repository_name
stringlengths 7
58
| func_path_in_repository
stringlengths 11
218
| func_name
stringlengths 4
140
| whole_func_string
stringlengths 153
5.32k
| language
stringclasses 1
value | func_code_string
stringlengths 72
4k
| func_code_tokens
sequencelengths 20
832
| func_documentation_string
stringlengths 61
2k
| func_documentation_tokens
sequencelengths 1
647
| split_name
stringclasses 1
value | func_code_url
stringlengths 102
339
|
---|---|---|---|---|---|---|---|---|---|---|
Axway/Grapes | server/src/main/java/org/axway/grapes/server/webapp/resources/OrganizationResource.java | OrganizationResource.postOrganization | @POST
public Response postOrganization(@Auth final DbCredential credential, final Organization organization) {
"""
Handle organization posts when the server got a request POST <dm_url>/organization & MIME that contains an organization.
@param organization The organization to add to Grapes database
@return Response An acknowledgment:<br/>- 400 if the artifact is MIME is malformed<br/>- 500 if internal error<br/>- 201 if ok
"""
if(!credential.getRoles().contains(DbCredential.AvailableRoles.DATA_UPDATER)){
throw new WebApplicationException(Response.status(Response.Status.UNAUTHORIZED).build());
}
LOG.info("Got a post organization request.");
// Checks if the data is corrupted
DataValidator.validate(organization);
final DbOrganization dbOrganization = getModelMapper().getDbOrganization(organization);
getOrganizationHandler().store(dbOrganization);
return Response.ok().status(HttpStatus.CREATED_201).build();
} | java | @POST
public Response postOrganization(@Auth final DbCredential credential, final Organization organization){
if(!credential.getRoles().contains(DbCredential.AvailableRoles.DATA_UPDATER)){
throw new WebApplicationException(Response.status(Response.Status.UNAUTHORIZED).build());
}
LOG.info("Got a post organization request.");
// Checks if the data is corrupted
DataValidator.validate(organization);
final DbOrganization dbOrganization = getModelMapper().getDbOrganization(organization);
getOrganizationHandler().store(dbOrganization);
return Response.ok().status(HttpStatus.CREATED_201).build();
} | [
"@",
"POST",
"public",
"Response",
"postOrganization",
"(",
"@",
"Auth",
"final",
"DbCredential",
"credential",
",",
"final",
"Organization",
"organization",
")",
"{",
"if",
"(",
"!",
"credential",
".",
"getRoles",
"(",
")",
".",
"contains",
"(",
"DbCredential",
".",
"AvailableRoles",
".",
"DATA_UPDATER",
")",
")",
"{",
"throw",
"new",
"WebApplicationException",
"(",
"Response",
".",
"status",
"(",
"Response",
".",
"Status",
".",
"UNAUTHORIZED",
")",
".",
"build",
"(",
")",
")",
";",
"}",
"LOG",
".",
"info",
"(",
"\"Got a post organization request.\"",
")",
";",
"// Checks if the data is corrupted",
"DataValidator",
".",
"validate",
"(",
"organization",
")",
";",
"final",
"DbOrganization",
"dbOrganization",
"=",
"getModelMapper",
"(",
")",
".",
"getDbOrganization",
"(",
"organization",
")",
";",
"getOrganizationHandler",
"(",
")",
".",
"store",
"(",
"dbOrganization",
")",
";",
"return",
"Response",
".",
"ok",
"(",
")",
".",
"status",
"(",
"HttpStatus",
".",
"CREATED_201",
")",
".",
"build",
"(",
")",
";",
"}"
] | Handle organization posts when the server got a request POST <dm_url>/organization & MIME that contains an organization.
@param organization The organization to add to Grapes database
@return Response An acknowledgment:<br/>- 400 if the artifact is MIME is malformed<br/>- 500 if internal error<br/>- 201 if ok | [
"Handle",
"organization",
"posts",
"when",
"the",
"server",
"got",
"a",
"request",
"POST",
"<dm_url",
">",
"/",
"organization",
"&",
"MIME",
"that",
"contains",
"an",
"organization",
"."
] | train | https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/server/src/main/java/org/axway/grapes/server/webapp/resources/OrganizationResource.java#L46-L61 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java | TypeUtils.determineTypeArguments | public static Map<TypeVariable<?>, Type> determineTypeArguments(final Class<?> cls,
final ParameterizedType superType) {
"""
<p>Tries to determine the type arguments of a class/interface based on a
super parameterized type's type arguments. This method is the inverse of
{@link #getTypeArguments(Type, Class)} which gets a class/interface's
type arguments based on a subtype. It is far more limited in determining
the type arguments for the subject class's type variables in that it can
only determine those parameters that map from the subject {@link Class}
object to the supertype.</p> <p>Example: {@link java.util.TreeSet
TreeSet} sets its parameter as the parameter for
{@link java.util.NavigableSet NavigableSet}, which in turn sets the
parameter of {@link java.util.SortedSet}, which in turn sets the
parameter of {@link Set}, which in turn sets the parameter of
{@link java.util.Collection}, which in turn sets the parameter of
{@link java.lang.Iterable}. Since {@code TreeSet}'s parameter maps
(indirectly) to {@code Iterable}'s parameter, it will be able to
determine that based on the super type {@code Iterable<? extends
Map<Integer, ? extends Collection<?>>>}, the parameter of
{@code TreeSet} is {@code ? extends Map<Integer, ? extends
Collection<?>>}.</p>
@param cls the class whose type parameters are to be determined, not {@code null}
@param superType the super type from which {@code cls}'s type
arguments are to be determined, not {@code null}
@return a {@code Map} of the type assignments that could be determined
for the type variables in each type in the inheritance hierarchy from
{@code type} to {@code toClass} inclusive.
"""
Validate.notNull(cls, "cls is null");
Validate.notNull(superType, "superType is null");
final Class<?> superClass = getRawType(superType);
// compatibility check
if (!isAssignable(cls, superClass)) {
return null;
}
if (cls.equals(superClass)) {
return getTypeArguments(superType, superClass, null);
}
// get the next class in the inheritance hierarchy
final Type midType = getClosestParentType(cls, superClass);
// can only be a class or a parameterized type
if (midType instanceof Class<?>) {
return determineTypeArguments((Class<?>) midType, superType);
}
final ParameterizedType midParameterizedType = (ParameterizedType) midType;
final Class<?> midClass = getRawType(midParameterizedType);
// get the type variables of the mid class that map to the type
// arguments of the super class
final Map<TypeVariable<?>, Type> typeVarAssigns = determineTypeArguments(midClass, superType);
// map the arguments of the mid type to the class type variables
mapTypeVariablesToArguments(cls, midParameterizedType, typeVarAssigns);
return typeVarAssigns;
} | java | public static Map<TypeVariable<?>, Type> determineTypeArguments(final Class<?> cls,
final ParameterizedType superType) {
Validate.notNull(cls, "cls is null");
Validate.notNull(superType, "superType is null");
final Class<?> superClass = getRawType(superType);
// compatibility check
if (!isAssignable(cls, superClass)) {
return null;
}
if (cls.equals(superClass)) {
return getTypeArguments(superType, superClass, null);
}
// get the next class in the inheritance hierarchy
final Type midType = getClosestParentType(cls, superClass);
// can only be a class or a parameterized type
if (midType instanceof Class<?>) {
return determineTypeArguments((Class<?>) midType, superType);
}
final ParameterizedType midParameterizedType = (ParameterizedType) midType;
final Class<?> midClass = getRawType(midParameterizedType);
// get the type variables of the mid class that map to the type
// arguments of the super class
final Map<TypeVariable<?>, Type> typeVarAssigns = determineTypeArguments(midClass, superType);
// map the arguments of the mid type to the class type variables
mapTypeVariablesToArguments(cls, midParameterizedType, typeVarAssigns);
return typeVarAssigns;
} | [
"public",
"static",
"Map",
"<",
"TypeVariable",
"<",
"?",
">",
",",
"Type",
">",
"determineTypeArguments",
"(",
"final",
"Class",
"<",
"?",
">",
"cls",
",",
"final",
"ParameterizedType",
"superType",
")",
"{",
"Validate",
".",
"notNull",
"(",
"cls",
",",
"\"cls is null\"",
")",
";",
"Validate",
".",
"notNull",
"(",
"superType",
",",
"\"superType is null\"",
")",
";",
"final",
"Class",
"<",
"?",
">",
"superClass",
"=",
"getRawType",
"(",
"superType",
")",
";",
"// compatibility check",
"if",
"(",
"!",
"isAssignable",
"(",
"cls",
",",
"superClass",
")",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"cls",
".",
"equals",
"(",
"superClass",
")",
")",
"{",
"return",
"getTypeArguments",
"(",
"superType",
",",
"superClass",
",",
"null",
")",
";",
"}",
"// get the next class in the inheritance hierarchy",
"final",
"Type",
"midType",
"=",
"getClosestParentType",
"(",
"cls",
",",
"superClass",
")",
";",
"// can only be a class or a parameterized type",
"if",
"(",
"midType",
"instanceof",
"Class",
"<",
"?",
">",
")",
"{",
"return",
"determineTypeArguments",
"(",
"(",
"Class",
"<",
"?",
">",
")",
"midType",
",",
"superType",
")",
";",
"}",
"final",
"ParameterizedType",
"midParameterizedType",
"=",
"(",
"ParameterizedType",
")",
"midType",
";",
"final",
"Class",
"<",
"?",
">",
"midClass",
"=",
"getRawType",
"(",
"midParameterizedType",
")",
";",
"// get the type variables of the mid class that map to the type",
"// arguments of the super class",
"final",
"Map",
"<",
"TypeVariable",
"<",
"?",
">",
",",
"Type",
">",
"typeVarAssigns",
"=",
"determineTypeArguments",
"(",
"midClass",
",",
"superType",
")",
";",
"// map the arguments of the mid type to the class type variables",
"mapTypeVariablesToArguments",
"(",
"cls",
",",
"midParameterizedType",
",",
"typeVarAssigns",
")",
";",
"return",
"typeVarAssigns",
";",
"}"
] | <p>Tries to determine the type arguments of a class/interface based on a
super parameterized type's type arguments. This method is the inverse of
{@link #getTypeArguments(Type, Class)} which gets a class/interface's
type arguments based on a subtype. It is far more limited in determining
the type arguments for the subject class's type variables in that it can
only determine those parameters that map from the subject {@link Class}
object to the supertype.</p> <p>Example: {@link java.util.TreeSet
TreeSet} sets its parameter as the parameter for
{@link java.util.NavigableSet NavigableSet}, which in turn sets the
parameter of {@link java.util.SortedSet}, which in turn sets the
parameter of {@link Set}, which in turn sets the parameter of
{@link java.util.Collection}, which in turn sets the parameter of
{@link java.lang.Iterable}. Since {@code TreeSet}'s parameter maps
(indirectly) to {@code Iterable}'s parameter, it will be able to
determine that based on the super type {@code Iterable<? extends
Map<Integer, ? extends Collection<?>>>}, the parameter of
{@code TreeSet} is {@code ? extends Map<Integer, ? extends
Collection<?>>}.</p>
@param cls the class whose type parameters are to be determined, not {@code null}
@param superType the super type from which {@code cls}'s type
arguments are to be determined, not {@code null}
@return a {@code Map} of the type assignments that could be determined
for the type variables in each type in the inheritance hierarchy from
{@code type} to {@code toClass} inclusive. | [
"<p",
">",
"Tries",
"to",
"determine",
"the",
"type",
"arguments",
"of",
"a",
"class",
"/",
"interface",
"based",
"on",
"a",
"super",
"parameterized",
"type",
"s",
"type",
"arguments",
".",
"This",
"method",
"is",
"the",
"inverse",
"of",
"{",
"@link",
"#getTypeArguments",
"(",
"Type",
"Class",
")",
"}",
"which",
"gets",
"a",
"class",
"/",
"interface",
"s",
"type",
"arguments",
"based",
"on",
"a",
"subtype",
".",
"It",
"is",
"far",
"more",
"limited",
"in",
"determining",
"the",
"type",
"arguments",
"for",
"the",
"subject",
"class",
"s",
"type",
"variables",
"in",
"that",
"it",
"can",
"only",
"determine",
"those",
"parameters",
"that",
"map",
"from",
"the",
"subject",
"{",
"@link",
"Class",
"}",
"object",
"to",
"the",
"supertype",
".",
"<",
"/",
"p",
">",
"<p",
">",
"Example",
":",
"{",
"@link",
"java",
".",
"util",
".",
"TreeSet",
"TreeSet",
"}",
"sets",
"its",
"parameter",
"as",
"the",
"parameter",
"for",
"{",
"@link",
"java",
".",
"util",
".",
"NavigableSet",
"NavigableSet",
"}",
"which",
"in",
"turn",
"sets",
"the",
"parameter",
"of",
"{",
"@link",
"java",
".",
"util",
".",
"SortedSet",
"}",
"which",
"in",
"turn",
"sets",
"the",
"parameter",
"of",
"{",
"@link",
"Set",
"}",
"which",
"in",
"turn",
"sets",
"the",
"parameter",
"of",
"{",
"@link",
"java",
".",
"util",
".",
"Collection",
"}",
"which",
"in",
"turn",
"sets",
"the",
"parameter",
"of",
"{",
"@link",
"java",
".",
"lang",
".",
"Iterable",
"}",
".",
"Since",
"{",
"@code",
"TreeSet",
"}",
"s",
"parameter",
"maps",
"(",
"indirectly",
")",
"to",
"{",
"@code",
"Iterable",
"}",
"s",
"parameter",
"it",
"will",
"be",
"able",
"to",
"determine",
"that",
"based",
"on",
"the",
"super",
"type",
"{",
"@code",
"Iterable<?",
"extends",
"Map<Integer",
"?",
"extends",
"Collection<?",
">>>",
"}",
"the",
"parameter",
"of",
"{",
"@code",
"TreeSet",
"}",
"is",
"{",
"@code",
"?",
"extends",
"Map<Integer",
"?",
"extends",
"Collection<?",
">>",
"}",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java#L963-L996 |
tractionsoftware/gwt-traction | src/main/java/com/tractionsoftware/gwt/user/client/util/RgbaColor.java | RgbaColor.fromHex | public static RgbaColor fromHex(String hex) {
"""
Parses an RgbaColor from a hexadecimal value.
@return returns the parsed color
"""
if (hex.length() == 0 || hex.charAt(0) != '#') return getDefaultColor();
// #rgb
if (hex.length() == 4) {
return new RgbaColor(parseHex(hex, 1, 2),
parseHex(hex, 2, 3),
parseHex(hex, 3, 4));
}
// #rrggbb
else if (hex.length() == 7) {
return new RgbaColor(parseHex(hex, 1, 3),
parseHex(hex, 3, 5),
parseHex(hex, 5, 7));
}
else {
return getDefaultColor();
}
} | java | public static RgbaColor fromHex(String hex) {
if (hex.length() == 0 || hex.charAt(0) != '#') return getDefaultColor();
// #rgb
if (hex.length() == 4) {
return new RgbaColor(parseHex(hex, 1, 2),
parseHex(hex, 2, 3),
parseHex(hex, 3, 4));
}
// #rrggbb
else if (hex.length() == 7) {
return new RgbaColor(parseHex(hex, 1, 3),
parseHex(hex, 3, 5),
parseHex(hex, 5, 7));
}
else {
return getDefaultColor();
}
} | [
"public",
"static",
"RgbaColor",
"fromHex",
"(",
"String",
"hex",
")",
"{",
"if",
"(",
"hex",
".",
"length",
"(",
")",
"==",
"0",
"||",
"hex",
".",
"charAt",
"(",
"0",
")",
"!=",
"'",
"'",
")",
"return",
"getDefaultColor",
"(",
")",
";",
"// #rgb",
"if",
"(",
"hex",
".",
"length",
"(",
")",
"==",
"4",
")",
"{",
"return",
"new",
"RgbaColor",
"(",
"parseHex",
"(",
"hex",
",",
"1",
",",
"2",
")",
",",
"parseHex",
"(",
"hex",
",",
"2",
",",
"3",
")",
",",
"parseHex",
"(",
"hex",
",",
"3",
",",
"4",
")",
")",
";",
"}",
"// #rrggbb",
"else",
"if",
"(",
"hex",
".",
"length",
"(",
")",
"==",
"7",
")",
"{",
"return",
"new",
"RgbaColor",
"(",
"parseHex",
"(",
"hex",
",",
"1",
",",
"3",
")",
",",
"parseHex",
"(",
"hex",
",",
"3",
",",
"5",
")",
",",
"parseHex",
"(",
"hex",
",",
"5",
",",
"7",
")",
")",
";",
"}",
"else",
"{",
"return",
"getDefaultColor",
"(",
")",
";",
"}",
"}"
] | Parses an RgbaColor from a hexadecimal value.
@return returns the parsed color | [
"Parses",
"an",
"RgbaColor",
"from",
"a",
"hexadecimal",
"value",
"."
] | train | https://github.com/tractionsoftware/gwt-traction/blob/efc1423c619439763fb064b777b7235e9ce414a3/src/main/java/com/tractionsoftware/gwt/user/client/util/RgbaColor.java#L107-L129 |
goldmansachs/gs-collections | collections/src/main/java/com/gs/collections/impl/utility/StringIterate.java | StringIterate.occurrencesOf | public static int occurrencesOf(String string, String singleCharacter) {
"""
Count the number of occurrences of the specified {@code string}.
"""
if (singleCharacter.length() != 1)
{
throw new IllegalArgumentException("Argument should be a single character: " + singleCharacter);
}
return StringIterate.occurrencesOfChar(string, singleCharacter.charAt(0));
} | java | public static int occurrencesOf(String string, String singleCharacter)
{
if (singleCharacter.length() != 1)
{
throw new IllegalArgumentException("Argument should be a single character: " + singleCharacter);
}
return StringIterate.occurrencesOfChar(string, singleCharacter.charAt(0));
} | [
"public",
"static",
"int",
"occurrencesOf",
"(",
"String",
"string",
",",
"String",
"singleCharacter",
")",
"{",
"if",
"(",
"singleCharacter",
".",
"length",
"(",
")",
"!=",
"1",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Argument should be a single character: \"",
"+",
"singleCharacter",
")",
";",
"}",
"return",
"StringIterate",
".",
"occurrencesOfChar",
"(",
"string",
",",
"singleCharacter",
".",
"charAt",
"(",
"0",
")",
")",
";",
"}"
] | Count the number of occurrences of the specified {@code string}. | [
"Count",
"the",
"number",
"of",
"occurrences",
"of",
"the",
"specified",
"{"
] | train | https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/StringIterate.java#L777-L784 |
antopen/alipay-sdk-java | src/main/java/com/alipay/api/internal/util/AlipaySignature.java | AlipaySignature.checkSignAndDecrypt | public static String checkSignAndDecrypt(Map<String, String> params, String alipayPublicKey,
String cusPrivateKey, boolean isCheckSign,
boolean isDecrypt) throws AlipayApiException {
"""
验签并解密
<p>
<b>目前适用于公众号</b><br>
params参数示例:
<br>{
<br>biz_content=M0qGiGz+8kIpxe8aF4geWJdBn0aBTuJRQItLHo9R7o5JGhpic/MIUjvXo2BLB++BbkSq2OsJCEQFDZ0zK5AJYwvBgeRX30gvEj6eXqXRt16/IkB9HzAccEqKmRHrZJ7PjQWE0KfvDAHsJqFIeMvEYk1Zei2QkwSQPlso7K0oheo/iT+HYE8aTATnkqD/ByD9iNDtGg38pCa2xnnns63abKsKoV8h0DfHWgPH62urGY7Pye3r9FCOXA2Ykm8X4/Bl1bWFN/PFCEJHWe/HXj8KJKjWMO6ttsoV0xRGfeyUO8agu6t587Dl5ux5zD/s8Lbg5QXygaOwo3Fz1G8EqmGhi4+soEIQb8DBYanQOS3X+m46tVqBGMw8Oe+hsyIMpsjwF4HaPKMr37zpW3fe7xOMuimbZ0wq53YP/jhQv6XWodjT3mL0H5ACqcsSn727B5ztquzCPiwrqyjUHjJQQefFTzOse8snaWNQTUsQS7aLsHq0FveGpSBYORyA90qPdiTjXIkVP7mAiYiAIWW9pCEC7F3XtViKTZ8FRMM9ySicfuAlf3jtap6v2KPMtQv70X+hlmzO/IXB6W0Ep8DovkF5rB4r/BJYJLw/6AS0LZM9w5JfnAZhfGM2rKzpfNsgpOgEZS1WleG4I2hoQC0nxg9IcP0Hs+nWIPkEUcYNaiXqeBc=,
<br>sign=rlqgA8O+RzHBVYLyHmrbODVSANWPXf3pSrr82OCO/bm3upZiXSYrX5fZr6UBmG6BZRAydEyTIguEW6VRuAKjnaO/sOiR9BsSrOdXbD5Rhos/Xt7/mGUWbTOt/F+3W0/XLuDNmuYg1yIC/6hzkg44kgtdSTsQbOC9gWM7ayB4J4c=,
sign_type=RSA,
<br>charset=UTF-8
<br>}
</p>
@param params
@param alipayPublicKey 支付宝公钥
@param cusPrivateKey 商户私钥
@param isCheckSign 是否验签
@param isDecrypt 是否解密
@return 解密后明文,验签失败则异常抛出
@throws AlipayApiException
"""
String charset = params.get("charset");
String bizContent = params.get("biz_content");
if (isCheckSign) {
if (!rsaCheckV2(params, alipayPublicKey, charset)) {
throw new AlipayApiException("rsaCheck failure:rsaParams=" + params);
}
}
if (isDecrypt) {
return rsaDecrypt(bizContent, cusPrivateKey, charset);
}
return bizContent;
} | java | public static String checkSignAndDecrypt(Map<String, String> params, String alipayPublicKey,
String cusPrivateKey, boolean isCheckSign,
boolean isDecrypt) throws AlipayApiException {
String charset = params.get("charset");
String bizContent = params.get("biz_content");
if (isCheckSign) {
if (!rsaCheckV2(params, alipayPublicKey, charset)) {
throw new AlipayApiException("rsaCheck failure:rsaParams=" + params);
}
}
if (isDecrypt) {
return rsaDecrypt(bizContent, cusPrivateKey, charset);
}
return bizContent;
} | [
"public",
"static",
"String",
"checkSignAndDecrypt",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"params",
",",
"String",
"alipayPublicKey",
",",
"String",
"cusPrivateKey",
",",
"boolean",
"isCheckSign",
",",
"boolean",
"isDecrypt",
")",
"throws",
"AlipayApiException",
"{",
"String",
"charset",
"=",
"params",
".",
"get",
"(",
"\"charset\"",
")",
";",
"String",
"bizContent",
"=",
"params",
".",
"get",
"(",
"\"biz_content\"",
")",
";",
"if",
"(",
"isCheckSign",
")",
"{",
"if",
"(",
"!",
"rsaCheckV2",
"(",
"params",
",",
"alipayPublicKey",
",",
"charset",
")",
")",
"{",
"throw",
"new",
"AlipayApiException",
"(",
"\"rsaCheck failure:rsaParams=\"",
"+",
"params",
")",
";",
"}",
"}",
"if",
"(",
"isDecrypt",
")",
"{",
"return",
"rsaDecrypt",
"(",
"bizContent",
",",
"cusPrivateKey",
",",
"charset",
")",
";",
"}",
"return",
"bizContent",
";",
"}"
] | 验签并解密
<p>
<b>目前适用于公众号</b><br>
params参数示例:
<br>{
<br>biz_content=M0qGiGz+8kIpxe8aF4geWJdBn0aBTuJRQItLHo9R7o5JGhpic/MIUjvXo2BLB++BbkSq2OsJCEQFDZ0zK5AJYwvBgeRX30gvEj6eXqXRt16/IkB9HzAccEqKmRHrZJ7PjQWE0KfvDAHsJqFIeMvEYk1Zei2QkwSQPlso7K0oheo/iT+HYE8aTATnkqD/ByD9iNDtGg38pCa2xnnns63abKsKoV8h0DfHWgPH62urGY7Pye3r9FCOXA2Ykm8X4/Bl1bWFN/PFCEJHWe/HXj8KJKjWMO6ttsoV0xRGfeyUO8agu6t587Dl5ux5zD/s8Lbg5QXygaOwo3Fz1G8EqmGhi4+soEIQb8DBYanQOS3X+m46tVqBGMw8Oe+hsyIMpsjwF4HaPKMr37zpW3fe7xOMuimbZ0wq53YP/jhQv6XWodjT3mL0H5ACqcsSn727B5ztquzCPiwrqyjUHjJQQefFTzOse8snaWNQTUsQS7aLsHq0FveGpSBYORyA90qPdiTjXIkVP7mAiYiAIWW9pCEC7F3XtViKTZ8FRMM9ySicfuAlf3jtap6v2KPMtQv70X+hlmzO/IXB6W0Ep8DovkF5rB4r/BJYJLw/6AS0LZM9w5JfnAZhfGM2rKzpfNsgpOgEZS1WleG4I2hoQC0nxg9IcP0Hs+nWIPkEUcYNaiXqeBc=,
<br>sign=rlqgA8O+RzHBVYLyHmrbODVSANWPXf3pSrr82OCO/bm3upZiXSYrX5fZr6UBmG6BZRAydEyTIguEW6VRuAKjnaO/sOiR9BsSrOdXbD5Rhos/Xt7/mGUWbTOt/F+3W0/XLuDNmuYg1yIC/6hzkg44kgtdSTsQbOC9gWM7ayB4J4c=,
sign_type=RSA,
<br>charset=UTF-8
<br>}
</p>
@param params
@param alipayPublicKey 支付宝公钥
@param cusPrivateKey 商户私钥
@param isCheckSign 是否验签
@param isDecrypt 是否解密
@return 解密后明文,验签失败则异常抛出
@throws AlipayApiException | [
"验签并解密",
"<p",
">",
"<b",
">",
"目前适用于公众号<",
"/",
"b",
">",
"<br",
">",
"params参数示例:",
"<br",
">",
"{",
"<br",
">",
"biz_content",
"=",
"M0qGiGz",
"+",
"8kIpxe8aF4geWJdBn0aBTuJRQItLHo9R7o5JGhpic",
"/",
"MIUjvXo2BLB",
"++",
"BbkSq2OsJCEQFDZ0zK5AJYwvBgeRX30gvEj6eXqXRt16",
"/",
"IkB9HzAccEqKmRHrZJ7PjQWE0KfvDAHsJqFIeMvEYk1Zei2QkwSQPlso7K0oheo",
"/",
"iT",
"+",
"HYE8aTATnkqD",
"/",
"ByD9iNDtGg38pCa2xnnns63abKsKoV8h0DfHWgPH62urGY7Pye3r9FCOXA2Ykm8X4",
"/",
"Bl1bWFN",
"/",
"PFCEJHWe",
"/",
"HXj8KJKjWMO6ttsoV0xRGfeyUO8agu6t587Dl5ux5zD",
"/",
"s8Lbg5QXygaOwo3Fz1G8EqmGhi4",
"+",
"soEIQb8DBYanQOS3X",
"+",
"m46tVqBGMw8Oe",
"+",
"hsyIMpsjwF4HaPKMr37zpW3fe7xOMuimbZ0wq53YP",
"/",
"jhQv6XWodjT3mL0H5ACqcsSn727B5ztquzCPiwrqyjUHjJQQefFTzOse8snaWNQTUsQS7aLsHq0FveGpSBYORyA90qPdiTjXIkVP7mAiYiAIWW9pCEC7F3XtViKTZ8FRMM9ySicfuAlf3jtap6v2KPMtQv70X",
"+",
"hlmzO",
"/",
"IXB6W0Ep8DovkF5rB4r",
"/",
"BJYJLw",
"/",
"6AS0LZM9w5JfnAZhfGM2rKzpfNsgpOgEZS1WleG4I2hoQC0nxg9IcP0Hs",
"+",
"nWIPkEUcYNaiXqeBc",
"=",
"<br",
">",
"sign",
"=",
"rlqgA8O",
"+",
"RzHBVYLyHmrbODVSANWPXf3pSrr82OCO",
"/",
"bm3upZiXSYrX5fZr6UBmG6BZRAydEyTIguEW6VRuAKjnaO",
"/",
"sOiR9BsSrOdXbD5Rhos",
"/",
"Xt7",
"/",
"mGUWbTOt",
"/",
"F",
"+",
"3W0",
"/",
"XLuDNmuYg1yIC",
"/",
"6hzkg44kgtdSTsQbOC9gWM7ayB4J4c",
"=",
"sign_type",
"=",
"RSA",
"<br",
">",
"charset",
"=",
"UTF",
"-",
"8",
"<br",
">",
"}",
"<",
"/",
"p",
">"
] | train | https://github.com/antopen/alipay-sdk-java/blob/e82aeac7d0239330ee173c7e393596e51e41c1cd/src/main/java/com/alipay/api/internal/util/AlipaySignature.java#L378-L394 |
irmen/Pyrolite | java/src/main/java/net/razorvine/pickle/PickleUtils.java | PickleUtils.readbytes_into | public static void readbytes_into(InputStream input, byte[] buffer, int offset, int length) throws IOException {
"""
read a number of signed bytes into the specified location in an existing byte array
"""
while (length > 0) {
int read = input.read(buffer, offset, length);
if (read == -1)
throw new IOException("expected more bytes in input stream");
offset += read;
length -= read;
}
} | java | public static void readbytes_into(InputStream input, byte[] buffer, int offset, int length) throws IOException {
while (length > 0) {
int read = input.read(buffer, offset, length);
if (read == -1)
throw new IOException("expected more bytes in input stream");
offset += read;
length -= read;
}
} | [
"public",
"static",
"void",
"readbytes_into",
"(",
"InputStream",
"input",
",",
"byte",
"[",
"]",
"buffer",
",",
"int",
"offset",
",",
"int",
"length",
")",
"throws",
"IOException",
"{",
"while",
"(",
"length",
">",
"0",
")",
"{",
"int",
"read",
"=",
"input",
".",
"read",
"(",
"buffer",
",",
"offset",
",",
"length",
")",
";",
"if",
"(",
"read",
"==",
"-",
"1",
")",
"throw",
"new",
"IOException",
"(",
"\"expected more bytes in input stream\"",
")",
";",
"offset",
"+=",
"read",
";",
"length",
"-=",
"read",
";",
"}",
"}"
] | read a number of signed bytes into the specified location in an existing byte array | [
"read",
"a",
"number",
"of",
"signed",
"bytes",
"into",
"the",
"specified",
"location",
"in",
"an",
"existing",
"byte",
"array"
] | train | https://github.com/irmen/Pyrolite/blob/060bc3c9069cd31560b6da4f67280736fb2cdf63/java/src/main/java/net/razorvine/pickle/PickleUtils.java#L71-L79 |
jbundle/jbundle | thin/base/db/base/src/main/java/org/jbundle/thin/base/db/FieldInfo.java | FieldInfo.setTextByReflection | public void setTextByReflection(Object obj, String text) {
"""
Lame method, since awt, swing, and android components all have setText methods.
@param obj
@param text
"""
try {
java.lang.reflect.Method method = obj.getClass().getMethod("setText", String.class);
if (method != null)
method.invoke(obj, text);
} catch (Exception e) {
e.printStackTrace();
}
} | java | public void setTextByReflection(Object obj, String text)
{
try {
java.lang.reflect.Method method = obj.getClass().getMethod("setText", String.class);
if (method != null)
method.invoke(obj, text);
} catch (Exception e) {
e.printStackTrace();
}
} | [
"public",
"void",
"setTextByReflection",
"(",
"Object",
"obj",
",",
"String",
"text",
")",
"{",
"try",
"{",
"java",
".",
"lang",
".",
"reflect",
".",
"Method",
"method",
"=",
"obj",
".",
"getClass",
"(",
")",
".",
"getMethod",
"(",
"\"setText\"",
",",
"String",
".",
"class",
")",
";",
"if",
"(",
"method",
"!=",
"null",
")",
"method",
".",
"invoke",
"(",
"obj",
",",
"text",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"}"
] | Lame method, since awt, swing, and android components all have setText methods.
@param obj
@param text | [
"Lame",
"method",
"since",
"awt",
"swing",
"and",
"android",
"components",
"all",
"have",
"setText",
"methods",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/base/src/main/java/org/jbundle/thin/base/db/FieldInfo.java#L316-L326 |
lessthanoptimal/ddogleg | src/org/ddogleg/nn/alg/KdTreeConstructor.java | KdTreeConstructor.computeChild | protected KdTree.Node computeChild(List<P> points , GrowQueue_I32 indexes ) {
"""
Creates a child by checking to see if it is a leaf or branch.
"""
if( points.size() == 0 )
return null;
if( points.size() == 1 ) {
return createLeaf(points,indexes);
} else {
return computeBranch(points,indexes);
}
} | java | protected KdTree.Node computeChild(List<P> points , GrowQueue_I32 indexes )
{
if( points.size() == 0 )
return null;
if( points.size() == 1 ) {
return createLeaf(points,indexes);
} else {
return computeBranch(points,indexes);
}
} | [
"protected",
"KdTree",
".",
"Node",
"computeChild",
"(",
"List",
"<",
"P",
">",
"points",
",",
"GrowQueue_I32",
"indexes",
")",
"{",
"if",
"(",
"points",
".",
"size",
"(",
")",
"==",
"0",
")",
"return",
"null",
";",
"if",
"(",
"points",
".",
"size",
"(",
")",
"==",
"1",
")",
"{",
"return",
"createLeaf",
"(",
"points",
",",
"indexes",
")",
";",
"}",
"else",
"{",
"return",
"computeBranch",
"(",
"points",
",",
"indexes",
")",
";",
"}",
"}"
] | Creates a child by checking to see if it is a leaf or branch. | [
"Creates",
"a",
"child",
"by",
"checking",
"to",
"see",
"if",
"it",
"is",
"a",
"leaf",
"or",
"branch",
"."
] | train | https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/nn/alg/KdTreeConstructor.java#L135-L144 |
samskivert/samskivert | src/main/java/com/samskivert/util/CollectionUtil.java | CollectionUtil.minList | public static <T extends Comparable<? super T>> List<T> minList (Iterable<T> iterable) {
"""
Return a List containing all the elements of the specified Iterable that compare as being
equal to the minimum element.
@throws NoSuchElementException if the Iterable is empty.
"""
return maxList(iterable, java.util.Collections.reverseOrder());
} | java | public static <T extends Comparable<? super T>> List<T> minList (Iterable<T> iterable)
{
return maxList(iterable, java.util.Collections.reverseOrder());
} | [
"public",
"static",
"<",
"T",
"extends",
"Comparable",
"<",
"?",
"super",
"T",
">",
">",
"List",
"<",
"T",
">",
"minList",
"(",
"Iterable",
"<",
"T",
">",
"iterable",
")",
"{",
"return",
"maxList",
"(",
"iterable",
",",
"java",
".",
"util",
".",
"Collections",
".",
"reverseOrder",
"(",
")",
")",
";",
"}"
] | Return a List containing all the elements of the specified Iterable that compare as being
equal to the minimum element.
@throws NoSuchElementException if the Iterable is empty. | [
"Return",
"a",
"List",
"containing",
"all",
"the",
"elements",
"of",
"the",
"specified",
"Iterable",
"that",
"compare",
"as",
"being",
"equal",
"to",
"the",
"minimum",
"element",
"."
] | train | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/CollectionUtil.java#L174-L177 |
alkacon/opencms-core | src/org/opencms/site/xmlsitemap/CmsXmlSitemapGenerator.java | CmsXmlSitemapGenerator.addResult | protected void addResult(CmsXmlSitemapUrlBean result, int resultPriority) {
"""
Adds an URL bean to the internal map of results, but only if there is no existing entry with higher internal priority
than the priority given as an argument.<p>
@param result the result URL bean to add
@param resultPriority the internal priority to use for updating the map of results
"""
String url = CmsFileUtil.removeTrailingSeparator(result.getUrl());
boolean writeEntry = true;
if (m_resultMap.containsKey(url)) {
LOG.warn("Encountered duplicate URL with while generating sitemap: " + result.getUrl());
ResultEntry entry = m_resultMap.get(url);
writeEntry = entry.getPriority() <= resultPriority;
}
if (writeEntry) {
m_resultMap.put(url, new ResultEntry(result, resultPriority));
}
} | java | protected void addResult(CmsXmlSitemapUrlBean result, int resultPriority) {
String url = CmsFileUtil.removeTrailingSeparator(result.getUrl());
boolean writeEntry = true;
if (m_resultMap.containsKey(url)) {
LOG.warn("Encountered duplicate URL with while generating sitemap: " + result.getUrl());
ResultEntry entry = m_resultMap.get(url);
writeEntry = entry.getPriority() <= resultPriority;
}
if (writeEntry) {
m_resultMap.put(url, new ResultEntry(result, resultPriority));
}
} | [
"protected",
"void",
"addResult",
"(",
"CmsXmlSitemapUrlBean",
"result",
",",
"int",
"resultPriority",
")",
"{",
"String",
"url",
"=",
"CmsFileUtil",
".",
"removeTrailingSeparator",
"(",
"result",
".",
"getUrl",
"(",
")",
")",
";",
"boolean",
"writeEntry",
"=",
"true",
";",
"if",
"(",
"m_resultMap",
".",
"containsKey",
"(",
"url",
")",
")",
"{",
"LOG",
".",
"warn",
"(",
"\"Encountered duplicate URL with while generating sitemap: \"",
"+",
"result",
".",
"getUrl",
"(",
")",
")",
";",
"ResultEntry",
"entry",
"=",
"m_resultMap",
".",
"get",
"(",
"url",
")",
";",
"writeEntry",
"=",
"entry",
".",
"getPriority",
"(",
")",
"<=",
"resultPriority",
";",
"}",
"if",
"(",
"writeEntry",
")",
"{",
"m_resultMap",
".",
"put",
"(",
"url",
",",
"new",
"ResultEntry",
"(",
"result",
",",
"resultPriority",
")",
")",
";",
"}",
"}"
] | Adds an URL bean to the internal map of results, but only if there is no existing entry with higher internal priority
than the priority given as an argument.<p>
@param result the result URL bean to add
@param resultPriority the internal priority to use for updating the map of results | [
"Adds",
"an",
"URL",
"bean",
"to",
"the",
"internal",
"map",
"of",
"results",
"but",
"only",
"if",
"there",
"is",
"no",
"existing",
"entry",
"with",
"higher",
"internal",
"priority",
"than",
"the",
"priority",
"given",
"as",
"an",
"argument",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/site/xmlsitemap/CmsXmlSitemapGenerator.java#L434-L446 |
Jasig/uPortal | uPortal-portlets/src/main/java/org/apereo/portal/portlets/statistics/PortletExecutionStatisticsController.java | PortletExecutionStatisticsController.getColumnDescriptions | @Override
protected List<ColumnDescription> getColumnDescriptions(
PortletExecutionAggregationDiscriminator reportColumnDiscriminator,
PortletExecutionReportForm form) {
"""
Create column descriptions for the portlet report using the configured report labelling
strategy.
@param reportColumnDiscriminator
@param form The original query form
@return
"""
int groupSize = form.getGroups().size();
int portletSize = form.getPortlets().size();
int executionTypeSize = form.getExecutionTypeNames().size();
String portletName = reportColumnDiscriminator.getPortletMapping().getFname();
String groupName = reportColumnDiscriminator.getAggregatedGroup().getGroupName();
String executionTypeName = reportColumnDiscriminator.getExecutionType().getName();
TitleAndCount[] items =
new TitleAndCount[] {
new TitleAndCount(portletName, portletSize),
new TitleAndCount(executionTypeName, executionTypeSize),
new TitleAndCount(groupName, groupSize)
};
return titleAndColumnDescriptionStrategy.getColumnDescriptions(
items, showFullColumnHeaderDescriptions(form), form);
} | java | @Override
protected List<ColumnDescription> getColumnDescriptions(
PortletExecutionAggregationDiscriminator reportColumnDiscriminator,
PortletExecutionReportForm form) {
int groupSize = form.getGroups().size();
int portletSize = form.getPortlets().size();
int executionTypeSize = form.getExecutionTypeNames().size();
String portletName = reportColumnDiscriminator.getPortletMapping().getFname();
String groupName = reportColumnDiscriminator.getAggregatedGroup().getGroupName();
String executionTypeName = reportColumnDiscriminator.getExecutionType().getName();
TitleAndCount[] items =
new TitleAndCount[] {
new TitleAndCount(portletName, portletSize),
new TitleAndCount(executionTypeName, executionTypeSize),
new TitleAndCount(groupName, groupSize)
};
return titleAndColumnDescriptionStrategy.getColumnDescriptions(
items, showFullColumnHeaderDescriptions(form), form);
} | [
"@",
"Override",
"protected",
"List",
"<",
"ColumnDescription",
">",
"getColumnDescriptions",
"(",
"PortletExecutionAggregationDiscriminator",
"reportColumnDiscriminator",
",",
"PortletExecutionReportForm",
"form",
")",
"{",
"int",
"groupSize",
"=",
"form",
".",
"getGroups",
"(",
")",
".",
"size",
"(",
")",
";",
"int",
"portletSize",
"=",
"form",
".",
"getPortlets",
"(",
")",
".",
"size",
"(",
")",
";",
"int",
"executionTypeSize",
"=",
"form",
".",
"getExecutionTypeNames",
"(",
")",
".",
"size",
"(",
")",
";",
"String",
"portletName",
"=",
"reportColumnDiscriminator",
".",
"getPortletMapping",
"(",
")",
".",
"getFname",
"(",
")",
";",
"String",
"groupName",
"=",
"reportColumnDiscriminator",
".",
"getAggregatedGroup",
"(",
")",
".",
"getGroupName",
"(",
")",
";",
"String",
"executionTypeName",
"=",
"reportColumnDiscriminator",
".",
"getExecutionType",
"(",
")",
".",
"getName",
"(",
")",
";",
"TitleAndCount",
"[",
"]",
"items",
"=",
"new",
"TitleAndCount",
"[",
"]",
"{",
"new",
"TitleAndCount",
"(",
"portletName",
",",
"portletSize",
")",
",",
"new",
"TitleAndCount",
"(",
"executionTypeName",
",",
"executionTypeSize",
")",
",",
"new",
"TitleAndCount",
"(",
"groupName",
",",
"groupSize",
")",
"}",
";",
"return",
"titleAndColumnDescriptionStrategy",
".",
"getColumnDescriptions",
"(",
"items",
",",
"showFullColumnHeaderDescriptions",
"(",
"form",
")",
",",
"form",
")",
";",
"}"
] | Create column descriptions for the portlet report using the configured report labelling
strategy.
@param reportColumnDiscriminator
@param form The original query form
@return | [
"Create",
"column",
"descriptions",
"for",
"the",
"portlet",
"report",
"using",
"the",
"configured",
"report",
"labelling",
"strategy",
"."
] | train | https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-portlets/src/main/java/org/apereo/portal/portlets/statistics/PortletExecutionStatisticsController.java#L274-L295 |
JodaOrg/joda-time | src/main/java/org/joda/time/LocalDate.java | LocalDate.toDateTimeAtStartOfDay | public DateTime toDateTimeAtStartOfDay(DateTimeZone zone) {
"""
Converts this LocalDate to a full datetime at the earliest valid time
for the date using the specified time zone.
<p>
The time will normally be midnight, as that is the earliest time on
any given day. However, in some time zones when Daylight Savings Time
starts, there is no midnight because time jumps from 11:59 to 01:00.
This method handles that situation by returning 01:00 on that date.
<p>
This method uses the chronology from this instance plus the time zone
specified.
<p>
This instance is immutable and unaffected by this method call.
@param zone the zone to use, null means default zone
@return this date as a datetime at the start of the day
@since 1.5
"""
zone = DateTimeUtils.getZone(zone);
Chronology chrono = getChronology().withZone(zone);
long localMillis = getLocalMillis() + 6L * DateTimeConstants.MILLIS_PER_HOUR;
long instant = zone.convertLocalToUTC(localMillis, false);
instant = chrono.dayOfMonth().roundFloor(instant);
return new DateTime(instant, chrono).withEarlierOffsetAtOverlap();
} | java | public DateTime toDateTimeAtStartOfDay(DateTimeZone zone) {
zone = DateTimeUtils.getZone(zone);
Chronology chrono = getChronology().withZone(zone);
long localMillis = getLocalMillis() + 6L * DateTimeConstants.MILLIS_PER_HOUR;
long instant = zone.convertLocalToUTC(localMillis, false);
instant = chrono.dayOfMonth().roundFloor(instant);
return new DateTime(instant, chrono).withEarlierOffsetAtOverlap();
} | [
"public",
"DateTime",
"toDateTimeAtStartOfDay",
"(",
"DateTimeZone",
"zone",
")",
"{",
"zone",
"=",
"DateTimeUtils",
".",
"getZone",
"(",
"zone",
")",
";",
"Chronology",
"chrono",
"=",
"getChronology",
"(",
")",
".",
"withZone",
"(",
"zone",
")",
";",
"long",
"localMillis",
"=",
"getLocalMillis",
"(",
")",
"+",
"6L",
"*",
"DateTimeConstants",
".",
"MILLIS_PER_HOUR",
";",
"long",
"instant",
"=",
"zone",
".",
"convertLocalToUTC",
"(",
"localMillis",
",",
"false",
")",
";",
"instant",
"=",
"chrono",
".",
"dayOfMonth",
"(",
")",
".",
"roundFloor",
"(",
"instant",
")",
";",
"return",
"new",
"DateTime",
"(",
"instant",
",",
"chrono",
")",
".",
"withEarlierOffsetAtOverlap",
"(",
")",
";",
"}"
] | Converts this LocalDate to a full datetime at the earliest valid time
for the date using the specified time zone.
<p>
The time will normally be midnight, as that is the earliest time on
any given day. However, in some time zones when Daylight Savings Time
starts, there is no midnight because time jumps from 11:59 to 01:00.
This method handles that situation by returning 01:00 on that date.
<p>
This method uses the chronology from this instance plus the time zone
specified.
<p>
This instance is immutable and unaffected by this method call.
@param zone the zone to use, null means default zone
@return this date as a datetime at the start of the day
@since 1.5 | [
"Converts",
"this",
"LocalDate",
"to",
"a",
"full",
"datetime",
"at",
"the",
"earliest",
"valid",
"time",
"for",
"the",
"date",
"using",
"the",
"specified",
"time",
"zone",
".",
"<p",
">",
"The",
"time",
"will",
"normally",
"be",
"midnight",
"as",
"that",
"is",
"the",
"earliest",
"time",
"on",
"any",
"given",
"day",
".",
"However",
"in",
"some",
"time",
"zones",
"when",
"Daylight",
"Savings",
"Time",
"starts",
"there",
"is",
"no",
"midnight",
"because",
"time",
"jumps",
"from",
"11",
":",
"59",
"to",
"01",
":",
"00",
".",
"This",
"method",
"handles",
"that",
"situation",
"by",
"returning",
"01",
":",
"00",
"on",
"that",
"date",
".",
"<p",
">",
"This",
"method",
"uses",
"the",
"chronology",
"from",
"this",
"instance",
"plus",
"the",
"time",
"zone",
"specified",
".",
"<p",
">",
"This",
"instance",
"is",
"immutable",
"and",
"unaffected",
"by",
"this",
"method",
"call",
"."
] | train | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/LocalDate.java#L727-L734 |
oboehm/jfachwert | src/main/java/de/jfachwert/post/Adresse.java | Adresse.of | public static Adresse of(Ort ort, String strasse, String hausnummer) {
"""
Liefert eine Adresse mit den uebergebenen Parametern.
@param ort the ort
@param strasse the strasse
@param hausnummer the hausnummer
@return Adresse
"""
return new Adresse(ort, strasse, hausnummer);
} | java | public static Adresse of(Ort ort, String strasse, String hausnummer) {
return new Adresse(ort, strasse, hausnummer);
} | [
"public",
"static",
"Adresse",
"of",
"(",
"Ort",
"ort",
",",
"String",
"strasse",
",",
"String",
"hausnummer",
")",
"{",
"return",
"new",
"Adresse",
"(",
"ort",
",",
"strasse",
",",
"hausnummer",
")",
";",
"}"
] | Liefert eine Adresse mit den uebergebenen Parametern.
@param ort the ort
@param strasse the strasse
@param hausnummer the hausnummer
@return Adresse | [
"Liefert",
"eine",
"Adresse",
"mit",
"den",
"uebergebenen",
"Parametern",
"."
] | train | https://github.com/oboehm/jfachwert/blob/67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b/src/main/java/de/jfachwert/post/Adresse.java#L155-L157 |
undertow-io/undertow | core/src/main/java/io/undertow/websockets/core/WebSockets.java | WebSockets.sendPongBlocking | public static void sendPongBlocking(final PooledByteBuffer pooledData, final WebSocketChannel wsChannel) throws IOException {
"""
Sends a complete pong message using blocking IO
Automatically frees the pooled byte buffer when done.
@param pooledData The data to send, it will be freed when done
@param wsChannel The web socket channel
"""
sendBlockingInternal(pooledData, WebSocketFrameType.PONG, wsChannel);
} | java | public static void sendPongBlocking(final PooledByteBuffer pooledData, final WebSocketChannel wsChannel) throws IOException {
sendBlockingInternal(pooledData, WebSocketFrameType.PONG, wsChannel);
} | [
"public",
"static",
"void",
"sendPongBlocking",
"(",
"final",
"PooledByteBuffer",
"pooledData",
",",
"final",
"WebSocketChannel",
"wsChannel",
")",
"throws",
"IOException",
"{",
"sendBlockingInternal",
"(",
"pooledData",
",",
"WebSocketFrameType",
".",
"PONG",
",",
"wsChannel",
")",
";",
"}"
] | Sends a complete pong message using blocking IO
Automatically frees the pooled byte buffer when done.
@param pooledData The data to send, it will be freed when done
@param wsChannel The web socket channel | [
"Sends",
"a",
"complete",
"pong",
"message",
"using",
"blocking",
"IO",
"Automatically",
"frees",
"the",
"pooled",
"byte",
"buffer",
"when",
"done",
"."
] | train | https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/websockets/core/WebSockets.java#L578-L580 |
greatman/craftconomy3 | src/main/java/com/greatmancode/craftconomy3/account/AccountACL.java | AccountACL.setAcl | public void setAcl(String name, boolean acl) {
"""
Set if a player can modify the ACL list
@param name The player name
@param acl can modify the ACL or not
"""
String newName = name.toLowerCase();
if (aclList.containsKey(newName)) {
AccountACLValue value = aclList.get(newName);
set(newName, value.canDeposit(), value.canWithdraw(), acl, value.canBalance(), value.isOwner());
} else {
set(newName, false, false, acl, false, false);
}
} | java | public void setAcl(String name, boolean acl) {
String newName = name.toLowerCase();
if (aclList.containsKey(newName)) {
AccountACLValue value = aclList.get(newName);
set(newName, value.canDeposit(), value.canWithdraw(), acl, value.canBalance(), value.isOwner());
} else {
set(newName, false, false, acl, false, false);
}
} | [
"public",
"void",
"setAcl",
"(",
"String",
"name",
",",
"boolean",
"acl",
")",
"{",
"String",
"newName",
"=",
"name",
".",
"toLowerCase",
"(",
")",
";",
"if",
"(",
"aclList",
".",
"containsKey",
"(",
"newName",
")",
")",
"{",
"AccountACLValue",
"value",
"=",
"aclList",
".",
"get",
"(",
"newName",
")",
";",
"set",
"(",
"newName",
",",
"value",
".",
"canDeposit",
"(",
")",
",",
"value",
".",
"canWithdraw",
"(",
")",
",",
"acl",
",",
"value",
".",
"canBalance",
"(",
")",
",",
"value",
".",
"isOwner",
"(",
")",
")",
";",
"}",
"else",
"{",
"set",
"(",
"newName",
",",
"false",
",",
"false",
",",
"acl",
",",
"false",
",",
"false",
")",
";",
"}",
"}"
] | Set if a player can modify the ACL list
@param name The player name
@param acl can modify the ACL or not | [
"Set",
"if",
"a",
"player",
"can",
"modify",
"the",
"ACL",
"list"
] | train | https://github.com/greatman/craftconomy3/blob/51b1b3de7d039e20c7418d1e70b8c4b02b8cf840/src/main/java/com/greatmancode/craftconomy3/account/AccountACL.java#L149-L157 |
UrielCh/ovh-java-sdk | ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java | ApiOvhIp.service_serviceName_PUT | public void service_serviceName_PUT(String serviceName, OvhServiceIp body) throws IOException {
"""
Alter this object properties
REST: PUT /ip/service/{serviceName}
@param body [required] New object properties
@param serviceName [required] The internal name of your IP services
API beta
"""
String qPath = "/ip/service/{serviceName}";
StringBuilder sb = path(qPath, serviceName);
exec(qPath, "PUT", sb.toString(), body);
} | java | public void service_serviceName_PUT(String serviceName, OvhServiceIp body) throws IOException {
String qPath = "/ip/service/{serviceName}";
StringBuilder sb = path(qPath, serviceName);
exec(qPath, "PUT", sb.toString(), body);
} | [
"public",
"void",
"service_serviceName_PUT",
"(",
"String",
"serviceName",
",",
"OvhServiceIp",
"body",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/ip/service/{serviceName}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"serviceName",
")",
";",
"exec",
"(",
"qPath",
",",
"\"PUT\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"body",
")",
";",
"}"
] | Alter this object properties
REST: PUT /ip/service/{serviceName}
@param body [required] New object properties
@param serviceName [required] The internal name of your IP services
API beta | [
"Alter",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java#L1153-L1157 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/network/v2018_06_01/implementation/ExpressRouteCircuitConnectionsInner.java | ExpressRouteCircuitConnectionsInner.createOrUpdate | public ExpressRouteCircuitConnectionInner createOrUpdate(String resourceGroupName, String circuitName, String peeringName, String connectionName, ExpressRouteCircuitConnectionInner expressRouteCircuitConnectionParameters) {
"""
Creates or updates a Express Route Circuit Connection in the specified express route circuits.
@param resourceGroupName The name of the resource group.
@param circuitName The name of the express route circuit.
@param peeringName The name of the peering.
@param connectionName The name of the express route circuit connection.
@param expressRouteCircuitConnectionParameters Parameters supplied to the create or update express route circuit circuit connection 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 ExpressRouteCircuitConnectionInner object if successful.
"""
return createOrUpdateWithServiceResponseAsync(resourceGroupName, circuitName, peeringName, connectionName, expressRouteCircuitConnectionParameters).toBlocking().last().body();
} | java | public ExpressRouteCircuitConnectionInner createOrUpdate(String resourceGroupName, String circuitName, String peeringName, String connectionName, ExpressRouteCircuitConnectionInner expressRouteCircuitConnectionParameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, circuitName, peeringName, connectionName, expressRouteCircuitConnectionParameters).toBlocking().last().body();
} | [
"public",
"ExpressRouteCircuitConnectionInner",
"createOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"circuitName",
",",
"String",
"peeringName",
",",
"String",
"connectionName",
",",
"ExpressRouteCircuitConnectionInner",
"expressRouteCircuitConnectionParameters",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"circuitName",
",",
"peeringName",
",",
"connectionName",
",",
"expressRouteCircuitConnectionParameters",
")",
".",
"toBlocking",
"(",
")",
".",
"last",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
] | Creates or updates a Express Route Circuit Connection in the specified express route circuits.
@param resourceGroupName The name of the resource group.
@param circuitName The name of the express route circuit.
@param peeringName The name of the peering.
@param connectionName The name of the express route circuit connection.
@param expressRouteCircuitConnectionParameters Parameters supplied to the create or update express route circuit circuit connection 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 ExpressRouteCircuitConnectionInner object if successful. | [
"Creates",
"or",
"updates",
"a",
"Express",
"Route",
"Circuit",
"Connection",
"in",
"the",
"specified",
"express",
"route",
"circuits",
"."
] | 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/ExpressRouteCircuitConnectionsInner.java#L370-L372 |
netty/netty | transport-native-epoll/src/main/java/io/netty/channel/epoll/AbstractEpollStreamChannel.java | AbstractEpollStreamChannel.spliceTo | public final ChannelFuture spliceTo(final FileDescriptor ch, final int offset, final int len) {
"""
Splice from this {@link AbstractEpollStreamChannel} to another {@link FileDescriptor}.
The {@code offset} is the offset for the {@link FileDescriptor} and {@code len} is the
number of bytes to splice. If using {@link Integer#MAX_VALUE} it will splice until the
{@link ChannelFuture} was canceled or it was failed.
Please note:
<ul>
<li>{@link EpollChannelConfig#getEpollMode()} must be {@link EpollMode#LEVEL_TRIGGERED} for this
{@link AbstractEpollStreamChannel}</li>
<li>the {@link FileDescriptor} will not be closed after the {@link ChannelFuture} is notified</li>
<li>this channel must be registered to an event loop or {@link IllegalStateException} will be thrown.</li>
</ul>
"""
return spliceTo(ch, offset, len, newPromise());
} | java | public final ChannelFuture spliceTo(final FileDescriptor ch, final int offset, final int len) {
return spliceTo(ch, offset, len, newPromise());
} | [
"public",
"final",
"ChannelFuture",
"spliceTo",
"(",
"final",
"FileDescriptor",
"ch",
",",
"final",
"int",
"offset",
",",
"final",
"int",
"len",
")",
"{",
"return",
"spliceTo",
"(",
"ch",
",",
"offset",
",",
"len",
",",
"newPromise",
"(",
")",
")",
";",
"}"
] | Splice from this {@link AbstractEpollStreamChannel} to another {@link FileDescriptor}.
The {@code offset} is the offset for the {@link FileDescriptor} and {@code len} is the
number of bytes to splice. If using {@link Integer#MAX_VALUE} it will splice until the
{@link ChannelFuture} was canceled or it was failed.
Please note:
<ul>
<li>{@link EpollChannelConfig#getEpollMode()} must be {@link EpollMode#LEVEL_TRIGGERED} for this
{@link AbstractEpollStreamChannel}</li>
<li>the {@link FileDescriptor} will not be closed after the {@link ChannelFuture} is notified</li>
<li>this channel must be registered to an event loop or {@link IllegalStateException} will be thrown.</li>
</ul> | [
"Splice",
"from",
"this",
"{",
"@link",
"AbstractEpollStreamChannel",
"}",
"to",
"another",
"{",
"@link",
"FileDescriptor",
"}",
".",
"The",
"{",
"@code",
"offset",
"}",
"is",
"the",
"offset",
"for",
"the",
"{",
"@link",
"FileDescriptor",
"}",
"and",
"{",
"@code",
"len",
"}",
"is",
"the",
"number",
"of",
"bytes",
"to",
"splice",
".",
"If",
"using",
"{",
"@link",
"Integer#MAX_VALUE",
"}",
"it",
"will",
"splice",
"until",
"the",
"{",
"@link",
"ChannelFuture",
"}",
"was",
"canceled",
"or",
"it",
"was",
"failed",
"."
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport-native-epoll/src/main/java/io/netty/channel/epoll/AbstractEpollStreamChannel.java#L196-L198 |
aoindustries/ao-servlet-filter | src/main/java/com/aoindustries/servlet/filter/LocaleFilter.java | LocaleFilter.getEnabledLocales | public static Map<String,Locale> getEnabledLocales(ServletRequest request) {
"""
Gets the set of enabled locales for the provided request. This must be called
from a request that has already been filtered through LocaleFilter.
When container's default locale is used, will return an empty map.
@return The mapping from localeString to locale
"""
@SuppressWarnings("unchecked")
Map<String,Locale> enabledLocales = (Map<String,Locale>)request.getAttribute(ENABLED_LOCALES_REQUEST_ATTRIBUTE_KEY);
if(enabledLocales==null) throw new IllegalStateException("Not in request filtered by LocaleFilter, unable to get enabled locales.");
return enabledLocales;
} | java | public static Map<String,Locale> getEnabledLocales(ServletRequest request) {
@SuppressWarnings("unchecked")
Map<String,Locale> enabledLocales = (Map<String,Locale>)request.getAttribute(ENABLED_LOCALES_REQUEST_ATTRIBUTE_KEY);
if(enabledLocales==null) throw new IllegalStateException("Not in request filtered by LocaleFilter, unable to get enabled locales.");
return enabledLocales;
} | [
"public",
"static",
"Map",
"<",
"String",
",",
"Locale",
">",
"getEnabledLocales",
"(",
"ServletRequest",
"request",
")",
"{",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"Map",
"<",
"String",
",",
"Locale",
">",
"enabledLocales",
"=",
"(",
"Map",
"<",
"String",
",",
"Locale",
">",
")",
"request",
".",
"getAttribute",
"(",
"ENABLED_LOCALES_REQUEST_ATTRIBUTE_KEY",
")",
";",
"if",
"(",
"enabledLocales",
"==",
"null",
")",
"throw",
"new",
"IllegalStateException",
"(",
"\"Not in request filtered by LocaleFilter, unable to get enabled locales.\"",
")",
";",
"return",
"enabledLocales",
";",
"}"
] | Gets the set of enabled locales for the provided request. This must be called
from a request that has already been filtered through LocaleFilter.
When container's default locale is used, will return an empty map.
@return The mapping from localeString to locale | [
"Gets",
"the",
"set",
"of",
"enabled",
"locales",
"for",
"the",
"provided",
"request",
".",
"This",
"must",
"be",
"called",
"from",
"a",
"request",
"that",
"has",
"already",
"been",
"filtered",
"through",
"LocaleFilter",
".",
"When",
"container",
"s",
"default",
"locale",
"is",
"used",
"will",
"return",
"an",
"empty",
"map",
"."
] | train | https://github.com/aoindustries/ao-servlet-filter/blob/ee1fb95e36b0620949e9cb8ee863ac37fb9e4f2b/src/main/java/com/aoindustries/servlet/filter/LocaleFilter.java#L154-L159 |
zanata/jgettext | src/main/java/org/fedorahosted/tennera/jgettext/catalog/parse/CatalogLexer.java | CatalogLexer.readGettextCharset | static String readGettextCharset(InputStream markableStream)
throws IOException, UnsupportedEncodingException {
"""
Searches the beginning (4096 bytes) of the InputStream for a Gettext
charset declaration, and returns the charset name. The InputStream must
support "mark". It will be reset to the beginning of the stream. If no
charset is found, UTF-8 will be assumed.
<p>
As with the Gettext tools, this only works for ASCII-compatible charsets.
UTF-16 is not supported.
</p>
@param markableStream
@return
@throws IOException
@throws UnsupportedEncodingException
"""
String charset = "UTF-8";
int limit = 4096;
markableStream.mark(limit);
byte[] buf = new byte[limit];
int count = markableStream.read(buf);
markableStream.reset();
if (count < 0) {
throw new RuntimeException();
}
String s = new String(buf, 0, count, "ASCII");
Pattern pat =
Pattern.compile("\"Content-Type:.*charset=([^ \t\\\\]*)[ \t\\\\]");
Matcher matcher = pat.matcher(s);
if (matcher.find()) {
charset = matcher.group(1);
} else {
// this regex is more prone to false positives inside comments, so
// we try the more specific regex (above) first
pat = Pattern.compile("charset=([^ \t\\\\]*)[ \t\\\\]");
if (matcher.find()) {
charset = matcher.group(1);
}
}
if (charset.equals("CHARSET")) {
charset = "ASCII";
}
return charset;
} | java | static String readGettextCharset(InputStream markableStream)
throws IOException, UnsupportedEncodingException
{
String charset = "UTF-8";
int limit = 4096;
markableStream.mark(limit);
byte[] buf = new byte[limit];
int count = markableStream.read(buf);
markableStream.reset();
if (count < 0) {
throw new RuntimeException();
}
String s = new String(buf, 0, count, "ASCII");
Pattern pat =
Pattern.compile("\"Content-Type:.*charset=([^ \t\\\\]*)[ \t\\\\]");
Matcher matcher = pat.matcher(s);
if (matcher.find()) {
charset = matcher.group(1);
} else {
// this regex is more prone to false positives inside comments, so
// we try the more specific regex (above) first
pat = Pattern.compile("charset=([^ \t\\\\]*)[ \t\\\\]");
if (matcher.find()) {
charset = matcher.group(1);
}
}
if (charset.equals("CHARSET")) {
charset = "ASCII";
}
return charset;
} | [
"static",
"String",
"readGettextCharset",
"(",
"InputStream",
"markableStream",
")",
"throws",
"IOException",
",",
"UnsupportedEncodingException",
"{",
"String",
"charset",
"=",
"\"UTF-8\"",
";",
"int",
"limit",
"=",
"4096",
";",
"markableStream",
".",
"mark",
"(",
"limit",
")",
";",
"byte",
"[",
"]",
"buf",
"=",
"new",
"byte",
"[",
"limit",
"]",
";",
"int",
"count",
"=",
"markableStream",
".",
"read",
"(",
"buf",
")",
";",
"markableStream",
".",
"reset",
"(",
")",
";",
"if",
"(",
"count",
"<",
"0",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
")",
";",
"}",
"String",
"s",
"=",
"new",
"String",
"(",
"buf",
",",
"0",
",",
"count",
",",
"\"ASCII\"",
")",
";",
"Pattern",
"pat",
"=",
"Pattern",
".",
"compile",
"(",
"\"\\\"Content-Type:.*charset=([^ \\t\\\\\\\\]*)[ \\t\\\\\\\\]\"",
")",
";",
"Matcher",
"matcher",
"=",
"pat",
".",
"matcher",
"(",
"s",
")",
";",
"if",
"(",
"matcher",
".",
"find",
"(",
")",
")",
"{",
"charset",
"=",
"matcher",
".",
"group",
"(",
"1",
")",
";",
"}",
"else",
"{",
"// this regex is more prone to false positives inside comments, so",
"// we try the more specific regex (above) first",
"pat",
"=",
"Pattern",
".",
"compile",
"(",
"\"charset=([^ \\t\\\\\\\\]*)[ \\t\\\\\\\\]\"",
")",
";",
"if",
"(",
"matcher",
".",
"find",
"(",
")",
")",
"{",
"charset",
"=",
"matcher",
".",
"group",
"(",
"1",
")",
";",
"}",
"}",
"if",
"(",
"charset",
".",
"equals",
"(",
"\"CHARSET\"",
")",
")",
"{",
"charset",
"=",
"\"ASCII\"",
";",
"}",
"return",
"charset",
";",
"}"
] | Searches the beginning (4096 bytes) of the InputStream for a Gettext
charset declaration, and returns the charset name. The InputStream must
support "mark". It will be reset to the beginning of the stream. If no
charset is found, UTF-8 will be assumed.
<p>
As with the Gettext tools, this only works for ASCII-compatible charsets.
UTF-16 is not supported.
</p>
@param markableStream
@return
@throws IOException
@throws UnsupportedEncodingException | [
"Searches",
"the",
"beginning",
"(",
"4096",
"bytes",
")",
"of",
"the",
"InputStream",
"for",
"a",
"Gettext",
"charset",
"declaration",
"and",
"returns",
"the",
"charset",
"name",
".",
"The",
"InputStream",
"must",
"support",
"mark",
".",
"It",
"will",
"be",
"reset",
"to",
"the",
"beginning",
"of",
"the",
"stream",
".",
"If",
"no",
"charset",
"is",
"found",
"UTF",
"-",
"8",
"will",
"be",
"assumed",
".",
"<p",
">",
"As",
"with",
"the",
"Gettext",
"tools",
"this",
"only",
"works",
"for",
"ASCII",
"-",
"compatible",
"charsets",
".",
"UTF",
"-",
"16",
"is",
"not",
"supported",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/zanata/jgettext/blob/29a6170c81b82a14458fb5c8b23720fc0dec291c/src/main/java/org/fedorahosted/tennera/jgettext/catalog/parse/CatalogLexer.java#L112-L142 |
jbundle/jbundle | base/message/trx/src/main/java/org/jbundle/base/message/trx/message/external/convert/BaseConvertToMessage.java | BaseConvertToMessage.addPayloadProperties | public void addPayloadProperties(Object msg, BaseMessage message) {
"""
Utility to add the standard payload properties to the message
@param msg
@param message
"""
MessageDataDesc messageDataDesc = message.getMessageDataDesc(null); // Top level only
if (messageDataDesc != null)
{
Map<String,Class<?>> mapPropertyNames = messageDataDesc.getPayloadPropertyNames(null);
if (mapPropertyNames != null)
{
Map<String,Object> properties = this.getPayloadProperties(msg, mapPropertyNames);
for (String key : properties.keySet())
{
message.put(key, properties.get(key));
}
}
}
} | java | public void addPayloadProperties(Object msg, BaseMessage message)
{
MessageDataDesc messageDataDesc = message.getMessageDataDesc(null); // Top level only
if (messageDataDesc != null)
{
Map<String,Class<?>> mapPropertyNames = messageDataDesc.getPayloadPropertyNames(null);
if (mapPropertyNames != null)
{
Map<String,Object> properties = this.getPayloadProperties(msg, mapPropertyNames);
for (String key : properties.keySet())
{
message.put(key, properties.get(key));
}
}
}
} | [
"public",
"void",
"addPayloadProperties",
"(",
"Object",
"msg",
",",
"BaseMessage",
"message",
")",
"{",
"MessageDataDesc",
"messageDataDesc",
"=",
"message",
".",
"getMessageDataDesc",
"(",
"null",
")",
";",
"// Top level only",
"if",
"(",
"messageDataDesc",
"!=",
"null",
")",
"{",
"Map",
"<",
"String",
",",
"Class",
"<",
"?",
">",
">",
"mapPropertyNames",
"=",
"messageDataDesc",
".",
"getPayloadPropertyNames",
"(",
"null",
")",
";",
"if",
"(",
"mapPropertyNames",
"!=",
"null",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
"=",
"this",
".",
"getPayloadProperties",
"(",
"msg",
",",
"mapPropertyNames",
")",
";",
"for",
"(",
"String",
"key",
":",
"properties",
".",
"keySet",
"(",
")",
")",
"{",
"message",
".",
"put",
"(",
"key",
",",
"properties",
".",
"get",
"(",
"key",
")",
")",
";",
"}",
"}",
"}",
"}"
] | Utility to add the standard payload properties to the message
@param msg
@param message | [
"Utility",
"to",
"add",
"the",
"standard",
"payload",
"properties",
"to",
"the",
"message"
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/message/trx/src/main/java/org/jbundle/base/message/trx/message/external/convert/BaseConvertToMessage.java#L161-L177 |
cloudant/java-cloudant | cloudant-client/src/main/java/com/cloudant/client/org/lightcouch/CouchDbClient.java | CouchDbClient.executeToResponse | public Response executeToResponse(HttpConnection connection) {
"""
Executes a HTTP request and parses the JSON response into a Response instance.
@param connection The HTTP request to execute.
@return Response object of the deserialized JSON response
"""
InputStream is = null;
try {
is = this.executeToInputStream(connection);
Response response = getResponse(is, Response.class, getGson());
response.setStatusCode(connection.getConnection().getResponseCode());
response.setReason(connection.getConnection().getResponseMessage());
return response;
} catch (IOException e) {
throw new CouchDbException("Error retrieving response code or message.", e);
} finally {
close(is);
}
} | java | public Response executeToResponse(HttpConnection connection) {
InputStream is = null;
try {
is = this.executeToInputStream(connection);
Response response = getResponse(is, Response.class, getGson());
response.setStatusCode(connection.getConnection().getResponseCode());
response.setReason(connection.getConnection().getResponseMessage());
return response;
} catch (IOException e) {
throw new CouchDbException("Error retrieving response code or message.", e);
} finally {
close(is);
}
} | [
"public",
"Response",
"executeToResponse",
"(",
"HttpConnection",
"connection",
")",
"{",
"InputStream",
"is",
"=",
"null",
";",
"try",
"{",
"is",
"=",
"this",
".",
"executeToInputStream",
"(",
"connection",
")",
";",
"Response",
"response",
"=",
"getResponse",
"(",
"is",
",",
"Response",
".",
"class",
",",
"getGson",
"(",
")",
")",
";",
"response",
".",
"setStatusCode",
"(",
"connection",
".",
"getConnection",
"(",
")",
".",
"getResponseCode",
"(",
")",
")",
";",
"response",
".",
"setReason",
"(",
"connection",
".",
"getConnection",
"(",
")",
".",
"getResponseMessage",
"(",
")",
")",
";",
"return",
"response",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"CouchDbException",
"(",
"\"Error retrieving response code or message.\"",
",",
"e",
")",
";",
"}",
"finally",
"{",
"close",
"(",
"is",
")",
";",
"}",
"}"
] | Executes a HTTP request and parses the JSON response into a Response instance.
@param connection The HTTP request to execute.
@return Response object of the deserialized JSON response | [
"Executes",
"a",
"HTTP",
"request",
"and",
"parses",
"the",
"JSON",
"response",
"into",
"a",
"Response",
"instance",
"."
] | train | https://github.com/cloudant/java-cloudant/blob/42c438654945361bded2cc0827afc046d535b31b/cloudant-client/src/main/java/com/cloudant/client/org/lightcouch/CouchDbClient.java#L356-L369 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/util/BaseApplication.java | BaseApplication.getPDatabaseParent | public ThinPhysicalDatabaseParent getPDatabaseParent(Map<String,Object> properties, boolean bCreateIfNew) {
"""
Get the (optional) raw data database manager.
@return The pDatabaseOwner (returns an object, so this package isn't dependent on PDatabaseOwner).
"""
return this.getEnvironment().getPDatabaseParent(properties, bCreateIfNew);
} | java | public ThinPhysicalDatabaseParent getPDatabaseParent(Map<String,Object> properties, boolean bCreateIfNew)
{
return this.getEnvironment().getPDatabaseParent(properties, bCreateIfNew);
} | [
"public",
"ThinPhysicalDatabaseParent",
"getPDatabaseParent",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
",",
"boolean",
"bCreateIfNew",
")",
"{",
"return",
"this",
".",
"getEnvironment",
"(",
")",
".",
"getPDatabaseParent",
"(",
"properties",
",",
"bCreateIfNew",
")",
";",
"}"
] | Get the (optional) raw data database manager.
@return The pDatabaseOwner (returns an object, so this package isn't dependent on PDatabaseOwner). | [
"Get",
"the",
"(",
"optional",
")",
"raw",
"data",
"database",
"manager",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/util/BaseApplication.java#L238-L241 |
netplex/json-smart-v2 | json-smart/src/main/java/net/minidev/json/JSONArray.java | JSONArray.writeJSONString | public static void writeJSONString(Iterable<? extends Object> list, Appendable out, JSONStyle compression)
throws IOException {
"""
Encode a list into JSON text and write it to out. If this list is also a
JSONStreamAware or a JSONAware, JSONStreamAware and JSONAware specific
behaviours will be ignored at this top level.
@see JSONValue#writeJSONString(Object, Appendable)
@param list
@param out
"""
if (list == null) {
out.append("null");
return;
}
JsonWriter.JSONIterableWriter.writeJSONString(list, out, compression);
} | java | public static void writeJSONString(Iterable<? extends Object> list, Appendable out, JSONStyle compression)
throws IOException {
if (list == null) {
out.append("null");
return;
}
JsonWriter.JSONIterableWriter.writeJSONString(list, out, compression);
} | [
"public",
"static",
"void",
"writeJSONString",
"(",
"Iterable",
"<",
"?",
"extends",
"Object",
">",
"list",
",",
"Appendable",
"out",
",",
"JSONStyle",
"compression",
")",
"throws",
"IOException",
"{",
"if",
"(",
"list",
"==",
"null",
")",
"{",
"out",
".",
"append",
"(",
"\"null\"",
")",
";",
"return",
";",
"}",
"JsonWriter",
".",
"JSONIterableWriter",
".",
"writeJSONString",
"(",
"list",
",",
"out",
",",
"compression",
")",
";",
"}"
] | Encode a list into JSON text and write it to out. If this list is also a
JSONStreamAware or a JSONAware, JSONStreamAware and JSONAware specific
behaviours will be ignored at this top level.
@see JSONValue#writeJSONString(Object, Appendable)
@param list
@param out | [
"Encode",
"a",
"list",
"into",
"JSON",
"text",
"and",
"write",
"it",
"to",
"out",
".",
"If",
"this",
"list",
"is",
"also",
"a",
"JSONStreamAware",
"or",
"a",
"JSONAware",
"JSONStreamAware",
"and",
"JSONAware",
"specific",
"behaviours",
"will",
"be",
"ignored",
"at",
"this",
"top",
"level",
"."
] | train | https://github.com/netplex/json-smart-v2/blob/bfb3daef039e22a7bbff5f76bf14ea23330cd70e/json-smart/src/main/java/net/minidev/json/JSONArray.java#L69-L76 |
exoplatform/jcr | exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/UserProfileHandlerImpl.java | UserProfileHandlerImpl.preDelete | private void preDelete(UserProfile userProfile, boolean broadcast) throws Exception {
"""
Notifying listeners before profile deletion.
@param userProfile
the user profile which is used in delete operation
@throws Exception
if any listener failed to handle the event
"""
for (UserProfileEventListener listener : listeners)
{
listener.preDelete(userProfile);
}
} | java | private void preDelete(UserProfile userProfile, boolean broadcast) throws Exception
{
for (UserProfileEventListener listener : listeners)
{
listener.preDelete(userProfile);
}
} | [
"private",
"void",
"preDelete",
"(",
"UserProfile",
"userProfile",
",",
"boolean",
"broadcast",
")",
"throws",
"Exception",
"{",
"for",
"(",
"UserProfileEventListener",
"listener",
":",
"listeners",
")",
"{",
"listener",
".",
"preDelete",
"(",
"userProfile",
")",
";",
"}",
"}"
] | Notifying listeners before profile deletion.
@param userProfile
the user profile which is used in delete operation
@throws Exception
if any listener failed to handle the event | [
"Notifying",
"listeners",
"before",
"profile",
"deletion",
"."
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/UserProfileHandlerImpl.java#L443-L449 |
lucee/Lucee | core/src/main/java/lucee/runtime/op/Caster.java | Caster.toNull | public static Object toNull(Object value, Object defaultValue) {
"""
casts a Object to null
@param value
@param defaultValue
@return to null from Object
"""
if (value == null) return null;
if (value instanceof String && Caster.toString(value, "").trim().length() == 0) return null;
if (value instanceof Number && ((Number) value).intValue() == 0) return null;
return defaultValue;
} | java | public static Object toNull(Object value, Object defaultValue) {
if (value == null) return null;
if (value instanceof String && Caster.toString(value, "").trim().length() == 0) return null;
if (value instanceof Number && ((Number) value).intValue() == 0) return null;
return defaultValue;
} | [
"public",
"static",
"Object",
"toNull",
"(",
"Object",
"value",
",",
"Object",
"defaultValue",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"return",
"null",
";",
"if",
"(",
"value",
"instanceof",
"String",
"&&",
"Caster",
".",
"toString",
"(",
"value",
",",
"\"\"",
")",
".",
"trim",
"(",
")",
".",
"length",
"(",
")",
"==",
"0",
")",
"return",
"null",
";",
"if",
"(",
"value",
"instanceof",
"Number",
"&&",
"(",
"(",
"Number",
")",
"value",
")",
".",
"intValue",
"(",
")",
"==",
"0",
")",
"return",
"null",
";",
"return",
"defaultValue",
";",
"}"
] | casts a Object to null
@param value
@param defaultValue
@return to null from Object | [
"casts",
"a",
"Object",
"to",
"null"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/op/Caster.java#L4428-L4433 |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/alg/misc/PixelMath.java | PixelMath.boundImage | public static void boundImage( GrayS8 img , int min , int max ) {
"""
Bounds image pixels to be between these two values
@param img Image
@param min minimum value.
@param max maximum value.
"""
ImplPixelMath.boundImage(img,min,max);
} | java | public static void boundImage( GrayS8 img , int min , int max ) {
ImplPixelMath.boundImage(img,min,max);
} | [
"public",
"static",
"void",
"boundImage",
"(",
"GrayS8",
"img",
",",
"int",
"min",
",",
"int",
"max",
")",
"{",
"ImplPixelMath",
".",
"boundImage",
"(",
"img",
",",
"min",
",",
"max",
")",
";",
"}"
] | Bounds image pixels to be between these two values
@param img Image
@param min minimum value.
@param max maximum value. | [
"Bounds",
"image",
"pixels",
"to",
"be",
"between",
"these",
"two",
"values"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/misc/PixelMath.java#L4329-L4331 |
Stratio/stratio-cassandra | src/java/org/apache/cassandra/triggers/TriggerExecutor.java | TriggerExecutor.reloadClasses | public void reloadClasses() {
"""
Reload the triggers which is already loaded, Invoking this will update
the class loader so new jars can be loaded.
"""
File triggerDirectory = FBUtilities.cassandraTriggerDir();
if (triggerDirectory == null)
return;
customClassLoader = new CustomClassLoader(parent, triggerDirectory);
cachedTriggers.clear();
} | java | public void reloadClasses()
{
File triggerDirectory = FBUtilities.cassandraTriggerDir();
if (triggerDirectory == null)
return;
customClassLoader = new CustomClassLoader(parent, triggerDirectory);
cachedTriggers.clear();
} | [
"public",
"void",
"reloadClasses",
"(",
")",
"{",
"File",
"triggerDirectory",
"=",
"FBUtilities",
".",
"cassandraTriggerDir",
"(",
")",
";",
"if",
"(",
"triggerDirectory",
"==",
"null",
")",
"return",
";",
"customClassLoader",
"=",
"new",
"CustomClassLoader",
"(",
"parent",
",",
"triggerDirectory",
")",
";",
"cachedTriggers",
".",
"clear",
"(",
")",
";",
"}"
] | Reload the triggers which is already loaded, Invoking this will update
the class loader so new jars can be loaded. | [
"Reload",
"the",
"triggers",
"which",
"is",
"already",
"loaded",
"Invoking",
"this",
"will",
"update",
"the",
"class",
"loader",
"so",
"new",
"jars",
"can",
"be",
"loaded",
"."
] | train | https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/triggers/TriggerExecutor.java#L54-L61 |
alkacon/opencms-core | src/org/opencms/ade/configuration/CmsConfigurationReader.java | CmsConfigurationReader.getString | public static String getString(CmsObject cms, I_CmsXmlContentValueLocation location) {
"""
Gets the string value of an XML content location.<p>
@param cms the CMS context to use
@param location an XML content location
@return the string value of that XML content location
"""
if (location == null) {
return null;
}
return location.asString(cms);
} | java | public static String getString(CmsObject cms, I_CmsXmlContentValueLocation location) {
if (location == null) {
return null;
}
return location.asString(cms);
} | [
"public",
"static",
"String",
"getString",
"(",
"CmsObject",
"cms",
",",
"I_CmsXmlContentValueLocation",
"location",
")",
"{",
"if",
"(",
"location",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"location",
".",
"asString",
"(",
"cms",
")",
";",
"}"
] | Gets the string value of an XML content location.<p>
@param cms the CMS context to use
@param location an XML content location
@return the string value of that XML content location | [
"Gets",
"the",
"string",
"value",
"of",
"an",
"XML",
"content",
"location",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/configuration/CmsConfigurationReader.java#L281-L287 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/ExpressRouteCrossConnectionsInner.java | ExpressRouteCrossConnectionsInner.beginListRoutesTableSummary | public ExpressRouteCrossConnectionsRoutesTableSummaryListResultInner beginListRoutesTableSummary(String resourceGroupName, String crossConnectionName, String peeringName, String devicePath) {
"""
Gets the route table summary associated with the express route cross connection in a resource group.
@param resourceGroupName The name of the resource group.
@param crossConnectionName The name of the ExpressRouteCrossConnection.
@param peeringName The name of the peering.
@param devicePath The path of the device.
@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 ExpressRouteCrossConnectionsRoutesTableSummaryListResultInner object if successful.
"""
return beginListRoutesTableSummaryWithServiceResponseAsync(resourceGroupName, crossConnectionName, peeringName, devicePath).toBlocking().single().body();
} | java | public ExpressRouteCrossConnectionsRoutesTableSummaryListResultInner beginListRoutesTableSummary(String resourceGroupName, String crossConnectionName, String peeringName, String devicePath) {
return beginListRoutesTableSummaryWithServiceResponseAsync(resourceGroupName, crossConnectionName, peeringName, devicePath).toBlocking().single().body();
} | [
"public",
"ExpressRouteCrossConnectionsRoutesTableSummaryListResultInner",
"beginListRoutesTableSummary",
"(",
"String",
"resourceGroupName",
",",
"String",
"crossConnectionName",
",",
"String",
"peeringName",
",",
"String",
"devicePath",
")",
"{",
"return",
"beginListRoutesTableSummaryWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"crossConnectionName",
",",
"peeringName",
",",
"devicePath",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
] | Gets the route table summary associated with the express route cross connection in a resource group.
@param resourceGroupName The name of the resource group.
@param crossConnectionName The name of the ExpressRouteCrossConnection.
@param peeringName The name of the peering.
@param devicePath The path of the device.
@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 ExpressRouteCrossConnectionsRoutesTableSummaryListResultInner object if successful. | [
"Gets",
"the",
"route",
"table",
"summary",
"associated",
"with",
"the",
"express",
"route",
"cross",
"connection",
"in",
"a",
"resource",
"group",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/ExpressRouteCrossConnectionsInner.java#L1187-L1189 |
twitter/hraven | hraven-core/src/main/java/com/twitter/hraven/datasource/AppSummaryService.java | AppSummaryService.createQueueListValue | String createQueueListValue(JobDetails jobDetails, String existingQueues) {
"""
looks at {@Link String} to see if queue name already is stored, if not,
adds it
@param {@link JobDetails}
@param {@link Result}
@return queue list
"""
/*
* check if queue already exists append separator at the end to avoid
* "false" queue match via substring match
*/
String queue = jobDetails.getQueue();
queue = queue.concat(Constants.SEP);
if (existingQueues == null) {
return queue;
}
if (!existingQueues.contains(queue)) {
existingQueues = existingQueues.concat(queue);
}
return existingQueues;
} | java | String createQueueListValue(JobDetails jobDetails, String existingQueues) {
/*
* check if queue already exists append separator at the end to avoid
* "false" queue match via substring match
*/
String queue = jobDetails.getQueue();
queue = queue.concat(Constants.SEP);
if (existingQueues == null) {
return queue;
}
if (!existingQueues.contains(queue)) {
existingQueues = existingQueues.concat(queue);
}
return existingQueues;
} | [
"String",
"createQueueListValue",
"(",
"JobDetails",
"jobDetails",
",",
"String",
"existingQueues",
")",
"{",
"/*\n * check if queue already exists append separator at the end to avoid\n * \"false\" queue match via substring match\n */",
"String",
"queue",
"=",
"jobDetails",
".",
"getQueue",
"(",
")",
";",
"queue",
"=",
"queue",
".",
"concat",
"(",
"Constants",
".",
"SEP",
")",
";",
"if",
"(",
"existingQueues",
"==",
"null",
")",
"{",
"return",
"queue",
";",
"}",
"if",
"(",
"!",
"existingQueues",
".",
"contains",
"(",
"queue",
")",
")",
"{",
"existingQueues",
"=",
"existingQueues",
".",
"concat",
"(",
"queue",
")",
";",
"}",
"return",
"existingQueues",
";",
"}"
] | looks at {@Link String} to see if queue name already is stored, if not,
adds it
@param {@link JobDetails}
@param {@link Result}
@return queue list | [
"looks",
"at",
"{"
] | train | https://github.com/twitter/hraven/blob/e35996b6e2f016bcd18db0bad320be7c93d95208/hraven-core/src/main/java/com/twitter/hraven/datasource/AppSummaryService.java#L308-L324 |
j-a-w-r/jawr-main-repo | jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/postprocess/impl/JSMinPostProcessor.java | JSMinPostProcessor.minifyStringBuffer | public StringBuffer minifyStringBuffer(StringBuffer sb, Charset charset) throws IOException, JSMinException {
"""
Utility method for components that need to use JSMin in a different
context other than bundle postprocessing.
@param sb
the content to minify
@param charset
the charset
@return the minified content
@throws java.io.IOException
if an IOException occurs
@throws net.jawr.web.minification.JSMin.JSMinException
if a JSMin exception occurs
"""
byte[] bundleBytes = sb.toString().getBytes(charset.name());
ByteArrayInputStream bIs = new ByteArrayInputStream(bundleBytes);
ByteArrayOutputStream bOs = new ByteArrayOutputStream();
// Compress data and recover it as a byte array.
JSMin minifier = new JSMin(bIs, bOs);
minifier.jsmin();
byte[] minified = bOs.toByteArray();
return byteArrayToString(charset, minified);
} | java | public StringBuffer minifyStringBuffer(StringBuffer sb, Charset charset) throws IOException, JSMinException {
byte[] bundleBytes = sb.toString().getBytes(charset.name());
ByteArrayInputStream bIs = new ByteArrayInputStream(bundleBytes);
ByteArrayOutputStream bOs = new ByteArrayOutputStream();
// Compress data and recover it as a byte array.
JSMin minifier = new JSMin(bIs, bOs);
minifier.jsmin();
byte[] minified = bOs.toByteArray();
return byteArrayToString(charset, minified);
} | [
"public",
"StringBuffer",
"minifyStringBuffer",
"(",
"StringBuffer",
"sb",
",",
"Charset",
"charset",
")",
"throws",
"IOException",
",",
"JSMinException",
"{",
"byte",
"[",
"]",
"bundleBytes",
"=",
"sb",
".",
"toString",
"(",
")",
".",
"getBytes",
"(",
"charset",
".",
"name",
"(",
")",
")",
";",
"ByteArrayInputStream",
"bIs",
"=",
"new",
"ByteArrayInputStream",
"(",
"bundleBytes",
")",
";",
"ByteArrayOutputStream",
"bOs",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"// Compress data and recover it as a byte array.",
"JSMin",
"minifier",
"=",
"new",
"JSMin",
"(",
"bIs",
",",
"bOs",
")",
";",
"minifier",
".",
"jsmin",
"(",
")",
";",
"byte",
"[",
"]",
"minified",
"=",
"bOs",
".",
"toByteArray",
"(",
")",
";",
"return",
"byteArrayToString",
"(",
"charset",
",",
"minified",
")",
";",
"}"
] | Utility method for components that need to use JSMin in a different
context other than bundle postprocessing.
@param sb
the content to minify
@param charset
the charset
@return the minified content
@throws java.io.IOException
if an IOException occurs
@throws net.jawr.web.minification.JSMin.JSMinException
if a JSMin exception occurs | [
"Utility",
"method",
"for",
"components",
"that",
"need",
"to",
"use",
"JSMin",
"in",
"a",
"different",
"context",
"other",
"than",
"bundle",
"postprocessing",
"."
] | train | https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/postprocess/impl/JSMinPostProcessor.java#L100-L110 |
DJCordhose/jmte | src/com/floreysoft/jmte/util/Util.java | Util.fileToString | public static String fileToString(String fileName, String charsetName) {
"""
Transforms a file into a string.
@param fileName
name of the file to be transformed
@param charsetName
encoding of the file
@return the string containing the content of the file
"""
return fileToString(new File(fileName), charsetName);
} | java | public static String fileToString(String fileName, String charsetName) {
return fileToString(new File(fileName), charsetName);
} | [
"public",
"static",
"String",
"fileToString",
"(",
"String",
"fileName",
",",
"String",
"charsetName",
")",
"{",
"return",
"fileToString",
"(",
"new",
"File",
"(",
"fileName",
")",
",",
"charsetName",
")",
";",
"}"
] | Transforms a file into a string.
@param fileName
name of the file to be transformed
@param charsetName
encoding of the file
@return the string containing the content of the file | [
"Transforms",
"a",
"file",
"into",
"a",
"string",
"."
] | train | https://github.com/DJCordhose/jmte/blob/7334e6d111cc2198c5cf69ee336584ab9e192fe5/src/com/floreysoft/jmte/util/Util.java#L111-L113 |
alexcojocaru/elasticsearch-maven-plugin | src/main/java/com/github/alexcojocaru/mojo/elasticsearch/v2/client/Monitor.java | Monitor.waitToStartCluster | public void waitToStartCluster(final String clusterName, int nodesCount, int timeout) {
"""
Wait until the cluster has fully started (ie. all nodes have joined).
@param clusterName the ES cluster name
@param nodesCount the number of nodes in the cluster
@param timeout how many seconds to wait
"""
log.debug(String.format(
"Waiting up to %ds for the Elasticsearch cluster to start ...",
timeout));
Awaitility.await()
.atMost(timeout, TimeUnit.SECONDS)
.pollDelay(1, TimeUnit.SECONDS)
.pollInterval(1, TimeUnit.SECONDS)
.until(new Callable<Boolean>()
{
@Override
public Boolean call() throws Exception
{
return isClusterRunning(clusterName, nodesCount, client);
}
}
);
log.info("The Elasticsearch cluster has started");
} | java | public void waitToStartCluster(final String clusterName, int nodesCount, int timeout)
{
log.debug(String.format(
"Waiting up to %ds for the Elasticsearch cluster to start ...",
timeout));
Awaitility.await()
.atMost(timeout, TimeUnit.SECONDS)
.pollDelay(1, TimeUnit.SECONDS)
.pollInterval(1, TimeUnit.SECONDS)
.until(new Callable<Boolean>()
{
@Override
public Boolean call() throws Exception
{
return isClusterRunning(clusterName, nodesCount, client);
}
}
);
log.info("The Elasticsearch cluster has started");
} | [
"public",
"void",
"waitToStartCluster",
"(",
"final",
"String",
"clusterName",
",",
"int",
"nodesCount",
",",
"int",
"timeout",
")",
"{",
"log",
".",
"debug",
"(",
"String",
".",
"format",
"(",
"\"Waiting up to %ds for the Elasticsearch cluster to start ...\"",
",",
"timeout",
")",
")",
";",
"Awaitility",
".",
"await",
"(",
")",
".",
"atMost",
"(",
"timeout",
",",
"TimeUnit",
".",
"SECONDS",
")",
".",
"pollDelay",
"(",
"1",
",",
"TimeUnit",
".",
"SECONDS",
")",
".",
"pollInterval",
"(",
"1",
",",
"TimeUnit",
".",
"SECONDS",
")",
".",
"until",
"(",
"new",
"Callable",
"<",
"Boolean",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Boolean",
"call",
"(",
")",
"throws",
"Exception",
"{",
"return",
"isClusterRunning",
"(",
"clusterName",
",",
"nodesCount",
",",
"client",
")",
";",
"}",
"}",
")",
";",
"log",
".",
"info",
"(",
"\"The Elasticsearch cluster has started\"",
")",
";",
"}"
] | Wait until the cluster has fully started (ie. all nodes have joined).
@param clusterName the ES cluster name
@param nodesCount the number of nodes in the cluster
@param timeout how many seconds to wait | [
"Wait",
"until",
"the",
"cluster",
"has",
"fully",
"started",
"(",
"ie",
".",
"all",
"nodes",
"have",
"joined",
")",
"."
] | train | https://github.com/alexcojocaru/elasticsearch-maven-plugin/blob/c283053cf99dc6b6d411b58629364b6aae62b7f8/src/main/java/com/github/alexcojocaru/mojo/elasticsearch/v2/client/Monitor.java#L115-L134 |
lessthanoptimal/BoofCV | main/boofcv-sfm/src/main/java/boofcv/alg/sfm/d3/VisOdomQuadPnP.java | VisOdomQuadPnP.process | public boolean process( T left , T right ) {
"""
Estimates camera egomotion from the stereo pair
@param left Image from left camera
@param right Image from right camera
@return true if motion was estimated and false if not
"""
if( first ) {
associateL2R(left, right);
first = false;
} else {
// long time0 = System.currentTimeMillis();
associateL2R(left, right);
// long time1 = System.currentTimeMillis();
associateF2F();
// long time2 = System.currentTimeMillis();
cyclicConsistency();
// long time3 = System.currentTimeMillis();
if( !estimateMotion() )
return false;
// long time4 = System.currentTimeMillis();
// System.out.println("timing: "+(time1-time0)+" "+(time2-time1)+" "+(time3-time2)+" "+(time4-time3));
}
return true;
} | java | public boolean process( T left , T right ) {
if( first ) {
associateL2R(left, right);
first = false;
} else {
// long time0 = System.currentTimeMillis();
associateL2R(left, right);
// long time1 = System.currentTimeMillis();
associateF2F();
// long time2 = System.currentTimeMillis();
cyclicConsistency();
// long time3 = System.currentTimeMillis();
if( !estimateMotion() )
return false;
// long time4 = System.currentTimeMillis();
// System.out.println("timing: "+(time1-time0)+" "+(time2-time1)+" "+(time3-time2)+" "+(time4-time3));
}
return true;
} | [
"public",
"boolean",
"process",
"(",
"T",
"left",
",",
"T",
"right",
")",
"{",
"if",
"(",
"first",
")",
"{",
"associateL2R",
"(",
"left",
",",
"right",
")",
";",
"first",
"=",
"false",
";",
"}",
"else",
"{",
"//\t\t\tlong time0 = System.currentTimeMillis();",
"associateL2R",
"(",
"left",
",",
"right",
")",
";",
"//\t\t\tlong time1 = System.currentTimeMillis();",
"associateF2F",
"(",
")",
";",
"//\t\t\tlong time2 = System.currentTimeMillis();",
"cyclicConsistency",
"(",
")",
";",
"//\t\t\tlong time3 = System.currentTimeMillis();",
"if",
"(",
"!",
"estimateMotion",
"(",
")",
")",
"return",
"false",
";",
"//\t\t\tlong time4 = System.currentTimeMillis();",
"//\t\t\tSystem.out.println(\"timing: \"+(time1-time0)+\" \"+(time2-time1)+\" \"+(time3-time2)+\" \"+(time4-time3));",
"}",
"return",
"true",
";",
"}"
] | Estimates camera egomotion from the stereo pair
@param left Image from left camera
@param right Image from right camera
@return true if motion was estimated and false if not | [
"Estimates",
"camera",
"egomotion",
"from",
"the",
"stereo",
"pair"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-sfm/src/main/java/boofcv/alg/sfm/d3/VisOdomQuadPnP.java#L173-L195 |
OpenNTF/JavascriptAggregator | jaggr-core/src/main/java/com/ibm/jaggr/core/util/SignalUtil.java | SignalUtil.logWaiting | static boolean logWaiting(String callerClass, String callerMethod, Object waitObj, long start, Object... extraArgs) {
"""
Logs a warning message. If the elapsed time is greater than
{@link #SIGNAL_LOG_QUIESCE_TIMEOUT_MINUTES} then the log message will indicate that wait
logging for the thread is being quiesced, and a value of true is returned. Otherwise, false
is returned.
<p>
This is a convenience method to call
{@link #logWaiting(Logger, String, String, Object, long, Object...)} with the default logger.
@param callerClass
the class name of the caller
@param callerMethod
the method name of the caller
@param waitObj
the object that is being waited on
@param start
the time that the wait began
@param extraArgs
caller provided extra arguments
@return true if the elapsed time is greater than {@link #SIGNAL_LOG_QUIESCE_TIMEOUT_MINUTES}
"""
return logWaiting(log, callerClass, callerMethod, waitObj, start, extraArgs);
} | java | static boolean logWaiting(String callerClass, String callerMethod, Object waitObj, long start, Object... extraArgs) {
return logWaiting(log, callerClass, callerMethod, waitObj, start, extraArgs);
} | [
"static",
"boolean",
"logWaiting",
"(",
"String",
"callerClass",
",",
"String",
"callerMethod",
",",
"Object",
"waitObj",
",",
"long",
"start",
",",
"Object",
"...",
"extraArgs",
")",
"{",
"return",
"logWaiting",
"(",
"log",
",",
"callerClass",
",",
"callerMethod",
",",
"waitObj",
",",
"start",
",",
"extraArgs",
")",
";",
"}"
] | Logs a warning message. If the elapsed time is greater than
{@link #SIGNAL_LOG_QUIESCE_TIMEOUT_MINUTES} then the log message will indicate that wait
logging for the thread is being quiesced, and a value of true is returned. Otherwise, false
is returned.
<p>
This is a convenience method to call
{@link #logWaiting(Logger, String, String, Object, long, Object...)} with the default logger.
@param callerClass
the class name of the caller
@param callerMethod
the method name of the caller
@param waitObj
the object that is being waited on
@param start
the time that the wait began
@param extraArgs
caller provided extra arguments
@return true if the elapsed time is greater than {@link #SIGNAL_LOG_QUIESCE_TIMEOUT_MINUTES} | [
"Logs",
"a",
"warning",
"message",
".",
"If",
"the",
"elapsed",
"time",
"is",
"greater",
"than",
"{",
"@link",
"#SIGNAL_LOG_QUIESCE_TIMEOUT_MINUTES",
"}",
"then",
"the",
"log",
"message",
"will",
"indicate",
"that",
"wait",
"logging",
"for",
"the",
"thread",
"is",
"being",
"quiesced",
"and",
"a",
"value",
"of",
"true",
"is",
"returned",
".",
"Otherwise",
"false",
"is",
"returned",
".",
"<p",
">",
"This",
"is",
"a",
"convenience",
"method",
"to",
"call",
"{",
"@link",
"#logWaiting",
"(",
"Logger",
"String",
"String",
"Object",
"long",
"Object",
"...",
")",
"}",
"with",
"the",
"default",
"logger",
"."
] | train | https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-core/src/main/java/com/ibm/jaggr/core/util/SignalUtil.java#L98-L100 |
authorjapps/zerocode | core/src/main/java/org/jsmart/zerocode/core/httpclient/BasicHttpClient.java | BasicHttpClient.handleHttpSession | public void handleHttpSession(Response serverResponse, String headerKey) {
"""
This method handles the http session to be maintained between the calls.
In case the session is not needed or to be handled differently, then this
method can be overridden to do nothing or to roll your own feature.
@param serverResponse
@param headerKey
"""
/** ---------------
* Session handled
* ----------------
*/
if ("Set-Cookie".equals(headerKey)) {
COOKIE_JSESSIONID_VALUE = serverResponse.getMetadata().get(headerKey);
}
} | java | public void handleHttpSession(Response serverResponse, String headerKey) {
/** ---------------
* Session handled
* ----------------
*/
if ("Set-Cookie".equals(headerKey)) {
COOKIE_JSESSIONID_VALUE = serverResponse.getMetadata().get(headerKey);
}
} | [
"public",
"void",
"handleHttpSession",
"(",
"Response",
"serverResponse",
",",
"String",
"headerKey",
")",
"{",
"/** ---------------\n * Session handled\n * ----------------\n */",
"if",
"(",
"\"Set-Cookie\"",
".",
"equals",
"(",
"headerKey",
")",
")",
"{",
"COOKIE_JSESSIONID_VALUE",
"=",
"serverResponse",
".",
"getMetadata",
"(",
")",
".",
"get",
"(",
"headerKey",
")",
";",
"}",
"}"
] | This method handles the http session to be maintained between the calls.
In case the session is not needed or to be handled differently, then this
method can be overridden to do nothing or to roll your own feature.
@param serverResponse
@param headerKey | [
"This",
"method",
"handles",
"the",
"http",
"session",
"to",
"be",
"maintained",
"between",
"the",
"calls",
".",
"In",
"case",
"the",
"session",
"is",
"not",
"needed",
"or",
"to",
"be",
"handled",
"differently",
"then",
"this",
"method",
"can",
"be",
"overridden",
"to",
"do",
"nothing",
"or",
"to",
"roll",
"your",
"own",
"feature",
"."
] | train | https://github.com/authorjapps/zerocode/blob/d66a3e8778d2eb5e4f0006bfcccfc0922ceb7cef/core/src/main/java/org/jsmart/zerocode/core/httpclient/BasicHttpClient.java#L371-L379 |
Mozu/mozu-java | mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/catalog/storefront/ProductUrl.java | ProductUrl.getProductForIndexingUrl | public static MozuUrl getProductForIndexingUrl(DateTime lastModifiedDate, String productCode, Long productVersion, String responseFields) {
"""
Get Resource Url for GetProductForIndexing
@param lastModifiedDate The date when the product was last updated.
@param productCode The unique, user-defined product code of a product, used throughout to reference and associate to a product.
@param productVersion The product version.
@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/commerce/catalog/storefront/products/indexing/{productCode}?productVersion={productVersion}&lastModifiedDate={lastModifiedDate}&responseFields={responseFields}");
formatter.formatUrl("lastModifiedDate", lastModifiedDate);
formatter.formatUrl("productCode", productCode);
formatter.formatUrl("productVersion", productVersion);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java | public static MozuUrl getProductForIndexingUrl(DateTime lastModifiedDate, String productCode, Long productVersion, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/storefront/products/indexing/{productCode}?productVersion={productVersion}&lastModifiedDate={lastModifiedDate}&responseFields={responseFields}");
formatter.formatUrl("lastModifiedDate", lastModifiedDate);
formatter.formatUrl("productCode", productCode);
formatter.formatUrl("productVersion", productVersion);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | [
"public",
"static",
"MozuUrl",
"getProductForIndexingUrl",
"(",
"DateTime",
"lastModifiedDate",
",",
"String",
"productCode",
",",
"Long",
"productVersion",
",",
"String",
"responseFields",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
"(",
"\"/api/commerce/catalog/storefront/products/indexing/{productCode}?productVersion={productVersion}&lastModifiedDate={lastModifiedDate}&responseFields={responseFields}\"",
")",
";",
"formatter",
".",
"formatUrl",
"(",
"\"lastModifiedDate\"",
",",
"lastModifiedDate",
")",
";",
"formatter",
".",
"formatUrl",
"(",
"\"productCode\"",
",",
"productCode",
")",
";",
"formatter",
".",
"formatUrl",
"(",
"\"productVersion\"",
",",
"productVersion",
")",
";",
"formatter",
".",
"formatUrl",
"(",
"\"responseFields\"",
",",
"responseFields",
")",
";",
"return",
"new",
"MozuUrl",
"(",
"formatter",
".",
"getResourceUrl",
"(",
")",
",",
"MozuUrl",
".",
"UrlLocation",
".",
"TENANT_POD",
")",
";",
"}"
] | Get Resource Url for GetProductForIndexing
@param lastModifiedDate The date when the product was last updated.
@param productCode The unique, user-defined product code of a product, used throughout to reference and associate to a product.
@param productVersion The product version.
@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",
"GetProductForIndexing"
] | train | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/catalog/storefront/ProductUrl.java#L96-L104 |
jbundle/jbundle | main/msg/src/main/java/org/jbundle/main/msg/db/MessageInfo.java | MessageInfo.createNewMessage | public MessageRecordDesc createNewMessage(BaseMessage message, String strKey) {
"""
Create the message that this record describes
(in the classname field)
@returns The message or null if error.
"""
MessageRecordDesc messageData = null;
String strClassName = this.getField(MessageInfo.MESSAGE_CLASS).toString();
messageData = (MessageRecordDesc)ClassServiceUtility.getClassService().makeObjectFromClassName(strClassName);
if (messageData != null)
messageData.init(message, strKey);
return messageData;
} | java | public MessageRecordDesc createNewMessage(BaseMessage message, String strKey)
{
MessageRecordDesc messageData = null;
String strClassName = this.getField(MessageInfo.MESSAGE_CLASS).toString();
messageData = (MessageRecordDesc)ClassServiceUtility.getClassService().makeObjectFromClassName(strClassName);
if (messageData != null)
messageData.init(message, strKey);
return messageData;
} | [
"public",
"MessageRecordDesc",
"createNewMessage",
"(",
"BaseMessage",
"message",
",",
"String",
"strKey",
")",
"{",
"MessageRecordDesc",
"messageData",
"=",
"null",
";",
"String",
"strClassName",
"=",
"this",
".",
"getField",
"(",
"MessageInfo",
".",
"MESSAGE_CLASS",
")",
".",
"toString",
"(",
")",
";",
"messageData",
"=",
"(",
"MessageRecordDesc",
")",
"ClassServiceUtility",
".",
"getClassService",
"(",
")",
".",
"makeObjectFromClassName",
"(",
"strClassName",
")",
";",
"if",
"(",
"messageData",
"!=",
"null",
")",
"messageData",
".",
"init",
"(",
"message",
",",
"strKey",
")",
";",
"return",
"messageData",
";",
"}"
] | Create the message that this record describes
(in the classname field)
@returns The message or null if error. | [
"Create",
"the",
"message",
"that",
"this",
"record",
"describes",
"(",
"in",
"the",
"classname",
"field",
")"
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/msg/src/main/java/org/jbundle/main/msg/db/MessageInfo.java#L239-L247 |
Azure/azure-sdk-for-java | appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java | AppServiceEnvironmentsInner.listWorkerPoolsWithServiceResponseAsync | public Observable<ServiceResponse<Page<WorkerPoolResourceInner>>> listWorkerPoolsWithServiceResponseAsync(final String resourceGroupName, final String name) {
"""
Get all worker pools of an App Service Environment.
Get all worker pools of an App Service Environment.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param name Name of the App Service Environment.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<WorkerPoolResourceInner> object
"""
return listWorkerPoolsSinglePageAsync(resourceGroupName, name)
.concatMap(new Func1<ServiceResponse<Page<WorkerPoolResourceInner>>, Observable<ServiceResponse<Page<WorkerPoolResourceInner>>>>() {
@Override
public Observable<ServiceResponse<Page<WorkerPoolResourceInner>>> call(ServiceResponse<Page<WorkerPoolResourceInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listWorkerPoolsNextWithServiceResponseAsync(nextPageLink));
}
});
} | java | public Observable<ServiceResponse<Page<WorkerPoolResourceInner>>> listWorkerPoolsWithServiceResponseAsync(final String resourceGroupName, final String name) {
return listWorkerPoolsSinglePageAsync(resourceGroupName, name)
.concatMap(new Func1<ServiceResponse<Page<WorkerPoolResourceInner>>, Observable<ServiceResponse<Page<WorkerPoolResourceInner>>>>() {
@Override
public Observable<ServiceResponse<Page<WorkerPoolResourceInner>>> call(ServiceResponse<Page<WorkerPoolResourceInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listWorkerPoolsNextWithServiceResponseAsync(nextPageLink));
}
});
} | [
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"Page",
"<",
"WorkerPoolResourceInner",
">",
">",
">",
"listWorkerPoolsWithServiceResponseAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"name",
")",
"{",
"return",
"listWorkerPoolsSinglePageAsync",
"(",
"resourceGroupName",
",",
"name",
")",
".",
"concatMap",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"Page",
"<",
"WorkerPoolResourceInner",
">",
">",
",",
"Observable",
"<",
"ServiceResponse",
"<",
"Page",
"<",
"WorkerPoolResourceInner",
">",
">",
">",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"Page",
"<",
"WorkerPoolResourceInner",
">",
">",
">",
"call",
"(",
"ServiceResponse",
"<",
"Page",
"<",
"WorkerPoolResourceInner",
">",
">",
"page",
")",
"{",
"String",
"nextPageLink",
"=",
"page",
".",
"body",
"(",
")",
".",
"nextPageLink",
"(",
")",
";",
"if",
"(",
"nextPageLink",
"==",
"null",
")",
"{",
"return",
"Observable",
".",
"just",
"(",
"page",
")",
";",
"}",
"return",
"Observable",
".",
"just",
"(",
"page",
")",
".",
"concatWith",
"(",
"listWorkerPoolsNextWithServiceResponseAsync",
"(",
"nextPageLink",
")",
")",
";",
"}",
"}",
")",
";",
"}"
] | Get all worker pools of an App Service Environment.
Get all worker pools of an App Service Environment.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param name Name of the App Service Environment.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<WorkerPoolResourceInner> object | [
"Get",
"all",
"worker",
"pools",
"of",
"an",
"App",
"Service",
"Environment",
".",
"Get",
"all",
"worker",
"pools",
"of",
"an",
"App",
"Service",
"Environment",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java#L5023-L5035 |
openengsb/openengsb | components/edbi/jdbc/src/main/java/org/openengsb/core/edbi/jdbc/IndexRecord.java | IndexRecord.extractValue | protected Object extractValue(IndexField<?> field, OpenEngSBModelEntry entry) {
"""
Extracts the value from the given {@code OpenEngSBModelEntry} and maps that value to the given field type.
@param field the field to map to
@param entry the entry containing the value
@return the transformed (possibly) value
"""
Object value = entry.getValue();
if (value == null) {
return null;
}
if (Introspector.isModel(value)) {
return ((OpenEngSBModel) value).retrieveInternalModelId();
}
// TODO: value mapping
return value;
} | java | protected Object extractValue(IndexField<?> field, OpenEngSBModelEntry entry) {
Object value = entry.getValue();
if (value == null) {
return null;
}
if (Introspector.isModel(value)) {
return ((OpenEngSBModel) value).retrieveInternalModelId();
}
// TODO: value mapping
return value;
} | [
"protected",
"Object",
"extractValue",
"(",
"IndexField",
"<",
"?",
">",
"field",
",",
"OpenEngSBModelEntry",
"entry",
")",
"{",
"Object",
"value",
"=",
"entry",
".",
"getValue",
"(",
")",
";",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"Introspector",
".",
"isModel",
"(",
"value",
")",
")",
"{",
"return",
"(",
"(",
"OpenEngSBModel",
")",
"value",
")",
".",
"retrieveInternalModelId",
"(",
")",
";",
"}",
"// TODO: value mapping",
"return",
"value",
";",
"}"
] | Extracts the value from the given {@code OpenEngSBModelEntry} and maps that value to the given field type.
@param field the field to map to
@param entry the entry containing the value
@return the transformed (possibly) value | [
"Extracts",
"the",
"value",
"from",
"the",
"given",
"{",
"@code",
"OpenEngSBModelEntry",
"}",
"and",
"maps",
"that",
"value",
"to",
"the",
"given",
"field",
"type",
"."
] | train | https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/components/edbi/jdbc/src/main/java/org/openengsb/core/edbi/jdbc/IndexRecord.java#L69-L83 |
apache/flink | flink-core/src/main/java/org/apache/flink/core/memory/MemorySegment.java | MemorySegment.copyToUnsafe | public final void copyToUnsafe(int offset, Object target, int targetPointer, int numBytes) {
"""
Bulk copy method. Copies {@code numBytes} bytes to target unsafe object and pointer.
NOTE: This is a unsafe method, no check here, please be carefully.
@param offset The position where the bytes are started to be read from in this memory segment.
@param target The unsafe memory to copy the bytes to.
@param targetPointer The position in the target unsafe memory to copy the chunk to.
@param numBytes The number of bytes to copy.
@throws IndexOutOfBoundsException If the source segment does not contain the given number
of bytes (starting from offset).
"""
final long thisPointer = this.address + offset;
if (thisPointer + numBytes > addressLimit) {
throw new IndexOutOfBoundsException(
String.format("offset=%d, numBytes=%d, address=%d",
offset, numBytes, this.address));
}
UNSAFE.copyMemory(this.heapMemory, thisPointer, target, targetPointer, numBytes);
} | java | public final void copyToUnsafe(int offset, Object target, int targetPointer, int numBytes) {
final long thisPointer = this.address + offset;
if (thisPointer + numBytes > addressLimit) {
throw new IndexOutOfBoundsException(
String.format("offset=%d, numBytes=%d, address=%d",
offset, numBytes, this.address));
}
UNSAFE.copyMemory(this.heapMemory, thisPointer, target, targetPointer, numBytes);
} | [
"public",
"final",
"void",
"copyToUnsafe",
"(",
"int",
"offset",
",",
"Object",
"target",
",",
"int",
"targetPointer",
",",
"int",
"numBytes",
")",
"{",
"final",
"long",
"thisPointer",
"=",
"this",
".",
"address",
"+",
"offset",
";",
"if",
"(",
"thisPointer",
"+",
"numBytes",
">",
"addressLimit",
")",
"{",
"throw",
"new",
"IndexOutOfBoundsException",
"(",
"String",
".",
"format",
"(",
"\"offset=%d, numBytes=%d, address=%d\"",
",",
"offset",
",",
"numBytes",
",",
"this",
".",
"address",
")",
")",
";",
"}",
"UNSAFE",
".",
"copyMemory",
"(",
"this",
".",
"heapMemory",
",",
"thisPointer",
",",
"target",
",",
"targetPointer",
",",
"numBytes",
")",
";",
"}"
] | Bulk copy method. Copies {@code numBytes} bytes to target unsafe object and pointer.
NOTE: This is a unsafe method, no check here, please be carefully.
@param offset The position where the bytes are started to be read from in this memory segment.
@param target The unsafe memory to copy the bytes to.
@param targetPointer The position in the target unsafe memory to copy the chunk to.
@param numBytes The number of bytes to copy.
@throws IndexOutOfBoundsException If the source segment does not contain the given number
of bytes (starting from offset). | [
"Bulk",
"copy",
"method",
".",
"Copies",
"{",
"@code",
"numBytes",
"}",
"bytes",
"to",
"target",
"unsafe",
"object",
"and",
"pointer",
".",
"NOTE",
":",
"This",
"is",
"a",
"unsafe",
"method",
"no",
"check",
"here",
"please",
"be",
"carefully",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/core/memory/MemorySegment.java#L1285-L1293 |
ziccardi/jnrpe | jnrpe-lib/src/main/java/it/jnrpe/JNRPE.java | JNRPE.getServerBootstrap | private ServerBootstrap getServerBootstrap(final boolean useSSL) {
"""
Creates and returns a configured NETTY ServerBootstrap object.
@param useSSL
<code>true</code> if SSL must be used.
@return the server bootstrap object
"""
final CommandInvoker invoker = new CommandInvoker(pluginRepository, commandRepository, acceptParams, getExecutionContext());
final ServerBootstrap serverBootstrap = new ServerBootstrap();
serverBootstrap.group(bossGroup, workerGroup).channel(NioServerSocketChannel.class).childHandler(new ChannelInitializer<SocketChannel>() {
@Override
public void initChannel(final SocketChannel ch) throws Exception {
if (useSSL) {
final SSLEngine engine = getSSLEngine();
engine.setEnabledCipherSuites(engine.getSupportedCipherSuites());
engine.setUseClientMode(false);
engine.setNeedClientAuth(false);
ch.pipeline().addLast("ssl", new SslHandler(engine));
}
ch.pipeline()
.addLast(new JNRPERequestDecoder(), new JNRPEResponseEncoder(), new JNRPEServerHandler(invoker, context))
.addLast("idleStateHandler", new IdleStateHandler(readTimeout, writeTimeout, 0))
.addLast(
"jnrpeIdleStateHandler",
new JNRPEIdleStateHandler(context));
}
}).option(ChannelOption.SO_BACKLOG, maxAcceptedConnections).childOption(ChannelOption.SO_KEEPALIVE, Boolean.TRUE);
return serverBootstrap;
} | java | private ServerBootstrap getServerBootstrap(final boolean useSSL) {
final CommandInvoker invoker = new CommandInvoker(pluginRepository, commandRepository, acceptParams, getExecutionContext());
final ServerBootstrap serverBootstrap = new ServerBootstrap();
serverBootstrap.group(bossGroup, workerGroup).channel(NioServerSocketChannel.class).childHandler(new ChannelInitializer<SocketChannel>() {
@Override
public void initChannel(final SocketChannel ch) throws Exception {
if (useSSL) {
final SSLEngine engine = getSSLEngine();
engine.setEnabledCipherSuites(engine.getSupportedCipherSuites());
engine.setUseClientMode(false);
engine.setNeedClientAuth(false);
ch.pipeline().addLast("ssl", new SslHandler(engine));
}
ch.pipeline()
.addLast(new JNRPERequestDecoder(), new JNRPEResponseEncoder(), new JNRPEServerHandler(invoker, context))
.addLast("idleStateHandler", new IdleStateHandler(readTimeout, writeTimeout, 0))
.addLast(
"jnrpeIdleStateHandler",
new JNRPEIdleStateHandler(context));
}
}).option(ChannelOption.SO_BACKLOG, maxAcceptedConnections).childOption(ChannelOption.SO_KEEPALIVE, Boolean.TRUE);
return serverBootstrap;
} | [
"private",
"ServerBootstrap",
"getServerBootstrap",
"(",
"final",
"boolean",
"useSSL",
")",
"{",
"final",
"CommandInvoker",
"invoker",
"=",
"new",
"CommandInvoker",
"(",
"pluginRepository",
",",
"commandRepository",
",",
"acceptParams",
",",
"getExecutionContext",
"(",
")",
")",
";",
"final",
"ServerBootstrap",
"serverBootstrap",
"=",
"new",
"ServerBootstrap",
"(",
")",
";",
"serverBootstrap",
".",
"group",
"(",
"bossGroup",
",",
"workerGroup",
")",
".",
"channel",
"(",
"NioServerSocketChannel",
".",
"class",
")",
".",
"childHandler",
"(",
"new",
"ChannelInitializer",
"<",
"SocketChannel",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"initChannel",
"(",
"final",
"SocketChannel",
"ch",
")",
"throws",
"Exception",
"{",
"if",
"(",
"useSSL",
")",
"{",
"final",
"SSLEngine",
"engine",
"=",
"getSSLEngine",
"(",
")",
";",
"engine",
".",
"setEnabledCipherSuites",
"(",
"engine",
".",
"getSupportedCipherSuites",
"(",
")",
")",
";",
"engine",
".",
"setUseClientMode",
"(",
"false",
")",
";",
"engine",
".",
"setNeedClientAuth",
"(",
"false",
")",
";",
"ch",
".",
"pipeline",
"(",
")",
".",
"addLast",
"(",
"\"ssl\"",
",",
"new",
"SslHandler",
"(",
"engine",
")",
")",
";",
"}",
"ch",
".",
"pipeline",
"(",
")",
".",
"addLast",
"(",
"new",
"JNRPERequestDecoder",
"(",
")",
",",
"new",
"JNRPEResponseEncoder",
"(",
")",
",",
"new",
"JNRPEServerHandler",
"(",
"invoker",
",",
"context",
")",
")",
".",
"addLast",
"(",
"\"idleStateHandler\"",
",",
"new",
"IdleStateHandler",
"(",
"readTimeout",
",",
"writeTimeout",
",",
"0",
")",
")",
".",
"addLast",
"(",
"\"jnrpeIdleStateHandler\"",
",",
"new",
"JNRPEIdleStateHandler",
"(",
"context",
")",
")",
";",
"}",
"}",
")",
".",
"option",
"(",
"ChannelOption",
".",
"SO_BACKLOG",
",",
"maxAcceptedConnections",
")",
".",
"childOption",
"(",
"ChannelOption",
".",
"SO_KEEPALIVE",
",",
"Boolean",
".",
"TRUE",
")",
";",
"return",
"serverBootstrap",
";",
"}"
] | Creates and returns a configured NETTY ServerBootstrap object.
@param useSSL
<code>true</code> if SSL must be used.
@return the server bootstrap object | [
"Creates",
"and",
"returns",
"a",
"configured",
"NETTY",
"ServerBootstrap",
"object",
"."
] | train | https://github.com/ziccardi/jnrpe/blob/ac9046355851136994388442b01ba4063305f9c4/jnrpe-lib/src/main/java/it/jnrpe/JNRPE.java#L325-L352 |
aNNiMON/Lightweight-Stream-API | stream/src/main/java/com/annimon/stream/Collectors.java | Collectors.groupingBy | @NotNull
public static <T, K, D, A, M extends Map<K, D>> Collector<T, ?, M> groupingBy(
@NotNull final Function<? super T, ? extends K> classifier,
@NotNull final Supplier<M> mapFactory,
@NotNull final Collector<? super T, A, D> downstream) {
"""
Returns a {@code Collector} that performs grouping operation by given classifier.
@param <T> the type of the input elements
@param <K> the type of the keys
@param <A> the accumulation type
@param <D> the result type of downstream reduction
@param <M> the type of the resulting {@code Map}
@param classifier the classifier function
@param mapFactory a supplier function that provides new {@code Map}
@param downstream the collector of mapped elements
@return a {@code Collector}
@see #groupingBy(com.annimon.stream.function.Function)
@see #groupingBy(com.annimon.stream.function.Function, com.annimon.stream.Collector)
"""
@SuppressWarnings("unchecked")
final Function<A, A> downstreamFinisher = (Function<A, A>) downstream.finisher();
Function<Map<K, A>, M> finisher = new Function<Map<K, A>, M>() {
@NotNull
@Override
public M apply(@NotNull Map<K, A> map) {
// Update values of a map by a finisher function
for (Map.Entry<K, A> entry : map.entrySet()) {
A value = entry.getValue();
value = downstreamFinisher.apply(value);
entry.setValue(value);
}
@SuppressWarnings("unchecked")
M castedMap = (M) map;
return castedMap;
}
};
@SuppressWarnings("unchecked")
Supplier<Map<K, A>> castedMapFactory = (Supplier<Map<K, A>>) mapFactory;
return new CollectorsImpl<T, Map<K, A>, M>(
castedMapFactory,
new BiConsumer<Map<K, A>, T>() {
@Override
public void accept(@NotNull Map<K, A> map, T t) {
K key = Objects.requireNonNull(classifier.apply(t), "element cannot be mapped to a null key");
// Get container with currently grouped elements
A container = map.get(key);
if (container == null) {
// Put new container (list, map, set, etc)
container = downstream.supplier().get();
map.put(key, container);
}
// Add element to container
downstream.accumulator().accept(container, t);
}
},
finisher
);
} | java | @NotNull
public static <T, K, D, A, M extends Map<K, D>> Collector<T, ?, M> groupingBy(
@NotNull final Function<? super T, ? extends K> classifier,
@NotNull final Supplier<M> mapFactory,
@NotNull final Collector<? super T, A, D> downstream) {
@SuppressWarnings("unchecked")
final Function<A, A> downstreamFinisher = (Function<A, A>) downstream.finisher();
Function<Map<K, A>, M> finisher = new Function<Map<K, A>, M>() {
@NotNull
@Override
public M apply(@NotNull Map<K, A> map) {
// Update values of a map by a finisher function
for (Map.Entry<K, A> entry : map.entrySet()) {
A value = entry.getValue();
value = downstreamFinisher.apply(value);
entry.setValue(value);
}
@SuppressWarnings("unchecked")
M castedMap = (M) map;
return castedMap;
}
};
@SuppressWarnings("unchecked")
Supplier<Map<K, A>> castedMapFactory = (Supplier<Map<K, A>>) mapFactory;
return new CollectorsImpl<T, Map<K, A>, M>(
castedMapFactory,
new BiConsumer<Map<K, A>, T>() {
@Override
public void accept(@NotNull Map<K, A> map, T t) {
K key = Objects.requireNonNull(classifier.apply(t), "element cannot be mapped to a null key");
// Get container with currently grouped elements
A container = map.get(key);
if (container == null) {
// Put new container (list, map, set, etc)
container = downstream.supplier().get();
map.put(key, container);
}
// Add element to container
downstream.accumulator().accept(container, t);
}
},
finisher
);
} | [
"@",
"NotNull",
"public",
"static",
"<",
"T",
",",
"K",
",",
"D",
",",
"A",
",",
"M",
"extends",
"Map",
"<",
"K",
",",
"D",
">",
">",
"Collector",
"<",
"T",
",",
"?",
",",
"M",
">",
"groupingBy",
"(",
"@",
"NotNull",
"final",
"Function",
"<",
"?",
"super",
"T",
",",
"?",
"extends",
"K",
">",
"classifier",
",",
"@",
"NotNull",
"final",
"Supplier",
"<",
"M",
">",
"mapFactory",
",",
"@",
"NotNull",
"final",
"Collector",
"<",
"?",
"super",
"T",
",",
"A",
",",
"D",
">",
"downstream",
")",
"{",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"final",
"Function",
"<",
"A",
",",
"A",
">",
"downstreamFinisher",
"=",
"(",
"Function",
"<",
"A",
",",
"A",
">",
")",
"downstream",
".",
"finisher",
"(",
")",
";",
"Function",
"<",
"Map",
"<",
"K",
",",
"A",
">",
",",
"M",
">",
"finisher",
"=",
"new",
"Function",
"<",
"Map",
"<",
"K",
",",
"A",
">",
",",
"M",
">",
"(",
")",
"{",
"@",
"NotNull",
"@",
"Override",
"public",
"M",
"apply",
"(",
"@",
"NotNull",
"Map",
"<",
"K",
",",
"A",
">",
"map",
")",
"{",
"// Update values of a map by a finisher function",
"for",
"(",
"Map",
".",
"Entry",
"<",
"K",
",",
"A",
">",
"entry",
":",
"map",
".",
"entrySet",
"(",
")",
")",
"{",
"A",
"value",
"=",
"entry",
".",
"getValue",
"(",
")",
";",
"value",
"=",
"downstreamFinisher",
".",
"apply",
"(",
"value",
")",
";",
"entry",
".",
"setValue",
"(",
"value",
")",
";",
"}",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"M",
"castedMap",
"=",
"(",
"M",
")",
"map",
";",
"return",
"castedMap",
";",
"}",
"}",
";",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"Supplier",
"<",
"Map",
"<",
"K",
",",
"A",
">",
">",
"castedMapFactory",
"=",
"(",
"Supplier",
"<",
"Map",
"<",
"K",
",",
"A",
">",
">",
")",
"mapFactory",
";",
"return",
"new",
"CollectorsImpl",
"<",
"T",
",",
"Map",
"<",
"K",
",",
"A",
">",
",",
"M",
">",
"(",
"castedMapFactory",
",",
"new",
"BiConsumer",
"<",
"Map",
"<",
"K",
",",
"A",
">",
",",
"T",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"accept",
"(",
"@",
"NotNull",
"Map",
"<",
"K",
",",
"A",
">",
"map",
",",
"T",
"t",
")",
"{",
"K",
"key",
"=",
"Objects",
".",
"requireNonNull",
"(",
"classifier",
".",
"apply",
"(",
"t",
")",
",",
"\"element cannot be mapped to a null key\"",
")",
";",
"// Get container with currently grouped elements",
"A",
"container",
"=",
"map",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"container",
"==",
"null",
")",
"{",
"// Put new container (list, map, set, etc)",
"container",
"=",
"downstream",
".",
"supplier",
"(",
")",
".",
"get",
"(",
")",
";",
"map",
".",
"put",
"(",
"key",
",",
"container",
")",
";",
"}",
"// Add element to container",
"downstream",
".",
"accumulator",
"(",
")",
".",
"accept",
"(",
"container",
",",
"t",
")",
";",
"}",
"}",
",",
"finisher",
")",
";",
"}"
] | Returns a {@code Collector} that performs grouping operation by given classifier.
@param <T> the type of the input elements
@param <K> the type of the keys
@param <A> the accumulation type
@param <D> the result type of downstream reduction
@param <M> the type of the resulting {@code Map}
@param classifier the classifier function
@param mapFactory a supplier function that provides new {@code Map}
@param downstream the collector of mapped elements
@return a {@code Collector}
@see #groupingBy(com.annimon.stream.function.Function)
@see #groupingBy(com.annimon.stream.function.Function, com.annimon.stream.Collector) | [
"Returns",
"a",
"{",
"@code",
"Collector",
"}",
"that",
"performs",
"grouping",
"operation",
"by",
"given",
"classifier",
"."
] | train | https://github.com/aNNiMON/Lightweight-Stream-API/blob/f29fd57208c20252a4549b084d55ed082c3e58f0/stream/src/main/java/com/annimon/stream/Collectors.java#L939-L986 |
liferay/com-liferay-commerce | commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPMeasurementUnitPersistenceImpl.java | CPMeasurementUnitPersistenceImpl.findByG_T | @Override
public List<CPMeasurementUnit> findByG_T(long groupId, int type, int start,
int end) {
"""
Returns a range of all the cp measurement units where groupId = ? and type = ?.
<p>
Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CPMeasurementUnitModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
</p>
@param groupId the group ID
@param type the type
@param start the lower bound of the range of cp measurement units
@param end the upper bound of the range of cp measurement units (not inclusive)
@return the range of matching cp measurement units
"""
return findByG_T(groupId, type, start, end, null);
} | java | @Override
public List<CPMeasurementUnit> findByG_T(long groupId, int type, int start,
int end) {
return findByG_T(groupId, type, start, end, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CPMeasurementUnit",
">",
"findByG_T",
"(",
"long",
"groupId",
",",
"int",
"type",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"return",
"findByG_T",
"(",
"groupId",
",",
"type",
",",
"start",
",",
"end",
",",
"null",
")",
";",
"}"
] | Returns a range of all the cp measurement units where groupId = ? and type = ?.
<p>
Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CPMeasurementUnitModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
</p>
@param groupId the group ID
@param type the type
@param start the lower bound of the range of cp measurement units
@param end the upper bound of the range of cp measurement units (not inclusive)
@return the range of matching cp measurement units | [
"Returns",
"a",
"range",
"of",
"all",
"the",
"cp",
"measurement",
"units",
"where",
"groupId",
"=",
"?",
";",
"and",
"type",
"=",
"?",
";",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPMeasurementUnitPersistenceImpl.java#L2044-L2048 |
jamesagnew/hapi-fhir | hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/util/JaxRsMethodBindings.java | JaxRsMethodBindings.getMethodBindings | public static JaxRsMethodBindings getMethodBindings(AbstractJaxRsProvider theProvider, Class<? extends AbstractJaxRsProvider> theProviderClass) {
"""
Get the method bindings for the given class. If this class is not yet contained in the classBindings, they will be added for this class
@param theProvider the implementation class
@param theProviderClass the provider class
@return the methodBindings for this class
"""
if(!getClassBindings().containsKey(theProviderClass)) {
JaxRsMethodBindings foundBindings = new JaxRsMethodBindings(theProvider, theProviderClass);
getClassBindings().putIfAbsent(theProviderClass, foundBindings);
}
return getClassBindings().get(theProviderClass);
} | java | public static JaxRsMethodBindings getMethodBindings(AbstractJaxRsProvider theProvider, Class<? extends AbstractJaxRsProvider> theProviderClass) {
if(!getClassBindings().containsKey(theProviderClass)) {
JaxRsMethodBindings foundBindings = new JaxRsMethodBindings(theProvider, theProviderClass);
getClassBindings().putIfAbsent(theProviderClass, foundBindings);
}
return getClassBindings().get(theProviderClass);
} | [
"public",
"static",
"JaxRsMethodBindings",
"getMethodBindings",
"(",
"AbstractJaxRsProvider",
"theProvider",
",",
"Class",
"<",
"?",
"extends",
"AbstractJaxRsProvider",
">",
"theProviderClass",
")",
"{",
"if",
"(",
"!",
"getClassBindings",
"(",
")",
".",
"containsKey",
"(",
"theProviderClass",
")",
")",
"{",
"JaxRsMethodBindings",
"foundBindings",
"=",
"new",
"JaxRsMethodBindings",
"(",
"theProvider",
",",
"theProviderClass",
")",
";",
"getClassBindings",
"(",
")",
".",
"putIfAbsent",
"(",
"theProviderClass",
",",
"foundBindings",
")",
";",
"}",
"return",
"getClassBindings",
"(",
")",
".",
"get",
"(",
"theProviderClass",
")",
";",
"}"
] | Get the method bindings for the given class. If this class is not yet contained in the classBindings, they will be added for this class
@param theProvider the implementation class
@param theProviderClass the provider class
@return the methodBindings for this class | [
"Get",
"the",
"method",
"bindings",
"for",
"the",
"given",
"class",
".",
"If",
"this",
"class",
"is",
"not",
"yet",
"contained",
"in",
"the",
"classBindings",
"they",
"will",
"be",
"added",
"for",
"this",
"class"
] | train | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/util/JaxRsMethodBindings.java#L136-L142 |
erlang/otp | lib/jinterface/java_src/com/ericsson/otp/erlang/OtpInputStream.java | OtpInputStream.read_port | public OtpErlangPort read_port() throws OtpErlangDecodeException {
"""
Read an Erlang port from the stream.
@return the value of the port.
@exception OtpErlangDecodeException
if the next term in the stream is not an Erlang port.
"""
String node;
int id;
int creation;
int tag;
tag = read1skip_version();
if (tag != OtpExternal.portTag &&
tag != OtpExternal.newPortTag) {
throw new OtpErlangDecodeException(
"Wrong tag encountered, expected " + OtpExternal.portTag
+ " or " + OtpExternal.newPortTag
+ ", got " + tag);
}
node = read_atom();
id = read4BE();
if (tag == OtpExternal.portTag)
creation = read1();
else
creation = read4BE();
return new OtpErlangPort(tag, node, id, creation);
} | java | public OtpErlangPort read_port() throws OtpErlangDecodeException {
String node;
int id;
int creation;
int tag;
tag = read1skip_version();
if (tag != OtpExternal.portTag &&
tag != OtpExternal.newPortTag) {
throw new OtpErlangDecodeException(
"Wrong tag encountered, expected " + OtpExternal.portTag
+ " or " + OtpExternal.newPortTag
+ ", got " + tag);
}
node = read_atom();
id = read4BE();
if (tag == OtpExternal.portTag)
creation = read1();
else
creation = read4BE();
return new OtpErlangPort(tag, node, id, creation);
} | [
"public",
"OtpErlangPort",
"read_port",
"(",
")",
"throws",
"OtpErlangDecodeException",
"{",
"String",
"node",
";",
"int",
"id",
";",
"int",
"creation",
";",
"int",
"tag",
";",
"tag",
"=",
"read1skip_version",
"(",
")",
";",
"if",
"(",
"tag",
"!=",
"OtpExternal",
".",
"portTag",
"&&",
"tag",
"!=",
"OtpExternal",
".",
"newPortTag",
")",
"{",
"throw",
"new",
"OtpErlangDecodeException",
"(",
"\"Wrong tag encountered, expected \"",
"+",
"OtpExternal",
".",
"portTag",
"+",
"\" or \"",
"+",
"OtpExternal",
".",
"newPortTag",
"+",
"\", got \"",
"+",
"tag",
")",
";",
"}",
"node",
"=",
"read_atom",
"(",
")",
";",
"id",
"=",
"read4BE",
"(",
")",
";",
"if",
"(",
"tag",
"==",
"OtpExternal",
".",
"portTag",
")",
"creation",
"=",
"read1",
"(",
")",
";",
"else",
"creation",
"=",
"read4BE",
"(",
")",
";",
"return",
"new",
"OtpErlangPort",
"(",
"tag",
",",
"node",
",",
"id",
",",
"creation",
")",
";",
"}"
] | Read an Erlang port from the stream.
@return the value of the port.
@exception OtpErlangDecodeException
if the next term in the stream is not an Erlang port. | [
"Read",
"an",
"Erlang",
"port",
"from",
"the",
"stream",
"."
] | train | https://github.com/erlang/otp/blob/ac6084fd83240355f72e94adbf303e57832d1fab/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpInputStream.java#L984-L1008 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java | KeyVaultClientBaseImpl.recoverDeletedSasDefinitionAsync | public Observable<SasDefinitionBundle> recoverDeletedSasDefinitionAsync(String vaultBaseUrl, String storageAccountName, String sasDefinitionName) {
"""
Recovers the deleted SAS definition.
Recovers the deleted SAS definition for the specified storage account. This operation can only be performed on a soft-delete enabled vault. This operation requires the storage/recover permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param storageAccountName The name of the storage account.
@param sasDefinitionName The name of the SAS definition.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the SasDefinitionBundle object
"""
return recoverDeletedSasDefinitionWithServiceResponseAsync(vaultBaseUrl, storageAccountName, sasDefinitionName).map(new Func1<ServiceResponse<SasDefinitionBundle>, SasDefinitionBundle>() {
@Override
public SasDefinitionBundle call(ServiceResponse<SasDefinitionBundle> response) {
return response.body();
}
});
} | java | public Observable<SasDefinitionBundle> recoverDeletedSasDefinitionAsync(String vaultBaseUrl, String storageAccountName, String sasDefinitionName) {
return recoverDeletedSasDefinitionWithServiceResponseAsync(vaultBaseUrl, storageAccountName, sasDefinitionName).map(new Func1<ServiceResponse<SasDefinitionBundle>, SasDefinitionBundle>() {
@Override
public SasDefinitionBundle call(ServiceResponse<SasDefinitionBundle> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"SasDefinitionBundle",
">",
"recoverDeletedSasDefinitionAsync",
"(",
"String",
"vaultBaseUrl",
",",
"String",
"storageAccountName",
",",
"String",
"sasDefinitionName",
")",
"{",
"return",
"recoverDeletedSasDefinitionWithServiceResponseAsync",
"(",
"vaultBaseUrl",
",",
"storageAccountName",
",",
"sasDefinitionName",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"SasDefinitionBundle",
">",
",",
"SasDefinitionBundle",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"SasDefinitionBundle",
"call",
"(",
"ServiceResponse",
"<",
"SasDefinitionBundle",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Recovers the deleted SAS definition.
Recovers the deleted SAS definition for the specified storage account. This operation can only be performed on a soft-delete enabled vault. This operation requires the storage/recover permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param storageAccountName The name of the storage account.
@param sasDefinitionName The name of the SAS definition.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the SasDefinitionBundle object | [
"Recovers",
"the",
"deleted",
"SAS",
"definition",
".",
"Recovers",
"the",
"deleted",
"SAS",
"definition",
"for",
"the",
"specified",
"storage",
"account",
".",
"This",
"operation",
"can",
"only",
"be",
"performed",
"on",
"a",
"soft",
"-",
"delete",
"enabled",
"vault",
".",
"This",
"operation",
"requires",
"the",
"storage",
"/",
"recover",
"permission",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L11004-L11011 |
VoltDB/voltdb | src/frontend/org/voltdb/VoltProcedure.java | VoltProcedure.voltQueueSQL | public void voltQueueSQL(final SQLStmt stmt, Expectation expectation, Object... args) {
"""
<p>Queue the SQL {@link org.voltdb.SQLStmt statement} for execution with the specified argument list,
and an Expectation describing the expected results. If the Expectation is not met then VoltAbortException
will be thrown with a description of the expectation that was not met. This exception must not be
caught from within the procedure.</p>
@param stmt {@link org.voltdb.SQLStmt Statement} to queue for execution.
@param expectation Expectation describing the expected result of executing this SQL statement.
@param args List of arguments to be bound as parameters for the {@link org.voltdb.SQLStmt statement}
@see <a href="#allowable_params">List of allowable parameter types</a>
"""
m_runner.voltQueueSQL(stmt, expectation, args);
} | java | public void voltQueueSQL(final SQLStmt stmt, Expectation expectation, Object... args) {
m_runner.voltQueueSQL(stmt, expectation, args);
} | [
"public",
"void",
"voltQueueSQL",
"(",
"final",
"SQLStmt",
"stmt",
",",
"Expectation",
"expectation",
",",
"Object",
"...",
"args",
")",
"{",
"m_runner",
".",
"voltQueueSQL",
"(",
"stmt",
",",
"expectation",
",",
"args",
")",
";",
"}"
] | <p>Queue the SQL {@link org.voltdb.SQLStmt statement} for execution with the specified argument list,
and an Expectation describing the expected results. If the Expectation is not met then VoltAbortException
will be thrown with a description of the expectation that was not met. This exception must not be
caught from within the procedure.</p>
@param stmt {@link org.voltdb.SQLStmt Statement} to queue for execution.
@param expectation Expectation describing the expected result of executing this SQL statement.
@param args List of arguments to be bound as parameters for the {@link org.voltdb.SQLStmt statement}
@see <a href="#allowable_params">List of allowable parameter types</a> | [
"<p",
">",
"Queue",
"the",
"SQL",
"{",
"@link",
"org",
".",
"voltdb",
".",
"SQLStmt",
"statement",
"}",
"for",
"execution",
"with",
"the",
"specified",
"argument",
"list",
"and",
"an",
"Expectation",
"describing",
"the",
"expected",
"results",
".",
"If",
"the",
"Expectation",
"is",
"not",
"met",
"then",
"VoltAbortException",
"will",
"be",
"thrown",
"with",
"a",
"description",
"of",
"the",
"expectation",
"that",
"was",
"not",
"met",
".",
"This",
"exception",
"must",
"not",
"be",
"caught",
"from",
"within",
"the",
"procedure",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/VoltProcedure.java#L232-L234 |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/factory/filter/kernel/FactoryKernelGaussian.java | FactoryKernelGaussian.gaussian2D_F32 | public static Kernel2D_F32 gaussian2D_F32(double sigma, int radius, boolean odd, boolean normalize) {
"""
Creates a kernel for a 2D convolution. This should only be used for validation purposes.
@param sigma Distributions standard deviation.
@param radius Kernel's radius.
@param odd Does the kernel have an even or add width
@param normalize If the kernel should be normalized to one or not.
"""
Kernel1D_F32 kernel1D = gaussian1D_F32(sigma,radius, odd, false);
Kernel2D_F32 ret = KernelMath.convolve2D(kernel1D, kernel1D);
if (normalize) {
KernelMath.normalizeSumToOne(ret);
}
return ret;
} | java | public static Kernel2D_F32 gaussian2D_F32(double sigma, int radius, boolean odd, boolean normalize) {
Kernel1D_F32 kernel1D = gaussian1D_F32(sigma,radius, odd, false);
Kernel2D_F32 ret = KernelMath.convolve2D(kernel1D, kernel1D);
if (normalize) {
KernelMath.normalizeSumToOne(ret);
}
return ret;
} | [
"public",
"static",
"Kernel2D_F32",
"gaussian2D_F32",
"(",
"double",
"sigma",
",",
"int",
"radius",
",",
"boolean",
"odd",
",",
"boolean",
"normalize",
")",
"{",
"Kernel1D_F32",
"kernel1D",
"=",
"gaussian1D_F32",
"(",
"sigma",
",",
"radius",
",",
"odd",
",",
"false",
")",
";",
"Kernel2D_F32",
"ret",
"=",
"KernelMath",
".",
"convolve2D",
"(",
"kernel1D",
",",
"kernel1D",
")",
";",
"if",
"(",
"normalize",
")",
"{",
"KernelMath",
".",
"normalizeSumToOne",
"(",
"ret",
")",
";",
"}",
"return",
"ret",
";",
"}"
] | Creates a kernel for a 2D convolution. This should only be used for validation purposes.
@param sigma Distributions standard deviation.
@param radius Kernel's radius.
@param odd Does the kernel have an even or add width
@param normalize If the kernel should be normalized to one or not. | [
"Creates",
"a",
"kernel",
"for",
"a",
"2D",
"convolution",
".",
"This",
"should",
"only",
"be",
"used",
"for",
"validation",
"purposes",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/factory/filter/kernel/FactoryKernelGaussian.java#L269-L278 |
jbundle/jbundle | base/screen/view/html/src/main/java/org/jbundle/base/screen/view/html/HBasePanel.java | HBasePanel.printDataStartField | public void printDataStartField(PrintWriter out, int iPrintOptions) {
"""
Display the start form in input format.
@param out The out stream.
@param iPrintOptions The view specific attributes.
"""
if ((iPrintOptions & HtmlConstants.MAIN_SCREEN) == HtmlConstants.MAIN_SCREEN)
{
}
else
out.println("<tr>");
} | java | public void printDataStartField(PrintWriter out, int iPrintOptions)
{
if ((iPrintOptions & HtmlConstants.MAIN_SCREEN) == HtmlConstants.MAIN_SCREEN)
{
}
else
out.println("<tr>");
} | [
"public",
"void",
"printDataStartField",
"(",
"PrintWriter",
"out",
",",
"int",
"iPrintOptions",
")",
"{",
"if",
"(",
"(",
"iPrintOptions",
"&",
"HtmlConstants",
".",
"MAIN_SCREEN",
")",
"==",
"HtmlConstants",
".",
"MAIN_SCREEN",
")",
"{",
"}",
"else",
"out",
".",
"println",
"(",
"\"<tr>\"",
")",
";",
"}"
] | Display the start form in input format.
@param out The out stream.
@param iPrintOptions The view specific attributes. | [
"Display",
"the",
"start",
"form",
"in",
"input",
"format",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/view/html/src/main/java/org/jbundle/base/screen/view/html/HBasePanel.java#L574-L581 |
aws/aws-sdk-java | aws-java-sdk-marketplaceentitlement/src/main/java/com/amazonaws/services/marketplaceentitlement/model/GetEntitlementsRequest.java | GetEntitlementsRequest.setFilter | public void setFilter(java.util.Map<String, java.util.List<String>> filter) {
"""
<p>
Filter is used to return entitlements for a specific customer or for a specific dimension. Filters are described
as keys mapped to a lists of values. Filtered requests are <i>unioned</i> for each value in the value list, and
then <i>intersected</i> for each filter key.
</p>
@param filter
Filter is used to return entitlements for a specific customer or for a specific dimension. Filters are
described as keys mapped to a lists of values. Filtered requests are <i>unioned</i> for each value in the
value list, and then <i>intersected</i> for each filter key.
"""
this.filter = filter;
} | java | public void setFilter(java.util.Map<String, java.util.List<String>> filter) {
this.filter = filter;
} | [
"public",
"void",
"setFilter",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"java",
".",
"util",
".",
"List",
"<",
"String",
">",
">",
"filter",
")",
"{",
"this",
".",
"filter",
"=",
"filter",
";",
"}"
] | <p>
Filter is used to return entitlements for a specific customer or for a specific dimension. Filters are described
as keys mapped to a lists of values. Filtered requests are <i>unioned</i> for each value in the value list, and
then <i>intersected</i> for each filter key.
</p>
@param filter
Filter is used to return entitlements for a specific customer or for a specific dimension. Filters are
described as keys mapped to a lists of values. Filtered requests are <i>unioned</i> for each value in the
value list, and then <i>intersected</i> for each filter key. | [
"<p",
">",
"Filter",
"is",
"used",
"to",
"return",
"entitlements",
"for",
"a",
"specific",
"customer",
"or",
"for",
"a",
"specific",
"dimension",
".",
"Filters",
"are",
"described",
"as",
"keys",
"mapped",
"to",
"a",
"lists",
"of",
"values",
".",
"Filtered",
"requests",
"are",
"<i",
">",
"unioned<",
"/",
"i",
">",
"for",
"each",
"value",
"in",
"the",
"value",
"list",
"and",
"then",
"<i",
">",
"intersected<",
"/",
"i",
">",
"for",
"each",
"filter",
"key",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-marketplaceentitlement/src/main/java/com/amazonaws/services/marketplaceentitlement/model/GetEntitlementsRequest.java#L135-L137 |
google/closure-templates | java/src/com/google/template/soy/jbcsrc/api/SoySauceBuilder.java | SoySauceBuilder.readDelTemplatesFromMetaInf | private static ImmutableSet<String> readDelTemplatesFromMetaInf(ClassLoader loader) {
"""
Walks all resources with the META_INF_DELTEMPLATE_PATH and collects the deltemplates.
"""
try {
ImmutableSet.Builder<String> builder = ImmutableSet.builder();
Enumeration<URL> resources = loader.getResources(Names.META_INF_DELTEMPLATE_PATH);
while (resources.hasMoreElements()) {
URL url = resources.nextElement();
try (InputStream in = url.openStream()) {
BufferedReader reader = new BufferedReader(new InputStreamReader(in, UTF_8));
for (String line = reader.readLine(); line != null; line = reader.readLine()) {
builder.add(line);
}
}
}
return builder.build();
} catch (IOException iox) {
throw new RuntimeException("Unable to read deltemplate listing", iox);
}
} | java | private static ImmutableSet<String> readDelTemplatesFromMetaInf(ClassLoader loader) {
try {
ImmutableSet.Builder<String> builder = ImmutableSet.builder();
Enumeration<URL> resources = loader.getResources(Names.META_INF_DELTEMPLATE_PATH);
while (resources.hasMoreElements()) {
URL url = resources.nextElement();
try (InputStream in = url.openStream()) {
BufferedReader reader = new BufferedReader(new InputStreamReader(in, UTF_8));
for (String line = reader.readLine(); line != null; line = reader.readLine()) {
builder.add(line);
}
}
}
return builder.build();
} catch (IOException iox) {
throw new RuntimeException("Unable to read deltemplate listing", iox);
}
} | [
"private",
"static",
"ImmutableSet",
"<",
"String",
">",
"readDelTemplatesFromMetaInf",
"(",
"ClassLoader",
"loader",
")",
"{",
"try",
"{",
"ImmutableSet",
".",
"Builder",
"<",
"String",
">",
"builder",
"=",
"ImmutableSet",
".",
"builder",
"(",
")",
";",
"Enumeration",
"<",
"URL",
">",
"resources",
"=",
"loader",
".",
"getResources",
"(",
"Names",
".",
"META_INF_DELTEMPLATE_PATH",
")",
";",
"while",
"(",
"resources",
".",
"hasMoreElements",
"(",
")",
")",
"{",
"URL",
"url",
"=",
"resources",
".",
"nextElement",
"(",
")",
";",
"try",
"(",
"InputStream",
"in",
"=",
"url",
".",
"openStream",
"(",
")",
")",
"{",
"BufferedReader",
"reader",
"=",
"new",
"BufferedReader",
"(",
"new",
"InputStreamReader",
"(",
"in",
",",
"UTF_8",
")",
")",
";",
"for",
"(",
"String",
"line",
"=",
"reader",
".",
"readLine",
"(",
")",
";",
"line",
"!=",
"null",
";",
"line",
"=",
"reader",
".",
"readLine",
"(",
")",
")",
"{",
"builder",
".",
"add",
"(",
"line",
")",
";",
"}",
"}",
"}",
"return",
"builder",
".",
"build",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"iox",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"Unable to read deltemplate listing\"",
",",
"iox",
")",
";",
"}",
"}"
] | Walks all resources with the META_INF_DELTEMPLATE_PATH and collects the deltemplates. | [
"Walks",
"all",
"resources",
"with",
"the",
"META_INF_DELTEMPLATE_PATH",
"and",
"collects",
"the",
"deltemplates",
"."
] | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/api/SoySauceBuilder.java#L116-L133 |
joniles/mpxj | src/main/java/net/sf/mpxj/mpx/LocaleUtility.java | LocaleUtility.setLocale | public static void setLocale(ProjectProperties properties, Locale locale) {
"""
This method is called when the locale of the parent file is updated.
It resets the locale specific currency attributes to the default values
for the new locale.
@param properties project properties
@param locale new locale
"""
properties.setMpxDelimiter(LocaleData.getChar(locale, LocaleData.FILE_DELIMITER));
properties.setMpxProgramName(LocaleData.getString(locale, LocaleData.PROGRAM_NAME));
properties.setMpxCodePage((CodePage) LocaleData.getObject(locale, LocaleData.CODE_PAGE));
properties.setCurrencySymbol(LocaleData.getString(locale, LocaleData.CURRENCY_SYMBOL));
properties.setSymbolPosition((CurrencySymbolPosition) LocaleData.getObject(locale, LocaleData.CURRENCY_SYMBOL_POSITION));
properties.setCurrencyDigits(LocaleData.getInteger(locale, LocaleData.CURRENCY_DIGITS));
properties.setThousandsSeparator(LocaleData.getChar(locale, LocaleData.CURRENCY_THOUSANDS_SEPARATOR));
properties.setDecimalSeparator(LocaleData.getChar(locale, LocaleData.CURRENCY_DECIMAL_SEPARATOR));
properties.setDateOrder((DateOrder) LocaleData.getObject(locale, LocaleData.DATE_ORDER));
properties.setTimeFormat((ProjectTimeFormat) LocaleData.getObject(locale, LocaleData.TIME_FORMAT));
properties.setDefaultStartTime(DateHelper.getTimeFromMinutesPastMidnight(LocaleData.getInteger(locale, LocaleData.DEFAULT_START_TIME)));
properties.setDateSeparator(LocaleData.getChar(locale, LocaleData.DATE_SEPARATOR));
properties.setTimeSeparator(LocaleData.getChar(locale, LocaleData.TIME_SEPARATOR));
properties.setAMText(LocaleData.getString(locale, LocaleData.AM_TEXT));
properties.setPMText(LocaleData.getString(locale, LocaleData.PM_TEXT));
properties.setDateFormat((ProjectDateFormat) LocaleData.getObject(locale, LocaleData.DATE_FORMAT));
properties.setBarTextDateFormat((ProjectDateFormat) LocaleData.getObject(locale, LocaleData.DATE_FORMAT));
} | java | public static void setLocale(ProjectProperties properties, Locale locale)
{
properties.setMpxDelimiter(LocaleData.getChar(locale, LocaleData.FILE_DELIMITER));
properties.setMpxProgramName(LocaleData.getString(locale, LocaleData.PROGRAM_NAME));
properties.setMpxCodePage((CodePage) LocaleData.getObject(locale, LocaleData.CODE_PAGE));
properties.setCurrencySymbol(LocaleData.getString(locale, LocaleData.CURRENCY_SYMBOL));
properties.setSymbolPosition((CurrencySymbolPosition) LocaleData.getObject(locale, LocaleData.CURRENCY_SYMBOL_POSITION));
properties.setCurrencyDigits(LocaleData.getInteger(locale, LocaleData.CURRENCY_DIGITS));
properties.setThousandsSeparator(LocaleData.getChar(locale, LocaleData.CURRENCY_THOUSANDS_SEPARATOR));
properties.setDecimalSeparator(LocaleData.getChar(locale, LocaleData.CURRENCY_DECIMAL_SEPARATOR));
properties.setDateOrder((DateOrder) LocaleData.getObject(locale, LocaleData.DATE_ORDER));
properties.setTimeFormat((ProjectTimeFormat) LocaleData.getObject(locale, LocaleData.TIME_FORMAT));
properties.setDefaultStartTime(DateHelper.getTimeFromMinutesPastMidnight(LocaleData.getInteger(locale, LocaleData.DEFAULT_START_TIME)));
properties.setDateSeparator(LocaleData.getChar(locale, LocaleData.DATE_SEPARATOR));
properties.setTimeSeparator(LocaleData.getChar(locale, LocaleData.TIME_SEPARATOR));
properties.setAMText(LocaleData.getString(locale, LocaleData.AM_TEXT));
properties.setPMText(LocaleData.getString(locale, LocaleData.PM_TEXT));
properties.setDateFormat((ProjectDateFormat) LocaleData.getObject(locale, LocaleData.DATE_FORMAT));
properties.setBarTextDateFormat((ProjectDateFormat) LocaleData.getObject(locale, LocaleData.DATE_FORMAT));
} | [
"public",
"static",
"void",
"setLocale",
"(",
"ProjectProperties",
"properties",
",",
"Locale",
"locale",
")",
"{",
"properties",
".",
"setMpxDelimiter",
"(",
"LocaleData",
".",
"getChar",
"(",
"locale",
",",
"LocaleData",
".",
"FILE_DELIMITER",
")",
")",
";",
"properties",
".",
"setMpxProgramName",
"(",
"LocaleData",
".",
"getString",
"(",
"locale",
",",
"LocaleData",
".",
"PROGRAM_NAME",
")",
")",
";",
"properties",
".",
"setMpxCodePage",
"(",
"(",
"CodePage",
")",
"LocaleData",
".",
"getObject",
"(",
"locale",
",",
"LocaleData",
".",
"CODE_PAGE",
")",
")",
";",
"properties",
".",
"setCurrencySymbol",
"(",
"LocaleData",
".",
"getString",
"(",
"locale",
",",
"LocaleData",
".",
"CURRENCY_SYMBOL",
")",
")",
";",
"properties",
".",
"setSymbolPosition",
"(",
"(",
"CurrencySymbolPosition",
")",
"LocaleData",
".",
"getObject",
"(",
"locale",
",",
"LocaleData",
".",
"CURRENCY_SYMBOL_POSITION",
")",
")",
";",
"properties",
".",
"setCurrencyDigits",
"(",
"LocaleData",
".",
"getInteger",
"(",
"locale",
",",
"LocaleData",
".",
"CURRENCY_DIGITS",
")",
")",
";",
"properties",
".",
"setThousandsSeparator",
"(",
"LocaleData",
".",
"getChar",
"(",
"locale",
",",
"LocaleData",
".",
"CURRENCY_THOUSANDS_SEPARATOR",
")",
")",
";",
"properties",
".",
"setDecimalSeparator",
"(",
"LocaleData",
".",
"getChar",
"(",
"locale",
",",
"LocaleData",
".",
"CURRENCY_DECIMAL_SEPARATOR",
")",
")",
";",
"properties",
".",
"setDateOrder",
"(",
"(",
"DateOrder",
")",
"LocaleData",
".",
"getObject",
"(",
"locale",
",",
"LocaleData",
".",
"DATE_ORDER",
")",
")",
";",
"properties",
".",
"setTimeFormat",
"(",
"(",
"ProjectTimeFormat",
")",
"LocaleData",
".",
"getObject",
"(",
"locale",
",",
"LocaleData",
".",
"TIME_FORMAT",
")",
")",
";",
"properties",
".",
"setDefaultStartTime",
"(",
"DateHelper",
".",
"getTimeFromMinutesPastMidnight",
"(",
"LocaleData",
".",
"getInteger",
"(",
"locale",
",",
"LocaleData",
".",
"DEFAULT_START_TIME",
")",
")",
")",
";",
"properties",
".",
"setDateSeparator",
"(",
"LocaleData",
".",
"getChar",
"(",
"locale",
",",
"LocaleData",
".",
"DATE_SEPARATOR",
")",
")",
";",
"properties",
".",
"setTimeSeparator",
"(",
"LocaleData",
".",
"getChar",
"(",
"locale",
",",
"LocaleData",
".",
"TIME_SEPARATOR",
")",
")",
";",
"properties",
".",
"setAMText",
"(",
"LocaleData",
".",
"getString",
"(",
"locale",
",",
"LocaleData",
".",
"AM_TEXT",
")",
")",
";",
"properties",
".",
"setPMText",
"(",
"LocaleData",
".",
"getString",
"(",
"locale",
",",
"LocaleData",
".",
"PM_TEXT",
")",
")",
";",
"properties",
".",
"setDateFormat",
"(",
"(",
"ProjectDateFormat",
")",
"LocaleData",
".",
"getObject",
"(",
"locale",
",",
"LocaleData",
".",
"DATE_FORMAT",
")",
")",
";",
"properties",
".",
"setBarTextDateFormat",
"(",
"(",
"ProjectDateFormat",
")",
"LocaleData",
".",
"getObject",
"(",
"locale",
",",
"LocaleData",
".",
"DATE_FORMAT",
")",
")",
";",
"}"
] | This method is called when the locale of the parent file is updated.
It resets the locale specific currency attributes to the default values
for the new locale.
@param properties project properties
@param locale new locale | [
"This",
"method",
"is",
"called",
"when",
"the",
"locale",
"of",
"the",
"parent",
"file",
"is",
"updated",
".",
"It",
"resets",
"the",
"locale",
"specific",
"currency",
"attributes",
"to",
"the",
"default",
"values",
"for",
"the",
"new",
"locale",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/LocaleUtility.java#L58-L79 |
rampatra/jbot | jbot-example/src/main/java/example/jbot/slack/SlackBot.java | SlackBot.onReceiveDM | @Controller(events = {
"""
Invoked when the bot receives a direct mention (@botname: message)
or a direct message. NOTE: These two event types are added by jbot
to make your task easier, Slack doesn't have any direct way to
determine these type of events.
@param session
@param event
"""EventType.DIRECT_MENTION, EventType.DIRECT_MESSAGE})
public void onReceiveDM(WebSocketSession session, Event event) {
reply(session, event, "Hi, I am " + slackService.getCurrentUser().getName());
} | java | @Controller(events = {EventType.DIRECT_MENTION, EventType.DIRECT_MESSAGE})
public void onReceiveDM(WebSocketSession session, Event event) {
reply(session, event, "Hi, I am " + slackService.getCurrentUser().getName());
} | [
"@",
"Controller",
"(",
"events",
"=",
"{",
"EventType",
".",
"DIRECT_MENTION",
",",
"EventType",
".",
"DIRECT_MESSAGE",
"}",
")",
"public",
"void",
"onReceiveDM",
"(",
"WebSocketSession",
"session",
",",
"Event",
"event",
")",
"{",
"reply",
"(",
"session",
",",
"event",
",",
"\"Hi, I am \"",
"+",
"slackService",
".",
"getCurrentUser",
"(",
")",
".",
"getName",
"(",
")",
")",
";",
"}"
] | Invoked when the bot receives a direct mention (@botname: message)
or a direct message. NOTE: These two event types are added by jbot
to make your task easier, Slack doesn't have any direct way to
determine these type of events.
@param session
@param event | [
"Invoked",
"when",
"the",
"bot",
"receives",
"a",
"direct",
"mention",
"(",
"@botname",
":",
"message",
")",
"or",
"a",
"direct",
"message",
".",
"NOTE",
":",
"These",
"two",
"event",
"types",
"are",
"added",
"by",
"jbot",
"to",
"make",
"your",
"task",
"easier",
"Slack",
"doesn",
"t",
"have",
"any",
"direct",
"way",
"to",
"determine",
"these",
"type",
"of",
"events",
"."
] | train | https://github.com/rampatra/jbot/blob/0f42e1a6ec4dcbc5d1257e1307704903e771f7b5/jbot-example/src/main/java/example/jbot/slack/SlackBot.java#L56-L59 |
nguillaumin/slick2d-maven | slick2d-core/src/main/java/org/newdawn/slick/Graphics.java | Graphics.clearAlphaMap | public void clearAlphaMap() {
"""
Clear the state of the alpha map across the entire screen. This sets
alpha to 0 everywhere, meaning in {@link Graphics#MODE_ALPHA_BLEND}
nothing will be drawn.
"""
pushTransform();
GL.glLoadIdentity();
int originalMode = currentDrawingMode;
setDrawMode(MODE_ALPHA_MAP);
setColor(new Color(0,0,0,0));
fillRect(0, 0, screenWidth, screenHeight);
setColor(currentColor);
setDrawMode(originalMode);
popTransform();
} | java | public void clearAlphaMap() {
pushTransform();
GL.glLoadIdentity();
int originalMode = currentDrawingMode;
setDrawMode(MODE_ALPHA_MAP);
setColor(new Color(0,0,0,0));
fillRect(0, 0, screenWidth, screenHeight);
setColor(currentColor);
setDrawMode(originalMode);
popTransform();
} | [
"public",
"void",
"clearAlphaMap",
"(",
")",
"{",
"pushTransform",
"(",
")",
";",
"GL",
".",
"glLoadIdentity",
"(",
")",
";",
"int",
"originalMode",
"=",
"currentDrawingMode",
";",
"setDrawMode",
"(",
"MODE_ALPHA_MAP",
")",
";",
"setColor",
"(",
"new",
"Color",
"(",
"0",
",",
"0",
",",
"0",
",",
"0",
")",
")",
";",
"fillRect",
"(",
"0",
",",
"0",
",",
"screenWidth",
",",
"screenHeight",
")",
";",
"setColor",
"(",
"currentColor",
")",
";",
"setDrawMode",
"(",
"originalMode",
")",
";",
"popTransform",
"(",
")",
";",
"}"
] | Clear the state of the alpha map across the entire screen. This sets
alpha to 0 everywhere, meaning in {@link Graphics#MODE_ALPHA_BLEND}
nothing will be drawn. | [
"Clear",
"the",
"state",
"of",
"the",
"alpha",
"map",
"across",
"the",
"entire",
"screen",
".",
"This",
"sets",
"alpha",
"to",
"0",
"everywhere",
"meaning",
"in",
"{"
] | train | https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Graphics.java#L218-L230 |
ops4j/org.ops4j.pax.logging | pax-logging-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java | PropertiesUtil.getBooleanProperty | public boolean getBooleanProperty(final String name, final boolean defaultValue) {
"""
Gets the named property as a boolean value.
@param name the name of the property to look up
@param defaultValue the default value to use if the property is undefined
@return the boolean value of the property or {@code defaultValue} if undefined.
"""
final String prop = getStringProperty(name);
return prop == null ? defaultValue : "true".equalsIgnoreCase(prop);
} | java | public boolean getBooleanProperty(final String name, final boolean defaultValue) {
final String prop = getStringProperty(name);
return prop == null ? defaultValue : "true".equalsIgnoreCase(prop);
} | [
"public",
"boolean",
"getBooleanProperty",
"(",
"final",
"String",
"name",
",",
"final",
"boolean",
"defaultValue",
")",
"{",
"final",
"String",
"prop",
"=",
"getStringProperty",
"(",
"name",
")",
";",
"return",
"prop",
"==",
"null",
"?",
"defaultValue",
":",
"\"true\"",
".",
"equalsIgnoreCase",
"(",
"prop",
")",
";",
"}"
] | Gets the named property as a boolean value.
@param name the name of the property to look up
@param defaultValue the default value to use if the property is undefined
@return the boolean value of the property or {@code defaultValue} if undefined. | [
"Gets",
"the",
"named",
"property",
"as",
"a",
"boolean",
"value",
"."
] | train | https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java#L132-L135 |
xmlet/XsdAsmFaster | src/main/java/org/xmlet/xsdasmfaster/classes/XsdAsmInterfaces.java | XsdAsmInterfaces.createElementsForSequence | private void createElementsForSequence(String className, String typeName, String nextTypeName, String apiName, List<XsdElement> sequenceElements) {
"""
Creates the inner classes that are used to support the sequence behaviour and the respective sequence methods.
@param className The name of the class which contains the sequence.
@param typeName The name of the next type to return.
@param apiName The name of the generated fluent interface.
@param nextTypeName The nextTypeName of the element that will implement the sequence.
@param sequenceElements The elements that serves as base to create this interface.
"""
ClassWriter classWriter = generateInnerSequenceClass(typeName, className, apiName);
sequenceElements.forEach(sequenceElement ->
generateSequenceMethod(classWriter, className, getJavaType(sequenceElement.getType()), getCleanName(sequenceElement.getName()), typeName, nextTypeName, apiName));
sequenceElements.forEach(element -> createElement(element, apiName));
addToCreateElements(typeName);
writeClassToFile(typeName, classWriter, apiName);
} | java | private void createElementsForSequence(String className, String typeName, String nextTypeName, String apiName, List<XsdElement> sequenceElements) {
ClassWriter classWriter = generateInnerSequenceClass(typeName, className, apiName);
sequenceElements.forEach(sequenceElement ->
generateSequenceMethod(classWriter, className, getJavaType(sequenceElement.getType()), getCleanName(sequenceElement.getName()), typeName, nextTypeName, apiName));
sequenceElements.forEach(element -> createElement(element, apiName));
addToCreateElements(typeName);
writeClassToFile(typeName, classWriter, apiName);
} | [
"private",
"void",
"createElementsForSequence",
"(",
"String",
"className",
",",
"String",
"typeName",
",",
"String",
"nextTypeName",
",",
"String",
"apiName",
",",
"List",
"<",
"XsdElement",
">",
"sequenceElements",
")",
"{",
"ClassWriter",
"classWriter",
"=",
"generateInnerSequenceClass",
"(",
"typeName",
",",
"className",
",",
"apiName",
")",
";",
"sequenceElements",
".",
"forEach",
"(",
"sequenceElement",
"->",
"generateSequenceMethod",
"(",
"classWriter",
",",
"className",
",",
"getJavaType",
"(",
"sequenceElement",
".",
"getType",
"(",
")",
")",
",",
"getCleanName",
"(",
"sequenceElement",
".",
"getName",
"(",
")",
")",
",",
"typeName",
",",
"nextTypeName",
",",
"apiName",
")",
")",
";",
"sequenceElements",
".",
"forEach",
"(",
"element",
"->",
"createElement",
"(",
"element",
",",
"apiName",
")",
")",
";",
"addToCreateElements",
"(",
"typeName",
")",
";",
"writeClassToFile",
"(",
"typeName",
",",
"classWriter",
",",
"apiName",
")",
";",
"}"
] | Creates the inner classes that are used to support the sequence behaviour and the respective sequence methods.
@param className The name of the class which contains the sequence.
@param typeName The name of the next type to return.
@param apiName The name of the generated fluent interface.
@param nextTypeName The nextTypeName of the element that will implement the sequence.
@param sequenceElements The elements that serves as base to create this interface. | [
"Creates",
"the",
"inner",
"classes",
"that",
"are",
"used",
"to",
"support",
"the",
"sequence",
"behaviour",
"and",
"the",
"respective",
"sequence",
"methods",
"."
] | train | https://github.com/xmlet/XsdAsmFaster/blob/ccb78f9dd4b957ad5ac1ca349eaf24338c421e94/src/main/java/org/xmlet/xsdasmfaster/classes/XsdAsmInterfaces.java#L481-L492 |
BranchMetrics/android-branch-deep-linking | Branch-SDK/src/io/branch/referral/Branch.java | Branch.initSession | public boolean initSession(BranchReferralInitListener callback, boolean isReferrable, Activity activity) {
"""
<p>Initialises a session with the Branch API.</p>
@param callback A {@link BranchReferralInitListener} instance that will be called
following successful (or unsuccessful) initialisation of the session
with the Branch API.
@param isReferrable A {@link Boolean} value indicating whether this initialisation
session should be considered as potentially referrable or not.
By default, a user is only referrable if initSession results in a
fresh install. Overriding this gives you control of who is referrable.
@param activity The calling {@link Activity} for context.
@return A {@link Boolean} value that returns <i>false</i> if unsuccessful.
"""
initUserSessionInternal(callback, activity, isReferrable);
return true;
} | java | public boolean initSession(BranchReferralInitListener callback, boolean isReferrable, Activity activity) {
initUserSessionInternal(callback, activity, isReferrable);
return true;
} | [
"public",
"boolean",
"initSession",
"(",
"BranchReferralInitListener",
"callback",
",",
"boolean",
"isReferrable",
",",
"Activity",
"activity",
")",
"{",
"initUserSessionInternal",
"(",
"callback",
",",
"activity",
",",
"isReferrable",
")",
";",
"return",
"true",
";",
"}"
] | <p>Initialises a session with the Branch API.</p>
@param callback A {@link BranchReferralInitListener} instance that will be called
following successful (or unsuccessful) initialisation of the session
with the Branch API.
@param isReferrable A {@link Boolean} value indicating whether this initialisation
session should be considered as potentially referrable or not.
By default, a user is only referrable if initSession results in a
fresh install. Overriding this gives you control of who is referrable.
@param activity The calling {@link Activity} for context.
@return A {@link Boolean} value that returns <i>false</i> if unsuccessful. | [
"<p",
">",
"Initialises",
"a",
"session",
"with",
"the",
"Branch",
"API",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/BranchMetrics/android-branch-deep-linking/blob/e3bee2ccfcbf6d4bf1a5815b5b86666e4ff8f848/Branch-SDK/src/io/branch/referral/Branch.java#L1329-L1332 |
geomajas/geomajas-project-client-gwt | client/src/main/java/org/geomajas/gwt/client/widget/attribute/DefaultFeatureForm.java | DefaultFeatureForm.setValue | public void setValue(String name, BooleanAttribute attribute) {
"""
Apply a boolean attribute value on the form, with the given name.
@param name attribute name
@param attribute attribute value
@since 1.11.1
"""
FormItem item = formWidget.getField(name);
if (item != null) {
item.setValue(attribute.getValue());
}
} | java | public void setValue(String name, BooleanAttribute attribute) {
FormItem item = formWidget.getField(name);
if (item != null) {
item.setValue(attribute.getValue());
}
} | [
"public",
"void",
"setValue",
"(",
"String",
"name",
",",
"BooleanAttribute",
"attribute",
")",
"{",
"FormItem",
"item",
"=",
"formWidget",
".",
"getField",
"(",
"name",
")",
";",
"if",
"(",
"item",
"!=",
"null",
")",
"{",
"item",
".",
"setValue",
"(",
"attribute",
".",
"getValue",
"(",
")",
")",
";",
"}",
"}"
] | Apply a boolean attribute value on the form, with the given name.
@param name attribute name
@param attribute attribute value
@since 1.11.1 | [
"Apply",
"a",
"boolean",
"attribute",
"value",
"on",
"the",
"form",
"with",
"the",
"given",
"name",
"."
] | train | https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/widget/attribute/DefaultFeatureForm.java#L483-L488 |
interedition/collatex | collatex-core/src/main/java/eu/interedition/collatex/suffixarray/BPR.java | BPR.buildSuffixArray | @Override
public int[] buildSuffixArray(int[] input, int start, int length) {
"""
{@inheritDoc}
<p>
Additional constraints enforced by BPR algorithm:
<ul>
<li>input array must contain at least {@link #KBS_STRING_EXTENSION_SIZE} extra
cells</li>
<li>non-negative (≥0) symbols in the input</li>
<li>symbols limited by {@link #KBS_MAX_ALPHABET_SIZE} (<
<code>KBS_MAX_ALPHABET_SIZE</code>)</li>
<li>length ≥ 2</li>
</ul>
<p>
"""
Tools.assertAlways(input != null, "input must not be null");
Tools.assertAlways(input.length >= start + length + KBS_STRING_EXTENSION_SIZE,
"input is too short");
Tools.assertAlways(length >= 2, "input length must be >= 2");
this.start = start;
if (preserveInput) {
seq = new int[length + KBS_STRING_EXTENSION_SIZE];
this.start = 0;
System.arraycopy(input, start, seq, 0, length);
} else {
seq = input;
}
this.alphabet = new Alphabet(seq, length);
this.length = length;
int alphaSize = alphabet.size;
int q;
if (alphaSize <= 9) {
q = 7;
} else if (9 < alphaSize && alphaSize <= 13) {
q = 6;
} else if (13 < alphaSize && alphaSize <= 21) {
q = 5;
} else if (21 < alphaSize && alphaSize <= 46) {
q = 4;
} else {
q = 3;
}
kbs_buildDstepUsePrePlusCopyFreqOrder_SuffixArray(q);
return suffixArray;
} | java | @Override
public int[] buildSuffixArray(int[] input, int start, int length) {
Tools.assertAlways(input != null, "input must not be null");
Tools.assertAlways(input.length >= start + length + KBS_STRING_EXTENSION_SIZE,
"input is too short");
Tools.assertAlways(length >= 2, "input length must be >= 2");
this.start = start;
if (preserveInput) {
seq = new int[length + KBS_STRING_EXTENSION_SIZE];
this.start = 0;
System.arraycopy(input, start, seq, 0, length);
} else {
seq = input;
}
this.alphabet = new Alphabet(seq, length);
this.length = length;
int alphaSize = alphabet.size;
int q;
if (alphaSize <= 9) {
q = 7;
} else if (9 < alphaSize && alphaSize <= 13) {
q = 6;
} else if (13 < alphaSize && alphaSize <= 21) {
q = 5;
} else if (21 < alphaSize && alphaSize <= 46) {
q = 4;
} else {
q = 3;
}
kbs_buildDstepUsePrePlusCopyFreqOrder_SuffixArray(q);
return suffixArray;
} | [
"@",
"Override",
"public",
"int",
"[",
"]",
"buildSuffixArray",
"(",
"int",
"[",
"]",
"input",
",",
"int",
"start",
",",
"int",
"length",
")",
"{",
"Tools",
".",
"assertAlways",
"(",
"input",
"!=",
"null",
",",
"\"input must not be null\"",
")",
";",
"Tools",
".",
"assertAlways",
"(",
"input",
".",
"length",
">=",
"start",
"+",
"length",
"+",
"KBS_STRING_EXTENSION_SIZE",
",",
"\"input is too short\"",
")",
";",
"Tools",
".",
"assertAlways",
"(",
"length",
">=",
"2",
",",
"\"input length must be >= 2\"",
")",
";",
"this",
".",
"start",
"=",
"start",
";",
"if",
"(",
"preserveInput",
")",
"{",
"seq",
"=",
"new",
"int",
"[",
"length",
"+",
"KBS_STRING_EXTENSION_SIZE",
"]",
";",
"this",
".",
"start",
"=",
"0",
";",
"System",
".",
"arraycopy",
"(",
"input",
",",
"start",
",",
"seq",
",",
"0",
",",
"length",
")",
";",
"}",
"else",
"{",
"seq",
"=",
"input",
";",
"}",
"this",
".",
"alphabet",
"=",
"new",
"Alphabet",
"(",
"seq",
",",
"length",
")",
";",
"this",
".",
"length",
"=",
"length",
";",
"int",
"alphaSize",
"=",
"alphabet",
".",
"size",
";",
"int",
"q",
";",
"if",
"(",
"alphaSize",
"<=",
"9",
")",
"{",
"q",
"=",
"7",
";",
"}",
"else",
"if",
"(",
"9",
"<",
"alphaSize",
"&&",
"alphaSize",
"<=",
"13",
")",
"{",
"q",
"=",
"6",
";",
"}",
"else",
"if",
"(",
"13",
"<",
"alphaSize",
"&&",
"alphaSize",
"<=",
"21",
")",
"{",
"q",
"=",
"5",
";",
"}",
"else",
"if",
"(",
"21",
"<",
"alphaSize",
"&&",
"alphaSize",
"<=",
"46",
")",
"{",
"q",
"=",
"4",
";",
"}",
"else",
"{",
"q",
"=",
"3",
";",
"}",
"kbs_buildDstepUsePrePlusCopyFreqOrder_SuffixArray",
"(",
"q",
")",
";",
"return",
"suffixArray",
";",
"}"
] | {@inheritDoc}
<p>
Additional constraints enforced by BPR algorithm:
<ul>
<li>input array must contain at least {@link #KBS_STRING_EXTENSION_SIZE} extra
cells</li>
<li>non-negative (≥0) symbols in the input</li>
<li>symbols limited by {@link #KBS_MAX_ALPHABET_SIZE} (<
<code>KBS_MAX_ALPHABET_SIZE</code>)</li>
<li>length ≥ 2</li>
</ul>
<p> | [
"{"
] | train | https://github.com/interedition/collatex/blob/76dd1fcc36047bc66a87d31142e72e98b5347821/collatex-core/src/main/java/eu/interedition/collatex/suffixarray/BPR.java#L99-L135 |
moparisthebest/beehive | beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/scoping/ScopedServletUtils.java | ScopedServletUtils.getRelativeURI | public static final String getRelativeURI( HttpServletRequest request, String uri ) {
"""
Get a URI relative to the webapp root.
@param request the current HttpServletRequest.
@param uri the URI which should be made relative.
"""
return getRelativeURI( request.getContextPath(), uri );
} | java | public static final String getRelativeURI( HttpServletRequest request, String uri )
{
return getRelativeURI( request.getContextPath(), uri );
} | [
"public",
"static",
"final",
"String",
"getRelativeURI",
"(",
"HttpServletRequest",
"request",
",",
"String",
"uri",
")",
"{",
"return",
"getRelativeURI",
"(",
"request",
".",
"getContextPath",
"(",
")",
",",
"uri",
")",
";",
"}"
] | Get a URI relative to the webapp root.
@param request the current HttpServletRequest.
@param uri the URI which should be made relative. | [
"Get",
"a",
"URI",
"relative",
"to",
"the",
"webapp",
"root",
"."
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/scoping/ScopedServletUtils.java#L384-L387 |
SonarSource/sonarqube | server/sonar-db-dao/src/main/java/org/sonar/db/alm/ProjectAlmBindingDao.java | ProjectAlmBindingDao.selectByRepoIds | public List<ProjectAlmBindingDto> selectByRepoIds(final DbSession session, ALM alm, Collection<String> repoIds) {
"""
Gets a list of bindings by their repo_id. The result does NOT contain {@code null} values for bindings not found, so
the size of result may be less than the number of ids.
<p>Results may be in a different order as input ids.</p>
"""
return executeLargeInputs(repoIds, partitionedIds -> getMapper(session).selectByRepoIds(alm.getId(), partitionedIds));
} | java | public List<ProjectAlmBindingDto> selectByRepoIds(final DbSession session, ALM alm, Collection<String> repoIds) {
return executeLargeInputs(repoIds, partitionedIds -> getMapper(session).selectByRepoIds(alm.getId(), partitionedIds));
} | [
"public",
"List",
"<",
"ProjectAlmBindingDto",
">",
"selectByRepoIds",
"(",
"final",
"DbSession",
"session",
",",
"ALM",
"alm",
",",
"Collection",
"<",
"String",
">",
"repoIds",
")",
"{",
"return",
"executeLargeInputs",
"(",
"repoIds",
",",
"partitionedIds",
"->",
"getMapper",
"(",
"session",
")",
".",
"selectByRepoIds",
"(",
"alm",
".",
"getId",
"(",
")",
",",
"partitionedIds",
")",
")",
";",
"}"
] | Gets a list of bindings by their repo_id. The result does NOT contain {@code null} values for bindings not found, so
the size of result may be less than the number of ids.
<p>Results may be in a different order as input ids.</p> | [
"Gets",
"a",
"list",
"of",
"bindings",
"by",
"their",
"repo_id",
".",
"The",
"result",
"does",
"NOT",
"contain",
"{"
] | train | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-db-dao/src/main/java/org/sonar/db/alm/ProjectAlmBindingDao.java#L69-L71 |
EdwardRaff/JSAT | JSAT/src/jsat/classifiers/linear/NHERD.java | NHERD.setC | public void setC(double C) {
"""
Set the aggressiveness parameter. Increasing the value of this parameter
increases the aggressiveness of the algorithm. It must be a positive
value. This parameter essentially performs a type of regularization on
the updates
@param C the positive aggressiveness parameter
"""
if(Double.isNaN(C) || Double.isInfinite(C) || C <= 0)
throw new IllegalArgumentException("C must be a postive constant, not " + C);
this.C = C;
} | java | public void setC(double C)
{
if(Double.isNaN(C) || Double.isInfinite(C) || C <= 0)
throw new IllegalArgumentException("C must be a postive constant, not " + C);
this.C = C;
} | [
"public",
"void",
"setC",
"(",
"double",
"C",
")",
"{",
"if",
"(",
"Double",
".",
"isNaN",
"(",
"C",
")",
"||",
"Double",
".",
"isInfinite",
"(",
"C",
")",
"||",
"C",
"<=",
"0",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"C must be a postive constant, not \"",
"+",
"C",
")",
";",
"this",
".",
"C",
"=",
"C",
";",
"}"
] | Set the aggressiveness parameter. Increasing the value of this parameter
increases the aggressiveness of the algorithm. It must be a positive
value. This parameter essentially performs a type of regularization on
the updates
@param C the positive aggressiveness parameter | [
"Set",
"the",
"aggressiveness",
"parameter",
".",
"Increasing",
"the",
"value",
"of",
"this",
"parameter",
"increases",
"the",
"aggressiveness",
"of",
"the",
"algorithm",
".",
"It",
"must",
"be",
"a",
"positive",
"value",
".",
"This",
"parameter",
"essentially",
"performs",
"a",
"type",
"of",
"regularization",
"on",
"the",
"updates"
] | train | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/linear/NHERD.java#L130-L135 |
threerings/narya | core/src/main/java/com/threerings/presents/server/TimeBaseProvider.java | TimeBaseProvider.init | public static void init (InvocationManager invmgr, RootDObjectManager omgr) {
"""
Registers the time provider with the appropriate managers. Called by the presents server at
startup.
"""
// we'll need these later
_invmgr = invmgr;
_omgr = omgr;
// register a provider instance
invmgr.registerProvider(new TimeBaseProvider(), TimeBaseMarshaller.class, GLOBAL_GROUP);
} | java | public static void init (InvocationManager invmgr, RootDObjectManager omgr)
{
// we'll need these later
_invmgr = invmgr;
_omgr = omgr;
// register a provider instance
invmgr.registerProvider(new TimeBaseProvider(), TimeBaseMarshaller.class, GLOBAL_GROUP);
} | [
"public",
"static",
"void",
"init",
"(",
"InvocationManager",
"invmgr",
",",
"RootDObjectManager",
"omgr",
")",
"{",
"// we'll need these later",
"_invmgr",
"=",
"invmgr",
";",
"_omgr",
"=",
"omgr",
";",
"// register a provider instance",
"invmgr",
".",
"registerProvider",
"(",
"new",
"TimeBaseProvider",
"(",
")",
",",
"TimeBaseMarshaller",
".",
"class",
",",
"GLOBAL_GROUP",
")",
";",
"}"
] | Registers the time provider with the appropriate managers. Called by the presents server at
startup. | [
"Registers",
"the",
"time",
"provider",
"with",
"the",
"appropriate",
"managers",
".",
"Called",
"by",
"the",
"presents",
"server",
"at",
"startup",
"."
] | train | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/server/TimeBaseProvider.java#L47-L55 |
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.updateCustomPrebuiltEntityRoleAsync | public Observable<OperationStatus> updateCustomPrebuiltEntityRoleAsync(UUID appId, String versionId, UUID entityId, UUID roleId, UpdateCustomPrebuiltEntityRoleOptionalParameter updateCustomPrebuiltEntityRoleOptionalParameter) {
"""
Update an entity role for a given entity.
@param appId The application ID.
@param versionId The version ID.
@param entityId The entity ID.
@param roleId The entity role ID.
@param updateCustomPrebuiltEntityRoleOptionalParameter 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 OperationStatus object
"""
return updateCustomPrebuiltEntityRoleWithServiceResponseAsync(appId, versionId, entityId, roleId, updateCustomPrebuiltEntityRoleOptionalParameter).map(new Func1<ServiceResponse<OperationStatus>, OperationStatus>() {
@Override
public OperationStatus call(ServiceResponse<OperationStatus> response) {
return response.body();
}
});
} | java | public Observable<OperationStatus> updateCustomPrebuiltEntityRoleAsync(UUID appId, String versionId, UUID entityId, UUID roleId, UpdateCustomPrebuiltEntityRoleOptionalParameter updateCustomPrebuiltEntityRoleOptionalParameter) {
return updateCustomPrebuiltEntityRoleWithServiceResponseAsync(appId, versionId, entityId, roleId, updateCustomPrebuiltEntityRoleOptionalParameter).map(new Func1<ServiceResponse<OperationStatus>, OperationStatus>() {
@Override
public OperationStatus call(ServiceResponse<OperationStatus> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"OperationStatus",
">",
"updateCustomPrebuiltEntityRoleAsync",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"UUID",
"entityId",
",",
"UUID",
"roleId",
",",
"UpdateCustomPrebuiltEntityRoleOptionalParameter",
"updateCustomPrebuiltEntityRoleOptionalParameter",
")",
"{",
"return",
"updateCustomPrebuiltEntityRoleWithServiceResponseAsync",
"(",
"appId",
",",
"versionId",
",",
"entityId",
",",
"roleId",
",",
"updateCustomPrebuiltEntityRoleOptionalParameter",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"OperationStatus",
">",
",",
"OperationStatus",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"OperationStatus",
"call",
"(",
"ServiceResponse",
"<",
"OperationStatus",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Update an entity role for a given entity.
@param appId The application ID.
@param versionId The version ID.
@param entityId The entity ID.
@param roleId The entity role ID.
@param updateCustomPrebuiltEntityRoleOptionalParameter 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 OperationStatus object | [
"Update",
"an",
"entity",
"role",
"for",
"a",
"given",
"entity",
"."
] | 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#L13694-L13701 |
apache/groovy | src/main/java/org/codehaus/groovy/syntax/Token.java | Token.newSymbol | public static Token newSymbol(String type, int startLine, int startColumn) {
"""
Creates a token that represents a symbol, using a library for the type.
"""
return new Token(Types.lookupSymbol(type), type, startLine, startColumn);
} | java | public static Token newSymbol(String type, int startLine, int startColumn) {
return new Token(Types.lookupSymbol(type), type, startLine, startColumn);
} | [
"public",
"static",
"Token",
"newSymbol",
"(",
"String",
"type",
",",
"int",
"startLine",
",",
"int",
"startColumn",
")",
"{",
"return",
"new",
"Token",
"(",
"Types",
".",
"lookupSymbol",
"(",
"type",
")",
",",
"type",
",",
"startLine",
",",
"startColumn",
")",
";",
"}"
] | Creates a token that represents a symbol, using a library for the type. | [
"Creates",
"a",
"token",
"that",
"represents",
"a",
"symbol",
"using",
"a",
"library",
"for",
"the",
"type",
"."
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/syntax/Token.java#L268-L270 |
Azure/azure-sdk-for-java | datamigration/resource-manager/v2017_11_15_preview/src/main/java/com/microsoft/azure/management/datamigration/v2017_11_15_preview/implementation/ServicesInner.java | ServicesInner.createOrUpdate | public DataMigrationServiceInner createOrUpdate(String groupName, String serviceName, DataMigrationServiceInner parameters) {
"""
Create or update DMS Instance.
The services resource is the top-level resource that represents the Data Migration Service. The PUT method creates a new service or updates an existing one. When a service is updated, existing child resources (i.e. tasks) are unaffected. Services currently support a single kind, "vm", which refers to a VM-based service, although other kinds may be added in the future. This method can change the kind, SKU, and network of the service, but if tasks are currently running (i.e. the service is busy), this will fail with 400 Bad Request ("ServiceIsBusy"). The provider will reply when successful with 200 OK or 201 Created. Long-running operations use the provisioningState property.
@param groupName Name of the resource group
@param serviceName Name of the service
@param parameters Information about the service
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ApiErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the DataMigrationServiceInner object if successful.
"""
return createOrUpdateWithServiceResponseAsync(groupName, serviceName, parameters).toBlocking().last().body();
} | java | public DataMigrationServiceInner createOrUpdate(String groupName, String serviceName, DataMigrationServiceInner parameters) {
return createOrUpdateWithServiceResponseAsync(groupName, serviceName, parameters).toBlocking().last().body();
} | [
"public",
"DataMigrationServiceInner",
"createOrUpdate",
"(",
"String",
"groupName",
",",
"String",
"serviceName",
",",
"DataMigrationServiceInner",
"parameters",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"groupName",
",",
"serviceName",
",",
"parameters",
")",
".",
"toBlocking",
"(",
")",
".",
"last",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
] | Create or update DMS Instance.
The services resource is the top-level resource that represents the Data Migration Service. The PUT method creates a new service or updates an existing one. When a service is updated, existing child resources (i.e. tasks) are unaffected. Services currently support a single kind, "vm", which refers to a VM-based service, although other kinds may be added in the future. This method can change the kind, SKU, and network of the service, but if tasks are currently running (i.e. the service is busy), this will fail with 400 Bad Request ("ServiceIsBusy"). The provider will reply when successful with 200 OK or 201 Created. Long-running operations use the provisioningState property.
@param groupName Name of the resource group
@param serviceName Name of the service
@param parameters Information about the service
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ApiErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the DataMigrationServiceInner object if successful. | [
"Create",
"or",
"update",
"DMS",
"Instance",
".",
"The",
"services",
"resource",
"is",
"the",
"top",
"-",
"level",
"resource",
"that",
"represents",
"the",
"Data",
"Migration",
"Service",
".",
"The",
"PUT",
"method",
"creates",
"a",
"new",
"service",
"or",
"updates",
"an",
"existing",
"one",
".",
"When",
"a",
"service",
"is",
"updated",
"existing",
"child",
"resources",
"(",
"i",
".",
"e",
".",
"tasks",
")",
"are",
"unaffected",
".",
"Services",
"currently",
"support",
"a",
"single",
"kind",
"vm",
"which",
"refers",
"to",
"a",
"VM",
"-",
"based",
"service",
"although",
"other",
"kinds",
"may",
"be",
"added",
"in",
"the",
"future",
".",
"This",
"method",
"can",
"change",
"the",
"kind",
"SKU",
"and",
"network",
"of",
"the",
"service",
"but",
"if",
"tasks",
"are",
"currently",
"running",
"(",
"i",
".",
"e",
".",
"the",
"service",
"is",
"busy",
")",
"this",
"will",
"fail",
"with",
"400",
"Bad",
"Request",
"(",
"ServiceIsBusy",
")",
".",
"The",
"provider",
"will",
"reply",
"when",
"successful",
"with",
"200",
"OK",
"or",
"201",
"Created",
".",
"Long",
"-",
"running",
"operations",
"use",
"the",
"provisioningState",
"property",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datamigration/resource-manager/v2017_11_15_preview/src/main/java/com/microsoft/azure/management/datamigration/v2017_11_15_preview/implementation/ServicesInner.java#L164-L166 |
ngageoint/geopackage-android-map | geopackage-map/src/main/java/mil/nga/geopackage/map/features/StyleCache.java | StyleCache.setFeatureStyle | public boolean setFeatureStyle(PolygonOptions polygonOptions, FeatureRow featureRow) {
"""
Set the feature row style into the polygon options
@param polygonOptions polygon options
@param featureRow feature row
@return true if style was set into the polygon options
"""
return StyleUtils.setFeatureStyle(polygonOptions, featureStyleExtension, featureRow, density);
} | java | public boolean setFeatureStyle(PolygonOptions polygonOptions, FeatureRow featureRow) {
return StyleUtils.setFeatureStyle(polygonOptions, featureStyleExtension, featureRow, density);
} | [
"public",
"boolean",
"setFeatureStyle",
"(",
"PolygonOptions",
"polygonOptions",
",",
"FeatureRow",
"featureRow",
")",
"{",
"return",
"StyleUtils",
".",
"setFeatureStyle",
"(",
"polygonOptions",
",",
"featureStyleExtension",
",",
"featureRow",
",",
"density",
")",
";",
"}"
] | Set the feature row style into the polygon options
@param polygonOptions polygon options
@param featureRow feature row
@return true if style was set into the polygon options | [
"Set",
"the",
"feature",
"row",
"style",
"into",
"the",
"polygon",
"options"
] | train | https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/features/StyleCache.java#L292-L294 |
datumbox/lpsolve | src/main/java/lpsolve/LpSolve.java | LpSolve.putLogfunc | public void putLogfunc(LogListener listener, Object userhandle) throws LpSolveException {
"""
Register an <code>LogListener</code> for callback.
@param listener the listener that should be called by lp_solve
@param userhandle an arbitrary object that is passed to the listener on call
"""
logListener = listener;
logUserhandle = (listener != null) ? userhandle : null;
addLp(this);
registerLogfunc();
} | java | public void putLogfunc(LogListener listener, Object userhandle) throws LpSolveException {
logListener = listener;
logUserhandle = (listener != null) ? userhandle : null;
addLp(this);
registerLogfunc();
} | [
"public",
"void",
"putLogfunc",
"(",
"LogListener",
"listener",
",",
"Object",
"userhandle",
")",
"throws",
"LpSolveException",
"{",
"logListener",
"=",
"listener",
";",
"logUserhandle",
"=",
"(",
"listener",
"!=",
"null",
")",
"?",
"userhandle",
":",
"null",
";",
"addLp",
"(",
"this",
")",
";",
"registerLogfunc",
"(",
")",
";",
"}"
] | Register an <code>LogListener</code> for callback.
@param listener the listener that should be called by lp_solve
@param userhandle an arbitrary object that is passed to the listener on call | [
"Register",
"an",
"<code",
">",
"LogListener<",
"/",
"code",
">",
"for",
"callback",
"."
] | train | https://github.com/datumbox/lpsolve/blob/201b3e99153d907bb99c189e5647bc71a3a1add6/src/main/java/lpsolve/LpSolve.java#L1613-L1618 |
looly/hutool | hutool-db/src/main/java/cn/hutool/db/Entity.java | Entity.parse | public static <T> Entity parse(T bean, boolean isToUnderlineCase, boolean ignoreNullValue) {
"""
将PO对象转为Entity
@param <T> Bean对象类型
@param bean Bean对象
@param isToUnderlineCase 是否转换为下划线模式
@param ignoreNullValue 是否忽略值为空的字段
@return Entity
"""
return create(null).parseBean(bean, isToUnderlineCase, ignoreNullValue);
} | java | public static <T> Entity parse(T bean, boolean isToUnderlineCase, boolean ignoreNullValue) {
return create(null).parseBean(bean, isToUnderlineCase, ignoreNullValue);
} | [
"public",
"static",
"<",
"T",
">",
"Entity",
"parse",
"(",
"T",
"bean",
",",
"boolean",
"isToUnderlineCase",
",",
"boolean",
"ignoreNullValue",
")",
"{",
"return",
"create",
"(",
"null",
")",
".",
"parseBean",
"(",
"bean",
",",
"isToUnderlineCase",
",",
"ignoreNullValue",
")",
";",
"}"
] | 将PO对象转为Entity
@param <T> Bean对象类型
@param bean Bean对象
@param isToUnderlineCase 是否转换为下划线模式
@param ignoreNullValue 是否忽略值为空的字段
@return Entity | [
"将PO对象转为Entity"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/Entity.java#L74-L76 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/align/ce/OptimalCECPMain.java | OptimalCECPMain.permuteAFPChain | private static void permuteAFPChain(AFPChain afpChain, int cp) {
"""
Permute the second protein of afpChain by the specified number of residues.
@param afpChain Input alignment
@param cp Amount leftwards (or rightward, if negative) to shift the
@return A new alignment equivalent to afpChain after the permutations
"""
int ca2len = afpChain.getCa2Length();
//fix up cp to be positive
if(cp == 0) {
return;
}
if(cp < 0) {
cp = ca2len+cp;
}
if(cp < 0 || cp >= ca2len) {
throw new ArrayIndexOutOfBoundsException(
"Permutation point ("+cp+") must be between -ca2.length and ca2.length-1" );
}
// Fix up optAln
permuteOptAln(afpChain,cp);
if(afpChain.getBlockNum() > 1)
afpChain.setSequentialAlignment(false);
// fix up matrices
// ca1 corresponds to row indices, while ca2 corresponds to column indices.
afpChain.setDistanceMatrix(permuteMatrix(afpChain.getDistanceMatrix(),0,-cp));
// this is square, so permute both
afpChain.setDisTable2(permuteMatrix(afpChain.getDisTable2(),-cp,-cp));
//TODO fix up other AFP parameters?
} | java | private static void permuteAFPChain(AFPChain afpChain, int cp) {
int ca2len = afpChain.getCa2Length();
//fix up cp to be positive
if(cp == 0) {
return;
}
if(cp < 0) {
cp = ca2len+cp;
}
if(cp < 0 || cp >= ca2len) {
throw new ArrayIndexOutOfBoundsException(
"Permutation point ("+cp+") must be between -ca2.length and ca2.length-1" );
}
// Fix up optAln
permuteOptAln(afpChain,cp);
if(afpChain.getBlockNum() > 1)
afpChain.setSequentialAlignment(false);
// fix up matrices
// ca1 corresponds to row indices, while ca2 corresponds to column indices.
afpChain.setDistanceMatrix(permuteMatrix(afpChain.getDistanceMatrix(),0,-cp));
// this is square, so permute both
afpChain.setDisTable2(permuteMatrix(afpChain.getDisTable2(),-cp,-cp));
//TODO fix up other AFP parameters?
} | [
"private",
"static",
"void",
"permuteAFPChain",
"(",
"AFPChain",
"afpChain",
",",
"int",
"cp",
")",
"{",
"int",
"ca2len",
"=",
"afpChain",
".",
"getCa2Length",
"(",
")",
";",
"//fix up cp to be positive",
"if",
"(",
"cp",
"==",
"0",
")",
"{",
"return",
";",
"}",
"if",
"(",
"cp",
"<",
"0",
")",
"{",
"cp",
"=",
"ca2len",
"+",
"cp",
";",
"}",
"if",
"(",
"cp",
"<",
"0",
"||",
"cp",
">=",
"ca2len",
")",
"{",
"throw",
"new",
"ArrayIndexOutOfBoundsException",
"(",
"\"Permutation point (\"",
"+",
"cp",
"+",
"\") must be between -ca2.length and ca2.length-1\"",
")",
";",
"}",
"// Fix up optAln",
"permuteOptAln",
"(",
"afpChain",
",",
"cp",
")",
";",
"if",
"(",
"afpChain",
".",
"getBlockNum",
"(",
")",
">",
"1",
")",
"afpChain",
".",
"setSequentialAlignment",
"(",
"false",
")",
";",
"// fix up matrices",
"// ca1 corresponds to row indices, while ca2 corresponds to column indices.",
"afpChain",
".",
"setDistanceMatrix",
"(",
"permuteMatrix",
"(",
"afpChain",
".",
"getDistanceMatrix",
"(",
")",
",",
"0",
",",
"-",
"cp",
")",
")",
";",
"// this is square, so permute both",
"afpChain",
".",
"setDisTable2",
"(",
"permuteMatrix",
"(",
"afpChain",
".",
"getDisTable2",
"(",
")",
",",
"-",
"cp",
",",
"-",
"cp",
")",
")",
";",
"//TODO fix up other AFP parameters?",
"}"
] | Permute the second protein of afpChain by the specified number of residues.
@param afpChain Input alignment
@param cp Amount leftwards (or rightward, if negative) to shift the
@return A new alignment equivalent to afpChain after the permutations | [
"Permute",
"the",
"second",
"protein",
"of",
"afpChain",
"by",
"the",
"specified",
"number",
"of",
"residues",
"."
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/ce/OptimalCECPMain.java#L217-L246 |
aws/aws-sdk-java | aws-java-sdk-pinpoint/src/main/java/com/amazonaws/services/pinpoint/model/ChannelsResponse.java | ChannelsResponse.withChannels | public ChannelsResponse withChannels(java.util.Map<String, ChannelResponse> channels) {
"""
A map of channels, with the ChannelType as the key and the Channel as the value.
@param channels
A map of channels, with the ChannelType as the key and the Channel as the value.
@return Returns a reference to this object so that method calls can be chained together.
"""
setChannels(channels);
return this;
} | java | public ChannelsResponse withChannels(java.util.Map<String, ChannelResponse> channels) {
setChannels(channels);
return this;
} | [
"public",
"ChannelsResponse",
"withChannels",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"ChannelResponse",
">",
"channels",
")",
"{",
"setChannels",
"(",
"channels",
")",
";",
"return",
"this",
";",
"}"
] | A map of channels, with the ChannelType as the key and the Channel as the value.
@param channels
A map of channels, with the ChannelType as the key and the Channel as the value.
@return Returns a reference to this object so that method calls can be chained together. | [
"A",
"map",
"of",
"channels",
"with",
"the",
"ChannelType",
"as",
"the",
"key",
"and",
"the",
"Channel",
"as",
"the",
"value",
"."
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-pinpoint/src/main/java/com/amazonaws/services/pinpoint/model/ChannelsResponse.java#L61-L64 |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/geo/MultiViewOps.java | MultiViewOps.createEssential | public static DMatrixRMaj createEssential(DMatrixRMaj R, Vector3D_F64 T, @Nullable DMatrixRMaj E) {
"""
<p>
Computes an essential matrix from a rotation and translation. This motion
is the motion from the first camera frame into the second camera frame. The essential
matrix 'E' is defined as:<br>
E = hat(T)*R<br>
where hat(T) is the skew symmetric cross product matrix for vector T.
</p>
@param R Rotation matrix.
@param T Translation vector.
@param E (Output) Storage for essential matrix. 3x3 matrix
@return Essential matrix
"""
if( E == null )
E = new DMatrixRMaj(3,3);
DMatrixRMaj T_hat = GeometryMath_F64.crossMatrix(T, null);
CommonOps_DDRM.mult(T_hat, R, E);
return E;
} | java | public static DMatrixRMaj createEssential(DMatrixRMaj R, Vector3D_F64 T, @Nullable DMatrixRMaj E)
{
if( E == null )
E = new DMatrixRMaj(3,3);
DMatrixRMaj T_hat = GeometryMath_F64.crossMatrix(T, null);
CommonOps_DDRM.mult(T_hat, R, E);
return E;
} | [
"public",
"static",
"DMatrixRMaj",
"createEssential",
"(",
"DMatrixRMaj",
"R",
",",
"Vector3D_F64",
"T",
",",
"@",
"Nullable",
"DMatrixRMaj",
"E",
")",
"{",
"if",
"(",
"E",
"==",
"null",
")",
"E",
"=",
"new",
"DMatrixRMaj",
"(",
"3",
",",
"3",
")",
";",
"DMatrixRMaj",
"T_hat",
"=",
"GeometryMath_F64",
".",
"crossMatrix",
"(",
"T",
",",
"null",
")",
";",
"CommonOps_DDRM",
".",
"mult",
"(",
"T_hat",
",",
"R",
",",
"E",
")",
";",
"return",
"E",
";",
"}"
] | <p>
Computes an essential matrix from a rotation and translation. This motion
is the motion from the first camera frame into the second camera frame. The essential
matrix 'E' is defined as:<br>
E = hat(T)*R<br>
where hat(T) is the skew symmetric cross product matrix for vector T.
</p>
@param R Rotation matrix.
@param T Translation vector.
@param E (Output) Storage for essential matrix. 3x3 matrix
@return Essential matrix | [
"<p",
">",
"Computes",
"an",
"essential",
"matrix",
"from",
"a",
"rotation",
"and",
"translation",
".",
"This",
"motion",
"is",
"the",
"motion",
"from",
"the",
"first",
"camera",
"frame",
"into",
"the",
"second",
"camera",
"frame",
".",
"The",
"essential",
"matrix",
"E",
"is",
"defined",
"as",
":",
"<br",
">",
"E",
"=",
"hat",
"(",
"T",
")",
"*",
"R<br",
">",
"where",
"hat",
"(",
"T",
")",
"is",
"the",
"skew",
"symmetric",
"cross",
"product",
"matrix",
"for",
"vector",
"T",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/MultiViewOps.java#L667-L676 |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/spatial/distance/ST_ClosestCoordinate.java | ST_ClosestCoordinate.getFurthestCoordinate | public static Geometry getFurthestCoordinate(Point point, Geometry geom) {
"""
Computes the closest coordinate(s) contained in the given geometry starting
from the given point, using the 2D distance.
@param point Point
@param geom Geometry
@return The closest coordinate(s) contained in the given geometry starting from
the given point, using the 2D distance
"""
if (point == null || geom == null) {
return null;
}
double minDistance = Double.POSITIVE_INFINITY;
Coordinate pointCoordinate = point.getCoordinate();
Set<Coordinate> closestCoordinates = new HashSet<Coordinate>();
for (Coordinate c : geom.getCoordinates()) {
double distance = c.distance(pointCoordinate);
if (Double.compare(distance, minDistance) == 0) {
closestCoordinates.add(c);
}
if (Double.compare(distance, minDistance) < 0) {
minDistance = distance;
closestCoordinates.clear();
closestCoordinates.add(c);
}
}
if (closestCoordinates.size() == 1) {
return GEOMETRY_FACTORY.createPoint(closestCoordinates.iterator().next());
}
return GEOMETRY_FACTORY.createMultiPoint(
closestCoordinates.toArray(new Coordinate[0]));
} | java | public static Geometry getFurthestCoordinate(Point point, Geometry geom) {
if (point == null || geom == null) {
return null;
}
double minDistance = Double.POSITIVE_INFINITY;
Coordinate pointCoordinate = point.getCoordinate();
Set<Coordinate> closestCoordinates = new HashSet<Coordinate>();
for (Coordinate c : geom.getCoordinates()) {
double distance = c.distance(pointCoordinate);
if (Double.compare(distance, minDistance) == 0) {
closestCoordinates.add(c);
}
if (Double.compare(distance, minDistance) < 0) {
minDistance = distance;
closestCoordinates.clear();
closestCoordinates.add(c);
}
}
if (closestCoordinates.size() == 1) {
return GEOMETRY_FACTORY.createPoint(closestCoordinates.iterator().next());
}
return GEOMETRY_FACTORY.createMultiPoint(
closestCoordinates.toArray(new Coordinate[0]));
} | [
"public",
"static",
"Geometry",
"getFurthestCoordinate",
"(",
"Point",
"point",
",",
"Geometry",
"geom",
")",
"{",
"if",
"(",
"point",
"==",
"null",
"||",
"geom",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"double",
"minDistance",
"=",
"Double",
".",
"POSITIVE_INFINITY",
";",
"Coordinate",
"pointCoordinate",
"=",
"point",
".",
"getCoordinate",
"(",
")",
";",
"Set",
"<",
"Coordinate",
">",
"closestCoordinates",
"=",
"new",
"HashSet",
"<",
"Coordinate",
">",
"(",
")",
";",
"for",
"(",
"Coordinate",
"c",
":",
"geom",
".",
"getCoordinates",
"(",
")",
")",
"{",
"double",
"distance",
"=",
"c",
".",
"distance",
"(",
"pointCoordinate",
")",
";",
"if",
"(",
"Double",
".",
"compare",
"(",
"distance",
",",
"minDistance",
")",
"==",
"0",
")",
"{",
"closestCoordinates",
".",
"add",
"(",
"c",
")",
";",
"}",
"if",
"(",
"Double",
".",
"compare",
"(",
"distance",
",",
"minDistance",
")",
"<",
"0",
")",
"{",
"minDistance",
"=",
"distance",
";",
"closestCoordinates",
".",
"clear",
"(",
")",
";",
"closestCoordinates",
".",
"add",
"(",
"c",
")",
";",
"}",
"}",
"if",
"(",
"closestCoordinates",
".",
"size",
"(",
")",
"==",
"1",
")",
"{",
"return",
"GEOMETRY_FACTORY",
".",
"createPoint",
"(",
"closestCoordinates",
".",
"iterator",
"(",
")",
".",
"next",
"(",
")",
")",
";",
"}",
"return",
"GEOMETRY_FACTORY",
".",
"createMultiPoint",
"(",
"closestCoordinates",
".",
"toArray",
"(",
"new",
"Coordinate",
"[",
"0",
"]",
")",
")",
";",
"}"
] | Computes the closest coordinate(s) contained in the given geometry starting
from the given point, using the 2D distance.
@param point Point
@param geom Geometry
@return The closest coordinate(s) contained in the given geometry starting from
the given point, using the 2D distance | [
"Computes",
"the",
"closest",
"coordinate",
"(",
"s",
")",
"contained",
"in",
"the",
"given",
"geometry",
"starting",
"from",
"the",
"given",
"point",
"using",
"the",
"2D",
"distance",
"."
] | train | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/distance/ST_ClosestCoordinate.java#L64-L87 |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/parametrics/onesample/DurbinWatson.java | DurbinWatson.checkCriticalValue | public static boolean checkCriticalValue(double score, int n, int k, boolean is_twoTailed, double aLevel) {
"""
Checks the Critical Value to determine if the Hypothesis should be rejected
@param score
@param n
@param k
@param is_twoTailed
@param aLevel
@return
"""
/*
if(n<=200 && k<=20) {
//Calculate it from tables
//http://www3.nd.edu/~wevans1/econ30331/Durbin_Watson_tables.pdf
}
*/
//Follows normal distribution for large samples
//References: http://econometrics.com/guide/dwdist.htm
double z=(score-2.0)/Math.sqrt(4.0/n);
double probability=ContinuousDistributions.gaussCdf(z);
boolean rejectH0=false;
double a=aLevel;
if(is_twoTailed) { //if to tailed test then split the statistical significance in half
a=aLevel/2.0;
}
if(probability<=a || probability>=(1-a)) {
rejectH0=true;
}
return rejectH0;
} | java | public static boolean checkCriticalValue(double score, int n, int k, boolean is_twoTailed, double aLevel) {
/*
if(n<=200 && k<=20) {
//Calculate it from tables
//http://www3.nd.edu/~wevans1/econ30331/Durbin_Watson_tables.pdf
}
*/
//Follows normal distribution for large samples
//References: http://econometrics.com/guide/dwdist.htm
double z=(score-2.0)/Math.sqrt(4.0/n);
double probability=ContinuousDistributions.gaussCdf(z);
boolean rejectH0=false;
double a=aLevel;
if(is_twoTailed) { //if to tailed test then split the statistical significance in half
a=aLevel/2.0;
}
if(probability<=a || probability>=(1-a)) {
rejectH0=true;
}
return rejectH0;
} | [
"public",
"static",
"boolean",
"checkCriticalValue",
"(",
"double",
"score",
",",
"int",
"n",
",",
"int",
"k",
",",
"boolean",
"is_twoTailed",
",",
"double",
"aLevel",
")",
"{",
"/*\n if(n<=200 && k<=20) {\n //Calculate it from tables\n //http://www3.nd.edu/~wevans1/econ30331/Durbin_Watson_tables.pdf\n }\n */",
"//Follows normal distribution for large samples",
"//References: http://econometrics.com/guide/dwdist.htm",
"double",
"z",
"=",
"(",
"score",
"-",
"2.0",
")",
"/",
"Math",
".",
"sqrt",
"(",
"4.0",
"/",
"n",
")",
";",
"double",
"probability",
"=",
"ContinuousDistributions",
".",
"gaussCdf",
"(",
"z",
")",
";",
"boolean",
"rejectH0",
"=",
"false",
";",
"double",
"a",
"=",
"aLevel",
";",
"if",
"(",
"is_twoTailed",
")",
"{",
"//if to tailed test then split the statistical significance in half",
"a",
"=",
"aLevel",
"/",
"2.0",
";",
"}",
"if",
"(",
"probability",
"<=",
"a",
"||",
"probability",
">=",
"(",
"1",
"-",
"a",
")",
")",
"{",
"rejectH0",
"=",
"true",
";",
"}",
"return",
"rejectH0",
";",
"}"
] | Checks the Critical Value to determine if the Hypothesis should be rejected
@param score
@param n
@param k
@param is_twoTailed
@param aLevel
@return | [
"Checks",
"the",
"Critical",
"Value",
"to",
"determine",
"if",
"the",
"Hypothesis",
"should",
"be",
"rejected"
] | train | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/parametrics/onesample/DurbinWatson.java#L86-L111 |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/util/BooleanExpressionParser.java | BooleanExpressionParser.parseDigits | private static String parseDigits(final String expression, final int startIndex) {
"""
This method reads digit characters from a given string, starting at a given index.
It will read till the end of the string or up until it encounters a non-digit character
@param expression The string to parse
@param startIndex The start index from where to parse
@return The parsed substring
"""
final StringBuilder digitBuffer = new StringBuilder();
char currentCharacter = expression.charAt(startIndex);
int subExpressionIndex = startIndex;
do {
digitBuffer.append(currentCharacter);
++subExpressionIndex;
if (subExpressionIndex < expression.length()) {
currentCharacter = expression.charAt(subExpressionIndex);
}
} while (subExpressionIndex < expression.length() && Character.isDigit(currentCharacter));
return digitBuffer.toString();
} | java | private static String parseDigits(final String expression, final int startIndex) {
final StringBuilder digitBuffer = new StringBuilder();
char currentCharacter = expression.charAt(startIndex);
int subExpressionIndex = startIndex;
do {
digitBuffer.append(currentCharacter);
++subExpressionIndex;
if (subExpressionIndex < expression.length()) {
currentCharacter = expression.charAt(subExpressionIndex);
}
} while (subExpressionIndex < expression.length() && Character.isDigit(currentCharacter));
return digitBuffer.toString();
} | [
"private",
"static",
"String",
"parseDigits",
"(",
"final",
"String",
"expression",
",",
"final",
"int",
"startIndex",
")",
"{",
"final",
"StringBuilder",
"digitBuffer",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"char",
"currentCharacter",
"=",
"expression",
".",
"charAt",
"(",
"startIndex",
")",
";",
"int",
"subExpressionIndex",
"=",
"startIndex",
";",
"do",
"{",
"digitBuffer",
".",
"append",
"(",
"currentCharacter",
")",
";",
"++",
"subExpressionIndex",
";",
"if",
"(",
"subExpressionIndex",
"<",
"expression",
".",
"length",
"(",
")",
")",
"{",
"currentCharacter",
"=",
"expression",
".",
"charAt",
"(",
"subExpressionIndex",
")",
";",
"}",
"}",
"while",
"(",
"subExpressionIndex",
"<",
"expression",
".",
"length",
"(",
")",
"&&",
"Character",
".",
"isDigit",
"(",
"currentCharacter",
")",
")",
";",
"return",
"digitBuffer",
".",
"toString",
"(",
")",
";",
"}"
] | This method reads digit characters from a given string, starting at a given index.
It will read till the end of the string or up until it encounters a non-digit character
@param expression The string to parse
@param startIndex The start index from where to parse
@return The parsed substring | [
"This",
"method",
"reads",
"digit",
"characters",
"from",
"a",
"given",
"string",
"starting",
"at",
"a",
"given",
"index",
".",
"It",
"will",
"read",
"till",
"the",
"end",
"of",
"the",
"string",
"or",
"up",
"until",
"it",
"encounters",
"a",
"non",
"-",
"digit",
"character"
] | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/util/BooleanExpressionParser.java#L178-L194 |
VoltDB/voltdb | third_party/java/src/org/apache/zookeeper_voltpatches/server/DataTree.java | DataTree.listACLEquals | private boolean listACLEquals(List<ACL> lista, List<ACL> listb) {
"""
compare two list of acls. if there elements are in the same order and the
same size then return true else return false
@param lista
the list to be compared
@param listb
the list to be compared
@return true if and only if the lists are of the same size and the
elements are in the same order in lista and listb
"""
if (lista.size() != listb.size()) {
return false;
}
for (int i = 0; i < lista.size(); i++) {
ACL a = lista.get(i);
ACL b = listb.get(i);
if (!a.equals(b)) {
return false;
}
}
return true;
} | java | private boolean listACLEquals(List<ACL> lista, List<ACL> listb) {
if (lista.size() != listb.size()) {
return false;
}
for (int i = 0; i < lista.size(); i++) {
ACL a = lista.get(i);
ACL b = listb.get(i);
if (!a.equals(b)) {
return false;
}
}
return true;
} | [
"private",
"boolean",
"listACLEquals",
"(",
"List",
"<",
"ACL",
">",
"lista",
",",
"List",
"<",
"ACL",
">",
"listb",
")",
"{",
"if",
"(",
"lista",
".",
"size",
"(",
")",
"!=",
"listb",
".",
"size",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"lista",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"ACL",
"a",
"=",
"lista",
".",
"get",
"(",
"i",
")",
";",
"ACL",
"b",
"=",
"listb",
".",
"get",
"(",
"i",
")",
";",
"if",
"(",
"!",
"a",
".",
"equals",
"(",
"b",
")",
")",
"{",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}"
] | compare two list of acls. if there elements are in the same order and the
same size then return true else return false
@param lista
the list to be compared
@param listb
the list to be compared
@return true if and only if the lists are of the same size and the
elements are in the same order in lista and listb | [
"compare",
"two",
"list",
"of",
"acls",
".",
"if",
"there",
"elements",
"are",
"in",
"the",
"same",
"order",
"and",
"the",
"same",
"size",
"then",
"return",
"true",
"else",
"return",
"false"
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/org/apache/zookeeper_voltpatches/server/DataTree.java#L168-L180 |
alkacon/opencms-core | src/org/opencms/ui/apps/cacheadmin/CmsImageCacheHelper.java | CmsImageCacheHelper.getSingleSize | public String getSingleSize(CmsObject cms, String resPath) throws CmsException {
"""
Reads the size of a single image.<p>
@param cms CmsObejct
@param resPath Path of image (uri)
@return a String representation of the dimension of the given image
@throws CmsException if something goes wrong
"""
CmsResource res = getClonedCmsObject(cms).readResource(resPath);
return getSingleSize(cms, res);
} | java | public String getSingleSize(CmsObject cms, String resPath) throws CmsException {
CmsResource res = getClonedCmsObject(cms).readResource(resPath);
return getSingleSize(cms, res);
} | [
"public",
"String",
"getSingleSize",
"(",
"CmsObject",
"cms",
",",
"String",
"resPath",
")",
"throws",
"CmsException",
"{",
"CmsResource",
"res",
"=",
"getClonedCmsObject",
"(",
"cms",
")",
".",
"readResource",
"(",
"resPath",
")",
";",
"return",
"getSingleSize",
"(",
"cms",
",",
"res",
")",
";",
"}"
] | Reads the size of a single image.<p>
@param cms CmsObejct
@param resPath Path of image (uri)
@return a String representation of the dimension of the given image
@throws CmsException if something goes wrong | [
"Reads",
"the",
"size",
"of",
"a",
"single",
"image",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/cacheadmin/CmsImageCacheHelper.java#L135-L139 |
albfernandez/itext2 | src/main/java/com/lowagie/text/rtf/table/RtfTable.java | RtfTable.importTable | private void importTable(Table table) {
"""
Imports the rows and settings from the Table into this
RtfTable.
@param table The source Table
"""
this.rows = new ArrayList();
this.tableWidthPercent = table.getWidth();
this.proportionalWidths = table.getProportionalWidths();
this.cellPadding = (float) (table.getPadding() * TWIPS_FACTOR);
this.cellSpacing = (float) (table.getSpacing() * TWIPS_FACTOR);
this.borders = new RtfBorderGroup(this.document, RtfBorder.ROW_BORDER, table.getBorder(), table.getBorderWidth(), table.getBorderColor());
this.alignment = table.getAlignment();
int i = 0;
Iterator rowIterator = table.iterator();
while(rowIterator.hasNext()) {
this.rows.add(new RtfRow(this.document, this, (Row) rowIterator.next(), i));
i++;
}
for(i = 0; i < this.rows.size(); i++) {
((RtfRow) this.rows.get(i)).handleCellSpanning();
((RtfRow) this.rows.get(i)).cleanRow();
}
this.headerRows = table.getLastHeaderRow();
this.cellsFitToPage = table.isCellsFitPage();
this.tableFitToPage = table.isTableFitsPage();
if(!Float.isNaN(table.getOffset())) {
this.offset = (int) (table.getOffset() * 2);
}
} | java | private void importTable(Table table) {
this.rows = new ArrayList();
this.tableWidthPercent = table.getWidth();
this.proportionalWidths = table.getProportionalWidths();
this.cellPadding = (float) (table.getPadding() * TWIPS_FACTOR);
this.cellSpacing = (float) (table.getSpacing() * TWIPS_FACTOR);
this.borders = new RtfBorderGroup(this.document, RtfBorder.ROW_BORDER, table.getBorder(), table.getBorderWidth(), table.getBorderColor());
this.alignment = table.getAlignment();
int i = 0;
Iterator rowIterator = table.iterator();
while(rowIterator.hasNext()) {
this.rows.add(new RtfRow(this.document, this, (Row) rowIterator.next(), i));
i++;
}
for(i = 0; i < this.rows.size(); i++) {
((RtfRow) this.rows.get(i)).handleCellSpanning();
((RtfRow) this.rows.get(i)).cleanRow();
}
this.headerRows = table.getLastHeaderRow();
this.cellsFitToPage = table.isCellsFitPage();
this.tableFitToPage = table.isTableFitsPage();
if(!Float.isNaN(table.getOffset())) {
this.offset = (int) (table.getOffset() * 2);
}
} | [
"private",
"void",
"importTable",
"(",
"Table",
"table",
")",
"{",
"this",
".",
"rows",
"=",
"new",
"ArrayList",
"(",
")",
";",
"this",
".",
"tableWidthPercent",
"=",
"table",
".",
"getWidth",
"(",
")",
";",
"this",
".",
"proportionalWidths",
"=",
"table",
".",
"getProportionalWidths",
"(",
")",
";",
"this",
".",
"cellPadding",
"=",
"(",
"float",
")",
"(",
"table",
".",
"getPadding",
"(",
")",
"*",
"TWIPS_FACTOR",
")",
";",
"this",
".",
"cellSpacing",
"=",
"(",
"float",
")",
"(",
"table",
".",
"getSpacing",
"(",
")",
"*",
"TWIPS_FACTOR",
")",
";",
"this",
".",
"borders",
"=",
"new",
"RtfBorderGroup",
"(",
"this",
".",
"document",
",",
"RtfBorder",
".",
"ROW_BORDER",
",",
"table",
".",
"getBorder",
"(",
")",
",",
"table",
".",
"getBorderWidth",
"(",
")",
",",
"table",
".",
"getBorderColor",
"(",
")",
")",
";",
"this",
".",
"alignment",
"=",
"table",
".",
"getAlignment",
"(",
")",
";",
"int",
"i",
"=",
"0",
";",
"Iterator",
"rowIterator",
"=",
"table",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"rowIterator",
".",
"hasNext",
"(",
")",
")",
"{",
"this",
".",
"rows",
".",
"add",
"(",
"new",
"RtfRow",
"(",
"this",
".",
"document",
",",
"this",
",",
"(",
"Row",
")",
"rowIterator",
".",
"next",
"(",
")",
",",
"i",
")",
")",
";",
"i",
"++",
";",
"}",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"rows",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"(",
"(",
"RtfRow",
")",
"this",
".",
"rows",
".",
"get",
"(",
"i",
")",
")",
".",
"handleCellSpanning",
"(",
")",
";",
"(",
"(",
"RtfRow",
")",
"this",
".",
"rows",
".",
"get",
"(",
"i",
")",
")",
".",
"cleanRow",
"(",
")",
";",
"}",
"this",
".",
"headerRows",
"=",
"table",
".",
"getLastHeaderRow",
"(",
")",
";",
"this",
".",
"cellsFitToPage",
"=",
"table",
".",
"isCellsFitPage",
"(",
")",
";",
"this",
".",
"tableFitToPage",
"=",
"table",
".",
"isTableFitsPage",
"(",
")",
";",
"if",
"(",
"!",
"Float",
".",
"isNaN",
"(",
"table",
".",
"getOffset",
"(",
")",
")",
")",
"{",
"this",
".",
"offset",
"=",
"(",
"int",
")",
"(",
"table",
".",
"getOffset",
"(",
")",
"*",
"2",
")",
";",
"}",
"}"
] | Imports the rows and settings from the Table into this
RtfTable.
@param table The source Table | [
"Imports",
"the",
"rows",
"and",
"settings",
"from",
"the",
"Table",
"into",
"this",
"RtfTable",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/rtf/table/RtfTable.java#L155-L180 |
h2oai/h2o-2 | src/main/java/hex/deeplearning/DeepLearning.java | DeepLearning.computeRowUsageFraction | private static float computeRowUsageFraction(final long numRows, final long train_samples_per_iteration, final boolean replicate_training_data) {
"""
Compute the fraction of rows that need to be used for training during one iteration
@param numRows number of training rows
@param train_samples_per_iteration number of training rows to be processed per iteration
@param replicate_training_data whether of not the training data is replicated on each node
@return fraction of rows to be used for training during one iteration
"""
float rowUsageFraction = (float)train_samples_per_iteration / numRows;
if (replicate_training_data) rowUsageFraction /= H2O.CLOUD.size();
assert(rowUsageFraction > 0);
return rowUsageFraction;
} | java | private static float computeRowUsageFraction(final long numRows, final long train_samples_per_iteration, final boolean replicate_training_data) {
float rowUsageFraction = (float)train_samples_per_iteration / numRows;
if (replicate_training_data) rowUsageFraction /= H2O.CLOUD.size();
assert(rowUsageFraction > 0);
return rowUsageFraction;
} | [
"private",
"static",
"float",
"computeRowUsageFraction",
"(",
"final",
"long",
"numRows",
",",
"final",
"long",
"train_samples_per_iteration",
",",
"final",
"boolean",
"replicate_training_data",
")",
"{",
"float",
"rowUsageFraction",
"=",
"(",
"float",
")",
"train_samples_per_iteration",
"/",
"numRows",
";",
"if",
"(",
"replicate_training_data",
")",
"rowUsageFraction",
"/=",
"H2O",
".",
"CLOUD",
".",
"size",
"(",
")",
";",
"assert",
"(",
"rowUsageFraction",
">",
"0",
")",
";",
"return",
"rowUsageFraction",
";",
"}"
] | Compute the fraction of rows that need to be used for training during one iteration
@param numRows number of training rows
@param train_samples_per_iteration number of training rows to be processed per iteration
@param replicate_training_data whether of not the training data is replicated on each node
@return fraction of rows to be used for training during one iteration | [
"Compute",
"the",
"fraction",
"of",
"rows",
"that",
"need",
"to",
"be",
"used",
"for",
"training",
"during",
"one",
"iteration"
] | train | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/hex/deeplearning/DeepLearning.java#L1288-L1293 |
FXMisc/RichTextFX | richtextfx/src/main/java/org/fxmisc/richtext/model/ReadOnlyStyledDocument.java | ReadOnlyStyledDocument.summaryProvider | private static <PS, SEG, S> ToSemigroup<Paragraph<PS, SEG, S>, Summary> summaryProvider() {
"""
Private method for quickly calculating the length of a portion (subdocument) of this document.
"""
return new ToSemigroup<Paragraph<PS, SEG, S>, Summary>() {
@Override
public Summary apply(Paragraph<PS, SEG, S> p) {
return new Summary(1, p.length());
}
@Override
public Summary reduce(Summary left, Summary right) {
return new Summary(
left.paragraphCount + right.paragraphCount,
left.charCount + right.charCount);
}
};
} | java | private static <PS, SEG, S> ToSemigroup<Paragraph<PS, SEG, S>, Summary> summaryProvider() {
return new ToSemigroup<Paragraph<PS, SEG, S>, Summary>() {
@Override
public Summary apply(Paragraph<PS, SEG, S> p) {
return new Summary(1, p.length());
}
@Override
public Summary reduce(Summary left, Summary right) {
return new Summary(
left.paragraphCount + right.paragraphCount,
left.charCount + right.charCount);
}
};
} | [
"private",
"static",
"<",
"PS",
",",
"SEG",
",",
"S",
">",
"ToSemigroup",
"<",
"Paragraph",
"<",
"PS",
",",
"SEG",
",",
"S",
">",
",",
"Summary",
">",
"summaryProvider",
"(",
")",
"{",
"return",
"new",
"ToSemigroup",
"<",
"Paragraph",
"<",
"PS",
",",
"SEG",
",",
"S",
">",
",",
"Summary",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Summary",
"apply",
"(",
"Paragraph",
"<",
"PS",
",",
"SEG",
",",
"S",
">",
"p",
")",
"{",
"return",
"new",
"Summary",
"(",
"1",
",",
"p",
".",
"length",
"(",
")",
")",
";",
"}",
"@",
"Override",
"public",
"Summary",
"reduce",
"(",
"Summary",
"left",
",",
"Summary",
"right",
")",
"{",
"return",
"new",
"Summary",
"(",
"left",
".",
"paragraphCount",
"+",
"right",
".",
"paragraphCount",
",",
"left",
".",
"charCount",
"+",
"right",
".",
"charCount",
")",
";",
"}",
"}",
";",
"}"
] | Private method for quickly calculating the length of a portion (subdocument) of this document. | [
"Private",
"method",
"for",
"quickly",
"calculating",
"the",
"length",
"of",
"a",
"portion",
"(",
"subdocument",
")",
"of",
"this",
"document",
"."
] | train | https://github.com/FXMisc/RichTextFX/blob/bc7cab6a637855e0f37d9b9c12a9172c31545f0b/richtextfx/src/main/java/org/fxmisc/richtext/model/ReadOnlyStyledDocument.java#L64-L80 |
grails/gorm-hibernate5 | grails-datastore-gorm-hibernate5/src/main/groovy/org/grails/orm/hibernate/cfg/GrailsHibernateUtil.java | GrailsHibernateUtil.addOrderPossiblyNested | private static void addOrderPossiblyNested(AbstractHibernateDatastore datastore, Criteria c, Class<?> targetClass, String sort, String order, boolean ignoreCase) {
"""
Add order to criteria, creating necessary subCriteria if nested sort property (ie. sort:'nested.property').
"""
int firstDotPos = sort.indexOf(".");
if (firstDotPos == -1) {
addOrder(c, sort, order, ignoreCase);
} else { // nested property
String sortHead = sort.substring(0,firstDotPos);
String sortTail = sort.substring(firstDotPos+1);
PersistentProperty property = getGrailsDomainClassProperty(datastore, targetClass, sortHead);
if (property instanceof Embedded) {
// embedded objects cannot reference entities (at time of writing), so no more recursion needed
addOrder(c, sort, order, ignoreCase);
} else if(property instanceof Association) {
Criteria subCriteria = c.createCriteria(sortHead);
Class<?> propertyTargetClass = ((Association)property).getAssociatedEntity().getJavaClass();
GrailsHibernateUtil.cacheCriteriaByMapping(datastore, propertyTargetClass, subCriteria);
addOrderPossiblyNested(datastore, subCriteria, propertyTargetClass, sortTail, order, ignoreCase); // Recurse on nested sort
}
}
} | java | private static void addOrderPossiblyNested(AbstractHibernateDatastore datastore, Criteria c, Class<?> targetClass, String sort, String order, boolean ignoreCase) {
int firstDotPos = sort.indexOf(".");
if (firstDotPos == -1) {
addOrder(c, sort, order, ignoreCase);
} else { // nested property
String sortHead = sort.substring(0,firstDotPos);
String sortTail = sort.substring(firstDotPos+1);
PersistentProperty property = getGrailsDomainClassProperty(datastore, targetClass, sortHead);
if (property instanceof Embedded) {
// embedded objects cannot reference entities (at time of writing), so no more recursion needed
addOrder(c, sort, order, ignoreCase);
} else if(property instanceof Association) {
Criteria subCriteria = c.createCriteria(sortHead);
Class<?> propertyTargetClass = ((Association)property).getAssociatedEntity().getJavaClass();
GrailsHibernateUtil.cacheCriteriaByMapping(datastore, propertyTargetClass, subCriteria);
addOrderPossiblyNested(datastore, subCriteria, propertyTargetClass, sortTail, order, ignoreCase); // Recurse on nested sort
}
}
} | [
"private",
"static",
"void",
"addOrderPossiblyNested",
"(",
"AbstractHibernateDatastore",
"datastore",
",",
"Criteria",
"c",
",",
"Class",
"<",
"?",
">",
"targetClass",
",",
"String",
"sort",
",",
"String",
"order",
",",
"boolean",
"ignoreCase",
")",
"{",
"int",
"firstDotPos",
"=",
"sort",
".",
"indexOf",
"(",
"\".\"",
")",
";",
"if",
"(",
"firstDotPos",
"==",
"-",
"1",
")",
"{",
"addOrder",
"(",
"c",
",",
"sort",
",",
"order",
",",
"ignoreCase",
")",
";",
"}",
"else",
"{",
"// nested property",
"String",
"sortHead",
"=",
"sort",
".",
"substring",
"(",
"0",
",",
"firstDotPos",
")",
";",
"String",
"sortTail",
"=",
"sort",
".",
"substring",
"(",
"firstDotPos",
"+",
"1",
")",
";",
"PersistentProperty",
"property",
"=",
"getGrailsDomainClassProperty",
"(",
"datastore",
",",
"targetClass",
",",
"sortHead",
")",
";",
"if",
"(",
"property",
"instanceof",
"Embedded",
")",
"{",
"// embedded objects cannot reference entities (at time of writing), so no more recursion needed",
"addOrder",
"(",
"c",
",",
"sort",
",",
"order",
",",
"ignoreCase",
")",
";",
"}",
"else",
"if",
"(",
"property",
"instanceof",
"Association",
")",
"{",
"Criteria",
"subCriteria",
"=",
"c",
".",
"createCriteria",
"(",
"sortHead",
")",
";",
"Class",
"<",
"?",
">",
"propertyTargetClass",
"=",
"(",
"(",
"Association",
")",
"property",
")",
".",
"getAssociatedEntity",
"(",
")",
".",
"getJavaClass",
"(",
")",
";",
"GrailsHibernateUtil",
".",
"cacheCriteriaByMapping",
"(",
"datastore",
",",
"propertyTargetClass",
",",
"subCriteria",
")",
";",
"addOrderPossiblyNested",
"(",
"datastore",
",",
"subCriteria",
",",
"propertyTargetClass",
",",
"sortTail",
",",
"order",
",",
"ignoreCase",
")",
";",
"// Recurse on nested sort",
"}",
"}",
"}"
] | Add order to criteria, creating necessary subCriteria if nested sort property (ie. sort:'nested.property'). | [
"Add",
"order",
"to",
"criteria",
"creating",
"necessary",
"subCriteria",
"if",
"nested",
"sort",
"property",
"(",
"ie",
".",
"sort",
":",
"nested",
".",
"property",
")",
"."
] | train | https://github.com/grails/gorm-hibernate5/blob/0ebb80cd769ef2bea955723d4543828a3e9542ef/grails-datastore-gorm-hibernate5/src/main/groovy/org/grails/orm/hibernate/cfg/GrailsHibernateUtil.java#L206-L224 |
j256/simplecsv | src/main/java/com/j256/simplecsv/processor/CsvProcessor.java | CsvProcessor.validateHeader | public boolean validateHeader(String line, ParseError parseError) throws ParseException {
"""
Validate the header row against the configured header columns.
@param line
Line to process to get our validate our header.
@param parseError
If not null, this will be set with the first parse error and it will return null. If this is null then
a ParseException will be thrown instead.
@return true if the header matched the column names configured here otherwise false.
@throws ParseException
Thrown on any parsing problems. If parseError is not null then the error will be added there and an
exception should not be thrown.
"""
checkEntityConfig();
String[] columns = processHeader(line, parseError);
return validateHeaderColumns(columns, parseError, 1);
} | java | public boolean validateHeader(String line, ParseError parseError) throws ParseException {
checkEntityConfig();
String[] columns = processHeader(line, parseError);
return validateHeaderColumns(columns, parseError, 1);
} | [
"public",
"boolean",
"validateHeader",
"(",
"String",
"line",
",",
"ParseError",
"parseError",
")",
"throws",
"ParseException",
"{",
"checkEntityConfig",
"(",
")",
";",
"String",
"[",
"]",
"columns",
"=",
"processHeader",
"(",
"line",
",",
"parseError",
")",
";",
"return",
"validateHeaderColumns",
"(",
"columns",
",",
"parseError",
",",
"1",
")",
";",
"}"
] | Validate the header row against the configured header columns.
@param line
Line to process to get our validate our header.
@param parseError
If not null, this will be set with the first parse error and it will return null. If this is null then
a ParseException will be thrown instead.
@return true if the header matched the column names configured here otherwise false.
@throws ParseException
Thrown on any parsing problems. If parseError is not null then the error will be added there and an
exception should not be thrown. | [
"Validate",
"the",
"header",
"row",
"against",
"the",
"configured",
"header",
"columns",
"."
] | train | https://github.com/j256/simplecsv/blob/964fe53073c43e2a311341e3f8fd2c94372f60cb/src/main/java/com/j256/simplecsv/processor/CsvProcessor.java#L327-L331 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/v1beta1/GrafeasV1Beta1Client.java | GrafeasV1Beta1Client.listNoteOccurrences | public final ListNoteOccurrencesPagedResponse listNoteOccurrences(NoteName name, String filter) {
"""
Lists occurrences referencing the specified note. Provider projects can use this method to get
all occurrences across consumer projects referencing the specified note.
<p>Sample code:
<pre><code>
try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) {
NoteName name = NoteName.of("[PROJECT]", "[NOTE]");
String filter = "";
for (Occurrence element : grafeasV1Beta1Client.listNoteOccurrences(name, filter).iterateAll()) {
// doThingsWith(element);
}
}
</code></pre>
@param name The name of the note to list occurrences for in the form of
`projects/[PROVIDER_ID]/notes/[NOTE_ID]`.
@param filter The filter expression.
@throws com.google.api.gax.rpc.ApiException if the remote call fails
"""
ListNoteOccurrencesRequest request =
ListNoteOccurrencesRequest.newBuilder()
.setName(name == null ? null : name.toString())
.setFilter(filter)
.build();
return listNoteOccurrences(request);
} | java | public final ListNoteOccurrencesPagedResponse listNoteOccurrences(NoteName name, String filter) {
ListNoteOccurrencesRequest request =
ListNoteOccurrencesRequest.newBuilder()
.setName(name == null ? null : name.toString())
.setFilter(filter)
.build();
return listNoteOccurrences(request);
} | [
"public",
"final",
"ListNoteOccurrencesPagedResponse",
"listNoteOccurrences",
"(",
"NoteName",
"name",
",",
"String",
"filter",
")",
"{",
"ListNoteOccurrencesRequest",
"request",
"=",
"ListNoteOccurrencesRequest",
".",
"newBuilder",
"(",
")",
".",
"setName",
"(",
"name",
"==",
"null",
"?",
"null",
":",
"name",
".",
"toString",
"(",
")",
")",
".",
"setFilter",
"(",
"filter",
")",
".",
"build",
"(",
")",
";",
"return",
"listNoteOccurrences",
"(",
"request",
")",
";",
"}"
] | Lists occurrences referencing the specified note. Provider projects can use this method to get
all occurrences across consumer projects referencing the specified note.
<p>Sample code:
<pre><code>
try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) {
NoteName name = NoteName.of("[PROJECT]", "[NOTE]");
String filter = "";
for (Occurrence element : grafeasV1Beta1Client.listNoteOccurrences(name, filter).iterateAll()) {
// doThingsWith(element);
}
}
</code></pre>
@param name The name of the note to list occurrences for in the form of
`projects/[PROVIDER_ID]/notes/[NOTE_ID]`.
@param filter The filter expression.
@throws com.google.api.gax.rpc.ApiException if the remote call fails | [
"Lists",
"occurrences",
"referencing",
"the",
"specified",
"note",
".",
"Provider",
"projects",
"can",
"use",
"this",
"method",
"to",
"get",
"all",
"occurrences",
"across",
"consumer",
"projects",
"referencing",
"the",
"specified",
"note",
"."
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/v1beta1/GrafeasV1Beta1Client.java#L1618-L1625 |
gallandarakhneorg/afc | advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/StandardRoadConnection.java | StandardRoadConnection.setPosition | void setPosition(Point2D<?, ?> position) {
"""
Set the temporary buffer of the position of the road connection.
@param position a position.
@since 4.0
"""
this.location = position == null ? null : new SoftReference<>(Point2d.convert(position));
} | java | void setPosition(Point2D<?, ?> position) {
this.location = position == null ? null : new SoftReference<>(Point2d.convert(position));
} | [
"void",
"setPosition",
"(",
"Point2D",
"<",
"?",
",",
"?",
">",
"position",
")",
"{",
"this",
".",
"location",
"=",
"position",
"==",
"null",
"?",
"null",
":",
"new",
"SoftReference",
"<>",
"(",
"Point2d",
".",
"convert",
"(",
"position",
")",
")",
";",
"}"
] | Set the temporary buffer of the position of the road connection.
@param position a position.
@since 4.0 | [
"Set",
"the",
"temporary",
"buffer",
"of",
"the",
"position",
"of",
"the",
"road",
"connection",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/StandardRoadConnection.java#L226-L228 |
line/armeria | jetty/src/main/java/com/linecorp/armeria/server/jetty/JettyService.java | JettyService.forServer | public static JettyService forServer(String hostname, Server jettyServer) {
"""
Creates a new {@link JettyService} from an existing Jetty {@link Server}.
@param hostname the default hostname
@param jettyServer the Jetty {@link Server}
"""
requireNonNull(hostname, "hostname");
requireNonNull(jettyServer, "jettyServer");
return new JettyService(hostname, blockingTaskExecutor -> jettyServer);
} | java | public static JettyService forServer(String hostname, Server jettyServer) {
requireNonNull(hostname, "hostname");
requireNonNull(jettyServer, "jettyServer");
return new JettyService(hostname, blockingTaskExecutor -> jettyServer);
} | [
"public",
"static",
"JettyService",
"forServer",
"(",
"String",
"hostname",
",",
"Server",
"jettyServer",
")",
"{",
"requireNonNull",
"(",
"hostname",
",",
"\"hostname\"",
")",
";",
"requireNonNull",
"(",
"jettyServer",
",",
"\"jettyServer\"",
")",
";",
"return",
"new",
"JettyService",
"(",
"hostname",
",",
"blockingTaskExecutor",
"->",
"jettyServer",
")",
";",
"}"
] | Creates a new {@link JettyService} from an existing Jetty {@link Server}.
@param hostname the default hostname
@param jettyServer the Jetty {@link Server} | [
"Creates",
"a",
"new",
"{",
"@link",
"JettyService",
"}",
"from",
"an",
"existing",
"Jetty",
"{",
"@link",
"Server",
"}",
"."
] | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/jetty/src/main/java/com/linecorp/armeria/server/jetty/JettyService.java#L94-L98 |
EdwardRaff/JSAT | JSAT/src/jsat/distributions/multivariate/NormalM.java | NormalM.setMeanCovariance | public void setMeanCovariance(Vec mean, Matrix covariance) {
"""
Sets the mean and covariance for this distribution. For an <i>n</i> dimensional distribution,
<tt>mean</tt> should be of length <i>n</i> and <tt>covariance</tt> should be an <i>n</i> by <i>n</i> matrix.
It is also a requirement that the matrix be symmetric positive definite.
@param mean the mean for the distribution. A copy will be used.
@param covariance the covariance for this distribution. A copy will be used.
@throws ArithmeticException if the <tt>mean</tt> and <tt>covariance</tt> do not agree, or the covariance is not
positive definite. An exception may not be throw for all bad matrices.
"""
if(!covariance.isSquare())
throw new ArithmeticException("Covariance matrix must be square");
else if(mean.length() != covariance.rows())
throw new ArithmeticException("The mean vector and matrix must have the same dimension," +
mean.length() + " does not match [" + covariance.rows() + ", " + covariance.rows() +"]" );
//Else, we are good!
this.mean = mean.clone();
setCovariance(covariance);
} | java | public void setMeanCovariance(Vec mean, Matrix covariance)
{
if(!covariance.isSquare())
throw new ArithmeticException("Covariance matrix must be square");
else if(mean.length() != covariance.rows())
throw new ArithmeticException("The mean vector and matrix must have the same dimension," +
mean.length() + " does not match [" + covariance.rows() + ", " + covariance.rows() +"]" );
//Else, we are good!
this.mean = mean.clone();
setCovariance(covariance);
} | [
"public",
"void",
"setMeanCovariance",
"(",
"Vec",
"mean",
",",
"Matrix",
"covariance",
")",
"{",
"if",
"(",
"!",
"covariance",
".",
"isSquare",
"(",
")",
")",
"throw",
"new",
"ArithmeticException",
"(",
"\"Covariance matrix must be square\"",
")",
";",
"else",
"if",
"(",
"mean",
".",
"length",
"(",
")",
"!=",
"covariance",
".",
"rows",
"(",
")",
")",
"throw",
"new",
"ArithmeticException",
"(",
"\"The mean vector and matrix must have the same dimension,\"",
"+",
"mean",
".",
"length",
"(",
")",
"+",
"\" does not match [\"",
"+",
"covariance",
".",
"rows",
"(",
")",
"+",
"\", \"",
"+",
"covariance",
".",
"rows",
"(",
")",
"+",
"\"]\"",
")",
";",
"//Else, we are good!",
"this",
".",
"mean",
"=",
"mean",
".",
"clone",
"(",
")",
";",
"setCovariance",
"(",
"covariance",
")",
";",
"}"
] | Sets the mean and covariance for this distribution. For an <i>n</i> dimensional distribution,
<tt>mean</tt> should be of length <i>n</i> and <tt>covariance</tt> should be an <i>n</i> by <i>n</i> matrix.
It is also a requirement that the matrix be symmetric positive definite.
@param mean the mean for the distribution. A copy will be used.
@param covariance the covariance for this distribution. A copy will be used.
@throws ArithmeticException if the <tt>mean</tt> and <tt>covariance</tt> do not agree, or the covariance is not
positive definite. An exception may not be throw for all bad matrices. | [
"Sets",
"the",
"mean",
"and",
"covariance",
"for",
"this",
"distribution",
".",
"For",
"an",
"<i",
">",
"n<",
"/",
"i",
">",
"dimensional",
"distribution",
"<tt",
">",
"mean<",
"/",
"tt",
">",
"should",
"be",
"of",
"length",
"<i",
">",
"n<",
"/",
"i",
">",
"and",
"<tt",
">",
"covariance<",
"/",
"tt",
">",
"should",
"be",
"an",
"<i",
">",
"n<",
"/",
"i",
">",
"by",
"<i",
">",
"n<",
"/",
"i",
">",
"matrix",
".",
"It",
"is",
"also",
"a",
"requirement",
"that",
"the",
"matrix",
"be",
"symmetric",
"positive",
"definite",
"."
] | train | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/distributions/multivariate/NormalM.java#L77-L87 |
OpenLiberty/open-liberty | dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/RecoveryDirectorImpl.java | RecoveryDirectorImpl.initializationOutstanding | private boolean initializationOutstanding(RecoveryAgent recoveryAgent, FailureScope failureScope) {
"""
<p>
Internal method to determine if there is an outstanding 'serialRecoveryComplete'
call that must be issued by the client service represented by the supplied
RecoveryAgent for the given failure scope.
</p>
<p>
Just prior to requesting a RecoveryAgent to "initiateRecovery" of a
FailureScope, the addInitializationRecord method is driven to record the
request. When the client service completes the serial portion of the recovery
process and invokes serialRecoveryComplete, the removeInitializationRecord method
is called to remove this record.
</p>
<p>
This allows the RLS to track the "serial" portion of an ongoing recovery process.
</p>
<p>
[ SERIAL PHASE ] [ INITIAL PHASE ] [ RETRY PHASE ]
</p>
@param recoveryAgent The RecoveryAgent.
@param failureScope The FailureScope.
@return boolean true if there is an oustanding recovery request, otherwise false.
"""
if (tc.isEntryEnabled())
Tr.entry(tc, "initializationOutstanding", new Object[] { recoveryAgent, failureScope, this });
boolean outstanding = false;
synchronized (_outstandingInitializationRecords) {
// Extract the set of failure scopes that the corrisponding client service is currently
// processing.
final HashSet failureScopeSet = _outstandingInitializationRecords.get(recoveryAgent);
// If there are some then determine if the set contains the given FailureScope.
if (failureScopeSet != null) {
outstanding = failureScopeSet.contains(failureScope);
}
}
if (tc.isEntryEnabled())
Tr.exit(tc, "initializationOutstanding", outstanding);
return outstanding;
} | java | private boolean initializationOutstanding(RecoveryAgent recoveryAgent, FailureScope failureScope) {
if (tc.isEntryEnabled())
Tr.entry(tc, "initializationOutstanding", new Object[] { recoveryAgent, failureScope, this });
boolean outstanding = false;
synchronized (_outstandingInitializationRecords) {
// Extract the set of failure scopes that the corrisponding client service is currently
// processing.
final HashSet failureScopeSet = _outstandingInitializationRecords.get(recoveryAgent);
// If there are some then determine if the set contains the given FailureScope.
if (failureScopeSet != null) {
outstanding = failureScopeSet.contains(failureScope);
}
}
if (tc.isEntryEnabled())
Tr.exit(tc, "initializationOutstanding", outstanding);
return outstanding;
} | [
"private",
"boolean",
"initializationOutstanding",
"(",
"RecoveryAgent",
"recoveryAgent",
",",
"FailureScope",
"failureScope",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"initializationOutstanding\"",
",",
"new",
"Object",
"[",
"]",
"{",
"recoveryAgent",
",",
"failureScope",
",",
"this",
"}",
")",
";",
"boolean",
"outstanding",
"=",
"false",
";",
"synchronized",
"(",
"_outstandingInitializationRecords",
")",
"{",
"// Extract the set of failure scopes that the corrisponding client service is currently",
"// processing.",
"final",
"HashSet",
"failureScopeSet",
"=",
"_outstandingInitializationRecords",
".",
"get",
"(",
"recoveryAgent",
")",
";",
"// If there are some then determine if the set contains the given FailureScope.",
"if",
"(",
"failureScopeSet",
"!=",
"null",
")",
"{",
"outstanding",
"=",
"failureScopeSet",
".",
"contains",
"(",
"failureScope",
")",
";",
"}",
"}",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"exit",
"(",
"tc",
",",
"\"initializationOutstanding\"",
",",
"outstanding",
")",
";",
"return",
"outstanding",
";",
"}"
] | <p>
Internal method to determine if there is an outstanding 'serialRecoveryComplete'
call that must be issued by the client service represented by the supplied
RecoveryAgent for the given failure scope.
</p>
<p>
Just prior to requesting a RecoveryAgent to "initiateRecovery" of a
FailureScope, the addInitializationRecord method is driven to record the
request. When the client service completes the serial portion of the recovery
process and invokes serialRecoveryComplete, the removeInitializationRecord method
is called to remove this record.
</p>
<p>
This allows the RLS to track the "serial" portion of an ongoing recovery process.
</p>
<p>
[ SERIAL PHASE ] [ INITIAL PHASE ] [ RETRY PHASE ]
</p>
@param recoveryAgent The RecoveryAgent.
@param failureScope The FailureScope.
@return boolean true if there is an oustanding recovery request, otherwise false. | [
"<p",
">",
"Internal",
"method",
"to",
"determine",
"if",
"there",
"is",
"an",
"outstanding",
"serialRecoveryComplete",
"call",
"that",
"must",
"be",
"issued",
"by",
"the",
"client",
"service",
"represented",
"by",
"the",
"supplied",
"RecoveryAgent",
"for",
"the",
"given",
"failure",
"scope",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.recoverylog/src/com/ibm/ws/recoverylog/spi/RecoveryDirectorImpl.java#L1049-L1069 |
kuujo/vertigo | core/src/main/java/net/kuujo/vertigo/util/Components.java | Components.createComponent | public static Component createComponent(Vertx vertx, Container container) {
"""
Creates a component instance for the current Vert.x instance.
"""
InstanceContext context = parseContext(container.config());
return new DefaultComponentFactory().setVertx(vertx).setContainer(container).createComponent(context, new DefaultCluster(context.component().network().cluster(), vertx, container));
} | java | public static Component createComponent(Vertx vertx, Container container) {
InstanceContext context = parseContext(container.config());
return new DefaultComponentFactory().setVertx(vertx).setContainer(container).createComponent(context, new DefaultCluster(context.component().network().cluster(), vertx, container));
} | [
"public",
"static",
"Component",
"createComponent",
"(",
"Vertx",
"vertx",
",",
"Container",
"container",
")",
"{",
"InstanceContext",
"context",
"=",
"parseContext",
"(",
"container",
".",
"config",
"(",
")",
")",
";",
"return",
"new",
"DefaultComponentFactory",
"(",
")",
".",
"setVertx",
"(",
"vertx",
")",
".",
"setContainer",
"(",
"container",
")",
".",
"createComponent",
"(",
"context",
",",
"new",
"DefaultCluster",
"(",
"context",
".",
"component",
"(",
")",
".",
"network",
"(",
")",
".",
"cluster",
"(",
")",
",",
"vertx",
",",
"container",
")",
")",
";",
"}"
] | Creates a component instance for the current Vert.x instance. | [
"Creates",
"a",
"component",
"instance",
"for",
"the",
"current",
"Vert",
".",
"x",
"instance",
"."
] | train | https://github.com/kuujo/vertigo/blob/c5869dbc5fff89eb5262e83f7a81719b01a5ba6f/core/src/main/java/net/kuujo/vertigo/util/Components.java#L74-L77 |
lmdbjava/lmdbjava | src/main/java/org/lmdbjava/KeyVal.java | KeyVal.valInMulti | Pointer valInMulti(final T val, final int elements) {
"""
Prepares an array suitable for presentation as the data argument to a
<code>MDB_MULTIPLE</code> put.
<p>
The returned array is equivalent of two <code>MDB_val</code>s as follows:
<ul>
<li>ptrVal1.data = pointer to the data address of passed buffer</li>
<li>ptrVal1.size = size of each individual data element</li>
<li>ptrVal2.data = unused</li>
<li>ptrVal2.size = number of data elements (as passed to this method)</li>
</ul>
@param val a user-provided buffer with data elements (required)
@param elements number of data elements the user has provided
@return a properly-prepared pointer to an array for the operation
"""
final long ptrVal2SizeOff = MDB_VAL_STRUCT_SIZE + STRUCT_FIELD_OFFSET_SIZE;
ptrArray.putLong(ptrVal2SizeOff, elements); // ptrVal2.size
proxy.in(val, ptrVal, ptrValAddr); // ptrVal1.data
final long totalBufferSize = ptrVal.getLong(STRUCT_FIELD_OFFSET_SIZE);
final long elemSize = totalBufferSize / elements;
ptrVal.putLong(STRUCT_FIELD_OFFSET_SIZE, elemSize); // ptrVal1.size
return ptrArray;
} | java | Pointer valInMulti(final T val, final int elements) {
final long ptrVal2SizeOff = MDB_VAL_STRUCT_SIZE + STRUCT_FIELD_OFFSET_SIZE;
ptrArray.putLong(ptrVal2SizeOff, elements); // ptrVal2.size
proxy.in(val, ptrVal, ptrValAddr); // ptrVal1.data
final long totalBufferSize = ptrVal.getLong(STRUCT_FIELD_OFFSET_SIZE);
final long elemSize = totalBufferSize / elements;
ptrVal.putLong(STRUCT_FIELD_OFFSET_SIZE, elemSize); // ptrVal1.size
return ptrArray;
} | [
"Pointer",
"valInMulti",
"(",
"final",
"T",
"val",
",",
"final",
"int",
"elements",
")",
"{",
"final",
"long",
"ptrVal2SizeOff",
"=",
"MDB_VAL_STRUCT_SIZE",
"+",
"STRUCT_FIELD_OFFSET_SIZE",
";",
"ptrArray",
".",
"putLong",
"(",
"ptrVal2SizeOff",
",",
"elements",
")",
";",
"// ptrVal2.size",
"proxy",
".",
"in",
"(",
"val",
",",
"ptrVal",
",",
"ptrValAddr",
")",
";",
"// ptrVal1.data",
"final",
"long",
"totalBufferSize",
"=",
"ptrVal",
".",
"getLong",
"(",
"STRUCT_FIELD_OFFSET_SIZE",
")",
";",
"final",
"long",
"elemSize",
"=",
"totalBufferSize",
"/",
"elements",
";",
"ptrVal",
".",
"putLong",
"(",
"STRUCT_FIELD_OFFSET_SIZE",
",",
"elemSize",
")",
";",
"// ptrVal1.size",
"return",
"ptrArray",
";",
"}"
] | Prepares an array suitable for presentation as the data argument to a
<code>MDB_MULTIPLE</code> put.
<p>
The returned array is equivalent of two <code>MDB_val</code>s as follows:
<ul>
<li>ptrVal1.data = pointer to the data address of passed buffer</li>
<li>ptrVal1.size = size of each individual data element</li>
<li>ptrVal2.data = unused</li>
<li>ptrVal2.size = number of data elements (as passed to this method)</li>
</ul>
@param val a user-provided buffer with data elements (required)
@param elements number of data elements the user has provided
@return a properly-prepared pointer to an array for the operation | [
"Prepares",
"an",
"array",
"suitable",
"for",
"presentation",
"as",
"the",
"data",
"argument",
"to",
"a",
"<code",
">",
"MDB_MULTIPLE<",
"/",
"code",
">",
"put",
"."
] | train | https://github.com/lmdbjava/lmdbjava/blob/5912beb1037722c71f3ddc05e70fcbe739dfa272/src/main/java/org/lmdbjava/KeyVal.java#L121-L130 |
j256/ormlite-core | src/main/java/com/j256/ormlite/stmt/mapped/MappedDeleteCollection.java | MappedDeleteCollection.deleteIds | public static <T, ID> int deleteIds(Dao<T, ID> dao, TableInfo<T, ID> tableInfo,
DatabaseConnection databaseConnection, Collection<ID> ids, ObjectCache objectCache) throws SQLException {
"""
Delete all of the objects in the collection. This builds a {@link MappedDeleteCollection} on the fly because the
ids could be variable sized.
"""
MappedDeleteCollection<T, ID> deleteCollection = MappedDeleteCollection.build(dao, tableInfo, ids.size());
Object[] fieldObjects = new Object[ids.size()];
FieldType idField = tableInfo.getIdField();
int objC = 0;
for (ID id : ids) {
fieldObjects[objC] = idField.convertJavaFieldToSqlArgValue(id);
objC++;
}
return updateRows(databaseConnection, tableInfo.getDataClass(), deleteCollection, fieldObjects, objectCache);
} | java | public static <T, ID> int deleteIds(Dao<T, ID> dao, TableInfo<T, ID> tableInfo,
DatabaseConnection databaseConnection, Collection<ID> ids, ObjectCache objectCache) throws SQLException {
MappedDeleteCollection<T, ID> deleteCollection = MappedDeleteCollection.build(dao, tableInfo, ids.size());
Object[] fieldObjects = new Object[ids.size()];
FieldType idField = tableInfo.getIdField();
int objC = 0;
for (ID id : ids) {
fieldObjects[objC] = idField.convertJavaFieldToSqlArgValue(id);
objC++;
}
return updateRows(databaseConnection, tableInfo.getDataClass(), deleteCollection, fieldObjects, objectCache);
} | [
"public",
"static",
"<",
"T",
",",
"ID",
">",
"int",
"deleteIds",
"(",
"Dao",
"<",
"T",
",",
"ID",
">",
"dao",
",",
"TableInfo",
"<",
"T",
",",
"ID",
">",
"tableInfo",
",",
"DatabaseConnection",
"databaseConnection",
",",
"Collection",
"<",
"ID",
">",
"ids",
",",
"ObjectCache",
"objectCache",
")",
"throws",
"SQLException",
"{",
"MappedDeleteCollection",
"<",
"T",
",",
"ID",
">",
"deleteCollection",
"=",
"MappedDeleteCollection",
".",
"build",
"(",
"dao",
",",
"tableInfo",
",",
"ids",
".",
"size",
"(",
")",
")",
";",
"Object",
"[",
"]",
"fieldObjects",
"=",
"new",
"Object",
"[",
"ids",
".",
"size",
"(",
")",
"]",
";",
"FieldType",
"idField",
"=",
"tableInfo",
".",
"getIdField",
"(",
")",
";",
"int",
"objC",
"=",
"0",
";",
"for",
"(",
"ID",
"id",
":",
"ids",
")",
"{",
"fieldObjects",
"[",
"objC",
"]",
"=",
"idField",
".",
"convertJavaFieldToSqlArgValue",
"(",
"id",
")",
";",
"objC",
"++",
";",
"}",
"return",
"updateRows",
"(",
"databaseConnection",
",",
"tableInfo",
".",
"getDataClass",
"(",
")",
",",
"deleteCollection",
",",
"fieldObjects",
",",
"objectCache",
")",
";",
"}"
] | Delete all of the objects in the collection. This builds a {@link MappedDeleteCollection} on the fly because the
ids could be variable sized. | [
"Delete",
"all",
"of",
"the",
"objects",
"in",
"the",
"collection",
".",
"This",
"builds",
"a",
"{"
] | train | https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/mapped/MappedDeleteCollection.java#L47-L58 |
comapi/comapi-sdk-android | COMAPI/foundation/src/main/java/com/comapi/internal/network/InternalService.java | InternalService.getConversations | @Deprecated
public Observable<ComapiResult<List<ConversationDetails>>> getConversations(@NonNull final Scope scope) {
"""
Returns observable to get all visible conversations.
@param scope {@link Scope} of the query
@return Observable to to create a conversation.
@deprecated Please use {@link InternalService#getConversations(boolean)} instead.
"""
final String token = getToken();
if (sessionController.isCreatingSession()) {
return getTaskQueue().queueGetConversations(scope);
} else if (TextUtils.isEmpty(token)) {
return Observable.error(getSessionStateErrorDescription());
} else {
return doGetConversations(token, dataMgr.getSessionDAO().session().getProfileId(), scope).map(result -> {
List<ConversationDetails> newList = new ArrayList<>();
List<Conversation> oldList = result.getResult();
if (oldList != null && !oldList.isEmpty()) {
newList.addAll(oldList);
}
return new ComapiResult<>(result, newList);
});
}
} | java | @Deprecated
public Observable<ComapiResult<List<ConversationDetails>>> getConversations(@NonNull final Scope scope) {
final String token = getToken();
if (sessionController.isCreatingSession()) {
return getTaskQueue().queueGetConversations(scope);
} else if (TextUtils.isEmpty(token)) {
return Observable.error(getSessionStateErrorDescription());
} else {
return doGetConversations(token, dataMgr.getSessionDAO().session().getProfileId(), scope).map(result -> {
List<ConversationDetails> newList = new ArrayList<>();
List<Conversation> oldList = result.getResult();
if (oldList != null && !oldList.isEmpty()) {
newList.addAll(oldList);
}
return new ComapiResult<>(result, newList);
});
}
} | [
"@",
"Deprecated",
"public",
"Observable",
"<",
"ComapiResult",
"<",
"List",
"<",
"ConversationDetails",
">",
">",
">",
"getConversations",
"(",
"@",
"NonNull",
"final",
"Scope",
"scope",
")",
"{",
"final",
"String",
"token",
"=",
"getToken",
"(",
")",
";",
"if",
"(",
"sessionController",
".",
"isCreatingSession",
"(",
")",
")",
"{",
"return",
"getTaskQueue",
"(",
")",
".",
"queueGetConversations",
"(",
"scope",
")",
";",
"}",
"else",
"if",
"(",
"TextUtils",
".",
"isEmpty",
"(",
"token",
")",
")",
"{",
"return",
"Observable",
".",
"error",
"(",
"getSessionStateErrorDescription",
"(",
")",
")",
";",
"}",
"else",
"{",
"return",
"doGetConversations",
"(",
"token",
",",
"dataMgr",
".",
"getSessionDAO",
"(",
")",
".",
"session",
"(",
")",
".",
"getProfileId",
"(",
")",
",",
"scope",
")",
".",
"map",
"(",
"result",
"->",
"{",
"List",
"<",
"ConversationDetails",
">",
"newList",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"List",
"<",
"Conversation",
">",
"oldList",
"=",
"result",
".",
"getResult",
"(",
")",
";",
"if",
"(",
"oldList",
"!=",
"null",
"&&",
"!",
"oldList",
".",
"isEmpty",
"(",
")",
")",
"{",
"newList",
".",
"addAll",
"(",
"oldList",
")",
";",
"}",
"return",
"new",
"ComapiResult",
"<>",
"(",
"result",
",",
"newList",
")",
";",
"}",
")",
";",
"}",
"}"
] | Returns observable to get all visible conversations.
@param scope {@link Scope} of the query
@return Observable to to create a conversation.
@deprecated Please use {@link InternalService#getConversations(boolean)} instead. | [
"Returns",
"observable",
"to",
"get",
"all",
"visible",
"conversations",
"."
] | train | https://github.com/comapi/comapi-sdk-android/blob/53140a58d5a62afe196047ccc5120bfe090ef211/COMAPI/foundation/src/main/java/com/comapi/internal/network/InternalService.java#L504-L523 |
playn/playn | core/src/playn/core/json/JsonObject.java | JsonObject.getDouble | public double getDouble(String key, double default_) {
"""
Returns the {@link Double} at the given key, or the default if it does not exist or is the
wrong type.
"""
Object o = get(key);
return o instanceof Number ? ((Number) o).doubleValue() : default_;
} | java | public double getDouble(String key, double default_) {
Object o = get(key);
return o instanceof Number ? ((Number) o).doubleValue() : default_;
} | [
"public",
"double",
"getDouble",
"(",
"String",
"key",
",",
"double",
"default_",
")",
"{",
"Object",
"o",
"=",
"get",
"(",
"key",
")",
";",
"return",
"o",
"instanceof",
"Number",
"?",
"(",
"(",
"Number",
")",
"o",
")",
".",
"doubleValue",
"(",
")",
":",
"default_",
";",
"}"
] | Returns the {@link Double} at the given key, or the default if it does not exist or is the
wrong type. | [
"Returns",
"the",
"{"
] | train | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/core/src/playn/core/json/JsonObject.java#L91-L94 |
apache/incubator-gobblin | gobblin-utility/src/main/java/org/apache/gobblin/util/filesystem/FileSystemInstrumentationFactory.java | FileSystemInstrumentationFactory.instrumentFileSystem | public FileSystem instrumentFileSystem(FileSystem fs, SharedResourcesBroker<S> broker, ConfigView<S, FileSystemKey> config) {
"""
Return an instrumented version of the input {@link FileSystem}. Generally, this will return a decorator for the
input {@link FileSystem}. If the instrumentation will be a no-op (due to, for example, configuration), it is
recommended to return the input {@link FileSystem} directly for performance.
"""
return fs;
} | java | public FileSystem instrumentFileSystem(FileSystem fs, SharedResourcesBroker<S> broker, ConfigView<S, FileSystemKey> config) {
return fs;
} | [
"public",
"FileSystem",
"instrumentFileSystem",
"(",
"FileSystem",
"fs",
",",
"SharedResourcesBroker",
"<",
"S",
">",
"broker",
",",
"ConfigView",
"<",
"S",
",",
"FileSystemKey",
">",
"config",
")",
"{",
"return",
"fs",
";",
"}"
] | Return an instrumented version of the input {@link FileSystem}. Generally, this will return a decorator for the
input {@link FileSystem}. If the instrumentation will be a no-op (due to, for example, configuration), it is
recommended to return the input {@link FileSystem} directly for performance. | [
"Return",
"an",
"instrumented",
"version",
"of",
"the",
"input",
"{"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/filesystem/FileSystemInstrumentationFactory.java#L39-L41 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/impl/MatchSpaceImpl.java | MatchSpaceImpl.clear | public synchronized void clear(Identifier rootId, boolean enableCache) {
"""
Removes all objects from the MatchSpace, resetting it to the 'as new'
condition.
"""
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
tc.entry(this,cclass, "clear");
matchTree = null;
matchTreeGeneration = 0;
subExpr.clear();
// Now reinitialise the matchspace
initialise(rootId, enableCache);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
tc.exit(this,cclass, "clear");
} | java | public synchronized void clear(Identifier rootId, boolean enableCache)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
tc.entry(this,cclass, "clear");
matchTree = null;
matchTreeGeneration = 0;
subExpr.clear();
// Now reinitialise the matchspace
initialise(rootId, enableCache);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
tc.exit(this,cclass, "clear");
} | [
"public",
"synchronized",
"void",
"clear",
"(",
"Identifier",
"rootId",
",",
"boolean",
"enableCache",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"tc",
".",
"entry",
"(",
"this",
",",
"cclass",
",",
"\"clear\"",
")",
";",
"matchTree",
"=",
"null",
";",
"matchTreeGeneration",
"=",
"0",
";",
"subExpr",
".",
"clear",
"(",
")",
";",
"// Now reinitialise the matchspace",
"initialise",
"(",
"rootId",
",",
"enableCache",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"tc",
".",
"exit",
"(",
"this",
",",
"cclass",
",",
"\"clear\"",
")",
";",
"}"
] | Removes all objects from the MatchSpace, resetting it to the 'as new'
condition. | [
"Removes",
"all",
"objects",
"from",
"the",
"MatchSpace",
"resetting",
"it",
"to",
"the",
"as",
"new",
"condition",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/matchspace/impl/MatchSpaceImpl.java#L862-L874 |
Azure/azure-sdk-for-java | appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServicePlansInner.java | AppServicePlansInner.listWebAppsAsync | public Observable<Page<SiteInner>> listWebAppsAsync(final String resourceGroupName, final String name, final String skipToken, final String filter, final String top) {
"""
Get all apps associated with an App Service plan.
Get all apps associated with an App Service plan.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param name Name of the App Service plan.
@param skipToken Skip to a web app in the list of webapps associated with app service plan. If specified, the resulting list will contain web apps starting from (including) the skipToken. Otherwise, the resulting list contains web apps from the start of the list
@param filter Supported filter: $filter=state eq running. Returns only web apps that are currently running
@param top List page size. If specified, results are paged.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<SiteInner> object
"""
return listWebAppsWithServiceResponseAsync(resourceGroupName, name, skipToken, filter, top)
.map(new Func1<ServiceResponse<Page<SiteInner>>, Page<SiteInner>>() {
@Override
public Page<SiteInner> call(ServiceResponse<Page<SiteInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<SiteInner>> listWebAppsAsync(final String resourceGroupName, final String name, final String skipToken, final String filter, final String top) {
return listWebAppsWithServiceResponseAsync(resourceGroupName, name, skipToken, filter, top)
.map(new Func1<ServiceResponse<Page<SiteInner>>, Page<SiteInner>>() {
@Override
public Page<SiteInner> call(ServiceResponse<Page<SiteInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"SiteInner",
">",
">",
"listWebAppsAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"name",
",",
"final",
"String",
"skipToken",
",",
"final",
"String",
"filter",
",",
"final",
"String",
"top",
")",
"{",
"return",
"listWebAppsWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"name",
",",
"skipToken",
",",
"filter",
",",
"top",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"Page",
"<",
"SiteInner",
">",
">",
",",
"Page",
"<",
"SiteInner",
">",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Page",
"<",
"SiteInner",
">",
"call",
"(",
"ServiceResponse",
"<",
"Page",
"<",
"SiteInner",
">",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Get all apps associated with an App Service plan.
Get all apps associated with an App Service plan.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param name Name of the App Service plan.
@param skipToken Skip to a web app in the list of webapps associated with app service plan. If specified, the resulting list will contain web apps starting from (including) the skipToken. Otherwise, the resulting list contains web apps from the start of the list
@param filter Supported filter: $filter=state eq running. Returns only web apps that are currently running
@param top List page size. If specified, results are paged.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<SiteInner> object | [
"Get",
"all",
"apps",
"associated",
"with",
"an",
"App",
"Service",
"plan",
".",
"Get",
"all",
"apps",
"associated",
"with",
"an",
"App",
"Service",
"plan",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServicePlansInner.java#L2546-L2554 |
joelittlejohn/jsonschema2pojo | jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/rules/FormatRule.java | FormatRule.apply | @Override
public JType apply(String nodeName, JsonNode node, JsonNode parent, JType baseType, Schema schema) {
"""
Applies this schema rule to take the required code generation steps.
<p>
This rule maps format values to Java types. By default:
<ul>
<li>"format":"date-time" => {@link java.util.Date} or {@link org.joda.time.DateTime} (if config useJodaDates is set)
<li>"format":"date" => {@link String} or {@link org.joda.time.LocalDate} (if config useJodaLocalDates is set)
<li>"format":"time" => {@link String} or {@link org.joda.time.LocalTime} (if config useJodaLocalTimes is set)
<li>"format":"utc-millisec" => <code>long</code>
<li>"format":"regex" => {@link java.util.regex.Pattern}
<li>"format":"color" => {@link String}
<li>"format":"style" => {@link String}
<li>"format":"phone" => {@link String}
<li>"format":"uri" => {@link java.net.URI}
<li>"format":"email" => {@link String}
<li>"format":"ip-address" => {@link String}
<li>"format":"ipv6" => {@link String}
<li>"format":"host-name" => {@link String}
<li>"format":"uuid" => {@link java.util.UUID}
<li>other (unrecognised format) => baseType
</ul>
@param nodeName
the name of the node to which this format is applied
@param node
the format node
@param parent
the parent node
@param baseType
the type which which is being formatted e.g. for
<code>{ "type" : "string", "format" : "uri" }</code> the
baseType would be java.lang.String
@return the Java type that is appropriate for the format value
"""
Class<?> type = getType(node.asText());
if (type != null) {
JType jtype = baseType.owner().ref(type);
if (ruleFactory.getGenerationConfig().isUsePrimitives()) {
jtype = jtype.unboxify();
}
return jtype;
} else {
return baseType;
}
} | java | @Override
public JType apply(String nodeName, JsonNode node, JsonNode parent, JType baseType, Schema schema) {
Class<?> type = getType(node.asText());
if (type != null) {
JType jtype = baseType.owner().ref(type);
if (ruleFactory.getGenerationConfig().isUsePrimitives()) {
jtype = jtype.unboxify();
}
return jtype;
} else {
return baseType;
}
} | [
"@",
"Override",
"public",
"JType",
"apply",
"(",
"String",
"nodeName",
",",
"JsonNode",
"node",
",",
"JsonNode",
"parent",
",",
"JType",
"baseType",
",",
"Schema",
"schema",
")",
"{",
"Class",
"<",
"?",
">",
"type",
"=",
"getType",
"(",
"node",
".",
"asText",
"(",
")",
")",
";",
"if",
"(",
"type",
"!=",
"null",
")",
"{",
"JType",
"jtype",
"=",
"baseType",
".",
"owner",
"(",
")",
".",
"ref",
"(",
"type",
")",
";",
"if",
"(",
"ruleFactory",
".",
"getGenerationConfig",
"(",
")",
".",
"isUsePrimitives",
"(",
")",
")",
"{",
"jtype",
"=",
"jtype",
".",
"unboxify",
"(",
")",
";",
"}",
"return",
"jtype",
";",
"}",
"else",
"{",
"return",
"baseType",
";",
"}",
"}"
] | Applies this schema rule to take the required code generation steps.
<p>
This rule maps format values to Java types. By default:
<ul>
<li>"format":"date-time" => {@link java.util.Date} or {@link org.joda.time.DateTime} (if config useJodaDates is set)
<li>"format":"date" => {@link String} or {@link org.joda.time.LocalDate} (if config useJodaLocalDates is set)
<li>"format":"time" => {@link String} or {@link org.joda.time.LocalTime} (if config useJodaLocalTimes is set)
<li>"format":"utc-millisec" => <code>long</code>
<li>"format":"regex" => {@link java.util.regex.Pattern}
<li>"format":"color" => {@link String}
<li>"format":"style" => {@link String}
<li>"format":"phone" => {@link String}
<li>"format":"uri" => {@link java.net.URI}
<li>"format":"email" => {@link String}
<li>"format":"ip-address" => {@link String}
<li>"format":"ipv6" => {@link String}
<li>"format":"host-name" => {@link String}
<li>"format":"uuid" => {@link java.util.UUID}
<li>other (unrecognised format) => baseType
</ul>
@param nodeName
the name of the node to which this format is applied
@param node
the format node
@param parent
the parent node
@param baseType
the type which which is being formatted e.g. for
<code>{ "type" : "string", "format" : "uri" }</code> the
baseType would be java.lang.String
@return the Java type that is appropriate for the format value | [
"Applies",
"this",
"schema",
"rule",
"to",
"take",
"the",
"required",
"code",
"generation",
"steps",
".",
"<p",
">",
"This",
"rule",
"maps",
"format",
"values",
"to",
"Java",
"types",
".",
"By",
"default",
":",
"<ul",
">",
"<li",
">",
"format",
":",
"date",
"-",
"time",
"=",
">",
";",
"{",
"@link",
"java",
".",
"util",
".",
"Date",
"}",
"or",
"{",
"@link",
"org",
".",
"joda",
".",
"time",
".",
"DateTime",
"}",
"(",
"if",
"config",
"useJodaDates",
"is",
"set",
")",
"<li",
">",
"format",
":",
"date",
"=",
">",
";",
"{",
"@link",
"String",
"}",
"or",
"{",
"@link",
"org",
".",
"joda",
".",
"time",
".",
"LocalDate",
"}",
"(",
"if",
"config",
"useJodaLocalDates",
"is",
"set",
")",
"<li",
">",
"format",
":",
"time",
"=",
">",
";",
"{",
"@link",
"String",
"}",
"or",
"{",
"@link",
"org",
".",
"joda",
".",
"time",
".",
"LocalTime",
"}",
"(",
"if",
"config",
"useJodaLocalTimes",
"is",
"set",
")",
"<li",
">",
"format",
":",
"utc",
"-",
"millisec",
"=",
">",
";",
"<code",
">",
"long<",
"/",
"code",
">",
"<li",
">",
"format",
":",
"regex",
"=",
">",
";",
"{",
"@link",
"java",
".",
"util",
".",
"regex",
".",
"Pattern",
"}",
"<li",
">",
"format",
":",
"color",
"=",
">",
";",
"{",
"@link",
"String",
"}",
"<li",
">",
"format",
":",
"style",
"=",
">",
";",
"{",
"@link",
"String",
"}",
"<li",
">",
"format",
":",
"phone",
"=",
">",
";",
"{",
"@link",
"String",
"}",
"<li",
">",
"format",
":",
"uri",
"=",
">",
";",
"{",
"@link",
"java",
".",
"net",
".",
"URI",
"}",
"<li",
">",
"format",
":",
"email",
"=",
">",
";",
"{",
"@link",
"String",
"}",
"<li",
">",
"format",
":",
"ip",
"-",
"address",
"=",
">",
";",
"{",
"@link",
"String",
"}",
"<li",
">",
"format",
":",
"ipv6",
"=",
">",
";",
"{",
"@link",
"String",
"}",
"<li",
">",
"format",
":",
"host",
"-",
"name",
"=",
">",
";",
"{",
"@link",
"String",
"}",
"<li",
">",
"format",
":",
"uuid",
"=",
">",
";",
"{",
"@link",
"java",
".",
"util",
".",
"UUID",
"}",
"<li",
">",
"other",
"(",
"unrecognised",
"format",
")",
"=",
">",
";",
"baseType",
"<",
"/",
"ul",
">"
] | train | https://github.com/joelittlejohn/jsonschema2pojo/blob/0552b80db93214eb186e4ae45b40866cc1e7eb84/jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/rules/FormatRule.java#L93-L106 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDBaseOps.java | SDBaseOps.lte | public SDVariable lte(SDVariable x, SDVariable y) {
"""
Less than or equal to operation: elementwise x <= y<br>
If x and y arrays have equal shape, the output shape is the same as these inputs.<br>
Note: supports broadcasting if x and y have different shapes and are broadcastable.<br>
Returns an array with values 1 where condition is satisfied, or value 0 otherwise.
@param x Input 1
@param y Input 2
@return Output SDVariable with values 0 and 1 based on where the condition is satisfied
"""
return lte(null, x, y);
} | java | public SDVariable lte(SDVariable x, SDVariable y) {
return lte(null, x, y);
} | [
"public",
"SDVariable",
"lte",
"(",
"SDVariable",
"x",
",",
"SDVariable",
"y",
")",
"{",
"return",
"lte",
"(",
"null",
",",
"x",
",",
"y",
")",
";",
"}"
] | Less than or equal to operation: elementwise x <= y<br>
If x and y arrays have equal shape, the output shape is the same as these inputs.<br>
Note: supports broadcasting if x and y have different shapes and are broadcastable.<br>
Returns an array with values 1 where condition is satisfied, or value 0 otherwise.
@param x Input 1
@param y Input 2
@return Output SDVariable with values 0 and 1 based on where the condition is satisfied | [
"Less",
"than",
"or",
"equal",
"to",
"operation",
":",
"elementwise",
"x",
"<",
"=",
"y<br",
">",
"If",
"x",
"and",
"y",
"arrays",
"have",
"equal",
"shape",
"the",
"output",
"shape",
"is",
"the",
"same",
"as",
"these",
"inputs",
".",
"<br",
">",
"Note",
":",
"supports",
"broadcasting",
"if",
"x",
"and",
"y",
"have",
"different",
"shapes",
"and",
"are",
"broadcastable",
".",
"<br",
">",
"Returns",
"an",
"array",
"with",
"values",
"1",
"where",
"condition",
"is",
"satisfied",
"or",
"value",
"0",
"otherwise",
"."
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDBaseOps.java#L946-L948 |
j256/simplejmx | src/main/java/com/j256/simplejmx/client/JmxClient.java | JmxClient.getBeanNames | public Set<ObjectName> getBeanNames() throws JMException {
"""
Return a set of the various bean ObjectName objects associated with the Jmx server.
"""
checkClientConnected();
try {
return mbeanConn.queryNames(null, null);
} catch (IOException e) {
throw createJmException("Problems querying for jmx bean names: " + e, e);
}
} | java | public Set<ObjectName> getBeanNames() throws JMException {
checkClientConnected();
try {
return mbeanConn.queryNames(null, null);
} catch (IOException e) {
throw createJmException("Problems querying for jmx bean names: " + e, e);
}
} | [
"public",
"Set",
"<",
"ObjectName",
">",
"getBeanNames",
"(",
")",
"throws",
"JMException",
"{",
"checkClientConnected",
"(",
")",
";",
"try",
"{",
"return",
"mbeanConn",
".",
"queryNames",
"(",
"null",
",",
"null",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"createJmException",
"(",
"\"Problems querying for jmx bean names: \"",
"+",
"e",
",",
"e",
")",
";",
"}",
"}"
] | Return a set of the various bean ObjectName objects associated with the Jmx server. | [
"Return",
"a",
"set",
"of",
"the",
"various",
"bean",
"ObjectName",
"objects",
"associated",
"with",
"the",
"Jmx",
"server",
"."
] | train | https://github.com/j256/simplejmx/blob/1a04f52512dfa0a711ba0cc7023c604dbc82a352/src/main/java/com/j256/simplejmx/client/JmxClient.java#L216-L223 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.