repository_name stringlengths 7 58 | func_path_in_repository stringlengths 11 204 | func_name stringlengths 5 103 | whole_func_string stringlengths 87 3.44k | language stringclasses 1
value | func_code_string stringlengths 87 3.44k | func_code_tokens listlengths 21 714 | func_documentation_string stringlengths 61 1.95k | func_documentation_tokens listlengths 1 482 | split_name stringclasses 1
value | func_code_url stringlengths 102 309 |
|---|---|---|---|---|---|---|---|---|---|---|
jOOQ/jOOL | jOOL-java-8/src/main/java/org/jooq/lambda/Unchecked.java | Unchecked.biPredicate | public static <T, U> BiPredicate<T, U> biPredicate(CheckedBiPredicate<T, U> predicate) {
return biPredicate(predicate, THROWABLE_TO_RUNTIME_EXCEPTION);
} | java | public static <T, U> BiPredicate<T, U> biPredicate(CheckedBiPredicate<T, U> predicate) {
return biPredicate(predicate, THROWABLE_TO_RUNTIME_EXCEPTION);
} | [
"public",
"static",
"<",
"T",
",",
"U",
">",
"BiPredicate",
"<",
"T",
",",
"U",
">",
"biPredicate",
"(",
"CheckedBiPredicate",
"<",
"T",
",",
"U",
">",
"predicate",
")",
"{",
"return",
"biPredicate",
"(",
"predicate",
",",
"THROWABLE_TO_RUNTIME_EXCEPTION",
... | Wrap a {@link org.jooq.lambda.fi.util.function.CheckedBiPredicate} in a {@link BiPredicate}. | [
"Wrap",
"a",
"{"
] | train | https://github.com/jOOQ/jOOL/blob/889d87c85ca57bafd4eddd78e0f7ae2804d2ee86/jOOL-java-8/src/main/java/org/jooq/lambda/Unchecked.java#L440-L442 |
WASdev/tool.accelerate.core | liberty-starter-application/src/main/java/com/ibm/liberty/starter/build/maven/DomUtil.java | DomUtil.addChildNode | public static Node addChildNode(Document doc, Node parentNode, String childName, String childValue){
if(doc == null || parentNode == null || childName == null){
return null;
}
Node childNode = doc.createElement(childName);
if(childValue != null){
childNode.setTextContent(childValue);
}
parentNode.appendChild(childNode);
return childNode;
} | java | public static Node addChildNode(Document doc, Node parentNode, String childName, String childValue){
if(doc == null || parentNode == null || childName == null){
return null;
}
Node childNode = doc.createElement(childName);
if(childValue != null){
childNode.setTextContent(childValue);
}
parentNode.appendChild(childNode);
return childNode;
} | [
"public",
"static",
"Node",
"addChildNode",
"(",
"Document",
"doc",
",",
"Node",
"parentNode",
",",
"String",
"childName",
",",
"String",
"childValue",
")",
"{",
"if",
"(",
"doc",
"==",
"null",
"||",
"parentNode",
"==",
"null",
"||",
"childName",
"==",
"nu... | Add a child node
@param parentNode - the parent node
@param childName - name of child node to create
@param childValue - value of child node
@return the child node | [
"Add",
"a",
"child",
"node"
] | train | https://github.com/WASdev/tool.accelerate.core/blob/6511da654a69a25a76573eb76eefff349d9c4d80/liberty-starter-application/src/main/java/com/ibm/liberty/starter/build/maven/DomUtil.java#L107-L117 |
lecousin/java-framework-core | net.lecousin.core/src/main/java/net/lecousin/framework/application/LCCore.java | LCCore.keepMainThread | public static void keepMainThread(Runnable toContinue) {
mainThread = Thread.currentThread();
Thread thread = new Thread(toContinue, "LC Core - Main");
thread.start();
mainThreadLoop();
} | java | public static void keepMainThread(Runnable toContinue) {
mainThread = Thread.currentThread();
Thread thread = new Thread(toContinue, "LC Core - Main");
thread.start();
mainThreadLoop();
} | [
"public",
"static",
"void",
"keepMainThread",
"(",
"Runnable",
"toContinue",
")",
"{",
"mainThread",
"=",
"Thread",
".",
"currentThread",
"(",
")",
";",
"Thread",
"thread",
"=",
"new",
"Thread",
"(",
"toContinue",
",",
"\"LC Core - Main\"",
")",
";",
"thread",... | Because some systems may need to use the main thread for specific action (like Cocoa),
we keep the current thread aside, and continue on a new thread.
@param toContinue the Runnable to run on a new Thread to continue the application startup | [
"Because",
"some",
"systems",
"may",
"need",
"to",
"use",
"the",
"main",
"thread",
"for",
"specific",
"action",
"(",
"like",
"Cocoa",
")",
"we",
"keep",
"the",
"current",
"thread",
"aside",
"and",
"continue",
"on",
"a",
"new",
"thread",
"."
] | train | https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/application/LCCore.java#L169-L174 |
google/closure-compiler | src/com/google/javascript/refactoring/ErrorToFixMapper.java | ErrorToFixMapper.getFixForEarlyReference | private static SuggestedFix getFixForEarlyReference(JSError error, AbstractCompiler compiler) {
Matcher m = EARLY_REF.matcher(error.description);
if (m.matches()) {
String name = m.group(1);
Node stmt = NodeUtil.getEnclosingStatement(error.node);
return new SuggestedFix.Builder()
.attachMatchedNodeInfo(error.node, compiler)
.insertBefore(stmt, "var " + name + ";\n")
.build();
}
return null;
} | java | private static SuggestedFix getFixForEarlyReference(JSError error, AbstractCompiler compiler) {
Matcher m = EARLY_REF.matcher(error.description);
if (m.matches()) {
String name = m.group(1);
Node stmt = NodeUtil.getEnclosingStatement(error.node);
return new SuggestedFix.Builder()
.attachMatchedNodeInfo(error.node, compiler)
.insertBefore(stmt, "var " + name + ";\n")
.build();
}
return null;
} | [
"private",
"static",
"SuggestedFix",
"getFixForEarlyReference",
"(",
"JSError",
"error",
",",
"AbstractCompiler",
"compiler",
")",
"{",
"Matcher",
"m",
"=",
"EARLY_REF",
".",
"matcher",
"(",
"error",
".",
"description",
")",
";",
"if",
"(",
"m",
".",
"matches"... | This fix is not ideal. It trades one warning (JSC_REFERENCE_BEFORE_DECLARE) for another
(JSC_REDECLARED_VARIABLE). But after running the fixer once, you can then run it again and
#getFixForRedeclaration will take care of the JSC_REDECLARED_VARIABLE warning. | [
"This",
"fix",
"is",
"not",
"ideal",
".",
"It",
"trades",
"one",
"warning",
"(",
"JSC_REFERENCE_BEFORE_DECLARE",
")",
"for",
"another",
"(",
"JSC_REDECLARED_VARIABLE",
")",
".",
"But",
"after",
"running",
"the",
"fixer",
"once",
"you",
"can",
"then",
"run",
... | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/refactoring/ErrorToFixMapper.java#L182-L193 |
fozziethebeat/S-Space | src/main/java/edu/ucla/sspace/vector/VectorMath.java | VectorMath.dotProduct | public static double dotProduct(Vector x, Vector y) {
// If both of the vectors are integer vectors, cast and special case
if (x instanceof IntegerVector && y instanceof IntegerVector)
return dotProduct((IntegerVector)x, (IntegerVector)y);
// Otherwise, just make both vectors double vectors and compute the dot
// product regardless of their internal data type.
else
return dotProduct(Vectors.asDouble(x), Vectors.asDouble(y));
} | java | public static double dotProduct(Vector x, Vector y) {
// If both of the vectors are integer vectors, cast and special case
if (x instanceof IntegerVector && y instanceof IntegerVector)
return dotProduct((IntegerVector)x, (IntegerVector)y);
// Otherwise, just make both vectors double vectors and compute the dot
// product regardless of their internal data type.
else
return dotProduct(Vectors.asDouble(x), Vectors.asDouble(y));
} | [
"public",
"static",
"double",
"dotProduct",
"(",
"Vector",
"x",
",",
"Vector",
"y",
")",
"{",
"// If both of the vectors are integer vectors, cast and special case",
"if",
"(",
"x",
"instanceof",
"IntegerVector",
"&&",
"y",
"instanceof",
"IntegerVector",
")",
"return",
... | Computes the dot product, {@code x}<sup>T</sup>{@code y} of the two
vectors.
@param x the left vector that will be transposed
@param y the right vector
@return the dot product of the two vectors.
@throws IllegalArgumentException if the two vectors are not of equal
length | [
"Computes",
"the",
"dot",
"product",
"{",
"@code",
"x",
"}",
"<sup",
">",
"T<",
"/",
"sup",
">",
"{",
"@code",
"y",
"}",
"of",
"the",
"two",
"vectors",
"."
] | train | https://github.com/fozziethebeat/S-Space/blob/a608102737dfd3d59038a9ead33fe60356bc6029/src/main/java/edu/ucla/sspace/vector/VectorMath.java#L306-L314 |
alipay/sofa-rpc | core/api/src/main/java/com/alipay/sofa/rpc/config/AbstractInterfaceConfig.java | AbstractInterfaceConfig.setParameter | public S setParameter(String key, String value) {
if (parameters == null) {
parameters = new ConcurrentHashMap<String, String>();
}
if (value == null) {
parameters.remove(key);
} else {
parameters.put(key, value);
}
return castThis();
} | java | public S setParameter(String key, String value) {
if (parameters == null) {
parameters = new ConcurrentHashMap<String, String>();
}
if (value == null) {
parameters.remove(key);
} else {
parameters.put(key, value);
}
return castThis();
} | [
"public",
"S",
"setParameter",
"(",
"String",
"key",
",",
"String",
"value",
")",
"{",
"if",
"(",
"parameters",
"==",
"null",
")",
"{",
"parameters",
"=",
"new",
"ConcurrentHashMap",
"<",
"String",
",",
"String",
">",
"(",
")",
";",
"}",
"if",
"(",
"... | Sets parameter.
@param key the key
@param value the value
@return the parameter | [
"Sets",
"parameter",
"."
] | train | https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/core/api/src/main/java/com/alipay/sofa/rpc/config/AbstractInterfaceConfig.java#L984-L994 |
palatable/lambda | src/main/java/com/jnape/palatable/lambda/optics/lenses/MaybeLens.java | MaybeLens.asMaybe | public static <V> Lens.Simple<V, Maybe<V>> asMaybe() {
return simpleLens(Maybe::maybe, (v, maybeV) -> maybeV.orElse(v));
} | java | public static <V> Lens.Simple<V, Maybe<V>> asMaybe() {
return simpleLens(Maybe::maybe, (v, maybeV) -> maybeV.orElse(v));
} | [
"public",
"static",
"<",
"V",
">",
"Lens",
".",
"Simple",
"<",
"V",
",",
"Maybe",
"<",
"V",
">",
">",
"asMaybe",
"(",
")",
"{",
"return",
"simpleLens",
"(",
"Maybe",
"::",
"maybe",
",",
"(",
"v",
",",
"maybeV",
")",
"->",
"maybeV",
".",
"orElse",... | Convenience static factory method for creating a lens that focuses on a value as a {@link Maybe}.
@param <V> the value type
@return a lens that focuses on the value as a {@link Maybe} | [
"Convenience",
"static",
"factory",
"method",
"for",
"creating",
"a",
"lens",
"that",
"focuses",
"on",
"a",
"value",
"as",
"a",
"{",
"@link",
"Maybe",
"}",
"."
] | train | https://github.com/palatable/lambda/blob/b643ba836c5916d1d8193822e5efb4e7b40c489a/src/main/java/com/jnape/palatable/lambda/optics/lenses/MaybeLens.java#L152-L154 |
sarl/sarl | main/coreplugins/io.sarl.m2e/src/io/sarl/m2e/utils/M2EUtilities.java | M2EUtilities.compareMavenVersions | public static int compareMavenVersions(String v1, String v2) {
return parseMavenVersion(v1).compareTo(parseMavenVersion(v2));
} | java | public static int compareMavenVersions(String v1, String v2) {
return parseMavenVersion(v1).compareTo(parseMavenVersion(v2));
} | [
"public",
"static",
"int",
"compareMavenVersions",
"(",
"String",
"v1",
",",
"String",
"v2",
")",
"{",
"return",
"parseMavenVersion",
"(",
"v1",
")",
".",
"compareTo",
"(",
"parseMavenVersion",
"(",
"v2",
")",
")",
";",
"}"
] | Compare two Maven versions.
@param v1 first Maven version.
@param v2 second Maven version.
@return an integer that the sign indicates if v1 is lower, equal ot greater than v2. | [
"Compare",
"two",
"Maven",
"versions",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.m2e/src/io/sarl/m2e/utils/M2EUtilities.java#L73-L75 |
upwork/java-upwork | src/com/Upwork/api/Routers/Hr/Contracts.java | Contracts.endContract | public JSONObject endContract(String reference, HashMap<String, String> params) throws JSONException {
return oClient.delete("/hr/v2/contracts/" + reference, params);
} | java | public JSONObject endContract(String reference, HashMap<String, String> params) throws JSONException {
return oClient.delete("/hr/v2/contracts/" + reference, params);
} | [
"public",
"JSONObject",
"endContract",
"(",
"String",
"reference",
",",
"HashMap",
"<",
"String",
",",
"String",
">",
"params",
")",
"throws",
"JSONException",
"{",
"return",
"oClient",
".",
"delete",
"(",
"\"/hr/v2/contracts/\"",
"+",
"reference",
",",
"params"... | End Contract
@param reference Contract reference
@param params Parameters
@throws JSONException If error occurred
@return {@link JSONObject} | [
"End",
"Contract"
] | train | https://github.com/upwork/java-upwork/blob/342297161503a74e9e0bddbd381ab5eebf4dc454/src/com/Upwork/api/Routers/Hr/Contracts.java#L78-L80 |
mozilla/rhino | toolsrc/org/mozilla/javascript/tools/shell/Global.java | Global.readFile | public static Object readFile(Context cx, Scriptable thisObj, Object[] args,
Function funObj)
throws IOException
{
if (args.length == 0) {
throw reportRuntimeError("msg.shell.readFile.bad.args");
}
String path = ScriptRuntime.toString(args[0]);
String charCoding = null;
if (args.length >= 2) {
charCoding = ScriptRuntime.toString(args[1]);
}
return readUrl(path, charCoding, true);
} | java | public static Object readFile(Context cx, Scriptable thisObj, Object[] args,
Function funObj)
throws IOException
{
if (args.length == 0) {
throw reportRuntimeError("msg.shell.readFile.bad.args");
}
String path = ScriptRuntime.toString(args[0]);
String charCoding = null;
if (args.length >= 2) {
charCoding = ScriptRuntime.toString(args[1]);
}
return readUrl(path, charCoding, true);
} | [
"public",
"static",
"Object",
"readFile",
"(",
"Context",
"cx",
",",
"Scriptable",
"thisObj",
",",
"Object",
"[",
"]",
"args",
",",
"Function",
"funObj",
")",
"throws",
"IOException",
"{",
"if",
"(",
"args",
".",
"length",
"==",
"0",
")",
"{",
"throw",
... | The readFile reads the given file content and convert it to a string
using the specified character coding or default character coding if
explicit coding argument is not given.
<p>
Usage:
<pre>
readFile(filePath)
readFile(filePath, charCoding)
</pre>
The first form converts file's context to string using the default
character coding. | [
"The",
"readFile",
"reads",
"the",
"given",
"file",
"content",
"and",
"convert",
"it",
"to",
"a",
"string",
"using",
"the",
"specified",
"character",
"coding",
"or",
"default",
"character",
"coding",
"if",
"explicit",
"coding",
"argument",
"is",
"not",
"given"... | train | https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/toolsrc/org/mozilla/javascript/tools/shell/Global.java#L838-L852 |
Netflix/concurrency-limits | concurrency-limits-servlet/src/main/java/com/netflix/concurrency/limits/servlet/ServletLimiterBuilder.java | ServletLimiterBuilder.partitionByUserPrincipal | public ServletLimiterBuilder partitionByUserPrincipal(Function<Principal, String> principalToGroup) {
return partitionResolver(request -> Optional.ofNullable(request.getUserPrincipal()).map(principalToGroup).orElse(null));
} | java | public ServletLimiterBuilder partitionByUserPrincipal(Function<Principal, String> principalToGroup) {
return partitionResolver(request -> Optional.ofNullable(request.getUserPrincipal()).map(principalToGroup).orElse(null));
} | [
"public",
"ServletLimiterBuilder",
"partitionByUserPrincipal",
"(",
"Function",
"<",
"Principal",
",",
"String",
">",
"principalToGroup",
")",
"{",
"return",
"partitionResolver",
"(",
"request",
"->",
"Optional",
".",
"ofNullable",
"(",
"request",
".",
"getUserPrincip... | Partition the limit by {@link Principal}. Percentages of the limit are partitioned to named
groups. Group membership is derived from the provided mapping function.
@param principalToGroup Mapping function from {@link Principal} to a named group.
@return Chainable builder | [
"Partition",
"the",
"limit",
"by",
"{"
] | train | https://github.com/Netflix/concurrency-limits/blob/5ae2be4fea9848af6f63c7b5632af30c494e7373/concurrency-limits-servlet/src/main/java/com/netflix/concurrency/limits/servlet/ServletLimiterBuilder.java#L46-L48 |
JodaOrg/joda-time | src/main/java/org/joda/time/convert/NullConverter.java | NullConverter.setInto | public void setInto(ReadWritableInterval writableInterval, Object object, Chronology chrono) {
writableInterval.setChronology(chrono);
long now = DateTimeUtils.currentTimeMillis();
writableInterval.setInterval(now, now);
} | java | public void setInto(ReadWritableInterval writableInterval, Object object, Chronology chrono) {
writableInterval.setChronology(chrono);
long now = DateTimeUtils.currentTimeMillis();
writableInterval.setInterval(now, now);
} | [
"public",
"void",
"setInto",
"(",
"ReadWritableInterval",
"writableInterval",
",",
"Object",
"object",
",",
"Chronology",
"chrono",
")",
"{",
"writableInterval",
".",
"setChronology",
"(",
"chrono",
")",
";",
"long",
"now",
"=",
"DateTimeUtils",
".",
"currentTimeM... | Extracts interval endpoint values from an object of this converter's
type, and sets them into the given ReadWritableInterval.
@param writableInterval interval to get modified, not null
@param object the object to convert, which is null
@param chrono the chronology to use, may be null
@throws NullPointerException if the interval is null | [
"Extracts",
"interval",
"endpoint",
"values",
"from",
"an",
"object",
"of",
"this",
"converter",
"s",
"type",
"and",
"sets",
"them",
"into",
"the",
"given",
"ReadWritableInterval",
"."
] | train | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/convert/NullConverter.java#L82-L86 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/http/HttpHeaderMap.java | HttpHeaderMap.addHeader | public void addHeader (@Nonnull @Nonempty final String sName, @Nullable final String sValue)
{
if (sValue != null)
_addHeader (sName, sValue);
} | java | public void addHeader (@Nonnull @Nonempty final String sName, @Nullable final String sValue)
{
if (sValue != null)
_addHeader (sName, sValue);
} | [
"public",
"void",
"addHeader",
"(",
"@",
"Nonnull",
"@",
"Nonempty",
"final",
"String",
"sName",
",",
"@",
"Nullable",
"final",
"String",
"sValue",
")",
"{",
"if",
"(",
"sValue",
"!=",
"null",
")",
"_addHeader",
"(",
"sName",
",",
"sValue",
")",
";",
"... | Add the passed header as is.
@param sName
Header name. May neither be <code>null</code> nor empty.
@param sValue
The value to be set. May be <code>null</code> in which case nothing
happens. | [
"Add",
"the",
"passed",
"header",
"as",
"is",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/http/HttpHeaderMap.java#L205-L209 |
dita-ot/dita-ot | src/main/java/org/dita/dost/util/FileUtils.java | FileUtils.directoryContains | public static boolean directoryContains(final File directory, final File child) {
final File d = new File(normalize(directory.getAbsolutePath()));
final File c = new File(normalize(child.getAbsolutePath()));
if (d.equals(c)) {
return false;
} else {
return c.getPath().startsWith(d.getPath());
}
} | java | public static boolean directoryContains(final File directory, final File child) {
final File d = new File(normalize(directory.getAbsolutePath()));
final File c = new File(normalize(child.getAbsolutePath()));
if (d.equals(c)) {
return false;
} else {
return c.getPath().startsWith(d.getPath());
}
} | [
"public",
"static",
"boolean",
"directoryContains",
"(",
"final",
"File",
"directory",
",",
"final",
"File",
"child",
")",
"{",
"final",
"File",
"d",
"=",
"new",
"File",
"(",
"normalize",
"(",
"directory",
".",
"getAbsolutePath",
"(",
")",
")",
")",
";",
... | Determines whether the parent directory contains the child element (a file or directory)
@param directory the file to consider as the parent
@param child the file to consider as the child
@return true is the candidate leaf is under by the specified composite, otherwise false | [
"Determines",
"whether",
"the",
"parent",
"directory",
"contains",
"the",
"child",
"element",
"(",
"a",
"file",
"or",
"directory",
")"
] | train | https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/util/FileUtils.java#L609-L617 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ExpressRouteCrossConnectionPeeringsInner.java | ExpressRouteCrossConnectionPeeringsInner.beginCreateOrUpdateAsync | public Observable<ExpressRouteCrossConnectionPeeringInner> beginCreateOrUpdateAsync(String resourceGroupName, String crossConnectionName, String peeringName, ExpressRouteCrossConnectionPeeringInner peeringParameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, crossConnectionName, peeringName, peeringParameters).map(new Func1<ServiceResponse<ExpressRouteCrossConnectionPeeringInner>, ExpressRouteCrossConnectionPeeringInner>() {
@Override
public ExpressRouteCrossConnectionPeeringInner call(ServiceResponse<ExpressRouteCrossConnectionPeeringInner> response) {
return response.body();
}
});
} | java | public Observable<ExpressRouteCrossConnectionPeeringInner> beginCreateOrUpdateAsync(String resourceGroupName, String crossConnectionName, String peeringName, ExpressRouteCrossConnectionPeeringInner peeringParameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, crossConnectionName, peeringName, peeringParameters).map(new Func1<ServiceResponse<ExpressRouteCrossConnectionPeeringInner>, ExpressRouteCrossConnectionPeeringInner>() {
@Override
public ExpressRouteCrossConnectionPeeringInner call(ServiceResponse<ExpressRouteCrossConnectionPeeringInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ExpressRouteCrossConnectionPeeringInner",
">",
"beginCreateOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"crossConnectionName",
",",
"String",
"peeringName",
",",
"ExpressRouteCrossConnectionPeeringInner",
"peeringParameters",
")... | Creates or updates a peering in the specified ExpressRouteCrossConnection.
@param resourceGroupName The name of the resource group.
@param crossConnectionName The name of the ExpressRouteCrossConnection.
@param peeringName The name of the peering.
@param peeringParameters Parameters supplied to the create or update ExpressRouteCrossConnection peering operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ExpressRouteCrossConnectionPeeringInner object | [
"Creates",
"or",
"updates",
"a",
"peering",
"in",
"the",
"specified",
"ExpressRouteCrossConnection",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ExpressRouteCrossConnectionPeeringsInner.java#L594-L601 |
apache/incubator-shardingsphere | sharding-core/sharding-core-execute/src/main/java/org/apache/shardingsphere/core/execute/sql/prepare/SQLExecutePrepareTemplate.java | SQLExecutePrepareTemplate.getExecuteUnitGroups | public Collection<ShardingExecuteGroup<StatementExecuteUnit>> getExecuteUnitGroups(final Collection<RouteUnit> routeUnits, final SQLExecutePrepareCallback callback) throws SQLException {
return getSynchronizedExecuteUnitGroups(routeUnits, callback);
} | java | public Collection<ShardingExecuteGroup<StatementExecuteUnit>> getExecuteUnitGroups(final Collection<RouteUnit> routeUnits, final SQLExecutePrepareCallback callback) throws SQLException {
return getSynchronizedExecuteUnitGroups(routeUnits, callback);
} | [
"public",
"Collection",
"<",
"ShardingExecuteGroup",
"<",
"StatementExecuteUnit",
">",
">",
"getExecuteUnitGroups",
"(",
"final",
"Collection",
"<",
"RouteUnit",
">",
"routeUnits",
",",
"final",
"SQLExecutePrepareCallback",
"callback",
")",
"throws",
"SQLException",
"{"... | Get execute unit groups.
@param routeUnits route units
@param callback SQL execute prepare callback
@return statement execute unit groups
@throws SQLException SQL exception | [
"Get",
"execute",
"unit",
"groups",
"."
] | train | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-execute/src/main/java/org/apache/shardingsphere/core/execute/sql/prepare/SQLExecutePrepareTemplate.java#L58-L60 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/stats/Counters.java | Counters.toSortedByKeysString | public static <T extends Comparable<T>> String toSortedByKeysString(Counter<T> counter, String itemFormat, String joiner, String wrapperFormat) {
List<String> strings = new ArrayList<String>();
for (T key : CollectionUtils.sorted(counter.keySet())) {
strings.add(String.format(itemFormat, key, counter.getCount(key)));
}
return String.format(wrapperFormat, StringUtils.join(strings, joiner));
} | java | public static <T extends Comparable<T>> String toSortedByKeysString(Counter<T> counter, String itemFormat, String joiner, String wrapperFormat) {
List<String> strings = new ArrayList<String>();
for (T key : CollectionUtils.sorted(counter.keySet())) {
strings.add(String.format(itemFormat, key, counter.getCount(key)));
}
return String.format(wrapperFormat, StringUtils.join(strings, joiner));
} | [
"public",
"static",
"<",
"T",
"extends",
"Comparable",
"<",
"T",
">",
">",
"String",
"toSortedByKeysString",
"(",
"Counter",
"<",
"T",
">",
"counter",
",",
"String",
"itemFormat",
",",
"String",
"joiner",
",",
"String",
"wrapperFormat",
")",
"{",
"List",
"... | Returns a string representation of a Counter, where (key, value) pairs are
sorted by key, and formatted as specified.
@param counter
The Counter.
@param itemFormat
The format string for key/count pairs, where the key is first and
the value is second. To display the value first, use argument
indices, e.g. "%2$f %1$s".
@param joiner
The string used between pairs of key/value strings.
@param wrapperFormat
The format string for wrapping text around the joined items, where
the joined item string value is "%s".
@return The Counter, formatted as specified. | [
"Returns",
"a",
"string",
"representation",
"of",
"a",
"Counter",
"where",
"(",
"key",
"value",
")",
"pairs",
"are",
"sorted",
"by",
"key",
"and",
"formatted",
"as",
"specified",
"."
] | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/stats/Counters.java#L1813-L1819 |
EdwardRaff/JSAT | JSAT/src/jsat/DataSet.java | DataSet.applyTransformMutate | public void applyTransformMutate(final DataTransform dt, boolean mutate, boolean parallel)
{
if (mutate && dt instanceof InPlaceTransform)
{
final InPlaceTransform ipt = (InPlaceTransform) dt;
ParallelUtils.range(size(), parallel)
.forEach(i->ipt.mutableTransform(getDataPoint(i)));
}
else
ParallelUtils.range(size(), parallel).forEach(i->setDataPoint(i, dt.transform(getDataPoint(i))));
//TODO this should be added to DataTransform
numNumerVals = getDataPoint(0).numNumericalValues();
categories = getDataPoint(0).getCategoricalData();
if (this.numericalVariableNames != null)
this.numericalVariableNames.clear();
} | java | public void applyTransformMutate(final DataTransform dt, boolean mutate, boolean parallel)
{
if (mutate && dt instanceof InPlaceTransform)
{
final InPlaceTransform ipt = (InPlaceTransform) dt;
ParallelUtils.range(size(), parallel)
.forEach(i->ipt.mutableTransform(getDataPoint(i)));
}
else
ParallelUtils.range(size(), parallel).forEach(i->setDataPoint(i, dt.transform(getDataPoint(i))));
//TODO this should be added to DataTransform
numNumerVals = getDataPoint(0).numNumericalValues();
categories = getDataPoint(0).getCategoricalData();
if (this.numericalVariableNames != null)
this.numericalVariableNames.clear();
} | [
"public",
"void",
"applyTransformMutate",
"(",
"final",
"DataTransform",
"dt",
",",
"boolean",
"mutate",
",",
"boolean",
"parallel",
")",
"{",
"if",
"(",
"mutate",
"&&",
"dt",
"instanceof",
"InPlaceTransform",
")",
"{",
"final",
"InPlaceTransform",
"ipt",
"=",
... | Applies the given transformation to all points in this data set in
parallel. If the transform supports mutating the original data points,
this will be applied if {@code mutableTransform} is set to {@code true}
@param dt the transformation to apply
@param mutate {@code true} to mutableTransform the original data points,
{@code false} to ignore the ability to mutableTransform and replace the original
@param parallel whether or not to perform the transform in parallel or not. | [
"Applies",
"the",
"given",
"transformation",
"to",
"all",
"points",
"in",
"this",
"data",
"set",
"in",
"parallel",
".",
"If",
"the",
"transform",
"supports",
"mutating",
"the",
"original",
"data",
"points",
"this",
"will",
"be",
"applied",
"if",
"{",
"@code"... | train | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/DataSet.java#L219-L236 |
facebookarchive/hadoop-20 | src/contrib/benchmark/src/java/org/apache/hadoop/mapred/DatanodeBenThread.java | DatanodeBenThread.getRunningDatanode | private String getRunningDatanode(Configuration conf)
throws IOException {
FileSystem fs = FileSystem.newInstance(conf);
fs.mkdirs(new Path("/tmp"));
Path fileName = new Path("/tmp", rtc.task_name + System.currentTimeMillis()
+ rb.nextInt());
if (fs.exists(fileName)) {
fs.delete(fileName);
}
FSDataOutputStream out = null;
byte[] buffer= new byte[1];
buffer[0] = '0';
try {
out = fs.create(fileName, (short)1);
out.write(buffer, 0, 1);
} finally {
IOUtils.closeStream(out);
}
fs = getDFS(fs);
assert fs instanceof DistributedFileSystem;
DistributedFileSystem dfs = (DistributedFileSystem)fs;
BlockLocation[] lbs = dfs.getClient().getBlockLocations(
fileName.toUri().getPath(), 0, 1);
fs.delete(fileName);
return lbs[0].getHosts()[0];
} | java | private String getRunningDatanode(Configuration conf)
throws IOException {
FileSystem fs = FileSystem.newInstance(conf);
fs.mkdirs(new Path("/tmp"));
Path fileName = new Path("/tmp", rtc.task_name + System.currentTimeMillis()
+ rb.nextInt());
if (fs.exists(fileName)) {
fs.delete(fileName);
}
FSDataOutputStream out = null;
byte[] buffer= new byte[1];
buffer[0] = '0';
try {
out = fs.create(fileName, (short)1);
out.write(buffer, 0, 1);
} finally {
IOUtils.closeStream(out);
}
fs = getDFS(fs);
assert fs instanceof DistributedFileSystem;
DistributedFileSystem dfs = (DistributedFileSystem)fs;
BlockLocation[] lbs = dfs.getClient().getBlockLocations(
fileName.toUri().getPath(), 0, 1);
fs.delete(fileName);
return lbs[0].getHosts()[0];
} | [
"private",
"String",
"getRunningDatanode",
"(",
"Configuration",
"conf",
")",
"throws",
"IOException",
"{",
"FileSystem",
"fs",
"=",
"FileSystem",
".",
"newInstance",
"(",
"conf",
")",
";",
"fs",
".",
"mkdirs",
"(",
"new",
"Path",
"(",
"\"/tmp\"",
")",
")",
... | Write a small file to figure out which datanode we are running | [
"Write",
"a",
"small",
"file",
"to",
"figure",
"out",
"which",
"datanode",
"we",
"are",
"running"
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/benchmark/src/java/org/apache/hadoop/mapred/DatanodeBenThread.java#L455-L480 |
alkacon/opencms-core | src/org/opencms/db/CmsSecurityManager.java | CmsSecurityManager.writePropertyObjects | public void writePropertyObjects(CmsRequestContext context, CmsResource resource, List<CmsProperty> properties)
throws CmsException, CmsSecurityException {
CmsDbContext dbc = m_dbContextFactory.getDbContext(context);
try {
checkOfflineProject(dbc);
checkPermissions(dbc, resource, CmsPermissionSet.ACCESS_WRITE, true, CmsResourceFilter.IGNORE_EXPIRATION);
// write the properties
m_driverManager.writePropertyObjects(dbc, resource, properties, true);
} catch (Exception e) {
dbc.report(null, Messages.get().container(Messages.ERR_WRITE_PROPS_1, context.getSitePath(resource)), e);
} finally {
dbc.clear();
}
} | java | public void writePropertyObjects(CmsRequestContext context, CmsResource resource, List<CmsProperty> properties)
throws CmsException, CmsSecurityException {
CmsDbContext dbc = m_dbContextFactory.getDbContext(context);
try {
checkOfflineProject(dbc);
checkPermissions(dbc, resource, CmsPermissionSet.ACCESS_WRITE, true, CmsResourceFilter.IGNORE_EXPIRATION);
// write the properties
m_driverManager.writePropertyObjects(dbc, resource, properties, true);
} catch (Exception e) {
dbc.report(null, Messages.get().container(Messages.ERR_WRITE_PROPS_1, context.getSitePath(resource)), e);
} finally {
dbc.clear();
}
} | [
"public",
"void",
"writePropertyObjects",
"(",
"CmsRequestContext",
"context",
",",
"CmsResource",
"resource",
",",
"List",
"<",
"CmsProperty",
">",
"properties",
")",
"throws",
"CmsException",
",",
"CmsSecurityException",
"{",
"CmsDbContext",
"dbc",
"=",
"m_dbContext... | Writes a list of properties for a specified resource.<p>
Code calling this method has to ensure that the no properties
<code>a, b</code> are contained in the specified list so that <code>a.equals(b)</code>,
otherwise an exception is thrown.<p>
@param context the current request context
@param resource the resource to write the properties for
@param properties the list of properties to write
@throws CmsException if something goes wrong
@throws CmsSecurityException if the user has insufficient permission for the given resource ({@link CmsPermissionSet#ACCESS_WRITE} required)
@see CmsObject#writePropertyObjects(String, List)
@see org.opencms.file.types.I_CmsResourceType#writePropertyObjects(CmsObject, CmsSecurityManager, CmsResource, List) | [
"Writes",
"a",
"list",
"of",
"properties",
"for",
"a",
"specified",
"resource",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSecurityManager.java#L6837-L6851 |
alkacon/opencms-core | src-modules/org/opencms/workplace/tools/database/CmsHtmlImportDialog.java | CmsHtmlImportDialog.getTemplates | private List getTemplates() {
ArrayList ret = new ArrayList();
TreeMap templates = null;
try {
templates = CmsNewResourceXmlPage.getTemplates(getJsp().getCmsObject(), null);
// loop through all templates and build the entries
Iterator i = templates.entrySet().iterator();
while (i.hasNext()) {
Map.Entry entry = (Map.Entry)i.next();
String title = (String)entry.getKey();
String path = (String)entry.getValue();
ret.add(new CmsSelectWidgetOption(path, false, title));
}
} catch (CmsException e) {
// not necessary
}
return ret;
} | java | private List getTemplates() {
ArrayList ret = new ArrayList();
TreeMap templates = null;
try {
templates = CmsNewResourceXmlPage.getTemplates(getJsp().getCmsObject(), null);
// loop through all templates and build the entries
Iterator i = templates.entrySet().iterator();
while (i.hasNext()) {
Map.Entry entry = (Map.Entry)i.next();
String title = (String)entry.getKey();
String path = (String)entry.getValue();
ret.add(new CmsSelectWidgetOption(path, false, title));
}
} catch (CmsException e) {
// not necessary
}
return ret;
} | [
"private",
"List",
"getTemplates",
"(",
")",
"{",
"ArrayList",
"ret",
"=",
"new",
"ArrayList",
"(",
")",
";",
"TreeMap",
"templates",
"=",
"null",
";",
"try",
"{",
"templates",
"=",
"CmsNewResourceXmlPage",
".",
"getTemplates",
"(",
"getJsp",
"(",
")",
"."... | Returns a list with all available templates.<p>
@return a list with all available templates | [
"Returns",
"a",
"list",
"with",
"all",
"available",
"templates",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/tools/database/CmsHtmlImportDialog.java#L536-L558 |
meraki-analytics/datapipelines-java | src/main/java/com/merakianalytics/datapipelines/SinkHandler.java | SinkHandler.put | public void put(final A item, final PipelineContext context) {
final S transformed = transform.transform(item, context);
sink.put(storedType, transformed, context);
} | java | public void put(final A item, final PipelineContext context) {
final S transformed = transform.transform(item, context);
sink.put(storedType, transformed, context);
} | [
"public",
"void",
"put",
"(",
"final",
"A",
"item",
",",
"final",
"PipelineContext",
"context",
")",
"{",
"final",
"S",
"transformed",
"=",
"transform",
".",
"transform",
"(",
"item",
",",
"context",
")",
";",
"sink",
".",
"put",
"(",
"storedType",
",",
... | Converts some data and provides it to the underlying {@link com.merakianalytics.datapipelines.sinks.DataSink}
@param item
the data to provide to the underlying {@link com.merakianalytics.datapipelines.sinks.DataSink}
@param context
information about the context of the request such as what {@link com.merakianalytics.datapipelines.DataPipeline} called this method | [
"Converts",
"some",
"data",
"and",
"provides",
"it",
"to",
"the",
"underlying",
"{",
"@link",
"com",
".",
"merakianalytics",
".",
"datapipelines",
".",
"sinks",
".",
"DataSink",
"}"
] | train | https://github.com/meraki-analytics/datapipelines-java/blob/376ff1e8e1f7c67f2f2a5521d2a66e91467e56b0/src/main/java/com/merakianalytics/datapipelines/SinkHandler.java#L92-L95 |
xdcrafts/flower | flower-tools/src/main/java/com/github/xdcrafts/flower/tools/ListApi.java | ListApi.getOptional | public static <T> Optional<Optional<T>> getOptional(final List list, final Class<T> clazz, final Integer... path) {
return get(list, Optional.class, path).map(opt -> (Optional<T>) opt);
} | java | public static <T> Optional<Optional<T>> getOptional(final List list, final Class<T> clazz, final Integer... path) {
return get(list, Optional.class, path).map(opt -> (Optional<T>) opt);
} | [
"public",
"static",
"<",
"T",
">",
"Optional",
"<",
"Optional",
"<",
"T",
">",
">",
"getOptional",
"(",
"final",
"List",
"list",
",",
"final",
"Class",
"<",
"T",
">",
"clazz",
",",
"final",
"Integer",
"...",
"path",
")",
"{",
"return",
"get",
"(",
... | Get optional value by path.
@param <T> optional value type
@param clazz type of value
@param list subject
@param path nodes to walk in map
@return value | [
"Get",
"optional",
"value",
"by",
"path",
"."
] | train | https://github.com/xdcrafts/flower/blob/96a8e49102fea434bd383a3c7852f0ee9545f999/flower-tools/src/main/java/com/github/xdcrafts/flower/tools/ListApi.java#L244-L246 |
Azure/azure-sdk-for-java | locks/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/locks/v2016_09_01/implementation/ManagementLocksInner.java | ManagementLocksInner.deleteAtResourceLevel | public void deleteAtResourceLevel(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String lockName) {
deleteAtResourceLevelWithServiceResponseAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, lockName).toBlocking().single().body();
} | java | public void deleteAtResourceLevel(String resourceGroupName, String resourceProviderNamespace, String parentResourcePath, String resourceType, String resourceName, String lockName) {
deleteAtResourceLevelWithServiceResponseAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, lockName).toBlocking().single().body();
} | [
"public",
"void",
"deleteAtResourceLevel",
"(",
"String",
"resourceGroupName",
",",
"String",
"resourceProviderNamespace",
",",
"String",
"parentResourcePath",
",",
"String",
"resourceType",
",",
"String",
"resourceName",
",",
"String",
"lockName",
")",
"{",
"deleteAtRe... | Deletes the management lock of a resource or any level below the resource.
To delete management locks, you must have access to Microsoft.Authorization/* or Microsoft.Authorization/locks/* actions. Of the built-in roles, only Owner and User Access Administrator are granted those actions.
@param resourceGroupName The name of the resource group containing the resource with the lock to delete.
@param resourceProviderNamespace The resource provider namespace of the resource with the lock to delete.
@param parentResourcePath The parent resource identity.
@param resourceType The resource type of the resource with the lock to delete.
@param resourceName The name of the resource with the lock to delete.
@param lockName The name of the lock to delete.
@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 | [
"Deletes",
"the",
"management",
"lock",
"of",
"a",
"resource",
"or",
"any",
"level",
"below",
"the",
"resource",
".",
"To",
"delete",
"management",
"locks",
"you",
"must",
"have",
"access",
"to",
"Microsoft",
".",
"Authorization",
"/",
"*",
"or",
"Microsoft"... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/locks/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/locks/v2016_09_01/implementation/ManagementLocksInner.java#L814-L816 |
JodaOrg/joda-time | src/main/java/org/joda/time/Weeks.java | Weeks.weeksBetween | public static Weeks weeksBetween(ReadableInstant start, ReadableInstant end) {
int amount = BaseSingleFieldPeriod.between(start, end, DurationFieldType.weeks());
return Weeks.weeks(amount);
} | java | public static Weeks weeksBetween(ReadableInstant start, ReadableInstant end) {
int amount = BaseSingleFieldPeriod.between(start, end, DurationFieldType.weeks());
return Weeks.weeks(amount);
} | [
"public",
"static",
"Weeks",
"weeksBetween",
"(",
"ReadableInstant",
"start",
",",
"ReadableInstant",
"end",
")",
"{",
"int",
"amount",
"=",
"BaseSingleFieldPeriod",
".",
"between",
"(",
"start",
",",
"end",
",",
"DurationFieldType",
".",
"weeks",
"(",
")",
")... | Creates a <code>Weeks</code> representing the number of whole weeks
between the two specified datetimes.
@param start the start instant, must not be null
@param end the end instant, must not be null
@return the period in weeks
@throws IllegalArgumentException if the instants are null or invalid | [
"Creates",
"a",
"<code",
">",
"Weeks<",
"/",
"code",
">",
"representing",
"the",
"number",
"of",
"whole",
"weeks",
"between",
"the",
"two",
"specified",
"datetimes",
"."
] | train | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/Weeks.java#L100-L103 |
phax/ph-css | ph-css/src/main/java/com/helger/css/utils/CSSDataURL.java | CSSDataURL.getContentAsBase64EncodedString | @Nonnull
public String getContentAsBase64EncodedString ()
{
// Add Base64 encoded String
final byte [] aEncoded = Base64.encodeBytesToBytes (m_aContent);
// Print the string in the specified charset
return new String (aEncoded, m_aCharset);
} | java | @Nonnull
public String getContentAsBase64EncodedString ()
{
// Add Base64 encoded String
final byte [] aEncoded = Base64.encodeBytesToBytes (m_aContent);
// Print the string in the specified charset
return new String (aEncoded, m_aCharset);
} | [
"@",
"Nonnull",
"public",
"String",
"getContentAsBase64EncodedString",
"(",
")",
"{",
"// Add Base64 encoded String",
"final",
"byte",
"[",
"]",
"aEncoded",
"=",
"Base64",
".",
"encodeBytesToBytes",
"(",
"m_aContent",
")",
";",
"// Print the string in the specified charse... | Get the content as a Base64 encoded {@link String} in the {@link Charset}
specified by {@link #getCharset()}. The encoding is applied independent of
the {@link #isBase64Encoded()} state.
@return Never <code>null</code>. | [
"Get",
"the",
"content",
"as",
"a",
"Base64",
"encoded",
"{",
"@link",
"String",
"}",
"in",
"the",
"{",
"@link",
"Charset",
"}",
"specified",
"by",
"{",
"@link",
"#getCharset",
"()",
"}",
".",
"The",
"encoding",
"is",
"applied",
"independent",
"of",
"the... | train | https://github.com/phax/ph-css/blob/c9da5bb4decc681de6e27ce31712aad4c00adafa/ph-css/src/main/java/com/helger/css/utils/CSSDataURL.java#L286-L293 |
alkacon/opencms-core | src/org/opencms/xml/CmsXmlContentDefinition.java | CmsXmlContentDefinition.createDefaultXml | public Element createDefaultXml(CmsObject cms, I_CmsXmlDocument document, Element root, Locale locale) {
Iterator<I_CmsXmlSchemaType> i = m_typeSequence.iterator();
while (i.hasNext()) {
I_CmsXmlSchemaType type = i.next();
for (int j = 0; j < type.getMinOccurs(); j++) {
Element typeElement = type.generateXml(cms, document, root, locale);
// need to check for default value again because of the appinfo "mappings" node
I_CmsXmlContentValue value = type.createValue(document, typeElement, locale);
String defaultValue = document.getHandler().getDefault(cms, value, locale);
if (defaultValue != null) {
// only if there is a default value available use it to overwrite the initial default
value.setStringValue(cms, defaultValue);
}
}
}
return root;
} | java | public Element createDefaultXml(CmsObject cms, I_CmsXmlDocument document, Element root, Locale locale) {
Iterator<I_CmsXmlSchemaType> i = m_typeSequence.iterator();
while (i.hasNext()) {
I_CmsXmlSchemaType type = i.next();
for (int j = 0; j < type.getMinOccurs(); j++) {
Element typeElement = type.generateXml(cms, document, root, locale);
// need to check for default value again because of the appinfo "mappings" node
I_CmsXmlContentValue value = type.createValue(document, typeElement, locale);
String defaultValue = document.getHandler().getDefault(cms, value, locale);
if (defaultValue != null) {
// only if there is a default value available use it to overwrite the initial default
value.setStringValue(cms, defaultValue);
}
}
}
return root;
} | [
"public",
"Element",
"createDefaultXml",
"(",
"CmsObject",
"cms",
",",
"I_CmsXmlDocument",
"document",
",",
"Element",
"root",
",",
"Locale",
"locale",
")",
"{",
"Iterator",
"<",
"I_CmsXmlSchemaType",
">",
"i",
"=",
"m_typeSequence",
".",
"iterator",
"(",
")",
... | Generates the default XML content for this content definition, and append it to the given root element.<p>
Please note: The default values for the annotations are read from the content definition of the given
document. For a nested content definitions, this means that all defaults are set in the annotations of the
"outer" or "main" content definition.<p>
@param cms the current users OpenCms context
@param document the OpenCms XML document the XML is created for
@param root the node of the document where to append the generated XML to
@param locale the locale to create the default element in the document with
@return the default XML content for this content definition, and append it to the given root element | [
"Generates",
"the",
"default",
"XML",
"content",
"for",
"this",
"content",
"definition",
"and",
"append",
"it",
"to",
"the",
"given",
"root",
"element",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/CmsXmlContentDefinition.java#L1186-L1204 |
Azure/azure-sdk-for-java | logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/WorkflowRunActionsInner.java | WorkflowRunActionsInner.listAsync | public Observable<Page<WorkflowRunActionInner>> listAsync(final String resourceGroupName, final String workflowName, final String runName, final Integer top, final String filter) {
return listWithServiceResponseAsync(resourceGroupName, workflowName, runName, top, filter)
.map(new Func1<ServiceResponse<Page<WorkflowRunActionInner>>, Page<WorkflowRunActionInner>>() {
@Override
public Page<WorkflowRunActionInner> call(ServiceResponse<Page<WorkflowRunActionInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<WorkflowRunActionInner>> listAsync(final String resourceGroupName, final String workflowName, final String runName, final Integer top, final String filter) {
return listWithServiceResponseAsync(resourceGroupName, workflowName, runName, top, filter)
.map(new Func1<ServiceResponse<Page<WorkflowRunActionInner>>, Page<WorkflowRunActionInner>>() {
@Override
public Page<WorkflowRunActionInner> call(ServiceResponse<Page<WorkflowRunActionInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"WorkflowRunActionInner",
">",
">",
"listAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"workflowName",
",",
"final",
"String",
"runName",
",",
"final",
"Integer",
"top",
",",
"final",
"Stri... | Gets a list of workflow run actions.
@param resourceGroupName The resource group name.
@param workflowName The workflow name.
@param runName The workflow run name.
@param top The number of items to be included in the result.
@param filter The filter to apply on the operation. Options for filters include: Status.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<WorkflowRunActionInner> object | [
"Gets",
"a",
"list",
"of",
"workflow",
"run",
"actions",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/WorkflowRunActionsInner.java#L263-L271 |
JRebirth/JRebirth | org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/ui/AbstractView.java | AbstractView.addHandler | private void addHandler(final EventTarget target, final Annotation annotation) throws CoreException {
// Build the auto event handler for this annotation
final AnnotationEventHandler<Event> aeh = new AnnotationEventHandler<>(this.callbackObject, annotation);
for (final EnumEventType eet : (EnumEventType[]) ClassUtility.getAnnotationAttribute(annotation, "value")) {
if (target instanceof Node) {
((Node) target).addEventHandler(eet.eventType(), aeh);
} else if (target instanceof MenuItem) {
if (eet.eventType() == ActionEvent.ACTION) {
((MenuItem) target).addEventHandler(ActionEvent.ACTION, new AnnotationEventHandler<>(this.callbackObject, annotation));
} else {
((MenuItem) target).setOnMenuValidation(aeh);
}
} else if (target instanceof Window) {
((Window) target).addEventHandler(eet.eventType(), aeh);
}
}
} | java | private void addHandler(final EventTarget target, final Annotation annotation) throws CoreException {
// Build the auto event handler for this annotation
final AnnotationEventHandler<Event> aeh = new AnnotationEventHandler<>(this.callbackObject, annotation);
for (final EnumEventType eet : (EnumEventType[]) ClassUtility.getAnnotationAttribute(annotation, "value")) {
if (target instanceof Node) {
((Node) target).addEventHandler(eet.eventType(), aeh);
} else if (target instanceof MenuItem) {
if (eet.eventType() == ActionEvent.ACTION) {
((MenuItem) target).addEventHandler(ActionEvent.ACTION, new AnnotationEventHandler<>(this.callbackObject, annotation));
} else {
((MenuItem) target).setOnMenuValidation(aeh);
}
} else if (target instanceof Window) {
((Window) target).addEventHandler(eet.eventType(), aeh);
}
}
} | [
"private",
"void",
"addHandler",
"(",
"final",
"EventTarget",
"target",
",",
"final",
"Annotation",
"annotation",
")",
"throws",
"CoreException",
"{",
"// Build the auto event handler for this annotation",
"final",
"AnnotationEventHandler",
"<",
"Event",
">",
"aeh",
"=",
... | Add an event handler on the given node according to annotation OnXxxxx.
@param target the graphical node, must be not null (is a subtype of EventTarget)
@param annotation the OnXxxx annotation
@throws CoreException if an error occurred while linking the event handler | [
"Add",
"an",
"event",
"handler",
"on",
"the",
"given",
"node",
"according",
"to",
"annotation",
"OnXxxxx",
"."
] | train | https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/ui/AbstractView.java#L322-L343 |
hawkular/hawkular-agent | hawkular-javaagent/src/main/java/org/hawkular/agent/javaagent/config/StringPropertyReplacer.java | StringPropertyReplacer.resolveCompositeKey | private static String resolveCompositeKey(String key, Properties props) {
String value = null;
// Look for the comma
int comma = key.indexOf(',');
if (comma > -1) {
// If we have a first part, try resolve it
if (comma > 0) {
// Check the first part
String key1 = key.substring(0, comma);
value = getReplacementString(key1, props);
}
// Check the second part, if there is one and first lookup failed
if (value == null && comma < key.length() - 1) {
String key2 = key.substring(comma + 1);
value = getReplacementString(key2, props);
}
}
// Return whatever we've found or null
return value;
} | java | private static String resolveCompositeKey(String key, Properties props) {
String value = null;
// Look for the comma
int comma = key.indexOf(',');
if (comma > -1) {
// If we have a first part, try resolve it
if (comma > 0) {
// Check the first part
String key1 = key.substring(0, comma);
value = getReplacementString(key1, props);
}
// Check the second part, if there is one and first lookup failed
if (value == null && comma < key.length() - 1) {
String key2 = key.substring(comma + 1);
value = getReplacementString(key2, props);
}
}
// Return whatever we've found or null
return value;
} | [
"private",
"static",
"String",
"resolveCompositeKey",
"(",
"String",
"key",
",",
"Properties",
"props",
")",
"{",
"String",
"value",
"=",
"null",
";",
"// Look for the comma",
"int",
"comma",
"=",
"key",
".",
"indexOf",
"(",
"'",
"'",
")",
";",
"if",
"(",
... | Try to resolve a "key" from the provided properties by
checking if it is actually a "key1,key2", in which case
try first "key1", then "key2". If all fails, return null.
It also accepts "key1," and ",key2".
@param key the key to resolve
@param props the properties to use
@return the resolved key or null | [
"Try",
"to",
"resolve",
"a",
"key",
"from",
"the",
"provided",
"properties",
"by",
"checking",
"if",
"it",
"is",
"actually",
"a",
"key1",
"key2",
"in",
"which",
"case",
"try",
"first",
"key1",
"then",
"key2",
".",
"If",
"all",
"fails",
"return",
"null",
... | train | https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-javaagent/src/main/java/org/hawkular/agent/javaagent/config/StringPropertyReplacer.java#L236-L256 |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/alg/transform/ii/IntegralImageOps.java | IntegralImageOps.block_unsafe | public static long block_unsafe(GrayS64 integral , int x0 , int y0 , int x1 , int y1 )
{
return ImplIntegralImageOps.block_unsafe(integral, x0, y0, x1, y1);
} | java | public static long block_unsafe(GrayS64 integral , int x0 , int y0 , int x1 , int y1 )
{
return ImplIntegralImageOps.block_unsafe(integral, x0, y0, x1, y1);
} | [
"public",
"static",
"long",
"block_unsafe",
"(",
"GrayS64",
"integral",
",",
"int",
"x0",
",",
"int",
"y0",
",",
"int",
"x1",
",",
"int",
"y1",
")",
"{",
"return",
"ImplIntegralImageOps",
".",
"block_unsafe",
"(",
"integral",
",",
"x0",
",",
"y0",
",",
... | <p>
Computes the value of a block inside an integral image without bounds checking. The block is
defined as follows: x0 < x ≤ x1 and y0 < y ≤ y1.
</p>
@param integral Integral image.
@param x0 Lower bound of the block. Exclusive.
@param y0 Lower bound of the block. Exclusive.
@param x1 Upper bound of the block. Inclusive.
@param y1 Upper bound of the block. Inclusive.
@return Value inside the block. | [
"<p",
">",
"Computes",
"the",
"value",
"of",
"a",
"block",
"inside",
"an",
"integral",
"image",
"without",
"bounds",
"checking",
".",
"The",
"block",
"is",
"defined",
"as",
"follows",
":",
"x0",
"<",
";",
"x",
"&le",
";",
"x1",
"and",
"y0",
"<",
... | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/transform/ii/IntegralImageOps.java#L426-L429 |
apache/incubator-shardingsphere | sharding-jdbc/sharding-jdbc-orchestration/src/main/java/org/apache/shardingsphere/shardingjdbc/orchestration/api/OrchestrationShardingDataSourceFactory.java | OrchestrationShardingDataSourceFactory.createDataSource | public static DataSource createDataSource(final Map<String, DataSource> dataSourceMap, final ShardingRuleConfiguration shardingRuleConfig,
final Properties props, final OrchestrationConfiguration orchestrationConfig) throws SQLException {
if (null == shardingRuleConfig || shardingRuleConfig.getTableRuleConfigs().isEmpty()) {
return createDataSource(orchestrationConfig);
}
ShardingDataSource shardingDataSource = new ShardingDataSource(dataSourceMap, new ShardingRule(shardingRuleConfig, dataSourceMap.keySet()), props);
return new OrchestrationShardingDataSource(shardingDataSource, orchestrationConfig);
} | java | public static DataSource createDataSource(final Map<String, DataSource> dataSourceMap, final ShardingRuleConfiguration shardingRuleConfig,
final Properties props, final OrchestrationConfiguration orchestrationConfig) throws SQLException {
if (null == shardingRuleConfig || shardingRuleConfig.getTableRuleConfigs().isEmpty()) {
return createDataSource(orchestrationConfig);
}
ShardingDataSource shardingDataSource = new ShardingDataSource(dataSourceMap, new ShardingRule(shardingRuleConfig, dataSourceMap.keySet()), props);
return new OrchestrationShardingDataSource(shardingDataSource, orchestrationConfig);
} | [
"public",
"static",
"DataSource",
"createDataSource",
"(",
"final",
"Map",
"<",
"String",
",",
"DataSource",
">",
"dataSourceMap",
",",
"final",
"ShardingRuleConfiguration",
"shardingRuleConfig",
",",
"final",
"Properties",
"props",
",",
"final",
"OrchestrationConfigura... | Create sharding data source.
@param dataSourceMap data source map
@param shardingRuleConfig sharding rule configuration
@param orchestrationConfig orchestration configuration
@param props properties for data source
@return sharding data source
@throws SQLException SQL exception | [
"Create",
"sharding",
"data",
"source",
"."
] | train | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-jdbc/sharding-jdbc-orchestration/src/main/java/org/apache/shardingsphere/shardingjdbc/orchestration/api/OrchestrationShardingDataSourceFactory.java#L51-L58 |
BoltsFramework/Bolts-Android | bolts-tasks/src/main/java/bolts/Task.java | Task.continueWhile | public Task<Void> continueWhile(Callable<Boolean> predicate,
Continuation<Void, Task<Void>> continuation) {
return continueWhile(predicate, continuation, IMMEDIATE_EXECUTOR, null);
} | java | public Task<Void> continueWhile(Callable<Boolean> predicate,
Continuation<Void, Task<Void>> continuation) {
return continueWhile(predicate, continuation, IMMEDIATE_EXECUTOR, null);
} | [
"public",
"Task",
"<",
"Void",
">",
"continueWhile",
"(",
"Callable",
"<",
"Boolean",
">",
"predicate",
",",
"Continuation",
"<",
"Void",
",",
"Task",
"<",
"Void",
">",
">",
"continuation",
")",
"{",
"return",
"continueWhile",
"(",
"predicate",
",",
"conti... | Continues a task with the equivalent of a Task-based while loop, where the body of the loop is
a task continuation. | [
"Continues",
"a",
"task",
"with",
"the",
"equivalent",
"of",
"a",
"Task",
"-",
"based",
"while",
"loop",
"where",
"the",
"body",
"of",
"the",
"loop",
"is",
"a",
"task",
"continuation",
"."
] | train | https://github.com/BoltsFramework/Bolts-Android/blob/54e9cb8bdd4950aa4d418dcbc0ea65414762aef5/bolts-tasks/src/main/java/bolts/Task.java#L576-L579 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/accesslayer/sql/SqlQueryStatement.java | SqlQueryStatement.appendExistsCriteria | private void appendExistsCriteria(ExistsCriteria c, StringBuffer buf)
{
Query subQuery = (Query) c.getValue();
buf.append(c.getClause());
appendSubQuery(subQuery, buf);
} | java | private void appendExistsCriteria(ExistsCriteria c, StringBuffer buf)
{
Query subQuery = (Query) c.getValue();
buf.append(c.getClause());
appendSubQuery(subQuery, buf);
} | [
"private",
"void",
"appendExistsCriteria",
"(",
"ExistsCriteria",
"c",
",",
"StringBuffer",
"buf",
")",
"{",
"Query",
"subQuery",
"=",
"(",
"Query",
")",
"c",
".",
"getValue",
"(",
")",
";",
"buf",
".",
"append",
"(",
"c",
".",
"getClause",
"(",
")",
"... | Answer the SQL-Clause for an ExistsCriteria
@param c ExistsCriteria | [
"Answer",
"the",
"SQL",
"-",
"Clause",
"for",
"an",
"ExistsCriteria"
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/accesslayer/sql/SqlQueryStatement.java#L711-L717 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/equals/EqualsHelper.java | EqualsHelper.identityEqual | public static <T> boolean identityEqual (@Nullable final T aObj1, @Nullable final T aObj2)
{
return aObj1 == aObj2;
} | java | public static <T> boolean identityEqual (@Nullable final T aObj1, @Nullable final T aObj2)
{
return aObj1 == aObj2;
} | [
"public",
"static",
"<",
"T",
">",
"boolean",
"identityEqual",
"(",
"@",
"Nullable",
"final",
"T",
"aObj1",
",",
"@",
"Nullable",
"final",
"T",
"aObj2",
")",
"{",
"return",
"aObj1",
"==",
"aObj2",
";",
"}"
] | The only place where objects are compared by identity.
@param aObj1
First object. May be <code>null</code>.
@param aObj2
Second object. May be <code>null</code>.
@return <code>true</code> if both objects are <code>null</code> or
reference the same object.
@param <T>
Type to check. | [
"The",
"only",
"place",
"where",
"objects",
"are",
"compared",
"by",
"identity",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/equals/EqualsHelper.java#L64-L67 |
jcuda/jcuda | JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java | JCudaDriver.cuTexRefGetFormat | public static int cuTexRefGetFormat(int pFormat[], int pNumChannels[], CUtexref hTexRef)
{
return checkResult(cuTexRefGetFormatNative(pFormat, pNumChannels, hTexRef));
} | java | public static int cuTexRefGetFormat(int pFormat[], int pNumChannels[], CUtexref hTexRef)
{
return checkResult(cuTexRefGetFormatNative(pFormat, pNumChannels, hTexRef));
} | [
"public",
"static",
"int",
"cuTexRefGetFormat",
"(",
"int",
"pFormat",
"[",
"]",
",",
"int",
"pNumChannels",
"[",
"]",
",",
"CUtexref",
"hTexRef",
")",
"{",
"return",
"checkResult",
"(",
"cuTexRefGetFormatNative",
"(",
"pFormat",
",",
"pNumChannels",
",",
"hTe... | Gets the format used by a texture reference.
<pre>
CUresult cuTexRefGetFormat (
CUarray_format* pFormat,
int* pNumChannels,
CUtexref hTexRef )
</pre>
<div>
<p>Gets the format used by a texture
reference. Returns in <tt>*pFormat</tt> and <tt>*pNumChannels</tt>
the format and number of components of the CUDA array bound to the
texture reference <tt>hTexRef</tt>. If <tt>pFormat</tt> or <tt>pNumChannels</tt> is NULL, it will be ignored.
</p>
</div>
@param pFormat Returned format
@param pNumChannels Returned number of components
@param hTexRef Texture reference
@return CUDA_SUCCESS, CUDA_ERROR_DEINITIALIZED, CUDA_ERROR_NOT_INITIALIZED,
CUDA_ERROR_INVALID_CONTEXT, CUDA_ERROR_INVALID_VALUE
@see JCudaDriver#cuTexRefSetAddress
@see JCudaDriver#cuTexRefSetAddress2D
@see JCudaDriver#cuTexRefSetAddressMode
@see JCudaDriver#cuTexRefSetArray
@see JCudaDriver#cuTexRefSetFilterMode
@see JCudaDriver#cuTexRefSetFlags
@see JCudaDriver#cuTexRefSetFormat
@see JCudaDriver#cuTexRefGetAddress
@see JCudaDriver#cuTexRefGetAddressMode
@see JCudaDriver#cuTexRefGetArray
@see JCudaDriver#cuTexRefGetFilterMode
@see JCudaDriver#cuTexRefGetFlags | [
"Gets",
"the",
"format",
"used",
"by",
"a",
"texture",
"reference",
"."
] | train | https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java#L10606-L10609 |
apiman/apiman | common/config/src/main/java/io/apiman/common/config/ConfigFileConfiguration.java | ConfigFileConfiguration.findConfigUrlInDirectory | protected static URL findConfigUrlInDirectory(File directory, String configName) {
if (directory.isDirectory()) {
File cfile = new File(directory, configName);
if (cfile.isFile()) {
try {
return cfile.toURI().toURL();
} catch (MalformedURLException e) {
throw new RuntimeException(e);
}
}
}
return null;
} | java | protected static URL findConfigUrlInDirectory(File directory, String configName) {
if (directory.isDirectory()) {
File cfile = new File(directory, configName);
if (cfile.isFile()) {
try {
return cfile.toURI().toURL();
} catch (MalformedURLException e) {
throw new RuntimeException(e);
}
}
}
return null;
} | [
"protected",
"static",
"URL",
"findConfigUrlInDirectory",
"(",
"File",
"directory",
",",
"String",
"configName",
")",
"{",
"if",
"(",
"directory",
".",
"isDirectory",
"(",
")",
")",
"{",
"File",
"cfile",
"=",
"new",
"File",
"(",
"directory",
",",
"configName... | Returns a URL to a file with the given name inside the given directory. | [
"Returns",
"a",
"URL",
"to",
"a",
"file",
"with",
"the",
"given",
"name",
"inside",
"the",
"given",
"directory",
"."
] | train | https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/common/config/src/main/java/io/apiman/common/config/ConfigFileConfiguration.java#L46-L58 |
Azure/azure-sdk-for-java | sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/EncryptionProtectorsInner.java | EncryptionProtectorsInner.beginCreateOrUpdateAsync | public Observable<EncryptionProtectorInner> beginCreateOrUpdateAsync(String resourceGroupName, String serverName, EncryptionProtectorInner parameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters).map(new Func1<ServiceResponse<EncryptionProtectorInner>, EncryptionProtectorInner>() {
@Override
public EncryptionProtectorInner call(ServiceResponse<EncryptionProtectorInner> response) {
return response.body();
}
});
} | java | public Observable<EncryptionProtectorInner> beginCreateOrUpdateAsync(String resourceGroupName, String serverName, EncryptionProtectorInner parameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters).map(new Func1<ServiceResponse<EncryptionProtectorInner>, EncryptionProtectorInner>() {
@Override
public EncryptionProtectorInner call(ServiceResponse<EncryptionProtectorInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"EncryptionProtectorInner",
">",
"beginCreateOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"EncryptionProtectorInner",
"parameters",
")",
"{",
"return",
"beginCreateOrUpdateWithServiceResponseAsync",
"(",
"r... | Updates an existing encryption protector.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param parameters The requested encryption protector resource state.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the EncryptionProtectorInner object | [
"Updates",
"an",
"existing",
"encryption",
"protector",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/EncryptionProtectorsInner.java#L411-L418 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/weights/WeightInitUtil.java | WeightInitUtil.initWeights | public static INDArray initWeights(double fanIn, double fanOut, long[] shape, WeightInit initScheme,
Distribution dist, INDArray paramView) {
return initWeights(fanIn, fanOut, shape, initScheme, dist, DEFAULT_WEIGHT_INIT_ORDER, paramView);
} | java | public static INDArray initWeights(double fanIn, double fanOut, long[] shape, WeightInit initScheme,
Distribution dist, INDArray paramView) {
return initWeights(fanIn, fanOut, shape, initScheme, dist, DEFAULT_WEIGHT_INIT_ORDER, paramView);
} | [
"public",
"static",
"INDArray",
"initWeights",
"(",
"double",
"fanIn",
",",
"double",
"fanOut",
",",
"long",
"[",
"]",
"shape",
",",
"WeightInit",
"initScheme",
",",
"Distribution",
"dist",
",",
"INDArray",
"paramView",
")",
"{",
"return",
"initWeights",
"(",
... | Initializes a matrix with the given weight initialization scheme.
Note: Defaults to fortran ('f') order arrays for the weights. Use {@link #initWeights(long[], WeightInit, Distribution, char, INDArray)}
to control this
@param shape the shape of the matrix
@param initScheme the scheme to use
@return a matrix of the specified dimensions with the specified
distribution based on the initialization scheme | [
"Initializes",
"a",
"matrix",
"with",
"the",
"given",
"weight",
"initialization",
"scheme",
".",
"Note",
":",
"Defaults",
"to",
"fortran",
"(",
"f",
")",
"order",
"arrays",
"for",
"the",
"weights",
".",
"Use",
"{",
"@link",
"#initWeights",
"(",
"long",
"[]... | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/weights/WeightInitUtil.java#L75-L78 |
alkacon/opencms-core | src/org/opencms/util/CmsRequestUtil.java | CmsRequestUtil.getCookieValue | public static String getCookieValue(Cookie[] cookies, String name) {
for (int i = 0; (cookies != null) && (i < cookies.length); i++) {
if (name.equalsIgnoreCase(cookies[i].getName())) {
return cookies[i].getValue();
}
}
return null;
} | java | public static String getCookieValue(Cookie[] cookies, String name) {
for (int i = 0; (cookies != null) && (i < cookies.length); i++) {
if (name.equalsIgnoreCase(cookies[i].getName())) {
return cookies[i].getValue();
}
}
return null;
} | [
"public",
"static",
"String",
"getCookieValue",
"(",
"Cookie",
"[",
"]",
"cookies",
",",
"String",
"name",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"(",
"cookies",
"!=",
"null",
")",
"&&",
"(",
"i",
"<",
"cookies",
".",
"length",
")",
";",
... | Gets the value of a specific cookie from an array of cookies.<p>
@param cookies the cookie array
@param name the name of the cookie we want
@return the cookie value, or null if cookie with the given name wasn't found | [
"Gets",
"the",
"value",
"of",
"a",
"specific",
"cookie",
"from",
"an",
"array",
"of",
"cookies",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/util/CmsRequestUtil.java#L560-L568 |
ops4j/org.ops4j.pax.logging | pax-logging-api/src/main/java/org/jboss/logging/Logger.java | Logger.getMessageLogger | public static <T> T getMessageLogger(Class<T> type, String category) {
return getMessageLogger(type, category, Locale.getDefault());
} | java | public static <T> T getMessageLogger(Class<T> type, String category) {
return getMessageLogger(type, category, Locale.getDefault());
} | [
"public",
"static",
"<",
"T",
">",
"T",
"getMessageLogger",
"(",
"Class",
"<",
"T",
">",
"type",
",",
"String",
"category",
")",
"{",
"return",
"getMessageLogger",
"(",
"type",
",",
"category",
",",
"Locale",
".",
"getDefault",
"(",
")",
")",
";",
"}"
... | Get a typed logger which implements the given interface. The current default locale will be used for the new logger.
@param type the interface to implement
@param category the logger category
@param <T> the logger type
@return the typed logger | [
"Get",
"a",
"typed",
"logger",
"which",
"implements",
"the",
"given",
"interface",
".",
"The",
"current",
"default",
"locale",
"will",
"be",
"used",
"for",
"the",
"new",
"logger",
"."
] | train | https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/jboss/logging/Logger.java#L2506-L2508 |
lightbend/config | config/src/main/java/com/typesafe/config/ConfigFactory.java | ConfigFactory.parseResourcesAnySyntax | public static Config parseResourcesAnySyntax(Class<?> klass, String resourceBasename) {
return parseResourcesAnySyntax(klass, resourceBasename, ConfigParseOptions.defaults());
} | java | public static Config parseResourcesAnySyntax(Class<?> klass, String resourceBasename) {
return parseResourcesAnySyntax(klass, resourceBasename, ConfigParseOptions.defaults());
} | [
"public",
"static",
"Config",
"parseResourcesAnySyntax",
"(",
"Class",
"<",
"?",
">",
"klass",
",",
"String",
"resourceBasename",
")",
"{",
"return",
"parseResourcesAnySyntax",
"(",
"klass",
",",
"resourceBasename",
",",
"ConfigParseOptions",
".",
"defaults",
"(",
... | Like {@link #parseResourcesAnySyntax(Class,String,ConfigParseOptions)}
but always uses default parse options.
@param klass
<code>klass.getClassLoader()</code> will be used to load
resources, and non-absolute resource names will have this
class's package added
@param resourceBasename
a resource name as in {@link java.lang.Class#getResource},
with or without extension
@return the parsed configuration | [
"Like",
"{",
"@link",
"#parseResourcesAnySyntax",
"(",
"Class",
"String",
"ConfigParseOptions",
")",
"}",
"but",
"always",
"uses",
"default",
"parse",
"options",
"."
] | train | https://github.com/lightbend/config/blob/68cebfde5e861e9a5fdc75ceff366ed95e17d475/config/src/main/java/com/typesafe/config/ConfigFactory.java#L907-L909 |
undertow-io/undertow | core/src/main/java/io/undertow/util/WorkerUtils.java | WorkerUtils.executeAfter | public static XnioExecutor.Key executeAfter(XnioIoThread thread, Runnable task, long timeout, TimeUnit timeUnit) {
try {
return thread.executeAfter(task, timeout, timeUnit);
} catch (RejectedExecutionException e) {
if(thread.getWorker().isShutdown()) {
UndertowLogger.ROOT_LOGGER.debugf(e, "Failed to schedule task %s as worker is shutting down", task);
//we just return a bogus key in this case
return new XnioExecutor.Key() {
@Override
public boolean remove() {
return false;
}
};
} else {
throw e;
}
}
} | java | public static XnioExecutor.Key executeAfter(XnioIoThread thread, Runnable task, long timeout, TimeUnit timeUnit) {
try {
return thread.executeAfter(task, timeout, timeUnit);
} catch (RejectedExecutionException e) {
if(thread.getWorker().isShutdown()) {
UndertowLogger.ROOT_LOGGER.debugf(e, "Failed to schedule task %s as worker is shutting down", task);
//we just return a bogus key in this case
return new XnioExecutor.Key() {
@Override
public boolean remove() {
return false;
}
};
} else {
throw e;
}
}
} | [
"public",
"static",
"XnioExecutor",
".",
"Key",
"executeAfter",
"(",
"XnioIoThread",
"thread",
",",
"Runnable",
"task",
",",
"long",
"timeout",
",",
"TimeUnit",
"timeUnit",
")",
"{",
"try",
"{",
"return",
"thread",
".",
"executeAfter",
"(",
"task",
",",
"tim... | Schedules a task for future execution. If the execution is rejected because the worker is shutting
down then it is logged at debug level and the exception is not re-thrown
@param thread The IO thread
@param task The task to execute
@param timeout The timeout
@param timeUnit The time unit | [
"Schedules",
"a",
"task",
"for",
"future",
"execution",
".",
"If",
"the",
"execution",
"is",
"rejected",
"because",
"the",
"worker",
"is",
"shutting",
"down",
"then",
"it",
"is",
"logged",
"at",
"debug",
"level",
"and",
"the",
"exception",
"is",
"not",
"re... | train | https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/util/WorkerUtils.java#L44-L61 |
naver/android-utilset | UtilSet/src/com/navercorp/utilset/network/NetworkMonitor.java | NetworkMonitor.isWifiFake | public boolean isWifiFake(String ipAddress, int port) {
SocketChannel socketChannel = null;
try {
socketChannel = SocketChannel.open();
socketChannel.connect(new InetSocketAddress(ipAddress, port));
} catch (IOException e) {
Log.d(TAG, "Current Wifi is stupid!!! by IOException");
return true;
} catch (UnresolvedAddressException e) {
Log.d(TAG, "Current Wifi is stupid!!! by InetSocketAddress");
return true;
} finally {
if (socketChannel != null)
try {
socketChannel.close();
} catch (IOException e) {
Log.d(TAG, "Error occured while closing SocketChannel");
}
}
return false;
} | java | public boolean isWifiFake(String ipAddress, int port) {
SocketChannel socketChannel = null;
try {
socketChannel = SocketChannel.open();
socketChannel.connect(new InetSocketAddress(ipAddress, port));
} catch (IOException e) {
Log.d(TAG, "Current Wifi is stupid!!! by IOException");
return true;
} catch (UnresolvedAddressException e) {
Log.d(TAG, "Current Wifi is stupid!!! by InetSocketAddress");
return true;
} finally {
if (socketChannel != null)
try {
socketChannel.close();
} catch (IOException e) {
Log.d(TAG, "Error occured while closing SocketChannel");
}
}
return false;
} | [
"public",
"boolean",
"isWifiFake",
"(",
"String",
"ipAddress",
",",
"int",
"port",
")",
"{",
"SocketChannel",
"socketChannel",
"=",
"null",
";",
"try",
"{",
"socketChannel",
"=",
"SocketChannel",
".",
"open",
"(",
")",
";",
"socketChannel",
".",
"connect",
"... | Checks if currently connected Access Point is either rogue or incapable
of routing packet
@param ipAddress
Any valid IP addresses will work to check if the device is
connected to properly working AP
@param port
Port number bound with ipAddress parameter
@return true if currently connected AP is not working normally; false
otherwise | [
"Checks",
"if",
"currently",
"connected",
"Access",
"Point",
"is",
"either",
"rogue",
"or",
"incapable",
"of",
"routing",
"packet"
] | train | https://github.com/naver/android-utilset/blob/4af5f821466bc5bec4ea221ca6d87e0ac9b87e0b/UtilSet/src/com/navercorp/utilset/network/NetworkMonitor.java#L756-L776 |
lessthanoptimal/BoofCV | integration/boofcv-swing/src/main/java/boofcv/gui/ListDisplayPanel.java | ListDisplayPanel.addItem | public synchronized void addItem( final JComponent panel , final String name ) {
Dimension panelD = panel.getPreferredSize();
final boolean sizeChanged = bodyWidth != panelD.width || bodyHeight != panelD.height;
// make the preferred size large enough to hold all the images
bodyWidth = (int)Math.max(bodyWidth, panelD.getWidth());
bodyHeight = (int)Math.max(bodyHeight,panelD.getHeight());
panels.add(panel);
SwingUtilities.invokeLater(new Runnable() {
public void run() {
listModel.addElement(name);
if (listModel.size() == 1) {
listPanel.setSelectedIndex(0);
}
// update the list's size
Dimension d = listPanel.getMinimumSize();
listPanel.setPreferredSize(new Dimension(d.width + scroll.getVerticalScrollBar().getWidth(), d.height));
// make sure it's preferred size is up to date
if( sizeChanged ) {
Component old = ((BorderLayout) bodyPanel.getLayout()).getLayoutComponent(BorderLayout.CENTER);
if (old != null) {
old.setPreferredSize(new Dimension(bodyWidth, bodyHeight));
}
}
validate();
}
});
} | java | public synchronized void addItem( final JComponent panel , final String name ) {
Dimension panelD = panel.getPreferredSize();
final boolean sizeChanged = bodyWidth != panelD.width || bodyHeight != panelD.height;
// make the preferred size large enough to hold all the images
bodyWidth = (int)Math.max(bodyWidth, panelD.getWidth());
bodyHeight = (int)Math.max(bodyHeight,panelD.getHeight());
panels.add(panel);
SwingUtilities.invokeLater(new Runnable() {
public void run() {
listModel.addElement(name);
if (listModel.size() == 1) {
listPanel.setSelectedIndex(0);
}
// update the list's size
Dimension d = listPanel.getMinimumSize();
listPanel.setPreferredSize(new Dimension(d.width + scroll.getVerticalScrollBar().getWidth(), d.height));
// make sure it's preferred size is up to date
if( sizeChanged ) {
Component old = ((BorderLayout) bodyPanel.getLayout()).getLayoutComponent(BorderLayout.CENTER);
if (old != null) {
old.setPreferredSize(new Dimension(bodyWidth, bodyHeight));
}
}
validate();
}
});
} | [
"public",
"synchronized",
"void",
"addItem",
"(",
"final",
"JComponent",
"panel",
",",
"final",
"String",
"name",
")",
"{",
"Dimension",
"panelD",
"=",
"panel",
".",
"getPreferredSize",
"(",
")",
";",
"final",
"boolean",
"sizeChanged",
"=",
"bodyWidth",
"!=",
... | Displays a new JPanel in the list.
@param panel The panel being displayed
@param name Name of the image. Shown in the list. | [
"Displays",
"a",
"new",
"JPanel",
"in",
"the",
"list",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/integration/boofcv-swing/src/main/java/boofcv/gui/ListDisplayPanel.java#L115-L146 |
Azure/azure-sdk-for-java | mediaservices/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/implementation/JobsInner.java | JobsInner.updateAsync | public Observable<JobInner> updateAsync(String resourceGroupName, String accountName, String transformName, String jobName, JobInner parameters) {
return updateWithServiceResponseAsync(resourceGroupName, accountName, transformName, jobName, parameters).map(new Func1<ServiceResponse<JobInner>, JobInner>() {
@Override
public JobInner call(ServiceResponse<JobInner> response) {
return response.body();
}
});
} | java | public Observable<JobInner> updateAsync(String resourceGroupName, String accountName, String transformName, String jobName, JobInner parameters) {
return updateWithServiceResponseAsync(resourceGroupName, accountName, transformName, jobName, parameters).map(new Func1<ServiceResponse<JobInner>, JobInner>() {
@Override
public JobInner call(ServiceResponse<JobInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"JobInner",
">",
"updateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
",",
"String",
"transformName",
",",
"String",
"jobName",
",",
"JobInner",
"parameters",
")",
"{",
"return",
"updateWithServiceResponseAsync"... | Update Job.
Update is only supported for description and priority. Updating Priority will take effect when the Job state is Queued or Scheduled and depending on the timing the priority update may be ignored.
@param resourceGroupName The name of the resource group within the Azure subscription.
@param accountName The Media Services account name.
@param transformName The Transform name.
@param jobName The Job name.
@param parameters The request parameters
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the JobInner object | [
"Update",
"Job",
".",
"Update",
"is",
"only",
"supported",
"for",
"description",
"and",
"priority",
".",
"Updating",
"Priority",
"will",
"take",
"effect",
"when",
"the",
"Job",
"state",
"is",
"Queued",
"or",
"Scheduled",
"and",
"depending",
"on",
"the",
"tim... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mediaservices/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/implementation/JobsInner.java#L741-L748 |
elki-project/elki | elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/gdbscan/LSDBC.java | LSDBC.isLocalMaximum | private boolean isLocalMaximum(double kdist, DBIDs neighbors, WritableDoubleDataStore kdists) {
for(DBIDIter it = neighbors.iter(); it.valid(); it.advance()) {
if(kdists.doubleValue(it) < kdist) {
return false;
}
}
return true;
} | java | private boolean isLocalMaximum(double kdist, DBIDs neighbors, WritableDoubleDataStore kdists) {
for(DBIDIter it = neighbors.iter(); it.valid(); it.advance()) {
if(kdists.doubleValue(it) < kdist) {
return false;
}
}
return true;
} | [
"private",
"boolean",
"isLocalMaximum",
"(",
"double",
"kdist",
",",
"DBIDs",
"neighbors",
",",
"WritableDoubleDataStore",
"kdists",
")",
"{",
"for",
"(",
"DBIDIter",
"it",
"=",
"neighbors",
".",
"iter",
"(",
")",
";",
"it",
".",
"valid",
"(",
")",
";",
... | Test if a point is a local density maximum.
@param kdist k-distance of current
@param neighbors Neighbor points
@param kdists kNN distances
@return {@code true} when the point is a local maximum | [
"Test",
"if",
"a",
"point",
"is",
"a",
"local",
"density",
"maximum",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/gdbscan/LSDBC.java#L222-L229 |
podio/podio-java | src/main/java/com/podio/task/TaskAPI.java | TaskAPI.assignTask | public void assignTask(int taskId, int responsible) {
getResourceFactory()
.getApiResource("/task/" + taskId + "/assign")
.entity(new AssignValue(responsible),
MediaType.APPLICATION_JSON_TYPE).post();
} | java | public void assignTask(int taskId, int responsible) {
getResourceFactory()
.getApiResource("/task/" + taskId + "/assign")
.entity(new AssignValue(responsible),
MediaType.APPLICATION_JSON_TYPE).post();
} | [
"public",
"void",
"assignTask",
"(",
"int",
"taskId",
",",
"int",
"responsible",
")",
"{",
"getResourceFactory",
"(",
")",
".",
"getApiResource",
"(",
"\"/task/\"",
"+",
"taskId",
"+",
"\"/assign\"",
")",
".",
"entity",
"(",
"new",
"AssignValue",
"(",
"respo... | Assigns the task to another user. This makes the user responsible for the
task and its completion.
@param taskId
The id of the task to assign
@param responsible
The id of the user the task should be assigned to | [
"Assigns",
"the",
"task",
"to",
"another",
"user",
".",
"This",
"makes",
"the",
"user",
"responsible",
"for",
"the",
"task",
"and",
"its",
"completion",
"."
] | train | https://github.com/podio/podio-java/blob/a520b23bac118c957ce02cdd8ff42a6c7d17b49a/src/main/java/com/podio/task/TaskAPI.java#L77-L82 |
QSFT/Doradus | doradus-client/src/main/java/com/dell/doradus/client/SpiderSession.java | SpiderSession.createBatchResult | private BatchResult createBatchResult(RESTResponse response, DBObjectBatch dbObjBatch) {
// See what kind of message payload, if any, we received.
BatchResult result = null;
if (response.getCode().isError()) {
String errMsg = response.getBody();
if (errMsg.length() == 0) {
errMsg = "Unknown error; response code=" + response.getCode();
}
result = BatchResult.newErrorResult(errMsg);
} else {
result = new BatchResult(getUNodeResult(response));
copyObjectIDsToBatch(result, dbObjBatch);
}
return result;
} | java | private BatchResult createBatchResult(RESTResponse response, DBObjectBatch dbObjBatch) {
// See what kind of message payload, if any, we received.
BatchResult result = null;
if (response.getCode().isError()) {
String errMsg = response.getBody();
if (errMsg.length() == 0) {
errMsg = "Unknown error; response code=" + response.getCode();
}
result = BatchResult.newErrorResult(errMsg);
} else {
result = new BatchResult(getUNodeResult(response));
copyObjectIDsToBatch(result, dbObjBatch);
}
return result;
} | [
"private",
"BatchResult",
"createBatchResult",
"(",
"RESTResponse",
"response",
",",
"DBObjectBatch",
"dbObjBatch",
")",
"{",
"// See what kind of message payload, if any, we received.\r",
"BatchResult",
"result",
"=",
"null",
";",
"if",
"(",
"response",
".",
"getCode",
"... | Extract the BatchResult from the given RESTResponse. Could be an error. | [
"Extract",
"the",
"BatchResult",
"from",
"the",
"given",
"RESTResponse",
".",
"Could",
"be",
"an",
"error",
"."
] | train | https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-client/src/main/java/com/dell/doradus/client/SpiderSession.java#L534-L548 |
Mozu/mozu-java | mozu-javaasync-core/src/main/java/com/mozu/api/urls/platform/ReferenceDataUrl.java | ReferenceDataUrl.getBehaviorCategoryUrl | public static MozuUrl getBehaviorCategoryUrl(Integer categoryId, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/platform/reference/behaviors/categories/{categoryId}?responseFields={responseFields}");
formatter.formatUrl("categoryId", categoryId);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.HOME_POD) ;
} | java | public static MozuUrl getBehaviorCategoryUrl(Integer categoryId, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/platform/reference/behaviors/categories/{categoryId}?responseFields={responseFields}");
formatter.formatUrl("categoryId", categoryId);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.HOME_POD) ;
} | [
"public",
"static",
"MozuUrl",
"getBehaviorCategoryUrl",
"(",
"Integer",
"categoryId",
",",
"String",
"responseFields",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
"(",
"\"/api/platform/reference/behaviors/categories/{categoryId}?responseFields={responseFie... | Get Resource Url for GetBehaviorCategory
@param categoryId Unique identifier of the category to modify.
@param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss.
@return String Resource Url | [
"Get",
"Resource",
"Url",
"for",
"GetBehaviorCategory"
] | train | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-javaasync-core/src/main/java/com/mozu/api/urls/platform/ReferenceDataUrl.java#L62-L68 |
dlemmermann/CalendarFX | CalendarFXView/src/main/java/com/calendarfx/model/Interval.java | Interval.withDates | public Interval withDates(LocalDate startDate, LocalDate endDate) {
requireNonNull(startDate);
requireNonNull(endDate);
return new Interval(startDate, this.startTime, endDate, this.endTime, this.zoneId);
} | java | public Interval withDates(LocalDate startDate, LocalDate endDate) {
requireNonNull(startDate);
requireNonNull(endDate);
return new Interval(startDate, this.startTime, endDate, this.endTime, this.zoneId);
} | [
"public",
"Interval",
"withDates",
"(",
"LocalDate",
"startDate",
",",
"LocalDate",
"endDate",
")",
"{",
"requireNonNull",
"(",
"startDate",
")",
";",
"requireNonNull",
"(",
"endDate",
")",
";",
"return",
"new",
"Interval",
"(",
"startDate",
",",
"this",
".",
... | Returns a new interval based on this interval but with a different start
and end date.
@param startDate the new start date
@param endDate the new end date
@return a new interval | [
"Returns",
"a",
"new",
"interval",
"based",
"on",
"this",
"interval",
"but",
"with",
"a",
"different",
"start",
"and",
"end",
"date",
"."
] | train | https://github.com/dlemmermann/CalendarFX/blob/f2b91c2622c3f29d004485b6426b23b86c331f96/CalendarFXView/src/main/java/com/calendarfx/model/Interval.java#L278-L282 |
apache/flink | flink-core/src/main/java/org/apache/flink/core/memory/MemorySegmentFactory.java | MemorySegmentFactory.allocateUnpooledOffHeapMemory | public static MemorySegment allocateUnpooledOffHeapMemory(int size, Object owner) {
ByteBuffer memory = ByteBuffer.allocateDirect(size);
return wrapPooledOffHeapMemory(memory, owner);
} | java | public static MemorySegment allocateUnpooledOffHeapMemory(int size, Object owner) {
ByteBuffer memory = ByteBuffer.allocateDirect(size);
return wrapPooledOffHeapMemory(memory, owner);
} | [
"public",
"static",
"MemorySegment",
"allocateUnpooledOffHeapMemory",
"(",
"int",
"size",
",",
"Object",
"owner",
")",
"{",
"ByteBuffer",
"memory",
"=",
"ByteBuffer",
".",
"allocateDirect",
"(",
"size",
")",
";",
"return",
"wrapPooledOffHeapMemory",
"(",
"memory",
... | Allocates some unpooled off-heap memory and creates a new memory segment that
represents that memory.
@param size The size of the off-heap memory segment to allocate.
@param owner The owner to associate with the off-heap memory segment.
@return A new memory segment, backed by unpooled off-heap memory. | [
"Allocates",
"some",
"unpooled",
"off",
"-",
"heap",
"memory",
"and",
"creates",
"a",
"new",
"memory",
"segment",
"that",
"represents",
"that",
"memory",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/core/memory/MemorySegmentFactory.java#L85-L88 |
Impetus/Kundera | src/jpa-engine/core/src/main/java/com/impetus/kundera/validation/rules/AttributeConstraintRule.java | AttributeConstraintRule.validateMaxDecimal | private boolean validateMaxDecimal(Object validationObject, Annotation annotate)
{
if (validationObject != null)
{
try
{
if (checkvalidDeciDigitTypes(validationObject.getClass()))
{
BigDecimal maxValue = NumberUtils.createBigDecimal(((DecimalMax) annotate).value());
BigDecimal actualValue = NumberUtils.createBigDecimal(toString(validationObject));
int res = actualValue.compareTo(maxValue);
if (res > 0)
{
throwValidationException(((DecimalMax) annotate).message());
}
}
}
catch (NumberFormatException nfe)
{
throw new RuleValidationException(nfe.getMessage());
}
}
return true;
} | java | private boolean validateMaxDecimal(Object validationObject, Annotation annotate)
{
if (validationObject != null)
{
try
{
if (checkvalidDeciDigitTypes(validationObject.getClass()))
{
BigDecimal maxValue = NumberUtils.createBigDecimal(((DecimalMax) annotate).value());
BigDecimal actualValue = NumberUtils.createBigDecimal(toString(validationObject));
int res = actualValue.compareTo(maxValue);
if (res > 0)
{
throwValidationException(((DecimalMax) annotate).message());
}
}
}
catch (NumberFormatException nfe)
{
throw new RuleValidationException(nfe.getMessage());
}
}
return true;
} | [
"private",
"boolean",
"validateMaxDecimal",
"(",
"Object",
"validationObject",
",",
"Annotation",
"annotate",
")",
"{",
"if",
"(",
"validationObject",
"!=",
"null",
")",
"{",
"try",
"{",
"if",
"(",
"checkvalidDeciDigitTypes",
"(",
"validationObject",
".",
"getClas... | Checks whether a given value is a valid maximum decimal digit when compared to given value
or not
@param validationObject
@param annotate
@return | [
"Checks",
"whether",
"a",
"given",
"value",
"is",
"a",
"valid",
"maximum",
"decimal",
"digit",
"when",
"compared",
"to",
"given",
"value",
"or",
"not"
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/validation/rules/AttributeConstraintRule.java#L520-L545 |
wisdom-framework/wisdom | core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/utils/PluginExtractor.java | PluginExtractor.getBuildPluginVersion | public static String getBuildPluginVersion(AbstractWisdomMojo mojo, String plugin) {
List<Plugin> plugins = mojo.project.getBuildPlugins();
for (Plugin plug : plugins) {
if (plug.getArtifactId().equals(plugin)) {
return plug.getVersion();
}
}
// Not found.
return null;
} | java | public static String getBuildPluginVersion(AbstractWisdomMojo mojo, String plugin) {
List<Plugin> plugins = mojo.project.getBuildPlugins();
for (Plugin plug : plugins) {
if (plug.getArtifactId().equals(plugin)) {
return plug.getVersion();
}
}
// Not found.
return null;
} | [
"public",
"static",
"String",
"getBuildPluginVersion",
"(",
"AbstractWisdomMojo",
"mojo",
",",
"String",
"plugin",
")",
"{",
"List",
"<",
"Plugin",
">",
"plugins",
"=",
"mojo",
".",
"project",
".",
"getBuildPlugins",
"(",
")",
";",
"for",
"(",
"Plugin",
"plu... | Retrieves the plugin version from Maven Project.
@param mojo the mojo
@param plugin the artifact id of the plugin
@return the version, {@code null} if the Maven Project does not used the given plugin | [
"Retrieves",
"the",
"plugin",
"version",
"from",
"Maven",
"Project",
"."
] | train | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/utils/PluginExtractor.java#L43-L52 |
alkacon/opencms-core | src/org/opencms/file/CmsObject.java | CmsObject.readBestUrlName | public String readBestUrlName(CmsUUID id, Locale locale, List<Locale> defaultLocales) throws CmsException {
return m_securityManager.readBestUrlName(m_context, id, locale, defaultLocales);
} | java | public String readBestUrlName(CmsUUID id, Locale locale, List<Locale> defaultLocales) throws CmsException {
return m_securityManager.readBestUrlName(m_context, id, locale, defaultLocales);
} | [
"public",
"String",
"readBestUrlName",
"(",
"CmsUUID",
"id",
",",
"Locale",
"locale",
",",
"List",
"<",
"Locale",
">",
"defaultLocales",
")",
"throws",
"CmsException",
"{",
"return",
"m_securityManager",
".",
"readBestUrlName",
"(",
"m_context",
",",
"id",
",",
... | Reads the newest URL name which is mapped to the given structure id.<p>
If the structure id is not mapped to any name, null will be returned.<p>
@param id the structure id for which the newest mapped name should be returned
@param locale the locale for which the URL name should be selected if possible
@param defaultLocales the default locales which should be used if the locale is not available
@return an URL name or null
@throws CmsException if something goes wrong | [
"Reads",
"the",
"newest",
"URL",
"name",
"which",
"is",
"mapped",
"to",
"the",
"given",
"structure",
"id",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/CmsObject.java#L2360-L2363 |
Netflix/eureka | eureka-core/src/main/java/com/netflix/eureka/cluster/PeerEurekaNodes.java | PeerEurekaNodes.isInstanceURL | public boolean isInstanceURL(String url, InstanceInfo instance) {
String hostName = hostFromUrl(url);
String myInfoComparator = instance.getHostName();
if (clientConfig.getTransportConfig().applicationsResolverUseIp()) {
myInfoComparator = instance.getIPAddr();
}
return hostName != null && hostName.equals(myInfoComparator);
} | java | public boolean isInstanceURL(String url, InstanceInfo instance) {
String hostName = hostFromUrl(url);
String myInfoComparator = instance.getHostName();
if (clientConfig.getTransportConfig().applicationsResolverUseIp()) {
myInfoComparator = instance.getIPAddr();
}
return hostName != null && hostName.equals(myInfoComparator);
} | [
"public",
"boolean",
"isInstanceURL",
"(",
"String",
"url",
",",
"InstanceInfo",
"instance",
")",
"{",
"String",
"hostName",
"=",
"hostFromUrl",
"(",
"url",
")",
";",
"String",
"myInfoComparator",
"=",
"instance",
".",
"getHostName",
"(",
")",
";",
"if",
"("... | Checks if the given service url matches the supplied instance
@param url the service url of the replica node that the check is made.
@param instance the instance to check the service url against
@return true, if the url represents the supplied instance, false otherwise. | [
"Checks",
"if",
"the",
"given",
"service",
"url",
"matches",
"the",
"supplied",
"instance"
] | train | https://github.com/Netflix/eureka/blob/48446d956be09df6650a3c00b7ebd7e2d1e1544f/eureka-core/src/main/java/com/netflix/eureka/cluster/PeerEurekaNodes.java#L250-L257 |
ThreeTen/threetenbp | src/main/java/org/threeten/bp/Duration.java | Duration.plus | private Duration plus(long secondsToAdd, long nanosToAdd) {
if ((secondsToAdd | nanosToAdd) == 0) {
return this;
}
long epochSec = Jdk8Methods.safeAdd(seconds, secondsToAdd);
epochSec = Jdk8Methods.safeAdd(epochSec, nanosToAdd / NANOS_PER_SECOND);
nanosToAdd = nanosToAdd % NANOS_PER_SECOND;
long nanoAdjustment = nanos + nanosToAdd; // safe int+NANOS_PER_SECOND
return ofSeconds(epochSec, nanoAdjustment);
} | java | private Duration plus(long secondsToAdd, long nanosToAdd) {
if ((secondsToAdd | nanosToAdd) == 0) {
return this;
}
long epochSec = Jdk8Methods.safeAdd(seconds, secondsToAdd);
epochSec = Jdk8Methods.safeAdd(epochSec, nanosToAdd / NANOS_PER_SECOND);
nanosToAdd = nanosToAdd % NANOS_PER_SECOND;
long nanoAdjustment = nanos + nanosToAdd; // safe int+NANOS_PER_SECOND
return ofSeconds(epochSec, nanoAdjustment);
} | [
"private",
"Duration",
"plus",
"(",
"long",
"secondsToAdd",
",",
"long",
"nanosToAdd",
")",
"{",
"if",
"(",
"(",
"secondsToAdd",
"|",
"nanosToAdd",
")",
"==",
"0",
")",
"{",
"return",
"this",
";",
"}",
"long",
"epochSec",
"=",
"Jdk8Methods",
".",
"safeAd... | Returns a copy of this duration with the specified duration added.
<p>
This instance is immutable and unaffected by this method call.
@param secondsToAdd the seconds to add, positive or negative
@param nanosToAdd the nanos to add, positive or negative
@return a {@code Duration} based on this duration with the specified seconds added, not null
@throws ArithmeticException if numeric overflow occurs | [
"Returns",
"a",
"copy",
"of",
"this",
"duration",
"with",
"the",
"specified",
"duration",
"added",
".",
"<p",
">",
"This",
"instance",
"is",
"immutable",
"and",
"unaffected",
"by",
"this",
"method",
"call",
"."
] | train | https://github.com/ThreeTen/threetenbp/blob/5f05b649f89f205aabd96b2f83c36796ec616fe6/src/main/java/org/threeten/bp/Duration.java#L748-L757 |
liyiorg/weixin-popular | src/main/java/weixin/popular/api/BizwifiAPI.java | BizwifiAPI.shopClean | public static BaseResult shopClean(String accessToken, ShopInfo shopInfo) {
return shopClean(accessToken, JsonUtil.toJSONString(shopInfo));
} | java | public static BaseResult shopClean(String accessToken, ShopInfo shopInfo) {
return shopClean(accessToken, JsonUtil.toJSONString(shopInfo));
} | [
"public",
"static",
"BaseResult",
"shopClean",
"(",
"String",
"accessToken",
",",
"ShopInfo",
"shopInfo",
")",
"{",
"return",
"shopClean",
"(",
"accessToken",
",",
"JsonUtil",
".",
"toJSONString",
"(",
"shopInfo",
")",
")",
";",
"}"
] | Wi-Fi门店管理-清空门店网络及设备
@param accessToken accessToken
@param shopInfo shopInfo
@return BaseResult | [
"Wi",
"-",
"Fi门店管理",
"-",
"清空门店网络及设备"
] | train | https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/api/BizwifiAPI.java#L285-L287 |
vkostyukov/la4j | src/main/java/org/la4j/Vectors.java | Vectors.mkMinAccumulator | public static VectorAccumulator mkMinAccumulator() {
return new VectorAccumulator() {
private double result = Double.POSITIVE_INFINITY;
@Override
public void update(int i, double value) {
result = Math.min(result, value);
}
@Override
public double accumulate() {
double value = result;
result = Double.POSITIVE_INFINITY;
return value;
}
};
} | java | public static VectorAccumulator mkMinAccumulator() {
return new VectorAccumulator() {
private double result = Double.POSITIVE_INFINITY;
@Override
public void update(int i, double value) {
result = Math.min(result, value);
}
@Override
public double accumulate() {
double value = result;
result = Double.POSITIVE_INFINITY;
return value;
}
};
} | [
"public",
"static",
"VectorAccumulator",
"mkMinAccumulator",
"(",
")",
"{",
"return",
"new",
"VectorAccumulator",
"(",
")",
"{",
"private",
"double",
"result",
"=",
"Double",
".",
"POSITIVE_INFINITY",
";",
"@",
"Override",
"public",
"void",
"update",
"(",
"int",... | Makes a minimum vector accumulator that accumulates the minimum across vector elements.
@return a minimum vector accumulator | [
"Makes",
"a",
"minimum",
"vector",
"accumulator",
"that",
"accumulates",
"the",
"minimum",
"across",
"vector",
"elements",
"."
] | train | https://github.com/vkostyukov/la4j/blob/dd1b917caf9606399a49afa6b0d738934cd3a7b3/src/main/java/org/la4j/Vectors.java#L282-L298 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/UnImplNode.java | UnImplNode.getAttributeNS | public String getAttributeNS(String namespaceURI, String localName)
{
error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getAttributeNS not supported!");
return null;
} | java | public String getAttributeNS(String namespaceURI, String localName)
{
error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getAttributeNS not supported!");
return null;
} | [
"public",
"String",
"getAttributeNS",
"(",
"String",
"namespaceURI",
",",
"String",
"localName",
")",
"{",
"error",
"(",
"XMLErrorResources",
".",
"ER_FUNCTION_NOT_SUPPORTED",
")",
";",
"//\"getAttributeNS not supported!\");",
"return",
"null",
";",
"}"
] | Unimplemented. See org.w3c.dom.Element
@param namespaceURI Namespace URI of attribute node to get
@param localName Local part of qualified name of attribute node to get
@return null | [
"Unimplemented",
".",
"See",
"org",
".",
"w3c",
".",
"dom",
".",
"Element"
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/UnImplNode.java#L505-L511 |
Carbonado/Carbonado | src/main/java/com/amazon/carbonado/raw/DataDecoder.java | DataDecoder.decodeDoubleObj | public static Double decodeDoubleObj(byte[] src, int srcOffset)
throws CorruptEncodingException
{
long bits = decodeDoubleBits(src, srcOffset);
bits ^= (bits < 0) ? 0x8000000000000000L : 0xffffffffffffffffL;
return bits == 0x7fffffffffffffffL ? null : Double.longBitsToDouble(bits);
} | java | public static Double decodeDoubleObj(byte[] src, int srcOffset)
throws CorruptEncodingException
{
long bits = decodeDoubleBits(src, srcOffset);
bits ^= (bits < 0) ? 0x8000000000000000L : 0xffffffffffffffffL;
return bits == 0x7fffffffffffffffL ? null : Double.longBitsToDouble(bits);
} | [
"public",
"static",
"Double",
"decodeDoubleObj",
"(",
"byte",
"[",
"]",
"src",
",",
"int",
"srcOffset",
")",
"throws",
"CorruptEncodingException",
"{",
"long",
"bits",
"=",
"decodeDoubleBits",
"(",
"src",
",",
"srcOffset",
")",
";",
"bits",
"^=",
"(",
"bits"... | Decodes a Double object from exactly 8 bytes.
@param src source of encoded bytes
@param srcOffset offset into source array
@return Double object or null | [
"Decodes",
"a",
"Double",
"object",
"from",
"exactly",
"8",
"bytes",
"."
] | train | https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/raw/DataDecoder.java#L349-L355 |
atomix/atomix | protocols/raft/src/main/java/io/atomix/protocols/raft/roles/LeaderRole.java | LeaderRole.drainCommands | private void drainCommands(long sequenceNumber, RaftSession session) {
// First we need to drain any commands that exist in the queue *prior* to the next sequence number. This is
// possible if commands from the prior term are committed after a leader change.
long nextSequence = session.nextRequestSequence();
for (long i = sequenceNumber; i < nextSequence; i++) {
PendingCommand nextCommand = session.removeCommand(i);
if (nextCommand != null) {
commitCommand(nextCommand.request(), nextCommand.future());
}
}
// Finally, drain any commands that are sequenced in the session.
PendingCommand nextCommand = session.removeCommand(nextSequence);
while (nextCommand != null) {
commitCommand(nextCommand.request(), nextCommand.future());
session.setRequestSequence(nextSequence);
nextSequence = session.nextRequestSequence();
nextCommand = session.removeCommand(nextSequence);
}
} | java | private void drainCommands(long sequenceNumber, RaftSession session) {
// First we need to drain any commands that exist in the queue *prior* to the next sequence number. This is
// possible if commands from the prior term are committed after a leader change.
long nextSequence = session.nextRequestSequence();
for (long i = sequenceNumber; i < nextSequence; i++) {
PendingCommand nextCommand = session.removeCommand(i);
if (nextCommand != null) {
commitCommand(nextCommand.request(), nextCommand.future());
}
}
// Finally, drain any commands that are sequenced in the session.
PendingCommand nextCommand = session.removeCommand(nextSequence);
while (nextCommand != null) {
commitCommand(nextCommand.request(), nextCommand.future());
session.setRequestSequence(nextSequence);
nextSequence = session.nextRequestSequence();
nextCommand = session.removeCommand(nextSequence);
}
} | [
"private",
"void",
"drainCommands",
"(",
"long",
"sequenceNumber",
",",
"RaftSession",
"session",
")",
"{",
"// First we need to drain any commands that exist in the queue *prior* to the next sequence number. This is",
"// possible if commands from the prior term are committed after a leader... | Sequentially drains pending commands from the session's command request queue.
@param session the session for which to drain commands | [
"Sequentially",
"drains",
"pending",
"commands",
"from",
"the",
"session",
"s",
"command",
"request",
"queue",
"."
] | train | https://github.com/atomix/atomix/blob/3a94b7c80576d762dd0d396d4645df07a0b37c31/protocols/raft/src/main/java/io/atomix/protocols/raft/roles/LeaderRole.java#L669-L688 |
Azure/azure-sdk-for-java | mediaservices/resource-manager/v2018_03_30_preview/src/main/java/com/microsoft/azure/management/mediaservices/v2018_03_30_preview/implementation/LiveOutputsInner.java | LiveOutputsInner.getAsync | public Observable<LiveOutputInner> getAsync(String resourceGroupName, String accountName, String liveEventName, String liveOutputName) {
return getWithServiceResponseAsync(resourceGroupName, accountName, liveEventName, liveOutputName).map(new Func1<ServiceResponse<LiveOutputInner>, LiveOutputInner>() {
@Override
public LiveOutputInner call(ServiceResponse<LiveOutputInner> response) {
return response.body();
}
});
} | java | public Observable<LiveOutputInner> getAsync(String resourceGroupName, String accountName, String liveEventName, String liveOutputName) {
return getWithServiceResponseAsync(resourceGroupName, accountName, liveEventName, liveOutputName).map(new Func1<ServiceResponse<LiveOutputInner>, LiveOutputInner>() {
@Override
public LiveOutputInner call(ServiceResponse<LiveOutputInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"LiveOutputInner",
">",
"getAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
",",
"String",
"liveEventName",
",",
"String",
"liveOutputName",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
"resourceGroupName... | Get Live Output.
Gets a Live Output.
@param resourceGroupName The name of the resource group within the Azure subscription.
@param accountName The Media Services account name.
@param liveEventName The name of the Live Event.
@param liveOutputName The name of the Live Output.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the LiveOutputInner object | [
"Get",
"Live",
"Output",
".",
"Gets",
"a",
"Live",
"Output",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mediaservices/resource-manager/v2018_03_30_preview/src/main/java/com/microsoft/azure/management/mediaservices/v2018_03_30_preview/implementation/LiveOutputsInner.java#L274-L281 |
unbescape/unbescape | src/main/java/org/unbescape/uri/UriEscape.java | UriEscape.unescapeUriPath | public static void unescapeUriPath(final String text, final Writer writer)
throws IOException {
unescapeUriPath(text, writer, DEFAULT_ENCODING);
} | java | public static void unescapeUriPath(final String text, final Writer writer)
throws IOException {
unescapeUriPath(text, writer, DEFAULT_ENCODING);
} | [
"public",
"static",
"void",
"unescapeUriPath",
"(",
"final",
"String",
"text",
",",
"final",
"Writer",
"writer",
")",
"throws",
"IOException",
"{",
"unescapeUriPath",
"(",
"text",
",",
"writer",
",",
"DEFAULT_ENCODING",
")",
";",
"}"
] | <p>
Perform am URI path <strong>unescape</strong> operation
on a <tt>String</tt> input using <tt>UTF-8</tt> as encoding, writing results to a <tt>Writer</tt>.
</p>
<p>
This method will unescape every percent-encoded (<tt>%HH</tt>) sequences present in input,
even for those characters that do not need to be percent-encoded in this context (unreserved characters
can be percent-encoded even if/when this is not required, though it is not generally considered a
good practice).
</p>
<p>
This method will use <tt>UTF-8</tt> in order to determine the characters specified in the
percent-encoded byte sequences.
</p>
<p>
This method is <strong>thread-safe</strong>.
</p>
@param text the <tt>String</tt> to be unescaped.
@param writer the <tt>java.io.Writer</tt> to which the unescaped result will be written. Nothing will
be written at all to this writer if input is <tt>null</tt>.
@throws IOException if an input/output exception occurs
@since 1.1.2 | [
"<p",
">",
"Perform",
"am",
"URI",
"path",
"<strong",
">",
"unescape<",
"/",
"strong",
">",
"operation",
"on",
"a",
"<tt",
">",
"String<",
"/",
"tt",
">",
"input",
"using",
"<tt",
">",
"UTF",
"-",
"8<",
"/",
"tt",
">",
"as",
"encoding",
"writing",
... | train | https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/uri/UriEscape.java#L1802-L1805 |
stratosphere/stratosphere | stratosphere-core/src/main/java/eu/stratosphere/configuration/Configuration.java | Configuration.getLong | public long getLong(String key, long defaultValue) {
String val = getStringInternal(key);
if (val == null) {
return defaultValue;
} else {
return Long.parseLong(val);
}
} | java | public long getLong(String key, long defaultValue) {
String val = getStringInternal(key);
if (val == null) {
return defaultValue;
} else {
return Long.parseLong(val);
}
} | [
"public",
"long",
"getLong",
"(",
"String",
"key",
",",
"long",
"defaultValue",
")",
"{",
"String",
"val",
"=",
"getStringInternal",
"(",
"key",
")",
";",
"if",
"(",
"val",
"==",
"null",
")",
"{",
"return",
"defaultValue",
";",
"}",
"else",
"{",
"retur... | Returns the value associated with the given key as a long.
@param key
the key pointing to the associated value
@param defaultValue
the default value which is returned in case there is no value associated with the given key
@return the (default) value associated with the given key | [
"Returns",
"the",
"value",
"associated",
"with",
"the",
"given",
"key",
"as",
"a",
"long",
"."
] | train | https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-core/src/main/java/eu/stratosphere/configuration/Configuration.java#L212-L219 |
lets-blade/blade | src/main/java/com/blade/mvc/route/RouteMatcher.java | RouteMatcher.giveMatch | private void giveMatch(final String uri, List<Route> routes) {
routes.stream().sorted((o1, o2) -> {
if (o2.getPath().equals(uri)) {
return o2.getPath().indexOf(uri);
}
return -1;
});
} | java | private void giveMatch(final String uri, List<Route> routes) {
routes.stream().sorted((o1, o2) -> {
if (o2.getPath().equals(uri)) {
return o2.getPath().indexOf(uri);
}
return -1;
});
} | [
"private",
"void",
"giveMatch",
"(",
"final",
"String",
"uri",
",",
"List",
"<",
"Route",
">",
"routes",
")",
"{",
"routes",
".",
"stream",
"(",
")",
".",
"sorted",
"(",
"(",
"o1",
",",
"o2",
")",
"->",
"{",
"if",
"(",
"o2",
".",
"getPath",
"(",
... | Sort of path
@param uri request uri
@param routes route list | [
"Sort",
"of",
"path"
] | train | https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/mvc/route/RouteMatcher.java#L304-L311 |
apache/flink | flink-connectors/flink-connector-cassandra/src/main/java/org/apache/flink/streaming/connectors/cassandra/CassandraSink.java | CassandraSink.addSink | public static <IN> CassandraSinkBuilder<IN> addSink(DataStream<IN> input) {
TypeInformation<IN> typeInfo = input.getType();
if (typeInfo instanceof TupleTypeInfo) {
DataStream<Tuple> tupleInput = (DataStream<Tuple>) input;
return (CassandraSinkBuilder<IN>) new CassandraTupleSinkBuilder<>(tupleInput, tupleInput.getType(), tupleInput.getType().createSerializer(tupleInput.getExecutionEnvironment().getConfig()));
}
if (typeInfo instanceof RowTypeInfo) {
DataStream<Row> rowInput = (DataStream<Row>) input;
return (CassandraSinkBuilder<IN>) new CassandraRowSinkBuilder(rowInput, rowInput.getType(), rowInput.getType().createSerializer(rowInput.getExecutionEnvironment().getConfig()));
}
if (typeInfo instanceof PojoTypeInfo) {
return new CassandraPojoSinkBuilder<>(input, input.getType(), input.getType().createSerializer(input.getExecutionEnvironment().getConfig()));
}
if (typeInfo instanceof CaseClassTypeInfo) {
DataStream<Product> productInput = (DataStream<Product>) input;
return (CassandraSinkBuilder<IN>) new CassandraScalaProductSinkBuilder<>(productInput, productInput.getType(), productInput.getType().createSerializer(input.getExecutionEnvironment().getConfig()));
}
throw new IllegalArgumentException("No support for the type of the given DataStream: " + input.getType());
} | java | public static <IN> CassandraSinkBuilder<IN> addSink(DataStream<IN> input) {
TypeInformation<IN> typeInfo = input.getType();
if (typeInfo instanceof TupleTypeInfo) {
DataStream<Tuple> tupleInput = (DataStream<Tuple>) input;
return (CassandraSinkBuilder<IN>) new CassandraTupleSinkBuilder<>(tupleInput, tupleInput.getType(), tupleInput.getType().createSerializer(tupleInput.getExecutionEnvironment().getConfig()));
}
if (typeInfo instanceof RowTypeInfo) {
DataStream<Row> rowInput = (DataStream<Row>) input;
return (CassandraSinkBuilder<IN>) new CassandraRowSinkBuilder(rowInput, rowInput.getType(), rowInput.getType().createSerializer(rowInput.getExecutionEnvironment().getConfig()));
}
if (typeInfo instanceof PojoTypeInfo) {
return new CassandraPojoSinkBuilder<>(input, input.getType(), input.getType().createSerializer(input.getExecutionEnvironment().getConfig()));
}
if (typeInfo instanceof CaseClassTypeInfo) {
DataStream<Product> productInput = (DataStream<Product>) input;
return (CassandraSinkBuilder<IN>) new CassandraScalaProductSinkBuilder<>(productInput, productInput.getType(), productInput.getType().createSerializer(input.getExecutionEnvironment().getConfig()));
}
throw new IllegalArgumentException("No support for the type of the given DataStream: " + input.getType());
} | [
"public",
"static",
"<",
"IN",
">",
"CassandraSinkBuilder",
"<",
"IN",
">",
"addSink",
"(",
"DataStream",
"<",
"IN",
">",
"input",
")",
"{",
"TypeInformation",
"<",
"IN",
">",
"typeInfo",
"=",
"input",
".",
"getType",
"(",
")",
";",
"if",
"(",
"typeInf... | Writes a DataStream into a Cassandra database.
@param input input DataStream
@param <IN> input type
@return CassandraSinkBuilder, to further configure the sink | [
"Writes",
"a",
"DataStream",
"into",
"a",
"Cassandra",
"database",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-cassandra/src/main/java/org/apache/flink/streaming/connectors/cassandra/CassandraSink.java#L212-L230 |
joniles/mpxj | src/main/java/net/sf/mpxj/mspdi/MSPDIWriter.java | MSPDIWriter.writeAssignmentExtendedAttributes | private void writeAssignmentExtendedAttributes(Project.Assignments.Assignment xml, ResourceAssignment mpx)
{
Project.Assignments.Assignment.ExtendedAttribute attrib;
List<Project.Assignments.Assignment.ExtendedAttribute> extendedAttributes = xml.getExtendedAttribute();
for (AssignmentField mpxFieldID : getAllAssignmentExtendedAttributes())
{
Object value = mpx.getCachedValue(mpxFieldID);
if (FieldTypeHelper.valueIsNotDefault(mpxFieldID, value))
{
m_extendedAttributesInUse.add(mpxFieldID);
Integer xmlFieldID = Integer.valueOf(MPPAssignmentField.getID(mpxFieldID) | MPPAssignmentField.ASSIGNMENT_FIELD_BASE);
attrib = m_factory.createProjectAssignmentsAssignmentExtendedAttribute();
extendedAttributes.add(attrib);
attrib.setFieldID(xmlFieldID.toString());
attrib.setValue(DatatypeConverter.printExtendedAttribute(this, value, mpxFieldID.getDataType()));
attrib.setDurationFormat(printExtendedAttributeDurationFormat(value));
}
}
} | java | private void writeAssignmentExtendedAttributes(Project.Assignments.Assignment xml, ResourceAssignment mpx)
{
Project.Assignments.Assignment.ExtendedAttribute attrib;
List<Project.Assignments.Assignment.ExtendedAttribute> extendedAttributes = xml.getExtendedAttribute();
for (AssignmentField mpxFieldID : getAllAssignmentExtendedAttributes())
{
Object value = mpx.getCachedValue(mpxFieldID);
if (FieldTypeHelper.valueIsNotDefault(mpxFieldID, value))
{
m_extendedAttributesInUse.add(mpxFieldID);
Integer xmlFieldID = Integer.valueOf(MPPAssignmentField.getID(mpxFieldID) | MPPAssignmentField.ASSIGNMENT_FIELD_BASE);
attrib = m_factory.createProjectAssignmentsAssignmentExtendedAttribute();
extendedAttributes.add(attrib);
attrib.setFieldID(xmlFieldID.toString());
attrib.setValue(DatatypeConverter.printExtendedAttribute(this, value, mpxFieldID.getDataType()));
attrib.setDurationFormat(printExtendedAttributeDurationFormat(value));
}
}
} | [
"private",
"void",
"writeAssignmentExtendedAttributes",
"(",
"Project",
".",
"Assignments",
".",
"Assignment",
"xml",
",",
"ResourceAssignment",
"mpx",
")",
"{",
"Project",
".",
"Assignments",
".",
"Assignment",
".",
"ExtendedAttribute",
"attrib",
";",
"List",
"<",
... | This method writes extended attribute data for an assignment.
@param xml MSPDI assignment
@param mpx MPXJ assignment | [
"This",
"method",
"writes",
"extended",
"attribute",
"data",
"for",
"an",
"assignment",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIWriter.java#L1674-L1696 |
j256/ormlite-core | src/main/java/com/j256/ormlite/stmt/Where.java | Where.isNull | public Where<T, ID> isNull(String columnName) throws SQLException {
addClause(new IsNull(columnName, findColumnFieldType(columnName)));
return this;
} | java | public Where<T, ID> isNull(String columnName) throws SQLException {
addClause(new IsNull(columnName, findColumnFieldType(columnName)));
return this;
} | [
"public",
"Where",
"<",
"T",
",",
"ID",
">",
"isNull",
"(",
"String",
"columnName",
")",
"throws",
"SQLException",
"{",
"addClause",
"(",
"new",
"IsNull",
"(",
"columnName",
",",
"findColumnFieldType",
"(",
"columnName",
")",
")",
")",
";",
"return",
"this... | Add a 'IS NULL' clause so the column must be null. '=' NULL does not work. | [
"Add",
"a",
"IS",
"NULL",
"clause",
"so",
"the",
"column",
"must",
"be",
"null",
".",
"=",
"NULL",
"does",
"not",
"work",
"."
] | train | https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/Where.java#L283-L286 |
ttddyy/datasource-proxy | src/main/java/net/ttddyy/dsproxy/listener/logging/DefaultQueryLogEntryCreator.java | DefaultQueryLogEntryCreator.writeTypeEntry | protected void writeTypeEntry(StringBuilder sb, ExecutionInfo execInfo, List<QueryInfo> queryInfoList) {
sb.append("Type:");
sb.append(getStatementType(execInfo.getStatementType()));
sb.append(", ");
} | java | protected void writeTypeEntry(StringBuilder sb, ExecutionInfo execInfo, List<QueryInfo> queryInfoList) {
sb.append("Type:");
sb.append(getStatementType(execInfo.getStatementType()));
sb.append(", ");
} | [
"protected",
"void",
"writeTypeEntry",
"(",
"StringBuilder",
"sb",
",",
"ExecutionInfo",
"execInfo",
",",
"List",
"<",
"QueryInfo",
">",
"queryInfoList",
")",
"{",
"sb",
".",
"append",
"(",
"\"Type:\"",
")",
";",
"sb",
".",
"append",
"(",
"getStatementType",
... | Write statement type.
<p>default: Type: Prepared,
@param sb StringBuilder to write
@param execInfo execution info
@param queryInfoList query info list
@since 1.3.3 | [
"Write",
"statement",
"type",
"."
] | train | https://github.com/ttddyy/datasource-proxy/blob/62163ccf9a569a99aa3ad9f9151a32567447a62e/src/main/java/net/ttddyy/dsproxy/listener/logging/DefaultQueryLogEntryCreator.java#L158-L162 |
m-m-m/util | reflect/src/main/java/net/sf/mmm/util/reflect/api/ClassName.java | ClassName.appendEnclosing | private void appendEnclosing(StringBuilder buffer, char enclosingSeparator, ClassName enclosing) {
if (enclosing.enclosingClass != null) {
appendEnclosing(buffer, enclosingSeparator, enclosing.enclosingClass);
}
buffer.append(enclosing.simpleName);
buffer.append(enclosingSeparator);
} | java | private void appendEnclosing(StringBuilder buffer, char enclosingSeparator, ClassName enclosing) {
if (enclosing.enclosingClass != null) {
appendEnclosing(buffer, enclosingSeparator, enclosing.enclosingClass);
}
buffer.append(enclosing.simpleName);
buffer.append(enclosingSeparator);
} | [
"private",
"void",
"appendEnclosing",
"(",
"StringBuilder",
"buffer",
",",
"char",
"enclosingSeparator",
",",
"ClassName",
"enclosing",
")",
"{",
"if",
"(",
"enclosing",
".",
"enclosingClass",
"!=",
"null",
")",
"{",
"appendEnclosing",
"(",
"buffer",
",",
"enclo... | {@link StringBuilder#append(String) Appends} the {@link #getEnclosingClass() enclosing class} in proper order
(reverse hierarchy).
@param buffer the {@link StringBuilder} to {@link StringBuilder#append(String) append} to.
@param enclosingSeparator the separator for enclosing types ('.' or '$').
@param enclosing the {@link #getEnclosingClass() enclosing class}. | [
"{",
"@link",
"StringBuilder#append",
"(",
"String",
")",
"Appends",
"}",
"the",
"{",
"@link",
"#getEnclosingClass",
"()",
"enclosing",
"class",
"}",
"in",
"proper",
"order",
"(",
"reverse",
"hierarchy",
")",
"."
] | train | https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/reflect/src/main/java/net/sf/mmm/util/reflect/api/ClassName.java#L135-L142 |
camunda/camunda-xml-model | src/main/java/org/camunda/bpm/model/xml/impl/type/reference/ReferenceImpl.java | ReferenceImpl.referencedElementUpdated | public void referencedElementUpdated(ModelElementInstance referenceTargetElement, String oldIdentifier, String newIdentifier) {
for (ModelElementInstance referenceSourceElement : findReferenceSourceElements(referenceTargetElement)) {
updateReference(referenceSourceElement, oldIdentifier, newIdentifier);
}
} | java | public void referencedElementUpdated(ModelElementInstance referenceTargetElement, String oldIdentifier, String newIdentifier) {
for (ModelElementInstance referenceSourceElement : findReferenceSourceElements(referenceTargetElement)) {
updateReference(referenceSourceElement, oldIdentifier, newIdentifier);
}
} | [
"public",
"void",
"referencedElementUpdated",
"(",
"ModelElementInstance",
"referenceTargetElement",
",",
"String",
"oldIdentifier",
",",
"String",
"newIdentifier",
")",
"{",
"for",
"(",
"ModelElementInstance",
"referenceSourceElement",
":",
"findReferenceSourceElements",
"("... | Update the reference identifier
@param referenceTargetElement the reference target model element instance
@param oldIdentifier the old reference identifier
@param newIdentifier the new reference identifier | [
"Update",
"the",
"reference",
"identifier"
] | train | https://github.com/camunda/camunda-xml-model/blob/85b3f879e26d063f71c94cfd21ac17d9ff6baf4d/src/main/java/org/camunda/bpm/model/xml/impl/type/reference/ReferenceImpl.java#L148-L152 |
lucee/Lucee | core/src/main/java/lucee/runtime/reflection/Reflector.java | Reflector.callSetterEL | public static void callSetterEL(Object obj, String prop, Object value) throws PageException {
try {
MethodInstance setter = getSetter(obj, prop, value, null);
if (setter != null) setter.invoke(obj);
}
catch (InvocationTargetException e) {
Throwable target = e.getTargetException();
if (target instanceof PageException) throw (PageException) target;
throw Caster.toPageException(e.getTargetException());
}
catch (Exception e) {
throw Caster.toPageException(e);
}
} | java | public static void callSetterEL(Object obj, String prop, Object value) throws PageException {
try {
MethodInstance setter = getSetter(obj, prop, value, null);
if (setter != null) setter.invoke(obj);
}
catch (InvocationTargetException e) {
Throwable target = e.getTargetException();
if (target instanceof PageException) throw (PageException) target;
throw Caster.toPageException(e.getTargetException());
}
catch (Exception e) {
throw Caster.toPageException(e);
}
} | [
"public",
"static",
"void",
"callSetterEL",
"(",
"Object",
"obj",
",",
"String",
"prop",
",",
"Object",
"value",
")",
"throws",
"PageException",
"{",
"try",
"{",
"MethodInstance",
"setter",
"=",
"getSetter",
"(",
"obj",
",",
"prop",
",",
"value",
",",
"nul... | do nothing when not exist
@param obj
@param prop
@param value
@throws PageException | [
"do",
"nothing",
"when",
"not",
"exist"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/reflection/Reflector.java#L1096-L1109 |
docusign/docusign-java-client | src/main/java/com/docusign/esign/api/CommentsApi.java | CommentsApi.getCommentsTranscript | public byte[] getCommentsTranscript(String accountId, String envelopeId) throws ApiException {
return getCommentsTranscript(accountId, envelopeId, null);
} | java | public byte[] getCommentsTranscript(String accountId, String envelopeId) throws ApiException {
return getCommentsTranscript(accountId, envelopeId, null);
} | [
"public",
"byte",
"[",
"]",
"getCommentsTranscript",
"(",
"String",
"accountId",
",",
"String",
"envelopeId",
")",
"throws",
"ApiException",
"{",
"return",
"getCommentsTranscript",
"(",
"accountId",
",",
"envelopeId",
",",
"null",
")",
";",
"}"
] | Gets comment transcript for envelope and user
@param accountId The external account number (int) or account ID Guid. (required)
@param envelopeId The envelopeId Guid of the envelope being accessed. (required)
@return byte[] | [
"Gets",
"comment",
"transcript",
"for",
"envelope",
"and",
"user"
] | train | https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/CommentsApi.java#L59-L61 |
Comcast/jrugged | jrugged-spring/src/main/java/org/fishwife/jrugged/spring/jmx/MBeanStringSanitizer.java | MBeanStringSanitizer.urlDecode | String urlDecode(String name, String encoding) throws UnsupportedEncodingException {
return URLDecoder.decode(name, encoding);
} | java | String urlDecode(String name, String encoding) throws UnsupportedEncodingException {
return URLDecoder.decode(name, encoding);
} | [
"String",
"urlDecode",
"(",
"String",
"name",
",",
"String",
"encoding",
")",
"throws",
"UnsupportedEncodingException",
"{",
"return",
"URLDecoder",
".",
"decode",
"(",
"name",
",",
"encoding",
")",
";",
"}"
] | Convert a URL Encoded name back to the original form.
@param name the name to URL urlDecode.
@param encoding the string encoding to be used (i.e. UTF-8)
@return the name in original form.
@throws UnsupportedEncodingException if the encoding is not supported. | [
"Convert",
"a",
"URL",
"Encoded",
"name",
"back",
"to",
"the",
"original",
"form",
"."
] | train | https://github.com/Comcast/jrugged/blob/b6a5147c68ee733faf5616d49800abcbba67afe9/jrugged-spring/src/main/java/org/fishwife/jrugged/spring/jmx/MBeanStringSanitizer.java#L37-L39 |
eclipse/xtext-lib | org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/CollectionExtensions.java | CollectionExtensions.operator_add | @Inline(value="$3.$4addAll($1, $2)", imported=Iterables.class)
public static <E> boolean operator_add(Collection<E> collection, Iterable<? extends E> newElements) {
return addAll(collection, newElements);
} | java | @Inline(value="$3.$4addAll($1, $2)", imported=Iterables.class)
public static <E> boolean operator_add(Collection<E> collection, Iterable<? extends E> newElements) {
return addAll(collection, newElements);
} | [
"@",
"Inline",
"(",
"value",
"=",
"\"$3.$4addAll($1, $2)\"",
",",
"imported",
"=",
"Iterables",
".",
"class",
")",
"public",
"static",
"<",
"E",
">",
"boolean",
"operator_add",
"(",
"Collection",
"<",
"E",
">",
"collection",
",",
"Iterable",
"<",
"?",
"ext... | The operator mapping from {@code +=} to {@link #addAll(Collection, Iterable)}. Returns <code>true</code> if the
collection changed due to this operation.
@param collection
the to-be-changed collection. May not be <code>null</code>.
@param newElements
elements to be inserted into the collection. May not be <code>null</code> but may contain
<code>null</code> elements if the the target collection supports <code>null</code> elements.
@return <code>true</code> if the collection changed due to this operation.
@see #addAll(Collection, Iterable) | [
"The",
"operator",
"mapping",
"from",
"{",
"@code",
"+",
"=",
"}",
"to",
"{",
"@link",
"#addAll",
"(",
"Collection",
"Iterable",
")",
"}",
".",
"Returns",
"<code",
">",
"true<",
"/",
"code",
">",
"if",
"the",
"collection",
"changed",
"due",
"to",
"this... | train | https://github.com/eclipse/xtext-lib/blob/7063572e1f1bd713a3aa53bdf3a8dc60e25c169a/org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/CollectionExtensions.java#L65-L68 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/db/event/SequenceHandler.java | SequenceHandler.init | public void init(Record record, BaseField fldDest, BaseField fldSource)
{
super.init(record, fldDest, fldSource, null, true, false, false, false, false, null, false);
} | java | public void init(Record record, BaseField fldDest, BaseField fldSource)
{
super.init(record, fldDest, fldSource, null, true, false, false, false, false, null, false);
} | [
"public",
"void",
"init",
"(",
"Record",
"record",
",",
"BaseField",
"fldDest",
",",
"BaseField",
"fldSource",
")",
"{",
"super",
".",
"init",
"(",
"record",
",",
"fldDest",
",",
"fldSource",
",",
"null",
",",
"true",
",",
"false",
",",
"false",
",",
"... | This Constructor moves the source field to the dest field on valid.
@param record My owner (usually passed as null, and set on addListener in setOwner()).
@param pfldDest tour.field.BaseField The destination field.
@param fldSource The source field. | [
"This",
"Constructor",
"moves",
"the",
"source",
"field",
"to",
"the",
"dest",
"field",
"on",
"valid",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/event/SequenceHandler.java#L55-L58 |
google/closure-compiler | src/com/google/javascript/jscomp/J2clConstantHoisterPass.java | J2clConstantHoisterPass.isHoistableFunction | private static boolean isHoistableFunction(NodeTraversal t, Node node) {
// TODO(michaelthomas): This could be improved slightly by not assuming that any variable in the
// outer scope is used in the function.
return node.isFunction() && t.getScope().getVarCount() == 0;
} | java | private static boolean isHoistableFunction(NodeTraversal t, Node node) {
// TODO(michaelthomas): This could be improved slightly by not assuming that any variable in the
// outer scope is used in the function.
return node.isFunction() && t.getScope().getVarCount() == 0;
} | [
"private",
"static",
"boolean",
"isHoistableFunction",
"(",
"NodeTraversal",
"t",
",",
"Node",
"node",
")",
"{",
"// TODO(michaelthomas): This could be improved slightly by not assuming that any variable in the",
"// outer scope is used in the function.",
"return",
"node",
".",
"is... | Returns whether the specified rValue is a function which does not receive any variables from
its containing scope, and is thus 'hoistable'. | [
"Returns",
"whether",
"the",
"specified",
"rValue",
"is",
"a",
"function",
"which",
"does",
"not",
"receive",
"any",
"variables",
"from",
"its",
"containing",
"scope",
"and",
"is",
"thus",
"hoistable",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/J2clConstantHoisterPass.java#L73-L77 |
buschmais/jqa-maven3-plugin | src/main/java/com/buschmais/jqassistant/plugin/maven3/impl/scanner/MavenProjectScannerPlugin.java | MavenProjectScannerPlugin.resolveProject | protected <T extends MavenProjectDescriptor> T resolveProject(MavenProject project, Class<T> expectedType, ScannerContext scannerContext) {
Store store = scannerContext.getStore();
String id = project.getGroupId() + ":" + project.getArtifactId() + ":" + project.getVersion();
MavenProjectDescriptor projectDescriptor = store.find(MavenProjectDescriptor.class, id);
if (projectDescriptor == null) {
projectDescriptor = store.create(expectedType, id);
projectDescriptor.setName(project.getName());
projectDescriptor.setGroupId(project.getGroupId());
projectDescriptor.setArtifactId(project.getArtifactId());
projectDescriptor.setVersion(project.getVersion());
projectDescriptor.setPackaging(project.getPackaging());
projectDescriptor.setFullQualifiedName(id);
} else if (!expectedType.isAssignableFrom(projectDescriptor.getClass())) {
projectDescriptor = store.addDescriptorType(projectDescriptor, expectedType);
}
return expectedType.cast(projectDescriptor);
} | java | protected <T extends MavenProjectDescriptor> T resolveProject(MavenProject project, Class<T> expectedType, ScannerContext scannerContext) {
Store store = scannerContext.getStore();
String id = project.getGroupId() + ":" + project.getArtifactId() + ":" + project.getVersion();
MavenProjectDescriptor projectDescriptor = store.find(MavenProjectDescriptor.class, id);
if (projectDescriptor == null) {
projectDescriptor = store.create(expectedType, id);
projectDescriptor.setName(project.getName());
projectDescriptor.setGroupId(project.getGroupId());
projectDescriptor.setArtifactId(project.getArtifactId());
projectDescriptor.setVersion(project.getVersion());
projectDescriptor.setPackaging(project.getPackaging());
projectDescriptor.setFullQualifiedName(id);
} else if (!expectedType.isAssignableFrom(projectDescriptor.getClass())) {
projectDescriptor = store.addDescriptorType(projectDescriptor, expectedType);
}
return expectedType.cast(projectDescriptor);
} | [
"protected",
"<",
"T",
"extends",
"MavenProjectDescriptor",
">",
"T",
"resolveProject",
"(",
"MavenProject",
"project",
",",
"Class",
"<",
"T",
">",
"expectedType",
",",
"ScannerContext",
"scannerContext",
")",
"{",
"Store",
"store",
"=",
"scannerContext",
".",
... | Resolves a maven project.
@param project
The project
@param expectedType
The expected descriptor type.
@param scannerContext
The scanner context.
@param <T>
The expected descriptor type.
@return The maven project descriptor. | [
"Resolves",
"a",
"maven",
"project",
"."
] | train | https://github.com/buschmais/jqa-maven3-plugin/blob/6c6e2dca56de6d5b8ceeb2f28982fb6d7c98778f/src/main/java/com/buschmais/jqassistant/plugin/maven3/impl/scanner/MavenProjectScannerPlugin.java#L140-L156 |
aws/aws-sdk-java | aws-java-sdk-datapipeline/src/main/java/com/amazonaws/services/datapipeline/model/TaskObject.java | TaskObject.withObjects | public TaskObject withObjects(java.util.Map<String, PipelineObject> objects) {
setObjects(objects);
return this;
} | java | public TaskObject withObjects(java.util.Map<String, PipelineObject> objects) {
setObjects(objects);
return this;
} | [
"public",
"TaskObject",
"withObjects",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"PipelineObject",
">",
"objects",
")",
"{",
"setObjects",
"(",
"objects",
")",
";",
"return",
"this",
";",
"}"
] | <p>
Connection information for the location where the task runner will publish the output of the task.
</p>
@param objects
Connection information for the location where the task runner will publish the output of the task.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"Connection",
"information",
"for",
"the",
"location",
"where",
"the",
"task",
"runner",
"will",
"publish",
"the",
"output",
"of",
"the",
"task",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-datapipeline/src/main/java/com/amazonaws/services/datapipeline/model/TaskObject.java#L225-L228 |
wcm-io/wcm-io-handler | media/src/main/java/io/wcm/handler/media/spi/MediaSource.java | MediaSource.getMediaRef | @Deprecated
protected final @Nullable String getMediaRef(@NotNull MediaRequest mediaRequest) {
return getMediaRef(mediaRequest, null);
} | java | @Deprecated
protected final @Nullable String getMediaRef(@NotNull MediaRequest mediaRequest) {
return getMediaRef(mediaRequest, null);
} | [
"@",
"Deprecated",
"protected",
"final",
"@",
"Nullable",
"String",
"getMediaRef",
"(",
"@",
"NotNull",
"MediaRequest",
"mediaRequest",
")",
"{",
"return",
"getMediaRef",
"(",
"mediaRequest",
",",
"null",
")",
";",
"}"
] | Get media request path to media library
@param mediaRequest Media request
@return Path or null if not present
@deprecated Use {@link #getMediaRef(MediaRequest, MediaHandlerConfig)} | [
"Get",
"media",
"request",
"path",
"to",
"media",
"library"
] | train | https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/media/src/main/java/io/wcm/handler/media/spi/MediaSource.java#L129-L132 |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/block/decomposition/qr/QRDecompositionHouseholder_DDRB.java | QRDecompositionHouseholder_DDRB.applyQ | public void applyQ(DMatrixRBlock B , boolean isIdentity ) {
int minDimen = Math.min(dataA.numCols,dataA.numRows);
DSubmatrixD1 subB = new DSubmatrixD1(B);
W.col0 = W.row0 = 0;
Y.row1 = W.row1 = dataA.numRows;
WTA.row0 = WTA.col0 = 0;
int start = minDimen - minDimen % blockLength;
if( start == minDimen )
start -= blockLength;
if( start < 0 )
start = 0;
// (Q1^T * (Q2^T * (Q3^t * A)))
for( int i = start; i >= 0; i -= blockLength ) {
Y.col0 = i;
Y.col1 = Math.min(Y.col0+blockLength,dataA.numCols);
Y.row0 = i;
if( isIdentity )
subB.col0 = i;
subB.row0 = i;
setW();
WTA.row1 = Y.col1-Y.col0;
WTA.col1 = subB.col1-subB.col0;
WTA.original.reshape(WTA.row1,WTA.col1,false);
// Compute W matrix from reflectors stored in Y
if( !saveW )
BlockHouseHolder_DDRB.computeW_Column(blockLength,Y,W,temp, gammas,Y.col0);
// Apply the Qi to Q
BlockHouseHolder_DDRB.multTransA_vecCol(blockLength,Y,subB,WTA);
MatrixMult_DDRB.multPlus(blockLength,W,WTA,subB);
}
} | java | public void applyQ(DMatrixRBlock B , boolean isIdentity ) {
int minDimen = Math.min(dataA.numCols,dataA.numRows);
DSubmatrixD1 subB = new DSubmatrixD1(B);
W.col0 = W.row0 = 0;
Y.row1 = W.row1 = dataA.numRows;
WTA.row0 = WTA.col0 = 0;
int start = minDimen - minDimen % blockLength;
if( start == minDimen )
start -= blockLength;
if( start < 0 )
start = 0;
// (Q1^T * (Q2^T * (Q3^t * A)))
for( int i = start; i >= 0; i -= blockLength ) {
Y.col0 = i;
Y.col1 = Math.min(Y.col0+blockLength,dataA.numCols);
Y.row0 = i;
if( isIdentity )
subB.col0 = i;
subB.row0 = i;
setW();
WTA.row1 = Y.col1-Y.col0;
WTA.col1 = subB.col1-subB.col0;
WTA.original.reshape(WTA.row1,WTA.col1,false);
// Compute W matrix from reflectors stored in Y
if( !saveW )
BlockHouseHolder_DDRB.computeW_Column(blockLength,Y,W,temp, gammas,Y.col0);
// Apply the Qi to Q
BlockHouseHolder_DDRB.multTransA_vecCol(blockLength,Y,subB,WTA);
MatrixMult_DDRB.multPlus(blockLength,W,WTA,subB);
}
} | [
"public",
"void",
"applyQ",
"(",
"DMatrixRBlock",
"B",
",",
"boolean",
"isIdentity",
")",
"{",
"int",
"minDimen",
"=",
"Math",
".",
"min",
"(",
"dataA",
".",
"numCols",
",",
"dataA",
".",
"numRows",
")",
";",
"DSubmatrixD1",
"subB",
"=",
"new",
"DSubmatr... | Specialized version of applyQ() that allows the zeros in an identity matrix
to be taken advantage of depending on if isIdentity is true or not.
@param B
@param isIdentity If B is an identity matrix. | [
"Specialized",
"version",
"of",
"applyQ",
"()",
"that",
"allows",
"the",
"zeros",
"in",
"an",
"identity",
"matrix",
"to",
"be",
"taken",
"advantage",
"of",
"depending",
"on",
"if",
"isIdentity",
"is",
"true",
"or",
"not",
"."
] | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/block/decomposition/qr/QRDecompositionHouseholder_DDRB.java#L177-L215 |
joestelmach/natty | src/main/java/com/joestelmach/natty/WalkerState.java | WalkerState.seasonalDateFromIcs | private Date seasonalDateFromIcs(String icsFileName, String eventSummary, int year) {
Map<Integer, Date> dates = getDatesFromIcs(icsFileName, eventSummary, year, year);
return dates.get(year - (eventSummary.equals(Holiday.NEW_YEARS_EVE.getSummary()) ? 1 : 0));
} | java | private Date seasonalDateFromIcs(String icsFileName, String eventSummary, int year) {
Map<Integer, Date> dates = getDatesFromIcs(icsFileName, eventSummary, year, year);
return dates.get(year - (eventSummary.equals(Holiday.NEW_YEARS_EVE.getSummary()) ? 1 : 0));
} | [
"private",
"Date",
"seasonalDateFromIcs",
"(",
"String",
"icsFileName",
",",
"String",
"eventSummary",
",",
"int",
"year",
")",
"{",
"Map",
"<",
"Integer",
",",
"Date",
">",
"dates",
"=",
"getDatesFromIcs",
"(",
"icsFileName",
",",
"eventSummary",
",",
"year",... | Finds and returns the date for the given event summary and year within the given ics file,
or null if not present. | [
"Finds",
"and",
"returns",
"the",
"date",
"for",
"the",
"given",
"event",
"summary",
"and",
"year",
"within",
"the",
"given",
"ics",
"file",
"or",
"null",
"if",
"not",
"present",
"."
] | train | https://github.com/joestelmach/natty/blob/74389feb4c9372e51cd51eb0800a0177fec3e5a0/src/main/java/com/joestelmach/natty/WalkerState.java#L619-L622 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/bean/copier/CopyOptions.java | CopyOptions.create | public static CopyOptions create(Class<?> editable, boolean ignoreNullValue, String... ignoreProperties) {
return new CopyOptions(editable, ignoreNullValue, ignoreProperties);
} | java | public static CopyOptions create(Class<?> editable, boolean ignoreNullValue, String... ignoreProperties) {
return new CopyOptions(editable, ignoreNullValue, ignoreProperties);
} | [
"public",
"static",
"CopyOptions",
"create",
"(",
"Class",
"<",
"?",
">",
"editable",
",",
"boolean",
"ignoreNullValue",
",",
"String",
"...",
"ignoreProperties",
")",
"{",
"return",
"new",
"CopyOptions",
"(",
"editable",
",",
"ignoreNullValue",
",",
"ignoreProp... | 创建拷贝选项
@param editable 限制的类或接口,必须为目标对象的实现接口或父类,用于限制拷贝的属性
@param ignoreNullValue 是否忽略空值,当源对象的值为null时,true: 忽略而不注入此值,false: 注入null
@param ignoreProperties 忽略的属性列表,设置一个属性列表,不拷贝这些属性值
@return 拷贝选项 | [
"创建拷贝选项"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/bean/copier/CopyOptions.java#L47-L49 |
HubSpot/Singularity | SingularityService/src/main/java/com/hubspot/singularity/async/AsyncSemaphore.java | AsyncSemaphore.newBuilder | public static AsyncSemaphoreBuilder newBuilder(Supplier<Integer> concurrentRequestLimit, ScheduledExecutorService flushingExecutor) {
return new AsyncSemaphoreBuilder(new PermitSource(concurrentRequestLimit), flushingExecutor);
} | java | public static AsyncSemaphoreBuilder newBuilder(Supplier<Integer> concurrentRequestLimit, ScheduledExecutorService flushingExecutor) {
return new AsyncSemaphoreBuilder(new PermitSource(concurrentRequestLimit), flushingExecutor);
} | [
"public",
"static",
"AsyncSemaphoreBuilder",
"newBuilder",
"(",
"Supplier",
"<",
"Integer",
">",
"concurrentRequestLimit",
",",
"ScheduledExecutorService",
"flushingExecutor",
")",
"{",
"return",
"new",
"AsyncSemaphoreBuilder",
"(",
"new",
"PermitSource",
"(",
"concurrent... | Create an AsyncSemaphore with the given limit.
@param concurrentRequestLimit - A supplier saying how many concurrent requests are allowed | [
"Create",
"an",
"AsyncSemaphore",
"with",
"the",
"given",
"limit",
"."
] | train | https://github.com/HubSpot/Singularity/blob/384a8c16a10aa076af5ca45c8dfcedab9e5122c8/SingularityService/src/main/java/com/hubspot/singularity/async/AsyncSemaphore.java#L47-L49 |
fhoeben/hsac-fitnesse-fixtures | src/main/java/nl/hsac/fitnesse/fixture/util/ReflectionHelper.java | ReflectionHelper.getField | public Object getField(Object o, String fieldName) {
if (o == null) {
throw new IllegalArgumentException("No object to get from provided");
}
Field field = findField(o, fieldName);
if (field == null) {
throw new IllegalArgumentException(o.getClass() + " does not have a field " + fieldName);
} else {
if (!field.isAccessible()) {
field.setAccessible(true);
}
try {
return field.get(o);
} catch (IllegalAccessException e) {
throw new IllegalArgumentException("Unable to get " + fieldName, e);
}
}
} | java | public Object getField(Object o, String fieldName) {
if (o == null) {
throw new IllegalArgumentException("No object to get from provided");
}
Field field = findField(o, fieldName);
if (field == null) {
throw new IllegalArgumentException(o.getClass() + " does not have a field " + fieldName);
} else {
if (!field.isAccessible()) {
field.setAccessible(true);
}
try {
return field.get(o);
} catch (IllegalAccessException e) {
throw new IllegalArgumentException("Unable to get " + fieldName, e);
}
}
} | [
"public",
"Object",
"getField",
"(",
"Object",
"o",
",",
"String",
"fieldName",
")",
"{",
"if",
"(",
"o",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"No object to get from provided\"",
")",
";",
"}",
"Field",
"field",
"=",
"fi... | Gets (private) field of o (the field may be defined by o's class, or one of its superclasses).
@param o instance to set field of.
@param fieldName name of field.
@return value of field. | [
"Gets",
"(",
"private",
")",
"field",
"of",
"o",
"(",
"the",
"field",
"may",
"be",
"defined",
"by",
"o",
"s",
"class",
"or",
"one",
"of",
"its",
"superclasses",
")",
"."
] | train | https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/ReflectionHelper.java#L118-L135 |
jeremylong/DependencyCheck | utils/src/main/java/org/owasp/dependencycheck/utils/Settings.java | Settings.setBoolean | public void setBoolean(@NotNull final String key, boolean value) {
setString(key, Boolean.toString(value));
} | java | public void setBoolean(@NotNull final String key, boolean value) {
setString(key, Boolean.toString(value));
} | [
"public",
"void",
"setBoolean",
"(",
"@",
"NotNull",
"final",
"String",
"key",
",",
"boolean",
"value",
")",
"{",
"setString",
"(",
"key",
",",
"Boolean",
".",
"toString",
"(",
"value",
")",
")",
";",
"}"
] | Sets a property value.
@param key the key for the property
@param value the value for the property | [
"Sets",
"a",
"property",
"value",
"."
] | train | https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/utils/src/main/java/org/owasp/dependencycheck/utils/Settings.java#L724-L726 |
xvik/guice-persist-orient | src/main/java/ru/vyarus/guice/persist/orient/db/user/UserManager.java | UserManager.executeWithTxUser | public <T> T executeWithTxUser(final OSecurityUser user, final SpecificUserAction<T> userAction) {
final boolean userChanged = checkSpecificUserConditions(user.getName());
final ODatabaseDocumentInternal db = (ODatabaseDocumentInternal) connectionProvider.get();
final OSecurityUser original = db.getUser();
if (userChanged) {
// no need to track user change if user not changed
specificTxUser.set(user);
db.setUser(user);
}
T result = null;
try {
result = userAction.execute();
} catch (Throwable th) {
Throwables.throwIfUnchecked(th);
throw new UserActionException(String.format("Failed to perform tx action with user '%s'",
user.getName()), th);
} finally {
if (userChanged) {
db.setUser(original);
specificTxUser.remove();
}
}
return result;
} | java | public <T> T executeWithTxUser(final OSecurityUser user, final SpecificUserAction<T> userAction) {
final boolean userChanged = checkSpecificUserConditions(user.getName());
final ODatabaseDocumentInternal db = (ODatabaseDocumentInternal) connectionProvider.get();
final OSecurityUser original = db.getUser();
if (userChanged) {
// no need to track user change if user not changed
specificTxUser.set(user);
db.setUser(user);
}
T result = null;
try {
result = userAction.execute();
} catch (Throwable th) {
Throwables.throwIfUnchecked(th);
throw new UserActionException(String.format("Failed to perform tx action with user '%s'",
user.getName()), th);
} finally {
if (userChanged) {
db.setUser(original);
specificTxUser.remove();
}
}
return result;
} | [
"public",
"<",
"T",
">",
"T",
"executeWithTxUser",
"(",
"final",
"OSecurityUser",
"user",
",",
"final",
"SpecificUserAction",
"<",
"T",
">",
"userAction",
")",
"{",
"final",
"boolean",
"userChanged",
"=",
"checkSpecificUserConditions",
"(",
"user",
".",
"getName... | Changes current connection user. Affects only current transaction and can't be used outside of transaction
({@link ODatabaseDocumentInternal#setUser(com.orientechnologies.orient.core.metadata.security.OSecurityUser)}).
<p>
Recursive user changes are not allowed, so attempt to change user under already changed user will
lead to error. The only exception is change to the same user (in this case change is ignored).
<p>
Action approach is important to explicitly define scope of specific user and
properly cleanup state (which may be not done in case of direct override).
<p>
Propagates runtime exceptions (orient exceptions).
@param user specific user
@param userAction logic to execute with specific user
@param <T> type of returned result (may be Void)
@return action result (may be null) | [
"Changes",
"current",
"connection",
"user",
".",
"Affects",
"only",
"current",
"transaction",
"and",
"can",
"t",
"be",
"used",
"outside",
"of",
"transaction",
"(",
"{",
"@link",
"ODatabaseDocumentInternal#setUser",
"(",
"com",
".",
"orientechnologies",
".",
"orien... | train | https://github.com/xvik/guice-persist-orient/blob/5ef06fb4f734360512e9824a3b875c4906c56b5b/src/main/java/ru/vyarus/guice/persist/orient/db/user/UserManager.java#L162-L185 |
mangstadt/biweekly | src/main/java/biweekly/util/StringUtils.java | StringUtils.afterPrefixIgnoreCase | public static String afterPrefixIgnoreCase(String string, String prefix) {
if (string.length() < prefix.length()) {
return null;
}
for (int i = 0; i < prefix.length(); i++) {
char a = Character.toUpperCase(prefix.charAt(i));
char b = Character.toUpperCase(string.charAt(i));
if (a != b) {
return null;
}
}
return string.substring(prefix.length());
} | java | public static String afterPrefixIgnoreCase(String string, String prefix) {
if (string.length() < prefix.length()) {
return null;
}
for (int i = 0; i < prefix.length(); i++) {
char a = Character.toUpperCase(prefix.charAt(i));
char b = Character.toUpperCase(string.charAt(i));
if (a != b) {
return null;
}
}
return string.substring(prefix.length());
} | [
"public",
"static",
"String",
"afterPrefixIgnoreCase",
"(",
"String",
"string",
",",
"String",
"prefix",
")",
"{",
"if",
"(",
"string",
".",
"length",
"(",
")",
"<",
"prefix",
".",
"length",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"for",
"(",
... | <p>
Returns a substring of the given string that comes after the given
prefix. Prefix matching is case-insensitive.
</p>
<p>
<b>Example:</b>
</p>
<pre class="brush:java">
String result = StringUtils.afterPrefixIgnoreCase("MAILTO:email@example.com", "mailto:");
assertEquals("email@example.com", result);
result = StringUtils.afterPrefixIgnoreCase("http://www.google.com", "mailto:");
assertNull(result);
</pre>
@param string the string
@param prefix the prefix
@return the string or null if the prefix was not found | [
"<p",
">",
"Returns",
"a",
"substring",
"of",
"the",
"given",
"string",
"that",
"comes",
"after",
"the",
"given",
"prefix",
".",
"Prefix",
"matching",
"is",
"case",
"-",
"insensitive",
".",
"<",
"/",
"p",
">",
"<p",
">",
"<b",
">",
"Example",
":",
"<... | train | https://github.com/mangstadt/biweekly/blob/2e21350f85c13dfff52fdef98fdbebe2976fcf61/src/main/java/biweekly/util/StringUtils.java#L61-L75 |
operasoftware/operaprestodriver | src/com/opera/core/systems/OperaDesktopDriver.java | OperaDesktopDriver.findWidgetByName | public QuickWidget findWidgetByName(QuickWidgetType type, int windowId, String widgetName) {
return desktopWindowManager.getQuickWidget(type, windowId, QuickWidgetSearchType.NAME,
widgetName);
} | java | public QuickWidget findWidgetByName(QuickWidgetType type, int windowId, String widgetName) {
return desktopWindowManager.getQuickWidget(type, windowId, QuickWidgetSearchType.NAME,
widgetName);
} | [
"public",
"QuickWidget",
"findWidgetByName",
"(",
"QuickWidgetType",
"type",
",",
"int",
"windowId",
",",
"String",
"widgetName",
")",
"{",
"return",
"desktopWindowManager",
".",
"getQuickWidget",
"(",
"type",
",",
"windowId",
",",
"QuickWidgetSearchType",
".",
"NAM... | Finds widget by name in the window specified by windowId.
@param windowId window id of parent window
@param widgetName name of widget to find
@return QuickWidget with the given name in the window with id windowId, or null if no such
widget exists. | [
"Finds",
"widget",
"by",
"name",
"in",
"the",
"window",
"specified",
"by",
"windowId",
"."
] | train | https://github.com/operasoftware/operaprestodriver/blob/1ccceda80f1c1a0489171d17dcaa6e7b18fb4c01/src/com/opera/core/systems/OperaDesktopDriver.java#L322-L325 |
lotaris/rox-client-java | rox-client-java/src/main/java/com/lotaris/rox/core/filters/FilterTargetData.java | FilterTargetData.mergeTickets | private static String mergeTickets(RoxableTest mAnnotation, RoxableTestClass cAnnotation) {
List<String> tickets = new ArrayList<>();
if (mAnnotation != null) {
tickets.addAll(Arrays.asList(mAnnotation.tickets()));
}
if (cAnnotation != null) {
tickets.addAll(Arrays.asList(cAnnotation.tickets()));
}
return Arrays.toString(tickets.toArray(new String[tickets.size()]));
} | java | private static String mergeTickets(RoxableTest mAnnotation, RoxableTestClass cAnnotation) {
List<String> tickets = new ArrayList<>();
if (mAnnotation != null) {
tickets.addAll(Arrays.asList(mAnnotation.tickets()));
}
if (cAnnotation != null) {
tickets.addAll(Arrays.asList(cAnnotation.tickets()));
}
return Arrays.toString(tickets.toArray(new String[tickets.size()]));
} | [
"private",
"static",
"String",
"mergeTickets",
"(",
"RoxableTest",
"mAnnotation",
",",
"RoxableTestClass",
"cAnnotation",
")",
"{",
"List",
"<",
"String",
">",
"tickets",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"if",
"(",
"mAnnotation",
"!=",
"null",
"... | Create a string containing all the tickets from method and class annotations
@param mAnnotation Method annotation
@param cAnnotation Class annotation
@return The string of tickets | [
"Create",
"a",
"string",
"containing",
"all",
"the",
"tickets",
"from",
"method",
"and",
"class",
"annotations"
] | train | https://github.com/lotaris/rox-client-java/blob/1b33f7560347c382c59a40c4037d175ab8127fde/rox-client-java/src/main/java/com/lotaris/rox/core/filters/FilterTargetData.java#L158-L170 |
zaproxy/zaproxy | src/org/zaproxy/zap/extension/brk/BreakpointMessageHandler.java | BreakpointMessageHandler.handleMessageReceivedFromClient | public boolean handleMessageReceivedFromClient(Message aMessage, boolean onlyIfInScope) {
if ( ! isBreakpoint(aMessage, true, onlyIfInScope)) {
return true;
}
// Do this outside of the semaphore loop so that the 'continue' button can apply to all queued break points
// but be reset when the next break point is hit
breakPanel.breakpointHit();
synchronized(semaphore) {
if (breakPanel.isHoldMessage()) {
setBreakDisplay(aMessage, true);
waitUntilContinue(true);
}
}
breakPanel.clearAndDisableRequest();
return ! breakPanel.isToBeDropped();
} | java | public boolean handleMessageReceivedFromClient(Message aMessage, boolean onlyIfInScope) {
if ( ! isBreakpoint(aMessage, true, onlyIfInScope)) {
return true;
}
// Do this outside of the semaphore loop so that the 'continue' button can apply to all queued break points
// but be reset when the next break point is hit
breakPanel.breakpointHit();
synchronized(semaphore) {
if (breakPanel.isHoldMessage()) {
setBreakDisplay(aMessage, true);
waitUntilContinue(true);
}
}
breakPanel.clearAndDisableRequest();
return ! breakPanel.isToBeDropped();
} | [
"public",
"boolean",
"handleMessageReceivedFromClient",
"(",
"Message",
"aMessage",
",",
"boolean",
"onlyIfInScope",
")",
"{",
"if",
"(",
"!",
"isBreakpoint",
"(",
"aMessage",
",",
"true",
",",
"onlyIfInScope",
")",
")",
"{",
"return",
"true",
";",
"}",
"// Do... | Do not call if in {@link Mode#safe}.
@param aMessage
@param onlyIfInScope
@return False if message should be dropped. | [
"Do",
"not",
"call",
"if",
"in",
"{",
"@link",
"Mode#safe",
"}",
"."
] | train | https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/extension/brk/BreakpointMessageHandler.java#L71-L88 |
spring-projects/spring-loaded | springloaded/src/main/java/org/springsource/loaded/TypeRegistry.java | TypeRegistry.iiIntercept | public static Object iiIntercept(Object instance, Object[] params, Object instance2, String nameAndDescriptor) {
Class<?> clazz = instance.getClass();
try {
if (clazz.getName().contains("$$Lambda")) {
// There may be multiple methods here, we want the public one (I think!)
Method[] ms = instance.getClass().getDeclaredMethods();
// public java.lang.String basic.LambdaJ$$E002$$Lambda$2/1484594489.m(java.lang.String,java.lang.String)
// private static basic.LambdaJ$Foo basic.LambdaJ$$E002$$Lambda$2/1484594489.get$Lambda(basic.LambdaJ)
Method toUse = null;
for (Method m : ms) {
if (Modifier.isPublic(m.getModifiers())) {
toUse = m;
break;
}
}
toUse.setAccessible(true);
Object o = toUse.invoke(instance, params);
return o;
}
else {
// Do what you were going to do...
Method m = instance.getClass().getDeclaredMethod("__execute", Object[].class, Object.class,
String.class);
m.setAccessible(true);
return m.invoke(instance, params, instance, nameAndDescriptor);
}
}
catch (Exception e) {
e.printStackTrace();
}
return null;
} | java | public static Object iiIntercept(Object instance, Object[] params, Object instance2, String nameAndDescriptor) {
Class<?> clazz = instance.getClass();
try {
if (clazz.getName().contains("$$Lambda")) {
// There may be multiple methods here, we want the public one (I think!)
Method[] ms = instance.getClass().getDeclaredMethods();
// public java.lang.String basic.LambdaJ$$E002$$Lambda$2/1484594489.m(java.lang.String,java.lang.String)
// private static basic.LambdaJ$Foo basic.LambdaJ$$E002$$Lambda$2/1484594489.get$Lambda(basic.LambdaJ)
Method toUse = null;
for (Method m : ms) {
if (Modifier.isPublic(m.getModifiers())) {
toUse = m;
break;
}
}
toUse.setAccessible(true);
Object o = toUse.invoke(instance, params);
return o;
}
else {
// Do what you were going to do...
Method m = instance.getClass().getDeclaredMethod("__execute", Object[].class, Object.class,
String.class);
m.setAccessible(true);
return m.invoke(instance, params, instance, nameAndDescriptor);
}
}
catch (Exception e) {
e.printStackTrace();
}
return null;
} | [
"public",
"static",
"Object",
"iiIntercept",
"(",
"Object",
"instance",
",",
"Object",
"[",
"]",
"params",
",",
"Object",
"instance2",
",",
"String",
"nameAndDescriptor",
")",
"{",
"Class",
"<",
"?",
">",
"clazz",
"=",
"instance",
".",
"getClass",
"(",
")"... | See notes.md#001
@param instance the object instance on which the INVOKEINTERFACE is being called
@param params the parameters to the INVOKEINTERFACE call
@param instance2 the object instance on which the INVOKEINTERFACE is being called
@param nameAndDescriptor the name and descriptor of what is being called (e.g. foo(Ljava/lang/String)I)
@return the result of making the INVOKEINTERFACE call | [
"See",
"notes",
".",
"md#001"
] | train | https://github.com/spring-projects/spring-loaded/blob/59b32f957a05c6d9f149148158053605e2a6205a/springloaded/src/main/java/org/springsource/loaded/TypeRegistry.java#L1512-L1543 |
lucmoreau/ProvToolbox | prov-interop/src/main/java/org/openprovenance/prov/interop/InteropFramework.java | InteropFramework.readDocumentFromFile | public Document readDocumentFromFile(String filename) {
ProvFormat format = getTypeForFile(filename);
if (format == null) {
throw new InteropException("Unknown output file format: "
+ filename);
}
return readDocumentFromFile(filename, format);
} | java | public Document readDocumentFromFile(String filename) {
ProvFormat format = getTypeForFile(filename);
if (format == null) {
throw new InteropException("Unknown output file format: "
+ filename);
}
return readDocumentFromFile(filename, format);
} | [
"public",
"Document",
"readDocumentFromFile",
"(",
"String",
"filename",
")",
"{",
"ProvFormat",
"format",
"=",
"getTypeForFile",
"(",
"filename",
")",
";",
"if",
"(",
"format",
"==",
"null",
")",
"{",
"throw",
"new",
"InteropException",
"(",
"\"Unknown output f... | Reads a document from a file, using the file extension to decide which parser to read the file with.
@param filename the file to read a document from
@return a Document | [
"Reads",
"a",
"document",
"from",
"a",
"file",
"using",
"the",
"file",
"extension",
"to",
"decide",
"which",
"parser",
"to",
"read",
"the",
"file",
"with",
"."
] | train | https://github.com/lucmoreau/ProvToolbox/blob/f865952868ffb69432937b08728c86bebbe4678a/prov-interop/src/main/java/org/openprovenance/prov/interop/InteropFramework.java#L685-L693 |
jenkinsci/multi-branch-project-plugin | src/main/java/com/github/mjdetullio/jenkins/plugins/multibranch/TemplateDrivenMultiBranchProject.java | TemplateDrivenMultiBranchProject.initViews | @Override
protected void initViews(List<View> views) throws IOException {
BranchListView v = new BranchListView("All", this);
v.setIncludeRegex(".*");
views.add(v);
v.save();
} | java | @Override
protected void initViews(List<View> views) throws IOException {
BranchListView v = new BranchListView("All", this);
v.setIncludeRegex(".*");
views.add(v);
v.save();
} | [
"@",
"Override",
"protected",
"void",
"initViews",
"(",
"List",
"<",
"View",
">",
"views",
")",
"throws",
"IOException",
"{",
"BranchListView",
"v",
"=",
"new",
"BranchListView",
"(",
"\"All\"",
",",
"this",
")",
";",
"v",
".",
"setIncludeRegex",
"(",
"\".... | Overrides view initialization to use BranchListView instead of AllView.
<br>
{@inheritDoc} | [
"Overrides",
"view",
"initialization",
"to",
"use",
"BranchListView",
"instead",
"of",
"AllView",
".",
"<br",
">",
"{"
] | train | https://github.com/jenkinsci/multi-branch-project-plugin/blob/a98828f6b5ea4e0f69a83f3d274fe05063caad52/src/main/java/com/github/mjdetullio/jenkins/plugins/multibranch/TemplateDrivenMultiBranchProject.java#L163-L169 |
m-m-m/util | event/src/main/java/net/sf/mmm/util/event/base/AbstractEventBus.java | AbstractEventBus.handleErrors | protected void handleErrors(Collection<Throwable> errors, Object event) {
if (this.globalExceptionHandler == null) {
for (Throwable error : errors) {
LOG.error("Failed to dispatch event {}", event, error);
}
} else {
this.globalExceptionHandler.handleErrors(event, errors.toArray(new Throwable[errors.size()]));
}
} | java | protected void handleErrors(Collection<Throwable> errors, Object event) {
if (this.globalExceptionHandler == null) {
for (Throwable error : errors) {
LOG.error("Failed to dispatch event {}", event, error);
}
} else {
this.globalExceptionHandler.handleErrors(event, errors.toArray(new Throwable[errors.size()]));
}
} | [
"protected",
"void",
"handleErrors",
"(",
"Collection",
"<",
"Throwable",
">",
"errors",
",",
"Object",
"event",
")",
"{",
"if",
"(",
"this",
".",
"globalExceptionHandler",
"==",
"null",
")",
"{",
"for",
"(",
"Throwable",
"error",
":",
"errors",
")",
"{",
... | This method is called if errors occurred while dispatching events.
@param errors is the {@link Collection} with the errors. Will NOT be {@link Collection#isEmpty() empty}.
@param event is the event that has been send and caused the errors. | [
"This",
"method",
"is",
"called",
"if",
"errors",
"occurred",
"while",
"dispatching",
"events",
"."
] | train | https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/event/src/main/java/net/sf/mmm/util/event/base/AbstractEventBus.java#L161-L170 |
jsurfer/JsonSurfer | jsurfer-core/src/main/java/org/jsfr/json/JsonSurfer.java | JsonSurfer.collectAll | @Deprecated
public Collection<Object> collectAll(Reader reader, String... paths) {
return collectAll(reader, compile(paths));
} | java | @Deprecated
public Collection<Object> collectAll(Reader reader, String... paths) {
return collectAll(reader, compile(paths));
} | [
"@",
"Deprecated",
"public",
"Collection",
"<",
"Object",
">",
"collectAll",
"(",
"Reader",
"reader",
",",
"String",
"...",
"paths",
")",
"{",
"return",
"collectAll",
"(",
"reader",
",",
"compile",
"(",
"paths",
")",
")",
";",
"}"
] | Collect all matched value into a collection
@param reader Json reader
@param paths JsonPath
@return values
@deprecated use {@link #collectAll(InputStream, String...)} instead | [
"Collect",
"all",
"matched",
"value",
"into",
"a",
"collection"
] | train | https://github.com/jsurfer/JsonSurfer/blob/52bd75a453338b86e115092803da140bf99cee62/jsurfer-core/src/main/java/org/jsfr/json/JsonSurfer.java#L301-L304 |
google/auto | common/src/main/java/com/google/auto/common/GeneratedAnnotationSpecs.java | GeneratedAnnotationSpecs.generatedAnnotationSpec | public static Optional<AnnotationSpec> generatedAnnotationSpec(
Elements elements, SourceVersion sourceVersion, Class<?> processorClass) {
return generatedAnnotationSpecBuilder(elements, sourceVersion, processorClass)
.map(AnnotationSpec.Builder::build);
} | java | public static Optional<AnnotationSpec> generatedAnnotationSpec(
Elements elements, SourceVersion sourceVersion, Class<?> processorClass) {
return generatedAnnotationSpecBuilder(elements, sourceVersion, processorClass)
.map(AnnotationSpec.Builder::build);
} | [
"public",
"static",
"Optional",
"<",
"AnnotationSpec",
">",
"generatedAnnotationSpec",
"(",
"Elements",
"elements",
",",
"SourceVersion",
"sourceVersion",
",",
"Class",
"<",
"?",
">",
"processorClass",
")",
"{",
"return",
"generatedAnnotationSpecBuilder",
"(",
"elemen... | Returns {@code @Generated("processorClass"} for the target {@code SourceVersion}.
<p>Returns {@code javax.annotation.processing.Generated} for JDK 9 and newer, {@code
javax.annotation.Generated} for earlier releases, and Optional#empty()} if the annotation is
not available. | [
"Returns",
"{",
"@code",
"@Generated",
"(",
"processorClass",
"}",
"for",
"the",
"target",
"{",
"@code",
"SourceVersion",
"}",
"."
] | train | https://github.com/google/auto/blob/4158a5fa71f1ef763e683b627f4d29bc04cfde9d/common/src/main/java/com/google/auto/common/GeneratedAnnotationSpecs.java#L73-L77 |
dita-ot/dita-ot | src/main/java/org/dita/dost/project/XmlReader.java | XmlReader.readDocument | private Document readDocument(InputStream in, URI file) throws TransformerConfigurationException, SAXException, IOException {
final Document document = documentBuilder.newDocument();
if (file != null) {
document.setDocumentURI(file.toString());
}
final TransformerHandler domSerializer = saxTransformerFactory.newTransformerHandler();
domSerializer.setResult(new DOMResult(document));
final InputSource inputSource = new InputSource(in);
if (file != null) {
inputSource.setSystemId(file.toString());
}
validator.validate(new SAXSource(inputSource), new SAXResult(domSerializer));
return document;
} | java | private Document readDocument(InputStream in, URI file) throws TransformerConfigurationException, SAXException, IOException {
final Document document = documentBuilder.newDocument();
if (file != null) {
document.setDocumentURI(file.toString());
}
final TransformerHandler domSerializer = saxTransformerFactory.newTransformerHandler();
domSerializer.setResult(new DOMResult(document));
final InputSource inputSource = new InputSource(in);
if (file != null) {
inputSource.setSystemId(file.toString());
}
validator.validate(new SAXSource(inputSource), new SAXResult(domSerializer));
return document;
} | [
"private",
"Document",
"readDocument",
"(",
"InputStream",
"in",
",",
"URI",
"file",
")",
"throws",
"TransformerConfigurationException",
",",
"SAXException",
",",
"IOException",
"{",
"final",
"Document",
"document",
"=",
"documentBuilder",
".",
"newDocument",
"(",
"... | Read and validate project file.
@param in input project file
@param file
@return project file document | [
"Read",
"and",
"validate",
"project",
"file",
"."
] | train | https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/project/XmlReader.java#L136-L151 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/trees/EnglishGrammaticalStructure.java | EnglishGrammaticalStructure.collapse2WP | private static void collapse2WP(Collection<TypedDependency> list) {
Collection<TypedDependency> newTypedDeps = new ArrayList<TypedDependency>();
for (String[] mwp : MULTIWORD_PREPS) {
// first look for patterns such as:
// X(gov, mwp[0])
// Y(mpw[0],mwp[1])
// Z(mwp[1], compl) or Z(mwp[0], compl)
// -> prep_mwp[0]_mwp[1](gov, compl)
collapseMultiWordPrep(list, newTypedDeps, mwp[0], mwp[1], mwp[0], mwp[1]);
// now look for patterns such as:
// X(gov, mwp[1])
// Y(mpw[1],mwp[0])
// Z(mwp[1], compl) or Z(mwp[0], compl)
// -> prep_mwp[0]_mwp[1](gov, compl)
collapseMultiWordPrep(list, newTypedDeps, mwp[0], mwp[1], mwp[1], mwp[0]);
}
} | java | private static void collapse2WP(Collection<TypedDependency> list) {
Collection<TypedDependency> newTypedDeps = new ArrayList<TypedDependency>();
for (String[] mwp : MULTIWORD_PREPS) {
// first look for patterns such as:
// X(gov, mwp[0])
// Y(mpw[0],mwp[1])
// Z(mwp[1], compl) or Z(mwp[0], compl)
// -> prep_mwp[0]_mwp[1](gov, compl)
collapseMultiWordPrep(list, newTypedDeps, mwp[0], mwp[1], mwp[0], mwp[1]);
// now look for patterns such as:
// X(gov, mwp[1])
// Y(mpw[1],mwp[0])
// Z(mwp[1], compl) or Z(mwp[0], compl)
// -> prep_mwp[0]_mwp[1](gov, compl)
collapseMultiWordPrep(list, newTypedDeps, mwp[0], mwp[1], mwp[1], mwp[0]);
}
} | [
"private",
"static",
"void",
"collapse2WP",
"(",
"Collection",
"<",
"TypedDependency",
">",
"list",
")",
"{",
"Collection",
"<",
"TypedDependency",
">",
"newTypedDeps",
"=",
"new",
"ArrayList",
"<",
"TypedDependency",
">",
"(",
")",
";",
"for",
"(",
"String",
... | Collapse multiword preposition of the following format:
prep|advmod|dep|amod(gov, mwp[0]) <br/>
dep(mpw[0],mwp[1]) <br/>
pobj|pcomp(mwp[1], compl) or pobj|pcomp(mwp[0], compl) <br/>
-> prep_mwp[0]_mwp[1](gov, compl) <br/>
prep|advmod|dep|amod(gov, mwp[1]) <br/>
dep(mpw[1],mwp[0]) <br/>
pobj|pcomp(mwp[1], compl) or pobj|pcomp(mwp[0], compl) <br/>
-> prep_mwp[0]_mwp[1](gov, compl)
<p/>
The collapsing has to be done at once in order to know exactly which node
is the gov and the dep of the multiword preposition. Otherwise this can
lead to problems: removing a non-multiword "to" preposition for example!!!
This method replaces the old "collapsedMultiWordPreps"
@param list
list of typedDependencies to work on | [
"Collapse",
"multiword",
"preposition",
"of",
"the",
"following",
"format",
":",
"prep|advmod|dep|amod",
"(",
"gov",
"mwp",
"[",
"0",
"]",
")",
"<br",
"/",
">",
"dep",
"(",
"mpw",
"[",
"0",
"]",
"mwp",
"[",
"1",
"]",
")",
"<br",
"/",
">",
"pobj|pcomp... | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/trees/EnglishGrammaticalStructure.java#L1141-L1159 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.