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 listlengths 20 832 | func_documentation_string stringlengths 61 2k | func_documentation_tokens listlengths 1 647 | split_name stringclasses 1
value | func_code_url stringlengths 102 339 |
|---|---|---|---|---|---|---|---|---|---|---|
gallandarakhneorg/afc | advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GISCoordinates.java | GISCoordinates.WSG84_L2 | @Pure
public static Point2d WSG84_L2(double lambda, double phi) {
"""
This function convert WSG84 GPS coordinate to France Lambert II coordinate.
@param lambda in degrees.
@param phi in degrees.
@return the France Lambert II coordinates.
"""
final Point2d ntfLambdaPhi = WSG84_NTFLamdaPhi(lambda, phi)... | java | @Pure
public static Point2d WSG84_L2(double lambda, double phi) {
final Point2d ntfLambdaPhi = WSG84_NTFLamdaPhi(lambda, phi);
return NTFLambdaPhi_NTFLambert(
ntfLambdaPhi.getX(), ntfLambdaPhi.getY(),
LAMBERT_2_N,
LAMBERT_2_C,
LAMBERT_2_XS,
LAMBERT_2_YS);
} | [
"@",
"Pure",
"public",
"static",
"Point2d",
"WSG84_L2",
"(",
"double",
"lambda",
",",
"double",
"phi",
")",
"{",
"final",
"Point2d",
"ntfLambdaPhi",
"=",
"WSG84_NTFLamdaPhi",
"(",
"lambda",
",",
"phi",
")",
";",
"return",
"NTFLambdaPhi_NTFLambert",
"(",
"ntfLa... | This function convert WSG84 GPS coordinate to France Lambert II coordinate.
@param lambda in degrees.
@param phi in degrees.
@return the France Lambert II coordinates. | [
"This",
"function",
"convert",
"WSG84",
"GPS",
"coordinate",
"to",
"France",
"Lambert",
"II",
"coordinate",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GISCoordinates.java#L1079-L1088 |
facebookarchive/hive-dwrf | hive-dwrf/src/main/java/com/facebook/hive/orc/DynamicByteArray.java | DynamicByteArray.setText | public void setText(Text result, int offset, int length) {
"""
Set a text value from the bytes in this dynamic array.
@param result the value to set
@param offset the start of the bytes to copy
@param length the number of bytes to copy
"""
result.clear();
result.set(data.getBytes(), offset, length);... | java | public void setText(Text result, int offset, int length) {
result.clear();
result.set(data.getBytes(), offset, length);
} | [
"public",
"void",
"setText",
"(",
"Text",
"result",
",",
"int",
"offset",
",",
"int",
"length",
")",
"{",
"result",
".",
"clear",
"(",
")",
";",
"result",
".",
"set",
"(",
"data",
".",
"getBytes",
"(",
")",
",",
"offset",
",",
"length",
")",
";",
... | Set a text value from the bytes in this dynamic array.
@param result the value to set
@param offset the start of the bytes to copy
@param length the number of bytes to copy | [
"Set",
"a",
"text",
"value",
"from",
"the",
"bytes",
"in",
"this",
"dynamic",
"array",
"."
] | train | https://github.com/facebookarchive/hive-dwrf/blob/a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45/hive-dwrf/src/main/java/com/facebook/hive/orc/DynamicByteArray.java#L146-L149 |
fhoeben/hsac-fitnesse-fixtures | src/main/java/nl/hsac/fitnesse/fixture/slim/CompareFixture.java | CompareFixture.differenceBetweenIgnoreWhitespaceAnd | public String differenceBetweenIgnoreWhitespaceAnd(String first, String second) {
"""
Determines difference between two strings, ignoring whitespace changes.
@param first first string to compare.
@param second second string to compare.
@return HTML of difference between the two.
"""
String cleanFirs... | java | public String differenceBetweenIgnoreWhitespaceAnd(String first, String second) {
String cleanFirst = allWhitespaceToSingleSpace(first);
String cleanSecond = allWhitespaceToSingleSpace(second);
String cleanDiff = differenceBetweenAnd(cleanFirst, cleanSecond);
if (cleanDiff != null) {
... | [
"public",
"String",
"differenceBetweenIgnoreWhitespaceAnd",
"(",
"String",
"first",
",",
"String",
"second",
")",
"{",
"String",
"cleanFirst",
"=",
"allWhitespaceToSingleSpace",
"(",
"first",
")",
";",
"String",
"cleanSecond",
"=",
"allWhitespaceToSingleSpace",
"(",
"... | Determines difference between two strings, ignoring whitespace changes.
@param first first string to compare.
@param second second string to compare.
@return HTML of difference between the two. | [
"Determines",
"difference",
"between",
"two",
"strings",
"ignoring",
"whitespace",
"changes",
"."
] | train | https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/slim/CompareFixture.java#L106-L118 |
liferay/com-liferay-commerce | commerce-product-service/src/main/java/com/liferay/commerce/product/service/base/CPInstanceLocalServiceBaseImpl.java | CPInstanceLocalServiceBaseImpl.fetchCPInstanceByUuidAndGroupId | @Override
public CPInstance fetchCPInstanceByUuidAndGroupId(String uuid, long groupId) {
"""
Returns the cp instance matching the UUID and group.
@param uuid the cp instance's UUID
@param groupId the primary key of the group
@return the matching cp instance, or <code>null</code> if a matching cp instance cou... | java | @Override
public CPInstance fetchCPInstanceByUuidAndGroupId(String uuid, long groupId) {
return cpInstancePersistence.fetchByUUID_G(uuid, groupId);
} | [
"@",
"Override",
"public",
"CPInstance",
"fetchCPInstanceByUuidAndGroupId",
"(",
"String",
"uuid",
",",
"long",
"groupId",
")",
"{",
"return",
"cpInstancePersistence",
".",
"fetchByUUID_G",
"(",
"uuid",
",",
"groupId",
")",
";",
"}"
] | Returns the cp instance matching the UUID and group.
@param uuid the cp instance's UUID
@param groupId the primary key of the group
@return the matching cp instance, or <code>null</code> if a matching cp instance could not be found | [
"Returns",
"the",
"cp",
"instance",
"matching",
"the",
"UUID",
"and",
"group",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/base/CPInstanceLocalServiceBaseImpl.java#L267-L270 |
jnidzwetzki/bitfinex-v2-wss-api-java | src/main/java/com/github/jnidzwetzki/bitfinex/v2/BitfinexClientFactory.java | BitfinexClientFactory.newPooledClient | public static BitfinexWebsocketClient newPooledClient(final BitfinexWebsocketConfiguration config,
final int channelsPerConnection) {
"""
bitfinex client with subscribed channel managed.
spreads amount of subscribed channels across multiple websocket physical connections.
@param config - ... | java | public static BitfinexWebsocketClient newPooledClient(final BitfinexWebsocketConfiguration config,
final int channelsPerConnection) {
if (channelsPerConnection < 10 || channelsPerConnection > 250) {
throw new IllegalArgumentException("channelsPerConnection must be in range (10, 250)");
... | [
"public",
"static",
"BitfinexWebsocketClient",
"newPooledClient",
"(",
"final",
"BitfinexWebsocketConfiguration",
"config",
",",
"final",
"int",
"channelsPerConnection",
")",
"{",
"if",
"(",
"channelsPerConnection",
"<",
"10",
"||",
"channelsPerConnection",
">",
"250",
... | bitfinex client with subscribed channel managed.
spreads amount of subscribed channels across multiple websocket physical connections.
@param config - config
@param channelsPerConnection - channels per client - 25 - 250 (limit by bitfinex exchange)
@return {@link PooledBitfinexApiBroker} client | [
"bitfinex",
"client",
"with",
"subscribed",
"channel",
"managed",
".",
"spreads",
"amount",
"of",
"subscribed",
"channels",
"across",
"multiple",
"websocket",
"physical",
"connections",
"."
] | train | https://github.com/jnidzwetzki/bitfinex-v2-wss-api-java/blob/2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee/src/main/java/com/github/jnidzwetzki/bitfinex/v2/BitfinexClientFactory.java#L54-L67 |
fcrepo3/fcrepo | fcrepo-common/src/main/java/org/fcrepo/common/rdf/JRDF.java | JRDF.sameLiteral | public static boolean sameLiteral(Literal l1, Literal l2) {
"""
Tells whether the given literals are equivalent.
<p>
Two literals are equivalent if they have the same lexical value, language
(which may be unspecified), and datatype (which may be unspecified).
@param l1
first literal.
@param l2
second lite... | java | public static boolean sameLiteral(Literal l1, Literal l2) {
URI type = l2.getDatatypeURI();
return sameLiteral(l1, l2.getLexicalForm(), type, l2.getLanguage());
} | [
"public",
"static",
"boolean",
"sameLiteral",
"(",
"Literal",
"l1",
",",
"Literal",
"l2",
")",
"{",
"URI",
"type",
"=",
"l2",
".",
"getDatatypeURI",
"(",
")",
";",
"return",
"sameLiteral",
"(",
"l1",
",",
"l2",
".",
"getLexicalForm",
"(",
")",
",",
"ty... | Tells whether the given literals are equivalent.
<p>
Two literals are equivalent if they have the same lexical value, language
(which may be unspecified), and datatype (which may be unspecified).
@param l1
first literal.
@param l2
second literal.
@return true if equivalent, false otherwise. | [
"Tells",
"whether",
"the",
"given",
"literals",
"are",
"equivalent",
".",
"<p",
">",
"Two",
"literals",
"are",
"equivalent",
"if",
"they",
"have",
"the",
"same",
"lexical",
"value",
"language",
"(",
"which",
"may",
"be",
"unspecified",
")",
"and",
"datatype"... | train | https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-common/src/main/java/org/fcrepo/common/rdf/JRDF.java#L86-L89 |
networknt/light-4j | service/src/main/java/com/networknt/service/SingletonServiceFactory.java | SingletonServiceFactory.handleSingletonList | private static void handleSingletonList(String key, List<Object> value) throws Exception {
"""
For each singleton definition, create object for the interface with the implementation class,
and push it into the service map with key and implemented object.
@param key String interface or multiple interface separate... | java | private static void handleSingletonList(String key, List<Object> value) throws Exception {
List<String> interfaceClasses = new ArrayList();
if(key.contains(",")) {
String[] interfaces = key.split(",");
interfaceClasses.addAll(Arrays.asList(interfaces));
} else {
... | [
"private",
"static",
"void",
"handleSingletonList",
"(",
"String",
"key",
",",
"List",
"<",
"Object",
">",
"value",
")",
"throws",
"Exception",
"{",
"List",
"<",
"String",
">",
"interfaceClasses",
"=",
"new",
"ArrayList",
"(",
")",
";",
"if",
"(",
"key",
... | For each singleton definition, create object for the interface with the implementation class,
and push it into the service map with key and implemented object.
@param key String interface or multiple interface separated by ","
@param value List of implementations of interface(s) defined in the key
@throws Exception exc... | [
"For",
"each",
"singleton",
"definition",
"create",
"object",
"for",
"the",
"interface",
"with",
"the",
"implementation",
"class",
"and",
"push",
"it",
"into",
"the",
"service",
"map",
"with",
"key",
"and",
"implemented",
"object",
"."
] | train | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/service/src/main/java/com/networknt/service/SingletonServiceFactory.java#L210-L225 |
Impetus/Kundera | src/kundera-rdbms/src/main/java/com/impetus/client/rdbms/query/RDBMSEntityReader.java | RDBMSEntityReader.populateEnhanceEntities | private List<EnhanceEntity> populateEnhanceEntities(EntityMetadata m, List<String> relationNames, Client client,
String sqlQuery) {
"""
Populate enhance entities.
@param m
the m
@param relationNames
the relation names
@param client
the client
@param sqlQuery
the sql query
@return the list
... | java | private List<EnhanceEntity> populateEnhanceEntities(EntityMetadata m, List<String> relationNames, Client client,
String sqlQuery)
{
List<EnhanceEntity> ls = null;
List result = ((HibernateClient) client).find(sqlQuery, relationNames, m);
if (!result.isEmpty())
{
... | [
"private",
"List",
"<",
"EnhanceEntity",
">",
"populateEnhanceEntities",
"(",
"EntityMetadata",
"m",
",",
"List",
"<",
"String",
">",
"relationNames",
",",
"Client",
"client",
",",
"String",
"sqlQuery",
")",
"{",
"List",
"<",
"EnhanceEntity",
">",
"ls",
"=",
... | Populate enhance entities.
@param m
the m
@param relationNames
the relation names
@param client
the client
@param sqlQuery
the sql query
@return the list | [
"Populate",
"enhance",
"entities",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-rdbms/src/main/java/com/impetus/client/rdbms/query/RDBMSEntityReader.java#L183-L207 |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/evaluator/context/RootContextLauncher.java | RootContextLauncher.getRootContext | private static ContextRuntime getRootContext(final Injector injector,
final Configuration rootContextConfiguration,
final Optional<Configuration> rootServiceConfiguration)
throws ContextClientCodeException {
"""
Ins... | java | private static ContextRuntime getRootContext(final Injector injector,
final Configuration rootContextConfiguration,
final Optional<Configuration> rootServiceConfiguration)
throws ContextClientCodeException {
final Co... | [
"private",
"static",
"ContextRuntime",
"getRootContext",
"(",
"final",
"Injector",
"injector",
",",
"final",
"Configuration",
"rootContextConfiguration",
",",
"final",
"Optional",
"<",
"Configuration",
">",
"rootServiceConfiguration",
")",
"throws",
"ContextClientCodeExcept... | Instantiates the root context.
<p>
This also launches the initial task if there is any.
@param injector
@param rootContextConfiguration
@param rootServiceConfiguration
@return ContextRuntime
@throws ContextClientCodeException | [
"Instantiates",
"the",
"root",
"context",
".",
"<p",
">",
"This",
"also",
"launches",
"the",
"initial",
"task",
"if",
"there",
"is",
"any",
"."
] | train | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/evaluator/context/RootContextLauncher.java#L105-L123 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jaxrs.2.0.common/src/org/apache/cxf/common/util/UrlUtils.java | UrlUtils.parseQueryString | public static Map<String, String> parseQueryString(String s) {
"""
Create a map from String to String that represents the contents of the query
portion of a URL. For each x=y, x is the key and y is the value.
@param s the query part of the URI.
@return the map.
"""
Map<String, String> ht = new Has... | java | public static Map<String, String> parseQueryString(String s) {
Map<String, String> ht = new HashMap<String, String>();
StringTokenizer st = new StringTokenizer(s, "&");
while (st.hasMoreTokens()) {
String pair = st.nextToken();
int pos = pair.indexOf('=');
if ... | [
"public",
"static",
"Map",
"<",
"String",
",",
"String",
">",
"parseQueryString",
"(",
"String",
"s",
")",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"ht",
"=",
"new",
"HashMap",
"<",
"String",
",",
"String",
">",
"(",
")",
";",
"StringTokenizer",
... | Create a map from String to String that represents the contents of the query
portion of a URL. For each x=y, x is the key and y is the value.
@param s the query part of the URI.
@return the map. | [
"Create",
"a",
"map",
"from",
"String",
"to",
"String",
"that",
"represents",
"the",
"contents",
"of",
"the",
"query",
"portion",
"of",
"a",
"URL",
".",
"For",
"each",
"x",
"=",
"y",
"x",
"is",
"the",
"key",
"and",
"y",
"is",
"the",
"value",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jaxrs.2.0.common/src/org/apache/cxf/common/util/UrlUtils.java#L152-L166 |
Azure/azure-sdk-for-java | network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/VirtualNetworkGatewayConnectionsInner.java | VirtualNetworkGatewayConnectionsInner.beginUpdateTagsAsync | public Observable<VirtualNetworkGatewayConnectionListEntityInner> beginUpdateTagsAsync(String resourceGroupName, String virtualNetworkGatewayConnectionName, Map<String, String> tags) {
"""
Updates a virtual network gateway connection tags.
@param resourceGroupName The name of the resource group.
@param virtual... | java | public Observable<VirtualNetworkGatewayConnectionListEntityInner> beginUpdateTagsAsync(String resourceGroupName, String virtualNetworkGatewayConnectionName, Map<String, String> tags) {
return beginUpdateTagsWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayConnectionName, tags).map(new Func1<Serv... | [
"public",
"Observable",
"<",
"VirtualNetworkGatewayConnectionListEntityInner",
">",
"beginUpdateTagsAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"virtualNetworkGatewayConnectionName",
",",
"Map",
"<",
"String",
",",
"String",
">",
"tags",
")",
"{",
"return",... | Updates a virtual network gateway connection tags.
@param resourceGroupName The name of the resource group.
@param virtualNetworkGatewayConnectionName The name of the virtual network gateway connection.
@param tags Resource tags.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the obs... | [
"Updates",
"a",
"virtual",
"network",
"gateway",
"connection",
"tags",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/VirtualNetworkGatewayConnectionsInner.java#L792-L799 |
Azure/azure-sdk-for-java | hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/ScriptExecutionHistorysInner.java | ScriptExecutionHistorysInner.promoteAsync | public Observable<Void> promoteAsync(String resourceGroupName, String clusterName, String scriptExecutionId) {
"""
Promotes the specified ad-hoc script execution to a persisted script.
@param resourceGroupName The name of the resource group.
@param clusterName The name of the cluster.
@param scriptExecutionId... | java | public Observable<Void> promoteAsync(String resourceGroupName, String clusterName, String scriptExecutionId) {
return promoteWithServiceResponseAsync(resourceGroupName, clusterName, scriptExecutionId).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceRespon... | [
"public",
"Observable",
"<",
"Void",
">",
"promoteAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"clusterName",
",",
"String",
"scriptExecutionId",
")",
"{",
"return",
"promoteWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"clusterName",
",",
"s... | Promotes the specified ad-hoc script execution to a persisted script.
@param resourceGroupName The name of the resource group.
@param clusterName The name of the cluster.
@param scriptExecutionId The script execution Id
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link Servic... | [
"Promotes",
"the",
"specified",
"ad",
"-",
"hoc",
"script",
"execution",
"to",
"a",
"persisted",
"script",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/ScriptExecutionHistorysInner.java#L235-L242 |
rundeck/rundeck | core/src/main/java/com/dtolabs/rundeck/core/plugins/ZipResourceLoader.java | ZipResourceLoader.extractJarContents | private void extractJarContents(final List<String> entries, final File destdir) throws IOException {
"""
Extract specific entries from the jar to a destination directory. Creates the
destination directory if it does not exist
@param entries the entries to extract
@param destdir destination directory
"""
... | java | private void extractJarContents(final List<String> entries, final File destdir) throws IOException {
if (!destdir.exists()) {
if (!destdir.mkdir()) {
//log.warn("Unable to create cache dir for plugin: " + destdir.getAbsolutePath());
}
}
//debug("extractin... | [
"private",
"void",
"extractJarContents",
"(",
"final",
"List",
"<",
"String",
">",
"entries",
",",
"final",
"File",
"destdir",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"destdir",
".",
"exists",
"(",
")",
")",
"{",
"if",
"(",
"!",
"destdir",
"... | Extract specific entries from the jar to a destination directory. Creates the
destination directory if it does not exist
@param entries the entries to extract
@param destdir destination directory | [
"Extract",
"specific",
"entries",
"from",
"the",
"jar",
"to",
"a",
"destination",
"directory",
".",
"Creates",
"the",
"destination",
"directory",
"if",
"it",
"does",
"not",
"exist"
] | train | https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/plugins/ZipResourceLoader.java#L150-L163 |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/mps/techsupport.java | techsupport.get_nitro_bulk_response | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception {
"""
<pre>
Converts API response of bulk operation into object and returns the object array in case of get request.
</pre>
"""
techsupport_responses result = (techsupport_responses) service.get_payl... | java | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
techsupport_responses result = (techsupport_responses) service.get_payload_formatter().string_to_resource(techsupport_responses.class, response);
if(result.errorcode != 0)
{
if (result.errorcode =... | [
"protected",
"base_resource",
"[",
"]",
"get_nitro_bulk_response",
"(",
"nitro_service",
"service",
",",
"String",
"response",
")",
"throws",
"Exception",
"{",
"techsupport_responses",
"result",
"=",
"(",
"techsupport_responses",
")",
"service",
".",
"get_payload_format... | <pre>
Converts API response of bulk operation into object and returns the object array in case of get request.
</pre> | [
"<pre",
">",
"Converts",
"API",
"response",
"of",
"bulk",
"operation",
"into",
"object",
"and",
"returns",
"the",
"object",
"array",
"in",
"case",
"of",
"get",
"request",
".",
"<",
"/",
"pre",
">"
] | train | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/mps/techsupport.java#L329-L346 |
greenmail-mail-test/greenmail | greenmail-core/src/main/java/com/icegreen/greenmail/util/GreenMailUtil.java | GreenMailUtil.createMultipartWithAttachment | public static MimeMultipart createMultipartWithAttachment(String msg, final byte[] attachment, final String contentType,
final String filename, String description) {
"""
Create new multipart with a text part and an attachment
@param msg Mes... | java | public static MimeMultipart createMultipartWithAttachment(String msg, final byte[] attachment, final String contentType,
final String filename, String description) {
try {
MimeMultipart multiPart = new MimeMultipart();
... | [
"public",
"static",
"MimeMultipart",
"createMultipartWithAttachment",
"(",
"String",
"msg",
",",
"final",
"byte",
"[",
"]",
"attachment",
",",
"final",
"String",
"contentType",
",",
"final",
"String",
"filename",
",",
"String",
"description",
")",
"{",
"try",
"{... | Create new multipart with a text part and an attachment
@param msg Message text
@param attachment Attachment data
@param contentType MIME content type of body
@param filename File name of the attachment
@param description Description of the attachment
@return New multipart | [
"Create",
"new",
"multipart",
"with",
"a",
"text",
"part",
"and",
"an",
"attachment"
] | train | https://github.com/greenmail-mail-test/greenmail/blob/6d19a62233d1ef6fedbbd1f6fdde2d28e713834a/greenmail-core/src/main/java/com/icegreen/greenmail/util/GreenMailUtil.java#L322-L364 |
Azure/azure-sdk-for-java | batchai/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/batchai/v2018_05_01/implementation/JobsInner.java | JobsInner.getAsync | public Observable<JobInner> getAsync(String resourceGroupName, String workspaceName, String experimentName, String jobName) {
"""
Gets information about a Job.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param workspaceName The name of the workspace. Workspace names can ... | java | public Observable<JobInner> getAsync(String resourceGroupName, String workspaceName, String experimentName, String jobName) {
return getWithServiceResponseAsync(resourceGroupName, workspaceName, experimentName, jobName).map(new Func1<ServiceResponse<JobInner>, JobInner>() {
@Override
pub... | [
"public",
"Observable",
"<",
"JobInner",
">",
"getAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"workspaceName",
",",
"String",
"experimentName",
",",
"String",
"jobName",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
... | Gets information about a Job.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param workspaceName The name of the workspace. Workspace names can only contain a combination of alphanumeric characters along with dash (-) and underscore (_). The name must be from 1 through 64 character... | [
"Gets",
"information",
"about",
"a",
"Job",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batchai/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/batchai/v2018_05_01/implementation/JobsInner.java#L813-L820 |
hal/core | gui/src/main/java/org/jboss/as/console/client/tools/ModelBrowserView.java | ModelBrowserView.updateRootTypes | public void updateRootTypes(ModelNode address, List<ModelNode> modelNodes) {
"""
Update root node. Basicaly a refresh of the tree.
@param address
@param modelNodes
"""
deck.showWidget(CHILD_VIEW);
tree.clear();
descView.clearDisplay();
formView.clearDisplay();
offse... | java | public void updateRootTypes(ModelNode address, List<ModelNode> modelNodes) {
deck.showWidget(CHILD_VIEW);
tree.clear();
descView.clearDisplay();
formView.clearDisplay();
offsetDisplay.clear();
// IMPORTANT: when pin down is active, we need to consider the offset to calc... | [
"public",
"void",
"updateRootTypes",
"(",
"ModelNode",
"address",
",",
"List",
"<",
"ModelNode",
">",
"modelNodes",
")",
"{",
"deck",
".",
"showWidget",
"(",
"CHILD_VIEW",
")",
";",
"tree",
".",
"clear",
"(",
")",
";",
"descView",
".",
"clearDisplay",
"(",... | Update root node. Basicaly a refresh of the tree.
@param address
@param modelNodes | [
"Update",
"root",
"node",
".",
"Basicaly",
"a",
"refresh",
"of",
"the",
"tree",
"."
] | train | https://github.com/hal/core/blob/d6d03f0bb128dc0470f5dc75fdb1ea1014400602/gui/src/main/java/org/jboss/as/console/client/tools/ModelBrowserView.java#L411-L463 |
aws/aws-sdk-java | aws-java-sdk-code-generator/src/main/java/com/amazonaws/codegen/customization/processors/EmitLegacyEnumSetterProcessor.java | EmitLegacyEnumSetterProcessor.assertShapeAndMembersAreInModel | private static void assertShapeAndMembersAreInModel(IntermediateModel model, Map<String, List<String>> shapeAndMembers) {
"""
Checks that all shapes and members in a given customization are actually in the model. Good to fail fast for things like
typos instead of silently not applying that customization.
@para... | java | private static void assertShapeAndMembersAreInModel(IntermediateModel model, Map<String, List<String>> shapeAndMembers) {
shapeAndMembers.forEach((shapeName, members) -> {
if (Utils.findShapeModelByC2jNameIfExists(model, shapeName) == null) {
throw new IllegalStateException(
... | [
"private",
"static",
"void",
"assertShapeAndMembersAreInModel",
"(",
"IntermediateModel",
"model",
",",
"Map",
"<",
"String",
",",
"List",
"<",
"String",
">",
">",
"shapeAndMembers",
")",
"{",
"shapeAndMembers",
".",
"forEach",
"(",
"(",
"shapeName",
",",
"membe... | Checks that all shapes and members in a given customization are actually in the model. Good to fail fast for things like
typos instead of silently not applying that customization.
@param model {@link IntermediateModel}
@param shapeAndMembers Shape and members referenced by customization. Map of String (shape... | [
"Checks",
"that",
"all",
"shapes",
"and",
"members",
"in",
"a",
"given",
"customization",
"are",
"actually",
"in",
"the",
"model",
".",
"Good",
"to",
"fail",
"fast",
"for",
"things",
"like",
"typos",
"instead",
"of",
"silently",
"not",
"applying",
"that",
... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-code-generator/src/main/java/com/amazonaws/codegen/customization/processors/EmitLegacyEnumSetterProcessor.java#L75-L90 |
Blazebit/blaze-utils | blaze-common-utils/src/main/java/com/blazebit/reflection/ReflectionUtils.java | ReflectionUtils.getMethod | public static Method getMethod(Class<?> clazz, final Class<? extends Annotation> annotation) {
"""
Returns the method object for a method which is annotated with the
given annotation of the given class. This method traverses through
the super classes of the given class and tries to find the method as
declared m... | java | public static Method getMethod(Class<?> clazz, final Class<? extends Annotation> annotation) {
return traverseHierarchy(clazz, new TraverseTask<Method>() {
@Override
public Method run(Class<?> clazz) {
Method[] methods = clazz.getDeclaredMethods();
for (... | [
"public",
"static",
"Method",
"getMethod",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"final",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"annotation",
")",
"{",
"return",
"traverseHierarchy",
"(",
"clazz",
",",
"new",
"TraverseTask",
"<",
"Method",
... | Returns the method object for a method which is annotated with the
given annotation of the given class. This method traverses through
the super classes of the given class and tries to find the method as
declared method within these classes that is annotated with an
annotation of the given annotation type.
When the obje... | [
"Returns",
"the",
"method",
"object",
"for",
"a",
"method",
"which",
"is",
"annotated",
"with",
"the",
"given",
"annotation",
"of",
"the",
"given",
"class",
".",
"This",
"method",
"traverses",
"through",
"the",
"super",
"classes",
"of",
"the",
"given",
"clas... | train | https://github.com/Blazebit/blaze-utils/blob/3e35a694a8f71d515aad066196acd523994d6aaa/blaze-common-utils/src/main/java/com/blazebit/reflection/ReflectionUtils.java#L940-L957 |
monitorjbl/excel-streaming-reader | src/main/java/com/monitorjbl/xlsx/impl/StreamingCell.java | StreamingCell.getBooleanCellValue | @Override
public boolean getBooleanCellValue() {
"""
Get the value of the cell as a boolean. For strings we throw an exception. For
blank cells we return a false.
@return the value of the cell as a date
"""
CellType cellType = getCellType();
switch(cellType) {
case BLANK:
return fal... | java | @Override
public boolean getBooleanCellValue() {
CellType cellType = getCellType();
switch(cellType) {
case BLANK:
return false;
case BOOLEAN:
return rawContents != null && TRUE_AS_STRING.equals(rawContents);
case FORMULA:
throw new NotSupportedException();
defa... | [
"@",
"Override",
"public",
"boolean",
"getBooleanCellValue",
"(",
")",
"{",
"CellType",
"cellType",
"=",
"getCellType",
"(",
")",
";",
"switch",
"(",
"cellType",
")",
"{",
"case",
"BLANK",
":",
"return",
"false",
";",
"case",
"BOOLEAN",
":",
"return",
"raw... | Get the value of the cell as a boolean. For strings we throw an exception. For
blank cells we return a false.
@return the value of the cell as a date | [
"Get",
"the",
"value",
"of",
"the",
"cell",
"as",
"a",
"boolean",
".",
"For",
"strings",
"we",
"throw",
"an",
"exception",
".",
"For",
"blank",
"cells",
"we",
"return",
"a",
"false",
"."
] | train | https://github.com/monitorjbl/excel-streaming-reader/blob/4e95c9aaaecf33685a09f8c267af3a578ba5e070/src/main/java/com/monitorjbl/xlsx/impl/StreamingCell.java#L224-L237 |
haraldk/TwelveMonkeys | sandbox/sandbox-common/src/main/java/com/twelvemonkeys/util/ResourceMonitor.java | ResourceMonitor.addResourceChangeListener | public void addResourceChangeListener(ResourceChangeListener pListener,
Object pResourceId, long pPeriod) throws IOException {
"""
Add a monitored {@code Resource} with a {@code ResourceChangeListener}.
The {@code reourceId} might be a {@code File} a {@code URL} or a
{... | java | public void addResourceChangeListener(ResourceChangeListener pListener,
Object pResourceId, long pPeriod) throws IOException {
// Create the task
ResourceMonitorTask task = new ResourceMonitorTask(pListener, pResourceId);
// Get unique Id
Object... | [
"public",
"void",
"addResourceChangeListener",
"(",
"ResourceChangeListener",
"pListener",
",",
"Object",
"pResourceId",
",",
"long",
"pPeriod",
")",
"throws",
"IOException",
"{",
"// Create the task",
"ResourceMonitorTask",
"task",
"=",
"new",
"ResourceMonitorTask",
"(",... | Add a monitored {@code Resource} with a {@code ResourceChangeListener}.
The {@code reourceId} might be a {@code File} a {@code URL} or a
{@code String} containing a file path, or a path to a resource in the
class path. Note that class path resources are resolved using the
given {@code ResourceChangeListener}'s {@code ... | [
"Add",
"a",
"monitored",
"{",
"@code",
"Resource",
"}",
"with",
"a",
"{",
"@code",
"ResourceChangeListener",
"}",
"."
] | train | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/sandbox/sandbox-common/src/main/java/com/twelvemonkeys/util/ResourceMonitor.java#L89-L104 |
heinrichreimer/material-drawer | library/src/main/java/com/heinrichreimersoftware/materialdrawer/structure/DrawerItem.java | DrawerItem.setTextMode | public DrawerItem setTextMode(int textMode) {
"""
Sets a text mode to the drawer item
@param textMode Text mode to set
"""
if (textMode != SINGLE_LINE && textMode != TWO_LINE && textMode != THREE_LINE) {
throw new IllegalArgumentException("Image mode must be either SINGLE_LINE, TWO_LINE ... | java | public DrawerItem setTextMode(int textMode) {
if (textMode != SINGLE_LINE && textMode != TWO_LINE && textMode != THREE_LINE) {
throw new IllegalArgumentException("Image mode must be either SINGLE_LINE, TWO_LINE or THREE_LINE.");
}
mTextMode = textMode;
notifyDataChanged();
... | [
"public",
"DrawerItem",
"setTextMode",
"(",
"int",
"textMode",
")",
"{",
"if",
"(",
"textMode",
"!=",
"SINGLE_LINE",
"&&",
"textMode",
"!=",
"TWO_LINE",
"&&",
"textMode",
"!=",
"THREE_LINE",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Image mod... | Sets a text mode to the drawer item
@param textMode Text mode to set | [
"Sets",
"a",
"text",
"mode",
"to",
"the",
"drawer",
"item"
] | train | https://github.com/heinrichreimer/material-drawer/blob/7c2406812d73f710ef8bb73d4a0f4bbef3b275ce/library/src/main/java/com/heinrichreimersoftware/materialdrawer/structure/DrawerItem.java#L414-L421 |
michael-rapp/AndroidMaterialValidation | library/src/main/java/de/mrapp/android/validation/Validators.java | Validators.phoneNumber | public static Validator<CharSequence> phoneNumber(@NonNull final Context context,
@StringRes final int resourceId) {
"""
Creates and returns a validator, which allows to validate texts to ensure, that they
represent valid phone numbers. Phone numbers, which ar... | java | public static Validator<CharSequence> phoneNumber(@NonNull final Context context,
@StringRes final int resourceId) {
return new PhoneNumberValidator(context, resourceId);
} | [
"public",
"static",
"Validator",
"<",
"CharSequence",
">",
"phoneNumber",
"(",
"@",
"NonNull",
"final",
"Context",
"context",
",",
"@",
"StringRes",
"final",
"int",
"resourceId",
")",
"{",
"return",
"new",
"PhoneNumberValidator",
"(",
"context",
",",
"resourceId... | Creates and returns a validator, which allows to validate texts to ensure, that they
represent valid phone numbers. Phone numbers, which are only consisting of numbers are
allowed as well as international phone numbers, e.g. +49 1624812382. Empty texts are also
accepted.
@param context
The context, which should be use... | [
"Creates",
"and",
"returns",
"a",
"validator",
"which",
"allows",
"to",
"validate",
"texts",
"to",
"ensure",
"that",
"they",
"represent",
"valid",
"phone",
"numbers",
".",
"Phone",
"numbers",
"which",
"are",
"only",
"consisting",
"of",
"numbers",
"are",
"allow... | train | https://github.com/michael-rapp/AndroidMaterialValidation/blob/ac8693baeac7abddf2e38a47da4c1849d4661a8b/library/src/main/java/de/mrapp/android/validation/Validators.java#L1137-L1140 |
QSFT/Doradus | doradus-server/src/main/java/com/dell/doradus/service/spider/ObjectUpdater.java | ObjectUpdater.buildErrorStatus | private void buildErrorStatus(ObjectResult result, String objID, Throwable ex) {
"""
Add error fields to the given ObjectResult due to the given exception.
"""
result.setStatus(ObjectResult.Status.ERROR);
result.setErrorMessage(ex.getLocalizedMessage());
if (!Utils.isEmpty(objID)) {
... | java | private void buildErrorStatus(ObjectResult result, String objID, Throwable ex) {
result.setStatus(ObjectResult.Status.ERROR);
result.setErrorMessage(ex.getLocalizedMessage());
if (!Utils.isEmpty(objID)) {
result.setObjectID(objID);
}
if (ex instanceof IllegalArg... | [
"private",
"void",
"buildErrorStatus",
"(",
"ObjectResult",
"result",
",",
"String",
"objID",
",",
"Throwable",
"ex",
")",
"{",
"result",
".",
"setStatus",
"(",
"ObjectResult",
".",
"Status",
".",
"ERROR",
")",
";",
"result",
".",
"setErrorMessage",
"(",
"ex... | Add error fields to the given ObjectResult due to the given exception. | [
"Add",
"error",
"fields",
"to",
"the",
"given",
"ObjectResult",
"due",
"to",
"the",
"given",
"exception",
"."
] | train | https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/service/spider/ObjectUpdater.java#L208-L221 |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/reflect/ReflectionUtils.java | ReflectionUtils.getValue | public static <T> T getValue(Object obj, String fieldName, Class<T> fieldType) {
"""
Gets the value of the field with the specified name on the given object cast to the desired field type.
This method assumes the field is a instance (object) member field.
@param <T> the desired return type in which the field's... | java | public static <T> T getValue(Object obj, String fieldName, Class<T> fieldType) {
try {
return getValue(obj, getField(obj.getClass(), fieldName), fieldType);
}
catch (FieldNotFoundException e) {
throw new IllegalArgumentException(String.format("Field with name (%1$s) does not exist on object of t... | [
"public",
"static",
"<",
"T",
">",
"T",
"getValue",
"(",
"Object",
"obj",
",",
"String",
"fieldName",
",",
"Class",
"<",
"T",
">",
"fieldType",
")",
"{",
"try",
"{",
"return",
"getValue",
"(",
"obj",
",",
"getField",
"(",
"obj",
".",
"getClass",
"(",... | Gets the value of the field with the specified name on the given object cast to the desired field type.
This method assumes the field is a instance (object) member field.
@param <T> the desired return type in which the field's value will be cast; should be compatible with
the field's declared type.
@param obj the Obje... | [
"Gets",
"the",
"value",
"of",
"the",
"field",
"with",
"the",
"specified",
"name",
"on",
"the",
"given",
"object",
"cast",
"to",
"the",
"desired",
"field",
"type",
".",
"This",
"method",
"assumes",
"the",
"field",
"is",
"a",
"instance",
"(",
"object",
")"... | train | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/reflect/ReflectionUtils.java#L127-L135 |
jcuda/jcuda | JCudaJava/src/main/java/jcuda/runtime/JCuda.java | JCuda.cudaGraphicsResourceGetMappedPointer | public static int cudaGraphicsResourceGetMappedPointer(Pointer devPtr, long size[], cudaGraphicsResource resource) {
"""
Get an device pointer through which to access a mapped graphics resource.
<pre>
cudaError_t cudaGraphicsResourceGetMappedPointer (
void** devPtr,
size_t* size,
cudaGraphicsResource_t reso... | java | public static int cudaGraphicsResourceGetMappedPointer(Pointer devPtr, long size[], cudaGraphicsResource resource)
{
return checkResult(cudaGraphicsResourceGetMappedPointerNative(devPtr, size, resource));
} | [
"public",
"static",
"int",
"cudaGraphicsResourceGetMappedPointer",
"(",
"Pointer",
"devPtr",
",",
"long",
"size",
"[",
"]",
",",
"cudaGraphicsResource",
"resource",
")",
"{",
"return",
"checkResult",
"(",
"cudaGraphicsResourceGetMappedPointerNative",
"(",
"devPtr",
",",... | Get an device pointer through which to access a mapped graphics resource.
<pre>
cudaError_t cudaGraphicsResourceGetMappedPointer (
void** devPtr,
size_t* size,
cudaGraphicsResource_t resource )
</pre>
<div>
<p>Get an device pointer through which to
access a mapped graphics resource. Returns in <tt>*devPtr</tt> a
poin... | [
"Get",
"an",
"device",
"pointer",
"through",
"which",
"to",
"access",
"a",
"mapped",
"graphics",
"resource",
"."
] | train | https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/runtime/JCuda.java#L11607-L11610 |
apereo/cas | support/cas-server-support-wsfederation/src/main/java/org/apereo/cas/support/wsfederation/authentication/principal/WsFederationCredential.java | WsFederationCredential.isValid | public boolean isValid(final String expectedAudience, final String expectedIssuer, final long timeDrift) {
"""
isValid validates the credential.
@param expectedAudience the audience that the token was issued to (CAS Server)
@param expectedIssuer the issuer of the token (the IdP)
@param timeDrift the ... | java | public boolean isValid(final String expectedAudience, final String expectedIssuer, final long timeDrift) {
if (!this.audience.equalsIgnoreCase(expectedAudience)) {
LOGGER.warn("Audience [{}] is invalid where the expected audience should be [{}]", this.audience, expectedAudience);
return ... | [
"public",
"boolean",
"isValid",
"(",
"final",
"String",
"expectedAudience",
",",
"final",
"String",
"expectedIssuer",
",",
"final",
"long",
"timeDrift",
")",
"{",
"if",
"(",
"!",
"this",
".",
"audience",
".",
"equalsIgnoreCase",
"(",
"expectedAudience",
")",
"... | isValid validates the credential.
@param expectedAudience the audience that the token was issued to (CAS Server)
@param expectedIssuer the issuer of the token (the IdP)
@param timeDrift the amount of acceptable time drift
@return true if the credentials are valid, otherwise false | [
"isValid",
"validates",
"the",
"credential",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-wsfederation/src/main/java/org/apereo/cas/support/wsfederation/authentication/principal/WsFederationCredential.java#L60-L85 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/transform/OpPredicate.java | OpPredicate.opNameEquals | public static OpPredicate opNameEquals(final String opName) {
"""
Return true if the operation name (i.e., "add", "mul", etc - not the user specified name) equals the specified name
"""
return new OpPredicate() {
@Override
public boolean matches(SameDiff sameDiff, DifferentialFu... | java | public static OpPredicate opNameEquals(final String opName){
return new OpPredicate() {
@Override
public boolean matches(SameDiff sameDiff, DifferentialFunction function) {
return function.opName().equals(opName);
}
};
} | [
"public",
"static",
"OpPredicate",
"opNameEquals",
"(",
"final",
"String",
"opName",
")",
"{",
"return",
"new",
"OpPredicate",
"(",
")",
"{",
"@",
"Override",
"public",
"boolean",
"matches",
"(",
"SameDiff",
"sameDiff",
",",
"DifferentialFunction",
"function",
"... | Return true if the operation name (i.e., "add", "mul", etc - not the user specified name) equals the specified name | [
"Return",
"true",
"if",
"the",
"operation",
"name",
"(",
"i",
".",
"e",
".",
"add",
"mul",
"etc",
"-",
"not",
"the",
"user",
"specified",
"name",
")",
"equals",
"the",
"specified",
"name"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/transform/OpPredicate.java#L54-L61 |
sniffy/sniffy | sniffy-core/src/main/java/io/sniffy/LegacySpy.java | LegacySpy.expectAtMost | @Deprecated
public C expectAtMost(int allowedStatements, Query query) {
"""
Alias for {@link #expectBetween(int, int, Threads, Query)} with arguments 0, {@code allowedStatements}, {@link Threads#CURRENT}, {@code queryType}
@since 2.2
"""
return expect(SqlQueries.maxQueries(allowedStatements).type(... | java | @Deprecated
public C expectAtMost(int allowedStatements, Query query) {
return expect(SqlQueries.maxQueries(allowedStatements).type(adapter(query)));
} | [
"@",
"Deprecated",
"public",
"C",
"expectAtMost",
"(",
"int",
"allowedStatements",
",",
"Query",
"query",
")",
"{",
"return",
"expect",
"(",
"SqlQueries",
".",
"maxQueries",
"(",
"allowedStatements",
")",
".",
"type",
"(",
"adapter",
"(",
"query",
")",
")",
... | Alias for {@link #expectBetween(int, int, Threads, Query)} with arguments 0, {@code allowedStatements}, {@link Threads#CURRENT}, {@code queryType}
@since 2.2 | [
"Alias",
"for",
"{"
] | train | https://github.com/sniffy/sniffy/blob/7bdddb9593e6b6e9fe5c7c87519f864acbc3a5c0/sniffy-core/src/main/java/io/sniffy/LegacySpy.java#L328-L331 |
cloudant/sync-android | cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/documentstore/AttachmentStreamFactory.java | AttachmentStreamFactory.getInputStream | public InputStream getInputStream(File file, Attachment.Encoding encoding) throws IOException {
"""
Return a stream to be used to read from the file on disk.
Stream's bytes will be unzipped, unencrypted attachment content.
@param file File object to read from.
@param encoding Encoding of attachment.
@retur... | java | public InputStream getInputStream(File file, Attachment.Encoding encoding) throws IOException {
// First, open a stream to the raw bytes on disk.
// Then, if we have a key assume the file is encrypted, so add a stream
// to the chain which decrypts the data as we read from disk.
// Fina... | [
"public",
"InputStream",
"getInputStream",
"(",
"File",
"file",
",",
"Attachment",
".",
"Encoding",
"encoding",
")",
"throws",
"IOException",
"{",
"// First, open a stream to the raw bytes on disk.",
"// Then, if we have a key assume the file is encrypted, so add a stream",
"// to ... | Return a stream to be used to read from the file on disk.
Stream's bytes will be unzipped, unencrypted attachment content.
@param file File object to read from.
@param encoding Encoding of attachment.
@return Stream for reading attachment data.
@throws IOException if there's a problem reading from disk, including iss... | [
"Return",
"a",
"stream",
"to",
"be",
"used",
"to",
"read",
"from",
"the",
"file",
"on",
"disk",
"."
] | train | https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/documentstore/AttachmentStreamFactory.java#L81-L113 |
xhsun/gw2wrapper | src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java | AsynchronousRequest.getAllContinentMapID | public void getAllContinentMapID(int continentID, int floorID, int regionID, Callback<List<Integer>> callback) throws NullPointerException {
"""
For more info on continents API go <a href="https://wiki.guildwars2.com/wiki/API:2/continents">here</a><br/>
Give user the access to {@link Callback#onResponse(Call, Res... | java | public void getAllContinentMapID(int continentID, int floorID, int regionID, Callback<List<Integer>> callback) throws NullPointerException {
gw2API.getAllContinentMapIDs(Integer.toString(continentID), Integer.toString(floorID), Integer.toString(regionID)).enqueue(callback);
} | [
"public",
"void",
"getAllContinentMapID",
"(",
"int",
"continentID",
",",
"int",
"floorID",
",",
"int",
"regionID",
",",
"Callback",
"<",
"List",
"<",
"Integer",
">",
">",
"callback",
")",
"throws",
"NullPointerException",
"{",
"gw2API",
".",
"getAllContinentMap... | For more info on continents API go <a href="https://wiki.guildwars2.com/wiki/API:2/continents">here</a><br/>
Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions
@param continentID {@link Continent#id}
@param floorID {@l... | [
"For",
"more",
"info",
"on",
"continents",
"API",
"go",
"<a",
"href",
"=",
"https",
":",
"//",
"wiki",
".",
"guildwars2",
".",
"com",
"/",
"wiki",
"/",
"API",
":",
"2",
"/",
"continents",
">",
"here<",
"/",
"a",
">",
"<br",
"/",
">",
"Give",
"use... | train | https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java#L1108-L1110 |
haifengl/smile | math/src/main/java/smile/math/Math.java | Math.pdist | public static void pdist(double[][] x, double[][] dist, boolean squared, boolean half) {
"""
Pairwise distance between pairs of objects.
@param x Rows of x correspond to observations, and columns correspond to variables.
@param squared If true, compute the squared Euclidean distance.
@param half If true, only t... | java | public static void pdist(double[][] x, double[][] dist, boolean squared, boolean half) {
int n = x.length;
if (n < 100) {
for (int i = 0; i < n; i++) {
for (int j = 0; j < i; j++) {
double d = distance(x[i], x[j]);
dist[i][j] = d;
... | [
"public",
"static",
"void",
"pdist",
"(",
"double",
"[",
"]",
"[",
"]",
"x",
",",
"double",
"[",
"]",
"[",
"]",
"dist",
",",
"boolean",
"squared",
",",
"boolean",
"half",
")",
"{",
"int",
"n",
"=",
"x",
".",
"length",
";",
"if",
"(",
"n",
"<",
... | Pairwise distance between pairs of objects.
@param x Rows of x correspond to observations, and columns correspond to variables.
@param squared If true, compute the squared Euclidean distance.
@param half If true, only the lower half of dist will be referenced.
@param dist The distance matrix. | [
"Pairwise",
"distance",
"between",
"pairs",
"of",
"objects",
"."
] | train | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/math/src/main/java/smile/math/Math.java#L2135-L2155 |
javamelody/javamelody | javamelody-core/src/main/java/net/bull/javamelody/internal/model/CounterStorage.java | CounterStorage.writeToFile | int writeToFile() throws IOException {
"""
Enregistre le counter.
@return Taille sérialisée non compressée du counter (estimation pessimiste de l'occupation mémoire)
@throws IOException Exception d'entrée/sortie
"""
if (storageDisabled) {
return -1;
}
final File file = getFile();
if (counter.... | java | int writeToFile() throws IOException {
if (storageDisabled) {
return -1;
}
final File file = getFile();
if (counter.getRequestsCount() == 0 && counter.getErrorsCount() == 0 && !file.exists()) {
// s'il n'y a pas de requête, inutile d'écrire des fichiers de compteurs vides
// (par exemple pour le... | [
"int",
"writeToFile",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"storageDisabled",
")",
"{",
"return",
"-",
"1",
";",
"}",
"final",
"File",
"file",
"=",
"getFile",
"(",
")",
";",
"if",
"(",
"counter",
".",
"getRequestsCount",
"(",
")",
"==",
... | Enregistre le counter.
@return Taille sérialisée non compressée du counter (estimation pessimiste de l'occupation mémoire)
@throws IOException Exception d'entrée/sortie | [
"Enregistre",
"le",
"counter",
"."
] | train | https://github.com/javamelody/javamelody/blob/18ad583ddeb5dcadd797dfda295409c6983ffd71/javamelody-core/src/main/java/net/bull/javamelody/internal/model/CounterStorage.java#L103-L118 |
playn/playn | java-base/src/playn/java/JavaAssets.java | JavaAssets.requireResource | protected Resource requireResource(String path) throws IOException {
"""
Attempts to locate the resource at the given path, and returns a wrapper which allows its data
to be efficiently read.
<p>First, the path prefix is prepended (see {@link #setPathPrefix(String)}) and the the class
loader checked. If not f... | java | protected Resource requireResource(String path) throws IOException {
URL url = getClass().getClassLoader().getResource(pathPrefix + path);
if (url != null) {
return url.getProtocol().equals("file") ?
new FileResource(new File(URLDecoder.decode(url.getPath(), "UTF-8"))) :
new URLResource(ur... | [
"protected",
"Resource",
"requireResource",
"(",
"String",
"path",
")",
"throws",
"IOException",
"{",
"URL",
"url",
"=",
"getClass",
"(",
")",
".",
"getClassLoader",
"(",
")",
".",
"getResource",
"(",
"pathPrefix",
"+",
"path",
")",
";",
"if",
"(",
"url",
... | Attempts to locate the resource at the given path, and returns a wrapper which allows its data
to be efficiently read.
<p>First, the path prefix is prepended (see {@link #setPathPrefix(String)}) and the the class
loader checked. If not found, then the extra directories, if any, are checked, in order. If
the file is no... | [
"Attempts",
"to",
"locate",
"the",
"resource",
"at",
"the",
"given",
"path",
"and",
"returns",
"a",
"wrapper",
"which",
"allows",
"its",
"data",
"to",
"be",
"efficiently",
"read",
"."
] | train | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/java-base/src/playn/java/JavaAssets.java#L174-L188 |
OpenLiberty/open-liberty | dev/com.ibm.ws.ssl/src/com/ibm/websphere/ssl/JSSEHelper.java | JSSEHelper.getProperties | public Properties getProperties(String sslAliasName, Map<String, Object> connectionInfo, SSLConfigChangeListener listener) throws SSLException {
"""
<p>
This method returns the effective SSL properties object for use by an SSL
application or component.
</p>
<p>
When Java 2 Security is enabled, access to call ... | java | public Properties getProperties(String sslAliasName, Map<String, Object> connectionInfo, SSLConfigChangeListener listener) throws SSLException {
return getProperties(sslAliasName, connectionInfo, listener, true);
} | [
"public",
"Properties",
"getProperties",
"(",
"String",
"sslAliasName",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"connectionInfo",
",",
"SSLConfigChangeListener",
"listener",
")",
"throws",
"SSLException",
"{",
"return",
"getProperties",
"(",
"sslAliasName",
"... | <p>
This method returns the effective SSL properties object for use by an SSL
application or component.
</p>
<p>
When Java 2 Security is enabled, access to call this method requires
WebSphereRuntimePermission "getSSLConfig" to be granted.
</p>
@param sslAliasName - Used in direct selection. The alias name of a
specifi... | [
"<p",
">",
"This",
"method",
"returns",
"the",
"effective",
"SSL",
"properties",
"object",
"for",
"use",
"by",
"an",
"SSL",
"application",
"or",
"component",
".",
"<",
"/",
"p",
">",
"<p",
">",
"When",
"Java",
"2",
"Security",
"is",
"enabled",
"access",
... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ssl/src/com/ibm/websphere/ssl/JSSEHelper.java#L987-L989 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/string/StringHelper.java | StringHelper.trimEnd | @Nullable
@CheckReturnValue
public static String trimEnd (@Nullable final String sSrc, @Nonnegative final int nCount) {
"""
Trim the passed tail from the source value. If the source value does not end
with the passed tail, nothing happens.
@param sSrc
The input source string
@param nCount
The number of ... | java | @Nullable
@CheckReturnValue
public static String trimEnd (@Nullable final String sSrc, @Nonnegative final int nCount)
{
if (nCount <= 0)
return sSrc;
return getLength (sSrc) <= nCount ? "" : sSrc.substring (0, sSrc.length () - nCount);
} | [
"@",
"Nullable",
"@",
"CheckReturnValue",
"public",
"static",
"String",
"trimEnd",
"(",
"@",
"Nullable",
"final",
"String",
"sSrc",
",",
"@",
"Nonnegative",
"final",
"int",
"nCount",
")",
"{",
"if",
"(",
"nCount",
"<=",
"0",
")",
"return",
"sSrc",
";",
"... | Trim the passed tail from the source value. If the source value does not end
with the passed tail, nothing happens.
@param sSrc
The input source string
@param nCount
The number of characters to trim at the end.
@return The trimmed string, or an empty string if nCount is ≥ the length
of the source string | [
"Trim",
"the",
"passed",
"tail",
"from",
"the",
"source",
"value",
".",
"If",
"the",
"source",
"value",
"does",
"not",
"end",
"with",
"the",
"passed",
"tail",
"nothing",
"happens",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L3445-L3452 |
apache/incubator-gobblin | gobblin-core/src/main/java/org/apache/gobblin/source/extractor/extract/sftp/SftpFsHelper.java | SftpFsHelper.getExecChannel | public ChannelExec getExecChannel(String command) throws SftpException {
"""
Create a new sftp channel to execute commands.
@param command to execute on the remote machine
@return a new execution channel
@throws SftpException if a channel could not be opened
"""
ChannelExec channelExec;
try {
... | java | public ChannelExec getExecChannel(String command) throws SftpException {
ChannelExec channelExec;
try {
channelExec = (ChannelExec) this.session.openChannel("exec");
channelExec.setCommand(command);
channelExec.connect();
return channelExec;
} catch (JSchException e) {
throw ne... | [
"public",
"ChannelExec",
"getExecChannel",
"(",
"String",
"command",
")",
"throws",
"SftpException",
"{",
"ChannelExec",
"channelExec",
";",
"try",
"{",
"channelExec",
"=",
"(",
"ChannelExec",
")",
"this",
".",
"session",
".",
"openChannel",
"(",
"\"exec\"",
")"... | Create a new sftp channel to execute commands.
@param command to execute on the remote machine
@return a new execution channel
@throws SftpException if a channel could not be opened | [
"Create",
"a",
"new",
"sftp",
"channel",
"to",
"execute",
"commands",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-core/src/main/java/org/apache/gobblin/source/extractor/extract/sftp/SftpFsHelper.java#L116-L126 |
SonarSource/sonarqube | sonar-scanner-protocol/src/main/java/org/sonar/scanner/protocol/viewer/TextLineNumber.java | TextLineNumber.setBorderGap | public void setBorderGap(int borderGap) {
"""
The border gap is used in calculating the left and right insets of the
border. Default value is 5.
@param borderGap the gap in pixels
"""
this.borderGap = borderGap;
Border inner = new EmptyBorder(0, borderGap, 0, borderGap);
setBorder(new Compound... | java | public void setBorderGap(int borderGap) {
this.borderGap = borderGap;
Border inner = new EmptyBorder(0, borderGap, 0, borderGap);
setBorder(new CompoundBorder(OUTER, inner));
lastDigits = 0;
setPreferredWidth();
} | [
"public",
"void",
"setBorderGap",
"(",
"int",
"borderGap",
")",
"{",
"this",
".",
"borderGap",
"=",
"borderGap",
";",
"Border",
"inner",
"=",
"new",
"EmptyBorder",
"(",
"0",
",",
"borderGap",
",",
"0",
",",
"borderGap",
")",
";",
"setBorder",
"(",
"new",... | The border gap is used in calculating the left and right insets of the
border. Default value is 5.
@param borderGap the gap in pixels | [
"The",
"border",
"gap",
"is",
"used",
"in",
"calculating",
"the",
"left",
"and",
"right",
"insets",
"of",
"the",
"border",
".",
"Default",
"value",
"is",
"5",
"."
] | train | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-scanner-protocol/src/main/java/org/sonar/scanner/protocol/viewer/TextLineNumber.java#L157-L163 |
zalando/logbook | logbook-json/src/main/java/org/zalando/logbook/json/JsonBodyFilters.java | JsonBodyFilters.replaceJsonStringProperty | @API(status = MAINTAINED)
public static BodyFilter replaceJsonStringProperty(final Set<String> properties, final String replacement) {
"""
Creates a {@link BodyFilter} that replaces the properties in the json response with the replacement passed as argument.
This {@link BodyFilter} works on all levels inside ... | java | @API(status = MAINTAINED)
public static BodyFilter replaceJsonStringProperty(final Set<String> properties, final String replacement) {
final String regex = properties.stream().map(Pattern::quote).collect(joining("|"));
final Pattern pattern = Pattern.compile("(\"(?:" + regex + ")\"\\s*:\\s*)\"(?:[^\... | [
"@",
"API",
"(",
"status",
"=",
"MAINTAINED",
")",
"public",
"static",
"BodyFilter",
"replaceJsonStringProperty",
"(",
"final",
"Set",
"<",
"String",
">",
"properties",
",",
"final",
"String",
"replacement",
")",
"{",
"final",
"String",
"regex",
"=",
"properti... | Creates a {@link BodyFilter} that replaces the properties in the json response with the replacement passed as argument.
This {@link BodyFilter} works on all levels inside the json tree and it only works with string values<br><br>
Example from {@link AccessTokenBodyFilter} method:<br>
<pre>{@code
Set<String> properties ... | [
"Creates",
"a",
"{",
"@link",
"BodyFilter",
"}",
"that",
"replaces",
"the",
"properties",
"in",
"the",
"json",
"response",
"with",
"the",
"replacement",
"passed",
"as",
"argument",
".",
"This",
"{",
"@link",
"BodyFilter",
"}",
"works",
"on",
"all",
"levels",... | train | https://github.com/zalando/logbook/blob/1c2fe40a2f6a3d2f60e746ab1da173a3907a21c4/logbook-json/src/main/java/org/zalando/logbook/json/JsonBodyFilters.java#L45-L53 |
druid-io/druid-api | src/main/java/io/druid/guice/PolyBind.java | PolyBind.createChoice | public static <T> ScopedBindingBuilder createChoice(
Binder binder,
String property,
Key<T> interfaceKey,
Key<? extends T> defaultKey
) {
"""
Sets up a "choice" for the injector to resolve at injection time.
@param binder the binder for the injector that is being configured
@param pro... | java | public static <T> ScopedBindingBuilder createChoice(
Binder binder,
String property,
Key<T> interfaceKey,
Key<? extends T> defaultKey
)
{
return createChoiceWithDefault(binder, property, interfaceKey, defaultKey, null);
} | [
"public",
"static",
"<",
"T",
">",
"ScopedBindingBuilder",
"createChoice",
"(",
"Binder",
"binder",
",",
"String",
"property",
",",
"Key",
"<",
"T",
">",
"interfaceKey",
",",
"Key",
"<",
"?",
"extends",
"T",
">",
"defaultKey",
")",
"{",
"return",
"createCh... | Sets up a "choice" for the injector to resolve at injection time.
@param binder the binder for the injector that is being configured
@param property the property that will be checked to determine the implementation choice
@param interfaceKey the interface that will be injected using this choice
@param defaultKey the d... | [
"Sets",
"up",
"a",
"choice",
"for",
"the",
"injector",
"to",
"resolve",
"at",
"injection",
"time",
"."
] | train | https://github.com/druid-io/druid-api/blob/d822339d30bcac5c59eeffd6e255f69671d5e57c/src/main/java/io/druid/guice/PolyBind.java#L57-L65 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDMath.java | SDMath.confusionMatrix | public SDVariable confusionMatrix(String name, SDVariable labels, SDVariable pred, DataType dataType) {
"""
Compute the 2d confusion matrix of size [numClasses, numClasses] from a pair of labels and predictions, both of
which are represented as integer values. This version assumes the number of classes is 1 + max... | java | public SDVariable confusionMatrix(String name, SDVariable labels, SDVariable pred, DataType dataType) {
validateInteger("confusionMatrix", "labels", labels);
validateInteger("confusionMatrix", "prediction", pred);
SDVariable result = f().confusionMatrix(labels, pred, dataType);
return up... | [
"public",
"SDVariable",
"confusionMatrix",
"(",
"String",
"name",
",",
"SDVariable",
"labels",
",",
"SDVariable",
"pred",
",",
"DataType",
"dataType",
")",
"{",
"validateInteger",
"(",
"\"confusionMatrix\"",
",",
"\"labels\"",
",",
"labels",
")",
";",
"validateInt... | Compute the 2d confusion matrix of size [numClasses, numClasses] from a pair of labels and predictions, both of
which are represented as integer values. This version assumes the number of classes is 1 + max(max(labels), max(pred))<br>
For example, if labels = [0, 1, 1] and predicted = [0, 2, 1] then output is:<br>
[1, ... | [
"Compute",
"the",
"2d",
"confusion",
"matrix",
"of",
"size",
"[",
"numClasses",
"numClasses",
"]",
"from",
"a",
"pair",
"of",
"labels",
"and",
"predictions",
"both",
"of",
"which",
"are",
"represented",
"as",
"integer",
"values",
".",
"This",
"version",
"ass... | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDMath.java#L493-L498 |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/MoreLikeThis.java | MoreLikeThis.createQueue | private PriorityQueue<Object[]> createQueue(Map<String, Int> words) throws IOException {
"""
Create a PriorityQueue<Object[]> from a word->tf map.
@param words a map of words keyed on the word(String) with Int objects as the values.
"""
// have collected all words in doc and their freqs
int numD... | java | private PriorityQueue<Object[]> createQueue(Map<String, Int> words) throws IOException
{
// have collected all words in doc and their freqs
int numDocs = ir.numDocs();
FreqQ res = new FreqQ(words.size()); // will order words by score
Iterator<String> it = words.keySet().iterator();
whi... | [
"private",
"PriorityQueue",
"<",
"Object",
"[",
"]",
">",
"createQueue",
"(",
"Map",
"<",
"String",
",",
"Int",
">",
"words",
")",
"throws",
"IOException",
"{",
"// have collected all words in doc and their freqs",
"int",
"numDocs",
"=",
"ir",
".",
"numDocs",
"(... | Create a PriorityQueue<Object[]> from a word->tf map.
@param words a map of words keyed on the word(String) with Int objects as the values. | [
"Create",
"a",
"PriorityQueue<Object",
"[]",
">",
"from",
"a",
"word",
"-",
">",
"tf",
"map",
"."
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/MoreLikeThis.java#L643-L692 |
MindscapeHQ/raygun4java | core/src/main/java/com/mindscapehq/raygun4java/core/RaygunSettings.java | RaygunSettings.setHttpProxy | public void setHttpProxy(String host, int port) {
"""
Set your proxy information, if your proxy server requires authentication set a
default Authenticator in your code:
<p>
Authenticator authenticator = new Authenticator() {
<p>
public PasswordAuthentication getPasswordAuthentication() {
return (new Password... | java | public void setHttpProxy(String host, int port) {
if (host == null) {
this.proxy = null;
} else {
this.proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(host, port));
}
} | [
"public",
"void",
"setHttpProxy",
"(",
"String",
"host",
",",
"int",
"port",
")",
"{",
"if",
"(",
"host",
"==",
"null",
")",
"{",
"this",
".",
"proxy",
"=",
"null",
";",
"}",
"else",
"{",
"this",
".",
"proxy",
"=",
"new",
"Proxy",
"(",
"Proxy",
"... | Set your proxy information, if your proxy server requires authentication set a
default Authenticator in your code:
<p>
Authenticator authenticator = new Authenticator() {
<p>
public PasswordAuthentication getPasswordAuthentication() {
return (new PasswordAuthentication("user",
"password".toCharArray()));
}
};
Authentic... | [
"Set",
"your",
"proxy",
"information",
"if",
"your",
"proxy",
"server",
"requires",
"authentication",
"set",
"a",
"default",
"Authenticator",
"in",
"your",
"code",
":",
"<p",
">",
"Authenticator",
"authenticator",
"=",
"new",
"Authenticator",
"()",
"{",
"<p",
... | train | https://github.com/MindscapeHQ/raygun4java/blob/284a818446cfc6f0c2f83b5365514bc1bfc129b0/core/src/main/java/com/mindscapehq/raygun4java/core/RaygunSettings.java#L55-L61 |
goldmansachs/gs-collections | collections/src/main/java/com/gs/collections/impl/list/Interval.java | Interval.forEach | public void forEach(Procedure<? super Integer> procedure, Executor executor) {
"""
This method executes a void procedure against an executor, passing the current index of the
interval.
"""
CountDownLatch latch = new CountDownLatch(this.size());
if (this.goForward())
{
// It... | java | public void forEach(Procedure<? super Integer> procedure, Executor executor)
{
CountDownLatch latch = new CountDownLatch(this.size());
if (this.goForward())
{
// Iterates in forward direction because step value is negative
for (int i = this.from; i <= this.to; i += th... | [
"public",
"void",
"forEach",
"(",
"Procedure",
"<",
"?",
"super",
"Integer",
">",
"procedure",
",",
"Executor",
"executor",
")",
"{",
"CountDownLatch",
"latch",
"=",
"new",
"CountDownLatch",
"(",
"this",
".",
"size",
"(",
")",
")",
";",
"if",
"(",
"this"... | This method executes a void procedure against an executor, passing the current index of the
interval. | [
"This",
"method",
"executes",
"a",
"void",
"procedure",
"against",
"an",
"executor",
"passing",
"the",
"current",
"index",
"of",
"the",
"interval",
"."
] | train | https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/list/Interval.java#L481-L508 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/math/SloppyMath.java | SloppyMath.logAdd | public static float logAdd(float lx, float ly) {
"""
Returns the log of the sum of two numbers, which are
themselves input in log form. This uses natural logarithms.
Reasonable care is taken to do this as efficiently as possible
(under the assumption that the numbers might differ greatly in
magnitude), with h... | java | public static float logAdd(float lx, float ly) {
float max, negDiff;
if (lx > ly) {
max = lx;
negDiff = ly - lx;
} else {
max = ly;
negDiff = lx - ly;
}
if (max == Double.NEGATIVE_INFINITY) {
return max;
} else if (negDiff < -LOGTOLERANCE_F) {
retu... | [
"public",
"static",
"float",
"logAdd",
"(",
"float",
"lx",
",",
"float",
"ly",
")",
"{",
"float",
"max",
",",
"negDiff",
";",
"if",
"(",
"lx",
">",
"ly",
")",
"{",
"max",
"=",
"lx",
";",
"negDiff",
"=",
"ly",
"-",
"lx",
";",
"}",
"else",
"{",
... | Returns the log of the sum of two numbers, which are
themselves input in log form. This uses natural logarithms.
Reasonable care is taken to do this as efficiently as possible
(under the assumption that the numbers might differ greatly in
magnitude), with high accuracy, and without numerical overflow.
Also, handle cor... | [
"Returns",
"the",
"log",
"of",
"the",
"sum",
"of",
"two",
"numbers",
"which",
"are",
"themselves",
"input",
"in",
"log",
"form",
".",
"This",
"uses",
"natural",
"logarithms",
".",
"Reasonable",
"care",
"is",
"taken",
"to",
"do",
"this",
"as",
"efficiently"... | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/math/SloppyMath.java#L240-L256 |
Wadpam/guja | guja-core/src/main/java/com/wadpam/guja/oauth2/provider/TemporaryTokenCache.java | TemporaryTokenCache.generateTemporaryToken | public String generateTemporaryToken(String key, int secondsToLive, Object context) {
"""
Same as above but will also store a context that can be retried later.
"""
checkNotNull(key);
String token = tokenGenerator.generate();
tokenCache.put(key, Triplet.of(token, DateTime.now().plusSeconds(secondsT... | java | public String generateTemporaryToken(String key, int secondsToLive, Object context) {
checkNotNull(key);
String token = tokenGenerator.generate();
tokenCache.put(key, Triplet.of(token, DateTime.now().plusSeconds(secondsToLive).getMillis(), context));
return token;
} | [
"public",
"String",
"generateTemporaryToken",
"(",
"String",
"key",
",",
"int",
"secondsToLive",
",",
"Object",
"context",
")",
"{",
"checkNotNull",
"(",
"key",
")",
";",
"String",
"token",
"=",
"tokenGenerator",
".",
"generate",
"(",
")",
";",
"tokenCache",
... | Same as above but will also store a context that can be retried later. | [
"Same",
"as",
"above",
"but",
"will",
"also",
"store",
"a",
"context",
"that",
"can",
"be",
"retried",
"later",
"."
] | train | https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/oauth2/provider/TemporaryTokenCache.java#L54-L59 |
craterdog/java-security-framework | java-secure-messaging-api/src/main/java/craterdog/security/MessageCryptex.java | MessageCryptex.encryptString | public final byte[] encryptString(SecretKey sharedKey, String string) {
"""
This method encrypts a string using a shared key.
@param sharedKey The shared key used for the encryption.
@param string The string to be encrypted.
@return The encrypted string.
"""
logger.entry();
try (ByteArra... | java | public final byte[] encryptString(SecretKey sharedKey, String string) {
logger.entry();
try (ByteArrayInputStream input = new ByteArrayInputStream(string.getBytes("UTF-8"));
ByteArrayOutputStream output = new ByteArrayOutputStream()) {
encryptStream(sharedKey, input, outp... | [
"public",
"final",
"byte",
"[",
"]",
"encryptString",
"(",
"SecretKey",
"sharedKey",
",",
"String",
"string",
")",
"{",
"logger",
".",
"entry",
"(",
")",
";",
"try",
"(",
"ByteArrayInputStream",
"input",
"=",
"new",
"ByteArrayInputStream",
"(",
"string",
"."... | This method encrypts a string using a shared key.
@param sharedKey The shared key used for the encryption.
@param string The string to be encrypted.
@return The encrypted string. | [
"This",
"method",
"encrypts",
"a",
"string",
"using",
"a",
"shared",
"key",
"."
] | train | https://github.com/craterdog/java-security-framework/blob/a5634c19812d473b608bc11060f5cbb4b4b0b5da/java-secure-messaging-api/src/main/java/craterdog/security/MessageCryptex.java#L145-L160 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/stats/Distribution.java | Distribution.laplaceSmoothedDistribution | public static <E> Distribution<E> laplaceSmoothedDistribution(Counter<E> counter, int numberOfKeys) {
"""
Creates an Laplace smoothed Distribution from the given counter, ie adds one count
to every item, including unseen ones, and divides by the total count.
@return a new add-1 smoothed Distribution
"""
... | java | public static <E> Distribution<E> laplaceSmoothedDistribution(Counter<E> counter, int numberOfKeys) {
return laplaceSmoothedDistribution(counter, numberOfKeys, 1.0);
} | [
"public",
"static",
"<",
"E",
">",
"Distribution",
"<",
"E",
">",
"laplaceSmoothedDistribution",
"(",
"Counter",
"<",
"E",
">",
"counter",
",",
"int",
"numberOfKeys",
")",
"{",
"return",
"laplaceSmoothedDistribution",
"(",
"counter",
",",
"numberOfKeys",
",",
... | Creates an Laplace smoothed Distribution from the given counter, ie adds one count
to every item, including unseen ones, and divides by the total count.
@return a new add-1 smoothed Distribution | [
"Creates",
"an",
"Laplace",
"smoothed",
"Distribution",
"from",
"the",
"given",
"counter",
"ie",
"adds",
"one",
"count",
"to",
"every",
"item",
"including",
"unseen",
"ones",
"and",
"divides",
"by",
"the",
"total",
"count",
"."
] | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/stats/Distribution.java#L264-L266 |
google/error-prone-javac | src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/ParamTaglet.java | ParamTaglet.getTagletOutput | public Content getTagletOutput(Element holder, TagletWriter writer) {
"""
Given an array of <code>ParamTag</code>s,return its string representation.
@param holder the member that holds the param tags.
@param writer the TagletWriter that will write this tag.
@return the TagletOutput representation of these <code... | java | public Content getTagletOutput(Element holder, TagletWriter writer) {
Utils utils = writer.configuration().utils;
if (utils.isExecutableElement(holder)) {
ExecutableElement member = (ExecutableElement) holder;
Content output = getTagletOutput(false, member, writer,
... | [
"public",
"Content",
"getTagletOutput",
"(",
"Element",
"holder",
",",
"TagletWriter",
"writer",
")",
"{",
"Utils",
"utils",
"=",
"writer",
".",
"configuration",
"(",
")",
".",
"utils",
";",
"if",
"(",
"utils",
".",
"isExecutableElement",
"(",
"holder",
")",... | Given an array of <code>ParamTag</code>s,return its string representation.
@param holder the member that holds the param tags.
@param writer the TagletWriter that will write this tag.
@return the TagletOutput representation of these <code>ParamTag</code>s. | [
"Given",
"an",
"array",
"of",
"<code",
">",
"ParamTag<",
"/",
"code",
">",
"s",
"return",
"its",
"string",
"representation",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/ParamTaglet.java#L187-L201 |
elki-project/elki | elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/subspace/PROCLUS.java | PROCLUS.evaluateClusters | private double evaluateClusters(ArrayList<PROCLUSCluster> clusters, long[][] dimensions, Relation<V> database) {
"""
Evaluates the quality of the clusters.
@param clusters the clusters to be evaluated
@param dimensions the dimensions associated with each cluster
@param database the database holding the object... | java | private double evaluateClusters(ArrayList<PROCLUSCluster> clusters, long[][] dimensions, Relation<V> database) {
double result = 0;
for(int i = 0; i < dimensions.length; i++) {
PROCLUSCluster c_i = clusters.get(i);
double[] centroid_i = c_i.centroid;
long[] dims_i = dimensions[i];
doubl... | [
"private",
"double",
"evaluateClusters",
"(",
"ArrayList",
"<",
"PROCLUSCluster",
">",
"clusters",
",",
"long",
"[",
"]",
"[",
"]",
"dimensions",
",",
"Relation",
"<",
"V",
">",
"database",
")",
"{",
"double",
"result",
"=",
"0",
";",
"for",
"(",
"int",
... | Evaluates the quality of the clusters.
@param clusters the clusters to be evaluated
@param dimensions the dimensions associated with each cluster
@param database the database holding the objects
@return a measure for the cluster quality | [
"Evaluates",
"the",
"quality",
"of",
"the",
"clusters",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/subspace/PROCLUS.java#L659-L676 |
app55/app55-java | src/support/java/org/apache/harmony/beans/Command.java | Command.doBeforeRun | private int doBeforeRun(Map<String, Command> references) throws Exception {
"""
put command in one of two collections - arguments or operations
"""
if (status == Command.INITIALIZED)
{
for (int i = 0; i < commands.size(); ++i)
{
Command cmd = commands.elementAt(i);
// XXX is this correct?
... | java | private int doBeforeRun(Map<String, Command> references) throws Exception
{
if (status == Command.INITIALIZED)
{
for (int i = 0; i < commands.size(); ++i)
{
Command cmd = commands.elementAt(i);
// XXX is this correct?
if (cmd.isExecutable())
{
arguments.add(cmd);
}
else
{
... | [
"private",
"int",
"doBeforeRun",
"(",
"Map",
"<",
"String",
",",
"Command",
">",
"references",
")",
"throws",
"Exception",
"{",
"if",
"(",
"status",
"==",
"Command",
".",
"INITIALIZED",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"comm... | put command in one of two collections - arguments or operations | [
"put",
"command",
"in",
"one",
"of",
"two",
"collections",
"-",
"arguments",
"or",
"operations"
] | train | https://github.com/app55/app55-java/blob/73e51d0f3141a859dfbd37ca9becef98477e553e/src/support/java/org/apache/harmony/beans/Command.java#L227-L248 |
petrbouda/joyrest | joyrest-core/src/main/java/org/joyrest/routing/matcher/RequestMatcher.java | RequestMatcher.matchConsumes | public static boolean matchConsumes(InternalRoute route, InternalRequest<?> request) {
"""
Matches route consumes configurer and Content-Type header in an incoming provider
@param route route configurer
@param request incoming provider object
@return returns {@code true} if the given route has consumes Medi... | java | public static boolean matchConsumes(InternalRoute route, InternalRequest<?> request) {
if (route.getConsumes().contains(WILDCARD)) {
return true;
}
return route.getConsumes().contains(request.getContentType());
} | [
"public",
"static",
"boolean",
"matchConsumes",
"(",
"InternalRoute",
"route",
",",
"InternalRequest",
"<",
"?",
">",
"request",
")",
"{",
"if",
"(",
"route",
".",
"getConsumes",
"(",
")",
".",
"contains",
"(",
"WILDCARD",
")",
")",
"{",
"return",
"true",
... | Matches route consumes configurer and Content-Type header in an incoming provider
@param route route configurer
@param request incoming provider object
@return returns {@code true} if the given route has consumes Media-Type one of a Content-Type from an incoming provider | [
"Matches",
"route",
"consumes",
"configurer",
"and",
"Content",
"-",
"Type",
"header",
"in",
"an",
"incoming",
"provider"
] | train | https://github.com/petrbouda/joyrest/blob/58903f06fb7f0b8fdf1ef91318fb48a88bf970e0/joyrest-core/src/main/java/org/joyrest/routing/matcher/RequestMatcher.java#L81-L87 |
j256/simplejmx | src/main/java/com/j256/simplejmx/client/CommandLineJmxClient.java | CommandLineJmxClient.runScript | private void runScript(String alias, int levelC) throws IOException {
"""
Run a script. This might go recursive if we run from within a script.
"""
String scriptFile = alias;
InputStream stream;
try {
stream = getInputStream(scriptFile);
if (stream == null) {
System.out.println("Error. Script ... | java | private void runScript(String alias, int levelC) throws IOException {
String scriptFile = alias;
InputStream stream;
try {
stream = getInputStream(scriptFile);
if (stream == null) {
System.out.println("Error. Script file is not found: " + scriptFile);
return;
}
} catch (IOException e) {
Sys... | [
"private",
"void",
"runScript",
"(",
"String",
"alias",
",",
"int",
"levelC",
")",
"throws",
"IOException",
"{",
"String",
"scriptFile",
"=",
"alias",
";",
"InputStream",
"stream",
";",
"try",
"{",
"stream",
"=",
"getInputStream",
"(",
"scriptFile",
")",
";"... | Run a script. This might go recursive if we run from within a script. | [
"Run",
"a",
"script",
".",
"This",
"might",
"go",
"recursive",
"if",
"we",
"run",
"from",
"within",
"a",
"script",
"."
] | train | https://github.com/j256/simplejmx/blob/1a04f52512dfa0a711ba0cc7023c604dbc82a352/src/main/java/com/j256/simplejmx/client/CommandLineJmxClient.java#L319-L343 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/ArabicShaping.java | ArabicShaping.handleTashkeelWithTatweel | private static int handleTashkeelWithTatweel(char[] dest, int sourceLength) {
"""
/*
Name : handleTashkeelWithTatweel
Function : Replaces Tashkeel as following:
Case 1 :if the Tashkeel on tatweel, replace it with Tatweel.
Case 2 :if the Tashkeel aggregated with Shadda on Tatweel, replace
it with Shadda on... | java | private static int handleTashkeelWithTatweel(char[] dest, int sourceLength) {
int i;
for(i = 0; i < sourceLength; i++){
if((isTashkeelOnTatweelChar(dest[i]) == 1)){
dest[i] = TATWEEL_CHAR;
}else if((i... | [
"private",
"static",
"int",
"handleTashkeelWithTatweel",
"(",
"char",
"[",
"]",
"dest",
",",
"int",
"sourceLength",
")",
"{",
"int",
"i",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"sourceLength",
";",
"i",
"++",
")",
"{",
"if",
"(",
"(",
"isTa... | /*
Name : handleTashkeelWithTatweel
Function : Replaces Tashkeel as following:
Case 1 :if the Tashkeel on tatweel, replace it with Tatweel.
Case 2 :if the Tashkeel aggregated with Shadda on Tatweel, replace
it with Shadda on Tatweel.
Case 3: if the Tashkeel is isolated replace it with Space. | [
"/",
"*",
"Name",
":",
"handleTashkeelWithTatweel",
"Function",
":",
"Replaces",
"Tashkeel",
"as",
"following",
":",
"Case",
"1",
":",
"if",
"the",
"Tashkeel",
"on",
"tatweel",
"replace",
"it",
"with",
"Tatweel",
".",
"Case",
"2",
":",
"if",
"the",
"Tashke... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/ArabicShaping.java#L1207-L1219 |
mozilla/rhino | src/org/mozilla/javascript/NativeGlobal.java | NativeGlobal.js_eval | private Object js_eval(Context cx, Scriptable scope, Object[] args) {
"""
This is an indirect call to eval, and thus uses the global environment.
Direct calls are executed via ScriptRuntime.callSpecial().
"""
Scriptable global = ScriptableObject.getTopLevelScope(scope);
return ScriptRuntime.ev... | java | private Object js_eval(Context cx, Scriptable scope, Object[] args)
{
Scriptable global = ScriptableObject.getTopLevelScope(scope);
return ScriptRuntime.evalSpecial(cx, global, global, args, "eval code", 1);
} | [
"private",
"Object",
"js_eval",
"(",
"Context",
"cx",
",",
"Scriptable",
"scope",
",",
"Object",
"[",
"]",
"args",
")",
"{",
"Scriptable",
"global",
"=",
"ScriptableObject",
".",
"getTopLevelScope",
"(",
"scope",
")",
";",
"return",
"ScriptRuntime",
".",
"ev... | This is an indirect call to eval, and thus uses the global environment.
Direct calls are executed via ScriptRuntime.callSpecial(). | [
"This",
"is",
"an",
"indirect",
"call",
"to",
"eval",
"and",
"thus",
"uses",
"the",
"global",
"environment",
".",
"Direct",
"calls",
"are",
"executed",
"via",
"ScriptRuntime",
".",
"callSpecial",
"()",
"."
] | train | https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/NativeGlobal.java#L482-L486 |
buschmais/jqa-javaee6-plugin | src/main/java/com/buschmais/jqassistant/plugin/javaee6/impl/scanner/JsfFaceletScannerPlugin.java | JsfFaceletScannerPlugin.absolutifyFilePath | private String absolutifyFilePath(final String path, final String referencePath) {
"""
<p>
Try to make an absolute path from a relative path and a reference path.
</p>
<p>
<b>Example:</b><br>
<i>path</i> - ../../a/b.jspx<br>
<i>referencePath</i> - c/d/e/f.jspx<br>
<b>Result: c/a/b.jspx</b>
</p>
@param... | java | private String absolutifyFilePath(final String path, final String referencePath) {
// can't handle EL-expressions
if (isElExpression(path)) {
return path;
}
String normalizedPath;
if (!path.startsWith("/")) {
Path reference = Paths.get(referencePath);
... | [
"private",
"String",
"absolutifyFilePath",
"(",
"final",
"String",
"path",
",",
"final",
"String",
"referencePath",
")",
"{",
"// can't handle EL-expressions",
"if",
"(",
"isElExpression",
"(",
"path",
")",
")",
"{",
"return",
"path",
";",
"}",
"String",
"normal... | <p>
Try to make an absolute path from a relative path and a reference path.
</p>
<p>
<b>Example:</b><br>
<i>path</i> - ../../a/b.jspx<br>
<i>referencePath</i> - c/d/e/f.jspx<br>
<b>Result: c/a/b.jspx</b>
</p>
@param path
the relative path
@param referencePath
the reference file path (should be absolute)
@return a pa... | [
"<p",
">",
"Try",
"to",
"make",
"an",
"absolute",
"path",
"from",
"a",
"relative",
"path",
"and",
"a",
"reference",
"path",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/buschmais/jqa-javaee6-plugin/blob/f5776604d9255206807e5aca90b8767bde494e14/src/main/java/com/buschmais/jqassistant/plugin/javaee6/impl/scanner/JsfFaceletScannerPlugin.java#L218-L233 |
gocd/gocd | base/src/main/java/com/thoughtworks/go/util/DirectoryScanner.java | DirectoryScanner.isMorePowerfulThanExcludes | private boolean isMorePowerfulThanExcludes(String name, String includepattern) {
"""
Find out whether one particular include pattern is more powerful
than all the excludes.
Note: the power comparison is based on the length of the include pattern
and of the exclude patterns without the wildcards.
Ideally the c... | java | private boolean isMorePowerfulThanExcludes(String name, String includepattern) {
String soughtexclude = name + File.separator + "**";
for (int counter = 0; counter < excludes.length; counter++) {
if (excludes[counter].equals(soughtexclude)) {
return false;
}
... | [
"private",
"boolean",
"isMorePowerfulThanExcludes",
"(",
"String",
"name",
",",
"String",
"includepattern",
")",
"{",
"String",
"soughtexclude",
"=",
"name",
"+",
"File",
".",
"separator",
"+",
"\"**\"",
";",
"for",
"(",
"int",
"counter",
"=",
"0",
";",
"cou... | Find out whether one particular include pattern is more powerful
than all the excludes.
Note: the power comparison is based on the length of the include pattern
and of the exclude patterns without the wildcards.
Ideally the comparison should be done based on the depth
of the match; that is to say how many file separat... | [
"Find",
"out",
"whether",
"one",
"particular",
"include",
"pattern",
"is",
"more",
"powerful",
"than",
"all",
"the",
"excludes",
".",
"Note",
":",
"the",
"power",
"comparison",
"is",
"based",
"on",
"the",
"length",
"of",
"the",
"include",
"pattern",
"and",
... | train | https://github.com/gocd/gocd/blob/59a8480e23d6c06de39127635108dff57603cb71/base/src/main/java/com/thoughtworks/go/util/DirectoryScanner.java#L1241-L1249 |
infinispan/infinispan | lucene/directory-provider/src/main/java/org/infinispan/hibernate/search/util/configuration/impl/ConfigurationParseHelper.java | ConfigurationParseHelper.getBooleanValue | public static final boolean getBooleanValue(Properties cfg, String key, boolean defaultValue) {
"""
Extracts a boolean value from configuration properties
@param cfg configuration Properties
@param key the property key
@param defaultValue a boolean.
@return the defaultValue if the property ... | java | public static final boolean getBooleanValue(Properties cfg, String key, boolean defaultValue) {
String propValue = cfg.getProperty(key);
if (propValue == null) {
return defaultValue;
} else {
return parseBoolean(propValue, "Property '" + key + "' needs to be either literal 'true' or ... | [
"public",
"static",
"final",
"boolean",
"getBooleanValue",
"(",
"Properties",
"cfg",
",",
"String",
"key",
",",
"boolean",
"defaultValue",
")",
"{",
"String",
"propValue",
"=",
"cfg",
".",
"getProperty",
"(",
"key",
")",
";",
"if",
"(",
"propValue",
"==",
... | Extracts a boolean value from configuration properties
@param cfg configuration Properties
@param key the property key
@param defaultValue a boolean.
@return the defaultValue if the property was not defined
@throws SearchException for invalid format or values. | [
"Extracts",
"a",
"boolean",
"value",
"from",
"configuration",
"properties"
] | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/lucene/directory-provider/src/main/java/org/infinispan/hibernate/search/util/configuration/impl/ConfigurationParseHelper.java#L94-L101 |
zaproxy/zaproxy | src/org/apache/commons/httpclient/HttpMethodBase.java | HttpMethodBase.parseCookieHeader | static List<Cookie> parseCookieHeader(String host, String cookieHeaderValue) {
"""
Parse a cookie header to return a list of cookies.
Unfortunatly the method Header.getElements() is not working properly.
On a line like Cookie: has-js=1; drupal-toolbar=off it only returns the
first element has-js=1. So we rewo... | java | static List<Cookie> parseCookieHeader(String host, String cookieHeaderValue) {
if (StringUtils.isEmpty(cookieHeaderValue)){
return Collections.emptyList();
}
String[] cookies = cookieHeaderValue.split(";");
List<Cookie> cookiesList = new ArrayList<Cookie>();
for (Stri... | [
"static",
"List",
"<",
"Cookie",
">",
"parseCookieHeader",
"(",
"String",
"host",
",",
"String",
"cookieHeaderValue",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isEmpty",
"(",
"cookieHeaderValue",
")",
")",
"{",
"return",
"Collections",
".",
"emptyList",
"(",
... | Parse a cookie header to return a list of cookies.
Unfortunatly the method Header.getElements() is not working properly.
On a line like Cookie: has-js=1; drupal-toolbar=off it only returns the
first element has-js=1. So we rework this one.
This is a "won't fix" known issue as the project ended.
https://issues.apache.... | [
"Parse",
"a",
"cookie",
"header",
"to",
"return",
"a",
"list",
"of",
"cookies",
"."
] | train | https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/apache/commons/httpclient/HttpMethodBase.java#L1430-L1446 |
Impetus/Kundera | src/kundera-spark/spark-teradata/src/main/java/com/impetus/spark/client/TeradataSparkClient.java | TeradataSparkClient.getConnectionString | public String getConnectionString(EntityMetadata m) {
"""
Gets the connection string.
@param m
the m
@return the connection string
"""
Properties properties = new Properties();
String fileName = "teradata.properties";
InputStream inputStream = getClass().getClassLoader().getResour... | java | public String getConnectionString(EntityMetadata m)
{
Properties properties = new Properties();
String fileName = "teradata.properties";
InputStream inputStream = getClass().getClassLoader().getResourceAsStream(fileName);
if (inputStream != null)
{
try
... | [
"public",
"String",
"getConnectionString",
"(",
"EntityMetadata",
"m",
")",
"{",
"Properties",
"properties",
"=",
"new",
"Properties",
"(",
")",
";",
"String",
"fileName",
"=",
"\"teradata.properties\"",
";",
"InputStream",
"inputStream",
"=",
"getClass",
"(",
")"... | Gets the connection string.
@param m
the m
@return the connection string | [
"Gets",
"the",
"connection",
"string",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-spark/spark-teradata/src/main/java/com/impetus/spark/client/TeradataSparkClient.java#L89-L116 |
netty/netty | handler/src/main/java/io/netty/handler/ssl/ReferenceCountedOpenSslContext.java | ReferenceCountedOpenSslContext.setPrivateKeyMethod | @UnstableApi
public final void setPrivateKeyMethod(OpenSslPrivateKeyMethod method) {
"""
Set the {@link OpenSslPrivateKeyMethod} to use. This allows to offload private-key operations
if needed.
This method is currently only supported when {@code BoringSSL} is used.
@param method method to use.
"""
... | java | @UnstableApi
public final void setPrivateKeyMethod(OpenSslPrivateKeyMethod method) {
ObjectUtil.checkNotNull(method, "method");
Lock writerLock = ctxLock.writeLock();
writerLock.lock();
try {
SSLContext.setPrivateKeyMethod(ctx, new PrivateKeyMethod(engineMap, method));
... | [
"@",
"UnstableApi",
"public",
"final",
"void",
"setPrivateKeyMethod",
"(",
"OpenSslPrivateKeyMethod",
"method",
")",
"{",
"ObjectUtil",
".",
"checkNotNull",
"(",
"method",
",",
"\"method\"",
")",
";",
"Lock",
"writerLock",
"=",
"ctxLock",
".",
"writeLock",
"(",
... | Set the {@link OpenSslPrivateKeyMethod} to use. This allows to offload private-key operations
if needed.
This method is currently only supported when {@code BoringSSL} is used.
@param method method to use. | [
"Set",
"the",
"{",
"@link",
"OpenSslPrivateKeyMethod",
"}",
"to",
"use",
".",
"This",
"allows",
"to",
"offload",
"private",
"-",
"key",
"operations",
"if",
"needed",
"."
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/ReferenceCountedOpenSslContext.java#L532-L542 |
Nexmo/nexmo-java | src/main/java/com/nexmo/client/verify/VerifyClient.java | VerifyClient.advanceVerification | public ControlResponse advanceVerification(String requestId) throws IOException, NexmoClientException {
"""
Advance a current verification request to the next stage in the process.
@param requestId The requestId of the ongoing verification request.
@return A {@link ControlResponse} representing the response fr... | java | public ControlResponse advanceVerification(String requestId) throws IOException, NexmoClientException {
return this.control.execute(new ControlRequest(requestId, VerifyControlCommand.TRIGGER_NEXT_EVENT));
} | [
"public",
"ControlResponse",
"advanceVerification",
"(",
"String",
"requestId",
")",
"throws",
"IOException",
",",
"NexmoClientException",
"{",
"return",
"this",
".",
"control",
".",
"execute",
"(",
"new",
"ControlRequest",
"(",
"requestId",
",",
"VerifyControlCommand... | Advance a current verification request to the next stage in the process.
@param requestId The requestId of the ongoing verification request.
@return A {@link ControlResponse} representing the response from the API.
@throws IOException If an IO error occurred while making the request.
@throws NexmoClientExcept... | [
"Advance",
"a",
"current",
"verification",
"request",
"to",
"the",
"next",
"stage",
"in",
"the",
"process",
"."
] | train | https://github.com/Nexmo/nexmo-java/blob/7427eff6d6baa5a5bd9197fa096bcf2564191cf5/src/main/java/com/nexmo/client/verify/VerifyClient.java#L219-L221 |
rsocket/rsocket-java | rsocket-core/src/main/java/io/rsocket/util/NumberUtils.java | NumberUtils.requireNonNegative | public static int requireNonNegative(int i, String message) {
"""
Requires that an {@code int} is greater than or equal to zero.
@param i the {@code int} to test
@param message detail message to be used in the event that a {@link IllegalArgumentException}
is thrown
@return the {@code int} if greater than or ... | java | public static int requireNonNegative(int i, String message) {
Objects.requireNonNull(message, "message must not be null");
if (i < 0) {
throw new IllegalArgumentException(message);
}
return i;
} | [
"public",
"static",
"int",
"requireNonNegative",
"(",
"int",
"i",
",",
"String",
"message",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"message",
",",
"\"message must not be null\"",
")",
";",
"if",
"(",
"i",
"<",
"0",
")",
"{",
"throw",
"new",
"Ille... | Requires that an {@code int} is greater than or equal to zero.
@param i the {@code int} to test
@param message detail message to be used in the event that a {@link IllegalArgumentException}
is thrown
@return the {@code int} if greater than or equal to zero
@throws IllegalArgumentException if {@code i} is less than zer... | [
"Requires",
"that",
"an",
"{",
"@code",
"int",
"}",
"is",
"greater",
"than",
"or",
"equal",
"to",
"zero",
"."
] | train | https://github.com/rsocket/rsocket-java/blob/5101748fbd224ec86570351cebd24d079b63fbfc/rsocket-core/src/main/java/io/rsocket/util/NumberUtils.java#L49-L57 |
DDTH/ddth-commons | ddth-commons-core/src/main/java/com/github/ddth/commons/utils/TypesafeConfigUtils.java | TypesafeConfigUtils.getInteger | public static Integer getInteger(Config config, String path) {
"""
Get a configuration as Integer. Return {@code null} if missing or wrong type.
@param config
@param path
@return
"""
try {
Object obj = config.getAnyRef(path);
return obj instanceof Number ? ((Number) obj).in... | java | public static Integer getInteger(Config config, String path) {
try {
Object obj = config.getAnyRef(path);
return obj instanceof Number ? ((Number) obj).intValue() : null;
} catch (ConfigException.Missing | ConfigException.WrongType e) {
if (e instanceof ConfigExceptio... | [
"public",
"static",
"Integer",
"getInteger",
"(",
"Config",
"config",
",",
"String",
"path",
")",
"{",
"try",
"{",
"Object",
"obj",
"=",
"config",
".",
"getAnyRef",
"(",
"path",
")",
";",
"return",
"obj",
"instanceof",
"Number",
"?",
"(",
"(",
"Number",
... | Get a configuration as Integer. Return {@code null} if missing or wrong type.
@param config
@param path
@return | [
"Get",
"a",
"configuration",
"as",
"Integer",
".",
"Return",
"{",
"@code",
"null",
"}",
"if",
"missing",
"or",
"wrong",
"type",
"."
] | train | https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/utils/TypesafeConfigUtils.java#L305-L315 |
actorapp/actor-platform | actor-sdk/sdk-core/core/core-shared/src/main/java/im/actor/core/Messenger.java | Messenger.rawRequest | @ObjectiveCName("rawRequestWithService:withMethod:WithParams:")
public void rawRequest(String service, String method, ApiRawValue params) {
"""
Command for raw api request
@param service service name
@param method method name
@param params request params
"""
modules.getExternalModule().rawRe... | java | @ObjectiveCName("rawRequestWithService:withMethod:WithParams:")
public void rawRequest(String service, String method, ApiRawValue params) {
modules.getExternalModule().rawRequest(service, method, params);
} | [
"@",
"ObjectiveCName",
"(",
"\"rawRequestWithService:withMethod:WithParams:\"",
")",
"public",
"void",
"rawRequest",
"(",
"String",
"service",
",",
"String",
"method",
",",
"ApiRawValue",
"params",
")",
"{",
"modules",
".",
"getExternalModule",
"(",
")",
".",
"rawRe... | Command for raw api request
@param service service name
@param method method name
@param params request params | [
"Command",
"for",
"raw",
"api",
"request"
] | train | https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core/core/core-shared/src/main/java/im/actor/core/Messenger.java#L2638-L2641 |
gosu-lang/gosu-lang | gosu-core-api/src/main/java/gw/lang/gosuc/Gosuc.java | Gosuc.main | public static void main( String[] args ) throws FileNotFoundException {
"""
- Then run this from IJ using 'classpath of module' setting to match the proper module for pl/pc/cc etc. (this is so the global loaders will be in the classpath)
"""
String error = GosucArg.parseArgs( args );
if( error != null ... | java | public static void main( String[] args ) throws FileNotFoundException {
String error = GosucArg.parseArgs( args );
if( error != null ) {
System.err.println( error );
return;
}
String strFile = GosucArg.PROJECT.getValue();
Gosuc gosuc = new Gosuc( strFile, maybeGetCustomParser() );
go... | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"throws",
"FileNotFoundException",
"{",
"String",
"error",
"=",
"GosucArg",
".",
"parseArgs",
"(",
"args",
")",
";",
"if",
"(",
"error",
"!=",
"null",
")",
"{",
"System",
".",
"e... | - Then run this from IJ using 'classpath of module' setting to match the proper module for pl/pc/cc etc. (this is so the global loaders will be in the classpath) | [
"-",
"Then",
"run",
"this",
"from",
"IJ",
"using",
"classpath",
"of",
"module",
"setting",
"to",
"match",
"the",
"proper",
"module",
"for",
"pl",
"/",
"pc",
"/",
"cc",
"etc",
".",
"(",
"this",
"is",
"so",
"the",
"global",
"loaders",
"will",
"be",
"in... | train | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/lang/gosuc/Gosuc.java#L309-L319 |
gmessner/gitlab4j-api | src/main/java/org/gitlab4j/api/ServicesApi.java | ServicesApi.updateExternalWikiService | public ExternalWikiService updateExternalWikiService(Object projectIdOrPath, ExternalWikiService externalWiki) throws GitLabApiException {
"""
Updates the ExternalWikiService service settings for a project.
<pre><code>GitLab Endpoint: PUT /projects/:id/services/external-wiki</code></pre>
The following prope... | java | public ExternalWikiService updateExternalWikiService(Object projectIdOrPath, ExternalWikiService externalWiki) throws GitLabApiException {
GitLabApiForm formData = new GitLabApiForm()
.withParam("external_wiki_url", externalWiki.getExternalWikiUrl());
Response response = put(Response.St... | [
"public",
"ExternalWikiService",
"updateExternalWikiService",
"(",
"Object",
"projectIdOrPath",
",",
"ExternalWikiService",
"externalWiki",
")",
"throws",
"GitLabApiException",
"{",
"GitLabApiForm",
"formData",
"=",
"new",
"GitLabApiForm",
"(",
")",
".",
"withParam",
"(",... | Updates the ExternalWikiService service settings for a project.
<pre><code>GitLab Endpoint: PUT /projects/:id/services/external-wiki</code></pre>
The following properties on the JiraService instance are utilized in the update of the settings:
<p>
external_wiki_url (required) - The URL to the External Wiki project whi... | [
"Updates",
"the",
"ExternalWikiService",
"service",
"settings",
"for",
"a",
"project",
"."
] | train | https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/ServicesApi.java#L345-L350 |
aws/aws-sdk-java | aws-java-sdk-robomaker/src/main/java/com/amazonaws/services/robomaker/model/CreateSimulationApplicationRequest.java | CreateSimulationApplicationRequest.withTags | public CreateSimulationApplicationRequest withTags(java.util.Map<String, String> tags) {
"""
<p>
A map that contains tag keys and tag values that are attached to the simulation application.
</p>
@param tags
A map that contains tag keys and tag values that are attached to the simulation application.
@return ... | java | public CreateSimulationApplicationRequest withTags(java.util.Map<String, String> tags) {
setTags(tags);
return this;
} | [
"public",
"CreateSimulationApplicationRequest",
"withTags",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"tags",
")",
"{",
"setTags",
"(",
"tags",
")",
";",
"return",
"this",
";",
"}"
] | <p>
A map that contains tag keys and tag values that are attached to the simulation application.
</p>
@param tags
A map that contains tag keys and tag values that are attached to the simulation application.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"A",
"map",
"that",
"contains",
"tag",
"keys",
"and",
"tag",
"values",
"that",
"are",
"attached",
"to",
"the",
"simulation",
"application",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-robomaker/src/main/java/com/amazonaws/services/robomaker/model/CreateSimulationApplicationRequest.java#L330-L333 |
sdaschner/jaxrs-analyzer | src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/results/ResultInterpreter.java | ResultInterpreter.interpretMethodResult | private void interpretMethodResult(final MethodResult methodResult, final ClassResult classResult) {
"""
Interprets the method result.
@param methodResult The method result
@param classResult The result of the containing class
"""
if (methodResult.getSubResource() != null) {
interpretC... | java | private void interpretMethodResult(final MethodResult methodResult, final ClassResult classResult) {
if (methodResult.getSubResource() != null) {
interpretClassResult(methodResult.getSubResource());
return;
}
// determine resource of the method
final String path ... | [
"private",
"void",
"interpretMethodResult",
"(",
"final",
"MethodResult",
"methodResult",
",",
"final",
"ClassResult",
"classResult",
")",
"{",
"if",
"(",
"methodResult",
".",
"getSubResource",
"(",
")",
"!=",
"null",
")",
"{",
"interpretClassResult",
"(",
"method... | Interprets the method result.
@param methodResult The method result
@param classResult The result of the containing class | [
"Interprets",
"the",
"method",
"result",
"."
] | train | https://github.com/sdaschner/jaxrs-analyzer/blob/4ac62942202d05632977d6c14d3cd7e2d27e2b9b/src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/results/ResultInterpreter.java#L83-L95 |
realexpayments/rxp-hpp-java | src/main/java/com/realexpayments/hpp/sdk/domain/HppResponse.java | HppResponse.setSupplementaryDataValue | @JsonAnySetter
public void setSupplementaryDataValue(String name, String value) {
"""
Setter for supplementary data value.
@param name
@param value
"""
supplementaryData.put(name, value);
} | java | @JsonAnySetter
public void setSupplementaryDataValue(String name, String value) {
supplementaryData.put(name, value);
} | [
"@",
"JsonAnySetter",
"public",
"void",
"setSupplementaryDataValue",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"supplementaryData",
".",
"put",
"(",
"name",
",",
"value",
")",
";",
"}"
] | Setter for supplementary data value.
@param name
@param value | [
"Setter",
"for",
"supplementary",
"data",
"value",
"."
] | train | https://github.com/realexpayments/rxp-hpp-java/blob/29cc5df036af09a6d8ea16ccd7e02e856f72620f/src/main/java/com/realexpayments/hpp/sdk/domain/HppResponse.java#L495-L498 |
ben-manes/caffeine | simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/segment/S4WindowTinyLfuPolicy.java | S4WindowTinyLfuPolicy.policies | public static Set<Policy> policies(Config config) {
"""
Returns all variations of this policy based on the configuration parameters.
"""
S4WindowTinyLfuSettings settings = new S4WindowTinyLfuSettings(config);
return settings.percentMain().stream()
.map(percentMain -> new S4WindowTinyLfuPolicy(p... | java | public static Set<Policy> policies(Config config) {
S4WindowTinyLfuSettings settings = new S4WindowTinyLfuSettings(config);
return settings.percentMain().stream()
.map(percentMain -> new S4WindowTinyLfuPolicy(percentMain, settings))
.collect(toSet());
} | [
"public",
"static",
"Set",
"<",
"Policy",
">",
"policies",
"(",
"Config",
"config",
")",
"{",
"S4WindowTinyLfuSettings",
"settings",
"=",
"new",
"S4WindowTinyLfuSettings",
"(",
"config",
")",
";",
"return",
"settings",
".",
"percentMain",
"(",
")",
".",
"strea... | Returns all variations of this policy based on the configuration parameters. | [
"Returns",
"all",
"variations",
"of",
"this",
"policy",
"based",
"on",
"the",
"configuration",
"parameters",
"."
] | train | https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/segment/S4WindowTinyLfuPolicy.java#L73-L78 |
lionsoul2014/jcseg | jcseg-core/src/main/java/org/lionsoul/jcseg/tokenizer/core/SegmentFactory.java | SegmentFactory.createJcseg | public static ISegment createJcseg( int mode, Object...args ) throws JcsegException {
"""
create the specified mode Jcseg instance
@param mode
@return ISegment
@throws JcsegException
"""
Class<? extends ISegment> _clsname;
switch ( mode ) {
case JcsegTaskConfig.SIMPLE_MODE:
... | java | public static ISegment createJcseg( int mode, Object...args ) throws JcsegException
{
Class<? extends ISegment> _clsname;
switch ( mode ) {
case JcsegTaskConfig.SIMPLE_MODE:
_clsname = SimpleSeg.class;
break;
case JcsegTaskConfig.COMPLEX_MODE:
_cl... | [
"public",
"static",
"ISegment",
"createJcseg",
"(",
"int",
"mode",
",",
"Object",
"...",
"args",
")",
"throws",
"JcsegException",
"{",
"Class",
"<",
"?",
"extends",
"ISegment",
">",
"_clsname",
";",
"switch",
"(",
"mode",
")",
"{",
"case",
"JcsegTaskConfig",... | create the specified mode Jcseg instance
@param mode
@return ISegment
@throws JcsegException | [
"create",
"the",
"specified",
"mode",
"Jcseg",
"instance"
] | train | https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/tokenizer/core/SegmentFactory.java#L55-L91 |
Omertron/api-themoviedb | src/main/java/com/omertron/themoviedbapi/methods/TmdbKeywords.java | TmdbKeywords.getKeyword | public Keyword getKeyword(String keywordId) throws MovieDbException {
"""
Get the basic information for a specific keyword id.
@param keywordId
@return
@throws MovieDbException
"""
TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.ID, keywordId);
URL url = new... | java | public Keyword getKeyword(String keywordId) throws MovieDbException {
TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.ID, keywordId);
URL url = new ApiUrl(apiKey, MethodBase.KEYWORD).buildUrl(parameters);
String webpage = httpTools.getRequest(url);
try {
... | [
"public",
"Keyword",
"getKeyword",
"(",
"String",
"keywordId",
")",
"throws",
"MovieDbException",
"{",
"TmdbParameters",
"parameters",
"=",
"new",
"TmdbParameters",
"(",
")",
";",
"parameters",
".",
"add",
"(",
"Param",
".",
"ID",
",",
"keywordId",
")",
";",
... | Get the basic information for a specific keyword id.
@param keywordId
@return
@throws MovieDbException | [
"Get",
"the",
"basic",
"information",
"for",
"a",
"specific",
"keyword",
"id",
"."
] | train | https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/methods/TmdbKeywords.java#L61-L74 |
Breinify/brein-time-utilities | src/com/brein/time/timeseries/BucketTimeSeries.java | BucketTimeSeries.fill | protected void fill(int fromIndex, int endIndex) {
"""
Resets the values from [fromIndex, endIndex).
@param fromIndex the index to start from (included)
@param endIndex the index to end (excluded)
"""
fromIndex = fromIndex == -1 ? 0 : fromIndex;
endIndex = endIndex == -1 || endIndex > this... | java | protected void fill(int fromIndex, int endIndex) {
fromIndex = fromIndex == -1 ? 0 : fromIndex;
endIndex = endIndex == -1 || endIndex > this.timeSeries.length ? this.timeSeries.length : endIndex;
final T val;
if (applyZero()) {
val = zero();
} else {
val ... | [
"protected",
"void",
"fill",
"(",
"int",
"fromIndex",
",",
"int",
"endIndex",
")",
"{",
"fromIndex",
"=",
"fromIndex",
"==",
"-",
"1",
"?",
"0",
":",
"fromIndex",
";",
"endIndex",
"=",
"endIndex",
"==",
"-",
"1",
"||",
"endIndex",
">",
"this",
".",
"... | Resets the values from [fromIndex, endIndex).
@param fromIndex the index to start from (included)
@param endIndex the index to end (excluded) | [
"Resets",
"the",
"values",
"from",
"[",
"fromIndex",
"endIndex",
")",
"."
] | train | https://github.com/Breinify/brein-time-utilities/blob/ec0165a50ec1951ec7730b72c85c801c2018f314/src/com/brein/time/timeseries/BucketTimeSeries.java#L125-L140 |
elki-project/elki | elki/src/main/java/de/lmu/ifi/dbs/elki/algorithm/outlier/OPTICSOF.java | OPTICSOF.run | public OutlierResult run(Database database, Relation<O> relation) {
"""
Perform OPTICS-based outlier detection.
@param database Database
@param relation Relation
@return Outlier detection result
"""
DistanceQuery<O> distQuery = database.getDistanceQuery(relation, getDistanceFunction());
KNNQuery<O... | java | public OutlierResult run(Database database, Relation<O> relation) {
DistanceQuery<O> distQuery = database.getDistanceQuery(relation, getDistanceFunction());
KNNQuery<O> knnQuery = database.getKNNQuery(distQuery, minpts);
RangeQuery<O> rangeQuery = database.getRangeQuery(distQuery);
DBIDs ids = relation.... | [
"public",
"OutlierResult",
"run",
"(",
"Database",
"database",
",",
"Relation",
"<",
"O",
">",
"relation",
")",
"{",
"DistanceQuery",
"<",
"O",
">",
"distQuery",
"=",
"database",
".",
"getDistanceQuery",
"(",
"relation",
",",
"getDistanceFunction",
"(",
")",
... | Perform OPTICS-based outlier detection.
@param database Database
@param relation Relation
@return Outlier detection result | [
"Perform",
"OPTICS",
"-",
"based",
"outlier",
"detection",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki/src/main/java/de/lmu/ifi/dbs/elki/algorithm/outlier/OPTICSOF.java#L116-L176 |
blackducksoftware/blackduck-common | src/main/java/com/synopsys/integration/blackduck/codelocation/signaturescanner/command/ScanPathsUtility.java | ScanPathsUtility.determineSignatureScannerPaths | public ScanPaths determineSignatureScannerPaths(final File directory) throws BlackDuckIntegrationException {
"""
The directory can either be the directory that contains Black_Duck_Scan_Installation, or the directory that contains the bin, jre, lib (etc) directories.
@param directory
@throws BlackDuckIntegrationE... | java | public ScanPaths determineSignatureScannerPaths(final File directory) throws BlackDuckIntegrationException {
if (directory == null) {
throw new IllegalArgumentException("null is not a valid directory");
}
if (!directory.isDirectory()) {
throw new IllegalArgumentException... | [
"public",
"ScanPaths",
"determineSignatureScannerPaths",
"(",
"final",
"File",
"directory",
")",
"throws",
"BlackDuckIntegrationException",
"{",
"if",
"(",
"directory",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"null is not a valid directo... | The directory can either be the directory that contains Black_Duck_Scan_Installation, or the directory that contains the bin, jre, lib (etc) directories.
@param directory
@throws BlackDuckIntegrationException | [
"The",
"directory",
"can",
"either",
"be",
"the",
"directory",
"that",
"contains",
"Black_Duck_Scan_Installation",
"or",
"the",
"directory",
"that",
"contains",
"the",
"bin",
"jre",
"lib",
"(",
"etc",
")",
"directories",
"."
] | train | https://github.com/blackducksoftware/blackduck-common/blob/4ea4e90b52b75470b71c597b65cf4e2d73887bcc/src/main/java/com/synopsys/integration/blackduck/codelocation/signaturescanner/command/ScanPathsUtility.java#L76-L115 |
eclipse/xtext-core | org.eclipse.xtext/src-gen/org/eclipse/xtext/serializer/XtextSemanticSequencer.java | XtextSemanticSequencer.sequence_ParameterReference | protected void sequence_ParameterReference(ISerializationContext context, ParameterReference semanticObject) {
"""
Contexts:
Disjunction returns ParameterReference
Disjunction.Disjunction_1_0 returns ParameterReference
Conjunction returns ParameterReference
Conjunction.Conjunction_1_0 returns ParameterReferenc... | java | protected void sequence_ParameterReference(ISerializationContext context, ParameterReference semanticObject) {
if (errorAcceptor != null) {
if (transientValues.isValueTransient(semanticObject, XtextPackage.Literals.PARAMETER_REFERENCE__PARAMETER) == ValueTransient.YES)
errorAcceptor.accept(diagnosticProvider.c... | [
"protected",
"void",
"sequence_ParameterReference",
"(",
"ISerializationContext",
"context",
",",
"ParameterReference",
"semanticObject",
")",
"{",
"if",
"(",
"errorAcceptor",
"!=",
"null",
")",
"{",
"if",
"(",
"transientValues",
".",
"isValueTransient",
"(",
"semanti... | Contexts:
Disjunction returns ParameterReference
Disjunction.Disjunction_1_0 returns ParameterReference
Conjunction returns ParameterReference
Conjunction.Conjunction_1_0 returns ParameterReference
Negation returns ParameterReference
Atom returns ParameterReference
ParenthesizedCondition returns ParameterReference
Para... | [
"Contexts",
":",
"Disjunction",
"returns",
"ParameterReference",
"Disjunction",
".",
"Disjunction_1_0",
"returns",
"ParameterReference",
"Conjunction",
"returns",
"ParameterReference",
"Conjunction",
".",
"Conjunction_1_0",
"returns",
"ParameterReference",
"Negation",
"returns"... | train | https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext/src-gen/org/eclipse/xtext/serializer/XtextSemanticSequencer.java#L979-L987 |
EdwardRaff/JSAT | JSAT/src/jsat/classifiers/linear/LinearSGD.java | LinearSGD.applyL1Reg | private void applyL1Reg(final double eta_t, Vec x) {
"""
Applies L1 regularization to the model
@param eta_t the learning rate in use
@param x the input vector the update is from
"""
//apply l1 regularization
if(lambda1 > 0)
{
l1U += eta_t*lambda1;//line 6: in Tsuruoka et ... | java | private void applyL1Reg(final double eta_t, Vec x)
{
//apply l1 regularization
if(lambda1 > 0)
{
l1U += eta_t*lambda1;//line 6: in Tsuruoka et al paper, figure 2
for(int k = 0; k < ws.length; k++)
{
final Vec w_k = ws[k];
fi... | [
"private",
"void",
"applyL1Reg",
"(",
"final",
"double",
"eta_t",
",",
"Vec",
"x",
")",
"{",
"//apply l1 regularization",
"if",
"(",
"lambda1",
">",
"0",
")",
"{",
"l1U",
"+=",
"eta_t",
"*",
"lambda1",
";",
"//line 6: in Tsuruoka et al paper, figure 2",
"for",
... | Applies L1 regularization to the model
@param eta_t the learning rate in use
@param x the input vector the update is from | [
"Applies",
"L1",
"regularization",
"to",
"the",
"model"
] | train | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/linear/LinearSGD.java#L461-L486 |
apiman/apiman | manager/api/es/src/main/java/io/apiman/manager/api/es/EsMarshalling.java | EsMarshalling.unmarshallPluginSummary | public static PluginSummaryBean unmarshallPluginSummary(Map<String, Object> map) {
"""
Unmarshals the given map source into a bean.
@param map the search hit map
@return the plugin summary
"""
PluginSummaryBean bean = new PluginSummaryBean();
bean.setId(asLong(map.get("id")));
bean.se... | java | public static PluginSummaryBean unmarshallPluginSummary(Map<String, Object> map) {
PluginSummaryBean bean = new PluginSummaryBean();
bean.setId(asLong(map.get("id")));
bean.setName(asString(map.get("name")));
if (map.containsKey("description")) {
bean.setDescription(asString(... | [
"public",
"static",
"PluginSummaryBean",
"unmarshallPluginSummary",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"map",
")",
"{",
"PluginSummaryBean",
"bean",
"=",
"new",
"PluginSummaryBean",
"(",
")",
";",
"bean",
".",
"setId",
"(",
"asLong",
"(",
"map",
... | Unmarshals the given map source into a bean.
@param map the search hit map
@return the plugin summary | [
"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#L1335-L1356 |
ical4j/ical4j | src/main/java/net/fortuna/ical4j/data/CalendarParserImpl.java | CalendarParserImpl.absorbWhitespace | private int absorbWhitespace(final StreamTokenizer tokeniser, Reader in, boolean ignoreEOF) throws IOException, ParserException {
"""
Absorbs extraneous newlines.
@param tokeniser
@param in
@return int value of the ttype field of the tokeniser
@throws IOException
"""
// HACK: absorb extraneous wh... | java | private int absorbWhitespace(final StreamTokenizer tokeniser, Reader in, boolean ignoreEOF) throws IOException, ParserException {
// HACK: absorb extraneous whitespace between components (KOrganizer)..
int ntok;
while ((ntok = nextToken(tokeniser, in, ignoreEOF)) == StreamTokenizer.TT_EOL) {
... | [
"private",
"int",
"absorbWhitespace",
"(",
"final",
"StreamTokenizer",
"tokeniser",
",",
"Reader",
"in",
",",
"boolean",
"ignoreEOF",
")",
"throws",
"IOException",
",",
"ParserException",
"{",
"// HACK: absorb extraneous whitespace between components (KOrganizer)..",
"int",
... | Absorbs extraneous newlines.
@param tokeniser
@param in
@return int value of the ttype field of the tokeniser
@throws IOException | [
"Absorbs",
"extraneous",
"newlines",
"."
] | train | https://github.com/ical4j/ical4j/blob/7ac4bd1ce2bb2e0a2906fb69a56fbd2d9d974156/src/main/java/net/fortuna/ical4j/data/CalendarParserImpl.java#L580-L592 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/cardinality/impl/CardinalityEstimatorContainerCollector.java | CardinalityEstimatorContainerCollector.onIteration | @Override
protected void onIteration(String containerName, CardinalityEstimatorContainer container) {
"""
The {@link CardinalityEstimatorContainer} doesn't know its name or configuration, so we create these lookup maps.
This is cheaper than storing this information permanently in the container.
"""
... | java | @Override
protected void onIteration(String containerName, CardinalityEstimatorContainer container) {
CardinalityEstimatorConfig cardinalityEstimatorConfig = config.findCardinalityEstimatorConfig(containerName);
containerNames.put(container, containerName);
containerPolicies.put(container, ... | [
"@",
"Override",
"protected",
"void",
"onIteration",
"(",
"String",
"containerName",
",",
"CardinalityEstimatorContainer",
"container",
")",
"{",
"CardinalityEstimatorConfig",
"cardinalityEstimatorConfig",
"=",
"config",
".",
"findCardinalityEstimatorConfig",
"(",
"containerN... | The {@link CardinalityEstimatorContainer} doesn't know its name or configuration, so we create these lookup maps.
This is cheaper than storing this information permanently in the container. | [
"The",
"{"
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/cardinality/impl/CardinalityEstimatorContainerCollector.java#L48-L54 |
LGoodDatePicker/LGoodDatePicker | Project/src/main/java/com/privatejgoodies/forms/layout/FormLayout.java | FormLayout.shiftComponentsVertically | private void shiftComponentsVertically(int rowIndex, boolean remove) {
"""
Shifts components vertically, either to the bottom if a row has been inserted or to the top
if a row has been removed.
@param rowIndex index of the row to remove
@param remove true for remove, false for insert
@throws IllegalStateExce... | java | private void shiftComponentsVertically(int rowIndex, boolean remove) {
final int offset = remove ? -1 : 1;
for (Object element : constraintMap.entrySet()) {
Map.Entry entry = (Map.Entry) element;
CellConstraints constraints = (CellConstraints) entry.getValue();
int y1... | [
"private",
"void",
"shiftComponentsVertically",
"(",
"int",
"rowIndex",
",",
"boolean",
"remove",
")",
"{",
"final",
"int",
"offset",
"=",
"remove",
"?",
"-",
"1",
":",
"1",
";",
"for",
"(",
"Object",
"element",
":",
"constraintMap",
".",
"entrySet",
"(",
... | Shifts components vertically, either to the bottom if a row has been inserted or to the top
if a row has been removed.
@param rowIndex index of the row to remove
@param remove true for remove, false for insert
@throws IllegalStateException if a removed column contains components | [
"Shifts",
"components",
"vertically",
"either",
"to",
"the",
"bottom",
"if",
"a",
"row",
"has",
"been",
"inserted",
"or",
"to",
"the",
"top",
"if",
"a",
"row",
"has",
"been",
"removed",
"."
] | train | https://github.com/LGoodDatePicker/LGoodDatePicker/blob/c7df05a5fe382e1e08a6237e9391d8dc5fd48692/Project/src/main/java/com/privatejgoodies/forms/layout/FormLayout.java#L681-L700 |
micronaut-projects/micronaut-core | inject/src/main/java/io/micronaut/context/env/DefaultPropertyPlaceholderResolver.java | DefaultPropertyPlaceholderResolver.resolveReplacement | @Deprecated
protected boolean resolveReplacement(StringBuilder builder, String str, String expr) {
"""
Resolves a replacement for the given expression. Returning true if the replacement was resolved.
@deprecated No longer used internally. See {@link #resolveExpression(String, String, Class)}
@param builder... | java | @Deprecated
protected boolean resolveReplacement(StringBuilder builder, String str, String expr) {
if (environment.containsProperty(expr)) {
builder.append(environment.getProperty(expr, String.class).orElseThrow(() -> new ConfigurationException("Could not resolve placeholder ${" + expr + "} in v... | [
"@",
"Deprecated",
"protected",
"boolean",
"resolveReplacement",
"(",
"StringBuilder",
"builder",
",",
"String",
"str",
",",
"String",
"expr",
")",
"{",
"if",
"(",
"environment",
".",
"containsProperty",
"(",
"expr",
")",
")",
"{",
"builder",
".",
"append",
... | Resolves a replacement for the given expression. Returning true if the replacement was resolved.
@deprecated No longer used internally. See {@link #resolveExpression(String, String, Class)}
@param builder The builder
@param str The full string
@param expr The current expression
@return True if a placeholder was resolv... | [
"Resolves",
"a",
"replacement",
"for",
"the",
"given",
"expression",
".",
"Returning",
"true",
"if",
"the",
"replacement",
"was",
"resolved",
"."
] | train | https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/inject/src/main/java/io/micronaut/context/env/DefaultPropertyPlaceholderResolver.java#L155-L162 |
mikepenz/FastAdapter | library-core/src/main/java/com/mikepenz/fastadapter/listeners/OnBindViewHolderListenerImpl.java | OnBindViewHolderListenerImpl.onBindViewHolder | @Override
public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int position, List<Object> payloads) {
"""
is called in onBindViewHolder to bind the data on the ViewHolder
@param viewHolder the viewHolder for the type at this position
@param position the position of this viewHolder
@param pay... | java | @Override
public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int position, List<Object> payloads) {
Object tag = viewHolder.itemView.getTag(R.id.fastadapter_item_adapter);
if (tag instanceof FastAdapter) {
FastAdapter fastAdapter = ((FastAdapter) tag);
IItem ite... | [
"@",
"Override",
"public",
"void",
"onBindViewHolder",
"(",
"RecyclerView",
".",
"ViewHolder",
"viewHolder",
",",
"int",
"position",
",",
"List",
"<",
"Object",
">",
"payloads",
")",
"{",
"Object",
"tag",
"=",
"viewHolder",
".",
"itemView",
".",
"getTag",
"(... | is called in onBindViewHolder to bind the data on the ViewHolder
@param viewHolder the viewHolder for the type at this position
@param position the position of this viewHolder
@param payloads the payloads provided by the adapter | [
"is",
"called",
"in",
"onBindViewHolder",
"to",
"bind",
"the",
"data",
"on",
"the",
"ViewHolder"
] | train | https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/library-core/src/main/java/com/mikepenz/fastadapter/listeners/OnBindViewHolderListenerImpl.java#L21-L36 |
jboss/jboss-jsf-api_spec | src/main/java/javax/faces/component/UIViewRoot.java | UIViewRoot.processApplication | public void processApplication(FacesContext context) {
"""
<p>Broadcast any events that have been queued for the <em>Invoke
Application</em> phase of the request processing lifecycle
and to clear out any events for later phases if the event processing
for this phase caused {@link FacesContext#renderResponse} or... | java | public void processApplication(FacesContext context) {
initState();
notifyBefore(context, PhaseId.INVOKE_APPLICATION);
try {
if (!skipPhase) {
// NOTE - no tree walk is performed; this is a UIViewRoot-only operation
broadcastEvents(context, PhaseId.INV... | [
"public",
"void",
"processApplication",
"(",
"FacesContext",
"context",
")",
"{",
"initState",
"(",
")",
";",
"notifyBefore",
"(",
"context",
",",
"PhaseId",
".",
"INVOKE_APPLICATION",
")",
";",
"try",
"{",
"if",
"(",
"!",
"skipPhase",
")",
"{",
"// NOTE - n... | <p>Broadcast any events that have been queued for the <em>Invoke
Application</em> phase of the request processing lifecycle
and to clear out any events for later phases if the event processing
for this phase caused {@link FacesContext#renderResponse} or
{@link FacesContext#responseComplete} to be called.</p>
@param co... | [
"<p",
">",
"Broadcast",
"any",
"events",
"that",
"have",
"been",
"queued",
"for",
"the",
"<em",
">",
"Invoke",
"Application<",
"/",
"em",
">",
"phase",
"of",
"the",
"request",
"processing",
"lifecycle",
"and",
"to",
"clear",
"out",
"any",
"events",
"for",
... | train | https://github.com/jboss/jboss-jsf-api_spec/blob/cb33d215acbab847f2db5cdf2c6fe4d99c0a01c3/src/main/java/javax/faces/component/UIViewRoot.java#L1276-L1288 |
mapbox/mapbox-plugins-android | plugin-offline/src/main/java/com/mapbox/mapboxsdk/plugins/offline/offline/OfflineDownloadService.java | OfflineDownloadService.onStartCommand | @Override
public int onStartCommand(final Intent intent, int flags, final int startId) {
"""
Called each time a new download is initiated. First it acquires the
{@link OfflineDownloadOptions} from the intent and if found, the process of downloading the
offline region carries on to the {@link #onResolveCommand(... | java | @Override
public int onStartCommand(final Intent intent, int flags, final int startId) {
Timber.v("onStartCommand called.");
if (intent != null) {
final OfflineDownloadOptions offlineDownload = intent.getParcelableExtra(KEY_BUNDLE);
if (offlineDownload != null) {
onResolveCommand(intent.ge... | [
"@",
"Override",
"public",
"int",
"onStartCommand",
"(",
"final",
"Intent",
"intent",
",",
"int",
"flags",
",",
"final",
"int",
"startId",
")",
"{",
"Timber",
".",
"v",
"(",
"\"onStartCommand called.\"",
")",
";",
"if",
"(",
"intent",
"!=",
"null",
")",
... | Called each time a new download is initiated. First it acquires the
{@link OfflineDownloadOptions} from the intent and if found, the process of downloading the
offline region carries on to the {@link #onResolveCommand(String, OfflineDownloadOptions)}.
If the {@link OfflineDownloadOptions} fails to be found inside the i... | [
"Called",
"each",
"time",
"a",
"new",
"download",
"is",
"initiated",
".",
"First",
"it",
"acquires",
"the",
"{",
"@link",
"OfflineDownloadOptions",
"}",
"from",
"the",
"intent",
"and",
"if",
"found",
"the",
"process",
"of",
"downloading",
"the",
"offline",
"... | train | https://github.com/mapbox/mapbox-plugins-android/blob/c683cad4d8306945d71838d96fae73b8cbe2e6c9/plugin-offline/src/main/java/com/mapbox/mapboxsdk/plugins/offline/offline/OfflineDownloadService.java#L83-L97 |
jmapper-framework/jmapper-core | JMapper Framework/src/main/java/com/googlecode/jmapper/generation/MapperConstructorAccessor.java | MapperConstructorAccessor.searchXmlConfig | private ChooseConfig searchXmlConfig(ChooseConfig cc, XML xml) {
"""
This method finds the xml configuration, returns null if there are no.
@param cc Configuration to check
@param xml xml object
return ChooseConfig configuration found
"""
if(isNull(xml.getXmlPath())) return null;
if((isNull... | java | private ChooseConfig searchXmlConfig(ChooseConfig cc, XML xml){
if(isNull(xml.getXmlPath())) return null;
if((isNull(cc)||cc == ChooseConfig.DESTINATION) && xml.isInheritedMapped(destination))
return ChooseConfig.DESTINATION;
if((isNull(cc)||cc == ChooseConfig.SOURCE) && xml.isInheritedMa... | [
"private",
"ChooseConfig",
"searchXmlConfig",
"(",
"ChooseConfig",
"cc",
",",
"XML",
"xml",
")",
"{",
"if",
"(",
"isNull",
"(",
"xml",
".",
"getXmlPath",
"(",
")",
")",
")",
"return",
"null",
";",
"if",
"(",
"(",
"isNull",
"(",
"cc",
")",
"||",
"cc",... | This method finds the xml configuration, returns null if there are no.
@param cc Configuration to check
@param xml xml object
return ChooseConfig configuration found | [
"This",
"method",
"finds",
"the",
"xml",
"configuration",
"returns",
"null",
"if",
"there",
"are",
"no",
"."
] | train | https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/generation/MapperConstructorAccessor.java#L101-L112 |
craftercms/core | src/main/java/org/craftercms/core/util/XmlUtils.java | XmlUtils.documentToPrettyString | public static String documentToPrettyString(Document document) {
"""
Returns the given document as a XML string in a "pretty" format.
@param document
@return the document as an XML string
"""
StringWriter stringWriter = new StringWriter();
OutputFormat prettyPrintFormat = OutputFormat.creat... | java | public static String documentToPrettyString(Document document) {
StringWriter stringWriter = new StringWriter();
OutputFormat prettyPrintFormat = OutputFormat.createPrettyPrint();
XMLWriter xmlWriter = new XMLWriter(stringWriter, prettyPrintFormat);
try {
xmlWriter.write(doc... | [
"public",
"static",
"String",
"documentToPrettyString",
"(",
"Document",
"document",
")",
"{",
"StringWriter",
"stringWriter",
"=",
"new",
"StringWriter",
"(",
")",
";",
"OutputFormat",
"prettyPrintFormat",
"=",
"OutputFormat",
".",
"createPrettyPrint",
"(",
")",
";... | Returns the given document as a XML string in a "pretty" format.
@param document
@return the document as an XML string | [
"Returns",
"the",
"given",
"document",
"as",
"a",
"XML",
"string",
"in",
"a",
"pretty",
"format",
"."
] | train | https://github.com/craftercms/core/blob/d3ec74d669d3f8cfcf995177615d5f126edfa237/src/main/java/org/craftercms/core/util/XmlUtils.java#L129-L141 |
greatman/craftconomy3 | src/main/java/com/greatmancode/craftconomy3/converter/Converter.java | Converter.setDbInfo | public boolean setDbInfo(String field, String value) {
"""
Sets a field information for the selected database type
@param field The field name.
@param value The value of the field.
@return True if the field has been saved else false (A invalid field)
"""
boolean result = false;
if (dbInfo.... | java | public boolean setDbInfo(String field, String value) {
boolean result = false;
if (dbInfo.contains(field)) {
dbConnectInfo.put(field, value);
result = true;
}
return result;
} | [
"public",
"boolean",
"setDbInfo",
"(",
"String",
"field",
",",
"String",
"value",
")",
"{",
"boolean",
"result",
"=",
"false",
";",
"if",
"(",
"dbInfo",
".",
"contains",
"(",
"field",
")",
")",
"{",
"dbConnectInfo",
".",
"put",
"(",
"field",
",",
"valu... | Sets a field information for the selected database type
@param field The field name.
@param value The value of the field.
@return True if the field has been saved else false (A invalid field) | [
"Sets",
"a",
"field",
"information",
"for",
"the",
"selected",
"database",
"type"
] | train | https://github.com/greatman/craftconomy3/blob/51b1b3de7d039e20c7418d1e70b8c4b02b8cf840/src/main/java/com/greatmancode/craftconomy3/converter/Converter.java#L98-L105 |
sagiegurari/fax4j | src/main/java/org/fax4j/spi/windows/WindowsJNIFaxClientSpi.java | WindowsJNIFaxClientSpi.winSubmitFaxJob | private int winSubmitFaxJob(String serverName,String targetAddress,String targetName,String senderName,String fileName,String documentName) {
"""
This function will submit a new fax job.<br>
The fax job ID will be returned by this method.
@param serverName
The fax server name
@param targetAddress
The fa... | java | private int winSubmitFaxJob(String serverName,String targetAddress,String targetName,String senderName,String fileName,String documentName)
{
int faxJobID=0;
synchronized(WindowsFaxClientSpiHelper.NATIVE_LOCK)
{
//pre native call
this.preNativeCall();
... | [
"private",
"int",
"winSubmitFaxJob",
"(",
"String",
"serverName",
",",
"String",
"targetAddress",
",",
"String",
"targetName",
",",
"String",
"senderName",
",",
"String",
"fileName",
",",
"String",
"documentName",
")",
"{",
"int",
"faxJobID",
"=",
"0",
";",
"s... | This function will submit a new fax job.<br>
The fax job ID will be returned by this method.
@param serverName
The fax server name
@param targetAddress
The fax job target address
@param targetName
The fax job target name
@param senderName
The fax job sender name
@param fileName
The file to fax
@param docum... | [
"This",
"function",
"will",
"submit",
"a",
"new",
"fax",
"job",
".",
"<br",
">",
"The",
"fax",
"job",
"ID",
"will",
"be",
"returned",
"by",
"this",
"method",
"."
] | train | https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/spi/windows/WindowsJNIFaxClientSpi.java#L265-L278 |
lessthanoptimal/BoofCV | main/boofcv-recognition/src/main/java/boofcv/alg/tracker/meanshift/LocalWeightedHistogramRotRect.java | LocalWeightedHistogramRotRect.squareToImageSample | protected void squareToImageSample(float x, float y, RectangleRotate_F32 region) {
"""
Converts a point from square coordinates into image coordinates
"""
// -1 because it starts counting at 0. otherwise width+1 samples are made
x *= region.width-1;
y *= region.height-1;
imageX = x*c - y*s + region.c... | java | protected void squareToImageSample(float x, float y, RectangleRotate_F32 region) {
// -1 because it starts counting at 0. otherwise width+1 samples are made
x *= region.width-1;
y *= region.height-1;
imageX = x*c - y*s + region.cx;
imageY = x*s + y*c + region.cy;
} | [
"protected",
"void",
"squareToImageSample",
"(",
"float",
"x",
",",
"float",
"y",
",",
"RectangleRotate_F32",
"region",
")",
"{",
"// -1 because it starts counting at 0. otherwise width+1 samples are made",
"x",
"*=",
"region",
".",
"width",
"-",
"1",
";",
"y",
"*=",... | Converts a point from square coordinates into image coordinates | [
"Converts",
"a",
"point",
"from",
"square",
"coordinates",
"into",
"image",
"coordinates"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/tracker/meanshift/LocalWeightedHistogramRotRect.java#L246-L253 |
jmeetsma/Iglu-Util | src/main/java/org/ijsberg/iglu/util/time/SchedulingSupport.java | SchedulingSupport.getPreviousIntervalStart | public static long getPreviousIntervalStart(long time, int intervalInMinutes, int offsetInMinutes) {
"""
Determines the exact time an interval starts based on a time within the interval.
@param time time in millis
@param intervalInMinutes
@param offsetInMinutes
@return the exact time in milliseconds the inte... | java | public static long getPreviousIntervalStart(long time, int intervalInMinutes, int offsetInMinutes) {
long interval = MINUTE_IN_MS * intervalInMinutes;
long offset = calculateOffsetInMs(intervalInMinutes, offsetInMinutes);
return (interval * ((time + LOCAL_UTC_OFFSET - offset) / (interval))) + offset - LOCAL_UT... | [
"public",
"static",
"long",
"getPreviousIntervalStart",
"(",
"long",
"time",
",",
"int",
"intervalInMinutes",
",",
"int",
"offsetInMinutes",
")",
"{",
"long",
"interval",
"=",
"MINUTE_IN_MS",
"*",
"intervalInMinutes",
";",
"long",
"offset",
"=",
"calculateOffsetInMs... | Determines the exact time an interval starts based on a time within the interval.
@param time time in millis
@param intervalInMinutes
@param offsetInMinutes
@return the exact time in milliseconds the interval begins local time | [
"Determines",
"the",
"exact",
"time",
"an",
"interval",
"starts",
"based",
"on",
"a",
"time",
"within",
"the",
"interval",
".",
"@param",
"time",
"time",
"in",
"millis",
"@param",
"intervalInMinutes",
"@param",
"offsetInMinutes"
] | train | https://github.com/jmeetsma/Iglu-Util/blob/971eb022115247b1e34dc26dd02e7e621e29e910/src/main/java/org/ijsberg/iglu/util/time/SchedulingSupport.java#L86-L91 |
aws/aws-sdk-java | aws-java-sdk-health/src/main/java/com/amazonaws/services/health/model/EntityFilter.java | EntityFilter.withTags | public EntityFilter withTags(java.util.Map<String, String>... tags) {
"""
<p>
A map of entity tags attached to the affected entity.
</p>
<p>
<b>NOTE:</b> This method appends the values to the existing list (if any). Use
{@link #setTags(java.util.Collection)} or {@link #withTags(java.util.Collection)} if you w... | java | public EntityFilter withTags(java.util.Map<String, String>... tags) {
if (this.tags == null) {
setTags(new java.util.ArrayList<java.util.Map<String, String>>(tags.length));
}
for (java.util.Map<String, String> ele : tags) {
this.tags.add(ele);
}
return thi... | [
"public",
"EntityFilter",
"withTags",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"...",
"tags",
")",
"{",
"if",
"(",
"this",
".",
"tags",
"==",
"null",
")",
"{",
"setTags",
"(",
"new",
"java",
".",
"util",
".",
"ArrayL... | <p>
A map of entity tags attached to the affected entity.
</p>
<p>
<b>NOTE:</b> This method appends the values to the existing list (if any). Use
{@link #setTags(java.util.Collection)} or {@link #withTags(java.util.Collection)} if you want to override the
existing values.
</p>
@param tags
A map of entity tags attached... | [
"<p",
">",
"A",
"map",
"of",
"entity",
"tags",
"attached",
"to",
"the",
"affected",
"entity",
".",
"<",
"/",
"p",
">",
"<p",
">",
"<b",
">",
"NOTE",
":",
"<",
"/",
"b",
">",
"This",
"method",
"appends",
"the",
"values",
"to",
"the",
"existing",
"... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-health/src/main/java/com/amazonaws/services/health/model/EntityFilter.java#L402-L410 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/secstruc/SecStrucCalc.java | SecStrucCalc.shouldExtendLadder | private boolean shouldExtendLadder(Ladder ladder, BetaBridge b) {
"""
Conditions to extend a ladder with a given beta Bridge:
<li>The bridge and ladder are of the same type.
<li>The smallest bridge residue is sequential to the first
strand ladder.
<li>The second bridge residue is either sequential (parallel)
... | java | private boolean shouldExtendLadder(Ladder ladder, BetaBridge b) {
//Only extend if they are of the same type
boolean sameType = b.type.equals(ladder.btype);
if (!sameType) return false;
//Only extend if residue 1 is sequential to ladder strand
boolean sequential = (b.partner1 == ladder.to+1);
if (!sequent... | [
"private",
"boolean",
"shouldExtendLadder",
"(",
"Ladder",
"ladder",
",",
"BetaBridge",
"b",
")",
"{",
"//Only extend if they are of the same type",
"boolean",
"sameType",
"=",
"b",
".",
"type",
".",
"equals",
"(",
"ladder",
".",
"btype",
")",
";",
"if",
"(",
... | Conditions to extend a ladder with a given beta Bridge:
<li>The bridge and ladder are of the same type.
<li>The smallest bridge residue is sequential to the first
strand ladder.
<li>The second bridge residue is either sequential (parallel)
or previous (antiparallel) to the second strand of the ladder
</li>
@param ladde... | [
"Conditions",
"to",
"extend",
"a",
"ladder",
"with",
"a",
"given",
"beta",
"Bridge",
":",
"<li",
">",
"The",
"bridge",
"and",
"ladder",
"are",
"of",
"the",
"same",
"type",
".",
"<li",
">",
"The",
"smallest",
"bridge",
"residue",
"is",
"sequential",
"to",... | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/secstruc/SecStrucCalc.java#L382-L403 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/map/impl/LocalMapStatsUtil.java | LocalMapStatsUtil.incrementOtherOperationsCount | public static void incrementOtherOperationsCount(MapService service, String mapName) {
"""
Increments other operations count statistic in local map statistics.
@param service
@param mapName
"""
MapServiceContext mapServiceContext = service.getMapServiceContext();
MapContainer mapContainer = m... | java | public static void incrementOtherOperationsCount(MapService service, String mapName) {
MapServiceContext mapServiceContext = service.getMapServiceContext();
MapContainer mapContainer = mapServiceContext.getMapContainer(mapName);
if (mapContainer.getMapConfig().isStatisticsEnabled()) {
... | [
"public",
"static",
"void",
"incrementOtherOperationsCount",
"(",
"MapService",
"service",
",",
"String",
"mapName",
")",
"{",
"MapServiceContext",
"mapServiceContext",
"=",
"service",
".",
"getMapServiceContext",
"(",
")",
";",
"MapContainer",
"mapContainer",
"=",
"m... | Increments other operations count statistic in local map statistics.
@param service
@param mapName | [
"Increments",
"other",
"operations",
"count",
"statistic",
"in",
"local",
"map",
"statistics",
"."
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/map/impl/LocalMapStatsUtil.java#L35-L42 |
fuinorg/utils4j | src/main/java/org/fuin/utils4j/Utils4J.java | Utils4J.expectedCause | public static boolean expectedCause(final Exception actualException, final Collection<Class<? extends Exception>> expectedExceptions) {
"""
Verifies if the cause of an exception is of a given type.
@param actualException
Actual exception that was caused by something else - Cannot be <code>null</code>.
@param ... | java | public static boolean expectedCause(final Exception actualException, final Collection<Class<? extends Exception>> expectedExceptions) {
checkNotNull("actualException", actualException);
if (expectedExceptions == null || expectedExceptions.size() == 0) {
// All exceptions are expected
... | [
"public",
"static",
"boolean",
"expectedCause",
"(",
"final",
"Exception",
"actualException",
",",
"final",
"Collection",
"<",
"Class",
"<",
"?",
"extends",
"Exception",
">",
">",
"expectedExceptions",
")",
"{",
"checkNotNull",
"(",
"\"actualException\"",
",",
"ac... | Verifies if the cause of an exception is of a given type.
@param actualException
Actual exception that was caused by something else - Cannot be <code>null</code>.
@param expectedExceptions
Expected exceptions - May be <code>null</code> if any cause is expected.
@return TRUE if the actual exception is one of the expec... | [
"Verifies",
"if",
"the",
"cause",
"of",
"an",
"exception",
"is",
"of",
"a",
"given",
"type",
"."
] | train | https://github.com/fuinorg/utils4j/blob/71cf88e0a8d8ed67bbac513bf3cab165cd7e3280/src/main/java/org/fuin/utils4j/Utils4J.java#L1568-L1585 |
alkacon/opencms-core | src/org/opencms/gwt/CmsBrokenLinkRenderer.java | CmsBrokenLinkRenderer.createBrokenLinkBean | protected CmsBrokenLinkBean createBrokenLinkBean(
CmsUUID structureId,
String type,
String title,
String path,
String extraTitle,
String extraPath) {
"""
Creates a broken link bean from the necessary values.<p>
@param structureId the structure id of the reso... | java | protected CmsBrokenLinkBean createBrokenLinkBean(
CmsUUID structureId,
String type,
String title,
String path,
String extraTitle,
String extraPath) {
CmsBrokenLinkBean result = new CmsBrokenLinkBean(structureId, title, path, type);
addPageInfo(re... | [
"protected",
"CmsBrokenLinkBean",
"createBrokenLinkBean",
"(",
"CmsUUID",
"structureId",
",",
"String",
"type",
",",
"String",
"title",
",",
"String",
"path",
",",
"String",
"extraTitle",
",",
"String",
"extraPath",
")",
"{",
"CmsBrokenLinkBean",
"result",
"=",
"n... | Creates a broken link bean from the necessary values.<p>
@param structureId the structure id of the resource
@param type the resource type
@param title the title
@param path the path
@param extraTitle an optional additional page title
@param extraPath an optional additional page path
@return the created broken link b... | [
"Creates",
"a",
"broken",
"link",
"bean",
"from",
"the",
"necessary",
"values",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/gwt/CmsBrokenLinkRenderer.java#L249-L260 |
apiman/apiman | gateway/engine/core/src/main/java/io/apiman/gateway/engine/impl/InMemoryRegistry.java | InMemoryRegistry.getApiInternal | private Api getApiInternal(String apiOrgId, String apiId, String apiVersion) {
"""
Gets an API by its unique identifying info (orgid, id, version).
@param apiOrgId
@param apiId
@param apiVersion
@return an Api or null if not found
"""
String key = getApiIndex(apiOrgId, apiId, apiVersion);
A... | java | private Api getApiInternal(String apiOrgId, String apiId, String apiVersion) {
String key = getApiIndex(apiOrgId, apiId, apiVersion);
Api api;
synchronized (mutex) {
api = (Api) getMap().get(key);
}
return api;
} | [
"private",
"Api",
"getApiInternal",
"(",
"String",
"apiOrgId",
",",
"String",
"apiId",
",",
"String",
"apiVersion",
")",
"{",
"String",
"key",
"=",
"getApiIndex",
"(",
"apiOrgId",
",",
"apiId",
",",
"apiVersion",
")",
";",
"Api",
"api",
";",
"synchronized",
... | Gets an API by its unique identifying info (orgid, id, version).
@param apiOrgId
@param apiId
@param apiVersion
@return an Api or null if not found | [
"Gets",
"an",
"API",
"by",
"its",
"unique",
"identifying",
"info",
"(",
"orgid",
"id",
"version",
")",
"."
] | train | https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/gateway/engine/core/src/main/java/io/apiman/gateway/engine/impl/InMemoryRegistry.java#L312-L319 |
iron-io/iron_mq_java | src/main/java/io/iron/ironmq/Queue.java | Queue.touchMessage | public MessageOptions touchMessage(Message message, Long timeout) throws IOException {
"""
Touching a reserved message extends its timeout to the duration specified when the message was created.
@param message The message to delete.
@param timeout After timeout (in seconds), item will be placed back onto queue... | java | public MessageOptions touchMessage(Message message, Long timeout) throws IOException {
MessageOptions messageOptions = touchMessage(message.getId(), message.getReservationId(), timeout);
message.setReservationId(messageOptions.getReservationId());
return messageOptions;
} | [
"public",
"MessageOptions",
"touchMessage",
"(",
"Message",
"message",
",",
"Long",
"timeout",
")",
"throws",
"IOException",
"{",
"MessageOptions",
"messageOptions",
"=",
"touchMessage",
"(",
"message",
".",
"getId",
"(",
")",
",",
"message",
".",
"getReservationI... | Touching a reserved message extends its timeout to the duration specified when the message was created.
@param message The message to delete.
@param timeout After timeout (in seconds), item will be placed back onto queue.
@throws io.iron.ironmq.HTTPException If the IronMQ service returns a status other than 200 OK.
@... | [
"Touching",
"a",
"reserved",
"message",
"extends",
"its",
"timeout",
"to",
"the",
"duration",
"specified",
"when",
"the",
"message",
"was",
"created",
"."
] | train | https://github.com/iron-io/iron_mq_java/blob/62d6a86545ca7ef31b7b4797aae0c5b31394a507/src/main/java/io/iron/ironmq/Queue.java#L207-L211 |
restfb/restfb | src/main/java/com/restfb/DefaultJsonMapper.java | DefaultJsonMapper.facebookFieldNamesWithMultipleMappings | protected Set<String> facebookFieldNamesWithMultipleMappings(
List<FieldWithAnnotation<Facebook>> fieldsWithAnnotation) {
"""
Finds any Facebook JSON fields that are mapped to more than 1 Java field.
@param fieldsWithAnnotation
Java fields annotated with the {@code Facebook} annotation.
@return Any Face... | java | protected Set<String> facebookFieldNamesWithMultipleMappings(
List<FieldWithAnnotation<Facebook>> fieldsWithAnnotation) {
Map<String, Integer> facebookFieldsNamesWithOccurrenceCount = new HashMap<>();
Set<String> facebookFieldNamesWithMultipleMappings = new HashSet<>();
// Get a count of Facebook fie... | [
"protected",
"Set",
"<",
"String",
">",
"facebookFieldNamesWithMultipleMappings",
"(",
"List",
"<",
"FieldWithAnnotation",
"<",
"Facebook",
">",
">",
"fieldsWithAnnotation",
")",
"{",
"Map",
"<",
"String",
",",
"Integer",
">",
"facebookFieldsNamesWithOccurrenceCount",
... | Finds any Facebook JSON fields that are mapped to more than 1 Java field.
@param fieldsWithAnnotation
Java fields annotated with the {@code Facebook} annotation.
@return Any Facebook JSON fields that are mapped to more than 1 Java field. | [
"Finds",
"any",
"Facebook",
"JSON",
"fields",
"that",
"are",
"mapped",
"to",
"more",
"than",
"1",
"Java",
"field",
"."
] | train | https://github.com/restfb/restfb/blob/fb77ba5486d1339e7deb81b9830670fa209b1047/src/main/java/com/restfb/DefaultJsonMapper.java#L343-L366 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.