repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 192 | func_name stringlengths 5 108 | whole_func_string stringlengths 75 3.91k | language stringclasses 1
value | func_code_string stringlengths 75 3.91k | func_code_tokens listlengths 21 629 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 647 | split_name stringclasses 1
value | func_code_url stringlengths 111 306 |
|---|---|---|---|---|---|---|---|---|---|---|
Azure/azure-sdk-for-java | sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ReplicationLinksInner.java | ReplicationLinksInner.failoverAllowDataLossAsync | public Observable<Void> failoverAllowDataLossAsync(String resourceGroupName, String serverName, String databaseName, String linkId) {
return failoverAllowDataLossWithServiceResponseAsync(resourceGroupName, serverName, databaseName, linkId).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | java | public Observable<Void> failoverAllowDataLossAsync(String resourceGroupName, String serverName, String databaseName, String linkId) {
return failoverAllowDataLossWithServiceResponseAsync(resourceGroupName, serverName, databaseName, linkId).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"failoverAllowDataLossAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"databaseName",
",",
"String",
"linkId",
")",
"{",
"return",
"failoverAllowDataLossWithServiceResponseAsync",
"(",
"re... | Sets which replica database is primary by failing over from the current primary replica database. This operation might result in data loss.
@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 databaseName The name of the database that has the replication link to be failed over.
@param linkId The ID of the replication link to be failed over.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Sets",
"which",
"replica",
"database",
"is",
"primary",
"by",
"failing",
"over",
"from",
"the",
"current",
"primary",
"replica",
"database",
".",
"This",
"operation",
"might",
"result",
"in",
"data",
"loss",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ReplicationLinksInner.java#L509-L516 |
eFaps/eFaps-Kernel | src/main/java/org/efaps/db/Context.java | Context.isTMMarkedRollback | public static boolean isTMMarkedRollback()
throws EFapsException
{
try {
return Context.TRANSMANAG.getStatus() == Status.STATUS_MARKED_ROLLBACK;
} catch (final SystemException e) {
throw new EFapsException(Context.class, "isTMMarkedRollback.SystemException", e);
}
} | java | public static boolean isTMMarkedRollback()
throws EFapsException
{
try {
return Context.TRANSMANAG.getStatus() == Status.STATUS_MARKED_ROLLBACK;
} catch (final SystemException e) {
throw new EFapsException(Context.class, "isTMMarkedRollback.SystemException", e);
}
} | [
"public",
"static",
"boolean",
"isTMMarkedRollback",
"(",
")",
"throws",
"EFapsException",
"{",
"try",
"{",
"return",
"Context",
".",
"TRANSMANAG",
".",
"getStatus",
"(",
")",
"==",
"Status",
".",
"STATUS_MARKED_ROLLBACK",
";",
"}",
"catch",
"(",
"final",
"Sys... | Is the status of transaction manager marked roll back?
@return <i>true</i> if transaction manager is marked roll back, otherwise
<i>false</i>
@throws EFapsException if the status of the transaction manager could not
be evaluated
@see #TRANSMANAG | [
"Is",
"the",
"status",
"of",
"transaction",
"manager",
"marked",
"roll",
"back?"
] | train | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/db/Context.java#L1166-L1174 |
Ellzord/JALSE | src/main/java/jalse/entities/Entities.java | Entities.findEntityRecursively | public static boolean findEntityRecursively(final EntityContainer container, final UUID id) {
final AtomicBoolean found = new AtomicBoolean();
walkEntityTree(container, e -> {
if (id.equals(e.getID())) {
found.set(true);
return EntityVisitResult.EXIT;
} else {
return EntityVisitResult.CONTINUE;
}
});
return found.get();
} | java | public static boolean findEntityRecursively(final EntityContainer container, final UUID id) {
final AtomicBoolean found = new AtomicBoolean();
walkEntityTree(container, e -> {
if (id.equals(e.getID())) {
found.set(true);
return EntityVisitResult.EXIT;
} else {
return EntityVisitResult.CONTINUE;
}
});
return found.get();
} | [
"public",
"static",
"boolean",
"findEntityRecursively",
"(",
"final",
"EntityContainer",
"container",
",",
"final",
"UUID",
"id",
")",
"{",
"final",
"AtomicBoolean",
"found",
"=",
"new",
"AtomicBoolean",
"(",
")",
";",
"walkEntityTree",
"(",
"container",
",",
"e... | Walks through the entity tree looking for an entity.
@param container
Entity container.
@param id
Entity ID to look for.
@return Whether the entity was found.
@see #walkEntityTree(EntityContainer, EntityVisitor) | [
"Walks",
"through",
"the",
"entity",
"tree",
"looking",
"for",
"an",
"entity",
"."
] | train | https://github.com/Ellzord/JALSE/blob/43fc6572de9b16eb8474aa21a88b6b2d11291615/src/main/java/jalse/entities/Entities.java#L143-L156 |
craterdog/java-primitive-types | src/main/java/craterdog/primitives/Probability.java | Probability.or | static public Probability or(Probability probability1, Probability probability2) {
double p1 = probability1.value;
double p2 = probability2.value;
return new Probability(p1 + p2 - (p1 * p2));
} | java | static public Probability or(Probability probability1, Probability probability2) {
double p1 = probability1.value;
double p2 = probability2.value;
return new Probability(p1 + p2 - (p1 * p2));
} | [
"static",
"public",
"Probability",
"or",
"(",
"Probability",
"probability1",
",",
"Probability",
"probability2",
")",
"{",
"double",
"p1",
"=",
"probability1",
".",
"value",
";",
"double",
"p2",
"=",
"probability2",
".",
"value",
";",
"return",
"new",
"Probabi... | This function returns the logical disjunction of the specified probabilities. The value
of the logical disjunction of two probabilities is P + Q - and(P, Q).
@param probability1 The first probability.
@param probability2 The second probability.
@return The logical disjunction of the two probabilities. | [
"This",
"function",
"returns",
"the",
"logical",
"disjunction",
"of",
"the",
"specified",
"probabilities",
".",
"The",
"value",
"of",
"the",
"logical",
"disjunction",
"of",
"two",
"probabilities",
"is",
"P",
"+",
"Q",
"-",
"and",
"(",
"P",
"Q",
")",
"."
] | train | https://github.com/craterdog/java-primitive-types/blob/730f9bceacfac69f99b094464a7da5747c07a59e/src/main/java/craterdog/primitives/Probability.java#L178-L182 |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/GVRCameraRig.java | GVRCameraRig.prettyPrint | @Override
public void prettyPrint(StringBuffer sb, int indent) {
sb.append(Log.getSpaces(indent));
sb.append(getClass().getSimpleName());
sb.append(System.lineSeparator());
sb.append(Log.getSpaces(indent + 2));
sb.append("type: ");
sb.append(getCameraRigType());
sb.append(System.lineSeparator());
sb.append(Log.getSpaces(indent + 2));
sb.append("lookAt: ");
float[] lookAt = getLookAt();
for (float vecElem : lookAt) {
sb.append(vecElem);
sb.append(" ");
}
sb.append(System.lineSeparator());
sb.append(Log.getSpaces(indent + 2));
sb.append("leftCamera: ");
if (leftCamera == null) {
sb.append("null");
sb.append(System.lineSeparator());
} else {
sb.append(System.lineSeparator());
leftCamera.prettyPrint(sb, indent + 4);
}
sb.append(Log.getSpaces(indent + 2));
sb.append("rightCamera: ");
if (rightCamera == null) {
sb.append("null");
sb.append(System.lineSeparator());
} else {
sb.append(System.lineSeparator());
rightCamera.prettyPrint(sb, indent + 4);
}
} | java | @Override
public void prettyPrint(StringBuffer sb, int indent) {
sb.append(Log.getSpaces(indent));
sb.append(getClass().getSimpleName());
sb.append(System.lineSeparator());
sb.append(Log.getSpaces(indent + 2));
sb.append("type: ");
sb.append(getCameraRigType());
sb.append(System.lineSeparator());
sb.append(Log.getSpaces(indent + 2));
sb.append("lookAt: ");
float[] lookAt = getLookAt();
for (float vecElem : lookAt) {
sb.append(vecElem);
sb.append(" ");
}
sb.append(System.lineSeparator());
sb.append(Log.getSpaces(indent + 2));
sb.append("leftCamera: ");
if (leftCamera == null) {
sb.append("null");
sb.append(System.lineSeparator());
} else {
sb.append(System.lineSeparator());
leftCamera.prettyPrint(sb, indent + 4);
}
sb.append(Log.getSpaces(indent + 2));
sb.append("rightCamera: ");
if (rightCamera == null) {
sb.append("null");
sb.append(System.lineSeparator());
} else {
sb.append(System.lineSeparator());
rightCamera.prettyPrint(sb, indent + 4);
}
} | [
"@",
"Override",
"public",
"void",
"prettyPrint",
"(",
"StringBuffer",
"sb",
",",
"int",
"indent",
")",
"{",
"sb",
".",
"append",
"(",
"Log",
".",
"getSpaces",
"(",
"indent",
")",
")",
";",
"sb",
".",
"append",
"(",
"getClass",
"(",
")",
".",
"getSim... | Prints the {@link GVRCameraRig} object with indentation.
@param sb
The {@code StringBuffer} object to receive the output.
@param indent
Size of indentation in number of spaces. | [
"Prints",
"the",
"{",
"@link",
"GVRCameraRig",
"}",
"object",
"with",
"indentation",
"."
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRCameraRig.java#L608-L647 |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/routing/bindings/Validator.java | Validator.expectValue | public void expectValue(String name, String message) {
String value = Optional.ofNullable(get(name)).orElse("");
if (StringUtils.isBlank(StringUtils.trimToNull(value))) {
addError(name, Optional.ofNullable(message).orElse(messages.get(Validation.REQUIRED_KEY.name(), name)));
}
} | java | public void expectValue(String name, String message) {
String value = Optional.ofNullable(get(name)).orElse("");
if (StringUtils.isBlank(StringUtils.trimToNull(value))) {
addError(name, Optional.ofNullable(message).orElse(messages.get(Validation.REQUIRED_KEY.name(), name)));
}
} | [
"public",
"void",
"expectValue",
"(",
"String",
"name",
",",
"String",
"message",
")",
"{",
"String",
"value",
"=",
"Optional",
".",
"ofNullable",
"(",
"get",
"(",
"name",
")",
")",
".",
"orElse",
"(",
"\"\"",
")",
";",
"if",
"(",
"StringUtils",
".",
... | Validates a given field to be present with a value
@param name The field to check
@param message A custom error message instead of the default one | [
"Validates",
"a",
"given",
"field",
"to",
"be",
"present",
"with",
"a",
"value"
] | train | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/bindings/Validator.java#L71-L77 |
sebastiangraf/treetank | interfacemodules/jax-rx/src/main/java/org/treetank/service/jaxrx/util/WorkerHelper.java | WorkerHelper.serializeXML | public static XMLSerializer serializeXML(final ISession session, final OutputStream out,
final boolean serializeXMLDec, final boolean serializeRest, final Long nodekey, final Long revision) {
final XMLSerializerProperties props = new XMLSerializerProperties();
final XMLSerializerBuilder builder;
if (revision == null && nodekey == null)
builder = new XMLSerializerBuilder(session, out);
else if (revision != null && nodekey == null)
builder = new XMLSerializerBuilder(session, out, revision);
else if (revision == null && nodekey != null)
builder = new XMLSerializerBuilder(session, nodekey, out, props);
else
builder = new XMLSerializerBuilder(session, nodekey, out, props, revision);
builder.setREST(serializeRest);
builder.setID(serializeRest);
builder.setDeclaration(serializeXMLDec);
builder.setIndend(false);
final XMLSerializer serializer = builder.build();
return serializer;
} | java | public static XMLSerializer serializeXML(final ISession session, final OutputStream out,
final boolean serializeXMLDec, final boolean serializeRest, final Long nodekey, final Long revision) {
final XMLSerializerProperties props = new XMLSerializerProperties();
final XMLSerializerBuilder builder;
if (revision == null && nodekey == null)
builder = new XMLSerializerBuilder(session, out);
else if (revision != null && nodekey == null)
builder = new XMLSerializerBuilder(session, out, revision);
else if (revision == null && nodekey != null)
builder = new XMLSerializerBuilder(session, nodekey, out, props);
else
builder = new XMLSerializerBuilder(session, nodekey, out, props, revision);
builder.setREST(serializeRest);
builder.setID(serializeRest);
builder.setDeclaration(serializeXMLDec);
builder.setIndend(false);
final XMLSerializer serializer = builder.build();
return serializer;
} | [
"public",
"static",
"XMLSerializer",
"serializeXML",
"(",
"final",
"ISession",
"session",
",",
"final",
"OutputStream",
"out",
",",
"final",
"boolean",
"serializeXMLDec",
",",
"final",
"boolean",
"serializeRest",
",",
"final",
"Long",
"nodekey",
",",
"final",
"Lon... | This method creates a new XMLSerializer reference
@param session
Associated session.
@param out
OutputStream
@param serializeXMLDec
specifies whether XML declaration should be shown
@param serializeRest
specifies whether node id should be shown
@return new XMLSerializer reference | [
"This",
"method",
"creates",
"a",
"new",
"XMLSerializer",
"reference"
] | train | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/jax-rx/src/main/java/org/treetank/service/jaxrx/util/WorkerHelper.java#L154-L172 |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/AuthenticateApi.java | AuthenticateApi.createSubjectAndPushItOnThreadAsNeeded | private void createSubjectAndPushItOnThreadAsNeeded(HttpServletRequest req, HttpServletResponse res) {
// We got a new instance of FormLogoutExtensionProcess every request.
logoutSubject = null;
Subject subject = subjectManager.getCallerSubject();
if (subject == null || subjectHelper.isUnauthenticated(subject)) {
if (authService == null && securityServiceRef != null) {
authService = securityServiceRef.getService().getAuthenticationService();
}
SSOAuthenticator ssoAuthenticator = new SSOAuthenticator(authService, null, null, ssoCookieHelper);
//TODO: We can not call ssoAuthenticator.authenticate because it can not handle multiple tokens.
//In the next release, authenticate need to handle multiple authentication data. See story
AuthenticationResult authResult = ssoAuthenticator.handleSSO(req, res);
if (authResult != null && authResult.getStatus() == AuthResult.SUCCESS) {
subjectManager.setCallerSubject(authResult.getSubject());
logoutSubject = authResult.getSubject();
}
}
} | java | private void createSubjectAndPushItOnThreadAsNeeded(HttpServletRequest req, HttpServletResponse res) {
// We got a new instance of FormLogoutExtensionProcess every request.
logoutSubject = null;
Subject subject = subjectManager.getCallerSubject();
if (subject == null || subjectHelper.isUnauthenticated(subject)) {
if (authService == null && securityServiceRef != null) {
authService = securityServiceRef.getService().getAuthenticationService();
}
SSOAuthenticator ssoAuthenticator = new SSOAuthenticator(authService, null, null, ssoCookieHelper);
//TODO: We can not call ssoAuthenticator.authenticate because it can not handle multiple tokens.
//In the next release, authenticate need to handle multiple authentication data. See story
AuthenticationResult authResult = ssoAuthenticator.handleSSO(req, res);
if (authResult != null && authResult.getStatus() == AuthResult.SUCCESS) {
subjectManager.setCallerSubject(authResult.getSubject());
logoutSubject = authResult.getSubject();
}
}
} | [
"private",
"void",
"createSubjectAndPushItOnThreadAsNeeded",
"(",
"HttpServletRequest",
"req",
",",
"HttpServletResponse",
"res",
")",
"{",
"// We got a new instance of FormLogoutExtensionProcess every request.",
"logoutSubject",
"=",
"null",
";",
"Subject",
"subject",
"=",
"su... | For formLogout, this is a new request and there is no subject on the thread. A previous
request handled on this thread may not be from this same client. We have to authenticate using
the token and push the subject on thread so webcontainer can use the subject credential to invalidate
the session.
@param req
@param res | [
"For",
"formLogout",
"this",
"is",
"a",
"new",
"request",
"and",
"there",
"is",
"no",
"subject",
"on",
"the",
"thread",
".",
"A",
"previous",
"request",
"handled",
"on",
"this",
"thread",
"may",
"not",
"be",
"from",
"this",
"same",
"client",
".",
"We",
... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/AuthenticateApi.java#L534-L551 |
facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/TaskTracker.java | TaskTracker.purgeTask | private void purgeTask(TaskInProgress tip, boolean wasFailure)
throws IOException {
if (tip != null) {
LOG.info("About to purge task: " + tip.getTask().getTaskID());
// Remove the task from running jobs,
// removing the job if it's the last task
removeTaskFromJob(tip.getTask().getJobID(), tip);
tip.jobHasFinished(wasFailure);
if (tip.getTask().isMapTask()) {
indexCache.removeMap(tip.getTask().getTaskID().toString());
}
}
} | java | private void purgeTask(TaskInProgress tip, boolean wasFailure)
throws IOException {
if (tip != null) {
LOG.info("About to purge task: " + tip.getTask().getTaskID());
// Remove the task from running jobs,
// removing the job if it's the last task
removeTaskFromJob(tip.getTask().getJobID(), tip);
tip.jobHasFinished(wasFailure);
if (tip.getTask().isMapTask()) {
indexCache.removeMap(tip.getTask().getTaskID().toString());
}
}
} | [
"private",
"void",
"purgeTask",
"(",
"TaskInProgress",
"tip",
",",
"boolean",
"wasFailure",
")",
"throws",
"IOException",
"{",
"if",
"(",
"tip",
"!=",
"null",
")",
"{",
"LOG",
".",
"info",
"(",
"\"About to purge task: \"",
"+",
"tip",
".",
"getTask",
"(",
... | Remove the tip and update all relevant state.
@param tip {@link TaskInProgress} to be removed.
@param wasFailure did the task fail or was it killed? | [
"Remove",
"the",
"tip",
"and",
"update",
"all",
"relevant",
"state",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/TaskTracker.java#L2180-L2193 |
mucaho/jnetrobust | jnetrobust-core/src/main/java/com/github/mucaho/jnetrobust/Logger.java | Logger.getConsoleLogger | public static Logger getConsoleLogger(final String name) {
return new Logger() {
@Override
public void log(String description, Object... params) {
System.out.print("[" + name + "]: " + description + "\t");
for (Object param: params)
System.out.print(param + "\t");
System.out.println();
}
};
} | java | public static Logger getConsoleLogger(final String name) {
return new Logger() {
@Override
public void log(String description, Object... params) {
System.out.print("[" + name + "]: " + description + "\t");
for (Object param: params)
System.out.print(param + "\t");
System.out.println();
}
};
} | [
"public",
"static",
"Logger",
"getConsoleLogger",
"(",
"final",
"String",
"name",
")",
"{",
"return",
"new",
"Logger",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"log",
"(",
"String",
"description",
",",
"Object",
"...",
"params",
")",
"{",
"System"... | Retrieve a simple logger which logs events to the {@link java.lang.System#out System.out} stream.
@param name the name of the protocol instance
@return a new console <code>Logger</code> | [
"Retrieve",
"a",
"simple",
"logger",
"which",
"logs",
"events",
"to",
"the",
"{"
] | train | https://github.com/mucaho/jnetrobust/blob/b82150eb2a4371dae9e4f40814cb8f538917c0fb/jnetrobust-core/src/main/java/com/github/mucaho/jnetrobust/Logger.java#L50-L60 |
jbundle/jbundle | thin/base/db/base/src/main/java/org/jbundle/thin/base/db/mem/base/PTable.java | PTable.saveCurrentKeys | public void saveCurrentKeys(FieldTable table, BaseBuffer bufferToSave, boolean bResetKeys) throws DBException
{
if (bufferToSave != null)
bufferToSave.bufferToFields(table.getRecord(), Constants.DONT_DISPLAY, Constants.READ_MOVE);
for (int iKeyArea = Constants.MAIN_KEY_AREA; iKeyArea < table.getRecord().getKeyAreaCount() + Constants.MAIN_KEY_AREA; iKeyArea++)
{ // Save the current keys
KeyAreaInfo keyArea = table.getRecord().getKeyArea(iKeyArea);
if (bResetKeys)
keyArea.zeroKeyFields(Constants.TEMP_KEY_AREA);
else
keyArea.setupKeyBuffer(null, Constants.TEMP_KEY_AREA);
}
} | java | public void saveCurrentKeys(FieldTable table, BaseBuffer bufferToSave, boolean bResetKeys) throws DBException
{
if (bufferToSave != null)
bufferToSave.bufferToFields(table.getRecord(), Constants.DONT_DISPLAY, Constants.READ_MOVE);
for (int iKeyArea = Constants.MAIN_KEY_AREA; iKeyArea < table.getRecord().getKeyAreaCount() + Constants.MAIN_KEY_AREA; iKeyArea++)
{ // Save the current keys
KeyAreaInfo keyArea = table.getRecord().getKeyArea(iKeyArea);
if (bResetKeys)
keyArea.zeroKeyFields(Constants.TEMP_KEY_AREA);
else
keyArea.setupKeyBuffer(null, Constants.TEMP_KEY_AREA);
}
} | [
"public",
"void",
"saveCurrentKeys",
"(",
"FieldTable",
"table",
",",
"BaseBuffer",
"bufferToSave",
",",
"boolean",
"bResetKeys",
")",
"throws",
"DBException",
"{",
"if",
"(",
"bufferToSave",
"!=",
"null",
")",
"bufferToSave",
".",
"bufferToFields",
"(",
"table",
... | Save the current key value's in the user's keyinfo space, so you can retrieve them later.
This is used primarly for updates and move()s.
@param table The table.
@return true if successful.
@exception DBException File exception. | [
"Save",
"the",
"current",
"key",
"value",
"s",
"in",
"the",
"user",
"s",
"keyinfo",
"space",
"so",
"you",
"can",
"retrieve",
"them",
"later",
".",
"This",
"is",
"used",
"primarly",
"for",
"updates",
"and",
"move",
"()",
"s",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/base/src/main/java/org/jbundle/thin/base/db/mem/base/PTable.java#L506-L518 |
paypal/SeLion | client/src/main/java/com/paypal/selion/platform/html/AbstractContainer.java | AbstractContainer.locateElement | public WebElement locateElement(int index, String childLocator) {
if (index < 0) {
throw new IllegalArgumentException("index cannot be a negative value");
}
setIndex(index);
WebElement locatedElement = null;
if (getParent() != null) {
locatedElement = getParent().locateChildElement(childLocator);
} else {
locatedElement = HtmlElementUtils.locateElement(childLocator, this);
}
return locatedElement;
} | java | public WebElement locateElement(int index, String childLocator) {
if (index < 0) {
throw new IllegalArgumentException("index cannot be a negative value");
}
setIndex(index);
WebElement locatedElement = null;
if (getParent() != null) {
locatedElement = getParent().locateChildElement(childLocator);
} else {
locatedElement = HtmlElementUtils.locateElement(childLocator, this);
}
return locatedElement;
} | [
"public",
"WebElement",
"locateElement",
"(",
"int",
"index",
",",
"String",
"childLocator",
")",
"{",
"if",
"(",
"index",
"<",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"index cannot be a negative value\"",
")",
";",
"}",
"setIndex",
"("... | Sets the container index and searches for the descendant element using the child locator.
@param index
index of the container element to search on
@param childLocator
locator of the child element within the container
@return child WebElement found using child locator at the indexed container | [
"Sets",
"the",
"container",
"index",
"and",
"searches",
"for",
"the",
"descendant",
"element",
"using",
"the",
"child",
"locator",
"."
] | train | https://github.com/paypal/SeLion/blob/694d12d0df76db48d0360b16192770c6a4fbdfd2/client/src/main/java/com/paypal/selion/platform/html/AbstractContainer.java#L302-L314 |
eFaps/eFaps-Kernel | src/main/java/org/efaps/init/StartupDatabaseConnection.java | StartupDatabaseConnection.configureEFapsProperties | protected static void configureEFapsProperties(final Context _compCtx,
final Map<String, String> _eFapsProps)
throws StartupException
{
try {
Util.bind(_compCtx, "env/" + INamingBinds.RESOURCE_CONFIGPROPERTIES, _eFapsProps);
} catch (final NamingException e) {
throw new StartupException("could not bind eFaps Properties '" + _eFapsProps + "'", e);
// CHECKSTYLE:OFF
} catch (final Exception e) {
// CHECKSTYLE:ON
throw new StartupException("could not bind eFaps Properties '" + _eFapsProps + "'", e);
}
} | java | protected static void configureEFapsProperties(final Context _compCtx,
final Map<String, String> _eFapsProps)
throws StartupException
{
try {
Util.bind(_compCtx, "env/" + INamingBinds.RESOURCE_CONFIGPROPERTIES, _eFapsProps);
} catch (final NamingException e) {
throw new StartupException("could not bind eFaps Properties '" + _eFapsProps + "'", e);
// CHECKSTYLE:OFF
} catch (final Exception e) {
// CHECKSTYLE:ON
throw new StartupException("could not bind eFaps Properties '" + _eFapsProps + "'", e);
}
} | [
"protected",
"static",
"void",
"configureEFapsProperties",
"(",
"final",
"Context",
"_compCtx",
",",
"final",
"Map",
"<",
"String",
",",
"String",
">",
"_eFapsProps",
")",
"throws",
"StartupException",
"{",
"try",
"{",
"Util",
".",
"bind",
"(",
"_compCtx",
","... | Add the eFaps Properties to the JNDI binding.
@param _compCtx Java root naming context
@param _eFapsProps Properties to bind
@throws StartupException on error | [
"Add",
"the",
"eFaps",
"Properties",
"to",
"the",
"JNDI",
"binding",
"."
] | train | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/init/StartupDatabaseConnection.java#L349-L362 |
kuali/ojb-1.0.4 | src/xdoclet/java/src/xdoclet/modules/ojb/constraints/ModelConstraints.java | ModelConstraints.ensureReferencedPKs | private void ensureReferencedPKs(ModelDef modelDef, ReferenceDescriptorDef refDef) throws ConstraintException
{
String targetClassName = refDef.getProperty(PropertyHelper.OJB_PROPERTY_CLASS_REF);
ClassDescriptorDef targetClassDef = modelDef.getClass(targetClassName);
ensurePKsFromHierarchy(targetClassDef);
} | java | private void ensureReferencedPKs(ModelDef modelDef, ReferenceDescriptorDef refDef) throws ConstraintException
{
String targetClassName = refDef.getProperty(PropertyHelper.OJB_PROPERTY_CLASS_REF);
ClassDescriptorDef targetClassDef = modelDef.getClass(targetClassName);
ensurePKsFromHierarchy(targetClassDef);
} | [
"private",
"void",
"ensureReferencedPKs",
"(",
"ModelDef",
"modelDef",
",",
"ReferenceDescriptorDef",
"refDef",
")",
"throws",
"ConstraintException",
"{",
"String",
"targetClassName",
"=",
"refDef",
".",
"getProperty",
"(",
"PropertyHelper",
".",
"OJB_PROPERTY_CLASS_REF",... | Ensures that the primary keys required by the given reference are present in the referenced class.
@param modelDef The model
@param refDef The reference
@throws ConstraintException If there is a conflict between the primary keys | [
"Ensures",
"that",
"the",
"primary",
"keys",
"required",
"by",
"the",
"given",
"reference",
"are",
"present",
"in",
"the",
"referenced",
"class",
"."
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/xdoclet/java/src/xdoclet/modules/ojb/constraints/ModelConstraints.java#L109-L115 |
junit-team/junit4 | src/main/java/org/junit/internal/Checks.java | Checks.notNull | public static <T> T notNull(T value, String message) {
if (value == null) {
throw new NullPointerException(message);
}
return value;
} | java | public static <T> T notNull(T value, String message) {
if (value == null) {
throw new NullPointerException(message);
}
return value;
} | [
"public",
"static",
"<",
"T",
">",
"T",
"notNull",
"(",
"T",
"value",
",",
"String",
"message",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"message",
")",
";",
"}",
"return",
"value",
";",
"}"
] | Checks that the given value is not {@code null}, using the given message
as the exception message if an exception is thrown.
@param value object reference to check
@param message message to use if {@code value} is {@code null}
@return the passed-in value, if not {@code null}
@throws NullPointerException if {@code value} is {@code null} | [
"Checks",
"that",
"the",
"given",
"value",
"is",
"not",
"{",
"@code",
"null",
"}",
"using",
"the",
"given",
"message",
"as",
"the",
"exception",
"message",
"if",
"an",
"exception",
"is",
"thrown",
"."
] | train | https://github.com/junit-team/junit4/blob/d9861ecdb6e487f6c352437ee823879aca3b81d4/src/main/java/org/junit/internal/Checks.java#L31-L36 |
haraldk/TwelveMonkeys | common/common-lang/src/main/java/com/twelvemonkeys/util/convert/ConverterImpl.java | ConverterImpl.toObject | public Object toObject(String pString, Class pType, String pFormat)
throws ConversionException {
if (pString == null) {
return null;
}
if (pType == null) {
throw new MissingTypeException();
}
// Get converter
PropertyConverter converter = getConverterForType(pType);
if (converter == null) {
throw new NoAvailableConverterException("Cannot convert to object, no converter available for type \"" + pType.getName() + "\"");
}
// Convert and return
return converter.toObject(pString, pType, pFormat);
} | java | public Object toObject(String pString, Class pType, String pFormat)
throws ConversionException {
if (pString == null) {
return null;
}
if (pType == null) {
throw new MissingTypeException();
}
// Get converter
PropertyConverter converter = getConverterForType(pType);
if (converter == null) {
throw new NoAvailableConverterException("Cannot convert to object, no converter available for type \"" + pType.getName() + "\"");
}
// Convert and return
return converter.toObject(pString, pType, pFormat);
} | [
"public",
"Object",
"toObject",
"(",
"String",
"pString",
",",
"Class",
"pType",
",",
"String",
"pFormat",
")",
"throws",
"ConversionException",
"{",
"if",
"(",
"pString",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"pType",
"==",
"nul... | Converts the string to an object of the given type, parsing after the
given format.
@param pString the string to convert
@param pType the type to convert to
@param pFormat the vonversion format
@return the object created from the given string.
@throws ConversionException if the string cannot be converted for any
reason. | [
"Converts",
"the",
"string",
"to",
"an",
"object",
"of",
"the",
"given",
"type",
"parsing",
"after",
"the",
"given",
"format",
"."
] | train | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/common/common-lang/src/main/java/com/twelvemonkeys/util/convert/ConverterImpl.java#L88-L108 |
JodaOrg/joda-time | src/main/java/org/joda/time/DateMidnight.java | DateMidnight.withDurationAdded | public DateMidnight withDurationAdded(ReadableDuration durationToAdd, int scalar) {
if (durationToAdd == null || scalar == 0) {
return this;
}
return withDurationAdded(durationToAdd.getMillis(), scalar);
} | java | public DateMidnight withDurationAdded(ReadableDuration durationToAdd, int scalar) {
if (durationToAdd == null || scalar == 0) {
return this;
}
return withDurationAdded(durationToAdd.getMillis(), scalar);
} | [
"public",
"DateMidnight",
"withDurationAdded",
"(",
"ReadableDuration",
"durationToAdd",
",",
"int",
"scalar",
")",
"{",
"if",
"(",
"durationToAdd",
"==",
"null",
"||",
"scalar",
"==",
"0",
")",
"{",
"return",
"this",
";",
"}",
"return",
"withDurationAdded",
"... | Returns a copy of this date with the specified duration added.
<p>
If the addition is zero, then <code>this</code> is returned.
@param durationToAdd the duration to add to this one, null means zero
@param scalar the amount of times to add, such as -1 to subtract once
@return a copy of this datetime with the duration added
@throws ArithmeticException if the new datetime exceeds the capacity of a long | [
"Returns",
"a",
"copy",
"of",
"this",
"date",
"with",
"the",
"specified",
"duration",
"added",
".",
"<p",
">",
"If",
"the",
"addition",
"is",
"zero",
"then",
"<code",
">",
"this<",
"/",
"code",
">",
"is",
"returned",
"."
] | train | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/DateMidnight.java#L530-L535 |
alkacon/opencms-core | src/org/opencms/ui/apps/CmsFileExplorer.java | CmsFileExplorer.onSiteOrProjectChange | public void onSiteOrProjectChange(CmsProject project, String siteRoot) {
if ((siteRoot != null) && !siteRoot.equals(getSiteRootFromState())) {
changeSite(siteRoot, null, true);
} else if ((project != null) && !project.getUuid().equals(getProjectIdFromState())) {
openPath(getPathFromState(), true);
}
m_appContext.updateOnChange();
setToolbarButtonsEnabled(!CmsAppWorkplaceUi.isOnlineProject());
} | java | public void onSiteOrProjectChange(CmsProject project, String siteRoot) {
if ((siteRoot != null) && !siteRoot.equals(getSiteRootFromState())) {
changeSite(siteRoot, null, true);
} else if ((project != null) && !project.getUuid().equals(getProjectIdFromState())) {
openPath(getPathFromState(), true);
}
m_appContext.updateOnChange();
setToolbarButtonsEnabled(!CmsAppWorkplaceUi.isOnlineProject());
} | [
"public",
"void",
"onSiteOrProjectChange",
"(",
"CmsProject",
"project",
",",
"String",
"siteRoot",
")",
"{",
"if",
"(",
"(",
"siteRoot",
"!=",
"null",
")",
"&&",
"!",
"siteRoot",
".",
"equals",
"(",
"getSiteRootFromState",
"(",
")",
")",
")",
"{",
"change... | Call if site and or project have been changed.<p>
@param project the project
@param siteRoot the site root | [
"Call",
"if",
"site",
"and",
"or",
"project",
"have",
"been",
"changed",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/CmsFileExplorer.java#L1017-L1026 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/linkedlist/LinkedList.java | LinkedList.insertAtBottom | public Entry insertAtBottom(Entry entry)
{
if (tc.isEntryEnabled())
SibTr.entry(tc, "insertAtBottom", new Object[] { entry });
//only add in the new entry if it is not already in a list.
if(entry.parentList == null)
{
//if the list is empty
if(last == null)
{
//double check that the link references are null
entry.previous = null;
entry.next = null;
//record the first and last pointers
first = entry;
last = entry;
//set the entry's parent list to show that it is now part of this list
entry.parentList = this;
}
else //if there are already entries in the list
{
//insert the new entry after the last one in the list
insertAfter(entry, last);
}
if (tc.isEntryEnabled())
SibTr.exit(tc, "insertAtBottom", entry);
return entry;
}
//if the entry is already in a list, throw a runtime exception
SIErrorException e = new SIErrorException(
nls.getFormattedMessage(
"INTERNAL_MESSAGING_ERROR_CWSIP0001",
new Object[] {
"com.ibm.ws.sib.processor.utils.linkedlist.LinkedList",
"1:166:1.18" },
null));
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.utils.linkedlist.LinkedList.insertAtBottom",
"1:172:1.18",
this);
SibTr.exception(tc, e);
SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0001",
new Object[] {
"com.ibm.ws.sib.processor.utils.linkedlist.LinkedList",
"1:179:1.18" });
if (tc.isEntryEnabled())
SibTr.exit(tc, "insertAtBottom", e);
throw e;
} | java | public Entry insertAtBottom(Entry entry)
{
if (tc.isEntryEnabled())
SibTr.entry(tc, "insertAtBottom", new Object[] { entry });
//only add in the new entry if it is not already in a list.
if(entry.parentList == null)
{
//if the list is empty
if(last == null)
{
//double check that the link references are null
entry.previous = null;
entry.next = null;
//record the first and last pointers
first = entry;
last = entry;
//set the entry's parent list to show that it is now part of this list
entry.parentList = this;
}
else //if there are already entries in the list
{
//insert the new entry after the last one in the list
insertAfter(entry, last);
}
if (tc.isEntryEnabled())
SibTr.exit(tc, "insertAtBottom", entry);
return entry;
}
//if the entry is already in a list, throw a runtime exception
SIErrorException e = new SIErrorException(
nls.getFormattedMessage(
"INTERNAL_MESSAGING_ERROR_CWSIP0001",
new Object[] {
"com.ibm.ws.sib.processor.utils.linkedlist.LinkedList",
"1:166:1.18" },
null));
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.utils.linkedlist.LinkedList.insertAtBottom",
"1:172:1.18",
this);
SibTr.exception(tc, e);
SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0001",
new Object[] {
"com.ibm.ws.sib.processor.utils.linkedlist.LinkedList",
"1:179:1.18" });
if (tc.isEntryEnabled())
SibTr.exit(tc, "insertAtBottom", e);
throw e;
} | [
"public",
"Entry",
"insertAtBottom",
"(",
"Entry",
"entry",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"insertAtBottom\"",
",",
"new",
"Object",
"[",
"]",
"{",
"entry",
"}",
")",
";",
"//... | Synchronized. Insert a new entry in to the list at the bottom.
The new entry must not be already in any list, including this one.
@param entry The entry to be added.
@return The entry after it has been added | [
"Synchronized",
".",
"Insert",
"a",
"new",
"entry",
"in",
"to",
"the",
"list",
"at",
"the",
"bottom",
".",
"The",
"new",
"entry",
"must",
"not",
"be",
"already",
"in",
"any",
"list",
"including",
"this",
"one",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/linkedlist/LinkedList.java#L109-L166 |
Omertron/api-tvrage | src/main/java/com/omertron/tvrageapi/tools/DOMHelper.java | DOMHelper.getEventDocFromUrl | public static Document getEventDocFromUrl(String url) throws TVRageException {
Document doc;
InputStream in = null;
try {
in = new ByteArrayInputStream(requestWebContent(url));
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
doc = db.parse(in);
doc.getDocumentElement().normalize();
return doc;
} catch (ParserConfigurationException | SAXException | IOException ex) {
throw new TVRageException(ApiExceptionType.MAPPING_FAILED, UNABLE_TO_PARSE, url, ex);
} finally {
try {
if (in != null) {
in.close();
}
} catch (IOException ex) {
// Input Stream was already closed or null
LOG.trace("Stream already closed for getEventDocFromUrl", ex);
}
}
} | java | public static Document getEventDocFromUrl(String url) throws TVRageException {
Document doc;
InputStream in = null;
try {
in = new ByteArrayInputStream(requestWebContent(url));
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
doc = db.parse(in);
doc.getDocumentElement().normalize();
return doc;
} catch (ParserConfigurationException | SAXException | IOException ex) {
throw new TVRageException(ApiExceptionType.MAPPING_FAILED, UNABLE_TO_PARSE, url, ex);
} finally {
try {
if (in != null) {
in.close();
}
} catch (IOException ex) {
// Input Stream was already closed or null
LOG.trace("Stream already closed for getEventDocFromUrl", ex);
}
}
} | [
"public",
"static",
"Document",
"getEventDocFromUrl",
"(",
"String",
"url",
")",
"throws",
"TVRageException",
"{",
"Document",
"doc",
";",
"InputStream",
"in",
"=",
"null",
";",
"try",
"{",
"in",
"=",
"new",
"ByteArrayInputStream",
"(",
"requestWebContent",
"(",... | Get a DOM document from the supplied URL
@param url
@return
@throws com.omertron.tvrageapi.TVRageException | [
"Get",
"a",
"DOM",
"document",
"from",
"the",
"supplied",
"URL"
] | train | https://github.com/Omertron/api-tvrage/blob/4e805a99de812fabea69d97098f2376be14d51bc/src/main/java/com/omertron/tvrageapi/tools/DOMHelper.java#L99-L123 |
TNG/property-loader | src/main/java/com/tngtech/propertyloader/Obfuscator.java | Obfuscator.encryptInternal | private byte[] encryptInternal(SecretKeySpec key, String toEncrypt) {
try {
Cipher cipher = Cipher.getInstance(ENCRYPTION_ALGORITHM + ENCRYPTION_ALGORITHM_MODIFIER);
cipher.init(Cipher.ENCRYPT_MODE, key);
return cipher.doFinal(toEncrypt.getBytes(ENCODING));
} catch (GeneralSecurityException e) {
throw new RuntimeException("Exception during decryptInternal: " + e, e);
} catch (UnsupportedEncodingException e) {
throw new RuntimeException("Exception during encryptInternal: " + e, e);
}
} | java | private byte[] encryptInternal(SecretKeySpec key, String toEncrypt) {
try {
Cipher cipher = Cipher.getInstance(ENCRYPTION_ALGORITHM + ENCRYPTION_ALGORITHM_MODIFIER);
cipher.init(Cipher.ENCRYPT_MODE, key);
return cipher.doFinal(toEncrypt.getBytes(ENCODING));
} catch (GeneralSecurityException e) {
throw new RuntimeException("Exception during decryptInternal: " + e, e);
} catch (UnsupportedEncodingException e) {
throw new RuntimeException("Exception during encryptInternal: " + e, e);
}
} | [
"private",
"byte",
"[",
"]",
"encryptInternal",
"(",
"SecretKeySpec",
"key",
",",
"String",
"toEncrypt",
")",
"{",
"try",
"{",
"Cipher",
"cipher",
"=",
"Cipher",
".",
"getInstance",
"(",
"ENCRYPTION_ALGORITHM",
"+",
"ENCRYPTION_ALGORITHM_MODIFIER",
")",
";",
"ci... | Internal Encryption method.
@param key - the SecretKeySpec used to encrypt
@param toEncrypt - the String to encrypt
@return the encrypted String (as byte[]) | [
"Internal",
"Encryption",
"method",
"."
] | train | https://github.com/TNG/property-loader/blob/0fbc8a091795aaf2bdaf7c0d494a32772bff0e1f/src/main/java/com/tngtech/propertyloader/Obfuscator.java#L53-L63 |
hal/core | gui/src/main/java/org/jboss/as/console/client/v3/dmr/AddressTemplate.java | AddressTemplate.subTemplate | public AddressTemplate subTemplate(int fromIndex, int toIndex) {
LinkedList<Token> subTokens = new LinkedList<>();
subTokens.addAll(this.tokens.subList(fromIndex, toIndex));
return AddressTemplate.of(join(this.optional, subTokens));
} | java | public AddressTemplate subTemplate(int fromIndex, int toIndex) {
LinkedList<Token> subTokens = new LinkedList<>();
subTokens.addAll(this.tokens.subList(fromIndex, toIndex));
return AddressTemplate.of(join(this.optional, subTokens));
} | [
"public",
"AddressTemplate",
"subTemplate",
"(",
"int",
"fromIndex",
",",
"int",
"toIndex",
")",
"{",
"LinkedList",
"<",
"Token",
">",
"subTokens",
"=",
"new",
"LinkedList",
"<>",
"(",
")",
";",
"subTokens",
".",
"addAll",
"(",
"this",
".",
"tokens",
".",
... | Works like {@link List#subList(int, int)} over the tokens of this template and throws the same exceptions.
@param fromIndex low endpoint (inclusive) of the sub template
@param toIndex high endpoint (exclusive) of the sub template
@return a new address template containing the specified tokens.
@throws IndexOutOfBoundsException for an illegal endpoint index value
(<tt>fromIndex < 0 || toIndex > size ||
fromIndex > toIndex</tt>) | [
"Works",
"like",
"{",
"@link",
"List#subList",
"(",
"int",
"int",
")",
"}",
"over",
"the",
"tokens",
"of",
"this",
"template",
"and",
"throws",
"the",
"same",
"exceptions",
"."
] | train | https://github.com/hal/core/blob/d6d03f0bb128dc0470f5dc75fdb1ea1014400602/gui/src/main/java/org/jboss/as/console/client/v3/dmr/AddressTemplate.java#L162-L166 |
samskivert/pythagoras | src/main/java/pythagoras/d/Transforms.java | Transforms.createTransformedShape | public static IShape createTransformedShape (Transform t, IShape src) {
if (src == null) {
return null;
}
if (src instanceof Path) {
return ((Path)src).createTransformedShape(t);
}
PathIterator path = src.pathIterator(t);
Path dst = new Path(path.windingRule());
dst.append(path, false);
return dst;
} | java | public static IShape createTransformedShape (Transform t, IShape src) {
if (src == null) {
return null;
}
if (src instanceof Path) {
return ((Path)src).createTransformedShape(t);
}
PathIterator path = src.pathIterator(t);
Path dst = new Path(path.windingRule());
dst.append(path, false);
return dst;
} | [
"public",
"static",
"IShape",
"createTransformedShape",
"(",
"Transform",
"t",
",",
"IShape",
"src",
")",
"{",
"if",
"(",
"src",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"src",
"instanceof",
"Path",
")",
"{",
"return",
"(",
"(",
... | Creates and returns a new shape that is the supplied shape transformed by this transform's
matrix. | [
"Creates",
"and",
"returns",
"a",
"new",
"shape",
"that",
"is",
"the",
"supplied",
"shape",
"transformed",
"by",
"this",
"transform",
"s",
"matrix",
"."
] | train | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/d/Transforms.java#L16-L27 |
Netflix/conductor | client/src/main/java/com/netflix/conductor/client/http/WorkflowClient.java | WorkflowClient.deleteWorkflow | public void deleteWorkflow(String workflowId, boolean archiveWorkflow) {
Preconditions.checkArgument(StringUtils.isNotBlank(workflowId), "Workflow id cannot be blank");
Object[] params = new Object[]{"archiveWorkflow", archiveWorkflow};
delete(params, "workflow/{workflowId}/remove", workflowId);
} | java | public void deleteWorkflow(String workflowId, boolean archiveWorkflow) {
Preconditions.checkArgument(StringUtils.isNotBlank(workflowId), "Workflow id cannot be blank");
Object[] params = new Object[]{"archiveWorkflow", archiveWorkflow};
delete(params, "workflow/{workflowId}/remove", workflowId);
} | [
"public",
"void",
"deleteWorkflow",
"(",
"String",
"workflowId",
",",
"boolean",
"archiveWorkflow",
")",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"StringUtils",
".",
"isNotBlank",
"(",
"workflowId",
")",
",",
"\"Workflow id cannot be blank\"",
")",
";",
"Obj... | Removes a workflow from the system
@param workflowId the id of the workflow to be deleted
@param archiveWorkflow flag to indicate if the workflow should be archived before deletion | [
"Removes",
"a",
"workflow",
"from",
"the",
"system"
] | train | https://github.com/Netflix/conductor/blob/78fae0ed9ddea22891f9eebb96a2ec0b2783dca0/client/src/main/java/com/netflix/conductor/client/http/WorkflowClient.java#L189-L194 |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/JcrQueryParser.java | JcrQueryParser.getSynonymQuery | protected Query getSynonymQuery(String field, String termStr, boolean quoted) throws ParseException
{
List<BooleanClause> synonyms = new ArrayList<BooleanClause>();
synonyms.add(new BooleanClause(getFieldQuery(field, termStr, quoted), BooleanClause.Occur.SHOULD));
if (synonymProvider != null)
{
String[] terms = synonymProvider.getSynonyms(termStr);
for (int i = 0; i < terms.length; i++)
{
synonyms.add(new BooleanClause(getFieldQuery(field, terms[i], quoted), BooleanClause.Occur.SHOULD));
}
}
if (synonyms.size() == 1)
{
return synonyms.get(0).getQuery();
}
else
{
return getBooleanQuery(synonyms);
}
} | java | protected Query getSynonymQuery(String field, String termStr, boolean quoted) throws ParseException
{
List<BooleanClause> synonyms = new ArrayList<BooleanClause>();
synonyms.add(new BooleanClause(getFieldQuery(field, termStr, quoted), BooleanClause.Occur.SHOULD));
if (synonymProvider != null)
{
String[] terms = synonymProvider.getSynonyms(termStr);
for (int i = 0; i < terms.length; i++)
{
synonyms.add(new BooleanClause(getFieldQuery(field, terms[i], quoted), BooleanClause.Occur.SHOULD));
}
}
if (synonyms.size() == 1)
{
return synonyms.get(0).getQuery();
}
else
{
return getBooleanQuery(synonyms);
}
} | [
"protected",
"Query",
"getSynonymQuery",
"(",
"String",
"field",
",",
"String",
"termStr",
",",
"boolean",
"quoted",
")",
"throws",
"ParseException",
"{",
"List",
"<",
"BooleanClause",
">",
"synonyms",
"=",
"new",
"ArrayList",
"<",
"BooleanClause",
">",
"(",
"... | Factory method for generating a synonym query.
Called when parser parses an input term token that has the synonym
prefix (~term) prepended.
@param field Name of the field query will use.
@param termStr Term token to use for building term for the query
@return Resulting {@link Query} built for the term
@exception ParseException throw in overridden method to disallow | [
"Factory",
"method",
"for",
"generating",
"a",
"synonym",
"query",
".",
"Called",
"when",
"parser",
"parses",
"an",
"input",
"term",
"token",
"that",
"has",
"the",
"synonym",
"prefix",
"(",
"~term",
")",
"prepended",
"."
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/JcrQueryParser.java#L124-L144 |
JOML-CI/JOML | src/org/joml/Matrix4f.java | Matrix4f.billboardCylindrical | public Matrix4f billboardCylindrical(Vector3fc objPos, Vector3fc targetPos, Vector3fc up) {
float dirX = targetPos.x() - objPos.x();
float dirY = targetPos.y() - objPos.y();
float dirZ = targetPos.z() - objPos.z();
// left = up x dir
float leftX = up.y() * dirZ - up.z() * dirY;
float leftY = up.z() * dirX - up.x() * dirZ;
float leftZ = up.x() * dirY - up.y() * dirX;
// normalize left
float invLeftLen = 1.0f / (float) Math.sqrt(leftX * leftX + leftY * leftY + leftZ * leftZ);
leftX *= invLeftLen;
leftY *= invLeftLen;
leftZ *= invLeftLen;
// recompute dir by constraining rotation around 'up'
// dir = left x up
dirX = leftY * up.z() - leftZ * up.y();
dirY = leftZ * up.x() - leftX * up.z();
dirZ = leftX * up.y() - leftY * up.x();
// normalize dir
float invDirLen = 1.0f / (float) Math.sqrt(dirX * dirX + dirY * dirY + dirZ * dirZ);
dirX *= invDirLen;
dirY *= invDirLen;
dirZ *= invDirLen;
// set matrix elements
this._m00(leftX);
this._m01(leftY);
this._m02(leftZ);
this._m03(0.0f);
this._m10(up.x());
this._m11(up.y());
this._m12(up.z());
this._m13(0.0f);
this._m20(dirX);
this._m21(dirY);
this._m22(dirZ);
this._m23(0.0f);
this._m30(objPos.x());
this._m31(objPos.y());
this._m32(objPos.z());
this._m33(1.0f);
_properties(PROPERTY_AFFINE | PROPERTY_ORTHONORMAL);
return this;
} | java | public Matrix4f billboardCylindrical(Vector3fc objPos, Vector3fc targetPos, Vector3fc up) {
float dirX = targetPos.x() - objPos.x();
float dirY = targetPos.y() - objPos.y();
float dirZ = targetPos.z() - objPos.z();
// left = up x dir
float leftX = up.y() * dirZ - up.z() * dirY;
float leftY = up.z() * dirX - up.x() * dirZ;
float leftZ = up.x() * dirY - up.y() * dirX;
// normalize left
float invLeftLen = 1.0f / (float) Math.sqrt(leftX * leftX + leftY * leftY + leftZ * leftZ);
leftX *= invLeftLen;
leftY *= invLeftLen;
leftZ *= invLeftLen;
// recompute dir by constraining rotation around 'up'
// dir = left x up
dirX = leftY * up.z() - leftZ * up.y();
dirY = leftZ * up.x() - leftX * up.z();
dirZ = leftX * up.y() - leftY * up.x();
// normalize dir
float invDirLen = 1.0f / (float) Math.sqrt(dirX * dirX + dirY * dirY + dirZ * dirZ);
dirX *= invDirLen;
dirY *= invDirLen;
dirZ *= invDirLen;
// set matrix elements
this._m00(leftX);
this._m01(leftY);
this._m02(leftZ);
this._m03(0.0f);
this._m10(up.x());
this._m11(up.y());
this._m12(up.z());
this._m13(0.0f);
this._m20(dirX);
this._m21(dirY);
this._m22(dirZ);
this._m23(0.0f);
this._m30(objPos.x());
this._m31(objPos.y());
this._m32(objPos.z());
this._m33(1.0f);
_properties(PROPERTY_AFFINE | PROPERTY_ORTHONORMAL);
return this;
} | [
"public",
"Matrix4f",
"billboardCylindrical",
"(",
"Vector3fc",
"objPos",
",",
"Vector3fc",
"targetPos",
",",
"Vector3fc",
"up",
")",
"{",
"float",
"dirX",
"=",
"targetPos",
".",
"x",
"(",
")",
"-",
"objPos",
".",
"x",
"(",
")",
";",
"float",
"dirY",
"="... | Set this matrix to a cylindrical billboard transformation that rotates the local +Z axis of a given object with position <code>objPos</code> towards
a target position at <code>targetPos</code> while constraining a cylindrical rotation around the given <code>up</code> vector.
<p>
This method can be used to create the complete model transformation for a given object, including the translation of the object to
its position <code>objPos</code>.
@param objPos
the position of the object to rotate towards <code>targetPos</code>
@param targetPos
the position of the target (for example the camera) towards which to rotate the object
@param up
the rotation axis (must be {@link Vector3f#normalize() normalized})
@return this | [
"Set",
"this",
"matrix",
"to",
"a",
"cylindrical",
"billboard",
"transformation",
"that",
"rotates",
"the",
"local",
"+",
"Z",
"axis",
"of",
"a",
"given",
"object",
"with",
"position",
"<code",
">",
"objPos<",
"/",
"code",
">",
"towards",
"a",
"target",
"p... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4f.java#L13277-L13319 |
google/error-prone-javac | src/jdk.jdeps/share/classes/com/sun/tools/jdeps/Module.java | Module.toNormalModule | public Module toNormalModule(Map<String, Boolean> requires) {
if (!isAutomatic()) {
throw new IllegalArgumentException(name() + " not an automatic module");
}
return new NormalModule(this, requires);
} | java | public Module toNormalModule(Map<String, Boolean> requires) {
if (!isAutomatic()) {
throw new IllegalArgumentException(name() + " not an automatic module");
}
return new NormalModule(this, requires);
} | [
"public",
"Module",
"toNormalModule",
"(",
"Map",
"<",
"String",
",",
"Boolean",
">",
"requires",
")",
"{",
"if",
"(",
"!",
"isAutomatic",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"name",
"(",
")",
"+",
"\" not an automatic module... | Converts this module to a normal module with the given dependences
@throws IllegalArgumentException if this module is not an automatic module | [
"Converts",
"this",
"module",
"to",
"a",
"normal",
"module",
"with",
"the",
"given",
"dependences"
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/Module.java#L138-L143 |
undertow-io/undertow | core/src/main/java/io/undertow/websockets/core/WebSockets.java | WebSockets.sendPingBlocking | public static void sendPingBlocking(final ByteBuffer data, final WebSocketChannel wsChannel) throws IOException {
sendBlockingInternal(data, WebSocketFrameType.PING, wsChannel);
} | java | public static void sendPingBlocking(final ByteBuffer data, final WebSocketChannel wsChannel) throws IOException {
sendBlockingInternal(data, WebSocketFrameType.PING, wsChannel);
} | [
"public",
"static",
"void",
"sendPingBlocking",
"(",
"final",
"ByteBuffer",
"data",
",",
"final",
"WebSocketChannel",
"wsChannel",
")",
"throws",
"IOException",
"{",
"sendBlockingInternal",
"(",
"data",
",",
"WebSocketFrameType",
".",
"PING",
",",
"wsChannel",
")",
... | Sends a complete ping message using blocking IO
@param data The data to send
@param wsChannel The web socket channel | [
"Sends",
"a",
"complete",
"ping",
"message",
"using",
"blocking",
"IO"
] | train | https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/websockets/core/WebSockets.java#L378-L380 |
hyperledger/fabric-sdk-java | src/main/java/org/hyperledger/fabric/sdk/security/CryptoPrimitives.java | CryptoPrimitives.ecdsaSignToBytes | private byte[] ecdsaSignToBytes(ECPrivateKey privateKey, byte[] data) throws CryptoException {
if (data == null) {
throw new CryptoException("Data that to be signed is null.");
}
if (data.length == 0) {
throw new CryptoException("Data to be signed was empty.");
}
try {
X9ECParameters params = ECNamedCurveTable.getByName(curveName);
BigInteger curveN = params.getN();
Signature sig = SECURITY_PROVIDER == null ? Signature.getInstance(DEFAULT_SIGNATURE_ALGORITHM) :
Signature.getInstance(DEFAULT_SIGNATURE_ALGORITHM, SECURITY_PROVIDER);
sig.initSign(privateKey);
sig.update(data);
byte[] signature = sig.sign();
BigInteger[] sigs = decodeECDSASignature(signature);
sigs = preventMalleability(sigs, curveN);
try (ByteArrayOutputStream s = new ByteArrayOutputStream()) {
DERSequenceGenerator seq = new DERSequenceGenerator(s);
seq.addObject(new ASN1Integer(sigs[0]));
seq.addObject(new ASN1Integer(sigs[1]));
seq.close();
return s.toByteArray();
}
} catch (Exception e) {
throw new CryptoException("Could not sign the message using private key", e);
}
} | java | private byte[] ecdsaSignToBytes(ECPrivateKey privateKey, byte[] data) throws CryptoException {
if (data == null) {
throw new CryptoException("Data that to be signed is null.");
}
if (data.length == 0) {
throw new CryptoException("Data to be signed was empty.");
}
try {
X9ECParameters params = ECNamedCurveTable.getByName(curveName);
BigInteger curveN = params.getN();
Signature sig = SECURITY_PROVIDER == null ? Signature.getInstance(DEFAULT_SIGNATURE_ALGORITHM) :
Signature.getInstance(DEFAULT_SIGNATURE_ALGORITHM, SECURITY_PROVIDER);
sig.initSign(privateKey);
sig.update(data);
byte[] signature = sig.sign();
BigInteger[] sigs = decodeECDSASignature(signature);
sigs = preventMalleability(sigs, curveN);
try (ByteArrayOutputStream s = new ByteArrayOutputStream()) {
DERSequenceGenerator seq = new DERSequenceGenerator(s);
seq.addObject(new ASN1Integer(sigs[0]));
seq.addObject(new ASN1Integer(sigs[1]));
seq.close();
return s.toByteArray();
}
} catch (Exception e) {
throw new CryptoException("Could not sign the message using private key", e);
}
} | [
"private",
"byte",
"[",
"]",
"ecdsaSignToBytes",
"(",
"ECPrivateKey",
"privateKey",
",",
"byte",
"[",
"]",
"data",
")",
"throws",
"CryptoException",
"{",
"if",
"(",
"data",
"==",
"null",
")",
"{",
"throw",
"new",
"CryptoException",
"(",
"\"Data that to be sign... | Sign data with the specified elliptic curve private key.
@param privateKey elliptic curve private key.
@param data data to sign
@return the signed data.
@throws CryptoException | [
"Sign",
"data",
"with",
"the",
"specified",
"elliptic",
"curve",
"private",
"key",
"."
] | train | https://github.com/hyperledger/fabric-sdk-java/blob/4a2d7b3408b8b0a1ed812aa36942c438159c37a0/src/main/java/org/hyperledger/fabric/sdk/security/CryptoPrimitives.java#L715-L750 |
google/error-prone-javac | src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/Resources.java | Resources.getText | public String getText(String key, Object... args) throws MissingResourceException {
return MessageFormat.format(getText(key), args);
} | java | public String getText(String key, Object... args) throws MissingResourceException {
return MessageFormat.format(getText(key), args);
} | [
"public",
"String",
"getText",
"(",
"String",
"key",
",",
"Object",
"...",
"args",
")",
"throws",
"MissingResourceException",
"{",
"return",
"MessageFormat",
".",
"format",
"(",
"getText",
"(",
"key",
")",
",",
"args",
")",
";",
"}"
] | Gets the string for the given key from one of the doclet's
resource bundles, substituting additional arguments into
into the resulting string with {@link MessageFormat#format}.
The more specific bundle is checked first;
if it is not there, the common bundle is then checked.
@param key the key for the desired string
@param args values to be substituted into the resulting string
@return the string for the given key
@throws MissingResourceException if the key is not found in either
bundle. | [
"Gets",
"the",
"string",
"for",
"the",
"given",
"key",
"from",
"one",
"of",
"the",
"doclet",
"s",
"resource",
"bundles",
"substituting",
"additional",
"arguments",
"into",
"into",
"the",
"resulting",
"string",
"with",
"{",
"@link",
"MessageFormat#format",
"}",
... | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/Resources.java#L101-L103 |
lightblueseas/file-worker | src/main/java/de/alpharogroup/file/read/ReadFileExtensions.java | ReadFileExtensions.readLinesInList | public static List<String> readLinesInList(final InputStream input, final boolean trim)
throws IOException
{
// return the list with all lines from the file.
return readLinesInList(input, Charset.forName("UTF-8"), trim);
} | java | public static List<String> readLinesInList(final InputStream input, final boolean trim)
throws IOException
{
// return the list with all lines from the file.
return readLinesInList(input, Charset.forName("UTF-8"), trim);
} | [
"public",
"static",
"List",
"<",
"String",
">",
"readLinesInList",
"(",
"final",
"InputStream",
"input",
",",
"final",
"boolean",
"trim",
")",
"throws",
"IOException",
"{",
"// return the list with all lines from the file.",
"return",
"readLinesInList",
"(",
"input",
... | Reads every line from the given InputStream and puts them to the List.
@param input
The InputStream from where the input comes.
@param trim
the flag trim if the lines shell be trimed.
@return The List with all lines from the file.
@throws IOException
When a io-problem occurs. | [
"Reads",
"every",
"line",
"from",
"the",
"given",
"InputStream",
"and",
"puts",
"them",
"to",
"the",
"List",
"."
] | train | https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/read/ReadFileExtensions.java#L312-L317 |
apache/incubator-gobblin | gobblin-service/src/main/java/org/apache/gobblin/service/modules/core/GitFlowGraphMonitor.java | GitFlowGraphMonitor.getEdgeId | private String getEdgeId(String source, String destination, String edgeName) {
return Joiner.on(FLOW_EDGE_LABEL_JOINER_CHAR).join(source, destination, edgeName);
} | java | private String getEdgeId(String source, String destination, String edgeName) {
return Joiner.on(FLOW_EDGE_LABEL_JOINER_CHAR).join(source, destination, edgeName);
} | [
"private",
"String",
"getEdgeId",
"(",
"String",
"source",
",",
"String",
"destination",
",",
"String",
"edgeName",
")",
"{",
"return",
"Joiner",
".",
"on",
"(",
"FLOW_EDGE_LABEL_JOINER_CHAR",
")",
".",
"join",
"(",
"source",
",",
"destination",
",",
"edgeName... | Get an edge label from the edge properties
@param source source data node id
@param destination destination data node id
@param edgeName simple name of the edge (e.g. file name without extension of the edge file)
@return a string label identifying the edge | [
"Get",
"an",
"edge",
"label",
"from",
"the",
"edge",
"properties"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-service/src/main/java/org/apache/gobblin/service/modules/core/GitFlowGraphMonitor.java#L382-L384 |
lucee/Lucee | core/src/main/java/lucee/runtime/op/Caster.java | Caster.toInteger | public static Integer toInteger(Object o, Integer defaultValue) {
if (defaultValue != null) return Integer.valueOf(toIntValue(o, defaultValue.intValue()));
int res = toIntValue(o, Integer.MIN_VALUE);
if (res == Integer.MIN_VALUE) return defaultValue;
return Integer.valueOf(res);
} | java | public static Integer toInteger(Object o, Integer defaultValue) {
if (defaultValue != null) return Integer.valueOf(toIntValue(o, defaultValue.intValue()));
int res = toIntValue(o, Integer.MIN_VALUE);
if (res == Integer.MIN_VALUE) return defaultValue;
return Integer.valueOf(res);
} | [
"public",
"static",
"Integer",
"toInteger",
"(",
"Object",
"o",
",",
"Integer",
"defaultValue",
")",
"{",
"if",
"(",
"defaultValue",
"!=",
"null",
")",
"return",
"Integer",
".",
"valueOf",
"(",
"toIntValue",
"(",
"o",
",",
"defaultValue",
".",
"intValue",
... | casts a Object to a Integer
@param o Object to cast to Integer
@param defaultValue
@return Integer from Object | [
"casts",
"a",
"Object",
"to",
"a",
"Integer"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/op/Caster.java#L4400-L4405 |
javalite/activejdbc | activejdbc/src/main/java/org/javalite/activejdbc/Base.java | Base.withDb | public static <T> T withDb(String driver, String url, Properties properties, Supplier<T> supplier) {
return new DB(DB.DEFAULT_NAME).withDb(driver, url, properties, supplier);
} | java | public static <T> T withDb(String driver, String url, Properties properties, Supplier<T> supplier) {
return new DB(DB.DEFAULT_NAME).withDb(driver, url, properties, supplier);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"withDb",
"(",
"String",
"driver",
",",
"String",
"url",
",",
"Properties",
"properties",
",",
"Supplier",
"<",
"T",
">",
"supplier",
")",
"{",
"return",
"new",
"DB",
"(",
"DB",
".",
"DEFAULT_NAME",
")",
".",
"... | Same as {@link DB#withDb(String, Properties, Supplier)}, but with db name {@link DB#DEFAULT_NAME}. | [
"Same",
"as",
"{"
] | train | https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/activejdbc/src/main/java/org/javalite/activejdbc/Base.java#L413-L415 |
google/closure-compiler | src/com/google/javascript/jscomp/TypeValidator.java | TypeValidator.expectSwitchMatchesCase | void expectSwitchMatchesCase(Node n, JSType switchType, JSType caseType) {
// ECMA-262, page 68, step 3 of evaluation of CaseBlock,
// but allowing extra autoboxing.
// TODO(user): remove extra conditions when type annotations
// in the code base have adapted to the change in the compiler.
if (!switchType.canTestForShallowEqualityWith(caseType)
&& (caseType.autoboxesTo() == null || !caseType.autoboxesTo().isSubtypeOf(switchType))) {
mismatch(n.getFirstChild(), "case expression doesn't match switch", caseType, switchType);
} else if (!switchType.canTestForShallowEqualityWith(caseType)
&& (caseType.autoboxesTo() == null
|| !caseType.autoboxesTo().isSubtypeWithoutStructuralTyping(switchType))) {
TypeMismatch.recordImplicitInterfaceUses(this.implicitInterfaceUses, n, caseType, switchType);
TypeMismatch.recordImplicitUseOfNativeObject(this.mismatches, n, caseType, switchType);
}
} | java | void expectSwitchMatchesCase(Node n, JSType switchType, JSType caseType) {
// ECMA-262, page 68, step 3 of evaluation of CaseBlock,
// but allowing extra autoboxing.
// TODO(user): remove extra conditions when type annotations
// in the code base have adapted to the change in the compiler.
if (!switchType.canTestForShallowEqualityWith(caseType)
&& (caseType.autoboxesTo() == null || !caseType.autoboxesTo().isSubtypeOf(switchType))) {
mismatch(n.getFirstChild(), "case expression doesn't match switch", caseType, switchType);
} else if (!switchType.canTestForShallowEqualityWith(caseType)
&& (caseType.autoboxesTo() == null
|| !caseType.autoboxesTo().isSubtypeWithoutStructuralTyping(switchType))) {
TypeMismatch.recordImplicitInterfaceUses(this.implicitInterfaceUses, n, caseType, switchType);
TypeMismatch.recordImplicitUseOfNativeObject(this.mismatches, n, caseType, switchType);
}
} | [
"void",
"expectSwitchMatchesCase",
"(",
"Node",
"n",
",",
"JSType",
"switchType",
",",
"JSType",
"caseType",
")",
"{",
"// ECMA-262, page 68, step 3 of evaluation of CaseBlock,",
"// but allowing extra autoboxing.",
"// TODO(user): remove extra conditions when type annotations",
"// ... | Expect that the type of a switch condition matches the type of its case condition. | [
"Expect",
"that",
"the",
"type",
"of",
"a",
"switch",
"condition",
"matches",
"the",
"type",
"of",
"its",
"case",
"condition",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypeValidator.java#L519-L533 |
onelogin/onelogin-java-sdk | src/main/java/com/onelogin/sdk/conn/Client.java | Client.getRolesBatch | public OneLoginResponse<Role> getRolesBatch(int batchSize, String afterCursor)
throws OAuthSystemException, OAuthProblemException, URISyntaxException {
return getRolesBatch(new HashMap<String, String>(), batchSize, afterCursor);
} | java | public OneLoginResponse<Role> getRolesBatch(int batchSize, String afterCursor)
throws OAuthSystemException, OAuthProblemException, URISyntaxException {
return getRolesBatch(new HashMap<String, String>(), batchSize, afterCursor);
} | [
"public",
"OneLoginResponse",
"<",
"Role",
">",
"getRolesBatch",
"(",
"int",
"batchSize",
",",
"String",
"afterCursor",
")",
"throws",
"OAuthSystemException",
",",
"OAuthProblemException",
",",
"URISyntaxException",
"{",
"return",
"getRolesBatch",
"(",
"new",
"HashMap... | Get a batch of Roles.
@param batchSize Size of the Batch
@param afterCursor Reference to continue collecting items of next page
@return OneLoginResponse of Role (Batch)
@throws OAuthSystemException - if there is a IOException reading parameters of the httpURLConnection
@throws OAuthProblemException - if there are errors validating the OneloginOAuthJSONResourceResponse and throwOAuthProblemException is enabled
@throws URISyntaxException - if there is an error when generating the target URL at the URIBuilder constructor
@see com.onelogin.sdk.model.Role
@see <a target="_blank" href="https://developers.onelogin.com/api-docs/1/roles/get-roles">Get Roles documentation</a> | [
"Get",
"a",
"batch",
"of",
"Roles",
"."
] | train | https://github.com/onelogin/onelogin-java-sdk/blob/1570b78033dcc1c7387099e77fe41b6b0638df8c/src/main/java/com/onelogin/sdk/conn/Client.java#L1758-L1761 |
FINRAOS/JTAF-ExtWebDriver | src/main/java/org/finra/jtaf/ewd/widget/element/html/CheckBox.java | CheckBox.setValue | @Override
public void setValue(Object value) throws WidgetException {
boolean set = false;
try {
if (value instanceof String) {
if (((String) value).equalsIgnoreCase(UNCHECK)) {
doAction(true);
} else if (((String) value).equalsIgnoreCase(CHECK)) {
doAction(false);
}
set = true;
} else {
throw new WidgetRuntimeException(
"value must be a String of either 'check' or 'uncheck'", getByLocator());
}
} catch (Exception e) {
throw new WidgetException("Error while checking/unchecking", getByLocator(), e);
}
if (!set)
throw new WidgetException(
"Invalid set value for checkbox. It must be either 'check' or 'uncheck'",
getByLocator());
} | java | @Override
public void setValue(Object value) throws WidgetException {
boolean set = false;
try {
if (value instanceof String) {
if (((String) value).equalsIgnoreCase(UNCHECK)) {
doAction(true);
} else if (((String) value).equalsIgnoreCase(CHECK)) {
doAction(false);
}
set = true;
} else {
throw new WidgetRuntimeException(
"value must be a String of either 'check' or 'uncheck'", getByLocator());
}
} catch (Exception e) {
throw new WidgetException("Error while checking/unchecking", getByLocator(), e);
}
if (!set)
throw new WidgetException(
"Invalid set value for checkbox. It must be either 'check' or 'uncheck'",
getByLocator());
} | [
"@",
"Override",
"public",
"void",
"setValue",
"(",
"Object",
"value",
")",
"throws",
"WidgetException",
"{",
"boolean",
"set",
"=",
"false",
";",
"try",
"{",
"if",
"(",
"value",
"instanceof",
"String",
")",
"{",
"if",
"(",
"(",
"(",
"String",
")",
"va... | Sets the value of the CheckBox
@param value
- String that can be one of two values: CHECK - sets checkbox
from UNCHECKED to CHECK UNCHECK - sets checkbox from CHECKED
to UNCHECKED | [
"Sets",
"the",
"value",
"of",
"the",
"CheckBox"
] | train | https://github.com/FINRAOS/JTAF-ExtWebDriver/blob/78d646def1bf0904f79b19a81df0241e07f2c73a/src/main/java/org/finra/jtaf/ewd/widget/element/html/CheckBox.java#L83-L107 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/secstruc/SecStrucCalc.java | SecStrucCalc.calculateHBonds | private void calculateHBonds() {
/**
* More efficient method for calculating C-Alpha pairs
*/
if (groups.length < 5) return;
Iterator<AtomContact> otu = contactSet.iterator();
while(otu.hasNext()){
AtomContact ac = otu.next();
Pair<Atom> pair = ac.getPair();
Group g1 = pair.getFirst().getGroup();
Group g2 = pair.getSecond().getGroup();
// Now I need to get the index of the Group in the list groups
int i = indResMap.get(g1.getResidueNumber());
int j = indResMap.get(g2.getResidueNumber());
// Now check this
checkAddHBond(i,j);
//"backwards" hbonds are not allowed
if (j!=(i+1)) checkAddHBond(j,i);
}
} | java | private void calculateHBonds() {
/**
* More efficient method for calculating C-Alpha pairs
*/
if (groups.length < 5) return;
Iterator<AtomContact> otu = contactSet.iterator();
while(otu.hasNext()){
AtomContact ac = otu.next();
Pair<Atom> pair = ac.getPair();
Group g1 = pair.getFirst().getGroup();
Group g2 = pair.getSecond().getGroup();
// Now I need to get the index of the Group in the list groups
int i = indResMap.get(g1.getResidueNumber());
int j = indResMap.get(g2.getResidueNumber());
// Now check this
checkAddHBond(i,j);
//"backwards" hbonds are not allowed
if (j!=(i+1)) checkAddHBond(j,i);
}
} | [
"private",
"void",
"calculateHBonds",
"(",
")",
"{",
"/**\n\t\t * More efficient method for calculating C-Alpha pairs\n\t\t */",
"if",
"(",
"groups",
".",
"length",
"<",
"5",
")",
"return",
";",
"Iterator",
"<",
"AtomContact",
">",
"otu",
"=",
"contactSet",
".",
"it... | Calculate the HBonds between different groups.
see Creighton page 147 f
Modified to use only the contact map | [
"Calculate",
"the",
"HBonds",
"between",
"different",
"groups",
".",
"see",
"Creighton",
"page",
"147",
"f",
"Modified",
"to",
"use",
"only",
"the",
"contact",
"map"
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/secstruc/SecStrucCalc.java#L775-L794 |
ops4j/org.ops4j.pax.logging | pax-logging-api/src/main/java/org/jboss/logging/Logger.java | Logger.debugv | public void debugv(String format, Object param1) {
if (isEnabled(Level.DEBUG)) {
doLog(Level.DEBUG, FQCN, format, new Object[] { param1 }, null);
}
} | java | public void debugv(String format, Object param1) {
if (isEnabled(Level.DEBUG)) {
doLog(Level.DEBUG, FQCN, format, new Object[] { param1 }, null);
}
} | [
"public",
"void",
"debugv",
"(",
"String",
"format",
",",
"Object",
"param1",
")",
"{",
"if",
"(",
"isEnabled",
"(",
"Level",
".",
"DEBUG",
")",
")",
"{",
"doLog",
"(",
"Level",
".",
"DEBUG",
",",
"FQCN",
",",
"format",
",",
"new",
"Object",
"[",
"... | Issue a log message with a level of DEBUG using {@link java.text.MessageFormat}-style formatting.
@param format the message format string
@param param1 the sole parameter | [
"Issue",
"a",
"log",
"message",
"with",
"a",
"level",
"of",
"DEBUG",
"using",
"{",
"@link",
"java",
".",
"text",
".",
"MessageFormat",
"}",
"-",
"style",
"formatting",
"."
] | train | https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/jboss/logging/Logger.java#L608-L612 |
alkacon/opencms-core | src/org/opencms/db/CmsSecurityManager.java | CmsSecurityManager.loginUser | public CmsUser loginUser(CmsRequestContext context, String username, String password, String remoteAddress)
throws CmsException {
CmsDbContext dbc = m_dbContextFactory.getDbContext(context);
CmsUser result = null;
try {
result = m_driverManager.loginUser(
dbc,
CmsOrganizationalUnit.removeLeadingSeparator(username),
password,
remoteAddress);
} finally {
dbc.clear();
}
return result;
} | java | public CmsUser loginUser(CmsRequestContext context, String username, String password, String remoteAddress)
throws CmsException {
CmsDbContext dbc = m_dbContextFactory.getDbContext(context);
CmsUser result = null;
try {
result = m_driverManager.loginUser(
dbc,
CmsOrganizationalUnit.removeLeadingSeparator(username),
password,
remoteAddress);
} finally {
dbc.clear();
}
return result;
} | [
"public",
"CmsUser",
"loginUser",
"(",
"CmsRequestContext",
"context",
",",
"String",
"username",
",",
"String",
"password",
",",
"String",
"remoteAddress",
")",
"throws",
"CmsException",
"{",
"CmsDbContext",
"dbc",
"=",
"m_dbContextFactory",
".",
"getDbContext",
"(... | Attempts to authenticate a user into OpenCms with the given password.<p>
@param context the current request context
@param username the name of the user to be logged in
@param password the password of the user
@param remoteAddress the ip address of the request
@return the logged in user
@throws CmsException if the login was not successful | [
"Attempts",
"to",
"authenticate",
"a",
"user",
"into",
"OpenCms",
"with",
"the",
"given",
"password",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSecurityManager.java#L3597-L3612 |
google/error-prone | core/src/main/java/com/google/errorprone/refaster/Unifier.java | Unifier.unifyList | public static <T, U extends Unifiable<? super T>> Choice<Unifier> unifyList(
Unifier unifier, @Nullable List<U> toUnify, @Nullable final List<? extends T> targets) {
return unifyList(unifier, toUnify, targets, /* allowVarargs= */ false);
} | java | public static <T, U extends Unifiable<? super T>> Choice<Unifier> unifyList(
Unifier unifier, @Nullable List<U> toUnify, @Nullable final List<? extends T> targets) {
return unifyList(unifier, toUnify, targets, /* allowVarargs= */ false);
} | [
"public",
"static",
"<",
"T",
",",
"U",
"extends",
"Unifiable",
"<",
"?",
"super",
"T",
">",
">",
"Choice",
"<",
"Unifier",
">",
"unifyList",
"(",
"Unifier",
"unifier",
",",
"@",
"Nullable",
"List",
"<",
"U",
">",
"toUnify",
",",
"@",
"Nullable",
"fi... | Returns all successful unification paths from the specified {@code Unifier} unifying the
specified lists, disallowing varargs. | [
"Returns",
"all",
"successful",
"unification",
"paths",
"from",
"the",
"specified",
"{"
] | train | https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/core/src/main/java/com/google/errorprone/refaster/Unifier.java#L139-L142 |
joniles/mpxj | src/main/java/net/sf/mpxj/ResourceAssignment.java | ResourceAssignment.setEnterpriseNumber | public void setEnterpriseNumber(int index, Number value)
{
set(selectField(AssignmentFieldLists.ENTERPRISE_NUMBER, index), value);
} | java | public void setEnterpriseNumber(int index, Number value)
{
set(selectField(AssignmentFieldLists.ENTERPRISE_NUMBER, index), value);
} | [
"public",
"void",
"setEnterpriseNumber",
"(",
"int",
"index",
",",
"Number",
"value",
")",
"{",
"set",
"(",
"selectField",
"(",
"AssignmentFieldLists",
".",
"ENTERPRISE_NUMBER",
",",
"index",
")",
",",
"value",
")",
";",
"}"
] | Set an enterprise number value.
@param index number index (1-40)
@param value number value | [
"Set",
"an",
"enterprise",
"number",
"value",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ResourceAssignment.java#L1782-L1785 |
google/error-prone-javac | src/java.compiler/share/classes/javax/lang/model/util/ElementFilter.java | ElementFilter.fieldsIn | public static List<VariableElement>
fieldsIn(Iterable<? extends Element> elements) {
return listFilter(elements, FIELD_KINDS, VariableElement.class);
} | java | public static List<VariableElement>
fieldsIn(Iterable<? extends Element> elements) {
return listFilter(elements, FIELD_KINDS, VariableElement.class);
} | [
"public",
"static",
"List",
"<",
"VariableElement",
">",
"fieldsIn",
"(",
"Iterable",
"<",
"?",
"extends",
"Element",
">",
"elements",
")",
"{",
"return",
"listFilter",
"(",
"elements",
",",
"FIELD_KINDS",
",",
"VariableElement",
".",
"class",
")",
";",
"}"
... | Returns a list of fields in {@code elements}.
@return a list of fields in {@code elements}
@param elements the elements to filter | [
"Returns",
"a",
"list",
"of",
"fields",
"in",
"{"
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/java.compiler/share/classes/javax/lang/model/util/ElementFilter.java#L92-L95 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ServiceEndpointPoliciesInner.java | ServiceEndpointPoliciesInner.beginDelete | public void beginDelete(String resourceGroupName, String serviceEndpointPolicyName) {
beginDeleteWithServiceResponseAsync(resourceGroupName, serviceEndpointPolicyName).toBlocking().single().body();
} | java | public void beginDelete(String resourceGroupName, String serviceEndpointPolicyName) {
beginDeleteWithServiceResponseAsync(resourceGroupName, serviceEndpointPolicyName).toBlocking().single().body();
} | [
"public",
"void",
"beginDelete",
"(",
"String",
"resourceGroupName",
",",
"String",
"serviceEndpointPolicyName",
")",
"{",
"beginDeleteWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"serviceEndpointPolicyName",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
... | Deletes the specified service endpoint policy.
@param resourceGroupName The name of the resource group.
@param serviceEndpointPolicyName The name of the service endpoint policy.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent | [
"Deletes",
"the",
"specified",
"service",
"endpoint",
"policy",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ServiceEndpointPoliciesInner.java#L191-L193 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/hashcode/HashCodeCalculator.java | HashCodeCalculator.append | public static int append (final int nPrevHashCode, final long x)
{
final int nTemp = append (nPrevHashCode, (int) (x >>> CGlobal.BITS_PER_INT));
return append (nTemp, (int) (x & 0xffffffffL));
} | java | public static int append (final int nPrevHashCode, final long x)
{
final int nTemp = append (nPrevHashCode, (int) (x >>> CGlobal.BITS_PER_INT));
return append (nTemp, (int) (x & 0xffffffffL));
} | [
"public",
"static",
"int",
"append",
"(",
"final",
"int",
"nPrevHashCode",
",",
"final",
"long",
"x",
")",
"{",
"final",
"int",
"nTemp",
"=",
"append",
"(",
"nPrevHashCode",
",",
"(",
"int",
")",
"(",
"x",
">>>",
"CGlobal",
".",
"BITS_PER_INT",
")",
")... | Atomic type hash code generation.
@param nPrevHashCode
The previous hash code used as the basis for calculation
@param x
Array to add
@return The updated hash code | [
"Atomic",
"type",
"hash",
"code",
"generation",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/hashcode/HashCodeCalculator.java#L144-L148 |
alkacon/opencms-core | src/org/opencms/db/CmsAliasManager.java | CmsAliasManager.getRewriteAliasMatcher | public CmsRewriteAliasMatcher getRewriteAliasMatcher(CmsObject cms, String siteRoot) throws CmsException {
List<CmsRewriteAlias> aliases = getRewriteAliases(cms, siteRoot);
return new CmsRewriteAliasMatcher(aliases);
} | java | public CmsRewriteAliasMatcher getRewriteAliasMatcher(CmsObject cms, String siteRoot) throws CmsException {
List<CmsRewriteAlias> aliases = getRewriteAliases(cms, siteRoot);
return new CmsRewriteAliasMatcher(aliases);
} | [
"public",
"CmsRewriteAliasMatcher",
"getRewriteAliasMatcher",
"(",
"CmsObject",
"cms",
",",
"String",
"siteRoot",
")",
"throws",
"CmsException",
"{",
"List",
"<",
"CmsRewriteAlias",
">",
"aliases",
"=",
"getRewriteAliases",
"(",
"cms",
",",
"siteRoot",
")",
";",
"... | Gets the rewrite alias matcher for the given site.<p>
@param cms the CMS context to use
@param siteRoot the site root
@return the alias matcher for the site with the given site root
@throws CmsException if something goes wrong | [
"Gets",
"the",
"rewrite",
"alias",
"matcher",
"for",
"the",
"given",
"site",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsAliasManager.java#L172-L176 |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer/src/com/ibm/ws/ejbcontainer/osgi/internal/NameSpaceBinderImpl.java | NameSpaceBinderImpl.bindJavaModule | @Override
public void bindJavaModule(String name, EJBBinding bindingObject) {
ejbJavaColonHelper.addModuleBinding(moduleMetaData, name, bindingObject);
} | java | @Override
public void bindJavaModule(String name, EJBBinding bindingObject) {
ejbJavaColonHelper.addModuleBinding(moduleMetaData, name, bindingObject);
} | [
"@",
"Override",
"public",
"void",
"bindJavaModule",
"(",
"String",
"name",
",",
"EJBBinding",
"bindingObject",
")",
"{",
"ejbJavaColonHelper",
".",
"addModuleBinding",
"(",
"moduleMetaData",
",",
"name",
",",
"bindingObject",
")",
";",
"}"
] | Adds the module binding to the java:module name space.
@param name The lookup name.
@param bindingObject The EJB binding information. | [
"Adds",
"the",
"module",
"binding",
"to",
"the",
"java",
":",
"module",
"name",
"space",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer/src/com/ibm/ws/ejbcontainer/osgi/internal/NameSpaceBinderImpl.java#L108-L111 |
stephanenicolas/toothpick | toothpick-runtime/src/main/java/toothpick/ScopeImpl.java | ScopeImpl.installScopedProvider | private <T> InternalProviderImpl<? extends T> installScopedProvider(Class<T> clazz, String bindingName,
ScopedProviderImpl<? extends T> scopedProvider, boolean isTestProvider) {
return installBoundProvider(clazz, bindingName, scopedProvider, isTestProvider);
} | java | private <T> InternalProviderImpl<? extends T> installScopedProvider(Class<T> clazz, String bindingName,
ScopedProviderImpl<? extends T> scopedProvider, boolean isTestProvider) {
return installBoundProvider(clazz, bindingName, scopedProvider, isTestProvider);
} | [
"private",
"<",
"T",
">",
"InternalProviderImpl",
"<",
"?",
"extends",
"T",
">",
"installScopedProvider",
"(",
"Class",
"<",
"T",
">",
"clazz",
",",
"String",
"bindingName",
",",
"ScopedProviderImpl",
"<",
"?",
"extends",
"T",
">",
"scopedProvider",
",",
"bo... | Install the provider of the class {@code clazz} and name {@code bindingName}
in the current scope.
@param clazz the class for which to install the scoped provider of this scope.
@param bindingName the name, possibly {@code null}, for which to install the scoped provider.
@param scopedProvider the internal provider to install.
@param isTestProvider whether or not is a test provider, installed through a Test Module that should override
existing providers for the same class-bindingname.
@param <T> the type of {@code clazz}.
@return the provider that will be installed, if one was previously installed, it is returned, in a lock-free way. | [
"Install",
"the",
"provider",
"of",
"the",
"class",
"{",
"@code",
"clazz",
"}",
"and",
"name",
"{",
"@code",
"bindingName",
"}",
"in",
"the",
"current",
"scope",
"."
] | train | https://github.com/stephanenicolas/toothpick/blob/54476ca9a5fa48809c15a46e43e38db9ed7e1a75/toothpick-runtime/src/main/java/toothpick/ScopeImpl.java#L429-L432 |
openzipkin-contrib/brave-opentracing | src/main/java/brave/opentracing/BraveScopeManager.java | BraveScopeManager.currentSpan | BraveSpan currentSpan() {
BraveScope scope = currentScopes.get().peekFirst();
if (scope != null) {
return scope.span();
} else {
brave.Span braveSpan = tracer.currentSpan();
if (braveSpan != null) {
return new BraveSpan(tracer, braveSpan);
}
}
return null;
} | java | BraveSpan currentSpan() {
BraveScope scope = currentScopes.get().peekFirst();
if (scope != null) {
return scope.span();
} else {
brave.Span braveSpan = tracer.currentSpan();
if (braveSpan != null) {
return new BraveSpan(tracer, braveSpan);
}
}
return null;
} | [
"BraveSpan",
"currentSpan",
"(",
")",
"{",
"BraveScope",
"scope",
"=",
"currentScopes",
".",
"get",
"(",
")",
".",
"peekFirst",
"(",
")",
";",
"if",
"(",
"scope",
"!=",
"null",
")",
"{",
"return",
"scope",
".",
"span",
"(",
")",
";",
"}",
"else",
"... | Attempts to get a span from the current api, falling back to brave's native one | [
"Attempts",
"to",
"get",
"a",
"span",
"from",
"the",
"current",
"api",
"falling",
"back",
"to",
"brave",
"s",
"native",
"one"
] | train | https://github.com/openzipkin-contrib/brave-opentracing/blob/07653ac3a67beb7df71008961051ff03db2b60b7/src/main/java/brave/opentracing/BraveScopeManager.java#L63-L74 |
tvesalainen/util | util/src/main/java/org/vesalainen/math/CircleFitter.java | CircleFitter.meanCenter | public static double meanCenter(DenseMatrix64F points, DenseMatrix64F center)
{
assert points.numCols == 2;
assert center.numCols == 1;
assert center.numRows == 2;
center.zero();
int count = points.numRows;
double[] d = points.data;
for (int i=0;i<count;i++)
{
center.add(0, 0, d[2*i]);
center.add(1, 0, d[2*i+1]);
}
if (count > 0)
{
divide(center, count);
DenseMatrix64F di = new DenseMatrix64F(points.numRows, 1);
computeDi(center, points, di);
return elementSum(di) / (double)points.numRows;
}
else
{
return Double.NaN;
}
} | java | public static double meanCenter(DenseMatrix64F points, DenseMatrix64F center)
{
assert points.numCols == 2;
assert center.numCols == 1;
assert center.numRows == 2;
center.zero();
int count = points.numRows;
double[] d = points.data;
for (int i=0;i<count;i++)
{
center.add(0, 0, d[2*i]);
center.add(1, 0, d[2*i+1]);
}
if (count > 0)
{
divide(center, count);
DenseMatrix64F di = new DenseMatrix64F(points.numRows, 1);
computeDi(center, points, di);
return elementSum(di) / (double)points.numRows;
}
else
{
return Double.NaN;
}
} | [
"public",
"static",
"double",
"meanCenter",
"(",
"DenseMatrix64F",
"points",
",",
"DenseMatrix64F",
"center",
")",
"{",
"assert",
"points",
".",
"numCols",
"==",
"2",
";",
"assert",
"center",
".",
"numCols",
"==",
"1",
";",
"assert",
"center",
".",
"numRows"... | Calculates mean tempCenter of points
@param points in
@param center out
@return | [
"Calculates",
"mean",
"tempCenter",
"of",
"points"
] | train | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/CircleFitter.java#L193-L217 |
khuxtable/seaglass | src/main/java/com/seaglasslookandfeel/painter/AbstractRegionPainter.java | AbstractRegionPainter.paintWithCaching | private void paintWithCaching(Graphics2D g, JComponent c, int w, int h, Object[] extendedCacheKeys) {
VolatileImage img = getImage(g.getDeviceConfiguration(), c, w, h, extendedCacheKeys);
if (img != null) {
// render cached image
g.drawImage(img, 0, 0, null);
} else {
// render directly
paintDirectly(g, c, w, h, extendedCacheKeys);
}
} | java | private void paintWithCaching(Graphics2D g, JComponent c, int w, int h, Object[] extendedCacheKeys) {
VolatileImage img = getImage(g.getDeviceConfiguration(), c, w, h, extendedCacheKeys);
if (img != null) {
// render cached image
g.drawImage(img, 0, 0, null);
} else {
// render directly
paintDirectly(g, c, w, h, extendedCacheKeys);
}
} | [
"private",
"void",
"paintWithCaching",
"(",
"Graphics2D",
"g",
",",
"JComponent",
"c",
",",
"int",
"w",
",",
"int",
"h",
",",
"Object",
"[",
"]",
"extendedCacheKeys",
")",
"{",
"VolatileImage",
"img",
"=",
"getImage",
"(",
"g",
".",
"getDeviceConfiguration",... | Paint the component, using a cached image if possible.
@param g the Graphics2D context to paint with.
@param c the component to paint.
@param w the component width.
@param h the component height.
@param extendedCacheKeys extended cache keys. | [
"Paint",
"the",
"component",
"using",
"a",
"cached",
"image",
"if",
"possible",
"."
] | train | https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/AbstractRegionPainter.java#L610-L622 |
knowm/Sundial | src/main/java/org/knowm/sundial/SundialJobScheduler.java | SundialJobScheduler.createScheduler | public static Scheduler createScheduler(SchedulerFactory schedulerFactory)
throws SundialSchedulerException {
if (scheduler == null) {
try {
scheduler = schedulerFactory.getScheduler();
} catch (SchedulerException e) {
throw new SundialSchedulerException("COULD NOT CREATE SUNDIAL SCHEDULER!!!", e);
}
}
return scheduler;
} | java | public static Scheduler createScheduler(SchedulerFactory schedulerFactory)
throws SundialSchedulerException {
if (scheduler == null) {
try {
scheduler = schedulerFactory.getScheduler();
} catch (SchedulerException e) {
throw new SundialSchedulerException("COULD NOT CREATE SUNDIAL SCHEDULER!!!", e);
}
}
return scheduler;
} | [
"public",
"static",
"Scheduler",
"createScheduler",
"(",
"SchedulerFactory",
"schedulerFactory",
")",
"throws",
"SundialSchedulerException",
"{",
"if",
"(",
"scheduler",
"==",
"null",
")",
"{",
"try",
"{",
"scheduler",
"=",
"schedulerFactory",
".",
"getScheduler",
"... | Creates the Sundial Scheduler
@param schedulerFactory factory to create the scheduler
@return | [
"Creates",
"the",
"Sundial",
"Scheduler"
] | train | https://github.com/knowm/Sundial/blob/0d61549fdfb8d6f884a1f2eed7e32ad39e2f4c62/src/main/java/org/knowm/sundial/SundialJobScheduler.java#L123-L135 |
Azure/azure-sdk-for-java | datalakeanalytics/resource-manager/v2015_10_01_preview/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2015_10_01_preview/implementation/AccountsInner.java | AccountsInner.listDataLakeStoreAccountsAsync | public Observable<Page<DataLakeStoreAccountInfoInner>> listDataLakeStoreAccountsAsync(final String resourceGroupName, final String accountName, final String filter, final Integer top, final Integer skip, final String expand, final String select, final String orderby, final Boolean count, final String search, final String format) {
return listDataLakeStoreAccountsWithServiceResponseAsync(resourceGroupName, accountName, filter, top, skip, expand, select, orderby, count, search, format)
.map(new Func1<ServiceResponse<Page<DataLakeStoreAccountInfoInner>>, Page<DataLakeStoreAccountInfoInner>>() {
@Override
public Page<DataLakeStoreAccountInfoInner> call(ServiceResponse<Page<DataLakeStoreAccountInfoInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<DataLakeStoreAccountInfoInner>> listDataLakeStoreAccountsAsync(final String resourceGroupName, final String accountName, final String filter, final Integer top, final Integer skip, final String expand, final String select, final String orderby, final Boolean count, final String search, final String format) {
return listDataLakeStoreAccountsWithServiceResponseAsync(resourceGroupName, accountName, filter, top, skip, expand, select, orderby, count, search, format)
.map(new Func1<ServiceResponse<Page<DataLakeStoreAccountInfoInner>>, Page<DataLakeStoreAccountInfoInner>>() {
@Override
public Page<DataLakeStoreAccountInfoInner> call(ServiceResponse<Page<DataLakeStoreAccountInfoInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"DataLakeStoreAccountInfoInner",
">",
">",
"listDataLakeStoreAccountsAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"accountName",
",",
"final",
"String",
"filter",
",",
"final",
"Integer",
"top",... | Gets the first page of Data Lake Store accounts linked to the specified Data Lake Analytics account. The response includes a link to the next page, if any.
@param resourceGroupName The name of the Azure resource group that contains the Data Lake Analytics account.
@param accountName The name of the Data Lake Analytics account for which to list Data Lake Store accounts.
@param filter OData filter. Optional.
@param top The number of items to return. Optional.
@param skip The number of items to skip over before returning elements. Optional.
@param expand OData expansion. Expand related resources in line with the retrieved resources, e.g. Categories/$expand=Products would expand Product data in line with each Category entry. Optional.
@param select OData Select statement. Limits the properties on each entry to just those requested, e.g. Categories?$select=CategoryName,Description. Optional.
@param orderby OrderBy clause. One or more comma-separated expressions with an optional "asc" (the default) or "desc" depending on the order you'd like the values sorted, e.g. Categories?$orderby=CategoryName desc. Optional.
@param count The Boolean value of true or false to request a count of the matching resources included with the resources in the response, e.g. Categories?$count=true. Optional.
@param search A free form search. A free-text search expression to match for whether a particular entry should be included in the feed, e.g. Categories?$search=blue OR green. Optional.
@param format The desired return format. Return the response in particular formatxii without access to request headers for standard content-type negotiation (e.g Orders?$format=json). Optional.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<DataLakeStoreAccountInfoInner> object | [
"Gets",
"the",
"first",
"page",
"of",
"Data",
"Lake",
"Store",
"accounts",
"linked",
"to",
"the",
"specified",
"Data",
"Lake",
"Analytics",
"account",
".",
"The",
"response",
"includes",
"a",
"link",
"to",
"the",
"next",
"page",
"if",
"any",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datalakeanalytics/resource-manager/v2015_10_01_preview/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2015_10_01_preview/implementation/AccountsInner.java#L1715-L1723 |
codelibs/fess | src/main/java/org/codelibs/fess/mylasta/action/FessMessages.java | FessMessages.addErrorsCrudFailedToUpdateCrudTable | public FessMessages addErrorsCrudFailedToUpdateCrudTable(String property, String arg0) {
assertPropertyNotNull(property);
add(property, new UserMessage(ERRORS_crud_failed_to_update_crud_table, arg0));
return this;
} | java | public FessMessages addErrorsCrudFailedToUpdateCrudTable(String property, String arg0) {
assertPropertyNotNull(property);
add(property, new UserMessage(ERRORS_crud_failed_to_update_crud_table, arg0));
return this;
} | [
"public",
"FessMessages",
"addErrorsCrudFailedToUpdateCrudTable",
"(",
"String",
"property",
",",
"String",
"arg0",
")",
"{",
"assertPropertyNotNull",
"(",
"property",
")",
";",
"add",
"(",
"property",
",",
"new",
"UserMessage",
"(",
"ERRORS_crud_failed_to_update_crud_t... | Add the created action message for the key 'errors.crud_failed_to_update_crud_table' with parameters.
<pre>
message: Failed to update the data. ({0})
</pre>
@param property The property name for the message. (NotNull)
@param arg0 The parameter arg0 for message. (NotNull)
@return this. (NotNull) | [
"Add",
"the",
"created",
"action",
"message",
"for",
"the",
"key",
"errors",
".",
"crud_failed_to_update_crud_table",
"with",
"parameters",
".",
"<pre",
">",
"message",
":",
"Failed",
"to",
"update",
"the",
"data",
".",
"(",
"{",
"0",
"}",
")",
"<",
"/",
... | train | https://github.com/codelibs/fess/blob/e5e4b722549d32a4958dfd94965b21937bfe64cf/src/main/java/org/codelibs/fess/mylasta/action/FessMessages.java#L2140-L2144 |
GerdHolz/TOVAL | src/de/invation/code/toval/time/TimeUtils.java | TimeUtils.futureFromDate | public static Date futureFromDate(Date date, TimeValue value, boolean clearTimeOfDay){
return diffFromDate(date, value.getValueInMilliseconds(), clearTimeOfDay);
} | java | public static Date futureFromDate(Date date, TimeValue value, boolean clearTimeOfDay){
return diffFromDate(date, value.getValueInMilliseconds(), clearTimeOfDay);
} | [
"public",
"static",
"Date",
"futureFromDate",
"(",
"Date",
"date",
",",
"TimeValue",
"value",
",",
"boolean",
"clearTimeOfDay",
")",
"{",
"return",
"diffFromDate",
"(",
"date",
",",
"value",
".",
"getValueInMilliseconds",
"(",
")",
",",
"clearTimeOfDay",
")",
... | Caution: Difference calculation is based on adding/subtracting milliseconds and omits time zones.<br>
In some cases the method might return possibly unexpected results due to time zones.<br>
When for example to the last day of CEST without time of day information (in 2016: 30.10.2016 00:00:00 000) milliseconds for one day are added,
the resulting date is NOT 30.10.2016 23:00:00 000 (as expected due to one hour subtraction because of summer time) but 31.10.2016 00:00:00 000. | [
"Caution",
":",
"Difference",
"calculation",
"is",
"based",
"on",
"adding",
"/",
"subtracting",
"milliseconds",
"and",
"omits",
"time",
"zones",
".",
"<br",
">",
"In",
"some",
"cases",
"the",
"method",
"might",
"return",
"possibly",
"unexpected",
"results",
"d... | train | https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/time/TimeUtils.java#L108-L110 |
dlemmermann/CalendarFX | CalendarFXGoogle/src/main/java/com/calendarfx/google/service/GoogleCalendarService.java | GoogleCalendarService.deleteEntry | public void deleteEntry(GoogleEntry entry, GoogleCalendar calendar) throws IOException {
dao.events().delete(calendar.getId(), entry.getId()).execute();
} | java | public void deleteEntry(GoogleEntry entry, GoogleCalendar calendar) throws IOException {
dao.events().delete(calendar.getId(), entry.getId()).execute();
} | [
"public",
"void",
"deleteEntry",
"(",
"GoogleEntry",
"entry",
",",
"GoogleCalendar",
"calendar",
")",
"throws",
"IOException",
"{",
"dao",
".",
"events",
"(",
")",
".",
"delete",
"(",
"calendar",
".",
"getId",
"(",
")",
",",
"entry",
".",
"getId",
"(",
"... | Sends a delete request to the google server for the given entry.
@param entry The entry to be deleted from the backend google calendar.
@param calendar The calendar from the entry was deleted.
@throws IOException For unexpected errors. | [
"Sends",
"a",
"delete",
"request",
"to",
"the",
"google",
"server",
"for",
"the",
"given",
"entry",
"."
] | train | https://github.com/dlemmermann/CalendarFX/blob/f2b91c2622c3f29d004485b6426b23b86c331f96/CalendarFXGoogle/src/main/java/com/calendarfx/google/service/GoogleCalendarService.java#L127-L129 |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/io/utility/PRJUtil.java | PRJUtil.readPRJFile | private static String readPRJFile(File prjFile) throws FileNotFoundException, IOException {
try (FileInputStream fis = new FileInputStream(prjFile)) {
BufferedReader r = new BufferedReader(new InputStreamReader(fis, Charset.defaultCharset()));
StringBuilder b = new StringBuilder();
while (r.ready()) {
b.append(r.readLine());
}
return b.toString();
}
} | java | private static String readPRJFile(File prjFile) throws FileNotFoundException, IOException {
try (FileInputStream fis = new FileInputStream(prjFile)) {
BufferedReader r = new BufferedReader(new InputStreamReader(fis, Charset.defaultCharset()));
StringBuilder b = new StringBuilder();
while (r.ready()) {
b.append(r.readLine());
}
return b.toString();
}
} | [
"private",
"static",
"String",
"readPRJFile",
"(",
"File",
"prjFile",
")",
"throws",
"FileNotFoundException",
",",
"IOException",
"{",
"try",
"(",
"FileInputStream",
"fis",
"=",
"new",
"FileInputStream",
"(",
"prjFile",
")",
")",
"{",
"BufferedReader",
"r",
"=",... | Return the content of the PRJ file as a single string
@param prjFile
@return
@throws FileNotFoundException
@throws IOException | [
"Return",
"the",
"content",
"of",
"the",
"PRJ",
"file",
"as",
"a",
"single",
"string"
] | train | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/utility/PRJUtil.java#L111-L120 |
belaban/jgroups-raft | src/org/jgroups/protocols/raft/RaftImpl.java | RaftImpl.handleAppendEntriesRequest | protected AppendResult handleAppendEntriesRequest(byte[] data, int offset, int length, Address leader,
int prev_log_index, int prev_log_term, int entry_term,
int leader_commit, boolean internal) {
// todo: synchronize
raft.leader(leader);
if(data == null || length == 0) { // we got an empty AppendEntries message containing only leader_commit
handleCommitRequest(leader, leader_commit);
return null;
}
LogEntry prev=raft.log_impl.get(prev_log_index);
int curr_index=prev_log_index+1;
if(prev == null && prev_log_index > 0) // didn't find entry
return new AppendResult(false, raft.lastAppended());
// if the term at prev_log_index != prev_term -> return false and the start index of the conflicting term
if(prev_log_index == 0 || prev.term == prev_log_term) {
LogEntry existing=raft.log_impl.get(curr_index);
if(existing != null && existing.term != entry_term) {
// delete this and all subsequent entries and overwrite with received entry
raft.deleteAllLogEntriesStartingFrom(curr_index);
}
raft.append(entry_term, curr_index, data, offset, length, internal).commitLogTo(leader_commit);
if(internal)
raft.executeInternalCommand(null, data, offset, length);
return new AppendResult(true, curr_index).commitIndex(raft.commitIndex());
}
return new AppendResult(false, getFirstIndexOfConflictingTerm(prev_log_index, prev.term), prev.term);
} | java | protected AppendResult handleAppendEntriesRequest(byte[] data, int offset, int length, Address leader,
int prev_log_index, int prev_log_term, int entry_term,
int leader_commit, boolean internal) {
// todo: synchronize
raft.leader(leader);
if(data == null || length == 0) { // we got an empty AppendEntries message containing only leader_commit
handleCommitRequest(leader, leader_commit);
return null;
}
LogEntry prev=raft.log_impl.get(prev_log_index);
int curr_index=prev_log_index+1;
if(prev == null && prev_log_index > 0) // didn't find entry
return new AppendResult(false, raft.lastAppended());
// if the term at prev_log_index != prev_term -> return false and the start index of the conflicting term
if(prev_log_index == 0 || prev.term == prev_log_term) {
LogEntry existing=raft.log_impl.get(curr_index);
if(existing != null && existing.term != entry_term) {
// delete this and all subsequent entries and overwrite with received entry
raft.deleteAllLogEntriesStartingFrom(curr_index);
}
raft.append(entry_term, curr_index, data, offset, length, internal).commitLogTo(leader_commit);
if(internal)
raft.executeInternalCommand(null, data, offset, length);
return new AppendResult(true, curr_index).commitIndex(raft.commitIndex());
}
return new AppendResult(false, getFirstIndexOfConflictingTerm(prev_log_index, prev.term), prev.term);
} | [
"protected",
"AppendResult",
"handleAppendEntriesRequest",
"(",
"byte",
"[",
"]",
"data",
",",
"int",
"offset",
",",
"int",
"length",
",",
"Address",
"leader",
",",
"int",
"prev_log_index",
",",
"int",
"prev_log_term",
",",
"int",
"entry_term",
",",
"int",
"le... | Called (on a follower) when an AppendEntries request is received
@param data The data (command to be appended to the log)
@param offset The offset
@param length The length
@param leader The leader's address (= the sender)
@param prev_log_index The index of the previous log entry
@param prev_log_term The term of the previous log entry
@param entry_term The term of the entry
@param leader_commit The leader's commit_index
@param internal True if the command is an internal command
@return AppendResult A result (true or false), or null if the request was ignored (e.g. due to lower term) | [
"Called",
"(",
"on",
"a",
"follower",
")",
"when",
"an",
"AppendEntries",
"request",
"is",
"received"
] | train | https://github.com/belaban/jgroups-raft/blob/5923a4761df50bfd203cc82cefc138694b4d7fc3/src/org/jgroups/protocols/raft/RaftImpl.java#L40-L70 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/db/KeyField.java | KeyField.init | public void init(KeyArea keyArea, BaseField field, boolean keyOrder)
{
this.m_keyArea = keyArea;
this.m_field = field;
this.m_bOrder = keyOrder;
m_bIsTemporary = false;
m_keyArea.addKeyField(this);
} | java | public void init(KeyArea keyArea, BaseField field, boolean keyOrder)
{
this.m_keyArea = keyArea;
this.m_field = field;
this.m_bOrder = keyOrder;
m_bIsTemporary = false;
m_keyArea.addKeyField(this);
} | [
"public",
"void",
"init",
"(",
"KeyArea",
"keyArea",
",",
"BaseField",
"field",
",",
"boolean",
"keyOrder",
")",
"{",
"this",
".",
"m_keyArea",
"=",
"keyArea",
";",
"this",
".",
"m_field",
"=",
"field",
";",
"this",
".",
"m_bOrder",
"=",
"keyOrder",
";",... | Constructor.
@param keyArea The parent key area.
@param field The key field.
@param keyOrder Ascending or Descending. | [
"Constructor",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/KeyField.java#L76-L83 |
bbottema/simple-java-mail | modules/simple-java-mail/src/main/java/org/simplejavamail/converter/EmailConverter.java | EmailConverter.emlToEmail | public static Email emlToEmail(@Nonnull final InputStream emlInputStream) {
try {
return emlToEmail(readInputStreamToString(checkNonEmptyArgument(emlInputStream, "emlInputStream"), UTF_8));
} catch (IOException e) {
throw new EmailConverterException(EmailConverterException.ERROR_READING_EML_INPUTSTREAM, e);
}
} | java | public static Email emlToEmail(@Nonnull final InputStream emlInputStream) {
try {
return emlToEmail(readInputStreamToString(checkNonEmptyArgument(emlInputStream, "emlInputStream"), UTF_8));
} catch (IOException e) {
throw new EmailConverterException(EmailConverterException.ERROR_READING_EML_INPUTSTREAM, e);
}
} | [
"public",
"static",
"Email",
"emlToEmail",
"(",
"@",
"Nonnull",
"final",
"InputStream",
"emlInputStream",
")",
"{",
"try",
"{",
"return",
"emlToEmail",
"(",
"readInputStreamToString",
"(",
"checkNonEmptyArgument",
"(",
"emlInputStream",
",",
"\"emlInputStream\"",
")",... | Delegates to {@link #emlToEmail(String)} with the full string value read from the given <code>InputStream</code>. | [
"Delegates",
"to",
"{"
] | train | https://github.com/bbottema/simple-java-mail/blob/b03635328aeecd525e35eddfef8f5b9a184559d8/modules/simple-java-mail/src/main/java/org/simplejavamail/converter/EmailConverter.java#L113-L119 |
joniles/mpxj | src/main/java/net/sf/mpxj/RecurringData.java | RecurringData.setWeeklyDay | public void setWeeklyDay(Day day, boolean value)
{
if (value)
{
m_days.add(day);
}
else
{
m_days.remove(day);
}
} | java | public void setWeeklyDay(Day day, boolean value)
{
if (value)
{
m_days.add(day);
}
else
{
m_days.remove(day);
}
} | [
"public",
"void",
"setWeeklyDay",
"(",
"Day",
"day",
",",
"boolean",
"value",
")",
"{",
"if",
"(",
"value",
")",
"{",
"m_days",
".",
"add",
"(",
"day",
")",
";",
"}",
"else",
"{",
"m_days",
".",
"remove",
"(",
"day",
")",
";",
"}",
"}"
] | Set the state of an individual day in a weekly recurrence.
@param day Day instance
@param value true if this day is included in the recurrence | [
"Set",
"the",
"state",
"of",
"an",
"individual",
"day",
"in",
"a",
"weekly",
"recurrence",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/RecurringData.java#L180-L190 |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/CoGroupedStreams.java | CoGroupedStreams.where | public <KEY> Where<KEY> where(KeySelector<T1, KEY> keySelector) {
Preconditions.checkNotNull(keySelector);
final TypeInformation<KEY> keyType = TypeExtractor.getKeySelectorTypes(keySelector, input1.getType());
return where(keySelector, keyType);
} | java | public <KEY> Where<KEY> where(KeySelector<T1, KEY> keySelector) {
Preconditions.checkNotNull(keySelector);
final TypeInformation<KEY> keyType = TypeExtractor.getKeySelectorTypes(keySelector, input1.getType());
return where(keySelector, keyType);
} | [
"public",
"<",
"KEY",
">",
"Where",
"<",
"KEY",
">",
"where",
"(",
"KeySelector",
"<",
"T1",
",",
"KEY",
">",
"keySelector",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"keySelector",
")",
";",
"final",
"TypeInformation",
"<",
"KEY",
">",
"keyTy... | Specifies a {@link KeySelector} for elements from the first input.
@param keySelector The KeySelector to be used for extracting the first input's key for partitioning. | [
"Specifies",
"a",
"{",
"@link",
"KeySelector",
"}",
"for",
"elements",
"from",
"the",
"first",
"input",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/CoGroupedStreams.java#L104-L108 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/JobsImpl.java | JobsImpl.listFromJobScheduleWithServiceResponseAsync | public Observable<ServiceResponseWithHeaders<Page<CloudJob>, JobListFromJobScheduleHeaders>> listFromJobScheduleWithServiceResponseAsync(final String jobScheduleId, final JobListFromJobScheduleOptions jobListFromJobScheduleOptions) {
return listFromJobScheduleSinglePageAsync(jobScheduleId, jobListFromJobScheduleOptions)
.concatMap(new Func1<ServiceResponseWithHeaders<Page<CloudJob>, JobListFromJobScheduleHeaders>, Observable<ServiceResponseWithHeaders<Page<CloudJob>, JobListFromJobScheduleHeaders>>>() {
@Override
public Observable<ServiceResponseWithHeaders<Page<CloudJob>, JobListFromJobScheduleHeaders>> call(ServiceResponseWithHeaders<Page<CloudJob>, JobListFromJobScheduleHeaders> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
JobListFromJobScheduleNextOptions jobListFromJobScheduleNextOptions = null;
if (jobListFromJobScheduleOptions != null) {
jobListFromJobScheduleNextOptions = new JobListFromJobScheduleNextOptions();
jobListFromJobScheduleNextOptions.withClientRequestId(jobListFromJobScheduleOptions.clientRequestId());
jobListFromJobScheduleNextOptions.withReturnClientRequestId(jobListFromJobScheduleOptions.returnClientRequestId());
jobListFromJobScheduleNextOptions.withOcpDate(jobListFromJobScheduleOptions.ocpDate());
}
return Observable.just(page).concatWith(listFromJobScheduleNextWithServiceResponseAsync(nextPageLink, jobListFromJobScheduleNextOptions));
}
});
} | java | public Observable<ServiceResponseWithHeaders<Page<CloudJob>, JobListFromJobScheduleHeaders>> listFromJobScheduleWithServiceResponseAsync(final String jobScheduleId, final JobListFromJobScheduleOptions jobListFromJobScheduleOptions) {
return listFromJobScheduleSinglePageAsync(jobScheduleId, jobListFromJobScheduleOptions)
.concatMap(new Func1<ServiceResponseWithHeaders<Page<CloudJob>, JobListFromJobScheduleHeaders>, Observable<ServiceResponseWithHeaders<Page<CloudJob>, JobListFromJobScheduleHeaders>>>() {
@Override
public Observable<ServiceResponseWithHeaders<Page<CloudJob>, JobListFromJobScheduleHeaders>> call(ServiceResponseWithHeaders<Page<CloudJob>, JobListFromJobScheduleHeaders> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
JobListFromJobScheduleNextOptions jobListFromJobScheduleNextOptions = null;
if (jobListFromJobScheduleOptions != null) {
jobListFromJobScheduleNextOptions = new JobListFromJobScheduleNextOptions();
jobListFromJobScheduleNextOptions.withClientRequestId(jobListFromJobScheduleOptions.clientRequestId());
jobListFromJobScheduleNextOptions.withReturnClientRequestId(jobListFromJobScheduleOptions.returnClientRequestId());
jobListFromJobScheduleNextOptions.withOcpDate(jobListFromJobScheduleOptions.ocpDate());
}
return Observable.just(page).concatWith(listFromJobScheduleNextWithServiceResponseAsync(nextPageLink, jobListFromJobScheduleNextOptions));
}
});
} | [
"public",
"Observable",
"<",
"ServiceResponseWithHeaders",
"<",
"Page",
"<",
"CloudJob",
">",
",",
"JobListFromJobScheduleHeaders",
">",
">",
"listFromJobScheduleWithServiceResponseAsync",
"(",
"final",
"String",
"jobScheduleId",
",",
"final",
"JobListFromJobScheduleOptions",... | Lists the jobs that have been created under the specified job schedule.
@param jobScheduleId The ID of the job schedule from which you want to get a list of jobs.
@param jobListFromJobScheduleOptions Additional parameters for the operation
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<CloudJob> object | [
"Lists",
"the",
"jobs",
"that",
"have",
"been",
"created",
"under",
"the",
"specified",
"job",
"schedule",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/JobsImpl.java#L2706-L2725 |
ksclarke/freelib-utils | src/main/java/info/freelibrary/util/FileUtils.java | FileUtils.toElement | public static Element toElement(final String aFilePath, final boolean aBool) throws FileNotFoundException,
ParserConfigurationException {
return toElement(aFilePath, WILDCARD, aBool);
} | java | public static Element toElement(final String aFilePath, final boolean aBool) throws FileNotFoundException,
ParserConfigurationException {
return toElement(aFilePath, WILDCARD, aBool);
} | [
"public",
"static",
"Element",
"toElement",
"(",
"final",
"String",
"aFilePath",
",",
"final",
"boolean",
"aBool",
")",
"throws",
"FileNotFoundException",
",",
"ParserConfigurationException",
"{",
"return",
"toElement",
"(",
"aFilePath",
",",
"WILDCARD",
",",
"aBool... | Creates an <code>Element</code> that describes the supplied file or directory (and, possibly, all its
subdirectories). Includes absolute path, last modified time, read/write permissions, etc.
@param aFilePath A file system path to turn into XML
@param aBool A boolean indicating whether the XML should contain more than one level
@return An element representation of the file structure
@throws FileNotFoundException If the supplied file does not exist
@throws ParserConfigurationException If the default XML parser for the JRE isn't configured correctly | [
"Creates",
"an",
"<code",
">",
"Element<",
"/",
"code",
">",
"that",
"describes",
"the",
"supplied",
"file",
"or",
"directory",
"(",
"and",
"possibly",
"all",
"its",
"subdirectories",
")",
".",
"Includes",
"absolute",
"path",
"last",
"modified",
"time",
"rea... | train | https://github.com/ksclarke/freelib-utils/blob/54e822ae4c11b3d74793fd82a1a535ffafffaf45/src/main/java/info/freelibrary/util/FileUtils.java#L107-L110 |
lessthanoptimal/BoofCV | main/boofcv-calibration/src/main/java/boofcv/alg/geo/selfcalib/RefineDualQuadraticAlgebra.java | RefineDualQuadraticAlgebra.recomputeQ | void recomputeQ( DMatrixRMaj p , DMatrix4x4 Q ) {
Equation eq = new Equation();
DMatrix3x3 K = new DMatrix3x3();
encodeK(K,0,3,param.data);
eq.alias(p,"p",K,"K");
eq.process("w=K*K'");
eq.process("Q=[w , -w*p;-p'*w , p'*w*p]");
DMatrixRMaj _Q = eq.lookupDDRM("Q");
CommonOps_DDRM.divide(_Q, NormOps_DDRM.normF(_Q));
ConvertDMatrixStruct.convert(_Q,Q);
} | java | void recomputeQ( DMatrixRMaj p , DMatrix4x4 Q ) {
Equation eq = new Equation();
DMatrix3x3 K = new DMatrix3x3();
encodeK(K,0,3,param.data);
eq.alias(p,"p",K,"K");
eq.process("w=K*K'");
eq.process("Q=[w , -w*p;-p'*w , p'*w*p]");
DMatrixRMaj _Q = eq.lookupDDRM("Q");
CommonOps_DDRM.divide(_Q, NormOps_DDRM.normF(_Q));
ConvertDMatrixStruct.convert(_Q,Q);
} | [
"void",
"recomputeQ",
"(",
"DMatrixRMaj",
"p",
",",
"DMatrix4x4",
"Q",
")",
"{",
"Equation",
"eq",
"=",
"new",
"Equation",
"(",
")",
";",
"DMatrix3x3",
"K",
"=",
"new",
"DMatrix3x3",
"(",
")",
";",
"encodeK",
"(",
"K",
",",
"0",
",",
"3",
",",
"par... | Compuets the absolute dual quadratic from the first camera parameters and
plane at infinity
@param p plane at infinity
@param Q (Output) ABQ | [
"Compuets",
"the",
"absolute",
"dual",
"quadratic",
"from",
"the",
"first",
"camera",
"parameters",
"and",
"plane",
"at",
"infinity"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-calibration/src/main/java/boofcv/alg/geo/selfcalib/RefineDualQuadraticAlgebra.java#L155-L165 |
google/closure-compiler | src/com/google/javascript/jscomp/AmbiguateProperties.java | AmbiguateProperties.addRelatedType | private void addRelatedType(JSType type, JSTypeBitSet related) {
computeRelatedTypesForNonUnionType(type);
related.or(relatedBitsets.get(type));
} | java | private void addRelatedType(JSType type, JSTypeBitSet related) {
computeRelatedTypesForNonUnionType(type);
related.or(relatedBitsets.get(type));
} | [
"private",
"void",
"addRelatedType",
"(",
"JSType",
"type",
",",
"JSTypeBitSet",
"related",
")",
"{",
"computeRelatedTypesForNonUnionType",
"(",
"type",
")",
";",
"related",
".",
"or",
"(",
"relatedBitsets",
".",
"get",
"(",
"type",
")",
")",
";",
"}"
] | Adds the given type and all its related types to the given bit set. | [
"Adds",
"the",
"given",
"type",
"and",
"all",
"its",
"related",
"types",
"to",
"the",
"given",
"bit",
"set",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/AmbiguateProperties.java#L342-L345 |
jenkinsci/jenkins | core/src/main/java/jenkins/util/ResourceBundleUtil.java | ResourceBundleUtil.getBundle | private static @CheckForNull ResourceBundle getBundle(@Nonnull String baseName, @Nonnull Locale locale, @Nonnull ClassLoader classLoader) {
try {
return ResourceBundle.getBundle(baseName, locale, classLoader);
} catch (MissingResourceException e) {
// fall through and return null.
logger.finer(e.getMessage());
}
return null;
} | java | private static @CheckForNull ResourceBundle getBundle(@Nonnull String baseName, @Nonnull Locale locale, @Nonnull ClassLoader classLoader) {
try {
return ResourceBundle.getBundle(baseName, locale, classLoader);
} catch (MissingResourceException e) {
// fall through and return null.
logger.finer(e.getMessage());
}
return null;
} | [
"private",
"static",
"@",
"CheckForNull",
"ResourceBundle",
"getBundle",
"(",
"@",
"Nonnull",
"String",
"baseName",
",",
"@",
"Nonnull",
"Locale",
"locale",
",",
"@",
"Nonnull",
"ClassLoader",
"classLoader",
")",
"{",
"try",
"{",
"return",
"ResourceBundle",
".",... | Get a plugin bundle using the supplied Locale and classLoader
@param baseName The bundle base name.
@param locale The Locale.
@param classLoader The classLoader
@return The bundle JSON. | [
"Get",
"a",
"plugin",
"bundle",
"using",
"the",
"supplied",
"Locale",
"and",
"classLoader"
] | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/jenkins/util/ResourceBundleUtil.java#L112-L120 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientCustomImpl.java | KeyVaultClientCustomImpl.listKeyVersionsAsync | public ServiceFuture<List<KeyItem>> listKeyVersionsAsync(final String vaultBaseUrl, final String keyName,
final ListOperationCallback<KeyItem> serviceCallback) {
return getKeyVersionsAsync(vaultBaseUrl, keyName, serviceCallback);
} | java | public ServiceFuture<List<KeyItem>> listKeyVersionsAsync(final String vaultBaseUrl, final String keyName,
final ListOperationCallback<KeyItem> serviceCallback) {
return getKeyVersionsAsync(vaultBaseUrl, keyName, serviceCallback);
} | [
"public",
"ServiceFuture",
"<",
"List",
"<",
"KeyItem",
">",
">",
"listKeyVersionsAsync",
"(",
"final",
"String",
"vaultBaseUrl",
",",
"final",
"String",
"keyName",
",",
"final",
"ListOperationCallback",
"<",
"KeyItem",
">",
"serviceCallback",
")",
"{",
"return",
... | Retrieves a list of individual key versions with the same key name. The full
key identifier, attributes, and tags are provided in the response.
Authorization: Requires the keys/list permission.
@param vaultBaseUrl
The vault name, e.g. https://myvault.vault.azure.net
@param keyName
The name of the key
@param serviceCallback
the async ServiceCallback to handle successful and failed
responses.
@return the {@link ServiceFuture} object | [
"Retrieves",
"a",
"list",
"of",
"individual",
"key",
"versions",
"with",
"the",
"same",
"key",
"name",
".",
"The",
"full",
"key",
"identifier",
"attributes",
"and",
"tags",
"are",
"provided",
"in",
"the",
"response",
".",
"Authorization",
":",
"Requires",
"t... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientCustomImpl.java#L782-L785 |
mapfish/mapfish-print | core/src/main/java/org/mapfish/print/wrapper/PAbstractObject.java | PAbstractObject.optLong | @Override
public final long optLong(final String key, final long defaultValue) {
Long result = optLong(key);
return result == null ? defaultValue : result;
} | java | @Override
public final long optLong(final String key, final long defaultValue) {
Long result = optLong(key);
return result == null ? defaultValue : result;
} | [
"@",
"Override",
"public",
"final",
"long",
"optLong",
"(",
"final",
"String",
"key",
",",
"final",
"long",
"defaultValue",
")",
"{",
"Long",
"result",
"=",
"optLong",
"(",
"key",
")",
";",
"return",
"result",
"==",
"null",
"?",
"defaultValue",
":",
"res... | Get a property as an long or default value.
@param key the property name
@param defaultValue the default value | [
"Get",
"a",
"property",
"as",
"an",
"long",
"or",
"default",
"value",
"."
] | train | https://github.com/mapfish/mapfish-print/blob/25a452cb39f592bd8a53b20db1037703898e1e22/core/src/main/java/org/mapfish/print/wrapper/PAbstractObject.java#L91-L95 |
eclipse/hawkbit | hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/utils/SPDateTimeUtil.java | SPDateTimeUtil.formatLastModifiedAt | public static String formatLastModifiedAt(final BaseEntity baseEntity, final String datePattern) {
if (baseEntity == null) {
return "";
}
return formatDate(baseEntity.getLastModifiedAt(), "", datePattern);
} | java | public static String formatLastModifiedAt(final BaseEntity baseEntity, final String datePattern) {
if (baseEntity == null) {
return "";
}
return formatDate(baseEntity.getLastModifiedAt(), "", datePattern);
} | [
"public",
"static",
"String",
"formatLastModifiedAt",
"(",
"final",
"BaseEntity",
"baseEntity",
",",
"final",
"String",
"datePattern",
")",
"{",
"if",
"(",
"baseEntity",
"==",
"null",
")",
"{",
"return",
"\"\"",
";",
"}",
"return",
"formatDate",
"(",
"baseEnti... | Get formatted date 'last modified at' by entity.
@param baseEntity
the entity
@param datePattern
pattern how to format the date (cp. {@code SimpleDateFormat})
@return String formatted date | [
"Get",
"formatted",
"date",
"last",
"modified",
"at",
"by",
"entity",
"."
] | train | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/utils/SPDateTimeUtil.java#L151-L156 |
alkacon/opencms-core | src/org/opencms/db/CmsSecurityManager.java | CmsSecurityManager.checkPermissions | public void checkPermissions(
CmsRequestContext context,
CmsResource resource,
CmsPermissionSet requiredPermissions,
boolean checkLock,
CmsResourceFilter filter)
throws CmsException, CmsSecurityException {
CmsDbContext dbc = m_dbContextFactory.getDbContext(context);
try {
// check the access permissions
checkPermissions(dbc, resource, requiredPermissions, checkLock, filter);
} finally {
dbc.clear();
}
} | java | public void checkPermissions(
CmsRequestContext context,
CmsResource resource,
CmsPermissionSet requiredPermissions,
boolean checkLock,
CmsResourceFilter filter)
throws CmsException, CmsSecurityException {
CmsDbContext dbc = m_dbContextFactory.getDbContext(context);
try {
// check the access permissions
checkPermissions(dbc, resource, requiredPermissions, checkLock, filter);
} finally {
dbc.clear();
}
} | [
"public",
"void",
"checkPermissions",
"(",
"CmsRequestContext",
"context",
",",
"CmsResource",
"resource",
",",
"CmsPermissionSet",
"requiredPermissions",
",",
"boolean",
"checkLock",
",",
"CmsResourceFilter",
"filter",
")",
"throws",
"CmsException",
",",
"CmsSecurityExce... | Performs a blocking permission check on a resource.<p>
If the required permissions are not satisfied by the permissions the user has on the resource,
an exception is thrown.<p>
@param context the current request context
@param resource the resource on which permissions are required
@param requiredPermissions the set of permissions required to access the resource
@param checkLock if true, the lock status of the resource is also checked
@param filter the filter for the resource
@throws CmsException in case of any i/o error
@throws CmsSecurityException if the required permissions are not satisfied
@see #checkPermissions(CmsRequestContext, CmsResource, CmsPermissionSet, I_CmsPermissionHandler.CmsPermissionCheckResult) | [
"Performs",
"a",
"blocking",
"permission",
"check",
"on",
"a",
"resource",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSecurityManager.java#L445-L460 |
grantland/android-autofittextview | library/src/main/java/me/grantland/widget/AutofitHelper.java | AutofitHelper.setMinTextSize | public AutofitHelper setMinTextSize(int unit, float size) {
Context context = mTextView.getContext();
Resources r = Resources.getSystem();
if (context != null) {
r = context.getResources();
}
setRawMinTextSize(TypedValue.applyDimension(unit, size, r.getDisplayMetrics()));
return this;
} | java | public AutofitHelper setMinTextSize(int unit, float size) {
Context context = mTextView.getContext();
Resources r = Resources.getSystem();
if (context != null) {
r = context.getResources();
}
setRawMinTextSize(TypedValue.applyDimension(unit, size, r.getDisplayMetrics()));
return this;
} | [
"public",
"AutofitHelper",
"setMinTextSize",
"(",
"int",
"unit",
",",
"float",
"size",
")",
"{",
"Context",
"context",
"=",
"mTextView",
".",
"getContext",
"(",
")",
";",
"Resources",
"r",
"=",
"Resources",
".",
"getSystem",
"(",
")",
";",
"if",
"(",
"co... | Set the minimum text size to a given unit and value. See TypedValue for the possible
dimension units.
@param unit The desired dimension unit.
@param size The desired size in the given units.
@attr ref me.grantland.R.styleable#AutofitTextView_minTextSize | [
"Set",
"the",
"minimum",
"text",
"size",
"to",
"a",
"given",
"unit",
"and",
"value",
".",
"See",
"TypedValue",
"for",
"the",
"possible",
"dimension",
"units",
"."
] | train | https://github.com/grantland/android-autofittextview/blob/5c565aa5c3ed62aaa31140440bb526e7435e7947/library/src/main/java/me/grantland/widget/AutofitHelper.java#L333-L343 |
iig-uni-freiburg/SEWOL | src/de/uni/freiburg/iig/telematik/sewol/accesscontrol/rbac/RBACModel.java | RBACModel.createRandomModel | public static RBACModel createRandomModel(Collection<String> users, Collection<String> transactions, Collection<String> roles){
Validate.notNull(transactions);
Validate.notEmpty(transactions);
Validate.noNullElements(transactions);
SOABase context = new SOABase("c1");
context.setSubjects(users);
context.setActivities(transactions);
RoleLattice roleLattice = new RoleLattice(roles);
RBACModel rbac = new RBACModel("rbac1", context, roleLattice);
//Role membership and permissions
List<String> transactionList = new ArrayList<>();
transactionList.addAll(transactions);
Collections.shuffle(transactionList);
List<List<String>> rolePartitions = CollectionUtils.exponentialPartition(users, roles.size());
List<List<String>> activityPartitions = CollectionUtils.exponentialPartition(transactionList, roles.size());
List<String> roleList = new ArrayList<>();
roleList.addAll(rbac.getRoles());
for(int i=0; i<rolePartitions.size(); i++){
try {
rbac.setRoleMembership(roleList.get(i), rolePartitions.get(i));
rbac.setActivityPermission(roleList.get(i), new HashSet<>(activityPartitions.get(i)));
} catch (Exception e) {
throw new RuntimeException(e);
}
}
return rbac;
} | java | public static RBACModel createRandomModel(Collection<String> users, Collection<String> transactions, Collection<String> roles){
Validate.notNull(transactions);
Validate.notEmpty(transactions);
Validate.noNullElements(transactions);
SOABase context = new SOABase("c1");
context.setSubjects(users);
context.setActivities(transactions);
RoleLattice roleLattice = new RoleLattice(roles);
RBACModel rbac = new RBACModel("rbac1", context, roleLattice);
//Role membership and permissions
List<String> transactionList = new ArrayList<>();
transactionList.addAll(transactions);
Collections.shuffle(transactionList);
List<List<String>> rolePartitions = CollectionUtils.exponentialPartition(users, roles.size());
List<List<String>> activityPartitions = CollectionUtils.exponentialPartition(transactionList, roles.size());
List<String> roleList = new ArrayList<>();
roleList.addAll(rbac.getRoles());
for(int i=0; i<rolePartitions.size(); i++){
try {
rbac.setRoleMembership(roleList.get(i), rolePartitions.get(i));
rbac.setActivityPermission(roleList.get(i), new HashSet<>(activityPartitions.get(i)));
} catch (Exception e) {
throw new RuntimeException(e);
}
}
return rbac;
} | [
"public",
"static",
"RBACModel",
"createRandomModel",
"(",
"Collection",
"<",
"String",
">",
"users",
",",
"Collection",
"<",
"String",
">",
"transactions",
",",
"Collection",
"<",
"String",
">",
"roles",
")",
"{",
"Validate",
".",
"notNull",
"(",
"transaction... | Creates a new RBAC model and randomly assigns uses and permissions to roles.<br>
The role lattice contains no relations between different roles.<br>
Only transaction permissions are added to the RBAC model.<br>
Each user is assigned to exactly one role.
@param users The set of users.
@param transactions
@param roles The set of roles.
@return A new RBAC model with random role assignments.
@throws ParameterException | [
"Creates",
"a",
"new",
"RBAC",
"model",
"and",
"randomly",
"assigns",
"uses",
"and",
"permissions",
"to",
"roles",
".",
"<br",
">",
"The",
"role",
"lattice",
"contains",
"no",
"relations",
"between",
"different",
"roles",
".",
"<br",
">",
"Only",
"transactio... | train | https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/src/de/uni/freiburg/iig/telematik/sewol/accesscontrol/rbac/RBACModel.java#L454-L482 |
EdwardRaff/JSAT | JSAT/src/jsat/classifiers/linear/StochasticSTLinearL1.java | StochasticSTLinearL1.setMinScaled | public void setMinScaled(double minFeature)
{
if(Double.isNaN(minFeature))
throw new ArithmeticException("NaN is not a valid feature value");
else if(minFeature < -1)
throw new ArithmeticException("Minimum possible feature value is -1, can not use " + minFeature);
else if(minFeature >= maxScaled)
throw new ArithmeticException("Minimum feature value must be smaller than the maximum");
this.minScaled = minFeature;
} | java | public void setMinScaled(double minFeature)
{
if(Double.isNaN(minFeature))
throw new ArithmeticException("NaN is not a valid feature value");
else if(minFeature < -1)
throw new ArithmeticException("Minimum possible feature value is -1, can not use " + minFeature);
else if(minFeature >= maxScaled)
throw new ArithmeticException("Minimum feature value must be smaller than the maximum");
this.minScaled = minFeature;
} | [
"public",
"void",
"setMinScaled",
"(",
"double",
"minFeature",
")",
"{",
"if",
"(",
"Double",
".",
"isNaN",
"(",
"minFeature",
")",
")",
"throw",
"new",
"ArithmeticException",
"(",
"\"NaN is not a valid feature value\"",
")",
";",
"else",
"if",
"(",
"minFeature"... | Sets the minimum value of any feature after scaling is applied. This
value can be no smaller than -1
@param minFeature the minimum feature value after scaling | [
"Sets",
"the",
"minimum",
"value",
"of",
"any",
"feature",
"after",
"scaling",
"is",
"applied",
".",
"This",
"value",
"can",
"be",
"no",
"smaller",
"than",
"-",
"1"
] | train | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/linear/StochasticSTLinearL1.java#L258-L267 |
Wadpam/guja | guja-core/src/main/java/com/wadpam/guja/oauth2/api/UserResource.java | UserResource.updateMe | @POST
@Path("me")
@RolesAllowed({"ROLE_ADMIN", "ROLE_USER"})
public Response updateMe(@Context HttpServletRequest request,
@Context UriInfo uriInfo,
@Context SecurityContext securityContext,
DUser user) {
Long userId = (Long) request.getAttribute(OAuth2Filter.NAME_USER_ID);
if (null == user.getId()) {
user.setId(userId);
} else if (!user.getId().equals(userId)) {
throw new BadRequestRestException("User ids does not match");
}
return update(userId, uriInfo, securityContext, user);
} | java | @POST
@Path("me")
@RolesAllowed({"ROLE_ADMIN", "ROLE_USER"})
public Response updateMe(@Context HttpServletRequest request,
@Context UriInfo uriInfo,
@Context SecurityContext securityContext,
DUser user) {
Long userId = (Long) request.getAttribute(OAuth2Filter.NAME_USER_ID);
if (null == user.getId()) {
user.setId(userId);
} else if (!user.getId().equals(userId)) {
throw new BadRequestRestException("User ids does not match");
}
return update(userId, uriInfo, securityContext, user);
} | [
"@",
"POST",
"@",
"Path",
"(",
"\"me\"",
")",
"@",
"RolesAllowed",
"(",
"{",
"\"ROLE_ADMIN\"",
",",
"\"ROLE_USER\"",
"}",
")",
"public",
"Response",
"updateMe",
"(",
"@",
"Context",
"HttpServletRequest",
"request",
",",
"@",
"Context",
"UriInfo",
"uriInfo",
... | Update the current user.
@param request injected
@param uriInfo injected
@param user new user info
@return http 200
The URI of the updated user will be stated in the Location header | [
"Update",
"the",
"current",
"user",
"."
] | train | https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/oauth2/api/UserResource.java#L269-L285 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java | KeyVaultClientBaseImpl.updateCertificateOperationAsync | public Observable<CertificateOperation> updateCertificateOperationAsync(String vaultBaseUrl, String certificateName, boolean cancellationRequested) {
return updateCertificateOperationWithServiceResponseAsync(vaultBaseUrl, certificateName, cancellationRequested).map(new Func1<ServiceResponse<CertificateOperation>, CertificateOperation>() {
@Override
public CertificateOperation call(ServiceResponse<CertificateOperation> response) {
return response.body();
}
});
} | java | public Observable<CertificateOperation> updateCertificateOperationAsync(String vaultBaseUrl, String certificateName, boolean cancellationRequested) {
return updateCertificateOperationWithServiceResponseAsync(vaultBaseUrl, certificateName, cancellationRequested).map(new Func1<ServiceResponse<CertificateOperation>, CertificateOperation>() {
@Override
public CertificateOperation call(ServiceResponse<CertificateOperation> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"CertificateOperation",
">",
"updateCertificateOperationAsync",
"(",
"String",
"vaultBaseUrl",
",",
"String",
"certificateName",
",",
"boolean",
"cancellationRequested",
")",
"{",
"return",
"updateCertificateOperationWithServiceResponseAsync",
"(",
... | Updates a certificate operation.
Updates a certificate creation operation that is already in progress. This operation requires the certificates/update permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param certificateName The name of the certificate.
@param cancellationRequested Indicates if cancellation was requested on the certificate operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the CertificateOperation object | [
"Updates",
"a",
"certificate",
"operation",
".",
"Updates",
"a",
"certificate",
"creation",
"operation",
"that",
"is",
"already",
"in",
"progress",
".",
"This",
"operation",
"requires",
"the",
"certificates",
"/",
"update",
"permission",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L7670-L7677 |
mailin-api/sendinblue-java-mvn | src/main/java/com/sendinblue/Sendinblue.java | Sendinblue.delete_child_account | public String delete_child_account(Map<String, String> data) {
String child_authkey = data.get("auth_key");
return delete("account/" + child_authkey, EMPTY_STRING);
} | java | public String delete_child_account(Map<String, String> data) {
String child_authkey = data.get("auth_key");
return delete("account/" + child_authkey, EMPTY_STRING);
} | [
"public",
"String",
"delete_child_account",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"data",
")",
"{",
"String",
"child_authkey",
"=",
"data",
".",
"get",
"(",
"\"auth_key\"",
")",
";",
"return",
"delete",
"(",
"\"account/\"",
"+",
"child_authkey",
","... | /*
Delete Child Account.
@param {Object} data contains json objects as a key value pair from HashMap.
@options data {String} auth_key: 16 character authorization key of Reseller child to be deleted [Mandatory] | [
"/",
"*",
"Delete",
"Child",
"Account",
"."
] | train | https://github.com/mailin-api/sendinblue-java-mvn/blob/3a186b004003450f18d619aa084adc8d75086183/src/main/java/com/sendinblue/Sendinblue.java#L223-L226 |
logic-ng/LogicNG | src/main/java/org/logicng/solvers/sat/CleaneLingSolver.java | CleaneLingSolver.blockClause | private boolean blockClause(final CLClause c, final int blit) {
if (c.dumped() || satisfied(c)) { return false; }
final CLOccs os = occs(-blit);
for (final CLClause d : os) {
assert !d.redundant();
this.stats.steps++;
if (d.dumped() || satisfied(d)) { continue; }
if (tryResolve(c, blit, d)) { return false; }
}
return true;
} | java | private boolean blockClause(final CLClause c, final int blit) {
if (c.dumped() || satisfied(c)) { return false; }
final CLOccs os = occs(-blit);
for (final CLClause d : os) {
assert !d.redundant();
this.stats.steps++;
if (d.dumped() || satisfied(d)) { continue; }
if (tryResolve(c, blit, d)) { return false; }
}
return true;
} | [
"private",
"boolean",
"blockClause",
"(",
"final",
"CLClause",
"c",
",",
"final",
"int",
"blit",
")",
"{",
"if",
"(",
"c",
".",
"dumped",
"(",
")",
"||",
"satisfied",
"(",
"c",
")",
")",
"{",
"return",
"false",
";",
"}",
"final",
"CLOccs",
"os",
"=... | Returns {@code true} if all resolvents of a given clause and a blocking literal are tautological, {@code false} otherwise.
@param c the clause
@param blit the blocking literal
@return {@code true} if all resolvents with 'c' on 'blit' are tautological | [
"Returns",
"{"
] | train | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/sat/CleaneLingSolver.java#L1209-L1219 |
umano/AndroidSlidingUpPanel | library/src/main/java/com/sothree/slidinguppanel/ViewDragHelper.java | ViewDragHelper.findTopChildUnder | public View findTopChildUnder(int x, int y) {
final int childCount = mParentView.getChildCount();
for (int i = childCount - 1; i >= 0; i--) {
final View child = mParentView.getChildAt(mCallback.getOrderedChildIndex(i));
if (x >= child.getLeft() && x < child.getRight() &&
y >= child.getTop() && y < child.getBottom()) {
return child;
}
}
return null;
} | java | public View findTopChildUnder(int x, int y) {
final int childCount = mParentView.getChildCount();
for (int i = childCount - 1; i >= 0; i--) {
final View child = mParentView.getChildAt(mCallback.getOrderedChildIndex(i));
if (x >= child.getLeft() && x < child.getRight() &&
y >= child.getTop() && y < child.getBottom()) {
return child;
}
}
return null;
} | [
"public",
"View",
"findTopChildUnder",
"(",
"int",
"x",
",",
"int",
"y",
")",
"{",
"final",
"int",
"childCount",
"=",
"mParentView",
".",
"getChildCount",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"childCount",
"-",
"1",
";",
"i",
">=",
"0",
";",
... | Find the topmost child under the given point within the parent view's coordinate system.
The child order is determined using {@link Callback#getOrderedChildIndex(int)}.
@param x X position to test in the parent's coordinate system
@param y Y position to test in the parent's coordinate system
@return The topmost child view under (x, y) or null if none found. | [
"Find",
"the",
"topmost",
"child",
"under",
"the",
"given",
"point",
"within",
"the",
"parent",
"view",
"s",
"coordinate",
"system",
".",
"The",
"child",
"order",
"is",
"determined",
"using",
"{",
"@link",
"Callback#getOrderedChildIndex",
"(",
"int",
")",
"}",... | train | https://github.com/umano/AndroidSlidingUpPanel/blob/45a460435b07e764138a700328836cafc1ed5c42/library/src/main/java/com/sothree/slidinguppanel/ViewDragHelper.java#L1480-L1490 |
apache/incubator-heron | heron/schedulers/src/java/org/apache/heron/scheduler/slurm/SlurmController.java | SlurmController.killJob | public boolean killJob(String jobIdFile) {
List<String> jobIdFileContent = readFromFile(jobIdFile);
if (jobIdFileContent.size() > 0) {
String[] slurmCmd = new String[]{"scancel", jobIdFileContent.get(0)};
return runProcess(null, slurmCmd, new StringBuilder());
} else {
LOG.log(Level.SEVERE, "Failed to read the Slurm Job id from file: {0}", jobIdFile);
return false;
}
} | java | public boolean killJob(String jobIdFile) {
List<String> jobIdFileContent = readFromFile(jobIdFile);
if (jobIdFileContent.size() > 0) {
String[] slurmCmd = new String[]{"scancel", jobIdFileContent.get(0)};
return runProcess(null, slurmCmd, new StringBuilder());
} else {
LOG.log(Level.SEVERE, "Failed to read the Slurm Job id from file: {0}", jobIdFile);
return false;
}
} | [
"public",
"boolean",
"killJob",
"(",
"String",
"jobIdFile",
")",
"{",
"List",
"<",
"String",
">",
"jobIdFileContent",
"=",
"readFromFile",
"(",
"jobIdFile",
")",
";",
"if",
"(",
"jobIdFileContent",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"String",
"["... | Cancel the Slurm job by reading the jobid from the jobIdFile. Uses scancel
command to cancel the job. The file contains a single line with the job id.
This file is written by the slurm job script after the job is allocated.
@param jobIdFile the jobId file
@return true if the job is cancelled successfully | [
"Cancel",
"the",
"Slurm",
"job",
"by",
"reading",
"the",
"jobid",
"from",
"the",
"jobIdFile",
".",
"Uses",
"scancel",
"command",
"to",
"cancel",
"the",
"job",
".",
"The",
"file",
"contains",
"a",
"single",
"line",
"with",
"the",
"job",
"id",
".",
"This",... | train | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/schedulers/src/java/org/apache/heron/scheduler/slurm/SlurmController.java#L141-L150 |
FXMisc/Flowless | src/main/java/org/fxmisc/flowless/VirtualFlow.java | VirtualFlow.createHorizontal | public static <T, C extends Cell<T, ?>> VirtualFlow<T, C> createHorizontal(
ObservableList<T> items,
Function<? super T, ? extends C> cellFactory) {
return createHorizontal(items, cellFactory, Gravity.FRONT);
} | java | public static <T, C extends Cell<T, ?>> VirtualFlow<T, C> createHorizontal(
ObservableList<T> items,
Function<? super T, ? extends C> cellFactory) {
return createHorizontal(items, cellFactory, Gravity.FRONT);
} | [
"public",
"static",
"<",
"T",
",",
"C",
"extends",
"Cell",
"<",
"T",
",",
"?",
">",
">",
"VirtualFlow",
"<",
"T",
",",
"C",
">",
"createHorizontal",
"(",
"ObservableList",
"<",
"T",
">",
"items",
",",
"Function",
"<",
"?",
"super",
"T",
",",
"?",
... | Creates a viewport that lays out content horizontally from left to right | [
"Creates",
"a",
"viewport",
"that",
"lays",
"out",
"content",
"horizontally",
"from",
"left",
"to",
"right"
] | train | https://github.com/FXMisc/Flowless/blob/dce2269ebafed8f79203d00085af41f06f3083bc/src/main/java/org/fxmisc/flowless/VirtualFlow.java#L84-L88 |
google/closure-compiler | src/com/google/javascript/jscomp/AstFactory.java | AstFactory.createIf | Node createIf(Node cond, Node then) {
return IR.ifNode(cond, then);
} | java | Node createIf(Node cond, Node then) {
return IR.ifNode(cond, then);
} | [
"Node",
"createIf",
"(",
"Node",
"cond",
",",
"Node",
"then",
")",
"{",
"return",
"IR",
".",
"ifNode",
"(",
"cond",
",",
"then",
")",
";",
"}"
] | Returns a new IF node.
<p>Blocks have no type information, so this is functionally the same as calling {@code
IR.ifNode(cond, then)}. It exists so that a pass can be consistent about always using {@code
AstFactory} to create new nodes. | [
"Returns",
"a",
"new",
"IF",
"node",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/AstFactory.java#L132-L134 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/LocalTime.java | LocalTime.withMinute | public LocalTime withMinute(int minute) {
if (this.minute == minute) {
return this;
}
MINUTE_OF_HOUR.checkValidValue(minute);
return create(hour, minute, second, nano);
} | java | public LocalTime withMinute(int minute) {
if (this.minute == minute) {
return this;
}
MINUTE_OF_HOUR.checkValidValue(minute);
return create(hour, minute, second, nano);
} | [
"public",
"LocalTime",
"withMinute",
"(",
"int",
"minute",
")",
"{",
"if",
"(",
"this",
".",
"minute",
"==",
"minute",
")",
"{",
"return",
"this",
";",
"}",
"MINUTE_OF_HOUR",
".",
"checkValidValue",
"(",
"minute",
")",
";",
"return",
"create",
"(",
"hour... | Returns a copy of this {@code LocalTime} with the minute-of-hour altered.
<p>
This instance is immutable and unaffected by this method call.
@param minute the minute-of-hour to set in the result, from 0 to 59
@return a {@code LocalTime} based on this time with the requested minute, not null
@throws DateTimeException if the minute value is invalid | [
"Returns",
"a",
"copy",
"of",
"this",
"{",
"@code",
"LocalTime",
"}",
"with",
"the",
"minute",
"-",
"of",
"-",
"hour",
"altered",
".",
"<p",
">",
"This",
"instance",
"is",
"immutable",
"and",
"unaffected",
"by",
"this",
"method",
"call",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/LocalTime.java#L880-L886 |
ReactiveX/RxJavaAsyncUtil | src/main/java/rx/util/async/Async.java | Async.toAsyncThrowing | public static <T1, T2, T3, T4, R> Func4<T1, T2, T3, T4, Observable<R>> toAsyncThrowing(final ThrowingFunc4<? super T1, ? super T2, ? super T3, ? super T4, ? extends R> func, final Scheduler scheduler) {
return new Func4<T1, T2, T3, T4, Observable<R>>() {
@Override
public Observable<R> call(T1 t1, T2 t2, T3 t3, T4 t4) {
return startCallable(ThrowingFunctions.toCallable(func, t1, t2, t3, t4), scheduler);
}
};
} | java | public static <T1, T2, T3, T4, R> Func4<T1, T2, T3, T4, Observable<R>> toAsyncThrowing(final ThrowingFunc4<? super T1, ? super T2, ? super T3, ? super T4, ? extends R> func, final Scheduler scheduler) {
return new Func4<T1, T2, T3, T4, Observable<R>>() {
@Override
public Observable<R> call(T1 t1, T2 t2, T3 t3, T4 t4) {
return startCallable(ThrowingFunctions.toCallable(func, t1, t2, t3, t4), scheduler);
}
};
} | [
"public",
"static",
"<",
"T1",
",",
"T2",
",",
"T3",
",",
"T4",
",",
"R",
">",
"Func4",
"<",
"T1",
",",
"T2",
",",
"T3",
",",
"T4",
",",
"Observable",
"<",
"R",
">",
">",
"toAsyncThrowing",
"(",
"final",
"ThrowingFunc4",
"<",
"?",
"super",
"T1",
... | Convert a synchronous function call into an asynchronous function call through an Observable.
<p>
<img width="640" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/toAsync.s.png" alt="">
@param <T1> the first parameter type
@param <T2> the second parameter type
@param <T3> the third parameter type
@param <T4> the fourth parameter type
@param <R> the result type
@param func the function to convert
@param scheduler the Scheduler used to call the {@code func}
@return a function that returns an Observable that executes the {@code func} and emits its returned value
@see <a href="https://github.com/ReactiveX/RxJava/wiki/Async-Operators#wiki-toasync-or-asyncaction-or-asyncfunc">RxJava Wiki: toAsync()</a>
@see <a href="http://msdn.microsoft.com/en-us/library/hh229560.aspx">MSDN: Observable.ToAsync</a> | [
"Convert",
"a",
"synchronous",
"function",
"call",
"into",
"an",
"asynchronous",
"function",
"call",
"through",
"an",
"Observable",
".",
"<p",
">",
"<img",
"width",
"=",
"640",
"src",
"=",
"https",
":",
"//",
"raw",
".",
"github",
".",
"com",
"/",
"wiki"... | train | https://github.com/ReactiveX/RxJavaAsyncUtil/blob/6294e1da30e639df79f76399906229314c14e74d/src/main/java/rx/util/async/Async.java#L1130-L1137 |
auth0/Lock.Android | lib/src/main/java/com/auth0/android/lock/PasswordlessLock.java | PasswordlessLock.newBuilder | @SuppressWarnings("unused")
public static Builder newBuilder(@NonNull Auth0 account, @NonNull LockCallback callback) {
return new PasswordlessLock.Builder(account, callback);
} | java | @SuppressWarnings("unused")
public static Builder newBuilder(@NonNull Auth0 account, @NonNull LockCallback callback) {
return new PasswordlessLock.Builder(account, callback);
} | [
"@",
"SuppressWarnings",
"(",
"\"unused\"",
")",
"public",
"static",
"Builder",
"newBuilder",
"(",
"@",
"NonNull",
"Auth0",
"account",
",",
"@",
"NonNull",
"LockCallback",
"callback",
")",
"{",
"return",
"new",
"PasswordlessLock",
".",
"Builder",
"(",
"account",... | Creates a new Lock.Builder instance with the given account and callback.
Use of Passwordless connections requires your Application to have the <b>Resource Owner</b> Legacy Grant Type enabled.
See <a href="https://auth0.com/docs/clients/client-grant-types">Client Grant Types</a> to learn how to enable it.
@param account details to use against the Auth0 Authentication API.
@param callback that will receive the authentication results.
@return a new Lock.Builder instance. | [
"Creates",
"a",
"new",
"Lock",
".",
"Builder",
"instance",
"with",
"the",
"given",
"account",
"and",
"callback",
".",
"Use",
"of",
"Passwordless",
"connections",
"requires",
"your",
"Application",
"to",
"have",
"the",
"<b",
">",
"Resource",
"Owner<",
"/",
"b... | train | https://github.com/auth0/Lock.Android/blob/8eb2a979048d2eb6cf0ec631e82e6c3fe6e7d220/lib/src/main/java/com/auth0/android/lock/PasswordlessLock.java#L92-L95 |
xetorthio/jedis | src/main/java/redis/clients/jedis/BinaryJedis.java | BinaryJedis.waitReplicas | @Override
public Long waitReplicas(final int replicas, final long timeout) {
checkIsInMultiOrPipeline();
client.waitReplicas(replicas, timeout);
return client.getIntegerReply();
} | java | @Override
public Long waitReplicas(final int replicas, final long timeout) {
checkIsInMultiOrPipeline();
client.waitReplicas(replicas, timeout);
return client.getIntegerReply();
} | [
"@",
"Override",
"public",
"Long",
"waitReplicas",
"(",
"final",
"int",
"replicas",
",",
"final",
"long",
"timeout",
")",
"{",
"checkIsInMultiOrPipeline",
"(",
")",
";",
"client",
".",
"waitReplicas",
"(",
"replicas",
",",
"timeout",
")",
";",
"return",
"cli... | Syncrhonous replication of Redis as described here: http://antirez.com/news/66 Since Java
Object class has implemented "wait" method, we cannot use it, so I had to change the name of
the method. Sorry :S | [
"Syncrhonous",
"replication",
"of",
"Redis",
"as",
"described",
"here",
":",
"http",
":",
"//",
"antirez",
".",
"com",
"/",
"news",
"/",
"66",
"Since",
"Java",
"Object",
"class",
"has",
"implemented",
"wait",
"method",
"we",
"cannot",
"use",
"it",
"so",
... | train | https://github.com/xetorthio/jedis/blob/ef4ab403f9d8fd88bd05092fea96de2e9db0bede/src/main/java/redis/clients/jedis/BinaryJedis.java#L3607-L3612 |
google/closure-compiler | src/com/google/javascript/jscomp/TypeValidator.java | TypeValidator.expectAnyObject | void expectAnyObject(Node n, JSType type, String msg) {
JSType anyObjectType = getNativeType(NO_OBJECT_TYPE);
if (!anyObjectType.isSubtypeOf(type) && !type.isEmptyType()) {
mismatch(n, msg, type, anyObjectType);
}
} | java | void expectAnyObject(Node n, JSType type, String msg) {
JSType anyObjectType = getNativeType(NO_OBJECT_TYPE);
if (!anyObjectType.isSubtypeOf(type) && !type.isEmptyType()) {
mismatch(n, msg, type, anyObjectType);
}
} | [
"void",
"expectAnyObject",
"(",
"Node",
"n",
",",
"JSType",
"type",
",",
"String",
"msg",
")",
"{",
"JSType",
"anyObjectType",
"=",
"getNativeType",
"(",
"NO_OBJECT_TYPE",
")",
";",
"if",
"(",
"!",
"anyObjectType",
".",
"isSubtypeOf",
"(",
"type",
")",
"&&... | Expect the type to contain an object sometimes. If the expectation is not met, issue a warning
at the provided node's source code position. | [
"Expect",
"the",
"type",
"to",
"contain",
"an",
"object",
"sometimes",
".",
"If",
"the",
"expectation",
"is",
"not",
"met",
"issue",
"a",
"warning",
"at",
"the",
"provided",
"node",
"s",
"source",
"code",
"position",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypeValidator.java#L271-L276 |
imsweb/naaccr-xml | src/main/java/com/imsweb/naaccrxml/runtime/NaaccrStreamConfiguration.java | NaaccrStreamConfiguration.registerAttribute | public void registerAttribute(String namespacePrefix, String attributeName, Class<?> clazz, String fieldName, Class<?> fieldClass) {
if (!_namespaces.containsKey(namespacePrefix))
throw new RuntimeException("Namespace prefix '" + namespacePrefix + "' has not been registered yet");
_xstream.aliasAttribute(clazz, fieldName, namespacePrefix + ":" + attributeName);
_xstream.useAttributeFor(fieldName, fieldClass);
} | java | public void registerAttribute(String namespacePrefix, String attributeName, Class<?> clazz, String fieldName, Class<?> fieldClass) {
if (!_namespaces.containsKey(namespacePrefix))
throw new RuntimeException("Namespace prefix '" + namespacePrefix + "' has not been registered yet");
_xstream.aliasAttribute(clazz, fieldName, namespacePrefix + ":" + attributeName);
_xstream.useAttributeFor(fieldName, fieldClass);
} | [
"public",
"void",
"registerAttribute",
"(",
"String",
"namespacePrefix",
",",
"String",
"attributeName",
",",
"Class",
"<",
"?",
">",
"clazz",
",",
"String",
"fieldName",
",",
"Class",
"<",
"?",
">",
"fieldClass",
")",
"{",
"if",
"(",
"!",
"_namespaces",
"... | Registers an attribute corresponding to a specific field of a specific class, in a given namespace.
@param namespacePrefix namespace prefix, required
@param attributeName attribute name, required
@param clazz class containing the field, required
@param fieldName field name, required
@param fieldClass field type, required | [
"Registers",
"an",
"attribute",
"corresponding",
"to",
"a",
"specific",
"field",
"of",
"a",
"specific",
"class",
"in",
"a",
"given",
"namespace",
"."
] | train | https://github.com/imsweb/naaccr-xml/blob/a3a501faa2a0c3411dd5248b2c1379f279131696/src/main/java/com/imsweb/naaccrxml/runtime/NaaccrStreamConfiguration.java#L288-L293 |
MenoData/Time4J | base/src/main/java/net/time4j/range/IsoInterval.java | IsoInterval.get | public final <R> R get(ChronoFunction<ChronoInterval<T>, R> function) {
return function.apply(this);
} | java | public final <R> R get(ChronoFunction<ChronoInterval<T>, R> function) {
return function.apply(this);
} | [
"public",
"final",
"<",
"R",
">",
"R",
"get",
"(",
"ChronoFunction",
"<",
"ChronoInterval",
"<",
"T",
">",
",",
"R",
">",
"function",
")",
"{",
"return",
"function",
".",
"apply",
"(",
"this",
")",
";",
"}"
] | /*[deutsch]
<p>Läßt die angegebene Abfrage dieses Intervall auswerten. </p>
@param <R> generic type of result of query
@param function interval query
@return result of query or {@code null} if undefined
@throws net.time4j.engine.ChronoException if the given query is not executable
@see HolidayModel#firstBusinessDay()
@see HolidayModel#lastBusinessDay()
@since 4.24 | [
"/",
"*",
"[",
"deutsch",
"]",
"<p",
">",
"Lä",
";",
"ß",
";",
"t",
"die",
"angegebene",
"Abfrage",
"dieses",
"Intervall",
"auswerten",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/MenoData/Time4J/blob/08b2eda6b2dbb140b92011cf7071bb087edd46a5/base/src/main/java/net/time4j/range/IsoInterval.java#L155-L159 |
blinkfox/zealot | src/main/java/com/blinkfox/zealot/core/ZealotKhala.java | ZealotKhala.andIn | public ZealotKhala andIn(String field, Collection<?> values) {
return this.doIn(ZealotConst.AND_PREFIX, field, values, true, true);
} | java | public ZealotKhala andIn(String field, Collection<?> values) {
return this.doIn(ZealotConst.AND_PREFIX, field, values, true, true);
} | [
"public",
"ZealotKhala",
"andIn",
"(",
"String",
"field",
",",
"Collection",
"<",
"?",
">",
"values",
")",
"{",
"return",
"this",
".",
"doIn",
"(",
"ZealotConst",
".",
"AND_PREFIX",
",",
"field",
",",
"values",
",",
"true",
",",
"true",
")",
";",
"}"
] | 生成带" AND "前缀的in范围查询的SQL片段.
@param field 数据库字段
@param values 集合的值
@return ZealotKhala实例 | [
"生成带",
"AND",
"前缀的in范围查询的SQL片段",
"."
] | train | https://github.com/blinkfox/zealot/blob/21b00fa3e4ed42188eef3116d494e112e7a4194c/src/main/java/com/blinkfox/zealot/core/ZealotKhala.java#L1326-L1328 |
MTDdk/jawn | jawn-core-new/src/main/java/net/javapla/jawn/core/util/ConvertUtil.java | ConvertUtil.toInteger | public static Integer toInteger(Object value) throws ConversionException {
if (value == null) {
return null;
} else if (value instanceof Number) {
return ((Number)value).intValue();
} else {
NumberFormat nf = new DecimalFormat();
try {
return nf.parse(value.toString()).intValue();
} catch (ParseException e) {
throw new ConversionException("failed to convert: '" + value + "' to Integer", e);
}
}
} | java | public static Integer toInteger(Object value) throws ConversionException {
if (value == null) {
return null;
} else if (value instanceof Number) {
return ((Number)value).intValue();
} else {
NumberFormat nf = new DecimalFormat();
try {
return nf.parse(value.toString()).intValue();
} catch (ParseException e) {
throw new ConversionException("failed to convert: '" + value + "' to Integer", e);
}
}
} | [
"public",
"static",
"Integer",
"toInteger",
"(",
"Object",
"value",
")",
"throws",
"ConversionException",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"else",
"if",
"(",
"value",
"instanceof",
"Number",
")",
"{",
"return",
... | Converts value to Integer if it can. If value is an Integer, it is returned, if it is a Number, it is
promoted to Integer and then returned, in all other cases, it converts the value to String,
then tries to parse Integer from it.
@param value value to be converted to Integer.
@return value converted to Integer.
@throws ConversionException if failing to do the conversion | [
"Converts",
"value",
"to",
"Integer",
"if",
"it",
"can",
".",
"If",
"value",
"is",
"an",
"Integer",
"it",
"is",
"returned",
"if",
"it",
"is",
"a",
"Number",
"it",
"is",
"promoted",
"to",
"Integer",
"and",
"then",
"returned",
"in",
"all",
"other",
"case... | train | https://github.com/MTDdk/jawn/blob/4ec2d09b97d413efdead7487e6075e5bfd13b925/jawn-core-new/src/main/java/net/javapla/jawn/core/util/ConvertUtil.java#L31-L44 |
morimekta/utils | io-util/src/main/java/net/morimekta/util/Binary.java | Binary.toUUID | public UUID toUUID() {
if (length() != 16) {
throw new IllegalStateException("Length not compatible with UUID: " + length() + " != 16");
}
try (BinaryReader reader = new BigEndianBinaryReader(getInputStream())) {
long mostSig = reader.expectLong();
long leastSig = reader.expectLong();
return new UUID(mostSig, leastSig);
} catch (IOException ignore) {
// Actually not possible, just hiding exception
throw new UncheckedIOException(ignore);
}
} | java | public UUID toUUID() {
if (length() != 16) {
throw new IllegalStateException("Length not compatible with UUID: " + length() + " != 16");
}
try (BinaryReader reader = new BigEndianBinaryReader(getInputStream())) {
long mostSig = reader.expectLong();
long leastSig = reader.expectLong();
return new UUID(mostSig, leastSig);
} catch (IOException ignore) {
// Actually not possible, just hiding exception
throw new UncheckedIOException(ignore);
}
} | [
"public",
"UUID",
"toUUID",
"(",
")",
"{",
"if",
"(",
"length",
"(",
")",
"!=",
"16",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Length not compatible with UUID: \"",
"+",
"length",
"(",
")",
"+",
"\" != 16\"",
")",
";",
"}",
"try",
"(",
... | Get a UUID from the binary data.The UUID binary representation is
equivalent to the hexadecimal representation of the UUID (sans dashes).
See {@link UUID#toString()} and {@link UUID#fromString(String)}.
@return The UUID representation of the 16 bytes.
@throws IllegalStateException If the binary does not have the correct
size for holding a UUID, 16 bytes. | [
"Get",
"a",
"UUID",
"from",
"the",
"binary",
"data",
".",
"The",
"UUID",
"binary",
"representation",
"is",
"equivalent",
"to",
"the",
"hexadecimal",
"representation",
"of",
"the",
"UUID",
"(",
"sans",
"dashes",
")",
".",
"See",
"{",
"@link",
"UUID#toString",... | train | https://github.com/morimekta/utils/blob/dc987485902f1a7d58169c89c61db97425a6226d/io-util/src/main/java/net/morimekta/util/Binary.java#L188-L200 |
aNNiMON/Lightweight-Stream-API | stream/src/main/java/com/annimon/stream/LongStream.java | LongStream.takeUntil | @NotNull
public LongStream takeUntil(@NotNull final LongPredicate stopPredicate) {
return new LongStream(params, new LongTakeUntil(iterator, stopPredicate));
} | java | @NotNull
public LongStream takeUntil(@NotNull final LongPredicate stopPredicate) {
return new LongStream(params, new LongTakeUntil(iterator, stopPredicate));
} | [
"@",
"NotNull",
"public",
"LongStream",
"takeUntil",
"(",
"@",
"NotNull",
"final",
"LongPredicate",
"stopPredicate",
")",
"{",
"return",
"new",
"LongStream",
"(",
"params",
",",
"new",
"LongTakeUntil",
"(",
"iterator",
",",
"stopPredicate",
")",
")",
";",
"}"
... | Takes elements while the predicate returns {@code false}.
Once predicate condition is satisfied by an element, the stream
finishes with this element.
<p>This is an intermediate operation.
<p>Example:
<pre>
stopPredicate: (a) -> a > 2
stream: [1, 2, 3, 4, 1, 2, 3, 4]
result: [1, 2, 3]
</pre>
@param stopPredicate the predicate used to take elements
@return the new {@code LongStream}
@since 1.1.6 | [
"Takes",
"elements",
"while",
"the",
"predicate",
"returns",
"{",
"@code",
"false",
"}",
".",
"Once",
"predicate",
"condition",
"is",
"satisfied",
"by",
"an",
"element",
"the",
"stream",
"finishes",
"with",
"this",
"element",
"."
] | train | https://github.com/aNNiMON/Lightweight-Stream-API/blob/f29fd57208c20252a4549b084d55ed082c3e58f0/stream/src/main/java/com/annimon/stream/LongStream.java#L755-L758 |
lessthanoptimal/BoofCV | main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/chess/ChessboardCornerClusterFinder.java | ChessboardCornerClusterFinder.removeReferences | void removeReferences( Vertex remove , EdgeType type ) {
EdgeSet removeSet = remove.getEdgeSet(type);
for (int i = removeSet.size()-1; i >= 0; i--) {
Vertex v = removeSet.get(i).dst;
EdgeSet setV = v.getEdgeSet(type);
// remove the connection from v to 'remove'. Be careful since the connection isn't always mutual
// at this point
int ridx = setV.find(remove);
if( ridx != -1 )
setV.edges.remove(ridx);
}
removeSet.reset();
} | java | void removeReferences( Vertex remove , EdgeType type ) {
EdgeSet removeSet = remove.getEdgeSet(type);
for (int i = removeSet.size()-1; i >= 0; i--) {
Vertex v = removeSet.get(i).dst;
EdgeSet setV = v.getEdgeSet(type);
// remove the connection from v to 'remove'. Be careful since the connection isn't always mutual
// at this point
int ridx = setV.find(remove);
if( ridx != -1 )
setV.edges.remove(ridx);
}
removeSet.reset();
} | [
"void",
"removeReferences",
"(",
"Vertex",
"remove",
",",
"EdgeType",
"type",
")",
"{",
"EdgeSet",
"removeSet",
"=",
"remove",
".",
"getEdgeSet",
"(",
"type",
")",
";",
"for",
"(",
"int",
"i",
"=",
"removeSet",
".",
"size",
"(",
")",
"-",
"1",
";",
"... | Go through all the vertexes that 'remove' is connected to and remove that link. if it is
in the connected list swap it with 'replaceWith'. | [
"Go",
"through",
"all",
"the",
"vertexes",
"that",
"remove",
"is",
"connected",
"to",
"and",
"remove",
"that",
"link",
".",
"if",
"it",
"is",
"in",
"the",
"connected",
"list",
"swap",
"it",
"with",
"replaceWith",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/chess/ChessboardCornerClusterFinder.java#L439-L451 |
weld/core | impl/src/main/java/org/jboss/weld/event/ObserverMethodImpl.java | ObserverMethodImpl.sendEvent | protected void sendEvent(T event, Object receiver, CreationalContext<?> creationalContext) {
try {
preNotify(event, receiver);
// As we are working with the contextual instance, we may not have the
// actual object, but a container proxy (e.g. EJB)
notificationStrategy.invoke(receiver, observerMethod, event, beanManager, creationalContext);
} finally {
postNotify(event, receiver);
}
} | java | protected void sendEvent(T event, Object receiver, CreationalContext<?> creationalContext) {
try {
preNotify(event, receiver);
// As we are working with the contextual instance, we may not have the
// actual object, but a container proxy (e.g. EJB)
notificationStrategy.invoke(receiver, observerMethod, event, beanManager, creationalContext);
} finally {
postNotify(event, receiver);
}
} | [
"protected",
"void",
"sendEvent",
"(",
"T",
"event",
",",
"Object",
"receiver",
",",
"CreationalContext",
"<",
"?",
">",
"creationalContext",
")",
"{",
"try",
"{",
"preNotify",
"(",
"event",
",",
"receiver",
")",
";",
"// As we are working with the contextual inst... | Note that {@link CreationalContext#release()} is not invoked within this method.
@param event
@param receiver
@param creationalContext | [
"Note",
"that",
"{",
"@link",
"CreationalContext#release",
"()",
"}",
"is",
"not",
"invoked",
"within",
"this",
"method",
"."
] | train | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/event/ObserverMethodImpl.java#L325-L334 |
lionsoul2014/jcseg | jcseg-core/src/main/java/org/lionsoul/jcseg/util/Sort.java | Sort.quicksort | private static <T extends Comparable<? super T>>
void quicksort( T[] arr, int left, int right )
{
if ( left + CUTOFF <= right ) {
//find the pivot
T pivot = median( arr, left, right );
//start partitioning
int i = left, j = right - 1;
for ( ; ; ) {
while ( arr[++i].compareTo( pivot ) < 0 ) ;
while ( arr[--j].compareTo( pivot ) > 0 ) ;
if ( i < j ) {
swapReferences( arr, i, j );
} else {
break;
}
}
//swap the pivot reference back to the small collection.
swapReferences( arr, i, right - 1 );
quicksort( arr, left, i - 1 ); //sort the small collection.
quicksort( arr, i + 1, right ); //sort the large collection.
} else {
//if the total number is less than CUTOFF we use insertion sort instead.
insertionSort( arr, left, right );
}
} | java | private static <T extends Comparable<? super T>>
void quicksort( T[] arr, int left, int right )
{
if ( left + CUTOFF <= right ) {
//find the pivot
T pivot = median( arr, left, right );
//start partitioning
int i = left, j = right - 1;
for ( ; ; ) {
while ( arr[++i].compareTo( pivot ) < 0 ) ;
while ( arr[--j].compareTo( pivot ) > 0 ) ;
if ( i < j ) {
swapReferences( arr, i, j );
} else {
break;
}
}
//swap the pivot reference back to the small collection.
swapReferences( arr, i, right - 1 );
quicksort( arr, left, i - 1 ); //sort the small collection.
quicksort( arr, i + 1, right ); //sort the large collection.
} else {
//if the total number is less than CUTOFF we use insertion sort instead.
insertionSort( arr, left, right );
}
} | [
"private",
"static",
"<",
"T",
"extends",
"Comparable",
"<",
"?",
"super",
"T",
">",
">",
"void",
"quicksort",
"(",
"T",
"[",
"]",
"arr",
",",
"int",
"left",
",",
"int",
"right",
")",
"{",
"if",
"(",
"left",
"+",
"CUTOFF",
"<=",
"right",
")",
"{"... | internal method to sort the array with quick sort algorithm
@param arr an array of Comparable Items
@param left the left-most index of the subarray
@param right the right-most index of the subarray | [
"internal",
"method",
"to",
"sort",
"the",
"array",
"with",
"quick",
"sort",
"algorithm"
] | train | https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/util/Sort.java#L266-L295 |
aoindustries/aocode-public | src/main/java/com/aoindustries/servlet/http/ServletUtil.java | ServletUtil.getResource | @Deprecated
public static URL getResource(ServletContext servletContext, HttpServletRequest request, String relativeUrlPath) throws MalformedURLException {
return servletContext.getResource(getAbsolutePath(request, relativeUrlPath));
} | java | @Deprecated
public static URL getResource(ServletContext servletContext, HttpServletRequest request, String relativeUrlPath) throws MalformedURLException {
return servletContext.getResource(getAbsolutePath(request, relativeUrlPath));
} | [
"@",
"Deprecated",
"public",
"static",
"URL",
"getResource",
"(",
"ServletContext",
"servletContext",
",",
"HttpServletRequest",
"request",
",",
"String",
"relativeUrlPath",
")",
"throws",
"MalformedURLException",
"{",
"return",
"servletContext",
".",
"getResource",
"("... | Gets the URL for the provided possibly-relative path or <code>null</code> if no resource
is mapped to the path.
@deprecated Use regular methods directly
@see #getAbsoluteURL(javax.servlet.http.HttpServletRequest, java.lang.String)
@see ServletContext#getResource(java.lang.String)
@see ServletContextCache#getResource(java.lang.String)
@see ServletContextCache#getResource(javax.servlet.ServletContext, java.lang.String) | [
"Gets",
"the",
"URL",
"for",
"the",
"provided",
"possibly",
"-",
"relative",
"path",
"or",
"<code",
">",
"null<",
"/",
"code",
">",
"if",
"no",
"resource",
"is",
"mapped",
"to",
"the",
"path",
"."
] | train | https://github.com/aoindustries/aocode-public/blob/c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3/src/main/java/com/aoindustries/servlet/http/ServletUtil.java#L175-L178 |
sculptor/sculptor | sculptor-generator/sculptor-generator-core/src/main/java/org/sculptor/generator/util/FactoryHelper.java | FactoryHelper.newInstanceFromName | public static Object newInstanceFromName(Object enclosingObject, String className, ClassLoader classLoader) {
try {
Class<?> clazz = Class.forName(className, false, classLoader);
for (Constructor<?> c : clazz.getConstructors()) {
Class<?>[] parameterTypes = c.getParameterTypes();
if (parameterTypes.length == 0) {
return c.newInstance();
} else if (parameterTypes.length == 1 && enclosingObject != null && parameterTypes[0].equals(enclosingObject.getClass())) {
return c.newInstance(enclosingObject);
}
}
return clazz.newInstance();
} catch (Exception e) {
String m = "Couldn't create instance from name " + className + " (" + e.getMessage() + ")";
LOG.error(m, e);
throw new RuntimeException(m);
}
} | java | public static Object newInstanceFromName(Object enclosingObject, String className, ClassLoader classLoader) {
try {
Class<?> clazz = Class.forName(className, false, classLoader);
for (Constructor<?> c : clazz.getConstructors()) {
Class<?>[] parameterTypes = c.getParameterTypes();
if (parameterTypes.length == 0) {
return c.newInstance();
} else if (parameterTypes.length == 1 && enclosingObject != null && parameterTypes[0].equals(enclosingObject.getClass())) {
return c.newInstance(enclosingObject);
}
}
return clazz.newInstance();
} catch (Exception e) {
String m = "Couldn't create instance from name " + className + " (" + e.getMessage() + ")";
LOG.error(m, e);
throw new RuntimeException(m);
}
} | [
"public",
"static",
"Object",
"newInstanceFromName",
"(",
"Object",
"enclosingObject",
",",
"String",
"className",
",",
"ClassLoader",
"classLoader",
")",
"{",
"try",
"{",
"Class",
"<",
"?",
">",
"clazz",
"=",
"Class",
".",
"forName",
"(",
"className",
",",
... | Creates an instance from a String class name.
@param className
full class name
@param classLoader
the class will be loaded with this ClassLoader
@return new instance of the class
@throws RuntimeException
if class not found or could not be instantiated | [
"Creates",
"an",
"instance",
"from",
"a",
"String",
"class",
"name",
"."
] | train | https://github.com/sculptor/sculptor/blob/38df06ceb7e40f5f52dbd53b1cd1d07ee11aade5/sculptor-generator/sculptor-generator-core/src/main/java/org/sculptor/generator/util/FactoryHelper.java#L64-L81 |
ops4j/org.ops4j.pax.logging | pax-logging-service/src/main/java/org/apache/log4j/receivers/db/DBReceiverJob.java | DBReceiverJob.getException | ThrowableInformation getException(Connection connection, long id)
throws SQLException {
PreparedStatement statement = null;
try {
statement = connection.prepareStatement(sqlException);
statement.setLong(1, id);
ResultSet rs = statement.executeQuery();
Vector v = new Vector();
while (rs.next()) {
//int i = rs.getShort(1);
v.add(rs.getString(1));
}
int len = v.size();
String[] strRep = new String[len];
for (int i = 0; i < len; i++) {
strRep[i] = (String) v.get(i);
}
// we've filled strRep, we now attach it to the event
return new ThrowableInformation(strRep);
} finally {
if (statement != null) {
statement.close();
}
}
} | java | ThrowableInformation getException(Connection connection, long id)
throws SQLException {
PreparedStatement statement = null;
try {
statement = connection.prepareStatement(sqlException);
statement.setLong(1, id);
ResultSet rs = statement.executeQuery();
Vector v = new Vector();
while (rs.next()) {
//int i = rs.getShort(1);
v.add(rs.getString(1));
}
int len = v.size();
String[] strRep = new String[len];
for (int i = 0; i < len; i++) {
strRep[i] = (String) v.get(i);
}
// we've filled strRep, we now attach it to the event
return new ThrowableInformation(strRep);
} finally {
if (statement != null) {
statement.close();
}
}
} | [
"ThrowableInformation",
"getException",
"(",
"Connection",
"connection",
",",
"long",
"id",
")",
"throws",
"SQLException",
"{",
"PreparedStatement",
"statement",
"=",
"null",
";",
"try",
"{",
"statement",
"=",
"connection",
".",
"prepareStatement",
"(",
"sqlExceptio... | Retrieve the exception string representation from the
logging_event_exception table.
@param connection
@param id
@throws SQLException | [
"Retrieve",
"the",
"exception",
"string",
"representation",
"from",
"the",
"logging_event_exception",
"table",
"."
] | train | https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-service/src/main/java/org/apache/log4j/receivers/db/DBReceiverJob.java#L198-L227 |
querydsl/querydsl | querydsl-core/src/main/java/com/querydsl/core/types/dsl/Expressions.java | Expressions.dslTemplate | public static <T> DslTemplate<T> dslTemplate(Class<? extends T> cl, String template, Object... args) {
return dslTemplate(cl, createTemplate(template), ImmutableList.copyOf(args));
} | java | public static <T> DslTemplate<T> dslTemplate(Class<? extends T> cl, String template, Object... args) {
return dslTemplate(cl, createTemplate(template), ImmutableList.copyOf(args));
} | [
"public",
"static",
"<",
"T",
">",
"DslTemplate",
"<",
"T",
">",
"dslTemplate",
"(",
"Class",
"<",
"?",
"extends",
"T",
">",
"cl",
",",
"String",
"template",
",",
"Object",
"...",
"args",
")",
"{",
"return",
"dslTemplate",
"(",
"cl",
",",
"createTempla... | Create a new Template expression
@param cl type of expression
@param template template
@param args template parameters
@return template expression | [
"Create",
"a",
"new",
"Template",
"expression"
] | train | https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-core/src/main/java/com/querydsl/core/types/dsl/Expressions.java#L320-L322 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.