repository_name
stringlengths 7
58
| func_path_in_repository
stringlengths 11
218
| func_name
stringlengths 4
140
| whole_func_string
stringlengths 153
5.32k
| language
stringclasses 1
value | func_code_string
stringlengths 72
4k
| func_code_tokens
sequencelengths 20
832
| func_documentation_string
stringlengths 61
2k
| func_documentation_tokens
sequencelengths 1
647
| split_name
stringclasses 1
value | func_code_url
stringlengths 102
339
|
---|---|---|---|---|---|---|---|---|---|---|
grails/grails-core | grails-core/src/main/groovy/org/grails/compiler/injection/GrailsASTUtils.java | GrailsASTUtils.buildGetPropertyExpression | public static MethodCallExpression buildGetPropertyExpression(final Expression objectExpression, final String propertyName, final ClassNode targetClassNode, final boolean useBooleanGetter) {
"""
Build static direct call to getter of a property
@param objectExpression
@param propertyName
@param targetClassNode
@param useBooleanGetter
@return The method call expression
"""
String methodName = (useBooleanGetter ? "is" : "get") + MetaClassHelper.capitalize(propertyName);
MethodCallExpression methodCallExpression = new MethodCallExpression(objectExpression, methodName, MethodCallExpression.NO_ARGUMENTS);
MethodNode getterMethod = targetClassNode.getGetterMethod(methodName);
if(getterMethod != null) {
methodCallExpression.setMethodTarget(getterMethod);
}
return methodCallExpression;
} | java | public static MethodCallExpression buildGetPropertyExpression(final Expression objectExpression, final String propertyName, final ClassNode targetClassNode, final boolean useBooleanGetter) {
String methodName = (useBooleanGetter ? "is" : "get") + MetaClassHelper.capitalize(propertyName);
MethodCallExpression methodCallExpression = new MethodCallExpression(objectExpression, methodName, MethodCallExpression.NO_ARGUMENTS);
MethodNode getterMethod = targetClassNode.getGetterMethod(methodName);
if(getterMethod != null) {
methodCallExpression.setMethodTarget(getterMethod);
}
return methodCallExpression;
} | [
"public",
"static",
"MethodCallExpression",
"buildGetPropertyExpression",
"(",
"final",
"Expression",
"objectExpression",
",",
"final",
"String",
"propertyName",
",",
"final",
"ClassNode",
"targetClassNode",
",",
"final",
"boolean",
"useBooleanGetter",
")",
"{",
"String",
"methodName",
"=",
"(",
"useBooleanGetter",
"?",
"\"is\"",
":",
"\"get\"",
")",
"+",
"MetaClassHelper",
".",
"capitalize",
"(",
"propertyName",
")",
";",
"MethodCallExpression",
"methodCallExpression",
"=",
"new",
"MethodCallExpression",
"(",
"objectExpression",
",",
"methodName",
",",
"MethodCallExpression",
".",
"NO_ARGUMENTS",
")",
";",
"MethodNode",
"getterMethod",
"=",
"targetClassNode",
".",
"getGetterMethod",
"(",
"methodName",
")",
";",
"if",
"(",
"getterMethod",
"!=",
"null",
")",
"{",
"methodCallExpression",
".",
"setMethodTarget",
"(",
"getterMethod",
")",
";",
"}",
"return",
"methodCallExpression",
";",
"}"
] | Build static direct call to getter of a property
@param objectExpression
@param propertyName
@param targetClassNode
@param useBooleanGetter
@return The method call expression | [
"Build",
"static",
"direct",
"call",
"to",
"getter",
"of",
"a",
"property"
] | train | https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-core/src/main/groovy/org/grails/compiler/injection/GrailsASTUtils.java#L1314-L1322 |
VoltDB/voltdb | third_party/java/src/com/google_voltpatches/common/util/concurrent/Monitor.java | Monitor.waitFor | public boolean waitFor(Guard guard, long time, TimeUnit unit) throws InterruptedException {
"""
Waits for the guard to be satisfied. Waits at most the given time, and may be interrupted. May
be called only by a thread currently occupying this monitor.
@return whether the guard is now satisfied
@throws InterruptedException if interrupted while waiting
"""
final long timeoutNanos = toSafeNanos(time, unit);
if (!((guard.monitor == this) & lock.isHeldByCurrentThread())) {
throw new IllegalMonitorStateException();
}
if (guard.isSatisfied()) {
return true;
}
if (Thread.interrupted()) {
throw new InterruptedException();
}
return awaitNanos(guard, timeoutNanos, true);
} | java | public boolean waitFor(Guard guard, long time, TimeUnit unit) throws InterruptedException {
final long timeoutNanos = toSafeNanos(time, unit);
if (!((guard.monitor == this) & lock.isHeldByCurrentThread())) {
throw new IllegalMonitorStateException();
}
if (guard.isSatisfied()) {
return true;
}
if (Thread.interrupted()) {
throw new InterruptedException();
}
return awaitNanos(guard, timeoutNanos, true);
} | [
"public",
"boolean",
"waitFor",
"(",
"Guard",
"guard",
",",
"long",
"time",
",",
"TimeUnit",
"unit",
")",
"throws",
"InterruptedException",
"{",
"final",
"long",
"timeoutNanos",
"=",
"toSafeNanos",
"(",
"time",
",",
"unit",
")",
";",
"if",
"(",
"!",
"(",
"(",
"guard",
".",
"monitor",
"==",
"this",
")",
"&",
"lock",
".",
"isHeldByCurrentThread",
"(",
")",
")",
")",
"{",
"throw",
"new",
"IllegalMonitorStateException",
"(",
")",
";",
"}",
"if",
"(",
"guard",
".",
"isSatisfied",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"Thread",
".",
"interrupted",
"(",
")",
")",
"{",
"throw",
"new",
"InterruptedException",
"(",
")",
";",
"}",
"return",
"awaitNanos",
"(",
"guard",
",",
"timeoutNanos",
",",
"true",
")",
";",
"}"
] | Waits for the guard to be satisfied. Waits at most the given time, and may be interrupted. May
be called only by a thread currently occupying this monitor.
@return whether the guard is now satisfied
@throws InterruptedException if interrupted while waiting | [
"Waits",
"for",
"the",
"guard",
"to",
"be",
"satisfied",
".",
"Waits",
"at",
"most",
"the",
"given",
"time",
"and",
"may",
"be",
"interrupted",
".",
"May",
"be",
"called",
"only",
"by",
"a",
"thread",
"currently",
"occupying",
"this",
"monitor",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/com/google_voltpatches/common/util/concurrent/Monitor.java#L762-L774 |
inkstand-io/scribble | scribble-jcr/src/main/java/io/inkstand/scribble/jcr/JCRAssert.java | JCRAssert.assertStringPropertyEquals | public static void assertStringPropertyEquals(final Node node, final String propertyName, final String actualValue)
throws RepositoryException {
"""
Asserts the equality of a property value of a node with an expected value
@param node
the node containing the property to be verified
@param propertyName
the property name to be verified
@param actualValue
the actual value that should be compared to the propert node
@throws RepositoryException
"""
assertTrue("Node " + node.getPath() + " has no property " + propertyName, node.hasProperty(propertyName));
final Property prop = node.getProperty(propertyName);
assertEquals("Property type is not STRING ", PropertyType.STRING, prop.getType());
assertEquals(actualValue, prop.getString());
} | java | public static void assertStringPropertyEquals(final Node node, final String propertyName, final String actualValue)
throws RepositoryException {
assertTrue("Node " + node.getPath() + " has no property " + propertyName, node.hasProperty(propertyName));
final Property prop = node.getProperty(propertyName);
assertEquals("Property type is not STRING ", PropertyType.STRING, prop.getType());
assertEquals(actualValue, prop.getString());
} | [
"public",
"static",
"void",
"assertStringPropertyEquals",
"(",
"final",
"Node",
"node",
",",
"final",
"String",
"propertyName",
",",
"final",
"String",
"actualValue",
")",
"throws",
"RepositoryException",
"{",
"assertTrue",
"(",
"\"Node \"",
"+",
"node",
".",
"getPath",
"(",
")",
"+",
"\" has no property \"",
"+",
"propertyName",
",",
"node",
".",
"hasProperty",
"(",
"propertyName",
")",
")",
";",
"final",
"Property",
"prop",
"=",
"node",
".",
"getProperty",
"(",
"propertyName",
")",
";",
"assertEquals",
"(",
"\"Property type is not STRING \"",
",",
"PropertyType",
".",
"STRING",
",",
"prop",
".",
"getType",
"(",
")",
")",
";",
"assertEquals",
"(",
"actualValue",
",",
"prop",
".",
"getString",
"(",
")",
")",
";",
"}"
] | Asserts the equality of a property value of a node with an expected value
@param node
the node containing the property to be verified
@param propertyName
the property name to be verified
@param actualValue
the actual value that should be compared to the propert node
@throws RepositoryException | [
"Asserts",
"the",
"equality",
"of",
"a",
"property",
"value",
"of",
"a",
"node",
"with",
"an",
"expected",
"value"
] | train | https://github.com/inkstand-io/scribble/blob/66e67553bad4b1ff817e1715fd1d3dd833406744/scribble-jcr/src/main/java/io/inkstand/scribble/jcr/JCRAssert.java#L62-L68 |
ModeShape/modeshape | web/modeshape-web-jcr-rest/src/main/java/org/modeshape/web/jcr/rest/model/RestRepositories.java | RestRepositories.addRepository | public Repository addRepository( String name,
HttpServletRequest request ) {
"""
Adds a repository to the list.
@param name a {@code non-null} string, the name of the repository.
@param request a {@link HttpServletRequest} instance
@return a {@link Repository} instance.
"""
Repository repository = new Repository(name, request);
repositories.add(repository);
return repository;
} | java | public Repository addRepository( String name,
HttpServletRequest request ) {
Repository repository = new Repository(name, request);
repositories.add(repository);
return repository;
} | [
"public",
"Repository",
"addRepository",
"(",
"String",
"name",
",",
"HttpServletRequest",
"request",
")",
"{",
"Repository",
"repository",
"=",
"new",
"Repository",
"(",
"name",
",",
"request",
")",
";",
"repositories",
".",
"add",
"(",
"repository",
")",
";",
"return",
"repository",
";",
"}"
] | Adds a repository to the list.
@param name a {@code non-null} string, the name of the repository.
@param request a {@link HttpServletRequest} instance
@return a {@link Repository} instance. | [
"Adds",
"a",
"repository",
"to",
"the",
"list",
"."
] | train | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/web/modeshape-web-jcr-rest/src/main/java/org/modeshape/web/jcr/rest/model/RestRepositories.java#L52-L57 |
QSFT/Doradus | doradus-client/src/main/java/com/dell/doradus/client/SpiderSession.java | SpiderSession.deleteObject | public ObjectResult deleteObject(String tableName, String objID) {
"""
Delete the object with the given ID from the given table. This is a convenience
method that creates a {@link DBObjectBatch} consisting of a single {@link DBObject}
with the given ID and then calls {@link #deleteBatch(String, DBObjectBatch)}. The
{@link ObjectResult} for the object ID is then returned. It is not an error to
delete an object that has already been deleted.
@param tableName Name of table from which to delete object. It must belong to this
session's application.
@param objID ID of object to delete.
@return {@link ObjectResult} of deletion request.
"""
Utils.require(!Utils.isEmpty(tableName), "tableName");
Utils.require(!Utils.isEmpty(objID), "objID");
TableDefinition tableDef = m_appDef.getTableDef(tableName);
Utils.require(tableDef != null,
"Unknown table for application '%s': %s", m_appDef.getAppName(), tableName);
DBObjectBatch dbObjBatch = new DBObjectBatch();
dbObjBatch.addObject(objID, tableName);
BatchResult batchResult = deleteBatch(tableName, dbObjBatch);
if (batchResult.isFailed()) {
throw new RuntimeException(batchResult.getErrorMessage());
}
return batchResult.getResultObjects().iterator().next();
} | java | public ObjectResult deleteObject(String tableName, String objID) {
Utils.require(!Utils.isEmpty(tableName), "tableName");
Utils.require(!Utils.isEmpty(objID), "objID");
TableDefinition tableDef = m_appDef.getTableDef(tableName);
Utils.require(tableDef != null,
"Unknown table for application '%s': %s", m_appDef.getAppName(), tableName);
DBObjectBatch dbObjBatch = new DBObjectBatch();
dbObjBatch.addObject(objID, tableName);
BatchResult batchResult = deleteBatch(tableName, dbObjBatch);
if (batchResult.isFailed()) {
throw new RuntimeException(batchResult.getErrorMessage());
}
return batchResult.getResultObjects().iterator().next();
} | [
"public",
"ObjectResult",
"deleteObject",
"(",
"String",
"tableName",
",",
"String",
"objID",
")",
"{",
"Utils",
".",
"require",
"(",
"!",
"Utils",
".",
"isEmpty",
"(",
"tableName",
")",
",",
"\"tableName\"",
")",
";",
"Utils",
".",
"require",
"(",
"!",
"Utils",
".",
"isEmpty",
"(",
"objID",
")",
",",
"\"objID\"",
")",
";",
"TableDefinition",
"tableDef",
"=",
"m_appDef",
".",
"getTableDef",
"(",
"tableName",
")",
";",
"Utils",
".",
"require",
"(",
"tableDef",
"!=",
"null",
",",
"\"Unknown table for application '%s': %s\"",
",",
"m_appDef",
".",
"getAppName",
"(",
")",
",",
"tableName",
")",
";",
"DBObjectBatch",
"dbObjBatch",
"=",
"new",
"DBObjectBatch",
"(",
")",
";",
"dbObjBatch",
".",
"addObject",
"(",
"objID",
",",
"tableName",
")",
";",
"BatchResult",
"batchResult",
"=",
"deleteBatch",
"(",
"tableName",
",",
"dbObjBatch",
")",
";",
"if",
"(",
"batchResult",
".",
"isFailed",
"(",
")",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"batchResult",
".",
"getErrorMessage",
"(",
")",
")",
";",
"}",
"return",
"batchResult",
".",
"getResultObjects",
"(",
")",
".",
"iterator",
"(",
")",
".",
"next",
"(",
")",
";",
"}"
] | Delete the object with the given ID from the given table. This is a convenience
method that creates a {@link DBObjectBatch} consisting of a single {@link DBObject}
with the given ID and then calls {@link #deleteBatch(String, DBObjectBatch)}. The
{@link ObjectResult} for the object ID is then returned. It is not an error to
delete an object that has already been deleted.
@param tableName Name of table from which to delete object. It must belong to this
session's application.
@param objID ID of object to delete.
@return {@link ObjectResult} of deletion request. | [
"Delete",
"the",
"object",
"with",
"the",
"given",
"ID",
"from",
"the",
"given",
"table",
".",
"This",
"is",
"a",
"convenience",
"method",
"that",
"creates",
"a",
"{",
"@link",
"DBObjectBatch",
"}",
"consisting",
"of",
"a",
"single",
"{",
"@link",
"DBObject",
"}",
"with",
"the",
"given",
"ID",
"and",
"then",
"calls",
"{",
"@link",
"#deleteBatch",
"(",
"String",
"DBObjectBatch",
")",
"}",
".",
"The",
"{",
"@link",
"ObjectResult",
"}",
"for",
"the",
"object",
"ID",
"is",
"then",
"returned",
".",
"It",
"is",
"not",
"an",
"error",
"to",
"delete",
"an",
"object",
"that",
"has",
"already",
"been",
"deleted",
"."
] | train | https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-client/src/main/java/com/dell/doradus/client/SpiderSession.java#L188-L201 |
craftercms/deployer | src/main/java/org/craftercms/deployer/utils/ConfigUtils.java | ConfigUtils.getConfigurationsAt | @SuppressWarnings("unchecked")
public static List<HierarchicalConfiguration> getConfigurationsAt(HierarchicalConfiguration config,
String key) throws
DeployerConfigurationException {
"""
Returns the sub-configuration tree whose root is the specified key.
@param config the configuration
@param key the key of the configuration tree
@return the sub-configuration tree, or null if not found
@throws DeployerConfigurationException if an error occurs
"""
try {
return config.configurationsAt(key);
} catch (Exception e) {
throw new DeployerConfigurationException("Failed to retrieve sub-configurations at '" + key + "'", e);
}
} | java | @SuppressWarnings("unchecked")
public static List<HierarchicalConfiguration> getConfigurationsAt(HierarchicalConfiguration config,
String key) throws
DeployerConfigurationException {
try {
return config.configurationsAt(key);
} catch (Exception e) {
throw new DeployerConfigurationException("Failed to retrieve sub-configurations at '" + key + "'", e);
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"List",
"<",
"HierarchicalConfiguration",
">",
"getConfigurationsAt",
"(",
"HierarchicalConfiguration",
"config",
",",
"String",
"key",
")",
"throws",
"DeployerConfigurationException",
"{",
"try",
"{",
"return",
"config",
".",
"configurationsAt",
"(",
"key",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"DeployerConfigurationException",
"(",
"\"Failed to retrieve sub-configurations at '\"",
"+",
"key",
"+",
"\"'\"",
",",
"e",
")",
";",
"}",
"}"
] | Returns the sub-configuration tree whose root is the specified key.
@param config the configuration
@param key the key of the configuration tree
@return the sub-configuration tree, or null if not found
@throws DeployerConfigurationException if an error occurs | [
"Returns",
"the",
"sub",
"-",
"configuration",
"tree",
"whose",
"root",
"is",
"the",
"specified",
"key",
"."
] | train | https://github.com/craftercms/deployer/blob/3ed446e3cc8af1055de2de6f871907f90ef27f63/src/main/java/org/craftercms/deployer/utils/ConfigUtils.java#L270-L279 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java | KeyVaultClientBaseImpl.restoreKeyAsync | public Observable<KeyBundle> restoreKeyAsync(String vaultBaseUrl, byte[] keyBundleBackup) {
"""
Restores a backed up key to a vault.
Imports a previously backed up key into Azure Key Vault, restoring the key, its key identifier, attributes and access control policies. The RESTORE operation may be used to import a previously backed up key. Individual versions of a key cannot be restored. The key is restored in its entirety with the same key name as it had when it was backed up. If the key name is not available in the target Key Vault, the RESTORE operation will be rejected. While the key name is retained during restore, the final key identifier will change if the key is restored to a different vault. Restore will restore all versions and preserve version identifiers. The RESTORE operation is subject to security constraints: The target Key Vault must be owned by the same Microsoft Azure Subscription as the source Key Vault The user must have RESTORE permission in the target Key Vault. This operation requires the keys/restore permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param keyBundleBackup The backup blob associated with a key bundle.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the KeyBundle object
"""
return restoreKeyWithServiceResponseAsync(vaultBaseUrl, keyBundleBackup).map(new Func1<ServiceResponse<KeyBundle>, KeyBundle>() {
@Override
public KeyBundle call(ServiceResponse<KeyBundle> response) {
return response.body();
}
});
} | java | public Observable<KeyBundle> restoreKeyAsync(String vaultBaseUrl, byte[] keyBundleBackup) {
return restoreKeyWithServiceResponseAsync(vaultBaseUrl, keyBundleBackup).map(new Func1<ServiceResponse<KeyBundle>, KeyBundle>() {
@Override
public KeyBundle call(ServiceResponse<KeyBundle> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"KeyBundle",
">",
"restoreKeyAsync",
"(",
"String",
"vaultBaseUrl",
",",
"byte",
"[",
"]",
"keyBundleBackup",
")",
"{",
"return",
"restoreKeyWithServiceResponseAsync",
"(",
"vaultBaseUrl",
",",
"keyBundleBackup",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"KeyBundle",
">",
",",
"KeyBundle",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"KeyBundle",
"call",
"(",
"ServiceResponse",
"<",
"KeyBundle",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Restores a backed up key to a vault.
Imports a previously backed up key into Azure Key Vault, restoring the key, its key identifier, attributes and access control policies. The RESTORE operation may be used to import a previously backed up key. Individual versions of a key cannot be restored. The key is restored in its entirety with the same key name as it had when it was backed up. If the key name is not available in the target Key Vault, the RESTORE operation will be rejected. While the key name is retained during restore, the final key identifier will change if the key is restored to a different vault. Restore will restore all versions and preserve version identifiers. The RESTORE operation is subject to security constraints: The target Key Vault must be owned by the same Microsoft Azure Subscription as the source Key Vault The user must have RESTORE permission in the target Key Vault. This operation requires the keys/restore permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param keyBundleBackup The backup blob associated with a key bundle.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the KeyBundle object | [
"Restores",
"a",
"backed",
"up",
"key",
"to",
"a",
"vault",
".",
"Imports",
"a",
"previously",
"backed",
"up",
"key",
"into",
"Azure",
"Key",
"Vault",
"restoring",
"the",
"key",
"its",
"key",
"identifier",
"attributes",
"and",
"access",
"control",
"policies",
".",
"The",
"RESTORE",
"operation",
"may",
"be",
"used",
"to",
"import",
"a",
"previously",
"backed",
"up",
"key",
".",
"Individual",
"versions",
"of",
"a",
"key",
"cannot",
"be",
"restored",
".",
"The",
"key",
"is",
"restored",
"in",
"its",
"entirety",
"with",
"the",
"same",
"key",
"name",
"as",
"it",
"had",
"when",
"it",
"was",
"backed",
"up",
".",
"If",
"the",
"key",
"name",
"is",
"not",
"available",
"in",
"the",
"target",
"Key",
"Vault",
"the",
"RESTORE",
"operation",
"will",
"be",
"rejected",
".",
"While",
"the",
"key",
"name",
"is",
"retained",
"during",
"restore",
"the",
"final",
"key",
"identifier",
"will",
"change",
"if",
"the",
"key",
"is",
"restored",
"to",
"a",
"different",
"vault",
".",
"Restore",
"will",
"restore",
"all",
"versions",
"and",
"preserve",
"version",
"identifiers",
".",
"The",
"RESTORE",
"operation",
"is",
"subject",
"to",
"security",
"constraints",
":",
"The",
"target",
"Key",
"Vault",
"must",
"be",
"owned",
"by",
"the",
"same",
"Microsoft",
"Azure",
"Subscription",
"as",
"the",
"source",
"Key",
"Vault",
"The",
"user",
"must",
"have",
"RESTORE",
"permission",
"in",
"the",
"target",
"Key",
"Vault",
".",
"This",
"operation",
"requires",
"the",
"keys",
"/",
"restore",
"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#L2080-L2087 |
GCRC/nunaliit | nunaliit2-multimedia/src/main/java/ca/carleton/gcrc/olkit/multimedia/apachePDFBox/imageio/ImageIOUtil.java | ImageIOUtil.getOrCreateChildNode | private static IIOMetadataNode getOrCreateChildNode(IIOMetadataNode parentNode, String name) {
"""
Gets the named child node, or creates and attaches it.
@param parentNode the parent node
@param name name of the child node
@return the existing or just created child node
"""
NodeList nodeList = parentNode.getElementsByTagName(name);
if (nodeList.getLength() > 0)
{
return (IIOMetadataNode) nodeList.item(0);
}
IIOMetadataNode childNode = new IIOMetadataNode(name);
parentNode.appendChild(childNode);
return childNode;
} | java | private static IIOMetadataNode getOrCreateChildNode(IIOMetadataNode parentNode, String name)
{
NodeList nodeList = parentNode.getElementsByTagName(name);
if (nodeList.getLength() > 0)
{
return (IIOMetadataNode) nodeList.item(0);
}
IIOMetadataNode childNode = new IIOMetadataNode(name);
parentNode.appendChild(childNode);
return childNode;
} | [
"private",
"static",
"IIOMetadataNode",
"getOrCreateChildNode",
"(",
"IIOMetadataNode",
"parentNode",
",",
"String",
"name",
")",
"{",
"NodeList",
"nodeList",
"=",
"parentNode",
".",
"getElementsByTagName",
"(",
"name",
")",
";",
"if",
"(",
"nodeList",
".",
"getLength",
"(",
")",
">",
"0",
")",
"{",
"return",
"(",
"IIOMetadataNode",
")",
"nodeList",
".",
"item",
"(",
"0",
")",
";",
"}",
"IIOMetadataNode",
"childNode",
"=",
"new",
"IIOMetadataNode",
"(",
"name",
")",
";",
"parentNode",
".",
"appendChild",
"(",
"childNode",
")",
";",
"return",
"childNode",
";",
"}"
] | Gets the named child node, or creates and attaches it.
@param parentNode the parent node
@param name name of the child node
@return the existing or just created child node | [
"Gets",
"the",
"named",
"child",
"node",
"or",
"creates",
"and",
"attaches",
"it",
"."
] | train | https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-multimedia/src/main/java/ca/carleton/gcrc/olkit/multimedia/apachePDFBox/imageio/ImageIOUtil.java#L336-L346 |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/natures/SARLProjectConfigurator.java | SARLProjectConfigurator.addSarlNatures | public static IStatus addSarlNatures(IProject project, IProgressMonitor monitor) {
"""
Add the SARL natures to the given project.
@param project the project.
@param monitor the monitor.
@return the status if the operation.
"""
return addNatures(project, monitor, getSarlNatures());
} | java | public static IStatus addSarlNatures(IProject project, IProgressMonitor monitor) {
return addNatures(project, monitor, getSarlNatures());
} | [
"public",
"static",
"IStatus",
"addSarlNatures",
"(",
"IProject",
"project",
",",
"IProgressMonitor",
"monitor",
")",
"{",
"return",
"addNatures",
"(",
"project",
",",
"monitor",
",",
"getSarlNatures",
"(",
")",
")",
";",
"}"
] | Add the SARL natures to the given project.
@param project the project.
@param monitor the monitor.
@return the status if the operation. | [
"Add",
"the",
"SARL",
"natures",
"to",
"the",
"given",
"project",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/natures/SARLProjectConfigurator.java#L760-L762 |
google/error-prone | check_api/src/main/java/com/google/errorprone/matchers/Matchers.java | Matchers.hasAnnotation | public static <T extends Tree> Matcher<T> hasAnnotation(
final Class<? extends Annotation> inputClass) {
"""
Determines whether an expression has an annotation of the given class. This includes
annotations inherited from superclasses due to @Inherited.
@param inputClass The class of the annotation to look for (e.g, Produces.class).
"""
return new Matcher<T>() {
@Override
public boolean matches(T tree, VisitorState state) {
return ASTHelpers.hasAnnotation(ASTHelpers.getDeclaredSymbol(tree), inputClass, state);
}
};
} | java | public static <T extends Tree> Matcher<T> hasAnnotation(
final Class<? extends Annotation> inputClass) {
return new Matcher<T>() {
@Override
public boolean matches(T tree, VisitorState state) {
return ASTHelpers.hasAnnotation(ASTHelpers.getDeclaredSymbol(tree), inputClass, state);
}
};
} | [
"public",
"static",
"<",
"T",
"extends",
"Tree",
">",
"Matcher",
"<",
"T",
">",
"hasAnnotation",
"(",
"final",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"inputClass",
")",
"{",
"return",
"new",
"Matcher",
"<",
"T",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"boolean",
"matches",
"(",
"T",
"tree",
",",
"VisitorState",
"state",
")",
"{",
"return",
"ASTHelpers",
".",
"hasAnnotation",
"(",
"ASTHelpers",
".",
"getDeclaredSymbol",
"(",
"tree",
")",
",",
"inputClass",
",",
"state",
")",
";",
"}",
"}",
";",
"}"
] | Determines whether an expression has an annotation of the given class. This includes
annotations inherited from superclasses due to @Inherited.
@param inputClass The class of the annotation to look for (e.g, Produces.class). | [
"Determines",
"whether",
"an",
"expression",
"has",
"an",
"annotation",
"of",
"the",
"given",
"class",
".",
"This",
"includes",
"annotations",
"inherited",
"from",
"superclasses",
"due",
"to",
"@Inherited",
"."
] | train | https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/check_api/src/main/java/com/google/errorprone/matchers/Matchers.java#L826-L834 |
hawkular/hawkular-agent | hawkular-agent-core/src/main/java/org/hawkular/agent/monitor/inventory/ConnectionData.java | ConnectionData.createUri | private static URI createUri(String protocol, String host, int port) {
"""
A convenience method to create a new {@link URI} out of a protocol, host and port, hiding the
{@link URISyntaxException} behind a {@link RuntimeException}.
@param protocol the protocol such as http
@param host hostname or IP address
@param port port number
@return a new {@link URI}
"""
try {
return new URI(protocol, null, host, port, null, null, null);
} catch (URISyntaxException e) {
throw new RuntimeException(e);
}
} | java | private static URI createUri(String protocol, String host, int port) {
try {
return new URI(protocol, null, host, port, null, null, null);
} catch (URISyntaxException e) {
throw new RuntimeException(e);
}
} | [
"private",
"static",
"URI",
"createUri",
"(",
"String",
"protocol",
",",
"String",
"host",
",",
"int",
"port",
")",
"{",
"try",
"{",
"return",
"new",
"URI",
"(",
"protocol",
",",
"null",
",",
"host",
",",
"port",
",",
"null",
",",
"null",
",",
"null",
")",
";",
"}",
"catch",
"(",
"URISyntaxException",
"e",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"e",
")",
";",
"}",
"}"
] | A convenience method to create a new {@link URI} out of a protocol, host and port, hiding the
{@link URISyntaxException} behind a {@link RuntimeException}.
@param protocol the protocol such as http
@param host hostname or IP address
@param port port number
@return a new {@link URI} | [
"A",
"convenience",
"method",
"to",
"create",
"a",
"new",
"{",
"@link",
"URI",
"}",
"out",
"of",
"a",
"protocol",
"host",
"and",
"port",
"hiding",
"the",
"{",
"@link",
"URISyntaxException",
"}",
"behind",
"a",
"{",
"@link",
"RuntimeException",
"}",
"."
] | train | https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-agent-core/src/main/java/org/hawkular/agent/monitor/inventory/ConnectionData.java#L39-L45 |
Azure/azure-sdk-for-java | compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetsInner.java | VirtualMachineScaleSetsInner.updateAsync | public Observable<VirtualMachineScaleSetInner> updateAsync(String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetUpdate parameters) {
"""
Update a VM scale set.
@param resourceGroupName The name of the resource group.
@param vmScaleSetName The name of the VM scale set to create or update.
@param parameters The scale set object.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request
"""
return updateWithServiceResponseAsync(resourceGroupName, vmScaleSetName, parameters).map(new Func1<ServiceResponse<VirtualMachineScaleSetInner>, VirtualMachineScaleSetInner>() {
@Override
public VirtualMachineScaleSetInner call(ServiceResponse<VirtualMachineScaleSetInner> response) {
return response.body();
}
});
} | java | public Observable<VirtualMachineScaleSetInner> updateAsync(String resourceGroupName, String vmScaleSetName, VirtualMachineScaleSetUpdate parameters) {
return updateWithServiceResponseAsync(resourceGroupName, vmScaleSetName, parameters).map(new Func1<ServiceResponse<VirtualMachineScaleSetInner>, VirtualMachineScaleSetInner>() {
@Override
public VirtualMachineScaleSetInner call(ServiceResponse<VirtualMachineScaleSetInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"VirtualMachineScaleSetInner",
">",
"updateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"vmScaleSetName",
",",
"VirtualMachineScaleSetUpdate",
"parameters",
")",
"{",
"return",
"updateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"vmScaleSetName",
",",
"parameters",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"VirtualMachineScaleSetInner",
">",
",",
"VirtualMachineScaleSetInner",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"VirtualMachineScaleSetInner",
"call",
"(",
"ServiceResponse",
"<",
"VirtualMachineScaleSetInner",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Update a VM scale set.
@param resourceGroupName The name of the resource group.
@param vmScaleSetName The name of the VM scale set to create or update.
@param parameters The scale set object.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Update",
"a",
"VM",
"scale",
"set",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetsInner.java#L404-L411 |
h2oai/h2o-3 | h2o-genmodel/src/main/java/hex/genmodel/algos/deeplearning/DeeplearningMojoModel.java | DeeplearningMojoModel.score0 | @Override
public final double[] score0(double[] dataRow, double offset, double[] preds) {
"""
*
This method will be derived from the scoring/prediction function of deeplearning model itself. However,
we followed closely what is being done in deepwater mojo. The variable offset is not used.
@param dataRow
@param offset
@param preds
@return
"""
assert(dataRow != null) : "doubles are null"; // check to make sure data is not null
double[] neuronsInput = new double[_units[0]]; // store inputs into the neural network
double[] neuronsOutput; // save output from a neural network layer
// transform inputs: NAs in categoricals are always set to new extra level.
setInput(dataRow, neuronsInput, _numsA, _catsA, _nums, _cats, _catoffsets, _normmul, _normsub, _use_all_factor_levels, true);
// proprogate inputs through neural network
for (int layer=0; layer < _numLayers; layer++) {
NeuralNetwork oneLayer = new NeuralNetwork(_allActivations[layer], _all_drop_out_ratios[layer],
_weightsAndBias[layer], neuronsInput, _units[layer + 1]);
neuronsOutput = oneLayer.fprop1Layer();
neuronsInput = neuronsOutput;
}
if (!this.isAutoEncoder())
assert (_nclasses == neuronsInput.length) : "nclasses " + _nclasses + " neuronsOutput.length " + neuronsInput.length;
// Correction for classification or standardize outputs
return modifyOutputs(neuronsInput, preds, dataRow);
} | java | @Override
public final double[] score0(double[] dataRow, double offset, double[] preds) {
assert(dataRow != null) : "doubles are null"; // check to make sure data is not null
double[] neuronsInput = new double[_units[0]]; // store inputs into the neural network
double[] neuronsOutput; // save output from a neural network layer
// transform inputs: NAs in categoricals are always set to new extra level.
setInput(dataRow, neuronsInput, _numsA, _catsA, _nums, _cats, _catoffsets, _normmul, _normsub, _use_all_factor_levels, true);
// proprogate inputs through neural network
for (int layer=0; layer < _numLayers; layer++) {
NeuralNetwork oneLayer = new NeuralNetwork(_allActivations[layer], _all_drop_out_ratios[layer],
_weightsAndBias[layer], neuronsInput, _units[layer + 1]);
neuronsOutput = oneLayer.fprop1Layer();
neuronsInput = neuronsOutput;
}
if (!this.isAutoEncoder())
assert (_nclasses == neuronsInput.length) : "nclasses " + _nclasses + " neuronsOutput.length " + neuronsInput.length;
// Correction for classification or standardize outputs
return modifyOutputs(neuronsInput, preds, dataRow);
} | [
"@",
"Override",
"public",
"final",
"double",
"[",
"]",
"score0",
"(",
"double",
"[",
"]",
"dataRow",
",",
"double",
"offset",
",",
"double",
"[",
"]",
"preds",
")",
"{",
"assert",
"(",
"dataRow",
"!=",
"null",
")",
":",
"\"doubles are null\"",
";",
"// check to make sure data is not null",
"double",
"[",
"]",
"neuronsInput",
"=",
"new",
"double",
"[",
"_units",
"[",
"0",
"]",
"]",
";",
"// store inputs into the neural network",
"double",
"[",
"]",
"neuronsOutput",
";",
"// save output from a neural network layer",
"// transform inputs: NAs in categoricals are always set to new extra level.",
"setInput",
"(",
"dataRow",
",",
"neuronsInput",
",",
"_numsA",
",",
"_catsA",
",",
"_nums",
",",
"_cats",
",",
"_catoffsets",
",",
"_normmul",
",",
"_normsub",
",",
"_use_all_factor_levels",
",",
"true",
")",
";",
"// proprogate inputs through neural network",
"for",
"(",
"int",
"layer",
"=",
"0",
";",
"layer",
"<",
"_numLayers",
";",
"layer",
"++",
")",
"{",
"NeuralNetwork",
"oneLayer",
"=",
"new",
"NeuralNetwork",
"(",
"_allActivations",
"[",
"layer",
"]",
",",
"_all_drop_out_ratios",
"[",
"layer",
"]",
",",
"_weightsAndBias",
"[",
"layer",
"]",
",",
"neuronsInput",
",",
"_units",
"[",
"layer",
"+",
"1",
"]",
")",
";",
"neuronsOutput",
"=",
"oneLayer",
".",
"fprop1Layer",
"(",
")",
";",
"neuronsInput",
"=",
"neuronsOutput",
";",
"}",
"if",
"(",
"!",
"this",
".",
"isAutoEncoder",
"(",
")",
")",
"assert",
"(",
"_nclasses",
"==",
"neuronsInput",
".",
"length",
")",
":",
"\"nclasses \"",
"+",
"_nclasses",
"+",
"\" neuronsOutput.length \"",
"+",
"neuronsInput",
".",
"length",
";",
"// Correction for classification or standardize outputs",
"return",
"modifyOutputs",
"(",
"neuronsInput",
",",
"preds",
",",
"dataRow",
")",
";",
"}"
] | *
This method will be derived from the scoring/prediction function of deeplearning model itself. However,
we followed closely what is being done in deepwater mojo. The variable offset is not used.
@param dataRow
@param offset
@param preds
@return | [
"*",
"This",
"method",
"will",
"be",
"derived",
"from",
"the",
"scoring",
"/",
"prediction",
"function",
"of",
"deeplearning",
"model",
"itself",
".",
"However",
"we",
"followed",
"closely",
"what",
"is",
"being",
"done",
"in",
"deepwater",
"mojo",
".",
"The",
"variable",
"offset",
"is",
"not",
"used",
"."
] | train | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-genmodel/src/main/java/hex/genmodel/algos/deeplearning/DeeplearningMojoModel.java#L60-L80 |
albfernandez/itext2 | src/main/java/com/lowagie/text/Document.java | Document.addProducer | public boolean addProducer() {
"""
Adds the producer to a Document.
@return <CODE>true</CODE> if successful, <CODE>false</CODE> otherwise
"""
try {
return add(new Meta(Element.PRODUCER, getVersion()));
} catch (DocumentException de) {
throw new ExceptionConverter(de);
}
} | java | public boolean addProducer() {
try {
return add(new Meta(Element.PRODUCER, getVersion()));
} catch (DocumentException de) {
throw new ExceptionConverter(de);
}
} | [
"public",
"boolean",
"addProducer",
"(",
")",
"{",
"try",
"{",
"return",
"add",
"(",
"new",
"Meta",
"(",
"Element",
".",
"PRODUCER",
",",
"getVersion",
"(",
")",
")",
")",
";",
"}",
"catch",
"(",
"DocumentException",
"de",
")",
"{",
"throw",
"new",
"ExceptionConverter",
"(",
"de",
")",
";",
"}",
"}"
] | Adds the producer to a Document.
@return <CODE>true</CODE> if successful, <CODE>false</CODE> otherwise | [
"Adds",
"the",
"producer",
"to",
"a",
"Document",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/Document.java#L606-L612 |
leancloud/java-sdk-all | core/src/main/java/cn/leancloud/AVACL.java | AVACL.setReadAccess | public void setReadAccess(String userId, boolean allowed) {
"""
Set whether the given user id is allowed to read this object.
"""
if (StringUtil.isEmpty(userId)) {
throw new IllegalArgumentException("cannot setRead/WriteAccess for null userId");
}
boolean writePermission = getWriteAccess(userId);
setPermissionsIfNonEmpty(userId, allowed, writePermission);
} | java | public void setReadAccess(String userId, boolean allowed) {
if (StringUtil.isEmpty(userId)) {
throw new IllegalArgumentException("cannot setRead/WriteAccess for null userId");
}
boolean writePermission = getWriteAccess(userId);
setPermissionsIfNonEmpty(userId, allowed, writePermission);
} | [
"public",
"void",
"setReadAccess",
"(",
"String",
"userId",
",",
"boolean",
"allowed",
")",
"{",
"if",
"(",
"StringUtil",
".",
"isEmpty",
"(",
"userId",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"cannot setRead/WriteAccess for null userId\"",
")",
";",
"}",
"boolean",
"writePermission",
"=",
"getWriteAccess",
"(",
"userId",
")",
";",
"setPermissionsIfNonEmpty",
"(",
"userId",
",",
"allowed",
",",
"writePermission",
")",
";",
"}"
] | Set whether the given user id is allowed to read this object. | [
"Set",
"whether",
"the",
"given",
"user",
"id",
"is",
"allowed",
"to",
"read",
"this",
"object",
"."
] | train | https://github.com/leancloud/java-sdk-all/blob/323f8e7ee38051b1350790e5192304768c5c9f5f/core/src/main/java/cn/leancloud/AVACL.java#L169-L175 |
finmath/finmath-lib | src/main/java/net/finmath/montecarlo/interestrate/products/components/ExposureEstimator.java | ExposureEstimator.getValue | @Override
public RandomVariable getValue(double evaluationTime, LIBORModelMonteCarloSimulationModel model) throws CalculationException {
"""
This method returns the value random variable of the product within the specified model, evaluated at a given evalutationTime.
Note: For a lattice this is often the value conditional to evalutationTime, for a Monte-Carlo simulation this is the (sum of) value discounted to evaluation time.
Cashflows prior evaluationTime are not considered.
@param evaluationTime The time on which this products value should be observed.
@param model The model used to price the product.
@return The random variable representing the value of the product discounted to evaluation time
@throws net.finmath.exception.CalculationException Thrown if the valuation fails, specific cause may be available via the <code>cause()</code> method.
"""
final RandomVariable one = model.getRandomVariableForConstant(1.0);
final RandomVariable zero = model.getRandomVariableForConstant(0.0);
RandomVariable values = underlying.getValue(evaluationTime, model);
if(values.getFiltrationTime() > evaluationTime) {
RandomVariable filterNaN = values.isNaN().sub(1.0).mult(-1.0);
RandomVariable valuesFiltered = values.mult(filterNaN);
/*
* Cut off two standard deviations from regression
*/
double valuesMean = valuesFiltered.getAverage();
double valuesStdDev = valuesFiltered.getStandardDeviation();
double valuesFloor = valuesMean*(1.0-Math.signum(valuesMean)*1E-5)-3.0*valuesStdDev;
double valuesCap = valuesMean*(1.0+Math.signum(valuesMean)*1E-5)+3.0*valuesStdDev;
RandomVariable filter = values.sub(valuesFloor).choose(one, zero)
.mult(values.sub(valuesCap).mult(-1.0).choose(one, zero));
filter = filter.mult(filterNaN);
// Filter values and regressionBasisFunctions
values = values.mult(filter);
RandomVariable[] regressionBasisFunctions = getRegressionBasisFunctions(evaluationTime, model);
RandomVariable[] filteredRegressionBasisFunctions = new RandomVariable[regressionBasisFunctions.length];
for(int i=0; i<regressionBasisFunctions.length; i++) {
filteredRegressionBasisFunctions[i] = regressionBasisFunctions[i].mult(filter);
}
// Remove foresight through conditional expectation
MonteCarloConditionalExpectationRegression condExpEstimator = new MonteCarloConditionalExpectationRegression(filteredRegressionBasisFunctions, regressionBasisFunctions);
// Calculate cond. expectation. Note that no discounting (numeraire division) is required!
values = condExpEstimator.getConditionalExpectation(values);
}
// Return values
return values;
} | java | @Override
public RandomVariable getValue(double evaluationTime, LIBORModelMonteCarloSimulationModel model) throws CalculationException {
final RandomVariable one = model.getRandomVariableForConstant(1.0);
final RandomVariable zero = model.getRandomVariableForConstant(0.0);
RandomVariable values = underlying.getValue(evaluationTime, model);
if(values.getFiltrationTime() > evaluationTime) {
RandomVariable filterNaN = values.isNaN().sub(1.0).mult(-1.0);
RandomVariable valuesFiltered = values.mult(filterNaN);
/*
* Cut off two standard deviations from regression
*/
double valuesMean = valuesFiltered.getAverage();
double valuesStdDev = valuesFiltered.getStandardDeviation();
double valuesFloor = valuesMean*(1.0-Math.signum(valuesMean)*1E-5)-3.0*valuesStdDev;
double valuesCap = valuesMean*(1.0+Math.signum(valuesMean)*1E-5)+3.0*valuesStdDev;
RandomVariable filter = values.sub(valuesFloor).choose(one, zero)
.mult(values.sub(valuesCap).mult(-1.0).choose(one, zero));
filter = filter.mult(filterNaN);
// Filter values and regressionBasisFunctions
values = values.mult(filter);
RandomVariable[] regressionBasisFunctions = getRegressionBasisFunctions(evaluationTime, model);
RandomVariable[] filteredRegressionBasisFunctions = new RandomVariable[regressionBasisFunctions.length];
for(int i=0; i<regressionBasisFunctions.length; i++) {
filteredRegressionBasisFunctions[i] = regressionBasisFunctions[i].mult(filter);
}
// Remove foresight through conditional expectation
MonteCarloConditionalExpectationRegression condExpEstimator = new MonteCarloConditionalExpectationRegression(filteredRegressionBasisFunctions, regressionBasisFunctions);
// Calculate cond. expectation. Note that no discounting (numeraire division) is required!
values = condExpEstimator.getConditionalExpectation(values);
}
// Return values
return values;
} | [
"@",
"Override",
"public",
"RandomVariable",
"getValue",
"(",
"double",
"evaluationTime",
",",
"LIBORModelMonteCarloSimulationModel",
"model",
")",
"throws",
"CalculationException",
"{",
"final",
"RandomVariable",
"one",
"=",
"model",
".",
"getRandomVariableForConstant",
"(",
"1.0",
")",
";",
"final",
"RandomVariable",
"zero",
"=",
"model",
".",
"getRandomVariableForConstant",
"(",
"0.0",
")",
";",
"RandomVariable",
"values",
"=",
"underlying",
".",
"getValue",
"(",
"evaluationTime",
",",
"model",
")",
";",
"if",
"(",
"values",
".",
"getFiltrationTime",
"(",
")",
">",
"evaluationTime",
")",
"{",
"RandomVariable",
"filterNaN",
"=",
"values",
".",
"isNaN",
"(",
")",
".",
"sub",
"(",
"1.0",
")",
".",
"mult",
"(",
"-",
"1.0",
")",
";",
"RandomVariable",
"valuesFiltered",
"=",
"values",
".",
"mult",
"(",
"filterNaN",
")",
";",
"/*\n\t\t\t * Cut off two standard deviations from regression\n\t\t\t */",
"double",
"valuesMean",
"=",
"valuesFiltered",
".",
"getAverage",
"(",
")",
";",
"double",
"valuesStdDev",
"=",
"valuesFiltered",
".",
"getStandardDeviation",
"(",
")",
";",
"double",
"valuesFloor",
"=",
"valuesMean",
"*",
"(",
"1.0",
"-",
"Math",
".",
"signum",
"(",
"valuesMean",
")",
"*",
"1E-5",
")",
"-",
"3.0",
"*",
"valuesStdDev",
";",
"double",
"valuesCap",
"=",
"valuesMean",
"*",
"(",
"1.0",
"+",
"Math",
".",
"signum",
"(",
"valuesMean",
")",
"*",
"1E-5",
")",
"+",
"3.0",
"*",
"valuesStdDev",
";",
"RandomVariable",
"filter",
"=",
"values",
".",
"sub",
"(",
"valuesFloor",
")",
".",
"choose",
"(",
"one",
",",
"zero",
")",
".",
"mult",
"(",
"values",
".",
"sub",
"(",
"valuesCap",
")",
".",
"mult",
"(",
"-",
"1.0",
")",
".",
"choose",
"(",
"one",
",",
"zero",
")",
")",
";",
"filter",
"=",
"filter",
".",
"mult",
"(",
"filterNaN",
")",
";",
"// Filter values and regressionBasisFunctions",
"values",
"=",
"values",
".",
"mult",
"(",
"filter",
")",
";",
"RandomVariable",
"[",
"]",
"regressionBasisFunctions",
"=",
"getRegressionBasisFunctions",
"(",
"evaluationTime",
",",
"model",
")",
";",
"RandomVariable",
"[",
"]",
"filteredRegressionBasisFunctions",
"=",
"new",
"RandomVariable",
"[",
"regressionBasisFunctions",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"regressionBasisFunctions",
".",
"length",
";",
"i",
"++",
")",
"{",
"filteredRegressionBasisFunctions",
"[",
"i",
"]",
"=",
"regressionBasisFunctions",
"[",
"i",
"]",
".",
"mult",
"(",
"filter",
")",
";",
"}",
"// Remove foresight through conditional expectation",
"MonteCarloConditionalExpectationRegression",
"condExpEstimator",
"=",
"new",
"MonteCarloConditionalExpectationRegression",
"(",
"filteredRegressionBasisFunctions",
",",
"regressionBasisFunctions",
")",
";",
"// Calculate cond. expectation. Note that no discounting (numeraire division) is required!",
"values",
"=",
"condExpEstimator",
".",
"getConditionalExpectation",
"(",
"values",
")",
";",
"}",
"// Return values",
"return",
"values",
";",
"}"
] | This method returns the value random variable of the product within the specified model, evaluated at a given evalutationTime.
Note: For a lattice this is often the value conditional to evalutationTime, for a Monte-Carlo simulation this is the (sum of) value discounted to evaluation time.
Cashflows prior evaluationTime are not considered.
@param evaluationTime The time on which this products value should be observed.
@param model The model used to price the product.
@return The random variable representing the value of the product discounted to evaluation time
@throws net.finmath.exception.CalculationException Thrown if the valuation fails, specific cause may be available via the <code>cause()</code> method. | [
"This",
"method",
"returns",
"the",
"value",
"random",
"variable",
"of",
"the",
"product",
"within",
"the",
"specified",
"model",
"evaluated",
"at",
"a",
"given",
"evalutationTime",
".",
"Note",
":",
"For",
"a",
"lattice",
"this",
"is",
"often",
"the",
"value",
"conditional",
"to",
"evalutationTime",
"for",
"a",
"Monte",
"-",
"Carlo",
"simulation",
"this",
"is",
"the",
"(",
"sum",
"of",
")",
"value",
"discounted",
"to",
"evaluation",
"time",
".",
"Cashflows",
"prior",
"evaluationTime",
"are",
"not",
"considered",
"."
] | train | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/montecarlo/interestrate/products/components/ExposureEstimator.java#L77-L117 |
bazaarvoice/emodb | common/zookeeper/src/main/java/com/bazaarvoice/emodb/common/zookeeper/Sync.java | Sync.synchronousSync | public static boolean synchronousSync(CuratorFramework curator, Duration timeout) {
"""
Performs a blocking sync operation. Returns true if the sync completed normally, false if it timed out or
was interrupted.
"""
try {
// Curator sync() is always a background operation. Use a latch to block until it finishes.
final CountDownLatch latch = new CountDownLatch(1);
curator.sync().inBackground(new BackgroundCallback() {
@Override
public void processResult(CuratorFramework curator, CuratorEvent event) throws Exception {
if (event.getType() == CuratorEventType.SYNC) {
latch.countDown();
}
}
}).forPath(curator.getNamespace().isEmpty() ? "/" : "");
// Wait for sync to complete.
return latch.await(timeout.toMillis(), TimeUnit.MILLISECONDS);
} catch (InterruptedException e) {
return false;
} catch (Exception e) {
throw Throwables.propagate(e);
}
} | java | public static boolean synchronousSync(CuratorFramework curator, Duration timeout) {
try {
// Curator sync() is always a background operation. Use a latch to block until it finishes.
final CountDownLatch latch = new CountDownLatch(1);
curator.sync().inBackground(new BackgroundCallback() {
@Override
public void processResult(CuratorFramework curator, CuratorEvent event) throws Exception {
if (event.getType() == CuratorEventType.SYNC) {
latch.countDown();
}
}
}).forPath(curator.getNamespace().isEmpty() ? "/" : "");
// Wait for sync to complete.
return latch.await(timeout.toMillis(), TimeUnit.MILLISECONDS);
} catch (InterruptedException e) {
return false;
} catch (Exception e) {
throw Throwables.propagate(e);
}
} | [
"public",
"static",
"boolean",
"synchronousSync",
"(",
"CuratorFramework",
"curator",
",",
"Duration",
"timeout",
")",
"{",
"try",
"{",
"// Curator sync() is always a background operation. Use a latch to block until it finishes.",
"final",
"CountDownLatch",
"latch",
"=",
"new",
"CountDownLatch",
"(",
"1",
")",
";",
"curator",
".",
"sync",
"(",
")",
".",
"inBackground",
"(",
"new",
"BackgroundCallback",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"processResult",
"(",
"CuratorFramework",
"curator",
",",
"CuratorEvent",
"event",
")",
"throws",
"Exception",
"{",
"if",
"(",
"event",
".",
"getType",
"(",
")",
"==",
"CuratorEventType",
".",
"SYNC",
")",
"{",
"latch",
".",
"countDown",
"(",
")",
";",
"}",
"}",
"}",
")",
".",
"forPath",
"(",
"curator",
".",
"getNamespace",
"(",
")",
".",
"isEmpty",
"(",
")",
"?",
"\"/\"",
":",
"\"\"",
")",
";",
"// Wait for sync to complete.",
"return",
"latch",
".",
"await",
"(",
"timeout",
".",
"toMillis",
"(",
")",
",",
"TimeUnit",
".",
"MILLISECONDS",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"e",
")",
"{",
"return",
"false",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"Throwables",
".",
"propagate",
"(",
"e",
")",
";",
"}",
"}"
] | Performs a blocking sync operation. Returns true if the sync completed normally, false if it timed out or
was interrupted. | [
"Performs",
"a",
"blocking",
"sync",
"operation",
".",
"Returns",
"true",
"if",
"the",
"sync",
"completed",
"normally",
"false",
"if",
"it",
"timed",
"out",
"or",
"was",
"interrupted",
"."
] | train | https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/common/zookeeper/src/main/java/com/bazaarvoice/emodb/common/zookeeper/Sync.java#L18-L38 |
xmlet/XsdAsmFaster | src/main/java/org/xmlet/xsdasmfaster/classes/XsdAsmInterfaces.java | XsdAsmInterfaces.addAttributeGroup | private void addAttributeGroup(XsdAttributeGroup attributeGroup) {
"""
Adds information about the attribute group interface to the attributeGroupInterfaces variable.
@param attributeGroup The attributeGroup to add.
"""
String interfaceName = firstToUpper(attributeGroup.getName());
if (!attributeGroupInterfaces.containsKey(interfaceName)){
List<XsdAttribute> ownElements = attributeGroup.getXsdElements()
.filter(attribute -> attribute.getParent().equals(attributeGroup))
.map(attribute -> (XsdAttribute) attribute)
.collect(Collectors.toList());
List<String> parentNames = attributeGroup.getAttributeGroups().stream().map(XsdNamedElements::getName).collect(Collectors.toList());
AttributeHierarchyItem attributeHierarchyItemItem = new AttributeHierarchyItem(parentNames, ownElements);
attributeGroupInterfaces.put(interfaceName, attributeHierarchyItemItem);
attributeGroup.getAttributeGroups().forEach(this::addAttributeGroup);
}
} | java | private void addAttributeGroup(XsdAttributeGroup attributeGroup) {
String interfaceName = firstToUpper(attributeGroup.getName());
if (!attributeGroupInterfaces.containsKey(interfaceName)){
List<XsdAttribute> ownElements = attributeGroup.getXsdElements()
.filter(attribute -> attribute.getParent().equals(attributeGroup))
.map(attribute -> (XsdAttribute) attribute)
.collect(Collectors.toList());
List<String> parentNames = attributeGroup.getAttributeGroups().stream().map(XsdNamedElements::getName).collect(Collectors.toList());
AttributeHierarchyItem attributeHierarchyItemItem = new AttributeHierarchyItem(parentNames, ownElements);
attributeGroupInterfaces.put(interfaceName, attributeHierarchyItemItem);
attributeGroup.getAttributeGroups().forEach(this::addAttributeGroup);
}
} | [
"private",
"void",
"addAttributeGroup",
"(",
"XsdAttributeGroup",
"attributeGroup",
")",
"{",
"String",
"interfaceName",
"=",
"firstToUpper",
"(",
"attributeGroup",
".",
"getName",
"(",
")",
")",
";",
"if",
"(",
"!",
"attributeGroupInterfaces",
".",
"containsKey",
"(",
"interfaceName",
")",
")",
"{",
"List",
"<",
"XsdAttribute",
">",
"ownElements",
"=",
"attributeGroup",
".",
"getXsdElements",
"(",
")",
".",
"filter",
"(",
"attribute",
"->",
"attribute",
".",
"getParent",
"(",
")",
".",
"equals",
"(",
"attributeGroup",
")",
")",
".",
"map",
"(",
"attribute",
"->",
"(",
"XsdAttribute",
")",
"attribute",
")",
".",
"collect",
"(",
"Collectors",
".",
"toList",
"(",
")",
")",
";",
"List",
"<",
"String",
">",
"parentNames",
"=",
"attributeGroup",
".",
"getAttributeGroups",
"(",
")",
".",
"stream",
"(",
")",
".",
"map",
"(",
"XsdNamedElements",
"::",
"getName",
")",
".",
"collect",
"(",
"Collectors",
".",
"toList",
"(",
")",
")",
";",
"AttributeHierarchyItem",
"attributeHierarchyItemItem",
"=",
"new",
"AttributeHierarchyItem",
"(",
"parentNames",
",",
"ownElements",
")",
";",
"attributeGroupInterfaces",
".",
"put",
"(",
"interfaceName",
",",
"attributeHierarchyItemItem",
")",
";",
"attributeGroup",
".",
"getAttributeGroups",
"(",
")",
".",
"forEach",
"(",
"this",
"::",
"addAttributeGroup",
")",
";",
"}",
"}"
] | Adds information about the attribute group interface to the attributeGroupInterfaces variable.
@param attributeGroup The attributeGroup to add. | [
"Adds",
"information",
"about",
"the",
"attribute",
"group",
"interface",
"to",
"the",
"attributeGroupInterfaces",
"variable",
"."
] | train | https://github.com/xmlet/XsdAsmFaster/blob/ccb78f9dd4b957ad5ac1ca349eaf24338c421e94/src/main/java/org/xmlet/xsdasmfaster/classes/XsdAsmInterfaces.java#L275-L291 |
apache/groovy | src/main/java/org/codehaus/groovy/classgen/asm/CompileStack.java | CompileStack.defineTemporaryVariable | public int defineTemporaryVariable(String name, ClassNode node, boolean store) {
"""
creates a temporary variable.
@param name defines the name
@param node defines the node
@param store defines if the top-level argument of the stack should be stored
@return the index used for this temporary variable
"""
BytecodeVariable answer = defineVar(name, node, false, false);
temporaryVariables.addFirst(answer); // TRICK: we add at the beginning so when we find for remove or get we always have the last one
usedVariables.removeLast();
if (store) controller.getOperandStack().storeVar(answer);
return answer.getIndex();
} | java | public int defineTemporaryVariable(String name, ClassNode node, boolean store) {
BytecodeVariable answer = defineVar(name, node, false, false);
temporaryVariables.addFirst(answer); // TRICK: we add at the beginning so when we find for remove or get we always have the last one
usedVariables.removeLast();
if (store) controller.getOperandStack().storeVar(answer);
return answer.getIndex();
} | [
"public",
"int",
"defineTemporaryVariable",
"(",
"String",
"name",
",",
"ClassNode",
"node",
",",
"boolean",
"store",
")",
"{",
"BytecodeVariable",
"answer",
"=",
"defineVar",
"(",
"name",
",",
"node",
",",
"false",
",",
"false",
")",
";",
"temporaryVariables",
".",
"addFirst",
"(",
"answer",
")",
";",
"// TRICK: we add at the beginning so when we find for remove or get we always have the last one",
"usedVariables",
".",
"removeLast",
"(",
")",
";",
"if",
"(",
"store",
")",
"controller",
".",
"getOperandStack",
"(",
")",
".",
"storeVar",
"(",
"answer",
")",
";",
"return",
"answer",
".",
"getIndex",
"(",
")",
";",
"}"
] | creates a temporary variable.
@param name defines the name
@param node defines the node
@param store defines if the top-level argument of the stack should be stored
@return the index used for this temporary variable | [
"creates",
"a",
"temporary",
"variable",
"."
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/classgen/asm/CompileStack.java#L316-L324 |
eurekaclinical/eurekaclinical-standard-apis | src/main/java/org/eurekaclinical/standardapis/props/EurekaClinicalProperties.java | EurekaClinicalProperties.getValue | protected final String getValue(final String propertyName, String defaultValue) {
"""
Returns the String value of the given property name, or the given default
if the given property name does not exist.
@param propertyName The name of the property to fetch a value for.
@param defaultValue The default value to return if the property name does
not exist.
@return A string containing either the value of the property, or the
default value.
"""
String value = getValue(propertyName);
if (value == null) {
if (defaultValue == null) {
LOGGER.warn(
"Property '{}' is not specified in "
+ getClass().getName()
+ ", and no default is specified.", propertyName);
}
value = defaultValue;
}
return value;
} | java | protected final String getValue(final String propertyName, String defaultValue) {
String value = getValue(propertyName);
if (value == null) {
if (defaultValue == null) {
LOGGER.warn(
"Property '{}' is not specified in "
+ getClass().getName()
+ ", and no default is specified.", propertyName);
}
value = defaultValue;
}
return value;
} | [
"protected",
"final",
"String",
"getValue",
"(",
"final",
"String",
"propertyName",
",",
"String",
"defaultValue",
")",
"{",
"String",
"value",
"=",
"getValue",
"(",
"propertyName",
")",
";",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"if",
"(",
"defaultValue",
"==",
"null",
")",
"{",
"LOGGER",
".",
"warn",
"(",
"\"Property '{}' is not specified in \"",
"+",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
"+",
"\", and no default is specified.\"",
",",
"propertyName",
")",
";",
"}",
"value",
"=",
"defaultValue",
";",
"}",
"return",
"value",
";",
"}"
] | Returns the String value of the given property name, or the given default
if the given property name does not exist.
@param propertyName The name of the property to fetch a value for.
@param defaultValue The default value to return if the property name does
not exist.
@return A string containing either the value of the property, or the
default value. | [
"Returns",
"the",
"String",
"value",
"of",
"the",
"given",
"property",
"name",
"or",
"the",
"given",
"default",
"if",
"the",
"given",
"property",
"name",
"does",
"not",
"exist",
"."
] | train | https://github.com/eurekaclinical/eurekaclinical-standard-apis/blob/690036dde82a4f2c2106d32403cdf1c713429377/src/main/java/org/eurekaclinical/standardapis/props/EurekaClinicalProperties.java#L164-L176 |
UrielCh/ovh-java-sdk | ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java | ApiOvhIpLoadbalancing.serviceName_availableFarmProbes_GET | public ArrayList<OvhFarmAvailableProbe> serviceName_availableFarmProbes_GET(String serviceName) throws IOException {
"""
Available farm probes for health checks
REST: GET /ipLoadbalancing/{serviceName}/availableFarmProbes
@param serviceName [required] The internal name of your IP load balancing
"""
String qPath = "/ipLoadbalancing/{serviceName}/availableFarmProbes";
StringBuilder sb = path(qPath, serviceName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t5);
} | java | public ArrayList<OvhFarmAvailableProbe> serviceName_availableFarmProbes_GET(String serviceName) throws IOException {
String qPath = "/ipLoadbalancing/{serviceName}/availableFarmProbes";
StringBuilder sb = path(qPath, serviceName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t5);
} | [
"public",
"ArrayList",
"<",
"OvhFarmAvailableProbe",
">",
"serviceName_availableFarmProbes_GET",
"(",
"String",
"serviceName",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/ipLoadbalancing/{serviceName}/availableFarmProbes\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"serviceName",
")",
";",
"String",
"resp",
"=",
"exec",
"(",
"qPath",
",",
"\"GET\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"null",
")",
";",
"return",
"convertTo",
"(",
"resp",
",",
"t5",
")",
";",
"}"
] | Available farm probes for health checks
REST: GET /ipLoadbalancing/{serviceName}/availableFarmProbes
@param serviceName [required] The internal name of your IP load balancing | [
"Available",
"farm",
"probes",
"for",
"health",
"checks"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java#L710-L715 |
betfair/cougar | baseline/baseline-app/src/main/java/com/betfair/cougar/baseline/BaselineServiceImpl.java | BaselineServiceImpl.subscribeToTimeTick | @Override
public void subscribeToTimeTick(ExecutionContext ctx, Object[] args, ExecutionObserver executionObserver) {
"""
Please note that this Service method is called by the Execution Venue to establish a communication
channel from the transport to the Application to publish events. In essence, the transport subscribes
to the app, so this method is called once for each publisher. The application should hold onto the
passed in observer, and call onResult on that observer to emit an event.
@param ctx
@param args
@param executionObserver
"""
if (getEventTransportIdentity(ctx).getPrincipal().getName().equals(SONIC_TRANSPORT_INSTANCE_ONE)) {
this.timeTickPublishingObserver = executionObserver;
}
} | java | @Override
public void subscribeToTimeTick(ExecutionContext ctx, Object[] args, ExecutionObserver executionObserver) {
if (getEventTransportIdentity(ctx).getPrincipal().getName().equals(SONIC_TRANSPORT_INSTANCE_ONE)) {
this.timeTickPublishingObserver = executionObserver;
}
} | [
"@",
"Override",
"public",
"void",
"subscribeToTimeTick",
"(",
"ExecutionContext",
"ctx",
",",
"Object",
"[",
"]",
"args",
",",
"ExecutionObserver",
"executionObserver",
")",
"{",
"if",
"(",
"getEventTransportIdentity",
"(",
"ctx",
")",
".",
"getPrincipal",
"(",
")",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"SONIC_TRANSPORT_INSTANCE_ONE",
")",
")",
"{",
"this",
".",
"timeTickPublishingObserver",
"=",
"executionObserver",
";",
"}",
"}"
] | Please note that this Service method is called by the Execution Venue to establish a communication
channel from the transport to the Application to publish events. In essence, the transport subscribes
to the app, so this method is called once for each publisher. The application should hold onto the
passed in observer, and call onResult on that observer to emit an event.
@param ctx
@param args
@param executionObserver | [
"Please",
"note",
"that",
"this",
"Service",
"method",
"is",
"called",
"by",
"the",
"Execution",
"Venue",
"to",
"establish",
"a",
"communication",
"channel",
"from",
"the",
"transport",
"to",
"the",
"Application",
"to",
"publish",
"events",
".",
"In",
"essence",
"the",
"transport",
"subscribes",
"to",
"the",
"app",
"so",
"this",
"method",
"is",
"called",
"once",
"for",
"each",
"publisher",
".",
"The",
"application",
"should",
"hold",
"onto",
"the",
"passed",
"in",
"observer",
"and",
"call",
"onResult",
"on",
"that",
"observer",
"to",
"emit",
"an",
"event",
"."
] | train | https://github.com/betfair/cougar/blob/08d1fe338fbd0e8572a9c2305bb5796402d5b1f5/baseline/baseline-app/src/main/java/com/betfair/cougar/baseline/BaselineServiceImpl.java#L1913-L1918 |
alkacon/opencms-core | src/org/opencms/db/CmsSecurityManager.java | CmsSecurityManager.readGroup | public CmsGroup readGroup(CmsRequestContext context, CmsUUID groupId) throws CmsException {
"""
Reads a group based on its id.<p>
@param context the current request context
@param groupId the id of the group that is to be read
@return the requested group
@throws CmsException if operation was not successful
"""
CmsDbContext dbc = m_dbContextFactory.getDbContext(context);
CmsGroup result = null;
try {
result = m_driverManager.readGroup(dbc, groupId);
} catch (Exception e) {
dbc.report(null, Messages.get().container(Messages.ERR_READ_GROUP_FOR_ID_1, groupId.toString()), e);
} finally {
dbc.clear();
}
return result;
} | java | public CmsGroup readGroup(CmsRequestContext context, CmsUUID groupId) throws CmsException {
CmsDbContext dbc = m_dbContextFactory.getDbContext(context);
CmsGroup result = null;
try {
result = m_driverManager.readGroup(dbc, groupId);
} catch (Exception e) {
dbc.report(null, Messages.get().container(Messages.ERR_READ_GROUP_FOR_ID_1, groupId.toString()), e);
} finally {
dbc.clear();
}
return result;
} | [
"public",
"CmsGroup",
"readGroup",
"(",
"CmsRequestContext",
"context",
",",
"CmsUUID",
"groupId",
")",
"throws",
"CmsException",
"{",
"CmsDbContext",
"dbc",
"=",
"m_dbContextFactory",
".",
"getDbContext",
"(",
"context",
")",
";",
"CmsGroup",
"result",
"=",
"null",
";",
"try",
"{",
"result",
"=",
"m_driverManager",
".",
"readGroup",
"(",
"dbc",
",",
"groupId",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"dbc",
".",
"report",
"(",
"null",
",",
"Messages",
".",
"get",
"(",
")",
".",
"container",
"(",
"Messages",
".",
"ERR_READ_GROUP_FOR_ID_1",
",",
"groupId",
".",
"toString",
"(",
")",
")",
",",
"e",
")",
";",
"}",
"finally",
"{",
"dbc",
".",
"clear",
"(",
")",
";",
"}",
"return",
"result",
";",
"}"
] | Reads a group based on its id.<p>
@param context the current request context
@param groupId the id of the group that is to be read
@return the requested group
@throws CmsException if operation was not successful | [
"Reads",
"a",
"group",
"based",
"on",
"its",
"id",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSecurityManager.java#L4350-L4362 |
i-net-software/jlessc | src/com/inet/lib/less/CssMediaOutput.java | CssMediaOutput.startBlock | void startBlock( String[] selectors , StringBuilder output ) {
"""
Start a block inside the media
@param selectors
the selectors
@param output
a buffer for the content of the rule.
"""
this.results.add( new CssRuleOutput( selectors, output, isReference ) );
} | java | void startBlock( String[] selectors , StringBuilder output ) {
this.results.add( new CssRuleOutput( selectors, output, isReference ) );
} | [
"void",
"startBlock",
"(",
"String",
"[",
"]",
"selectors",
",",
"StringBuilder",
"output",
")",
"{",
"this",
".",
"results",
".",
"add",
"(",
"new",
"CssRuleOutput",
"(",
"selectors",
",",
"output",
",",
"isReference",
")",
")",
";",
"}"
] | Start a block inside the media
@param selectors
the selectors
@param output
a buffer for the content of the rule. | [
"Start",
"a",
"block",
"inside",
"the",
"media"
] | train | https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/CssMediaOutput.java#L107-L109 |
timols/java-gitlab-api | src/main/java/org/gitlab/api/GitlabAPI.java | GitlabAPI.getBuildVariable | public GitlabBuildVariable getBuildVariable(GitlabProject project, String key)
throws IOException {
"""
Gets build variable associated with a project and key.
@param project The project associated with the variable.
@return A variable.
@throws IOException on gitlab api call error
"""
return getBuildVariable(project.getId(), key);
} | java | public GitlabBuildVariable getBuildVariable(GitlabProject project, String key)
throws IOException {
return getBuildVariable(project.getId(), key);
} | [
"public",
"GitlabBuildVariable",
"getBuildVariable",
"(",
"GitlabProject",
"project",
",",
"String",
"key",
")",
"throws",
"IOException",
"{",
"return",
"getBuildVariable",
"(",
"project",
".",
"getId",
"(",
")",
",",
"key",
")",
";",
"}"
] | Gets build variable associated with a project and key.
@param project The project associated with the variable.
@return A variable.
@throws IOException on gitlab api call error | [
"Gets",
"build",
"variable",
"associated",
"with",
"a",
"project",
"and",
"key",
"."
] | train | https://github.com/timols/java-gitlab-api/blob/f03eedf952cfbb40306be3bf9234dcf78fab029e/src/main/java/org/gitlab/api/GitlabAPI.java#L3661-L3664 |
ironjacamar/ironjacamar | codegenerator/src/main/java/org/ironjacamar/codegenerator/code/CfCodeGen.java | CfCodeGen.writeConnection | private void writeConnection(Definition def, Writer out, int indent) throws IOException {
"""
Output Connection method
@param def definition
@param out Writer
@param indent space number
@throws IOException ioException
"""
writeWithIndent(out, indent, "/** \n");
writeWithIndent(out, indent, " * Get connection from factory\n");
writeWithIndent(out, indent, " *\n");
writeWithIndent(out, indent,
" * @return " + def.getMcfDefs().get(getNumOfMcf()).getConnInterfaceClass() + " instance\n");
writeWithIndent(out, indent, " * @exception ResourceException Thrown if a connection can't be obtained\n");
writeWithIndent(out, indent, " */\n");
writeWithIndent(out, indent, "@Override\n");
writeWithIndent(out, indent, "public " + def.getMcfDefs().get(getNumOfMcf()).getConnInterfaceClass() +
" getConnection() throws ResourceException");
writeLeftCurlyBracket(out, indent);
writeLogging(def, out, indent + 1, "trace", "getConnection");
writeWithIndent(out, indent + 1, "return (" + def.getMcfDefs().get(getNumOfMcf()).getConnInterfaceClass() +
")connectionManager.allocateConnection(mcf, null);");
writeRightCurlyBracket(out, indent);
writeEol(out);
} | java | private void writeConnection(Definition def, Writer out, int indent) throws IOException
{
writeWithIndent(out, indent, "/** \n");
writeWithIndent(out, indent, " * Get connection from factory\n");
writeWithIndent(out, indent, " *\n");
writeWithIndent(out, indent,
" * @return " + def.getMcfDefs().get(getNumOfMcf()).getConnInterfaceClass() + " instance\n");
writeWithIndent(out, indent, " * @exception ResourceException Thrown if a connection can't be obtained\n");
writeWithIndent(out, indent, " */\n");
writeWithIndent(out, indent, "@Override\n");
writeWithIndent(out, indent, "public " + def.getMcfDefs().get(getNumOfMcf()).getConnInterfaceClass() +
" getConnection() throws ResourceException");
writeLeftCurlyBracket(out, indent);
writeLogging(def, out, indent + 1, "trace", "getConnection");
writeWithIndent(out, indent + 1, "return (" + def.getMcfDefs().get(getNumOfMcf()).getConnInterfaceClass() +
")connectionManager.allocateConnection(mcf, null);");
writeRightCurlyBracket(out, indent);
writeEol(out);
} | [
"private",
"void",
"writeConnection",
"(",
"Definition",
"def",
",",
"Writer",
"out",
",",
"int",
"indent",
")",
"throws",
"IOException",
"{",
"writeWithIndent",
"(",
"out",
",",
"indent",
",",
"\"/** \\n\"",
")",
";",
"writeWithIndent",
"(",
"out",
",",
"indent",
",",
"\" * Get connection from factory\\n\"",
")",
";",
"writeWithIndent",
"(",
"out",
",",
"indent",
",",
"\" *\\n\"",
")",
";",
"writeWithIndent",
"(",
"out",
",",
"indent",
",",
"\" * @return \"",
"+",
"def",
".",
"getMcfDefs",
"(",
")",
".",
"get",
"(",
"getNumOfMcf",
"(",
")",
")",
".",
"getConnInterfaceClass",
"(",
")",
"+",
"\" instance\\n\"",
")",
";",
"writeWithIndent",
"(",
"out",
",",
"indent",
",",
"\" * @exception ResourceException Thrown if a connection can't be obtained\\n\"",
")",
";",
"writeWithIndent",
"(",
"out",
",",
"indent",
",",
"\" */\\n\"",
")",
";",
"writeWithIndent",
"(",
"out",
",",
"indent",
",",
"\"@Override\\n\"",
")",
";",
"writeWithIndent",
"(",
"out",
",",
"indent",
",",
"\"public \"",
"+",
"def",
".",
"getMcfDefs",
"(",
")",
".",
"get",
"(",
"getNumOfMcf",
"(",
")",
")",
".",
"getConnInterfaceClass",
"(",
")",
"+",
"\" getConnection() throws ResourceException\"",
")",
";",
"writeLeftCurlyBracket",
"(",
"out",
",",
"indent",
")",
";",
"writeLogging",
"(",
"def",
",",
"out",
",",
"indent",
"+",
"1",
",",
"\"trace\"",
",",
"\"getConnection\"",
")",
";",
"writeWithIndent",
"(",
"out",
",",
"indent",
"+",
"1",
",",
"\"return (\"",
"+",
"def",
".",
"getMcfDefs",
"(",
")",
".",
"get",
"(",
"getNumOfMcf",
"(",
")",
")",
".",
"getConnInterfaceClass",
"(",
")",
"+",
"\")connectionManager.allocateConnection(mcf, null);\"",
")",
";",
"writeRightCurlyBracket",
"(",
"out",
",",
"indent",
")",
";",
"writeEol",
"(",
"out",
")",
";",
"}"
] | Output Connection method
@param def definition
@param out Writer
@param indent space number
@throws IOException ioException | [
"Output",
"Connection",
"method"
] | train | https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/codegenerator/src/main/java/org/ironjacamar/codegenerator/code/CfCodeGen.java#L131-L151 |
infinispan/infinispan | core/src/main/java/org/infinispan/xsite/BackupReceiverRepositoryImpl.java | BackupReceiverRepositoryImpl.getBackupReceiver | @Override
public BackupReceiver getBackupReceiver(String remoteSite, String remoteCache) {
"""
Returns the local cache defined as backup for the provided remote (site, cache) combo, or throws an
exception if no such site is defined.
<p/>
Also starts the cache if not already started; that is because the cache is needed for update after this method
is invoked.
"""
SiteCachePair toLookFor = new SiteCachePair(remoteCache, remoteSite);
BackupReceiver backupManager = backupReceivers.get(toLookFor);
if (backupManager != null) return backupManager;
//check the default cache first
Configuration dcc = cacheManager.getDefaultCacheConfiguration();
if (dcc != null && isBackupForRemoteCache(remoteSite, remoteCache, dcc, EmbeddedCacheManager.DEFAULT_CACHE_NAME)) {
Cache<Object, Object> cache = cacheManager.getCache();
backupReceivers.putIfAbsent(toLookFor, createBackupReceiver(cache));
toLookFor.setLocalCacheName(EmbeddedCacheManager.DEFAULT_CACHE_NAME);
return backupReceivers.get(toLookFor);
}
Set<String> cacheNames = cacheManager.getCacheNames();
for (String name : cacheNames) {
Configuration cacheConfiguration = cacheManager.getCacheConfiguration(name);
if (cacheConfiguration != null && isBackupForRemoteCache(remoteSite, remoteCache, cacheConfiguration, name)) {
Cache<Object, Object> cache = cacheManager.getCache(name);
toLookFor.setLocalCacheName(name);
backupReceivers.putIfAbsent(toLookFor, createBackupReceiver(cache));
return backupReceivers.get(toLookFor);
}
}
log.debugf("Did not find any backup explicitly configured backup cache for remote cache/site: %s/%s. Using %s",
remoteSite, remoteCache, remoteCache);
Cache<Object, Object> cache = cacheManager.getCache(remoteCache);
backupReceivers.putIfAbsent(toLookFor, createBackupReceiver(cache));
toLookFor.setLocalCacheName(cache.getName());
return backupReceivers.get(toLookFor);
} | java | @Override
public BackupReceiver getBackupReceiver(String remoteSite, String remoteCache) {
SiteCachePair toLookFor = new SiteCachePair(remoteCache, remoteSite);
BackupReceiver backupManager = backupReceivers.get(toLookFor);
if (backupManager != null) return backupManager;
//check the default cache first
Configuration dcc = cacheManager.getDefaultCacheConfiguration();
if (dcc != null && isBackupForRemoteCache(remoteSite, remoteCache, dcc, EmbeddedCacheManager.DEFAULT_CACHE_NAME)) {
Cache<Object, Object> cache = cacheManager.getCache();
backupReceivers.putIfAbsent(toLookFor, createBackupReceiver(cache));
toLookFor.setLocalCacheName(EmbeddedCacheManager.DEFAULT_CACHE_NAME);
return backupReceivers.get(toLookFor);
}
Set<String> cacheNames = cacheManager.getCacheNames();
for (String name : cacheNames) {
Configuration cacheConfiguration = cacheManager.getCacheConfiguration(name);
if (cacheConfiguration != null && isBackupForRemoteCache(remoteSite, remoteCache, cacheConfiguration, name)) {
Cache<Object, Object> cache = cacheManager.getCache(name);
toLookFor.setLocalCacheName(name);
backupReceivers.putIfAbsent(toLookFor, createBackupReceiver(cache));
return backupReceivers.get(toLookFor);
}
}
log.debugf("Did not find any backup explicitly configured backup cache for remote cache/site: %s/%s. Using %s",
remoteSite, remoteCache, remoteCache);
Cache<Object, Object> cache = cacheManager.getCache(remoteCache);
backupReceivers.putIfAbsent(toLookFor, createBackupReceiver(cache));
toLookFor.setLocalCacheName(cache.getName());
return backupReceivers.get(toLookFor);
} | [
"@",
"Override",
"public",
"BackupReceiver",
"getBackupReceiver",
"(",
"String",
"remoteSite",
",",
"String",
"remoteCache",
")",
"{",
"SiteCachePair",
"toLookFor",
"=",
"new",
"SiteCachePair",
"(",
"remoteCache",
",",
"remoteSite",
")",
";",
"BackupReceiver",
"backupManager",
"=",
"backupReceivers",
".",
"get",
"(",
"toLookFor",
")",
";",
"if",
"(",
"backupManager",
"!=",
"null",
")",
"return",
"backupManager",
";",
"//check the default cache first",
"Configuration",
"dcc",
"=",
"cacheManager",
".",
"getDefaultCacheConfiguration",
"(",
")",
";",
"if",
"(",
"dcc",
"!=",
"null",
"&&",
"isBackupForRemoteCache",
"(",
"remoteSite",
",",
"remoteCache",
",",
"dcc",
",",
"EmbeddedCacheManager",
".",
"DEFAULT_CACHE_NAME",
")",
")",
"{",
"Cache",
"<",
"Object",
",",
"Object",
">",
"cache",
"=",
"cacheManager",
".",
"getCache",
"(",
")",
";",
"backupReceivers",
".",
"putIfAbsent",
"(",
"toLookFor",
",",
"createBackupReceiver",
"(",
"cache",
")",
")",
";",
"toLookFor",
".",
"setLocalCacheName",
"(",
"EmbeddedCacheManager",
".",
"DEFAULT_CACHE_NAME",
")",
";",
"return",
"backupReceivers",
".",
"get",
"(",
"toLookFor",
")",
";",
"}",
"Set",
"<",
"String",
">",
"cacheNames",
"=",
"cacheManager",
".",
"getCacheNames",
"(",
")",
";",
"for",
"(",
"String",
"name",
":",
"cacheNames",
")",
"{",
"Configuration",
"cacheConfiguration",
"=",
"cacheManager",
".",
"getCacheConfiguration",
"(",
"name",
")",
";",
"if",
"(",
"cacheConfiguration",
"!=",
"null",
"&&",
"isBackupForRemoteCache",
"(",
"remoteSite",
",",
"remoteCache",
",",
"cacheConfiguration",
",",
"name",
")",
")",
"{",
"Cache",
"<",
"Object",
",",
"Object",
">",
"cache",
"=",
"cacheManager",
".",
"getCache",
"(",
"name",
")",
";",
"toLookFor",
".",
"setLocalCacheName",
"(",
"name",
")",
";",
"backupReceivers",
".",
"putIfAbsent",
"(",
"toLookFor",
",",
"createBackupReceiver",
"(",
"cache",
")",
")",
";",
"return",
"backupReceivers",
".",
"get",
"(",
"toLookFor",
")",
";",
"}",
"}",
"log",
".",
"debugf",
"(",
"\"Did not find any backup explicitly configured backup cache for remote cache/site: %s/%s. Using %s\"",
",",
"remoteSite",
",",
"remoteCache",
",",
"remoteCache",
")",
";",
"Cache",
"<",
"Object",
",",
"Object",
">",
"cache",
"=",
"cacheManager",
".",
"getCache",
"(",
"remoteCache",
")",
";",
"backupReceivers",
".",
"putIfAbsent",
"(",
"toLookFor",
",",
"createBackupReceiver",
"(",
"cache",
")",
")",
";",
"toLookFor",
".",
"setLocalCacheName",
"(",
"cache",
".",
"getName",
"(",
")",
")",
";",
"return",
"backupReceivers",
".",
"get",
"(",
"toLookFor",
")",
";",
"}"
] | Returns the local cache defined as backup for the provided remote (site, cache) combo, or throws an
exception if no such site is defined.
<p/>
Also starts the cache if not already started; that is because the cache is needed for update after this method
is invoked. | [
"Returns",
"the",
"local",
"cache",
"defined",
"as",
"backup",
"for",
"the",
"provided",
"remote",
"(",
"site",
"cache",
")",
"combo",
"or",
"throws",
"an",
"exception",
"if",
"no",
"such",
"site",
"is",
"defined",
".",
"<p",
"/",
">",
"Also",
"starts",
"the",
"cache",
"if",
"not",
"already",
"started",
";",
"that",
"is",
"because",
"the",
"cache",
"is",
"needed",
"for",
"update",
"after",
"this",
"method",
"is",
"invoked",
"."
] | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/xsite/BackupReceiverRepositoryImpl.java#L63-L95 |
javalite/activejdbc | activejdbc/src/main/java/org/javalite/activejdbc/Model.java | Model.getAll | public <C extends Model> LazyList<C> getAll(Class<C> clazz) {
"""
This methods supports one to many, many to many relationships as well as polymorphic associations.
<p></p>
In case of one to many, the <code>clazz</code> must be a class of a child model, and it will return a
collection of all children.
<p></p>
In case of many to many, the <code>clazz</code> must be a class of a another related model, and it will return a
collection of all related models.
<p></p>
In case of polymorphic, the <code>clazz</code> must be a class of a polymorphically related model, and it will return a
collection of all related models.
@param clazz class of a child model for one to many, or class of another model, in case of many to many or class of child in case of
polymorphic
@return list of children in case of one to many, or list of other models, in case many to many.
"""
List<Model> children = cachedChildren.get(clazz);
if(children != null){
return (LazyList<C>) children;
}
// String tableName = Registry.instance().getTableName(clazz);
// if(tableName == null) throw new IllegalArgumentException("table: " + tableName + " does not exist for model: " + clazz);
return get(clazz, null);
} | java | public <C extends Model> LazyList<C> getAll(Class<C> clazz) {
List<Model> children = cachedChildren.get(clazz);
if(children != null){
return (LazyList<C>) children;
}
// String tableName = Registry.instance().getTableName(clazz);
// if(tableName == null) throw new IllegalArgumentException("table: " + tableName + " does not exist for model: " + clazz);
return get(clazz, null);
} | [
"public",
"<",
"C",
"extends",
"Model",
">",
"LazyList",
"<",
"C",
">",
"getAll",
"(",
"Class",
"<",
"C",
">",
"clazz",
")",
"{",
"List",
"<",
"Model",
">",
"children",
"=",
"cachedChildren",
".",
"get",
"(",
"clazz",
")",
";",
"if",
"(",
"children",
"!=",
"null",
")",
"{",
"return",
"(",
"LazyList",
"<",
"C",
">",
")",
"children",
";",
"}",
"// String tableName = Registry.instance().getTableName(clazz);",
"// if(tableName == null) throw new IllegalArgumentException(\"table: \" + tableName + \" does not exist for model: \" + clazz);",
"return",
"get",
"(",
"clazz",
",",
"null",
")",
";",
"}"
] | This methods supports one to many, many to many relationships as well as polymorphic associations.
<p></p>
In case of one to many, the <code>clazz</code> must be a class of a child model, and it will return a
collection of all children.
<p></p>
In case of many to many, the <code>clazz</code> must be a class of a another related model, and it will return a
collection of all related models.
<p></p>
In case of polymorphic, the <code>clazz</code> must be a class of a polymorphically related model, and it will return a
collection of all related models.
@param clazz class of a child model for one to many, or class of another model, in case of many to many or class of child in case of
polymorphic
@return list of children in case of one to many, or list of other models, in case many to many. | [
"This",
"methods",
"supports",
"one",
"to",
"many",
"many",
"to",
"many",
"relationships",
"as",
"well",
"as",
"polymorphic",
"associations",
".",
"<p",
">",
"<",
"/",
"p",
">",
"In",
"case",
"of",
"one",
"to",
"many",
"the",
"<code",
">",
"clazz<",
"/",
"code",
">",
"must",
"be",
"a",
"class",
"of",
"a",
"child",
"model",
"and",
"it",
"will",
"return",
"a",
"collection",
"of",
"all",
"children",
".",
"<p",
">",
"<",
"/",
"p",
">",
"In",
"case",
"of",
"many",
"to",
"many",
"the",
"<code",
">",
"clazz<",
"/",
"code",
">",
"must",
"be",
"a",
"class",
"of",
"a",
"another",
"related",
"model",
"and",
"it",
"will",
"return",
"a",
"collection",
"of",
"all",
"related",
"models",
".",
"<p",
">",
"<",
"/",
"p",
">",
"In",
"case",
"of",
"polymorphic",
"the",
"<code",
">",
"clazz<",
"/",
"code",
">",
"must",
"be",
"a",
"class",
"of",
"a",
"polymorphically",
"related",
"model",
"and",
"it",
"will",
"return",
"a",
"collection",
"of",
"all",
"related",
"models",
"."
] | train | https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/activejdbc/src/main/java/org/javalite/activejdbc/Model.java#L1872-L1882 |
BioPAX/Paxtools | pattern/src/main/java/org/biopax/paxtools/pattern/PatternBox.java | PatternBox.bindsTo | public static Pattern bindsTo() {
"""
Finds two Protein that appear together in a Complex.
@return the pattern
"""
Pattern p = new Pattern(ProteinReference.class, "first PR");
p.add(erToPE(), "first PR", "first simple PE");
p.add(linkToComplex(), "first simple PE", "Complex");
p.add(new Type(Complex.class), "Complex");
p.add(linkToSpecific(), "Complex", "second simple PE");
p.add(peToER(), "second simple PE", "second PR");
p.add(equal(false), "first PR", "second PR");
return p;
} | java | public static Pattern bindsTo()
{
Pattern p = new Pattern(ProteinReference.class, "first PR");
p.add(erToPE(), "first PR", "first simple PE");
p.add(linkToComplex(), "first simple PE", "Complex");
p.add(new Type(Complex.class), "Complex");
p.add(linkToSpecific(), "Complex", "second simple PE");
p.add(peToER(), "second simple PE", "second PR");
p.add(equal(false), "first PR", "second PR");
return p;
} | [
"public",
"static",
"Pattern",
"bindsTo",
"(",
")",
"{",
"Pattern",
"p",
"=",
"new",
"Pattern",
"(",
"ProteinReference",
".",
"class",
",",
"\"first PR\"",
")",
";",
"p",
".",
"add",
"(",
"erToPE",
"(",
")",
",",
"\"first PR\"",
",",
"\"first simple PE\"",
")",
";",
"p",
".",
"add",
"(",
"linkToComplex",
"(",
")",
",",
"\"first simple PE\"",
",",
"\"Complex\"",
")",
";",
"p",
".",
"add",
"(",
"new",
"Type",
"(",
"Complex",
".",
"class",
")",
",",
"\"Complex\"",
")",
";",
"p",
".",
"add",
"(",
"linkToSpecific",
"(",
")",
",",
"\"Complex\"",
",",
"\"second simple PE\"",
")",
";",
"p",
".",
"add",
"(",
"peToER",
"(",
")",
",",
"\"second simple PE\"",
",",
"\"second PR\"",
")",
";",
"p",
".",
"add",
"(",
"equal",
"(",
"false",
")",
",",
"\"first PR\"",
",",
"\"second PR\"",
")",
";",
"return",
"p",
";",
"}"
] | Finds two Protein that appear together in a Complex.
@return the pattern | [
"Finds",
"two",
"Protein",
"that",
"appear",
"together",
"in",
"a",
"Complex",
"."
] | train | https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/PatternBox.java#L861-L871 |
phax/ph-commons | ph-xml/src/main/java/com/helger/xml/serialize/write/XMLEmitter.java | XMLEmitter.onText | public void onText (@Nonnull final char [] aText,
@Nonnegative final int nOfs,
@Nonnegative final int nLen,
final boolean bEscape) {
"""
Text node.
@param aText
The contained text array
@param nOfs
Offset into the array where to start
@param nLen
Number of chars to use, starting from the provided offset.
@param bEscape
If <code>true</code> the text should be XML masked (the default),
<code>false</code> if not. The <code>false</code> case is especially
interesting for HTML inline JS and CSS code.
"""
if (bEscape)
_appendMasked (EXMLCharMode.TEXT, aText, nOfs, nLen);
else
_append (aText, nOfs, nLen);
} | java | public void onText (@Nonnull final char [] aText,
@Nonnegative final int nOfs,
@Nonnegative final int nLen,
final boolean bEscape)
{
if (bEscape)
_appendMasked (EXMLCharMode.TEXT, aText, nOfs, nLen);
else
_append (aText, nOfs, nLen);
} | [
"public",
"void",
"onText",
"(",
"@",
"Nonnull",
"final",
"char",
"[",
"]",
"aText",
",",
"@",
"Nonnegative",
"final",
"int",
"nOfs",
",",
"@",
"Nonnegative",
"final",
"int",
"nLen",
",",
"final",
"boolean",
"bEscape",
")",
"{",
"if",
"(",
"bEscape",
")",
"_appendMasked",
"(",
"EXMLCharMode",
".",
"TEXT",
",",
"aText",
",",
"nOfs",
",",
"nLen",
")",
";",
"else",
"_append",
"(",
"aText",
",",
"nOfs",
",",
"nLen",
")",
";",
"}"
] | Text node.
@param aText
The contained text array
@param nOfs
Offset into the array where to start
@param nLen
Number of chars to use, starting from the provided offset.
@param bEscape
If <code>true</code> the text should be XML masked (the default),
<code>false</code> if not. The <code>false</code> case is especially
interesting for HTML inline JS and CSS code. | [
"Text",
"node",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-xml/src/main/java/com/helger/xml/serialize/write/XMLEmitter.java#L500-L509 |
apiman/apiman | manager/api/es/src/main/java/io/apiman/manager/api/es/EsMarshalling.java | EsMarshalling.unmarshallRoleMembership | public static RoleMembershipBean unmarshallRoleMembership(Map<String, Object> source) {
"""
Unmarshals the given map source into a bean.
@param source the source
@return the role membership
"""
if (source == null) {
return null;
}
RoleMembershipBean bean = new RoleMembershipBean();
bean.setId(asLong(source.get("id")));
bean.setOrganizationId(asString(source.get("organizationId")));
bean.setRoleId(asString(source.get("roleId")));
bean.setUserId(asString(source.get("userId")));
bean.setCreatedOn(asDate(source.get("createdOn")));
postMarshall(bean);
return bean;
} | java | public static RoleMembershipBean unmarshallRoleMembership(Map<String, Object> source) {
if (source == null) {
return null;
}
RoleMembershipBean bean = new RoleMembershipBean();
bean.setId(asLong(source.get("id")));
bean.setOrganizationId(asString(source.get("organizationId")));
bean.setRoleId(asString(source.get("roleId")));
bean.setUserId(asString(source.get("userId")));
bean.setCreatedOn(asDate(source.get("createdOn")));
postMarshall(bean);
return bean;
} | [
"public",
"static",
"RoleMembershipBean",
"unmarshallRoleMembership",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"source",
")",
"{",
"if",
"(",
"source",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"RoleMembershipBean",
"bean",
"=",
"new",
"RoleMembershipBean",
"(",
")",
";",
"bean",
".",
"setId",
"(",
"asLong",
"(",
"source",
".",
"get",
"(",
"\"id\"",
")",
")",
")",
";",
"bean",
".",
"setOrganizationId",
"(",
"asString",
"(",
"source",
".",
"get",
"(",
"\"organizationId\"",
")",
")",
")",
";",
"bean",
".",
"setRoleId",
"(",
"asString",
"(",
"source",
".",
"get",
"(",
"\"roleId\"",
")",
")",
")",
";",
"bean",
".",
"setUserId",
"(",
"asString",
"(",
"source",
".",
"get",
"(",
"\"userId\"",
")",
")",
")",
";",
"bean",
".",
"setCreatedOn",
"(",
"asDate",
"(",
"source",
".",
"get",
"(",
"\"createdOn\"",
")",
")",
")",
";",
"postMarshall",
"(",
"bean",
")",
";",
"return",
"bean",
";",
"}"
] | Unmarshals the given map source into a bean.
@param source the source
@return the role membership | [
"Unmarshals",
"the",
"given",
"map",
"source",
"into",
"a",
"bean",
"."
] | train | https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/manager/api/es/src/main/java/io/apiman/manager/api/es/EsMarshalling.java#L1190-L1202 |
SonarSource/sonarqube | sonar-plugin-api/src/main/java/org/sonar/api/config/Settings.java | Settings.getStringArray | public String[] getStringArray(String key) {
"""
Value is split by comma and trimmed. Never returns null.
<br>
Examples :
<ul>
<li>"one,two,three " -> ["one", "two", "three"]</li>
<li>" one, two, three " -> ["one", "two", "three"]</li>
<li>"one, , three" -> ["one", "", "three"]</li>
</ul>
"""
String effectiveKey = definitions.validKey(key);
Optional<PropertyDefinition> def = getDefinition(effectiveKey);
if ((def.isPresent()) && (def.get().multiValues())) {
String value = getString(key);
if (value == null) {
return ArrayUtils.EMPTY_STRING_ARRAY;
}
List<String> values = new ArrayList<>();
for (String v : Splitter.on(",").trimResults().split(value)) {
values.add(v.replace("%2C", ","));
}
return values.toArray(new String[values.size()]);
}
return getStringArrayBySeparator(key, ",");
} | java | public String[] getStringArray(String key) {
String effectiveKey = definitions.validKey(key);
Optional<PropertyDefinition> def = getDefinition(effectiveKey);
if ((def.isPresent()) && (def.get().multiValues())) {
String value = getString(key);
if (value == null) {
return ArrayUtils.EMPTY_STRING_ARRAY;
}
List<String> values = new ArrayList<>();
for (String v : Splitter.on(",").trimResults().split(value)) {
values.add(v.replace("%2C", ","));
}
return values.toArray(new String[values.size()]);
}
return getStringArrayBySeparator(key, ",");
} | [
"public",
"String",
"[",
"]",
"getStringArray",
"(",
"String",
"key",
")",
"{",
"String",
"effectiveKey",
"=",
"definitions",
".",
"validKey",
"(",
"key",
")",
";",
"Optional",
"<",
"PropertyDefinition",
">",
"def",
"=",
"getDefinition",
"(",
"effectiveKey",
")",
";",
"if",
"(",
"(",
"def",
".",
"isPresent",
"(",
")",
")",
"&&",
"(",
"def",
".",
"get",
"(",
")",
".",
"multiValues",
"(",
")",
")",
")",
"{",
"String",
"value",
"=",
"getString",
"(",
"key",
")",
";",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"return",
"ArrayUtils",
".",
"EMPTY_STRING_ARRAY",
";",
"}",
"List",
"<",
"String",
">",
"values",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"String",
"v",
":",
"Splitter",
".",
"on",
"(",
"\",\"",
")",
".",
"trimResults",
"(",
")",
".",
"split",
"(",
"value",
")",
")",
"{",
"values",
".",
"add",
"(",
"v",
".",
"replace",
"(",
"\"%2C\"",
",",
"\",\"",
")",
")",
";",
"}",
"return",
"values",
".",
"toArray",
"(",
"new",
"String",
"[",
"values",
".",
"size",
"(",
")",
"]",
")",
";",
"}",
"return",
"getStringArrayBySeparator",
"(",
"key",
",",
"\",\"",
")",
";",
"}"
] | Value is split by comma and trimmed. Never returns null.
<br>
Examples :
<ul>
<li>"one,two,three " -> ["one", "two", "three"]</li>
<li>" one, two, three " -> ["one", "two", "three"]</li>
<li>"one, , three" -> ["one", "", "three"]</li>
</ul> | [
"Value",
"is",
"split",
"by",
"comma",
"and",
"trimmed",
".",
"Never",
"returns",
"null",
".",
"<br",
">",
"Examples",
":",
"<ul",
">",
"<li",
">",
"one",
"two",
"three",
"-",
">",
";",
"[",
"one",
"two",
"three",
"]",
"<",
"/",
"li",
">",
"<li",
">",
"one",
"two",
"three",
"-",
">",
";",
"[",
"one",
"two",
"three",
"]",
"<",
"/",
"li",
">",
"<li",
">",
"one",
"three",
"-",
">",
";",
"[",
"one",
"three",
"]",
"<",
"/",
"li",
">",
"<",
"/",
"ul",
">"
] | train | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-plugin-api/src/main/java/org/sonar/api/config/Settings.java#L272-L289 |
JavaMoney/jsr354-api | src/main/java/javax/money/format/MonetaryFormats.java | MonetaryFormats.getAmountFormat | public static MonetaryAmountFormat getAmountFormat(Locale locale, String... providers) {
"""
Access the default {@link MonetaryAmountFormat} given a {@link Locale}.
@param locale the target {@link Locale}, not {@code null}.
@param providers The providers to be queried, if not set the providers as defined by #getDefaultCurrencyProviderChain()
are queried.
@return the matching {@link MonetaryAmountFormat}
@throws MonetaryException if no registered {@link MonetaryAmountFormatProviderSpi} can provide a
corresponding {@link MonetaryAmountFormat} instance.
"""
return getAmountFormat(AmountFormatQueryBuilder.of(locale).setProviderNames(providers).setLocale(locale).build());
} | java | public static MonetaryAmountFormat getAmountFormat(Locale locale, String... providers) {
return getAmountFormat(AmountFormatQueryBuilder.of(locale).setProviderNames(providers).setLocale(locale).build());
} | [
"public",
"static",
"MonetaryAmountFormat",
"getAmountFormat",
"(",
"Locale",
"locale",
",",
"String",
"...",
"providers",
")",
"{",
"return",
"getAmountFormat",
"(",
"AmountFormatQueryBuilder",
".",
"of",
"(",
"locale",
")",
".",
"setProviderNames",
"(",
"providers",
")",
".",
"setLocale",
"(",
"locale",
")",
".",
"build",
"(",
")",
")",
";",
"}"
] | Access the default {@link MonetaryAmountFormat} given a {@link Locale}.
@param locale the target {@link Locale}, not {@code null}.
@param providers The providers to be queried, if not set the providers as defined by #getDefaultCurrencyProviderChain()
are queried.
@return the matching {@link MonetaryAmountFormat}
@throws MonetaryException if no registered {@link MonetaryAmountFormatProviderSpi} can provide a
corresponding {@link MonetaryAmountFormat} instance. | [
"Access",
"the",
"default",
"{",
"@link",
"MonetaryAmountFormat",
"}",
"given",
"a",
"{",
"@link",
"Locale",
"}",
"."
] | train | https://github.com/JavaMoney/jsr354-api/blob/49a7ae436eaf45cac1040879185531ef22de5525/src/main/java/javax/money/format/MonetaryFormats.java#L89-L91 |
flow/commons | src/main/java/com/flowpowered/commons/map/impl/TTripleInt21ObjectHashMap.java | TTripleInt21ObjectHashMap.put | @Override
public T put(int x, int y, int z, T value) {
"""
Associates the specified value with the specified key in this map (optional operation). If the map previously contained a mapping for the key, the old value is replaced by the specified value.
(A map m is said to contain a mapping for a key k if and only if {@see #containsKey(int, int, int) m.containsKey(k)} would return <code>true</code>.)
@param x an <code>int</code> value
@param y an <code>int</code> value
@param z an <code>int</code> value
@return the previous value associated with <code>key(x, y, z)</code>, or no_entry_value if there was no mapping for <code>key(x, y, z)</code>. (A no_entry_value return can also indicate that
the map previously associated <code>null</code> with key, if the implementation supports <code>null</code> values.)
"""
long key = Int21TripleHashed.key(x, y, z);
return map.put(key, value);
} | java | @Override
public T put(int x, int y, int z, T value) {
long key = Int21TripleHashed.key(x, y, z);
return map.put(key, value);
} | [
"@",
"Override",
"public",
"T",
"put",
"(",
"int",
"x",
",",
"int",
"y",
",",
"int",
"z",
",",
"T",
"value",
")",
"{",
"long",
"key",
"=",
"Int21TripleHashed",
".",
"key",
"(",
"x",
",",
"y",
",",
"z",
")",
";",
"return",
"map",
".",
"put",
"(",
"key",
",",
"value",
")",
";",
"}"
] | Associates the specified value with the specified key in this map (optional operation). If the map previously contained a mapping for the key, the old value is replaced by the specified value.
(A map m is said to contain a mapping for a key k if and only if {@see #containsKey(int, int, int) m.containsKey(k)} would return <code>true</code>.)
@param x an <code>int</code> value
@param y an <code>int</code> value
@param z an <code>int</code> value
@return the previous value associated with <code>key(x, y, z)</code>, or no_entry_value if there was no mapping for <code>key(x, y, z)</code>. (A no_entry_value return can also indicate that
the map previously associated <code>null</code> with key, if the implementation supports <code>null</code> values.) | [
"Associates",
"the",
"specified",
"value",
"with",
"the",
"specified",
"key",
"in",
"this",
"map",
"(",
"optional",
"operation",
")",
".",
"If",
"the",
"map",
"previously",
"contained",
"a",
"mapping",
"for",
"the",
"key",
"the",
"old",
"value",
"is",
"replaced",
"by",
"the",
"specified",
"value",
".",
"(",
"A",
"map",
"m",
"is",
"said",
"to",
"contain",
"a",
"mapping",
"for",
"a",
"key",
"k",
"if",
"and",
"only",
"if",
"{",
"@see",
"#containsKey",
"(",
"int",
"int",
"int",
")",
"m",
".",
"containsKey",
"(",
"k",
")",
"}",
"would",
"return",
"<code",
">",
"true<",
"/",
"code",
">",
".",
")"
] | train | https://github.com/flow/commons/blob/0690efdac06fd728fcd7e9cf10f2b1319379c45b/src/main/java/com/flowpowered/commons/map/impl/TTripleInt21ObjectHashMap.java#L82-L86 |
BlueBrain/bluima | utils/blue_commons/src/main/java/ch/epfl/bbp/ResourceHelper.java | ResourceHelper.getFile | public static File getFile(String resourceOrFile)
throws FileNotFoundException {
"""
Use getInputStream instead, because Files are trouble, when in (maven)
JARs
"""
try {
File file = new File(resourceOrFile);
if (file.exists()) {
return file;
}
} catch (Exception e) {// nope
}
return getFile(resourceOrFile, Thread.class, false);
} | java | public static File getFile(String resourceOrFile)
throws FileNotFoundException {
try {
File file = new File(resourceOrFile);
if (file.exists()) {
return file;
}
} catch (Exception e) {// nope
}
return getFile(resourceOrFile, Thread.class, false);
} | [
"public",
"static",
"File",
"getFile",
"(",
"String",
"resourceOrFile",
")",
"throws",
"FileNotFoundException",
"{",
"try",
"{",
"File",
"file",
"=",
"new",
"File",
"(",
"resourceOrFile",
")",
";",
"if",
"(",
"file",
".",
"exists",
"(",
")",
")",
"{",
"return",
"file",
";",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"// nope",
"}",
"return",
"getFile",
"(",
"resourceOrFile",
",",
"Thread",
".",
"class",
",",
"false",
")",
";",
"}"
] | Use getInputStream instead, because Files are trouble, when in (maven)
JARs | [
"Use",
"getInputStream",
"instead",
"because",
"Files",
"are",
"trouble",
"when",
"in",
"(",
"maven",
")",
"JARs"
] | train | https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/utils/blue_commons/src/main/java/ch/epfl/bbp/ResourceHelper.java#L31-L43 |
networknt/json-schema-validator | src/main/java/com/networknt/schema/url/URLFactory.java | URLFactory.toURL | public static URL toURL(final String pURL) throws MalformedURLException {
"""
Creates an {@link URL} based on the provided string
@param pURL the url
@return a {@link URL}
@throws MalformedURLException if the url is not a proper URL
"""
return new URL(null, pURL, sClasspathURLStreamHandler.supports(pURL) ? sClasspathURLStreamHandler : null);
} | java | public static URL toURL(final String pURL) throws MalformedURLException {
return new URL(null, pURL, sClasspathURLStreamHandler.supports(pURL) ? sClasspathURLStreamHandler : null);
} | [
"public",
"static",
"URL",
"toURL",
"(",
"final",
"String",
"pURL",
")",
"throws",
"MalformedURLException",
"{",
"return",
"new",
"URL",
"(",
"null",
",",
"pURL",
",",
"sClasspathURLStreamHandler",
".",
"supports",
"(",
"pURL",
")",
"?",
"sClasspathURLStreamHandler",
":",
"null",
")",
";",
"}"
] | Creates an {@link URL} based on the provided string
@param pURL the url
@return a {@link URL}
@throws MalformedURLException if the url is not a proper URL | [
"Creates",
"an",
"{"
] | train | https://github.com/networknt/json-schema-validator/blob/d2a3a8d2085e72eb5c25c2fd8c8c9e641a62376d/src/main/java/com/networknt/schema/url/URLFactory.java#L41-L43 |
OpenLiberty/open-liberty | dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheProviderWrapper.java | CacheProviderWrapper.addToTimeLimitDaemon | @Override
public void addToTimeLimitDaemon(Object id, long expirationTime, int inactivity) {
"""
This method is used only by default cache provider (cache.java). Do nothing.
"""
final String methodName = "addToTimeLimitDaemon()";
if (tc.isDebugEnabled()) {
Tr.debug(tc, methodName + " cacheName=" + cacheName + " ERROR because it should not be called");
}
} | java | @Override
public void addToTimeLimitDaemon(Object id, long expirationTime, int inactivity) {
final String methodName = "addToTimeLimitDaemon()";
if (tc.isDebugEnabled()) {
Tr.debug(tc, methodName + " cacheName=" + cacheName + " ERROR because it should not be called");
}
} | [
"@",
"Override",
"public",
"void",
"addToTimeLimitDaemon",
"(",
"Object",
"id",
",",
"long",
"expirationTime",
",",
"int",
"inactivity",
")",
"{",
"final",
"String",
"methodName",
"=",
"\"addToTimeLimitDaemon()\"",
";",
"if",
"(",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"methodName",
"+",
"\" cacheName=\"",
"+",
"cacheName",
"+",
"\" ERROR because it should not be called\"",
")",
";",
"}",
"}"
] | This method is used only by default cache provider (cache.java). Do nothing. | [
"This",
"method",
"is",
"used",
"only",
"by",
"default",
"cache",
"provider",
"(",
"cache",
".",
"java",
")",
".",
"Do",
"nothing",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheProviderWrapper.java#L1528-L1534 |
amzn/ion-java | src/com/amazon/ion/impl/bin/WriteBuffer.java | WriteBuffer.writeTo | public void writeTo(final OutputStream out, long position, long length) throws IOException {
"""
Write a specific segment of data from the buffer to a stream.
"""
while (length > 0)
{
final int index = index(position);
final int offset = offset(position);
final Block block = blocks.get(index);
final int amount = (int) Math.min(block.data.length - offset, length);
out.write(block.data, offset, amount);
position += amount;
length -= amount;
}
} | java | public void writeTo(final OutputStream out, long position, long length) throws IOException
{
while (length > 0)
{
final int index = index(position);
final int offset = offset(position);
final Block block = blocks.get(index);
final int amount = (int) Math.min(block.data.length - offset, length);
out.write(block.data, offset, amount);
position += amount;
length -= amount;
}
} | [
"public",
"void",
"writeTo",
"(",
"final",
"OutputStream",
"out",
",",
"long",
"position",
",",
"long",
"length",
")",
"throws",
"IOException",
"{",
"while",
"(",
"length",
">",
"0",
")",
"{",
"final",
"int",
"index",
"=",
"index",
"(",
"position",
")",
";",
"final",
"int",
"offset",
"=",
"offset",
"(",
"position",
")",
";",
"final",
"Block",
"block",
"=",
"blocks",
".",
"get",
"(",
"index",
")",
";",
"final",
"int",
"amount",
"=",
"(",
"int",
")",
"Math",
".",
"min",
"(",
"block",
".",
"data",
".",
"length",
"-",
"offset",
",",
"length",
")",
";",
"out",
".",
"write",
"(",
"block",
".",
"data",
",",
"offset",
",",
"amount",
")",
";",
"position",
"+=",
"amount",
";",
"length",
"-=",
"amount",
";",
"}",
"}"
] | Write a specific segment of data from the buffer to a stream. | [
"Write",
"a",
"specific",
"segment",
"of",
"data",
"from",
"the",
"buffer",
"to",
"a",
"stream",
"."
] | train | https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/impl/bin/WriteBuffer.java#L1083-L1096 |
matthewhorridge/owlapi-gwt | owlapi-gwt-serialization/src/main/java/org/semanticweb/owlapi/model/IRI_CustomFieldSerializer.java | IRI_CustomFieldSerializer.deserializeInstance | @Override
public void deserializeInstance(SerializationStreamReader streamReader, IRI instance) throws SerializationException {
"""
Deserializes the content of the object from the
{@link com.google.gwt.user.client.rpc.SerializationStreamReader}.
@param streamReader the {@link com.google.gwt.user.client.rpc.SerializationStreamReader} to read the
object's content from
@param instance the object instance to deserialize
@throws com.google.gwt.user.client.rpc.SerializationException
if the deserialization operation is not
successful
"""
deserialize(streamReader, instance);
} | java | @Override
public void deserializeInstance(SerializationStreamReader streamReader, IRI instance) throws SerializationException {
deserialize(streamReader, instance);
} | [
"@",
"Override",
"public",
"void",
"deserializeInstance",
"(",
"SerializationStreamReader",
"streamReader",
",",
"IRI",
"instance",
")",
"throws",
"SerializationException",
"{",
"deserialize",
"(",
"streamReader",
",",
"instance",
")",
";",
"}"
] | Deserializes the content of the object from the
{@link com.google.gwt.user.client.rpc.SerializationStreamReader}.
@param streamReader the {@link com.google.gwt.user.client.rpc.SerializationStreamReader} to read the
object's content from
@param instance the object instance to deserialize
@throws com.google.gwt.user.client.rpc.SerializationException
if the deserialization operation is not
successful | [
"Deserializes",
"the",
"content",
"of",
"the",
"object",
"from",
"the",
"{"
] | train | https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/org/semanticweb/owlapi/model/IRI_CustomFieldSerializer.java#L82-L85 |
lz4/lz4-java | src/java/net/jpountz/xxhash/StreamingXXHash64.java | StreamingXXHash64.asChecksum | public final Checksum asChecksum() {
"""
Returns a {@link Checksum} view of this instance. Modifications to the view
will modify this instance too and vice-versa.
@return the {@link Checksum} object representing this instance
"""
return new Checksum() {
@Override
public long getValue() {
return StreamingXXHash64.this.getValue();
}
@Override
public void reset() {
StreamingXXHash64.this.reset();
}
@Override
public void update(int b) {
StreamingXXHash64.this.update(new byte[] {(byte) b}, 0, 1);
}
@Override
public void update(byte[] b, int off, int len) {
StreamingXXHash64.this.update(b, off, len);
}
@Override
public String toString() {
return StreamingXXHash64.this.toString();
}
};
} | java | public final Checksum asChecksum() {
return new Checksum() {
@Override
public long getValue() {
return StreamingXXHash64.this.getValue();
}
@Override
public void reset() {
StreamingXXHash64.this.reset();
}
@Override
public void update(int b) {
StreamingXXHash64.this.update(new byte[] {(byte) b}, 0, 1);
}
@Override
public void update(byte[] b, int off, int len) {
StreamingXXHash64.this.update(b, off, len);
}
@Override
public String toString() {
return StreamingXXHash64.this.toString();
}
};
} | [
"public",
"final",
"Checksum",
"asChecksum",
"(",
")",
"{",
"return",
"new",
"Checksum",
"(",
")",
"{",
"@",
"Override",
"public",
"long",
"getValue",
"(",
")",
"{",
"return",
"StreamingXXHash64",
".",
"this",
".",
"getValue",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"reset",
"(",
")",
"{",
"StreamingXXHash64",
".",
"this",
".",
"reset",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"update",
"(",
"int",
"b",
")",
"{",
"StreamingXXHash64",
".",
"this",
".",
"update",
"(",
"new",
"byte",
"[",
"]",
"{",
"(",
"byte",
")",
"b",
"}",
",",
"0",
",",
"1",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"update",
"(",
"byte",
"[",
"]",
"b",
",",
"int",
"off",
",",
"int",
"len",
")",
"{",
"StreamingXXHash64",
".",
"this",
".",
"update",
"(",
"b",
",",
"off",
",",
"len",
")",
";",
"}",
"@",
"Override",
"public",
"String",
"toString",
"(",
")",
"{",
"return",
"StreamingXXHash64",
".",
"this",
".",
"toString",
"(",
")",
";",
"}",
"}",
";",
"}"
] | Returns a {@link Checksum} view of this instance. Modifications to the view
will modify this instance too and vice-versa.
@return the {@link Checksum} object representing this instance | [
"Returns",
"a",
"{",
"@link",
"Checksum",
"}",
"view",
"of",
"this",
"instance",
".",
"Modifications",
"to",
"the",
"view",
"will",
"modify",
"this",
"instance",
"too",
"and",
"vice",
"-",
"versa",
"."
] | train | https://github.com/lz4/lz4-java/blob/c5ae694a3aa8b33ef87fd0486727a7d1e8f71367/src/java/net/jpountz/xxhash/StreamingXXHash64.java#L88-L117 |
alkacon/opencms-core | src/org/opencms/db/CmsAliasManager.java | CmsAliasManager.checkPermissionsForMassEdit | private void checkPermissionsForMassEdit(CmsObject cms, String siteRoot) throws CmsException {
"""
Checks that the user has permissions for a mass edit operation in a given site.<p>
@param cms the current CMS context
@param siteRoot the site for which the permissions should be checked
@throws CmsException if something goes wrong
"""
String originalSiteRoot = cms.getRequestContext().getSiteRoot();
try {
cms.getRequestContext().setSiteRoot(siteRoot);
checkPermissionsForMassEdit(cms);
} finally {
cms.getRequestContext().setSiteRoot(originalSiteRoot);
}
} | java | private void checkPermissionsForMassEdit(CmsObject cms, String siteRoot) throws CmsException {
String originalSiteRoot = cms.getRequestContext().getSiteRoot();
try {
cms.getRequestContext().setSiteRoot(siteRoot);
checkPermissionsForMassEdit(cms);
} finally {
cms.getRequestContext().setSiteRoot(originalSiteRoot);
}
} | [
"private",
"void",
"checkPermissionsForMassEdit",
"(",
"CmsObject",
"cms",
",",
"String",
"siteRoot",
")",
"throws",
"CmsException",
"{",
"String",
"originalSiteRoot",
"=",
"cms",
".",
"getRequestContext",
"(",
")",
".",
"getSiteRoot",
"(",
")",
";",
"try",
"{",
"cms",
".",
"getRequestContext",
"(",
")",
".",
"setSiteRoot",
"(",
"siteRoot",
")",
";",
"checkPermissionsForMassEdit",
"(",
"cms",
")",
";",
"}",
"finally",
"{",
"cms",
".",
"getRequestContext",
"(",
")",
".",
"setSiteRoot",
"(",
"originalSiteRoot",
")",
";",
"}",
"}"
] | Checks that the user has permissions for a mass edit operation in a given site.<p>
@param cms the current CMS context
@param siteRoot the site for which the permissions should be checked
@throws CmsException if something goes wrong | [
"Checks",
"that",
"the",
"user",
"has",
"permissions",
"for",
"a",
"mass",
"edit",
"operation",
"in",
"a",
"given",
"site",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsAliasManager.java#L512-L521 |
palatable/lambda | src/main/java/com/jnape/palatable/lambda/adt/Either.java | Either.orThrow | public final <T extends Throwable> R orThrow(Function<? super L, ? extends T> throwableFn) throws T {
"""
Return the wrapped value if this is a right; otherwise, map the wrapped left value to a <code>T</code> and throw
it.
@param throwableFn a function from L to T
@param <T> the left parameter type (the throwable type)
@return the wrapped value if this is a right
@throws T the result of applying the wrapped left value to throwableFn, if this is a left
"""
return match((CheckedFn1<T, L, R>) l -> {
throw throwableFn.apply(l);
}, id());
} | java | public final <T extends Throwable> R orThrow(Function<? super L, ? extends T> throwableFn) throws T {
return match((CheckedFn1<T, L, R>) l -> {
throw throwableFn.apply(l);
}, id());
} | [
"public",
"final",
"<",
"T",
"extends",
"Throwable",
">",
"R",
"orThrow",
"(",
"Function",
"<",
"?",
"super",
"L",
",",
"?",
"extends",
"T",
">",
"throwableFn",
")",
"throws",
"T",
"{",
"return",
"match",
"(",
"(",
"CheckedFn1",
"<",
"T",
",",
"L",
",",
"R",
">",
")",
"l",
"->",
"{",
"throw",
"throwableFn",
".",
"apply",
"(",
"l",
")",
";",
"}",
",",
"id",
"(",
")",
")",
";",
"}"
] | Return the wrapped value if this is a right; otherwise, map the wrapped left value to a <code>T</code> and throw
it.
@param throwableFn a function from L to T
@param <T> the left parameter type (the throwable type)
@return the wrapped value if this is a right
@throws T the result of applying the wrapped left value to throwableFn, if this is a left | [
"Return",
"the",
"wrapped",
"value",
"if",
"this",
"is",
"a",
"right",
";",
"otherwise",
"map",
"the",
"wrapped",
"left",
"value",
"to",
"a",
"<code",
">",
"T<",
"/",
"code",
">",
"and",
"throw",
"it",
"."
] | train | https://github.com/palatable/lambda/blob/b643ba836c5916d1d8193822e5efb4e7b40c489a/src/main/java/com/jnape/palatable/lambda/adt/Either.java#L85-L89 |
jtrfp/javamod | src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v2Tag.java | ID3v2Tag.setURLFrame | public void setURLFrame(String id, String data) {
"""
Set the data contained in a URL frame. This includes all frames with
an id that starts with 'W' but excludes "WXXX". If an improper id is
passed, then nothing will happen.
@param id the id of the frame to set the data for
@param data the data for the frame
"""
if ((id.charAt(0) == 'W') && !id.equals(ID3v2Frames.USER_DEFINED_URL))
{
updateFrameData(id, data.getBytes());
}
} | java | public void setURLFrame(String id, String data)
{
if ((id.charAt(0) == 'W') && !id.equals(ID3v2Frames.USER_DEFINED_URL))
{
updateFrameData(id, data.getBytes());
}
} | [
"public",
"void",
"setURLFrame",
"(",
"String",
"id",
",",
"String",
"data",
")",
"{",
"if",
"(",
"(",
"id",
".",
"charAt",
"(",
"0",
")",
"==",
"'",
"'",
")",
"&&",
"!",
"id",
".",
"equals",
"(",
"ID3v2Frames",
".",
"USER_DEFINED_URL",
")",
")",
"{",
"updateFrameData",
"(",
"id",
",",
"data",
".",
"getBytes",
"(",
")",
")",
";",
"}",
"}"
] | Set the data contained in a URL frame. This includes all frames with
an id that starts with 'W' but excludes "WXXX". If an improper id is
passed, then nothing will happen.
@param id the id of the frame to set the data for
@param data the data for the frame | [
"Set",
"the",
"data",
"contained",
"in",
"a",
"URL",
"frame",
".",
"This",
"includes",
"all",
"frames",
"with",
"an",
"id",
"that",
"starts",
"with",
"W",
"but",
"excludes",
"WXXX",
".",
"If",
"an",
"improper",
"id",
"is",
"passed",
"then",
"nothing",
"will",
"happen",
"."
] | train | https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v2Tag.java#L327-L333 |
Whiley/WhileyCompiler | src/main/java/wyil/check/FlowTypeCheck.java | FlowTypeCheck.checkBreak | private Environment checkBreak(Stmt.Break stmt, Environment environment, EnclosingScope scope) {
"""
Type check a break statement. This requires propagating the current
environment to the block destination, to ensure that the actual types of all
variables at that point are precise.
@param stmt
Statement to type check
@param environment
Determines the type of all variables immediately going into this
block
@return
"""
// FIXME: need to check environment to the break destination
return FlowTypeUtils.BOTTOM;
} | java | private Environment checkBreak(Stmt.Break stmt, Environment environment, EnclosingScope scope) {
// FIXME: need to check environment to the break destination
return FlowTypeUtils.BOTTOM;
} | [
"private",
"Environment",
"checkBreak",
"(",
"Stmt",
".",
"Break",
"stmt",
",",
"Environment",
"environment",
",",
"EnclosingScope",
"scope",
")",
"{",
"// FIXME: need to check environment to the break destination",
"return",
"FlowTypeUtils",
".",
"BOTTOM",
";",
"}"
] | Type check a break statement. This requires propagating the current
environment to the block destination, to ensure that the actual types of all
variables at that point are precise.
@param stmt
Statement to type check
@param environment
Determines the type of all variables immediately going into this
block
@return | [
"Type",
"check",
"a",
"break",
"statement",
".",
"This",
"requires",
"propagating",
"the",
"current",
"environment",
"to",
"the",
"block",
"destination",
"to",
"ensure",
"that",
"the",
"actual",
"types",
"of",
"all",
"variables",
"at",
"that",
"point",
"are",
"precise",
"."
] | train | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/check/FlowTypeCheck.java#L464-L467 |
mongodb/stitch-android-sdk | core/sdk/src/main/java/com/mongodb/stitch/core/auth/internal/CoreStitchAuth.java | CoreStitchAuth.doAuthenticatedRequest | public <T> T doAuthenticatedRequest(
final StitchAuthRequest stitchReq,
final Class<T> resultClass,
final CodecRegistry codecRegistry
) {
"""
Performs a request against Stitch using the provided {@link StitchAuthRequest} object, and
decodes the JSON body of the response into a T value as specified by the provided class type.
The type will be decoded using the codec found for T in the codec registry given.
If the provided type is not supported by the codec registry to be used, the method will throw
a {@link org.bson.codecs.configuration.CodecConfigurationException}.
@param stitchReq the request to perform.
@param resultClass the class that the JSON response should be decoded as.
@param codecRegistry the codec registry used for de/serialization.
@param <T> the type into which the JSON response will be decoded into.
@return the decoded value.
"""
final Response response = doAuthenticatedRequest(stitchReq);
try {
final String bodyStr = IoUtils.readAllToString(response.getBody());
final JsonReader bsonReader = new JsonReader(bodyStr);
// We must check this condition because the decoder will throw trying to decode null
if (bsonReader.readBsonType() == BsonType.NULL) {
return null;
}
final CodecRegistry newReg =
CodecRegistries.fromRegistries(BsonUtils.DEFAULT_CODEC_REGISTRY, codecRegistry);
return newReg.get(resultClass).decode(bsonReader, DecoderContext.builder().build());
} catch (final Exception e) {
throw new StitchRequestException(e, StitchRequestErrorCode.DECODING_ERROR);
}
} | java | public <T> T doAuthenticatedRequest(
final StitchAuthRequest stitchReq,
final Class<T> resultClass,
final CodecRegistry codecRegistry
) {
final Response response = doAuthenticatedRequest(stitchReq);
try {
final String bodyStr = IoUtils.readAllToString(response.getBody());
final JsonReader bsonReader = new JsonReader(bodyStr);
// We must check this condition because the decoder will throw trying to decode null
if (bsonReader.readBsonType() == BsonType.NULL) {
return null;
}
final CodecRegistry newReg =
CodecRegistries.fromRegistries(BsonUtils.DEFAULT_CODEC_REGISTRY, codecRegistry);
return newReg.get(resultClass).decode(bsonReader, DecoderContext.builder().build());
} catch (final Exception e) {
throw new StitchRequestException(e, StitchRequestErrorCode.DECODING_ERROR);
}
} | [
"public",
"<",
"T",
">",
"T",
"doAuthenticatedRequest",
"(",
"final",
"StitchAuthRequest",
"stitchReq",
",",
"final",
"Class",
"<",
"T",
">",
"resultClass",
",",
"final",
"CodecRegistry",
"codecRegistry",
")",
"{",
"final",
"Response",
"response",
"=",
"doAuthenticatedRequest",
"(",
"stitchReq",
")",
";",
"try",
"{",
"final",
"String",
"bodyStr",
"=",
"IoUtils",
".",
"readAllToString",
"(",
"response",
".",
"getBody",
"(",
")",
")",
";",
"final",
"JsonReader",
"bsonReader",
"=",
"new",
"JsonReader",
"(",
"bodyStr",
")",
";",
"// We must check this condition because the decoder will throw trying to decode null",
"if",
"(",
"bsonReader",
".",
"readBsonType",
"(",
")",
"==",
"BsonType",
".",
"NULL",
")",
"{",
"return",
"null",
";",
"}",
"final",
"CodecRegistry",
"newReg",
"=",
"CodecRegistries",
".",
"fromRegistries",
"(",
"BsonUtils",
".",
"DEFAULT_CODEC_REGISTRY",
",",
"codecRegistry",
")",
";",
"return",
"newReg",
".",
"get",
"(",
"resultClass",
")",
".",
"decode",
"(",
"bsonReader",
",",
"DecoderContext",
".",
"builder",
"(",
")",
".",
"build",
"(",
")",
")",
";",
"}",
"catch",
"(",
"final",
"Exception",
"e",
")",
"{",
"throw",
"new",
"StitchRequestException",
"(",
"e",
",",
"StitchRequestErrorCode",
".",
"DECODING_ERROR",
")",
";",
"}",
"}"
] | Performs a request against Stitch using the provided {@link StitchAuthRequest} object, and
decodes the JSON body of the response into a T value as specified by the provided class type.
The type will be decoded using the codec found for T in the codec registry given.
If the provided type is not supported by the codec registry to be used, the method will throw
a {@link org.bson.codecs.configuration.CodecConfigurationException}.
@param stitchReq the request to perform.
@param resultClass the class that the JSON response should be decoded as.
@param codecRegistry the codec registry used for de/serialization.
@param <T> the type into which the JSON response will be decoded into.
@return the decoded value. | [
"Performs",
"a",
"request",
"against",
"Stitch",
"using",
"the",
"provided",
"{",
"@link",
"StitchAuthRequest",
"}",
"object",
"and",
"decodes",
"the",
"JSON",
"body",
"of",
"the",
"response",
"into",
"a",
"T",
"value",
"as",
"specified",
"by",
"the",
"provided",
"class",
"type",
".",
"The",
"type",
"will",
"be",
"decoded",
"using",
"the",
"codec",
"found",
"for",
"T",
"in",
"the",
"codec",
"registry",
"given",
".",
"If",
"the",
"provided",
"type",
"is",
"not",
"supported",
"by",
"the",
"codec",
"registry",
"to",
"be",
"used",
"the",
"method",
"will",
"throw",
"a",
"{",
"@link",
"org",
".",
"bson",
".",
"codecs",
".",
"configuration",
".",
"CodecConfigurationException",
"}",
"."
] | train | https://github.com/mongodb/stitch-android-sdk/blob/159b9334b1f1a827285544be5ee20cdf7b04e4cc/core/sdk/src/main/java/com/mongodb/stitch/core/auth/internal/CoreStitchAuth.java#L282-L304 |
dvasilen/Hive-XML-SerDe | src/main/java/com/ibm/spss/hive/serde2/xml/processor/XmlNode.java | XmlNode.addAttribute | public void addAttribute(final String _name, final String _value) {
"""
Adds the attribute
@param _name
the attribute name
@param _value
the attribute name
"""
this.attributes.put(_name, new XmlNode() {
{
this.name = _name;
this.value = _value;
this.valid = true;
this.type = XmlNode.ATTRIBUTE_NODE;
}
});
} | java | public void addAttribute(final String _name, final String _value) {
this.attributes.put(_name, new XmlNode() {
{
this.name = _name;
this.value = _value;
this.valid = true;
this.type = XmlNode.ATTRIBUTE_NODE;
}
});
} | [
"public",
"void",
"addAttribute",
"(",
"final",
"String",
"_name",
",",
"final",
"String",
"_value",
")",
"{",
"this",
".",
"attributes",
".",
"put",
"(",
"_name",
",",
"new",
"XmlNode",
"(",
")",
"{",
"{",
"this",
".",
"name",
"=",
"_name",
";",
"this",
".",
"value",
"=",
"_value",
";",
"this",
".",
"valid",
"=",
"true",
";",
"this",
".",
"type",
"=",
"XmlNode",
".",
"ATTRIBUTE_NODE",
";",
"}",
"}",
")",
";",
"}"
] | Adds the attribute
@param _name
the attribute name
@param _value
the attribute name | [
"Adds",
"the",
"attribute"
] | train | https://github.com/dvasilen/Hive-XML-SerDe/blob/2a7a184b2cfaeb63008529a9851cd72edb8025d9/src/main/java/com/ibm/spss/hive/serde2/xml/processor/XmlNode.java#L155-L164 |
cloudant/sync-android | cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/mazha/CouchClient.java | CouchClient.getDocRevisions | public DocumentRevs getDocRevisions(String id, String rev) {
"""
Get document along with its revision history, and the result is converted to a
<code>DocumentRevs</code> object.
@see <code>DocumentRevs</code>
"""
return getDocRevisions(id, rev,
new CouchClientTypeReference<DocumentRevs>(DocumentRevs.class));
} | java | public DocumentRevs getDocRevisions(String id, String rev) {
return getDocRevisions(id, rev,
new CouchClientTypeReference<DocumentRevs>(DocumentRevs.class));
} | [
"public",
"DocumentRevs",
"getDocRevisions",
"(",
"String",
"id",
",",
"String",
"rev",
")",
"{",
"return",
"getDocRevisions",
"(",
"id",
",",
"rev",
",",
"new",
"CouchClientTypeReference",
"<",
"DocumentRevs",
">",
"(",
"DocumentRevs",
".",
"class",
")",
")",
";",
"}"
] | Get document along with its revision history, and the result is converted to a
<code>DocumentRevs</code> object.
@see <code>DocumentRevs</code> | [
"Get",
"document",
"along",
"with",
"its",
"revision",
"history",
"and",
"the",
"result",
"is",
"converted",
"to",
"a",
"<code",
">",
"DocumentRevs<",
"/",
"code",
">",
"object",
"."
] | train | https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/mazha/CouchClient.java#L721-L724 |
TheCoder4eu/BootsFaces-OSP | src/main/java/net/bootsfaces/component/kebab/KebabRenderer.java | KebabRenderer.encodeBegin | @Override
public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
"""
/*
<div class="dropdown dropdown-kebab dropdown-kebab-pf">
<button class="btn btn-link dropdown-toggle" type="button" id="dropdownKebab" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
<span class="fa fa-ellipsis-v"></span>
</button>
<ul class="dropdown-menu " aria-labelledby="dropdownKebab">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li role="separator" class="divider"></li>
<li><a href="#">Separated link</a></li>
</ul>
</div>
"""
if (!component.isRendered()) {
return;
}
Kebab kebab = (Kebab) component;
ResponseWriter rw = context.getResponseWriter();
String clientId = kebab.getClientId();
// Kebabs are a restyled version of a dropdown and support the same feature set.
// They look like a very tight burger menu.
//<div class="dropdown dropdown-kebab dropdown-kebab-pf">
rw.startElement("div", kebab);
rw.writeAttribute("id", kebab.getId(), "id");
String s="dropdown dropdown-kebab dropdown-kebab-bf dropdown-kebab-pf";
if(kebab.getStyleClass()!=null){
s=s.concat(" ").concat(kebab.getStyleClass());
}
rw.writeAttribute("class", s, "class");
if(kebab.getStyle()!=null){
rw.writeAttribute("style", kebab.getStyle(), "style");
}
//Button
//<button id="dropdownKebab" class="btn btn-link dropdown-toggle" type="button" data-toggle="dropdown"
//aria-haspopup="true" aria-expanded="true">
rw.startElement("button", kebab);
rw.writeAttribute("id", kebab.getId()+"_btn", "id");
rw.writeAttribute("class", "btn btn-link dropdown-toggle", "class");
rw.writeAttribute("type", "button", "type");
rw.writeAttribute("data-toggle", "dropdown", "data-toggle");
//ARIA Attributes
rw.writeAttribute("aria-haspopup", "true", "aria-haspopup");
rw.writeAttribute("aria-expanded", "true", "aria-expanded");
//<span class="fa fa-ellipsis-v"></span>
rw.startElement("span", kebab);
rw.writeAttribute("class", "fa fa-ellipsis-v", "class");
rw.endElement("span");
rw.endElement("button");
//<ul class="dropdown-menu " aria-labelledby="dropdownKebab">
rw.startElement("ul", kebab);
rw.writeAttribute("class", "dropdown-menu ", "class");
rw.writeAttribute("aria-labelledby", kebab.getId()+"_btn", "aria-labelledby");
//rw.writeText("Dummy content of b:kebab", null);
} | java | @Override
public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
if (!component.isRendered()) {
return;
}
Kebab kebab = (Kebab) component;
ResponseWriter rw = context.getResponseWriter();
String clientId = kebab.getClientId();
// Kebabs are a restyled version of a dropdown and support the same feature set.
// They look like a very tight burger menu.
//<div class="dropdown dropdown-kebab dropdown-kebab-pf">
rw.startElement("div", kebab);
rw.writeAttribute("id", kebab.getId(), "id");
String s="dropdown dropdown-kebab dropdown-kebab-bf dropdown-kebab-pf";
if(kebab.getStyleClass()!=null){
s=s.concat(" ").concat(kebab.getStyleClass());
}
rw.writeAttribute("class", s, "class");
if(kebab.getStyle()!=null){
rw.writeAttribute("style", kebab.getStyle(), "style");
}
//Button
//<button id="dropdownKebab" class="btn btn-link dropdown-toggle" type="button" data-toggle="dropdown"
//aria-haspopup="true" aria-expanded="true">
rw.startElement("button", kebab);
rw.writeAttribute("id", kebab.getId()+"_btn", "id");
rw.writeAttribute("class", "btn btn-link dropdown-toggle", "class");
rw.writeAttribute("type", "button", "type");
rw.writeAttribute("data-toggle", "dropdown", "data-toggle");
//ARIA Attributes
rw.writeAttribute("aria-haspopup", "true", "aria-haspopup");
rw.writeAttribute("aria-expanded", "true", "aria-expanded");
//<span class="fa fa-ellipsis-v"></span>
rw.startElement("span", kebab);
rw.writeAttribute("class", "fa fa-ellipsis-v", "class");
rw.endElement("span");
rw.endElement("button");
//<ul class="dropdown-menu " aria-labelledby="dropdownKebab">
rw.startElement("ul", kebab);
rw.writeAttribute("class", "dropdown-menu ", "class");
rw.writeAttribute("aria-labelledby", kebab.getId()+"_btn", "aria-labelledby");
//rw.writeText("Dummy content of b:kebab", null);
} | [
"@",
"Override",
"public",
"void",
"encodeBegin",
"(",
"FacesContext",
"context",
",",
"UIComponent",
"component",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"component",
".",
"isRendered",
"(",
")",
")",
"{",
"return",
";",
"}",
"Kebab",
"kebab",
"=",
"(",
"Kebab",
")",
"component",
";",
"ResponseWriter",
"rw",
"=",
"context",
".",
"getResponseWriter",
"(",
")",
";",
"String",
"clientId",
"=",
"kebab",
".",
"getClientId",
"(",
")",
";",
"// Kebabs are a restyled version of a dropdown and support the same feature set.",
"// They look like a very tight burger menu.",
"//<div class=\"dropdown dropdown-kebab dropdown-kebab-pf\">",
"rw",
".",
"startElement",
"(",
"\"div\"",
",",
"kebab",
")",
";",
"rw",
".",
"writeAttribute",
"(",
"\"id\"",
",",
"kebab",
".",
"getId",
"(",
")",
",",
"\"id\"",
")",
";",
"String",
"s",
"=",
"\"dropdown dropdown-kebab dropdown-kebab-bf dropdown-kebab-pf\"",
";",
"if",
"(",
"kebab",
".",
"getStyleClass",
"(",
")",
"!=",
"null",
")",
"{",
"s",
"=",
"s",
".",
"concat",
"(",
"\" \"",
")",
".",
"concat",
"(",
"kebab",
".",
"getStyleClass",
"(",
")",
")",
";",
"}",
"rw",
".",
"writeAttribute",
"(",
"\"class\"",
",",
"s",
",",
"\"class\"",
")",
";",
"if",
"(",
"kebab",
".",
"getStyle",
"(",
")",
"!=",
"null",
")",
"{",
"rw",
".",
"writeAttribute",
"(",
"\"style\"",
",",
"kebab",
".",
"getStyle",
"(",
")",
",",
"\"style\"",
")",
";",
"}",
"//Button",
"//<button id=\"dropdownKebab\" class=\"btn btn-link dropdown-toggle\" type=\"button\" data-toggle=\"dropdown\" ",
"//aria-haspopup=\"true\" aria-expanded=\"true\">",
"rw",
".",
"startElement",
"(",
"\"button\"",
",",
"kebab",
")",
";",
"rw",
".",
"writeAttribute",
"(",
"\"id\"",
",",
"kebab",
".",
"getId",
"(",
")",
"+",
"\"_btn\"",
",",
"\"id\"",
")",
";",
"rw",
".",
"writeAttribute",
"(",
"\"class\"",
",",
"\"btn btn-link dropdown-toggle\"",
",",
"\"class\"",
")",
";",
"rw",
".",
"writeAttribute",
"(",
"\"type\"",
",",
"\"button\"",
",",
"\"type\"",
")",
";",
"rw",
".",
"writeAttribute",
"(",
"\"data-toggle\"",
",",
"\"dropdown\"",
",",
"\"data-toggle\"",
")",
";",
"//ARIA Attributes",
"rw",
".",
"writeAttribute",
"(",
"\"aria-haspopup\"",
",",
"\"true\"",
",",
"\"aria-haspopup\"",
")",
";",
"rw",
".",
"writeAttribute",
"(",
"\"aria-expanded\"",
",",
"\"true\"",
",",
"\"aria-expanded\"",
")",
";",
"//<span class=\"fa fa-ellipsis-v\"></span>",
"rw",
".",
"startElement",
"(",
"\"span\"",
",",
"kebab",
")",
";",
"rw",
".",
"writeAttribute",
"(",
"\"class\"",
",",
"\"fa fa-ellipsis-v\"",
",",
"\"class\"",
")",
";",
"rw",
".",
"endElement",
"(",
"\"span\"",
")",
";",
"rw",
".",
"endElement",
"(",
"\"button\"",
")",
";",
"//<ul class=\"dropdown-menu \" aria-labelledby=\"dropdownKebab\">",
"rw",
".",
"startElement",
"(",
"\"ul\"",
",",
"kebab",
")",
";",
"rw",
".",
"writeAttribute",
"(",
"\"class\"",
",",
"\"dropdown-menu \"",
",",
"\"class\"",
")",
";",
"rw",
".",
"writeAttribute",
"(",
"\"aria-labelledby\"",
",",
"kebab",
".",
"getId",
"(",
")",
"+",
"\"_btn\"",
",",
"\"aria-labelledby\"",
")",
";",
"//rw.writeText(\"Dummy content of b:kebab\", null);",
"}"
] | /*
<div class="dropdown dropdown-kebab dropdown-kebab-pf">
<button class="btn btn-link dropdown-toggle" type="button" id="dropdownKebab" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
<span class="fa fa-ellipsis-v"></span>
</button>
<ul class="dropdown-menu " aria-labelledby="dropdownKebab">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li role="separator" class="divider"></li>
<li><a href="#">Separated link</a></li>
</ul>
</div> | [
"/",
"*",
"<div",
"class",
"=",
"dropdown",
"dropdown",
"-",
"kebab",
"dropdown",
"-",
"kebab",
"-",
"pf",
">",
"<button",
"class",
"=",
"btn",
"btn",
"-",
"link",
"dropdown",
"-",
"toggle",
"type",
"=",
"button",
"id",
"=",
"dropdownKebab",
"data",
"-",
"toggle",
"=",
"dropdown",
"aria",
"-",
"haspopup",
"=",
"true",
"aria",
"-",
"expanded",
"=",
"true",
">",
"<span",
"class",
"=",
"fa",
"fa",
"-",
"ellipsis",
"-",
"v",
">",
"<",
"/",
"span",
">",
"<",
"/",
"button",
">",
"<ul",
"class",
"=",
"dropdown",
"-",
"menu",
"aria",
"-",
"labelledby",
"=",
"dropdownKebab",
">",
"<li",
">",
"<a",
"href",
"=",
"#",
">",
"Action<",
"/",
"a",
">",
"<",
"/",
"li",
">",
"<li",
">",
"<a",
"href",
"=",
"#",
">",
"Another",
"action<",
"/",
"a",
">",
"<",
"/",
"li",
">",
"<li",
">",
"<a",
"href",
"=",
"#",
">",
"Something",
"else",
"here<",
"/",
"a",
">",
"<",
"/",
"li",
">",
"<li",
"role",
"=",
"separator",
"class",
"=",
"divider",
">",
"<",
"/",
"li",
">",
"<li",
">",
"<a",
"href",
"=",
"#",
">",
"Separated",
"link<",
"/",
"a",
">",
"<",
"/",
"li",
">",
"<",
"/",
"ul",
">",
"<",
"/",
"div",
">"
] | train | https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/component/kebab/KebabRenderer.java#L58-L108 |
JOML-CI/JOML | src/org/joml/Matrix3f.java | Matrix3f.rotateYXZ | public Matrix3f rotateYXZ(Vector3f angles) {
"""
Apply rotation of <code>angles.y</code> radians about the Y axis, followed by a rotation of <code>angles.x</code> radians about the X axis and
followed by a rotation of <code>angles.z</code> radians about the Z axis.
<p>
When used with a right-handed coordinate system, the produced rotation will rotate a vector
counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin.
When used with a left-handed coordinate system, the rotation is clockwise.
<p>
If <code>M</code> is <code>this</code> matrix and <code>R</code> the rotation matrix,
then the new matrix will be <code>M * R</code>. So when transforming a
vector <code>v</code> with the new matrix by using <code>M * R * v</code>, the
rotation will be applied first!
<p>
This method is equivalent to calling: <code>rotateY(angles.y).rotateX(angles.x).rotateZ(angles.z)</code>
@param angles
the Euler angles
@return this
"""
return rotateYXZ(angles.y, angles.x, angles.z);
} | java | public Matrix3f rotateYXZ(Vector3f angles) {
return rotateYXZ(angles.y, angles.x, angles.z);
} | [
"public",
"Matrix3f",
"rotateYXZ",
"(",
"Vector3f",
"angles",
")",
"{",
"return",
"rotateYXZ",
"(",
"angles",
".",
"y",
",",
"angles",
".",
"x",
",",
"angles",
".",
"z",
")",
";",
"}"
] | Apply rotation of <code>angles.y</code> radians about the Y axis, followed by a rotation of <code>angles.x</code> radians about the X axis and
followed by a rotation of <code>angles.z</code> radians about the Z axis.
<p>
When used with a right-handed coordinate system, the produced rotation will rotate a vector
counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin.
When used with a left-handed coordinate system, the rotation is clockwise.
<p>
If <code>M</code> is <code>this</code> matrix and <code>R</code> the rotation matrix,
then the new matrix will be <code>M * R</code>. So when transforming a
vector <code>v</code> with the new matrix by using <code>M * R * v</code>, the
rotation will be applied first!
<p>
This method is equivalent to calling: <code>rotateY(angles.y).rotateX(angles.x).rotateZ(angles.z)</code>
@param angles
the Euler angles
@return this | [
"Apply",
"rotation",
"of",
"<code",
">",
"angles",
".",
"y<",
"/",
"code",
">",
"radians",
"about",
"the",
"Y",
"axis",
"followed",
"by",
"a",
"rotation",
"of",
"<code",
">",
"angles",
".",
"x<",
"/",
"code",
">",
"radians",
"about",
"the",
"X",
"axis",
"and",
"followed",
"by",
"a",
"rotation",
"of",
"<code",
">",
"angles",
".",
"z<",
"/",
"code",
">",
"radians",
"about",
"the",
"Z",
"axis",
".",
"<p",
">",
"When",
"used",
"with",
"a",
"right",
"-",
"handed",
"coordinate",
"system",
"the",
"produced",
"rotation",
"will",
"rotate",
"a",
"vector",
"counter",
"-",
"clockwise",
"around",
"the",
"rotation",
"axis",
"when",
"viewing",
"along",
"the",
"negative",
"axis",
"direction",
"towards",
"the",
"origin",
".",
"When",
"used",
"with",
"a",
"left",
"-",
"handed",
"coordinate",
"system",
"the",
"rotation",
"is",
"clockwise",
".",
"<p",
">",
"If",
"<code",
">",
"M<",
"/",
"code",
">",
"is",
"<code",
">",
"this<",
"/",
"code",
">",
"matrix",
"and",
"<code",
">",
"R<",
"/",
"code",
">",
"the",
"rotation",
"matrix",
"then",
"the",
"new",
"matrix",
"will",
"be",
"<code",
">",
"M",
"*",
"R<",
"/",
"code",
">",
".",
"So",
"when",
"transforming",
"a",
"vector",
"<code",
">",
"v<",
"/",
"code",
">",
"with",
"the",
"new",
"matrix",
"by",
"using",
"<code",
">",
"M",
"*",
"R",
"*",
"v<",
"/",
"code",
">",
"the",
"rotation",
"will",
"be",
"applied",
"first!",
"<p",
">",
"This",
"method",
"is",
"equivalent",
"to",
"calling",
":",
"<code",
">",
"rotateY",
"(",
"angles",
".",
"y",
")",
".",
"rotateX",
"(",
"angles",
".",
"x",
")",
".",
"rotateZ",
"(",
"angles",
".",
"z",
")",
"<",
"/",
"code",
">"
] | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix3f.java#L2195-L2197 |
febit/wit | wit-core/src/main/java/org/febit/wit_shaded/asm/ClassWriter.java | ClassWriter.newFloat | private Item newFloat(final float value) {
"""
Adds a float to the constant pool of the class being build. Does nothing if the constant pool already contains a
similar item.
@param value the float value.
@return a new or already existing float item.
"""
Item result = get(key.set(FLOAT, value));
if (result == null) {
pool.putByte(FLOAT).putInt(Float.floatToIntBits(value));
result = new Item(poolIndex++, key);
put(result);
}
return result;
} | java | private Item newFloat(final float value) {
Item result = get(key.set(FLOAT, value));
if (result == null) {
pool.putByte(FLOAT).putInt(Float.floatToIntBits(value));
result = new Item(poolIndex++, key);
put(result);
}
return result;
} | [
"private",
"Item",
"newFloat",
"(",
"final",
"float",
"value",
")",
"{",
"Item",
"result",
"=",
"get",
"(",
"key",
".",
"set",
"(",
"FLOAT",
",",
"value",
")",
")",
";",
"if",
"(",
"result",
"==",
"null",
")",
"{",
"pool",
".",
"putByte",
"(",
"FLOAT",
")",
".",
"putInt",
"(",
"Float",
".",
"floatToIntBits",
"(",
"value",
")",
")",
";",
"result",
"=",
"new",
"Item",
"(",
"poolIndex",
"++",
",",
"key",
")",
";",
"put",
"(",
"result",
")",
";",
"}",
"return",
"result",
";",
"}"
] | Adds a float to the constant pool of the class being build. Does nothing if the constant pool already contains a
similar item.
@param value the float value.
@return a new or already existing float item. | [
"Adds",
"a",
"float",
"to",
"the",
"constant",
"pool",
"of",
"the",
"class",
"being",
"build",
".",
"Does",
"nothing",
"if",
"the",
"constant",
"pool",
"already",
"contains",
"a",
"similar",
"item",
"."
] | train | https://github.com/febit/wit/blob/89ee29efbc5633b79c30c3c7b953c9f4130575af/wit-core/src/main/java/org/febit/wit_shaded/asm/ClassWriter.java#L631-L639 |
RKumsher/utils | src/main/java/com/github/rkumsher/date/RandomDateUtils.java | RandomDateUtils.randomInstantAfter | public static Instant randomInstantAfter(Instant after) {
"""
Returns a random {@link Instant} that is after the given {@link Instant}.
@param after the value that returned {@link Instant} must be after
@return the random {@link Instant}
@throws IllegalArgumentException if after is null or if after is equal to or after {@link
RandomDateUtils#MAX_INSTANT}
"""
checkArgument(after != null, "After must be non-null");
checkArgument(after.isBefore(MAX_INSTANT), "Cannot produce date after %s", MAX_INSTANT);
return randomInstant(after.plus(1, MILLIS), MAX_INSTANT);
} | java | public static Instant randomInstantAfter(Instant after) {
checkArgument(after != null, "After must be non-null");
checkArgument(after.isBefore(MAX_INSTANT), "Cannot produce date after %s", MAX_INSTANT);
return randomInstant(after.plus(1, MILLIS), MAX_INSTANT);
} | [
"public",
"static",
"Instant",
"randomInstantAfter",
"(",
"Instant",
"after",
")",
"{",
"checkArgument",
"(",
"after",
"!=",
"null",
",",
"\"After must be non-null\"",
")",
";",
"checkArgument",
"(",
"after",
".",
"isBefore",
"(",
"MAX_INSTANT",
")",
",",
"\"Cannot produce date after %s\"",
",",
"MAX_INSTANT",
")",
";",
"return",
"randomInstant",
"(",
"after",
".",
"plus",
"(",
"1",
",",
"MILLIS",
")",
",",
"MAX_INSTANT",
")",
";",
"}"
] | Returns a random {@link Instant} that is after the given {@link Instant}.
@param after the value that returned {@link Instant} must be after
@return the random {@link Instant}
@throws IllegalArgumentException if after is null or if after is equal to or after {@link
RandomDateUtils#MAX_INSTANT} | [
"Returns",
"a",
"random",
"{",
"@link",
"Instant",
"}",
"that",
"is",
"after",
"the",
"given",
"{",
"@link",
"Instant",
"}",
"."
] | train | https://github.com/RKumsher/utils/blob/fcdb190569cd0288249bf4b46fd418f8c01d1caf/src/main/java/com/github/rkumsher/date/RandomDateUtils.java#L487-L491 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/objects/XNodeSet.java | XNodeSet.lessThanOrEqual | public boolean lessThanOrEqual(XObject obj2) throws javax.xml.transform.TransformerException {
"""
Tell if one object is less than or equal to the other.
@param obj2 object to compare this nodeset to
@return see this.compare(...)
@throws javax.xml.transform.TransformerException
"""
return compare(obj2, S_LTE);
} | java | public boolean lessThanOrEqual(XObject obj2) throws javax.xml.transform.TransformerException
{
return compare(obj2, S_LTE);
} | [
"public",
"boolean",
"lessThanOrEqual",
"(",
"XObject",
"obj2",
")",
"throws",
"javax",
".",
"xml",
".",
"transform",
".",
"TransformerException",
"{",
"return",
"compare",
"(",
"obj2",
",",
"S_LTE",
")",
";",
"}"
] | Tell if one object is less than or equal to the other.
@param obj2 object to compare this nodeset to
@return see this.compare(...)
@throws javax.xml.transform.TransformerException | [
"Tell",
"if",
"one",
"object",
"is",
"less",
"than",
"or",
"equal",
"to",
"the",
"other",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/objects/XNodeSet.java#L658-L661 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/ConsumerSessionProxy.java | ConsumerSessionProxy._deleteSet | private void _deleteSet(SIMessageHandle[] msgHandles, SITransaction tran)
throws SISessionUnavailableException, SISessionDroppedException,
SIConnectionUnavailableException, SIConnectionDroppedException,
SIResourceException, SIConnectionLostException, SILimitExceededException,
SIIncorrectCallException, SIMessageNotLockedException,
SIErrorException {
"""
Used to delete a set of messages.
@param msgHandles
@param tran
"""
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "_deleteSet",
new Object[] { msgHandles.length + " msg handles", tran });
if (TraceComponent.isAnyTracingEnabled()) {
CommsLightTrace.traceMessageIds(tc, "DeleteSetMsgTrace", msgHandles);
}
CommsByteBuffer request = getCommsByteBuffer();
request.putShort(getConnectionObjectID());
request.putShort(getProxyID());
request.putSITransaction(tran);
request.putSIMessageHandles(msgHandles);
CommsByteBuffer reply = jfapExchange(request,
JFapChannelConstants.SEG_DELETE_SET,
JFapChannelConstants.PRIORITY_MEDIUM,
true);
try
{
short err = reply.getCommandCompletionCode(JFapChannelConstants.SEG_DELETE_SET_R);
if (err != CommsConstants.SI_NO_EXCEPTION)
{
checkFor_SISessionUnavailableException(reply, err);
checkFor_SISessionDroppedException(reply, err);
checkFor_SIConnectionUnavailableException(reply, err);
checkFor_SIConnectionDroppedException(reply, err);
checkFor_SIResourceException(reply, err);
checkFor_SIConnectionLostException(reply, err);
checkFor_SILimitExceededException(reply, err);
checkFor_SIIncorrectCallException(reply, err);
checkFor_SIMessageNotLockedException(reply, err);
checkFor_SIErrorException(reply, err);
defaultChecker(reply, err);
}
}
finally
{
if (reply != null) reply.release();
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "_deleteSet");
} | java | private void _deleteSet(SIMessageHandle[] msgHandles, SITransaction tran)
throws SISessionUnavailableException, SISessionDroppedException,
SIConnectionUnavailableException, SIConnectionDroppedException,
SIResourceException, SIConnectionLostException, SILimitExceededException,
SIIncorrectCallException, SIMessageNotLockedException,
SIErrorException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "_deleteSet",
new Object[] { msgHandles.length + " msg handles", tran });
if (TraceComponent.isAnyTracingEnabled()) {
CommsLightTrace.traceMessageIds(tc, "DeleteSetMsgTrace", msgHandles);
}
CommsByteBuffer request = getCommsByteBuffer();
request.putShort(getConnectionObjectID());
request.putShort(getProxyID());
request.putSITransaction(tran);
request.putSIMessageHandles(msgHandles);
CommsByteBuffer reply = jfapExchange(request,
JFapChannelConstants.SEG_DELETE_SET,
JFapChannelConstants.PRIORITY_MEDIUM,
true);
try
{
short err = reply.getCommandCompletionCode(JFapChannelConstants.SEG_DELETE_SET_R);
if (err != CommsConstants.SI_NO_EXCEPTION)
{
checkFor_SISessionUnavailableException(reply, err);
checkFor_SISessionDroppedException(reply, err);
checkFor_SIConnectionUnavailableException(reply, err);
checkFor_SIConnectionDroppedException(reply, err);
checkFor_SIResourceException(reply, err);
checkFor_SIConnectionLostException(reply, err);
checkFor_SILimitExceededException(reply, err);
checkFor_SIIncorrectCallException(reply, err);
checkFor_SIMessageNotLockedException(reply, err);
checkFor_SIErrorException(reply, err);
defaultChecker(reply, err);
}
}
finally
{
if (reply != null) reply.release();
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "_deleteSet");
} | [
"private",
"void",
"_deleteSet",
"(",
"SIMessageHandle",
"[",
"]",
"msgHandles",
",",
"SITransaction",
"tran",
")",
"throws",
"SISessionUnavailableException",
",",
"SISessionDroppedException",
",",
"SIConnectionUnavailableException",
",",
"SIConnectionDroppedException",
",",
"SIResourceException",
",",
"SIConnectionLostException",
",",
"SILimitExceededException",
",",
"SIIncorrectCallException",
",",
"SIMessageNotLockedException",
",",
"SIErrorException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
",",
"\"_deleteSet\"",
",",
"new",
"Object",
"[",
"]",
"{",
"msgHandles",
".",
"length",
"+",
"\" msg handles\"",
",",
"tran",
"}",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
")",
"{",
"CommsLightTrace",
".",
"traceMessageIds",
"(",
"tc",
",",
"\"DeleteSetMsgTrace\"",
",",
"msgHandles",
")",
";",
"}",
"CommsByteBuffer",
"request",
"=",
"getCommsByteBuffer",
"(",
")",
";",
"request",
".",
"putShort",
"(",
"getConnectionObjectID",
"(",
")",
")",
";",
"request",
".",
"putShort",
"(",
"getProxyID",
"(",
")",
")",
";",
"request",
".",
"putSITransaction",
"(",
"tran",
")",
";",
"request",
".",
"putSIMessageHandles",
"(",
"msgHandles",
")",
";",
"CommsByteBuffer",
"reply",
"=",
"jfapExchange",
"(",
"request",
",",
"JFapChannelConstants",
".",
"SEG_DELETE_SET",
",",
"JFapChannelConstants",
".",
"PRIORITY_MEDIUM",
",",
"true",
")",
";",
"try",
"{",
"short",
"err",
"=",
"reply",
".",
"getCommandCompletionCode",
"(",
"JFapChannelConstants",
".",
"SEG_DELETE_SET_R",
")",
";",
"if",
"(",
"err",
"!=",
"CommsConstants",
".",
"SI_NO_EXCEPTION",
")",
"{",
"checkFor_SISessionUnavailableException",
"(",
"reply",
",",
"err",
")",
";",
"checkFor_SISessionDroppedException",
"(",
"reply",
",",
"err",
")",
";",
"checkFor_SIConnectionUnavailableException",
"(",
"reply",
",",
"err",
")",
";",
"checkFor_SIConnectionDroppedException",
"(",
"reply",
",",
"err",
")",
";",
"checkFor_SIResourceException",
"(",
"reply",
",",
"err",
")",
";",
"checkFor_SIConnectionLostException",
"(",
"reply",
",",
"err",
")",
";",
"checkFor_SILimitExceededException",
"(",
"reply",
",",
"err",
")",
";",
"checkFor_SIIncorrectCallException",
"(",
"reply",
",",
"err",
")",
";",
"checkFor_SIMessageNotLockedException",
"(",
"reply",
",",
"err",
")",
";",
"checkFor_SIErrorException",
"(",
"reply",
",",
"err",
")",
";",
"defaultChecker",
"(",
"reply",
",",
"err",
")",
";",
"}",
"}",
"finally",
"{",
"if",
"(",
"reply",
"!=",
"null",
")",
"reply",
".",
"release",
"(",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"this",
",",
"tc",
",",
"\"_deleteSet\"",
")",
";",
"}"
] | Used to delete a set of messages.
@param msgHandles
@param tran | [
"Used",
"to",
"delete",
"a",
"set",
"of",
"messages",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/ConsumerSessionProxy.java#L1581-L1631 |
tvesalainen/util | util/src/main/java/org/vesalainen/navi/Navis.java | Navis.addLongitude | public static final double addLongitude(double longitude, double delta) {
"""
Adds delta to longitude. Positive delta is to east
@param longitude
@param delta
@return
"""
double gha = longitudeToGHA(longitude);
gha -= delta;
return ghaToLongitude(normalizeAngle(gha));
} | java | public static final double addLongitude(double longitude, double delta)
{
double gha = longitudeToGHA(longitude);
gha -= delta;
return ghaToLongitude(normalizeAngle(gha));
} | [
"public",
"static",
"final",
"double",
"addLongitude",
"(",
"double",
"longitude",
",",
"double",
"delta",
")",
"{",
"double",
"gha",
"=",
"longitudeToGHA",
"(",
"longitude",
")",
";",
"gha",
"-=",
"delta",
";",
"return",
"ghaToLongitude",
"(",
"normalizeAngle",
"(",
"gha",
")",
")",
";",
"}"
] | Adds delta to longitude. Positive delta is to east
@param longitude
@param delta
@return | [
"Adds",
"delta",
"to",
"longitude",
".",
"Positive",
"delta",
"is",
"to",
"east"
] | train | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/navi/Navis.java#L232-L237 |
Impetus/Kundera | src/jpa-engine/core/src/main/java/com/impetus/kundera/index/IndexManager.java | IndexManager.write | public final void write(EntityMetadata metadata, Object entity) {
"""
Indexes an object.
@param metadata
the metadata
@param entity
the entity
"""
if (indexer != null)
{
MetamodelImpl metamodel = (MetamodelImpl) kunderaMetadata.getApplicationMetadata().getMetamodel(
metadata.getPersistenceUnit());
((com.impetus.kundera.index.lucene.Indexer) indexer).index(metadata, metamodel, entity);
}
} | java | public final void write(EntityMetadata metadata, Object entity)
{
if (indexer != null)
{
MetamodelImpl metamodel = (MetamodelImpl) kunderaMetadata.getApplicationMetadata().getMetamodel(
metadata.getPersistenceUnit());
((com.impetus.kundera.index.lucene.Indexer) indexer).index(metadata, metamodel, entity);
}
} | [
"public",
"final",
"void",
"write",
"(",
"EntityMetadata",
"metadata",
",",
"Object",
"entity",
")",
"{",
"if",
"(",
"indexer",
"!=",
"null",
")",
"{",
"MetamodelImpl",
"metamodel",
"=",
"(",
"MetamodelImpl",
")",
"kunderaMetadata",
".",
"getApplicationMetadata",
"(",
")",
".",
"getMetamodel",
"(",
"metadata",
".",
"getPersistenceUnit",
"(",
")",
")",
";",
"(",
"(",
"com",
".",
"impetus",
".",
"kundera",
".",
"index",
".",
"lucene",
".",
"Indexer",
")",
"indexer",
")",
".",
"index",
"(",
"metadata",
",",
"metamodel",
",",
"entity",
")",
";",
"}",
"}"
] | Indexes an object.
@param metadata
the metadata
@param entity
the entity | [
"Indexes",
"an",
"object",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/index/IndexManager.java#L233-L241 |
zaproxy/zaproxy | src/org/zaproxy/zap/extension/script/ExtensionScript.java | ExtensionScript.invokeTargetedScript | public void invokeTargetedScript(ScriptWrapper script, HttpMessage msg) {
"""
Invokes the given {@code script}, synchronously, as a {@link TargetedScript}, handling any {@code Exception} thrown
during the invocation.
<p>
The context class loader of caller thread is replaced with the class loader {@code AddOnLoader} to allow the script to
access classes of add-ons.
@param script the script to invoke.
@param msg the HTTP message to process.
@since 2.2.0
@see #getInterface(ScriptWrapper, Class)
"""
validateScriptType(script, TYPE_TARGETED);
Writer writer = getWriters(script);
try {
// Dont need to check if enabled as it can only be invoked manually
TargetedScript s = this.getInterface(script, TargetedScript.class);
if (s != null) {
s.invokeWith(msg);
} else {
handleUnspecifiedScriptError(script, writer, Constant.messages.getString("script.interface.targeted.error"));
}
} catch (Exception e) {
handleScriptException(script, writer, e);
}
} | java | public void invokeTargetedScript(ScriptWrapper script, HttpMessage msg) {
validateScriptType(script, TYPE_TARGETED);
Writer writer = getWriters(script);
try {
// Dont need to check if enabled as it can only be invoked manually
TargetedScript s = this.getInterface(script, TargetedScript.class);
if (s != null) {
s.invokeWith(msg);
} else {
handleUnspecifiedScriptError(script, writer, Constant.messages.getString("script.interface.targeted.error"));
}
} catch (Exception e) {
handleScriptException(script, writer, e);
}
} | [
"public",
"void",
"invokeTargetedScript",
"(",
"ScriptWrapper",
"script",
",",
"HttpMessage",
"msg",
")",
"{",
"validateScriptType",
"(",
"script",
",",
"TYPE_TARGETED",
")",
";",
"Writer",
"writer",
"=",
"getWriters",
"(",
"script",
")",
";",
"try",
"{",
"// Dont need to check if enabled as it can only be invoked manually\r",
"TargetedScript",
"s",
"=",
"this",
".",
"getInterface",
"(",
"script",
",",
"TargetedScript",
".",
"class",
")",
";",
"if",
"(",
"s",
"!=",
"null",
")",
"{",
"s",
".",
"invokeWith",
"(",
"msg",
")",
";",
"}",
"else",
"{",
"handleUnspecifiedScriptError",
"(",
"script",
",",
"writer",
",",
"Constant",
".",
"messages",
".",
"getString",
"(",
"\"script.interface.targeted.error\"",
")",
")",
";",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"handleScriptException",
"(",
"script",
",",
"writer",
",",
"e",
")",
";",
"}",
"}"
] | Invokes the given {@code script}, synchronously, as a {@link TargetedScript}, handling any {@code Exception} thrown
during the invocation.
<p>
The context class loader of caller thread is replaced with the class loader {@code AddOnLoader} to allow the script to
access classes of add-ons.
@param script the script to invoke.
@param msg the HTTP message to process.
@since 2.2.0
@see #getInterface(ScriptWrapper, Class) | [
"Invokes",
"the",
"given",
"{",
"@code",
"script",
"}",
"synchronously",
"as",
"a",
"{",
"@link",
"TargetedScript",
"}",
"handling",
"any",
"{",
"@code",
"Exception",
"}",
"thrown",
"during",
"the",
"invocation",
".",
"<p",
">",
"The",
"context",
"class",
"loader",
"of",
"caller",
"thread",
"is",
"replaced",
"with",
"the",
"class",
"loader",
"{",
"@code",
"AddOnLoader",
"}",
"to",
"allow",
"the",
"script",
"to",
"access",
"classes",
"of",
"add",
"-",
"ons",
"."
] | train | https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/extension/script/ExtensionScript.java#L1390-L1408 |
OpenLiberty/open-liberty | dev/com.ibm.ws.container.service.compat/src/com/ibm/ws/util/ThreadPool.java | ThreadPool.executeOnDaemon | public void executeOnDaemon(Runnable command) {
"""
Dispatch work on a daemon thread. This thread is not accounted
for in the pool. There are no corresponding
ThreadPoolListener events. There is no MonitorPlugin support.
"""
int id = 0;
final Runnable commandToRun = command;
synchronized (this) {
this.daemonId++;
id = this.daemonId;
}
final String runId = name + " : DMN" + id; // d185137.2
Thread t = (Thread) AccessController.doPrivileged(new PrivilegedAction()
{ // d185137.2
public Object run()
{
// return new Thread(commandToRun); // d185137.2
Thread temp = new Thread(commandToRun, runId); // d185137.2
temp.setDaemon(true);
return temp;
}
});
t.start();
} | java | public void executeOnDaemon(Runnable command) {
int id = 0;
final Runnable commandToRun = command;
synchronized (this) {
this.daemonId++;
id = this.daemonId;
}
final String runId = name + " : DMN" + id; // d185137.2
Thread t = (Thread) AccessController.doPrivileged(new PrivilegedAction()
{ // d185137.2
public Object run()
{
// return new Thread(commandToRun); // d185137.2
Thread temp = new Thread(commandToRun, runId); // d185137.2
temp.setDaemon(true);
return temp;
}
});
t.start();
} | [
"public",
"void",
"executeOnDaemon",
"(",
"Runnable",
"command",
")",
"{",
"int",
"id",
"=",
"0",
";",
"final",
"Runnable",
"commandToRun",
"=",
"command",
";",
"synchronized",
"(",
"this",
")",
"{",
"this",
".",
"daemonId",
"++",
";",
"id",
"=",
"this",
".",
"daemonId",
";",
"}",
"final",
"String",
"runId",
"=",
"name",
"+",
"\" : DMN\"",
"+",
"id",
";",
"// d185137.2",
"Thread",
"t",
"=",
"(",
"Thread",
")",
"AccessController",
".",
"doPrivileged",
"(",
"new",
"PrivilegedAction",
"(",
")",
"{",
"// d185137.2",
"public",
"Object",
"run",
"(",
")",
"{",
"// return new Thread(commandToRun); // d185137.2",
"Thread",
"temp",
"=",
"new",
"Thread",
"(",
"commandToRun",
",",
"runId",
")",
";",
"// d185137.2",
"temp",
".",
"setDaemon",
"(",
"true",
")",
";",
"return",
"temp",
";",
"}",
"}",
")",
";",
"t",
".",
"start",
"(",
")",
";",
"}"
] | Dispatch work on a daemon thread. This thread is not accounted
for in the pool. There are no corresponding
ThreadPoolListener events. There is no MonitorPlugin support. | [
"Dispatch",
"work",
"on",
"a",
"daemon",
"thread",
".",
"This",
"thread",
"is",
"not",
"accounted",
"for",
"in",
"the",
"pool",
".",
"There",
"are",
"no",
"corresponding",
"ThreadPoolListener",
"events",
".",
"There",
"is",
"no",
"MonitorPlugin",
"support",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.container.service.compat/src/com/ibm/ws/util/ThreadPool.java#L1066-L1089 |
lievendoclo/Valkyrie-RCP | valkyrie-rcp-core/src/main/java/org/valkyriercp/command/config/CommandButtonLabelInfo.java | CommandButtonLabelInfo.configureAccelerator | protected void configureAccelerator(AbstractButton button, KeyStroke keystrokeAccelerator) {
"""
Sets the given keystroke accelerator on the given button.
@param button The button. May be null.
@param keystrokeAccelerator The accelerator. May be null.
"""
if ((button instanceof JMenuItem) && !(button instanceof JMenu)) {
((JMenuItem)button).setAccelerator(keystrokeAccelerator);
}
} | java | protected void configureAccelerator(AbstractButton button, KeyStroke keystrokeAccelerator) {
if ((button instanceof JMenuItem) && !(button instanceof JMenu)) {
((JMenuItem)button).setAccelerator(keystrokeAccelerator);
}
} | [
"protected",
"void",
"configureAccelerator",
"(",
"AbstractButton",
"button",
",",
"KeyStroke",
"keystrokeAccelerator",
")",
"{",
"if",
"(",
"(",
"button",
"instanceof",
"JMenuItem",
")",
"&&",
"!",
"(",
"button",
"instanceof",
"JMenu",
")",
")",
"{",
"(",
"(",
"JMenuItem",
")",
"button",
")",
".",
"setAccelerator",
"(",
"keystrokeAccelerator",
")",
";",
"}",
"}"
] | Sets the given keystroke accelerator on the given button.
@param button The button. May be null.
@param keystrokeAccelerator The accelerator. May be null. | [
"Sets",
"the",
"given",
"keystroke",
"accelerator",
"on",
"the",
"given",
"button",
"."
] | train | https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/command/config/CommandButtonLabelInfo.java#L264-L268 |
bingoohuang/excel2javabeans | src/main/java/com/github/bingoohuang/excel2beans/PoiUtil.java | PoiUtil.findCell | public static Cell findCell(Sheet sheet, String cellRefValue) {
"""
根据单元格索引,找到单元格。
@param sheet EXCEL表单。
@param cellRefValue 单元格索引,例如A1, AB12等。
@return 单元格。
"""
val cellRef = new CellReference(cellRefValue);
val row = sheet.getRow(cellRef.getRow());
if (row == null) {
log.warn("unable to find row for " + cellRefValue);
return null;
}
val cell = row.getCell(cellRef.getCol());
if (cell == null) {
log.warn("unable to find cell for " + cellRefValue);
}
return cell;
} | java | public static Cell findCell(Sheet sheet, String cellRefValue) {
val cellRef = new CellReference(cellRefValue);
val row = sheet.getRow(cellRef.getRow());
if (row == null) {
log.warn("unable to find row for " + cellRefValue);
return null;
}
val cell = row.getCell(cellRef.getCol());
if (cell == null) {
log.warn("unable to find cell for " + cellRefValue);
}
return cell;
} | [
"public",
"static",
"Cell",
"findCell",
"(",
"Sheet",
"sheet",
",",
"String",
"cellRefValue",
")",
"{",
"val",
"cellRef",
"=",
"new",
"CellReference",
"(",
"cellRefValue",
")",
";",
"val",
"row",
"=",
"sheet",
".",
"getRow",
"(",
"cellRef",
".",
"getRow",
"(",
")",
")",
";",
"if",
"(",
"row",
"==",
"null",
")",
"{",
"log",
".",
"warn",
"(",
"\"unable to find row for \"",
"+",
"cellRefValue",
")",
";",
"return",
"null",
";",
"}",
"val",
"cell",
"=",
"row",
".",
"getCell",
"(",
"cellRef",
".",
"getCol",
"(",
")",
")",
";",
"if",
"(",
"cell",
"==",
"null",
")",
"{",
"log",
".",
"warn",
"(",
"\"unable to find cell for \"",
"+",
"cellRefValue",
")",
";",
"}",
"return",
"cell",
";",
"}"
] | 根据单元格索引,找到单元格。
@param sheet EXCEL表单。
@param cellRefValue 单元格索引,例如A1, AB12等。
@return 单元格。 | [
"根据单元格索引,找到单元格。"
] | train | https://github.com/bingoohuang/excel2javabeans/blob/db136d460b93b649814366c0d84a982698b96dc3/src/main/java/com/github/bingoohuang/excel2beans/PoiUtil.java#L212-L226 |
hibernate/hibernate-ogm | infinispan-remote/src/main/java/org/hibernate/ogm/datastore/infinispanremote/configuration/impl/InfinispanRemoteConfiguration.java | InfinispanRemoteConfiguration.initConfiguration | public void initConfiguration(Map<?, ?> configurationMap, ServiceRegistryImplementor serviceRegistry) {
"""
Initialize the internal values from the given {@link Map}.
@param configurationMap
The values to use as configuration
@param serviceRegistry
"""
ClassLoaderService classLoaderService = serviceRegistry.getService( ClassLoaderService.class );
ConfigurationPropertyReader propertyReader = new ConfigurationPropertyReader( configurationMap, classLoaderService );
this.configurationResource = propertyReader
.property( InfinispanRemoteProperties.CONFIGURATION_RESOURCE_NAME, URL.class )
.withDefaultStringValue( InfinispanRemoteProperties.DEFAULT_CONFIGURATION_RESOURCE_NAME )
.getValue();
this.clientProperties = getHotRodConfiguration( configurationMap, propertyReader, this.configurationResource );
this.schemaCaptureService = propertyReader
.property( InfinispanRemoteProperties.SCHEMA_CAPTURE_SERVICE, SchemaCapture.class )
.instantiate()
.getValue();
this.schemaOverrideService = propertyReader
.property( InfinispanRemoteProperties.SCHEMA_OVERRIDE_SERVICE, SchemaOverride.class )
.instantiate()
.getValue();
this.schemaOverrideResource = propertyReader
.property( InfinispanRemoteProperties.SCHEMA_OVERRIDE_RESOURCE, URL.class )
.getValue();
this.schemaPackageName = propertyReader
.property( InfinispanRemoteProperties.SCHEMA_PACKAGE_NAME, String.class )
.withDefault( InfinispanRemoteProperties.DEFAULT_SCHEMA_PACKAGE_NAME )
.getValue();
this.schemaFileName = propertyReader
.property( InfinispanRemoteProperties.SCHEMA_FILE_NAME, String.class )
.withDefault( InfinispanRemoteProperties.DEFAULT_SCHEMA_FILE_NAME )
.withValidator( InfinispanRemoteValidators.SCHEMA_FILE_NAME )
.getValue();
this.createCachesEnabled = propertyReader
.property( OgmProperties.CREATE_DATABASE, boolean.class )
.withDefault( false )
.getValue();
this.cacheConfiguration = propertyReader
.property( InfinispanRemoteProperties.CACHE_CONFIGURATION, String.class )
.withDefault( null )
.getValue();
String transactionModeString = propertyReader
.property( InfinispanRemoteProperties.TRANSACTION_MODE, String.class )
.withDefault( InfinispanRemoteProperties.DEFAULT_TRANSACTION_MODE )
.getValue();
this.transactionMode = extractTransactionMode( transactionModeString );
log.tracef( "Initializing Infinispan Hot Rod client from configuration file at '%1$s'", configurationResource );
} | java | public void initConfiguration(Map<?, ?> configurationMap, ServiceRegistryImplementor serviceRegistry) {
ClassLoaderService classLoaderService = serviceRegistry.getService( ClassLoaderService.class );
ConfigurationPropertyReader propertyReader = new ConfigurationPropertyReader( configurationMap, classLoaderService );
this.configurationResource = propertyReader
.property( InfinispanRemoteProperties.CONFIGURATION_RESOURCE_NAME, URL.class )
.withDefaultStringValue( InfinispanRemoteProperties.DEFAULT_CONFIGURATION_RESOURCE_NAME )
.getValue();
this.clientProperties = getHotRodConfiguration( configurationMap, propertyReader, this.configurationResource );
this.schemaCaptureService = propertyReader
.property( InfinispanRemoteProperties.SCHEMA_CAPTURE_SERVICE, SchemaCapture.class )
.instantiate()
.getValue();
this.schemaOverrideService = propertyReader
.property( InfinispanRemoteProperties.SCHEMA_OVERRIDE_SERVICE, SchemaOverride.class )
.instantiate()
.getValue();
this.schemaOverrideResource = propertyReader
.property( InfinispanRemoteProperties.SCHEMA_OVERRIDE_RESOURCE, URL.class )
.getValue();
this.schemaPackageName = propertyReader
.property( InfinispanRemoteProperties.SCHEMA_PACKAGE_NAME, String.class )
.withDefault( InfinispanRemoteProperties.DEFAULT_SCHEMA_PACKAGE_NAME )
.getValue();
this.schemaFileName = propertyReader
.property( InfinispanRemoteProperties.SCHEMA_FILE_NAME, String.class )
.withDefault( InfinispanRemoteProperties.DEFAULT_SCHEMA_FILE_NAME )
.withValidator( InfinispanRemoteValidators.SCHEMA_FILE_NAME )
.getValue();
this.createCachesEnabled = propertyReader
.property( OgmProperties.CREATE_DATABASE, boolean.class )
.withDefault( false )
.getValue();
this.cacheConfiguration = propertyReader
.property( InfinispanRemoteProperties.CACHE_CONFIGURATION, String.class )
.withDefault( null )
.getValue();
String transactionModeString = propertyReader
.property( InfinispanRemoteProperties.TRANSACTION_MODE, String.class )
.withDefault( InfinispanRemoteProperties.DEFAULT_TRANSACTION_MODE )
.getValue();
this.transactionMode = extractTransactionMode( transactionModeString );
log.tracef( "Initializing Infinispan Hot Rod client from configuration file at '%1$s'", configurationResource );
} | [
"public",
"void",
"initConfiguration",
"(",
"Map",
"<",
"?",
",",
"?",
">",
"configurationMap",
",",
"ServiceRegistryImplementor",
"serviceRegistry",
")",
"{",
"ClassLoaderService",
"classLoaderService",
"=",
"serviceRegistry",
".",
"getService",
"(",
"ClassLoaderService",
".",
"class",
")",
";",
"ConfigurationPropertyReader",
"propertyReader",
"=",
"new",
"ConfigurationPropertyReader",
"(",
"configurationMap",
",",
"classLoaderService",
")",
";",
"this",
".",
"configurationResource",
"=",
"propertyReader",
".",
"property",
"(",
"InfinispanRemoteProperties",
".",
"CONFIGURATION_RESOURCE_NAME",
",",
"URL",
".",
"class",
")",
".",
"withDefaultStringValue",
"(",
"InfinispanRemoteProperties",
".",
"DEFAULT_CONFIGURATION_RESOURCE_NAME",
")",
".",
"getValue",
"(",
")",
";",
"this",
".",
"clientProperties",
"=",
"getHotRodConfiguration",
"(",
"configurationMap",
",",
"propertyReader",
",",
"this",
".",
"configurationResource",
")",
";",
"this",
".",
"schemaCaptureService",
"=",
"propertyReader",
".",
"property",
"(",
"InfinispanRemoteProperties",
".",
"SCHEMA_CAPTURE_SERVICE",
",",
"SchemaCapture",
".",
"class",
")",
".",
"instantiate",
"(",
")",
".",
"getValue",
"(",
")",
";",
"this",
".",
"schemaOverrideService",
"=",
"propertyReader",
".",
"property",
"(",
"InfinispanRemoteProperties",
".",
"SCHEMA_OVERRIDE_SERVICE",
",",
"SchemaOverride",
".",
"class",
")",
".",
"instantiate",
"(",
")",
".",
"getValue",
"(",
")",
";",
"this",
".",
"schemaOverrideResource",
"=",
"propertyReader",
".",
"property",
"(",
"InfinispanRemoteProperties",
".",
"SCHEMA_OVERRIDE_RESOURCE",
",",
"URL",
".",
"class",
")",
".",
"getValue",
"(",
")",
";",
"this",
".",
"schemaPackageName",
"=",
"propertyReader",
".",
"property",
"(",
"InfinispanRemoteProperties",
".",
"SCHEMA_PACKAGE_NAME",
",",
"String",
".",
"class",
")",
".",
"withDefault",
"(",
"InfinispanRemoteProperties",
".",
"DEFAULT_SCHEMA_PACKAGE_NAME",
")",
".",
"getValue",
"(",
")",
";",
"this",
".",
"schemaFileName",
"=",
"propertyReader",
".",
"property",
"(",
"InfinispanRemoteProperties",
".",
"SCHEMA_FILE_NAME",
",",
"String",
".",
"class",
")",
".",
"withDefault",
"(",
"InfinispanRemoteProperties",
".",
"DEFAULT_SCHEMA_FILE_NAME",
")",
".",
"withValidator",
"(",
"InfinispanRemoteValidators",
".",
"SCHEMA_FILE_NAME",
")",
".",
"getValue",
"(",
")",
";",
"this",
".",
"createCachesEnabled",
"=",
"propertyReader",
".",
"property",
"(",
"OgmProperties",
".",
"CREATE_DATABASE",
",",
"boolean",
".",
"class",
")",
".",
"withDefault",
"(",
"false",
")",
".",
"getValue",
"(",
")",
";",
"this",
".",
"cacheConfiguration",
"=",
"propertyReader",
".",
"property",
"(",
"InfinispanRemoteProperties",
".",
"CACHE_CONFIGURATION",
",",
"String",
".",
"class",
")",
".",
"withDefault",
"(",
"null",
")",
".",
"getValue",
"(",
")",
";",
"String",
"transactionModeString",
"=",
"propertyReader",
".",
"property",
"(",
"InfinispanRemoteProperties",
".",
"TRANSACTION_MODE",
",",
"String",
".",
"class",
")",
".",
"withDefault",
"(",
"InfinispanRemoteProperties",
".",
"DEFAULT_TRANSACTION_MODE",
")",
".",
"getValue",
"(",
")",
";",
"this",
".",
"transactionMode",
"=",
"extractTransactionMode",
"(",
"transactionModeString",
")",
";",
"log",
".",
"tracef",
"(",
"\"Initializing Infinispan Hot Rod client from configuration file at '%1$s'\"",
",",
"configurationResource",
")",
";",
"}"
] | Initialize the internal values from the given {@link Map}.
@param configurationMap
The values to use as configuration
@param serviceRegistry | [
"Initialize",
"the",
"internal",
"values",
"from",
"the",
"given",
"{",
"@link",
"Map",
"}",
"."
] | train | https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/infinispan-remote/src/main/java/org/hibernate/ogm/datastore/infinispanremote/configuration/impl/InfinispanRemoteConfiguration.java#L186-L240 |
Azure/azure-sdk-for-java | labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/GlobalUsersInner.java | GlobalUsersInner.getOperationStatusAsync | public Observable<OperationStatusResponseInner> getOperationStatusAsync(String userName, String operationUrl) {
"""
Gets the status of long running operation.
@param userName The name of the user.
@param operationUrl The operation url of long running operation
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the OperationStatusResponseInner object
"""
return getOperationStatusWithServiceResponseAsync(userName, operationUrl).map(new Func1<ServiceResponse<OperationStatusResponseInner>, OperationStatusResponseInner>() {
@Override
public OperationStatusResponseInner call(ServiceResponse<OperationStatusResponseInner> response) {
return response.body();
}
});
} | java | public Observable<OperationStatusResponseInner> getOperationStatusAsync(String userName, String operationUrl) {
return getOperationStatusWithServiceResponseAsync(userName, operationUrl).map(new Func1<ServiceResponse<OperationStatusResponseInner>, OperationStatusResponseInner>() {
@Override
public OperationStatusResponseInner call(ServiceResponse<OperationStatusResponseInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"OperationStatusResponseInner",
">",
"getOperationStatusAsync",
"(",
"String",
"userName",
",",
"String",
"operationUrl",
")",
"{",
"return",
"getOperationStatusWithServiceResponseAsync",
"(",
"userName",
",",
"operationUrl",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"OperationStatusResponseInner",
">",
",",
"OperationStatusResponseInner",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"OperationStatusResponseInner",
"call",
"(",
"ServiceResponse",
"<",
"OperationStatusResponseInner",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Gets the status of long running operation.
@param userName The name of the user.
@param operationUrl The operation url of long running operation
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the OperationStatusResponseInner object | [
"Gets",
"the",
"status",
"of",
"long",
"running",
"operation",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/GlobalUsersInner.java#L407-L414 |
undertow-io/undertow | core/src/main/java/io/undertow/websockets/core/WebSockets.java | WebSockets.sendText | public static <T> void sendText(final PooledByteBuffer pooledData, final WebSocketChannel wsChannel, final WebSocketCallback<T> callback, T context, long timeoutmillis) {
"""
Sends a complete text message, invoking the callback when complete
Automatically frees the pooled byte buffer when done.
@param pooledData The data to send, it will be freed when done
@param wsChannel The web socket channel
@param callback The callback to invoke on completion
@param context The context object that will be passed to the callback on completion
@param timeoutmillis the timeout in milliseconds
"""
sendInternal(pooledData, WebSocketFrameType.TEXT, wsChannel, callback, context, timeoutmillis);
} | java | public static <T> void sendText(final PooledByteBuffer pooledData, final WebSocketChannel wsChannel, final WebSocketCallback<T> callback, T context, long timeoutmillis) {
sendInternal(pooledData, WebSocketFrameType.TEXT, wsChannel, callback, context, timeoutmillis);
} | [
"public",
"static",
"<",
"T",
">",
"void",
"sendText",
"(",
"final",
"PooledByteBuffer",
"pooledData",
",",
"final",
"WebSocketChannel",
"wsChannel",
",",
"final",
"WebSocketCallback",
"<",
"T",
">",
"callback",
",",
"T",
"context",
",",
"long",
"timeoutmillis",
")",
"{",
"sendInternal",
"(",
"pooledData",
",",
"WebSocketFrameType",
".",
"TEXT",
",",
"wsChannel",
",",
"callback",
",",
"context",
",",
"timeoutmillis",
")",
";",
"}"
] | Sends a complete text message, invoking the callback when complete
Automatically frees the pooled byte buffer when done.
@param pooledData The data to send, it will be freed when done
@param wsChannel The web socket channel
@param callback The callback to invoke on completion
@param context The context object that will be passed to the callback on completion
@param timeoutmillis the timeout in milliseconds | [
"Sends",
"a",
"complete",
"text",
"message",
"invoking",
"the",
"callback",
"when",
"complete",
"Automatically",
"frees",
"the",
"pooled",
"byte",
"buffer",
"when",
"done",
"."
] | train | https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/websockets/core/WebSockets.java#L188-L190 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/PublicIPPrefixesInner.java | PublicIPPrefixesInner.getByResourceGroupAsync | public Observable<PublicIPPrefixInner> getByResourceGroupAsync(String resourceGroupName, String publicIpPrefixName) {
"""
Gets the specified public IP prefix in a specified resource group.
@param resourceGroupName The name of the resource group.
@param publicIpPrefixName The name of the PublicIPPrefx.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PublicIPPrefixInner object
"""
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, publicIpPrefixName).map(new Func1<ServiceResponse<PublicIPPrefixInner>, PublicIPPrefixInner>() {
@Override
public PublicIPPrefixInner call(ServiceResponse<PublicIPPrefixInner> response) {
return response.body();
}
});
} | java | public Observable<PublicIPPrefixInner> getByResourceGroupAsync(String resourceGroupName, String publicIpPrefixName) {
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, publicIpPrefixName).map(new Func1<ServiceResponse<PublicIPPrefixInner>, PublicIPPrefixInner>() {
@Override
public PublicIPPrefixInner call(ServiceResponse<PublicIPPrefixInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"PublicIPPrefixInner",
">",
"getByResourceGroupAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"publicIpPrefixName",
")",
"{",
"return",
"getByResourceGroupWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"publicIpPrefixName",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"PublicIPPrefixInner",
">",
",",
"PublicIPPrefixInner",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"PublicIPPrefixInner",
"call",
"(",
"ServiceResponse",
"<",
"PublicIPPrefixInner",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Gets the specified public IP prefix in a specified resource group.
@param resourceGroupName The name of the resource group.
@param publicIpPrefixName The name of the PublicIPPrefx.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PublicIPPrefixInner object | [
"Gets",
"the",
"specified",
"public",
"IP",
"prefix",
"in",
"a",
"specified",
"resource",
"group",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/PublicIPPrefixesInner.java#L302-L309 |
mfornos/humanize | humanize-icu/src/main/java/humanize/ICUHumanize.java | ICUHumanize.withinLocale | private static <T> T withinLocale(final Callable<T> operation, final Locale locale) {
"""
<p>
Wraps the given operation on a context with the specified locale.
</p>
@param operation
Operation to be performed
@param locale
Target locale
@return Result of the operation
"""
DefaultICUContext ctx = context.get();
Locale oldLocale = ctx.getLocale();
try
{
ctx.setLocale(locale);
return operation.call();
} catch (Exception e)
{
throw new RuntimeException(e);
} finally
{
ctx.setLocale(oldLocale);
context.set(ctx);
}
} | java | private static <T> T withinLocale(final Callable<T> operation, final Locale locale)
{
DefaultICUContext ctx = context.get();
Locale oldLocale = ctx.getLocale();
try
{
ctx.setLocale(locale);
return operation.call();
} catch (Exception e)
{
throw new RuntimeException(e);
} finally
{
ctx.setLocale(oldLocale);
context.set(ctx);
}
} | [
"private",
"static",
"<",
"T",
">",
"T",
"withinLocale",
"(",
"final",
"Callable",
"<",
"T",
">",
"operation",
",",
"final",
"Locale",
"locale",
")",
"{",
"DefaultICUContext",
"ctx",
"=",
"context",
".",
"get",
"(",
")",
";",
"Locale",
"oldLocale",
"=",
"ctx",
".",
"getLocale",
"(",
")",
";",
"try",
"{",
"ctx",
".",
"setLocale",
"(",
"locale",
")",
";",
"return",
"operation",
".",
"call",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"e",
")",
";",
"}",
"finally",
"{",
"ctx",
".",
"setLocale",
"(",
"oldLocale",
")",
";",
"context",
".",
"set",
"(",
"ctx",
")",
";",
"}",
"}"
] | <p>
Wraps the given operation on a context with the specified locale.
</p>
@param operation
Operation to be performed
@param locale
Target locale
@return Result of the operation | [
"<p",
">",
"Wraps",
"the",
"given",
"operation",
"on",
"a",
"context",
"with",
"the",
"specified",
"locale",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/mfornos/humanize/blob/59fc103045de9d217c9e77dbcb7621f992f46c63/humanize-icu/src/main/java/humanize/ICUHumanize.java#L1777-L1794 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SameDiff.java | SameDiff.putOrUpdateShapeForVarName | @Deprecated
public void putOrUpdateShapeForVarName(String varName, long[] shape, boolean clearArrayOnShapeMismatch) {
"""
Put or update the shape for the given variable name. Optionally supports clearing the specified variable's
INDArray if it's shape does not match the new shape
@param varName Variable name
@param shape Shape to put
@param clearArrayOnShapeMismatch If false: no change to arrays. If true: if an INDArray is defined for the specified
variable name, it will be removed from the graph (to be later re-generated) if
its shape does not match the specified shape
"""
Preconditions.checkNotNull(shape, "Cannot put null shape for variable: %s", varName);
if(variableNameToShape.containsKey(varName)){
// updateShapeForVarName(varName, shape, clearArrayOnShapeMismatch);
//TODO
} else {
putShapeForVarName(varName, shape);
}
} | java | @Deprecated
public void putOrUpdateShapeForVarName(String varName, long[] shape, boolean clearArrayOnShapeMismatch){
Preconditions.checkNotNull(shape, "Cannot put null shape for variable: %s", varName);
if(variableNameToShape.containsKey(varName)){
// updateShapeForVarName(varName, shape, clearArrayOnShapeMismatch);
//TODO
} else {
putShapeForVarName(varName, shape);
}
} | [
"@",
"Deprecated",
"public",
"void",
"putOrUpdateShapeForVarName",
"(",
"String",
"varName",
",",
"long",
"[",
"]",
"shape",
",",
"boolean",
"clearArrayOnShapeMismatch",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"shape",
",",
"\"Cannot put null shape for variable: %s\"",
",",
"varName",
")",
";",
"if",
"(",
"variableNameToShape",
".",
"containsKey",
"(",
"varName",
")",
")",
"{",
"// updateShapeForVarName(varName, shape, clearArrayOnShapeMismatch);",
"//TODO",
"}",
"else",
"{",
"putShapeForVarName",
"(",
"varName",
",",
"shape",
")",
";",
"}",
"}"
] | Put or update the shape for the given variable name. Optionally supports clearing the specified variable's
INDArray if it's shape does not match the new shape
@param varName Variable name
@param shape Shape to put
@param clearArrayOnShapeMismatch If false: no change to arrays. If true: if an INDArray is defined for the specified
variable name, it will be removed from the graph (to be later re-generated) if
its shape does not match the specified shape | [
"Put",
"or",
"update",
"the",
"shape",
"for",
"the",
"given",
"variable",
"name",
".",
"Optionally",
"supports",
"clearing",
"the",
"specified",
"variable",
"s",
"INDArray",
"if",
"it",
"s",
"shape",
"does",
"not",
"match",
"the",
"new",
"shape"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SameDiff.java#L690-L699 |
sirensolutions/siren-join | src/main/java/solutions/siren/join/action/terms/collector/NumericTermStream.java | NumericTermStream.get | public static NumericTermStream get(IndexReader reader, IndexFieldData indexFieldData) {
"""
Instantiates a new reusable {@link NumericTermStream} based on the field type.
"""
if (indexFieldData instanceof IndexNumericFieldData) {
IndexNumericFieldData numFieldData = (IndexNumericFieldData) indexFieldData;
if (!numFieldData.getNumericType().isFloatingPoint()) {
return new LongTermStream(reader, numFieldData);
}
else {
throw new UnsupportedOperationException("Streaming floating points is unsupported");
}
}
else {
return new HashTermStream(reader, indexFieldData);
}
} | java | public static NumericTermStream get(IndexReader reader, IndexFieldData indexFieldData) {
if (indexFieldData instanceof IndexNumericFieldData) {
IndexNumericFieldData numFieldData = (IndexNumericFieldData) indexFieldData;
if (!numFieldData.getNumericType().isFloatingPoint()) {
return new LongTermStream(reader, numFieldData);
}
else {
throw new UnsupportedOperationException("Streaming floating points is unsupported");
}
}
else {
return new HashTermStream(reader, indexFieldData);
}
} | [
"public",
"static",
"NumericTermStream",
"get",
"(",
"IndexReader",
"reader",
",",
"IndexFieldData",
"indexFieldData",
")",
"{",
"if",
"(",
"indexFieldData",
"instanceof",
"IndexNumericFieldData",
")",
"{",
"IndexNumericFieldData",
"numFieldData",
"=",
"(",
"IndexNumericFieldData",
")",
"indexFieldData",
";",
"if",
"(",
"!",
"numFieldData",
".",
"getNumericType",
"(",
")",
".",
"isFloatingPoint",
"(",
")",
")",
"{",
"return",
"new",
"LongTermStream",
"(",
"reader",
",",
"numFieldData",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"UnsupportedOperationException",
"(",
"\"Streaming floating points is unsupported\"",
")",
";",
"}",
"}",
"else",
"{",
"return",
"new",
"HashTermStream",
"(",
"reader",
",",
"indexFieldData",
")",
";",
"}",
"}"
] | Instantiates a new reusable {@link NumericTermStream} based on the field type. | [
"Instantiates",
"a",
"new",
"reusable",
"{"
] | train | https://github.com/sirensolutions/siren-join/blob/cba1111b209ce6f72ab7750d5488a573a6c77fe5/src/main/java/solutions/siren/join/action/terms/collector/NumericTermStream.java#L38-L51 |
google/closure-compiler | src/com/google/javascript/jscomp/CollapseProperties.java | CollapseProperties.flattenSimpleStubDeclaration | private void flattenSimpleStubDeclaration(Name name, String alias) {
"""
Flattens a stub declaration.
This is mostly a hack to support legacy users.
"""
Ref ref = Iterables.getOnlyElement(name.getRefs());
Node nameNode = NodeUtil.newName(compiler, alias, ref.getNode(), name.getFullName());
Node varNode = IR.var(nameNode).useSourceInfoIfMissingFrom(nameNode);
checkState(ref.getNode().getParent().isExprResult());
Node parent = ref.getNode().getParent();
Node grandparent = parent.getParent();
grandparent.replaceChild(parent, varNode);
compiler.reportChangeToEnclosingScope(varNode);
} | java | private void flattenSimpleStubDeclaration(Name name, String alias) {
Ref ref = Iterables.getOnlyElement(name.getRefs());
Node nameNode = NodeUtil.newName(compiler, alias, ref.getNode(), name.getFullName());
Node varNode = IR.var(nameNode).useSourceInfoIfMissingFrom(nameNode);
checkState(ref.getNode().getParent().isExprResult());
Node parent = ref.getNode().getParent();
Node grandparent = parent.getParent();
grandparent.replaceChild(parent, varNode);
compiler.reportChangeToEnclosingScope(varNode);
} | [
"private",
"void",
"flattenSimpleStubDeclaration",
"(",
"Name",
"name",
",",
"String",
"alias",
")",
"{",
"Ref",
"ref",
"=",
"Iterables",
".",
"getOnlyElement",
"(",
"name",
".",
"getRefs",
"(",
")",
")",
";",
"Node",
"nameNode",
"=",
"NodeUtil",
".",
"newName",
"(",
"compiler",
",",
"alias",
",",
"ref",
".",
"getNode",
"(",
")",
",",
"name",
".",
"getFullName",
"(",
")",
")",
";",
"Node",
"varNode",
"=",
"IR",
".",
"var",
"(",
"nameNode",
")",
".",
"useSourceInfoIfMissingFrom",
"(",
"nameNode",
")",
";",
"checkState",
"(",
"ref",
".",
"getNode",
"(",
")",
".",
"getParent",
"(",
")",
".",
"isExprResult",
"(",
")",
")",
";",
"Node",
"parent",
"=",
"ref",
".",
"getNode",
"(",
")",
".",
"getParent",
"(",
")",
";",
"Node",
"grandparent",
"=",
"parent",
".",
"getParent",
"(",
")",
";",
"grandparent",
".",
"replaceChild",
"(",
"parent",
",",
"varNode",
")",
";",
"compiler",
".",
"reportChangeToEnclosingScope",
"(",
"varNode",
")",
";",
"}"
] | Flattens a stub declaration.
This is mostly a hack to support legacy users. | [
"Flattens",
"a",
"stub",
"declaration",
".",
"This",
"is",
"mostly",
"a",
"hack",
"to",
"support",
"legacy",
"users",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/CollapseProperties.java#L274-L284 |
facebook/fresco | drawee/src/main/java/com/facebook/drawee/generic/GenericDraweeHierarchy.java | GenericDraweeHierarchy.setFailureImage | public void setFailureImage(int resourceId, ScalingUtils.ScaleType scaleType) {
"""
Sets a new failure drawable with scale type.
@param resourceId an identifier of an Android drawable or color resource.
@param ScalingUtils.ScaleType a new scale type.
"""
setFailureImage(mResources.getDrawable(resourceId), scaleType);
} | java | public void setFailureImage(int resourceId, ScalingUtils.ScaleType scaleType) {
setFailureImage(mResources.getDrawable(resourceId), scaleType);
} | [
"public",
"void",
"setFailureImage",
"(",
"int",
"resourceId",
",",
"ScalingUtils",
".",
"ScaleType",
"scaleType",
")",
"{",
"setFailureImage",
"(",
"mResources",
".",
"getDrawable",
"(",
"resourceId",
")",
",",
"scaleType",
")",
";",
"}"
] | Sets a new failure drawable with scale type.
@param resourceId an identifier of an Android drawable or color resource.
@param ScalingUtils.ScaleType a new scale type. | [
"Sets",
"a",
"new",
"failure",
"drawable",
"with",
"scale",
"type",
"."
] | train | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/drawee/src/main/java/com/facebook/drawee/generic/GenericDraweeHierarchy.java#L483-L485 |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/query/dsl/functions/DateFunctions.java | DateFunctions.dateDiffMillis | public static Expression dateDiffMillis(String expression1, String expression2, DatePart part) {
"""
Returned expression results in Date arithmetic.
Returns the elapsed time between two UNIX timestamps as an integer whose unit is part.
"""
return dateDiffMillis(x(expression1), x(expression2), part);
} | java | public static Expression dateDiffMillis(String expression1, String expression2, DatePart part) {
return dateDiffMillis(x(expression1), x(expression2), part);
} | [
"public",
"static",
"Expression",
"dateDiffMillis",
"(",
"String",
"expression1",
",",
"String",
"expression2",
",",
"DatePart",
"part",
")",
"{",
"return",
"dateDiffMillis",
"(",
"x",
"(",
"expression1",
")",
",",
"x",
"(",
"expression2",
")",
",",
"part",
")",
";",
"}"
] | Returned expression results in Date arithmetic.
Returns the elapsed time between two UNIX timestamps as an integer whose unit is part. | [
"Returned",
"expression",
"results",
"in",
"Date",
"arithmetic",
".",
"Returns",
"the",
"elapsed",
"time",
"between",
"two",
"UNIX",
"timestamps",
"as",
"an",
"integer",
"whose",
"unit",
"is",
"part",
"."
] | train | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/functions/DateFunctions.java#L115-L117 |
SonarSource/sonarqube | server/sonar-ce/src/main/java/org/sonar/ce/app/CeServer.java | CeServer.main | public static void main(String[] args) {
"""
Can't be started as is. Needs to be bootstrapped by sonar-application
"""
ProcessEntryPoint entryPoint = ProcessEntryPoint.createForArguments(args);
Props props = entryPoint.getProps();
new CeProcessLogging().configure(props);
CeServer server = new CeServer(
new ComputeEngineImpl(props, new ComputeEngineContainerImpl()),
new MinimumViableSystem());
entryPoint.launch(server);
} | java | public static void main(String[] args) {
ProcessEntryPoint entryPoint = ProcessEntryPoint.createForArguments(args);
Props props = entryPoint.getProps();
new CeProcessLogging().configure(props);
CeServer server = new CeServer(
new ComputeEngineImpl(props, new ComputeEngineContainerImpl()),
new MinimumViableSystem());
entryPoint.launch(server);
} | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"{",
"ProcessEntryPoint",
"entryPoint",
"=",
"ProcessEntryPoint",
".",
"createForArguments",
"(",
"args",
")",
";",
"Props",
"props",
"=",
"entryPoint",
".",
"getProps",
"(",
")",
";",
"new",
"CeProcessLogging",
"(",
")",
".",
"configure",
"(",
"props",
")",
";",
"CeServer",
"server",
"=",
"new",
"CeServer",
"(",
"new",
"ComputeEngineImpl",
"(",
"props",
",",
"new",
"ComputeEngineContainerImpl",
"(",
")",
")",
",",
"new",
"MinimumViableSystem",
"(",
")",
")",
";",
"entryPoint",
".",
"launch",
"(",
"server",
")",
";",
"}"
] | Can't be started as is. Needs to be bootstrapped by sonar-application | [
"Can",
"t",
"be",
"started",
"as",
"is",
".",
"Needs",
"to",
"be",
"bootstrapped",
"by",
"sonar",
"-",
"application"
] | train | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-ce/src/main/java/org/sonar/ce/app/CeServer.java#L119-L127 |
bwkimmel/jdcp | jdcp-worker/src/main/java/ca/eandb/jdcp/worker/DbCachingJobServiceClassLoaderStrategy.java | DbCachingJobServiceClassLoaderStrategy.prepareDataSource | public static void prepareDataSource(DataSource ds) throws SQLException {
"""
Prepares the data source to store cached class definitions.
@param ds The <code>DataSource</code> to prepare.
@throws SQLException If an error occurs while communicating with the
database.
"""
Connection con = null;
String sql;
try {
con = ds.getConnection();
con.setAutoCommit(false);
DatabaseMetaData meta = con.getMetaData();
ResultSet rs = meta.getTables(null, null, null, new String[]{"TABLE"});
int tableNameColumn = rs.findColumn("TABLE_NAME");
int count = 0;
while (rs.next()) {
String tableName = rs.getString(tableNameColumn);
if (tableName.equalsIgnoreCase("CachedClasses")) {
count++;
}
}
if (count == 0) {
String blobType = DbUtil.getTypeName(Types.BLOB, con);
String nameType = DbUtil.getTypeName(Types.VARCHAR, 1024, con);
String md5Type = DbUtil.getTypeName(Types.BINARY, 16, con);
sql = "CREATE TABLE CachedClasses ( \n" +
" Name " + nameType + " NOT NULL, \n" +
" MD5 " + md5Type + " NOT NULL, \n" +
" Definition " + blobType + " NOT NULL, \n" +
" PRIMARY KEY (Name, MD5) \n" +
")";
DbUtil.update(ds, sql);
con.commit();
}
con.setAutoCommit(true);
} catch (SQLException e) {
DbUtil.rollback(con);
throw e;
} finally {
DbUtil.close(con);
}
} | java | public static void prepareDataSource(DataSource ds) throws SQLException {
Connection con = null;
String sql;
try {
con = ds.getConnection();
con.setAutoCommit(false);
DatabaseMetaData meta = con.getMetaData();
ResultSet rs = meta.getTables(null, null, null, new String[]{"TABLE"});
int tableNameColumn = rs.findColumn("TABLE_NAME");
int count = 0;
while (rs.next()) {
String tableName = rs.getString(tableNameColumn);
if (tableName.equalsIgnoreCase("CachedClasses")) {
count++;
}
}
if (count == 0) {
String blobType = DbUtil.getTypeName(Types.BLOB, con);
String nameType = DbUtil.getTypeName(Types.VARCHAR, 1024, con);
String md5Type = DbUtil.getTypeName(Types.BINARY, 16, con);
sql = "CREATE TABLE CachedClasses ( \n" +
" Name " + nameType + " NOT NULL, \n" +
" MD5 " + md5Type + " NOT NULL, \n" +
" Definition " + blobType + " NOT NULL, \n" +
" PRIMARY KEY (Name, MD5) \n" +
")";
DbUtil.update(ds, sql);
con.commit();
}
con.setAutoCommit(true);
} catch (SQLException e) {
DbUtil.rollback(con);
throw e;
} finally {
DbUtil.close(con);
}
} | [
"public",
"static",
"void",
"prepareDataSource",
"(",
"DataSource",
"ds",
")",
"throws",
"SQLException",
"{",
"Connection",
"con",
"=",
"null",
";",
"String",
"sql",
";",
"try",
"{",
"con",
"=",
"ds",
".",
"getConnection",
"(",
")",
";",
"con",
".",
"setAutoCommit",
"(",
"false",
")",
";",
"DatabaseMetaData",
"meta",
"=",
"con",
".",
"getMetaData",
"(",
")",
";",
"ResultSet",
"rs",
"=",
"meta",
".",
"getTables",
"(",
"null",
",",
"null",
",",
"null",
",",
"new",
"String",
"[",
"]",
"{",
"\"TABLE\"",
"}",
")",
";",
"int",
"tableNameColumn",
"=",
"rs",
".",
"findColumn",
"(",
"\"TABLE_NAME\"",
")",
";",
"int",
"count",
"=",
"0",
";",
"while",
"(",
"rs",
".",
"next",
"(",
")",
")",
"{",
"String",
"tableName",
"=",
"rs",
".",
"getString",
"(",
"tableNameColumn",
")",
";",
"if",
"(",
"tableName",
".",
"equalsIgnoreCase",
"(",
"\"CachedClasses\"",
")",
")",
"{",
"count",
"++",
";",
"}",
"}",
"if",
"(",
"count",
"==",
"0",
")",
"{",
"String",
"blobType",
"=",
"DbUtil",
".",
"getTypeName",
"(",
"Types",
".",
"BLOB",
",",
"con",
")",
";",
"String",
"nameType",
"=",
"DbUtil",
".",
"getTypeName",
"(",
"Types",
".",
"VARCHAR",
",",
"1024",
",",
"con",
")",
";",
"String",
"md5Type",
"=",
"DbUtil",
".",
"getTypeName",
"(",
"Types",
".",
"BINARY",
",",
"16",
",",
"con",
")",
";",
"sql",
"=",
"\"CREATE TABLE CachedClasses ( \\n\"",
"+",
"\" Name \"",
"+",
"nameType",
"+",
"\" NOT NULL, \\n\"",
"+",
"\" MD5 \"",
"+",
"md5Type",
"+",
"\" NOT NULL, \\n\"",
"+",
"\" Definition \"",
"+",
"blobType",
"+",
"\" NOT NULL, \\n\"",
"+",
"\" PRIMARY KEY (Name, MD5) \\n\"",
"+",
"\")\"",
";",
"DbUtil",
".",
"update",
"(",
"ds",
",",
"sql",
")",
";",
"con",
".",
"commit",
"(",
")",
";",
"}",
"con",
".",
"setAutoCommit",
"(",
"true",
")",
";",
"}",
"catch",
"(",
"SQLException",
"e",
")",
"{",
"DbUtil",
".",
"rollback",
"(",
"con",
")",
";",
"throw",
"e",
";",
"}",
"finally",
"{",
"DbUtil",
".",
"close",
"(",
"con",
")",
";",
"}",
"}"
] | Prepares the data source to store cached class definitions.
@param ds The <code>DataSource</code> to prepare.
@throws SQLException If an error occurs while communicating with the
database. | [
"Prepares",
"the",
"data",
"source",
"to",
"store",
"cached",
"class",
"definitions",
"."
] | train | https://github.com/bwkimmel/jdcp/blob/630c5150c245054e2556ff370f4bad2ec793dfb7/jdcp-worker/src/main/java/ca/eandb/jdcp/worker/DbCachingJobServiceClassLoaderStrategy.java#L63-L103 |
olivergondza/dumpling | core/src/main/java/com/github/olivergondza/dumpling/model/ProcessThread.java | ProcessThread.waitingOnLock | public static @Nonnull Predicate waitingOnLock(final @Nonnull String className) {
"""
Match waiting thread waiting for given thread to be notified.
"""
return new Predicate() {
@Override
public boolean isValid(@Nonnull ProcessThread<?, ?, ?> thread) {
final ThreadLock lock = thread.getWaitingOnLock();
return lock != null && lock.getClassName().equals(className);
}
};
} | java | public static @Nonnull Predicate waitingOnLock(final @Nonnull String className) {
return new Predicate() {
@Override
public boolean isValid(@Nonnull ProcessThread<?, ?, ?> thread) {
final ThreadLock lock = thread.getWaitingOnLock();
return lock != null && lock.getClassName().equals(className);
}
};
} | [
"public",
"static",
"@",
"Nonnull",
"Predicate",
"waitingOnLock",
"(",
"final",
"@",
"Nonnull",
"String",
"className",
")",
"{",
"return",
"new",
"Predicate",
"(",
")",
"{",
"@",
"Override",
"public",
"boolean",
"isValid",
"(",
"@",
"Nonnull",
"ProcessThread",
"<",
"?",
",",
"?",
",",
"?",
">",
"thread",
")",
"{",
"final",
"ThreadLock",
"lock",
"=",
"thread",
".",
"getWaitingOnLock",
"(",
")",
";",
"return",
"lock",
"!=",
"null",
"&&",
"lock",
".",
"getClassName",
"(",
")",
".",
"equals",
"(",
"className",
")",
";",
"}",
"}",
";",
"}"
] | Match waiting thread waiting for given thread to be notified. | [
"Match",
"waiting",
"thread",
"waiting",
"for",
"given",
"thread",
"to",
"be",
"notified",
"."
] | train | https://github.com/olivergondza/dumpling/blob/ac698735fcc7c023db0c1637cc1f522cb3576c7f/core/src/main/java/com/github/olivergondza/dumpling/model/ProcessThread.java#L540-L548 |
dkpro/dkpro-statistics | dkpro-statistics-agreement/src/main/java/org/dkpro/statistics/agreement/unitizing/UnitizingAnnotationStudy.java | UnitizingAnnotationStudy.findNextUnit | public static IUnitizingAnnotationUnit findNextUnit(
final Iterator<IUnitizingAnnotationUnit> units, int raterIdx) {
"""
Utility method for moving on the cursor of the given iterator until
a unit of the specified rater is returned.
"""
return findNextUnit(units, raterIdx, null);
} | java | public static IUnitizingAnnotationUnit findNextUnit(
final Iterator<IUnitizingAnnotationUnit> units, int raterIdx) {
return findNextUnit(units, raterIdx, null);
} | [
"public",
"static",
"IUnitizingAnnotationUnit",
"findNextUnit",
"(",
"final",
"Iterator",
"<",
"IUnitizingAnnotationUnit",
">",
"units",
",",
"int",
"raterIdx",
")",
"{",
"return",
"findNextUnit",
"(",
"units",
",",
"raterIdx",
",",
"null",
")",
";",
"}"
] | Utility method for moving on the cursor of the given iterator until
a unit of the specified rater is returned. | [
"Utility",
"method",
"for",
"moving",
"on",
"the",
"cursor",
"of",
"the",
"given",
"iterator",
"until",
"a",
"unit",
"of",
"the",
"specified",
"rater",
"is",
"returned",
"."
] | train | https://github.com/dkpro/dkpro-statistics/blob/0b0e93dc49223984964411cbc6df420ba796a8cb/dkpro-statistics-agreement/src/main/java/org/dkpro/statistics/agreement/unitizing/UnitizingAnnotationStudy.java#L120-L123 |
spotbugs/spotbugs | eclipsePlugin/src/de/tobject/findbugs/FindbugsPlugin.java | FindbugsPlugin.readBugCollectionAndProject | private static void readBugCollectionAndProject(IProject project, IProgressMonitor monitor)
throws IOException, DocumentException, CoreException {
"""
Read saved bug collection and findbugs project from file. Will populate
the bug collection and findbugs project session properties if successful.
If there is no saved bug collection and project for the eclipse project,
then FileNotFoundException will be thrown.
@param project
the eclipse project
@param monitor
a progress monitor
@throws java.io.FileNotFoundException
the saved bug collection doesn't exist
@throws IOException
@throws DocumentException
@throws CoreException
"""
SortedBugCollection bugCollection;
IPath bugCollectionPath = getBugCollectionFile(project);
// Don't turn the path to an IFile because it isn't local to the
// project.
// see the javadoc for org.eclipse.core.runtime.Plugin
File bugCollectionFile = bugCollectionPath.toFile();
if (!bugCollectionFile.exists()) {
// throw new
// FileNotFoundException(bugCollectionFile.getLocation().toOSString());
getDefault().logInfo("creating new bug collection: " + bugCollectionPath.toOSString());
createDefaultEmptyBugCollection(project); // since we no longer
// throw, have to do this
// here
return;
}
UserPreferences prefs = getUserPreferences(project);
bugCollection = new SortedBugCollection();
bugCollection.getProject().setGuiCallback(new EclipseGuiCallback(project));
bugCollection.readXML(bugCollectionFile);
cacheBugCollectionAndProject(project, bugCollection, bugCollection.getProject());
} | java | private static void readBugCollectionAndProject(IProject project, IProgressMonitor monitor)
throws IOException, DocumentException, CoreException {
SortedBugCollection bugCollection;
IPath bugCollectionPath = getBugCollectionFile(project);
// Don't turn the path to an IFile because it isn't local to the
// project.
// see the javadoc for org.eclipse.core.runtime.Plugin
File bugCollectionFile = bugCollectionPath.toFile();
if (!bugCollectionFile.exists()) {
// throw new
// FileNotFoundException(bugCollectionFile.getLocation().toOSString());
getDefault().logInfo("creating new bug collection: " + bugCollectionPath.toOSString());
createDefaultEmptyBugCollection(project); // since we no longer
// throw, have to do this
// here
return;
}
UserPreferences prefs = getUserPreferences(project);
bugCollection = new SortedBugCollection();
bugCollection.getProject().setGuiCallback(new EclipseGuiCallback(project));
bugCollection.readXML(bugCollectionFile);
cacheBugCollectionAndProject(project, bugCollection, bugCollection.getProject());
} | [
"private",
"static",
"void",
"readBugCollectionAndProject",
"(",
"IProject",
"project",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"IOException",
",",
"DocumentException",
",",
"CoreException",
"{",
"SortedBugCollection",
"bugCollection",
";",
"IPath",
"bugCollectionPath",
"=",
"getBugCollectionFile",
"(",
"project",
")",
";",
"// Don't turn the path to an IFile because it isn't local to the",
"// project.",
"// see the javadoc for org.eclipse.core.runtime.Plugin",
"File",
"bugCollectionFile",
"=",
"bugCollectionPath",
".",
"toFile",
"(",
")",
";",
"if",
"(",
"!",
"bugCollectionFile",
".",
"exists",
"(",
")",
")",
"{",
"// throw new",
"// FileNotFoundException(bugCollectionFile.getLocation().toOSString());",
"getDefault",
"(",
")",
".",
"logInfo",
"(",
"\"creating new bug collection: \"",
"+",
"bugCollectionPath",
".",
"toOSString",
"(",
")",
")",
";",
"createDefaultEmptyBugCollection",
"(",
"project",
")",
";",
"// since we no longer",
"// throw, have to do this",
"// here",
"return",
";",
"}",
"UserPreferences",
"prefs",
"=",
"getUserPreferences",
"(",
"project",
")",
";",
"bugCollection",
"=",
"new",
"SortedBugCollection",
"(",
")",
";",
"bugCollection",
".",
"getProject",
"(",
")",
".",
"setGuiCallback",
"(",
"new",
"EclipseGuiCallback",
"(",
"project",
")",
")",
";",
"bugCollection",
".",
"readXML",
"(",
"bugCollectionFile",
")",
";",
"cacheBugCollectionAndProject",
"(",
"project",
",",
"bugCollection",
",",
"bugCollection",
".",
"getProject",
"(",
")",
")",
";",
"}"
] | Read saved bug collection and findbugs project from file. Will populate
the bug collection and findbugs project session properties if successful.
If there is no saved bug collection and project for the eclipse project,
then FileNotFoundException will be thrown.
@param project
the eclipse project
@param monitor
a progress monitor
@throws java.io.FileNotFoundException
the saved bug collection doesn't exist
@throws IOException
@throws DocumentException
@throws CoreException | [
"Read",
"saved",
"bug",
"collection",
"and",
"findbugs",
"project",
"from",
"file",
".",
"Will",
"populate",
"the",
"bug",
"collection",
"and",
"findbugs",
"project",
"session",
"properties",
"if",
"successful",
".",
"If",
"there",
"is",
"no",
"saved",
"bug",
"collection",
"and",
"project",
"for",
"the",
"eclipse",
"project",
"then",
"FileNotFoundException",
"will",
"be",
"thrown",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/eclipsePlugin/src/de/tobject/findbugs/FindbugsPlugin.java#L703-L729 |
pip-services3-java/pip-services3-components-java | src/org/pipservices3/components/config/YamlConfigReader.java | YamlConfigReader.readConfig | public static ConfigParams readConfig(String correlationId, String path, ConfigParams parameters)
throws ApplicationException {
"""
Reads configuration from a file, parameterize it with given values and
returns a new ConfigParams object.
@param correlationId (optional) transaction id to trace execution through
call chain.
@param path a path to configuration file.
@param parameters values to parameters the configuration or null to skip
parameterization.
@return ConfigParams configuration.
@throws ApplicationException when error occured.
"""
return new YamlConfigReader(path).readConfig(correlationId, parameters);
} | java | public static ConfigParams readConfig(String correlationId, String path, ConfigParams parameters)
throws ApplicationException {
return new YamlConfigReader(path).readConfig(correlationId, parameters);
} | [
"public",
"static",
"ConfigParams",
"readConfig",
"(",
"String",
"correlationId",
",",
"String",
"path",
",",
"ConfigParams",
"parameters",
")",
"throws",
"ApplicationException",
"{",
"return",
"new",
"YamlConfigReader",
"(",
"path",
")",
".",
"readConfig",
"(",
"correlationId",
",",
"parameters",
")",
";",
"}"
] | Reads configuration from a file, parameterize it with given values and
returns a new ConfigParams object.
@param correlationId (optional) transaction id to trace execution through
call chain.
@param path a path to configuration file.
@param parameters values to parameters the configuration or null to skip
parameterization.
@return ConfigParams configuration.
@throws ApplicationException when error occured. | [
"Reads",
"configuration",
"from",
"a",
"file",
"parameterize",
"it",
"with",
"given",
"values",
"and",
"returns",
"a",
"new",
"ConfigParams",
"object",
"."
] | train | https://github.com/pip-services3-java/pip-services3-components-java/blob/122352fbf9b208f6417376da7b8ad725bc85ee58/src/org/pipservices3/components/config/YamlConfigReader.java#L130-L133 |
alkacon/opencms-core | src/org/opencms/ui/dataview/CmsDataViewPanel.java | CmsDataViewPanel.refreshData | public void refreshData(boolean resetPaging, String textQuery) {
"""
Updates the data displayed in the table.<p>
@param resetPaging true if we should go back to page 1
@param textQuery the text query to use
"""
String fullTextQuery = textQuery != null ? textQuery : m_fullTextSearch.getValue();
LinkedHashMap<String, String> filterValues = new LinkedHashMap<String, String>();
for (Map.Entry<String, CmsDataViewFilter> entry : m_filterMap.entrySet()) {
filterValues.put(entry.getKey(), entry.getValue().getValue());
}
CmsDataViewQuery query = new CmsDataViewQuery();
String sortCol = (String)m_sortCol;
boolean ascending = m_ascending;
query.setFullTextQuery(fullTextQuery);
query.setFilterValues(filterValues);
query.setSortColumn(sortCol);
query.setSortAscending(ascending);
CmsDataViewResult result = m_dataView.getResults(
query,
resetPaging ? 0 : getOffset(),
m_dataView.getPageSize());
m_container.removeAllItems();
for (I_CmsDataViewItem item : result.getItems()) {
fillItem(item, m_container.addItem(item.getId()));
}
//m_tablePanel.setScrollTop(0);
if (resetPaging) {
int total = result.getHitCount();
m_pagingControls.reset(result.getHitCount(), m_dataView.getPageSize(), false);
}
} | java | public void refreshData(boolean resetPaging, String textQuery) {
String fullTextQuery = textQuery != null ? textQuery : m_fullTextSearch.getValue();
LinkedHashMap<String, String> filterValues = new LinkedHashMap<String, String>();
for (Map.Entry<String, CmsDataViewFilter> entry : m_filterMap.entrySet()) {
filterValues.put(entry.getKey(), entry.getValue().getValue());
}
CmsDataViewQuery query = new CmsDataViewQuery();
String sortCol = (String)m_sortCol;
boolean ascending = m_ascending;
query.setFullTextQuery(fullTextQuery);
query.setFilterValues(filterValues);
query.setSortColumn(sortCol);
query.setSortAscending(ascending);
CmsDataViewResult result = m_dataView.getResults(
query,
resetPaging ? 0 : getOffset(),
m_dataView.getPageSize());
m_container.removeAllItems();
for (I_CmsDataViewItem item : result.getItems()) {
fillItem(item, m_container.addItem(item.getId()));
}
//m_tablePanel.setScrollTop(0);
if (resetPaging) {
int total = result.getHitCount();
m_pagingControls.reset(result.getHitCount(), m_dataView.getPageSize(), false);
}
} | [
"public",
"void",
"refreshData",
"(",
"boolean",
"resetPaging",
",",
"String",
"textQuery",
")",
"{",
"String",
"fullTextQuery",
"=",
"textQuery",
"!=",
"null",
"?",
"textQuery",
":",
"m_fullTextSearch",
".",
"getValue",
"(",
")",
";",
"LinkedHashMap",
"<",
"String",
",",
"String",
">",
"filterValues",
"=",
"new",
"LinkedHashMap",
"<",
"String",
",",
"String",
">",
"(",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"CmsDataViewFilter",
">",
"entry",
":",
"m_filterMap",
".",
"entrySet",
"(",
")",
")",
"{",
"filterValues",
".",
"put",
"(",
"entry",
".",
"getKey",
"(",
")",
",",
"entry",
".",
"getValue",
"(",
")",
".",
"getValue",
"(",
")",
")",
";",
"}",
"CmsDataViewQuery",
"query",
"=",
"new",
"CmsDataViewQuery",
"(",
")",
";",
"String",
"sortCol",
"=",
"(",
"String",
")",
"m_sortCol",
";",
"boolean",
"ascending",
"=",
"m_ascending",
";",
"query",
".",
"setFullTextQuery",
"(",
"fullTextQuery",
")",
";",
"query",
".",
"setFilterValues",
"(",
"filterValues",
")",
";",
"query",
".",
"setSortColumn",
"(",
"sortCol",
")",
";",
"query",
".",
"setSortAscending",
"(",
"ascending",
")",
";",
"CmsDataViewResult",
"result",
"=",
"m_dataView",
".",
"getResults",
"(",
"query",
",",
"resetPaging",
"?",
"0",
":",
"getOffset",
"(",
")",
",",
"m_dataView",
".",
"getPageSize",
"(",
")",
")",
";",
"m_container",
".",
"removeAllItems",
"(",
")",
";",
"for",
"(",
"I_CmsDataViewItem",
"item",
":",
"result",
".",
"getItems",
"(",
")",
")",
"{",
"fillItem",
"(",
"item",
",",
"m_container",
".",
"addItem",
"(",
"item",
".",
"getId",
"(",
")",
")",
")",
";",
"}",
"//m_tablePanel.setScrollTop(0);",
"if",
"(",
"resetPaging",
")",
"{",
"int",
"total",
"=",
"result",
".",
"getHitCount",
"(",
")",
";",
"m_pagingControls",
".",
"reset",
"(",
"result",
".",
"getHitCount",
"(",
")",
",",
"m_dataView",
".",
"getPageSize",
"(",
")",
",",
"false",
")",
";",
"}",
"}"
] | Updates the data displayed in the table.<p>
@param resetPaging true if we should go back to page 1
@param textQuery the text query to use | [
"Updates",
"the",
"data",
"displayed",
"in",
"the",
"table",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/dataview/CmsDataViewPanel.java#L396-L425 |
lucee/Lucee | core/src/main/java/lucee/commons/io/res/type/ram/RamResourceProviderOld.java | RamResourceProviderOld.createCore | RamResourceCore createCore(String path, int type) throws IOException {
"""
create a new core
@param path
@param type
@return created core
@throws IOException
"""
String[] names = ListUtil.listToStringArray(path, '/');
RamResourceCore rrc = root;
for (int i = 0; i < names.length - 1; i++) {
rrc = rrc.getChild(names[i], caseSensitive);
if (rrc == null) throw new IOException("can't create resource " + path + ", missing parent resource");
}
rrc = new RamResourceCore(rrc, type, names[names.length - 1]);
return rrc;
} | java | RamResourceCore createCore(String path, int type) throws IOException {
String[] names = ListUtil.listToStringArray(path, '/');
RamResourceCore rrc = root;
for (int i = 0; i < names.length - 1; i++) {
rrc = rrc.getChild(names[i], caseSensitive);
if (rrc == null) throw new IOException("can't create resource " + path + ", missing parent resource");
}
rrc = new RamResourceCore(rrc, type, names[names.length - 1]);
return rrc;
} | [
"RamResourceCore",
"createCore",
"(",
"String",
"path",
",",
"int",
"type",
")",
"throws",
"IOException",
"{",
"String",
"[",
"]",
"names",
"=",
"ListUtil",
".",
"listToStringArray",
"(",
"path",
",",
"'",
"'",
")",
";",
"RamResourceCore",
"rrc",
"=",
"root",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"names",
".",
"length",
"-",
"1",
";",
"i",
"++",
")",
"{",
"rrc",
"=",
"rrc",
".",
"getChild",
"(",
"names",
"[",
"i",
"]",
",",
"caseSensitive",
")",
";",
"if",
"(",
"rrc",
"==",
"null",
")",
"throw",
"new",
"IOException",
"(",
"\"can't create resource \"",
"+",
"path",
"+",
"\", missing parent resource\"",
")",
";",
"}",
"rrc",
"=",
"new",
"RamResourceCore",
"(",
"rrc",
",",
"type",
",",
"names",
"[",
"names",
".",
"length",
"-",
"1",
"]",
")",
";",
"return",
"rrc",
";",
"}"
] | create a new core
@param path
@param type
@return created core
@throws IOException | [
"create",
"a",
"new",
"core"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/io/res/type/ram/RamResourceProviderOld.java#L110-L119 |
liferay/com-liferay-commerce | commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPInstancePersistenceImpl.java | CPInstancePersistenceImpl.removeByG_NotST | @Override
public void removeByG_NotST(long groupId, int status) {
"""
Removes all the cp instances where groupId = ? and status ≠ ? from the database.
@param groupId the group ID
@param status the status
"""
for (CPInstance cpInstance : findByG_NotST(groupId, status,
QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
remove(cpInstance);
}
} | java | @Override
public void removeByG_NotST(long groupId, int status) {
for (CPInstance cpInstance : findByG_NotST(groupId, status,
QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
remove(cpInstance);
}
} | [
"@",
"Override",
"public",
"void",
"removeByG_NotST",
"(",
"long",
"groupId",
",",
"int",
"status",
")",
"{",
"for",
"(",
"CPInstance",
"cpInstance",
":",
"findByG_NotST",
"(",
"groupId",
",",
"status",
",",
"QueryUtil",
".",
"ALL_POS",
",",
"QueryUtil",
".",
"ALL_POS",
",",
"null",
")",
")",
"{",
"remove",
"(",
"cpInstance",
")",
";",
"}",
"}"
] | Removes all the cp instances where groupId = ? and status ≠ ? from the database.
@param groupId the group ID
@param status the status | [
"Removes",
"all",
"the",
"cp",
"instances",
"where",
"groupId",
"=",
"?",
";",
"and",
"status",
"&ne",
";",
"?",
";",
"from",
"the",
"database",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPInstancePersistenceImpl.java#L4001-L4007 |
bmwcarit/joynr | java/messaging/bounceproxy/bounceproxy-controller/src/main/java/io/joynr/messaging/bounceproxy/controller/RemoteBounceProxyFacade.java | RemoteBounceProxyFacade.createChannelLoop | private URI createChannelLoop(ControlledBounceProxyInformation bpInfo,
String ccid,
String trackingId,
int retries) throws JoynrProtocolException {
"""
Starts a loop to send createChannel requests to a bounce proxy with a
maximum number of retries.
@param bpInfo
information about the bounce proxy to create the channel at
@param ccid
the channel ID for the channel to create
@param trackingId
a tracking ID necessary for long polling
@param retries
the maximum number of retries
@return the url of the channel at the bounce proxy as it was returned by
the bounce proxy itself
@throws JoynrProtocolException
if the bounce proxy rejects channel creation
"""
while (retries > 0) {
retries--;
try {
return sendCreateChannelHttpRequest(bpInfo, ccid, trackingId);
} catch (IOException e) {
// failed to establish communication with the bounce proxy
logger.error("creating a channel on bounce proxy {} failed due to communication errors: message: {}",
bpInfo.getId(),
e.getMessage());
}
// try again if creating the channel failed
try {
Thread.sleep(sendCreateChannelRetryIntervalMs);
} catch (InterruptedException e) {
throw new JoynrRuntimeException("creating a channel on bounce proxy " + bpInfo.getId()
+ " was interrupted.");
}
}
// the maximum number of retries passed, so channel creation failed
throw new JoynrRuntimeException("creating a channel on bounce proxy " + bpInfo.getId() + " failed.");
} | java | private URI createChannelLoop(ControlledBounceProxyInformation bpInfo,
String ccid,
String trackingId,
int retries) throws JoynrProtocolException {
while (retries > 0) {
retries--;
try {
return sendCreateChannelHttpRequest(bpInfo, ccid, trackingId);
} catch (IOException e) {
// failed to establish communication with the bounce proxy
logger.error("creating a channel on bounce proxy {} failed due to communication errors: message: {}",
bpInfo.getId(),
e.getMessage());
}
// try again if creating the channel failed
try {
Thread.sleep(sendCreateChannelRetryIntervalMs);
} catch (InterruptedException e) {
throw new JoynrRuntimeException("creating a channel on bounce proxy " + bpInfo.getId()
+ " was interrupted.");
}
}
// the maximum number of retries passed, so channel creation failed
throw new JoynrRuntimeException("creating a channel on bounce proxy " + bpInfo.getId() + " failed.");
} | [
"private",
"URI",
"createChannelLoop",
"(",
"ControlledBounceProxyInformation",
"bpInfo",
",",
"String",
"ccid",
",",
"String",
"trackingId",
",",
"int",
"retries",
")",
"throws",
"JoynrProtocolException",
"{",
"while",
"(",
"retries",
">",
"0",
")",
"{",
"retries",
"--",
";",
"try",
"{",
"return",
"sendCreateChannelHttpRequest",
"(",
"bpInfo",
",",
"ccid",
",",
"trackingId",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"// failed to establish communication with the bounce proxy",
"logger",
".",
"error",
"(",
"\"creating a channel on bounce proxy {} failed due to communication errors: message: {}\"",
",",
"bpInfo",
".",
"getId",
"(",
")",
",",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"// try again if creating the channel failed",
"try",
"{",
"Thread",
".",
"sleep",
"(",
"sendCreateChannelRetryIntervalMs",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"e",
")",
"{",
"throw",
"new",
"JoynrRuntimeException",
"(",
"\"creating a channel on bounce proxy \"",
"+",
"bpInfo",
".",
"getId",
"(",
")",
"+",
"\" was interrupted.\"",
")",
";",
"}",
"}",
"// the maximum number of retries passed, so channel creation failed",
"throw",
"new",
"JoynrRuntimeException",
"(",
"\"creating a channel on bounce proxy \"",
"+",
"bpInfo",
".",
"getId",
"(",
")",
"+",
"\" failed.\"",
")",
";",
"}"
] | Starts a loop to send createChannel requests to a bounce proxy with a
maximum number of retries.
@param bpInfo
information about the bounce proxy to create the channel at
@param ccid
the channel ID for the channel to create
@param trackingId
a tracking ID necessary for long polling
@param retries
the maximum number of retries
@return the url of the channel at the bounce proxy as it was returned by
the bounce proxy itself
@throws JoynrProtocolException
if the bounce proxy rejects channel creation | [
"Starts",
"a",
"loop",
"to",
"send",
"createChannel",
"requests",
"to",
"a",
"bounce",
"proxy",
"with",
"a",
"maximum",
"number",
"of",
"retries",
"."
] | train | https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/messaging/bounceproxy/bounceproxy-controller/src/main/java/io/joynr/messaging/bounceproxy/controller/RemoteBounceProxyFacade.java#L117-L143 |
checkstyle-addons/checkstyle-addons | buildSrc/src/main/java/com/thomasjensen/checkstyle/addons/build/BuildUtil.java | BuildUtil.addBuildTimestampDeferred | public void addBuildTimestampDeferred(@Nonnull final Task pTask, @Nonnull final Attributes pAttributes) {
"""
Add build timestamp to some manifest attributes in the execution phase, so that it does not count for the
up-to-date check.
@param pTask the executing task
@param pAttributes the attributes map to add to
"""
pTask.doFirst(new Closure<Void>(pTask)
{
@Override
@SuppressWarnings("MethodDoesntCallSuperMethod")
public Void call()
{
addBuildTimestamp(pAttributes);
return null;
}
});
} | java | public void addBuildTimestampDeferred(@Nonnull final Task pTask, @Nonnull final Attributes pAttributes)
{
pTask.doFirst(new Closure<Void>(pTask)
{
@Override
@SuppressWarnings("MethodDoesntCallSuperMethod")
public Void call()
{
addBuildTimestamp(pAttributes);
return null;
}
});
} | [
"public",
"void",
"addBuildTimestampDeferred",
"(",
"@",
"Nonnull",
"final",
"Task",
"pTask",
",",
"@",
"Nonnull",
"final",
"Attributes",
"pAttributes",
")",
"{",
"pTask",
".",
"doFirst",
"(",
"new",
"Closure",
"<",
"Void",
">",
"(",
"pTask",
")",
"{",
"@",
"Override",
"@",
"SuppressWarnings",
"(",
"\"MethodDoesntCallSuperMethod\"",
")",
"public",
"Void",
"call",
"(",
")",
"{",
"addBuildTimestamp",
"(",
"pAttributes",
")",
";",
"return",
"null",
";",
"}",
"}",
")",
";",
"}"
] | Add build timestamp to some manifest attributes in the execution phase, so that it does not count for the
up-to-date check.
@param pTask the executing task
@param pAttributes the attributes map to add to | [
"Add",
"build",
"timestamp",
"to",
"some",
"manifest",
"attributes",
"in",
"the",
"execution",
"phase",
"so",
"that",
"it",
"does",
"not",
"count",
"for",
"the",
"up",
"-",
"to",
"-",
"date",
"check",
"."
] | train | https://github.com/checkstyle-addons/checkstyle-addons/blob/fae1b4d341639c8e32c3e59ec5abdc0ffc11b865/buildSrc/src/main/java/com/thomasjensen/checkstyle/addons/build/BuildUtil.java#L180-L192 |
albfernandez/itext2 | src/main/java/com/lowagie/text/rtf/RtfWriter2.java | RtfWriter2.importRtfFragment | public void importRtfFragment(InputStream documentSource, RtfImportMappings mappings, EventListener[] events ) throws IOException, DocumentException {
"""
Adds a fragment of an RTF document to the current RTF document being generated.
Since this fragment doesn't contain font or color tables, all fonts and colors
are mapped to the default font and color. If the font and color mappings are
known, they can be specified via the mappings parameter.
Uses new RtfParser object.
(author: Howard Shank)
@param documentSource The InputStream to read the RTF fragment from.
@param mappings The RtfImportMappings that contain font and color mappings to apply to the fragment.
@param events The array of event listeners. May be null
@throws IOException On errors reading the RTF fragment.
@throws DocumentException On errors adding to this RTF fragment.
@see RtfImportMappings
@see RtfParser
@see RtfParser#importRtfFragment(InputStream, RtfDocument, RtfImportMappings)
@since 2.0.8
"""
if(!this.open) {
throw new DocumentException("The document must be open to import RTF fragments.");
}
RtfParser rtfImport = new RtfParser(this.document);
if(events != null) {
for(int idx=0;idx<events.length;idx++) {
rtfImport.addListener(events[idx]);
}
}
rtfImport.importRtfFragment(documentSource, this.rtfDoc, mappings);
} | java | public void importRtfFragment(InputStream documentSource, RtfImportMappings mappings, EventListener[] events ) throws IOException, DocumentException {
if(!this.open) {
throw new DocumentException("The document must be open to import RTF fragments.");
}
RtfParser rtfImport = new RtfParser(this.document);
if(events != null) {
for(int idx=0;idx<events.length;idx++) {
rtfImport.addListener(events[idx]);
}
}
rtfImport.importRtfFragment(documentSource, this.rtfDoc, mappings);
} | [
"public",
"void",
"importRtfFragment",
"(",
"InputStream",
"documentSource",
",",
"RtfImportMappings",
"mappings",
",",
"EventListener",
"[",
"]",
"events",
")",
"throws",
"IOException",
",",
"DocumentException",
"{",
"if",
"(",
"!",
"this",
".",
"open",
")",
"{",
"throw",
"new",
"DocumentException",
"(",
"\"The document must be open to import RTF fragments.\"",
")",
";",
"}",
"RtfParser",
"rtfImport",
"=",
"new",
"RtfParser",
"(",
"this",
".",
"document",
")",
";",
"if",
"(",
"events",
"!=",
"null",
")",
"{",
"for",
"(",
"int",
"idx",
"=",
"0",
";",
"idx",
"<",
"events",
".",
"length",
";",
"idx",
"++",
")",
"{",
"rtfImport",
".",
"addListener",
"(",
"events",
"[",
"idx",
"]",
")",
";",
"}",
"}",
"rtfImport",
".",
"importRtfFragment",
"(",
"documentSource",
",",
"this",
".",
"rtfDoc",
",",
"mappings",
")",
";",
"}"
] | Adds a fragment of an RTF document to the current RTF document being generated.
Since this fragment doesn't contain font or color tables, all fonts and colors
are mapped to the default font and color. If the font and color mappings are
known, they can be specified via the mappings parameter.
Uses new RtfParser object.
(author: Howard Shank)
@param documentSource The InputStream to read the RTF fragment from.
@param mappings The RtfImportMappings that contain font and color mappings to apply to the fragment.
@param events The array of event listeners. May be null
@throws IOException On errors reading the RTF fragment.
@throws DocumentException On errors adding to this RTF fragment.
@see RtfImportMappings
@see RtfParser
@see RtfParser#importRtfFragment(InputStream, RtfDocument, RtfImportMappings)
@since 2.0.8 | [
"Adds",
"a",
"fragment",
"of",
"an",
"RTF",
"document",
"to",
"the",
"current",
"RTF",
"document",
"being",
"generated",
".",
"Since",
"this",
"fragment",
"doesn",
"t",
"contain",
"font",
"or",
"color",
"tables",
"all",
"fonts",
"and",
"colors",
"are",
"mapped",
"to",
"the",
"default",
"font",
"and",
"color",
".",
"If",
"the",
"font",
"and",
"color",
"mappings",
"are",
"known",
"they",
"can",
"be",
"specified",
"via",
"the",
"mappings",
"parameter",
".",
"Uses",
"new",
"RtfParser",
"object",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/rtf/RtfWriter2.java#L335-L346 |
ngageoint/geopackage-android-map | geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java | GoogleMapShapeConverter.toCompoundCurveFromList | public CompoundCurve toCompoundCurveFromList(List<List<LatLng>> polylineList) {
"""
Convert a list of List<LatLng> to a {@link CompoundCurve}
@param polylineList polyline list
@return compound curve
"""
return toCompoundCurveFromList(polylineList, false, false);
} | java | public CompoundCurve toCompoundCurveFromList(List<List<LatLng>> polylineList) {
return toCompoundCurveFromList(polylineList, false, false);
} | [
"public",
"CompoundCurve",
"toCompoundCurveFromList",
"(",
"List",
"<",
"List",
"<",
"LatLng",
">",
">",
"polylineList",
")",
"{",
"return",
"toCompoundCurveFromList",
"(",
"polylineList",
",",
"false",
",",
"false",
")",
";",
"}"
] | Convert a list of List<LatLng> to a {@link CompoundCurve}
@param polylineList polyline list
@return compound curve | [
"Convert",
"a",
"list",
"of",
"List<LatLng",
">",
"to",
"a",
"{",
"@link",
"CompoundCurve",
"}"
] | train | https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java#L891-L893 |
camunda/camunda-xml-model | src/main/java/org/camunda/bpm/model/xml/impl/util/ModelUtil.java | ModelUtil.getModelElement | public static ModelElementInstance getModelElement(DomElement domElement, ModelInstanceImpl modelInstance, ModelElementTypeImpl modelType) {
"""
Returns the {@link ModelElementInstanceImpl ModelElement} for a DOM element.
If the model element does not yet exist, it is created and linked to the DOM.
@param domElement the child element to create a new {@link ModelElementInstanceImpl ModelElement} for
@param modelInstance the {@link ModelInstanceImpl ModelInstance} for which the new {@link ModelElementInstanceImpl ModelElement} is created
@param modelType the {@link ModelElementTypeImpl ModelElementType} to create a new {@link ModelElementInstanceImpl ModelElement} for
@return the child model element
"""
ModelElementInstance modelElement = domElement.getModelElementInstance();
if(modelElement == null) {
modelElement = modelType.newInstance(modelInstance, domElement);
domElement.setModelElementInstance(modelElement);
}
return modelElement;
} | java | public static ModelElementInstance getModelElement(DomElement domElement, ModelInstanceImpl modelInstance, ModelElementTypeImpl modelType) {
ModelElementInstance modelElement = domElement.getModelElementInstance();
if(modelElement == null) {
modelElement = modelType.newInstance(modelInstance, domElement);
domElement.setModelElementInstance(modelElement);
}
return modelElement;
} | [
"public",
"static",
"ModelElementInstance",
"getModelElement",
"(",
"DomElement",
"domElement",
",",
"ModelInstanceImpl",
"modelInstance",
",",
"ModelElementTypeImpl",
"modelType",
")",
"{",
"ModelElementInstance",
"modelElement",
"=",
"domElement",
".",
"getModelElementInstance",
"(",
")",
";",
"if",
"(",
"modelElement",
"==",
"null",
")",
"{",
"modelElement",
"=",
"modelType",
".",
"newInstance",
"(",
"modelInstance",
",",
"domElement",
")",
";",
"domElement",
".",
"setModelElementInstance",
"(",
"modelElement",
")",
";",
"}",
"return",
"modelElement",
";",
"}"
] | Returns the {@link ModelElementInstanceImpl ModelElement} for a DOM element.
If the model element does not yet exist, it is created and linked to the DOM.
@param domElement the child element to create a new {@link ModelElementInstanceImpl ModelElement} for
@param modelInstance the {@link ModelInstanceImpl ModelInstance} for which the new {@link ModelElementInstanceImpl ModelElement} is created
@param modelType the {@link ModelElementTypeImpl ModelElementType} to create a new {@link ModelElementInstanceImpl ModelElement} for
@return the child model element | [
"Returns",
"the",
"{",
"@link",
"ModelElementInstanceImpl",
"ModelElement",
"}",
"for",
"a",
"DOM",
"element",
".",
"If",
"the",
"model",
"element",
"does",
"not",
"yet",
"exist",
"it",
"is",
"created",
"and",
"linked",
"to",
"the",
"DOM",
"."
] | train | https://github.com/camunda/camunda-xml-model/blob/85b3f879e26d063f71c94cfd21ac17d9ff6baf4d/src/main/java/org/camunda/bpm/model/xml/impl/util/ModelUtil.java#L68-L76 |
headius/invokebinder | src/main/java/com/headius/invokebinder/Signature.java | Signature.permuteWith | public MethodHandle permuteWith(MethodHandle target, String... permuteArgs) {
"""
Produce a method handle permuting the arguments in this signature using
the given permute arguments and targeting the given java.lang.invoke.MethodHandle.
Example:
<pre>
Signature sig = Signature.returning(String.class).appendArg("a", int.class).appendArg("b", int.class);
MethodHandle handle = handleThatTakesOneInt();
MethodHandle newHandle = sig.permuteTo(handle, "b");
</pre>
@param target the method handle to target
@param permuteArgs the arguments to permute
@return a new handle that permutes appropriate positions based on the
given permute args
"""
return MethodHandles.permuteArguments(target, methodType, to(permute(permuteArgs)));
} | java | public MethodHandle permuteWith(MethodHandle target, String... permuteArgs) {
return MethodHandles.permuteArguments(target, methodType, to(permute(permuteArgs)));
} | [
"public",
"MethodHandle",
"permuteWith",
"(",
"MethodHandle",
"target",
",",
"String",
"...",
"permuteArgs",
")",
"{",
"return",
"MethodHandles",
".",
"permuteArguments",
"(",
"target",
",",
"methodType",
",",
"to",
"(",
"permute",
"(",
"permuteArgs",
")",
")",
")",
";",
"}"
] | Produce a method handle permuting the arguments in this signature using
the given permute arguments and targeting the given java.lang.invoke.MethodHandle.
Example:
<pre>
Signature sig = Signature.returning(String.class).appendArg("a", int.class).appendArg("b", int.class);
MethodHandle handle = handleThatTakesOneInt();
MethodHandle newHandle = sig.permuteTo(handle, "b");
</pre>
@param target the method handle to target
@param permuteArgs the arguments to permute
@return a new handle that permutes appropriate positions based on the
given permute args | [
"Produce",
"a",
"method",
"handle",
"permuting",
"the",
"arguments",
"in",
"this",
"signature",
"using",
"the",
"given",
"permute",
"arguments",
"and",
"targeting",
"the",
"given",
"java",
".",
"lang",
".",
"invoke",
".",
"MethodHandle",
"."
] | train | https://github.com/headius/invokebinder/blob/ce6bfeb8e33265480daa7b797989dd915d51238d/src/main/java/com/headius/invokebinder/Signature.java#L730-L732 |
DDTH/ddth-commons | ddth-commons-core/src/main/java/com/github/ddth/commons/utils/DateTimeUtils.java | DateTimeUtils.addYears | public static Calendar addYears(Calendar origin, int value) {
"""
Add/Subtract the specified amount of years to the given {@link Calendar}.
<p>
The returned {@link Calendar} has its fields synced.
</p>
@param origin
@param value
@return
@since 0.9.2
"""
Calendar cal = sync((Calendar) origin.clone());
cal.add(Calendar.YEAR, value);
return sync(cal);
} | java | public static Calendar addYears(Calendar origin, int value) {
Calendar cal = sync((Calendar) origin.clone());
cal.add(Calendar.YEAR, value);
return sync(cal);
} | [
"public",
"static",
"Calendar",
"addYears",
"(",
"Calendar",
"origin",
",",
"int",
"value",
")",
"{",
"Calendar",
"cal",
"=",
"sync",
"(",
"(",
"Calendar",
")",
"origin",
".",
"clone",
"(",
")",
")",
";",
"cal",
".",
"add",
"(",
"Calendar",
".",
"YEAR",
",",
"value",
")",
";",
"return",
"sync",
"(",
"cal",
")",
";",
"}"
] | Add/Subtract the specified amount of years to the given {@link Calendar}.
<p>
The returned {@link Calendar} has its fields synced.
</p>
@param origin
@param value
@return
@since 0.9.2 | [
"Add",
"/",
"Subtract",
"the",
"specified",
"amount",
"of",
"years",
"to",
"the",
"given",
"{",
"@link",
"Calendar",
"}",
"."
] | train | https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/utils/DateTimeUtils.java#L965-L969 |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/DefaultAttributeMarshaller.java | DefaultAttributeMarshaller.marshallAsElement | @Deprecated
public void marshallAsElement(AttributeDefinition attribute, ModelNode resourceModel, XMLStreamWriter writer) throws XMLStreamException {
"""
Use {@link #marshallAsElement(AttributeDefinition, ModelNode, boolean, XMLStreamWriter)} instead.
"""
marshallAsElement(attribute, resourceModel, true, writer);
} | java | @Deprecated
public void marshallAsElement(AttributeDefinition attribute, ModelNode resourceModel, XMLStreamWriter writer) throws XMLStreamException {
marshallAsElement(attribute, resourceModel, true, writer);
} | [
"@",
"Deprecated",
"public",
"void",
"marshallAsElement",
"(",
"AttributeDefinition",
"attribute",
",",
"ModelNode",
"resourceModel",
",",
"XMLStreamWriter",
"writer",
")",
"throws",
"XMLStreamException",
"{",
"marshallAsElement",
"(",
"attribute",
",",
"resourceModel",
",",
"true",
",",
"writer",
")",
";",
"}"
] | Use {@link #marshallAsElement(AttributeDefinition, ModelNode, boolean, XMLStreamWriter)} instead. | [
"Use",
"{"
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/DefaultAttributeMarshaller.java#L45-L48 |
gallandarakhneorg/afc | advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/layer/RoadNetworkLayerConstants.java | RoadNetworkLayerConstants.setPreferredRoadColor | public static void setPreferredRoadColor(RoadType roadType, Integer color) {
"""
Set the preferred color to draw the content of the roads of the given type.
@param roadType is the type of road for which the color should be replied.
@param color is the color or <code>null</code> to restore the default value.
"""
final RoadType rt = roadType == null ? RoadType.OTHER : roadType;
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkLayerConstants.class);
if (prefs != null) {
if (color == null || color.intValue() == DEFAULT_ROAD_COLORS[rt.ordinal() * 2]) {
prefs.remove("ROAD_COLOR_" + rt.name().toUpperCase()); //$NON-NLS-1$
} else {
prefs.put("ROAD_COLOR_" + rt.name().toUpperCase(), Integer.toString(color.intValue())); //$NON-NLS-1$
}
try {
prefs.flush();
} catch (BackingStoreException exception) {
//
}
}
} | java | public static void setPreferredRoadColor(RoadType roadType, Integer color) {
final RoadType rt = roadType == null ? RoadType.OTHER : roadType;
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkLayerConstants.class);
if (prefs != null) {
if (color == null || color.intValue() == DEFAULT_ROAD_COLORS[rt.ordinal() * 2]) {
prefs.remove("ROAD_COLOR_" + rt.name().toUpperCase()); //$NON-NLS-1$
} else {
prefs.put("ROAD_COLOR_" + rt.name().toUpperCase(), Integer.toString(color.intValue())); //$NON-NLS-1$
}
try {
prefs.flush();
} catch (BackingStoreException exception) {
//
}
}
} | [
"public",
"static",
"void",
"setPreferredRoadColor",
"(",
"RoadType",
"roadType",
",",
"Integer",
"color",
")",
"{",
"final",
"RoadType",
"rt",
"=",
"roadType",
"==",
"null",
"?",
"RoadType",
".",
"OTHER",
":",
"roadType",
";",
"final",
"Preferences",
"prefs",
"=",
"Preferences",
".",
"userNodeForPackage",
"(",
"RoadNetworkLayerConstants",
".",
"class",
")",
";",
"if",
"(",
"prefs",
"!=",
"null",
")",
"{",
"if",
"(",
"color",
"==",
"null",
"||",
"color",
".",
"intValue",
"(",
")",
"==",
"DEFAULT_ROAD_COLORS",
"[",
"rt",
".",
"ordinal",
"(",
")",
"*",
"2",
"]",
")",
"{",
"prefs",
".",
"remove",
"(",
"\"ROAD_COLOR_\"",
"+",
"rt",
".",
"name",
"(",
")",
".",
"toUpperCase",
"(",
")",
")",
";",
"//$NON-NLS-1$",
"}",
"else",
"{",
"prefs",
".",
"put",
"(",
"\"ROAD_COLOR_\"",
"+",
"rt",
".",
"name",
"(",
")",
".",
"toUpperCase",
"(",
")",
",",
"Integer",
".",
"toString",
"(",
"color",
".",
"intValue",
"(",
")",
")",
")",
";",
"//$NON-NLS-1$",
"}",
"try",
"{",
"prefs",
".",
"flush",
"(",
")",
";",
"}",
"catch",
"(",
"BackingStoreException",
"exception",
")",
"{",
"//",
"}",
"}",
"}"
] | Set the preferred color to draw the content of the roads of the given type.
@param roadType is the type of road for which the color should be replied.
@param color is the color or <code>null</code> to restore the default value. | [
"Set",
"the",
"preferred",
"color",
"to",
"draw",
"the",
"content",
"of",
"the",
"roads",
"of",
"the",
"given",
"type",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/layer/RoadNetworkLayerConstants.java#L195-L210 |
gmessner/gitlab4j-api | src/main/java/org/gitlab4j/api/ProjectApi.java | ProjectApi.uploadFile | public FileUpload uploadFile(Object projectIdOrPath, File fileToUpload) throws GitLabApiException {
"""
Uploads a file to the specified project to be used in an issue or merge request description, or a comment.
<pre><code>POST /projects/:id/uploads</code></pre>
@param projectIdOrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required
@param fileToUpload the File instance of the file to upload, required
@return a FileUpload instance with information on the just uploaded file
@throws GitLabApiException if any exception occurs
"""
return (uploadFile(projectIdOrPath, fileToUpload, null));
} | java | public FileUpload uploadFile(Object projectIdOrPath, File fileToUpload) throws GitLabApiException {
return (uploadFile(projectIdOrPath, fileToUpload, null));
} | [
"public",
"FileUpload",
"uploadFile",
"(",
"Object",
"projectIdOrPath",
",",
"File",
"fileToUpload",
")",
"throws",
"GitLabApiException",
"{",
"return",
"(",
"uploadFile",
"(",
"projectIdOrPath",
",",
"fileToUpload",
",",
"null",
")",
")",
";",
"}"
] | Uploads a file to the specified project to be used in an issue or merge request description, or a comment.
<pre><code>POST /projects/:id/uploads</code></pre>
@param projectIdOrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required
@param fileToUpload the File instance of the file to upload, required
@return a FileUpload instance with information on the just uploaded file
@throws GitLabApiException if any exception occurs | [
"Uploads",
"a",
"file",
"to",
"the",
"specified",
"project",
"to",
"be",
"used",
"in",
"an",
"issue",
"or",
"merge",
"request",
"description",
"or",
"a",
"comment",
"."
] | train | https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/ProjectApi.java#L2145-L2147 |
wonderpush/wonderpush-android-sdk | sdk/src/main/java/com/wonderpush/sdk/WonderPushDialogBuilder.java | WonderPushDialogBuilder.getDialogStyledAttributes | @SuppressLint("Recycle")
public static TypedArray getDialogStyledAttributes(Context activity, int[] attrs, int defStyleAttr, int defStyleRef) {
"""
Read styled attributes, they will defined in an AlertDialog shown by the given activity.
You must call {@link TypedArray#recycle()} after having read the desired attributes.
@see Context#obtainStyledAttributes(android.util.AttributeSet, int[], int, int)
"""
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
AlertDialog dialog = builder.create();
TypedArray ta = dialog.getContext().obtainStyledAttributes(null, attrs, defStyleAttr, defStyleRef);
dialog.dismiss();
return ta;
} | java | @SuppressLint("Recycle")
public static TypedArray getDialogStyledAttributes(Context activity, int[] attrs, int defStyleAttr, int defStyleRef) {
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
AlertDialog dialog = builder.create();
TypedArray ta = dialog.getContext().obtainStyledAttributes(null, attrs, defStyleAttr, defStyleRef);
dialog.dismiss();
return ta;
} | [
"@",
"SuppressLint",
"(",
"\"Recycle\"",
")",
"public",
"static",
"TypedArray",
"getDialogStyledAttributes",
"(",
"Context",
"activity",
",",
"int",
"[",
"]",
"attrs",
",",
"int",
"defStyleAttr",
",",
"int",
"defStyleRef",
")",
"{",
"AlertDialog",
".",
"Builder",
"builder",
"=",
"new",
"AlertDialog",
".",
"Builder",
"(",
"activity",
")",
";",
"AlertDialog",
"dialog",
"=",
"builder",
".",
"create",
"(",
")",
";",
"TypedArray",
"ta",
"=",
"dialog",
".",
"getContext",
"(",
")",
".",
"obtainStyledAttributes",
"(",
"null",
",",
"attrs",
",",
"defStyleAttr",
",",
"defStyleRef",
")",
";",
"dialog",
".",
"dismiss",
"(",
")",
";",
"return",
"ta",
";",
"}"
] | Read styled attributes, they will defined in an AlertDialog shown by the given activity.
You must call {@link TypedArray#recycle()} after having read the desired attributes.
@see Context#obtainStyledAttributes(android.util.AttributeSet, int[], int, int) | [
"Read",
"styled",
"attributes",
"they",
"will",
"defined",
"in",
"an",
"AlertDialog",
"shown",
"by",
"the",
"given",
"activity",
".",
"You",
"must",
"call",
"{"
] | train | https://github.com/wonderpush/wonderpush-android-sdk/blob/ba0a1568f705cdd6206639bfab1e5cf529084b59/sdk/src/main/java/com/wonderpush/sdk/WonderPushDialogBuilder.java#L39-L46 |
jbundle/jbundle | base/message/jibx/src/main/java/org/jbundle/base/message/trx/message/external/convert/jibx/JibxConvertToMessage.java | JibxConvertToMessage.unmarshalRootElement | public Object unmarshalRootElement(Node node, BaseXmlTrxMessageIn soapTrxMessage) throws Exception {
"""
Create the root element for this message.
You must override this.
@return The root element.
"""
/* try {
// create a JAXBContext capable of handling classes generated into
// the primer.po package
String strSOAPPackage = (String)((TrxMessageHeader)soapTrxMessage.getMessage().getMessageHeader()).get(SOAPMessageTransport.SOAP_PACKAGE);
if (strSOAPPackage != null)
{
Object obj = null;
IUnmarshallingContext u = JibxContexts.getJAXBContexts().getUnmarshaller(strSOAPPackage);
if (u == null)
return null;
synchronized(u)
{ // Since the marshaller is shared (may want to tweek this for multi-cpu implementations)
obj = u.unmarshalDocument( node );
}
return obj;
}
//+ } catch (XMLStreamException ex) {
//+ ex.printStackTrace();
} catch (JiBXException ex) {
ex.printStackTrace();
}
*/
return super.unmarshalRootElement(node, soapTrxMessage);
} | java | public Object unmarshalRootElement(Node node, BaseXmlTrxMessageIn soapTrxMessage) throws Exception
{
/* try {
// create a JAXBContext capable of handling classes generated into
// the primer.po package
String strSOAPPackage = (String)((TrxMessageHeader)soapTrxMessage.getMessage().getMessageHeader()).get(SOAPMessageTransport.SOAP_PACKAGE);
if (strSOAPPackage != null)
{
Object obj = null;
IUnmarshallingContext u = JibxContexts.getJAXBContexts().getUnmarshaller(strSOAPPackage);
if (u == null)
return null;
synchronized(u)
{ // Since the marshaller is shared (may want to tweek this for multi-cpu implementations)
obj = u.unmarshalDocument( node );
}
return obj;
}
//+ } catch (XMLStreamException ex) {
//+ ex.printStackTrace();
} catch (JiBXException ex) {
ex.printStackTrace();
}
*/
return super.unmarshalRootElement(node, soapTrxMessage);
} | [
"public",
"Object",
"unmarshalRootElement",
"(",
"Node",
"node",
",",
"BaseXmlTrxMessageIn",
"soapTrxMessage",
")",
"throws",
"Exception",
"{",
"/* try {\n // create a JAXBContext capable of handling classes generated into\n // the primer.po package\n String strSOAPPackage = (String)((TrxMessageHeader)soapTrxMessage.getMessage().getMessageHeader()).get(SOAPMessageTransport.SOAP_PACKAGE);\n if (strSOAPPackage != null)\n {\n Object obj = null;\n IUnmarshallingContext u = JibxContexts.getJAXBContexts().getUnmarshaller(strSOAPPackage);\n if (u == null)\n return null;\n synchronized(u)\n { // Since the marshaller is shared (may want to tweek this for multi-cpu implementations)\n obj = u.unmarshalDocument( node );\n }\n\n return obj;\n }\n//+ } catch (XMLStreamException ex) {\n//+ ex.printStackTrace();\n } catch (JiBXException ex) {\n ex.printStackTrace();\n }\n*/",
"return",
"super",
".",
"unmarshalRootElement",
"(",
"node",
",",
"soapTrxMessage",
")",
";",
"}"
] | Create the root element for this message.
You must override this.
@return The root element. | [
"Create",
"the",
"root",
"element",
"for",
"this",
"message",
".",
"You",
"must",
"override",
"this",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/message/jibx/src/main/java/org/jbundle/base/message/trx/message/external/convert/jibx/JibxConvertToMessage.java#L102-L128 |
goldmansachs/reladomo | reladomo/src/main/java/com/gs/fw/common/mithra/databasetype/SybaseIqDatabaseType.java | SybaseIqDatabaseType.getTableColumnInfo | public TableColumnInfo getTableColumnInfo(Connection connection, String schema, String table) throws SQLException {
"""
<p>Overridden to create the table metadata by hand rather than using the JDBC
<code>DatabaseMetadata.getColumns()</code> method. This is because the Sybase driver fails
when the connection is an XA connection unless you allow transactional DDL in tempdb.</p>
"""
if (schema == null || schema.length() == 0 || schema.equals(this.getTempDbSchemaName()))
{
schema = this.getCurrentSchema(connection);
}
return TableColumnInfo.createTableMetadataWithExtraSelect(connection, schema, table, this.getFullyQualifiedTableName(schema, table));
} | java | public TableColumnInfo getTableColumnInfo(Connection connection, String schema, String table) throws SQLException
{
if (schema == null || schema.length() == 0 || schema.equals(this.getTempDbSchemaName()))
{
schema = this.getCurrentSchema(connection);
}
return TableColumnInfo.createTableMetadataWithExtraSelect(connection, schema, table, this.getFullyQualifiedTableName(schema, table));
} | [
"public",
"TableColumnInfo",
"getTableColumnInfo",
"(",
"Connection",
"connection",
",",
"String",
"schema",
",",
"String",
"table",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"schema",
"==",
"null",
"||",
"schema",
".",
"length",
"(",
")",
"==",
"0",
"||",
"schema",
".",
"equals",
"(",
"this",
".",
"getTempDbSchemaName",
"(",
")",
")",
")",
"{",
"schema",
"=",
"this",
".",
"getCurrentSchema",
"(",
"connection",
")",
";",
"}",
"return",
"TableColumnInfo",
".",
"createTableMetadataWithExtraSelect",
"(",
"connection",
",",
"schema",
",",
"table",
",",
"this",
".",
"getFullyQualifiedTableName",
"(",
"schema",
",",
"table",
")",
")",
";",
"}"
] | <p>Overridden to create the table metadata by hand rather than using the JDBC
<code>DatabaseMetadata.getColumns()</code> method. This is because the Sybase driver fails
when the connection is an XA connection unless you allow transactional DDL in tempdb.</p> | [
"<p",
">",
"Overridden",
"to",
"create",
"the",
"table",
"metadata",
"by",
"hand",
"rather",
"than",
"using",
"the",
"JDBC",
"<code",
">",
"DatabaseMetadata",
".",
"getColumns",
"()",
"<",
"/",
"code",
">",
"method",
".",
"This",
"is",
"because",
"the",
"Sybase",
"driver",
"fails",
"when",
"the",
"connection",
"is",
"an",
"XA",
"connection",
"unless",
"you",
"allow",
"transactional",
"DDL",
"in",
"tempdb",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/goldmansachs/reladomo/blob/e9a069452eece7a6ef9551caf81a69d3d9a3d990/reladomo/src/main/java/com/gs/fw/common/mithra/databasetype/SybaseIqDatabaseType.java#L225-L232 |
geomajas/geomajas-project-client-gwt | plugin/widget-searchandfilter/searchandfilter/src/main/java/org/geomajas/widget/searchandfilter/service/SearchFavouritesServiceInMemoryImpl.java | SearchFavouritesServiceInMemoryImpl.deleteSearchFavourite | public void deleteSearchFavourite(SearchFavourite sf) throws IOException {
"""
If creator is not set, only shared favourites will be checked (if
shared)!
"""
synchronized (lock) {
if (sf == null || sf.getId() == null) {
throw new IllegalArgumentException("null, or id not set!");
} else {
allFavourites.remove(sf.getId());
if (sf.isShared()) {
sharedFavourites.remove(sf.getId());
} else {
if (sf.getCreator() != null) {
Map<Long, SearchFavourite> favs = privateFavourites.get(sf.getCreator());
if (favs != null) {
favs.remove(sf.getId());
}
} else {
log.warn("Creator is not set! I'm not checking all users so I'm giving up.");
}
}
}
}
} | java | public void deleteSearchFavourite(SearchFavourite sf) throws IOException {
synchronized (lock) {
if (sf == null || sf.getId() == null) {
throw new IllegalArgumentException("null, or id not set!");
} else {
allFavourites.remove(sf.getId());
if (sf.isShared()) {
sharedFavourites.remove(sf.getId());
} else {
if (sf.getCreator() != null) {
Map<Long, SearchFavourite> favs = privateFavourites.get(sf.getCreator());
if (favs != null) {
favs.remove(sf.getId());
}
} else {
log.warn("Creator is not set! I'm not checking all users so I'm giving up.");
}
}
}
}
} | [
"public",
"void",
"deleteSearchFavourite",
"(",
"SearchFavourite",
"sf",
")",
"throws",
"IOException",
"{",
"synchronized",
"(",
"lock",
")",
"{",
"if",
"(",
"sf",
"==",
"null",
"||",
"sf",
".",
"getId",
"(",
")",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"null, or id not set!\"",
")",
";",
"}",
"else",
"{",
"allFavourites",
".",
"remove",
"(",
"sf",
".",
"getId",
"(",
")",
")",
";",
"if",
"(",
"sf",
".",
"isShared",
"(",
")",
")",
"{",
"sharedFavourites",
".",
"remove",
"(",
"sf",
".",
"getId",
"(",
")",
")",
";",
"}",
"else",
"{",
"if",
"(",
"sf",
".",
"getCreator",
"(",
")",
"!=",
"null",
")",
"{",
"Map",
"<",
"Long",
",",
"SearchFavourite",
">",
"favs",
"=",
"privateFavourites",
".",
"get",
"(",
"sf",
".",
"getCreator",
"(",
")",
")",
";",
"if",
"(",
"favs",
"!=",
"null",
")",
"{",
"favs",
".",
"remove",
"(",
"sf",
".",
"getId",
"(",
")",
")",
";",
"}",
"}",
"else",
"{",
"log",
".",
"warn",
"(",
"\"Creator is not set! I'm not checking all users so I'm giving up.\"",
")",
";",
"}",
"}",
"}",
"}",
"}"
] | If creator is not set, only shared favourites will be checked (if
shared)! | [
"If",
"creator",
"is",
"not",
"set",
"only",
"shared",
"favourites",
"will",
"be",
"checked",
"(",
"if",
"shared",
")",
"!"
] | train | https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/plugin/widget-searchandfilter/searchandfilter/src/main/java/org/geomajas/widget/searchandfilter/service/SearchFavouritesServiceInMemoryImpl.java#L81-L101 |
census-instrumentation/opencensus-java | impl_core/src/main/java/io/opencensus/implcore/tags/TagContextUtils.java | TagContextUtils.addTagToBuilder | static void addTagToBuilder(Tag tag, TagMapBuilderImpl builder) {
"""
Add a {@code Tag} of any type to a builder.
@param tag tag containing the key and value to set.
@param builder the builder to update.
"""
builder.put(tag.getKey(), tag.getValue(), tag.getTagMetadata());
} | java | static void addTagToBuilder(Tag tag, TagMapBuilderImpl builder) {
builder.put(tag.getKey(), tag.getValue(), tag.getTagMetadata());
} | [
"static",
"void",
"addTagToBuilder",
"(",
"Tag",
"tag",
",",
"TagMapBuilderImpl",
"builder",
")",
"{",
"builder",
".",
"put",
"(",
"tag",
".",
"getKey",
"(",
")",
",",
"tag",
".",
"getValue",
"(",
")",
",",
"tag",
".",
"getTagMetadata",
"(",
")",
")",
";",
"}"
] | Add a {@code Tag} of any type to a builder.
@param tag tag containing the key and value to set.
@param builder the builder to update. | [
"Add",
"a",
"{",
"@code",
"Tag",
"}",
"of",
"any",
"type",
"to",
"a",
"builder",
"."
] | train | https://github.com/census-instrumentation/opencensus-java/blob/deefac9bed77e40a2297bff1ca5ec5aa48a5f755/impl_core/src/main/java/io/opencensus/implcore/tags/TagContextUtils.java#L30-L32 |
wcm-io/wcm-io-handler | media/src/main/java/io/wcm/handler/mediasource/dam/impl/DefaultRenditionHandler.java | DefaultRenditionHandler.getVirtualRendition | private RenditionMetadata getVirtualRendition(Set<RenditionMetadata> candidates,
long destWidth, long destHeight, double destRatio) {
"""
Check if a rendition is available from which the required format can be downscaled from and returns
a virtual rendition in this case.
@param candidates Candidates
@param destWidth Destination width
@param destHeight Destination height
@param destRatio Destination ratio
@return Rendition or null
"""
// if ratio is defined get first rendition with matching ratio and same or bigger size
if (destRatio > 0) {
for (RenditionMetadata candidate : candidates) {
if (candidate.matches(destWidth, destHeight, 0, 0, destRatio)) {
return getVirtualRendition(candidate, destWidth, destHeight, destRatio);
}
}
}
// otherwise get first rendition which is same or bigger in width and height
else {
for (RenditionMetadata candidate : candidates) {
if (candidate.matches(destWidth, destHeight, 0, 0, 0d)) {
return getVirtualRendition(candidate, destWidth, destHeight, 0d);
}
}
}
// none found
return null;
} | java | private RenditionMetadata getVirtualRendition(Set<RenditionMetadata> candidates,
long destWidth, long destHeight, double destRatio) {
// if ratio is defined get first rendition with matching ratio and same or bigger size
if (destRatio > 0) {
for (RenditionMetadata candidate : candidates) {
if (candidate.matches(destWidth, destHeight, 0, 0, destRatio)) {
return getVirtualRendition(candidate, destWidth, destHeight, destRatio);
}
}
}
// otherwise get first rendition which is same or bigger in width and height
else {
for (RenditionMetadata candidate : candidates) {
if (candidate.matches(destWidth, destHeight, 0, 0, 0d)) {
return getVirtualRendition(candidate, destWidth, destHeight, 0d);
}
}
}
// none found
return null;
} | [
"private",
"RenditionMetadata",
"getVirtualRendition",
"(",
"Set",
"<",
"RenditionMetadata",
">",
"candidates",
",",
"long",
"destWidth",
",",
"long",
"destHeight",
",",
"double",
"destRatio",
")",
"{",
"// if ratio is defined get first rendition with matching ratio and same or bigger size",
"if",
"(",
"destRatio",
">",
"0",
")",
"{",
"for",
"(",
"RenditionMetadata",
"candidate",
":",
"candidates",
")",
"{",
"if",
"(",
"candidate",
".",
"matches",
"(",
"destWidth",
",",
"destHeight",
",",
"0",
",",
"0",
",",
"destRatio",
")",
")",
"{",
"return",
"getVirtualRendition",
"(",
"candidate",
",",
"destWidth",
",",
"destHeight",
",",
"destRatio",
")",
";",
"}",
"}",
"}",
"// otherwise get first rendition which is same or bigger in width and height",
"else",
"{",
"for",
"(",
"RenditionMetadata",
"candidate",
":",
"candidates",
")",
"{",
"if",
"(",
"candidate",
".",
"matches",
"(",
"destWidth",
",",
"destHeight",
",",
"0",
",",
"0",
",",
"0d",
")",
")",
"{",
"return",
"getVirtualRendition",
"(",
"candidate",
",",
"destWidth",
",",
"destHeight",
",",
"0d",
")",
";",
"}",
"}",
"}",
"// none found",
"return",
"null",
";",
"}"
] | Check if a rendition is available from which the required format can be downscaled from and returns
a virtual rendition in this case.
@param candidates Candidates
@param destWidth Destination width
@param destHeight Destination height
@param destRatio Destination ratio
@return Rendition or null | [
"Check",
"if",
"a",
"rendition",
"is",
"available",
"from",
"which",
"the",
"required",
"format",
"can",
"be",
"downscaled",
"from",
"and",
"returns",
"a",
"virtual",
"rendition",
"in",
"this",
"case",
"."
] | train | https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/media/src/main/java/io/wcm/handler/mediasource/dam/impl/DefaultRenditionHandler.java#L387-L409 |
steveohara/j2mod | src/main/java/com/ghgande/j2mod/modbus/io/ModbusUDPTransport.java | ModbusUDPTransport.writeMessage | private void writeMessage(ModbusMessage msg) throws ModbusIOException {
"""
Writes the request/response message to the port
@param msg Message to write
@throws ModbusIOException If the port cannot be written to
"""
try {
synchronized (byteOutputStream) {
int len = msg.getOutputLength();
byteOutputStream.reset();
msg.writeTo(byteOutputStream);
byte data[] = byteOutputStream.getBuffer();
data = Arrays.copyOf(data, len);
terminal.sendMessage(data);
}
}
catch (Exception ex) {
throw new ModbusIOException("I/O exception - failed to write", ex);
}
} | java | private void writeMessage(ModbusMessage msg) throws ModbusIOException {
try {
synchronized (byteOutputStream) {
int len = msg.getOutputLength();
byteOutputStream.reset();
msg.writeTo(byteOutputStream);
byte data[] = byteOutputStream.getBuffer();
data = Arrays.copyOf(data, len);
terminal.sendMessage(data);
}
}
catch (Exception ex) {
throw new ModbusIOException("I/O exception - failed to write", ex);
}
} | [
"private",
"void",
"writeMessage",
"(",
"ModbusMessage",
"msg",
")",
"throws",
"ModbusIOException",
"{",
"try",
"{",
"synchronized",
"(",
"byteOutputStream",
")",
"{",
"int",
"len",
"=",
"msg",
".",
"getOutputLength",
"(",
")",
";",
"byteOutputStream",
".",
"reset",
"(",
")",
";",
"msg",
".",
"writeTo",
"(",
"byteOutputStream",
")",
";",
"byte",
"data",
"[",
"]",
"=",
"byteOutputStream",
".",
"getBuffer",
"(",
")",
";",
"data",
"=",
"Arrays",
".",
"copyOf",
"(",
"data",
",",
"len",
")",
";",
"terminal",
".",
"sendMessage",
"(",
"data",
")",
";",
"}",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"throw",
"new",
"ModbusIOException",
"(",
"\"I/O exception - failed to write\"",
",",
"ex",
")",
";",
"}",
"}"
] | Writes the request/response message to the port
@param msg Message to write
@throws ModbusIOException If the port cannot be written to | [
"Writes",
"the",
"request",
"/",
"response",
"message",
"to",
"the",
"port"
] | train | https://github.com/steveohara/j2mod/blob/67162c55d7c02564e50211a9df06b8314953b5f2/src/main/java/com/ghgande/j2mod/modbus/io/ModbusUDPTransport.java#L136-L150 |
casmi/casmi | src/main/java/casmi/image/Image.java | Image.getColor | public final Color getColor(int x, int y) {
"""
Returns the pixel color of this Image.
@param x
The x-coordinate of the pixel.
@param y
The y-coordinate of the pixel.
@return
The color of the pixel.
"""
int[] pixels = ((DataBufferInt)img.getRaster().getDataBuffer()).getData();
int idx = x + y * width;
return new RGBColor((pixels[idx] >> 16 & 0x000000ff) / 255.0,
(pixels[idx] >> 8 & 0x000000ff) / 255.0,
(pixels[idx] & 0x000000ff) / 255.0,
(pixels[idx] >> 24) / 255.0);
} | java | public final Color getColor(int x, int y) {
int[] pixels = ((DataBufferInt)img.getRaster().getDataBuffer()).getData();
int idx = x + y * width;
return new RGBColor((pixels[idx] >> 16 & 0x000000ff) / 255.0,
(pixels[idx] >> 8 & 0x000000ff) / 255.0,
(pixels[idx] & 0x000000ff) / 255.0,
(pixels[idx] >> 24) / 255.0);
} | [
"public",
"final",
"Color",
"getColor",
"(",
"int",
"x",
",",
"int",
"y",
")",
"{",
"int",
"[",
"]",
"pixels",
"=",
"(",
"(",
"DataBufferInt",
")",
"img",
".",
"getRaster",
"(",
")",
".",
"getDataBuffer",
"(",
")",
")",
".",
"getData",
"(",
")",
";",
"int",
"idx",
"=",
"x",
"+",
"y",
"*",
"width",
";",
"return",
"new",
"RGBColor",
"(",
"(",
"pixels",
"[",
"idx",
"]",
">>",
"16",
"&",
"0x000000ff",
")",
"/",
"255.0",
",",
"(",
"pixels",
"[",
"idx",
"]",
">>",
"8",
"&",
"0x000000ff",
")",
"/",
"255.0",
",",
"(",
"pixels",
"[",
"idx",
"]",
"&",
"0x000000ff",
")",
"/",
"255.0",
",",
"(",
"pixels",
"[",
"idx",
"]",
">>",
"24",
")",
"/",
"255.0",
")",
";",
"}"
] | Returns the pixel color of this Image.
@param x
The x-coordinate of the pixel.
@param y
The y-coordinate of the pixel.
@return
The color of the pixel. | [
"Returns",
"the",
"pixel",
"color",
"of",
"this",
"Image",
"."
] | train | https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/image/Image.java#L251-L259 |
UrielCh/ovh-java-sdk | ovh-java-sdk-emailmxplan/src/main/java/net/minidev/ovh/api/ApiOvhEmailmxplan.java | ApiOvhEmailmxplan.service_domain_domainName_disclaimer_POST | public OvhTask service_domain_domainName_disclaimer_POST(String service, String domainName, String content, Boolean outsideOnly) throws IOException {
"""
Create organization disclaimer of each email
REST: POST /email/mxplan/{service}/domain/{domainName}/disclaimer
@param content [required] Signature, added at the bottom of your organization emails
@param outsideOnly [required] Activate the disclaimer only for external emails
@param service [required] The internal name of your mxplan organization
@param domainName [required] Domain name
API beta
"""
String qPath = "/email/mxplan/{service}/domain/{domainName}/disclaimer";
StringBuilder sb = path(qPath, service, domainName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "content", content);
addBody(o, "outsideOnly", outsideOnly);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhTask.class);
} | java | public OvhTask service_domain_domainName_disclaimer_POST(String service, String domainName, String content, Boolean outsideOnly) throws IOException {
String qPath = "/email/mxplan/{service}/domain/{domainName}/disclaimer";
StringBuilder sb = path(qPath, service, domainName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "content", content);
addBody(o, "outsideOnly", outsideOnly);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhTask.class);
} | [
"public",
"OvhTask",
"service_domain_domainName_disclaimer_POST",
"(",
"String",
"service",
",",
"String",
"domainName",
",",
"String",
"content",
",",
"Boolean",
"outsideOnly",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/email/mxplan/{service}/domain/{domainName}/disclaimer\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"service",
",",
"domainName",
")",
";",
"HashMap",
"<",
"String",
",",
"Object",
">",
"o",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"addBody",
"(",
"o",
",",
"\"content\"",
",",
"content",
")",
";",
"addBody",
"(",
"o",
",",
"\"outsideOnly\"",
",",
"outsideOnly",
")",
";",
"String",
"resp",
"=",
"exec",
"(",
"qPath",
",",
"\"POST\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"o",
")",
";",
"return",
"convertTo",
"(",
"resp",
",",
"OvhTask",
".",
"class",
")",
";",
"}"
] | Create organization disclaimer of each email
REST: POST /email/mxplan/{service}/domain/{domainName}/disclaimer
@param content [required] Signature, added at the bottom of your organization emails
@param outsideOnly [required] Activate the disclaimer only for external emails
@param service [required] The internal name of your mxplan organization
@param domainName [required] Domain name
API beta | [
"Create",
"organization",
"disclaimer",
"of",
"each",
"email"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emailmxplan/src/main/java/net/minidev/ovh/api/ApiOvhEmailmxplan.java#L702-L710 |
kubernetes-client/java | util/src/main/java/io/kubernetes/client/informer/cache/Cache.java | Cache.deleteFromIndices | private void deleteFromIndices(ApiType oldObj, String key) {
"""
deleteFromIndices removes the object from each of the managed indexes.
<p>Note: It is intended to be called from a function that already has a lock on the cache.
@param oldObj the old obj
@param key the key
"""
for (Map.Entry<String, Function<ApiType, List<String>>> indexEntry : this.indexers.entrySet()) {
Function<ApiType, List<String>> indexFunc = indexEntry.getValue();
List<String> indexValues = indexFunc.apply(oldObj);
if (io.kubernetes.client.util.common.Collections.isEmptyCollection(indexValues)) {
continue;
}
Map<String, Set<String>> index = this.indices.get(indexEntry.getKey());
if (index == null) {
continue;
}
for (String indexValue : indexValues) {
Set<String> indexSet = index.get(indexValue);
if (indexSet != null) {
indexSet.remove(key);
}
}
}
} | java | private void deleteFromIndices(ApiType oldObj, String key) {
for (Map.Entry<String, Function<ApiType, List<String>>> indexEntry : this.indexers.entrySet()) {
Function<ApiType, List<String>> indexFunc = indexEntry.getValue();
List<String> indexValues = indexFunc.apply(oldObj);
if (io.kubernetes.client.util.common.Collections.isEmptyCollection(indexValues)) {
continue;
}
Map<String, Set<String>> index = this.indices.get(indexEntry.getKey());
if (index == null) {
continue;
}
for (String indexValue : indexValues) {
Set<String> indexSet = index.get(indexValue);
if (indexSet != null) {
indexSet.remove(key);
}
}
}
} | [
"private",
"void",
"deleteFromIndices",
"(",
"ApiType",
"oldObj",
",",
"String",
"key",
")",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"Function",
"<",
"ApiType",
",",
"List",
"<",
"String",
">",
">",
">",
"indexEntry",
":",
"this",
".",
"indexers",
".",
"entrySet",
"(",
")",
")",
"{",
"Function",
"<",
"ApiType",
",",
"List",
"<",
"String",
">",
">",
"indexFunc",
"=",
"indexEntry",
".",
"getValue",
"(",
")",
";",
"List",
"<",
"String",
">",
"indexValues",
"=",
"indexFunc",
".",
"apply",
"(",
"oldObj",
")",
";",
"if",
"(",
"io",
".",
"kubernetes",
".",
"client",
".",
"util",
".",
"common",
".",
"Collections",
".",
"isEmptyCollection",
"(",
"indexValues",
")",
")",
"{",
"continue",
";",
"}",
"Map",
"<",
"String",
",",
"Set",
"<",
"String",
">",
">",
"index",
"=",
"this",
".",
"indices",
".",
"get",
"(",
"indexEntry",
".",
"getKey",
"(",
")",
")",
";",
"if",
"(",
"index",
"==",
"null",
")",
"{",
"continue",
";",
"}",
"for",
"(",
"String",
"indexValue",
":",
"indexValues",
")",
"{",
"Set",
"<",
"String",
">",
"indexSet",
"=",
"index",
".",
"get",
"(",
"indexValue",
")",
";",
"if",
"(",
"indexSet",
"!=",
"null",
")",
"{",
"indexSet",
".",
"remove",
"(",
"key",
")",
";",
"}",
"}",
"}",
"}"
] | deleteFromIndices removes the object from each of the managed indexes.
<p>Note: It is intended to be called from a function that already has a lock on the cache.
@param oldObj the old obj
@param key the key | [
"deleteFromIndices",
"removes",
"the",
"object",
"from",
"each",
"of",
"the",
"managed",
"indexes",
"."
] | train | https://github.com/kubernetes-client/java/blob/7413e98bd904f09d1ad00fb60e8c6ff787f3f560/util/src/main/java/io/kubernetes/client/informer/cache/Cache.java#L357-L376 |
alkacon/opencms-core | src/org/opencms/loader/CmsJspLoader.java | CmsJspLoader.parseJspLinkMacros | protected String parseJspLinkMacros(String content, CmsFlexController controller) {
"""
Parses all jsp link macros, and replace them by the right target path.<p>
@param content the content to parse
@param controller the request controller
@return the parsed content
"""
CmsJspLinkMacroResolver macroResolver = new CmsJspLinkMacroResolver(controller.getCmsObject(), null, true);
return macroResolver.resolveMacros(content);
} | java | protected String parseJspLinkMacros(String content, CmsFlexController controller) {
CmsJspLinkMacroResolver macroResolver = new CmsJspLinkMacroResolver(controller.getCmsObject(), null, true);
return macroResolver.resolveMacros(content);
} | [
"protected",
"String",
"parseJspLinkMacros",
"(",
"String",
"content",
",",
"CmsFlexController",
"controller",
")",
"{",
"CmsJspLinkMacroResolver",
"macroResolver",
"=",
"new",
"CmsJspLinkMacroResolver",
"(",
"controller",
".",
"getCmsObject",
"(",
")",
",",
"null",
",",
"true",
")",
";",
"return",
"macroResolver",
".",
"resolveMacros",
"(",
"content",
")",
";",
"}"
] | Parses all jsp link macros, and replace them by the right target path.<p>
@param content the content to parse
@param controller the request controller
@return the parsed content | [
"Parses",
"all",
"jsp",
"link",
"macros",
"and",
"replace",
"them",
"by",
"the",
"right",
"target",
"path",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/loader/CmsJspLoader.java#L1585-L1589 |
JodaOrg/joda-convert | src/main/java/org/joda/convert/RenameHandler.java | RenameHandler.lookupEnum | public <T extends Enum<T>> T lookupEnum(Class<T> type, String name) {
"""
Lookup an enum from a name, handling renames.
@param <T> the type of the desired enum
@param type the enum type, not null
@param name the name of the enum to lookup, not null
@return the enum value, not null
@throws IllegalArgumentException if the name is not a valid enum constant
"""
if (type == null) {
throw new IllegalArgumentException("type must not be null");
}
if (name == null) {
throw new IllegalArgumentException("name must not be null");
}
Map<String, Enum<?>> map = getEnumRenames(type);
Enum<?> value = map.get(name);
if (value != null) {
return type.cast(value);
}
return Enum.valueOf(type, name);
} | java | public <T extends Enum<T>> T lookupEnum(Class<T> type, String name) {
if (type == null) {
throw new IllegalArgumentException("type must not be null");
}
if (name == null) {
throw new IllegalArgumentException("name must not be null");
}
Map<String, Enum<?>> map = getEnumRenames(type);
Enum<?> value = map.get(name);
if (value != null) {
return type.cast(value);
}
return Enum.valueOf(type, name);
} | [
"public",
"<",
"T",
"extends",
"Enum",
"<",
"T",
">",
">",
"T",
"lookupEnum",
"(",
"Class",
"<",
"T",
">",
"type",
",",
"String",
"name",
")",
"{",
"if",
"(",
"type",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"type must not be null\"",
")",
";",
"}",
"if",
"(",
"name",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"name must not be null\"",
")",
";",
"}",
"Map",
"<",
"String",
",",
"Enum",
"<",
"?",
">",
">",
"map",
"=",
"getEnumRenames",
"(",
"type",
")",
";",
"Enum",
"<",
"?",
">",
"value",
"=",
"map",
".",
"get",
"(",
"name",
")",
";",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"return",
"type",
".",
"cast",
"(",
"value",
")",
";",
"}",
"return",
"Enum",
".",
"valueOf",
"(",
"type",
",",
"name",
")",
";",
"}"
] | Lookup an enum from a name, handling renames.
@param <T> the type of the desired enum
@param type the enum type, not null
@param name the name of the enum to lookup, not null
@return the enum value, not null
@throws IllegalArgumentException if the name is not a valid enum constant | [
"Lookup",
"an",
"enum",
"from",
"a",
"name",
"handling",
"renames",
"."
] | train | https://github.com/JodaOrg/joda-convert/blob/266bd825f4550590d5dafdf4225c548559e0633b/src/main/java/org/joda/convert/RenameHandler.java#L267-L280 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.