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 |
|---|---|---|---|---|---|---|---|---|---|---|
pip-services3-java/pip-services3-components-java | src/org/pipservices3/components/config/JsonConfigReader.java | JsonConfigReader.readConfig | @Override
public ConfigParams readConfig(String correlationId, ConfigParams parameters) throws ApplicationException {
Object value = readObject(correlationId, parameters);
return ConfigParams.fromValue(value);
} | java | @Override
public ConfigParams readConfig(String correlationId, ConfigParams parameters) throws ApplicationException {
Object value = readObject(correlationId, parameters);
return ConfigParams.fromValue(value);
} | [
"@",
"Override",
"public",
"ConfigParams",
"readConfig",
"(",
"String",
"correlationId",
",",
"ConfigParams",
"parameters",
")",
"throws",
"ApplicationException",
"{",
"Object",
"value",
"=",
"readObject",
"(",
"correlationId",
",",
"parameters",
")",
";",
"return",... | Reads configuration and parameterize it with given values.
@param correlationId (optional) transaction id to trace execution through
call chain.
@param parameters values to parameters the configuration
@return ConfigParams configuration.
@throws ApplicationException when error occured. | [
"Reads",
"configuration",
"and",
"parameterize",
"it",
"with",
"given",
"values",
"."
] | train | https://github.com/pip-services3-java/pip-services3-components-java/blob/122352fbf9b208f6417376da7b8ad725bc85ee58/src/org/pipservices3/components/config/JsonConfigReader.java#L98-L102 |
line/armeria | thrift/src/main/java/com/linecorp/armeria/server/thrift/THttpService.java | THttpService.newDecorator | public static Function<Service<RpcRequest, RpcResponse>, THttpService> newDecorator(
SerializationFormat defaultSerializationFormat) {
final SerializationFormat[] allowedSerializationFormatArray = newAllowedSerializationFormats(
defaultSerializationFormat,
ThriftSerializationFormats.values());
return delegate -> new THttpService(delegate, allowedSerializationFormatArray);
} | java | public static Function<Service<RpcRequest, RpcResponse>, THttpService> newDecorator(
SerializationFormat defaultSerializationFormat) {
final SerializationFormat[] allowedSerializationFormatArray = newAllowedSerializationFormats(
defaultSerializationFormat,
ThriftSerializationFormats.values());
return delegate -> new THttpService(delegate, allowedSerializationFormatArray);
} | [
"public",
"static",
"Function",
"<",
"Service",
"<",
"RpcRequest",
",",
"RpcResponse",
">",
",",
"THttpService",
">",
"newDecorator",
"(",
"SerializationFormat",
"defaultSerializationFormat",
")",
"{",
"final",
"SerializationFormat",
"[",
"]",
"allowedSerializationForma... | Creates a new decorator that supports all thrift protocols and defaults to the specified
{@code defaultSerializationFormat} when the client doesn't specify one.
Currently, the only way to specify a serialization format is by using the HTTP session
protocol and setting the Content-Type header to the appropriate {@link SerializationFormat#mediaType()}.
@param defaultSerializationFormat the default serialization format to use when not specified by the
client | [
"Creates",
"a",
"new",
"decorator",
"that",
"supports",
"all",
"thrift",
"protocols",
"and",
"defaults",
"to",
"the",
"specified",
"{",
"@code",
"defaultSerializationFormat",
"}",
"when",
"the",
"client",
"doesn",
"t",
"specify",
"one",
".",
"Currently",
"the",
... | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/thrift/src/main/java/com/linecorp/armeria/server/thrift/THttpService.java#L292-L300 |
mfornos/humanize | humanize-slim/src/main/java/humanize/Humanize.java | Humanize.fixLength | public static String fixLength(final String text, final int charsNum, final char paddingChar, final boolean left)
{
Preconditions.checkArgument(charsNum > 0, "The number of characters must be greater than zero.");
String str = text == null ? "" : text;
String fmt = String.format("%%%ss", left ? charsNum : -charsNum);
return String.format(fmt, str).substring(0, charsNum).replace(' ', paddingChar);
} | java | public static String fixLength(final String text, final int charsNum, final char paddingChar, final boolean left)
{
Preconditions.checkArgument(charsNum > 0, "The number of characters must be greater than zero.");
String str = text == null ? "" : text;
String fmt = String.format("%%%ss", left ? charsNum : -charsNum);
return String.format(fmt, str).substring(0, charsNum).replace(' ', paddingChar);
} | [
"public",
"static",
"String",
"fixLength",
"(",
"final",
"String",
"text",
",",
"final",
"int",
"charsNum",
",",
"final",
"char",
"paddingChar",
",",
"final",
"boolean",
"left",
")",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"charsNum",
">",
"0",
",",... | <p>
Pads or truncates a string to a specified length.
</p>
@param text
String to be fixed
@param charsNum
The fixed length in number of chars
@param paddingChar
The padding character
@param left
true for left padding
@return A fixed length string | [
"<p",
">",
"Pads",
"or",
"truncates",
"a",
"string",
"to",
"a",
"specified",
"length",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/mfornos/humanize/blob/59fc103045de9d217c9e77dbcb7621f992f46c63/humanize-slim/src/main/java/humanize/Humanize.java#L822-L830 |
Azure/azure-sdk-for-java | recoveryservices.backup/resource-manager/v2017_07_01/src/main/java/com/microsoft/azure/management/recoveryservices/backup/v2017_07_01/implementation/BackupWorkloadItemsInner.java | BackupWorkloadItemsInner.listAsync | public Observable<Page<WorkloadItemResourceInner>> listAsync(final String vaultName, final String resourceGroupName, final String fabricName, final String containerName) {
return listWithServiceResponseAsync(vaultName, resourceGroupName, fabricName, containerName)
.map(new Func1<ServiceResponse<Page<WorkloadItemResourceInner>>, Page<WorkloadItemResourceInner>>() {
@Override
public Page<WorkloadItemResourceInner> call(ServiceResponse<Page<WorkloadItemResourceInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<WorkloadItemResourceInner>> listAsync(final String vaultName, final String resourceGroupName, final String fabricName, final String containerName) {
return listWithServiceResponseAsync(vaultName, resourceGroupName, fabricName, containerName)
.map(new Func1<ServiceResponse<Page<WorkloadItemResourceInner>>, Page<WorkloadItemResourceInner>>() {
@Override
public Page<WorkloadItemResourceInner> call(ServiceResponse<Page<WorkloadItemResourceInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"WorkloadItemResourceInner",
">",
">",
"listAsync",
"(",
"final",
"String",
"vaultName",
",",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"fabricName",
",",
"final",
"String",
"containerName",
")",
"{",... | Provides a pageable list of workload item of a specific container according to the query filter and the pagination parameters.
@param vaultName The name of the recovery services vault.
@param resourceGroupName The name of the resource group where the recovery services vault is present.
@param fabricName Fabric name associated with the container.
@param containerName Name of the container.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<WorkloadItemResourceInner> object | [
"Provides",
"a",
"pageable",
"list",
"of",
"workload",
"item",
"of",
"a",
"specific",
"container",
"according",
"to",
"the",
"query",
"filter",
"and",
"the",
"pagination",
"parameters",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/recoveryservices.backup/resource-manager/v2017_07_01/src/main/java/com/microsoft/azure/management/recoveryservices/backup/v2017_07_01/implementation/BackupWorkloadItemsInner.java#L124-L132 |
EdwardRaff/JSAT | JSAT/src/jsat/utils/ListUtils.java | ListUtils.randomSample | public static <T> void randomSample(List<T> source, List<T> dest, int samples)
{
randomSample(source, dest, samples, RandomUtil.getRandom());
} | java | public static <T> void randomSample(List<T> source, List<T> dest, int samples)
{
randomSample(source, dest, samples, RandomUtil.getRandom());
} | [
"public",
"static",
"<",
"T",
">",
"void",
"randomSample",
"(",
"List",
"<",
"T",
">",
"source",
",",
"List",
"<",
"T",
">",
"dest",
",",
"int",
"samples",
")",
"{",
"randomSample",
"(",
"source",
",",
"dest",
",",
"samples",
",",
"RandomUtil",
".",
... | Obtains a random sample without replacement from a source list and places
it in the destination list. This is done without modifying the source list.
@param <T> the list content type involved
@param source the source of values to randomly sample from
@param dest the list to store the random samples in. The list does not
need to be empty for the sampling to work correctly
@param samples the number of samples to select from the source
@throws IllegalArgumentException if the sample size is not positive or l
arger than the source population. | [
"Obtains",
"a",
"random",
"sample",
"without",
"replacement",
"from",
"a",
"source",
"list",
"and",
"places",
"it",
"in",
"the",
"destination",
"list",
".",
"This",
"is",
"done",
"without",
"modifying",
"the",
"source",
"list",
"."
] | train | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/utils/ListUtils.java#L237-L240 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SameDiff.java | SameDiff.addPropertyToResolve | public void addPropertyToResolve(DifferentialFunction forFunction, String arrayName) {
if (!propertiesToResolve.containsKey(forFunction.getOwnName())) {
List<String> newVal = new ArrayList<>();
newVal.add(arrayName);
propertiesToResolve.put(forFunction.getOwnName(), newVal);
} else {
List<String> newVal = propertiesToResolve.get(forFunction.getOwnName());
newVal.add(arrayName);
}
} | java | public void addPropertyToResolve(DifferentialFunction forFunction, String arrayName) {
if (!propertiesToResolve.containsKey(forFunction.getOwnName())) {
List<String> newVal = new ArrayList<>();
newVal.add(arrayName);
propertiesToResolve.put(forFunction.getOwnName(), newVal);
} else {
List<String> newVal = propertiesToResolve.get(forFunction.getOwnName());
newVal.add(arrayName);
}
} | [
"public",
"void",
"addPropertyToResolve",
"(",
"DifferentialFunction",
"forFunction",
",",
"String",
"arrayName",
")",
"{",
"if",
"(",
"!",
"propertiesToResolve",
".",
"containsKey",
"(",
"forFunction",
".",
"getOwnName",
"(",
")",
")",
")",
"{",
"List",
"<",
... | Adds a property that needs to be resolve for later.
These variables are typically values that are arrays
that are named but have an unknown value till execution time.
<p>
This is very common for model import.
@param forFunction the function to add the property to resolve for
@param arrayName the array name | [
"Adds",
"a",
"property",
"that",
"needs",
"to",
"be",
"resolve",
"for",
"later",
".",
"These",
"variables",
"are",
"typically",
"values",
"that",
"are",
"arrays",
"that",
"are",
"named",
"but",
"have",
"an",
"unknown",
"value",
"till",
"execution",
"time",
... | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SameDiff.java#L975-L984 |
Azure/azure-sdk-for-java | devspaces/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/devspaces/v2018_06_01_preview/implementation/ControllersInner.java | ControllersInner.listConnectionDetails | public ControllerConnectionDetailsListInner listConnectionDetails(String resourceGroupName, String name) {
return listConnectionDetailsWithServiceResponseAsync(resourceGroupName, name).toBlocking().single().body();
} | java | public ControllerConnectionDetailsListInner listConnectionDetails(String resourceGroupName, String name) {
return listConnectionDetailsWithServiceResponseAsync(resourceGroupName, name).toBlocking().single().body();
} | [
"public",
"ControllerConnectionDetailsListInner",
"listConnectionDetails",
"(",
"String",
"resourceGroupName",
",",
"String",
"name",
")",
"{",
"return",
"listConnectionDetailsWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"name",
")",
".",
"toBlocking",
"(",
")"... | Lists connection details for an Azure Dev Spaces Controller.
Lists connection details for the underlying container resources of an Azure Dev Spaces Controller.
@param resourceGroupName Resource group to which the resource belongs.
@param name Name of the resource.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the ControllerConnectionDetailsListInner object if successful. | [
"Lists",
"connection",
"details",
"for",
"an",
"Azure",
"Dev",
"Spaces",
"Controller",
".",
"Lists",
"connection",
"details",
"for",
"the",
"underlying",
"container",
"resources",
"of",
"an",
"Azure",
"Dev",
"Spaces",
"Controller",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/devspaces/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/devspaces/v2018_06_01_preview/implementation/ControllersInner.java#L976-L978 |
FlyingHe/UtilsMaven | src/main/java/com/github/flyinghe/tools/DBUtils.java | DBUtils.transformMapListToBeanList | private static <T> List<T> transformMapListToBeanList(Class<T> clazz, List<Map<String, Object>> listProperties)
throws InstantiationException, IllegalAccessException, InvocationTargetException {
// 存放被实例化的T类对象
T bean = null;
// 存放所有被实例化的对象
List<T> list = new ArrayList<T>();
// 将实例化的对象放入List数组中
if (listProperties.size() != 0) {
Iterator<Map<String, Object>> iter = listProperties.iterator();
while (iter.hasNext()) {
// 实例化T类对象
bean = clazz.newInstance();
// 遍历每条记录的字段,并给T类实例化对象属性赋值
for (Map.Entry<String, Object> entry : iter.next().entrySet()) {
BeanUtils.setProperty(bean, entry.getKey(), entry.getValue());
}
// 将赋过值的T类对象放入数组中
list.add(bean);
}
}
return list;
} | java | private static <T> List<T> transformMapListToBeanList(Class<T> clazz, List<Map<String, Object>> listProperties)
throws InstantiationException, IllegalAccessException, InvocationTargetException {
// 存放被实例化的T类对象
T bean = null;
// 存放所有被实例化的对象
List<T> list = new ArrayList<T>();
// 将实例化的对象放入List数组中
if (listProperties.size() != 0) {
Iterator<Map<String, Object>> iter = listProperties.iterator();
while (iter.hasNext()) {
// 实例化T类对象
bean = clazz.newInstance();
// 遍历每条记录的字段,并给T类实例化对象属性赋值
for (Map.Entry<String, Object> entry : iter.next().entrySet()) {
BeanUtils.setProperty(bean, entry.getKey(), entry.getValue());
}
// 将赋过值的T类对象放入数组中
list.add(bean);
}
}
return list;
} | [
"private",
"static",
"<",
"T",
">",
"List",
"<",
"T",
">",
"transformMapListToBeanList",
"(",
"Class",
"<",
"T",
">",
"clazz",
",",
"List",
"<",
"Map",
"<",
"String",
",",
"Object",
">",
">",
"listProperties",
")",
"throws",
"InstantiationException",
",",
... | 将所有记录包装成T类对象,并将所有T类对象放入一个数组中并返回,传入的T类的定义必须符合JavaBean规范,
因为本函数是调用T类对象的setter器来给对象赋值的
@param clazz T类的类对象
@param listProperties 所有记录
@return 返回所有被实例化的对象的数组,若没有对象,返回一个空数组
@throws InstantiationException
@throws IllegalAccessException
@throws InvocationTargetException | [
"将所有记录包装成T类对象,并将所有T类对象放入一个数组中并返回,传入的T类的定义必须符合JavaBean规范,",
"因为本函数是调用T类对象的setter器来给对象赋值的"
] | train | https://github.com/FlyingHe/UtilsMaven/blob/d9605b7bfe0c28a05289252e12d163e114080b4a/src/main/java/com/github/flyinghe/tools/DBUtils.java#L181-L203 |
alkacon/opencms-core | src/org/opencms/ui/apps/git/CmsGitCheckin.java | CmsGitCheckin.addConfigurationIfValid | private void addConfigurationIfValid(final Collection<CmsGitConfiguration> configurations, final File configFile) {
CmsGitConfiguration config = null;
try {
if (configFile.isFile()) {
config = new CmsGitConfiguration(configFile);
if (config.isValid()) {
configurations.add(config);
} else {
throw new Exception(
"Could not read git configuration file" + config.getConfigurationFile().getAbsolutePath());
}
}
} catch (NullPointerException npe) {
LOG.error("Could not read git configuration.", npe);
} catch (Exception e) {
String file = (null != config)
&& (null != config.getConfigurationFile())
&& (null != config.getConfigurationFile().getAbsolutePath())
? config.getConfigurationFile().getAbsolutePath()
: "<unknown>";
LOG.warn("Trying to read invalid git configuration from " + file + ".", e);
}
} | java | private void addConfigurationIfValid(final Collection<CmsGitConfiguration> configurations, final File configFile) {
CmsGitConfiguration config = null;
try {
if (configFile.isFile()) {
config = new CmsGitConfiguration(configFile);
if (config.isValid()) {
configurations.add(config);
} else {
throw new Exception(
"Could not read git configuration file" + config.getConfigurationFile().getAbsolutePath());
}
}
} catch (NullPointerException npe) {
LOG.error("Could not read git configuration.", npe);
} catch (Exception e) {
String file = (null != config)
&& (null != config.getConfigurationFile())
&& (null != config.getConfigurationFile().getAbsolutePath())
? config.getConfigurationFile().getAbsolutePath()
: "<unknown>";
LOG.warn("Trying to read invalid git configuration from " + file + ".", e);
}
} | [
"private",
"void",
"addConfigurationIfValid",
"(",
"final",
"Collection",
"<",
"CmsGitConfiguration",
">",
"configurations",
",",
"final",
"File",
"configFile",
")",
"{",
"CmsGitConfiguration",
"config",
"=",
"null",
";",
"try",
"{",
"if",
"(",
"configFile",
".",
... | Adds the configuration from <code>configFile</code> to the {@link Collection} of {@link CmsGitConfiguration},
if a valid configuration is read. Otherwise it logs the failure.
@param configurations Collection of configurations where the new configuration should be added.
@param configFile file to read the new configuration from. | [
"Adds",
"the",
"configuration",
"from",
"<code",
">",
"configFile<",
"/",
"code",
">",
"to",
"the",
"{"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/git/CmsGitCheckin.java#L529-L552 |
jeremylong/DependencyCheck | maven/src/main/java/org/owasp/dependencycheck/maven/BaseDependencyCheckMojo.java | BaseDependencyCheckMojo.isEqualOrNull | private static boolean isEqualOrNull(String left, String right) {
return (left != null && left.equals(right)) || (left == null && right == null);
} | java | private static boolean isEqualOrNull(String left, String right) {
return (left != null && left.equals(right)) || (left == null && right == null);
} | [
"private",
"static",
"boolean",
"isEqualOrNull",
"(",
"String",
"left",
",",
"String",
"right",
")",
"{",
"return",
"(",
"left",
"!=",
"null",
"&&",
"left",
".",
"equals",
"(",
"right",
")",
")",
"||",
"(",
"left",
"==",
"null",
"&&",
"right",
"==",
... | Compares two strings for equality; if both strings are null they are
considered equal.
@param left the first string to compare
@param right the second string to compare
@return true if the strings are equal or if they are both null; otherwise
false. | [
"Compares",
"two",
"strings",
"for",
"equality",
";",
"if",
"both",
"strings",
"are",
"null",
"they",
"are",
"considered",
"equal",
"."
] | train | https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/maven/src/main/java/org/owasp/dependencycheck/maven/BaseDependencyCheckMojo.java#L698-L700 |
molgenis/molgenis | molgenis-dataexplorer/src/main/java/org/molgenis/dataexplorer/negotiator/NegotiatorController.java | NegotiatorController.generateBase64Authentication | private static String generateBase64Authentication(String username, String password) {
requireNonNull(username, password);
String userPass = username + ":" + password;
String userPassBase64 = Base64.getEncoder().encodeToString(userPass.getBytes(UTF_8));
return "Basic " + userPassBase64;
} | java | private static String generateBase64Authentication(String username, String password) {
requireNonNull(username, password);
String userPass = username + ":" + password;
String userPassBase64 = Base64.getEncoder().encodeToString(userPass.getBytes(UTF_8));
return "Basic " + userPassBase64;
} | [
"private",
"static",
"String",
"generateBase64Authentication",
"(",
"String",
"username",
",",
"String",
"password",
")",
"{",
"requireNonNull",
"(",
"username",
",",
"password",
")",
";",
"String",
"userPass",
"=",
"username",
"+",
"\":\"",
"+",
"password",
";"... | Generate base64 authentication based on username and password.
@return Authentication header value. | [
"Generate",
"base64",
"authentication",
"based",
"on",
"username",
"and",
"password",
"."
] | train | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-dataexplorer/src/main/java/org/molgenis/dataexplorer/negotiator/NegotiatorController.java#L270-L275 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateFormat.java | DateFormat.getDateInstance | public final static DateFormat getDateInstance(int style)
{
return get(style, -1, ULocale.getDefault(Category.FORMAT), null);
} | java | public final static DateFormat getDateInstance(int style)
{
return get(style, -1, ULocale.getDefault(Category.FORMAT), null);
} | [
"public",
"final",
"static",
"DateFormat",
"getDateInstance",
"(",
"int",
"style",
")",
"{",
"return",
"get",
"(",
"style",
",",
"-",
"1",
",",
"ULocale",
".",
"getDefault",
"(",
"Category",
".",
"FORMAT",
")",
",",
"null",
")",
";",
"}"
] | Returns the date formatter with the given formatting style
for the default <code>FORMAT</code> locale.
@param style the given formatting style. For example,
SHORT for "M/d/yy" in the US locale. As currently implemented, relative date
formatting only affects a limited range of calendar days before or after the
current date, based on the CLDR <field type="day">/<relative> data: For example,
in English, "Yesterday", "Today", and "Tomorrow". Outside of this range, relative
dates are formatted using the corresponding non-relative style.
@return a date formatter.
@see Category#FORMAT | [
"Returns",
"the",
"date",
"formatter",
"with",
"the",
"given",
"formatting",
"style",
"for",
"the",
"default",
"<code",
">",
"FORMAT<",
"/",
"code",
">",
"locale",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateFormat.java#L1299-L1302 |
querydsl/querydsl | querydsl-core/src/main/java/com/querydsl/core/types/dsl/Expressions.java | Expressions.stringTemplate | public static StringTemplate stringTemplate(Template template, List<?> args) {
return new StringTemplate(template, ImmutableList.copyOf(args));
} | java | public static StringTemplate stringTemplate(Template template, List<?> args) {
return new StringTemplate(template, ImmutableList.copyOf(args));
} | [
"public",
"static",
"StringTemplate",
"stringTemplate",
"(",
"Template",
"template",
",",
"List",
"<",
"?",
">",
"args",
")",
"{",
"return",
"new",
"StringTemplate",
"(",
"template",
",",
"ImmutableList",
".",
"copyOf",
"(",
"args",
")",
")",
";",
"}"
] | Create a new Template 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#L949-L951 |
defei/codelogger-utils | src/main/java/org/codelogger/utils/StringUtils.java | StringUtils.containsIgnoreCase | public static boolean containsIgnoreCase(final String source, final String target) {
if (source != null && target != null) {
return indexOfIgnoreCase(source, target) != INDEX_OF_NOT_FOUND;
} else {
return false;
}
} | java | public static boolean containsIgnoreCase(final String source, final String target) {
if (source != null && target != null) {
return indexOfIgnoreCase(source, target) != INDEX_OF_NOT_FOUND;
} else {
return false;
}
} | [
"public",
"static",
"boolean",
"containsIgnoreCase",
"(",
"final",
"String",
"source",
",",
"final",
"String",
"target",
")",
"{",
"if",
"(",
"source",
"!=",
"null",
"&&",
"target",
"!=",
"null",
")",
"{",
"return",
"indexOfIgnoreCase",
"(",
"source",
",",
... | Returns true if given string contains given target string ignore case,
false otherwise.<br>
@param source string to be tested.
@param target string to be tested.
@return true if given string contains given target string ignore case,
false otherwise. | [
"Returns",
"true",
"if",
"given",
"string",
"contains",
"given",
"target",
"string",
"ignore",
"case",
"false",
"otherwise",
".",
"<br",
">"
] | train | https://github.com/defei/codelogger-utils/blob/d906f5d217b783c7ae3e53442cd6fb87b20ecc0a/src/main/java/org/codelogger/utils/StringUtils.java#L186-L193 |
TakahikoKawasaki/nv-websocket-client | src/main/java/com/neovisionaries/ws/client/WebSocketFrame.java | WebSocketFrame.setCloseFramePayload | public WebSocketFrame setCloseFramePayload(int closeCode, String reason)
{
// Convert the close code to a 2-byte unsigned integer
// in network byte order.
byte[] encodedCloseCode = new byte[] {
(byte)((closeCode >> 8) & 0xFF),
(byte)((closeCode ) & 0xFF)
};
// If a reason string is not given.
if (reason == null || reason.length() == 0)
{
// Use the close code only.
return setPayload(encodedCloseCode);
}
// Convert the reason into a byte array.
byte[] encodedReason = Misc.getBytesUTF8(reason);
// Concatenate the close code and the reason.
byte[] payload = new byte[2 + encodedReason.length];
System.arraycopy(encodedCloseCode, 0, payload, 0, 2);
System.arraycopy(encodedReason, 0, payload, 2, encodedReason.length);
// Use the concatenated string.
return setPayload(payload);
} | java | public WebSocketFrame setCloseFramePayload(int closeCode, String reason)
{
// Convert the close code to a 2-byte unsigned integer
// in network byte order.
byte[] encodedCloseCode = new byte[] {
(byte)((closeCode >> 8) & 0xFF),
(byte)((closeCode ) & 0xFF)
};
// If a reason string is not given.
if (reason == null || reason.length() == 0)
{
// Use the close code only.
return setPayload(encodedCloseCode);
}
// Convert the reason into a byte array.
byte[] encodedReason = Misc.getBytesUTF8(reason);
// Concatenate the close code and the reason.
byte[] payload = new byte[2 + encodedReason.length];
System.arraycopy(encodedCloseCode, 0, payload, 0, 2);
System.arraycopy(encodedReason, 0, payload, 2, encodedReason.length);
// Use the concatenated string.
return setPayload(payload);
} | [
"public",
"WebSocketFrame",
"setCloseFramePayload",
"(",
"int",
"closeCode",
",",
"String",
"reason",
")",
"{",
"// Convert the close code to a 2-byte unsigned integer",
"// in network byte order.",
"byte",
"[",
"]",
"encodedCloseCode",
"=",
"new",
"byte",
"[",
"]",
"{",
... | Set the payload that conforms to the payload format of close frames.
<p>
The given parameters are encoded based on the rules described in
"<a href="http://tools.ietf.org/html/rfc6455#section-5.5.1"
>5.5.1. Close</a>" of RFC 6455.
</p>
<p>
Note that the reason should not be too long because the payload
length of a <a href="http://tools.ietf.org/html/rfc6455#section-5.5"
>control frame</a> must be 125 bytes or less.
</p>
@param closeCode
The close code.
@param reason
The reason. {@code null} is accepted. An empty string
is treated in the same way as {@code null}.
@return
{@code this} object.
@see <a href="http://tools.ietf.org/html/rfc6455#section-5.5.1"
>RFC 6455, 5.5.1. Close</a>
@see WebSocketCloseCode | [
"Set",
"the",
"payload",
"that",
"conforms",
"to",
"the",
"payload",
"format",
"of",
"close",
"frames",
"."
] | train | https://github.com/TakahikoKawasaki/nv-websocket-client/blob/efaec21181d740ad3808313acf679313179e0825/src/main/java/com/neovisionaries/ws/client/WebSocketFrame.java#L559-L585 |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/bos/BosClient.java | BosClient.fetchObject | public FetchObjectResponse fetchObject(String bucketName, String key, String sourceUrl) {
FetchObjectRequest request = new FetchObjectRequest(bucketName, key, sourceUrl);
return this.fetchObject(request);
} | java | public FetchObjectResponse fetchObject(String bucketName, String key, String sourceUrl) {
FetchObjectRequest request = new FetchObjectRequest(bucketName, key, sourceUrl);
return this.fetchObject(request);
} | [
"public",
"FetchObjectResponse",
"fetchObject",
"(",
"String",
"bucketName",
",",
"String",
"key",
",",
"String",
"sourceUrl",
")",
"{",
"FetchObjectRequest",
"request",
"=",
"new",
"FetchObjectRequest",
"(",
"bucketName",
",",
"key",
",",
"sourceUrl",
")",
";",
... | Fetches a source object to a new destination in Bos.
@param bucketName The name of the bucket in which the new object will be created.
@param key The key in the destination bucket under which the new object will be created.
@param sourceUrl The url full path for fetching.
@return A FetchObjectResponse object containing the information returned by Bos for the newly fetching. | [
"Fetches",
"a",
"source",
"object",
"to",
"a",
"new",
"destination",
"in",
"Bos",
"."
] | train | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bos/BosClient.java#L1005-L1008 |
DiUS/pact-jvm | pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslJsonArray.java | PactDslJsonArray.arrayMaxLike | public static PactDslJsonBody arrayMaxLike(int maxSize, int numberExamples) {
if (numberExamples > maxSize) {
throw new IllegalArgumentException(String.format("Number of example %d is more than the maximum size of %d",
numberExamples, maxSize));
}
PactDslJsonArray parent = new PactDslJsonArray("", "", null, true);
parent.setNumberExamples(numberExamples);
parent.matchers.addRule("", parent.matchMax(maxSize));
return new PactDslJsonBody(".", "", parent);
} | java | public static PactDslJsonBody arrayMaxLike(int maxSize, int numberExamples) {
if (numberExamples > maxSize) {
throw new IllegalArgumentException(String.format("Number of example %d is more than the maximum size of %d",
numberExamples, maxSize));
}
PactDslJsonArray parent = new PactDslJsonArray("", "", null, true);
parent.setNumberExamples(numberExamples);
parent.matchers.addRule("", parent.matchMax(maxSize));
return new PactDslJsonBody(".", "", parent);
} | [
"public",
"static",
"PactDslJsonBody",
"arrayMaxLike",
"(",
"int",
"maxSize",
",",
"int",
"numberExamples",
")",
"{",
"if",
"(",
"numberExamples",
">",
"maxSize",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"String",
".",
"format",
"(",
"\"Number ... | Array with a maximum size where each item must match the following example
@param maxSize maximum size
@param numberExamples Number of examples to generate | [
"Array",
"with",
"a",
"maximum",
"size",
"where",
"each",
"item",
"must",
"match",
"the",
"following",
"example"
] | train | https://github.com/DiUS/pact-jvm/blob/2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef/pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslJsonArray.java#L827-L836 |
sarl/sarl | contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyGenerator.java | PyGenerator._generate | protected void _generate(SarlSkill skill, IExtraLanguageGeneratorContext context) {
final JvmDeclaredType jvmType = getJvmModelAssociations().getInferredType(skill);
final PyAppendable appendable = createAppendable(jvmType, context);
List<JvmTypeReference> superTypes = getSuperTypes(skill.getExtends(), skill.getImplements());
if (superTypes.isEmpty()) {
superTypes = Collections.singletonList(getTypeReferences().getTypeForName(Skill.class, skill));
}
final String qualifiedName = this.qualifiedNameProvider.getFullyQualifiedName(skill).toString();
if (generateTypeDeclaration(
qualifiedName,
skill.getName(), skill.isAbstract(), superTypes,
getTypeBuilder().getDocumentation(skill),
true,
skill.getMembers(), appendable, context, (it, context2) -> {
generateGuardEvaluators(qualifiedName, it, context2);
})) {
final QualifiedName name = getQualifiedNameProvider().getFullyQualifiedName(skill);
writeFile(name, appendable, context);
}
} | java | protected void _generate(SarlSkill skill, IExtraLanguageGeneratorContext context) {
final JvmDeclaredType jvmType = getJvmModelAssociations().getInferredType(skill);
final PyAppendable appendable = createAppendable(jvmType, context);
List<JvmTypeReference> superTypes = getSuperTypes(skill.getExtends(), skill.getImplements());
if (superTypes.isEmpty()) {
superTypes = Collections.singletonList(getTypeReferences().getTypeForName(Skill.class, skill));
}
final String qualifiedName = this.qualifiedNameProvider.getFullyQualifiedName(skill).toString();
if (generateTypeDeclaration(
qualifiedName,
skill.getName(), skill.isAbstract(), superTypes,
getTypeBuilder().getDocumentation(skill),
true,
skill.getMembers(), appendable, context, (it, context2) -> {
generateGuardEvaluators(qualifiedName, it, context2);
})) {
final QualifiedName name = getQualifiedNameProvider().getFullyQualifiedName(skill);
writeFile(name, appendable, context);
}
} | [
"protected",
"void",
"_generate",
"(",
"SarlSkill",
"skill",
",",
"IExtraLanguageGeneratorContext",
"context",
")",
"{",
"final",
"JvmDeclaredType",
"jvmType",
"=",
"getJvmModelAssociations",
"(",
")",
".",
"getInferredType",
"(",
"skill",
")",
";",
"final",
"PyAppe... | Generate the given object.
@param skill the skill.
@param context the context. | [
"Generate",
"the",
"given",
"object",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyGenerator.java#L850-L870 |
moparisthebest/beehive | beehive-netui-compiler/src/main/java/org/apache/beehive/netui/compiler/CompilerUtils.java | CompilerUtils.getFormClassName | public static String getFormClassName( TypeDeclaration jclass, CoreAnnotationProcessorEnv env )
{
if ( isAssignableFrom( STRUTS_FORM_CLASS_NAME, jclass, env ) )
{
return getLoadableName( jclass );
}
else if ( isAssignableFrom( BEA_XMLOBJECT_CLASS_NAME, jclass, env ) )
{
return XML_FORM_CLASS_NAME;
}
else if ( isAssignableFrom( APACHE_XMLOBJECT_CLASS_NAME, jclass, env ) )
{
return XML_FORM_CLASS_NAME;
}
else
{
return ANY_FORM_CLASS_NAME;
}
} | java | public static String getFormClassName( TypeDeclaration jclass, CoreAnnotationProcessorEnv env )
{
if ( isAssignableFrom( STRUTS_FORM_CLASS_NAME, jclass, env ) )
{
return getLoadableName( jclass );
}
else if ( isAssignableFrom( BEA_XMLOBJECT_CLASS_NAME, jclass, env ) )
{
return XML_FORM_CLASS_NAME;
}
else if ( isAssignableFrom( APACHE_XMLOBJECT_CLASS_NAME, jclass, env ) )
{
return XML_FORM_CLASS_NAME;
}
else
{
return ANY_FORM_CLASS_NAME;
}
} | [
"public",
"static",
"String",
"getFormClassName",
"(",
"TypeDeclaration",
"jclass",
",",
"CoreAnnotationProcessorEnv",
"env",
")",
"{",
"if",
"(",
"isAssignableFrom",
"(",
"STRUTS_FORM_CLASS_NAME",
",",
"jclass",
",",
"env",
")",
")",
"{",
"return",
"getLoadableName... | Get a Class.forName-able string for the given type signature. | [
"Get",
"a",
"Class",
".",
"forName",
"-",
"able",
"string",
"for",
"the",
"given",
"type",
"signature",
"."
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-compiler/src/main/java/org/apache/beehive/netui/compiler/CompilerUtils.java#L548-L566 |
netty/netty | codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java | HttpHeaders.addIntHeader | @Deprecated
public static void addIntHeader(HttpMessage message, String name, int value) {
message.headers().add(name, value);
} | java | @Deprecated
public static void addIntHeader(HttpMessage message, String name, int value) {
message.headers().add(name, value);
} | [
"@",
"Deprecated",
"public",
"static",
"void",
"addIntHeader",
"(",
"HttpMessage",
"message",
",",
"String",
"name",
",",
"int",
"value",
")",
"{",
"message",
".",
"headers",
"(",
")",
".",
"add",
"(",
"name",
",",
"value",
")",
";",
"}"
] | @deprecated Use {@link #add(CharSequence, Iterable)} instead.
@see #addIntHeader(HttpMessage, CharSequence, int) | [
"@deprecated",
"Use",
"{",
"@link",
"#add",
"(",
"CharSequence",
"Iterable",
")",
"}",
"instead",
"."
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java#L806-L809 |
powermock/powermock | powermock-api/powermock-api-easymock/src/main/java/org/powermock/api/easymock/PowerMock.java | PowerMock.createPartialMockForAllMethodsExcept | public static synchronized <T> T createPartialMockForAllMethodsExcept(Class<T> type, String... methodNames) {
if (methodNames != null && methodNames.length == 0) {
return createMock(type);
}
return createMock(type, WhiteboxImpl.getAllMethodExcept(type, methodNames));
} | java | public static synchronized <T> T createPartialMockForAllMethodsExcept(Class<T> type, String... methodNames) {
if (methodNames != null && methodNames.length == 0) {
return createMock(type);
}
return createMock(type, WhiteboxImpl.getAllMethodExcept(type, methodNames));
} | [
"public",
"static",
"synchronized",
"<",
"T",
">",
"T",
"createPartialMockForAllMethodsExcept",
"(",
"Class",
"<",
"T",
">",
"type",
",",
"String",
"...",
"methodNames",
")",
"{",
"if",
"(",
"methodNames",
"!=",
"null",
"&&",
"methodNames",
".",
"length",
"=... | A utility method that may be used to specify several methods that should
<i>not</i> be mocked in an easy manner (by just passing in the method
names of the method you wish <i>not</i> to mock). Note that you cannot
uniquely specify a method to exclude using this method if there are
several methods with the same name in {@code type}. This method will
mock ALL methods that doesn't match the supplied name(s) regardless of
parameter types and signature. If this is not the case you should
fall-back on using the {@link #createMock(Class, Method...)} method
instead.
@param <T> The type of the mock.
@param type The type that'll be used to create a mock instance.
@param methodNames The names of the methods that should be mocked. If
{@code null}, then this method will have the same effect
as just calling {@link #createMock(Class, Method...)} with the
second parameter as {@code new Method[0]} (i.e. all
methods in that class will be mocked).
@return A mock object of type <T>. | [
"A",
"utility",
"method",
"that",
"may",
"be",
"used",
"to",
"specify",
"several",
"methods",
"that",
"should",
"<i",
">",
"not<",
"/",
"i",
">",
"be",
"mocked",
"in",
"an",
"easy",
"manner",
"(",
"by",
"just",
"passing",
"in",
"the",
"method",
"names"... | train | https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-api/powermock-api-easymock/src/main/java/org/powermock/api/easymock/PowerMock.java#L320-L326 |
jpush/jmessage-api-java-client | src/main/java/cn/jmessage/api/user/UserClient.java | UserClient.forbidUser | public ResponseWrapper forbidUser(String username, boolean disable)
throws APIConnectionException, APIRequestException {
StringUtils.checkUsername(username);
return _httpClient.sendPut(_baseUrl + userPath + "/" + username + "/forbidden?disable=" + disable, null);
} | java | public ResponseWrapper forbidUser(String username, boolean disable)
throws APIConnectionException, APIRequestException {
StringUtils.checkUsername(username);
return _httpClient.sendPut(_baseUrl + userPath + "/" + username + "/forbidden?disable=" + disable, null);
} | [
"public",
"ResponseWrapper",
"forbidUser",
"(",
"String",
"username",
",",
"boolean",
"disable",
")",
"throws",
"APIConnectionException",
",",
"APIRequestException",
"{",
"StringUtils",
".",
"checkUsername",
"(",
"username",
")",
";",
"return",
"_httpClient",
".",
"... | Forbid or activate user
@param username username
@param disable true means forbid, false means activate
@return No content
@throws APIConnectionException connect exception
@throws APIRequestException request exception | [
"Forbid",
"or",
"activate",
"user"
] | train | https://github.com/jpush/jmessage-api-java-client/blob/767f5fb15e9fe5a546c00f6e68b64f6dd53c617c/src/main/java/cn/jmessage/api/user/UserClient.java#L376-L380 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/util/JsonUtil.java | JsonUtil.getObject | public static JsonObject getObject(JsonObject object, String field, JsonObject defaultValue) {
final JsonValue value = object.get(field);
if (value == null || value.isNull()) {
return defaultValue;
} else {
return value.asObject();
}
} | java | public static JsonObject getObject(JsonObject object, String field, JsonObject defaultValue) {
final JsonValue value = object.get(field);
if (value == null || value.isNull()) {
return defaultValue;
} else {
return value.asObject();
}
} | [
"public",
"static",
"JsonObject",
"getObject",
"(",
"JsonObject",
"object",
",",
"String",
"field",
",",
"JsonObject",
"defaultValue",
")",
"{",
"final",
"JsonValue",
"value",
"=",
"object",
".",
"get",
"(",
"field",
")",
";",
"if",
"(",
"value",
"==",
"nu... | Returns a field in a Json object as an object.
@param object the Json object
@param field the field in the Json object to return
@param defaultValue a default value for the field if the field value is null
@return the Json field value as a Json object | [
"Returns",
"a",
"field",
"in",
"a",
"Json",
"object",
"as",
"an",
"object",
"."
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/util/JsonUtil.java#L275-L282 |
couchbase/couchbase-lite-java | src/main/java/com/couchbase/lite/ArrayExpression.java | ArrayExpression.anyAndEvery | @NonNull
public static ArrayExpressionIn anyAndEvery(@NonNull VariableExpression variable) {
if (variable == null) {
throw new IllegalArgumentException("variable cannot be null.");
}
return new ArrayExpressionIn(QuantifiesType.ANY_AND_EVERY, variable);
} | java | @NonNull
public static ArrayExpressionIn anyAndEvery(@NonNull VariableExpression variable) {
if (variable == null) {
throw new IllegalArgumentException("variable cannot be null.");
}
return new ArrayExpressionIn(QuantifiesType.ANY_AND_EVERY, variable);
} | [
"@",
"NonNull",
"public",
"static",
"ArrayExpressionIn",
"anyAndEvery",
"(",
"@",
"NonNull",
"VariableExpression",
"variable",
")",
"{",
"if",
"(",
"variable",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"variable cannot be null.\"",
"... | Creates an ANY AND EVERY Quantified operator (ANY AND EVERY <variable name> IN <expr>
SATISFIES <expr>) with the given variable name. The method returns an IN clause object
that is used for specifying an array object or an expression evaluated as an array object,
each of which will be evaluated against the satisfies expression.
The ANY AND EVERY operator returns TRUE if the array is NOT empty, and at least one of
the items in the array satisfies the given satisfies expression.
@param variable The variable expression.
@return An In object. | [
"Creates",
"an",
"ANY",
"AND",
"EVERY",
"Quantified",
"operator",
"(",
"ANY",
"AND",
"EVERY",
"<variable",
"name",
">",
"IN",
"<expr",
">",
"SATISFIES",
"<expr",
">",
")",
"with",
"the",
"given",
"variable",
"name",
".",
"The",
"method",
"returns",
"an",
... | train | https://github.com/couchbase/couchbase-lite-java/blob/cb72c44186456e6191a9ad0a7feb310011d0b081/src/main/java/com/couchbase/lite/ArrayExpression.java#L82-L88 |
line/armeria | core/src/main/java/com/linecorp/armeria/server/docs/DocServiceBuilder.java | DocServiceBuilder.exampleHttpHeaders | public DocServiceBuilder exampleHttpHeaders(String serviceName, String methodName,
Iterable<? extends HttpHeaders> exampleHttpHeaders) {
requireNonNull(serviceName, "serviceName");
checkArgument(!serviceName.isEmpty(), "serviceName is empty.");
requireNonNull(methodName, "methodName");
checkArgument(!methodName.isEmpty(), "methodName is empty.");
requireNonNull(exampleHttpHeaders, "exampleHttpHeaders");
return exampleHttpHeaders0(serviceName, methodName, exampleHttpHeaders);
} | java | public DocServiceBuilder exampleHttpHeaders(String serviceName, String methodName,
Iterable<? extends HttpHeaders> exampleHttpHeaders) {
requireNonNull(serviceName, "serviceName");
checkArgument(!serviceName.isEmpty(), "serviceName is empty.");
requireNonNull(methodName, "methodName");
checkArgument(!methodName.isEmpty(), "methodName is empty.");
requireNonNull(exampleHttpHeaders, "exampleHttpHeaders");
return exampleHttpHeaders0(serviceName, methodName, exampleHttpHeaders);
} | [
"public",
"DocServiceBuilder",
"exampleHttpHeaders",
"(",
"String",
"serviceName",
",",
"String",
"methodName",
",",
"Iterable",
"<",
"?",
"extends",
"HttpHeaders",
">",
"exampleHttpHeaders",
")",
"{",
"requireNonNull",
"(",
"serviceName",
",",
"\"serviceName\"",
")",... | Adds the example {@link HttpHeaders} for the method with the specified service and method name. | [
"Adds",
"the",
"example",
"{"
] | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/server/docs/DocServiceBuilder.java#L159-L167 |
vigna/Sux4J | src/it/unimi/dsi/sux4j/mph/HypergraphSorter.java | HypergraphSorter.generateAndSort | public boolean generateAndSort(final Iterator<? extends T> iterator, final TransformationStrategy<? super T> transform, final long seed) {
// We cache all variables for faster access
final int[] d = this.d;
final int[] e = new int[3];
cleanUpIfNecessary();
/* We build the XOR'd edge list and compute the degree of each vertex. */
for(int k = 0; k < numEdges; k++) {
bitVectorToEdge(transform.toBitVector(iterator.next()), seed, numVertices, partSize, e);
xorEdge(k, e[0], e[1], e[2], false);
d[e[0]]++;
d[e[1]]++;
d[e[2]]++;
}
if (iterator.hasNext()) throw new IllegalStateException("This " + HypergraphSorter.class.getSimpleName() + " has " + numEdges + " edges, but the provided iterator returns more");
return sort();
} | java | public boolean generateAndSort(final Iterator<? extends T> iterator, final TransformationStrategy<? super T> transform, final long seed) {
// We cache all variables for faster access
final int[] d = this.d;
final int[] e = new int[3];
cleanUpIfNecessary();
/* We build the XOR'd edge list and compute the degree of each vertex. */
for(int k = 0; k < numEdges; k++) {
bitVectorToEdge(transform.toBitVector(iterator.next()), seed, numVertices, partSize, e);
xorEdge(k, e[0], e[1], e[2], false);
d[e[0]]++;
d[e[1]]++;
d[e[2]]++;
}
if (iterator.hasNext()) throw new IllegalStateException("This " + HypergraphSorter.class.getSimpleName() + " has " + numEdges + " edges, but the provided iterator returns more");
return sort();
} | [
"public",
"boolean",
"generateAndSort",
"(",
"final",
"Iterator",
"<",
"?",
"extends",
"T",
">",
"iterator",
",",
"final",
"TransformationStrategy",
"<",
"?",
"super",
"T",
">",
"transform",
",",
"final",
"long",
"seed",
")",
"{",
"// We cache all variables for ... | Generates a random 3-hypergraph and tries to sort its edges.
@param iterator an iterator returning {@link #numEdges} keys.
@param transform a transformation from keys to bit vectors.
@param seed a 64-bit random seed.
@return true if the sorting procedure succeeded. | [
"Generates",
"a",
"random",
"3",
"-",
"hypergraph",
"and",
"tries",
"to",
"sort",
"its",
"edges",
"."
] | train | https://github.com/vigna/Sux4J/blob/d57de8fa897c7d273e0e6dae7a3274174f175a5f/src/it/unimi/dsi/sux4j/mph/HypergraphSorter.java#L312-L330 |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/alg/interpolate/ImageLineIntegral.java | ImageLineIntegral.isInside | public boolean isInside( double x, double y ) {
return x >= 0 && y >= 0 && x <= image.getWidth() && y <= image.getHeight();
} | java | public boolean isInside( double x, double y ) {
return x >= 0 && y >= 0 && x <= image.getWidth() && y <= image.getHeight();
} | [
"public",
"boolean",
"isInside",
"(",
"double",
"x",
",",
"double",
"y",
")",
"{",
"return",
"x",
">=",
"0",
"&&",
"y",
">=",
"0",
"&&",
"x",
"<=",
"image",
".",
"getWidth",
"(",
")",
"&&",
"y",
"<=",
"image",
".",
"getHeight",
"(",
")",
";",
"... | <p>
Return true if the coordinate is inside the image or false if not.<br>
0 ≤ x ≤ width<br>
0 ≤ y ≤ height
</p>
<p>Note: while the image is defined up to width and height, including coordinates up to that point contribute
nothing towards the line integral since they are infinitesimally small.</p>
@param x x-coordinate in pixel coordinates
@param y y-coordinate in pixel coordinates
@return true if inside or false if outside | [
"<p",
">",
"Return",
"true",
"if",
"the",
"coordinate",
"is",
"inside",
"the",
"image",
"or",
"false",
"if",
"not",
".",
"<br",
">",
"0",
"&le",
";",
"x",
"&le",
";",
"width<br",
">",
"0",
"&le",
";",
"y",
"&le",
";",
"height",
"<",
"/",
"p",
"... | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/interpolate/ImageLineIntegral.java#L185-L187 |
aloha-app/thrift-client-pool-java | src/main/java/com/wealoha/thrift/ThriftClientPool.java | ThriftClientPool.getClient | public ThriftClient<T> getClient() throws ThriftException {
try {
return pool.borrowObject();
} catch (Exception e) {
if (e instanceof ThriftException) {
throw (ThriftException) e;
}
throw new ThriftException("Get client from pool failed.", e);
}
} | java | public ThriftClient<T> getClient() throws ThriftException {
try {
return pool.borrowObject();
} catch (Exception e) {
if (e instanceof ThriftException) {
throw (ThriftException) e;
}
throw new ThriftException("Get client from pool failed.", e);
}
} | [
"public",
"ThriftClient",
"<",
"T",
">",
"getClient",
"(",
")",
"throws",
"ThriftException",
"{",
"try",
"{",
"return",
"pool",
".",
"borrowObject",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"if",
"(",
"e",
"instanceof",
"ThriftExcept... | get a client from pool
@return
@throws ThriftException
@throws NoBackendServiceException if
{@link PoolConfig#setFailover(boolean)} is set and no
service can connect to
@throws ConnectionFailException if
{@link PoolConfig#setFailover(boolean)} not set and
connection fail | [
"get",
"a",
"client",
"from",
"pool"
] | train | https://github.com/aloha-app/thrift-client-pool-java/blob/7781fc18f81ced14ea7b03d3ffd070c411c33a17/src/main/java/com/wealoha/thrift/ThriftClientPool.java#L232-L241 |
SeaCloudsEU/SeaCloudsPlatform | sla/sla-core/sla-service/src/main/java/eu/atos/sla/service/rest/SeacloudsRest.java | SeacloudsRest.getSlaUrl | private String getSlaUrl(String envSlaUrl, UriInfo uriInfo) {
String baseUrl = uriInfo.getBaseUri().toString();
if (envSlaUrl == null) {
envSlaUrl = "";
}
String result = ("".equals(envSlaUrl))? baseUrl : envSlaUrl;
logger.debug("getSlaUrl(env={}, supplied={}) = {}", envSlaUrl, baseUrl, result);
return result;
} | java | private String getSlaUrl(String envSlaUrl, UriInfo uriInfo) {
String baseUrl = uriInfo.getBaseUri().toString();
if (envSlaUrl == null) {
envSlaUrl = "";
}
String result = ("".equals(envSlaUrl))? baseUrl : envSlaUrl;
logger.debug("getSlaUrl(env={}, supplied={}) = {}", envSlaUrl, baseUrl, result);
return result;
} | [
"private",
"String",
"getSlaUrl",
"(",
"String",
"envSlaUrl",
",",
"UriInfo",
"uriInfo",
")",
"{",
"String",
"baseUrl",
"=",
"uriInfo",
".",
"getBaseUri",
"(",
")",
".",
"toString",
"(",
")",
";",
"if",
"(",
"envSlaUrl",
"==",
"null",
")",
"{",
"envSlaUr... | Returns base url of the sla core.
If the SLA_URL env var is set, returns that value. Else, get the base url from the
context of the current REST call. This second value may be wrong because this base url must
be the value that the MonitoringPlatform needs to use to connect to the SLA Core. | [
"Returns",
"base",
"url",
"of",
"the",
"sla",
"core",
"."
] | train | https://github.com/SeaCloudsEU/SeaCloudsPlatform/blob/b199fe6de2c63b808cb248d3aca947d802375df8/sla/sla-core/sla-service/src/main/java/eu/atos/sla/service/rest/SeacloudsRest.java#L372-L382 |
apache/groovy | src/main/java/org/codehaus/groovy/runtime/ScriptBytecodeAdapter.java | ScriptBytecodeAdapter.castToType | public static Object castToType(Object object, Class type) throws Throwable {
return DefaultTypeTransformation.castToType(object, type);
} | java | public static Object castToType(Object object, Class type) throws Throwable {
return DefaultTypeTransformation.castToType(object, type);
} | [
"public",
"static",
"Object",
"castToType",
"(",
"Object",
"object",
",",
"Class",
"type",
")",
"throws",
"Throwable",
"{",
"return",
"DefaultTypeTransformation",
".",
"castToType",
"(",
"object",
",",
"type",
")",
";",
"}"
] | Provides a hook for type casting of the given object to the required type
@param type of object to convert the given object to
@param object the object to be converted
@return the original object or a new converted value
@throws Throwable if the type casting fails | [
"Provides",
"a",
"hook",
"for",
"type",
"casting",
"of",
"the",
"given",
"object",
"to",
"the",
"required",
"type"
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/ScriptBytecodeAdapter.java#L614-L616 |
eclipse/xtext-extras | org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/imports/NonOverridableTypesProvider.java | NonOverridableTypesProvider.getVisibleType | public JvmIdentifiableElement getVisibleType(JvmMember context, String name) {
if (context == null)
return null;
Map<String, JvmIdentifiableElement> map = visibleElements.get(context);
if (map == null) {
map = create(context);
}
return map.get(name);
} | java | public JvmIdentifiableElement getVisibleType(JvmMember context, String name) {
if (context == null)
return null;
Map<String, JvmIdentifiableElement> map = visibleElements.get(context);
if (map == null) {
map = create(context);
}
return map.get(name);
} | [
"public",
"JvmIdentifiableElement",
"getVisibleType",
"(",
"JvmMember",
"context",
",",
"String",
"name",
")",
"{",
"if",
"(",
"context",
"==",
"null",
")",
"return",
"null",
";",
"Map",
"<",
"String",
",",
"JvmIdentifiableElement",
">",
"map",
"=",
"visibleEl... | Returns a type with the given name that is reachable in the context.
If the context is <code>null</code>, it is assumed that no type is visible.
@return the visible type or <code>null</code> | [
"Returns",
"a",
"type",
"with",
"the",
"given",
"name",
"that",
"is",
"reachable",
"in",
"the",
"context",
".",
"If",
"the",
"context",
"is",
"<code",
">",
"null<",
"/",
"code",
">",
"it",
"is",
"assumed",
"that",
"no",
"type",
"is",
"visible",
"."
] | train | https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/imports/NonOverridableTypesProvider.java#L48-L56 |
hawkular/hawkular-apm | client/opentracing/src/main/java/io/opentracing/impl/APMSpan.java | APMSpan.processRemainingReferences | protected void processRemainingReferences(APMSpanBuilder builder, Reference primaryRef) {
// Check if other references
for (Reference ref : builder.references) {
if (primaryRef == ref) {
continue;
}
// Setup correlation ids for other references
if (ref.getReferredTo() instanceof APMSpan) {
APMSpan referenced = (APMSpan) ref.getReferredTo();
String nodeId = referenced.getNodePath();
getNodeBuilder().addCorrelationId(new CorrelationIdentifier(Scope.CausedBy, nodeId));
} else if (ref.getReferredTo() instanceof APMSpanBuilder
&& ((APMSpanBuilder) ref.getReferredTo()).state().containsKey(Constants.HAWKULAR_APM_ID)) {
getNodeBuilder().addCorrelationId(new CorrelationIdentifier(Scope.Interaction,
((APMSpanBuilder) ref.getReferredTo()).state().get(Constants.HAWKULAR_APM_ID).toString()));
}
}
} | java | protected void processRemainingReferences(APMSpanBuilder builder, Reference primaryRef) {
// Check if other references
for (Reference ref : builder.references) {
if (primaryRef == ref) {
continue;
}
// Setup correlation ids for other references
if (ref.getReferredTo() instanceof APMSpan) {
APMSpan referenced = (APMSpan) ref.getReferredTo();
String nodeId = referenced.getNodePath();
getNodeBuilder().addCorrelationId(new CorrelationIdentifier(Scope.CausedBy, nodeId));
} else if (ref.getReferredTo() instanceof APMSpanBuilder
&& ((APMSpanBuilder) ref.getReferredTo()).state().containsKey(Constants.HAWKULAR_APM_ID)) {
getNodeBuilder().addCorrelationId(new CorrelationIdentifier(Scope.Interaction,
((APMSpanBuilder) ref.getReferredTo()).state().get(Constants.HAWKULAR_APM_ID).toString()));
}
}
} | [
"protected",
"void",
"processRemainingReferences",
"(",
"APMSpanBuilder",
"builder",
",",
"Reference",
"primaryRef",
")",
"{",
"// Check if other references",
"for",
"(",
"Reference",
"ref",
":",
"builder",
".",
"references",
")",
"{",
"if",
"(",
"primaryRef",
"==",... | This method processes the remaining references by creating appropriate correlation ids
against the current node.
@param builder The span builder
@param primaryRef The primary reference, if null if one was not found | [
"This",
"method",
"processes",
"the",
"remaining",
"references",
"by",
"creating",
"appropriate",
"correlation",
"ids",
"against",
"the",
"current",
"node",
"."
] | train | https://github.com/hawkular/hawkular-apm/blob/57a4df0611b359597626563ea5f9ac64d4bb2533/client/opentracing/src/main/java/io/opentracing/impl/APMSpan.java#L295-L314 |
Whiley/WhileyCompiler | src/main/java/wyc/io/WhileyFileParser.java | WhileyFileParser.parseUnicodeString | protected byte[] parseUnicodeString(Token token) {
String v = token.text;
/*
* Parsing a string requires several steps to be taken. First, we need
* to strip quotes from the ends of the string.
*/
v = v.substring(1, v.length() - 1);
StringBuffer result = new StringBuffer();
// Second, step through the string and replace escaped characters
for (int i = 0; i < v.length(); i++) {
if (v.charAt(i) == '\\') {
if (v.length() <= i + 1) {
throw new RuntimeException("unexpected end-of-string");
} else {
char replace = 0;
int len = 2;
switch (v.charAt(i + 1)) {
case 'b':
replace = '\b';
break;
case 't':
replace = '\t';
break;
case 'n':
replace = '\n';
break;
case 'f':
replace = '\f';
break;
case 'r':
replace = '\r';
break;
case '"':
replace = '\"';
break;
case '\'':
replace = '\'';
break;
case '\\':
replace = '\\';
break;
case 'u':
len = 6; // unicode escapes are six digits long,
// including "slash u"
String unicode = v.substring(i + 2, i + 6);
replace = (char) Integer.parseInt(unicode, 16); // unicode
i = i + 5;
break;
default:
throw new RuntimeException("unknown escape character");
}
result.append(replace);
i = i + 1;
}
} else {
result.append(v.charAt(i));
}
}
try {
// Now, convert string into a sequence of UTF8 bytes.
return result.toString().getBytes("UTF8");
} catch (UnsupportedEncodingException e) {
// This really should be deadcode
syntaxError("invalid unicode string", token);
return null; // deadcode
}
} | java | protected byte[] parseUnicodeString(Token token) {
String v = token.text;
/*
* Parsing a string requires several steps to be taken. First, we need
* to strip quotes from the ends of the string.
*/
v = v.substring(1, v.length() - 1);
StringBuffer result = new StringBuffer();
// Second, step through the string and replace escaped characters
for (int i = 0; i < v.length(); i++) {
if (v.charAt(i) == '\\') {
if (v.length() <= i + 1) {
throw new RuntimeException("unexpected end-of-string");
} else {
char replace = 0;
int len = 2;
switch (v.charAt(i + 1)) {
case 'b':
replace = '\b';
break;
case 't':
replace = '\t';
break;
case 'n':
replace = '\n';
break;
case 'f':
replace = '\f';
break;
case 'r':
replace = '\r';
break;
case '"':
replace = '\"';
break;
case '\'':
replace = '\'';
break;
case '\\':
replace = '\\';
break;
case 'u':
len = 6; // unicode escapes are six digits long,
// including "slash u"
String unicode = v.substring(i + 2, i + 6);
replace = (char) Integer.parseInt(unicode, 16); // unicode
i = i + 5;
break;
default:
throw new RuntimeException("unknown escape character");
}
result.append(replace);
i = i + 1;
}
} else {
result.append(v.charAt(i));
}
}
try {
// Now, convert string into a sequence of UTF8 bytes.
return result.toString().getBytes("UTF8");
} catch (UnsupportedEncodingException e) {
// This really should be deadcode
syntaxError("invalid unicode string", token);
return null; // deadcode
}
} | [
"protected",
"byte",
"[",
"]",
"parseUnicodeString",
"(",
"Token",
"token",
")",
"{",
"String",
"v",
"=",
"token",
".",
"text",
";",
"/*\n\t\t * Parsing a string requires several steps to be taken. First, we need\n\t\t * to strip quotes from the ends of the string.\n\t\t */",
"v"... | Parse a string constant whilst interpreting all escape characters.
@param v
@return | [
"Parse",
"a",
"string",
"constant",
"whilst",
"interpreting",
"all",
"escape",
"characters",
"."
] | train | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyc/io/WhileyFileParser.java#L4496-L4563 |
smanikandan14/ThinDownloadManager | ThinDownloadManager/src/main/java/com/thin/downloadmanager/DownloadRequestQueue.java | DownloadRequestQueue.checkResumableDownloadEnabled | private void checkResumableDownloadEnabled(int downloadId) {
synchronized (mCurrentRequests) {
for (DownloadRequest request : mCurrentRequests) {
if (downloadId == -1 && !request.isResumable()) {
Log.e("ThinDownloadManager",
String.format(Locale.getDefault(), "This request has not enabled resume feature hence request will be cancelled. Request Id: %d", request.getDownloadId()));
} else if ((request.getDownloadId() == downloadId && !request.isResumable())) {
throw new IllegalStateException("You cannot pause the download, unless you have enabled Resume feature in DownloadRequest.");
} else {
//ignored, It can not be a scenario to happen.
}
}
}
} | java | private void checkResumableDownloadEnabled(int downloadId) {
synchronized (mCurrentRequests) {
for (DownloadRequest request : mCurrentRequests) {
if (downloadId == -1 && !request.isResumable()) {
Log.e("ThinDownloadManager",
String.format(Locale.getDefault(), "This request has not enabled resume feature hence request will be cancelled. Request Id: %d", request.getDownloadId()));
} else if ((request.getDownloadId() == downloadId && !request.isResumable())) {
throw new IllegalStateException("You cannot pause the download, unless you have enabled Resume feature in DownloadRequest.");
} else {
//ignored, It can not be a scenario to happen.
}
}
}
} | [
"private",
"void",
"checkResumableDownloadEnabled",
"(",
"int",
"downloadId",
")",
"{",
"synchronized",
"(",
"mCurrentRequests",
")",
"{",
"for",
"(",
"DownloadRequest",
"request",
":",
"mCurrentRequests",
")",
"{",
"if",
"(",
"downloadId",
"==",
"-",
"1",
"&&",... | This is called by methods that want to throw an exception if the {@link DownloadRequest}
hasn't enable isResumable feature. | [
"This",
"is",
"called",
"by",
"methods",
"that",
"want",
"to",
"throw",
"an",
"exception",
"if",
"the",
"{"
] | train | https://github.com/smanikandan14/ThinDownloadManager/blob/63c153c918eff0b1c9de384171563d2c70baea5e/ThinDownloadManager/src/main/java/com/thin/downloadmanager/DownloadRequestQueue.java#L233-L246 |
JodaOrg/joda-time | src/main/java/org/joda/time/Period.java | Period.normalizedStandard | public Period normalizedStandard(PeriodType type) {
type = DateTimeUtils.getPeriodType(type);
long millis = getMillis(); // no overflow can happen, even with Integer.MAX_VALUEs
millis += (((long) getSeconds()) * ((long) DateTimeConstants.MILLIS_PER_SECOND));
millis += (((long) getMinutes()) * ((long) DateTimeConstants.MILLIS_PER_MINUTE));
millis += (((long) getHours()) * ((long) DateTimeConstants.MILLIS_PER_HOUR));
millis += (((long) getDays()) * ((long) DateTimeConstants.MILLIS_PER_DAY));
millis += (((long) getWeeks()) * ((long) DateTimeConstants.MILLIS_PER_WEEK));
Period result = new Period(millis, type, ISOChronology.getInstanceUTC());
int years = getYears();
int months = getMonths();
if (years != 0 || months != 0) {
long totalMonths = years * 12L + months;
if (type.isSupported(DurationFieldType.YEARS_TYPE)) {
int normalizedYears = FieldUtils.safeToInt(totalMonths / 12);
result = result.withYears(normalizedYears);
totalMonths = totalMonths - (normalizedYears * 12);
}
if (type.isSupported(DurationFieldType.MONTHS_TYPE)) {
int normalizedMonths = FieldUtils.safeToInt(totalMonths);
result = result.withMonths(normalizedMonths);
totalMonths = totalMonths - normalizedMonths;
}
if (totalMonths != 0) {
throw new UnsupportedOperationException("Unable to normalize as PeriodType is missing either years or months but period has a month/year amount: " + toString());
}
}
return result;
} | java | public Period normalizedStandard(PeriodType type) {
type = DateTimeUtils.getPeriodType(type);
long millis = getMillis(); // no overflow can happen, even with Integer.MAX_VALUEs
millis += (((long) getSeconds()) * ((long) DateTimeConstants.MILLIS_PER_SECOND));
millis += (((long) getMinutes()) * ((long) DateTimeConstants.MILLIS_PER_MINUTE));
millis += (((long) getHours()) * ((long) DateTimeConstants.MILLIS_PER_HOUR));
millis += (((long) getDays()) * ((long) DateTimeConstants.MILLIS_PER_DAY));
millis += (((long) getWeeks()) * ((long) DateTimeConstants.MILLIS_PER_WEEK));
Period result = new Period(millis, type, ISOChronology.getInstanceUTC());
int years = getYears();
int months = getMonths();
if (years != 0 || months != 0) {
long totalMonths = years * 12L + months;
if (type.isSupported(DurationFieldType.YEARS_TYPE)) {
int normalizedYears = FieldUtils.safeToInt(totalMonths / 12);
result = result.withYears(normalizedYears);
totalMonths = totalMonths - (normalizedYears * 12);
}
if (type.isSupported(DurationFieldType.MONTHS_TYPE)) {
int normalizedMonths = FieldUtils.safeToInt(totalMonths);
result = result.withMonths(normalizedMonths);
totalMonths = totalMonths - normalizedMonths;
}
if (totalMonths != 0) {
throw new UnsupportedOperationException("Unable to normalize as PeriodType is missing either years or months but period has a month/year amount: " + toString());
}
}
return result;
} | [
"public",
"Period",
"normalizedStandard",
"(",
"PeriodType",
"type",
")",
"{",
"type",
"=",
"DateTimeUtils",
".",
"getPeriodType",
"(",
"type",
")",
";",
"long",
"millis",
"=",
"getMillis",
"(",
")",
";",
"// no overflow can happen, even with Integer.MAX_VALUEs",
"m... | Normalizes this period using standard rules, assuming a 12 month year,
7 day week, 24 hour day, 60 minute hour and 60 second minute,
providing control over how the result is split into fields.
<p>
This method allows you to normalize a period.
However to achieve this it makes the assumption that all years are
12 months, all weeks are 7 days, all days are 24 hours,
all hours are 60 minutes and all minutes are 60 seconds. This is not
true when daylight savings time is considered, and may also not be true
for some chronologies. However, it is included as it is a useful operation
for many applications and business rules.
<p>
If the period contains years or months, then the months will be
normalized to be between 0 and 11. The days field and below will be
normalized as necessary, however this will not overflow into the months
field. Thus a period of 1 year 15 months will normalize to 2 years 3 months.
But a period of 1 month 40 days will remain as 1 month 40 days.
<p>
The PeriodType parameter controls how the result is created. It allows
you to omit certain fields from the result if desired. For example,
you may not want the result to include weeks, in which case you pass
in <code>PeriodType.yearMonthDayTime()</code>.
@param type the period type of the new period, null means standard type
@return a normalized period equivalent to this period
@throws ArithmeticException if any field is too large to be represented
@throws UnsupportedOperationException if this period contains non-zero
years or months but the specified period type does not support them
@since 1.5 | [
"Normalizes",
"this",
"period",
"using",
"standard",
"rules",
"assuming",
"a",
"12",
"month",
"year",
"7",
"day",
"week",
"24",
"hour",
"day",
"60",
"minute",
"hour",
"and",
"60",
"second",
"minute",
"providing",
"control",
"over",
"how",
"the",
"result",
... | train | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/Period.java#L1636-L1664 |
Azure/azure-sdk-for-java | iotcentral/resource-manager/v2017_07_01_privatepreview/src/main/java/com/microsoft/azure/management/iotcentral/v2017_07_01_privatepreview/implementation/AppsInner.java | AppsInner.createOrUpdate | public AppInner createOrUpdate(String resourceGroupName, String resourceName, AppInner app) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, app).toBlocking().last().body();
} | java | public AppInner createOrUpdate(String resourceGroupName, String resourceName, AppInner app) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, app).toBlocking().last().body();
} | [
"public",
"AppInner",
"createOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"resourceName",
",",
"AppInner",
"app",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"resourceName",
",",
"app",
")",
".",
"toBlo... | Create or update the metadata of an IoT Central application. The usual pattern to modify a property is to retrieve the IoT Central application metadata and security metadata, and then combine them with the modified values in a new body to update the IoT Central application.
@param resourceGroupName The name of the resource group that contains the IoT Central application.
@param resourceName The ARM resource name of the IoT Central application.
@param app The IoT Central application metadata and security metadata.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorDetailsException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the AppInner object if successful. | [
"Create",
"or",
"update",
"the",
"metadata",
"of",
"an",
"IoT",
"Central",
"application",
".",
"The",
"usual",
"pattern",
"to",
"modify",
"a",
"property",
"is",
"to",
"retrieve",
"the",
"IoT",
"Central",
"application",
"metadata",
"and",
"security",
"metadata"... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/iotcentral/resource-manager/v2017_07_01_privatepreview/src/main/java/com/microsoft/azure/management/iotcentral/v2017_07_01_privatepreview/implementation/AppsInner.java#L218-L220 |
Waikato/moa | moa/src/main/java/com/yahoo/labs/samoa/instances/WekaToSamoaInstanceConverter.java | WekaToSamoaInstanceConverter.samoaAttribute | protected Attribute samoaAttribute(int index, weka.core.Attribute attribute) {
Attribute samoaAttribute;
if (attribute.isNominal()) {
Enumeration enu = attribute.enumerateValues();
List<String> attributeValues = new ArrayList<String>();
while (enu.hasMoreElements()) {
attributeValues.add((String) enu.nextElement());
}
samoaAttribute = new Attribute(attribute.name(), attributeValues);
} else {
samoaAttribute = new Attribute(attribute.name());
}
return samoaAttribute;
} | java | protected Attribute samoaAttribute(int index, weka.core.Attribute attribute) {
Attribute samoaAttribute;
if (attribute.isNominal()) {
Enumeration enu = attribute.enumerateValues();
List<String> attributeValues = new ArrayList<String>();
while (enu.hasMoreElements()) {
attributeValues.add((String) enu.nextElement());
}
samoaAttribute = new Attribute(attribute.name(), attributeValues);
} else {
samoaAttribute = new Attribute(attribute.name());
}
return samoaAttribute;
} | [
"protected",
"Attribute",
"samoaAttribute",
"(",
"int",
"index",
",",
"weka",
".",
"core",
".",
"Attribute",
"attribute",
")",
"{",
"Attribute",
"samoaAttribute",
";",
"if",
"(",
"attribute",
".",
"isNominal",
"(",
")",
")",
"{",
"Enumeration",
"enu",
"=",
... | Get Samoa attribute from a weka attribute.
@param index the index
@param attribute the attribute
@return the attribute | [
"Get",
"Samoa",
"attribute",
"from",
"a",
"weka",
"attribute",
"."
] | train | https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/com/yahoo/labs/samoa/instances/WekaToSamoaInstanceConverter.java#L111-L124 |
chhh/MSFTBX | MSFileToolbox/src/main/java/umich/ms/util/base64/Base64Slow.java | Base64Slow.readBase64 | private static final int readBase64(InputStream in, boolean throwExceptions) throws IOException {
int read;
int numPadding = 0;
do {
read = in.read();
if (read == END_OF_INPUT) {
return END_OF_INPUT;
}
read = reverseBase64Chars[(byte) read];
if (throwExceptions && (read == NON_BASE_64 || (numPadding > 0 && read > NON_BASE_64))) {
throw new Base64DecodingException(
MessageFormat.format(
"Unexpected char",
(Object[]) new String[]{
"'" + (char) read + "' (0x" + Integer.toHexString(read) + ")"
}
),
(char) read
);
}
if (read == NON_BASE_64_PADDING) {
numPadding++;
}
} while (read <= NON_BASE_64);
return read;
} | java | private static final int readBase64(InputStream in, boolean throwExceptions) throws IOException {
int read;
int numPadding = 0;
do {
read = in.read();
if (read == END_OF_INPUT) {
return END_OF_INPUT;
}
read = reverseBase64Chars[(byte) read];
if (throwExceptions && (read == NON_BASE_64 || (numPadding > 0 && read > NON_BASE_64))) {
throw new Base64DecodingException(
MessageFormat.format(
"Unexpected char",
(Object[]) new String[]{
"'" + (char) read + "' (0x" + Integer.toHexString(read) + ")"
}
),
(char) read
);
}
if (read == NON_BASE_64_PADDING) {
numPadding++;
}
} while (read <= NON_BASE_64);
return read;
} | [
"private",
"static",
"final",
"int",
"readBase64",
"(",
"InputStream",
"in",
",",
"boolean",
"throwExceptions",
")",
"throws",
"IOException",
"{",
"int",
"read",
";",
"int",
"numPadding",
"=",
"0",
";",
"do",
"{",
"read",
"=",
"in",
".",
"read",
"(",
")"... | Reads the next (decoded) Base64 character from the input stream. Non Base64 characters are
skipped.
@param in Stream from which bytes are read.
@param throwExceptions Throw an exception if an unexpected character is encountered.
@return the next Base64 character from the stream or -1 if there are no more Base64 characters
on the stream.
@throws IOException if an IO Error occurs.
@throws Base64DecodingException if unexpected data is encountered when throwExceptions is
specified.
@since ostermillerutils 1.00.00 | [
"Reads",
"the",
"next",
"(",
"decoded",
")",
"Base64",
"character",
"from",
"the",
"input",
"stream",
".",
"Non",
"Base64",
"characters",
"are",
"skipped",
"."
] | train | https://github.com/chhh/MSFTBX/blob/e53ae6be982e2de3123292be7d5297715bec70bb/MSFileToolbox/src/main/java/umich/ms/util/base64/Base64Slow.java#L677-L702 |
FDMediagroep/hamcrest-jsoup | src/main/java/nl/fd/hamcrest/jsoup/ElementWithAttribute.java | ElementWithAttribute.hasAttribute | @Factory
public static Matcher<Element> hasAttribute(final String attributeName,
final String expectedValue) {
return new ElementWithAttribute(attributeName, Matchers.is(expectedValue));
} | java | @Factory
public static Matcher<Element> hasAttribute(final String attributeName,
final String expectedValue) {
return new ElementWithAttribute(attributeName, Matchers.is(expectedValue));
} | [
"@",
"Factory",
"public",
"static",
"Matcher",
"<",
"Element",
">",
"hasAttribute",
"(",
"final",
"String",
"attributeName",
",",
"final",
"String",
"expectedValue",
")",
"{",
"return",
"new",
"ElementWithAttribute",
"(",
"attributeName",
",",
"Matchers",
".",
"... | Creates a {@link org.hamcrest.Matcher} for a JSoup {@link org.jsoup.nodes.Element} with the given {@code expectedValue} for the given {@code
attributeName}. See {@link #hasAttribute(String, org.hamcrest.Matcher)} for use with Matchers.
@param attributeName The attribute name whose value to check
@param expectedValue The attribute value that is expected
@return a {@link org.hamcrest.Matcher} for a JSoup {@link org.jsoup.nodes.Element} with the given {@code expectedValue} for the given {@code
attributeName} | [
"Creates",
"a",
"{",
"@link",
"org",
".",
"hamcrest",
".",
"Matcher",
"}",
"for",
"a",
"JSoup",
"{",
"@link",
"org",
".",
"jsoup",
".",
"nodes",
".",
"Element",
"}",
"with",
"the",
"given",
"{",
"@code",
"expectedValue",
"}",
"for",
"the",
"given",
"... | train | https://github.com/FDMediagroep/hamcrest-jsoup/blob/b7152dac6f834e40117fb7cfdd3149a268d95f7b/src/main/java/nl/fd/hamcrest/jsoup/ElementWithAttribute.java#L55-L59 |
Impetus/Kundera | src/kundera-couchdb/src/main/java/com/impetus/client/couchdb/CouchDBUtils.java | CouchDBUtils.createView | static void createView(Map<String, MapReduce> views, String columnName, List<String> columns)
{
Iterator<String> iterator = columns.iterator();
MapReduce mapr = new MapReduce();
StringBuilder mapBuilder = new StringBuilder();
StringBuilder ifBuilder = new StringBuilder("function(doc){if(");
StringBuilder emitFunction = new StringBuilder("{emit(");
if (columns != null && columns.size() > 1)
{
emitFunction.append("[");
}
while (iterator.hasNext())
{
String nextToken = iterator.next();
ifBuilder.append("doc." + nextToken);
ifBuilder.append(" && ");
emitFunction.append("doc." + nextToken);
emitFunction.append(",");
}
ifBuilder.delete(ifBuilder.toString().lastIndexOf(" && "), ifBuilder.toString().lastIndexOf(" && ") + 3);
emitFunction.deleteCharAt(emitFunction.toString().lastIndexOf(","));
ifBuilder.append(")");
if (columns != null && columns.size() > 1)
{
emitFunction.append("]");
}
emitFunction.append(", doc)}}");
mapBuilder.append(ifBuilder.toString()).append(emitFunction.toString());
mapr.setMap(mapBuilder.toString());
views.put(columnName, mapr);
} | java | static void createView(Map<String, MapReduce> views, String columnName, List<String> columns)
{
Iterator<String> iterator = columns.iterator();
MapReduce mapr = new MapReduce();
StringBuilder mapBuilder = new StringBuilder();
StringBuilder ifBuilder = new StringBuilder("function(doc){if(");
StringBuilder emitFunction = new StringBuilder("{emit(");
if (columns != null && columns.size() > 1)
{
emitFunction.append("[");
}
while (iterator.hasNext())
{
String nextToken = iterator.next();
ifBuilder.append("doc." + nextToken);
ifBuilder.append(" && ");
emitFunction.append("doc." + nextToken);
emitFunction.append(",");
}
ifBuilder.delete(ifBuilder.toString().lastIndexOf(" && "), ifBuilder.toString().lastIndexOf(" && ") + 3);
emitFunction.deleteCharAt(emitFunction.toString().lastIndexOf(","));
ifBuilder.append(")");
if (columns != null && columns.size() > 1)
{
emitFunction.append("]");
}
emitFunction.append(", doc)}}");
mapBuilder.append(ifBuilder.toString()).append(emitFunction.toString());
mapr.setMap(mapBuilder.toString());
views.put(columnName, mapr);
} | [
"static",
"void",
"createView",
"(",
"Map",
"<",
"String",
",",
"MapReduce",
">",
"views",
",",
"String",
"columnName",
",",
"List",
"<",
"String",
">",
"columns",
")",
"{",
"Iterator",
"<",
"String",
">",
"iterator",
"=",
"columns",
".",
"iterator",
"("... | Creates the view.
@param views
the views
@param columnName
the column name
@param columns
the columns | [
"Creates",
"the",
"view",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-couchdb/src/main/java/com/impetus/client/couchdb/CouchDBUtils.java#L112-L146 |
gmessner/gitlab4j-api | src/main/java/org/gitlab4j/api/MilestonesApi.java | MilestonesApi.createMilestone | public Milestone createMilestone(Object projectIdOrPath, String title, String description, Date dueDate, Date startDate) throws GitLabApiException {
GitLabApiForm formData = new GitLabApiForm()
.withParam("title", title, true)
.withParam("description", description)
.withParam("due_date", dueDate)
.withParam("start_date", startDate);
Response response = post(Response.Status.CREATED, formData,
"projects", getProjectIdOrPath(projectIdOrPath), "milestones");
return (response.readEntity(Milestone.class));
} | java | public Milestone createMilestone(Object projectIdOrPath, String title, String description, Date dueDate, Date startDate) throws GitLabApiException {
GitLabApiForm formData = new GitLabApiForm()
.withParam("title", title, true)
.withParam("description", description)
.withParam("due_date", dueDate)
.withParam("start_date", startDate);
Response response = post(Response.Status.CREATED, formData,
"projects", getProjectIdOrPath(projectIdOrPath), "milestones");
return (response.readEntity(Milestone.class));
} | [
"public",
"Milestone",
"createMilestone",
"(",
"Object",
"projectIdOrPath",
",",
"String",
"title",
",",
"String",
"description",
",",
"Date",
"dueDate",
",",
"Date",
"startDate",
")",
"throws",
"GitLabApiException",
"{",
"GitLabApiForm",
"formData",
"=",
"new",
"... | Create a milestone.
@param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
@param title the title for the milestone
@param description the description for the milestone
@param dueDate the due date for the milestone
@param startDate the start date for the milestone
@return the created Milestone instance
@throws GitLabApiException if any exception occurs | [
"Create",
"a",
"milestone",
"."
] | train | https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/MilestonesApi.java#L410-L419 |
structurizr/java | structurizr-core/src/com/structurizr/documentation/Arc42DocumentationTemplate.java | Arc42DocumentationTemplate.addArchitecturalDecisionsSection | public Section addArchitecturalDecisionsSection(SoftwareSystem softwareSystem, File... files) throws IOException {
return addSection(softwareSystem, "Architectural Decisions", files);
} | java | public Section addArchitecturalDecisionsSection(SoftwareSystem softwareSystem, File... files) throws IOException {
return addSection(softwareSystem, "Architectural Decisions", files);
} | [
"public",
"Section",
"addArchitecturalDecisionsSection",
"(",
"SoftwareSystem",
"softwareSystem",
",",
"File",
"...",
"files",
")",
"throws",
"IOException",
"{",
"return",
"addSection",
"(",
"softwareSystem",
",",
"\"Architectural Decisions\"",
",",
"files",
")",
";",
... | Adds an "Architectural Decisions" section relating to a {@link SoftwareSystem} from one or more files.
@param softwareSystem the {@link SoftwareSystem} the documentation content relates to
@param files one or more File objects that point to the documentation content
@return a documentation {@link Section}
@throws IOException if there is an error reading the files | [
"Adds",
"an",
"Architectural",
"Decisions",
"section",
"relating",
"to",
"a",
"{",
"@link",
"SoftwareSystem",
"}",
"from",
"one",
"or",
"more",
"files",
"."
] | train | https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/documentation/Arc42DocumentationTemplate.java#L241-L243 |
apache/reef | lang/java/reef-applications/reef-vortex/src/main/java/org/apache/reef/vortex/evaluator/AggregateContainer.java | AggregateContainer.taskletComplete | public void taskletComplete(final int taskletId, final Object result) {
final boolean aggregateOnCount;
synchronized (stateLock) {
completedTasklets.add(new ImmutablePair<>(taskletId, result));
removePendingTaskletReferenceCount(taskletId);
aggregateOnCount = aggregateOnCount();
}
if (aggregateOnCount) {
aggregateTasklets(AggregateTriggerType.COUNT);
}
} | java | public void taskletComplete(final int taskletId, final Object result) {
final boolean aggregateOnCount;
synchronized (stateLock) {
completedTasklets.add(new ImmutablePair<>(taskletId, result));
removePendingTaskletReferenceCount(taskletId);
aggregateOnCount = aggregateOnCount();
}
if (aggregateOnCount) {
aggregateTasklets(AggregateTriggerType.COUNT);
}
} | [
"public",
"void",
"taskletComplete",
"(",
"final",
"int",
"taskletId",
",",
"final",
"Object",
"result",
")",
"{",
"final",
"boolean",
"aggregateOnCount",
";",
"synchronized",
"(",
"stateLock",
")",
"{",
"completedTasklets",
".",
"add",
"(",
"new",
"ImmutablePai... | Reported when an associated tasklet is complete and adds it to the completion pool. | [
"Reported",
"when",
"an",
"associated",
"tasklet",
"is",
"complete",
"and",
"adds",
"it",
"to",
"the",
"completion",
"pool",
"."
] | train | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-applications/reef-vortex/src/main/java/org/apache/reef/vortex/evaluator/AggregateContainer.java#L185-L196 |
ngageoint/geopackage-core-java | src/main/java/mil/nga/geopackage/extension/related/ExtendedRelationsDao.java | ExtendedRelationsDao.getBaseTableRelations | public List<ExtendedRelation> getBaseTableRelations(String baseTable)
throws SQLException {
return queryForEq(ExtendedRelation.COLUMN_BASE_TABLE_NAME, baseTable);
} | java | public List<ExtendedRelation> getBaseTableRelations(String baseTable)
throws SQLException {
return queryForEq(ExtendedRelation.COLUMN_BASE_TABLE_NAME, baseTable);
} | [
"public",
"List",
"<",
"ExtendedRelation",
">",
"getBaseTableRelations",
"(",
"String",
"baseTable",
")",
"throws",
"SQLException",
"{",
"return",
"queryForEq",
"(",
"ExtendedRelation",
".",
"COLUMN_BASE_TABLE_NAME",
",",
"baseTable",
")",
";",
"}"
] | Get the relations to the base table
@param baseTable
base table
@return extended relations
@throws SQLException
upon failure | [
"Get",
"the",
"relations",
"to",
"the",
"base",
"table"
] | train | https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/extension/related/ExtendedRelationsDao.java#L83-L86 |
shrinkwrap/resolver | maven/impl-maven/src/main/java/org/jboss/shrinkwrap/resolver/impl/maven/bootstrap/MavenRepositorySystem.java | MavenRepositorySystem.resolveVersionRange | public VersionRangeResult resolveVersionRange(final RepositorySystemSession session, final VersionRangeRequest request)
throws VersionRangeResolutionException {
return system.resolveVersionRange(session, request);
} | java | public VersionRangeResult resolveVersionRange(final RepositorySystemSession session, final VersionRangeRequest request)
throws VersionRangeResolutionException {
return system.resolveVersionRange(session, request);
} | [
"public",
"VersionRangeResult",
"resolveVersionRange",
"(",
"final",
"RepositorySystemSession",
"session",
",",
"final",
"VersionRangeRequest",
"request",
")",
"throws",
"VersionRangeResolutionException",
"{",
"return",
"system",
".",
"resolveVersionRange",
"(",
"session",
... | Resolves versions range
@param session The current Maven session
@param request The request to be computed
@return version range result
@throws VersionRangeResolutionException
If the requested range could not be parsed. Note that an empty range does not raise an exception. | [
"Resolves",
"versions",
"range"
] | train | https://github.com/shrinkwrap/resolver/blob/e881a84b8cff5b0a014f2a5ebf612be3eb9db01f/maven/impl-maven/src/main/java/org/jboss/shrinkwrap/resolver/impl/maven/bootstrap/MavenRepositorySystem.java#L148-L151 |
overturetool/overture | core/parser/src/main/java/org/overture/parser/lex/LexTokenReader.java | LexTokenReader.throwMessage | private void throwMessage(int number, String msg) throws LexException
{
throwMessage(number, linecount, charpos, msg);
} | java | private void throwMessage(int number, String msg) throws LexException
{
throwMessage(number, linecount, charpos, msg);
} | [
"private",
"void",
"throwMessage",
"(",
"int",
"number",
",",
"String",
"msg",
")",
"throws",
"LexException",
"{",
"throwMessage",
"(",
"number",
",",
"linecount",
",",
"charpos",
",",
"msg",
")",
";",
"}"
] | Throw a {@link LexException} with the given message and details of the current file and position appended.
@param number
The error number.
@param msg
The basic error message.
@throws LexException | [
"Throw",
"a",
"{",
"@link",
"LexException",
"}",
"with",
"the",
"given",
"message",
"and",
"details",
"of",
"the",
"current",
"file",
"and",
"position",
"appended",
"."
] | train | https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/core/parser/src/main/java/org/overture/parser/lex/LexTokenReader.java#L296-L299 |
Omertron/api-tvrage | src/main/java/com/omertron/tvrageapi/tools/TVRageParser.java | TVRageParser.processSeasonEpisodes | private static void processSeasonEpisodes(Element eEpisodeList, EpisodeList epList) {
// Get the season number
String season = eEpisodeList.getAttribute("no");
NodeList nlEpisode = eEpisodeList.getElementsByTagName(EPISODE);
if (nlEpisode == null || nlEpisode.getLength() == 0) {
return;
}
for (int eLoop = 0; eLoop < nlEpisode.getLength(); eLoop++) {
Node nEpisode = nlEpisode.item(eLoop);
if (nEpisode.getNodeType() == Node.ELEMENT_NODE) {
epList.addEpisode(parseEpisode((Element) nEpisode, season));
}
}
} | java | private static void processSeasonEpisodes(Element eEpisodeList, EpisodeList epList) {
// Get the season number
String season = eEpisodeList.getAttribute("no");
NodeList nlEpisode = eEpisodeList.getElementsByTagName(EPISODE);
if (nlEpisode == null || nlEpisode.getLength() == 0) {
return;
}
for (int eLoop = 0; eLoop < nlEpisode.getLength(); eLoop++) {
Node nEpisode = nlEpisode.item(eLoop);
if (nEpisode.getNodeType() == Node.ELEMENT_NODE) {
epList.addEpisode(parseEpisode((Element) nEpisode, season));
}
}
} | [
"private",
"static",
"void",
"processSeasonEpisodes",
"(",
"Element",
"eEpisodeList",
",",
"EpisodeList",
"epList",
")",
"{",
"// Get the season number",
"String",
"season",
"=",
"eEpisodeList",
".",
"getAttribute",
"(",
"\"no\"",
")",
";",
"NodeList",
"nlEpisode",
... | Process the episodes in the season and add them to the EpisodeList
@param eEpisodeList
@param epList
@return | [
"Process",
"the",
"episodes",
"in",
"the",
"season",
"and",
"add",
"them",
"to",
"the",
"EpisodeList"
] | train | https://github.com/Omertron/api-tvrage/blob/4e805a99de812fabea69d97098f2376be14d51bc/src/main/java/com/omertron/tvrageapi/tools/TVRageParser.java#L133-L149 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/HttpCookie.java | HttpCookie.guessCookieVersion | private static int guessCookieVersion(String header) {
int version = 0;
header = header.toLowerCase();
if (header.indexOf("expires=") != -1) {
// only netscape cookie using 'expires'
version = 0;
} else if (header.indexOf("version=") != -1) {
// version is mandatory for rfc 2965/2109 cookie
version = 1;
} else if (header.indexOf("max-age") != -1) {
// rfc 2965/2109 use 'max-age'
version = 1;
} else if (startsWithIgnoreCase(header, SET_COOKIE2)) {
// only rfc 2965 cookie starts with 'set-cookie2'
version = 1;
}
return version;
} | java | private static int guessCookieVersion(String header) {
int version = 0;
header = header.toLowerCase();
if (header.indexOf("expires=") != -1) {
// only netscape cookie using 'expires'
version = 0;
} else if (header.indexOf("version=") != -1) {
// version is mandatory for rfc 2965/2109 cookie
version = 1;
} else if (header.indexOf("max-age") != -1) {
// rfc 2965/2109 use 'max-age'
version = 1;
} else if (startsWithIgnoreCase(header, SET_COOKIE2)) {
// only rfc 2965 cookie starts with 'set-cookie2'
version = 1;
}
return version;
} | [
"private",
"static",
"int",
"guessCookieVersion",
"(",
"String",
"header",
")",
"{",
"int",
"version",
"=",
"0",
";",
"header",
"=",
"header",
".",
"toLowerCase",
"(",
")",
";",
"if",
"(",
"header",
".",
"indexOf",
"(",
"\"expires=\"",
")",
"!=",
"-",
... | /*
try to guess the cookie version through set-cookie header string | [
"/",
"*",
"try",
"to",
"guess",
"the",
"cookie",
"version",
"through",
"set",
"-",
"cookie",
"header",
"string"
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/HttpCookie.java#L1202-L1221 |
JOML-CI/JOML | src/org/joml/Matrix4x3f.java | Matrix4x3f.rotateLocalY | public Matrix4x3f rotateLocalY(float ang, Matrix4x3f dest) {
float sin = (float) Math.sin(ang);
float cos = (float) Math.cosFromSin(sin, ang);
float nm00 = cos * m00 + sin * m02;
float nm02 = -sin * m00 + cos * m02;
float nm10 = cos * m10 + sin * m12;
float nm12 = -sin * m10 + cos * m12;
float nm20 = cos * m20 + sin * m22;
float nm22 = -sin * m20 + cos * m22;
float nm30 = cos * m30 + sin * m32;
float nm32 = -sin * m30 + cos * m32;
dest._m00(nm00);
dest._m01(m01);
dest._m02(nm02);
dest._m10(nm10);
dest._m11(m11);
dest._m12(nm12);
dest._m20(nm20);
dest._m21(m21);
dest._m22(nm22);
dest._m30(nm30);
dest._m31(m31);
dest._m32(nm32);
dest.properties = properties & ~(PROPERTY_IDENTITY | PROPERTY_TRANSLATION);
return dest;
} | java | public Matrix4x3f rotateLocalY(float ang, Matrix4x3f dest) {
float sin = (float) Math.sin(ang);
float cos = (float) Math.cosFromSin(sin, ang);
float nm00 = cos * m00 + sin * m02;
float nm02 = -sin * m00 + cos * m02;
float nm10 = cos * m10 + sin * m12;
float nm12 = -sin * m10 + cos * m12;
float nm20 = cos * m20 + sin * m22;
float nm22 = -sin * m20 + cos * m22;
float nm30 = cos * m30 + sin * m32;
float nm32 = -sin * m30 + cos * m32;
dest._m00(nm00);
dest._m01(m01);
dest._m02(nm02);
dest._m10(nm10);
dest._m11(m11);
dest._m12(nm12);
dest._m20(nm20);
dest._m21(m21);
dest._m22(nm22);
dest._m30(nm30);
dest._m31(m31);
dest._m32(nm32);
dest.properties = properties & ~(PROPERTY_IDENTITY | PROPERTY_TRANSLATION);
return dest;
} | [
"public",
"Matrix4x3f",
"rotateLocalY",
"(",
"float",
"ang",
",",
"Matrix4x3f",
"dest",
")",
"{",
"float",
"sin",
"=",
"(",
"float",
")",
"Math",
".",
"sin",
"(",
"ang",
")",
";",
"float",
"cos",
"=",
"(",
"float",
")",
"Math",
".",
"cosFromSin",
"("... | Pre-multiply a rotation around the Y axis to this matrix by rotating the given amount of radians
about the Y axis and store the result in <code>dest</code>.
<p>
When used with a right-handed coordinate system, the produced rotation will rotate a vector
counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin.
When used with a left-handed coordinate system, the rotation is clockwise.
<p>
If <code>M</code> is <code>this</code> matrix and <code>R</code> the rotation matrix,
then the new matrix will be <code>R * M</code>. So when transforming a
vector <code>v</code> with the new matrix by using <code>R * M * v</code>, the
rotation will be applied last!
<p>
In order to set the matrix to a rotation matrix without pre-multiplying the rotation
transformation, use {@link #rotationY(float) rotationY()}.
<p>
Reference: <a href="http://en.wikipedia.org/wiki/Rotation_matrix#Rotation_matrix_from_axis_and_angle">http://en.wikipedia.org</a>
@see #rotationY(float)
@param ang
the angle in radians to rotate about the Y axis
@param dest
will hold the result
@return dest | [
"Pre",
"-",
"multiply",
"a",
"rotation",
"around",
"the",
"Y",
"axis",
"to",
"this",
"matrix",
"by",
"rotating",
"the",
"given",
"amount",
"of",
"radians",
"about",
"the",
"Y",
"axis",
"and",
"store",
"the",
"result",
"in",
"<code",
">",
"dest<",
"/",
... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4x3f.java#L4324-L4349 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/source/util/SimpleDocTreeVisitor.java | SimpleDocTreeVisitor.visitSerialField | @Override
public R visitSerialField(SerialFieldTree node, P p) {
return defaultAction(node, p);
} | java | @Override
public R visitSerialField(SerialFieldTree node, P p) {
return defaultAction(node, p);
} | [
"@",
"Override",
"public",
"R",
"visitSerialField",
"(",
"SerialFieldTree",
"node",
",",
"P",
"p",
")",
"{",
"return",
"defaultAction",
"(",
"node",
",",
"p",
")",
";",
"}"
] | {@inheritDoc} This implementation calls {@code defaultAction}.
@param node {@inheritDoc}
@param p {@inheritDoc}
@return the result of {@code defaultAction} | [
"{",
"@inheritDoc",
"}",
"This",
"implementation",
"calls",
"{",
"@code",
"defaultAction",
"}",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/source/util/SimpleDocTreeVisitor.java#L369-L372 |
mikepenz/FastAdapter | app/src/main/java/com/mikepenz/fastadapter/app/items/RealmSampleUserItem.java | RealmSampleUserItem.generateView | @Override
public View generateView(Context ctx, ViewGroup parent) {
ViewHolder viewHolder = getViewHolder(LayoutInflater.from(ctx).inflate(getLayoutRes(), parent, false));
//as we already know the type of our ViewHolder cast it to our type
bindView(viewHolder, Collections.EMPTY_LIST);
//return the bound and generatedView
return viewHolder.itemView;
} | java | @Override
public View generateView(Context ctx, ViewGroup parent) {
ViewHolder viewHolder = getViewHolder(LayoutInflater.from(ctx).inflate(getLayoutRes(), parent, false));
//as we already know the type of our ViewHolder cast it to our type
bindView(viewHolder, Collections.EMPTY_LIST);
//return the bound and generatedView
return viewHolder.itemView;
} | [
"@",
"Override",
"public",
"View",
"generateView",
"(",
"Context",
"ctx",
",",
"ViewGroup",
"parent",
")",
"{",
"ViewHolder",
"viewHolder",
"=",
"getViewHolder",
"(",
"LayoutInflater",
".",
"from",
"(",
"ctx",
")",
".",
"inflate",
"(",
"getLayoutRes",
"(",
"... | generates a view by the defined LayoutRes and pass the LayoutParams from the parent
@param ctx
@param parent
@return | [
"generates",
"a",
"view",
"by",
"the",
"defined",
"LayoutRes",
"and",
"pass",
"the",
"LayoutParams",
"from",
"the",
"parent"
] | train | https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/app/src/main/java/com/mikepenz/fastadapter/app/items/RealmSampleUserItem.java#L202-L210 |
pebble/pebble-android-sdk | PebbleKit/PebbleKit/src/main/java/com/getpebble/android/kit/PebbleKit.java | PebbleKit.startAppOnPebble | public static void startAppOnPebble(final Context context, final UUID watchappUuid)
throws IllegalArgumentException {
if (watchappUuid == null) {
throw new IllegalArgumentException("uuid cannot be null");
}
final Intent startAppIntent = new Intent(INTENT_APP_START);
startAppIntent.putExtra(APP_UUID, watchappUuid);
context.sendBroadcast(startAppIntent);
} | java | public static void startAppOnPebble(final Context context, final UUID watchappUuid)
throws IllegalArgumentException {
if (watchappUuid == null) {
throw new IllegalArgumentException("uuid cannot be null");
}
final Intent startAppIntent = new Intent(INTENT_APP_START);
startAppIntent.putExtra(APP_UUID, watchappUuid);
context.sendBroadcast(startAppIntent);
} | [
"public",
"static",
"void",
"startAppOnPebble",
"(",
"final",
"Context",
"context",
",",
"final",
"UUID",
"watchappUuid",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"watchappUuid",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
... | Send a message to the connected Pebble to launch an application identified by a UUID. If another application is
currently running it will be terminated and the new application will be brought to the foreground.
@param context
The context used to send the broadcast.
@param watchappUuid
A UUID uniquely identifying the target application. UUIDs for the stock PebbleKit applications are
available in {@link Constants}.
@throws IllegalArgumentException
Thrown if the specified UUID is invalid. | [
"Send",
"a",
"message",
"to",
"the",
"connected",
"Pebble",
"to",
"launch",
"an",
"application",
"identified",
"by",
"a",
"UUID",
".",
"If",
"another",
"application",
"is",
"currently",
"running",
"it",
"will",
"be",
"terminated",
"and",
"the",
"new",
"appli... | train | https://github.com/pebble/pebble-android-sdk/blob/ddfc53ecf3950deebb62a1f205aa21fbe9bce45d/PebbleKit/PebbleKit/src/main/java/com/getpebble/android/kit/PebbleKit.java#L212-L222 |
ow2-chameleon/fuchsia | bases/knx/calimero/src/main/java/tuwien/auto/calimero/dptxlator/DPTXlatorTime.java | DPTXlatorTime.setValue | public final void setValue(int dayOfWeek, int hour, int minute, int second)
{
data = set(dayOfWeek, hour, minute, second, new short[3], 0);
} | java | public final void setValue(int dayOfWeek, int hour, int minute, int second)
{
data = set(dayOfWeek, hour, minute, second, new short[3], 0);
} | [
"public",
"final",
"void",
"setValue",
"(",
"int",
"dayOfWeek",
",",
"int",
"hour",
",",
"int",
"minute",
",",
"int",
"second",
")",
"{",
"data",
"=",
"set",
"(",
"dayOfWeek",
",",
"hour",
",",
"minute",
",",
"second",
",",
"new",
"short",
"[",
"3",
... | Sets the day of week, hour, minute and second information for the first time item.
<p>
Any other items in the translator are discarded on successful set.<br>
A day of week value of 0 corresponds to "no-day", indicating the day of week is not
used. The first day of week is Monday with a value of 1, the last day is Sunday
with a value of 7. <br>
@param dayOfWeek day of week, 0 <= day <= 7
@param hour hour value, 0 <= hour <= 23
@param minute minute value, 0 <= minute <= 59
@param second second value, 0 <= second <= 59 | [
"Sets",
"the",
"day",
"of",
"week",
"hour",
"minute",
"and",
"second",
"information",
"for",
"the",
"first",
"time",
"item",
".",
"<p",
">",
"Any",
"other",
"items",
"in",
"the",
"translator",
"are",
"discarded",
"on",
"successful",
"set",
".",
"<br",
">... | train | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/bases/knx/calimero/src/main/java/tuwien/auto/calimero/dptxlator/DPTXlatorTime.java#L194-L197 |
astrapi69/mystic-crypt | crypt-data/src/main/java/de/alpharogroup/crypto/factories/KeyPairFactory.java | KeyPairFactory.newKeyPair | public static KeyPair newKeyPair(final File publicKeyDerFile, final File privateKeyDerFile)
throws NoSuchAlgorithmException, InvalidKeySpecException, NoSuchProviderException,
IOException
{
final PublicKey publicKey = PublicKeyReader.readPublicKey(publicKeyDerFile);
final PrivateKey privateKey = PrivateKeyReader.readPrivateKey(privateKeyDerFile);
return newKeyPair(publicKey, privateKey);
} | java | public static KeyPair newKeyPair(final File publicKeyDerFile, final File privateKeyDerFile)
throws NoSuchAlgorithmException, InvalidKeySpecException, NoSuchProviderException,
IOException
{
final PublicKey publicKey = PublicKeyReader.readPublicKey(publicKeyDerFile);
final PrivateKey privateKey = PrivateKeyReader.readPrivateKey(privateKeyDerFile);
return newKeyPair(publicKey, privateKey);
} | [
"public",
"static",
"KeyPair",
"newKeyPair",
"(",
"final",
"File",
"publicKeyDerFile",
",",
"final",
"File",
"privateKeyDerFile",
")",
"throws",
"NoSuchAlgorithmException",
",",
"InvalidKeySpecException",
",",
"NoSuchProviderException",
",",
"IOException",
"{",
"final",
... | Factory method for creating a new {@link KeyPair} from the given parameters.
@param publicKeyDerFile
the public key der file
@param privateKeyDerFile
the private key der file
@return the new {@link KeyPair} from the given parameters.
@throws IOException
Signals that an I/O exception has occurred.
@throws NoSuchAlgorithmException
is thrown if no Provider supports a KeyPairGeneratorSpi implementation for the
specified algorithm
@throws InvalidKeySpecException
is thrown if generation of the SecretKey object fails.
@throws NoSuchProviderException
is thrown if the specified provider is not registered in the security provider
list | [
"Factory",
"method",
"for",
"creating",
"a",
"new",
"{",
"@link",
"KeyPair",
"}",
"from",
"the",
"given",
"parameters",
"."
] | train | https://github.com/astrapi69/mystic-crypt/blob/7f51ef5e4457e24de7ff391f10bfc5609e6f1a34/crypt-data/src/main/java/de/alpharogroup/crypto/factories/KeyPairFactory.java#L154-L161 |
bwkimmel/jdcp | jdcp-console/src/main/java/ca/eandb/jdcp/client/ScriptFacade.java | ScriptFacade.setJobPriority | public void setJobPriority(UUID jobId, int priority) throws Exception {
config.getJobService().setJobPriority(jobId, priority);
} | java | public void setJobPriority(UUID jobId, int priority) throws Exception {
config.getJobService().setJobPriority(jobId, priority);
} | [
"public",
"void",
"setJobPriority",
"(",
"UUID",
"jobId",
",",
"int",
"priority",
")",
"throws",
"Exception",
"{",
"config",
".",
"getJobService",
"(",
")",
".",
"setJobPriority",
"(",
"jobId",
",",
"priority",
")",
";",
"}"
] | Sets the priority of the specified job.
@param jobId The <code>UUID</code> of the job for which to set the
priority.
@param priority The priority to assign to the job.
@throws Exception if an error occurs in delegating the request to the
configured job service | [
"Sets",
"the",
"priority",
"of",
"the",
"specified",
"job",
"."
] | train | https://github.com/bwkimmel/jdcp/blob/630c5150c245054e2556ff370f4bad2ec793dfb7/jdcp-console/src/main/java/ca/eandb/jdcp/client/ScriptFacade.java#L71-L73 |
cdk/cdk | legacy/src/main/java/org/openscience/cdk/smsd/tools/ExtAtomContainerManipulator.java | ExtAtomContainerManipulator.getHydrogenCount | public static int getHydrogenCount(IAtomContainer atomContainer, IAtom atom) {
return getExplicitHydrogenCount(atomContainer, atom) + getImplicitHydrogenCount(atom);
} | java | public static int getHydrogenCount(IAtomContainer atomContainer, IAtom atom) {
return getExplicitHydrogenCount(atomContainer, atom) + getImplicitHydrogenCount(atom);
} | [
"public",
"static",
"int",
"getHydrogenCount",
"(",
"IAtomContainer",
"atomContainer",
",",
"IAtom",
"atom",
")",
"{",
"return",
"getExplicitHydrogenCount",
"(",
"atomContainer",
",",
"atom",
")",
"+",
"getImplicitHydrogenCount",
"(",
"atom",
")",
";",
"}"
] | The summed implicit + explicit hydrogens of the given IAtom.
@param atomContainer
@param atom
@return The summed implicit + explicit hydrogens of the given IAtom. | [
"The",
"summed",
"implicit",
"+",
"explicit",
"hydrogens",
"of",
"the",
"given",
"IAtom",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/legacy/src/main/java/org/openscience/cdk/smsd/tools/ExtAtomContainerManipulator.java#L214-L216 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/StrictMath.java | StrictMath.copySign | public static float copySign(float magnitude, float sign) {
return Math.copySign(magnitude, (Float.isNaN(sign)?1.0f:sign));
} | java | public static float copySign(float magnitude, float sign) {
return Math.copySign(magnitude, (Float.isNaN(sign)?1.0f:sign));
} | [
"public",
"static",
"float",
"copySign",
"(",
"float",
"magnitude",
",",
"float",
"sign",
")",
"{",
"return",
"Math",
".",
"copySign",
"(",
"magnitude",
",",
"(",
"Float",
".",
"isNaN",
"(",
"sign",
")",
"?",
"1.0f",
":",
"sign",
")",
")",
";",
"}"
] | Returns the first floating-point argument with the sign of the
second floating-point argument. For this method, a NaN
{@code sign} argument is always treated as if it were
positive.
@param magnitude the parameter providing the magnitude of the result
@param sign the parameter providing the sign of the result
@return a value with the magnitude of {@code magnitude}
and the sign of {@code sign}.
@since 1.6 | [
"Returns",
"the",
"first",
"floating",
"-",
"point",
"argument",
"with",
"the",
"sign",
"of",
"the",
"second",
"floating",
"-",
"point",
"argument",
".",
"For",
"this",
"method",
"a",
"NaN",
"{",
"@code",
"sign",
"}",
"argument",
"is",
"always",
"treated",... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/StrictMath.java#L1403-L1405 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/net/www/URLConnection.java | URLConnection.addRequestProperty | public void addRequestProperty(String key, String value) {
if (connected)
throw new IllegalStateException("Already connected");
if (key == null)
throw new NullPointerException ("key is null");
} | java | public void addRequestProperty(String key, String value) {
if (connected)
throw new IllegalStateException("Already connected");
if (key == null)
throw new NullPointerException ("key is null");
} | [
"public",
"void",
"addRequestProperty",
"(",
"String",
"key",
",",
"String",
"value",
")",
"{",
"if",
"(",
"connected",
")",
"throw",
"new",
"IllegalStateException",
"(",
"\"Already connected\"",
")",
";",
"if",
"(",
"key",
"==",
"null",
")",
"throw",
"new",... | The following three methods addRequestProperty, getRequestProperty,
and getRequestProperties were copied from the superclass implementation
before it was changed by CR:6230836, to maintain backward compatibility. | [
"The",
"following",
"three",
"methods",
"addRequestProperty",
"getRequestProperty",
"and",
"getRequestProperties",
"were",
"copied",
"from",
"the",
"superclass",
"implementation",
"before",
"it",
"was",
"changed",
"by",
"CR",
":",
"6230836",
"to",
"maintain",
"backwar... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/net/www/URLConnection.java#L86-L91 |
ehcache/ehcache3 | impl/src/main/java/org/ehcache/config/builders/UserManagedCacheBuilder.java | UserManagedCacheBuilder.withSizeOfMaxObjectSize | public UserManagedCacheBuilder<K, V, T> withSizeOfMaxObjectSize(long size, MemoryUnit unit) {
UserManagedCacheBuilder<K, V, T> otherBuilder = new UserManagedCacheBuilder<>(this);
removeAnySizeOfEngine(otherBuilder);
otherBuilder.maxObjectSize = size;
otherBuilder.sizeOfUnit = unit;
otherBuilder.serviceCreationConfigurations.add(new DefaultSizeOfEngineProviderConfiguration(otherBuilder.maxObjectSize, otherBuilder.sizeOfUnit, otherBuilder.objectGraphSize));
return otherBuilder;
} | java | public UserManagedCacheBuilder<K, V, T> withSizeOfMaxObjectSize(long size, MemoryUnit unit) {
UserManagedCacheBuilder<K, V, T> otherBuilder = new UserManagedCacheBuilder<>(this);
removeAnySizeOfEngine(otherBuilder);
otherBuilder.maxObjectSize = size;
otherBuilder.sizeOfUnit = unit;
otherBuilder.serviceCreationConfigurations.add(new DefaultSizeOfEngineProviderConfiguration(otherBuilder.maxObjectSize, otherBuilder.sizeOfUnit, otherBuilder.objectGraphSize));
return otherBuilder;
} | [
"public",
"UserManagedCacheBuilder",
"<",
"K",
",",
"V",
",",
"T",
">",
"withSizeOfMaxObjectSize",
"(",
"long",
"size",
",",
"MemoryUnit",
"unit",
")",
"{",
"UserManagedCacheBuilder",
"<",
"K",
",",
"V",
",",
"T",
">",
"otherBuilder",
"=",
"new",
"UserManage... | Adds or updates the {@link DefaultSizeOfEngineProviderConfiguration} with the specified maximum mapping size to the configured
builder.
<p>
{@link SizeOfEngine} is what enables the heap tier to be sized in {@link MemoryUnit}.
@param size the maximum mapping size
@param unit the memory unit
@return a new builder with the added / updated configuration | [
"Adds",
"or",
"updates",
"the",
"{",
"@link",
"DefaultSizeOfEngineProviderConfiguration",
"}",
"with",
"the",
"specified",
"maximum",
"mapping",
"size",
"to",
"the",
"configured",
"builder",
".",
"<p",
">",
"{",
"@link",
"SizeOfEngine",
"}",
"is",
"what",
"enabl... | train | https://github.com/ehcache/ehcache3/blob/3cceda57185e522f8d241ddb75146d67ee2af898/impl/src/main/java/org/ehcache/config/builders/UserManagedCacheBuilder.java#L759-L766 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WMenu.java | WMenu.getSelectableItems | private List<MenuItemSelectable> getSelectableItems(final MenuSelectContainer selectContainer) {
List<MenuItemSelectable> result = new ArrayList<>(selectContainer.getMenuItems().size());
SelectionMode selectionMode = selectContainer.getSelectionMode();
for (MenuItem item : selectContainer.getMenuItems()) {
if (item instanceof MenuItemGroup) {
for (MenuItem groupItem : ((MenuItemGroup) item).getMenuItems()) {
if (isSelectable(groupItem, selectionMode)) {
result.add((MenuItemSelectable) groupItem);
}
}
} else if (isSelectable(item, selectionMode)) {
result.add((MenuItemSelectable) item);
}
}
return result;
} | java | private List<MenuItemSelectable> getSelectableItems(final MenuSelectContainer selectContainer) {
List<MenuItemSelectable> result = new ArrayList<>(selectContainer.getMenuItems().size());
SelectionMode selectionMode = selectContainer.getSelectionMode();
for (MenuItem item : selectContainer.getMenuItems()) {
if (item instanceof MenuItemGroup) {
for (MenuItem groupItem : ((MenuItemGroup) item).getMenuItems()) {
if (isSelectable(groupItem, selectionMode)) {
result.add((MenuItemSelectable) groupItem);
}
}
} else if (isSelectable(item, selectionMode)) {
result.add((MenuItemSelectable) item);
}
}
return result;
} | [
"private",
"List",
"<",
"MenuItemSelectable",
">",
"getSelectableItems",
"(",
"final",
"MenuSelectContainer",
"selectContainer",
")",
"{",
"List",
"<",
"MenuItemSelectable",
">",
"result",
"=",
"new",
"ArrayList",
"<>",
"(",
"selectContainer",
".",
"getMenuItems",
"... | Retrieves the selectable items for the given container.
@param selectContainer the component to search within.
@return the list of selectable items for the given component. May be empty. | [
"Retrieves",
"the",
"selectable",
"items",
"for",
"the",
"given",
"container",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WMenu.java#L541-L559 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/runtime/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/runtime/implementation/PredictionsImpl.java | PredictionsImpl.resolveWithServiceResponseAsync | public Observable<ServiceResponse<LuisResult>> resolveWithServiceResponseAsync(String appId, String query, ResolveOptionalParameter resolveOptionalParameter) {
if (this.client.endpoint() == null) {
throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null.");
}
if (appId == null) {
throw new IllegalArgumentException("Parameter appId is required and cannot be null.");
}
if (query == null) {
throw new IllegalArgumentException("Parameter query is required and cannot be null.");
}
final Double timezoneOffset = resolveOptionalParameter != null ? resolveOptionalParameter.timezoneOffset() : null;
final Boolean verbose = resolveOptionalParameter != null ? resolveOptionalParameter.verbose() : null;
final Boolean staging = resolveOptionalParameter != null ? resolveOptionalParameter.staging() : null;
final Boolean spellCheck = resolveOptionalParameter != null ? resolveOptionalParameter.spellCheck() : null;
final String bingSpellCheckSubscriptionKey = resolveOptionalParameter != null ? resolveOptionalParameter.bingSpellCheckSubscriptionKey() : null;
final Boolean log = resolveOptionalParameter != null ? resolveOptionalParameter.log() : null;
return resolveWithServiceResponseAsync(appId, query, timezoneOffset, verbose, staging, spellCheck, bingSpellCheckSubscriptionKey, log);
} | java | public Observable<ServiceResponse<LuisResult>> resolveWithServiceResponseAsync(String appId, String query, ResolveOptionalParameter resolveOptionalParameter) {
if (this.client.endpoint() == null) {
throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null.");
}
if (appId == null) {
throw new IllegalArgumentException("Parameter appId is required and cannot be null.");
}
if (query == null) {
throw new IllegalArgumentException("Parameter query is required and cannot be null.");
}
final Double timezoneOffset = resolveOptionalParameter != null ? resolveOptionalParameter.timezoneOffset() : null;
final Boolean verbose = resolveOptionalParameter != null ? resolveOptionalParameter.verbose() : null;
final Boolean staging = resolveOptionalParameter != null ? resolveOptionalParameter.staging() : null;
final Boolean spellCheck = resolveOptionalParameter != null ? resolveOptionalParameter.spellCheck() : null;
final String bingSpellCheckSubscriptionKey = resolveOptionalParameter != null ? resolveOptionalParameter.bingSpellCheckSubscriptionKey() : null;
final Boolean log = resolveOptionalParameter != null ? resolveOptionalParameter.log() : null;
return resolveWithServiceResponseAsync(appId, query, timezoneOffset, verbose, staging, spellCheck, bingSpellCheckSubscriptionKey, log);
} | [
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"LuisResult",
">",
">",
"resolveWithServiceResponseAsync",
"(",
"String",
"appId",
",",
"String",
"query",
",",
"ResolveOptionalParameter",
"resolveOptionalParameter",
")",
"{",
"if",
"(",
"this",
".",
"client",
"... | Gets predictions for a given utterance, in the form of intents and entities. The current maximum query size is 500 characters.
@param appId The LUIS application ID (Guid).
@param query The utterance to predict.
@param resolveOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the LuisResult object | [
"Gets",
"predictions",
"for",
"a",
"given",
"utterance",
"in",
"the",
"form",
"of",
"intents",
"and",
"entities",
".",
"The",
"current",
"maximum",
"query",
"size",
"is",
"500",
"characters",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/runtime/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/runtime/implementation/PredictionsImpl.java#L122-L140 |
medined/d4m | src/main/java/com/codebits/d4m/TableManager.java | TableManager.addSplits | public void addSplits(final String tablename, final SortedSet<Text> splits) {
try {
tableOperations.addSplits(tablename, splits);
} catch (TableNotFoundException e) {
throw new D4MException(String.format("Unable to find table [%s]", tablename), e);
} catch (AccumuloException | AccumuloSecurityException e) {
throw new D4MException(String.format("Unable to add splits to table [%s]", tablename), e);
}
} | java | public void addSplits(final String tablename, final SortedSet<Text> splits) {
try {
tableOperations.addSplits(tablename, splits);
} catch (TableNotFoundException e) {
throw new D4MException(String.format("Unable to find table [%s]", tablename), e);
} catch (AccumuloException | AccumuloSecurityException e) {
throw new D4MException(String.format("Unable to add splits to table [%s]", tablename), e);
}
} | [
"public",
"void",
"addSplits",
"(",
"final",
"String",
"tablename",
",",
"final",
"SortedSet",
"<",
"Text",
">",
"splits",
")",
"{",
"try",
"{",
"tableOperations",
".",
"addSplits",
"(",
"tablename",
",",
"splits",
")",
";",
"}",
"catch",
"(",
"TableNotFou... | Pre-split the Tedge and TedgeText tables.
@param tablename name of the accumulo table
@param splits set of splits to add | [
"Pre",
"-",
"split",
"the",
"Tedge",
"and",
"TedgeText",
"tables",
"."
] | train | https://github.com/medined/d4m/blob/b61100609fba6961f6c903fcf96b687122c5bf05/src/main/java/com/codebits/d4m/TableManager.java#L205-L213 |
buschmais/jqa-maven3-plugin | src/main/java/com/buschmais/jqassistant/plugin/maven3/impl/scanner/MavenProjectScannerPlugin.java | MavenProjectScannerPlugin.scanPath | private <F extends FileDescriptor> void scanPath(MavenProjectDirectoryDescriptor projectDescriptor, String path, Scope scope, Scanner scanner) {
File file = new File(path);
if (!file.exists()) {
LOGGER.debug(file.getAbsolutePath() + " does not exist, skipping.");
} else {
F fileDescriptor = scanFile(projectDescriptor, file, path, scope, scanner);
if (fileDescriptor != null) {
projectDescriptor.getContains().add(fileDescriptor);
}
}
} | java | private <F extends FileDescriptor> void scanPath(MavenProjectDirectoryDescriptor projectDescriptor, String path, Scope scope, Scanner scanner) {
File file = new File(path);
if (!file.exists()) {
LOGGER.debug(file.getAbsolutePath() + " does not exist, skipping.");
} else {
F fileDescriptor = scanFile(projectDescriptor, file, path, scope, scanner);
if (fileDescriptor != null) {
projectDescriptor.getContains().add(fileDescriptor);
}
}
} | [
"private",
"<",
"F",
"extends",
"FileDescriptor",
">",
"void",
"scanPath",
"(",
"MavenProjectDirectoryDescriptor",
"projectDescriptor",
",",
"String",
"path",
",",
"Scope",
"scope",
",",
"Scanner",
"scanner",
")",
"{",
"File",
"file",
"=",
"new",
"File",
"(",
... | Scan a given path and add it to
{@link MavenProjectDirectoryDescriptor#getContains()}.
@param projectDescriptor
The maven project descriptor.
@param path
The path.
@param scope
The scope.
@param scanner
The scanner. | [
"Scan",
"a",
"given",
"path",
"and",
"add",
"it",
"to",
"{",
"@link",
"MavenProjectDirectoryDescriptor#getContains",
"()",
"}",
"."
] | train | https://github.com/buschmais/jqa-maven3-plugin/blob/6c6e2dca56de6d5b8ceeb2f28982fb6d7c98778f/src/main/java/com/buschmais/jqassistant/plugin/maven3/impl/scanner/MavenProjectScannerPlugin.java#L330-L340 |
ldapchai/ldapchai | src/main/java/com/novell/ldapchai/util/SearchHelper.java | SearchHelper.setFilterExists | public void setFilterExists( final String attributeName )
{
final StringBuilder sb = new StringBuilder();
sb.append( "(" );
sb.append( new FilterSequence( attributeName, "*", FilterSequence.MatchingRuleEnum.EQUALS ) );
sb.append( ")" );
this.filter = sb.toString();
} | java | public void setFilterExists( final String attributeName )
{
final StringBuilder sb = new StringBuilder();
sb.append( "(" );
sb.append( new FilterSequence( attributeName, "*", FilterSequence.MatchingRuleEnum.EQUALS ) );
sb.append( ")" );
this.filter = sb.toString();
} | [
"public",
"void",
"setFilterExists",
"(",
"final",
"String",
"attributeName",
")",
"{",
"final",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"sb",
".",
"append",
"(",
"\"(\"",
")",
";",
"sb",
".",
"append",
"(",
"new",
"FilterSequenc... | Set up an exists filter for attribute name. Consider the following example.
<table border="1"><caption>Example Values</caption>
<tr><td><b>Value</b></td></tr>
<tr><td>givenName</td></tr>
</table>
<p><i>Result</i></p>
<code>(givenName=*)</code>
@param attributeName A valid attribute name | [
"Set",
"up",
"an",
"exists",
"filter",
"for",
"attribute",
"name",
".",
"Consider",
"the",
"following",
"example",
"."
] | train | https://github.com/ldapchai/ldapchai/blob/a6d4b5dbfa4e270db0ce70892512cbe39e64b874/src/main/java/com/novell/ldapchai/util/SearchHelper.java#L523-L530 |
jqm4gwt/jqm4gwt | library/src/main/java/com/sksamuel/jqm4gwt/toolbar/JQMHeader.java | JQMHeader.setRightButton | public JQMButton setRightButton(String text, JQMPage page) {
return setRightButton(text, page, null);
} | java | public JQMButton setRightButton(String text, JQMPage page) {
return setRightButton(text, page, null);
} | [
"public",
"JQMButton",
"setRightButton",
"(",
"String",
"text",
",",
"JQMPage",
"page",
")",
"{",
"return",
"setRightButton",
"(",
"text",
",",
"page",
",",
"null",
")",
";",
"}"
] | Creates a new {@link JQMButton} with the given text and linking to the
given {@link JQMPage} and then sets that button in the right slot. Any
existing right button will be replaced.
@param text
the text for the button
@param page
the optional page for the button to link to, if null then
this button does not navigate by default
@return the created button | [
"Creates",
"a",
"new",
"{",
"@link",
"JQMButton",
"}",
"with",
"the",
"given",
"text",
"and",
"linking",
"to",
"the",
"given",
"{",
"@link",
"JQMPage",
"}",
"and",
"then",
"sets",
"that",
"button",
"in",
"the",
"right",
"slot",
".",
"Any",
"existing",
... | train | https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/src/main/java/com/sksamuel/jqm4gwt/toolbar/JQMHeader.java#L310-L312 |
JOML-CI/JOML | src/org/joml/Matrix4f.java | Matrix4f.setOrthoSymmetric | public Matrix4f setOrthoSymmetric(float width, float height, float zNear, float zFar, boolean zZeroToOne) {
if ((properties & PROPERTY_IDENTITY) == 0)
MemUtil.INSTANCE.identity(this);
this._m00(2.0f / width);
this._m11(2.0f / height);
this._m22((zZeroToOne ? 1.0f : 2.0f) / (zNear - zFar));
this._m32((zZeroToOne ? zNear : (zFar + zNear)) / (zNear - zFar));
_properties(PROPERTY_AFFINE);
return this;
} | java | public Matrix4f setOrthoSymmetric(float width, float height, float zNear, float zFar, boolean zZeroToOne) {
if ((properties & PROPERTY_IDENTITY) == 0)
MemUtil.INSTANCE.identity(this);
this._m00(2.0f / width);
this._m11(2.0f / height);
this._m22((zZeroToOne ? 1.0f : 2.0f) / (zNear - zFar));
this._m32((zZeroToOne ? zNear : (zFar + zNear)) / (zNear - zFar));
_properties(PROPERTY_AFFINE);
return this;
} | [
"public",
"Matrix4f",
"setOrthoSymmetric",
"(",
"float",
"width",
",",
"float",
"height",
",",
"float",
"zNear",
",",
"float",
"zFar",
",",
"boolean",
"zZeroToOne",
")",
"{",
"if",
"(",
"(",
"properties",
"&",
"PROPERTY_IDENTITY",
")",
"==",
"0",
")",
"Mem... | Set this matrix to be a symmetric orthographic projection transformation for a right-handed coordinate system using the given NDC z range.
<p>
This method is equivalent to calling {@link #setOrtho(float, float, float, float, float, float, boolean) setOrtho()} with
<code>left=-width/2</code>, <code>right=+width/2</code>, <code>bottom=-height/2</code> and <code>top=+height/2</code>.
<p>
In order to apply the symmetric orthographic projection to an already existing transformation,
use {@link #orthoSymmetric(float, float, float, float, boolean) orthoSymmetric()}.
<p>
Reference: <a href="http://www.songho.ca/opengl/gl_projectionmatrix.html#ortho">http://www.songho.ca</a>
@see #orthoSymmetric(float, float, float, float, boolean)
@param width
the distance between the right and left frustum edges
@param height
the distance between the top and bottom frustum edges
@param zNear
near clipping plane distance
@param zFar
far clipping plane distance
@param zZeroToOne
whether to use Vulkan's and Direct3D's NDC z range of <code>[0..+1]</code> when <code>true</code>
or whether to use OpenGL's NDC z range of <code>[-1..+1]</code> when <code>false</code>
@return this | [
"Set",
"this",
"matrix",
"to",
"be",
"a",
"symmetric",
"orthographic",
"projection",
"transformation",
"for",
"a",
"right",
"-",
"handed",
"coordinate",
"system",
"using",
"the",
"given",
"NDC",
"z",
"range",
".",
"<p",
">",
"This",
"method",
"is",
"equivale... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4f.java#L7668-L7677 |
khuxtable/seaglass | src/main/java/com/seaglasslookandfeel/painter/TitlePaneIconifyButtonPainter.java | TitlePaneIconifyButtonPainter.paintMinimizeEnabled | private void paintMinimizeEnabled(Graphics2D g, JComponent c, int width, int height) {
iconifyPainter.paintEnabled(g, c, width, height);
} | java | private void paintMinimizeEnabled(Graphics2D g, JComponent c, int width, int height) {
iconifyPainter.paintEnabled(g, c, width, height);
} | [
"private",
"void",
"paintMinimizeEnabled",
"(",
"Graphics2D",
"g",
",",
"JComponent",
"c",
",",
"int",
"width",
",",
"int",
"height",
")",
"{",
"iconifyPainter",
".",
"paintEnabled",
"(",
"g",
",",
"c",
",",
"width",
",",
"height",
")",
";",
"}"
] | Paint the foreground minimized button enabled state.
@param g the Graphics2D context to paint with.
@param c the component.
@param width the width of the component.
@param height the height of the component. | [
"Paint",
"the",
"foreground",
"minimized",
"button",
"enabled",
"state",
"."
] | train | https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/TitlePaneIconifyButtonPainter.java#L171-L173 |
joniles/mpxj | src/main/java/net/sf/mpxj/ProjectCalendar.java | ProjectCalendar.getTotalTime | private long getTotalTime(ProjectCalendarDateRanges exception, Date date, boolean after)
{
long currentTime = DateHelper.getCanonicalTime(date).getTime();
long total = 0;
for (DateRange range : exception)
{
total += getTime(range.getStart(), range.getEnd(), currentTime, after);
}
return (total);
} | java | private long getTotalTime(ProjectCalendarDateRanges exception, Date date, boolean after)
{
long currentTime = DateHelper.getCanonicalTime(date).getTime();
long total = 0;
for (DateRange range : exception)
{
total += getTime(range.getStart(), range.getEnd(), currentTime, after);
}
return (total);
} | [
"private",
"long",
"getTotalTime",
"(",
"ProjectCalendarDateRanges",
"exception",
",",
"Date",
"date",
",",
"boolean",
"after",
")",
"{",
"long",
"currentTime",
"=",
"DateHelper",
".",
"getCanonicalTime",
"(",
"date",
")",
".",
"getTime",
"(",
")",
";",
"long"... | Retrieves the amount of time represented by a calendar exception
before or after an intersection point.
@param exception calendar exception
@param date intersection time
@param after true to report time after intersection, false to report time before
@return length of time in milliseconds | [
"Retrieves",
"the",
"amount",
"of",
"time",
"represented",
"by",
"a",
"calendar",
"exception",
"before",
"or",
"after",
"an",
"intersection",
"point",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ProjectCalendar.java#L1423-L1432 |
gmessner/gitlab4j-api | src/main/java/org/gitlab4j/api/PackagesApi.java | PackagesApi.getPackage | public Package getPackage(Object projectIdOrPath, Integer packageId) throws GitLabApiException {
Response response = get(Response.Status.OK, null,
"projects", getProjectIdOrPath(projectIdOrPath), "packages", packageId);
return (response.readEntity(Package.class));
} | java | public Package getPackage(Object projectIdOrPath, Integer packageId) throws GitLabApiException {
Response response = get(Response.Status.OK, null,
"projects", getProjectIdOrPath(projectIdOrPath), "packages", packageId);
return (response.readEntity(Package.class));
} | [
"public",
"Package",
"getPackage",
"(",
"Object",
"projectIdOrPath",
",",
"Integer",
"packageId",
")",
"throws",
"GitLabApiException",
"{",
"Response",
"response",
"=",
"get",
"(",
"Response",
".",
"Status",
".",
"OK",
",",
"null",
",",
"\"projects\"",
",",
"g... | Get a single project package.
<pre><code>GitLab Endpoint: GET /projects/:id/packages/:package_id</code></pre>
@param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
@param packageId the ID of the package to get
@return a Package instance for the specified package ID
@throws GitLabApiException if any exception occurs | [
"Get",
"a",
"single",
"project",
"package",
"."
] | train | https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/PackagesApi.java#L119-L123 |
beders/Resty | src/main/java/us/monoid/json/JSONObject.java | JSONObject.putOnce | public JSONObject putOnce(Enum<?> key, Object value) throws JSONException {
return putOnce(key.name(), value);
} | java | public JSONObject putOnce(Enum<?> key, Object value) throws JSONException {
return putOnce(key.name(), value);
} | [
"public",
"JSONObject",
"putOnce",
"(",
"Enum",
"<",
"?",
">",
"key",
",",
"Object",
"value",
")",
"throws",
"JSONException",
"{",
"return",
"putOnce",
"(",
"key",
".",
"name",
"(",
")",
",",
"value",
")",
";",
"}"
] | Put a key/value pair in the JSONObject, but only if the key and the value
are both non-null, and only if there is not already a member with that
name.
@param key
@param value
@return his.
@throws JSONException
if the key is a duplicate | [
"Put",
"a",
"key",
"/",
"value",
"pair",
"in",
"the",
"JSONObject",
"but",
"only",
"if",
"the",
"key",
"and",
"the",
"value",
"are",
"both",
"non",
"-",
"null",
"and",
"only",
"if",
"there",
"is",
"not",
"already",
"a",
"member",
"with",
"that",
"nam... | train | https://github.com/beders/Resty/blob/4493603e9689c942cc3e53b9c5018010e414a364/src/main/java/us/monoid/json/JSONObject.java#L1531-L1533 |
sniffy/sniffy | sniffy-core/src/main/java/io/sniffy/LegacySpy.java | LegacySpy.verifyBetween | @Deprecated
public C verifyBetween(int minAllowedStatements, int maxAllowedStatements, Threads threadMatcher) throws WrongNumberOfQueriesError {
return verify(SqlQueries.queriesBetween(minAllowedStatements, maxAllowedStatements).threads(threadMatcher));
} | java | @Deprecated
public C verifyBetween(int minAllowedStatements, int maxAllowedStatements, Threads threadMatcher) throws WrongNumberOfQueriesError {
return verify(SqlQueries.queriesBetween(minAllowedStatements, maxAllowedStatements).threads(threadMatcher));
} | [
"@",
"Deprecated",
"public",
"C",
"verifyBetween",
"(",
"int",
"minAllowedStatements",
",",
"int",
"maxAllowedStatements",
",",
"Threads",
"threadMatcher",
")",
"throws",
"WrongNumberOfQueriesError",
"{",
"return",
"verify",
"(",
"SqlQueries",
".",
"queriesBetween",
"... | Verifies that at least {@code minAllowedStatements} and at most
{@code maxAllowedStatements} were called between the creation of the current instance
and a call to {@link #verify()} method
@throws WrongNumberOfQueriesError if wrong number of queries was executed
@since 2.0 | [
"Verifies",
"that",
"at",
"least",
"{"
] | train | https://github.com/sniffy/sniffy/blob/7bdddb9593e6b6e9fe5c7c87519f864acbc3a5c0/sniffy-core/src/main/java/io/sniffy/LegacySpy.java#L651-L654 |
igniterealtime/REST-API-Client | src/main/java/org/igniterealtime/restclient/RestApiClient.java | RestApiClient.addRosterEntry | public Response addRosterEntry(String username, RosterItemEntity rosterItemEntity) {
return restClient.post("users/" + username + "/roster", rosterItemEntity, new HashMap<String, String>());
} | java | public Response addRosterEntry(String username, RosterItemEntity rosterItemEntity) {
return restClient.post("users/" + username + "/roster", rosterItemEntity, new HashMap<String, String>());
} | [
"public",
"Response",
"addRosterEntry",
"(",
"String",
"username",
",",
"RosterItemEntity",
"rosterItemEntity",
")",
"{",
"return",
"restClient",
".",
"post",
"(",
"\"users/\"",
"+",
"username",
"+",
"\"/roster\"",
",",
"rosterItemEntity",
",",
"new",
"HashMap",
"... | Adds the roster entry.
@param username
the username
@param rosterItemEntity
the roster item entity
@return the response | [
"Adds",
"the",
"roster",
"entry",
"."
] | train | https://github.com/igniterealtime/REST-API-Client/blob/fd544dd770ec2ababa47fef51579522ddce09f05/src/main/java/org/igniterealtime/restclient/RestApiClient.java#L691-L693 |
Azure/azure-sdk-for-java | sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ServerKeysInner.java | ServerKeysInner.listByServerAsync | public Observable<Page<ServerKeyInner>> listByServerAsync(final String resourceGroupName, final String serverName) {
return listByServerWithServiceResponseAsync(resourceGroupName, serverName)
.map(new Func1<ServiceResponse<Page<ServerKeyInner>>, Page<ServerKeyInner>>() {
@Override
public Page<ServerKeyInner> call(ServiceResponse<Page<ServerKeyInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<ServerKeyInner>> listByServerAsync(final String resourceGroupName, final String serverName) {
return listByServerWithServiceResponseAsync(resourceGroupName, serverName)
.map(new Func1<ServiceResponse<Page<ServerKeyInner>>, Page<ServerKeyInner>>() {
@Override
public Page<ServerKeyInner> call(ServiceResponse<Page<ServerKeyInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"ServerKeyInner",
">",
">",
"listByServerAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"serverName",
")",
"{",
"return",
"listByServerWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"se... | Gets a list of server keys.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<ServerKeyInner> object | [
"Gets",
"a",
"list",
"of",
"server",
"keys",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ServerKeysInner.java#L143-L151 |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/jobgraph/JobVertex.java | JobVertex.setStrictlyCoLocatedWith | public void setStrictlyCoLocatedWith(JobVertex strictlyCoLocatedWith) {
if (this.slotSharingGroup == null || this.slotSharingGroup != strictlyCoLocatedWith.slotSharingGroup) {
throw new IllegalArgumentException("Strict co-location requires that both vertices are in the same slot sharing group.");
}
CoLocationGroup thisGroup = this.coLocationGroup;
CoLocationGroup otherGroup = strictlyCoLocatedWith.coLocationGroup;
if (otherGroup == null) {
if (thisGroup == null) {
CoLocationGroup group = new CoLocationGroup(this, strictlyCoLocatedWith);
this.coLocationGroup = group;
strictlyCoLocatedWith.coLocationGroup = group;
}
else {
thisGroup.addVertex(strictlyCoLocatedWith);
strictlyCoLocatedWith.coLocationGroup = thisGroup;
}
}
else {
if (thisGroup == null) {
otherGroup.addVertex(this);
this.coLocationGroup = otherGroup;
}
else {
// both had yet distinct groups, we need to merge them
thisGroup.mergeInto(otherGroup);
}
}
} | java | public void setStrictlyCoLocatedWith(JobVertex strictlyCoLocatedWith) {
if (this.slotSharingGroup == null || this.slotSharingGroup != strictlyCoLocatedWith.slotSharingGroup) {
throw new IllegalArgumentException("Strict co-location requires that both vertices are in the same slot sharing group.");
}
CoLocationGroup thisGroup = this.coLocationGroup;
CoLocationGroup otherGroup = strictlyCoLocatedWith.coLocationGroup;
if (otherGroup == null) {
if (thisGroup == null) {
CoLocationGroup group = new CoLocationGroup(this, strictlyCoLocatedWith);
this.coLocationGroup = group;
strictlyCoLocatedWith.coLocationGroup = group;
}
else {
thisGroup.addVertex(strictlyCoLocatedWith);
strictlyCoLocatedWith.coLocationGroup = thisGroup;
}
}
else {
if (thisGroup == null) {
otherGroup.addVertex(this);
this.coLocationGroup = otherGroup;
}
else {
// both had yet distinct groups, we need to merge them
thisGroup.mergeInto(otherGroup);
}
}
} | [
"public",
"void",
"setStrictlyCoLocatedWith",
"(",
"JobVertex",
"strictlyCoLocatedWith",
")",
"{",
"if",
"(",
"this",
".",
"slotSharingGroup",
"==",
"null",
"||",
"this",
".",
"slotSharingGroup",
"!=",
"strictlyCoLocatedWith",
".",
"slotSharingGroup",
")",
"{",
"thr... | Tells this vertex to strictly co locate its subtasks with the subtasks of the given vertex.
Strict co-location implies that the n'th subtask of this vertex will run on the same parallel computing
instance (TaskManager) as the n'th subtask of the given vertex.
NOTE: Co-location is only possible between vertices in a slot sharing group.
NOTE: This vertex must (transitively) depend on the vertex to be co-located with. That means that the
respective vertex must be a (transitive) input of this vertex.
@param strictlyCoLocatedWith The vertex whose subtasks to co-locate this vertex's subtasks with.
@throws IllegalArgumentException Thrown, if this vertex and the vertex to co-locate with are not in a common
slot sharing group.
@see #setSlotSharingGroup(SlotSharingGroup) | [
"Tells",
"this",
"vertex",
"to",
"strictly",
"co",
"locate",
"its",
"subtasks",
"with",
"the",
"subtasks",
"of",
"the",
"given",
"vertex",
".",
"Strict",
"co",
"-",
"location",
"implies",
"that",
"the",
"n",
"th",
"subtask",
"of",
"this",
"vertex",
"will",... | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/jobgraph/JobVertex.java#L405-L434 |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.fat.common/src/com/ibm/ws/security/fat/common/utils/FatStringUtils.java | FatStringUtils.extractRegexGroup | public static String extractRegexGroup(String fromContent, String regex, int groupNumber) throws Exception {
if (regex == null) {
throw new Exception("Cannot extract regex group because the provided regular expression is null.");
}
Pattern expectedPattern = Pattern.compile(regex);
return extractRegexGroup(fromContent, expectedPattern, groupNumber);
} | java | public static String extractRegexGroup(String fromContent, String regex, int groupNumber) throws Exception {
if (regex == null) {
throw new Exception("Cannot extract regex group because the provided regular expression is null.");
}
Pattern expectedPattern = Pattern.compile(regex);
return extractRegexGroup(fromContent, expectedPattern, groupNumber);
} | [
"public",
"static",
"String",
"extractRegexGroup",
"(",
"String",
"fromContent",
",",
"String",
"regex",
",",
"int",
"groupNumber",
")",
"throws",
"Exception",
"{",
"if",
"(",
"regex",
"==",
"null",
")",
"{",
"throw",
"new",
"Exception",
"(",
"\"Cannot extract... | Extracts the specified matching group in the provided content. An exception is thrown if the group number is invalid
(negative or greater than the number of groups found in the content), or if a matching group cannot be found in the
content. | [
"Extracts",
"the",
"specified",
"matching",
"group",
"in",
"the",
"provided",
"content",
".",
"An",
"exception",
"is",
"thrown",
"if",
"the",
"group",
"number",
"is",
"invalid",
"(",
"negative",
"or",
"greater",
"than",
"the",
"number",
"of",
"groups",
"foun... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.fat.common/src/com/ibm/ws/security/fat/common/utils/FatStringUtils.java#L39-L45 |
UrielCh/ovh-java-sdk | ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java | ApiOvhDomain.zone_zoneName_serviceInfos_PUT | public void zone_zoneName_serviceInfos_PUT(String zoneName, OvhService body) throws IOException {
String qPath = "/domain/zone/{zoneName}/serviceInfos";
StringBuilder sb = path(qPath, zoneName);
exec(qPath, "PUT", sb.toString(), body);
} | java | public void zone_zoneName_serviceInfos_PUT(String zoneName, OvhService body) throws IOException {
String qPath = "/domain/zone/{zoneName}/serviceInfos";
StringBuilder sb = path(qPath, zoneName);
exec(qPath, "PUT", sb.toString(), body);
} | [
"public",
"void",
"zone_zoneName_serviceInfos_PUT",
"(",
"String",
"zoneName",
",",
"OvhService",
"body",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/domain/zone/{zoneName}/serviceInfos\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",... | Alter this object properties
REST: PUT /domain/zone/{zoneName}/serviceInfos
@param body [required] New object properties
@param zoneName [required] The internal name of your zone | [
"Alter",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java#L706-L710 |
chhh/MSFTBX | MSFileToolbox/src/main/java/umich/ms/datatypes/LCMSRange.java | LCMSRange.create | public static final LCMSRange create(Range<Integer> scanRange, Integer msLevel) {
return new LCMSRange(scanRange, msLevel, null);
} | java | public static final LCMSRange create(Range<Integer> scanRange, Integer msLevel) {
return new LCMSRange(scanRange, msLevel, null);
} | [
"public",
"static",
"final",
"LCMSRange",
"create",
"(",
"Range",
"<",
"Integer",
">",
"scanRange",
",",
"Integer",
"msLevel",
")",
"{",
"return",
"new",
"LCMSRange",
"(",
"scanRange",
",",
"msLevel",
",",
"null",
")",
";",
"}"
] | A range that will contain all scans with the scan number range, but only at a specific
MS-Level.
@param scanRange null means the whole range of scan numbers in the run
@param msLevel null means any ms-level | [
"A",
"range",
"that",
"will",
"contain",
"all",
"scans",
"with",
"the",
"scan",
"number",
"range",
"but",
"only",
"at",
"a",
"specific",
"MS",
"-",
"Level",
"."
] | train | https://github.com/chhh/MSFTBX/blob/e53ae6be982e2de3123292be7d5297715bec70bb/MSFileToolbox/src/main/java/umich/ms/datatypes/LCMSRange.java#L98-L100 |
Netflix/conductor | core/src/main/java/com/netflix/conductor/service/utils/ServiceUtils.java | ServiceUtils.checkNotNullOrEmpty | public static void checkNotNullOrEmpty(Collection<?> collection, String errorMessage){
if(collection == null || collection.isEmpty()) {
throw new ApplicationException(ApplicationException.Code.INVALID_INPUT, errorMessage);
}
} | java | public static void checkNotNullOrEmpty(Collection<?> collection, String errorMessage){
if(collection == null || collection.isEmpty()) {
throw new ApplicationException(ApplicationException.Code.INVALID_INPUT, errorMessage);
}
} | [
"public",
"static",
"void",
"checkNotNullOrEmpty",
"(",
"Collection",
"<",
"?",
">",
"collection",
",",
"String",
"errorMessage",
")",
"{",
"if",
"(",
"collection",
"==",
"null",
"||",
"collection",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"Appl... | /*
This method checks if the collection is null or is empty.
@param collection input of type {@link Collection}
@param errorMessage The exception message use if the collection is empty or null
@throws com.netflix.conductor.core.execution.ApplicationException if input Collection is not valid | [
"/",
"*",
"This",
"method",
"checks",
"if",
"the",
"collection",
"is",
"null",
"or",
"is",
"empty",
"."
] | train | https://github.com/Netflix/conductor/blob/78fae0ed9ddea22891f9eebb96a2ec0b2783dca0/core/src/main/java/com/netflix/conductor/service/utils/ServiceUtils.java#L62-L66 |
wdullaer/SwipeActionAdapter | library/src/main/java/com/wdullaer/swipeactionadapter/SwipeActionAdapter.java | SwipeActionAdapter.onSwipeStarted | @Override
public void onSwipeStarted(ListView listView, int position, SwipeDirection direction) {
if(mSwipeActionListener != null) mSwipeActionListener.onSwipeStarted(listView, position, direction);
} | java | @Override
public void onSwipeStarted(ListView listView, int position, SwipeDirection direction) {
if(mSwipeActionListener != null) mSwipeActionListener.onSwipeStarted(listView, position, direction);
} | [
"@",
"Override",
"public",
"void",
"onSwipeStarted",
"(",
"ListView",
"listView",
",",
"int",
"position",
",",
"SwipeDirection",
"direction",
")",
"{",
"if",
"(",
"mSwipeActionListener",
"!=",
"null",
")",
"mSwipeActionListener",
".",
"onSwipeStarted",
"(",
"listV... | Called once the user touches the screen and starts swiping in any direction
@param listView The originating {@link ListView}.
@param position The position to perform the action on, sorted in descending order
for convenience.
@param direction The type of swipe that triggered the action | [
"Called",
"once",
"the",
"user",
"touches",
"the",
"screen",
"and",
"starts",
"swiping",
"in",
"any",
"direction"
] | train | https://github.com/wdullaer/SwipeActionAdapter/blob/24a7e2ed953ac11ea0d8875d375bba571ffeba55/library/src/main/java/com/wdullaer/swipeactionadapter/SwipeActionAdapter.java#L118-L121 |
graphql-java/graphql-java | src/main/java/graphql/introspection/Introspection.java | Introspection.getFieldDef | public static GraphQLFieldDefinition getFieldDef(GraphQLSchema schema, GraphQLCompositeType parentType, String fieldName) {
if (schema.getQueryType() == parentType) {
if (fieldName.equals(SchemaMetaFieldDef.getName())) {
return SchemaMetaFieldDef;
}
if (fieldName.equals(TypeMetaFieldDef.getName())) {
return TypeMetaFieldDef;
}
}
if (fieldName.equals(TypeNameMetaFieldDef.getName())) {
return TypeNameMetaFieldDef;
}
assertTrue(parentType instanceof GraphQLFieldsContainer, "should not happen : parent type must be an object or interface %s", parentType);
GraphQLFieldsContainer fieldsContainer = (GraphQLFieldsContainer) parentType;
GraphQLFieldDefinition fieldDefinition = schema.getCodeRegistry().getFieldVisibility().getFieldDefinition(fieldsContainer, fieldName);
Assert.assertTrue(fieldDefinition != null, "Unknown field '%s'", fieldName);
return fieldDefinition;
} | java | public static GraphQLFieldDefinition getFieldDef(GraphQLSchema schema, GraphQLCompositeType parentType, String fieldName) {
if (schema.getQueryType() == parentType) {
if (fieldName.equals(SchemaMetaFieldDef.getName())) {
return SchemaMetaFieldDef;
}
if (fieldName.equals(TypeMetaFieldDef.getName())) {
return TypeMetaFieldDef;
}
}
if (fieldName.equals(TypeNameMetaFieldDef.getName())) {
return TypeNameMetaFieldDef;
}
assertTrue(parentType instanceof GraphQLFieldsContainer, "should not happen : parent type must be an object or interface %s", parentType);
GraphQLFieldsContainer fieldsContainer = (GraphQLFieldsContainer) parentType;
GraphQLFieldDefinition fieldDefinition = schema.getCodeRegistry().getFieldVisibility().getFieldDefinition(fieldsContainer, fieldName);
Assert.assertTrue(fieldDefinition != null, "Unknown field '%s'", fieldName);
return fieldDefinition;
} | [
"public",
"static",
"GraphQLFieldDefinition",
"getFieldDef",
"(",
"GraphQLSchema",
"schema",
",",
"GraphQLCompositeType",
"parentType",
",",
"String",
"fieldName",
")",
"{",
"if",
"(",
"schema",
".",
"getQueryType",
"(",
")",
"==",
"parentType",
")",
"{",
"if",
... | This will look up a field definition by name, and understand that fields like __typename and __schema are special
and take precedence in field resolution
@param schema the schema to use
@param parentType the type of the parent object
@param fieldName the field to look up
@return a field definition otherwise throws an assertion exception if its null | [
"This",
"will",
"look",
"up",
"a",
"field",
"definition",
"by",
"name",
"and",
"understand",
"that",
"fields",
"like",
"__typename",
"and",
"__schema",
"are",
"special",
"and",
"take",
"precedence",
"in",
"field",
"resolution"
] | train | https://github.com/graphql-java/graphql-java/blob/9214b6044317849388bd88a14b54fc1c18c9f29f/src/main/java/graphql/introspection/Introspection.java#L534-L553 |
camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/behavior/ExternalTaskActivityBehavior.java | ExternalTaskActivityBehavior.propagateBpmnError | @Override
public void propagateBpmnError(BpmnError error, ActivityExecution execution) throws Exception {
super.propagateBpmnError(error, execution);
} | java | @Override
public void propagateBpmnError(BpmnError error, ActivityExecution execution) throws Exception {
super.propagateBpmnError(error, execution);
} | [
"@",
"Override",
"public",
"void",
"propagateBpmnError",
"(",
"BpmnError",
"error",
",",
"ActivityExecution",
"execution",
")",
"throws",
"Exception",
"{",
"super",
".",
"propagateBpmnError",
"(",
"error",
",",
"execution",
")",
";",
"}"
] | Overrides the propagateBpmnError method to made it public.
Is used to propagate the bpmn error from an external task.
@param error the error which should be propagated
@param execution the current activity execution
@throws Exception throwsn an exception if no handler was found | [
"Overrides",
"the",
"propagateBpmnError",
"method",
"to",
"made",
"it",
"public",
".",
"Is",
"used",
"to",
"propagate",
"the",
"bpmn",
"error",
"from",
"an",
"external",
"task",
"."
] | train | https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/behavior/ExternalTaskActivityBehavior.java#L76-L79 |
goldmansachs/gs-collections | collections/src/main/java/com/gs/collections/impl/utility/MapIterate.java | MapIterate.selectMapOnEntry | public static <K, V, R extends Map<K, V>> R selectMapOnEntry(
Map<K, V> map,
final Predicate2<? super K, ? super V> predicate,
R target)
{
final Procedure2<K, V> mapTransferProcedure = new MapPutProcedure<K, V>(target);
Procedure2<K, V> procedure = new Procedure2<K, V>()
{
public void value(K key, V value)
{
if (predicate.accept(key, value))
{
mapTransferProcedure.value(key, value);
}
}
};
MapIterate.forEachKeyValue(map, procedure);
return target;
} | java | public static <K, V, R extends Map<K, V>> R selectMapOnEntry(
Map<K, V> map,
final Predicate2<? super K, ? super V> predicate,
R target)
{
final Procedure2<K, V> mapTransferProcedure = new MapPutProcedure<K, V>(target);
Procedure2<K, V> procedure = new Procedure2<K, V>()
{
public void value(K key, V value)
{
if (predicate.accept(key, value))
{
mapTransferProcedure.value(key, value);
}
}
};
MapIterate.forEachKeyValue(map, procedure);
return target;
} | [
"public",
"static",
"<",
"K",
",",
"V",
",",
"R",
"extends",
"Map",
"<",
"K",
",",
"V",
">",
">",
"R",
"selectMapOnEntry",
"(",
"Map",
"<",
"K",
",",
"V",
">",
"map",
",",
"final",
"Predicate2",
"<",
"?",
"super",
"K",
",",
"?",
"super",
"V",
... | For each <em>entry</em> of the source map, the Predicate2 is evaluated.
If the result of the evaluation is true, the map entry is moved to a result map.
The result map is returned containing all entries in the source map that evaluated to true. | [
"For",
"each",
"<em",
">",
"entry<",
"/",
"em",
">",
"of",
"the",
"source",
"map",
"the",
"Predicate2",
"is",
"evaluated",
".",
"If",
"the",
"result",
"of",
"the",
"evaluation",
"is",
"true",
"the",
"map",
"entry",
"is",
"moved",
"to",
"a",
"result",
... | train | https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/MapIterate.java#L296-L315 |
VoltDB/voltdb | src/frontend/org/voltdb/compiler/VoltCompiler.java | VoltCompiler.compileFromDDL | public boolean compileFromDDL(final String jarOutputPath, final String... ddlFilePaths) {
if (ddlFilePaths.length == 0) {
compilerLog.error("At least one DDL file is required.");
return false;
}
List<VoltCompilerReader> ddlReaderList;
try {
ddlReaderList = DDLPathsToReaderList(ddlFilePaths);
}
catch (VoltCompilerException e) {
compilerLog.error("Unable to open DDL file.", e);
return false;
}
return compileInternalToFile(jarOutputPath, null, null, ddlReaderList, null);
} | java | public boolean compileFromDDL(final String jarOutputPath, final String... ddlFilePaths) {
if (ddlFilePaths.length == 0) {
compilerLog.error("At least one DDL file is required.");
return false;
}
List<VoltCompilerReader> ddlReaderList;
try {
ddlReaderList = DDLPathsToReaderList(ddlFilePaths);
}
catch (VoltCompilerException e) {
compilerLog.error("Unable to open DDL file.", e);
return false;
}
return compileInternalToFile(jarOutputPath, null, null, ddlReaderList, null);
} | [
"public",
"boolean",
"compileFromDDL",
"(",
"final",
"String",
"jarOutputPath",
",",
"final",
"String",
"...",
"ddlFilePaths",
")",
"{",
"if",
"(",
"ddlFilePaths",
".",
"length",
"==",
"0",
")",
"{",
"compilerLog",
".",
"error",
"(",
"\"At least one DDL file is ... | Compile from a set of DDL files.
@param jarOutputPath The location to put the finished JAR to.
@param ddlFilePaths The array of DDL files to compile (at least one is required).
@return true if successful
@throws VoltCompilerException | [
"Compile",
"from",
"a",
"set",
"of",
"DDL",
"files",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/compiler/VoltCompiler.java#L514-L528 |
b3dgs/lionengine | lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/collision/CollisionFunctionConfig.java | CollisionFunctionConfig.imports | public static CollisionFunction imports(Xml parent)
{
Check.notNull(parent);
final Xml node = parent.getChild(FUNCTION);
final String name = node.readString(TYPE);
try
{
final CollisionFunctionType type = CollisionFunctionType.valueOf(name);
switch (type)
{
case LINEAR:
return new CollisionFunctionLinear(node.readDouble(A), node.readDouble(B));
default:
throw new LionEngineException(ERROR_TYPE + name);
}
}
catch (final IllegalArgumentException | NullPointerException exception)
{
throw new LionEngineException(exception, ERROR_TYPE + name);
}
} | java | public static CollisionFunction imports(Xml parent)
{
Check.notNull(parent);
final Xml node = parent.getChild(FUNCTION);
final String name = node.readString(TYPE);
try
{
final CollisionFunctionType type = CollisionFunctionType.valueOf(name);
switch (type)
{
case LINEAR:
return new CollisionFunctionLinear(node.readDouble(A), node.readDouble(B));
default:
throw new LionEngineException(ERROR_TYPE + name);
}
}
catch (final IllegalArgumentException | NullPointerException exception)
{
throw new LionEngineException(exception, ERROR_TYPE + name);
}
} | [
"public",
"static",
"CollisionFunction",
"imports",
"(",
"Xml",
"parent",
")",
"{",
"Check",
".",
"notNull",
"(",
"parent",
")",
";",
"final",
"Xml",
"node",
"=",
"parent",
".",
"getChild",
"(",
"FUNCTION",
")",
";",
"final",
"String",
"name",
"=",
"node... | Create the collision function from node.
@param parent The parent reference (must not be <code>null</code>).
@return The collision function data.
@throws LionEngineException If error when reading node. | [
"Create",
"the",
"collision",
"function",
"from",
"node",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/collision/CollisionFunctionConfig.java#L53-L74 |
Stratio/stratio-cassandra | src/java/org/apache/cassandra/utils/btree/BTree.java | BTree.find | static <V> int find(Comparator<V> comparator, Object key, Object[] a, final int fromIndex, final int toIndex)
{
int low = fromIndex;
int high = toIndex - 1;
while (low <= high)
{
int mid = (low + high) / 2;
int cmp = comparator.compare((V) key, (V) a[mid]);
if (cmp > 0)
low = mid + 1;
else if (cmp < 0)
high = mid - 1;
else
return mid; // key found
}
return -(low + 1); // key not found.
} | java | static <V> int find(Comparator<V> comparator, Object key, Object[] a, final int fromIndex, final int toIndex)
{
int low = fromIndex;
int high = toIndex - 1;
while (low <= high)
{
int mid = (low + high) / 2;
int cmp = comparator.compare((V) key, (V) a[mid]);
if (cmp > 0)
low = mid + 1;
else if (cmp < 0)
high = mid - 1;
else
return mid; // key found
}
return -(low + 1); // key not found.
} | [
"static",
"<",
"V",
">",
"int",
"find",
"(",
"Comparator",
"<",
"V",
">",
"comparator",
",",
"Object",
"key",
",",
"Object",
"[",
"]",
"a",
",",
"final",
"int",
"fromIndex",
",",
"final",
"int",
"toIndex",
")",
"{",
"int",
"low",
"=",
"fromIndex",
... | wrapping generic Comparator with support for Special +/- infinity sentinels | [
"wrapping",
"generic",
"Comparator",
"with",
"support",
"for",
"Special",
"+",
"/",
"-",
"infinity",
"sentinels"
] | train | https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/utils/btree/BTree.java#L269-L287 |
googleads/googleads-java-lib | examples/admanager_axis/src/main/java/admanager/axis/v201902/inventoryservice/GetAdUnitHierarchy.java | GetAdUnitHierarchy.displayInventoryTree | private static void displayInventoryTree(AdUnit root, Map<String, List<AdUnit>> treeMap) {
displayInventoryTreeHelper(root, treeMap, 0);
} | java | private static void displayInventoryTree(AdUnit root, Map<String, List<AdUnit>> treeMap) {
displayInventoryTreeHelper(root, treeMap, 0);
} | [
"private",
"static",
"void",
"displayInventoryTree",
"(",
"AdUnit",
"root",
",",
"Map",
"<",
"String",
",",
"List",
"<",
"AdUnit",
">",
">",
"treeMap",
")",
"{",
"displayInventoryTreeHelper",
"(",
"root",
",",
"treeMap",
",",
"0",
")",
";",
"}"
] | Displays the ad unit tree beginning at the root ad unit.
@param root the root ad unit
@param treeMap the map of id to {@code List} of ad units | [
"Displays",
"the",
"ad",
"unit",
"tree",
"beginning",
"at",
"the",
"root",
"ad",
"unit",
"."
] | train | https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/examples/admanager_axis/src/main/java/admanager/axis/v201902/inventoryservice/GetAdUnitHierarchy.java#L154-L156 |
ben-manes/caffeine | caffeine/src/main/java/com/github/benmanes/caffeine/cache/BoundedLocalCache.java | BoundedLocalCache.removeWithWriter | @Nullable V removeWithWriter(Object key) {
@SuppressWarnings("unchecked")
K castKey = (K) key;
@SuppressWarnings({"unchecked", "rawtypes"})
Node<K, V>[] node = new Node[1];
@SuppressWarnings("unchecked")
V[] oldValue = (V[]) new Object[1];
RemovalCause[] cause = new RemovalCause[1];
data.computeIfPresent(nodeFactory.newLookupKey(key), (k, n) -> {
synchronized (n) {
oldValue[0] = n.getValue();
if (oldValue[0] == null) {
cause[0] = RemovalCause.COLLECTED;
} else if (hasExpired(n, expirationTicker().read())) {
cause[0] = RemovalCause.EXPIRED;
} else {
cause[0] = RemovalCause.EXPLICIT;
}
writer.delete(castKey, oldValue[0], cause[0]);
n.retire();
}
node[0] = n;
return null;
});
if (cause[0] != null) {
afterWrite(new RemovalTask(node[0]));
if (hasRemovalListener()) {
notifyRemoval(castKey, oldValue[0], cause[0]);
}
}
return (cause[0] == RemovalCause.EXPLICIT) ? oldValue[0] : null;
} | java | @Nullable V removeWithWriter(Object key) {
@SuppressWarnings("unchecked")
K castKey = (K) key;
@SuppressWarnings({"unchecked", "rawtypes"})
Node<K, V>[] node = new Node[1];
@SuppressWarnings("unchecked")
V[] oldValue = (V[]) new Object[1];
RemovalCause[] cause = new RemovalCause[1];
data.computeIfPresent(nodeFactory.newLookupKey(key), (k, n) -> {
synchronized (n) {
oldValue[0] = n.getValue();
if (oldValue[0] == null) {
cause[0] = RemovalCause.COLLECTED;
} else if (hasExpired(n, expirationTicker().read())) {
cause[0] = RemovalCause.EXPIRED;
} else {
cause[0] = RemovalCause.EXPLICIT;
}
writer.delete(castKey, oldValue[0], cause[0]);
n.retire();
}
node[0] = n;
return null;
});
if (cause[0] != null) {
afterWrite(new RemovalTask(node[0]));
if (hasRemovalListener()) {
notifyRemoval(castKey, oldValue[0], cause[0]);
}
}
return (cause[0] == RemovalCause.EXPLICIT) ? oldValue[0] : null;
} | [
"@",
"Nullable",
"V",
"removeWithWriter",
"(",
"Object",
"key",
")",
"{",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"K",
"castKey",
"=",
"(",
"K",
")",
"key",
";",
"@",
"SuppressWarnings",
"(",
"{",
"\"unchecked\"",
",",
"\"rawtypes\"",
"}",
")",... | Removes the mapping for a key after notifying the writer.
@param key key whose mapping is to be removed
@return the removed value or null if no mapping was found | [
"Removes",
"the",
"mapping",
"for",
"a",
"key",
"after",
"notifying",
"the",
"writer",
"."
] | train | https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/caffeine/src/main/java/com/github/benmanes/caffeine/cache/BoundedLocalCache.java#L2086-L2119 |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.fat.common/src/com/ibm/ws/security/fat/common/web/WebFormUtils.java | WebFormUtils.getAndSubmitLoginForm | public Page getAndSubmitLoginForm(HtmlPage loginPage, String username, String password) throws Exception {
if (loginPage == null) {
throw new Exception("Cannot submit login form because the provided HtmlPage object is null.");
}
HtmlForm form = getAndValidateLoginForm(loginPage);
return fillAndSubmitCredentialForm(form, username, password);
} | java | public Page getAndSubmitLoginForm(HtmlPage loginPage, String username, String password) throws Exception {
if (loginPage == null) {
throw new Exception("Cannot submit login form because the provided HtmlPage object is null.");
}
HtmlForm form = getAndValidateLoginForm(loginPage);
return fillAndSubmitCredentialForm(form, username, password);
} | [
"public",
"Page",
"getAndSubmitLoginForm",
"(",
"HtmlPage",
"loginPage",
",",
"String",
"username",
",",
"String",
"password",
")",
"throws",
"Exception",
"{",
"if",
"(",
"loginPage",
"==",
"null",
")",
"{",
"throw",
"new",
"Exception",
"(",
"\"Cannot submit log... | Fills out the first form found in the provided login page with the specified credentials and submits the form. An exception
is thrown if the provided login page does not have any forms, if the first form does not have an action of
"j_security_check", or if the form is missing the appropriate username/password inputs or submit button. | [
"Fills",
"out",
"the",
"first",
"form",
"found",
"in",
"the",
"provided",
"login",
"page",
"with",
"the",
"specified",
"credentials",
"and",
"submits",
"the",
"form",
".",
"An",
"exception",
"is",
"thrown",
"if",
"the",
"provided",
"login",
"page",
"does",
... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.fat.common/src/com/ibm/ws/security/fat/common/web/WebFormUtils.java#L22-L28 |
Azure/azure-sdk-for-java | labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/LabAccountsInner.java | LabAccountsInner.createLabAsync | public Observable<Void> createLabAsync(String resourceGroupName, String labAccountName, CreateLabProperties createLabProperties) {
return createLabWithServiceResponseAsync(resourceGroupName, labAccountName, createLabProperties).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | java | public Observable<Void> createLabAsync(String resourceGroupName, String labAccountName, CreateLabProperties createLabProperties) {
return createLabWithServiceResponseAsync(resourceGroupName, labAccountName, createLabProperties).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"createLabAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"labAccountName",
",",
"CreateLabProperties",
"createLabProperties",
")",
"{",
"return",
"createLabWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"lab... | Create a lab in a lab account.
@param resourceGroupName The name of the resource group.
@param labAccountName The name of the lab Account.
@param createLabProperties Properties for creating a managed lab and a default environment setting
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponse} object if successful. | [
"Create",
"a",
"lab",
"in",
"a",
"lab",
"account",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/LabAccountsInner.java#L1145-L1152 |
realtime-framework/RealtimeMessaging-Android | library/src/main/java/ibt/ortc/api/Ortc.java | Ortc.saveAuthentication | public static void saveAuthentication(String url, boolean isCluster,
final String authenticationToken, final boolean authenticationTokenIsPrivate,
final String applicationKey, final int timeToLive, final String privateKey,
final HashMap<String, LinkedList<ChannelPermissions>> permissions,
final OnRestWebserviceResponse onCompleted) throws IOException,
InvalidBalancerServerException,
OrtcAuthenticationNotAuthorizedException {
String connectionUrl = url;
if (isCluster) {
Balancer.getServerFromBalancerAsync(url, applicationKey, new OnRestWebserviceResponse() {
@Override
public void run(Exception error, String response) {
if(error != null){
onCompleted.run(error, null);
}else{
saveAuthenticationAsync(response, authenticationToken, authenticationTokenIsPrivate, applicationKey, timeToLive, privateKey, permissions, onCompleted);
}
}
});
}else{
saveAuthenticationAsync(connectionUrl, authenticationToken, authenticationTokenIsPrivate, applicationKey, timeToLive, privateKey, permissions, onCompleted);
}
} | java | public static void saveAuthentication(String url, boolean isCluster,
final String authenticationToken, final boolean authenticationTokenIsPrivate,
final String applicationKey, final int timeToLive, final String privateKey,
final HashMap<String, LinkedList<ChannelPermissions>> permissions,
final OnRestWebserviceResponse onCompleted) throws IOException,
InvalidBalancerServerException,
OrtcAuthenticationNotAuthorizedException {
String connectionUrl = url;
if (isCluster) {
Balancer.getServerFromBalancerAsync(url, applicationKey, new OnRestWebserviceResponse() {
@Override
public void run(Exception error, String response) {
if(error != null){
onCompleted.run(error, null);
}else{
saveAuthenticationAsync(response, authenticationToken, authenticationTokenIsPrivate, applicationKey, timeToLive, privateKey, permissions, onCompleted);
}
}
});
}else{
saveAuthenticationAsync(connectionUrl, authenticationToken, authenticationTokenIsPrivate, applicationKey, timeToLive, privateKey, permissions, onCompleted);
}
} | [
"public",
"static",
"void",
"saveAuthentication",
"(",
"String",
"url",
",",
"boolean",
"isCluster",
",",
"final",
"String",
"authenticationToken",
",",
"final",
"boolean",
"authenticationTokenIsPrivate",
",",
"final",
"String",
"applicationKey",
",",
"final",
"int",
... | Saves the authentication token channels permissions in the ORTC server.
<pre>
HashMap<String, LinkedList<ChannelPermissions>> permissions = new HashMap<String, LinkedList<ChannelPermissions>>();
LinkedList<ChannelPermissions> channelPermissions = new LinkedList<ChannelPermissions>();
channelPermissions.add(ChannelPermissions.Write);
channelPermissions.add(ChannelPermissions.Presence);
permissions.put("channel", channelPermissions);
if (!Ortc.saveAuthentication("http://ortc-developers.realtime.co/server/2.1/",
true, "SessionId", false, "APPKEY", 1800, "PVTKEY", permissions)) {
throw new Exception("Was not possible to authenticate");
}
</pre>
@param url
Ortc Server Url
@param isCluster
Indicates whether the ORTC server is in a cluster.
@param authenticationToken
Authentication Token which is generated by the application
server, for instance a unique session ID.
@param authenticationTokenIsPrivate
Indicates whether the authentication token is private (true)
or not (false)
@param applicationKey
Application Key that was provided to you together with the
ORTC service purchasing.
@param timeToLive
The authentication token time to live, in other words, the
allowed activity time (in seconds).
@param privateKey
The private key provided to you together with the ORTC service
purchasing.
@param permissions
HashMap<String,LinkedList<String,ChannelPermissions>
> permissions The channels and their permissions (w:
write/read or r: read or p: presence, case sensitive).
@param onCompleted
The callback that is executed after the save authentication is completed
@throws ibt.ortc.api.OrtcAuthenticationNotAuthorizedException
@throws InvalidBalancerServerException | [
"Saves",
"the",
"authentication",
"token",
"channels",
"permissions",
"in",
"the",
"ORTC",
"server",
"."
] | train | https://github.com/realtime-framework/RealtimeMessaging-Android/blob/f0d87b92ed7c591bcfe2b9cf45b947865570e061/library/src/main/java/ibt/ortc/api/Ortc.java#L496-L518 |
jamesagnew/hapi-fhir | hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/param/DateRangeParam.java | DateRangeParam.setRangeFromDatesInclusive | public void setRangeFromDatesInclusive(Date theLowerBound, Date theUpperBound) {
DateParam lowerBound = theLowerBound != null
? new DateParam(GREATERTHAN_OR_EQUALS, theLowerBound) : null;
DateParam upperBound = theUpperBound != null
? new DateParam(LESSTHAN_OR_EQUALS, theUpperBound) : null;
validateAndSet(lowerBound, upperBound);
} | java | public void setRangeFromDatesInclusive(Date theLowerBound, Date theUpperBound) {
DateParam lowerBound = theLowerBound != null
? new DateParam(GREATERTHAN_OR_EQUALS, theLowerBound) : null;
DateParam upperBound = theUpperBound != null
? new DateParam(LESSTHAN_OR_EQUALS, theUpperBound) : null;
validateAndSet(lowerBound, upperBound);
} | [
"public",
"void",
"setRangeFromDatesInclusive",
"(",
"Date",
"theLowerBound",
",",
"Date",
"theUpperBound",
")",
"{",
"DateParam",
"lowerBound",
"=",
"theLowerBound",
"!=",
"null",
"?",
"new",
"DateParam",
"(",
"GREATERTHAN_OR_EQUALS",
",",
"theLowerBound",
")",
":"... | Sets the range from a pair of dates, inclusive on both ends
@param theLowerBound A qualified date param representing the lower date bound (optionally may include time), e.g.
"2011-02-22" or "2011-02-22T13:12:00Z". Will be treated inclusively. Either theLowerBound or
theUpperBound may both be populated, or one may be null, but it is not valid for both to be null.
@param theUpperBound A qualified date param representing the upper date bound (optionally may include time), e.g.
"2011-02-22" or "2011-02-22T13:12:00Z". Will be treated inclusively. Either theLowerBound or
theUpperBound may both be populated, or one may be null, but it is not valid for both to be null. | [
"Sets",
"the",
"range",
"from",
"a",
"pair",
"of",
"dates",
"inclusive",
"on",
"both",
"ends"
] | train | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/param/DateRangeParam.java#L387-L393 |
xhsun/gw2wrapper | src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java | AsynchronousRequest.getPriceInfo | public void getPriceInfo(int[] ids, Callback<List<Prices>> callback) throws GuildWars2Exception, NullPointerException {
isParamValid(new ParamChecker(ids));
gw2API.getTPPriceInfo(processIds(ids)).enqueue(callback);
} | java | public void getPriceInfo(int[] ids, Callback<List<Prices>> callback) throws GuildWars2Exception, NullPointerException {
isParamValid(new ParamChecker(ids));
gw2API.getTPPriceInfo(processIds(ids)).enqueue(callback);
} | [
"public",
"void",
"getPriceInfo",
"(",
"int",
"[",
"]",
"ids",
",",
"Callback",
"<",
"List",
"<",
"Prices",
">",
">",
"callback",
")",
"throws",
"GuildWars2Exception",
",",
"NullPointerException",
"{",
"isParamValid",
"(",
"new",
"ParamChecker",
"(",
"ids",
... | For more info on Listing Price API go <a href="https://wiki.guildwars2.com/wiki/API:2/commerce/prices">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 item 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 Prices listing item price info | [
"For",
"more",
"info",
"on",
"Listing",
"Price",
"API",
"go",
"<a",
"href",
"=",
"https",
":",
"//",
"wiki",
".",
"guildwars2",
".",
"com",
"/",
"wiki",
"/",
"API",
":",
"2",
"/",
"commerce",
"/",
"prices",
">",
"here<",
"/",
"a",
">",
"<br",
"/"... | train | https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java#L985-L988 |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/io/tsv/TSVWrite.java | TSVWrite.writeTSV | public static void writeTSV(Connection connection, String fileName, String tableReference, String encoding) throws SQLException, IOException {
TSVDriverFunction tSVDriverFunction = new TSVDriverFunction();
tSVDriverFunction.exportTable(connection, tableReference, URIUtilities.fileFromString(fileName), new EmptyProgressVisitor(), encoding);
} | java | public static void writeTSV(Connection connection, String fileName, String tableReference, String encoding) throws SQLException, IOException {
TSVDriverFunction tSVDriverFunction = new TSVDriverFunction();
tSVDriverFunction.exportTable(connection, tableReference, URIUtilities.fileFromString(fileName), new EmptyProgressVisitor(), encoding);
} | [
"public",
"static",
"void",
"writeTSV",
"(",
"Connection",
"connection",
",",
"String",
"fileName",
",",
"String",
"tableReference",
",",
"String",
"encoding",
")",
"throws",
"SQLException",
",",
"IOException",
"{",
"TSVDriverFunction",
"tSVDriverFunction",
"=",
"ne... | Export a table into a Tab-separated values file
@param connection
@param fileName
@param tableReference
@param encoding
@throws SQLException
@throws IOException | [
"Export",
"a",
"table",
"into",
"a",
"Tab",
"-",
"separated",
"values",
"file"
] | train | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/tsv/TSVWrite.java#L71-L74 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java | KeyVaultClientBaseImpl.deleteStorageAccountAsync | public ServiceFuture<DeletedStorageBundle> deleteStorageAccountAsync(String vaultBaseUrl, String storageAccountName, final ServiceCallback<DeletedStorageBundle> serviceCallback) {
return ServiceFuture.fromResponse(deleteStorageAccountWithServiceResponseAsync(vaultBaseUrl, storageAccountName), serviceCallback);
} | java | public ServiceFuture<DeletedStorageBundle> deleteStorageAccountAsync(String vaultBaseUrl, String storageAccountName, final ServiceCallback<DeletedStorageBundle> serviceCallback) {
return ServiceFuture.fromResponse(deleteStorageAccountWithServiceResponseAsync(vaultBaseUrl, storageAccountName), serviceCallback);
} | [
"public",
"ServiceFuture",
"<",
"DeletedStorageBundle",
">",
"deleteStorageAccountAsync",
"(",
"String",
"vaultBaseUrl",
",",
"String",
"storageAccountName",
",",
"final",
"ServiceCallback",
"<",
"DeletedStorageBundle",
">",
"serviceCallback",
")",
"{",
"return",
"Service... | Deletes a storage account. This operation requires the storage/delete permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param storageAccountName The name of the storage account.
@param serviceCallback the async ServiceCallback to handle successful and failed responses.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceFuture} object | [
"Deletes",
"a",
"storage",
"account",
".",
"This",
"operation",
"requires",
"the",
"storage",
"/",
"delete",
"permission",
"."
] | 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#L9710-L9712 |
landawn/AbacusUtil | src/com/landawn/abacus/util/Sheet.java | Sheet.replaceIf | public <X extends Exception> void replaceIf(final Try.TriPredicate<R, C, E, X> predicate, final E newValue) throws X {
checkFrozen();
if (rowLength() > 0 && columnLength() > 0) {
this.init();
final int rowLength = rowLength();
int columnIndex = 0;
R rowKey = null;
C columnKey = null;
E val = null;
for (List<E> column : _columnList) {
columnKey = _columnKeyIndexMap.getByValue(columnIndex);
for (int rowIndex = 0; rowIndex < rowLength; rowIndex++) {
rowKey = _rowKeyIndexMap.getByValue(rowIndex);
val = column.get(rowIndex);
if (predicate.test(rowKey, columnKey, val)) {
column.set(rowIndex, newValue);
}
}
columnIndex++;
}
}
} | java | public <X extends Exception> void replaceIf(final Try.TriPredicate<R, C, E, X> predicate, final E newValue) throws X {
checkFrozen();
if (rowLength() > 0 && columnLength() > 0) {
this.init();
final int rowLength = rowLength();
int columnIndex = 0;
R rowKey = null;
C columnKey = null;
E val = null;
for (List<E> column : _columnList) {
columnKey = _columnKeyIndexMap.getByValue(columnIndex);
for (int rowIndex = 0; rowIndex < rowLength; rowIndex++) {
rowKey = _rowKeyIndexMap.getByValue(rowIndex);
val = column.get(rowIndex);
if (predicate.test(rowKey, columnKey, val)) {
column.set(rowIndex, newValue);
}
}
columnIndex++;
}
}
} | [
"public",
"<",
"X",
"extends",
"Exception",
">",
"void",
"replaceIf",
"(",
"final",
"Try",
".",
"TriPredicate",
"<",
"R",
",",
"C",
",",
"E",
",",
"X",
">",
"predicate",
",",
"final",
"E",
"newValue",
")",
"throws",
"X",
"{",
"checkFrozen",
"(",
")",... | Replace elements by <code>Predicate.test(i, j)</code> based on points
@param predicate
@param newValue | [
"Replace",
"elements",
"by",
"<code",
">",
"Predicate",
".",
"test",
"(",
"i",
"j",
")",
"<",
"/",
"code",
">",
"based",
"on",
"points"
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/Sheet.java#L1074-L1101 |
sksamuel/scrimage | scrimage-filters/src/main/java/thirdparty/jhlabs/image/ArrayColormap.java | ArrayColormap.setColorInterpolated | public void setColorInterpolated(int index, int firstIndex, int lastIndex, int color) {
int firstColor = map[firstIndex];
int lastColor = map[lastIndex];
for (int i = firstIndex; i <= index; i++)
map[i] = ImageMath.mixColors((float)(i-firstIndex)/(index-firstIndex), firstColor, color);
for (int i = index; i < lastIndex; i++)
map[i] = ImageMath.mixColors((float)(i-index)/(lastIndex-index), color, lastColor);
} | java | public void setColorInterpolated(int index, int firstIndex, int lastIndex, int color) {
int firstColor = map[firstIndex];
int lastColor = map[lastIndex];
for (int i = firstIndex; i <= index; i++)
map[i] = ImageMath.mixColors((float)(i-firstIndex)/(index-firstIndex), firstColor, color);
for (int i = index; i < lastIndex; i++)
map[i] = ImageMath.mixColors((float)(i-index)/(lastIndex-index), color, lastColor);
} | [
"public",
"void",
"setColorInterpolated",
"(",
"int",
"index",
",",
"int",
"firstIndex",
",",
"int",
"lastIndex",
",",
"int",
"color",
")",
"{",
"int",
"firstColor",
"=",
"map",
"[",
"firstIndex",
"]",
";",
"int",
"lastColor",
"=",
"map",
"[",
"lastIndex",... | Set the color at "index" to "color". Entries are interpolated linearly from
the existing entries at "firstIndex" and "lastIndex" to the new entry.
firstIndex < index < lastIndex must hold.
@param index the position to set
@param firstIndex the position of the first color from which to interpolate
@param lastIndex the position of the second color from which to interpolate
@param color the color to set | [
"Set",
"the",
"color",
"at",
"index",
"to",
"color",
".",
"Entries",
"are",
"interpolated",
"linearly",
"from",
"the",
"existing",
"entries",
"at",
"firstIndex",
"and",
"lastIndex",
"to",
"the",
"new",
"entry",
".",
"firstIndex",
"<",
"index",
"<",
"lastInde... | train | https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/image/ArrayColormap.java#L107-L114 |
elki-project/elki | elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/statistics/distribution/CauchyDistribution.java | CauchyDistribution.cdf | public static double cdf(double x, double location, double shape) {
return FastMath.atan2(x - location, shape) / Math.PI + .5;
} | java | public static double cdf(double x, double location, double shape) {
return FastMath.atan2(x - location, shape) / Math.PI + .5;
} | [
"public",
"static",
"double",
"cdf",
"(",
"double",
"x",
",",
"double",
"location",
",",
"double",
"shape",
")",
"{",
"return",
"FastMath",
".",
"atan2",
"(",
"x",
"-",
"location",
",",
"shape",
")",
"/",
"Math",
".",
"PI",
"+",
".5",
";",
"}"
] | PDF function, static version.
@param x Value
@param location Location (x0)
@param shape Shape (gamma)
@return PDF value | [
"PDF",
"function",
"static",
"version",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/statistics/distribution/CauchyDistribution.java#L162-L164 |
Esri/geometry-api-java | src/main/java/com/esri/core/geometry/Envelope2D.java | Envelope2D.containsExclusive | public boolean containsExclusive(double x, double y) {
// Note: This will return False, if envelope is empty, thus no need to
// call is_empty().
return x > xmin && x < xmax && y > ymin && y < ymax;
} | java | public boolean containsExclusive(double x, double y) {
// Note: This will return False, if envelope is empty, thus no need to
// call is_empty().
return x > xmin && x < xmax && y > ymin && y < ymax;
} | [
"public",
"boolean",
"containsExclusive",
"(",
"double",
"x",
",",
"double",
"y",
")",
"{",
"// Note: This will return False, if envelope is empty, thus no need to",
"// call is_empty().",
"return",
"x",
">",
"xmin",
"&&",
"x",
"<",
"xmax",
"&&",
"y",
">",
"ymin",
"... | Returns True if the envelope contains the point (boundary exclusive).
@param x
@param y
@return True if this contains the point. | [
"Returns",
"True",
"if",
"the",
"envelope",
"contains",
"the",
"point",
"(",
"boundary",
"exclusive",
")",
"."
] | train | https://github.com/Esri/geometry-api-java/blob/494da8ec953d76e7c6072afbc081abfe48ff07cf/src/main/java/com/esri/core/geometry/Envelope2D.java#L655-L659 |
b3log/latke | latke-core/src/main/java/org/b3log/latke/plugin/AbstractPlugin.java | AbstractPlugin.handleLangs | private void handleLangs(final Map<String, Object> dataModel) {
final Locale locale = Latkes.getLocale();
final String language = locale.getLanguage();
final String country = locale.getCountry();
final String variant = locale.getVariant();
final StringBuilder keyBuilder = new StringBuilder(language);
if (StringUtils.isNotBlank(country)) {
keyBuilder.append("_").append(country);
}
if (StringUtils.isNotBlank(variant)) {
keyBuilder.append("_").append(variant);
}
final String localKey = keyBuilder.toString();
final Properties props = langs.get(localKey);
if (null == props) {
return;
}
final Set<Object> keySet = props.keySet();
for (final Object key : keySet) {
dataModel.put((String) key, props.getProperty((String) key));
}
} | java | private void handleLangs(final Map<String, Object> dataModel) {
final Locale locale = Latkes.getLocale();
final String language = locale.getLanguage();
final String country = locale.getCountry();
final String variant = locale.getVariant();
final StringBuilder keyBuilder = new StringBuilder(language);
if (StringUtils.isNotBlank(country)) {
keyBuilder.append("_").append(country);
}
if (StringUtils.isNotBlank(variant)) {
keyBuilder.append("_").append(variant);
}
final String localKey = keyBuilder.toString();
final Properties props = langs.get(localKey);
if (null == props) {
return;
}
final Set<Object> keySet = props.keySet();
for (final Object key : keySet) {
dataModel.put((String) key, props.getProperty((String) key));
}
} | [
"private",
"void",
"handleLangs",
"(",
"final",
"Map",
"<",
"String",
",",
"Object",
">",
"dataModel",
")",
"{",
"final",
"Locale",
"locale",
"=",
"Latkes",
".",
"getLocale",
"(",
")",
";",
"final",
"String",
"language",
"=",
"locale",
".",
"getLanguage",
... | Processes languages. Retrieves language labels with default locale, then sets them into the specified data model.
@param dataModel the specified data model | [
"Processes",
"languages",
".",
"Retrieves",
"language",
"labels",
"with",
"default",
"locale",
"then",
"sets",
"them",
"into",
"the",
"specified",
"data",
"model",
"."
] | train | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/plugin/AbstractPlugin.java#L301-L328 |
OpenLiberty/open-liberty | dev/com.ibm.ws.event/src/com/ibm/ws/event/internal/TopicBasedCache.java | TopicBasedCache.addHandler | synchronized void addHandler(ServiceReference<?> serviceReference, boolean osgiHandler) {
HandlerHolder holder = new HandlerHolder(eventEngine, serviceReference, osgiHandler);
serviceReferenceMap.put(serviceReference, holder);
for (String topic : holder.getDiscreteTopics()) {
addTopicHandlerToMap(topic, holder, discreteEventHandlers);
}
for (String topic : holder.getWildcardTopics()) {
addTopicHandlerToMap(topic, holder, wildcardEventHandlers);
}
// Clear the cache since it's no longer up to date
clearTopicDataCache();
} | java | synchronized void addHandler(ServiceReference<?> serviceReference, boolean osgiHandler) {
HandlerHolder holder = new HandlerHolder(eventEngine, serviceReference, osgiHandler);
serviceReferenceMap.put(serviceReference, holder);
for (String topic : holder.getDiscreteTopics()) {
addTopicHandlerToMap(topic, holder, discreteEventHandlers);
}
for (String topic : holder.getWildcardTopics()) {
addTopicHandlerToMap(topic, holder, wildcardEventHandlers);
}
// Clear the cache since it's no longer up to date
clearTopicDataCache();
} | [
"synchronized",
"void",
"addHandler",
"(",
"ServiceReference",
"<",
"?",
">",
"serviceReference",
",",
"boolean",
"osgiHandler",
")",
"{",
"HandlerHolder",
"holder",
"=",
"new",
"HandlerHolder",
"(",
"eventEngine",
",",
"serviceReference",
",",
"osgiHandler",
")",
... | Add an <code>EventHandler</code> <code>ServiceReference</code> to our
collection. Adding a handler reference will populate the maps that
associate topics with handlers.
@param serviceReference
the <code>EventHandler</code> reference
@param osgiHandler
the serviceReference refers to an OSGi Event Handler | [
"Add",
"an",
"<code",
">",
"EventHandler<",
"/",
"code",
">",
"<code",
">",
"ServiceReference<",
"/",
"code",
">",
"to",
"our",
"collection",
".",
"Adding",
"a",
"handler",
"reference",
"will",
"populate",
"the",
"maps",
"that",
"associate",
"topics",
"with"... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.event/src/com/ibm/ws/event/internal/TopicBasedCache.java#L148-L162 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.