repository_name
stringlengths 7
58
| func_path_in_repository
stringlengths 11
218
| func_name
stringlengths 4
140
| whole_func_string
stringlengths 153
5.32k
| language
stringclasses 1
value | func_code_string
stringlengths 72
4k
| func_code_tokens
sequencelengths 20
832
| func_documentation_string
stringlengths 61
2k
| func_documentation_tokens
sequencelengths 1
647
| split_name
stringclasses 1
value | func_code_url
stringlengths 102
339
|
---|---|---|---|---|---|---|---|---|---|---|
spring-cloud/spring-cloud-stream-app-starters | processor/spring-cloud-starter-stream-processor-tasklaunchrequest-transform/src/main/java/org/springframework/cloud/stream/app/tasklaunchrequest/transform/processor/TasklaunchrequestTransformProcessorConfiguration.java | TasklaunchrequestTransformProcessorConfiguration.addKeyValuePairAsProperty | private void addKeyValuePairAsProperty(String pair, Map<String, String> properties) {
"""
Adds a String of format key=value to the provided Map as a key/value pair.
@param pair the String representation
@param properties the Map to which the key/value pair should be added
"""
int firstEquals = pair.indexOf('=');
if (firstEquals != -1) {
properties.put(pair.substring(0, firstEquals).trim(), pair.substring(firstEquals + 1).trim());
}
} | java | private void addKeyValuePairAsProperty(String pair, Map<String, String> properties) {
int firstEquals = pair.indexOf('=');
if (firstEquals != -1) {
properties.put(pair.substring(0, firstEquals).trim(), pair.substring(firstEquals + 1).trim());
}
} | [
"private",
"void",
"addKeyValuePairAsProperty",
"(",
"String",
"pair",
",",
"Map",
"<",
"String",
",",
"String",
">",
"properties",
")",
"{",
"int",
"firstEquals",
"=",
"pair",
".",
"indexOf",
"(",
"'",
"'",
")",
";",
"if",
"(",
"firstEquals",
"!=",
"-",
"1",
")",
"{",
"properties",
".",
"put",
"(",
"pair",
".",
"substring",
"(",
"0",
",",
"firstEquals",
")",
".",
"trim",
"(",
")",
",",
"pair",
".",
"substring",
"(",
"firstEquals",
"+",
"1",
")",
".",
"trim",
"(",
")",
")",
";",
"}",
"}"
] | Adds a String of format key=value to the provided Map as a key/value pair.
@param pair the String representation
@param properties the Map to which the key/value pair should be added | [
"Adds",
"a",
"String",
"of",
"format",
"key",
"=",
"value",
"to",
"the",
"provided",
"Map",
"as",
"a",
"key",
"/",
"value",
"pair",
"."
] | train | https://github.com/spring-cloud/spring-cloud-stream-app-starters/blob/c82827a9b5a6eab78fe6a2d56a946b5f9fb0ead9/processor/spring-cloud-starter-stream-processor-tasklaunchrequest-transform/src/main/java/org/springframework/cloud/stream/app/tasklaunchrequest/transform/processor/TasklaunchrequestTransformProcessorConfiguration.java#L121-L126 |
JetBrains/xodus | environment/src/main/java/jetbrains/exodus/tree/patricia/PatriciaTreeMutable.java | PatriciaTreeMutable.mutateUp | private void mutateUp(@NotNull final Deque<ChildReferenceTransient> stack, MutableNode node) {
"""
/*
stack contains all ancestors of the node, stack.peek() is its parent.
"""
while (!stack.isEmpty()) {
final ChildReferenceTransient parent = stack.pop();
final MutableNode mutableParent = parent.mutate(this);
mutableParent.setChild(parent.firstByte, node);
node = mutableParent;
}
} | java | private void mutateUp(@NotNull final Deque<ChildReferenceTransient> stack, MutableNode node) {
while (!stack.isEmpty()) {
final ChildReferenceTransient parent = stack.pop();
final MutableNode mutableParent = parent.mutate(this);
mutableParent.setChild(parent.firstByte, node);
node = mutableParent;
}
} | [
"private",
"void",
"mutateUp",
"(",
"@",
"NotNull",
"final",
"Deque",
"<",
"ChildReferenceTransient",
">",
"stack",
",",
"MutableNode",
"node",
")",
"{",
"while",
"(",
"!",
"stack",
".",
"isEmpty",
"(",
")",
")",
"{",
"final",
"ChildReferenceTransient",
"parent",
"=",
"stack",
".",
"pop",
"(",
")",
";",
"final",
"MutableNode",
"mutableParent",
"=",
"parent",
".",
"mutate",
"(",
"this",
")",
";",
"mutableParent",
".",
"setChild",
"(",
"parent",
".",
"firstByte",
",",
"node",
")",
";",
"node",
"=",
"mutableParent",
";",
"}",
"}"
] | /*
stack contains all ancestors of the node, stack.peek() is its parent. | [
"/",
"*",
"stack",
"contains",
"all",
"ancestors",
"of",
"the",
"node",
"stack",
".",
"peek",
"()",
"is",
"its",
"parent",
"."
] | train | https://github.com/JetBrains/xodus/blob/7b3476c4e81db66f9c7529148c761605cc8eea6d/environment/src/main/java/jetbrains/exodus/tree/patricia/PatriciaTreeMutable.java#L416-L423 |
anotheria/moskito | moskito-core/src/main/java/net/anotheria/moskito/core/logging/LoggerUtil.java | LoggerUtil.createSLF4JIntervalStatsLoggerForAllConfiguredIntervals | public static final void createSLF4JIntervalStatsLoggerForAllConfiguredIntervals(IStatsProducer producer, String loggerNamePrefix) {
"""
Creates interval stats loggers for all configured intervals. Every logger is attached to a logger with name
loggerNamePrefix<intervalName>. If loggerNamePrefix is for example 'foo' then all loggers are attached to
foo1m, foo5m, foo15m etc, for all configured intervals.
@param producer producer to attach loggers to.
@param loggerNamePrefix loggerNamePrefix prefix.
"""
List<String> configuredIntervals = MoskitoConfigurationHolder.getConfiguration().getConfiguredIntervalNames();
for (String intervalName : configuredIntervals){
new IntervalStatsLogger(producer,
IntervalRegistry.getInstance().getInterval(intervalName),
new SLF4JLogOutput(LoggerFactory.getLogger(loggerNamePrefix+intervalName)));
}
} | java | public static final void createSLF4JIntervalStatsLoggerForAllConfiguredIntervals(IStatsProducer producer, String loggerNamePrefix){
List<String> configuredIntervals = MoskitoConfigurationHolder.getConfiguration().getConfiguredIntervalNames();
for (String intervalName : configuredIntervals){
new IntervalStatsLogger(producer,
IntervalRegistry.getInstance().getInterval(intervalName),
new SLF4JLogOutput(LoggerFactory.getLogger(loggerNamePrefix+intervalName)));
}
} | [
"public",
"static",
"final",
"void",
"createSLF4JIntervalStatsLoggerForAllConfiguredIntervals",
"(",
"IStatsProducer",
"producer",
",",
"String",
"loggerNamePrefix",
")",
"{",
"List",
"<",
"String",
">",
"configuredIntervals",
"=",
"MoskitoConfigurationHolder",
".",
"getConfiguration",
"(",
")",
".",
"getConfiguredIntervalNames",
"(",
")",
";",
"for",
"(",
"String",
"intervalName",
":",
"configuredIntervals",
")",
"{",
"new",
"IntervalStatsLogger",
"(",
"producer",
",",
"IntervalRegistry",
".",
"getInstance",
"(",
")",
".",
"getInterval",
"(",
"intervalName",
")",
",",
"new",
"SLF4JLogOutput",
"(",
"LoggerFactory",
".",
"getLogger",
"(",
"loggerNamePrefix",
"+",
"intervalName",
")",
")",
")",
";",
"}",
"}"
] | Creates interval stats loggers for all configured intervals. Every logger is attached to a logger with name
loggerNamePrefix<intervalName>. If loggerNamePrefix is for example 'foo' then all loggers are attached to
foo1m, foo5m, foo15m etc, for all configured intervals.
@param producer producer to attach loggers to.
@param loggerNamePrefix loggerNamePrefix prefix. | [
"Creates",
"interval",
"stats",
"loggers",
"for",
"all",
"configured",
"intervals",
".",
"Every",
"logger",
"is",
"attached",
"to",
"a",
"logger",
"with",
"name",
"loggerNamePrefix<",
";",
"intervalName>",
";",
".",
"If",
"loggerNamePrefix",
"is",
"for",
"example",
"foo",
"then",
"all",
"loggers",
"are",
"attached",
"to",
"foo1m",
"foo5m",
"foo15m",
"etc",
"for",
"all",
"configured",
"intervals",
"."
] | train | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-core/src/main/java/net/anotheria/moskito/core/logging/LoggerUtil.java#L41-L48 |
actframework/actframework | src/main/java/act/event/EventBus.java | EventBus.emitSync | public EventBus emitSync(String event, Object... args) {
"""
Emit a string event with parameters and force all listener to be called synchronously.
@param event
the target event
@param args
the arguments passed in
@see #emit(String, Object...)
"""
return _emitWithOnceBus(eventContextSync(event, args));
} | java | public EventBus emitSync(String event, Object... args) {
return _emitWithOnceBus(eventContextSync(event, args));
} | [
"public",
"EventBus",
"emitSync",
"(",
"String",
"event",
",",
"Object",
"...",
"args",
")",
"{",
"return",
"_emitWithOnceBus",
"(",
"eventContextSync",
"(",
"event",
",",
"args",
")",
")",
";",
"}"
] | Emit a string event with parameters and force all listener to be called synchronously.
@param event
the target event
@param args
the arguments passed in
@see #emit(String, Object...) | [
"Emit",
"a",
"string",
"event",
"with",
"parameters",
"and",
"force",
"all",
"listener",
"to",
"be",
"called",
"synchronously",
"."
] | train | https://github.com/actframework/actframework/blob/55a8f8b45e71159a79ec6e157c02f71700f8cd54/src/main/java/act/event/EventBus.java#L1092-L1094 |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/CookieHelper.java | CookieHelper.clearCookie | @Sensitive
public static void clearCookie(HttpServletRequest req, HttpServletResponse res, String cookieName, Cookie[] cookies) {
"""
Invalidate (clear) the cookie in the HttpServletResponse.
Setting age to 0 to invalidate it.
@param res
"""
Cookie existing = getCookie(cookies, cookieName);
if (existing != null) {
Cookie c = new Cookie(cookieName, "");
String path = existing.getPath();
if (path == null)
path = "/";
c.setPath(path);
c.setMaxAge(0);
//c.setHttpOnly(existing.isHttpOnly());
c.setSecure(existing.getSecure());
res.addCookie(c);
}
} | java | @Sensitive
public static void clearCookie(HttpServletRequest req, HttpServletResponse res, String cookieName, Cookie[] cookies) {
Cookie existing = getCookie(cookies, cookieName);
if (existing != null) {
Cookie c = new Cookie(cookieName, "");
String path = existing.getPath();
if (path == null)
path = "/";
c.setPath(path);
c.setMaxAge(0);
//c.setHttpOnly(existing.isHttpOnly());
c.setSecure(existing.getSecure());
res.addCookie(c);
}
} | [
"@",
"Sensitive",
"public",
"static",
"void",
"clearCookie",
"(",
"HttpServletRequest",
"req",
",",
"HttpServletResponse",
"res",
",",
"String",
"cookieName",
",",
"Cookie",
"[",
"]",
"cookies",
")",
"{",
"Cookie",
"existing",
"=",
"getCookie",
"(",
"cookies",
",",
"cookieName",
")",
";",
"if",
"(",
"existing",
"!=",
"null",
")",
"{",
"Cookie",
"c",
"=",
"new",
"Cookie",
"(",
"cookieName",
",",
"\"\"",
")",
";",
"String",
"path",
"=",
"existing",
".",
"getPath",
"(",
")",
";",
"if",
"(",
"path",
"==",
"null",
")",
"path",
"=",
"\"/\"",
";",
"c",
".",
"setPath",
"(",
"path",
")",
";",
"c",
".",
"setMaxAge",
"(",
"0",
")",
";",
"//c.setHttpOnly(existing.isHttpOnly());",
"c",
".",
"setSecure",
"(",
"existing",
".",
"getSecure",
"(",
")",
")",
";",
"res",
".",
"addCookie",
"(",
"c",
")",
";",
"}",
"}"
] | Invalidate (clear) the cookie in the HttpServletResponse.
Setting age to 0 to invalidate it.
@param res | [
"Invalidate",
"(",
"clear",
")",
"the",
"cookie",
"in",
"the",
"HttpServletResponse",
".",
"Setting",
"age",
"to",
"0",
"to",
"invalidate",
"it",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/CookieHelper.java#L106-L125 |
hyperledger/fabric-sdk-java | src/main/java/org/hyperledger/fabric/sdk/idemix/IdemixUtils.java | IdemixUtils.modSub | static BIG modSub(BIG a, BIG b, BIG m) {
"""
Modsub takes input BIGs a, b, m and returns a-b modulo m
@param a the minuend of the modular subtraction
@param b the subtrahend of the modular subtraction
@param m the modulus
@return returns a-b (mod m)
"""
return modAdd(a, BIG.modneg(b, m), m);
} | java | static BIG modSub(BIG a, BIG b, BIG m) {
return modAdd(a, BIG.modneg(b, m), m);
} | [
"static",
"BIG",
"modSub",
"(",
"BIG",
"a",
",",
"BIG",
"b",
",",
"BIG",
"m",
")",
"{",
"return",
"modAdd",
"(",
"a",
",",
"BIG",
".",
"modneg",
"(",
"b",
",",
"m",
")",
",",
"m",
")",
";",
"}"
] | Modsub takes input BIGs a, b, m and returns a-b modulo m
@param a the minuend of the modular subtraction
@param b the subtrahend of the modular subtraction
@param m the modulus
@return returns a-b (mod m) | [
"Modsub",
"takes",
"input",
"BIGs",
"a",
"b",
"m",
"and",
"returns",
"a",
"-",
"b",
"modulo",
"m"
] | train | https://github.com/hyperledger/fabric-sdk-java/blob/4a2d7b3408b8b0a1ed812aa36942c438159c37a0/src/main/java/org/hyperledger/fabric/sdk/idemix/IdemixUtils.java#L272-L274 |
rpau/javalang-compiler | src/main/java/org/walkmod/javalang/compiler/types/IndexedURLClassPath.java | IndexedURLClassPath.maybeIndexResource | private void maybeIndexResource(String relPath, URL delegate) {
"""
Callers may request the directory itself as a resource, and may
do so with or without trailing slashes. We do this in a while-loop
in case the classpath element has multiple superfluous trailing slashes.
@param relPath relative path
@param delegate value to insert
"""
if (!index.containsKey(relPath)) {
index.put(relPath, delegate);
if (relPath.endsWith(File.separator)) {
maybeIndexResource(relPath.substring(0, relPath.length() - File.separator.length()), delegate);
}
}
} | java | private void maybeIndexResource(String relPath, URL delegate) {
if (!index.containsKey(relPath)) {
index.put(relPath, delegate);
if (relPath.endsWith(File.separator)) {
maybeIndexResource(relPath.substring(0, relPath.length() - File.separator.length()), delegate);
}
}
} | [
"private",
"void",
"maybeIndexResource",
"(",
"String",
"relPath",
",",
"URL",
"delegate",
")",
"{",
"if",
"(",
"!",
"index",
".",
"containsKey",
"(",
"relPath",
")",
")",
"{",
"index",
".",
"put",
"(",
"relPath",
",",
"delegate",
")",
";",
"if",
"(",
"relPath",
".",
"endsWith",
"(",
"File",
".",
"separator",
")",
")",
"{",
"maybeIndexResource",
"(",
"relPath",
".",
"substring",
"(",
"0",
",",
"relPath",
".",
"length",
"(",
")",
"-",
"File",
".",
"separator",
".",
"length",
"(",
")",
")",
",",
"delegate",
")",
";",
"}",
"}",
"}"
] | Callers may request the directory itself as a resource, and may
do so with or without trailing slashes. We do this in a while-loop
in case the classpath element has multiple superfluous trailing slashes.
@param relPath relative path
@param delegate value to insert | [
"Callers",
"may",
"request",
"the",
"directory",
"itself",
"as",
"a",
"resource",
"and",
"may",
"do",
"so",
"with",
"or",
"without",
"trailing",
"slashes",
".",
"We",
"do",
"this",
"in",
"a",
"while",
"-",
"loop",
"in",
"case",
"the",
"classpath",
"element",
"has",
"multiple",
"superfluous",
"trailing",
"slashes",
"."
] | train | https://github.com/rpau/javalang-compiler/blob/d7da81359161feef2bc7ff186c4e1b73c6a5a8ef/src/main/java/org/walkmod/javalang/compiler/types/IndexedURLClassPath.java#L148-L156 |
before/uadetector | modules/uadetector-resources/src/main/java/net/sf/uadetector/service/UADetectorServiceFactory.java | UADetectorServiceFactory.getCachingAndUpdatingParser | public static UserAgentStringParser getCachingAndUpdatingParser(final URL dataUrl, final URL versionUrl) {
"""
Returns an implementation of {@link UserAgentStringParser} which checks at regular intervals for new versions of
<em>UAS data</em> (also known as database). When newer data available, it automatically loads and updates it.
Additionally the loaded data are stored in a cache file.
<p>
At initialization time the returned parser will be loaded with the <em>UAS data</em> of the cache file. If the
cache file doesn't exist or is empty the data of this module will be loaded. The initialization is started only
when this method is called the first time.
<p>
The update of the data store runs as background task. With this feature we try to reduce the initialization time
of this <code>UserAgentStringParser</code>, because a network connection is involved and the remote system can be
not available or slow.
<p>
The static class definition {@code CachingAndUpdatingParserHolder} within this factory class is <em>not</em>
initialized until the JVM determines that {@code CachingAndUpdatingParserHolder} must be executed. The static
class {@code CachingAndUpdatingParserHolder} is only executed when the static method
{@code getOnlineUserAgentStringParser} is invoked on the class {@code UADetectorServiceFactory}, and the first
time this happens the JVM will load and initialize the {@code CachingAndUpdatingParserHolder} class.
<p>
If during the operation the Internet connection gets lost, then this instance continues to work properly (and
under correct log level settings you will get an corresponding log messages).
@param dataUrl
@param versionUrl
@return an user agent string parser with updating service
"""
return CachingAndUpdatingParserHolder.getParser(dataUrl, versionUrl, RESOURCE_MODULE);
} | java | public static UserAgentStringParser getCachingAndUpdatingParser(final URL dataUrl, final URL versionUrl) {
return CachingAndUpdatingParserHolder.getParser(dataUrl, versionUrl, RESOURCE_MODULE);
} | [
"public",
"static",
"UserAgentStringParser",
"getCachingAndUpdatingParser",
"(",
"final",
"URL",
"dataUrl",
",",
"final",
"URL",
"versionUrl",
")",
"{",
"return",
"CachingAndUpdatingParserHolder",
".",
"getParser",
"(",
"dataUrl",
",",
"versionUrl",
",",
"RESOURCE_MODULE",
")",
";",
"}"
] | Returns an implementation of {@link UserAgentStringParser} which checks at regular intervals for new versions of
<em>UAS data</em> (also known as database). When newer data available, it automatically loads and updates it.
Additionally the loaded data are stored in a cache file.
<p>
At initialization time the returned parser will be loaded with the <em>UAS data</em> of the cache file. If the
cache file doesn't exist or is empty the data of this module will be loaded. The initialization is started only
when this method is called the first time.
<p>
The update of the data store runs as background task. With this feature we try to reduce the initialization time
of this <code>UserAgentStringParser</code>, because a network connection is involved and the remote system can be
not available or slow.
<p>
The static class definition {@code CachingAndUpdatingParserHolder} within this factory class is <em>not</em>
initialized until the JVM determines that {@code CachingAndUpdatingParserHolder} must be executed. The static
class {@code CachingAndUpdatingParserHolder} is only executed when the static method
{@code getOnlineUserAgentStringParser} is invoked on the class {@code UADetectorServiceFactory}, and the first
time this happens the JVM will load and initialize the {@code CachingAndUpdatingParserHolder} class.
<p>
If during the operation the Internet connection gets lost, then this instance continues to work properly (and
under correct log level settings you will get an corresponding log messages).
@param dataUrl
@param versionUrl
@return an user agent string parser with updating service | [
"Returns",
"an",
"implementation",
"of",
"{",
"@link",
"UserAgentStringParser",
"}",
"which",
"checks",
"at",
"regular",
"intervals",
"for",
"new",
"versions",
"of",
"<em",
">",
"UAS",
"data<",
"/",
"em",
">",
"(",
"also",
"known",
"as",
"database",
")",
".",
"When",
"newer",
"data",
"available",
"it",
"automatically",
"loads",
"and",
"updates",
"it",
".",
"Additionally",
"the",
"loaded",
"data",
"are",
"stored",
"in",
"a",
"cache",
"file",
"."
] | train | https://github.com/before/uadetector/blob/215fb652723c52866572cff885f52a3fe67b9db5/modules/uadetector-resources/src/main/java/net/sf/uadetector/service/UADetectorServiceFactory.java#L170-L172 |
apache/groovy | subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java | Sql.asList | protected List<GroovyRowResult> asList(String sql, ResultSet rs,
@ClosureParams(value=SimpleType.class, options="java.sql.ResultSetMetaData") Closure metaClosure) throws SQLException {
"""
Hook to allow derived classes to override list of result collection behavior.
The default behavior is to return a list of GroovyRowResult objects corresponding
to each row in the ResultSet.
@param sql query to execute
@param rs the ResultSet to process
@param metaClosure called for meta data (only once after sql execution)
@return the resulting list of rows
@throws SQLException if a database error occurs
"""
return asList(sql, rs, 0, 0, metaClosure);
} | java | protected List<GroovyRowResult> asList(String sql, ResultSet rs,
@ClosureParams(value=SimpleType.class, options="java.sql.ResultSetMetaData") Closure metaClosure) throws SQLException {
return asList(sql, rs, 0, 0, metaClosure);
} | [
"protected",
"List",
"<",
"GroovyRowResult",
">",
"asList",
"(",
"String",
"sql",
",",
"ResultSet",
"rs",
",",
"@",
"ClosureParams",
"(",
"value",
"=",
"SimpleType",
".",
"class",
",",
"options",
"=",
"\"java.sql.ResultSetMetaData\"",
")",
"Closure",
"metaClosure",
")",
"throws",
"SQLException",
"{",
"return",
"asList",
"(",
"sql",
",",
"rs",
",",
"0",
",",
"0",
",",
"metaClosure",
")",
";",
"}"
] | Hook to allow derived classes to override list of result collection behavior.
The default behavior is to return a list of GroovyRowResult objects corresponding
to each row in the ResultSet.
@param sql query to execute
@param rs the ResultSet to process
@param metaClosure called for meta data (only once after sql execution)
@return the resulting list of rows
@throws SQLException if a database error occurs | [
"Hook",
"to",
"allow",
"derived",
"classes",
"to",
"override",
"list",
"of",
"result",
"collection",
"behavior",
".",
"The",
"default",
"behavior",
"is",
"to",
"return",
"a",
"list",
"of",
"GroovyRowResult",
"objects",
"corresponding",
"to",
"each",
"row",
"in",
"the",
"ResultSet",
"."
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java#L3969-L3972 |
JOML-CI/JOML | src/org/joml/Matrix4f.java | Matrix4f.perspectiveRect | public Matrix4f perspectiveRect(float width, float height, float zNear, float zFar, boolean zZeroToOne, Matrix4f dest) {
"""
Apply a symmetric perspective projection frustum transformation for a right-handed coordinate system
using the given NDC z range to this matrix and store the result in <code>dest</code>.
<p>
If <code>M</code> is <code>this</code> matrix and <code>P</code> the perspective projection matrix,
then the new matrix will be <code>M * P</code>. So when transforming a
vector <code>v</code> with the new matrix by using <code>M * P * v</code>,
the perspective projection will be applied first!
<p>
In order to set the matrix to a perspective frustum transformation without post-multiplying,
use {@link #setPerspectiveRect(float, float, float, float, boolean) setPerspectiveRect}.
@see #setPerspectiveRect(float, float, float, float, boolean)
@param width
the width of the near frustum plane
@param height
the height of the near frustum plane
@param zNear
near clipping plane distance. If the special value {@link Float#POSITIVE_INFINITY} is used, the near clipping plane will be at positive infinity.
In that case, <code>zFar</code> may not also be {@link Float#POSITIVE_INFINITY}.
@param zFar
far clipping plane distance. If the special value {@link Float#POSITIVE_INFINITY} is used, the far clipping plane will be at positive infinity.
In that case, <code>zNear</code> may not also be {@link Float#POSITIVE_INFINITY}.
@param dest
will hold the result
@param zZeroToOne
whether to use Vulkan's and Direct3D's NDC z range of <code>[0..+1]</code> when <code>true</code>
or whether to use OpenGL's NDC z range of <code>[-1..+1]</code> when <code>false</code>
@return dest
"""
if ((properties & PROPERTY_IDENTITY) != 0)
return dest.setPerspectiveRect(width, height, zNear, zFar, zZeroToOne);
return perspectiveRectGeneric(width, height, zNear, zFar, zZeroToOne, dest);
} | java | public Matrix4f perspectiveRect(float width, float height, float zNear, float zFar, boolean zZeroToOne, Matrix4f dest) {
if ((properties & PROPERTY_IDENTITY) != 0)
return dest.setPerspectiveRect(width, height, zNear, zFar, zZeroToOne);
return perspectiveRectGeneric(width, height, zNear, zFar, zZeroToOne, dest);
} | [
"public",
"Matrix4f",
"perspectiveRect",
"(",
"float",
"width",
",",
"float",
"height",
",",
"float",
"zNear",
",",
"float",
"zFar",
",",
"boolean",
"zZeroToOne",
",",
"Matrix4f",
"dest",
")",
"{",
"if",
"(",
"(",
"properties",
"&",
"PROPERTY_IDENTITY",
")",
"!=",
"0",
")",
"return",
"dest",
".",
"setPerspectiveRect",
"(",
"width",
",",
"height",
",",
"zNear",
",",
"zFar",
",",
"zZeroToOne",
")",
";",
"return",
"perspectiveRectGeneric",
"(",
"width",
",",
"height",
",",
"zNear",
",",
"zFar",
",",
"zZeroToOne",
",",
"dest",
")",
";",
"}"
] | Apply a symmetric perspective projection frustum transformation for a right-handed coordinate system
using the given NDC z range to this matrix and store the result in <code>dest</code>.
<p>
If <code>M</code> is <code>this</code> matrix and <code>P</code> the perspective projection matrix,
then the new matrix will be <code>M * P</code>. So when transforming a
vector <code>v</code> with the new matrix by using <code>M * P * v</code>,
the perspective projection will be applied first!
<p>
In order to set the matrix to a perspective frustum transformation without post-multiplying,
use {@link #setPerspectiveRect(float, float, float, float, boolean) setPerspectiveRect}.
@see #setPerspectiveRect(float, float, float, float, boolean)
@param width
the width of the near frustum plane
@param height
the height of the near frustum plane
@param zNear
near clipping plane distance. If the special value {@link Float#POSITIVE_INFINITY} is used, the near clipping plane will be at positive infinity.
In that case, <code>zFar</code> may not also be {@link Float#POSITIVE_INFINITY}.
@param zFar
far clipping plane distance. If the special value {@link Float#POSITIVE_INFINITY} is used, the far clipping plane will be at positive infinity.
In that case, <code>zNear</code> may not also be {@link Float#POSITIVE_INFINITY}.
@param dest
will hold the result
@param zZeroToOne
whether to use Vulkan's and Direct3D's NDC z range of <code>[0..+1]</code> when <code>true</code>
or whether to use OpenGL's NDC z range of <code>[-1..+1]</code> when <code>false</code>
@return dest | [
"Apply",
"a",
"symmetric",
"perspective",
"projection",
"frustum",
"transformation",
"for",
"a",
"right",
"-",
"handed",
"coordinate",
"system",
"using",
"the",
"given",
"NDC",
"z",
"range",
"to",
"this",
"matrix",
"and",
"store",
"the",
"result",
"in",
"<code",
">",
"dest<",
"/",
"code",
">",
".",
"<p",
">",
"If",
"<code",
">",
"M<",
"/",
"code",
">",
"is",
"<code",
">",
"this<",
"/",
"code",
">",
"matrix",
"and",
"<code",
">",
"P<",
"/",
"code",
">",
"the",
"perspective",
"projection",
"matrix",
"then",
"the",
"new",
"matrix",
"will",
"be",
"<code",
">",
"M",
"*",
"P<",
"/",
"code",
">",
".",
"So",
"when",
"transforming",
"a",
"vector",
"<code",
">",
"v<",
"/",
"code",
">",
"with",
"the",
"new",
"matrix",
"by",
"using",
"<code",
">",
"M",
"*",
"P",
"*",
"v<",
"/",
"code",
">",
"the",
"perspective",
"projection",
"will",
"be",
"applied",
"first!",
"<p",
">",
"In",
"order",
"to",
"set",
"the",
"matrix",
"to",
"a",
"perspective",
"frustum",
"transformation",
"without",
"post",
"-",
"multiplying",
"use",
"{",
"@link",
"#setPerspectiveRect",
"(",
"float",
"float",
"float",
"float",
"boolean",
")",
"setPerspectiveRect",
"}",
"."
] | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4f.java#L9425-L9429 |
Alluxio/alluxio | core/server/master/src/main/java/alluxio/master/file/activesync/ActiveSyncManager.java | ActiveSyncManager.getSyncPathList | public List<SyncPointInfo> getSyncPathList() {
"""
Get the sync point list.
@return a list of URIs (sync points)
"""
List<SyncPointInfo> returnList = new ArrayList<>();
for (AlluxioURI uri: mSyncPathList) {
SyncPointInfo.SyncStatus status;
Future<?> syncStatus = mSyncPathStatus.get(uri);
if (syncStatus == null) {
status = SyncPointInfo.SyncStatus.NOT_INITIALLY_SYNCED;
} else if (syncStatus.isDone()) {
status = SyncPointInfo.SyncStatus.INITIALLY_SYNCED;
} else {
status = SyncPointInfo.SyncStatus.SYNCING;
}
returnList.add(new SyncPointInfo(uri, status));
}
return returnList;
} | java | public List<SyncPointInfo> getSyncPathList() {
List<SyncPointInfo> returnList = new ArrayList<>();
for (AlluxioURI uri: mSyncPathList) {
SyncPointInfo.SyncStatus status;
Future<?> syncStatus = mSyncPathStatus.get(uri);
if (syncStatus == null) {
status = SyncPointInfo.SyncStatus.NOT_INITIALLY_SYNCED;
} else if (syncStatus.isDone()) {
status = SyncPointInfo.SyncStatus.INITIALLY_SYNCED;
} else {
status = SyncPointInfo.SyncStatus.SYNCING;
}
returnList.add(new SyncPointInfo(uri, status));
}
return returnList;
} | [
"public",
"List",
"<",
"SyncPointInfo",
">",
"getSyncPathList",
"(",
")",
"{",
"List",
"<",
"SyncPointInfo",
">",
"returnList",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"AlluxioURI",
"uri",
":",
"mSyncPathList",
")",
"{",
"SyncPointInfo",
".",
"SyncStatus",
"status",
";",
"Future",
"<",
"?",
">",
"syncStatus",
"=",
"mSyncPathStatus",
".",
"get",
"(",
"uri",
")",
";",
"if",
"(",
"syncStatus",
"==",
"null",
")",
"{",
"status",
"=",
"SyncPointInfo",
".",
"SyncStatus",
".",
"NOT_INITIALLY_SYNCED",
";",
"}",
"else",
"if",
"(",
"syncStatus",
".",
"isDone",
"(",
")",
")",
"{",
"status",
"=",
"SyncPointInfo",
".",
"SyncStatus",
".",
"INITIALLY_SYNCED",
";",
"}",
"else",
"{",
"status",
"=",
"SyncPointInfo",
".",
"SyncStatus",
".",
"SYNCING",
";",
"}",
"returnList",
".",
"add",
"(",
"new",
"SyncPointInfo",
"(",
"uri",
",",
"status",
")",
")",
";",
"}",
"return",
"returnList",
";",
"}"
] | Get the sync point list.
@return a list of URIs (sync points) | [
"Get",
"the",
"sync",
"point",
"list",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/master/src/main/java/alluxio/master/file/activesync/ActiveSyncManager.java#L338-L353 |
dickschoeller/gedbrowser | gedbrowser-datamodel/src/main/java/org/schoellerfamily/gedbrowser/datamodel/util/FamilyBuilderImpl.java | FamilyBuilderImpl.createFamilyEvent | public Attribute createFamilyEvent(final Family family, final String type,
final String dateString) {
"""
Create a dated event.
@param family the family the event is for
@param type the type of event
@param dateString the date of the event
@return the created event
"""
if (family == null || type == null || dateString == null) {
return gedObjectBuilder.createAttribute();
}
final Attribute event = gedObjectBuilder.createAttribute(family, type);
event.insert(new Date(event, dateString));
return event;
} | java | public Attribute createFamilyEvent(final Family family, final String type,
final String dateString) {
if (family == null || type == null || dateString == null) {
return gedObjectBuilder.createAttribute();
}
final Attribute event = gedObjectBuilder.createAttribute(family, type);
event.insert(new Date(event, dateString));
return event;
} | [
"public",
"Attribute",
"createFamilyEvent",
"(",
"final",
"Family",
"family",
",",
"final",
"String",
"type",
",",
"final",
"String",
"dateString",
")",
"{",
"if",
"(",
"family",
"==",
"null",
"||",
"type",
"==",
"null",
"||",
"dateString",
"==",
"null",
")",
"{",
"return",
"gedObjectBuilder",
".",
"createAttribute",
"(",
")",
";",
"}",
"final",
"Attribute",
"event",
"=",
"gedObjectBuilder",
".",
"createAttribute",
"(",
"family",
",",
"type",
")",
";",
"event",
".",
"insert",
"(",
"new",
"Date",
"(",
"event",
",",
"dateString",
")",
")",
";",
"return",
"event",
";",
"}"
] | Create a dated event.
@param family the family the event is for
@param type the type of event
@param dateString the date of the event
@return the created event | [
"Create",
"a",
"dated",
"event",
"."
] | train | https://github.com/dickschoeller/gedbrowser/blob/e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1/gedbrowser-datamodel/src/main/java/org/schoellerfamily/gedbrowser/datamodel/util/FamilyBuilderImpl.java#L71-L79 |
pressgang-ccms/PressGangCCMSCommonUtilities | src/main/java/org/jboss/pressgang/ccms/utils/common/HTMLUtilities.java | HTMLUtilities.inlineHtmlPage | public static String inlineHtmlPage(final String html, final String basePath) {
"""
Takes a XHTML file (usually generated by Publican), and inlines all the
CSS, image and SVG data. The resulting string is a stand alone HTML file
with no references to external resources.
@param html The original XHTML code
@param basePath The path on which all the resources referenced by the
XHTML file can be found
@return A single, stand alone version of the XHTML
"""
String retValue = html;
Document doc = null;
try {
doc = XMLUtilities.convertStringToDocument(html);
} catch (Exception ex) {
LOG.error("Failed to convert the HTML into a DOM Document", ex);
}
if (doc != null) {
inlineImgNodes(doc, basePath);
inlineCssNodes(doc, basePath);
inlineSvgNodes(doc, basePath);
retValue = XMLUtilities.convertDocumentToString(doc);
}
return retValue;
} | java | public static String inlineHtmlPage(final String html, final String basePath) {
String retValue = html;
Document doc = null;
try {
doc = XMLUtilities.convertStringToDocument(html);
} catch (Exception ex) {
LOG.error("Failed to convert the HTML into a DOM Document", ex);
}
if (doc != null) {
inlineImgNodes(doc, basePath);
inlineCssNodes(doc, basePath);
inlineSvgNodes(doc, basePath);
retValue = XMLUtilities.convertDocumentToString(doc);
}
return retValue;
} | [
"public",
"static",
"String",
"inlineHtmlPage",
"(",
"final",
"String",
"html",
",",
"final",
"String",
"basePath",
")",
"{",
"String",
"retValue",
"=",
"html",
";",
"Document",
"doc",
"=",
"null",
";",
"try",
"{",
"doc",
"=",
"XMLUtilities",
".",
"convertStringToDocument",
"(",
"html",
")",
";",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"LOG",
".",
"error",
"(",
"\"Failed to convert the HTML into a DOM Document\"",
",",
"ex",
")",
";",
"}",
"if",
"(",
"doc",
"!=",
"null",
")",
"{",
"inlineImgNodes",
"(",
"doc",
",",
"basePath",
")",
";",
"inlineCssNodes",
"(",
"doc",
",",
"basePath",
")",
";",
"inlineSvgNodes",
"(",
"doc",
",",
"basePath",
")",
";",
"retValue",
"=",
"XMLUtilities",
".",
"convertDocumentToString",
"(",
"doc",
")",
";",
"}",
"return",
"retValue",
";",
"}"
] | Takes a XHTML file (usually generated by Publican), and inlines all the
CSS, image and SVG data. The resulting string is a stand alone HTML file
with no references to external resources.
@param html The original XHTML code
@param basePath The path on which all the resources referenced by the
XHTML file can be found
@return A single, stand alone version of the XHTML | [
"Takes",
"a",
"XHTML",
"file",
"(",
"usually",
"generated",
"by",
"Publican",
")",
"and",
"inlines",
"all",
"the",
"CSS",
"image",
"and",
"SVG",
"data",
".",
"The",
"resulting",
"string",
"is",
"a",
"stand",
"alone",
"HTML",
"file",
"with",
"no",
"references",
"to",
"external",
"resources",
"."
] | train | https://github.com/pressgang-ccms/PressGangCCMSCommonUtilities/blob/5ebf5ed30a94c34c33f4708caa04a8da99cbb15c/src/main/java/org/jboss/pressgang/ccms/utils/common/HTMLUtilities.java#L60-L78 |
audit4j/audit4j-core | src/main/java/org/audit4j/core/schedule/ConcurrentTaskScheduler.java | ConcurrentTaskScheduler.decorateTask | private Runnable decorateTask(Runnable task, boolean isRepeatingTask) {
"""
Decorate task.
@param task
the task
@param isRepeatingTask
the is repeating task
@return the runnable
"""
Runnable result = TaskUtils.decorateTaskWithErrorHandler(task, this.errorHandler, isRepeatingTask);
if (this.enterpriseConcurrentScheduler) {
result = ManagedTaskBuilder.buildManagedTask(result, task.toString());
}
return result;
} | java | private Runnable decorateTask(Runnable task, boolean isRepeatingTask) {
Runnable result = TaskUtils.decorateTaskWithErrorHandler(task, this.errorHandler, isRepeatingTask);
if (this.enterpriseConcurrentScheduler) {
result = ManagedTaskBuilder.buildManagedTask(result, task.toString());
}
return result;
} | [
"private",
"Runnable",
"decorateTask",
"(",
"Runnable",
"task",
",",
"boolean",
"isRepeatingTask",
")",
"{",
"Runnable",
"result",
"=",
"TaskUtils",
".",
"decorateTaskWithErrorHandler",
"(",
"task",
",",
"this",
".",
"errorHandler",
",",
"isRepeatingTask",
")",
";",
"if",
"(",
"this",
".",
"enterpriseConcurrentScheduler",
")",
"{",
"result",
"=",
"ManagedTaskBuilder",
".",
"buildManagedTask",
"(",
"result",
",",
"task",
".",
"toString",
"(",
")",
")",
";",
"}",
"return",
"result",
";",
"}"
] | Decorate task.
@param task
the task
@param isRepeatingTask
the is repeating task
@return the runnable | [
"Decorate",
"task",
"."
] | train | https://github.com/audit4j/audit4j-core/blob/dc8569108851e64cb0ecc7a39048db0ad070fba2/src/main/java/org/audit4j/core/schedule/ConcurrentTaskScheduler.java#L287-L293 |
wisdom-framework/wisdom-jdbc | wisdom-jpa-manager/src/main/java/org/wisdom/framework/jpa/PersistenceUnitComponent.java | PersistenceUnitComponent.getNewTempClassLoader | @Override
public ClassLoader getNewTempClassLoader() {
"""
In this method we just create a simple temporary class loader. This class
loader uses the bundle's class loader as parent but defines the classes
in this class loader. This has the implicit assumption that the temp
class loader is used BEFORE any bundle's classes are loaded since a class
loader does parent delegation first. Sigh, guess it works most of the
time. There is however, no good alternative though in OSGi we could
actually refresh the bundle.
@see javax.persistence.spi.PersistenceUnitInfo#getNewTempClassLoader()
"""
return new ClassLoader(getClassLoader()) { //NOSONAR
/**
* Searches for the .class file and define it using the current class loader.
* @param className the class name
* @return the class object
* @throws ClassNotFoundException if the class cannot be found
*/
@Override
protected Class findClass(String className) throws ClassNotFoundException {
// Use path of class, then get the resource
String path = className.replace('.', '/').concat(".class");
URL resource = getParent().getResource(path);
if (resource == null) {
throw new ClassNotFoundException(className + " as resource " + path + " in " + getParent());
}
try {
ByteArrayOutputStream bout = new ByteArrayOutputStream();
IOUtils.copy(resource.openStream(), bout);
byte[] buffer = bout.toByteArray();
return defineClass(className, buffer, 0, buffer.length);
} catch (Exception e) {
throw new ClassNotFoundException(className + " as resource" + path + " in " + getParent(), e);
}
}
/**
* Finds a resource in the bundle.
* @param resource the resource
* @return the url of the resource from the bundle, {@code null} if not found.
*/
@Override
protected URL findResource(String resource) {
return getParent().getResource(resource);
}
/**
* Finds resources in the bundle.
* @param resource the resource
* @return the url of the resources from the bundle, empty if not found.
*/
@Override
protected Enumeration<URL> findResources(String resource) throws IOException {
return getParent().getResources(resource);
}
};
} | java | @Override
public ClassLoader getNewTempClassLoader() {
return new ClassLoader(getClassLoader()) { //NOSONAR
/**
* Searches for the .class file and define it using the current class loader.
* @param className the class name
* @return the class object
* @throws ClassNotFoundException if the class cannot be found
*/
@Override
protected Class findClass(String className) throws ClassNotFoundException {
// Use path of class, then get the resource
String path = className.replace('.', '/').concat(".class");
URL resource = getParent().getResource(path);
if (resource == null) {
throw new ClassNotFoundException(className + " as resource " + path + " in " + getParent());
}
try {
ByteArrayOutputStream bout = new ByteArrayOutputStream();
IOUtils.copy(resource.openStream(), bout);
byte[] buffer = bout.toByteArray();
return defineClass(className, buffer, 0, buffer.length);
} catch (Exception e) {
throw new ClassNotFoundException(className + " as resource" + path + " in " + getParent(), e);
}
}
/**
* Finds a resource in the bundle.
* @param resource the resource
* @return the url of the resource from the bundle, {@code null} if not found.
*/
@Override
protected URL findResource(String resource) {
return getParent().getResource(resource);
}
/**
* Finds resources in the bundle.
* @param resource the resource
* @return the url of the resources from the bundle, empty if not found.
*/
@Override
protected Enumeration<URL> findResources(String resource) throws IOException {
return getParent().getResources(resource);
}
};
} | [
"@",
"Override",
"public",
"ClassLoader",
"getNewTempClassLoader",
"(",
")",
"{",
"return",
"new",
"ClassLoader",
"(",
"getClassLoader",
"(",
")",
")",
"{",
"//NOSONAR",
"/**\n * Searches for the .class file and define it using the current class loader.\n * @param className the class name\n * @return the class object\n * @throws ClassNotFoundException if the class cannot be found\n */",
"@",
"Override",
"protected",
"Class",
"findClass",
"(",
"String",
"className",
")",
"throws",
"ClassNotFoundException",
"{",
"// Use path of class, then get the resource",
"String",
"path",
"=",
"className",
".",
"replace",
"(",
"'",
"'",
",",
"'",
"'",
")",
".",
"concat",
"(",
"\".class\"",
")",
";",
"URL",
"resource",
"=",
"getParent",
"(",
")",
".",
"getResource",
"(",
"path",
")",
";",
"if",
"(",
"resource",
"==",
"null",
")",
"{",
"throw",
"new",
"ClassNotFoundException",
"(",
"className",
"+",
"\" as resource \"",
"+",
"path",
"+",
"\" in \"",
"+",
"getParent",
"(",
")",
")",
";",
"}",
"try",
"{",
"ByteArrayOutputStream",
"bout",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"IOUtils",
".",
"copy",
"(",
"resource",
".",
"openStream",
"(",
")",
",",
"bout",
")",
";",
"byte",
"[",
"]",
"buffer",
"=",
"bout",
".",
"toByteArray",
"(",
")",
";",
"return",
"defineClass",
"(",
"className",
",",
"buffer",
",",
"0",
",",
"buffer",
".",
"length",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"ClassNotFoundException",
"(",
"className",
"+",
"\" as resource\"",
"+",
"path",
"+",
"\" in \"",
"+",
"getParent",
"(",
")",
",",
"e",
")",
";",
"}",
"}",
"/**\n * Finds a resource in the bundle.\n * @param resource the resource\n * @return the url of the resource from the bundle, {@code null} if not found.\n */",
"@",
"Override",
"protected",
"URL",
"findResource",
"(",
"String",
"resource",
")",
"{",
"return",
"getParent",
"(",
")",
".",
"getResource",
"(",
"resource",
")",
";",
"}",
"/**\n * Finds resources in the bundle.\n * @param resource the resource\n * @return the url of the resources from the bundle, empty if not found.\n */",
"@",
"Override",
"protected",
"Enumeration",
"<",
"URL",
">",
"findResources",
"(",
"String",
"resource",
")",
"throws",
"IOException",
"{",
"return",
"getParent",
"(",
")",
".",
"getResources",
"(",
"resource",
")",
";",
"}",
"}",
";",
"}"
] | In this method we just create a simple temporary class loader. This class
loader uses the bundle's class loader as parent but defines the classes
in this class loader. This has the implicit assumption that the temp
class loader is used BEFORE any bundle's classes are loaded since a class
loader does parent delegation first. Sigh, guess it works most of the
time. There is however, no good alternative though in OSGi we could
actually refresh the bundle.
@see javax.persistence.spi.PersistenceUnitInfo#getNewTempClassLoader() | [
"In",
"this",
"method",
"we",
"just",
"create",
"a",
"simple",
"temporary",
"class",
"loader",
".",
"This",
"class",
"loader",
"uses",
"the",
"bundle",
"s",
"class",
"loader",
"as",
"parent",
"but",
"defines",
"the",
"classes",
"in",
"this",
"class",
"loader",
".",
"This",
"has",
"the",
"implicit",
"assumption",
"that",
"the",
"temp",
"class",
"loader",
"is",
"used",
"BEFORE",
"any",
"bundle",
"s",
"classes",
"are",
"loaded",
"since",
"a",
"class",
"loader",
"does",
"parent",
"delegation",
"first",
".",
"Sigh",
"guess",
"it",
"works",
"most",
"of",
"the",
"time",
".",
"There",
"is",
"however",
"no",
"good",
"alternative",
"though",
"in",
"OSGi",
"we",
"could",
"actually",
"refresh",
"the",
"bundle",
"."
] | train | https://github.com/wisdom-framework/wisdom-jdbc/blob/931f5acf0b2bcb0a8f3b683d60d326caafd09a72/wisdom-jpa-manager/src/main/java/org/wisdom/framework/jpa/PersistenceUnitComponent.java#L314-L365 |
couchbase/couchbase-lite-java-core | src/main/java/com/couchbase/lite/support/security/SymmetricKey.java | SymmetricKey.decryptData | public byte[] decryptData(byte[] data) throws SymmetricKeyException {
"""
Decrypt the encrypted byte array data. The encrypted data must be prefixed with the
IV header (16 bytes) used when encrypting the data.
@param data Encrypted data
@return Decrypted data
@throws SymmetricKeyException
"""
if (data.length < IV_SIZE)
throw new SymmetricKeyException("Invalid encrypted data, no IV prepended");
byte[] iv = ArrayUtils.subarray(data, 0, IV_SIZE);
Cipher cipher = getCipher(Cipher.DECRYPT_MODE, iv);
try {
return cipher.doFinal(data, iv.length, data.length - iv.length);
} catch (Exception e) {
throw new SymmetricKeyException(e);
}
} | java | public byte[] decryptData(byte[] data) throws SymmetricKeyException {
if (data.length < IV_SIZE)
throw new SymmetricKeyException("Invalid encrypted data, no IV prepended");
byte[] iv = ArrayUtils.subarray(data, 0, IV_SIZE);
Cipher cipher = getCipher(Cipher.DECRYPT_MODE, iv);
try {
return cipher.doFinal(data, iv.length, data.length - iv.length);
} catch (Exception e) {
throw new SymmetricKeyException(e);
}
} | [
"public",
"byte",
"[",
"]",
"decryptData",
"(",
"byte",
"[",
"]",
"data",
")",
"throws",
"SymmetricKeyException",
"{",
"if",
"(",
"data",
".",
"length",
"<",
"IV_SIZE",
")",
"throw",
"new",
"SymmetricKeyException",
"(",
"\"Invalid encrypted data, no IV prepended\"",
")",
";",
"byte",
"[",
"]",
"iv",
"=",
"ArrayUtils",
".",
"subarray",
"(",
"data",
",",
"0",
",",
"IV_SIZE",
")",
";",
"Cipher",
"cipher",
"=",
"getCipher",
"(",
"Cipher",
".",
"DECRYPT_MODE",
",",
"iv",
")",
";",
"try",
"{",
"return",
"cipher",
".",
"doFinal",
"(",
"data",
",",
"iv",
".",
"length",
",",
"data",
".",
"length",
"-",
"iv",
".",
"length",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"SymmetricKeyException",
"(",
"e",
")",
";",
"}",
"}"
] | Decrypt the encrypted byte array data. The encrypted data must be prefixed with the
IV header (16 bytes) used when encrypting the data.
@param data Encrypted data
@return Decrypted data
@throws SymmetricKeyException | [
"Decrypt",
"the",
"encrypted",
"byte",
"array",
"data",
".",
"The",
"encrypted",
"data",
"must",
"be",
"prefixed",
"with",
"the",
"IV",
"header",
"(",
"16",
"bytes",
")",
"used",
"when",
"encrypting",
"the",
"data",
"."
] | train | https://github.com/couchbase/couchbase-lite-java-core/blob/3b275642e2d2f231fd155ad9def9c5e9eff3118e/src/main/java/com/couchbase/lite/support/security/SymmetricKey.java#L131-L141 |
cryptomator/cryptofs | src/main/java/org/cryptomator/cryptofs/ConflictResolver.java | ConflictResolver.resolveConflictsIfNecessary | public Path resolveConflictsIfNecessary(Path ciphertextPath, String dirId) throws IOException {
"""
Checks if the name of the file represented by the given ciphertextPath is a valid ciphertext name without any additional chars.
If any unexpected chars are found on the name but it still contains an authentic ciphertext, it is considered a conflicting file.
Conflicting files will be given a new name. The caller must use the path returned by this function after invoking it, as the given ciphertextPath might be no longer valid.
@param ciphertextPath The path to a file to check.
@param dirId The directory id of the file's parent directory.
@return Either the original name if no unexpected chars have been found or a completely new path.
@throws IOException
"""
String ciphertextFileName = ciphertextPath.getFileName().toString();
String basename = StringUtils.removeEnd(ciphertextFileName, LONG_NAME_FILE_EXT);
Matcher m = CIPHERTEXT_FILENAME_PATTERN.matcher(basename);
if (!m.matches() && m.find(0)) {
// no full match, but still contains base32 -> partial match
return resolveConflict(ciphertextPath, m.group(0), dirId);
} else {
// full match or no match at all -> nothing to resolve
return ciphertextPath;
}
} | java | public Path resolveConflictsIfNecessary(Path ciphertextPath, String dirId) throws IOException {
String ciphertextFileName = ciphertextPath.getFileName().toString();
String basename = StringUtils.removeEnd(ciphertextFileName, LONG_NAME_FILE_EXT);
Matcher m = CIPHERTEXT_FILENAME_PATTERN.matcher(basename);
if (!m.matches() && m.find(0)) {
// no full match, but still contains base32 -> partial match
return resolveConflict(ciphertextPath, m.group(0), dirId);
} else {
// full match or no match at all -> nothing to resolve
return ciphertextPath;
}
} | [
"public",
"Path",
"resolveConflictsIfNecessary",
"(",
"Path",
"ciphertextPath",
",",
"String",
"dirId",
")",
"throws",
"IOException",
"{",
"String",
"ciphertextFileName",
"=",
"ciphertextPath",
".",
"getFileName",
"(",
")",
".",
"toString",
"(",
")",
";",
"String",
"basename",
"=",
"StringUtils",
".",
"removeEnd",
"(",
"ciphertextFileName",
",",
"LONG_NAME_FILE_EXT",
")",
";",
"Matcher",
"m",
"=",
"CIPHERTEXT_FILENAME_PATTERN",
".",
"matcher",
"(",
"basename",
")",
";",
"if",
"(",
"!",
"m",
".",
"matches",
"(",
")",
"&&",
"m",
".",
"find",
"(",
"0",
")",
")",
"{",
"// no full match, but still contains base32 -> partial match",
"return",
"resolveConflict",
"(",
"ciphertextPath",
",",
"m",
".",
"group",
"(",
"0",
")",
",",
"dirId",
")",
";",
"}",
"else",
"{",
"// full match or no match at all -> nothing to resolve",
"return",
"ciphertextPath",
";",
"}",
"}"
] | Checks if the name of the file represented by the given ciphertextPath is a valid ciphertext name without any additional chars.
If any unexpected chars are found on the name but it still contains an authentic ciphertext, it is considered a conflicting file.
Conflicting files will be given a new name. The caller must use the path returned by this function after invoking it, as the given ciphertextPath might be no longer valid.
@param ciphertextPath The path to a file to check.
@param dirId The directory id of the file's parent directory.
@return Either the original name if no unexpected chars have been found or a completely new path.
@throws IOException | [
"Checks",
"if",
"the",
"name",
"of",
"the",
"file",
"represented",
"by",
"the",
"given",
"ciphertextPath",
"is",
"a",
"valid",
"ciphertext",
"name",
"without",
"any",
"additional",
"chars",
".",
"If",
"any",
"unexpected",
"chars",
"are",
"found",
"on",
"the",
"name",
"but",
"it",
"still",
"contains",
"an",
"authentic",
"ciphertext",
"it",
"is",
"considered",
"a",
"conflicting",
"file",
".",
"Conflicting",
"files",
"will",
"be",
"given",
"a",
"new",
"name",
".",
"The",
"caller",
"must",
"use",
"the",
"path",
"returned",
"by",
"this",
"function",
"after",
"invoking",
"it",
"as",
"the",
"given",
"ciphertextPath",
"might",
"be",
"no",
"longer",
"valid",
"."
] | train | https://github.com/cryptomator/cryptofs/blob/67fc1a4950dd1c150cd2e2c75bcabbeb7c9ac82e/src/main/java/org/cryptomator/cryptofs/ConflictResolver.java#L50-L61 |
google/error-prone-javac | src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlTree.java | HtmlTree.SMALL | public static HtmlTree SMALL(Content body) {
"""
Generates a SMALL tag with some content.
@param body content for the tag
@return an HtmlTree object for the SMALL tag
"""
HtmlTree htmltree = new HtmlTree(HtmlTag.SMALL, nullCheck(body));
return htmltree;
} | java | public static HtmlTree SMALL(Content body) {
HtmlTree htmltree = new HtmlTree(HtmlTag.SMALL, nullCheck(body));
return htmltree;
} | [
"public",
"static",
"HtmlTree",
"SMALL",
"(",
"Content",
"body",
")",
"{",
"HtmlTree",
"htmltree",
"=",
"new",
"HtmlTree",
"(",
"HtmlTag",
".",
"SMALL",
",",
"nullCheck",
"(",
"body",
")",
")",
";",
"return",
"htmltree",
";",
"}"
] | Generates a SMALL tag with some content.
@param body content for the tag
@return an HtmlTree object for the SMALL tag | [
"Generates",
"a",
"SMALL",
"tag",
"with",
"some",
"content",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlTree.java#L697-L700 |
gliga/ekstazi | org.ekstazi.core/src/main/java/org/ekstazi/data/Storer.java | Storer.openFileRead | private static FileInputStream openFileRead(String dirName, String fullName, String firstPart, String secondPart) {
"""
Opens {@link FileInputStream}. This method checks if file name is too
long and hashes the file name. If there are some other problems, the
method gives up and returns null.
@param dirName
Destination directory.
@param fullName
Name of the file.
@return Opened {@link FileInputStream} or null if operation was not
successful.
"""
try {
return new FileInputStream(new File(dirName, fullName));
} catch (FileNotFoundException ex1) {
// If file name is too long hash it and try again.
String message = ex1.getMessage();
if (message != null && message.contains("File name too long")) {
if (secondPart != null) {
long hashedSecondPart = Hasher.hashString(secondPart);
fullName = firstPart + "." + Long.toString(hashedSecondPart);
// Note that we pass fullName as the second argument too.
return openFileRead(dirName, fullName, fullName, null);
} else if (firstPart != null) {
long hashedFirstPart = Hasher.hashString(firstPart);
fullName = Long.toString(hashedFirstPart);
return openFileRead(dirName, fullName, null, null);
} else {
// No hope.
Log.w("Could not open file for reading (name too long) " + fullName);
}
}
return null;
}
} | java | private static FileInputStream openFileRead(String dirName, String fullName, String firstPart, String secondPart) {
try {
return new FileInputStream(new File(dirName, fullName));
} catch (FileNotFoundException ex1) {
// If file name is too long hash it and try again.
String message = ex1.getMessage();
if (message != null && message.contains("File name too long")) {
if (secondPart != null) {
long hashedSecondPart = Hasher.hashString(secondPart);
fullName = firstPart + "." + Long.toString(hashedSecondPart);
// Note that we pass fullName as the second argument too.
return openFileRead(dirName, fullName, fullName, null);
} else if (firstPart != null) {
long hashedFirstPart = Hasher.hashString(firstPart);
fullName = Long.toString(hashedFirstPart);
return openFileRead(dirName, fullName, null, null);
} else {
// No hope.
Log.w("Could not open file for reading (name too long) " + fullName);
}
}
return null;
}
} | [
"private",
"static",
"FileInputStream",
"openFileRead",
"(",
"String",
"dirName",
",",
"String",
"fullName",
",",
"String",
"firstPart",
",",
"String",
"secondPart",
")",
"{",
"try",
"{",
"return",
"new",
"FileInputStream",
"(",
"new",
"File",
"(",
"dirName",
",",
"fullName",
")",
")",
";",
"}",
"catch",
"(",
"FileNotFoundException",
"ex1",
")",
"{",
"// If file name is too long hash it and try again.",
"String",
"message",
"=",
"ex1",
".",
"getMessage",
"(",
")",
";",
"if",
"(",
"message",
"!=",
"null",
"&&",
"message",
".",
"contains",
"(",
"\"File name too long\"",
")",
")",
"{",
"if",
"(",
"secondPart",
"!=",
"null",
")",
"{",
"long",
"hashedSecondPart",
"=",
"Hasher",
".",
"hashString",
"(",
"secondPart",
")",
";",
"fullName",
"=",
"firstPart",
"+",
"\".\"",
"+",
"Long",
".",
"toString",
"(",
"hashedSecondPart",
")",
";",
"// Note that we pass fullName as the second argument too.",
"return",
"openFileRead",
"(",
"dirName",
",",
"fullName",
",",
"fullName",
",",
"null",
")",
";",
"}",
"else",
"if",
"(",
"firstPart",
"!=",
"null",
")",
"{",
"long",
"hashedFirstPart",
"=",
"Hasher",
".",
"hashString",
"(",
"firstPart",
")",
";",
"fullName",
"=",
"Long",
".",
"toString",
"(",
"hashedFirstPart",
")",
";",
"return",
"openFileRead",
"(",
"dirName",
",",
"fullName",
",",
"null",
",",
"null",
")",
";",
"}",
"else",
"{",
"// No hope.",
"Log",
".",
"w",
"(",
"\"Could not open file for reading (name too long) \"",
"+",
"fullName",
")",
";",
"}",
"}",
"return",
"null",
";",
"}",
"}"
] | Opens {@link FileInputStream}. This method checks if file name is too
long and hashes the file name. If there are some other problems, the
method gives up and returns null.
@param dirName
Destination directory.
@param fullName
Name of the file.
@return Opened {@link FileInputStream} or null if operation was not
successful. | [
"Opens",
"{",
"@link",
"FileInputStream",
"}",
".",
"This",
"method",
"checks",
"if",
"file",
"name",
"is",
"too",
"long",
"and",
"hashes",
"the",
"file",
"name",
".",
"If",
"there",
"are",
"some",
"other",
"problems",
"the",
"method",
"gives",
"up",
"and",
"returns",
"null",
"."
] | train | https://github.com/gliga/ekstazi/blob/5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1/org.ekstazi.core/src/main/java/org/ekstazi/data/Storer.java#L187-L210 |
alkacon/opencms-core | src/org/opencms/file/CmsObject.java | CmsObject.existsResource | public boolean existsResource(String resourcename, CmsResourceFilter filter) {
"""
Checks the availability of a resource in the VFS,
using the provided filter.<p>
A resource may be of type <code>{@link CmsFile}</code> or
<code>{@link CmsFolder}</code>.<p>
The specified filter controls what kind of resources should be "found"
during the read operation. This will depend on the application. For example,
using <code>{@link CmsResourceFilter#DEFAULT}</code> will only return currently
"valid" resources, while using <code>{@link CmsResourceFilter#IGNORE_EXPIRATION}</code>
will ignore the date release / date expired information of the resource.<p>
This method also takes into account the user permissions, so if
the given resource exists, but the current user has not the required
permissions, then this method will return <code>false</code>.<p>
@param resourcename the name of the resource to check (full current site relative path)
@param filter the resource filter to use while checking
@return <code>true</code> if the resource is available
@see #readResource(String)
@see #readResource(String, CmsResourceFilter)
"""
return m_securityManager.existsResource(m_context, addSiteRoot(resourcename), filter);
} | java | public boolean existsResource(String resourcename, CmsResourceFilter filter) {
return m_securityManager.existsResource(m_context, addSiteRoot(resourcename), filter);
} | [
"public",
"boolean",
"existsResource",
"(",
"String",
"resourcename",
",",
"CmsResourceFilter",
"filter",
")",
"{",
"return",
"m_securityManager",
".",
"existsResource",
"(",
"m_context",
",",
"addSiteRoot",
"(",
"resourcename",
")",
",",
"filter",
")",
";",
"}"
] | Checks the availability of a resource in the VFS,
using the provided filter.<p>
A resource may be of type <code>{@link CmsFile}</code> or
<code>{@link CmsFolder}</code>.<p>
The specified filter controls what kind of resources should be "found"
during the read operation. This will depend on the application. For example,
using <code>{@link CmsResourceFilter#DEFAULT}</code> will only return currently
"valid" resources, while using <code>{@link CmsResourceFilter#IGNORE_EXPIRATION}</code>
will ignore the date release / date expired information of the resource.<p>
This method also takes into account the user permissions, so if
the given resource exists, but the current user has not the required
permissions, then this method will return <code>false</code>.<p>
@param resourcename the name of the resource to check (full current site relative path)
@param filter the resource filter to use while checking
@return <code>true</code> if the resource is available
@see #readResource(String)
@see #readResource(String, CmsResourceFilter) | [
"Checks",
"the",
"availability",
"of",
"a",
"resource",
"in",
"the",
"VFS",
"using",
"the",
"provided",
"filter",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/CmsObject.java#L1229-L1232 |
bullhorn/sdk-rest | src/main/java/com/bullhornsdk/data/api/StandardBullhornData.java | StandardBullhornData.handleDeleteEntity | protected <C extends CrudResponse, T extends DeleteEntity> C handleDeleteEntity(Class<T> type, Integer id) {
"""
Makes the delete api call. The type of delete (soft or hard) depends on the DeleteEntity type of the Class<T> type passed in.
@param type
@param id
@return
"""
Map<String, String> uriVariables = restUriVariablesFactory.getUriVariablesForEntityDelete(
BullhornEntityInfo.getTypesRestEntityName(type), id);
String url = restUrlFactory.assembleEntityDeleteUrl();
CrudResponse response = null;
try {
if (isSoftDeleteEntity(type)) {
String jsonString = "{\"isDeleted\" : true}";
response = this.performPostRequest(url, jsonString, DeleteResponse.class, uriVariables);
}
if (isHardDeleteEntity(type)) {
response = this.performCustomRequest(url, null, DeleteResponse.class, uriVariables, HttpMethod.DELETE, null);
}
} catch (HttpStatusCodeException error) {
response = restErrorHandler.handleHttpFourAndFiveHundredErrors(new DeleteResponse(), error, id);
}
return (C) response;
} | java | protected <C extends CrudResponse, T extends DeleteEntity> C handleDeleteEntity(Class<T> type, Integer id) {
Map<String, String> uriVariables = restUriVariablesFactory.getUriVariablesForEntityDelete(
BullhornEntityInfo.getTypesRestEntityName(type), id);
String url = restUrlFactory.assembleEntityDeleteUrl();
CrudResponse response = null;
try {
if (isSoftDeleteEntity(type)) {
String jsonString = "{\"isDeleted\" : true}";
response = this.performPostRequest(url, jsonString, DeleteResponse.class, uriVariables);
}
if (isHardDeleteEntity(type)) {
response = this.performCustomRequest(url, null, DeleteResponse.class, uriVariables, HttpMethod.DELETE, null);
}
} catch (HttpStatusCodeException error) {
response = restErrorHandler.handleHttpFourAndFiveHundredErrors(new DeleteResponse(), error, id);
}
return (C) response;
} | [
"protected",
"<",
"C",
"extends",
"CrudResponse",
",",
"T",
"extends",
"DeleteEntity",
">",
"C",
"handleDeleteEntity",
"(",
"Class",
"<",
"T",
">",
"type",
",",
"Integer",
"id",
")",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"uriVariables",
"=",
"restUriVariablesFactory",
".",
"getUriVariablesForEntityDelete",
"(",
"BullhornEntityInfo",
".",
"getTypesRestEntityName",
"(",
"type",
")",
",",
"id",
")",
";",
"String",
"url",
"=",
"restUrlFactory",
".",
"assembleEntityDeleteUrl",
"(",
")",
";",
"CrudResponse",
"response",
"=",
"null",
";",
"try",
"{",
"if",
"(",
"isSoftDeleteEntity",
"(",
"type",
")",
")",
"{",
"String",
"jsonString",
"=",
"\"{\\\"isDeleted\\\" : true}\"",
";",
"response",
"=",
"this",
".",
"performPostRequest",
"(",
"url",
",",
"jsonString",
",",
"DeleteResponse",
".",
"class",
",",
"uriVariables",
")",
";",
"}",
"if",
"(",
"isHardDeleteEntity",
"(",
"type",
")",
")",
"{",
"response",
"=",
"this",
".",
"performCustomRequest",
"(",
"url",
",",
"null",
",",
"DeleteResponse",
".",
"class",
",",
"uriVariables",
",",
"HttpMethod",
".",
"DELETE",
",",
"null",
")",
";",
"}",
"}",
"catch",
"(",
"HttpStatusCodeException",
"error",
")",
"{",
"response",
"=",
"restErrorHandler",
".",
"handleHttpFourAndFiveHundredErrors",
"(",
"new",
"DeleteResponse",
"(",
")",
",",
"error",
",",
"id",
")",
";",
"}",
"return",
"(",
"C",
")",
"response",
";",
"}"
] | Makes the delete api call. The type of delete (soft or hard) depends on the DeleteEntity type of the Class<T> type passed in.
@param type
@param id
@return | [
"Makes",
"the",
"delete",
"api",
"call",
".",
"The",
"type",
"of",
"delete",
"(",
"soft",
"or",
"hard",
")",
"depends",
"on",
"the",
"DeleteEntity",
"type",
"of",
"the",
"Class<T",
">",
"type",
"passed",
"in",
"."
] | train | https://github.com/bullhorn/sdk-rest/blob/0c75a141c768bb31510afc3a412c11bd101eca06/src/main/java/com/bullhornsdk/data/api/StandardBullhornData.java#L1192-L1215 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java | ImgUtil.rotate | public static void rotate(Image image, int degree, File outFile) throws IORuntimeException {
"""
旋转图片为指定角度<br>
此方法不会关闭输出流
@param image 目标图像
@param degree 旋转角度
@param outFile 输出文件
@since 3.2.2
@throws IORuntimeException IO异常
"""
write(rotate(image, degree), outFile);
} | java | public static void rotate(Image image, int degree, File outFile) throws IORuntimeException {
write(rotate(image, degree), outFile);
} | [
"public",
"static",
"void",
"rotate",
"(",
"Image",
"image",
",",
"int",
"degree",
",",
"File",
"outFile",
")",
"throws",
"IORuntimeException",
"{",
"write",
"(",
"rotate",
"(",
"image",
",",
"degree",
")",
",",
"outFile",
")",
";",
"}"
] | 旋转图片为指定角度<br>
此方法不会关闭输出流
@param image 目标图像
@param degree 旋转角度
@param outFile 输出文件
@since 3.2.2
@throws IORuntimeException IO异常 | [
"旋转图片为指定角度<br",
">",
"此方法不会关闭输出流"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L1016-L1018 |
sporniket/p3 | src/main/java/com/sporniket/libre/p3/P3.java | P3.executeProgram | @SuppressWarnings("unused")
private void executeProgram(String name, String[] source) throws Exception {
"""
The processor for extracting directives.
@param name
property name, unused.
@param source
the directives.
@throws Exception
when there is a problem.
"""
String _singleStringSource = executeProgram__makeSingleStringSource(source);
executeProgram(name, _singleStringSource);
} | java | @SuppressWarnings("unused")
private void executeProgram(String name, String[] source) throws Exception
{
String _singleStringSource = executeProgram__makeSingleStringSource(source);
executeProgram(name, _singleStringSource);
} | [
"@",
"SuppressWarnings",
"(",
"\"unused\"",
")",
"private",
"void",
"executeProgram",
"(",
"String",
"name",
",",
"String",
"[",
"]",
"source",
")",
"throws",
"Exception",
"{",
"String",
"_singleStringSource",
"=",
"executeProgram__makeSingleStringSource",
"(",
"source",
")",
";",
"executeProgram",
"(",
"name",
",",
"_singleStringSource",
")",
";",
"}"
] | The processor for extracting directives.
@param name
property name, unused.
@param source
the directives.
@throws Exception
when there is a problem. | [
"The",
"processor",
"for",
"extracting",
"directives",
"."
] | train | https://github.com/sporniket/p3/blob/fc20b3066dc4a9cd759090adae0a6b02508df135/src/main/java/com/sporniket/libre/p3/P3.java#L558-L563 |
fcrepo3/fcrepo | fcrepo-server/src/main/java/org/fcrepo/server/journal/JournalCreator.java | JournalCreator.getNextPID | public String[] getNextPID(Context context, int numPIDs, String namespace)
throws ServerException {
"""
Create a journal entry, add the arguments, and invoke the method.
"""
try {
CreatorJournalEntry cje =
new CreatorJournalEntry(METHOD_GET_NEXT_PID, context);
cje.addArgument(ARGUMENT_NAME_NUM_PIDS, numPIDs);
cje.addArgument(ARGUMENT_NAME_NAMESPACE, namespace);
return (String[]) cje.invokeAndClose(delegate, writer);
} catch (JournalException e) {
throw new GeneralException("Problem creating the Journal", e);
}
} | java | public String[] getNextPID(Context context, int numPIDs, String namespace)
throws ServerException {
try {
CreatorJournalEntry cje =
new CreatorJournalEntry(METHOD_GET_NEXT_PID, context);
cje.addArgument(ARGUMENT_NAME_NUM_PIDS, numPIDs);
cje.addArgument(ARGUMENT_NAME_NAMESPACE, namespace);
return (String[]) cje.invokeAndClose(delegate, writer);
} catch (JournalException e) {
throw new GeneralException("Problem creating the Journal", e);
}
} | [
"public",
"String",
"[",
"]",
"getNextPID",
"(",
"Context",
"context",
",",
"int",
"numPIDs",
",",
"String",
"namespace",
")",
"throws",
"ServerException",
"{",
"try",
"{",
"CreatorJournalEntry",
"cje",
"=",
"new",
"CreatorJournalEntry",
"(",
"METHOD_GET_NEXT_PID",
",",
"context",
")",
";",
"cje",
".",
"addArgument",
"(",
"ARGUMENT_NAME_NUM_PIDS",
",",
"numPIDs",
")",
";",
"cje",
".",
"addArgument",
"(",
"ARGUMENT_NAME_NAMESPACE",
",",
"namespace",
")",
";",
"return",
"(",
"String",
"[",
"]",
")",
"cje",
".",
"invokeAndClose",
"(",
"delegate",
",",
"writer",
")",
";",
"}",
"catch",
"(",
"JournalException",
"e",
")",
"{",
"throw",
"new",
"GeneralException",
"(",
"\"Problem creating the Journal\"",
",",
"e",
")",
";",
"}",
"}"
] | Create a journal entry, add the arguments, and invoke the method. | [
"Create",
"a",
"journal",
"entry",
"add",
"the",
"arguments",
"and",
"invoke",
"the",
"method",
"."
] | train | https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/journal/JournalCreator.java#L360-L371 |
hdbeukel/james-extensions | src/main/java/org/jamesframework/ext/permutation/neigh/SingleSwapNeighbourhood.java | SingleSwapNeighbourhood.getRandomMove | @Override
public SingleSwapMove getRandomMove(PermutationSolution solution, Random rnd) {
"""
Create a random single swap move.
@param solution permutation solution to which the move is to be applied
@param rnd source of randomness used to generate random move
@return random swap move, <code>null</code> if the permutation contains
less than 2 items
"""
int n = solution.size();
// check: move possible
if(n < 2){
return null;
}
// pick two random, distinct positions to swap
int i = rnd.nextInt(n);
int j = rnd.nextInt(n-1);
if(j >= i){
j++;
}
// generate swap move
return new SingleSwapMove(i, j);
} | java | @Override
public SingleSwapMove getRandomMove(PermutationSolution solution, Random rnd) {
int n = solution.size();
// check: move possible
if(n < 2){
return null;
}
// pick two random, distinct positions to swap
int i = rnd.nextInt(n);
int j = rnd.nextInt(n-1);
if(j >= i){
j++;
}
// generate swap move
return new SingleSwapMove(i, j);
} | [
"@",
"Override",
"public",
"SingleSwapMove",
"getRandomMove",
"(",
"PermutationSolution",
"solution",
",",
"Random",
"rnd",
")",
"{",
"int",
"n",
"=",
"solution",
".",
"size",
"(",
")",
";",
"// check: move possible",
"if",
"(",
"n",
"<",
"2",
")",
"{",
"return",
"null",
";",
"}",
"// pick two random, distinct positions to swap",
"int",
"i",
"=",
"rnd",
".",
"nextInt",
"(",
"n",
")",
";",
"int",
"j",
"=",
"rnd",
".",
"nextInt",
"(",
"n",
"-",
"1",
")",
";",
"if",
"(",
"j",
">=",
"i",
")",
"{",
"j",
"++",
";",
"}",
"// generate swap move",
"return",
"new",
"SingleSwapMove",
"(",
"i",
",",
"j",
")",
";",
"}"
] | Create a random single swap move.
@param solution permutation solution to which the move is to be applied
@param rnd source of randomness used to generate random move
@return random swap move, <code>null</code> if the permutation contains
less than 2 items | [
"Create",
"a",
"random",
"single",
"swap",
"move",
"."
] | train | https://github.com/hdbeukel/james-extensions/blob/37a43aa6ac4d67575cabc7aed25fd96c91d4c7b2/src/main/java/org/jamesframework/ext/permutation/neigh/SingleSwapNeighbourhood.java#L41-L56 |
TNG/JGiven | jgiven-core/src/main/java/com/tngtech/jgiven/attachment/Attachment.java | Attachment.fromTextInputStream | @Deprecated
public static Attachment fromTextInputStream( InputStream inputStream, MediaType mediaType, Charset charset ) throws IOException {
"""
Creates a non-binary attachment from the given file.
@throws IOException if an I/O error occurs
@throws java.lang.IllegalArgumentException if mediaType is binary
@deprecated use fromTextInputStream without charSet with a mediaType that has a specified charSet
"""
return fromText( CharStreams.toString( new InputStreamReader( inputStream, charset ) ), mediaType );
} | java | @Deprecated
public static Attachment fromTextInputStream( InputStream inputStream, MediaType mediaType, Charset charset ) throws IOException {
return fromText( CharStreams.toString( new InputStreamReader( inputStream, charset ) ), mediaType );
} | [
"@",
"Deprecated",
"public",
"static",
"Attachment",
"fromTextInputStream",
"(",
"InputStream",
"inputStream",
",",
"MediaType",
"mediaType",
",",
"Charset",
"charset",
")",
"throws",
"IOException",
"{",
"return",
"fromText",
"(",
"CharStreams",
".",
"toString",
"(",
"new",
"InputStreamReader",
"(",
"inputStream",
",",
"charset",
")",
")",
",",
"mediaType",
")",
";",
"}"
] | Creates a non-binary attachment from the given file.
@throws IOException if an I/O error occurs
@throws java.lang.IllegalArgumentException if mediaType is binary
@deprecated use fromTextInputStream without charSet with a mediaType that has a specified charSet | [
"Creates",
"a",
"non",
"-",
"binary",
"attachment",
"from",
"the",
"given",
"file",
"."
] | train | https://github.com/TNG/JGiven/blob/1a69248fc6d7eb380cdc4542e3be273842889748/jgiven-core/src/main/java/com/tngtech/jgiven/attachment/Attachment.java#L221-L224 |
GerdHolz/TOVAL | src/de/invation/code/toval/types/DynamicMatrix.java | DynamicMatrix.putValue | public void putValue(E row, E col, T value) {
"""
Sets the matrix entry specified by the given row and col keys.<br>
This method sets the following content: Matrix[row,col]=value
@param row Row-value of indexing type
@param col Col-value of indexing type
@param value Value that has to be inserted
"""
ensureRowKey(row);
ensureColKey(col);
get(rowKeys.get(row)).set(colKeys.get(col), value);
} | java | public void putValue(E row, E col, T value) {
ensureRowKey(row);
ensureColKey(col);
get(rowKeys.get(row)).set(colKeys.get(col), value);
} | [
"public",
"void",
"putValue",
"(",
"E",
"row",
",",
"E",
"col",
",",
"T",
"value",
")",
"{",
"ensureRowKey",
"(",
"row",
")",
";",
"ensureColKey",
"(",
"col",
")",
";",
"get",
"(",
"rowKeys",
".",
"get",
"(",
"row",
")",
")",
".",
"set",
"(",
"colKeys",
".",
"get",
"(",
"col",
")",
",",
"value",
")",
";",
"}"
] | Sets the matrix entry specified by the given row and col keys.<br>
This method sets the following content: Matrix[row,col]=value
@param row Row-value of indexing type
@param col Col-value of indexing type
@param value Value that has to be inserted | [
"Sets",
"the",
"matrix",
"entry",
"specified",
"by",
"the",
"given",
"row",
"and",
"col",
"keys",
".",
"<br",
">",
"This",
"method",
"sets",
"the",
"following",
"content",
":",
"Matrix",
"[",
"row",
"col",
"]",
"=",
"value"
] | train | https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/types/DynamicMatrix.java#L51-L55 |
jbundle/webapp | base/src/main/java/org/jbundle/util/webapp/base/HttpServiceActivator.java | HttpServiceActivator.shutdownService | @Override
public boolean shutdownService(Object service, BundleContext context) {
"""
Shutdown this service.
Override this to do all the startup.
@return true if successful.
"""
if (this.service != null)
((HttpServiceTracker)this.service).close();
return true;
} | java | @Override
public boolean shutdownService(Object service, BundleContext context)
{
if (this.service != null)
((HttpServiceTracker)this.service).close();
return true;
} | [
"@",
"Override",
"public",
"boolean",
"shutdownService",
"(",
"Object",
"service",
",",
"BundleContext",
"context",
")",
"{",
"if",
"(",
"this",
".",
"service",
"!=",
"null",
")",
"(",
"(",
"HttpServiceTracker",
")",
"this",
".",
"service",
")",
".",
"close",
"(",
")",
";",
"return",
"true",
";",
"}"
] | Shutdown this service.
Override this to do all the startup.
@return true if successful. | [
"Shutdown",
"this",
"service",
".",
"Override",
"this",
"to",
"do",
"all",
"the",
"startup",
"."
] | train | https://github.com/jbundle/webapp/blob/af2cf32bd92254073052f1f9b4bcd47c2f76ba7d/base/src/main/java/org/jbundle/util/webapp/base/HttpServiceActivator.java#L58-L64 |
jbundle/jbundle | base/screen/model/src/main/java/org/jbundle/base/screen/model/ScreenField.java | ScreenField.printData | public boolean printData(PrintWriter out, int iPrintOptions) {
"""
Display this control's data in print (view) format.
@return true if default params were found for this form.
@param out The http output stream.
@exception DBException File exception.
"""
if (!this.isInputField())
return false;
if (this.isToolbar())
return false;
return this.getScreenFieldView().printData(out, iPrintOptions);
} | java | public boolean printData(PrintWriter out, int iPrintOptions)
{
if (!this.isInputField())
return false;
if (this.isToolbar())
return false;
return this.getScreenFieldView().printData(out, iPrintOptions);
} | [
"public",
"boolean",
"printData",
"(",
"PrintWriter",
"out",
",",
"int",
"iPrintOptions",
")",
"{",
"if",
"(",
"!",
"this",
".",
"isInputField",
"(",
")",
")",
"return",
"false",
";",
"if",
"(",
"this",
".",
"isToolbar",
"(",
")",
")",
"return",
"false",
";",
"return",
"this",
".",
"getScreenFieldView",
"(",
")",
".",
"printData",
"(",
"out",
",",
"iPrintOptions",
")",
";",
"}"
] | Display this control's data in print (view) format.
@return true if default params were found for this form.
@param out The http output stream.
@exception DBException File exception. | [
"Display",
"this",
"control",
"s",
"data",
"in",
"print",
"(",
"view",
")",
"format",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/model/ScreenField.java#L700-L707 |
opsmatters/newrelic-api | src/main/java/com/opsmatters/newrelic/api/services/HttpContext.java | HttpContext.PUT | public <T> Optional<T> PUT(String partialUrl, Object payload, GenericType<T> returnType) {
"""
Execute a PUT call against the partial URL.
@param <T> The type parameter used for the return object
@param partialUrl The partial URL to build
@param payload The object to use for the PUT
@param returnType The expected return type
@return The return type
"""
URI uri = buildUri(partialUrl);
return executePutRequest(uri, payload, null, null, returnType);
} | java | public <T> Optional<T> PUT(String partialUrl, Object payload, GenericType<T> returnType)
{
URI uri = buildUri(partialUrl);
return executePutRequest(uri, payload, null, null, returnType);
} | [
"public",
"<",
"T",
">",
"Optional",
"<",
"T",
">",
"PUT",
"(",
"String",
"partialUrl",
",",
"Object",
"payload",
",",
"GenericType",
"<",
"T",
">",
"returnType",
")",
"{",
"URI",
"uri",
"=",
"buildUri",
"(",
"partialUrl",
")",
";",
"return",
"executePutRequest",
"(",
"uri",
",",
"payload",
",",
"null",
",",
"null",
",",
"returnType",
")",
";",
"}"
] | Execute a PUT call against the partial URL.
@param <T> The type parameter used for the return object
@param partialUrl The partial URL to build
@param payload The object to use for the PUT
@param returnType The expected return type
@return The return type | [
"Execute",
"a",
"PUT",
"call",
"against",
"the",
"partial",
"URL",
"."
] | train | https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/HttpContext.java#L164-L168 |
liferay/com-liferay-commerce | commerce-product-type-virtual-order-service/src/main/java/com/liferay/commerce/product/type/virtual/order/service/persistence/impl/CommerceVirtualOrderItemPersistenceImpl.java | CommerceVirtualOrderItemPersistenceImpl.findAll | @Override
public List<CommerceVirtualOrderItem> findAll() {
"""
Returns all the commerce virtual order items.
@return the commerce virtual order items
"""
return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
} | java | @Override
public List<CommerceVirtualOrderItem> findAll() {
return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CommerceVirtualOrderItem",
">",
"findAll",
"(",
")",
"{",
"return",
"findAll",
"(",
"QueryUtil",
".",
"ALL_POS",
",",
"QueryUtil",
".",
"ALL_POS",
",",
"null",
")",
";",
"}"
] | Returns all the commerce virtual order items.
@return the commerce virtual order items | [
"Returns",
"all",
"the",
"commerce",
"virtual",
"order",
"items",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-type-virtual-order-service/src/main/java/com/liferay/commerce/product/type/virtual/order/service/persistence/impl/CommerceVirtualOrderItemPersistenceImpl.java#L2353-L2356 |
ykrasik/jaci | jaci-utils/src/main/java/com/github/ykrasik/jaci/util/string/StringUtils.java | StringUtils.removeTrailingDelimiter | public static String removeTrailingDelimiter(String str, String delimiter) {
"""
Removes the trailing delimiter from a string.
@param str String to process.
@param delimiter Delimiter to remove.
@return The string with the trailing delimiter removed.
"""
if (!str.endsWith(delimiter)) {
return str;
} else {
return str.substring(0, str.length() - delimiter.length());
}
} | java | public static String removeTrailingDelimiter(String str, String delimiter) {
if (!str.endsWith(delimiter)) {
return str;
} else {
return str.substring(0, str.length() - delimiter.length());
}
} | [
"public",
"static",
"String",
"removeTrailingDelimiter",
"(",
"String",
"str",
",",
"String",
"delimiter",
")",
"{",
"if",
"(",
"!",
"str",
".",
"endsWith",
"(",
"delimiter",
")",
")",
"{",
"return",
"str",
";",
"}",
"else",
"{",
"return",
"str",
".",
"substring",
"(",
"0",
",",
"str",
".",
"length",
"(",
")",
"-",
"delimiter",
".",
"length",
"(",
")",
")",
";",
"}",
"}"
] | Removes the trailing delimiter from a string.
@param str String to process.
@param delimiter Delimiter to remove.
@return The string with the trailing delimiter removed. | [
"Removes",
"the",
"trailing",
"delimiter",
"from",
"a",
"string",
"."
] | train | https://github.com/ykrasik/jaci/blob/4615edef7c76288ad5ea8d678132b161645ca1e3/jaci-utils/src/main/java/com/github/ykrasik/jaci/util/string/StringUtils.java#L60-L66 |
Baidu-AIP/java-sdk | src/main/java/com/baidu/aip/imagesearch/AipImageSearch.java | AipImageSearch.similarDeleteByUrl | public JSONObject similarDeleteByUrl(String url, HashMap<String, String> options) {
"""
相似图检索—删除接口
**删除图库中的图片,支持批量删除,批量删除时请传cont_sign参数,勿传image,最多支持1000个cont_sign**
@param url - 图片完整URL,URL长度不超过1024字节,URL对应的图片base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式,当image字段存在时url字段失效
@param options - 可选参数对象,key: value都为string类型
options - options列表:
@return JSONObject
"""
AipRequest request = new AipRequest();
preOperation(request);
request.addBody("url", url);
if (options != null) {
request.addBody(options);
}
request.setUri(ImageSearchConsts.SIMILAR_DELETE);
postOperation(request);
return requestServer(request);
} | java | public JSONObject similarDeleteByUrl(String url, HashMap<String, String> options) {
AipRequest request = new AipRequest();
preOperation(request);
request.addBody("url", url);
if (options != null) {
request.addBody(options);
}
request.setUri(ImageSearchConsts.SIMILAR_DELETE);
postOperation(request);
return requestServer(request);
} | [
"public",
"JSONObject",
"similarDeleteByUrl",
"(",
"String",
"url",
",",
"HashMap",
"<",
"String",
",",
"String",
">",
"options",
")",
"{",
"AipRequest",
"request",
"=",
"new",
"AipRequest",
"(",
")",
";",
"preOperation",
"(",
"request",
")",
";",
"request",
".",
"addBody",
"(",
"\"url\"",
",",
"url",
")",
";",
"if",
"(",
"options",
"!=",
"null",
")",
"{",
"request",
".",
"addBody",
"(",
"options",
")",
";",
"}",
"request",
".",
"setUri",
"(",
"ImageSearchConsts",
".",
"SIMILAR_DELETE",
")",
";",
"postOperation",
"(",
"request",
")",
";",
"return",
"requestServer",
"(",
"request",
")",
";",
"}"
] | 相似图检索—删除接口
**删除图库中的图片,支持批量删除,批量删除时请传cont_sign参数,勿传image,最多支持1000个cont_sign**
@param url - 图片完整URL,URL长度不超过1024字节,URL对应的图片base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式,当image字段存在时url字段失效
@param options - 可选参数对象,key: value都为string类型
options - options列表:
@return JSONObject | [
"相似图检索—删除接口",
"**",
"删除图库中的图片,支持批量删除,批量删除时请传cont_sign参数,勿传image,最多支持1000个cont_sign",
"**"
] | train | https://github.com/Baidu-AIP/java-sdk/blob/16bb8b7bb8f9bbcb7c8af62d0a67a1e79eecad90/src/main/java/com/baidu/aip/imagesearch/AipImageSearch.java#L649-L660 |
RestComm/media-core | network/src/main/java/org/restcomm/media/core/network/deprecated/UdpManager.java | UdpManager.bindLocal | public void bindLocal(DatagramChannel channel, int port) throws IOException {
"""
Binds socket to global bind address and specified port.
@param channel the channel
@param port the port to bind to
@throws IOException
"""
// select port if wildcarded
if (port == PORT_ANY) {
port = localPortManager.next();
}
// try bind
IOException ex = null;
for (int q = 0; q < 100; q++) {
try {
channel.bind(new InetSocketAddress(localBindAddress, port));
ex = null;
break;
} catch (IOException e) {
ex = e;
logger.info("Failed trying to bind " + localBindAddress + ":" + port);
port = localPortManager.next();
}
}
if (ex != null) {
throw ex;
}
} | java | public void bindLocal(DatagramChannel channel, int port) throws IOException {
// select port if wildcarded
if (port == PORT_ANY) {
port = localPortManager.next();
}
// try bind
IOException ex = null;
for (int q = 0; q < 100; q++) {
try {
channel.bind(new InetSocketAddress(localBindAddress, port));
ex = null;
break;
} catch (IOException e) {
ex = e;
logger.info("Failed trying to bind " + localBindAddress + ":" + port);
port = localPortManager.next();
}
}
if (ex != null) {
throw ex;
}
} | [
"public",
"void",
"bindLocal",
"(",
"DatagramChannel",
"channel",
",",
"int",
"port",
")",
"throws",
"IOException",
"{",
"// select port if wildcarded",
"if",
"(",
"port",
"==",
"PORT_ANY",
")",
"{",
"port",
"=",
"localPortManager",
".",
"next",
"(",
")",
";",
"}",
"// try bind",
"IOException",
"ex",
"=",
"null",
";",
"for",
"(",
"int",
"q",
"=",
"0",
";",
"q",
"<",
"100",
";",
"q",
"++",
")",
"{",
"try",
"{",
"channel",
".",
"bind",
"(",
"new",
"InetSocketAddress",
"(",
"localBindAddress",
",",
"port",
")",
")",
";",
"ex",
"=",
"null",
";",
"break",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"ex",
"=",
"e",
";",
"logger",
".",
"info",
"(",
"\"Failed trying to bind \"",
"+",
"localBindAddress",
"+",
"\":\"",
"+",
"port",
")",
";",
"port",
"=",
"localPortManager",
".",
"next",
"(",
")",
";",
"}",
"}",
"if",
"(",
"ex",
"!=",
"null",
")",
"{",
"throw",
"ex",
";",
"}",
"}"
] | Binds socket to global bind address and specified port.
@param channel the channel
@param port the port to bind to
@throws IOException | [
"Binds",
"socket",
"to",
"global",
"bind",
"address",
"and",
"specified",
"port",
"."
] | train | https://github.com/RestComm/media-core/blob/07b8703343708599f60af66bae62aded77ee81b5/network/src/main/java/org/restcomm/media/core/network/deprecated/UdpManager.java#L390-L413 |
zxing/zxing | core/src/main/java/com/google/zxing/pdf417/detector/Detector.java | Detector.patternMatchVariance | private static float patternMatchVariance(int[] counters, int[] pattern, float maxIndividualVariance) {
"""
Determines how closely a set of observed counts of runs of black/white
values matches a given target pattern. This is reported as the ratio of
the total variance from the expected pattern proportions across all
pattern elements, to the length of the pattern.
@param counters observed counters
@param pattern expected pattern
@param maxIndividualVariance The most any counter can differ before we give up
@return ratio of total variance between counters and pattern compared to total pattern size
"""
int numCounters = counters.length;
int total = 0;
int patternLength = 0;
for (int i = 0; i < numCounters; i++) {
total += counters[i];
patternLength += pattern[i];
}
if (total < patternLength) {
// If we don't even have one pixel per unit of bar width, assume this
// is too small to reliably match, so fail:
return Float.POSITIVE_INFINITY;
}
// We're going to fake floating-point math in integers. We just need to use more bits.
// Scale up patternLength so that intermediate values below like scaledCounter will have
// more "significant digits".
float unitBarWidth = (float) total / patternLength;
maxIndividualVariance *= unitBarWidth;
float totalVariance = 0.0f;
for (int x = 0; x < numCounters; x++) {
int counter = counters[x];
float scaledPattern = pattern[x] * unitBarWidth;
float variance = counter > scaledPattern ? counter - scaledPattern : scaledPattern - counter;
if (variance > maxIndividualVariance) {
return Float.POSITIVE_INFINITY;
}
totalVariance += variance;
}
return totalVariance / total;
} | java | private static float patternMatchVariance(int[] counters, int[] pattern, float maxIndividualVariance) {
int numCounters = counters.length;
int total = 0;
int patternLength = 0;
for (int i = 0; i < numCounters; i++) {
total += counters[i];
patternLength += pattern[i];
}
if (total < patternLength) {
// If we don't even have one pixel per unit of bar width, assume this
// is too small to reliably match, so fail:
return Float.POSITIVE_INFINITY;
}
// We're going to fake floating-point math in integers. We just need to use more bits.
// Scale up patternLength so that intermediate values below like scaledCounter will have
// more "significant digits".
float unitBarWidth = (float) total / patternLength;
maxIndividualVariance *= unitBarWidth;
float totalVariance = 0.0f;
for (int x = 0; x < numCounters; x++) {
int counter = counters[x];
float scaledPattern = pattern[x] * unitBarWidth;
float variance = counter > scaledPattern ? counter - scaledPattern : scaledPattern - counter;
if (variance > maxIndividualVariance) {
return Float.POSITIVE_INFINITY;
}
totalVariance += variance;
}
return totalVariance / total;
} | [
"private",
"static",
"float",
"patternMatchVariance",
"(",
"int",
"[",
"]",
"counters",
",",
"int",
"[",
"]",
"pattern",
",",
"float",
"maxIndividualVariance",
")",
"{",
"int",
"numCounters",
"=",
"counters",
".",
"length",
";",
"int",
"total",
"=",
"0",
";",
"int",
"patternLength",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"numCounters",
";",
"i",
"++",
")",
"{",
"total",
"+=",
"counters",
"[",
"i",
"]",
";",
"patternLength",
"+=",
"pattern",
"[",
"i",
"]",
";",
"}",
"if",
"(",
"total",
"<",
"patternLength",
")",
"{",
"// If we don't even have one pixel per unit of bar width, assume this",
"// is too small to reliably match, so fail:",
"return",
"Float",
".",
"POSITIVE_INFINITY",
";",
"}",
"// We're going to fake floating-point math in integers. We just need to use more bits.",
"// Scale up patternLength so that intermediate values below like scaledCounter will have",
"// more \"significant digits\".",
"float",
"unitBarWidth",
"=",
"(",
"float",
")",
"total",
"/",
"patternLength",
";",
"maxIndividualVariance",
"*=",
"unitBarWidth",
";",
"float",
"totalVariance",
"=",
"0.0f",
";",
"for",
"(",
"int",
"x",
"=",
"0",
";",
"x",
"<",
"numCounters",
";",
"x",
"++",
")",
"{",
"int",
"counter",
"=",
"counters",
"[",
"x",
"]",
";",
"float",
"scaledPattern",
"=",
"pattern",
"[",
"x",
"]",
"*",
"unitBarWidth",
";",
"float",
"variance",
"=",
"counter",
">",
"scaledPattern",
"?",
"counter",
"-",
"scaledPattern",
":",
"scaledPattern",
"-",
"counter",
";",
"if",
"(",
"variance",
">",
"maxIndividualVariance",
")",
"{",
"return",
"Float",
".",
"POSITIVE_INFINITY",
";",
"}",
"totalVariance",
"+=",
"variance",
";",
"}",
"return",
"totalVariance",
"/",
"total",
";",
"}"
] | Determines how closely a set of observed counts of runs of black/white
values matches a given target pattern. This is reported as the ratio of
the total variance from the expected pattern proportions across all
pattern elements, to the length of the pattern.
@param counters observed counters
@param pattern expected pattern
@param maxIndividualVariance The most any counter can differ before we give up
@return ratio of total variance between counters and pattern compared to total pattern size | [
"Determines",
"how",
"closely",
"a",
"set",
"of",
"observed",
"counts",
"of",
"runs",
"of",
"black",
"/",
"white",
"values",
"matches",
"a",
"given",
"target",
"pattern",
".",
"This",
"is",
"reported",
"as",
"the",
"ratio",
"of",
"the",
"total",
"variance",
"from",
"the",
"expected",
"pattern",
"proportions",
"across",
"all",
"pattern",
"elements",
"to",
"the",
"length",
"of",
"the",
"pattern",
"."
] | train | https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/pdf417/detector/Detector.java#L309-L339 |
bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/core/BloomFilter.java | BloomFilter.murmurHash3 | public static int murmurHash3(byte[] data, long nTweak, int hashNum, byte[] object) {
"""
Applies the MurmurHash3 (x86_32) algorithm to the given data.
See this <a href="https://github.com/aappleby/smhasher/blob/master/src/MurmurHash3.cpp">C++ code for the original.</a>
"""
int h1 = (int)(hashNum * 0xFBA4C795L + nTweak);
final int c1 = 0xcc9e2d51;
final int c2 = 0x1b873593;
int numBlocks = (object.length / 4) * 4;
// body
for(int i = 0; i < numBlocks; i += 4) {
int k1 = (object[i] & 0xFF) |
((object[i+1] & 0xFF) << 8) |
((object[i+2] & 0xFF) << 16) |
((object[i+3] & 0xFF) << 24);
k1 *= c1;
k1 = rotateLeft32(k1, 15);
k1 *= c2;
h1 ^= k1;
h1 = rotateLeft32(h1, 13);
h1 = h1*5+0xe6546b64;
}
int k1 = 0;
switch(object.length & 3)
{
case 3:
k1 ^= (object[numBlocks + 2] & 0xff) << 16;
// Fall through.
case 2:
k1 ^= (object[numBlocks + 1] & 0xff) << 8;
// Fall through.
case 1:
k1 ^= (object[numBlocks] & 0xff);
k1 *= c1; k1 = rotateLeft32(k1, 15); k1 *= c2; h1 ^= k1;
// Fall through.
default:
// Do nothing.
break;
}
// finalization
h1 ^= object.length;
h1 ^= h1 >>> 16;
h1 *= 0x85ebca6b;
h1 ^= h1 >>> 13;
h1 *= 0xc2b2ae35;
h1 ^= h1 >>> 16;
return (int)((h1&0xFFFFFFFFL) % (data.length * 8));
} | java | public static int murmurHash3(byte[] data, long nTweak, int hashNum, byte[] object) {
int h1 = (int)(hashNum * 0xFBA4C795L + nTweak);
final int c1 = 0xcc9e2d51;
final int c2 = 0x1b873593;
int numBlocks = (object.length / 4) * 4;
// body
for(int i = 0; i < numBlocks; i += 4) {
int k1 = (object[i] & 0xFF) |
((object[i+1] & 0xFF) << 8) |
((object[i+2] & 0xFF) << 16) |
((object[i+3] & 0xFF) << 24);
k1 *= c1;
k1 = rotateLeft32(k1, 15);
k1 *= c2;
h1 ^= k1;
h1 = rotateLeft32(h1, 13);
h1 = h1*5+0xe6546b64;
}
int k1 = 0;
switch(object.length & 3)
{
case 3:
k1 ^= (object[numBlocks + 2] & 0xff) << 16;
// Fall through.
case 2:
k1 ^= (object[numBlocks + 1] & 0xff) << 8;
// Fall through.
case 1:
k1 ^= (object[numBlocks] & 0xff);
k1 *= c1; k1 = rotateLeft32(k1, 15); k1 *= c2; h1 ^= k1;
// Fall through.
default:
// Do nothing.
break;
}
// finalization
h1 ^= object.length;
h1 ^= h1 >>> 16;
h1 *= 0x85ebca6b;
h1 ^= h1 >>> 13;
h1 *= 0xc2b2ae35;
h1 ^= h1 >>> 16;
return (int)((h1&0xFFFFFFFFL) % (data.length * 8));
} | [
"public",
"static",
"int",
"murmurHash3",
"(",
"byte",
"[",
"]",
"data",
",",
"long",
"nTweak",
",",
"int",
"hashNum",
",",
"byte",
"[",
"]",
"object",
")",
"{",
"int",
"h1",
"=",
"(",
"int",
")",
"(",
"hashNum",
"*",
"0xFBA4C795",
"L",
"+",
"nTweak",
")",
";",
"final",
"int",
"c1",
"=",
"0xcc9e2d51",
";",
"final",
"int",
"c2",
"=",
"0x1b873593",
";",
"int",
"numBlocks",
"=",
"(",
"object",
".",
"length",
"/",
"4",
")",
"*",
"4",
";",
"// body",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"numBlocks",
";",
"i",
"+=",
"4",
")",
"{",
"int",
"k1",
"=",
"(",
"object",
"[",
"i",
"]",
"&",
"0xFF",
")",
"|",
"(",
"(",
"object",
"[",
"i",
"+",
"1",
"]",
"&",
"0xFF",
")",
"<<",
"8",
")",
"|",
"(",
"(",
"object",
"[",
"i",
"+",
"2",
"]",
"&",
"0xFF",
")",
"<<",
"16",
")",
"|",
"(",
"(",
"object",
"[",
"i",
"+",
"3",
"]",
"&",
"0xFF",
")",
"<<",
"24",
")",
";",
"k1",
"*=",
"c1",
";",
"k1",
"=",
"rotateLeft32",
"(",
"k1",
",",
"15",
")",
";",
"k1",
"*=",
"c2",
";",
"h1",
"^=",
"k1",
";",
"h1",
"=",
"rotateLeft32",
"(",
"h1",
",",
"13",
")",
";",
"h1",
"=",
"h1",
"*",
"5",
"+",
"0xe6546b64",
";",
"}",
"int",
"k1",
"=",
"0",
";",
"switch",
"(",
"object",
".",
"length",
"&",
"3",
")",
"{",
"case",
"3",
":",
"k1",
"^=",
"(",
"object",
"[",
"numBlocks",
"+",
"2",
"]",
"&",
"0xff",
")",
"<<",
"16",
";",
"// Fall through.",
"case",
"2",
":",
"k1",
"^=",
"(",
"object",
"[",
"numBlocks",
"+",
"1",
"]",
"&",
"0xff",
")",
"<<",
"8",
";",
"// Fall through.",
"case",
"1",
":",
"k1",
"^=",
"(",
"object",
"[",
"numBlocks",
"]",
"&",
"0xff",
")",
";",
"k1",
"*=",
"c1",
";",
"k1",
"=",
"rotateLeft32",
"(",
"k1",
",",
"15",
")",
";",
"k1",
"*=",
"c2",
";",
"h1",
"^=",
"k1",
";",
"// Fall through.",
"default",
":",
"// Do nothing.",
"break",
";",
"}",
"// finalization",
"h1",
"^=",
"object",
".",
"length",
";",
"h1",
"^=",
"h1",
">>>",
"16",
";",
"h1",
"*=",
"0x85ebca6b",
";",
"h1",
"^=",
"h1",
">>>",
"13",
";",
"h1",
"*=",
"0xc2b2ae35",
";",
"h1",
"^=",
"h1",
">>>",
"16",
";",
"return",
"(",
"int",
")",
"(",
"(",
"h1",
"&",
"0xFFFFFFFF",
"L",
")",
"%",
"(",
"data",
".",
"length",
"*",
"8",
")",
")",
";",
"}"
] | Applies the MurmurHash3 (x86_32) algorithm to the given data.
See this <a href="https://github.com/aappleby/smhasher/blob/master/src/MurmurHash3.cpp">C++ code for the original.</a> | [
"Applies",
"the",
"MurmurHash3",
"(",
"x86_32",
")",
"algorithm",
"to",
"the",
"given",
"data",
".",
"See",
"this",
"<a",
"href",
"=",
"https",
":",
"//",
"github",
".",
"com",
"/",
"aappleby",
"/",
"smhasher",
"/",
"blob",
"/",
"master",
"/",
"src",
"/",
"MurmurHash3",
".",
"cpp",
">",
"C",
"++",
"code",
"for",
"the",
"original",
".",
"<",
"/",
"a",
">"
] | train | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/BloomFilter.java#L175-L224 |
spotify/sparkey-java | src/main/java/com/spotify/sparkey/Sparkey.java | Sparkey.writeHash | public static void writeHash(File file, HashType hashType) throws IOException {
"""
Write (or rewrite) the index file for a given sparkey file.
@param file File base to use, the actual file endings will be set to .spi and .spl
@param hashType choice of hash type, can be 32 or 64 bits.
"""
SparkeyWriter writer = append(file);
writer.writeHash(hashType);
writer.close();
} | java | public static void writeHash(File file, HashType hashType) throws IOException {
SparkeyWriter writer = append(file);
writer.writeHash(hashType);
writer.close();
} | [
"public",
"static",
"void",
"writeHash",
"(",
"File",
"file",
",",
"HashType",
"hashType",
")",
"throws",
"IOException",
"{",
"SparkeyWriter",
"writer",
"=",
"append",
"(",
"file",
")",
";",
"writer",
".",
"writeHash",
"(",
"hashType",
")",
";",
"writer",
".",
"close",
"(",
")",
";",
"}"
] | Write (or rewrite) the index file for a given sparkey file.
@param file File base to use, the actual file endings will be set to .spi and .spl
@param hashType choice of hash type, can be 32 or 64 bits. | [
"Write",
"(",
"or",
"rewrite",
")",
"the",
"index",
"file",
"for",
"a",
"given",
"sparkey",
"file",
"."
] | train | https://github.com/spotify/sparkey-java/blob/77ed13b17b4b28f38d6e335610269fb135c3a1be/src/main/java/com/spotify/sparkey/Sparkey.java#L137-L141 |
PinaeOS/nala | src/main/java/org/pinae/nala/xb/Xml.java | Xml.toObject | @SuppressWarnings("rawtypes")
public static Object toObject(File file, String encoding, Class<Map> cls) throws UnmarshalException, NoSuchPathException {
"""
将XML文件绑定为对象
@param file XML文件
@param encoding XML文件编码, 例如UTF-8, GBK
@param cls 绑定目标类
@return 绑定后的对象
@throws NoSuchPathException 路径异常
@throws UnmarshalException 解组异常
"""
if (file == null || !file.exists()) {
throw new NoSuchPathException("Could not find file");
}
if (file.isDirectory()) {
throw new NoSuchPathException(String.format("%s is Directory", file.getAbsolutePath()));
}
Object object = null;
Unmarshaller bind = new XmlUnmarshaller(new ResourceReader().getFileStream(file, encoding));
bind.setRootClass(cls);
object = bind.unmarshal();
return object;
} | java | @SuppressWarnings("rawtypes")
public static Object toObject(File file, String encoding, Class<Map> cls) throws UnmarshalException, NoSuchPathException {
if (file == null || !file.exists()) {
throw new NoSuchPathException("Could not find file");
}
if (file.isDirectory()) {
throw new NoSuchPathException(String.format("%s is Directory", file.getAbsolutePath()));
}
Object object = null;
Unmarshaller bind = new XmlUnmarshaller(new ResourceReader().getFileStream(file, encoding));
bind.setRootClass(cls);
object = bind.unmarshal();
return object;
} | [
"@",
"SuppressWarnings",
"(",
"\"rawtypes\"",
")",
"public",
"static",
"Object",
"toObject",
"(",
"File",
"file",
",",
"String",
"encoding",
",",
"Class",
"<",
"Map",
">",
"cls",
")",
"throws",
"UnmarshalException",
",",
"NoSuchPathException",
"{",
"if",
"(",
"file",
"==",
"null",
"||",
"!",
"file",
".",
"exists",
"(",
")",
")",
"{",
"throw",
"new",
"NoSuchPathException",
"(",
"\"Could not find file\"",
")",
";",
"}",
"if",
"(",
"file",
".",
"isDirectory",
"(",
")",
")",
"{",
"throw",
"new",
"NoSuchPathException",
"(",
"String",
".",
"format",
"(",
"\"%s is Directory\"",
",",
"file",
".",
"getAbsolutePath",
"(",
")",
")",
")",
";",
"}",
"Object",
"object",
"=",
"null",
";",
"Unmarshaller",
"bind",
"=",
"new",
"XmlUnmarshaller",
"(",
"new",
"ResourceReader",
"(",
")",
".",
"getFileStream",
"(",
"file",
",",
"encoding",
")",
")",
";",
"bind",
".",
"setRootClass",
"(",
"cls",
")",
";",
"object",
"=",
"bind",
".",
"unmarshal",
"(",
")",
";",
"return",
"object",
";",
"}"
] | 将XML文件绑定为对象
@param file XML文件
@param encoding XML文件编码, 例如UTF-8, GBK
@param cls 绑定目标类
@return 绑定后的对象
@throws NoSuchPathException 路径异常
@throws UnmarshalException 解组异常 | [
"将XML文件绑定为对象"
] | train | https://github.com/PinaeOS/nala/blob/2047ade4af197cec938278d300d111ea94af6fbf/src/main/java/org/pinae/nala/xb/Xml.java#L175-L193 |
google/error-prone | core/src/main/java/com/google/errorprone/bugpatterns/ThreadLocalUsage.java | ThreadLocalUsage.wellKnownTypeArgument | private boolean wellKnownTypeArgument(NewClassTree tree, VisitorState state) {
"""
Ignore some common ThreadLocal type arguments that are fine to have per-instance copies of.
"""
Type type = getType(tree);
if (type == null) {
return false;
}
type = state.getTypes().asSuper(type, state.getSymbolFromString("java.lang.ThreadLocal"));
if (type == null) {
return false;
}
if (type.getTypeArguments().isEmpty()) {
return false;
}
Type argType = getOnlyElement(type.getTypeArguments());
if (WELL_KNOWN_TYPES.contains(argType.asElement().getQualifiedName().toString())) {
return true;
}
if (isSubtype(argType, state.getTypeFromString("java.text.DateFormat"), state)) {
return true;
}
return false;
} | java | private boolean wellKnownTypeArgument(NewClassTree tree, VisitorState state) {
Type type = getType(tree);
if (type == null) {
return false;
}
type = state.getTypes().asSuper(type, state.getSymbolFromString("java.lang.ThreadLocal"));
if (type == null) {
return false;
}
if (type.getTypeArguments().isEmpty()) {
return false;
}
Type argType = getOnlyElement(type.getTypeArguments());
if (WELL_KNOWN_TYPES.contains(argType.asElement().getQualifiedName().toString())) {
return true;
}
if (isSubtype(argType, state.getTypeFromString("java.text.DateFormat"), state)) {
return true;
}
return false;
} | [
"private",
"boolean",
"wellKnownTypeArgument",
"(",
"NewClassTree",
"tree",
",",
"VisitorState",
"state",
")",
"{",
"Type",
"type",
"=",
"getType",
"(",
"tree",
")",
";",
"if",
"(",
"type",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"type",
"=",
"state",
".",
"getTypes",
"(",
")",
".",
"asSuper",
"(",
"type",
",",
"state",
".",
"getSymbolFromString",
"(",
"\"java.lang.ThreadLocal\"",
")",
")",
";",
"if",
"(",
"type",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"type",
".",
"getTypeArguments",
"(",
")",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"Type",
"argType",
"=",
"getOnlyElement",
"(",
"type",
".",
"getTypeArguments",
"(",
")",
")",
";",
"if",
"(",
"WELL_KNOWN_TYPES",
".",
"contains",
"(",
"argType",
".",
"asElement",
"(",
")",
".",
"getQualifiedName",
"(",
")",
".",
"toString",
"(",
")",
")",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"isSubtype",
"(",
"argType",
",",
"state",
".",
"getTypeFromString",
"(",
"\"java.text.DateFormat\"",
")",
",",
"state",
")",
")",
"{",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
] | Ignore some common ThreadLocal type arguments that are fine to have per-instance copies of. | [
"Ignore",
"some",
"common",
"ThreadLocal",
"type",
"arguments",
"that",
"are",
"fine",
"to",
"have",
"per",
"-",
"instance",
"copies",
"of",
"."
] | train | https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/core/src/main/java/com/google/errorprone/bugpatterns/ThreadLocalUsage.java#L106-L126 |
groupe-sii/ogham | ogham-core/src/main/java/fr/sii/ogham/core/util/StringUtils.java | StringUtils.leftPad | public static String leftPad(String str, int size, char padChar) {
"""
<p>
Left pad a String with a specified character.
</p>
<p>
Pad to a size of {@code size}.
</p>
<pre>
StringUtils.leftPad(null, *, *) = null
StringUtils.leftPad("", 3, 'z') = "zzz"
StringUtils.leftPad("bat", 3, 'z') = "bat"
StringUtils.leftPad("bat", 5, 'z') = "zzbat"
StringUtils.leftPad("bat", 1, 'z') = "bat"
StringUtils.leftPad("bat", -1, 'z') = "bat"
</pre>
@param str
the String to pad out, may be null
@param size
the size to pad to
@param padChar
the character to pad with
@return left padded String or original String if no padding is necessary,
{@code null} if null String input
@since 2.0
"""
return org.apache.commons.lang3.StringUtils.leftPad(str, size, padChar);
} | java | public static String leftPad(String str, int size, char padChar) {
return org.apache.commons.lang3.StringUtils.leftPad(str, size, padChar);
} | [
"public",
"static",
"String",
"leftPad",
"(",
"String",
"str",
",",
"int",
"size",
",",
"char",
"padChar",
")",
"{",
"return",
"org",
".",
"apache",
".",
"commons",
".",
"lang3",
".",
"StringUtils",
".",
"leftPad",
"(",
"str",
",",
"size",
",",
"padChar",
")",
";",
"}"
] | <p>
Left pad a String with a specified character.
</p>
<p>
Pad to a size of {@code size}.
</p>
<pre>
StringUtils.leftPad(null, *, *) = null
StringUtils.leftPad("", 3, 'z') = "zzz"
StringUtils.leftPad("bat", 3, 'z') = "bat"
StringUtils.leftPad("bat", 5, 'z') = "zzbat"
StringUtils.leftPad("bat", 1, 'z') = "bat"
StringUtils.leftPad("bat", -1, 'z') = "bat"
</pre>
@param str
the String to pad out, may be null
@param size
the size to pad to
@param padChar
the character to pad with
@return left padded String or original String if no padding is necessary,
{@code null} if null String input
@since 2.0 | [
"<p",
">",
"Left",
"pad",
"a",
"String",
"with",
"a",
"specified",
"character",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/groupe-sii/ogham/blob/e273b845604add74b5a25dfd931cb3c166b1008f/ogham-core/src/main/java/fr/sii/ogham/core/util/StringUtils.java#L107-L109 |
treasure-data/td-client-java | src/main/java/com/treasuredata/client/TDHttpClient.java | TDHttpClient.withHeaders | public TDHttpClient withHeaders(Multimap<String, String> headers) {
"""
Get a {@link TDHttpClient} that uses the specified headers for each request. Reuses the same
underlying http client so closing the returned instance will return this instance as well.
@param headers
@return
"""
Multimap<String, String> mergedHeaders = ImmutableMultimap.<String, String>builder()
.putAll(this.headers)
.putAll(headers)
.build();
return new TDHttpClient(config, httpClient, objectMapper, mergedHeaders);
} | java | public TDHttpClient withHeaders(Multimap<String, String> headers)
{
Multimap<String, String> mergedHeaders = ImmutableMultimap.<String, String>builder()
.putAll(this.headers)
.putAll(headers)
.build();
return new TDHttpClient(config, httpClient, objectMapper, mergedHeaders);
} | [
"public",
"TDHttpClient",
"withHeaders",
"(",
"Multimap",
"<",
"String",
",",
"String",
">",
"headers",
")",
"{",
"Multimap",
"<",
"String",
",",
"String",
">",
"mergedHeaders",
"=",
"ImmutableMultimap",
".",
"<",
"String",
",",
"String",
">",
"builder",
"(",
")",
".",
"putAll",
"(",
"this",
".",
"headers",
")",
".",
"putAll",
"(",
"headers",
")",
".",
"build",
"(",
")",
";",
"return",
"new",
"TDHttpClient",
"(",
"config",
",",
"httpClient",
",",
"objectMapper",
",",
"mergedHeaders",
")",
";",
"}"
] | Get a {@link TDHttpClient} that uses the specified headers for each request. Reuses the same
underlying http client so closing the returned instance will return this instance as well.
@param headers
@return | [
"Get",
"a",
"{",
"@link",
"TDHttpClient",
"}",
"that",
"uses",
"the",
"specified",
"headers",
"for",
"each",
"request",
".",
"Reuses",
"the",
"same",
"underlying",
"http",
"client",
"so",
"closing",
"the",
"returned",
"instance",
"will",
"return",
"this",
"instance",
"as",
"well",
"."
] | train | https://github.com/treasure-data/td-client-java/blob/2769cbcf0e787d457344422cfcdde467399bd684/src/main/java/com/treasuredata/client/TDHttpClient.java#L152-L159 |
xdcrafts/flower | flower-tools/src/main/java/com/github/xdcrafts/flower/tools/map/MapDotApi.java | MapDotApi.dotGetOptional | public static <T> Optional<Optional<T>> dotGetOptional(
final Map map, final String pathString, final Class<T> clazz
) {
"""
Get optional value by path.
@param <T> optional value type
@param clazz type of value
@param map subject
@param pathString nodes to walk in map
@return value
"""
return dotGet(map, Optional.class, pathString).map(opt -> (Optional<T>) opt);
} | java | public static <T> Optional<Optional<T>> dotGetOptional(
final Map map, final String pathString, final Class<T> clazz
) {
return dotGet(map, Optional.class, pathString).map(opt -> (Optional<T>) opt);
} | [
"public",
"static",
"<",
"T",
">",
"Optional",
"<",
"Optional",
"<",
"T",
">",
">",
"dotGetOptional",
"(",
"final",
"Map",
"map",
",",
"final",
"String",
"pathString",
",",
"final",
"Class",
"<",
"T",
">",
"clazz",
")",
"{",
"return",
"dotGet",
"(",
"map",
",",
"Optional",
".",
"class",
",",
"pathString",
")",
".",
"map",
"(",
"opt",
"->",
"(",
"Optional",
"<",
"T",
">",
")",
"opt",
")",
";",
"}"
] | Get optional value by path.
@param <T> optional value type
@param clazz type of value
@param map subject
@param pathString 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/map/MapDotApi.java#L240-L244 |
jbundle/jbundle | app/program/screen/src/main/java/org/jbundle/app/program/access/AccessGridScreen.java | AccessGridScreen.doCommand | public boolean doCommand(String strCommand, ScreenField sourceSField, int iCommandOptions) {
"""
Process the command.
<br />Step 1 - Process the command if possible and return true if processed.
<br />Step 2 - If I can't process, pass to all children (with me as the source).
<br />Step 3 - If children didn't process, pass to parent (with me as the source).
<br />Note: Never pass to a parent or child that matches the source (to avoid an endless loop).
@param strCommand The command to process.
@param sourceSField The source screen field (to avoid echos).
@param iCommandOptions If this command creates a new screen, create in a new window?
@return true if success.
"""
if ((strCommand.equalsIgnoreCase(MenuConstants.FORM))
|| (strCommand.equalsIgnoreCase(MenuConstants.FORMLINK)))
{
String strHandle = null;
if (strCommand.equalsIgnoreCase(MenuConstants.FORMLINK))
{
try {
Record record = this.getMainRecord();
if ((record.getEditMode() == DBConstants.EDIT_CURRENT)
|| (record.getEditMode() == DBConstants.EDIT_IN_PROGRESS))
strHandle = record.getHandle(DBConstants.OBJECT_ID_HANDLE).toString();
} catch (DBException ex) {
strHandle = null; // Ignore error - just go to form
}
}
strCommand = Utility.addURLParam(null, DBParams.SCREEN, AccessScreen.class.getName()); // Screen class
strCommand = Utility.addURLParam(strCommand, DBParams.RECORD, this.getProperty(DBParams.RECORD));
strCommand = Utility.addURLParam(strCommand, "package", this.getProperty("package"));
if (strHandle != null)
strCommand = Utility.addURLParam(strCommand, DBConstants.STRING_OBJECT_ID_HANDLE, strHandle);
}
return super.doCommand(strCommand, sourceSField, iCommandOptions); // This will send the command to my parent
} | java | public boolean doCommand(String strCommand, ScreenField sourceSField, int iCommandOptions)
{
if ((strCommand.equalsIgnoreCase(MenuConstants.FORM))
|| (strCommand.equalsIgnoreCase(MenuConstants.FORMLINK)))
{
String strHandle = null;
if (strCommand.equalsIgnoreCase(MenuConstants.FORMLINK))
{
try {
Record record = this.getMainRecord();
if ((record.getEditMode() == DBConstants.EDIT_CURRENT)
|| (record.getEditMode() == DBConstants.EDIT_IN_PROGRESS))
strHandle = record.getHandle(DBConstants.OBJECT_ID_HANDLE).toString();
} catch (DBException ex) {
strHandle = null; // Ignore error - just go to form
}
}
strCommand = Utility.addURLParam(null, DBParams.SCREEN, AccessScreen.class.getName()); // Screen class
strCommand = Utility.addURLParam(strCommand, DBParams.RECORD, this.getProperty(DBParams.RECORD));
strCommand = Utility.addURLParam(strCommand, "package", this.getProperty("package"));
if (strHandle != null)
strCommand = Utility.addURLParam(strCommand, DBConstants.STRING_OBJECT_ID_HANDLE, strHandle);
}
return super.doCommand(strCommand, sourceSField, iCommandOptions); // This will send the command to my parent
} | [
"public",
"boolean",
"doCommand",
"(",
"String",
"strCommand",
",",
"ScreenField",
"sourceSField",
",",
"int",
"iCommandOptions",
")",
"{",
"if",
"(",
"(",
"strCommand",
".",
"equalsIgnoreCase",
"(",
"MenuConstants",
".",
"FORM",
")",
")",
"||",
"(",
"strCommand",
".",
"equalsIgnoreCase",
"(",
"MenuConstants",
".",
"FORMLINK",
")",
")",
")",
"{",
"String",
"strHandle",
"=",
"null",
";",
"if",
"(",
"strCommand",
".",
"equalsIgnoreCase",
"(",
"MenuConstants",
".",
"FORMLINK",
")",
")",
"{",
"try",
"{",
"Record",
"record",
"=",
"this",
".",
"getMainRecord",
"(",
")",
";",
"if",
"(",
"(",
"record",
".",
"getEditMode",
"(",
")",
"==",
"DBConstants",
".",
"EDIT_CURRENT",
")",
"||",
"(",
"record",
".",
"getEditMode",
"(",
")",
"==",
"DBConstants",
".",
"EDIT_IN_PROGRESS",
")",
")",
"strHandle",
"=",
"record",
".",
"getHandle",
"(",
"DBConstants",
".",
"OBJECT_ID_HANDLE",
")",
".",
"toString",
"(",
")",
";",
"}",
"catch",
"(",
"DBException",
"ex",
")",
"{",
"strHandle",
"=",
"null",
";",
"// Ignore error - just go to form",
"}",
"}",
"strCommand",
"=",
"Utility",
".",
"addURLParam",
"(",
"null",
",",
"DBParams",
".",
"SCREEN",
",",
"AccessScreen",
".",
"class",
".",
"getName",
"(",
")",
")",
";",
"// Screen class",
"strCommand",
"=",
"Utility",
".",
"addURLParam",
"(",
"strCommand",
",",
"DBParams",
".",
"RECORD",
",",
"this",
".",
"getProperty",
"(",
"DBParams",
".",
"RECORD",
")",
")",
";",
"strCommand",
"=",
"Utility",
".",
"addURLParam",
"(",
"strCommand",
",",
"\"package\"",
",",
"this",
".",
"getProperty",
"(",
"\"package\"",
")",
")",
";",
"if",
"(",
"strHandle",
"!=",
"null",
")",
"strCommand",
"=",
"Utility",
".",
"addURLParam",
"(",
"strCommand",
",",
"DBConstants",
".",
"STRING_OBJECT_ID_HANDLE",
",",
"strHandle",
")",
";",
"}",
"return",
"super",
".",
"doCommand",
"(",
"strCommand",
",",
"sourceSField",
",",
"iCommandOptions",
")",
";",
"// This will send the command to my parent",
"}"
] | Process the command.
<br />Step 1 - Process the command if possible and return true if processed.
<br />Step 2 - If I can't process, pass to all children (with me as the source).
<br />Step 3 - If children didn't process, pass to parent (with me as the source).
<br />Note: Never pass to a parent or child that matches the source (to avoid an endless loop).
@param strCommand The command to process.
@param sourceSField The source screen field (to avoid echos).
@param iCommandOptions If this command creates a new screen, create in a new window?
@return true if success. | [
"Process",
"the",
"command",
".",
"<br",
"/",
">",
"Step",
"1",
"-",
"Process",
"the",
"command",
"if",
"possible",
"and",
"return",
"true",
"if",
"processed",
".",
"<br",
"/",
">",
"Step",
"2",
"-",
"If",
"I",
"can",
"t",
"process",
"pass",
"to",
"all",
"children",
"(",
"with",
"me",
"as",
"the",
"source",
")",
".",
"<br",
"/",
">",
"Step",
"3",
"-",
"If",
"children",
"didn",
"t",
"process",
"pass",
"to",
"parent",
"(",
"with",
"me",
"as",
"the",
"source",
")",
".",
"<br",
"/",
">",
"Note",
":",
"Never",
"pass",
"to",
"a",
"parent",
"or",
"child",
"that",
"matches",
"the",
"source",
"(",
"to",
"avoid",
"an",
"endless",
"loop",
")",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/screen/src/main/java/org/jbundle/app/program/access/AccessGridScreen.java#L111-L135 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/util/HashUtil.java | HashUtil.MurmurHash3_x64_64_direct | public static long MurmurHash3_x64_64_direct(MemoryAccessor mem, long base, int offset, int len) {
"""
Returns the {@code MurmurHash3_x64_64} hash of a memory block accessed by the provided {@link MemoryAccessor}.
The {@code MemoryAccessor} will be used to access {@code long}-sized data at addresses {@code (base + offset)},
{@code (base + offset + 8)}, etc. The caller must ensure that the {@code MemoryAccessor} supports it, especially
when {@code (base + offset)} is not guaranteed to be 8 byte-aligned.
"""
return MurmurHash3_x64_64(mem.isBigEndian() ? NARROW_DIRECT_LOADER : WIDE_DIRECT_LOADER,
mem, base + offset, len, DEFAULT_MURMUR_SEED);
} | java | public static long MurmurHash3_x64_64_direct(MemoryAccessor mem, long base, int offset, int len) {
return MurmurHash3_x64_64(mem.isBigEndian() ? NARROW_DIRECT_LOADER : WIDE_DIRECT_LOADER,
mem, base + offset, len, DEFAULT_MURMUR_SEED);
} | [
"public",
"static",
"long",
"MurmurHash3_x64_64_direct",
"(",
"MemoryAccessor",
"mem",
",",
"long",
"base",
",",
"int",
"offset",
",",
"int",
"len",
")",
"{",
"return",
"MurmurHash3_x64_64",
"(",
"mem",
".",
"isBigEndian",
"(",
")",
"?",
"NARROW_DIRECT_LOADER",
":",
"WIDE_DIRECT_LOADER",
",",
"mem",
",",
"base",
"+",
"offset",
",",
"len",
",",
"DEFAULT_MURMUR_SEED",
")",
";",
"}"
] | Returns the {@code MurmurHash3_x64_64} hash of a memory block accessed by the provided {@link MemoryAccessor}.
The {@code MemoryAccessor} will be used to access {@code long}-sized data at addresses {@code (base + offset)},
{@code (base + offset + 8)}, etc. The caller must ensure that the {@code MemoryAccessor} supports it, especially
when {@code (base + offset)} is not guaranteed to be 8 byte-aligned. | [
"Returns",
"the",
"{"
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/util/HashUtil.java#L153-L156 |
alkacon/opencms-core | src/org/opencms/workplace/editors/CmsPreEditorAction.java | CmsPreEditorAction.sendForwardToEditor | public static void sendForwardToEditor(CmsDialog dialog, Map<String, String[]> additionalParams) {
"""
Forwards to the editor and opens it after the action was performed.<p>
@param dialog the dialog instance forwarding to the editor
@param additionalParams eventual additional request parameters for the editor to use
"""
// create the Map of original request parameters
Map<String, String[]> params = CmsRequestUtil.createParameterMap(dialog.getParamOriginalParams());
// put the parameter indicating that the pre editor action was executed
params.put(PARAM_PREACTIONDONE, new String[] {CmsStringUtil.TRUE});
if (additionalParams != null) {
// put the additional parameters to the Map
params.putAll(additionalParams);
}
try {
// now forward to the editor frameset
dialog.sendForward(CmsWorkplace.VFS_PATH_EDITORS + "editor.jsp", params);
} catch (Exception e) {
// error forwarding, log the exception as error
if (LOG.isErrorEnabled()) {
LOG.error(e.getLocalizedMessage(), e);
}
}
} | java | public static void sendForwardToEditor(CmsDialog dialog, Map<String, String[]> additionalParams) {
// create the Map of original request parameters
Map<String, String[]> params = CmsRequestUtil.createParameterMap(dialog.getParamOriginalParams());
// put the parameter indicating that the pre editor action was executed
params.put(PARAM_PREACTIONDONE, new String[] {CmsStringUtil.TRUE});
if (additionalParams != null) {
// put the additional parameters to the Map
params.putAll(additionalParams);
}
try {
// now forward to the editor frameset
dialog.sendForward(CmsWorkplace.VFS_PATH_EDITORS + "editor.jsp", params);
} catch (Exception e) {
// error forwarding, log the exception as error
if (LOG.isErrorEnabled()) {
LOG.error(e.getLocalizedMessage(), e);
}
}
} | [
"public",
"static",
"void",
"sendForwardToEditor",
"(",
"CmsDialog",
"dialog",
",",
"Map",
"<",
"String",
",",
"String",
"[",
"]",
">",
"additionalParams",
")",
"{",
"// create the Map of original request parameters",
"Map",
"<",
"String",
",",
"String",
"[",
"]",
">",
"params",
"=",
"CmsRequestUtil",
".",
"createParameterMap",
"(",
"dialog",
".",
"getParamOriginalParams",
"(",
")",
")",
";",
"// put the parameter indicating that the pre editor action was executed",
"params",
".",
"put",
"(",
"PARAM_PREACTIONDONE",
",",
"new",
"String",
"[",
"]",
"{",
"CmsStringUtil",
".",
"TRUE",
"}",
")",
";",
"if",
"(",
"additionalParams",
"!=",
"null",
")",
"{",
"// put the additional parameters to the Map",
"params",
".",
"putAll",
"(",
"additionalParams",
")",
";",
"}",
"try",
"{",
"// now forward to the editor frameset",
"dialog",
".",
"sendForward",
"(",
"CmsWorkplace",
".",
"VFS_PATH_EDITORS",
"+",
"\"editor.jsp\"",
",",
"params",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"// error forwarding, log the exception as error",
"if",
"(",
"LOG",
".",
"isErrorEnabled",
"(",
")",
")",
"{",
"LOG",
".",
"error",
"(",
"e",
".",
"getLocalizedMessage",
"(",
")",
",",
"e",
")",
";",
"}",
"}",
"}"
] | Forwards to the editor and opens it after the action was performed.<p>
@param dialog the dialog instance forwarding to the editor
@param additionalParams eventual additional request parameters for the editor to use | [
"Forwards",
"to",
"the",
"editor",
"and",
"opens",
"it",
"after",
"the",
"action",
"was",
"performed",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/editors/CmsPreEditorAction.java#L119-L138 |
UrielCh/ovh-java-sdk | ovh-java-sdk-hostingweb/src/main/java/net/minidev/ovh/api/ApiOvhHostingweb.java | ApiOvhHostingweb.serviceName_attachedDomain_POST | public OvhTask serviceName_attachedDomain_POST(String serviceName, OvhCdnEnum cdn, String domain, OvhFirewallEnum firewall, String ownLog, String path, Long runtimeId, Boolean ssl) throws IOException {
"""
Link a domain to this hosting
REST: POST /hosting/web/{serviceName}/attachedDomain
@param cdn [required] Is linked to the hosting cdn
@param runtimeId [required] The runtime configuration ID linked to this attached domain
@param ownLog [required] Put domain for separate the logs on logs.ovh.net
@param ssl [required] Put domain in ssl certificate
@param domain [required] Domain to link
@param path [required] Domain's path, relative to your home directory
@param firewall [required] Firewall state for this path
@param serviceName [required] The internal name of your hosting
"""
String qPath = "/hosting/web/{serviceName}/attachedDomain";
StringBuilder sb = path(qPath, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "cdn", cdn);
addBody(o, "domain", domain);
addBody(o, "firewall", firewall);
addBody(o, "ownLog", ownLog);
addBody(o, "path", path);
addBody(o, "runtimeId", runtimeId);
addBody(o, "ssl", ssl);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhTask.class);
} | java | public OvhTask serviceName_attachedDomain_POST(String serviceName, OvhCdnEnum cdn, String domain, OvhFirewallEnum firewall, String ownLog, String path, Long runtimeId, Boolean ssl) throws IOException {
String qPath = "/hosting/web/{serviceName}/attachedDomain";
StringBuilder sb = path(qPath, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "cdn", cdn);
addBody(o, "domain", domain);
addBody(o, "firewall", firewall);
addBody(o, "ownLog", ownLog);
addBody(o, "path", path);
addBody(o, "runtimeId", runtimeId);
addBody(o, "ssl", ssl);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhTask.class);
} | [
"public",
"OvhTask",
"serviceName_attachedDomain_POST",
"(",
"String",
"serviceName",
",",
"OvhCdnEnum",
"cdn",
",",
"String",
"domain",
",",
"OvhFirewallEnum",
"firewall",
",",
"String",
"ownLog",
",",
"String",
"path",
",",
"Long",
"runtimeId",
",",
"Boolean",
"ssl",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/hosting/web/{serviceName}/attachedDomain\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"serviceName",
")",
";",
"HashMap",
"<",
"String",
",",
"Object",
">",
"o",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"addBody",
"(",
"o",
",",
"\"cdn\"",
",",
"cdn",
")",
";",
"addBody",
"(",
"o",
",",
"\"domain\"",
",",
"domain",
")",
";",
"addBody",
"(",
"o",
",",
"\"firewall\"",
",",
"firewall",
")",
";",
"addBody",
"(",
"o",
",",
"\"ownLog\"",
",",
"ownLog",
")",
";",
"addBody",
"(",
"o",
",",
"\"path\"",
",",
"path",
")",
";",
"addBody",
"(",
"o",
",",
"\"runtimeId\"",
",",
"runtimeId",
")",
";",
"addBody",
"(",
"o",
",",
"\"ssl\"",
",",
"ssl",
")",
";",
"String",
"resp",
"=",
"exec",
"(",
"qPath",
",",
"\"POST\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"o",
")",
";",
"return",
"convertTo",
"(",
"resp",
",",
"OvhTask",
".",
"class",
")",
";",
"}"
] | Link a domain to this hosting
REST: POST /hosting/web/{serviceName}/attachedDomain
@param cdn [required] Is linked to the hosting cdn
@param runtimeId [required] The runtime configuration ID linked to this attached domain
@param ownLog [required] Put domain for separate the logs on logs.ovh.net
@param ssl [required] Put domain in ssl certificate
@param domain [required] Domain to link
@param path [required] Domain's path, relative to your home directory
@param firewall [required] Firewall state for this path
@param serviceName [required] The internal name of your hosting | [
"Link",
"a",
"domain",
"to",
"this",
"hosting"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-hostingweb/src/main/java/net/minidev/ovh/api/ApiOvhHostingweb.java#L2027-L2040 |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/Assert.java | Assert.areNotEqual | @NullSafe
private static boolean areNotEqual(Object obj1, Object obj2) {
"""
Evaluate the given {@link Object objects} or equality.
@param obj1 {@link Object} to evaluate for equality with {@link Object object 1}.
@param obj2 {@link Object} to evaluate for equality with {@link Object object 2}.
@return a boolean value indicating whether the given {@link Object objects} are equal.
@see java.lang.Object#equals(Object)
"""
return obj1 == null || !obj1.equals(obj2);
} | java | @NullSafe
private static boolean areNotEqual(Object obj1, Object obj2) {
return obj1 == null || !obj1.equals(obj2);
} | [
"@",
"NullSafe",
"private",
"static",
"boolean",
"areNotEqual",
"(",
"Object",
"obj1",
",",
"Object",
"obj2",
")",
"{",
"return",
"obj1",
"==",
"null",
"||",
"!",
"obj1",
".",
"equals",
"(",
"obj2",
")",
";",
"}"
] | Evaluate the given {@link Object objects} or equality.
@param obj1 {@link Object} to evaluate for equality with {@link Object object 1}.
@param obj2 {@link Object} to evaluate for equality with {@link Object object 2}.
@return a boolean value indicating whether the given {@link Object objects} are equal.
@see java.lang.Object#equals(Object) | [
"Evaluate",
"the",
"given",
"{",
"@link",
"Object",
"objects",
"}",
"or",
"equality",
"."
] | train | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/Assert.java#L330-L333 |
frostwire/frostwire-jlibtorrent | src/main/java/com/frostwire/jlibtorrent/FileStorage.java | FileStorage.filePath | public String filePath(int index, String savePath) {
"""
returns the full path to a file.
@param index
@param savePath
@return
"""
// not calling the corresponding swig function because internally,
// the use of the function GetStringUTFChars does not consider the case of
// a copy not made
return savePath + File.separator + fs.file_path(index);
} | java | public String filePath(int index, String savePath) {
// not calling the corresponding swig function because internally,
// the use of the function GetStringUTFChars does not consider the case of
// a copy not made
return savePath + File.separator + fs.file_path(index);
} | [
"public",
"String",
"filePath",
"(",
"int",
"index",
",",
"String",
"savePath",
")",
"{",
"// not calling the corresponding swig function because internally,",
"// the use of the function GetStringUTFChars does not consider the case of",
"// a copy not made",
"return",
"savePath",
"+",
"File",
".",
"separator",
"+",
"fs",
".",
"file_path",
"(",
"index",
")",
";",
"}"
] | returns the full path to a file.
@param index
@param savePath
@return | [
"returns",
"the",
"full",
"path",
"to",
"a",
"file",
"."
] | train | https://github.com/frostwire/frostwire-jlibtorrent/blob/a29249a940d34aba8c4677d238b472ef01833506/src/main/java/com/frostwire/jlibtorrent/FileStorage.java#L322-L327 |
riversun/finbin | src/main/java/org/riversun/finbin/BigBinarySearcher.java | BigBinarySearcher.searchBigBytes | public List<Integer> searchBigBytes(byte[] srcBytes, byte[] searchBytes) {
"""
Search bytes faster in a concurrent processing.
@param srcBytes
@param searchBytes
@return
"""
int numOfThreadsOptimized = (srcBytes.length / analyzeByteArrayUnitSize);
if (numOfThreadsOptimized == 0) {
numOfThreadsOptimized = 1;
}
return searchBigBytes(srcBytes, searchBytes, numOfThreadsOptimized);
} | java | public List<Integer> searchBigBytes(byte[] srcBytes, byte[] searchBytes) {
int numOfThreadsOptimized = (srcBytes.length / analyzeByteArrayUnitSize);
if (numOfThreadsOptimized == 0) {
numOfThreadsOptimized = 1;
}
return searchBigBytes(srcBytes, searchBytes, numOfThreadsOptimized);
} | [
"public",
"List",
"<",
"Integer",
">",
"searchBigBytes",
"(",
"byte",
"[",
"]",
"srcBytes",
",",
"byte",
"[",
"]",
"searchBytes",
")",
"{",
"int",
"numOfThreadsOptimized",
"=",
"(",
"srcBytes",
".",
"length",
"/",
"analyzeByteArrayUnitSize",
")",
";",
"if",
"(",
"numOfThreadsOptimized",
"==",
"0",
")",
"{",
"numOfThreadsOptimized",
"=",
"1",
";",
"}",
"return",
"searchBigBytes",
"(",
"srcBytes",
",",
"searchBytes",
",",
"numOfThreadsOptimized",
")",
";",
"}"
] | Search bytes faster in a concurrent processing.
@param srcBytes
@param searchBytes
@return | [
"Search",
"bytes",
"faster",
"in",
"a",
"concurrent",
"processing",
"."
] | train | https://github.com/riversun/finbin/blob/d1db86a0d2966dcf47087340bbd0727a9d508b3e/src/main/java/org/riversun/finbin/BigBinarySearcher.java#L87-L96 |
stagemonitor/stagemonitor | stagemonitor-configuration/src/main/java/org/stagemonitor/configuration/ConfigurationRegistry.java | ConfigurationRegistry.save | public void save(String key, String value, String configurationSourceName) throws IOException {
"""
Dynamically updates a configuration key.
<p>
Does not perform a password check.
@param key the configuration key
@param value the configuration value
@param configurationSourceName the {@link ConfigurationSource#getName()}
of the configuration source the value should be stored to
@throws IOException if there was an error saving the key to the source
@throws IllegalArgumentException if there was a error processing the configuration key or value or the
configurationSourceName did not match any of the available configuration
sources
@throws UnsupportedOperationException if saving values is not possible with this configuration source
"""
final ConfigurationOption<?> configurationOption = validateConfigurationOption(key, value);
saveToConfigurationSource(key, value, configurationSourceName, configurationOption);
} | java | public void save(String key, String value, String configurationSourceName) throws IOException {
final ConfigurationOption<?> configurationOption = validateConfigurationOption(key, value);
saveToConfigurationSource(key, value, configurationSourceName, configurationOption);
} | [
"public",
"void",
"save",
"(",
"String",
"key",
",",
"String",
"value",
",",
"String",
"configurationSourceName",
")",
"throws",
"IOException",
"{",
"final",
"ConfigurationOption",
"<",
"?",
">",
"configurationOption",
"=",
"validateConfigurationOption",
"(",
"key",
",",
"value",
")",
";",
"saveToConfigurationSource",
"(",
"key",
",",
"value",
",",
"configurationSourceName",
",",
"configurationOption",
")",
";",
"}"
] | Dynamically updates a configuration key.
<p>
Does not perform a password check.
@param key the configuration key
@param value the configuration value
@param configurationSourceName the {@link ConfigurationSource#getName()}
of the configuration source the value should be stored to
@throws IOException if there was an error saving the key to the source
@throws IllegalArgumentException if there was a error processing the configuration key or value or the
configurationSourceName did not match any of the available configuration
sources
@throws UnsupportedOperationException if saving values is not possible with this configuration source | [
"Dynamically",
"updates",
"a",
"configuration",
"key",
".",
"<p",
">",
"Does",
"not",
"perform",
"a",
"password",
"check",
"."
] | train | https://github.com/stagemonitor/stagemonitor/blob/7a1bf6848906f816aa465983f602ea1f1e8f2b7b/stagemonitor-configuration/src/main/java/org/stagemonitor/configuration/ConfigurationRegistry.java#L384-L387 |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/SerializedFormBuilder.java | SerializedFormBuilder.buildPackageSerializedForm | public void buildPackageSerializedForm(XMLNode node, Content serializedSummariesTree) {
"""
Build the package serialized form for the current package being processed.
@param node the XML element that specifies which components to document
@param serializedSummariesTree content tree to which the documentation will be added
"""
Content packageSerializedTree = writer.getPackageSerializedHeader();
String foo = currentPackage.name();
ClassDoc[] classes = currentPackage.allClasses(false);
if (classes == null || classes.length == 0) {
return;
}
if (!serialInclude(currentPackage)) {
return;
}
if (!serialClassFoundToDocument(classes)) {
return;
}
buildChildren(node, packageSerializedTree);
serializedSummariesTree.addContent(packageSerializedTree);
} | java | public void buildPackageSerializedForm(XMLNode node, Content serializedSummariesTree) {
Content packageSerializedTree = writer.getPackageSerializedHeader();
String foo = currentPackage.name();
ClassDoc[] classes = currentPackage.allClasses(false);
if (classes == null || classes.length == 0) {
return;
}
if (!serialInclude(currentPackage)) {
return;
}
if (!serialClassFoundToDocument(classes)) {
return;
}
buildChildren(node, packageSerializedTree);
serializedSummariesTree.addContent(packageSerializedTree);
} | [
"public",
"void",
"buildPackageSerializedForm",
"(",
"XMLNode",
"node",
",",
"Content",
"serializedSummariesTree",
")",
"{",
"Content",
"packageSerializedTree",
"=",
"writer",
".",
"getPackageSerializedHeader",
"(",
")",
";",
"String",
"foo",
"=",
"currentPackage",
".",
"name",
"(",
")",
";",
"ClassDoc",
"[",
"]",
"classes",
"=",
"currentPackage",
".",
"allClasses",
"(",
"false",
")",
";",
"if",
"(",
"classes",
"==",
"null",
"||",
"classes",
".",
"length",
"==",
"0",
")",
"{",
"return",
";",
"}",
"if",
"(",
"!",
"serialInclude",
"(",
"currentPackage",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"!",
"serialClassFoundToDocument",
"(",
"classes",
")",
")",
"{",
"return",
";",
"}",
"buildChildren",
"(",
"node",
",",
"packageSerializedTree",
")",
";",
"serializedSummariesTree",
".",
"addContent",
"(",
"packageSerializedTree",
")",
";",
"}"
] | Build the package serialized form for the current package being processed.
@param node the XML element that specifies which components to document
@param serializedSummariesTree content tree to which the documentation will be added | [
"Build",
"the",
"package",
"serialized",
"form",
"for",
"the",
"current",
"package",
"being",
"processed",
"."
] | train | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/SerializedFormBuilder.java#L180-L195 |
mebigfatguy/fb-contrib | src/main/java/com/mebigfatguy/fbcontrib/detect/SluggishGui.java | SluggishGui.sawOpcode | @Override
public void sawOpcode(int seen) {
"""
overrides the visitor to look for the execution of expensive calls
@param seen
the currently parsed opcode
"""
if ((seen == Const.INVOKEINTERFACE) || (seen == Const.INVOKEVIRTUAL) || (seen == Const.INVOKESPECIAL) || (seen == Const.INVOKESTATIC)) {
String clsName = getClassConstantOperand();
String mName = getNameConstantOperand();
String methodInfo = clsName + ':' + mName;
String thisMethodInfo = (clsName.equals(getClassName())) ? (mName + ':' + methodSig) : "0";
if (expensiveCalls.contains(methodInfo) || expensiveThisCalls.contains(thisMethodInfo)) {
if (isListenerMethod) {
bugReporter.reportBug(new BugInstance(this, BugType.SG_SLUGGISH_GUI.name(), NORMAL_PRIORITY).addClass(this)
.addMethod(this.getClassContext().getJavaClass(), listenerCode.get(this.getCode())));
} else {
expensiveThisCalls.add(getMethodName() + ':' + getMethodSig());
}
throw new StopOpcodeParsingException();
}
}
} | java | @Override
public void sawOpcode(int seen) {
if ((seen == Const.INVOKEINTERFACE) || (seen == Const.INVOKEVIRTUAL) || (seen == Const.INVOKESPECIAL) || (seen == Const.INVOKESTATIC)) {
String clsName = getClassConstantOperand();
String mName = getNameConstantOperand();
String methodInfo = clsName + ':' + mName;
String thisMethodInfo = (clsName.equals(getClassName())) ? (mName + ':' + methodSig) : "0";
if (expensiveCalls.contains(methodInfo) || expensiveThisCalls.contains(thisMethodInfo)) {
if (isListenerMethod) {
bugReporter.reportBug(new BugInstance(this, BugType.SG_SLUGGISH_GUI.name(), NORMAL_PRIORITY).addClass(this)
.addMethod(this.getClassContext().getJavaClass(), listenerCode.get(this.getCode())));
} else {
expensiveThisCalls.add(getMethodName() + ':' + getMethodSig());
}
throw new StopOpcodeParsingException();
}
}
} | [
"@",
"Override",
"public",
"void",
"sawOpcode",
"(",
"int",
"seen",
")",
"{",
"if",
"(",
"(",
"seen",
"==",
"Const",
".",
"INVOKEINTERFACE",
")",
"||",
"(",
"seen",
"==",
"Const",
".",
"INVOKEVIRTUAL",
")",
"||",
"(",
"seen",
"==",
"Const",
".",
"INVOKESPECIAL",
")",
"||",
"(",
"seen",
"==",
"Const",
".",
"INVOKESTATIC",
")",
")",
"{",
"String",
"clsName",
"=",
"getClassConstantOperand",
"(",
")",
";",
"String",
"mName",
"=",
"getNameConstantOperand",
"(",
")",
";",
"String",
"methodInfo",
"=",
"clsName",
"+",
"'",
"'",
"+",
"mName",
";",
"String",
"thisMethodInfo",
"=",
"(",
"clsName",
".",
"equals",
"(",
"getClassName",
"(",
")",
")",
")",
"?",
"(",
"mName",
"+",
"'",
"'",
"+",
"methodSig",
")",
":",
"\"0\"",
";",
"if",
"(",
"expensiveCalls",
".",
"contains",
"(",
"methodInfo",
")",
"||",
"expensiveThisCalls",
".",
"contains",
"(",
"thisMethodInfo",
")",
")",
"{",
"if",
"(",
"isListenerMethod",
")",
"{",
"bugReporter",
".",
"reportBug",
"(",
"new",
"BugInstance",
"(",
"this",
",",
"BugType",
".",
"SG_SLUGGISH_GUI",
".",
"name",
"(",
")",
",",
"NORMAL_PRIORITY",
")",
".",
"addClass",
"(",
"this",
")",
".",
"addMethod",
"(",
"this",
".",
"getClassContext",
"(",
")",
".",
"getJavaClass",
"(",
")",
",",
"listenerCode",
".",
"get",
"(",
"this",
".",
"getCode",
"(",
")",
")",
")",
")",
";",
"}",
"else",
"{",
"expensiveThisCalls",
".",
"add",
"(",
"getMethodName",
"(",
")",
"+",
"'",
"'",
"+",
"getMethodSig",
"(",
")",
")",
";",
"}",
"throw",
"new",
"StopOpcodeParsingException",
"(",
")",
";",
"}",
"}",
"}"
] | overrides the visitor to look for the execution of expensive calls
@param seen
the currently parsed opcode | [
"overrides",
"the",
"visitor",
"to",
"look",
"for",
"the",
"execution",
"of",
"expensive",
"calls"
] | train | https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/SluggishGui.java#L170-L189 |
seedstack/business | migrate/src/main/java/org/seedstack/business/view/VirtualList.java | VirtualList.assertSubRange | private void assertSubRange(long from, long to) {
"""
Asserts that the requested sub list is available in the virtual list. Otherwise it throws
an IndexOutOfBoundsException.
@param from the from index (inclusive)
@param to the to index (inclusive)
"""
if (!checkSubRange(from) || !checkSubRange(to)) {
throw new IndexOutOfBoundsException("Required data for the sub list [" + from + "," + (to + 1) + "[ have "
+ "not been loaded in the virtual list.");
}
} | java | private void assertSubRange(long from, long to) {
if (!checkSubRange(from) || !checkSubRange(to)) {
throw new IndexOutOfBoundsException("Required data for the sub list [" + from + "," + (to + 1) + "[ have "
+ "not been loaded in the virtual list.");
}
} | [
"private",
"void",
"assertSubRange",
"(",
"long",
"from",
",",
"long",
"to",
")",
"{",
"if",
"(",
"!",
"checkSubRange",
"(",
"from",
")",
"||",
"!",
"checkSubRange",
"(",
"to",
")",
")",
"{",
"throw",
"new",
"IndexOutOfBoundsException",
"(",
"\"Required data for the sub list [\"",
"+",
"from",
"+",
"\",\"",
"+",
"(",
"to",
"+",
"1",
")",
"+",
"\"[ have \"",
"+",
"\"not been loaded in the virtual list.\"",
")",
";",
"}",
"}"
] | Asserts that the requested sub list is available in the virtual list. Otherwise it throws
an IndexOutOfBoundsException.
@param from the from index (inclusive)
@param to the to index (inclusive) | [
"Asserts",
"that",
"the",
"requested",
"sub",
"list",
"is",
"available",
"in",
"the",
"virtual",
"list",
".",
"Otherwise",
"it",
"throws",
"an",
"IndexOutOfBoundsException",
"."
] | train | https://github.com/seedstack/business/blob/55b3e861fe152e9b125ebc69daa91a682deeae8a/migrate/src/main/java/org/seedstack/business/view/VirtualList.java#L116-L121 |
hortonworks/dstream | dstream-api/src/main/java/io/dstream/utils/StringUtils.java | StringUtils.compareLength | public static int compareLength(String a, String b) {
"""
Will compare the length of two strings, maintaining semantics of the
traditional {@link Comparator} by returning <i>int</i>.
@param a first {@link String}
@param b second {@link String}
@return integer value of -1, 0 or 1 following this logic:<br>
<pre>
a.length() > b.length() ? 1 : a.length() < b.length() ? -1 : 0;
</pre>
"""
return a.length() > b.length() ? 1 : a.length() < b.length() ? -1 : 0;
} | java | public static int compareLength(String a, String b){
return a.length() > b.length() ? 1 : a.length() < b.length() ? -1 : 0;
} | [
"public",
"static",
"int",
"compareLength",
"(",
"String",
"a",
",",
"String",
"b",
")",
"{",
"return",
"a",
".",
"length",
"(",
")",
">",
"b",
".",
"length",
"(",
")",
"?",
"1",
":",
"a",
".",
"length",
"(",
")",
"<",
"b",
".",
"length",
"(",
")",
"?",
"-",
"1",
":",
"0",
";",
"}"
] | Will compare the length of two strings, maintaining semantics of the
traditional {@link Comparator} by returning <i>int</i>.
@param a first {@link String}
@param b second {@link String}
@return integer value of -1, 0 or 1 following this logic:<br>
<pre>
a.length() > b.length() ? 1 : a.length() < b.length() ? -1 : 0;
</pre> | [
"Will",
"compare",
"the",
"length",
"of",
"two",
"strings",
"maintaining",
"semantics",
"of",
"the",
"traditional",
"{"
] | train | https://github.com/hortonworks/dstream/blob/3a106c0f14725b028fe7fe2dbc660406d9a5f142/dstream-api/src/main/java/io/dstream/utils/StringUtils.java#L37-L39 |
facebookarchive/hadoop-20 | src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/AvatarNode.java | AvatarNode.adjustMetaDirectoryNames | public static void adjustMetaDirectoryNames(Configuration conf, String serviceKey) {
"""
Append service name to each avatar meta directory name
@param conf configuration of NameNode
@param serviceKey the non-empty name of the name node service
"""
adjustMetaDirectoryName(conf, DFS_SHARED_NAME_DIR0_KEY, serviceKey);
adjustMetaDirectoryName(conf, DFS_SHARED_NAME_DIR1_KEY, serviceKey);
adjustMetaDirectoryName(conf, DFS_SHARED_EDITS_DIR0_KEY, serviceKey);
adjustMetaDirectoryName(conf, DFS_SHARED_EDITS_DIR1_KEY, serviceKey);
} | java | public static void adjustMetaDirectoryNames(Configuration conf, String serviceKey) {
adjustMetaDirectoryName(conf, DFS_SHARED_NAME_DIR0_KEY, serviceKey);
adjustMetaDirectoryName(conf, DFS_SHARED_NAME_DIR1_KEY, serviceKey);
adjustMetaDirectoryName(conf, DFS_SHARED_EDITS_DIR0_KEY, serviceKey);
adjustMetaDirectoryName(conf, DFS_SHARED_EDITS_DIR1_KEY, serviceKey);
} | [
"public",
"static",
"void",
"adjustMetaDirectoryNames",
"(",
"Configuration",
"conf",
",",
"String",
"serviceKey",
")",
"{",
"adjustMetaDirectoryName",
"(",
"conf",
",",
"DFS_SHARED_NAME_DIR0_KEY",
",",
"serviceKey",
")",
";",
"adjustMetaDirectoryName",
"(",
"conf",
",",
"DFS_SHARED_NAME_DIR1_KEY",
",",
"serviceKey",
")",
";",
"adjustMetaDirectoryName",
"(",
"conf",
",",
"DFS_SHARED_EDITS_DIR0_KEY",
",",
"serviceKey",
")",
";",
"adjustMetaDirectoryName",
"(",
"conf",
",",
"DFS_SHARED_EDITS_DIR1_KEY",
",",
"serviceKey",
")",
";",
"}"
] | Append service name to each avatar meta directory name
@param conf configuration of NameNode
@param serviceKey the non-empty name of the name node service | [
"Append",
"service",
"name",
"to",
"each",
"avatar",
"meta",
"directory",
"name"
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/AvatarNode.java#L1598-L1603 |
joniles/mpxj | src/main/java/net/sf/mpxj/mpp/GanttChartView14.java | GanttChartView14.getFontStyle | protected FontStyle getFontStyle(byte[] data, int offset, Map<Integer, FontBase> fontBases, boolean ignoreBackground) {
"""
Retrieve font details from a block of property data.
@param data property data
@param offset offset into property data
@param fontBases map of font bases
@param ignoreBackground set background to default values
@return FontStyle instance
"""
//System.out.println(ByteArrayHelper.hexdump(data, offset, 32, false));
Integer index = Integer.valueOf(MPPUtility.getByte(data, offset));
FontBase fontBase = fontBases.get(index);
int style = MPPUtility.getByte(data, offset + 3);
Color color = MPPUtility.getColor(data, offset + 4);
Color backgroundColor;
BackgroundPattern backgroundPattern;
if (ignoreBackground)
{
backgroundColor = null;
backgroundPattern = BackgroundPattern.SOLID;
}
else
{
backgroundColor = MPPUtility.getColor(data, offset + 16);
backgroundPattern = BackgroundPattern.getInstance(MPPUtility.getShort(data, offset + 28));
}
boolean bold = ((style & 0x01) != 0);
boolean italic = ((style & 0x02) != 0);
boolean underline = ((style & 0x04) != 0);
boolean strikethrough = ((style & 0x08) != 0);
FontStyle fontStyle = new FontStyle(fontBase, italic, bold, underline, strikethrough, color, backgroundColor, backgroundPattern);
//System.out.println(fontStyle);
return fontStyle;
} | java | protected FontStyle getFontStyle(byte[] data, int offset, Map<Integer, FontBase> fontBases, boolean ignoreBackground)
{
//System.out.println(ByteArrayHelper.hexdump(data, offset, 32, false));
Integer index = Integer.valueOf(MPPUtility.getByte(data, offset));
FontBase fontBase = fontBases.get(index);
int style = MPPUtility.getByte(data, offset + 3);
Color color = MPPUtility.getColor(data, offset + 4);
Color backgroundColor;
BackgroundPattern backgroundPattern;
if (ignoreBackground)
{
backgroundColor = null;
backgroundPattern = BackgroundPattern.SOLID;
}
else
{
backgroundColor = MPPUtility.getColor(data, offset + 16);
backgroundPattern = BackgroundPattern.getInstance(MPPUtility.getShort(data, offset + 28));
}
boolean bold = ((style & 0x01) != 0);
boolean italic = ((style & 0x02) != 0);
boolean underline = ((style & 0x04) != 0);
boolean strikethrough = ((style & 0x08) != 0);
FontStyle fontStyle = new FontStyle(fontBase, italic, bold, underline, strikethrough, color, backgroundColor, backgroundPattern);
//System.out.println(fontStyle);
return fontStyle;
} | [
"protected",
"FontStyle",
"getFontStyle",
"(",
"byte",
"[",
"]",
"data",
",",
"int",
"offset",
",",
"Map",
"<",
"Integer",
",",
"FontBase",
">",
"fontBases",
",",
"boolean",
"ignoreBackground",
")",
"{",
"//System.out.println(ByteArrayHelper.hexdump(data, offset, 32, false));",
"Integer",
"index",
"=",
"Integer",
".",
"valueOf",
"(",
"MPPUtility",
".",
"getByte",
"(",
"data",
",",
"offset",
")",
")",
";",
"FontBase",
"fontBase",
"=",
"fontBases",
".",
"get",
"(",
"index",
")",
";",
"int",
"style",
"=",
"MPPUtility",
".",
"getByte",
"(",
"data",
",",
"offset",
"+",
"3",
")",
";",
"Color",
"color",
"=",
"MPPUtility",
".",
"getColor",
"(",
"data",
",",
"offset",
"+",
"4",
")",
";",
"Color",
"backgroundColor",
";",
"BackgroundPattern",
"backgroundPattern",
";",
"if",
"(",
"ignoreBackground",
")",
"{",
"backgroundColor",
"=",
"null",
";",
"backgroundPattern",
"=",
"BackgroundPattern",
".",
"SOLID",
";",
"}",
"else",
"{",
"backgroundColor",
"=",
"MPPUtility",
".",
"getColor",
"(",
"data",
",",
"offset",
"+",
"16",
")",
";",
"backgroundPattern",
"=",
"BackgroundPattern",
".",
"getInstance",
"(",
"MPPUtility",
".",
"getShort",
"(",
"data",
",",
"offset",
"+",
"28",
")",
")",
";",
"}",
"boolean",
"bold",
"=",
"(",
"(",
"style",
"&",
"0x01",
")",
"!=",
"0",
")",
";",
"boolean",
"italic",
"=",
"(",
"(",
"style",
"&",
"0x02",
")",
"!=",
"0",
")",
";",
"boolean",
"underline",
"=",
"(",
"(",
"style",
"&",
"0x04",
")",
"!=",
"0",
")",
";",
"boolean",
"strikethrough",
"=",
"(",
"(",
"style",
"&",
"0x08",
")",
"!=",
"0",
")",
";",
"FontStyle",
"fontStyle",
"=",
"new",
"FontStyle",
"(",
"fontBase",
",",
"italic",
",",
"bold",
",",
"underline",
",",
"strikethrough",
",",
"color",
",",
"backgroundColor",
",",
"backgroundPattern",
")",
";",
"//System.out.println(fontStyle);",
"return",
"fontStyle",
";",
"}"
] | Retrieve font details from a block of property data.
@param data property data
@param offset offset into property data
@param fontBases map of font bases
@param ignoreBackground set background to default values
@return FontStyle instance | [
"Retrieve",
"font",
"details",
"from",
"a",
"block",
"of",
"property",
"data",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/GanttChartView14.java#L251-L281 |
nostra13/Android-Universal-Image-Loader | library/src/main/java/com/nostra13/universalimageloader/core/ImageLoader.java | ImageLoader.displayImage | public void displayImage(String uri, ImageView imageView) {
"""
Adds display image task to execution pool. Image will be set to ImageView when it's turn. <br/>
Default {@linkplain DisplayImageOptions display image options} from {@linkplain ImageLoaderConfiguration
configuration} will be used.<br />
<b>NOTE:</b> {@link #init(ImageLoaderConfiguration)} method must be called before this method call
@param uri Image URI (i.e. "http://site.com/image.png", "file:///mnt/sdcard/image.png")
@param imageView {@link ImageView} which should display image
@throws IllegalStateException if {@link #init(ImageLoaderConfiguration)} method wasn't called before
@throws IllegalArgumentException if passed <b>imageView</b> is null
"""
displayImage(uri, new ImageViewAware(imageView), null, null, null);
} | java | public void displayImage(String uri, ImageView imageView) {
displayImage(uri, new ImageViewAware(imageView), null, null, null);
} | [
"public",
"void",
"displayImage",
"(",
"String",
"uri",
",",
"ImageView",
"imageView",
")",
"{",
"displayImage",
"(",
"uri",
",",
"new",
"ImageViewAware",
"(",
"imageView",
")",
",",
"null",
",",
"null",
",",
"null",
")",
";",
"}"
] | Adds display image task to execution pool. Image will be set to ImageView when it's turn. <br/>
Default {@linkplain DisplayImageOptions display image options} from {@linkplain ImageLoaderConfiguration
configuration} will be used.<br />
<b>NOTE:</b> {@link #init(ImageLoaderConfiguration)} method must be called before this method call
@param uri Image URI (i.e. "http://site.com/image.png", "file:///mnt/sdcard/image.png")
@param imageView {@link ImageView} which should display image
@throws IllegalStateException if {@link #init(ImageLoaderConfiguration)} method wasn't called before
@throws IllegalArgumentException if passed <b>imageView</b> is null | [
"Adds",
"display",
"image",
"task",
"to",
"execution",
"pool",
".",
"Image",
"will",
"be",
"set",
"to",
"ImageView",
"when",
"it",
"s",
"turn",
".",
"<br",
"/",
">",
"Default",
"{",
"@linkplain",
"DisplayImageOptions",
"display",
"image",
"options",
"}",
"from",
"{",
"@linkplain",
"ImageLoaderConfiguration",
"configuration",
"}",
"will",
"be",
"used",
".",
"<br",
"/",
">",
"<b",
">",
"NOTE",
":",
"<",
"/",
"b",
">",
"{",
"@link",
"#init",
"(",
"ImageLoaderConfiguration",
")",
"}",
"method",
"must",
"be",
"called",
"before",
"this",
"method",
"call"
] | train | https://github.com/nostra13/Android-Universal-Image-Loader/blob/fc3c5f6779bb4f702e233653b61bd9d559e345cc/library/src/main/java/com/nostra13/universalimageloader/core/ImageLoader.java#L315-L317 |
strator-dev/greenpepper-open | extensions-external/selenium/src/main/java/com/greenpepper/extensions/selenium/SeleniumRemoteControlFixture.java | SeleniumRemoteControlFixture.assertExpression | public boolean assertExpression(String variableNameExpression, String expectedValue) {
"""
<p>assertExpression.</p>
@param variableNameExpression a {@link java.lang.String} object.
@param expectedValue a {@link java.lang.String} object.
@return a boolean.
"""
Expression expression = new Expression(variableNameExpression);
return expectedValue.equals(this.variables.get(expression.parseVariableName()));
} | java | public boolean assertExpression(String variableNameExpression, String expectedValue)
{
Expression expression = new Expression(variableNameExpression);
return expectedValue.equals(this.variables.get(expression.parseVariableName()));
} | [
"public",
"boolean",
"assertExpression",
"(",
"String",
"variableNameExpression",
",",
"String",
"expectedValue",
")",
"{",
"Expression",
"expression",
"=",
"new",
"Expression",
"(",
"variableNameExpression",
")",
";",
"return",
"expectedValue",
".",
"equals",
"(",
"this",
".",
"variables",
".",
"get",
"(",
"expression",
".",
"parseVariableName",
"(",
")",
")",
")",
";",
"}"
] | <p>assertExpression.</p>
@param variableNameExpression a {@link java.lang.String} object.
@param expectedValue a {@link java.lang.String} object.
@return a boolean. | [
"<p",
">",
"assertExpression",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/strator-dev/greenpepper-open/blob/71fd244b4989e9cd2d07ae62dd954a1f2a269a92/extensions-external/selenium/src/main/java/com/greenpepper/extensions/selenium/SeleniumRemoteControlFixture.java#L178-L182 |
carewebframework/carewebframework-core | org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/context/ContextManager.java | ContextManager.ccowPending | @Override
public void ccowPending(CCOWContextManager sender, ContextItems contextItems) {
"""
Callback to handle a polling request from the CCOW context manager.
"""
ccowTransaction = true;
updateCCOWStatus();
setMarshaledContext(contextItems, false, response -> {
if (response.rejected()) {
sender.setSurveyResponse(response.toString());
}
ccowTransaction = false;
updateCCOWStatus();
});
} | java | @Override
public void ccowPending(CCOWContextManager sender, ContextItems contextItems) {
ccowTransaction = true;
updateCCOWStatus();
setMarshaledContext(contextItems, false, response -> {
if (response.rejected()) {
sender.setSurveyResponse(response.toString());
}
ccowTransaction = false;
updateCCOWStatus();
});
} | [
"@",
"Override",
"public",
"void",
"ccowPending",
"(",
"CCOWContextManager",
"sender",
",",
"ContextItems",
"contextItems",
")",
"{",
"ccowTransaction",
"=",
"true",
";",
"updateCCOWStatus",
"(",
")",
";",
"setMarshaledContext",
"(",
"contextItems",
",",
"false",
",",
"response",
"->",
"{",
"if",
"(",
"response",
".",
"rejected",
"(",
")",
")",
"{",
"sender",
".",
"setSurveyResponse",
"(",
"response",
".",
"toString",
"(",
")",
")",
";",
"}",
"ccowTransaction",
"=",
"false",
";",
"updateCCOWStatus",
"(",
")",
";",
"}",
")",
";",
"}"
] | Callback to handle a polling request from the CCOW context manager. | [
"Callback",
"to",
"handle",
"a",
"polling",
"request",
"from",
"the",
"CCOW",
"context",
"manager",
"."
] | train | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/context/ContextManager.java#L636-L648 |
docusign/docusign-java-client | src/main/java/com/docusign/esign/api/EnvelopesApi.java | EnvelopesApi.createRecipient | public Recipients createRecipient(String accountId, String envelopeId, Recipients recipients) throws ApiException {
"""
Adds one or more recipients to an envelope.
Adds one or more recipients to an envelope. For an in process envelope, one that has been sent and has not been completed or voided, an email is sent to a new recipient when they are reached in the routing order. If the new recipient's routing order is before or the same as the envelope's next recipient, an email is only sent if the optional `resend_envelope` query string is set to **true**.
@param accountId The external account number (int) or account ID Guid. (required)
@param envelopeId The envelopeId Guid of the envelope being accessed. (required)
@param recipients (optional)
@return Recipients
"""
return createRecipient(accountId, envelopeId, recipients, null);
} | java | public Recipients createRecipient(String accountId, String envelopeId, Recipients recipients) throws ApiException {
return createRecipient(accountId, envelopeId, recipients, null);
} | [
"public",
"Recipients",
"createRecipient",
"(",
"String",
"accountId",
",",
"String",
"envelopeId",
",",
"Recipients",
"recipients",
")",
"throws",
"ApiException",
"{",
"return",
"createRecipient",
"(",
"accountId",
",",
"envelopeId",
",",
"recipients",
",",
"null",
")",
";",
"}"
] | Adds one or more recipients to an envelope.
Adds one or more recipients to an envelope. For an in process envelope, one that has been sent and has not been completed or voided, an email is sent to a new recipient when they are reached in the routing order. If the new recipient's routing order is before or the same as the envelope's next recipient, an email is only sent if the optional `resend_envelope` query string is set to **true**.
@param accountId The external account number (int) or account ID Guid. (required)
@param envelopeId The envelopeId Guid of the envelope being accessed. (required)
@param recipients (optional)
@return Recipients | [
"Adds",
"one",
"or",
"more",
"recipients",
"to",
"an",
"envelope",
".",
"Adds",
"one",
"or",
"more",
"recipients",
"to",
"an",
"envelope",
".",
"For",
"an",
"in",
"process",
"envelope",
"one",
"that",
"has",
"been",
"sent",
"and",
"has",
"not",
"been",
"completed",
"or",
"voided",
"an",
"email",
"is",
"sent",
"to",
"a",
"new",
"recipient",
"when",
"they",
"are",
"reached",
"in",
"the",
"routing",
"order",
".",
"If",
"the",
"new",
"recipient'",
";",
"s",
"routing",
"order",
"is",
"before",
"or",
"the",
"same",
"as",
"the",
"envelope'",
";",
"s",
"next",
"recipient",
"an",
"email",
"is",
"only",
"sent",
"if",
"the",
"optional",
"`",
";",
"resend_envelope`",
";",
"query",
"string",
"is",
"set",
"to",
"**",
"true",
"**",
"."
] | train | https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/EnvelopesApi.java#L831-L833 |
facebookarchive/hadoop-20 | src/core/org/apache/hadoop/net/NetworkTopology.java | NetworkTopology.isOnSameRack | public boolean isOnSameRack( Node node1, Node node2) {
"""
Check if two nodes are on the same rack
@param node1 one node
@param node2 another node
@return true if node1 and node2 are pm the same rack; false otherwise
@exception IllegalArgumentException when either node1 or node2 is null, or
node1 or node2 do not belong to the cluster
"""
if (node1 == null || node2 == null) {
return false;
}
netlock.readLock().lock();
try {
return node1.getParent()==node2.getParent();
} finally {
netlock.readLock().unlock();
}
} | java | public boolean isOnSameRack( Node node1, Node node2) {
if (node1 == null || node2 == null) {
return false;
}
netlock.readLock().lock();
try {
return node1.getParent()==node2.getParent();
} finally {
netlock.readLock().unlock();
}
} | [
"public",
"boolean",
"isOnSameRack",
"(",
"Node",
"node1",
",",
"Node",
"node2",
")",
"{",
"if",
"(",
"node1",
"==",
"null",
"||",
"node2",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"netlock",
".",
"readLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"try",
"{",
"return",
"node1",
".",
"getParent",
"(",
")",
"==",
"node2",
".",
"getParent",
"(",
")",
";",
"}",
"finally",
"{",
"netlock",
".",
"readLock",
"(",
")",
".",
"unlock",
"(",
")",
";",
"}",
"}"
] | Check if two nodes are on the same rack
@param node1 one node
@param node2 another node
@return true if node1 and node2 are pm the same rack; false otherwise
@exception IllegalArgumentException when either node1 or node2 is null, or
node1 or node2 do not belong to the cluster | [
"Check",
"if",
"two",
"nodes",
"are",
"on",
"the",
"same",
"rack"
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/net/NetworkTopology.java#L551-L562 |
line/armeria | examples/grpc-service/src/main/java/example/armeria/grpc/HelloServiceImpl.java | HelloServiceImpl.lazyHello | @Override
public void lazyHello(HelloRequest request, StreamObserver<HelloReply> responseObserver) {
"""
Sends a {@link HelloReply} 3 seconds after receiving a request.
"""
// You can use the event loop for scheduling a task.
RequestContext.current().contextAwareEventLoop().schedule(() -> {
responseObserver.onNext(buildReply(toMessage(request.getName())));
responseObserver.onCompleted();
}, 3, TimeUnit.SECONDS);
} | java | @Override
public void lazyHello(HelloRequest request, StreamObserver<HelloReply> responseObserver) {
// You can use the event loop for scheduling a task.
RequestContext.current().contextAwareEventLoop().schedule(() -> {
responseObserver.onNext(buildReply(toMessage(request.getName())));
responseObserver.onCompleted();
}, 3, TimeUnit.SECONDS);
} | [
"@",
"Override",
"public",
"void",
"lazyHello",
"(",
"HelloRequest",
"request",
",",
"StreamObserver",
"<",
"HelloReply",
">",
"responseObserver",
")",
"{",
"// You can use the event loop for scheduling a task.",
"RequestContext",
".",
"current",
"(",
")",
".",
"contextAwareEventLoop",
"(",
")",
".",
"schedule",
"(",
"(",
")",
"->",
"{",
"responseObserver",
".",
"onNext",
"(",
"buildReply",
"(",
"toMessage",
"(",
"request",
".",
"getName",
"(",
")",
")",
")",
")",
";",
"responseObserver",
".",
"onCompleted",
"(",
")",
";",
"}",
",",
"3",
",",
"TimeUnit",
".",
"SECONDS",
")",
";",
"}"
] | Sends a {@link HelloReply} 3 seconds after receiving a request. | [
"Sends",
"a",
"{"
] | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/examples/grpc-service/src/main/java/example/armeria/grpc/HelloServiceImpl.java#L31-L38 |
OpenTSDB/opentsdb | src/query/filter/TagVLiteralOrFilter.java | TagVLiteralOrFilter.resolveTagkName | @Override
public Deferred<byte[]> resolveTagkName(final TSDB tsdb) {
"""
Overridden here so that we can resolve the literal values if we don't have
too many of them AND we're not searching with case insensitivity.
"""
final Config config = tsdb.getConfig();
// resolve tag values if the filter is NOT case insensitive and there are
// fewer literals than the expansion limit
if (!case_insensitive &&
literals.size() <= config.getInt("tsd.query.filter.expansion_limit")) {
return resolveTags(tsdb, literals);
} else {
return super.resolveTagkName(tsdb);
}
} | java | @Override
public Deferred<byte[]> resolveTagkName(final TSDB tsdb) {
final Config config = tsdb.getConfig();
// resolve tag values if the filter is NOT case insensitive and there are
// fewer literals than the expansion limit
if (!case_insensitive &&
literals.size() <= config.getInt("tsd.query.filter.expansion_limit")) {
return resolveTags(tsdb, literals);
} else {
return super.resolveTagkName(tsdb);
}
} | [
"@",
"Override",
"public",
"Deferred",
"<",
"byte",
"[",
"]",
">",
"resolveTagkName",
"(",
"final",
"TSDB",
"tsdb",
")",
"{",
"final",
"Config",
"config",
"=",
"tsdb",
".",
"getConfig",
"(",
")",
";",
"// resolve tag values if the filter is NOT case insensitive and there are ",
"// fewer literals than the expansion limit",
"if",
"(",
"!",
"case_insensitive",
"&&",
"literals",
".",
"size",
"(",
")",
"<=",
"config",
".",
"getInt",
"(",
"\"tsd.query.filter.expansion_limit\"",
")",
")",
"{",
"return",
"resolveTags",
"(",
"tsdb",
",",
"literals",
")",
";",
"}",
"else",
"{",
"return",
"super",
".",
"resolveTagkName",
"(",
"tsdb",
")",
";",
"}",
"}"
] | Overridden here so that we can resolve the literal values if we don't have
too many of them AND we're not searching with case insensitivity. | [
"Overridden",
"here",
"so",
"that",
"we",
"can",
"resolve",
"the",
"literal",
"values",
"if",
"we",
"don",
"t",
"have",
"too",
"many",
"of",
"them",
"AND",
"we",
"re",
"not",
"searching",
"with",
"case",
"insensitivity",
"."
] | train | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/query/filter/TagVLiteralOrFilter.java#L100-L112 |
stratosphere/stratosphere | stratosphere-core/src/main/java/eu/stratosphere/api/common/operators/base/GenericDataSinkBase.java | GenericDataSinkBase.setRangePartitioned | public void setRangePartitioned(Ordering partitionOrdering, DataDistribution distribution) {
"""
Sets the sink to partition the records into ranges over the given ordering.
The bucket boundaries are determined using the given data distribution.
@param partitionOrdering The record ordering over which to partition in ranges.
@param distribution The distribution to use for the range partitioning.
"""
if (partitionOrdering.getNumberOfFields() != distribution.getNumberOfFields()) {
throw new IllegalArgumentException("The number of keys in the distribution must match number of ordered fields.");
}
// TODO: check compatibility of distribution and ordering (number and order of keys, key types, etc.
// TODO: adapt partition ordering to data distribution (use prefix of ordering)
this.partitionOrdering = partitionOrdering;
this.distribution = distribution;
} | java | public void setRangePartitioned(Ordering partitionOrdering, DataDistribution distribution) {
if (partitionOrdering.getNumberOfFields() != distribution.getNumberOfFields()) {
throw new IllegalArgumentException("The number of keys in the distribution must match number of ordered fields.");
}
// TODO: check compatibility of distribution and ordering (number and order of keys, key types, etc.
// TODO: adapt partition ordering to data distribution (use prefix of ordering)
this.partitionOrdering = partitionOrdering;
this.distribution = distribution;
} | [
"public",
"void",
"setRangePartitioned",
"(",
"Ordering",
"partitionOrdering",
",",
"DataDistribution",
"distribution",
")",
"{",
"if",
"(",
"partitionOrdering",
".",
"getNumberOfFields",
"(",
")",
"!=",
"distribution",
".",
"getNumberOfFields",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"The number of keys in the distribution must match number of ordered fields.\"",
")",
";",
"}",
"// TODO: check compatibility of distribution and ordering (number and order of keys, key types, etc.",
"// TODO: adapt partition ordering to data distribution (use prefix of ordering)",
"this",
".",
"partitionOrdering",
"=",
"partitionOrdering",
";",
"this",
".",
"distribution",
"=",
"distribution",
";",
"}"
] | Sets the sink to partition the records into ranges over the given ordering.
The bucket boundaries are determined using the given data distribution.
@param partitionOrdering The record ordering over which to partition in ranges.
@param distribution The distribution to use for the range partitioning. | [
"Sets",
"the",
"sink",
"to",
"partition",
"the",
"records",
"into",
"ranges",
"over",
"the",
"given",
"ordering",
".",
"The",
"bucket",
"boundaries",
"are",
"determined",
"using",
"the",
"given",
"data",
"distribution",
"."
] | train | https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-core/src/main/java/eu/stratosphere/api/common/operators/base/GenericDataSinkBase.java#L221-L231 |
Impetus/Kundera | src/jpa-engine/core/src/main/java/com/impetus/kundera/metadata/MetadataUtils.java | MetadataUtils.setSchemaAndPersistenceUnit | public static void setSchemaAndPersistenceUnit(EntityMetadata m, String schemaStr, Map puProperties) {
"""
Sets the schema and persistence unit.
@param m
the m
@param schemaStr
the schema str
@param puProperties
"""
if (schemaStr.indexOf(Constants.SCHEMA_PERSISTENCE_UNIT_SEPARATOR) > 0)
{
String schemaName = null;
if (puProperties != null)
{
schemaName = (String) puProperties.get(PersistenceProperties.KUNDERA_KEYSPACE);
}
if (schemaName == null)
{
schemaName = schemaStr.substring(0, schemaStr.indexOf(Constants.SCHEMA_PERSISTENCE_UNIT_SEPARATOR));
}
m.setSchema(schemaName);
m.setPersistenceUnit(schemaStr.substring(
schemaStr.indexOf(Constants.SCHEMA_PERSISTENCE_UNIT_SEPARATOR) + 1, schemaStr.length()));
}
else
{
m.setSchema(StringUtils.isBlank(schemaStr) ? null : schemaStr);
}
} | java | public static void setSchemaAndPersistenceUnit(EntityMetadata m, String schemaStr, Map puProperties)
{
if (schemaStr.indexOf(Constants.SCHEMA_PERSISTENCE_UNIT_SEPARATOR) > 0)
{
String schemaName = null;
if (puProperties != null)
{
schemaName = (String) puProperties.get(PersistenceProperties.KUNDERA_KEYSPACE);
}
if (schemaName == null)
{
schemaName = schemaStr.substring(0, schemaStr.indexOf(Constants.SCHEMA_PERSISTENCE_UNIT_SEPARATOR));
}
m.setSchema(schemaName);
m.setPersistenceUnit(schemaStr.substring(
schemaStr.indexOf(Constants.SCHEMA_PERSISTENCE_UNIT_SEPARATOR) + 1, schemaStr.length()));
}
else
{
m.setSchema(StringUtils.isBlank(schemaStr) ? null : schemaStr);
}
} | [
"public",
"static",
"void",
"setSchemaAndPersistenceUnit",
"(",
"EntityMetadata",
"m",
",",
"String",
"schemaStr",
",",
"Map",
"puProperties",
")",
"{",
"if",
"(",
"schemaStr",
".",
"indexOf",
"(",
"Constants",
".",
"SCHEMA_PERSISTENCE_UNIT_SEPARATOR",
")",
">",
"0",
")",
"{",
"String",
"schemaName",
"=",
"null",
";",
"if",
"(",
"puProperties",
"!=",
"null",
")",
"{",
"schemaName",
"=",
"(",
"String",
")",
"puProperties",
".",
"get",
"(",
"PersistenceProperties",
".",
"KUNDERA_KEYSPACE",
")",
";",
"}",
"if",
"(",
"schemaName",
"==",
"null",
")",
"{",
"schemaName",
"=",
"schemaStr",
".",
"substring",
"(",
"0",
",",
"schemaStr",
".",
"indexOf",
"(",
"Constants",
".",
"SCHEMA_PERSISTENCE_UNIT_SEPARATOR",
")",
")",
";",
"}",
"m",
".",
"setSchema",
"(",
"schemaName",
")",
";",
"m",
".",
"setPersistenceUnit",
"(",
"schemaStr",
".",
"substring",
"(",
"schemaStr",
".",
"indexOf",
"(",
"Constants",
".",
"SCHEMA_PERSISTENCE_UNIT_SEPARATOR",
")",
"+",
"1",
",",
"schemaStr",
".",
"length",
"(",
")",
")",
")",
";",
"}",
"else",
"{",
"m",
".",
"setSchema",
"(",
"StringUtils",
".",
"isBlank",
"(",
"schemaStr",
")",
"?",
"null",
":",
"schemaStr",
")",
";",
"}",
"}"
] | Sets the schema and persistence unit.
@param m
the m
@param schemaStr
the schema str
@param puProperties | [
"Sets",
"the",
"schema",
"and",
"persistence",
"unit",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/metadata/MetadataUtils.java#L283-L305 |
googlegenomics/utils-java | src/main/java/com/google/cloud/genomics/utils/GenomicsFactory.java | GenomicsFactory.fromServiceAccount | public Genomics fromServiceAccount(String serviceAccountId, File p12File)
throws GeneralSecurityException, IOException {
"""
Create a new genomics stub from the given service account ID and private key {@link File}.
@param serviceAccountId The service account ID (typically an email address)
@param p12File The file on disk containing the private key
@return The new {@code Genomics} stub
@throws GeneralSecurityException
@throws IOException
"""
Preconditions.checkNotNull(serviceAccountId);
Preconditions.checkNotNull(p12File);
return fromServiceAccount(getGenomicsBuilder(), serviceAccountId, p12File).build();
} | java | public Genomics fromServiceAccount(String serviceAccountId, File p12File)
throws GeneralSecurityException, IOException {
Preconditions.checkNotNull(serviceAccountId);
Preconditions.checkNotNull(p12File);
return fromServiceAccount(getGenomicsBuilder(), serviceAccountId, p12File).build();
} | [
"public",
"Genomics",
"fromServiceAccount",
"(",
"String",
"serviceAccountId",
",",
"File",
"p12File",
")",
"throws",
"GeneralSecurityException",
",",
"IOException",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"serviceAccountId",
")",
";",
"Preconditions",
".",
"checkNotNull",
"(",
"p12File",
")",
";",
"return",
"fromServiceAccount",
"(",
"getGenomicsBuilder",
"(",
")",
",",
"serviceAccountId",
",",
"p12File",
")",
".",
"build",
"(",
")",
";",
"}"
] | Create a new genomics stub from the given service account ID and private key {@link File}.
@param serviceAccountId The service account ID (typically an email address)
@param p12File The file on disk containing the private key
@return The new {@code Genomics} stub
@throws GeneralSecurityException
@throws IOException | [
"Create",
"a",
"new",
"genomics",
"stub",
"from",
"the",
"given",
"service",
"account",
"ID",
"and",
"private",
"key",
"{",
"@link",
"File",
"}",
"."
] | train | https://github.com/googlegenomics/utils-java/blob/7205d5b4e4f61fc6b93acb4bdd76b93df5b5f612/src/main/java/com/google/cloud/genomics/utils/GenomicsFactory.java#L440-L445 |
intive-FDV/DynamicJasper | src/main/java/ar/com/fdvs/dj/domain/builders/CrosstabBuilder.java | CrosstabBuilder.setRowStyles | public CrosstabBuilder setRowStyles(Style headerStyle, Style totalStyle, Style totalHeaderStyle) {
"""
Should be called after all rows have been created
@param headerStyle
@param totalStyle
@param totalHeaderStyle
@return
"""
crosstab.setRowHeaderStyle(headerStyle);
crosstab.setRowTotalheaderStyle(totalHeaderStyle);
crosstab.setRowTotalStyle(totalStyle);
return this;
} | java | public CrosstabBuilder setRowStyles(Style headerStyle, Style totalStyle, Style totalHeaderStyle) {
crosstab.setRowHeaderStyle(headerStyle);
crosstab.setRowTotalheaderStyle(totalHeaderStyle);
crosstab.setRowTotalStyle(totalStyle);
return this;
} | [
"public",
"CrosstabBuilder",
"setRowStyles",
"(",
"Style",
"headerStyle",
",",
"Style",
"totalStyle",
",",
"Style",
"totalHeaderStyle",
")",
"{",
"crosstab",
".",
"setRowHeaderStyle",
"(",
"headerStyle",
")",
";",
"crosstab",
".",
"setRowTotalheaderStyle",
"(",
"totalHeaderStyle",
")",
";",
"crosstab",
".",
"setRowTotalStyle",
"(",
"totalStyle",
")",
";",
"return",
"this",
";",
"}"
] | Should be called after all rows have been created
@param headerStyle
@param totalStyle
@param totalHeaderStyle
@return | [
"Should",
"be",
"called",
"after",
"all",
"rows",
"have",
"been",
"created"
] | train | https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/domain/builders/CrosstabBuilder.java#L385-L390 |
bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/core/Block.java | Block.checkTransactions | private void checkTransactions(final int height, final EnumSet<VerifyFlag> flags)
throws VerificationException {
"""
Verify the transactions on a block.
@param height block height, if known, or -1 otherwise. If provided, used
to validate the coinbase input script of v2 and above blocks.
@throws VerificationException if there was an error verifying the block.
"""
// The first transaction in a block must always be a coinbase transaction.
if (!transactions.get(0).isCoinBase())
throw new VerificationException("First tx is not coinbase");
if (flags.contains(Block.VerifyFlag.HEIGHT_IN_COINBASE) && height >= BLOCK_HEIGHT_GENESIS) {
transactions.get(0).checkCoinBaseHeight(height);
}
// The rest must not be.
for (int i = 1; i < transactions.size(); i++) {
if (transactions.get(i).isCoinBase())
throw new VerificationException("TX " + i + " is coinbase when it should not be.");
}
} | java | private void checkTransactions(final int height, final EnumSet<VerifyFlag> flags)
throws VerificationException {
// The first transaction in a block must always be a coinbase transaction.
if (!transactions.get(0).isCoinBase())
throw new VerificationException("First tx is not coinbase");
if (flags.contains(Block.VerifyFlag.HEIGHT_IN_COINBASE) && height >= BLOCK_HEIGHT_GENESIS) {
transactions.get(0).checkCoinBaseHeight(height);
}
// The rest must not be.
for (int i = 1; i < transactions.size(); i++) {
if (transactions.get(i).isCoinBase())
throw new VerificationException("TX " + i + " is coinbase when it should not be.");
}
} | [
"private",
"void",
"checkTransactions",
"(",
"final",
"int",
"height",
",",
"final",
"EnumSet",
"<",
"VerifyFlag",
">",
"flags",
")",
"throws",
"VerificationException",
"{",
"// The first transaction in a block must always be a coinbase transaction.",
"if",
"(",
"!",
"transactions",
".",
"get",
"(",
"0",
")",
".",
"isCoinBase",
"(",
")",
")",
"throw",
"new",
"VerificationException",
"(",
"\"First tx is not coinbase\"",
")",
";",
"if",
"(",
"flags",
".",
"contains",
"(",
"Block",
".",
"VerifyFlag",
".",
"HEIGHT_IN_COINBASE",
")",
"&&",
"height",
">=",
"BLOCK_HEIGHT_GENESIS",
")",
"{",
"transactions",
".",
"get",
"(",
"0",
")",
".",
"checkCoinBaseHeight",
"(",
"height",
")",
";",
"}",
"// The rest must not be.",
"for",
"(",
"int",
"i",
"=",
"1",
";",
"i",
"<",
"transactions",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"if",
"(",
"transactions",
".",
"get",
"(",
"i",
")",
".",
"isCoinBase",
"(",
")",
")",
"throw",
"new",
"VerificationException",
"(",
"\"TX \"",
"+",
"i",
"+",
"\" is coinbase when it should not be.\"",
")",
";",
"}",
"}"
] | Verify the transactions on a block.
@param height block height, if known, or -1 otherwise. If provided, used
to validate the coinbase input script of v2 and above blocks.
@throws VerificationException if there was an error verifying the block. | [
"Verify",
"the",
"transactions",
"on",
"a",
"block",
"."
] | train | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/Block.java#L686-L699 |
infinispan/infinispan | core/src/main/java/org/infinispan/io/GridFilesystem.java | GridFilesystem.getOutput | public OutputStream getOutput(String pathname, boolean append, int chunkSize) throws IOException {
"""
Opens an OutputStream for writing to the file denoted by pathname.
@param pathname the file to write to
@param append if true, the bytes written to the OutputStream will be appended to the end of the file
@param chunkSize the size of the file's chunks. This parameter is honored only when the file at pathname does
not yet exist. If the file already exists, the file's own chunkSize has precedence.
@return the OutputStream for writing to the file
@throws IOException if the file is a directory, cannot be created or some other error occurs
"""
GridFile file = (GridFile) getFile(pathname, chunkSize);
checkIsNotDirectory(file);
createIfNeeded(file);
return new GridOutputStream(file, append, data);
} | java | public OutputStream getOutput(String pathname, boolean append, int chunkSize) throws IOException {
GridFile file = (GridFile) getFile(pathname, chunkSize);
checkIsNotDirectory(file);
createIfNeeded(file);
return new GridOutputStream(file, append, data);
} | [
"public",
"OutputStream",
"getOutput",
"(",
"String",
"pathname",
",",
"boolean",
"append",
",",
"int",
"chunkSize",
")",
"throws",
"IOException",
"{",
"GridFile",
"file",
"=",
"(",
"GridFile",
")",
"getFile",
"(",
"pathname",
",",
"chunkSize",
")",
";",
"checkIsNotDirectory",
"(",
"file",
")",
";",
"createIfNeeded",
"(",
"file",
")",
";",
"return",
"new",
"GridOutputStream",
"(",
"file",
",",
"append",
",",
"data",
")",
";",
"}"
] | Opens an OutputStream for writing to the file denoted by pathname.
@param pathname the file to write to
@param append if true, the bytes written to the OutputStream will be appended to the end of the file
@param chunkSize the size of the file's chunks. This parameter is honored only when the file at pathname does
not yet exist. If the file already exists, the file's own chunkSize has precedence.
@return the OutputStream for writing to the file
@throws IOException if the file is a directory, cannot be created or some other error occurs | [
"Opens",
"an",
"OutputStream",
"for",
"writing",
"to",
"the",
"file",
"denoted",
"by",
"pathname",
"."
] | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/io/GridFilesystem.java#L119-L124 |
BioPAX/Paxtools | pattern/src/main/java/org/biopax/paxtools/pattern/PatternBox.java | PatternBox.chemicalAffectsProteinThroughBinding | public static Pattern chemicalAffectsProteinThroughBinding(Blacklist blacklist) {
"""
A small molecule is in a complex with a protein.
@param blacklist a skip-list of ubiquitous molecules
@return pattern
"""
Pattern p = new Pattern(SmallMoleculeReference.class, "SMR");
p.add(erToPE(), "SMR", "SPE1");
p.add(notGeneric(), "SPE1");
if (blacklist != null) p.add(new NonUbique(blacklist), "SPE1");
p.add(linkToComplex(), "SPE1", "PE1");
p.add(new PathConstraint("PhysicalEntity/componentOf"), "PE1", "Complex");
p.add(new PathConstraint("Complex/component"), "Complex", "PE2");
p.add(equal(false), "PE1", "PE2");
p.add(linkToSpecific(), "PE2", "SPE2");
p.add(new Type(SequenceEntity.class), "SPE2");
p.add(peToER(), "SPE2", "generic ER");
p.add(linkedER(false), "generic ER", "ER");
return p;
} | java | public static Pattern chemicalAffectsProteinThroughBinding(Blacklist blacklist)
{
Pattern p = new Pattern(SmallMoleculeReference.class, "SMR");
p.add(erToPE(), "SMR", "SPE1");
p.add(notGeneric(), "SPE1");
if (blacklist != null) p.add(new NonUbique(blacklist), "SPE1");
p.add(linkToComplex(), "SPE1", "PE1");
p.add(new PathConstraint("PhysicalEntity/componentOf"), "PE1", "Complex");
p.add(new PathConstraint("Complex/component"), "Complex", "PE2");
p.add(equal(false), "PE1", "PE2");
p.add(linkToSpecific(), "PE2", "SPE2");
p.add(new Type(SequenceEntity.class), "SPE2");
p.add(peToER(), "SPE2", "generic ER");
p.add(linkedER(false), "generic ER", "ER");
return p;
} | [
"public",
"static",
"Pattern",
"chemicalAffectsProteinThroughBinding",
"(",
"Blacklist",
"blacklist",
")",
"{",
"Pattern",
"p",
"=",
"new",
"Pattern",
"(",
"SmallMoleculeReference",
".",
"class",
",",
"\"SMR\"",
")",
";",
"p",
".",
"add",
"(",
"erToPE",
"(",
")",
",",
"\"SMR\"",
",",
"\"SPE1\"",
")",
";",
"p",
".",
"add",
"(",
"notGeneric",
"(",
")",
",",
"\"SPE1\"",
")",
";",
"if",
"(",
"blacklist",
"!=",
"null",
")",
"p",
".",
"add",
"(",
"new",
"NonUbique",
"(",
"blacklist",
")",
",",
"\"SPE1\"",
")",
";",
"p",
".",
"add",
"(",
"linkToComplex",
"(",
")",
",",
"\"SPE1\"",
",",
"\"PE1\"",
")",
";",
"p",
".",
"add",
"(",
"new",
"PathConstraint",
"(",
"\"PhysicalEntity/componentOf\"",
")",
",",
"\"PE1\"",
",",
"\"Complex\"",
")",
";",
"p",
".",
"add",
"(",
"new",
"PathConstraint",
"(",
"\"Complex/component\"",
")",
",",
"\"Complex\"",
",",
"\"PE2\"",
")",
";",
"p",
".",
"add",
"(",
"equal",
"(",
"false",
")",
",",
"\"PE1\"",
",",
"\"PE2\"",
")",
";",
"p",
".",
"add",
"(",
"linkToSpecific",
"(",
")",
",",
"\"PE2\"",
",",
"\"SPE2\"",
")",
";",
"p",
".",
"add",
"(",
"new",
"Type",
"(",
"SequenceEntity",
".",
"class",
")",
",",
"\"SPE2\"",
")",
";",
"p",
".",
"add",
"(",
"peToER",
"(",
")",
",",
"\"SPE2\"",
",",
"\"generic ER\"",
")",
";",
"p",
".",
"add",
"(",
"linkedER",
"(",
"false",
")",
",",
"\"generic ER\"",
",",
"\"ER\"",
")",
";",
"return",
"p",
";",
"}"
] | A small molecule is in a complex with a protein.
@param blacklist a skip-list of ubiquitous molecules
@return pattern | [
"A",
"small",
"molecule",
"is",
"in",
"a",
"complex",
"with",
"a",
"protein",
"."
] | train | https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/PatternBox.java#L527-L542 |
gallandarakhneorg/afc | advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/mapelement/MapComposedElement.java | MapComposedElement.setPointAt | public final boolean setPointAt(int groupIndex, int indexInGroup, Point2D<?, ?> point, boolean canonize) {
"""
Set the specified point at the given index in the specified group.
@param groupIndex is the index of the group
@param indexInGroup is the index of the ponit in the group (0 for the
first point of the group...).
@param point is the new value.
@param canonize indicates if the function {@link #canonize(int)} must be called.
@return <code>true</code> if the point was set, <code>false</code> if
the specified coordinates correspond to the already existing point.
@throws IndexOutOfBoundsException in case of error.
"""
return setPointAt(groupIndex, indexInGroup, point.getX(), point.getY(), canonize);
} | java | public final boolean setPointAt(int groupIndex, int indexInGroup, Point2D<?, ?> point, boolean canonize) {
return setPointAt(groupIndex, indexInGroup, point.getX(), point.getY(), canonize);
} | [
"public",
"final",
"boolean",
"setPointAt",
"(",
"int",
"groupIndex",
",",
"int",
"indexInGroup",
",",
"Point2D",
"<",
"?",
",",
"?",
">",
"point",
",",
"boolean",
"canonize",
")",
"{",
"return",
"setPointAt",
"(",
"groupIndex",
",",
"indexInGroup",
",",
"point",
".",
"getX",
"(",
")",
",",
"point",
".",
"getY",
"(",
")",
",",
"canonize",
")",
";",
"}"
] | Set the specified point at the given index in the specified group.
@param groupIndex is the index of the group
@param indexInGroup is the index of the ponit in the group (0 for the
first point of the group...).
@param point is the new value.
@param canonize indicates if the function {@link #canonize(int)} must be called.
@return <code>true</code> if the point was set, <code>false</code> if
the specified coordinates correspond to the already existing point.
@throws IndexOutOfBoundsException in case of error. | [
"Set",
"the",
"specified",
"point",
"at",
"the",
"given",
"index",
"in",
"the",
"specified",
"group",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/mapelement/MapComposedElement.java#L1081-L1083 |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.feature.core/src/com/ibm/ws/kernel/feature/internal/HashUtils.java | HashUtils.getFileSHA256String | public static String getFileSHA256String(File file) throws IOException {
"""
Calculate SHA-256 hash of a File
@param file - the File to hash
@return the SHA-256 hash value
@throws IOException
"""
MessageDigest messageDigest = getMessageDigest(SHA256);
return getFileHashString(file, messageDigest);
} | java | public static String getFileSHA256String(File file) throws IOException {
MessageDigest messageDigest = getMessageDigest(SHA256);
return getFileHashString(file, messageDigest);
} | [
"public",
"static",
"String",
"getFileSHA256String",
"(",
"File",
"file",
")",
"throws",
"IOException",
"{",
"MessageDigest",
"messageDigest",
"=",
"getMessageDigest",
"(",
"SHA256",
")",
";",
"return",
"getFileHashString",
"(",
"file",
",",
"messageDigest",
")",
";",
"}"
] | Calculate SHA-256 hash of a File
@param file - the File to hash
@return the SHA-256 hash value
@throws IOException | [
"Calculate",
"SHA",
"-",
"256",
"hash",
"of",
"a",
"File"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.feature.core/src/com/ibm/ws/kernel/feature/internal/HashUtils.java#L70-L73 |
powermock/powermock | powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java | WhiteboxImpl.invokeConstructor | public static <T> T invokeConstructor(Class<T> classThatContainsTheConstructorToTest, Class<?>[] parameterTypes,
Object[] arguments) throws Exception {
"""
Invoke a constructor. Useful for testing classes with a private
constructor when PowerMock cannot determine which constructor to invoke.
This only happens if you have two constructors with the same number of
arguments where one is using primitive data types and the other is using
the wrapped counter part. For example:
<pre>
public class MyClass {
private MyClass(Integer i) {
...
}
private MyClass(int i) {
...
}
</pre>
This ought to be a really rare case. So for most situation, use
@param <T> the generic type
@param classThatContainsTheConstructorToTest the class that contains the constructor to test
@param parameterTypes the parameter types
@param arguments the arguments
@return The object created after the constructor has been invoked.
@throws Exception If an exception occur when invoking the constructor.
{@link #invokeConstructor(Class, Object...)} instead.
"""
if (parameterTypes != null && arguments != null) {
if (parameterTypes.length != arguments.length) {
throw new IllegalArgumentException("parameterTypes and arguments must have the same length");
}
}
Constructor<T> constructor = null;
try {
constructor = classThatContainsTheConstructorToTest.getDeclaredConstructor(parameterTypes);
} catch (Exception e) {
throw new ConstructorNotFoundException("Could not lookup the constructor", e);
}
return createInstance(constructor, arguments);
} | java | public static <T> T invokeConstructor(Class<T> classThatContainsTheConstructorToTest, Class<?>[] parameterTypes,
Object[] arguments) throws Exception {
if (parameterTypes != null && arguments != null) {
if (parameterTypes.length != arguments.length) {
throw new IllegalArgumentException("parameterTypes and arguments must have the same length");
}
}
Constructor<T> constructor = null;
try {
constructor = classThatContainsTheConstructorToTest.getDeclaredConstructor(parameterTypes);
} catch (Exception e) {
throw new ConstructorNotFoundException("Could not lookup the constructor", e);
}
return createInstance(constructor, arguments);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"invokeConstructor",
"(",
"Class",
"<",
"T",
">",
"classThatContainsTheConstructorToTest",
",",
"Class",
"<",
"?",
">",
"[",
"]",
"parameterTypes",
",",
"Object",
"[",
"]",
"arguments",
")",
"throws",
"Exception",
"{",
"if",
"(",
"parameterTypes",
"!=",
"null",
"&&",
"arguments",
"!=",
"null",
")",
"{",
"if",
"(",
"parameterTypes",
".",
"length",
"!=",
"arguments",
".",
"length",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"parameterTypes and arguments must have the same length\"",
")",
";",
"}",
"}",
"Constructor",
"<",
"T",
">",
"constructor",
"=",
"null",
";",
"try",
"{",
"constructor",
"=",
"classThatContainsTheConstructorToTest",
".",
"getDeclaredConstructor",
"(",
"parameterTypes",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"ConstructorNotFoundException",
"(",
"\"Could not lookup the constructor\"",
",",
"e",
")",
";",
"}",
"return",
"createInstance",
"(",
"constructor",
",",
"arguments",
")",
";",
"}"
] | Invoke a constructor. Useful for testing classes with a private
constructor when PowerMock cannot determine which constructor to invoke.
This only happens if you have two constructors with the same number of
arguments where one is using primitive data types and the other is using
the wrapped counter part. For example:
<pre>
public class MyClass {
private MyClass(Integer i) {
...
}
private MyClass(int i) {
...
}
</pre>
This ought to be a really rare case. So for most situation, use
@param <T> the generic type
@param classThatContainsTheConstructorToTest the class that contains the constructor to test
@param parameterTypes the parameter types
@param arguments the arguments
@return The object created after the constructor has been invoked.
@throws Exception If an exception occur when invoking the constructor.
{@link #invokeConstructor(Class, Object...)} instead. | [
"Invoke",
"a",
"constructor",
".",
"Useful",
"for",
"testing",
"classes",
"with",
"a",
"private",
"constructor",
"when",
"PowerMock",
"cannot",
"determine",
"which",
"constructor",
"to",
"invoke",
".",
"This",
"only",
"happens",
"if",
"you",
"have",
"two",
"constructors",
"with",
"the",
"same",
"number",
"of",
"arguments",
"where",
"one",
"is",
"using",
"primitive",
"data",
"types",
"and",
"the",
"other",
"is",
"using",
"the",
"wrapped",
"counter",
"part",
".",
"For",
"example",
":"
] | train | https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java#L1247-L1263 |
google/error-prone-javac | src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/AbstractDoclet.java | AbstractDoclet.generateClassFiles | protected void generateClassFiles(DocletEnvironment docEnv, ClassTree classtree)
throws DocletException {
"""
Iterate through all classes and construct documentation for them.
@param docEnv the DocletEnvironment
@param classtree the data structure representing the class tree
@throws DocletException if there is a problem while generating the documentation
"""
generateClassFiles(classtree);
SortedSet<PackageElement> packages = new TreeSet<>(utils.makePackageComparator());
packages.addAll(configuration.getSpecifiedPackageElements());
configuration.modulePackages.values().stream().forEach(packages::addAll);
for (PackageElement pkg : packages) {
generateClassFiles(utils.getAllClasses(pkg), classtree);
}
} | java | protected void generateClassFiles(DocletEnvironment docEnv, ClassTree classtree)
throws DocletException {
generateClassFiles(classtree);
SortedSet<PackageElement> packages = new TreeSet<>(utils.makePackageComparator());
packages.addAll(configuration.getSpecifiedPackageElements());
configuration.modulePackages.values().stream().forEach(packages::addAll);
for (PackageElement pkg : packages) {
generateClassFiles(utils.getAllClasses(pkg), classtree);
}
} | [
"protected",
"void",
"generateClassFiles",
"(",
"DocletEnvironment",
"docEnv",
",",
"ClassTree",
"classtree",
")",
"throws",
"DocletException",
"{",
"generateClassFiles",
"(",
"classtree",
")",
";",
"SortedSet",
"<",
"PackageElement",
">",
"packages",
"=",
"new",
"TreeSet",
"<>",
"(",
"utils",
".",
"makePackageComparator",
"(",
")",
")",
";",
"packages",
".",
"addAll",
"(",
"configuration",
".",
"getSpecifiedPackageElements",
"(",
")",
")",
";",
"configuration",
".",
"modulePackages",
".",
"values",
"(",
")",
".",
"stream",
"(",
")",
".",
"forEach",
"(",
"packages",
"::",
"addAll",
")",
";",
"for",
"(",
"PackageElement",
"pkg",
":",
"packages",
")",
"{",
"generateClassFiles",
"(",
"utils",
".",
"getAllClasses",
"(",
"pkg",
")",
",",
"classtree",
")",
";",
"}",
"}"
] | Iterate through all classes and construct documentation for them.
@param docEnv the DocletEnvironment
@param classtree the data structure representing the class tree
@throws DocletException if there is a problem while generating the documentation | [
"Iterate",
"through",
"all",
"classes",
"and",
"construct",
"documentation",
"for",
"them",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/AbstractDoclet.java#L266-L275 |
WorldwideAntimalarialResistanceNetwork/WWARN-Maps-Surveyor | SurveyorCore/src/main/java/org/wwarn/surveyor/client/core/FilterQuery.java | FilterQuery.addMultipleValuesFilter | public void addMultipleValuesFilter(String field, Set<String> valueToFilter) {
"""
add a filter with multiple values to build FilterQuery instance
@param field
@param valueToFilter
"""
if(!valueToFilter.isEmpty()){
filterQueries.put(field, new FilterFieldValue(field, valueToFilter));
}
} | java | public void addMultipleValuesFilter(String field, Set<String> valueToFilter){
if(!valueToFilter.isEmpty()){
filterQueries.put(field, new FilterFieldValue(field, valueToFilter));
}
} | [
"public",
"void",
"addMultipleValuesFilter",
"(",
"String",
"field",
",",
"Set",
"<",
"String",
">",
"valueToFilter",
")",
"{",
"if",
"(",
"!",
"valueToFilter",
".",
"isEmpty",
"(",
")",
")",
"{",
"filterQueries",
".",
"put",
"(",
"field",
",",
"new",
"FilterFieldValue",
"(",
"field",
",",
"valueToFilter",
")",
")",
";",
"}",
"}"
] | add a filter with multiple values to build FilterQuery instance
@param field
@param valueToFilter | [
"add",
"a",
"filter",
"with",
"multiple",
"values",
"to",
"build",
"FilterQuery",
"instance"
] | train | https://github.com/WorldwideAntimalarialResistanceNetwork/WWARN-Maps-Surveyor/blob/224280bcd6e8045bda6b673584caf0aea5e4c841/SurveyorCore/src/main/java/org/wwarn/surveyor/client/core/FilterQuery.java#L105-L109 |
paypal/SeLion | client/src/main/java/com/paypal/selion/reports/services/ReporterConfigMetadata.java | ReporterConfigMetadata.addReporterMetadataItem | public static void addReporterMetadataItem(String key, String itemType, String value) {
"""
Adds an new item to the reporter metadata.
@param key
- A {@link String} that represents the property name contained in JsonRuntimeReporter file.
@param itemType
- A {@link String} that represents the (supported) type of metadata.
@param value
- A {@link String} that represents the reader friendly value to be displayed in the SeLion HTML
Reports.
"""
logger.entering(new Object[] { key, itemType, value });
if (StringUtils.isNotBlank(value) && supportedMetaDataProperties.contains(itemType)) {
Map<String, String> subMap = reporterMetadata.get(key);
if (null == subMap) {
subMap = new HashMap<String, String>();
}
subMap.put(itemType, value);
reporterMetadata.put(key, subMap);
} else {
String message = "Key/value pair for '" + key + "' for '" + itemType
+ "' was not inserted into report metadata.";
logger.fine(message);
}
} | java | public static void addReporterMetadataItem(String key, String itemType, String value) {
logger.entering(new Object[] { key, itemType, value });
if (StringUtils.isNotBlank(value) && supportedMetaDataProperties.contains(itemType)) {
Map<String, String> subMap = reporterMetadata.get(key);
if (null == subMap) {
subMap = new HashMap<String, String>();
}
subMap.put(itemType, value);
reporterMetadata.put(key, subMap);
} else {
String message = "Key/value pair for '" + key + "' for '" + itemType
+ "' was not inserted into report metadata.";
logger.fine(message);
}
} | [
"public",
"static",
"void",
"addReporterMetadataItem",
"(",
"String",
"key",
",",
"String",
"itemType",
",",
"String",
"value",
")",
"{",
"logger",
".",
"entering",
"(",
"new",
"Object",
"[",
"]",
"{",
"key",
",",
"itemType",
",",
"value",
"}",
")",
";",
"if",
"(",
"StringUtils",
".",
"isNotBlank",
"(",
"value",
")",
"&&",
"supportedMetaDataProperties",
".",
"contains",
"(",
"itemType",
")",
")",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"subMap",
"=",
"reporterMetadata",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"null",
"==",
"subMap",
")",
"{",
"subMap",
"=",
"new",
"HashMap",
"<",
"String",
",",
"String",
">",
"(",
")",
";",
"}",
"subMap",
".",
"put",
"(",
"itemType",
",",
"value",
")",
";",
"reporterMetadata",
".",
"put",
"(",
"key",
",",
"subMap",
")",
";",
"}",
"else",
"{",
"String",
"message",
"=",
"\"Key/value pair for '\"",
"+",
"key",
"+",
"\"' for '\"",
"+",
"itemType",
"+",
"\"' was not inserted into report metadata.\"",
";",
"logger",
".",
"fine",
"(",
"message",
")",
";",
"}",
"}"
] | Adds an new item to the reporter metadata.
@param key
- A {@link String} that represents the property name contained in JsonRuntimeReporter file.
@param itemType
- A {@link String} that represents the (supported) type of metadata.
@param value
- A {@link String} that represents the reader friendly value to be displayed in the SeLion HTML
Reports. | [
"Adds",
"an",
"new",
"item",
"to",
"the",
"reporter",
"metadata",
"."
] | train | https://github.com/paypal/SeLion/blob/694d12d0df76db48d0360b16192770c6a4fbdfd2/client/src/main/java/com/paypal/selion/reports/services/ReporterConfigMetadata.java#L68-L83 |
google/error-prone | check_api/src/main/java/com/google/errorprone/util/ASTHelpers.java | ASTHelpers.findSuperMethod | public static Optional<MethodSymbol> findSuperMethod(MethodSymbol methodSymbol, Types types) {
"""
Finds (if it exists) first (in the class hierarchy) non-interface super method of given {@code
method}.
"""
return findSuperMethods(methodSymbol, types, /* skipInterfaces= */ true).findFirst();
} | java | public static Optional<MethodSymbol> findSuperMethod(MethodSymbol methodSymbol, Types types) {
return findSuperMethods(methodSymbol, types, /* skipInterfaces= */ true).findFirst();
} | [
"public",
"static",
"Optional",
"<",
"MethodSymbol",
">",
"findSuperMethod",
"(",
"MethodSymbol",
"methodSymbol",
",",
"Types",
"types",
")",
"{",
"return",
"findSuperMethods",
"(",
"methodSymbol",
",",
"types",
",",
"/* skipInterfaces= */",
"true",
")",
".",
"findFirst",
"(",
")",
";",
"}"
] | Finds (if it exists) first (in the class hierarchy) non-interface super method of given {@code
method}. | [
"Finds",
"(",
"if",
"it",
"exists",
")",
"first",
"(",
"in",
"the",
"class",
"hierarchy",
")",
"non",
"-",
"interface",
"super",
"method",
"of",
"given",
"{"
] | train | https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/check_api/src/main/java/com/google/errorprone/util/ASTHelpers.java#L584-L586 |
apache/groovy | src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java | DefaultGroovyMethods.retainAll | public static <T> boolean retainAll(Collection<T> self, @ClosureParams(FirstParam.FirstGenericType.class) Closure condition) {
"""
Modifies this collection so that it retains only its elements
that are matched according to the specified closure condition. In other words,
removes from this collection all of its elements that don't match.
<pre class="groovyTestCase">def list = ['a', 'b']
list.retainAll { it == 'b' }
assert list == ['b']</pre>
See also <code>findAll</code> and <code>grep</code> when wanting to produce a new list
containing items which match some criteria but leaving the original collection unchanged.
@param self a Collection to be modified
@param condition a closure condition
@return <tt>true</tt> if this collection changed as a result of the call
@see Iterator#remove()
@since 1.7.2
"""
Iterator iter = InvokerHelper.asIterator(self);
BooleanClosureWrapper bcw = new BooleanClosureWrapper(condition);
boolean result = false;
while (iter.hasNext()) {
Object value = iter.next();
if (!bcw.call(value)) {
iter.remove();
result = true;
}
}
return result;
} | java | public static <T> boolean retainAll(Collection<T> self, @ClosureParams(FirstParam.FirstGenericType.class) Closure condition) {
Iterator iter = InvokerHelper.asIterator(self);
BooleanClosureWrapper bcw = new BooleanClosureWrapper(condition);
boolean result = false;
while (iter.hasNext()) {
Object value = iter.next();
if (!bcw.call(value)) {
iter.remove();
result = true;
}
}
return result;
} | [
"public",
"static",
"<",
"T",
">",
"boolean",
"retainAll",
"(",
"Collection",
"<",
"T",
">",
"self",
",",
"@",
"ClosureParams",
"(",
"FirstParam",
".",
"FirstGenericType",
".",
"class",
")",
"Closure",
"condition",
")",
"{",
"Iterator",
"iter",
"=",
"InvokerHelper",
".",
"asIterator",
"(",
"self",
")",
";",
"BooleanClosureWrapper",
"bcw",
"=",
"new",
"BooleanClosureWrapper",
"(",
"condition",
")",
";",
"boolean",
"result",
"=",
"false",
";",
"while",
"(",
"iter",
".",
"hasNext",
"(",
")",
")",
"{",
"Object",
"value",
"=",
"iter",
".",
"next",
"(",
")",
";",
"if",
"(",
"!",
"bcw",
".",
"call",
"(",
"value",
")",
")",
"{",
"iter",
".",
"remove",
"(",
")",
";",
"result",
"=",
"true",
";",
"}",
"}",
"return",
"result",
";",
"}"
] | Modifies this collection so that it retains only its elements
that are matched according to the specified closure condition. In other words,
removes from this collection all of its elements that don't match.
<pre class="groovyTestCase">def list = ['a', 'b']
list.retainAll { it == 'b' }
assert list == ['b']</pre>
See also <code>findAll</code> and <code>grep</code> when wanting to produce a new list
containing items which match some criteria but leaving the original collection unchanged.
@param self a Collection to be modified
@param condition a closure condition
@return <tt>true</tt> if this collection changed as a result of the call
@see Iterator#remove()
@since 1.7.2 | [
"Modifies",
"this",
"collection",
"so",
"that",
"it",
"retains",
"only",
"its",
"elements",
"that",
"are",
"matched",
"according",
"to",
"the",
"specified",
"closure",
"condition",
".",
"In",
"other",
"words",
"removes",
"from",
"this",
"collection",
"all",
"of",
"its",
"elements",
"that",
"don",
"t",
"match",
"."
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L5012-L5024 |
enioka/jqm | jqm-all/jqm-model/src/main/java/com/enioka/jqm/jdbc/DbAdapter.java | DbAdapter.prepare | public void prepare(Properties p, Connection cnx) {
"""
Called after creating the first connection. The adapter should create its caches and do all initialization it requires. Most
importantly, the SQL query cache should be created.
@param cnx
an open ready to use connection to the database.
"""
this.tablePrefix = p.getProperty("com.enioka.jqm.jdbc.tablePrefix", "");
queries.putAll(DbImplBase.queries);
for (Map.Entry<String, String> entry : DbImplBase.queries.entrySet())
{
queries.put(entry.getKey(), this.adaptSql(entry.getValue()));
}
} | java | public void prepare(Properties p, Connection cnx)
{
this.tablePrefix = p.getProperty("com.enioka.jqm.jdbc.tablePrefix", "");
queries.putAll(DbImplBase.queries);
for (Map.Entry<String, String> entry : DbImplBase.queries.entrySet())
{
queries.put(entry.getKey(), this.adaptSql(entry.getValue()));
}
} | [
"public",
"void",
"prepare",
"(",
"Properties",
"p",
",",
"Connection",
"cnx",
")",
"{",
"this",
".",
"tablePrefix",
"=",
"p",
".",
"getProperty",
"(",
"\"com.enioka.jqm.jdbc.tablePrefix\"",
",",
"\"\"",
")",
";",
"queries",
".",
"putAll",
"(",
"DbImplBase",
".",
"queries",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"String",
">",
"entry",
":",
"DbImplBase",
".",
"queries",
".",
"entrySet",
"(",
")",
")",
"{",
"queries",
".",
"put",
"(",
"entry",
".",
"getKey",
"(",
")",
",",
"this",
".",
"adaptSql",
"(",
"entry",
".",
"getValue",
"(",
")",
")",
")",
";",
"}",
"}"
] | Called after creating the first connection. The adapter should create its caches and do all initialization it requires. Most
importantly, the SQL query cache should be created.
@param cnx
an open ready to use connection to the database. | [
"Called",
"after",
"creating",
"the",
"first",
"connection",
".",
"The",
"adapter",
"should",
"create",
"its",
"caches",
"and",
"do",
"all",
"initialization",
"it",
"requires",
".",
"Most",
"importantly",
"the",
"SQL",
"query",
"cache",
"should",
"be",
"created",
"."
] | train | https://github.com/enioka/jqm/blob/391733b8e291404b97c714c3727a241c4a861f98/jqm-all/jqm-model/src/main/java/com/enioka/jqm/jdbc/DbAdapter.java#L94-L102 |
wso2/transport-http | components/org.wso2.transport.http.netty/src/main/java/org/wso2/transport/http/netty/contractimpl/sender/http2/Http2ConnectionManager.java | Http2ConnectionManager.getOrCreatePerRoutePool | private EventLoopPool.PerRouteConnectionPool getOrCreatePerRoutePool(EventLoopPool eventLoopPool, String key) {
"""
Get or creat the per route pool.
@param eventLoopPool the pool that is bound to the eventloop
@param key the route key
@return PerRouteConnectionPool
"""
final EventLoopPool.PerRouteConnectionPool perRouteConnectionPool = eventLoopPool.fetchPerRoutePool(key);
if (perRouteConnectionPool != null) {
return perRouteConnectionPool;
}
return eventLoopPool.getPerRouteConnectionPools().computeIfAbsent(key,
p -> new EventLoopPool.PerRouteConnectionPool(
poolConfiguration
.getHttp2MaxActiveStreamsPerConnection()));
} | java | private EventLoopPool.PerRouteConnectionPool getOrCreatePerRoutePool(EventLoopPool eventLoopPool, String key) {
final EventLoopPool.PerRouteConnectionPool perRouteConnectionPool = eventLoopPool.fetchPerRoutePool(key);
if (perRouteConnectionPool != null) {
return perRouteConnectionPool;
}
return eventLoopPool.getPerRouteConnectionPools().computeIfAbsent(key,
p -> new EventLoopPool.PerRouteConnectionPool(
poolConfiguration
.getHttp2MaxActiveStreamsPerConnection()));
} | [
"private",
"EventLoopPool",
".",
"PerRouteConnectionPool",
"getOrCreatePerRoutePool",
"(",
"EventLoopPool",
"eventLoopPool",
",",
"String",
"key",
")",
"{",
"final",
"EventLoopPool",
".",
"PerRouteConnectionPool",
"perRouteConnectionPool",
"=",
"eventLoopPool",
".",
"fetchPerRoutePool",
"(",
"key",
")",
";",
"if",
"(",
"perRouteConnectionPool",
"!=",
"null",
")",
"{",
"return",
"perRouteConnectionPool",
";",
"}",
"return",
"eventLoopPool",
".",
"getPerRouteConnectionPools",
"(",
")",
".",
"computeIfAbsent",
"(",
"key",
",",
"p",
"->",
"new",
"EventLoopPool",
".",
"PerRouteConnectionPool",
"(",
"poolConfiguration",
".",
"getHttp2MaxActiveStreamsPerConnection",
"(",
")",
")",
")",
";",
"}"
] | Get or creat the per route pool.
@param eventLoopPool the pool that is bound to the eventloop
@param key the route key
@return PerRouteConnectionPool | [
"Get",
"or",
"creat",
"the",
"per",
"route",
"pool",
"."
] | train | https://github.com/wso2/transport-http/blob/c51aa715b473db6c1b82a7d7b22f6e65f74df4c9/components/org.wso2.transport.http.netty/src/main/java/org/wso2/transport/http/netty/contractimpl/sender/http2/Http2ConnectionManager.java#L93-L102 |
vatbub/common | updater/src/main/java/com/github/vatbub/common/updater/UpdateChecker.java | UpdateChecker.downloadAndInstallUpdate | public static boolean downloadAndInstallUpdate(UpdateInfo updateToInstall, UpdateProgressDialog gui, String... params)
throws IllegalStateException, IOException {
"""
Downloads the specified update as a jar-file and launches it. The jar
file will be saved at the same location as the currently executed file
but will not replace it (unless it has the same filename but this will
never happen). The old app file will be deleted once the updated one is
launched. <b>Please note</b> that the file can't delete itself on some
operating systems. Therefore, the deletion is done by the updated file.
To actually delete the file, you need to call
{@link #completeUpdate(String[])} in your applications main method.
@param updateToInstall The {@link UpdateInfo}-object that contains the information
about the update to download
@param gui The reference to an {@link UpdateProgressDialog} that displays
the current update status.
@param params Additional commandline parameters to be submitted to the new application version.
@return {@code true} if the download finished successfully, {@code false}
if the download was cancelled using
{@link #cancelDownloadAndLaunch()}
@throws IllegalStateException if maven fails to download or copy the new artifact.
@throws IOException If the updated artifact cannot be launched.
@see #completeUpdate(String[])
"""
return downloadAndInstallUpdate(updateToInstall, gui, true, params);
} | java | public static boolean downloadAndInstallUpdate(UpdateInfo updateToInstall, UpdateProgressDialog gui, String... params)
throws IllegalStateException, IOException {
return downloadAndInstallUpdate(updateToInstall, gui, true, params);
} | [
"public",
"static",
"boolean",
"downloadAndInstallUpdate",
"(",
"UpdateInfo",
"updateToInstall",
",",
"UpdateProgressDialog",
"gui",
",",
"String",
"...",
"params",
")",
"throws",
"IllegalStateException",
",",
"IOException",
"{",
"return",
"downloadAndInstallUpdate",
"(",
"updateToInstall",
",",
"gui",
",",
"true",
",",
"params",
")",
";",
"}"
] | Downloads the specified update as a jar-file and launches it. The jar
file will be saved at the same location as the currently executed file
but will not replace it (unless it has the same filename but this will
never happen). The old app file will be deleted once the updated one is
launched. <b>Please note</b> that the file can't delete itself on some
operating systems. Therefore, the deletion is done by the updated file.
To actually delete the file, you need to call
{@link #completeUpdate(String[])} in your applications main method.
@param updateToInstall The {@link UpdateInfo}-object that contains the information
about the update to download
@param gui The reference to an {@link UpdateProgressDialog} that displays
the current update status.
@param params Additional commandline parameters to be submitted to the new application version.
@return {@code true} if the download finished successfully, {@code false}
if the download was cancelled using
{@link #cancelDownloadAndLaunch()}
@throws IllegalStateException if maven fails to download or copy the new artifact.
@throws IOException If the updated artifact cannot be launched.
@see #completeUpdate(String[]) | [
"Downloads",
"the",
"specified",
"update",
"as",
"a",
"jar",
"-",
"file",
"and",
"launches",
"it",
".",
"The",
"jar",
"file",
"will",
"be",
"saved",
"at",
"the",
"same",
"location",
"as",
"the",
"currently",
"executed",
"file",
"but",
"will",
"not",
"replace",
"it",
"(",
"unless",
"it",
"has",
"the",
"same",
"filename",
"but",
"this",
"will",
"never",
"happen",
")",
".",
"The",
"old",
"app",
"file",
"will",
"be",
"deleted",
"once",
"the",
"updated",
"one",
"is",
"launched",
".",
"<b",
">",
"Please",
"note<",
"/",
"b",
">",
"that",
"the",
"file",
"can",
"t",
"delete",
"itself",
"on",
"some",
"operating",
"systems",
".",
"Therefore",
"the",
"deletion",
"is",
"done",
"by",
"the",
"updated",
"file",
".",
"To",
"actually",
"delete",
"the",
"file",
"you",
"need",
"to",
"call",
"{",
"@link",
"#completeUpdate",
"(",
"String",
"[]",
")",
"}",
"in",
"your",
"applications",
"main",
"method",
"."
] | train | https://github.com/vatbub/common/blob/8b9fd2ece0a23d520ce53b66c84cbd094e378443/updater/src/main/java/com/github/vatbub/common/updater/UpdateChecker.java#L423-L426 |
MenoData/Time4J | base/src/main/java/net/time4j/range/DateInterval.java | DateInterval.toFullDays | public TimestampInterval toFullDays() {
"""
/*[deutsch]
<p>Wandelt diese Instanz in ein Zeitstempelintervall
mit Datumswerten von Mitternacht zu Mitternacht um. </p>
<p>Das Ergebnisintervall ist halb-offen, wenn dieses Intervall
endlich ist. </p>
@return timestamp interval (from midnight to midnight)
@since 2.0
"""
Boundary<PlainTimestamp> b1;
Boundary<PlainTimestamp> b2;
if (this.getStart().isInfinite()) {
b1 = Boundary.infinitePast();
} else {
PlainDate d1 = this.getStart().getTemporal();
PlainTimestamp t1;
if (this.getStart().isOpen()) {
t1 = d1.at(PlainTime.midnightAtEndOfDay());
} else {
t1 = d1.atStartOfDay();
}
b1 = Boundary.of(IntervalEdge.CLOSED, t1);
}
if (this.getEnd().isInfinite()) {
b2 = Boundary.infiniteFuture();
} else {
PlainDate d2 = this.getEnd().getTemporal();
PlainTimestamp t2;
if (this.getEnd().isOpen()) {
t2 = d2.atStartOfDay();
} else {
t2 = d2.at(PlainTime.midnightAtEndOfDay());
}
b2 = Boundary.of(IntervalEdge.OPEN, t2);
}
return new TimestampInterval(b1, b2);
} | java | public TimestampInterval toFullDays() {
Boundary<PlainTimestamp> b1;
Boundary<PlainTimestamp> b2;
if (this.getStart().isInfinite()) {
b1 = Boundary.infinitePast();
} else {
PlainDate d1 = this.getStart().getTemporal();
PlainTimestamp t1;
if (this.getStart().isOpen()) {
t1 = d1.at(PlainTime.midnightAtEndOfDay());
} else {
t1 = d1.atStartOfDay();
}
b1 = Boundary.of(IntervalEdge.CLOSED, t1);
}
if (this.getEnd().isInfinite()) {
b2 = Boundary.infiniteFuture();
} else {
PlainDate d2 = this.getEnd().getTemporal();
PlainTimestamp t2;
if (this.getEnd().isOpen()) {
t2 = d2.atStartOfDay();
} else {
t2 = d2.at(PlainTime.midnightAtEndOfDay());
}
b2 = Boundary.of(IntervalEdge.OPEN, t2);
}
return new TimestampInterval(b1, b2);
} | [
"public",
"TimestampInterval",
"toFullDays",
"(",
")",
"{",
"Boundary",
"<",
"PlainTimestamp",
">",
"b1",
";",
"Boundary",
"<",
"PlainTimestamp",
">",
"b2",
";",
"if",
"(",
"this",
".",
"getStart",
"(",
")",
".",
"isInfinite",
"(",
")",
")",
"{",
"b1",
"=",
"Boundary",
".",
"infinitePast",
"(",
")",
";",
"}",
"else",
"{",
"PlainDate",
"d1",
"=",
"this",
".",
"getStart",
"(",
")",
".",
"getTemporal",
"(",
")",
";",
"PlainTimestamp",
"t1",
";",
"if",
"(",
"this",
".",
"getStart",
"(",
")",
".",
"isOpen",
"(",
")",
")",
"{",
"t1",
"=",
"d1",
".",
"at",
"(",
"PlainTime",
".",
"midnightAtEndOfDay",
"(",
")",
")",
";",
"}",
"else",
"{",
"t1",
"=",
"d1",
".",
"atStartOfDay",
"(",
")",
";",
"}",
"b1",
"=",
"Boundary",
".",
"of",
"(",
"IntervalEdge",
".",
"CLOSED",
",",
"t1",
")",
";",
"}",
"if",
"(",
"this",
".",
"getEnd",
"(",
")",
".",
"isInfinite",
"(",
")",
")",
"{",
"b2",
"=",
"Boundary",
".",
"infiniteFuture",
"(",
")",
";",
"}",
"else",
"{",
"PlainDate",
"d2",
"=",
"this",
".",
"getEnd",
"(",
")",
".",
"getTemporal",
"(",
")",
";",
"PlainTimestamp",
"t2",
";",
"if",
"(",
"this",
".",
"getEnd",
"(",
")",
".",
"isOpen",
"(",
")",
")",
"{",
"t2",
"=",
"d2",
".",
"atStartOfDay",
"(",
")",
";",
"}",
"else",
"{",
"t2",
"=",
"d2",
".",
"at",
"(",
"PlainTime",
".",
"midnightAtEndOfDay",
"(",
")",
")",
";",
"}",
"b2",
"=",
"Boundary",
".",
"of",
"(",
"IntervalEdge",
".",
"OPEN",
",",
"t2",
")",
";",
"}",
"return",
"new",
"TimestampInterval",
"(",
"b1",
",",
"b2",
")",
";",
"}"
] | /*[deutsch]
<p>Wandelt diese Instanz in ein Zeitstempelintervall
mit Datumswerten von Mitternacht zu Mitternacht um. </p>
<p>Das Ergebnisintervall ist halb-offen, wenn dieses Intervall
endlich ist. </p>
@return timestamp interval (from midnight to midnight)
@since 2.0 | [
"/",
"*",
"[",
"deutsch",
"]",
"<p",
">",
"Wandelt",
"diese",
"Instanz",
"in",
"ein",
"Zeitstempelintervall",
"mit",
"Datumswerten",
"von",
"Mitternacht",
"zu",
"Mitternacht",
"um",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/MenoData/Time4J/blob/08b2eda6b2dbb140b92011cf7071bb087edd46a5/base/src/main/java/net/time4j/range/DateInterval.java#L535-L568 |
nguillaumin/slick2d-maven | slick2d-core/src/main/java/org/newdawn/slick/geom/Line.java | Line.set | public void set(float sx, float sy, float ex, float ey) {
"""
Configure the line without garbage
@param sx
The x coordinate of the start
@param sy
The y coordinate of the start
@param ex
The x coordiante of the end
@param ey
The y coordinate of the end
"""
super.pointsDirty = true;
start.set(sx, sy);
end.set(ex, ey);
float dx = (ex - sx);
float dy = (ey - sy);
vec.set(dx,dy);
lenSquared = (dx * dx) + (dy * dy);
} | java | public void set(float sx, float sy, float ex, float ey) {
super.pointsDirty = true;
start.set(sx, sy);
end.set(ex, ey);
float dx = (ex - sx);
float dy = (ey - sy);
vec.set(dx,dy);
lenSquared = (dx * dx) + (dy * dy);
} | [
"public",
"void",
"set",
"(",
"float",
"sx",
",",
"float",
"sy",
",",
"float",
"ex",
",",
"float",
"ey",
")",
"{",
"super",
".",
"pointsDirty",
"=",
"true",
";",
"start",
".",
"set",
"(",
"sx",
",",
"sy",
")",
";",
"end",
".",
"set",
"(",
"ex",
",",
"ey",
")",
";",
"float",
"dx",
"=",
"(",
"ex",
"-",
"sx",
")",
";",
"float",
"dy",
"=",
"(",
"ey",
"-",
"sy",
")",
";",
"vec",
".",
"set",
"(",
"dx",
",",
"dy",
")",
";",
"lenSquared",
"=",
"(",
"dx",
"*",
"dx",
")",
"+",
"(",
"dy",
"*",
"dy",
")",
";",
"}"
] | Configure the line without garbage
@param sx
The x coordinate of the start
@param sy
The y coordinate of the start
@param ex
The x coordiante of the end
@param ey
The y coordinate of the end | [
"Configure",
"the",
"line",
"without",
"garbage"
] | train | https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/geom/Line.java#L215-L224 |
pip-services3-java/pip-services3-commons-java | src/org/pipservices3/commons/refer/Referencer.java | Referencer.setReferencesForOne | public static void setReferencesForOne(IReferences references, Object component)
throws ReferenceException, ConfigException {
"""
Sets references to specific component.
To set references components must implement IReferenceable interface. If they
don't the call to this method has no effect.
@param references the references to be set.
@param component the component to set references to.
@throws ReferenceException when no references found.
@throws ConfigException when configuration is wrong.
@see IReferenceable
"""
if (component instanceof IReferenceable)
((IReferenceable) component).setReferences(references);
} | java | public static void setReferencesForOne(IReferences references, Object component)
throws ReferenceException, ConfigException {
if (component instanceof IReferenceable)
((IReferenceable) component).setReferences(references);
} | [
"public",
"static",
"void",
"setReferencesForOne",
"(",
"IReferences",
"references",
",",
"Object",
"component",
")",
"throws",
"ReferenceException",
",",
"ConfigException",
"{",
"if",
"(",
"component",
"instanceof",
"IReferenceable",
")",
"(",
"(",
"IReferenceable",
")",
"component",
")",
".",
"setReferences",
"(",
"references",
")",
";",
"}"
] | Sets references to specific component.
To set references components must implement IReferenceable interface. If they
don't the call to this method has no effect.
@param references the references to be set.
@param component the component to set references to.
@throws ReferenceException when no references found.
@throws ConfigException when configuration is wrong.
@see IReferenceable | [
"Sets",
"references",
"to",
"specific",
"component",
"."
] | train | https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/refer/Referencer.java#L25-L30 |
elki-project/elki | addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGUtil.java | SVGUtil.svgElement | public static Element svgElement(Document document, String name) {
"""
Create a SVG element in appropriate namespace
@param document containing document
@param name node name
@return new SVG element.
"""
return document.createElementNS(SVGConstants.SVG_NAMESPACE_URI, name);
} | java | public static Element svgElement(Document document, String name) {
return document.createElementNS(SVGConstants.SVG_NAMESPACE_URI, name);
} | [
"public",
"static",
"Element",
"svgElement",
"(",
"Document",
"document",
",",
"String",
"name",
")",
"{",
"return",
"document",
".",
"createElementNS",
"(",
"SVGConstants",
".",
"SVG_NAMESPACE_URI",
",",
"name",
")",
";",
"}"
] | Create a SVG element in appropriate namespace
@param document containing document
@param name node name
@return new SVG element. | [
"Create",
"a",
"SVG",
"element",
"in",
"appropriate",
"namespace"
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGUtil.java#L283-L285 |
redbox-mint/redbox | plugins/transaction/curation/src/main/java/com/googlecode/fascinator/redbox/plugins/curation/redbox/CurationManager.java | CurationManager.reharvest | private void reharvest(JsonSimple response, JsonSimple message) {
"""
Generate a fairly common list of orders to transform and index an object.
This mirrors the traditional tool chain.
@param message
The response to modify
@param message
The message we received
"""
String oid = message.getString(null, "oid");
try {
if (oid != null) {
setRenderFlag(oid);
// Transformer config
JsonSimple itemConfig = getConfigFromStorage(oid);
if (itemConfig == null) {
log.error("Error accessing item configuration!");
return;
}
itemConfig.getJsonObject().put("oid", oid);
// Tool chain
scheduleTransformers(itemConfig, response);
JsonObject order = newIndex(response, oid);
order.put("forceCommit", true);
createTask(response, oid, "clear-render-flag");
} else {
log.error("Cannot reharvest without an OID!");
}
} catch (Exception ex) {
log.error("Error during reharvest setup: ", ex);
}
} | java | private void reharvest(JsonSimple response, JsonSimple message) {
String oid = message.getString(null, "oid");
try {
if (oid != null) {
setRenderFlag(oid);
// Transformer config
JsonSimple itemConfig = getConfigFromStorage(oid);
if (itemConfig == null) {
log.error("Error accessing item configuration!");
return;
}
itemConfig.getJsonObject().put("oid", oid);
// Tool chain
scheduleTransformers(itemConfig, response);
JsonObject order = newIndex(response, oid);
order.put("forceCommit", true);
createTask(response, oid, "clear-render-flag");
} else {
log.error("Cannot reharvest without an OID!");
}
} catch (Exception ex) {
log.error("Error during reharvest setup: ", ex);
}
} | [
"private",
"void",
"reharvest",
"(",
"JsonSimple",
"response",
",",
"JsonSimple",
"message",
")",
"{",
"String",
"oid",
"=",
"message",
".",
"getString",
"(",
"null",
",",
"\"oid\"",
")",
";",
"try",
"{",
"if",
"(",
"oid",
"!=",
"null",
")",
"{",
"setRenderFlag",
"(",
"oid",
")",
";",
"// Transformer config",
"JsonSimple",
"itemConfig",
"=",
"getConfigFromStorage",
"(",
"oid",
")",
";",
"if",
"(",
"itemConfig",
"==",
"null",
")",
"{",
"log",
".",
"error",
"(",
"\"Error accessing item configuration!\"",
")",
";",
"return",
";",
"}",
"itemConfig",
".",
"getJsonObject",
"(",
")",
".",
"put",
"(",
"\"oid\"",
",",
"oid",
")",
";",
"// Tool chain",
"scheduleTransformers",
"(",
"itemConfig",
",",
"response",
")",
";",
"JsonObject",
"order",
"=",
"newIndex",
"(",
"response",
",",
"oid",
")",
";",
"order",
".",
"put",
"(",
"\"forceCommit\"",
",",
"true",
")",
";",
"createTask",
"(",
"response",
",",
"oid",
",",
"\"clear-render-flag\"",
")",
";",
"}",
"else",
"{",
"log",
".",
"error",
"(",
"\"Cannot reharvest without an OID!\"",
")",
";",
"}",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"log",
".",
"error",
"(",
"\"Error during reharvest setup: \"",
",",
"ex",
")",
";",
"}",
"}"
] | Generate a fairly common list of orders to transform and index an object.
This mirrors the traditional tool chain.
@param message
The response to modify
@param message
The message we received | [
"Generate",
"a",
"fairly",
"common",
"list",
"of",
"orders",
"to",
"transform",
"and",
"index",
"an",
"object",
".",
"This",
"mirrors",
"the",
"traditional",
"tool",
"chain",
"."
] | train | https://github.com/redbox-mint/redbox/blob/1db230f218031b85c48c8603cbb04fce7ac6de0c/plugins/transaction/curation/src/main/java/com/googlecode/fascinator/redbox/plugins/curation/redbox/CurationManager.java#L1526-L1552 |
casmi/casmi | src/main/java/casmi/graphics/Graphics.java | Graphics.setDirectionalLight | public void setDirectionalLight(int i, Color color, boolean enableColor, Vector3D v) {
"""
Sets the color value and the position of the No.i directionalLight
"""
float directionalColor[] = {
(float)color.getRed(),
(float)color.getGreen(),
(float)color.getBlue(),
(float)color.getAlpha()
};
float pos[] = { (float)v.getX(), (float)v.getY(), (float)v.getZ(), 0.0f };
gl.glEnable(GL2.GL_LIGHTING);
gl.glEnable(GL2.GL_LIGHT0 + i);
gl.glLightfv(GL2.GL_LIGHT0 + i, GL2.GL_POSITION, pos, 0);
if(enableColor) gl.glLightfv(GL2.GL_LIGHT0 + i, GL2.GL_DIFFUSE, directionalColor, 0);
} | java | public void setDirectionalLight(int i, Color color, boolean enableColor, Vector3D v) {
float directionalColor[] = {
(float)color.getRed(),
(float)color.getGreen(),
(float)color.getBlue(),
(float)color.getAlpha()
};
float pos[] = { (float)v.getX(), (float)v.getY(), (float)v.getZ(), 0.0f };
gl.glEnable(GL2.GL_LIGHTING);
gl.glEnable(GL2.GL_LIGHT0 + i);
gl.glLightfv(GL2.GL_LIGHT0 + i, GL2.GL_POSITION, pos, 0);
if(enableColor) gl.glLightfv(GL2.GL_LIGHT0 + i, GL2.GL_DIFFUSE, directionalColor, 0);
} | [
"public",
"void",
"setDirectionalLight",
"(",
"int",
"i",
",",
"Color",
"color",
",",
"boolean",
"enableColor",
",",
"Vector3D",
"v",
")",
"{",
"float",
"directionalColor",
"[",
"]",
"=",
"{",
"(",
"float",
")",
"color",
".",
"getRed",
"(",
")",
",",
"(",
"float",
")",
"color",
".",
"getGreen",
"(",
")",
",",
"(",
"float",
")",
"color",
".",
"getBlue",
"(",
")",
",",
"(",
"float",
")",
"color",
".",
"getAlpha",
"(",
")",
"}",
";",
"float",
"pos",
"[",
"]",
"=",
"{",
"(",
"float",
")",
"v",
".",
"getX",
"(",
")",
",",
"(",
"float",
")",
"v",
".",
"getY",
"(",
")",
",",
"(",
"float",
")",
"v",
".",
"getZ",
"(",
")",
",",
"0.0f",
"}",
";",
"gl",
".",
"glEnable",
"(",
"GL2",
".",
"GL_LIGHTING",
")",
";",
"gl",
".",
"glEnable",
"(",
"GL2",
".",
"GL_LIGHT0",
"+",
"i",
")",
";",
"gl",
".",
"glLightfv",
"(",
"GL2",
".",
"GL_LIGHT0",
"+",
"i",
",",
"GL2",
".",
"GL_POSITION",
",",
"pos",
",",
"0",
")",
";",
"if",
"(",
"enableColor",
")",
"gl",
".",
"glLightfv",
"(",
"GL2",
".",
"GL_LIGHT0",
"+",
"i",
",",
"GL2",
".",
"GL_DIFFUSE",
",",
"directionalColor",
",",
"0",
")",
";",
"}"
] | Sets the color value and the position of the No.i directionalLight | [
"Sets",
"the",
"color",
"value",
"and",
"the",
"position",
"of",
"the",
"No",
".",
"i",
"directionalLight"
] | train | https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/graphics/Graphics.java#L528-L540 |
motown-io/motown | operator-api/view-model/src/main/java/io/motown/operatorapi/viewmodel/TransactionEventListener.java | TransactionEventListener.toOperatorApiMeterValue | private io.motown.operatorapi.viewmodel.persistence.entities.MeterValue toOperatorApiMeterValue(MeterValue meterValue) {
"""
Converts the Core API's {@code MeterValue} to an Operator API's {@code MeterValue}.
@param meterValue the Core API {@code MeterValue}.
@return the Operator API {@code MeterValue}.
@throws AssertionError if an unexpected {@code UnitOfMeasure} is encountered.
"""
String value;
switch (meterValue.getUnit()) {
case WATT_HOUR:
value = meterValue.getValue();
break;
case KILOWATT_HOUR:
value = String.valueOf(Float.parseFloat(meterValue.getValue()) * 1000);
break;
default:
throw new AssertionError(String.format("Unexpected value for MeterValue's UnitOfMeasure [%s]", meterValue.getUnit()));
}
return new io.motown.operatorapi.viewmodel.persistence.entities.MeterValue(meterValue.getTimestamp(), value);
} | java | private io.motown.operatorapi.viewmodel.persistence.entities.MeterValue toOperatorApiMeterValue(MeterValue meterValue) {
String value;
switch (meterValue.getUnit()) {
case WATT_HOUR:
value = meterValue.getValue();
break;
case KILOWATT_HOUR:
value = String.valueOf(Float.parseFloat(meterValue.getValue()) * 1000);
break;
default:
throw new AssertionError(String.format("Unexpected value for MeterValue's UnitOfMeasure [%s]", meterValue.getUnit()));
}
return new io.motown.operatorapi.viewmodel.persistence.entities.MeterValue(meterValue.getTimestamp(), value);
} | [
"private",
"io",
".",
"motown",
".",
"operatorapi",
".",
"viewmodel",
".",
"persistence",
".",
"entities",
".",
"MeterValue",
"toOperatorApiMeterValue",
"(",
"MeterValue",
"meterValue",
")",
"{",
"String",
"value",
";",
"switch",
"(",
"meterValue",
".",
"getUnit",
"(",
")",
")",
"{",
"case",
"WATT_HOUR",
":",
"value",
"=",
"meterValue",
".",
"getValue",
"(",
")",
";",
"break",
";",
"case",
"KILOWATT_HOUR",
":",
"value",
"=",
"String",
".",
"valueOf",
"(",
"Float",
".",
"parseFloat",
"(",
"meterValue",
".",
"getValue",
"(",
")",
")",
"*",
"1000",
")",
";",
"break",
";",
"default",
":",
"throw",
"new",
"AssertionError",
"(",
"String",
".",
"format",
"(",
"\"Unexpected value for MeterValue's UnitOfMeasure [%s]\"",
",",
"meterValue",
".",
"getUnit",
"(",
")",
")",
")",
";",
"}",
"return",
"new",
"io",
".",
"motown",
".",
"operatorapi",
".",
"viewmodel",
".",
"persistence",
".",
"entities",
".",
"MeterValue",
"(",
"meterValue",
".",
"getTimestamp",
"(",
")",
",",
"value",
")",
";",
"}"
] | Converts the Core API's {@code MeterValue} to an Operator API's {@code MeterValue}.
@param meterValue the Core API {@code MeterValue}.
@return the Operator API {@code MeterValue}.
@throws AssertionError if an unexpected {@code UnitOfMeasure} is encountered. | [
"Converts",
"the",
"Core",
"API",
"s",
"{",
"@code",
"MeterValue",
"}",
"to",
"an",
"Operator",
"API",
"s",
"{",
"@code",
"MeterValue",
"}",
"."
] | train | https://github.com/motown-io/motown/blob/783ccda7c28b273a529ddd47defe8673b1ea365b/operator-api/view-model/src/main/java/io/motown/operatorapi/viewmodel/TransactionEventListener.java#L123-L138 |
greese/dasein-util | src/main/java/org/dasein/util/ConcurrentMultiCache.java | ConcurrentMultiCache.find | public T find(String key, Object val, CacheLoader<T> loader) {
"""
Seeks the item from the cache that is identified by the specified key having
the specified value. If no match is found, the specified loader will be called to
place an item in the cache. You may pass in <code>null</code> for the loader.
If you do, only an object in active memory will be returned.
@param key the name of the unique identifier attribute whose value you have
@param val the value of the unique identifier that identifiers the desired item
@param loader a loader to load the desired object from the persistence store if it
is not in memory
@return the object that matches the specified key/value
"""
return find(key, val, loader, null, null);
} | java | public T find(String key, Object val, CacheLoader<T> loader) {
return find(key, val, loader, null, null);
} | [
"public",
"T",
"find",
"(",
"String",
"key",
",",
"Object",
"val",
",",
"CacheLoader",
"<",
"T",
">",
"loader",
")",
"{",
"return",
"find",
"(",
"key",
",",
"val",
",",
"loader",
",",
"null",
",",
"null",
")",
";",
"}"
] | Seeks the item from the cache that is identified by the specified key having
the specified value. If no match is found, the specified loader will be called to
place an item in the cache. You may pass in <code>null</code> for the loader.
If you do, only an object in active memory will be returned.
@param key the name of the unique identifier attribute whose value you have
@param val the value of the unique identifier that identifiers the desired item
@param loader a loader to load the desired object from the persistence store if it
is not in memory
@return the object that matches the specified key/value | [
"Seeks",
"the",
"item",
"from",
"the",
"cache",
"that",
"is",
"identified",
"by",
"the",
"specified",
"key",
"having",
"the",
"specified",
"value",
".",
"If",
"no",
"match",
"is",
"found",
"the",
"specified",
"loader",
"will",
"be",
"called",
"to",
"place",
"an",
"item",
"in",
"the",
"cache",
".",
"You",
"may",
"pass",
"in",
"<code",
">",
"null<",
"/",
"code",
">",
"for",
"the",
"loader",
".",
"If",
"you",
"do",
"only",
"an",
"object",
"in",
"active",
"memory",
"will",
"be",
"returned",
"."
] | train | https://github.com/greese/dasein-util/blob/648606dcb4bd382e3287a6c897a32e65d553dc47/src/main/java/org/dasein/util/ConcurrentMultiCache.java#L241-L243 |
astrapi69/mystic-crypt | crypt-data/src/main/java/de/alpharogroup/crypto/key/writer/CertificateWriter.java | CertificateWriter.writeInDerFormat | public static void writeInDerFormat(final X509Certificate certificate, final @NonNull File file)
throws IOException, CertificateEncodingException {
"""
Write the given {@link X509Certificate} into the given {@link File} in the *.der format.
@param certificate
the certificate
@param file
the file to write in
@throws IOException
Signals that an I/O exception has occurred.
@throws CertificateEncodingException
is thrown if an encoding error occurs.
"""
writeInDerFormat(certificate, new FileOutputStream(file));
} | java | public static void writeInDerFormat(final X509Certificate certificate, final @NonNull File file)
throws IOException, CertificateEncodingException
{
writeInDerFormat(certificate, new FileOutputStream(file));
} | [
"public",
"static",
"void",
"writeInDerFormat",
"(",
"final",
"X509Certificate",
"certificate",
",",
"final",
"@",
"NonNull",
"File",
"file",
")",
"throws",
"IOException",
",",
"CertificateEncodingException",
"{",
"writeInDerFormat",
"(",
"certificate",
",",
"new",
"FileOutputStream",
"(",
"file",
")",
")",
";",
"}"
] | Write the given {@link X509Certificate} into the given {@link File} in the *.der format.
@param certificate
the certificate
@param file
the file to write in
@throws IOException
Signals that an I/O exception has occurred.
@throws CertificateEncodingException
is thrown if an encoding error occurs. | [
"Write",
"the",
"given",
"{",
"@link",
"X509Certificate",
"}",
"into",
"the",
"given",
"{",
"@link",
"File",
"}",
"in",
"the",
"*",
".",
"der",
"format",
"."
] | train | https://github.com/astrapi69/mystic-crypt/blob/7f51ef5e4457e24de7ff391f10bfc5609e6f1a34/crypt-data/src/main/java/de/alpharogroup/crypto/key/writer/CertificateWriter.java#L119-L123 |
oasp/oasp4j | modules/rest/src/main/java/io/oasp/module/rest/service/impl/RestServiceExceptionFacade.java | RestServiceExceptionFacade.createResponse | protected Response createResponse(Status status, NlsRuntimeException error, String message,
Map<String, List<String>> errorsMap) {
"""
Create a response message as a JSON-String from the given parts.
@param status is the HTTP {@link Status}.
@param error is the catched or wrapped {@link NlsRuntimeException}.
@param message is the JSON message attribute.
@param errorsMap is a map with all validation errors
@return the corresponding {@link Response}.
"""
return createResponse(status, error, message, error.getCode(), errorsMap);
} | java | protected Response createResponse(Status status, NlsRuntimeException error, String message,
Map<String, List<String>> errorsMap) {
return createResponse(status, error, message, error.getCode(), errorsMap);
} | [
"protected",
"Response",
"createResponse",
"(",
"Status",
"status",
",",
"NlsRuntimeException",
"error",
",",
"String",
"message",
",",
"Map",
"<",
"String",
",",
"List",
"<",
"String",
">",
">",
"errorsMap",
")",
"{",
"return",
"createResponse",
"(",
"status",
",",
"error",
",",
"message",
",",
"error",
".",
"getCode",
"(",
")",
",",
"errorsMap",
")",
";",
"}"
] | Create a response message as a JSON-String from the given parts.
@param status is the HTTP {@link Status}.
@param error is the catched or wrapped {@link NlsRuntimeException}.
@param message is the JSON message attribute.
@param errorsMap is a map with all validation errors
@return the corresponding {@link Response}. | [
"Create",
"a",
"response",
"message",
"as",
"a",
"JSON",
"-",
"String",
"from",
"the",
"given",
"parts",
"."
] | train | https://github.com/oasp/oasp4j/blob/03f90132699fad95e52ec8efa54aa391f8d3c7e4/modules/rest/src/main/java/io/oasp/module/rest/service/impl/RestServiceExceptionFacade.java#L426-L430 |
lucee/Lucee | core/src/main/java/lucee/runtime/net/http/ReqRspUtil.java | ReqRspUtil.getRequestURL | public static String getRequestURL(HttpServletRequest req, boolean includeQueryString) {
"""
returns the full request URL
@param req - the HttpServletRequest
@param includeQueryString - if true, the QueryString will be appended if one exists
"""
StringBuffer sb = req.getRequestURL();
int maxpos = sb.indexOf("/", 8);
if (maxpos > -1) {
if (req.isSecure()) {
if (sb.substring(maxpos - 4, maxpos).equals(":443")) sb.delete(maxpos - 4, maxpos);
}
else {
if (sb.substring(maxpos - 3, maxpos).equals(":80")) sb.delete(maxpos - 3, maxpos);
}
if (includeQueryString && !StringUtil.isEmpty(req.getQueryString())) sb.append('?').append(req.getQueryString());
}
return sb.toString();
} | java | public static String getRequestURL(HttpServletRequest req, boolean includeQueryString) {
StringBuffer sb = req.getRequestURL();
int maxpos = sb.indexOf("/", 8);
if (maxpos > -1) {
if (req.isSecure()) {
if (sb.substring(maxpos - 4, maxpos).equals(":443")) sb.delete(maxpos - 4, maxpos);
}
else {
if (sb.substring(maxpos - 3, maxpos).equals(":80")) sb.delete(maxpos - 3, maxpos);
}
if (includeQueryString && !StringUtil.isEmpty(req.getQueryString())) sb.append('?').append(req.getQueryString());
}
return sb.toString();
} | [
"public",
"static",
"String",
"getRequestURL",
"(",
"HttpServletRequest",
"req",
",",
"boolean",
"includeQueryString",
")",
"{",
"StringBuffer",
"sb",
"=",
"req",
".",
"getRequestURL",
"(",
")",
";",
"int",
"maxpos",
"=",
"sb",
".",
"indexOf",
"(",
"\"/\"",
",",
"8",
")",
";",
"if",
"(",
"maxpos",
">",
"-",
"1",
")",
"{",
"if",
"(",
"req",
".",
"isSecure",
"(",
")",
")",
"{",
"if",
"(",
"sb",
".",
"substring",
"(",
"maxpos",
"-",
"4",
",",
"maxpos",
")",
".",
"equals",
"(",
"\":443\"",
")",
")",
"sb",
".",
"delete",
"(",
"maxpos",
"-",
"4",
",",
"maxpos",
")",
";",
"}",
"else",
"{",
"if",
"(",
"sb",
".",
"substring",
"(",
"maxpos",
"-",
"3",
",",
"maxpos",
")",
".",
"equals",
"(",
"\":80\"",
")",
")",
"sb",
".",
"delete",
"(",
"maxpos",
"-",
"3",
",",
"maxpos",
")",
";",
"}",
"if",
"(",
"includeQueryString",
"&&",
"!",
"StringUtil",
".",
"isEmpty",
"(",
"req",
".",
"getQueryString",
"(",
")",
")",
")",
"sb",
".",
"append",
"(",
"'",
"'",
")",
".",
"append",
"(",
"req",
".",
"getQueryString",
"(",
")",
")",
";",
"}",
"return",
"sb",
".",
"toString",
"(",
")",
";",
"}"
] | returns the full request URL
@param req - the HttpServletRequest
@param includeQueryString - if true, the QueryString will be appended if one exists | [
"returns",
"the",
"full",
"request",
"URL"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/net/http/ReqRspUtil.java#L493-L511 |
grails/gorm-hibernate5 | grails-datastore-gorm-hibernate5/src/main/groovy/org/grails/orm/hibernate/query/AbstractHibernateCriteriaBuilder.java | AbstractHibernateCriteriaBuilder.createAlias | public Criteria createAlias(String associationPath, String alias) {
"""
Join an association, assigning an alias to the joined association.
Functionally equivalent to createAlias(String, String, int) using
CriteriaSpecificationINNER_JOIN for the joinType.
@param associationPath A dot-seperated property path
@param alias The alias to assign to the joined association (for later reference).
@return this (for method chaining)
#see {@link #createAlias(String, String, int)}
@throws HibernateException Indicates a problem creating the sub criteria
"""
return criteria.createAlias(associationPath, alias);
} | java | public Criteria createAlias(String associationPath, String alias) {
return criteria.createAlias(associationPath, alias);
} | [
"public",
"Criteria",
"createAlias",
"(",
"String",
"associationPath",
",",
"String",
"alias",
")",
"{",
"return",
"criteria",
".",
"createAlias",
"(",
"associationPath",
",",
"alias",
")",
";",
"}"
] | Join an association, assigning an alias to the joined association.
Functionally equivalent to createAlias(String, String, int) using
CriteriaSpecificationINNER_JOIN for the joinType.
@param associationPath A dot-seperated property path
@param alias The alias to assign to the joined association (for later reference).
@return this (for method chaining)
#see {@link #createAlias(String, String, int)}
@throws HibernateException Indicates a problem creating the sub criteria | [
"Join",
"an",
"association",
"assigning",
"an",
"alias",
"to",
"the",
"joined",
"association",
"."
] | train | https://github.com/grails/gorm-hibernate5/blob/0ebb80cd769ef2bea955723d4543828a3e9542ef/grails-datastore-gorm-hibernate5/src/main/groovy/org/grails/orm/hibernate/query/AbstractHibernateCriteriaBuilder.java#L574-L576 |
ModeShape/modeshape | index-providers/modeshape-elasticsearch-index-provider/src/main/java/org/modeshape/jcr/index/elasticsearch/EsIndexColumns.java | EsIndexColumns.noprefix | private String noprefix(String name, String... prefix) {
"""
Cuts name prefix for the pseudo column case.
@param name the name of the column or pseudo column.
@param prefix the list of prefixes to cut.
@return the name without prefix.
"""
for (int i = 0; i < prefix.length; i++) {
if (name.startsWith(prefix[i])) {
name = name.replaceAll(prefix[i], "");
}
}
return name;
} | java | private String noprefix(String name, String... prefix) {
for (int i = 0; i < prefix.length; i++) {
if (name.startsWith(prefix[i])) {
name = name.replaceAll(prefix[i], "");
}
}
return name;
} | [
"private",
"String",
"noprefix",
"(",
"String",
"name",
",",
"String",
"...",
"prefix",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"prefix",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"name",
".",
"startsWith",
"(",
"prefix",
"[",
"i",
"]",
")",
")",
"{",
"name",
"=",
"name",
".",
"replaceAll",
"(",
"prefix",
"[",
"i",
"]",
",",
"\"\"",
")",
";",
"}",
"}",
"return",
"name",
";",
"}"
] | Cuts name prefix for the pseudo column case.
@param name the name of the column or pseudo column.
@param prefix the list of prefixes to cut.
@return the name without prefix. | [
"Cuts",
"name",
"prefix",
"for",
"the",
"pseudo",
"column",
"case",
"."
] | train | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/index-providers/modeshape-elasticsearch-index-provider/src/main/java/org/modeshape/jcr/index/elasticsearch/EsIndexColumns.java#L92-L99 |
jboss/jboss-common-beans | src/main/java/org/jboss/common/beans/property/DateEditor.java | DateEditor.setAsText | @Override
public void setAsText(String text) {
"""
Parse the text into a java.util.Date by trying one by one the registered DateFormat(s).
@param text the string date
"""
if (BeanUtils.isNull(text)) {
setValue(null);
return;
}
ParseException pe = null;
for (int i = 0; i < formats.length; i++) {
try {
// try to parse the date
DateFormat df = formats[i];
Date date = df.parse(text);
// store the date in both forms
this.text = text;
super.setValue(date);
// done
return;
} catch (ParseException e) {
// remember the last seen exception
pe = e;
}
}
// couldn't parse
throw new IllegalArgumentException("Failed to parse to Date!", pe);
} | java | @Override
public void setAsText(String text) {
if (BeanUtils.isNull(text)) {
setValue(null);
return;
}
ParseException pe = null;
for (int i = 0; i < formats.length; i++) {
try {
// try to parse the date
DateFormat df = formats[i];
Date date = df.parse(text);
// store the date in both forms
this.text = text;
super.setValue(date);
// done
return;
} catch (ParseException e) {
// remember the last seen exception
pe = e;
}
}
// couldn't parse
throw new IllegalArgumentException("Failed to parse to Date!", pe);
} | [
"@",
"Override",
"public",
"void",
"setAsText",
"(",
"String",
"text",
")",
"{",
"if",
"(",
"BeanUtils",
".",
"isNull",
"(",
"text",
")",
")",
"{",
"setValue",
"(",
"null",
")",
";",
"return",
";",
"}",
"ParseException",
"pe",
"=",
"null",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"formats",
".",
"length",
";",
"i",
"++",
")",
"{",
"try",
"{",
"// try to parse the date",
"DateFormat",
"df",
"=",
"formats",
"[",
"i",
"]",
";",
"Date",
"date",
"=",
"df",
".",
"parse",
"(",
"text",
")",
";",
"// store the date in both forms",
"this",
".",
"text",
"=",
"text",
";",
"super",
".",
"setValue",
"(",
"date",
")",
";",
"// done",
"return",
";",
"}",
"catch",
"(",
"ParseException",
"e",
")",
"{",
"// remember the last seen exception",
"pe",
"=",
"e",
";",
"}",
"}",
"// couldn't parse",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Failed to parse to Date!\"",
",",
"pe",
")",
";",
"}"
] | Parse the text into a java.util.Date by trying one by one the registered DateFormat(s).
@param text the string date | [
"Parse",
"the",
"text",
"into",
"a",
"java",
".",
"util",
".",
"Date",
"by",
"trying",
"one",
"by",
"one",
"the",
"registered",
"DateFormat",
"(",
"s",
")",
"."
] | train | https://github.com/jboss/jboss-common-beans/blob/ffb48b1719762534bf92d762eadf91d1815f6748/src/main/java/org/jboss/common/beans/property/DateEditor.java#L109-L136 |
defei/codelogger-utils | src/main/java/org/codelogger/utils/ExceptionThrower.java | ExceptionThrower.createExceptionMessage | protected String createExceptionMessage(final String message, final Object... messageParameters) {
"""
Create a string message by string format.
@param message
@param messageParameters
@return
"""
if (ArrayUtils.isEmpty(messageParameters)) {
return message;
} else {
return String.format(message, messageParameters);
}
} | java | protected String createExceptionMessage(final String message, final Object... messageParameters) {
if (ArrayUtils.isEmpty(messageParameters)) {
return message;
} else {
return String.format(message, messageParameters);
}
} | [
"protected",
"String",
"createExceptionMessage",
"(",
"final",
"String",
"message",
",",
"final",
"Object",
"...",
"messageParameters",
")",
"{",
"if",
"(",
"ArrayUtils",
".",
"isEmpty",
"(",
"messageParameters",
")",
")",
"{",
"return",
"message",
";",
"}",
"else",
"{",
"return",
"String",
".",
"format",
"(",
"message",
",",
"messageParameters",
")",
";",
"}",
"}"
] | Create a string message by string format.
@param message
@param messageParameters
@return | [
"Create",
"a",
"string",
"message",
"by",
"string",
"format",
"."
] | train | https://github.com/defei/codelogger-utils/blob/d906f5d217b783c7ae3e53442cd6fb87b20ecc0a/src/main/java/org/codelogger/utils/ExceptionThrower.java#L65-L72 |
gsi-upm/Shanks | shanks-core/src/main/java/es/upm/dit/gsi/shanks/model/scenario/portrayal/ScenarioPortrayal.java | ScenarioPortrayal.addDataSerieToHistogram | public void addDataSerieToHistogram(String histogramID, double[] dataSerie, int binsCount) {
"""
Adds data to the histogram.
Given the number of bins, this will show a count on the number of
times a value is repeated. For example:
[1,2,3,1,1,3], and bins = 3
Will provide:
_
| | _
| | _ | |
_|_||_||_|_
If the number of different values is different from the number of bins,
then each bin will represent the number of values in a range, evenly distributed
between the minimum and the maximum value. For example:
[1,2,3,1,1,3], and bins = 2
Two ranges will be considered: [1,2) and [2,3].
BE ADVISED The middle value would be assigned to the upper range.
In this example, the histogram will look:
_ _
| || |
| || |
_|_||_|_
@param histogramID
@param dataSerie the data
@param binsCount the number of bins
"""
if (this.histograms.containsKey(histogramID)) {
this.histograms.get(histogramID).addSeries(dataSerie, binsCount, histogramID, null);
}
} | java | public void addDataSerieToHistogram(String histogramID, double[] dataSerie, int binsCount){
if (this.histograms.containsKey(histogramID)) {
this.histograms.get(histogramID).addSeries(dataSerie, binsCount, histogramID, null);
}
} | [
"public",
"void",
"addDataSerieToHistogram",
"(",
"String",
"histogramID",
",",
"double",
"[",
"]",
"dataSerie",
",",
"int",
"binsCount",
")",
"{",
"if",
"(",
"this",
".",
"histograms",
".",
"containsKey",
"(",
"histogramID",
")",
")",
"{",
"this",
".",
"histograms",
".",
"get",
"(",
"histogramID",
")",
".",
"addSeries",
"(",
"dataSerie",
",",
"binsCount",
",",
"histogramID",
",",
"null",
")",
";",
"}",
"}"
] | Adds data to the histogram.
Given the number of bins, this will show a count on the number of
times a value is repeated. For example:
[1,2,3,1,1,3], and bins = 3
Will provide:
_
| | _
| | _ | |
_|_||_||_|_
If the number of different values is different from the number of bins,
then each bin will represent the number of values in a range, evenly distributed
between the minimum and the maximum value. For example:
[1,2,3,1,1,3], and bins = 2
Two ranges will be considered: [1,2) and [2,3].
BE ADVISED The middle value would be assigned to the upper range.
In this example, the histogram will look:
_ _
| || |
| || |
_|_||_|_
@param histogramID
@param dataSerie the data
@param binsCount the number of bins | [
"Adds",
"data",
"to",
"the",
"histogram",
".",
"Given",
"the",
"number",
"of",
"bins",
"this",
"will",
"show",
"a",
"count",
"on",
"the",
"number",
"of",
"times",
"a",
"value",
"is",
"repeated",
".",
"For",
"example",
":",
"[",
"1",
"2",
"3",
"1",
"1",
"3",
"]",
"and",
"bins",
"=",
"3",
"Will",
"provide",
":",
"_",
"|",
"|",
"_",
"|",
"|",
"_",
"|",
"|",
"_|_||_||_|_"
] | train | https://github.com/gsi-upm/Shanks/blob/35d87a81c22731f4f83bbd0571c9c6d466bd16be/shanks-core/src/main/java/es/upm/dit/gsi/shanks/model/scenario/portrayal/ScenarioPortrayal.java#L416-L420 |
alkacon/opencms-core | src/org/opencms/search/documents/CmsDocumentDependency.java | CmsDocumentDependency.readFromContext | private static CmsDocumentDependency readFromContext(CmsObject cms, String rootPath) {
"""
Reads the dependency object for the given root path in the OpenCms runtime context.<p>
@param cms the current OpenCms user context
@param rootPath the root path to look up the dependency object for
@return the deps
"""
return (CmsDocumentDependency)cms.getRequestContext().getAttribute(getAttributeKey(rootPath));
} | java | private static CmsDocumentDependency readFromContext(CmsObject cms, String rootPath) {
return (CmsDocumentDependency)cms.getRequestContext().getAttribute(getAttributeKey(rootPath));
} | [
"private",
"static",
"CmsDocumentDependency",
"readFromContext",
"(",
"CmsObject",
"cms",
",",
"String",
"rootPath",
")",
"{",
"return",
"(",
"CmsDocumentDependency",
")",
"cms",
".",
"getRequestContext",
"(",
")",
".",
"getAttribute",
"(",
"getAttributeKey",
"(",
"rootPath",
")",
")",
";",
"}"
] | Reads the dependency object for the given root path in the OpenCms runtime context.<p>
@param cms the current OpenCms user context
@param rootPath the root path to look up the dependency object for
@return the deps | [
"Reads",
"the",
"dependency",
"object",
"for",
"the",
"given",
"root",
"path",
"in",
"the",
"OpenCms",
"runtime",
"context",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/documents/CmsDocumentDependency.java#L405-L408 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/ArrayList.java | ArrayList.addAll | public boolean addAll(int index, Collection<? extends E> c) {
"""
Inserts all of the elements in the specified collection into this
list, starting at the specified position. Shifts the element
currently at that position (if any) and any subsequent elements to
the right (increases their indices). The new elements will appear
in the list in the order that they are returned by the
specified collection's iterator.
@param index index at which to insert the first element from the
specified collection
@param c collection containing elements to be added to this list
@return <tt>true</tt> if this list changed as a result of the call
@throws IndexOutOfBoundsException {@inheritDoc}
@throws NullPointerException if the specified collection is null
"""
if (index > size || index < 0)
throw new IndexOutOfBoundsException(outOfBoundsMsg(index));
Object[] a = c.toArray();
int numNew = a.length;
ensureCapacityInternal(size + numNew); // Increments modCount
int numMoved = size - index;
if (numMoved > 0)
System.arraycopy(elementData, index, elementData, index + numNew,
numMoved);
System.arraycopy(a, 0, elementData, index, numNew);
size += numNew;
return numNew != 0;
} | java | public boolean addAll(int index, Collection<? extends E> c) {
if (index > size || index < 0)
throw new IndexOutOfBoundsException(outOfBoundsMsg(index));
Object[] a = c.toArray();
int numNew = a.length;
ensureCapacityInternal(size + numNew); // Increments modCount
int numMoved = size - index;
if (numMoved > 0)
System.arraycopy(elementData, index, elementData, index + numNew,
numMoved);
System.arraycopy(a, 0, elementData, index, numNew);
size += numNew;
return numNew != 0;
} | [
"public",
"boolean",
"addAll",
"(",
"int",
"index",
",",
"Collection",
"<",
"?",
"extends",
"E",
">",
"c",
")",
"{",
"if",
"(",
"index",
">",
"size",
"||",
"index",
"<",
"0",
")",
"throw",
"new",
"IndexOutOfBoundsException",
"(",
"outOfBoundsMsg",
"(",
"index",
")",
")",
";",
"Object",
"[",
"]",
"a",
"=",
"c",
".",
"toArray",
"(",
")",
";",
"int",
"numNew",
"=",
"a",
".",
"length",
";",
"ensureCapacityInternal",
"(",
"size",
"+",
"numNew",
")",
";",
"// Increments modCount",
"int",
"numMoved",
"=",
"size",
"-",
"index",
";",
"if",
"(",
"numMoved",
">",
"0",
")",
"System",
".",
"arraycopy",
"(",
"elementData",
",",
"index",
",",
"elementData",
",",
"index",
"+",
"numNew",
",",
"numMoved",
")",
";",
"System",
".",
"arraycopy",
"(",
"a",
",",
"0",
",",
"elementData",
",",
"index",
",",
"numNew",
")",
";",
"size",
"+=",
"numNew",
";",
"return",
"numNew",
"!=",
"0",
";",
"}"
] | Inserts all of the elements in the specified collection into this
list, starting at the specified position. Shifts the element
currently at that position (if any) and any subsequent elements to
the right (increases their indices). The new elements will appear
in the list in the order that they are returned by the
specified collection's iterator.
@param index index at which to insert the first element from the
specified collection
@param c collection containing elements to be added to this list
@return <tt>true</tt> if this list changed as a result of the call
@throws IndexOutOfBoundsException {@inheritDoc}
@throws NullPointerException if the specified collection is null | [
"Inserts",
"all",
"of",
"the",
"elements",
"in",
"the",
"specified",
"collection",
"into",
"this",
"list",
"starting",
"at",
"the",
"specified",
"position",
".",
"Shifts",
"the",
"element",
"currently",
"at",
"that",
"position",
"(",
"if",
"any",
")",
"and",
"any",
"subsequent",
"elements",
"to",
"the",
"right",
"(",
"increases",
"their",
"indices",
")",
".",
"The",
"new",
"elements",
"will",
"appear",
"in",
"the",
"list",
"in",
"the",
"order",
"that",
"they",
"are",
"returned",
"by",
"the",
"specified",
"collection",
"s",
"iterator",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/ArrayList.java#L611-L627 |
Azure/azure-sdk-for-java | storage/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/storage/v2018_03_01_preview/implementation/StorageAccountsInner.java | StorageAccountsInner.updateAsync | public Observable<StorageAccountInner> updateAsync(String resourceGroupName, String accountName, StorageAccountUpdateParameters parameters) {
"""
The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation.
@param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive.
@param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only.
@param parameters The parameters to provide for the updated account.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the StorageAccountInner object
"""
return updateWithServiceResponseAsync(resourceGroupName, accountName, parameters).map(new Func1<ServiceResponse<StorageAccountInner>, StorageAccountInner>() {
@Override
public StorageAccountInner call(ServiceResponse<StorageAccountInner> response) {
return response.body();
}
});
} | java | public Observable<StorageAccountInner> updateAsync(String resourceGroupName, String accountName, StorageAccountUpdateParameters parameters) {
return updateWithServiceResponseAsync(resourceGroupName, accountName, parameters).map(new Func1<ServiceResponse<StorageAccountInner>, StorageAccountInner>() {
@Override
public StorageAccountInner call(ServiceResponse<StorageAccountInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"StorageAccountInner",
">",
"updateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
",",
"StorageAccountUpdateParameters",
"parameters",
")",
"{",
"return",
"updateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"accountName",
",",
"parameters",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"StorageAccountInner",
">",
",",
"StorageAccountInner",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"StorageAccountInner",
"call",
"(",
"ServiceResponse",
"<",
"StorageAccountInner",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | The update operation can be used to update the SKU, encryption, access tier, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account; the replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value can be set. The update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change the storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation.
@param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive.
@param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only.
@param parameters The parameters to provide for the updated account.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the StorageAccountInner object | [
"The",
"update",
"operation",
"can",
"be",
"used",
"to",
"update",
"the",
"SKU",
"encryption",
"access",
"tier",
"or",
"tags",
"for",
"a",
"storage",
"account",
".",
"It",
"can",
"also",
"be",
"used",
"to",
"map",
"the",
"account",
"to",
"a",
"custom",
"domain",
".",
"Only",
"one",
"custom",
"domain",
"is",
"supported",
"per",
"storage",
"account",
";",
"the",
"replacement",
"/",
"change",
"of",
"custom",
"domain",
"is",
"not",
"supported",
".",
"In",
"order",
"to",
"replace",
"an",
"old",
"custom",
"domain",
"the",
"old",
"value",
"must",
"be",
"cleared",
"/",
"unregistered",
"before",
"a",
"new",
"value",
"can",
"be",
"set",
".",
"The",
"update",
"of",
"multiple",
"properties",
"is",
"supported",
".",
"This",
"call",
"does",
"not",
"change",
"the",
"storage",
"keys",
"for",
"the",
"account",
".",
"If",
"you",
"want",
"to",
"change",
"the",
"storage",
"account",
"keys",
"use",
"the",
"regenerate",
"keys",
"operation",
".",
"The",
"location",
"and",
"name",
"of",
"the",
"storage",
"account",
"cannot",
"be",
"changed",
"after",
"creation",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/storage/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/storage/v2018_03_01_preview/implementation/StorageAccountsInner.java#L598-L605 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.