repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 188 | func_name stringlengths 7 127 | whole_func_string stringlengths 77 3.91k | language stringclasses 1
value | func_code_string stringlengths 77 3.91k | func_code_tokens listlengths 20 745 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 477 | split_name stringclasses 1
value | func_code_url stringlengths 111 288 |
|---|---|---|---|---|---|---|---|---|---|---|
code4everything/util | src/main/java/com/zhazhapan/util/Checker.java | Checker.replace | public static String replace(String string, String oldString, String newString) {
return checkNull(string).replace(oldString, newString);
} | java | public static String replace(String string, String oldString, String newString) {
return checkNull(string).replace(oldString, newString);
} | [
"public",
"static",
"String",
"replace",
"(",
"String",
"string",
",",
"String",
"oldString",
",",
"String",
"newString",
")",
"{",
"return",
"checkNull",
"(",
"string",
")",
".",
"replace",
"(",
"oldString",
",",
"newString",
")",
";",
"}"
] | 替换字符串之前检查字符串是否为空
@param string 需要检测的字符串
@param oldString 需要替换的字符串
@param newString 新的字符串
@return {@link String} | [
"替换字符串之前检查字符串是否为空"
] | train | https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/Checker.java#L834-L836 |
Netflix/zeno | src/main/java/com/netflix/zeno/genericobject/DiffHtmlGenerator.java | DiffHtmlGenerator.generateDiff | public String generateDiff(GenericObject from, GenericObject to) {
StringBuilder builder = new StringBuilder();
builder.append("<table class=\"nomargin diff\">");
builder.append("<thead>");
builder.append("<tr>");
builder.append("<th/>");
builder.append("<th class=\"texttitle\">From</th>");
builder.append("<th/>");
builder.append("<th class=\"texttitle\">To</th>");
builder.append("</tr>");
builder.append("</thead>");
builder.append("<tbody>");
writeDiff(builder, from, to);
builder.append("</tbody>");
builder.append("</table>");
return builder.toString();
} | java | public String generateDiff(GenericObject from, GenericObject to) {
StringBuilder builder = new StringBuilder();
builder.append("<table class=\"nomargin diff\">");
builder.append("<thead>");
builder.append("<tr>");
builder.append("<th/>");
builder.append("<th class=\"texttitle\">From</th>");
builder.append("<th/>");
builder.append("<th class=\"texttitle\">To</th>");
builder.append("</tr>");
builder.append("</thead>");
builder.append("<tbody>");
writeDiff(builder, from, to);
builder.append("</tbody>");
builder.append("</table>");
return builder.toString();
} | [
"public",
"String",
"generateDiff",
"(",
"GenericObject",
"from",
",",
"GenericObject",
"to",
")",
"{",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"builder",
".",
"append",
"(",
"\"<table class=\\\"nomargin diff\\\">\"",
")",
";",
"bui... | Generate the HTML difference between two GenericObjects.
@return | [
"Generate",
"the",
"HTML",
"difference",
"between",
"two",
"GenericObjects",
"."
] | train | https://github.com/Netflix/zeno/blob/e571a3f1e304942724d454408fe6417fe18c20fd/src/main/java/com/netflix/zeno/genericobject/DiffHtmlGenerator.java#L77-L98 |
avarabyeu/restendpoint | src/main/java/com/github/avarabyeu/restendpoint/serializer/StringSerializer.java | StringSerializer.canRead | @Override
public boolean canRead(@Nonnull MediaType mimeType, Class<?> resultType) {
MediaType type = mimeType.withoutParameters();
return (type.is(MediaType.ANY_TEXT_TYPE) || MediaType.APPLICATION_XML_UTF_8.withoutParameters().is(type)
|| MediaType.JSON_UTF_8.withoutParameters().is(type)) && String.class.equals(resultType);
} | java | @Override
public boolean canRead(@Nonnull MediaType mimeType, Class<?> resultType) {
MediaType type = mimeType.withoutParameters();
return (type.is(MediaType.ANY_TEXT_TYPE) || MediaType.APPLICATION_XML_UTF_8.withoutParameters().is(type)
|| MediaType.JSON_UTF_8.withoutParameters().is(type)) && String.class.equals(resultType);
} | [
"@",
"Override",
"public",
"boolean",
"canRead",
"(",
"@",
"Nonnull",
"MediaType",
"mimeType",
",",
"Class",
"<",
"?",
">",
"resultType",
")",
"{",
"MediaType",
"type",
"=",
"mimeType",
".",
"withoutParameters",
"(",
")",
";",
"return",
"(",
"type",
".",
... | Checks whether mime types is supported by this serializer implementation | [
"Checks",
"whether",
"mime",
"types",
"is",
"supported",
"by",
"this",
"serializer",
"implementation"
] | train | https://github.com/avarabyeu/restendpoint/blob/e11fc0813ea4cefbe4d8bca292cd48b40abf185d/src/main/java/com/github/avarabyeu/restendpoint/serializer/StringSerializer.java#L77-L82 |
Alluxio/alluxio | shell/src/main/java/alluxio/cli/fs/FileSystemShellUtils.java | FileSystemShellUtils.getFilePath | public static String getFilePath(String path, AlluxioConfiguration alluxioConf)
throws IOException {
path = validatePath(path, alluxioConf);
if (path.startsWith(Constants.HEADER)) {
path = path.substring(Constants.HEADER.length());
} else if (path.startsWith(Constants.HEADER_FT)) {
path = path.substring(Constants.HEADER_FT.length());
}
return path.substring(path.indexOf(AlluxioURI.SEPARATOR));
} | java | public static String getFilePath(String path, AlluxioConfiguration alluxioConf)
throws IOException {
path = validatePath(path, alluxioConf);
if (path.startsWith(Constants.HEADER)) {
path = path.substring(Constants.HEADER.length());
} else if (path.startsWith(Constants.HEADER_FT)) {
path = path.substring(Constants.HEADER_FT.length());
}
return path.substring(path.indexOf(AlluxioURI.SEPARATOR));
} | [
"public",
"static",
"String",
"getFilePath",
"(",
"String",
"path",
",",
"AlluxioConfiguration",
"alluxioConf",
")",
"throws",
"IOException",
"{",
"path",
"=",
"validatePath",
"(",
"path",
",",
"alluxioConf",
")",
";",
"if",
"(",
"path",
".",
"startsWith",
"("... | Removes {@link Constants#HEADER} / {@link Constants#HEADER_FT} and hostname:port information
from a path, leaving only the local file path.
@param path the path to obtain the local path from
@param alluxioConf Alluxio configuration
@return the local path in string format | [
"Removes",
"{",
"@link",
"Constants#HEADER",
"}",
"/",
"{",
"@link",
"Constants#HEADER_FT",
"}",
"and",
"hostname",
":",
"port",
"information",
"from",
"a",
"path",
"leaving",
"only",
"the",
"local",
"file",
"path",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/shell/src/main/java/alluxio/cli/fs/FileSystemShellUtils.java#L59-L68 |
bekkopen/NoCommons | src/main/java/no/bekk/bekkopen/common/Checksums.java | Checksums.calculateMod10CheckSum | public static int calculateMod10CheckSum(int[] weights, StringNumber number) {
int c = calculateChecksum(weights, number, true) % 10;
return c == 0 ? 0 : 10 - c;
} | java | public static int calculateMod10CheckSum(int[] weights, StringNumber number) {
int c = calculateChecksum(weights, number, true) % 10;
return c == 0 ? 0 : 10 - c;
} | [
"public",
"static",
"int",
"calculateMod10CheckSum",
"(",
"int",
"[",
"]",
"weights",
",",
"StringNumber",
"number",
")",
"{",
"int",
"c",
"=",
"calculateChecksum",
"(",
"weights",
",",
"number",
",",
"true",
")",
"%",
"10",
";",
"return",
"c",
"==",
"0"... | Calculate the check sum for the given weights and number.
@param weights The weights
@param number The number
@return The checksum | [
"Calculate",
"the",
"check",
"sum",
"for",
"the",
"given",
"weights",
"and",
"number",
"."
] | train | https://github.com/bekkopen/NoCommons/blob/5a576696390cecaac111fa97fde581e0c1afb9b8/src/main/java/no/bekk/bekkopen/common/Checksums.java#L29-L32 |
liyiorg/weixin-popular | src/main/java/weixin/popular/api/MessageAPI.java | MessageAPI.messageMassPreview | public static MessageSendResult messageMassPreview(String access_token, Preview preview) {
String previewJson = JsonUtil.toJSONString(preview);
HttpUriRequest httpUriRequest = RequestBuilder.post()
.setHeader(jsonHeader)
.setUri(BASE_URI + "/cgi-bin/message/mass/preview")
.addParameter(PARAM_ACCESS_TOKEN, API.accessToken(access_token))
.setEntity(new StringEntity(previewJson, Charset.forName("utf-8")))
.build();
return LocalHttpClient.executeJsonResult(httpUriRequest, MessageSendResult.class);
} | java | public static MessageSendResult messageMassPreview(String access_token, Preview preview) {
String previewJson = JsonUtil.toJSONString(preview);
HttpUriRequest httpUriRequest = RequestBuilder.post()
.setHeader(jsonHeader)
.setUri(BASE_URI + "/cgi-bin/message/mass/preview")
.addParameter(PARAM_ACCESS_TOKEN, API.accessToken(access_token))
.setEntity(new StringEntity(previewJson, Charset.forName("utf-8")))
.build();
return LocalHttpClient.executeJsonResult(httpUriRequest, MessageSendResult.class);
} | [
"public",
"static",
"MessageSendResult",
"messageMassPreview",
"(",
"String",
"access_token",
",",
"Preview",
"preview",
")",
"{",
"String",
"previewJson",
"=",
"JsonUtil",
".",
"toJSONString",
"(",
"preview",
")",
";",
"HttpUriRequest",
"httpUriRequest",
"=",
"Requ... | 预览接口
@param access_token access_token
@param preview preview
@return MessageSendResult
@since 2.6.3 | [
"预览接口"
] | train | https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/api/MessageAPI.java#L234-L243 |
dbflute-session/tomcat-boot | src/main/java/org/dbflute/tomcat/util/BotmReflectionUtil.java | BotmReflectionUtil.assertStringNotNullAndNotTrimmedEmpty | public static void assertStringNotNullAndNotTrimmedEmpty(String variableName, String value) {
assertObjectNotNull("variableName", variableName);
assertObjectNotNull("value", value);
if (value.trim().length() == 0) {
String msg = "The value should not be empty: variableName=" + variableName + " value=" + value;
throw new IllegalArgumentException(msg);
}
} | java | public static void assertStringNotNullAndNotTrimmedEmpty(String variableName, String value) {
assertObjectNotNull("variableName", variableName);
assertObjectNotNull("value", value);
if (value.trim().length() == 0) {
String msg = "The value should not be empty: variableName=" + variableName + " value=" + value;
throw new IllegalArgumentException(msg);
}
} | [
"public",
"static",
"void",
"assertStringNotNullAndNotTrimmedEmpty",
"(",
"String",
"variableName",
",",
"String",
"value",
")",
"{",
"assertObjectNotNull",
"(",
"\"variableName\"",
",",
"variableName",
")",
";",
"assertObjectNotNull",
"(",
"\"value\"",
",",
"value",
... | Assert that the entity is not null and not trimmed empty.
@param variableName The check name of variable for message. (NotNull)
@param value The checked value. (NotNull) | [
"Assert",
"that",
"the",
"entity",
"is",
"not",
"null",
"and",
"not",
"trimmed",
"empty",
"."
] | train | https://github.com/dbflute-session/tomcat-boot/blob/fe941f88b6be083781873126f5b12d4c16bb9073/src/main/java/org/dbflute/tomcat/util/BotmReflectionUtil.java#L859-L866 |
threerings/narya | core/src/main/java/com/threerings/presents/data/InvocationMarshaller.java | InvocationMarshaller.sendRequest | protected void sendRequest (int methodId, Object[] args, Transport transport)
{
_invdir.sendRequest(_invOid, _invCode, methodId, args, transport);
} | java | protected void sendRequest (int methodId, Object[] args, Transport transport)
{
_invdir.sendRequest(_invOid, _invCode, methodId, args, transport);
} | [
"protected",
"void",
"sendRequest",
"(",
"int",
"methodId",
",",
"Object",
"[",
"]",
"args",
",",
"Transport",
"transport",
")",
"{",
"_invdir",
".",
"sendRequest",
"(",
"_invOid",
",",
"_invCode",
",",
"methodId",
",",
"args",
",",
"transport",
")",
";",
... | Called by generated invocation marshaller code; packages up and sends the specified
invocation service request. | [
"Called",
"by",
"generated",
"invocation",
"marshaller",
"code",
";",
"packages",
"up",
"and",
"sends",
"the",
"specified",
"invocation",
"service",
"request",
"."
] | train | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/data/InvocationMarshaller.java#L293-L296 |
b3dgs/lionengine | lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/pathfinding/PathfindableModel.java | PathfindableModel.getMovementForce | private Force getMovementForce(double x, double y, double dx, double dy)
{
double sx = 0.0;
double sy = 0.0;
// Horizontal speed
if (dx - x < 0)
{
sx = -getSpeedX();
}
else if (dx - x > 0)
{
sx = getSpeedX();
}
// Vertical speed
if (dy - y < 0)
{
sy = -getSpeedX();
}
else if (dy - y > 0)
{
sy = getSpeedX();
}
// Diagonal speed
if (Double.compare(sx, 0) != 0 && Double.compare(sy, 0) != 0)
{
sx *= PathfindableModel.DIAGONAL_SPEED;
sy *= PathfindableModel.DIAGONAL_SPEED;
}
return new Force(sx, sy);
} | java | private Force getMovementForce(double x, double y, double dx, double dy)
{
double sx = 0.0;
double sy = 0.0;
// Horizontal speed
if (dx - x < 0)
{
sx = -getSpeedX();
}
else if (dx - x > 0)
{
sx = getSpeedX();
}
// Vertical speed
if (dy - y < 0)
{
sy = -getSpeedX();
}
else if (dy - y > 0)
{
sy = getSpeedX();
}
// Diagonal speed
if (Double.compare(sx, 0) != 0 && Double.compare(sy, 0) != 0)
{
sx *= PathfindableModel.DIAGONAL_SPEED;
sy *= PathfindableModel.DIAGONAL_SPEED;
}
return new Force(sx, sy);
} | [
"private",
"Force",
"getMovementForce",
"(",
"double",
"x",
",",
"double",
"y",
",",
"double",
"dx",
",",
"double",
"dy",
")",
"{",
"double",
"sx",
"=",
"0.0",
";",
"double",
"sy",
"=",
"0.0",
";",
"// Horizontal speed",
"if",
"(",
"dx",
"-",
"x",
"<... | Get the movement force depending of the current location and the destination location.
@param x The current horizontal location.
@param y The current vertical location.
@param dx The destination horizontal location.
@param dy The destination vertical location.
@return The movement force pointing to the destination. | [
"Get",
"the",
"movement",
"force",
"depending",
"of",
"the",
"current",
"location",
"and",
"the",
"destination",
"location",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/pathfinding/PathfindableModel.java#L478-L509 |
liferay/com-liferay-commerce | commerce-price-list-service/src/main/java/com/liferay/commerce/price/list/service/persistence/impl/CommerceTierPriceEntryPersistenceImpl.java | CommerceTierPriceEntryPersistenceImpl.fetchByUUID_G | @Override
public CommerceTierPriceEntry fetchByUUID_G(String uuid, long groupId) {
return fetchByUUID_G(uuid, groupId, true);
} | java | @Override
public CommerceTierPriceEntry fetchByUUID_G(String uuid, long groupId) {
return fetchByUUID_G(uuid, groupId, true);
} | [
"@",
"Override",
"public",
"CommerceTierPriceEntry",
"fetchByUUID_G",
"(",
"String",
"uuid",
",",
"long",
"groupId",
")",
"{",
"return",
"fetchByUUID_G",
"(",
"uuid",
",",
"groupId",
",",
"true",
")",
";",
"}"
] | Returns the commerce tier price entry where uuid = ? and groupId = ? or returns <code>null</code> if it could not be found. Uses the finder cache.
@param uuid the uuid
@param groupId the group ID
@return the matching commerce tier price entry, or <code>null</code> if a matching commerce tier price entry could not be found | [
"Returns",
"the",
"commerce",
"tier",
"price",
"entry",
"where",
"uuid",
"=",
"?",
";",
"and",
"groupId",
"=",
"?",
";",
"or",
"returns",
"<code",
">",
"null<",
"/",
"code",
">",
"if",
"it",
"could",
"not",
"be",
"found",
".",
"Uses",
"the",
"f... | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-price-list-service/src/main/java/com/liferay/commerce/price/list/service/persistence/impl/CommerceTierPriceEntryPersistenceImpl.java#L707-L710 |
gwtbootstrap3/gwtbootstrap3 | gwtbootstrap3/src/main/java/org/gwtbootstrap3/client/ui/base/mixin/AttributeMixin.java | AttributeMixin.setAttribute | public void setAttribute(final String attributeName, final String attributeValue) {
uiObject.getElement().setAttribute(attributeName, attributeValue);
} | java | public void setAttribute(final String attributeName, final String attributeValue) {
uiObject.getElement().setAttribute(attributeName, attributeValue);
} | [
"public",
"void",
"setAttribute",
"(",
"final",
"String",
"attributeName",
",",
"final",
"String",
"attributeValue",
")",
"{",
"uiObject",
".",
"getElement",
"(",
")",
".",
"setAttribute",
"(",
"attributeName",
",",
"attributeValue",
")",
";",
"}"
] | Sets the attribute on the UiObject
@param attributeName attribute name
@param attributeValue attribute value | [
"Sets",
"the",
"attribute",
"on",
"the",
"UiObject"
] | train | https://github.com/gwtbootstrap3/gwtbootstrap3/blob/54bdbd0b12ba7a436b278c007df960d1adf2e641/gwtbootstrap3/src/main/java/org/gwtbootstrap3/client/ui/base/mixin/AttributeMixin.java#L40-L42 |
jeremylong/DependencyCheck | utils/src/main/java/org/owasp/dependencycheck/utils/Settings.java | Settings.getLong | public long getLong(@NotNull final String key) throws InvalidSettingException {
try {
return Long.parseLong(getString(key));
} catch (NumberFormatException ex) {
throw new InvalidSettingException("Could not convert property '" + key + "' to a long.", ex);
}
} | java | public long getLong(@NotNull final String key) throws InvalidSettingException {
try {
return Long.parseLong(getString(key));
} catch (NumberFormatException ex) {
throw new InvalidSettingException("Could not convert property '" + key + "' to a long.", ex);
}
} | [
"public",
"long",
"getLong",
"(",
"@",
"NotNull",
"final",
"String",
"key",
")",
"throws",
"InvalidSettingException",
"{",
"try",
"{",
"return",
"Long",
".",
"parseLong",
"(",
"getString",
"(",
"key",
")",
")",
";",
"}",
"catch",
"(",
"NumberFormatException"... | Returns a long value from the properties file. If the value was specified
as a system property or passed in via the -Dprop=value argument - this
method will return the value from the system properties before the values
in the contained configuration file.
@param key the key to lookup within the properties file
@return the property from the properties file
@throws org.owasp.dependencycheck.utils.InvalidSettingException is thrown
if there is an error retrieving the setting | [
"Returns",
"a",
"long",
"value",
"from",
"the",
"properties",
"file",
".",
"If",
"the",
"value",
"was",
"specified",
"as",
"a",
"system",
"property",
"or",
"passed",
"in",
"via",
"the",
"-",
"Dprop",
"=",
"value",
"argument",
"-",
"this",
"method",
"will... | train | https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/utils/src/main/java/org/owasp/dependencycheck/utils/Settings.java#L1018-L1024 |
openengsb/openengsb | components/edbi/jdbc/src/main/java/org/openengsb/core/edbi/jdbc/AbstractTableFactory.java | AbstractTableFactory.onMissingTypeVisit | protected void onMissingTypeVisit(Table table, IndexField<?> field) {
if (!Introspector.isModelClass(field.getType())) {
return;
}
Field idField = Introspector.getOpenEngSBModelIdField(field.getType());
if (idField == null) {
LOG.warn("@Model class {} does not have an @OpenEngSBModelId", field.getType());
return;
}
DataType type = getTypeMap().getType(idField.getType());
if (type == null) {
LOG.warn("@OpenEngSBModelId field {} has an unmapped type {}", field.getName(), field.getType());
return;
}
((JdbcIndexField) field).setMappedType(type);
Column column = new Column(getColumnNameTranslator().translate(field), type);
table.addElement(column); // will hold the models OID
onAfterFieldVisit(table, column, field);
} | java | protected void onMissingTypeVisit(Table table, IndexField<?> field) {
if (!Introspector.isModelClass(field.getType())) {
return;
}
Field idField = Introspector.getOpenEngSBModelIdField(field.getType());
if (idField == null) {
LOG.warn("@Model class {} does not have an @OpenEngSBModelId", field.getType());
return;
}
DataType type = getTypeMap().getType(idField.getType());
if (type == null) {
LOG.warn("@OpenEngSBModelId field {} has an unmapped type {}", field.getName(), field.getType());
return;
}
((JdbcIndexField) field).setMappedType(type);
Column column = new Column(getColumnNameTranslator().translate(field), type);
table.addElement(column); // will hold the models OID
onAfterFieldVisit(table, column, field);
} | [
"protected",
"void",
"onMissingTypeVisit",
"(",
"Table",
"table",
",",
"IndexField",
"<",
"?",
">",
"field",
")",
"{",
"if",
"(",
"!",
"Introspector",
".",
"isModelClass",
"(",
"field",
".",
"getType",
"(",
")",
")",
")",
"{",
"return",
";",
"}",
"Fiel... | Called when type map returns null.
@param table the table to be created
@param field the field being visited and has no type information | [
"Called",
"when",
"type",
"map",
"returns",
"null",
"."
] | train | https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/components/edbi/jdbc/src/main/java/org/openengsb/core/edbi/jdbc/AbstractTableFactory.java#L98-L123 |
tvesalainen/util | util/src/main/java/org/vesalainen/ui/Scaler.java | Scaler.getLevelFor | public ScaleLevel getLevelFor(Font font, FontRenderContext frc, DoubleTransform transformer, boolean horizontal, double xy)
{
return getLevelFor(font, frc, transformer, horizontal, xy, null);
} | java | public ScaleLevel getLevelFor(Font font, FontRenderContext frc, DoubleTransform transformer, boolean horizontal, double xy)
{
return getLevelFor(font, frc, transformer, horizontal, xy, null);
} | [
"public",
"ScaleLevel",
"getLevelFor",
"(",
"Font",
"font",
",",
"FontRenderContext",
"frc",
",",
"DoubleTransform",
"transformer",
",",
"boolean",
"horizontal",
",",
"double",
"xy",
")",
"{",
"return",
"getLevelFor",
"(",
"font",
",",
"frc",
",",
"transformer",... | Returns highest level where drawn labels don't overlap
@param font
@param frc
@param transformer
@param horizontal
@param xy Lines constant value
@return | [
"Returns",
"highest",
"level",
"where",
"drawn",
"labels",
"don",
"t",
"overlap"
] | train | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/ui/Scaler.java#L160-L163 |
upwork/java-upwork | src/com/Upwork/api/Routers/Reports/Finance/Billings.java | Billings.getByFreelancersCompany | public JSONObject getByFreelancersCompany(String freelancerCompanyReference, HashMap<String, String> params) throws JSONException {
return oClient.get("/finreports/v2/provider_companies/" + freelancerCompanyReference + "/billings", params);
} | java | public JSONObject getByFreelancersCompany(String freelancerCompanyReference, HashMap<String, String> params) throws JSONException {
return oClient.get("/finreports/v2/provider_companies/" + freelancerCompanyReference + "/billings", params);
} | [
"public",
"JSONObject",
"getByFreelancersCompany",
"(",
"String",
"freelancerCompanyReference",
",",
"HashMap",
"<",
"String",
",",
"String",
">",
"params",
")",
"throws",
"JSONException",
"{",
"return",
"oClient",
".",
"get",
"(",
"\"/finreports/v2/provider_companies/\... | Generate Billing Reports for a Specific Freelancer's Company
@param freelancerCompanyReference Freelancer's company reference
@param params Parameters
@throws JSONException If error occurred
@return {@link JSONObject} | [
"Generate",
"Billing",
"Reports",
"for",
"a",
"Specific",
"Freelancer",
"s",
"Company"
] | train | https://github.com/upwork/java-upwork/blob/342297161503a74e9e0bddbd381ab5eebf4dc454/src/com/Upwork/api/Routers/Reports/Finance/Billings.java#L78-L80 |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/ws/udpchannel/internal/WorkQueueManager.java | WorkQueueManager.getMultiThreadedWorker | protected MultiThreadedWorker getMultiThreadedWorker(SelectionKey key, long threadIdfWQM) {
MultiThreadedWorker worker = null;
synchronized (multiThreadedObjectPool) {
worker = (MultiThreadedWorker) multiThreadedObjectPool.get();
}
if (worker == null) {
worker = new MultiThreadedWorker(this);
}
worker.set(key);
return worker;
} | java | protected MultiThreadedWorker getMultiThreadedWorker(SelectionKey key, long threadIdfWQM) {
MultiThreadedWorker worker = null;
synchronized (multiThreadedObjectPool) {
worker = (MultiThreadedWorker) multiThreadedObjectPool.get();
}
if (worker == null) {
worker = new MultiThreadedWorker(this);
}
worker.set(key);
return worker;
} | [
"protected",
"MultiThreadedWorker",
"getMultiThreadedWorker",
"(",
"SelectionKey",
"key",
",",
"long",
"threadIdfWQM",
")",
"{",
"MultiThreadedWorker",
"worker",
"=",
"null",
";",
"synchronized",
"(",
"multiThreadedObjectPool",
")",
"{",
"worker",
"=",
"(",
"MultiThre... | Retrieve a MultiThreadedWorker object from the object pool.
@param key
@param threadIdfWQM
@return MultiThreadedWorker | [
"Retrieve",
"a",
"MultiThreadedWorker",
"object",
"from",
"the",
"object",
"pool",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/udpchannel/internal/WorkQueueManager.java#L1062-L1075 |
Carbonado/Carbonado | src/main/java/com/amazon/carbonado/gen/StorableGenerator.java | StorableGenerator.loadThisProperty | private void loadThisProperty(CodeBuilder b, StorableProperty property) {
loadThisProperty(b, property, TypeDesc.forClass(property.getType()));
} | java | private void loadThisProperty(CodeBuilder b, StorableProperty property) {
loadThisProperty(b, property, TypeDesc.forClass(property.getType()));
} | [
"private",
"void",
"loadThisProperty",
"(",
"CodeBuilder",
"b",
",",
"StorableProperty",
"property",
")",
"{",
"loadThisProperty",
"(",
"b",
",",
"property",
",",
"TypeDesc",
".",
"forClass",
"(",
"property",
".",
"getType",
"(",
")",
")",
")",
";",
"}"
] | Loads the property value of the current storable onto the stack. If the
property is derived the read method is used, otherwise it just loads the
value from the appropriate field.
entry stack: [
exit stack: [value
@param b - {@link CodeBuilder} to which to add the load code
@param property - property to load | [
"Loads",
"the",
"property",
"value",
"of",
"the",
"current",
"storable",
"onto",
"the",
"stack",
".",
"If",
"the",
"property",
"is",
"derived",
"the",
"read",
"method",
"is",
"used",
"otherwise",
"it",
"just",
"loads",
"the",
"value",
"from",
"the",
"appro... | train | https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/gen/StorableGenerator.java#L2061-L2063 |
netty/netty | handler/src/main/java/io/netty/handler/ssl/SslContext.java | SslContext.newServerContext | @Deprecated
public static SslContext newServerContext(File certChainFile, File keyFile) throws SSLException {
return newServerContext(certChainFile, keyFile, null);
} | java | @Deprecated
public static SslContext newServerContext(File certChainFile, File keyFile) throws SSLException {
return newServerContext(certChainFile, keyFile, null);
} | [
"@",
"Deprecated",
"public",
"static",
"SslContext",
"newServerContext",
"(",
"File",
"certChainFile",
",",
"File",
"keyFile",
")",
"throws",
"SSLException",
"{",
"return",
"newServerContext",
"(",
"certChainFile",
",",
"keyFile",
",",
"null",
")",
";",
"}"
] | Creates a new server-side {@link SslContext}.
@param certChainFile an X.509 certificate chain file in PEM format
@param keyFile a PKCS#8 private key file in PEM format
@return a new server-side {@link SslContext}
@deprecated Replaced by {@link SslContextBuilder} | [
"Creates",
"a",
"new",
"server",
"-",
"side",
"{",
"@link",
"SslContext",
"}",
"."
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/SslContext.java#L135-L138 |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.jwt/src/com/ibm/ws/security/jwt/utils/TokenBuilder.java | TokenBuilder.createTokenString | public String createTokenString(String builderConfigId) {
try {
return createTokenString(builderConfigId, WSSubject.getRunAsSubject(), null, null);
// JwtBuilder builder = JwtBuilder.create(builderConfigId);
//
// // all the "normal" stuff like issuer, aud, etc. is handled
// // by the builder, we only need to add the mp-jwt things
// // that the builder is not already aware of.
// String user = getUserName();
// builder.subject(user);
// builder.claim(USER_CLAIM, user);
//
// ArrayList<String> groups = getGroups();
// if (isValidList(groups)) {
// builder.claim(GROUP_CLAIM, groups);
// }
//
// return builder.buildJwt().compact();
} catch (Exception e) {
// ffdc
return null;
}
} | java | public String createTokenString(String builderConfigId) {
try {
return createTokenString(builderConfigId, WSSubject.getRunAsSubject(), null, null);
// JwtBuilder builder = JwtBuilder.create(builderConfigId);
//
// // all the "normal" stuff like issuer, aud, etc. is handled
// // by the builder, we only need to add the mp-jwt things
// // that the builder is not already aware of.
// String user = getUserName();
// builder.subject(user);
// builder.claim(USER_CLAIM, user);
//
// ArrayList<String> groups = getGroups();
// if (isValidList(groups)) {
// builder.claim(GROUP_CLAIM, groups);
// }
//
// return builder.buildJwt().compact();
} catch (Exception e) {
// ffdc
return null;
}
} | [
"public",
"String",
"createTokenString",
"(",
"String",
"builderConfigId",
")",
"{",
"try",
"{",
"return",
"createTokenString",
"(",
"builderConfigId",
",",
"WSSubject",
".",
"getRunAsSubject",
"(",
")",
",",
"null",
",",
"null",
")",
";",
"// JwtBuilder builder =... | create an MP-JWT token using the builder API. Assumes the user is already
authenticated.
@param builderConfigId
- the id of the builder element in server.xml
@return the token string, or null if a mandatory param was null or empty. | [
"create",
"an",
"MP",
"-",
"JWT",
"token",
"using",
"the",
"builder",
"API",
".",
"Assumes",
"the",
"user",
"is",
"already",
"authenticated",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.jwt/src/com/ibm/ws/security/jwt/utils/TokenBuilder.java#L62-L87 |
intive-FDV/DynamicJasper | src/main/java/ar/com/fdvs/dj/core/layout/ClassicLayoutManager.java | ClassicLayoutManager.setTextAndClassToExpression | protected void setTextAndClassToExpression(JRDesignExpression expression, DJGroupVariable var, AbstractColumn col, String variableName) {
if (var.getValueFormatter() != null){
expression.setText(var.getTextForValueFormatterExpression(variableName));
expression.setValueClassName(var.getValueFormatter().getClassName());
}
else if (col.getTextFormatter() != null) {
expression.setText("$V{" + variableName + "}");
expression.setValueClassName(col.getVariableClassName(var.getOperation()));
}
else {
expression.setText("$V{" + variableName + "}");
expression.setValueClassName(col.getVariableClassName(var.getOperation()));
}
} | java | protected void setTextAndClassToExpression(JRDesignExpression expression, DJGroupVariable var, AbstractColumn col, String variableName) {
if (var.getValueFormatter() != null){
expression.setText(var.getTextForValueFormatterExpression(variableName));
expression.setValueClassName(var.getValueFormatter().getClassName());
}
else if (col.getTextFormatter() != null) {
expression.setText("$V{" + variableName + "}");
expression.setValueClassName(col.getVariableClassName(var.getOperation()));
}
else {
expression.setText("$V{" + variableName + "}");
expression.setValueClassName(col.getVariableClassName(var.getOperation()));
}
} | [
"protected",
"void",
"setTextAndClassToExpression",
"(",
"JRDesignExpression",
"expression",
",",
"DJGroupVariable",
"var",
",",
"AbstractColumn",
"col",
",",
"String",
"variableName",
")",
"{",
"if",
"(",
"var",
".",
"getValueFormatter",
"(",
")",
"!=",
"null",
"... | If a variable has a DJValueFormatter, we must use it in the expression, otherwise, use plain $V{...}
@param expression
@param var
@param col
@param variableName | [
"If",
"a",
"variable",
"has",
"a",
"DJValueFormatter",
"we",
"must",
"use",
"it",
"in",
"the",
"expression",
"otherwise",
"use",
"plain",
"$V",
"{",
"...",
"}"
] | train | https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/core/layout/ClassicLayoutManager.java#L1194-L1209 |
guardtime/ksi-java-sdk | ksi-common/src/main/java/com/guardtime/ksi/tlv/TLVElement.java | TLVElement.getDecodedString | public final String getDecodedString() throws TLVParserException {
byte[] data = getContent();
if (!(data.length > 0 && data[data.length - 1] == '\0')) {
throw new TLVParserException("String must be null terminated");
}
try {
return Util.decodeString(data, 0, data.length - 1);
} catch (CharacterCodingException e) {
throw new TLVParserException("Malformed UTF-8 data", e);
}
} | java | public final String getDecodedString() throws TLVParserException {
byte[] data = getContent();
if (!(data.length > 0 && data[data.length - 1] == '\0')) {
throw new TLVParserException("String must be null terminated");
}
try {
return Util.decodeString(data, 0, data.length - 1);
} catch (CharacterCodingException e) {
throw new TLVParserException("Malformed UTF-8 data", e);
}
} | [
"public",
"final",
"String",
"getDecodedString",
"(",
")",
"throws",
"TLVParserException",
"{",
"byte",
"[",
"]",
"data",
"=",
"getContent",
"(",
")",
";",
"if",
"(",
"!",
"(",
"data",
".",
"length",
">",
"0",
"&&",
"data",
"[",
"data",
".",
"length",
... | Converts the TLV element content data to UTF-8 string.
@return Decoded instance of string.
@throws TLVParserException
when content string isn't null terminated or is malformed UTF-8 data. | [
"Converts",
"the",
"TLV",
"element",
"content",
"data",
"to",
"UTF",
"-",
"8",
"string",
"."
] | train | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-common/src/main/java/com/guardtime/ksi/tlv/TLVElement.java#L257-L267 |
nguillaumin/slick2d-maven | slick2d-core/src/main/java/org/newdawn/slick/geom/Line.java | Line.set | public void set(Vector2f start, Vector2f end) {
super.pointsDirty = true;
if (this.start == null) {
this.start = new Vector2f();
}
this.start.set(start);
if (this.end == null) {
this.end = new Vector2f();
}
this.end.set(end);
vec = new Vector2f(end);
vec.sub(start);
lenSquared = vec.lengthSquared();
} | java | public void set(Vector2f start, Vector2f end) {
super.pointsDirty = true;
if (this.start == null) {
this.start = new Vector2f();
}
this.start.set(start);
if (this.end == null) {
this.end = new Vector2f();
}
this.end.set(end);
vec = new Vector2f(end);
vec.sub(start);
lenSquared = vec.lengthSquared();
} | [
"public",
"void",
"set",
"(",
"Vector2f",
"start",
",",
"Vector2f",
"end",
")",
"{",
"super",
".",
"pointsDirty",
"=",
"true",
";",
"if",
"(",
"this",
".",
"start",
"==",
"null",
")",
"{",
"this",
".",
"start",
"=",
"new",
"Vector2f",
"(",
")",
";"... | Configure the line
@param start
The start point of the line
@param end
The end point of the line | [
"Configure",
"the",
"line"
] | train | https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/geom/Line.java#L185-L201 |
j256/ormlite-core | src/main/java/com/j256/ormlite/dao/DaoManager.java | DaoManager.unregisterDao | public static synchronized void unregisterDao(ConnectionSource connectionSource, Dao<?, ?> dao) {
if (connectionSource == null) {
throw new IllegalArgumentException("connectionSource argument cannot be null");
}
removeDaoToClassMap(new ClassConnectionSource(connectionSource, dao.getDataClass()));
} | java | public static synchronized void unregisterDao(ConnectionSource connectionSource, Dao<?, ?> dao) {
if (connectionSource == null) {
throw new IllegalArgumentException("connectionSource argument cannot be null");
}
removeDaoToClassMap(new ClassConnectionSource(connectionSource, dao.getDataClass()));
} | [
"public",
"static",
"synchronized",
"void",
"unregisterDao",
"(",
"ConnectionSource",
"connectionSource",
",",
"Dao",
"<",
"?",
",",
"?",
">",
"dao",
")",
"{",
"if",
"(",
"connectionSource",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"... | Remove a DAO from the cache. This is necessary if we've registered it already but it throws an exception during
configuration. | [
"Remove",
"a",
"DAO",
"from",
"the",
"cache",
".",
"This",
"is",
"necessary",
"if",
"we",
"ve",
"registered",
"it",
"already",
"but",
"it",
"throws",
"an",
"exception",
"during",
"configuration",
"."
] | train | https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/dao/DaoManager.java#L179-L184 |
gmessner/gitlab4j-api | src/main/java/org/gitlab4j/api/BoardsApi.java | BoardsApi.getBoard | public Board getBoard(Object projectIdOrPath, Integer boardId) throws GitLabApiException {
Response response = get(Response.Status.OK, null,
"projects", getProjectIdOrPath(projectIdOrPath), "boards", boardId);
return (response.readEntity(Board.class));
} | java | public Board getBoard(Object projectIdOrPath, Integer boardId) throws GitLabApiException {
Response response = get(Response.Status.OK, null,
"projects", getProjectIdOrPath(projectIdOrPath), "boards", boardId);
return (response.readEntity(Board.class));
} | [
"public",
"Board",
"getBoard",
"(",
"Object",
"projectIdOrPath",
",",
"Integer",
"boardId",
")",
"throws",
"GitLabApiException",
"{",
"Response",
"response",
"=",
"get",
"(",
"Response",
".",
"Status",
".",
"OK",
",",
"null",
",",
"\"projects\"",
",",
"getProj... | Get a single issue board.
<pre><code>GitLab Endpoint: GET /projects/:id/boards/:board_id</code></pre>
@param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
@param boardId the ID of the board
@return a Board instance for the specified board ID
@throws GitLabApiException if any exception occurs | [
"Get",
"a",
"single",
"issue",
"board",
"."
] | train | https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/BoardsApi.java#L95-L99 |
otto-de/edison-microservice | edison-jobs/src/main/java/de/otto/edison/jobs/definition/DefaultJobDefinition.java | DefaultJobDefinition.cronJobDefinition | public static JobDefinition cronJobDefinition(final String jobType,
final String jobName,
final String description,
final String cron,
final int restarts,
final Optional<Duration> maxAge) {
return new DefaultJobDefinition(jobType, jobName, description, maxAge, Optional.empty(), Optional.of(cron), restarts, 0, Optional.empty());
} | java | public static JobDefinition cronJobDefinition(final String jobType,
final String jobName,
final String description,
final String cron,
final int restarts,
final Optional<Duration> maxAge) {
return new DefaultJobDefinition(jobType, jobName, description, maxAge, Optional.empty(), Optional.of(cron), restarts, 0, Optional.empty());
} | [
"public",
"static",
"JobDefinition",
"cronJobDefinition",
"(",
"final",
"String",
"jobType",
",",
"final",
"String",
"jobName",
",",
"final",
"String",
"description",
",",
"final",
"String",
"cron",
",",
"final",
"int",
"restarts",
",",
"final",
"Optional",
"<",... | Create a JobDefinition that is using a cron expression to specify, when and how often the job should be triggered.
@param jobType The type of the Job
@param jobName A human readable name of the Job
@param description A human readable description of the Job.
@param cron The cron expression. Must conform to {@link CronSequenceGenerator}s cron expressions.
@param restarts The number of restarts if the job failed because of errors or exceptions
@param maxAge Optional maximum age of a job. When the job is not run for longer than this duration,
a warning is displayed on the status page
@return JobDefinition
@throws IllegalArgumentException if cron expression is invalid. | [
"Create",
"a",
"JobDefinition",
"that",
"is",
"using",
"a",
"cron",
"expression",
"to",
"specify",
"when",
"and",
"how",
"often",
"the",
"job",
"should",
"be",
"triggered",
"."
] | train | https://github.com/otto-de/edison-microservice/blob/89ecf0a0dee40977f004370b0b474a36c699e8a2/edison-jobs/src/main/java/de/otto/edison/jobs/definition/DefaultJobDefinition.java#L59-L66 |
hyperledger/fabric-sdk-java | src/main/java/org/hyperledger/fabric/sdk/HFClient.java | HFClient.newOrderer | public Orderer newOrderer(String name, String grpcURL) throws InvalidArgumentException {
clientCheck();
return newOrderer(name, grpcURL, null);
} | java | public Orderer newOrderer(String name, String grpcURL) throws InvalidArgumentException {
clientCheck();
return newOrderer(name, grpcURL, null);
} | [
"public",
"Orderer",
"newOrderer",
"(",
"String",
"name",
",",
"String",
"grpcURL",
")",
"throws",
"InvalidArgumentException",
"{",
"clientCheck",
"(",
")",
";",
"return",
"newOrderer",
"(",
"name",
",",
"grpcURL",
",",
"null",
")",
";",
"}"
] | Create a new urlOrderer.
@param name name of the orderer.
@param grpcURL url location of orderer grpc or grpcs protocol.
@return a new Orderer.
@throws InvalidArgumentException | [
"Create",
"a",
"new",
"urlOrderer",
"."
] | train | https://github.com/hyperledger/fabric-sdk-java/blob/4a2d7b3408b8b0a1ed812aa36942c438159c37a0/src/main/java/org/hyperledger/fabric/sdk/HFClient.java#L694-L697 |
CODAIT/stocator | src/main/java/com/ibm/stocator/fs/cos/COSAPIClient.java | COSAPIClient.pathToKey | private String pathToKey(Path path) {
if (!path.isAbsolute()) {
path = new Path(workingDir, path);
}
if (path.toUri().getScheme() != null && path.toUri().getPath().isEmpty()) {
return "";
}
return path.toUri().getPath().substring(1);
} | java | private String pathToKey(Path path) {
if (!path.isAbsolute()) {
path = new Path(workingDir, path);
}
if (path.toUri().getScheme() != null && path.toUri().getPath().isEmpty()) {
return "";
}
return path.toUri().getPath().substring(1);
} | [
"private",
"String",
"pathToKey",
"(",
"Path",
"path",
")",
"{",
"if",
"(",
"!",
"path",
".",
"isAbsolute",
"(",
")",
")",
"{",
"path",
"=",
"new",
"Path",
"(",
"workingDir",
",",
"path",
")",
";",
"}",
"if",
"(",
"path",
".",
"toUri",
"(",
")",
... | Turns a path (relative or otherwise) into an COS key
@param path object full path | [
"Turns",
"a",
"path",
"(",
"relative",
"or",
"otherwise",
")",
"into",
"an",
"COS",
"key"
] | train | https://github.com/CODAIT/stocator/blob/35969cadd2e8faa6fdac45e8bec1799fdd3d8299/src/main/java/com/ibm/stocator/fs/cos/COSAPIClient.java#L1035-L1045 |
RestComm/sipunit | src/main/java/org/cafesip/sipunit/SipStack.java | SipStack.createSipPhone | public SipPhone createSipPhone(String me) throws InvalidArgumentException, ParseException {
return createSipPhone(null, null, -1, me);
} | java | public SipPhone createSipPhone(String me) throws InvalidArgumentException, ParseException {
return createSipPhone(null, null, -1, me);
} | [
"public",
"SipPhone",
"createSipPhone",
"(",
"String",
"me",
")",
"throws",
"InvalidArgumentException",
",",
"ParseException",
"{",
"return",
"createSipPhone",
"(",
"null",
",",
"null",
",",
"-",
"1",
",",
"me",
")",
";",
"}"
] | This method is the equivalent to the other createSipPhone() methods but without a proxy server.
@param me "Address of Record" URI of the phone user. Each SipPhone is associated with one user.
This parameter is used in the "from" header field.
@return A new SipPhone object.
@throws InvalidArgumentException
@throws ParseException | [
"This",
"method",
"is",
"the",
"equivalent",
"to",
"the",
"other",
"createSipPhone",
"()",
"methods",
"but",
"without",
"a",
"proxy",
"server",
"."
] | train | https://github.com/RestComm/sipunit/blob/18a6be2e29be3fbdc14226e8c41b25e2d57378b1/src/main/java/org/cafesip/sipunit/SipStack.java#L283-L285 |
Wadpam/guja | guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDConnectionDaoImpl.java | GeneratedDConnectionDaoImpl.queryByAppArg0 | public Iterable<DConnection> queryByAppArg0(java.lang.String appArg0) {
return queryByField(null, DConnectionMapper.Field.APPARG0.getFieldName(), appArg0);
} | java | public Iterable<DConnection> queryByAppArg0(java.lang.String appArg0) {
return queryByField(null, DConnectionMapper.Field.APPARG0.getFieldName(), appArg0);
} | [
"public",
"Iterable",
"<",
"DConnection",
">",
"queryByAppArg0",
"(",
"java",
".",
"lang",
".",
"String",
"appArg0",
")",
"{",
"return",
"queryByField",
"(",
"null",
",",
"DConnectionMapper",
".",
"Field",
".",
"APPARG0",
".",
"getFieldName",
"(",
")",
",",
... | query-by method for field appArg0
@param appArg0 the specified attribute
@return an Iterable of DConnections for the specified appArg0 | [
"query",
"-",
"by",
"method",
"for",
"field",
"appArg0"
] | train | https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDConnectionDaoImpl.java#L52-L54 |
Azure/autorest-clientruntime-for-java | azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/resources/models/implementation/ResourceImpl.java | ResourceImpl.withTag | @SuppressWarnings("unchecked")
public final FluentModelImplT withTag(String key, String value) {
if (this.inner().getTags() == null) {
this.inner().withTags(new HashMap<String, String>());
}
this.inner().getTags().put(key, value);
return (FluentModelImplT) this;
} | java | @SuppressWarnings("unchecked")
public final FluentModelImplT withTag(String key, String value) {
if (this.inner().getTags() == null) {
this.inner().withTags(new HashMap<String, String>());
}
this.inner().getTags().put(key, value);
return (FluentModelImplT) this;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"final",
"FluentModelImplT",
"withTag",
"(",
"String",
"key",
",",
"String",
"value",
")",
"{",
"if",
"(",
"this",
".",
"inner",
"(",
")",
".",
"getTags",
"(",
")",
"==",
"null",
")",
"{",
"... | Adds a tag to the resource.
@param key the key for the tag
@param value the value for the tag
@return the next stage of the definition/update | [
"Adds",
"a",
"tag",
"to",
"the",
"resource",
"."
] | train | https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-arm-client-runtime/src/main/java/com/microsoft/azure/arm/resources/models/implementation/ResourceImpl.java#L109-L116 |
SonarSource/sonarqube | sonar-core/src/main/java/org/sonar/core/util/UuidFactoryFast.java | UuidFactoryFast.putLong | private static void putLong(byte[] array, long l, int pos, int numberOfLongBytes) {
for (int i = 0; i < numberOfLongBytes; ++i) {
array[pos + numberOfLongBytes - i - 1] = (byte) (l >>> (i * 8));
}
} | java | private static void putLong(byte[] array, long l, int pos, int numberOfLongBytes) {
for (int i = 0; i < numberOfLongBytes; ++i) {
array[pos + numberOfLongBytes - i - 1] = (byte) (l >>> (i * 8));
}
} | [
"private",
"static",
"void",
"putLong",
"(",
"byte",
"[",
"]",
"array",
",",
"long",
"l",
",",
"int",
"pos",
",",
"int",
"numberOfLongBytes",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"numberOfLongBytes",
";",
"++",
"i",
")",
"{",
... | Puts the lower numberOfLongBytes from l into the array, starting index pos. | [
"Puts",
"the",
"lower",
"numberOfLongBytes",
"from",
"l",
"into",
"the",
"array",
"starting",
"index",
"pos",
"."
] | train | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-core/src/main/java/org/sonar/core/util/UuidFactoryFast.java#L62-L66 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/CharsetUtil.java | CharsetUtil.convert | public static String convert(String source, Charset srcCharset, Charset destCharset) {
if(null == srcCharset) {
srcCharset = StandardCharsets.ISO_8859_1;
}
if(null == destCharset) {
destCharset = StandardCharsets.UTF_8;
}
if (StrUtil.isBlank(source) || srcCharset.equals(destCharset)) {
return source;
}
return new String(source.getBytes(srcCharset), destCharset);
} | java | public static String convert(String source, Charset srcCharset, Charset destCharset) {
if(null == srcCharset) {
srcCharset = StandardCharsets.ISO_8859_1;
}
if(null == destCharset) {
destCharset = StandardCharsets.UTF_8;
}
if (StrUtil.isBlank(source) || srcCharset.equals(destCharset)) {
return source;
}
return new String(source.getBytes(srcCharset), destCharset);
} | [
"public",
"static",
"String",
"convert",
"(",
"String",
"source",
",",
"Charset",
"srcCharset",
",",
"Charset",
"destCharset",
")",
"{",
"if",
"(",
"null",
"==",
"srcCharset",
")",
"{",
"srcCharset",
"=",
"StandardCharsets",
".",
"ISO_8859_1",
";",
"}",
"if"... | 转换字符串的字符集编码<br>
当以错误的编码读取为字符串时,打印字符串将出现乱码。<br>
此方法用于纠正因读取使用编码错误导致的乱码问题。<br>
例如,在Servlet请求中客户端用GBK编码了请求参数,我们使用UTF-8读取到的是乱码,此时,使用此方法即可还原原编码的内容
<pre>
客户端 -》 GBK编码 -》 Servlet容器 -》 UTF-8解码 -》 乱码
乱码 -》 UTF-8编码 -》 GBK解码 -》 正确内容
</pre>
@param source 字符串
@param srcCharset 源字符集,默认ISO-8859-1
@param destCharset 目标字符集,默认UTF-8
@return 转换后的字符集 | [
"转换字符串的字符集编码<br",
">",
"当以错误的编码读取为字符串时,打印字符串将出现乱码。<br",
">",
"此方法用于纠正因读取使用编码错误导致的乱码问题。<br",
">",
"例如,在Servlet请求中客户端用GBK编码了请求参数,我们使用UTF",
"-",
"8读取到的是乱码,此时,使用此方法即可还原原编码的内容",
"<pre",
">",
"客户端",
"-",
"》",
"GBK编码",
"-",
"》",
"Servlet容器",
"-",
"》",
"UTF",
"-",
"8解码",
"-",
... | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/CharsetUtil.java#L67-L80 |
xqbase/util | util-jdk17/src/main/java/com/xqbase/util/Time.java | Time.parse | public static long parse(String date, String time) {
return parseDate(date) + parseTime(time) + timeZoneOffset;
} | java | public static long parse(String date, String time) {
return parseDate(date) + parseTime(time) + timeZoneOffset;
} | [
"public",
"static",
"long",
"parse",
"(",
"String",
"date",
",",
"String",
"time",
")",
"{",
"return",
"parseDate",
"(",
"date",
")",
"+",
"parseTime",
"(",
"time",
")",
"+",
"timeZoneOffset",
";",
"}"
] | Convert a date and a time string to a Unix time (in milliseconds).
Either date or time can be null. | [
"Convert",
"a",
"date",
"and",
"a",
"time",
"string",
"to",
"a",
"Unix",
"time",
"(",
"in",
"milliseconds",
")",
".",
"Either",
"date",
"or",
"time",
"can",
"be",
"null",
"."
] | train | https://github.com/xqbase/util/blob/e7b9167b6c701b9eec988a9d1e68446cef5ef420/util-jdk17/src/main/java/com/xqbase/util/Time.java#L51-L53 |
QSFT/Doradus | doradus-client/src/main/java/com/dell/doradus/client/RESTClient.java | RESTClient.sendRequest | public RESTResponse sendRequest(HttpMethod method, String uri,
Map<String, String> headers, byte[] body)
throws IOException {
// Compress body using GZIP and add a content-encoding header if compression is requested.
byte[] entity = body;
if (m_bCompress && body != null && body.length > 0) {
entity = Utils.compressGZIP(body);
headers.put(HttpDefs.CONTENT_ENCODING, "gzip");
}
return sendAndReceive(method, uri, headers, entity);
} | java | public RESTResponse sendRequest(HttpMethod method, String uri,
Map<String, String> headers, byte[] body)
throws IOException {
// Compress body using GZIP and add a content-encoding header if compression is requested.
byte[] entity = body;
if (m_bCompress && body != null && body.length > 0) {
entity = Utils.compressGZIP(body);
headers.put(HttpDefs.CONTENT_ENCODING, "gzip");
}
return sendAndReceive(method, uri, headers, entity);
} | [
"public",
"RESTResponse",
"sendRequest",
"(",
"HttpMethod",
"method",
",",
"String",
"uri",
",",
"Map",
"<",
"String",
",",
"String",
">",
"headers",
",",
"byte",
"[",
"]",
"body",
")",
"throws",
"IOException",
"{",
"// Compress body using GZIP and add a content-e... | Send a REST command with the given method, URI, headers, and body to the
server and return the response in a {@link RESTResponse} object.
@param method HTTP method such as "GET" or "POST".
@param uri URI such as "/foo/bar?baz"
@param headers Headers to be included in the request, including content-type
if a body is included. Content-type is set automatically.
@param body Input entity to send with request in binary.
@return {@link RESTResponse} containing response from server.
@throws IOException If an error occurs on the socket. | [
"Send",
"a",
"REST",
"command",
"with",
"the",
"given",
"method",
"URI",
"headers",
"and",
"body",
"to",
"the",
"server",
"and",
"return",
"the",
"response",
"in",
"a",
"{",
"@link",
"RESTResponse",
"}",
"object",
"."
] | train | https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-client/src/main/java/com/dell/doradus/client/RESTClient.java#L282-L292 |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/javac/main/JavaCompiler.java | JavaCompiler.printSource | JavaFileObject printSource(Env<AttrContext> env, JCClassDecl cdef) throws IOException {
JavaFileObject outFile
= fileManager.getJavaFileForOutput(CLASS_OUTPUT,
cdef.sym.flatname.toString(),
JavaFileObject.Kind.SOURCE,
null);
if (inputFiles.contains(outFile)) {
log.error(cdef.pos(), "source.cant.overwrite.input.file", outFile);
return null;
} else {
BufferedWriter out = new BufferedWriter(outFile.openWriter());
try {
new Pretty(out, true).printUnit(env.toplevel, cdef);
if (verbose)
log.printVerbose("wrote.file", outFile);
} finally {
out.close();
}
return outFile;
}
} | java | JavaFileObject printSource(Env<AttrContext> env, JCClassDecl cdef) throws IOException {
JavaFileObject outFile
= fileManager.getJavaFileForOutput(CLASS_OUTPUT,
cdef.sym.flatname.toString(),
JavaFileObject.Kind.SOURCE,
null);
if (inputFiles.contains(outFile)) {
log.error(cdef.pos(), "source.cant.overwrite.input.file", outFile);
return null;
} else {
BufferedWriter out = new BufferedWriter(outFile.openWriter());
try {
new Pretty(out, true).printUnit(env.toplevel, cdef);
if (verbose)
log.printVerbose("wrote.file", outFile);
} finally {
out.close();
}
return outFile;
}
} | [
"JavaFileObject",
"printSource",
"(",
"Env",
"<",
"AttrContext",
">",
"env",
",",
"JCClassDecl",
"cdef",
")",
"throws",
"IOException",
"{",
"JavaFileObject",
"outFile",
"=",
"fileManager",
".",
"getJavaFileForOutput",
"(",
"CLASS_OUTPUT",
",",
"cdef",
".",
"sym",
... | Emit plain Java source for a class.
@param env The attribution environment of the outermost class
containing this class.
@param cdef The class definition to be printed. | [
"Emit",
"plain",
"Java",
"source",
"for",
"a",
"class",
"."
] | train | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java#L716-L736 |
EsotericSoftware/kryo | benchmarks/src/main/java/com/esotericsoftware/kryo/benchmarks/KryoBenchmarks.java | KryoBenchmarks.main | static public void main (String[] args) throws Exception {
if (args.length == 0) {
String commandLine = "-f 0 -wi 1 -i 1 -t 1 -w 1s -r 1s " // For developement only (fork 0, short runs).
// + "-bs 2500000 ArrayBenchmark" //
// + "-rf csv FieldSerializerBenchmark.field FieldSerializerBenchmark.tagged" //
// + "FieldSerializerBenchmark.tagged" //
;
System.out.println(commandLine);
args = commandLine.split(" ");
}
Main.main(args);
} | java | static public void main (String[] args) throws Exception {
if (args.length == 0) {
String commandLine = "-f 0 -wi 1 -i 1 -t 1 -w 1s -r 1s " // For developement only (fork 0, short runs).
// + "-bs 2500000 ArrayBenchmark" //
// + "-rf csv FieldSerializerBenchmark.field FieldSerializerBenchmark.tagged" //
// + "FieldSerializerBenchmark.tagged" //
;
System.out.println(commandLine);
args = commandLine.split(" ");
}
Main.main(args);
} | [
"static",
"public",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"throws",
"Exception",
"{",
"if",
"(",
"args",
".",
"length",
"==",
"0",
")",
"{",
"String",
"commandLine",
"=",
"\"-f 0 -wi 1 -i 1 -t 1 -w 1s -r 1s \"",
"// For developement only (fork 0, s... | To run from command line: $ mvn clean install exec:java -Dexec.args="-f 4 -wi 5 -i 3 -t 2 -w 2s -r 2s"
<p>
Fork 0 can be used for debugging/development, eg: -f 0 -wi 1 -i 1 -t 1 -w 1s -r 1s [benchmarkClassName] | [
"To",
"run",
"from",
"command",
"line",
":",
"$",
"mvn",
"clean",
"install",
"exec",
":",
"java",
"-",
"Dexec",
".",
"args",
"=",
"-",
"f",
"4",
"-",
"wi",
"5",
"-",
"i",
"3",
"-",
"t",
"2",
"-",
"w",
"2s",
"-",
"r",
"2s",
"<p",
">",
"Fork"... | train | https://github.com/EsotericSoftware/kryo/blob/a8be1ab26f347f299a3c3f7171d6447dd5390845/benchmarks/src/main/java/com/esotericsoftware/kryo/benchmarks/KryoBenchmarks.java#L28-L39 |
vladmihalcea/flexy-pool | flexy-pool-core/src/main/java/com/vladmihalcea/flexypool/util/LazyJndiResolver.java | LazyJndiResolver.newInstance | @SuppressWarnings("unchecked")
public static <T> T newInstance(String name, Class<?> objectType) {
return (T) Proxy.newProxyInstance(
ClassLoaderUtils.getClassLoader(),
new Class[]{objectType},
new LazyJndiResolver(name));
} | java | @SuppressWarnings("unchecked")
public static <T> T newInstance(String name, Class<?> objectType) {
return (T) Proxy.newProxyInstance(
ClassLoaderUtils.getClassLoader(),
new Class[]{objectType},
new LazyJndiResolver(name));
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"T",
"newInstance",
"(",
"String",
"name",
",",
"Class",
"<",
"?",
">",
"objectType",
")",
"{",
"return",
"(",
"T",
")",
"Proxy",
".",
"newProxyInstance",
"(",
"ClassL... | Creates a new Proxy instance
@param name JNDI name of the object to be lazily looked up
@param objectType object type
@param <T> typed parameter
@return Proxy object | [
"Creates",
"a",
"new",
"Proxy",
"instance"
] | train | https://github.com/vladmihalcea/flexy-pool/blob/d763d359e68299c2b4e28e4b67770581ae083431/flexy-pool-core/src/main/java/com/vladmihalcea/flexypool/util/LazyJndiResolver.java#L60-L66 |
Azure/azure-sdk-for-java | iothub/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/iothub/v2018_04_01/implementation/CertificatesInner.java | CertificatesInner.getAsync | public Observable<CertificateDescriptionInner> getAsync(String resourceGroupName, String resourceName, String certificateName) {
return getWithServiceResponseAsync(resourceGroupName, resourceName, certificateName).map(new Func1<ServiceResponse<CertificateDescriptionInner>, CertificateDescriptionInner>() {
@Override
public CertificateDescriptionInner call(ServiceResponse<CertificateDescriptionInner> response) {
return response.body();
}
});
} | java | public Observable<CertificateDescriptionInner> getAsync(String resourceGroupName, String resourceName, String certificateName) {
return getWithServiceResponseAsync(resourceGroupName, resourceName, certificateName).map(new Func1<ServiceResponse<CertificateDescriptionInner>, CertificateDescriptionInner>() {
@Override
public CertificateDescriptionInner call(ServiceResponse<CertificateDescriptionInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"CertificateDescriptionInner",
">",
"getAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"resourceName",
",",
"String",
"certificateName",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"resourceNam... | Get the certificate.
Returns the certificate.
@param resourceGroupName The name of the resource group that contains the IoT hub.
@param resourceName The name of the IoT hub.
@param certificateName The name of the certificate
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the CertificateDescriptionInner object | [
"Get",
"the",
"certificate",
".",
"Returns",
"the",
"certificate",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/iothub/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/iothub/v2018_04_01/implementation/CertificatesInner.java#L217-L224 |
UrielCh/ovh-java-sdk | ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java | ApiOvhEmailexchange.organizationName_service_exchangeService_domain_domainName_disclaimer_POST | public OvhTask organizationName_service_exchangeService_domain_domainName_disclaimer_POST(String organizationName, String exchangeService, String domainName, String content, Boolean outsideOnly) throws IOException {
String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/domain/{domainName}/disclaimer";
StringBuilder sb = path(qPath, organizationName, exchangeService, domainName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "content", content);
addBody(o, "outsideOnly", outsideOnly);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhTask.class);
} | java | public OvhTask organizationName_service_exchangeService_domain_domainName_disclaimer_POST(String organizationName, String exchangeService, String domainName, String content, Boolean outsideOnly) throws IOException {
String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/domain/{domainName}/disclaimer";
StringBuilder sb = path(qPath, organizationName, exchangeService, domainName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "content", content);
addBody(o, "outsideOnly", outsideOnly);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhTask.class);
} | [
"public",
"OvhTask",
"organizationName_service_exchangeService_domain_domainName_disclaimer_POST",
"(",
"String",
"organizationName",
",",
"String",
"exchangeService",
",",
"String",
"domainName",
",",
"String",
"content",
",",
"Boolean",
"outsideOnly",
")",
"throws",
"IOExce... | Create organization disclaimer of each email
REST: POST /email/exchange/{organizationName}/service/{exchangeService}/domain/{domainName}/disclaimer
@param outsideOnly [required] Activate the disclaimer only for external emails
@param content [required] Signature, added at the bottom of your organization emails
@param organizationName [required] The internal name of your exchange organization
@param exchangeService [required] The internal name of your exchange service
@param domainName [required] Domain name | [
"Create",
"organization",
"disclaimer",
"of",
"each",
"email"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java#L561-L569 |
alkacon/opencms-core | src/org/opencms/main/OpenCmsCore.java | OpenCmsCore.initContext | protected synchronized void initContext(ServletContext context) throws CmsInitException {
m_gwtServiceContexts = new HashMap<String, CmsGwtServiceContext>();
// automatic servlet container recognition and specific behavior:
CmsServletContainerSettings servletContainerSettings = new CmsServletContainerSettings(context);
getSystemInfo().init(servletContainerSettings);
// Collect the configurations
CmsParameterConfiguration configuration;
try {
configuration = new CmsParameterConfiguration(getSystemInfo().getConfigurationFileRfsPath());
} catch (Exception e) {
throw new CmsInitException(
Messages.get().container(
Messages.ERR_CRITICAL_INIT_PROPFILE_1,
getSystemInfo().getConfigurationFileRfsPath()),
e);
}
String throwException = configuration.getString("servlet.exception.enabled", "auto");
if (!throwException.equals("auto")) {
// set the parameter is not automatic, the rest of the servlet container dependent parameters
// will be set when reading the system configuration, if not set to auto
boolean throwExc = Boolean.valueOf(throwException).booleanValue();
getSystemInfo().getServletContainerSettings().setServletThrowsException(throwExc);
}
// check if the wizard is enabled, if so stop initialization
if (configuration.getBoolean("wizard.enabled", true)) {
throw new CmsInitException(Messages.get().container(Messages.ERR_CRITICAL_INIT_WIZARD_0));
}
// add an indicator that the configuration was processed from the servlet context
configuration.add("context.servlet.container", context.getServerInfo());
// output startup message and copyright to STDERR
System.err.println(
Messages.get().getBundle().key(
Messages.LOG_STARTUP_CONSOLE_NOTE_2,
OpenCms.getSystemInfo().getVersionNumber(),
getSystemInfo().getWebApplicationName()));
for (int i = 0; i < Messages.COPYRIGHT_BY_ALKACON.length; i++) {
System.err.println(Messages.COPYRIGHT_BY_ALKACON[i]);
}
System.err.println();
// initialize the configuration
initConfiguration(configuration);
} | java | protected synchronized void initContext(ServletContext context) throws CmsInitException {
m_gwtServiceContexts = new HashMap<String, CmsGwtServiceContext>();
// automatic servlet container recognition and specific behavior:
CmsServletContainerSettings servletContainerSettings = new CmsServletContainerSettings(context);
getSystemInfo().init(servletContainerSettings);
// Collect the configurations
CmsParameterConfiguration configuration;
try {
configuration = new CmsParameterConfiguration(getSystemInfo().getConfigurationFileRfsPath());
} catch (Exception e) {
throw new CmsInitException(
Messages.get().container(
Messages.ERR_CRITICAL_INIT_PROPFILE_1,
getSystemInfo().getConfigurationFileRfsPath()),
e);
}
String throwException = configuration.getString("servlet.exception.enabled", "auto");
if (!throwException.equals("auto")) {
// set the parameter is not automatic, the rest of the servlet container dependent parameters
// will be set when reading the system configuration, if not set to auto
boolean throwExc = Boolean.valueOf(throwException).booleanValue();
getSystemInfo().getServletContainerSettings().setServletThrowsException(throwExc);
}
// check if the wizard is enabled, if so stop initialization
if (configuration.getBoolean("wizard.enabled", true)) {
throw new CmsInitException(Messages.get().container(Messages.ERR_CRITICAL_INIT_WIZARD_0));
}
// add an indicator that the configuration was processed from the servlet context
configuration.add("context.servlet.container", context.getServerInfo());
// output startup message and copyright to STDERR
System.err.println(
Messages.get().getBundle().key(
Messages.LOG_STARTUP_CONSOLE_NOTE_2,
OpenCms.getSystemInfo().getVersionNumber(),
getSystemInfo().getWebApplicationName()));
for (int i = 0; i < Messages.COPYRIGHT_BY_ALKACON.length; i++) {
System.err.println(Messages.COPYRIGHT_BY_ALKACON[i]);
}
System.err.println();
// initialize the configuration
initConfiguration(configuration);
} | [
"protected",
"synchronized",
"void",
"initContext",
"(",
"ServletContext",
"context",
")",
"throws",
"CmsInitException",
"{",
"m_gwtServiceContexts",
"=",
"new",
"HashMap",
"<",
"String",
",",
"CmsGwtServiceContext",
">",
"(",
")",
";",
"// automatic servlet container r... | Initialization of the OpenCms runtime environment.<p>
The connection information for the database is read
from the <code>opencms.properties</code> configuration file and all
driver manager are initialized via the initializer,
which usually will be an instance of a <code>OpenCms</code> class.
@param context configuration of OpenCms from <code>web.xml</code>
@throws CmsInitException in case OpenCms can not be initialized | [
"Initialization",
"of",
"the",
"OpenCms",
"runtime",
"environment",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/main/OpenCmsCore.java#L1706-L1755 |
line/armeria | grpc-protocol/src/main/java/com/linecorp/armeria/common/grpc/protocol/ArmeriaMessageFramer.java | ArmeriaMessageFramer.writePayload | public ByteBufHttpData writePayload(ByteBuf message) {
verifyNotClosed();
final boolean compressed = messageCompression && compressor != null;
final int messageLength = message.readableBytes();
try {
final ByteBuf buf;
if (messageLength != 0 && compressed) {
buf = writeCompressed(message);
} else {
buf = writeUncompressed(message);
}
return new ByteBufHttpData(buf, false);
} catch (IOException | RuntimeException e) {
// IOException will not be thrown, since sink#deliverFrame doesn't throw.
throw new ArmeriaStatusException(
StatusCodes.INTERNAL,
"Failed to frame message",
e);
}
} | java | public ByteBufHttpData writePayload(ByteBuf message) {
verifyNotClosed();
final boolean compressed = messageCompression && compressor != null;
final int messageLength = message.readableBytes();
try {
final ByteBuf buf;
if (messageLength != 0 && compressed) {
buf = writeCompressed(message);
} else {
buf = writeUncompressed(message);
}
return new ByteBufHttpData(buf, false);
} catch (IOException | RuntimeException e) {
// IOException will not be thrown, since sink#deliverFrame doesn't throw.
throw new ArmeriaStatusException(
StatusCodes.INTERNAL,
"Failed to frame message",
e);
}
} | [
"public",
"ByteBufHttpData",
"writePayload",
"(",
"ByteBuf",
"message",
")",
"{",
"verifyNotClosed",
"(",
")",
";",
"final",
"boolean",
"compressed",
"=",
"messageCompression",
"&&",
"compressor",
"!=",
"null",
";",
"final",
"int",
"messageLength",
"=",
"message",... | Writes out a payload message.
@param message the message to be written out. Ownership is taken by {@link ArmeriaMessageFramer}.
@return a {@link ByteBufHttpData} with the framed payload. Ownership is passed to caller. | [
"Writes",
"out",
"a",
"payload",
"message",
"."
] | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/grpc-protocol/src/main/java/com/linecorp/armeria/common/grpc/protocol/ArmeriaMessageFramer.java#L105-L124 |
groovyfx-project/groovyfx | src/main/groovy/groovyx/javafx/beans/FXBindableASTTransformation.java | FXBindableASTTransformation.visit | @Override
public void visit(ASTNode[] nodes, SourceUnit sourceUnit) {
if (!(nodes[0] instanceof AnnotationNode) || !(nodes[1] instanceof AnnotatedNode)) {
throw new IllegalArgumentException("Internal error: wrong types: "
+ nodes[0].getClass().getName() + " / " + nodes[1].getClass().getName());
}
AnnotationNode node = (AnnotationNode) nodes[0];
AnnotatedNode parent = (AnnotatedNode) nodes[1];
ClassNode declaringClass = parent.getDeclaringClass();
if (parent instanceof FieldNode) {
int modifiers = ((FieldNode) parent).getModifiers();
if ((modifiers & Modifier.FINAL) != 0) {
String msg = "@griffon.transform.FXBindable cannot annotate a final property.";
generateSyntaxErrorMessage(sourceUnit, node, msg);
}
addJavaFXProperty(sourceUnit, node, declaringClass, (FieldNode) parent);
} else {
addJavaFXPropertyToClass(sourceUnit, node, (ClassNode) parent);
}
} | java | @Override
public void visit(ASTNode[] nodes, SourceUnit sourceUnit) {
if (!(nodes[0] instanceof AnnotationNode) || !(nodes[1] instanceof AnnotatedNode)) {
throw new IllegalArgumentException("Internal error: wrong types: "
+ nodes[0].getClass().getName() + " / " + nodes[1].getClass().getName());
}
AnnotationNode node = (AnnotationNode) nodes[0];
AnnotatedNode parent = (AnnotatedNode) nodes[1];
ClassNode declaringClass = parent.getDeclaringClass();
if (parent instanceof FieldNode) {
int modifiers = ((FieldNode) parent).getModifiers();
if ((modifiers & Modifier.FINAL) != 0) {
String msg = "@griffon.transform.FXBindable cannot annotate a final property.";
generateSyntaxErrorMessage(sourceUnit, node, msg);
}
addJavaFXProperty(sourceUnit, node, declaringClass, (FieldNode) parent);
} else {
addJavaFXPropertyToClass(sourceUnit, node, (ClassNode) parent);
}
} | [
"@",
"Override",
"public",
"void",
"visit",
"(",
"ASTNode",
"[",
"]",
"nodes",
",",
"SourceUnit",
"sourceUnit",
")",
"{",
"if",
"(",
"!",
"(",
"nodes",
"[",
"0",
"]",
"instanceof",
"AnnotationNode",
")",
"||",
"!",
"(",
"nodes",
"[",
"1",
"]",
"insta... | This ASTTransformation method is called when the compiler encounters our annotation.
@param nodes An array of nodes. Index 0 is the annotation that triggered the call, index 1
is the annotated node.
@param sourceUnit The SourceUnit describing the source code in which the annotation was placed. | [
"This",
"ASTTransformation",
"method",
"is",
"called",
"when",
"the",
"compiler",
"encounters",
"our",
"annotation",
"."
] | train | https://github.com/groovyfx-project/groovyfx/blob/7067d76793601ce4de9c642d4c0c0e11db7907cb/src/main/groovy/groovyx/javafx/beans/FXBindableASTTransformation.java#L178-L199 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/tools/javac/util/Log.java | Log.initWriters | private static Map<WriterKind, PrintWriter> initWriters(Context context) {
PrintWriter out = context.get(outKey);
PrintWriter err = context.get(errKey);
if (out == null && err == null) {
out = new PrintWriter(System.out, true);
err = new PrintWriter(System.err, true);
return initWriters(out, err);
} else if (out == null || err == null) {
PrintWriter pw = (out != null) ? out : err;
return initWriters(pw, pw);
} else {
return initWriters(out, err);
}
} | java | private static Map<WriterKind, PrintWriter> initWriters(Context context) {
PrintWriter out = context.get(outKey);
PrintWriter err = context.get(errKey);
if (out == null && err == null) {
out = new PrintWriter(System.out, true);
err = new PrintWriter(System.err, true);
return initWriters(out, err);
} else if (out == null || err == null) {
PrintWriter pw = (out != null) ? out : err;
return initWriters(pw, pw);
} else {
return initWriters(out, err);
}
} | [
"private",
"static",
"Map",
"<",
"WriterKind",
",",
"PrintWriter",
">",
"initWriters",
"(",
"Context",
"context",
")",
"{",
"PrintWriter",
"out",
"=",
"context",
".",
"get",
"(",
"outKey",
")",
";",
"PrintWriter",
"err",
"=",
"context",
".",
"get",
"(",
... | Initialize a map of writers based on values found in the context
@param context the context in which to find writers to use
@return a map of writers | [
"Initialize",
"a",
"map",
"of",
"writers",
"based",
"on",
"values",
"found",
"in",
"the",
"context"
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Log.java#L262-L275 |
aalmiray/Json-lib | src/main/java/net/sf/json/JsonConfig.java | JsonConfig.registerJsonValueProcessor | public void registerJsonValueProcessor( Class beanClass, String key, JsonValueProcessor jsonValueProcessor ) {
if( beanClass != null && key != null && jsonValueProcessor != null ) {
beanKeyMap.put( beanClass, key, jsonValueProcessor );
}
} | java | public void registerJsonValueProcessor( Class beanClass, String key, JsonValueProcessor jsonValueProcessor ) {
if( beanClass != null && key != null && jsonValueProcessor != null ) {
beanKeyMap.put( beanClass, key, jsonValueProcessor );
}
} | [
"public",
"void",
"registerJsonValueProcessor",
"(",
"Class",
"beanClass",
",",
"String",
"key",
",",
"JsonValueProcessor",
"jsonValueProcessor",
")",
"{",
"if",
"(",
"beanClass",
"!=",
"null",
"&&",
"key",
"!=",
"null",
"&&",
"jsonValueProcessor",
"!=",
"null",
... | Registers a JsonValueProcessor.<br>
[Java -> JSON]
@param beanClass the class to use as key
@param key the property name to use as key
@param jsonValueProcessor the processor to register | [
"Registers",
"a",
"JsonValueProcessor",
".",
"<br",
">",
"[",
"Java",
"-",
">",
";",
"JSON",
"]"
] | train | https://github.com/aalmiray/Json-lib/blob/9e2b3376ee8f511a48aa7ac05f75a7414e02280f/src/main/java/net/sf/json/JsonConfig.java#L840-L844 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/LinkedList.java | LinkedList.set | public E set(int index, E element) {
checkElementIndex(index);
Node<E> x = node(index);
E oldVal = x.item;
x.item = element;
return oldVal;
} | java | public E set(int index, E element) {
checkElementIndex(index);
Node<E> x = node(index);
E oldVal = x.item;
x.item = element;
return oldVal;
} | [
"public",
"E",
"set",
"(",
"int",
"index",
",",
"E",
"element",
")",
"{",
"checkElementIndex",
"(",
"index",
")",
";",
"Node",
"<",
"E",
">",
"x",
"=",
"node",
"(",
"index",
")",
";",
"E",
"oldVal",
"=",
"x",
".",
"item",
";",
"x",
".",
"item",... | Replaces the element at the specified position in this list with the
specified element.
@param index index of the element to replace
@param element element to be stored at the specified position
@return the element previously at the specified position
@throws IndexOutOfBoundsException {@inheritDoc} | [
"Replaces",
"the",
"element",
"at",
"the",
"specified",
"position",
"in",
"this",
"list",
"with",
"the",
"specified",
"element",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/LinkedList.java#L491-L497 |
Jasig/uPortal | uPortal-api/uPortal-api-internal/src/main/java/org/apereo/portal/portlets/groupadmin/GroupFormValidator.java | GroupFormValidator.validateEditDetails | public void validateEditDetails(GroupForm group, MessageContext context) {
// ensure the group name is set
if (StringUtils.isBlank(group.getName())) {
context.addMessage(
new MessageBuilder().error().source("name").code("please.enter.name").build());
}
} | java | public void validateEditDetails(GroupForm group, MessageContext context) {
// ensure the group name is set
if (StringUtils.isBlank(group.getName())) {
context.addMessage(
new MessageBuilder().error().source("name").code("please.enter.name").build());
}
} | [
"public",
"void",
"validateEditDetails",
"(",
"GroupForm",
"group",
",",
"MessageContext",
"context",
")",
"{",
"// ensure the group name is set",
"if",
"(",
"StringUtils",
".",
"isBlank",
"(",
"group",
".",
"getName",
"(",
")",
")",
")",
"{",
"context",
".",
... | Validate the detail editing group view
@param group
@param context | [
"Validate",
"the",
"detail",
"editing",
"group",
"view"
] | train | https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-api/uPortal-api-internal/src/main/java/org/apereo/portal/portlets/groupadmin/GroupFormValidator.java#L30-L37 |
jnr/jnr-x86asm | src/main/java/jnr/x86asm/Asm.java | Asm.mmword_ptr_abs | public static final Mem mmword_ptr_abs(long target, long disp, SEGMENT segmentPrefix) {
return _ptr_build_abs(target, disp, segmentPrefix, SIZE_QWORD);
} | java | public static final Mem mmword_ptr_abs(long target, long disp, SEGMENT segmentPrefix) {
return _ptr_build_abs(target, disp, segmentPrefix, SIZE_QWORD);
} | [
"public",
"static",
"final",
"Mem",
"mmword_ptr_abs",
"(",
"long",
"target",
",",
"long",
"disp",
",",
"SEGMENT",
"segmentPrefix",
")",
"{",
"return",
"_ptr_build_abs",
"(",
"target",
",",
"disp",
",",
"segmentPrefix",
",",
"SIZE_QWORD",
")",
";",
"}"
] | Create mmword (8 bytes) pointer operand
!
! @note This constructor is provided only for convenience for mmx programming. | [
"Create",
"mmword",
"(",
"8",
"bytes",
")",
"pointer",
"operand",
"!",
"!"
] | train | https://github.com/jnr/jnr-x86asm/blob/fdcf68fb3dae49e607a49e33399e3dad1ada5536/src/main/java/jnr/x86asm/Asm.java#L433-L435 |
versionone/VersionOne.SDK.Java.ObjectModel | src/main/java/com/versionone/om/V1InstanceGetter.java | V1InstanceGetter.retrospectives | public Collection<Retrospective> retrospectives(
RetrospectiveFilter filter) {
return get(Retrospective.class, (filter != null) ? filter : new RetrospectiveFilter());
} | java | public Collection<Retrospective> retrospectives(
RetrospectiveFilter filter) {
return get(Retrospective.class, (filter != null) ? filter : new RetrospectiveFilter());
} | [
"public",
"Collection",
"<",
"Retrospective",
">",
"retrospectives",
"(",
"RetrospectiveFilter",
"filter",
")",
"{",
"return",
"get",
"(",
"Retrospective",
".",
"class",
",",
"(",
"filter",
"!=",
"null",
")",
"?",
"filter",
":",
"new",
"RetrospectiveFilter",
"... | Get Retrospective filtered by the criteria specified in the passed in
filter.
@param filter Limit the items returned. If null, then all items returned.
@return Collection of items as specified in the filter. | [
"Get",
"Retrospective",
"filtered",
"by",
"the",
"criteria",
"specified",
"in",
"the",
"passed",
"in",
"filter",
"."
] | train | https://github.com/versionone/VersionOne.SDK.Java.ObjectModel/blob/59d35b67c849299631bca45ee94143237eb2ae1a/src/main/java/com/versionone/om/V1InstanceGetter.java#L282-L285 |
SpartaTech/sparta-spring-web-utils | src/main/java/org/sparta/springwebutils/SpringContextUtils.java | SpringContextUtils.setProperties | private static void setProperties(GenericApplicationContext newContext, Properties properties) {
PropertiesPropertySource pps = new PropertiesPropertySource("external-props", properties);
newContext.getEnvironment().getPropertySources().addFirst(pps);
} | java | private static void setProperties(GenericApplicationContext newContext, Properties properties) {
PropertiesPropertySource pps = new PropertiesPropertySource("external-props", properties);
newContext.getEnvironment().getPropertySources().addFirst(pps);
} | [
"private",
"static",
"void",
"setProperties",
"(",
"GenericApplicationContext",
"newContext",
",",
"Properties",
"properties",
")",
"{",
"PropertiesPropertySource",
"pps",
"=",
"new",
"PropertiesPropertySource",
"(",
"\"external-props\"",
",",
"properties",
")",
";",
"n... | Set properties into the context.
@param newContext new context to add properties
@param properties properties to add to the context | [
"Set",
"properties",
"into",
"the",
"context",
"."
] | train | https://github.com/SpartaTech/sparta-spring-web-utils/blob/f5382474d46a6048d58707fc64e7936277e8b2ce/src/main/java/org/sparta/springwebutils/SpringContextUtils.java#L100-L103 |
OpenLiberty/open-liberty | dev/com.ibm.ws.microprofile.faulttolerance/src/com/ibm/ws/microprofile/faulttolerance/impl/async/QueuedFuture.java | QueuedFuture.start | public void start(ExecutorService executorService, Callable<Future<R>> innerTask, ThreadContextDescriptor threadContext) {
synchronized (this) {
this.innerTask = innerTask;
this.threadContext = threadContext;
//set up the future to hold the result
this.resultFuture = new CompletableFuture<Future<R>>();
//submit the innerTask (wrapped by this) for execution
this.taskFuture = executorService.submit(this);
}
} | java | public void start(ExecutorService executorService, Callable<Future<R>> innerTask, ThreadContextDescriptor threadContext) {
synchronized (this) {
this.innerTask = innerTask;
this.threadContext = threadContext;
//set up the future to hold the result
this.resultFuture = new CompletableFuture<Future<R>>();
//submit the innerTask (wrapped by this) for execution
this.taskFuture = executorService.submit(this);
}
} | [
"public",
"void",
"start",
"(",
"ExecutorService",
"executorService",
",",
"Callable",
"<",
"Future",
"<",
"R",
">",
">",
"innerTask",
",",
"ThreadContextDescriptor",
"threadContext",
")",
"{",
"synchronized",
"(",
"this",
")",
"{",
"this",
".",
"innerTask",
"... | Submit this task for execution by the given executor service.
@param executorService the executor service to use
@param innerTask the task to run
@param threadContext the thread context to apply when running the task | [
"Submit",
"this",
"task",
"for",
"execution",
"by",
"the",
"given",
"executor",
"service",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.faulttolerance/src/com/ibm/ws/microprofile/faulttolerance/impl/async/QueuedFuture.java#L265-L274 |
jsilland/piezo | src/main/java/io/soliton/protobuf/ChannelInitializers.java | ChannelInitializers.protoBuf | public static final <M extends Message> ChannelInitializer<Channel> protoBuf(
final M defaultInstance, final SimpleChannelInboundHandler<M> handler) {
return new ChannelInitializer<Channel>() {
@Override
protected void initChannel(Channel channel) throws Exception {
channel.pipeline().addLast("frameDecoder",
new LengthFieldBasedFrameDecoder(10 * 1024 * 1024, 0, 4, 0, 4));
channel.pipeline().addLast("protobufDecoder",
new ProtobufDecoder(defaultInstance));
channel.pipeline().addLast("frameEncoder", new LengthFieldPrepender(4));
channel.pipeline().addLast("protobufEncoder", new ProtobufEncoder());
channel.pipeline().addLast("applicationHandler", handler);
}
};
} | java | public static final <M extends Message> ChannelInitializer<Channel> protoBuf(
final M defaultInstance, final SimpleChannelInboundHandler<M> handler) {
return new ChannelInitializer<Channel>() {
@Override
protected void initChannel(Channel channel) throws Exception {
channel.pipeline().addLast("frameDecoder",
new LengthFieldBasedFrameDecoder(10 * 1024 * 1024, 0, 4, 0, 4));
channel.pipeline().addLast("protobufDecoder",
new ProtobufDecoder(defaultInstance));
channel.pipeline().addLast("frameEncoder", new LengthFieldPrepender(4));
channel.pipeline().addLast("protobufEncoder", new ProtobufEncoder());
channel.pipeline().addLast("applicationHandler", handler);
}
};
} | [
"public",
"static",
"final",
"<",
"M",
"extends",
"Message",
">",
"ChannelInitializer",
"<",
"Channel",
">",
"protoBuf",
"(",
"final",
"M",
"defaultInstance",
",",
"final",
"SimpleChannelInboundHandler",
"<",
"M",
">",
"handler",
")",
"{",
"return",
"new",
"Ch... | Returns a new channel initializer suited to encode and decode a protocol
buffer message.
<p/>
<p>Message sizes over 10 MB are not supported.</p>
<p/>
<p>The handler will be executed on the I/O thread. Blocking operations
should be executed in their own thread.</p>
@param defaultInstance an instance of the message to handle
@param handler the handler implementing the application logic
@param <M> the type of the support protocol buffer message | [
"Returns",
"a",
"new",
"channel",
"initializer",
"suited",
"to",
"encode",
"and",
"decode",
"a",
"protocol",
"buffer",
"message",
".",
"<p",
"/",
">",
"<p",
">",
"Message",
"sizes",
"over",
"10",
"MB",
"are",
"not",
"supported",
".",
"<",
"/",
"p",
">"... | train | https://github.com/jsilland/piezo/blob/9a340f1460d25e07ec475dd24128b838667c959b/src/main/java/io/soliton/protobuf/ChannelInitializers.java#L59-L74 |
citrusframework/citrus | modules/citrus-selenium/src/main/java/com/consol/citrus/selenium/endpoint/SeleniumBrowser.java | SeleniumBrowser.createRemoteWebDriver | private RemoteWebDriver createRemoteWebDriver(String browserType, String serverAddress) {
try {
switch (browserType) {
case BrowserType.FIREFOX:
DesiredCapabilities defaultsFF = DesiredCapabilities.firefox();
defaultsFF.setCapability(FirefoxDriver.PROFILE, getEndpointConfiguration().getFirefoxProfile());
return new RemoteWebDriver(new URL(serverAddress), defaultsFF);
case BrowserType.IE:
DesiredCapabilities defaultsIE = DesiredCapabilities.internetExplorer();
defaultsIE.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
return new RemoteWebDriver(new URL(serverAddress), defaultsIE);
case BrowserType.CHROME:
DesiredCapabilities defaultsChrome = DesiredCapabilities.chrome();
defaultsChrome.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
return new RemoteWebDriver(new URL(serverAddress), defaultsChrome);
case BrowserType.GOOGLECHROME:
DesiredCapabilities defaultsGoogleChrome = DesiredCapabilities.chrome();
defaultsGoogleChrome.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
return new RemoteWebDriver(new URL(serverAddress), defaultsGoogleChrome);
default:
throw new CitrusRuntimeException("Unsupported remote browser type: " + browserType);
}
} catch (MalformedURLException e) {
throw new CitrusRuntimeException("Failed to access remote server", e);
}
} | java | private RemoteWebDriver createRemoteWebDriver(String browserType, String serverAddress) {
try {
switch (browserType) {
case BrowserType.FIREFOX:
DesiredCapabilities defaultsFF = DesiredCapabilities.firefox();
defaultsFF.setCapability(FirefoxDriver.PROFILE, getEndpointConfiguration().getFirefoxProfile());
return new RemoteWebDriver(new URL(serverAddress), defaultsFF);
case BrowserType.IE:
DesiredCapabilities defaultsIE = DesiredCapabilities.internetExplorer();
defaultsIE.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
return new RemoteWebDriver(new URL(serverAddress), defaultsIE);
case BrowserType.CHROME:
DesiredCapabilities defaultsChrome = DesiredCapabilities.chrome();
defaultsChrome.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
return new RemoteWebDriver(new URL(serverAddress), defaultsChrome);
case BrowserType.GOOGLECHROME:
DesiredCapabilities defaultsGoogleChrome = DesiredCapabilities.chrome();
defaultsGoogleChrome.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
return new RemoteWebDriver(new URL(serverAddress), defaultsGoogleChrome);
default:
throw new CitrusRuntimeException("Unsupported remote browser type: " + browserType);
}
} catch (MalformedURLException e) {
throw new CitrusRuntimeException("Failed to access remote server", e);
}
} | [
"private",
"RemoteWebDriver",
"createRemoteWebDriver",
"(",
"String",
"browserType",
",",
"String",
"serverAddress",
")",
"{",
"try",
"{",
"switch",
"(",
"browserType",
")",
"{",
"case",
"BrowserType",
".",
"FIREFOX",
":",
"DesiredCapabilities",
"defaultsFF",
"=",
... | Creates remote web driver.
@param browserType
@param serverAddress
@return
@throws MalformedURLException | [
"Creates",
"remote",
"web",
"driver",
"."
] | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-selenium/src/main/java/com/consol/citrus/selenium/endpoint/SeleniumBrowser.java#L253-L278 |
Graylog2/graylog2-server | graylog2-server/src/main/java/org/graylog2/plugin/Tools.java | Tools.decompressGzip | public static String decompressGzip(byte[] compressedData, long maxBytes) throws IOException {
try (final ByteArrayInputStream dataStream = new ByteArrayInputStream(compressedData);
final GZIPInputStream in = new GZIPInputStream(dataStream);
final InputStream limited = ByteStreams.limit(in, maxBytes)) {
return new String(ByteStreams.toByteArray(limited), StandardCharsets.UTF_8);
}
} | java | public static String decompressGzip(byte[] compressedData, long maxBytes) throws IOException {
try (final ByteArrayInputStream dataStream = new ByteArrayInputStream(compressedData);
final GZIPInputStream in = new GZIPInputStream(dataStream);
final InputStream limited = ByteStreams.limit(in, maxBytes)) {
return new String(ByteStreams.toByteArray(limited), StandardCharsets.UTF_8);
}
} | [
"public",
"static",
"String",
"decompressGzip",
"(",
"byte",
"[",
"]",
"compressedData",
",",
"long",
"maxBytes",
")",
"throws",
"IOException",
"{",
"try",
"(",
"final",
"ByteArrayInputStream",
"dataStream",
"=",
"new",
"ByteArrayInputStream",
"(",
"compressedData",... | Decompress GZIP (RFC 1952) compressed data
@param compressedData A byte array containing the GZIP-compressed data.
@param maxBytes The maximum number of uncompressed bytes to read.
@return A string containing the decompressed data | [
"Decompress",
"GZIP",
"(",
"RFC",
"1952",
")",
"compressed",
"data"
] | train | https://github.com/Graylog2/graylog2-server/blob/50b565dcead6e0a372236d5c2f8530dc5726fa9b/graylog2-server/src/main/java/org/graylog2/plugin/Tools.java#L237-L243 |
jamesagnew/hapi-fhir | hapi-fhir-utilities/src/main/java/org/hl7/fhir/utilities/IniFile.java | IniFile.removeProperty | public void removeProperty(String pstrSection, String pstrProp)
{
INISection objSec = null;
objSec = (INISection) this.mhmapSections.get(pstrSection);
if (objSec != null)
{
objSec.removeProperty(pstrProp);
objSec = null;
}
} | java | public void removeProperty(String pstrSection, String pstrProp)
{
INISection objSec = null;
objSec = (INISection) this.mhmapSections.get(pstrSection);
if (objSec != null)
{
objSec.removeProperty(pstrProp);
objSec = null;
}
} | [
"public",
"void",
"removeProperty",
"(",
"String",
"pstrSection",
",",
"String",
"pstrProp",
")",
"{",
"INISection",
"objSec",
"=",
"null",
";",
"objSec",
"=",
"(",
"INISection",
")",
"this",
".",
"mhmapSections",
".",
"get",
"(",
"pstrSection",
")",
";",
... | Removed specified property from the specified section. If the specified
section or the property does not exist, does nothing.
@param pstrSection the section name.
@param pstrProp the name of the property to be removed. | [
"Removed",
"specified",
"property",
"from",
"the",
"specified",
"section",
".",
"If",
"the",
"specified",
"section",
"or",
"the",
"property",
"does",
"not",
"exist",
"does",
"nothing",
"."
] | train | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-utilities/src/main/java/org/hl7/fhir/utilities/IniFile.java#L646-L656 |
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.beginUpdateTags | public ExpressRouteCrossConnectionInner beginUpdateTags(String resourceGroupName, String crossConnectionName, Map<String, String> tags) {
return beginUpdateTagsWithServiceResponseAsync(resourceGroupName, crossConnectionName, tags).toBlocking().single().body();
} | java | public ExpressRouteCrossConnectionInner beginUpdateTags(String resourceGroupName, String crossConnectionName, Map<String, String> tags) {
return beginUpdateTagsWithServiceResponseAsync(resourceGroupName, crossConnectionName, tags).toBlocking().single().body();
} | [
"public",
"ExpressRouteCrossConnectionInner",
"beginUpdateTags",
"(",
"String",
"resourceGroupName",
",",
"String",
"crossConnectionName",
",",
"Map",
"<",
"String",
",",
"String",
">",
"tags",
")",
"{",
"return",
"beginUpdateTagsWithServiceResponseAsync",
"(",
"resourceG... | Updates an express route cross connection tags.
@param resourceGroupName The name of the resource group.
@param crossConnectionName The name of the cross connection.
@param tags Resource tags.
@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 ExpressRouteCrossConnectionInner object if successful. | [
"Updates",
"an",
"express",
"route",
"cross",
"connection",
"tags",
"."
] | 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#L834-L836 |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/HashOperations.java | HashOperations.hashSearch | public static int hashSearch(final long[] hashTable, final int lgArrLongs, final long hash) {
if (hash == 0) {
throw new SketchesArgumentException("Given hash cannot be zero: " + hash);
}
final int arrayMask = (1 << lgArrLongs) - 1; // current Size -1
final int stride = getStride(hash, lgArrLongs);
int curProbe = (int) (hash & arrayMask);
// search for duplicate or empty slot
final int loopIndex = curProbe;
do {
final long arrVal = hashTable[curProbe];
if (arrVal == EMPTY) {
return -1; // not found
} else if (arrVal == hash) {
return curProbe; // found
}
curProbe = (curProbe + stride) & arrayMask;
} while (curProbe != loopIndex);
return -1;
} | java | public static int hashSearch(final long[] hashTable, final int lgArrLongs, final long hash) {
if (hash == 0) {
throw new SketchesArgumentException("Given hash cannot be zero: " + hash);
}
final int arrayMask = (1 << lgArrLongs) - 1; // current Size -1
final int stride = getStride(hash, lgArrLongs);
int curProbe = (int) (hash & arrayMask);
// search for duplicate or empty slot
final int loopIndex = curProbe;
do {
final long arrVal = hashTable[curProbe];
if (arrVal == EMPTY) {
return -1; // not found
} else if (arrVal == hash) {
return curProbe; // found
}
curProbe = (curProbe + stride) & arrayMask;
} while (curProbe != loopIndex);
return -1;
} | [
"public",
"static",
"int",
"hashSearch",
"(",
"final",
"long",
"[",
"]",
"hashTable",
",",
"final",
"int",
"lgArrLongs",
",",
"final",
"long",
"hash",
")",
"{",
"if",
"(",
"hash",
"==",
"0",
")",
"{",
"throw",
"new",
"SketchesArgumentException",
"(",
"\"... | This is a classical Knuth-style Open Addressing, Double Hash search scheme for on-heap.
Returns the index if found, -1 if not found.
@param hashTable The hash table to search. Must be a power of 2 in size.
@param lgArrLongs <a href="{@docRoot}/resources/dictionary.html#lgArrLongs">See lgArrLongs</a>.
lgArrLongs ≤ log2(hashTable.length).
@param hash A hash value to search for. Must not be zero.
@return Current probe index if found, -1 if not found. | [
"This",
"is",
"a",
"classical",
"Knuth",
"-",
"style",
"Open",
"Addressing",
"Double",
"Hash",
"search",
"scheme",
"for",
"on",
"-",
"heap",
".",
"Returns",
"the",
"index",
"if",
"found",
"-",
"1",
"if",
"not",
"found",
"."
] | train | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/HashOperations.java#L86-L106 |
pavlospt/RxFile | rxfile/src/main/java/com/pavlospt/rxfile/RxFile.java | RxFile.getThumbnail | public static Observable<Bitmap> getThumbnail(Context context, Uri uri, int requiredWidth,
int requiredHeight, int kind) {
return getThumbnailFromUriWithSizeAndKind(context, uri, requiredWidth, requiredHeight, kind);
} | java | public static Observable<Bitmap> getThumbnail(Context context, Uri uri, int requiredWidth,
int requiredHeight, int kind) {
return getThumbnailFromUriWithSizeAndKind(context, uri, requiredWidth, requiredHeight, kind);
} | [
"public",
"static",
"Observable",
"<",
"Bitmap",
">",
"getThumbnail",
"(",
"Context",
"context",
",",
"Uri",
"uri",
",",
"int",
"requiredWidth",
",",
"int",
"requiredHeight",
",",
"int",
"kind",
")",
"{",
"return",
"getThumbnailFromUriWithSizeAndKind",
"(",
"con... | /*
Get a thumbnail from the provided Image or Video Uri in the specified size and kind.
Kind is a value of MediaStore.Images.Thumbnails.MICRO_KIND or MediaStore.Images.Thumbnails.MINI_KIND | [
"/",
"*",
"Get",
"a",
"thumbnail",
"from",
"the",
"provided",
"Image",
"or",
"Video",
"Uri",
"in",
"the",
"specified",
"size",
"and",
"kind",
".",
"Kind",
"is",
"a",
"value",
"of",
"MediaStore",
".",
"Images",
".",
"Thumbnails",
".",
"MICRO_KIND",
"or",
... | train | https://github.com/pavlospt/RxFile/blob/54210b02631f4b27d31bea040eca86183136cf46/rxfile/src/main/java/com/pavlospt/rxfile/RxFile.java#L194-L197 |
Jasig/uPortal | uPortal-web/src/main/java/org/apereo/portal/portlet/marketplace/MarketplaceService.java | MarketplaceService.mayAddPortlet | @Override
@RequestCache
public boolean mayAddPortlet(final IPerson user, final IPortletDefinition portletDefinition) {
Validate.notNull(user, "Cannot determine if null users can browse portlets.");
Validate.notNull(
portletDefinition,
"Cannot determine whether a user can browse a null portlet definition.");
// short-cut for guest user, it will always be false for guest, otherwise evaluate
return user.isGuest()
? false
: authorizationService.canPrincipalSubscribe(
AuthorizationPrincipalHelper.principalFromUser(user),
portletDefinition.getPortletDefinitionId().getStringId());
} | java | @Override
@RequestCache
public boolean mayAddPortlet(final IPerson user, final IPortletDefinition portletDefinition) {
Validate.notNull(user, "Cannot determine if null users can browse portlets.");
Validate.notNull(
portletDefinition,
"Cannot determine whether a user can browse a null portlet definition.");
// short-cut for guest user, it will always be false for guest, otherwise evaluate
return user.isGuest()
? false
: authorizationService.canPrincipalSubscribe(
AuthorizationPrincipalHelper.principalFromUser(user),
portletDefinition.getPortletDefinitionId().getStringId());
} | [
"@",
"Override",
"@",
"RequestCache",
"public",
"boolean",
"mayAddPortlet",
"(",
"final",
"IPerson",
"user",
",",
"final",
"IPortletDefinition",
"portletDefinition",
")",
"{",
"Validate",
".",
"notNull",
"(",
"user",
",",
"\"Cannot determine if null users can browse por... | Answers whether the given user may add the portlet to their layout
@param user a non-null IPerson who might be permitted to add
@param portletDefinition a non-null portlet definition
@return true if permitted, false otherwise
@throws IllegalArgumentException if user is null
@throws IllegalArgumentException if portletDefinition is null
@since 4.2 | [
"Answers",
"whether",
"the",
"given",
"user",
"may",
"add",
"the",
"portlet",
"to",
"their",
"layout"
] | train | https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-web/src/main/java/org/apereo/portal/portlet/marketplace/MarketplaceService.java#L385-L398 |
jboss/jboss-jsf-api_spec | src/main/java/javax/faces/component/UISelectBoolean.java | UISelectBoolean.setValueBinding | public void setValueBinding(String name, ValueBinding binding) {
if ("selected".equals(name)) {
super.setValueBinding("value", binding);
} else {
super.setValueBinding(name, binding);
}
} | java | public void setValueBinding(String name, ValueBinding binding) {
if ("selected".equals(name)) {
super.setValueBinding("value", binding);
} else {
super.setValueBinding(name, binding);
}
} | [
"public",
"void",
"setValueBinding",
"(",
"String",
"name",
",",
"ValueBinding",
"binding",
")",
"{",
"if",
"(",
"\"selected\"",
".",
"equals",
"(",
"name",
")",
")",
"{",
"super",
".",
"setValueBinding",
"(",
"\"value\"",
",",
"binding",
")",
";",
"}",
... | <p>Store any {@link ValueBinding} specified for <code>selected</code>
under <code>value</code> instead; otherwise, perform the default
superclass processing for this method.</p>
<p>Rely on the superclass implementation to wrap the argument
<code>ValueBinding</code> in a <code>ValueExpression</code>.</p>
@param name Name of the attribute or property for which to set
a {@link ValueBinding}
@param binding The {@link ValueBinding} to set, or <code>null</code>
to remove any currently set {@link ValueBinding}
@throws NullPointerException if <code>name</code>
is <code>null</code>
@deprecated This has been replaced by {@link #setValueExpression}. | [
"<p",
">",
"Store",
"any",
"{",
"@link",
"ValueBinding",
"}",
"specified",
"for",
"<code",
">",
"selected<",
"/",
"code",
">",
"under",
"<code",
">",
"value<",
"/",
"code",
">",
"instead",
";",
"otherwise",
"perform",
"the",
"default",
"superclass",
"proce... | train | https://github.com/jboss/jboss-jsf-api_spec/blob/cb33d215acbab847f2db5cdf2c6fe4d99c0a01c3/src/main/java/javax/faces/component/UISelectBoolean.java#L182-L190 |
box/box-java-sdk | src/main/java/com/box/sdk/BoxFileVersionRetention.java | BoxFileVersionRetention.getAll | public static Iterable<BoxFileVersionRetention.Info> getAll(BoxAPIConnection api, String ... fields) {
return getRetentions(api, new QueryFilter(), fields);
} | java | public static Iterable<BoxFileVersionRetention.Info> getAll(BoxAPIConnection api, String ... fields) {
return getRetentions(api, new QueryFilter(), fields);
} | [
"public",
"static",
"Iterable",
"<",
"BoxFileVersionRetention",
".",
"Info",
">",
"getAll",
"(",
"BoxAPIConnection",
"api",
",",
"String",
"...",
"fields",
")",
"{",
"return",
"getRetentions",
"(",
"api",
",",
"new",
"QueryFilter",
"(",
")",
",",
"fields",
"... | Retrieves all file version retentions.
@param api the API connection to be used by the resource.
@param fields the fields to retrieve.
@return an iterable contains information about all file version retentions. | [
"Retrieves",
"all",
"file",
"version",
"retentions",
"."
] | train | https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/BoxFileVersionRetention.java#L72-L74 |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/ui/CmsInlineEditOverlay.java | CmsInlineEditOverlay.addButton | public void addButton(CmsInlineEntityWidget widget, int absoluteTop) {
setButtonBarVisible(true);
m_buttonPanel.add(widget);
setButtonPosition(widget, absoluteTop);
} | java | public void addButton(CmsInlineEntityWidget widget, int absoluteTop) {
setButtonBarVisible(true);
m_buttonPanel.add(widget);
setButtonPosition(widget, absoluteTop);
} | [
"public",
"void",
"addButton",
"(",
"CmsInlineEntityWidget",
"widget",
",",
"int",
"absoluteTop",
")",
"{",
"setButtonBarVisible",
"(",
"true",
")",
";",
"m_buttonPanel",
".",
"add",
"(",
"widget",
")",
";",
"setButtonPosition",
"(",
"widget",
",",
"absoluteTop"... | Adds a button widget to the button panel.<p>
@param widget the button widget
@param absoluteTop the absolute top position | [
"Adds",
"a",
"button",
"widget",
"to",
"the",
"button",
"panel",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/ui/CmsInlineEditOverlay.java#L259-L264 |
GenesysPureEngage/provisioning-client-java | src/main/java/com/genesys/internal/provisioning/api/ImportApi.java | ImportApi.getImportStatus | public GetImportStatusResponse getImportStatus(String adminName, String tenantName) throws ApiException {
ApiResponse<GetImportStatusResponse> resp = getImportStatusWithHttpInfo(adminName, tenantName);
return resp.getData();
} | java | public GetImportStatusResponse getImportStatus(String adminName, String tenantName) throws ApiException {
ApiResponse<GetImportStatusResponse> resp = getImportStatusWithHttpInfo(adminName, tenantName);
return resp.getData();
} | [
"public",
"GetImportStatusResponse",
"getImportStatus",
"(",
"String",
"adminName",
",",
"String",
"tenantName",
")",
"throws",
"ApiException",
"{",
"ApiResponse",
"<",
"GetImportStatusResponse",
">",
"resp",
"=",
"getImportStatusWithHttpInfo",
"(",
"adminName",
",",
"t... | Get import status.
Get all active imports for the specified tenant.
@param adminName The login name of an administrator for the tenant. (required)
@param tenantName The name of the tenant. (required)
@return GetImportStatusResponse
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body | [
"Get",
"import",
"status",
".",
"Get",
"all",
"active",
"imports",
"for",
"the",
"specified",
"tenant",
"."
] | train | https://github.com/GenesysPureEngage/provisioning-client-java/blob/1ad594c3767cec83052168e350994f922a26f75e/src/main/java/com/genesys/internal/provisioning/api/ImportApi.java#L141-L144 |
akarnokd/akarnokd-xml | src/main/java/hu/akarnokd/xml/XNElement.java | XNElement.getDouble | public double getDouble(String name, String namespace, double defaultValue) {
String v = get(name, namespace);
return v != null ? Double.parseDouble(v) : defaultValue;
} | java | public double getDouble(String name, String namespace, double defaultValue) {
String v = get(name, namespace);
return v != null ? Double.parseDouble(v) : defaultValue;
} | [
"public",
"double",
"getDouble",
"(",
"String",
"name",
",",
"String",
"namespace",
",",
"double",
"defaultValue",
")",
"{",
"String",
"v",
"=",
"get",
"(",
"name",
",",
"namespace",
")",
";",
"return",
"v",
"!=",
"null",
"?",
"Double",
".",
"parseDouble... | Returns the attribute as a double value or the default.
@param name the attribute name
@param namespace the attribute namespace
@param defaultValue the default if the attribute is missing
@return the value | [
"Returns",
"the",
"attribute",
"as",
"a",
"double",
"value",
"or",
"the",
"default",
"."
] | train | https://github.com/akarnokd/akarnokd-xml/blob/57466a5a9cb455a13d7121557c165287b31ee870/src/main/java/hu/akarnokd/xml/XNElement.java#L797-L800 |
redbox-mint/redbox | plugins/transaction/curation/src/main/java/com/googlecode/fascinator/redbox/plugins/curation/redbox/FormDataParser.java | FormDataParser.getObject | private static JsonObject getObject(JsonObject object, String key)
throws IOException {
// Get the existing one
if (object.containsKey(key)) {
Object existing = object.get(key);
if (!(existing instanceof JsonObject)) {
throw new IOException("Invalid field structure, '" + key +
"' expected to be an object, but incompatible "
+ "data type already present.");
}
return (JsonObject) existing;
// Or add a new one
} else {
JsonObject newObject = new JsonObject();
object.put(key, newObject);
return newObject;
}
} | java | private static JsonObject getObject(JsonObject object, String key)
throws IOException {
// Get the existing one
if (object.containsKey(key)) {
Object existing = object.get(key);
if (!(existing instanceof JsonObject)) {
throw new IOException("Invalid field structure, '" + key +
"' expected to be an object, but incompatible "
+ "data type already present.");
}
return (JsonObject) existing;
// Or add a new one
} else {
JsonObject newObject = new JsonObject();
object.put(key, newObject);
return newObject;
}
} | [
"private",
"static",
"JsonObject",
"getObject",
"(",
"JsonObject",
"object",
",",
"String",
"key",
")",
"throws",
"IOException",
"{",
"// Get the existing one",
"if",
"(",
"object",
".",
"containsKey",
"(",
"key",
")",
")",
"{",
"Object",
"existing",
"=",
"obj... | Get a child JSON Object from an incoming JSON object. If the child does
not exist it will be created.
@param object The incoming object we are to look inside
@param key The child node we are looking for
@return JsonObject The child we found or created
@throws IOException if there is a type mismatch on existing data | [
"Get",
"a",
"child",
"JSON",
"Object",
"from",
"an",
"incoming",
"JSON",
"object",
".",
"If",
"the",
"child",
"does",
"not",
"exist",
"it",
"will",
"be",
"created",
"."
] | train | https://github.com/redbox-mint/redbox/blob/1db230f218031b85c48c8603cbb04fce7ac6de0c/plugins/transaction/curation/src/main/java/com/googlecode/fascinator/redbox/plugins/curation/redbox/FormDataParser.java#L300-L318 |
JOML-CI/JOML | src/org/joml/Vector2f.java | Vector2f.set | public Vector2f set(int index, ByteBuffer buffer) {
MemUtil.INSTANCE.get(this, index, buffer);
return this;
} | java | public Vector2f set(int index, ByteBuffer buffer) {
MemUtil.INSTANCE.get(this, index, buffer);
return this;
} | [
"public",
"Vector2f",
"set",
"(",
"int",
"index",
",",
"ByteBuffer",
"buffer",
")",
"{",
"MemUtil",
".",
"INSTANCE",
".",
"get",
"(",
"this",
",",
"index",
",",
"buffer",
")",
";",
"return",
"this",
";",
"}"
] | Read this vector from the supplied {@link ByteBuffer} starting at the specified
absolute buffer position/index.
<p>
This method will not increment the position of the given ByteBuffer.
@param index
the absolute position into the ByteBuffer
@param buffer
values will be read in <code>x, y</code> order
@return this | [
"Read",
"this",
"vector",
"from",
"the",
"supplied",
"{",
"@link",
"ByteBuffer",
"}",
"starting",
"at",
"the",
"specified",
"absolute",
"buffer",
"position",
"/",
"index",
".",
"<p",
">",
"This",
"method",
"will",
"not",
"increment",
"the",
"position",
"of",... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Vector2f.java#L292-L295 |
VoltDB/voltdb | third_party/java/src/com/google_voltpatches/common/base/Preconditions.java | Preconditions.checkArgument | public static void checkArgument(boolean b, @Nullable String errorMessageTemplate, char p1) {
if (!b) {
throw new IllegalArgumentException(format(errorMessageTemplate, p1));
}
} | java | public static void checkArgument(boolean b, @Nullable String errorMessageTemplate, char p1) {
if (!b) {
throw new IllegalArgumentException(format(errorMessageTemplate, p1));
}
} | [
"public",
"static",
"void",
"checkArgument",
"(",
"boolean",
"b",
",",
"@",
"Nullable",
"String",
"errorMessageTemplate",
",",
"char",
"p1",
")",
"{",
"if",
"(",
"!",
"b",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"format",
"(",
"errorMessag... | Ensures the truth of an expression involving one or more parameters to the calling method.
<p>See {@link #checkArgument(boolean, String, Object...)} for details. | [
"Ensures",
"the",
"truth",
"of",
"an",
"expression",
"involving",
"one",
"or",
"more",
"parameters",
"to",
"the",
"calling",
"method",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/com/google_voltpatches/common/base/Preconditions.java#L155-L159 |
raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/implementation/MethodDelegation.java | MethodDelegation.toField | public static MethodDelegation toField(String name, FieldLocator.Factory fieldLocatorFactory) {
return withDefaultConfiguration().toField(name, fieldLocatorFactory);
} | java | public static MethodDelegation toField(String name, FieldLocator.Factory fieldLocatorFactory) {
return withDefaultConfiguration().toField(name, fieldLocatorFactory);
} | [
"public",
"static",
"MethodDelegation",
"toField",
"(",
"String",
"name",
",",
"FieldLocator",
".",
"Factory",
"fieldLocatorFactory",
")",
"{",
"return",
"withDefaultConfiguration",
"(",
")",
".",
"toField",
"(",
"name",
",",
"fieldLocatorFactory",
")",
";",
"}"
] | Delegates any intercepted method to invoke a non-{@code static} method on the instance of the supplied field. To be
considered a valid delegation target, a method must be visible and accessible to the instrumented type. This is the
case if the method's declaring type is either public or in the same package as the instrumented type and if the method
is either public or non-private and in the same package as the instrumented type. Private methods can only be used as
a delegation target if the delegation is targeting the instrumented type.
@param name The field's name.
@param fieldLocatorFactory The field locator factory to use.
@return A delegation that redirects invocations to a method of the specified field's instance. | [
"Delegates",
"any",
"intercepted",
"method",
"to",
"invoke",
"a",
"non",
"-",
"{",
"@code",
"static",
"}",
"method",
"on",
"the",
"instance",
"of",
"the",
"supplied",
"field",
".",
"To",
"be",
"considered",
"a",
"valid",
"delegation",
"target",
"a",
"metho... | train | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/implementation/MethodDelegation.java#L465-L467 |
jayantk/jklol | src/com/jayantkrish/jklol/evaluation/Example.java | Example.outputGetter | public static <B> Function<Example<?, B>, B> outputGetter() {
return new Function<Example<?, B>, B>() {
@Override
public B apply(Example<?, B> item) {
return item.getOutput();
}
};
} | java | public static <B> Function<Example<?, B>, B> outputGetter() {
return new Function<Example<?, B>, B>() {
@Override
public B apply(Example<?, B> item) {
return item.getOutput();
}
};
} | [
"public",
"static",
"<",
"B",
">",
"Function",
"<",
"Example",
"<",
"?",
",",
"B",
">",
",",
"B",
">",
"outputGetter",
"(",
")",
"{",
"return",
"new",
"Function",
"<",
"Example",
"<",
"?",
",",
"B",
">",
",",
"B",
">",
"(",
")",
"{",
"@",
"Ov... | Gets a function which maps {@code Example}s to their output value.
@return | [
"Gets",
"a",
"function",
"which",
"maps",
"{",
"@code",
"Example",
"}",
"s",
"to",
"their",
"output",
"value",
"."
] | train | https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/evaluation/Example.java#L108-L115 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/implementation/ComputerVisionImpl.java | ComputerVisionImpl.recognizePrintedTextInStreamWithServiceResponseAsync | public Observable<ServiceResponse<OcrResult>> recognizePrintedTextInStreamWithServiceResponseAsync(boolean detectOrientation, byte[] image, RecognizePrintedTextInStreamOptionalParameter recognizePrintedTextInStreamOptionalParameter) {
if (this.client.endpoint() == null) {
throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null.");
}
if (image == null) {
throw new IllegalArgumentException("Parameter image is required and cannot be null.");
}
final OcrLanguages language = recognizePrintedTextInStreamOptionalParameter != null ? recognizePrintedTextInStreamOptionalParameter.language() : null;
return recognizePrintedTextInStreamWithServiceResponseAsync(detectOrientation, image, language);
} | java | public Observable<ServiceResponse<OcrResult>> recognizePrintedTextInStreamWithServiceResponseAsync(boolean detectOrientation, byte[] image, RecognizePrintedTextInStreamOptionalParameter recognizePrintedTextInStreamOptionalParameter) {
if (this.client.endpoint() == null) {
throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null.");
}
if (image == null) {
throw new IllegalArgumentException("Parameter image is required and cannot be null.");
}
final OcrLanguages language = recognizePrintedTextInStreamOptionalParameter != null ? recognizePrintedTextInStreamOptionalParameter.language() : null;
return recognizePrintedTextInStreamWithServiceResponseAsync(detectOrientation, image, language);
} | [
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"OcrResult",
">",
">",
"recognizePrintedTextInStreamWithServiceResponseAsync",
"(",
"boolean",
"detectOrientation",
",",
"byte",
"[",
"]",
"image",
",",
"RecognizePrintedTextInStreamOptionalParameter",
"recognizePrintedTextIn... | Optical Character Recognition (OCR) detects printed text in an image and extracts the recognized characters into a machine-usable character stream. Upon success, the OCR results will be returned. Upon failure, the error code together with an error message will be returned. The error code can be one of InvalidImageUrl, InvalidImageFormat, InvalidImageSize, NotSupportedImage, NotSupportedLanguage, or InternalServerError.
@param detectOrientation Whether detect the text orientation in the image. With detectOrientation=true the OCR service tries to detect the image orientation and correct it before further processing (e.g. if it's upside-down).
@param image An image stream.
@param recognizePrintedTextInStreamOptionalParameter 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 OcrResult object | [
"Optical",
"Character",
"Recognition",
"(",
"OCR",
")",
"detects",
"printed",
"text",
"in",
"an",
"image",
"and",
"extracts",
"the",
"recognized",
"characters",
"into",
"a",
"machine",
"-",
"usable",
"character",
"stream",
".",
"Upon",
"success",
"the",
"OCR",... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/implementation/ComputerVisionImpl.java#L785-L795 |
Azure/azure-sdk-for-java | containerregistry/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/containerregistry/v2017_10_01/implementation/RegistriesInner.java | RegistriesInner.listPolicies | public RegistryPoliciesInner listPolicies(String resourceGroupName, String registryName) {
return listPoliciesWithServiceResponseAsync(resourceGroupName, registryName).toBlocking().single().body();
} | java | public RegistryPoliciesInner listPolicies(String resourceGroupName, String registryName) {
return listPoliciesWithServiceResponseAsync(resourceGroupName, registryName).toBlocking().single().body();
} | [
"public",
"RegistryPoliciesInner",
"listPolicies",
"(",
"String",
"resourceGroupName",
",",
"String",
"registryName",
")",
"{",
"return",
"listPoliciesWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"registryName",
")",
".",
"toBlocking",
"(",
")",
".",
"singl... | Lists the policies for the specified container registry.
@param resourceGroupName The name of the resource group to which the container registry belongs.
@param registryName The name of the container registry.
@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 RegistryPoliciesInner object if successful. | [
"Lists",
"the",
"policies",
"for",
"the",
"specified",
"container",
"registry",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerregistry/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/containerregistry/v2017_10_01/implementation/RegistriesInner.java#L1491-L1493 |
jmeetsma/Iglu-Util | src/main/java/org/ijsberg/iglu/util/misc/StringSupport.java | StringSupport.removeAll | public static String removeAll(String haystack, String ... needles) {
return replaceAll(haystack, needles, ArraySupport.getFilledArray(new String[needles.length], ""));
} | java | public static String removeAll(String haystack, String ... needles) {
return replaceAll(haystack, needles, ArraySupport.getFilledArray(new String[needles.length], ""));
} | [
"public",
"static",
"String",
"removeAll",
"(",
"String",
"haystack",
",",
"String",
"...",
"needles",
")",
"{",
"return",
"replaceAll",
"(",
"haystack",
",",
"needles",
",",
"ArraySupport",
".",
"getFilledArray",
"(",
"new",
"String",
"[",
"needles",
".",
"... | removes all occurrences of needle in haystack
@param haystack input string
@param needles strings to remove | [
"removes",
"all",
"occurrences",
"of",
"needle",
"in",
"haystack"
] | train | https://github.com/jmeetsma/Iglu-Util/blob/971eb022115247b1e34dc26dd02e7e621e29e910/src/main/java/org/ijsberg/iglu/util/misc/StringSupport.java#L250-L252 |
liferay/com-liferay-commerce | commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionOptionRelPersistenceImpl.java | CPDefinitionOptionRelPersistenceImpl.findByC_SC | @Override
public List<CPDefinitionOptionRel> findByC_SC(long CPDefinitionId,
boolean skuContributor, int start, int end) {
return findByC_SC(CPDefinitionId, skuContributor, start, end, null);
} | java | @Override
public List<CPDefinitionOptionRel> findByC_SC(long CPDefinitionId,
boolean skuContributor, int start, int end) {
return findByC_SC(CPDefinitionId, skuContributor, start, end, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CPDefinitionOptionRel",
">",
"findByC_SC",
"(",
"long",
"CPDefinitionId",
",",
"boolean",
"skuContributor",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"return",
"findByC_SC",
"(",
"CPDefinitionId",
",",
"skuContrib... | Returns a range of all the cp definition option rels where CPDefinitionId = ? and skuContributor = ?.
<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 CPDefinitionOptionRelModelImpl}. 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 CPDefinitionId the cp definition ID
@param skuContributor the sku contributor
@param start the lower bound of the range of cp definition option rels
@param end the upper bound of the range of cp definition option rels (not inclusive)
@return the range of matching cp definition option rels | [
"Returns",
"a",
"range",
"of",
"all",
"the",
"cp",
"definition",
"option",
"rels",
"where",
"CPDefinitionId",
"=",
"?",
";",
"and",
"skuContributor",
"=",
"?",
";",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionOptionRelPersistenceImpl.java#L3313-L3317 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/stat/appfw/appfwpolicylabel_stats.java | appfwpolicylabel_stats.get | public static appfwpolicylabel_stats get(nitro_service service, String labelname) throws Exception{
appfwpolicylabel_stats obj = new appfwpolicylabel_stats();
obj.set_labelname(labelname);
appfwpolicylabel_stats response = (appfwpolicylabel_stats) obj.stat_resource(service);
return response;
} | java | public static appfwpolicylabel_stats get(nitro_service service, String labelname) throws Exception{
appfwpolicylabel_stats obj = new appfwpolicylabel_stats();
obj.set_labelname(labelname);
appfwpolicylabel_stats response = (appfwpolicylabel_stats) obj.stat_resource(service);
return response;
} | [
"public",
"static",
"appfwpolicylabel_stats",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"labelname",
")",
"throws",
"Exception",
"{",
"appfwpolicylabel_stats",
"obj",
"=",
"new",
"appfwpolicylabel_stats",
"(",
")",
";",
"obj",
".",
"set_labelname",
"(",... | Use this API to fetch statistics of appfwpolicylabel_stats resource of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"statistics",
"of",
"appfwpolicylabel_stats",
"resource",
"of",
"given",
"name",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/stat/appfw/appfwpolicylabel_stats.java#L149-L154 |
QSFT/Doradus | doradus-client/src/main/java/com/dell/doradus/client/SSLTransportParameters.java | SSLTransportParameters.setTrustStore | public void setTrustStore(String trustStore, String trustPass, String trustManagerType, String trustStoreType)
{
if((trustStore == null) || (trustPass == null))
{
this.trustStore = System.getProperty("javax.net.ssl.trustStore");
this.trustPass = System.getProperty("javax.net.ssl.trustStorePassword");
}
else
{
this.trustStore = trustStore;
this.trustPass = trustPass;
}
if (trustManagerType != null) {
this.trustManagerType = trustManagerType;
}
if (trustStoreType != null) {
this.trustStoreType = trustStoreType;
}
isTrustStoreSet = (trustStore != null) && (trustPass != null);
} | java | public void setTrustStore(String trustStore, String trustPass, String trustManagerType, String trustStoreType)
{
if((trustStore == null) || (trustPass == null))
{
this.trustStore = System.getProperty("javax.net.ssl.trustStore");
this.trustPass = System.getProperty("javax.net.ssl.trustStorePassword");
}
else
{
this.trustStore = trustStore;
this.trustPass = trustPass;
}
if (trustManagerType != null) {
this.trustManagerType = trustManagerType;
}
if (trustStoreType != null) {
this.trustStoreType = trustStoreType;
}
isTrustStoreSet = (trustStore != null) && (trustPass != null);
} | [
"public",
"void",
"setTrustStore",
"(",
"String",
"trustStore",
",",
"String",
"trustPass",
",",
"String",
"trustManagerType",
",",
"String",
"trustStoreType",
")",
"{",
"if",
"(",
"(",
"trustStore",
"==",
"null",
")",
"||",
"(",
"trustPass",
"==",
"null",
"... | Set the truststore, password, certificate type and the store type
@param trustStore Location of the Truststore on disk
@param trustPass Truststore password
@param trustManagerType The default is X509
@param trustStoreType The default is JKS | [
"Set",
"the",
"truststore",
"password",
"certificate",
"type",
"and",
"the",
"store",
"type"
] | train | https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-client/src/main/java/com/dell/doradus/client/SSLTransportParameters.java#L226-L246 |
igniterealtime/Smack | smack-openpgp/src/main/java/org/jivesoftware/smackx/ox_im/OXInstantMessagingManager.java | OXInstantMessagingManager.sendOxMessage | public OpenPgpMetadata sendOxMessage(OpenPgpContact contact, CharSequence body)
throws InterruptedException, IOException,
SmackException.NotConnectedException, SmackException.NotLoggedInException, PGPException {
Message message = new Message(contact.getJid());
Message.Body mBody = new Message.Body(null, body.toString());
OpenPgpMetadata metadata = addOxMessage(message, contact, Collections.<ExtensionElement>singletonList(mBody));
ChatManager.getInstanceFor(connection()).chatWith(contact.getJid().asEntityBareJidIfPossible()).send(message);
return metadata;
} | java | public OpenPgpMetadata sendOxMessage(OpenPgpContact contact, CharSequence body)
throws InterruptedException, IOException,
SmackException.NotConnectedException, SmackException.NotLoggedInException, PGPException {
Message message = new Message(contact.getJid());
Message.Body mBody = new Message.Body(null, body.toString());
OpenPgpMetadata metadata = addOxMessage(message, contact, Collections.<ExtensionElement>singletonList(mBody));
ChatManager.getInstanceFor(connection()).chatWith(contact.getJid().asEntityBareJidIfPossible()).send(message);
return metadata;
} | [
"public",
"OpenPgpMetadata",
"sendOxMessage",
"(",
"OpenPgpContact",
"contact",
",",
"CharSequence",
"body",
")",
"throws",
"InterruptedException",
",",
"IOException",
",",
"SmackException",
".",
"NotConnectedException",
",",
"SmackException",
".",
"NotLoggedInException",
... | Send an OX message to a {@link OpenPgpContact}. The message will be encrypted to all active keys of the contact,
as well as all of our active keys. The message is also signed with our key.
@param contact contact capable of OpenPGP for XMPP: Instant Messaging.
@param body message body.
@return {@link OpenPgpMetadata} about the messages encryption + signatures.
@throws InterruptedException if the thread is interrupted
@throws IOException IO is dangerous
@throws SmackException.NotConnectedException if we are not connected
@throws SmackException.NotLoggedInException if we are not logged in
@throws PGPException PGP is brittle | [
"Send",
"an",
"OX",
"message",
"to",
"a",
"{",
"@link",
"OpenPgpContact",
"}",
".",
"The",
"message",
"will",
"be",
"encrypted",
"to",
"all",
"active",
"keys",
"of",
"the",
"contact",
"as",
"well",
"as",
"all",
"of",
"our",
"active",
"keys",
".",
"The"... | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox_im/OXInstantMessagingManager.java#L227-L238 |
js-lib-com/commons | src/main/java/js/converter/UrlConverter.java | UrlConverter.asObject | @Override
public <T> T asObject(String string, Class<T> valueType) throws ConverterException {
// at this point value type is guaranteed to be URL
try {
return (T) new URL(string);
} catch (MalformedURLException e) {
throw new ConverterException(e.getMessage());
}
} | java | @Override
public <T> T asObject(String string, Class<T> valueType) throws ConverterException {
// at this point value type is guaranteed to be URL
try {
return (T) new URL(string);
} catch (MalformedURLException e) {
throw new ConverterException(e.getMessage());
}
} | [
"@",
"Override",
"public",
"<",
"T",
">",
"T",
"asObject",
"(",
"String",
"string",
",",
"Class",
"<",
"T",
">",
"valueType",
")",
"throws",
"ConverterException",
"{",
"// at this point value type is guaranteed to be URL\r",
"try",
"{",
"return",
"(",
"T",
")",
... | Convert URL string representation into URL instance.
@throws ConverterException if given string is not a valid URL. | [
"Convert",
"URL",
"string",
"representation",
"into",
"URL",
"instance",
"."
] | train | https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/converter/UrlConverter.java#L23-L31 |
sawano/java-commons | src/main/java/se/sawano/java/commons/lang/validate/AbstractValidate.java | AbstractValidate.isFalse | public void isFalse(final boolean expression, final String message, final long value) {
if (expression) {
fail(String.format(message, value));
}
} | java | public void isFalse(final boolean expression, final String message, final long value) {
if (expression) {
fail(String.format(message, value));
}
} | [
"public",
"void",
"isFalse",
"(",
"final",
"boolean",
"expression",
",",
"final",
"String",
"message",
",",
"final",
"long",
"value",
")",
"{",
"if",
"(",
"expression",
")",
"{",
"fail",
"(",
"String",
".",
"format",
"(",
"message",
",",
"value",
")",
... | <p>Validate that the argument condition is {@code false}; otherwise throwing an exception with the specified message. This method is useful when validating according to an arbitrary boolean
expression, such as validating a primitive number or using your own custom validation expression.</p>
<pre>
Validate.isFalse(age <= 20, "The age must be greater than 20: %d", age);
</pre>
<p>For performance reasons, the long value is passed as a separate parameter and appended to the exception message only in the case of an error.</p>
@param expression
the boolean expression to check
@param message
the {@link String#format(String, Object...)} exception message if invalid, not null
@param value
the value to append to the message when invalid
@throws IllegalArgumentValidationException
if expression is {@code true}
@see #isFalse(boolean)
@see #isFalse(boolean, String, double)
@see #isFalse(boolean, String, Object...) | [
"<p",
">",
"Validate",
"that",
"the",
"argument",
"condition",
"is",
"{",
"@code",
"false",
"}",
";",
"otherwise",
"throwing",
"an",
"exception",
"with",
"the",
"specified",
"message",
".",
"This",
"method",
"is",
"useful",
"when",
"validating",
"according",
... | train | https://github.com/sawano/java-commons/blob/6f219c9e8dec4401dbe528d17ae6ec1ef9c0d284/src/main/java/se/sawano/java/commons/lang/validate/AbstractValidate.java#L406-L410 |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/GenericWriteAheadSink.java | GenericWriteAheadSink.saveHandleInState | private void saveHandleInState(final long checkpointId, final long timestamp) throws Exception {
//only add handle if a new OperatorState was created since the last snapshot
if (out != null) {
int subtaskIdx = getRuntimeContext().getIndexOfThisSubtask();
StreamStateHandle handle = out.closeAndGetHandle();
PendingCheckpoint pendingCheckpoint = new PendingCheckpoint(
checkpointId, subtaskIdx, timestamp, handle);
if (pendingCheckpoints.contains(pendingCheckpoint)) {
//we already have a checkpoint stored for that ID that may have been partially written,
//so we discard this "alternate version" and use the stored checkpoint
handle.discardState();
} else {
pendingCheckpoints.add(pendingCheckpoint);
}
out = null;
}
} | java | private void saveHandleInState(final long checkpointId, final long timestamp) throws Exception {
//only add handle if a new OperatorState was created since the last snapshot
if (out != null) {
int subtaskIdx = getRuntimeContext().getIndexOfThisSubtask();
StreamStateHandle handle = out.closeAndGetHandle();
PendingCheckpoint pendingCheckpoint = new PendingCheckpoint(
checkpointId, subtaskIdx, timestamp, handle);
if (pendingCheckpoints.contains(pendingCheckpoint)) {
//we already have a checkpoint stored for that ID that may have been partially written,
//so we discard this "alternate version" and use the stored checkpoint
handle.discardState();
} else {
pendingCheckpoints.add(pendingCheckpoint);
}
out = null;
}
} | [
"private",
"void",
"saveHandleInState",
"(",
"final",
"long",
"checkpointId",
",",
"final",
"long",
"timestamp",
")",
"throws",
"Exception",
"{",
"//only add handle if a new OperatorState was created since the last snapshot",
"if",
"(",
"out",
"!=",
"null",
")",
"{",
"i... | Called when a checkpoint barrier arrives. It closes any open streams to the backend
and marks them as pending for committing to the external, third-party storage system.
@param checkpointId the id of the latest received checkpoint.
@throws IOException in case something went wrong when handling the stream to the backend. | [
"Called",
"when",
"a",
"checkpoint",
"barrier",
"arrives",
".",
"It",
"closes",
"any",
"open",
"streams",
"to",
"the",
"backend",
"and",
"marks",
"them",
"as",
"pending",
"for",
"committing",
"to",
"the",
"external",
"third",
"-",
"party",
"storage",
"system... | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/operators/GenericWriteAheadSink.java#L136-L155 |
looly/hulu | src/main/java/com/xiaoleilu/hulu/ActionContext.java | ActionContext.handle | protected static boolean handle(ServletRequest req, ServletResponse res) {
return handler.handle((HttpServletRequest)req, (HttpServletResponse)res);
} | java | protected static boolean handle(ServletRequest req, ServletResponse res) {
return handler.handle((HttpServletRequest)req, (HttpServletResponse)res);
} | [
"protected",
"static",
"boolean",
"handle",
"(",
"ServletRequest",
"req",
",",
"ServletResponse",
"res",
")",
"{",
"return",
"handler",
".",
"handle",
"(",
"(",
"HttpServletRequest",
")",
"req",
",",
"(",
"HttpServletResponse",
")",
"res",
")",
";",
"}"
] | 注入ServletRequest 和 ServletResponse并处理请求
@param req ServletRequest
@param res ServletResponse
@return 是否处理成功 | [
"注入ServletRequest",
"和",
"ServletResponse并处理请求"
] | train | https://github.com/looly/hulu/blob/4072de684e2e2f28ac8a3a44c0d5a690b289ef28/src/main/java/com/xiaoleilu/hulu/ActionContext.java#L91-L93 |
alibaba/jstorm | jstorm-core/src/main/java/com/alibaba/jstorm/daemon/supervisor/SyncProcessEvent.java | SyncProcessEvent.matchesAssignment | public boolean matchesAssignment(WorkerHeartbeat whb, Map<Integer, LocalAssignment> assignedTasks) {
boolean isMatch = true;
LocalAssignment localAssignment = assignedTasks.get(whb.getPort());
if (localAssignment == null) {
LOG.debug("Following worker has been removed, port=" + whb.getPort() + ", assignedTasks=" + assignedTasks);
isMatch = false;
} else if (!whb.getTopologyId().equals(localAssignment.getTopologyId())) {
// topology id not equal
LOG.info("topology id not equal whb=" + whb.getTopologyId() + ",localAssignment=" + localAssignment.getTopologyId());
isMatch = false;
}/*
* else if (!(whb.getTaskIds().equals(localAssignment.getTaskIds()))) { // task-id isn't equal LOG.info("task-id isn't equal whb=" + whb.getTaskIds() +
* ",localAssignment=" + localAssignment.getTaskIds()); isMatch = false; }
*/
return isMatch;
} | java | public boolean matchesAssignment(WorkerHeartbeat whb, Map<Integer, LocalAssignment> assignedTasks) {
boolean isMatch = true;
LocalAssignment localAssignment = assignedTasks.get(whb.getPort());
if (localAssignment == null) {
LOG.debug("Following worker has been removed, port=" + whb.getPort() + ", assignedTasks=" + assignedTasks);
isMatch = false;
} else if (!whb.getTopologyId().equals(localAssignment.getTopologyId())) {
// topology id not equal
LOG.info("topology id not equal whb=" + whb.getTopologyId() + ",localAssignment=" + localAssignment.getTopologyId());
isMatch = false;
}/*
* else if (!(whb.getTaskIds().equals(localAssignment.getTaskIds()))) { // task-id isn't equal LOG.info("task-id isn't equal whb=" + whb.getTaskIds() +
* ",localAssignment=" + localAssignment.getTaskIds()); isMatch = false; }
*/
return isMatch;
} | [
"public",
"boolean",
"matchesAssignment",
"(",
"WorkerHeartbeat",
"whb",
",",
"Map",
"<",
"Integer",
",",
"LocalAssignment",
">",
"assignedTasks",
")",
"{",
"boolean",
"isMatch",
"=",
"true",
";",
"LocalAssignment",
"localAssignment",
"=",
"assignedTasks",
".",
"g... | check whether the worker heartbeat is allowed in the assignedTasks
@param whb WorkerHeartbeat
@param assignedTasks assigned tasks
@return if true, the assignments(LS-LOCAL-ASSIGNMENTS) match with worker heartbeat, false otherwise | [
"check",
"whether",
"the",
"worker",
"heartbeat",
"is",
"allowed",
"in",
"the",
"assignedTasks"
] | train | https://github.com/alibaba/jstorm/blob/5d6cde22dbca7df3d6e6830bf94f98a6639ab559/jstorm-core/src/main/java/com/alibaba/jstorm/daemon/supervisor/SyncProcessEvent.java#L437-L453 |
apache/incubator-gobblin | gobblin-utility/src/main/java/org/apache/gobblin/util/HadoopUtils.java | HadoopUtils.renamePath | public static void renamePath(FileContext fc, Path oldName, Path newName, boolean overwrite)
throws IOException {
Options.Rename renameOptions = (overwrite) ? Options.Rename.OVERWRITE : Options.Rename.NONE;
fc.rename(oldName, newName, renameOptions);
} | java | public static void renamePath(FileContext fc, Path oldName, Path newName, boolean overwrite)
throws IOException {
Options.Rename renameOptions = (overwrite) ? Options.Rename.OVERWRITE : Options.Rename.NONE;
fc.rename(oldName, newName, renameOptions);
} | [
"public",
"static",
"void",
"renamePath",
"(",
"FileContext",
"fc",
",",
"Path",
"oldName",
",",
"Path",
"newName",
",",
"boolean",
"overwrite",
")",
"throws",
"IOException",
"{",
"Options",
".",
"Rename",
"renameOptions",
"=",
"(",
"overwrite",
")",
"?",
"O... | A wrapper around {@link FileContext#rename(Path, Path, Options.Rename...)}}. | [
"A",
"wrapper",
"around",
"{"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/HadoopUtils.java#L250-L254 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/ba/Hierarchy.java | Hierarchy.findMethod | @Deprecated
public static JavaClassAndMethod findMethod(JavaClass[] classList, String methodName, String methodSig) {
return findMethod(classList, methodName, methodSig, ANY_METHOD);
} | java | @Deprecated
public static JavaClassAndMethod findMethod(JavaClass[] classList, String methodName, String methodSig) {
return findMethod(classList, methodName, methodSig, ANY_METHOD);
} | [
"@",
"Deprecated",
"public",
"static",
"JavaClassAndMethod",
"findMethod",
"(",
"JavaClass",
"[",
"]",
"classList",
",",
"String",
"methodName",
",",
"String",
"methodSig",
")",
"{",
"return",
"findMethod",
"(",
"classList",
",",
"methodName",
",",
"methodSig",
... | Find a method in given list of classes, searching the classes in order.
@param classList
list of classes in which to search
@param methodName
the name of the method
@param methodSig
the signature of the method
@return the JavaClassAndMethod, or null if no such method exists in the
class | [
"Find",
"a",
"method",
"in",
"given",
"list",
"of",
"classes",
"searching",
"the",
"classes",
"in",
"order",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/Hierarchy.java#L622-L625 |
actorapp/actor-platform | actor-sdk/sdk-core-android/android-sdk/src/main/java/im/actor/sdk/util/images/ops/ImageLoading.java | ImageLoading.loadReuse | public static ReuseResult loadReuse(Uri uri, Context context, Bitmap dest) throws ImageLoadException {
return loadBitmapReuse(new UriSource(uri, context), dest);
} | java | public static ReuseResult loadReuse(Uri uri, Context context, Bitmap dest) throws ImageLoadException {
return loadBitmapReuse(new UriSource(uri, context), dest);
} | [
"public",
"static",
"ReuseResult",
"loadReuse",
"(",
"Uri",
"uri",
",",
"Context",
"context",
",",
"Bitmap",
"dest",
")",
"throws",
"ImageLoadException",
"{",
"return",
"loadBitmapReuse",
"(",
"new",
"UriSource",
"(",
"uri",
",",
"context",
")",
",",
"dest",
... | Loading bitmap with using reuse bitmap with the different size of source image.
If it is unable to load with reuse method tries to load without it.
Reuse works only for Android 4.4+
@param uri content uri for bitmap
@param dest destination bitmap
@param context Application Context
@return result of loading
@throws ImageLoadException if it is unable to load file | [
"Loading",
"bitmap",
"with",
"using",
"reuse",
"bitmap",
"with",
"the",
"different",
"size",
"of",
"source",
"image",
".",
"If",
"it",
"is",
"unable",
"to",
"load",
"with",
"reuse",
"method",
"tries",
"to",
"load",
"without",
"it",
".",
"Reuse",
"works",
... | train | https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core-android/android-sdk/src/main/java/im/actor/sdk/util/images/ops/ImageLoading.java#L231-L233 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/watch/WatchMonitor.java | WatchMonitor.create | public static WatchMonitor create(Path path, int maxDepth, WatchEvent.Kind<?>... events){
return new WatchMonitor(path, maxDepth, events);
} | java | public static WatchMonitor create(Path path, int maxDepth, WatchEvent.Kind<?>... events){
return new WatchMonitor(path, maxDepth, events);
} | [
"public",
"static",
"WatchMonitor",
"create",
"(",
"Path",
"path",
",",
"int",
"maxDepth",
",",
"WatchEvent",
".",
"Kind",
"<",
"?",
">",
"...",
"events",
")",
"{",
"return",
"new",
"WatchMonitor",
"(",
"path",
",",
"maxDepth",
",",
"events",
")",
";",
... | 创建并初始化监听
@param path 路径
@param events 监听事件列表
@param maxDepth 当监听目录时,监听目录的最大深度,当设置值为1(或小于1)时,表示不递归监听子目录
@return 监听对象 | [
"创建并初始化监听"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/watch/WatchMonitor.java#L183-L185 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/Duration.java | Duration.create | private static Duration create(long seconds, int nanoAdjustment) {
if ((seconds | nanoAdjustment) == 0) {
return ZERO;
}
return new Duration(seconds, nanoAdjustment);
} | java | private static Duration create(long seconds, int nanoAdjustment) {
if ((seconds | nanoAdjustment) == 0) {
return ZERO;
}
return new Duration(seconds, nanoAdjustment);
} | [
"private",
"static",
"Duration",
"create",
"(",
"long",
"seconds",
",",
"int",
"nanoAdjustment",
")",
"{",
"if",
"(",
"(",
"seconds",
"|",
"nanoAdjustment",
")",
"==",
"0",
")",
"{",
"return",
"ZERO",
";",
"}",
"return",
"new",
"Duration",
"(",
"seconds"... | Obtains an instance of {@code Duration} using seconds and nanoseconds.
@param seconds the length of the duration in seconds, positive or negative
@param nanoAdjustment the nanosecond adjustment within the second, from 0 to 999,999,999 | [
"Obtains",
"an",
"instance",
"of",
"{",
"@code",
"Duration",
"}",
"using",
"seconds",
"and",
"nanoseconds",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/Duration.java#L492-L497 |
redkale/redkale | src/org/redkale/convert/ConvertFactory.java | ConvertFactory.registerIgnoreAll | public final void registerIgnoreAll(final Class type, String... excludeColumns) {
Set<String> set = ignoreAlls.get(type);
if (set == null) {
ignoreAlls.put(type, new HashSet<>(Arrays.asList(excludeColumns)));
} else {
set.addAll(Arrays.asList(excludeColumns));
}
} | java | public final void registerIgnoreAll(final Class type, String... excludeColumns) {
Set<String> set = ignoreAlls.get(type);
if (set == null) {
ignoreAlls.put(type, new HashSet<>(Arrays.asList(excludeColumns)));
} else {
set.addAll(Arrays.asList(excludeColumns));
}
} | [
"public",
"final",
"void",
"registerIgnoreAll",
"(",
"final",
"Class",
"type",
",",
"String",
"...",
"excludeColumns",
")",
"{",
"Set",
"<",
"String",
">",
"set",
"=",
"ignoreAlls",
".",
"get",
"(",
"type",
")",
";",
"if",
"(",
"set",
"==",
"null",
")"... | 屏蔽指定类所有字段,仅仅保留指定字段 <br>
<b>注意: 该配置优先级高于skipAllIgnore和ConvertColumnEntry配置</b>
@param type 指定的类
@param excludeColumns 需要排除的字段名 | [
"屏蔽指定类所有字段,仅仅保留指定字段",
"<br",
">",
"<b",
">",
"注意",
":",
"该配置优先级高于skipAllIgnore和ConvertColumnEntry配置<",
"/",
"b",
">"
] | train | https://github.com/redkale/redkale/blob/ea5169b5c5ea7412fd762331c0c497165832e901/src/org/redkale/convert/ConvertFactory.java#L400-L407 |
terrestris/shogun-core | src/shogun-core-main/src/main/java/de/terrestris/shoguncore/service/UserService.java | UserService.registerUser | public E registerUser(E user, HttpServletRequest request) throws Exception {
String email = user.getEmail();
// check if a user with the email already exists
E existingUser = dao.findByEmail(email);
if (existingUser != null) {
final String errorMessage = "User with eMail '" + email + "' already exists.";
LOG.info(errorMessage);
throw new Exception(errorMessage);
}
user = (E) this.persistNewUser(user, true);
// create a token for the user and send an email with an "activation" link
registrationTokenService.sendRegistrationActivationMail(request, user);
return user;
} | java | public E registerUser(E user, HttpServletRequest request) throws Exception {
String email = user.getEmail();
// check if a user with the email already exists
E existingUser = dao.findByEmail(email);
if (existingUser != null) {
final String errorMessage = "User with eMail '" + email + "' already exists.";
LOG.info(errorMessage);
throw new Exception(errorMessage);
}
user = (E) this.persistNewUser(user, true);
// create a token for the user and send an email with an "activation" link
registrationTokenService.sendRegistrationActivationMail(request, user);
return user;
} | [
"public",
"E",
"registerUser",
"(",
"E",
"user",
",",
"HttpServletRequest",
"request",
")",
"throws",
"Exception",
"{",
"String",
"email",
"=",
"user",
".",
"getEmail",
"(",
")",
";",
"// check if a user with the email already exists",
"E",
"existingUser",
"=",
"d... | Registers a new user. Initially, the user will be inactive. An email with
an activation link will be sent to the user.
@param user A user with an UNencrypted password (!)
@param request
@throws Exception | [
"Registers",
"a",
"new",
"user",
".",
"Initially",
"the",
"user",
"will",
"be",
"inactive",
".",
"An",
"email",
"with",
"an",
"activation",
"link",
"will",
"be",
"sent",
"to",
"the",
"user",
"."
] | train | https://github.com/terrestris/shogun-core/blob/3dbabda35ae63235265913c865dba389b050b6e6/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/service/UserService.java#L122-L141 |
BioPAX/Paxtools | pattern/src/main/java/org/biopax/paxtools/pattern/miner/MinerAdapter.java | MinerAdapter.getGeneSymbol | protected String getGeneSymbol(Match m, String label)
{
ProteinReference pr = (ProteinReference) m.get(label, getPattern());
return getGeneSymbol(pr);
} | java | protected String getGeneSymbol(Match m, String label)
{
ProteinReference pr = (ProteinReference) m.get(label, getPattern());
return getGeneSymbol(pr);
} | [
"protected",
"String",
"getGeneSymbol",
"(",
"Match",
"m",
",",
"String",
"label",
")",
"{",
"ProteinReference",
"pr",
"=",
"(",
"ProteinReference",
")",
"m",
".",
"get",
"(",
"label",
",",
"getPattern",
"(",
")",
")",
";",
"return",
"getGeneSymbol",
"(",
... | Searches for the gene symbol of the given EntityReference.
@param m current match
@param label label of the related EntityReference in the pattern
@return symbol | [
"Searches",
"for",
"the",
"gene",
"symbol",
"of",
"the",
"given",
"EntityReference",
"."
] | train | https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/miner/MinerAdapter.java#L208-L212 |
spring-projects/spring-retry | src/main/java/org/springframework/classify/util/MethodInvokerUtils.java | MethodInvokerUtils.getMethodInvokerByAnnotation | public static MethodInvoker getMethodInvokerByAnnotation(
final Class<? extends Annotation> annotationType, final Object target) {
Assert.notNull(target, "Target must not be null");
Assert.notNull(annotationType, "AnnotationType must not be null");
Assert.isTrue(ObjectUtils.containsElement(
annotationType.getAnnotation(Target.class).value(), ElementType.METHOD),
"Annotation [" + annotationType + "] is not a Method-level annotation.");
final Class<?> targetClass = (target instanceof Advised)
? ((Advised) target).getTargetSource().getTargetClass()
: target.getClass();
if (targetClass == null) {
// Proxy with no target cannot have annotations
return null;
}
final AtomicReference<Method> annotatedMethod = new AtomicReference<Method>();
ReflectionUtils.doWithMethods(targetClass, new ReflectionUtils.MethodCallback() {
public void doWith(Method method)
throws IllegalArgumentException, IllegalAccessException {
Annotation annotation = AnnotationUtils.findAnnotation(method,
annotationType);
if (annotation != null) {
Assert.isNull(annotatedMethod.get(),
"found more than one method on target class ["
+ targetClass.getSimpleName()
+ "] with the annotation type ["
+ annotationType.getSimpleName() + "].");
annotatedMethod.set(method);
}
}
});
Method method = annotatedMethod.get();
if (method == null) {
return null;
}
else {
return new SimpleMethodInvoker(target, annotatedMethod.get());
}
} | java | public static MethodInvoker getMethodInvokerByAnnotation(
final Class<? extends Annotation> annotationType, final Object target) {
Assert.notNull(target, "Target must not be null");
Assert.notNull(annotationType, "AnnotationType must not be null");
Assert.isTrue(ObjectUtils.containsElement(
annotationType.getAnnotation(Target.class).value(), ElementType.METHOD),
"Annotation [" + annotationType + "] is not a Method-level annotation.");
final Class<?> targetClass = (target instanceof Advised)
? ((Advised) target).getTargetSource().getTargetClass()
: target.getClass();
if (targetClass == null) {
// Proxy with no target cannot have annotations
return null;
}
final AtomicReference<Method> annotatedMethod = new AtomicReference<Method>();
ReflectionUtils.doWithMethods(targetClass, new ReflectionUtils.MethodCallback() {
public void doWith(Method method)
throws IllegalArgumentException, IllegalAccessException {
Annotation annotation = AnnotationUtils.findAnnotation(method,
annotationType);
if (annotation != null) {
Assert.isNull(annotatedMethod.get(),
"found more than one method on target class ["
+ targetClass.getSimpleName()
+ "] with the annotation type ["
+ annotationType.getSimpleName() + "].");
annotatedMethod.set(method);
}
}
});
Method method = annotatedMethod.get();
if (method == null) {
return null;
}
else {
return new SimpleMethodInvoker(target, annotatedMethod.get());
}
} | [
"public",
"static",
"MethodInvoker",
"getMethodInvokerByAnnotation",
"(",
"final",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"annotationType",
",",
"final",
"Object",
"target",
")",
"{",
"Assert",
".",
"notNull",
"(",
"target",
",",
"\"Target must not be null... | Create {@link MethodInvoker} for the method with the provided annotation on the
provided object. Annotations that cannot be applied to methods (i.e. that aren't
annotated with an element type of METHOD) will cause an exception to be thrown.
@param annotationType to be searched for
@param target to be invoked
@return MethodInvoker for the provided annotation, null if none is found. | [
"Create",
"{"
] | train | https://github.com/spring-projects/spring-retry/blob/e2b0555f96594c2321990d0deeac45fc44d4f123/src/main/java/org/springframework/classify/util/MethodInvokerUtils.java#L166-L203 |
spotbugs/spotbugs | eclipsePlugin/src/de/tobject/findbugs/reporter/Reporter.java | Reporter.reportResultsToConsole | private void reportResultsToConsole() {
if (!isStreamReportingEnabled()) {
return;
}
printToStream("Finished, found: " + bugCount + " bugs");
ConfigurableXmlOutputStream xmlStream = new ConfigurableXmlOutputStream(stream, true);
ProjectStats stats = bugCollection.getProjectStats();
printToStream("\nFootprint: " + new Footprint(stats.getBaseFootprint()).toString());
Profiler profiler = stats.getProfiler();
PrintStream printStream;
try {
printStream = new PrintStream(stream, false, "UTF-8");
} catch (UnsupportedEncodingException e1) {
// can never happen with UTF-8
return;
}
printToStream("\nTotal time:");
profiler.report(new Profiler.TotalTimeComparator(profiler), new Profiler.FilterByTime(10000000), printStream);
printToStream("\nTotal calls:");
int numClasses = stats.getNumClasses();
if(numClasses > 0) {
profiler.report(new Profiler.TotalCallsComparator(profiler), new Profiler.FilterByCalls(numClasses),
printStream);
printToStream("\nTime per call:");
profiler.report(new Profiler.TimePerCallComparator(profiler),
new Profiler.FilterByTimePerCall(10000000 / numClasses), printStream);
}
try {
xmlStream.finish();
} catch (IOException e) {
FindbugsPlugin.getDefault().logException(e, "Print to console failed");
}
} | java | private void reportResultsToConsole() {
if (!isStreamReportingEnabled()) {
return;
}
printToStream("Finished, found: " + bugCount + " bugs");
ConfigurableXmlOutputStream xmlStream = new ConfigurableXmlOutputStream(stream, true);
ProjectStats stats = bugCollection.getProjectStats();
printToStream("\nFootprint: " + new Footprint(stats.getBaseFootprint()).toString());
Profiler profiler = stats.getProfiler();
PrintStream printStream;
try {
printStream = new PrintStream(stream, false, "UTF-8");
} catch (UnsupportedEncodingException e1) {
// can never happen with UTF-8
return;
}
printToStream("\nTotal time:");
profiler.report(new Profiler.TotalTimeComparator(profiler), new Profiler.FilterByTime(10000000), printStream);
printToStream("\nTotal calls:");
int numClasses = stats.getNumClasses();
if(numClasses > 0) {
profiler.report(new Profiler.TotalCallsComparator(profiler), new Profiler.FilterByCalls(numClasses),
printStream);
printToStream("\nTime per call:");
profiler.report(new Profiler.TimePerCallComparator(profiler),
new Profiler.FilterByTimePerCall(10000000 / numClasses), printStream);
}
try {
xmlStream.finish();
} catch (IOException e) {
FindbugsPlugin.getDefault().logException(e, "Print to console failed");
}
} | [
"private",
"void",
"reportResultsToConsole",
"(",
")",
"{",
"if",
"(",
"!",
"isStreamReportingEnabled",
"(",
")",
")",
"{",
"return",
";",
"}",
"printToStream",
"(",
"\"Finished, found: \"",
"+",
"bugCount",
"+",
"\" bugs\"",
")",
";",
"ConfigurableXmlOutputStream... | If there is a FB console opened, report results and statistics to it. | [
"If",
"there",
"is",
"a",
"FB",
"console",
"opened",
"report",
"results",
"and",
"statistics",
"to",
"it",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/eclipsePlugin/src/de/tobject/findbugs/reporter/Reporter.java#L184-L221 |
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.updateSubListAsync | public Observable<OperationStatus> updateSubListAsync(UUID appId, String versionId, UUID clEntityId, int subListId, WordListBaseUpdateObject wordListBaseUpdateObject) {
return updateSubListWithServiceResponseAsync(appId, versionId, clEntityId, subListId, wordListBaseUpdateObject).map(new Func1<ServiceResponse<OperationStatus>, OperationStatus>() {
@Override
public OperationStatus call(ServiceResponse<OperationStatus> response) {
return response.body();
}
});
} | java | public Observable<OperationStatus> updateSubListAsync(UUID appId, String versionId, UUID clEntityId, int subListId, WordListBaseUpdateObject wordListBaseUpdateObject) {
return updateSubListWithServiceResponseAsync(appId, versionId, clEntityId, subListId, wordListBaseUpdateObject).map(new Func1<ServiceResponse<OperationStatus>, OperationStatus>() {
@Override
public OperationStatus call(ServiceResponse<OperationStatus> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"OperationStatus",
">",
"updateSubListAsync",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"UUID",
"clEntityId",
",",
"int",
"subListId",
",",
"WordListBaseUpdateObject",
"wordListBaseUpdateObject",
")",
"{",
"return",
"updateSub... | Updates one of the closed list's sublists.
@param appId The application ID.
@param versionId The version ID.
@param clEntityId The closed list entity extractor ID.
@param subListId The sublist ID.
@param wordListBaseUpdateObject A sublist update object containing the new canonical form and the list of words.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the OperationStatus object | [
"Updates",
"one",
"of",
"the",
"closed",
"list",
"s",
"sublists",
"."
] | 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#L4999-L5006 |
Erudika/para | para-core/src/main/java/com/erudika/para/Para.java | Para.getParaClassLoader | public static ClassLoader getParaClassLoader() {
if (paraClassLoader == null) {
try {
ClassLoader currentClassLoader = Thread.currentThread().getContextClassLoader();
List<URL> jars = new ArrayList<>();
File lib = new File(Config.getConfigParam("plugin_folder", "lib/"));
if (lib.exists() && lib.isDirectory()) {
for (File file : FileUtils.listFiles(lib, new String[]{"jar"}, false)) {
jars.add(file.toURI().toURL());
}
}
paraClassLoader = new URLClassLoader(jars.toArray(new URL[0]), currentClassLoader);
// Thread.currentThread().setContextClassLoader(paraClassLoader);
} catch (Exception e) {
logger.error(null, e);
}
}
return paraClassLoader;
} | java | public static ClassLoader getParaClassLoader() {
if (paraClassLoader == null) {
try {
ClassLoader currentClassLoader = Thread.currentThread().getContextClassLoader();
List<URL> jars = new ArrayList<>();
File lib = new File(Config.getConfigParam("plugin_folder", "lib/"));
if (lib.exists() && lib.isDirectory()) {
for (File file : FileUtils.listFiles(lib, new String[]{"jar"}, false)) {
jars.add(file.toURI().toURL());
}
}
paraClassLoader = new URLClassLoader(jars.toArray(new URL[0]), currentClassLoader);
// Thread.currentThread().setContextClassLoader(paraClassLoader);
} catch (Exception e) {
logger.error(null, e);
}
}
return paraClassLoader;
} | [
"public",
"static",
"ClassLoader",
"getParaClassLoader",
"(",
")",
"{",
"if",
"(",
"paraClassLoader",
"==",
"null",
")",
"{",
"try",
"{",
"ClassLoader",
"currentClassLoader",
"=",
"Thread",
".",
"currentThread",
"(",
")",
".",
"getContextClassLoader",
"(",
")",
... | Returns the {@link URLClassLoader} classloader for Para.
Used for loading JAR files from 'lib/*.jar'.
@return a classloader | [
"Returns",
"the",
"{"
] | train | https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-core/src/main/java/com/erudika/para/Para.java#L320-L338 |
Azure/azure-sdk-for-java | storage/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/storage/v2018_03_01_preview/implementation/StorageAccountsInner.java | StorageAccountsInner.regenerateKey | public StorageAccountListKeysResultInner regenerateKey(String resourceGroupName, String accountName, String keyName) {
return regenerateKeyWithServiceResponseAsync(resourceGroupName, accountName, keyName).toBlocking().single().body();
} | java | public StorageAccountListKeysResultInner regenerateKey(String resourceGroupName, String accountName, String keyName) {
return regenerateKeyWithServiceResponseAsync(resourceGroupName, accountName, keyName).toBlocking().single().body();
} | [
"public",
"StorageAccountListKeysResultInner",
"regenerateKey",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
",",
"String",
"keyName",
")",
"{",
"return",
"regenerateKeyWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"accountName",
",",
"keyNa... | Regenerates one of the access keys for the specified storage account.
@param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive.
@param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only.
@param keyName The name of storage keys that want to be regenerated, possible vaules are key1, key2.
@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 StorageAccountListKeysResultInner object if successful. | [
"Regenerates",
"one",
"of",
"the",
"access",
"keys",
"for",
"the",
"specified",
"storage",
"account",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/storage/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/storage/v2018_03_01_preview/implementation/StorageAccountsInner.java#L920-L922 |
Azure/azure-sdk-for-java | edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/UsersInner.java | UsersInner.beginCreateOrUpdateAsync | public Observable<UserInner> beginCreateOrUpdateAsync(String deviceName, String name, String resourceGroupName, UserInner user) {
return beginCreateOrUpdateWithServiceResponseAsync(deviceName, name, resourceGroupName, user).map(new Func1<ServiceResponse<UserInner>, UserInner>() {
@Override
public UserInner call(ServiceResponse<UserInner> response) {
return response.body();
}
});
} | java | public Observable<UserInner> beginCreateOrUpdateAsync(String deviceName, String name, String resourceGroupName, UserInner user) {
return beginCreateOrUpdateWithServiceResponseAsync(deviceName, name, resourceGroupName, user).map(new Func1<ServiceResponse<UserInner>, UserInner>() {
@Override
public UserInner call(ServiceResponse<UserInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"UserInner",
">",
"beginCreateOrUpdateAsync",
"(",
"String",
"deviceName",
",",
"String",
"name",
",",
"String",
"resourceGroupName",
",",
"UserInner",
"user",
")",
"{",
"return",
"beginCreateOrUpdateWithServiceResponseAsync",
"(",
"deviceNa... | Creates a new user or updates an existing user's information on a data box edge/gateway device.
@param deviceName The device name.
@param name The user name.
@param resourceGroupName The resource group name.
@param user The user details.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the UserInner object | [
"Creates",
"a",
"new",
"user",
"or",
"updates",
"an",
"existing",
"user",
"s",
"information",
"on",
"a",
"data",
"box",
"edge",
"/",
"gateway",
"device",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/UsersInner.java#L435-L442 |
Azure/azure-sdk-for-java | edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/StorageAccountCredentialsInner.java | StorageAccountCredentialsInner.getAsync | public Observable<StorageAccountCredentialInner> getAsync(String deviceName, String name, String resourceGroupName) {
return getWithServiceResponseAsync(deviceName, name, resourceGroupName).map(new Func1<ServiceResponse<StorageAccountCredentialInner>, StorageAccountCredentialInner>() {
@Override
public StorageAccountCredentialInner call(ServiceResponse<StorageAccountCredentialInner> response) {
return response.body();
}
});
} | java | public Observable<StorageAccountCredentialInner> getAsync(String deviceName, String name, String resourceGroupName) {
return getWithServiceResponseAsync(deviceName, name, resourceGroupName).map(new Func1<ServiceResponse<StorageAccountCredentialInner>, StorageAccountCredentialInner>() {
@Override
public StorageAccountCredentialInner call(ServiceResponse<StorageAccountCredentialInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"StorageAccountCredentialInner",
">",
"getAsync",
"(",
"String",
"deviceName",
",",
"String",
"name",
",",
"String",
"resourceGroupName",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
"deviceName",
",",
"name",
",",
"resourceGrou... | Gets the properties of the specified storage account credential.
@param deviceName The device name.
@param name The storage account credential name.
@param resourceGroupName The resource group name.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the StorageAccountCredentialInner object | [
"Gets",
"the",
"properties",
"of",
"the",
"specified",
"storage",
"account",
"credential",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/StorageAccountCredentialsInner.java#L255-L262 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/field/event/ChangeFocusOnChangeHandler.java | ChangeFocusOnChangeHandler.init | public void init(BaseField field, ScreenComponent screenField, BaseField fldTarget)
{
super.init(field);
m_screenField = screenField;
m_fldTarget = fldTarget;
m_bScreenMove = true; // Only respond to user change
m_bInitMove = false;
m_bReadMove = false;
if (screenField == null)
this.lookupSField();
} | java | public void init(BaseField field, ScreenComponent screenField, BaseField fldTarget)
{
super.init(field);
m_screenField = screenField;
m_fldTarget = fldTarget;
m_bScreenMove = true; // Only respond to user change
m_bInitMove = false;
m_bReadMove = false;
if (screenField == null)
this.lookupSField();
} | [
"public",
"void",
"init",
"(",
"BaseField",
"field",
",",
"ScreenComponent",
"screenField",
",",
"BaseField",
"fldTarget",
")",
"{",
"super",
".",
"init",
"(",
"field",
")",
";",
"m_screenField",
"=",
"screenField",
";",
"m_fldTarget",
"=",
"fldTarget",
";",
... | Constructor.
This listener only responds to screen moves by default.
@param field The field to change the focus to on change to this field.
@param screenField The screen field to change the focus to on change to this field. | [
"Constructor",
".",
"This",
"listener",
"only",
"responds",
"to",
"screen",
"moves",
"by",
"default",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/event/ChangeFocusOnChangeHandler.java#L68-L79 |
Polidea/RxAndroidBle | rxandroidble/src/main/java/com/polidea/rxandroidble2/helpers/ValueInterpreter.java | ValueInterpreter.unsignedToSigned | private static int unsignedToSigned(int unsigned, int size) {
if ((unsigned & (1 << size - 1)) != 0) {
unsigned = -1 * ((1 << size - 1) - (unsigned & ((1 << size - 1) - 1)));
}
return unsigned;
} | java | private static int unsignedToSigned(int unsigned, int size) {
if ((unsigned & (1 << size - 1)) != 0) {
unsigned = -1 * ((1 << size - 1) - (unsigned & ((1 << size - 1) - 1)));
}
return unsigned;
} | [
"private",
"static",
"int",
"unsignedToSigned",
"(",
"int",
"unsigned",
",",
"int",
"size",
")",
"{",
"if",
"(",
"(",
"unsigned",
"&",
"(",
"1",
"<<",
"size",
"-",
"1",
")",
")",
"!=",
"0",
")",
"{",
"unsigned",
"=",
"-",
"1",
"*",
"(",
"(",
"1... | Convert an unsigned integer value to a two's-complement encoded
signed value. | [
"Convert",
"an",
"unsigned",
"integer",
"value",
"to",
"a",
"two",
"s",
"-",
"complement",
"encoded",
"signed",
"value",
"."
] | train | https://github.com/Polidea/RxAndroidBle/blob/c6e4a9753c834d710e255306bb290e9244cdbc10/rxandroidble/src/main/java/com/polidea/rxandroidble2/helpers/ValueInterpreter.java#L228-L233 |
lookfirst/WePay-Java-SDK | src/main/java/com/lookfirst/wepay/WePayApi.java | WePayApi.execute | public <T> T execute(String token, WePayRequest<T> req) throws IOException, WePayException {
String uri = currentUrl + req.getEndpoint();
String postJson = MAPPER.writeValueAsString(req);
if (log.isTraceEnabled()) {
log.trace("request to {}: {}", uri, postJson);
}
// Use the data provider to get an input stream response. This is faked out in tests.
InputStream is = dataProvider.getData(uri, postJson, token);
JsonNode resp;
if (log.isTraceEnabled()) {
String results = IOUtils.toString(is);
log.trace("response: " + results);
resp = MAPPER.readTree(results);
} else {
resp = MAPPER.readTree(is);
}
// if there is an error in the response from wepay, it'll get thrown in this call.
this.checkForError(resp);
// This is a little bit of black magic with jackson. We know that any request passed extends
// the abstract WePayRequest and de-genericizes it. This means the concrete class has full
// generic type information, and we can use this to determine what type to deserialize. The
// trickiest case is WePayAccountFindRequest, whose response type is List<AccountWithUri>.
ParameterizedType paramType = (ParameterizedType)req.getClass().getGenericSuperclass();
JavaType type = MAPPER.constructType(paramType.getActualTypeArguments()[0]);
return MAPPER.readValue(MAPPER.treeAsTokens(resp), type);
} | java | public <T> T execute(String token, WePayRequest<T> req) throws IOException, WePayException {
String uri = currentUrl + req.getEndpoint();
String postJson = MAPPER.writeValueAsString(req);
if (log.isTraceEnabled()) {
log.trace("request to {}: {}", uri, postJson);
}
// Use the data provider to get an input stream response. This is faked out in tests.
InputStream is = dataProvider.getData(uri, postJson, token);
JsonNode resp;
if (log.isTraceEnabled()) {
String results = IOUtils.toString(is);
log.trace("response: " + results);
resp = MAPPER.readTree(results);
} else {
resp = MAPPER.readTree(is);
}
// if there is an error in the response from wepay, it'll get thrown in this call.
this.checkForError(resp);
// This is a little bit of black magic with jackson. We know that any request passed extends
// the abstract WePayRequest and de-genericizes it. This means the concrete class has full
// generic type information, and we can use this to determine what type to deserialize. The
// trickiest case is WePayAccountFindRequest, whose response type is List<AccountWithUri>.
ParameterizedType paramType = (ParameterizedType)req.getClass().getGenericSuperclass();
JavaType type = MAPPER.constructType(paramType.getActualTypeArguments()[0]);
return MAPPER.readValue(MAPPER.treeAsTokens(resp), type);
} | [
"public",
"<",
"T",
">",
"T",
"execute",
"(",
"String",
"token",
",",
"WePayRequest",
"<",
"T",
">",
"req",
")",
"throws",
"IOException",
",",
"WePayException",
"{",
"String",
"uri",
"=",
"currentUrl",
"+",
"req",
".",
"getEndpoint",
"(",
")",
";",
"St... | Make API calls against authenticated user.
Turn up logging to trace level to see the request / response. | [
"Make",
"API",
"calls",
"against",
"authenticated",
"user",
".",
"Turn",
"up",
"logging",
"to",
"trace",
"level",
"to",
"see",
"the",
"request",
"/",
"response",
"."
] | train | https://github.com/lookfirst/WePay-Java-SDK/blob/3c0a47d6fa051d531c8fdbbfd54a0ef2891aa8f0/src/main/java/com/lookfirst/wepay/WePayApi.java#L214-L247 |
netty/netty | codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketClientHandshaker.java | WebSocketClientHandshaker.close | public ChannelFuture close(Channel channel, CloseWebSocketFrame frame) {
if (channel == null) {
throw new NullPointerException("channel");
}
return close(channel, frame, channel.newPromise());
} | java | public ChannelFuture close(Channel channel, CloseWebSocketFrame frame) {
if (channel == null) {
throw new NullPointerException("channel");
}
return close(channel, frame, channel.newPromise());
} | [
"public",
"ChannelFuture",
"close",
"(",
"Channel",
"channel",
",",
"CloseWebSocketFrame",
"frame",
")",
"{",
"if",
"(",
"channel",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"channel\"",
")",
";",
"}",
"return",
"close",
"(",
"ch... | Performs the closing handshake
@param channel
Channel
@param frame
Closing Frame that was received | [
"Performs",
"the",
"closing",
"handshake"
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketClientHandshaker.java#L473-L478 |
mozilla/rhino | src/org/mozilla/javascript/NativeArray.java | NativeArray.getRawElem | private static Object getRawElem(Scriptable target, long index) {
if (index > Integer.MAX_VALUE) {
return ScriptableObject.getProperty(target, Long.toString(index));
}
return ScriptableObject.getProperty(target, (int)index);
} | java | private static Object getRawElem(Scriptable target, long index) {
if (index > Integer.MAX_VALUE) {
return ScriptableObject.getProperty(target, Long.toString(index));
}
return ScriptableObject.getProperty(target, (int)index);
} | [
"private",
"static",
"Object",
"getRawElem",
"(",
"Scriptable",
"target",
",",
"long",
"index",
")",
"{",
"if",
"(",
"index",
">",
"Integer",
".",
"MAX_VALUE",
")",
"{",
"return",
"ScriptableObject",
".",
"getProperty",
"(",
"target",
",",
"Long",
".",
"to... | same as getElem, but without converting NOT_FOUND to undefined | [
"same",
"as",
"getElem",
"but",
"without",
"converting",
"NOT_FOUND",
"to",
"undefined"
] | train | https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/NativeArray.java#L793-L798 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.