repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 201 | func_name stringlengths 4 126 | whole_func_string stringlengths 75 3.57k | language stringclasses 1
value | func_code_string stringlengths 75 3.57k | func_code_tokens listlengths 21 599 | func_documentation_string stringlengths 61 1.95k | func_documentation_tokens listlengths 1 478 | split_name stringclasses 1
value | func_code_url stringlengths 111 308 |
|---|---|---|---|---|---|---|---|---|---|---|
looly/hutool | hutool-extra/src/main/java/cn/hutool/extra/template/engine/velocity/VelocityUtil.java | VelocityUtil.getContent | public static String getContent(String templateDir, String templateFileName, VelocityContext context, String charset) {
// 初始化模板引擎
final VelocityEngine ve = newEngine(templateDir, charset);
return getContent(ve, templateFileName, context);
} | java | public static String getContent(String templateDir, String templateFileName, VelocityContext context, String charset) {
// 初始化模板引擎
final VelocityEngine ve = newEngine(templateDir, charset);
return getContent(ve, templateFileName, context);
} | [
"public",
"static",
"String",
"getContent",
"(",
"String",
"templateDir",
",",
"String",
"templateFileName",
",",
"VelocityContext",
"context",
",",
"String",
"charset",
")",
"{",
"// 初始化模板引擎\r",
"final",
"VelocityEngine",
"ve",
"=",
"newEngine",
"(",
"templateDir",... | 获得指定模板填充后的内容
@param templateDir 模板所在目录,绝对路径
@param templateFileName 模板名称
@param context 上下文(变量值的容器)
@param charset 字符集
@return 模板和内容匹配后的内容 | [
"获得指定模板填充后的内容"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/template/engine/velocity/VelocityUtil.java#L99-L104 |
OpenTSDB/opentsdb | src/tsd/TreeRpc.java | TreeRpc.parseTreeId | private int parseTreeId(HttpQuery query, final boolean required) {
try{
if (required) {
return Integer.parseInt(query.getRequiredQueryStringParam("treeid"));
} else {
if (query.hasQueryStringParam("treeid")) {
return Integer.parseInt(query.getQueryStringParam("treeid"));
} else {
return 0;
}
}
} catch (NumberFormatException nfe) {
throw new BadRequestException("Unable to parse 'tree' value", nfe);
}
} | java | private int parseTreeId(HttpQuery query, final boolean required) {
try{
if (required) {
return Integer.parseInt(query.getRequiredQueryStringParam("treeid"));
} else {
if (query.hasQueryStringParam("treeid")) {
return Integer.parseInt(query.getQueryStringParam("treeid"));
} else {
return 0;
}
}
} catch (NumberFormatException nfe) {
throw new BadRequestException("Unable to parse 'tree' value", nfe);
}
} | [
"private",
"int",
"parseTreeId",
"(",
"HttpQuery",
"query",
",",
"final",
"boolean",
"required",
")",
"{",
"try",
"{",
"if",
"(",
"required",
")",
"{",
"return",
"Integer",
".",
"parseInt",
"(",
"query",
".",
"getRequiredQueryStringParam",
"(",
"\"treeid\"",
... | Parses the tree ID from a query
Used often so it's been broken into it's own method
@param query The HTTP query to work with
@param required Whether or not the ID is required for the given call
@return The tree ID or 0 if not provided | [
"Parses",
"the",
"tree",
"ID",
"from",
"a",
"query",
"Used",
"often",
"so",
"it",
"s",
"been",
"broken",
"into",
"it",
"s",
"own",
"method"
] | train | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tsd/TreeRpc.java#L692-L706 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeAnnotationPosition.java | TypeAnnotationPosition.methodThrows | public static TypeAnnotationPosition
methodThrows(final List<TypePathEntry> location,
final int type_index) {
return methodThrows(location, null, type_index, -1);
} | java | public static TypeAnnotationPosition
methodThrows(final List<TypePathEntry> location,
final int type_index) {
return methodThrows(location, null, type_index, -1);
} | [
"public",
"static",
"TypeAnnotationPosition",
"methodThrows",
"(",
"final",
"List",
"<",
"TypePathEntry",
">",
"location",
",",
"final",
"int",
"type_index",
")",
"{",
"return",
"methodThrows",
"(",
"location",
",",
"null",
",",
"type_index",
",",
"-",
"1",
")... | Create a {@code TypeAnnotationPosition} for a throws clause.
@param location The type path.
@param type_index The index of the exception. | [
"Create",
"a",
"{",
"@code",
"TypeAnnotationPosition",
"}",
"for",
"a",
"throws",
"clause",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeAnnotationPosition.java#L1037-L1041 |
arquillian/arquillian-algeron | common/git/src/main/java/org/arquillian/algeron/git/GitOperations.java | GitOperations.isRemoteBranch | public boolean isRemoteBranch(final Git git, final String branch, final String remote) {
try {
final List<Ref> refs = git.branchList()
.setListMode(ListBranchCommand.ListMode.REMOTE).call();
final String remoteBranch = remote + "/" + branch;
return refs.stream().anyMatch(ref -> ref.getName().endsWith(remoteBranch));
} catch (GitAPIException e) {
throw new IllegalStateException(e);
}
} | java | public boolean isRemoteBranch(final Git git, final String branch, final String remote) {
try {
final List<Ref> refs = git.branchList()
.setListMode(ListBranchCommand.ListMode.REMOTE).call();
final String remoteBranch = remote + "/" + branch;
return refs.stream().anyMatch(ref -> ref.getName().endsWith(remoteBranch));
} catch (GitAPIException e) {
throw new IllegalStateException(e);
}
} | [
"public",
"boolean",
"isRemoteBranch",
"(",
"final",
"Git",
"git",
",",
"final",
"String",
"branch",
",",
"final",
"String",
"remote",
")",
"{",
"try",
"{",
"final",
"List",
"<",
"Ref",
">",
"refs",
"=",
"git",
".",
"branchList",
"(",
")",
".",
"setLis... | Checks if given branch is remote.
@param git
instance.
@param branch
to check.
@param remote
name.
@return True if it is remote, false otherwise. | [
"Checks",
"if",
"given",
"branch",
"is",
"remote",
"."
] | train | https://github.com/arquillian/arquillian-algeron/blob/ec79372defdafe99ab2f7bb696f1c1eabdbbacb6/common/git/src/main/java/org/arquillian/algeron/git/GitOperations.java#L119-L129 |
threerings/narya | tools/src/main/java/com/threerings/presents/tools/GenTask.java | GenTask.mergeTemplate | protected String mergeTemplate (String template, Object... data)
throws IOException
{
return mergeTemplate(template, createMap(data));
} | java | protected String mergeTemplate (String template, Object... data)
throws IOException
{
return mergeTemplate(template, createMap(data));
} | [
"protected",
"String",
"mergeTemplate",
"(",
"String",
"template",
",",
"Object",
"...",
"data",
")",
"throws",
"IOException",
"{",
"return",
"mergeTemplate",
"(",
"template",
",",
"createMap",
"(",
"data",
")",
")",
";",
"}"
] | Merges the specified template using the supplied mapping of keys to objects.
@param data a series of key, value pairs where the keys must be strings and the values can
be any object. | [
"Merges",
"the",
"specified",
"template",
"using",
"the",
"supplied",
"mapping",
"of",
"keys",
"to",
"objects",
"."
] | train | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/tools/src/main/java/com/threerings/presents/tools/GenTask.java#L206-L210 |
j-a-w-r/jawr-main-repo | jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/mappings/CompositeBundlePathMappingBuilder.java | CompositeBundlePathMappingBuilder.addFilePathMapping | private void addFilePathMapping(BundlePathMapping bundlePathMapping, List<BundlePath> itemPathList) {
for (BundlePath bundlePath : itemPathList) {
addFilePathMapping(bundlePathMapping, bundlePath.getPath());
}
} | java | private void addFilePathMapping(BundlePathMapping bundlePathMapping, List<BundlePath> itemPathList) {
for (BundlePath bundlePath : itemPathList) {
addFilePathMapping(bundlePathMapping, bundlePath.getPath());
}
} | [
"private",
"void",
"addFilePathMapping",
"(",
"BundlePathMapping",
"bundlePathMapping",
",",
"List",
"<",
"BundlePath",
">",
"itemPathList",
")",
"{",
"for",
"(",
"BundlePath",
"bundlePath",
":",
"itemPathList",
")",
"{",
"addFilePathMapping",
"(",
"bundlePathMapping"... | Adds bundle paths to the file path mapping
@param bundlePathMapping
the bundle path mapping
@param paths
the paths to add | [
"Adds",
"bundle",
"paths",
"to",
"the",
"file",
"path",
"mapping"
] | train | https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/mappings/CompositeBundlePathMappingBuilder.java#L97-L101 |
haifengl/smile | core/src/main/java/smile/classification/NeuralNetwork.java | NeuralNetwork.backpropagate | private void backpropagate(Layer upper, Layer lower) {
for (int i = 0; i <= lower.units; i++) {
double out = lower.output[i];
double err = 0;
for (int j = 0; j < upper.units; j++) {
err += upper.weight[j][i] * upper.error[j];
}
lower.error[i] = out * (1.0 - out) * err;
}
} | java | private void backpropagate(Layer upper, Layer lower) {
for (int i = 0; i <= lower.units; i++) {
double out = lower.output[i];
double err = 0;
for (int j = 0; j < upper.units; j++) {
err += upper.weight[j][i] * upper.error[j];
}
lower.error[i] = out * (1.0 - out) * err;
}
} | [
"private",
"void",
"backpropagate",
"(",
"Layer",
"upper",
",",
"Layer",
"lower",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<=",
"lower",
".",
"units",
";",
"i",
"++",
")",
"{",
"double",
"out",
"=",
"lower",
".",
"output",
"[",
"i",... | Propagates the errors back from a upper layer to the next lower layer.
@param upper the lower layer where errors are from.
@param lower the upper layer where errors are propagated back to. | [
"Propagates",
"the",
"errors",
"back",
"from",
"a",
"upper",
"layer",
"to",
"the",
"next",
"lower",
"layer",
"."
] | train | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/classification/NeuralNetwork.java#L738-L747 |
micronaut-projects/micronaut-core | core/src/main/java/io/micronaut/core/util/clhm/ConcurrentLinkedHashMap.java | ConcurrentLinkedHashMap.makeDead | @GuardedBy("evictionLock")
void makeDead(Node<K, V> node) {
for (;;) {
WeightedValue<V> current = node.get();
WeightedValue<V> dead = new WeightedValue<V>(current.value, 0);
if (node.compareAndSet(current, dead)) {
weightedSize.lazySet(weightedSize.get() - Math.abs(current.weight));
return;
}
}
} | java | @GuardedBy("evictionLock")
void makeDead(Node<K, V> node) {
for (;;) {
WeightedValue<V> current = node.get();
WeightedValue<V> dead = new WeightedValue<V>(current.value, 0);
if (node.compareAndSet(current, dead)) {
weightedSize.lazySet(weightedSize.get() - Math.abs(current.weight));
return;
}
}
} | [
"@",
"GuardedBy",
"(",
"\"evictionLock\"",
")",
"void",
"makeDead",
"(",
"Node",
"<",
"K",
",",
"V",
">",
"node",
")",
"{",
"for",
"(",
";",
";",
")",
"{",
"WeightedValue",
"<",
"V",
">",
"current",
"=",
"node",
".",
"get",
"(",
")",
";",
"Weight... | Atomically transitions the node to the <tt>dead</tt> state and decrements
the <tt>weightedSize</tt>.
@param node the entry in the page replacement policy | [
"Atomically",
"transitions",
"the",
"node",
"to",
"the",
"<tt",
">",
"dead<",
"/",
"tt",
">",
"state",
"and",
"decrements",
"the",
"<tt",
">",
"weightedSize<",
"/",
"tt",
">",
"."
] | train | https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/core/src/main/java/io/micronaut/core/util/clhm/ConcurrentLinkedHashMap.java#L517-L527 |
metamx/java-util | src/main/java/com/metamx/common/parsers/JSONPathParser.java | JSONPathParser.parse | @Override
public Map<String, Object> parse(String input)
{
try {
Map<String, Object> map = new LinkedHashMap<>();
Map<String, Object> document = mapper.readValue(
input,
new TypeReference<Map<String, Object>>()
{
}
);
for (Map.Entry<String, Pair<FieldType, JsonPath>> entry : fieldPathMap.entrySet()) {
String fieldName = entry.getKey();
Pair<FieldType, JsonPath> pair = entry.getValue();
JsonPath path = pair.rhs;
Object parsedVal;
if (pair.lhs == FieldType.ROOT) {
parsedVal = document.get(fieldName);
} else {
parsedVal = path.read(document, jsonPathConfig);
}
if (parsedVal == null) {
continue;
}
parsedVal = valueConversionFunction(parsedVal);
map.put(fieldName, parsedVal);
}
if (useFieldDiscovery) {
discoverFields(map, document);
}
return map;
}
catch (Exception e) {
throw new ParseException(e, "Unable to parse row [%s]", input);
}
} | java | @Override
public Map<String, Object> parse(String input)
{
try {
Map<String, Object> map = new LinkedHashMap<>();
Map<String, Object> document = mapper.readValue(
input,
new TypeReference<Map<String, Object>>()
{
}
);
for (Map.Entry<String, Pair<FieldType, JsonPath>> entry : fieldPathMap.entrySet()) {
String fieldName = entry.getKey();
Pair<FieldType, JsonPath> pair = entry.getValue();
JsonPath path = pair.rhs;
Object parsedVal;
if (pair.lhs == FieldType.ROOT) {
parsedVal = document.get(fieldName);
} else {
parsedVal = path.read(document, jsonPathConfig);
}
if (parsedVal == null) {
continue;
}
parsedVal = valueConversionFunction(parsedVal);
map.put(fieldName, parsedVal);
}
if (useFieldDiscovery) {
discoverFields(map, document);
}
return map;
}
catch (Exception e) {
throw new ParseException(e, "Unable to parse row [%s]", input);
}
} | [
"@",
"Override",
"public",
"Map",
"<",
"String",
",",
"Object",
">",
"parse",
"(",
"String",
"input",
")",
"{",
"try",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"map",
"=",
"new",
"LinkedHashMap",
"<>",
"(",
")",
";",
"Map",
"<",
"String",
","... | @param input JSON string. The root must be a JSON object, not an array.
e.g., {"valid": "true"} and {"valid":[1,2,3]} are supported
but [{"invalid": "true"}] and [1,2,3] are not.
@return A map of field names and values | [
"@param",
"input",
"JSON",
"string",
".",
"The",
"root",
"must",
"be",
"a",
"JSON",
"object",
"not",
"an",
"array",
".",
"e",
".",
"g",
".",
"{",
"valid",
":",
"true",
"}",
"and",
"{",
"valid",
":",
"[",
"1",
"2",
"3",
"]",
"}",
"are",
"support... | train | https://github.com/metamx/java-util/blob/9d204043da1136e94fb2e2d63e3543a29bf54b4d/src/main/java/com/metamx/common/parsers/JSONPathParser.java#L92-L127 |
jferard/fastods | fastods/src/main/java/com/github/jferard/fastods/datastyle/FloatStyle.java | FloatStyle.appendXMLAttributes | void appendXMLAttributes(final XMLUtil util, final Appendable appendable) throws IOException {
util.appendAttribute(appendable, "number:decimal-places",
this.decimalPlaces);
this.numberStyle.appendNumberAttribute(util, appendable);
} | java | void appendXMLAttributes(final XMLUtil util, final Appendable appendable) throws IOException {
util.appendAttribute(appendable, "number:decimal-places",
this.decimalPlaces);
this.numberStyle.appendNumberAttribute(util, appendable);
} | [
"void",
"appendXMLAttributes",
"(",
"final",
"XMLUtil",
"util",
",",
"final",
"Appendable",
"appendable",
")",
"throws",
"IOException",
"{",
"util",
".",
"appendAttribute",
"(",
"appendable",
",",
"\"number:decimal-places\"",
",",
"this",
".",
"decimalPlaces",
")",
... | Append number:decimal-places, number:min-integer-digits and number:grouping
@param util an XML util
@param appendable the appendable
@throws IOException if an I/O error occurs | [
"Append",
"number",
":",
"decimal",
"-",
"places",
"number",
":",
"min",
"-",
"integer",
"-",
"digits",
"and",
"number",
":",
"grouping"
] | train | https://github.com/jferard/fastods/blob/a034d173083ffa602dc525699b97f753082eaef9/fastods/src/main/java/com/github/jferard/fastods/datastyle/FloatStyle.java#L90-L94 |
apereo/cas | support/cas-server-support-ldap-core/src/main/java/org/apereo/cas/util/LdapUtils.java | LdapUtils.executeAddOperation | public static boolean executeAddOperation(final ConnectionFactory connectionFactory, final LdapEntry entry) {
try (val connection = createConnection(connectionFactory)) {
val operation = new AddOperation(connection);
operation.execute(new AddRequest(entry.getDn(), entry.getAttributes()));
return true;
} catch (final LdapException e) {
LOGGER.error(e.getMessage(), e);
}
return false;
} | java | public static boolean executeAddOperation(final ConnectionFactory connectionFactory, final LdapEntry entry) {
try (val connection = createConnection(connectionFactory)) {
val operation = new AddOperation(connection);
operation.execute(new AddRequest(entry.getDn(), entry.getAttributes()));
return true;
} catch (final LdapException e) {
LOGGER.error(e.getMessage(), e);
}
return false;
} | [
"public",
"static",
"boolean",
"executeAddOperation",
"(",
"final",
"ConnectionFactory",
"connectionFactory",
",",
"final",
"LdapEntry",
"entry",
")",
"{",
"try",
"(",
"val",
"connection",
"=",
"createConnection",
"(",
"connectionFactory",
")",
")",
"{",
"val",
"o... | Execute add operation boolean.
@param connectionFactory the connection factory
@param entry the entry
@return true/false | [
"Execute",
"add",
"operation",
"boolean",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-ldap-core/src/main/java/org/apereo/cas/util/LdapUtils.java#L399-L408 |
wildfly/wildfly-core | patching/src/main/java/org/jboss/as/patching/runner/IdentityPatchContext.java | IdentityPatchContext.undoChanges | static void undoChanges(final PatchEntry entry, final PatchContentLoader loader) {
final List<ContentModification> modifications = new ArrayList<ContentModification>(entry.rollbackActions);
for (final ContentModification modification : modifications) {
final ContentItem item = modification.getItem();
if (item.getContentType() != ContentType.MISC) {
// Skip modules and bundles they should be removed as part of the {@link FinalizeCallback}
continue;
}
final PatchingTaskDescription description = new PatchingTaskDescription(entry.applyPatchId, modification, loader, false, false, false);
try {
final PatchingTask task = PatchingTask.Factory.create(description, entry);
task.execute(entry);
} catch (Exception e) {
PatchLogger.ROOT_LOGGER.failedToUndoChange(item.toString());
}
}
} | java | static void undoChanges(final PatchEntry entry, final PatchContentLoader loader) {
final List<ContentModification> modifications = new ArrayList<ContentModification>(entry.rollbackActions);
for (final ContentModification modification : modifications) {
final ContentItem item = modification.getItem();
if (item.getContentType() != ContentType.MISC) {
// Skip modules and bundles they should be removed as part of the {@link FinalizeCallback}
continue;
}
final PatchingTaskDescription description = new PatchingTaskDescription(entry.applyPatchId, modification, loader, false, false, false);
try {
final PatchingTask task = PatchingTask.Factory.create(description, entry);
task.execute(entry);
} catch (Exception e) {
PatchLogger.ROOT_LOGGER.failedToUndoChange(item.toString());
}
}
} | [
"static",
"void",
"undoChanges",
"(",
"final",
"PatchEntry",
"entry",
",",
"final",
"PatchContentLoader",
"loader",
")",
"{",
"final",
"List",
"<",
"ContentModification",
">",
"modifications",
"=",
"new",
"ArrayList",
"<",
"ContentModification",
">",
"(",
"entry",... | Undo changes for a single patch entry.
@param entry the patch entry
@param loader the content loader | [
"Undo",
"changes",
"for",
"a",
"single",
"patch",
"entry",
"."
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/runner/IdentityPatchContext.java#L488-L504 |
knightliao/disconf | disconf-core/src/main/java/com/baidu/disconf/core/common/zookeeper/ZookeeperMgr.java | ZookeeperMgr.initInternal | private void initInternal(String hosts, String defaultPrefixString, boolean debug)
throws IOException, InterruptedException {
curHost = hosts;
curDefaultPrefixString = defaultPrefixString;
store = new ResilientActiveKeyValueStore(debug);
store.connect(hosts);
LOGGER.info("zoo prefix: " + defaultPrefixString);
// 新建父目录
makeDir(defaultPrefixString, ZooUtils.getIp());
} | java | private void initInternal(String hosts, String defaultPrefixString, boolean debug)
throws IOException, InterruptedException {
curHost = hosts;
curDefaultPrefixString = defaultPrefixString;
store = new ResilientActiveKeyValueStore(debug);
store.connect(hosts);
LOGGER.info("zoo prefix: " + defaultPrefixString);
// 新建父目录
makeDir(defaultPrefixString, ZooUtils.getIp());
} | [
"private",
"void",
"initInternal",
"(",
"String",
"hosts",
",",
"String",
"defaultPrefixString",
",",
"boolean",
"debug",
")",
"throws",
"IOException",
",",
"InterruptedException",
"{",
"curHost",
"=",
"hosts",
";",
"curDefaultPrefixString",
"=",
"defaultPrefixString"... | @return void
@throws IOException
@throws InterruptedException
@Description: 初始化
@author liaoqiqi
@date 2013-6-14 | [
"@return",
"void"
] | train | https://github.com/knightliao/disconf/blob/d413cbce9334fe38a5a24982ce4db3a6ed8e98ea/disconf-core/src/main/java/com/baidu/disconf/core/common/zookeeper/ZookeeperMgr.java#L91-L104 |
redkale/redkale | src/org/redkale/asm/ClassReader.java | ClassReader.readTypeAnnotations | private int[] readTypeAnnotations(final MethodVisitor mv,
final Context context, int u, boolean visible) {
char[] c = context.buffer;
int[] offsets = new int[readUnsignedShort(u)];
u += 2;
for (int i = 0; i < offsets.length; ++i) {
offsets[i] = u;
int target = readInt(u);
switch (target >>> 24) {
case 0x00: // CLASS_TYPE_PARAMETER
case 0x01: // METHOD_TYPE_PARAMETER
case 0x16: // METHOD_FORMAL_PARAMETER
u += 2;
break;
case 0x13: // FIELD
case 0x14: // METHOD_RETURN
case 0x15: // METHOD_RECEIVER
u += 1;
break;
case 0x40: // LOCAL_VARIABLE
case 0x41: // RESOURCE_VARIABLE
for (int j = readUnsignedShort(u + 1); j > 0; --j) {
int start = readUnsignedShort(u + 3);
int length = readUnsignedShort(u + 5);
createLabel(start, context.labels);
createLabel(start + length, context.labels);
u += 6;
}
u += 3;
break;
case 0x47: // CAST
case 0x48: // CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT
case 0x49: // METHOD_INVOCATION_TYPE_ARGUMENT
case 0x4A: // CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT
case 0x4B: // METHOD_REFERENCE_TYPE_ARGUMENT
u += 4;
break;
// case 0x10: // CLASS_EXTENDS
// case 0x11: // CLASS_TYPE_PARAMETER_BOUND
// case 0x12: // METHOD_TYPE_PARAMETER_BOUND
// case 0x17: // THROWS
// case 0x42: // EXCEPTION_PARAMETER
// case 0x43: // INSTANCEOF
// case 0x44: // NEW
// case 0x45: // CONSTRUCTOR_REFERENCE
// case 0x46: // METHOD_REFERENCE
default:
u += 3;
break;
}
int pathLength = readByte(u);
if ((target >>> 24) == 0x42) {
TypePath path = pathLength == 0 ? null : new TypePath(b, u);
u += 1 + 2 * pathLength;
u = readAnnotationValues(u + 2, c, true,
mv.visitTryCatchAnnotation(target, path,
readUTF8(u, c), visible));
} else {
u = readAnnotationValues(u + 3 + 2 * pathLength, c, true, null);
}
}
return offsets;
} | java | private int[] readTypeAnnotations(final MethodVisitor mv,
final Context context, int u, boolean visible) {
char[] c = context.buffer;
int[] offsets = new int[readUnsignedShort(u)];
u += 2;
for (int i = 0; i < offsets.length; ++i) {
offsets[i] = u;
int target = readInt(u);
switch (target >>> 24) {
case 0x00: // CLASS_TYPE_PARAMETER
case 0x01: // METHOD_TYPE_PARAMETER
case 0x16: // METHOD_FORMAL_PARAMETER
u += 2;
break;
case 0x13: // FIELD
case 0x14: // METHOD_RETURN
case 0x15: // METHOD_RECEIVER
u += 1;
break;
case 0x40: // LOCAL_VARIABLE
case 0x41: // RESOURCE_VARIABLE
for (int j = readUnsignedShort(u + 1); j > 0; --j) {
int start = readUnsignedShort(u + 3);
int length = readUnsignedShort(u + 5);
createLabel(start, context.labels);
createLabel(start + length, context.labels);
u += 6;
}
u += 3;
break;
case 0x47: // CAST
case 0x48: // CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT
case 0x49: // METHOD_INVOCATION_TYPE_ARGUMENT
case 0x4A: // CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT
case 0x4B: // METHOD_REFERENCE_TYPE_ARGUMENT
u += 4;
break;
// case 0x10: // CLASS_EXTENDS
// case 0x11: // CLASS_TYPE_PARAMETER_BOUND
// case 0x12: // METHOD_TYPE_PARAMETER_BOUND
// case 0x17: // THROWS
// case 0x42: // EXCEPTION_PARAMETER
// case 0x43: // INSTANCEOF
// case 0x44: // NEW
// case 0x45: // CONSTRUCTOR_REFERENCE
// case 0x46: // METHOD_REFERENCE
default:
u += 3;
break;
}
int pathLength = readByte(u);
if ((target >>> 24) == 0x42) {
TypePath path = pathLength == 0 ? null : new TypePath(b, u);
u += 1 + 2 * pathLength;
u = readAnnotationValues(u + 2, c, true,
mv.visitTryCatchAnnotation(target, path,
readUTF8(u, c), visible));
} else {
u = readAnnotationValues(u + 3 + 2 * pathLength, c, true, null);
}
}
return offsets;
} | [
"private",
"int",
"[",
"]",
"readTypeAnnotations",
"(",
"final",
"MethodVisitor",
"mv",
",",
"final",
"Context",
"context",
",",
"int",
"u",
",",
"boolean",
"visible",
")",
"{",
"char",
"[",
"]",
"c",
"=",
"context",
".",
"buffer",
";",
"int",
"[",
"]"... | Parses a type annotation table to find the labels, and to visit the try
catch block annotations.
@param u
the start offset of a type annotation table.
@param mv
the method visitor to be used to visit the try catch block
annotations.
@param context
information about the class being parsed.
@param visible
if the type annotation table to parse contains runtime visible
annotations.
@return the start offset of each type annotation in the parsed table. | [
"Parses",
"a",
"type",
"annotation",
"table",
"to",
"find",
"the",
"labels",
"and",
"to",
"visit",
"the",
"try",
"catch",
"block",
"annotations",
"."
] | train | https://github.com/redkale/redkale/blob/ea5169b5c5ea7412fd762331c0c497165832e901/src/org/redkale/asm/ClassReader.java#L1786-L1848 |
andrewoma/dexx | collection/src/main/java/com/github/andrewoma/dexx/collection/internal/redblack/RedBlackTree.java | RedBlackTree.del | private Tree<K, V> del(Tree<K, V> tree, K k) {
if (tree == null)
return null;
int cmp = ordering.compare(k, tree.getKey(kf));
if (cmp < 0) return delLeft(tree, k);
else if (cmp > 0) return delRight(tree, k);
else return append(tree.getLeft(), tree.getRight());
} | java | private Tree<K, V> del(Tree<K, V> tree, K k) {
if (tree == null)
return null;
int cmp = ordering.compare(k, tree.getKey(kf));
if (cmp < 0) return delLeft(tree, k);
else if (cmp > 0) return delRight(tree, k);
else return append(tree.getLeft(), tree.getRight());
} | [
"private",
"Tree",
"<",
"K",
",",
"V",
">",
"del",
"(",
"Tree",
"<",
"K",
",",
"V",
">",
"tree",
",",
"K",
"k",
")",
"{",
"if",
"(",
"tree",
"==",
"null",
")",
"return",
"null",
";",
"int",
"cmp",
"=",
"ordering",
".",
"compare",
"(",
"k",
... | /* Based on Stefan Kahrs' Haskell version of Okasaki's Red&Black Trees
http://www.cse.unsw.edu.au/~dons/data/RedBlackTree.html | [
"/",
"*",
"Based",
"on",
"Stefan",
"Kahrs",
"Haskell",
"version",
"of",
"Okasaki",
"s",
"Red&Black",
"Trees",
"http",
":",
"//",
"www",
".",
"cse",
".",
"unsw",
".",
"edu",
".",
"au",
"/",
"~dons",
"/",
"data",
"/",
"RedBlackTree",
".",
"html"
] | train | https://github.com/andrewoma/dexx/blob/96755b325e90c84ffa006365dde9ddf89c83c6ca/collection/src/main/java/com/github/andrewoma/dexx/collection/internal/redblack/RedBlackTree.java#L264-L272 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/ns/nstrafficdomain_bridgegroup_binding.java | nstrafficdomain_bridgegroup_binding.count_filtered | public static long count_filtered(nitro_service service, Long td, String filter) throws Exception{
nstrafficdomain_bridgegroup_binding obj = new nstrafficdomain_bridgegroup_binding();
obj.set_td(td);
options option = new options();
option.set_count(true);
option.set_filter(filter);
nstrafficdomain_bridgegroup_binding[] response = (nstrafficdomain_bridgegroup_binding[]) obj.getfiltered(service, option);
if (response != null) {
return response[0].__count;
}
return 0;
} | java | public static long count_filtered(nitro_service service, Long td, String filter) throws Exception{
nstrafficdomain_bridgegroup_binding obj = new nstrafficdomain_bridgegroup_binding();
obj.set_td(td);
options option = new options();
option.set_count(true);
option.set_filter(filter);
nstrafficdomain_bridgegroup_binding[] response = (nstrafficdomain_bridgegroup_binding[]) obj.getfiltered(service, option);
if (response != null) {
return response[0].__count;
}
return 0;
} | [
"public",
"static",
"long",
"count_filtered",
"(",
"nitro_service",
"service",
",",
"Long",
"td",
",",
"String",
"filter",
")",
"throws",
"Exception",
"{",
"nstrafficdomain_bridgegroup_binding",
"obj",
"=",
"new",
"nstrafficdomain_bridgegroup_binding",
"(",
")",
";",
... | Use this API to count the filtered set of nstrafficdomain_bridgegroup_binding resources.
filter string should be in JSON format.eg: "port:80,servicetype:HTTP". | [
"Use",
"this",
"API",
"to",
"count",
"the",
"filtered",
"set",
"of",
"nstrafficdomain_bridgegroup_binding",
"resources",
".",
"filter",
"string",
"should",
"be",
"in",
"JSON",
"format",
".",
"eg",
":",
"port",
":",
"80",
"servicetype",
":",
"HTTP",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/ns/nstrafficdomain_bridgegroup_binding.java#L227-L238 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDNN.java | SDNN.dotProductAttention | public SDVariable dotProductAttention(String name, SDVariable queries, SDVariable keys, SDVariable values, SDVariable mask, boolean scaled){
final SDVariable result = f().dotProductAttention(queries, keys, values, mask, scaled);
return updateVariableNameAndReference(result, name);
} | java | public SDVariable dotProductAttention(String name, SDVariable queries, SDVariable keys, SDVariable values, SDVariable mask, boolean scaled){
final SDVariable result = f().dotProductAttention(queries, keys, values, mask, scaled);
return updateVariableNameAndReference(result, name);
} | [
"public",
"SDVariable",
"dotProductAttention",
"(",
"String",
"name",
",",
"SDVariable",
"queries",
",",
"SDVariable",
"keys",
",",
"SDVariable",
"values",
",",
"SDVariable",
"mask",
",",
"boolean",
"scaled",
")",
"{",
"final",
"SDVariable",
"result",
"=",
"f",
... | This operation performs dot product attention on the given timeseries input with the given queries
@see #dotProductAttention(String, SDVariable, SDVariable, SDVariable, SDVariable, boolean, boolean) | [
"This",
"operation",
"performs",
"dot",
"product",
"attention",
"on",
"the",
"given",
"timeseries",
"input",
"with",
"the",
"given",
"queries"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDNN.java#L842-L845 |
Graylog2/graylog2-server | graylog2-server/src/main/java/org/graylog/plugins/pipelineprocessor/ast/Stage.java | Stage.registerMetrics | public void registerMetrics(MetricRegistry metricRegistry, String pipelineId) {
meterName = name(Pipeline.class, pipelineId, "stage", String.valueOf(stage()), "executed");
executed = metricRegistry.meter(meterName);
} | java | public void registerMetrics(MetricRegistry metricRegistry, String pipelineId) {
meterName = name(Pipeline.class, pipelineId, "stage", String.valueOf(stage()), "executed");
executed = metricRegistry.meter(meterName);
} | [
"public",
"void",
"registerMetrics",
"(",
"MetricRegistry",
"metricRegistry",
",",
"String",
"pipelineId",
")",
"{",
"meterName",
"=",
"name",
"(",
"Pipeline",
".",
"class",
",",
"pipelineId",
",",
"\"stage\"",
",",
"String",
".",
"valueOf",
"(",
"stage",
"(",... | Register the metrics attached to this stage.
@param metricRegistry the registry to add the metrics to | [
"Register",
"the",
"metrics",
"attached",
"to",
"this",
"stage",
"."
] | train | https://github.com/Graylog2/graylog2-server/blob/50b565dcead6e0a372236d5c2f8530dc5726fa9b/graylog2-server/src/main/java/org/graylog/plugins/pipelineprocessor/ast/Stage.java#L65-L68 |
Wikidata/Wikidata-Toolkit | wdtk-rdf/src/main/java/org/wikidata/wdtk/rdf/values/BufferedValueConverter.java | BufferedValueConverter.addValue | void addValue(V value, Resource resource) {
this.valueQueue.add(value);
this.valueSubjectQueue.add(resource);
} | java | void addValue(V value, Resource resource) {
this.valueQueue.add(value);
this.valueSubjectQueue.add(resource);
} | [
"void",
"addValue",
"(",
"V",
"value",
",",
"Resource",
"resource",
")",
"{",
"this",
".",
"valueQueue",
".",
"add",
"(",
"value",
")",
";",
"this",
".",
"valueSubjectQueue",
".",
"add",
"(",
"resource",
")",
";",
"}"
] | Adds the given value to the list of values that should still be
serialized. The given RDF resource will be used as a subject.
@param value
the value to be serialized
@param resource
the RDF resource that is used as a subject for serialization | [
"Adds",
"the",
"given",
"value",
"to",
"the",
"list",
"of",
"values",
"that",
"should",
"still",
"be",
"serialized",
".",
"The",
"given",
"RDF",
"resource",
"will",
"be",
"used",
"as",
"a",
"subject",
"."
] | train | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-rdf/src/main/java/org/wikidata/wdtk/rdf/values/BufferedValueConverter.java#L56-L59 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/internal/json/JsonObject.java | JsonObject.getInt | public int getInt(String name, int defaultValue) {
JsonValue value = get(name);
return value != null ? value.asInt() : defaultValue;
} | java | public int getInt(String name, int defaultValue) {
JsonValue value = get(name);
return value != null ? value.asInt() : defaultValue;
} | [
"public",
"int",
"getInt",
"(",
"String",
"name",
",",
"int",
"defaultValue",
")",
"{",
"JsonValue",
"value",
"=",
"get",
"(",
"name",
")",
";",
"return",
"value",
"!=",
"null",
"?",
"value",
".",
"asInt",
"(",
")",
":",
"defaultValue",
";",
"}"
] | Returns the <code>int</code> value of the member with the specified name in this object. If
this object does not contain a member with this name, the given default value is returned. If
this object contains multiple members with the given name, the last one will be picked. If this
member's value does not represent a JSON number or if it cannot be interpreted as Java
<code>int</code>, an exception is thrown.
@param name
the name of the member whose value is to be returned
@param defaultValue
the value to be returned if the requested member is missing
@return the value of the last member with the specified name, or the given default value if
this object does not contain a member with that name | [
"Returns",
"the",
"<code",
">",
"int<",
"/",
"code",
">",
"value",
"of",
"the",
"member",
"with",
"the",
"specified",
"name",
"in",
"this",
"object",
".",
"If",
"this",
"object",
"does",
"not",
"contain",
"a",
"member",
"with",
"this",
"name",
"the",
"... | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/json/JsonObject.java#L581-L584 |
jcuda/jcudnn | JCudnnJava/src/main/java/jcuda/jcudnn/JCudnn.java | JCudnn.cudnnSetTensor | public static int cudnnSetTensor(
cudnnHandle handle,
cudnnTensorDescriptor yDesc,
Pointer y,
Pointer valuePtr)
{
return checkResult(cudnnSetTensorNative(handle, yDesc, y, valuePtr));
} | java | public static int cudnnSetTensor(
cudnnHandle handle,
cudnnTensorDescriptor yDesc,
Pointer y,
Pointer valuePtr)
{
return checkResult(cudnnSetTensorNative(handle, yDesc, y, valuePtr));
} | [
"public",
"static",
"int",
"cudnnSetTensor",
"(",
"cudnnHandle",
"handle",
",",
"cudnnTensorDescriptor",
"yDesc",
",",
"Pointer",
"y",
",",
"Pointer",
"valuePtr",
")",
"{",
"return",
"checkResult",
"(",
"cudnnSetTensorNative",
"(",
"handle",
",",
"yDesc",
",",
"... | Set all values of a tensor to a given value : y[i] = value[0] | [
"Set",
"all",
"values",
"of",
"a",
"tensor",
"to",
"a",
"given",
"value",
":",
"y",
"[",
"i",
"]",
"=",
"value",
"[",
"0",
"]"
] | train | https://github.com/jcuda/jcudnn/blob/ce71f2fc02817cecace51a80e6db5f0c7f10cffc/JCudnnJava/src/main/java/jcuda/jcudnn/JCudnn.java#L690-L697 |
before/quality-check | modules/quality-check/src/main/java/net/sf/qualitycheck/ConditionalCheck.java | ConditionalCheck.isNumber | @ArgumentsChecked
@Throws({ IllegalNullArgumentException.class, IllegalNumberArgumentException.class })
public static void isNumber(final boolean condition, @Nonnull final String value) {
if (condition) {
Check.isNumber(value);
}
} | java | @ArgumentsChecked
@Throws({ IllegalNullArgumentException.class, IllegalNumberArgumentException.class })
public static void isNumber(final boolean condition, @Nonnull final String value) {
if (condition) {
Check.isNumber(value);
}
} | [
"@",
"ArgumentsChecked",
"@",
"Throws",
"(",
"{",
"IllegalNullArgumentException",
".",
"class",
",",
"IllegalNumberArgumentException",
".",
"class",
"}",
")",
"public",
"static",
"void",
"isNumber",
"(",
"final",
"boolean",
"condition",
",",
"@",
"Nonnull",
"final... | Ensures that a String argument is a number.
@param condition
condition must be {@code true}^ so that the check will be performed
@param value
value which must be a number
@throws IllegalNumberArgumentException
if the given argument {@code value} is not a number | [
"Ensures",
"that",
"a",
"String",
"argument",
"is",
"a",
"number",
"."
] | train | https://github.com/before/quality-check/blob/a75c32c39434ddb1f89bece57acae0536724c15a/modules/quality-check/src/main/java/net/sf/qualitycheck/ConditionalCheck.java#L812-L818 |
kiegroup/drools | kie-dmn/kie-dmn-feel/src/main/java/org/kie/dmn/feel/lang/impl/FEELImpl.java | FEELImpl.newEvaluationContext | public EvaluationContextImpl newEvaluationContext(Collection<FEELEventListener> listeners, Map<String, Object> inputVariables) {
return newEvaluationContext(this.classLoader, listeners, inputVariables);
} | java | public EvaluationContextImpl newEvaluationContext(Collection<FEELEventListener> listeners, Map<String, Object> inputVariables) {
return newEvaluationContext(this.classLoader, listeners, inputVariables);
} | [
"public",
"EvaluationContextImpl",
"newEvaluationContext",
"(",
"Collection",
"<",
"FEELEventListener",
">",
"listeners",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"inputVariables",
")",
"{",
"return",
"newEvaluationContext",
"(",
"this",
".",
"classLoader",
",... | Creates a new EvaluationContext using this FEEL instance classloader, and the supplied parameters listeners and inputVariables | [
"Creates",
"a",
"new",
"EvaluationContext",
"using",
"this",
"FEEL",
"instance",
"classloader",
"and",
"the",
"supplied",
"parameters",
"listeners",
"and",
"inputVariables"
] | train | https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/kie-dmn/kie-dmn-feel/src/main/java/org/kie/dmn/feel/lang/impl/FEELImpl.java#L170-L172 |
wildfly/wildfly-core | server/src/main/java/org/jboss/as/server/deployment/reflect/ClassReflectionIndexUtil.java | ClassReflectionIndexUtil.findRequiredMethod | public static Method findRequiredMethod(final DeploymentReflectionIndex deploymentReflectionIndex, final Class<?> clazz, final Method method) throws DeploymentUnitProcessingException {
Assert.checkNotNullParam("method", method);
final MethodIdentifier methodIdentifier = MethodIdentifier.getIdentifierForMethod(method);
return findRequiredMethod(deploymentReflectionIndex, clazz, methodIdentifier);
} | java | public static Method findRequiredMethod(final DeploymentReflectionIndex deploymentReflectionIndex, final Class<?> clazz, final Method method) throws DeploymentUnitProcessingException {
Assert.checkNotNullParam("method", method);
final MethodIdentifier methodIdentifier = MethodIdentifier.getIdentifierForMethod(method);
return findRequiredMethod(deploymentReflectionIndex, clazz, methodIdentifier);
} | [
"public",
"static",
"Method",
"findRequiredMethod",
"(",
"final",
"DeploymentReflectionIndex",
"deploymentReflectionIndex",
",",
"final",
"Class",
"<",
"?",
">",
"clazz",
",",
"final",
"Method",
"method",
")",
"throws",
"DeploymentUnitProcessingException",
"{",
"Assert"... | Finds and returns a method corresponding to the passed <code>method</code>, which may be declared in the super class
of the passed <code>classReflectionIndex</code>.
<p/>
<p/>
Throws {@link org.jboss.as.server.deployment.DeploymentUnitProcessingException} if no such method is found.
@param deploymentReflectionIndex The deployment reflection index
@param clazz The class
@param method The method being searched for
@return
@throws org.jboss.as.server.deployment.DeploymentUnitProcessingException
If no such method is found | [
"Finds",
"and",
"returns",
"a",
"method",
"corresponding",
"to",
"the",
"passed",
"<code",
">",
"method<",
"/",
"code",
">",
"which",
"may",
"be",
"declared",
"in",
"the",
"super",
"class",
"of",
"the",
"passed",
"<code",
">",
"classReflectionIndex<",
"/",
... | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/deployment/reflect/ClassReflectionIndexUtil.java#L119-L123 |
zxing/zxing | android/src/com/google/zxing/client/android/camera/CameraManager.java | CameraManager.getFramingRect | public synchronized Rect getFramingRect() {
if (framingRect == null) {
if (camera == null) {
return null;
}
Point screenResolution = configManager.getScreenResolution();
if (screenResolution == null) {
// Called early, before init even finished
return null;
}
int width = findDesiredDimensionInRange(screenResolution.x, MIN_FRAME_WIDTH, MAX_FRAME_WIDTH);
int height = findDesiredDimensionInRange(screenResolution.y, MIN_FRAME_HEIGHT, MAX_FRAME_HEIGHT);
int leftOffset = (screenResolution.x - width) / 2;
int topOffset = (screenResolution.y - height) / 2;
framingRect = new Rect(leftOffset, topOffset, leftOffset + width, topOffset + height);
Log.d(TAG, "Calculated framing rect: " + framingRect);
}
return framingRect;
} | java | public synchronized Rect getFramingRect() {
if (framingRect == null) {
if (camera == null) {
return null;
}
Point screenResolution = configManager.getScreenResolution();
if (screenResolution == null) {
// Called early, before init even finished
return null;
}
int width = findDesiredDimensionInRange(screenResolution.x, MIN_FRAME_WIDTH, MAX_FRAME_WIDTH);
int height = findDesiredDimensionInRange(screenResolution.y, MIN_FRAME_HEIGHT, MAX_FRAME_HEIGHT);
int leftOffset = (screenResolution.x - width) / 2;
int topOffset = (screenResolution.y - height) / 2;
framingRect = new Rect(leftOffset, topOffset, leftOffset + width, topOffset + height);
Log.d(TAG, "Calculated framing rect: " + framingRect);
}
return framingRect;
} | [
"public",
"synchronized",
"Rect",
"getFramingRect",
"(",
")",
"{",
"if",
"(",
"framingRect",
"==",
"null",
")",
"{",
"if",
"(",
"camera",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"Point",
"screenResolution",
"=",
"configManager",
".",
"getScreen... | Calculates the framing rect which the UI should draw to show the user where to place the
barcode. This target helps with alignment as well as forces the user to hold the device
far enough away to ensure the image will be in focus.
@return The rectangle to draw on screen in window coordinates. | [
"Calculates",
"the",
"framing",
"rect",
"which",
"the",
"UI",
"should",
"draw",
"to",
"show",
"the",
"user",
"where",
"to",
"place",
"the",
"barcode",
".",
"This",
"target",
"helps",
"with",
"alignment",
"as",
"well",
"as",
"forces",
"the",
"user",
"to",
... | train | https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/android/src/com/google/zxing/client/android/camera/CameraManager.java#L213-L233 |
OpenLiberty/open-liberty | dev/com.ibm.ws.cdi.1.2.jsf/src/com/ibm/ws/cdi/jsf/IBMViewHandler.java | IBMViewHandler.getActionURL | @Override
public String getActionURL(FacesContext facesContext, String viewId) {
facesContext.getAttributes().put(Container.CONTEXT_ID_KEY, contextID);
return super.getActionURL(facesContext, viewId);
} | java | @Override
public String getActionURL(FacesContext facesContext, String viewId) {
facesContext.getAttributes().put(Container.CONTEXT_ID_KEY, contextID);
return super.getActionURL(facesContext, viewId);
} | [
"@",
"Override",
"public",
"String",
"getActionURL",
"(",
"FacesContext",
"facesContext",
",",
"String",
"viewId",
")",
"{",
"facesContext",
".",
"getAttributes",
"(",
")",
".",
"put",
"(",
"Container",
".",
"CONTEXT_ID_KEY",
",",
"contextID",
")",
";",
"retur... | Allow the delegate to produce the action URL. If the conversation is
long-running, append the conversation id request parameter to the query
string part of the URL, but only if the request parameter is not already
present.
<p/>
This covers form actions Ajax calls, and redirect URLs (which we want)
and link hrefs (which we don't)
@see {@link ViewHandler#getActionURL(FacesContext, String)} | [
"Allow",
"the",
"delegate",
"to",
"produce",
"the",
"action",
"URL",
".",
"If",
"the",
"conversation",
"is",
"long",
"-",
"running",
"append",
"the",
"conversation",
"id",
"request",
"parameter",
"to",
"the",
"query",
"string",
"part",
"of",
"the",
"URL",
... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.cdi.1.2.jsf/src/com/ibm/ws/cdi/jsf/IBMViewHandler.java#L44-L48 |
meltmedia/cadmium | captcha/src/main/java/com/meltmedia/cadmium/captcha/CaptchaValidator.java | CaptchaValidator.isValid | public boolean isValid(HttpServletRequest request, String challenge, String response) {
String remoteAddr = request.getRemoteAddr();
log.info("Challenge Field Name = [{}]", challenge);
log.info("Response Field Name = [{}]", response);
if(challenge != null && response != null && challenge.trim().length() > 0) {
return reCaptcha.checkAnswer(remoteAddr, challenge, response).isValid();
} else {
return false;
}
} | java | public boolean isValid(HttpServletRequest request, String challenge, String response) {
String remoteAddr = request.getRemoteAddr();
log.info("Challenge Field Name = [{}]", challenge);
log.info("Response Field Name = [{}]", response);
if(challenge != null && response != null && challenge.trim().length() > 0) {
return reCaptcha.checkAnswer(remoteAddr, challenge, response).isValid();
} else {
return false;
}
} | [
"public",
"boolean",
"isValid",
"(",
"HttpServletRequest",
"request",
",",
"String",
"challenge",
",",
"String",
"response",
")",
"{",
"String",
"remoteAddr",
"=",
"request",
".",
"getRemoteAddr",
"(",
")",
";",
"log",
".",
"info",
"(",
"\"Challenge Field Name =... | Validates the captcha response.
@param request
@param challenge
@param response
@return | [
"Validates",
"the",
"captcha",
"response",
"."
] | train | https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/captcha/src/main/java/com/meltmedia/cadmium/captcha/CaptchaValidator.java#L80-L89 |
apache/flink | flink-core/src/main/java/org/apache/flink/configuration/GlobalConfiguration.java | GlobalConfiguration.loadConfiguration | public static Configuration loadConfiguration() {
final String configDir = System.getenv(ConfigConstants.ENV_FLINK_CONF_DIR);
if (configDir == null) {
return new Configuration();
}
return loadConfiguration(configDir, null);
} | java | public static Configuration loadConfiguration() {
final String configDir = System.getenv(ConfigConstants.ENV_FLINK_CONF_DIR);
if (configDir == null) {
return new Configuration();
}
return loadConfiguration(configDir, null);
} | [
"public",
"static",
"Configuration",
"loadConfiguration",
"(",
")",
"{",
"final",
"String",
"configDir",
"=",
"System",
".",
"getenv",
"(",
"ConfigConstants",
".",
"ENV_FLINK_CONF_DIR",
")",
";",
"if",
"(",
"configDir",
"==",
"null",
")",
"{",
"return",
"new",... | Loads the global configuration from the environment. Fails if an error occurs during loading. Returns an
empty configuration object if the environment variable is not set. In production this variable is set but
tests and local execution/debugging don't have this environment variable set. That's why we should fail
if it is not set.
@return Returns the Configuration | [
"Loads",
"the",
"global",
"configuration",
"from",
"the",
"environment",
".",
"Fails",
"if",
"an",
"error",
"occurs",
"during",
"loading",
".",
"Returns",
"an",
"empty",
"configuration",
"object",
"if",
"the",
"environment",
"variable",
"is",
"not",
"set",
"."... | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/configuration/GlobalConfiguration.java#L65-L71 |
igniterealtime/Smack | smack-core/src/main/java/org/jivesoftware/smack/util/PacketParserUtils.java | PacketParserUtils.parseStreamError | public static StreamError parseStreamError(XmlPullParser parser, XmlEnvironment outerXmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException {
final int initialDepth = parser.getDepth();
List<ExtensionElement> extensions = new ArrayList<>();
Map<String, String> descriptiveTexts = null;
StreamError.Condition condition = null;
String conditionText = null;
XmlEnvironment streamErrorXmlEnvironment = XmlEnvironment.from(parser, outerXmlEnvironment);
outerloop: while (true) {
int eventType = parser.next();
switch (eventType) {
case XmlPullParser.START_TAG:
String name = parser.getName();
String namespace = parser.getNamespace();
switch (namespace) {
case StreamError.NAMESPACE:
switch (name) {
case "text":
descriptiveTexts = parseDescriptiveTexts(parser, descriptiveTexts);
break;
default:
// If it's not a text element, that is qualified by the StreamError.NAMESPACE,
// then it has to be the stream error code
condition = StreamError.Condition.fromString(name);
if (!parser.isEmptyElementTag()) {
conditionText = parser.nextText();
}
break;
}
break;
default:
PacketParserUtils.addExtensionElement(extensions, parser, name, namespace, streamErrorXmlEnvironment);
break;
}
break;
case XmlPullParser.END_TAG:
if (parser.getDepth() == initialDepth) {
break outerloop;
}
break;
}
}
return new StreamError(condition, conditionText, descriptiveTexts, extensions);
} | java | public static StreamError parseStreamError(XmlPullParser parser, XmlEnvironment outerXmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException {
final int initialDepth = parser.getDepth();
List<ExtensionElement> extensions = new ArrayList<>();
Map<String, String> descriptiveTexts = null;
StreamError.Condition condition = null;
String conditionText = null;
XmlEnvironment streamErrorXmlEnvironment = XmlEnvironment.from(parser, outerXmlEnvironment);
outerloop: while (true) {
int eventType = parser.next();
switch (eventType) {
case XmlPullParser.START_TAG:
String name = parser.getName();
String namespace = parser.getNamespace();
switch (namespace) {
case StreamError.NAMESPACE:
switch (name) {
case "text":
descriptiveTexts = parseDescriptiveTexts(parser, descriptiveTexts);
break;
default:
// If it's not a text element, that is qualified by the StreamError.NAMESPACE,
// then it has to be the stream error code
condition = StreamError.Condition.fromString(name);
if (!parser.isEmptyElementTag()) {
conditionText = parser.nextText();
}
break;
}
break;
default:
PacketParserUtils.addExtensionElement(extensions, parser, name, namespace, streamErrorXmlEnvironment);
break;
}
break;
case XmlPullParser.END_TAG:
if (parser.getDepth() == initialDepth) {
break outerloop;
}
break;
}
}
return new StreamError(condition, conditionText, descriptiveTexts, extensions);
} | [
"public",
"static",
"StreamError",
"parseStreamError",
"(",
"XmlPullParser",
"parser",
",",
"XmlEnvironment",
"outerXmlEnvironment",
")",
"throws",
"XmlPullParserException",
",",
"IOException",
",",
"SmackParsingException",
"{",
"final",
"int",
"initialDepth",
"=",
"parse... | Parses stream error packets.
@param parser the XML parser.
@param outerXmlEnvironment the outer XML environment (optional).
@return an stream error packet.
@throws IOException
@throws XmlPullParserException
@throws SmackParsingException | [
"Parses",
"stream",
"error",
"packets",
"."
] | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-core/src/main/java/org/jivesoftware/smack/util/PacketParserUtils.java#L821-L863 |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/internal/commands/HotSpotJavaDumperImpl.java | HotSpotJavaDumperImpl.getToolsJar | private static File getToolsJar() {
String javaHome = System.getProperty("java.home");
File file = new File(javaHome, "../lib/tools.jar");
if (!file.exists()) {
file = new File(javaHome, "lib/tools.jar");
if (!file.exists()) {
return null;
}
}
return file;
} | java | private static File getToolsJar() {
String javaHome = System.getProperty("java.home");
File file = new File(javaHome, "../lib/tools.jar");
if (!file.exists()) {
file = new File(javaHome, "lib/tools.jar");
if (!file.exists()) {
return null;
}
}
return file;
} | [
"private",
"static",
"File",
"getToolsJar",
"(",
")",
"{",
"String",
"javaHome",
"=",
"System",
".",
"getProperty",
"(",
"\"java.home\"",
")",
";",
"File",
"file",
"=",
"new",
"File",
"(",
"javaHome",
",",
"\"../lib/tools.jar\"",
")",
";",
"if",
"(",
"!",
... | Gets tools.jar from the JDK, or null if not found (for example, when
running with a JRE rather than a JDK, or when running on Mac). | [
"Gets",
"tools",
".",
"jar",
"from",
"the",
"JDK",
"or",
"null",
"if",
"not",
"found",
"(",
"for",
"example",
"when",
"running",
"with",
"a",
"JRE",
"rather",
"than",
"a",
"JDK",
"or",
"when",
"running",
"on",
"Mac",
")",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/internal/commands/HotSpotJavaDumperImpl.java#L292-L303 |
JOML-CI/JOML | src/org/joml/Matrix4d.java | Matrix4d.scaleAround | public Matrix4d scaleAround(double factor, double ox, double oy, double oz) {
return scaleAround(factor, factor, factor, ox, oy, oz, this);
} | java | public Matrix4d scaleAround(double factor, double ox, double oy, double oz) {
return scaleAround(factor, factor, factor, ox, oy, oz, this);
} | [
"public",
"Matrix4d",
"scaleAround",
"(",
"double",
"factor",
",",
"double",
"ox",
",",
"double",
"oy",
",",
"double",
"oz",
")",
"{",
"return",
"scaleAround",
"(",
"factor",
",",
"factor",
",",
"factor",
",",
"ox",
",",
"oy",
",",
"oz",
",",
"this",
... | Apply scaling to this matrix by scaling all three base axes by the given <code>factor</code>
while using <code>(ox, oy, oz)</code> as the scaling origin.
<p>
If <code>M</code> is <code>this</code> matrix and <code>S</code> the scaling matrix,
then the new matrix will be <code>M * S</code>. So when transforming a
vector <code>v</code> with the new matrix by using <code>M * S * v</code>, the
scaling will be applied first!
<p>
This method is equivalent to calling: <code>translate(ox, oy, oz).scale(factor).translate(-ox, -oy, -oz)</code>
@param factor
the scaling factor for all three axes
@param ox
the x coordinate of the scaling origin
@param oy
the y coordinate of the scaling origin
@param oz
the z coordinate of the scaling origin
@return this | [
"Apply",
"scaling",
"to",
"this",
"matrix",
"by",
"scaling",
"all",
"three",
"base",
"axes",
"by",
"the",
"given",
"<code",
">",
"factor<",
"/",
"code",
">",
"while",
"using",
"<code",
">",
"(",
"ox",
"oy",
"oz",
")",
"<",
"/",
"code",
">",
"as",
"... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4d.java#L4503-L4505 |
hypercube1024/firefly | firefly-common/src/main/java/com/firefly/utils/retry/WaitStrategies.java | WaitStrategies.exponentialWait | public static <V> Action1<TaskContext<V>> exponentialWait(long initTime, TimeUnit timeUnit) {
return exponentialWait(initTime, Long.MAX_VALUE, timeUnit);
} | java | public static <V> Action1<TaskContext<V>> exponentialWait(long initTime, TimeUnit timeUnit) {
return exponentialWait(initTime, Long.MAX_VALUE, timeUnit);
} | [
"public",
"static",
"<",
"V",
">",
"Action1",
"<",
"TaskContext",
"<",
"V",
">",
">",
"exponentialWait",
"(",
"long",
"initTime",
",",
"TimeUnit",
"timeUnit",
")",
"{",
"return",
"exponentialWait",
"(",
"initTime",
",",
"Long",
".",
"MAX_VALUE",
",",
"time... | The exponential increase sleep time.
@param initTime The first sleep time.
@param timeUnit The time unit.
@param <V> The return value type.
@return The wait strategy action. | [
"The",
"exponential",
"increase",
"sleep",
"time",
"."
] | train | https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly-common/src/main/java/com/firefly/utils/retry/WaitStrategies.java#L67-L69 |
att/openstacksdk | openstack-java-sdk/heat-model/src/main/java/com/woorea/openstack/heat/model/Stack.java | Stack.getOutputValue | public <T> T getOutputValue (String key, Class<T> type)
{
try {
String s = mapper.writeValueAsString(_findOutputValue(key));
return (mapper.readValue(s, type));
}
catch (IOException e) {
return null;
}
} | java | public <T> T getOutputValue (String key, Class<T> type)
{
try {
String s = mapper.writeValueAsString(_findOutputValue(key));
return (mapper.readValue(s, type));
}
catch (IOException e) {
return null;
}
} | [
"public",
"<",
"T",
">",
"T",
"getOutputValue",
"(",
"String",
"key",
",",
"Class",
"<",
"T",
">",
"type",
")",
"{",
"try",
"{",
"String",
"s",
"=",
"mapper",
".",
"writeValueAsString",
"(",
"_findOutputValue",
"(",
"key",
")",
")",
";",
"return",
"(... | /*
Return a stack output as a Json-mapped Object of the provided type.
This is useful for json-object stack outputs. | [
"/",
"*",
"Return",
"a",
"stack",
"output",
"as",
"a",
"Json",
"-",
"mapped",
"Object",
"of",
"the",
"provided",
"type",
".",
"This",
"is",
"useful",
"for",
"json",
"-",
"object",
"stack",
"outputs",
"."
] | train | https://github.com/att/openstacksdk/blob/16a81c460a7186ebe1ea63b7682486ba147208b9/openstack-java-sdk/heat-model/src/main/java/com/woorea/openstack/heat/model/Stack.java#L203-L212 |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/sjavac/comp/ResolveWithDeps.java | ResolveWithDeps.reportDependence | @Override
public void reportDependence(Symbol from, Symbol to) {
// Capture dependencies between the packages.
deps.collect(from.packge().fullname, to.packge().fullname);
} | java | @Override
public void reportDependence(Symbol from, Symbol to) {
// Capture dependencies between the packages.
deps.collect(from.packge().fullname, to.packge().fullname);
} | [
"@",
"Override",
"public",
"void",
"reportDependence",
"(",
"Symbol",
"from",
",",
"Symbol",
"to",
")",
"{",
"// Capture dependencies between the packages.",
"deps",
".",
"collect",
"(",
"from",
".",
"packge",
"(",
")",
".",
"fullname",
",",
"to",
".",
"packge... | Collect dependencies in the enclosing class
@param from The enclosing class sym
@param to The enclosing classes references this sym. | [
"Collect",
"dependencies",
"in",
"the",
"enclosing",
"class"
] | train | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/sjavac/comp/ResolveWithDeps.java#L62-L66 |
DiUS/pact-jvm | pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslJsonRootValue.java | PactDslJsonRootValue.stringMatcher | public static PactDslJsonRootValue stringMatcher(String regex, String value) {
if (!value.matches(regex)) {
throw new InvalidMatcherException(EXAMPLE + value + "\" does not match regular expression \"" +
regex + "\"");
}
PactDslJsonRootValue rootValue = new PactDslJsonRootValue();
rootValue.setValue(value);
rootValue.setMatcher(new RegexMatcher(regex, value));
return rootValue;
} | java | public static PactDslJsonRootValue stringMatcher(String regex, String value) {
if (!value.matches(regex)) {
throw new InvalidMatcherException(EXAMPLE + value + "\" does not match regular expression \"" +
regex + "\"");
}
PactDslJsonRootValue rootValue = new PactDslJsonRootValue();
rootValue.setValue(value);
rootValue.setMatcher(new RegexMatcher(regex, value));
return rootValue;
} | [
"public",
"static",
"PactDslJsonRootValue",
"stringMatcher",
"(",
"String",
"regex",
",",
"String",
"value",
")",
"{",
"if",
"(",
"!",
"value",
".",
"matches",
"(",
"regex",
")",
")",
"{",
"throw",
"new",
"InvalidMatcherException",
"(",
"EXAMPLE",
"+",
"valu... | Value that must match the regular expression
@param regex regular expression
@param value example value to use for generated bodies | [
"Value",
"that",
"must",
"match",
"the",
"regular",
"expression"
] | train | https://github.com/DiUS/pact-jvm/blob/2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef/pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslJsonRootValue.java#L412-L421 |
fabric8io/kubernetes-client | kubernetes-client/src/main/java/io/fabric8/kubernetes/client/internal/KubeConfigUtils.java | KubeConfigUtils.getUserToken | public static String getUserToken(Config config, Context context) {
AuthInfo authInfo = getUserAuthInfo(config, context);
if (authInfo != null) {
return authInfo.getToken();
}
return null;
} | java | public static String getUserToken(Config config, Context context) {
AuthInfo authInfo = getUserAuthInfo(config, context);
if (authInfo != null) {
return authInfo.getToken();
}
return null;
} | [
"public",
"static",
"String",
"getUserToken",
"(",
"Config",
"config",
",",
"Context",
"context",
")",
"{",
"AuthInfo",
"authInfo",
"=",
"getUserAuthInfo",
"(",
"config",
",",
"context",
")",
";",
"if",
"(",
"authInfo",
"!=",
"null",
")",
"{",
"return",
"a... | Returns the current user token for the config and current context
@param config Config object
@param context Context object
@return returns current user based upon provided parameters. | [
"Returns",
"the",
"current",
"user",
"token",
"for",
"the",
"config",
"and",
"current",
"context"
] | train | https://github.com/fabric8io/kubernetes-client/blob/141668a882ed8e902c045a5cd0a80f14bd17d132/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/internal/KubeConfigUtils.java#L78-L84 |
CenturyLinkCloud/mdw | mdw-workflow/src/com/centurylink/mdw/workflow/adapter/rest/MultiRestServiceAdapter.java | MultiRestServiceAdapter.getEndpointUris | protected List<String> getEndpointUris() throws AdapterException {
List<String> urlmap = new ArrayList<String>();
try {
String map = getAttributeValue(ENDPOINT_URI);
List<String[]> urlmaparray;
if (map==null)
urlmaparray = new ArrayList<String[]>();
else
urlmaparray = StringHelper.parseTable(map, ',', ';', 1);
for (String[] entry : urlmaparray)
urlmap.add(getValueSmart(entry[0], ""));
}
catch (Exception ex) {
throw new AdapterException(-1, ex.getMessage(), ex);
}
return urlmap;
} | java | protected List<String> getEndpointUris() throws AdapterException {
List<String> urlmap = new ArrayList<String>();
try {
String map = getAttributeValue(ENDPOINT_URI);
List<String[]> urlmaparray;
if (map==null)
urlmaparray = new ArrayList<String[]>();
else
urlmaparray = StringHelper.parseTable(map, ',', ';', 1);
for (String[] entry : urlmaparray)
urlmap.add(getValueSmart(entry[0], ""));
}
catch (Exception ex) {
throw new AdapterException(-1, ex.getMessage(), ex);
}
return urlmap;
} | [
"protected",
"List",
"<",
"String",
">",
"getEndpointUris",
"(",
")",
"throws",
"AdapterException",
"{",
"List",
"<",
"String",
">",
"urlmap",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"try",
"{",
"String",
"map",
"=",
"getAttributeValue"... | Returns the endpoint URLs for the RESTful service. Supports property specifiers
via the syntax for {@link #AdapterActivityBase.getAttributeValueSmart(String)}.
@throws ActivityException | [
"Returns",
"the",
"endpoint",
"URLs",
"for",
"the",
"RESTful",
"service",
".",
"Supports",
"property",
"specifiers",
"via",
"the",
"syntax",
"for",
"{"
] | train | https://github.com/CenturyLinkCloud/mdw/blob/91167fe65a25a5d7022cdcf8b0fae8506f5b87ce/mdw-workflow/src/com/centurylink/mdw/workflow/adapter/rest/MultiRestServiceAdapter.java#L96-L113 |
UrielCh/ovh-java-sdk | ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java | ApiOvhOrder.license_windows_new_duration_POST | public OvhOrder license_windows_new_duration_POST(String duration, String ip, OvhLicenseTypeEnum serviceType, OvhWindowsSqlVersionEnum sqlVersion, OvhWindowsOsVersionEnum version) throws IOException {
String qPath = "/order/license/windows/new/{duration}";
StringBuilder sb = path(qPath, duration);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "ip", ip);
addBody(o, "serviceType", serviceType);
addBody(o, "sqlVersion", sqlVersion);
addBody(o, "version", version);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhOrder.class);
} | java | public OvhOrder license_windows_new_duration_POST(String duration, String ip, OvhLicenseTypeEnum serviceType, OvhWindowsSqlVersionEnum sqlVersion, OvhWindowsOsVersionEnum version) throws IOException {
String qPath = "/order/license/windows/new/{duration}";
StringBuilder sb = path(qPath, duration);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "ip", ip);
addBody(o, "serviceType", serviceType);
addBody(o, "sqlVersion", sqlVersion);
addBody(o, "version", version);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhOrder.class);
} | [
"public",
"OvhOrder",
"license_windows_new_duration_POST",
"(",
"String",
"duration",
",",
"String",
"ip",
",",
"OvhLicenseTypeEnum",
"serviceType",
",",
"OvhWindowsSqlVersionEnum",
"sqlVersion",
",",
"OvhWindowsOsVersionEnum",
"version",
")",
"throws",
"IOException",
"{",
... | Create order
REST: POST /order/license/windows/new/{duration}
@param serviceType [required] # DEPRECATED # The kind of service on which this license will be used # Will not be used, keeped only for compatibility #
@param sqlVersion [required] The SQL Server version to enable on this license Windows license
@param version [required] This license version
@param ip [required] Ip on which this license would be installed (for dedicated your main server Ip)
@param duration [required] Duration | [
"Create",
"order"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L1280-L1290 |
khuxtable/seaglass | src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java | SeaGlassLookAndFeel.getSeaGlassStyle | SynthStyle getSeaGlassStyle(JComponent c, Region r) {
// validate method arguments
if (c == null || r == null) {
throw new IllegalArgumentException("Neither comp nor r may be null");
}
// if there are no lazy styles registered for the region r, then return
// the default style
List<LazyStyle> styles = styleMap.get(r);
if (styles == null || styles.size() == 0) {
return getDefaultStyle();
}
// Look for the best SynthStyle for this component/region pair.
LazyStyle foundStyle = null;
for (LazyStyle s : styles) {
if (s.matches(c)) {
/*
* Replace the foundStyle if foundStyle is null, or if the new
* style "s" is more specific (ie, its path was longer), or if
* the foundStyle was "simple" and the new style was not (ie:
* the foundStyle was for something like Button and the new
* style was for something like "MyButton", hence, being more
* specific). In all cases, favor the most specific style found.
*/
if (foundStyle == null || (foundStyle.parts.length < s.parts.length)
|| (foundStyle.parts.length == s.parts.length && foundStyle.simple && !s.simple)) {
foundStyle = s;
}
}
}
// return the style, if found, or the default style if not found
return foundStyle == null ? getDefaultStyle() : foundStyle.getStyle(c);
} | java | SynthStyle getSeaGlassStyle(JComponent c, Region r) {
// validate method arguments
if (c == null || r == null) {
throw new IllegalArgumentException("Neither comp nor r may be null");
}
// if there are no lazy styles registered for the region r, then return
// the default style
List<LazyStyle> styles = styleMap.get(r);
if (styles == null || styles.size() == 0) {
return getDefaultStyle();
}
// Look for the best SynthStyle for this component/region pair.
LazyStyle foundStyle = null;
for (LazyStyle s : styles) {
if (s.matches(c)) {
/*
* Replace the foundStyle if foundStyle is null, or if the new
* style "s" is more specific (ie, its path was longer), or if
* the foundStyle was "simple" and the new style was not (ie:
* the foundStyle was for something like Button and the new
* style was for something like "MyButton", hence, being more
* specific). In all cases, favor the most specific style found.
*/
if (foundStyle == null || (foundStyle.parts.length < s.parts.length)
|| (foundStyle.parts.length == s.parts.length && foundStyle.simple && !s.simple)) {
foundStyle = s;
}
}
}
// return the style, if found, or the default style if not found
return foundStyle == null ? getDefaultStyle() : foundStyle.getStyle(c);
} | [
"SynthStyle",
"getSeaGlassStyle",
"(",
"JComponent",
"c",
",",
"Region",
"r",
")",
"{",
"// validate method arguments",
"if",
"(",
"c",
"==",
"null",
"||",
"r",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Neither comp nor r may be n... | Locate the style associated with the given region and component. This is
called from SeaGlassLookAndFeel in the SynthStyleFactory implementation.
<p>Lookup occurs as follows:<br/>
Check the map of styles <code>styleMap</code>. If the map contains no
styles at all, then simply return the defaultStyle. If the map contains
styles, then iterate over all of the styles for the Region <code>r</code>
looking for the best match, based on prefix. If a match was made, then
return that SynthStyle. Otherwise, return the defaultStyle.</p>
@param c The component associated with this region. For example, if the
Region is Region.Button then the component will be a JButton.
If the Region is a subregion, such as ScrollBarThumb, then the
associated component will be the component that subregion
belongs to, such as JScrollBar. The JComponent may be named. It
may not be null.
@param r The region we are looking for a style for. May not be null.
@return the style associated with the given region and component. | [
"Locate",
"the",
"style",
"associated",
"with",
"the",
"given",
"region",
"and",
"component",
".",
"This",
"is",
"called",
"from",
"SeaGlassLookAndFeel",
"in",
"the",
"SynthStyleFactory",
"implementation",
"."
] | train | https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java#L2680-L2718 |
webmetrics/browsermob-proxy | src/main/java/org/browsermob/proxy/jetty/util/IO.java | IO.copyThread | public static void copyThread(Reader in, Writer out)
{
try
{
instance().run(new Job(in,out));
}
catch(InterruptedException e)
{
log.warn(LogSupport.EXCEPTION,e);
}
} | java | public static void copyThread(Reader in, Writer out)
{
try
{
instance().run(new Job(in,out));
}
catch(InterruptedException e)
{
log.warn(LogSupport.EXCEPTION,e);
}
} | [
"public",
"static",
"void",
"copyThread",
"(",
"Reader",
"in",
",",
"Writer",
"out",
")",
"{",
"try",
"{",
"instance",
"(",
")",
".",
"run",
"(",
"new",
"Job",
"(",
"in",
",",
"out",
")",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"e",
")... | Copy Stream in to Stream out until EOF or exception
in own thread | [
"Copy",
"Stream",
"in",
"to",
"Stream",
"out",
"until",
"EOF",
"or",
"exception",
"in",
"own",
"thread"
] | train | https://github.com/webmetrics/browsermob-proxy/blob/a9252e62246ac33d55d51b993ba1159404e7d389/src/main/java/org/browsermob/proxy/jetty/util/IO.java#L110-L120 |
jenkinsci/jenkins | core/src/main/java/jenkins/security/apitoken/ApiTokenStore.java | ApiTokenStore.reconfigure | public synchronized void reconfigure(@Nonnull Map<String, JSONObject> tokenStoreDataMap) {
tokenList.forEach(hashedToken -> {
JSONObject receivedTokenData = tokenStoreDataMap.get(hashedToken.uuid);
if (receivedTokenData == null) {
LOGGER.log(Level.INFO, "No token received for {0}", hashedToken.uuid);
return;
}
String name = receivedTokenData.getString("tokenName");
if (StringUtils.isBlank(name)) {
LOGGER.log(Level.INFO, "Empty name received for {0}, we do not care about it", hashedToken.uuid);
return;
}
hashedToken.setName(name);
});
} | java | public synchronized void reconfigure(@Nonnull Map<String, JSONObject> tokenStoreDataMap) {
tokenList.forEach(hashedToken -> {
JSONObject receivedTokenData = tokenStoreDataMap.get(hashedToken.uuid);
if (receivedTokenData == null) {
LOGGER.log(Level.INFO, "No token received for {0}", hashedToken.uuid);
return;
}
String name = receivedTokenData.getString("tokenName");
if (StringUtils.isBlank(name)) {
LOGGER.log(Level.INFO, "Empty name received for {0}, we do not care about it", hashedToken.uuid);
return;
}
hashedToken.setName(name);
});
} | [
"public",
"synchronized",
"void",
"reconfigure",
"(",
"@",
"Nonnull",
"Map",
"<",
"String",
",",
"JSONObject",
">",
"tokenStoreDataMap",
")",
"{",
"tokenList",
".",
"forEach",
"(",
"hashedToken",
"->",
"{",
"JSONObject",
"receivedTokenData",
"=",
"tokenStoreDataMa... | Defensive approach to avoid involuntary change since the UUIDs are generated at startup only for UI
and so between restart they change | [
"Defensive",
"approach",
"to",
"avoid",
"involuntary",
"change",
"since",
"the",
"UUIDs",
"are",
"generated",
"at",
"startup",
"only",
"for",
"UI",
"and",
"so",
"between",
"restart",
"they",
"change"
] | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/jenkins/security/apitoken/ApiTokenStore.java#L104-L120 |
JetBrains/xodus | entity-store/src/main/java/jetbrains/exodus/entitystore/tables/BlobsTable.java | BlobsTable.put | public void put(@NotNull final Transaction txn, final long localId,
final int blobId, @NotNull final ByteIterable value) {
primaryStore.put(txn, PropertyKey.propertyKeyToEntry(new PropertyKey(localId, blobId)), value);
allBlobsIndex.put(txn, IntegerBinding.intToCompressedEntry(blobId), LongBinding.longToCompressedEntry(localId));
} | java | public void put(@NotNull final Transaction txn, final long localId,
final int blobId, @NotNull final ByteIterable value) {
primaryStore.put(txn, PropertyKey.propertyKeyToEntry(new PropertyKey(localId, blobId)), value);
allBlobsIndex.put(txn, IntegerBinding.intToCompressedEntry(blobId), LongBinding.longToCompressedEntry(localId));
} | [
"public",
"void",
"put",
"(",
"@",
"NotNull",
"final",
"Transaction",
"txn",
",",
"final",
"long",
"localId",
",",
"final",
"int",
"blobId",
",",
"@",
"NotNull",
"final",
"ByteIterable",
"value",
")",
"{",
"primaryStore",
".",
"put",
"(",
"txn",
",",
"Pr... | Setter for blob handle value.
@param txn enclosing transaction
@param localId entity local id.
@param blobId blob id
@param value property value. | [
"Setter",
"for",
"blob",
"handle",
"value",
"."
] | train | https://github.com/JetBrains/xodus/blob/7b3476c4e81db66f9c7529148c761605cc8eea6d/entity-store/src/main/java/jetbrains/exodus/entitystore/tables/BlobsTable.java#L62-L66 |
RestComm/sipunit | src/main/java/org/cafesip/sipunit/SipAssert.java | SipAssert.assertBodyContains | public static void assertBodyContains(String msg, SipMessage sipMessage, String value) {
assertNotNull("Null assert object passed in", sipMessage);
assertBodyPresent(msg, sipMessage);
String body = new String(sipMessage.getRawContent());
if (body.indexOf(value) != -1) {
assertTrue(true);
return;
}
fail(msg);
} | java | public static void assertBodyContains(String msg, SipMessage sipMessage, String value) {
assertNotNull("Null assert object passed in", sipMessage);
assertBodyPresent(msg, sipMessage);
String body = new String(sipMessage.getRawContent());
if (body.indexOf(value) != -1) {
assertTrue(true);
return;
}
fail(msg);
} | [
"public",
"static",
"void",
"assertBodyContains",
"(",
"String",
"msg",
",",
"SipMessage",
"sipMessage",
",",
"String",
"value",
")",
"{",
"assertNotNull",
"(",
"\"Null assert object passed in\"",
",",
"sipMessage",
")",
";",
"assertBodyPresent",
"(",
"msg",
",",
... | Asserts that the given SIP message contains a body that includes the given value. The assertion
fails if a body is not present in the message or is present but doesn't include the value.
Assertion failure output includes the given message text.
@param msg message text to output if the assertion fails.
@param sipMessage the SIP message.
@param value the string value to look for in the body. An exact string match is done against
the entire contents of the body. The assertion will pass if any part of the body matches
the value given. | [
"Asserts",
"that",
"the",
"given",
"SIP",
"message",
"contains",
"a",
"body",
"that",
"includes",
"the",
"given",
"value",
".",
"The",
"assertion",
"fails",
"if",
"a",
"body",
"is",
"not",
"present",
"in",
"the",
"message",
"or",
"is",
"present",
"but",
... | train | https://github.com/RestComm/sipunit/blob/18a6be2e29be3fbdc14226e8c41b25e2d57378b1/src/main/java/org/cafesip/sipunit/SipAssert.java#L698-L709 |
SonarSource/sonarqube | server/sonar-server-common/src/main/java/org/sonar/server/es/BaseDoc.java | BaseDoc.getNullableField | @CheckForNull
public <K> K getNullableField(String key) {
if (!fields.containsKey(key)) {
throw new IllegalStateException(String.format("Field %s not specified in query options", key));
}
return (K) fields.get(key);
} | java | @CheckForNull
public <K> K getNullableField(String key) {
if (!fields.containsKey(key)) {
throw new IllegalStateException(String.format("Field %s not specified in query options", key));
}
return (K) fields.get(key);
} | [
"@",
"CheckForNull",
"public",
"<",
"K",
">",
"K",
"getNullableField",
"(",
"String",
"key",
")",
"{",
"if",
"(",
"!",
"fields",
".",
"containsKey",
"(",
"key",
")",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"String",
".",
"format",
"(",
... | Use this method when field value can be null. See warning in {@link #getField(String)} | [
"Use",
"this",
"method",
"when",
"field",
"value",
"can",
"be",
"null",
".",
"See",
"warning",
"in",
"{"
] | train | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-server-common/src/main/java/org/sonar/server/es/BaseDoc.java#L97-L103 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java | DTMDefaultBase.isNodeAfter | public boolean isNodeAfter(int nodeHandle1, int nodeHandle2)
{
// These return NULL if the node doesn't belong to this document.
int index1 = makeNodeIdentity(nodeHandle1);
int index2 = makeNodeIdentity(nodeHandle2);
return index1!=NULL && index2!=NULL && index1 <= index2;
} | java | public boolean isNodeAfter(int nodeHandle1, int nodeHandle2)
{
// These return NULL if the node doesn't belong to this document.
int index1 = makeNodeIdentity(nodeHandle1);
int index2 = makeNodeIdentity(nodeHandle2);
return index1!=NULL && index2!=NULL && index1 <= index2;
} | [
"public",
"boolean",
"isNodeAfter",
"(",
"int",
"nodeHandle1",
",",
"int",
"nodeHandle2",
")",
"{",
"// These return NULL if the node doesn't belong to this document.",
"int",
"index1",
"=",
"makeNodeIdentity",
"(",
"nodeHandle1",
")",
";",
"int",
"index2",
"=",
"makeNo... | Figure out whether nodeHandle2 should be considered as being later
in the document than nodeHandle1, in Document Order as defined
by the XPath model. This may not agree with the ordering defined
by other XML applications.
<p>
There are some cases where ordering isn't defined, and neither are
the results of this function -- though we'll generally return false.
@param nodeHandle1 Node handle to perform position comparison on.
@param nodeHandle2 Second Node handle to perform position comparison on .
@return true if node1 comes before node2, otherwise return false.
You can think of this as
<code>(node1.documentOrderPosition <= node2.documentOrderPosition)</code>. | [
"Figure",
"out",
"whether",
"nodeHandle2",
"should",
"be",
"considered",
"as",
"being",
"later",
"in",
"the",
"document",
"than",
"nodeHandle1",
"in",
"Document",
"Order",
"as",
"defined",
"by",
"the",
"XPath",
"model",
".",
"This",
"may",
"not",
"agree",
"w... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java#L2113-L2120 |
alkacon/opencms-core | src/org/opencms/db/generic/CmsUserDriver.java | CmsUserDriver.internalUpdateUserInfo | protected void internalUpdateUserInfo(CmsDbContext dbc, CmsUUID userId, String key, Object value)
throws CmsDataAccessException {
PreparedStatement stmt = null;
Connection conn = null;
try {
conn = getSqlManager().getConnection(dbc);
stmt = m_sqlManager.getPreparedStatement(conn, "C_USERDATA_UPDATE_4");
// write data to database
m_sqlManager.setBytes(stmt, 1, CmsDataTypeUtil.dataSerialize(value));
stmt.setString(2, value.getClass().getName());
stmt.setString(3, userId.toString());
stmt.setString(4, key);
stmt.executeUpdate();
} catch (SQLException e) {
throw new CmsDbSqlException(
Messages.get().container(Messages.ERR_GENERIC_SQL_1, CmsDbSqlException.getErrorQuery(stmt)),
e);
} catch (IOException e) {
throw new CmsDbIoException(Messages.get().container(Messages.ERR_SERIALIZING_USER_DATA_1, userId), e);
} finally {
m_sqlManager.closeAll(dbc, conn, stmt, null);
}
} | java | protected void internalUpdateUserInfo(CmsDbContext dbc, CmsUUID userId, String key, Object value)
throws CmsDataAccessException {
PreparedStatement stmt = null;
Connection conn = null;
try {
conn = getSqlManager().getConnection(dbc);
stmt = m_sqlManager.getPreparedStatement(conn, "C_USERDATA_UPDATE_4");
// write data to database
m_sqlManager.setBytes(stmt, 1, CmsDataTypeUtil.dataSerialize(value));
stmt.setString(2, value.getClass().getName());
stmt.setString(3, userId.toString());
stmt.setString(4, key);
stmt.executeUpdate();
} catch (SQLException e) {
throw new CmsDbSqlException(
Messages.get().container(Messages.ERR_GENERIC_SQL_1, CmsDbSqlException.getErrorQuery(stmt)),
e);
} catch (IOException e) {
throw new CmsDbIoException(Messages.get().container(Messages.ERR_SERIALIZING_USER_DATA_1, userId), e);
} finally {
m_sqlManager.closeAll(dbc, conn, stmt, null);
}
} | [
"protected",
"void",
"internalUpdateUserInfo",
"(",
"CmsDbContext",
"dbc",
",",
"CmsUUID",
"userId",
",",
"String",
"key",
",",
"Object",
"value",
")",
"throws",
"CmsDataAccessException",
"{",
"PreparedStatement",
"stmt",
"=",
"null",
";",
"Connection",
"conn",
"=... | Updates additional user info.<p>
@param dbc the current dbc
@param userId the user id to add the user info for
@param key the name of the additional user info
@param value the value of the additional user info
@throws CmsDataAccessException if something goes wrong | [
"Updates",
"additional",
"user",
"info",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/generic/CmsUserDriver.java#L2808-L2832 |
jenkinsci/jenkins | core/src/main/java/hudson/Launcher.java | Launcher.decorateByEnv | @Nonnull
public final Launcher decorateByEnv(@Nonnull EnvVars _env) {
final EnvVars env = new EnvVars(_env);
final Launcher outer = this;
return new Launcher(outer) {
@Override
public boolean isUnix() {
return outer.isUnix();
}
@Override
public Proc launch(ProcStarter starter) throws IOException {
EnvVars e = new EnvVars(env);
if (starter.envs!=null) {
for (String env : starter.envs) {
e.addLine(env);
}
}
starter.envs = Util.mapToEnv(e);
return outer.launch(starter);
}
@Override
public Channel launchChannel(String[] cmd, OutputStream out, FilePath workDir, Map<String, String> envVars) throws IOException, InterruptedException {
EnvVars e = new EnvVars(env);
e.putAll(envVars);
return outer.launchChannel(cmd,out,workDir,e);
}
@Override
public void kill(Map<String, String> modelEnvVars) throws IOException, InterruptedException {
outer.kill(modelEnvVars);
}
};
} | java | @Nonnull
public final Launcher decorateByEnv(@Nonnull EnvVars _env) {
final EnvVars env = new EnvVars(_env);
final Launcher outer = this;
return new Launcher(outer) {
@Override
public boolean isUnix() {
return outer.isUnix();
}
@Override
public Proc launch(ProcStarter starter) throws IOException {
EnvVars e = new EnvVars(env);
if (starter.envs!=null) {
for (String env : starter.envs) {
e.addLine(env);
}
}
starter.envs = Util.mapToEnv(e);
return outer.launch(starter);
}
@Override
public Channel launchChannel(String[] cmd, OutputStream out, FilePath workDir, Map<String, String> envVars) throws IOException, InterruptedException {
EnvVars e = new EnvVars(env);
e.putAll(envVars);
return outer.launchChannel(cmd,out,workDir,e);
}
@Override
public void kill(Map<String, String> modelEnvVars) throws IOException, InterruptedException {
outer.kill(modelEnvVars);
}
};
} | [
"@",
"Nonnull",
"public",
"final",
"Launcher",
"decorateByEnv",
"(",
"@",
"Nonnull",
"EnvVars",
"_env",
")",
"{",
"final",
"EnvVars",
"env",
"=",
"new",
"EnvVars",
"(",
"_env",
")",
";",
"final",
"Launcher",
"outer",
"=",
"this",
";",
"return",
"new",
"L... | Returns a decorated {@link Launcher} that automatically adds the specified environment
variables.
Those that are specified in {@link ProcStarter#envs(String...)} will take precedence over
what's specified here.
@since 1.489 | [
"Returns",
"a",
"decorated",
"{",
"@link",
"Launcher",
"}",
"that",
"automatically",
"adds",
"the",
"specified",
"environment",
"variables",
"."
] | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/Launcher.java#L872-L906 |
OpenLiberty/open-liberty | dev/com.ibm.ws.microprofile.config.1.1/src/com/ibm/ws/microprofile/config/impl/AbstractProviderResolver.java | AbstractProviderResolver.shutdown | private void shutdown(String applicationName, ClassLoader classLoader) {
synchronized (configCache) {
ConfigWrapper configWrapper = configCache.get(classLoader);
boolean close = configWrapper.removeApplication(applicationName);
if (close) {
close(classLoader);
}
}
} | java | private void shutdown(String applicationName, ClassLoader classLoader) {
synchronized (configCache) {
ConfigWrapper configWrapper = configCache.get(classLoader);
boolean close = configWrapper.removeApplication(applicationName);
if (close) {
close(classLoader);
}
}
} | [
"private",
"void",
"shutdown",
"(",
"String",
"applicationName",
",",
"ClassLoader",
"classLoader",
")",
"{",
"synchronized",
"(",
"configCache",
")",
"{",
"ConfigWrapper",
"configWrapper",
"=",
"configCache",
".",
"get",
"(",
"classLoader",
")",
";",
"boolean",
... | Close down a specific config used by a specified application (that is not also still in use by other applications) | [
"Close",
"down",
"a",
"specific",
"config",
"used",
"by",
"a",
"specified",
"application",
"(",
"that",
"is",
"not",
"also",
"still",
"in",
"use",
"by",
"other",
"applications",
")"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.config.1.1/src/com/ibm/ws/microprofile/config/impl/AbstractProviderResolver.java#L174-L182 |
recruit-mp/android-HeaderFooterGridView | library/src/main/java/jp/co/recruit_mp/android/headerfootergridview/HeaderFooterGridView.java | HeaderFooterGridView.addFooterView | public void addFooterView(View v, Object data, boolean isSelectable) {
ListAdapter adapter = getAdapter();
if (adapter != null && !(adapter instanceof HeaderFooterViewGridAdapter)) {
throw new IllegalStateException(
"Cannot add footer view to grid -- setAdapter has already been called.");
}
FixedViewInfo info = new FixedViewInfo();
FrameLayout fl = new FullWidthFixedViewLayout(getContext());
fl.addView(v);
info.view = v;
info.viewContainer = fl;
info.data = data;
info.isSelectable = isSelectable;
mFooterViewInfos.add(info);
// in the case of re-adding a header view, or adding one later on,
// we need to notify the observer
if (adapter != null) {
((HeaderFooterViewGridAdapter) adapter).notifyDataSetChanged();
}
} | java | public void addFooterView(View v, Object data, boolean isSelectable) {
ListAdapter adapter = getAdapter();
if (adapter != null && !(adapter instanceof HeaderFooterViewGridAdapter)) {
throw new IllegalStateException(
"Cannot add footer view to grid -- setAdapter has already been called.");
}
FixedViewInfo info = new FixedViewInfo();
FrameLayout fl = new FullWidthFixedViewLayout(getContext());
fl.addView(v);
info.view = v;
info.viewContainer = fl;
info.data = data;
info.isSelectable = isSelectable;
mFooterViewInfos.add(info);
// in the case of re-adding a header view, or adding one later on,
// we need to notify the observer
if (adapter != null) {
((HeaderFooterViewGridAdapter) adapter).notifyDataSetChanged();
}
} | [
"public",
"void",
"addFooterView",
"(",
"View",
"v",
",",
"Object",
"data",
",",
"boolean",
"isSelectable",
")",
"{",
"ListAdapter",
"adapter",
"=",
"getAdapter",
"(",
")",
";",
"if",
"(",
"adapter",
"!=",
"null",
"&&",
"!",
"(",
"adapter",
"instanceof",
... | Add a fixed view to appear at the bottom of the grid. If addFooterView is
called more than once, the views will appear in the order they were
added. Views added using this call can take focus if they want.
<p>
NOTE: Call this before calling setAdapter. This is so HeaderFooterGridView can wrap
the supplied cursor with one that will also account for header views.
@param v The view to add.
@param data Data to associate with this view
@param isSelectable whether the item is selectable | [
"Add",
"a",
"fixed",
"view",
"to",
"appear",
"at",
"the",
"bottom",
"of",
"the",
"grid",
".",
"If",
"addFooterView",
"is",
"called",
"more",
"than",
"once",
"the",
"views",
"will",
"appear",
"in",
"the",
"order",
"they",
"were",
"added",
".",
"Views",
... | train | https://github.com/recruit-mp/android-HeaderFooterGridView/blob/a3deb03fffaa5b7e6723994b8b79b4c8e3e54c34/library/src/main/java/jp/co/recruit_mp/android/headerfootergridview/HeaderFooterGridView.java#L181-L203 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/renderkit/html/HtmlFormRenderer.java | HtmlFormRenderer.afterFormElementsEnd | @Override
protected void afterFormElementsEnd(FacesContext facesContext, UIComponent component) throws IOException
{
super.afterFormElementsEnd(facesContext, component);
} | java | @Override
protected void afterFormElementsEnd(FacesContext facesContext, UIComponent component) throws IOException
{
super.afterFormElementsEnd(facesContext, component);
} | [
"@",
"Override",
"protected",
"void",
"afterFormElementsEnd",
"(",
"FacesContext",
"facesContext",
",",
"UIComponent",
"component",
")",
"throws",
"IOException",
"{",
"super",
".",
"afterFormElementsEnd",
"(",
"facesContext",
",",
"component",
")",
";",
"}"
] | private static final Log log = LogFactory.getLog(HtmlFormRenderer.class); | [
"private",
"static",
"final",
"Log",
"log",
"=",
"LogFactory",
".",
"getLog",
"(",
"HtmlFormRenderer",
".",
"class",
")",
";"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/renderkit/html/HtmlFormRenderer.java#L46-L50 |
keshrath/Giphy4J | src/main/java/at/mukprojects/giphy4j/Giphy.java | Giphy.searchRandomSticker | public SearchRandom searchRandomSticker(String tag) throws GiphyException {
SearchRandom random = null;
HashMap<String, String> params = new HashMap<String, String>();
params.put("api_key", apiKey);
params.put("tag", tag);
Request request = new Request(UrlUtil.buildUrlQuery(RandomEndpointSticker, params));
try {
Response response = sender.sendRequest(request);
random = gson.fromJson(response.getBody(), SearchRandom.class);
} catch (JsonSyntaxException | IOException e) {
log.error(e.getMessage(), e);
throw new GiphyException(e);
}
return random;
} | java | public SearchRandom searchRandomSticker(String tag) throws GiphyException {
SearchRandom random = null;
HashMap<String, String> params = new HashMap<String, String>();
params.put("api_key", apiKey);
params.put("tag", tag);
Request request = new Request(UrlUtil.buildUrlQuery(RandomEndpointSticker, params));
try {
Response response = sender.sendRequest(request);
random = gson.fromJson(response.getBody(), SearchRandom.class);
} catch (JsonSyntaxException | IOException e) {
log.error(e.getMessage(), e);
throw new GiphyException(e);
}
return random;
} | [
"public",
"SearchRandom",
"searchRandomSticker",
"(",
"String",
"tag",
")",
"throws",
"GiphyException",
"{",
"SearchRandom",
"random",
"=",
"null",
";",
"HashMap",
"<",
"String",
",",
"String",
">",
"params",
"=",
"new",
"HashMap",
"<",
"String",
",",
"String"... | Returns a random GIF, limited by tag.
<p>
Be aware that not every response has all information available. In that
case the value will be returned as null.
@param tag
the GIF tag to limit randomness
@return the SerachGiphy object
@throws GiphyException
if an error occurs during the search | [
"Returns",
"a",
"random",
"GIF",
"limited",
"by",
"tag",
"."
] | train | https://github.com/keshrath/Giphy4J/blob/e56b67f161e2184ccff9b9e8f95a70ef89cec897/src/main/java/at/mukprojects/giphy4j/Giphy.java#L448-L467 |
moparisthebest/beehive | beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowUtils.java | PageFlowUtils.getRelativeURI | public static String getRelativeURI( HttpServletRequest request, String uri, PageFlowController relativeTo )
{
String contextPath = request.getContextPath();
if ( relativeTo != null ) contextPath += relativeTo.getModulePath();
int overlap = uri.indexOf( contextPath + '/' );
if ( overlap == -1 ) return null;
return uri.substring( overlap + contextPath.length() );
} | java | public static String getRelativeURI( HttpServletRequest request, String uri, PageFlowController relativeTo )
{
String contextPath = request.getContextPath();
if ( relativeTo != null ) contextPath += relativeTo.getModulePath();
int overlap = uri.indexOf( contextPath + '/' );
if ( overlap == -1 ) return null;
return uri.substring( overlap + contextPath.length() );
} | [
"public",
"static",
"String",
"getRelativeURI",
"(",
"HttpServletRequest",
"request",
",",
"String",
"uri",
",",
"PageFlowController",
"relativeTo",
")",
"{",
"String",
"contextPath",
"=",
"request",
".",
"getContextPath",
"(",
")",
";",
"if",
"(",
"relativeTo",
... | Get a URI relative to the URI of the given PageFlowController.
@param request the current HttpServletRequest.
@param uri the URI which should be made relative.
@param relativeTo a PageFlowController to which the returned URI should be relative, or
<code>null</code> if the returned URI should be relative to the webapp root. | [
"Get",
"a",
"URI",
"relative",
"to",
"the",
"URI",
"of",
"the",
"given",
"PageFlowController",
"."
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowUtils.java#L150-L157 |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/geo/PerspectiveOps.java | PerspectiveOps.convertPixelToNorm | public static Point2D_F32 convertPixelToNorm( FMatrixRMaj K , Point2D_F32 pixel , Point2D_F32 norm ) {
return ImplPerspectiveOps_F32.convertPixelToNorm(K, pixel, norm);
} | java | public static Point2D_F32 convertPixelToNorm( FMatrixRMaj K , Point2D_F32 pixel , Point2D_F32 norm ) {
return ImplPerspectiveOps_F32.convertPixelToNorm(K, pixel, norm);
} | [
"public",
"static",
"Point2D_F32",
"convertPixelToNorm",
"(",
"FMatrixRMaj",
"K",
",",
"Point2D_F32",
"pixel",
",",
"Point2D_F32",
"norm",
")",
"{",
"return",
"ImplPerspectiveOps_F32",
".",
"convertPixelToNorm",
"(",
"K",
",",
"pixel",
",",
"norm",
")",
";",
"}"... | <p>
Convenient function for converting from original image pixel coordinate to normalized< image coordinates.
If speed is a concern then {@link PinholePtoN_F64} should be used instead.
</p>
NOTE: norm and pixel can be the same instance.
@param K Intrinsic camera calibration matrix
@param pixel Pixel coordinate.
@param norm Optional storage for output. If null a new instance will be declared.
@return normalized image coordinate | [
"<p",
">",
"Convenient",
"function",
"for",
"converting",
"from",
"original",
"image",
"pixel",
"coordinate",
"to",
"normalized<",
"image",
"coordinates",
".",
"If",
"speed",
"is",
"a",
"concern",
"then",
"{",
"@link",
"PinholePtoN_F64",
"}",
"should",
"be",
"... | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/PerspectiveOps.java#L496-L498 |
jenkinsci/support-core-plugin | src/main/java/com/cloudbees/jenkins/support/filter/ContentMapping.java | ContentMapping.of | public static ContentMapping of(@Nonnull String original, @Nonnull String replacement) {
return new ContentMapping(original, replacement);
} | java | public static ContentMapping of(@Nonnull String original, @Nonnull String replacement) {
return new ContentMapping(original, replacement);
} | [
"public",
"static",
"ContentMapping",
"of",
"(",
"@",
"Nonnull",
"String",
"original",
",",
"@",
"Nonnull",
"String",
"replacement",
")",
"{",
"return",
"new",
"ContentMapping",
"(",
"original",
",",
"replacement",
")",
";",
"}"
] | Constructs a ContentMapping using an original and replacement value. | [
"Constructs",
"a",
"ContentMapping",
"using",
"an",
"original",
"and",
"replacement",
"value",
"."
] | train | https://github.com/jenkinsci/support-core-plugin/blob/bcbe1dfd5bf48ac89903645cd48ed897c1a04688/src/main/java/com/cloudbees/jenkins/support/filter/ContentMapping.java#L82-L84 |
graphhopper/graphhopper | core/src/main/java/com/graphhopper/storage/index/BresenhamLine.java | BresenhamLine.calcPoints | public static void calcPoints(final double lat1, final double lon1,
final double lat2, final double lon2,
final PointEmitter emitter,
final double offsetLat, final double offsetLon,
final double deltaLat, final double deltaLon) {
// round to make results of bresenham closer to correct solution
int y1 = (int) ((lat1 - offsetLat) / deltaLat);
int x1 = (int) ((lon1 - offsetLon) / deltaLon);
int y2 = (int) ((lat2 - offsetLat) / deltaLat);
int x2 = (int) ((lon2 - offsetLon) / deltaLon);
bresenham(y1, x1, y2, x2, new PointEmitter() {
@Override
public void set(double lat, double lon) {
// +.1 to move more near the center of the tile
emitter.set((lat + .1) * deltaLat + offsetLat, (lon + .1) * deltaLon + offsetLon);
}
});
} | java | public static void calcPoints(final double lat1, final double lon1,
final double lat2, final double lon2,
final PointEmitter emitter,
final double offsetLat, final double offsetLon,
final double deltaLat, final double deltaLon) {
// round to make results of bresenham closer to correct solution
int y1 = (int) ((lat1 - offsetLat) / deltaLat);
int x1 = (int) ((lon1 - offsetLon) / deltaLon);
int y2 = (int) ((lat2 - offsetLat) / deltaLat);
int x2 = (int) ((lon2 - offsetLon) / deltaLon);
bresenham(y1, x1, y2, x2, new PointEmitter() {
@Override
public void set(double lat, double lon) {
// +.1 to move more near the center of the tile
emitter.set((lat + .1) * deltaLat + offsetLat, (lon + .1) * deltaLon + offsetLon);
}
});
} | [
"public",
"static",
"void",
"calcPoints",
"(",
"final",
"double",
"lat1",
",",
"final",
"double",
"lon1",
",",
"final",
"double",
"lat2",
",",
"final",
"double",
"lon2",
",",
"final",
"PointEmitter",
"emitter",
",",
"final",
"double",
"offsetLat",
",",
"fina... | Calls the Bresenham algorithm but make it working for double values | [
"Calls",
"the",
"Bresenham",
"algorithm",
"but",
"make",
"it",
"working",
"for",
"double",
"values"
] | train | https://github.com/graphhopper/graphhopper/blob/c235e306e6e823043cadcc41ead0e685bdebf737/core/src/main/java/com/graphhopper/storage/index/BresenhamLine.java#L65-L82 |
xhsun/gw2wrapper | src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java | AsynchronousRequest.getCharacterUnlockedRecipes | public void getCharacterUnlockedRecipes(String API, String name, Callback<CharacterRecipes> callback) throws GuildWars2Exception, NullPointerException {
isParamValid(new ParamChecker(ParamType.API, API), new ParamChecker(ParamType.CHAR, name));
gw2API.getCharacterUnlockedRecipes(name, API).enqueue(callback);
} | java | public void getCharacterUnlockedRecipes(String API, String name, Callback<CharacterRecipes> callback) throws GuildWars2Exception, NullPointerException {
isParamValid(new ParamChecker(ParamType.API, API), new ParamChecker(ParamType.CHAR, name));
gw2API.getCharacterUnlockedRecipes(name, API).enqueue(callback);
} | [
"public",
"void",
"getCharacterUnlockedRecipes",
"(",
"String",
"API",
",",
"String",
"name",
",",
"Callback",
"<",
"CharacterRecipes",
">",
"callback",
")",
"throws",
"GuildWars2Exception",
",",
"NullPointerException",
"{",
"isParamValid",
"(",
"new",
"ParamChecker",... | For more info on Character Recipes API go <a href="https://wiki.guildwars2.com/wiki/API:2/characters">here</a><br/>
Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions
@param API API key
@param name character name
@param callback callback that is going to be used for {@link Call#enqueue(Callback)}
@throws GuildWars2Exception invalid API key | empty character name
@throws NullPointerException if given {@link Callback} is empty
@see Recipe recipe info | [
"For",
"more",
"info",
"on",
"Character",
"Recipes",
"API",
"go",
"<a",
"href",
"=",
"https",
":",
"//",
"wiki",
".",
"guildwars2",
".",
"com",
"/",
"wiki",
"/",
"API",
":",
"2",
"/",
"characters",
">",
"here<",
"/",
"a",
">",
"<br",
"/",
">",
"G... | train | https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java#L797-L800 |
sockeqwe/mosby-conductor | mvi/src/main/java/com/hannesdorfmann/mosby3/MviConductorLifecycleListener.java | MviConductorLifecycleListener.retainPresenterInstance | static boolean retainPresenterInstance(boolean keepPresenterInstance, Controller controller) {
return keepPresenterInstance && (controller.getActivity().isChangingConfigurations()
|| !controller.getActivity().isFinishing()) && !controller.isBeingDestroyed();
} | java | static boolean retainPresenterInstance(boolean keepPresenterInstance, Controller controller) {
return keepPresenterInstance && (controller.getActivity().isChangingConfigurations()
|| !controller.getActivity().isFinishing()) && !controller.isBeingDestroyed();
} | [
"static",
"boolean",
"retainPresenterInstance",
"(",
"boolean",
"keepPresenterInstance",
",",
"Controller",
"controller",
")",
"{",
"return",
"keepPresenterInstance",
"&&",
"(",
"controller",
".",
"getActivity",
"(",
")",
".",
"isChangingConfigurations",
"(",
")",
"||... | Determines whether or not a Presenter Instance should be kept
@param keepPresenterInstance true, if the delegate has enabled keep | [
"Determines",
"whether",
"or",
"not",
"a",
"Presenter",
"Instance",
"should",
"be",
"kept"
] | train | https://github.com/sockeqwe/mosby-conductor/blob/2a70b20eb8262ca3bcddd30efdc080a3cdabb96c/mvi/src/main/java/com/hannesdorfmann/mosby3/MviConductorLifecycleListener.java#L109-L113 |
eclipse/xtext-lib | org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/FunctionExtensions.java | FunctionExtensions.andThen | public static <V1,V2,T,R> Function2<V1, V2, R> andThen(final Function2<? super V1,? super V2, ? extends T> before, final Function1<? super T, ? extends R> after) {
if (after == null)
throw new NullPointerException("after");
if (before == null)
throw new NullPointerException("before");
return new Function2<V1, V2, R>() {
@Override
public R apply(V1 v1, V2 v2) {
return after.apply(before.apply(v1, v2));
}
};
} | java | public static <V1,V2,T,R> Function2<V1, V2, R> andThen(final Function2<? super V1,? super V2, ? extends T> before, final Function1<? super T, ? extends R> after) {
if (after == null)
throw new NullPointerException("after");
if (before == null)
throw new NullPointerException("before");
return new Function2<V1, V2, R>() {
@Override
public R apply(V1 v1, V2 v2) {
return after.apply(before.apply(v1, v2));
}
};
} | [
"public",
"static",
"<",
"V1",
",",
"V2",
",",
"T",
",",
"R",
">",
"Function2",
"<",
"V1",
",",
"V2",
",",
"R",
">",
"andThen",
"(",
"final",
"Function2",
"<",
"?",
"super",
"V1",
",",
"?",
"super",
"V2",
",",
"?",
"extends",
"T",
">",
"before"... | Returns a composed function that first applies the {@code before}
function to its input, and then applies the {@code after} function to the result.
If evaluation of either function throws an exception, it is relayed to
the caller of the composed function.
@param <V1> the type of the first parameter to the {@code before} function, and to the composed function
@param <V2> the type of the second parameter to the {@code before} function, and to the composed function
@param <T> the type of output of the {@code before} function, and input to the {@code after} function
@param <R> the type of output to the {@code after} function, and to the composed function
@param before the function to apply before the {@code after} function is applied
@param after the function to apply after the {@code before} function is applied
@return a composed function that first applies the {@code before}
function and then applies the {@code after} function
@throws NullPointerException if {@code before} or {@code after} is null
@see #compose(Functions.Function1, Functions.Function1)
@since 2.9 | [
"Returns",
"a",
"composed",
"function",
"that",
"first",
"applies",
"the",
"{",
"@code",
"before",
"}",
"function",
"to",
"its",
"input",
"and",
"then",
"applies",
"the",
"{",
"@code",
"after",
"}",
"function",
"to",
"the",
"result",
".",
"If",
"evaluation... | train | https://github.com/eclipse/xtext-lib/blob/7063572e1f1bd713a3aa53bdf3a8dc60e25c169a/org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/FunctionExtensions.java#L237-L248 |
moparisthebest/beehive | beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/TreeRenderer.java | TreeRenderer.renderLabel | protected void renderLabel(AbstractRenderAppender writer, TreeElement node)
{
String label = node.getLabel();
if (label != null) {
renderLabelPrefix(writer, node);
if (_trs.escapeContent) {
HtmlUtils.filter(label, writer);
}
else {
writer.append(label);
}
renderLabelSuffix(writer, node);
}
} | java | protected void renderLabel(AbstractRenderAppender writer, TreeElement node)
{
String label = node.getLabel();
if (label != null) {
renderLabelPrefix(writer, node);
if (_trs.escapeContent) {
HtmlUtils.filter(label, writer);
}
else {
writer.append(label);
}
renderLabelSuffix(writer, node);
}
} | [
"protected",
"void",
"renderLabel",
"(",
"AbstractRenderAppender",
"writer",
",",
"TreeElement",
"node",
")",
"{",
"String",
"label",
"=",
"node",
".",
"getLabel",
"(",
")",
";",
"if",
"(",
"label",
"!=",
"null",
")",
"{",
"renderLabelPrefix",
"(",
"writer",... | Render the label for this node (if any).
@param writer the appender where the tree markup is appended
@param node the node to render | [
"Render",
"the",
"label",
"for",
"this",
"node",
"(",
"if",
"any",
")",
"."
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/TreeRenderer.java#L739-L752 |
cloudant/java-cloudant | cloudant-client/src/main/java/com/cloudant/client/org/lightcouch/CouchDatabaseBase.java | CouchDatabaseBase.saveAttachment | public Response saveAttachment(InputStream in, String name, String contentType, String docId,
String docRev) {
assertNotEmpty(in, "in");
assertNotEmpty(name, "name");
assertNotEmpty(contentType, "ContentType");
if (docId == null) {
docId = generateUUID();
// A new doc is being created; there should be no revision specified.
assertNull(docRev, "docRev");
} else {
// The id has been specified, ensure it is not empty
assertNotEmpty(docId, "docId");
if (docRev != null) {
// Existing doc with the specified ID, ensure rev is not empty
assertNotEmpty(docRev, "docRev");
}
}
final URI uri = new DatabaseURIHelper(dbUri).attachmentUri(docId, docRev, name);
return couchDbClient.put(uri, in, contentType);
} | java | public Response saveAttachment(InputStream in, String name, String contentType, String docId,
String docRev) {
assertNotEmpty(in, "in");
assertNotEmpty(name, "name");
assertNotEmpty(contentType, "ContentType");
if (docId == null) {
docId = generateUUID();
// A new doc is being created; there should be no revision specified.
assertNull(docRev, "docRev");
} else {
// The id has been specified, ensure it is not empty
assertNotEmpty(docId, "docId");
if (docRev != null) {
// Existing doc with the specified ID, ensure rev is not empty
assertNotEmpty(docRev, "docRev");
}
}
final URI uri = new DatabaseURIHelper(dbUri).attachmentUri(docId, docRev, name);
return couchDbClient.put(uri, in, contentType);
} | [
"public",
"Response",
"saveAttachment",
"(",
"InputStream",
"in",
",",
"String",
"name",
",",
"String",
"contentType",
",",
"String",
"docId",
",",
"String",
"docRev",
")",
"{",
"assertNotEmpty",
"(",
"in",
",",
"\"in\"",
")",
";",
"assertNotEmpty",
"(",
"na... | Saves an attachment to an existing document given both a document id
and revision, or save to a new document given only the id, and rev as {@code null}.
<p>To retrieve an attachment, see {@link #find(String)}.
@param in The {@link InputStream} holding the binary data.
@param name The attachment name.
@param contentType The attachment "Content-Type".
@param docId The document id to save the attachment under, or {@code null} to save
under a new document.
@param docRev The document revision to save the attachment under, or {@code null}
when saving to a new document.
@return {@link Response}
@throws DocumentConflictException | [
"Saves",
"an",
"attachment",
"to",
"an",
"existing",
"document",
"given",
"both",
"a",
"document",
"id",
"and",
"revision",
"or",
"save",
"to",
"a",
"new",
"document",
"given",
"only",
"the",
"id",
"and",
"rev",
"as",
"{",
"@code",
"null",
"}",
".",
"<... | train | https://github.com/cloudant/java-cloudant/blob/42c438654945361bded2cc0827afc046d535b31b/cloudant-client/src/main/java/com/cloudant/client/org/lightcouch/CouchDatabaseBase.java#L361-L380 |
groupon/odo | proxyui/src/main/java/com/groupon/odo/controllers/PathOrderController.java | PathOrderController.pathOrderUpdated | @RequestMapping(value = "", method = RequestMethod.POST)
public String pathOrderUpdated(Model model, @PathVariable int profileId, String pathOrder) {
logger.info("new path order = {}", pathOrder);
int[] intArrayPathOrder = Utils.arrayFromStringOfIntegers(pathOrder);
pathOverrideService.updatePathOrder(profileId, intArrayPathOrder);
return "pathOrder";
} | java | @RequestMapping(value = "", method = RequestMethod.POST)
public String pathOrderUpdated(Model model, @PathVariable int profileId, String pathOrder) {
logger.info("new path order = {}", pathOrder);
int[] intArrayPathOrder = Utils.arrayFromStringOfIntegers(pathOrder);
pathOverrideService.updatePathOrder(profileId, intArrayPathOrder);
return "pathOrder";
} | [
"@",
"RequestMapping",
"(",
"value",
"=",
"\"\"",
",",
"method",
"=",
"RequestMethod",
".",
"POST",
")",
"public",
"String",
"pathOrderUpdated",
"(",
"Model",
"model",
",",
"@",
"PathVariable",
"int",
"profileId",
",",
"String",
"pathOrder",
")",
"{",
"logge... | Called when a path's priority is changed
@param model
@param profileId
@param pathOrder
@return | [
"Called",
"when",
"a",
"path",
"s",
"priority",
"is",
"changed"
] | train | https://github.com/groupon/odo/blob/3bae43d5eca8ace036775e5b2d3ed9af1a9ff9b1/proxyui/src/main/java/com/groupon/odo/controllers/PathOrderController.java#L68-L76 |
FXMisc/WellBehavedFX | src/main/java/org/fxmisc/wellbehaved/event/Nodes.java | Nodes.addFallbackInputMap | public static void addFallbackInputMap(Node node, InputMap<?> im) {
// getInputMap calls init, so can use unsafe setter
setInputMapUnsafe(node, InputMap.sequence(getInputMap(node), im));
} | java | public static void addFallbackInputMap(Node node, InputMap<?> im) {
// getInputMap calls init, so can use unsafe setter
setInputMapUnsafe(node, InputMap.sequence(getInputMap(node), im));
} | [
"public",
"static",
"void",
"addFallbackInputMap",
"(",
"Node",
"node",
",",
"InputMap",
"<",
"?",
">",
"im",
")",
"{",
"// getInputMap calls init, so can use unsafe setter",
"setInputMapUnsafe",
"(",
"node",
",",
"InputMap",
".",
"sequence",
"(",
"getInputMap",
"("... | Adds the given input map to the end of the node's list of input maps, so that an event will be pattern-matched
against all other input maps currently "installed" in the node before being pattern-matched against the given
input map. | [
"Adds",
"the",
"given",
"input",
"map",
"to",
"the",
"end",
"of",
"the",
"node",
"s",
"list",
"of",
"input",
"maps",
"so",
"that",
"an",
"event",
"will",
"be",
"pattern",
"-",
"matched",
"against",
"all",
"other",
"input",
"maps",
"currently",
"installed... | train | https://github.com/FXMisc/WellBehavedFX/blob/ca889734481f5439655ca8deb6f742964b5654b0/src/main/java/org/fxmisc/wellbehaved/event/Nodes.java#L61-L64 |
rainu/dbc | src/main/java/de/raysha/lib/dbc/meta/MetadataManager.java | MetadataManager.insertMetadata | public TableMetadata insertMetadata(String tableName, String version){
TableMetadata result = new TableMetadata(this);
result.setId(new Long(tableName.hashCode()));
result.setName(tableName);
result.setVersion(version);
try{
insertStatement.setLong(1, result.getId());
insertStatement.setString(2, result.getName());
insertStatement.setString(3, result.getVersion());
insertStatement.executeUpdate();
}catch(SQLException e){
throw new BackendException("Could not insert new metadata-entry: " + result, e);
}
return result;
} | java | public TableMetadata insertMetadata(String tableName, String version){
TableMetadata result = new TableMetadata(this);
result.setId(new Long(tableName.hashCode()));
result.setName(tableName);
result.setVersion(version);
try{
insertStatement.setLong(1, result.getId());
insertStatement.setString(2, result.getName());
insertStatement.setString(3, result.getVersion());
insertStatement.executeUpdate();
}catch(SQLException e){
throw new BackendException("Could not insert new metadata-entry: " + result, e);
}
return result;
} | [
"public",
"TableMetadata",
"insertMetadata",
"(",
"String",
"tableName",
",",
"String",
"version",
")",
"{",
"TableMetadata",
"result",
"=",
"new",
"TableMetadata",
"(",
"this",
")",
";",
"result",
".",
"setId",
"(",
"new",
"Long",
"(",
"tableName",
".",
"ha... | Fügt neue Metadaten einer Tabelle hinzu.
@param tableName Name der Tabelle.
@param version Version der Tabelle.
@return | [
"Fügt",
"neue",
"Metadaten",
"einer",
"Tabelle",
"hinzu",
"."
] | train | https://github.com/rainu/dbc/blob/bdf1d1945ccaa8db8ed0b91bd08d5ef9802777f7/src/main/java/de/raysha/lib/dbc/meta/MetadataManager.java#L134-L151 |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/dispatching/composing/PipelinedTernaryConsumer.java | PipelinedTernaryConsumer.accept | @Override
public void accept(E1 first, E2 second, E3 third) {
for (TriConsumer<E1, E2, E3> consumer : consumers) {
consumer.accept(first, second, third);
}
} | java | @Override
public void accept(E1 first, E2 second, E3 third) {
for (TriConsumer<E1, E2, E3> consumer : consumers) {
consumer.accept(first, second, third);
}
} | [
"@",
"Override",
"public",
"void",
"accept",
"(",
"E1",
"first",
",",
"E2",
"second",
",",
"E3",
"third",
")",
"{",
"for",
"(",
"TriConsumer",
"<",
"E1",
",",
"E2",
",",
"E3",
">",
"consumer",
":",
"consumers",
")",
"{",
"consumer",
".",
"accept",
... | Performs every composed consumer.
@param first the first element
@param second the second element
@param third the third element | [
"Performs",
"every",
"composed",
"consumer",
"."
] | train | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/dispatching/composing/PipelinedTernaryConsumer.java#L31-L36 |
MorphiaOrg/morphia | morphia/src/main/java/dev/morphia/utils/Assert.java | Assert.parameterNotEmpty | public static void parameterNotEmpty(final String name, final Iterable obj) {
if (!obj.iterator().hasNext()) {
raiseError(format("Parameter '%s' from type '%s' is expected to NOT be empty", name, obj.getClass().getName()));
}
} | java | public static void parameterNotEmpty(final String name, final Iterable obj) {
if (!obj.iterator().hasNext()) {
raiseError(format("Parameter '%s' from type '%s' is expected to NOT be empty", name, obj.getClass().getName()));
}
} | [
"public",
"static",
"void",
"parameterNotEmpty",
"(",
"final",
"String",
"name",
",",
"final",
"Iterable",
"obj",
")",
"{",
"if",
"(",
"!",
"obj",
".",
"iterator",
"(",
")",
".",
"hasNext",
"(",
")",
")",
"{",
"raiseError",
"(",
"format",
"(",
"\"Param... | Validates that the Iterable is not empty
@param name the parameter name
@param obj the proposed parameter value | [
"Validates",
"that",
"the",
"Iterable",
"is",
"not",
"empty"
] | train | https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/dev/morphia/utils/Assert.java#L61-L65 |
landawn/AbacusUtil | src/com/landawn/abacus/util/CSVUtil.java | CSVUtil.importCSV | public static <E extends Exception> long importCSV(final File file, final long offset, final long count, final Try.Predicate<String[], E> filter,
final PreparedStatement stmt, final int batchSize, final int batchInterval,
final Try.BiConsumer<? super PreparedStatement, ? super String[], SQLException> stmtSetter) throws UncheckedSQLException, UncheckedIOException, E {
Reader reader = null;
try {
reader = new FileReader(file);
return importCSV(reader, offset, count, filter, stmt, batchSize, batchInterval, stmtSetter);
} catch (IOException e) {
throw new UncheckedIOException(e);
} finally {
IOUtil.close(reader);
}
} | java | public static <E extends Exception> long importCSV(final File file, final long offset, final long count, final Try.Predicate<String[], E> filter,
final PreparedStatement stmt, final int batchSize, final int batchInterval,
final Try.BiConsumer<? super PreparedStatement, ? super String[], SQLException> stmtSetter) throws UncheckedSQLException, UncheckedIOException, E {
Reader reader = null;
try {
reader = new FileReader(file);
return importCSV(reader, offset, count, filter, stmt, batchSize, batchInterval, stmtSetter);
} catch (IOException e) {
throw new UncheckedIOException(e);
} finally {
IOUtil.close(reader);
}
} | [
"public",
"static",
"<",
"E",
"extends",
"Exception",
">",
"long",
"importCSV",
"(",
"final",
"File",
"file",
",",
"final",
"long",
"offset",
",",
"final",
"long",
"count",
",",
"final",
"Try",
".",
"Predicate",
"<",
"String",
"[",
"]",
",",
"E",
">",
... | Imports the data from CSV to database.
@param file
@param offset
@param count
@param filter
@param stmt the column order in the sql should be consistent with the column order in the CSV file.
@param batchSize
@param batchInterval
@param stmtSetter
@return | [
"Imports",
"the",
"data",
"from",
"CSV",
"to",
"database",
"."
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/CSVUtil.java#L1604-L1618 |
landawn/AbacusUtil | src/com/landawn/abacus/util/Primitives.java | Primitives.box | @SafeVarargs
public static Integer[] box(final int... a) {
if (a == null) {
return null;
}
return box(a, 0, a.length);
} | java | @SafeVarargs
public static Integer[] box(final int... a) {
if (a == null) {
return null;
}
return box(a, 0, a.length);
} | [
"@",
"SafeVarargs",
"public",
"static",
"Integer",
"[",
"]",
"box",
"(",
"final",
"int",
"...",
"a",
")",
"{",
"if",
"(",
"a",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"box",
"(",
"a",
",",
"0",
",",
"a",
".",
"length",
")"... | <p>
Converts an array of primitive ints to objects.
</p>
<p>
This method returns {@code null} for a {@code null} input array.
</p>
@param a
an {@code int} array
@return an {@code Integer} array, {@code null} if null array input | [
"<p",
">",
"Converts",
"an",
"array",
"of",
"primitive",
"ints",
"to",
"objects",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/Primitives.java#L275-L282 |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java | JBBPDslBuilder.Byte | public JBBPDslBuilder Byte(final String name) {
final Item item = new Item(BinType.BYTE, name, this.byteOrder);
this.addItem(item);
return this;
} | java | public JBBPDslBuilder Byte(final String name) {
final Item item = new Item(BinType.BYTE, name, this.byteOrder);
this.addItem(item);
return this;
} | [
"public",
"JBBPDslBuilder",
"Byte",
"(",
"final",
"String",
"name",
")",
"{",
"final",
"Item",
"item",
"=",
"new",
"Item",
"(",
"BinType",
".",
"BYTE",
",",
"name",
",",
"this",
".",
"byteOrder",
")",
";",
"this",
".",
"addItem",
"(",
"item",
")",
";... | Add named signed byte field.
@param name name of the field, can be null for anonymous one
@return the builder instance, must not be null | [
"Add",
"named",
"signed",
"byte",
"field",
"."
] | train | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java#L827-L831 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/PdfAppearance.java | PdfAppearance.setFontAndSize | public void setFontAndSize(BaseFont bf, float size) {
checkWriter();
state.size = size;
if (bf.getFontType() == BaseFont.FONT_TYPE_DOCUMENT) {
state.fontDetails = new FontDetails(null, ((DocumentFont)bf).getIndirectReference(), bf);
}
else
state.fontDetails = writer.addSimple(bf);
PdfName psn = (PdfName)stdFieldFontNames.get(bf.getPostscriptFontName());
if (psn == null) {
if (bf.isSubset() && bf.getFontType() == BaseFont.FONT_TYPE_TTUNI)
psn = state.fontDetails.getFontName();
else {
psn = new PdfName(bf.getPostscriptFontName());
state.fontDetails.setSubset(false);
}
}
PageResources prs = getPageResources();
// PdfName name = state.fontDetails.getFontName();
prs.addFont(psn, state.fontDetails.getIndirectReference());
content.append(psn.getBytes()).append(' ').append(size).append(" Tf").append_i(separator);
} | java | public void setFontAndSize(BaseFont bf, float size) {
checkWriter();
state.size = size;
if (bf.getFontType() == BaseFont.FONT_TYPE_DOCUMENT) {
state.fontDetails = new FontDetails(null, ((DocumentFont)bf).getIndirectReference(), bf);
}
else
state.fontDetails = writer.addSimple(bf);
PdfName psn = (PdfName)stdFieldFontNames.get(bf.getPostscriptFontName());
if (psn == null) {
if (bf.isSubset() && bf.getFontType() == BaseFont.FONT_TYPE_TTUNI)
psn = state.fontDetails.getFontName();
else {
psn = new PdfName(bf.getPostscriptFontName());
state.fontDetails.setSubset(false);
}
}
PageResources prs = getPageResources();
// PdfName name = state.fontDetails.getFontName();
prs.addFont(psn, state.fontDetails.getIndirectReference());
content.append(psn.getBytes()).append(' ').append(size).append(" Tf").append_i(separator);
} | [
"public",
"void",
"setFontAndSize",
"(",
"BaseFont",
"bf",
",",
"float",
"size",
")",
"{",
"checkWriter",
"(",
")",
";",
"state",
".",
"size",
"=",
"size",
";",
"if",
"(",
"bf",
".",
"getFontType",
"(",
")",
"==",
"BaseFont",
".",
"FONT_TYPE_DOCUMENT",
... | Set the font and the size for the subsequent text writing.
@param bf the font
@param size the font size in points | [
"Set",
"the",
"font",
"and",
"the",
"size",
"for",
"the",
"subsequent",
"text",
"writing",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfAppearance.java#L138-L159 |
upwork/java-upwork | src/com/Upwork/api/Routers/Hr/Clients/Offers.java | Offers.getSpecific | public JSONObject getSpecific(String reference, HashMap<String, String> params) throws JSONException {
return oClient.get("/offers/v1/clients/offers/" + reference, params);
} | java | public JSONObject getSpecific(String reference, HashMap<String, String> params) throws JSONException {
return oClient.get("/offers/v1/clients/offers/" + reference, params);
} | [
"public",
"JSONObject",
"getSpecific",
"(",
"String",
"reference",
",",
"HashMap",
"<",
"String",
",",
"String",
">",
"params",
")",
"throws",
"JSONException",
"{",
"return",
"oClient",
".",
"get",
"(",
"\"/offers/v1/clients/offers/\"",
"+",
"reference",
",",
"p... | Get specific offer
@param reference Offer reference
@param params Parameters
@throws JSONException If error occurred
@return {@link JSONObject} | [
"Get",
"specific",
"offer"
] | train | https://github.com/upwork/java-upwork/blob/342297161503a74e9e0bddbd381ab5eebf4dc454/src/com/Upwork/api/Routers/Hr/Clients/Offers.java#L65-L67 |
cloudant/java-cloudant | cloudant-client/src/main/java/com/cloudant/client/api/Replication.java | Replication.queryParams | public Replication queryParams(Map<String, Object> queryParams) {
this.replication = replication.queryParams(queryParams);
return this;
} | java | public Replication queryParams(Map<String, Object> queryParams) {
this.replication = replication.queryParams(queryParams);
return this;
} | [
"public",
"Replication",
"queryParams",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"queryParams",
")",
"{",
"this",
".",
"replication",
"=",
"replication",
".",
"queryParams",
"(",
"queryParams",
")",
";",
"return",
"this",
";",
"}"
] | Specify additional query parameters to be passed to the filter function.
@param queryParams map of key-value parameters
@return this Replication instance to set more options or trigger the replication | [
"Specify",
"additional",
"query",
"parameters",
"to",
"be",
"passed",
"to",
"the",
"filter",
"function",
"."
] | train | https://github.com/cloudant/java-cloudant/blob/42c438654945361bded2cc0827afc046d535b31b/cloudant-client/src/main/java/com/cloudant/client/api/Replication.java#L131-L134 |
box/box-java-sdk | src/main/java/com/box/sdk/BoxWebHookSignatureVerifier.java | BoxWebHookSignatureVerifier.signRaw | private byte[] signRaw(BoxSignatureAlgorithm algorithm, String key, String webHookPayload,
String deliveryTimestamp) {
Mac mac = MAC_POOL.acquire(algorithm.javaProviderName);
try {
mac.init(new SecretKeySpec(key.getBytes(UTF_8), algorithm.javaProviderName));
mac.update(UTF_8.encode(webHookPayload));
mac.update(UTF_8.encode(deliveryTimestamp));
return mac.doFinal();
} catch (InvalidKeyException e) {
throw new IllegalArgumentException("Invalid key: ", e);
} finally {
MAC_POOL.release(mac);
}
} | java | private byte[] signRaw(BoxSignatureAlgorithm algorithm, String key, String webHookPayload,
String deliveryTimestamp) {
Mac mac = MAC_POOL.acquire(algorithm.javaProviderName);
try {
mac.init(new SecretKeySpec(key.getBytes(UTF_8), algorithm.javaProviderName));
mac.update(UTF_8.encode(webHookPayload));
mac.update(UTF_8.encode(deliveryTimestamp));
return mac.doFinal();
} catch (InvalidKeyException e) {
throw new IllegalArgumentException("Invalid key: ", e);
} finally {
MAC_POOL.release(mac);
}
} | [
"private",
"byte",
"[",
"]",
"signRaw",
"(",
"BoxSignatureAlgorithm",
"algorithm",
",",
"String",
"key",
",",
"String",
"webHookPayload",
",",
"String",
"deliveryTimestamp",
")",
"{",
"Mac",
"mac",
"=",
"MAC_POOL",
".",
"acquire",
"(",
"algorithm",
".",
"javaP... | Calculates signature for a provided information.
@param algorithm
for which algorithm
@param key
used by signing
@param webHookPayload
for singing
@param deliveryTimestamp
for signing
@return calculated signature | [
"Calculates",
"signature",
"for",
"a",
"provided",
"information",
"."
] | train | https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/BoxWebHookSignatureVerifier.java#L180-L193 |
vikingbrain/thedavidbox-client4j | src/main/java/com/vikingbrain/nmt/operations/TheDavidboxOperationFactory.java | TheDavidboxOperationFactory.sendAndParse | private <T extends DavidBoxResponse> T sendAndParse(String urlGet, Class<T> responseTargetClass) throws TheDavidBoxClientException{
logger.debug("urlGet: " + urlGet);
//Notify the listener about the request
notifyRequest(urlGet);
// Call the davidbox service to get the xml response
String xmlResponse = "";
try {
xmlResponse = getRemoteHttpService().sendGetRequest(urlGet);
} catch (TheDavidBoxClientException e1) {
throw new TheDavidBoxClientException(e1, urlGet, xmlResponse);
}
//Notify the listener about the response
notifyResponse(xmlResponse);
// Parse the response into a business object
T responseObject = null;
try {
responseObject = getDavidBoxPaser().parse(responseTargetClass, xmlResponse);
} catch (TheDavidBoxClientException e2) {
throw new TheDavidBoxClientException(e2, urlGet, xmlResponse);
}
return responseObject;
} | java | private <T extends DavidBoxResponse> T sendAndParse(String urlGet, Class<T> responseTargetClass) throws TheDavidBoxClientException{
logger.debug("urlGet: " + urlGet);
//Notify the listener about the request
notifyRequest(urlGet);
// Call the davidbox service to get the xml response
String xmlResponse = "";
try {
xmlResponse = getRemoteHttpService().sendGetRequest(urlGet);
} catch (TheDavidBoxClientException e1) {
throw new TheDavidBoxClientException(e1, urlGet, xmlResponse);
}
//Notify the listener about the response
notifyResponse(xmlResponse);
// Parse the response into a business object
T responseObject = null;
try {
responseObject = getDavidBoxPaser().parse(responseTargetClass, xmlResponse);
} catch (TheDavidBoxClientException e2) {
throw new TheDavidBoxClientException(e2, urlGet, xmlResponse);
}
return responseObject;
} | [
"private",
"<",
"T",
"extends",
"DavidBoxResponse",
">",
"T",
"sendAndParse",
"(",
"String",
"urlGet",
",",
"Class",
"<",
"T",
">",
"responseTargetClass",
")",
"throws",
"TheDavidBoxClientException",
"{",
"logger",
".",
"debug",
"(",
"\"urlGet: \"",
"+",
"urlGet... | It sends the url get to the service and parse the response in the desired response target class.
@param urlGet the url to send to the service
@param responseTargetClass the response target class
@return the response object filled with the xml result
@throws TheDavidBoxClientException exception in the client | [
"It",
"sends",
"the",
"url",
"get",
"to",
"the",
"service",
"and",
"parse",
"the",
"response",
"in",
"the",
"desired",
"response",
"target",
"class",
"."
] | train | https://github.com/vikingbrain/thedavidbox-client4j/blob/b2375a59b30fc3bd5dae34316bda68e01d006535/src/main/java/com/vikingbrain/nmt/operations/TheDavidboxOperationFactory.java#L110-L137 |
salesforce/Argus | ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/resources/UserResources.java | UserResources.updateUserEmail | @PUT
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
@Path("/{userId}/email")
@Description("Update user email")
public PrincipalUserDto updateUserEmail(@Context HttpServletRequest req,
@PathParam("userId") final BigInteger userId,
@FormParam("email") final String email) {
if (userId == null || userId.compareTo(BigInteger.ZERO) < 1) {
throw new WebApplicationException("User Id cannot be null and must be a positive non-zero number.", Status.BAD_REQUEST);
}
if (email == null || email.isEmpty()) {
throw new WebApplicationException("Cannot update with null or empty email.", Status.BAD_REQUEST);
}
PrincipalUser remoteUser = getRemoteUser(req);
PrincipalUser user = _uService.findUserByPrimaryKey(userId);
validateResourceAuthorization(req, user, remoteUser);
if (user == null) {
throw new WebApplicationException(Response.Status.NOT_FOUND.getReasonPhrase(), Response.Status.NOT_FOUND);
}
user.setEmail(email);
user = _uService.updateUser(user);
return PrincipalUserDto.transformToDto(user);
} | java | @PUT
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
@Path("/{userId}/email")
@Description("Update user email")
public PrincipalUserDto updateUserEmail(@Context HttpServletRequest req,
@PathParam("userId") final BigInteger userId,
@FormParam("email") final String email) {
if (userId == null || userId.compareTo(BigInteger.ZERO) < 1) {
throw new WebApplicationException("User Id cannot be null and must be a positive non-zero number.", Status.BAD_REQUEST);
}
if (email == null || email.isEmpty()) {
throw new WebApplicationException("Cannot update with null or empty email.", Status.BAD_REQUEST);
}
PrincipalUser remoteUser = getRemoteUser(req);
PrincipalUser user = _uService.findUserByPrimaryKey(userId);
validateResourceAuthorization(req, user, remoteUser);
if (user == null) {
throw new WebApplicationException(Response.Status.NOT_FOUND.getReasonPhrase(), Response.Status.NOT_FOUND);
}
user.setEmail(email);
user = _uService.updateUser(user);
return PrincipalUserDto.transformToDto(user);
} | [
"@",
"PUT",
"@",
"Produces",
"(",
"MediaType",
".",
"APPLICATION_JSON",
")",
"@",
"Consumes",
"(",
"MediaType",
".",
"APPLICATION_FORM_URLENCODED",
")",
"@",
"Path",
"(",
"\"/{userId}/email\"",
")",
"@",
"Description",
"(",
"\"Update user email\"",
")",
"public",
... | Updates the user email.
@param req The HTTP request.
@param userId The ID of the user to update.
@param email The new email address.
@return The updated user DTO.
@throws WebApplicationException If an error occurs. | [
"Updates",
"the",
"user",
"email",
"."
] | train | https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/resources/UserResources.java#L208-L233 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java | Gen.genStats | public void genStats(List<JCStatement> trees, Env<GenContext> env, int crtFlags) {
if (!genCrt) {
genStats(trees, env);
return;
}
if (trees.length() == 1) { // mark one statement with the flags
genStat(trees.head, env, crtFlags | CRT_STATEMENT);
} else {
int startpc = code.curCP();
genStats(trees, env);
code.crt.put(trees, crtFlags, startpc, code.curCP());
}
} | java | public void genStats(List<JCStatement> trees, Env<GenContext> env, int crtFlags) {
if (!genCrt) {
genStats(trees, env);
return;
}
if (trees.length() == 1) { // mark one statement with the flags
genStat(trees.head, env, crtFlags | CRT_STATEMENT);
} else {
int startpc = code.curCP();
genStats(trees, env);
code.crt.put(trees, crtFlags, startpc, code.curCP());
}
} | [
"public",
"void",
"genStats",
"(",
"List",
"<",
"JCStatement",
">",
"trees",
",",
"Env",
"<",
"GenContext",
">",
"env",
",",
"int",
"crtFlags",
")",
"{",
"if",
"(",
"!",
"genCrt",
")",
"{",
"genStats",
"(",
"trees",
",",
"env",
")",
";",
"return",
... | Derived visitor method: check whether CharacterRangeTable
should be emitted, if so, put a new entry into CRTable
and call method to generate bytecode.
If not, just call method to generate bytecode.
@see #genStats(List, Env)
@param trees The list of trees to be visited.
@param env The environment to use.
@param crtFlags The CharacterRangeTable flags
indicating type of the entry. | [
"Derived",
"visitor",
"method",
":",
"check",
"whether",
"CharacterRangeTable",
"should",
"be",
"emitted",
"if",
"so",
"put",
"a",
"new",
"entry",
"into",
"CRTable",
"and",
"call",
"method",
"to",
"generate",
"bytecode",
".",
"If",
"not",
"just",
"call",
"me... | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java#L647-L659 |
sarl/sarl | docs/io.sarl.docs.doclet/src/main/java/io/sarl/docs/doclet/utils/Reflect.java | Reflect.getField | public static <T> T getField(Object obj, String string, Class<?> clazz, Class<T> fieldType) {
try {
final Field field = clazz.getDeclaredField(string);
field.setAccessible(true);
final Object value = field.get(obj);
return fieldType.cast(value);
} catch (Exception exception) {
throw new Error(exception);
}
} | java | public static <T> T getField(Object obj, String string, Class<?> clazz, Class<T> fieldType) {
try {
final Field field = clazz.getDeclaredField(string);
field.setAccessible(true);
final Object value = field.get(obj);
return fieldType.cast(value);
} catch (Exception exception) {
throw new Error(exception);
}
} | [
"public",
"static",
"<",
"T",
">",
"T",
"getField",
"(",
"Object",
"obj",
",",
"String",
"string",
",",
"Class",
"<",
"?",
">",
"clazz",
",",
"Class",
"<",
"T",
">",
"fieldType",
")",
"{",
"try",
"{",
"final",
"Field",
"field",
"=",
"clazz",
".",
... | Replies the value of the field.
@param <T> the field type.
@param obj the instance.
@param string the field name.
@param clazz the container type.
@param fieldType the field type.
@return the value. | [
"Replies",
"the",
"value",
"of",
"the",
"field",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/docs/io.sarl.docs.doclet/src/main/java/io/sarl/docs/doclet/utils/Reflect.java#L118-L127 |
ysc/word | src/main/java/org/apdplat/word/segmentation/impl/AbstractSegmentation.java | AbstractSegmentation.addWord | protected void addWord(List<Word> result, String text, int start, int len){
Word word = getWord(text, start, len);
if(word != null){
result.add(word);
}
} | java | protected void addWord(List<Word> result, String text, int start, int len){
Word word = getWord(text, start, len);
if(word != null){
result.add(word);
}
} | [
"protected",
"void",
"addWord",
"(",
"List",
"<",
"Word",
">",
"result",
",",
"String",
"text",
",",
"int",
"start",
",",
"int",
"len",
")",
"{",
"Word",
"word",
"=",
"getWord",
"(",
"text",
",",
"start",
",",
"len",
")",
";",
"if",
"(",
"word",
... | 将识别出的词放入队列
@param result 队列
@param text 文本
@param start 词开始索引
@param len 词长度 | [
"将识别出的词放入队列"
] | train | https://github.com/ysc/word/blob/5e45607f4e97207f55d1e3bc561abda6b34f7c54/src/main/java/org/apdplat/word/segmentation/impl/AbstractSegmentation.java#L200-L205 |
di2e/Argo | Responder/ResponderDaemon/src/main/java/ws/argo/responder/Responder.java | Responder.addHandler | private void addHandler(String classname, String configFilename) throws ProbeHandlerConfigException {
ClassLoader cl = ClassLoader.getSystemClassLoader();
Class<?> handlerClass;
try {
handlerClass = cl.loadClass(classname);
} catch (ClassNotFoundException e1) {
throw new ProbeHandlerConfigException("Error loading the handler class", e1);
}
ProbeHandlerPlugin handler;
try {
handler = (ProbeHandlerPlugin) handlerClass.newInstance();
} catch (InstantiationException | IllegalAccessException e) {
LOGGER.warn("Could not create an instance of the configured handler class - " + classname);
throw new ProbeHandlerConfigException("Error instantiating the handler class " + classname, e);
}
handler.initializeWithPropertiesFilename(configFilename);
LOGGER.info("Loaded Probe Handler [" + handler.pluginName() + "] classname [" + classname + "] configFile [" + configFilename + "]");
_handlers.add(handler);
} | java | private void addHandler(String classname, String configFilename) throws ProbeHandlerConfigException {
ClassLoader cl = ClassLoader.getSystemClassLoader();
Class<?> handlerClass;
try {
handlerClass = cl.loadClass(classname);
} catch (ClassNotFoundException e1) {
throw new ProbeHandlerConfigException("Error loading the handler class", e1);
}
ProbeHandlerPlugin handler;
try {
handler = (ProbeHandlerPlugin) handlerClass.newInstance();
} catch (InstantiationException | IllegalAccessException e) {
LOGGER.warn("Could not create an instance of the configured handler class - " + classname);
throw new ProbeHandlerConfigException("Error instantiating the handler class " + classname, e);
}
handler.initializeWithPropertiesFilename(configFilename);
LOGGER.info("Loaded Probe Handler [" + handler.pluginName() + "] classname [" + classname + "] configFile [" + configFilename + "]");
_handlers.add(handler);
} | [
"private",
"void",
"addHandler",
"(",
"String",
"classname",
",",
"String",
"configFilename",
")",
"throws",
"ProbeHandlerConfigException",
"{",
"ClassLoader",
"cl",
"=",
"ClassLoader",
".",
"getSystemClassLoader",
"(",
")",
";",
"Class",
"<",
"?",
">",
"handlerCl... | Add a new handler given the classname and config filename. It instantiates
the class and then calls its initialization method to get the handler ready
to process inbound probes.
@param classname is the FQCN of the handler class
@param configFilename is the full path name of the config file name
specific for the handler (could be any crazy format)
@throws ResponderConfigException if there is some issues with the config
file | [
"Add",
"a",
"new",
"handler",
"given",
"the",
"classname",
"and",
"config",
"filename",
".",
"It",
"instantiates",
"the",
"class",
"and",
"then",
"calls",
"its",
"initialization",
"method",
"to",
"get",
"the",
"handler",
"ready",
"to",
"process",
"inbound",
... | train | https://github.com/di2e/Argo/blob/f537a03d2d25fdfecda7999ec10e1da67dc3b8f3/Responder/ResponderDaemon/src/main/java/ws/argo/responder/Responder.java#L265-L287 |
jamesagnew/hapi-fhir | hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/RestfulServer.java | RestfulServer.removeResourceMethods | private void removeResourceMethods(Object theProvider, Class<?> clazz, Collection<String> resourceNames) throws ConfigurationException {
for (Method m : ReflectionUtil.getDeclaredMethods(clazz)) {
BaseMethodBinding<?> foundMethodBinding = BaseMethodBinding.bindMethod(m, getFhirContext(), theProvider);
if (foundMethodBinding == null) {
continue; // not a bound method
}
if (foundMethodBinding instanceof ConformanceMethodBinding) {
myServerConformanceMethod = null;
continue;
}
String resourceName = foundMethodBinding.getResourceName();
if (!resourceNames.contains(resourceName)) {
resourceNames.add(resourceName);
}
}
} | java | private void removeResourceMethods(Object theProvider, Class<?> clazz, Collection<String> resourceNames) throws ConfigurationException {
for (Method m : ReflectionUtil.getDeclaredMethods(clazz)) {
BaseMethodBinding<?> foundMethodBinding = BaseMethodBinding.bindMethod(m, getFhirContext(), theProvider);
if (foundMethodBinding == null) {
continue; // not a bound method
}
if (foundMethodBinding instanceof ConformanceMethodBinding) {
myServerConformanceMethod = null;
continue;
}
String resourceName = foundMethodBinding.getResourceName();
if (!resourceNames.contains(resourceName)) {
resourceNames.add(resourceName);
}
}
} | [
"private",
"void",
"removeResourceMethods",
"(",
"Object",
"theProvider",
",",
"Class",
"<",
"?",
">",
"clazz",
",",
"Collection",
"<",
"String",
">",
"resourceNames",
")",
"throws",
"ConfigurationException",
"{",
"for",
"(",
"Method",
"m",
":",
"ReflectionUtil"... | /*
Collect the set of RESTful methods for a single class when it is being unregistered | [
"/",
"*",
"Collect",
"the",
"set",
"of",
"RESTful",
"methods",
"for",
"a",
"single",
"class",
"when",
"it",
"is",
"being",
"unregistered"
] | train | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/RestfulServer.java#L1528-L1543 |
fhoeben/hsac-fitnesse-fixtures | src/main/java/nl/hsac/fitnesse/fixture/util/FileUtil.java | FileUtil.streamToString | public static String streamToString(InputStream inputStream, String fileName) {
return streamToString(inputStream, fileName, null);
} | java | public static String streamToString(InputStream inputStream, String fileName) {
return streamToString(inputStream, fileName, null);
} | [
"public",
"static",
"String",
"streamToString",
"(",
"InputStream",
"inputStream",
",",
"String",
"fileName",
")",
"{",
"return",
"streamToString",
"(",
"inputStream",
",",
"fileName",
",",
"null",
")",
";",
"}"
] | Copies UTF-8 input stream's content to a string (closes the stream).
@param inputStream input stream (UTF-8) to read.
@param fileName description for stream in error messages.
@return content of stream
@throws RuntimeException if content could not be read. | [
"Copies",
"UTF",
"-",
"8",
"input",
"stream",
"s",
"content",
"to",
"a",
"string",
"(",
"closes",
"the",
"stream",
")",
"."
] | train | https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/FileUtil.java#L55-L57 |
google/error-prone-javac | src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractExecutableMemberWriter.java | AbstractExecutableMemberWriter.addTypeParameters | protected void addTypeParameters(ExecutableElement member, Content htmltree) {
Content typeParameters = getTypeParameters(member);
if (!typeParameters.isEmpty()) {
htmltree.addContent(typeParameters);
htmltree.addContent(Contents.SPACE);
}
} | java | protected void addTypeParameters(ExecutableElement member, Content htmltree) {
Content typeParameters = getTypeParameters(member);
if (!typeParameters.isEmpty()) {
htmltree.addContent(typeParameters);
htmltree.addContent(Contents.SPACE);
}
} | [
"protected",
"void",
"addTypeParameters",
"(",
"ExecutableElement",
"member",
",",
"Content",
"htmltree",
")",
"{",
"Content",
"typeParameters",
"=",
"getTypeParameters",
"(",
"member",
")",
";",
"if",
"(",
"!",
"typeParameters",
".",
"isEmpty",
"(",
")",
")",
... | Add the type parameters for the executable member.
@param member the member to write type parameters for.
@param htmltree the content tree to which the parameters will be added. | [
"Add",
"the",
"type",
"parameters",
"for",
"the",
"executable",
"member",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractExecutableMemberWriter.java#L77-L83 |
jxnet/Jxnet | jxnet-context/src/main/java/com/ardikars/jxnet/context/Application.java | Application.run | public static void run(String aplicationName, String applicationDisplayName, String applicationVersion, Builder<Pcap, Void> builder) {
Validate.notIllegalArgument(builder != null,
new IllegalArgumentException("Pcap builder should be not null."));
instance.context = new ApplicationContext(aplicationName, applicationDisplayName, applicationVersion, builder);
} | java | public static void run(String aplicationName, String applicationDisplayName, String applicationVersion, Builder<Pcap, Void> builder) {
Validate.notIllegalArgument(builder != null,
new IllegalArgumentException("Pcap builder should be not null."));
instance.context = new ApplicationContext(aplicationName, applicationDisplayName, applicationVersion, builder);
} | [
"public",
"static",
"void",
"run",
"(",
"String",
"aplicationName",
",",
"String",
"applicationDisplayName",
",",
"String",
"applicationVersion",
",",
"Builder",
"<",
"Pcap",
",",
"Void",
">",
"builder",
")",
"{",
"Validate",
".",
"notIllegalArgument",
"(",
"bui... | Bootstraping application.
@param aplicationName application name.
@param applicationDisplayName application display name.
@param applicationVersion application version.
@param builder pcap builder. | [
"Bootstraping",
"application",
"."
] | train | https://github.com/jxnet/Jxnet/blob/3ef28eb83c149ff134df1841d12bcbea3d8fe163/jxnet-context/src/main/java/com/ardikars/jxnet/context/Application.java#L68-L72 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassWriter.java | ClassWriter.putInt | void putInt(ByteBuffer buf, int adr, int x) {
buf.elems[adr ] = (byte)((x >> 24) & 0xFF);
buf.elems[adr+1] = (byte)((x >> 16) & 0xFF);
buf.elems[adr+2] = (byte)((x >> 8) & 0xFF);
buf.elems[adr+3] = (byte)((x ) & 0xFF);
} | java | void putInt(ByteBuffer buf, int adr, int x) {
buf.elems[adr ] = (byte)((x >> 24) & 0xFF);
buf.elems[adr+1] = (byte)((x >> 16) & 0xFF);
buf.elems[adr+2] = (byte)((x >> 8) & 0xFF);
buf.elems[adr+3] = (byte)((x ) & 0xFF);
} | [
"void",
"putInt",
"(",
"ByteBuffer",
"buf",
",",
"int",
"adr",
",",
"int",
"x",
")",
"{",
"buf",
".",
"elems",
"[",
"adr",
"]",
"=",
"(",
"byte",
")",
"(",
"(",
"x",
">>",
"24",
")",
"&",
"0xFF",
")",
";",
"buf",
".",
"elems",
"[",
"adr",
"... | Write an integer into given byte buffer;
byte buffer will not be grown. | [
"Write",
"an",
"integer",
"into",
"given",
"byte",
"buffer",
";",
"byte",
"buffer",
"will",
"not",
"be",
"grown",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassWriter.java#L256-L261 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/PublicIPAddressesInner.java | PublicIPAddressesInner.getByResourceGroup | public PublicIPAddressInner getByResourceGroup(String resourceGroupName, String publicIpAddressName, String expand) {
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, publicIpAddressName, expand).toBlocking().single().body();
} | java | public PublicIPAddressInner getByResourceGroup(String resourceGroupName, String publicIpAddressName, String expand) {
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, publicIpAddressName, expand).toBlocking().single().body();
} | [
"public",
"PublicIPAddressInner",
"getByResourceGroup",
"(",
"String",
"resourceGroupName",
",",
"String",
"publicIpAddressName",
",",
"String",
"expand",
")",
"{",
"return",
"getByResourceGroupWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"publicIpAddressName",
"... | Gets the specified public IP address in a specified resource group.
@param resourceGroupName The name of the resource group.
@param publicIpAddressName The name of the subnet.
@param expand Expands referenced resources.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the PublicIPAddressInner object if successful. | [
"Gets",
"the",
"specified",
"public",
"IP",
"address",
"in",
"a",
"specified",
"resource",
"group",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/PublicIPAddressesInner.java#L376-L378 |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/br_broker/br_broker_upgrade.java | br_broker_upgrade.get_nitro_bulk_response | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
br_broker_upgrade_responses result = (br_broker_upgrade_responses) service.get_payload_formatter().string_to_resource(br_broker_upgrade_responses.class, response);
if(result.errorcode != 0)
{
if (result.errorcode == SESSION_NOT_EXISTS)
service.clear_session();
throw new nitro_exception(result.message, result.errorcode, (base_response [])result.br_broker_upgrade_response_array);
}
br_broker_upgrade[] result_br_broker_upgrade = new br_broker_upgrade[result.br_broker_upgrade_response_array.length];
for(int i = 0; i < result.br_broker_upgrade_response_array.length; i++)
{
result_br_broker_upgrade[i] = result.br_broker_upgrade_response_array[i].br_broker_upgrade[0];
}
return result_br_broker_upgrade;
} | java | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
br_broker_upgrade_responses result = (br_broker_upgrade_responses) service.get_payload_formatter().string_to_resource(br_broker_upgrade_responses.class, response);
if(result.errorcode != 0)
{
if (result.errorcode == SESSION_NOT_EXISTS)
service.clear_session();
throw new nitro_exception(result.message, result.errorcode, (base_response [])result.br_broker_upgrade_response_array);
}
br_broker_upgrade[] result_br_broker_upgrade = new br_broker_upgrade[result.br_broker_upgrade_response_array.length];
for(int i = 0; i < result.br_broker_upgrade_response_array.length; i++)
{
result_br_broker_upgrade[i] = result.br_broker_upgrade_response_array[i].br_broker_upgrade[0];
}
return result_br_broker_upgrade;
} | [
"protected",
"base_resource",
"[",
"]",
"get_nitro_bulk_response",
"(",
"nitro_service",
"service",
",",
"String",
"response",
")",
"throws",
"Exception",
"{",
"br_broker_upgrade_responses",
"result",
"=",
"(",
"br_broker_upgrade_responses",
")",
"service",
".",
"get_pa... | <pre>
Converts API response of bulk operation into object and returns the object array in case of get request.
</pre> | [
"<pre",
">",
"Converts",
"API",
"response",
"of",
"bulk",
"operation",
"into",
"object",
"and",
"returns",
"the",
"object",
"array",
"in",
"case",
"of",
"get",
"request",
".",
"<",
"/",
"pre",
">"
] | train | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/br_broker/br_broker_upgrade.java#L157-L174 |
PawelAdamski/HttpClientMock | src/main/java/com/github/paweladamski/httpclientmock/HttpClientResponseBuilder.java | HttpClientResponseBuilder.doReturn | public HttpClientResponseBuilder doReturn(int statusCode, String response) {
return doReturn(statusCode, response, Charset.forName("UTF-8"));
} | java | public HttpClientResponseBuilder doReturn(int statusCode, String response) {
return doReturn(statusCode, response, Charset.forName("UTF-8"));
} | [
"public",
"HttpClientResponseBuilder",
"doReturn",
"(",
"int",
"statusCode",
",",
"String",
"response",
")",
"{",
"return",
"doReturn",
"(",
"statusCode",
",",
"response",
",",
"Charset",
".",
"forName",
"(",
"\"UTF-8\"",
")",
")",
";",
"}"
] | Adds action which returns provided response in UTF-8 with status code.
@param statusCode status to return
@param response response to return
@return response builder | [
"Adds",
"action",
"which",
"returns",
"provided",
"response",
"in",
"UTF",
"-",
"8",
"with",
"status",
"code",
"."
] | train | https://github.com/PawelAdamski/HttpClientMock/blob/0205498434bbc0c78c187a51181cac9b266a28fb/src/main/java/com/github/paweladamski/httpclientmock/HttpClientResponseBuilder.java#L89-L91 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/CompHandshakeImpl.java | CompHandshakeImpl.compData | public boolean compData(CommsConnection conn, int version, byte[] data) {
try {
SchemaManager.receiveSchemas(conn, data);
return true;
} catch (Exception ex) {
FFDCFilter.processException(ex, "compData", "82", this);
return false;
}
} | java | public boolean compData(CommsConnection conn, int version, byte[] data) {
try {
SchemaManager.receiveSchemas(conn, data);
return true;
} catch (Exception ex) {
FFDCFilter.processException(ex, "compData", "82", this);
return false;
}
} | [
"public",
"boolean",
"compData",
"(",
"CommsConnection",
"conn",
",",
"int",
"version",
",",
"byte",
"[",
"]",
"data",
")",
"{",
"try",
"{",
"SchemaManager",
".",
"receiveSchemas",
"(",
"conn",
",",
"data",
")",
";",
"return",
"true",
";",
"}",
"catch",
... | /*
This method will be invoked when data is received on a connection from a
corresponding 'CommsConnection.sendMFPSchema()' method.
We use this to transfer lists of schema definitions. | [
"/",
"*",
"This",
"method",
"will",
"be",
"invoked",
"when",
"data",
"is",
"received",
"on",
"a",
"connection",
"from",
"a",
"corresponding",
"CommsConnection",
".",
"sendMFPSchema",
"()",
"method",
".",
"We",
"use",
"this",
"to",
"transfer",
"lists",
"of",
... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/CompHandshakeImpl.java#L58-L66 |
phax/ph-oton | ph-oton-app/src/main/java/com/helger/photon/app/url/LinkHelper.java | LinkHelper.getStreamURL | @Nonnull
public static SimpleURL getStreamURL (@Nonnull final IRequestWebScopeWithoutResponse aRequestScope,
@Nonnull @Nonempty final String sURL)
{
ValueEnforcer.notNull (aRequestScope, "RequestScope");
ValueEnforcer.notEmpty (sURL, "URL");
// If the URL is absolute, use it
if (hasKnownProtocol (sURL))
return new SimpleURL (sURL);
final StringBuilder aPrefix = new StringBuilder (getStreamServletPath ());
if (!StringHelper.startsWith (sURL, '/'))
aPrefix.append ('/');
return getURLWithContext (aRequestScope, aPrefix.append (sURL).toString ());
} | java | @Nonnull
public static SimpleURL getStreamURL (@Nonnull final IRequestWebScopeWithoutResponse aRequestScope,
@Nonnull @Nonempty final String sURL)
{
ValueEnforcer.notNull (aRequestScope, "RequestScope");
ValueEnforcer.notEmpty (sURL, "URL");
// If the URL is absolute, use it
if (hasKnownProtocol (sURL))
return new SimpleURL (sURL);
final StringBuilder aPrefix = new StringBuilder (getStreamServletPath ());
if (!StringHelper.startsWith (sURL, '/'))
aPrefix.append ('/');
return getURLWithContext (aRequestScope, aPrefix.append (sURL).toString ());
} | [
"@",
"Nonnull",
"public",
"static",
"SimpleURL",
"getStreamURL",
"(",
"@",
"Nonnull",
"final",
"IRequestWebScopeWithoutResponse",
"aRequestScope",
",",
"@",
"Nonnull",
"@",
"Nonempty",
"final",
"String",
"sURL",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"aRe... | Get the default URL to stream the passed URL. It is assumed that the
servlet is located under the path "/stream". Because of the logic of the
stream servlet, no parameter are assumed.
@param aRequestScope
The request web scope to be used. Required for cookie-less handling.
May not be <code>null</code>.
@param sURL
The URL to be streamed. If it does not start with a slash ("/") one
is prepended automatically. If the URL already has a protocol, it is
returned unchanged. May neither be <code>null</code> nor empty.
@return The URL incl. the context to be stream. E.g.
<code>/<i>webapp-context</i>/stream/<i>URL</i></code>. | [
"Get",
"the",
"default",
"URL",
"to",
"stream",
"the",
"passed",
"URL",
".",
"It",
"is",
"assumed",
"that",
"the",
"servlet",
"is",
"located",
"under",
"the",
"path",
"/",
"stream",
".",
"Because",
"of",
"the",
"logic",
"of",
"the",
"stream",
"servlet",
... | train | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-app/src/main/java/com/helger/photon/app/url/LinkHelper.java#L339-L354 |
nohana/Amalgam | amalgam/src/main/java/com/amalgam/graphics/BitmapUtils.java | BitmapUtils.getSize | public static Point getSize(ContentResolver resolver, Uri uri) {
InputStream is = null;
try {
BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
is = resolver.openInputStream(uri);
BitmapFactory.decodeStream(is, null, options);
int width = options.outWidth;
int height = options.outHeight;
return new Point(width, height);
} catch (FileNotFoundException e) {
Log.e(TAG, "target file (" + uri + ") does not exist.", e);
return null;
} finally {
CloseableUtils.close(is);
}
} | java | public static Point getSize(ContentResolver resolver, Uri uri) {
InputStream is = null;
try {
BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
is = resolver.openInputStream(uri);
BitmapFactory.decodeStream(is, null, options);
int width = options.outWidth;
int height = options.outHeight;
return new Point(width, height);
} catch (FileNotFoundException e) {
Log.e(TAG, "target file (" + uri + ") does not exist.", e);
return null;
} finally {
CloseableUtils.close(is);
}
} | [
"public",
"static",
"Point",
"getSize",
"(",
"ContentResolver",
"resolver",
",",
"Uri",
"uri",
")",
"{",
"InputStream",
"is",
"=",
"null",
";",
"try",
"{",
"BitmapFactory",
".",
"Options",
"options",
"=",
"new",
"BitmapFactory",
".",
"Options",
"(",
")",
"... | Get width and height of the bitmap specified with the {@link android.net.Uri}.
@param resolver the resolver.
@param uri the uri that points to the bitmap.
@return the size. | [
"Get",
"width",
"and",
"height",
"of",
"the",
"bitmap",
"specified",
"with",
"the",
"{"
] | train | https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/graphics/BitmapUtils.java#L71-L87 |
MutabilityDetector/MutabilityDetector | src/main/java/org/mutabilitydetector/checkers/settermethod/AssignmentGuardFinder.java | AssignmentGuardFinder.newInstance | public static AssignmentGuardFinder newInstance(final String candidateName,
final ControlFlowBlock controlFlowBlock) {
checkArgument(!candidateName.isEmpty());
return new AssignmentGuardFinder(candidateName, checkNotNull(controlFlowBlock));
} | java | public static AssignmentGuardFinder newInstance(final String candidateName,
final ControlFlowBlock controlFlowBlock) {
checkArgument(!candidateName.isEmpty());
return new AssignmentGuardFinder(candidateName, checkNotNull(controlFlowBlock));
} | [
"public",
"static",
"AssignmentGuardFinder",
"newInstance",
"(",
"final",
"String",
"candidateName",
",",
"final",
"ControlFlowBlock",
"controlFlowBlock",
")",
"{",
"checkArgument",
"(",
"!",
"candidateName",
".",
"isEmpty",
"(",
")",
")",
";",
"return",
"new",
"A... | Creates a new instance of this class. None of the arguments must be
{@code null}.
@param candidateName
name of the lazy variable. Must not be empty!
@param controlFlowBlock
the control flow block which is supposed to contain an
{@link AssignmentGuard}.
@return a new instance of this class. | [
"Creates",
"a",
"new",
"instance",
"of",
"this",
"class",
".",
"None",
"of",
"the",
"arguments",
"must",
"be",
"{",
"@code",
"null",
"}",
"."
] | train | https://github.com/MutabilityDetector/MutabilityDetector/blob/36014d2f9e45cf0cc6d67b81395942cd39c4f6ae/src/main/java/org/mutabilitydetector/checkers/settermethod/AssignmentGuardFinder.java#L72-L76 |
SUSE/salt-netapi-client | src/main/java/com/suse/salt/netapi/parser/XorTypeAdapterFactory.java | XorTypeAdapterFactory.errorAdapter | private <R> TypeAdapter<Xor<SaltError, R>> errorAdapter(TypeAdapter<R> innerAdapter) {
return new TypeAdapter<Xor<SaltError, R>>() {
@Override
public Xor<SaltError, R> read(JsonReader in) throws IOException {
JsonElement json = TypeAdapters.JSON_ELEMENT.read(in);
try {
R value = innerAdapter.fromJsonTree(json);
return Xor.right(value);
} catch (Throwable e) {
Optional<SaltError> saltError =
extractErrorString(json).flatMap(SaltErrorUtils::deriveError);
return Xor.left(saltError.orElse(new JsonParsingError(json, e)));
}
}
private Optional<String> extractErrorString(JsonElement json) {
if (json.isJsonPrimitive() && json.getAsJsonPrimitive().isString()) {
return Optional.of(json.getAsJsonPrimitive().getAsString());
}
return Optional.empty();
}
@Override
public void write(JsonWriter out, Xor<SaltError, R> xor) throws IOException {
throw new JsonParseException("Writing Xor is not supported");
}
};
} | java | private <R> TypeAdapter<Xor<SaltError, R>> errorAdapter(TypeAdapter<R> innerAdapter) {
return new TypeAdapter<Xor<SaltError, R>>() {
@Override
public Xor<SaltError, R> read(JsonReader in) throws IOException {
JsonElement json = TypeAdapters.JSON_ELEMENT.read(in);
try {
R value = innerAdapter.fromJsonTree(json);
return Xor.right(value);
} catch (Throwable e) {
Optional<SaltError> saltError =
extractErrorString(json).flatMap(SaltErrorUtils::deriveError);
return Xor.left(saltError.orElse(new JsonParsingError(json, e)));
}
}
private Optional<String> extractErrorString(JsonElement json) {
if (json.isJsonPrimitive() && json.getAsJsonPrimitive().isString()) {
return Optional.of(json.getAsJsonPrimitive().getAsString());
}
return Optional.empty();
}
@Override
public void write(JsonWriter out, Xor<SaltError, R> xor) throws IOException {
throw new JsonParseException("Writing Xor is not supported");
}
};
} | [
"private",
"<",
"R",
">",
"TypeAdapter",
"<",
"Xor",
"<",
"SaltError",
",",
"R",
">",
">",
"errorAdapter",
"(",
"TypeAdapter",
"<",
"R",
">",
"innerAdapter",
")",
"{",
"return",
"new",
"TypeAdapter",
"<",
"Xor",
"<",
"SaltError",
",",
"R",
">",
">",
... | Creates a Xor adapter specifically for the case in which the left side is a
SaltError. This is used to catch any Salt-side or JSON parsing errors.
@param <R> the generic type for the right side of the Xor
@param innerAdapter the inner adapter
@return the Xor type adapter | [
"Creates",
"a",
"Xor",
"adapter",
"specifically",
"for",
"the",
"case",
"in",
"which",
"the",
"left",
"side",
"is",
"a",
"SaltError",
".",
"This",
"is",
"used",
"to",
"catch",
"any",
"Salt",
"-",
"side",
"or",
"JSON",
"parsing",
"errors",
"."
] | train | https://github.com/SUSE/salt-netapi-client/blob/a0bdf643c8e34fa4def4b915366594c1491fdad5/src/main/java/com/suse/salt/netapi/parser/XorTypeAdapterFactory.java#L100-L127 |
biouno/figshare-java-api | src/main/java/org/biouno/figshare/FigShareClient.java | FigShareClient.createArticle | public Article createArticle(final String title, final String description, final String definedType) {
HttpClient httpClient = null;
try {
final String method = "my_data/articles";
// create an HTTP request to a protected resource
final String url = getURL(endpoint, version, method);
// create an HTTP request to a protected resource
final HttpPost request = new HttpPost(url);
Gson gson = new Gson();
JsonObject payload = new JsonObject();
payload.addProperty("title", title);
payload.addProperty("description", description);
payload.addProperty("defined_type", definedType);
String jsonRequest = gson.toJson(payload);
StringEntity entity = new StringEntity(jsonRequest);
entity.setContentType(JSON_CONTENT_TYPE);
request.setEntity(entity);
// sign the request
consumer.sign(request);
// send the request
httpClient = HttpClientBuilder.create().build();
HttpResponse response = httpClient.execute(request);
HttpEntity responseEntity = response.getEntity();
String json = EntityUtils.toString(responseEntity);
Article article = readArticleFromJson(json);
return article;
} catch (OAuthCommunicationException e) {
throw new FigShareClientException("Failed to get articles: " + e.getMessage(), e);
} catch (OAuthMessageSignerException e) {
throw new FigShareClientException("Failed to get articles: " + e.getMessage(), e);
} catch (OAuthExpectationFailedException e) {
throw new FigShareClientException("Failed to get articles: " + e.getMessage(), e);
} catch (ClientProtocolException e) {
throw new FigShareClientException("Failed to get articles: " + e.getMessage(), e);
} catch (IOException e) {
throw new FigShareClientException("Failed to get articles: " + e.getMessage(), e);
}
} | java | public Article createArticle(final String title, final String description, final String definedType) {
HttpClient httpClient = null;
try {
final String method = "my_data/articles";
// create an HTTP request to a protected resource
final String url = getURL(endpoint, version, method);
// create an HTTP request to a protected resource
final HttpPost request = new HttpPost(url);
Gson gson = new Gson();
JsonObject payload = new JsonObject();
payload.addProperty("title", title);
payload.addProperty("description", description);
payload.addProperty("defined_type", definedType);
String jsonRequest = gson.toJson(payload);
StringEntity entity = new StringEntity(jsonRequest);
entity.setContentType(JSON_CONTENT_TYPE);
request.setEntity(entity);
// sign the request
consumer.sign(request);
// send the request
httpClient = HttpClientBuilder.create().build();
HttpResponse response = httpClient.execute(request);
HttpEntity responseEntity = response.getEntity();
String json = EntityUtils.toString(responseEntity);
Article article = readArticleFromJson(json);
return article;
} catch (OAuthCommunicationException e) {
throw new FigShareClientException("Failed to get articles: " + e.getMessage(), e);
} catch (OAuthMessageSignerException e) {
throw new FigShareClientException("Failed to get articles: " + e.getMessage(), e);
} catch (OAuthExpectationFailedException e) {
throw new FigShareClientException("Failed to get articles: " + e.getMessage(), e);
} catch (ClientProtocolException e) {
throw new FigShareClientException("Failed to get articles: " + e.getMessage(), e);
} catch (IOException e) {
throw new FigShareClientException("Failed to get articles: " + e.getMessage(), e);
}
} | [
"public",
"Article",
"createArticle",
"(",
"final",
"String",
"title",
",",
"final",
"String",
"description",
",",
"final",
"String",
"definedType",
")",
"{",
"HttpClient",
"httpClient",
"=",
"null",
";",
"try",
"{",
"final",
"String",
"method",
"=",
"\"my_dat... | Create an article.
@param title title
@param description description
@param definedType defined type (e.g. dataset)
@return an {@link Article} | [
"Create",
"an",
"article",
"."
] | train | https://github.com/biouno/figshare-java-api/blob/6d447764efe8fa4329d15e339a8601351aade93c/src/main/java/org/biouno/figshare/FigShareClient.java#L226-L265 |
michael-rapp/AndroidMaterialValidation | library/src/main/java/de/mrapp/android/validation/Validators.java | Validators.noWhitespace | public static Validator<CharSequence> noWhitespace(@NonNull final Context context) {
return new NoWhitespaceValidator(context, R.string.default_error_message);
} | java | public static Validator<CharSequence> noWhitespace(@NonNull final Context context) {
return new NoWhitespaceValidator(context, R.string.default_error_message);
} | [
"public",
"static",
"Validator",
"<",
"CharSequence",
">",
"noWhitespace",
"(",
"@",
"NonNull",
"final",
"Context",
"context",
")",
"{",
"return",
"new",
"NoWhitespaceValidator",
"(",
"context",
",",
"R",
".",
"string",
".",
"default_error_message",
")",
";",
... | Creates and returns a validator, which allows to validate texts to ensure, that they contain
no whitespace. Empty texts are also accepted.
@param context
The context, which should be used to retrieve the error message, as an instance of
the class {@link Context}. The context may not be null
@return The validator, which has been created, as an instance of the type {@link Validator} | [
"Creates",
"and",
"returns",
"a",
"validator",
"which",
"allows",
"to",
"validate",
"texts",
"to",
"ensure",
"that",
"they",
"contain",
"no",
"whitespace",
".",
"Empty",
"texts",
"are",
"also",
"accepted",
"."
] | train | https://github.com/michael-rapp/AndroidMaterialValidation/blob/ac8693baeac7abddf2e38a47da4c1849d4661a8b/library/src/main/java/de/mrapp/android/validation/Validators.java#L545-L547 |
rjeschke/txtmark | src/main/java/com/github/rjeschke/txtmark/Utils.java | Utils.getXMLTag | public final static void getXMLTag(final StringBuilder out, final StringBuilder in)
{
int pos = 1;
if (in.charAt(1) == '/')
{
pos++;
}
while (Character.isLetterOrDigit(in.charAt(pos)))
{
out.append(in.charAt(pos++));
}
} | java | public final static void getXMLTag(final StringBuilder out, final StringBuilder in)
{
int pos = 1;
if (in.charAt(1) == '/')
{
pos++;
}
while (Character.isLetterOrDigit(in.charAt(pos)))
{
out.append(in.charAt(pos++));
}
} | [
"public",
"final",
"static",
"void",
"getXMLTag",
"(",
"final",
"StringBuilder",
"out",
",",
"final",
"StringBuilder",
"in",
")",
"{",
"int",
"pos",
"=",
"1",
";",
"if",
"(",
"in",
".",
"charAt",
"(",
"1",
")",
"==",
"'",
"'",
")",
"{",
"pos",
"++"... | Extracts the tag from an XML element.
@param out
The StringBuilder to write to.
@param in
Input StringBuilder. | [
"Extracts",
"the",
"tag",
"from",
"an",
"XML",
"element",
"."
] | train | https://github.com/rjeschke/txtmark/blob/108cee6b209a362843729c032c2d982625d12d98/src/main/java/com/github/rjeschke/txtmark/Utils.java#L605-L616 |
jOOQ/jOOL | jOOL-java-8/src/main/java/org/jooq/lambda/Unchecked.java | Unchecked.intUnaryOperator | public static IntUnaryOperator intUnaryOperator(CheckedIntUnaryOperator operator, Consumer<Throwable> handler) {
return t -> {
try {
return operator.applyAsInt(t);
}
catch (Throwable e) {
handler.accept(e);
throw new IllegalStateException("Exception handler must throw a RuntimeException", e);
}
};
} | java | public static IntUnaryOperator intUnaryOperator(CheckedIntUnaryOperator operator, Consumer<Throwable> handler) {
return t -> {
try {
return operator.applyAsInt(t);
}
catch (Throwable e) {
handler.accept(e);
throw new IllegalStateException("Exception handler must throw a RuntimeException", e);
}
};
} | [
"public",
"static",
"IntUnaryOperator",
"intUnaryOperator",
"(",
"CheckedIntUnaryOperator",
"operator",
",",
"Consumer",
"<",
"Throwable",
">",
"handler",
")",
"{",
"return",
"t",
"->",
"{",
"try",
"{",
"return",
"operator",
".",
"applyAsInt",
"(",
"t",
")",
"... | Wrap a {@link CheckedIntUnaryOperator} in a {@link IntUnaryOperator} with a custom handler for checked exceptions.
<p>
Example:
<code><pre>
IntStream.of(1, 2, 3).map(Unchecked.intUnaryOperator(
i -> {
if (i < 0)
throw new Exception("Only positive numbers allowed");
return i;
},
e -> {
throw new IllegalStateException(e);
}
));
</pre></code> | [
"Wrap",
"a",
"{",
"@link",
"CheckedIntUnaryOperator",
"}",
"in",
"a",
"{",
"@link",
"IntUnaryOperator",
"}",
"with",
"a",
"custom",
"handler",
"for",
"checked",
"exceptions",
".",
"<p",
">",
"Example",
":",
"<code",
">",
"<pre",
">",
"IntStream",
".",
"of"... | train | https://github.com/jOOQ/jOOL/blob/889d87c85ca57bafd4eddd78e0f7ae2804d2ee86/jOOL-java-8/src/main/java/org/jooq/lambda/Unchecked.java#L1956-L1967 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-kms/src/main/java/com/google/cloud/kms/v1/KeyManagementServiceClient.java | KeyManagementServiceClient.updateCryptoKeyPrimaryVersion | public final CryptoKey updateCryptoKeyPrimaryVersion(String name, String cryptoKeyVersionId) {
UpdateCryptoKeyPrimaryVersionRequest request =
UpdateCryptoKeyPrimaryVersionRequest.newBuilder()
.setName(name)
.setCryptoKeyVersionId(cryptoKeyVersionId)
.build();
return updateCryptoKeyPrimaryVersion(request);
} | java | public final CryptoKey updateCryptoKeyPrimaryVersion(String name, String cryptoKeyVersionId) {
UpdateCryptoKeyPrimaryVersionRequest request =
UpdateCryptoKeyPrimaryVersionRequest.newBuilder()
.setName(name)
.setCryptoKeyVersionId(cryptoKeyVersionId)
.build();
return updateCryptoKeyPrimaryVersion(request);
} | [
"public",
"final",
"CryptoKey",
"updateCryptoKeyPrimaryVersion",
"(",
"String",
"name",
",",
"String",
"cryptoKeyVersionId",
")",
"{",
"UpdateCryptoKeyPrimaryVersionRequest",
"request",
"=",
"UpdateCryptoKeyPrimaryVersionRequest",
".",
"newBuilder",
"(",
")",
".",
"setName"... | Update the version of a [CryptoKey][google.cloud.kms.v1.CryptoKey] that will be used in
[Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt].
<p>Returns an error if called on an asymmetric key.
<p>Sample code:
<pre><code>
try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
CryptoKeyName name = CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]");
String cryptoKeyVersionId = "";
CryptoKey response = keyManagementServiceClient.updateCryptoKeyPrimaryVersion(name.toString(), cryptoKeyVersionId);
}
</code></pre>
@param name The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to update.
@param cryptoKeyVersionId The id of the child
[CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use as primary.
@throws com.google.api.gax.rpc.ApiException if the remote call fails | [
"Update",
"the",
"version",
"of",
"a",
"[",
"CryptoKey",
"]",
"[",
"google",
".",
"cloud",
".",
"kms",
".",
"v1",
".",
"CryptoKey",
"]",
"that",
"will",
"be",
"used",
"in",
"[",
"Encrypt",
"]",
"[",
"google",
".",
"cloud",
".",
"kms",
".",
"v1",
... | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-kms/src/main/java/com/google/cloud/kms/v1/KeyManagementServiceClient.java#L1792-L1800 |
JOML-CI/JOML | src/org/joml/Matrix3x2d.java | Matrix3x2d.scaleAroundLocal | public Matrix3x2d scaleAroundLocal(double sx, double sy, double sz, double ox, double oy, double oz) {
return scaleAroundLocal(sx, sy, ox, oy, this);
} | java | public Matrix3x2d scaleAroundLocal(double sx, double sy, double sz, double ox, double oy, double oz) {
return scaleAroundLocal(sx, sy, ox, oy, this);
} | [
"public",
"Matrix3x2d",
"scaleAroundLocal",
"(",
"double",
"sx",
",",
"double",
"sy",
",",
"double",
"sz",
",",
"double",
"ox",
",",
"double",
"oy",
",",
"double",
"oz",
")",
"{",
"return",
"scaleAroundLocal",
"(",
"sx",
",",
"sy",
",",
"ox",
",",
"oy"... | Pre-multiply scaling to this matrix by scaling the base axes by the given sx and
sy factors while using <code>(ox, oy)</code> as the scaling origin.
<p>
If <code>M</code> is <code>this</code> matrix and <code>S</code> the scaling matrix,
then the new matrix will be <code>S * M</code>. So when transforming a
vector <code>v</code> with the new matrix by using <code>S * M * v</code>, the
scaling will be applied last!
<p>
This method is equivalent to calling: <code>new Matrix3x2d().translate(ox, oy).scale(sx, sy).translate(-ox, -oy).mul(this, this)</code>
@param sx
the scaling factor of the x component
@param sy
the scaling factor of the y component
@param sz
the scaling factor of the z component
@param ox
the x coordinate of the scaling origin
@param oy
the y coordinate of the scaling origin
@param oz
the z coordinate of the scaling origin
@return this | [
"Pre",
"-",
"multiply",
"scaling",
"to",
"this",
"matrix",
"by",
"scaling",
"the",
"base",
"axes",
"by",
"the",
"given",
"sx",
"and",
"sy",
"factors",
"while",
"using",
"<code",
">",
"(",
"ox",
"oy",
")",
"<",
"/",
"code",
">",
"as",
"the",
"scaling"... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix3x2d.java#L1562-L1564 |
BranchMetrics/android-branch-deep-linking | Branch-SDK/src/io/branch/indexing/BranchUniversalObject.java | BranchUniversalObject.registerView | public void registerView(@Nullable RegisterViewStatusListener callback) {
if (Branch.getInstance() != null) {
Branch.getInstance().registerView(this, callback);
} else {
if (callback != null) {
callback.onRegisterViewFinished(false, new BranchError("Register view error", BranchError.ERR_BRANCH_NOT_INSTANTIATED));
}
}
} | java | public void registerView(@Nullable RegisterViewStatusListener callback) {
if (Branch.getInstance() != null) {
Branch.getInstance().registerView(this, callback);
} else {
if (callback != null) {
callback.onRegisterViewFinished(false, new BranchError("Register view error", BranchError.ERR_BRANCH_NOT_INSTANTIATED));
}
}
} | [
"public",
"void",
"registerView",
"(",
"@",
"Nullable",
"RegisterViewStatusListener",
"callback",
")",
"{",
"if",
"(",
"Branch",
".",
"getInstance",
"(",
")",
"!=",
"null",
")",
"{",
"Branch",
".",
"getInstance",
"(",
")",
".",
"registerView",
"(",
"this",
... | Mark the content referred by this object as viewed. This increment the view count of the contents referred by this object.
@param callback An instance of {@link RegisterViewStatusListener} to listen to results of the operation | [
"Mark",
"the",
"content",
"referred",
"by",
"this",
"object",
"as",
"viewed",
".",
"This",
"increment",
"the",
"view",
"count",
"of",
"the",
"contents",
"referred",
"by",
"this",
"object",
"."
] | train | https://github.com/BranchMetrics/android-branch-deep-linking/blob/e3bee2ccfcbf6d4bf1a5815b5b86666e4ff8f848/Branch-SDK/src/io/branch/indexing/BranchUniversalObject.java#L560-L568 |
mgormley/pacaya | src/main/java/edu/jhu/pacaya/gm/maxent/LogLinearXYData.java | LogLinearXYData.addEx | public void addEx(double weight, int x, int y, FeatureVector[] fvs) {
if (numYs == -1) {
numYs = fvs.length;
}
if (yAlphabet.size() > numYs) {
throw new IllegalStateException("Y alphabet has grown larger than the number of Ys");
}
if (y >= numYs) {
throw new IllegalArgumentException("Invalid y: " + y);
} else if (fvs.length != numYs) {
throw new IllegalArgumentException("Features must be given for all labels y");
}
LogLinearExample ex = new LogLinearExample(weight, x, y, fvs);
exList.add(ex);
} | java | public void addEx(double weight, int x, int y, FeatureVector[] fvs) {
if (numYs == -1) {
numYs = fvs.length;
}
if (yAlphabet.size() > numYs) {
throw new IllegalStateException("Y alphabet has grown larger than the number of Ys");
}
if (y >= numYs) {
throw new IllegalArgumentException("Invalid y: " + y);
} else if (fvs.length != numYs) {
throw new IllegalArgumentException("Features must be given for all labels y");
}
LogLinearExample ex = new LogLinearExample(weight, x, y, fvs);
exList.add(ex);
} | [
"public",
"void",
"addEx",
"(",
"double",
"weight",
",",
"int",
"x",
",",
"int",
"y",
",",
"FeatureVector",
"[",
"]",
"fvs",
")",
"{",
"if",
"(",
"numYs",
"==",
"-",
"1",
")",
"{",
"numYs",
"=",
"fvs",
".",
"length",
";",
"}",
"if",
"(",
"yAlph... | Adds a new log-linear model instance.
@param weight The weight of this example.
@param x The observation, x.
@param y The prediction, y.
@param fvs The binary features on the observations, x, for all possible labels, y'. Indexed by y'. | [
"Adds",
"a",
"new",
"log",
"-",
"linear",
"model",
"instance",
"."
] | train | https://github.com/mgormley/pacaya/blob/786294cbac7cc65dbc32210c10acc32ed0c69233/src/main/java/edu/jhu/pacaya/gm/maxent/LogLinearXYData.java#L88-L102 |
Impetus/Kundera | src/kundera-elastic-search/src/main/java/com/impetus/client/es/utils/ESResponseWrapper.java | ESResponseWrapper.validateBucket | private boolean validateBucket(String left, String right, String operator)
{
Double leftValue = Double.valueOf(left);
Double rightValue = Double.valueOf(right);
logger.debug("Comparison expression " + operator + "found with left value: " + left + " right value: " + right);
if (Expression.GREATER_THAN.equals(operator))
{
return leftValue > rightValue;
}
else if (Expression.GREATER_THAN_OR_EQUAL.equals(operator))
{
return leftValue >= rightValue;
}
else if (Expression.LOWER_THAN.equals(operator))
{
return leftValue < rightValue;
}
else if (Expression.LOWER_THAN_OR_EQUAL.equals(operator))
{
return leftValue <= rightValue;
}
else if (Expression.EQUAL.equals(operator))
{
return leftValue == rightValue;
}
else
{
logger.error(operator + " in having clause is not supported in Kundera");
throw new UnsupportedOperationException(operator + " in having clause is not supported in Kundera");
}
} | java | private boolean validateBucket(String left, String right, String operator)
{
Double leftValue = Double.valueOf(left);
Double rightValue = Double.valueOf(right);
logger.debug("Comparison expression " + operator + "found with left value: " + left + " right value: " + right);
if (Expression.GREATER_THAN.equals(operator))
{
return leftValue > rightValue;
}
else if (Expression.GREATER_THAN_OR_EQUAL.equals(operator))
{
return leftValue >= rightValue;
}
else if (Expression.LOWER_THAN.equals(operator))
{
return leftValue < rightValue;
}
else if (Expression.LOWER_THAN_OR_EQUAL.equals(operator))
{
return leftValue <= rightValue;
}
else if (Expression.EQUAL.equals(operator))
{
return leftValue == rightValue;
}
else
{
logger.error(operator + " in having clause is not supported in Kundera");
throw new UnsupportedOperationException(operator + " in having clause is not supported in Kundera");
}
} | [
"private",
"boolean",
"validateBucket",
"(",
"String",
"left",
",",
"String",
"right",
",",
"String",
"operator",
")",
"{",
"Double",
"leftValue",
"=",
"Double",
".",
"valueOf",
"(",
"left",
")",
";",
"Double",
"rightValue",
"=",
"Double",
".",
"valueOf",
... | Validate bucket.
@param left
the left
@param right
the right
@param operator
the operator
@return true, if successful | [
"Validate",
"bucket",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-elastic-search/src/main/java/com/impetus/client/es/utils/ESResponseWrapper.java#L475-L507 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.