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
|
---|---|---|---|---|---|---|---|---|---|---|
iipc/webarchive-commons
|
src/main/java/org/archive/net/PublicSuffixes.java
|
PublicSuffixes.surtPrefixRegexFromTrie
|
private static String surtPrefixRegexFromTrie(Node trie) {
"""
Converts SURT-ordered list of public prefixes into a Java regex which
matches the public-portion "plus one" segment, giving the domain on which
cookies can be set or other policy grouping should occur. Also adds to
regex a fallback matcher that for any new/unknown TLDs assumes the
second-level domain is assignable. (Eg: 'zzz,example,').
@param list
@return
"""
StringBuilder regex = new StringBuilder();
regex.append("(?ix)^\n");
trie.addBranch("*,"); // for new/unknown TLDs
buildRegex(trie, regex);
regex.append("\n([-\\w]+,)");
return regex.toString();
}
|
java
|
private static String surtPrefixRegexFromTrie(Node trie) {
StringBuilder regex = new StringBuilder();
regex.append("(?ix)^\n");
trie.addBranch("*,"); // for new/unknown TLDs
buildRegex(trie, regex);
regex.append("\n([-\\w]+,)");
return regex.toString();
}
|
[
"private",
"static",
"String",
"surtPrefixRegexFromTrie",
"(",
"Node",
"trie",
")",
"{",
"StringBuilder",
"regex",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"regex",
".",
"append",
"(",
"\"(?ix)^\\n\"",
")",
";",
"trie",
".",
"addBranch",
"(",
"\"*,\"",
")",
";",
"// for new/unknown TLDs",
"buildRegex",
"(",
"trie",
",",
"regex",
")",
";",
"regex",
".",
"append",
"(",
"\"\\n([-\\\\w]+,)\"",
")",
";",
"return",
"regex",
".",
"toString",
"(",
")",
";",
"}"
] |
Converts SURT-ordered list of public prefixes into a Java regex which
matches the public-portion "plus one" segment, giving the domain on which
cookies can be set or other policy grouping should occur. Also adds to
regex a fallback matcher that for any new/unknown TLDs assumes the
second-level domain is assignable. (Eg: 'zzz,example,').
@param list
@return
|
[
"Converts",
"SURT",
"-",
"ordered",
"list",
"of",
"public",
"prefixes",
"into",
"a",
"Java",
"regex",
"which",
"matches",
"the",
"public",
"-",
"portion",
"plus",
"one",
"segment",
"giving",
"the",
"domain",
"on",
"which",
"cookies",
"can",
"be",
"set",
"or",
"other",
"policy",
"grouping",
"should",
"occur",
".",
"Also",
"adds",
"to",
"regex",
"a",
"fallback",
"matcher",
"that",
"for",
"any",
"new",
"/",
"unknown",
"TLDs",
"assumes",
"the",
"second",
"-",
"level",
"domain",
"is",
"assignable",
".",
"(",
"Eg",
":",
"zzz",
"example",
")",
"."
] |
train
|
https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/net/PublicSuffixes.java#L302-L309
|
couchbase/couchbase-java-client
|
src/main/java/com/couchbase/client/java/query/dsl/functions/PatternMatchingFunctions.java
|
PatternMatchingFunctions.regexpContains
|
public static Expression regexpContains(Expression expression, String pattern) {
"""
Returned expression results in True if the string value contains the regular expression pattern.
"""
return x("REGEXP_CONTAINS(" + expression.toString() + ", \"" + pattern + "\")");
}
|
java
|
public static Expression regexpContains(Expression expression, String pattern) {
return x("REGEXP_CONTAINS(" + expression.toString() + ", \"" + pattern + "\")");
}
|
[
"public",
"static",
"Expression",
"regexpContains",
"(",
"Expression",
"expression",
",",
"String",
"pattern",
")",
"{",
"return",
"x",
"(",
"\"REGEXP_CONTAINS(\"",
"+",
"expression",
".",
"toString",
"(",
")",
"+",
"\", \\\"\"",
"+",
"pattern",
"+",
"\"\\\")\"",
")",
";",
"}"
] |
Returned expression results in True if the string value contains the regular expression pattern.
|
[
"Returned",
"expression",
"results",
"in",
"True",
"if",
"the",
"string",
"value",
"contains",
"the",
"regular",
"expression",
"pattern",
"."
] |
train
|
https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/functions/PatternMatchingFunctions.java#L42-L44
|
zaproxy/zaproxy
|
src/org/parosproxy/paros/extension/manualrequest/http/impl/HttpPanelSender.java
|
HttpPanelSender.notifyPersistentConnectionListener
|
private boolean notifyPersistentConnectionListener(HttpMessage httpMessage, Socket inSocket, ZapGetMethod method) {
"""
Go thru each listener and offer him to take over the connection. The
first observer that returns true gets exclusive rights.
@param httpMessage Contains HTTP request & response.
@param inSocket Encapsulates the TCP connection to the browser.
@param method Provides more power to process response.
@return Boolean to indicate if socket should be kept open.
"""
boolean keepSocketOpen = false;
PersistentConnectionListener listener = null;
synchronized (persistentConnectionListener) {
for (int i = 0; i < persistentConnectionListener.size(); i++) {
listener = persistentConnectionListener.get(i);
try {
if (listener.onHandshakeResponse(httpMessage, inSocket, method)) {
// inform as long as one listener wishes to overtake the connection
keepSocketOpen = true;
break;
}
} catch (Exception e) {
logger.warn(e.getMessage(), e);
}
}
}
return keepSocketOpen;
}
|
java
|
private boolean notifyPersistentConnectionListener(HttpMessage httpMessage, Socket inSocket, ZapGetMethod method) {
boolean keepSocketOpen = false;
PersistentConnectionListener listener = null;
synchronized (persistentConnectionListener) {
for (int i = 0; i < persistentConnectionListener.size(); i++) {
listener = persistentConnectionListener.get(i);
try {
if (listener.onHandshakeResponse(httpMessage, inSocket, method)) {
// inform as long as one listener wishes to overtake the connection
keepSocketOpen = true;
break;
}
} catch (Exception e) {
logger.warn(e.getMessage(), e);
}
}
}
return keepSocketOpen;
}
|
[
"private",
"boolean",
"notifyPersistentConnectionListener",
"(",
"HttpMessage",
"httpMessage",
",",
"Socket",
"inSocket",
",",
"ZapGetMethod",
"method",
")",
"{",
"boolean",
"keepSocketOpen",
"=",
"false",
";",
"PersistentConnectionListener",
"listener",
"=",
"null",
";",
"synchronized",
"(",
"persistentConnectionListener",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"persistentConnectionListener",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"listener",
"=",
"persistentConnectionListener",
".",
"get",
"(",
"i",
")",
";",
"try",
"{",
"if",
"(",
"listener",
".",
"onHandshakeResponse",
"(",
"httpMessage",
",",
"inSocket",
",",
"method",
")",
")",
"{",
"// inform as long as one listener wishes to overtake the connection\r",
"keepSocketOpen",
"=",
"true",
";",
"break",
";",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"logger",
".",
"warn",
"(",
"e",
".",
"getMessage",
"(",
")",
",",
"e",
")",
";",
"}",
"}",
"}",
"return",
"keepSocketOpen",
";",
"}"
] |
Go thru each listener and offer him to take over the connection. The
first observer that returns true gets exclusive rights.
@param httpMessage Contains HTTP request & response.
@param inSocket Encapsulates the TCP connection to the browser.
@param method Provides more power to process response.
@return Boolean to indicate if socket should be kept open.
|
[
"Go",
"thru",
"each",
"listener",
"and",
"offer",
"him",
"to",
"take",
"over",
"the",
"connection",
".",
"The",
"first",
"observer",
"that",
"returns",
"true",
"gets",
"exclusive",
"rights",
"."
] |
train
|
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/parosproxy/paros/extension/manualrequest/http/impl/HttpPanelSender.java#L172-L191
|
VoltDB/voltdb
|
src/frontend/org/voltdb/jdbc/JDBC4DatabaseMetaData.java
|
JDBC4DatabaseMetaData.getImportedKeys
|
@Override
public ResultSet getImportedKeys(String catalog, String schema, String table) throws SQLException {
"""
Retrieves a description of the primary key columns that are referenced by the given table's foreign key columns (the primary keys imported by a table) throws SQLException.
"""
checkClosed();
VoltTable vtable = new VoltTable(
new ColumnInfo("PKTABLE_CAT", VoltType.STRING),
new ColumnInfo("PKTABLE_SCHEM", VoltType.STRING),
new ColumnInfo("PKTABLE_NAME", VoltType.STRING),
new ColumnInfo("PKCOLUMN_NAME", VoltType.STRING),
new ColumnInfo("FKTABLE_CAT", VoltType.STRING),
new ColumnInfo("FKTABLE_SCHEM", VoltType.STRING),
new ColumnInfo("FKTABLE_NAME", VoltType.STRING),
new ColumnInfo("FKCOLUMN_NAME", VoltType.STRING),
new ColumnInfo("KEY_SEQ", VoltType.SMALLINT),
new ColumnInfo("UPDATE_RULE", VoltType.SMALLINT),
new ColumnInfo("DELETE_RULE", VoltType.SMALLINT),
new ColumnInfo("FK_NAME", VoltType.STRING),
new ColumnInfo("PK_NAME", VoltType.STRING),
new ColumnInfo("DEFERRABILITY", VoltType.SMALLINT)
);
//NB: @SystemCatalog(?) will need additional support if we want to
// populate the table.
JDBC4ResultSet res = new JDBC4ResultSet(this.sysCatalog, vtable);
return res;
}
|
java
|
@Override
public ResultSet getImportedKeys(String catalog, String schema, String table) throws SQLException
{
checkClosed();
VoltTable vtable = new VoltTable(
new ColumnInfo("PKTABLE_CAT", VoltType.STRING),
new ColumnInfo("PKTABLE_SCHEM", VoltType.STRING),
new ColumnInfo("PKTABLE_NAME", VoltType.STRING),
new ColumnInfo("PKCOLUMN_NAME", VoltType.STRING),
new ColumnInfo("FKTABLE_CAT", VoltType.STRING),
new ColumnInfo("FKTABLE_SCHEM", VoltType.STRING),
new ColumnInfo("FKTABLE_NAME", VoltType.STRING),
new ColumnInfo("FKCOLUMN_NAME", VoltType.STRING),
new ColumnInfo("KEY_SEQ", VoltType.SMALLINT),
new ColumnInfo("UPDATE_RULE", VoltType.SMALLINT),
new ColumnInfo("DELETE_RULE", VoltType.SMALLINT),
new ColumnInfo("FK_NAME", VoltType.STRING),
new ColumnInfo("PK_NAME", VoltType.STRING),
new ColumnInfo("DEFERRABILITY", VoltType.SMALLINT)
);
//NB: @SystemCatalog(?) will need additional support if we want to
// populate the table.
JDBC4ResultSet res = new JDBC4ResultSet(this.sysCatalog, vtable);
return res;
}
|
[
"@",
"Override",
"public",
"ResultSet",
"getImportedKeys",
"(",
"String",
"catalog",
",",
"String",
"schema",
",",
"String",
"table",
")",
"throws",
"SQLException",
"{",
"checkClosed",
"(",
")",
";",
"VoltTable",
"vtable",
"=",
"new",
"VoltTable",
"(",
"new",
"ColumnInfo",
"(",
"\"PKTABLE_CAT\"",
",",
"VoltType",
".",
"STRING",
")",
",",
"new",
"ColumnInfo",
"(",
"\"PKTABLE_SCHEM\"",
",",
"VoltType",
".",
"STRING",
")",
",",
"new",
"ColumnInfo",
"(",
"\"PKTABLE_NAME\"",
",",
"VoltType",
".",
"STRING",
")",
",",
"new",
"ColumnInfo",
"(",
"\"PKCOLUMN_NAME\"",
",",
"VoltType",
".",
"STRING",
")",
",",
"new",
"ColumnInfo",
"(",
"\"FKTABLE_CAT\"",
",",
"VoltType",
".",
"STRING",
")",
",",
"new",
"ColumnInfo",
"(",
"\"FKTABLE_SCHEM\"",
",",
"VoltType",
".",
"STRING",
")",
",",
"new",
"ColumnInfo",
"(",
"\"FKTABLE_NAME\"",
",",
"VoltType",
".",
"STRING",
")",
",",
"new",
"ColumnInfo",
"(",
"\"FKCOLUMN_NAME\"",
",",
"VoltType",
".",
"STRING",
")",
",",
"new",
"ColumnInfo",
"(",
"\"KEY_SEQ\"",
",",
"VoltType",
".",
"SMALLINT",
")",
",",
"new",
"ColumnInfo",
"(",
"\"UPDATE_RULE\"",
",",
"VoltType",
".",
"SMALLINT",
")",
",",
"new",
"ColumnInfo",
"(",
"\"DELETE_RULE\"",
",",
"VoltType",
".",
"SMALLINT",
")",
",",
"new",
"ColumnInfo",
"(",
"\"FK_NAME\"",
",",
"VoltType",
".",
"STRING",
")",
",",
"new",
"ColumnInfo",
"(",
"\"PK_NAME\"",
",",
"VoltType",
".",
"STRING",
")",
",",
"new",
"ColumnInfo",
"(",
"\"DEFERRABILITY\"",
",",
"VoltType",
".",
"SMALLINT",
")",
")",
";",
"//NB: @SystemCatalog(?) will need additional support if we want to",
"// populate the table.",
"JDBC4ResultSet",
"res",
"=",
"new",
"JDBC4ResultSet",
"(",
"this",
".",
"sysCatalog",
",",
"vtable",
")",
";",
"return",
"res",
";",
"}"
] |
Retrieves a description of the primary key columns that are referenced by the given table's foreign key columns (the primary keys imported by a table) throws SQLException.
|
[
"Retrieves",
"a",
"description",
"of",
"the",
"primary",
"key",
"columns",
"that",
"are",
"referenced",
"by",
"the",
"given",
"table",
"s",
"foreign",
"key",
"columns",
"(",
"the",
"primary",
"keys",
"imported",
"by",
"a",
"table",
")",
"throws",
"SQLException",
"."
] |
train
|
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/jdbc/JDBC4DatabaseMetaData.java#L386-L410
|
apereo/cas
|
support/cas-server-support-openid/src/main/java/org/apereo/cas/support/openid/authentication/principal/OpenIdServiceResponseBuilder.java
|
OpenIdServiceResponseBuilder.build
|
@Override
public Response build(final WebApplicationService webApplicationService, final String ticketId, final Authentication authentication) {
"""
Generates an Openid response.
If no ticketId is found, response is negative.
If we have a ticket id, then we check if we have an association.
If so, we ask OpenId server manager to generate the answer according with the existing association.
If not, we send back an answer with the ticket id as association handle.
This will force the consumer to ask a verification, which will validate the service ticket.
@param ticketId the service ticket to provide to the service.
@param webApplicationService the service requesting an openid response
@return the generated authentication answer
"""
val service = (OpenIdService) webApplicationService;
val parameterList = new ParameterList(HttpRequestUtils.getHttpServletRequestFromRequestAttributes().getParameterMap());
val parameters = new HashMap<String, String>();
if (StringUtils.isBlank(ticketId)) {
parameters.put(OpenIdProtocolConstants.OPENID_MODE, OpenIdProtocolConstants.CANCEL);
return buildRedirect(service, parameters);
}
val association = getAssociation(serverManager, parameterList);
val associated = association != null;
val associationValid = isAssociationValid(association);
var successFullAuthentication = true;
var assertion = (Assertion) null;
try {
if (associated && associationValid) {
assertion = centralAuthenticationService.validateServiceTicket(ticketId, service);
LOGGER.debug("Validated openid ticket [{}] for [{}]", ticketId, service);
} else if (!associated) {
LOGGER.debug("Responding to non-associated mode. Service ticket [{}] must be validated by the RP", ticketId);
} else {
LOGGER.warn("Association does not exist or is not valid");
successFullAuthentication = false;
}
} catch (final AbstractTicketException e) {
LOGGER.error("Could not validate ticket : [{}]", e.getMessage(), e);
successFullAuthentication = false;
}
val id = determineIdentity(service, assertion);
return buildAuthenticationResponse(service, parameters, successFullAuthentication, id, parameterList);
}
|
java
|
@Override
public Response build(final WebApplicationService webApplicationService, final String ticketId, final Authentication authentication) {
val service = (OpenIdService) webApplicationService;
val parameterList = new ParameterList(HttpRequestUtils.getHttpServletRequestFromRequestAttributes().getParameterMap());
val parameters = new HashMap<String, String>();
if (StringUtils.isBlank(ticketId)) {
parameters.put(OpenIdProtocolConstants.OPENID_MODE, OpenIdProtocolConstants.CANCEL);
return buildRedirect(service, parameters);
}
val association = getAssociation(serverManager, parameterList);
val associated = association != null;
val associationValid = isAssociationValid(association);
var successFullAuthentication = true;
var assertion = (Assertion) null;
try {
if (associated && associationValid) {
assertion = centralAuthenticationService.validateServiceTicket(ticketId, service);
LOGGER.debug("Validated openid ticket [{}] for [{}]", ticketId, service);
} else if (!associated) {
LOGGER.debug("Responding to non-associated mode. Service ticket [{}] must be validated by the RP", ticketId);
} else {
LOGGER.warn("Association does not exist or is not valid");
successFullAuthentication = false;
}
} catch (final AbstractTicketException e) {
LOGGER.error("Could not validate ticket : [{}]", e.getMessage(), e);
successFullAuthentication = false;
}
val id = determineIdentity(service, assertion);
return buildAuthenticationResponse(service, parameters, successFullAuthentication, id, parameterList);
}
|
[
"@",
"Override",
"public",
"Response",
"build",
"(",
"final",
"WebApplicationService",
"webApplicationService",
",",
"final",
"String",
"ticketId",
",",
"final",
"Authentication",
"authentication",
")",
"{",
"val",
"service",
"=",
"(",
"OpenIdService",
")",
"webApplicationService",
";",
"val",
"parameterList",
"=",
"new",
"ParameterList",
"(",
"HttpRequestUtils",
".",
"getHttpServletRequestFromRequestAttributes",
"(",
")",
".",
"getParameterMap",
"(",
")",
")",
";",
"val",
"parameters",
"=",
"new",
"HashMap",
"<",
"String",
",",
"String",
">",
"(",
")",
";",
"if",
"(",
"StringUtils",
".",
"isBlank",
"(",
"ticketId",
")",
")",
"{",
"parameters",
".",
"put",
"(",
"OpenIdProtocolConstants",
".",
"OPENID_MODE",
",",
"OpenIdProtocolConstants",
".",
"CANCEL",
")",
";",
"return",
"buildRedirect",
"(",
"service",
",",
"parameters",
")",
";",
"}",
"val",
"association",
"=",
"getAssociation",
"(",
"serverManager",
",",
"parameterList",
")",
";",
"val",
"associated",
"=",
"association",
"!=",
"null",
";",
"val",
"associationValid",
"=",
"isAssociationValid",
"(",
"association",
")",
";",
"var",
"successFullAuthentication",
"=",
"true",
";",
"var",
"assertion",
"=",
"(",
"Assertion",
")",
"null",
";",
"try",
"{",
"if",
"(",
"associated",
"&&",
"associationValid",
")",
"{",
"assertion",
"=",
"centralAuthenticationService",
".",
"validateServiceTicket",
"(",
"ticketId",
",",
"service",
")",
";",
"LOGGER",
".",
"debug",
"(",
"\"Validated openid ticket [{}] for [{}]\"",
",",
"ticketId",
",",
"service",
")",
";",
"}",
"else",
"if",
"(",
"!",
"associated",
")",
"{",
"LOGGER",
".",
"debug",
"(",
"\"Responding to non-associated mode. Service ticket [{}] must be validated by the RP\"",
",",
"ticketId",
")",
";",
"}",
"else",
"{",
"LOGGER",
".",
"warn",
"(",
"\"Association does not exist or is not valid\"",
")",
";",
"successFullAuthentication",
"=",
"false",
";",
"}",
"}",
"catch",
"(",
"final",
"AbstractTicketException",
"e",
")",
"{",
"LOGGER",
".",
"error",
"(",
"\"Could not validate ticket : [{}]\"",
",",
"e",
".",
"getMessage",
"(",
")",
",",
"e",
")",
";",
"successFullAuthentication",
"=",
"false",
";",
"}",
"val",
"id",
"=",
"determineIdentity",
"(",
"service",
",",
"assertion",
")",
";",
"return",
"buildAuthenticationResponse",
"(",
"service",
",",
"parameters",
",",
"successFullAuthentication",
",",
"id",
",",
"parameterList",
")",
";",
"}"
] |
Generates an Openid response.
If no ticketId is found, response is negative.
If we have a ticket id, then we check if we have an association.
If so, we ask OpenId server manager to generate the answer according with the existing association.
If not, we send back an answer with the ticket id as association handle.
This will force the consumer to ask a verification, which will validate the service ticket.
@param ticketId the service ticket to provide to the service.
@param webApplicationService the service requesting an openid response
@return the generated authentication answer
|
[
"Generates",
"an",
"Openid",
"response",
".",
"If",
"no",
"ticketId",
"is",
"found",
"response",
"is",
"negative",
".",
"If",
"we",
"have",
"a",
"ticket",
"id",
"then",
"we",
"check",
"if",
"we",
"have",
"an",
"association",
".",
"If",
"so",
"we",
"ask",
"OpenId",
"server",
"manager",
"to",
"generate",
"the",
"answer",
"according",
"with",
"the",
"existing",
"association",
".",
"If",
"not",
"we",
"send",
"back",
"an",
"answer",
"with",
"the",
"ticket",
"id",
"as",
"association",
"handle",
".",
"This",
"will",
"force",
"the",
"consumer",
"to",
"ask",
"a",
"verification",
"which",
"will",
"validate",
"the",
"service",
"ticket",
"."
] |
train
|
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-openid/src/main/java/org/apereo/cas/support/openid/authentication/principal/OpenIdServiceResponseBuilder.java#L64-L99
|
gallandarakhneorg/afc
|
advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GISCoordinates.java
|
GISCoordinates.WSG84_EL2
|
@Pure
public static Point2d WSG84_EL2(double lambda, double phi) {
"""
This function convert WSG84 GPS coordinate to extended France Lambert II coordinate.
@param lambda in degrees.
@param phi in degrees.
@return the extended France Lambert II coordinates.
"""
final Point2d ntfLambdaPhi = WSG84_NTFLamdaPhi(lambda, phi);
return NTFLambdaPhi_NTFLambert(
ntfLambdaPhi.getX(), ntfLambdaPhi.getY(),
LAMBERT_2E_N,
LAMBERT_2E_C,
LAMBERT_2E_XS,
LAMBERT_2E_YS);
}
|
java
|
@Pure
public static Point2d WSG84_EL2(double lambda, double phi) {
final Point2d ntfLambdaPhi = WSG84_NTFLamdaPhi(lambda, phi);
return NTFLambdaPhi_NTFLambert(
ntfLambdaPhi.getX(), ntfLambdaPhi.getY(),
LAMBERT_2E_N,
LAMBERT_2E_C,
LAMBERT_2E_XS,
LAMBERT_2E_YS);
}
|
[
"@",
"Pure",
"public",
"static",
"Point2d",
"WSG84_EL2",
"(",
"double",
"lambda",
",",
"double",
"phi",
")",
"{",
"final",
"Point2d",
"ntfLambdaPhi",
"=",
"WSG84_NTFLamdaPhi",
"(",
"lambda",
",",
"phi",
")",
";",
"return",
"NTFLambdaPhi_NTFLambert",
"(",
"ntfLambdaPhi",
".",
"getX",
"(",
")",
",",
"ntfLambdaPhi",
".",
"getY",
"(",
")",
",",
"LAMBERT_2E_N",
",",
"LAMBERT_2E_C",
",",
"LAMBERT_2E_XS",
",",
"LAMBERT_2E_YS",
")",
";",
"}"
] |
This function convert WSG84 GPS coordinate to extended France Lambert II coordinate.
@param lambda in degrees.
@param phi in degrees.
@return the extended France Lambert II coordinates.
|
[
"This",
"function",
"convert",
"WSG84",
"GPS",
"coordinate",
"to",
"extended",
"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#L1043-L1052
|
spotbugs/spotbugs
|
spotbugs/src/main/java/edu/umd/cs/findbugs/SourceLineAnnotation.java
|
SourceLineAnnotation.fromVisitedInstructionRange
|
public static SourceLineAnnotation fromVisitedInstructionRange(ClassContext classContext, MethodGen methodGen,
String sourceFile, InstructionHandle start, InstructionHandle end) {
"""
Factory method for creating a source line annotation describing the
source line numbers for a range of instruction in a method.
@param classContext
theClassContext
@param methodGen
the method
@param start
the start instruction
@param end
the end instruction (inclusive)
"""
LineNumberTable lineNumberTable = methodGen.getLineNumberTable(methodGen.getConstantPool());
String className = methodGen.getClassName();
if (lineNumberTable == null) {
return createUnknown(className, sourceFile, start.getPosition(), end.getPosition());
}
int startLine = lineNumberTable.getSourceLine(start.getPosition());
int endLine = lineNumberTable.getSourceLine(end.getPosition());
return new SourceLineAnnotation(className, sourceFile, startLine, endLine, start.getPosition(), end.getPosition());
}
|
java
|
public static SourceLineAnnotation fromVisitedInstructionRange(ClassContext classContext, MethodGen methodGen,
String sourceFile, InstructionHandle start, InstructionHandle end) {
LineNumberTable lineNumberTable = methodGen.getLineNumberTable(methodGen.getConstantPool());
String className = methodGen.getClassName();
if (lineNumberTable == null) {
return createUnknown(className, sourceFile, start.getPosition(), end.getPosition());
}
int startLine = lineNumberTable.getSourceLine(start.getPosition());
int endLine = lineNumberTable.getSourceLine(end.getPosition());
return new SourceLineAnnotation(className, sourceFile, startLine, endLine, start.getPosition(), end.getPosition());
}
|
[
"public",
"static",
"SourceLineAnnotation",
"fromVisitedInstructionRange",
"(",
"ClassContext",
"classContext",
",",
"MethodGen",
"methodGen",
",",
"String",
"sourceFile",
",",
"InstructionHandle",
"start",
",",
"InstructionHandle",
"end",
")",
"{",
"LineNumberTable",
"lineNumberTable",
"=",
"methodGen",
".",
"getLineNumberTable",
"(",
"methodGen",
".",
"getConstantPool",
"(",
")",
")",
";",
"String",
"className",
"=",
"methodGen",
".",
"getClassName",
"(",
")",
";",
"if",
"(",
"lineNumberTable",
"==",
"null",
")",
"{",
"return",
"createUnknown",
"(",
"className",
",",
"sourceFile",
",",
"start",
".",
"getPosition",
"(",
")",
",",
"end",
".",
"getPosition",
"(",
")",
")",
";",
"}",
"int",
"startLine",
"=",
"lineNumberTable",
".",
"getSourceLine",
"(",
"start",
".",
"getPosition",
"(",
")",
")",
";",
"int",
"endLine",
"=",
"lineNumberTable",
".",
"getSourceLine",
"(",
"end",
".",
"getPosition",
"(",
")",
")",
";",
"return",
"new",
"SourceLineAnnotation",
"(",
"className",
",",
"sourceFile",
",",
"startLine",
",",
"endLine",
",",
"start",
".",
"getPosition",
"(",
")",
",",
"end",
".",
"getPosition",
"(",
")",
")",
";",
"}"
] |
Factory method for creating a source line annotation describing the
source line numbers for a range of instruction in a method.
@param classContext
theClassContext
@param methodGen
the method
@param start
the start instruction
@param end
the end instruction (inclusive)
|
[
"Factory",
"method",
"for",
"creating",
"a",
"source",
"line",
"annotation",
"describing",
"the",
"source",
"line",
"numbers",
"for",
"a",
"range",
"of",
"instruction",
"in",
"a",
"method",
"."
] |
train
|
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/SourceLineAnnotation.java#L607-L619
|
GeoLatte/geolatte-common
|
src/main/java/org/geolatte/common/dataformats/json/jackson/GeometryDeserializer.java
|
GeometryDeserializer.asPolygon
|
private Polygon asPolygon(List<List<List>> coords, CrsId crsId) throws IOException {
"""
Parses the JSON as a polygon geometry
@param coords the coordinate array corresponding with the polygon (a list containing rings, each of which
contains a list of coordinates (which in turn are lists of numbers)).
@param crsId
@return An instance of polygon
@throws IOException if the given json does not correspond to a polygon or can be parsed as such.
"""
if (coords == null || coords.isEmpty()) {
throw new IOException("A polygon requires the specification of its outer ring");
}
List<LinearRing> rings = new ArrayList<LinearRing>();
try {
for (List<List> ring : coords) {
PointSequence ringCoords = getPointSequence(ring, crsId);
rings.add(new LinearRing(ringCoords));
}
return new Polygon(rings.toArray(new LinearRing[]{}));
} catch (IllegalArgumentException e) {
throw new IOException("Invalid Polygon: " + e.getMessage(), e);
}
}
|
java
|
private Polygon asPolygon(List<List<List>> coords, CrsId crsId) throws IOException {
if (coords == null || coords.isEmpty()) {
throw new IOException("A polygon requires the specification of its outer ring");
}
List<LinearRing> rings = new ArrayList<LinearRing>();
try {
for (List<List> ring : coords) {
PointSequence ringCoords = getPointSequence(ring, crsId);
rings.add(new LinearRing(ringCoords));
}
return new Polygon(rings.toArray(new LinearRing[]{}));
} catch (IllegalArgumentException e) {
throw new IOException("Invalid Polygon: " + e.getMessage(), e);
}
}
|
[
"private",
"Polygon",
"asPolygon",
"(",
"List",
"<",
"List",
"<",
"List",
">",
">",
"coords",
",",
"CrsId",
"crsId",
")",
"throws",
"IOException",
"{",
"if",
"(",
"coords",
"==",
"null",
"||",
"coords",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"A polygon requires the specification of its outer ring\"",
")",
";",
"}",
"List",
"<",
"LinearRing",
">",
"rings",
"=",
"new",
"ArrayList",
"<",
"LinearRing",
">",
"(",
")",
";",
"try",
"{",
"for",
"(",
"List",
"<",
"List",
">",
"ring",
":",
"coords",
")",
"{",
"PointSequence",
"ringCoords",
"=",
"getPointSequence",
"(",
"ring",
",",
"crsId",
")",
";",
"rings",
".",
"add",
"(",
"new",
"LinearRing",
"(",
"ringCoords",
")",
")",
";",
"}",
"return",
"new",
"Polygon",
"(",
"rings",
".",
"toArray",
"(",
"new",
"LinearRing",
"[",
"]",
"{",
"}",
")",
")",
";",
"}",
"catch",
"(",
"IllegalArgumentException",
"e",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"Invalid Polygon: \"",
"+",
"e",
".",
"getMessage",
"(",
")",
",",
"e",
")",
";",
"}",
"}"
] |
Parses the JSON as a polygon geometry
@param coords the coordinate array corresponding with the polygon (a list containing rings, each of which
contains a list of coordinates (which in turn are lists of numbers)).
@param crsId
@return An instance of polygon
@throws IOException if the given json does not correspond to a polygon or can be parsed as such.
|
[
"Parses",
"the",
"JSON",
"as",
"a",
"polygon",
"geometry"
] |
train
|
https://github.com/GeoLatte/geolatte-common/blob/dc7f92b04d8c6cb706e78cb95e746d8f12089d95/src/main/java/org/geolatte/common/dataformats/json/jackson/GeometryDeserializer.java#L257-L272
|
azkaban/azkaban
|
azkaban-common/src/main/java/azkaban/executor/selector/CandidateComparator.java
|
CandidateComparator.tieBreak
|
protected boolean tieBreak(final T object1, final T object2) {
"""
tieBreak method which will kick in when the comparator list generated an equality result for
both sides. the tieBreak method will try best to make sure a stable result is returned.
"""
if (null == object2) {
return true;
}
if (null == object1) {
return false;
}
return object1.hashCode() >= object2.hashCode();
}
|
java
|
protected boolean tieBreak(final T object1, final T object2) {
if (null == object2) {
return true;
}
if (null == object1) {
return false;
}
return object1.hashCode() >= object2.hashCode();
}
|
[
"protected",
"boolean",
"tieBreak",
"(",
"final",
"T",
"object1",
",",
"final",
"T",
"object2",
")",
"{",
"if",
"(",
"null",
"==",
"object2",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"null",
"==",
"object1",
")",
"{",
"return",
"false",
";",
"}",
"return",
"object1",
".",
"hashCode",
"(",
")",
">=",
"object2",
".",
"hashCode",
"(",
")",
";",
"}"
] |
tieBreak method which will kick in when the comparator list generated an equality result for
both sides. the tieBreak method will try best to make sure a stable result is returned.
|
[
"tieBreak",
"method",
"which",
"will",
"kick",
"in",
"when",
"the",
"comparator",
"list",
"generated",
"an",
"equality",
"result",
"for",
"both",
"sides",
".",
"the",
"tieBreak",
"method",
"will",
"try",
"best",
"to",
"make",
"sure",
"a",
"stable",
"result",
"is",
"returned",
"."
] |
train
|
https://github.com/azkaban/azkaban/blob/d258ea7d6e66807c6eff79c5325d6d3443618dff/azkaban-common/src/main/java/azkaban/executor/selector/CandidateComparator.java#L54-L62
|
pressgang-ccms/PressGangCCMSCommonUtilities
|
src/main/java/org/jboss/pressgang/ccms/utils/common/CollectionUtilities.java
|
CollectionUtilities.isEqual
|
public static <T> boolean isEqual(final T first, final T second) {
"""
Provides an easy way to see if two possibly null objects are equal
@param first The first object to test
@param second The second to test
@return true if both objects are equal, false otherwise
"""
/* test to see if they are both null, or both reference the same object */
if (first == second) return true;
if (first == null && second != null) return false;
return first.equals(second);
}
|
java
|
public static <T> boolean isEqual(final T first, final T second) {
/* test to see if they are both null, or both reference the same object */
if (first == second) return true;
if (first == null && second != null) return false;
return first.equals(second);
}
|
[
"public",
"static",
"<",
"T",
">",
"boolean",
"isEqual",
"(",
"final",
"T",
"first",
",",
"final",
"T",
"second",
")",
"{",
"/* test to see if they are both null, or both reference the same object */",
"if",
"(",
"first",
"==",
"second",
")",
"return",
"true",
";",
"if",
"(",
"first",
"==",
"null",
"&&",
"second",
"!=",
"null",
")",
"return",
"false",
";",
"return",
"first",
".",
"equals",
"(",
"second",
")",
";",
"}"
] |
Provides an easy way to see if two possibly null objects are equal
@param first The first object to test
@param second The second to test
@return true if both objects are equal, false otherwise
|
[
"Provides",
"an",
"easy",
"way",
"to",
"see",
"if",
"two",
"possibly",
"null",
"objects",
"are",
"equal"
] |
train
|
https://github.com/pressgang-ccms/PressGangCCMSCommonUtilities/blob/5ebf5ed30a94c34c33f4708caa04a8da99cbb15c/src/main/java/org/jboss/pressgang/ccms/utils/common/CollectionUtilities.java#L180-L187
|
aNNiMON/Lightweight-Stream-API
|
stream/src/main/java/com/annimon/stream/LongStream.java
|
LongStream.mapToInt
|
@NotNull
public IntStream mapToInt(@NotNull final LongToIntFunction mapper) {
"""
Returns an {@code IntStream} consisting of the results of applying the given
function to the elements of this stream.
<p> This is an intermediate operation.
@param mapper the mapper function used to apply to each element
@return the new {@code IntStream}
"""
return new IntStream(params, new LongMapToInt(iterator, mapper));
}
|
java
|
@NotNull
public IntStream mapToInt(@NotNull final LongToIntFunction mapper) {
return new IntStream(params, new LongMapToInt(iterator, mapper));
}
|
[
"@",
"NotNull",
"public",
"IntStream",
"mapToInt",
"(",
"@",
"NotNull",
"final",
"LongToIntFunction",
"mapper",
")",
"{",
"return",
"new",
"IntStream",
"(",
"params",
",",
"new",
"LongMapToInt",
"(",
"iterator",
",",
"mapper",
")",
")",
";",
"}"
] |
Returns an {@code IntStream} consisting of the results of applying the given
function to the elements of this stream.
<p> This is an intermediate operation.
@param mapper the mapper function used to apply to each element
@return the new {@code IntStream}
|
[
"Returns",
"an",
"{",
"@code",
"IntStream",
"}",
"consisting",
"of",
"the",
"results",
"of",
"applying",
"the",
"given",
"function",
"to",
"the",
"elements",
"of",
"this",
"stream",
"."
] |
train
|
https://github.com/aNNiMON/Lightweight-Stream-API/blob/f29fd57208c20252a4549b084d55ed082c3e58f0/stream/src/main/java/com/annimon/stream/LongStream.java#L526-L529
|
venkatramanm/swf-all
|
swf/src/main/java/com/venky/swf/views/HtmlView.java
|
HtmlView._createBody
|
protected void _createBody(_IControl body,boolean includeStatusMessage) {
"""
/*
When views are composed, includeStatusMessage is passed as false so that it may be included in parent/including view
"""
int statusMessageIndex = body.getContainedControls().size();
showErrorsIfAny(body,statusMessageIndex, includeStatusMessage);
createBody(body);
}
|
java
|
protected void _createBody(_IControl body,boolean includeStatusMessage){
int statusMessageIndex = body.getContainedControls().size();
showErrorsIfAny(body,statusMessageIndex, includeStatusMessage);
createBody(body);
}
|
[
"protected",
"void",
"_createBody",
"(",
"_IControl",
"body",
",",
"boolean",
"includeStatusMessage",
")",
"{",
"int",
"statusMessageIndex",
"=",
"body",
".",
"getContainedControls",
"(",
")",
".",
"size",
"(",
")",
";",
"showErrorsIfAny",
"(",
"body",
",",
"statusMessageIndex",
",",
"includeStatusMessage",
")",
";",
"createBody",
"(",
"body",
")",
";",
"}"
] |
/*
When views are composed, includeStatusMessage is passed as false so that it may be included in parent/including view
|
[
"/",
"*",
"When",
"views",
"are",
"composed",
"includeStatusMessage",
"is",
"passed",
"as",
"false",
"so",
"that",
"it",
"may",
"be",
"included",
"in",
"parent",
"/",
"including",
"view"
] |
train
|
https://github.com/venkatramanm/swf-all/blob/e6ca342df0645bf1122d81e302575014ad565b69/swf/src/main/java/com/venky/swf/views/HtmlView.java#L214-L218
|
Azure/azure-sdk-for-java
|
appservice/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/appservice/v2016_03_01/implementation/DiagnosticsInner.java
|
DiagnosticsInner.getHostingEnvironmentDetectorResponseAsync
|
public Observable<DetectorResponseInner> getHostingEnvironmentDetectorResponseAsync(String resourceGroupName, String name, String detectorName) {
"""
Get Hosting Environment Detector Response.
Get Hosting Environment Detector Response.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param name App Service Environment Name
@param detectorName Detector Resource Name
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the DetectorResponseInner object
"""
return getHostingEnvironmentDetectorResponseWithServiceResponseAsync(resourceGroupName, name, detectorName).map(new Func1<ServiceResponse<DetectorResponseInner>, DetectorResponseInner>() {
@Override
public DetectorResponseInner call(ServiceResponse<DetectorResponseInner> response) {
return response.body();
}
});
}
|
java
|
public Observable<DetectorResponseInner> getHostingEnvironmentDetectorResponseAsync(String resourceGroupName, String name, String detectorName) {
return getHostingEnvironmentDetectorResponseWithServiceResponseAsync(resourceGroupName, name, detectorName).map(new Func1<ServiceResponse<DetectorResponseInner>, DetectorResponseInner>() {
@Override
public DetectorResponseInner call(ServiceResponse<DetectorResponseInner> response) {
return response.body();
}
});
}
|
[
"public",
"Observable",
"<",
"DetectorResponseInner",
">",
"getHostingEnvironmentDetectorResponseAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"name",
",",
"String",
"detectorName",
")",
"{",
"return",
"getHostingEnvironmentDetectorResponseWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"name",
",",
"detectorName",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"DetectorResponseInner",
">",
",",
"DetectorResponseInner",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"DetectorResponseInner",
"call",
"(",
"ServiceResponse",
"<",
"DetectorResponseInner",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] |
Get Hosting Environment Detector Response.
Get Hosting Environment Detector Response.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param name App Service Environment Name
@param detectorName Detector Resource Name
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the DetectorResponseInner object
|
[
"Get",
"Hosting",
"Environment",
"Detector",
"Response",
".",
"Get",
"Hosting",
"Environment",
"Detector",
"Response",
"."
] |
train
|
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/appservice/v2016_03_01/implementation/DiagnosticsInner.java#L365-L372
|
DV8FromTheWorld/JDA
|
src/main/java/net/dv8tion/jda/core/requests/restaction/pagination/PaginationAction.java
|
PaginationAction.forEachAsync
|
public RequestFuture<?> forEachAsync(final Procedure<T> action) {
"""
Iterates over all entities until the provided action returns {@code false}!
<br>This operation is different from {@link #forEach(Consumer)} as it
uses successive {@link #queue()} tasks to iterate each entity in callback threads instead of
the calling active thread.
This means that this method fully works on different threads to retrieve new entities.
<p><b>This iteration will include already cached entities, in order to exclude cached
entities use {@link #forEachRemainingAsync(Procedure)}</b>
<h1>Example</h1>
<pre>{@code
//deletes messages until it finds a user that is still in guild
public void cleanupMessages(MessagePaginationAction action)
{
action.forEachAsync( (message) ->
{
Guild guild = message.getGuild();
if (!guild.isMember(message.getAuthor()))
message.delete().queue();
else
return false;
return true;
});
}
}</pre>
@param action
{@link net.dv8tion.jda.core.utils.Procedure Procedure} returning {@code true} if iteration should continue!
@throws java.lang.IllegalArgumentException
If the provided Procedure is {@code null}
@return {@link java.util.concurrent.Future Future} that can be cancelled to stop iteration from outside!
"""
return forEachAsync(action, (throwable) ->
{
if (RestAction.DEFAULT_FAILURE != null)
RestAction.DEFAULT_FAILURE.accept(throwable);
}
|
java
|
public RequestFuture<?> forEachAsync(final Procedure<T> action)
{
return forEachAsync(action, (throwable) ->
{
if (RestAction.DEFAULT_FAILURE != null)
RestAction.DEFAULT_FAILURE.accept(throwable);
}
|
[
"public",
"RequestFuture",
"<",
"?",
">",
"forEachAsync",
"(",
"final",
"Procedure",
"<",
"T",
">",
"action",
")",
"{",
"return",
"forEachAsync",
"(",
"action",
",",
"(",
"throwable",
")",
"-",
">",
"{",
"if",
"(",
"RestAction",
".",
"DEFAULT_FAILURE",
"!=",
"null",
")",
"RestAction",
".",
"DEFAULT_FAILURE",
".",
"accept",
"(",
"throwable",
")",
"",
";",
"}"
] |
Iterates over all entities until the provided action returns {@code false}!
<br>This operation is different from {@link #forEach(Consumer)} as it
uses successive {@link #queue()} tasks to iterate each entity in callback threads instead of
the calling active thread.
This means that this method fully works on different threads to retrieve new entities.
<p><b>This iteration will include already cached entities, in order to exclude cached
entities use {@link #forEachRemainingAsync(Procedure)}</b>
<h1>Example</h1>
<pre>{@code
//deletes messages until it finds a user that is still in guild
public void cleanupMessages(MessagePaginationAction action)
{
action.forEachAsync( (message) ->
{
Guild guild = message.getGuild();
if (!guild.isMember(message.getAuthor()))
message.delete().queue();
else
return false;
return true;
});
}
}</pre>
@param action
{@link net.dv8tion.jda.core.utils.Procedure Procedure} returning {@code true} if iteration should continue!
@throws java.lang.IllegalArgumentException
If the provided Procedure is {@code null}
@return {@link java.util.concurrent.Future Future} that can be cancelled to stop iteration from outside!
|
[
"Iterates",
"over",
"all",
"entities",
"until",
"the",
"provided",
"action",
"returns",
"{",
"@code",
"false",
"}",
"!",
"<br",
">",
"This",
"operation",
"is",
"different",
"from",
"{",
"@link",
"#forEach",
"(",
"Consumer",
")",
"}",
"as",
"it",
"uses",
"successive",
"{",
"@link",
"#queue",
"()",
"}",
"tasks",
"to",
"iterate",
"each",
"entity",
"in",
"callback",
"threads",
"instead",
"of",
"the",
"calling",
"active",
"thread",
".",
"This",
"means",
"that",
"this",
"method",
"fully",
"works",
"on",
"different",
"threads",
"to",
"retrieve",
"new",
"entities",
".",
"<p",
">",
"<b",
">",
"This",
"iteration",
"will",
"include",
"already",
"cached",
"entities",
"in",
"order",
"to",
"exclude",
"cached",
"entities",
"use",
"{",
"@link",
"#forEachRemainingAsync",
"(",
"Procedure",
")",
"}",
"<",
"/",
"b",
">"
] |
train
|
https://github.com/DV8FromTheWorld/JDA/blob/8ecbbe354d03f6bf448411bba573d0d4c268b560/src/main/java/net/dv8tion/jda/core/requests/restaction/pagination/PaginationAction.java#L412-L418
|
alkacon/opencms-core
|
src/org/opencms/ui/contextmenu/CmsContextMenu.java
|
CmsContextMenu.addItem
|
public ContextMenuItem addItem(String caption) {
"""
Adds new item to context menu root with given caption.<p>
@param caption the caption
@return reference to newly added item
"""
ContextMenuItemState itemState = getState().addChild(caption, getNextId());
ContextMenuItem item = new ContextMenuItem(null, itemState);
m_items.put(itemState.getId(), item);
return item;
}
|
java
|
public ContextMenuItem addItem(String caption) {
ContextMenuItemState itemState = getState().addChild(caption, getNextId());
ContextMenuItem item = new ContextMenuItem(null, itemState);
m_items.put(itemState.getId(), item);
return item;
}
|
[
"public",
"ContextMenuItem",
"addItem",
"(",
"String",
"caption",
")",
"{",
"ContextMenuItemState",
"itemState",
"=",
"getState",
"(",
")",
".",
"addChild",
"(",
"caption",
",",
"getNextId",
"(",
")",
")",
";",
"ContextMenuItem",
"item",
"=",
"new",
"ContextMenuItem",
"(",
"null",
",",
"itemState",
")",
";",
"m_items",
".",
"put",
"(",
"itemState",
".",
"getId",
"(",
")",
",",
"item",
")",
";",
"return",
"item",
";",
"}"
] |
Adds new item to context menu root with given caption.<p>
@param caption the caption
@return reference to newly added item
|
[
"Adds",
"new",
"item",
"to",
"context",
"menu",
"root",
"with",
"given",
"caption",
".",
"<p",
">"
] |
train
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/contextmenu/CmsContextMenu.java#L1024-L1032
|
MariaDB/mariadb-connector-j
|
src/main/java/org/mariadb/jdbc/BasePrepareStatement.java
|
BasePrepareStatement.setTime
|
public void setTime(final int parameterIndex, final Time time, final Calendar cal)
throws SQLException {
"""
Sets the designated parameter to the given <code>java.sql.Time</code> value, using the given
<code>Calendar</code> object. The driver uses the <code>Calendar</code> object to construct
an SQL
<code>TIME</code> value, which the driver then sends to the database. With a
<code>Calendar</code> object, the
driver can calculate the time taking into account a custom timezone. If no
<code>Calendar</code> object is specified, the driver uses the default timezone, which is that
of the virtual machine running the application.
@param parameterIndex the first parameter is 1, the second is 2, ...
@param time the parameter value
@param cal the <code>Calendar</code> object the driver will use to construct the
time
@throws SQLException if parameterIndex does not correspond to a parameter marker in the SQL
statement; if a database access error occurs or this method is called on a
closed
<code>PreparedStatement</code>
"""
if (time == null) {
setNull(parameterIndex, ColumnType.TIME);
return;
}
setParameter(parameterIndex,
new TimeParameter(time, cal != null ? cal.getTimeZone() : TimeZone.getDefault(),
useFractionalSeconds));
}
|
java
|
public void setTime(final int parameterIndex, final Time time, final Calendar cal)
throws SQLException {
if (time == null) {
setNull(parameterIndex, ColumnType.TIME);
return;
}
setParameter(parameterIndex,
new TimeParameter(time, cal != null ? cal.getTimeZone() : TimeZone.getDefault(),
useFractionalSeconds));
}
|
[
"public",
"void",
"setTime",
"(",
"final",
"int",
"parameterIndex",
",",
"final",
"Time",
"time",
",",
"final",
"Calendar",
"cal",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"time",
"==",
"null",
")",
"{",
"setNull",
"(",
"parameterIndex",
",",
"ColumnType",
".",
"TIME",
")",
";",
"return",
";",
"}",
"setParameter",
"(",
"parameterIndex",
",",
"new",
"TimeParameter",
"(",
"time",
",",
"cal",
"!=",
"null",
"?",
"cal",
".",
"getTimeZone",
"(",
")",
":",
"TimeZone",
".",
"getDefault",
"(",
")",
",",
"useFractionalSeconds",
")",
")",
";",
"}"
] |
Sets the designated parameter to the given <code>java.sql.Time</code> value, using the given
<code>Calendar</code> object. The driver uses the <code>Calendar</code> object to construct
an SQL
<code>TIME</code> value, which the driver then sends to the database. With a
<code>Calendar</code> object, the
driver can calculate the time taking into account a custom timezone. If no
<code>Calendar</code> object is specified, the driver uses the default timezone, which is that
of the virtual machine running the application.
@param parameterIndex the first parameter is 1, the second is 2, ...
@param time the parameter value
@param cal the <code>Calendar</code> object the driver will use to construct the
time
@throws SQLException if parameterIndex does not correspond to a parameter marker in the SQL
statement; if a database access error occurs or this method is called on a
closed
<code>PreparedStatement</code>
|
[
"Sets",
"the",
"designated",
"parameter",
"to",
"the",
"given",
"<code",
">",
"java",
".",
"sql",
".",
"Time<",
"/",
"code",
">",
"value",
"using",
"the",
"given",
"<code",
">",
"Calendar<",
"/",
"code",
">",
"object",
".",
"The",
"driver",
"uses",
"the",
"<code",
">",
"Calendar<",
"/",
"code",
">",
"object",
"to",
"construct",
"an",
"SQL",
"<code",
">",
"TIME<",
"/",
"code",
">",
"value",
"which",
"the",
"driver",
"then",
"sends",
"to",
"the",
"database",
".",
"With",
"a",
"<code",
">",
"Calendar<",
"/",
"code",
">",
"object",
"the",
"driver",
"can",
"calculate",
"the",
"time",
"taking",
"into",
"account",
"a",
"custom",
"timezone",
".",
"If",
"no",
"<code",
">",
"Calendar<",
"/",
"code",
">",
"object",
"is",
"specified",
"the",
"driver",
"uses",
"the",
"default",
"timezone",
"which",
"is",
"that",
"of",
"the",
"virtual",
"machine",
"running",
"the",
"application",
"."
] |
train
|
https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/BasePrepareStatement.java#L541-L550
|
cedricbou/simple-xml
|
src/main/java/foop/simple/xml/SimpleXmlUtils.java
|
SimpleXmlUtils.tagToQName
|
public static QName tagToQName(final String tag,
final Map<String, String> nsRegistry) {
"""
Transform a tag, local or prefixed with a namespace alias, to a local or
full QName.
@param tag
The tag to convert, it can be local like <code>azerty</code>
or qualified like <code>ns1:azerty</code>.
@param nsRegistry
The namespaces registry containing for an alias, the full
namespace name.
@return the QName corresponding to the tag, it will be a local QName
except if a prefix was provided and it could be found in the
namespace registry.
"""
final String[] split = tag.split("\\:");
if (split.length <= 1) {
return new QName(split[0]);
} else {
final String namespace = nsRegistry.get(split[0]);
if (namespace != null) {
return new QName(namespace, split[1]);
} else {
return new QName(split[1]);
}
}
}
|
java
|
public static QName tagToQName(final String tag,
final Map<String, String> nsRegistry) {
final String[] split = tag.split("\\:");
if (split.length <= 1) {
return new QName(split[0]);
} else {
final String namespace = nsRegistry.get(split[0]);
if (namespace != null) {
return new QName(namespace, split[1]);
} else {
return new QName(split[1]);
}
}
}
|
[
"public",
"static",
"QName",
"tagToQName",
"(",
"final",
"String",
"tag",
",",
"final",
"Map",
"<",
"String",
",",
"String",
">",
"nsRegistry",
")",
"{",
"final",
"String",
"[",
"]",
"split",
"=",
"tag",
".",
"split",
"(",
"\"\\\\:\"",
")",
";",
"if",
"(",
"split",
".",
"length",
"<=",
"1",
")",
"{",
"return",
"new",
"QName",
"(",
"split",
"[",
"0",
"]",
")",
";",
"}",
"else",
"{",
"final",
"String",
"namespace",
"=",
"nsRegistry",
".",
"get",
"(",
"split",
"[",
"0",
"]",
")",
";",
"if",
"(",
"namespace",
"!=",
"null",
")",
"{",
"return",
"new",
"QName",
"(",
"namespace",
",",
"split",
"[",
"1",
"]",
")",
";",
"}",
"else",
"{",
"return",
"new",
"QName",
"(",
"split",
"[",
"1",
"]",
")",
";",
"}",
"}",
"}"
] |
Transform a tag, local or prefixed with a namespace alias, to a local or
full QName.
@param tag
The tag to convert, it can be local like <code>azerty</code>
or qualified like <code>ns1:azerty</code>.
@param nsRegistry
The namespaces registry containing for an alias, the full
namespace name.
@return the QName corresponding to the tag, it will be a local QName
except if a prefix was provided and it could be found in the
namespace registry.
|
[
"Transform",
"a",
"tag",
"local",
"or",
"prefixed",
"with",
"a",
"namespace",
"alias",
"to",
"a",
"local",
"or",
"full",
"QName",
"."
] |
train
|
https://github.com/cedricbou/simple-xml/blob/d7aa63d940c168e00e00716d9b07f99d2fd350f7/src/main/java/foop/simple/xml/SimpleXmlUtils.java#L23-L38
|
Azure/azure-sdk-for-java
|
batch/data-plane/src/main/java/com/microsoft/azure/batch/JobScheduleOperations.java
|
JobScheduleOperations.createJobSchedule
|
public void createJobSchedule(JobScheduleAddParameter jobSchedule, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException {
"""
Adds a job schedule to the Batch account.
@param jobSchedule The job schedule to be added.
@param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request.
@throws BatchErrorException Exception thrown when an error response is received from the Batch service.
@throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
"""
JobScheduleAddOptions options = new JobScheduleAddOptions();
BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors);
bhMgr.applyRequestBehaviors(options);
this.parentBatchClient.protocolLayer().jobSchedules().add(jobSchedule, options);
}
|
java
|
public void createJobSchedule(JobScheduleAddParameter jobSchedule, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException {
JobScheduleAddOptions options = new JobScheduleAddOptions();
BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors);
bhMgr.applyRequestBehaviors(options);
this.parentBatchClient.protocolLayer().jobSchedules().add(jobSchedule, options);
}
|
[
"public",
"void",
"createJobSchedule",
"(",
"JobScheduleAddParameter",
"jobSchedule",
",",
"Iterable",
"<",
"BatchClientBehavior",
">",
"additionalBehaviors",
")",
"throws",
"BatchErrorException",
",",
"IOException",
"{",
"JobScheduleAddOptions",
"options",
"=",
"new",
"JobScheduleAddOptions",
"(",
")",
";",
"BehaviorManager",
"bhMgr",
"=",
"new",
"BehaviorManager",
"(",
"this",
".",
"customBehaviors",
"(",
")",
",",
"additionalBehaviors",
")",
";",
"bhMgr",
".",
"applyRequestBehaviors",
"(",
"options",
")",
";",
"this",
".",
"parentBatchClient",
".",
"protocolLayer",
"(",
")",
".",
"jobSchedules",
"(",
")",
".",
"add",
"(",
"jobSchedule",
",",
"options",
")",
";",
"}"
] |
Adds a job schedule to the Batch account.
@param jobSchedule The job schedule to be added.
@param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request.
@throws BatchErrorException Exception thrown when an error response is received from the Batch service.
@throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
|
[
"Adds",
"a",
"job",
"schedule",
"to",
"the",
"Batch",
"account",
"."
] |
train
|
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/JobScheduleOperations.java#L405-L411
|
querydsl/querydsl
|
querydsl-core/src/main/java/com/querydsl/core/types/ExpressionUtils.java
|
ExpressionUtils.inAny
|
public static <D> Predicate inAny(Expression<D> left, Iterable<? extends Collection<? extends D>> lists) {
"""
Create a {@code left in right or...} expression for each list
@param <D> element type
@param left
@param lists
@return a {@code left in right or...} expression
"""
BooleanBuilder rv = new BooleanBuilder();
for (Collection<? extends D> list : lists) {
rv.or(in(left, list));
}
return rv;
}
|
java
|
public static <D> Predicate inAny(Expression<D> left, Iterable<? extends Collection<? extends D>> lists) {
BooleanBuilder rv = new BooleanBuilder();
for (Collection<? extends D> list : lists) {
rv.or(in(left, list));
}
return rv;
}
|
[
"public",
"static",
"<",
"D",
">",
"Predicate",
"inAny",
"(",
"Expression",
"<",
"D",
">",
"left",
",",
"Iterable",
"<",
"?",
"extends",
"Collection",
"<",
"?",
"extends",
"D",
">",
">",
"lists",
")",
"{",
"BooleanBuilder",
"rv",
"=",
"new",
"BooleanBuilder",
"(",
")",
";",
"for",
"(",
"Collection",
"<",
"?",
"extends",
"D",
">",
"list",
":",
"lists",
")",
"{",
"rv",
".",
"or",
"(",
"in",
"(",
"left",
",",
"list",
")",
")",
";",
"}",
"return",
"rv",
";",
"}"
] |
Create a {@code left in right or...} expression for each list
@param <D> element type
@param left
@param lists
@return a {@code left in right or...} expression
|
[
"Create",
"a",
"{",
"@code",
"left",
"in",
"right",
"or",
"...",
"}",
"expression",
"for",
"each",
"list"
] |
train
|
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-core/src/main/java/com/querydsl/core/types/ExpressionUtils.java#L533-L539
|
JOML-CI/JOML
|
src/org/joml/Matrix3x2f.java
|
Matrix3x2f.scaleAround
|
public Matrix3x2f scaleAround(float factor, float ox, float oy, Matrix3x2f dest) {
"""
Apply scaling to this matrix by scaling the base axes by the given <code>factor</code>
while using <code>(ox, oy)</code> as the scaling origin,
and store the result in <code>dest</code>.
<p>
If <code>M</code> is <code>this</code> matrix and <code>S</code> the scaling matrix,
then the new matrix will be <code>M * S</code>. So when transforming a
vector <code>v</code> with the new matrix by using <code>M * S * v</code>, the
scaling will be applied first!
<p>
This method is equivalent to calling: <code>translate(ox, oy, dest).scale(factor).translate(-ox, -oy)</code>
@param factor
the scaling factor for all three axes
@param ox
the x coordinate of the scaling origin
@param oy
the y coordinate of the scaling origin
@param dest
will hold the result
@return this
"""
return scaleAround(factor, factor, ox, oy, this);
}
|
java
|
public Matrix3x2f scaleAround(float factor, float ox, float oy, Matrix3x2f dest) {
return scaleAround(factor, factor, ox, oy, this);
}
|
[
"public",
"Matrix3x2f",
"scaleAround",
"(",
"float",
"factor",
",",
"float",
"ox",
",",
"float",
"oy",
",",
"Matrix3x2f",
"dest",
")",
"{",
"return",
"scaleAround",
"(",
"factor",
",",
"factor",
",",
"ox",
",",
"oy",
",",
"this",
")",
";",
"}"
] |
Apply scaling to this matrix by scaling the base axes by the given <code>factor</code>
while using <code>(ox, oy)</code> as the scaling origin,
and store the result in <code>dest</code>.
<p>
If <code>M</code> is <code>this</code> matrix and <code>S</code> the scaling matrix,
then the new matrix will be <code>M * S</code>. So when transforming a
vector <code>v</code> with the new matrix by using <code>M * S * v</code>, the
scaling will be applied first!
<p>
This method is equivalent to calling: <code>translate(ox, oy, dest).scale(factor).translate(-ox, -oy)</code>
@param factor
the scaling factor for all three axes
@param ox
the x coordinate of the scaling origin
@param oy
the y coordinate of the scaling origin
@param dest
will hold the result
@return this
|
[
"Apply",
"scaling",
"to",
"this",
"matrix",
"by",
"scaling",
"the",
"base",
"axes",
"by",
"the",
"given",
"<code",
">",
"factor<",
"/",
"code",
">",
"while",
"using",
"<code",
">",
"(",
"ox",
"oy",
")",
"<",
"/",
"code",
">",
"as",
"the",
"scaling",
"origin",
"and",
"store",
"the",
"result",
"in",
"<code",
">",
"dest<",
"/",
"code",
">",
".",
"<p",
">",
"If",
"<code",
">",
"M<",
"/",
"code",
">",
"is",
"<code",
">",
"this<",
"/",
"code",
">",
"matrix",
"and",
"<code",
">",
"S<",
"/",
"code",
">",
"the",
"scaling",
"matrix",
"then",
"the",
"new",
"matrix",
"will",
"be",
"<code",
">",
"M",
"*",
"S<",
"/",
"code",
">",
".",
"So",
"when",
"transforming",
"a",
"vector",
"<code",
">",
"v<",
"/",
"code",
">",
"with",
"the",
"new",
"matrix",
"by",
"using",
"<code",
">",
"M",
"*",
"S",
"*",
"v<",
"/",
"code",
">",
"the",
"scaling",
"will",
"be",
"applied",
"first!",
"<p",
">",
"This",
"method",
"is",
"equivalent",
"to",
"calling",
":",
"<code",
">",
"translate",
"(",
"ox",
"oy",
"dest",
")",
".",
"scale",
"(",
"factor",
")",
".",
"translate",
"(",
"-",
"ox",
"-",
"oy",
")",
"<",
"/",
"code",
">"
] |
train
|
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix3x2f.java#L1457-L1459
|
MKLab-ITI/multimedia-indexing
|
src/main/java/gr/iti/mklab/visual/vectorization/ImageVectorizer.java
|
ImageVectorizer.submitImageVectorizationTask
|
public void submitImageVectorizationTask(String imageFolder, String imageName) {
"""
Submits a new image vectorization task for an image that is stored in the disk and has not yet been
read into a BufferedImage object.
@param imageFolder
The folder where the image resides.
@param imageName
The name of the image.
"""
Callable<ImageVectorizationResult> call = new ImageVectorization(imageFolder, imageName,
targetVectorLength, maxImageSizeInPixels);
pool.submit(call);
numPendingTasks++;
}
|
java
|
public void submitImageVectorizationTask(String imageFolder, String imageName) {
Callable<ImageVectorizationResult> call = new ImageVectorization(imageFolder, imageName,
targetVectorLength, maxImageSizeInPixels);
pool.submit(call);
numPendingTasks++;
}
|
[
"public",
"void",
"submitImageVectorizationTask",
"(",
"String",
"imageFolder",
",",
"String",
"imageName",
")",
"{",
"Callable",
"<",
"ImageVectorizationResult",
">",
"call",
"=",
"new",
"ImageVectorization",
"(",
"imageFolder",
",",
"imageName",
",",
"targetVectorLength",
",",
"maxImageSizeInPixels",
")",
";",
"pool",
".",
"submit",
"(",
"call",
")",
";",
"numPendingTasks",
"++",
";",
"}"
] |
Submits a new image vectorization task for an image that is stored in the disk and has not yet been
read into a BufferedImage object.
@param imageFolder
The folder where the image resides.
@param imageName
The name of the image.
|
[
"Submits",
"a",
"new",
"image",
"vectorization",
"task",
"for",
"an",
"image",
"that",
"is",
"stored",
"in",
"the",
"disk",
"and",
"has",
"not",
"yet",
"been",
"read",
"into",
"a",
"BufferedImage",
"object",
"."
] |
train
|
https://github.com/MKLab-ITI/multimedia-indexing/blob/f82e8e517da706651f4b7a719805401f3102e135/src/main/java/gr/iti/mklab/visual/vectorization/ImageVectorizer.java#L138-L143
|
iipc/webarchive-commons
|
src/main/java/org/archive/util/FileUtils.java
|
FileUtils.storeProperties
|
public static void storeProperties(Properties p, File file) throws IOException {
"""
Store Properties instance to a File
@param p
@param file destination File
@throws IOException
"""
FileOutputStream fos = new FileOutputStream(file);
try {
p.store(fos,"");
} finally {
ArchiveUtils.closeQuietly(fos);
}
}
|
java
|
public static void storeProperties(Properties p, File file) throws IOException {
FileOutputStream fos = new FileOutputStream(file);
try {
p.store(fos,"");
} finally {
ArchiveUtils.closeQuietly(fos);
}
}
|
[
"public",
"static",
"void",
"storeProperties",
"(",
"Properties",
"p",
",",
"File",
"file",
")",
"throws",
"IOException",
"{",
"FileOutputStream",
"fos",
"=",
"new",
"FileOutputStream",
"(",
"file",
")",
";",
"try",
"{",
"p",
".",
"store",
"(",
"fos",
",",
"\"\"",
")",
";",
"}",
"finally",
"{",
"ArchiveUtils",
".",
"closeQuietly",
"(",
"fos",
")",
";",
"}",
"}"
] |
Store Properties instance to a File
@param p
@param file destination File
@throws IOException
|
[
"Store",
"Properties",
"instance",
"to",
"a",
"File"
] |
train
|
https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/util/FileUtils.java#L352-L359
|
spotbugs/spotbugs
|
spotbugs/src/main/java/edu/umd/cs/findbugs/util/ClassPathUtil.java
|
ClassPathUtil.findCodeBaseInClassPath
|
public static String findCodeBaseInClassPath(Pattern codeBaseNamePattern, String classPath) {
"""
Try to find a codebase matching the given pattern in the given class path
string.
@param codeBaseNamePattern
pattern describing a codebase (e.g., compiled from the regex
"findbugs\\.jar$")
@param classPath
a classpath
@return full path of named codebase, or null if the codebase couldn't be
found
"""
if (classPath == null) {
return null;
}
StringTokenizer tok = new StringTokenizer(classPath, File.pathSeparator);
while (tok.hasMoreTokens()) {
String t = tok.nextToken();
File f = new File(t);
Matcher m = codeBaseNamePattern.matcher(f.getName());
if (m.matches()) {
return t;
}
}
return null;
}
|
java
|
public static String findCodeBaseInClassPath(Pattern codeBaseNamePattern, String classPath) {
if (classPath == null) {
return null;
}
StringTokenizer tok = new StringTokenizer(classPath, File.pathSeparator);
while (tok.hasMoreTokens()) {
String t = tok.nextToken();
File f = new File(t);
Matcher m = codeBaseNamePattern.matcher(f.getName());
if (m.matches()) {
return t;
}
}
return null;
}
|
[
"public",
"static",
"String",
"findCodeBaseInClassPath",
"(",
"Pattern",
"codeBaseNamePattern",
",",
"String",
"classPath",
")",
"{",
"if",
"(",
"classPath",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"StringTokenizer",
"tok",
"=",
"new",
"StringTokenizer",
"(",
"classPath",
",",
"File",
".",
"pathSeparator",
")",
";",
"while",
"(",
"tok",
".",
"hasMoreTokens",
"(",
")",
")",
"{",
"String",
"t",
"=",
"tok",
".",
"nextToken",
"(",
")",
";",
"File",
"f",
"=",
"new",
"File",
"(",
"t",
")",
";",
"Matcher",
"m",
"=",
"codeBaseNamePattern",
".",
"matcher",
"(",
"f",
".",
"getName",
"(",
")",
")",
";",
"if",
"(",
"m",
".",
"matches",
"(",
")",
")",
"{",
"return",
"t",
";",
"}",
"}",
"return",
"null",
";",
"}"
] |
Try to find a codebase matching the given pattern in the given class path
string.
@param codeBaseNamePattern
pattern describing a codebase (e.g., compiled from the regex
"findbugs\\.jar$")
@param classPath
a classpath
@return full path of named codebase, or null if the codebase couldn't be
found
|
[
"Try",
"to",
"find",
"a",
"codebase",
"matching",
"the",
"given",
"pattern",
"in",
"the",
"given",
"class",
"path",
"string",
"."
] |
train
|
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/util/ClassPathUtil.java#L75-L91
|
knowm/XChart
|
xchart/src/main/java/org/knowm/xchart/internal/chartpart/Axis.java
|
Axis.getXAxisHeightHint
|
private double getXAxisHeightHint(double workingSpace) {
"""
The vertical Y-Axis is drawn first, but to know the lower bounds of it, we need to know how
high the X-Axis paint zone is going to be. Since the tick labels could be rotated, we need to
actually determine the tick labels first to get an idea of how tall the X-Axis tick labels will
be.
@return
"""
// Axis title
double titleHeight = 0.0;
if (chart.getXAxisTitle() != null
&& !chart.getXAxisTitle().trim().equalsIgnoreCase("")
&& axesChartStyler.isXAxisTitleVisible()) {
TextLayout textLayout =
new TextLayout(
chart.getXAxisTitle(),
axesChartStyler.getAxisTitleFont(),
new FontRenderContext(null, true, false));
Rectangle2D rectangle = textLayout.getBounds();
titleHeight = rectangle.getHeight() + axesChartStyler.getAxisTitlePadding();
}
this.axisTickCalculator = getAxisTickCalculator(workingSpace);
// Axis tick labels
double axisTickLabelsHeight = 0.0;
if (axesChartStyler.isXAxisTicksVisible()) {
// get some real tick labels
// System.out.println("XAxisHeightHint");
// System.out.println("workingSpace: " + workingSpace);
String sampleLabel = "";
// find the longest String in all the labels
for (int i = 0; i < axisTickCalculator.getTickLabels().size(); i++) {
// System.out.println("label: " + axisTickCalculator.getTickLabels().get(i));
if (axisTickCalculator.getTickLabels().get(i) != null
&& axisTickCalculator.getTickLabels().get(i).length() > sampleLabel.length()) {
sampleLabel = axisTickCalculator.getTickLabels().get(i);
}
}
// System.out.println("sampleLabel: " + sampleLabel);
// get the height of the label including rotation
TextLayout textLayout =
new TextLayout(
sampleLabel.length() == 0 ? " " : sampleLabel,
axesChartStyler.getAxisTickLabelsFont(),
new FontRenderContext(null, true, false));
AffineTransform rot =
axesChartStyler.getXAxisLabelRotation() == 0
? null
: AffineTransform.getRotateInstance(
-1 * Math.toRadians(axesChartStyler.getXAxisLabelRotation()));
Shape shape = textLayout.getOutline(rot);
Rectangle2D rectangle = shape.getBounds();
axisTickLabelsHeight =
rectangle.getHeight()
+ axesChartStyler.getAxisTickPadding()
+ axesChartStyler.getAxisTickMarkLength();
}
return titleHeight + axisTickLabelsHeight;
}
|
java
|
private double getXAxisHeightHint(double workingSpace) {
// Axis title
double titleHeight = 0.0;
if (chart.getXAxisTitle() != null
&& !chart.getXAxisTitle().trim().equalsIgnoreCase("")
&& axesChartStyler.isXAxisTitleVisible()) {
TextLayout textLayout =
new TextLayout(
chart.getXAxisTitle(),
axesChartStyler.getAxisTitleFont(),
new FontRenderContext(null, true, false));
Rectangle2D rectangle = textLayout.getBounds();
titleHeight = rectangle.getHeight() + axesChartStyler.getAxisTitlePadding();
}
this.axisTickCalculator = getAxisTickCalculator(workingSpace);
// Axis tick labels
double axisTickLabelsHeight = 0.0;
if (axesChartStyler.isXAxisTicksVisible()) {
// get some real tick labels
// System.out.println("XAxisHeightHint");
// System.out.println("workingSpace: " + workingSpace);
String sampleLabel = "";
// find the longest String in all the labels
for (int i = 0; i < axisTickCalculator.getTickLabels().size(); i++) {
// System.out.println("label: " + axisTickCalculator.getTickLabels().get(i));
if (axisTickCalculator.getTickLabels().get(i) != null
&& axisTickCalculator.getTickLabels().get(i).length() > sampleLabel.length()) {
sampleLabel = axisTickCalculator.getTickLabels().get(i);
}
}
// System.out.println("sampleLabel: " + sampleLabel);
// get the height of the label including rotation
TextLayout textLayout =
new TextLayout(
sampleLabel.length() == 0 ? " " : sampleLabel,
axesChartStyler.getAxisTickLabelsFont(),
new FontRenderContext(null, true, false));
AffineTransform rot =
axesChartStyler.getXAxisLabelRotation() == 0
? null
: AffineTransform.getRotateInstance(
-1 * Math.toRadians(axesChartStyler.getXAxisLabelRotation()));
Shape shape = textLayout.getOutline(rot);
Rectangle2D rectangle = shape.getBounds();
axisTickLabelsHeight =
rectangle.getHeight()
+ axesChartStyler.getAxisTickPadding()
+ axesChartStyler.getAxisTickMarkLength();
}
return titleHeight + axisTickLabelsHeight;
}
|
[
"private",
"double",
"getXAxisHeightHint",
"(",
"double",
"workingSpace",
")",
"{",
"// Axis title",
"double",
"titleHeight",
"=",
"0.0",
";",
"if",
"(",
"chart",
".",
"getXAxisTitle",
"(",
")",
"!=",
"null",
"&&",
"!",
"chart",
".",
"getXAxisTitle",
"(",
")",
".",
"trim",
"(",
")",
".",
"equalsIgnoreCase",
"(",
"\"\"",
")",
"&&",
"axesChartStyler",
".",
"isXAxisTitleVisible",
"(",
")",
")",
"{",
"TextLayout",
"textLayout",
"=",
"new",
"TextLayout",
"(",
"chart",
".",
"getXAxisTitle",
"(",
")",
",",
"axesChartStyler",
".",
"getAxisTitleFont",
"(",
")",
",",
"new",
"FontRenderContext",
"(",
"null",
",",
"true",
",",
"false",
")",
")",
";",
"Rectangle2D",
"rectangle",
"=",
"textLayout",
".",
"getBounds",
"(",
")",
";",
"titleHeight",
"=",
"rectangle",
".",
"getHeight",
"(",
")",
"+",
"axesChartStyler",
".",
"getAxisTitlePadding",
"(",
")",
";",
"}",
"this",
".",
"axisTickCalculator",
"=",
"getAxisTickCalculator",
"(",
"workingSpace",
")",
";",
"// Axis tick labels",
"double",
"axisTickLabelsHeight",
"=",
"0.0",
";",
"if",
"(",
"axesChartStyler",
".",
"isXAxisTicksVisible",
"(",
")",
")",
"{",
"// get some real tick labels",
"// System.out.println(\"XAxisHeightHint\");",
"// System.out.println(\"workingSpace: \" + workingSpace);",
"String",
"sampleLabel",
"=",
"\"\"",
";",
"// find the longest String in all the labels",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"axisTickCalculator",
".",
"getTickLabels",
"(",
")",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"// System.out.println(\"label: \" + axisTickCalculator.getTickLabels().get(i));",
"if",
"(",
"axisTickCalculator",
".",
"getTickLabels",
"(",
")",
".",
"get",
"(",
"i",
")",
"!=",
"null",
"&&",
"axisTickCalculator",
".",
"getTickLabels",
"(",
")",
".",
"get",
"(",
"i",
")",
".",
"length",
"(",
")",
">",
"sampleLabel",
".",
"length",
"(",
")",
")",
"{",
"sampleLabel",
"=",
"axisTickCalculator",
".",
"getTickLabels",
"(",
")",
".",
"get",
"(",
"i",
")",
";",
"}",
"}",
"// System.out.println(\"sampleLabel: \" + sampleLabel);",
"// get the height of the label including rotation",
"TextLayout",
"textLayout",
"=",
"new",
"TextLayout",
"(",
"sampleLabel",
".",
"length",
"(",
")",
"==",
"0",
"?",
"\" \"",
":",
"sampleLabel",
",",
"axesChartStyler",
".",
"getAxisTickLabelsFont",
"(",
")",
",",
"new",
"FontRenderContext",
"(",
"null",
",",
"true",
",",
"false",
")",
")",
";",
"AffineTransform",
"rot",
"=",
"axesChartStyler",
".",
"getXAxisLabelRotation",
"(",
")",
"==",
"0",
"?",
"null",
":",
"AffineTransform",
".",
"getRotateInstance",
"(",
"-",
"1",
"*",
"Math",
".",
"toRadians",
"(",
"axesChartStyler",
".",
"getXAxisLabelRotation",
"(",
")",
")",
")",
";",
"Shape",
"shape",
"=",
"textLayout",
".",
"getOutline",
"(",
"rot",
")",
";",
"Rectangle2D",
"rectangle",
"=",
"shape",
".",
"getBounds",
"(",
")",
";",
"axisTickLabelsHeight",
"=",
"rectangle",
".",
"getHeight",
"(",
")",
"+",
"axesChartStyler",
".",
"getAxisTickPadding",
"(",
")",
"+",
"axesChartStyler",
".",
"getAxisTickMarkLength",
"(",
")",
";",
"}",
"return",
"titleHeight",
"+",
"axisTickLabelsHeight",
";",
"}"
] |
The vertical Y-Axis is drawn first, but to know the lower bounds of it, we need to know how
high the X-Axis paint zone is going to be. Since the tick labels could be rotated, we need to
actually determine the tick labels first to get an idea of how tall the X-Axis tick labels will
be.
@return
|
[
"The",
"vertical",
"Y",
"-",
"Axis",
"is",
"drawn",
"first",
"but",
"to",
"know",
"the",
"lower",
"bounds",
"of",
"it",
"we",
"need",
"to",
"know",
"how",
"high",
"the",
"X",
"-",
"Axis",
"paint",
"zone",
"is",
"going",
"to",
"be",
".",
"Since",
"the",
"tick",
"labels",
"could",
"be",
"rotated",
"we",
"need",
"to",
"actually",
"determine",
"the",
"tick",
"labels",
"first",
"to",
"get",
"an",
"idea",
"of",
"how",
"tall",
"the",
"X",
"-",
"Axis",
"tick",
"labels",
"will",
"be",
"."
] |
train
|
https://github.com/knowm/XChart/blob/677a105753a855edf24782fab1bf1f5aec3e642b/xchart/src/main/java/org/knowm/xchart/internal/chartpart/Axis.java#L257-L314
|
nohana/Amalgam
|
amalgam/src/main/java/com/amalgam/app/DialogFragmentUtils.java
|
DialogFragmentUtils.showOnLoaderCallback
|
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public static void showOnLoaderCallback(Handler handler, final android.app.FragmentManager manager, final android.app.DialogFragment fragment, final String tag) {
"""
Show {@link android.app.DialogFragment} with the specified tag on the loader callbacks.
@param handler the handler, in most case, this handler is the main handler.
@param manager the manager.
@param fragment the fragment.
@param tag the tag string that is related to the {@link android.app.DialogFragment}.
"""
handler.post(new Runnable() {
@Override
public void run() {
fragment.show(manager, tag);
}
});
}
|
java
|
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public static void showOnLoaderCallback(Handler handler, final android.app.FragmentManager manager, final android.app.DialogFragment fragment, final String tag) {
handler.post(new Runnable() {
@Override
public void run() {
fragment.show(manager, tag);
}
});
}
|
[
"@",
"TargetApi",
"(",
"Build",
".",
"VERSION_CODES",
".",
"HONEYCOMB",
")",
"public",
"static",
"void",
"showOnLoaderCallback",
"(",
"Handler",
"handler",
",",
"final",
"android",
".",
"app",
".",
"FragmentManager",
"manager",
",",
"final",
"android",
".",
"app",
".",
"DialogFragment",
"fragment",
",",
"final",
"String",
"tag",
")",
"{",
"handler",
".",
"post",
"(",
"new",
"Runnable",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"run",
"(",
")",
"{",
"fragment",
".",
"show",
"(",
"manager",
",",
"tag",
")",
";",
"}",
"}",
")",
";",
"}"
] |
Show {@link android.app.DialogFragment} with the specified tag on the loader callbacks.
@param handler the handler, in most case, this handler is the main handler.
@param manager the manager.
@param fragment the fragment.
@param tag the tag string that is related to the {@link android.app.DialogFragment}.
|
[
"Show",
"{"
] |
train
|
https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/app/DialogFragmentUtils.java#L134-L142
|
ManfredTremmel/gwt-commons-lang3
|
src/main/java/org/apache/commons/lang3/ClassPathUtils.java
|
ClassPathUtils.toFullyQualifiedPath
|
@GwtIncompatible("incompatible method")
public static String toFullyQualifiedPath(final Package context, final String resourceName) {
"""
Returns the fully qualified path for the resource with name {@code resourceName} relative to the given context.
<p>Note that this method does not check whether the resource actually exists.
It only constructs the path.
Null inputs are not allowed.</p>
<pre>
ClassPathUtils.toFullyQualifiedPath(StringUtils.class.getPackage(), "StringUtils.properties") = "org/apache/commons/lang3/StringUtils.properties"
</pre>
@param context The context for constructing the path.
@param resourceName the resource name to construct the fully qualified path for.
@return the fully qualified path of the resource with name {@code resourceName}.
@throws java.lang.NullPointerException if either {@code context} or {@code resourceName} is null.
"""
Validate.notNull(context, "Parameter '%s' must not be null!", "context" );
Validate.notNull(resourceName, "Parameter '%s' must not be null!", "resourceName");
return context.getName().replace('.', '/') + "/" + resourceName;
}
|
java
|
@GwtIncompatible("incompatible method")
public static String toFullyQualifiedPath(final Package context, final String resourceName) {
Validate.notNull(context, "Parameter '%s' must not be null!", "context" );
Validate.notNull(resourceName, "Parameter '%s' must not be null!", "resourceName");
return context.getName().replace('.', '/') + "/" + resourceName;
}
|
[
"@",
"GwtIncompatible",
"(",
"\"incompatible method\"",
")",
"public",
"static",
"String",
"toFullyQualifiedPath",
"(",
"final",
"Package",
"context",
",",
"final",
"String",
"resourceName",
")",
"{",
"Validate",
".",
"notNull",
"(",
"context",
",",
"\"Parameter '%s' must not be null!\"",
",",
"\"context\"",
")",
";",
"Validate",
".",
"notNull",
"(",
"resourceName",
",",
"\"Parameter '%s' must not be null!\"",
",",
"\"resourceName\"",
")",
";",
"return",
"context",
".",
"getName",
"(",
")",
".",
"replace",
"(",
"'",
"'",
",",
"'",
"'",
")",
"+",
"\"/\"",
"+",
"resourceName",
";",
"}"
] |
Returns the fully qualified path for the resource with name {@code resourceName} relative to the given context.
<p>Note that this method does not check whether the resource actually exists.
It only constructs the path.
Null inputs are not allowed.</p>
<pre>
ClassPathUtils.toFullyQualifiedPath(StringUtils.class.getPackage(), "StringUtils.properties") = "org/apache/commons/lang3/StringUtils.properties"
</pre>
@param context The context for constructing the path.
@param resourceName the resource name to construct the fully qualified path for.
@return the fully qualified path of the resource with name {@code resourceName}.
@throws java.lang.NullPointerException if either {@code context} or {@code resourceName} is null.
|
[
"Returns",
"the",
"fully",
"qualified",
"path",
"for",
"the",
"resource",
"with",
"name",
"{",
"@code",
"resourceName",
"}",
"relative",
"to",
"the",
"given",
"context",
"."
] |
train
|
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/ClassPathUtils.java#L129-L134
|
sevensource/html-email-service
|
src/main/java/org/sevensource/commons/email/model/DefaultEmailModel.java
|
DefaultEmailModel.addCc
|
public void addCc(String address, String personal) throws AddressException {
"""
adds a CC recipient
@param address a valid email address
@param personal the real world name of the sender (can be null)
@throws AddressException in case of an invalid email address
"""
if(cc == null) {
cc = new ArrayList<>();
}
cc.add( toInternetAddress(address, personal) );
}
|
java
|
public void addCc(String address, String personal) throws AddressException {
if(cc == null) {
cc = new ArrayList<>();
}
cc.add( toInternetAddress(address, personal) );
}
|
[
"public",
"void",
"addCc",
"(",
"String",
"address",
",",
"String",
"personal",
")",
"throws",
"AddressException",
"{",
"if",
"(",
"cc",
"==",
"null",
")",
"{",
"cc",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"}",
"cc",
".",
"add",
"(",
"toInternetAddress",
"(",
"address",
",",
"personal",
")",
")",
";",
"}"
] |
adds a CC recipient
@param address a valid email address
@param personal the real world name of the sender (can be null)
@throws AddressException in case of an invalid email address
|
[
"adds",
"a",
"CC",
"recipient"
] |
train
|
https://github.com/sevensource/html-email-service/blob/a55d9ef1a2173917cb5f870854bc24e5aaebd182/src/main/java/org/sevensource/commons/email/model/DefaultEmailModel.java#L107-L112
|
OpenLiberty/open-liberty
|
dev/com.ibm.ws.kernel.feature.cmdline/src/com/ibm/ws/kernel/feature/internal/cmdline/ClasspathAction.java
|
ClasspathAction.collectFeatureInfos
|
private void collectFeatureInfos(Map<String, ProductInfo> productInfos,
Map<String, FeatureInfo> featuresBySymbolicName) {
"""
Collect information about all installed products and their features.
@param productInfos result parameter of product name (prefix) to info
@param featuresBySymbolicName result parameter of symbolic name to info
"""
ManifestFileProcessor manifestFileProcessor = new ManifestFileProcessor();
for (Map.Entry<String, Map<String, ProvisioningFeatureDefinition>> productEntry : manifestFileProcessor.getFeatureDefinitionsByProduct().entrySet()) {
String productName = productEntry.getKey();
Map<String, ProvisioningFeatureDefinition> features = productEntry.getValue();
ContentBasedLocalBundleRepository repository;
if (productName.equals(ManifestFileProcessor.CORE_PRODUCT_NAME)) {
repository = BundleRepositoryRegistry.getInstallBundleRepository();
} else if (productName.equals(ManifestFileProcessor.USR_PRODUCT_EXT_NAME)) {
repository = BundleRepositoryRegistry.getUsrInstallBundleRepository();
} else {
repository = manifestFileProcessor.getBundleRepository(productName, null);
}
ProductInfo productInfo = new ProductInfo(repository);
productInfos.put(productName, productInfo);
for (Map.Entry<String, ProvisioningFeatureDefinition> featureEntry : features.entrySet()) {
String featureSymbolicName = featureEntry.getKey();
ProvisioningFeatureDefinition feature = featureEntry.getValue();
FeatureInfo featureInfo = new FeatureInfo(productInfo, feature);
featuresBySymbolicName.put(featureSymbolicName, featureInfo);
String shortName = feature.getIbmShortName();
if (shortName != null) {
productInfo.featuresByShortName.put(shortName, featureInfo);
}
}
}
}
|
java
|
private void collectFeatureInfos(Map<String, ProductInfo> productInfos,
Map<String, FeatureInfo> featuresBySymbolicName) {
ManifestFileProcessor manifestFileProcessor = new ManifestFileProcessor();
for (Map.Entry<String, Map<String, ProvisioningFeatureDefinition>> productEntry : manifestFileProcessor.getFeatureDefinitionsByProduct().entrySet()) {
String productName = productEntry.getKey();
Map<String, ProvisioningFeatureDefinition> features = productEntry.getValue();
ContentBasedLocalBundleRepository repository;
if (productName.equals(ManifestFileProcessor.CORE_PRODUCT_NAME)) {
repository = BundleRepositoryRegistry.getInstallBundleRepository();
} else if (productName.equals(ManifestFileProcessor.USR_PRODUCT_EXT_NAME)) {
repository = BundleRepositoryRegistry.getUsrInstallBundleRepository();
} else {
repository = manifestFileProcessor.getBundleRepository(productName, null);
}
ProductInfo productInfo = new ProductInfo(repository);
productInfos.put(productName, productInfo);
for (Map.Entry<String, ProvisioningFeatureDefinition> featureEntry : features.entrySet()) {
String featureSymbolicName = featureEntry.getKey();
ProvisioningFeatureDefinition feature = featureEntry.getValue();
FeatureInfo featureInfo = new FeatureInfo(productInfo, feature);
featuresBySymbolicName.put(featureSymbolicName, featureInfo);
String shortName = feature.getIbmShortName();
if (shortName != null) {
productInfo.featuresByShortName.put(shortName, featureInfo);
}
}
}
}
|
[
"private",
"void",
"collectFeatureInfos",
"(",
"Map",
"<",
"String",
",",
"ProductInfo",
">",
"productInfos",
",",
"Map",
"<",
"String",
",",
"FeatureInfo",
">",
"featuresBySymbolicName",
")",
"{",
"ManifestFileProcessor",
"manifestFileProcessor",
"=",
"new",
"ManifestFileProcessor",
"(",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"Map",
"<",
"String",
",",
"ProvisioningFeatureDefinition",
">",
">",
"productEntry",
":",
"manifestFileProcessor",
".",
"getFeatureDefinitionsByProduct",
"(",
")",
".",
"entrySet",
"(",
")",
")",
"{",
"String",
"productName",
"=",
"productEntry",
".",
"getKey",
"(",
")",
";",
"Map",
"<",
"String",
",",
"ProvisioningFeatureDefinition",
">",
"features",
"=",
"productEntry",
".",
"getValue",
"(",
")",
";",
"ContentBasedLocalBundleRepository",
"repository",
";",
"if",
"(",
"productName",
".",
"equals",
"(",
"ManifestFileProcessor",
".",
"CORE_PRODUCT_NAME",
")",
")",
"{",
"repository",
"=",
"BundleRepositoryRegistry",
".",
"getInstallBundleRepository",
"(",
")",
";",
"}",
"else",
"if",
"(",
"productName",
".",
"equals",
"(",
"ManifestFileProcessor",
".",
"USR_PRODUCT_EXT_NAME",
")",
")",
"{",
"repository",
"=",
"BundleRepositoryRegistry",
".",
"getUsrInstallBundleRepository",
"(",
")",
";",
"}",
"else",
"{",
"repository",
"=",
"manifestFileProcessor",
".",
"getBundleRepository",
"(",
"productName",
",",
"null",
")",
";",
"}",
"ProductInfo",
"productInfo",
"=",
"new",
"ProductInfo",
"(",
"repository",
")",
";",
"productInfos",
".",
"put",
"(",
"productName",
",",
"productInfo",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"ProvisioningFeatureDefinition",
">",
"featureEntry",
":",
"features",
".",
"entrySet",
"(",
")",
")",
"{",
"String",
"featureSymbolicName",
"=",
"featureEntry",
".",
"getKey",
"(",
")",
";",
"ProvisioningFeatureDefinition",
"feature",
"=",
"featureEntry",
".",
"getValue",
"(",
")",
";",
"FeatureInfo",
"featureInfo",
"=",
"new",
"FeatureInfo",
"(",
"productInfo",
",",
"feature",
")",
";",
"featuresBySymbolicName",
".",
"put",
"(",
"featureSymbolicName",
",",
"featureInfo",
")",
";",
"String",
"shortName",
"=",
"feature",
".",
"getIbmShortName",
"(",
")",
";",
"if",
"(",
"shortName",
"!=",
"null",
")",
"{",
"productInfo",
".",
"featuresByShortName",
".",
"put",
"(",
"shortName",
",",
"featureInfo",
")",
";",
"}",
"}",
"}",
"}"
] |
Collect information about all installed products and their features.
@param productInfos result parameter of product name (prefix) to info
@param featuresBySymbolicName result parameter of symbolic name to info
|
[
"Collect",
"information",
"about",
"all",
"installed",
"products",
"and",
"their",
"features",
"."
] |
train
|
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.feature.cmdline/src/com/ibm/ws/kernel/feature/internal/cmdline/ClasspathAction.java#L163-L195
|
undertow-io/undertow
|
core/src/main/java/io/undertow/server/handlers/resource/PathResourceManager.java
|
PathResourceManager.isFileSameCase
|
private boolean isFileSameCase(final Path file, String normalizeFile) throws IOException {
"""
Security check for case insensitive file systems.
We make sure the case of the filename matches the case of the request.
This is only a check for case sensitivity, not for non canonical . and ../ which are allowed.
For example:
file.getName() == "page.jsp" && file.getCanonicalFile().getName() == "page.jsp" should return true
file.getName() == "page.jsp" && file.getCanonicalFile().getName() == "page.JSP" should return false
file.getName() == "./page.jsp" && file.getCanonicalFile().getName() == "page.jsp" should return true
"""
String canonicalName = file.toRealPath().toString();
return canonicalName.equals(normalizeFile);
}
|
java
|
private boolean isFileSameCase(final Path file, String normalizeFile) throws IOException {
String canonicalName = file.toRealPath().toString();
return canonicalName.equals(normalizeFile);
}
|
[
"private",
"boolean",
"isFileSameCase",
"(",
"final",
"Path",
"file",
",",
"String",
"normalizeFile",
")",
"throws",
"IOException",
"{",
"String",
"canonicalName",
"=",
"file",
".",
"toRealPath",
"(",
")",
".",
"toString",
"(",
")",
";",
"return",
"canonicalName",
".",
"equals",
"(",
"normalizeFile",
")",
";",
"}"
] |
Security check for case insensitive file systems.
We make sure the case of the filename matches the case of the request.
This is only a check for case sensitivity, not for non canonical . and ../ which are allowed.
For example:
file.getName() == "page.jsp" && file.getCanonicalFile().getName() == "page.jsp" should return true
file.getName() == "page.jsp" && file.getCanonicalFile().getName() == "page.JSP" should return false
file.getName() == "./page.jsp" && file.getCanonicalFile().getName() == "page.jsp" should return true
|
[
"Security",
"check",
"for",
"case",
"insensitive",
"file",
"systems",
".",
"We",
"make",
"sure",
"the",
"case",
"of",
"the",
"filename",
"matches",
"the",
"case",
"of",
"the",
"request",
".",
"This",
"is",
"only",
"a",
"check",
"for",
"case",
"sensitivity",
"not",
"for",
"non",
"canonical",
".",
"and",
"..",
"/",
"which",
"are",
"allowed",
"."
] |
train
|
https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/server/handlers/resource/PathResourceManager.java#L325-L328
|
ironjacamar/ironjacamar
|
common/src/main/java/org/ironjacamar/common/metadata/ds/DsParser.java
|
DsParser.storeStatement
|
protected void storeStatement(Statement s, XMLStreamWriter writer) throws Exception {
"""
Store statement
@param s The statement
@param writer The writer
@exception Exception Thrown if an error occurs
"""
writer.writeStartElement(XML.ELEMENT_STATEMENT);
if (s.getTrackStatements() != null)
{
writer.writeStartElement(XML.ELEMENT_TRACK_STATEMENTS);
writer.writeCharacters(s.getValue(XML.ELEMENT_TRACK_STATEMENTS, s.getTrackStatements().toString()));
writer.writeEndElement();
}
if (s.getPreparedStatementsCacheSize() != null)
{
writer.writeStartElement(XML.ELEMENT_PREPARED_STATEMENT_CACHE_SIZE);
writer.writeCharacters(s.getValue(XML.ELEMENT_PREPARED_STATEMENT_CACHE_SIZE,
s.getPreparedStatementsCacheSize().toString()));
writer.writeEndElement();
}
if (s.isSharePreparedStatements() != null && Boolean.TRUE.equals(s.isSharePreparedStatements()))
{
writer.writeEmptyElement(XML.ELEMENT_SHARE_PREPARED_STATEMENTS);
}
writer.writeEndElement();
}
|
java
|
protected void storeStatement(Statement s, XMLStreamWriter writer) throws Exception
{
writer.writeStartElement(XML.ELEMENT_STATEMENT);
if (s.getTrackStatements() != null)
{
writer.writeStartElement(XML.ELEMENT_TRACK_STATEMENTS);
writer.writeCharacters(s.getValue(XML.ELEMENT_TRACK_STATEMENTS, s.getTrackStatements().toString()));
writer.writeEndElement();
}
if (s.getPreparedStatementsCacheSize() != null)
{
writer.writeStartElement(XML.ELEMENT_PREPARED_STATEMENT_CACHE_SIZE);
writer.writeCharacters(s.getValue(XML.ELEMENT_PREPARED_STATEMENT_CACHE_SIZE,
s.getPreparedStatementsCacheSize().toString()));
writer.writeEndElement();
}
if (s.isSharePreparedStatements() != null && Boolean.TRUE.equals(s.isSharePreparedStatements()))
{
writer.writeEmptyElement(XML.ELEMENT_SHARE_PREPARED_STATEMENTS);
}
writer.writeEndElement();
}
|
[
"protected",
"void",
"storeStatement",
"(",
"Statement",
"s",
",",
"XMLStreamWriter",
"writer",
")",
"throws",
"Exception",
"{",
"writer",
".",
"writeStartElement",
"(",
"XML",
".",
"ELEMENT_STATEMENT",
")",
";",
"if",
"(",
"s",
".",
"getTrackStatements",
"(",
")",
"!=",
"null",
")",
"{",
"writer",
".",
"writeStartElement",
"(",
"XML",
".",
"ELEMENT_TRACK_STATEMENTS",
")",
";",
"writer",
".",
"writeCharacters",
"(",
"s",
".",
"getValue",
"(",
"XML",
".",
"ELEMENT_TRACK_STATEMENTS",
",",
"s",
".",
"getTrackStatements",
"(",
")",
".",
"toString",
"(",
")",
")",
")",
";",
"writer",
".",
"writeEndElement",
"(",
")",
";",
"}",
"if",
"(",
"s",
".",
"getPreparedStatementsCacheSize",
"(",
")",
"!=",
"null",
")",
"{",
"writer",
".",
"writeStartElement",
"(",
"XML",
".",
"ELEMENT_PREPARED_STATEMENT_CACHE_SIZE",
")",
";",
"writer",
".",
"writeCharacters",
"(",
"s",
".",
"getValue",
"(",
"XML",
".",
"ELEMENT_PREPARED_STATEMENT_CACHE_SIZE",
",",
"s",
".",
"getPreparedStatementsCacheSize",
"(",
")",
".",
"toString",
"(",
")",
")",
")",
";",
"writer",
".",
"writeEndElement",
"(",
")",
";",
"}",
"if",
"(",
"s",
".",
"isSharePreparedStatements",
"(",
")",
"!=",
"null",
"&&",
"Boolean",
".",
"TRUE",
".",
"equals",
"(",
"s",
".",
"isSharePreparedStatements",
"(",
")",
")",
")",
"{",
"writer",
".",
"writeEmptyElement",
"(",
"XML",
".",
"ELEMENT_SHARE_PREPARED_STATEMENTS",
")",
";",
"}",
"writer",
".",
"writeEndElement",
"(",
")",
";",
"}"
] |
Store statement
@param s The statement
@param writer The writer
@exception Exception Thrown if an error occurs
|
[
"Store",
"statement"
] |
train
|
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/common/src/main/java/org/ironjacamar/common/metadata/ds/DsParser.java#L2096-L2121
|
TheHortonMachine/hortonmachine
|
gears/src/main/java/org/hortonmachine/gears/utils/SldUtilities.java
|
SldUtilities.getStyleFromFile
|
public static Style getStyleFromFile( File file ) {
"""
Get the style from an sld file.
@param file the SLD file or a companion file.
@return the {@link Style} object.
@throws IOException
"""
Style style = null;
try {
String name = file.getName();
if (!name.endsWith("sld")) {
String nameWithoutExtention = FileUtilities.getNameWithoutExtention(file);
File sldFile = new File(file.getParentFile(), nameWithoutExtention + ".sld");
if (sldFile.exists()) {
file = sldFile;
} else {
// no style file here
return null;
}
}
SLDHandler h = new SLDHandler();
StyledLayerDescriptor sld = h.parse(file, null, null, null);
// SLDParser stylereader = new SLDParser(sf, file);
// StyledLayerDescriptor sld = stylereader.parseSLD();
style = getDefaultStyle(sld);
return style;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
|
java
|
public static Style getStyleFromFile( File file ) {
Style style = null;
try {
String name = file.getName();
if (!name.endsWith("sld")) {
String nameWithoutExtention = FileUtilities.getNameWithoutExtention(file);
File sldFile = new File(file.getParentFile(), nameWithoutExtention + ".sld");
if (sldFile.exists()) {
file = sldFile;
} else {
// no style file here
return null;
}
}
SLDHandler h = new SLDHandler();
StyledLayerDescriptor sld = h.parse(file, null, null, null);
// SLDParser stylereader = new SLDParser(sf, file);
// StyledLayerDescriptor sld = stylereader.parseSLD();
style = getDefaultStyle(sld);
return style;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
|
[
"public",
"static",
"Style",
"getStyleFromFile",
"(",
"File",
"file",
")",
"{",
"Style",
"style",
"=",
"null",
";",
"try",
"{",
"String",
"name",
"=",
"file",
".",
"getName",
"(",
")",
";",
"if",
"(",
"!",
"name",
".",
"endsWith",
"(",
"\"sld\"",
")",
")",
"{",
"String",
"nameWithoutExtention",
"=",
"FileUtilities",
".",
"getNameWithoutExtention",
"(",
"file",
")",
";",
"File",
"sldFile",
"=",
"new",
"File",
"(",
"file",
".",
"getParentFile",
"(",
")",
",",
"nameWithoutExtention",
"+",
"\".sld\"",
")",
";",
"if",
"(",
"sldFile",
".",
"exists",
"(",
")",
")",
"{",
"file",
"=",
"sldFile",
";",
"}",
"else",
"{",
"// no style file here",
"return",
"null",
";",
"}",
"}",
"SLDHandler",
"h",
"=",
"new",
"SLDHandler",
"(",
")",
";",
"StyledLayerDescriptor",
"sld",
"=",
"h",
".",
"parse",
"(",
"file",
",",
"null",
",",
"null",
",",
"null",
")",
";",
"// SLDParser stylereader = new SLDParser(sf, file);",
"// StyledLayerDescriptor sld = stylereader.parseSLD();",
"style",
"=",
"getDefaultStyle",
"(",
"sld",
")",
";",
"return",
"style",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"return",
"null",
";",
"}",
"}"
] |
Get the style from an sld file.
@param file the SLD file or a companion file.
@return the {@link Style} object.
@throws IOException
|
[
"Get",
"the",
"style",
"from",
"an",
"sld",
"file",
"."
] |
train
|
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/SldUtilities.java#L86-L111
|
landawn/AbacusUtil
|
src/com/landawn/abacus/util/StringUtil.java
|
StringUtil.wrapIfMissing
|
public static String wrapIfMissing(final String str, final String prefix, final String suffix) {
"""
<pre>
N.wrapIfMissing(null, "[", "]") -> "[]"
N.wrapIfMissing("", "[", "]") -> "[]"
N.wrapIfMissing("[", "[", "]") -> "[]"
N.wrapIfMissing("]", "[", "]") -> "[]"
N.wrapIfMissing("abc", "[", "]") -> "[abc]"
N.wrapIfMissing("a", "aa", "aa") -> "aaaaa"
N.wrapIfMissing("aa", "aa", "aa") -> "aaaa"
N.wrapIfMissing("aaa", "aa", "aa") -> "aaaaa"
N.wrapIfMissing("aaaa", "aa", "aa") -> "aaaa"
</pre>
@param str
@param prefix
@param suffix
@return
"""
N.checkArgNotNull(prefix);
N.checkArgNotNull(suffix);
if (N.isNullOrEmpty(str)) {
return prefix + suffix;
} else if (str.startsWith(prefix)) {
return (str.length() - prefix.length() >= suffix.length() && str.endsWith(suffix)) ? str : str + suffix;
} else if (str.endsWith(suffix)) {
return prefix + str;
} else {
return concat(prefix, str, suffix);
}
}
|
java
|
public static String wrapIfMissing(final String str, final String prefix, final String suffix) {
N.checkArgNotNull(prefix);
N.checkArgNotNull(suffix);
if (N.isNullOrEmpty(str)) {
return prefix + suffix;
} else if (str.startsWith(prefix)) {
return (str.length() - prefix.length() >= suffix.length() && str.endsWith(suffix)) ? str : str + suffix;
} else if (str.endsWith(suffix)) {
return prefix + str;
} else {
return concat(prefix, str, suffix);
}
}
|
[
"public",
"static",
"String",
"wrapIfMissing",
"(",
"final",
"String",
"str",
",",
"final",
"String",
"prefix",
",",
"final",
"String",
"suffix",
")",
"{",
"N",
".",
"checkArgNotNull",
"(",
"prefix",
")",
";",
"N",
".",
"checkArgNotNull",
"(",
"suffix",
")",
";",
"if",
"(",
"N",
".",
"isNullOrEmpty",
"(",
"str",
")",
")",
"{",
"return",
"prefix",
"+",
"suffix",
";",
"}",
"else",
"if",
"(",
"str",
".",
"startsWith",
"(",
"prefix",
")",
")",
"{",
"return",
"(",
"str",
".",
"length",
"(",
")",
"-",
"prefix",
".",
"length",
"(",
")",
">=",
"suffix",
".",
"length",
"(",
")",
"&&",
"str",
".",
"endsWith",
"(",
"suffix",
")",
")",
"?",
"str",
":",
"str",
"+",
"suffix",
";",
"}",
"else",
"if",
"(",
"str",
".",
"endsWith",
"(",
"suffix",
")",
")",
"{",
"return",
"prefix",
"+",
"str",
";",
"}",
"else",
"{",
"return",
"concat",
"(",
"prefix",
",",
"str",
",",
"suffix",
")",
";",
"}",
"}"
] |
<pre>
N.wrapIfMissing(null, "[", "]") -> "[]"
N.wrapIfMissing("", "[", "]") -> "[]"
N.wrapIfMissing("[", "[", "]") -> "[]"
N.wrapIfMissing("]", "[", "]") -> "[]"
N.wrapIfMissing("abc", "[", "]") -> "[abc]"
N.wrapIfMissing("a", "aa", "aa") -> "aaaaa"
N.wrapIfMissing("aa", "aa", "aa") -> "aaaa"
N.wrapIfMissing("aaa", "aa", "aa") -> "aaaaa"
N.wrapIfMissing("aaaa", "aa", "aa") -> "aaaa"
</pre>
@param str
@param prefix
@param suffix
@return
|
[
"<pre",
">",
"N",
".",
"wrapIfMissing",
"(",
"null",
"[",
"]",
")",
"-",
">",
"[]",
"N",
".",
"wrapIfMissing",
"(",
"[",
"]",
")",
"-",
">",
"[]",
"N",
".",
"wrapIfMissing",
"(",
"[",
"[",
"]",
")",
"-",
">",
"[]",
"N",
".",
"wrapIfMissing",
"(",
"]",
"[",
"]",
")",
"-",
">",
"[]",
"N",
".",
"wrapIfMissing",
"(",
"abc",
"[",
"]",
")",
"-",
">",
"[",
"abc",
"]",
"N",
".",
"wrapIfMissing",
"(",
"a",
"aa",
"aa",
")",
"-",
">",
"aaaaa",
"N",
".",
"wrapIfMissing",
"(",
"aa",
"aa",
"aa",
")",
"-",
">",
"aaaa",
"N",
".",
"wrapIfMissing",
"(",
"aaa",
"aa",
"aa",
")",
"-",
">",
"aaaaa",
"N",
".",
"wrapIfMissing",
"(",
"aaaa",
"aa",
"aa",
")",
"-",
">",
"aaaa",
"<",
"/",
"pre",
">"
] |
train
|
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/StringUtil.java#L2331-L2344
|
Azure/azure-sdk-for-java
|
cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/DatabaseAccountsInner.java
|
DatabaseAccountsInner.beginPatchAsync
|
public Observable<DatabaseAccountInner> beginPatchAsync(String resourceGroupName, String accountName, DatabaseAccountPatchParameters updateParameters) {
"""
Patches the properties of an existing Azure Cosmos DB database account.
@param resourceGroupName Name of an Azure resource group.
@param accountName Cosmos DB database account name.
@param updateParameters The tags parameter to patch for the current database account.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the DatabaseAccountInner object
"""
return beginPatchWithServiceResponseAsync(resourceGroupName, accountName, updateParameters).map(new Func1<ServiceResponse<DatabaseAccountInner>, DatabaseAccountInner>() {
@Override
public DatabaseAccountInner call(ServiceResponse<DatabaseAccountInner> response) {
return response.body();
}
});
}
|
java
|
public Observable<DatabaseAccountInner> beginPatchAsync(String resourceGroupName, String accountName, DatabaseAccountPatchParameters updateParameters) {
return beginPatchWithServiceResponseAsync(resourceGroupName, accountName, updateParameters).map(new Func1<ServiceResponse<DatabaseAccountInner>, DatabaseAccountInner>() {
@Override
public DatabaseAccountInner call(ServiceResponse<DatabaseAccountInner> response) {
return response.body();
}
});
}
|
[
"public",
"Observable",
"<",
"DatabaseAccountInner",
">",
"beginPatchAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
",",
"DatabaseAccountPatchParameters",
"updateParameters",
")",
"{",
"return",
"beginPatchWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"accountName",
",",
"updateParameters",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"DatabaseAccountInner",
">",
",",
"DatabaseAccountInner",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"DatabaseAccountInner",
"call",
"(",
"ServiceResponse",
"<",
"DatabaseAccountInner",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] |
Patches the properties of an existing Azure Cosmos DB database account.
@param resourceGroupName Name of an Azure resource group.
@param accountName Cosmos DB database account name.
@param updateParameters The tags parameter to patch for the current database account.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the DatabaseAccountInner object
|
[
"Patches",
"the",
"properties",
"of",
"an",
"existing",
"Azure",
"Cosmos",
"DB",
"database",
"account",
"."
] |
train
|
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/DatabaseAccountsInner.java#L378-L385
|
wanglinsong/thx-webservice
|
src/main/java/com/tascape/qa/th/ws/driver/EndpointHandler.java
|
EndpointHandler.getParameter
|
public static String getParameter(HttpRequest request, String name) throws URISyntaxException {
"""
Gets parameter value of request line.
@param request HTTP request
@param name name of the request line parameter
@return parameter value, only the first is returned if there are multiple values for the same name
@throws URISyntaxException in case of URL issue
"""
NameValuePair nv = URLEncodedUtils.parse(new URI(request.getRequestLine().getUri()), "UTF-8").stream()
.filter(param -> param.getName().equals(name))
.findFirst().get();
if (nv == null) {
return null;
}
return nv.getValue();
}
|
java
|
public static String getParameter(HttpRequest request, String name) throws URISyntaxException {
NameValuePair nv = URLEncodedUtils.parse(new URI(request.getRequestLine().getUri()), "UTF-8").stream()
.filter(param -> param.getName().equals(name))
.findFirst().get();
if (nv == null) {
return null;
}
return nv.getValue();
}
|
[
"public",
"static",
"String",
"getParameter",
"(",
"HttpRequest",
"request",
",",
"String",
"name",
")",
"throws",
"URISyntaxException",
"{",
"NameValuePair",
"nv",
"=",
"URLEncodedUtils",
".",
"parse",
"(",
"new",
"URI",
"(",
"request",
".",
"getRequestLine",
"(",
")",
".",
"getUri",
"(",
")",
")",
",",
"\"UTF-8\"",
")",
".",
"stream",
"(",
")",
".",
"filter",
"(",
"param",
"->",
"param",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"name",
")",
")",
".",
"findFirst",
"(",
")",
".",
"get",
"(",
")",
";",
"if",
"(",
"nv",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"nv",
".",
"getValue",
"(",
")",
";",
"}"
] |
Gets parameter value of request line.
@param request HTTP request
@param name name of the request line parameter
@return parameter value, only the first is returned if there are multiple values for the same name
@throws URISyntaxException in case of URL issue
|
[
"Gets",
"parameter",
"value",
"of",
"request",
"line",
"."
] |
train
|
https://github.com/wanglinsong/thx-webservice/blob/29bc084b09ad35b012eb7c6b5c9ee55337ddee28/src/main/java/com/tascape/qa/th/ws/driver/EndpointHandler.java#L202-L210
|
Azure/azure-sdk-for-java
|
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/PatternsImpl.java
|
PatternsImpl.getIntentPatternsWithServiceResponseAsync
|
public Observable<ServiceResponse<List<PatternRuleInfo>>> getIntentPatternsWithServiceResponseAsync(UUID appId, String versionId, UUID intentId, GetIntentPatternsOptionalParameter getIntentPatternsOptionalParameter) {
"""
Returns patterns to be retrieved for the specific intent.
@param appId The application ID.
@param versionId The version ID.
@param intentId The intent classifier ID.
@param getIntentPatternsOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the List<PatternRuleInfo> object
"""
if (this.client.endpoint() == null) {
throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null.");
}
if (appId == null) {
throw new IllegalArgumentException("Parameter appId is required and cannot be null.");
}
if (versionId == null) {
throw new IllegalArgumentException("Parameter versionId is required and cannot be null.");
}
if (intentId == null) {
throw new IllegalArgumentException("Parameter intentId is required and cannot be null.");
}
final Integer skip = getIntentPatternsOptionalParameter != null ? getIntentPatternsOptionalParameter.skip() : null;
final Integer take = getIntentPatternsOptionalParameter != null ? getIntentPatternsOptionalParameter.take() : null;
return getIntentPatternsWithServiceResponseAsync(appId, versionId, intentId, skip, take);
}
|
java
|
public Observable<ServiceResponse<List<PatternRuleInfo>>> getIntentPatternsWithServiceResponseAsync(UUID appId, String versionId, UUID intentId, GetIntentPatternsOptionalParameter getIntentPatternsOptionalParameter) {
if (this.client.endpoint() == null) {
throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null.");
}
if (appId == null) {
throw new IllegalArgumentException("Parameter appId is required and cannot be null.");
}
if (versionId == null) {
throw new IllegalArgumentException("Parameter versionId is required and cannot be null.");
}
if (intentId == null) {
throw new IllegalArgumentException("Parameter intentId is required and cannot be null.");
}
final Integer skip = getIntentPatternsOptionalParameter != null ? getIntentPatternsOptionalParameter.skip() : null;
final Integer take = getIntentPatternsOptionalParameter != null ? getIntentPatternsOptionalParameter.take() : null;
return getIntentPatternsWithServiceResponseAsync(appId, versionId, intentId, skip, take);
}
|
[
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"List",
"<",
"PatternRuleInfo",
">",
">",
">",
"getIntentPatternsWithServiceResponseAsync",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"UUID",
"intentId",
",",
"GetIntentPatternsOptionalParameter",
"getIntentPatternsOptionalParameter",
")",
"{",
"if",
"(",
"this",
".",
"client",
".",
"endpoint",
"(",
")",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Parameter this.client.endpoint() is required and cannot be null.\"",
")",
";",
"}",
"if",
"(",
"appId",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Parameter appId is required and cannot be null.\"",
")",
";",
"}",
"if",
"(",
"versionId",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Parameter versionId is required and cannot be null.\"",
")",
";",
"}",
"if",
"(",
"intentId",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Parameter intentId is required and cannot be null.\"",
")",
";",
"}",
"final",
"Integer",
"skip",
"=",
"getIntentPatternsOptionalParameter",
"!=",
"null",
"?",
"getIntentPatternsOptionalParameter",
".",
"skip",
"(",
")",
":",
"null",
";",
"final",
"Integer",
"take",
"=",
"getIntentPatternsOptionalParameter",
"!=",
"null",
"?",
"getIntentPatternsOptionalParameter",
".",
"take",
"(",
")",
":",
"null",
";",
"return",
"getIntentPatternsWithServiceResponseAsync",
"(",
"appId",
",",
"versionId",
",",
"intentId",
",",
"skip",
",",
"take",
")",
";",
"}"
] |
Returns patterns to be retrieved for the specific intent.
@param appId The application ID.
@param versionId The version ID.
@param intentId The intent classifier ID.
@param getIntentPatternsOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the List<PatternRuleInfo> object
|
[
"Returns",
"patterns",
"to",
"be",
"retrieved",
"for",
"the",
"specific",
"intent",
"."
] |
train
|
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/PatternsImpl.java#L900-L917
|
alkacon/opencms-core
|
src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorTypes.java
|
CmsMessageBundleEditorTypes.showWarning
|
static void showWarning(final String caption, final String description) {
"""
Displays a localized warning.
@param caption the caption of the warning.
@param description the description of the warning.
"""
Notification warning = new Notification(caption, description, Type.WARNING_MESSAGE, true);
warning.setDelayMsec(-1);
warning.show(UI.getCurrent().getPage());
}
|
java
|
static void showWarning(final String caption, final String description) {
Notification warning = new Notification(caption, description, Type.WARNING_MESSAGE, true);
warning.setDelayMsec(-1);
warning.show(UI.getCurrent().getPage());
}
|
[
"static",
"void",
"showWarning",
"(",
"final",
"String",
"caption",
",",
"final",
"String",
"description",
")",
"{",
"Notification",
"warning",
"=",
"new",
"Notification",
"(",
"caption",
",",
"description",
",",
"Type",
".",
"WARNING_MESSAGE",
",",
"true",
")",
";",
"warning",
".",
"setDelayMsec",
"(",
"-",
"1",
")",
";",
"warning",
".",
"show",
"(",
"UI",
".",
"getCurrent",
"(",
")",
".",
"getPage",
"(",
")",
")",
";",
"}"
] |
Displays a localized warning.
@param caption the caption of the warning.
@param description the description of the warning.
|
[
"Displays",
"a",
"localized",
"warning",
"."
] |
train
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorTypes.java#L1014-L1020
|
unic/neba
|
core/src/main/java/io/neba/core/resourcemodels/metadata/MappedFieldMetaData.java
|
MappedFieldMetaData.getParameterTypeOf
|
private Type getParameterTypeOf(Type type) {
"""
Wraps {@link io.neba.core.util.ReflectionUtil#getLowerBoundOfSingleTypeParameter(java.lang.reflect.Type)}
in order to provide a field-related error message to signal users which field is affected.
"""
try {
return getLowerBoundOfSingleTypeParameter(type);
} catch (Exception e) {
throw new IllegalArgumentException("Unable to resolve a generic parameter type of the mapped field " + this.field + ".", e);
}
}
|
java
|
private Type getParameterTypeOf(Type type) {
try {
return getLowerBoundOfSingleTypeParameter(type);
} catch (Exception e) {
throw new IllegalArgumentException("Unable to resolve a generic parameter type of the mapped field " + this.field + ".", e);
}
}
|
[
"private",
"Type",
"getParameterTypeOf",
"(",
"Type",
"type",
")",
"{",
"try",
"{",
"return",
"getLowerBoundOfSingleTypeParameter",
"(",
"type",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Unable to resolve a generic parameter type of the mapped field \"",
"+",
"this",
".",
"field",
"+",
"\".\"",
",",
"e",
")",
";",
"}",
"}"
] |
Wraps {@link io.neba.core.util.ReflectionUtil#getLowerBoundOfSingleTypeParameter(java.lang.reflect.Type)}
in order to provide a field-related error message to signal users which field is affected.
|
[
"Wraps",
"{"
] |
train
|
https://github.com/unic/neba/blob/4d762e60112a1fcb850926a56a9843d5aa424c4b/core/src/main/java/io/neba/core/resourcemodels/metadata/MappedFieldMetaData.java#L142-L148
|
phax/ph-bdve
|
ph-bdve-ubl/src/main/java/com/helger/bdve/ubl/UBLValidation.java
|
UBLValidation.initUBL21
|
public static void initUBL21 (@Nonnull final ValidationExecutorSetRegistry aRegistry) {
"""
Register all standard UBL 2.1 validation execution sets to the provided
registry.
@param aRegistry
The registry to add the artefacts. May not be <code>null</code>.
"""
ValueEnforcer.notNull (aRegistry, "Registry");
// For better error messages
LocationBeautifierSPI.addMappings (UBL21NamespaceContext.getInstance ());
final boolean bNotDeprecated = false;
for (final EUBL21DocumentType e : EUBL21DocumentType.values ())
{
final String sName = e.getLocalName ();
final VESID aVESID = new VESID (GROUP_ID, sName.toLowerCase (Locale.US), VERSION_21);
// No Schematrons here
aRegistry.registerValidationExecutorSet (ValidationExecutorSet.create (aVESID,
"UBL " + sName + " " + VERSION_21,
bNotDeprecated,
ValidationExecutorXSD.create (e)));
}
}
|
java
|
public static void initUBL21 (@Nonnull final ValidationExecutorSetRegistry aRegistry)
{
ValueEnforcer.notNull (aRegistry, "Registry");
// For better error messages
LocationBeautifierSPI.addMappings (UBL21NamespaceContext.getInstance ());
final boolean bNotDeprecated = false;
for (final EUBL21DocumentType e : EUBL21DocumentType.values ())
{
final String sName = e.getLocalName ();
final VESID aVESID = new VESID (GROUP_ID, sName.toLowerCase (Locale.US), VERSION_21);
// No Schematrons here
aRegistry.registerValidationExecutorSet (ValidationExecutorSet.create (aVESID,
"UBL " + sName + " " + VERSION_21,
bNotDeprecated,
ValidationExecutorXSD.create (e)));
}
}
|
[
"public",
"static",
"void",
"initUBL21",
"(",
"@",
"Nonnull",
"final",
"ValidationExecutorSetRegistry",
"aRegistry",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"aRegistry",
",",
"\"Registry\"",
")",
";",
"// For better error messages",
"LocationBeautifierSPI",
".",
"addMappings",
"(",
"UBL21NamespaceContext",
".",
"getInstance",
"(",
")",
")",
";",
"final",
"boolean",
"bNotDeprecated",
"=",
"false",
";",
"for",
"(",
"final",
"EUBL21DocumentType",
"e",
":",
"EUBL21DocumentType",
".",
"values",
"(",
")",
")",
"{",
"final",
"String",
"sName",
"=",
"e",
".",
"getLocalName",
"(",
")",
";",
"final",
"VESID",
"aVESID",
"=",
"new",
"VESID",
"(",
"GROUP_ID",
",",
"sName",
".",
"toLowerCase",
"(",
"Locale",
".",
"US",
")",
",",
"VERSION_21",
")",
";",
"// No Schematrons here",
"aRegistry",
".",
"registerValidationExecutorSet",
"(",
"ValidationExecutorSet",
".",
"create",
"(",
"aVESID",
",",
"\"UBL \"",
"+",
"sName",
"+",
"\" \"",
"+",
"VERSION_21",
",",
"bNotDeprecated",
",",
"ValidationExecutorXSD",
".",
"create",
"(",
"e",
")",
")",
")",
";",
"}",
"}"
] |
Register all standard UBL 2.1 validation execution sets to the provided
registry.
@param aRegistry
The registry to add the artefacts. May not be <code>null</code>.
|
[
"Register",
"all",
"standard",
"UBL",
"2",
".",
"1",
"validation",
"execution",
"sets",
"to",
"the",
"provided",
"registry",
"."
] |
train
|
https://github.com/phax/ph-bdve/blob/2438f491174cd8989567fcdf129b273bd217e89f/ph-bdve-ubl/src/main/java/com/helger/bdve/ubl/UBLValidation.java#L370-L389
|
groupon/odo
|
browsermob-proxy/src/main/java/com/groupon/odo/bmp/KeyStoreManager.java
|
KeyStoreManager.createKeystore
|
protected void createKeystore() {
"""
Creates, writes and loads a new keystore and CA root certificate.
"""
java.security.cert.Certificate signingCert = null;
PrivateKey caPrivKey = null;
if(_caCert == null || _caPrivKey == null)
{
try
{
log.debug("Keystore or signing cert & keypair not found. Generating...");
KeyPair caKeypair = getRSAKeyPair();
caPrivKey = caKeypair.getPrivate();
signingCert = CertificateCreator.createTypicalMasterCert(caKeypair);
log.debug("Done generating signing cert");
log.debug(signingCert);
_ks.load(null, _keystorepass);
_ks.setCertificateEntry(_caCertAlias, signingCert);
_ks.setKeyEntry(_caPrivKeyAlias, caPrivKey, _keypassword, new java.security.cert.Certificate[] {signingCert});
File caKsFile = new File(root, _caPrivateKeystore);
OutputStream os = new FileOutputStream(caKsFile);
_ks.store(os, _keystorepass);
log.debug("Wrote JKS keystore to: " +
caKsFile.getAbsolutePath());
// also export a .cer that can be imported as a trusted root
// to disable all warning dialogs for interception
File signingCertFile = new File(root, EXPORTED_CERT_NAME);
FileOutputStream cerOut = new FileOutputStream(signingCertFile);
byte[] buf = signingCert.getEncoded();
log.debug("Wrote signing cert to: " + signingCertFile.getAbsolutePath());
cerOut.write(buf);
cerOut.flush();
cerOut.close();
_caCert = (X509Certificate)signingCert;
_caPrivKey = caPrivKey;
}
catch(Exception e)
{
log.error("Fatal error creating/storing keystore or signing cert.", e);
throw new Error(e);
}
}
else
{
log.debug("Successfully loaded keystore.");
log.debug(_caCert);
}
}
|
java
|
protected void createKeystore() {
java.security.cert.Certificate signingCert = null;
PrivateKey caPrivKey = null;
if(_caCert == null || _caPrivKey == null)
{
try
{
log.debug("Keystore or signing cert & keypair not found. Generating...");
KeyPair caKeypair = getRSAKeyPair();
caPrivKey = caKeypair.getPrivate();
signingCert = CertificateCreator.createTypicalMasterCert(caKeypair);
log.debug("Done generating signing cert");
log.debug(signingCert);
_ks.load(null, _keystorepass);
_ks.setCertificateEntry(_caCertAlias, signingCert);
_ks.setKeyEntry(_caPrivKeyAlias, caPrivKey, _keypassword, new java.security.cert.Certificate[] {signingCert});
File caKsFile = new File(root, _caPrivateKeystore);
OutputStream os = new FileOutputStream(caKsFile);
_ks.store(os, _keystorepass);
log.debug("Wrote JKS keystore to: " +
caKsFile.getAbsolutePath());
// also export a .cer that can be imported as a trusted root
// to disable all warning dialogs for interception
File signingCertFile = new File(root, EXPORTED_CERT_NAME);
FileOutputStream cerOut = new FileOutputStream(signingCertFile);
byte[] buf = signingCert.getEncoded();
log.debug("Wrote signing cert to: " + signingCertFile.getAbsolutePath());
cerOut.write(buf);
cerOut.flush();
cerOut.close();
_caCert = (X509Certificate)signingCert;
_caPrivKey = caPrivKey;
}
catch(Exception e)
{
log.error("Fatal error creating/storing keystore or signing cert.", e);
throw new Error(e);
}
}
else
{
log.debug("Successfully loaded keystore.");
log.debug(_caCert);
}
}
|
[
"protected",
"void",
"createKeystore",
"(",
")",
"{",
"java",
".",
"security",
".",
"cert",
".",
"Certificate",
"signingCert",
"=",
"null",
";",
"PrivateKey",
"caPrivKey",
"=",
"null",
";",
"if",
"(",
"_caCert",
"==",
"null",
"||",
"_caPrivKey",
"==",
"null",
")",
"{",
"try",
"{",
"log",
".",
"debug",
"(",
"\"Keystore or signing cert & keypair not found. Generating...\"",
")",
";",
"KeyPair",
"caKeypair",
"=",
"getRSAKeyPair",
"(",
")",
";",
"caPrivKey",
"=",
"caKeypair",
".",
"getPrivate",
"(",
")",
";",
"signingCert",
"=",
"CertificateCreator",
".",
"createTypicalMasterCert",
"(",
"caKeypair",
")",
";",
"log",
".",
"debug",
"(",
"\"Done generating signing cert\"",
")",
";",
"log",
".",
"debug",
"(",
"signingCert",
")",
";",
"_ks",
".",
"load",
"(",
"null",
",",
"_keystorepass",
")",
";",
"_ks",
".",
"setCertificateEntry",
"(",
"_caCertAlias",
",",
"signingCert",
")",
";",
"_ks",
".",
"setKeyEntry",
"(",
"_caPrivKeyAlias",
",",
"caPrivKey",
",",
"_keypassword",
",",
"new",
"java",
".",
"security",
".",
"cert",
".",
"Certificate",
"[",
"]",
"{",
"signingCert",
"}",
")",
";",
"File",
"caKsFile",
"=",
"new",
"File",
"(",
"root",
",",
"_caPrivateKeystore",
")",
";",
"OutputStream",
"os",
"=",
"new",
"FileOutputStream",
"(",
"caKsFile",
")",
";",
"_ks",
".",
"store",
"(",
"os",
",",
"_keystorepass",
")",
";",
"log",
".",
"debug",
"(",
"\"Wrote JKS keystore to: \"",
"+",
"caKsFile",
".",
"getAbsolutePath",
"(",
")",
")",
";",
"// also export a .cer that can be imported as a trusted root",
"// to disable all warning dialogs for interception",
"File",
"signingCertFile",
"=",
"new",
"File",
"(",
"root",
",",
"EXPORTED_CERT_NAME",
")",
";",
"FileOutputStream",
"cerOut",
"=",
"new",
"FileOutputStream",
"(",
"signingCertFile",
")",
";",
"byte",
"[",
"]",
"buf",
"=",
"signingCert",
".",
"getEncoded",
"(",
")",
";",
"log",
".",
"debug",
"(",
"\"Wrote signing cert to: \"",
"+",
"signingCertFile",
".",
"getAbsolutePath",
"(",
")",
")",
";",
"cerOut",
".",
"write",
"(",
"buf",
")",
";",
"cerOut",
".",
"flush",
"(",
")",
";",
"cerOut",
".",
"close",
"(",
")",
";",
"_caCert",
"=",
"(",
"X509Certificate",
")",
"signingCert",
";",
"_caPrivKey",
"=",
"caPrivKey",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"log",
".",
"error",
"(",
"\"Fatal error creating/storing keystore or signing cert.\"",
",",
"e",
")",
";",
"throw",
"new",
"Error",
"(",
"e",
")",
";",
"}",
"}",
"else",
"{",
"log",
".",
"debug",
"(",
"\"Successfully loaded keystore.\"",
")",
";",
"log",
".",
"debug",
"(",
"_caCert",
")",
";",
"}",
"}"
] |
Creates, writes and loads a new keystore and CA root certificate.
|
[
"Creates",
"writes",
"and",
"loads",
"a",
"new",
"keystore",
"and",
"CA",
"root",
"certificate",
"."
] |
train
|
https://github.com/groupon/odo/blob/3bae43d5eca8ace036775e5b2d3ed9af1a9ff9b1/browsermob-proxy/src/main/java/com/groupon/odo/bmp/KeyStoreManager.java#L475-L537
|
BorderTech/wcomponents
|
wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/layout/ColumnLayoutExample.java
|
ColumnLayoutExample.addHgapVGapExample
|
private void addHgapVGapExample(final Size hgap, final Size vgap) {
"""
Build an example using hgap and vgap.
@param hgap the hgap width
@param vgap the vgap width
"""
add(new WHeading(HeadingLevel.H2, "Column Layout: hgap=" + hgap.toString() + " vgap=" + vgap.toString()));
WPanel panel = new WPanel();
panel.setLayout(new ColumnLayout(new int[]{25, 25, 25, 25}, hgap, vgap));
add(panel);
for (int i = 0; i < 8; i++) {
panel.add(new BoxComponent("25%"));
}
add(new WHorizontalRule());
}
|
java
|
private void addHgapVGapExample(final Size hgap, final Size vgap) {
add(new WHeading(HeadingLevel.H2, "Column Layout: hgap=" + hgap.toString() + " vgap=" + vgap.toString()));
WPanel panel = new WPanel();
panel.setLayout(new ColumnLayout(new int[]{25, 25, 25, 25}, hgap, vgap));
add(panel);
for (int i = 0; i < 8; i++) {
panel.add(new BoxComponent("25%"));
}
add(new WHorizontalRule());
}
|
[
"private",
"void",
"addHgapVGapExample",
"(",
"final",
"Size",
"hgap",
",",
"final",
"Size",
"vgap",
")",
"{",
"add",
"(",
"new",
"WHeading",
"(",
"HeadingLevel",
".",
"H2",
",",
"\"Column Layout: hgap=\"",
"+",
"hgap",
".",
"toString",
"(",
")",
"+",
"\" vgap=\"",
"+",
"vgap",
".",
"toString",
"(",
")",
")",
")",
";",
"WPanel",
"panel",
"=",
"new",
"WPanel",
"(",
")",
";",
"panel",
".",
"setLayout",
"(",
"new",
"ColumnLayout",
"(",
"new",
"int",
"[",
"]",
"{",
"25",
",",
"25",
",",
"25",
",",
"25",
"}",
",",
"hgap",
",",
"vgap",
")",
")",
";",
"add",
"(",
"panel",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"8",
";",
"i",
"++",
")",
"{",
"panel",
".",
"add",
"(",
"new",
"BoxComponent",
"(",
"\"25%\"",
")",
")",
";",
"}",
"add",
"(",
"new",
"WHorizontalRule",
"(",
")",
")",
";",
"}"
] |
Build an example using hgap and vgap.
@param hgap the hgap width
@param vgap the vgap width
|
[
"Build",
"an",
"example",
"using",
"hgap",
"and",
"vgap",
"."
] |
train
|
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/layout/ColumnLayoutExample.java#L115-L126
|
liferay/com-liferay-commerce
|
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPRuleAssetCategoryRelPersistenceImpl.java
|
CPRuleAssetCategoryRelPersistenceImpl.findAll
|
@Override
public List<CPRuleAssetCategoryRel> findAll() {
"""
Returns all the cp rule asset category rels.
@return the cp rule asset category rels
"""
return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
}
|
java
|
@Override
public List<CPRuleAssetCategoryRel> findAll() {
return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
}
|
[
"@",
"Override",
"public",
"List",
"<",
"CPRuleAssetCategoryRel",
">",
"findAll",
"(",
")",
"{",
"return",
"findAll",
"(",
"QueryUtil",
".",
"ALL_POS",
",",
"QueryUtil",
".",
"ALL_POS",
",",
"null",
")",
";",
"}"
] |
Returns all the cp rule asset category rels.
@return the cp rule asset category rels
|
[
"Returns",
"all",
"the",
"cp",
"rule",
"asset",
"category",
"rels",
"."
] |
train
|
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPRuleAssetCategoryRelPersistenceImpl.java#L1666-L1669
|
fozziethebeat/S-Space
|
src/main/java/edu/ucla/sspace/util/Properties.java
|
Properties.getProperty
|
public int getProperty(String propName, int defaultValue) {
"""
Returns the integer value of the property associated with {@code propName},
or {@code defaultValue} if there is no property.
"""
String propValue = props.getProperty(propName);
return (propValue == null) ? defaultValue : Integer.parseInt(propValue);
}
|
java
|
public int getProperty(String propName, int defaultValue) {
String propValue = props.getProperty(propName);
return (propValue == null) ? defaultValue : Integer.parseInt(propValue);
}
|
[
"public",
"int",
"getProperty",
"(",
"String",
"propName",
",",
"int",
"defaultValue",
")",
"{",
"String",
"propValue",
"=",
"props",
".",
"getProperty",
"(",
"propName",
")",
";",
"return",
"(",
"propValue",
"==",
"null",
")",
"?",
"defaultValue",
":",
"Integer",
".",
"parseInt",
"(",
"propValue",
")",
";",
"}"
] |
Returns the integer value of the property associated with {@code propName},
or {@code defaultValue} if there is no property.
|
[
"Returns",
"the",
"integer",
"value",
"of",
"the",
"property",
"associated",
"with",
"{"
] |
train
|
https://github.com/fozziethebeat/S-Space/blob/a608102737dfd3d59038a9ead33fe60356bc6029/src/main/java/edu/ucla/sspace/util/Properties.java#L73-L76
|
elki-project/elki
|
elki-core-dbids/src/main/java/de/lmu/ifi/dbs/elki/database/datastore/DataStoreUtil.java
|
DataStoreUtil.makeDoubleStorage
|
public static WritableDoubleDataStore makeDoubleStorage(DBIDs ids, int hints) {
"""
Make a new storage, to associate the given ids with an object of class
dataclass.
@param ids DBIDs to store data for
@param hints Hints for the storage manager
@return new data store
"""
return DataStoreFactory.FACTORY.makeDoubleStorage(ids, hints);
}
|
java
|
public static WritableDoubleDataStore makeDoubleStorage(DBIDs ids, int hints) {
return DataStoreFactory.FACTORY.makeDoubleStorage(ids, hints);
}
|
[
"public",
"static",
"WritableDoubleDataStore",
"makeDoubleStorage",
"(",
"DBIDs",
"ids",
",",
"int",
"hints",
")",
"{",
"return",
"DataStoreFactory",
".",
"FACTORY",
".",
"makeDoubleStorage",
"(",
"ids",
",",
"hints",
")",
";",
"}"
] |
Make a new storage, to associate the given ids with an object of class
dataclass.
@param ids DBIDs to store data for
@param hints Hints for the storage manager
@return new data store
|
[
"Make",
"a",
"new",
"storage",
"to",
"associate",
"the",
"given",
"ids",
"with",
"an",
"object",
"of",
"class",
"dataclass",
"."
] |
train
|
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-dbids/src/main/java/de/lmu/ifi/dbs/elki/database/datastore/DataStoreUtil.java#L87-L89
|
dnsjava/dnsjava
|
org/xbill/DNS/TXTBase.java
|
TXTBase.getStrings
|
public List
getStrings() {
"""
Returns the text strings
@return A list of Strings corresponding to the text strings.
"""
List list = new ArrayList(strings.size());
for (int i = 0; i < strings.size(); i++)
list.add(byteArrayToString((byte []) strings.get(i), false));
return list;
}
/**
* Returns the text strings
* @return A list of byte arrays corresponding to the text strings.
*/
public List
getStringsAsByteArrays() {
return strings;
}
void
rrToWire(DNSOutput out, Compression c, boolean canonical) {
Iterator it = strings.iterator();
while (it.hasNext()) {
byte [] b = (byte []) it.next();
out.writeCountedString(b);
}
}
}
|
java
|
public List
getStrings() {
List list = new ArrayList(strings.size());
for (int i = 0; i < strings.size(); i++)
list.add(byteArrayToString((byte []) strings.get(i), false));
return list;
}
/**
* Returns the text strings
* @return A list of byte arrays corresponding to the text strings.
*/
public List
getStringsAsByteArrays() {
return strings;
}
void
rrToWire(DNSOutput out, Compression c, boolean canonical) {
Iterator it = strings.iterator();
while (it.hasNext()) {
byte [] b = (byte []) it.next();
out.writeCountedString(b);
}
}
}
|
[
"public",
"List",
"getStrings",
"(",
")",
"{",
"List",
"list",
"=",
"new",
"ArrayList",
"(",
"strings",
".",
"size",
"(",
")",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"strings",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"list",
".",
"(",
"byteArrayToString",
"(",
"(",
"byte",
"[",
"]",
")",
"strings",
".",
"get",
"(",
"i",
")",
",",
"false",
")",
")",
";",
"return",
"list",
";",
"}",
"/**\n * Returns the text strings\n * @return A list of byte arrays corresponding to the text strings.\n */",
"public",
"List",
"getStringsAsByteArrays",
"(",
")",
"{",
"return",
"strings",
";",
"}",
"void",
"rrToWire",
"",
"(",
"DNSOutput",
"out",
",",
"Compression",
"c",
",",
"boolean",
"canonical",
")",
"{",
"Iterator",
"it",
"=",
"strings",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"it",
".",
"hasNext",
"(",
")",
")",
"{",
"byte",
"[",
"]",
"b",
"=",
"(",
"byte",
"[",
"]",
")",
"it",
".",
"next",
"(",
")",
";",
"out",
".",
"writeCountedString",
"(",
"b",
")",
";",
"}",
"}",
"}"
] |
Returns the text strings
@return A list of Strings corresponding to the text strings.
|
[
"Returns",
"the",
"text",
"strings"
] |
train
|
https://github.com/dnsjava/dnsjava/blob/d97b6a0685d59143372bb392ab591dd8dd840b61/org/xbill/DNS/TXTBase.java#L97-L123
|
liferay/com-liferay-commerce
|
commerce-price-list-service/src/main/java/com/liferay/commerce/price/list/service/persistence/impl/CommercePriceListAccountRelPersistenceImpl.java
|
CommercePriceListAccountRelPersistenceImpl.removeByUuid_C
|
@Override
public void removeByUuid_C(String uuid, long companyId) {
"""
Removes all the commerce price list account rels where uuid = ? and companyId = ? from the database.
@param uuid the uuid
@param companyId the company ID
"""
for (CommercePriceListAccountRel commercePriceListAccountRel : findByUuid_C(
uuid, companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
remove(commercePriceListAccountRel);
}
}
|
java
|
@Override
public void removeByUuid_C(String uuid, long companyId) {
for (CommercePriceListAccountRel commercePriceListAccountRel : findByUuid_C(
uuid, companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
remove(commercePriceListAccountRel);
}
}
|
[
"@",
"Override",
"public",
"void",
"removeByUuid_C",
"(",
"String",
"uuid",
",",
"long",
"companyId",
")",
"{",
"for",
"(",
"CommercePriceListAccountRel",
"commercePriceListAccountRel",
":",
"findByUuid_C",
"(",
"uuid",
",",
"companyId",
",",
"QueryUtil",
".",
"ALL_POS",
",",
"QueryUtil",
".",
"ALL_POS",
",",
"null",
")",
")",
"{",
"remove",
"(",
"commercePriceListAccountRel",
")",
";",
"}",
"}"
] |
Removes all the commerce price list account rels where uuid = ? and companyId = ? from the database.
@param uuid the uuid
@param companyId the company ID
|
[
"Removes",
"all",
"the",
"commerce",
"price",
"list",
"account",
"rels",
"where",
"uuid",
"=",
"?",
";",
"and",
"companyId",
"=",
"?",
";",
"from",
"the",
"database",
"."
] |
train
|
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-price-list-service/src/main/java/com/liferay/commerce/price/list/service/persistence/impl/CommercePriceListAccountRelPersistenceImpl.java#L1428-L1434
|
apache/incubator-shardingsphere
|
sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/old/parser/sql/SQLParserFactory.java
|
SQLParserFactory.newInstance
|
public static SQLParser newInstance(final DatabaseType dbType, final EncryptRule encryptRule, final ShardingTableMetaData shardingTableMetaData, final String sql) {
"""
Create Encrypt SQL parser.
@param dbType db type
@param encryptRule encrypt rule
@param shardingTableMetaData sharding table meta data
@param sql sql
@return sql parser
"""
if (DatabaseType.MySQL == dbType || DatabaseType.H2 == dbType) {
return new AntlrParsingEngine(dbType, sql, encryptRule, shardingTableMetaData);
}
throw new SQLParsingUnsupportedException(String.format("Can not support %s", dbType));
}
|
java
|
public static SQLParser newInstance(final DatabaseType dbType, final EncryptRule encryptRule, final ShardingTableMetaData shardingTableMetaData, final String sql) {
if (DatabaseType.MySQL == dbType || DatabaseType.H2 == dbType) {
return new AntlrParsingEngine(dbType, sql, encryptRule, shardingTableMetaData);
}
throw new SQLParsingUnsupportedException(String.format("Can not support %s", dbType));
}
|
[
"public",
"static",
"SQLParser",
"newInstance",
"(",
"final",
"DatabaseType",
"dbType",
",",
"final",
"EncryptRule",
"encryptRule",
",",
"final",
"ShardingTableMetaData",
"shardingTableMetaData",
",",
"final",
"String",
"sql",
")",
"{",
"if",
"(",
"DatabaseType",
".",
"MySQL",
"==",
"dbType",
"||",
"DatabaseType",
".",
"H2",
"==",
"dbType",
")",
"{",
"return",
"new",
"AntlrParsingEngine",
"(",
"dbType",
",",
"sql",
",",
"encryptRule",
",",
"shardingTableMetaData",
")",
";",
"}",
"throw",
"new",
"SQLParsingUnsupportedException",
"(",
"String",
".",
"format",
"(",
"\"Can not support %s\"",
",",
"dbType",
")",
")",
";",
"}"
] |
Create Encrypt SQL parser.
@param dbType db type
@param encryptRule encrypt rule
@param shardingTableMetaData sharding table meta data
@param sql sql
@return sql parser
|
[
"Create",
"Encrypt",
"SQL",
"parser",
"."
] |
train
|
https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/old/parser/sql/SQLParserFactory.java#L125-L130
|
wmdietl/jsr308-langtools
|
src/share/classes/com/sun/tools/javac/comp/Resolve.java
|
Resolve.findGlobalType
|
Symbol findGlobalType(Env<AttrContext> env, Scope scope, Name name) {
"""
Find a global type in given scope and load corresponding class.
@param env The current environment.
@param scope The scope in which to look for the type.
@param name The type's name.
"""
Symbol bestSoFar = typeNotFound;
for (Scope.Entry e = scope.lookup(name); e.scope != null; e = e.next()) {
Symbol sym = loadClass(env, e.sym.flatName());
if (bestSoFar.kind == TYP && sym.kind == TYP &&
bestSoFar != sym)
return new AmbiguityError(bestSoFar, sym);
else if (sym.kind < bestSoFar.kind)
bestSoFar = sym;
}
return bestSoFar;
}
|
java
|
Symbol findGlobalType(Env<AttrContext> env, Scope scope, Name name) {
Symbol bestSoFar = typeNotFound;
for (Scope.Entry e = scope.lookup(name); e.scope != null; e = e.next()) {
Symbol sym = loadClass(env, e.sym.flatName());
if (bestSoFar.kind == TYP && sym.kind == TYP &&
bestSoFar != sym)
return new AmbiguityError(bestSoFar, sym);
else if (sym.kind < bestSoFar.kind)
bestSoFar = sym;
}
return bestSoFar;
}
|
[
"Symbol",
"findGlobalType",
"(",
"Env",
"<",
"AttrContext",
">",
"env",
",",
"Scope",
"scope",
",",
"Name",
"name",
")",
"{",
"Symbol",
"bestSoFar",
"=",
"typeNotFound",
";",
"for",
"(",
"Scope",
".",
"Entry",
"e",
"=",
"scope",
".",
"lookup",
"(",
"name",
")",
";",
"e",
".",
"scope",
"!=",
"null",
";",
"e",
"=",
"e",
".",
"next",
"(",
")",
")",
"{",
"Symbol",
"sym",
"=",
"loadClass",
"(",
"env",
",",
"e",
".",
"sym",
".",
"flatName",
"(",
")",
")",
";",
"if",
"(",
"bestSoFar",
".",
"kind",
"==",
"TYP",
"&&",
"sym",
".",
"kind",
"==",
"TYP",
"&&",
"bestSoFar",
"!=",
"sym",
")",
"return",
"new",
"AmbiguityError",
"(",
"bestSoFar",
",",
"sym",
")",
";",
"else",
"if",
"(",
"sym",
".",
"kind",
"<",
"bestSoFar",
".",
"kind",
")",
"bestSoFar",
"=",
"sym",
";",
"}",
"return",
"bestSoFar",
";",
"}"
] |
Find a global type in given scope and load corresponding class.
@param env The current environment.
@param scope The scope in which to look for the type.
@param name The type's name.
|
[
"Find",
"a",
"global",
"type",
"in",
"given",
"scope",
"and",
"load",
"corresponding",
"class",
"."
] |
train
|
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/comp/Resolve.java#L2004-L2015
|
nguillaumin/slick2d-maven
|
slick2d-core/src/main/java/org/newdawn/slick/tiled/TiledMap.java
|
TiledMap.getTileImage
|
public Image getTileImage(int x, int y, int layerIndex) {
"""
Gets the Image used to draw the tile at the given x and y coordinates.
@param x
The x coordinate of the tile whose image should be retrieved
@param y
The y coordinate of the tile whose image should be retrieved
@param layerIndex
The index of the layer on which the tile whose image should be
retrieve exists
@return The image used to draw the specified tile or null if there is no
image for the specified tile.
"""
Layer layer = (Layer) layers.get(layerIndex);
int tileSetIndex = layer.data[x][y][0];
if ((tileSetIndex >= 0) && (tileSetIndex < tileSets.size())) {
TileSet tileSet = (TileSet) tileSets.get(tileSetIndex);
int sheetX = tileSet.getTileX(layer.data[x][y][1]);
int sheetY = tileSet.getTileY(layer.data[x][y][1]);
return tileSet.tiles.getSprite(sheetX, sheetY);
}
return null;
}
|
java
|
public Image getTileImage(int x, int y, int layerIndex) {
Layer layer = (Layer) layers.get(layerIndex);
int tileSetIndex = layer.data[x][y][0];
if ((tileSetIndex >= 0) && (tileSetIndex < tileSets.size())) {
TileSet tileSet = (TileSet) tileSets.get(tileSetIndex);
int sheetX = tileSet.getTileX(layer.data[x][y][1]);
int sheetY = tileSet.getTileY(layer.data[x][y][1]);
return tileSet.tiles.getSprite(sheetX, sheetY);
}
return null;
}
|
[
"public",
"Image",
"getTileImage",
"(",
"int",
"x",
",",
"int",
"y",
",",
"int",
"layerIndex",
")",
"{",
"Layer",
"layer",
"=",
"(",
"Layer",
")",
"layers",
".",
"get",
"(",
"layerIndex",
")",
";",
"int",
"tileSetIndex",
"=",
"layer",
".",
"data",
"[",
"x",
"]",
"[",
"y",
"]",
"[",
"0",
"]",
";",
"if",
"(",
"(",
"tileSetIndex",
">=",
"0",
")",
"&&",
"(",
"tileSetIndex",
"<",
"tileSets",
".",
"size",
"(",
")",
")",
")",
"{",
"TileSet",
"tileSet",
"=",
"(",
"TileSet",
")",
"tileSets",
".",
"get",
"(",
"tileSetIndex",
")",
";",
"int",
"sheetX",
"=",
"tileSet",
".",
"getTileX",
"(",
"layer",
".",
"data",
"[",
"x",
"]",
"[",
"y",
"]",
"[",
"1",
"]",
")",
";",
"int",
"sheetY",
"=",
"tileSet",
".",
"getTileY",
"(",
"layer",
".",
"data",
"[",
"x",
"]",
"[",
"y",
"]",
"[",
"1",
"]",
")",
";",
"return",
"tileSet",
".",
"tiles",
".",
"getSprite",
"(",
"sheetX",
",",
"sheetY",
")",
";",
"}",
"return",
"null",
";",
"}"
] |
Gets the Image used to draw the tile at the given x and y coordinates.
@param x
The x coordinate of the tile whose image should be retrieved
@param y
The y coordinate of the tile whose image should be retrieved
@param layerIndex
The index of the layer on which the tile whose image should be
retrieve exists
@return The image used to draw the specified tile or null if there is no
image for the specified tile.
|
[
"Gets",
"the",
"Image",
"used",
"to",
"draw",
"the",
"tile",
"at",
"the",
"given",
"x",
"and",
"y",
"coordinates",
"."
] |
train
|
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/tiled/TiledMap.java#L196-L210
|
threerings/nenya
|
core/src/main/java/com/threerings/openal/Listener.java
|
Listener.setOrientation
|
public void setOrientation (float ax, float ay, float az, float ux, float uy, float uz) {
"""
Sets the orientation of the listener in terms of an "at" (direction) and "up" vector.
"""
if (_ax != ax || _ay != ay || _az != az || _ux != ux || _uy != uy || _uz != uz) {
_vbuf.put(_ax = ax).put(_ay = ay).put(_az = az);
_vbuf.put(_ux = ux).put(_uy = uy).put(_uz = uz).rewind();
AL10.alListener(AL10.AL_ORIENTATION, _vbuf);
}
}
|
java
|
public void setOrientation (float ax, float ay, float az, float ux, float uy, float uz)
{
if (_ax != ax || _ay != ay || _az != az || _ux != ux || _uy != uy || _uz != uz) {
_vbuf.put(_ax = ax).put(_ay = ay).put(_az = az);
_vbuf.put(_ux = ux).put(_uy = uy).put(_uz = uz).rewind();
AL10.alListener(AL10.AL_ORIENTATION, _vbuf);
}
}
|
[
"public",
"void",
"setOrientation",
"(",
"float",
"ax",
",",
"float",
"ay",
",",
"float",
"az",
",",
"float",
"ux",
",",
"float",
"uy",
",",
"float",
"uz",
")",
"{",
"if",
"(",
"_ax",
"!=",
"ax",
"||",
"_ay",
"!=",
"ay",
"||",
"_az",
"!=",
"az",
"||",
"_ux",
"!=",
"ux",
"||",
"_uy",
"!=",
"uy",
"||",
"_uz",
"!=",
"uz",
")",
"{",
"_vbuf",
".",
"put",
"(",
"_ax",
"=",
"ax",
")",
".",
"put",
"(",
"_ay",
"=",
"ay",
")",
".",
"put",
"(",
"_az",
"=",
"az",
")",
";",
"_vbuf",
".",
"put",
"(",
"_ux",
"=",
"ux",
")",
".",
"put",
"(",
"_uy",
"=",
"uy",
")",
".",
"put",
"(",
"_uz",
"=",
"uz",
")",
".",
"rewind",
"(",
")",
";",
"AL10",
".",
"alListener",
"(",
"AL10",
".",
"AL_ORIENTATION",
",",
"_vbuf",
")",
";",
"}",
"}"
] |
Sets the orientation of the listener in terms of an "at" (direction) and "up" vector.
|
[
"Sets",
"the",
"orientation",
"of",
"the",
"listener",
"in",
"terms",
"of",
"an",
"at",
"(",
"direction",
")",
"and",
"up",
"vector",
"."
] |
train
|
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/openal/Listener.java#L89-L96
|
FINRAOS/JTAF-ExtWebDriver
|
src/main/java/org/finra/jtaf/ewd/timer/WaitForConditionTimer.java
|
WaitForConditionTimer.waitUntil
|
public void waitUntil(long waitTime) throws WidgetTimeoutException {
"""
Blocks for a given time, or until the associated condition is met. The
associated condition is checked every half second.
<p>
Only an {@link InterruptedException} will prematurely halt the waiting
process.
@param waitTime
the time to wait in milliseconds
@throws WidgetTimeoutException
"""
long currentTimeMillis = System.currentTimeMillis();
long maxRequestTimeout = waitTime;
long endTime = currentTimeMillis + maxRequestTimeout;
while (System.currentTimeMillis() < endTime) {
try {
if (timerCallback.execute())
return;
Thread.sleep(500);
} catch (InterruptedException e1) {
throw new WidgetTimeoutException("The request has timed out", locator);
} catch (Exception e) {
// ignore any other type of Exception and continue
logger.debug(" Exception while waiting. " + "Ignoring and continuing to wait. ", e);
}
}
throw new WidgetTimeoutException("Timed out performing action " + timerCallback, locator);
}
|
java
|
public void waitUntil(long waitTime) throws WidgetTimeoutException {
long currentTimeMillis = System.currentTimeMillis();
long maxRequestTimeout = waitTime;
long endTime = currentTimeMillis + maxRequestTimeout;
while (System.currentTimeMillis() < endTime) {
try {
if (timerCallback.execute())
return;
Thread.sleep(500);
} catch (InterruptedException e1) {
throw new WidgetTimeoutException("The request has timed out", locator);
} catch (Exception e) {
// ignore any other type of Exception and continue
logger.debug(" Exception while waiting. " + "Ignoring and continuing to wait. ", e);
}
}
throw new WidgetTimeoutException("Timed out performing action " + timerCallback, locator);
}
|
[
"public",
"void",
"waitUntil",
"(",
"long",
"waitTime",
")",
"throws",
"WidgetTimeoutException",
"{",
"long",
"currentTimeMillis",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"long",
"maxRequestTimeout",
"=",
"waitTime",
";",
"long",
"endTime",
"=",
"currentTimeMillis",
"+",
"maxRequestTimeout",
";",
"while",
"(",
"System",
".",
"currentTimeMillis",
"(",
")",
"<",
"endTime",
")",
"{",
"try",
"{",
"if",
"(",
"timerCallback",
".",
"execute",
"(",
")",
")",
"return",
";",
"Thread",
".",
"sleep",
"(",
"500",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"e1",
")",
"{",
"throw",
"new",
"WidgetTimeoutException",
"(",
"\"The request has timed out\"",
",",
"locator",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"// ignore any other type of Exception and continue",
"logger",
".",
"debug",
"(",
"\" Exception while waiting. \"",
"+",
"\"Ignoring and continuing to wait. \"",
",",
"e",
")",
";",
"}",
"}",
"throw",
"new",
"WidgetTimeoutException",
"(",
"\"Timed out performing action \"",
"+",
"timerCallback",
",",
"locator",
")",
";",
"}"
] |
Blocks for a given time, or until the associated condition is met. The
associated condition is checked every half second.
<p>
Only an {@link InterruptedException} will prematurely halt the waiting
process.
@param waitTime
the time to wait in milliseconds
@throws WidgetTimeoutException
|
[
"Blocks",
"for",
"a",
"given",
"time",
"or",
"until",
"the",
"associated",
"condition",
"is",
"met",
".",
"The",
"associated",
"condition",
"is",
"checked",
"every",
"half",
"second",
".",
"<p",
">",
"Only",
"an",
"{",
"@link",
"InterruptedException",
"}",
"will",
"prematurely",
"halt",
"the",
"waiting",
"process",
"."
] |
train
|
https://github.com/FINRAOS/JTAF-ExtWebDriver/blob/78d646def1bf0904f79b19a81df0241e07f2c73a/src/main/java/org/finra/jtaf/ewd/timer/WaitForConditionTimer.java#L79-L101
|
Azure/azure-sdk-for-java
|
network/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/network/v2018_06_01/implementation/NetworkSecurityGroupsInner.java
|
NetworkSecurityGroupsInner.beginCreateOrUpdate
|
public NetworkSecurityGroupInner beginCreateOrUpdate(String resourceGroupName, String networkSecurityGroupName, NetworkSecurityGroupInner parameters) {
"""
Creates or updates a network security group in the specified resource group.
@param resourceGroupName The name of the resource group.
@param networkSecurityGroupName The name of the network security group.
@param parameters Parameters supplied to the create or update network security group operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the NetworkSecurityGroupInner object if successful.
"""
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, networkSecurityGroupName, parameters).toBlocking().single().body();
}
|
java
|
public NetworkSecurityGroupInner beginCreateOrUpdate(String resourceGroupName, String networkSecurityGroupName, NetworkSecurityGroupInner parameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, networkSecurityGroupName, parameters).toBlocking().single().body();
}
|
[
"public",
"NetworkSecurityGroupInner",
"beginCreateOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"networkSecurityGroupName",
",",
"NetworkSecurityGroupInner",
"parameters",
")",
"{",
"return",
"beginCreateOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"networkSecurityGroupName",
",",
"parameters",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
] |
Creates or updates a network security group in the specified resource group.
@param resourceGroupName The name of the resource group.
@param networkSecurityGroupName The name of the network security group.
@param parameters Parameters supplied to the create or update network security group operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the NetworkSecurityGroupInner object if successful.
|
[
"Creates",
"or",
"updates",
"a",
"network",
"security",
"group",
"in",
"the",
"specified",
"resource",
"group",
"."
] |
train
|
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/network/v2018_06_01/implementation/NetworkSecurityGroupsInner.java#L519-L521
|
morimekta/providence
|
providence-generator-java/src/main/java/net/morimekta/providence/generator/format/java/utils/JUtils.java
|
JUtils.camelCase
|
public static String camelCase(String prefix, String name) {
"""
Format a prefixed name as camelCase. The prefix is kept verbatim, while
tha name is split on '_' chars, and joined with each part capitalized.
@param prefix Name prefix, not modified.
@param name The name to camel-case.
@return theCamelCasedName
"""
return Strings.camelCase(prefix, name);
}
|
java
|
public static String camelCase(String prefix, String name) {
return Strings.camelCase(prefix, name);
}
|
[
"public",
"static",
"String",
"camelCase",
"(",
"String",
"prefix",
",",
"String",
"name",
")",
"{",
"return",
"Strings",
".",
"camelCase",
"(",
"prefix",
",",
"name",
")",
";",
"}"
] |
Format a prefixed name as camelCase. The prefix is kept verbatim, while
tha name is split on '_' chars, and joined with each part capitalized.
@param prefix Name prefix, not modified.
@param name The name to camel-case.
@return theCamelCasedName
|
[
"Format",
"a",
"prefixed",
"name",
"as",
"camelCase",
".",
"The",
"prefix",
"is",
"kept",
"verbatim",
"while",
"tha",
"name",
"is",
"split",
"on",
"_",
"chars",
"and",
"joined",
"with",
"each",
"part",
"capitalized",
"."
] |
train
|
https://github.com/morimekta/providence/blob/7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa/providence-generator-java/src/main/java/net/morimekta/providence/generator/format/java/utils/JUtils.java#L128-L130
|
twilio/twilio-java
|
src/main/java/com/twilio/http/Request.java
|
Request.addQueryDateTimeRange
|
public void addQueryDateTimeRange(final String name, final Range<DateTime> range) {
"""
Add query parameters for date ranges.
@param name name of query parameter
@param range date range
"""
if (range.hasLowerBound()) {
String value = range.lowerEndpoint().toString(QUERY_STRING_DATE_TIME_FORMAT);
addQueryParam(name + ">", value);
}
if (range.hasUpperBound()) {
String value = range.upperEndpoint().toString(QUERY_STRING_DATE_TIME_FORMAT);
addQueryParam(name + "<", value);
}
}
|
java
|
public void addQueryDateTimeRange(final String name, final Range<DateTime> range) {
if (range.hasLowerBound()) {
String value = range.lowerEndpoint().toString(QUERY_STRING_DATE_TIME_FORMAT);
addQueryParam(name + ">", value);
}
if (range.hasUpperBound()) {
String value = range.upperEndpoint().toString(QUERY_STRING_DATE_TIME_FORMAT);
addQueryParam(name + "<", value);
}
}
|
[
"public",
"void",
"addQueryDateTimeRange",
"(",
"final",
"String",
"name",
",",
"final",
"Range",
"<",
"DateTime",
">",
"range",
")",
"{",
"if",
"(",
"range",
".",
"hasLowerBound",
"(",
")",
")",
"{",
"String",
"value",
"=",
"range",
".",
"lowerEndpoint",
"(",
")",
".",
"toString",
"(",
"QUERY_STRING_DATE_TIME_FORMAT",
")",
";",
"addQueryParam",
"(",
"name",
"+",
"\">\"",
",",
"value",
")",
";",
"}",
"if",
"(",
"range",
".",
"hasUpperBound",
"(",
")",
")",
"{",
"String",
"value",
"=",
"range",
".",
"upperEndpoint",
"(",
")",
".",
"toString",
"(",
"QUERY_STRING_DATE_TIME_FORMAT",
")",
";",
"addQueryParam",
"(",
"name",
"+",
"\"<\"",
",",
"value",
")",
";",
"}",
"}"
] |
Add query parameters for date ranges.
@param name name of query parameter
@param range date range
|
[
"Add",
"query",
"parameters",
"for",
"date",
"ranges",
"."
] |
train
|
https://github.com/twilio/twilio-java/blob/0318974c0a6a152994af167d430255684d5e9b9f/src/main/java/com/twilio/http/Request.java#L171-L181
|
alkacon/opencms-core
|
src/org/opencms/db/CmsDriverManager.java
|
CmsDriverManager.readAliasesByStructureId
|
public List<CmsAlias> readAliasesByStructureId(CmsDbContext dbc, CmsProject project, CmsUUID structureId)
throws CmsException {
"""
Reads the aliases which point to a given structure id.<p>
@param dbc the current database context
@param project the current project
@param structureId the structure id for which we want to read the aliases
@return the list of aliases pointing to the structure id
@throws CmsException if something goes wrong
"""
return getVfsDriver(dbc).readAliases(dbc, project, new CmsAliasFilter(null, null, structureId));
}
|
java
|
public List<CmsAlias> readAliasesByStructureId(CmsDbContext dbc, CmsProject project, CmsUUID structureId)
throws CmsException {
return getVfsDriver(dbc).readAliases(dbc, project, new CmsAliasFilter(null, null, structureId));
}
|
[
"public",
"List",
"<",
"CmsAlias",
">",
"readAliasesByStructureId",
"(",
"CmsDbContext",
"dbc",
",",
"CmsProject",
"project",
",",
"CmsUUID",
"structureId",
")",
"throws",
"CmsException",
"{",
"return",
"getVfsDriver",
"(",
"dbc",
")",
".",
"readAliases",
"(",
"dbc",
",",
"project",
",",
"new",
"CmsAliasFilter",
"(",
"null",
",",
"null",
",",
"structureId",
")",
")",
";",
"}"
] |
Reads the aliases which point to a given structure id.<p>
@param dbc the current database context
@param project the current project
@param structureId the structure id for which we want to read the aliases
@return the list of aliases pointing to the structure id
@throws CmsException if something goes wrong
|
[
"Reads",
"the",
"aliases",
"which",
"point",
"to",
"a",
"given",
"structure",
"id",
".",
"<p",
">"
] |
train
|
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsDriverManager.java#L6381-L6385
|
aboutsip/pkts
|
pkts-streams/src/main/java/io/pkts/streams/impl/SimpleCallStateMachine.java
|
SimpleCallStateMachine.handleInCancellingState
|
private void handleInCancellingState(final SipPacket msg) throws SipPacketParseException {
"""
When in the cancelling state, we may actually end up going back to
IN_CALL in case we see a 2xx to the invite so pay attention for that.
@param msg
@throws SipPacketParseException
"""
// we don't move over to cancelled state even if
// we receive a 200 OK to the cancel request.
// therefore, not even checking it...
if (msg.isCancel()) {
transition(CallState.CANCELLING, msg);
return;
}
if (msg.isRequest()) {
} else {
final SipResponsePacket response = msg.toResponse();
if (response.isInvite()) {
if (response.getStatus() == 487) {
transition(CallState.CANCELLED, msg);
} else if (response.isSuccess()) {
// the cancel didn't make it over in time
// so we never cancelled, hence we move
// to in call
transition(CallState.IN_CALL, msg);
}
}
}
}
|
java
|
private void handleInCancellingState(final SipPacket msg) throws SipPacketParseException {
// we don't move over to cancelled state even if
// we receive a 200 OK to the cancel request.
// therefore, not even checking it...
if (msg.isCancel()) {
transition(CallState.CANCELLING, msg);
return;
}
if (msg.isRequest()) {
} else {
final SipResponsePacket response = msg.toResponse();
if (response.isInvite()) {
if (response.getStatus() == 487) {
transition(CallState.CANCELLED, msg);
} else if (response.isSuccess()) {
// the cancel didn't make it over in time
// so we never cancelled, hence we move
// to in call
transition(CallState.IN_CALL, msg);
}
}
}
}
|
[
"private",
"void",
"handleInCancellingState",
"(",
"final",
"SipPacket",
"msg",
")",
"throws",
"SipPacketParseException",
"{",
"// we don't move over to cancelled state even if",
"// we receive a 200 OK to the cancel request.",
"// therefore, not even checking it...",
"if",
"(",
"msg",
".",
"isCancel",
"(",
")",
")",
"{",
"transition",
"(",
"CallState",
".",
"CANCELLING",
",",
"msg",
")",
";",
"return",
";",
"}",
"if",
"(",
"msg",
".",
"isRequest",
"(",
")",
")",
"{",
"}",
"else",
"{",
"final",
"SipResponsePacket",
"response",
"=",
"msg",
".",
"toResponse",
"(",
")",
";",
"if",
"(",
"response",
".",
"isInvite",
"(",
")",
")",
"{",
"if",
"(",
"response",
".",
"getStatus",
"(",
")",
"==",
"487",
")",
"{",
"transition",
"(",
"CallState",
".",
"CANCELLED",
",",
"msg",
")",
";",
"}",
"else",
"if",
"(",
"response",
".",
"isSuccess",
"(",
")",
")",
"{",
"// the cancel didn't make it over in time",
"// so we never cancelled, hence we move",
"// to in call",
"transition",
"(",
"CallState",
".",
"IN_CALL",
",",
"msg",
")",
";",
"}",
"}",
"}",
"}"
] |
When in the cancelling state, we may actually end up going back to
IN_CALL in case we see a 2xx to the invite so pay attention for that.
@param msg
@throws SipPacketParseException
|
[
"When",
"in",
"the",
"cancelling",
"state",
"we",
"may",
"actually",
"end",
"up",
"going",
"back",
"to",
"IN_CALL",
"in",
"case",
"we",
"see",
"a",
"2xx",
"to",
"the",
"invite",
"so",
"pay",
"attention",
"for",
"that",
"."
] |
train
|
https://github.com/aboutsip/pkts/blob/0f06bb0dac76c812187829f580a8d476ca99a1a1/pkts-streams/src/main/java/io/pkts/streams/impl/SimpleCallStateMachine.java#L219-L246
|
moparisthebest/beehive
|
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/internal/DefaultURLTemplatesFactory.java
|
DefaultURLTemplatesFactory.loadTemplates
|
private void loadTemplates( Element parent ) {
"""
Loads the templates from a URL template config document.
@param parent
"""
// Load templates
List templates = DomUtils.getChildElementsByName( parent, URL_TEMPLATE );
for ( int i = 0; i < templates.size(); i++ )
{
Element template = ( Element ) templates.get( i );
String name = getElementText( template, NAME );
if ( name == null )
{
_log.error( "Malformed URL template descriptor in " + _configFilePath
+ ". The url-template name is missing." );
continue;
}
String value = getElementText( template, VALUE );
if ( value == null )
{
_log.error( "Malformed URL template descriptor in " + _configFilePath
+ ". The url-template value is missing for template " + name );
continue;
}
if ( _log.isDebugEnabled() )
{
_log.debug( "[URLTemplate] " + name + " = " + value );
}
URLTemplate urlTemplate = new URLTemplate( value, name );
if ( urlTemplate.verify( _knownTokens, _requiredTokens ) )
{
_urlTemplates.addTemplate( name, urlTemplate );
}
}
}
|
java
|
private void loadTemplates( Element parent )
{
// Load templates
List templates = DomUtils.getChildElementsByName( parent, URL_TEMPLATE );
for ( int i = 0; i < templates.size(); i++ )
{
Element template = ( Element ) templates.get( i );
String name = getElementText( template, NAME );
if ( name == null )
{
_log.error( "Malformed URL template descriptor in " + _configFilePath
+ ". The url-template name is missing." );
continue;
}
String value = getElementText( template, VALUE );
if ( value == null )
{
_log.error( "Malformed URL template descriptor in " + _configFilePath
+ ". The url-template value is missing for template " + name );
continue;
}
if ( _log.isDebugEnabled() )
{
_log.debug( "[URLTemplate] " + name + " = " + value );
}
URLTemplate urlTemplate = new URLTemplate( value, name );
if ( urlTemplate.verify( _knownTokens, _requiredTokens ) )
{
_urlTemplates.addTemplate( name, urlTemplate );
}
}
}
|
[
"private",
"void",
"loadTemplates",
"(",
"Element",
"parent",
")",
"{",
"// Load templates",
"List",
"templates",
"=",
"DomUtils",
".",
"getChildElementsByName",
"(",
"parent",
",",
"URL_TEMPLATE",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"templates",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"Element",
"template",
"=",
"(",
"Element",
")",
"templates",
".",
"get",
"(",
"i",
")",
";",
"String",
"name",
"=",
"getElementText",
"(",
"template",
",",
"NAME",
")",
";",
"if",
"(",
"name",
"==",
"null",
")",
"{",
"_log",
".",
"error",
"(",
"\"Malformed URL template descriptor in \"",
"+",
"_configFilePath",
"+",
"\". The url-template name is missing.\"",
")",
";",
"continue",
";",
"}",
"String",
"value",
"=",
"getElementText",
"(",
"template",
",",
"VALUE",
")",
";",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"_log",
".",
"error",
"(",
"\"Malformed URL template descriptor in \"",
"+",
"_configFilePath",
"+",
"\". The url-template value is missing for template \"",
"+",
"name",
")",
";",
"continue",
";",
"}",
"if",
"(",
"_log",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"_log",
".",
"debug",
"(",
"\"[URLTemplate] \"",
"+",
"name",
"+",
"\" = \"",
"+",
"value",
")",
";",
"}",
"URLTemplate",
"urlTemplate",
"=",
"new",
"URLTemplate",
"(",
"value",
",",
"name",
")",
";",
"if",
"(",
"urlTemplate",
".",
"verify",
"(",
"_knownTokens",
",",
"_requiredTokens",
")",
")",
"{",
"_urlTemplates",
".",
"addTemplate",
"(",
"name",
",",
"urlTemplate",
")",
";",
"}",
"}",
"}"
] |
Loads the templates from a URL template config document.
@param parent
|
[
"Loads",
"the",
"templates",
"from",
"a",
"URL",
"template",
"config",
"document",
"."
] |
train
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/internal/DefaultURLTemplatesFactory.java#L243-L277
|
Azure/azure-sdk-for-java
|
notificationhubs/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/notificationhubs/v2016_03_01/implementation/NamespacesInner.java
|
NamespacesInner.beginDelete
|
public void beginDelete(String resourceGroupName, String namespaceName) {
"""
Deletes an existing namespace. This operation also removes all associated notificationHubs under the namespace.
@param resourceGroupName The name of the resource group.
@param namespaceName The namespace name.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
"""
beginDeleteWithServiceResponseAsync(resourceGroupName, namespaceName).toBlocking().single().body();
}
|
java
|
public void beginDelete(String resourceGroupName, String namespaceName) {
beginDeleteWithServiceResponseAsync(resourceGroupName, namespaceName).toBlocking().single().body();
}
|
[
"public",
"void",
"beginDelete",
"(",
"String",
"resourceGroupName",
",",
"String",
"namespaceName",
")",
"{",
"beginDeleteWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"namespaceName",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
] |
Deletes an existing namespace. This operation also removes all associated notificationHubs under the namespace.
@param resourceGroupName The name of the resource group.
@param namespaceName The namespace name.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
|
[
"Deletes",
"an",
"existing",
"namespace",
".",
"This",
"operation",
"also",
"removes",
"all",
"associated",
"notificationHubs",
"under",
"the",
"namespace",
"."
] |
train
|
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/notificationhubs/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/notificationhubs/v2016_03_01/implementation/NamespacesInner.java#L490-L492
|
podio/podio-java
|
src/main/java/com/podio/task/TaskAPI.java
|
TaskAPI.updateText
|
public void updateText(int taskId, String text) {
"""
Updates the text of the task.
@param taskId
The id of the task
@param text
The new text of the task
"""
getResourceFactory().getApiResource("/task/" + taskId + "/text")
.entity(new TaskText(text), MediaType.APPLICATION_JSON_TYPE)
.put();
}
|
java
|
public void updateText(int taskId, String text) {
getResourceFactory().getApiResource("/task/" + taskId + "/text")
.entity(new TaskText(text), MediaType.APPLICATION_JSON_TYPE)
.put();
}
|
[
"public",
"void",
"updateText",
"(",
"int",
"taskId",
",",
"String",
"text",
")",
"{",
"getResourceFactory",
"(",
")",
".",
"getApiResource",
"(",
"\"/task/\"",
"+",
"taskId",
"+",
"\"/text\"",
")",
".",
"entity",
"(",
"new",
"TaskText",
"(",
"text",
")",
",",
"MediaType",
".",
"APPLICATION_JSON_TYPE",
")",
".",
"put",
"(",
")",
";",
"}"
] |
Updates the text of the task.
@param taskId
The id of the task
@param text
The new text of the task
|
[
"Updates",
"the",
"text",
"of",
"the",
"task",
"."
] |
train
|
https://github.com/podio/podio-java/blob/a520b23bac118c957ce02cdd8ff42a6c7d17b49a/src/main/java/com/podio/task/TaskAPI.java#L144-L148
|
xmlunit/xmlunit
|
xmlunit-legacy/src/main/java/org/custommonkey/xmlunit/XMLUnit.java
|
XMLUnit.compareXML
|
public static Diff compareXML(Reader control, Reader test)
throws SAXException, IOException {
"""
Compare XML documents provided by two Reader classes
@param control Control document
@param test Document to test
@return Diff object describing differences in documents
@throws SAXException
@throws IOException
"""
return new Diff(control, test);
}
|
java
|
public static Diff compareXML(Reader control, Reader test)
throws SAXException, IOException {
return new Diff(control, test);
}
|
[
"public",
"static",
"Diff",
"compareXML",
"(",
"Reader",
"control",
",",
"Reader",
"test",
")",
"throws",
"SAXException",
",",
"IOException",
"{",
"return",
"new",
"Diff",
"(",
"control",
",",
"test",
")",
";",
"}"
] |
Compare XML documents provided by two Reader classes
@param control Control document
@param test Document to test
@return Diff object describing differences in documents
@throws SAXException
@throws IOException
|
[
"Compare",
"XML",
"documents",
"provided",
"by",
"two",
"Reader",
"classes"
] |
train
|
https://github.com/xmlunit/xmlunit/blob/fe3d701d43f57ee83dcba336e4c1555619d3084b/xmlunit-legacy/src/main/java/org/custommonkey/xmlunit/XMLUnit.java#L580-L583
|
stephanenicolas/toothpick
|
toothpick-runtime/src/main/java/toothpick/ScopeNode.java
|
ScopeNode.addChild
|
ScopeNode addChild(ScopeNode child) {
"""
Adds a child {@link ScopeNode} to a {@link ScopeNode}.
Children scopes have access to all bindings of their parents, as well as their scoped instances, and can override them.
In a lock free way, this method returns the child scope : either {@code child} or a child scope that was already added.
@param child the new child scope.
@return either {@code child} or a child scope that was already added.
"""
if (child == null) {
throw new IllegalArgumentException("Child must be non null.");
}
//this variable is important. It takes a snapshot of the node
final ScopeNode parentScope = child.getParentScope();
if (parentScope == this) {
return child;
}
if (parentScope != null) {
throw new IllegalStateException(format("Scope %s already has a parent: %s which is not %s", child, parentScope, this));
}
//non-locking allows multiple threads to arrive here,
//we take into account the first one only
ScopeNode scope = childrenScopes.putIfAbsent(child.getName(), child);
if (scope != null) {
return scope;
}
//this could bug in multi-thread if a node is added to 2 parents...
//there is no atomic operation to add them both and getting sure they are the only parent scopes.
//we choose not to lock as this scenario doesn't seem meaningful
child.parentScopes.add(this);
child.parentScopes.addAll(parentScopes);
return child;
}
|
java
|
ScopeNode addChild(ScopeNode child) {
if (child == null) {
throw new IllegalArgumentException("Child must be non null.");
}
//this variable is important. It takes a snapshot of the node
final ScopeNode parentScope = child.getParentScope();
if (parentScope == this) {
return child;
}
if (parentScope != null) {
throw new IllegalStateException(format("Scope %s already has a parent: %s which is not %s", child, parentScope, this));
}
//non-locking allows multiple threads to arrive here,
//we take into account the first one only
ScopeNode scope = childrenScopes.putIfAbsent(child.getName(), child);
if (scope != null) {
return scope;
}
//this could bug in multi-thread if a node is added to 2 parents...
//there is no atomic operation to add them both and getting sure they are the only parent scopes.
//we choose not to lock as this scenario doesn't seem meaningful
child.parentScopes.add(this);
child.parentScopes.addAll(parentScopes);
return child;
}
|
[
"ScopeNode",
"addChild",
"(",
"ScopeNode",
"child",
")",
"{",
"if",
"(",
"child",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Child must be non null.\"",
")",
";",
"}",
"//this variable is important. It takes a snapshot of the node",
"final",
"ScopeNode",
"parentScope",
"=",
"child",
".",
"getParentScope",
"(",
")",
";",
"if",
"(",
"parentScope",
"==",
"this",
")",
"{",
"return",
"child",
";",
"}",
"if",
"(",
"parentScope",
"!=",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"format",
"(",
"\"Scope %s already has a parent: %s which is not %s\"",
",",
"child",
",",
"parentScope",
",",
"this",
")",
")",
";",
"}",
"//non-locking allows multiple threads to arrive here,",
"//we take into account the first one only",
"ScopeNode",
"scope",
"=",
"childrenScopes",
".",
"putIfAbsent",
"(",
"child",
".",
"getName",
"(",
")",
",",
"child",
")",
";",
"if",
"(",
"scope",
"!=",
"null",
")",
"{",
"return",
"scope",
";",
"}",
"//this could bug in multi-thread if a node is added to 2 parents...",
"//there is no atomic operation to add them both and getting sure they are the only parent scopes.",
"//we choose not to lock as this scenario doesn't seem meaningful",
"child",
".",
"parentScopes",
".",
"add",
"(",
"this",
")",
";",
"child",
".",
"parentScopes",
".",
"addAll",
"(",
"parentScopes",
")",
";",
"return",
"child",
";",
"}"
] |
Adds a child {@link ScopeNode} to a {@link ScopeNode}.
Children scopes have access to all bindings of their parents, as well as their scoped instances, and can override them.
In a lock free way, this method returns the child scope : either {@code child} or a child scope that was already added.
@param child the new child scope.
@return either {@code child} or a child scope that was already added.
|
[
"Adds",
"a",
"child",
"{",
"@link",
"ScopeNode",
"}",
"to",
"a",
"{",
"@link",
"ScopeNode",
"}",
".",
"Children",
"scopes",
"have",
"access",
"to",
"all",
"bindings",
"of",
"their",
"parents",
"as",
"well",
"as",
"their",
"scoped",
"instances",
"and",
"can",
"override",
"them",
".",
"In",
"a",
"lock",
"free",
"way",
"this",
"method",
"returns",
"the",
"child",
"scope",
":",
"either",
"{",
"@code",
"child",
"}",
"or",
"a",
"child",
"scope",
"that",
"was",
"already",
"added",
"."
] |
train
|
https://github.com/stephanenicolas/toothpick/blob/54476ca9a5fa48809c15a46e43e38db9ed7e1a75/toothpick-runtime/src/main/java/toothpick/ScopeNode.java#L223-L250
|
umeding/fuzzer
|
src/main/java/com/uwemeding/fuzzer/java/JavaOutputType.java
|
JavaOutputType.addReasoningMethod
|
private void addReasoningMethod(Java.CLASS clazz, Program program) throws FuzzerException {
"""
Add the reasoning method to the generated code.
<p>
@param clazz the class wrapper
@param program the fuzzy program
@throws FuzzerException
"""
// reasoning strategy
Java.METHOD rs = clazz.addMETHOD("private", "Number", "rs");
rs.setComment("Reasoning strategy is " + program.getReasoningStrategy().getName());
rs.setReturnComment("the reasoned value");
rs.addArg("Number", "a", "strength value");
rs.addArg("Number", "b", "mapped value");
switch (program.getReasoningStrategy()) {
case MAXDOT:
rs.addRETURN("a.doubleValue() * b.doubleValue()");
break;
case MAXMIN:
rs.addRETURN("a.doubleValue() < b.doubleValue() ? a : b");
break;
default:
throw new FuzzerException(program.getReasoningStrategy() + ": not implemented");
}
}
|
java
|
private void addReasoningMethod(Java.CLASS clazz, Program program) throws FuzzerException {
// reasoning strategy
Java.METHOD rs = clazz.addMETHOD("private", "Number", "rs");
rs.setComment("Reasoning strategy is " + program.getReasoningStrategy().getName());
rs.setReturnComment("the reasoned value");
rs.addArg("Number", "a", "strength value");
rs.addArg("Number", "b", "mapped value");
switch (program.getReasoningStrategy()) {
case MAXDOT:
rs.addRETURN("a.doubleValue() * b.doubleValue()");
break;
case MAXMIN:
rs.addRETURN("a.doubleValue() < b.doubleValue() ? a : b");
break;
default:
throw new FuzzerException(program.getReasoningStrategy() + ": not implemented");
}
}
|
[
"private",
"void",
"addReasoningMethod",
"(",
"Java",
".",
"CLASS",
"clazz",
",",
"Program",
"program",
")",
"throws",
"FuzzerException",
"{",
"// reasoning strategy",
"Java",
".",
"METHOD",
"rs",
"=",
"clazz",
".",
"addMETHOD",
"(",
"\"private\"",
",",
"\"Number\"",
",",
"\"rs\"",
")",
";",
"rs",
".",
"setComment",
"(",
"\"Reasoning strategy is \"",
"+",
"program",
".",
"getReasoningStrategy",
"(",
")",
".",
"getName",
"(",
")",
")",
";",
"rs",
".",
"setReturnComment",
"(",
"\"the reasoned value\"",
")",
";",
"rs",
".",
"addArg",
"(",
"\"Number\"",
",",
"\"a\"",
",",
"\"strength value\"",
")",
";",
"rs",
".",
"addArg",
"(",
"\"Number\"",
",",
"\"b\"",
",",
"\"mapped value\"",
")",
";",
"switch",
"(",
"program",
".",
"getReasoningStrategy",
"(",
")",
")",
"{",
"case",
"MAXDOT",
":",
"rs",
".",
"addRETURN",
"(",
"\"a.doubleValue() * b.doubleValue()\"",
")",
";",
"break",
";",
"case",
"MAXMIN",
":",
"rs",
".",
"addRETURN",
"(",
"\"a.doubleValue() < b.doubleValue() ? a : b\"",
")",
";",
"break",
";",
"default",
":",
"throw",
"new",
"FuzzerException",
"(",
"program",
".",
"getReasoningStrategy",
"(",
")",
"+",
"\": not implemented\"",
")",
";",
"}",
"}"
] |
Add the reasoning method to the generated code.
<p>
@param clazz the class wrapper
@param program the fuzzy program
@throws FuzzerException
|
[
"Add",
"the",
"reasoning",
"method",
"to",
"the",
"generated",
"code",
".",
"<p",
">"
] |
train
|
https://github.com/umeding/fuzzer/blob/e8aa46313bb1d1328865f26f99455124aede828c/src/main/java/com/uwemeding/fuzzer/java/JavaOutputType.java#L210-L227
|
kiegroup/droolsjbpm-integration
|
kie-server-parent/kie-server-common/src/main/java/org/kie/server/common/rest/KieServerHttpRequest.java
|
KieServerHttpRequest.responseHeaderParameter
|
private String responseHeaderParameter( final String headerName, final String paramName ) {
"""
Get parameter with given name from header value in response
@param headerName
@param paramName
@return parameter value or null if missing
"""
return getHeaderParam(responseHeader(headerName), paramName);
}
|
java
|
private String responseHeaderParameter( final String headerName, final String paramName ) {
return getHeaderParam(responseHeader(headerName), paramName);
}
|
[
"private",
"String",
"responseHeaderParameter",
"(",
"final",
"String",
"headerName",
",",
"final",
"String",
"paramName",
")",
"{",
"return",
"getHeaderParam",
"(",
"responseHeader",
"(",
"headerName",
")",
",",
"paramName",
")",
";",
"}"
] |
Get parameter with given name from header value in response
@param headerName
@param paramName
@return parameter value or null if missing
|
[
"Get",
"parameter",
"with",
"given",
"name",
"from",
"header",
"value",
"in",
"response"
] |
train
|
https://github.com/kiegroup/droolsjbpm-integration/blob/6c26200ab03855dbb92b56ca0c6363cdec0eaf2c/kie-server-parent/kie-server-common/src/main/java/org/kie/server/common/rest/KieServerHttpRequest.java#L1452-L1454
|
wonderpush/wonderpush-android-sdk
|
sdk/src/main/java/com/wonderpush/sdk/WonderPushRestClient.java
|
WonderPushRestClient.postEventually
|
protected static void postEventually(String resource, RequestParams params) {
"""
A POST request that is guaranteed to be executed when a network connection
is present, surviving application reboot. The responseHandler will be
called only if the network is present when the request is first run.
@param resource
The resource path, starting with /
@param params
AsyncHttpClient request parameters
"""
final Request request = new Request(WonderPushConfiguration.getUserId(), HttpMethod.POST, resource, params, null);
WonderPushRequestVault.getDefaultVault().put(request, 0);
}
|
java
|
protected static void postEventually(String resource, RequestParams params) {
final Request request = new Request(WonderPushConfiguration.getUserId(), HttpMethod.POST, resource, params, null);
WonderPushRequestVault.getDefaultVault().put(request, 0);
}
|
[
"protected",
"static",
"void",
"postEventually",
"(",
"String",
"resource",
",",
"RequestParams",
"params",
")",
"{",
"final",
"Request",
"request",
"=",
"new",
"Request",
"(",
"WonderPushConfiguration",
".",
"getUserId",
"(",
")",
",",
"HttpMethod",
".",
"POST",
",",
"resource",
",",
"params",
",",
"null",
")",
";",
"WonderPushRequestVault",
".",
"getDefaultVault",
"(",
")",
".",
"put",
"(",
"request",
",",
"0",
")",
";",
"}"
] |
A POST request that is guaranteed to be executed when a network connection
is present, surviving application reboot. The responseHandler will be
called only if the network is present when the request is first run.
@param resource
The resource path, starting with /
@param params
AsyncHttpClient request parameters
|
[
"A",
"POST",
"request",
"that",
"is",
"guaranteed",
"to",
"be",
"executed",
"when",
"a",
"network",
"connection",
"is",
"present",
"surviving",
"application",
"reboot",
".",
"The",
"responseHandler",
"will",
"be",
"called",
"only",
"if",
"the",
"network",
"is",
"present",
"when",
"the",
"request",
"is",
"first",
"run",
"."
] |
train
|
https://github.com/wonderpush/wonderpush-android-sdk/blob/ba0a1568f705cdd6206639bfab1e5cf529084b59/sdk/src/main/java/com/wonderpush/sdk/WonderPushRestClient.java#L115-L118
|
diirt/util
|
src/main/java/org/epics/util/time/Timestamp.java
|
Timestamp.createWithCarry
|
private static Timestamp createWithCarry(long seconds, long nanos) {
"""
Creates a new time stamp by carrying nanosecs into seconds if necessary.
@param seconds new seconds
@param ofNanos new nanoseconds (can be the whole long range)
@return the new timestamp
"""
if (nanos > 999999999) {
seconds = seconds + nanos / 1000000000;
nanos = nanos % 1000000000;
}
if (nanos < 0) {
long pastSec = nanos / 1000000000;
pastSec--;
seconds += pastSec;
nanos -= pastSec * 1000000000;
}
return new Timestamp(seconds, (int) nanos);
}
|
java
|
private static Timestamp createWithCarry(long seconds, long nanos) {
if (nanos > 999999999) {
seconds = seconds + nanos / 1000000000;
nanos = nanos % 1000000000;
}
if (nanos < 0) {
long pastSec = nanos / 1000000000;
pastSec--;
seconds += pastSec;
nanos -= pastSec * 1000000000;
}
return new Timestamp(seconds, (int) nanos);
}
|
[
"private",
"static",
"Timestamp",
"createWithCarry",
"(",
"long",
"seconds",
",",
"long",
"nanos",
")",
"{",
"if",
"(",
"nanos",
">",
"999999999",
")",
"{",
"seconds",
"=",
"seconds",
"+",
"nanos",
"/",
"1000000000",
";",
"nanos",
"=",
"nanos",
"%",
"1000000000",
";",
"}",
"if",
"(",
"nanos",
"<",
"0",
")",
"{",
"long",
"pastSec",
"=",
"nanos",
"/",
"1000000000",
";",
"pastSec",
"--",
";",
"seconds",
"+=",
"pastSec",
";",
"nanos",
"-=",
"pastSec",
"*",
"1000000000",
";",
"}",
"return",
"new",
"Timestamp",
"(",
"seconds",
",",
"(",
"int",
")",
"nanos",
")",
";",
"}"
] |
Creates a new time stamp by carrying nanosecs into seconds if necessary.
@param seconds new seconds
@param ofNanos new nanoseconds (can be the whole long range)
@return the new timestamp
|
[
"Creates",
"a",
"new",
"time",
"stamp",
"by",
"carrying",
"nanosecs",
"into",
"seconds",
"if",
"necessary",
"."
] |
train
|
https://github.com/diirt/util/blob/24aca0a173a635aaf0b78d213a3fee8d4f91c077/src/main/java/org/epics/util/time/Timestamp.java#L173-L187
|
mongodb/stitch-android-sdk
|
core/sdk/src/main/java/com/mongodb/stitch/core/internal/common/StitchObjectMapper.java
|
StitchObjectMapper.withCodecRegistry
|
public StitchObjectMapper withCodecRegistry(final CodecRegistry codecRegistry) {
"""
Applies the given codec registry to be used alongside the default codec registry.
@param codecRegistry the codec registry to merge in.
@return an {@link StitchObjectMapper} with the merged codec registries.
"""
// We can't detect if their codecRegistry has any duplicate providers. There's also a chance
// that putting ours first may prevent decoding of some of their classes if for example they
// have their own way of decoding an Integer.
final CodecRegistry newReg =
CodecRegistries.fromRegistries(BsonUtils.DEFAULT_CODEC_REGISTRY, codecRegistry);
return new StitchObjectMapper(this, newReg);
}
|
java
|
public StitchObjectMapper withCodecRegistry(final CodecRegistry codecRegistry) {
// We can't detect if their codecRegistry has any duplicate providers. There's also a chance
// that putting ours first may prevent decoding of some of their classes if for example they
// have their own way of decoding an Integer.
final CodecRegistry newReg =
CodecRegistries.fromRegistries(BsonUtils.DEFAULT_CODEC_REGISTRY, codecRegistry);
return new StitchObjectMapper(this, newReg);
}
|
[
"public",
"StitchObjectMapper",
"withCodecRegistry",
"(",
"final",
"CodecRegistry",
"codecRegistry",
")",
"{",
"// We can't detect if their codecRegistry has any duplicate providers. There's also a chance",
"// that putting ours first may prevent decoding of some of their classes if for example they",
"// have their own way of decoding an Integer.",
"final",
"CodecRegistry",
"newReg",
"=",
"CodecRegistries",
".",
"fromRegistries",
"(",
"BsonUtils",
".",
"DEFAULT_CODEC_REGISTRY",
",",
"codecRegistry",
")",
";",
"return",
"new",
"StitchObjectMapper",
"(",
"this",
",",
"newReg",
")",
";",
"}"
] |
Applies the given codec registry to be used alongside the default codec registry.
@param codecRegistry the codec registry to merge in.
@return an {@link StitchObjectMapper} with the merged codec registries.
|
[
"Applies",
"the",
"given",
"codec",
"registry",
"to",
"be",
"used",
"alongside",
"the",
"default",
"codec",
"registry",
"."
] |
train
|
https://github.com/mongodb/stitch-android-sdk/blob/159b9334b1f1a827285544be5ee20cdf7b04e4cc/core/sdk/src/main/java/com/mongodb/stitch/core/internal/common/StitchObjectMapper.java#L107-L114
|
ist-dresden/composum
|
sling/core/commons/src/main/java/com/composum/sling/core/util/RequestUtil.java
|
RequestUtil.checkSelector
|
public static boolean checkSelector(SlingHttpServletRequest request, String key) {
"""
Retrieves a key in the selectors and returns 'true' is the key is present.
@param request the request object with the selector info
@param key the selector key which is checked
"""
String[] selectors = request.getRequestPathInfo().getSelectors();
for (String selector : selectors) {
if (selector.equals(key)) {
return true;
}
}
return false;
}
|
java
|
public static boolean checkSelector(SlingHttpServletRequest request, String key) {
String[] selectors = request.getRequestPathInfo().getSelectors();
for (String selector : selectors) {
if (selector.equals(key)) {
return true;
}
}
return false;
}
|
[
"public",
"static",
"boolean",
"checkSelector",
"(",
"SlingHttpServletRequest",
"request",
",",
"String",
"key",
")",
"{",
"String",
"[",
"]",
"selectors",
"=",
"request",
".",
"getRequestPathInfo",
"(",
")",
".",
"getSelectors",
"(",
")",
";",
"for",
"(",
"String",
"selector",
":",
"selectors",
")",
"{",
"if",
"(",
"selector",
".",
"equals",
"(",
"key",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}"
] |
Retrieves a key in the selectors and returns 'true' is the key is present.
@param request the request object with the selector info
@param key the selector key which is checked
|
[
"Retrieves",
"a",
"key",
"in",
"the",
"selectors",
"and",
"returns",
"true",
"is",
"the",
"key",
"is",
"present",
"."
] |
train
|
https://github.com/ist-dresden/composum/blob/ebc79f559f6022c935240c19102539bdfb1bd1e2/sling/core/commons/src/main/java/com/composum/sling/core/util/RequestUtil.java#L73-L81
|
jmeetsma/Iglu-Util
|
src/main/java/org/ijsberg/iglu/util/misc/StringSupport.java
|
StringSupport.split
|
public static List<String> split(String input, String punctuationChars, boolean sort) {
"""
reads all words in a text and converts them to lower case
@param input
@param punctuationChars characters that can not belong to words and are therefore separators
@param sort indicates if result must be sorted alphabetically
@return a collection of uniquely identified words
"""
return split(input, punctuationChars, sort, false);
}
|
java
|
public static List<String> split(String input, String punctuationChars, boolean sort) {
return split(input, punctuationChars, sort, false);
}
|
[
"public",
"static",
"List",
"<",
"String",
">",
"split",
"(",
"String",
"input",
",",
"String",
"punctuationChars",
",",
"boolean",
"sort",
")",
"{",
"return",
"split",
"(",
"input",
",",
"punctuationChars",
",",
"sort",
",",
"false",
")",
";",
"}"
] |
reads all words in a text and converts them to lower case
@param input
@param punctuationChars characters that can not belong to words and are therefore separators
@param sort indicates if result must be sorted alphabetically
@return a collection of uniquely identified words
|
[
"reads",
"all",
"words",
"in",
"a",
"text",
"and",
"converts",
"them",
"to",
"lower",
"case"
] |
train
|
https://github.com/jmeetsma/Iglu-Util/blob/971eb022115247b1e34dc26dd02e7e621e29e910/src/main/java/org/ijsberg/iglu/util/misc/StringSupport.java#L529-L531
|
beihaifeiwu/dolphin
|
dolphin-mybatis-generator/src/main/java/com/freetmp/mbg/formatter/StringHelper.java
|
StringHelper.generateAlias
|
public static String generateAlias(String description, int unique) {
"""
Generate a nice alias for the given class name or collection role name and unique integer. Subclasses of
Loader do <em>not</em> have to use aliases of this form.
@param description The base name (usually an entity-name or collection-role)
@param unique A uniquing value
@return an alias of the form foo1_
"""
return generateAliasRoot(description) +
Integer.toString(unique) +
'_';
}
|
java
|
public static String generateAlias(String description, int unique) {
return generateAliasRoot(description) +
Integer.toString(unique) +
'_';
}
|
[
"public",
"static",
"String",
"generateAlias",
"(",
"String",
"description",
",",
"int",
"unique",
")",
"{",
"return",
"generateAliasRoot",
"(",
"description",
")",
"+",
"Integer",
".",
"toString",
"(",
"unique",
")",
"+",
"'",
"'",
";",
"}"
] |
Generate a nice alias for the given class name or collection role name and unique integer. Subclasses of
Loader do <em>not</em> have to use aliases of this form.
@param description The base name (usually an entity-name or collection-role)
@param unique A uniquing value
@return an alias of the form foo1_
|
[
"Generate",
"a",
"nice",
"alias",
"for",
"the",
"given",
"class",
"name",
"or",
"collection",
"role",
"name",
"and",
"unique",
"integer",
".",
"Subclasses",
"of",
"Loader",
"do",
"<em",
">",
"not<",
"/",
"em",
">",
"have",
"to",
"use",
"aliases",
"of",
"this",
"form",
"."
] |
train
|
https://github.com/beihaifeiwu/dolphin/blob/b100579cc6986dce5eba5593ebb5fbae7bad9d1a/dolphin-mybatis-generator/src/main/java/com/freetmp/mbg/formatter/StringHelper.java#L459-L463
|
fcrepo3/fcrepo
|
fcrepo-security/fcrepo-security-pdp/src/main/java/org/fcrepo/server/security/xacml/util/ContextUtil.java
|
ContextUtil.setupEnvironment
|
public List<Attribute> setupEnvironment(Map<URI, AttributeValue> e) {
"""
Creates the Environment attributes.
@return a Set of Attributes for inclusion in a Request
"""
if (e == null || e.size() == 0) {
return Collections.emptyList();
}
List<Attribute> environment = new ArrayList<Attribute>(e.size());
for (URI uri : e.keySet()) {
environment.add(new SingletonAttribute(uri, null, null, e.get(uri)));
}
return environment;
}
|
java
|
public List<Attribute> setupEnvironment(Map<URI, AttributeValue> e) {
if (e == null || e.size() == 0) {
return Collections.emptyList();
}
List<Attribute> environment = new ArrayList<Attribute>(e.size());
for (URI uri : e.keySet()) {
environment.add(new SingletonAttribute(uri, null, null, e.get(uri)));
}
return environment;
}
|
[
"public",
"List",
"<",
"Attribute",
">",
"setupEnvironment",
"(",
"Map",
"<",
"URI",
",",
"AttributeValue",
">",
"e",
")",
"{",
"if",
"(",
"e",
"==",
"null",
"||",
"e",
".",
"size",
"(",
")",
"==",
"0",
")",
"{",
"return",
"Collections",
".",
"emptyList",
"(",
")",
";",
"}",
"List",
"<",
"Attribute",
">",
"environment",
"=",
"new",
"ArrayList",
"<",
"Attribute",
">",
"(",
"e",
".",
"size",
"(",
")",
")",
";",
"for",
"(",
"URI",
"uri",
":",
"e",
".",
"keySet",
"(",
")",
")",
"{",
"environment",
".",
"add",
"(",
"new",
"SingletonAttribute",
"(",
"uri",
",",
"null",
",",
"null",
",",
"e",
".",
"get",
"(",
"uri",
")",
")",
")",
";",
"}",
"return",
"environment",
";",
"}"
] |
Creates the Environment attributes.
@return a Set of Attributes for inclusion in a Request
|
[
"Creates",
"the",
"Environment",
"attributes",
"."
] |
train
|
https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-security/fcrepo-security-pdp/src/main/java/org/fcrepo/server/security/xacml/util/ContextUtil.java#L222-L234
|
Impetus/Kundera
|
src/kundera-elastic-search/src/main/java/com/impetus/client/es/ESClient.java
|
ESClient.setRefreshIndexes
|
private void setRefreshIndexes(Properties puProps, Map<String, Object> externalProperties) {
"""
Sets the refresh indexes.
@param puProps
the pu props
@param externalProperties
the external properties
"""
Object refreshIndexes = null;
/*
* Check from properties set while creating emf
*
*/
if (externalProperties.get(ESConstants.KUNDERA_ES_REFRESH_INDEXES) != null)
{
refreshIndexes = externalProperties.get(ESConstants.KUNDERA_ES_REFRESH_INDEXES);
}
/*
* Check from PU Properties
*
*/
if (refreshIndexes == null && puProps.get(ESConstants.KUNDERA_ES_REFRESH_INDEXES) != null)
{
refreshIndexes = puProps.get(ESConstants.KUNDERA_ES_REFRESH_INDEXES);
}
if (refreshIndexes != null)
{
if (refreshIndexes instanceof Boolean)
{
this.setRereshIndexes = (boolean) refreshIndexes;
}
else
{
this.setRereshIndexes = Boolean.parseBoolean((String) refreshIndexes);
}
}
}
|
java
|
private void setRefreshIndexes(Properties puProps, Map<String, Object> externalProperties)
{
Object refreshIndexes = null;
/*
* Check from properties set while creating emf
*
*/
if (externalProperties.get(ESConstants.KUNDERA_ES_REFRESH_INDEXES) != null)
{
refreshIndexes = externalProperties.get(ESConstants.KUNDERA_ES_REFRESH_INDEXES);
}
/*
* Check from PU Properties
*
*/
if (refreshIndexes == null && puProps.get(ESConstants.KUNDERA_ES_REFRESH_INDEXES) != null)
{
refreshIndexes = puProps.get(ESConstants.KUNDERA_ES_REFRESH_INDEXES);
}
if (refreshIndexes != null)
{
if (refreshIndexes instanceof Boolean)
{
this.setRereshIndexes = (boolean) refreshIndexes;
}
else
{
this.setRereshIndexes = Boolean.parseBoolean((String) refreshIndexes);
}
}
}
|
[
"private",
"void",
"setRefreshIndexes",
"(",
"Properties",
"puProps",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"externalProperties",
")",
"{",
"Object",
"refreshIndexes",
"=",
"null",
";",
"/*\n * Check from properties set while creating emf\n * \n */",
"if",
"(",
"externalProperties",
".",
"get",
"(",
"ESConstants",
".",
"KUNDERA_ES_REFRESH_INDEXES",
")",
"!=",
"null",
")",
"{",
"refreshIndexes",
"=",
"externalProperties",
".",
"get",
"(",
"ESConstants",
".",
"KUNDERA_ES_REFRESH_INDEXES",
")",
";",
"}",
"/*\n * Check from PU Properties\n * \n */",
"if",
"(",
"refreshIndexes",
"==",
"null",
"&&",
"puProps",
".",
"get",
"(",
"ESConstants",
".",
"KUNDERA_ES_REFRESH_INDEXES",
")",
"!=",
"null",
")",
"{",
"refreshIndexes",
"=",
"puProps",
".",
"get",
"(",
"ESConstants",
".",
"KUNDERA_ES_REFRESH_INDEXES",
")",
";",
"}",
"if",
"(",
"refreshIndexes",
"!=",
"null",
")",
"{",
"if",
"(",
"refreshIndexes",
"instanceof",
"Boolean",
")",
"{",
"this",
".",
"setRereshIndexes",
"=",
"(",
"boolean",
")",
"refreshIndexes",
";",
"}",
"else",
"{",
"this",
".",
"setRereshIndexes",
"=",
"Boolean",
".",
"parseBoolean",
"(",
"(",
"String",
")",
"refreshIndexes",
")",
";",
"}",
"}",
"}"
] |
Sets the refresh indexes.
@param puProps
the pu props
@param externalProperties
the external properties
|
[
"Sets",
"the",
"refresh",
"indexes",
"."
] |
train
|
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-elastic-search/src/main/java/com/impetus/client/es/ESClient.java#L957-L994
|
Azure/azure-sdk-for-java
|
batchai/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/batchai/v2018_03_01/implementation/JobsInner.java
|
JobsInner.beginTerminate
|
public void beginTerminate(String resourceGroupName, String jobName) {
"""
Terminates a job.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param jobName The name of the job within the specified resource group. Job names can only contain a combination of alphanumeric characters along with dash (-) and underscore (_). The name must be from 1 through 64 characters long.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
"""
beginTerminateWithServiceResponseAsync(resourceGroupName, jobName).toBlocking().single().body();
}
|
java
|
public void beginTerminate(String resourceGroupName, String jobName) {
beginTerminateWithServiceResponseAsync(resourceGroupName, jobName).toBlocking().single().body();
}
|
[
"public",
"void",
"beginTerminate",
"(",
"String",
"resourceGroupName",
",",
"String",
"jobName",
")",
"{",
"beginTerminateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"jobName",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
] |
Terminates a job.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param jobName The name of the job within the specified resource group. Job names can only contain a combination of alphanumeric characters along with dash (-) and underscore (_). The name must be from 1 through 64 characters long.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
|
[
"Terminates",
"a",
"job",
"."
] |
train
|
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batchai/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/batchai/v2018_03_01/implementation/JobsInner.java#L747-L749
|
kaazing/java.client
|
ws/ws/src/main/java/org/kaazing/gateway/client/util/WrappedByteBuffer.java
|
WrappedByteBuffer.getPrefixedString
|
public String getPrefixedString(int fieldSize, Charset cs) {
"""
Returns a length-prefixed string from the buffer at the current position.
@param fieldSize the width in bytes of the prefixed length field
@param cs the character set
@return the length-prefixed string
"""
int len = 0;
switch (fieldSize) {
case 1:
len = _buf.get();
break;
case 2:
len = _buf.getShort();
break;
case 4:
len = _buf.getInt();
break;
default:
throw new IllegalArgumentException("Illegal argument, field size should be 1,2 or 4 and fieldSize is: " + fieldSize);
}
if (len == 0) {
return "";
}
int oldLimit = _buf.limit();
try {
_buf.limit(_buf.position() + len);
byte[] bytes = new byte[len];
_buf.get(bytes, 0, len);
String retVal = cs.decode(java.nio.ByteBuffer.wrap(bytes)).toString();
return retVal;
} finally {
_buf.limit(oldLimit);
}
}
|
java
|
public String getPrefixedString(int fieldSize, Charset cs) {
int len = 0;
switch (fieldSize) {
case 1:
len = _buf.get();
break;
case 2:
len = _buf.getShort();
break;
case 4:
len = _buf.getInt();
break;
default:
throw new IllegalArgumentException("Illegal argument, field size should be 1,2 or 4 and fieldSize is: " + fieldSize);
}
if (len == 0) {
return "";
}
int oldLimit = _buf.limit();
try {
_buf.limit(_buf.position() + len);
byte[] bytes = new byte[len];
_buf.get(bytes, 0, len);
String retVal = cs.decode(java.nio.ByteBuffer.wrap(bytes)).toString();
return retVal;
} finally {
_buf.limit(oldLimit);
}
}
|
[
"public",
"String",
"getPrefixedString",
"(",
"int",
"fieldSize",
",",
"Charset",
"cs",
")",
"{",
"int",
"len",
"=",
"0",
";",
"switch",
"(",
"fieldSize",
")",
"{",
"case",
"1",
":",
"len",
"=",
"_buf",
".",
"get",
"(",
")",
";",
"break",
";",
"case",
"2",
":",
"len",
"=",
"_buf",
".",
"getShort",
"(",
")",
";",
"break",
";",
"case",
"4",
":",
"len",
"=",
"_buf",
".",
"getInt",
"(",
")",
";",
"break",
";",
"default",
":",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Illegal argument, field size should be 1,2 or 4 and fieldSize is: \"",
"+",
"fieldSize",
")",
";",
"}",
"if",
"(",
"len",
"==",
"0",
")",
"{",
"return",
"\"\"",
";",
"}",
"int",
"oldLimit",
"=",
"_buf",
".",
"limit",
"(",
")",
";",
"try",
"{",
"_buf",
".",
"limit",
"(",
"_buf",
".",
"position",
"(",
")",
"+",
"len",
")",
";",
"byte",
"[",
"]",
"bytes",
"=",
"new",
"byte",
"[",
"len",
"]",
";",
"_buf",
".",
"get",
"(",
"bytes",
",",
"0",
",",
"len",
")",
";",
"String",
"retVal",
"=",
"cs",
".",
"decode",
"(",
"java",
".",
"nio",
".",
"ByteBuffer",
".",
"wrap",
"(",
"bytes",
")",
")",
".",
"toString",
"(",
")",
";",
"return",
"retVal",
";",
"}",
"finally",
"{",
"_buf",
".",
"limit",
"(",
"oldLimit",
")",
";",
"}",
"}"
] |
Returns a length-prefixed string from the buffer at the current position.
@param fieldSize the width in bytes of the prefixed length field
@param cs the character set
@return the length-prefixed string
|
[
"Returns",
"a",
"length",
"-",
"prefixed",
"string",
"from",
"the",
"buffer",
"at",
"the",
"current",
"position",
"."
] |
train
|
https://github.com/kaazing/java.client/blob/25ad2ae5bb24aa9d6b79400fce649b518dcfbe26/ws/ws/src/main/java/org/kaazing/gateway/client/util/WrappedByteBuffer.java#L912-L943
|
Mozu/mozu-java
|
mozu-java-core/src/main/java/com/mozu/api/urls/platform/InstalledApplicationsUrl.java
|
InstalledApplicationsUrl.getApplicationUrl
|
public static MozuUrl getApplicationUrl(String appId, String responseFields) {
"""
Get Resource Url for GetApplication
@param appId appId parameter description DOCUMENT_HERE
@param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss.
@return String Resource Url
"""
UrlFormatter formatter = new UrlFormatter("/api/platform/applications/{appId}?responseFields={responseFields}");
formatter.formatUrl("appId", appId);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
}
|
java
|
public static MozuUrl getApplicationUrl(String appId, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/platform/applications/{appId}?responseFields={responseFields}");
formatter.formatUrl("appId", appId);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
}
|
[
"public",
"static",
"MozuUrl",
"getApplicationUrl",
"(",
"String",
"appId",
",",
"String",
"responseFields",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
"(",
"\"/api/platform/applications/{appId}?responseFields={responseFields}\"",
")",
";",
"formatter",
".",
"formatUrl",
"(",
"\"appId\"",
",",
"appId",
")",
";",
"formatter",
".",
"formatUrl",
"(",
"\"responseFields\"",
",",
"responseFields",
")",
";",
"return",
"new",
"MozuUrl",
"(",
"formatter",
".",
"getResourceUrl",
"(",
")",
",",
"MozuUrl",
".",
"UrlLocation",
".",
"TENANT_POD",
")",
";",
"}"
] |
Get Resource Url for GetApplication
@param appId appId parameter description DOCUMENT_HERE
@param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss.
@return String Resource Url
|
[
"Get",
"Resource",
"Url",
"for",
"GetApplication"
] |
train
|
https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/platform/InstalledApplicationsUrl.java#L22-L28
|
gosu-lang/gosu-lang
|
gosu-lab/src/main/java/editor/util/TextComponentUtil.java
|
TextComponentUtil.getWhiteSpaceLineStartAfter
|
public static int getWhiteSpaceLineStartAfter( String script, int end ) {
"""
Returns the start of the next line if that line is only whitespace. Returns -1 otherwise.
"""
int endLine = getLineEnd( script, end );
if( endLine < script.length() - 1 )
{
int nextLineStart = endLine + 1;
int nextLineEnd = getLineEnd( script, nextLineStart );
boolean whitespace = GosuStringUtil.isWhitespace( script.substring( nextLineStart, nextLineEnd ) );
if( whitespace )
{
return nextLineStart;
}
}
return -1;
}
|
java
|
public static int getWhiteSpaceLineStartAfter( String script, int end )
{
int endLine = getLineEnd( script, end );
if( endLine < script.length() - 1 )
{
int nextLineStart = endLine + 1;
int nextLineEnd = getLineEnd( script, nextLineStart );
boolean whitespace = GosuStringUtil.isWhitespace( script.substring( nextLineStart, nextLineEnd ) );
if( whitespace )
{
return nextLineStart;
}
}
return -1;
}
|
[
"public",
"static",
"int",
"getWhiteSpaceLineStartAfter",
"(",
"String",
"script",
",",
"int",
"end",
")",
"{",
"int",
"endLine",
"=",
"getLineEnd",
"(",
"script",
",",
"end",
")",
";",
"if",
"(",
"endLine",
"<",
"script",
".",
"length",
"(",
")",
"-",
"1",
")",
"{",
"int",
"nextLineStart",
"=",
"endLine",
"+",
"1",
";",
"int",
"nextLineEnd",
"=",
"getLineEnd",
"(",
"script",
",",
"nextLineStart",
")",
";",
"boolean",
"whitespace",
"=",
"GosuStringUtil",
".",
"isWhitespace",
"(",
"script",
".",
"substring",
"(",
"nextLineStart",
",",
"nextLineEnd",
")",
")",
";",
"if",
"(",
"whitespace",
")",
"{",
"return",
"nextLineStart",
";",
"}",
"}",
"return",
"-",
"1",
";",
"}"
] |
Returns the start of the next line if that line is only whitespace. Returns -1 otherwise.
|
[
"Returns",
"the",
"start",
"of",
"the",
"next",
"line",
"if",
"that",
"line",
"is",
"only",
"whitespace",
".",
"Returns",
"-",
"1",
"otherwise",
"."
] |
train
|
https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-lab/src/main/java/editor/util/TextComponentUtil.java#L798-L812
|
Hygieia/Hygieia
|
api/src/main/java/com/capitalone/dashboard/service/DashboardServiceImpl.java
|
DashboardServiceImpl.getAllDashboardsByTitleCount
|
@Override
public Integer getAllDashboardsByTitleCount(String title, String type) {
"""
Get count of all dashboards filtered by title
@param title
@return Integer
"""
List<Dashboard> dashboards = null;
if ((type != null) && (!type.isEmpty()) && (!UNDEFINED.equalsIgnoreCase(type))) {
dashboards = dashboardRepository.findAllByTypeContainingIgnoreCaseAndTitleContainingIgnoreCase(type, title);
} else {
dashboards = dashboardRepository.findAllByTitleContainingIgnoreCase(title);
}
return dashboards != null ? dashboards.size() : 0;
}
|
java
|
@Override
public Integer getAllDashboardsByTitleCount(String title, String type) {
List<Dashboard> dashboards = null;
if ((type != null) && (!type.isEmpty()) && (!UNDEFINED.equalsIgnoreCase(type))) {
dashboards = dashboardRepository.findAllByTypeContainingIgnoreCaseAndTitleContainingIgnoreCase(type, title);
} else {
dashboards = dashboardRepository.findAllByTitleContainingIgnoreCase(title);
}
return dashboards != null ? dashboards.size() : 0;
}
|
[
"@",
"Override",
"public",
"Integer",
"getAllDashboardsByTitleCount",
"(",
"String",
"title",
",",
"String",
"type",
")",
"{",
"List",
"<",
"Dashboard",
">",
"dashboards",
"=",
"null",
";",
"if",
"(",
"(",
"type",
"!=",
"null",
")",
"&&",
"(",
"!",
"type",
".",
"isEmpty",
"(",
")",
")",
"&&",
"(",
"!",
"UNDEFINED",
".",
"equalsIgnoreCase",
"(",
"type",
")",
")",
")",
"{",
"dashboards",
"=",
"dashboardRepository",
".",
"findAllByTypeContainingIgnoreCaseAndTitleContainingIgnoreCase",
"(",
"type",
",",
"title",
")",
";",
"}",
"else",
"{",
"dashboards",
"=",
"dashboardRepository",
".",
"findAllByTitleContainingIgnoreCase",
"(",
"title",
")",
";",
"}",
"return",
"dashboards",
"!=",
"null",
"?",
"dashboards",
".",
"size",
"(",
")",
":",
"0",
";",
"}"
] |
Get count of all dashboards filtered by title
@param title
@return Integer
|
[
"Get",
"count",
"of",
"all",
"dashboards",
"filtered",
"by",
"title"
] |
train
|
https://github.com/Hygieia/Hygieia/blob/d8b67a590da2744acf59bcd99d9b34ef1bb84890/api/src/main/java/com/capitalone/dashboard/service/DashboardServiceImpl.java#L726-L735
|
talenguyen/PrettySharedPreferences
|
prettysharedpreferences/src/main/java/com/tale/prettysharedpreferences/PrettySharedPreferences.java
|
PrettySharedPreferences.getDoubleEditor
|
protected DoubleEditor getDoubleEditor(String key) {
"""
Call to get a {@link com.tale.prettysharedpreferences.DoubleEditor} object for the specific
key. <code>NOTE:</code> There is a unique {@link com.tale.prettysharedpreferences.TypeEditor}
object for a unique key.
@param key The name of the preference.
@return {@link com.tale.prettysharedpreferences.DoubleEditor} object to be store or retrieve
a {@link java.lang.Double} value.
"""
TypeEditor typeEditor = TYPE_EDITOR_MAP.get(key);
if (typeEditor == null) {
typeEditor = new DoubleEditor(this, sharedPreferences, key);
TYPE_EDITOR_MAP.put(key, typeEditor);
} else if (!(typeEditor instanceof DoubleEditor)) {
throw new IllegalArgumentException(String.format("key %s is already used for other type", key));
}
return (DoubleEditor) typeEditor;
}
|
java
|
protected DoubleEditor getDoubleEditor(String key) {
TypeEditor typeEditor = TYPE_EDITOR_MAP.get(key);
if (typeEditor == null) {
typeEditor = new DoubleEditor(this, sharedPreferences, key);
TYPE_EDITOR_MAP.put(key, typeEditor);
} else if (!(typeEditor instanceof DoubleEditor)) {
throw new IllegalArgumentException(String.format("key %s is already used for other type", key));
}
return (DoubleEditor) typeEditor;
}
|
[
"protected",
"DoubleEditor",
"getDoubleEditor",
"(",
"String",
"key",
")",
"{",
"TypeEditor",
"typeEditor",
"=",
"TYPE_EDITOR_MAP",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"typeEditor",
"==",
"null",
")",
"{",
"typeEditor",
"=",
"new",
"DoubleEditor",
"(",
"this",
",",
"sharedPreferences",
",",
"key",
")",
";",
"TYPE_EDITOR_MAP",
".",
"put",
"(",
"key",
",",
"typeEditor",
")",
";",
"}",
"else",
"if",
"(",
"!",
"(",
"typeEditor",
"instanceof",
"DoubleEditor",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"String",
".",
"format",
"(",
"\"key %s is already used for other type\"",
",",
"key",
")",
")",
";",
"}",
"return",
"(",
"DoubleEditor",
")",
"typeEditor",
";",
"}"
] |
Call to get a {@link com.tale.prettysharedpreferences.DoubleEditor} object for the specific
key. <code>NOTE:</code> There is a unique {@link com.tale.prettysharedpreferences.TypeEditor}
object for a unique key.
@param key The name of the preference.
@return {@link com.tale.prettysharedpreferences.DoubleEditor} object to be store or retrieve
a {@link java.lang.Double} value.
|
[
"Call",
"to",
"get",
"a",
"{"
] |
train
|
https://github.com/talenguyen/PrettySharedPreferences/blob/b97edf86c8fa65be2165f2cd790545c78c971c22/prettysharedpreferences/src/main/java/com/tale/prettysharedpreferences/PrettySharedPreferences.java#L129-L139
|
gallandarakhneorg/afc
|
advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GeodesicPosition.java
|
GeodesicPosition.toDecimalDegreeMinuteString
|
@Pure
public static String toDecimalDegreeMinuteString(double lambda, double phi, boolean useSymbolicDirection) {
"""
Replies the string representation of the longitude/latitude coordinates
in the Decimal Degree Minute format: coordinate containing degrees (integer)
and minutes (integer, or real number).
<p>Example: <code>40° 26.7717N 79° 56.93172W</code>
@param lambda is the longitude in degrees.
@param phi is the latitude in degrees.
@param useSymbolicDirection indicates if the directions should be output with there
symbols or if there are represented by the signs of the coordinates.
@return the string representation of the longitude/latitude coordinates.
"""
final StringBuilder b = new StringBuilder();
final SexagesimalLatitudeAxis latitudeAxis = (phi < 0.) ? SexagesimalLatitudeAxis.SOUTH : SexagesimalLatitudeAxis.NORTH;
final SexagesimalLongitudeAxis longitudeAxis = lambda < 0. ? SexagesimalLongitudeAxis.WEST
: SexagesimalLongitudeAxis.EAST;
toDMString(b, phi, useSymbolicDirection ? Locale.getString(latitudeAxis.name()) : EMPTY_STRING);
b.append(" "); //$NON-NLS-1$
toDMString(b, lambda, useSymbolicDirection ? Locale.getString(longitudeAxis.name()) : EMPTY_STRING);
return b.toString();
}
|
java
|
@Pure
public static String toDecimalDegreeMinuteString(double lambda, double phi, boolean useSymbolicDirection) {
final StringBuilder b = new StringBuilder();
final SexagesimalLatitudeAxis latitudeAxis = (phi < 0.) ? SexagesimalLatitudeAxis.SOUTH : SexagesimalLatitudeAxis.NORTH;
final SexagesimalLongitudeAxis longitudeAxis = lambda < 0. ? SexagesimalLongitudeAxis.WEST
: SexagesimalLongitudeAxis.EAST;
toDMString(b, phi, useSymbolicDirection ? Locale.getString(latitudeAxis.name()) : EMPTY_STRING);
b.append(" "); //$NON-NLS-1$
toDMString(b, lambda, useSymbolicDirection ? Locale.getString(longitudeAxis.name()) : EMPTY_STRING);
return b.toString();
}
|
[
"@",
"Pure",
"public",
"static",
"String",
"toDecimalDegreeMinuteString",
"(",
"double",
"lambda",
",",
"double",
"phi",
",",
"boolean",
"useSymbolicDirection",
")",
"{",
"final",
"StringBuilder",
"b",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"final",
"SexagesimalLatitudeAxis",
"latitudeAxis",
"=",
"(",
"phi",
"<",
"0.",
")",
"?",
"SexagesimalLatitudeAxis",
".",
"SOUTH",
":",
"SexagesimalLatitudeAxis",
".",
"NORTH",
";",
"final",
"SexagesimalLongitudeAxis",
"longitudeAxis",
"=",
"lambda",
"<",
"0.",
"?",
"SexagesimalLongitudeAxis",
".",
"WEST",
":",
"SexagesimalLongitudeAxis",
".",
"EAST",
";",
"toDMString",
"(",
"b",
",",
"phi",
",",
"useSymbolicDirection",
"?",
"Locale",
".",
"getString",
"(",
"latitudeAxis",
".",
"name",
"(",
")",
")",
":",
"EMPTY_STRING",
")",
";",
"b",
".",
"append",
"(",
"\" \"",
")",
";",
"//$NON-NLS-1$",
"toDMString",
"(",
"b",
",",
"lambda",
",",
"useSymbolicDirection",
"?",
"Locale",
".",
"getString",
"(",
"longitudeAxis",
".",
"name",
"(",
")",
")",
":",
"EMPTY_STRING",
")",
";",
"return",
"b",
".",
"toString",
"(",
")",
";",
"}"
] |
Replies the string representation of the longitude/latitude coordinates
in the Decimal Degree Minute format: coordinate containing degrees (integer)
and minutes (integer, or real number).
<p>Example: <code>40° 26.7717N 79° 56.93172W</code>
@param lambda is the longitude in degrees.
@param phi is the latitude in degrees.
@param useSymbolicDirection indicates if the directions should be output with there
symbols or if there are represented by the signs of the coordinates.
@return the string representation of the longitude/latitude coordinates.
|
[
"Replies",
"the",
"string",
"representation",
"of",
"the",
"longitude",
"/",
"latitude",
"coordinates",
"in",
"the",
"Decimal",
"Degree",
"Minute",
"format",
":",
"coordinate",
"containing",
"degrees",
"(",
"integer",
")",
"and",
"minutes",
"(",
"integer",
"or",
"real",
"number",
")",
"."
] |
train
|
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GeodesicPosition.java#L384-L394
|
wigforss/Ka-Jmx
|
core/src/main/java/org/kasource/jmx/core/util/JmxValueFormatterImpl.java
|
JmxValueFormatterImpl.toXml
|
private String toXml(Node node) {
"""
Returns the XML node as String of XML.
@param node Node to convert to String of XML
@return the XML node as String of XML.
"""
try {
Transformer transformer = TransformerFactory.newInstance().newTransformer();
StreamResult result = new StreamResult(new StringWriter());
DOMSource source = new DOMSource(node);
transformer.transform(source, result);
return result.getWriter().toString();
} catch(TransformerException ex) {
throw new IllegalArgumentException("Could not transform " +node + " to XML", ex);
}
}
|
java
|
private String toXml(Node node) {
try {
Transformer transformer = TransformerFactory.newInstance().newTransformer();
StreamResult result = new StreamResult(new StringWriter());
DOMSource source = new DOMSource(node);
transformer.transform(source, result);
return result.getWriter().toString();
} catch(TransformerException ex) {
throw new IllegalArgumentException("Could not transform " +node + " to XML", ex);
}
}
|
[
"private",
"String",
"toXml",
"(",
"Node",
"node",
")",
"{",
"try",
"{",
"Transformer",
"transformer",
"=",
"TransformerFactory",
".",
"newInstance",
"(",
")",
".",
"newTransformer",
"(",
")",
";",
"StreamResult",
"result",
"=",
"new",
"StreamResult",
"(",
"new",
"StringWriter",
"(",
")",
")",
";",
"DOMSource",
"source",
"=",
"new",
"DOMSource",
"(",
"node",
")",
";",
"transformer",
".",
"transform",
"(",
"source",
",",
"result",
")",
";",
"return",
"result",
".",
"getWriter",
"(",
")",
".",
"toString",
"(",
")",
";",
"}",
"catch",
"(",
"TransformerException",
"ex",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Could not transform \"",
"+",
"node",
"+",
"\" to XML\"",
",",
"ex",
")",
";",
"}",
"}"
] |
Returns the XML node as String of XML.
@param node Node to convert to String of XML
@return the XML node as String of XML.
|
[
"Returns",
"the",
"XML",
"node",
"as",
"String",
"of",
"XML",
"."
] |
train
|
https://github.com/wigforss/Ka-Jmx/blob/7f096394e5a11ad5ef483c90ce511a2ba2c14ab2/core/src/main/java/org/kasource/jmx/core/util/JmxValueFormatterImpl.java#L119-L129
|
qiniu/java-sdk
|
src/main/java/com/qiniu/storage/BucketManager.java
|
BucketManager.checkAsynFetchid
|
public Response checkAsynFetchid(String region, String fetchWorkId) throws QiniuException {
"""
查询异步抓取任务
@param region 抓取任务所在bucket区域 华东 z0 华北 z1 华南 z2 北美 na0 东南亚 as0
@param fetchWorkId 抓取任务id
@return Response
@throws QiniuException
"""
String path = String.format("http://api-%s.qiniu.com/sisyphus/fetch?id=%s", region, fetchWorkId);
return client.get(path, auth.authorization(path));
}
|
java
|
public Response checkAsynFetchid(String region, String fetchWorkId) throws QiniuException {
String path = String.format("http://api-%s.qiniu.com/sisyphus/fetch?id=%s", region, fetchWorkId);
return client.get(path, auth.authorization(path));
}
|
[
"public",
"Response",
"checkAsynFetchid",
"(",
"String",
"region",
",",
"String",
"fetchWorkId",
")",
"throws",
"QiniuException",
"{",
"String",
"path",
"=",
"String",
".",
"format",
"(",
"\"http://api-%s.qiniu.com/sisyphus/fetch?id=%s\"",
",",
"region",
",",
"fetchWorkId",
")",
";",
"return",
"client",
".",
"get",
"(",
"path",
",",
"auth",
".",
"authorization",
"(",
"path",
")",
")",
";",
"}"
] |
查询异步抓取任务
@param region 抓取任务所在bucket区域 华东 z0 华北 z1 华南 z2 北美 na0 东南亚 as0
@param fetchWorkId 抓取任务id
@return Response
@throws QiniuException
|
[
"查询异步抓取任务"
] |
train
|
https://github.com/qiniu/java-sdk/blob/6c05f3fb718403a496c725b048e9241f80171499/src/main/java/com/qiniu/storage/BucketManager.java#L521-L524
|
adessoAG/wicked-charts
|
wicket/wicked-charts-wicket6/src/main/java/de/adesso/wickedcharts/wicket6/JavaScriptExpressionSendingAjaxBehavior.java
|
JavaScriptExpressionSendingAjaxBehavior.addJavaScriptValues
|
public void addJavaScriptValues(Map<String, String> parameterMap) {
"""
Adds a set of javascript expressions to be passed from client to server.
@param parameterMap a map containing the name of a parameter as key and a javascript
expression as value
@see #addJavaScriptValue(String, String)
"""
for (String parameterName : parameterMap.keySet()) {
this.javascriptExpressions.put(parameterName, parameterMap.get(parameterName));
}
}
|
java
|
public void addJavaScriptValues(Map<String, String> parameterMap) {
for (String parameterName : parameterMap.keySet()) {
this.javascriptExpressions.put(parameterName, parameterMap.get(parameterName));
}
}
|
[
"public",
"void",
"addJavaScriptValues",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"parameterMap",
")",
"{",
"for",
"(",
"String",
"parameterName",
":",
"parameterMap",
".",
"keySet",
"(",
")",
")",
"{",
"this",
".",
"javascriptExpressions",
".",
"put",
"(",
"parameterName",
",",
"parameterMap",
".",
"get",
"(",
"parameterName",
")",
")",
";",
"}",
"}"
] |
Adds a set of javascript expressions to be passed from client to server.
@param parameterMap a map containing the name of a parameter as key and a javascript
expression as value
@see #addJavaScriptValue(String, String)
|
[
"Adds",
"a",
"set",
"of",
"javascript",
"expressions",
"to",
"be",
"passed",
"from",
"client",
"to",
"server",
"."
] |
train
|
https://github.com/adessoAG/wicked-charts/blob/498aceff025f612e22ba5135b26531afeabac03c/wicket/wicked-charts-wicket6/src/main/java/de/adesso/wickedcharts/wicket6/JavaScriptExpressionSendingAjaxBehavior.java#L83-L87
|
infinispan/infinispan
|
object-filter/src/main/java/org/infinispan/objectfilter/impl/syntax/parser/QueryRendererDelegateImpl.java
|
QueryRendererDelegateImpl.sortSpecification
|
@Override
public void sortSpecification(String collateName, boolean isAscending) {
"""
Add field sort criteria.
@param collateName optional collation name
@param isAscending sort direction
"""
// collationName is ignored for now
PropertyPath<TypeDescriptor<TypeMetadata>> property = resolveAlias(propertyPath);
checkAnalyzed(property, false); //todo [anistor] cannot sort on analyzed field?
if (sortFields == null) {
sortFields = new ArrayList<>(ARRAY_INITIAL_LENGTH);
}
sortFields.add(new IckleParsingResult.SortFieldImpl<>(property, isAscending));
}
|
java
|
@Override
public void sortSpecification(String collateName, boolean isAscending) {
// collationName is ignored for now
PropertyPath<TypeDescriptor<TypeMetadata>> property = resolveAlias(propertyPath);
checkAnalyzed(property, false); //todo [anistor] cannot sort on analyzed field?
if (sortFields == null) {
sortFields = new ArrayList<>(ARRAY_INITIAL_LENGTH);
}
sortFields.add(new IckleParsingResult.SortFieldImpl<>(property, isAscending));
}
|
[
"@",
"Override",
"public",
"void",
"sortSpecification",
"(",
"String",
"collateName",
",",
"boolean",
"isAscending",
")",
"{",
"// collationName is ignored for now",
"PropertyPath",
"<",
"TypeDescriptor",
"<",
"TypeMetadata",
">>",
"property",
"=",
"resolveAlias",
"(",
"propertyPath",
")",
";",
"checkAnalyzed",
"(",
"property",
",",
"false",
")",
";",
"//todo [anistor] cannot sort on analyzed field?",
"if",
"(",
"sortFields",
"==",
"null",
")",
"{",
"sortFields",
"=",
"new",
"ArrayList",
"<>",
"(",
"ARRAY_INITIAL_LENGTH",
")",
";",
"}",
"sortFields",
".",
"add",
"(",
"new",
"IckleParsingResult",
".",
"SortFieldImpl",
"<>",
"(",
"property",
",",
"isAscending",
")",
")",
";",
"}"
] |
Add field sort criteria.
@param collateName optional collation name
@param isAscending sort direction
|
[
"Add",
"field",
"sort",
"criteria",
"."
] |
train
|
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/object-filter/src/main/java/org/infinispan/objectfilter/impl/syntax/parser/QueryRendererDelegateImpl.java#L529-L539
|
Azure/azure-sdk-for-java
|
sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/BackupShortTermRetentionPoliciesInner.java
|
BackupShortTermRetentionPoliciesInner.beginUpdate
|
public BackupShortTermRetentionPolicyInner beginUpdate(String resourceGroupName, String serverName, String databaseName, Integer retentionDays) {
"""
Updates a database's short term retention policy.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param databaseName The name of the database.
@param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the BackupShortTermRetentionPolicyInner object if successful.
"""
return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, retentionDays).toBlocking().single().body();
}
|
java
|
public BackupShortTermRetentionPolicyInner beginUpdate(String resourceGroupName, String serverName, String databaseName, Integer retentionDays) {
return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, retentionDays).toBlocking().single().body();
}
|
[
"public",
"BackupShortTermRetentionPolicyInner",
"beginUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"databaseName",
",",
"Integer",
"retentionDays",
")",
"{",
"return",
"beginUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"serverName",
",",
"databaseName",
",",
"retentionDays",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
] |
Updates a database's short term retention policy.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param databaseName The name of the database.
@param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the BackupShortTermRetentionPolicyInner object if successful.
|
[
"Updates",
"a",
"database",
"s",
"short",
"term",
"retention",
"policy",
"."
] |
train
|
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/BackupShortTermRetentionPoliciesInner.java#L804-L806
|
shrinkwrap/shrinkwrap
|
impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/MemoryMapArchiveBase.java
|
MemoryMapArchiveBase.startsWith
|
private boolean startsWith(ArchivePath fullPath, ArchivePath startingPath) {
"""
Check to see if one path starts with another
@param fullPath
@param startingPath
@return
"""
final String context = fullPath.get();
final String startingContext = startingPath.get();
return context.startsWith(startingContext);
}
|
java
|
private boolean startsWith(ArchivePath fullPath, ArchivePath startingPath) {
final String context = fullPath.get();
final String startingContext = startingPath.get();
return context.startsWith(startingContext);
}
|
[
"private",
"boolean",
"startsWith",
"(",
"ArchivePath",
"fullPath",
",",
"ArchivePath",
"startingPath",
")",
"{",
"final",
"String",
"context",
"=",
"fullPath",
".",
"get",
"(",
")",
";",
"final",
"String",
"startingContext",
"=",
"startingPath",
".",
"get",
"(",
")",
";",
"return",
"context",
".",
"startsWith",
"(",
"startingContext",
")",
";",
"}"
] |
Check to see if one path starts with another
@param fullPath
@param startingPath
@return
|
[
"Check",
"to",
"see",
"if",
"one",
"path",
"starts",
"with",
"another"
] |
train
|
https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/MemoryMapArchiveBase.java#L449-L454
|
UrielCh/ovh-java-sdk
|
ovh-java-sdk-packxdsl/src/main/java/net/minidev/ovh/api/ApiOvhPackxdsl.java
|
ApiOvhPackxdsl.packName_siteBuilderFull_options_templates_GET
|
public ArrayList<OvhSiteBuilderTemplate> packName_siteBuilderFull_options_templates_GET(String packName) throws IOException {
"""
Get the available templates
REST: GET /pack/xdsl/{packName}/siteBuilderFull/options/templates
@param packName [required] The internal name of your pack
"""
String qPath = "/pack/xdsl/{packName}/siteBuilderFull/options/templates";
StringBuilder sb = path(qPath, packName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t8);
}
|
java
|
public ArrayList<OvhSiteBuilderTemplate> packName_siteBuilderFull_options_templates_GET(String packName) throws IOException {
String qPath = "/pack/xdsl/{packName}/siteBuilderFull/options/templates";
StringBuilder sb = path(qPath, packName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t8);
}
|
[
"public",
"ArrayList",
"<",
"OvhSiteBuilderTemplate",
">",
"packName_siteBuilderFull_options_templates_GET",
"(",
"String",
"packName",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/pack/xdsl/{packName}/siteBuilderFull/options/templates\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"packName",
")",
";",
"String",
"resp",
"=",
"exec",
"(",
"qPath",
",",
"\"GET\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"null",
")",
";",
"return",
"convertTo",
"(",
"resp",
",",
"t8",
")",
";",
"}"
] |
Get the available templates
REST: GET /pack/xdsl/{packName}/siteBuilderFull/options/templates
@param packName [required] The internal name of your pack
|
[
"Get",
"the",
"available",
"templates"
] |
train
|
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-packxdsl/src/main/java/net/minidev/ovh/api/ApiOvhPackxdsl.java#L524-L529
|
Azure/azure-sdk-for-java
|
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java
|
ModelsImpl.addCustomPrebuiltEntityAsync
|
public Observable<UUID> addCustomPrebuiltEntityAsync(UUID appId, String versionId, PrebuiltDomainModelCreateObject prebuiltDomainModelCreateObject) {
"""
Adds a custom prebuilt entity model to the application.
@param appId The application ID.
@param versionId The version ID.
@param prebuiltDomainModelCreateObject A model object containing the name of the custom prebuilt entity and the name of the domain to which this model belongs.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the UUID object
"""
return addCustomPrebuiltEntityWithServiceResponseAsync(appId, versionId, prebuiltDomainModelCreateObject).map(new Func1<ServiceResponse<UUID>, UUID>() {
@Override
public UUID call(ServiceResponse<UUID> response) {
return response.body();
}
});
}
|
java
|
public Observable<UUID> addCustomPrebuiltEntityAsync(UUID appId, String versionId, PrebuiltDomainModelCreateObject prebuiltDomainModelCreateObject) {
return addCustomPrebuiltEntityWithServiceResponseAsync(appId, versionId, prebuiltDomainModelCreateObject).map(new Func1<ServiceResponse<UUID>, UUID>() {
@Override
public UUID call(ServiceResponse<UUID> response) {
return response.body();
}
});
}
|
[
"public",
"Observable",
"<",
"UUID",
">",
"addCustomPrebuiltEntityAsync",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"PrebuiltDomainModelCreateObject",
"prebuiltDomainModelCreateObject",
")",
"{",
"return",
"addCustomPrebuiltEntityWithServiceResponseAsync",
"(",
"appId",
",",
"versionId",
",",
"prebuiltDomainModelCreateObject",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"UUID",
">",
",",
"UUID",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"UUID",
"call",
"(",
"ServiceResponse",
"<",
"UUID",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] |
Adds a custom prebuilt entity model to the application.
@param appId The application ID.
@param versionId The version ID.
@param prebuiltDomainModelCreateObject A model object containing the name of the custom prebuilt entity and the name of the domain to which this model belongs.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the UUID object
|
[
"Adds",
"a",
"custom",
"prebuilt",
"entity",
"model",
"to",
"the",
"application",
"."
] |
train
|
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L5916-L5923
|
jayantk/jklol
|
src/com/jayantkrish/jklol/util/Assignment.java
|
Assignment.mapVariables
|
public Assignment mapVariables(Map<Integer, Integer> varMap) {
"""
Return a new assignment where each var num has been replaced by its value
in varMap.
"""
int[] newVarNums = new int[vars.length];
Object[] newValues = new Object[vars.length];
int numFilled = 0;
for (int i = 0; i < vars.length; i++) {
if (varMap.containsKey(vars[i])) {
newVarNums[numFilled] = varMap.get(vars[i]);
newValues[numFilled] = values[i];
numFilled++;
}
}
if (numFilled < newVarNums.length) {
newVarNums = Arrays.copyOf(newVarNums, numFilled);
newValues = Arrays.copyOf(newValues, numFilled);
}
return Assignment.fromUnsortedArrays(newVarNums, newValues);
}
|
java
|
public Assignment mapVariables(Map<Integer, Integer> varMap) {
int[] newVarNums = new int[vars.length];
Object[] newValues = new Object[vars.length];
int numFilled = 0;
for (int i = 0; i < vars.length; i++) {
if (varMap.containsKey(vars[i])) {
newVarNums[numFilled] = varMap.get(vars[i]);
newValues[numFilled] = values[i];
numFilled++;
}
}
if (numFilled < newVarNums.length) {
newVarNums = Arrays.copyOf(newVarNums, numFilled);
newValues = Arrays.copyOf(newValues, numFilled);
}
return Assignment.fromUnsortedArrays(newVarNums, newValues);
}
|
[
"public",
"Assignment",
"mapVariables",
"(",
"Map",
"<",
"Integer",
",",
"Integer",
">",
"varMap",
")",
"{",
"int",
"[",
"]",
"newVarNums",
"=",
"new",
"int",
"[",
"vars",
".",
"length",
"]",
";",
"Object",
"[",
"]",
"newValues",
"=",
"new",
"Object",
"[",
"vars",
".",
"length",
"]",
";",
"int",
"numFilled",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"vars",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"varMap",
".",
"containsKey",
"(",
"vars",
"[",
"i",
"]",
")",
")",
"{",
"newVarNums",
"[",
"numFilled",
"]",
"=",
"varMap",
".",
"get",
"(",
"vars",
"[",
"i",
"]",
")",
";",
"newValues",
"[",
"numFilled",
"]",
"=",
"values",
"[",
"i",
"]",
";",
"numFilled",
"++",
";",
"}",
"}",
"if",
"(",
"numFilled",
"<",
"newVarNums",
".",
"length",
")",
"{",
"newVarNums",
"=",
"Arrays",
".",
"copyOf",
"(",
"newVarNums",
",",
"numFilled",
")",
";",
"newValues",
"=",
"Arrays",
".",
"copyOf",
"(",
"newValues",
",",
"numFilled",
")",
";",
"}",
"return",
"Assignment",
".",
"fromUnsortedArrays",
"(",
"newVarNums",
",",
"newValues",
")",
";",
"}"
] |
Return a new assignment where each var num has been replaced by its value
in varMap.
|
[
"Return",
"a",
"new",
"assignment",
"where",
"each",
"var",
"num",
"has",
"been",
"replaced",
"by",
"its",
"value",
"in",
"varMap",
"."
] |
train
|
https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/util/Assignment.java#L359-L377
|
bbossgroups/bboss-elasticsearch
|
bboss-elasticsearch-spring-boot-starter/src/main/java/org/frameworkset/elasticsearch/boot/BBossESStarter.java
|
BBossESStarter.getConfigRestClient
|
public ClientInterface getConfigRestClient(String elasticsearchName,String configFile) {
"""
Get Special elasticsearch server ConfigFile ClientInterface
@param elasticsearchName elasticsearch server name which defined in bboss spring boot application configfile
@param configFile
@return
"""
return ElasticSearchHelper.getConfigRestClientUtil(elasticsearchName,configFile);
}
|
java
|
public ClientInterface getConfigRestClient(String elasticsearchName,String configFile){
return ElasticSearchHelper.getConfigRestClientUtil(elasticsearchName,configFile);
}
|
[
"public",
"ClientInterface",
"getConfigRestClient",
"(",
"String",
"elasticsearchName",
",",
"String",
"configFile",
")",
"{",
"return",
"ElasticSearchHelper",
".",
"getConfigRestClientUtil",
"(",
"elasticsearchName",
",",
"configFile",
")",
";",
"}"
] |
Get Special elasticsearch server ConfigFile ClientInterface
@param elasticsearchName elasticsearch server name which defined in bboss spring boot application configfile
@param configFile
@return
|
[
"Get",
"Special",
"elasticsearch",
"server",
"ConfigFile",
"ClientInterface"
] |
train
|
https://github.com/bbossgroups/bboss-elasticsearch/blob/31717c8aa2c4c880987be53aeeb8a0cf5183c3a7/bboss-elasticsearch-spring-boot-starter/src/main/java/org/frameworkset/elasticsearch/boot/BBossESStarter.java#L77-L81
|
google/j2objc
|
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/Encodings.java
|
Encodings.getEncodingInfo
|
static EncodingInfo getEncodingInfo(String encoding) {
"""
Returns the EncodingInfo object for the specified
encoding, never null, although the encoding name
inside the returned EncodingInfo object will be if
we can't find a "real" EncodingInfo for the encoding.
<p>
This is not a public API.
@param encoding The encoding
@return The object that is used to determine if
characters are in the given encoding.
@xsl.usage internal
"""
EncodingInfo ei;
String normalizedEncoding = toUpperCaseFast(encoding);
ei = (EncodingInfo) _encodingTableKeyJava.get(normalizedEncoding);
if (ei == null)
ei = (EncodingInfo) _encodingTableKeyMime.get(normalizedEncoding);
if (ei == null) {
// We shouldn't have to do this, but just in case.
ei = new EncodingInfo(null,null, '\u0000');
}
return ei;
}
|
java
|
static EncodingInfo getEncodingInfo(String encoding)
{
EncodingInfo ei;
String normalizedEncoding = toUpperCaseFast(encoding);
ei = (EncodingInfo) _encodingTableKeyJava.get(normalizedEncoding);
if (ei == null)
ei = (EncodingInfo) _encodingTableKeyMime.get(normalizedEncoding);
if (ei == null) {
// We shouldn't have to do this, but just in case.
ei = new EncodingInfo(null,null, '\u0000');
}
return ei;
}
|
[
"static",
"EncodingInfo",
"getEncodingInfo",
"(",
"String",
"encoding",
")",
"{",
"EncodingInfo",
"ei",
";",
"String",
"normalizedEncoding",
"=",
"toUpperCaseFast",
"(",
"encoding",
")",
";",
"ei",
"=",
"(",
"EncodingInfo",
")",
"_encodingTableKeyJava",
".",
"get",
"(",
"normalizedEncoding",
")",
";",
"if",
"(",
"ei",
"==",
"null",
")",
"ei",
"=",
"(",
"EncodingInfo",
")",
"_encodingTableKeyMime",
".",
"get",
"(",
"normalizedEncoding",
")",
";",
"if",
"(",
"ei",
"==",
"null",
")",
"{",
"// We shouldn't have to do this, but just in case.",
"ei",
"=",
"new",
"EncodingInfo",
"(",
"null",
",",
"null",
",",
"'",
"'",
")",
";",
"}",
"return",
"ei",
";",
"}"
] |
Returns the EncodingInfo object for the specified
encoding, never null, although the encoding name
inside the returned EncodingInfo object will be if
we can't find a "real" EncodingInfo for the encoding.
<p>
This is not a public API.
@param encoding The encoding
@return The object that is used to determine if
characters are in the given encoding.
@xsl.usage internal
|
[
"Returns",
"the",
"EncodingInfo",
"object",
"for",
"the",
"specified",
"encoding",
"never",
"null",
"although",
"the",
"encoding",
"name",
"inside",
"the",
"returned",
"EncodingInfo",
"object",
"will",
"be",
"if",
"we",
"can",
"t",
"find",
"a",
"real",
"EncodingInfo",
"for",
"the",
"encoding",
".",
"<p",
">",
"This",
"is",
"not",
"a",
"public",
"API",
"."
] |
train
|
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/Encodings.java#L116-L130
|
Azure/azure-sdk-for-java
|
automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/JobStreamsInner.java
|
JobStreamsInner.listByJobWithServiceResponseAsync
|
public Observable<ServiceResponse<Page<JobStreamInner>>> listByJobWithServiceResponseAsync(final String resourceGroupName, final String automationAccountName, final String jobId) {
"""
Retrieve a list of jobs streams identified by job id.
@param resourceGroupName Name of an Azure Resource group.
@param automationAccountName The name of the automation account.
@param jobId The job Id.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<JobStreamInner> object
"""
return listByJobSinglePageAsync(resourceGroupName, automationAccountName, jobId)
.concatMap(new Func1<ServiceResponse<Page<JobStreamInner>>, Observable<ServiceResponse<Page<JobStreamInner>>>>() {
@Override
public Observable<ServiceResponse<Page<JobStreamInner>>> call(ServiceResponse<Page<JobStreamInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listByJobNextWithServiceResponseAsync(nextPageLink));
}
});
}
|
java
|
public Observable<ServiceResponse<Page<JobStreamInner>>> listByJobWithServiceResponseAsync(final String resourceGroupName, final String automationAccountName, final String jobId) {
return listByJobSinglePageAsync(resourceGroupName, automationAccountName, jobId)
.concatMap(new Func1<ServiceResponse<Page<JobStreamInner>>, Observable<ServiceResponse<Page<JobStreamInner>>>>() {
@Override
public Observable<ServiceResponse<Page<JobStreamInner>>> call(ServiceResponse<Page<JobStreamInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listByJobNextWithServiceResponseAsync(nextPageLink));
}
});
}
|
[
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"Page",
"<",
"JobStreamInner",
">",
">",
">",
"listByJobWithServiceResponseAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"automationAccountName",
",",
"final",
"String",
"jobId",
")",
"{",
"return",
"listByJobSinglePageAsync",
"(",
"resourceGroupName",
",",
"automationAccountName",
",",
"jobId",
")",
".",
"concatMap",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"Page",
"<",
"JobStreamInner",
">",
">",
",",
"Observable",
"<",
"ServiceResponse",
"<",
"Page",
"<",
"JobStreamInner",
">",
">",
">",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"Page",
"<",
"JobStreamInner",
">",
">",
">",
"call",
"(",
"ServiceResponse",
"<",
"Page",
"<",
"JobStreamInner",
">",
">",
"page",
")",
"{",
"String",
"nextPageLink",
"=",
"page",
".",
"body",
"(",
")",
".",
"nextPageLink",
"(",
")",
";",
"if",
"(",
"nextPageLink",
"==",
"null",
")",
"{",
"return",
"Observable",
".",
"just",
"(",
"page",
")",
";",
"}",
"return",
"Observable",
".",
"just",
"(",
"page",
")",
".",
"concatWith",
"(",
"listByJobNextWithServiceResponseAsync",
"(",
"nextPageLink",
")",
")",
";",
"}",
"}",
")",
";",
"}"
] |
Retrieve a list of jobs streams identified by job id.
@param resourceGroupName Name of an Azure Resource group.
@param automationAccountName The name of the automation account.
@param jobId The job Id.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<JobStreamInner> object
|
[
"Retrieve",
"a",
"list",
"of",
"jobs",
"streams",
"identified",
"by",
"job",
"id",
"."
] |
train
|
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/JobStreamsInner.java#L243-L255
|
openbase/jul
|
extension/type/processing/src/main/java/org/openbase/jul/extension/type/processing/TimestampProcessor.java
|
TimestampProcessor.getTimestamp
|
public static long getTimestamp(final MessageOrBuilder messageOrBuilder, final TimeUnit timeUnit) throws NotAvailableException {
"""
Method resolves the timestamp of the given {@code messageOrBuilder} and returns the time it the given {@code timeUnit}.
@param messageOrBuilder a message containing the timestamp.
@param timeUnit the time unit of the return value.
@return the time of the timestamp.
@throws NotAvailableException in thrown if the {@code messageOrBuilder} does not support or contain a timestamp.
"""
final FieldDescriptor timeStampFieldDescriptor = ProtoBufFieldProcessor.getFieldDescriptor(messageOrBuilder, TIMESTAMP_NAME.toLowerCase());
if (timeStampFieldDescriptor == null || !messageOrBuilder.hasField(timeStampFieldDescriptor)) {
throw new NotAvailableException(TIMESTAMP_NAME);
}
return TimeUnit.MILLISECONDS.convert(((Timestamp) messageOrBuilder.getField(timeStampFieldDescriptor)).getTime(), timeUnit);
}
|
java
|
public static long getTimestamp(final MessageOrBuilder messageOrBuilder, final TimeUnit timeUnit) throws NotAvailableException {
final FieldDescriptor timeStampFieldDescriptor = ProtoBufFieldProcessor.getFieldDescriptor(messageOrBuilder, TIMESTAMP_NAME.toLowerCase());
if (timeStampFieldDescriptor == null || !messageOrBuilder.hasField(timeStampFieldDescriptor)) {
throw new NotAvailableException(TIMESTAMP_NAME);
}
return TimeUnit.MILLISECONDS.convert(((Timestamp) messageOrBuilder.getField(timeStampFieldDescriptor)).getTime(), timeUnit);
}
|
[
"public",
"static",
"long",
"getTimestamp",
"(",
"final",
"MessageOrBuilder",
"messageOrBuilder",
",",
"final",
"TimeUnit",
"timeUnit",
")",
"throws",
"NotAvailableException",
"{",
"final",
"FieldDescriptor",
"timeStampFieldDescriptor",
"=",
"ProtoBufFieldProcessor",
".",
"getFieldDescriptor",
"(",
"messageOrBuilder",
",",
"TIMESTAMP_NAME",
".",
"toLowerCase",
"(",
")",
")",
";",
"if",
"(",
"timeStampFieldDescriptor",
"==",
"null",
"||",
"!",
"messageOrBuilder",
".",
"hasField",
"(",
"timeStampFieldDescriptor",
")",
")",
"{",
"throw",
"new",
"NotAvailableException",
"(",
"TIMESTAMP_NAME",
")",
";",
"}",
"return",
"TimeUnit",
".",
"MILLISECONDS",
".",
"convert",
"(",
"(",
"(",
"Timestamp",
")",
"messageOrBuilder",
".",
"getField",
"(",
"timeStampFieldDescriptor",
")",
")",
".",
"getTime",
"(",
")",
",",
"timeUnit",
")",
";",
"}"
] |
Method resolves the timestamp of the given {@code messageOrBuilder} and returns the time it the given {@code timeUnit}.
@param messageOrBuilder a message containing the timestamp.
@param timeUnit the time unit of the return value.
@return the time of the timestamp.
@throws NotAvailableException in thrown if the {@code messageOrBuilder} does not support or contain a timestamp.
|
[
"Method",
"resolves",
"the",
"timestamp",
"of",
"the",
"given",
"{",
"@code",
"messageOrBuilder",
"}",
"and",
"returns",
"the",
"time",
"it",
"the",
"given",
"{",
"@code",
"timeUnit",
"}",
"."
] |
train
|
https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/extension/type/processing/src/main/java/org/openbase/jul/extension/type/processing/TimestampProcessor.java#L137-L143
|
mozilla/rhino
|
src/org/mozilla/javascript/Context.java
|
Context.javaToJS
|
public static Object javaToJS(Object value, Scriptable scope) {
"""
Convenient method to convert java value to its closest representation
in JavaScript.
<p>
If value is an instance of String, Number, Boolean, Function or
Scriptable, it is returned as it and will be treated as the corresponding
JavaScript type of string, number, boolean, function and object.
<p>
Note that for Number instances during any arithmetic operation in
JavaScript the engine will always use the result of
<tt>Number.doubleValue()</tt> resulting in a precision loss if
the number can not fit into double.
<p>
If value is an instance of Character, it will be converted to string of
length 1 and its JavaScript type will be string.
<p>
The rest of values will be wrapped as LiveConnect objects
by calling {@link WrapFactory#wrap(Context cx, Scriptable scope,
Object obj, Class staticType)} as in:
<pre>
Context cx = Context.getCurrentContext();
return cx.getWrapFactory().wrap(cx, scope, value, null);
</pre>
@param value any Java object
@param scope top scope object
@return value suitable to pass to any API that takes JavaScript values.
"""
if (value instanceof String || value instanceof Number
|| value instanceof Boolean || value instanceof Scriptable)
{
return value;
} else if (value instanceof Character) {
return String.valueOf(((Character)value).charValue());
} else {
Context cx = Context.getContext();
return cx.getWrapFactory().wrap(cx, scope, value, null);
}
}
|
java
|
public static Object javaToJS(Object value, Scriptable scope)
{
if (value instanceof String || value instanceof Number
|| value instanceof Boolean || value instanceof Scriptable)
{
return value;
} else if (value instanceof Character) {
return String.valueOf(((Character)value).charValue());
} else {
Context cx = Context.getContext();
return cx.getWrapFactory().wrap(cx, scope, value, null);
}
}
|
[
"public",
"static",
"Object",
"javaToJS",
"(",
"Object",
"value",
",",
"Scriptable",
"scope",
")",
"{",
"if",
"(",
"value",
"instanceof",
"String",
"||",
"value",
"instanceof",
"Number",
"||",
"value",
"instanceof",
"Boolean",
"||",
"value",
"instanceof",
"Scriptable",
")",
"{",
"return",
"value",
";",
"}",
"else",
"if",
"(",
"value",
"instanceof",
"Character",
")",
"{",
"return",
"String",
".",
"valueOf",
"(",
"(",
"(",
"Character",
")",
"value",
")",
".",
"charValue",
"(",
")",
")",
";",
"}",
"else",
"{",
"Context",
"cx",
"=",
"Context",
".",
"getContext",
"(",
")",
";",
"return",
"cx",
".",
"getWrapFactory",
"(",
")",
".",
"wrap",
"(",
"cx",
",",
"scope",
",",
"value",
",",
"null",
")",
";",
"}",
"}"
] |
Convenient method to convert java value to its closest representation
in JavaScript.
<p>
If value is an instance of String, Number, Boolean, Function or
Scriptable, it is returned as it and will be treated as the corresponding
JavaScript type of string, number, boolean, function and object.
<p>
Note that for Number instances during any arithmetic operation in
JavaScript the engine will always use the result of
<tt>Number.doubleValue()</tt> resulting in a precision loss if
the number can not fit into double.
<p>
If value is an instance of Character, it will be converted to string of
length 1 and its JavaScript type will be string.
<p>
The rest of values will be wrapped as LiveConnect objects
by calling {@link WrapFactory#wrap(Context cx, Scriptable scope,
Object obj, Class staticType)} as in:
<pre>
Context cx = Context.getCurrentContext();
return cx.getWrapFactory().wrap(cx, scope, value, null);
</pre>
@param value any Java object
@param scope top scope object
@return value suitable to pass to any API that takes JavaScript values.
|
[
"Convenient",
"method",
"to",
"convert",
"java",
"value",
"to",
"its",
"closest",
"representation",
"in",
"JavaScript",
".",
"<p",
">",
"If",
"value",
"is",
"an",
"instance",
"of",
"String",
"Number",
"Boolean",
"Function",
"or",
"Scriptable",
"it",
"is",
"returned",
"as",
"it",
"and",
"will",
"be",
"treated",
"as",
"the",
"corresponding",
"JavaScript",
"type",
"of",
"string",
"number",
"boolean",
"function",
"and",
"object",
".",
"<p",
">",
"Note",
"that",
"for",
"Number",
"instances",
"during",
"any",
"arithmetic",
"operation",
"in",
"JavaScript",
"the",
"engine",
"will",
"always",
"use",
"the",
"result",
"of",
"<tt",
">",
"Number",
".",
"doubleValue",
"()",
"<",
"/",
"tt",
">",
"resulting",
"in",
"a",
"precision",
"loss",
"if",
"the",
"number",
"can",
"not",
"fit",
"into",
"double",
".",
"<p",
">",
"If",
"value",
"is",
"an",
"instance",
"of",
"Character",
"it",
"will",
"be",
"converted",
"to",
"string",
"of",
"length",
"1",
"and",
"its",
"JavaScript",
"type",
"will",
"be",
"string",
".",
"<p",
">",
"The",
"rest",
"of",
"values",
"will",
"be",
"wrapped",
"as",
"LiveConnect",
"objects",
"by",
"calling",
"{",
"@link",
"WrapFactory#wrap",
"(",
"Context",
"cx",
"Scriptable",
"scope",
"Object",
"obj",
"Class",
"staticType",
")",
"}",
"as",
"in",
":",
"<pre",
">",
"Context",
"cx",
"=",
"Context",
".",
"getCurrentContext",
"()",
";",
"return",
"cx",
".",
"getWrapFactory",
"()",
".",
"wrap",
"(",
"cx",
"scope",
"value",
"null",
")",
";",
"<",
"/",
"pre",
">"
] |
train
|
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/Context.java#L1849-L1861
|
google/j2objc
|
jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/DateFormatSymbols.java
|
DateFormatSymbols.copyMembers
|
private final void copyMembers(DateFormatSymbols src, DateFormatSymbols dst) {
"""
Clones all the data members from the source DateFormatSymbols to
the target DateFormatSymbols. This is only for subclasses.
@param src the source DateFormatSymbols.
@param dst the target DateFormatSymbols.
"""
dst.eras = Arrays.copyOf(src.eras, src.eras.length);
dst.months = Arrays.copyOf(src.months, src.months.length);
dst.shortMonths = Arrays.copyOf(src.shortMonths, src.shortMonths.length);
dst.weekdays = Arrays.copyOf(src.weekdays, src.weekdays.length);
dst.shortWeekdays = Arrays.copyOf(src.shortWeekdays, src.shortWeekdays.length);
dst.ampms = Arrays.copyOf(src.ampms, src.ampms.length);
if (src.zoneStrings != null) {
dst.zoneStrings = src.getZoneStringsImpl(true);
} else {
dst.zoneStrings = null;
}
dst.localPatternChars = src.localPatternChars;
dst.tinyMonths = src.tinyMonths;
dst.tinyWeekdays = src.tinyWeekdays;
dst.standAloneMonths = src.standAloneMonths;
dst.shortStandAloneMonths = src.shortStandAloneMonths;
dst.tinyStandAloneMonths = src.tinyStandAloneMonths;
dst.standAloneWeekdays = src.standAloneWeekdays;
dst.shortStandAloneWeekdays = src.shortStandAloneWeekdays;
dst.tinyStandAloneWeekdays = src.tinyStandAloneWeekdays;
}
|
java
|
private final void copyMembers(DateFormatSymbols src, DateFormatSymbols dst)
{
dst.eras = Arrays.copyOf(src.eras, src.eras.length);
dst.months = Arrays.copyOf(src.months, src.months.length);
dst.shortMonths = Arrays.copyOf(src.shortMonths, src.shortMonths.length);
dst.weekdays = Arrays.copyOf(src.weekdays, src.weekdays.length);
dst.shortWeekdays = Arrays.copyOf(src.shortWeekdays, src.shortWeekdays.length);
dst.ampms = Arrays.copyOf(src.ampms, src.ampms.length);
if (src.zoneStrings != null) {
dst.zoneStrings = src.getZoneStringsImpl(true);
} else {
dst.zoneStrings = null;
}
dst.localPatternChars = src.localPatternChars;
dst.tinyMonths = src.tinyMonths;
dst.tinyWeekdays = src.tinyWeekdays;
dst.standAloneMonths = src.standAloneMonths;
dst.shortStandAloneMonths = src.shortStandAloneMonths;
dst.tinyStandAloneMonths = src.tinyStandAloneMonths;
dst.standAloneWeekdays = src.standAloneWeekdays;
dst.shortStandAloneWeekdays = src.shortStandAloneWeekdays;
dst.tinyStandAloneWeekdays = src.tinyStandAloneWeekdays;
}
|
[
"private",
"final",
"void",
"copyMembers",
"(",
"DateFormatSymbols",
"src",
",",
"DateFormatSymbols",
"dst",
")",
"{",
"dst",
".",
"eras",
"=",
"Arrays",
".",
"copyOf",
"(",
"src",
".",
"eras",
",",
"src",
".",
"eras",
".",
"length",
")",
";",
"dst",
".",
"months",
"=",
"Arrays",
".",
"copyOf",
"(",
"src",
".",
"months",
",",
"src",
".",
"months",
".",
"length",
")",
";",
"dst",
".",
"shortMonths",
"=",
"Arrays",
".",
"copyOf",
"(",
"src",
".",
"shortMonths",
",",
"src",
".",
"shortMonths",
".",
"length",
")",
";",
"dst",
".",
"weekdays",
"=",
"Arrays",
".",
"copyOf",
"(",
"src",
".",
"weekdays",
",",
"src",
".",
"weekdays",
".",
"length",
")",
";",
"dst",
".",
"shortWeekdays",
"=",
"Arrays",
".",
"copyOf",
"(",
"src",
".",
"shortWeekdays",
",",
"src",
".",
"shortWeekdays",
".",
"length",
")",
";",
"dst",
".",
"ampms",
"=",
"Arrays",
".",
"copyOf",
"(",
"src",
".",
"ampms",
",",
"src",
".",
"ampms",
".",
"length",
")",
";",
"if",
"(",
"src",
".",
"zoneStrings",
"!=",
"null",
")",
"{",
"dst",
".",
"zoneStrings",
"=",
"src",
".",
"getZoneStringsImpl",
"(",
"true",
")",
";",
"}",
"else",
"{",
"dst",
".",
"zoneStrings",
"=",
"null",
";",
"}",
"dst",
".",
"localPatternChars",
"=",
"src",
".",
"localPatternChars",
";",
"dst",
".",
"tinyMonths",
"=",
"src",
".",
"tinyMonths",
";",
"dst",
".",
"tinyWeekdays",
"=",
"src",
".",
"tinyWeekdays",
";",
"dst",
".",
"standAloneMonths",
"=",
"src",
".",
"standAloneMonths",
";",
"dst",
".",
"shortStandAloneMonths",
"=",
"src",
".",
"shortStandAloneMonths",
";",
"dst",
".",
"tinyStandAloneMonths",
"=",
"src",
".",
"tinyStandAloneMonths",
";",
"dst",
".",
"standAloneWeekdays",
"=",
"src",
".",
"standAloneWeekdays",
";",
"dst",
".",
"shortStandAloneWeekdays",
"=",
"src",
".",
"shortStandAloneWeekdays",
";",
"dst",
".",
"tinyStandAloneWeekdays",
"=",
"src",
".",
"tinyStandAloneWeekdays",
";",
"}"
] |
Clones all the data members from the source DateFormatSymbols to
the target DateFormatSymbols. This is only for subclasses.
@param src the source DateFormatSymbols.
@param dst the target DateFormatSymbols.
|
[
"Clones",
"all",
"the",
"data",
"members",
"from",
"the",
"source",
"DateFormatSymbols",
"to",
"the",
"target",
"DateFormatSymbols",
".",
"This",
"is",
"only",
"for",
"subclasses",
"."
] |
train
|
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/DateFormatSymbols.java#L926-L951
|
UrielCh/ovh-java-sdk
|
ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java
|
ApiOvhCloud.project_serviceName_instance_instanceId_vnc_POST
|
public OvhInstanceVnc project_serviceName_instance_instanceId_vnc_POST(String serviceName, String instanceId) throws IOException {
"""
Get VNC access to your instance
REST: POST /cloud/project/{serviceName}/instance/{instanceId}/vnc
@param instanceId [required] Instance id
@param serviceName [required] Project id
"""
String qPath = "/cloud/project/{serviceName}/instance/{instanceId}/vnc";
StringBuilder sb = path(qPath, serviceName, instanceId);
String resp = exec(qPath, "POST", sb.toString(), null);
return convertTo(resp, OvhInstanceVnc.class);
}
|
java
|
public OvhInstanceVnc project_serviceName_instance_instanceId_vnc_POST(String serviceName, String instanceId) throws IOException {
String qPath = "/cloud/project/{serviceName}/instance/{instanceId}/vnc";
StringBuilder sb = path(qPath, serviceName, instanceId);
String resp = exec(qPath, "POST", sb.toString(), null);
return convertTo(resp, OvhInstanceVnc.class);
}
|
[
"public",
"OvhInstanceVnc",
"project_serviceName_instance_instanceId_vnc_POST",
"(",
"String",
"serviceName",
",",
"String",
"instanceId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/cloud/project/{serviceName}/instance/{instanceId}/vnc\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"serviceName",
",",
"instanceId",
")",
";",
"String",
"resp",
"=",
"exec",
"(",
"qPath",
",",
"\"POST\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"null",
")",
";",
"return",
"convertTo",
"(",
"resp",
",",
"OvhInstanceVnc",
".",
"class",
")",
";",
"}"
] |
Get VNC access to your instance
REST: POST /cloud/project/{serviceName}/instance/{instanceId}/vnc
@param instanceId [required] Instance id
@param serviceName [required] Project id
|
[
"Get",
"VNC",
"access",
"to",
"your",
"instance"
] |
train
|
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java#L1987-L1992
|
biojava/biojava
|
biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/aligpanel/MultipleAlignmentCoordManager.java
|
MultipleAlignmentCoordManager.getSeqPos
|
public int getSeqPos(int aligSeq, Point p) {
"""
Convert from an X position in the JPanel to the position
in the sequence alignment.
@param aligSeq sequence number
@param p point on panel
@return the sequence position for a point on the Panel
"""
int x = p.x - DEFAULT_X_SPACE - DEFAULT_LEGEND_SIZE;
int y = p.y - DEFAULT_Y_SPACE ;
y -= (DEFAULT_LINE_SEPARATION * aligSeq) - DEFAULT_CHAR_SIZE;
int lineNr = y / DEFAULT_Y_STEP;
int linePos = x / DEFAULT_CHAR_SIZE;
return lineNr * DEFAULT_LINE_LENGTH + linePos ;
}
|
java
|
public int getSeqPos(int aligSeq, Point p) {
int x = p.x - DEFAULT_X_SPACE - DEFAULT_LEGEND_SIZE;
int y = p.y - DEFAULT_Y_SPACE ;
y -= (DEFAULT_LINE_SEPARATION * aligSeq) - DEFAULT_CHAR_SIZE;
int lineNr = y / DEFAULT_Y_STEP;
int linePos = x / DEFAULT_CHAR_SIZE;
return lineNr * DEFAULT_LINE_LENGTH + linePos ;
}
|
[
"public",
"int",
"getSeqPos",
"(",
"int",
"aligSeq",
",",
"Point",
"p",
")",
"{",
"int",
"x",
"=",
"p",
".",
"x",
"-",
"DEFAULT_X_SPACE",
"-",
"DEFAULT_LEGEND_SIZE",
";",
"int",
"y",
"=",
"p",
".",
"y",
"-",
"DEFAULT_Y_SPACE",
";",
"y",
"-=",
"(",
"DEFAULT_LINE_SEPARATION",
"*",
"aligSeq",
")",
"-",
"DEFAULT_CHAR_SIZE",
";",
"int",
"lineNr",
"=",
"y",
"/",
"DEFAULT_Y_STEP",
";",
"int",
"linePos",
"=",
"x",
"/",
"DEFAULT_CHAR_SIZE",
";",
"return",
"lineNr",
"*",
"DEFAULT_LINE_LENGTH",
"+",
"linePos",
";",
"}"
] |
Convert from an X position in the JPanel to the position
in the sequence alignment.
@param aligSeq sequence number
@param p point on panel
@return the sequence position for a point on the Panel
|
[
"Convert",
"from",
"an",
"X",
"position",
"in",
"the",
"JPanel",
"to",
"the",
"position",
"in",
"the",
"sequence",
"alignment",
"."
] |
train
|
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/aligpanel/MultipleAlignmentCoordManager.java#L125-L136
|
looly/hutool
|
hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java
|
ArrayUtil.indexOf
|
public static <T> int indexOf(T[] array, Object value) {
"""
返回数组中指定元素所在位置,未找到返回{@link #INDEX_NOT_FOUND}
@param <T> 数组类型
@param array 数组
@param value 被检查的元素
@return 数组中指定元素所在位置,未找到返回{@link #INDEX_NOT_FOUND}
@since 3.0.7
"""
if (null != array) {
for (int i = 0; i < array.length; i++) {
if (ObjectUtil.equal(value, array[i])) {
return i;
}
}
}
return INDEX_NOT_FOUND;
}
|
java
|
public static <T> int indexOf(T[] array, Object value) {
if (null != array) {
for (int i = 0; i < array.length; i++) {
if (ObjectUtil.equal(value, array[i])) {
return i;
}
}
}
return INDEX_NOT_FOUND;
}
|
[
"public",
"static",
"<",
"T",
">",
"int",
"indexOf",
"(",
"T",
"[",
"]",
"array",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"null",
"!=",
"array",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"array",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"ObjectUtil",
".",
"equal",
"(",
"value",
",",
"array",
"[",
"i",
"]",
")",
")",
"{",
"return",
"i",
";",
"}",
"}",
"}",
"return",
"INDEX_NOT_FOUND",
";",
"}"
] |
返回数组中指定元素所在位置,未找到返回{@link #INDEX_NOT_FOUND}
@param <T> 数组类型
@param array 数组
@param value 被检查的元素
@return 数组中指定元素所在位置,未找到返回{@link #INDEX_NOT_FOUND}
@since 3.0.7
|
[
"返回数组中指定元素所在位置,未找到返回",
"{",
"@link",
"#INDEX_NOT_FOUND",
"}"
] |
train
|
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java#L897-L906
|
TheHortonMachine/hortonmachine
|
gears/src/main/java/org/hortonmachine/gears/libs/modules/JGTProcessingRegion.java
|
JGTProcessingRegion.snapToNextHigherInRegionResolution
|
public static Coordinate snapToNextHigherInRegionResolution( double x, double y, JGTProcessingRegion region ) {
"""
Snaps a geographic point to be on the region grid.
<p>
Moves the point given by X and Y to be on the grid of the supplied
region.
</p>
@param x
the easting of the arbitrary point.
@param y
the northing of the arbitrary point.
@param region
the active window from which to take the grid.
@return the snapped coordinate.
"""
double minx = region.getRectangle().getBounds2D().getMinX();
double ewres = region.getWEResolution();
double xsnap = minx + (Math.ceil((x - minx) / ewres) * ewres);
double miny = region.getRectangle().getBounds2D().getMinY();
double nsres = region.getNSResolution();
double ysnap = miny + (Math.ceil((y - miny) / nsres) * nsres);
return new Coordinate(xsnap, ysnap);
}
|
java
|
public static Coordinate snapToNextHigherInRegionResolution( double x, double y, JGTProcessingRegion region ) {
double minx = region.getRectangle().getBounds2D().getMinX();
double ewres = region.getWEResolution();
double xsnap = minx + (Math.ceil((x - minx) / ewres) * ewres);
double miny = region.getRectangle().getBounds2D().getMinY();
double nsres = region.getNSResolution();
double ysnap = miny + (Math.ceil((y - miny) / nsres) * nsres);
return new Coordinate(xsnap, ysnap);
}
|
[
"public",
"static",
"Coordinate",
"snapToNextHigherInRegionResolution",
"(",
"double",
"x",
",",
"double",
"y",
",",
"JGTProcessingRegion",
"region",
")",
"{",
"double",
"minx",
"=",
"region",
".",
"getRectangle",
"(",
")",
".",
"getBounds2D",
"(",
")",
".",
"getMinX",
"(",
")",
";",
"double",
"ewres",
"=",
"region",
".",
"getWEResolution",
"(",
")",
";",
"double",
"xsnap",
"=",
"minx",
"+",
"(",
"Math",
".",
"ceil",
"(",
"(",
"x",
"-",
"minx",
")",
"/",
"ewres",
")",
"*",
"ewres",
")",
";",
"double",
"miny",
"=",
"region",
".",
"getRectangle",
"(",
")",
".",
"getBounds2D",
"(",
")",
".",
"getMinY",
"(",
")",
";",
"double",
"nsres",
"=",
"region",
".",
"getNSResolution",
"(",
")",
";",
"double",
"ysnap",
"=",
"miny",
"+",
"(",
"Math",
".",
"ceil",
"(",
"(",
"y",
"-",
"miny",
")",
"/",
"nsres",
")",
"*",
"nsres",
")",
";",
"return",
"new",
"Coordinate",
"(",
"xsnap",
",",
"ysnap",
")",
";",
"}"
] |
Snaps a geographic point to be on the region grid.
<p>
Moves the point given by X and Y to be on the grid of the supplied
region.
</p>
@param x
the easting of the arbitrary point.
@param y
the northing of the arbitrary point.
@param region
the active window from which to take the grid.
@return the snapped coordinate.
|
[
"Snaps",
"a",
"geographic",
"point",
"to",
"be",
"on",
"the",
"region",
"grid",
"."
] |
train
|
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/libs/modules/JGTProcessingRegion.java#L386-L398
|
Impetus/Kundera
|
src/jpa-engine/core/src/main/java/com/impetus/kundera/metadata/model/MetamodelImpl.java
|
MetamodelImpl.assignEmbeddables
|
public void assignEmbeddables(Map<Class<?>, ManagedType<?>> embeddables) {
"""
Assign embeddables to embeddables collection.
@param embeddables
the embeddables to set
"""
if (this.embeddables == null)
{
this.embeddables = embeddables;
}
else
{
this.embeddables.putAll(embeddables);
}
}
|
java
|
public void assignEmbeddables(Map<Class<?>, ManagedType<?>> embeddables)
{
if (this.embeddables == null)
{
this.embeddables = embeddables;
}
else
{
this.embeddables.putAll(embeddables);
}
}
|
[
"public",
"void",
"assignEmbeddables",
"(",
"Map",
"<",
"Class",
"<",
"?",
">",
",",
"ManagedType",
"<",
"?",
">",
">",
"embeddables",
")",
"{",
"if",
"(",
"this",
".",
"embeddables",
"==",
"null",
")",
"{",
"this",
".",
"embeddables",
"=",
"embeddables",
";",
"}",
"else",
"{",
"this",
".",
"embeddables",
".",
"putAll",
"(",
"embeddables",
")",
";",
"}",
"}"
] |
Assign embeddables to embeddables collection.
@param embeddables
the embeddables to set
|
[
"Assign",
"embeddables",
"to",
"embeddables",
"collection",
"."
] |
train
|
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/metadata/model/MetamodelImpl.java#L315-L325
|
irmen/Pyrolite
|
java/src/main/java/net/razorvine/pickle/Pickler.java
|
Pickler.writeMemo
|
protected void writeMemo( Object obj ) throws IOException {
"""
Write the object to the memo table and output a memo write opcode
Only works for hashable objects
"""
if(!this.useMemo)
return;
int hash = valueCompare ? obj.hashCode() : System.identityHashCode(obj);
if(!memo.containsKey(hash))
{
int memo_index = memo.size();
memo.put(hash, new Memo(obj, memo_index));
if(memo_index<=0xFF)
{
out.write(Opcodes.BINPUT);
out.write((byte)memo_index);
}
else
{
out.write(Opcodes.LONG_BINPUT);
byte[] index_bytes = PickleUtils.integer_to_bytes(memo_index);
out.write(index_bytes, 0, 4);
}
}
}
|
java
|
protected void writeMemo( Object obj ) throws IOException
{
if(!this.useMemo)
return;
int hash = valueCompare ? obj.hashCode() : System.identityHashCode(obj);
if(!memo.containsKey(hash))
{
int memo_index = memo.size();
memo.put(hash, new Memo(obj, memo_index));
if(memo_index<=0xFF)
{
out.write(Opcodes.BINPUT);
out.write((byte)memo_index);
}
else
{
out.write(Opcodes.LONG_BINPUT);
byte[] index_bytes = PickleUtils.integer_to_bytes(memo_index);
out.write(index_bytes, 0, 4);
}
}
}
|
[
"protected",
"void",
"writeMemo",
"(",
"Object",
"obj",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"this",
".",
"useMemo",
")",
"return",
";",
"int",
"hash",
"=",
"valueCompare",
"?",
"obj",
".",
"hashCode",
"(",
")",
":",
"System",
".",
"identityHashCode",
"(",
"obj",
")",
";",
"if",
"(",
"!",
"memo",
".",
"containsKey",
"(",
"hash",
")",
")",
"{",
"int",
"memo_index",
"=",
"memo",
".",
"size",
"(",
")",
";",
"memo",
".",
"put",
"(",
"hash",
",",
"new",
"Memo",
"(",
"obj",
",",
"memo_index",
")",
")",
";",
"if",
"(",
"memo_index",
"<=",
"0xFF",
")",
"{",
"out",
".",
"write",
"(",
"Opcodes",
".",
"BINPUT",
")",
";",
"out",
".",
"write",
"(",
"(",
"byte",
")",
"memo_index",
")",
";",
"}",
"else",
"{",
"out",
".",
"write",
"(",
"Opcodes",
".",
"LONG_BINPUT",
")",
";",
"byte",
"[",
"]",
"index_bytes",
"=",
"PickleUtils",
".",
"integer_to_bytes",
"(",
"memo_index",
")",
";",
"out",
".",
"write",
"(",
"index_bytes",
",",
"0",
",",
"4",
")",
";",
"}",
"}",
"}"
] |
Write the object to the memo table and output a memo write opcode
Only works for hashable objects
|
[
"Write",
"the",
"object",
"to",
"the",
"memo",
"table",
"and",
"output",
"a",
"memo",
"write",
"opcode",
"Only",
"works",
"for",
"hashable",
"objects"
] |
train
|
https://github.com/irmen/Pyrolite/blob/060bc3c9069cd31560b6da4f67280736fb2cdf63/java/src/main/java/net/razorvine/pickle/Pickler.java#L205-L226
|
JodaOrg/joda-time
|
src/main/java/org/joda/time/MutablePeriod.java
|
MutablePeriod.setPeriod
|
public void setPeriod(long startInstant, long endInstant, Chronology chrono) {
"""
Sets all the fields in one go from a millisecond interval.
@param startInstant interval start, in milliseconds
@param endInstant interval end, in milliseconds
@param chrono the chronology to use, null means ISO chronology
@throws ArithmeticException if the set exceeds the capacity of the period
"""
chrono = DateTimeUtils.getChronology(chrono);
setValues(chrono.get(this, startInstant, endInstant));
}
|
java
|
public void setPeriod(long startInstant, long endInstant, Chronology chrono) {
chrono = DateTimeUtils.getChronology(chrono);
setValues(chrono.get(this, startInstant, endInstant));
}
|
[
"public",
"void",
"setPeriod",
"(",
"long",
"startInstant",
",",
"long",
"endInstant",
",",
"Chronology",
"chrono",
")",
"{",
"chrono",
"=",
"DateTimeUtils",
".",
"getChronology",
"(",
"chrono",
")",
";",
"setValues",
"(",
"chrono",
".",
"get",
"(",
"this",
",",
"startInstant",
",",
"endInstant",
")",
")",
";",
"}"
] |
Sets all the fields in one go from a millisecond interval.
@param startInstant interval start, in milliseconds
@param endInstant interval end, in milliseconds
@param chrono the chronology to use, null means ISO chronology
@throws ArithmeticException if the set exceeds the capacity of the period
|
[
"Sets",
"all",
"the",
"fields",
"in",
"one",
"go",
"from",
"a",
"millisecond",
"interval",
"."
] |
train
|
https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/MutablePeriod.java#L546-L549
|
liferay/com-liferay-commerce
|
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionOptionValueRelPersistenceImpl.java
|
CPDefinitionOptionValueRelPersistenceImpl.fetchByUUID_G
|
@Override
public CPDefinitionOptionValueRel fetchByUUID_G(String uuid, long groupId) {
"""
Returns the cp definition option value rel where uuid = ? and groupId = ? or returns <code>null</code> if it could not be found. Uses the finder cache.
@param uuid the uuid
@param groupId the group ID
@return the matching cp definition option value rel, or <code>null</code> if a matching cp definition option value rel could not be found
"""
return fetchByUUID_G(uuid, groupId, true);
}
|
java
|
@Override
public CPDefinitionOptionValueRel fetchByUUID_G(String uuid, long groupId) {
return fetchByUUID_G(uuid, groupId, true);
}
|
[
"@",
"Override",
"public",
"CPDefinitionOptionValueRel",
"fetchByUUID_G",
"(",
"String",
"uuid",
",",
"long",
"groupId",
")",
"{",
"return",
"fetchByUUID_G",
"(",
"uuid",
",",
"groupId",
",",
"true",
")",
";",
"}"
] |
Returns the cp definition option value rel where uuid = ? and groupId = ? or returns <code>null</code> if it could not be found. Uses the finder cache.
@param uuid the uuid
@param groupId the group ID
@return the matching cp definition option value rel, or <code>null</code> if a matching cp definition option value rel could not be found
|
[
"Returns",
"the",
"cp",
"definition",
"option",
"value",
"rel",
"where",
"uuid",
"=",
"?",
";",
"and",
"groupId",
"=",
"?",
";",
"or",
"returns",
"<code",
">",
"null<",
"/",
"code",
">",
"if",
"it",
"could",
"not",
"be",
"found",
".",
"Uses",
"the",
"finder",
"cache",
"."
] |
train
|
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionOptionValueRelPersistenceImpl.java#L712-L715
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.