repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 192 | func_name stringlengths 5 108 | whole_func_string stringlengths 75 3.91k | language stringclasses 1
value | func_code_string stringlengths 75 3.91k | func_code_tokens listlengths 21 629 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 647 | split_name stringclasses 1
value | func_code_url stringlengths 111 306 |
|---|---|---|---|---|---|---|---|---|---|---|
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/tools/sjavac/JavacState.java | JavacState.taintPackagesDependingOnChangedPackages | public void taintPackagesDependingOnChangedPackages(Set<String> pkgsWithChangedPubApi, Set<String> recentlyCompiled) {
// For each to-be-recompiled-candidates...
for (Package pkg : new HashSet<>(prev.packages().values())) {
// Find out what it depends upon...
Set<String> deps = pkg.typeDependencies()
.values()
.stream()
.flatMap(Collection::stream)
.collect(Collectors.toSet());
for (String dep : deps) {
String depPkg = ":" + dep.substring(0, dep.lastIndexOf('.'));
if (depPkg.equals(pkg.name()))
continue;
// Checking if that dependency has changed
if (pkgsWithChangedPubApi.contains(depPkg) && !recentlyCompiled.contains(pkg.name())) {
taintPackage(pkg.name(), "its depending on " + depPkg);
}
}
}
} | java | public void taintPackagesDependingOnChangedPackages(Set<String> pkgsWithChangedPubApi, Set<String> recentlyCompiled) {
// For each to-be-recompiled-candidates...
for (Package pkg : new HashSet<>(prev.packages().values())) {
// Find out what it depends upon...
Set<String> deps = pkg.typeDependencies()
.values()
.stream()
.flatMap(Collection::stream)
.collect(Collectors.toSet());
for (String dep : deps) {
String depPkg = ":" + dep.substring(0, dep.lastIndexOf('.'));
if (depPkg.equals(pkg.name()))
continue;
// Checking if that dependency has changed
if (pkgsWithChangedPubApi.contains(depPkg) && !recentlyCompiled.contains(pkg.name())) {
taintPackage(pkg.name(), "its depending on " + depPkg);
}
}
}
} | [
"public",
"void",
"taintPackagesDependingOnChangedPackages",
"(",
"Set",
"<",
"String",
">",
"pkgsWithChangedPubApi",
",",
"Set",
"<",
"String",
">",
"recentlyCompiled",
")",
"{",
"// For each to-be-recompiled-candidates...",
"for",
"(",
"Package",
"pkg",
":",
"new",
... | Propagate recompilation through the dependency chains.
Avoid re-tainting packages that have already been compiled. | [
"Propagate",
"recompilation",
"through",
"the",
"dependency",
"chains",
".",
"Avoid",
"re",
"-",
"tainting",
"packages",
"that",
"have",
"already",
"been",
"compiled",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/sjavac/JavacState.java#L483-L502 |
looly/hutool | hutool-extra/src/main/java/cn/hutool/extra/emoji/EmojiUtil.java | EmojiUtil.toAlias | public static String toAlias(String str, FitzpatrickAction fitzpatrickAction) {
return EmojiParser.parseToAliases(str, fitzpatrickAction);
} | java | public static String toAlias(String str, FitzpatrickAction fitzpatrickAction) {
return EmojiParser.parseToAliases(str, fitzpatrickAction);
} | [
"public",
"static",
"String",
"toAlias",
"(",
"String",
"str",
",",
"FitzpatrickAction",
"fitzpatrickAction",
")",
"{",
"return",
"EmojiParser",
".",
"parseToAliases",
"(",
"str",
",",
"fitzpatrickAction",
")",
";",
"}"
] | 将字符串中的Unicode Emoji字符转换为别名表现形式(两个":"包围的格式),别名后会增加"|"并追加fitzpatrick类型
<p>
例如:<code>👦🏿</code> 转换为 <code>:boy|type_6:</code>
@param str 包含Emoji Unicode字符的字符串
@return 替换后的字符串 | [
"将字符串中的Unicode",
"Emoji字符转换为别名表现形式(两个",
":",
"包围的格式),别名后会增加",
"|",
"并追加fitzpatrick类型",
"<p",
">",
"例如:<code",
">",
"👦🏿<",
"/",
"code",
">",
"转换为",
"<code",
">",
":",
"boy|type_6",
":",
"<",
"/",
"code",
">"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/emoji/EmojiUtil.java#L104-L106 |
aws/aws-sdk-java | aws-java-sdk-api-gateway/src/main/java/com/amazonaws/services/apigateway/model/PutRestApiRequest.java | PutRestApiRequest.withParameters | public PutRestApiRequest withParameters(java.util.Map<String, String> parameters) {
setParameters(parameters);
return this;
} | java | public PutRestApiRequest withParameters(java.util.Map<String, String> parameters) {
setParameters(parameters);
return this;
} | [
"public",
"PutRestApiRequest",
"withParameters",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"parameters",
")",
"{",
"setParameters",
"(",
"parameters",
")",
";",
"return",
"this",
";",
"}"
] | <p>
Custom header parameters as part of the request. For example, to exclude <a>DocumentationParts</a> from an
imported API, set <code>ignore=documentation</code> as a <code>parameters</code> value, as in the AWS CLI command
of
<code>aws apigateway import-rest-api --parameters ignore=documentation --body 'file:///path/to/imported-api-body.json'</code>
.
</p>
@param parameters
Custom header parameters as part of the request. For example, to exclude <a>DocumentationParts</a> from an
imported API, set <code>ignore=documentation</code> as a <code>parameters</code> value, as in the AWS CLI
command of
<code>aws apigateway import-rest-api --parameters ignore=documentation --body 'file:///path/to/imported-api-body.json'</code>
.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"Custom",
"header",
"parameters",
"as",
"part",
"of",
"the",
"request",
".",
"For",
"example",
"to",
"exclude",
"<a",
">",
"DocumentationParts<",
"/",
"a",
">",
"from",
"an",
"imported",
"API",
"set",
"<code",
">",
"ignore",
"=",
"documentation<... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-api-gateway/src/main/java/com/amazonaws/services/apigateway/model/PutRestApiRequest.java#L308-L311 |
incodehq-legacy/incode-module-document | dom/src/main/java/org/incode/module/document/dom/impl/docs/DocumentTemplateRepository.java | DocumentTemplateRepository.findFirstByTypeAndApplicableToAtPath | @Programmatic
public DocumentTemplate findFirstByTypeAndApplicableToAtPath(final DocumentType documentType, final String atPath) {
final List<DocumentTemplate> templates = findByTypeAndApplicableToAtPath(documentType, atPath);
return templates.isEmpty() ? null : templates.get(0);
} | java | @Programmatic
public DocumentTemplate findFirstByTypeAndApplicableToAtPath(final DocumentType documentType, final String atPath) {
final List<DocumentTemplate> templates = findByTypeAndApplicableToAtPath(documentType, atPath);
return templates.isEmpty() ? null : templates.get(0);
} | [
"@",
"Programmatic",
"public",
"DocumentTemplate",
"findFirstByTypeAndApplicableToAtPath",
"(",
"final",
"DocumentType",
"documentType",
",",
"final",
"String",
"atPath",
")",
"{",
"final",
"List",
"<",
"DocumentTemplate",
">",
"templates",
"=",
"findByTypeAndApplicableTo... | Returns all document templates for the specified {@link DocumentType}, ordered by type, then most specific to
provided application tenancy, and then by date (desc). | [
"Returns",
"all",
"document",
"templates",
"for",
"the",
"specified",
"{"
] | train | https://github.com/incodehq-legacy/incode-module-document/blob/c62f064e96d6e6007f7fd6a4bc06e03b78b1816c/dom/src/main/java/org/incode/module/document/dom/impl/docs/DocumentTemplateRepository.java#L147-L151 |
SvenEwald/xmlbeam | src/main/java/org/xmlbeam/io/UrlIO.java | UrlIO.addRequestProperty | @Scope(DocScope.IO)
public UrlIO addRequestProperty(final String name, final String value) {
requestProperties.put(name, value);
return this;
} | java | @Scope(DocScope.IO)
public UrlIO addRequestProperty(final String name, final String value) {
requestProperties.put(name, value);
return this;
} | [
"@",
"Scope",
"(",
"DocScope",
".",
"IO",
")",
"public",
"UrlIO",
"addRequestProperty",
"(",
"final",
"String",
"name",
",",
"final",
"String",
"value",
")",
"{",
"requestProperties",
".",
"put",
"(",
"name",
",",
"value",
")",
";",
"return",
"this",
";"... | Allows to add a single request property.
@param name
@param value
@return this for convenience. | [
"Allows",
"to",
"add",
"a",
"single",
"request",
"property",
"."
] | train | https://github.com/SvenEwald/xmlbeam/blob/acaac1b8fa28d246f17187f5e3c6696458a0b447/src/main/java/org/xmlbeam/io/UrlIO.java#L111-L115 |
undertow-io/undertow | core/src/main/java/io/undertow/server/handlers/proxy/mod_cluster/MCMPHandler.java | MCMPHandler.checkHostUp | protected void checkHostUp(final String scheme, final String host, final int port, final HttpServerExchange exchange, final NodePingUtil.PingCallback callback) {
final XnioSsl xnioSsl = null; // TODO
final OptionMap options = OptionMap.builder()
.set(Options.TCP_NODELAY, true)
.getMap();
try {
// http, ajp and maybe more in future
if ("ajp".equalsIgnoreCase(scheme) || "http".equalsIgnoreCase(scheme)) {
final URI uri = new URI(scheme, null, host, port, "/", null, null);
NodePingUtil.pingHttpClient(uri, callback, exchange, container.getClient(), xnioSsl, options);
} else {
final InetSocketAddress address = new InetSocketAddress(host, port);
NodePingUtil.pingHost(address, exchange, callback, options);
}
} catch (URISyntaxException e) {
callback.failed();
}
} | java | protected void checkHostUp(final String scheme, final String host, final int port, final HttpServerExchange exchange, final NodePingUtil.PingCallback callback) {
final XnioSsl xnioSsl = null; // TODO
final OptionMap options = OptionMap.builder()
.set(Options.TCP_NODELAY, true)
.getMap();
try {
// http, ajp and maybe more in future
if ("ajp".equalsIgnoreCase(scheme) || "http".equalsIgnoreCase(scheme)) {
final URI uri = new URI(scheme, null, host, port, "/", null, null);
NodePingUtil.pingHttpClient(uri, callback, exchange, container.getClient(), xnioSsl, options);
} else {
final InetSocketAddress address = new InetSocketAddress(host, port);
NodePingUtil.pingHost(address, exchange, callback, options);
}
} catch (URISyntaxException e) {
callback.failed();
}
} | [
"protected",
"void",
"checkHostUp",
"(",
"final",
"String",
"scheme",
",",
"final",
"String",
"host",
",",
"final",
"int",
"port",
",",
"final",
"HttpServerExchange",
"exchange",
",",
"final",
"NodePingUtil",
".",
"PingCallback",
"callback",
")",
"{",
"final",
... | Check whether a host is up.
@param scheme the scheme
@param host the host
@param port the port
@param exchange the http server exchange
@param callback the ping callback | [
"Check",
"whether",
"a",
"host",
"is",
"up",
"."
] | train | https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/server/handlers/proxy/mod_cluster/MCMPHandler.java#L682-L701 |
revapi/revapi | revapi-java-spi/src/main/java/org/revapi/java/spi/Util.java | Util.isSameType | public static boolean isSameType(@Nonnull TypeMirror t1, @Nonnull TypeMirror t2) {
String t1Name = toUniqueString(t1);
String t2Name = toUniqueString(t2);
return t1Name.equals(t2Name);
} | java | public static boolean isSameType(@Nonnull TypeMirror t1, @Nonnull TypeMirror t2) {
String t1Name = toUniqueString(t1);
String t2Name = toUniqueString(t2);
return t1Name.equals(t2Name);
} | [
"public",
"static",
"boolean",
"isSameType",
"(",
"@",
"Nonnull",
"TypeMirror",
"t1",
",",
"@",
"Nonnull",
"TypeMirror",
"t2",
")",
"{",
"String",
"t1Name",
"=",
"toUniqueString",
"(",
"t1",
")",
";",
"String",
"t2Name",
"=",
"toUniqueString",
"(",
"t2",
"... | To be used to compare types from different compilations (which are not comparable by standard means in Types).
This just compares the type names.
@param t1 first type
@param t2 second type
@return true if the types have the same fqn, false otherwise | [
"To",
"be",
"used",
"to",
"compare",
"types",
"from",
"different",
"compilations",
"(",
"which",
"are",
"not",
"comparable",
"by",
"standard",
"means",
"in",
"Types",
")",
".",
"This",
"just",
"compares",
"the",
"type",
"names",
"."
] | train | https://github.com/revapi/revapi/blob/e070b136d977441ab96fdce067a13e7e0423295b/revapi-java-spi/src/main/java/org/revapi/java/spi/Util.java#L718-L723 |
yanzhenjie/AndServer | api/src/main/java/com/yanzhenjie/andserver/util/Assert.java | Assert.noNullElements | public static void noNullElements(Object[] array, String message) {
if (array != null) {
for (Object element : array) {
if (element == null) {
throw new IllegalArgumentException(message);
}
}
}
} | java | public static void noNullElements(Object[] array, String message) {
if (array != null) {
for (Object element : array) {
if (element == null) {
throw new IllegalArgumentException(message);
}
}
}
} | [
"public",
"static",
"void",
"noNullElements",
"(",
"Object",
"[",
"]",
"array",
",",
"String",
"message",
")",
"{",
"if",
"(",
"array",
"!=",
"null",
")",
"{",
"for",
"(",
"Object",
"element",
":",
"array",
")",
"{",
"if",
"(",
"element",
"==",
"null... | Assert that an array contains no {@code null} elements. <p>Note: Does not complain if the array is empty! <pre
class="code">Assert.noNullElements(array, "The array must contain non-null elements");</pre>
@param array the array to check.
@param message the exception message to use if the assertion fails.
@throws IllegalArgumentException if the object array contains a {@code null} element. | [
"Assert",
"that",
"an",
"array",
"contains",
"no",
"{",
"@code",
"null",
"}",
"elements",
".",
"<p",
">",
"Note",
":",
"Does",
"not",
"complain",
"if",
"the",
"array",
"is",
"empty!",
"<pre",
"class",
"=",
"code",
">",
"Assert",
".",
"noNullElements",
... | train | https://github.com/yanzhenjie/AndServer/blob/f95f316cdfa5755d6a3fec3c6a1b5df783b81517/api/src/main/java/com/yanzhenjie/andserver/util/Assert.java#L146-L154 |
maven-nar/nar-maven-plugin | src/main/java/com/github/maven_nar/cpptasks/openwatcom/OpenWatcomCompiler.java | OpenWatcomCompiler.addWarningSwitch | @Override
protected final void addWarningSwitch(final Vector<String> args, final int level) {
OpenWatcomProcessor.addWarningSwitch(args, level);
} | java | @Override
protected final void addWarningSwitch(final Vector<String> args, final int level) {
OpenWatcomProcessor.addWarningSwitch(args, level);
} | [
"@",
"Override",
"protected",
"final",
"void",
"addWarningSwitch",
"(",
"final",
"Vector",
"<",
"String",
">",
"args",
",",
"final",
"int",
"level",
")",
"{",
"OpenWatcomProcessor",
".",
"addWarningSwitch",
"(",
"args",
",",
"level",
")",
";",
"}"
] | Add warning switch.
@param args
Vector command line arguments
@param level
int warning level | [
"Add",
"warning",
"switch",
"."
] | train | https://github.com/maven-nar/nar-maven-plugin/blob/3c622e2024296b4203431bbae3bde290a01dac00/src/main/java/com/github/maven_nar/cpptasks/openwatcom/OpenWatcomCompiler.java#L116-L119 |
mygreen/xlsmapper | src/main/java/com/gh/mygreen/xlsmapper/validation/SheetBindingErrors.java | SheetBindingErrors.pushNestedPath | public void pushNestedPath(final String subPath, final String key) {
final String canonicalPath = normalizePath(subPath);
ArgUtils.notEmpty(subPath, "subPath");
ArgUtils.notEmpty(key, "key");
pushNestedPath(String.format("%s[%s]", canonicalPath, key));
} | java | public void pushNestedPath(final String subPath, final String key) {
final String canonicalPath = normalizePath(subPath);
ArgUtils.notEmpty(subPath, "subPath");
ArgUtils.notEmpty(key, "key");
pushNestedPath(String.format("%s[%s]", canonicalPath, key));
} | [
"public",
"void",
"pushNestedPath",
"(",
"final",
"String",
"subPath",
",",
"final",
"String",
"key",
")",
"{",
"final",
"String",
"canonicalPath",
"=",
"normalizePath",
"(",
"subPath",
")",
";",
"ArgUtils",
".",
"notEmpty",
"(",
"subPath",
",",
"\"subPath\"",... | マップなどのキー付きのパスを1つ下位に移動します。
@param subPath ネストするパス
@param key マップのキー
@throws IllegalArgumentException {@literal subPath is empty or key is empty} | [
"マップなどのキー付きのパスを1つ下位に移動します。"
] | train | https://github.com/mygreen/xlsmapper/blob/a0c6b25c622e5f3a50b199ef685d2ee46ad5483c/src/main/java/com/gh/mygreen/xlsmapper/validation/SheetBindingErrors.java#L332-L338 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/internal/util/InvocationUtil.java | InvocationUtil.invokeOnStableClusterSerial | public static ICompletableFuture<Object> invokeOnStableClusterSerial(NodeEngine nodeEngine,
Supplier<? extends Operation> operationSupplier,
int maxRetries) {
ClusterService clusterService = nodeEngine.getClusterService();
if (!clusterService.isJoined()) {
return new CompletedFuture<Object>(null, null, new CallerRunsExecutor());
}
RestartingMemberIterator memberIterator = new RestartingMemberIterator(clusterService, maxRetries);
// we are going to iterate over all members and invoke an operation on each of them
InvokeOnMemberFunction invokeOnMemberFunction = new InvokeOnMemberFunction(operationSupplier, nodeEngine,
memberIterator);
Iterator<ICompletableFuture<Object>> invocationIterator = map(memberIterator, invokeOnMemberFunction);
ILogger logger = nodeEngine.getLogger(ChainingFuture.class);
ExecutionService executionService = nodeEngine.getExecutionService();
ManagedExecutorService executor = executionService.getExecutor(ExecutionService.ASYNC_EXECUTOR);
// ChainingFuture uses the iterator to start invocations
// it invokes on another member only when the previous invocation is completed (so invocations are serial)
// the future itself completes only when the last invocation completes (or if there is an error)
return new ChainingFuture<Object>(invocationIterator, executor, memberIterator, logger);
} | java | public static ICompletableFuture<Object> invokeOnStableClusterSerial(NodeEngine nodeEngine,
Supplier<? extends Operation> operationSupplier,
int maxRetries) {
ClusterService clusterService = nodeEngine.getClusterService();
if (!clusterService.isJoined()) {
return new CompletedFuture<Object>(null, null, new CallerRunsExecutor());
}
RestartingMemberIterator memberIterator = new RestartingMemberIterator(clusterService, maxRetries);
// we are going to iterate over all members and invoke an operation on each of them
InvokeOnMemberFunction invokeOnMemberFunction = new InvokeOnMemberFunction(operationSupplier, nodeEngine,
memberIterator);
Iterator<ICompletableFuture<Object>> invocationIterator = map(memberIterator, invokeOnMemberFunction);
ILogger logger = nodeEngine.getLogger(ChainingFuture.class);
ExecutionService executionService = nodeEngine.getExecutionService();
ManagedExecutorService executor = executionService.getExecutor(ExecutionService.ASYNC_EXECUTOR);
// ChainingFuture uses the iterator to start invocations
// it invokes on another member only when the previous invocation is completed (so invocations are serial)
// the future itself completes only when the last invocation completes (or if there is an error)
return new ChainingFuture<Object>(invocationIterator, executor, memberIterator, logger);
} | [
"public",
"static",
"ICompletableFuture",
"<",
"Object",
">",
"invokeOnStableClusterSerial",
"(",
"NodeEngine",
"nodeEngine",
",",
"Supplier",
"<",
"?",
"extends",
"Operation",
">",
"operationSupplier",
",",
"int",
"maxRetries",
")",
"{",
"ClusterService",
"clusterSer... | Invoke operation on all cluster members.
The invocation is serial: It iterates over all members starting from the oldest member to the youngest one.
If there is a cluster membership change while invoking then it will restart invocations on all members. This
implies the operation should be idempotent.
If there is an exception - other than {@link com.hazelcast.core.MemberLeftException} or
{@link com.hazelcast.spi.exception.TargetNotMemberException} while invoking then the iteration
is interrupted and the exception is propagated to the caller. | [
"Invoke",
"operation",
"on",
"all",
"cluster",
"members",
"."
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/util/InvocationUtil.java#L63-L87 |
apache/incubator-gobblin | gobblin-salesforce/src/main/java/org/apache/gobblin/salesforce/SalesforceSource.java | SalesforceSource.getRefinedHistogram | private Histogram getRefinedHistogram(SalesforceConnector connector, String entity, String watermarkColumn,
SourceState state, Partition partition, Histogram histogram) {
final int maxPartitions = state.getPropAsInt(ConfigurationKeys.SOURCE_MAX_NUMBER_OF_PARTITIONS,
ConfigurationKeys.DEFAULT_MAX_NUMBER_OF_PARTITIONS);
final int probeLimit = state.getPropAsInt(DYNAMIC_PROBING_LIMIT, DEFAULT_DYNAMIC_PROBING_LIMIT);
final int minTargetPartitionSize = state.getPropAsInt(MIN_TARGET_PARTITION_SIZE, DEFAULT_MIN_TARGET_PARTITION_SIZE);
final Histogram outputHistogram = new Histogram();
final double probeTargetRatio = state.getPropAsDouble(PROBE_TARGET_RATIO, DEFAULT_PROBE_TARGET_RATIO);
final int bucketSizeLimit =
(int) (probeTargetRatio * computeTargetPartitionSize(histogram, minTargetPartitionSize, maxPartitions));
log.info("Refining histogram with bucket size limit {}.", bucketSizeLimit);
HistogramGroup currentGroup;
HistogramGroup nextGroup;
final TableCountProbingContext probingContext =
new TableCountProbingContext(connector, entity, watermarkColumn, bucketSizeLimit, probeLimit);
if (histogram.getGroups().isEmpty()) {
return outputHistogram;
}
// make a copy of the histogram list and add a dummy entry at the end to avoid special processing of the last group
List<HistogramGroup> list = new ArrayList(histogram.getGroups());
Date hwmDate = Utils.toDate(partition.getHighWatermark(), Partitioner.WATERMARKTIMEFORMAT);
list.add(new HistogramGroup(Utils.epochToDate(hwmDate.getTime(), SECONDS_FORMAT), 0));
for (int i = 0; i < list.size() - 1; i++) {
currentGroup = list.get(i);
nextGroup = list.get(i + 1);
// split the group if it is larger than the bucket size limit
if (currentGroup.count > bucketSizeLimit) {
long startEpoch = Utils.toDate(currentGroup.getKey(), SECONDS_FORMAT).getTime();
long endEpoch = Utils.toDate(nextGroup.getKey(), SECONDS_FORMAT).getTime();
outputHistogram.add(getHistogramByProbing(probingContext, currentGroup.count, startEpoch, endEpoch));
} else {
outputHistogram.add(currentGroup);
}
}
log.info("Executed {} probes for refining the histogram.", probingContext.probeCount);
// if the probe limit has been reached then print a warning
if (probingContext.probeCount >= probingContext.probeLimit) {
log.warn("Reached the probe limit");
}
return outputHistogram;
} | java | private Histogram getRefinedHistogram(SalesforceConnector connector, String entity, String watermarkColumn,
SourceState state, Partition partition, Histogram histogram) {
final int maxPartitions = state.getPropAsInt(ConfigurationKeys.SOURCE_MAX_NUMBER_OF_PARTITIONS,
ConfigurationKeys.DEFAULT_MAX_NUMBER_OF_PARTITIONS);
final int probeLimit = state.getPropAsInt(DYNAMIC_PROBING_LIMIT, DEFAULT_DYNAMIC_PROBING_LIMIT);
final int minTargetPartitionSize = state.getPropAsInt(MIN_TARGET_PARTITION_SIZE, DEFAULT_MIN_TARGET_PARTITION_SIZE);
final Histogram outputHistogram = new Histogram();
final double probeTargetRatio = state.getPropAsDouble(PROBE_TARGET_RATIO, DEFAULT_PROBE_TARGET_RATIO);
final int bucketSizeLimit =
(int) (probeTargetRatio * computeTargetPartitionSize(histogram, minTargetPartitionSize, maxPartitions));
log.info("Refining histogram with bucket size limit {}.", bucketSizeLimit);
HistogramGroup currentGroup;
HistogramGroup nextGroup;
final TableCountProbingContext probingContext =
new TableCountProbingContext(connector, entity, watermarkColumn, bucketSizeLimit, probeLimit);
if (histogram.getGroups().isEmpty()) {
return outputHistogram;
}
// make a copy of the histogram list and add a dummy entry at the end to avoid special processing of the last group
List<HistogramGroup> list = new ArrayList(histogram.getGroups());
Date hwmDate = Utils.toDate(partition.getHighWatermark(), Partitioner.WATERMARKTIMEFORMAT);
list.add(new HistogramGroup(Utils.epochToDate(hwmDate.getTime(), SECONDS_FORMAT), 0));
for (int i = 0; i < list.size() - 1; i++) {
currentGroup = list.get(i);
nextGroup = list.get(i + 1);
// split the group if it is larger than the bucket size limit
if (currentGroup.count > bucketSizeLimit) {
long startEpoch = Utils.toDate(currentGroup.getKey(), SECONDS_FORMAT).getTime();
long endEpoch = Utils.toDate(nextGroup.getKey(), SECONDS_FORMAT).getTime();
outputHistogram.add(getHistogramByProbing(probingContext, currentGroup.count, startEpoch, endEpoch));
} else {
outputHistogram.add(currentGroup);
}
}
log.info("Executed {} probes for refining the histogram.", probingContext.probeCount);
// if the probe limit has been reached then print a warning
if (probingContext.probeCount >= probingContext.probeLimit) {
log.warn("Reached the probe limit");
}
return outputHistogram;
} | [
"private",
"Histogram",
"getRefinedHistogram",
"(",
"SalesforceConnector",
"connector",
",",
"String",
"entity",
",",
"String",
"watermarkColumn",
",",
"SourceState",
"state",
",",
"Partition",
"partition",
",",
"Histogram",
"histogram",
")",
"{",
"final",
"int",
"m... | Refine the histogram by probing to split large buckets
@return the refined histogram | [
"Refine",
"the",
"histogram",
"by",
"probing",
"to",
"split",
"large",
"buckets"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-salesforce/src/main/java/org/apache/gobblin/salesforce/SalesforceSource.java#L388-L438 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/LocalNetworkGatewaysInner.java | LocalNetworkGatewaysInner.beginCreateOrUpdate | public LocalNetworkGatewayInner beginCreateOrUpdate(String resourceGroupName, String localNetworkGatewayName, LocalNetworkGatewayInner parameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, localNetworkGatewayName, parameters).toBlocking().single().body();
} | java | public LocalNetworkGatewayInner beginCreateOrUpdate(String resourceGroupName, String localNetworkGatewayName, LocalNetworkGatewayInner parameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, localNetworkGatewayName, parameters).toBlocking().single().body();
} | [
"public",
"LocalNetworkGatewayInner",
"beginCreateOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"localNetworkGatewayName",
",",
"LocalNetworkGatewayInner",
"parameters",
")",
"{",
"return",
"beginCreateOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
"... | Creates or updates a local network gateway in the specified resource group.
@param resourceGroupName The name of the resource group.
@param localNetworkGatewayName The name of the local network gateway.
@param parameters Parameters supplied to the create or update local network gateway operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the LocalNetworkGatewayInner object if successful. | [
"Creates",
"or",
"updates",
"a",
"local",
"network",
"gateway",
"in",
"the",
"specified",
"resource",
"group",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/LocalNetworkGatewaysInner.java#L193-L195 |
ironjacamar/ironjacamar | codegenerator/src/main/java/org/ironjacamar/codegenerator/code/McCodeGen.java | McCodeGen.writeImport | @Override
public void writeImport(Definition def, Writer out) throws IOException
{
out.write("package " + def.getRaPackage() + ";\n\n");
if (def.isSupportEis())
{
out.write("import java.io.IOException;\n");
}
out.write("import java.io.PrintWriter;\n");
if (def.isSupportEis())
{
out.write("import java.net.Socket;\n");
}
out.write("import java.util.ArrayList;\n");
out.write("import java.util.Collections;\n");
out.write("import java.util.HashSet;\n");
out.write("import java.util.List;\n");
out.write("import java.util.Set;\n");
importLogging(def, out);
out.write("import javax.resource.NotSupportedException;\n");
out.write("import javax.resource.ResourceException;\n");
out.write("import javax.resource.spi.ConnectionEvent;\n");
out.write("import javax.resource.spi.ConnectionEventListener;\n");
out.write("import javax.resource.spi.ConnectionRequestInfo;\n");
out.write("import javax.resource.spi.LocalTransaction;\n");
out.write("import javax.resource.spi.ManagedConnection;\n");
out.write("import javax.resource.spi.ManagedConnectionMetaData;\n\n");
out.write("import javax.security.auth.Subject;\n");
out.write("import javax.transaction.xa.XAResource;\n\n");
} | java | @Override
public void writeImport(Definition def, Writer out) throws IOException
{
out.write("package " + def.getRaPackage() + ";\n\n");
if (def.isSupportEis())
{
out.write("import java.io.IOException;\n");
}
out.write("import java.io.PrintWriter;\n");
if (def.isSupportEis())
{
out.write("import java.net.Socket;\n");
}
out.write("import java.util.ArrayList;\n");
out.write("import java.util.Collections;\n");
out.write("import java.util.HashSet;\n");
out.write("import java.util.List;\n");
out.write("import java.util.Set;\n");
importLogging(def, out);
out.write("import javax.resource.NotSupportedException;\n");
out.write("import javax.resource.ResourceException;\n");
out.write("import javax.resource.spi.ConnectionEvent;\n");
out.write("import javax.resource.spi.ConnectionEventListener;\n");
out.write("import javax.resource.spi.ConnectionRequestInfo;\n");
out.write("import javax.resource.spi.LocalTransaction;\n");
out.write("import javax.resource.spi.ManagedConnection;\n");
out.write("import javax.resource.spi.ManagedConnectionMetaData;\n\n");
out.write("import javax.security.auth.Subject;\n");
out.write("import javax.transaction.xa.XAResource;\n\n");
} | [
"@",
"Override",
"public",
"void",
"writeImport",
"(",
"Definition",
"def",
",",
"Writer",
"out",
")",
"throws",
"IOException",
"{",
"out",
".",
"write",
"(",
"\"package \"",
"+",
"def",
".",
"getRaPackage",
"(",
")",
"+",
"\";\\n\\n\"",
")",
";",
"if",
... | Output class import
@param def definition
@param out Writer
@throws IOException ioException | [
"Output",
"class",
"import"
] | train | https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/codegenerator/src/main/java/org/ironjacamar/codegenerator/code/McCodeGen.java#L131-L163 |
sirthias/pegdown | src/main/java/org/pegdown/Parser.java | Parser.SetextHeading1 | public Rule SetextHeading1() {
return Sequence(
SetextInline(), push(new HeaderNode(1, popAsNode(), true)),
ZeroOrMore(SetextInline(), addAsChild()),
wrapInAnchor(),
Sp(), Newline(), NOrMore('=', 3), Sp(), Newline()
);
} | java | public Rule SetextHeading1() {
return Sequence(
SetextInline(), push(new HeaderNode(1, popAsNode(), true)),
ZeroOrMore(SetextInline(), addAsChild()),
wrapInAnchor(),
Sp(), Newline(), NOrMore('=', 3), Sp(), Newline()
);
} | [
"public",
"Rule",
"SetextHeading1",
"(",
")",
"{",
"return",
"Sequence",
"(",
"SetextInline",
"(",
")",
",",
"push",
"(",
"new",
"HeaderNode",
"(",
"1",
",",
"popAsNode",
"(",
")",
",",
"true",
")",
")",
",",
"ZeroOrMore",
"(",
"SetextInline",
"(",
")"... | vsch: #186 add isSetext flag to header node to distinguish header types | [
"vsch",
":",
"#186",
"add",
"isSetext",
"flag",
"to",
"header",
"node",
"to",
"distinguish",
"header",
"types"
] | train | https://github.com/sirthias/pegdown/blob/19ca3d3d2bea5df19eb885260ab24f1200a16452/src/main/java/org/pegdown/Parser.java#L284-L291 |
joniles/mpxj | src/main/java/net/sf/mpxj/mpx/Record.java | Record.getTime | public Date getTime(int field) throws MPXJException
{
try
{
Date result;
if ((field < m_fields.length) && (m_fields[field].length() != 0))
{
result = m_formats.getTimeFormat().parse(m_fields[field]);
}
else
{
result = null;
}
return (result);
}
catch (ParseException ex)
{
throw new MPXJException("Failed to parse time", ex);
}
} | java | public Date getTime(int field) throws MPXJException
{
try
{
Date result;
if ((field < m_fields.length) && (m_fields[field].length() != 0))
{
result = m_formats.getTimeFormat().parse(m_fields[field]);
}
else
{
result = null;
}
return (result);
}
catch (ParseException ex)
{
throw new MPXJException("Failed to parse time", ex);
}
} | [
"public",
"Date",
"getTime",
"(",
"int",
"field",
")",
"throws",
"MPXJException",
"{",
"try",
"{",
"Date",
"result",
";",
"if",
"(",
"(",
"field",
"<",
"m_fields",
".",
"length",
")",
"&&",
"(",
"m_fields",
"[",
"field",
"]",
".",
"length",
"(",
")",... | Accessor method used to retrieve an Date instance representing the
contents of an individual field. If the field does not exist in the
record, null is returned.
@param field the index number of the field to be retrieved
@return the value of the required field
@throws MPXJException normally thrown when parsing fails | [
"Accessor",
"method",
"used",
"to",
"retrieve",
"an",
"Date",
"instance",
"representing",
"the",
"contents",
"of",
"an",
"individual",
"field",
".",
"If",
"the",
"field",
"does",
"not",
"exist",
"in",
"the",
"record",
"null",
"is",
"returned",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/Record.java#L316-L338 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/config/Config.java | Config.setRingbufferConfigs | public Config setRingbufferConfigs(Map<String, RingbufferConfig> ringbufferConfigs) {
this.ringbufferConfigs.clear();
this.ringbufferConfigs.putAll(ringbufferConfigs);
for (Entry<String, RingbufferConfig> entry : ringbufferConfigs.entrySet()) {
entry.getValue().setName(entry.getKey());
}
return this;
} | java | public Config setRingbufferConfigs(Map<String, RingbufferConfig> ringbufferConfigs) {
this.ringbufferConfigs.clear();
this.ringbufferConfigs.putAll(ringbufferConfigs);
for (Entry<String, RingbufferConfig> entry : ringbufferConfigs.entrySet()) {
entry.getValue().setName(entry.getKey());
}
return this;
} | [
"public",
"Config",
"setRingbufferConfigs",
"(",
"Map",
"<",
"String",
",",
"RingbufferConfig",
">",
"ringbufferConfigs",
")",
"{",
"this",
".",
"ringbufferConfigs",
".",
"clear",
"(",
")",
";",
"this",
".",
"ringbufferConfigs",
".",
"putAll",
"(",
"ringbufferCo... | Sets the map of {@link com.hazelcast.ringbuffer.Ringbuffer} configurations,
mapped by config name. The config name may be a pattern with which the
configuration will be obtained in the future.
@param ringbufferConfigs the ringbuffer configuration map to set
@return this config instance | [
"Sets",
"the",
"map",
"of",
"{",
"@link",
"com",
".",
"hazelcast",
".",
"ringbuffer",
".",
"Ringbuffer",
"}",
"configurations",
"mapped",
"by",
"config",
"name",
".",
"The",
"config",
"name",
"may",
"be",
"a",
"pattern",
"with",
"which",
"the",
"configurat... | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/config/Config.java#L1296-L1303 |
bingoohuang/excel2javabeans | src/main/java/com/github/bingoohuang/excel2beans/BeansToExcelOnTemplate.java | BeansToExcelOnTemplate.fixCellValue | private void fixCellValue(MergeRow mergeRowAnn, int fromRow, int col) {
val sep = mergeRowAnn.prefixSeperate();
if (StringUtils.isEmpty(sep)) return;
val cell = sheet.getRow(fromRow).getCell(col);
val old = PoiUtil.getCellStringValue(cell);
val fixed = substringAfterSep(old, sep);
PoiUtil.writeCellValue(cell, fixed);
} | java | private void fixCellValue(MergeRow mergeRowAnn, int fromRow, int col) {
val sep = mergeRowAnn.prefixSeperate();
if (StringUtils.isEmpty(sep)) return;
val cell = sheet.getRow(fromRow).getCell(col);
val old = PoiUtil.getCellStringValue(cell);
val fixed = substringAfterSep(old, sep);
PoiUtil.writeCellValue(cell, fixed);
} | [
"private",
"void",
"fixCellValue",
"(",
"MergeRow",
"mergeRowAnn",
",",
"int",
"fromRow",
",",
"int",
"col",
")",
"{",
"val",
"sep",
"=",
"mergeRowAnn",
".",
"prefixSeperate",
"(",
")",
";",
"if",
"(",
"StringUtils",
".",
"isEmpty",
"(",
"sep",
")",
")",... | 修复合并单元格的数据。
1. 去除指导合并的取值前缀,例如1^a中的1^;
@param mergeRowAnn 纵向合并单元格注解。
@param fromRow 开始合并行索引。
@param col 纵向列索引。 | [
"修复合并单元格的数据。",
"1",
".",
"去除指导合并的取值前缀,例如1^a中的1^",
";"
] | train | https://github.com/bingoohuang/excel2javabeans/blob/db136d460b93b649814366c0d84a982698b96dc3/src/main/java/com/github/bingoohuang/excel2beans/BeansToExcelOnTemplate.java#L197-L206 |
gallandarakhneorg/afc | core/maths/mathgeom/tobeincluded/src/d3/continuous/Quaternion.java | Quaternion.getAxis | @Pure
public final Vector3f getAxis() {
double mag = this.x*this.x + this.y*this.y + this.z*this.z;
if ( mag > EPS ) {
mag = Math.sqrt(mag);
double invMag = 1f/mag;
return new Vector3f(
this.x*invMag,
this.y*invMag,
this.z*invMag);
}
return new Vector3f(0f, 0f, 1f);
} | java | @Pure
public final Vector3f getAxis() {
double mag = this.x*this.x + this.y*this.y + this.z*this.z;
if ( mag > EPS ) {
mag = Math.sqrt(mag);
double invMag = 1f/mag;
return new Vector3f(
this.x*invMag,
this.y*invMag,
this.z*invMag);
}
return new Vector3f(0f, 0f, 1f);
} | [
"@",
"Pure",
"public",
"final",
"Vector3f",
"getAxis",
"(",
")",
"{",
"double",
"mag",
"=",
"this",
".",
"x",
"*",
"this",
".",
"x",
"+",
"this",
".",
"y",
"*",
"this",
".",
"y",
"+",
"this",
".",
"z",
"*",
"this",
".",
"z",
";",
"if",
"(",
... | Replies the rotation axis-angle represented by this quaternion.
@return the rotation axis-angle. | [
"Replies",
"the",
"rotation",
"axis",
"-",
"angle",
"represented",
"by",
"this",
"quaternion",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/Quaternion.java#L672-L686 |
Azure/azure-sdk-for-java | mediaservices/data-plane/src/main/java/com/microsoft/windowsazure/services/media/models/ContentKeyAuthorizationPolicy.java | ContentKeyAuthorizationPolicy.unlinkOptions | public static EntityUnlinkOperation unlinkOptions(String contentKeyAuthorizationPolicyId,
String contentKeyAuthorizationPolicyOptionId) {
return new EntityUnlinkOperation(ENTITY_SET, contentKeyAuthorizationPolicyId, "Options", contentKeyAuthorizationPolicyOptionId);
} | java | public static EntityUnlinkOperation unlinkOptions(String contentKeyAuthorizationPolicyId,
String contentKeyAuthorizationPolicyOptionId) {
return new EntityUnlinkOperation(ENTITY_SET, contentKeyAuthorizationPolicyId, "Options", contentKeyAuthorizationPolicyOptionId);
} | [
"public",
"static",
"EntityUnlinkOperation",
"unlinkOptions",
"(",
"String",
"contentKeyAuthorizationPolicyId",
",",
"String",
"contentKeyAuthorizationPolicyOptionId",
")",
"{",
"return",
"new",
"EntityUnlinkOperation",
"(",
"ENTITY_SET",
",",
"contentKeyAuthorizationPolicyId",
... | Unlink content key authorization policy options.
@param assetId
the asset id
@param adpId
the Asset Delivery Policy id
@return the entity action operation | [
"Unlink",
"content",
"key",
"authorization",
"policy",
"options",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mediaservices/data-plane/src/main/java/com/microsoft/windowsazure/services/media/models/ContentKeyAuthorizationPolicy.java#L160-L163 |
52inc/android-52Kit | library-winds/src/main/java/com/ftinc/kit/winds/Winds.java | Winds.checkChangelogActivity | public static void checkChangelogActivity(Context ctx, @XmlRes int configId){
// Parse configuration
ChangeLog changeLog = Parser.parse(ctx, configId);
if(changeLog != null){
// Validate that there is a new version code
if(validateVersion(ctx, changeLog)) {
openChangelogActivity(ctx, configId);
}
}else{
throw new NullPointerException("Unable to find a 'Winds' configuration @ " + configId);
}
} | java | public static void checkChangelogActivity(Context ctx, @XmlRes int configId){
// Parse configuration
ChangeLog changeLog = Parser.parse(ctx, configId);
if(changeLog != null){
// Validate that there is a new version code
if(validateVersion(ctx, changeLog)) {
openChangelogActivity(ctx, configId);
}
}else{
throw new NullPointerException("Unable to find a 'Winds' configuration @ " + configId);
}
} | [
"public",
"static",
"void",
"checkChangelogActivity",
"(",
"Context",
"ctx",
",",
"@",
"XmlRes",
"int",
"configId",
")",
"{",
"// Parse configuration",
"ChangeLog",
"changeLog",
"=",
"Parser",
".",
"parse",
"(",
"ctx",
",",
"configId",
")",
";",
"if",
"(",
"... | Check to see if we should show the changelog activity if there are any new changes
to the configuration file.
@param ctx the context to launch the activity with
@param configId the changelog configuration xml resource id | [
"Check",
"to",
"see",
"if",
"we",
"should",
"show",
"the",
"changelog",
"activity",
"if",
"there",
"are",
"any",
"new",
"changes",
"to",
"the",
"configuration",
"file",
"."
] | train | https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library-winds/src/main/java/com/ftinc/kit/winds/Winds.java#L120-L135 |
xcesco/kripton | kripton-processor/src/main/java/com/abubusoft/kripton/processor/core/ManagedPropertyPersistenceHelper.java | ManagedPropertyPersistenceHelper.generateParamSerializer | public static void generateParamSerializer(BindTypeContext context, String propertyName, TypeName parameterTypeName, PersistType persistType) {
propertyName = SQLiteDaoDefinition.PARAM_SERIALIZER_PREFIX + propertyName;
MethodSpec.Builder methodBuilder = MethodSpec.methodBuilder(propertyName).addJavadoc("for param $L serialization\n", propertyName).addParameter(ParameterSpec.builder(parameterTypeName, "value").build());
methodBuilder.addModifiers(context.modifiers);
switch (persistType) {
case STRING:
methodBuilder.returns(className(String.class));
break;
case BYTE:
methodBuilder.returns(TypeUtility.arrayTypeName(Byte.TYPE));
break;
}
methodBuilder.beginControlFlow("if (value==null)");
methodBuilder.addStatement("return null");
methodBuilder.endControlFlow();
methodBuilder.addStatement("$T context=$T.jsonBind()", KriptonJsonContext.class, KriptonBinder.class);
methodBuilder.beginControlFlow("try ($T stream=new $T(); $T wrapper=context.createSerializer(stream))", KriptonByteArrayOutputStream.class, KriptonByteArrayOutputStream.class,
JacksonWrapperSerializer.class);
methodBuilder.addStatement("$T jacksonSerializer=wrapper.jacksonGenerator", JsonGenerator.class);
methodBuilder.addStatement("int fieldCount=0");
BindTransform bindTransform = BindTransformer.lookup(parameterTypeName);
String serializerName = "jacksonSerializer";
boolean isInCollection = true;
if (!BindTransformer.isBindedObject(parameterTypeName)) {
methodBuilder.addStatement("$L.writeStartObject()", serializerName);
isInCollection = false;
}
BindProperty property = BindProperty.builder(parameterTypeName).inCollection(isInCollection).elementName(DEFAULT_FIELD_NAME).build();
bindTransform.generateSerializeOnJackson(context, methodBuilder, serializerName, null, "value", property);
if (!BindTransformer.isBindedObject(parameterTypeName)) {
methodBuilder.addStatement("$L.writeEndObject()", serializerName);
}
methodBuilder.addStatement("$L.flush()", serializerName);
switch (persistType) {
case STRING:
methodBuilder.addStatement("return stream.toString()");
break;
case BYTE:
methodBuilder.addStatement("return stream.toByteArray()");
break;
}
methodBuilder.nextControlFlow("catch($T e)", Exception.class);
methodBuilder.addStatement("throw(new $T(e.getMessage()))", KriptonRuntimeException.class);
methodBuilder.endControlFlow();
context.builder.addMethod(methodBuilder.build());
} | java | public static void generateParamSerializer(BindTypeContext context, String propertyName, TypeName parameterTypeName, PersistType persistType) {
propertyName = SQLiteDaoDefinition.PARAM_SERIALIZER_PREFIX + propertyName;
MethodSpec.Builder methodBuilder = MethodSpec.methodBuilder(propertyName).addJavadoc("for param $L serialization\n", propertyName).addParameter(ParameterSpec.builder(parameterTypeName, "value").build());
methodBuilder.addModifiers(context.modifiers);
switch (persistType) {
case STRING:
methodBuilder.returns(className(String.class));
break;
case BYTE:
methodBuilder.returns(TypeUtility.arrayTypeName(Byte.TYPE));
break;
}
methodBuilder.beginControlFlow("if (value==null)");
methodBuilder.addStatement("return null");
methodBuilder.endControlFlow();
methodBuilder.addStatement("$T context=$T.jsonBind()", KriptonJsonContext.class, KriptonBinder.class);
methodBuilder.beginControlFlow("try ($T stream=new $T(); $T wrapper=context.createSerializer(stream))", KriptonByteArrayOutputStream.class, KriptonByteArrayOutputStream.class,
JacksonWrapperSerializer.class);
methodBuilder.addStatement("$T jacksonSerializer=wrapper.jacksonGenerator", JsonGenerator.class);
methodBuilder.addStatement("int fieldCount=0");
BindTransform bindTransform = BindTransformer.lookup(parameterTypeName);
String serializerName = "jacksonSerializer";
boolean isInCollection = true;
if (!BindTransformer.isBindedObject(parameterTypeName)) {
methodBuilder.addStatement("$L.writeStartObject()", serializerName);
isInCollection = false;
}
BindProperty property = BindProperty.builder(parameterTypeName).inCollection(isInCollection).elementName(DEFAULT_FIELD_NAME).build();
bindTransform.generateSerializeOnJackson(context, methodBuilder, serializerName, null, "value", property);
if (!BindTransformer.isBindedObject(parameterTypeName)) {
methodBuilder.addStatement("$L.writeEndObject()", serializerName);
}
methodBuilder.addStatement("$L.flush()", serializerName);
switch (persistType) {
case STRING:
methodBuilder.addStatement("return stream.toString()");
break;
case BYTE:
methodBuilder.addStatement("return stream.toByteArray()");
break;
}
methodBuilder.nextControlFlow("catch($T e)", Exception.class);
methodBuilder.addStatement("throw(new $T(e.getMessage()))", KriptonRuntimeException.class);
methodBuilder.endControlFlow();
context.builder.addMethod(methodBuilder.build());
} | [
"public",
"static",
"void",
"generateParamSerializer",
"(",
"BindTypeContext",
"context",
",",
"String",
"propertyName",
",",
"TypeName",
"parameterTypeName",
",",
"PersistType",
"persistType",
")",
"{",
"propertyName",
"=",
"SQLiteDaoDefinition",
".",
"PARAM_SERIALIZER_P... | Generate param serializer.
@param context the context
@param propertyName the property name
@param parameterTypeName the parameter type name
@param persistType the persist type | [
"Generate",
"param",
"serializer",
"."
] | train | https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/core/ManagedPropertyPersistenceHelper.java#L244-L303 |
LearnLib/learnlib | oracles/membership-oracles/src/main/java/de/learnlib/oracle/membership/SimulatorOmegaOracle.java | SimulatorOmegaOracle.isSameState | @Override
public boolean isSameState(Word<I> input1, S s1, Word<I> input2, S s2) {
return s1.equals(s2);
} | java | @Override
public boolean isSameState(Word<I> input1, S s1, Word<I> input2, S s2) {
return s1.equals(s2);
} | [
"@",
"Override",
"public",
"boolean",
"isSameState",
"(",
"Word",
"<",
"I",
">",
"input1",
",",
"S",
"s1",
",",
"Word",
"<",
"I",
">",
"input2",
",",
"S",
"s2",
")",
"{",
"return",
"s1",
".",
"equals",
"(",
"s2",
")",
";",
"}"
] | Test for state equivalence by simply invoking {@link Object#equals(Object)}.
@see OmegaMembershipOracle#isSameState(Word, Object, Word, Object) | [
"Test",
"for",
"state",
"equivalence",
"by",
"simply",
"invoking",
"{",
"@link",
"Object#equals",
"(",
"Object",
")",
"}",
"."
] | train | https://github.com/LearnLib/learnlib/blob/fa38a14adcc0664099f180d671ffa42480318d7b/oracles/membership-oracles/src/main/java/de/learnlib/oracle/membership/SimulatorOmegaOracle.java#L92-L95 |
awslabs/jsii | packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiClient.java | JsiiClient.setStaticPropertyValue | public void setStaticPropertyValue(final String fqn, final String property, final JsonNode value) {
ObjectNode req = makeRequest("sset");
req.put("fqn", fqn);
req.put("property", property);
req.set("value", value);
this.runtime.requestResponse(req);
} | java | public void setStaticPropertyValue(final String fqn, final String property, final JsonNode value) {
ObjectNode req = makeRequest("sset");
req.put("fqn", fqn);
req.put("property", property);
req.set("value", value);
this.runtime.requestResponse(req);
} | [
"public",
"void",
"setStaticPropertyValue",
"(",
"final",
"String",
"fqn",
",",
"final",
"String",
"property",
",",
"final",
"JsonNode",
"value",
")",
"{",
"ObjectNode",
"req",
"=",
"makeRequest",
"(",
"\"sset\"",
")",
";",
"req",
".",
"put",
"(",
"\"fqn\"",... | Sets the value of a mutable static property.
@param fqn The FQN of the class
@param property The property name
@param value The new value | [
"Sets",
"the",
"value",
"of",
"a",
"mutable",
"static",
"property",
"."
] | train | https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiClient.java#L149-L155 |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/BootstrapConfig.java | BootstrapConfig.getWorkareaFile | public File getWorkareaFile(String relativeServerWorkareaPath) {
if (relativeServerWorkareaPath == null)
return workarea;
else
return new File(workarea, relativeServerWorkareaPath);
} | java | public File getWorkareaFile(String relativeServerWorkareaPath) {
if (relativeServerWorkareaPath == null)
return workarea;
else
return new File(workarea, relativeServerWorkareaPath);
} | [
"public",
"File",
"getWorkareaFile",
"(",
"String",
"relativeServerWorkareaPath",
")",
"{",
"if",
"(",
"relativeServerWorkareaPath",
"==",
"null",
")",
"return",
"workarea",
";",
"else",
"return",
"new",
"File",
"(",
"workarea",
",",
"relativeServerWorkareaPath",
")... | Allocate a file in the server directory, e.g.
usr/servers/serverName/workarea/relativeServerWorkareaPath
@param relativeServerWorkareaPath
relative path of file to create in the server's workarea
@return File object for relative path, or for the server workarea itself if
the relative path argument is null | [
"Allocate",
"a",
"file",
"in",
"the",
"server",
"directory",
"e",
".",
"g",
".",
"usr",
"/",
"servers",
"/",
"serverName",
"/",
"workarea",
"/",
"relativeServerWorkareaPath"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/BootstrapConfig.java#L644-L649 |
mgledi/DRUMS | src/main/java/com/unister/semweb/drums/storable/GeneralStructure.java | GeneralStructure.addKeyPart | public boolean addKeyPart(String name, int size) throws IOException {
if (INSTANCE_EXISITS) {
throw new IOException("A GeneralStroable was already instantiated. You cant further add Key Parts");
}
int hash = Arrays.hashCode(name.getBytes());
int index = keyPartNames.size();
if (keyHash2Index.containsKey(hash)) {
logger.error("A keyPart with the name {} already exists", name);
return false;
}
keyPartNames.add(name);
keyHash2Index.put(hash, index);
keyIndex2Hash.add(hash);
keySizes.add(size);
keyByteOffsets.add(keySize);
keySize += size;
return true;
} | java | public boolean addKeyPart(String name, int size) throws IOException {
if (INSTANCE_EXISITS) {
throw new IOException("A GeneralStroable was already instantiated. You cant further add Key Parts");
}
int hash = Arrays.hashCode(name.getBytes());
int index = keyPartNames.size();
if (keyHash2Index.containsKey(hash)) {
logger.error("A keyPart with the name {} already exists", name);
return false;
}
keyPartNames.add(name);
keyHash2Index.put(hash, index);
keyIndex2Hash.add(hash);
keySizes.add(size);
keyByteOffsets.add(keySize);
keySize += size;
return true;
} | [
"public",
"boolean",
"addKeyPart",
"(",
"String",
"name",
",",
"int",
"size",
")",
"throws",
"IOException",
"{",
"if",
"(",
"INSTANCE_EXISITS",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"A GeneralStroable was already instantiated. You cant further add Key Parts\"",
... | Adds a new KeyPart
@param name
the name of the key part. With this name you can access this part
@param size
the size of the key part in bytes
@return true if adding the key part was successful
@throws IOException | [
"Adds",
"a",
"new",
"KeyPart"
] | train | https://github.com/mgledi/DRUMS/blob/a670f17a2186c9a15725f26617d77ce8e444e072/src/main/java/com/unister/semweb/drums/storable/GeneralStructure.java#L125-L142 |
opentelecoms-org/zrtp-java | src/zorg/ZRTP.java | ZRTP.setSdpHelloHash | public void setSdpHelloHash(String version, String helloHash) {
if (!version.startsWith(VERSION_PREFIX)) {
logWarning("Different version number: '" + version + "' Ours: '"
+ VERSION_PREFIX + "' (" + VERSION + ")");
}
sdpHelloHashReceived = helloHash;
} | java | public void setSdpHelloHash(String version, String helloHash) {
if (!version.startsWith(VERSION_PREFIX)) {
logWarning("Different version number: '" + version + "' Ours: '"
+ VERSION_PREFIX + "' (" + VERSION + ")");
}
sdpHelloHashReceived = helloHash;
} | [
"public",
"void",
"setSdpHelloHash",
"(",
"String",
"version",
",",
"String",
"helloHash",
")",
"{",
"if",
"(",
"!",
"version",
".",
"startsWith",
"(",
"VERSION_PREFIX",
")",
")",
"{",
"logWarning",
"(",
"\"Different version number: '\"",
"+",
"version",
"+",
... | Hash of the Hello message to be received. This hash is sent by the other
end as part of the SDP for further verification.
@param version
ZRTP version of the hash
@param helloHash
Hello hash received as part of SDP in SIP | [
"Hash",
"of",
"the",
"Hello",
"message",
"to",
"be",
"received",
".",
"This",
"hash",
"is",
"sent",
"by",
"the",
"other",
"end",
"as",
"part",
"of",
"the",
"SDP",
"for",
"further",
"verification",
"."
] | train | https://github.com/opentelecoms-org/zrtp-java/blob/10a0c77866c5d1b1504df161db9a447f5069ed54/src/zorg/ZRTP.java#L2554-L2560 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/PoolsImpl.java | PoolsImpl.evaluateAutoScaleAsync | public ServiceFuture<AutoScaleRun> evaluateAutoScaleAsync(String poolId, String autoScaleFormula, final ServiceCallback<AutoScaleRun> serviceCallback) {
return ServiceFuture.fromHeaderResponse(evaluateAutoScaleWithServiceResponseAsync(poolId, autoScaleFormula), serviceCallback);
} | java | public ServiceFuture<AutoScaleRun> evaluateAutoScaleAsync(String poolId, String autoScaleFormula, final ServiceCallback<AutoScaleRun> serviceCallback) {
return ServiceFuture.fromHeaderResponse(evaluateAutoScaleWithServiceResponseAsync(poolId, autoScaleFormula), serviceCallback);
} | [
"public",
"ServiceFuture",
"<",
"AutoScaleRun",
">",
"evaluateAutoScaleAsync",
"(",
"String",
"poolId",
",",
"String",
"autoScaleFormula",
",",
"final",
"ServiceCallback",
"<",
"AutoScaleRun",
">",
"serviceCallback",
")",
"{",
"return",
"ServiceFuture",
".",
"fromHead... | Gets the result of evaluating an automatic scaling formula on the pool.
This API is primarily for validating an autoscale formula, as it simply returns the result without applying the formula to the pool. The pool must have auto scaling enabled in order to evaluate a formula.
@param poolId The ID of the pool on which to evaluate the automatic scaling formula.
@param autoScaleFormula The formula for the desired number of compute nodes in the pool. The formula is validated and its results calculated, but it is not applied to the pool. To apply the formula to the pool, 'Enable automatic scaling on a pool'. For more information about specifying this formula, see Automatically scale compute nodes in an Azure Batch pool (https://azure.microsoft.com/en-us/documentation/articles/batch-automatic-scaling).
@param serviceCallback the async ServiceCallback to handle successful and failed responses.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceFuture} object | [
"Gets",
"the",
"result",
"of",
"evaluating",
"an",
"automatic",
"scaling",
"formula",
"on",
"the",
"pool",
".",
"This",
"API",
"is",
"primarily",
"for",
"validating",
"an",
"autoscale",
"formula",
"as",
"it",
"simply",
"returns",
"the",
"result",
"without",
... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/PoolsImpl.java#L2523-L2525 |
overview/mime-types | src/main/java/org/overviewproject/mime_types/MimeTypeDetector.java | MimeTypeDetector.oneMatchletMagicEquals | private boolean oneMatchletMagicEquals(int offset, byte[] data) {
int rangeStart = content.getInt(offset); // first byte of data for check to start at
int rangeLength = content.getInt(offset + 4); // last byte of data for check to start at
int dataLength = content.getInt(offset + 12); // number of bytes in match data/mask
int dataOffset = content.getInt(offset + 16); // contentBytes offset to the match data
int maskOffset = content.getInt(offset + 20); // contentBytes offset to the mask
boolean found = false;
for (int i = 0; !found && (i <= rangeLength) && (i + rangeStart + dataLength <= data.length); i++) {
if (maskOffset != 0) {
found = subArraysEqualWithMask(
contentBytes, dataOffset,
data, rangeStart + i,
contentBytes, maskOffset,
dataLength
);
} else {
found = subArraysEqual(
contentBytes, dataOffset,
data, rangeStart + i,
dataLength
);
}
}
return found;
} | java | private boolean oneMatchletMagicEquals(int offset, byte[] data) {
int rangeStart = content.getInt(offset); // first byte of data for check to start at
int rangeLength = content.getInt(offset + 4); // last byte of data for check to start at
int dataLength = content.getInt(offset + 12); // number of bytes in match data/mask
int dataOffset = content.getInt(offset + 16); // contentBytes offset to the match data
int maskOffset = content.getInt(offset + 20); // contentBytes offset to the mask
boolean found = false;
for (int i = 0; !found && (i <= rangeLength) && (i + rangeStart + dataLength <= data.length); i++) {
if (maskOffset != 0) {
found = subArraysEqualWithMask(
contentBytes, dataOffset,
data, rangeStart + i,
contentBytes, maskOffset,
dataLength
);
} else {
found = subArraysEqual(
contentBytes, dataOffset,
data, rangeStart + i,
dataLength
);
}
}
return found;
} | [
"private",
"boolean",
"oneMatchletMagicEquals",
"(",
"int",
"offset",
",",
"byte",
"[",
"]",
"data",
")",
"{",
"int",
"rangeStart",
"=",
"content",
".",
"getInt",
"(",
"offset",
")",
";",
"// first byte of data for check to start at",
"int",
"rangeLength",
"=",
... | Tests whether one matchlet (but not its children) matches data. | [
"Tests",
"whether",
"one",
"matchlet",
"(",
"but",
"not",
"its",
"children",
")",
"matches",
"data",
"."
] | train | https://github.com/overview/mime-types/blob/d5c45302049c0cd5e634a50954304d8ddeb9abb4/src/main/java/org/overviewproject/mime_types/MimeTypeDetector.java#L434-L461 |
jenkinsci/jenkins | core/src/main/java/hudson/scheduler/BaseParser.java | BaseParser.doHash | protected long doHash(int step, int field) throws ANTLRException {
int u = UPPER_BOUNDS[field];
if (field==2) u = 28; // day of month can vary depending on month, so to make life simpler, just use [1,28] that's always safe
if (field==4) u = 6; // Both 0 and 7 of day of week are Sunday. For better distribution, limit upper bound to 6
return doHash(LOWER_BOUNDS[field], u, step, field);
} | java | protected long doHash(int step, int field) throws ANTLRException {
int u = UPPER_BOUNDS[field];
if (field==2) u = 28; // day of month can vary depending on month, so to make life simpler, just use [1,28] that's always safe
if (field==4) u = 6; // Both 0 and 7 of day of week are Sunday. For better distribution, limit upper bound to 6
return doHash(LOWER_BOUNDS[field], u, step, field);
} | [
"protected",
"long",
"doHash",
"(",
"int",
"step",
",",
"int",
"field",
")",
"throws",
"ANTLRException",
"{",
"int",
"u",
"=",
"UPPER_BOUNDS",
"[",
"field",
"]",
";",
"if",
"(",
"field",
"==",
"2",
")",
"u",
"=",
"28",
";",
"// day of month can vary depe... | Uses {@link Hash} to choose a random (but stable) value from within this field.
@param step
Increments. For example, 15 if "H/15". Or {@link #NO_STEP} to indicate
the special constant for "H" without the step value. | [
"Uses",
"{",
"@link",
"Hash",
"}",
"to",
"choose",
"a",
"random",
"(",
"but",
"stable",
")",
"value",
"from",
"within",
"this",
"field",
"."
] | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/scheduler/BaseParser.java#L96-L101 |
gallandarakhneorg/afc | core/text/src/main/java/org/arakhne/afc/text/TextUtil.java | TextUtil.mergeBrackets | @Pure
@Inline(value = "TextUtil.join('{', '}', $1)", imported = {TextUtil.class})
public static <T> String mergeBrackets(@SuppressWarnings("unchecked") T... strs) {
return join('{', '}', strs);
} | java | @Pure
@Inline(value = "TextUtil.join('{', '}', $1)", imported = {TextUtil.class})
public static <T> String mergeBrackets(@SuppressWarnings("unchecked") T... strs) {
return join('{', '}', strs);
} | [
"@",
"Pure",
"@",
"Inline",
"(",
"value",
"=",
"\"TextUtil.join('{', '}', $1)\"",
",",
"imported",
"=",
"{",
"TextUtil",
".",
"class",
"}",
")",
"public",
"static",
"<",
"T",
">",
"String",
"mergeBrackets",
"(",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
... | Merge the given strings with to brackets.
The brackets are used to delimit the groups
of characters.
<p>Examples:
<ul>
<li><code>mergeBrackets("a","b","cd")</code> returns the string
<code>"{a}{b}{cd}"</code></li>
<li><code>mergeBrackets("a{bcd")</code> returns the string
<code>"{a{bcd}"</code></li>
</ul>
@param <T> is the type of the parameters.
@param strs is the array of strings.
@return the string with bracketed strings. | [
"Merge",
"the",
"given",
"strings",
"with",
"to",
"brackets",
".",
"The",
"brackets",
"are",
"used",
"to",
"delimit",
"the",
"groups",
"of",
"characters",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/text/src/main/java/org/arakhne/afc/text/TextUtil.java#L842-L846 |
dashorst/wicket-stuff-markup-validator | jing/src/main/java/com/thaiopensource/validate/nvdl/Mode.java | Mode.bindAttribute | boolean bindAttribute(String ns, String wildcard, AttributeActionSet actions) {
NamespaceSpecification nss = new NamespaceSpecification(ns, wildcard);
if (nssAttributeMap.get(nss) != null)
return false;
for (Enumeration e = nssAttributeMap.keys(); e.hasMoreElements();) {
NamespaceSpecification nssI = (NamespaceSpecification)e.nextElement();
if (nss.compete(nssI)) {
return false;
}
}
nssAttributeMap.put(nss, actions);
return true;
} | java | boolean bindAttribute(String ns, String wildcard, AttributeActionSet actions) {
NamespaceSpecification nss = new NamespaceSpecification(ns, wildcard);
if (nssAttributeMap.get(nss) != null)
return false;
for (Enumeration e = nssAttributeMap.keys(); e.hasMoreElements();) {
NamespaceSpecification nssI = (NamespaceSpecification)e.nextElement();
if (nss.compete(nssI)) {
return false;
}
}
nssAttributeMap.put(nss, actions);
return true;
} | [
"boolean",
"bindAttribute",
"(",
"String",
"ns",
",",
"String",
"wildcard",
",",
"AttributeActionSet",
"actions",
")",
"{",
"NamespaceSpecification",
"nss",
"=",
"new",
"NamespaceSpecification",
"(",
"ns",
",",
"wildcard",
")",
";",
"if",
"(",
"nssAttributeMap",
... | Adds a set of attribute actions to be performed in this mode
for attributes in a specified namespace.
@param ns The namespace pattern.
@param wildcard The wildcard character.
@param actions The set of attribute actions.
@return true if successfully added, that is the namespace was
not already present in the attributeMap, otherwise false, the
caller should signal a script error in this case. | [
"Adds",
"a",
"set",
"of",
"attribute",
"actions",
"to",
"be",
"performed",
"in",
"this",
"mode",
"for",
"attributes",
"in",
"a",
"specified",
"namespace",
"."
] | train | https://github.com/dashorst/wicket-stuff-markup-validator/blob/9e529a4dc8bfdbbe4c794f3132ef400a006560a1/jing/src/main/java/com/thaiopensource/validate/nvdl/Mode.java#L389-L401 |
Netflix/conductor | core/src/main/java/com/netflix/conductor/core/execution/mapper/ForkJoinDynamicTaskMapper.java | ForkJoinDynamicTaskMapper.createJoinTask | @VisibleForTesting
Task createJoinTask(Workflow workflowInstance, WorkflowTask joinWorkflowTask, HashMap<String, Object> joinInput) {
Task joinTask = new Task();
joinTask.setTaskType(SystemTaskType.JOIN.name());
joinTask.setTaskDefName(SystemTaskType.JOIN.name());
joinTask.setReferenceTaskName(joinWorkflowTask.getTaskReferenceName());
joinTask.setWorkflowInstanceId(workflowInstance.getWorkflowId());
joinTask.setWorkflowType(workflowInstance.getWorkflowName());
joinTask.setCorrelationId(workflowInstance.getCorrelationId());
joinTask.setScheduledTime(System.currentTimeMillis());
joinTask.setInputData(joinInput);
joinTask.setTaskId(IDGenerator.generate());
joinTask.setStatus(Task.Status.IN_PROGRESS);
joinTask.setWorkflowTask(joinWorkflowTask);
return joinTask;
} | java | @VisibleForTesting
Task createJoinTask(Workflow workflowInstance, WorkflowTask joinWorkflowTask, HashMap<String, Object> joinInput) {
Task joinTask = new Task();
joinTask.setTaskType(SystemTaskType.JOIN.name());
joinTask.setTaskDefName(SystemTaskType.JOIN.name());
joinTask.setReferenceTaskName(joinWorkflowTask.getTaskReferenceName());
joinTask.setWorkflowInstanceId(workflowInstance.getWorkflowId());
joinTask.setWorkflowType(workflowInstance.getWorkflowName());
joinTask.setCorrelationId(workflowInstance.getCorrelationId());
joinTask.setScheduledTime(System.currentTimeMillis());
joinTask.setInputData(joinInput);
joinTask.setTaskId(IDGenerator.generate());
joinTask.setStatus(Task.Status.IN_PROGRESS);
joinTask.setWorkflowTask(joinWorkflowTask);
return joinTask;
} | [
"@",
"VisibleForTesting",
"Task",
"createJoinTask",
"(",
"Workflow",
"workflowInstance",
",",
"WorkflowTask",
"joinWorkflowTask",
",",
"HashMap",
"<",
"String",
",",
"Object",
">",
"joinInput",
")",
"{",
"Task",
"joinTask",
"=",
"new",
"Task",
"(",
")",
";",
"... | This method creates a JOIN task that is used in the {@link this#getMappedTasks(TaskMapperContext)}
at the end to add a join task to be scheduled after all the fork tasks
@param workflowInstance: A instance of the {@link Workflow} which represents the workflow being executed.
@param joinWorkflowTask: A instance of {@link WorkflowTask} which is of type {@link TaskType#JOIN}
@param joinInput: The input which is set in the {@link Task#setInputData(Map)}
@return a new instance of {@link Task} representing a {@link SystemTaskType#JOIN} | [
"This",
"method",
"creates",
"a",
"JOIN",
"task",
"that",
"is",
"used",
"in",
"the",
"{",
"@link",
"this#getMappedTasks",
"(",
"TaskMapperContext",
")",
"}",
"at",
"the",
"end",
"to",
"add",
"a",
"join",
"task",
"to",
"be",
"scheduled",
"after",
"all",
"... | train | https://github.com/Netflix/conductor/blob/78fae0ed9ddea22891f9eebb96a2ec0b2783dca0/core/src/main/java/com/netflix/conductor/core/execution/mapper/ForkJoinDynamicTaskMapper.java#L208-L223 |
javagl/ND | nd-tuples/src/main/java/de/javagl/nd/tuples/i/IntTuples.java | IntTuples.compareLexicographically | public static int compareLexicographically(IntTuple t0, IntTuple t1)
{
Utils.checkForEqualSize(t0, t1);
for (int i=0; i<t0.getSize(); i++)
{
if (t0.get(i) < t1.get(i))
{
return -1;
}
else if (t0.get(i) > t1.get(i))
{
return 1;
}
}
return 0;
} | java | public static int compareLexicographically(IntTuple t0, IntTuple t1)
{
Utils.checkForEqualSize(t0, t1);
for (int i=0; i<t0.getSize(); i++)
{
if (t0.get(i) < t1.get(i))
{
return -1;
}
else if (t0.get(i) > t1.get(i))
{
return 1;
}
}
return 0;
} | [
"public",
"static",
"int",
"compareLexicographically",
"(",
"IntTuple",
"t0",
",",
"IntTuple",
"t1",
")",
"{",
"Utils",
".",
"checkForEqualSize",
"(",
"t0",
",",
"t1",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"t0",
".",
"getSize",
"... | Compares two tuples lexicographically, starting with
the elements of the lowest index.
@param t0 The first tuple
@param t1 The second tuple
@return -1 if the first tuple is lexicographically
smaller than the second, +1 if it is larger, and
0 if they are equal.
@throws IllegalArgumentException If the given tuples do not
have the same {@link Tuple#getSize() size} | [
"Compares",
"two",
"tuples",
"lexicographically",
"starting",
"with",
"the",
"elements",
"of",
"the",
"lowest",
"index",
"."
] | train | https://github.com/javagl/ND/blob/bcb655aaf5fc88af6194f73a27cca079186ff559/nd-tuples/src/main/java/de/javagl/nd/tuples/i/IntTuples.java#L902-L917 |
Azure/azure-sdk-for-java | labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/OperationsInner.java | OperationsInner.getAsync | public Observable<OperationResultInner> getAsync(String locationName, String operationName) {
return getWithServiceResponseAsync(locationName, operationName).map(new Func1<ServiceResponse<OperationResultInner>, OperationResultInner>() {
@Override
public OperationResultInner call(ServiceResponse<OperationResultInner> response) {
return response.body();
}
});
} | java | public Observable<OperationResultInner> getAsync(String locationName, String operationName) {
return getWithServiceResponseAsync(locationName, operationName).map(new Func1<ServiceResponse<OperationResultInner>, OperationResultInner>() {
@Override
public OperationResultInner call(ServiceResponse<OperationResultInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"OperationResultInner",
">",
"getAsync",
"(",
"String",
"locationName",
",",
"String",
"operationName",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
"locationName",
",",
"operationName",
")",
".",
"map",
"(",
"new",
"Func1",
... | Get operation.
@param locationName The name of the location.
@param operationName The name of the operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the OperationResultInner object | [
"Get",
"operation",
"."
] | 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/OperationsInner.java#L95-L102 |
VoltDB/voltdb | src/hsqldb19b3/org/hsqldb_voltpatches/TableWorks.java | TableWorks.addIndex | Index addIndex(int[] col, HsqlName name, boolean unique, boolean migrating) {
Index newindex;
if (table.isEmpty(session) || table.isIndexingMutable()) {
PersistentStore store = session.sessionData.getRowStore(table);
newindex = table.createIndex(store, name, col, null, null, unique, migrating,
false, false);
} else {
newindex = table.createIndexStructure(name, col, null, null,
unique, migrating, false, false);
Table tn = table.moveDefinition(session, table.tableType, null,
null, newindex, -1, 0, emptySet,
emptySet);
// for all sessions move the data
tn.moveData(session, table, -1, 0);
database.persistentStoreCollection.releaseStore(table);
table = tn;
setNewTableInSchema(table);
updateConstraints(table, emptySet);
}
database.schemaManager.addSchemaObject(newindex);
database.schemaManager.recompileDependentObjects(table);
return newindex;
} | java | Index addIndex(int[] col, HsqlName name, boolean unique, boolean migrating) {
Index newindex;
if (table.isEmpty(session) || table.isIndexingMutable()) {
PersistentStore store = session.sessionData.getRowStore(table);
newindex = table.createIndex(store, name, col, null, null, unique, migrating,
false, false);
} else {
newindex = table.createIndexStructure(name, col, null, null,
unique, migrating, false, false);
Table tn = table.moveDefinition(session, table.tableType, null,
null, newindex, -1, 0, emptySet,
emptySet);
// for all sessions move the data
tn.moveData(session, table, -1, 0);
database.persistentStoreCollection.releaseStore(table);
table = tn;
setNewTableInSchema(table);
updateConstraints(table, emptySet);
}
database.schemaManager.addSchemaObject(newindex);
database.schemaManager.recompileDependentObjects(table);
return newindex;
} | [
"Index",
"addIndex",
"(",
"int",
"[",
"]",
"col",
",",
"HsqlName",
"name",
",",
"boolean",
"unique",
",",
"boolean",
"migrating",
")",
"{",
"Index",
"newindex",
";",
"if",
"(",
"table",
".",
"isEmpty",
"(",
"session",
")",
"||",
"table",
".",
"isIndexi... | Because of the way indexes and column data are held in memory and on
disk, it is necessary to recreate the table when an index is added to a
non-empty cached table.
<p> With empty tables, Index objects are simply added
<p> With MEOMRY and TEXT tables, a new index is built up and nodes for
earch row are interlinked (fredt@users)
@param col int[]
@param name HsqlName
@param unique boolean
@return new index | [
"Because",
"of",
"the",
"way",
"indexes",
"and",
"column",
"data",
"are",
"held",
"in",
"memory",
"and",
"on",
"disk",
"it",
"is",
"necessary",
"to",
"recreate",
"the",
"table",
"when",
"an",
"index",
"is",
"added",
"to",
"a",
"non",
"-",
"empty",
"cac... | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/TableWorks.java#L486-L517 |
shinesolutions/swagger-aem | java/generated/src/main/java/com/shinesolutions/swaggeraem4j/api/ConsoleApi.java | ConsoleApi.postSamlConfigurationAsync | public com.squareup.okhttp.Call postSamlConfigurationAsync(Boolean post, Boolean apply, Boolean delete, String action, String location, List<String> path, String serviceRanking, String idpUrl, String idpCertAlias, Boolean idpHttpRedirect, String serviceProviderEntityId, String assertionConsumerServiceURL, String spPrivateKeyAlias, String keyStorePassword, String defaultRedirectUrl, String userIDAttribute, Boolean useEncryption, Boolean createUser, Boolean addGroupMemberships, String groupMembershipAttribute, List<String> defaultGroups, String nameIdFormat, List<String> synchronizeAttributes, Boolean handleLogout, String logoutUrl, String clockTolerance, String digestMethod, String signatureMethod, String userIntermediatePath, List<String> propertylist, final ApiCallback<SamlConfigurationInformations> callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
com.squareup.okhttp.Call call = postSamlConfigurationValidateBeforeCall(post, apply, delete, action, location, path, serviceRanking, idpUrl, idpCertAlias, idpHttpRedirect, serviceProviderEntityId, assertionConsumerServiceURL, spPrivateKeyAlias, keyStorePassword, defaultRedirectUrl, userIDAttribute, useEncryption, createUser, addGroupMemberships, groupMembershipAttribute, defaultGroups, nameIdFormat, synchronizeAttributes, handleLogout, logoutUrl, clockTolerance, digestMethod, signatureMethod, userIntermediatePath, propertylist, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken<SamlConfigurationInformations>(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
} | java | public com.squareup.okhttp.Call postSamlConfigurationAsync(Boolean post, Boolean apply, Boolean delete, String action, String location, List<String> path, String serviceRanking, String idpUrl, String idpCertAlias, Boolean idpHttpRedirect, String serviceProviderEntityId, String assertionConsumerServiceURL, String spPrivateKeyAlias, String keyStorePassword, String defaultRedirectUrl, String userIDAttribute, Boolean useEncryption, Boolean createUser, Boolean addGroupMemberships, String groupMembershipAttribute, List<String> defaultGroups, String nameIdFormat, List<String> synchronizeAttributes, Boolean handleLogout, String logoutUrl, String clockTolerance, String digestMethod, String signatureMethod, String userIntermediatePath, List<String> propertylist, final ApiCallback<SamlConfigurationInformations> callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
com.squareup.okhttp.Call call = postSamlConfigurationValidateBeforeCall(post, apply, delete, action, location, path, serviceRanking, idpUrl, idpCertAlias, idpHttpRedirect, serviceProviderEntityId, assertionConsumerServiceURL, spPrivateKeyAlias, keyStorePassword, defaultRedirectUrl, userIDAttribute, useEncryption, createUser, addGroupMemberships, groupMembershipAttribute, defaultGroups, nameIdFormat, synchronizeAttributes, handleLogout, logoutUrl, clockTolerance, digestMethod, signatureMethod, userIntermediatePath, propertylist, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken<SamlConfigurationInformations>(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
} | [
"public",
"com",
".",
"squareup",
".",
"okhttp",
".",
"Call",
"postSamlConfigurationAsync",
"(",
"Boolean",
"post",
",",
"Boolean",
"apply",
",",
"Boolean",
"delete",
",",
"String",
"action",
",",
"String",
"location",
",",
"List",
"<",
"String",
">",
"path"... | (asynchronously)
@param post (optional)
@param apply (optional)
@param delete (optional)
@param action (optional)
@param location (optional)
@param path (optional)
@param serviceRanking (optional)
@param idpUrl (optional)
@param idpCertAlias (optional)
@param idpHttpRedirect (optional)
@param serviceProviderEntityId (optional)
@param assertionConsumerServiceURL (optional)
@param spPrivateKeyAlias (optional)
@param keyStorePassword (optional)
@param defaultRedirectUrl (optional)
@param userIDAttribute (optional)
@param useEncryption (optional)
@param createUser (optional)
@param addGroupMemberships (optional)
@param groupMembershipAttribute (optional)
@param defaultGroups (optional)
@param nameIdFormat (optional)
@param synchronizeAttributes (optional)
@param handleLogout (optional)
@param logoutUrl (optional)
@param clockTolerance (optional)
@param digestMethod (optional)
@param signatureMethod (optional)
@param userIntermediatePath (optional)
@param propertylist (optional)
@param callback The callback to be executed when the API call finishes
@return The request call
@throws ApiException If fail to process the API call, e.g. serializing the request body object | [
"(",
"asynchronously",
")"
] | train | https://github.com/shinesolutions/swagger-aem/blob/ae7da4df93e817dc2bad843779b2069d9c4e7c6b/java/generated/src/main/java/com/shinesolutions/swaggeraem4j/api/ConsoleApi.java#L585-L610 |
threerings/narya | core/src/main/java/com/threerings/presents/client/ClientDObjectMgr.java | ClientDObjectMgr.notifyFailure | protected void notifyFailure (int oid, String message)
{
// let the penders know that the object is not available
PendingRequest<?> req = _penders.remove(oid);
if (req == null) {
log.warning("Failed to get object, but no one cares?!", "oid", oid);
return;
}
for (int ii = 0; ii < req.targets.size(); ii++) {
req.targets.get(ii).requestFailed(oid, new ObjectAccessException(message));
}
} | java | protected void notifyFailure (int oid, String message)
{
// let the penders know that the object is not available
PendingRequest<?> req = _penders.remove(oid);
if (req == null) {
log.warning("Failed to get object, but no one cares?!", "oid", oid);
return;
}
for (int ii = 0; ii < req.targets.size(); ii++) {
req.targets.get(ii).requestFailed(oid, new ObjectAccessException(message));
}
} | [
"protected",
"void",
"notifyFailure",
"(",
"int",
"oid",
",",
"String",
"message",
")",
"{",
"// let the penders know that the object is not available",
"PendingRequest",
"<",
"?",
">",
"req",
"=",
"_penders",
".",
"remove",
"(",
"oid",
")",
";",
"if",
"(",
"req... | Notifies the subscribers that had requested this object (for subscription) that it is not
available. | [
"Notifies",
"the",
"subscribers",
"that",
"had",
"requested",
"this",
"object",
"(",
"for",
"subscription",
")",
"that",
"it",
"is",
"not",
"available",
"."
] | train | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/client/ClientDObjectMgr.java#L379-L391 |
lessthanoptimal/BoofCV | main/boofcv-recognition/src/main/java/boofcv/abst/fiducial/SquareImage_to_FiducialDetector.java | SquareImage_to_FiducialDetector.addPatternImage | public void addPatternImage(T pattern, double threshold, double lengthSide) {
GrayU8 binary = new GrayU8(pattern.width,pattern.height);
GThresholdImageOps.threshold(pattern,binary,threshold,false);
alg.addPattern(binary, lengthSide);
} | java | public void addPatternImage(T pattern, double threshold, double lengthSide) {
GrayU8 binary = new GrayU8(pattern.width,pattern.height);
GThresholdImageOps.threshold(pattern,binary,threshold,false);
alg.addPattern(binary, lengthSide);
} | [
"public",
"void",
"addPatternImage",
"(",
"T",
"pattern",
",",
"double",
"threshold",
",",
"double",
"lengthSide",
")",
"{",
"GrayU8",
"binary",
"=",
"new",
"GrayU8",
"(",
"pattern",
".",
"width",
",",
"pattern",
".",
"height",
")",
";",
"GThresholdImageOps"... | Add a new pattern to be detected. This function takes in a raw gray scale image and thresholds it.
@param pattern Gray scale image of the pattern
@param threshold Threshold used to convert it into a binary image
@param lengthSide Length of a side on the square in world units. | [
"Add",
"a",
"new",
"pattern",
"to",
"be",
"detected",
".",
"This",
"function",
"takes",
"in",
"a",
"raw",
"gray",
"scale",
"image",
"and",
"thresholds",
"it",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/abst/fiducial/SquareImage_to_FiducialDetector.java#L48-L52 |
atomix/atomix | protocols/raft/src/main/java/io/atomix/protocols/raft/roles/ActiveRole.java | ActiveRole.isLogUpToDate | boolean isLogUpToDate(long lastIndex, long lastTerm, RaftRequest request) {
// Read the last entry from the log.
final Indexed<RaftLogEntry> lastEntry = raft.getLogWriter().getLastEntry();
// If the log is empty then vote for the candidate.
if (lastEntry == null) {
log.debug("Accepted {}: candidate's log is up-to-date", request);
return true;
}
// If the candidate's last log term is lower than the local log's last entry term, reject the request.
if (lastTerm < lastEntry.entry().term()) {
log.debug("Rejected {}: candidate's last log entry ({}) is at a lower term than the local log ({})", request, lastTerm, lastEntry.entry().term());
return false;
}
// If the candidate's last term is equal to the local log's last entry term, reject the request if the
// candidate's last index is less than the local log's last index. If the candidate's last log term is
// greater than the local log's last term then it's considered up to date, and if both have the same term
// then the candidate's last index must be greater than the local log's last index.
if (lastTerm == lastEntry.entry().term() && lastIndex < lastEntry.index()) {
log.debug("Rejected {}: candidate's last log entry ({}) is at a lower index than the local log ({})", request, lastIndex, lastEntry.index());
return false;
}
// If we made it this far, the candidate's last term is greater than or equal to the local log's last
// term, and if equal to the local log's last term, the candidate's last index is equal to or greater
// than the local log's last index.
log.debug("Accepted {}: candidate's log is up-to-date", request);
return true;
} | java | boolean isLogUpToDate(long lastIndex, long lastTerm, RaftRequest request) {
// Read the last entry from the log.
final Indexed<RaftLogEntry> lastEntry = raft.getLogWriter().getLastEntry();
// If the log is empty then vote for the candidate.
if (lastEntry == null) {
log.debug("Accepted {}: candidate's log is up-to-date", request);
return true;
}
// If the candidate's last log term is lower than the local log's last entry term, reject the request.
if (lastTerm < lastEntry.entry().term()) {
log.debug("Rejected {}: candidate's last log entry ({}) is at a lower term than the local log ({})", request, lastTerm, lastEntry.entry().term());
return false;
}
// If the candidate's last term is equal to the local log's last entry term, reject the request if the
// candidate's last index is less than the local log's last index. If the candidate's last log term is
// greater than the local log's last term then it's considered up to date, and if both have the same term
// then the candidate's last index must be greater than the local log's last index.
if (lastTerm == lastEntry.entry().term() && lastIndex < lastEntry.index()) {
log.debug("Rejected {}: candidate's last log entry ({}) is at a lower index than the local log ({})", request, lastIndex, lastEntry.index());
return false;
}
// If we made it this far, the candidate's last term is greater than or equal to the local log's last
// term, and if equal to the local log's last term, the candidate's last index is equal to or greater
// than the local log's last index.
log.debug("Accepted {}: candidate's log is up-to-date", request);
return true;
} | [
"boolean",
"isLogUpToDate",
"(",
"long",
"lastIndex",
",",
"long",
"lastTerm",
",",
"RaftRequest",
"request",
")",
"{",
"// Read the last entry from the log.",
"final",
"Indexed",
"<",
"RaftLogEntry",
">",
"lastEntry",
"=",
"raft",
".",
"getLogWriter",
"(",
")",
"... | Returns a boolean value indicating whether the given candidate's log is up-to-date. | [
"Returns",
"a",
"boolean",
"value",
"indicating",
"whether",
"the",
"given",
"candidate",
"s",
"log",
"is",
"up",
"-",
"to",
"-",
"date",
"."
] | train | https://github.com/atomix/atomix/blob/3a94b7c80576d762dd0d396d4645df07a0b37c31/protocols/raft/src/main/java/io/atomix/protocols/raft/roles/ActiveRole.java#L190-L220 |
FXMisc/Flowless | src/main/java/org/fxmisc/flowless/CellListManager.java | CellListManager.cropTo | public void cropTo(int fromItem, int toItem) {
fromItem = Math.max(fromItem, 0);
toItem = Math.min(toItem, cells.size());
cells.forget(0, fromItem);
cells.forget(toItem, cells.size());
} | java | public void cropTo(int fromItem, int toItem) {
fromItem = Math.max(fromItem, 0);
toItem = Math.min(toItem, cells.size());
cells.forget(0, fromItem);
cells.forget(toItem, cells.size());
} | [
"public",
"void",
"cropTo",
"(",
"int",
"fromItem",
",",
"int",
"toItem",
")",
"{",
"fromItem",
"=",
"Math",
".",
"max",
"(",
"fromItem",
",",
"0",
")",
";",
"toItem",
"=",
"Math",
".",
"min",
"(",
"toItem",
",",
"cells",
".",
"size",
"(",
")",
"... | Updates the list of cells to display
@param fromItem the index of the first item to display
@param toItem the index of the last item to display | [
"Updates",
"the",
"list",
"of",
"cells",
"to",
"display"
] | train | https://github.com/FXMisc/Flowless/blob/dce2269ebafed8f79203d00085af41f06f3083bc/src/main/java/org/fxmisc/flowless/CellListManager.java#L82-L87 |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/config/xml/SchemaRepositoryParser.java | SchemaRepositoryParser.registerJsonSchemaRepository | private void registerJsonSchemaRepository(Element element, ParserContext parserContext) {
BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(JsonSchemaRepository.class);
addLocationsToBuilder(element, builder);
parseSchemasElement(element, builder, parserContext);
parserContext.getRegistry().registerBeanDefinition(element.getAttribute(ID), builder.getBeanDefinition());
} | java | private void registerJsonSchemaRepository(Element element, ParserContext parserContext) {
BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(JsonSchemaRepository.class);
addLocationsToBuilder(element, builder);
parseSchemasElement(element, builder, parserContext);
parserContext.getRegistry().registerBeanDefinition(element.getAttribute(ID), builder.getBeanDefinition());
} | [
"private",
"void",
"registerJsonSchemaRepository",
"(",
"Element",
"element",
",",
"ParserContext",
"parserContext",
")",
"{",
"BeanDefinitionBuilder",
"builder",
"=",
"BeanDefinitionBuilder",
".",
"genericBeanDefinition",
"(",
"JsonSchemaRepository",
".",
"class",
")",
"... | Registers a JsonSchemaRepository definition in the parser context
@param element The element to be converted into a JsonSchemaRepository definition
@param parserContext The parser context to add the definitions to | [
"Registers",
"a",
"JsonSchemaRepository",
"definition",
"in",
"the",
"parser",
"context"
] | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/config/xml/SchemaRepositoryParser.java#L69-L74 |
zeroturnaround/zt-zip | src/main/java/org/zeroturnaround/zip/Zips.java | Zips.process | public void process() {
if (src == null && dest == null) {
throw new IllegalArgumentException("Source and destination shouldn't be null together");
}
File destinationFile = null;
try {
destinationFile = getDestinationFile();
ZipOutputStream out = null;
ZipEntryOrInfoAdapter zipEntryAdapter = null;
if (destinationFile.isFile()) {
out = ZipFileUtil.createZipOutputStream(new BufferedOutputStream(new FileOutputStream(destinationFile)), charset);
zipEntryAdapter = new ZipEntryOrInfoAdapter(new CopyingCallback(transformers, out, preserveTimestamps), null);
}
else { // directory
zipEntryAdapter = new ZipEntryOrInfoAdapter(new UnpackingCallback(transformers, destinationFile), null);
}
try {
processAllEntries(zipEntryAdapter);
}
finally {
IOUtils.closeQuietly(out);
}
handleInPlaceActions(destinationFile);
}
catch (IOException e) {
ZipExceptionUtil.rethrow(e);
}
finally {
if (isInPlace()) {
// destinationZip is a temporary file
FileUtils.deleteQuietly(destinationFile);
}
}
} | java | public void process() {
if (src == null && dest == null) {
throw new IllegalArgumentException("Source and destination shouldn't be null together");
}
File destinationFile = null;
try {
destinationFile = getDestinationFile();
ZipOutputStream out = null;
ZipEntryOrInfoAdapter zipEntryAdapter = null;
if (destinationFile.isFile()) {
out = ZipFileUtil.createZipOutputStream(new BufferedOutputStream(new FileOutputStream(destinationFile)), charset);
zipEntryAdapter = new ZipEntryOrInfoAdapter(new CopyingCallback(transformers, out, preserveTimestamps), null);
}
else { // directory
zipEntryAdapter = new ZipEntryOrInfoAdapter(new UnpackingCallback(transformers, destinationFile), null);
}
try {
processAllEntries(zipEntryAdapter);
}
finally {
IOUtils.closeQuietly(out);
}
handleInPlaceActions(destinationFile);
}
catch (IOException e) {
ZipExceptionUtil.rethrow(e);
}
finally {
if (isInPlace()) {
// destinationZip is a temporary file
FileUtils.deleteQuietly(destinationFile);
}
}
} | [
"public",
"void",
"process",
"(",
")",
"{",
"if",
"(",
"src",
"==",
"null",
"&&",
"dest",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Source and destination shouldn't be null together\"",
")",
";",
"}",
"File",
"destinationFile",
... | Iterates through source Zip entries removing or changing them according to
set parameters. | [
"Iterates",
"through",
"source",
"Zip",
"entries",
"removing",
"or",
"changing",
"them",
"according",
"to",
"set",
"parameters",
"."
] | train | https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/Zips.java#L345-L380 |
Impetus/Kundera | src/kundera-hbase/kundera-hbase-v2/src/main/java/com/impetus/client/hbase/schemamanager/HBaseSchemaManager.java | HBaseSchemaManager.isNamespaceAvailable | private boolean isNamespaceAvailable(String databaseName)
{
try
{
for (NamespaceDescriptor ns : admin.listNamespaceDescriptors())
{
if (ns.getName().equals(databaseName))
{
return true;
}
}
return false;
}
catch (IOException ioex)
{
logger.error("Either table isn't in enabled state or some network problem, Caused by: ", ioex);
throw new SchemaGenerationException(ioex, "Either table isn't in enabled state or some network problem.");
}
} | java | private boolean isNamespaceAvailable(String databaseName)
{
try
{
for (NamespaceDescriptor ns : admin.listNamespaceDescriptors())
{
if (ns.getName().equals(databaseName))
{
return true;
}
}
return false;
}
catch (IOException ioex)
{
logger.error("Either table isn't in enabled state or some network problem, Caused by: ", ioex);
throw new SchemaGenerationException(ioex, "Either table isn't in enabled state or some network problem.");
}
} | [
"private",
"boolean",
"isNamespaceAvailable",
"(",
"String",
"databaseName",
")",
"{",
"try",
"{",
"for",
"(",
"NamespaceDescriptor",
"ns",
":",
"admin",
".",
"listNamespaceDescriptors",
"(",
")",
")",
"{",
"if",
"(",
"ns",
".",
"getName",
"(",
")",
".",
"... | Checks if is namespace available.
@param databaseName
the database name
@return true, if is namespace available | [
"Checks",
"if",
"is",
"namespace",
"available",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-hbase/kundera-hbase-v2/src/main/java/com/impetus/client/hbase/schemamanager/HBaseSchemaManager.java#L428-L446 |
RallyTools/RallyRestToolkitForJava | src/main/java/com/rallydev/rest/RallyRestApi.java | RallyRestApi.setProxy | public void setProxy(URI proxy, String userName, String password) {
client.setProxy(proxy, userName, password);
} | java | public void setProxy(URI proxy, String userName, String password) {
client.setProxy(proxy, userName, password);
} | [
"public",
"void",
"setProxy",
"(",
"URI",
"proxy",
",",
"String",
"userName",
",",
"String",
"password",
")",
"{",
"client",
".",
"setProxy",
"(",
"proxy",
",",
"userName",
",",
"password",
")",
";",
"}"
] | Set the authenticated proxy server to use. By default no proxy is configured.
@param proxy The proxy server, e.g. {@code new URI("http://my.proxy.com:8000")}
@param userName The username to be used for authentication.
@param password The password to be used for authentication. | [
"Set",
"the",
"authenticated",
"proxy",
"server",
"to",
"use",
".",
"By",
"default",
"no",
"proxy",
"is",
"configured",
"."
] | train | https://github.com/RallyTools/RallyRestToolkitForJava/blob/542afa16ea44c9c64cebb0299500dcbbb50b6d7d/src/main/java/com/rallydev/rest/RallyRestApi.java#L64-L66 |
kohsuke/args4j | args4j/src/org/kohsuke/args4j/CmdLineParser.java | CmdLineParser.printUsage | public void printUsage(Writer out, ResourceBundle rb) {
printUsage(out, rb, OptionHandlerFilter.PUBLIC);
} | java | public void printUsage(Writer out, ResourceBundle rb) {
printUsage(out, rb, OptionHandlerFilter.PUBLIC);
} | [
"public",
"void",
"printUsage",
"(",
"Writer",
"out",
",",
"ResourceBundle",
"rb",
")",
"{",
"printUsage",
"(",
"out",
",",
"rb",
",",
"OptionHandlerFilter",
".",
"PUBLIC",
")",
";",
"}"
] | Prints the list of all the non-hidden options and their usages to the screen.
<p>
Short for {@code printUsage(out,rb,OptionHandlerFilter.PUBLIC)} | [
"Prints",
"the",
"list",
"of",
"all",
"the",
"non",
"-",
"hidden",
"options",
"and",
"their",
"usages",
"to",
"the",
"screen",
"."
] | train | https://github.com/kohsuke/args4j/blob/dc2e7e265caf15a1a146e3389c1f16a8781f06cf/args4j/src/org/kohsuke/args4j/CmdLineParser.java#L272-L274 |
js-lib-com/commons | src/main/java/js/util/Strings.java | Strings.save | public static void save(CharSequence chars, File file) throws IOException
{
save(chars, new FileWriter(Files.mkdirs(file)));
} | java | public static void save(CharSequence chars, File file) throws IOException
{
save(chars, new FileWriter(Files.mkdirs(file)));
} | [
"public",
"static",
"void",
"save",
"(",
"CharSequence",
"chars",
",",
"File",
"file",
")",
"throws",
"IOException",
"{",
"save",
"(",
"chars",
",",
"new",
"FileWriter",
"(",
"Files",
".",
"mkdirs",
"(",
"file",
")",
")",
")",
";",
"}"
] | Create target file and copy characters into. Copy destination should be a file and this method throws access denied
if attempt to write to a directory. This method creates target file if it does not already exist. If target file
does exist it will be overwritten and old content lost. If given <code>chars</code> parameter is null or empty this
method does nothing.
<p>
Note that this method takes care to create file parent directories.
@param chars source characters sequence,
@param file target file.
@throws FileNotFoundException if <code>target</code> file does not exist and cannot be created.
@throws IOException if copy operation fails, including if <code>target</code> is a directory. | [
"Create",
"target",
"file",
"and",
"copy",
"characters",
"into",
".",
"Copy",
"destination",
"should",
"be",
"a",
"file",
"and",
"this",
"method",
"throws",
"access",
"denied",
"if",
"attempt",
"to",
"write",
"to",
"a",
"directory",
".",
"This",
"method",
... | train | https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Strings.java#L1496-L1499 |
apache/incubator-druid | core/src/main/java/org/apache/druid/concurrent/ConcurrentAwaitableCounter.java | ConcurrentAwaitableCounter.awaitFirstIncrement | public boolean awaitFirstIncrement(long timeout, TimeUnit unit) throws InterruptedException
{
return sync.tryAcquireSharedNanos(0, unit.toNanos(timeout));
} | java | public boolean awaitFirstIncrement(long timeout, TimeUnit unit) throws InterruptedException
{
return sync.tryAcquireSharedNanos(0, unit.toNanos(timeout));
} | [
"public",
"boolean",
"awaitFirstIncrement",
"(",
"long",
"timeout",
",",
"TimeUnit",
"unit",
")",
"throws",
"InterruptedException",
"{",
"return",
"sync",
".",
"tryAcquireSharedNanos",
"(",
"0",
",",
"unit",
".",
"toNanos",
"(",
"timeout",
")",
")",
";",
"}"
] | The difference between this method and {@link #awaitCount(long, long, TimeUnit)} with argument 1 is that {@code
awaitFirstIncrement()} returns boolean designating whether the count was await (while waiting for no longer than
for the specified period of time), while {@code awaitCount()} throws {@link TimeoutException} if the count was not
awaited. | [
"The",
"difference",
"between",
"this",
"method",
"and",
"{"
] | train | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/core/src/main/java/org/apache/druid/concurrent/ConcurrentAwaitableCounter.java#L162-L165 |
alkacon/opencms-core | src/org/opencms/ui/login/CmsLoginController.java | CmsLoginController.displayError | private void displayError(String message, boolean showForgotPassword, boolean showTime) {
message = message.replace("\n", "<br />");
if (showForgotPassword) {
message += "<br /><br /><a href=\""
+ getResetPasswordLink()
+ "\">"
+ CmsVaadinUtils.getMessageText(Messages.GUI_FORGOT_PASSWORD_0)
+ "</a>";
}
if (showTime) {
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
message += "<div style=\"position:absolute;right:6px;bottom:5px;\">"
+ CmsVaadinUtils.getMessageText(Messages.GUI_TIME_1, sdf.format(new Date()))
+ "</div>";
}
m_ui.showLoginError(message);
} | java | private void displayError(String message, boolean showForgotPassword, boolean showTime) {
message = message.replace("\n", "<br />");
if (showForgotPassword) {
message += "<br /><br /><a href=\""
+ getResetPasswordLink()
+ "\">"
+ CmsVaadinUtils.getMessageText(Messages.GUI_FORGOT_PASSWORD_0)
+ "</a>";
}
if (showTime) {
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
message += "<div style=\"position:absolute;right:6px;bottom:5px;\">"
+ CmsVaadinUtils.getMessageText(Messages.GUI_TIME_1, sdf.format(new Date()))
+ "</div>";
}
m_ui.showLoginError(message);
} | [
"private",
"void",
"displayError",
"(",
"String",
"message",
",",
"boolean",
"showForgotPassword",
",",
"boolean",
"showTime",
")",
"{",
"message",
"=",
"message",
".",
"replace",
"(",
"\"\\n\"",
",",
"\"<br />\"",
")",
";",
"if",
"(",
"showForgotPassword",
")... | Displays the given error message.<p>
@param message the message
@param showForgotPassword in case the forgot password link should be shown
@param showTime show the time | [
"Displays",
"the",
"given",
"error",
"message",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/login/CmsLoginController.java#L732-L749 |
MorphiaOrg/morphia | morphia/src/main/java/dev/morphia/mapping/Mapper.java | Mapper.addMappedClass | public MappedClass addMappedClass(final Class c) {
MappedClass mappedClass = mappedClasses.get(c.getName());
if (mappedClass == null) {
mappedClass = new MappedClass(c, this);
return addMappedClass(mappedClass, true);
}
return mappedClass;
} | java | public MappedClass addMappedClass(final Class c) {
MappedClass mappedClass = mappedClasses.get(c.getName());
if (mappedClass == null) {
mappedClass = new MappedClass(c, this);
return addMappedClass(mappedClass, true);
}
return mappedClass;
} | [
"public",
"MappedClass",
"addMappedClass",
"(",
"final",
"Class",
"c",
")",
"{",
"MappedClass",
"mappedClass",
"=",
"mappedClasses",
".",
"get",
"(",
"c",
".",
"getName",
"(",
")",
")",
";",
"if",
"(",
"mappedClass",
"==",
"null",
")",
"{",
"mappedClass",
... | Creates a MappedClass and validates it.
@param c the Class to map
@return the MappedClass for the given Class | [
"Creates",
"a",
"MappedClass",
"and",
"validates",
"it",
"."
] | train | https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/dev/morphia/mapping/Mapper.java#L168-L176 |
xwiki/xwiki-commons | xwiki-commons-core/xwiki-commons-velocity/src/main/java/org/xwiki/velocity/tools/nio/NIOTool.java | NIOTool.getAttribute | public Object getAttribute(Path path, String attribute, LinkOption... options)
{
try {
return Files.getAttribute(path, attribute, options);
} catch (IOException e) {
return null;
}
} | java | public Object getAttribute(Path path, String attribute, LinkOption... options)
{
try {
return Files.getAttribute(path, attribute, options);
} catch (IOException e) {
return null;
}
} | [
"public",
"Object",
"getAttribute",
"(",
"Path",
"path",
",",
"String",
"attribute",
",",
"LinkOption",
"...",
"options",
")",
"{",
"try",
"{",
"return",
"Files",
".",
"getAttribute",
"(",
"path",
",",
"attribute",
",",
"options",
")",
";",
"}",
"catch",
... | See {@link Files#getAttribute(Path, String, LinkOption...)}.
@param path See {@link Files#getAttribute(Path, String, LinkOption...)}
@param attribute See {@link Files#getAttribute(Path, String, LinkOption...)}
@param options See {@link Files#getAttribute(Path, String, LinkOption...)}
@return See {@link Files#getAttribute(Path, String, LinkOption...)} | [
"See",
"{",
"@link",
"Files#getAttribute",
"(",
"Path",
"String",
"LinkOption",
"...",
")",
"}",
"."
] | train | https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-velocity/src/main/java/org/xwiki/velocity/tools/nio/NIOTool.java#L229-L236 |
joniles/mpxj | src/main/java/net/sf/mpxj/primavera/common/AbstractIntColumn.java | AbstractIntColumn.readInt | public int readInt(int offset, byte[] data)
{
int result = 0;
int i = offset + m_offset;
for (int shiftBy = 0; shiftBy < 32; shiftBy += 8)
{
result |= ((data[i] & 0xff)) << shiftBy;
++i;
}
return result;
} | java | public int readInt(int offset, byte[] data)
{
int result = 0;
int i = offset + m_offset;
for (int shiftBy = 0; shiftBy < 32; shiftBy += 8)
{
result |= ((data[i] & 0xff)) << shiftBy;
++i;
}
return result;
} | [
"public",
"int",
"readInt",
"(",
"int",
"offset",
",",
"byte",
"[",
"]",
"data",
")",
"{",
"int",
"result",
"=",
"0",
";",
"int",
"i",
"=",
"offset",
"+",
"m_offset",
";",
"for",
"(",
"int",
"shiftBy",
"=",
"0",
";",
"shiftBy",
"<",
"32",
";",
... | Read a four byte integer from the data.
@param offset current offset into data block
@param data data block
@return int value | [
"Read",
"a",
"four",
"byte",
"integer",
"from",
"the",
"data",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/common/AbstractIntColumn.java#L49-L59 |
tuenti/ButtonMenu | library/src/main/java/com/tuenti/buttonmenu/animator/ScrollAnimator.java | ScrollAnimator.configureListView | public void configureListView(ListView listView) {
this.listView = listView;
this.listView.setOnScrollListener(new OnScrollListener() {
int scrollPosition;
@Override
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
notifyScrollToAdditionalScrollListener(view, firstVisibleItem, visibleItemCount, totalItemCount);
View topChild = view.getChildAt(0);
int newScrollPosition;
if (topChild == null) {
newScrollPosition = 0;
} else {
newScrollPosition = view.getFirstVisiblePosition() * topChild.getHeight() - topChild.getTop();
}
if (Math.abs(newScrollPosition - scrollPosition) >= SCROLL_DIRECTION_CHANGE_THRESHOLD) {
onScrollPositionChanged(scrollPosition, newScrollPosition);
}
scrollPosition = newScrollPosition;
}
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
notifyScrollStateChangedToAdditionalScrollListener(view, scrollState);
}
});
} | java | public void configureListView(ListView listView) {
this.listView = listView;
this.listView.setOnScrollListener(new OnScrollListener() {
int scrollPosition;
@Override
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
notifyScrollToAdditionalScrollListener(view, firstVisibleItem, visibleItemCount, totalItemCount);
View topChild = view.getChildAt(0);
int newScrollPosition;
if (topChild == null) {
newScrollPosition = 0;
} else {
newScrollPosition = view.getFirstVisiblePosition() * topChild.getHeight() - topChild.getTop();
}
if (Math.abs(newScrollPosition - scrollPosition) >= SCROLL_DIRECTION_CHANGE_THRESHOLD) {
onScrollPositionChanged(scrollPosition, newScrollPosition);
}
scrollPosition = newScrollPosition;
}
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
notifyScrollStateChangedToAdditionalScrollListener(view, scrollState);
}
});
} | [
"public",
"void",
"configureListView",
"(",
"ListView",
"listView",
")",
"{",
"this",
".",
"listView",
"=",
"listView",
";",
"this",
".",
"listView",
".",
"setOnScrollListener",
"(",
"new",
"OnScrollListener",
"(",
")",
"{",
"int",
"scrollPosition",
";",
"@",
... | Associate a ListView to listen in order to perform the "translationY" animation when the ListView scroll is
updated. This method is going to set a "OnScrollListener" to the ListView passed as argument.
@param listView to listen. | [
"Associate",
"a",
"ListView",
"to",
"listen",
"in",
"order",
"to",
"perform",
"the",
"translationY",
"animation",
"when",
"the",
"ListView",
"scroll",
"is",
"updated",
".",
"This",
"method",
"is",
"going",
"to",
"set",
"a",
"OnScrollListener",
"to",
"the",
"... | train | https://github.com/tuenti/ButtonMenu/blob/95791383f6f976933496542b54e8c6dbdd73e669/library/src/main/java/com/tuenti/buttonmenu/animator/ScrollAnimator.java#L71-L101 |
liferay/com-liferay-commerce | commerce-price-list-service/src/main/java/com/liferay/commerce/price/list/service/persistence/impl/CommercePriceListPersistenceImpl.java | CommercePriceListPersistenceImpl.fetchByC_ERC | @Override
public CommercePriceList fetchByC_ERC(long companyId,
String externalReferenceCode) {
return fetchByC_ERC(companyId, externalReferenceCode, true);
} | java | @Override
public CommercePriceList fetchByC_ERC(long companyId,
String externalReferenceCode) {
return fetchByC_ERC(companyId, externalReferenceCode, true);
} | [
"@",
"Override",
"public",
"CommercePriceList",
"fetchByC_ERC",
"(",
"long",
"companyId",
",",
"String",
"externalReferenceCode",
")",
"{",
"return",
"fetchByC_ERC",
"(",
"companyId",
",",
"externalReferenceCode",
",",
"true",
")",
";",
"}"
] | Returns the commerce price list where companyId = ? and externalReferenceCode = ? or returns <code>null</code> if it could not be found. Uses the finder cache.
@param companyId the company ID
@param externalReferenceCode the external reference code
@return the matching commerce price list, or <code>null</code> if a matching commerce price list could not be found | [
"Returns",
"the",
"commerce",
"price",
"list",
"where",
"companyId",
"=",
"?",
";",
"and",
"externalReferenceCode",
"=",
"?",
";",
"or",
"returns",
"<code",
">",
"null<",
"/",
"code",
">",
"if",
"it",
"could",
"not",
"be",
"found",
".",
"Uses",
"th... | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-price-list-service/src/main/java/com/liferay/commerce/price/list/service/persistence/impl/CommercePriceListPersistenceImpl.java#L4955-L4959 |
aws/aws-sdk-java | aws-java-sdk-api-gateway/src/main/java/com/amazonaws/services/apigateway/model/Stage.java | Stage.withTags | public Stage withTags(java.util.Map<String, String> tags) {
setTags(tags);
return this;
} | java | public Stage withTags(java.util.Map<String, String> tags) {
setTags(tags);
return this;
} | [
"public",
"Stage",
"withTags",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"tags",
")",
"{",
"setTags",
"(",
"tags",
")",
";",
"return",
"this",
";",
"}"
] | <p>
The collection of tags. Each tag element is associated with a given resource.
</p>
@param tags
The collection of tags. Each tag element is associated with a given resource.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"The",
"collection",
"of",
"tags",
".",
"Each",
"tag",
"element",
"is",
"associated",
"with",
"a",
"given",
"resource",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-api-gateway/src/main/java/com/amazonaws/services/apigateway/model/Stage.java#L858-L861 |
centic9/commons-dost | src/main/java/org/dstadler/commons/exec/ExecutionHelper.java | ExecutionHelper.getCommandResult | public static InputStream getCommandResult(
CommandLine cmdLine, File dir, int expectedExit,
long timeout) throws IOException {
return getCommandResult(cmdLine, dir, expectedExit, timeout, null);
} | java | public static InputStream getCommandResult(
CommandLine cmdLine, File dir, int expectedExit,
long timeout) throws IOException {
return getCommandResult(cmdLine, dir, expectedExit, timeout, null);
} | [
"public",
"static",
"InputStream",
"getCommandResult",
"(",
"CommandLine",
"cmdLine",
",",
"File",
"dir",
",",
"int",
"expectedExit",
",",
"long",
"timeout",
")",
"throws",
"IOException",
"{",
"return",
"getCommandResult",
"(",
"cmdLine",
",",
"dir",
",",
"expec... | Run the given commandline in the given directory and verify that the tool
has the expected exit code and does finish in the timeout.
Note: The resulting output is stored in memory, running a command
which prints out a huge amount of data to stdout or stderr will
cause memory problems.
@param cmdLine The commandline object filled with the executable and command line arguments
@param dir The working directory for the command
@param expectedExit The expected exit value or -1 to not fail on any exit value
@param timeout The timeout in milliseconds or ExecuteWatchdog.INFINITE_TIMEOUT
@return An InputStream which provides the output of the command.
@throws IOException Execution of sub-process failed or the
sub-process returned a exit value indicating a failure | [
"Run",
"the",
"given",
"commandline",
"in",
"the",
"given",
"directory",
"and",
"verify",
"that",
"the",
"tool",
"has",
"the",
"expected",
"exit",
"code",
"and",
"does",
"finish",
"in",
"the",
"timeout",
"."
] | train | https://github.com/centic9/commons-dost/blob/f6fa4e3e0b943ff103f918824319d8abf33d0e0f/src/main/java/org/dstadler/commons/exec/ExecutionHelper.java#L46-L50 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/map/impl/MapKeyLoader.java | MapKeyLoader.calculateRole | private Role calculateRole() {
boolean isPartitionOwner = partitionService.isPartitionOwner(partitionId);
boolean isMapNamePartition = partitionId == mapNamePartition;
boolean isMapNamePartitionFirstReplica = false;
if (hasBackup && isMapNamePartition) {
IPartition partition = partitionService.getPartition(partitionId);
Address firstReplicaAddress = partition.getReplicaAddress(1);
Member member = clusterService.getMember(firstReplicaAddress);
if (member != null) {
isMapNamePartitionFirstReplica = member.localMember();
}
}
return assignRole(isPartitionOwner, isMapNamePartition, isMapNamePartitionFirstReplica);
} | java | private Role calculateRole() {
boolean isPartitionOwner = partitionService.isPartitionOwner(partitionId);
boolean isMapNamePartition = partitionId == mapNamePartition;
boolean isMapNamePartitionFirstReplica = false;
if (hasBackup && isMapNamePartition) {
IPartition partition = partitionService.getPartition(partitionId);
Address firstReplicaAddress = partition.getReplicaAddress(1);
Member member = clusterService.getMember(firstReplicaAddress);
if (member != null) {
isMapNamePartitionFirstReplica = member.localMember();
}
}
return assignRole(isPartitionOwner, isMapNamePartition, isMapNamePartitionFirstReplica);
} | [
"private",
"Role",
"calculateRole",
"(",
")",
"{",
"boolean",
"isPartitionOwner",
"=",
"partitionService",
".",
"isPartitionOwner",
"(",
"partitionId",
")",
";",
"boolean",
"isMapNamePartition",
"=",
"partitionId",
"==",
"mapNamePartition",
";",
"boolean",
"isMapNameP... | Calculates and returns the role for the map key loader on this partition | [
"Calculates",
"and",
"returns",
"the",
"role",
"for",
"the",
"map",
"key",
"loader",
"on",
"this",
"partition"
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/map/impl/MapKeyLoader.java#L210-L223 |
asterisk-java/asterisk-java | src/main/java/org/asteriskjava/pbx/internal/core/ChannelImpl.java | ChannelImpl.notifyHangupListeners | @Override
public void notifyHangupListeners(Integer cause, String causeText)
{
this._isLive = false;
if (this.hangupListener != null)
{
this.hangupListener.channelHangup(this, cause, causeText);
}
else
{
logger.warn("Hangup listener is null");
}
} | java | @Override
public void notifyHangupListeners(Integer cause, String causeText)
{
this._isLive = false;
if (this.hangupListener != null)
{
this.hangupListener.channelHangup(this, cause, causeText);
}
else
{
logger.warn("Hangup listener is null");
}
} | [
"@",
"Override",
"public",
"void",
"notifyHangupListeners",
"(",
"Integer",
"cause",
",",
"String",
"causeText",
")",
"{",
"this",
".",
"_isLive",
"=",
"false",
";",
"if",
"(",
"this",
".",
"hangupListener",
"!=",
"null",
")",
"{",
"this",
".",
"hangupList... | Called by Peer when we have been hungup. This can happen when Peer
receives a HangupEvent or during a periodic sweep done by PeerMonitor to
find the status of all channels. Notify any listeners that this channel
has been hung up. | [
"Called",
"by",
"Peer",
"when",
"we",
"have",
"been",
"hungup",
".",
"This",
"can",
"happen",
"when",
"Peer",
"receives",
"a",
"HangupEvent",
"or",
"during",
"a",
"periodic",
"sweep",
"done",
"by",
"PeerMonitor",
"to",
"find",
"the",
"status",
"of",
"all",... | train | https://github.com/asterisk-java/asterisk-java/blob/cdc9849270d97ef75afa447a02c5194ed29121eb/src/main/java/org/asteriskjava/pbx/internal/core/ChannelImpl.java#L651-L663 |
eclipse/xtext-lib | org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/IterableExtensions.java | IterableExtensions.reject | @GwtIncompatible("Class.isInstance")
@Pure
public static <T> Iterable<T> reject(Iterable<T> unfiltered, Class<?> type) {
return filter(unfiltered, (t) -> !type.isInstance(t));
} | java | @GwtIncompatible("Class.isInstance")
@Pure
public static <T> Iterable<T> reject(Iterable<T> unfiltered, Class<?> type) {
return filter(unfiltered, (t) -> !type.isInstance(t));
} | [
"@",
"GwtIncompatible",
"(",
"\"Class.isInstance\"",
")",
"@",
"Pure",
"public",
"static",
"<",
"T",
">",
"Iterable",
"<",
"T",
">",
"reject",
"(",
"Iterable",
"<",
"T",
">",
"unfiltered",
",",
"Class",
"<",
"?",
">",
"type",
")",
"{",
"return",
"filte... | Returns the elements of {@code unfiltered} that are not instanceof {@code type}. The resulting iterable's iterator does not
support {@code remove()}. The returned iterable is a view on the original elements. Changes in the unfiltered
original are reflected in the view.
@param unfiltered
the unfiltered iterable. May not be <code>null</code>.
@param type
the type of elements undesired. May not be <code>null</code>.
@return an iterable that contains only the elements that are not instances of {@code type}. Never <code>null</code>.
Note that the elements of the iterable can be null as null is an instance of nothing.
@since 2.15 | [
"Returns",
"the",
"elements",
"of",
"{",
"@code",
"unfiltered",
"}",
"that",
"are",
"not",
"instanceof",
"{",
"@code",
"type",
"}",
".",
"The",
"resulting",
"iterable",
"s",
"iterator",
"does",
"not",
"support",
"{",
"@code",
"remove",
"()",
"}",
".",
"T... | train | https://github.com/eclipse/xtext-lib/blob/7063572e1f1bd713a3aa53bdf3a8dc60e25c169a/org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/IterableExtensions.java#L288-L292 |
nats-io/java-nats | src/main/java/io/nats/client/Nats.java | Nats.credentials | public static AuthHandler credentials(String jwtFile, String nkeyFile) {
return NatsImpl.credentials(jwtFile, nkeyFile);
} | java | public static AuthHandler credentials(String jwtFile, String nkeyFile) {
return NatsImpl.credentials(jwtFile, nkeyFile);
} | [
"public",
"static",
"AuthHandler",
"credentials",
"(",
"String",
"jwtFile",
",",
"String",
"nkeyFile",
")",
"{",
"return",
"NatsImpl",
".",
"credentials",
"(",
"jwtFile",
",",
"nkeyFile",
")",
";",
"}"
] | Create an authhandler from a jwt file and an nkey file. The handler will read the files each time it needs to respond to a request
and clear the memory after. This has a small price, but will only be encountered during connect or reconnect.
@param jwtFile a file containing a user JWT, may or may not contain separators
@param nkeyFile a file containing a user nkey that matches the JWT, may or may not contain separators
@return an authhandler that will use the chain file to load/clear the nkey and jwt as needed | [
"Create",
"an",
"authhandler",
"from",
"a",
"jwt",
"file",
"and",
"an",
"nkey",
"file",
".",
"The",
"handler",
"will",
"read",
"the",
"files",
"each",
"time",
"it",
"needs",
"to",
"respond",
"to",
"a",
"request",
"and",
"clear",
"the",
"memory",
"after",... | train | https://github.com/nats-io/java-nats/blob/5f291048fd30192ba39b3fe2925ecd60aaad6b48/src/main/java/io/nats/client/Nats.java#L212-L214 |
apache/incubator-druid | server/src/main/java/org/apache/druid/discovery/DruidLeaderClient.java | DruidLeaderClient.makeRequest | public Request makeRequest(HttpMethod httpMethod, String urlPath, boolean cached) throws IOException
{
Preconditions.checkState(lifecycleLock.awaitStarted(1, TimeUnit.MILLISECONDS));
return new Request(httpMethod, new URL(StringUtils.format("%s%s", getCurrentKnownLeader(cached), urlPath)));
} | java | public Request makeRequest(HttpMethod httpMethod, String urlPath, boolean cached) throws IOException
{
Preconditions.checkState(lifecycleLock.awaitStarted(1, TimeUnit.MILLISECONDS));
return new Request(httpMethod, new URL(StringUtils.format("%s%s", getCurrentKnownLeader(cached), urlPath)));
} | [
"public",
"Request",
"makeRequest",
"(",
"HttpMethod",
"httpMethod",
",",
"String",
"urlPath",
",",
"boolean",
"cached",
")",
"throws",
"IOException",
"{",
"Preconditions",
".",
"checkState",
"(",
"lifecycleLock",
".",
"awaitStarted",
"(",
"1",
",",
"TimeUnit",
... | Make a Request object aimed at the leader. Throws IOException if the leader cannot be located.
@param cached Uses cached leader if true, else uses the current leader | [
"Make",
"a",
"Request",
"object",
"aimed",
"at",
"the",
"leader",
".",
"Throws",
"IOException",
"if",
"the",
"leader",
"cannot",
"be",
"located",
"."
] | train | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/server/src/main/java/org/apache/druid/discovery/DruidLeaderClient.java#L128-L132 |
apereo/cas | core/cas-server-core-webflow-api/src/main/java/org/apereo/cas/web/flow/configurer/AbstractCasWebflowConfigurer.java | AbstractCasWebflowConfigurer.appendActionsToActionStateExecutionList | public void appendActionsToActionStateExecutionList(final Flow flow, final String actionStateId, final EvaluateAction... actions) {
addActionsToActionStateExecutionListAt(flow, actionStateId, Integer.MAX_VALUE, actions);
} | java | public void appendActionsToActionStateExecutionList(final Flow flow, final String actionStateId, final EvaluateAction... actions) {
addActionsToActionStateExecutionListAt(flow, actionStateId, Integer.MAX_VALUE, actions);
} | [
"public",
"void",
"appendActionsToActionStateExecutionList",
"(",
"final",
"Flow",
"flow",
",",
"final",
"String",
"actionStateId",
",",
"final",
"EvaluateAction",
"...",
"actions",
")",
"{",
"addActionsToActionStateExecutionListAt",
"(",
"flow",
",",
"actionStateId",
"... | Append actions to action state execution list.
@param flow the flow
@param actionStateId the action state id
@param actions the actions | [
"Append",
"actions",
"to",
"action",
"state",
"execution",
"list",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-webflow-api/src/main/java/org/apereo/cas/web/flow/configurer/AbstractCasWebflowConfigurer.java#L844-L846 |
moparisthebest/beehive | beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowUtils.java | PageFlowUtils.getFormBeanName | public static String getFormBeanName( ActionForm formInstance, HttpServletRequest request )
{
return getFormBeanName( formInstance.getClass(), request );
} | java | public static String getFormBeanName( ActionForm formInstance, HttpServletRequest request )
{
return getFormBeanName( formInstance.getClass(), request );
} | [
"public",
"static",
"String",
"getFormBeanName",
"(",
"ActionForm",
"formInstance",
",",
"HttpServletRequest",
"request",
")",
"{",
"return",
"getFormBeanName",
"(",
"formInstance",
".",
"getClass",
"(",
")",
",",
"request",
")",
";",
"}"
] | Get the name for the type of a ActionForm instance. Use a name looked up from
the current Struts module, or, if none is found, create one.
@param formInstance the ActionForm instance whose type will determine the name.
@param request the current HttpServletRequest, which contains a reference to the current Struts module.
@return the name found in the Struts module, or, if none is found, a name that is either:
<ul>
<li>a camel-cased version of the base class name (minus any package or outer-class
qualifiers, or, if that name is already taken,</li>
<li>the full class name, with '.' and '$' replaced by '_'.</li>
</ul> | [
"Get",
"the",
"name",
"for",
"the",
"type",
"of",
"a",
"ActionForm",
"instance",
".",
"Use",
"a",
"name",
"looked",
"up",
"from",
"the",
"current",
"Struts",
"module",
"or",
"if",
"none",
"is",
"found",
"create",
"one",
"."
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowUtils.java#L715-L718 |
liferay/com-liferay-commerce | commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPFriendlyURLEntryPersistenceImpl.java | CPFriendlyURLEntryPersistenceImpl.findAll | @Override
public List<CPFriendlyURLEntry> findAll() {
return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
} | java | @Override
public List<CPFriendlyURLEntry> findAll() {
return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CPFriendlyURLEntry",
">",
"findAll",
"(",
")",
"{",
"return",
"findAll",
"(",
"QueryUtil",
".",
"ALL_POS",
",",
"QueryUtil",
".",
"ALL_POS",
",",
"null",
")",
";",
"}"
] | Returns all the cp friendly url entries.
@return the cp friendly url entries | [
"Returns",
"all",
"the",
"cp",
"friendly",
"url",
"entries",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPFriendlyURLEntryPersistenceImpl.java#L5818-L5821 |
pravega/pravega | common/src/main/java/io/pravega/common/concurrent/Services.java | Services.onStop | public static void onStop(Service service, Runnable terminatedCallback, Consumer<Throwable> failureCallback, Executor executor) {
ShutdownListener listener = new ShutdownListener(terminatedCallback, failureCallback);
service.addListener(listener, executor);
// addListener() will not invoke the callbacks if the service is already in a terminal state. As such, we need to
// manually check for these states after registering the listener and invoke the appropriate callback. The
// ShutdownListener will make sure they are not invoked multiple times.
Service.State state = service.state();
if (state == Service.State.FAILED) {
// We don't care (or know) the state from which we came, so we just pass some random one.
listener.failed(Service.State.FAILED, service.failureCause());
} else if (state == Service.State.TERMINATED) {
listener.terminated(Service.State.TERMINATED);
}
} | java | public static void onStop(Service service, Runnable terminatedCallback, Consumer<Throwable> failureCallback, Executor executor) {
ShutdownListener listener = new ShutdownListener(terminatedCallback, failureCallback);
service.addListener(listener, executor);
// addListener() will not invoke the callbacks if the service is already in a terminal state. As such, we need to
// manually check for these states after registering the listener and invoke the appropriate callback. The
// ShutdownListener will make sure they are not invoked multiple times.
Service.State state = service.state();
if (state == Service.State.FAILED) {
// We don't care (or know) the state from which we came, so we just pass some random one.
listener.failed(Service.State.FAILED, service.failureCause());
} else if (state == Service.State.TERMINATED) {
listener.terminated(Service.State.TERMINATED);
}
} | [
"public",
"static",
"void",
"onStop",
"(",
"Service",
"service",
",",
"Runnable",
"terminatedCallback",
",",
"Consumer",
"<",
"Throwable",
">",
"failureCallback",
",",
"Executor",
"executor",
")",
"{",
"ShutdownListener",
"listener",
"=",
"new",
"ShutdownListener",
... | Attaches the given callbacks which will be invoked when the given Service enters a TERMINATED or FAILED state.
The callbacks are optional and may be invoked synchronously if the Service is already in one of these states.
@param service The Service to attach to.
@param terminatedCallback (Optional) A Runnable that will be invoked if the Service enters a TERMINATED state.
@param failureCallback (Optional) A Runnable that will be invoked if the Service enters a FAILED state.
@param executor An Executor to use for callback invocations. | [
"Attaches",
"the",
"given",
"callbacks",
"which",
"will",
"be",
"invoked",
"when",
"the",
"given",
"Service",
"enters",
"a",
"TERMINATED",
"or",
"FAILED",
"state",
".",
"The",
"callbacks",
"are",
"optional",
"and",
"may",
"be",
"invoked",
"synchronously",
"if"... | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/concurrent/Services.java#L74-L88 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/indexing/NDArrayIndex.java | NDArrayIndex.updateForNewAxes | public static void updateForNewAxes(INDArray arr, INDArrayIndex... indexes) {
int numNewAxes = NDArrayIndex.numNewAxis(indexes);
if (numNewAxes >= 1 && (indexes[0].length() > 1 || indexes[0] instanceof NDArrayIndexAll)) {
List<Long> newShape = new ArrayList<>();
List<Long> newStrides = new ArrayList<>();
int currDimension = 0;
for (int i = 0; i < indexes.length; i++) {
if (indexes[i] instanceof NewAxis) {
newShape.add(1L);
newStrides.add(0L);
} else {
newShape.add(arr.size(currDimension));
newStrides.add(arr.size(currDimension));
currDimension++;
}
}
while (currDimension < arr.rank()) {
newShape.add((long) currDimension);
newStrides.add((long) currDimension);
currDimension++;
}
long[] newShapeArr = Longs.toArray(newShape);
long[] newStrideArr = Longs.toArray(newStrides);
// FIXME: this is wrong, it breaks shapeInfo immutability
arr.setShape(newShapeArr);
arr.setStride(newStrideArr);
} else {
if (numNewAxes > 0) {
long[] newShape = Longs.concat(ArrayUtil.toLongArray(ArrayUtil.nTimes(numNewAxes, 1)), arr.shape());
long[] newStrides = Longs.concat(new long[numNewAxes], arr.stride());
arr.setShape(newShape);
arr.setStride(newStrides);
}
}
} | java | public static void updateForNewAxes(INDArray arr, INDArrayIndex... indexes) {
int numNewAxes = NDArrayIndex.numNewAxis(indexes);
if (numNewAxes >= 1 && (indexes[0].length() > 1 || indexes[0] instanceof NDArrayIndexAll)) {
List<Long> newShape = new ArrayList<>();
List<Long> newStrides = new ArrayList<>();
int currDimension = 0;
for (int i = 0; i < indexes.length; i++) {
if (indexes[i] instanceof NewAxis) {
newShape.add(1L);
newStrides.add(0L);
} else {
newShape.add(arr.size(currDimension));
newStrides.add(arr.size(currDimension));
currDimension++;
}
}
while (currDimension < arr.rank()) {
newShape.add((long) currDimension);
newStrides.add((long) currDimension);
currDimension++;
}
long[] newShapeArr = Longs.toArray(newShape);
long[] newStrideArr = Longs.toArray(newStrides);
// FIXME: this is wrong, it breaks shapeInfo immutability
arr.setShape(newShapeArr);
arr.setStride(newStrideArr);
} else {
if (numNewAxes > 0) {
long[] newShape = Longs.concat(ArrayUtil.toLongArray(ArrayUtil.nTimes(numNewAxes, 1)), arr.shape());
long[] newStrides = Longs.concat(new long[numNewAxes], arr.stride());
arr.setShape(newShape);
arr.setStride(newStrides);
}
}
} | [
"public",
"static",
"void",
"updateForNewAxes",
"(",
"INDArray",
"arr",
",",
"INDArrayIndex",
"...",
"indexes",
")",
"{",
"int",
"numNewAxes",
"=",
"NDArrayIndex",
".",
"numNewAxis",
"(",
"indexes",
")",
";",
"if",
"(",
"numNewAxes",
">=",
"1",
"&&",
"(",
... | Set the shape and stride for
new axes based dimensions
@param arr the array to update
the shape/strides for
@param indexes the indexes to update based on | [
"Set",
"the",
"shape",
"and",
"stride",
"for",
"new",
"axes",
"based",
"dimensions"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/indexing/NDArrayIndex.java#L106-L146 |
Azure/azure-sdk-for-java | sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerAzureADAdministratorsInner.java | ServerAzureADAdministratorsInner.createOrUpdate | public ServerAzureADAdministratorInner createOrUpdate(String resourceGroupName, String serverName, ServerAzureADAdministratorInner properties) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, properties).toBlocking().last().body();
} | java | public ServerAzureADAdministratorInner createOrUpdate(String resourceGroupName, String serverName, ServerAzureADAdministratorInner properties) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, properties).toBlocking().last().body();
} | [
"public",
"ServerAzureADAdministratorInner",
"createOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"ServerAzureADAdministratorInner",
"properties",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"se... | Creates a new Server Active Directory Administrator or updates an existing server Active Directory Administrator.
@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.
@param properties The required parameters for creating or updating an Active Directory Administrator.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the ServerAzureADAdministratorInner object if successful. | [
"Creates",
"a",
"new",
"Server",
"Active",
"Directory",
"Administrator",
"or",
"updates",
"an",
"existing",
"server",
"Active",
"Directory",
"Administrator",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerAzureADAdministratorsInner.java#L97-L99 |
elki-project/elki | elki-core/src/main/java/de/lmu/ifi/dbs/elki/utilities/HandlerList.java | HandlerList.insertHandler | public void insertHandler(Class<?> restrictionClass, H handler) {
// note that the handlers list is kept in a list that is traversed in
// backwards order.
handlers.add(new Pair<Class<?>, H>(restrictionClass, handler));
} | java | public void insertHandler(Class<?> restrictionClass, H handler) {
// note that the handlers list is kept in a list that is traversed in
// backwards order.
handlers.add(new Pair<Class<?>, H>(restrictionClass, handler));
} | [
"public",
"void",
"insertHandler",
"(",
"Class",
"<",
"?",
">",
"restrictionClass",
",",
"H",
"handler",
")",
"{",
"// note that the handlers list is kept in a list that is traversed in",
"// backwards order.",
"handlers",
".",
"add",
"(",
"new",
"Pair",
"<",
"Class",
... | Insert a handler to the beginning of the stack.
@param restrictionClass restriction class
@param handler handler | [
"Insert",
"a",
"handler",
"to",
"the",
"beginning",
"of",
"the",
"stack",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core/src/main/java/de/lmu/ifi/dbs/elki/utilities/HandlerList.java#L51-L55 |
h2oai/h2o-3 | h2o-extensions/xgboost/src/main/java/hex/tree/xgboost/XGBoostModel.java | XGBoostModel.doScoring | final void doScoring(Frame _train, Frame _trainOrig, Frame _valid, Frame _validOrig) {
ModelMetrics mm = makeMetrics(_train, _trainOrig, true, "Metrics reported on training frame");
_output._training_metrics = mm;
_output._scored_train[_output._ntrees].fillFrom(mm);
addModelMetrics(mm);
// Optional validation part
if (_valid!=null) {
mm = makeMetrics(_valid, _validOrig, false, "Metrics reported on validation frame");
_output._validation_metrics = mm;
_output._scored_valid[_output._ntrees].fillFrom(mm);
addModelMetrics(mm);
}
} | java | final void doScoring(Frame _train, Frame _trainOrig, Frame _valid, Frame _validOrig) {
ModelMetrics mm = makeMetrics(_train, _trainOrig, true, "Metrics reported on training frame");
_output._training_metrics = mm;
_output._scored_train[_output._ntrees].fillFrom(mm);
addModelMetrics(mm);
// Optional validation part
if (_valid!=null) {
mm = makeMetrics(_valid, _validOrig, false, "Metrics reported on validation frame");
_output._validation_metrics = mm;
_output._scored_valid[_output._ntrees].fillFrom(mm);
addModelMetrics(mm);
}
} | [
"final",
"void",
"doScoring",
"(",
"Frame",
"_train",
",",
"Frame",
"_trainOrig",
",",
"Frame",
"_valid",
",",
"Frame",
"_validOrig",
")",
"{",
"ModelMetrics",
"mm",
"=",
"makeMetrics",
"(",
"_train",
",",
"_trainOrig",
",",
"true",
",",
"\"Metrics reported on... | Score an XGBoost model on training and validation data (optional)
Note: every row is scored, all observation weights are assumed to be equal
@param _train training data in the form of matrix
@param _valid validation data (optional, can be null) | [
"Score",
"an",
"XGBoost",
"model",
"on",
"training",
"and",
"validation",
"data",
"(",
"optional",
")",
"Note",
":",
"every",
"row",
"is",
"scored",
"all",
"observation",
"weights",
"are",
"assumed",
"to",
"be",
"equal"
] | train | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-extensions/xgboost/src/main/java/hex/tree/xgboost/XGBoostModel.java#L398-L410 |
relayrides/pushy | pushy/src/main/java/com/turo/pushy/apns/server/BaseHttp2ServerBuilder.java | BaseHttp2ServerBuilder.setServerCredentials | public BaseHttp2ServerBuilder setServerCredentials(final File certificatePemFile, final File privateKeyPkcs8File, final String privateKeyPassword) {
this.certificateChain = null;
this.privateKey = null;
this.certificateChainPemFile = certificatePemFile;
this.privateKeyPkcs8File = privateKeyPkcs8File;
this.certificateChainInputStream = null;
this.privateKeyPkcs8InputStream = null;
this.privateKeyPassword = privateKeyPassword;
return this;
} | java | public BaseHttp2ServerBuilder setServerCredentials(final File certificatePemFile, final File privateKeyPkcs8File, final String privateKeyPassword) {
this.certificateChain = null;
this.privateKey = null;
this.certificateChainPemFile = certificatePemFile;
this.privateKeyPkcs8File = privateKeyPkcs8File;
this.certificateChainInputStream = null;
this.privateKeyPkcs8InputStream = null;
this.privateKeyPassword = privateKeyPassword;
return this;
} | [
"public",
"BaseHttp2ServerBuilder",
"setServerCredentials",
"(",
"final",
"File",
"certificatePemFile",
",",
"final",
"File",
"privateKeyPkcs8File",
",",
"final",
"String",
"privateKeyPassword",
")",
"{",
"this",
".",
"certificateChain",
"=",
"null",
";",
"this",
".",... | <p>Sets the credentials for the server under construction using the certificates in the given PEM file and the
private key in the given PKCS#8 file.</p>
@param certificatePemFile a PEM file containing the certificate chain for the server under construction
@param privateKeyPkcs8File a PKCS#8 file containing the private key for the server under construction
@param privateKeyPassword the password for the given private key, or {@code null} if the key is not
password-protected
@return a reference to this builder
@since 0.8 | [
"<p",
">",
"Sets",
"the",
"credentials",
"for",
"the",
"server",
"under",
"construction",
"using",
"the",
"certificates",
"in",
"the",
"given",
"PEM",
"file",
"and",
"the",
"private",
"key",
"in",
"the",
"given",
"PKCS#8",
"file",
".",
"<",
"/",
"p",
">"... | train | https://github.com/relayrides/pushy/blob/1f6f9a0e07d785c815d74c2320a8d87c80231d36/pushy/src/main/java/com/turo/pushy/apns/server/BaseHttp2ServerBuilder.java#L82-L95 |
lucee/Lucee | core/src/main/java/lucee/runtime/text/xml/XMLCaster.java | XMLCaster.toNode | public static Node toNode(Document doc, Object o, short type) throws PageException {
if (Node.TEXT_NODE == type) toText(doc, o);
else if (Node.ATTRIBUTE_NODE == type) toAttr(doc, o);
else if (Node.COMMENT_NODE == type) toComment(doc, o);
else if (Node.ELEMENT_NODE == type) toElement(doc, o);
throw new ExpressionException("invalid node type definition");
} | java | public static Node toNode(Document doc, Object o, short type) throws PageException {
if (Node.TEXT_NODE == type) toText(doc, o);
else if (Node.ATTRIBUTE_NODE == type) toAttr(doc, o);
else if (Node.COMMENT_NODE == type) toComment(doc, o);
else if (Node.ELEMENT_NODE == type) toElement(doc, o);
throw new ExpressionException("invalid node type definition");
} | [
"public",
"static",
"Node",
"toNode",
"(",
"Document",
"doc",
",",
"Object",
"o",
",",
"short",
"type",
")",
"throws",
"PageException",
"{",
"if",
"(",
"Node",
".",
"TEXT_NODE",
"==",
"type",
")",
"toText",
"(",
"doc",
",",
"o",
")",
";",
"else",
"if... | casts a value to a XML Object defined by type parameter
@param doc XML Document
@param o Object to cast
@param type type to cast to
@return XML Text Object
@throws PageException | [
"casts",
"a",
"value",
"to",
"a",
"XML",
"Object",
"defined",
"by",
"type",
"parameter"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/text/xml/XMLCaster.java#L406-L414 |
alkacon/opencms-core | src-gwt/org/opencms/gwt/client/ui/input/colorpicker/CmsColorSelector.java | CmsColorSelector.setHSV | public void setHSV(int hue, int sat, int bri) throws Exception {
CmsColor color = new CmsColor();
color.setHSV(hue, sat, bri);
m_red = color.getRed();
m_green = color.getGreen();
m_blue = color.getBlue();
m_hue = hue;
m_saturation = sat;
m_brightness = bri;
m_tbRed.setText(Integer.toString(m_red));
m_tbGreen.setText(Integer.toString(m_green));
m_tbBlue.setText(Integer.toString(m_blue));
m_tbHue.setText(Integer.toString(m_hue));
m_tbSaturation.setText(Integer.toString(m_saturation));
m_tbBrightness.setText(Integer.toString(m_brightness));
m_tbHexColor.setText(color.getHex());
setPreview(color.getHex());
updateSliders();
} | java | public void setHSV(int hue, int sat, int bri) throws Exception {
CmsColor color = new CmsColor();
color.setHSV(hue, sat, bri);
m_red = color.getRed();
m_green = color.getGreen();
m_blue = color.getBlue();
m_hue = hue;
m_saturation = sat;
m_brightness = bri;
m_tbRed.setText(Integer.toString(m_red));
m_tbGreen.setText(Integer.toString(m_green));
m_tbBlue.setText(Integer.toString(m_blue));
m_tbHue.setText(Integer.toString(m_hue));
m_tbSaturation.setText(Integer.toString(m_saturation));
m_tbBrightness.setText(Integer.toString(m_brightness));
m_tbHexColor.setText(color.getHex());
setPreview(color.getHex());
updateSliders();
} | [
"public",
"void",
"setHSV",
"(",
"int",
"hue",
",",
"int",
"sat",
",",
"int",
"bri",
")",
"throws",
"Exception",
"{",
"CmsColor",
"color",
"=",
"new",
"CmsColor",
"(",
")",
";",
"color",
".",
"setHSV",
"(",
"hue",
",",
"sat",
",",
"bri",
")",
";",
... | Set the Hue, Saturation and Brightness variables.<p>
@param hue angle - valid range is 0-359
@param sat percent - valid range is 0-100
@param bri percent (Brightness) - valid range is 0-100
@throws java.lang.Exception if something goes wrong | [
"Set",
"the",
"Hue",
"Saturation",
"and",
"Brightness",
"variables",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/input/colorpicker/CmsColorSelector.java#L754-L776 |
spotify/helios | helios-client/src/main/java/com/spotify/helios/client/HeliosClient.java | HeliosClient.listHosts | public ListenableFuture<List<String>> listHosts(final String namePattern) {
return listHosts(ImmutableMultimap.of("namePattern", namePattern));
} | java | public ListenableFuture<List<String>> listHosts(final String namePattern) {
return listHosts(ImmutableMultimap.of("namePattern", namePattern));
} | [
"public",
"ListenableFuture",
"<",
"List",
"<",
"String",
">",
">",
"listHosts",
"(",
"final",
"String",
"namePattern",
")",
"{",
"return",
"listHosts",
"(",
"ImmutableMultimap",
".",
"of",
"(",
"\"namePattern\"",
",",
"namePattern",
")",
")",
";",
"}"
] | Returns a list of all hosts registered in the Helios cluster whose name matches the given
pattern. | [
"Returns",
"a",
"list",
"of",
"all",
"hosts",
"registered",
"in",
"the",
"Helios",
"cluster",
"whose",
"name",
"matches",
"the",
"given",
"pattern",
"."
] | train | https://github.com/spotify/helios/blob/c9000bc1d6908651570be8b057d4981bba4df5b4/helios-client/src/main/java/com/spotify/helios/client/HeliosClient.java#L374-L376 |
mangstadt/biweekly | src/main/java/biweekly/util/com/google/ical/iter/Util.java | Util.invertWeekdayNum | static int invertWeekdayNum(ByDay weekdayNum, DayOfWeek dow0, int nDays) {
//how many are there of that week?
return countInPeriod(weekdayNum.getDay(), dow0, nDays) + weekdayNum.getNum() + 1;
} | java | static int invertWeekdayNum(ByDay weekdayNum, DayOfWeek dow0, int nDays) {
//how many are there of that week?
return countInPeriod(weekdayNum.getDay(), dow0, nDays) + weekdayNum.getNum() + 1;
} | [
"static",
"int",
"invertWeekdayNum",
"(",
"ByDay",
"weekdayNum",
",",
"DayOfWeek",
"dow0",
",",
"int",
"nDays",
")",
"{",
"//how many are there of that week?",
"return",
"countInPeriod",
"(",
"weekdayNum",
".",
"getDay",
"(",
")",
",",
"dow0",
",",
"nDays",
")",... | <p>
Converts a relative week number (such as {@code -1SU}) to an absolute
week number.
</p>
<p>
For example, the week number {@code -1SU} refers to the last Sunday of
either the month or year (depending on how this method was called). So if
there are 5 Sundays in the given period, then given a week number of
{@code -1SU}, this method would return 5. Similarly, {@code -2SU} would
return 4.
</p>
@param weekdayNum the weekday number (must be a negative value, such as
{@code -1SU})
@param dow0 the day of the week of the first day of the week or month
@param nDays the number of days in the month or year
@return the absolute week number | [
"<p",
">",
"Converts",
"a",
"relative",
"week",
"number",
"(",
"such",
"as",
"{"
] | train | https://github.com/mangstadt/biweekly/blob/2e21350f85c13dfff52fdef98fdbebe2976fcf61/src/main/java/biweekly/util/com/google/ical/iter/Util.java#L138-L141 |
Stratio/deep-spark | deep-commons/src/main/java/com/stratio/deep/commons/utils/Utils.java | Utils.getExtractorInstance | public static <T, S extends BaseConfig> IExtractor<T, S> getExtractorInstance(S config) {
try {
Class<T> rdd = (Class<T>) config.getExtractorImplClass();
if (rdd == null) {
rdd = (Class<T>) Class.forName(config.getExtractorImplClassName());
}
Constructor<T> c;
if (config.getEntityClass().isAssignableFrom(Cells.class)) {
c = rdd.getConstructor();
return (IExtractor<T, S>) c.newInstance();
} else {
c = rdd.getConstructor(Class.class);
return (IExtractor<T, S>) c.newInstance(config.getEntityClass());
}
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException | IllegalArgumentException
| InvocationTargetException | NoSuchMethodException | SecurityException e) {
String message = "A exception happens and we wrap with DeepExtractorInitializationException" + e.getMessage();
LOG.error(message);
throw new DeepExtractorInitializationException(message,e);
}
} | java | public static <T, S extends BaseConfig> IExtractor<T, S> getExtractorInstance(S config) {
try {
Class<T> rdd = (Class<T>) config.getExtractorImplClass();
if (rdd == null) {
rdd = (Class<T>) Class.forName(config.getExtractorImplClassName());
}
Constructor<T> c;
if (config.getEntityClass().isAssignableFrom(Cells.class)) {
c = rdd.getConstructor();
return (IExtractor<T, S>) c.newInstance();
} else {
c = rdd.getConstructor(Class.class);
return (IExtractor<T, S>) c.newInstance(config.getEntityClass());
}
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException | IllegalArgumentException
| InvocationTargetException | NoSuchMethodException | SecurityException e) {
String message = "A exception happens and we wrap with DeepExtractorInitializationException" + e.getMessage();
LOG.error(message);
throw new DeepExtractorInitializationException(message,e);
}
} | [
"public",
"static",
"<",
"T",
",",
"S",
"extends",
"BaseConfig",
">",
"IExtractor",
"<",
"T",
",",
"S",
">",
"getExtractorInstance",
"(",
"S",
"config",
")",
"{",
"try",
"{",
"Class",
"<",
"T",
">",
"rdd",
"=",
"(",
"Class",
"<",
"T",
">",
")",
"... | Gets extractor instance.
@param config the config
@return the extractor instance | [
"Gets",
"extractor",
"instance",
"."
] | train | https://github.com/Stratio/deep-spark/blob/b9621c9b7a6d996f80fce1d073d696a157bed095/deep-commons/src/main/java/com/stratio/deep/commons/utils/Utils.java#L381-L403 |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/util/Jdt2Ecore.java | Jdt2Ecore.getAnnotation | public IAnnotation getAnnotation(IAnnotatable element, String qualifiedName) {
if (element != null) {
try {
final int separator = qualifiedName.lastIndexOf('.');
final String simpleName;
if (separator >= 0 && separator < (qualifiedName.length() - 1)) {
simpleName = qualifiedName.substring(separator + 1, qualifiedName.length());
} else {
simpleName = qualifiedName;
}
for (final IAnnotation annotation : element.getAnnotations()) {
final String name = annotation.getElementName();
if (name.equals(simpleName) || name.equals(qualifiedName)) {
return annotation;
}
}
} catch (JavaModelException e) {
//
}
}
return null;
} | java | public IAnnotation getAnnotation(IAnnotatable element, String qualifiedName) {
if (element != null) {
try {
final int separator = qualifiedName.lastIndexOf('.');
final String simpleName;
if (separator >= 0 && separator < (qualifiedName.length() - 1)) {
simpleName = qualifiedName.substring(separator + 1, qualifiedName.length());
} else {
simpleName = qualifiedName;
}
for (final IAnnotation annotation : element.getAnnotations()) {
final String name = annotation.getElementName();
if (name.equals(simpleName) || name.equals(qualifiedName)) {
return annotation;
}
}
} catch (JavaModelException e) {
//
}
}
return null;
} | [
"public",
"IAnnotation",
"getAnnotation",
"(",
"IAnnotatable",
"element",
",",
"String",
"qualifiedName",
")",
"{",
"if",
"(",
"element",
"!=",
"null",
")",
"{",
"try",
"{",
"final",
"int",
"separator",
"=",
"qualifiedName",
".",
"lastIndexOf",
"(",
"'",
"'"... | Replies the annotation with the given qualified name.
@param element the annoted element.
@param qualifiedName the qualified name of the element.
@return the annotation, or <code>null</code> if the element is not annoted. | [
"Replies",
"the",
"annotation",
"with",
"the",
"given",
"qualified",
"name",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/util/Jdt2Ecore.java#L335-L356 |
ixa-ehu/kaflib | src/main/java/ixa/kaflib/KAFDocument.java | KAFDocument.newCategory | public Feature newCategory(String id, String lemma, List<Span<Term>> references) {
idManager.updateCounter(AnnotationType.CATEGORY, id);
Feature newCategory = new Feature(id, lemma, references);
annotationContainer.add(newCategory, Layer.CATEGORIES, AnnotationType.CATEGORY);
return newCategory;
} | java | public Feature newCategory(String id, String lemma, List<Span<Term>> references) {
idManager.updateCounter(AnnotationType.CATEGORY, id);
Feature newCategory = new Feature(id, lemma, references);
annotationContainer.add(newCategory, Layer.CATEGORIES, AnnotationType.CATEGORY);
return newCategory;
} | [
"public",
"Feature",
"newCategory",
"(",
"String",
"id",
",",
"String",
"lemma",
",",
"List",
"<",
"Span",
"<",
"Term",
">",
">",
"references",
")",
"{",
"idManager",
".",
"updateCounter",
"(",
"AnnotationType",
".",
"CATEGORY",
",",
"id",
")",
";",
"Fea... | Creates a new category. It receives it's ID as an argument. The category is added to the document.
@param id the ID of the category.
@param lemma the lemma of the category.
@param references different mentions (list of targets) to the same category.
@return a new coreference. | [
"Creates",
"a",
"new",
"category",
".",
"It",
"receives",
"it",
"s",
"ID",
"as",
"an",
"argument",
".",
"The",
"category",
"is",
"added",
"to",
"the",
"document",
"."
] | train | https://github.com/ixa-ehu/kaflib/blob/3921f55d9ae4621736a329418f6334fb721834b8/src/main/java/ixa/kaflib/KAFDocument.java#L927-L932 |
DDTH/ddth-commons | ddth-commons-core/src/main/java/com/github/ddth/commons/utils/TypesafeConfigUtils.java | TypesafeConfigUtils.getPeriod | public static Period getPeriod(Config config, String path) {
try {
return config.getPeriod(path);
} catch (ConfigException.Missing | ConfigException.WrongType | ConfigException.BadValue e) {
if (e instanceof ConfigException.WrongType || e instanceof ConfigException.BadValue) {
LOGGER.warn(e.getMessage(), e);
}
return null;
}
} | java | public static Period getPeriod(Config config, String path) {
try {
return config.getPeriod(path);
} catch (ConfigException.Missing | ConfigException.WrongType | ConfigException.BadValue e) {
if (e instanceof ConfigException.WrongType || e instanceof ConfigException.BadValue) {
LOGGER.warn(e.getMessage(), e);
}
return null;
}
} | [
"public",
"static",
"Period",
"getPeriod",
"(",
"Config",
"config",
",",
"String",
"path",
")",
"{",
"try",
"{",
"return",
"config",
".",
"getPeriod",
"(",
"path",
")",
";",
"}",
"catch",
"(",
"ConfigException",
".",
"Missing",
"|",
"ConfigException",
".",... | Get a configuration as period (parses special strings like "1w"). Return {@code null}
if missing, wrong type or bad value.
@param config
@param path
@return | [
"Get",
"a",
"configuration",
"as",
"period",
"(",
"parses",
"special",
"strings",
"like",
"1w",
")",
".",
"Return",
"{",
"@code",
"null",
"}",
"if",
"missing",
"wrong",
"type",
"or",
"bad",
"value",
"."
] | train | https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/utils/TypesafeConfigUtils.java#L604-L613 |
JavaMoney/jsr354-ri-bp | src/main/java/org/javamoney/moneta/spi/base/BaseExchangeRateProvider.java | BaseExchangeRateProvider.isAvailable | public boolean isAvailable(CurrencyUnit base, CurrencyUnit term){
return isAvailable(ConversionQueryBuilder.of().setBaseCurrency(base).setTermCurrency(term).build());
} | java | public boolean isAvailable(CurrencyUnit base, CurrencyUnit term){
return isAvailable(ConversionQueryBuilder.of().setBaseCurrency(base).setTermCurrency(term).build());
} | [
"public",
"boolean",
"isAvailable",
"(",
"CurrencyUnit",
"base",
",",
"CurrencyUnit",
"term",
")",
"{",
"return",
"isAvailable",
"(",
"ConversionQueryBuilder",
".",
"of",
"(",
")",
".",
"setBaseCurrency",
"(",
"base",
")",
".",
"setTermCurrency",
"(",
"term",
... | Checks if an {@link javax.money.convert.ExchangeRate} between two {@link javax.money.CurrencyUnit} is
available from this provider. This method should check, if a given rate
is <i>currently</i> defined.
@param base the base {@link javax.money.CurrencyUnit}
@param term the term {@link javax.money.CurrencyUnit}
@return {@code true}, if such an {@link javax.money.convert.ExchangeRate} is currently
defined. | [
"Checks",
"if",
"an",
"{",
"@link",
"javax",
".",
"money",
".",
"convert",
".",
"ExchangeRate",
"}",
"between",
"two",
"{",
"@link",
"javax",
".",
"money",
".",
"CurrencyUnit",
"}",
"is",
"available",
"from",
"this",
"provider",
".",
"This",
"method",
"s... | train | https://github.com/JavaMoney/jsr354-ri-bp/blob/9c147ef5623d8032a6dc4c0e5eefdfb41641a9a2/src/main/java/org/javamoney/moneta/spi/base/BaseExchangeRateProvider.java#L106-L108 |
lievendoclo/Valkyrie-RCP | valkyrie-rcp-core/src/main/java/org/valkyriercp/util/EventListenerListHelper.java | EventListenerListHelper.fire | public void fire(String methodName, Object arg1, Object arg2) {
if (listeners != EMPTY_OBJECT_ARRAY) {
fireEventByReflection(methodName, new Object[] { arg1, arg2 });
}
} | java | public void fire(String methodName, Object arg1, Object arg2) {
if (listeners != EMPTY_OBJECT_ARRAY) {
fireEventByReflection(methodName, new Object[] { arg1, arg2 });
}
} | [
"public",
"void",
"fire",
"(",
"String",
"methodName",
",",
"Object",
"arg1",
",",
"Object",
"arg2",
")",
"{",
"if",
"(",
"listeners",
"!=",
"EMPTY_OBJECT_ARRAY",
")",
"{",
"fireEventByReflection",
"(",
"methodName",
",",
"new",
"Object",
"[",
"]",
"{",
"a... | Invokes the method with the given name and two parameters on each of the listeners
registered with this list.
@param methodName the name of the method to invoke.
@param arg1 the first argument to pass to each invocation.
@param arg2 the second argument to pass to each invocation.
@throws IllegalArgumentException if no method with the given name and 2 formal parameters
exists on the listener class managed by this list helper. | [
"Invokes",
"the",
"method",
"with",
"the",
"given",
"name",
"and",
"two",
"parameters",
"on",
"each",
"of",
"the",
"listeners",
"registered",
"with",
"this",
"list",
"."
] | train | https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/util/EventListenerListHelper.java#L250-L254 |
Azure/azure-sdk-for-java | storage/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/storage/v2018_03_01_preview/implementation/StorageAccountsInner.java | StorageAccountsInner.listServiceSASAsync | public Observable<ListServiceSasResponseInner> listServiceSASAsync(String resourceGroupName, String accountName, ServiceSasParameters parameters) {
return listServiceSASWithServiceResponseAsync(resourceGroupName, accountName, parameters).map(new Func1<ServiceResponse<ListServiceSasResponseInner>, ListServiceSasResponseInner>() {
@Override
public ListServiceSasResponseInner call(ServiceResponse<ListServiceSasResponseInner> response) {
return response.body();
}
});
} | java | public Observable<ListServiceSasResponseInner> listServiceSASAsync(String resourceGroupName, String accountName, ServiceSasParameters parameters) {
return listServiceSASWithServiceResponseAsync(resourceGroupName, accountName, parameters).map(new Func1<ServiceResponse<ListServiceSasResponseInner>, ListServiceSasResponseInner>() {
@Override
public ListServiceSasResponseInner call(ServiceResponse<ListServiceSasResponseInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ListServiceSasResponseInner",
">",
"listServiceSASAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
",",
"ServiceSasParameters",
"parameters",
")",
"{",
"return",
"listServiceSASWithServiceResponseAsync",
"(",
"resourceGro... | List service SAS credentials of a specific resource.
@param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive.
@param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only.
@param parameters The parameters to provide to list service SAS credentials.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ListServiceSasResponseInner object | [
"List",
"service",
"SAS",
"credentials",
"of",
"a",
"specific",
"resource",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/storage/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/storage/v2018_03_01_preview/implementation/StorageAccountsInner.java#L1136-L1143 |
kaazing/gateway | management/src/main/java/org/kaazing/gateway/management/monitoring/configuration/impl/MonitorFileWriterImpl.java | MonitorFileWriterImpl.initializeServiceRefMetadata | private void initializeServiceRefMetadata(int serviceLocationOffset, int serviceOffsetIndex) {
metaDataBuffer.putInt(serviceLocationOffset, serviceRefSection + serviceOffsetIndex * BitUtil.SIZE_OF_INT);
// service reference section
metaDataBuffer.putInt(serviceRefSection + serviceOffsetIndex * BitUtil.SIZE_OF_INT, 0);
metaDataBuffer.putInt(serviceRefSection + (serviceOffsetIndex + 1) * BitUtil.SIZE_OF_INT,
SERVICE_COUNTER_LABELS_BUFFER_LENGTH);
metaDataBuffer.putInt(serviceRefSection + (serviceOffsetIndex + 2) * BitUtil.SIZE_OF_INT, 0);
metaDataBuffer.putInt(serviceRefSection + (serviceOffsetIndex + 3) * BitUtil.SIZE_OF_INT,
SERVICE_COUNTER_VALUES_BUFFER_LENGTH);
} | java | private void initializeServiceRefMetadata(int serviceLocationOffset, int serviceOffsetIndex) {
metaDataBuffer.putInt(serviceLocationOffset, serviceRefSection + serviceOffsetIndex * BitUtil.SIZE_OF_INT);
// service reference section
metaDataBuffer.putInt(serviceRefSection + serviceOffsetIndex * BitUtil.SIZE_OF_INT, 0);
metaDataBuffer.putInt(serviceRefSection + (serviceOffsetIndex + 1) * BitUtil.SIZE_OF_INT,
SERVICE_COUNTER_LABELS_BUFFER_LENGTH);
metaDataBuffer.putInt(serviceRefSection + (serviceOffsetIndex + 2) * BitUtil.SIZE_OF_INT, 0);
metaDataBuffer.putInt(serviceRefSection + (serviceOffsetIndex + 3) * BitUtil.SIZE_OF_INT,
SERVICE_COUNTER_VALUES_BUFFER_LENGTH);
} | [
"private",
"void",
"initializeServiceRefMetadata",
"(",
"int",
"serviceLocationOffset",
",",
"int",
"serviceOffsetIndex",
")",
"{",
"metaDataBuffer",
".",
"putInt",
"(",
"serviceLocationOffset",
",",
"serviceRefSection",
"+",
"serviceOffsetIndex",
"*",
"BitUtil",
".",
"... | Method initializing service ref metadata section data
@param serviceLocationOffset
@param serviceOffsetIndex | [
"Method",
"initializing",
"service",
"ref",
"metadata",
"section",
"data"
] | train | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/management/src/main/java/org/kaazing/gateway/management/monitoring/configuration/impl/MonitorFileWriterImpl.java#L241-L251 |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/query/dsl/functions/ConditionalFunctions.java | ConditionalFunctions.negInfIf | public static Expression negInfIf(Expression expression1, Expression expression2) {
return x("NEGINFIF(" + expression1.toString() + ", " + expression2.toString() + ")");
} | java | public static Expression negInfIf(Expression expression1, Expression expression2) {
return x("NEGINFIF(" + expression1.toString() + ", " + expression2.toString() + ")");
} | [
"public",
"static",
"Expression",
"negInfIf",
"(",
"Expression",
"expression1",
",",
"Expression",
"expression2",
")",
"{",
"return",
"x",
"(",
"\"NEGINFIF(\"",
"+",
"expression1",
".",
"toString",
"(",
")",
"+",
"\", \"",
"+",
"expression2",
".",
"toString",
... | Returned expression results in NegInf if expression1 = expression2, otherwise returns expression1.
Returns MISSING or NULL if either input is MISSING or NULL. | [
"Returned",
"expression",
"results",
"in",
"NegInf",
"if",
"expression1",
"=",
"expression2",
"otherwise",
"returns",
"expression1",
".",
"Returns",
"MISSING",
"or",
"NULL",
"if",
"either",
"input",
"is",
"MISSING",
"or",
"NULL",
"."
] | train | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/functions/ConditionalFunctions.java#L132-L134 |
paypal/SeLion | dataproviders/src/main/java/com/paypal/selion/platform/dataprovider/impl/XmlDataProviderImpl.java | XmlDataProviderImpl.loadDataFromXml | private List<?> loadDataFromXml(String xml, Class<?> cls) {
logger.entering(new Object[] { xml, cls });
Preconditions.checkArgument(cls != null, "Please provide a valid type.");
List<?> returned;
try {
JAXBContext context = JAXBContext.newInstance(Wrapper.class, cls);
Unmarshaller unmarshaller = context.createUnmarshaller();
StringReader xmlStringReader = new StringReader(xml);
StreamSource streamSource = new StreamSource(xmlStringReader);
Wrapper<?> wrapper = unmarshaller.unmarshal(streamSource, Wrapper.class).getValue();
returned = wrapper.getList();
} catch (JAXBException excp) {
logger.exiting(excp.getMessage());
throw new DataProviderException("Error unmarshalling XML string.", excp);
}
logger.exiting(returned);
return returned;
} | java | private List<?> loadDataFromXml(String xml, Class<?> cls) {
logger.entering(new Object[] { xml, cls });
Preconditions.checkArgument(cls != null, "Please provide a valid type.");
List<?> returned;
try {
JAXBContext context = JAXBContext.newInstance(Wrapper.class, cls);
Unmarshaller unmarshaller = context.createUnmarshaller();
StringReader xmlStringReader = new StringReader(xml);
StreamSource streamSource = new StreamSource(xmlStringReader);
Wrapper<?> wrapper = unmarshaller.unmarshal(streamSource, Wrapper.class).getValue();
returned = wrapper.getList();
} catch (JAXBException excp) {
logger.exiting(excp.getMessage());
throw new DataProviderException("Error unmarshalling XML string.", excp);
}
logger.exiting(returned);
return returned;
} | [
"private",
"List",
"<",
"?",
">",
"loadDataFromXml",
"(",
"String",
"xml",
",",
"Class",
"<",
"?",
">",
"cls",
")",
"{",
"logger",
".",
"entering",
"(",
"new",
"Object",
"[",
"]",
"{",
"xml",
",",
"cls",
"}",
")",
";",
"Preconditions",
".",
"checkA... | Generates a list of the declared type after parsing the XML data string.
@param xml
String containing the XML data.
@param cls
The declared type modeled by the XML content.
@return A {@link List} of object of declared type {@link XmlFileSystemResource#getCls()}. | [
"Generates",
"a",
"list",
"of",
"the",
"declared",
"type",
"after",
"parsing",
"the",
"XML",
"data",
"string",
"."
] | train | https://github.com/paypal/SeLion/blob/694d12d0df76db48d0360b16192770c6a4fbdfd2/dataproviders/src/main/java/com/paypal/selion/platform/dataprovider/impl/XmlDataProviderImpl.java#L372-L391 |
spotify/async-google-pubsub-client | src/main/java/com/spotify/google/cloud/pubsub/client/Pubsub.java | Pubsub.deleteSubscription | public PubsubFuture<Void> deleteSubscription(final String project,
final String subscription) {
return deleteSubscription(canonicalSubscription(project, subscription));
} | java | public PubsubFuture<Void> deleteSubscription(final String project,
final String subscription) {
return deleteSubscription(canonicalSubscription(project, subscription));
} | [
"public",
"PubsubFuture",
"<",
"Void",
">",
"deleteSubscription",
"(",
"final",
"String",
"project",
",",
"final",
"String",
"subscription",
")",
"{",
"return",
"deleteSubscription",
"(",
"canonicalSubscription",
"(",
"project",
",",
"subscription",
")",
")",
";",... | Delete a Pub/Sub subscription.
@param project The Google Cloud project.
@param subscription The name of the subscription to delete.
@return A future that is completed when this request is completed. The future will be completed with {@code null}
if the response is 404. | [
"Delete",
"a",
"Pub",
"/",
"Sub",
"subscription",
"."
] | train | https://github.com/spotify/async-google-pubsub-client/blob/7d021528fa5bc29be458e6f210fa62f59b71d004/src/main/java/com/spotify/google/cloud/pubsub/client/Pubsub.java#L456-L459 |
UrielCh/ovh-java-sdk | ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java | ApiOvhTelephony.billingAccount_ovhPabx_serviceName_menu_menuId_GET | public OvhOvhPabxMenu billingAccount_ovhPabx_serviceName_menu_menuId_GET(String billingAccount, String serviceName, Long menuId) throws IOException {
String qPath = "/telephony/{billingAccount}/ovhPabx/{serviceName}/menu/{menuId}";
StringBuilder sb = path(qPath, billingAccount, serviceName, menuId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhOvhPabxMenu.class);
} | java | public OvhOvhPabxMenu billingAccount_ovhPabx_serviceName_menu_menuId_GET(String billingAccount, String serviceName, Long menuId) throws IOException {
String qPath = "/telephony/{billingAccount}/ovhPabx/{serviceName}/menu/{menuId}";
StringBuilder sb = path(qPath, billingAccount, serviceName, menuId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhOvhPabxMenu.class);
} | [
"public",
"OvhOvhPabxMenu",
"billingAccount_ovhPabx_serviceName_menu_menuId_GET",
"(",
"String",
"billingAccount",
",",
"String",
"serviceName",
",",
"Long",
"menuId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/telephony/{billingAccount}/ovhPabx/{serviceName... | Get this object properties
REST: GET /telephony/{billingAccount}/ovhPabx/{serviceName}/menu/{menuId}
@param billingAccount [required] The name of your billingAccount
@param serviceName [required]
@param menuId [required] | [
"Get",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L7538-L7543 |
jakenjarvis/Android-OrmLiteContentProvider | ormlite-content-provider-library/src/com/tojc/ormlite/android/framework/MatcherController.java | MatcherController.add | public MatcherController add(Class<?> tableClassType, SubType subType, String pattern, int patternCode) {
this.addTableClass(tableClassType);
this.addMatcherPattern(subType, pattern, patternCode);
return this;
} | java | public MatcherController add(Class<?> tableClassType, SubType subType, String pattern, int patternCode) {
this.addTableClass(tableClassType);
this.addMatcherPattern(subType, pattern, patternCode);
return this;
} | [
"public",
"MatcherController",
"add",
"(",
"Class",
"<",
"?",
">",
"tableClassType",
",",
"SubType",
"subType",
",",
"String",
"pattern",
",",
"int",
"patternCode",
")",
"{",
"this",
".",
"addTableClass",
"(",
"tableClassType",
")",
";",
"this",
".",
"addMat... | Register a class for table. And registers a pattern for UriMatcher.
@param tableClassType
Register a class for table.
@param subType
Contents to be registered in the pattern, specify single or multiple. This is used
in the MIME types. * ITEM : If the URI pattern is for a single row :
vnd.android.cursor.item/ * DIRECTORY : If the URI pattern is for more than one row
: vnd.android.cursor.dir/
@param pattern
registers a pattern for UriMatcher. Note: Must not contain the name of path here.
ex) content://com.example.app.provider/table1 : pattern = ""
content://com.example.app.provider/table1/# : pattern = "#"
content://com.example.app.provider/table1/dataset2 : pattern = "dataset2"
@param patternCode
UriMatcher code is returned
@return Instance of the MatcherController class. | [
"Register",
"a",
"class",
"for",
"table",
".",
"And",
"registers",
"a",
"pattern",
"for",
"UriMatcher",
"."
] | train | https://github.com/jakenjarvis/Android-OrmLiteContentProvider/blob/8f102f0743b308c9f58d43639e98f832fd951985/ormlite-content-provider-library/src/com/tojc/ormlite/android/framework/MatcherController.java#L86-L90 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/XmlUtil.java | XmlUtil.xmlToMap | public static Map<String, Object> xmlToMap(String xmlStr, Map<String, Object> result) {
final Document doc = parseXml(xmlStr);
final Element root = getRootElement(doc);
root.normalize();
return xmlToMap(root, result);
} | java | public static Map<String, Object> xmlToMap(String xmlStr, Map<String, Object> result) {
final Document doc = parseXml(xmlStr);
final Element root = getRootElement(doc);
root.normalize();
return xmlToMap(root, result);
} | [
"public",
"static",
"Map",
"<",
"String",
",",
"Object",
">",
"xmlToMap",
"(",
"String",
"xmlStr",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"result",
")",
"{",
"final",
"Document",
"doc",
"=",
"parseXml",
"(",
"xmlStr",
")",
";",
"final",
"Elemen... | XML格式字符串转换为Map<br>
只支持第一级别的XML,不支持多级XML
@param xmlStr XML字符串
@param result 结果Map类型
@return XML数据转换后的Map
@since 4.0.8 | [
"XML格式字符串转换为Map<br",
">",
"只支持第一级别的XML,不支持多级XML"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/XmlUtil.java#L697-L703 |
grpc/grpc-java | core/src/main/java/io/grpc/internal/TransportFrameUtil.java | TransportFrameUtil.toRawSerializedHeaders | @CheckReturnValue
public static byte[][] toRawSerializedHeaders(byte[][] http2Headers) {
for (int i = 0; i < http2Headers.length; i += 2) {
byte[] key = http2Headers[i];
byte[] value = http2Headers[i + 1];
if (endsWith(key, binaryHeaderSuffixBytes)) {
// Binary header
for (int idx = 0; idx < value.length; idx++) {
if (value[idx] == (byte) ',') {
return serializeHeadersWithCommasInBin(http2Headers, i);
}
}
byte[] decodedVal = BaseEncoding.base64().decode(new String(value, US_ASCII));
http2Headers[i + 1] = decodedVal;
} else {
// Non-binary header
// Nothing to do, the value is already in the right place.
}
}
return http2Headers;
} | java | @CheckReturnValue
public static byte[][] toRawSerializedHeaders(byte[][] http2Headers) {
for (int i = 0; i < http2Headers.length; i += 2) {
byte[] key = http2Headers[i];
byte[] value = http2Headers[i + 1];
if (endsWith(key, binaryHeaderSuffixBytes)) {
// Binary header
for (int idx = 0; idx < value.length; idx++) {
if (value[idx] == (byte) ',') {
return serializeHeadersWithCommasInBin(http2Headers, i);
}
}
byte[] decodedVal = BaseEncoding.base64().decode(new String(value, US_ASCII));
http2Headers[i + 1] = decodedVal;
} else {
// Non-binary header
// Nothing to do, the value is already in the right place.
}
}
return http2Headers;
} | [
"@",
"CheckReturnValue",
"public",
"static",
"byte",
"[",
"]",
"[",
"]",
"toRawSerializedHeaders",
"(",
"byte",
"[",
"]",
"[",
"]",
"http2Headers",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"http2Headers",
".",
"length",
";",
"i",
"+... | Transform HTTP/2-compliant headers to the raw serialized format which can be deserialized by
metadata marshallers. It decodes the Base64-encoded binary headers.
<p>Warning: This function may partially modify the headers in place by modifying the input
array (but not modifying any single byte), so the input reference {@code http2Headers} can not
be used again.
@param http2Headers the interleaved keys and values of HTTP/2-compliant headers
@return the interleaved keys and values in the raw serialized format | [
"Transform",
"HTTP",
"/",
"2",
"-",
"compliant",
"headers",
"to",
"the",
"raw",
"serialized",
"format",
"which",
"can",
"be",
"deserialized",
"by",
"metadata",
"marshallers",
".",
"It",
"decodes",
"the",
"Base64",
"-",
"encoded",
"binary",
"headers",
"."
] | train | https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/core/src/main/java/io/grpc/internal/TransportFrameUtil.java#L99-L119 |
JavaMoney/jsr354-ri-bp | src/main/java/org/javamoney/moneta/spi/base/BaseMonetaryRoundingsSingletonSpi.java | BaseMonetaryRoundingsSingletonSpi.getRounding | public MonetaryRounding getRounding(CurrencyUnit currencyUnit, String... providers) {
MonetaryRounding op =
getRounding(RoundingQueryBuilder.of().setProviderNames(providers).setCurrency(currencyUnit).build());
if(op==null) {
throw new MonetaryException(
"No rounding provided for CurrencyUnit: " + currencyUnit.getCurrencyCode());
}
return op;
} | java | public MonetaryRounding getRounding(CurrencyUnit currencyUnit, String... providers) {
MonetaryRounding op =
getRounding(RoundingQueryBuilder.of().setProviderNames(providers).setCurrency(currencyUnit).build());
if(op==null) {
throw new MonetaryException(
"No rounding provided for CurrencyUnit: " + currencyUnit.getCurrencyCode());
}
return op;
} | [
"public",
"MonetaryRounding",
"getRounding",
"(",
"CurrencyUnit",
"currencyUnit",
",",
"String",
"...",
"providers",
")",
"{",
"MonetaryRounding",
"op",
"=",
"getRounding",
"(",
"RoundingQueryBuilder",
".",
"of",
"(",
")",
".",
"setProviderNames",
"(",
"providers",
... | Access a {@link javax.money.MonetaryRounding} for rounding {@link javax.money.MonetaryAmount}
instances given a currency.
@param currencyUnit The currency, which determines the required precision. As
{@link java.math.RoundingMode}, by default, {@link java.math.RoundingMode#HALF_UP}
is sued.
@param providers the optional provider list and ordering to be used
@return a new instance {@link javax.money.MonetaryOperator} implementing the
rounding, never {@code null}.
@throws javax.money.MonetaryException if no such rounding could be provided. | [
"Access",
"a",
"{",
"@link",
"javax",
".",
"money",
".",
"MonetaryRounding",
"}",
"for",
"rounding",
"{",
"@link",
"javax",
".",
"money",
".",
"MonetaryAmount",
"}",
"instances",
"given",
"a",
"currency",
"."
] | train | https://github.com/JavaMoney/jsr354-ri-bp/blob/9c147ef5623d8032a6dc4c0e5eefdfb41641a9a2/src/main/java/org/javamoney/moneta/spi/base/BaseMonetaryRoundingsSingletonSpi.java#L44-L52 |
knowm/XChange | xchange-coinbase/src/main/java/org/knowm/xchange/coinbase/service/CoinbaseBaseService.java | CoinbaseBaseService.createCoinbaseUser | public CoinbaseUser createCoinbaseUser(CoinbaseUser user, final String oAuthClientId)
throws IOException {
final CoinbaseUser createdUser = coinbase.createUser(user.withoAuthClientId(oAuthClientId));
return handleResponse(createdUser);
} | java | public CoinbaseUser createCoinbaseUser(CoinbaseUser user, final String oAuthClientId)
throws IOException {
final CoinbaseUser createdUser = coinbase.createUser(user.withoAuthClientId(oAuthClientId));
return handleResponse(createdUser);
} | [
"public",
"CoinbaseUser",
"createCoinbaseUser",
"(",
"CoinbaseUser",
"user",
",",
"final",
"String",
"oAuthClientId",
")",
"throws",
"IOException",
"{",
"final",
"CoinbaseUser",
"createdUser",
"=",
"coinbase",
".",
"createUser",
"(",
"user",
".",
"withoAuthClientId",
... | Unauthenticated resource that creates a user with an email and password.
@param user New Coinbase User information.
@param oAuthClientId Optional client id that corresponds to your OAuth2 application.
@return Information for the newly created user, including information to perform future OAuth
requests for the user.
@throws IOException
@see <a
href="https://coinbase.com/api/doc/1.0/users/create.html">coinbase.com/api/doc/1.0/users/create.html</a>
@see {@link CoinbaseUser#createNewCoinbaseUser} and {@link
CoinbaseUser#createCoinbaseNewUserWithReferrerId} | [
"Unauthenticated",
"resource",
"that",
"creates",
"a",
"user",
"with",
"an",
"email",
"and",
"password",
"."
] | train | https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-coinbase/src/main/java/org/knowm/xchange/coinbase/service/CoinbaseBaseService.java#L82-L87 |
mebigfatguy/fb-contrib | src/main/java/com/mebigfatguy/fbcontrib/detect/FinalParameters.java | FinalParameters.getRegisterName | private static String getRegisterName(final Code obj, final int reg) {
LocalVariableTable lvt = obj.getLocalVariableTable();
if (lvt != null) {
LocalVariable lv = lvt.getLocalVariable(reg, 0);
if (lv != null) {
return lv.getName();
}
}
return String.valueOf(reg);
} | java | private static String getRegisterName(final Code obj, final int reg) {
LocalVariableTable lvt = obj.getLocalVariableTable();
if (lvt != null) {
LocalVariable lv = lvt.getLocalVariable(reg, 0);
if (lv != null) {
return lv.getName();
}
}
return String.valueOf(reg);
} | [
"private",
"static",
"String",
"getRegisterName",
"(",
"final",
"Code",
"obj",
",",
"final",
"int",
"reg",
")",
"{",
"LocalVariableTable",
"lvt",
"=",
"obj",
".",
"getLocalVariableTable",
"(",
")",
";",
"if",
"(",
"lvt",
"!=",
"null",
")",
"{",
"LocalVaria... | returns the variable name of the specified register slot
@param obj
the currently parsed code object
@param reg
the variable register of interest
@return the variable name of the specified register | [
"returns",
"the",
"variable",
"name",
"of",
"the",
"specified",
"register",
"slot"
] | train | https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/FinalParameters.java#L238-L247 |
apache/incubator-druid | processing/src/main/java/org/apache/druid/collections/spatial/search/PolygonBound.java | PolygonBound.from | @JsonCreator
public static PolygonBound from(
@JsonProperty("abscissa") float[] abscissa,
@JsonProperty("ordinate") float[] ordinate,
@JsonProperty("limit") int limit
)
{
Preconditions.checkArgument(abscissa.length == ordinate.length); //abscissa and ordinate should be the same length
Preconditions.checkArgument(abscissa.length > 2); //a polygon should have more than 2 corners
return new PolygonBound(abscissa, ordinate, limit);
} | java | @JsonCreator
public static PolygonBound from(
@JsonProperty("abscissa") float[] abscissa,
@JsonProperty("ordinate") float[] ordinate,
@JsonProperty("limit") int limit
)
{
Preconditions.checkArgument(abscissa.length == ordinate.length); //abscissa and ordinate should be the same length
Preconditions.checkArgument(abscissa.length > 2); //a polygon should have more than 2 corners
return new PolygonBound(abscissa, ordinate, limit);
} | [
"@",
"JsonCreator",
"public",
"static",
"PolygonBound",
"from",
"(",
"@",
"JsonProperty",
"(",
"\"abscissa\"",
")",
"float",
"[",
"]",
"abscissa",
",",
"@",
"JsonProperty",
"(",
"\"ordinate\"",
")",
"float",
"[",
"]",
"ordinate",
",",
"@",
"JsonProperty",
"(... | abscissa and ordinate contain the coordinates of polygon.
abscissa[i] is the horizontal coordinate for the i'th corner of the polygon,
and ordinate[i] is the vertical coordinate for the i'th corner.
The polygon must have more than 2 corners, so the length of abscissa or ordinate must be equal or greater than 3.
if the polygon is a rectangular, which corners are {0.0, 0.0}, {0.0, 1.0}, {1.0, 1.0}, {1.0, 0.0},
the abscissa should be {0.0, 0.0, 1.0, 1.0} and ordinate should be {0.0, 1.0, 1.0, 0.0} | [
"abscissa",
"and",
"ordinate",
"contain",
"the",
"coordinates",
"of",
"polygon",
".",
"abscissa",
"[",
"i",
"]",
"is",
"the",
"horizontal",
"coordinate",
"for",
"the",
"i",
"th",
"corner",
"of",
"the",
"polygon",
"and",
"ordinate",
"[",
"i",
"]",
"is",
"... | train | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/processing/src/main/java/org/apache/druid/collections/spatial/search/PolygonBound.java#L89-L99 |
jdereg/java-util | src/main/java/com/cedarsoftware/util/DeepEquals.java | DeepEquals.compareArrays | private static boolean compareArrays(Object array1, Object array2, Deque stack, Set visited)
{
// Same instance check already performed...
int len = Array.getLength(array1);
if (len != Array.getLength(array2))
{
return false;
}
for (int i = 0; i < len; i++)
{
DualKey dk = new DualKey(Array.get(array1, i), Array.get(array2, i));
if (!visited.contains(dk))
{ // push contents for further comparison
stack.addFirst(dk);
}
}
return true;
} | java | private static boolean compareArrays(Object array1, Object array2, Deque stack, Set visited)
{
// Same instance check already performed...
int len = Array.getLength(array1);
if (len != Array.getLength(array2))
{
return false;
}
for (int i = 0; i < len; i++)
{
DualKey dk = new DualKey(Array.get(array1, i), Array.get(array2, i));
if (!visited.contains(dk))
{ // push contents for further comparison
stack.addFirst(dk);
}
}
return true;
} | [
"private",
"static",
"boolean",
"compareArrays",
"(",
"Object",
"array1",
",",
"Object",
"array2",
",",
"Deque",
"stack",
",",
"Set",
"visited",
")",
"{",
"// Same instance check already performed...",
"int",
"len",
"=",
"Array",
".",
"getLength",
"(",
"array1",
... | Deeply compare to Arrays []. Both arrays must be of the same type, same length, and all
elements within the arrays must be deeply equal in order to return true.
@param array1 [] type (Object[], String[], etc.)
@param array2 [] type (Object[], String[], etc.)
@param stack add items to compare to the Stack (Stack versus recursion)
@param visited Set of objects already compared (prevents cycles)
@return true if the two arrays are the same length and contain deeply equivalent items. | [
"Deeply",
"compare",
"to",
"Arrays",
"[]",
".",
"Both",
"arrays",
"must",
"be",
"of",
"the",
"same",
"type",
"same",
"length",
"and",
"all",
"elements",
"within",
"the",
"arrays",
"must",
"be",
"deeply",
"equal",
"in",
"order",
"to",
"return",
"true",
".... | train | https://github.com/jdereg/java-util/blob/a2dce61aed16d6454ee575174dda1ba6bff0015c/src/main/java/com/cedarsoftware/util/DeepEquals.java#L381-L400 |
google/closure-compiler | src/com/google/javascript/rhino/jstype/JSTypeRegistry.java | JSTypeRegistry.createFunctionType | public FunctionType createFunctionType(
JSType returnType, JSType... parameterTypes) {
return createFunctionType(returnType, createParameters(parameterTypes));
} | java | public FunctionType createFunctionType(
JSType returnType, JSType... parameterTypes) {
return createFunctionType(returnType, createParameters(parameterTypes));
} | [
"public",
"FunctionType",
"createFunctionType",
"(",
"JSType",
"returnType",
",",
"JSType",
"...",
"parameterTypes",
")",
"{",
"return",
"createFunctionType",
"(",
"returnType",
",",
"createParameters",
"(",
"parameterTypes",
")",
")",
";",
"}"
] | Creates a function type.
@param returnType the function's return type
@param parameterTypes the parameters' types | [
"Creates",
"a",
"function",
"type",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/jstype/JSTypeRegistry.java#L1589-L1592 |
Drivemode/TypefaceHelper | TypefaceHelper/src/main/java/com/drivemode/android/typeface/TypefaceHelper.java | TypefaceHelper.setTypeface | public <V extends TextView> void setTypeface(V view, @StringRes int strResId) {
setTypeface(view, mApplication.getString(strResId));
} | java | public <V extends TextView> void setTypeface(V view, @StringRes int strResId) {
setTypeface(view, mApplication.getString(strResId));
} | [
"public",
"<",
"V",
"extends",
"TextView",
">",
"void",
"setTypeface",
"(",
"V",
"view",
",",
"@",
"StringRes",
"int",
"strResId",
")",
"{",
"setTypeface",
"(",
"view",
",",
"mApplication",
".",
"getString",
"(",
"strResId",
")",
")",
";",
"}"
] | Set the typeface to the target view.
@param view to set typeface.
@param strResId string resource containing typeface name.
@param <V> text view parameter. | [
"Set",
"the",
"typeface",
"to",
"the",
"target",
"view",
"."
] | train | https://github.com/Drivemode/TypefaceHelper/blob/86bef9ce16b9626b7076559e846db1b9f043c008/TypefaceHelper/src/main/java/com/drivemode/android/typeface/TypefaceHelper.java#L95-L97 |
pac4j/pac4j | pac4j-oauth/src/main/java/org/pac4j/oauth/config/OAuthConfiguration.java | OAuthConfiguration.buildService | public S buildService(final WebContext context, final IndirectClient client, final String state) {
init();
final String finalCallbackUrl = client.computeFinalCallbackUrl(context);
return getApi().createService(this.key, this.secret, finalCallbackUrl, this.scope, null, state, this.responseType, null,
this.httpClientConfig, null);
} | java | public S buildService(final WebContext context, final IndirectClient client, final String state) {
init();
final String finalCallbackUrl = client.computeFinalCallbackUrl(context);
return getApi().createService(this.key, this.secret, finalCallbackUrl, this.scope, null, state, this.responseType, null,
this.httpClientConfig, null);
} | [
"public",
"S",
"buildService",
"(",
"final",
"WebContext",
"context",
",",
"final",
"IndirectClient",
"client",
",",
"final",
"String",
"state",
")",
"{",
"init",
"(",
")",
";",
"final",
"String",
"finalCallbackUrl",
"=",
"client",
".",
"computeFinalCallbackUrl"... | Build an OAuth service from the web context and with a state.
@param context the web context
@param client the client
@param state a given state
@return the OAuth service | [
"Build",
"an",
"OAuth",
"service",
"from",
"the",
"web",
"context",
"and",
"with",
"a",
"state",
"."
] | train | https://github.com/pac4j/pac4j/blob/d9cd029f8783792b31dd48bf1e32f80628f2c4a3/pac4j-oauth/src/main/java/org/pac4j/oauth/config/OAuthConfiguration.java#L62-L69 |
tango-controls/JTango | dao/src/main/java/fr/esrf/TangoDs/Logging.java | Logging.init | public static Logging init(String ds_name, int trace_level, Database db) {
if (_instance == null) {
_instance = new Logging(ds_name, trace_level, db);
}
return _instance;
} | java | public static Logging init(String ds_name, int trace_level, Database db) {
if (_instance == null) {
_instance = new Logging(ds_name, trace_level, db);
}
return _instance;
} | [
"public",
"static",
"Logging",
"init",
"(",
"String",
"ds_name",
",",
"int",
"trace_level",
",",
"Database",
"db",
")",
"{",
"if",
"(",
"_instance",
"==",
"null",
")",
"{",
"_instance",
"=",
"new",
"Logging",
"(",
"ds_name",
",",
"trace_level",
",",
"db"... | Create and get the singleton object reference.
<p>
This method returns a reference to the object of the Logging class.
If the class singleton object has not been created, it will be
instanciated
@param ds_name The device server executable name
@param db The database object
@return The Logging object reference | [
"Create",
"and",
"get",
"the",
"singleton",
"object",
"reference",
".",
"<p",
">",
"This",
"method",
"returns",
"a",
"reference",
"to",
"the",
"object",
"of",
"the",
"Logging",
"class",
".",
"If",
"the",
"class",
"singleton",
"object",
"has",
"not",
"been"... | train | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/dao/src/main/java/fr/esrf/TangoDs/Logging.java#L236-L241 |
phax/ph-css | ph-css/src/main/java/com/helger/css/decl/CascadingStyleSheet.java | CascadingStyleSheet.addImportRule | @Nonnull
public CascadingStyleSheet addImportRule (@Nonnegative final int nIndex, @Nonnull final CSSImportRule aImportRule)
{
ValueEnforcer.isGE0 (nIndex, "Index");
ValueEnforcer.notNull (aImportRule, "ImportRule");
if (nIndex >= getImportRuleCount ())
m_aImportRules.add (aImportRule);
else
m_aImportRules.add (nIndex, aImportRule);
return this;
} | java | @Nonnull
public CascadingStyleSheet addImportRule (@Nonnegative final int nIndex, @Nonnull final CSSImportRule aImportRule)
{
ValueEnforcer.isGE0 (nIndex, "Index");
ValueEnforcer.notNull (aImportRule, "ImportRule");
if (nIndex >= getImportRuleCount ())
m_aImportRules.add (aImportRule);
else
m_aImportRules.add (nIndex, aImportRule);
return this;
} | [
"@",
"Nonnull",
"public",
"CascadingStyleSheet",
"addImportRule",
"(",
"@",
"Nonnegative",
"final",
"int",
"nIndex",
",",
"@",
"Nonnull",
"final",
"CSSImportRule",
"aImportRule",
")",
"{",
"ValueEnforcer",
".",
"isGE0",
"(",
"nIndex",
",",
"\"Index\"",
")",
";",... | Add a new <code>@import</code> rule at a specified index of the
<code>@import</code> rule list.
@param nIndex
The index where the rule should be added. Must be ≥ 0.
@param aImportRule
The import rule to add. May not be <code>null</code>.
@return this
@throws ArrayIndexOutOfBoundsException
if the index is invalid | [
"Add",
"a",
"new",
"<code",
">",
"@import<",
"/",
"code",
">",
"rule",
"at",
"a",
"specified",
"index",
"of",
"the",
"<code",
">",
"@import<",
"/",
"code",
">",
"rule",
"list",
"."
] | train | https://github.com/phax/ph-css/blob/c9da5bb4decc681de6e27ce31712aad4c00adafa/ph-css/src/main/java/com/helger/css/decl/CascadingStyleSheet.java#L114-L125 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ULocale.java | ULocale.getDisplayNameWithDialect | public static String getDisplayNameWithDialect(String localeID, String displayLocaleID) {
return getDisplayNameWithDialectInternal(new ULocale(localeID),
new ULocale(displayLocaleID));
} | java | public static String getDisplayNameWithDialect(String localeID, String displayLocaleID) {
return getDisplayNameWithDialectInternal(new ULocale(localeID),
new ULocale(displayLocaleID));
} | [
"public",
"static",
"String",
"getDisplayNameWithDialect",
"(",
"String",
"localeID",
",",
"String",
"displayLocaleID",
")",
"{",
"return",
"getDisplayNameWithDialectInternal",
"(",
"new",
"ULocale",
"(",
"localeID",
")",
",",
"new",
"ULocale",
"(",
"displayLocaleID",... | <strong>[icu]</strong> Returns the locale ID localized for display in the provided locale.
If a dialect name is present in the locale data, then it is returned.
This is a cover for the ICU4C API.
@param localeID the locale whose name is to be displayed.
@param displayLocaleID the id of the locale in which to display the locale name.
@return the localized locale name. | [
"<strong",
">",
"[",
"icu",
"]",
"<",
"/",
"strong",
">",
"Returns",
"the",
"locale",
"ID",
"localized",
"for",
"display",
"in",
"the",
"provided",
"locale",
".",
"If",
"a",
"dialect",
"name",
"is",
"present",
"in",
"the",
"locale",
"data",
"then",
"it... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ULocale.java#L1825-L1828 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.