repository_name stringlengths 7 54 | func_path_in_repository stringlengths 18 196 | func_name stringlengths 7 107 | whole_func_string stringlengths 76 3.82k | language stringclasses 1
value | func_code_string stringlengths 76 3.82k | func_code_tokens listlengths 22 717 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 508 | split_name stringclasses 1
value | func_code_url stringlengths 111 310 |
|---|---|---|---|---|---|---|---|---|---|---|
sebastiangraf/treetank | interfacemodules/xml/src/main/java/org/treetank/service/xml/diff/AbsDiff.java | AbsDiff.diffAlgorithm | private EDiff diffAlgorithm(final INodeReadTrx paramNewRtx, final INodeReadTrx paramOldRtx,
final DepthCounter paramDepth) throws TTIOException {
EDiff diff = null;
// Check if node has been deleted.
if (paramDepth.getOldDepth() > paramDepth.getNewDepth()) {
diff = EDiff.DELETED;
} else if (checkUpdate(paramNewRtx, paramOldRtx)) { // Check if node has
// been updated.
diff = EDiff.UPDATED;
} else {
// See if one of the right sibling matches.
EFoundEqualNode found = EFoundEqualNode.FALSE;
final long key = paramOldRtx.getNode().getDataKey();
while (((ITreeStructData)paramOldRtx.getNode()).hasRightSibling()
&& paramOldRtx.moveTo(((ITreeStructData)paramOldRtx.getNode()).getRightSiblingKey())
&& found == EFoundEqualNode.FALSE) {
if (checkNodes(paramNewRtx, paramOldRtx)) {
found = EFoundEqualNode.TRUE;
}
}
paramOldRtx.moveTo(key);
diff = found.kindOfDiff();
}
assert diff != null;
return diff;
} | java | private EDiff diffAlgorithm(final INodeReadTrx paramNewRtx, final INodeReadTrx paramOldRtx,
final DepthCounter paramDepth) throws TTIOException {
EDiff diff = null;
// Check if node has been deleted.
if (paramDepth.getOldDepth() > paramDepth.getNewDepth()) {
diff = EDiff.DELETED;
} else if (checkUpdate(paramNewRtx, paramOldRtx)) { // Check if node has
// been updated.
diff = EDiff.UPDATED;
} else {
// See if one of the right sibling matches.
EFoundEqualNode found = EFoundEqualNode.FALSE;
final long key = paramOldRtx.getNode().getDataKey();
while (((ITreeStructData)paramOldRtx.getNode()).hasRightSibling()
&& paramOldRtx.moveTo(((ITreeStructData)paramOldRtx.getNode()).getRightSiblingKey())
&& found == EFoundEqualNode.FALSE) {
if (checkNodes(paramNewRtx, paramOldRtx)) {
found = EFoundEqualNode.TRUE;
}
}
paramOldRtx.moveTo(key);
diff = found.kindOfDiff();
}
assert diff != null;
return diff;
} | [
"private",
"EDiff",
"diffAlgorithm",
"(",
"final",
"INodeReadTrx",
"paramNewRtx",
",",
"final",
"INodeReadTrx",
"paramOldRtx",
",",
"final",
"DepthCounter",
"paramDepth",
")",
"throws",
"TTIOException",
"{",
"EDiff",
"diff",
"=",
"null",
";",
"// Check if node has bee... | Main algorithm to compute diffs between two nodes.
@param paramNewRtx
{@link IReadTransaction} on new revision
@param paramOldRtx
{@link IReadTransaction} on old revision
@param paramDepth
{@link DepthCounter} container for current depths of both
transaction cursors
@return kind of diff
@throws TTIOException | [
"Main",
"algorithm",
"to",
"compute",
"diffs",
"between",
"two",
"nodes",
"."
] | train | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/xml/src/main/java/org/treetank/service/xml/diff/AbsDiff.java#L381-L410 |
gallandarakhneorg/afc | advanced/nodefx/src/main/java/org/arakhne/afc/nodefx/ZoomableGraphicsContext.java | ZoomableGraphicsContext.quadraticCurveTo | public void quadraticCurveTo(double xc, double yc, double x1, double y1) {
this.gc.quadraticCurveTo(
doc2fxX(xc), doc2fxY(yc),
doc2fxX(x1), doc2fxY(y1));
} | java | public void quadraticCurveTo(double xc, double yc, double x1, double y1) {
this.gc.quadraticCurveTo(
doc2fxX(xc), doc2fxY(yc),
doc2fxX(x1), doc2fxY(y1));
} | [
"public",
"void",
"quadraticCurveTo",
"(",
"double",
"xc",
",",
"double",
"yc",
",",
"double",
"x1",
",",
"double",
"y1",
")",
"{",
"this",
".",
"gc",
".",
"quadraticCurveTo",
"(",
"doc2fxX",
"(",
"xc",
")",
",",
"doc2fxY",
"(",
"yc",
")",
",",
"doc2... | Adds segments to the current path to make a quadratic Bezier curve.
The coordinates are transformed by the current transform as they are
added to the path and unaffected by subsequent changes to the transform.
The current path is a path attribute
used for any of the path methods as specified in the
Rendering Attributes Table of {@link GraphicsContext}
and <b>is not affected</b> by the {@link #save()} and
{@link #restore()} operations.
@param xc the X coordinate of the control point
@param yc the Y coordinate of the control point
@param x1 the X coordinate of the end point
@param y1 the Y coordinate of the end point | [
"Adds",
"segments",
"to",
"the",
"current",
"path",
"to",
"make",
"a",
"quadratic",
"Bezier",
"curve",
".",
"The",
"coordinates",
"are",
"transformed",
"by",
"the",
"current",
"transform",
"as",
"they",
"are",
"added",
"to",
"the",
"path",
"and",
"unaffected... | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/nodefx/src/main/java/org/arakhne/afc/nodefx/ZoomableGraphicsContext.java#L1248-L1252 |
milaboratory/milib | src/main/java/com/milaboratory/core/sequence/SequenceQuality.java | SequenceQuality.create | public static SequenceQuality create(QualityFormat format, byte[] data, int from, int length, boolean check) {
if (from + length >= data.length || from < 0 || length < 0)
throw new IllegalArgumentException();
//For performance
final byte valueOffset = format.getOffset(),
minValue = format.getMinValue(),
maxValue = format.getMaxValue();
byte[] res = new byte[length];
int pointer = from;
for (int i = 0; i < length; i++) {
res[i] = (byte) (data[pointer++] - valueOffset);
if (check &&
(res[i] < minValue || res[i] > maxValue))
throw new WrongQualityFormat(((char) (data[i])) + " [" + res[i] + "]");
}
return new SequenceQuality(res, true);
} | java | public static SequenceQuality create(QualityFormat format, byte[] data, int from, int length, boolean check) {
if (from + length >= data.length || from < 0 || length < 0)
throw new IllegalArgumentException();
//For performance
final byte valueOffset = format.getOffset(),
minValue = format.getMinValue(),
maxValue = format.getMaxValue();
byte[] res = new byte[length];
int pointer = from;
for (int i = 0; i < length; i++) {
res[i] = (byte) (data[pointer++] - valueOffset);
if (check &&
(res[i] < minValue || res[i] > maxValue))
throw new WrongQualityFormat(((char) (data[i])) + " [" + res[i] + "]");
}
return new SequenceQuality(res, true);
} | [
"public",
"static",
"SequenceQuality",
"create",
"(",
"QualityFormat",
"format",
",",
"byte",
"[",
"]",
"data",
",",
"int",
"from",
",",
"int",
"length",
",",
"boolean",
"check",
")",
"{",
"if",
"(",
"from",
"+",
"length",
">=",
"data",
".",
"length",
... | Factory method for the SequenceQualityPhred object. It performs all necessary range checks if required.
@param format format of encoded quality values
@param data byte with encoded quality values
@param from starting position in {@code data}
@param length number of bytes to parse
@param check determines whether range check is required
@return quality line object
@throws WrongQualityFormat if encoded value are out of range and checking is enabled | [
"Factory",
"method",
"for",
"the",
"SequenceQualityPhred",
"object",
".",
"It",
"performs",
"all",
"necessary",
"range",
"checks",
"if",
"required",
"."
] | train | https://github.com/milaboratory/milib/blob/2349b3dccdd3c7948643760e570238d6e30d5a34/src/main/java/com/milaboratory/core/sequence/SequenceQuality.java#L348-L365 |
UrielCh/ovh-java-sdk | ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java | ApiOvhEmaildomain.domain_redirection_POST | public OvhTaskSpecialAccount domain_redirection_POST(String domain, String from, Boolean localCopy, String to) throws IOException {
String qPath = "/email/domain/{domain}/redirection";
StringBuilder sb = path(qPath, domain);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "from", from);
addBody(o, "localCopy", localCopy);
addBody(o, "to", to);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhTaskSpecialAccount.class);
} | java | public OvhTaskSpecialAccount domain_redirection_POST(String domain, String from, Boolean localCopy, String to) throws IOException {
String qPath = "/email/domain/{domain}/redirection";
StringBuilder sb = path(qPath, domain);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "from", from);
addBody(o, "localCopy", localCopy);
addBody(o, "to", to);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhTaskSpecialAccount.class);
} | [
"public",
"OvhTaskSpecialAccount",
"domain_redirection_POST",
"(",
"String",
"domain",
",",
"String",
"from",
",",
"Boolean",
"localCopy",
",",
"String",
"to",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/email/domain/{domain}/redirection\"",
";",
"S... | Create new redirection in server
REST: POST /email/domain/{domain}/redirection
@param from [required] Name of redirection
@param localCopy [required] If true keep a local copy
@param to [required] Target of account
@param domain [required] Name of your domain name | [
"Create",
"new",
"redirection",
"in",
"server"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java#L1071-L1080 |
line/centraldogma | server/src/main/java/com/linecorp/centraldogma/server/internal/api/RepositoryServiceV1.java | RepositoryServiceV1.patchRepository | @Consumes("application/json-patch+json")
@Patch("/projects/{projectName}/repos/{repoName}")
@RequiresRole(roles = ProjectRole.OWNER)
public CompletableFuture<RepositoryDto> patchRepository(@Param("repoName") String repoName,
Project project,
JsonNode node,
Author author) {
checkUnremoveArgument(node);
return execute(Command.unremoveRepository(author, project.name(), repoName))
.thenCompose(unused -> mds.restoreRepo(author, project.name(), repoName))
.handle(returnOrThrow(() -> DtoConverter.convert(project.repos().get(repoName))));
} | java | @Consumes("application/json-patch+json")
@Patch("/projects/{projectName}/repos/{repoName}")
@RequiresRole(roles = ProjectRole.OWNER)
public CompletableFuture<RepositoryDto> patchRepository(@Param("repoName") String repoName,
Project project,
JsonNode node,
Author author) {
checkUnremoveArgument(node);
return execute(Command.unremoveRepository(author, project.name(), repoName))
.thenCompose(unused -> mds.restoreRepo(author, project.name(), repoName))
.handle(returnOrThrow(() -> DtoConverter.convert(project.repos().get(repoName))));
} | [
"@",
"Consumes",
"(",
"\"application/json-patch+json\"",
")",
"@",
"Patch",
"(",
"\"/projects/{projectName}/repos/{repoName}\"",
")",
"@",
"RequiresRole",
"(",
"roles",
"=",
"ProjectRole",
".",
"OWNER",
")",
"public",
"CompletableFuture",
"<",
"RepositoryDto",
">",
"p... | PATCH /projects/{projectName}/repos/{repoName}
<p>Patches a repository with the JSON_PATCH. Currently, only unremove repository operation is supported. | [
"PATCH",
"/",
"projects",
"/",
"{",
"projectName",
"}",
"/",
"repos",
"/",
"{",
"repoName",
"}"
] | train | https://github.com/line/centraldogma/blob/b9e46c67fbc26628c2186ce2f46e7fb303c831e9/server/src/main/java/com/linecorp/centraldogma/server/internal/api/RepositoryServiceV1.java#L149-L160 |
flow/caustic | api/src/main/java/com/flowpowered/caustic/api/util/CausticUtil.java | CausticUtil.checkVersion | public static void checkVersion(GLVersioned required, GLVersioned object) {
if (!debug) {
return;
}
final GLVersion requiredVersion = required.getGLVersion();
final GLVersion objectVersion = object.getGLVersion();
if (objectVersion.getMajor() > requiredVersion.getMajor() && objectVersion.getMinor() > requiredVersion.getMinor()) {
throw new IllegalStateException("Versions not compatible: expected " + requiredVersion + " or lower, got " + objectVersion);
}
} | java | public static void checkVersion(GLVersioned required, GLVersioned object) {
if (!debug) {
return;
}
final GLVersion requiredVersion = required.getGLVersion();
final GLVersion objectVersion = object.getGLVersion();
if (objectVersion.getMajor() > requiredVersion.getMajor() && objectVersion.getMinor() > requiredVersion.getMinor()) {
throw new IllegalStateException("Versions not compatible: expected " + requiredVersion + " or lower, got " + objectVersion);
}
} | [
"public",
"static",
"void",
"checkVersion",
"(",
"GLVersioned",
"required",
",",
"GLVersioned",
"object",
")",
"{",
"if",
"(",
"!",
"debug",
")",
"{",
"return",
";",
"}",
"final",
"GLVersion",
"requiredVersion",
"=",
"required",
".",
"getGLVersion",
"(",
")"... | Checks if two OpenGL versioned object have compatible version. Throws an exception if that's not the case. A version is determined to be compatible with another is it's lower than the said
version. This isn't always true when deprecation is involved, but it's an acceptable way of doing this in most implementations.
@param required The required version
@param object The object to check the version of
@throws IllegalStateException If the object versions are not compatible | [
"Checks",
"if",
"two",
"OpenGL",
"versioned",
"object",
"have",
"compatible",
"version",
".",
"Throws",
"an",
"exception",
"if",
"that",
"s",
"not",
"the",
"case",
".",
"A",
"version",
"is",
"determined",
"to",
"be",
"compatible",
"with",
"another",
"is",
... | train | https://github.com/flow/caustic/blob/88652fcf0621ce158a0e92ce4c570ed6b1f6fca9/api/src/main/java/com/flowpowered/caustic/api/util/CausticUtil.java#L106-L115 |
riversun/d6 | src/main/java/org/riversun/d6/core/D6Crud.java | D6Crud.execSelectTable | public <T extends D6Model> T[] execSelectTable(String preparedSql, Class<T> modelClazz) {
return execSelectTable(preparedSql, null, modelClazz);
} | java | public <T extends D6Model> T[] execSelectTable(String preparedSql, Class<T> modelClazz) {
return execSelectTable(preparedSql, null, modelClazz);
} | [
"public",
"<",
"T",
"extends",
"D6Model",
">",
"T",
"[",
"]",
"execSelectTable",
"(",
"String",
"preparedSql",
",",
"Class",
"<",
"T",
">",
"modelClazz",
")",
"{",
"return",
"execSelectTable",
"(",
"preparedSql",
",",
"null",
",",
"modelClazz",
")",
";",
... | Execute select statement for the single table.
@param preparedSql
@param modelClazz
@return | [
"Execute",
"select",
"statement",
"for",
"the",
"single",
"table",
"."
] | train | https://github.com/riversun/d6/blob/2798bd876b9380dbfea8182d11ad306cb1b0e114/src/main/java/org/riversun/d6/core/D6Crud.java#L770-L772 |
gosu-lang/gosu-lang | gosu-core-api/src/main/java/gw/config/DefaultGosuProfilingService.java | DefaultGosuProfilingService.completed | public void completed(long startTime, long endTime, String path, String location, int count, long waitTime) {
ILogger logger = CommonServices.getEntityAccess().getLogger();
if (logger.isDebugEnabled()) {
if (endTime <= 0) {
endTime = CommonServices.getEntityAccess().getCurrentTime().getTime();
}
logger.debug("At " + (endTime - _time0) + " msecs: executed '"
+ path + "' (" + location + ") "
+ (count > 1 ? count + " times " : "")
+ "in " + (endTime - startTime) + " msecs"
+ (waitTime > 0 ? " wait=" + waitTime + " msecs " : "")
);
}
} | java | public void completed(long startTime, long endTime, String path, String location, int count, long waitTime) {
ILogger logger = CommonServices.getEntityAccess().getLogger();
if (logger.isDebugEnabled()) {
if (endTime <= 0) {
endTime = CommonServices.getEntityAccess().getCurrentTime().getTime();
}
logger.debug("At " + (endTime - _time0) + " msecs: executed '"
+ path + "' (" + location + ") "
+ (count > 1 ? count + " times " : "")
+ "in " + (endTime - startTime) + " msecs"
+ (waitTime > 0 ? " wait=" + waitTime + " msecs " : "")
);
}
} | [
"public",
"void",
"completed",
"(",
"long",
"startTime",
",",
"long",
"endTime",
",",
"String",
"path",
",",
"String",
"location",
",",
"int",
"count",
",",
"long",
"waitTime",
")",
"{",
"ILogger",
"logger",
"=",
"CommonServices",
".",
"getEntityAccess",
"("... | This will log a profiling event, note that the start time and end times should have been captured
from the same clock, for example IEntityAccess.getCurrentTime().
@param startTime the start of the profiled code
@param endTime the end of the profiled code (if 0 will use IEntityAccess.getCurrentTime())
@param path the path that was taken to reach this place (A called B called C could be A->B->C)
@param location this would be the location (maybe file#linenumb)
@param count the number of times this time represented
@param waitTime any wait times that were consumed during this execution | [
"This",
"will",
"log",
"a",
"profiling",
"event",
"note",
"that",
"the",
"start",
"time",
"and",
"end",
"times",
"should",
"have",
"been",
"captured",
"from",
"the",
"same",
"clock",
"for",
"example",
"IEntityAccess",
".",
"getCurrentTime",
"()",
"."
] | train | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/config/DefaultGosuProfilingService.java#L25-L38 |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/SFStatement.java | SFStatement.addProperty | public void addProperty(String propertyName, Object propertyValue)
throws SFException
{
statementParametersMap.put(propertyName, propertyValue);
// for query timeout, we implement it on client side for now
if ("query_timeout".equalsIgnoreCase(propertyName))
{
queryTimeout = (Integer) propertyValue;
}
// check if the number of session properties exceed limit
if (statementParametersMap.size() > MAX_STATEMENT_PARAMETERS)
{
throw new SFException(
ErrorCode.TOO_MANY_STATEMENT_PARAMETERS, MAX_STATEMENT_PARAMETERS);
}
} | java | public void addProperty(String propertyName, Object propertyValue)
throws SFException
{
statementParametersMap.put(propertyName, propertyValue);
// for query timeout, we implement it on client side for now
if ("query_timeout".equalsIgnoreCase(propertyName))
{
queryTimeout = (Integer) propertyValue;
}
// check if the number of session properties exceed limit
if (statementParametersMap.size() > MAX_STATEMENT_PARAMETERS)
{
throw new SFException(
ErrorCode.TOO_MANY_STATEMENT_PARAMETERS, MAX_STATEMENT_PARAMETERS);
}
} | [
"public",
"void",
"addProperty",
"(",
"String",
"propertyName",
",",
"Object",
"propertyValue",
")",
"throws",
"SFException",
"{",
"statementParametersMap",
".",
"put",
"(",
"propertyName",
",",
"propertyValue",
")",
";",
"// for query timeout, we implement it on client s... | Add a statement parameter
<p>
Make sure a property is not added more than once and the number of
properties does not exceed limit.
@param propertyName property name
@param propertyValue property value
@throws SFException if too many parameters for a statement | [
"Add",
"a",
"statement",
"parameter",
"<p",
">",
"Make",
"sure",
"a",
"property",
"is",
"not",
"added",
"more",
"than",
"once",
"and",
"the",
"number",
"of",
"properties",
"does",
"not",
"exceed",
"limit",
"."
] | train | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/SFStatement.java#L101-L118 |
ReactiveX/RxNetty | rxnetty-http/src/main/java/io/reactivex/netty/protocol/http/TrailingHeaders.java | TrailingHeaders.addHeader | public TrailingHeaders addHeader(CharSequence name, Object value) {
lastHttpContent.trailingHeaders().add(name, value);
return this;
} | java | public TrailingHeaders addHeader(CharSequence name, Object value) {
lastHttpContent.trailingHeaders().add(name, value);
return this;
} | [
"public",
"TrailingHeaders",
"addHeader",
"(",
"CharSequence",
"name",
",",
"Object",
"value",
")",
"{",
"lastHttpContent",
".",
"trailingHeaders",
"(",
")",
".",
"add",
"(",
"name",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | Adds an HTTP trailing header with the passed {@code name} and {@code value} to this request.
@param name Name of the header.
@param value Value for the header.
@return {@code this}. | [
"Adds",
"an",
"HTTP",
"trailing",
"header",
"with",
"the",
"passed",
"{",
"@code",
"name",
"}",
"and",
"{",
"@code",
"value",
"}",
"to",
"this",
"request",
"."
] | train | https://github.com/ReactiveX/RxNetty/blob/a7ca9a9c1d544a79c82f7b17036daf6958bf1cd6/rxnetty-http/src/main/java/io/reactivex/netty/protocol/http/TrailingHeaders.java#L49-L52 |
ralscha/extdirectspring | src/main/java/ch/ralscha/extdirectspring/util/JsonHandler.java | JsonHandler.convertValue | public <T> T convertValue(Object object, JavaType toValueTypeRef) {
return this.mapper.convertValue(object, toValueTypeRef);
} | java | public <T> T convertValue(Object object, JavaType toValueTypeRef) {
return this.mapper.convertValue(object, toValueTypeRef);
} | [
"public",
"<",
"T",
">",
"T",
"convertValue",
"(",
"Object",
"object",
",",
"JavaType",
"toValueTypeRef",
")",
"{",
"return",
"this",
".",
"mapper",
".",
"convertValue",
"(",
"object",
",",
"toValueTypeRef",
")",
";",
"}"
] | Converts one object into another.
@param object the source
@param toValueTypeRef the type of the target
@return the converted object | [
"Converts",
"one",
"object",
"into",
"another",
"."
] | train | https://github.com/ralscha/extdirectspring/blob/4b018497c4e7503033f91d0491b4e74bf8291d2c/src/main/java/ch/ralscha/extdirectspring/util/JsonHandler.java#L170-L172 |
forge/furnace | container-api/src/main/java/org/jboss/forge/furnace/util/ClassLoaders.java | ClassLoaders.executeIn | public static void executeIn(ClassLoader loader, Runnable task) throws Exception
{
if (task == null)
return;
if (log.isLoggable(Level.FINE))
{
log.fine("ClassLoader [" + loader + "] task began.");
}
ClassLoader original = SecurityActions.getContextClassLoader();
try
{
SecurityActions.setContextClassLoader(loader);
task.run();
}
finally
{
SecurityActions.setContextClassLoader(original);
if (log.isLoggable(Level.FINE))
{
log.fine("ClassLoader [" + loader + "] task ended.");
}
}
} | java | public static void executeIn(ClassLoader loader, Runnable task) throws Exception
{
if (task == null)
return;
if (log.isLoggable(Level.FINE))
{
log.fine("ClassLoader [" + loader + "] task began.");
}
ClassLoader original = SecurityActions.getContextClassLoader();
try
{
SecurityActions.setContextClassLoader(loader);
task.run();
}
finally
{
SecurityActions.setContextClassLoader(original);
if (log.isLoggable(Level.FINE))
{
log.fine("ClassLoader [" + loader + "] task ended.");
}
}
} | [
"public",
"static",
"void",
"executeIn",
"(",
"ClassLoader",
"loader",
",",
"Runnable",
"task",
")",
"throws",
"Exception",
"{",
"if",
"(",
"task",
"==",
"null",
")",
"return",
";",
"if",
"(",
"log",
".",
"isLoggable",
"(",
"Level",
".",
"FINE",
")",
"... | Execute the given {@link Runnable} in the {@link ClassLoader} provided. Return the result, if any. | [
"Execute",
"the",
"given",
"{"
] | train | https://github.com/forge/furnace/blob/bbe6deaa3c0d85ba43daa3e2f7d486f2dad21e0a/container-api/src/main/java/org/jboss/forge/furnace/util/ClassLoaders.java#L57-L80 |
cdk/cdk | tool/builder3d/src/main/java/org/openscience/cdk/modeling/builder3d/AtomPlacer3D.java | AtomPlacer3D.getPlacedHeavyAtom | public IAtom getPlacedHeavyAtom(IAtomContainer molecule, IAtom atomA, IAtom atomB) {
List<IBond> bonds = molecule.getConnectedBondsList(atomA);
for (IBond bond : bonds) {
IAtom connectedAtom = bond.getOther(atomA);
if (isPlacedHeavyAtom(connectedAtom) && !connectedAtom.equals(atomB)) {
return connectedAtom;
}
}
return null;
} | java | public IAtom getPlacedHeavyAtom(IAtomContainer molecule, IAtom atomA, IAtom atomB) {
List<IBond> bonds = molecule.getConnectedBondsList(atomA);
for (IBond bond : bonds) {
IAtom connectedAtom = bond.getOther(atomA);
if (isPlacedHeavyAtom(connectedAtom) && !connectedAtom.equals(atomB)) {
return connectedAtom;
}
}
return null;
} | [
"public",
"IAtom",
"getPlacedHeavyAtom",
"(",
"IAtomContainer",
"molecule",
",",
"IAtom",
"atomA",
",",
"IAtom",
"atomB",
")",
"{",
"List",
"<",
"IBond",
">",
"bonds",
"=",
"molecule",
".",
"getConnectedBondsList",
"(",
"atomA",
")",
";",
"for",
"(",
"IBond"... | Gets the first placed Heavy Atom around atomA which is not atomB.
@param molecule
@param atomA Description of the Parameter
@param atomB Description of the Parameter
@return The placedHeavyAtom value | [
"Gets",
"the",
"first",
"placed",
"Heavy",
"Atom",
"around",
"atomA",
"which",
"is",
"not",
"atomB",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/builder3d/src/main/java/org/openscience/cdk/modeling/builder3d/AtomPlacer3D.java#L540-L549 |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/interest/SiftDetector.java | SiftDetector.isEdge | boolean isEdge( int x , int y ) {
if( edgeThreshold <= 0 )
return false;
double xx = derivXX.compute(x,y);
double xy = derivXY.compute(x,y);
double yy = derivYY.compute(x,y);
double Tr = xx + yy;
double det = xx*yy - xy*xy;
// Paper quite "In the unlikely event that the determinant is negative, the curvatures have different signs
// so the point is discarded as not being an extremum"
if( det <= 0)
return true;
else {
// In paper this is:
// Tr**2/Det < (r+1)**2/r
return( Tr*Tr >= edgeThreshold*det);
}
} | java | boolean isEdge( int x , int y ) {
if( edgeThreshold <= 0 )
return false;
double xx = derivXX.compute(x,y);
double xy = derivXY.compute(x,y);
double yy = derivYY.compute(x,y);
double Tr = xx + yy;
double det = xx*yy - xy*xy;
// Paper quite "In the unlikely event that the determinant is negative, the curvatures have different signs
// so the point is discarded as not being an extremum"
if( det <= 0)
return true;
else {
// In paper this is:
// Tr**2/Det < (r+1)**2/r
return( Tr*Tr >= edgeThreshold*det);
}
} | [
"boolean",
"isEdge",
"(",
"int",
"x",
",",
"int",
"y",
")",
"{",
"if",
"(",
"edgeThreshold",
"<=",
"0",
")",
"return",
"false",
";",
"double",
"xx",
"=",
"derivXX",
".",
"compute",
"(",
"x",
",",
"y",
")",
";",
"double",
"xy",
"=",
"derivXY",
"."... | Performs an edge test to remove false positives. See 4.1 in [1]. | [
"Performs",
"an",
"edge",
"test",
"to",
"remove",
"false",
"positives",
".",
"See",
"4",
".",
"1",
"in",
"[",
"1",
"]",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/interest/SiftDetector.java#L311-L331 |
UrielCh/ovh-java-sdk | ovh-java-sdk-vps/src/main/java/net/minidev/ovh/api/ApiOvhVps.java | ApiOvhVps.serviceName_backupftp_access_POST | public net.minidev.ovh.api.dedicated.server.OvhTask serviceName_backupftp_access_POST(String serviceName, Boolean cifs, Boolean ftp, String ipBlock, Boolean nfs) throws IOException {
String qPath = "/vps/{serviceName}/backupftp/access";
StringBuilder sb = path(qPath, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "cifs", cifs);
addBody(o, "ftp", ftp);
addBody(o, "ipBlock", ipBlock);
addBody(o, "nfs", nfs);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, net.minidev.ovh.api.dedicated.server.OvhTask.class);
} | java | public net.minidev.ovh.api.dedicated.server.OvhTask serviceName_backupftp_access_POST(String serviceName, Boolean cifs, Boolean ftp, String ipBlock, Boolean nfs) throws IOException {
String qPath = "/vps/{serviceName}/backupftp/access";
StringBuilder sb = path(qPath, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "cifs", cifs);
addBody(o, "ftp", ftp);
addBody(o, "ipBlock", ipBlock);
addBody(o, "nfs", nfs);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, net.minidev.ovh.api.dedicated.server.OvhTask.class);
} | [
"public",
"net",
".",
"minidev",
".",
"ovh",
".",
"api",
".",
"dedicated",
".",
"server",
".",
"OvhTask",
"serviceName_backupftp_access_POST",
"(",
"String",
"serviceName",
",",
"Boolean",
"cifs",
",",
"Boolean",
"ftp",
",",
"String",
"ipBlock",
",",
"Boolean"... | Create a new Backup FTP ACL
REST: POST /vps/{serviceName}/backupftp/access
@param ipBlock [required] The IP Block specific to this ACL. It musts belong to your server.
@param cifs [required] Wether to allow the CIFS (SMB) protocol for this ACL
@param nfs [required] Wether to allow the NFS protocol for this ACL
@param ftp [required] Wether to allow the FTP protocol for this ACL
@param serviceName [required] The internal name of your VPS offer | [
"Create",
"a",
"new",
"Backup",
"FTP",
"ACL"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-vps/src/main/java/net/minidev/ovh/api/ApiOvhVps.java#L792-L802 |
mapsforge/mapsforge | sqlite-android/src/main/java/org/sqlite/database/DatabaseUtils.java | DatabaseUtils.appendEscapedSQLString | public static void appendEscapedSQLString(StringBuilder sb, String sqlString) {
sb.append('\'');
if (sqlString.indexOf('\'') != -1) {
int length = sqlString.length();
for (int i = 0; i < length; i++) {
char c = sqlString.charAt(i);
if (c == '\'') {
sb.append('\'');
}
sb.append(c);
}
} else
sb.append(sqlString);
sb.append('\'');
} | java | public static void appendEscapedSQLString(StringBuilder sb, String sqlString) {
sb.append('\'');
if (sqlString.indexOf('\'') != -1) {
int length = sqlString.length();
for (int i = 0; i < length; i++) {
char c = sqlString.charAt(i);
if (c == '\'') {
sb.append('\'');
}
sb.append(c);
}
} else
sb.append(sqlString);
sb.append('\'');
} | [
"public",
"static",
"void",
"appendEscapedSQLString",
"(",
"StringBuilder",
"sb",
",",
"String",
"sqlString",
")",
"{",
"sb",
".",
"append",
"(",
"'",
"'",
")",
";",
"if",
"(",
"sqlString",
".",
"indexOf",
"(",
"'",
"'",
")",
"!=",
"-",
"1",
")",
"{"... | Appends an SQL string to the given StringBuilder, including the opening
and closing single quotes. Any single quotes internal to sqlString will
be escaped.
This method is deprecated because we want to encourage everyone
to use the "?" binding form. However, when implementing a
ContentProvider, one may want to add WHERE clauses that were
not provided by the caller. Since "?" is a positional form,
using it in this case could break the caller because the
indexes would be shifted to accomodate the ContentProvider's
internal bindings. In that case, it may be necessary to
construct a WHERE clause manually. This method is useful for
those cases.
@param sb the StringBuilder that the SQL string will be appended to
@param sqlString the raw string to be appended, which may contain single
quotes | [
"Appends",
"an",
"SQL",
"string",
"to",
"the",
"given",
"StringBuilder",
"including",
"the",
"opening",
"and",
"closing",
"single",
"quotes",
".",
"Any",
"single",
"quotes",
"internal",
"to",
"sqlString",
"will",
"be",
"escaped",
"."
] | train | https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/sqlite-android/src/main/java/org/sqlite/database/DatabaseUtils.java#L343-L357 |
BlueBrain/bluima | modules/bluima_typesystem/src/main/java/de/julielab/jules/types/List.java | List.setItemList | public void setItemList(int i, ListItem v) {
if (List_Type.featOkTst && ((List_Type)jcasType).casFeat_itemList == null)
jcasType.jcas.throwFeatMissing("itemList", "de.julielab.jules.types.List");
jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((List_Type)jcasType).casFeatCode_itemList), i);
jcasType.ll_cas.ll_setRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((List_Type)jcasType).casFeatCode_itemList), i, jcasType.ll_cas.ll_getFSRef(v));} | java | public void setItemList(int i, ListItem v) {
if (List_Type.featOkTst && ((List_Type)jcasType).casFeat_itemList == null)
jcasType.jcas.throwFeatMissing("itemList", "de.julielab.jules.types.List");
jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((List_Type)jcasType).casFeatCode_itemList), i);
jcasType.ll_cas.ll_setRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((List_Type)jcasType).casFeatCode_itemList), i, jcasType.ll_cas.ll_getFSRef(v));} | [
"public",
"void",
"setItemList",
"(",
"int",
"i",
",",
"ListItem",
"v",
")",
"{",
"if",
"(",
"List_Type",
".",
"featOkTst",
"&&",
"(",
"(",
"List_Type",
")",
"jcasType",
")",
".",
"casFeat_itemList",
"==",
"null",
")",
"jcasType",
".",
"jcas",
".",
"th... | indexed setter for itemList - sets an indexed value - contains items of the level 1. The items of the level 1 could contain further items of next level and so on in order to represent an iterative structure of list items.
@generated
@param i index in the array to set
@param v value to set into the array | [
"indexed",
"setter",
"for",
"itemList",
"-",
"sets",
"an",
"indexed",
"value",
"-",
"contains",
"items",
"of",
"the",
"level",
"1",
".",
"The",
"items",
"of",
"the",
"level",
"1",
"could",
"contain",
"further",
"items",
"of",
"next",
"level",
"and",
"so"... | train | https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_typesystem/src/main/java/de/julielab/jules/types/List.java#L116-L120 |
gallandarakhneorg/afc | core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/endian/EndianNumbers.java | EndianNumbers.toLEInt | @Pure
public static int toLEInt(int b1, int b2, int b3, int b4) {
return ((b4 & 0xFF) << 24) + ((b3 & 0xFF) << 16) + ((b2 & 0xFF) << 8) + (b1 & 0xFF);
} | java | @Pure
public static int toLEInt(int b1, int b2, int b3, int b4) {
return ((b4 & 0xFF) << 24) + ((b3 & 0xFF) << 16) + ((b2 & 0xFF) << 8) + (b1 & 0xFF);
} | [
"@",
"Pure",
"public",
"static",
"int",
"toLEInt",
"(",
"int",
"b1",
",",
"int",
"b2",
",",
"int",
"b3",
",",
"int",
"b4",
")",
"{",
"return",
"(",
"(",
"b4",
"&",
"0xFF",
")",
"<<",
"24",
")",
"+",
"(",
"(",
"b3",
"&",
"0xFF",
")",
"<<",
"... | Converting four bytes to a Little Endian integer.
@param b1 the first byte.
@param b2 the second byte.
@param b3 the third byte.
@param b4 the fourth byte.
@return the conversion result | [
"Converting",
"four",
"bytes",
"to",
"a",
"Little",
"Endian",
"integer",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/endian/EndianNumbers.java#L75-L78 |
feedzai/pdb | src/main/java/com/feedzai/commons/sql/abstraction/engine/AbstractDatabaseEngine.java | AbstractDatabaseEngine.beginTransaction | @Override
public synchronized void beginTransaction() throws DatabaseEngineRuntimeException {
/*
* It makes sense trying to reconnect since it's the beginning of a transaction.
*/
try {
getConnection();
if (!conn.getAutoCommit()) { //I.E. Manual control
logger.debug("There's already one transaction active");
return;
}
conn.setAutoCommit(false);
} catch (final Exception ex) {
throw new DatabaseEngineRuntimeException("Error occurred while starting transaction", ex);
}
} | java | @Override
public synchronized void beginTransaction() throws DatabaseEngineRuntimeException {
/*
* It makes sense trying to reconnect since it's the beginning of a transaction.
*/
try {
getConnection();
if (!conn.getAutoCommit()) { //I.E. Manual control
logger.debug("There's already one transaction active");
return;
}
conn.setAutoCommit(false);
} catch (final Exception ex) {
throw new DatabaseEngineRuntimeException("Error occurred while starting transaction", ex);
}
} | [
"@",
"Override",
"public",
"synchronized",
"void",
"beginTransaction",
"(",
")",
"throws",
"DatabaseEngineRuntimeException",
"{",
"/*\n * It makes sense trying to reconnect since it's the beginning of a transaction.\n */",
"try",
"{",
"getConnection",
"(",
")",
";",... | Starts a transaction. Doing this will set auto commit to false ({@link Connection#getAutoCommit()}).
@throws DatabaseEngineRuntimeException If something goes wrong while beginning transaction. | [
"Starts",
"a",
"transaction",
".",
"Doing",
"this",
"will",
"set",
"auto",
"commit",
"to",
"false",
"(",
"{",
"@link",
"Connection#getAutoCommit",
"()",
"}",
")",
"."
] | train | https://github.com/feedzai/pdb/blob/fe07ca08417e0ddcd620a36aa1fdbca7f338be98/src/main/java/com/feedzai/commons/sql/abstraction/engine/AbstractDatabaseEngine.java#L474-L490 |
katjahahn/PortEx | src/main/java/com/github/katjahahn/parser/PEData.java | PEData.readMSDOSLoadModule | @Beta
// TODO maybe load with PELoader
public MSDOSLoadModule readMSDOSLoadModule() throws IOException {
MSDOSLoadModule module = new MSDOSLoadModule(msdos, file);
module.read();
return module;
} | java | @Beta
// TODO maybe load with PELoader
public MSDOSLoadModule readMSDOSLoadModule() throws IOException {
MSDOSLoadModule module = new MSDOSLoadModule(msdos, file);
module.read();
return module;
} | [
"@",
"Beta",
"// TODO maybe load with PELoader",
"public",
"MSDOSLoadModule",
"readMSDOSLoadModule",
"(",
")",
"throws",
"IOException",
"{",
"MSDOSLoadModule",
"module",
"=",
"new",
"MSDOSLoadModule",
"(",
"msdos",
",",
"file",
")",
";",
"module",
".",
"read",
"(",
... | Reads and returns the {@link MSDOSLoadModule}.
@return msdos load module
@throws IOException if load module can not be read. | [
"Reads",
"and",
"returns",
"the",
"{",
"@link",
"MSDOSLoadModule",
"}",
"."
] | train | https://github.com/katjahahn/PortEx/blob/319f08560aa58e3d5d7abe346ffdf623d6dc6990/src/main/java/com/github/katjahahn/parser/PEData.java#L124-L130 |
alkacon/opencms-core | src-gwt/org/opencms/gwt/client/ui/CmsNotification.java | CmsNotification.sendBusy | public CmsNotificationMessage sendBusy(Type type, final String message) {
CmsNotificationMessage notificationMessage = new CmsNotificationMessage(Mode.BUSY, type, message);
m_messages.add(notificationMessage);
if (hasWidget()) {
m_widget.addMessage(notificationMessage);
}
return notificationMessage;
} | java | public CmsNotificationMessage sendBusy(Type type, final String message) {
CmsNotificationMessage notificationMessage = new CmsNotificationMessage(Mode.BUSY, type, message);
m_messages.add(notificationMessage);
if (hasWidget()) {
m_widget.addMessage(notificationMessage);
}
return notificationMessage;
} | [
"public",
"CmsNotificationMessage",
"sendBusy",
"(",
"Type",
"type",
",",
"final",
"String",
"message",
")",
"{",
"CmsNotificationMessage",
"notificationMessage",
"=",
"new",
"CmsNotificationMessage",
"(",
"Mode",
".",
"BUSY",
",",
"type",
",",
"message",
")",
";"... | Sends a new blocking notification that can not be removed by the user.<p>
@param type the notification type
@param message the message
@return the message, use to hide the message | [
"Sends",
"a",
"new",
"blocking",
"notification",
"that",
"can",
"not",
"be",
"removed",
"by",
"the",
"user",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/CmsNotification.java#L191-L199 |
apache/incubator-heron | heron/scheduler-core/src/java/org/apache/heron/scheduler/utils/LauncherUtils.java | LauncherUtils.createConfigWithPackingDetails | public Config createConfigWithPackingDetails(Config runtime, PackingPlan packing) {
return Config.newBuilder()
.putAll(runtime)
.put(Key.COMPONENT_RAMMAP, packing.getComponentRamDistribution())
.put(Key.NUM_CONTAINERS, 1 + packing.getContainers().size())
.build();
} | java | public Config createConfigWithPackingDetails(Config runtime, PackingPlan packing) {
return Config.newBuilder()
.putAll(runtime)
.put(Key.COMPONENT_RAMMAP, packing.getComponentRamDistribution())
.put(Key.NUM_CONTAINERS, 1 + packing.getContainers().size())
.build();
} | [
"public",
"Config",
"createConfigWithPackingDetails",
"(",
"Config",
"runtime",
",",
"PackingPlan",
"packing",
")",
"{",
"return",
"Config",
".",
"newBuilder",
"(",
")",
".",
"putAll",
"(",
"runtime",
")",
".",
"put",
"(",
"Key",
".",
"COMPONENT_RAMMAP",
",",
... | Creates a config instance with packing plan info added to runtime config
@return packing details config | [
"Creates",
"a",
"config",
"instance",
"with",
"packing",
"plan",
"info",
"added",
"to",
"runtime",
"config"
] | train | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/scheduler-core/src/java/org/apache/heron/scheduler/utils/LauncherUtils.java#L162-L168 |
sarl/sarl | main/internalmaven/sarl-maven-plugin/src/main/java/io/sarl/maven/compiler/AbstractSarlMojo.java | AbstractSarlMojo.makeAbsolute | protected File makeAbsolute(File file) {
if (!file.isAbsolute()) {
final File basedir = this.mavenHelper.getSession().getCurrentProject().getBasedir();
return new File(basedir, file.getPath()).getAbsoluteFile();
}
return file;
} | java | protected File makeAbsolute(File file) {
if (!file.isAbsolute()) {
final File basedir = this.mavenHelper.getSession().getCurrentProject().getBasedir();
return new File(basedir, file.getPath()).getAbsoluteFile();
}
return file;
} | [
"protected",
"File",
"makeAbsolute",
"(",
"File",
"file",
")",
"{",
"if",
"(",
"!",
"file",
".",
"isAbsolute",
"(",
")",
")",
"{",
"final",
"File",
"basedir",
"=",
"this",
".",
"mavenHelper",
".",
"getSession",
"(",
")",
".",
"getCurrentProject",
"(",
... | Make absolute the given filename, relatively to the project's folder.
@param file the file to convert.
@return the absolute filename. | [
"Make",
"absolute",
"the",
"given",
"filename",
"relatively",
"to",
"the",
"project",
"s",
"folder",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/internalmaven/sarl-maven-plugin/src/main/java/io/sarl/maven/compiler/AbstractSarlMojo.java#L154-L160 |
gearpump/gearpump | core/src/main/java/io/gearpump/transport/netty/MessageDecoder.java | MessageDecoder.decode | protected List<TaskMessage> decode(ChannelHandlerContext ctx, Channel channel,
ChannelBuffer buf) {
this.dataInput.setChannelBuffer(buf);
final int SESSION_LENGTH = 4; //int
final int SOURCE_TASK_LENGTH = 8; //long
final int TARGET_TASK_LENGTH = 8; //long
final int MESSAGE_LENGTH = 4; //int
final int HEADER_LENGTH = SESSION_LENGTH + SOURCE_TASK_LENGTH + TARGET_TASK_LENGTH + MESSAGE_LENGTH;
// Make sure that we have received at least a short message
long available = buf.readableBytes();
if (available < HEADER_LENGTH) {
//need more data
return null;
}
List<TaskMessage> taskMessageList = new ArrayList<TaskMessage>();
// Use while loop, try to decode as more messages as possible in single call
while (available >= HEADER_LENGTH) {
// Mark the current buffer position before reading task/len field
// because the whole frame might not be in the buffer yet.
// We will reset the buffer position to the marked position if
// there's not enough bytes in the buffer.
buf.markReaderIndex();
int sessionId = buf.readInt();
long targetTask = buf.readLong();
long sourceTask = buf.readLong();
// Read the length field.
int length = buf.readInt();
available -= HEADER_LENGTH;
if (length <= 0) {
taskMessageList.add(new TaskMessage(sessionId, targetTask, sourceTask, null));
break;
}
// Make sure if there's enough bytes in the buffer.
if (available < length) {
// The whole bytes were not received yet - return null.
buf.resetReaderIndex();
break;
}
available -= length;
// There's enough bytes in the buffer. Read it.
Object message = serializer.deserialize(dataInput, length);
// Successfully decoded a frame.
// Return a TaskMessage object
taskMessageList.add(new TaskMessage(sessionId, targetTask, sourceTask, message));
}
return taskMessageList.size() == 0 ? null : taskMessageList;
} | java | protected List<TaskMessage> decode(ChannelHandlerContext ctx, Channel channel,
ChannelBuffer buf) {
this.dataInput.setChannelBuffer(buf);
final int SESSION_LENGTH = 4; //int
final int SOURCE_TASK_LENGTH = 8; //long
final int TARGET_TASK_LENGTH = 8; //long
final int MESSAGE_LENGTH = 4; //int
final int HEADER_LENGTH = SESSION_LENGTH + SOURCE_TASK_LENGTH + TARGET_TASK_LENGTH + MESSAGE_LENGTH;
// Make sure that we have received at least a short message
long available = buf.readableBytes();
if (available < HEADER_LENGTH) {
//need more data
return null;
}
List<TaskMessage> taskMessageList = new ArrayList<TaskMessage>();
// Use while loop, try to decode as more messages as possible in single call
while (available >= HEADER_LENGTH) {
// Mark the current buffer position before reading task/len field
// because the whole frame might not be in the buffer yet.
// We will reset the buffer position to the marked position if
// there's not enough bytes in the buffer.
buf.markReaderIndex();
int sessionId = buf.readInt();
long targetTask = buf.readLong();
long sourceTask = buf.readLong();
// Read the length field.
int length = buf.readInt();
available -= HEADER_LENGTH;
if (length <= 0) {
taskMessageList.add(new TaskMessage(sessionId, targetTask, sourceTask, null));
break;
}
// Make sure if there's enough bytes in the buffer.
if (available < length) {
// The whole bytes were not received yet - return null.
buf.resetReaderIndex();
break;
}
available -= length;
// There's enough bytes in the buffer. Read it.
Object message = serializer.deserialize(dataInput, length);
// Successfully decoded a frame.
// Return a TaskMessage object
taskMessageList.add(new TaskMessage(sessionId, targetTask, sourceTask, message));
}
return taskMessageList.size() == 0 ? null : taskMessageList;
} | [
"protected",
"List",
"<",
"TaskMessage",
">",
"decode",
"(",
"ChannelHandlerContext",
"ctx",
",",
"Channel",
"channel",
",",
"ChannelBuffer",
"buf",
")",
"{",
"this",
".",
"dataInput",
".",
"setChannelBuffer",
"(",
"buf",
")",
";",
"final",
"int",
"SESSION_LEN... | /*
Each TaskMessage is encoded as:
sessionId ... int(4)
source task ... long(8)
target task ... long(8)
len ... int(4)
payload ... byte[] * | [
"/",
"*",
"Each",
"TaskMessage",
"is",
"encoded",
"as",
":",
"sessionId",
"...",
"int",
"(",
"4",
")",
"source",
"task",
"...",
"long",
"(",
"8",
")",
"target",
"task",
"...",
"long",
"(",
"8",
")",
"len",
"...",
"int",
"(",
"4",
")",
"payload",
... | train | https://github.com/gearpump/gearpump/blob/6f505aad25d5b8f54976867dbf4e752f13f9702e/core/src/main/java/io/gearpump/transport/netty/MessageDecoder.java#L41-L99 |
dlemmermann/CalendarFX | CalendarFXRecurrence/src/main/java/com/google/ical/compat/javatime/LocalDateIteratorFactory.java | LocalDateIteratorFactory.createLocalDateIterator | public static LocalDateIterator createLocalDateIterator(String rdata,
LocalDate start, boolean strict) throws ParseException {
return createLocalDateIterator(rdata, start, ZoneId.of("UTC"), strict);
} | java | public static LocalDateIterator createLocalDateIterator(String rdata,
LocalDate start, boolean strict) throws ParseException {
return createLocalDateIterator(rdata, start, ZoneId.of("UTC"), strict);
} | [
"public",
"static",
"LocalDateIterator",
"createLocalDateIterator",
"(",
"String",
"rdata",
",",
"LocalDate",
"start",
",",
"boolean",
"strict",
")",
"throws",
"ParseException",
"{",
"return",
"createLocalDateIterator",
"(",
"rdata",
",",
"start",
",",
"ZoneId",
"."... | given a block of RRULE, EXRULE, RDATE, and EXDATE content lines, parse
them into a single local date iterator.
@param rdata
RRULE, EXRULE, RDATE, and EXDATE lines.
@param start
the first occurrence of the series.
@param strict
true if any failure to parse should result in a
ParseException. false causes bad content lines to be logged
and ignored. | [
"given",
"a",
"block",
"of",
"RRULE",
"EXRULE",
"RDATE",
"and",
"EXDATE",
"content",
"lines",
"parse",
"them",
"into",
"a",
"single",
"local",
"date",
"iterator",
"."
] | train | https://github.com/dlemmermann/CalendarFX/blob/f2b91c2622c3f29d004485b6426b23b86c331f96/CalendarFXRecurrence/src/main/java/com/google/ical/compat/javatime/LocalDateIteratorFactory.java#L81-L84 |
OpenLiberty/open-liberty | dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/SSLUtils.java | SSLUtils.allocateByteBuffer | public static WsByteBuffer allocateByteBuffer(int size, boolean allocateDirect) {
WsByteBuffer newBuffer = null;
// Allocate based on the input parameter.
if (allocateDirect) {
newBuffer = ChannelFrameworkFactory.getBufferManager().allocateDirect(size);
} else {
newBuffer = ChannelFrameworkFactory.getBufferManager().allocate(size);
}
// Shift the limit to the capacity to maximize the space available in the buffer.
newBuffer.limit(newBuffer.capacity());
return newBuffer;
} | java | public static WsByteBuffer allocateByteBuffer(int size, boolean allocateDirect) {
WsByteBuffer newBuffer = null;
// Allocate based on the input parameter.
if (allocateDirect) {
newBuffer = ChannelFrameworkFactory.getBufferManager().allocateDirect(size);
} else {
newBuffer = ChannelFrameworkFactory.getBufferManager().allocate(size);
}
// Shift the limit to the capacity to maximize the space available in the buffer.
newBuffer.limit(newBuffer.capacity());
return newBuffer;
} | [
"public",
"static",
"WsByteBuffer",
"allocateByteBuffer",
"(",
"int",
"size",
",",
"boolean",
"allocateDirect",
")",
"{",
"WsByteBuffer",
"newBuffer",
"=",
"null",
";",
"// Allocate based on the input parameter.",
"if",
"(",
"allocateDirect",
")",
"{",
"newBuffer",
"=... | Allocate a ByteBuffer per the SSL config at least as big as the input size.
@param size Minimum size of the resulting buffer.
@param allocateDirect flag to indicate if allocation should be done with direct byte buffers.
@return Newly allocated ByteBuffer | [
"Allocate",
"a",
"ByteBuffer",
"per",
"the",
"SSL",
"config",
"at",
"least",
"as",
"big",
"as",
"the",
"input",
"size",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/SSLUtils.java#L428-L439 |
wildfly/wildfly-core | server/src/main/java/org/jboss/as/server/deploymentoverlay/AffectedDeploymentOverlay.java | AffectedDeploymentOverlay.redeployDeployments | public static void redeployDeployments(OperationContext context, PathAddress deploymentsRootAddress, Set<String> deploymentNames) throws OperationFailedException {
for (String deploymentName : deploymentNames) {
PathAddress address = deploymentsRootAddress.append(DEPLOYMENT, deploymentName);
OperationStepHandler handler = context.getRootResourceRegistration().getOperationHandler(address, REDEPLOY);
ModelNode operation = addRedeployStep(address);
ServerLogger.AS_ROOT_LOGGER.debugf("Redeploying %s at address %s with handler %s", deploymentName, address, handler);
assert handler != null;
assert operation.isDefined();
context.addStep(operation, handler, OperationContext.Stage.MODEL);
}
} | java | public static void redeployDeployments(OperationContext context, PathAddress deploymentsRootAddress, Set<String> deploymentNames) throws OperationFailedException {
for (String deploymentName : deploymentNames) {
PathAddress address = deploymentsRootAddress.append(DEPLOYMENT, deploymentName);
OperationStepHandler handler = context.getRootResourceRegistration().getOperationHandler(address, REDEPLOY);
ModelNode operation = addRedeployStep(address);
ServerLogger.AS_ROOT_LOGGER.debugf("Redeploying %s at address %s with handler %s", deploymentName, address, handler);
assert handler != null;
assert operation.isDefined();
context.addStep(operation, handler, OperationContext.Stage.MODEL);
}
} | [
"public",
"static",
"void",
"redeployDeployments",
"(",
"OperationContext",
"context",
",",
"PathAddress",
"deploymentsRootAddress",
",",
"Set",
"<",
"String",
">",
"deploymentNames",
")",
"throws",
"OperationFailedException",
"{",
"for",
"(",
"String",
"deploymentName"... | We are adding a redeploy operation step for each specified deployment runtime name.
@param context
@param deploymentsRootAddress
@param deploymentNames
@throws OperationFailedException | [
"We",
"are",
"adding",
"a",
"redeploy",
"operation",
"step",
"for",
"each",
"specified",
"deployment",
"runtime",
"name",
"."
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/deploymentoverlay/AffectedDeploymentOverlay.java#L128-L138 |
netty/netty | handler/src/main/java/io/netty/handler/ssl/SslContext.java | SslContext.buildTrustManagerFactory | @Deprecated
protected static TrustManagerFactory buildTrustManagerFactory(
File certChainFile, TrustManagerFactory trustManagerFactory)
throws NoSuchAlgorithmException, CertificateException, KeyStoreException, IOException {
X509Certificate[] x509Certs = toX509Certificates(certChainFile);
return buildTrustManagerFactory(x509Certs, trustManagerFactory);
} | java | @Deprecated
protected static TrustManagerFactory buildTrustManagerFactory(
File certChainFile, TrustManagerFactory trustManagerFactory)
throws NoSuchAlgorithmException, CertificateException, KeyStoreException, IOException {
X509Certificate[] x509Certs = toX509Certificates(certChainFile);
return buildTrustManagerFactory(x509Certs, trustManagerFactory);
} | [
"@",
"Deprecated",
"protected",
"static",
"TrustManagerFactory",
"buildTrustManagerFactory",
"(",
"File",
"certChainFile",
",",
"TrustManagerFactory",
"trustManagerFactory",
")",
"throws",
"NoSuchAlgorithmException",
",",
"CertificateException",
",",
"KeyStoreException",
",",
... | Build a {@link TrustManagerFactory} from a certificate chain file.
@param certChainFile The certificate file to build from.
@param trustManagerFactory The existing {@link TrustManagerFactory} that will be used if not {@code null}.
@return A {@link TrustManagerFactory} which contains the certificates in {@code certChainFile} | [
"Build",
"a",
"{"
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/SslContext.java#L1094-L1101 |
osmdroid/osmdroid | osmdroid-android/src/main/java/org/osmdroid/util/TileSystem.java | TileSystem.TileXYToQuadKey | public static String TileXYToQuadKey(final int tileX, final int tileY, final int levelOfDetail) {
final char[] quadKey = new char[levelOfDetail];
for (int i = 0 ; i < levelOfDetail; i++) {
char digit = '0';
final int mask = 1 << i;
if ((tileX & mask) != 0) {
digit++;
}
if ((tileY & mask) != 0) {
digit++;
digit++;
}
quadKey[levelOfDetail - i - 1] = digit;
}
return new String(quadKey);
} | java | public static String TileXYToQuadKey(final int tileX, final int tileY, final int levelOfDetail) {
final char[] quadKey = new char[levelOfDetail];
for (int i = 0 ; i < levelOfDetail; i++) {
char digit = '0';
final int mask = 1 << i;
if ((tileX & mask) != 0) {
digit++;
}
if ((tileY & mask) != 0) {
digit++;
digit++;
}
quadKey[levelOfDetail - i - 1] = digit;
}
return new String(quadKey);
} | [
"public",
"static",
"String",
"TileXYToQuadKey",
"(",
"final",
"int",
"tileX",
",",
"final",
"int",
"tileY",
",",
"final",
"int",
"levelOfDetail",
")",
"{",
"final",
"char",
"[",
"]",
"quadKey",
"=",
"new",
"char",
"[",
"levelOfDetail",
"]",
";",
"for",
... | Use {@link MapTileIndex#getTileIndex(int, int, int)} instead
Quadkey principles can be found at https://msdn.microsoft.com/en-us/library/bb259689.aspx
Works only for zoom level >= 1 | [
"Use",
"{"
] | train | https://github.com/osmdroid/osmdroid/blob/3b178b2f078497dd88c137110e87aafe45ad2b16/osmdroid-android/src/main/java/org/osmdroid/util/TileSystem.java#L341-L356 |
wisdom-framework/wisdom | framework/resource-controller/src/main/java/org/wisdom/resources/WebJarController.java | WebJarController.modifiedBundle | @Override
public void modifiedBundle(Bundle bundle, BundleEvent bundleEvent, List<BundleWebJarLib> webJarLibs) {
// Remove all WebJars from the given bundle, and then read tem.
synchronized (this) {
removedBundle(bundle, bundleEvent, webJarLibs);
addingBundle(bundle, bundleEvent);
}
} | java | @Override
public void modifiedBundle(Bundle bundle, BundleEvent bundleEvent, List<BundleWebJarLib> webJarLibs) {
// Remove all WebJars from the given bundle, and then read tem.
synchronized (this) {
removedBundle(bundle, bundleEvent, webJarLibs);
addingBundle(bundle, bundleEvent);
}
} | [
"@",
"Override",
"public",
"void",
"modifiedBundle",
"(",
"Bundle",
"bundle",
",",
"BundleEvent",
"bundleEvent",
",",
"List",
"<",
"BundleWebJarLib",
">",
"webJarLibs",
")",
"{",
"// Remove all WebJars from the given bundle, and then read tem.",
"synchronized",
"(",
"this... | A bundle is updated.
@param bundle the bundle
@param bundleEvent the event
@param webJarLibs the webjars that were embedded in the previous version of the bundle. | [
"A",
"bundle",
"is",
"updated",
"."
] | train | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/framework/resource-controller/src/main/java/org/wisdom/resources/WebJarController.java#L340-L347 |
tzaeschke/zoodb | src/org/zoodb/internal/DataDeSerializer.java | DataDeSerializer.readObject | public ZooPC readObject(int page, int offs, boolean skipIfCached) {
long clsOid = in.startReading(page, offs);
long ts = in.getHeaderTimestamp();
//Read first object:
long oid = in.readLong();
//check cache
ZooPC pc = cache.findCoByOID(oid);
if (skipIfCached && pc != null) {
if (pc.jdoZooIsDeleted() || !pc.jdoZooIsStateHollow()) {
//isDeleted() are filtered out later.
return pc;
}
}
ZooClassDef clsDef = cache.getSchema(clsOid);
ObjectReader or = in;
boolean isEvolved = false;
if (clsDef.getNextVersion() != null) {
isEvolved = true;
GenericObject go = GenericObject.newInstance(clsDef, oid, false, cache);
readGOPrivate(go, clsDef);
clsDef = go.ensureLatestVersion();
in = go.toStream();
if (oid != in.readLong()) {
throw new IllegalStateException();
}
}
ZooPC pObj = getInstance(clsDef, oid, pc);
pObj.jdoZooSetTimestamp(ts);
readObjPrivate(pObj, clsDef);
in = or;
if (isEvolved) {
//force object to be stored again
//TODO is this necessary?
pObj.jdoZooMarkDirty();
}
return pObj;
} | java | public ZooPC readObject(int page, int offs, boolean skipIfCached) {
long clsOid = in.startReading(page, offs);
long ts = in.getHeaderTimestamp();
//Read first object:
long oid = in.readLong();
//check cache
ZooPC pc = cache.findCoByOID(oid);
if (skipIfCached && pc != null) {
if (pc.jdoZooIsDeleted() || !pc.jdoZooIsStateHollow()) {
//isDeleted() are filtered out later.
return pc;
}
}
ZooClassDef clsDef = cache.getSchema(clsOid);
ObjectReader or = in;
boolean isEvolved = false;
if (clsDef.getNextVersion() != null) {
isEvolved = true;
GenericObject go = GenericObject.newInstance(clsDef, oid, false, cache);
readGOPrivate(go, clsDef);
clsDef = go.ensureLatestVersion();
in = go.toStream();
if (oid != in.readLong()) {
throw new IllegalStateException();
}
}
ZooPC pObj = getInstance(clsDef, oid, pc);
pObj.jdoZooSetTimestamp(ts);
readObjPrivate(pObj, clsDef);
in = or;
if (isEvolved) {
//force object to be stored again
//TODO is this necessary?
pObj.jdoZooMarkDirty();
}
return pObj;
} | [
"public",
"ZooPC",
"readObject",
"(",
"int",
"page",
",",
"int",
"offs",
",",
"boolean",
"skipIfCached",
")",
"{",
"long",
"clsOid",
"=",
"in",
".",
"startReading",
"(",
"page",
",",
"offs",
")",
";",
"long",
"ts",
"=",
"in",
".",
"getHeaderTimestamp",
... | This method returns an object that is read from the input
stream.
@param page page id
@param offs offset in page
@param skipIfCached Set 'true' to skip objects that are already in the cache
@return The read object. | [
"This",
"method",
"returns",
"an",
"object",
"that",
"is",
"read",
"from",
"the",
"input",
"stream",
"."
] | train | https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/internal/DataDeSerializer.java#L152-L194 |
camunda/camunda-commons | utils/src/main/java/org/camunda/commons/utils/EnsureUtil.java | EnsureUtil.ensureNotNull | public static void ensureNotNull(String parameterName, Object value) {
if(value == null) {
throw LOG.parameterIsNullException(parameterName);
}
} | java | public static void ensureNotNull(String parameterName, Object value) {
if(value == null) {
throw LOG.parameterIsNullException(parameterName);
}
} | [
"public",
"static",
"void",
"ensureNotNull",
"(",
"String",
"parameterName",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"throw",
"LOG",
".",
"parameterIsNullException",
"(",
"parameterName",
")",
";",
"}",
"}"
] | Ensures that the parameter is not null.
@param parameterName the parameter name
@param value the value to ensure to be not null
@throws IllegalArgumentException if the parameter value is null | [
"Ensures",
"that",
"the",
"parameter",
"is",
"not",
"null",
"."
] | train | https://github.com/camunda/camunda-commons/blob/bd3195db47c92c25717288fe9e6735f8e882f247/utils/src/main/java/org/camunda/commons/utils/EnsureUtil.java#L33-L37 |
OpenNTF/JavascriptAggregator | jaggr-core/src/main/java/com/ibm/jaggr/core/impl/modulebuilder/less/LessModuleBuilder.java | LessModuleBuilder._inlineImports | protected String _inlineImports(HttpServletRequest req, String css, IResource res, String path) throws IOException {
return super.inlineImports(req, css, res, path);
} | java | protected String _inlineImports(HttpServletRequest req, String css, IResource res, String path) throws IOException {
return super.inlineImports(req, css, res, path);
} | [
"protected",
"String",
"_inlineImports",
"(",
"HttpServletRequest",
"req",
",",
"String",
"css",
",",
"IResource",
"res",
",",
"String",
"path",
")",
"throws",
"IOException",
"{",
"return",
"super",
".",
"inlineImports",
"(",
"req",
",",
"css",
",",
"res",
"... | Called by our <code>postcss</code> method to inline imports not processed by the LESS compiler
(i.e. CSS imports) <b>after</b> the LESS compiler has processed the input.
@param req
The request associated with the call.
@param css
The current CSS containing @import statements to be
processed
@param res
The resource for the CSS file.
@param path
The path, as specified in the @import statement used to
import the current CSS, or null if this is the top level CSS.
@return The input CSS with @import statements replaced with the
contents of the imported files.
@throws IOException | [
"Called",
"by",
"our",
"<code",
">",
"postcss<",
"/",
"code",
">",
"method",
"to",
"inline",
"imports",
"not",
"processed",
"by",
"the",
"LESS",
"compiler",
"(",
"i",
".",
"e",
".",
"CSS",
"imports",
")",
"<b",
">",
"after<",
"/",
"b",
">",
"the",
... | train | https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-core/src/main/java/com/ibm/jaggr/core/impl/modulebuilder/less/LessModuleBuilder.java#L233-L235 |
vanilladb/vanillacore | src/main/java/org/vanilladb/core/query/planner/opt/TablePlanner.java | TablePlanner.makeProductPlan | public Plan makeProductPlan(Plan trunk) {
Plan p = makeSelectPlan();
return new MultiBufferProductPlan(trunk, p, tx);
} | java | public Plan makeProductPlan(Plan trunk) {
Plan p = makeSelectPlan();
return new MultiBufferProductPlan(trunk, p, tx);
} | [
"public",
"Plan",
"makeProductPlan",
"(",
"Plan",
"trunk",
")",
"{",
"Plan",
"p",
"=",
"makeSelectPlan",
"(",
")",
";",
"return",
"new",
"MultiBufferProductPlan",
"(",
"trunk",
",",
"p",
",",
"tx",
")",
";",
"}"
] | Constructs a product plan of the specified trunk and this table.
<p>
The select predicate applicable to this table is pushed down below the
product.
</p>
@param trunk
the specified trunk of join
@return a product plan of the trunk and this table | [
"Constructs",
"a",
"product",
"plan",
"of",
"the",
"specified",
"trunk",
"and",
"this",
"table",
"."
] | train | https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/query/planner/opt/TablePlanner.java#L138-L141 |
grpc/grpc-java | examples/src/main/java/io/grpc/examples/errorhandling/ErrorHandlingClient.java | ErrorHandlingClient.advancedAsyncCall | void advancedAsyncCall() {
ClientCall<HelloRequest, HelloReply> call =
channel.newCall(GreeterGrpc.getSayHelloMethod(), CallOptions.DEFAULT);
final CountDownLatch latch = new CountDownLatch(1);
call.start(new ClientCall.Listener<HelloReply>() {
@Override
public void onClose(Status status, Metadata trailers) {
Verify.verify(status.getCode() == Status.Code.INTERNAL);
Verify.verify(status.getDescription().contains("Narwhal"));
// Cause is not transmitted over the wire.
latch.countDown();
}
}, new Metadata());
call.sendMessage(HelloRequest.newBuilder().setName("Marge").build());
call.halfClose();
if (!Uninterruptibles.awaitUninterruptibly(latch, 1, TimeUnit.SECONDS)) {
throw new RuntimeException("timeout!");
}
} | java | void advancedAsyncCall() {
ClientCall<HelloRequest, HelloReply> call =
channel.newCall(GreeterGrpc.getSayHelloMethod(), CallOptions.DEFAULT);
final CountDownLatch latch = new CountDownLatch(1);
call.start(new ClientCall.Listener<HelloReply>() {
@Override
public void onClose(Status status, Metadata trailers) {
Verify.verify(status.getCode() == Status.Code.INTERNAL);
Verify.verify(status.getDescription().contains("Narwhal"));
// Cause is not transmitted over the wire.
latch.countDown();
}
}, new Metadata());
call.sendMessage(HelloRequest.newBuilder().setName("Marge").build());
call.halfClose();
if (!Uninterruptibles.awaitUninterruptibly(latch, 1, TimeUnit.SECONDS)) {
throw new RuntimeException("timeout!");
}
} | [
"void",
"advancedAsyncCall",
"(",
")",
"{",
"ClientCall",
"<",
"HelloRequest",
",",
"HelloReply",
">",
"call",
"=",
"channel",
".",
"newCall",
"(",
"GreeterGrpc",
".",
"getSayHelloMethod",
"(",
")",
",",
"CallOptions",
".",
"DEFAULT",
")",
";",
"final",
"Cou... | This is more advanced and does not make use of the stub. You should not normally need to do
this, but here is how you would. | [
"This",
"is",
"more",
"advanced",
"and",
"does",
"not",
"make",
"use",
"of",
"the",
"stub",
".",
"You",
"should",
"not",
"normally",
"need",
"to",
"do",
"this",
"but",
"here",
"is",
"how",
"you",
"would",
"."
] | train | https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/examples/src/main/java/io/grpc/examples/errorhandling/ErrorHandlingClient.java#L178-L201 |
alkacon/opencms-core | src/org/opencms/db/CmsDriverManager.java | CmsDriverManager.wrapDriverInProfilingProxy | private Object wrapDriverInProfilingProxy(Object newDriverInstance) {
Class<?> cls = getDriverInterfaceForProxy(newDriverInstance);
if (cls == null) {
return newDriverInstance;
}
return Proxy.newProxyInstance(
Thread.currentThread().getContextClassLoader(),
new Class[] {cls},
new CmsProfilingInvocationHandler(newDriverInstance, CmsDefaultProfilingHandler.INSTANCE));
} | java | private Object wrapDriverInProfilingProxy(Object newDriverInstance) {
Class<?> cls = getDriverInterfaceForProxy(newDriverInstance);
if (cls == null) {
return newDriverInstance;
}
return Proxy.newProxyInstance(
Thread.currentThread().getContextClassLoader(),
new Class[] {cls},
new CmsProfilingInvocationHandler(newDriverInstance, CmsDefaultProfilingHandler.INSTANCE));
} | [
"private",
"Object",
"wrapDriverInProfilingProxy",
"(",
"Object",
"newDriverInstance",
")",
"{",
"Class",
"<",
"?",
">",
"cls",
"=",
"getDriverInterfaceForProxy",
"(",
"newDriverInstance",
")",
";",
"if",
"(",
"cls",
"==",
"null",
")",
"{",
"return",
"newDriverI... | Wraps a driver object with a dynamic proxy that counts method calls and their durations.<p>
@param newDriverInstance the driver instance to wrap
@return the proxy | [
"Wraps",
"a",
"driver",
"object",
"with",
"a",
"dynamic",
"proxy",
"that",
"counts",
"method",
"calls",
"and",
"their",
"durations",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsDriverManager.java#L11984-L11994 |
youngmonkeys/ezyfox-sfs2x | src/main/java/com/tvd12/ezyfox/sfs2x/clienthandler/ClientEventHandler.java | ClientEventHandler.responseClient | private void responseClient(RequestResponseClass clazz, Object listener, User user) {
if(!clazz.isResponseToClient()) return;
String command = clazz.getResponseCommand();
ISFSObject params = (ISFSObject) new ParamTransformer(context)
.transform(listener).getObject();
send(command, params, user);
} | java | private void responseClient(RequestResponseClass clazz, Object listener, User user) {
if(!clazz.isResponseToClient()) return;
String command = clazz.getResponseCommand();
ISFSObject params = (ISFSObject) new ParamTransformer(context)
.transform(listener).getObject();
send(command, params, user);
} | [
"private",
"void",
"responseClient",
"(",
"RequestResponseClass",
"clazz",
",",
"Object",
"listener",
",",
"User",
"user",
")",
"{",
"if",
"(",
"!",
"clazz",
".",
"isResponseToClient",
"(",
")",
")",
"return",
";",
"String",
"command",
"=",
"clazz",
".",
"... | Response information to client
@param clazz structure of listener class
@param listener listener object
@param user smartfox user | [
"Response",
"information",
"to",
"client"
] | train | https://github.com/youngmonkeys/ezyfox-sfs2x/blob/7e004033a3b551c3ae970a0c8f45db7b1ec144de/src/main/java/com/tvd12/ezyfox/sfs2x/clienthandler/ClientEventHandler.java#L146-L152 |
alkacon/opencms-core | src-gwt/org/opencms/ade/galleries/client/preview/CmsCroppingParamBean.java | CmsCroppingParamBean.getRestrictedSizeScaleParam | public String getRestrictedSizeScaleParam(int maxHeight, int maxWidth) {
String result = toString();
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(result)) {
return getRestrictedSizeParam(maxHeight, maxWidth).toString();
}
if ((getOrgWidth() < maxWidth) && (getOrgHeight() < maxHeight)) {
return "";
}
CmsCroppingParamBean restricted = new CmsCroppingParamBean();
restricted.setTargetHeight(maxHeight);
restricted.setTargetWidth(maxWidth);
return restricted.toString();
} | java | public String getRestrictedSizeScaleParam(int maxHeight, int maxWidth) {
String result = toString();
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(result)) {
return getRestrictedSizeParam(maxHeight, maxWidth).toString();
}
if ((getOrgWidth() < maxWidth) && (getOrgHeight() < maxHeight)) {
return "";
}
CmsCroppingParamBean restricted = new CmsCroppingParamBean();
restricted.setTargetHeight(maxHeight);
restricted.setTargetWidth(maxWidth);
return restricted.toString();
} | [
"public",
"String",
"getRestrictedSizeScaleParam",
"(",
"int",
"maxHeight",
",",
"int",
"maxWidth",
")",
"{",
"String",
"result",
"=",
"toString",
"(",
")",
";",
"if",
"(",
"CmsStringUtil",
".",
"isNotEmptyOrWhitespaceOnly",
"(",
"result",
")",
")",
"{",
"retu... | Returns the scale parameter to this bean for a restricted maximum target size.<p>
@param maxHeight the max height
@param maxWidth the max width
@return the scale parameter | [
"Returns",
"the",
"scale",
"parameter",
"to",
"this",
"bean",
"for",
"a",
"restricted",
"maximum",
"target",
"size",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/galleries/client/preview/CmsCroppingParamBean.java#L363-L376 |
loldevs/riotapi | rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java | ThrottledApiHandler.getRune | public Future<Item> getRune(int id, ItemData data, String version, String locale) {
return new DummyFuture<>(handler.getRune(id, data, version, locale));
} | java | public Future<Item> getRune(int id, ItemData data, String version, String locale) {
return new DummyFuture<>(handler.getRune(id, data, version, locale));
} | [
"public",
"Future",
"<",
"Item",
">",
"getRune",
"(",
"int",
"id",
",",
"ItemData",
"data",
",",
"String",
"version",
",",
"String",
"locale",
")",
"{",
"return",
"new",
"DummyFuture",
"<>",
"(",
"handler",
".",
"getRune",
"(",
"id",
",",
"data",
",",
... | <p>
Retrieve a specific runes
</p>
This method does not count towards the rate limit and is not affected by the throttle
@param id The id of the runes
@param data Additional information to retrieve
@param version Data dragon version for returned data
@param locale Locale code for returned data
@return The runes
@see <a href=https://developer.riotgames.com/api/methods#!/649/2168>Official API documentation</a> | [
"<p",
">",
"Retrieve",
"a",
"specific",
"runes",
"<",
"/",
"p",
">",
"This",
"method",
"does",
"not",
"count",
"towards",
"the",
"rate",
"limit",
"and",
"is",
"not",
"affected",
"by",
"the",
"throttle"
] | train | https://github.com/loldevs/riotapi/blob/0b8aac407aa5289845f249024f9732332855544f/rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java#L700-L702 |
undertow-io/undertow | core/src/main/java/io/undertow/Handlers.java | Handlers.virtualHost | public static NameVirtualHostHandler virtualHost(final HttpHandler hostHandler, String... hostnames) {
NameVirtualHostHandler handler = new NameVirtualHostHandler();
for (String host : hostnames) {
handler.addHost(host, hostHandler);
}
return handler;
} | java | public static NameVirtualHostHandler virtualHost(final HttpHandler hostHandler, String... hostnames) {
NameVirtualHostHandler handler = new NameVirtualHostHandler();
for (String host : hostnames) {
handler.addHost(host, hostHandler);
}
return handler;
} | [
"public",
"static",
"NameVirtualHostHandler",
"virtualHost",
"(",
"final",
"HttpHandler",
"hostHandler",
",",
"String",
"...",
"hostnames",
")",
"{",
"NameVirtualHostHandler",
"handler",
"=",
"new",
"NameVirtualHostHandler",
"(",
")",
";",
"for",
"(",
"String",
"hos... | Creates a new virtual host handler that uses the provided handler as the root handler for the given hostnames.
@param hostHandler The host handler
@param hostnames The host names
@return A new virtual host handler | [
"Creates",
"a",
"new",
"virtual",
"host",
"handler",
"that",
"uses",
"the",
"provided",
"handler",
"as",
"the",
"root",
"handler",
"for",
"the",
"given",
"hostnames",
"."
] | train | https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/Handlers.java#L151-L157 |
google/closure-compiler | src/com/google/javascript/jscomp/LateEs6ToEs3Converter.java | LateEs6ToEs3Converter.visitMemberFunctionDefInObjectLit | private void visitMemberFunctionDefInObjectLit(Node n, Node parent) {
String name = n.getString();
Node nameNode = n.getFirstFirstChild();
Node stringKey = withType(IR.stringKey(name, n.getFirstChild().detach()), n.getJSType());
stringKey.setJSDocInfo(n.getJSDocInfo());
parent.replaceChild(n, stringKey);
stringKey.useSourceInfoFrom(nameNode);
compiler.reportChangeToEnclosingScope(stringKey);
} | java | private void visitMemberFunctionDefInObjectLit(Node n, Node parent) {
String name = n.getString();
Node nameNode = n.getFirstFirstChild();
Node stringKey = withType(IR.stringKey(name, n.getFirstChild().detach()), n.getJSType());
stringKey.setJSDocInfo(n.getJSDocInfo());
parent.replaceChild(n, stringKey);
stringKey.useSourceInfoFrom(nameNode);
compiler.reportChangeToEnclosingScope(stringKey);
} | [
"private",
"void",
"visitMemberFunctionDefInObjectLit",
"(",
"Node",
"n",
",",
"Node",
"parent",
")",
"{",
"String",
"name",
"=",
"n",
".",
"getString",
"(",
")",
";",
"Node",
"nameNode",
"=",
"n",
".",
"getFirstFirstChild",
"(",
")",
";",
"Node",
"stringK... | Converts a member definition in an object literal to an ES3 key/value pair.
Member definitions in classes are handled in {@link Es6RewriteClass}. | [
"Converts",
"a",
"member",
"definition",
"in",
"an",
"object",
"literal",
"to",
"an",
"ES3",
"key",
"/",
"value",
"pair",
".",
"Member",
"definitions",
"in",
"classes",
"are",
"handled",
"in",
"{"
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/LateEs6ToEs3Converter.java#L133-L141 |
hector-client/hector | object-mapper/src/main/java/me/prettyprint/hom/HectorObjectMapper.java | HectorObjectMapper.getObject | public <T, I> T getObject(Keyspace keyspace, String colFamName, I pkObj) {
if (null == pkObj) {
throw new IllegalArgumentException("object ID cannot be null or empty");
}
CFMappingDef<T> cfMapDef = cacheMgr.getCfMapDef(colFamName, true);
byte[] colFamKey = generateColumnFamilyKeyFromPkObj(cfMapDef, pkObj);
SliceQuery<byte[], String, byte[]> q = HFactory.createSliceQuery(keyspace,
BytesArraySerializer.get(), StringSerializer.get(), BytesArraySerializer.get());
q.setColumnFamily(colFamName);
q.setKey(colFamKey);
// if no anonymous handler then use specific columns
if (cfMapDef.isColumnSliceRequired()) {
q.setColumnNames(cfMapDef.getSliceColumnNameArr());
} else {
q.setRange("", "", false, maxNumColumns);
}
QueryResult<ColumnSlice<String, byte[]>> result = q.execute();
if (null == result || null == result.get()) {
return null;
}
T obj = createObject(cfMapDef, pkObj, result.get());
return obj;
} | java | public <T, I> T getObject(Keyspace keyspace, String colFamName, I pkObj) {
if (null == pkObj) {
throw new IllegalArgumentException("object ID cannot be null or empty");
}
CFMappingDef<T> cfMapDef = cacheMgr.getCfMapDef(colFamName, true);
byte[] colFamKey = generateColumnFamilyKeyFromPkObj(cfMapDef, pkObj);
SliceQuery<byte[], String, byte[]> q = HFactory.createSliceQuery(keyspace,
BytesArraySerializer.get(), StringSerializer.get(), BytesArraySerializer.get());
q.setColumnFamily(colFamName);
q.setKey(colFamKey);
// if no anonymous handler then use specific columns
if (cfMapDef.isColumnSliceRequired()) {
q.setColumnNames(cfMapDef.getSliceColumnNameArr());
} else {
q.setRange("", "", false, maxNumColumns);
}
QueryResult<ColumnSlice<String, byte[]>> result = q.execute();
if (null == result || null == result.get()) {
return null;
}
T obj = createObject(cfMapDef, pkObj, result.get());
return obj;
} | [
"public",
"<",
"T",
",",
"I",
">",
"T",
"getObject",
"(",
"Keyspace",
"keyspace",
",",
"String",
"colFamName",
",",
"I",
"pkObj",
")",
"{",
"if",
"(",
"null",
"==",
"pkObj",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"object ID cannot be ... | Retrieve columns from cassandra keyspace and column family, instantiate a
new object of required type, and then map them to the object's properties.
@param <T>
@param keyspace
@param colFamName
@param pkObj
@return | [
"Retrieve",
"columns",
"from",
"cassandra",
"keyspace",
"and",
"column",
"family",
"instantiate",
"a",
"new",
"object",
"of",
"required",
"type",
"and",
"then",
"map",
"them",
"to",
"the",
"object",
"s",
"properties",
"."
] | train | https://github.com/hector-client/hector/blob/a302e68ca8d91b45d332e8c9afd7d98030b54de1/object-mapper/src/main/java/me/prettyprint/hom/HectorObjectMapper.java#L79-L107 |
geomajas/geomajas-project-client-gwt | client/src/main/java/org/geomajas/gwt/client/spatial/geometry/GeometryFactory.java | GeometryFactory.createLinearRing | public LinearRing createLinearRing(Coordinate[] coordinates) {
if (coordinates == null || coordinates.length == 0) {
return new LinearRing(srid, precision);
}
boolean isClosed = true;
if (coordinates.length == 1 || !coordinates[0].equals(coordinates[coordinates.length - 1])) {
isClosed = false;
}
Coordinate[] clones;
if (isClosed) {
clones = new Coordinate[coordinates.length];
} else {
clones = new Coordinate[coordinates.length + 1];
}
for (int i = 0; i < coordinates.length; i++) {
clones[i] = (Coordinate) coordinates[i].clone();
}
if (!isClosed) {
clones[coordinates.length] = (Coordinate) clones[0].clone();
}
return new LinearRing(srid, precision, clones);
} | java | public LinearRing createLinearRing(Coordinate[] coordinates) {
if (coordinates == null || coordinates.length == 0) {
return new LinearRing(srid, precision);
}
boolean isClosed = true;
if (coordinates.length == 1 || !coordinates[0].equals(coordinates[coordinates.length - 1])) {
isClosed = false;
}
Coordinate[] clones;
if (isClosed) {
clones = new Coordinate[coordinates.length];
} else {
clones = new Coordinate[coordinates.length + 1];
}
for (int i = 0; i < coordinates.length; i++) {
clones[i] = (Coordinate) coordinates[i].clone();
}
if (!isClosed) {
clones[coordinates.length] = (Coordinate) clones[0].clone();
}
return new LinearRing(srid, precision, clones);
} | [
"public",
"LinearRing",
"createLinearRing",
"(",
"Coordinate",
"[",
"]",
"coordinates",
")",
"{",
"if",
"(",
"coordinates",
"==",
"null",
"||",
"coordinates",
".",
"length",
"==",
"0",
")",
"{",
"return",
"new",
"LinearRing",
"(",
"srid",
",",
"precision",
... | Create a new {@link LinearRing}, given an array of coordinates.
@param coordinates
An array of {@link Coordinate} objects. This function checks if the array is closed, and does so
itself if needed.
@return Returns a {@link LinearRing} object. | [
"Create",
"a",
"new",
"{",
"@link",
"LinearRing",
"}",
"given",
"an",
"array",
"of",
"coordinates",
"."
] | train | https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/spatial/geometry/GeometryFactory.java#L127-L149 |
liferay/com-liferay-commerce | commerce-notification-service/src/main/java/com/liferay/commerce/notification/service/persistence/impl/CommerceNotificationAttachmentPersistenceImpl.java | CommerceNotificationAttachmentPersistenceImpl.removeByUuid_C | @Override
public void removeByUuid_C(String uuid, long companyId) {
for (CommerceNotificationAttachment commerceNotificationAttachment : findByUuid_C(
uuid, companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
remove(commerceNotificationAttachment);
}
} | java | @Override
public void removeByUuid_C(String uuid, long companyId) {
for (CommerceNotificationAttachment commerceNotificationAttachment : findByUuid_C(
uuid, companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
remove(commerceNotificationAttachment);
}
} | [
"@",
"Override",
"public",
"void",
"removeByUuid_C",
"(",
"String",
"uuid",
",",
"long",
"companyId",
")",
"{",
"for",
"(",
"CommerceNotificationAttachment",
"commerceNotificationAttachment",
":",
"findByUuid_C",
"(",
"uuid",
",",
"companyId",
",",
"QueryUtil",
".",... | Removes all the commerce notification attachments where uuid = ? and companyId = ? from the database.
@param uuid the uuid
@param companyId the company ID | [
"Removes",
"all",
"the",
"commerce",
"notification",
"attachments",
"where",
"uuid",
"=",
"?",
";",
"and",
"companyId",
"=",
"?",
";",
"from",
"the",
"database",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-notification-service/src/main/java/com/liferay/commerce/notification/service/persistence/impl/CommerceNotificationAttachmentPersistenceImpl.java#L1433-L1439 |
apache/groovy | subprojects/groovy-dateutil/src/main/java/org/apache/groovy/dateutil/extensions/DateUtilExtensions.java | DateUtilExtensions.copyWith | public static Date copyWith(Date self, Map<Object, Integer> updates) {
Calendar cal = Calendar.getInstance();
cal.setTime(self);
set(cal, updates);
return cal.getTime();
} | java | public static Date copyWith(Date self, Map<Object, Integer> updates) {
Calendar cal = Calendar.getInstance();
cal.setTime(self);
set(cal, updates);
return cal.getTime();
} | [
"public",
"static",
"Date",
"copyWith",
"(",
"Date",
"self",
",",
"Map",
"<",
"Object",
",",
"Integer",
">",
"updates",
")",
"{",
"Calendar",
"cal",
"=",
"Calendar",
".",
"getInstance",
"(",
")",
";",
"cal",
".",
"setTime",
"(",
"self",
")",
";",
"se... | Support creating a new Date having similar properties to
an existing Date (which remains unaltered) but with
some fields updated according to a Map of changes.
<p>
Example usage:
<pre>
import static java.util.Calendar.YEAR
def today = new Date()
def nextYear = today[YEAR] + 1
def oneYearFromNow = today.copyWith(year: nextYear)
println today
println oneYearFromNow
</pre>
@param self A Date
@param updates A Map of Calendar keys and values
@return The newly created Date
@see java.util.Calendar#set(int, int)
@see #set(java.util.Date, java.util.Map)
@see #copyWith(java.util.Calendar, java.util.Map)
@since 2.2.0 | [
"Support",
"creating",
"a",
"new",
"Date",
"having",
"similar",
"properties",
"to",
"an",
"existing",
"Date",
"(",
"which",
"remains",
"unaltered",
")",
"but",
"with",
"some",
"fields",
"updated",
"according",
"to",
"a",
"Map",
"of",
"changes",
".",
"<p",
... | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-dateutil/src/main/java/org/apache/groovy/dateutil/extensions/DateUtilExtensions.java#L280-L285 |
Samsung/GearVRf | GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/WidgetFactory.java | WidgetFactory.createWidgetFromModel | @SuppressWarnings("WeakerAccess")
public static Widget createWidgetFromModel(final GVRContext gvrContext,
final String modelFile, Class<? extends Widget> widgetClass)
throws InstantiationException, IOException {
GVRSceneObject rootNode = loadModel(gvrContext, modelFile);
return createWidget(rootNode, widgetClass);
} | java | @SuppressWarnings("WeakerAccess")
public static Widget createWidgetFromModel(final GVRContext gvrContext,
final String modelFile, Class<? extends Widget> widgetClass)
throws InstantiationException, IOException {
GVRSceneObject rootNode = loadModel(gvrContext, modelFile);
return createWidget(rootNode, widgetClass);
} | [
"@",
"SuppressWarnings",
"(",
"\"WeakerAccess\"",
")",
"public",
"static",
"Widget",
"createWidgetFromModel",
"(",
"final",
"GVRContext",
"gvrContext",
",",
"final",
"String",
"modelFile",
",",
"Class",
"<",
"?",
"extends",
"Widget",
">",
"widgetClass",
")",
"thro... | Create a {@link Widget} of the specified {@code widgetClass} to wrap the
root {@link GVRSceneObject} of the scene graph loaded from a file.
@param gvrContext
The {@link GVRContext} to load the model into.
@param modelFile
The asset file to load the model from.
@param widgetClass
The {@linkplain Class} of the {@code Widget} to wrap the root
{@code GVRSceneObject} with.
@return A new {@code AbsoluteLayout} instance.
@throws InstantiationException
If the {@code Widget} can't be instantiated for any reason.
@throws IOException
If the model file can't be read. | [
"Create",
"a",
"{",
"@link",
"Widget",
"}",
"of",
"the",
"specified",
"{",
"@code",
"widgetClass",
"}",
"to",
"wrap",
"the",
"root",
"{",
"@link",
"GVRSceneObject",
"}",
"of",
"the",
"scene",
"graph",
"loaded",
"from",
"a",
"file",
"."
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/WidgetFactory.java#L178-L184 |
b3dgs/lionengine | lionengine-audio-sc68/src/main/java/com/b3dgs/lionengine/audio/sc68/Sc68Format.java | Sc68Format.loadLibrary | private static Sc68Binding loadLibrary()
{
try
{
Verbose.info("Load library: ", LIBRARY_NAME);
final Sc68Binding binding = Native.loadLibrary(LIBRARY_NAME, Sc68Binding.class);
Verbose.info("Library ", LIBRARY_NAME, " loaded");
return binding;
}
catch (final LinkageError exception)
{
throw new LionEngineException(exception, ERROR_LOAD_LIBRARY + LIBRARY_NAME);
}
} | java | private static Sc68Binding loadLibrary()
{
try
{
Verbose.info("Load library: ", LIBRARY_NAME);
final Sc68Binding binding = Native.loadLibrary(LIBRARY_NAME, Sc68Binding.class);
Verbose.info("Library ", LIBRARY_NAME, " loaded");
return binding;
}
catch (final LinkageError exception)
{
throw new LionEngineException(exception, ERROR_LOAD_LIBRARY + LIBRARY_NAME);
}
} | [
"private",
"static",
"Sc68Binding",
"loadLibrary",
"(",
")",
"{",
"try",
"{",
"Verbose",
".",
"info",
"(",
"\"Load library: \"",
",",
"LIBRARY_NAME",
")",
";",
"final",
"Sc68Binding",
"binding",
"=",
"Native",
".",
"loadLibrary",
"(",
"LIBRARY_NAME",
",",
"Sc6... | Load the library.
@return The library binding.
@throws LionEngineException If error on loading. | [
"Load",
"the",
"library",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-audio-sc68/src/main/java/com/b3dgs/lionengine/audio/sc68/Sc68Format.java#L77-L90 |
riversun/string-grabber | src/main/java/org/riversun/string_grabber/StringGrabber.java | StringGrabber.insertRepeat | public StringGrabber insertRepeat(String str, int repeatCount) {
for (int i = 0; i < repeatCount; i++) {
insertIntoHead(str);
}
return StringGrabber.this;
} | java | public StringGrabber insertRepeat(String str, int repeatCount) {
for (int i = 0; i < repeatCount; i++) {
insertIntoHead(str);
}
return StringGrabber.this;
} | [
"public",
"StringGrabber",
"insertRepeat",
"(",
"String",
"str",
",",
"int",
"repeatCount",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"repeatCount",
";",
"i",
"++",
")",
"{",
"insertIntoHead",
"(",
"str",
")",
";",
"}",
"return",
"St... | Append a string to be repeated into head
@see StringGrabber#insertRepeat(String);
@param str
@param repeatCount
@return | [
"Append",
"a",
"string",
"to",
"be",
"repeated",
"into",
"head"
] | train | https://github.com/riversun/string-grabber/blob/b5aadc21fe15f50d35392188dec6ab81dcf8d464/src/main/java/org/riversun/string_grabber/StringGrabber.java#L586-L591 |
mozilla/rhino | src/org/mozilla/javascript/Context.java | Context.toObject | public static Scriptable toObject(Object value, Scriptable scope)
{
return ScriptRuntime.toObject(scope, value);
} | java | public static Scriptable toObject(Object value, Scriptable scope)
{
return ScriptRuntime.toObject(scope, value);
} | [
"public",
"static",
"Scriptable",
"toObject",
"(",
"Object",
"value",
",",
"Scriptable",
"scope",
")",
"{",
"return",
"ScriptRuntime",
".",
"toObject",
"(",
"scope",
",",
"value",
")",
";",
"}"
] | Convert the value to an JavaScript object value.
<p>
Note that a scope must be provided to look up the constructors
for Number, Boolean, and String.
<p>
See ECMA 9.9.
<p>
Additionally, arbitrary Java objects and classes will be
wrapped in a Scriptable object with its Java fields and methods
reflected as JavaScript properties of the object.
@param value any Java object
@param scope global scope containing constructors for Number,
Boolean, and String
@return new JavaScript object | [
"Convert",
"the",
"value",
"to",
"an",
"JavaScript",
"object",
"value",
".",
"<p",
">",
"Note",
"that",
"a",
"scope",
"must",
"be",
"provided",
"to",
"look",
"up",
"the",
"constructors",
"for",
"Number",
"Boolean",
"and",
"String",
".",
"<p",
">",
"See",... | train | https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/Context.java#L1805-L1808 |
matthewhorridge/owlapi-gwt | owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLSubDataPropertyOfAxiomImpl_CustomFieldSerializer.java | OWLSubDataPropertyOfAxiomImpl_CustomFieldSerializer.serializeInstance | @Override
public void serializeInstance(SerializationStreamWriter streamWriter, OWLSubDataPropertyOfAxiomImpl instance) throws SerializationException {
serialize(streamWriter, instance);
} | java | @Override
public void serializeInstance(SerializationStreamWriter streamWriter, OWLSubDataPropertyOfAxiomImpl instance) throws SerializationException {
serialize(streamWriter, instance);
} | [
"@",
"Override",
"public",
"void",
"serializeInstance",
"(",
"SerializationStreamWriter",
"streamWriter",
",",
"OWLSubDataPropertyOfAxiomImpl",
"instance",
")",
"throws",
"SerializationException",
"{",
"serialize",
"(",
"streamWriter",
",",
"instance",
")",
";",
"}"
] | Serializes the content of the object into the
{@link com.google.gwt.user.client.rpc.SerializationStreamWriter}.
@param streamWriter the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter} to write the
object's content to
@param instance the object instance to serialize
@throws com.google.gwt.user.client.rpc.SerializationException
if the serialization operation is not
successful | [
"Serializes",
"the",
"content",
"of",
"the",
"object",
"into",
"the",
"{",
"@link",
"com",
".",
"google",
".",
"gwt",
".",
"user",
".",
"client",
".",
"rpc",
".",
"SerializationStreamWriter",
"}",
"."
] | train | https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLSubDataPropertyOfAxiomImpl_CustomFieldSerializer.java#L75-L78 |
DDTH/ddth-dao | ddth-dao-core/src/main/java/com/github/ddth/dao/BaseBo.java | BaseBo.setAttribute | public BaseBo setAttribute(String attrName, Object value, boolean triggerChange) {
Lock lock = lockForWrite();
try {
if (value == null) {
attributes.remove(attrName);
} else {
attributes.put(attrName, value);
}
if (triggerChange) {
triggerChange(attrName);
}
markDirty();
return this;
} finally {
lock.unlock();
}
} | java | public BaseBo setAttribute(String attrName, Object value, boolean triggerChange) {
Lock lock = lockForWrite();
try {
if (value == null) {
attributes.remove(attrName);
} else {
attributes.put(attrName, value);
}
if (triggerChange) {
triggerChange(attrName);
}
markDirty();
return this;
} finally {
lock.unlock();
}
} | [
"public",
"BaseBo",
"setAttribute",
"(",
"String",
"attrName",
",",
"Object",
"value",
",",
"boolean",
"triggerChange",
")",
"{",
"Lock",
"lock",
"=",
"lockForWrite",
"(",
")",
";",
"try",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"attributes",
".... | Set a BO's attribute.
@param attrName
@param value
@param triggerChange
if set to {@code true} {@link #triggerChange(String)} will be
called
@return
@since 0.7.1 | [
"Set",
"a",
"BO",
"s",
"attribute",
"."
] | train | https://github.com/DDTH/ddth-dao/blob/8d059ddf641a1629aa53851f9d1b41abf175a180/ddth-dao-core/src/main/java/com/github/ddth/dao/BaseBo.java#L321-L337 |
Metatavu/edelphi | edelphi/src/main/java/fi/metatavu/edelphi/query/AbstractQueryPageHandler.java | AbstractQueryPageHandler.renderComments | protected void renderComments(PageRequestContext requestContext, QueryPage queryPage, QueryReply queryReply, boolean commentable, boolean viewDiscussion) {
Query query = queryPage.getQuerySection().getQuery();
Panel panel = ResourceUtils.getResourcePanel(query);
RequiredQueryFragment queryFragment = new RequiredQueryFragment("comments");
queryFragment.addAttribute("panelId", panel.getId().toString());
queryFragment.addAttribute("queryId", query.getId().toString());
queryFragment.addAttribute("pageId", queryPage.getId().toString());
if (queryReply != null) {
queryFragment.addAttribute("queryReplyId", queryReply.getId().toString());
}
queryFragment.addAttribute("queryPageCommentable", commentable ? "true" : "false");
queryFragment.addAttribute("queryViewDiscussion", viewDiscussion ? "true" : "false");
addRequiredFragment(requestContext, queryFragment);
} | java | protected void renderComments(PageRequestContext requestContext, QueryPage queryPage, QueryReply queryReply, boolean commentable, boolean viewDiscussion) {
Query query = queryPage.getQuerySection().getQuery();
Panel panel = ResourceUtils.getResourcePanel(query);
RequiredQueryFragment queryFragment = new RequiredQueryFragment("comments");
queryFragment.addAttribute("panelId", panel.getId().toString());
queryFragment.addAttribute("queryId", query.getId().toString());
queryFragment.addAttribute("pageId", queryPage.getId().toString());
if (queryReply != null) {
queryFragment.addAttribute("queryReplyId", queryReply.getId().toString());
}
queryFragment.addAttribute("queryPageCommentable", commentable ? "true" : "false");
queryFragment.addAttribute("queryViewDiscussion", viewDiscussion ? "true" : "false");
addRequiredFragment(requestContext, queryFragment);
} | [
"protected",
"void",
"renderComments",
"(",
"PageRequestContext",
"requestContext",
",",
"QueryPage",
"queryPage",
",",
"QueryReply",
"queryReply",
",",
"boolean",
"commentable",
",",
"boolean",
"viewDiscussion",
")",
"{",
"Query",
"query",
"=",
"queryPage",
".",
"g... | Renders comment list and comment editor
@param requestContext request context
@param queryPage query page
@param queryReply query reply
@param commentable whether to render comment editor
@param viewDiscussion whether to render comment list | [
"Renders",
"comment",
"list",
"and",
"comment",
"editor"
] | train | https://github.com/Metatavu/edelphi/blob/d91a0b54f954b33b4ee674a1bdf03612d76c3305/edelphi/src/main/java/fi/metatavu/edelphi/query/AbstractQueryPageHandler.java#L141-L157 |
UrielCh/ovh-java-sdk | ovh-java-sdk-hostingweb/src/main/java/net/minidev/ovh/api/ApiOvhHostingweb.java | ApiOvhHostingweb.moduleList_GET | public ArrayList<Long> moduleList_GET(Boolean active, OvhBranchEnum branch, Boolean latest) throws IOException {
String qPath = "/hosting/web/moduleList";
StringBuilder sb = path(qPath);
query(sb, "active", active);
query(sb, "branch", branch);
query(sb, "latest", latest);
String resp = execN(qPath, "GET", sb.toString(), null);
return convertTo(resp, t3);
} | java | public ArrayList<Long> moduleList_GET(Boolean active, OvhBranchEnum branch, Boolean latest) throws IOException {
String qPath = "/hosting/web/moduleList";
StringBuilder sb = path(qPath);
query(sb, "active", active);
query(sb, "branch", branch);
query(sb, "latest", latest);
String resp = execN(qPath, "GET", sb.toString(), null);
return convertTo(resp, t3);
} | [
"public",
"ArrayList",
"<",
"Long",
">",
"moduleList_GET",
"(",
"Boolean",
"active",
",",
"OvhBranchEnum",
"branch",
",",
"Boolean",
"latest",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/hosting/web/moduleList\"",
";",
"StringBuilder",
"sb",
"="... | IDs of all modules available
REST: GET /hosting/web/moduleList
@param branch [required] Filter the value of branch property (=)
@param active [required] Filter the value of active property (=)
@param latest [required] Filter the value of latest property (=) | [
"IDs",
"of",
"all",
"modules",
"available"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-hostingweb/src/main/java/net/minidev/ovh/api/ApiOvhHostingweb.java#L2306-L2314 |
Multifarious/MacroManager | src/main/java/com/fasterxml/mama/Cluster.java | Cluster.shutdownWork | public void shutdownWork(String workUnit, boolean doLog /*true*/ ) {
if (doLog) {
LOG.info("Shutting down {}: {}...", config.workUnitName, workUnit);
}
myWorkUnits.remove(workUnit);
claimedForHandoff.remove(workUnit);
balancingPolicy.onShutdownWork(workUnit);
try {
listener.shutdownWork(workUnit);
} finally {
ZKUtils.deleteAtomic(zk, workUnitClaimPath(workUnit), myNodeID);
}
} | java | public void shutdownWork(String workUnit, boolean doLog /*true*/ ) {
if (doLog) {
LOG.info("Shutting down {}: {}...", config.workUnitName, workUnit);
}
myWorkUnits.remove(workUnit);
claimedForHandoff.remove(workUnit);
balancingPolicy.onShutdownWork(workUnit);
try {
listener.shutdownWork(workUnit);
} finally {
ZKUtils.deleteAtomic(zk, workUnitClaimPath(workUnit), myNodeID);
}
} | [
"public",
"void",
"shutdownWork",
"(",
"String",
"workUnit",
",",
"boolean",
"doLog",
"/*true*/",
")",
"{",
"if",
"(",
"doLog",
")",
"{",
"LOG",
".",
"info",
"(",
"\"Shutting down {}: {}...\"",
",",
"config",
".",
"workUnitName",
",",
"workUnit",
")",
";",
... | Shuts down a work unit by removing the claim in ZK and calling the listener. | [
"Shuts",
"down",
"a",
"work",
"unit",
"by",
"removing",
"the",
"claim",
"in",
"ZK",
"and",
"calling",
"the",
"listener",
"."
] | train | https://github.com/Multifarious/MacroManager/blob/559785839981f460aaeba3c3fddff7fb667d9581/src/main/java/com/fasterxml/mama/Cluster.java#L742-L754 |
molgenis/molgenis | molgenis-data-security/src/main/java/org/molgenis/data/security/auth/GroupService.java | GroupService.addMember | @RunAsSystem
public void addMember(final Group group, final User user, final Role role) {
ArrayList<Role> groupRoles = newArrayList(group.getRoles());
Collection<RoleMembership> memberships = roleMembershipService.getMemberships(groupRoles);
boolean isGroupRole = groupRoles.stream().anyMatch(gr -> gr.getName().equals(role.getName()));
if (!isGroupRole) {
throw new NotAValidGroupRoleException(role, group);
}
boolean isMember = memberships.stream().parallel().anyMatch(m -> m.getUser().equals(user));
if (isMember) {
throw new IsAlreadyMemberException(user, group);
}
roleMembershipService.addUserToRole(user, role);
} | java | @RunAsSystem
public void addMember(final Group group, final User user, final Role role) {
ArrayList<Role> groupRoles = newArrayList(group.getRoles());
Collection<RoleMembership> memberships = roleMembershipService.getMemberships(groupRoles);
boolean isGroupRole = groupRoles.stream().anyMatch(gr -> gr.getName().equals(role.getName()));
if (!isGroupRole) {
throw new NotAValidGroupRoleException(role, group);
}
boolean isMember = memberships.stream().parallel().anyMatch(m -> m.getUser().equals(user));
if (isMember) {
throw new IsAlreadyMemberException(user, group);
}
roleMembershipService.addUserToRole(user, role);
} | [
"@",
"RunAsSystem",
"public",
"void",
"addMember",
"(",
"final",
"Group",
"group",
",",
"final",
"User",
"user",
",",
"final",
"Role",
"role",
")",
"{",
"ArrayList",
"<",
"Role",
">",
"groupRoles",
"=",
"newArrayList",
"(",
"group",
".",
"getRoles",
"(",
... | Add member to group. User can only be added to a role that belongs to the group. The user can
only have a single role within the group
@param group group to add the user to in the given role
@param user user to be added in the given role to the given group
@param role role in which the given user is to be added to given group | [
"Add",
"member",
"to",
"group",
".",
"User",
"can",
"only",
"be",
"added",
"to",
"a",
"role",
"that",
"belongs",
"to",
"the",
"group",
".",
"The",
"user",
"can",
"only",
"have",
"a",
"single",
"role",
"within",
"the",
"group"
] | train | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-security/src/main/java/org/molgenis/data/security/auth/GroupService.java#L153-L170 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/JobOperations.java | JobOperations.listJobs | public PagedList<CloudJob> listJobs(DetailLevel detailLevel) throws BatchErrorException, IOException {
return listJobs(detailLevel, null);
} | java | public PagedList<CloudJob> listJobs(DetailLevel detailLevel) throws BatchErrorException, IOException {
return listJobs(detailLevel, null);
} | [
"public",
"PagedList",
"<",
"CloudJob",
">",
"listJobs",
"(",
"DetailLevel",
"detailLevel",
")",
"throws",
"BatchErrorException",
",",
"IOException",
"{",
"return",
"listJobs",
"(",
"detailLevel",
",",
"null",
")",
";",
"}"
] | Lists the {@link CloudJob jobs} in the Batch account.
@param detailLevel A {@link DetailLevel} used for filtering the list and for controlling which properties are retrieved from the service.
@return A list of {@link CloudJob} objects.
@throws BatchErrorException Exception thrown when an error response is received from the Batch service.
@throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. | [
"Lists",
"the",
"{",
"@link",
"CloudJob",
"jobs",
"}",
"in",
"the",
"Batch",
"account",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/JobOperations.java#L170-L172 |
alkacon/opencms-core | src/org/opencms/ade/detailpage/CmsDetailPageUtil.java | CmsDetailPageUtil.lookupPage | public static CmsResource lookupPage(CmsObject cms, String uri) throws CmsException {
try {
CmsResource res = cms.readResource(uri);
return res;
} catch (CmsVfsResourceNotFoundException e) {
String detailName = CmsResource.getName(uri).replaceAll("/$", "");
CmsUUID detailId = cms.readIdForUrlName(detailName);
if (detailId != null) {
return cms.readResource(detailId);
}
throw new CmsVfsResourceNotFoundException(
org.opencms.db.generic.Messages.get().container(
org.opencms.db.generic.Messages.ERR_READ_RESOURCE_1,
uri));
}
} | java | public static CmsResource lookupPage(CmsObject cms, String uri) throws CmsException {
try {
CmsResource res = cms.readResource(uri);
return res;
} catch (CmsVfsResourceNotFoundException e) {
String detailName = CmsResource.getName(uri).replaceAll("/$", "");
CmsUUID detailId = cms.readIdForUrlName(detailName);
if (detailId != null) {
return cms.readResource(detailId);
}
throw new CmsVfsResourceNotFoundException(
org.opencms.db.generic.Messages.get().container(
org.opencms.db.generic.Messages.ERR_READ_RESOURCE_1,
uri));
}
} | [
"public",
"static",
"CmsResource",
"lookupPage",
"(",
"CmsObject",
"cms",
",",
"String",
"uri",
")",
"throws",
"CmsException",
"{",
"try",
"{",
"CmsResource",
"res",
"=",
"cms",
".",
"readResource",
"(",
"uri",
")",
";",
"return",
"res",
";",
"}",
"catch",... | Looks up a page by URI (which may be a detail page URI, or a normal VFS uri).<p>
@param cms the current CMS context
@param uri the detail page or VFS uri
@return the resource with the given uri
@throws CmsException if something goes wrong | [
"Looks",
"up",
"a",
"page",
"by",
"URI",
"(",
"which",
"may",
"be",
"a",
"detail",
"page",
"URI",
"or",
"a",
"normal",
"VFS",
"uri",
")",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/detailpage/CmsDetailPageUtil.java#L123-L139 |
line/armeria | core/src/main/java/com/linecorp/armeria/internal/annotation/AnnotatedHttpServiceFactory.java | AnnotatedHttpServiceFactory.consumableMediaTypes | private static List<MediaType> consumableMediaTypes(Method method, Class<?> clazz) {
List<Consumes> consumes = findAll(method, Consumes.class);
List<ConsumeType> consumeTypes = findAll(method, ConsumeType.class);
if (consumes.isEmpty() && consumeTypes.isEmpty()) {
consumes = findAll(clazz, Consumes.class);
consumeTypes = findAll(clazz, ConsumeType.class);
}
final List<MediaType> types =
Stream.concat(consumes.stream().map(Consumes::value),
consumeTypes.stream().map(ConsumeType::value))
.map(MediaType::parse)
.collect(toImmutableList());
return ensureUniqueTypes(types, Consumes.class);
} | java | private static List<MediaType> consumableMediaTypes(Method method, Class<?> clazz) {
List<Consumes> consumes = findAll(method, Consumes.class);
List<ConsumeType> consumeTypes = findAll(method, ConsumeType.class);
if (consumes.isEmpty() && consumeTypes.isEmpty()) {
consumes = findAll(clazz, Consumes.class);
consumeTypes = findAll(clazz, ConsumeType.class);
}
final List<MediaType> types =
Stream.concat(consumes.stream().map(Consumes::value),
consumeTypes.stream().map(ConsumeType::value))
.map(MediaType::parse)
.collect(toImmutableList());
return ensureUniqueTypes(types, Consumes.class);
} | [
"private",
"static",
"List",
"<",
"MediaType",
">",
"consumableMediaTypes",
"(",
"Method",
"method",
",",
"Class",
"<",
"?",
">",
"clazz",
")",
"{",
"List",
"<",
"Consumes",
">",
"consumes",
"=",
"findAll",
"(",
"method",
",",
"Consumes",
".",
"class",
"... | Returns the list of {@link MediaType}s specified by {@link Consumes} annotation. | [
"Returns",
"the",
"list",
"of",
"{"
] | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/internal/annotation/AnnotatedHttpServiceFactory.java#L450-L465 |
opencb/biodata | biodata-tools/src/main/java/org/opencb/biodata/tools/variant/converters/VariantContextConverter.java | VariantContextConverter.getReferenceBase | protected static String getReferenceBase(String chromosome, int from, int to, Map<Integer, Character> referenceAlleles) {
int length = to - from;
if (length < 0) {
throw new IllegalStateException(
"Sequence length is negative: chromosome " + chromosome + " from " + from + " to " + to);
}
StringBuilder sb = new StringBuilder(length);
for (int i = from; i < to; i++) {
sb.append(referenceAlleles.getOrDefault(i, 'N'));
}
return sb.toString();
// return StringUtils.repeat('N', length); // current return default base TODO load reference sequence
} | java | protected static String getReferenceBase(String chromosome, int from, int to, Map<Integer, Character> referenceAlleles) {
int length = to - from;
if (length < 0) {
throw new IllegalStateException(
"Sequence length is negative: chromosome " + chromosome + " from " + from + " to " + to);
}
StringBuilder sb = new StringBuilder(length);
for (int i = from; i < to; i++) {
sb.append(referenceAlleles.getOrDefault(i, 'N'));
}
return sb.toString();
// return StringUtils.repeat('N', length); // current return default base TODO load reference sequence
} | [
"protected",
"static",
"String",
"getReferenceBase",
"(",
"String",
"chromosome",
",",
"int",
"from",
",",
"int",
"to",
",",
"Map",
"<",
"Integer",
",",
"Character",
">",
"referenceAlleles",
")",
"{",
"int",
"length",
"=",
"to",
"-",
"from",
";",
"if",
"... | Get bases from reference sequence.
@param chromosome Chromosome
@param from Start ( inclusive) position
@param to End (exclusive) position
@param referenceAlleles Reference alleles
@return String Reference sequence of length to - from | [
"Get",
"bases",
"from",
"reference",
"sequence",
"."
] | train | https://github.com/opencb/biodata/blob/21b3d51d71f578efab908422aca4bab7a73097b1/biodata-tools/src/main/java/org/opencb/biodata/tools/variant/converters/VariantContextConverter.java#L148-L160 |
mapsforge/mapsforge | sqlite-android/src/main/java/org/sqlite/database/sqlite/SQLiteConnectionPool.java | SQLiteConnectionPool.acquireConnection | public SQLiteConnection acquireConnection(String sql, int connectionFlags,
CancellationSignal cancellationSignal) {
return waitForConnection(sql, connectionFlags, cancellationSignal);
} | java | public SQLiteConnection acquireConnection(String sql, int connectionFlags,
CancellationSignal cancellationSignal) {
return waitForConnection(sql, connectionFlags, cancellationSignal);
} | [
"public",
"SQLiteConnection",
"acquireConnection",
"(",
"String",
"sql",
",",
"int",
"connectionFlags",
",",
"CancellationSignal",
"cancellationSignal",
")",
"{",
"return",
"waitForConnection",
"(",
"sql",
",",
"connectionFlags",
",",
"cancellationSignal",
")",
";",
"... | Acquires a connection from the pool.
<p>
The caller must call {@link #releaseConnection} to release the connection
back to the pool when it is finished. Failure to do so will result
in much unpleasantness.
</p>
@param sql If not null, try to find a connection that already has
the specified SQL statement in its prepared statement cache.
@param connectionFlags The connection request flags.
@param cancellationSignal A signal to cancel the operation in progress, or null if none.
@return The connection that was acquired, never null.
@throws IllegalStateException if the pool has been closed.
@throws SQLiteException if a database error occurs.
@throws OperationCanceledException if the operation was canceled. | [
"Acquires",
"a",
"connection",
"from",
"the",
"pool",
".",
"<p",
">",
"The",
"caller",
"must",
"call",
"{",
"@link",
"#releaseConnection",
"}",
"to",
"release",
"the",
"connection",
"back",
"to",
"the",
"pool",
"when",
"it",
"is",
"finished",
".",
"Failure... | train | https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/sqlite-android/src/main/java/org/sqlite/database/sqlite/SQLiteConnectionPool.java#L349-L352 |
landawn/AbacusUtil | src/com/landawn/abacus/util/MutableByte.java | MutableByte.setIf | public <E extends Exception> boolean setIf(byte newValue, Try.BytePredicate<E> predicate) throws E {
if (predicate.test(this.value)) {
this.value = newValue;
return true;
}
return false;
} | java | public <E extends Exception> boolean setIf(byte newValue, Try.BytePredicate<E> predicate) throws E {
if (predicate.test(this.value)) {
this.value = newValue;
return true;
}
return false;
} | [
"public",
"<",
"E",
"extends",
"Exception",
">",
"boolean",
"setIf",
"(",
"byte",
"newValue",
",",
"Try",
".",
"BytePredicate",
"<",
"E",
">",
"predicate",
")",
"throws",
"E",
"{",
"if",
"(",
"predicate",
".",
"test",
"(",
"this",
".",
"value",
")",
... | Set with the specified new value and returns <code>true</code> if <code>predicate</code> returns true.
Otherwise just return <code>false</code> without setting the value to new value.
@param newValue
@param predicate - test the current value.
@return | [
"Set",
"with",
"the",
"specified",
"new",
"value",
"and",
"returns",
"<code",
">",
"true<",
"/",
"code",
">",
"if",
"<code",
">",
"predicate<",
"/",
"code",
">",
"returns",
"true",
".",
"Otherwise",
"just",
"return",
"<code",
">",
"false<",
"/",
"code",
... | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/MutableByte.java#L110-L117 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/CopyOnWriteArrayList.java | CopyOnWriteArrayList.indexOf | public int indexOf(E object, int from) {
Object[] snapshot = elements;
return indexOf(object, snapshot, from, snapshot.length);
} | java | public int indexOf(E object, int from) {
Object[] snapshot = elements;
return indexOf(object, snapshot, from, snapshot.length);
} | [
"public",
"int",
"indexOf",
"(",
"E",
"object",
",",
"int",
"from",
")",
"{",
"Object",
"[",
"]",
"snapshot",
"=",
"elements",
";",
"return",
"indexOf",
"(",
"object",
",",
"snapshot",
",",
"from",
",",
"snapshot",
".",
"length",
")",
";",
"}"
] | Searches this list for {@code object} and returns the index of the first
occurrence that is at or after {@code from}.
@return the index or -1 if the object was not found. | [
"Searches",
"this",
"list",
"for",
"{",
"@code",
"object",
"}",
"and",
"returns",
"the",
"index",
"of",
"the",
"first",
"occurrence",
"that",
"is",
"at",
"or",
"after",
"{",
"@code",
"from",
"}",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/CopyOnWriteArrayList.java#L166-L169 |
UrielCh/ovh-java-sdk | ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java | ApiOvhCloud.project_serviceName_storage_containerId_user_POST | public OvhUserDetail project_serviceName_storage_containerId_user_POST(String serviceName, String containerId, String description, OvhRightEnum right) throws IOException {
String qPath = "/cloud/project/{serviceName}/storage/{containerId}/user";
StringBuilder sb = path(qPath, serviceName, containerId);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "description", description);
addBody(o, "right", right);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhUserDetail.class);
} | java | public OvhUserDetail project_serviceName_storage_containerId_user_POST(String serviceName, String containerId, String description, OvhRightEnum right) throws IOException {
String qPath = "/cloud/project/{serviceName}/storage/{containerId}/user";
StringBuilder sb = path(qPath, serviceName, containerId);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "description", description);
addBody(o, "right", right);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhUserDetail.class);
} | [
"public",
"OvhUserDetail",
"project_serviceName_storage_containerId_user_POST",
"(",
"String",
"serviceName",
",",
"String",
"containerId",
",",
"String",
"description",
",",
"OvhRightEnum",
"right",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/cloud/pro... | Create openstack user with only access to this container
REST: POST /cloud/project/{serviceName}/storage/{containerId}/user
@param containerId [required] Container ID
@param description [required] User description
@param right [required] User right (all, read, write)
@param serviceName [required] Service name | [
"Create",
"openstack",
"user",
"with",
"only",
"access",
"to",
"this",
"container"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java#L695-L703 |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/services/ServerSentEventService.java | ServerSentEventService.setConnections | public void setConnections(String uri, Set<ServerSentEventConnection> uriConnections) {
Objects.requireNonNull(uri, Required.URI.toString());
Objects.requireNonNull(uriConnections, Required.URI_CONNECTIONS.toString());
this.cache.put(Default.SSE_CACHE_PREFIX.toString() + uri, uriConnections);
} | java | public void setConnections(String uri, Set<ServerSentEventConnection> uriConnections) {
Objects.requireNonNull(uri, Required.URI.toString());
Objects.requireNonNull(uriConnections, Required.URI_CONNECTIONS.toString());
this.cache.put(Default.SSE_CACHE_PREFIX.toString() + uri, uriConnections);
} | [
"public",
"void",
"setConnections",
"(",
"String",
"uri",
",",
"Set",
"<",
"ServerSentEventConnection",
">",
"uriConnections",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"uri",
",",
"Required",
".",
"URI",
".",
"toString",
"(",
")",
")",
";",
"Objects"... | Sets the URI resources for a given URL
@param uri The URI resource for the connection
@param uriConnections The connections for the URI resource | [
"Sets",
"the",
"URI",
"resources",
"for",
"a",
"given",
"URL"
] | train | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/services/ServerSentEventService.java#L133-L138 |
knowm/XChange | xchange-coinmate/src/main/java/org/knowm/xchange/coinmate/CoinmateAdapters.java | CoinmateAdapters.adaptTicker | public static Ticker adaptTicker(CoinmateTicker coinmateTicker, CurrencyPair currencyPair) {
BigDecimal last = coinmateTicker.getData().getLast();
BigDecimal bid = coinmateTicker.getData().getBid();
BigDecimal ask = coinmateTicker.getData().getAsk();
BigDecimal high = coinmateTicker.getData().getHigh();
BigDecimal low = coinmateTicker.getData().getLow();
BigDecimal volume = coinmateTicker.getData().getAmount();
Date timestamp = new Date(coinmateTicker.getData().getTimestamp() * 1000L);
return new Ticker.Builder()
.currencyPair(currencyPair)
.last(last)
.bid(bid)
.ask(ask)
.high(high)
.low(low)
.volume(volume)
.timestamp(timestamp)
.build();
} | java | public static Ticker adaptTicker(CoinmateTicker coinmateTicker, CurrencyPair currencyPair) {
BigDecimal last = coinmateTicker.getData().getLast();
BigDecimal bid = coinmateTicker.getData().getBid();
BigDecimal ask = coinmateTicker.getData().getAsk();
BigDecimal high = coinmateTicker.getData().getHigh();
BigDecimal low = coinmateTicker.getData().getLow();
BigDecimal volume = coinmateTicker.getData().getAmount();
Date timestamp = new Date(coinmateTicker.getData().getTimestamp() * 1000L);
return new Ticker.Builder()
.currencyPair(currencyPair)
.last(last)
.bid(bid)
.ask(ask)
.high(high)
.low(low)
.volume(volume)
.timestamp(timestamp)
.build();
} | [
"public",
"static",
"Ticker",
"adaptTicker",
"(",
"CoinmateTicker",
"coinmateTicker",
",",
"CurrencyPair",
"currencyPair",
")",
"{",
"BigDecimal",
"last",
"=",
"coinmateTicker",
".",
"getData",
"(",
")",
".",
"getLast",
"(",
")",
";",
"BigDecimal",
"bid",
"=",
... | Adapts a CoinmateTicker to a Ticker Object
@param coinmateTicker The exchange specific ticker
@param currencyPair (e.g. BTC/USD)
@return The ticker | [
"Adapts",
"a",
"CoinmateTicker",
"to",
"a",
"Ticker",
"Object"
] | train | https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-coinmate/src/main/java/org/knowm/xchange/coinmate/CoinmateAdapters.java#L66-L86 |
JodaOrg/joda-time | src/main/java/org/joda/time/Duration.java | Duration.standardHours | public static Duration standardHours(long hours) {
if (hours == 0) {
return ZERO;
}
return new Duration(FieldUtils.safeMultiply(hours, DateTimeConstants.MILLIS_PER_HOUR));
} | java | public static Duration standardHours(long hours) {
if (hours == 0) {
return ZERO;
}
return new Duration(FieldUtils.safeMultiply(hours, DateTimeConstants.MILLIS_PER_HOUR));
} | [
"public",
"static",
"Duration",
"standardHours",
"(",
"long",
"hours",
")",
"{",
"if",
"(",
"hours",
"==",
"0",
")",
"{",
"return",
"ZERO",
";",
"}",
"return",
"new",
"Duration",
"(",
"FieldUtils",
".",
"safeMultiply",
"(",
"hours",
",",
"DateTimeConstants... | Create a duration with the specified number of hours assuming that
there are the standard number of milliseconds in an hour.
<p>
This method assumes that there are 60 minutes in an hour,
60 seconds in a minute and 1000 milliseconds in a second.
All currently supplied chronologies use this definition.
<p>
A Duration is a representation of an amount of time. If you want to express
the concept of 'hours' you should consider using the {@link Hours} class.
@param hours the number of standard hours in this duration
@return the duration, never null
@throws ArithmeticException if the hours value is too large
@since 1.6 | [
"Create",
"a",
"duration",
"with",
"the",
"specified",
"number",
"of",
"hours",
"assuming",
"that",
"there",
"are",
"the",
"standard",
"number",
"of",
"milliseconds",
"in",
"an",
"hour",
".",
"<p",
">",
"This",
"method",
"assumes",
"that",
"there",
"are",
... | train | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/Duration.java#L105-L110 |
pmwmedia/tinylog | tinylog-impl/src/main/java/org/tinylog/pattern/FormatPatternParser.java | FormatPatternParser.styleToken | private static Token styleToken(final Token token, final String[] options) {
Token styledToken = token;
for (String option : options) {
int splitIndex = option.indexOf('=');
if (splitIndex == -1) {
InternalLogger.log(Level.ERROR, "No value set for '" + option.trim() + "'");
} else {
String key = option.substring(0, splitIndex).trim();
String value = option.substring(splitIndex + 1).trim();
int number;
try {
number = parsePositiveInteger(value);
} catch (NumberFormatException ex) {
InternalLogger.log(Level.ERROR, "'" + value + "' is an invalid value for '" + key + "'");
continue;
}
if ("min-size".equals(key)) {
styledToken = new MinimumSizeToken(styledToken, number);
} else if ("indent".equals(key)) {
styledToken = new IndentationToken(styledToken, number);
} else {
InternalLogger.log(Level.ERROR, "Unknown style option: '" + key + "'");
}
}
}
return styledToken;
} | java | private static Token styleToken(final Token token, final String[] options) {
Token styledToken = token;
for (String option : options) {
int splitIndex = option.indexOf('=');
if (splitIndex == -1) {
InternalLogger.log(Level.ERROR, "No value set for '" + option.trim() + "'");
} else {
String key = option.substring(0, splitIndex).trim();
String value = option.substring(splitIndex + 1).trim();
int number;
try {
number = parsePositiveInteger(value);
} catch (NumberFormatException ex) {
InternalLogger.log(Level.ERROR, "'" + value + "' is an invalid value for '" + key + "'");
continue;
}
if ("min-size".equals(key)) {
styledToken = new MinimumSizeToken(styledToken, number);
} else if ("indent".equals(key)) {
styledToken = new IndentationToken(styledToken, number);
} else {
InternalLogger.log(Level.ERROR, "Unknown style option: '" + key + "'");
}
}
}
return styledToken;
} | [
"private",
"static",
"Token",
"styleToken",
"(",
"final",
"Token",
"token",
",",
"final",
"String",
"[",
"]",
"options",
")",
"{",
"Token",
"styledToken",
"=",
"token",
";",
"for",
"(",
"String",
"option",
":",
"options",
")",
"{",
"int",
"splitIndex",
"... | Creates style decorators for a token.
@param token
Token to style
@param options
Style options
@return Styled token | [
"Creates",
"style",
"decorators",
"for",
"a",
"token",
"."
] | train | https://github.com/pmwmedia/tinylog/blob/d03d4ef84a1310155037e08ca8822a91697d1086/tinylog-impl/src/main/java/org/tinylog/pattern/FormatPatternParser.java#L217-L247 |
couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/endpoint/query/QueryHandler.java | QueryHandler.parseQueryRows | private void parseQueryRows(boolean lastChunk) {
while (true) {
int openBracketPos = findNextChar(responseContent, '{');
if (isEmptySection(openBracketPos) || (lastChunk && openBracketPos < 0)) {
sectionDone();
queryParsingState = transitionToNextToken(lastChunk);
queryRowClosingPositionProcessor = null;
queryRowClosingProcessorIndex = 0;
break;
}
if (queryRowClosingPositionProcessor == null) {
queryRowClosingPositionProcessor = new ClosingPositionBufProcessor('{', '}', true);
queryRowClosingProcessorIndex = responseContent.readerIndex();
}
int lengthToScan = responseContent.writerIndex() - this.queryRowClosingProcessorIndex;
int closeBracketPos = responseContent.forEachByte(queryRowClosingProcessorIndex,
lengthToScan, queryRowClosingPositionProcessor);
if (closeBracketPos == -1) {
queryRowClosingProcessorIndex = responseContent.writerIndex();
break;
}
queryRowClosingPositionProcessor = null;
queryRowClosingProcessorIndex = 0;
int length = closeBracketPos - openBracketPos - responseContent.readerIndex() + 1;
responseContent.skipBytes(openBracketPos);
ByteBuf resultSlice = responseContent.readSlice(length);
queryRowObservable.onNext(resultSlice.copy());
responseContent.discardSomeReadBytes();
}
} | java | private void parseQueryRows(boolean lastChunk) {
while (true) {
int openBracketPos = findNextChar(responseContent, '{');
if (isEmptySection(openBracketPos) || (lastChunk && openBracketPos < 0)) {
sectionDone();
queryParsingState = transitionToNextToken(lastChunk);
queryRowClosingPositionProcessor = null;
queryRowClosingProcessorIndex = 0;
break;
}
if (queryRowClosingPositionProcessor == null) {
queryRowClosingPositionProcessor = new ClosingPositionBufProcessor('{', '}', true);
queryRowClosingProcessorIndex = responseContent.readerIndex();
}
int lengthToScan = responseContent.writerIndex() - this.queryRowClosingProcessorIndex;
int closeBracketPos = responseContent.forEachByte(queryRowClosingProcessorIndex,
lengthToScan, queryRowClosingPositionProcessor);
if (closeBracketPos == -1) {
queryRowClosingProcessorIndex = responseContent.writerIndex();
break;
}
queryRowClosingPositionProcessor = null;
queryRowClosingProcessorIndex = 0;
int length = closeBracketPos - openBracketPos - responseContent.readerIndex() + 1;
responseContent.skipBytes(openBracketPos);
ByteBuf resultSlice = responseContent.readSlice(length);
queryRowObservable.onNext(resultSlice.copy());
responseContent.discardSomeReadBytes();
}
} | [
"private",
"void",
"parseQueryRows",
"(",
"boolean",
"lastChunk",
")",
"{",
"while",
"(",
"true",
")",
"{",
"int",
"openBracketPos",
"=",
"findNextChar",
"(",
"responseContent",
",",
"'",
"'",
")",
";",
"if",
"(",
"isEmptySection",
"(",
"openBracketPos",
")"... | Parses the query rows from the content stream as long as there is data to be found. | [
"Parses",
"the",
"query",
"rows",
"from",
"the",
"content",
"stream",
"as",
"long",
"as",
"there",
"is",
"data",
"to",
"be",
"found",
"."
] | train | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/endpoint/query/QueryHandler.java#L616-L649 |
netty/netty | codec-http/src/main/java/io/netty/handler/codec/http/HttpUtil.java | HttpUtil.getCharset | public static Charset getCharset(CharSequence contentTypeValue, Charset defaultCharset) {
if (contentTypeValue != null) {
CharSequence charsetCharSequence = getCharsetAsSequence(contentTypeValue);
if (charsetCharSequence != null) {
try {
return Charset.forName(charsetCharSequence.toString());
} catch (UnsupportedCharsetException ignored) {
return defaultCharset;
}
} else {
return defaultCharset;
}
} else {
return defaultCharset;
}
} | java | public static Charset getCharset(CharSequence contentTypeValue, Charset defaultCharset) {
if (contentTypeValue != null) {
CharSequence charsetCharSequence = getCharsetAsSequence(contentTypeValue);
if (charsetCharSequence != null) {
try {
return Charset.forName(charsetCharSequence.toString());
} catch (UnsupportedCharsetException ignored) {
return defaultCharset;
}
} else {
return defaultCharset;
}
} else {
return defaultCharset;
}
} | [
"public",
"static",
"Charset",
"getCharset",
"(",
"CharSequence",
"contentTypeValue",
",",
"Charset",
"defaultCharset",
")",
"{",
"if",
"(",
"contentTypeValue",
"!=",
"null",
")",
"{",
"CharSequence",
"charsetCharSequence",
"=",
"getCharsetAsSequence",
"(",
"contentTy... | Fetch charset from Content-Type header value.
@param contentTypeValue Content-Type header value to parse
@param defaultCharset result to use in case of empty, incorrect or doesn't contain required part header value
@return the charset from message's Content-Type header or {@code defaultCharset}
if charset is not presented or unparsable | [
"Fetch",
"charset",
"from",
"Content",
"-",
"Type",
"header",
"value",
"."
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/HttpUtil.java#L388-L403 |
grails/grails-core | grails-core/src/main/groovy/grails/util/GrailsClassUtils.java | GrailsClassUtils.isSetter | @SuppressWarnings("rawtypes")
public static boolean isSetter(String name, Class[] args) {
if (!StringUtils.hasText(name) || args == null)return false;
if (name.startsWith("set")) {
if (args.length != 1) return false;
return GrailsNameUtils.isPropertyMethodSuffix(name.substring(3));
}
return false;
} | java | @SuppressWarnings("rawtypes")
public static boolean isSetter(String name, Class[] args) {
if (!StringUtils.hasText(name) || args == null)return false;
if (name.startsWith("set")) {
if (args.length != 1) return false;
return GrailsNameUtils.isPropertyMethodSuffix(name.substring(3));
}
return false;
} | [
"@",
"SuppressWarnings",
"(",
"\"rawtypes\"",
")",
"public",
"static",
"boolean",
"isSetter",
"(",
"String",
"name",
",",
"Class",
"[",
"]",
"args",
")",
"{",
"if",
"(",
"!",
"StringUtils",
".",
"hasText",
"(",
"name",
")",
"||",
"args",
"==",
"null",
... | Returns true if the name of the method specified and the number of arguments make it a javabean property setter.
The name is assumed to be a valid Java method name, that is not verified.
@param name The name of the method
@param args The arguments
@return true if it is a javabean property setter | [
"Returns",
"true",
"if",
"the",
"name",
"of",
"the",
"method",
"specified",
"and",
"the",
"number",
"of",
"arguments",
"make",
"it",
"a",
"javabean",
"property",
"setter",
".",
"The",
"name",
"is",
"assumed",
"to",
"be",
"a",
"valid",
"Java",
"method",
"... | train | https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-core/src/main/groovy/grails/util/GrailsClassUtils.java#L743-L753 |
baratine/baratine | kraken/src/main/java/com/caucho/v5/kelp/BlockLeaf.java | BlockLeaf.writeCheckpointFull | void writeCheckpointFull(OutputStream os, int rowHead)
throws IOException
{
BitsUtil.writeInt16(os, _blobTail);
os.write(_buffer, 0, _blobTail);
rowHead = Math.max(rowHead, _rowHead);
int rowLength = _buffer.length - rowHead;
BitsUtil.writeInt16(os, rowLength);
os.write(_buffer, rowHead, rowLength);
} | java | void writeCheckpointFull(OutputStream os, int rowHead)
throws IOException
{
BitsUtil.writeInt16(os, _blobTail);
os.write(_buffer, 0, _blobTail);
rowHead = Math.max(rowHead, _rowHead);
int rowLength = _buffer.length - rowHead;
BitsUtil.writeInt16(os, rowLength);
os.write(_buffer, rowHead, rowLength);
} | [
"void",
"writeCheckpointFull",
"(",
"OutputStream",
"os",
",",
"int",
"rowHead",
")",
"throws",
"IOException",
"{",
"BitsUtil",
".",
"writeInt16",
"(",
"os",
",",
"_blobTail",
")",
";",
"os",
".",
"write",
"(",
"_buffer",
",",
"0",
",",
"_blobTail",
")",
... | Writes the block to the checkpoint stream.
Because of timing, the requested rowHead might be for an older
checkpoint of the block, if new rows have arrived since the request.
<pre><code>
b16 - inline blob length (blobTail)
<n> - inline blob data
b16 - row data length (block_size - row_head)
<m> - row data
</code></pre>
@param rowHead the requested row head | [
"Writes",
"the",
"block",
"to",
"the",
"checkpoint",
"stream",
"."
] | train | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/kelp/BlockLeaf.java#L698-L710 |
Polidea/RxAndroidBle | rxandroidble/src/main/java/com/polidea/rxandroidble2/helpers/ValueInterpreter.java | ValueInterpreter.getFloatValue | public static Float getFloatValue(@NonNull byte[] value, @FloatFormatType int formatType, @IntRange(from = 0) int offset) {
if ((offset + getTypeLen(formatType)) > value.length) {
RxBleLog.w(
"Float formatType (0x%x) is longer than remaining bytes (%d) - returning null", formatType, value.length - offset
);
return null;
}
switch (formatType) {
case FORMAT_SFLOAT:
return bytesToFloat(value[offset], value[offset + 1]);
case FORMAT_FLOAT:
return bytesToFloat(value[offset], value[offset + 1],
value[offset + 2], value[offset + 3]);
default:
RxBleLog.w("Passed an invalid float formatType (0x%x) - returning null", formatType);
return null;
}
} | java | public static Float getFloatValue(@NonNull byte[] value, @FloatFormatType int formatType, @IntRange(from = 0) int offset) {
if ((offset + getTypeLen(formatType)) > value.length) {
RxBleLog.w(
"Float formatType (0x%x) is longer than remaining bytes (%d) - returning null", formatType, value.length - offset
);
return null;
}
switch (formatType) {
case FORMAT_SFLOAT:
return bytesToFloat(value[offset], value[offset + 1]);
case FORMAT_FLOAT:
return bytesToFloat(value[offset], value[offset + 1],
value[offset + 2], value[offset + 3]);
default:
RxBleLog.w("Passed an invalid float formatType (0x%x) - returning null", formatType);
return null;
}
} | [
"public",
"static",
"Float",
"getFloatValue",
"(",
"@",
"NonNull",
"byte",
"[",
"]",
"value",
",",
"@",
"FloatFormatType",
"int",
"formatType",
",",
"@",
"IntRange",
"(",
"from",
"=",
"0",
")",
"int",
"offset",
")",
"{",
"if",
"(",
"(",
"offset",
"+",
... | Return the float value interpreted from the passed byte array.
@param value The byte array from which to interpret value.
@param formatType The format type used to interpret the value.
@param offset Offset at which the float value can be found.
@return The value at a given offset or null if the requested offset exceeds the value size. | [
"Return",
"the",
"float",
"value",
"interpreted",
"from",
"the",
"passed",
"byte",
"array",
"."
] | train | https://github.com/Polidea/RxAndroidBle/blob/c6e4a9753c834d710e255306bb290e9244cdbc10/rxandroidble/src/main/java/com/polidea/rxandroidble2/helpers/ValueInterpreter.java#L136-L155 |
UrielCh/ovh-java-sdk | ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java | ApiOvhOrder.hosting_web_serviceName_upgrade_duration_POST | public OvhOrder hosting_web_serviceName_upgrade_duration_POST(String serviceName, String duration, net.minidev.ovh.api.hosting.web.OvhOfferEnum offer, Boolean waiveRetractationPeriod) throws IOException {
String qPath = "/order/hosting/web/{serviceName}/upgrade/{duration}";
StringBuilder sb = path(qPath, serviceName, duration);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "offer", offer);
addBody(o, "waiveRetractationPeriod", waiveRetractationPeriod);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhOrder.class);
} | java | public OvhOrder hosting_web_serviceName_upgrade_duration_POST(String serviceName, String duration, net.minidev.ovh.api.hosting.web.OvhOfferEnum offer, Boolean waiveRetractationPeriod) throws IOException {
String qPath = "/order/hosting/web/{serviceName}/upgrade/{duration}";
StringBuilder sb = path(qPath, serviceName, duration);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "offer", offer);
addBody(o, "waiveRetractationPeriod", waiveRetractationPeriod);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhOrder.class);
} | [
"public",
"OvhOrder",
"hosting_web_serviceName_upgrade_duration_POST",
"(",
"String",
"serviceName",
",",
"String",
"duration",
",",
"net",
".",
"minidev",
".",
"ovh",
".",
"api",
".",
"hosting",
".",
"web",
".",
"OvhOfferEnum",
"offer",
",",
"Boolean",
"waiveRetr... | Create order
REST: POST /order/hosting/web/{serviceName}/upgrade/{duration}
@param offer [required] New offers for your hosting account
@param waiveRetractationPeriod [required] Indicates that order will be processed with waiving retractation period
@param serviceName [required] The internal name of your hosting
@param duration [required] Duration | [
"Create",
"order"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L4962-L4970 |
osglworks/java-tool | src/main/java/org/osgl/Lang.java | F3.orElse | public F3<P1, P2, P3, R> orElse(final Func3<? super P1, ? super P2, ? super P3, ? extends R> fallback) {
final F3<P1, P2, P3, R> me = this;
return new F3<P1, P2, P3, R>() {
@Override
public R apply(P1 p1, P2 p2, P3 p3) {
try {
return me.apply(p1, p2, p3);
} catch (RuntimeException e) {
return fallback.apply(p1, p2, p3);
}
}
};
} | java | public F3<P1, P2, P3, R> orElse(final Func3<? super P1, ? super P2, ? super P3, ? extends R> fallback) {
final F3<P1, P2, P3, R> me = this;
return new F3<P1, P2, P3, R>() {
@Override
public R apply(P1 p1, P2 p2, P3 p3) {
try {
return me.apply(p1, p2, p3);
} catch (RuntimeException e) {
return fallback.apply(p1, p2, p3);
}
}
};
} | [
"public",
"F3",
"<",
"P1",
",",
"P2",
",",
"P3",
",",
"R",
">",
"orElse",
"(",
"final",
"Func3",
"<",
"?",
"super",
"P1",
",",
"?",
"super",
"P2",
",",
"?",
"super",
"P3",
",",
"?",
"extends",
"R",
">",
"fallback",
")",
"{",
"final",
"F3",
"<... | Returns a composed function that when applied, try to apply this function first, in case
a {@link NotAppliedException} is captured apply to the fallback function specified. This
method helps to implement partial function
@param fallback
the function to applied if this function doesn't apply to the parameter(s)
@return the composed function | [
"Returns",
"a",
"composed",
"function",
"that",
"when",
"applied",
"try",
"to",
"apply",
"this",
"function",
"first",
"in",
"case",
"a",
"{",
"@link",
"NotAppliedException",
"}",
"is",
"captured",
"apply",
"to",
"the",
"fallback",
"function",
"specified",
".",... | train | https://github.com/osglworks/java-tool/blob/8b6eee2bccb067eb32e6a7bc4a4dfef7a7d9008b/src/main/java/org/osgl/Lang.java#L1308-L1320 |
j-a-w-r/jawr-main-repo | jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/generator/validator/CommonsValidatorGenerator.java | CommonsValidatorGenerator.getJavascriptBegin | protected String getJavascriptBegin(String jsFormName, String methods) {
StringBuffer sb = new StringBuffer();
String name = jsFormName.replace('/', '_'); // remove any '/' characters
name = jsFormName.substring(0, 1).toUpperCase()
+ jsFormName.substring(1, jsFormName.length());
sb.append("\n var bCancel = false; \n\n");
sb.append(" function validate" + name + "(form) { \n");
sb.append(" if (bCancel) { \n");
sb.append(" return true; \n");
sb.append(" } else { \n");
// Always return true if there aren't any Javascript validation methods
if ((methods == null) || (methods.length() == 0)) {
sb.append(" return true; \n");
} else {
sb.append(" var formValidationResult; \n");
sb.append(" formValidationResult = " + methods + "; \n");
if (methods.indexOf("&&") >= 0) {
sb.append(" return (formValidationResult); \n");
} else {
// Making Sure that Bitwise operator works:
sb.append(" return (formValidationResult == 1); \n");
}
}
sb.append(" } \n");
sb.append(" } \n\n");
return sb.toString();
} | java | protected String getJavascriptBegin(String jsFormName, String methods) {
StringBuffer sb = new StringBuffer();
String name = jsFormName.replace('/', '_'); // remove any '/' characters
name = jsFormName.substring(0, 1).toUpperCase()
+ jsFormName.substring(1, jsFormName.length());
sb.append("\n var bCancel = false; \n\n");
sb.append(" function validate" + name + "(form) { \n");
sb.append(" if (bCancel) { \n");
sb.append(" return true; \n");
sb.append(" } else { \n");
// Always return true if there aren't any Javascript validation methods
if ((methods == null) || (methods.length() == 0)) {
sb.append(" return true; \n");
} else {
sb.append(" var formValidationResult; \n");
sb.append(" formValidationResult = " + methods + "; \n");
if (methods.indexOf("&&") >= 0) {
sb.append(" return (formValidationResult); \n");
} else {
// Making Sure that Bitwise operator works:
sb.append(" return (formValidationResult == 1); \n");
}
}
sb.append(" } \n");
sb.append(" } \n\n");
return sb.toString();
} | [
"protected",
"String",
"getJavascriptBegin",
"(",
"String",
"jsFormName",
",",
"String",
"methods",
")",
"{",
"StringBuffer",
"sb",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"String",
"name",
"=",
"jsFormName",
".",
"replace",
"(",
"'",
"'",
",",
"'",
"'"... | Returns the opening script element and some initial javascript. | [
"Returns",
"the",
"opening",
"script",
"element",
"and",
"some",
"initial",
"javascript",
"."
] | train | https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/generator/validator/CommonsValidatorGenerator.java#L282-L312 |
deeplearning4j/deeplearning4j | datavec/datavec-arrow/src/main/java/org/datavec/arrow/ArrowConverter.java | ArrowConverter.ndarrayVectorOf | public static VarBinaryVector ndarrayVectorOf(BufferAllocator allocator,String name,int length) {
VarBinaryVector ret = new VarBinaryVector(name,allocator);
ret.allocateNewSafe();
ret.setValueCount(length);
return ret;
} | java | public static VarBinaryVector ndarrayVectorOf(BufferAllocator allocator,String name,int length) {
VarBinaryVector ret = new VarBinaryVector(name,allocator);
ret.allocateNewSafe();
ret.setValueCount(length);
return ret;
} | [
"public",
"static",
"VarBinaryVector",
"ndarrayVectorOf",
"(",
"BufferAllocator",
"allocator",
",",
"String",
"name",
",",
"int",
"length",
")",
"{",
"VarBinaryVector",
"ret",
"=",
"new",
"VarBinaryVector",
"(",
"name",
",",
"allocator",
")",
";",
"ret",
".",
... | Create an ndarray vector that stores structs
of {@link INDArray}
based on the {@link org.apache.arrow.flatbuf.Tensor}
format
@param allocator the allocator to use
@param name the name of the vector
@param length the number of vectors to store
@return | [
"Create",
"an",
"ndarray",
"vector",
"that",
"stores",
"structs",
"of",
"{"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-arrow/src/main/java/org/datavec/arrow/ArrowConverter.java#L943-L948 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/DateFormat.java | DateFormat.getDateTimeInstance | public final static DateFormat getDateTimeInstance(int dateStyle,
int timeStyle)
{
return get(timeStyle, dateStyle, 3, Locale.getDefault(Locale.Category.FORMAT));
} | java | public final static DateFormat getDateTimeInstance(int dateStyle,
int timeStyle)
{
return get(timeStyle, dateStyle, 3, Locale.getDefault(Locale.Category.FORMAT));
} | [
"public",
"final",
"static",
"DateFormat",
"getDateTimeInstance",
"(",
"int",
"dateStyle",
",",
"int",
"timeStyle",
")",
"{",
"return",
"get",
"(",
"timeStyle",
",",
"dateStyle",
",",
"3",
",",
"Locale",
".",
"getDefault",
"(",
"Locale",
".",
"Category",
"."... | Gets the date/time formatter with the given date and time
formatting styles for the default locale.
@param dateStyle the given date formatting style. For example,
SHORT for "M/d/yy" in the US locale.
@param timeStyle the given time formatting style. For example,
SHORT for "h:mm a" in the US locale.
@return a date/time formatter. | [
"Gets",
"the",
"date",
"/",
"time",
"formatter",
"with",
"the",
"given",
"date",
"and",
"time",
"formatting",
"styles",
"for",
"the",
"default",
"locale",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/DateFormat.java#L532-L536 |
lessthanoptimal/BoofCV | main/boofcv-types/src/main/java/boofcv/alg/InputSanityCheck.java | InputSanityCheck.checkReshape | public static void checkReshape(ImageBase<?> imgA, ImageBase<?> imgB) {
if( imgA == imgB )
throw new IllegalArgumentException("Image's can't be the same instance");
imgB.reshape(imgA.width,imgA.height);
} | java | public static void checkReshape(ImageBase<?> imgA, ImageBase<?> imgB) {
if( imgA == imgB )
throw new IllegalArgumentException("Image's can't be the same instance");
imgB.reshape(imgA.width,imgA.height);
} | [
"public",
"static",
"void",
"checkReshape",
"(",
"ImageBase",
"<",
"?",
">",
"imgA",
",",
"ImageBase",
"<",
"?",
">",
"imgB",
")",
"{",
"if",
"(",
"imgA",
"==",
"imgB",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Image's can't be the same instance... | Throws exception if two images are the same instance. Otherwise reshapes B to match A | [
"Throws",
"exception",
"if",
"two",
"images",
"are",
"the",
"same",
"instance",
".",
"Otherwise",
"reshapes",
"B",
"to",
"match",
"A"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-types/src/main/java/boofcv/alg/InputSanityCheck.java#L84-L88 |
eclipse/hawkbit | hawkbit-dmf/hawkbit-dmf-amqp/src/main/java/org/eclipse/hawkbit/amqp/AmqpAuthenticationMessageHandler.java | AmqpAuthenticationMessageHandler.checkIfArtifactIsAssignedToTarget | private void checkIfArtifactIsAssignedToTarget(final DmfTenantSecurityToken secruityToken, final String sha1Hash) {
if (secruityToken.getControllerId() != null) {
checkByControllerId(sha1Hash, secruityToken.getControllerId());
} else if (secruityToken.getTargetId() != null) {
checkByTargetId(sha1Hash, secruityToken.getTargetId());
} else {
LOG.info("anonymous download no authentication check for artifact {}", sha1Hash);
}
} | java | private void checkIfArtifactIsAssignedToTarget(final DmfTenantSecurityToken secruityToken, final String sha1Hash) {
if (secruityToken.getControllerId() != null) {
checkByControllerId(sha1Hash, secruityToken.getControllerId());
} else if (secruityToken.getTargetId() != null) {
checkByTargetId(sha1Hash, secruityToken.getTargetId());
} else {
LOG.info("anonymous download no authentication check for artifact {}", sha1Hash);
}
} | [
"private",
"void",
"checkIfArtifactIsAssignedToTarget",
"(",
"final",
"DmfTenantSecurityToken",
"secruityToken",
",",
"final",
"String",
"sha1Hash",
")",
"{",
"if",
"(",
"secruityToken",
".",
"getControllerId",
"(",
")",
"!=",
"null",
")",
"{",
"checkByControllerId",
... | check action for this download purposes, the method will throw an
EntityNotFoundException in case the controller is not allowed to download
this file because it's not assigned to an action and not assigned to this
controller. Otherwise no controllerId is set = anonymous download
@param secruityToken
the security token which holds the target ID to check on
@param sha1Hash
of the artifact to verify if the given target is allowed to
download it | [
"check",
"action",
"for",
"this",
"download",
"purposes",
"the",
"method",
"will",
"throw",
"an",
"EntityNotFoundException",
"in",
"case",
"the",
"controller",
"is",
"not",
"allowed",
"to",
"download",
"this",
"file",
"because",
"it",
"s",
"not",
"assigned",
"... | train | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-dmf/hawkbit-dmf-amqp/src/main/java/org/eclipse/hawkbit/amqp/AmqpAuthenticationMessageHandler.java#L128-L138 |
glyptodon/guacamole-client | extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/user/ModeledUser.java | ModeledUser.setUnrestrictedAttributes | private void setUnrestrictedAttributes(Map<String, String> attributes) {
// Translate full name attribute
getModel().setFullName(TextField.parse(attributes.get(User.Attribute.FULL_NAME)));
// Translate email address attribute
getModel().setEmailAddress(TextField.parse(attributes.get(User.Attribute.EMAIL_ADDRESS)));
// Translate organization attribute
getModel().setOrganization(TextField.parse(attributes.get(User.Attribute.ORGANIZATION)));
// Translate role attribute
getModel().setOrganizationalRole(TextField.parse(attributes.get(User.Attribute.ORGANIZATIONAL_ROLE)));
} | java | private void setUnrestrictedAttributes(Map<String, String> attributes) {
// Translate full name attribute
getModel().setFullName(TextField.parse(attributes.get(User.Attribute.FULL_NAME)));
// Translate email address attribute
getModel().setEmailAddress(TextField.parse(attributes.get(User.Attribute.EMAIL_ADDRESS)));
// Translate organization attribute
getModel().setOrganization(TextField.parse(attributes.get(User.Attribute.ORGANIZATION)));
// Translate role attribute
getModel().setOrganizationalRole(TextField.parse(attributes.get(User.Attribute.ORGANIZATIONAL_ROLE)));
} | [
"private",
"void",
"setUnrestrictedAttributes",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"attributes",
")",
"{",
"// Translate full name attribute",
"getModel",
"(",
")",
".",
"setFullName",
"(",
"TextField",
".",
"parse",
"(",
"attributes",
".",
"get",
"(... | Stores all unrestricted (unprivileged) attributes within the underlying
user model, pulling the values of those attributes from the given Map.
@param attributes
The Map to pull all unrestricted attributes from. | [
"Stores",
"all",
"unrestricted",
"(",
"unprivileged",
")",
"attributes",
"within",
"the",
"underlying",
"user",
"model",
"pulling",
"the",
"values",
"of",
"those",
"attributes",
"from",
"the",
"given",
"Map",
"."
] | train | https://github.com/glyptodon/guacamole-client/blob/ea1b10e9d1e3f1fa640dff2ca64d61b44bf1ace9/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/user/ModeledUser.java#L467-L481 |
Azure/azure-sdk-for-java | containerregistry/resource-manager/v2018_02_01_preview/src/main/java/com/microsoft/azure/management/containerregistry/v2018_02_01_preview/implementation/BuildStepsInner.java | BuildStepsInner.updateAsync | public Observable<BuildStepInner> updateAsync(String resourceGroupName, String registryName, String buildTaskName, String stepName, BuildStepUpdateParameters buildStepUpdateParameters) {
return updateWithServiceResponseAsync(resourceGroupName, registryName, buildTaskName, stepName, buildStepUpdateParameters).map(new Func1<ServiceResponse<BuildStepInner>, BuildStepInner>() {
@Override
public BuildStepInner call(ServiceResponse<BuildStepInner> response) {
return response.body();
}
});
} | java | public Observable<BuildStepInner> updateAsync(String resourceGroupName, String registryName, String buildTaskName, String stepName, BuildStepUpdateParameters buildStepUpdateParameters) {
return updateWithServiceResponseAsync(resourceGroupName, registryName, buildTaskName, stepName, buildStepUpdateParameters).map(new Func1<ServiceResponse<BuildStepInner>, BuildStepInner>() {
@Override
public BuildStepInner call(ServiceResponse<BuildStepInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"BuildStepInner",
">",
"updateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"registryName",
",",
"String",
"buildTaskName",
",",
"String",
"stepName",
",",
"BuildStepUpdateParameters",
"buildStepUpdateParameters",
")",
"{",
"ret... | Updates a build step in a build task.
@param resourceGroupName The name of the resource group to which the container registry belongs.
@param registryName The name of the container registry.
@param buildTaskName The name of the container registry build task.
@param stepName The name of a build step for a container registry build task.
@param buildStepUpdateParameters The parameters for updating a build step.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Updates",
"a",
"build",
"step",
"in",
"a",
"build",
"task",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerregistry/resource-manager/v2018_02_01_preview/src/main/java/com/microsoft/azure/management/containerregistry/v2018_02_01_preview/implementation/BuildStepsInner.java#L934-L941 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/tools/javac/util/AbstractLog.java | AbstractLog.mandatoryNote | public void mandatoryNote(final JavaFileObject file, Note noteKey) {
report(diags.mandatoryNote(getSource(file), noteKey));
} | java | public void mandatoryNote(final JavaFileObject file, Note noteKey) {
report(diags.mandatoryNote(getSource(file), noteKey));
} | [
"public",
"void",
"mandatoryNote",
"(",
"final",
"JavaFileObject",
"file",
",",
"Note",
"noteKey",
")",
"{",
"report",
"(",
"diags",
".",
"mandatoryNote",
"(",
"getSource",
"(",
"file",
")",
",",
"noteKey",
")",
")",
";",
"}"
] | Provide a non-fatal notification, unless suppressed by the -nowarn option.
@param noteKey The key for the localized notification message. | [
"Provide",
"a",
"non",
"-",
"fatal",
"notification",
"unless",
"suppressed",
"by",
"the",
"-",
"nowarn",
"option",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/util/AbstractLog.java#L392-L394 |
unbescape/unbescape | src/main/java/org/unbescape/xml/XmlEscape.java | XmlEscape.escapeXml11 | public static void escapeXml11(final Reader reader, final Writer writer, final XmlEscapeType type, final XmlEscapeLevel level)
throws IOException {
escapeXml(reader, writer, XmlEscapeSymbols.XML11_SYMBOLS, type, level);
} | java | public static void escapeXml11(final Reader reader, final Writer writer, final XmlEscapeType type, final XmlEscapeLevel level)
throws IOException {
escapeXml(reader, writer, XmlEscapeSymbols.XML11_SYMBOLS, type, level);
} | [
"public",
"static",
"void",
"escapeXml11",
"(",
"final",
"Reader",
"reader",
",",
"final",
"Writer",
"writer",
",",
"final",
"XmlEscapeType",
"type",
",",
"final",
"XmlEscapeLevel",
"level",
")",
"throws",
"IOException",
"{",
"escapeXml",
"(",
"reader",
",",
"... | <p>
Perform a (configurable) XML 1.1 <strong>escape</strong> operation on a <tt>Reader</tt> input,
writing results to a <tt>Writer</tt>.
</p>
<p>
This method will perform an escape operation according to the specified
{@link org.unbescape.xml.XmlEscapeType} and {@link org.unbescape.xml.XmlEscapeLevel}
argument values.
</p>
<p>
All other <tt>Reader</tt>/<tt>Writer</tt>-based <tt>escapeXml11*(...)</tt> methods call this one with preconfigured
<tt>type</tt> and <tt>level</tt> values.
</p>
<p>
This method is <strong>thread-safe</strong>.
</p>
@param reader the <tt>Reader</tt> reading the text to be escaped.
@param type the type of escape operation to be performed, see {@link org.unbescape.xml.XmlEscapeType}.
@param writer the <tt>java.io.Writer</tt> to which the escaped result will be written. Nothing will
be written at all to this writer if input is <tt>null</tt>.
@param level the escape level to be applied, see {@link org.unbescape.xml.XmlEscapeLevel}.
@throws IOException if an input/output exception occurs
@since 1.1.2 | [
"<p",
">",
"Perform",
"a",
"(",
"configurable",
")",
"XML",
"1",
".",
"1",
"<strong",
">",
"escape<",
"/",
"strong",
">",
"operation",
"on",
"a",
"<tt",
">",
"Reader<",
"/",
"tt",
">",
"input",
"writing",
"results",
"to",
"a",
"<tt",
">",
"Writer<",
... | train | https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/xml/XmlEscape.java#L1622-L1625 |
twilliamson/mogwee-logging | src/main/java/com/mogwee/logging/Logger.java | Logger.infof | public final void infof(String message, Object... args)
{
logf(Level.INFO, null, message, args);
} | java | public final void infof(String message, Object... args)
{
logf(Level.INFO, null, message, args);
} | [
"public",
"final",
"void",
"infof",
"(",
"String",
"message",
",",
"Object",
"...",
"args",
")",
"{",
"logf",
"(",
"Level",
".",
"INFO",
",",
"null",
",",
"message",
",",
"args",
")",
";",
"}"
] | Logs a formatted message if INFO logging is enabled.
@param message a <a href="http://download.oracle.com/javase/6/docs/api/java/util/Formatter.html#syntax">format string</a>
@param args arguments referenced by the format specifiers in the format string. | [
"Logs",
"a",
"formatted",
"message",
"if",
"INFO",
"logging",
"is",
"enabled",
"."
] | train | https://github.com/twilliamson/mogwee-logging/blob/30b99c2649de455432d956a8f6a74316de4cd62c/src/main/java/com/mogwee/logging/Logger.java#L148-L151 |
carewebframework/carewebframework-core | org.carewebframework.shell/src/main/java/org/carewebframework/shell/CareWebShellEx.java | CareWebShellEx.registerLayout | public void registerLayout(String path, String resource) throws Exception {
Layout layout = LayoutParser.parseResource(resource);
ElementUI parent = parentFromPath(path);
if (parent != null) {
layout.materialize(parent);
}
} | java | public void registerLayout(String path, String resource) throws Exception {
Layout layout = LayoutParser.parseResource(resource);
ElementUI parent = parentFromPath(path);
if (parent != null) {
layout.materialize(parent);
}
} | [
"public",
"void",
"registerLayout",
"(",
"String",
"path",
",",
"String",
"resource",
")",
"throws",
"Exception",
"{",
"Layout",
"layout",
"=",
"LayoutParser",
".",
"parseResource",
"(",
"resource",
")",
";",
"ElementUI",
"parent",
"=",
"parentFromPath",
"(",
... | Registers a layout at the specified path.
@param path Format is <tab name>\<tree node path>
@param resource Location of the xml layout.
@throws Exception Unspecified exception. | [
"Registers",
"a",
"layout",
"at",
"the",
"specified",
"path",
"."
] | train | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/CareWebShellEx.java#L311-L318 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Operators.java | Operators.initOperators | @SafeVarargs
private final <O extends OperatorHelper> void initOperators(Map<Name, List<O>> opsMap, O... ops) {
for (O o : ops) {
Name opName = o.name;
List<O> helpers = opsMap.getOrDefault(opName, List.nil());
opsMap.put(opName, helpers.prepend(o));
}
} | java | @SafeVarargs
private final <O extends OperatorHelper> void initOperators(Map<Name, List<O>> opsMap, O... ops) {
for (O o : ops) {
Name opName = o.name;
List<O> helpers = opsMap.getOrDefault(opName, List.nil());
opsMap.put(opName, helpers.prepend(o));
}
} | [
"@",
"SafeVarargs",
"private",
"final",
"<",
"O",
"extends",
"OperatorHelper",
">",
"void",
"initOperators",
"(",
"Map",
"<",
"Name",
",",
"List",
"<",
"O",
">",
">",
"opsMap",
",",
"O",
"...",
"ops",
")",
"{",
"for",
"(",
"O",
"o",
":",
"ops",
")"... | Complete the initialization of an operator helper by storing it into the corresponding operator map. | [
"Complete",
"the",
"initialization",
"of",
"an",
"operator",
"helper",
"by",
"storing",
"it",
"into",
"the",
"corresponding",
"operator",
"map",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Operators.java#L818-L825 |
Waikato/moa | moa/src/main/java/com/yahoo/labs/samoa/instances/SparseInstanceData.java | SparseInstanceData.setValue | @Override
public void setValue(int attributeIndex, double d) {
int index = locateIndex(attributeIndex);
if (index(index) == attributeIndex) {
this.attributeValues[index] = d;
} else {
// We need to add the value
}
} | java | @Override
public void setValue(int attributeIndex, double d) {
int index = locateIndex(attributeIndex);
if (index(index) == attributeIndex) {
this.attributeValues[index] = d;
} else {
// We need to add the value
}
} | [
"@",
"Override",
"public",
"void",
"setValue",
"(",
"int",
"attributeIndex",
",",
"double",
"d",
")",
"{",
"int",
"index",
"=",
"locateIndex",
"(",
"attributeIndex",
")",
";",
"if",
"(",
"index",
"(",
"index",
")",
"==",
"attributeIndex",
")",
"{",
"this... | Sets the value.
@param attributeIndex the attribute index
@param d the d | [
"Sets",
"the",
"value",
"."
] | train | https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/com/yahoo/labs/samoa/instances/SparseInstanceData.java#L218-L226 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X400Address.java | X400Address.constrains | public int constrains(GeneralNameInterface inputName) throws UnsupportedOperationException {
int constraintType;
if (inputName == null)
constraintType = NAME_DIFF_TYPE;
else if (inputName.getType() != NAME_X400)
constraintType = NAME_DIFF_TYPE;
else
//Narrowing, widening, and match constraints not defined in rfc2459 for X400Address
throw new UnsupportedOperationException("Narrowing, widening, and match are not supported for X400Address.");
return constraintType;
} | java | public int constrains(GeneralNameInterface inputName) throws UnsupportedOperationException {
int constraintType;
if (inputName == null)
constraintType = NAME_DIFF_TYPE;
else if (inputName.getType() != NAME_X400)
constraintType = NAME_DIFF_TYPE;
else
//Narrowing, widening, and match constraints not defined in rfc2459 for X400Address
throw new UnsupportedOperationException("Narrowing, widening, and match are not supported for X400Address.");
return constraintType;
} | [
"public",
"int",
"constrains",
"(",
"GeneralNameInterface",
"inputName",
")",
"throws",
"UnsupportedOperationException",
"{",
"int",
"constraintType",
";",
"if",
"(",
"inputName",
"==",
"null",
")",
"constraintType",
"=",
"NAME_DIFF_TYPE",
";",
"else",
"if",
"(",
... | Return type of constraint inputName places on this name:<ul>
<li>NAME_DIFF_TYPE = -1: input name is different type from name (i.e. does not constrain).
<li>NAME_MATCH = 0: input name matches name.
<li>NAME_NARROWS = 1: input name narrows name (is lower in the naming subtree)
<li>NAME_WIDENS = 2: input name widens name (is higher in the naming subtree)
<li>NAME_SAME_TYPE = 3: input name does not match or narrow name, but is same type.
</ul>. These results are used in checking NameConstraints during
certification path verification.
@param inputName to be checked for being constrained
@returns constraint type above
@throws UnsupportedOperationException if name is same type, but comparison operations are
not supported for this name type. | [
"Return",
"type",
"of",
"constraint",
"inputName",
"places",
"on",
"this",
"name",
":",
"<ul",
">",
"<li",
">",
"NAME_DIFF_TYPE",
"=",
"-",
"1",
":",
"input",
"name",
"is",
"different",
"type",
"from",
"name",
"(",
"i",
".",
"e",
".",
"does",
"not",
... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X400Address.java#L399-L409 |
Azure/azure-sdk-for-java | mysql/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/mysql/v2017_12_01/implementation/ServersInner.java | ServersInner.beginCreate | public ServerInner beginCreate(String resourceGroupName, String serverName, ServerForCreate parameters) {
return beginCreateWithServiceResponseAsync(resourceGroupName, serverName, parameters).toBlocking().single().body();
} | java | public ServerInner beginCreate(String resourceGroupName, String serverName, ServerForCreate parameters) {
return beginCreateWithServiceResponseAsync(resourceGroupName, serverName, parameters).toBlocking().single().body();
} | [
"public",
"ServerInner",
"beginCreate",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"ServerForCreate",
"parameters",
")",
"{",
"return",
"beginCreateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"serverName",
",",
"parameters",
")",
... | Creates a new server or updates an existing server. The update action will overwrite the existing server.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param parameters The required parameters for creating or updating a server.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the ServerInner object if successful. | [
"Creates",
"a",
"new",
"server",
"or",
"updates",
"an",
"existing",
"server",
".",
"The",
"update",
"action",
"will",
"overwrite",
"the",
"existing",
"server",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mysql/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/mysql/v2017_12_01/implementation/ServersInner.java#L193-L195 |
voldemort/voldemort | src/java/voldemort/server/protocol/admin/AsyncOperationService.java | AsyncOperationService.submitOperation | public synchronized void submitOperation(int requestId, AsyncOperation operation) {
if(this.operations.containsKey(requestId))
throw new VoldemortException("Request " + requestId
+ " already submitted to the system");
this.operations.put(requestId, operation);
scheduler.scheduleNow(operation);
logger.debug("Handling async operation " + requestId);
} | java | public synchronized void submitOperation(int requestId, AsyncOperation operation) {
if(this.operations.containsKey(requestId))
throw new VoldemortException("Request " + requestId
+ " already submitted to the system");
this.operations.put(requestId, operation);
scheduler.scheduleNow(operation);
logger.debug("Handling async operation " + requestId);
} | [
"public",
"synchronized",
"void",
"submitOperation",
"(",
"int",
"requestId",
",",
"AsyncOperation",
"operation",
")",
"{",
"if",
"(",
"this",
".",
"operations",
".",
"containsKey",
"(",
"requestId",
")",
")",
"throw",
"new",
"VoldemortException",
"(",
"\"Reques... | Submit a operations. Throw a run time exception if the operations is
already submitted
@param operation The asynchronous operations to submit
@param requestId Id of the request | [
"Submit",
"a",
"operations",
".",
"Throw",
"a",
"run",
"time",
"exception",
"if",
"the",
"operations",
"is",
"already",
"submitted"
] | train | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/server/protocol/admin/AsyncOperationService.java#L68-L76 |
ibm-bluemix-mobile-services/bms-clientsdk-android-core | lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/security/mca/internal/AuthorizationProcessManager.java | AuthorizationProcessManager.saveCertificateFromResponse | private void saveCertificateFromResponse(Response response) {
try {
String responseBody = response.getResponseText();
JSONObject jsonResponse = new JSONObject(responseBody);
//handle certificate
String certificateString = jsonResponse.getString("certificate");
X509Certificate certificate = CertificatesUtility.base64StringToCertificate(certificateString);
CertificatesUtility.checkValidityWithPublicKey(certificate, registrationKeyPair.getPublic());
certificateStore.saveCertificate(registrationKeyPair, certificate);
//save the clientId separately
preferences.clientId.set(jsonResponse.getString("clientId"));
} catch (Exception e) {
throw new RuntimeException("Failed to save certificate from response", e);
}
logger.debug("certificate successfully saved");
} | java | private void saveCertificateFromResponse(Response response) {
try {
String responseBody = response.getResponseText();
JSONObject jsonResponse = new JSONObject(responseBody);
//handle certificate
String certificateString = jsonResponse.getString("certificate");
X509Certificate certificate = CertificatesUtility.base64StringToCertificate(certificateString);
CertificatesUtility.checkValidityWithPublicKey(certificate, registrationKeyPair.getPublic());
certificateStore.saveCertificate(registrationKeyPair, certificate);
//save the clientId separately
preferences.clientId.set(jsonResponse.getString("clientId"));
} catch (Exception e) {
throw new RuntimeException("Failed to save certificate from response", e);
}
logger.debug("certificate successfully saved");
} | [
"private",
"void",
"saveCertificateFromResponse",
"(",
"Response",
"response",
")",
"{",
"try",
"{",
"String",
"responseBody",
"=",
"response",
".",
"getResponseText",
"(",
")",
";",
"JSONObject",
"jsonResponse",
"=",
"new",
"JSONObject",
"(",
"responseBody",
")",... | Extract the certificate data from response and save it on local storage
@param response contains the certificate data | [
"Extract",
"the",
"certificate",
"data",
"from",
"response",
"and",
"save",
"it",
"on",
"local",
"storage"
] | train | https://github.com/ibm-bluemix-mobile-services/bms-clientsdk-android-core/blob/8db4f00d0d564792397bfc0e5bd57d52a238b858/lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/security/mca/internal/AuthorizationProcessManager.java#L223-L244 |
rundeck/rundeck | core/src/main/java/com/dtolabs/rundeck/core/utils/ZipUtil.java | ZipUtil.extractZipFile | public static void extractZipFile(final String path, final File dest, final String fileName) throws IOException {
FilenameFilter filter = null;
if (null != fileName) {
filter = new FilenameFilter() {
public boolean accept(final File file, final String name) {
return fileName.equals(name) || fileName.startsWith(name);
}
};
}
extractZip(path, dest, filter, null, null);
} | java | public static void extractZipFile(final String path, final File dest, final String fileName) throws IOException {
FilenameFilter filter = null;
if (null != fileName) {
filter = new FilenameFilter() {
public boolean accept(final File file, final String name) {
return fileName.equals(name) || fileName.startsWith(name);
}
};
}
extractZip(path, dest, filter, null, null);
} | [
"public",
"static",
"void",
"extractZipFile",
"(",
"final",
"String",
"path",
",",
"final",
"File",
"dest",
",",
"final",
"String",
"fileName",
")",
"throws",
"IOException",
"{",
"FilenameFilter",
"filter",
"=",
"null",
";",
"if",
"(",
"null",
"!=",
"fileNam... | Extracts a single entry from the zip
@param path zip file path
@param dest destination directory
@param fileName specific filepath to extract
@throws IOException on io error | [
"Extracts",
"a",
"single",
"entry",
"from",
"the",
"zip"
] | train | https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/utils/ZipUtil.java#L70-L80 |
apereo/cas | support/cas-server-support-saml-idp-web/src/main/java/org/apereo/cas/support/saml/web/idp/profile/AbstractSamlProfileHandlerController.java | AbstractSamlProfileHandlerController.buildCasAssertion | protected Assertion buildCasAssertion(final String principal,
final RegisteredService registeredService,
final Map<String, Object> attributes) {
val p = new AttributePrincipalImpl(principal, attributes);
return new AssertionImpl(p, DateTimeUtils.dateOf(ZonedDateTime.now(ZoneOffset.UTC)),
null, DateTimeUtils.dateOf(ZonedDateTime.now(ZoneOffset.UTC)), attributes);
} | java | protected Assertion buildCasAssertion(final String principal,
final RegisteredService registeredService,
final Map<String, Object> attributes) {
val p = new AttributePrincipalImpl(principal, attributes);
return new AssertionImpl(p, DateTimeUtils.dateOf(ZonedDateTime.now(ZoneOffset.UTC)),
null, DateTimeUtils.dateOf(ZonedDateTime.now(ZoneOffset.UTC)), attributes);
} | [
"protected",
"Assertion",
"buildCasAssertion",
"(",
"final",
"String",
"principal",
",",
"final",
"RegisteredService",
"registeredService",
",",
"final",
"Map",
"<",
"String",
",",
"Object",
">",
"attributes",
")",
"{",
"val",
"p",
"=",
"new",
"AttributePrincipalI... | Build cas assertion.
@param principal the principal
@param registeredService the registered service
@param attributes the attributes
@return the assertion | [
"Build",
"cas",
"assertion",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-saml-idp-web/src/main/java/org/apereo/cas/support/saml/web/idp/profile/AbstractSamlProfileHandlerController.java#L181-L187 |
oboehm/jfachwert | src/main/java/de/jfachwert/net/Telefonnummer.java | Telefonnummer.getRufnummer | public Telefonnummer getRufnummer() {
String inlandsnummer = RegExUtils.replaceAll(this.getInlandsnummer().toString(), "[ /]+", " ");
return new Telefonnummer(StringUtils.substringAfter(inlandsnummer, " ").replaceAll(" ", ""));
} | java | public Telefonnummer getRufnummer() {
String inlandsnummer = RegExUtils.replaceAll(this.getInlandsnummer().toString(), "[ /]+", " ");
return new Telefonnummer(StringUtils.substringAfter(inlandsnummer, " ").replaceAll(" ", ""));
} | [
"public",
"Telefonnummer",
"getRufnummer",
"(",
")",
"{",
"String",
"inlandsnummer",
"=",
"RegExUtils",
".",
"replaceAll",
"(",
"this",
".",
"getInlandsnummer",
"(",
")",
".",
"toString",
"(",
")",
",",
"\"[ /]+\"",
",",
"\" \"",
")",
";",
"return",
"new",
... | Liefert die Nummer der Ortsvermittlungsstelle, d.h. die Telefonnummer
ohne Vorwahl und Laenderkennzahl.
@return z.B. "32168" | [
"Liefert",
"die",
"Nummer",
"der",
"Ortsvermittlungsstelle",
"d",
".",
"h",
".",
"die",
"Telefonnummer",
"ohne",
"Vorwahl",
"und",
"Laenderkennzahl",
"."
] | train | https://github.com/oboehm/jfachwert/blob/67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b/src/main/java/de/jfachwert/net/Telefonnummer.java#L172-L175 |
xvik/guice-persist-orient | src/main/java/ru/vyarus/guice/persist/orient/repository/core/ext/util/ExtUtils.java | ExtUtils.findAmendAnnotations | public static List<Annotation> findAmendAnnotations(
final Method method, final Class<?> root,
final Class<? extends RepositoryMethodDescriptor> descriptorType) {
final List<Annotation> res = filterAnnotations(AmendMethod.class, method.getAnnotations());
// strict check: if bad annotation defined - definitely error
ExtCompatibilityUtils.checkAmendExtensionsCompatibility(descriptorType, res);
// some annotations may be defined on type; these annotations are filtered according to descriptor
merge(res, filterAnnotations(AmendMethod.class, method.getDeclaringClass().getAnnotations()), descriptorType);
if (root != method.getDeclaringClass()) {
// global extensions may be applied on repository level
merge(res, filterAnnotations(AmendMethod.class, root.getAnnotations()), descriptorType);
}
return res;
} | java | public static List<Annotation> findAmendAnnotations(
final Method method, final Class<?> root,
final Class<? extends RepositoryMethodDescriptor> descriptorType) {
final List<Annotation> res = filterAnnotations(AmendMethod.class, method.getAnnotations());
// strict check: if bad annotation defined - definitely error
ExtCompatibilityUtils.checkAmendExtensionsCompatibility(descriptorType, res);
// some annotations may be defined on type; these annotations are filtered according to descriptor
merge(res, filterAnnotations(AmendMethod.class, method.getDeclaringClass().getAnnotations()), descriptorType);
if (root != method.getDeclaringClass()) {
// global extensions may be applied on repository level
merge(res, filterAnnotations(AmendMethod.class, root.getAnnotations()), descriptorType);
}
return res;
} | [
"public",
"static",
"List",
"<",
"Annotation",
">",
"findAmendAnnotations",
"(",
"final",
"Method",
"method",
",",
"final",
"Class",
"<",
"?",
">",
"root",
",",
"final",
"Class",
"<",
"?",
"extends",
"RepositoryMethodDescriptor",
">",
"descriptorType",
")",
"{... | Searches for amend annotations (annotations annotated with
{@link ru.vyarus.guice.persist.orient.repository.core.spi.amend.AmendMethod}).
<p>
Amend annotation may be defined on method, type and probably globally on root repository type.
If annotation is defined in two places then only more prioritized will be used.
Priorities: method, direct method type, repository type (in simple cases the last two will be the same type).
<p>
Extensions compatibility is checked against descriptor object. If extension declared directly on method
error will be throw (bad usage). For type and root type declared extensions, incompatible extensions simply
skipped (case when extension should apply to all methods except few).
@param method repository method
@param root root repository type
@param descriptorType type of descriptor object (used to filter extensions)
@return list of found extension annotations | [
"Searches",
"for",
"amend",
"annotations",
"(",
"annotations",
"annotated",
"with",
"{",
"@link",
"ru",
".",
"vyarus",
".",
"guice",
".",
"persist",
".",
"orient",
".",
"repository",
".",
"core",
".",
"spi",
".",
"amend",
".",
"AmendMethod",
"}",
")",
".... | train | https://github.com/xvik/guice-persist-orient/blob/5ef06fb4f734360512e9824a3b875c4906c56b5b/src/main/java/ru/vyarus/guice/persist/orient/repository/core/ext/util/ExtUtils.java#L99-L112 |
google/closure-compiler | src/com/google/javascript/jscomp/TypeValidator.java | TypeValidator.expectCanAssignToPrototype | void expectCanAssignToPrototype(JSType ownerType, Node node, JSType rightType) {
if (ownerType.isFunctionType()) {
FunctionType functionType = ownerType.toMaybeFunctionType();
if (functionType.isConstructor()) {
expectObject(node, rightType, "cannot override prototype with non-object");
}
}
} | java | void expectCanAssignToPrototype(JSType ownerType, Node node, JSType rightType) {
if (ownerType.isFunctionType()) {
FunctionType functionType = ownerType.toMaybeFunctionType();
if (functionType.isConstructor()) {
expectObject(node, rightType, "cannot override prototype with non-object");
}
}
} | [
"void",
"expectCanAssignToPrototype",
"(",
"JSType",
"ownerType",
",",
"Node",
"node",
",",
"JSType",
"rightType",
")",
"{",
"if",
"(",
"ownerType",
".",
"isFunctionType",
"(",
")",
")",
"{",
"FunctionType",
"functionType",
"=",
"ownerType",
".",
"toMaybeFunctio... | Expect that it's valid to assign something to a given type's prototype.
<p>Most of these checks occur during TypedScopeCreator, so we just handle very basic cases here
<p>For example, assuming `Foo` is a constructor, `Foo.prototype = 3;` will warn because `3` is
not an object.
@param ownerType The type of the object whose prototype is being changed. (e.g. `Foo` above)
@param node Node to issue warnings on (e.g. `3` above)
@param rightType the rvalue type being assigned to the prototype (e.g. `number` above) | [
"Expect",
"that",
"it",
"s",
"valid",
"to",
"assign",
"something",
"to",
"a",
"given",
"type",
"s",
"prototype",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypeValidator.java#L760-L767 |
btrplace/scheduler | choco/src/main/java/org/btrplace/scheduler/choco/extensions/pack/KnapsackDecorator.java | KnapsackDecorator.postRemoveItem | @SuppressWarnings("squid:S3346")
public void postRemoveItem(int item, int bin) {
assert candidate.get(bin).get(item);
candidate.get(bin).clear(item);
} | java | @SuppressWarnings("squid:S3346")
public void postRemoveItem(int item, int bin) {
assert candidate.get(bin).get(item);
candidate.get(bin).clear(item);
} | [
"@",
"SuppressWarnings",
"(",
"\"squid:S3346\"",
")",
"public",
"void",
"postRemoveItem",
"(",
"int",
"item",
",",
"int",
"bin",
")",
"{",
"assert",
"candidate",
".",
"get",
"(",
"bin",
")",
".",
"get",
"(",
"item",
")",
";",
"candidate",
".",
"get",
"... | update the candidate list of a bin when an item is removed
@param item the removed item
@param bin the bin | [
"update",
"the",
"candidate",
"list",
"of",
"a",
"bin",
"when",
"an",
"item",
"is",
"removed"
] | train | https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/choco/src/main/java/org/btrplace/scheduler/choco/extensions/pack/KnapsackDecorator.java#L148-L152 |
infinispan/infinispan | commons/src/main/java/org/infinispan/commons/marshall/MarshallUtil.java | MarshallUtil.marshallArray | public static <E> void marshallArray(E[] array, ObjectOutput out) throws IOException {
final int size = array == null ? NULL_VALUE : array.length;
marshallSize(out, size);
if (size <= 0) {
return;
}
for (int i = 0; i < size; ++i) {
out.writeObject(array[i]);
}
} | java | public static <E> void marshallArray(E[] array, ObjectOutput out) throws IOException {
final int size = array == null ? NULL_VALUE : array.length;
marshallSize(out, size);
if (size <= 0) {
return;
}
for (int i = 0; i < size; ++i) {
out.writeObject(array[i]);
}
} | [
"public",
"static",
"<",
"E",
">",
"void",
"marshallArray",
"(",
"E",
"[",
"]",
"array",
",",
"ObjectOutput",
"out",
")",
"throws",
"IOException",
"{",
"final",
"int",
"size",
"=",
"array",
"==",
"null",
"?",
"NULL_VALUE",
":",
"array",
".",
"length",
... | Marshall arrays.
<p>
This method supports {@code null} {@code array}.
@param array Array to marshall.
@param out {@link ObjectOutput} to write.
@param <E> Array type.
@throws IOException If any of the usual Input/Output related exceptions occur. | [
"Marshall",
"arrays",
".",
"<p",
">",
"This",
"method",
"supports",
"{",
"@code",
"null",
"}",
"{",
"@code",
"array",
"}",
"."
] | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/commons/src/main/java/org/infinispan/commons/marshall/MarshallUtil.java#L184-L193 |
litsec/eidas-opensaml | opensaml3/src/main/java/se/litsec/eidas/opensaml/ext/RequestedAttributeTemplates.java | RequestedAttributeTemplates.CURRENT_GIVEN_NAME | public static RequestedAttribute CURRENT_GIVEN_NAME(Boolean isRequired, boolean includeFriendlyName) {
return create(AttributeConstants.EIDAS_CURRENT_GIVEN_NAME_ATTRIBUTE_NAME,
includeFriendlyName ? AttributeConstants.EIDAS_CURRENT_GIVEN_NAME_ATTRIBUTE_FRIENDLY_NAME : null,
Attribute.URI_REFERENCE, isRequired);
} | java | public static RequestedAttribute CURRENT_GIVEN_NAME(Boolean isRequired, boolean includeFriendlyName) {
return create(AttributeConstants.EIDAS_CURRENT_GIVEN_NAME_ATTRIBUTE_NAME,
includeFriendlyName ? AttributeConstants.EIDAS_CURRENT_GIVEN_NAME_ATTRIBUTE_FRIENDLY_NAME : null,
Attribute.URI_REFERENCE, isRequired);
} | [
"public",
"static",
"RequestedAttribute",
"CURRENT_GIVEN_NAME",
"(",
"Boolean",
"isRequired",
",",
"boolean",
"includeFriendlyName",
")",
"{",
"return",
"create",
"(",
"AttributeConstants",
".",
"EIDAS_CURRENT_GIVEN_NAME_ATTRIBUTE_NAME",
",",
"includeFriendlyName",
"?",
"At... | Creates a {@code RequestedAttribute} object for the CurrentGivenName attribute.
@param isRequired
flag to tell whether the attribute is required
@param includeFriendlyName
flag that tells whether the friendly name should be included
@return a {@code RequestedAttribute} object representing the CurrentGivenName attribute | [
"Creates",
"a",
"{",
"@code",
"RequestedAttribute",
"}",
"object",
"for",
"the",
"CurrentGivenName",
"attribute",
"."
] | train | https://github.com/litsec/eidas-opensaml/blob/522ba6dba433a9524cb8a02464cc3b087b47a2b7/opensaml3/src/main/java/se/litsec/eidas/opensaml/ext/RequestedAttributeTemplates.java#L71-L75 |
UrielCh/ovh-java-sdk | ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java | ApiOvhTelephony.billingAccount_easyPabx_serviceName_hunting_agent_agentNumber_DELETE | public void billingAccount_easyPabx_serviceName_hunting_agent_agentNumber_DELETE(String billingAccount, String serviceName, String agentNumber) throws IOException {
String qPath = "/telephony/{billingAccount}/easyPabx/{serviceName}/hunting/agent/{agentNumber}";
StringBuilder sb = path(qPath, billingAccount, serviceName, agentNumber);
exec(qPath, "DELETE", sb.toString(), null);
} | java | public void billingAccount_easyPabx_serviceName_hunting_agent_agentNumber_DELETE(String billingAccount, String serviceName, String agentNumber) throws IOException {
String qPath = "/telephony/{billingAccount}/easyPabx/{serviceName}/hunting/agent/{agentNumber}";
StringBuilder sb = path(qPath, billingAccount, serviceName, agentNumber);
exec(qPath, "DELETE", sb.toString(), null);
} | [
"public",
"void",
"billingAccount_easyPabx_serviceName_hunting_agent_agentNumber_DELETE",
"(",
"String",
"billingAccount",
",",
"String",
"serviceName",
",",
"String",
"agentNumber",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/telephony/{billingAccount}/easyP... | Delete the agent
REST: DELETE /telephony/{billingAccount}/easyPabx/{serviceName}/hunting/agent/{agentNumber}
@param billingAccount [required] The name of your billingAccount
@param serviceName [required]
@param agentNumber [required] The phone number of the agent | [
"Delete",
"the",
"agent"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L3572-L3576 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.