repository_name stringlengths 7 54 | func_path_in_repository stringlengths 18 218 | func_name stringlengths 5 140 | whole_func_string stringlengths 79 3.99k | language stringclasses 1
value | func_code_string stringlengths 79 3.99k | func_code_tokens listlengths 20 624 | func_documentation_string stringlengths 61 1.96k | func_documentation_tokens listlengths 1 478 | split_name stringclasses 1
value | func_code_url stringlengths 107 339 |
|---|---|---|---|---|---|---|---|---|---|---|
Viascom/groundwork | foxhttp/src/main/java/ch/viascom/groundwork/foxhttp/header/FoxHttpHeader.java | FoxHttpHeader.addHeader | public void addHeader(Map<String, String> entries) {
for (Map.Entry<String, String> entry : entries.entrySet()) {
headerEntries.add(new HeaderEntry(entry.getKey(), entry.getValue()));
}
} | java | public void addHeader(Map<String, String> entries) {
for (Map.Entry<String, String> entry : entries.entrySet()) {
headerEntries.add(new HeaderEntry(entry.getKey(), entry.getValue()));
}
} | [
"public",
"void",
"addHeader",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"entries",
")",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"String",
">",
"entry",
":",
"entries",
".",
"entrySet",
"(",
")",
")",
"{",
"headerEntries",
".",... | Add a new map of header entries
@param entries map of header entries | [
"Add",
"a",
"new",
"map",
"of",
"header",
"entries"
] | train | https://github.com/Viascom/groundwork/blob/d3f7d0df65e2e75861fc7db938090683f2cdf919/foxhttp/src/main/java/ch/viascom/groundwork/foxhttp/header/FoxHttpHeader.java#L51-L55 |
sarl/sarl | main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/parser/SarlDocumentationParser.java | SarlDocumentationParser.extractValidationComponents | public void extractValidationComponents(CharSequence content, File inputFile,
Procedure1<Map<Tag, List<MutableTriple<File, Integer, String>>>> observer) {
//
// STEP 1: Extract the raw text
//
final Map<Tag, List<MutableTriple<File, Integer, String>>> components = new TreeMap<>();
final ContentParserInterceptor interceptor = new ContentParserInterceptor(new ParserInterceptor() {
@Override
public void tag(ParsingContext context, Tag tag, String dynamicName, String parameter,
String blockValue) {
if (tag.isOpeningTag() || tag.hasParameter()) {
List<MutableTriple<File, Integer, String>> values = components.get(tag);
if (values == null) {
values = new ArrayList<>();
components.put(tag, values);
}
if (tag.isOpeningTag()) {
values.add(new MutableTriple<>(context.getCurrentFile(),
context.getLineNo(), Strings.nullToEmpty(blockValue).trim()));
} else {
values.add(new MutableTriple<>(context.getCurrentFile(),
context.getLineNo(), Strings.nullToEmpty(parameter).trim()));
}
}
}
});
final ParsingContext rootContextForReplacements = new ParsingContext(true, true);
initializeContext(rootContextForReplacements);
parse(content, inputFile, 0, Stage.FIRST, rootContextForReplacements, interceptor);
//
// STEP 2: Do macro replacement in the captured elements.
//
final Collection<List<MutableTriple<File, Integer, String>>> allTexts = new ArrayList<>(components.values());
for (final List<MutableTriple<File, Integer, String>> values : allTexts) {
for (final MutableTriple<File, Integer, String> pair : values) {
final ContentParserInterceptor localInterceptor = new ContentParserInterceptor(interceptor);
parse(pair.getRight(), inputFile, 0, Stage.SECOND, rootContextForReplacements, localInterceptor);
final String newCapturedText = localInterceptor.getResult();
pair.setRight(newCapturedText);
}
}
observer.apply(components);
} | java | public void extractValidationComponents(CharSequence content, File inputFile,
Procedure1<Map<Tag, List<MutableTriple<File, Integer, String>>>> observer) {
//
// STEP 1: Extract the raw text
//
final Map<Tag, List<MutableTriple<File, Integer, String>>> components = new TreeMap<>();
final ContentParserInterceptor interceptor = new ContentParserInterceptor(new ParserInterceptor() {
@Override
public void tag(ParsingContext context, Tag tag, String dynamicName, String parameter,
String blockValue) {
if (tag.isOpeningTag() || tag.hasParameter()) {
List<MutableTriple<File, Integer, String>> values = components.get(tag);
if (values == null) {
values = new ArrayList<>();
components.put(tag, values);
}
if (tag.isOpeningTag()) {
values.add(new MutableTriple<>(context.getCurrentFile(),
context.getLineNo(), Strings.nullToEmpty(blockValue).trim()));
} else {
values.add(new MutableTriple<>(context.getCurrentFile(),
context.getLineNo(), Strings.nullToEmpty(parameter).trim()));
}
}
}
});
final ParsingContext rootContextForReplacements = new ParsingContext(true, true);
initializeContext(rootContextForReplacements);
parse(content, inputFile, 0, Stage.FIRST, rootContextForReplacements, interceptor);
//
// STEP 2: Do macro replacement in the captured elements.
//
final Collection<List<MutableTriple<File, Integer, String>>> allTexts = new ArrayList<>(components.values());
for (final List<MutableTriple<File, Integer, String>> values : allTexts) {
for (final MutableTriple<File, Integer, String> pair : values) {
final ContentParserInterceptor localInterceptor = new ContentParserInterceptor(interceptor);
parse(pair.getRight(), inputFile, 0, Stage.SECOND, rootContextForReplacements, localInterceptor);
final String newCapturedText = localInterceptor.getResult();
pair.setRight(newCapturedText);
}
}
observer.apply(components);
} | [
"public",
"void",
"extractValidationComponents",
"(",
"CharSequence",
"content",
",",
"File",
"inputFile",
",",
"Procedure1",
"<",
"Map",
"<",
"Tag",
",",
"List",
"<",
"MutableTriple",
"<",
"File",
",",
"Integer",
",",
"String",
">",
">",
">",
">",
"observer... | Read the given input content and extract validation components.
@param content the content to parse.
@param inputFile the name of the input file for locating included features and formatting error messages.
@param observer the oberserver to be called with extracted information. The parameter of the lambda maps
the tags to the associated list of the extraction information. | [
"Read",
"the",
"given",
"input",
"content",
"and",
"extract",
"validation",
"components",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/parser/SarlDocumentationParser.java#L772-L815 |
b3dgs/lionengine | lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/TileGroupsConfig.java | TileGroupsConfig.importGroup | private static TileGroup importGroup(Xml nodeGroup)
{
final Collection<Xml> children = nodeGroup.getChildren(TileConfig.NODE_TILE);
final Collection<TileRef> tiles = new ArrayList<>(children.size());
for (final Xml nodeTileRef : children)
{
final TileRef tileRef = TileConfig.imports(nodeTileRef);
tiles.add(tileRef);
}
final String groupName = nodeGroup.readString(ATT_GROUP_NAME);
final TileGroupType groupType = TileGroupType.from(nodeGroup.readString(TileGroupType.NONE.name(),
ATT_GROUP_TYPE));
return new TileGroup(groupName, groupType, tiles);
} | java | private static TileGroup importGroup(Xml nodeGroup)
{
final Collection<Xml> children = nodeGroup.getChildren(TileConfig.NODE_TILE);
final Collection<TileRef> tiles = new ArrayList<>(children.size());
for (final Xml nodeTileRef : children)
{
final TileRef tileRef = TileConfig.imports(nodeTileRef);
tiles.add(tileRef);
}
final String groupName = nodeGroup.readString(ATT_GROUP_NAME);
final TileGroupType groupType = TileGroupType.from(nodeGroup.readString(TileGroupType.NONE.name(),
ATT_GROUP_TYPE));
return new TileGroup(groupName, groupType, tiles);
} | [
"private",
"static",
"TileGroup",
"importGroup",
"(",
"Xml",
"nodeGroup",
")",
"{",
"final",
"Collection",
"<",
"Xml",
">",
"children",
"=",
"nodeGroup",
".",
"getChildren",
"(",
"TileConfig",
".",
"NODE_TILE",
")",
";",
"final",
"Collection",
"<",
"TileRef",
... | Import the group from its node.
@param nodeGroup The group node (must not be <code>null</code>).
@return The imported group. | [
"Import",
"the",
"group",
"from",
"its",
"node",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/TileGroupsConfig.java#L106-L121 |
census-instrumentation/opencensus-java | api/src/main/java/io/opencensus/tags/TagContextBuilder.java | TagContextBuilder.putLocal | public final TagContextBuilder putLocal(TagKey key, TagValue value) {
return put(key, value, METADATA_NO_PROPAGATION);
} | java | public final TagContextBuilder putLocal(TagKey key, TagValue value) {
return put(key, value, METADATA_NO_PROPAGATION);
} | [
"public",
"final",
"TagContextBuilder",
"putLocal",
"(",
"TagKey",
"key",
",",
"TagValue",
"value",
")",
"{",
"return",
"put",
"(",
"key",
",",
"value",
",",
"METADATA_NO_PROPAGATION",
")",
";",
"}"
] | Adds a non-propagating tag to this {@code TagContextBuilder}.
<p>This is equivalent to calling {@code put(key, value,
TagMetadata.create(TagTtl.NO_PROPAGATION))}.
@param key the {@code TagKey} which will be set.
@param value the {@code TagValue} to set for the given key.
@return this
@since 0.21 | [
"Adds",
"a",
"non",
"-",
"propagating",
"tag",
"to",
"this",
"{",
"@code",
"TagContextBuilder",
"}",
"."
] | train | https://github.com/census-instrumentation/opencensus-java/blob/deefac9bed77e40a2297bff1ca5ec5aa48a5f755/api/src/main/java/io/opencensus/tags/TagContextBuilder.java#L78-L80 |
sirensolutions/siren-join | src/main/java/solutions/siren/join/common/Bytes.java | Bytes.writeBytesRef | public final static void writeBytesRef(BytesRef src, BytesRef dst) {
if (src == null) {
Bytes.writeVInt(dst, 0);
return;
}
Bytes.writeVInt(dst, src.length);
System.arraycopy(src.bytes, src.offset, dst.bytes, dst.offset, src.length);
dst.offset += src.length;
} | java | public final static void writeBytesRef(BytesRef src, BytesRef dst) {
if (src == null) {
Bytes.writeVInt(dst, 0);
return;
}
Bytes.writeVInt(dst, src.length);
System.arraycopy(src.bytes, src.offset, dst.bytes, dst.offset, src.length);
dst.offset += src.length;
} | [
"public",
"final",
"static",
"void",
"writeBytesRef",
"(",
"BytesRef",
"src",
",",
"BytesRef",
"dst",
")",
"{",
"if",
"(",
"src",
"==",
"null",
")",
"{",
"Bytes",
".",
"writeVInt",
"(",
"dst",
",",
"0",
")",
";",
"return",
";",
"}",
"Bytes",
".",
"... | Encodes a {@link BytesRef} into another {@link BytesRef}. Null and empty bytes arrays will be encoded
with a 0.
@see Bytes#readBytesRef(BytesRef, BytesRef) | [
"Encodes",
"a",
"{"
] | train | https://github.com/sirensolutions/siren-join/blob/cba1111b209ce6f72ab7750d5488a573a6c77fe5/src/main/java/solutions/siren/join/common/Bytes.java#L134-L142 |
baasbox/Android-SDK | library/src/main/java/com/baasbox/android/BaasDocument.java | BaasDocument.fetchAll | public static RequestToken fetchAll(String collection, BaasHandler<List<BaasDocument>> handler) {
return fetchAll(collection, null, RequestOptions.DEFAULT, handler);
} | java | public static RequestToken fetchAll(String collection, BaasHandler<List<BaasDocument>> handler) {
return fetchAll(collection, null, RequestOptions.DEFAULT, handler);
} | [
"public",
"static",
"RequestToken",
"fetchAll",
"(",
"String",
"collection",
",",
"BaasHandler",
"<",
"List",
"<",
"BaasDocument",
">",
">",
"handler",
")",
"{",
"return",
"fetchAll",
"(",
"collection",
",",
"null",
",",
"RequestOptions",
".",
"DEFAULT",
",",
... | Asynchronously retrieves the list of documents readable to the user in <code>collection</code>.
@param collection the collection to retrieve not <code>null</code>
@param handler a callback to be invoked with the result of the request
@return a {@link com.baasbox.android.RequestToken} to handle the asynchronous request | [
"Asynchronously",
"retrieves",
"the",
"list",
"of",
"documents",
"readable",
"to",
"the",
"user",
"in",
"<code",
">",
"collection<",
"/",
"code",
">",
"."
] | train | https://github.com/baasbox/Android-SDK/blob/6bb2203246b885b2ad63a7bfaf37c83caf15e0d8/library/src/main/java/com/baasbox/android/BaasDocument.java#L232-L234 |
jenkinsci/jenkins | core/src/main/java/hudson/Util.java | Util.displayIOException | public static void displayIOException(@Nonnull IOException e, @Nonnull TaskListener listener ) {
String msg = getWin32ErrorMessage(e);
if(msg!=null)
listener.getLogger().println(msg);
} | java | public static void displayIOException(@Nonnull IOException e, @Nonnull TaskListener listener ) {
String msg = getWin32ErrorMessage(e);
if(msg!=null)
listener.getLogger().println(msg);
} | [
"public",
"static",
"void",
"displayIOException",
"(",
"@",
"Nonnull",
"IOException",
"e",
",",
"@",
"Nonnull",
"TaskListener",
"listener",
")",
"{",
"String",
"msg",
"=",
"getWin32ErrorMessage",
"(",
"e",
")",
";",
"if",
"(",
"msg",
"!=",
"null",
")",
"li... | On Windows, error messages for IOException aren't very helpful.
This method generates additional user-friendly error message to the listener | [
"On",
"Windows",
"error",
"messages",
"for",
"IOException",
"aren",
"t",
"very",
"helpful",
".",
"This",
"method",
"generates",
"additional",
"user",
"-",
"friendly",
"error",
"message",
"to",
"the",
"listener"
] | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/Util.java#L413-L417 |
Whiley/WhileyCompiler | src/main/java/wyil/transform/VerificationConditionGenerator.java | VerificationConditionGenerator.translateFail | private Context translateFail(WyilFile.Stmt.Fail stmt, Context context) {
Expr condition = new Expr.Constant(new Value.Bool(false));
//
VerificationCondition verificationCondition = new VerificationCondition("possible panic", context.assumptions,
condition, stmt.getParent(WyilFile.Attribute.Span.class));
context.emit(verificationCondition);
//
return null;
} | java | private Context translateFail(WyilFile.Stmt.Fail stmt, Context context) {
Expr condition = new Expr.Constant(new Value.Bool(false));
//
VerificationCondition verificationCondition = new VerificationCondition("possible panic", context.assumptions,
condition, stmt.getParent(WyilFile.Attribute.Span.class));
context.emit(verificationCondition);
//
return null;
} | [
"private",
"Context",
"translateFail",
"(",
"WyilFile",
".",
"Stmt",
".",
"Fail",
"stmt",
",",
"Context",
"context",
")",
"{",
"Expr",
"condition",
"=",
"new",
"Expr",
".",
"Constant",
"(",
"new",
"Value",
".",
"Bool",
"(",
"false",
")",
")",
";",
"//"... | Translate a fail statement. Execution should never reach such a statement.
Hence, we need to emit a verification condition to ensure this is the case.
@param stmt
@param context
@return | [
"Translate",
"a",
"fail",
"statement",
".",
"Execution",
"should",
"never",
"reach",
"such",
"a",
"statement",
".",
"Hence",
"we",
"need",
"to",
"emit",
"a",
"verification",
"condition",
"to",
"ensure",
"this",
"is",
"the",
"case",
"."
] | train | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/transform/VerificationConditionGenerator.java#L824-L832 |
aws/aws-sdk-java | aws-java-sdk-medialive/src/main/java/com/amazonaws/services/medialive/model/StopChannelResult.java | StopChannelResult.withTags | public StopChannelResult withTags(java.util.Map<String, String> tags) {
setTags(tags);
return this;
} | java | public StopChannelResult withTags(java.util.Map<String, String> tags) {
setTags(tags);
return this;
} | [
"public",
"StopChannelResult",
"withTags",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"tags",
")",
"{",
"setTags",
"(",
"tags",
")",
";",
"return",
"this",
";",
"}"
] | A collection of key-value pairs.
@param tags
A collection of key-value pairs.
@return Returns a reference to this object so that method calls can be chained together. | [
"A",
"collection",
"of",
"key",
"-",
"value",
"pairs",
"."
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-medialive/src/main/java/com/amazonaws/services/medialive/model/StopChannelResult.java#L658-L661 |
apache/incubator-gobblin | gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/hive/HiveTargetPathHelper.java | HiveTargetPathHelper.getTargetPath | public Path getTargetPath(Path sourcePath, FileSystem targetFs, Optional<Partition> partition, boolean isConcreteFile) {
if (this.relocateDataFiles) {
Preconditions.checkArgument(this.targetTableRoot.isPresent(), "Must define %s to relocate data files.",
COPY_TARGET_TABLE_ROOT);
Path path = this.targetTableRoot.get();
if (partition.isPresent()) {
path = addPartitionToPath(path, partition.get());
}
if (!isConcreteFile) {
return targetFs.makeQualified(path);
}
return targetFs.makeQualified(new Path(path, sourcePath.getName()));
}
// both prefixs must be present as the same time
// can not used with option {@link #COPY_TARGET_TABLE_ROOT}
if (this.targetTablePrefixTobeReplaced.isPresent() || this.targetTablePrefixReplacement.isPresent()) {
Preconditions.checkState(this.targetTablePrefixTobeReplaced.isPresent(),
String.format("Must specify both %s option and %s option together", COPY_TARGET_TABLE_PREFIX_TOBE_REPLACED,
COPY_TARGET_TABLE_PREFIX_REPLACEMENT));
Preconditions.checkState(this.targetTablePrefixReplacement.isPresent(),
String.format("Must specify both %s option and %s option together", COPY_TARGET_TABLE_PREFIX_TOBE_REPLACED,
COPY_TARGET_TABLE_PREFIX_REPLACEMENT));
Preconditions.checkState(!this.targetTableRoot.isPresent(),
String.format("Can not specify the option %s with option %s ", COPY_TARGET_TABLE_ROOT,
COPY_TARGET_TABLE_PREFIX_REPLACEMENT));
Path targetPathWithoutSchemeAndAuthority =
HiveCopyEntityHelper.replacedPrefix(sourcePath, this.targetTablePrefixTobeReplaced.get(), this.targetTablePrefixReplacement.get());
return targetFs.makeQualified(targetPathWithoutSchemeAndAuthority);
} else if (this.targetTableRoot.isPresent()) {
Preconditions.checkArgument(this.dataset.getTableRootPath().isPresent(),
"Cannot move paths to a new root unless table has exactly one location.");
Preconditions.checkArgument(PathUtils.isAncestor(this.dataset.getTableRootPath().get(), sourcePath),
"When moving paths to a new root, all locations must be descendants of the table root location. "
+ "Table root location: %s, file location: %s.", this.dataset.getTableRootPath(), sourcePath);
Path relativePath = PathUtils.relativizePath(sourcePath, this.dataset.getTableRootPath().get());
return targetFs.makeQualified(new Path(this.targetTableRoot.get(), relativePath));
} else {
return targetFs.makeQualified(PathUtils.getPathWithoutSchemeAndAuthority(sourcePath));
}
} | java | public Path getTargetPath(Path sourcePath, FileSystem targetFs, Optional<Partition> partition, boolean isConcreteFile) {
if (this.relocateDataFiles) {
Preconditions.checkArgument(this.targetTableRoot.isPresent(), "Must define %s to relocate data files.",
COPY_TARGET_TABLE_ROOT);
Path path = this.targetTableRoot.get();
if (partition.isPresent()) {
path = addPartitionToPath(path, partition.get());
}
if (!isConcreteFile) {
return targetFs.makeQualified(path);
}
return targetFs.makeQualified(new Path(path, sourcePath.getName()));
}
// both prefixs must be present as the same time
// can not used with option {@link #COPY_TARGET_TABLE_ROOT}
if (this.targetTablePrefixTobeReplaced.isPresent() || this.targetTablePrefixReplacement.isPresent()) {
Preconditions.checkState(this.targetTablePrefixTobeReplaced.isPresent(),
String.format("Must specify both %s option and %s option together", COPY_TARGET_TABLE_PREFIX_TOBE_REPLACED,
COPY_TARGET_TABLE_PREFIX_REPLACEMENT));
Preconditions.checkState(this.targetTablePrefixReplacement.isPresent(),
String.format("Must specify both %s option and %s option together", COPY_TARGET_TABLE_PREFIX_TOBE_REPLACED,
COPY_TARGET_TABLE_PREFIX_REPLACEMENT));
Preconditions.checkState(!this.targetTableRoot.isPresent(),
String.format("Can not specify the option %s with option %s ", COPY_TARGET_TABLE_ROOT,
COPY_TARGET_TABLE_PREFIX_REPLACEMENT));
Path targetPathWithoutSchemeAndAuthority =
HiveCopyEntityHelper.replacedPrefix(sourcePath, this.targetTablePrefixTobeReplaced.get(), this.targetTablePrefixReplacement.get());
return targetFs.makeQualified(targetPathWithoutSchemeAndAuthority);
} else if (this.targetTableRoot.isPresent()) {
Preconditions.checkArgument(this.dataset.getTableRootPath().isPresent(),
"Cannot move paths to a new root unless table has exactly one location.");
Preconditions.checkArgument(PathUtils.isAncestor(this.dataset.getTableRootPath().get(), sourcePath),
"When moving paths to a new root, all locations must be descendants of the table root location. "
+ "Table root location: %s, file location: %s.", this.dataset.getTableRootPath(), sourcePath);
Path relativePath = PathUtils.relativizePath(sourcePath, this.dataset.getTableRootPath().get());
return targetFs.makeQualified(new Path(this.targetTableRoot.get(), relativePath));
} else {
return targetFs.makeQualified(PathUtils.getPathWithoutSchemeAndAuthority(sourcePath));
}
} | [
"public",
"Path",
"getTargetPath",
"(",
"Path",
"sourcePath",
",",
"FileSystem",
"targetFs",
",",
"Optional",
"<",
"Partition",
">",
"partition",
",",
"boolean",
"isConcreteFile",
")",
"{",
"if",
"(",
"this",
".",
"relocateDataFiles",
")",
"{",
"Preconditions",
... | Compute the target {@link Path} for a file or directory copied by Hive distcp.
<p>
The target locations of data files for this table depend on the values of the resolved table root (e.g.
the value of {@link #COPY_TARGET_TABLE_ROOT} with tokens replaced) and {@link #RELOCATE_DATA_FILES_KEY}:
* if {@link #RELOCATE_DATA_FILES_KEY} is true, then origin file /path/to/file/myFile will be written to
/resolved/table/root/<partition>/myFile
* if {@link #COPY_TARGET_TABLE_PREFIX_TOBE_REPLACED} and {@link #COPY_TARGET_TABLE_PREFIX_REPLACEMENT} are defined,
then the specified prefix in each file will be replaced by the specified replacement.
* otherwise, if the resolved table root is defined (e.g. {@link #COPY_TARGET_TABLE_ROOT} is defined in the
properties), we define:
origin_table_root := the deepest non glob ancestor of table.getSc().getLocation() iff getLocation() points to
a single glob. (e.g. /path/to/*/files -> /path/to). If getLocation() contains none
or multiple globs, job will fail.
relative_path := path of the file relative to origin_table_root. If the path of the file is not a descendant
of origin_table_root, job will fail.
target_path := /resolved/table/root/relative/path
This mode is useful when moving a table with a complicated directory structure to a different base directory.
* otherwise the target is identical to the origin path.
</p>
@param sourcePath Source path to be transformed.
@param targetFs target {@link FileSystem}
@param partition partition this file belongs to.
@param isConcreteFile true if this is a path to an existing file in HDFS. | [
"Compute",
"the",
"target",
"{",
"@link",
"Path",
"}",
"for",
"a",
"file",
"or",
"directory",
"copied",
"by",
"Hive",
"distcp",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/hive/HiveTargetPathHelper.java#L144-L187 |
JOML-CI/JOML | src/org/joml/Intersectionf.java | Intersectionf.intersectLineSegmentTriangle | public static boolean intersectLineSegmentTriangle(Vector3fc p0, Vector3fc p1, Vector3fc v0, Vector3fc v1, Vector3fc v2, float epsilon, Vector3f intersectionPoint) {
return intersectLineSegmentTriangle(p0.x(), p0.y(), p0.z(), p1.x(), p1.y(), p1.z(), v0.x(), v0.y(), v0.z(), v1.x(), v1.y(), v1.z(), v2.x(), v2.y(), v2.z(), epsilon, intersectionPoint);
} | java | public static boolean intersectLineSegmentTriangle(Vector3fc p0, Vector3fc p1, Vector3fc v0, Vector3fc v1, Vector3fc v2, float epsilon, Vector3f intersectionPoint) {
return intersectLineSegmentTriangle(p0.x(), p0.y(), p0.z(), p1.x(), p1.y(), p1.z(), v0.x(), v0.y(), v0.z(), v1.x(), v1.y(), v1.z(), v2.x(), v2.y(), v2.z(), epsilon, intersectionPoint);
} | [
"public",
"static",
"boolean",
"intersectLineSegmentTriangle",
"(",
"Vector3fc",
"p0",
",",
"Vector3fc",
"p1",
",",
"Vector3fc",
"v0",
",",
"Vector3fc",
"v1",
",",
"Vector3fc",
"v2",
",",
"float",
"epsilon",
",",
"Vector3f",
"intersectionPoint",
")",
"{",
"retur... | Determine whether the line segment with the end points <code>p0</code> and <code>p1</code>
intersects the triangle consisting of the three vertices <code>(v0X, v0Y, v0Z)</code>, <code>(v1X, v1Y, v1Z)</code> and <code>(v2X, v2Y, v2Z)</code>,
regardless of the winding order of the triangle or the direction of the line segment between its two end points,
and return the point of intersection.
<p>
Reference: <a href="http://www.graphics.cornell.edu/pubs/1997/MT97.pdf">
Fast, Minimum Storage Ray/Triangle Intersection</a>
@see #intersectLineSegmentTriangle(float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, Vector3f)
@param p0
the line segment's first end point
@param p1
the line segment's second end point
@param v0
the position of the first vertex
@param v1
the position of the second vertex
@param v2
the position of the third vertex
@param epsilon
a small epsilon when testing line segments that are almost parallel to the triangle
@param intersectionPoint
the point of intersection
@return <code>true</code> if the given line segment intersects the triangle; <code>false</code> otherwise | [
"Determine",
"whether",
"the",
"line",
"segment",
"with",
"the",
"end",
"points",
"<code",
">",
"p0<",
"/",
"code",
">",
"and",
"<code",
">",
"p1<",
"/",
"code",
">",
"intersects",
"the",
"triangle",
"consisting",
"of",
"the",
"three",
"vertices",
"<code",... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Intersectionf.java#L3335-L3337 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/JobSchedulesImpl.java | JobSchedulesImpl.updateAsync | public Observable<Void> updateAsync(String jobScheduleId, JobScheduleUpdateParameter jobScheduleUpdateParameter, JobScheduleUpdateOptions jobScheduleUpdateOptions) {
return updateWithServiceResponseAsync(jobScheduleId, jobScheduleUpdateParameter, jobScheduleUpdateOptions).map(new Func1<ServiceResponseWithHeaders<Void, JobScheduleUpdateHeaders>, Void>() {
@Override
public Void call(ServiceResponseWithHeaders<Void, JobScheduleUpdateHeaders> response) {
return response.body();
}
});
} | java | public Observable<Void> updateAsync(String jobScheduleId, JobScheduleUpdateParameter jobScheduleUpdateParameter, JobScheduleUpdateOptions jobScheduleUpdateOptions) {
return updateWithServiceResponseAsync(jobScheduleId, jobScheduleUpdateParameter, jobScheduleUpdateOptions).map(new Func1<ServiceResponseWithHeaders<Void, JobScheduleUpdateHeaders>, Void>() {
@Override
public Void call(ServiceResponseWithHeaders<Void, JobScheduleUpdateHeaders> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"updateAsync",
"(",
"String",
"jobScheduleId",
",",
"JobScheduleUpdateParameter",
"jobScheduleUpdateParameter",
",",
"JobScheduleUpdateOptions",
"jobScheduleUpdateOptions",
")",
"{",
"return",
"updateWithServiceResponseAsync",
"(",
"j... | Updates the properties of the specified job schedule.
This fully replaces all the updatable properties of the job schedule. For example, if the schedule property is not specified with this request, then the Batch service will remove the existing schedule. Changes to a job schedule only impact jobs created by the schedule after the update has taken place; currently running jobs are unaffected.
@param jobScheduleId The ID of the job schedule to update.
@param jobScheduleUpdateParameter The parameters for the request.
@param jobScheduleUpdateOptions Additional parameters for the operation
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponseWithHeaders} object if successful. | [
"Updates",
"the",
"properties",
"of",
"the",
"specified",
"job",
"schedule",
".",
"This",
"fully",
"replaces",
"all",
"the",
"updatable",
"properties",
"of",
"the",
"job",
"schedule",
".",
"For",
"example",
"if",
"the",
"schedule",
"property",
"is",
"not",
"... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/JobSchedulesImpl.java#L1216-L1223 |
Arello-Mobile/Moxy | moxy/src/main/java/com/arellomobile/mvp/PresentersCounter.java | PresentersCounter.injectPresenter | public void injectPresenter(MvpPresenter<?> presenter, String delegateTag) {
Set<String> delegateTags = mConnections.get(presenter);
if (delegateTags == null) {
delegateTags = new HashSet<>();
mConnections.put(presenter, delegateTags);
}
delegateTags.add(delegateTag);
Set<MvpPresenter> presenters = mTags.get(delegateTag);
if (presenters == null) {
presenters = new HashSet<>();
mTags.put(delegateTag, presenters);
}
presenters.add(presenter);
} | java | public void injectPresenter(MvpPresenter<?> presenter, String delegateTag) {
Set<String> delegateTags = mConnections.get(presenter);
if (delegateTags == null) {
delegateTags = new HashSet<>();
mConnections.put(presenter, delegateTags);
}
delegateTags.add(delegateTag);
Set<MvpPresenter> presenters = mTags.get(delegateTag);
if (presenters == null) {
presenters = new HashSet<>();
mTags.put(delegateTag, presenters);
}
presenters.add(presenter);
} | [
"public",
"void",
"injectPresenter",
"(",
"MvpPresenter",
"<",
"?",
">",
"presenter",
",",
"String",
"delegateTag",
")",
"{",
"Set",
"<",
"String",
">",
"delegateTags",
"=",
"mConnections",
".",
"get",
"(",
"presenter",
")",
";",
"if",
"(",
"delegateTags",
... | Save delegate tag when it inject presenter to delegate's object
@param presenter Injected presenter
@param delegateTag Delegate tag | [
"Save",
"delegate",
"tag",
"when",
"it",
"inject",
"presenter",
"to",
"delegate",
"s",
"object"
] | train | https://github.com/Arello-Mobile/Moxy/blob/83c608de22a55864f0cdd8c1eee878e72afa3e71/moxy/src/main/java/com/arellomobile/mvp/PresentersCounter.java#L27-L42 |
OpenLiberty/open-liberty | dev/com.ibm.ws.app.manager.springboot/src/com/ibm/ws/app/manager/springboot/container/config/ConfigElement.java | ConfigElement.setExtraAttribute | public void setExtraAttribute(String name, String value) {
if (extraAttributes == null) {
extraAttributes = new HashMap<QName, Object>();
}
if (value == null) {
extraAttributes.remove(new QName(null, name));
} else {
extraAttributes.put(new QName(null, name), value);
}
} | java | public void setExtraAttribute(String name, String value) {
if (extraAttributes == null) {
extraAttributes = new HashMap<QName, Object>();
}
if (value == null) {
extraAttributes.remove(new QName(null, name));
} else {
extraAttributes.put(new QName(null, name), value);
}
} | [
"public",
"void",
"setExtraAttribute",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"if",
"(",
"extraAttributes",
"==",
"null",
")",
"{",
"extraAttributes",
"=",
"new",
"HashMap",
"<",
"QName",
",",
"Object",
">",
"(",
")",
";",
"}",
"if",
... | Sets an attribute on this element that does not have an explicit setter.
@param name the name
@param value the value | [
"Sets",
"an",
"attribute",
"on",
"this",
"element",
"that",
"does",
"not",
"have",
"an",
"explicit",
"setter",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.app.manager.springboot/src/com/ibm/ws/app/manager/springboot/container/config/ConfigElement.java#L55-L64 |
google/closure-compiler | src/com/google/javascript/jscomp/NodeUtil.java | NodeUtil.getAllVarsDeclaredInFunction | static void getAllVarsDeclaredInFunction(
final Map<String, Var> nameVarMap,
final List<Var> orderedVars,
AbstractCompiler compiler,
ScopeCreator scopeCreator,
final Scope scope) {
checkState(nameVarMap.isEmpty());
checkState(orderedVars.isEmpty());
checkState(scope.isFunctionScope(), scope);
ScopedCallback finder =
new ScopedCallback() {
@Override
public void enterScope(NodeTraversal t) {
Scope currentScope = t.getScope();
for (Var v : currentScope.getVarIterable()) {
nameVarMap.put(v.getName(), v);
orderedVars.add(v);
}
}
@Override
public void exitScope(NodeTraversal t) {}
@Override
public final boolean shouldTraverse(NodeTraversal t, Node n, Node parent) {
// Don't enter any new functions
return !n.isFunction() || n == scope.getRootNode();
}
@Override
public void visit(NodeTraversal t, Node n, Node parent) {}
};
NodeTraversal t = new NodeTraversal(compiler, finder, scopeCreator);
t.traverseAtScope(scope);
} | java | static void getAllVarsDeclaredInFunction(
final Map<String, Var> nameVarMap,
final List<Var> orderedVars,
AbstractCompiler compiler,
ScopeCreator scopeCreator,
final Scope scope) {
checkState(nameVarMap.isEmpty());
checkState(orderedVars.isEmpty());
checkState(scope.isFunctionScope(), scope);
ScopedCallback finder =
new ScopedCallback() {
@Override
public void enterScope(NodeTraversal t) {
Scope currentScope = t.getScope();
for (Var v : currentScope.getVarIterable()) {
nameVarMap.put(v.getName(), v);
orderedVars.add(v);
}
}
@Override
public void exitScope(NodeTraversal t) {}
@Override
public final boolean shouldTraverse(NodeTraversal t, Node n, Node parent) {
// Don't enter any new functions
return !n.isFunction() || n == scope.getRootNode();
}
@Override
public void visit(NodeTraversal t, Node n, Node parent) {}
};
NodeTraversal t = new NodeTraversal(compiler, finder, scopeCreator);
t.traverseAtScope(scope);
} | [
"static",
"void",
"getAllVarsDeclaredInFunction",
"(",
"final",
"Map",
"<",
"String",
",",
"Var",
">",
"nameVarMap",
",",
"final",
"List",
"<",
"Var",
">",
"orderedVars",
",",
"AbstractCompiler",
"compiler",
",",
"ScopeCreator",
"scopeCreator",
",",
"final",
"Sc... | Records a mapping of names to vars of everything reachable in a function. Should only be called
with a function scope. Does not enter new control flow areas aka embedded functions.
@param nameVarMap an empty map that gets populated with the keys being variable names and
values being variable objects
@param orderedVars an empty list that gets populated with variable objects in the order that
they appear in the fn | [
"Records",
"a",
"mapping",
"of",
"names",
"to",
"vars",
"of",
"everything",
"reachable",
"in",
"a",
"function",
".",
"Should",
"only",
"be",
"called",
"with",
"a",
"function",
"scope",
".",
"Does",
"not",
"enter",
"new",
"control",
"flow",
"areas",
"aka",
... | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/NodeUtil.java#L5935-L5972 |
RoaringBitmap/RoaringBitmap | roaringbitmap/src/main/java/org/roaringbitmap/buffer/BufferParallelAggregation.java | BufferParallelAggregation.or | public static MutableRoaringBitmap or(ImmutableRoaringBitmap... bitmaps) {
SortedMap<Short, List<MappeableContainer>> grouped = groupByKey(bitmaps);
short[] keys = new short[grouped.size()];
MappeableContainer[] values = new MappeableContainer[grouped.size()];
List<List<MappeableContainer>> slices = new ArrayList<>(grouped.size());
int i = 0;
for (Map.Entry<Short, List<MappeableContainer>> slice : grouped.entrySet()) {
keys[i++] = slice.getKey();
slices.add(slice.getValue());
}
IntStream.range(0, i)
.parallel()
.forEach(position -> values[position] = or(slices.get(position)));
return new MutableRoaringBitmap(new MutableRoaringArray(keys, values, i));
} | java | public static MutableRoaringBitmap or(ImmutableRoaringBitmap... bitmaps) {
SortedMap<Short, List<MappeableContainer>> grouped = groupByKey(bitmaps);
short[] keys = new short[grouped.size()];
MappeableContainer[] values = new MappeableContainer[grouped.size()];
List<List<MappeableContainer>> slices = new ArrayList<>(grouped.size());
int i = 0;
for (Map.Entry<Short, List<MappeableContainer>> slice : grouped.entrySet()) {
keys[i++] = slice.getKey();
slices.add(slice.getValue());
}
IntStream.range(0, i)
.parallel()
.forEach(position -> values[position] = or(slices.get(position)));
return new MutableRoaringBitmap(new MutableRoaringArray(keys, values, i));
} | [
"public",
"static",
"MutableRoaringBitmap",
"or",
"(",
"ImmutableRoaringBitmap",
"...",
"bitmaps",
")",
"{",
"SortedMap",
"<",
"Short",
",",
"List",
"<",
"MappeableContainer",
">",
">",
"grouped",
"=",
"groupByKey",
"(",
"bitmaps",
")",
";",
"short",
"[",
"]",... | Computes the bitwise union of the input bitmaps
@param bitmaps the input bitmaps
@return the union of the bitmaps | [
"Computes",
"the",
"bitwise",
"union",
"of",
"the",
"input",
"bitmaps"
] | train | https://github.com/RoaringBitmap/RoaringBitmap/blob/b26fd0a1330fd4d2877f4d74feb69ceb812e9efa/roaringbitmap/src/main/java/org/roaringbitmap/buffer/BufferParallelAggregation.java#L169-L183 |
diirt/util | src/main/java/org/epics/util/stats/Ranges.java | Ranges.sum | public static Range sum(Range range1, Range range2) {
if (range1.getMinimum().doubleValue() <= range2.getMinimum().doubleValue()) {
if (range1.getMaximum().doubleValue() >= range2.getMaximum().doubleValue()) {
return range1;
} else {
return range(range1.getMinimum().doubleValue(), range2.getMaximum().doubleValue());
}
} else {
if (range1.getMaximum().doubleValue() >= range2.getMaximum().doubleValue()) {
return range(range2.getMinimum().doubleValue(), range1.getMaximum().doubleValue());
} else {
return range2;
}
}
} | java | public static Range sum(Range range1, Range range2) {
if (range1.getMinimum().doubleValue() <= range2.getMinimum().doubleValue()) {
if (range1.getMaximum().doubleValue() >= range2.getMaximum().doubleValue()) {
return range1;
} else {
return range(range1.getMinimum().doubleValue(), range2.getMaximum().doubleValue());
}
} else {
if (range1.getMaximum().doubleValue() >= range2.getMaximum().doubleValue()) {
return range(range2.getMinimum().doubleValue(), range1.getMaximum().doubleValue());
} else {
return range2;
}
}
} | [
"public",
"static",
"Range",
"sum",
"(",
"Range",
"range1",
",",
"Range",
"range2",
")",
"{",
"if",
"(",
"range1",
".",
"getMinimum",
"(",
")",
".",
"doubleValue",
"(",
")",
"<=",
"range2",
".",
"getMinimum",
"(",
")",
".",
"doubleValue",
"(",
")",
"... | Determines the range that can contain both ranges. If one of the
ranges in contained in the other, the bigger range is returned.
@param range1 a range
@param range2 another range
@return the bigger range | [
"Determines",
"the",
"range",
"that",
"can",
"contain",
"both",
"ranges",
".",
"If",
"one",
"of",
"the",
"ranges",
"in",
"contained",
"in",
"the",
"other",
"the",
"bigger",
"range",
"is",
"returned",
"."
] | train | https://github.com/diirt/util/blob/24aca0a173a635aaf0b78d213a3fee8d4f91c077/src/main/java/org/epics/util/stats/Ranges.java#L84-L99 |
fommil/matrix-toolkits-java | src/main/java/no/uib/cipr/matrix/sparse/Chebyshev.java | Chebyshev.setEigenvalues | public void setEigenvalues(double eigmin, double eigmax) {
this.eigmin = eigmin;
this.eigmax = eigmax;
if (eigmin <= 0)
throw new IllegalArgumentException("eigmin <= 0");
if (eigmax <= 0)
throw new IllegalArgumentException("eigmax <= 0");
if (eigmin > eigmax)
throw new IllegalArgumentException("eigmin > eigmax");
} | java | public void setEigenvalues(double eigmin, double eigmax) {
this.eigmin = eigmin;
this.eigmax = eigmax;
if (eigmin <= 0)
throw new IllegalArgumentException("eigmin <= 0");
if (eigmax <= 0)
throw new IllegalArgumentException("eigmax <= 0");
if (eigmin > eigmax)
throw new IllegalArgumentException("eigmin > eigmax");
} | [
"public",
"void",
"setEigenvalues",
"(",
"double",
"eigmin",
",",
"double",
"eigmax",
")",
"{",
"this",
".",
"eigmin",
"=",
"eigmin",
";",
"this",
".",
"eigmax",
"=",
"eigmax",
";",
"if",
"(",
"eigmin",
"<=",
"0",
")",
"throw",
"new",
"IllegalArgumentExc... | Sets the eigenvalue estimates.
@param eigmin
Smallest eigenvalue. Must be positive
@param eigmax
Largest eigenvalue. Must be positive | [
"Sets",
"the",
"eigenvalue",
"estimates",
"."
] | train | https://github.com/fommil/matrix-toolkits-java/blob/6157618bc86bcda3749af2a60bf869d8f3292960/src/main/java/no/uib/cipr/matrix/sparse/Chebyshev.java#L78-L88 |
Red5/red5-io | src/main/java/org/red5/io/flv/meta/MetaService.java | MetaService.injectMetaData | private static ITag injectMetaData(IMetaData<?, ?> meta, ITag tag) {
IoBuffer bb = IoBuffer.allocate(1000);
bb.setAutoExpand(true);
Output out = new Output(bb);
Serializer.serialize(out, "onMetaData");
Serializer.serialize(out, meta);
IoBuffer tmpBody = out.buf().flip();
int tmpBodySize = out.buf().limit();
int tmpPreviousTagSize = tag.getPreviousTagSize();
return new Tag(IoConstants.TYPE_METADATA, 0, tmpBodySize, tmpBody, tmpPreviousTagSize);
} | java | private static ITag injectMetaData(IMetaData<?, ?> meta, ITag tag) {
IoBuffer bb = IoBuffer.allocate(1000);
bb.setAutoExpand(true);
Output out = new Output(bb);
Serializer.serialize(out, "onMetaData");
Serializer.serialize(out, meta);
IoBuffer tmpBody = out.buf().flip();
int tmpBodySize = out.buf().limit();
int tmpPreviousTagSize = tag.getPreviousTagSize();
return new Tag(IoConstants.TYPE_METADATA, 0, tmpBodySize, tmpBody, tmpPreviousTagSize);
} | [
"private",
"static",
"ITag",
"injectMetaData",
"(",
"IMetaData",
"<",
"?",
",",
"?",
">",
"meta",
",",
"ITag",
"tag",
")",
"{",
"IoBuffer",
"bb",
"=",
"IoBuffer",
".",
"allocate",
"(",
"1000",
")",
";",
"bb",
".",
"setAutoExpand",
"(",
"true",
")",
"... | Injects metadata (other than Cue points) into a tag
@param meta
Metadata
@param tag
Tag
@return New tag with injected metadata | [
"Injects",
"metadata",
"(",
"other",
"than",
"Cue",
"points",
")",
"into",
"a",
"tag"
] | train | https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/flv/meta/MetaService.java#L211-L221 |
apache/incubator-gobblin | gobblin-metrics-libs/gobblin-metrics-base/src/main/java/org/apache/gobblin/metrics/MetricContext.java | MetricContext.addNotificationTarget | public UUID addNotificationTarget(Function<Notification, Void> target) {
UUID uuid = UUID.randomUUID();
if(this.notificationTargets.containsKey(uuid)) {
throw new RuntimeException("Failed to create notification target.");
}
this.notificationTargets.put(uuid, target);
return uuid;
} | java | public UUID addNotificationTarget(Function<Notification, Void> target) {
UUID uuid = UUID.randomUUID();
if(this.notificationTargets.containsKey(uuid)) {
throw new RuntimeException("Failed to create notification target.");
}
this.notificationTargets.put(uuid, target);
return uuid;
} | [
"public",
"UUID",
"addNotificationTarget",
"(",
"Function",
"<",
"Notification",
",",
"Void",
">",
"target",
")",
"{",
"UUID",
"uuid",
"=",
"UUID",
".",
"randomUUID",
"(",
")",
";",
"if",
"(",
"this",
".",
"notificationTargets",
".",
"containsKey",
"(",
"u... | Add a target for {@link org.apache.gobblin.metrics.notification.Notification}s.
@param target A {@link com.google.common.base.Function} that will be run every time
there is a new {@link org.apache.gobblin.metrics.notification.Notification} in this context.
@return a key for this notification target. Can be used to remove the notification target later. | [
"Add",
"a",
"target",
"for",
"{"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-metrics-libs/gobblin-metrics-base/src/main/java/org/apache/gobblin/metrics/MetricContext.java#L581-L591 |
tvbarthel/Cheerleader | library/src/main/java/fr/tvbarthel/cheerleader/library/offline/OfflinerQueryHandler.java | OfflinerQueryHandler.put | public void put(String url, String result) {
if (TextUtils.isEmpty(url)) {
return;
}
ContentValues contentValues = new ContentValues();
contentValues.put(OfflinerDBHelper.REQUEST_RESULT, result);
contentValues.put(OfflinerDBHelper.REQUEST_URL, url);
contentValues.put(OfflinerDBHelper.REQUEST_TIMESTAMP, Calendar.getInstance().getTime().getTime());
this.startQuery(
TOKEN_CHECK_SAVED_STATUS,
contentValues,
getUri(OfflinerDBHelper.TABLE_CACHE),
OfflinerDBHelper.PARAMS_CACHE,
OfflinerDBHelper.REQUEST_URL + " = '" + url + "'",
null,
null
);
} | java | public void put(String url, String result) {
if (TextUtils.isEmpty(url)) {
return;
}
ContentValues contentValues = new ContentValues();
contentValues.put(OfflinerDBHelper.REQUEST_RESULT, result);
contentValues.put(OfflinerDBHelper.REQUEST_URL, url);
contentValues.put(OfflinerDBHelper.REQUEST_TIMESTAMP, Calendar.getInstance().getTime().getTime());
this.startQuery(
TOKEN_CHECK_SAVED_STATUS,
contentValues,
getUri(OfflinerDBHelper.TABLE_CACHE),
OfflinerDBHelper.PARAMS_CACHE,
OfflinerDBHelper.REQUEST_URL + " = '" + url + "'",
null,
null
);
} | [
"public",
"void",
"put",
"(",
"String",
"url",
",",
"String",
"result",
")",
"{",
"if",
"(",
"TextUtils",
".",
"isEmpty",
"(",
"url",
")",
")",
"{",
"return",
";",
"}",
"ContentValues",
"contentValues",
"=",
"new",
"ContentValues",
"(",
")",
";",
"cont... | Save a result for offline access.
@param url key.
@param result value. | [
"Save",
"a",
"result",
"for",
"offline",
"access",
"."
] | train | https://github.com/tvbarthel/Cheerleader/blob/f61527e4cc44fcd0ed2e1e98aca285f8c236f24e/library/src/main/java/fr/tvbarthel/cheerleader/library/offline/OfflinerQueryHandler.java#L146-L165 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/util/TreeUtil.java | TreeUtil.getRoot | public static WComponent getRoot(final UIContext uic, final WComponent comp) {
UIContextHolder.pushContext(uic);
try {
return WebUtilities.getTop(comp);
} finally {
UIContextHolder.popContext();
}
} | java | public static WComponent getRoot(final UIContext uic, final WComponent comp) {
UIContextHolder.pushContext(uic);
try {
return WebUtilities.getTop(comp);
} finally {
UIContextHolder.popContext();
}
} | [
"public",
"static",
"WComponent",
"getRoot",
"(",
"final",
"UIContext",
"uic",
",",
"final",
"WComponent",
"comp",
")",
"{",
"UIContextHolder",
".",
"pushContext",
"(",
"uic",
")",
";",
"try",
"{",
"return",
"WebUtilities",
".",
"getTop",
"(",
"comp",
")",
... | Retrieves the root component of a WComponent hierarchy.
@param uic the context to retrieve the root component for.
@param comp a component in the tree.
@return the root of the tree. | [
"Retrieves",
"the",
"root",
"component",
"of",
"a",
"WComponent",
"hierarchy",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/util/TreeUtil.java#L72-L80 |
alkacon/opencms-core | src/org/opencms/main/A_CmsAuthorizationHandler.java | A_CmsAuthorizationHandler.registerSession | protected CmsObject registerSession(HttpServletRequest request, CmsObject cms) throws CmsException {
if (!cms.getRequestContext().getCurrentUser().isGuestUser()) {
// make sure we have a new session after login for security reasons
HttpSession session = request.getSession(false);
if (session != null) {
session.invalidate();
}
session = request.getSession(true);
}
// update the request context
cms = OpenCmsCore.getInstance().updateContext(request, cms);
CmsUser user = cms.getRequestContext().getCurrentUser();
if (!user.isGuestUser() && !OpenCms.getDefaultUsers().isUserExport(user.getName())) {
// create the session info object, only for 'real' users
CmsSessionInfo sessionInfo = new CmsSessionInfo(
cms.getRequestContext(),
new CmsUUID(),
request.getSession().getMaxInactiveInterval());
// register the updated cms object in the session manager
OpenCmsCore.getInstance().getSessionManager().addSessionInfo(sessionInfo);
}
// return the updated cms object
return cms;
} | java | protected CmsObject registerSession(HttpServletRequest request, CmsObject cms) throws CmsException {
if (!cms.getRequestContext().getCurrentUser().isGuestUser()) {
// make sure we have a new session after login for security reasons
HttpSession session = request.getSession(false);
if (session != null) {
session.invalidate();
}
session = request.getSession(true);
}
// update the request context
cms = OpenCmsCore.getInstance().updateContext(request, cms);
CmsUser user = cms.getRequestContext().getCurrentUser();
if (!user.isGuestUser() && !OpenCms.getDefaultUsers().isUserExport(user.getName())) {
// create the session info object, only for 'real' users
CmsSessionInfo sessionInfo = new CmsSessionInfo(
cms.getRequestContext(),
new CmsUUID(),
request.getSession().getMaxInactiveInterval());
// register the updated cms object in the session manager
OpenCmsCore.getInstance().getSessionManager().addSessionInfo(sessionInfo);
}
// return the updated cms object
return cms;
} | [
"protected",
"CmsObject",
"registerSession",
"(",
"HttpServletRequest",
"request",
",",
"CmsObject",
"cms",
")",
"throws",
"CmsException",
"{",
"if",
"(",
"!",
"cms",
".",
"getRequestContext",
"(",
")",
".",
"getCurrentUser",
"(",
")",
".",
"isGuestUser",
"(",
... | Registers the current session with OpenCms.<p>
@param request the current request
@param cms the cms object to register
@return the updated cms context
@throws CmsException if something goes wrong | [
"Registers",
"the",
"current",
"session",
"with",
"OpenCms",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/main/A_CmsAuthorizationHandler.java#L90-L116 |
auth0/java-jwt | lib/src/main/java/com/auth0/jwt/algorithms/CryptoHelper.java | CryptoHelper.verifySignatureFor | boolean verifySignatureFor(String algorithm, PublicKey publicKey, byte[] headerBytes, byte[] payloadBytes, byte[] signatureBytes) throws NoSuchAlgorithmException, InvalidKeyException, SignatureException {
final Signature s = Signature.getInstance(algorithm);
s.initVerify(publicKey);
s.update(headerBytes);
s.update(JWT_PART_SEPARATOR);
s.update(payloadBytes);
return s.verify(signatureBytes);
} | java | boolean verifySignatureFor(String algorithm, PublicKey publicKey, byte[] headerBytes, byte[] payloadBytes, byte[] signatureBytes) throws NoSuchAlgorithmException, InvalidKeyException, SignatureException {
final Signature s = Signature.getInstance(algorithm);
s.initVerify(publicKey);
s.update(headerBytes);
s.update(JWT_PART_SEPARATOR);
s.update(payloadBytes);
return s.verify(signatureBytes);
} | [
"boolean",
"verifySignatureFor",
"(",
"String",
"algorithm",
",",
"PublicKey",
"publicKey",
",",
"byte",
"[",
"]",
"headerBytes",
",",
"byte",
"[",
"]",
"payloadBytes",
",",
"byte",
"[",
"]",
"signatureBytes",
")",
"throws",
"NoSuchAlgorithmException",
",",
"Inv... | Verify signature for JWT header and payload using a public key.
@param algorithm algorithm name.
@param publicKey the public key to use for verification.
@param headerBytes JWT header.
@param payloadBytes JWT payload.
@param signatureBytes JWT signature.
@return true if signature is valid.
@throws NoSuchAlgorithmException if the algorithm is not supported.
@throws InvalidKeyException if the given key is inappropriate for initializing the specified algorithm. | [
"Verify",
"signature",
"for",
"JWT",
"header",
"and",
"payload",
"using",
"a",
"public",
"key",
"."
] | train | https://github.com/auth0/java-jwt/blob/890538970a9699b7251a4bfe4f26e8d7605ad530/lib/src/main/java/com/auth0/jwt/algorithms/CryptoHelper.java#L97-L104 |
TNG/JGiven | jgiven-core/src/main/java/com/tngtech/jgiven/report/config/ConfigOptionParser.java | ConfigOptionParser.commandLineLookup | private boolean commandLineLookup( String arg, ConfigOption co, List<ConfigOption> configList ) {
if( arg.startsWith( co.getCommandLineOption().getLongFlag() ) || ( co.getCommandLineOption().hasShortFlag() && arg
.startsWith( co.getCommandLineOption().getShortFlag() ) ) ) {
if( co.getCommandLineOption().hasArgument() ) {
String[] formatArgs = arg.split( co.getCommandLineOption().getDelimiter() );
if( formatArgs.length < 2 ) {
System.err.println( "Anticipated argument after " + co.getCommandLineOption().showFlagInfo() + ", terminating." );
printUsageAndExit( configList );
}
Object value = co.toObject( formatArgs[1] );
if( value == null ) {
System.err
.println( "Parse error for flag " + co.getCommandLineOption().showFlagInfo() + " got " + formatArgs[1] );
printUsageAndExit( configList );
}
log.debug( "setting the argument value: " + co.getLongName() + " to " + value );
parsedOptions.put( co.getLongName(), value );
} else {
log.debug( "setting the default value of " + co.getLongName() + " to " + co.getValue() );
parsedOptions.put( co.getLongName(), co.getValue() );
}
return true;
}
return false;
} | java | private boolean commandLineLookup( String arg, ConfigOption co, List<ConfigOption> configList ) {
if( arg.startsWith( co.getCommandLineOption().getLongFlag() ) || ( co.getCommandLineOption().hasShortFlag() && arg
.startsWith( co.getCommandLineOption().getShortFlag() ) ) ) {
if( co.getCommandLineOption().hasArgument() ) {
String[] formatArgs = arg.split( co.getCommandLineOption().getDelimiter() );
if( formatArgs.length < 2 ) {
System.err.println( "Anticipated argument after " + co.getCommandLineOption().showFlagInfo() + ", terminating." );
printUsageAndExit( configList );
}
Object value = co.toObject( formatArgs[1] );
if( value == null ) {
System.err
.println( "Parse error for flag " + co.getCommandLineOption().showFlagInfo() + " got " + formatArgs[1] );
printUsageAndExit( configList );
}
log.debug( "setting the argument value: " + co.getLongName() + " to " + value );
parsedOptions.put( co.getLongName(), value );
} else {
log.debug( "setting the default value of " + co.getLongName() + " to " + co.getValue() );
parsedOptions.put( co.getLongName(), co.getValue() );
}
return true;
}
return false;
} | [
"private",
"boolean",
"commandLineLookup",
"(",
"String",
"arg",
",",
"ConfigOption",
"co",
",",
"List",
"<",
"ConfigOption",
">",
"configList",
")",
"{",
"if",
"(",
"arg",
".",
"startsWith",
"(",
"co",
".",
"getCommandLineOption",
"(",
")",
".",
"getLongFla... | Compares the argument with the {@link CommandLineOption} flags and inserts an object into the parsedOptions map
Terminates with a sane help message if a parse is unsuccessful
@param arg the current word from the command line argument list
@param co the config option to look for in the argument
@param configList the global config list, used to create a sane help message if the parse fails | [
"Compares",
"the",
"argument",
"with",
"the",
"{",
"@link",
"CommandLineOption",
"}",
"flags",
"and",
"inserts",
"an",
"object",
"into",
"the",
"parsedOptions",
"map",
"Terminates",
"with",
"a",
"sane",
"help",
"message",
"if",
"a",
"parse",
"is",
"unsuccessfu... | train | https://github.com/TNG/JGiven/blob/1a69248fc6d7eb380cdc4542e3be273842889748/jgiven-core/src/main/java/com/tngtech/jgiven/report/config/ConfigOptionParser.java#L111-L141 |
m-m-m/util | pojopath/src/main/java/net/sf/mmm/util/pojo/path/base/AbstractPojoPathNavigator.java | AbstractPojoPathNavigator.getFromFunction | @SuppressWarnings({ "unchecked", "rawtypes" })
protected Object getFromFunction(CachingPojoPath currentPath, PojoPathContext context, PojoPathState state, PojoPathFunction function) {
Object parentPojo = currentPath.parent.pojo;
// TODO: convert parentPojo from parentPojoType to function.getInputClass()
// if necessary.
Object result = function.get(parentPojo, currentPath.getFunction(), context);
if ((result == null) && (state.mode == PojoPathMode.CREATE_IF_NULL)) {
result = function.create(parentPojo, currentPath.getFunction(), context);
if (result == null) {
throw new PojoPathCreationException(state.rootPath.pojo, currentPath.getPojoPath());
}
}
if (!function.isDeterministic()) {
state.setCachingDisabled();
}
return result;
} | java | @SuppressWarnings({ "unchecked", "rawtypes" })
protected Object getFromFunction(CachingPojoPath currentPath, PojoPathContext context, PojoPathState state, PojoPathFunction function) {
Object parentPojo = currentPath.parent.pojo;
// TODO: convert parentPojo from parentPojoType to function.getInputClass()
// if necessary.
Object result = function.get(parentPojo, currentPath.getFunction(), context);
if ((result == null) && (state.mode == PojoPathMode.CREATE_IF_NULL)) {
result = function.create(parentPojo, currentPath.getFunction(), context);
if (result == null) {
throw new PojoPathCreationException(state.rootPath.pojo, currentPath.getPojoPath());
}
}
if (!function.isDeterministic()) {
state.setCachingDisabled();
}
return result;
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"unchecked\"",
",",
"\"rawtypes\"",
"}",
")",
"protected",
"Object",
"getFromFunction",
"(",
"CachingPojoPath",
"currentPath",
",",
"PojoPathContext",
"context",
",",
"PojoPathState",
"state",
",",
"PojoPathFunction",
"function",
"... | This method {@link PojoPathFunction#get(Object, String, PojoPathContext) gets} the single
{@link CachingPojoPath#getSegment() segment} of the given {@code currentPath} from the
{@link net.sf.mmm.util.pojo.api.Pojo} given by {@code parentPojo}. If the result is {@code null} and
{@link PojoPathState#getMode() mode} is {@link PojoPathMode#CREATE_IF_NULL} it
{@link PojoPathFunction#create(Object, String, PojoPathContext) creates} the missing object.
@param currentPath is the current {@link CachingPojoPath} to evaluate.
@param context is the {@link PojoPathContext context} for this operation.
@param state is the {@link #createState(Object, String, PojoPathMode, PojoPathContext) state} of this operation.
@param function is the {@link PojoPathFunction} for evaluation.
@return the result of the evaluation. It might be {@code null} according to the {@link PojoPathState#getMode()
mode}. | [
"This",
"method",
"{",
"@link",
"PojoPathFunction#get",
"(",
"Object",
"String",
"PojoPathContext",
")",
"gets",
"}",
"the",
"single",
"{",
"@link",
"CachingPojoPath#getSegment",
"()",
"segment",
"}",
"of",
"the",
"given",
"{",
"@code",
"currentPath",
"}",
"from... | train | https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/pojopath/src/main/java/net/sf/mmm/util/pojo/path/base/AbstractPojoPathNavigator.java#L463-L480 |
xdcrafts/flower | flower-tools/src/main/java/com/github/xdcrafts/flower/tools/map/MapApi.java | MapApi.getStringUnsafe | public static String getStringUnsafe(final Map map, final Object... path) {
return getUnsafe(map, String.class, path);
} | java | public static String getStringUnsafe(final Map map, final Object... path) {
return getUnsafe(map, String.class, path);
} | [
"public",
"static",
"String",
"getStringUnsafe",
"(",
"final",
"Map",
"map",
",",
"final",
"Object",
"...",
"path",
")",
"{",
"return",
"getUnsafe",
"(",
"map",
",",
"String",
".",
"class",
",",
"path",
")",
";",
"}"
] | Get string value by path.
@param map subject
@param path nodes to walk in map
@return value | [
"Get",
"string",
"value",
"by",
"path",
"."
] | train | https://github.com/xdcrafts/flower/blob/96a8e49102fea434bd383a3c7852f0ee9545f999/flower-tools/src/main/java/com/github/xdcrafts/flower/tools/map/MapApi.java#L187-L189 |
VoltDB/voltdb | src/frontend/org/voltdb/expressions/SelectSubqueryExpression.java | SelectSubqueryExpression.resolveCorrelations | public void resolveCorrelations() {
AbstractParsedStmt subqueryStmt = m_subquery.getSubqueryStmt();
AbstractParsedStmt parentStmt = subqueryStmt.m_parentStmt;
// we must have a parent - it's a subquery statement
assert(parentStmt != null);
// Preserve indexes of all parameters this subquery depends on.
// It might include parameters from its nested child subqueries that
// the subquery statement could not resolve itself and had to "move up".
m_allParameterIdxList.addAll(subqueryStmt.m_parameterTveMap.keySet());
for (Map.Entry<Integer, AbstractExpression> entry : subqueryStmt.m_parameterTveMap.entrySet()) {
Integer paramIdx = entry.getKey();
AbstractExpression expr = entry.getValue();
if (expr instanceof TupleValueExpression) {
TupleValueExpression tve = (TupleValueExpression) expr;
if (tve.getOrigStmtId() == parentStmt.getStmtId()) {
// TVE originates from the statement that this SubqueryExpression belongs to
addArgumentParameter(paramIdx, expr);
}
else {
// TVE originates from a statement above this parent. Move it up.
parentStmt.m_parameterTveMap.put(paramIdx, expr);
}
}
else if (expr instanceof AggregateExpression) {
// An aggregate expression is always from THIS parent statement.
addArgumentParameter(paramIdx, expr);
}
else {
// so far it should be either AggregateExpression or TupleValueExpression types
assert(false);
}
}
subqueryStmt.m_parameterTveMap.clear();
} | java | public void resolveCorrelations() {
AbstractParsedStmt subqueryStmt = m_subquery.getSubqueryStmt();
AbstractParsedStmt parentStmt = subqueryStmt.m_parentStmt;
// we must have a parent - it's a subquery statement
assert(parentStmt != null);
// Preserve indexes of all parameters this subquery depends on.
// It might include parameters from its nested child subqueries that
// the subquery statement could not resolve itself and had to "move up".
m_allParameterIdxList.addAll(subqueryStmt.m_parameterTveMap.keySet());
for (Map.Entry<Integer, AbstractExpression> entry : subqueryStmt.m_parameterTveMap.entrySet()) {
Integer paramIdx = entry.getKey();
AbstractExpression expr = entry.getValue();
if (expr instanceof TupleValueExpression) {
TupleValueExpression tve = (TupleValueExpression) expr;
if (tve.getOrigStmtId() == parentStmt.getStmtId()) {
// TVE originates from the statement that this SubqueryExpression belongs to
addArgumentParameter(paramIdx, expr);
}
else {
// TVE originates from a statement above this parent. Move it up.
parentStmt.m_parameterTveMap.put(paramIdx, expr);
}
}
else if (expr instanceof AggregateExpression) {
// An aggregate expression is always from THIS parent statement.
addArgumentParameter(paramIdx, expr);
}
else {
// so far it should be either AggregateExpression or TupleValueExpression types
assert(false);
}
}
subqueryStmt.m_parameterTveMap.clear();
} | [
"public",
"void",
"resolveCorrelations",
"(",
")",
"{",
"AbstractParsedStmt",
"subqueryStmt",
"=",
"m_subquery",
".",
"getSubqueryStmt",
"(",
")",
";",
"AbstractParsedStmt",
"parentStmt",
"=",
"subqueryStmt",
".",
"m_parentStmt",
";",
"// we must have a parent - it's a su... | Resolve the subquery's correlated TVEs (and, in one special case, aggregates)
that became ParameterValueExpressions in the subquery statement (or its children).
If they reference a column from the parent statement (getOrigStmtId() == parentStmt.m_stmtId)
that PVE will have to be initialized by this subquery expression in the back-end executor.
Otherwise, the TVE references a grandparent statement with its own subquery expression,
so just add it to the parent statement's set of correlated TVEs needing to be resolved later
at a higher level. | [
"Resolve",
"the",
"subquery",
"s",
"correlated",
"TVEs",
"(",
"and",
"in",
"one",
"special",
"case",
"aggregates",
")",
"that",
"became",
"ParameterValueExpressions",
"in",
"the",
"subquery",
"statement",
"(",
"or",
"its",
"children",
")",
".",
"If",
"they",
... | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/expressions/SelectSubqueryExpression.java#L238-L272 |
OpenLiberty/open-liberty | dev/com.ibm.ws.concurrent.mp.1.0/src/com/ibm/ws/concurrent/mp/ManagedCompletableFuture.java | ManagedCompletableFuture.runAsync | @Trivial
public static CompletableFuture<Void> runAsync(Runnable action) {
throw new UnsupportedOperationException(Tr.formatMessage(tc, "CWWKC1156.not.supported", "ManagedExecutor.runAsync"));
} | java | @Trivial
public static CompletableFuture<Void> runAsync(Runnable action) {
throw new UnsupportedOperationException(Tr.formatMessage(tc, "CWWKC1156.not.supported", "ManagedExecutor.runAsync"));
} | [
"@",
"Trivial",
"public",
"static",
"CompletableFuture",
"<",
"Void",
">",
"runAsync",
"(",
"Runnable",
"action",
")",
"{",
"throw",
"new",
"UnsupportedOperationException",
"(",
"Tr",
".",
"formatMessage",
"(",
"tc",
",",
"\"CWWKC1156.not.supported\"",
",",
"\"Man... | Because CompletableFuture.runAsync is static, this is not a true override.
It will be difficult for the user to invoke this method because they would need to get the class
of the CompletableFuture implementation and locate the static runAsync method on that.
@throws UnsupportedOperationException directing the user to use the ManagedExecutor spec interface instead. | [
"Because",
"CompletableFuture",
".",
"runAsync",
"is",
"static",
"this",
"is",
"not",
"a",
"true",
"override",
".",
"It",
"will",
"be",
"difficult",
"for",
"the",
"user",
"to",
"invoke",
"this",
"method",
"because",
"they",
"would",
"need",
"to",
"get",
"t... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.concurrent.mp.1.0/src/com/ibm/ws/concurrent/mp/ManagedCompletableFuture.java#L438-L441 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java | JavacProcessingEnvironment.handleException | private void handleException(String key, Exception e) {
if (e != null) {
log.error(key, e.getLocalizedMessage());
throw new Abort(e);
} else {
log.error(key);
throw new Abort();
}
} | java | private void handleException(String key, Exception e) {
if (e != null) {
log.error(key, e.getLocalizedMessage());
throw new Abort(e);
} else {
log.error(key);
throw new Abort();
}
} | [
"private",
"void",
"handleException",
"(",
"String",
"key",
",",
"Exception",
"e",
")",
"{",
"if",
"(",
"e",
"!=",
"null",
")",
"{",
"log",
".",
"error",
"(",
"key",
",",
"e",
".",
"getLocalizedMessage",
"(",
")",
")",
";",
"throw",
"new",
"Abort",
... | Handle a security exception thrown during initializing the
Processor iterator. | [
"Handle",
"a",
"security",
"exception",
"thrown",
"during",
"initializing",
"the",
"Processor",
"iterator",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java#L384-L392 |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/modules/v/vectorize/OmsVectorizer.java | OmsVectorizer.doVectorize | @SuppressWarnings("unchecked")
private Collection<Polygon> doVectorize( RenderedImage src, Map<String, Object> args ) {
ParameterBlockJAI pb = new ParameterBlockJAI("Vectorize");
pb.setSource("source0", src);
// Set any parameters that were passed in
for( Entry<String, Object> e : args.entrySet() ) {
pb.setParameter(e.getKey(), e.getValue());
}
// Get the desintation image: this is the unmodified source image data
// plus a property for the generated vectors
RenderedOp dest = JAI.create("Vectorize", pb);
// Get the vectors
Object property = dest.getProperty(VectorizeDescriptor.VECTOR_PROPERTY_NAME);
return (Collection<Polygon>) property;
} | java | @SuppressWarnings("unchecked")
private Collection<Polygon> doVectorize( RenderedImage src, Map<String, Object> args ) {
ParameterBlockJAI pb = new ParameterBlockJAI("Vectorize");
pb.setSource("source0", src);
// Set any parameters that were passed in
for( Entry<String, Object> e : args.entrySet() ) {
pb.setParameter(e.getKey(), e.getValue());
}
// Get the desintation image: this is the unmodified source image data
// plus a property for the generated vectors
RenderedOp dest = JAI.create("Vectorize", pb);
// Get the vectors
Object property = dest.getProperty(VectorizeDescriptor.VECTOR_PROPERTY_NAME);
return (Collection<Polygon>) property;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"Collection",
"<",
"Polygon",
">",
"doVectorize",
"(",
"RenderedImage",
"src",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"args",
")",
"{",
"ParameterBlockJAI",
"pb",
"=",
"new",
"ParameterBloc... | Helper function to run the Vectorize operation with given parameters and
retrieve the vectors.
@param src the source image
@param args a {@code Map} of parameter names and values
@return the generated vectors as JTS Polygons | [
"Helper",
"function",
"to",
"run",
"the",
"Vectorize",
"operation",
"with",
"given",
"parameters",
"and",
"retrieve",
"the",
"vectors",
"."
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/modules/v/vectorize/OmsVectorizer.java#L331-L348 |
rampatra/jbot | jbot-example/src/main/java/example/jbot/slack/SlackBot.java | SlackBot.onReceiveMessage | @Controller(events = EventType.MESSAGE, pattern = "^([a-z ]{2})(\\d+)([a-z ]{2})$")
public void onReceiveMessage(WebSocketSession session, Event event, Matcher matcher) {
reply(session, event, "First group: " + matcher.group(0) + "\n" +
"Second group: " + matcher.group(1) + "\n" +
"Third group: " + matcher.group(2) + "\n" +
"Fourth group: " + matcher.group(3));
} | java | @Controller(events = EventType.MESSAGE, pattern = "^([a-z ]{2})(\\d+)([a-z ]{2})$")
public void onReceiveMessage(WebSocketSession session, Event event, Matcher matcher) {
reply(session, event, "First group: " + matcher.group(0) + "\n" +
"Second group: " + matcher.group(1) + "\n" +
"Third group: " + matcher.group(2) + "\n" +
"Fourth group: " + matcher.group(3));
} | [
"@",
"Controller",
"(",
"events",
"=",
"EventType",
".",
"MESSAGE",
",",
"pattern",
"=",
"\"^([a-z ]{2})(\\\\d+)([a-z ]{2})$\"",
")",
"public",
"void",
"onReceiveMessage",
"(",
"WebSocketSession",
"session",
",",
"Event",
"event",
",",
"Matcher",
"matcher",
")",
"... | Invoked when bot receives an event of type message with text satisfying
the pattern {@code ([a-z ]{2})(\d+)([a-z ]{2})}. For example,
messages like "ab12xy" or "ab2bc" etc will invoke this method.
@param session
@param event | [
"Invoked",
"when",
"bot",
"receives",
"an",
"event",
"of",
"type",
"message",
"with",
"text",
"satisfying",
"the",
"pattern",
"{",
"@code",
"(",
"[",
"a",
"-",
"z",
"]",
"{",
"2",
"}",
")",
"(",
"\\",
"d",
"+",
")",
"(",
"[",
"a",
"-",
"z",
"]"... | train | https://github.com/rampatra/jbot/blob/0f42e1a6ec4dcbc5d1257e1307704903e771f7b5/jbot-example/src/main/java/example/jbot/slack/SlackBot.java#L69-L75 |
zaproxy/zaproxy | src/org/zaproxy/zap/spider/parser/SpiderHtmlFormParser.java | SpiderHtmlFormParser.prepareFormDataSet | private FormData prepareFormDataSet(Source source, Element form) {
List<FormDataField> formDataFields = new LinkedList<>();
// Process each form field
Iterator<FormField> it = getFormFields(source, form).iterator();
while (it.hasNext()) {
FormField field = it.next();
if (log.isDebugEnabled()) {
log.debug("New form field: " + field.getDebugInfo());
}
for (String value : getDefaultTextValue(field)) {
formDataFields
.add(new FormDataField(field.getName(), value, field.getFormControl().getFormControlType().isSubmit()));
}
}
return new FormData(formDataFields);
} | java | private FormData prepareFormDataSet(Source source, Element form) {
List<FormDataField> formDataFields = new LinkedList<>();
// Process each form field
Iterator<FormField> it = getFormFields(source, form).iterator();
while (it.hasNext()) {
FormField field = it.next();
if (log.isDebugEnabled()) {
log.debug("New form field: " + field.getDebugInfo());
}
for (String value : getDefaultTextValue(field)) {
formDataFields
.add(new FormDataField(field.getName(), value, field.getFormControl().getFormControlType().isSubmit()));
}
}
return new FormData(formDataFields);
} | [
"private",
"FormData",
"prepareFormDataSet",
"(",
"Source",
"source",
",",
"Element",
"form",
")",
"{",
"List",
"<",
"FormDataField",
">",
"formDataFields",
"=",
"new",
"LinkedList",
"<>",
"(",
")",
";",
"// Process each form field",
"Iterator",
"<",
"FormField",
... | Prepares the form data set. A form data set is a sequence of control-name/current-value pairs
constructed from successful controls, which will be sent with a GET/POST request for a form.
@see <a href="https://www.w3.org/TR/REC-html40/interact/forms.html#form-data-set">HTML 4.01 Specification - 17.13.3
Processing form data</a>
@see <a href="https://html.spec.whatwg.org/multipage/forms.html#association-of-controls-and-forms">HTML 5 - 4.10.18.3
Association of controls and forms</a>
@param source the source where the form is (to obtain further input elements)
@param form the form
@return the list | [
"Prepares",
"the",
"form",
"data",
"set",
".",
"A",
"form",
"data",
"set",
"is",
"a",
"sequence",
"of",
"control",
"-",
"name",
"/",
"current",
"-",
"value",
"pairs",
"constructed",
"from",
"successful",
"controls",
"which",
"will",
"be",
"sent",
"with",
... | train | https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/spider/parser/SpiderHtmlFormParser.java#L233-L249 |
lucee/Lucee | core/src/main/java/lucee/runtime/tag/Mail.java | Mail.setProxyuser | public void setProxyuser(String proxyuser) throws ApplicationException {
try {
smtp.getProxyData().setUsername(proxyuser);
}
catch (Exception e) {
throw new ApplicationException("attribute [proxyuser] of the tag [mail] is invalid", e.getMessage());
}
} | java | public void setProxyuser(String proxyuser) throws ApplicationException {
try {
smtp.getProxyData().setUsername(proxyuser);
}
catch (Exception e) {
throw new ApplicationException("attribute [proxyuser] of the tag [mail] is invalid", e.getMessage());
}
} | [
"public",
"void",
"setProxyuser",
"(",
"String",
"proxyuser",
")",
"throws",
"ApplicationException",
"{",
"try",
"{",
"smtp",
".",
"getProxyData",
"(",
")",
".",
"setUsername",
"(",
"proxyuser",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"thr... | set the value username When required by a proxy server, a valid username.
@param proxyuser value to set
@throws ApplicationException | [
"set",
"the",
"value",
"username",
"When",
"required",
"by",
"a",
"proxy",
"server",
"a",
"valid",
"username",
"."
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/tag/Mail.java#L155-L162 |
cloudant/java-cloudant | cloudant-client/src/main/java/com/cloudant/client/org/lightcouch/Params.java | Params.replaceOrAdd | public void replaceOrAdd(String name, String value) {
boolean found = false;
for (Param param : params) {
if (param.getKey().equals(name)) {
param.setValue(value);
found = true;
break;
}
}
if (!found) {
addParam(name, value);
}
} | java | public void replaceOrAdd(String name, String value) {
boolean found = false;
for (Param param : params) {
if (param.getKey().equals(name)) {
param.setValue(value);
found = true;
break;
}
}
if (!found) {
addParam(name, value);
}
} | [
"public",
"void",
"replaceOrAdd",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"boolean",
"found",
"=",
"false",
";",
"for",
"(",
"Param",
"param",
":",
"params",
")",
"{",
"if",
"(",
"param",
".",
"getKey",
"(",
")",
".",
"equals",
"(",
... | If this object already contains a parameter whose name matches {@code name}, replace the
existing value with {@code value} for the first instance of parameter {@code name}.
Otherwise, add a parameter with the new {@code name} and {@code value}.
@param name The name of the parameter to replace/add.
@param value The new value of the parameter. | [
"If",
"this",
"object",
"already",
"contains",
"a",
"parameter",
"whose",
"name",
"matches",
"{",
"@code",
"name",
"}",
"replace",
"the",
"existing",
"value",
"with",
"{",
"@code",
"value",
"}",
"for",
"the",
"first",
"instance",
"of",
"parameter",
"{",
"@... | train | https://github.com/cloudant/java-cloudant/blob/42c438654945361bded2cc0827afc046d535b31b/cloudant-client/src/main/java/com/cloudant/client/org/lightcouch/Params.java#L103-L115 |
m-m-m/util | contenttype/src/main/java/net/sf/mmm/util/contenttype/base/ContentTypeList.java | ContentTypeList.collectNodes | private void collectNodes(ContentTypeBean node, Collection<ContentTypeBean> collection) {
collection.add(node);
for (ContentType child : node.getChildren()) {
collectNodes((ContentTypeBean) child, collection);
}
} | java | private void collectNodes(ContentTypeBean node, Collection<ContentTypeBean> collection) {
collection.add(node);
for (ContentType child : node.getChildren()) {
collectNodes((ContentTypeBean) child, collection);
}
} | [
"private",
"void",
"collectNodes",
"(",
"ContentTypeBean",
"node",
",",
"Collection",
"<",
"ContentTypeBean",
">",
"collection",
")",
"{",
"collection",
".",
"add",
"(",
"node",
")",
";",
"for",
"(",
"ContentType",
"child",
":",
"node",
".",
"getChildren",
"... | This method walks down the tree of {@link ContentTypeBean}s recursively adding them to the given {@link Collection}
.
@param node is the current node to traverse.
@param collection is where to {@link Collection#add(Object) add} the {@link ContentTypeBean} objects. | [
"This",
"method",
"walks",
"down",
"the",
"tree",
"of",
"{",
"@link",
"ContentTypeBean",
"}",
"s",
"recursively",
"adding",
"them",
"to",
"the",
"given",
"{",
"@link",
"Collection",
"}",
"."
] | train | https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/contenttype/src/main/java/net/sf/mmm/util/contenttype/base/ContentTypeList.java#L103-L109 |
google/gson | gson/src/main/java/com/google/gson/TypeAdapter.java | TypeAdapter.toJson | public final void toJson(Writer out, T value) throws IOException {
JsonWriter writer = new JsonWriter(out);
write(writer, value);
} | java | public final void toJson(Writer out, T value) throws IOException {
JsonWriter writer = new JsonWriter(out);
write(writer, value);
} | [
"public",
"final",
"void",
"toJson",
"(",
"Writer",
"out",
",",
"T",
"value",
")",
"throws",
"IOException",
"{",
"JsonWriter",
"writer",
"=",
"new",
"JsonWriter",
"(",
"out",
")",
";",
"write",
"(",
"writer",
",",
"value",
")",
";",
"}"
] | Converts {@code value} to a JSON document and writes it to {@code out}.
Unlike Gson's similar {@link Gson#toJson(JsonElement, Appendable) toJson}
method, this write is strict. Create a {@link
JsonWriter#setLenient(boolean) lenient} {@code JsonWriter} and call
{@link #write(com.google.gson.stream.JsonWriter, Object)} for lenient
writing.
@param value the Java object to convert. May be null.
@since 2.2 | [
"Converts",
"{",
"@code",
"value",
"}",
"to",
"a",
"JSON",
"document",
"and",
"writes",
"it",
"to",
"{",
"@code",
"out",
"}",
".",
"Unlike",
"Gson",
"s",
"similar",
"{",
"@link",
"Gson#toJson",
"(",
"JsonElement",
"Appendable",
")",
"toJson",
"}",
"metho... | train | https://github.com/google/gson/blob/63ee47cb642c8018e5cddd639aa2be143220ad4b/gson/src/main/java/com/google/gson/TypeAdapter.java#L140-L143 |
JM-Lab/utils-elasticsearch | src/main/java/kr/jm/utils/elasticsearch/JMElasticsearchSearchAndCount.java | JMElasticsearchSearchAndCount.searchAll | public SearchResponse searchAll(String index, String type) {
return searchAll(JMArrays.buildArray(index), type);
} | java | public SearchResponse searchAll(String index, String type) {
return searchAll(JMArrays.buildArray(index), type);
} | [
"public",
"SearchResponse",
"searchAll",
"(",
"String",
"index",
",",
"String",
"type",
")",
"{",
"return",
"searchAll",
"(",
"JMArrays",
".",
"buildArray",
"(",
"index",
")",
",",
"type",
")",
";",
"}"
] | Search all search response.
@param index the index
@param type the type
@return the search response | [
"Search",
"all",
"search",
"response",
"."
] | train | https://github.com/JM-Lab/utils-elasticsearch/blob/6ccec90e1e51d65d2af5efbb6d7b9f9bad90e638/src/main/java/kr/jm/utils/elasticsearch/JMElasticsearchSearchAndCount.java#L495-L497 |
adorsys/hbci4java-adorsys | src/main/java/org/kapott/hbci/protocol/Message.java | Message.setMsgSizeValue | private void setMsgSizeValue(int value, boolean allowOverwrite) {
String absPath = getPath() + ".MsgHead.msgsize";
SyntaxElement msgsizeElem = getElement(absPath);
if (msgsizeElem == null)
throw new NoSuchPathException(absPath);
int size = ((DE) msgsizeElem).getMinSize();
char[] zeros = new char[size];
Arrays.fill(zeros, '0');
DecimalFormat df = new DecimalFormat(String.valueOf(zeros));
if (!propagateValue(absPath, df.format(value), DONT_TRY_TO_CREATE, allowOverwrite))
throw new NoSuchPathException(absPath);
} | java | private void setMsgSizeValue(int value, boolean allowOverwrite) {
String absPath = getPath() + ".MsgHead.msgsize";
SyntaxElement msgsizeElem = getElement(absPath);
if (msgsizeElem == null)
throw new NoSuchPathException(absPath);
int size = ((DE) msgsizeElem).getMinSize();
char[] zeros = new char[size];
Arrays.fill(zeros, '0');
DecimalFormat df = new DecimalFormat(String.valueOf(zeros));
if (!propagateValue(absPath, df.format(value), DONT_TRY_TO_CREATE, allowOverwrite))
throw new NoSuchPathException(absPath);
} | [
"private",
"void",
"setMsgSizeValue",
"(",
"int",
"value",
",",
"boolean",
"allowOverwrite",
")",
"{",
"String",
"absPath",
"=",
"getPath",
"(",
")",
"+",
"\".MsgHead.msgsize\"",
";",
"SyntaxElement",
"msgsizeElem",
"=",
"getElement",
"(",
"absPath",
")",
";",
... | setzen des feldes "nachrichtengroesse" im nachrichtenkopf einer nachricht | [
"setzen",
"des",
"feldes",
"nachrichtengroesse",
"im",
"nachrichtenkopf",
"einer",
"nachricht"
] | train | https://github.com/adorsys/hbci4java-adorsys/blob/5e24f7e429d6b555e1d993196b4cf1adda6433cf/src/main/java/org/kapott/hbci/protocol/Message.java#L96-L109 |
jbundle/jbundle | base/remote/src/main/java/org/jbundle/base/remote/db/TableSession.java | TableSession.setProperty | public void setProperty(String strProperty, String strValue)
{
Record record = this.getMainRecord();
BaseTable table = record.getTable();
table.setProperty(strProperty, strValue);
} | java | public void setProperty(String strProperty, String strValue)
{
Record record = this.getMainRecord();
BaseTable table = record.getTable();
table.setProperty(strProperty, strValue);
} | [
"public",
"void",
"setProperty",
"(",
"String",
"strProperty",
",",
"String",
"strValue",
")",
"{",
"Record",
"record",
"=",
"this",
".",
"getMainRecord",
"(",
")",
";",
"BaseTable",
"table",
"=",
"record",
".",
"getTable",
"(",
")",
";",
"table",
".",
"... | Set a table property.
@param strProperty The key to set.
@param strValue The value to set it to. | [
"Set",
"a",
"table",
"property",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/remote/src/main/java/org/jbundle/base/remote/db/TableSession.java#L786-L791 |
jirutka/spring-rest-exception-handler | src/main/java/cz/jirutka/spring/exhandler/MapUtils.java | MapUtils.putAllIfAbsent | static <K, V> void putAllIfAbsent(Map<K, V> target, Map<K, V> source) {
for (Map.Entry<K, V> entry : source.entrySet()) {
if (!target.containsKey(entry.getKey())) {
target.put(entry.getKey(), entry.getValue());
}
}
} | java | static <K, V> void putAllIfAbsent(Map<K, V> target, Map<K, V> source) {
for (Map.Entry<K, V> entry : source.entrySet()) {
if (!target.containsKey(entry.getKey())) {
target.put(entry.getKey(), entry.getValue());
}
}
} | [
"static",
"<",
"K",
",",
"V",
">",
"void",
"putAllIfAbsent",
"(",
"Map",
"<",
"K",
",",
"V",
">",
"target",
",",
"Map",
"<",
"K",
",",
"V",
">",
"source",
")",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"K",
",",
"V",
">",
"entry",
":",
"so... | Puts entries from the {@code source} map into the {@code target} map, but without overriding
any existing entry in {@code target} map, i.e. put only if the key does not exist in the
{@code target} map.
@param target The target map where to put new entries.
@param source The source map from which read the entries. | [
"Puts",
"entries",
"from",
"the",
"{",
"@code",
"source",
"}",
"map",
"into",
"the",
"{",
"@code",
"target",
"}",
"map",
"but",
"without",
"overriding",
"any",
"existing",
"entry",
"in",
"{",
"@code",
"target",
"}",
"map",
"i",
".",
"e",
".",
"put",
... | train | https://github.com/jirutka/spring-rest-exception-handler/blob/f171956e59fe866f1a853c7d38444f136acc7a3b/src/main/java/cz/jirutka/spring/exhandler/MapUtils.java#L32-L39 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java | ModelsImpl.updateEntity | public OperationStatus updateEntity(UUID appId, String versionId, UUID entityId, UpdateEntityOptionalParameter updateEntityOptionalParameter) {
return updateEntityWithServiceResponseAsync(appId, versionId, entityId, updateEntityOptionalParameter).toBlocking().single().body();
} | java | public OperationStatus updateEntity(UUID appId, String versionId, UUID entityId, UpdateEntityOptionalParameter updateEntityOptionalParameter) {
return updateEntityWithServiceResponseAsync(appId, versionId, entityId, updateEntityOptionalParameter).toBlocking().single().body();
} | [
"public",
"OperationStatus",
"updateEntity",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"UUID",
"entityId",
",",
"UpdateEntityOptionalParameter",
"updateEntityOptionalParameter",
")",
"{",
"return",
"updateEntityWithServiceResponseAsync",
"(",
"appId",
",",
"v... | Updates the name of an entity extractor.
@param appId The application ID.
@param versionId The version ID.
@param entityId The entity extractor ID.
@param updateEntityOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the OperationStatus object if successful. | [
"Updates",
"the",
"name",
"of",
"an",
"entity",
"extractor",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L3378-L3380 |
trellis-ldp-archive/trellis-http | src/main/java/org/trellisldp/http/impl/GetHandler.java | GetHandler.getRepresentation | public ResponseBuilder getRepresentation(final Resource res) {
final String identifier = getBaseUrl() + req.getPartition() + req.getPath();
// Check if this is already deleted
checkDeleted(res, identifier);
LOGGER.debug("Acceptable media types: {}", req.getHeaders().getAcceptableMediaTypes());
final Optional<RDFSyntax> syntax = getSyntax(req.getHeaders().getAcceptableMediaTypes(), res.getBinary()
.map(b -> b.getMimeType().orElse(APPLICATION_OCTET_STREAM)));
if (ACL.equals(req.getExt()) && !res.hasAcl()) {
throw new NotFoundException();
}
final ResponseBuilder builder = basicGetResponseBuilder(res, syntax);
// Add NonRDFSource-related "describe*" link headers
res.getBinary().ifPresent(ds -> {
if (syntax.isPresent()) {
builder.link(identifier + "#description", "canonical").link(identifier, "describes");
} else {
builder.link(identifier, "canonical").link(identifier + "#description", "describedby")
.type(ds.getMimeType().orElse(APPLICATION_OCTET_STREAM));
}
});
// Only show memento links for the user-managed graph (not ACL)
if (!ACL.equals(req.getExt())) {
builder.link(identifier, "original timegate")
.links(MementoResource.getMementoLinks(identifier, res.getMementos()).toArray(Link[]::new));
}
// URI Template
builder.header(LINK_TEMPLATE, "<" + identifier + "{?version}>; rel=\"" + Memento.Memento.getIRIString() + "\"");
// NonRDFSources responses (strong ETags, etc)
if (res.getBinary().isPresent() && !syntax.isPresent()) {
return getLdpNr(identifier, res, builder);
}
// RDFSource responses (weak ETags, etc)
final RDFSyntax s = syntax.orElse(TURTLE);
final IRI profile = getProfile(req.getHeaders().getAcceptableMediaTypes(), s);
return getLdpRs(identifier, res, builder, s, profile);
} | java | public ResponseBuilder getRepresentation(final Resource res) {
final String identifier = getBaseUrl() + req.getPartition() + req.getPath();
// Check if this is already deleted
checkDeleted(res, identifier);
LOGGER.debug("Acceptable media types: {}", req.getHeaders().getAcceptableMediaTypes());
final Optional<RDFSyntax> syntax = getSyntax(req.getHeaders().getAcceptableMediaTypes(), res.getBinary()
.map(b -> b.getMimeType().orElse(APPLICATION_OCTET_STREAM)));
if (ACL.equals(req.getExt()) && !res.hasAcl()) {
throw new NotFoundException();
}
final ResponseBuilder builder = basicGetResponseBuilder(res, syntax);
// Add NonRDFSource-related "describe*" link headers
res.getBinary().ifPresent(ds -> {
if (syntax.isPresent()) {
builder.link(identifier + "#description", "canonical").link(identifier, "describes");
} else {
builder.link(identifier, "canonical").link(identifier + "#description", "describedby")
.type(ds.getMimeType().orElse(APPLICATION_OCTET_STREAM));
}
});
// Only show memento links for the user-managed graph (not ACL)
if (!ACL.equals(req.getExt())) {
builder.link(identifier, "original timegate")
.links(MementoResource.getMementoLinks(identifier, res.getMementos()).toArray(Link[]::new));
}
// URI Template
builder.header(LINK_TEMPLATE, "<" + identifier + "{?version}>; rel=\"" + Memento.Memento.getIRIString() + "\"");
// NonRDFSources responses (strong ETags, etc)
if (res.getBinary().isPresent() && !syntax.isPresent()) {
return getLdpNr(identifier, res, builder);
}
// RDFSource responses (weak ETags, etc)
final RDFSyntax s = syntax.orElse(TURTLE);
final IRI profile = getProfile(req.getHeaders().getAcceptableMediaTypes(), s);
return getLdpRs(identifier, res, builder, s, profile);
} | [
"public",
"ResponseBuilder",
"getRepresentation",
"(",
"final",
"Resource",
"res",
")",
"{",
"final",
"String",
"identifier",
"=",
"getBaseUrl",
"(",
")",
"+",
"req",
".",
"getPartition",
"(",
")",
"+",
"req",
".",
"getPath",
"(",
")",
";",
"// Check if this... | Build the representation for the given resource
@param res the resource
@return the response builder | [
"Build",
"the",
"representation",
"for",
"the",
"given",
"resource"
] | train | https://github.com/trellis-ldp-archive/trellis-http/blob/bc762f88602c49c2b137a7adf68d576666e55fff/src/main/java/org/trellisldp/http/impl/GetHandler.java#L132-L176 |
xebia-france/xebia-management-extras | src/main/java/fr/xebia/management/statistics/ProfileAspect.java | ProfileAspect.getFullyQualifiedMethodName | protected static String getFullyQualifiedMethodName(String fullyQualifiedClassName, String methodName, ClassNameStyle classNameStyle) {
StringBuilder fullyQualifiedMethodName = new StringBuilder(fullyQualifiedClassName.length() + methodName.length() + 1);
switch (classNameStyle) {
case FULLY_QUALIFIED_NAME:
fullyQualifiedMethodName.append(fullyQualifiedClassName);
break;
case COMPACT_FULLY_QUALIFIED_NAME:
String[] splittedFullyQualifiedName = StringUtils.delimitedListToStringArray(fullyQualifiedClassName, ".");
for (int i = 0; i < splittedFullyQualifiedName.length - 1; i++) {
fullyQualifiedMethodName.append(splittedFullyQualifiedName[i].charAt(0)).append(".");
}
fullyQualifiedMethodName.append(splittedFullyQualifiedName[splittedFullyQualifiedName.length - 1]);
break;
case SHORT_NAME:
fullyQualifiedMethodName.append(StringUtils.unqualify(fullyQualifiedClassName));
break;
default:
// should not occur
fullyQualifiedMethodName.append(fullyQualifiedClassName);
break;
}
fullyQualifiedMethodName.append(".").append(methodName);
return fullyQualifiedMethodName.toString();
} | java | protected static String getFullyQualifiedMethodName(String fullyQualifiedClassName, String methodName, ClassNameStyle classNameStyle) {
StringBuilder fullyQualifiedMethodName = new StringBuilder(fullyQualifiedClassName.length() + methodName.length() + 1);
switch (classNameStyle) {
case FULLY_QUALIFIED_NAME:
fullyQualifiedMethodName.append(fullyQualifiedClassName);
break;
case COMPACT_FULLY_QUALIFIED_NAME:
String[] splittedFullyQualifiedName = StringUtils.delimitedListToStringArray(fullyQualifiedClassName, ".");
for (int i = 0; i < splittedFullyQualifiedName.length - 1; i++) {
fullyQualifiedMethodName.append(splittedFullyQualifiedName[i].charAt(0)).append(".");
}
fullyQualifiedMethodName.append(splittedFullyQualifiedName[splittedFullyQualifiedName.length - 1]);
break;
case SHORT_NAME:
fullyQualifiedMethodName.append(StringUtils.unqualify(fullyQualifiedClassName));
break;
default:
// should not occur
fullyQualifiedMethodName.append(fullyQualifiedClassName);
break;
}
fullyQualifiedMethodName.append(".").append(methodName);
return fullyQualifiedMethodName.toString();
} | [
"protected",
"static",
"String",
"getFullyQualifiedMethodName",
"(",
"String",
"fullyQualifiedClassName",
",",
"String",
"methodName",
",",
"ClassNameStyle",
"classNameStyle",
")",
"{",
"StringBuilder",
"fullyQualifiedMethodName",
"=",
"new",
"StringBuilder",
"(",
"fullyQua... | <p>
Formats the given <code>fullyQualifiedName</code> according to the given
<code>classNameStyle</code>.
</p>
<p>
Samples with <code>java.lang.String</code>:
<ul>
<li>{@link ClassNameStyle#FULLY_QUALIFIED_NAME} :
<code>java.lang.String</code></li>
<li>{@link ClassNameStyle#COMPACT_FULLY_QUALIFIED_NAME} :
<code>j.l.String</code></li>
<li>{@link ClassNameStyle#SHORT_NAME} : <code>String</code></li>
</ul>
</p> | [
"<p",
">",
"Formats",
"the",
"given",
"<code",
">",
"fullyQualifiedName<",
"/",
"code",
">",
"according",
"to",
"the",
"given",
"<code",
">",
"classNameStyle<",
"/",
"code",
">",
".",
"<",
"/",
"p",
">",
"<p",
">",
"Samples",
"with",
"<code",
">",
"jav... | train | https://github.com/xebia-france/xebia-management-extras/blob/09f52a0ddb898e402a04f0adfacda74a5d0556e8/src/main/java/fr/xebia/management/statistics/ProfileAspect.java#L105-L128 |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/shapes/polygon/DetectPolygonFromContour.java | DetectPolygonFromContour.determineCornersOnBorder | void determineCornersOnBorder( Polygon2D_F64 polygon , GrowQueue_B onImageBorder ) {
onImageBorder.reset();
for (int i = 0; i < polygon.size(); i++) {
Point2D_F64 p = polygon.get(i);
onImageBorder.add( p.x <= 1 || p.y <= 1 || p.x >= imageWidth-2 || p.y >= imageHeight-2);
}
} | java | void determineCornersOnBorder( Polygon2D_F64 polygon , GrowQueue_B onImageBorder ) {
onImageBorder.reset();
for (int i = 0; i < polygon.size(); i++) {
Point2D_F64 p = polygon.get(i);
onImageBorder.add( p.x <= 1 || p.y <= 1 || p.x >= imageWidth-2 || p.y >= imageHeight-2);
}
} | [
"void",
"determineCornersOnBorder",
"(",
"Polygon2D_F64",
"polygon",
",",
"GrowQueue_B",
"onImageBorder",
")",
"{",
"onImageBorder",
".",
"reset",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"polygon",
".",
"size",
"(",
")",
";",
"i",... | Check to see if corners are touching the image border
@param polygon Polygon in distorted (original image) pixels
@param onImageBorder storage for corner indexes | [
"Check",
"to",
"see",
"if",
"corners",
"are",
"touching",
"the",
"image",
"border"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/shapes/polygon/DetectPolygonFromContour.java#L442-L449 |
amaembo/streamex | src/main/java/one/util/streamex/EntryStream.java | EntryStream.ofTree | @SuppressWarnings("unchecked")
public static <T, TT extends T> EntryStream<Integer, T> ofTree(T root, Class<TT> collectionClass,
BiFunction<Integer, TT, Stream<T>> mapper) {
return ofTree(root, (d, t) -> collectionClass.isInstance(t) ? mapper.apply(d, (TT) t) : null);
} | java | @SuppressWarnings("unchecked")
public static <T, TT extends T> EntryStream<Integer, T> ofTree(T root, Class<TT> collectionClass,
BiFunction<Integer, TT, Stream<T>> mapper) {
return ofTree(root, (d, t) -> collectionClass.isInstance(t) ? mapper.apply(d, (TT) t) : null);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
",",
"TT",
"extends",
"T",
">",
"EntryStream",
"<",
"Integer",
",",
"T",
">",
"ofTree",
"(",
"T",
"root",
",",
"Class",
"<",
"TT",
">",
"collectionClass",
",",
"BiFunction"... | Return a new {@link EntryStream} containing all the nodes of tree-like
data structure in entry values along with the corresponding tree depths
in entry keys, in depth-first order.
<p>
The keys of the returned stream are non-negative integer numbers. 0 is
used for the root node only, 1 is for root immediate children, 2 is for
their children and so on.
<p>
The streams created by mapper may be automatically
{@link java.util.stream.BaseStream#close() closed} after its contents
already consumed and unnecessary anymore. It's not guaranteed that all
created streams will be closed during the stream terminal operation. If
it's necessary to close all the created streams, call the {@code close()}
method of the resulting stream returned by {@code ofTree()}.
@param <T> the base type of tree nodes
@param <TT> the sub-type of composite tree nodes which may have children
@param root root node of the tree
@param collectionClass a class representing the composite tree node
@param mapper a non-interfering, stateless function to apply to each
composite tree node and its depth which returns stream of direct
children. May return null if the given node has no children.
@return the new sequential ordered stream
@since 0.5.2
@see StreamEx#ofTree(Object, Class, Function)
@see #ofTree(Object, BiFunction) | [
"Return",
"a",
"new",
"{",
"@link",
"EntryStream",
"}",
"containing",
"all",
"the",
"nodes",
"of",
"tree",
"-",
"like",
"data",
"structure",
"in",
"entry",
"values",
"along",
"with",
"the",
"corresponding",
"tree",
"depths",
"in",
"entry",
"keys",
"in",
"d... | train | https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/EntryStream.java#L2126-L2130 |
Netflix/ribbon | ribbon-loadbalancer/src/main/java/com/netflix/client/ClientFactory.java | ClientFactory.instantiateInstanceWithClientConfig | @SuppressWarnings("unchecked")
public static Object instantiateInstanceWithClientConfig(String className, IClientConfig clientConfig)
throws InstantiationException, IllegalAccessException, ClassNotFoundException {
Class clazz = Class.forName(className);
if (IClientConfigAware.class.isAssignableFrom(clazz)) {
IClientConfigAware obj = (IClientConfigAware) clazz.newInstance();
obj.initWithNiwsConfig(clientConfig);
return obj;
} else {
try {
if (clazz.getConstructor(IClientConfig.class) != null) {
return clazz.getConstructor(IClientConfig.class).newInstance(clientConfig);
}
} catch (NoSuchMethodException ignored) {
// OK for a class to not take an IClientConfig
} catch (SecurityException | IllegalArgumentException | InvocationTargetException e) {
logger.warn("Error getting/invoking IClientConfig constructor of {}", className, e);
}
}
logger.warn("Class " + className + " neither implements IClientConfigAware nor provides a constructor with IClientConfig as the parameter. Only default constructor will be used.");
return clazz.newInstance();
} | java | @SuppressWarnings("unchecked")
public static Object instantiateInstanceWithClientConfig(String className, IClientConfig clientConfig)
throws InstantiationException, IllegalAccessException, ClassNotFoundException {
Class clazz = Class.forName(className);
if (IClientConfigAware.class.isAssignableFrom(clazz)) {
IClientConfigAware obj = (IClientConfigAware) clazz.newInstance();
obj.initWithNiwsConfig(clientConfig);
return obj;
} else {
try {
if (clazz.getConstructor(IClientConfig.class) != null) {
return clazz.getConstructor(IClientConfig.class).newInstance(clientConfig);
}
} catch (NoSuchMethodException ignored) {
// OK for a class to not take an IClientConfig
} catch (SecurityException | IllegalArgumentException | InvocationTargetException e) {
logger.warn("Error getting/invoking IClientConfig constructor of {}", className, e);
}
}
logger.warn("Class " + className + " neither implements IClientConfigAware nor provides a constructor with IClientConfig as the parameter. Only default constructor will be used.");
return clazz.newInstance();
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"Object",
"instantiateInstanceWithClientConfig",
"(",
"String",
"className",
",",
"IClientConfig",
"clientConfig",
")",
"throws",
"InstantiationException",
",",
"IllegalAccessException",
",",
"ClassNotF... | Creates instance related to client framework using reflection. It first checks if the object is an instance of
{@link IClientConfigAware} and if so invoke {@link IClientConfigAware#initWithNiwsConfig(IClientConfig)}. If that does not
apply, it tries to find if there is a constructor with {@link IClientConfig} as a parameter and if so invoke that constructor. If neither applies,
it simply invokes the no-arg constructor and ignores the clientConfig parameter.
@param className Class name of the object
@param clientConfig IClientConfig object used for initialization. | [
"Creates",
"instance",
"related",
"to",
"client",
"framework",
"using",
"reflection",
".",
"It",
"first",
"checks",
"if",
"the",
"object",
"is",
"an",
"instance",
"of",
"{",
"@link",
"IClientConfigAware",
"}",
"and",
"if",
"so",
"invoke",
"{",
"@link",
"ICli... | train | https://github.com/Netflix/ribbon/blob/d15cd7715b0bf2f64ae6ca98c5e4d184f178e261/ribbon-loadbalancer/src/main/java/com/netflix/client/ClientFactory.java#L217-L238 |
forge/core | javaee/impl/src/main/java/org/jboss/forge/addon/javaee/rest/generator/impl/RootAndNestedDTOResourceGenerator.java | RootAndNestedDTOResourceGenerator.from | public DTOCollection from(Project project, JavaClass<?> entity, String dtoPackage)
{
DTOCollection dtoCollection = new DTOCollection();
if (entity == null)
{
throw new IllegalArgumentException("The argument entity was null.");
}
generatedDTOGraphForEntity(project, entity, dtoPackage, true, false, dtoCollection);
return dtoCollection;
} | java | public DTOCollection from(Project project, JavaClass<?> entity, String dtoPackage)
{
DTOCollection dtoCollection = new DTOCollection();
if (entity == null)
{
throw new IllegalArgumentException("The argument entity was null.");
}
generatedDTOGraphForEntity(project, entity, dtoPackage, true, false, dtoCollection);
return dtoCollection;
} | [
"public",
"DTOCollection",
"from",
"(",
"Project",
"project",
",",
"JavaClass",
"<",
"?",
">",
"entity",
",",
"String",
"dtoPackage",
")",
"{",
"DTOCollection",
"dtoCollection",
"=",
"new",
"DTOCollection",
"(",
")",
";",
"if",
"(",
"entity",
"==",
"null",
... | Creates a collection of DTOs for the provided JPA entity, and any JPA entities referenced in the JPA entity.
@param entity The JPA entity for which DTOs are to be generated
@param dtoPackage The Java package in which the DTOs are to be created
@return The {@link DTOCollection} containing the DTOs created for the JPA entity. | [
"Creates",
"a",
"collection",
"of",
"DTOs",
"for",
"the",
"provided",
"JPA",
"entity",
"and",
"any",
"JPA",
"entities",
"referenced",
"in",
"the",
"JPA",
"entity",
"."
] | train | https://github.com/forge/core/blob/e140eb03bbe2b3409478ad70c86c3edbef6d9a0c/javaee/impl/src/main/java/org/jboss/forge/addon/javaee/rest/generator/impl/RootAndNestedDTOResourceGenerator.java#L121-L130 |
line/armeria | core/src/main/java/com/linecorp/armeria/server/composition/AbstractCompositeServiceBuilder.java | AbstractCompositeServiceBuilder.serviceUnder | protected T serviceUnder(String pathPrefix, Service<I, O> service) {
return service(CompositeServiceEntry.ofPrefix(pathPrefix, service));
} | java | protected T serviceUnder(String pathPrefix, Service<I, O> service) {
return service(CompositeServiceEntry.ofPrefix(pathPrefix, service));
} | [
"protected",
"T",
"serviceUnder",
"(",
"String",
"pathPrefix",
",",
"Service",
"<",
"I",
",",
"O",
">",
"service",
")",
"{",
"return",
"service",
"(",
"CompositeServiceEntry",
".",
"ofPrefix",
"(",
"pathPrefix",
",",
"service",
")",
")",
";",
"}"
] | Binds the specified {@link Service} under the specified directory.. | [
"Binds",
"the",
"specified",
"{"
] | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/server/composition/AbstractCompositeServiceBuilder.java#L115-L117 |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/ssh/PseudoTerminalModes.java | PseudoTerminalModes.setTerminalMode | public void setTerminalMode(int mode, int value) throws SshException {
try {
encodedModes.write(mode);
if (version == 1 && mode <= 127) {
encodedModes.write(value);
} else {
encodedModes.writeInt(value);
}
} catch (IOException ex) {
throw new SshException(SshException.INTERNAL_ERROR, ex);
}
} | java | public void setTerminalMode(int mode, int value) throws SshException {
try {
encodedModes.write(mode);
if (version == 1 && mode <= 127) {
encodedModes.write(value);
} else {
encodedModes.writeInt(value);
}
} catch (IOException ex) {
throw new SshException(SshException.INTERNAL_ERROR, ex);
}
} | [
"public",
"void",
"setTerminalMode",
"(",
"int",
"mode",
",",
"int",
"value",
")",
"throws",
"SshException",
"{",
"try",
"{",
"encodedModes",
".",
"write",
"(",
"mode",
")",
";",
"if",
"(",
"version",
"==",
"1",
"&&",
"mode",
"<=",
"127",
")",
"{",
"... | Set an integer value mode
@param mode
int
@param value
int
@throws SshException | [
"Set",
"an",
"integer",
"value",
"mode"
] | train | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/ssh/PseudoTerminalModes.java#L372-L386 |
leadware/jpersistence-tools | jpersistence-tools-core/src/main/java/net/leadware/persistence/tools/core/dao/impl/JPAGenericDAORulesBasedImpl.java | JPAGenericDAORulesBasedImpl.addPredicates | protected void addPredicates(CriteriaBuilder criteriaBuilder, Root<T> root, CriteriaQuery<?> criteriaQuery, List<Predicate> predicates) {
// Si la liste de predicats est vide
if(predicates == null || predicates.size() == 0) return;
// Liste de predicats JPA 2
List<javax.persistence.criteria.Predicate> jpaPredicates = new ArrayList<javax.persistence.criteria.Predicate>();
// Parcours de la liste
for (Predicate predicate : predicates) {
// Ajout du critere JPA
jpaPredicates.add(predicate.generateJPAPredicate(criteriaBuilder, root));
}
// Si la liste des prdicats JPA est de taille 1
if(jpaPredicates.size() == 1) criteriaQuery.where(jpaPredicates.get(0));
// Sinon
else criteriaQuery.where(criteriaBuilder.and(jpaPredicates.toArray(new javax.persistence.criteria.Predicate[0])));
} | java | protected void addPredicates(CriteriaBuilder criteriaBuilder, Root<T> root, CriteriaQuery<?> criteriaQuery, List<Predicate> predicates) {
// Si la liste de predicats est vide
if(predicates == null || predicates.size() == 0) return;
// Liste de predicats JPA 2
List<javax.persistence.criteria.Predicate> jpaPredicates = new ArrayList<javax.persistence.criteria.Predicate>();
// Parcours de la liste
for (Predicate predicate : predicates) {
// Ajout du critere JPA
jpaPredicates.add(predicate.generateJPAPredicate(criteriaBuilder, root));
}
// Si la liste des prdicats JPA est de taille 1
if(jpaPredicates.size() == 1) criteriaQuery.where(jpaPredicates.get(0));
// Sinon
else criteriaQuery.where(criteriaBuilder.and(jpaPredicates.toArray(new javax.persistence.criteria.Predicate[0])));
} | [
"protected",
"void",
"addPredicates",
"(",
"CriteriaBuilder",
"criteriaBuilder",
",",
"Root",
"<",
"T",
">",
"root",
",",
"CriteriaQuery",
"<",
"?",
">",
"criteriaQuery",
",",
"List",
"<",
"Predicate",
">",
"predicates",
")",
"{",
"// Si la liste de predicats est ... | Méthode de chargement des prédicats
@param criteriaBuilder Constructeur de critères
@param root Objet racine
@param criteriaQuery Requete de critères
@param predicates Liste des predicats | [
"Méthode",
"de",
"chargement",
"des",
"prédicats"
] | train | https://github.com/leadware/jpersistence-tools/blob/4c15372993584579d7dbb9b23dd4c0c0fdc9e789/jpersistence-tools-core/src/main/java/net/leadware/persistence/tools/core/dao/impl/JPAGenericDAORulesBasedImpl.java#L714-L734 |
jglobus/JGlobus | gss/src/main/java/org/globus/gsi/gssapi/GlobusGSSCredentialImpl.java | GlobusGSSCredentialImpl.getPrivateKey | public PrivateKey getPrivateKey()
throws GSSException {
try {
return (this.cred == null) ? null : this.cred.getPrivateKey();
} catch (CredentialException e) {
throw new GlobusGSSException(GSSException.FAILURE, e);
}
} | java | public PrivateKey getPrivateKey()
throws GSSException {
try {
return (this.cred == null) ? null : this.cred.getPrivateKey();
} catch (CredentialException e) {
throw new GlobusGSSException(GSSException.FAILURE, e);
}
} | [
"public",
"PrivateKey",
"getPrivateKey",
"(",
")",
"throws",
"GSSException",
"{",
"try",
"{",
"return",
"(",
"this",
".",
"cred",
"==",
"null",
")",
"?",
"null",
":",
"this",
".",
"cred",
".",
"getPrivateKey",
"(",
")",
";",
"}",
"catch",
"(",
"Credent... | Returns the private key of this credential (if any).
@return The private key. Might be null if this
is an anonymous credential. | [
"Returns",
"the",
"private",
"key",
"of",
"this",
"credential",
"(",
"if",
"any",
")",
"."
] | train | https://github.com/jglobus/JGlobus/blob/e14f6f6636544fd84298f9cec749d626ea971930/gss/src/main/java/org/globus/gsi/gssapi/GlobusGSSCredentialImpl.java#L264-L271 |
grails/grails-core | grails-bootstrap/src/main/groovy/org/grails/io/support/GrailsResourceUtils.java | GrailsResourceUtils.getClassNameForClassFile | public static String getClassNameForClassFile(String rootDir, String path) {
path = path.replace("/", ".");
path = path.replace('\\', '.');
path = path.substring(0, path.length() - CLASS_EXTENSION.length());
if (rootDir != null) {
path = path.substring(rootDir.length());
}
return path;
} | java | public static String getClassNameForClassFile(String rootDir, String path) {
path = path.replace("/", ".");
path = path.replace('\\', '.');
path = path.substring(0, path.length() - CLASS_EXTENSION.length());
if (rootDir != null) {
path = path.substring(rootDir.length());
}
return path;
} | [
"public",
"static",
"String",
"getClassNameForClassFile",
"(",
"String",
"rootDir",
",",
"String",
"path",
")",
"{",
"path",
"=",
"path",
".",
"replace",
"(",
"\"/\"",
",",
"\".\"",
")",
";",
"path",
"=",
"path",
".",
"replace",
"(",
"'",
"'",
",",
"'"... | Returns the class name for a compiled class file
@param path The path to check
@return The class name or null if it doesn't exist | [
"Returns",
"the",
"class",
"name",
"for",
"a",
"compiled",
"class",
"file"
] | train | https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-bootstrap/src/main/groovy/org/grails/io/support/GrailsResourceUtils.java#L305-L313 |
apache/incubator-atlas | graphdb/titan0/src/main/java/com/thinkaurelius/titan/diskstorage/locking/LocalLockMediator.java | LocalLockMediator.unlock | public boolean unlock(KeyColumn kc, T requestor) {
if (!locks.containsKey(kc)) {
log.info("Local unlock failed: no locks found for {}", kc);
return false;
}
AuditRecord<T> unlocker = new AuditRecord<>(requestor, null);
AuditRecord<T> holder = locks.get(kc);
if (!holder.equals(unlocker)) {
log.error("Local unlock of {} by {} failed: it is held by {}",
kc, unlocker, holder);
return false;
}
boolean removed = locks.remove(kc, unlocker);
if (removed) {
expiryQueue.remove(kc);
if (log.isTraceEnabled()) {
log.trace("Local unlock succeeded: {} namespace={} txn={}",
kc, name, requestor);
}
} else {
log.warn("Local unlock warning: lock record for {} disappeared "
+ "during removal; this suggests the lock either expired "
+ "while we were removing it, or that it was erroneously "
+ "unlocked multiple times.", kc);
}
// Even if !removed, we're finished unlocking, so return true
return true;
} | java | public boolean unlock(KeyColumn kc, T requestor) {
if (!locks.containsKey(kc)) {
log.info("Local unlock failed: no locks found for {}", kc);
return false;
}
AuditRecord<T> unlocker = new AuditRecord<>(requestor, null);
AuditRecord<T> holder = locks.get(kc);
if (!holder.equals(unlocker)) {
log.error("Local unlock of {} by {} failed: it is held by {}",
kc, unlocker, holder);
return false;
}
boolean removed = locks.remove(kc, unlocker);
if (removed) {
expiryQueue.remove(kc);
if (log.isTraceEnabled()) {
log.trace("Local unlock succeeded: {} namespace={} txn={}",
kc, name, requestor);
}
} else {
log.warn("Local unlock warning: lock record for {} disappeared "
+ "during removal; this suggests the lock either expired "
+ "while we were removing it, or that it was erroneously "
+ "unlocked multiple times.", kc);
}
// Even if !removed, we're finished unlocking, so return true
return true;
} | [
"public",
"boolean",
"unlock",
"(",
"KeyColumn",
"kc",
",",
"T",
"requestor",
")",
"{",
"if",
"(",
"!",
"locks",
".",
"containsKey",
"(",
"kc",
")",
")",
"{",
"log",
".",
"info",
"(",
"\"Local unlock failed: no locks found for {}\"",
",",
"kc",
")",
";",
... | Release the lock specified by {@code kc} and which was previously
locked by {@code requestor}, if it is possible to release it.
@param kc lock identifier
@param requestor the object which previously locked {@code kc} | [
"Release",
"the",
"lock",
"specified",
"by",
"{",
"@code",
"kc",
"}",
"and",
"which",
"was",
"previously",
"locked",
"by",
"{",
"@code",
"requestor",
"}",
"if",
"it",
"is",
"possible",
"to",
"release",
"it",
"."
] | train | https://github.com/apache/incubator-atlas/blob/e0d2cdc27c32742ebecd24db4cca62dc04dcdf4b/graphdb/titan0/src/main/java/com/thinkaurelius/titan/diskstorage/locking/LocalLockMediator.java#L186-L220 |
algolia/algoliasearch-client-java | src/main/java/com/algolia/search/saas/Index.java | Index.saveSynonym | public JSONObject saveSynonym(String objectID, JSONObject content, boolean forwardToReplicas) throws AlgoliaException {
return this.saveSynonym(objectID, content, forwardToReplicas, RequestOptions.empty);
} | java | public JSONObject saveSynonym(String objectID, JSONObject content, boolean forwardToReplicas) throws AlgoliaException {
return this.saveSynonym(objectID, content, forwardToReplicas, RequestOptions.empty);
} | [
"public",
"JSONObject",
"saveSynonym",
"(",
"String",
"objectID",
",",
"JSONObject",
"content",
",",
"boolean",
"forwardToReplicas",
")",
"throws",
"AlgoliaException",
"{",
"return",
"this",
".",
"saveSynonym",
"(",
"objectID",
",",
"content",
",",
"forwardToReplica... | Update one synonym
@param objectID The objectId of the synonym to save
@param content The new content of this synonym
@param forwardToReplicas Forward the operation to the replica indices | [
"Update",
"one",
"synonym"
] | train | https://github.com/algolia/algoliasearch-client-java/blob/a05da2f66c099fe6f77295c7b6a8a12c24e95f9b/src/main/java/com/algolia/search/saas/Index.java#L1639-L1641 |
cdk/cdk | display/renderbasic/src/main/java/org/openscience/cdk/renderer/generators/BasicAtomGenerator.java | BasicAtomGenerator.invisibleHydrogen | protected boolean invisibleHydrogen(IAtom atom, RendererModel model) {
return isHydrogen(atom) && !(Boolean) model.get(ShowExplicitHydrogens.class);
} | java | protected boolean invisibleHydrogen(IAtom atom, RendererModel model) {
return isHydrogen(atom) && !(Boolean) model.get(ShowExplicitHydrogens.class);
} | [
"protected",
"boolean",
"invisibleHydrogen",
"(",
"IAtom",
"atom",
",",
"RendererModel",
"model",
")",
"{",
"return",
"isHydrogen",
"(",
"atom",
")",
"&&",
"!",
"(",
"Boolean",
")",
"model",
".",
"get",
"(",
"ShowExplicitHydrogens",
".",
"class",
")",
";",
... | Checks an atom to see if it is an 'invisible hydrogen' - that is, it
is a) an (explicit) hydrogen, and b) explicit hydrogens are set to off.
@param atom the atom to check
@param model the renderer model
@return true if this atom should not be shown | [
"Checks",
"an",
"atom",
"to",
"see",
"if",
"it",
"is",
"an",
"invisible",
"hydrogen",
"-",
"that",
"is",
"it",
"is",
"a",
")",
"an",
"(",
"explicit",
")",
"hydrogen",
"and",
"b",
")",
"explicit",
"hydrogens",
"are",
"set",
"to",
"off",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/display/renderbasic/src/main/java/org/openscience/cdk/renderer/generators/BasicAtomGenerator.java#L262-L264 |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiFile.java | BoxApiFile.getDownloadRequest | public BoxRequestsFile.DownloadFile getDownloadRequest(File target, String fileId) throws IOException{
if (!target.exists()){
throw new FileNotFoundException();
}
BoxRequestsFile.DownloadFile request = new BoxRequestsFile.DownloadFile(fileId, target, getFileDownloadUrl(fileId),mSession);
return request;
} | java | public BoxRequestsFile.DownloadFile getDownloadRequest(File target, String fileId) throws IOException{
if (!target.exists()){
throw new FileNotFoundException();
}
BoxRequestsFile.DownloadFile request = new BoxRequestsFile.DownloadFile(fileId, target, getFileDownloadUrl(fileId),mSession);
return request;
} | [
"public",
"BoxRequestsFile",
".",
"DownloadFile",
"getDownloadRequest",
"(",
"File",
"target",
",",
"String",
"fileId",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"target",
".",
"exists",
"(",
")",
")",
"{",
"throw",
"new",
"FileNotFoundException",
"("... | Gets a request that downloads a given file to a target file
@param target target file to download to, target can be either a directory or a file
@param fileId id of the file to download
@return request to download a file to a target file
@throws IOException throws FileNotFoundException if target file does not exist. | [
"Gets",
"a",
"request",
"that",
"downloads",
"a",
"given",
"file",
"to",
"a",
"target",
"file"
] | train | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiFile.java#L367-L373 |
jcuda/jcuda | JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java | JCudaDriver.cuParamSetf | @Deprecated
public static int cuParamSetf(CUfunction hfunc, int offset, float value)
{
return checkResult(cuParamSetfNative(hfunc, offset, value));
} | java | @Deprecated
public static int cuParamSetf(CUfunction hfunc, int offset, float value)
{
return checkResult(cuParamSetfNative(hfunc, offset, value));
} | [
"@",
"Deprecated",
"public",
"static",
"int",
"cuParamSetf",
"(",
"CUfunction",
"hfunc",
",",
"int",
"offset",
",",
"float",
"value",
")",
"{",
"return",
"checkResult",
"(",
"cuParamSetfNative",
"(",
"hfunc",
",",
"offset",
",",
"value",
")",
")",
";",
"}"... | Adds a floating-point parameter to the function's argument list.
<pre>
CUresult cuParamSetf (
CUfunction hfunc,
int offset,
float value )
</pre>
<div>
<p>Adds a floating-point parameter to the
function's argument list.
Deprecated Sets a floating-point parameter
that will be specified the next time the kernel corresponding to <tt>hfunc</tt> will be invoked. <tt>offset</tt> is a byte offset.
</p>
<div>
<span>Note:</span>
<p>Note that this
function may also return error codes from previous, asynchronous
launches.
</p>
</div>
</p>
</div>
@param hfunc Kernel to add parameter to
@param offset Offset to add parameter to argument list
@param value Value of parameter
@return CUDA_SUCCESS, CUDA_ERROR_DEINITIALIZED, CUDA_ERROR_NOT_INITIALIZED,
CUDA_ERROR_INVALID_CONTEXT, CUDA_ERROR_INVALID_VALUE
@see JCudaDriver#cuFuncSetBlockShape
@see JCudaDriver#cuFuncSetSharedSize
@see JCudaDriver#cuFuncGetAttribute
@see JCudaDriver#cuParamSetSize
@see JCudaDriver#cuParamSeti
@see JCudaDriver#cuParamSetv
@see JCudaDriver#cuLaunch
@see JCudaDriver#cuLaunchGrid
@see JCudaDriver#cuLaunchGridAsync
@see JCudaDriver#cuLaunchKernel
@deprecated Deprecated in CUDA | [
"Adds",
"a",
"floating",
"-",
"point",
"parameter",
"to",
"the",
"function",
"s",
"argument",
"list",
"."
] | train | https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java#L11843-L11847 |
OpenTSDB/opentsdb | src/tsd/HttpJsonSerializer.java | HttpJsonSerializer.parsePutV1 | @Override
public <T extends IncomingDataPoint> List<T> parsePutV1(
final Class<T> type, final TypeReference<ArrayList<T>> typeReference) {
if (!query.hasContent()) {
throw new BadRequestException("Missing request content");
}
// convert to a string so we can handle character encoding properly
final String content = query.getContent().trim();
final int firstbyte = content.charAt(0);
try {
if (firstbyte == '{') {
final T dp =
JSON.parseToObject(content, type);
final ArrayList<T> dps =
new ArrayList<T>(1);
dps.add(dp);
return dps;
} else if (firstbyte == '[') {
return JSON.parseToObject(content, typeReference);
} else {
throw new BadRequestException("The JSON must start as an object or an array");
}
} catch (IllegalArgumentException iae) {
throw new BadRequestException("Unable to parse the given JSON", iae);
}
} | java | @Override
public <T extends IncomingDataPoint> List<T> parsePutV1(
final Class<T> type, final TypeReference<ArrayList<T>> typeReference) {
if (!query.hasContent()) {
throw new BadRequestException("Missing request content");
}
// convert to a string so we can handle character encoding properly
final String content = query.getContent().trim();
final int firstbyte = content.charAt(0);
try {
if (firstbyte == '{') {
final T dp =
JSON.parseToObject(content, type);
final ArrayList<T> dps =
new ArrayList<T>(1);
dps.add(dp);
return dps;
} else if (firstbyte == '[') {
return JSON.parseToObject(content, typeReference);
} else {
throw new BadRequestException("The JSON must start as an object or an array");
}
} catch (IllegalArgumentException iae) {
throw new BadRequestException("Unable to parse the given JSON", iae);
}
} | [
"@",
"Override",
"public",
"<",
"T",
"extends",
"IncomingDataPoint",
">",
"List",
"<",
"T",
">",
"parsePutV1",
"(",
"final",
"Class",
"<",
"T",
">",
"type",
",",
"final",
"TypeReference",
"<",
"ArrayList",
"<",
"T",
">",
">",
"typeReference",
")",
"{",
... | Parses one or more data points for storage
@return an array of data points to process for storage
@throws JSONException if parsing failed
@throws BadRequestException if the content was missing or parsing failed
@since 2.4 | [
"Parses",
"one",
"or",
"more",
"data",
"points",
"for",
"storage"
] | train | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tsd/HttpJsonSerializer.java#L168-L194 |
adorsys/hbci4java-adorsys | src/main/java/org/kapott/hbci/GV/generators/SEPAGeneratorFactory.java | SEPAGeneratorFactory.get | public static ISEPAGenerator get(AbstractSEPAGV job, SepaVersion version) throws ClassNotFoundException,
InstantiationException, IllegalAccessException {
String jobname = job.getPainJobName(); // referenzierter pain-Geschäftsvorfall
return get(jobname, version);
} | java | public static ISEPAGenerator get(AbstractSEPAGV job, SepaVersion version) throws ClassNotFoundException,
InstantiationException, IllegalAccessException {
String jobname = job.getPainJobName(); // referenzierter pain-Geschäftsvorfall
return get(jobname, version);
} | [
"public",
"static",
"ISEPAGenerator",
"get",
"(",
"AbstractSEPAGV",
"job",
",",
"SepaVersion",
"version",
")",
"throws",
"ClassNotFoundException",
",",
"InstantiationException",
",",
"IllegalAccessException",
"{",
"String",
"jobname",
"=",
"job",
".",
"getPainJobName",
... | Gibt den passenden SEPA Generator für die angegebene PAIN-Version.
@param job der zu erzeugende Job.
@param version die PAIN-Version.
@return ISEPAGenerator
@throws IllegalAccessException
@throws InstantiationException
@throws ClassNotFoundException | [
"Gibt",
"den",
"passenden",
"SEPA",
"Generator",
"für",
"die",
"angegebene",
"PAIN",
"-",
"Version",
"."
] | train | https://github.com/adorsys/hbci4java-adorsys/blob/5e24f7e429d6b555e1d993196b4cf1adda6433cf/src/main/java/org/kapott/hbci/GV/generators/SEPAGeneratorFactory.java#L30-L34 |
OpenHFT/Chronicle-Network | src/main/java/net/openhft/chronicle/network/connection/TcpChannelHub.java | TcpChannelHub.proxyReply | public Wire proxyReply(long timeoutTime, final long tid) throws ConnectionDroppedException, TimeoutException {
try {
return tcpSocketConsumer.syncBlockingReadSocket(timeoutTime, tid);
} catch (ConnectionDroppedException e) {
closeSocket();
throw e;
} catch (Throwable e) {
Jvm.warn().on(getClass(), e);
closeSocket();
throw e;
}
} | java | public Wire proxyReply(long timeoutTime, final long tid) throws ConnectionDroppedException, TimeoutException {
try {
return tcpSocketConsumer.syncBlockingReadSocket(timeoutTime, tid);
} catch (ConnectionDroppedException e) {
closeSocket();
throw e;
} catch (Throwable e) {
Jvm.warn().on(getClass(), e);
closeSocket();
throw e;
}
} | [
"public",
"Wire",
"proxyReply",
"(",
"long",
"timeoutTime",
",",
"final",
"long",
"tid",
")",
"throws",
"ConnectionDroppedException",
",",
"TimeoutException",
"{",
"try",
"{",
"return",
"tcpSocketConsumer",
".",
"syncBlockingReadSocket",
"(",
"timeoutTime",
",",
"ti... | blocks for a message with the appropriate {@code tid}
@param timeoutTime the amount of time to wait ( in MS ) before a time out exceptions
@param tid the {@code tid} of the message that we are waiting for
@return the wire of the message with the {@code tid} | [
"blocks",
"for",
"a",
"message",
"with",
"the",
"appropriate",
"{",
"@code",
"tid",
"}"
] | train | https://github.com/OpenHFT/Chronicle-Network/blob/b50d232a1763b1400d5438c7925dce845e5c387a/src/main/java/net/openhft/chronicle/network/connection/TcpChannelHub.java#L638-L652 |
deeplearning4j/deeplearning4j | datavec/datavec-api/src/main/java/org/datavec/api/writable/WritableFactory.java | WritableFactory.writeWithType | public void writeWithType(Writable w, DataOutput dataOutput) throws IOException {
w.writeType(dataOutput);
w.write(dataOutput);
} | java | public void writeWithType(Writable w, DataOutput dataOutput) throws IOException {
w.writeType(dataOutput);
w.write(dataOutput);
} | [
"public",
"void",
"writeWithType",
"(",
"Writable",
"w",
",",
"DataOutput",
"dataOutput",
")",
"throws",
"IOException",
"{",
"w",
".",
"writeType",
"(",
"dataOutput",
")",
";",
"w",
".",
"write",
"(",
"dataOutput",
")",
";",
"}"
] | A convenience method for writing a given Writable object to a DataOutput. The key is 1st written (a single short)
followed by the value from writable.
@param w Writable value
@param dataOutput DataOutput to write both key and value to
@throws IOException If an error occurs during writing to the DataOutput | [
"A",
"convenience",
"method",
"for",
"writing",
"a",
"given",
"Writable",
"object",
"to",
"a",
"DataOutput",
".",
"The",
"key",
"is",
"1st",
"written",
"(",
"a",
"single",
"short",
")",
"followed",
"by",
"the",
"value",
"from",
"writable",
"."
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-api/src/main/java/org/datavec/api/writable/WritableFactory.java#L108-L111 |
quattor/pan | panc/src/main/java/org/quattor/pan/ttemplate/BuildContext.java | BuildContext.setGlobalVariable | public void setGlobalVariable(String name, Element value) {
assert (name != null);
GlobalVariable gvar = globalVariables.get(name);
gvar.setValue(value);
} | java | public void setGlobalVariable(String name, Element value) {
assert (name != null);
GlobalVariable gvar = globalVariables.get(name);
gvar.setValue(value);
} | [
"public",
"void",
"setGlobalVariable",
"(",
"String",
"name",
",",
"Element",
"value",
")",
"{",
"assert",
"(",
"name",
"!=",
"null",
")",
";",
"GlobalVariable",
"gvar",
"=",
"globalVariables",
".",
"get",
"(",
"name",
")",
";",
"gvar",
".",
"setValue",
... | Set the variable to the given value, preserving the status of the final
flag. This will unconditionally set the value without checking if the
value is final; be careful. The value must already exist. | [
"Set",
"the",
"variable",
"to",
"the",
"given",
"value",
"preserving",
"the",
"status",
"of",
"the",
"final",
"flag",
".",
"This",
"will",
"unconditionally",
"set",
"the",
"value",
"without",
"checking",
"if",
"the",
"value",
"is",
"final",
";",
"be",
"car... | train | https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/ttemplate/BuildContext.java#L598-L604 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/shape/Shape.java | Shape.setElementWiseStride | public static void setElementWiseStride(DataBuffer buffer, int elementWiseStride) {
int length2 = shapeInfoLength(Shape.rank(buffer));
//if (1 > 0) throw new RuntimeException("setElementWiseStride called: [" + elementWiseStride + "], buffer: " + buffer);
buffer.put(length2 - 2, elementWiseStride);
} | java | public static void setElementWiseStride(DataBuffer buffer, int elementWiseStride) {
int length2 = shapeInfoLength(Shape.rank(buffer));
//if (1 > 0) throw new RuntimeException("setElementWiseStride called: [" + elementWiseStride + "], buffer: " + buffer);
buffer.put(length2 - 2, elementWiseStride);
} | [
"public",
"static",
"void",
"setElementWiseStride",
"(",
"DataBuffer",
"buffer",
",",
"int",
"elementWiseStride",
")",
"{",
"int",
"length2",
"=",
"shapeInfoLength",
"(",
"Shape",
".",
"rank",
"(",
"buffer",
")",
")",
";",
"//if (1 > 0) throw new RuntimeException(\"... | Get the element wise stride for the
shape info buffer
@param buffer the buffer to get the element
wise stride from
@return the element wise stride for the buffer | [
"Get",
"the",
"element",
"wise",
"stride",
"for",
"the",
"shape",
"info",
"buffer"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/shape/Shape.java#L3086-L3090 |
mikepenz/FastAdapter | library-extensions-expandable/src/main/java/com/mikepenz/fastadapter/utils/AdapterUtil.java | AdapterUtil.addAllSubItems | public static <Item extends IItem> void addAllSubItems(Item item, List<Item> items) {
if (item instanceof IExpandable && !((IExpandable) item).isExpanded() && ((IExpandable) item).getSubItems() != null) {
List<Item> subItems = (List<Item>) ((IExpandable<Item, ?>) item).getSubItems();
Item subItem;
for (int i = 0, size = subItems.size(); i < size; i++) {
subItem = subItems.get(i);
items.add(subItem);
addAllSubItems(subItem, items);
}
}
} | java | public static <Item extends IItem> void addAllSubItems(Item item, List<Item> items) {
if (item instanceof IExpandable && !((IExpandable) item).isExpanded() && ((IExpandable) item).getSubItems() != null) {
List<Item> subItems = (List<Item>) ((IExpandable<Item, ?>) item).getSubItems();
Item subItem;
for (int i = 0, size = subItems.size(); i < size; i++) {
subItem = subItems.get(i);
items.add(subItem);
addAllSubItems(subItem, items);
}
}
} | [
"public",
"static",
"<",
"Item",
"extends",
"IItem",
">",
"void",
"addAllSubItems",
"(",
"Item",
"item",
",",
"List",
"<",
"Item",
">",
"items",
")",
"{",
"if",
"(",
"item",
"instanceof",
"IExpandable",
"&&",
"!",
"(",
"(",
"IExpandable",
")",
"item",
... | Gets all subItems from a given parent item
@param item the parent from which we add all items
@param items the list in which we add the subItems | [
"Gets",
"all",
"subItems",
"from",
"a",
"given",
"parent",
"item"
] | train | https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/library-extensions-expandable/src/main/java/com/mikepenz/fastadapter/utils/AdapterUtil.java#L77-L87 |
xwiki/xwiki-commons | xwiki-commons-core/xwiki-commons-extension/xwiki-commons-extension-api/src/main/java/org/xwiki/extension/job/internal/AbstractInstallPlanJob.java | AbstractInstallPlanJob.installExtension | protected void installExtension(ExtensionId extensionId, String namespace, DefaultExtensionPlanTree parentBranch)
throws InstallException
{
installExtension(extensionId, false, namespace, parentBranch);
} | java | protected void installExtension(ExtensionId extensionId, String namespace, DefaultExtensionPlanTree parentBranch)
throws InstallException
{
installExtension(extensionId, false, namespace, parentBranch);
} | [
"protected",
"void",
"installExtension",
"(",
"ExtensionId",
"extensionId",
",",
"String",
"namespace",
",",
"DefaultExtensionPlanTree",
"parentBranch",
")",
"throws",
"InstallException",
"{",
"installExtension",
"(",
"extensionId",
",",
"false",
",",
"namespace",
",",
... | Install provided extension.
@param extensionId the identifier of the extension to install
@param namespace the namespace where to install the extension
@param parentBranch the children of the parent {@link DefaultExtensionPlanNode}
@throws InstallException error when trying to install provided extension | [
"Install",
"provided",
"extension",
"."
] | train | https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-extension/xwiki-commons-extension-api/src/main/java/org/xwiki/extension/job/internal/AbstractInstallPlanJob.java#L282-L286 |
apache/incubator-gobblin | gobblin-utility/src/main/java/org/apache/gobblin/util/SerializationUtils.java | SerializationUtils.deserializeStateFromInputStream | public static <T extends State> void deserializeStateFromInputStream(InputStream is, T state) throws IOException {
try (DataInputStream dis = (new DataInputStream(is))) {
state.readFields(dis);
}
} | java | public static <T extends State> void deserializeStateFromInputStream(InputStream is, T state) throws IOException {
try (DataInputStream dis = (new DataInputStream(is))) {
state.readFields(dis);
}
} | [
"public",
"static",
"<",
"T",
"extends",
"State",
">",
"void",
"deserializeStateFromInputStream",
"(",
"InputStream",
"is",
",",
"T",
"state",
")",
"throws",
"IOException",
"{",
"try",
"(",
"DataInputStream",
"dis",
"=",
"(",
"new",
"DataInputStream",
"(",
"is... | Deserialize/read a {@link State} instance from a file.
@param is {@link InputStream} containing the state.
@param state an empty {@link State} instance to deserialize into
@param <T> the {@link State} object type
@throws IOException if it fails to deserialize the {@link State} instance | [
"Deserialize",
"/",
"read",
"a",
"{",
"@link",
"State",
"}",
"instance",
"from",
"a",
"file",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/SerializationUtils.java#L188-L192 |
jeremylong/DependencyCheck | core/src/main/java/org/owasp/dependencycheck/analyzer/AbstractNpmAnalyzer.java | AbstractNpmAnalyzer.processPackage | protected void processPackage(Engine engine, Dependency dependency, JsonArray jsonArray, String depType) {
final JsonObjectBuilder builder = Json.createObjectBuilder();
jsonArray.getValuesAs(JsonString.class).forEach((str) -> {
builder.add(str.toString(), "");
} | java | protected void processPackage(Engine engine, Dependency dependency, JsonArray jsonArray, String depType) {
final JsonObjectBuilder builder = Json.createObjectBuilder();
jsonArray.getValuesAs(JsonString.class).forEach((str) -> {
builder.add(str.toString(), "");
} | [
"protected",
"void",
"processPackage",
"(",
"Engine",
"engine",
",",
"Dependency",
"dependency",
",",
"JsonArray",
"jsonArray",
",",
"String",
"depType",
")",
"{",
"final",
"JsonObjectBuilder",
"builder",
"=",
"Json",
".",
"createObjectBuilder",
"(",
")",
";",
"... | Processes a part of package.json (as defined by JsonArray) and update the
specified dependency with relevant info.
@param engine the dependency-check engine
@param dependency the Dependency to update
@param jsonArray the jsonArray to parse
@param depType the dependency type | [
"Processes",
"a",
"part",
"of",
"package",
".",
"json",
"(",
"as",
"defined",
"by",
"JsonArray",
")",
"and",
"update",
"the",
"specified",
"dependency",
"with",
"relevant",
"info",
"."
] | train | https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/analyzer/AbstractNpmAnalyzer.java#L171-L175 |
apptentive/apptentive-android | apptentive/src/main/java/com/apptentive/android/sdk/Apptentive.java | Apptentive.getBodyFromApptentivePush | public static String getBodyFromApptentivePush(Map<String, String> data) {
try {
if (!ApptentiveInternal.checkRegistered()) {
return null;
}
if (data == null) {
return null;
}
return data.get(ApptentiveInternal.BODY_DEFAULT);
} catch (Exception e) {
ApptentiveLog.e(PUSH, e, "Exception while getting body from Apptentive push");
logException(e);
}
return null;
} | java | public static String getBodyFromApptentivePush(Map<String, String> data) {
try {
if (!ApptentiveInternal.checkRegistered()) {
return null;
}
if (data == null) {
return null;
}
return data.get(ApptentiveInternal.BODY_DEFAULT);
} catch (Exception e) {
ApptentiveLog.e(PUSH, e, "Exception while getting body from Apptentive push");
logException(e);
}
return null;
} | [
"public",
"static",
"String",
"getBodyFromApptentivePush",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"data",
")",
"{",
"try",
"{",
"if",
"(",
"!",
"ApptentiveInternal",
".",
"checkRegistered",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(... | Use this method in your push receiver to get the notification body text you can use to
construct a {@link android.app.Notification} object.
@param data A {@link Map}<{@link String},{@link String}> containing the Apptentive Push
data. Pass in what you receive in the the Service or BroadcastReceiver that is
used by your chosen push provider.
@return a String value, or null. | [
"Use",
"this",
"method",
"in",
"your",
"push",
"receiver",
"to",
"get",
"the",
"notification",
"body",
"text",
"you",
"can",
"use",
"to",
"construct",
"a",
"{",
"@link",
"android",
".",
"app",
".",
"Notification",
"}",
"object",
"."
] | train | https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/Apptentive.java#L830-L844 |
andkulikov/Transitions-Everywhere | library(1.x)/src/main/java/com/transitionseverywhere/TransitionInflater.java | TransitionInflater.inflateTransitionManager | @Nullable
public TransitionManager inflateTransitionManager(int resource, @NonNull ViewGroup sceneRoot) {
XmlResourceParser parser = mContext.getResources().getXml(resource);
try {
return createTransitionManagerFromXml(parser, Xml.asAttributeSet(parser), sceneRoot);
} catch (XmlPullParserException e) {
InflateException ex = new InflateException(e.getMessage());
ex.initCause(e);
throw ex;
} catch (IOException e) {
InflateException ex = new InflateException(
parser.getPositionDescription()
+ ": " + e.getMessage());
ex.initCause(e);
throw ex;
} finally {
parser.close();
}
} | java | @Nullable
public TransitionManager inflateTransitionManager(int resource, @NonNull ViewGroup sceneRoot) {
XmlResourceParser parser = mContext.getResources().getXml(resource);
try {
return createTransitionManagerFromXml(parser, Xml.asAttributeSet(parser), sceneRoot);
} catch (XmlPullParserException e) {
InflateException ex = new InflateException(e.getMessage());
ex.initCause(e);
throw ex;
} catch (IOException e) {
InflateException ex = new InflateException(
parser.getPositionDescription()
+ ": " + e.getMessage());
ex.initCause(e);
throw ex;
} finally {
parser.close();
}
} | [
"@",
"Nullable",
"public",
"TransitionManager",
"inflateTransitionManager",
"(",
"int",
"resource",
",",
"@",
"NonNull",
"ViewGroup",
"sceneRoot",
")",
"{",
"XmlResourceParser",
"parser",
"=",
"mContext",
".",
"getResources",
"(",
")",
".",
"getXml",
"(",
"resourc... | Loads a {@link TransitionManager} object from a resource
@param resource The resource id of the transition manager to load
@return The loaded TransitionManager object
@throws android.content.res.Resources.NotFoundException when the
transition manager cannot be loaded | [
"Loads",
"a",
"{",
"@link",
"TransitionManager",
"}",
"object",
"from",
"a",
"resource"
] | train | https://github.com/andkulikov/Transitions-Everywhere/blob/828efe5f152a2f05e2bfeee6254b74ad2269d4f1/library(1.x)/src/main/java/com/transitionseverywhere/TransitionInflater.java#L109-L127 |
apache/incubator-gobblin | gobblin-api/src/main/java/org/apache/gobblin/stream/RecordEnvelope.java | RecordEnvelope.setRecordMetadata | public void setRecordMetadata(String key, Object value) {
if (_recordMetadata == null) {
_recordMetadata = new HashMap<>();
}
_recordMetadata.put(key, value);
} | java | public void setRecordMetadata(String key, Object value) {
if (_recordMetadata == null) {
_recordMetadata = new HashMap<>();
}
_recordMetadata.put(key, value);
} | [
"public",
"void",
"setRecordMetadata",
"(",
"String",
"key",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"_recordMetadata",
"==",
"null",
")",
"{",
"_recordMetadata",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"}",
"_recordMetadata",
".",
"put",
"(",
"... | Set the record metadata
@param key key for the metadata
@param value value of the metadata
@implNote should not be called concurrently | [
"Set",
"the",
"record",
"metadata",
"@param",
"key",
"key",
"for",
"the",
"metadata",
"@param",
"value",
"value",
"of",
"the",
"metadata"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-api/src/main/java/org/apache/gobblin/stream/RecordEnvelope.java#L141-L147 |
UrielCh/ovh-java-sdk | ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java | ApiOvhTelephony.billingAccount_voicemail_serviceName_directories_GET | public ArrayList<Long> billingAccount_voicemail_serviceName_directories_GET(String billingAccount, String serviceName, OvhVoicemailMessageFolderDirectoryEnum dir) throws IOException {
String qPath = "/telephony/{billingAccount}/voicemail/{serviceName}/directories";
StringBuilder sb = path(qPath, billingAccount, serviceName);
query(sb, "dir", dir);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t2);
} | java | public ArrayList<Long> billingAccount_voicemail_serviceName_directories_GET(String billingAccount, String serviceName, OvhVoicemailMessageFolderDirectoryEnum dir) throws IOException {
String qPath = "/telephony/{billingAccount}/voicemail/{serviceName}/directories";
StringBuilder sb = path(qPath, billingAccount, serviceName);
query(sb, "dir", dir);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t2);
} | [
"public",
"ArrayList",
"<",
"Long",
">",
"billingAccount_voicemail_serviceName_directories_GET",
"(",
"String",
"billingAccount",
",",
"String",
"serviceName",
",",
"OvhVoicemailMessageFolderDirectoryEnum",
"dir",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
... | Voicemail directory messages
REST: GET /telephony/{billingAccount}/voicemail/{serviceName}/directories
@param dir [required] Filter the value of dir property (=)
@param billingAccount [required] The name of your billingAccount
@param serviceName [required] | [
"Voicemail",
"directory",
"messages"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L7892-L7898 |
NessComputing/service-discovery | jms/src/main/java/com/nesscomputing/jms/activemq/ServiceDiscoveryTransportFactory.java | ServiceDiscoveryTransportFactory.registerDiscoveryClient | static void registerDiscoveryClient(UUID injectorId, ReadOnlyDiscoveryClient discoveryClient, DiscoveryJmsConfig config) {
DISCO_CLIENTS.put(injectorId, discoveryClient);
CONFIGS.put(injectorId, config);
LOG.info("Registered discovery client %s as %s", injectorId, discoveryClient);
} | java | static void registerDiscoveryClient(UUID injectorId, ReadOnlyDiscoveryClient discoveryClient, DiscoveryJmsConfig config) {
DISCO_CLIENTS.put(injectorId, discoveryClient);
CONFIGS.put(injectorId, config);
LOG.info("Registered discovery client %s as %s", injectorId, discoveryClient);
} | [
"static",
"void",
"registerDiscoveryClient",
"(",
"UUID",
"injectorId",
",",
"ReadOnlyDiscoveryClient",
"discoveryClient",
",",
"DiscoveryJmsConfig",
"config",
")",
"{",
"DISCO_CLIENTS",
".",
"put",
"(",
"injectorId",
",",
"discoveryClient",
")",
";",
"CONFIGS",
".",
... | Register a discoveryClient under a unique id. This works around the TransportFactory's inherent staticness
so that we may use the correct discovery client even in the presence of multiple injectors in the same JVM. | [
"Register",
"a",
"discoveryClient",
"under",
"a",
"unique",
"id",
".",
"This",
"works",
"around",
"the",
"TransportFactory",
"s",
"inherent",
"staticness",
"so",
"that",
"we",
"may",
"use",
"the",
"correct",
"discovery",
"client",
"even",
"in",
"the",
"presenc... | train | https://github.com/NessComputing/service-discovery/blob/5091ffdb1de6b12d216d1c238f72858037c7b765/jms/src/main/java/com/nesscomputing/jms/activemq/ServiceDiscoveryTransportFactory.java#L70-L74 |
fhoeben/hsac-fitnesse-fixtures | src/main/java/nl/hsac/fitnesse/fixture/slim/CompareFixture.java | CompareFixture.countDifferencesBetweenAnd | public int countDifferencesBetweenAnd(String first, String second) {
if (first == null) {
if (second == null) {
return 0;
} else {
first = "";
}
} else if (second == null) {
second = "";
}
LinkedList<DiffMatchPatch.Diff> diffs = getDiffs(first, second);
int diffCount = 0;
for (DiffMatchPatch.Diff diff : diffs) {
if (diff.operation != DiffMatchPatch.Operation.EQUAL) {
diffCount++;
}
}
return diffCount;
} | java | public int countDifferencesBetweenAnd(String first, String second) {
if (first == null) {
if (second == null) {
return 0;
} else {
first = "";
}
} else if (second == null) {
second = "";
}
LinkedList<DiffMatchPatch.Diff> diffs = getDiffs(first, second);
int diffCount = 0;
for (DiffMatchPatch.Diff diff : diffs) {
if (diff.operation != DiffMatchPatch.Operation.EQUAL) {
diffCount++;
}
}
return diffCount;
} | [
"public",
"int",
"countDifferencesBetweenAnd",
"(",
"String",
"first",
",",
"String",
"second",
")",
"{",
"if",
"(",
"first",
"==",
"null",
")",
"{",
"if",
"(",
"second",
"==",
"null",
")",
"{",
"return",
"0",
";",
"}",
"else",
"{",
"first",
"=",
"\"... | Determines number of differences (substrings that are not equal) between two strings.
@param first first string to compare.
@param second second string to compare.
@return number of different substrings. | [
"Determines",
"number",
"of",
"differences",
"(",
"substrings",
"that",
"are",
"not",
"equal",
")",
"between",
"two",
"strings",
"."
] | train | https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/slim/CompareFixture.java#L74-L92 |
apache/incubator-gobblin | gobblin-api/src/main/java/org/apache/gobblin/source/workunit/MultiWorkUnit.java | MultiWorkUnit.setProp | @Override
public void setProp(String key, Object value) {
super.setProp(key, value);
for (WorkUnit workUnit : this.workUnits) {
workUnit.setProp(key, value);
}
} | java | @Override
public void setProp(String key, Object value) {
super.setProp(key, value);
for (WorkUnit workUnit : this.workUnits) {
workUnit.setProp(key, value);
}
} | [
"@",
"Override",
"public",
"void",
"setProp",
"(",
"String",
"key",
",",
"Object",
"value",
")",
"{",
"super",
".",
"setProp",
"(",
"key",
",",
"value",
")",
";",
"for",
"(",
"WorkUnit",
"workUnit",
":",
"this",
".",
"workUnits",
")",
"{",
"workUnit",
... | Set the specified key, value pair in this {@link MultiWorkUnit} as well as in all the inner {@link WorkUnit}s.
{@inheritDoc}
@see org.apache.gobblin.configuration.State#setProp(java.lang.String, java.lang.Object) | [
"Set",
"the",
"specified",
"key",
"value",
"pair",
"in",
"this",
"{",
"@link",
"MultiWorkUnit",
"}",
"as",
"well",
"as",
"in",
"all",
"the",
"inner",
"{",
"@link",
"WorkUnit",
"}",
"s",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-api/src/main/java/org/apache/gobblin/source/workunit/MultiWorkUnit.java#L91-L97 |
alkacon/opencms-core | src/org/opencms/db/CmsAliasManager.java | CmsAliasManager.messageImportCantReadResource | private String messageImportCantReadResource(Locale locale, String path) {
return Messages.get().getBundle(locale).key(Messages.ERR_ALIAS_IMPORT_COULD_NOT_READ_RESOURCE_0);
} | java | private String messageImportCantReadResource(Locale locale, String path) {
return Messages.get().getBundle(locale).key(Messages.ERR_ALIAS_IMPORT_COULD_NOT_READ_RESOURCE_0);
} | [
"private",
"String",
"messageImportCantReadResource",
"(",
"Locale",
"locale",
",",
"String",
"path",
")",
"{",
"return",
"Messages",
".",
"get",
"(",
")",
".",
"getBundle",
"(",
"locale",
")",
".",
"key",
"(",
"Messages",
".",
"ERR_ALIAS_IMPORT_COULD_NOT_READ_R... | Message accessor.<p>
@param locale the message locale
@param path a path
@return the message string | [
"Message",
"accessor",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsAliasManager.java#L531-L535 |
Azure/azure-sdk-for-java | sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedDatabaseVulnerabilityAssessmentScansInner.java | ManagedDatabaseVulnerabilityAssessmentScansInner.initiateScanAsync | public Observable<Void> initiateScanAsync(String resourceGroupName, String managedInstanceName, String databaseName, String scanId) {
return initiateScanWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, scanId).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | java | public Observable<Void> initiateScanAsync(String resourceGroupName, String managedInstanceName, String databaseName, String scanId) {
return initiateScanWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, scanId).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"initiateScanAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"managedInstanceName",
",",
"String",
"databaseName",
",",
"String",
"scanId",
")",
"{",
"return",
"initiateScanWithServiceResponseAsync",
"(",
"resourceGro... | Executes a Vulnerability Assessment database scan.
@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 managedInstanceName The name of the managed instance.
@param databaseName The name of the database.
@param scanId The vulnerability assessment scan Id of the scan to retrieve.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Executes",
"a",
"Vulnerability",
"Assessment",
"database",
"scan",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedDatabaseVulnerabilityAssessmentScansInner.java#L360-L367 |
geomajas/geomajas-project-client-gwt | client/src/main/java/org/geomajas/gwt/client/gfx/context/DomHelper.java | DomHelper.setCursor | public void setCursor(Object parent, String name, String cursor) {
Element element = getElement(parent, name);
if (element != null) {
Dom.setStyleAttribute(element, "cursor", cursor);
}
} | java | public void setCursor(Object parent, String name, String cursor) {
Element element = getElement(parent, name);
if (element != null) {
Dom.setStyleAttribute(element, "cursor", cursor);
}
} | [
"public",
"void",
"setCursor",
"(",
"Object",
"parent",
",",
"String",
"name",
",",
"String",
"cursor",
")",
"{",
"Element",
"element",
"=",
"getElement",
"(",
"parent",
",",
"name",
")",
";",
"if",
"(",
"element",
"!=",
"null",
")",
"{",
"Dom",
".",
... | Set a specific cursor on an element of this <code>GraphicsContext</code>.
@param parent
the parent of the element on which the cursor should be set.
@param name
the name of the child element on which the cursor should be set
@param cursor
The string representation of the cursor to use. | [
"Set",
"a",
"specific",
"cursor",
"on",
"an",
"element",
"of",
"this",
"<code",
">",
"GraphicsContext<",
"/",
"code",
">",
"."
] | train | https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/gfx/context/DomHelper.java#L649-L654 |
sculptor/sculptor | sculptor-generator/sculptor-generator-core/src/main/java/org/sculptor/generator/util/HelperBase.java | HelperBase.substringBefore | public String substringBefore(String string, String pattern) {
if (string == null || pattern == null) {
return string;
}
int pos = string.indexOf(pattern);
if (pos != -1) {
return string.substring(0, pos);
}
return null;
} | java | public String substringBefore(String string, String pattern) {
if (string == null || pattern == null) {
return string;
}
int pos = string.indexOf(pattern);
if (pos != -1) {
return string.substring(0, pos);
}
return null;
} | [
"public",
"String",
"substringBefore",
"(",
"String",
"string",
",",
"String",
"pattern",
")",
"{",
"if",
"(",
"string",
"==",
"null",
"||",
"pattern",
"==",
"null",
")",
"{",
"return",
"string",
";",
"}",
"int",
"pos",
"=",
"string",
".",
"indexOf",
"... | Gets the substring before a given pattern
@param string
original string
@param pattern
pattern to check
@return substring before the pattern | [
"Gets",
"the",
"substring",
"before",
"a",
"given",
"pattern"
] | train | https://github.com/sculptor/sculptor/blob/38df06ceb7e40f5f52dbd53b1cd1d07ee11aade5/sculptor-generator/sculptor-generator-core/src/main/java/org/sculptor/generator/util/HelperBase.java#L567-L576 |
gfk-ba/senbot | SenBotRunner/src/main/java/com/gfk/senbot/framework/cucumber/stepdefinitions/selenium/SeleniumPageRepresentationSteps.java | SeleniumPageRepresentationSteps.the_view_should_contain | @Then("^the \"([^\"]*)\" view should contain the element \"([^\"]*)\"$")
public WebElement the_view_should_contain(String viewName, String elementName) throws Throwable {
return seleniumElementService.viewShouldContainElement(viewName, elementName);
} | java | @Then("^the \"([^\"]*)\" view should contain the element \"([^\"]*)\"$")
public WebElement the_view_should_contain(String viewName, String elementName) throws Throwable {
return seleniumElementService.viewShouldContainElement(viewName, elementName);
} | [
"@",
"Then",
"(",
"\"^the \\\"([^\\\"]*)\\\" view should contain the element \\\"([^\\\"]*)\\\"$\"",
")",
"public",
"WebElement",
"the_view_should_contain",
"(",
"String",
"viewName",
",",
"String",
"elementName",
")",
"throws",
"Throwable",
"{",
"return",
"seleniumElementServi... | A generic way to assert of a view/page contains a certain element. The element lookup is done though a naming convention.
variable_Name is matched up on argument "Variable name". So case insensitive and spaces are replaced by underscores
@param viewName
@param elementName
@throws Throwable | [
"A",
"generic",
"way",
"to",
"assert",
"of",
"a",
"view",
"/",
"page",
"contains",
"a",
"certain",
"element",
".",
"The",
"element",
"lookup",
"is",
"done",
"though",
"a",
"naming",
"convention",
".",
"variable_Name",
"is",
"matched",
"up",
"on",
"argument... | train | https://github.com/gfk-ba/senbot/blob/e9a152aa67be48b1bb13a4691655caf6d873b553/SenBotRunner/src/main/java/com/gfk/senbot/framework/cucumber/stepdefinitions/selenium/SeleniumPageRepresentationSteps.java#L85-L89 |
pravega/pravega | controller/src/main/java/io/pravega/controller/store/stream/records/RecordHelper.java | RecordHelper.canScaleFor | public static boolean canScaleFor(final List<Long> segmentsToSeal, final EpochRecord currentEpoch) {
return segmentsToSeal.stream().allMatch(x -> currentEpoch.getSegment(x) != null);
} | java | public static boolean canScaleFor(final List<Long> segmentsToSeal, final EpochRecord currentEpoch) {
return segmentsToSeal.stream().allMatch(x -> currentEpoch.getSegment(x) != null);
} | [
"public",
"static",
"boolean",
"canScaleFor",
"(",
"final",
"List",
"<",
"Long",
">",
"segmentsToSeal",
",",
"final",
"EpochRecord",
"currentEpoch",
")",
"{",
"return",
"segmentsToSeal",
".",
"stream",
"(",
")",
".",
"allMatch",
"(",
"x",
"->",
"currentEpoch",... | Method to check that segments to seal are present in current epoch.
@param segmentsToSeal segments to seal
@param currentEpoch current epoch record
@return true if a scale operation can be performed, false otherwise | [
"Method",
"to",
"check",
"that",
"segments",
"to",
"seal",
"are",
"present",
"in",
"current",
"epoch",
"."
] | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/controller/src/main/java/io/pravega/controller/store/stream/records/RecordHelper.java#L71-L73 |
apache/spark | sql/catalyst/src/main/java/org/apache/spark/sql/util/CaseInsensitiveStringMap.java | CaseInsensitiveStringMap.getDouble | public double getDouble(String key, double defaultValue) {
String value = get(key);
return value == null ? defaultValue : Double.parseDouble(value);
} | java | public double getDouble(String key, double defaultValue) {
String value = get(key);
return value == null ? defaultValue : Double.parseDouble(value);
} | [
"public",
"double",
"getDouble",
"(",
"String",
"key",
",",
"double",
"defaultValue",
")",
"{",
"String",
"value",
"=",
"get",
"(",
"key",
")",
";",
"return",
"value",
"==",
"null",
"?",
"defaultValue",
":",
"Double",
".",
"parseDouble",
"(",
"value",
")... | Returns the double value to which the specified key is mapped,
or defaultValue if there is no mapping for the key. The key match is case-insensitive. | [
"Returns",
"the",
"double",
"value",
"to",
"which",
"the",
"specified",
"key",
"is",
"mapped",
"or",
"defaultValue",
"if",
"there",
"is",
"no",
"mapping",
"for",
"the",
"key",
".",
"The",
"key",
"match",
"is",
"case",
"-",
"insensitive",
"."
] | train | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/catalyst/src/main/java/org/apache/spark/sql/util/CaseInsensitiveStringMap.java#L170-L173 |
gmessner/gitlab4j-api | src/main/java/org/gitlab4j/api/ProjectApi.java | ProjectApi.shareProject | public void shareProject(Object projectIdOrPath, Integer groupId, AccessLevel accessLevel, Date expiresAt)
throws GitLabApiException {
GitLabApiForm formData = new GitLabApiForm()
.withParam("group_id", groupId, true)
.withParam("group_access", accessLevel, true)
.withParam("expires_at", expiresAt);
post(Response.Status.CREATED, formData, "projects", getProjectIdOrPath(projectIdOrPath), "share");
} | java | public void shareProject(Object projectIdOrPath, Integer groupId, AccessLevel accessLevel, Date expiresAt)
throws GitLabApiException {
GitLabApiForm formData = new GitLabApiForm()
.withParam("group_id", groupId, true)
.withParam("group_access", accessLevel, true)
.withParam("expires_at", expiresAt);
post(Response.Status.CREATED, formData, "projects", getProjectIdOrPath(projectIdOrPath), "share");
} | [
"public",
"void",
"shareProject",
"(",
"Object",
"projectIdOrPath",
",",
"Integer",
"groupId",
",",
"AccessLevel",
"accessLevel",
",",
"Date",
"expiresAt",
")",
"throws",
"GitLabApiException",
"{",
"GitLabApiForm",
"formData",
"=",
"new",
"GitLabApiForm",
"(",
")",
... | Share a project with the specified group.
<pre><code>POST /projects/:id/share</code></pre>
@param projectIdOrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required
@param groupId the ID of the group to share with, required
@param accessLevel the permissions level to grant the group, required
@param expiresAt the share expiration date, optional
@throws GitLabApiException if any exception occurs | [
"Share",
"a",
"project",
"with",
"the",
"specified",
"group",
"."
] | train | https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/ProjectApi.java#L2082-L2089 |
cdk/cdk | legacy/src/main/java/org/openscience/cdk/smsd/algorithm/vflib/builder/VFQueryBuilder.java | VFQueryBuilder.addNode | public INode addNode(VFAtomMatcher matcher, IAtom atom) {
NodeBuilder node = new NodeBuilder(matcher);
nodesList.add(node);
nodeBondMap.put(node, atom);
return node;
} | java | public INode addNode(VFAtomMatcher matcher, IAtom atom) {
NodeBuilder node = new NodeBuilder(matcher);
nodesList.add(node);
nodeBondMap.put(node, atom);
return node;
} | [
"public",
"INode",
"addNode",
"(",
"VFAtomMatcher",
"matcher",
",",
"IAtom",
"atom",
")",
"{",
"NodeBuilder",
"node",
"=",
"new",
"NodeBuilder",
"(",
"matcher",
")",
";",
"nodesList",
".",
"add",
"(",
"node",
")",
";",
"nodeBondMap",
".",
"put",
"(",
"no... | Add and return a node for a query atom
@param matcher
@param atom
@return added Node | [
"Add",
"and",
"return",
"a",
"node",
"for",
"a",
"query",
"atom"
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/legacy/src/main/java/org/openscience/cdk/smsd/algorithm/vflib/builder/VFQueryBuilder.java#L152-L157 |
joniles/mpxj | src/main/java/net/sf/mpxj/ganttproject/GanttProjectReader.java | GanttProjectReader.setWorkingDays | private void setWorkingDays(ProjectCalendar mpxjCalendar, Calendars gpCalendar)
{
DayTypes dayTypes = gpCalendar.getDayTypes();
DefaultWeek defaultWeek = dayTypes.getDefaultWeek();
if (defaultWeek == null)
{
mpxjCalendar.setWorkingDay(Day.SUNDAY, false);
mpxjCalendar.setWorkingDay(Day.MONDAY, true);
mpxjCalendar.setWorkingDay(Day.TUESDAY, true);
mpxjCalendar.setWorkingDay(Day.WEDNESDAY, true);
mpxjCalendar.setWorkingDay(Day.THURSDAY, true);
mpxjCalendar.setWorkingDay(Day.FRIDAY, true);
mpxjCalendar.setWorkingDay(Day.SATURDAY, false);
}
else
{
mpxjCalendar.setWorkingDay(Day.MONDAY, isWorkingDay(defaultWeek.getMon()));
mpxjCalendar.setWorkingDay(Day.TUESDAY, isWorkingDay(defaultWeek.getTue()));
mpxjCalendar.setWorkingDay(Day.WEDNESDAY, isWorkingDay(defaultWeek.getWed()));
mpxjCalendar.setWorkingDay(Day.THURSDAY, isWorkingDay(defaultWeek.getThu()));
mpxjCalendar.setWorkingDay(Day.FRIDAY, isWorkingDay(defaultWeek.getFri()));
mpxjCalendar.setWorkingDay(Day.SATURDAY, isWorkingDay(defaultWeek.getSat()));
mpxjCalendar.setWorkingDay(Day.SUNDAY, isWorkingDay(defaultWeek.getSun()));
}
for (Day day : Day.values())
{
if (mpxjCalendar.isWorkingDay(day))
{
ProjectCalendarHours hours = mpxjCalendar.addCalendarHours(day);
hours.addRange(ProjectCalendarWeek.DEFAULT_WORKING_MORNING);
hours.addRange(ProjectCalendarWeek.DEFAULT_WORKING_AFTERNOON);
}
}
} | java | private void setWorkingDays(ProjectCalendar mpxjCalendar, Calendars gpCalendar)
{
DayTypes dayTypes = gpCalendar.getDayTypes();
DefaultWeek defaultWeek = dayTypes.getDefaultWeek();
if (defaultWeek == null)
{
mpxjCalendar.setWorkingDay(Day.SUNDAY, false);
mpxjCalendar.setWorkingDay(Day.MONDAY, true);
mpxjCalendar.setWorkingDay(Day.TUESDAY, true);
mpxjCalendar.setWorkingDay(Day.WEDNESDAY, true);
mpxjCalendar.setWorkingDay(Day.THURSDAY, true);
mpxjCalendar.setWorkingDay(Day.FRIDAY, true);
mpxjCalendar.setWorkingDay(Day.SATURDAY, false);
}
else
{
mpxjCalendar.setWorkingDay(Day.MONDAY, isWorkingDay(defaultWeek.getMon()));
mpxjCalendar.setWorkingDay(Day.TUESDAY, isWorkingDay(defaultWeek.getTue()));
mpxjCalendar.setWorkingDay(Day.WEDNESDAY, isWorkingDay(defaultWeek.getWed()));
mpxjCalendar.setWorkingDay(Day.THURSDAY, isWorkingDay(defaultWeek.getThu()));
mpxjCalendar.setWorkingDay(Day.FRIDAY, isWorkingDay(defaultWeek.getFri()));
mpxjCalendar.setWorkingDay(Day.SATURDAY, isWorkingDay(defaultWeek.getSat()));
mpxjCalendar.setWorkingDay(Day.SUNDAY, isWorkingDay(defaultWeek.getSun()));
}
for (Day day : Day.values())
{
if (mpxjCalendar.isWorkingDay(day))
{
ProjectCalendarHours hours = mpxjCalendar.addCalendarHours(day);
hours.addRange(ProjectCalendarWeek.DEFAULT_WORKING_MORNING);
hours.addRange(ProjectCalendarWeek.DEFAULT_WORKING_AFTERNOON);
}
}
} | [
"private",
"void",
"setWorkingDays",
"(",
"ProjectCalendar",
"mpxjCalendar",
",",
"Calendars",
"gpCalendar",
")",
"{",
"DayTypes",
"dayTypes",
"=",
"gpCalendar",
".",
"getDayTypes",
"(",
")",
";",
"DefaultWeek",
"defaultWeek",
"=",
"dayTypes",
".",
"getDefaultWeek",... | Add working days and working time to a calendar.
@param mpxjCalendar MPXJ calendar
@param gpCalendar GanttProject calendar | [
"Add",
"working",
"days",
"and",
"working",
"time",
"to",
"a",
"calendar",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ganttproject/GanttProjectReader.java#L239-L273 |
lightblueseas/file-worker | src/main/java/de/alpharogroup/file/read/ReadFileExtensions.java | ReadFileExtensions.readLinesInList | public static List<String> readLinesInList(final File input)
throws FileNotFoundException, IOException
{
return readLinesInList(input, false);
} | java | public static List<String> readLinesInList(final File input)
throws FileNotFoundException, IOException
{
return readLinesInList(input, false);
} | [
"public",
"static",
"List",
"<",
"String",
">",
"readLinesInList",
"(",
"final",
"File",
"input",
")",
"throws",
"FileNotFoundException",
",",
"IOException",
"{",
"return",
"readLinesInList",
"(",
"input",
",",
"false",
")",
";",
"}"
] | Reads every line from the File and puts them to the List.
@param input
The File from where the input comes.
@return The List with all lines from the file.
@throws FileNotFoundException
is thrown if the given file is not found.
@throws IOException
Signals that an I/O exception has occurred. | [
"Reads",
"every",
"line",
"from",
"the",
"File",
"and",
"puts",
"them",
"to",
"the",
"List",
"."
] | train | https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/read/ReadFileExtensions.java#L222-L226 |
adyliu/jafka | src/main/java/io/jafka/consumer/ZookeeperConsumerConnector.java | ZookeeperConsumerConnector.generateConsumerId | private String generateConsumerId() {
UUID uuid = UUID.randomUUID();
try {
return format("%s-%d-%s", InetAddress.getLocalHost().getHostName(), //
System.currentTimeMillis(),//
Long.toHexString(uuid.getMostSignificantBits()).substring(0, 8));
} catch (UnknownHostException e) {
try {
return format("%s-%d-%s", InetAddress.getLocalHost().getHostAddress(), //
System.currentTimeMillis(),//
Long.toHexString(uuid.getMostSignificantBits()).substring(0, 8));
} catch (UnknownHostException ex) {
throw new IllegalArgumentException(
"can not generate consume id by auto, set the 'consumerid' parameter to fix this");
}
}
} | java | private String generateConsumerId() {
UUID uuid = UUID.randomUUID();
try {
return format("%s-%d-%s", InetAddress.getLocalHost().getHostName(), //
System.currentTimeMillis(),//
Long.toHexString(uuid.getMostSignificantBits()).substring(0, 8));
} catch (UnknownHostException e) {
try {
return format("%s-%d-%s", InetAddress.getLocalHost().getHostAddress(), //
System.currentTimeMillis(),//
Long.toHexString(uuid.getMostSignificantBits()).substring(0, 8));
} catch (UnknownHostException ex) {
throw new IllegalArgumentException(
"can not generate consume id by auto, set the 'consumerid' parameter to fix this");
}
}
} | [
"private",
"String",
"generateConsumerId",
"(",
")",
"{",
"UUID",
"uuid",
"=",
"UUID",
".",
"randomUUID",
"(",
")",
";",
"try",
"{",
"return",
"format",
"(",
"\"%s-%d-%s\"",
",",
"InetAddress",
".",
"getLocalHost",
"(",
")",
".",
"getHostName",
"(",
")",
... | generate random consumerid ( hostname-currenttime-uuid.sub(8) )
@return random consumerid | [
"generate",
"random",
"consumerid",
"(",
"hostname",
"-",
"currenttime",
"-",
"uuid",
".",
"sub",
"(",
"8",
")",
")"
] | train | https://github.com/adyliu/jafka/blob/cc14d2ed60c039b12d7b106bb5269ef21d0add7e/src/main/java/io/jafka/consumer/ZookeeperConsumerConnector.java#L266-L282 |
foundation-runtime/service-directory | 2.0/sd-core/src/main/java/com/cisco/oss/foundation/directory/ServiceDirectoryThread.java | ServiceDirectoryThread.getThread | public static Thread getThread(Runnable runnable, String name, boolean deamon){
return doThread(runnable, name, deamon);
} | java | public static Thread getThread(Runnable runnable, String name, boolean deamon){
return doThread(runnable, name, deamon);
} | [
"public",
"static",
"Thread",
"getThread",
"(",
"Runnable",
"runnable",
",",
"String",
"name",
",",
"boolean",
"deamon",
")",
"{",
"return",
"doThread",
"(",
"runnable",
",",
"name",
",",
"deamon",
")",
";",
"}"
] | Get a Thread.
@param runnable
the runnable task.
@param name
the thread name.
@param deamon
the deamon flag.
@return
the Thread. | [
"Get",
"a",
"Thread",
"."
] | train | https://github.com/foundation-runtime/service-directory/blob/a7bdefe173dc99e75eff4a24e07e6407e62f2ed4/2.0/sd-core/src/main/java/com/cisco/oss/foundation/directory/ServiceDirectoryThread.java#L80-L82 |
networknt/light-4j | utility/src/main/java/com/networknt/utility/CharSequenceUtils.java | CharSequenceUtils.subSequence | public static CharSequence subSequence(final CharSequence cs, final int start) {
return cs == null ? null : cs.subSequence(start, cs.length());
} | java | public static CharSequence subSequence(final CharSequence cs, final int start) {
return cs == null ? null : cs.subSequence(start, cs.length());
} | [
"public",
"static",
"CharSequence",
"subSequence",
"(",
"final",
"CharSequence",
"cs",
",",
"final",
"int",
"start",
")",
"{",
"return",
"cs",
"==",
"null",
"?",
"null",
":",
"cs",
".",
"subSequence",
"(",
"start",
",",
"cs",
".",
"length",
"(",
")",
"... | <p>Returns a new {@code CharSequence} that is a subsequence of this
sequence starting with the {@code char} value at the specified index.</p>
<p>This provides the {@code CharSequence} equivalent to {@link String#substring(int)}.
The length (in {@code char}) of the returned sequence is {@code length() - start},
so if {@code start == end} then an empty sequence is returned.</p>
@param cs the specified subsequence, null returns null
@param start the start index, inclusive, valid
@return a new subsequence, may be null
@throws IndexOutOfBoundsException if {@code start} is negative or if
{@code start} is greater than {@code length()} | [
"<p",
">",
"Returns",
"a",
"new",
"{",
"@code",
"CharSequence",
"}",
"that",
"is",
"a",
"subsequence",
"of",
"this",
"sequence",
"starting",
"with",
"the",
"{",
"@code",
"char",
"}",
"value",
"at",
"the",
"specified",
"index",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/utility/src/main/java/com/networknt/utility/CharSequenceUtils.java#L56-L58 |
uoa-group-applications/morc | src/main/java/nz/ac/auckland/morc/MorcBuilder.java | MorcBuilder.addProcessors | public Builder addProcessors(int index, Processor... processors) {
while (index >= this.processors.size()) {
this.processors.add(new ArrayList<>());
}
this.processors.get(index).addAll(new ArrayList<>(Arrays.asList(processors)));
return self();
} | java | public Builder addProcessors(int index, Processor... processors) {
while (index >= this.processors.size()) {
this.processors.add(new ArrayList<>());
}
this.processors.get(index).addAll(new ArrayList<>(Arrays.asList(processors)));
return self();
} | [
"public",
"Builder",
"addProcessors",
"(",
"int",
"index",
",",
"Processor",
"...",
"processors",
")",
"{",
"while",
"(",
"index",
">=",
"this",
".",
"processors",
".",
"size",
"(",
")",
")",
"{",
"this",
".",
"processors",
".",
"add",
"(",
"new",
"Arr... | Add a set of processors to handle an outgoing exchange at a particular offset (n'th message)
@param index The exchange offset that these processors should be applied to
@param processors The processors that will handle populating the exchange with an appropriate outgoing value | [
"Add",
"a",
"set",
"of",
"processors",
"to",
"handle",
"an",
"outgoing",
"exchange",
"at",
"a",
"particular",
"offset",
"(",
"n",
"th",
"message",
")"
] | train | https://github.com/uoa-group-applications/morc/blob/3add6308b1fbfc98187364ac73007c83012ea8ba/src/main/java/nz/ac/auckland/morc/MorcBuilder.java#L72-L78 |
apiman/apiman | manager/api/core/src/main/java/io/apiman/manager/api/core/plugin/AbstractPluginRegistry.java | AbstractPluginRegistry.downloadFromMavenRepo | protected boolean downloadFromMavenRepo(File pluginFile, PluginCoordinates coordinates, URI mavenRepoUrl) {
String artifactSubPath = PluginUtils.getMavenPath(coordinates);
InputStream istream = null;
OutputStream ostream = null;
try {
URL artifactUrl = new URL(mavenRepoUrl.toURL(), artifactSubPath);
URLConnection connection = artifactUrl.openConnection();
connection.connect();
if (connection instanceof HttpURLConnection) {
HttpURLConnection httpConnection = (HttpURLConnection) connection;
if (httpConnection.getResponseCode() != 200) {
throw new IOException();
}
}
istream = connection.getInputStream();
ostream = new FileOutputStream(pluginFile);
IOUtils.copy(istream, ostream);
ostream.flush();
return true;
} catch (Exception e) {
return false;
} finally {
IOUtils.closeQuietly(istream);
IOUtils.closeQuietly(ostream);
}
} | java | protected boolean downloadFromMavenRepo(File pluginFile, PluginCoordinates coordinates, URI mavenRepoUrl) {
String artifactSubPath = PluginUtils.getMavenPath(coordinates);
InputStream istream = null;
OutputStream ostream = null;
try {
URL artifactUrl = new URL(mavenRepoUrl.toURL(), artifactSubPath);
URLConnection connection = artifactUrl.openConnection();
connection.connect();
if (connection instanceof HttpURLConnection) {
HttpURLConnection httpConnection = (HttpURLConnection) connection;
if (httpConnection.getResponseCode() != 200) {
throw new IOException();
}
}
istream = connection.getInputStream();
ostream = new FileOutputStream(pluginFile);
IOUtils.copy(istream, ostream);
ostream.flush();
return true;
} catch (Exception e) {
return false;
} finally {
IOUtils.closeQuietly(istream);
IOUtils.closeQuietly(ostream);
}
} | [
"protected",
"boolean",
"downloadFromMavenRepo",
"(",
"File",
"pluginFile",
",",
"PluginCoordinates",
"coordinates",
",",
"URI",
"mavenRepoUrl",
")",
"{",
"String",
"artifactSubPath",
"=",
"PluginUtils",
".",
"getMavenPath",
"(",
"coordinates",
")",
";",
"InputStream"... | Tries to download the plugin from the given remote maven repository. | [
"Tries",
"to",
"download",
"the",
"plugin",
"from",
"the",
"given",
"remote",
"maven",
"repository",
"."
] | train | https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/manager/api/core/src/main/java/io/apiman/manager/api/core/plugin/AbstractPluginRegistry.java#L177-L203 |
VoltDB/voltdb | third_party/java/src/com/google_voltpatches/common/collect/Iterables.java | Iterables.removeFirstMatching | @Nullable
static <T> T removeFirstMatching(Iterable<T> removeFrom, Predicate<? super T> predicate) {
checkNotNull(predicate);
Iterator<T> iterator = removeFrom.iterator();
while (iterator.hasNext()) {
T next = iterator.next();
if (predicate.apply(next)) {
iterator.remove();
return next;
}
}
return null;
} | java | @Nullable
static <T> T removeFirstMatching(Iterable<T> removeFrom, Predicate<? super T> predicate) {
checkNotNull(predicate);
Iterator<T> iterator = removeFrom.iterator();
while (iterator.hasNext()) {
T next = iterator.next();
if (predicate.apply(next)) {
iterator.remove();
return next;
}
}
return null;
} | [
"@",
"Nullable",
"static",
"<",
"T",
">",
"T",
"removeFirstMatching",
"(",
"Iterable",
"<",
"T",
">",
"removeFrom",
",",
"Predicate",
"<",
"?",
"super",
"T",
">",
"predicate",
")",
"{",
"checkNotNull",
"(",
"predicate",
")",
";",
"Iterator",
"<",
"T",
... | Removes and returns the first matching element, or returns {@code null} if there is none. | [
"Removes",
"and",
"returns",
"the",
"first",
"matching",
"element",
"or",
"returns",
"{"
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/com/google_voltpatches/common/collect/Iterables.java#L242-L254 |
xetorthio/jedis | src/main/java/redis/clients/jedis/BinaryJedis.java | BinaryJedis.hdel | @Override
public Long hdel(final byte[] key, final byte[]... fields) {
checkIsInMultiOrPipeline();
client.hdel(key, fields);
return client.getIntegerReply();
} | java | @Override
public Long hdel(final byte[] key, final byte[]... fields) {
checkIsInMultiOrPipeline();
client.hdel(key, fields);
return client.getIntegerReply();
} | [
"@",
"Override",
"public",
"Long",
"hdel",
"(",
"final",
"byte",
"[",
"]",
"key",
",",
"final",
"byte",
"[",
"]",
"...",
"fields",
")",
"{",
"checkIsInMultiOrPipeline",
"(",
")",
";",
"client",
".",
"hdel",
"(",
"key",
",",
"fields",
")",
";",
"retur... | Remove the specified field from an hash stored at key.
<p>
<b>Time complexity:</b> O(1)
@param key
@param fields
@return If the field was present in the hash it is deleted and 1 is returned, otherwise 0 is
returned and no operation is performed. | [
"Remove",
"the",
"specified",
"field",
"from",
"an",
"hash",
"stored",
"at",
"key",
".",
"<p",
">",
"<b",
">",
"Time",
"complexity",
":",
"<",
"/",
"b",
">",
"O",
"(",
"1",
")"
] | train | https://github.com/xetorthio/jedis/blob/ef4ab403f9d8fd88bd05092fea96de2e9db0bede/src/main/java/redis/clients/jedis/BinaryJedis.java#L1044-L1049 |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/cdn/CdnClient.java | CdnClient.createDomain | public CreateDomainResponse createDomain(CreateDomainRequest request) {
checkNotNull(request, "The parameter request should NOT be null.");
InternalRequest internalRequest = createRequest(request, HttpMethodName.PUT, DOMAIN, request.getDomain());
this.attachRequestToBody(request, internalRequest);
return invokeHttpClient(internalRequest, CreateDomainResponse.class);
} | java | public CreateDomainResponse createDomain(CreateDomainRequest request) {
checkNotNull(request, "The parameter request should NOT be null.");
InternalRequest internalRequest = createRequest(request, HttpMethodName.PUT, DOMAIN, request.getDomain());
this.attachRequestToBody(request, internalRequest);
return invokeHttpClient(internalRequest, CreateDomainResponse.class);
} | [
"public",
"CreateDomainResponse",
"createDomain",
"(",
"CreateDomainRequest",
"request",
")",
"{",
"checkNotNull",
"(",
"request",
",",
"\"The parameter request should NOT be null.\"",
")",
";",
"InternalRequest",
"internalRequest",
"=",
"createRequest",
"(",
"request",
","... | Create a new domain acceleration.
@param request The request containing user-defined domain information.
@return Result of the createDomain operation returned by the service. | [
"Create",
"a",
"new",
"domain",
"acceleration",
"."
] | train | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/cdn/CdnClient.java#L182-L187 |
UrielCh/ovh-java-sdk | ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java | ApiOvhEmailexchange.organizationName_service_exchangeService_sharedAccount_POST | public OvhTask organizationName_service_exchangeService_sharedAccount_POST(String organizationName, String exchangeService, String displayName, String firstName, Boolean hiddenFromGAL, String initials, String lastName, OvhMailingFilterEnum[] mailingFilter, Long quota, String sharedEmailAddress) throws IOException {
String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/sharedAccount";
StringBuilder sb = path(qPath, organizationName, exchangeService);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "displayName", displayName);
addBody(o, "firstName", firstName);
addBody(o, "hiddenFromGAL", hiddenFromGAL);
addBody(o, "initials", initials);
addBody(o, "lastName", lastName);
addBody(o, "mailingFilter", mailingFilter);
addBody(o, "quota", quota);
addBody(o, "sharedEmailAddress", sharedEmailAddress);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhTask.class);
} | java | public OvhTask organizationName_service_exchangeService_sharedAccount_POST(String organizationName, String exchangeService, String displayName, String firstName, Boolean hiddenFromGAL, String initials, String lastName, OvhMailingFilterEnum[] mailingFilter, Long quota, String sharedEmailAddress) throws IOException {
String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/sharedAccount";
StringBuilder sb = path(qPath, organizationName, exchangeService);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "displayName", displayName);
addBody(o, "firstName", firstName);
addBody(o, "hiddenFromGAL", hiddenFromGAL);
addBody(o, "initials", initials);
addBody(o, "lastName", lastName);
addBody(o, "mailingFilter", mailingFilter);
addBody(o, "quota", quota);
addBody(o, "sharedEmailAddress", sharedEmailAddress);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhTask.class);
} | [
"public",
"OvhTask",
"organizationName_service_exchangeService_sharedAccount_POST",
"(",
"String",
"organizationName",
",",
"String",
"exchangeService",
",",
"String",
"displayName",
",",
"String",
"firstName",
",",
"Boolean",
"hiddenFromGAL",
",",
"String",
"initials",
","... | Create new shared mailbox in exchange server
REST: POST /email/exchange/{organizationName}/service/{exchangeService}/sharedAccount
@param mailingFilter [required] Enable mailing filtrering
@param lastName [required] Shared account last name
@param hiddenFromGAL [required] Hide the shared account in Global Address List
@param initials [required] Shared account initials
@param quota [required] Shared account maximum size
@param displayName [required] Shared account display name
@param sharedEmailAddress [required] Shared account email address
@param firstName [required] Shared account first name
@param organizationName [required] The internal name of your exchange organization
@param exchangeService [required] The internal name of your exchange service | [
"Create",
"new",
"shared",
"mailbox",
"in",
"exchange",
"server"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java#L617-L631 |
kaazing/java.client | ws/ws/src/main/java/org/kaazing/gateway/client/util/WrappedByteBuffer.java | WrappedByteBuffer.fillWith | public WrappedByteBuffer fillWith(byte b, int size) {
_autoExpand(size);
while (size-- > 0) {
_buf.put(b);
}
return this;
} | java | public WrappedByteBuffer fillWith(byte b, int size) {
_autoExpand(size);
while (size-- > 0) {
_buf.put(b);
}
return this;
} | [
"public",
"WrappedByteBuffer",
"fillWith",
"(",
"byte",
"b",
",",
"int",
"size",
")",
"{",
"_autoExpand",
"(",
"size",
")",
";",
"while",
"(",
"size",
"--",
">",
"0",
")",
"{",
"_buf",
".",
"put",
"(",
"b",
")",
";",
"}",
"return",
"this",
";",
"... | Fills the buffer with a specific number of repeated bytes.
@param b
the byte to repeat
@param size
the number of times to repeat
@return the buffer | [
"Fills",
"the",
"buffer",
"with",
"a",
"specific",
"number",
"of",
"repeated",
"bytes",
"."
] | train | https://github.com/kaazing/java.client/blob/25ad2ae5bb24aa9d6b79400fce649b518dcfbe26/ws/ws/src/main/java/org/kaazing/gateway/client/util/WrappedByteBuffer.java#L305-L311 |
jglobus/JGlobus | ssl-proxies/src/main/java/org/globus/gsi/bc/BouncyCastleUtil.java | BouncyCastleUtil.getIdentity | public static String getIdentity(X509Certificate cert) {
if (cert == null) {
return null;
}
String subjectDN = cert.getSubjectX500Principal().getName(X500Principal.RFC2253);
X509Name name = new X509Name(true, subjectDN);
return X509NameHelper.toString(name);
} | java | public static String getIdentity(X509Certificate cert) {
if (cert == null) {
return null;
}
String subjectDN = cert.getSubjectX500Principal().getName(X500Principal.RFC2253);
X509Name name = new X509Name(true, subjectDN);
return X509NameHelper.toString(name);
} | [
"public",
"static",
"String",
"getIdentity",
"(",
"X509Certificate",
"cert",
")",
"{",
"if",
"(",
"cert",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"String",
"subjectDN",
"=",
"cert",
".",
"getSubjectX500Principal",
"(",
")",
".",
"getName",
"(",... | Returns the subject DN of the given certificate in the Globus format.
@param cert the certificate to get the subject of. The certificate
must be of <code>X509CertificateObject</code> type.
@return the subject DN of the certificate in the Globus format. | [
"Returns",
"the",
"subject",
"DN",
"of",
"the",
"given",
"certificate",
"in",
"the",
"Globus",
"format",
"."
] | train | https://github.com/jglobus/JGlobus/blob/e14f6f6636544fd84298f9cec749d626ea971930/ssl-proxies/src/main/java/org/globus/gsi/bc/BouncyCastleUtil.java#L425-L433 |
b3dgs/lionengine | lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/collidable/ComponentCollision.java | ComponentCollision.removePoints | private void removePoints(double x, double y, Collidable collidable)
{
final int minX = (int) Math.floor(x / REDUCE_FACTOR);
final int minY = (int) Math.floor(y / REDUCE_FACTOR);
final int maxX = (int) Math.floor((x + collidable.getMaxWidth()) / REDUCE_FACTOR);
final int maxY = (int) Math.floor((y + collidable.getMaxHeight()) / REDUCE_FACTOR);
removePoints(minX, minY, maxX, maxY, collidable);
} | java | private void removePoints(double x, double y, Collidable collidable)
{
final int minX = (int) Math.floor(x / REDUCE_FACTOR);
final int minY = (int) Math.floor(y / REDUCE_FACTOR);
final int maxX = (int) Math.floor((x + collidable.getMaxWidth()) / REDUCE_FACTOR);
final int maxY = (int) Math.floor((y + collidable.getMaxHeight()) / REDUCE_FACTOR);
removePoints(minX, minY, maxX, maxY, collidable);
} | [
"private",
"void",
"removePoints",
"(",
"double",
"x",
",",
"double",
"y",
",",
"Collidable",
"collidable",
")",
"{",
"final",
"int",
"minX",
"=",
"(",
"int",
")",
"Math",
".",
"floor",
"(",
"x",
"/",
"REDUCE_FACTOR",
")",
";",
"final",
"int",
"minY",
... | Remove point and adjacent points depending of the collidable max collision size.
@param x The horizontal location.
@param y The vertical location.
@param collidable The collidable reference. | [
"Remove",
"point",
"and",
"adjacent",
"points",
"depending",
"of",
"the",
"collidable",
"max",
"collision",
"size",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/collidable/ComponentCollision.java#L284-L292 |
zaproxy/zaproxy | src/org/zaproxy/zap/extension/help/ZapTocView.java | ZapTocView.getDataAsTree | @Override
public DefaultMutableTreeNode getDataAsTree() {
HelpSet hs = getHelpSet();
Hashtable<?, ?> params = getParameters();
URL url;
if (params == null || !params.containsKey("data")) {
return new DefaultMutableTreeNode();
}
try {
url = new URL(hs.getHelpSetURL(), (String) params.get("data"));
} catch (Exception ex) {
throw new Error("Trouble getting URL to TOC data; " + ex);
}
return parse(url, hs, hs.getLocale(), new TreeItemFactoryImpl(), this);
} | java | @Override
public DefaultMutableTreeNode getDataAsTree() {
HelpSet hs = getHelpSet();
Hashtable<?, ?> params = getParameters();
URL url;
if (params == null || !params.containsKey("data")) {
return new DefaultMutableTreeNode();
}
try {
url = new URL(hs.getHelpSetURL(), (String) params.get("data"));
} catch (Exception ex) {
throw new Error("Trouble getting URL to TOC data; " + ex);
}
return parse(url, hs, hs.getLocale(), new TreeItemFactoryImpl(), this);
} | [
"@",
"Override",
"public",
"DefaultMutableTreeNode",
"getDataAsTree",
"(",
")",
"{",
"HelpSet",
"hs",
"=",
"getHelpSet",
"(",
")",
";",
"Hashtable",
"<",
"?",
",",
"?",
">",
"params",
"=",
"getParameters",
"(",
")",
";",
"URL",
"url",
";",
"if",
"(",
"... | Note: The implementation has been copied (verbatim) from the base method except for the use of a custom TreeItemFactory. | [
"Note",
":",
"The",
"implementation",
"has",
"been",
"copied",
"(",
"verbatim",
")",
"from",
"the",
"base",
"method",
"except",
"for",
"the",
"use",
"of",
"a",
"custom",
"TreeItemFactory",
"."
] | train | https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/extension/help/ZapTocView.java#L58-L75 |
jhunters/jprotobuf | src/main/java/com/baidu/bjf/remoting/protobuf/utils/MiniTemplator.java | MiniTemplatorParser.excludeTemplateRange | private void excludeTemplateRange(int tPosBegin, int tPosEnd) {
if (blockTabCnt > 0) {
// Check whether we can extend the previous block.
BlockTabRec btr = blockTab[blockTabCnt - 1];
if (btr.dummy && btr.tPosEnd == tPosBegin) {
btr.tPosContentsEnd = tPosEnd;
btr.tPosEnd = tPosEnd;
return;
}
}
int blockNo = registerBlock(null);
BlockTabRec btr = blockTab[blockNo];
btr.tPosBegin = tPosBegin;
btr.tPosContentsBegin = tPosBegin;
btr.tPosContentsEnd = tPosEnd;
btr.tPosEnd = tPosEnd;
btr.definitionIsOpen = false;
btr.dummy = true;
} | java | private void excludeTemplateRange(int tPosBegin, int tPosEnd) {
if (blockTabCnt > 0) {
// Check whether we can extend the previous block.
BlockTabRec btr = blockTab[blockTabCnt - 1];
if (btr.dummy && btr.tPosEnd == tPosBegin) {
btr.tPosContentsEnd = tPosEnd;
btr.tPosEnd = tPosEnd;
return;
}
}
int blockNo = registerBlock(null);
BlockTabRec btr = blockTab[blockNo];
btr.tPosBegin = tPosBegin;
btr.tPosContentsBegin = tPosBegin;
btr.tPosContentsEnd = tPosEnd;
btr.tPosEnd = tPosEnd;
btr.definitionIsOpen = false;
btr.dummy = true;
} | [
"private",
"void",
"excludeTemplateRange",
"(",
"int",
"tPosBegin",
",",
"int",
"tPosEnd",
")",
"{",
"if",
"(",
"blockTabCnt",
">",
"0",
")",
"{",
"// Check whether we can extend the previous block.\r",
"BlockTabRec",
"btr",
"=",
"blockTab",
"[",
"blockTabCnt",
"-",... | Registers a dummy block to exclude a range within the template text. | [
"Registers",
"a",
"dummy",
"block",
"to",
"exclude",
"a",
"range",
"within",
"the",
"template",
"text",
"."
] | train | https://github.com/jhunters/jprotobuf/blob/55832c9b4792afb128e5b35139d8a3891561d8a3/src/main/java/com/baidu/bjf/remoting/protobuf/utils/MiniTemplator.java#L1234-L1252 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.