repository_name stringlengths 7 58 | func_path_in_repository stringlengths 11 204 | func_name stringlengths 5 103 | whole_func_string stringlengths 87 3.44k | language stringclasses 1
value | func_code_string stringlengths 87 3.44k | func_code_tokens listlengths 21 714 | func_documentation_string stringlengths 61 1.95k | func_documentation_tokens listlengths 1 482 | split_name stringclasses 1
value | func_code_url stringlengths 102 309 |
|---|---|---|---|---|---|---|---|---|---|---|
camunda/camunda-engine-dmn | engine/src/main/java/org/camunda/bpm/dmn/engine/impl/el/VariableContextScriptBindings.java | VariableContextScriptBindings.put | public Object put(String name, Object value) {
// only write to the wrapped bindings
return wrappedBindings.put(name, value);
} | java | public Object put(String name, Object value) {
// only write to the wrapped bindings
return wrappedBindings.put(name, value);
} | [
"public",
"Object",
"put",
"(",
"String",
"name",
",",
"Object",
"value",
")",
"{",
"// only write to the wrapped bindings",
"return",
"wrappedBindings",
".",
"put",
"(",
"name",
",",
"value",
")",
";",
"}"
] | Dedicated implementation which does not fall back on the {@link #calculateBindingMap()} for performance reasons | [
"Dedicated",
"implementation",
"which",
"does",
"not",
"fall",
"back",
"on",
"the",
"{"
] | train | https://github.com/camunda/camunda-engine-dmn/blob/6335ea29f66ac3c1b8c9404e15d89e0bb8b0a27c/engine/src/main/java/org/camunda/bpm/dmn/engine/impl/el/VariableContextScriptBindings.java#L87-L90 |
Jasig/portlet-utils | portlet-security-util/src/main/java/org/jasig/web/filter/SimpleCorsFilter.java | SimpleCorsFilter.doFilter | @Override
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException {
HttpServletResponse response = (HttpServletResponse) res;
response.setHeader("Access-Control-Allow-Origin", allowOrigin);
response.setHeader("Access-Control-Allow-Methods", allowMethod);
response.setHeader("Access-Control-Max-Age", maxAge);
response.setHeader("Access-Control-Allow-Headers", allowHeaders);
chain.doFilter(req, res);
} | java | @Override
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException {
HttpServletResponse response = (HttpServletResponse) res;
response.setHeader("Access-Control-Allow-Origin", allowOrigin);
response.setHeader("Access-Control-Allow-Methods", allowMethod);
response.setHeader("Access-Control-Max-Age", maxAge);
response.setHeader("Access-Control-Allow-Headers", allowHeaders);
chain.doFilter(req, res);
} | [
"@",
"Override",
"public",
"void",
"doFilter",
"(",
"ServletRequest",
"req",
",",
"ServletResponse",
"res",
",",
"FilterChain",
"chain",
")",
"throws",
"IOException",
",",
"ServletException",
"{",
"HttpServletResponse",
"response",
"=",
"(",
"HttpServletResponse",
"... | Sets the headers to support CORS
@see javax.servlet.Filter#doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse, javax.servlet.FilterChain) | [
"Sets",
"the",
"headers",
"to",
"support",
"CORS"
] | train | https://github.com/Jasig/portlet-utils/blob/bb54047a90b92bdfecd0ca51cc4371929c941ff5/portlet-security-util/src/main/java/org/jasig/web/filter/SimpleCorsFilter.java#L115-L123 |
gallandarakhneorg/afc | core/maths/mathgeom/tobeincluded/src/d3/continuous/AlignedBox3d.java | AlignedBox3d.setY | @Override
public void setY(double min, double max) {
if (min <= max) {
this.minyProperty.set(min);
this.maxyProperty.set(max);
} else {
this.minyProperty.set(max);
this.maxyProperty.set(min);
}
} | java | @Override
public void setY(double min, double max) {
if (min <= max) {
this.minyProperty.set(min);
this.maxyProperty.set(max);
} else {
this.minyProperty.set(max);
this.maxyProperty.set(min);
}
} | [
"@",
"Override",
"public",
"void",
"setY",
"(",
"double",
"min",
",",
"double",
"max",
")",
"{",
"if",
"(",
"min",
"<=",
"max",
")",
"{",
"this",
".",
"minyProperty",
".",
"set",
"(",
"min",
")",
";",
"this",
".",
"maxyProperty",
".",
"set",
"(",
... | Set the y bounds of the box.
@param min the min value for the y axis.
@param max the max value for the y axis. | [
"Set",
"the",
"y",
"bounds",
"of",
"the",
"box",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/AlignedBox3d.java#L688-L697 |
teatrove/teatrove | teaservlet/src/main/java/org/teatrove/teaservlet/stats/TeaServletRequestStats.java | TeaServletRequestStats.getStats | public TemplateStats getStats(String fullTemplateName) {
TemplateStats stats = (TemplateStats) mStatsMap.get(fullTemplateName);
if (stats == null) {
stats = new TemplateStats(fullTemplateName, mRawWindowSize, mAggregateWindowSize);
mStatsMap.put(fullTemplateName, stats);
}
return stats;
} | java | public TemplateStats getStats(String fullTemplateName) {
TemplateStats stats = (TemplateStats) mStatsMap.get(fullTemplateName);
if (stats == null) {
stats = new TemplateStats(fullTemplateName, mRawWindowSize, mAggregateWindowSize);
mStatsMap.put(fullTemplateName, stats);
}
return stats;
} | [
"public",
"TemplateStats",
"getStats",
"(",
"String",
"fullTemplateName",
")",
"{",
"TemplateStats",
"stats",
"=",
"(",
"TemplateStats",
")",
"mStatsMap",
".",
"get",
"(",
"fullTemplateName",
")",
";",
"if",
"(",
"stats",
"==",
"null",
")",
"{",
"stats",
"="... | Returns the template stats for a given template name.
@param fullTemplateName the full name of the template with '.'s as
delimeters.
@return the template stats | [
"Returns",
"the",
"template",
"stats",
"for",
"a",
"given",
"template",
"name",
"."
] | train | https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/teaservlet/src/main/java/org/teatrove/teaservlet/stats/TeaServletRequestStats.java#L79-L86 |
facebook/fresco | fbcore/src/main/java/com/facebook/common/util/UriUtil.java | UriUtil.getRealPathFromUri | @Nullable
public static String getRealPathFromUri(ContentResolver contentResolver, final Uri srcUri) {
String result = null;
if (isLocalContentUri(srcUri)) {
Cursor cursor = null;
try {
cursor = contentResolver.query(srcUri, null, null, null, null);
if (cursor != null && cursor.moveToFirst()) {
int idx = cursor.getColumnIndex(MediaStore.Images.ImageColumns.DATA);
if (idx != -1) {
result = cursor.getString(idx);
}
}
} finally {
if (cursor != null) {
cursor.close();
}
}
} else if (isLocalFileUri(srcUri)) {
result = srcUri.getPath();
}
return result;
} | java | @Nullable
public static String getRealPathFromUri(ContentResolver contentResolver, final Uri srcUri) {
String result = null;
if (isLocalContentUri(srcUri)) {
Cursor cursor = null;
try {
cursor = contentResolver.query(srcUri, null, null, null, null);
if (cursor != null && cursor.moveToFirst()) {
int idx = cursor.getColumnIndex(MediaStore.Images.ImageColumns.DATA);
if (idx != -1) {
result = cursor.getString(idx);
}
}
} finally {
if (cursor != null) {
cursor.close();
}
}
} else if (isLocalFileUri(srcUri)) {
result = srcUri.getPath();
}
return result;
} | [
"@",
"Nullable",
"public",
"static",
"String",
"getRealPathFromUri",
"(",
"ContentResolver",
"contentResolver",
",",
"final",
"Uri",
"srcUri",
")",
"{",
"String",
"result",
"=",
"null",
";",
"if",
"(",
"isLocalContentUri",
"(",
"srcUri",
")",
")",
"{",
"Cursor... | Get the path of a file from the Uri.
@param contentResolver the content resolver which will query for the source file
@param srcUri The source uri
@return The Path for the file or null if doesn't exists | [
"Get",
"the",
"path",
"of",
"a",
"file",
"from",
"the",
"Uri",
"."
] | train | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/fbcore/src/main/java/com/facebook/common/util/UriUtil.java#L205-L227 |
jhg023/SimpleNet | src/main/java/simplenet/packet/Packet.java | Packet.putString | public Packet putString(String s) {
return putString(s, StandardCharsets.UTF_8, ByteOrder.BIG_ENDIAN);
} | java | public Packet putString(String s) {
return putString(s, StandardCharsets.UTF_8, ByteOrder.BIG_ENDIAN);
} | [
"public",
"Packet",
"putString",
"(",
"String",
"s",
")",
"{",
"return",
"putString",
"(",
"s",
",",
"StandardCharsets",
".",
"UTF_8",
",",
"ByteOrder",
".",
"BIG_ENDIAN",
")",
";",
"}"
] | Writes a single {@link StandardCharsets#UTF_8}-encoded {@link String} with {@link ByteOrder#BIG_ENDIAN} order to
this {@link Packet}'s payload.
<br><br>
The {@link String} can have a maximum length of {@code 65,535}.
@param s The {@link String} to write.
@return The {@link Packet} to allow for chained writes.
@see #putString(String, Charset, ByteOrder) | [
"Writes",
"a",
"single",
"{",
"@link",
"StandardCharsets#UTF_8",
"}",
"-",
"encoded",
"{",
"@link",
"String",
"}",
"with",
"{",
"@link",
"ByteOrder#BIG_ENDIAN",
"}",
"order",
"to",
"this",
"{",
"@link",
"Packet",
"}",
"s",
"payload",
".",
"<br",
">",
"<br"... | train | https://github.com/jhg023/SimpleNet/blob/a5b55cbfe1768c6a28874f12adac3c748f2b509a/src/main/java/simplenet/packet/Packet.java#L310-L312 |
Azure/azure-sdk-for-java | cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/DatabaseAccountsInner.java | DatabaseAccountsInner.onlineRegionAsync | public Observable<Void> onlineRegionAsync(String resourceGroupName, String accountName, String region) {
return onlineRegionWithServiceResponseAsync(resourceGroupName, accountName, region).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | java | public Observable<Void> onlineRegionAsync(String resourceGroupName, String accountName, String region) {
return onlineRegionWithServiceResponseAsync(resourceGroupName, accountName, region).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"onlineRegionAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
",",
"String",
"region",
")",
"{",
"return",
"onlineRegionWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"accountName",
",",
"re... | Online the specified region for the specified Azure Cosmos DB database account.
@param resourceGroupName Name of an Azure resource group.
@param accountName Cosmos DB database account name.
@param region Cosmos DB region, with spaces between words and each word capitalized.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Online",
"the",
"specified",
"region",
"for",
"the",
"specified",
"Azure",
"Cosmos",
"DB",
"database",
"account",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/DatabaseAccountsInner.java#L1483-L1490 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/VirtualNetworkGatewaysInner.java | VirtualNetworkGatewaysInner.beginResetAsync | public Observable<VirtualNetworkGatewayInner> beginResetAsync(String resourceGroupName, String virtualNetworkGatewayName) {
return beginResetWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayName).map(new Func1<ServiceResponse<VirtualNetworkGatewayInner>, VirtualNetworkGatewayInner>() {
@Override
public VirtualNetworkGatewayInner call(ServiceResponse<VirtualNetworkGatewayInner> response) {
return response.body();
}
});
} | java | public Observable<VirtualNetworkGatewayInner> beginResetAsync(String resourceGroupName, String virtualNetworkGatewayName) {
return beginResetWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayName).map(new Func1<ServiceResponse<VirtualNetworkGatewayInner>, VirtualNetworkGatewayInner>() {
@Override
public VirtualNetworkGatewayInner call(ServiceResponse<VirtualNetworkGatewayInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"VirtualNetworkGatewayInner",
">",
"beginResetAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"virtualNetworkGatewayName",
")",
"{",
"return",
"beginResetWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"virtualNetworkGatewayName... | Resets the primary of the virtual network gateway in the specified resource group.
@param resourceGroupName The name of the resource group.
@param virtualNetworkGatewayName The name of the virtual network gateway.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the VirtualNetworkGatewayInner object | [
"Resets",
"the",
"primary",
"of",
"the",
"virtual",
"network",
"gateway",
"in",
"the",
"specified",
"resource",
"group",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/VirtualNetworkGatewaysInner.java#L1322-L1329 |
sdl/odata | odata_renderer/src/main/java/com/sdl/odata/renderer/atom/writer/AtomWriter.java | AtomWriter.writeStartFeed | public void writeStartFeed(String requestContextURL, Map<String, Object> meta) throws ODataRenderException {
this.contextURL = checkNotNull(requestContextURL);
try {
startFeed(false);
if (ODataUriUtil.hasCountOption(oDataUri) &&
meta != null && meta.containsKey("count")) {
metadataWriter.writeCount(meta.get("count"));
}
metadataWriter.writeFeedId(null, null);
metadataWriter.writeTitle();
metadataWriter.writeUpdate(dateTime);
metadataWriter.writeFeedLink(null, null);
} catch (XMLStreamException | ODataEdmException e) {
LOG.error("Not possible to marshall feed stream XML");
throw new ODataRenderException("Not possible to marshall feed stream XML: ", e);
}
} | java | public void writeStartFeed(String requestContextURL, Map<String, Object> meta) throws ODataRenderException {
this.contextURL = checkNotNull(requestContextURL);
try {
startFeed(false);
if (ODataUriUtil.hasCountOption(oDataUri) &&
meta != null && meta.containsKey("count")) {
metadataWriter.writeCount(meta.get("count"));
}
metadataWriter.writeFeedId(null, null);
metadataWriter.writeTitle();
metadataWriter.writeUpdate(dateTime);
metadataWriter.writeFeedLink(null, null);
} catch (XMLStreamException | ODataEdmException e) {
LOG.error("Not possible to marshall feed stream XML");
throw new ODataRenderException("Not possible to marshall feed stream XML: ", e);
}
} | [
"public",
"void",
"writeStartFeed",
"(",
"String",
"requestContextURL",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"meta",
")",
"throws",
"ODataRenderException",
"{",
"this",
".",
"contextURL",
"=",
"checkNotNull",
"(",
"requestContextURL",
")",
";",
"try",
... | Write start feed to the XML stream.
@param requestContextURL The 'Context URL' to write for the feed. It can not {@code null}.
@param meta Additional metadata to write.
@throws ODataRenderException In case it is not possible to write to the XML stream. | [
"Write",
"start",
"feed",
"to",
"the",
"XML",
"stream",
"."
] | train | https://github.com/sdl/odata/blob/eb747d73e9af0f4e59a25b82ed656e526a7e2189/odata_renderer/src/main/java/com/sdl/odata/renderer/atom/writer/AtomWriter.java#L223-L241 |
glyptodon/guacamole-client | extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/user/ModeledUser.java | ModeledUser.setRestrictedAttributes | private void setRestrictedAttributes(Map<String, String> attributes) {
// Translate disabled attribute
getModel().setDisabled("true".equals(attributes.get(DISABLED_ATTRIBUTE_NAME)));
// Translate password expired attribute
getModel().setExpired("true".equals(attributes.get(EXPIRED_ATTRIBUTE_NAME)));
// Translate access window start time
try { getModel().setAccessWindowStart(parseTime(attributes.get(ACCESS_WINDOW_START_ATTRIBUTE_NAME))); }
catch (ParseException e) {
logger.warn("Not setting start time of user access window: {}", e.getMessage());
logger.debug("Unable to parse time attribute.", e);
}
// Translate access window end time
try { getModel().setAccessWindowEnd(parseTime(attributes.get(ACCESS_WINDOW_END_ATTRIBUTE_NAME))); }
catch (ParseException e) {
logger.warn("Not setting end time of user access window: {}", e.getMessage());
logger.debug("Unable to parse time attribute.", e);
}
// Translate account validity start date
try { getModel().setValidFrom(parseDate(attributes.get(VALID_FROM_ATTRIBUTE_NAME))); }
catch (ParseException e) {
logger.warn("Not setting user validity start date: {}", e.getMessage());
logger.debug("Unable to parse date attribute.", e);
}
// Translate account validity end date
try { getModel().setValidUntil(parseDate(attributes.get(VALID_UNTIL_ATTRIBUTE_NAME))); }
catch (ParseException e) {
logger.warn("Not setting user validity end date: {}", e.getMessage());
logger.debug("Unable to parse date attribute.", e);
}
// Translate timezone attribute
getModel().setTimeZone(TimeZoneField.parse(attributes.get(TIMEZONE_ATTRIBUTE_NAME)));
} | java | private void setRestrictedAttributes(Map<String, String> attributes) {
// Translate disabled attribute
getModel().setDisabled("true".equals(attributes.get(DISABLED_ATTRIBUTE_NAME)));
// Translate password expired attribute
getModel().setExpired("true".equals(attributes.get(EXPIRED_ATTRIBUTE_NAME)));
// Translate access window start time
try { getModel().setAccessWindowStart(parseTime(attributes.get(ACCESS_WINDOW_START_ATTRIBUTE_NAME))); }
catch (ParseException e) {
logger.warn("Not setting start time of user access window: {}", e.getMessage());
logger.debug("Unable to parse time attribute.", e);
}
// Translate access window end time
try { getModel().setAccessWindowEnd(parseTime(attributes.get(ACCESS_WINDOW_END_ATTRIBUTE_NAME))); }
catch (ParseException e) {
logger.warn("Not setting end time of user access window: {}", e.getMessage());
logger.debug("Unable to parse time attribute.", e);
}
// Translate account validity start date
try { getModel().setValidFrom(parseDate(attributes.get(VALID_FROM_ATTRIBUTE_NAME))); }
catch (ParseException e) {
logger.warn("Not setting user validity start date: {}", e.getMessage());
logger.debug("Unable to parse date attribute.", e);
}
// Translate account validity end date
try { getModel().setValidUntil(parseDate(attributes.get(VALID_UNTIL_ATTRIBUTE_NAME))); }
catch (ParseException e) {
logger.warn("Not setting user validity end date: {}", e.getMessage());
logger.debug("Unable to parse date attribute.", e);
}
// Translate timezone attribute
getModel().setTimeZone(TimeZoneField.parse(attributes.get(TIMEZONE_ATTRIBUTE_NAME)));
} | [
"private",
"void",
"setRestrictedAttributes",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"attributes",
")",
"{",
"// Translate disabled attribute",
"getModel",
"(",
")",
".",
"setDisabled",
"(",
"\"true\"",
".",
"equals",
"(",
"attributes",
".",
"get",
"(",
... | Stores all restricted (privileged) attributes within the underlying user
model, pulling the values of those attributes from the given Map.
@param attributes
The Map to pull all restricted attributes from. | [
"Stores",
"all",
"restricted",
"(",
"privileged",
")",
"attributes",
"within",
"the",
"underlying",
"user",
"model",
"pulling",
"the",
"values",
"of",
"those",
"attributes",
"from",
"the",
"given",
"Map",
"."
] | train | https://github.com/glyptodon/guacamole-client/blob/ea1b10e9d1e3f1fa640dff2ca64d61b44bf1ace9/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/user/ModeledUser.java#L419-L458 |
mabe02/lanterna | src/main/java/com/googlecode/lanterna/bundle/LanternaThemes.java | LanternaThemes.registerTheme | public static void registerTheme(String name, Theme theme) {
if(theme == null) {
throw new IllegalArgumentException("Name cannot be null");
}
else if(name.isEmpty()) {
throw new IllegalArgumentException("Name cannot be empty");
}
Theme result = REGISTERED_THEMES.putIfAbsent(name, theme);
if(result != null && result != theme) {
throw new IllegalArgumentException("There is already a theme registered with the name '" + name + "'");
}
} | java | public static void registerTheme(String name, Theme theme) {
if(theme == null) {
throw new IllegalArgumentException("Name cannot be null");
}
else if(name.isEmpty()) {
throw new IllegalArgumentException("Name cannot be empty");
}
Theme result = REGISTERED_THEMES.putIfAbsent(name, theme);
if(result != null && result != theme) {
throw new IllegalArgumentException("There is already a theme registered with the name '" + name + "'");
}
} | [
"public",
"static",
"void",
"registerTheme",
"(",
"String",
"name",
",",
"Theme",
"theme",
")",
"{",
"if",
"(",
"theme",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Name cannot be null\"",
")",
";",
"}",
"else",
"if",
"(",
"... | Registers a {@link Theme} with this class under a certain name so that calling
{@link #getRegisteredTheme(String)} on that name will return this theme and calling
{@link #getRegisteredThemes()} will return a collection including this name.
@param name Name to register the theme under
@param theme Theme to register with this name | [
"Registers",
"a",
"{"
] | train | https://github.com/mabe02/lanterna/blob/8dfd62206ff46ab10223b2ef2dbb0a2c51850954/src/main/java/com/googlecode/lanterna/bundle/LanternaThemes.java#L79-L90 |
strator-dev/greenpepper | greenpepper-open/extensions-external/ognl/src/main/java/com/greenpepper/extensions/ognl/OgnlExpression.java | OgnlExpression.onUnresolvedExpression | public static OgnlExpression onUnresolvedExpression( String expression, Object... targets )
{
OgnlResolution resolver = new OgnlResolution( expression );
return new OgnlExpression( resolver.expressionsListToResolve(), targets );
} | java | public static OgnlExpression onUnresolvedExpression( String expression, Object... targets )
{
OgnlResolution resolver = new OgnlResolution( expression );
return new OgnlExpression( resolver.expressionsListToResolve(), targets );
} | [
"public",
"static",
"OgnlExpression",
"onUnresolvedExpression",
"(",
"String",
"expression",
",",
"Object",
"...",
"targets",
")",
"{",
"OgnlResolution",
"resolver",
"=",
"new",
"OgnlResolution",
"(",
"expression",
")",
";",
"return",
"new",
"OgnlExpression",
"(",
... | <p>onUnresolvedExpression.</p>
@param expression a {@link java.lang.String} object.
@param targets a {@link java.lang.Object} object.
@return a {@link com.greenpepper.extensions.ognl.OgnlExpression} object. | [
"<p",
">",
"onUnresolvedExpression",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper-open/extensions-external/ognl/src/main/java/com/greenpepper/extensions/ognl/OgnlExpression.java#L81-L86 |
facebookarchive/hadoop-20 | src/core/org/apache/hadoop/fs/FileSystem.java | FileSystem.setDefaultUri | public static void setDefaultUri(Configuration conf, String uri) {
setDefaultUri(conf, URI.create(fixName(uri)));
} | java | public static void setDefaultUri(Configuration conf, String uri) {
setDefaultUri(conf, URI.create(fixName(uri)));
} | [
"public",
"static",
"void",
"setDefaultUri",
"(",
"Configuration",
"conf",
",",
"String",
"uri",
")",
"{",
"setDefaultUri",
"(",
"conf",
",",
"URI",
".",
"create",
"(",
"fixName",
"(",
"uri",
")",
")",
")",
";",
"}"
] | Set the default filesystem URI in a configuration.
@param conf the configuration to alter
@param uri the new default filesystem uri | [
"Set",
"the",
"default",
"filesystem",
"URI",
"in",
"a",
"configuration",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/FileSystem.java#L132-L134 |
james-hu/jabb-core | src/main/java/net/sf/jabb/cache/AbstractEhCachedKeyValueRepository.java | AbstractEhCachedKeyValueRepository.replaceWithSelfPopulatingCacheIfNot | protected SelfPopulatingCache replaceWithSelfPopulatingCacheIfNot(Ehcache ehcache, CacheEntryFactory factory){
if (ehcache instanceof SelfPopulatingCache){
return (SelfPopulatingCache) ehcache;
}
SelfPopulatingCache selfPopulatingCache = new SelfPopulatingCache(ehcache, factory);
selfPopulatingCache.setTimeoutMillis((int)ehcache.getCacheConfiguration().getCacheLoaderTimeoutMillis());
cacheManager.replaceCacheWithDecoratedCache(ehcache, selfPopulatingCache);
return selfPopulatingCache;
} | java | protected SelfPopulatingCache replaceWithSelfPopulatingCacheIfNot(Ehcache ehcache, CacheEntryFactory factory){
if (ehcache instanceof SelfPopulatingCache){
return (SelfPopulatingCache) ehcache;
}
SelfPopulatingCache selfPopulatingCache = new SelfPopulatingCache(ehcache, factory);
selfPopulatingCache.setTimeoutMillis((int)ehcache.getCacheConfiguration().getCacheLoaderTimeoutMillis());
cacheManager.replaceCacheWithDecoratedCache(ehcache, selfPopulatingCache);
return selfPopulatingCache;
} | [
"protected",
"SelfPopulatingCache",
"replaceWithSelfPopulatingCacheIfNot",
"(",
"Ehcache",
"ehcache",
",",
"CacheEntryFactory",
"factory",
")",
"{",
"if",
"(",
"ehcache",
"instanceof",
"SelfPopulatingCache",
")",
"{",
"return",
"(",
"SelfPopulatingCache",
")",
"ehcache",
... | Replace the cache with a SelfPopulatingCache decorated one if this has not been done yet.
The cacheLoaderTimeoutMillis of the original cache will be used as the timeoutMillis of the BlockingCache.
@param ehcache the original cache
@param factory the cache entry value factory
@return a BlockingCache wrapping the original one | [
"Replace",
"the",
"cache",
"with",
"a",
"SelfPopulatingCache",
"decorated",
"one",
"if",
"this",
"has",
"not",
"been",
"done",
"yet",
".",
"The",
"cacheLoaderTimeoutMillis",
"of",
"the",
"original",
"cache",
"will",
"be",
"used",
"as",
"the",
"timeoutMillis",
... | train | https://github.com/james-hu/jabb-core/blob/bceed441595c5e5195a7418795f03b69fa7b61e4/src/main/java/net/sf/jabb/cache/AbstractEhCachedKeyValueRepository.java#L173-L183 |
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.getEntityRole | public EntityRole getEntityRole(UUID appId, String versionId, UUID entityId, UUID roleId) {
return getEntityRoleWithServiceResponseAsync(appId, versionId, entityId, roleId).toBlocking().single().body();
} | java | public EntityRole getEntityRole(UUID appId, String versionId, UUID entityId, UUID roleId) {
return getEntityRoleWithServiceResponseAsync(appId, versionId, entityId, roleId).toBlocking().single().body();
} | [
"public",
"EntityRole",
"getEntityRole",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"UUID",
"entityId",
",",
"UUID",
"roleId",
")",
"{",
"return",
"getEntityRoleWithServiceResponseAsync",
"(",
"appId",
",",
"versionId",
",",
"entityId",
",",
"roleId",
... | Get one entity role for a given entity.
@param appId The application ID.
@param versionId The version ID.
@param entityId entity ID.
@param roleId entity role ID.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the EntityRole object if successful. | [
"Get",
"one",
"entity",
"role",
"for",
"a",
"given",
"entity",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L10742-L10744 |
fengwenyi/JavaLib | src/main/java/com/fengwenyi/javalib/util/RSAUtil.java | RSAUtil.privateKeyEncrypt | public static String privateKeyEncrypt(String key, String plainText) throws NoSuchAlgorithmException,
InvalidKeySpecException, NoSuchPaddingException, UnsupportedEncodingException, BadPaddingException,
IllegalBlockSizeException, InvalidKeyException {
PrivateKey privateKey = commonGetPrivatekeyByText(key);
Cipher cipher = Cipher.getInstance(RSA);
cipher.init(Cipher.ENCRYPT_MODE, privateKey);
byte [] result = cipher.doFinal(plainText.getBytes(Charset.UTF_8));
return Base64.byteArrayToBase64(result);
} | java | public static String privateKeyEncrypt(String key, String plainText) throws NoSuchAlgorithmException,
InvalidKeySpecException, NoSuchPaddingException, UnsupportedEncodingException, BadPaddingException,
IllegalBlockSizeException, InvalidKeyException {
PrivateKey privateKey = commonGetPrivatekeyByText(key);
Cipher cipher = Cipher.getInstance(RSA);
cipher.init(Cipher.ENCRYPT_MODE, privateKey);
byte [] result = cipher.doFinal(plainText.getBytes(Charset.UTF_8));
return Base64.byteArrayToBase64(result);
} | [
"public",
"static",
"String",
"privateKeyEncrypt",
"(",
"String",
"key",
",",
"String",
"plainText",
")",
"throws",
"NoSuchAlgorithmException",
",",
"InvalidKeySpecException",
",",
"NoSuchPaddingException",
",",
"UnsupportedEncodingException",
",",
"BadPaddingException",
",... | 私钥加密
@param key [ellipsis]
@param plainText [ellipsis]
@return [ellipsis]
@throws NoSuchAlgorithmException [ellipsis]
@throws InvalidKeySpecException [ellipsis]
@throws NoSuchPaddingException [ellipsis]
@throws UnsupportedEncodingException [ellipsis]
@throws BadPaddingException [ellipsis]
@throws IllegalBlockSizeException [ellipsis]
@throws InvalidKeyException [ellipsis] | [
"私钥加密"
] | train | https://github.com/fengwenyi/JavaLib/blob/14838b13fb11c024e41be766aa3e13ead4be1703/src/main/java/com/fengwenyi/javalib/util/RSAUtil.java#L74-L83 |
m-m-m/util | nls/src/main/java/net/sf/mmm/util/nls/impl/DefaultNlsTemplateResolver.java | DefaultNlsTemplateResolver.initTemplatesForNlsBundles | protected void initTemplatesForNlsBundles(Map<String, NlsTemplate> map) {
if (this.bundleFactory instanceof AbstractNlsBundleFactory) {
Collection<? extends NlsBundleDescriptor> bundleDescriptors = ((AbstractNlsBundleFactory) this.bundleFactory).getNlsBundleDescriptors();
for (NlsBundleDescriptor descriptor : bundleDescriptors) {
for (Provider<NlsTemplate> container : descriptor.getTemplateContainers()) {
NlsTemplate template = container.get();
if (template instanceof NlsTemplateImplWithMessage) {
String message = template.translate(AbstractNlsMessage.LOCALE_ROOT);
map.put(message, template);
}
}
}
}
} | java | protected void initTemplatesForNlsBundles(Map<String, NlsTemplate> map) {
if (this.bundleFactory instanceof AbstractNlsBundleFactory) {
Collection<? extends NlsBundleDescriptor> bundleDescriptors = ((AbstractNlsBundleFactory) this.bundleFactory).getNlsBundleDescriptors();
for (NlsBundleDescriptor descriptor : bundleDescriptors) {
for (Provider<NlsTemplate> container : descriptor.getTemplateContainers()) {
NlsTemplate template = container.get();
if (template instanceof NlsTemplateImplWithMessage) {
String message = template.translate(AbstractNlsMessage.LOCALE_ROOT);
map.put(message, template);
}
}
}
}
} | [
"protected",
"void",
"initTemplatesForNlsBundles",
"(",
"Map",
"<",
"String",
",",
"NlsTemplate",
">",
"map",
")",
"{",
"if",
"(",
"this",
".",
"bundleFactory",
"instanceof",
"AbstractNlsBundleFactory",
")",
"{",
"Collection",
"<",
"?",
"extends",
"NlsBundleDescri... | This method initializes the {@link NlsTemplate}s for reverse lookup for {@link NlsBundle}s.
@param map the {@link Map} where to {@link Map#put(Object, Object) register} the {@link NlsTemplate}s by
their {@link net.sf.mmm.util.nls.api.NlsMessage#getInternationalizedMessage() i18n message}. | [
"This",
"method",
"initializes",
"the",
"{",
"@link",
"NlsTemplate",
"}",
"s",
"for",
"reverse",
"lookup",
"for",
"{",
"@link",
"NlsBundle",
"}",
"s",
"."
] | train | https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/nls/src/main/java/net/sf/mmm/util/nls/impl/DefaultNlsTemplateResolver.java#L121-L135 |
gitblit/fathom | fathom-x509/src/main/java/fathom/x509/X509Utils.java | X509Utils.getPrivateKey | public static PrivateKey getPrivateKey(String alias, File storeFile, String storePassword) {
try {
KeyStore store = openKeyStore(storeFile, storePassword);
PrivateKey key = (PrivateKey) store.getKey(alias, storePassword.toCharArray());
return key;
} catch (Exception e) {
throw new RuntimeException(e);
}
} | java | public static PrivateKey getPrivateKey(String alias, File storeFile, String storePassword) {
try {
KeyStore store = openKeyStore(storeFile, storePassword);
PrivateKey key = (PrivateKey) store.getKey(alias, storePassword.toCharArray());
return key;
} catch (Exception e) {
throw new RuntimeException(e);
}
} | [
"public",
"static",
"PrivateKey",
"getPrivateKey",
"(",
"String",
"alias",
",",
"File",
"storeFile",
",",
"String",
"storePassword",
")",
"{",
"try",
"{",
"KeyStore",
"store",
"=",
"openKeyStore",
"(",
"storeFile",
",",
"storePassword",
")",
";",
"PrivateKey",
... | Retrieves the private key for the specified alias from the certificate
store.
@param alias
@param storeFile
@param storePassword
@return the private key | [
"Retrieves",
"the",
"private",
"key",
"for",
"the",
"specified",
"alias",
"from",
"the",
"certificate",
"store",
"."
] | train | https://github.com/gitblit/fathom/blob/f2f820eb16e9fea1e36ad4eda4ed51b35f056538/fathom-x509/src/main/java/fathom/x509/X509Utils.java#L415-L423 |
UrielCh/ovh-java-sdk | ovh-java-sdk-newAccount/src/main/java/net/minidev/ovh/api/ApiOvhNewAccount.java | ApiOvhNewAccount.countries_GET | public ArrayList<OvhCountryEnum> countries_GET(OvhOvhCompanyEnum ovhCompany, OvhOvhSubsidiaryEnum ovhSubsidiary) throws IOException {
String qPath = "/newAccount/countries";
StringBuilder sb = path(qPath);
query(sb, "ovhCompany", ovhCompany);
query(sb, "ovhSubsidiary", ovhSubsidiary);
String resp = execN(qPath, "GET", sb.toString(), null);
return convertTo(resp, t2);
} | java | public ArrayList<OvhCountryEnum> countries_GET(OvhOvhCompanyEnum ovhCompany, OvhOvhSubsidiaryEnum ovhSubsidiary) throws IOException {
String qPath = "/newAccount/countries";
StringBuilder sb = path(qPath);
query(sb, "ovhCompany", ovhCompany);
query(sb, "ovhSubsidiary", ovhSubsidiary);
String resp = execN(qPath, "GET", sb.toString(), null);
return convertTo(resp, t2);
} | [
"public",
"ArrayList",
"<",
"OvhCountryEnum",
">",
"countries_GET",
"(",
"OvhOvhCompanyEnum",
"ovhCompany",
",",
"OvhOvhSubsidiaryEnum",
"ovhSubsidiary",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/newAccount/countries\"",
";",
"StringBuilder",
"sb",
... | All available countries for an ovh company and an ovh subsidiary
REST: GET /newAccount/countries
@param ovhCompany [required]
@param ovhSubsidiary [required] | [
"All",
"available",
"countries",
"for",
"an",
"ovh",
"company",
"and",
"an",
"ovh",
"subsidiary"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-newAccount/src/main/java/net/minidev/ovh/api/ApiOvhNewAccount.java#L53-L60 |
apache/incubator-gobblin | gobblin-utility/src/main/java/org/apache/gobblin/util/ConfigUtils.java | ConfigUtils.propertiesToTypedConfig | public static Config propertiesToTypedConfig(Properties properties, Optional<String> prefix) {
Map<String, Object> typedProps = guessPropertiesTypes(properties);
ImmutableMap.Builder<String, Object> immutableMapBuilder = ImmutableMap.builder();
for (Map.Entry<String, Object> entry : typedProps.entrySet()) {
if (StringUtils.startsWith(entry.getKey(), prefix.or(StringUtils.EMPTY))) {
immutableMapBuilder.put(entry.getKey(), entry.getValue());
}
}
return ConfigFactory.parseMap(immutableMapBuilder.build());
} | java | public static Config propertiesToTypedConfig(Properties properties, Optional<String> prefix) {
Map<String, Object> typedProps = guessPropertiesTypes(properties);
ImmutableMap.Builder<String, Object> immutableMapBuilder = ImmutableMap.builder();
for (Map.Entry<String, Object> entry : typedProps.entrySet()) {
if (StringUtils.startsWith(entry.getKey(), prefix.or(StringUtils.EMPTY))) {
immutableMapBuilder.put(entry.getKey(), entry.getValue());
}
}
return ConfigFactory.parseMap(immutableMapBuilder.build());
} | [
"public",
"static",
"Config",
"propertiesToTypedConfig",
"(",
"Properties",
"properties",
",",
"Optional",
"<",
"String",
">",
"prefix",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"typedProps",
"=",
"guessPropertiesTypes",
"(",
"properties",
")",
";",
... | Convert all the keys that start with a <code>prefix</code> in {@link Properties} to a
{@link Config} instance. The method also tries to guess the types of properties.
<p>
This method will throw an exception if (1) the {@link Object#toString()} method of any two keys in the
{@link Properties} objects returns the same {@link String}, or (2) if any two keys are prefixes of one another,
see the Java Docs of {@link ConfigFactory#parseMap(Map)} for more details.
</p>
@param properties the given {@link Properties} instance
@param prefix of keys to be converted
@return a {@link Config} instance | [
"Convert",
"all",
"the",
"keys",
"that",
"start",
"with",
"a",
"<code",
">",
"prefix<",
"/",
"code",
">",
"in",
"{",
"@link",
"Properties",
"}",
"to",
"a",
"{",
"@link",
"Config",
"}",
"instance",
".",
"The",
"method",
"also",
"tries",
"to",
"guess",
... | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/ConfigUtils.java#L264-L273 |
DV8FromTheWorld/JDA | src/main/java/net/dv8tion/jda/core/requests/restaction/MessageAction.java | MessageAction.addFile | @CheckReturnValue
public MessageAction addFile(final File file, final String name)
{
Checks.notNull(file, "File");
Checks.check(file.exists() && file.canRead(), "Provided file either does not exist or cannot be read from!");
final long maxSize = getJDA().getSelfUser().getAllowedFileSize();
Checks.check(file.length() <= maxSize, "File may not exceed the maximum file length of %d bytes!", maxSize);
try
{
FileInputStream data = new FileInputStream(file);
ownedResources.add(data);
return addFile(data, name);
}
catch (FileNotFoundException e)
{
throw new IllegalArgumentException(e);
}
} | java | @CheckReturnValue
public MessageAction addFile(final File file, final String name)
{
Checks.notNull(file, "File");
Checks.check(file.exists() && file.canRead(), "Provided file either does not exist or cannot be read from!");
final long maxSize = getJDA().getSelfUser().getAllowedFileSize();
Checks.check(file.length() <= maxSize, "File may not exceed the maximum file length of %d bytes!", maxSize);
try
{
FileInputStream data = new FileInputStream(file);
ownedResources.add(data);
return addFile(data, name);
}
catch (FileNotFoundException e)
{
throw new IllegalArgumentException(e);
}
} | [
"@",
"CheckReturnValue",
"public",
"MessageAction",
"addFile",
"(",
"final",
"File",
"file",
",",
"final",
"String",
"name",
")",
"{",
"Checks",
".",
"notNull",
"(",
"file",
",",
"\"File\"",
")",
";",
"Checks",
".",
"check",
"(",
"file",
".",
"exists",
"... | Adds the provided {@link java.io.File File} as file data.
<p>To reset all files use {@link #clearFiles()}
<br><u>This method opens a {@link java.io.FileInputStream FileInputStream} which will be closed by executing this action or using {@link #clearFiles()}!</u>
@param file
The File that will be interpreted as file data
@param name
The file name that should be used to interpret the type of the given data
using the file-name extension. This name is similar to what will be visible
through {@link net.dv8tion.jda.core.entities.Message.Attachment#getFileName() Message.Attachment.getFileName()}
@throws java.lang.IllegalStateException
If the file limit of {@value Message#MAX_FILE_AMOUNT} has been reached prior to calling this method,
or if this MessageAction will perform an edit operation on an existing Message (see {@link #isEdit()})
@throws java.lang.IllegalArgumentException
If the provided file is {@code null} or the provided name is blank or {@code null}
or if the provided file is bigger than the maximum file size of the currently logged in account,
or if the provided file does not exist/ is not readable
@throws net.dv8tion.jda.core.exceptions.InsufficientPermissionException
If this is targeting a TextChannel and the currently logged in account does not have
{@link net.dv8tion.jda.core.Permission#MESSAGE_ATTACH_FILES Permission.MESSAGE_ATTACH_FILES}
@return Updated MessageAction for chaining convenience
@see net.dv8tion.jda.core.entities.SelfUser#getAllowedFileSize() SelfUser.getAllowedFileSize() | [
"Adds",
"the",
"provided",
"{",
"@link",
"java",
".",
"io",
".",
"File",
"File",
"}",
"as",
"file",
"data",
"."
] | train | https://github.com/DV8FromTheWorld/JDA/blob/8ecbbe354d03f6bf448411bba573d0d4c268b560/src/main/java/net/dv8tion/jda/core/requests/restaction/MessageAction.java#L468-L485 |
datastax/java-driver | core/src/main/java/com/datastax/oss/driver/api/core/session/SessionBuilder.java | SessionBuilder.withNodeFilter | @NonNull
public SelfT withNodeFilter(@NonNull String profileName, @NonNull Predicate<Node> nodeFilter) {
this.nodeFilters.put(profileName, nodeFilter);
return self;
} | java | @NonNull
public SelfT withNodeFilter(@NonNull String profileName, @NonNull Predicate<Node> nodeFilter) {
this.nodeFilters.put(profileName, nodeFilter);
return self;
} | [
"@",
"NonNull",
"public",
"SelfT",
"withNodeFilter",
"(",
"@",
"NonNull",
"String",
"profileName",
",",
"@",
"NonNull",
"Predicate",
"<",
"Node",
">",
"nodeFilter",
")",
"{",
"this",
".",
"nodeFilters",
".",
"put",
"(",
"profileName",
",",
"nodeFilter",
")",... | Adds a custom filter to include/exclude nodes for a particular execution profile. This assumes
that you're also using a dedicated load balancing policy for that profile.
<p>The predicate's {@link Predicate#test(Object) test()} method will be invoked each time the
{@link LoadBalancingPolicy} processes a topology or state change: if it returns false, the
policy will suggest distance IGNORED (meaning the driver won't ever connect to it if all
policies agree), and never included in any query plan.
<p>Note that this behavior is implemented in the default load balancing policy. If you use a
custom policy implementation, you'll need to explicitly invoke the filter.
<p>If the filter is specified programmatically with this method, it overrides the configuration
(that is, the {@code load-balancing-policy.filter.class} option will be ignored).
@see #withNodeFilter(Predicate) | [
"Adds",
"a",
"custom",
"filter",
"to",
"include",
"/",
"exclude",
"nodes",
"for",
"a",
"particular",
"execution",
"profile",
".",
"This",
"assumes",
"that",
"you",
"re",
"also",
"using",
"a",
"dedicated",
"load",
"balancing",
"policy",
"for",
"that",
"profil... | train | https://github.com/datastax/java-driver/blob/612a63f2525618e2020e86c9ad75ab37adba6132/core/src/main/java/com/datastax/oss/driver/api/core/session/SessionBuilder.java#L264-L268 |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/jobgraph/tasks/AbstractInvokable.java | AbstractInvokable.abortCheckpointOnBarrier | public void abortCheckpointOnBarrier(long checkpointId, Throwable cause) throws Exception {
throw new UnsupportedOperationException(String.format("abortCheckpointOnBarrier not supported by %s", this.getClass().getName()));
} | java | public void abortCheckpointOnBarrier(long checkpointId, Throwable cause) throws Exception {
throw new UnsupportedOperationException(String.format("abortCheckpointOnBarrier not supported by %s", this.getClass().getName()));
} | [
"public",
"void",
"abortCheckpointOnBarrier",
"(",
"long",
"checkpointId",
",",
"Throwable",
"cause",
")",
"throws",
"Exception",
"{",
"throw",
"new",
"UnsupportedOperationException",
"(",
"String",
".",
"format",
"(",
"\"abortCheckpointOnBarrier not supported by %s\"",
"... | Aborts a checkpoint as the result of receiving possibly some checkpoint barriers,
but at least one {@link org.apache.flink.runtime.io.network.api.CancelCheckpointMarker}.
<p>This requires implementing tasks to forward a
{@link org.apache.flink.runtime.io.network.api.CancelCheckpointMarker} to their outputs.
@param checkpointId The ID of the checkpoint to be aborted.
@param cause The reason why the checkpoint was aborted during alignment | [
"Aborts",
"a",
"checkpoint",
"as",
"the",
"result",
"of",
"receiving",
"possibly",
"some",
"checkpoint",
"barriers",
"but",
"at",
"least",
"one",
"{",
"@link",
"org",
".",
"apache",
".",
"flink",
".",
"runtime",
".",
"io",
".",
"network",
".",
"api",
"."... | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/jobgraph/tasks/AbstractInvokable.java#L239-L241 |
gliga/ekstazi | org.ekstazi.core/src/main/java/org/ekstazi/dynamic/DynamicEkstazi.java | DynamicEkstazi.setSystemClassLoaderClassPath | private static void setSystemClassLoaderClassPath() throws Exception {
Log.d("Setting classpath");
// We use agent class as we do not extract this class in newly created
// jar (otherwise we may end up creating one -magic jar from another);
// also it will exist even without JUnit classes).
URL url = EkstaziAgent.class.getResource(EkstaziAgent.class.getSimpleName() + ".class");
String origPath = url.getFile().replace("file:", "").replaceAll(".jar!.*", ".jar");
File junitJar = new File(origPath);
File xtsJar = new File(origPath.replaceAll(".jar", "-magic.jar"));
boolean isCreated = false;
// If extracted (Tool) jar is newer than junit*.jar, there is no reason
// to extract files again, so just return in that case.
if (FileUtil.isSecondNewerThanFirst(junitJar, xtsJar)) {
// We cannot return here, as we have to include jar on the path.
isCreated = true;
} else {
// Extract new jar as junit.jar is newer.
String[] includePrefixes = { Names.EKSTAZI_PACKAGE_BIN };
String[] excludePrefixes = { EkstaziAgent.class.getName() };
isCreated = JarXtractor.extract(junitJar, xtsJar, includePrefixes, excludePrefixes);
}
// Add jar to classpath if it was successfully created, otherwise throw
// an exception.
if (isCreated) {
addURL(xtsJar.toURI().toURL());
} else {
throw new RuntimeException("Could not extract Tool classes in separate jar.");
}
} | java | private static void setSystemClassLoaderClassPath() throws Exception {
Log.d("Setting classpath");
// We use agent class as we do not extract this class in newly created
// jar (otherwise we may end up creating one -magic jar from another);
// also it will exist even without JUnit classes).
URL url = EkstaziAgent.class.getResource(EkstaziAgent.class.getSimpleName() + ".class");
String origPath = url.getFile().replace("file:", "").replaceAll(".jar!.*", ".jar");
File junitJar = new File(origPath);
File xtsJar = new File(origPath.replaceAll(".jar", "-magic.jar"));
boolean isCreated = false;
// If extracted (Tool) jar is newer than junit*.jar, there is no reason
// to extract files again, so just return in that case.
if (FileUtil.isSecondNewerThanFirst(junitJar, xtsJar)) {
// We cannot return here, as we have to include jar on the path.
isCreated = true;
} else {
// Extract new jar as junit.jar is newer.
String[] includePrefixes = { Names.EKSTAZI_PACKAGE_BIN };
String[] excludePrefixes = { EkstaziAgent.class.getName() };
isCreated = JarXtractor.extract(junitJar, xtsJar, includePrefixes, excludePrefixes);
}
// Add jar to classpath if it was successfully created, otherwise throw
// an exception.
if (isCreated) {
addURL(xtsJar.toURI().toURL());
} else {
throw new RuntimeException("Could not extract Tool classes in separate jar.");
}
} | [
"private",
"static",
"void",
"setSystemClassLoaderClassPath",
"(",
")",
"throws",
"Exception",
"{",
"Log",
".",
"d",
"(",
"\"Setting classpath\"",
")",
";",
"// We use agent class as we do not extract this class in newly created",
"// jar (otherwise we may end up creating one -magi... | Set paths from the current class loader to the path of system class
loader. This method should be invoked only once. | [
"Set",
"paths",
"from",
"the",
"current",
"class",
"loader",
"to",
"the",
"path",
"of",
"system",
"class",
"loader",
".",
"This",
"method",
"should",
"be",
"invoked",
"only",
"once",
"."
] | train | https://github.com/gliga/ekstazi/blob/5bf4d39a13305afe62f8b8d2d7b4c573d37d42a1/org.ekstazi.core/src/main/java/org/ekstazi/dynamic/DynamicEkstazi.java#L137-L167 |
wnameless/rubycollect4j | src/main/java/net/sf/rubycollect4j/util/ByteUtils.java | ByteUtils.toHexString | public static String toHexString(byte[] bytes, boolean isHNF) {
StringBuilder sb = new StringBuilder();
for (byte b : bytes) {
String hex =
String.format("%2s", Integer.toHexString(b & 0xFF)).replace(' ', '0');
if (isHNF)
sb.append(hex);
else
sb.append(new StringBuilder(hex).reverse());
}
return sb.toString();
} | java | public static String toHexString(byte[] bytes, boolean isHNF) {
StringBuilder sb = new StringBuilder();
for (byte b : bytes) {
String hex =
String.format("%2s", Integer.toHexString(b & 0xFF)).replace(' ', '0');
if (isHNF)
sb.append(hex);
else
sb.append(new StringBuilder(hex).reverse());
}
return sb.toString();
} | [
"public",
"static",
"String",
"toHexString",
"(",
"byte",
"[",
"]",
"bytes",
",",
"boolean",
"isHNF",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"byte",
"b",
":",
"bytes",
")",
"{",
"String",
"hex",
"=",
... | Converts a byte array to a hex String.
@param bytes
a byte array
@param isHNF
true if HNF(high nibble first), false if LNF(low nibble first)
@return hex String | [
"Converts",
"a",
"byte",
"array",
"to",
"a",
"hex",
"String",
"."
] | train | https://github.com/wnameless/rubycollect4j/blob/b8b8d8eccaca2254a3d09b91745882fb7a0d5add/src/main/java/net/sf/rubycollect4j/util/ByteUtils.java#L496-L507 |
umeding/fuzzer | src/main/java/com/uwemeding/fuzzer/Program.java | Program.getItem | private <T> T getItem(String itemName, Map<String, T> items, String typeName) {
T item = items.get(itemName);
if (item == null) {
throw new FuzzerException(name + ": " + typeName + " '" + itemName + "' not found");
}
return item;
} | java | private <T> T getItem(String itemName, Map<String, T> items, String typeName) {
T item = items.get(itemName);
if (item == null) {
throw new FuzzerException(name + ": " + typeName + " '" + itemName + "' not found");
}
return item;
} | [
"private",
"<",
"T",
">",
"T",
"getItem",
"(",
"String",
"itemName",
",",
"Map",
"<",
"String",
",",
"T",
">",
"items",
",",
"String",
"typeName",
")",
"{",
"T",
"item",
"=",
"items",
".",
"get",
"(",
"itemName",
")",
";",
"if",
"(",
"item",
"=="... | Get an item from a map.
<p>
@param <T> the map type
@param itemName the item name
@param items the items
@param typeName the item type name
@return the item | [
"Get",
"an",
"item",
"from",
"a",
"map",
".",
"<p",
">"
] | train | https://github.com/umeding/fuzzer/blob/e8aa46313bb1d1328865f26f99455124aede828c/src/main/java/com/uwemeding/fuzzer/Program.java#L369-L375 |
UrielCh/ovh-java-sdk | ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java | ApiOvhCloud.project_serviceName_user_userId_regeneratePassword_POST | public OvhUserDetail project_serviceName_user_userId_regeneratePassword_POST(String serviceName, Long userId) throws IOException {
String qPath = "/cloud/project/{serviceName}/user/{userId}/regeneratePassword";
StringBuilder sb = path(qPath, serviceName, userId);
String resp = exec(qPath, "POST", sb.toString(), null);
return convertTo(resp, OvhUserDetail.class);
} | java | public OvhUserDetail project_serviceName_user_userId_regeneratePassword_POST(String serviceName, Long userId) throws IOException {
String qPath = "/cloud/project/{serviceName}/user/{userId}/regeneratePassword";
StringBuilder sb = path(qPath, serviceName, userId);
String resp = exec(qPath, "POST", sb.toString(), null);
return convertTo(resp, OvhUserDetail.class);
} | [
"public",
"OvhUserDetail",
"project_serviceName_user_userId_regeneratePassword_POST",
"(",
"String",
"serviceName",
",",
"Long",
"userId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/cloud/project/{serviceName}/user/{userId}/regeneratePassword\"",
";",
"StringB... | Regenerate user password
REST: POST /cloud/project/{serviceName}/user/{userId}/regeneratePassword
@param serviceName [required] Service name
@param userId [required] User id | [
"Regenerate",
"user",
"password"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java#L418-L423 |
haifengl/smile | core/src/main/java/smile/wavelet/WaveletShrinkage.java | WaveletShrinkage.denoise | public static void denoise(double[] t, Wavelet wavelet, boolean soft) {
wavelet.transform(t);
int n = t.length;
int nh = t.length >> 1;
double[] wc = new double[nh];
System.arraycopy(t, nh, wc, 0, nh);
double error = Math.mad(wc) / 0.6745;
double lambda = error * Math.sqrt(2 * Math.log(n));
if (soft) {
for (int i = 2; i < n; i++) {
t[i] = Math.signum(t[i]) * Math.max(Math.abs(t[i]) - lambda, 0.0);
}
} else {
for (int i = 2; i < n; i++) {
if (Math.abs(t[i]) < lambda) {
t[i] = 0.0;
}
}
}
wavelet.inverse(t);
} | java | public static void denoise(double[] t, Wavelet wavelet, boolean soft) {
wavelet.transform(t);
int n = t.length;
int nh = t.length >> 1;
double[] wc = new double[nh];
System.arraycopy(t, nh, wc, 0, nh);
double error = Math.mad(wc) / 0.6745;
double lambda = error * Math.sqrt(2 * Math.log(n));
if (soft) {
for (int i = 2; i < n; i++) {
t[i] = Math.signum(t[i]) * Math.max(Math.abs(t[i]) - lambda, 0.0);
}
} else {
for (int i = 2; i < n; i++) {
if (Math.abs(t[i]) < lambda) {
t[i] = 0.0;
}
}
}
wavelet.inverse(t);
} | [
"public",
"static",
"void",
"denoise",
"(",
"double",
"[",
"]",
"t",
",",
"Wavelet",
"wavelet",
",",
"boolean",
"soft",
")",
"{",
"wavelet",
".",
"transform",
"(",
"t",
")",
";",
"int",
"n",
"=",
"t",
".",
"length",
";",
"int",
"nh",
"=",
"t",
".... | Adaptive denoising a time series with given wavelet.
@param t the time series array. The size should be a power of 2. For time
series of size no power of 2, 0 padding can be applied.
@param wavelet the wavelet to transform the time series.
@param soft true if apply soft thresholding. | [
"Adaptive",
"denoising",
"a",
"time",
"series",
"with",
"given",
"wavelet",
"."
] | train | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/wavelet/WaveletShrinkage.java#L68-L93 |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.registry/src/com/ibm/ws/security/registry/internal/UserRegistryServiceImpl.java | UserRegistryServiceImpl.autoDetectUserRegistry | private UserRegistry autoDetectUserRegistry(boolean exceptionOnError) throws RegistryException {
// Determine if there is a federation registry configured.
UserRegistry ur = getFederationRegistry(exceptionOnError);
synchronized (userRegistrySync) {
if (ur != null) {
setRegistriesToBeFederated((FederationRegistry) ur, exceptionOnError);
isFederationActive = true;
return ur;
} else
isFederationActive = false;
}
if (userRegistries.isEmpty()) {
if (exceptionOnError) {
Tr.error(tc, "USER_REGISTRY_SERVICE_NO_USER_REGISTRY_AVAILABLE");
throw new RegistryException(TraceNLS.getFormattedMessage(this.getClass(), TraceConstants.MESSAGE_BUNDLE,
"USER_REGISTRY_SERVICE_NO_USER_REGISTRY_AVAILABLE",
new Object[] {},
"CWWKS3005E: A configuration exception has occurred. No UserRegistry implementation service is available. Ensure that you have a user registry configured."));
} else {
return null;
}
} else if (urCount > 1) {
if (exceptionOnError) {
Tr.error(tc, "USER_REGISTRY_SERVICE_MULTIPLE_USER_REGISTRY_AVAILABLE");
throw new RegistryException(TraceNLS.getFormattedMessage(
this.getClass(),
TraceConstants.MESSAGE_BUNDLE,
"USER_REGISTRY_SERVICE_MULTIPLE_USER_REGISTRY_AVAILABLE",
new Object[] {},
"CWWKS3006E: A configuration error has occurred. Multiple available UserRegistry implementation services, unable to determine which to use."));
} else {
return null;
}
} else {
String id = userRegistries.keySet().iterator().next();
return getUserRegistry(id, exceptionOnError);
}
} | java | private UserRegistry autoDetectUserRegistry(boolean exceptionOnError) throws RegistryException {
// Determine if there is a federation registry configured.
UserRegistry ur = getFederationRegistry(exceptionOnError);
synchronized (userRegistrySync) {
if (ur != null) {
setRegistriesToBeFederated((FederationRegistry) ur, exceptionOnError);
isFederationActive = true;
return ur;
} else
isFederationActive = false;
}
if (userRegistries.isEmpty()) {
if (exceptionOnError) {
Tr.error(tc, "USER_REGISTRY_SERVICE_NO_USER_REGISTRY_AVAILABLE");
throw new RegistryException(TraceNLS.getFormattedMessage(this.getClass(), TraceConstants.MESSAGE_BUNDLE,
"USER_REGISTRY_SERVICE_NO_USER_REGISTRY_AVAILABLE",
new Object[] {},
"CWWKS3005E: A configuration exception has occurred. No UserRegistry implementation service is available. Ensure that you have a user registry configured."));
} else {
return null;
}
} else if (urCount > 1) {
if (exceptionOnError) {
Tr.error(tc, "USER_REGISTRY_SERVICE_MULTIPLE_USER_REGISTRY_AVAILABLE");
throw new RegistryException(TraceNLS.getFormattedMessage(
this.getClass(),
TraceConstants.MESSAGE_BUNDLE,
"USER_REGISTRY_SERVICE_MULTIPLE_USER_REGISTRY_AVAILABLE",
new Object[] {},
"CWWKS3006E: A configuration error has occurred. Multiple available UserRegistry implementation services, unable to determine which to use."));
} else {
return null;
}
} else {
String id = userRegistries.keySet().iterator().next();
return getUserRegistry(id, exceptionOnError);
}
} | [
"private",
"UserRegistry",
"autoDetectUserRegistry",
"(",
"boolean",
"exceptionOnError",
")",
"throws",
"RegistryException",
"{",
"// Determine if there is a federation registry configured.",
"UserRegistry",
"ur",
"=",
"getFederationRegistry",
"(",
"exceptionOnError",
")",
";",
... | When a configuration element is not defined, use some "auto-detect"
logic to try and return the single UserRegistry. If there is no
service, or multiple services, that is considered an error case which
"auto-detect" can not resolve.
@return
@throws RegistryException | [
"When",
"a",
"configuration",
"element",
"is",
"not",
"defined",
"use",
"some",
"auto",
"-",
"detect",
"logic",
"to",
"try",
"and",
"return",
"the",
"single",
"UserRegistry",
".",
"If",
"there",
"is",
"no",
"service",
"or",
"multiple",
"services",
"that",
... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.registry/src/com/ibm/ws/security/registry/internal/UserRegistryServiceImpl.java#L391-L429 |
infinispan/infinispan | extended-statistics/src/main/java/org/infinispan/stats/topK/StreamSummaryContainer.java | StreamSummaryContainer.addLockInformation | public void addLockInformation(Object key, boolean contention, boolean failLock) {
if (!isEnabled()) {
return;
}
syncOffer(Stat.MOST_LOCKED_KEYS, key);
if (contention) {
syncOffer(Stat.MOST_CONTENDED_KEYS, key);
}
if (failLock) {
syncOffer(Stat.MOST_FAILED_KEYS, key);
}
} | java | public void addLockInformation(Object key, boolean contention, boolean failLock) {
if (!isEnabled()) {
return;
}
syncOffer(Stat.MOST_LOCKED_KEYS, key);
if (contention) {
syncOffer(Stat.MOST_CONTENDED_KEYS, key);
}
if (failLock) {
syncOffer(Stat.MOST_FAILED_KEYS, key);
}
} | [
"public",
"void",
"addLockInformation",
"(",
"Object",
"key",
",",
"boolean",
"contention",
",",
"boolean",
"failLock",
")",
"{",
"if",
"(",
"!",
"isEnabled",
"(",
")",
")",
"{",
"return",
";",
"}",
"syncOffer",
"(",
"Stat",
".",
"MOST_LOCKED_KEYS",
",",
... | Adds the lock information about the key, namely if the key suffer some contention and if the keys was locked or
not.
@param contention {@code true} if the key was contented.
@param failLock {@code true} if the key was not locked. | [
"Adds",
"the",
"lock",
"information",
"about",
"the",
"key",
"namely",
"if",
"the",
"key",
"suffer",
"some",
"contention",
"and",
"if",
"the",
"keys",
"was",
"locked",
"or",
"not",
"."
] | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/extended-statistics/src/main/java/org/infinispan/stats/topK/StreamSummaryContainer.java#L129-L142 |
sarl/sarl | main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/parser/SarlDocumentationParser.java | SarlDocumentationParser.setPattern | public void setPattern(Tag tag, String regex) {
if (Strings.isNullOrEmpty(regex)) {
this.rawPatterns.remove(tag);
this.compiledPatterns.remove(tag);
} else {
this.rawPatterns.put(tag, regex);
this.compiledPatterns.put(tag, Pattern.compile("^\\s*" + regex, PATTERN_COMPILE_OPTIONS)); //$NON-NLS-1$
}
} | java | public void setPattern(Tag tag, String regex) {
if (Strings.isNullOrEmpty(regex)) {
this.rawPatterns.remove(tag);
this.compiledPatterns.remove(tag);
} else {
this.rawPatterns.put(tag, regex);
this.compiledPatterns.put(tag, Pattern.compile("^\\s*" + regex, PATTERN_COMPILE_OPTIONS)); //$NON-NLS-1$
}
} | [
"public",
"void",
"setPattern",
"(",
"Tag",
"tag",
",",
"String",
"regex",
")",
"{",
"if",
"(",
"Strings",
".",
"isNullOrEmpty",
"(",
"regex",
")",
")",
"{",
"this",
".",
"rawPatterns",
".",
"remove",
"(",
"tag",
")",
";",
"this",
".",
"compiledPattern... | Change the pattern of the tag.
@param tag the tag.
@param regex the regular expression. | [
"Change",
"the",
"pattern",
"of",
"the",
"tag",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/parser/SarlDocumentationParser.java#L289-L297 |
camunda/camunda-bpmn-model | src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractCallActivityBuilder.java | AbstractCallActivityBuilder.camundaOut | public B camundaOut(String source, String target) {
CamundaOut param = modelInstance.newInstance(CamundaOut.class);
param.setCamundaSource(source);
param.setCamundaTarget(target);
addExtensionElement(param);
return myself;
} | java | public B camundaOut(String source, String target) {
CamundaOut param = modelInstance.newInstance(CamundaOut.class);
param.setCamundaSource(source);
param.setCamundaTarget(target);
addExtensionElement(param);
return myself;
} | [
"public",
"B",
"camundaOut",
"(",
"String",
"source",
",",
"String",
"target",
")",
"{",
"CamundaOut",
"param",
"=",
"modelInstance",
".",
"newInstance",
"(",
"CamundaOut",
".",
"class",
")",
";",
"param",
".",
"setCamundaSource",
"(",
"source",
")",
";",
... | Sets a "camunda out" parameter to pass a variable from a sub process instance to the super process instance
@param source the name of variable in the sub process instance
@param target the name of the variable in the super process instance
@return the builder object | [
"Sets",
"a",
"camunda",
"out",
"parameter",
"to",
"pass",
"a",
"variable",
"from",
"a",
"sub",
"process",
"instance",
"to",
"the",
"super",
"process",
"instance"
] | train | https://github.com/camunda/camunda-bpmn-model/blob/debcadf041d10fa62b799de0307b832cea84e5d4/src/main/java/org/camunda/bpm/model/bpmn/builder/AbstractCallActivityBuilder.java#L181-L187 |
groovy/groovy-core | src/main/groovy/lang/GroovyClassLoader.java | GroovyClassLoader.defineClass | public Class defineClass(ClassNode classNode, String file, String newCodeBase) {
CodeSource codeSource = null;
try {
codeSource = new CodeSource(new URL("file", "", newCodeBase), (java.security.cert.Certificate[]) null);
} catch (MalformedURLException e) {
//swallow
}
CompilationUnit unit = createCompilationUnit(config, codeSource);
ClassCollector collector = createCollector(unit, classNode.getModule().getContext());
try {
unit.addClassNode(classNode);
unit.setClassgenCallback(collector);
unit.compile(Phases.CLASS_GENERATION);
definePackage(collector.generatedClass.getName());
return collector.generatedClass;
} catch (CompilationFailedException e) {
throw new RuntimeException(e);
}
} | java | public Class defineClass(ClassNode classNode, String file, String newCodeBase) {
CodeSource codeSource = null;
try {
codeSource = new CodeSource(new URL("file", "", newCodeBase), (java.security.cert.Certificate[]) null);
} catch (MalformedURLException e) {
//swallow
}
CompilationUnit unit = createCompilationUnit(config, codeSource);
ClassCollector collector = createCollector(unit, classNode.getModule().getContext());
try {
unit.addClassNode(classNode);
unit.setClassgenCallback(collector);
unit.compile(Phases.CLASS_GENERATION);
definePackage(collector.generatedClass.getName());
return collector.generatedClass;
} catch (CompilationFailedException e) {
throw new RuntimeException(e);
}
} | [
"public",
"Class",
"defineClass",
"(",
"ClassNode",
"classNode",
",",
"String",
"file",
",",
"String",
"newCodeBase",
")",
"{",
"CodeSource",
"codeSource",
"=",
"null",
";",
"try",
"{",
"codeSource",
"=",
"new",
"CodeSource",
"(",
"new",
"URL",
"(",
"\"file\... | Loads the given class node returning the implementation Class.
<p>
WARNING: this compilation is not synchronized
@param classNode
@return a class | [
"Loads",
"the",
"given",
"class",
"node",
"returning",
"the",
"implementation",
"Class",
".",
"<p",
">",
"WARNING",
":",
"this",
"compilation",
"is",
"not",
"synchronized"
] | train | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/groovy/lang/GroovyClassLoader.java#L168-L187 |
code4everything/util | src/main/java/com/zhazhapan/util/ReflectUtils.java | ReflectUtils.executeExpression | public static Object executeExpression(String jexlExpression, Map<String, Object> map) {
JexlExpression expression = jexlEngine.createExpression(jexlExpression);
JexlContext context = new MapContext();
if (Checker.isNotEmpty(map)) {
map.forEach(context::set);
}
return expression.evaluate(context);
} | java | public static Object executeExpression(String jexlExpression, Map<String, Object> map) {
JexlExpression expression = jexlEngine.createExpression(jexlExpression);
JexlContext context = new MapContext();
if (Checker.isNotEmpty(map)) {
map.forEach(context::set);
}
return expression.evaluate(context);
} | [
"public",
"static",
"Object",
"executeExpression",
"(",
"String",
"jexlExpression",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"map",
")",
"{",
"JexlExpression",
"expression",
"=",
"jexlEngine",
".",
"createExpression",
"(",
"jexlExpression",
")",
";",
"Jexl... | 将字符串转成代码,并执行
<p>
<br><a href="https://blog.csdn.net/qq_26954773/article/details/80379015#3-%E6%B5%8B%E8%AF%95">怎么使用</a>
@param jexlExpression 代码表达式
@param map 参数映射
@return 执行结果
@since 1.0.8 | [
"将字符串转成代码,并执行",
"<p",
">",
"<br",
">",
"<a",
"href",
"=",
"https",
":",
"//",
"blog",
".",
"csdn",
".",
"net",
"/",
"qq_26954773",
"/",
"article",
"/",
"details",
"/",
"80379015#3",
"-",
"%E6%B5%8B%E8%AF%95",
">",
"怎么使用<",
"/",
"a",
">"
] | train | https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/ReflectUtils.java#L79-L86 |
aspectran/aspectran | core/src/main/java/com/aspectran/core/support/i18n/message/ResourceBundleMessageSource.java | ResourceBundleMessageSource.getStringOrNull | protected String getStringOrNull(ResourceBundle bundle, String key) {
if (bundle.containsKey(key)) {
try {
return bundle.getString(key);
} catch (MissingResourceException ex) {
// Assume key not found for some other reason
// -> do NOT throw the exception to allow for checking parent message source.
}
}
return null;
} | java | protected String getStringOrNull(ResourceBundle bundle, String key) {
if (bundle.containsKey(key)) {
try {
return bundle.getString(key);
} catch (MissingResourceException ex) {
// Assume key not found for some other reason
// -> do NOT throw the exception to allow for checking parent message source.
}
}
return null;
} | [
"protected",
"String",
"getStringOrNull",
"(",
"ResourceBundle",
"bundle",
",",
"String",
"key",
")",
"{",
"if",
"(",
"bundle",
".",
"containsKey",
"(",
"key",
")",
")",
"{",
"try",
"{",
"return",
"bundle",
".",
"getString",
"(",
"key",
")",
";",
"}",
... | Efficiently retrieve the String value for the specified key,
or return {@code null} if not found.
@param bundle the ResourceBundle to perform the lookup in
@param key the key to look up
@return the associated value, or {@code null} if none
@see ResourceBundle#getString(String) ResourceBundle#getString(String)
@see ResourceBundle#containsKey(String) ResourceBundle#containsKey(String) | [
"Efficiently",
"retrieve",
"the",
"String",
"value",
"for",
"the",
"specified",
"key",
"or",
"return",
"{",
"@code",
"null",
"}",
"if",
"not",
"found",
"."
] | train | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/support/i18n/message/ResourceBundleMessageSource.java#L389-L399 |
MindscapeHQ/raygun4android | provider/src/main/java/com.mindscapehq.android.raygun4android/network/RaygunNetworkLogger.java | RaygunNetworkLogger.cancelNetworkCall | public static synchronized void cancelNetworkCall(String url, String requestMethod, long endTime, String exception) {
if (url != null) {
String id = sanitiseURL(url);
if ((connections != null) && (connections.containsKey(id))) {
connections.remove(id);
}
}
} | java | public static synchronized void cancelNetworkCall(String url, String requestMethod, long endTime, String exception) {
if (url != null) {
String id = sanitiseURL(url);
if ((connections != null) && (connections.containsKey(id))) {
connections.remove(id);
}
}
} | [
"public",
"static",
"synchronized",
"void",
"cancelNetworkCall",
"(",
"String",
"url",
",",
"String",
"requestMethod",
",",
"long",
"endTime",
",",
"String",
"exception",
")",
"{",
"if",
"(",
"url",
"!=",
"null",
")",
"{",
"String",
"id",
"=",
"sanitiseURL",... | When a network request is cancelled we stop tracking it and do not send the information through.
Future updates may include sending the cancelled request timing through with information showing it was cancelled. | [
"When",
"a",
"network",
"request",
"is",
"cancelled",
"we",
"stop",
"tracking",
"it",
"and",
"do",
"not",
"send",
"the",
"information",
"through",
".",
"Future",
"updates",
"may",
"include",
"sending",
"the",
"cancelled",
"request",
"timing",
"through",
"with"... | train | https://github.com/MindscapeHQ/raygun4android/blob/227231f9b8aca1cafa5b6518a388d128e37d35fe/provider/src/main/java/com.mindscapehq.android.raygun4android/network/RaygunNetworkLogger.java#L61-L68 |
taskadapter/redmine-java-api | src/main/java/com/taskadapter/redmineapi/WikiManager.java | WikiManager.getWikiPageDetailByProjectAndTitle | public WikiPageDetail getWikiPageDetailByProjectAndTitle(String projectKey, String pageTitle) throws RedmineException {
String urlSafeString = WikiPageDetail.getUrlSafeString(pageTitle);
WikiPageDetail wikiPageDetail = transport.getChildEntry(Project.class, projectKey, WikiPageDetail.class, urlSafeString, new BasicNameValuePair("include", "attachments"));
// Redmine REST API does not provide projectKey in response, so...
wikiPageDetail.setProjectKey(projectKey);
return wikiPageDetail;
} | java | public WikiPageDetail getWikiPageDetailByProjectAndTitle(String projectKey, String pageTitle) throws RedmineException {
String urlSafeString = WikiPageDetail.getUrlSafeString(pageTitle);
WikiPageDetail wikiPageDetail = transport.getChildEntry(Project.class, projectKey, WikiPageDetail.class, urlSafeString, new BasicNameValuePair("include", "attachments"));
// Redmine REST API does not provide projectKey in response, so...
wikiPageDetail.setProjectKey(projectKey);
return wikiPageDetail;
} | [
"public",
"WikiPageDetail",
"getWikiPageDetailByProjectAndTitle",
"(",
"String",
"projectKey",
",",
"String",
"pageTitle",
")",
"throws",
"RedmineException",
"{",
"String",
"urlSafeString",
"=",
"WikiPageDetail",
".",
"getUrlSafeString",
"(",
"pageTitle",
")",
";",
"Wik... | @param projectKey the key of the project (like "TEST-12") we want the wiki page from
@param pageTitle The name of the page
@return the wiki page titled with the name passed as parameter
@since Redmine 2.2 | [
"@param",
"projectKey",
"the",
"key",
"of",
"the",
"project",
"(",
"like",
"TEST",
"-",
"12",
")",
"we",
"want",
"the",
"wiki",
"page",
"from",
"@param",
"pageTitle",
"The",
"name",
"of",
"the",
"page"
] | train | https://github.com/taskadapter/redmine-java-api/blob/0bb65f27ee806ec3bd4007e1641f3e996261a04e/src/main/java/com/taskadapter/redmineapi/WikiManager.java#L56-L62 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/date/DateUtil.java | DateUtil.offsetDate | @Deprecated
public static DateTime offsetDate(Date date, DateField dateField, int offset) {
return offset(date, dateField, offset);
} | java | @Deprecated
public static DateTime offsetDate(Date date, DateField dateField, int offset) {
return offset(date, dateField, offset);
} | [
"@",
"Deprecated",
"public",
"static",
"DateTime",
"offsetDate",
"(",
"Date",
"date",
",",
"DateField",
"dateField",
",",
"int",
"offset",
")",
"{",
"return",
"offset",
"(",
"date",
",",
"dateField",
",",
"offset",
")",
";",
"}"
] | 获取指定日期偏移指定时间后的时间
@param date 基准日期
@param dateField 偏移的粒度大小(小时、天、月等){@link DateField}
@param offset 偏移量,正数为向后偏移,负数为向前偏移
@return 偏移后的日期
@deprecated please use {@link DateUtil#offset(Date, DateField, int)} | [
"获取指定日期偏移指定时间后的时间"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/DateUtil.java#L1214-L1217 |
jenkinsci/support-core-plugin | src/main/java/com/cloudbees/jenkins/support/api/PrintedContent.java | PrintedContent.getWriter | private PrintWriter getWriter(OutputStream os) throws IOException {
if (os instanceof WrapperOutputStream) {
OutputStream out = ((WrapperOutputStream) os).unwrapRecursively();
if (out instanceof FilteredOutputStream) {
FilteredOutputStream filteredStream = (FilteredOutputStream) out;
return new PrintWriter(new IgnoreCloseWriter(filteredStream.asWriter()));
}
}
return new PrintWriter(new BufferedWriter(new OutputStreamWriter(os, StandardCharsets.UTF_8)));
} | java | private PrintWriter getWriter(OutputStream os) throws IOException {
if (os instanceof WrapperOutputStream) {
OutputStream out = ((WrapperOutputStream) os).unwrapRecursively();
if (out instanceof FilteredOutputStream) {
FilteredOutputStream filteredStream = (FilteredOutputStream) out;
return new PrintWriter(new IgnoreCloseWriter(filteredStream.asWriter()));
}
}
return new PrintWriter(new BufferedWriter(new OutputStreamWriter(os, StandardCharsets.UTF_8)));
} | [
"private",
"PrintWriter",
"getWriter",
"(",
"OutputStream",
"os",
")",
"throws",
"IOException",
"{",
"if",
"(",
"os",
"instanceof",
"WrapperOutputStream",
")",
"{",
"OutputStream",
"out",
"=",
"(",
"(",
"WrapperOutputStream",
")",
"os",
")",
".",
"unwrapRecursiv... | When anonymization is enabled, we create an {@link com.cloudbees.jenkins.support.filter.FilteredWriter} directly from
the underlying {@link FilteredOutputStream} that prevents us from encoding and
then immediately decoding characters written to the returned {@link java.io.PrintStream}
when filtering. | [
"When",
"anonymization",
"is",
"enabled",
"we",
"create",
"an",
"{"
] | train | https://github.com/jenkinsci/support-core-plugin/blob/bcbe1dfd5bf48ac89903645cd48ed897c1a04688/src/main/java/com/cloudbees/jenkins/support/api/PrintedContent.java#L68-L77 |
fernandospr/javapns-jdk16 | src/main/java/javapns/Push.java | Push.payloads | public static PushedNotifications payloads(Object keystore, String password, boolean production, Object payloadDevicePairs) throws CommunicationException, KeystoreException {
return sendPayloads(keystore, password, production, payloadDevicePairs);
} | java | public static PushedNotifications payloads(Object keystore, String password, boolean production, Object payloadDevicePairs) throws CommunicationException, KeystoreException {
return sendPayloads(keystore, password, production, payloadDevicePairs);
} | [
"public",
"static",
"PushedNotifications",
"payloads",
"(",
"Object",
"keystore",
",",
"String",
"password",
",",
"boolean",
"production",
",",
"Object",
"payloadDevicePairs",
")",
"throws",
"CommunicationException",
",",
"KeystoreException",
"{",
"return",
"sendPayload... | Push a different preformatted payload for each device.
@param keystore a keystore containing your private key and the certificate signed by Apple ({@link java.io.File}, {@link java.io.InputStream}, byte[], {@link java.security.KeyStore} or {@link java.lang.String} for a file path)
@param password the keystore's password.
@param production true to use Apple's production servers, false to use the sandbox servers.
@param payloadDevicePairs a list or an array of PayloadPerDevice: {@link java.util.List}<{@link javapns.notification.PayloadPerDevice}>, {@link javapns.notification.PayloadPerDevice PayloadPerDevice[]} or {@link javapns.notification.PayloadPerDevice}
@return a list of pushed notifications, each with details on transmission results and error (if any)
@throws KeystoreException thrown if an error occurs when loading the keystore
@throws CommunicationException thrown if an unrecoverable error occurs while trying to communicate with Apple servers | [
"Push",
"a",
"different",
"preformatted",
"payload",
"for",
"each",
"device",
"."
] | train | https://github.com/fernandospr/javapns-jdk16/blob/84de6d9328ab01af92f77cc60c4554de02420909/src/main/java/javapns/Push.java#L250-L252 |
ivanceras/orm | src/main/java/com/ivanceras/db/api/ModelDef.java | ModelDef.getPlainProperties | public String[] getPlainProperties(){
String[] commonColumns = {"created", "createdby", "updated","updatedby", "isactive"};
String[] referencedProperties = getReferencedColumns();
List<String> plainProperties = new ArrayList<String>();
for(String att : attributes){
if(CStringUtils.indexOf(referencedProperties, att) >= 0 ){
//do not include referenced columns
}
else if(att.endsWith("_id")){
;//do not include implied columns
}
else if(CStringUtils.indexOf(commonColumns, att) >= 0){
;//do not include common columns
}
else{
plainProperties.add(att);
}
}
return plainProperties.toArray(new String[plainProperties.size()]);
} | java | public String[] getPlainProperties(){
String[] commonColumns = {"created", "createdby", "updated","updatedby", "isactive"};
String[] referencedProperties = getReferencedColumns();
List<String> plainProperties = new ArrayList<String>();
for(String att : attributes){
if(CStringUtils.indexOf(referencedProperties, att) >= 0 ){
//do not include referenced columns
}
else if(att.endsWith("_id")){
;//do not include implied columns
}
else if(CStringUtils.indexOf(commonColumns, att) >= 0){
;//do not include common columns
}
else{
plainProperties.add(att);
}
}
return plainProperties.toArray(new String[plainProperties.size()]);
} | [
"public",
"String",
"[",
"]",
"getPlainProperties",
"(",
")",
"{",
"String",
"[",
"]",
"commonColumns",
"=",
"{",
"\"created\"",
",",
"\"createdby\"",
",",
"\"updated\"",
",",
"\"updatedby\"",
",",
"\"isactive\"",
"}",
";",
"String",
"[",
"]",
"referencedPrope... | Get the properties that are pertaining to the model, this does not include linker columns
@return | [
"Get",
"the",
"properties",
"that",
"are",
"pertaining",
"to",
"the",
"model",
"this",
"does",
"not",
"include",
"linker",
"columns"
] | train | https://github.com/ivanceras/orm/blob/e63213cb8abefd11df0e2d34b1c95477788e600e/src/main/java/com/ivanceras/db/api/ModelDef.java#L342-L361 |
landawn/AbacusUtil | src/com/landawn/abacus/util/LongList.java | LongList.noneMatch | public <E extends Exception> boolean noneMatch(Try.LongPredicate<E> filter) throws E {
return noneMatch(0, size(), filter);
} | java | public <E extends Exception> boolean noneMatch(Try.LongPredicate<E> filter) throws E {
return noneMatch(0, size(), filter);
} | [
"public",
"<",
"E",
"extends",
"Exception",
">",
"boolean",
"noneMatch",
"(",
"Try",
".",
"LongPredicate",
"<",
"E",
">",
"filter",
")",
"throws",
"E",
"{",
"return",
"noneMatch",
"(",
"0",
",",
"size",
"(",
")",
",",
"filter",
")",
";",
"}"
] | Returns whether no elements of this List match the provided predicate.
@param filter
@return | [
"Returns",
"whether",
"no",
"elements",
"of",
"this",
"List",
"match",
"the",
"provided",
"predicate",
"."
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/LongList.java#L968-L970 |
twitter/cloudhopper-commons | ch-commons-util/src/main/java/com/cloudhopper/commons/util/DateTimeUtil.java | DateTimeUtil.parseEmbedded | public static DateTime parseEmbedded(String string0, String pattern, DateTimeZone zone) throws IllegalArgumentException {
// compile a date time formatter -- which also will check that pattern
DateTimeFormatter fmt = DateTimeFormat.forPattern(pattern).withZone(zone);
//
// use the pattern to generate a regular expression now -- we'll do a
// simple replacement of ascii characters with \\d
//
StringBuilder regex = new StringBuilder(pattern.length()*2);
for (int i = 0; i < pattern.length(); i++) {
char c = pattern.charAt(i);
if (Character.isLetter(c)) {
regex.append("\\d");
} else {
regex.append(c);
}
}
// extract the date from the string
Pattern p = Pattern.compile(regex.toString()); // Compiles regular expression into Pattern.
Matcher m = p.matcher(string0); // Creates Matcher with subject s and Pattern p.
if (!m.find()) {
// if we get here, then no valid grouping was found
throw new IllegalArgumentException("String '" + string0 + "' did not contain an embedded date [regexPattern='" + regex.toString() + "', datePattern='" + pattern + "']");
}
//logger.debug("Matching date: " + m.group());
// this group represents a string in the format YYYY-MM-DD
String dateString = m.group();
// parse the string and return the Date
return fmt.parseDateTime(dateString);
} | java | public static DateTime parseEmbedded(String string0, String pattern, DateTimeZone zone) throws IllegalArgumentException {
// compile a date time formatter -- which also will check that pattern
DateTimeFormatter fmt = DateTimeFormat.forPattern(pattern).withZone(zone);
//
// use the pattern to generate a regular expression now -- we'll do a
// simple replacement of ascii characters with \\d
//
StringBuilder regex = new StringBuilder(pattern.length()*2);
for (int i = 0; i < pattern.length(); i++) {
char c = pattern.charAt(i);
if (Character.isLetter(c)) {
regex.append("\\d");
} else {
regex.append(c);
}
}
// extract the date from the string
Pattern p = Pattern.compile(regex.toString()); // Compiles regular expression into Pattern.
Matcher m = p.matcher(string0); // Creates Matcher with subject s and Pattern p.
if (!m.find()) {
// if we get here, then no valid grouping was found
throw new IllegalArgumentException("String '" + string0 + "' did not contain an embedded date [regexPattern='" + regex.toString() + "', datePattern='" + pattern + "']");
}
//logger.debug("Matching date: " + m.group());
// this group represents a string in the format YYYY-MM-DD
String dateString = m.group();
// parse the string and return the Date
return fmt.parseDateTime(dateString);
} | [
"public",
"static",
"DateTime",
"parseEmbedded",
"(",
"String",
"string0",
",",
"String",
"pattern",
",",
"DateTimeZone",
"zone",
")",
"throws",
"IllegalArgumentException",
"{",
"// compile a date time formatter -- which also will check that pattern",
"DateTimeFormatter",
"fmt"... | Parses a string for an embedded date and/or time contained within a
string such as "app.2008-05-01.log" or "app-20090624-051112.log.gz".
This method accepts a variety of date and time patterns that are valid
within the Joda DateTime library. For example, the string "app.2008-05-01.log"
would be a pattern of "yyyy-MM-dd" and the string "app-20090624-151112.log.gz"
would be a pattern of "yyyy-MM-dd-HHmmss".
@param string0 The string to parse
@param pattern The DateTime pattern embedded in the string such as
"yyyy-MM-dd". The pattern must be a valid DateTime Joda pattern.
@param zone The timezone the parsed date will be in
@return The parsed DateTime value
@throws IllegalArgumentException Thrown if the pattern is invalid or if
string did not contain an embedded date. | [
"Parses",
"a",
"string",
"for",
"an",
"embedded",
"date",
"and",
"/",
"or",
"time",
"contained",
"within",
"a",
"string",
"such",
"as",
"app",
".",
"2008",
"-",
"05",
"-",
"01",
".",
"log",
"or",
"app",
"-",
"20090624",
"-",
"051112",
".",
"log",
"... | train | https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/DateTimeUtil.java#L121-L153 |
gmessner/gitlab4j-api | src/main/java/org/gitlab4j/api/GitLabApi.java | GitLabApi.enableRequestResponseLogging | public void enableRequestResponseLogging(Logger logger, Level level, int maxEntitySize, List<String> maskedHeaderNames) {
apiClient.enableRequestResponseLogging(logger, level, maxEntitySize, maskedHeaderNames);
} | java | public void enableRequestResponseLogging(Logger logger, Level level, int maxEntitySize, List<String> maskedHeaderNames) {
apiClient.enableRequestResponseLogging(logger, level, maxEntitySize, maskedHeaderNames);
} | [
"public",
"void",
"enableRequestResponseLogging",
"(",
"Logger",
"logger",
",",
"Level",
"level",
",",
"int",
"maxEntitySize",
",",
"List",
"<",
"String",
">",
"maskedHeaderNames",
")",
"{",
"apiClient",
".",
"enableRequestResponseLogging",
"(",
"logger",
",",
"le... | Enable the logging of the requests to and the responses from the GitLab server API using the
specified logger.
@param logger the Logger instance to log to
@param level the logging level (SEVERE, WARNING, INFO, CONFIG, FINE, FINER, FINEST)
@param maxEntitySize maximum number of entity bytes to be logged. When logging if the maxEntitySize
is reached, the entity logging will be truncated at maxEntitySize and "...more..." will be added at
the end of the log entry. If maxEntitySize is <= 0, entity logging will be disabled
@param maskedHeaderNames a list of header names that should have the values masked | [
"Enable",
"the",
"logging",
"of",
"the",
"requests",
"to",
"and",
"the",
"responses",
"from",
"the",
"GitLab",
"server",
"API",
"using",
"the",
"specified",
"logger",
"."
] | train | https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/GitLabApi.java#L719-L721 |
aws/aws-sdk-java | aws-java-sdk-api-gateway/src/main/java/com/amazonaws/services/apigateway/model/GetGatewayResponseResult.java | GetGatewayResponseResult.withResponseParameters | public GetGatewayResponseResult withResponseParameters(java.util.Map<String, String> responseParameters) {
setResponseParameters(responseParameters);
return this;
} | java | public GetGatewayResponseResult withResponseParameters(java.util.Map<String, String> responseParameters) {
setResponseParameters(responseParameters);
return this;
} | [
"public",
"GetGatewayResponseResult",
"withResponseParameters",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"responseParameters",
")",
"{",
"setResponseParameters",
"(",
"responseParameters",
")",
";",
"return",
"this",
";",
"}"
] | <p>
Response parameters (paths, query strings and headers) of the <a>GatewayResponse</a> as a string-to-string map of
key-value pairs.
</p>
@param responseParameters
Response parameters (paths, query strings and headers) of the <a>GatewayResponse</a> as a string-to-string
map of key-value pairs.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"Response",
"parameters",
"(",
"paths",
"query",
"strings",
"and",
"headers",
")",
"of",
"the",
"<a",
">",
"GatewayResponse<",
"/",
"a",
">",
"as",
"a",
"string",
"-",
"to",
"-",
"string",
"map",
"of",
"key",
"-",
"value",
"pairs",
".",
"<... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-api-gateway/src/main/java/com/amazonaws/services/apigateway/model/GetGatewayResponseResult.java#L483-L486 |
lucee/Lucee | core/src/main/java/lucee/runtime/reflection/Reflector.java | Reflector.getConstructorInstance | public static ConstructorInstance getConstructorInstance(Class clazz, Object[] args) throws NoSuchMethodException {
ConstructorInstance ci = getConstructorInstance(clazz, args, null);
if (ci != null) return ci;
throw new NoSuchMethodException("No matching Constructor for " + clazz.getName() + "(" + getDspMethods(getClasses(args)) + ") found");
} | java | public static ConstructorInstance getConstructorInstance(Class clazz, Object[] args) throws NoSuchMethodException {
ConstructorInstance ci = getConstructorInstance(clazz, args, null);
if (ci != null) return ci;
throw new NoSuchMethodException("No matching Constructor for " + clazz.getName() + "(" + getDspMethods(getClasses(args)) + ") found");
} | [
"public",
"static",
"ConstructorInstance",
"getConstructorInstance",
"(",
"Class",
"clazz",
",",
"Object",
"[",
"]",
"args",
")",
"throws",
"NoSuchMethodException",
"{",
"ConstructorInstance",
"ci",
"=",
"getConstructorInstance",
"(",
"clazz",
",",
"args",
",",
"nul... | gets Constructor Instance matching given parameter
@param clazz Clazz to Invoke
@param args Matching args
@return Matching ConstructorInstance
@throws NoSuchMethodException
@throws PageException | [
"gets",
"Constructor",
"Instance",
"matching",
"given",
"parameter"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/reflection/Reflector.java#L420-L424 |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging/src/com/ibm/ws/logging/internal/impl/BaseTraceService.java | BaseTraceService.jsonEscape | private void jsonEscape(StringBuilder sb, String s) {
if (s == null) {
sb.append(s);
return;
}
for (int i = 0; i < s.length(); i++) {
char c = s.charAt(i);
switch (c) {
case '\b':
sb.append("\\b");
break;
case '\f':
sb.append("\\f");
break;
case '\n':
sb.append("\\n");
break;
case '\r':
sb.append("\\r");
break;
case '\t':
sb.append("\\t");
break;
// Fall through because we just need to add \ (escaped) before the character
case '\\':
case '\"':
case '/':
sb.append("\\");
sb.append(c);
break;
default:
sb.append(c);
}
}
} | java | private void jsonEscape(StringBuilder sb, String s) {
if (s == null) {
sb.append(s);
return;
}
for (int i = 0; i < s.length(); i++) {
char c = s.charAt(i);
switch (c) {
case '\b':
sb.append("\\b");
break;
case '\f':
sb.append("\\f");
break;
case '\n':
sb.append("\\n");
break;
case '\r':
sb.append("\\r");
break;
case '\t':
sb.append("\\t");
break;
// Fall through because we just need to add \ (escaped) before the character
case '\\':
case '\"':
case '/':
sb.append("\\");
sb.append(c);
break;
default:
sb.append(c);
}
}
} | [
"private",
"void",
"jsonEscape",
"(",
"StringBuilder",
"sb",
",",
"String",
"s",
")",
"{",
"if",
"(",
"s",
"==",
"null",
")",
"{",
"sb",
".",
"append",
"(",
"s",
")",
";",
"return",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"... | Escape \b, \f, \n, \r, \t, ", \, / characters and appends to a string builder
@param sb String builder to append to
@param s String to escape | [
"Escape",
"\\",
"b",
"\\",
"f",
"\\",
"n",
"\\",
"r",
"\\",
"t",
"\\",
"/",
"characters",
"and",
"appends",
"to",
"a",
"string",
"builder"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging/src/com/ibm/ws/logging/internal/impl/BaseTraceService.java#L1127-L1162 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/ie/AbstractSequenceClassifier.java | AbstractSequenceClassifier.classifyAndWriteViterbiSearchGraph | public void classifyAndWriteViterbiSearchGraph(String testFile, String searchGraphPrefix, DocumentReaderAndWriter<IN> readerAndWriter) throws IOException {
Timing timer = new Timing();
ObjectBank<List<IN>> documents =
makeObjectBankFromFile(testFile, readerAndWriter);
int numWords = 0;
int numSentences = 0;
for (List<IN> doc : documents) {
DFSA<String, Integer> tagLattice = getViterbiSearchGraph(doc, AnswerAnnotation.class);
numWords += doc.size();
PrintWriter latticeWriter = new PrintWriter(new FileOutputStream(searchGraphPrefix + '.' + numSentences
+ ".wlattice"));
PrintWriter vsgWriter = new PrintWriter(new FileOutputStream(searchGraphPrefix + '.' + numSentences + ".lattice"));
if (readerAndWriter instanceof LatticeWriter)
((LatticeWriter) readerAndWriter).printLattice(tagLattice, doc, latticeWriter);
tagLattice.printAttFsmFormat(vsgWriter);
latticeWriter.close();
vsgWriter.close();
numSentences++;
}
long millis = timer.stop();
double wordspersec = numWords / (((double) millis) / 1000);
NumberFormat nf = new DecimalFormat("0.00"); // easier way!
System.err.println(this.getClass().getName() + " tagged " + numWords + " words in " + numSentences
+ " documents at " + nf.format(wordspersec) + " words per second.");
} | java | public void classifyAndWriteViterbiSearchGraph(String testFile, String searchGraphPrefix, DocumentReaderAndWriter<IN> readerAndWriter) throws IOException {
Timing timer = new Timing();
ObjectBank<List<IN>> documents =
makeObjectBankFromFile(testFile, readerAndWriter);
int numWords = 0;
int numSentences = 0;
for (List<IN> doc : documents) {
DFSA<String, Integer> tagLattice = getViterbiSearchGraph(doc, AnswerAnnotation.class);
numWords += doc.size();
PrintWriter latticeWriter = new PrintWriter(new FileOutputStream(searchGraphPrefix + '.' + numSentences
+ ".wlattice"));
PrintWriter vsgWriter = new PrintWriter(new FileOutputStream(searchGraphPrefix + '.' + numSentences + ".lattice"));
if (readerAndWriter instanceof LatticeWriter)
((LatticeWriter) readerAndWriter).printLattice(tagLattice, doc, latticeWriter);
tagLattice.printAttFsmFormat(vsgWriter);
latticeWriter.close();
vsgWriter.close();
numSentences++;
}
long millis = timer.stop();
double wordspersec = numWords / (((double) millis) / 1000);
NumberFormat nf = new DecimalFormat("0.00"); // easier way!
System.err.println(this.getClass().getName() + " tagged " + numWords + " words in " + numSentences
+ " documents at " + nf.format(wordspersec) + " words per second.");
} | [
"public",
"void",
"classifyAndWriteViterbiSearchGraph",
"(",
"String",
"testFile",
",",
"String",
"searchGraphPrefix",
",",
"DocumentReaderAndWriter",
"<",
"IN",
">",
"readerAndWriter",
")",
"throws",
"IOException",
"{",
"Timing",
"timer",
"=",
"new",
"Timing",
"(",
... | Load a test file, run the classifier on it, and then write a Viterbi search
graph for each sequence.
@param testFile
The file to test on. | [
"Load",
"a",
"test",
"file",
"run",
"the",
"classifier",
"on",
"it",
"and",
"then",
"write",
"a",
"Viterbi",
"search",
"graph",
"for",
"each",
"sequence",
"."
] | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/ie/AbstractSequenceClassifier.java#L1205-L1231 |
btrplace/scheduler | choco/src/main/java/org/btrplace/scheduler/choco/view/CShareableResource.java | CShareableResource.capOverbookRatio | public double capOverbookRatio(int nIdx, double d) {
if (d < 1) {
return ratios.get(nIdx);
}
double v = Math.min(ratios.get(nIdx), d);
ratios.set(nIdx, v);
return v;
} | java | public double capOverbookRatio(int nIdx, double d) {
if (d < 1) {
return ratios.get(nIdx);
}
double v = Math.min(ratios.get(nIdx), d);
ratios.set(nIdx, v);
return v;
} | [
"public",
"double",
"capOverbookRatio",
"(",
"int",
"nIdx",
",",
"double",
"d",
")",
"{",
"if",
"(",
"d",
"<",
"1",
")",
"{",
"return",
"ratios",
".",
"get",
"(",
"nIdx",
")",
";",
"}",
"double",
"v",
"=",
"Math",
".",
"min",
"(",
"ratios",
".",
... | Cap the overbooking ratio for a given node.
@param nIdx the node
@param d the new ratio. {@code >= 1}
@return the resulting ratio. Will be lower than {@code d} if a previous cap stated a lower value | [
"Cap",
"the",
"overbooking",
"ratio",
"for",
"a",
"given",
"node",
"."
] | train | https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/choco/src/main/java/org/btrplace/scheduler/choco/view/CShareableResource.java#L243-L250 |
GeoLatte/geolatte-common | src/main/java/org/geolatte/common/reflection/EntityClassReader.java | EntityClassReader.getPropertyValue | public Object getPropertyValue(Object objectToGet, String propertyPath) throws InvalidObjectReaderException {
if (objectToGet == null || propertyPath == null) {
throw new IllegalArgumentException("Given object/propertyname may not be null");
}
if (objectToGet.getClass() != entityClass) {
throw new InvalidObjectReaderException("Class of target object does not correspond with entityclass of this reader.");
}
StringTokenizer tokenizer = new StringTokenizer(propertyPath, ".", false);
return getPropertyValue(objectToGet, tokenizer);
} | java | public Object getPropertyValue(Object objectToGet, String propertyPath) throws InvalidObjectReaderException {
if (objectToGet == null || propertyPath == null) {
throw new IllegalArgumentException("Given object/propertyname may not be null");
}
if (objectToGet.getClass() != entityClass) {
throw new InvalidObjectReaderException("Class of target object does not correspond with entityclass of this reader.");
}
StringTokenizer tokenizer = new StringTokenizer(propertyPath, ".", false);
return getPropertyValue(objectToGet, tokenizer);
} | [
"public",
"Object",
"getPropertyValue",
"(",
"Object",
"objectToGet",
",",
"String",
"propertyPath",
")",
"throws",
"InvalidObjectReaderException",
"{",
"if",
"(",
"objectToGet",
"==",
"null",
"||",
"propertyPath",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalA... | Returns the value of the property with a given name from the given object
@param objectToGet The object from which the property value is to be retrieved
@param propertyPath The dot-separated path of the property to retrieve. E.g. directly property: "name",
sub property: "streetAddress.number"
@return The value of the named property in the given object or null if the property can not
be found
@throws InvalidObjectReaderException If the class of the given object does not correspond with the entityclass
of this reader
@throws IllegalArgumentException if the given objectToGet or propertyValue is null | [
"Returns",
"the",
"value",
"of",
"the",
"property",
"with",
"a",
"given",
"name",
"from",
"the",
"given",
"object"
] | train | https://github.com/GeoLatte/geolatte-common/blob/dc7f92b04d8c6cb706e78cb95e746d8f12089d95/src/main/java/org/geolatte/common/reflection/EntityClassReader.java#L323-L334 |
zalando/riptide | riptide-opentracing/src/main/java/org/zalando/riptide/opentracing/OpenTracingPlugin.java | OpenTracingPlugin.withSpanDecorators | @CheckReturnValue
public OpenTracingPlugin withSpanDecorators(final SpanDecorator decorator, final SpanDecorator... decorators) {
return new OpenTracingPlugin(tracer, SpanDecorator.composite(decorator, decorators));
} | java | @CheckReturnValue
public OpenTracingPlugin withSpanDecorators(final SpanDecorator decorator, final SpanDecorator... decorators) {
return new OpenTracingPlugin(tracer, SpanDecorator.composite(decorator, decorators));
} | [
"@",
"CheckReturnValue",
"public",
"OpenTracingPlugin",
"withSpanDecorators",
"(",
"final",
"SpanDecorator",
"decorator",
",",
"final",
"SpanDecorator",
"...",
"decorators",
")",
"{",
"return",
"new",
"OpenTracingPlugin",
"(",
"tracer",
",",
"SpanDecorator",
".",
"com... | Creates a new {@link OpenTracingPlugin plugin} by <strong>replacing</strong> the {@link SpanDecorator decorator(s)} of
{@code this} plugin with the supplied ones.
@param decorator first decorator
@param decorators optional, remaining decorators
@return a new {@link OpenTracingPlugin} | [
"Creates",
"a",
"new",
"{",
"@link",
"OpenTracingPlugin",
"plugin",
"}",
"by",
"<strong",
">",
"replacing<",
"/",
"strong",
">",
"the",
"{",
"@link",
"SpanDecorator",
"decorator",
"(",
"s",
")",
"}",
"of",
"{",
"@code",
"this",
"}",
"plugin",
"with",
"th... | train | https://github.com/zalando/riptide/blob/0f53529a69c864203ced5fa067dcf3d42dba0e26/riptide-opentracing/src/main/java/org/zalando/riptide/opentracing/OpenTracingPlugin.java#L103-L106 |
pryzach/midao | midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/utils/MappingUtils.java | MappingUtils.callSetter | public static void callSetter(Object target, PropertyDescriptor prop, Object value) {
Method setter = prop.getWriteMethod();
if (setter == null) {
return;
}
try {
setter.invoke(target, new Object[]{value});
} catch (IllegalArgumentException e) {
throw new RuntimeException(
"Cannot set " + prop.getName() + ": " + e.getMessage(), e);
} catch (IllegalAccessException e) {
throw new RuntimeException(
"Cannot set " + prop.getName() + ": " + e.getMessage(), e);
} catch (InvocationTargetException e) {
throw new RuntimeException(
"Cannot set " + prop.getName() + ": " + e.getMessage(), e);
}
} | java | public static void callSetter(Object target, PropertyDescriptor prop, Object value) {
Method setter = prop.getWriteMethod();
if (setter == null) {
return;
}
try {
setter.invoke(target, new Object[]{value});
} catch (IllegalArgumentException e) {
throw new RuntimeException(
"Cannot set " + prop.getName() + ": " + e.getMessage(), e);
} catch (IllegalAccessException e) {
throw new RuntimeException(
"Cannot set " + prop.getName() + ": " + e.getMessage(), e);
} catch (InvocationTargetException e) {
throw new RuntimeException(
"Cannot set " + prop.getName() + ": " + e.getMessage(), e);
}
} | [
"public",
"static",
"void",
"callSetter",
"(",
"Object",
"target",
",",
"PropertyDescriptor",
"prop",
",",
"Object",
"value",
")",
"{",
"Method",
"setter",
"=",
"prop",
".",
"getWriteMethod",
"(",
")",
";",
"if",
"(",
"setter",
"==",
"null",
")",
"{",
"r... | Invokes Property Descriptor Setter and sets value @value into it.
@param target Object Getter of which would be executed
@param prop Property Descriptor which would be used to invoke Getter
@param value Value which should be set into @target | [
"Invokes",
"Property",
"Descriptor",
"Setter",
"and",
"sets",
"value",
"@value",
"into",
"it",
"."
] | train | https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/utils/MappingUtils.java#L152-L175 |
wcm-io/wcm-io-caconfig | extensions/src/main/java/io/wcm/caconfig/extensions/persistence/impl/PersistenceUtils.java | PersistenceUtils.deleteChildrenNotInCollection | public static void deleteChildrenNotInCollection(Resource resource, ConfigurationCollectionPersistData data) {
Set<String> collectionItemNames = data.getItems().stream()
.map(item -> item.getCollectionItemName())
.collect(Collectors.toSet());
for (Resource child : resource.getChildren()) {
if (!collectionItemNames.contains(child.getName()) && !StringUtils.equals(JCR_CONTENT, child.getName())) {
deletePageOrResource(child);
}
}
} | java | public static void deleteChildrenNotInCollection(Resource resource, ConfigurationCollectionPersistData data) {
Set<String> collectionItemNames = data.getItems().stream()
.map(item -> item.getCollectionItemName())
.collect(Collectors.toSet());
for (Resource child : resource.getChildren()) {
if (!collectionItemNames.contains(child.getName()) && !StringUtils.equals(JCR_CONTENT, child.getName())) {
deletePageOrResource(child);
}
}
} | [
"public",
"static",
"void",
"deleteChildrenNotInCollection",
"(",
"Resource",
"resource",
",",
"ConfigurationCollectionPersistData",
"data",
")",
"{",
"Set",
"<",
"String",
">",
"collectionItemNames",
"=",
"data",
".",
"getItems",
"(",
")",
".",
"stream",
"(",
")"... | Delete children that are no longer contained in list of collection items.
@param resource Parent resource
@param data List of collection items | [
"Delete",
"children",
"that",
"are",
"no",
"longer",
"contained",
"in",
"list",
"of",
"collection",
"items",
"."
] | train | https://github.com/wcm-io/wcm-io-caconfig/blob/48592eadb0b62a09eec555cedfae7e00b213f6ed/extensions/src/main/java/io/wcm/caconfig/extensions/persistence/impl/PersistenceUtils.java#L215-L225 |
bazaarvoice/jolt | jolt-core/src/main/java/com/bazaarvoice/jolt/cardinality/CardinalityCompositeSpec.java | CardinalityCompositeSpec.applyCardinality | @Override
public boolean applyCardinality( String inputKey, Object input, WalkedPath walkedPath, Object parentContainer ) {
MatchedElement thisLevel = pathElement.match( inputKey, walkedPath );
if ( thisLevel == null ) {
return false;
}
walkedPath.add( input, thisLevel );
// The specialChild can change the data object that I point to.
// Aka, my key had a value that was a List, and that gets changed so that my key points to a ONE value
if (specialChild != null) {
input = specialChild.applyToParentContainer( inputKey, input, walkedPath, parentContainer );
}
// Handle the rest of the children
process( input, walkedPath );
walkedPath.removeLast();
return true;
} | java | @Override
public boolean applyCardinality( String inputKey, Object input, WalkedPath walkedPath, Object parentContainer ) {
MatchedElement thisLevel = pathElement.match( inputKey, walkedPath );
if ( thisLevel == null ) {
return false;
}
walkedPath.add( input, thisLevel );
// The specialChild can change the data object that I point to.
// Aka, my key had a value that was a List, and that gets changed so that my key points to a ONE value
if (specialChild != null) {
input = specialChild.applyToParentContainer( inputKey, input, walkedPath, parentContainer );
}
// Handle the rest of the children
process( input, walkedPath );
walkedPath.removeLast();
return true;
} | [
"@",
"Override",
"public",
"boolean",
"applyCardinality",
"(",
"String",
"inputKey",
",",
"Object",
"input",
",",
"WalkedPath",
"walkedPath",
",",
"Object",
"parentContainer",
")",
"{",
"MatchedElement",
"thisLevel",
"=",
"pathElement",
".",
"match",
"(",
"inputKe... | If this Spec matches the inputkey, then perform one step in the parallel treewalk.
<p/>
Step one level down the input "tree" by carefully handling the List/Map nature the input to
get the "one level down" data.
<p/>
Step one level down the Spec tree by carefully and efficiently applying our children to the
"one level down" data.
@return true if this this spec "handles" the inputkey such that no sibling specs need to see it | [
"If",
"this",
"Spec",
"matches",
"the",
"inputkey",
"then",
"perform",
"one",
"step",
"in",
"the",
"parallel",
"treewalk",
".",
"<p",
"/",
">",
"Step",
"one",
"level",
"down",
"the",
"input",
"tree",
"by",
"carefully",
"handling",
"the",
"List",
"/",
"Ma... | train | https://github.com/bazaarvoice/jolt/blob/4cf866a9f4222142da41b50dbcccce022a956bff/jolt-core/src/main/java/com/bazaarvoice/jolt/cardinality/CardinalityCompositeSpec.java#L144-L164 |
aws/aws-sdk-java | aws-java-sdk-core/src/main/java/com/amazonaws/util/ValidationUtils.java | ValidationUtils.assertNotNull | public static <T> T assertNotNull(T object, String fieldName) throws IllegalArgumentException {
if (object == null) {
throw new IllegalArgumentException(String.format("%s cannot be null", fieldName));
}
return object;
} | java | public static <T> T assertNotNull(T object, String fieldName) throws IllegalArgumentException {
if (object == null) {
throw new IllegalArgumentException(String.format("%s cannot be null", fieldName));
}
return object;
} | [
"public",
"static",
"<",
"T",
">",
"T",
"assertNotNull",
"(",
"T",
"object",
",",
"String",
"fieldName",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"object",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"String",
"... | Asserts that the given object is non-null and returns it.
@param object
Object to assert on
@param fieldName
Field name to display in exception message if null
@return Object if non null
@throws IllegalArgumentException
If object was null | [
"Asserts",
"that",
"the",
"given",
"object",
"is",
"non",
"-",
"null",
"and",
"returns",
"it",
"."
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-core/src/main/java/com/amazonaws/util/ValidationUtils.java#L35-L40 |
cdk/cdk | app/depict/src/main/java/org/openscience/cdk/depict/Abbreviations.java | Abbreviations.setEnabled | public boolean setEnabled(String label, boolean enabled) {
return enabled ? labels.contains(label) && disabled.remove(label)
: labels.contains(label) && disabled.add(label);
} | java | public boolean setEnabled(String label, boolean enabled) {
return enabled ? labels.contains(label) && disabled.remove(label)
: labels.contains(label) && disabled.add(label);
} | [
"public",
"boolean",
"setEnabled",
"(",
"String",
"label",
",",
"boolean",
"enabled",
")",
"{",
"return",
"enabled",
"?",
"labels",
".",
"contains",
"(",
"label",
")",
"&&",
"disabled",
".",
"remove",
"(",
"label",
")",
":",
"labels",
".",
"contains",
"(... | Set whether an abbreviation is enabled or disabled.
@param label the label (e.g. Ph, Et, Me, OAc, etc.)
@param enabled flag the label as enabled or disabled
@return the label state was modified | [
"Set",
"whether",
"an",
"abbreviation",
"is",
"enabled",
"or",
"disabled",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/app/depict/src/main/java/org/openscience/cdk/depict/Abbreviations.java#L166-L169 |
census-instrumentation/opencensus-java | contrib/dropwizard5/src/main/java/io/opencensus/contrib/dropwizard5/DropWizardUtils.java | DropWizardUtils.generateFullMetricDescription | static String generateFullMetricDescription(String metricName, Metric metric) {
return "Collected from "
+ SOURCE
+ " (metric="
+ metricName
+ ", type="
+ metric.getClass().getName()
+ ")";
} | java | static String generateFullMetricDescription(String metricName, Metric metric) {
return "Collected from "
+ SOURCE
+ " (metric="
+ metricName
+ ", type="
+ metric.getClass().getName()
+ ")";
} | [
"static",
"String",
"generateFullMetricDescription",
"(",
"String",
"metricName",
",",
"Metric",
"metric",
")",
"{",
"return",
"\"Collected from \"",
"+",
"SOURCE",
"+",
"\" (metric=\"",
"+",
"metricName",
"+",
"\", type=\"",
"+",
"metric",
".",
"getClass",
"(",
"... | Returns the metric description.
@param metricName the initial metric name
@param metric the codahale metric class.
@return a String the custom metric description | [
"Returns",
"the",
"metric",
"description",
"."
] | train | https://github.com/census-instrumentation/opencensus-java/blob/deefac9bed77e40a2297bff1ca5ec5aa48a5f755/contrib/dropwizard5/src/main/java/io/opencensus/contrib/dropwizard5/DropWizardUtils.java#L51-L59 |
liyiorg/weixin-popular | src/main/java/weixin/popular/api/SemanticAPI.java | SemanticAPI.addvoicetorecofortext | public static BaseResult addvoicetorecofortext(String accessToken, String voiceId, URI uri) {
return addvoicetorecofortext(accessToken, voiceId, null, uri);
} | java | public static BaseResult addvoicetorecofortext(String accessToken, String voiceId, URI uri) {
return addvoicetorecofortext(accessToken, voiceId, null, uri);
} | [
"public",
"static",
"BaseResult",
"addvoicetorecofortext",
"(",
"String",
"accessToken",
",",
"String",
"voiceId",
",",
"URI",
"uri",
")",
"{",
"return",
"addvoicetorecofortext",
"(",
"accessToken",
",",
"voiceId",
",",
"null",
",",
"uri",
")",
";",
"}"
] | 提交语音
@param accessToken 接口调用凭证
@param voiceId 语音唯一标识
@param uri 文件格式 只支持mp3,16k,单声道,最大1M
@return BaseResult
@since 2.8.22 | [
"提交语音"
] | train | https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/api/SemanticAPI.java#L110-L112 |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/concurrent/FutureUtils.java | FutureUtils.runAfterwardsAsync | public static CompletableFuture<Void> runAfterwardsAsync(CompletableFuture<?> future, RunnableWithException runnable) {
return runAfterwardsAsync(future, runnable, ForkJoinPool.commonPool());
} | java | public static CompletableFuture<Void> runAfterwardsAsync(CompletableFuture<?> future, RunnableWithException runnable) {
return runAfterwardsAsync(future, runnable, ForkJoinPool.commonPool());
} | [
"public",
"static",
"CompletableFuture",
"<",
"Void",
">",
"runAfterwardsAsync",
"(",
"CompletableFuture",
"<",
"?",
">",
"future",
",",
"RunnableWithException",
"runnable",
")",
"{",
"return",
"runAfterwardsAsync",
"(",
"future",
",",
"runnable",
",",
"ForkJoinPool... | Run the given action after the completion of the given future. The given future can be
completed normally or exceptionally. In case of an exceptional completion the, the
action's exception will be added to the initial exception.
@param future to wait for its completion
@param runnable action which is triggered after the future's completion
@return Future which is completed after the action has completed. This future can contain an exception,
if an error occurred in the given future or action. | [
"Run",
"the",
"given",
"action",
"after",
"the",
"completion",
"of",
"the",
"given",
"future",
".",
"The",
"given",
"future",
"can",
"be",
"completed",
"normally",
"or",
"exceptionally",
".",
"In",
"case",
"of",
"an",
"exceptional",
"completion",
"the",
"the... | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/concurrent/FutureUtils.java#L421-L423 |
yavijava/yavijava | src/main/java/com/vmware/vim25/mo/HostVsanSystem.java | HostVsanSystem.removeDisk_Task | public Task removeDisk_Task(HostScsiDisk[] disk, HostMaintenanceSpec maintenanceSpec, int timeout) throws RuntimeFault, RemoteException {
ManagedObjectReference mor = getVimService().removeDisk_Task(this.getMOR(), disk, maintenanceSpec, timeout);
return new Task(getServerConnection(), mor);
} | java | public Task removeDisk_Task(HostScsiDisk[] disk, HostMaintenanceSpec maintenanceSpec, int timeout) throws RuntimeFault, RemoteException {
ManagedObjectReference mor = getVimService().removeDisk_Task(this.getMOR(), disk, maintenanceSpec, timeout);
return new Task(getServerConnection(), mor);
} | [
"public",
"Task",
"removeDisk_Task",
"(",
"HostScsiDisk",
"[",
"]",
"disk",
",",
"HostMaintenanceSpec",
"maintenanceSpec",
",",
"int",
"timeout",
")",
"throws",
"RuntimeFault",
",",
"RemoteException",
"{",
"ManagedObjectReference",
"mor",
"=",
"getVimService",
"(",
... | Remove the set of given disks from use by the VSAN service on this host. Users may use this API to manually
remove a DiskMapping#nonSsd from a DiskMapping. This operation is only permitted if the VSAN service on this host
is not configured to automatically claim storage.
@param disk list of disks to be removed from use by the VSAN service.
@param maintenanceSpec -
Any additional actions to move data out of the disk before removing it.
@param timeout Time to wait for the task to complete in seconds. If the value is less than or equal to zero,
there is no timeout. The operation fails with a Timedout exception if it timed out.
@return This method returns a Task object with which to monitor the operation.
@throws RuntimeFault
@throws RemoteException
@see com.vmware.vim25.HostMaintenanceSpec
If unspecified, there is no action taken to move data from the
disk. | [
"Remove",
"the",
"set",
"of",
"given",
"disks",
"from",
"use",
"by",
"the",
"VSAN",
"service",
"on",
"this",
"host",
".",
"Users",
"may",
"use",
"this",
"API",
"to",
"manually",
"remove",
"a",
"DiskMapping#nonSsd",
"from",
"a",
"DiskMapping",
".",
"This",
... | train | https://github.com/yavijava/yavijava/blob/27fd2c5826115782d5eeb934f86e3e39240179cd/src/main/java/com/vmware/vim25/mo/HostVsanSystem.java#L101-L104 |
googleads/googleads-java-lib | examples/admanager_axis/src/main/java/admanager/axis/v201811/reportservice/RunAdExchangeReport.java | RunAdExchangeReport.runExample | public static void runExample(AdManagerServices adManagerServices, AdManagerSession session)
throws IOException, InterruptedException {
// Get the ReportService.
ReportServiceInterface reportService =
adManagerServices.get(session, ReportServiceInterface.class);
// Create report query.
ReportQuery reportQuery = new ReportQuery();
reportQuery.setDimensions(
new Dimension[] {Dimension.AD_EXCHANGE_DATE, Dimension.AD_EXCHANGE_COUNTRY_NAME});
reportQuery.setColumns(
new Column[] {
Column.AD_EXCHANGE_AD_REQUESTS,
Column.AD_EXCHANGE_IMPRESSIONS,
Column.AD_EXCHANGE_ESTIMATED_REVENUE
});
// Run in pacific time.
reportQuery.setTimeZoneType(TimeZoneType.AD_EXCHANGE);
reportQuery.setAdxReportCurrency("EUR");
// Set the dynamic date range type or a custom start and end date.
reportQuery.setDateRangeType(DateRangeType.YESTERDAY);
// Create report job.
ReportJob reportJob = new ReportJob();
reportJob.setReportQuery(reportQuery);
// Run report job.
reportJob = reportService.runReportJob(reportJob);
// Create report downloader.
ReportDownloader reportDownloader = new ReportDownloader(reportService, reportJob.getId());
// Wait for the report to be ready.
reportDownloader.waitForReportReady();
// Change to your file location.
File file = File.createTempFile("adexchange-report-", ".csv.gz");
System.out.printf("Downloading report to %s ...", file.toString());
// Download the report.
ReportDownloadOptions options = new ReportDownloadOptions();
options.setExportFormat(ExportFormat.CSV_DUMP);
options.setUseGzipCompression(true);
URL url = reportDownloader.getDownloadUrl(options);
Resources.asByteSource(url).copyTo(Files.asByteSink(file));
System.out.println("done.");
} | java | public static void runExample(AdManagerServices adManagerServices, AdManagerSession session)
throws IOException, InterruptedException {
// Get the ReportService.
ReportServiceInterface reportService =
adManagerServices.get(session, ReportServiceInterface.class);
// Create report query.
ReportQuery reportQuery = new ReportQuery();
reportQuery.setDimensions(
new Dimension[] {Dimension.AD_EXCHANGE_DATE, Dimension.AD_EXCHANGE_COUNTRY_NAME});
reportQuery.setColumns(
new Column[] {
Column.AD_EXCHANGE_AD_REQUESTS,
Column.AD_EXCHANGE_IMPRESSIONS,
Column.AD_EXCHANGE_ESTIMATED_REVENUE
});
// Run in pacific time.
reportQuery.setTimeZoneType(TimeZoneType.AD_EXCHANGE);
reportQuery.setAdxReportCurrency("EUR");
// Set the dynamic date range type or a custom start and end date.
reportQuery.setDateRangeType(DateRangeType.YESTERDAY);
// Create report job.
ReportJob reportJob = new ReportJob();
reportJob.setReportQuery(reportQuery);
// Run report job.
reportJob = reportService.runReportJob(reportJob);
// Create report downloader.
ReportDownloader reportDownloader = new ReportDownloader(reportService, reportJob.getId());
// Wait for the report to be ready.
reportDownloader.waitForReportReady();
// Change to your file location.
File file = File.createTempFile("adexchange-report-", ".csv.gz");
System.out.printf("Downloading report to %s ...", file.toString());
// Download the report.
ReportDownloadOptions options = new ReportDownloadOptions();
options.setExportFormat(ExportFormat.CSV_DUMP);
options.setUseGzipCompression(true);
URL url = reportDownloader.getDownloadUrl(options);
Resources.asByteSource(url).copyTo(Files.asByteSink(file));
System.out.println("done.");
} | [
"public",
"static",
"void",
"runExample",
"(",
"AdManagerServices",
"adManagerServices",
",",
"AdManagerSession",
"session",
")",
"throws",
"IOException",
",",
"InterruptedException",
"{",
"// Get the ReportService.",
"ReportServiceInterface",
"reportService",
"=",
"adManager... | Runs the example.
@param adManagerServices the services factory.
@param session the session.
@throws ApiException if the API request failed with one or more service errors.
@throws RemoteException if the API request failed due to other errors.
@throws IOException if the report's contents could not be written to a temp file.
@throws InterruptedException if the thread was interrupted while waiting for the report to be
ready. | [
"Runs",
"the",
"example",
"."
] | train | https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/examples/admanager_axis/src/main/java/admanager/axis/v201811/reportservice/RunAdExchangeReport.java#L65-L115 |
rometools/rome | rome/src/main/java/com/rometools/rome/io/impl/DCModuleGenerator.java | DCModuleGenerator.generateSimpleElement | protected final Element generateSimpleElement(final String name, final String value) {
final Element element = new Element(name, getDCNamespace());
element.addContent(value);
return element;
} | java | protected final Element generateSimpleElement(final String name, final String value) {
final Element element = new Element(name, getDCNamespace());
element.addContent(value);
return element;
} | [
"protected",
"final",
"Element",
"generateSimpleElement",
"(",
"final",
"String",
"name",
",",
"final",
"String",
"value",
")",
"{",
"final",
"Element",
"element",
"=",
"new",
"Element",
"(",
"name",
",",
"getDCNamespace",
"(",
")",
")",
";",
"element",
".",... | Utility method to generate a single element containing a string.
<p>
@param name the name of the elment to generate.
@param value the value of the text in the element.
@return the element generated. | [
"Utility",
"method",
"to",
"generate",
"a",
"single",
"element",
"containing",
"a",
"string",
".",
"<p",
">"
] | train | https://github.com/rometools/rome/blob/5fcf0b1a9a6cdedbe253a45ad9468c54a0f97010/rome/src/main/java/com/rometools/rome/io/impl/DCModuleGenerator.java#L229-L233 |
apache/incubator-gobblin | gobblin-data-management/src/main/java/org/apache/gobblin/data/management/conversion/hive/task/HiveTask.java | HiveTask.addJar | public static void addJar(State state, String jar) {
state.setProp(ADD_JARS, state.getProp(ADD_JARS, "") + "," + jar);
} | java | public static void addJar(State state, String jar) {
state.setProp(ADD_JARS, state.getProp(ADD_JARS, "") + "," + jar);
} | [
"public",
"static",
"void",
"addJar",
"(",
"State",
"state",
",",
"String",
"jar",
")",
"{",
"state",
".",
"setProp",
"(",
"ADD_JARS",
",",
"state",
".",
"getProp",
"(",
"ADD_JARS",
",",
"\"\"",
")",
"+",
"\",\"",
"+",
"jar",
")",
";",
"}"
] | Add the input jar to the Hive session before running the task. | [
"Add",
"the",
"input",
"jar",
"to",
"the",
"Hive",
"session",
"before",
"running",
"the",
"task",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-data-management/src/main/java/org/apache/gobblin/data/management/conversion/hive/task/HiveTask.java#L80-L82 |
rundeck/rundeck | core/src/main/java/com/dtolabs/rundeck/core/resources/format/ResourceFormatGeneratorService.java | ResourceFormatGeneratorService.getGeneratorForFormat | public ResourceFormatGenerator getGeneratorForFormat(final String format) throws UnsupportedFormatException {
try {
return providerOfType(format);
} catch (ExecutionServiceException e) {
throw new UnsupportedFormatException("No provider available to parse format: " + format, e);
}
} | java | public ResourceFormatGenerator getGeneratorForFormat(final String format) throws UnsupportedFormatException {
try {
return providerOfType(format);
} catch (ExecutionServiceException e) {
throw new UnsupportedFormatException("No provider available to parse format: " + format, e);
}
} | [
"public",
"ResourceFormatGenerator",
"getGeneratorForFormat",
"(",
"final",
"String",
"format",
")",
"throws",
"UnsupportedFormatException",
"{",
"try",
"{",
"return",
"providerOfType",
"(",
"format",
")",
";",
"}",
"catch",
"(",
"ExecutionServiceException",
"e",
")",... | Return a parser for the exact format name
@param format the format name
@return the parser found for the format
@throws com.dtolabs.rundeck.core.resources.format.UnsupportedFormatException
if no provider for the format exists | [
"Return",
"a",
"parser",
"for",
"the",
"exact",
"format",
"name"
] | train | https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/resources/format/ResourceFormatGeneratorService.java#L128-L134 |
spotify/async-google-pubsub-client | src/main/java/com/spotify/google/cloud/pubsub/client/Pubsub.java | Pubsub.deleteTopic | public PubsubFuture<Void> deleteTopic(final String canonicalTopic) {
validateCanonicalTopic(canonicalTopic);
return delete("delete topic", canonicalTopic, VOID);
} | java | public PubsubFuture<Void> deleteTopic(final String canonicalTopic) {
validateCanonicalTopic(canonicalTopic);
return delete("delete topic", canonicalTopic, VOID);
} | [
"public",
"PubsubFuture",
"<",
"Void",
">",
"deleteTopic",
"(",
"final",
"String",
"canonicalTopic",
")",
"{",
"validateCanonicalTopic",
"(",
"canonicalTopic",
")",
";",
"return",
"delete",
"(",
"\"delete topic\"",
",",
"canonicalTopic",
",",
"VOID",
")",
";",
"... | Delete a Pub/Sub topic.
@param canonicalTopic The canonical (including project) name of the topic to delete.
@return A future that is completed when this request is completed. The future will be completed with {@code null}
if the response is 404. | [
"Delete",
"a",
"Pub",
"/",
"Sub",
"topic",
"."
] | train | https://github.com/spotify/async-google-pubsub-client/blob/7d021528fa5bc29be458e6f210fa62f59b71d004/src/main/java/com/spotify/google/cloud/pubsub/client/Pubsub.java#L342-L345 |
hyperledger/fabric-sdk-java | src/main/java/org/hyperledger/fabric/sdk/Channel.java | Channel.queryBlockchainInfo | public BlockchainInfo queryBlockchainInfo(Peer peer, User userContext) throws ProposalException, InvalidArgumentException {
return queryBlockchainInfo(Collections.singleton(peer), userContext);
} | java | public BlockchainInfo queryBlockchainInfo(Peer peer, User userContext) throws ProposalException, InvalidArgumentException {
return queryBlockchainInfo(Collections.singleton(peer), userContext);
} | [
"public",
"BlockchainInfo",
"queryBlockchainInfo",
"(",
"Peer",
"peer",
",",
"User",
"userContext",
")",
"throws",
"ProposalException",
",",
"InvalidArgumentException",
"{",
"return",
"queryBlockchainInfo",
"(",
"Collections",
".",
"singleton",
"(",
"peer",
")",
",",
... | query for chain information
@param peer The peer to send the request to
@param userContext the user context to use.
@return a {@link BlockchainInfo} object containing the chain info requested
@throws InvalidArgumentException
@throws ProposalException | [
"query",
"for",
"chain",
"information"
] | train | https://github.com/hyperledger/fabric-sdk-java/blob/4a2d7b3408b8b0a1ed812aa36942c438159c37a0/src/main/java/org/hyperledger/fabric/sdk/Channel.java#L3115-L3119 |
groovy/groovy-core | src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java | StringGroovyMethods.eachMatch | public static <T extends CharSequence> T eachMatch(T self, Pattern pattern, @ClosureParams(value=FromString.class, options={"List<String>","String[]"}) Closure closure) {
eachMatch(self.toString(), pattern, closure);
return self;
} | java | public static <T extends CharSequence> T eachMatch(T self, Pattern pattern, @ClosureParams(value=FromString.class, options={"List<String>","String[]"}) Closure closure) {
eachMatch(self.toString(), pattern, closure);
return self;
} | [
"public",
"static",
"<",
"T",
"extends",
"CharSequence",
">",
"T",
"eachMatch",
"(",
"T",
"self",
",",
"Pattern",
"pattern",
",",
"@",
"ClosureParams",
"(",
"value",
"=",
"FromString",
".",
"class",
",",
"options",
"=",
"{",
"\"List<String>\"",
",",
"\"Str... | Process each regex group matched substring of the given pattern. If the closure
parameter takes one argument, an array with all match groups is passed to it.
If the closure takes as many arguments as there are match groups, then each
parameter will be one match group.
@param self the source CharSequence
@param pattern a regex Pattern
@param closure a closure with one parameter or as much parameters as groups
@return the source CharSequence
@see #eachMatch(String, java.util.regex.Pattern, groovy.lang.Closure)
@since 1.8.2 | [
"Process",
"each",
"regex",
"group",
"matched",
"substring",
"of",
"the",
"given",
"pattern",
".",
"If",
"the",
"closure",
"parameter",
"takes",
"one",
"argument",
"an",
"array",
"with",
"all",
"match",
"groups",
"is",
"passed",
"to",
"it",
".",
"If",
"the... | train | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java#L710-L713 |
cdk/cdk | base/standard/src/main/java/org/openscience/cdk/tools/manipulator/ChemModelManipulator.java | ChemModelManipulator.getRelevantReaction | public static IReaction getRelevantReaction(IChemModel chemModel, IAtom atom) {
IReaction reaction = null;
if (chemModel.getReactionSet() != null) {
IReactionSet reactionSet = chemModel.getReactionSet();
reaction = ReactionSetManipulator.getRelevantReaction(reactionSet, atom);
}
return reaction;
} | java | public static IReaction getRelevantReaction(IChemModel chemModel, IAtom atom) {
IReaction reaction = null;
if (chemModel.getReactionSet() != null) {
IReactionSet reactionSet = chemModel.getReactionSet();
reaction = ReactionSetManipulator.getRelevantReaction(reactionSet, atom);
}
return reaction;
} | [
"public",
"static",
"IReaction",
"getRelevantReaction",
"(",
"IChemModel",
"chemModel",
",",
"IAtom",
"atom",
")",
"{",
"IReaction",
"reaction",
"=",
"null",
";",
"if",
"(",
"chemModel",
".",
"getReactionSet",
"(",
")",
"!=",
"null",
")",
"{",
"IReactionSet",
... | Retrieves the first IReaction containing a given IAtom from an
IChemModel.
@param chemModel The IChemModel object.
@param atom The IAtom object to search.
@return The IAtomContainer object found, null if none is found. | [
"Retrieves",
"the",
"first",
"IReaction",
"containing",
"a",
"given",
"IAtom",
"from",
"an",
"IChemModel",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/standard/src/main/java/org/openscience/cdk/tools/manipulator/ChemModelManipulator.java#L255-L262 |
qspin/qtaste | kernel/src/main/java/com/qspin/qtaste/addon/AddOn.java | AddOn.setAddOnLoaded | protected void setAddOnLoaded(boolean isLoaded) {
String oldState = mMetaData.getStatus();
mMetaData.setStatus(AddOnMetadata.LOAD);
firePropertyChangedEvent(new PropertyChangeEvent(this, PROPERTY_LOAD_STATE, oldState, mMetaData.getStatus()));
} | java | protected void setAddOnLoaded(boolean isLoaded) {
String oldState = mMetaData.getStatus();
mMetaData.setStatus(AddOnMetadata.LOAD);
firePropertyChangedEvent(new PropertyChangeEvent(this, PROPERTY_LOAD_STATE, oldState, mMetaData.getStatus()));
} | [
"protected",
"void",
"setAddOnLoaded",
"(",
"boolean",
"isLoaded",
")",
"{",
"String",
"oldState",
"=",
"mMetaData",
".",
"getStatus",
"(",
")",
";",
"mMetaData",
".",
"setStatus",
"(",
"AddOnMetadata",
".",
"LOAD",
")",
";",
"firePropertyChangedEvent",
"(",
"... | Changes the add-on loading state. Fires a property change event ({@link #PROPERTY_LOAD_STATE}).
@param isLoaded The new add-on loading state. | [
"Changes",
"the",
"add",
"-",
"on",
"loading",
"state",
".",
"Fires",
"a",
"property",
"change",
"event",
"(",
"{",
"@link",
"#PROPERTY_LOAD_STATE",
"}",
")",
"."
] | train | https://github.com/qspin/qtaste/blob/ba45d4d86eb29b92f157c6e98536dee2002ddfdc/kernel/src/main/java/com/qspin/qtaste/addon/AddOn.java#L96-L100 |
cesarferreira/AndroidQuickUtils | library/src/main/java/quickutils/core/categories/system.java | system.navigateToActivity | public static void navigateToActivity(Context A, Class<?> B) {
Intent myIntent = new Intent(A, B);
A.startActivity(myIntent);
} | java | public static void navigateToActivity(Context A, Class<?> B) {
Intent myIntent = new Intent(A, B);
A.startActivity(myIntent);
} | [
"public",
"static",
"void",
"navigateToActivity",
"(",
"Context",
"A",
",",
"Class",
"<",
"?",
">",
"B",
")",
"{",
"Intent",
"myIntent",
"=",
"new",
"Intent",
"(",
"A",
",",
"B",
")",
";",
"A",
".",
"startActivity",
"(",
"myIntent",
")",
";",
"}"
] | Navigate to an activity.<br>
e.g. navigateToActivity(context, SecondActivity.class)
@param A From Activity
@param B Destination Activity | [
"Navigate",
"to",
"an",
"activity",
".",
"<br",
">",
"e",
".",
"g",
".",
"navigateToActivity",
"(",
"context",
"SecondActivity",
".",
"class",
")"
] | train | https://github.com/cesarferreira/AndroidQuickUtils/blob/73a91daedbb9f7be7986ea786fbc441c9e5a881c/library/src/main/java/quickutils/core/categories/system.java#L122-L125 |
google/error-prone-javac | src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/Main.java | Main.call | public static boolean call(PrintStream out, PrintStream err, String... args) {
return new Main(out, err).run(args);
} | java | public static boolean call(PrintStream out, PrintStream err, String... args) {
return new Main(out, err).run(args);
} | [
"public",
"static",
"boolean",
"call",
"(",
"PrintStream",
"out",
",",
"PrintStream",
"err",
",",
"String",
"...",
"args",
")",
"{",
"return",
"new",
"Main",
"(",
"out",
",",
"err",
")",
".",
"run",
"(",
"args",
")",
";",
"}"
] | Programmatic main entry point: initializes the tool instance to
use stdout and stderr; runs the tool, passing command-line args;
returns an exit status.
@return true on success, false otherwise | [
"Programmatic",
"main",
"entry",
"point",
":",
"initializes",
"the",
"tool",
"instance",
"to",
"use",
"stdout",
"and",
"stderr",
";",
"runs",
"the",
"tool",
"passing",
"command",
"-",
"line",
"args",
";",
"returns",
"an",
"exit",
"status",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/Main.java#L691-L693 |
tempodb/tempodb-java | src/main/java/com/tempodb/Client.java | Client.getSeries | public Cursor<Series> getSeries(Filter filter) {
URI uri = null;
try {
URIBuilder builder = new URIBuilder(String.format("/%s/series/", API_VERSION));
addFilterToURI(builder, filter);
uri = builder.build();
} catch (URISyntaxException e) {
String message = String.format("Could not build URI with input - filter: %s", filter);
throw new IllegalArgumentException(message, e);
}
Cursor<Series> cursor = new SeriesCursor(uri, this);
return cursor;
} | java | public Cursor<Series> getSeries(Filter filter) {
URI uri = null;
try {
URIBuilder builder = new URIBuilder(String.format("/%s/series/", API_VERSION));
addFilterToURI(builder, filter);
uri = builder.build();
} catch (URISyntaxException e) {
String message = String.format("Could not build URI with input - filter: %s", filter);
throw new IllegalArgumentException(message, e);
}
Cursor<Series> cursor = new SeriesCursor(uri, this);
return cursor;
} | [
"public",
"Cursor",
"<",
"Series",
">",
"getSeries",
"(",
"Filter",
"filter",
")",
"{",
"URI",
"uri",
"=",
"null",
";",
"try",
"{",
"URIBuilder",
"builder",
"=",
"new",
"URIBuilder",
"(",
"String",
".",
"format",
"(",
"\"/%s/series/\"",
",",
"API_VERSION",... | Returns a cursor of series specified by a filter.
@param filter The series filter
@return A Cursor of Series. The cursor.iterator().next() may throw a {@link TempoDBException} if an error occurs while making a request.
@see Cursor
@see Filter
@since 1.0.0 | [
"Returns",
"a",
"cursor",
"of",
"series",
"specified",
"by",
"a",
"filter",
"."
] | train | https://github.com/tempodb/tempodb-java/blob/5733f204fe4c8dda48916ba1f67cf44f5a3f9c69/src/main/java/com/tempodb/Client.java#L372-L385 |
khuxtable/seaglass | src/main/java/com/seaglasslookandfeel/painter/TitlePaneMaximizeButtonPainter.java | TitlePaneMaximizeButtonPainter.paintMaximizeEnabled | private void paintMaximizeEnabled(Graphics2D g, JComponent c, int width, int height) {
maximizePainter.paintEnabled(g, c, width, height);
} | java | private void paintMaximizeEnabled(Graphics2D g, JComponent c, int width, int height) {
maximizePainter.paintEnabled(g, c, width, height);
} | [
"private",
"void",
"paintMaximizeEnabled",
"(",
"Graphics2D",
"g",
",",
"JComponent",
"c",
",",
"int",
"width",
",",
"int",
"height",
")",
"{",
"maximizePainter",
".",
"paintEnabled",
"(",
"g",
",",
"c",
",",
"width",
",",
"height",
")",
";",
"}"
] | Paint the foreground maximized button enabled state.
@param g the Graphics2D context to paint with.
@param c the component.
@param width the width of the component.
@param height the height of the component. | [
"Paint",
"the",
"foreground",
"maximized",
"button",
"enabled",
"state",
"."
] | train | https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/TitlePaneMaximizeButtonPainter.java#L173-L175 |
dadoonet/spring-elasticsearch | src/main/java/fr/pilato/spring/elasticsearch/type/TypeElasticsearchUpdater.java | TypeElasticsearchUpdater.isMappingExist | private static boolean isMappingExist(RestHighLevelClient client, String index) throws Exception {
GetMappingsResponse mapping = client.indices().getMapping(new GetMappingsRequest().indices(index), RequestOptions.DEFAULT);
// Let's get the default mapping
if (mapping.mappings().isEmpty()) {
return false;
}
MappingMetaData doc = mapping.mappings().values().iterator().next();
return !doc.getSourceAsMap().isEmpty();
} | java | private static boolean isMappingExist(RestHighLevelClient client, String index) throws Exception {
GetMappingsResponse mapping = client.indices().getMapping(new GetMappingsRequest().indices(index), RequestOptions.DEFAULT);
// Let's get the default mapping
if (mapping.mappings().isEmpty()) {
return false;
}
MappingMetaData doc = mapping.mappings().values().iterator().next();
return !doc.getSourceAsMap().isEmpty();
} | [
"private",
"static",
"boolean",
"isMappingExist",
"(",
"RestHighLevelClient",
"client",
",",
"String",
"index",
")",
"throws",
"Exception",
"{",
"GetMappingsResponse",
"mapping",
"=",
"client",
".",
"indices",
"(",
")",
".",
"getMapping",
"(",
"new",
"GetMappingsR... | Check if an index already exist
@param client Elasticsearch client
@param index Index name
@return true if the index already exist
@throws Exception if the elasticsearch call is failing | [
"Check",
"if",
"an",
"index",
"already",
"exist"
] | train | https://github.com/dadoonet/spring-elasticsearch/blob/b338223818a5bdf5d9c06c88cb98589c843fd293/src/main/java/fr/pilato/spring/elasticsearch/type/TypeElasticsearchUpdater.java#L92-L100 |
citiususc/hipster | hipster-core/src/main/java/es/usc/citius/hipster/util/examples/maze/Maze2D.java | Maze2D.updateRectangle | public void updateRectangle(Point a, Point b, Symbol symbol) {
int xfrom = (a.x < b.x) ? a.x : b.x;
int xto = (a.x > b.x) ? a.x : b.x;
int yfrom = (a.y < b.y) ? a.y : b.y;
int yto = (a.y > b.y) ? a.y : b.y;
for (int x = xfrom; x <= xto; x++) {
for (int y = yfrom; y <= yto; y++) {
updateLocation(new Point(x, y), symbol);
}
}
} | java | public void updateRectangle(Point a, Point b, Symbol symbol) {
int xfrom = (a.x < b.x) ? a.x : b.x;
int xto = (a.x > b.x) ? a.x : b.x;
int yfrom = (a.y < b.y) ? a.y : b.y;
int yto = (a.y > b.y) ? a.y : b.y;
for (int x = xfrom; x <= xto; x++) {
for (int y = yfrom; y <= yto; y++) {
updateLocation(new Point(x, y), symbol);
}
}
} | [
"public",
"void",
"updateRectangle",
"(",
"Point",
"a",
",",
"Point",
"b",
",",
"Symbol",
"symbol",
")",
"{",
"int",
"xfrom",
"=",
"(",
"a",
".",
"x",
"<",
"b",
".",
"x",
")",
"?",
"a",
".",
"x",
":",
"b",
".",
"x",
";",
"int",
"xto",
"=",
... | Replace all tiles inside the rectangle with the provided symbol.
@param a point a of the rectangle.
@param b point b of the rectangle.
@param symbol symbol to be inserted in each tile. | [
"Replace",
"all",
"tiles",
"inside",
"the",
"rectangle",
"with",
"the",
"provided",
"symbol",
"."
] | train | https://github.com/citiususc/hipster/blob/9ab1236abb833a27641ae73ba9ca890d5c17598e/hipster-core/src/main/java/es/usc/citius/hipster/util/examples/maze/Maze2D.java#L263-L273 |
Nordstrom/JUnit-Foundation | src/main/java/com/nordstrom/automation/junit/Run.java | Run.attachRunListeners | static void attachRunListeners(Object runner, final RunNotifier notifier) throws Exception {
if (NOTIFIERS.add(notifier)) {
Description description = LifecycleHooks.invoke(runner, "getDescription");
synchronized(runListenerLoader) {
for (RunListener listener : runListenerLoader) {
notifier.addListener(listener);
listener.testRunStarted(description);
}
}
}
} | java | static void attachRunListeners(Object runner, final RunNotifier notifier) throws Exception {
if (NOTIFIERS.add(notifier)) {
Description description = LifecycleHooks.invoke(runner, "getDescription");
synchronized(runListenerLoader) {
for (RunListener listener : runListenerLoader) {
notifier.addListener(listener);
listener.testRunStarted(description);
}
}
}
} | [
"static",
"void",
"attachRunListeners",
"(",
"Object",
"runner",
",",
"final",
"RunNotifier",
"notifier",
")",
"throws",
"Exception",
"{",
"if",
"(",
"NOTIFIERS",
".",
"add",
"(",
"notifier",
")",
")",
"{",
"Description",
"description",
"=",
"LifecycleHooks",
... | Attach registered run listeners to the specified run notifier.
<p>
<b>NOTE</b>: If the specified run notifier has already been seen, do nothing.
@param runner JUnit test runner
@param notifier JUnit {@link RunNotifier} object
@throws Exception if {@code run-started} notification | [
"Attach",
"registered",
"run",
"listeners",
"to",
"the",
"specified",
"run",
"notifier",
".",
"<p",
">",
"<b",
">",
"NOTE<",
"/",
"b",
">",
":",
"If",
"the",
"specified",
"run",
"notifier",
"has",
"already",
"been",
"seen",
"do",
"nothing",
"."
] | train | https://github.com/Nordstrom/JUnit-Foundation/blob/f24d91f8677d262c27d18ef29ed633eaac717be5/src/main/java/com/nordstrom/automation/junit/Run.java#L92-L102 |
sporniket/core | sporniket-core-ml/src/main/java/com/sporniket/libre/lang/xml/XmlStringTools.java | XmlStringTools.getComment | public static String getComment(String comment)
{
StringBuffer _result = new StringBuffer();
return doAppendComment(_result, comment).toString();
} | java | public static String getComment(String comment)
{
StringBuffer _result = new StringBuffer();
return doAppendComment(_result, comment).toString();
} | [
"public",
"static",
"String",
"getComment",
"(",
"String",
"comment",
")",
"{",
"StringBuffer",
"_result",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"return",
"doAppendComment",
"(",
"_result",
",",
"comment",
")",
".",
"toString",
"(",
")",
";",
"}"
] | Create a string containing a comment.
@param comment
the comment to generate.
@return the closing tag. | [
"Create",
"a",
"string",
"containing",
"a",
"comment",
"."
] | train | https://github.com/sporniket/core/blob/3480ebd72a07422fcc09971be2607ee25efb2c26/sporniket-core-ml/src/main/java/com/sporniket/libre/lang/xml/XmlStringTools.java#L566-L570 |
lastaflute/lastaflute | src/main/java/org/lastaflute/web/LastaAction.java | LastaAction.toActionUrl | protected String toActionUrl(Class<?> actionType, UrlChain chain) {
assertArgumentNotNull("actionType", actionType);
assertArgumentNotNull("chain", chain);
return actionPathResolver.toActionUrl(actionType, chain);
} | java | protected String toActionUrl(Class<?> actionType, UrlChain chain) {
assertArgumentNotNull("actionType", actionType);
assertArgumentNotNull("chain", chain);
return actionPathResolver.toActionUrl(actionType, chain);
} | [
"protected",
"String",
"toActionUrl",
"(",
"Class",
"<",
"?",
">",
"actionType",
",",
"UrlChain",
"chain",
")",
"{",
"assertArgumentNotNull",
"(",
"\"actionType\"",
",",
"actionType",
")",
";",
"assertArgumentNotNull",
"(",
"\"chain\"",
",",
"chain",
")",
";",
... | Convert to URL string to move the action.
<pre>
<span style="color: #3F7E5E">// /product/list/3</span>
String url = toActionUrl(ProductListAction.<span style="color: #70226C">class</span>, moreUrl(3));
</pre>
@param actionType The class type of action that it redirects to. (NotNull)
@param chain The chain of URL to build additional info on URL. (NotNull)
@return The URL string to move to the action. (NotNull) | [
"Convert",
"to",
"URL",
"string",
"to",
"move",
"the",
"action",
".",
"<pre",
">",
"<span",
"style",
"=",
"color",
":",
"#3F7E5E",
">",
"//",
"/",
"product",
"/",
"list",
"/",
"3<",
"/",
"span",
">",
"String",
"url",
"=",
"toActionUrl",
"(",
"Product... | train | https://github.com/lastaflute/lastaflute/blob/17b56dda8322e4c6d79043532c1dda917d6b60a8/src/main/java/org/lastaflute/web/LastaAction.java#L553-L557 |
algolia/algoliasearch-client-java | src/main/java/com/algolia/search/saas/Index.java | Index.getRule | public JSONObject getRule(String objectID, RequestOptions requestOptions) throws AlgoliaException {
if (objectID == null || objectID.length() == 0) {
throw new AlgoliaException("Invalid objectID");
}
try {
return client.getRequest("/1/indexes/" + encodedIndexName + "/rules/" + URLEncoder.encode(objectID, "UTF-8"), true, requestOptions);
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
} | java | public JSONObject getRule(String objectID, RequestOptions requestOptions) throws AlgoliaException {
if (objectID == null || objectID.length() == 0) {
throw new AlgoliaException("Invalid objectID");
}
try {
return client.getRequest("/1/indexes/" + encodedIndexName + "/rules/" + URLEncoder.encode(objectID, "UTF-8"), true, requestOptions);
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
} | [
"public",
"JSONObject",
"getRule",
"(",
"String",
"objectID",
",",
"RequestOptions",
"requestOptions",
")",
"throws",
"AlgoliaException",
"{",
"if",
"(",
"objectID",
"==",
"null",
"||",
"objectID",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"throw",
"new"... | Get a query rule
@param objectID the objectID of the query rule to get
@param requestOptions Options to pass to this request | [
"Get",
"a",
"query",
"rule"
] | train | https://github.com/algolia/algoliasearch-client-java/blob/a05da2f66c099fe6f77295c7b6a8a12c24e95f9b/src/main/java/com/algolia/search/saas/Index.java#L1779-L1788 |
OpenLiberty/open-liberty | dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/persistent/htod/HashtableOnDisk.java | HashtableOnDisk.iterateObjects | public int iterateObjects(HashtableAction action, int index, int length)
throws IOException,
EOFException,
FileManagerException,
ClassNotFoundException,
HashtableOnDiskException {
return walkHash(action, RETRIEVE_ALL, index, length);
} | java | public int iterateObjects(HashtableAction action, int index, int length)
throws IOException,
EOFException,
FileManagerException,
ClassNotFoundException,
HashtableOnDiskException {
return walkHash(action, RETRIEVE_ALL, index, length);
} | [
"public",
"int",
"iterateObjects",
"(",
"HashtableAction",
"action",
",",
"int",
"index",
",",
"int",
"length",
")",
"throws",
"IOException",
",",
"EOFException",
",",
"FileManagerException",
",",
"ClassNotFoundException",
",",
"HashtableOnDiskException",
"{",
"return... | ************************************************************************
This invokes the action's "execute" method once for every
object, passing both the key and the object to the interface.
The iteration is synchronized with concurrent get and put operations
to avoid locking the HTOD for long periods of time. Some objects which
are added during iteration may not be seen by the iteration.
@param action The object to be "invoked" for each object.
*********************************************************************** | [
"************************************************************************",
"This",
"invokes",
"the",
"action",
"s",
"execute",
"method",
"once",
"for",
"every",
"object",
"passing",
"both",
"the",
"key",
"and",
"the",
"object",
"to",
"the",
"interface",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/persistent/htod/HashtableOnDisk.java#L1319-L1326 |
waldheinz/fat32-lib | src/main/java/de/waldheinz/fs/fat/ClusterChain.java | ClusterChain.writeData | public void writeData(long offset, ByteBuffer srcBuf) throws IOException {
int len = srcBuf.remaining();
if (len == 0) return;
final long minSize = offset + len;
if (getLengthOnDisk() < minSize) {
setSize(minSize);
}
final long[] chain = fat.getChain(getStartCluster());
int chainIdx = (int) (offset / clusterSize);
if (offset % clusterSize != 0) {
int clusOfs = (int) (offset % clusterSize);
int size = Math.min(len,
(int) (clusterSize - (offset % clusterSize)));
srcBuf.limit(srcBuf.position() + size);
device.write(getDevOffset(chain[chainIdx], clusOfs), srcBuf);
len -= size;
chainIdx++;
}
while (len > 0) {
int size = Math.min(clusterSize, len);
srcBuf.limit(srcBuf.position() + size);
device.write(getDevOffset(chain[chainIdx], 0), srcBuf);
len -= size;
chainIdx++;
}
} | java | public void writeData(long offset, ByteBuffer srcBuf) throws IOException {
int len = srcBuf.remaining();
if (len == 0) return;
final long minSize = offset + len;
if (getLengthOnDisk() < minSize) {
setSize(minSize);
}
final long[] chain = fat.getChain(getStartCluster());
int chainIdx = (int) (offset / clusterSize);
if (offset % clusterSize != 0) {
int clusOfs = (int) (offset % clusterSize);
int size = Math.min(len,
(int) (clusterSize - (offset % clusterSize)));
srcBuf.limit(srcBuf.position() + size);
device.write(getDevOffset(chain[chainIdx], clusOfs), srcBuf);
len -= size;
chainIdx++;
}
while (len > 0) {
int size = Math.min(clusterSize, len);
srcBuf.limit(srcBuf.position() + size);
device.write(getDevOffset(chain[chainIdx], 0), srcBuf);
len -= size;
chainIdx++;
}
} | [
"public",
"void",
"writeData",
"(",
"long",
"offset",
",",
"ByteBuffer",
"srcBuf",
")",
"throws",
"IOException",
"{",
"int",
"len",
"=",
"srcBuf",
".",
"remaining",
"(",
")",
";",
"if",
"(",
"len",
"==",
"0",
")",
"return",
";",
"final",
"long",
"minSi... | Writes data to this cluster chain, possibly growing the chain so it
can store the additional data. When this method returns without throwing
an exception, the buffer's {@link ByteBuffer#position() position} will
equal it's {@link ByteBuffer#limit() limit}, and the limit will not
have changed. This is not guaranteed if writing fails.
@param offset the offset where to write the first byte from the buffer
@param srcBuf the buffer to write to this {@code ClusterChain}
@throws IOException on write error | [
"Writes",
"data",
"to",
"this",
"cluster",
"chain",
"possibly",
"growing",
"the",
"chain",
"so",
"it",
"can",
"store",
"the",
"additional",
"data",
".",
"When",
"this",
"method",
"returns",
"without",
"throwing",
"an",
"exception",
"the",
"buffer",
"s",
"{",... | train | https://github.com/waldheinz/fat32-lib/blob/3d8f1a986339573576e02eb0b6ea49bfdc9cce26/src/main/java/de/waldheinz/fs/fat/ClusterChain.java#L246-L283 |
lessthanoptimal/BoofCV | main/boofcv-calibration/src/main/java/boofcv/alg/geo/selfcalib/SelfCalibrationGuessAndCheckFocus.java | SelfCalibrationGuessAndCheckFocus.setCamera | public void setCamera( double skew , double cx , double cy , int width , int height ) {
// Define normalization matrix
// center points, remove skew, scale coordinates
double d = Math.sqrt(width*width + height*height);
V.zero();
V.set(0,0,d/2); V.set(0,1,skew); V.set(0,2,cx);
V.set(1,1,d/2); V.set(1,2,cy);
V.set(2,2,1);
CommonOps_DDRM.invert(V,Vinv);
} | java | public void setCamera( double skew , double cx , double cy , int width , int height ) {
// Define normalization matrix
// center points, remove skew, scale coordinates
double d = Math.sqrt(width*width + height*height);
V.zero();
V.set(0,0,d/2); V.set(0,1,skew); V.set(0,2,cx);
V.set(1,1,d/2); V.set(1,2,cy);
V.set(2,2,1);
CommonOps_DDRM.invert(V,Vinv);
} | [
"public",
"void",
"setCamera",
"(",
"double",
"skew",
",",
"double",
"cx",
",",
"double",
"cy",
",",
"int",
"width",
",",
"int",
"height",
")",
"{",
"// Define normalization matrix",
"// center points, remove skew, scale coordinates",
"double",
"d",
"=",
"Math",
"... | Specifies known portions of camera intrinsic parameters
@param skew skew
@param cx image center x
@param cy image center y
@param width Image width
@param height Image height | [
"Specifies",
"known",
"portions",
"of",
"camera",
"intrinsic",
"parameters"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-calibration/src/main/java/boofcv/alg/geo/selfcalib/SelfCalibrationGuessAndCheckFocus.java#L134-L145 |
fozziethebeat/S-Space | src/main/java/edu/ucla/sspace/matrix/AtomicGrowingSparseHashMatrix.java | AtomicGrowingSparseHashMatrix.getColumnVector | private SparseDoubleVector getColumnVector(int column, boolean shouldLock) {
int r = rows.get();
if (shouldLock)
lockColumn(column, r);
// Ensure that the column data is up to date
while (lastVectorCacheUpdate.get() != modifications.get())
updateVectorCache();
int[] rowArr = colToRowsCache[column];
SparseDoubleVector colVec = new SparseHashDoubleVector(r);
for (int row : rowArr)
colVec.set(row, matrixEntries.get(new Entry(row, column)));
if (shouldLock)
unlockColumn(column, r);
return colVec;
} | java | private SparseDoubleVector getColumnVector(int column, boolean shouldLock) {
int r = rows.get();
if (shouldLock)
lockColumn(column, r);
// Ensure that the column data is up to date
while (lastVectorCacheUpdate.get() != modifications.get())
updateVectorCache();
int[] rowArr = colToRowsCache[column];
SparseDoubleVector colVec = new SparseHashDoubleVector(r);
for (int row : rowArr)
colVec.set(row, matrixEntries.get(new Entry(row, column)));
if (shouldLock)
unlockColumn(column, r);
return colVec;
} | [
"private",
"SparseDoubleVector",
"getColumnVector",
"(",
"int",
"column",
",",
"boolean",
"shouldLock",
")",
"{",
"int",
"r",
"=",
"rows",
".",
"get",
"(",
")",
";",
"if",
"(",
"shouldLock",
")",
"lockColumn",
"(",
"column",
",",
"r",
")",
";",
"// Ensur... | Returns the column vector, locking the data if {@code shouldLock} is
{@code true}. | [
"Returns",
"the",
"column",
"vector",
"locking",
"the",
"data",
"if",
"{"
] | train | https://github.com/fozziethebeat/S-Space/blob/a608102737dfd3d59038a9ead33fe60356bc6029/src/main/java/edu/ucla/sspace/matrix/AtomicGrowingSparseHashMatrix.java#L283-L297 |
xcesco/kripton | kripton-core/src/main/java/com/abubusoft/kripton/common/PrimitiveUtils.java | PrimitiveUtils.readLong | public static Long readLong(String value, Long defaultValue) {
if (!StringUtils.hasText(value)) return defaultValue;
return Long.valueOf(value);
} | java | public static Long readLong(String value, Long defaultValue) {
if (!StringUtils.hasText(value)) return defaultValue;
return Long.valueOf(value);
} | [
"public",
"static",
"Long",
"readLong",
"(",
"String",
"value",
",",
"Long",
"defaultValue",
")",
"{",
"if",
"(",
"!",
"StringUtils",
".",
"hasText",
"(",
"value",
")",
")",
"return",
"defaultValue",
";",
"return",
"Long",
".",
"valueOf",
"(",
"value",
"... | Read long.
@param value the value
@param defaultValue the default value
@return the long | [
"Read",
"long",
"."
] | train | https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-core/src/main/java/com/abubusoft/kripton/common/PrimitiveUtils.java#L152-L156 |
googleads/googleads-java-lib | modules/ads_lib/src/main/java/com/google/api/ads/admanager/lib/utils/DateTimesHelper.java | DateTimesHelper.toDateTime | public T toDateTime(DateTime dateTime) {
try {
D dateObj = dateClass.newInstance();
PropertyUtils.setProperty(dateObj, "year", dateTime.getYear());
PropertyUtils.setProperty(dateObj, "month", dateTime.getMonthOfYear());
PropertyUtils.setProperty(dateObj, "day", dateTime.getDayOfMonth());
T dateTimeObj = dateTimeClass.newInstance();
PropertyUtils.setProperty(dateTimeObj, "date", dateObj);
PropertyUtils.setProperty(dateTimeObj, "hour", dateTime.getHourOfDay());
PropertyUtils.setProperty(dateTimeObj, "minute", dateTime.getMinuteOfHour());
PropertyUtils.setProperty(dateTimeObj, "second", dateTime.getSecondOfMinute());
// Starting in v201811, timeZoneID was renamed to timeZoneId
if (PropertyUtils.isWriteable(dateTimeObj, "timeZoneID")) {
PropertyUtils.setProperty(
dateTimeObj, "timeZoneID", dateTime.getZone().toTimeZone().getID());
} else {
PropertyUtils.setProperty(
dateTimeObj, "timeZoneId", dateTime.getZone().toTimeZone().getID());
}
return dateTimeObj;
} catch (InstantiationException e) {
throw new IllegalStateException("Could not instantiate class.", e);
} catch (IllegalAccessException e) {
throw new IllegalStateException("Could not instantiate class.", e);
} catch (InvocationTargetException e) {
throw new IllegalStateException("Could not set field.", e);
} catch (NoSuchMethodException e) {
throw new IllegalStateException("Could not set field.", e);
}
} | java | public T toDateTime(DateTime dateTime) {
try {
D dateObj = dateClass.newInstance();
PropertyUtils.setProperty(dateObj, "year", dateTime.getYear());
PropertyUtils.setProperty(dateObj, "month", dateTime.getMonthOfYear());
PropertyUtils.setProperty(dateObj, "day", dateTime.getDayOfMonth());
T dateTimeObj = dateTimeClass.newInstance();
PropertyUtils.setProperty(dateTimeObj, "date", dateObj);
PropertyUtils.setProperty(dateTimeObj, "hour", dateTime.getHourOfDay());
PropertyUtils.setProperty(dateTimeObj, "minute", dateTime.getMinuteOfHour());
PropertyUtils.setProperty(dateTimeObj, "second", dateTime.getSecondOfMinute());
// Starting in v201811, timeZoneID was renamed to timeZoneId
if (PropertyUtils.isWriteable(dateTimeObj, "timeZoneID")) {
PropertyUtils.setProperty(
dateTimeObj, "timeZoneID", dateTime.getZone().toTimeZone().getID());
} else {
PropertyUtils.setProperty(
dateTimeObj, "timeZoneId", dateTime.getZone().toTimeZone().getID());
}
return dateTimeObj;
} catch (InstantiationException e) {
throw new IllegalStateException("Could not instantiate class.", e);
} catch (IllegalAccessException e) {
throw new IllegalStateException("Could not instantiate class.", e);
} catch (InvocationTargetException e) {
throw new IllegalStateException("Could not set field.", e);
} catch (NoSuchMethodException e) {
throw new IllegalStateException("Could not set field.", e);
}
} | [
"public",
"T",
"toDateTime",
"(",
"DateTime",
"dateTime",
")",
"{",
"try",
"{",
"D",
"dateObj",
"=",
"dateClass",
".",
"newInstance",
"(",
")",
";",
"PropertyUtils",
".",
"setProperty",
"(",
"dateObj",
",",
"\"year\"",
",",
"dateTime",
".",
"getYear",
"(",... | Converts a {@code DateTime} object to an API date time preserving the
time zone. | [
"Converts",
"a",
"{"
] | train | https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/modules/ads_lib/src/main/java/com/google/api/ads/admanager/lib/utils/DateTimesHelper.java#L72-L103 |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/MariaDbConnection.java | MariaDbConnection.setNetworkTimeout | public void setNetworkTimeout(Executor executor, final int milliseconds) throws SQLException {
if (this.isClosed()) {
throw ExceptionMapper
.getSqlException("Connection.setNetworkTimeout cannot be called on a closed connection");
}
if (milliseconds < 0) {
throw ExceptionMapper
.getSqlException("Connection.setNetworkTimeout cannot be called with a negative timeout");
}
SQLPermission sqlPermission = new SQLPermission("setNetworkTimeout");
SecurityManager securityManager = System.getSecurityManager();
if (securityManager != null) {
securityManager.checkPermission(sqlPermission);
}
try {
stateFlag |= ConnectionState.STATE_NETWORK_TIMEOUT;
protocol.setTimeout(milliseconds);
} catch (SocketException se) {
throw ExceptionMapper.getSqlException("Cannot set the network timeout", se);
}
} | java | public void setNetworkTimeout(Executor executor, final int milliseconds) throws SQLException {
if (this.isClosed()) {
throw ExceptionMapper
.getSqlException("Connection.setNetworkTimeout cannot be called on a closed connection");
}
if (milliseconds < 0) {
throw ExceptionMapper
.getSqlException("Connection.setNetworkTimeout cannot be called with a negative timeout");
}
SQLPermission sqlPermission = new SQLPermission("setNetworkTimeout");
SecurityManager securityManager = System.getSecurityManager();
if (securityManager != null) {
securityManager.checkPermission(sqlPermission);
}
try {
stateFlag |= ConnectionState.STATE_NETWORK_TIMEOUT;
protocol.setTimeout(milliseconds);
} catch (SocketException se) {
throw ExceptionMapper.getSqlException("Cannot set the network timeout", se);
}
} | [
"public",
"void",
"setNetworkTimeout",
"(",
"Executor",
"executor",
",",
"final",
"int",
"milliseconds",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"this",
".",
"isClosed",
"(",
")",
")",
"{",
"throw",
"ExceptionMapper",
".",
"getSqlException",
"(",
"\"Con... | Change network timeout.
@param executor executor (can be null)
@param milliseconds network timeout in milliseconds.
@throws SQLException if security manager doesn't permit it. | [
"Change",
"network",
"timeout",
"."
] | train | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/MariaDbConnection.java#L1700-L1720 |
mangstadt/biweekly | src/main/java/biweekly/io/xml/XCalElement.java | XCalElement.append | public Element append(ICalDataType dataType, String value) {
String dataTypeStr = toLocalName(dataType);
return append(dataTypeStr, value);
} | java | public Element append(ICalDataType dataType, String value) {
String dataTypeStr = toLocalName(dataType);
return append(dataTypeStr, value);
} | [
"public",
"Element",
"append",
"(",
"ICalDataType",
"dataType",
",",
"String",
"value",
")",
"{",
"String",
"dataTypeStr",
"=",
"toLocalName",
"(",
"dataType",
")",
";",
"return",
"append",
"(",
"dataTypeStr",
",",
"value",
")",
";",
"}"
] | Adds a value.
@param dataType the data type or null for the "unknown" data type
@param value the value
@return the created element | [
"Adds",
"a",
"value",
"."
] | train | https://github.com/mangstadt/biweekly/blob/2e21350f85c13dfff52fdef98fdbebe2976fcf61/src/main/java/biweekly/io/xml/XCalElement.java#L115-L118 |
VoltDB/voltdb | src/frontend/org/voltdb/ElasticHashinator.java | ElasticHashinator.addTokens | public ElasticHashinator addTokens(NavigableMap<Integer, Integer> tokensToAdd)
{
// figure out the interval
long interval = deriveTokenInterval(m_tokensMap.get().keySet());
Map<Integer, Integer> tokens = Maps.newTreeMap();
for (Map.Entry<Integer, Integer> e : m_tokensMap.get().entrySet()) {
if (tokensToAdd.containsKey(e.getKey())) {
continue;
}
// see if we are moving an intermediate token forward
if (isIntermediateToken(e.getKey(), interval)) {
Map.Entry<Integer, Integer> floorEntry = tokensToAdd.floorEntry(e.getKey());
// If the two tokens belong to the same partition and bucket, we are moving the one on the ring
// forward, so remove it from the ring
if (floorEntry != null &&
floorEntry.getValue().equals(e.getValue()) &&
containingBucket(floorEntry.getKey(), interval) == containingBucket(e.getKey(), interval)) {
continue;
}
}
tokens.put(e.getKey(), e.getValue());
}
tokens.putAll(tokensToAdd);
return new ElasticHashinator(ImmutableSortedMap.copyOf(tokens));
} | java | public ElasticHashinator addTokens(NavigableMap<Integer, Integer> tokensToAdd)
{
// figure out the interval
long interval = deriveTokenInterval(m_tokensMap.get().keySet());
Map<Integer, Integer> tokens = Maps.newTreeMap();
for (Map.Entry<Integer, Integer> e : m_tokensMap.get().entrySet()) {
if (tokensToAdd.containsKey(e.getKey())) {
continue;
}
// see if we are moving an intermediate token forward
if (isIntermediateToken(e.getKey(), interval)) {
Map.Entry<Integer, Integer> floorEntry = tokensToAdd.floorEntry(e.getKey());
// If the two tokens belong to the same partition and bucket, we are moving the one on the ring
// forward, so remove it from the ring
if (floorEntry != null &&
floorEntry.getValue().equals(e.getValue()) &&
containingBucket(floorEntry.getKey(), interval) == containingBucket(e.getKey(), interval)) {
continue;
}
}
tokens.put(e.getKey(), e.getValue());
}
tokens.putAll(tokensToAdd);
return new ElasticHashinator(ImmutableSortedMap.copyOf(tokens));
} | [
"public",
"ElasticHashinator",
"addTokens",
"(",
"NavigableMap",
"<",
"Integer",
",",
"Integer",
">",
"tokensToAdd",
")",
"{",
"// figure out the interval",
"long",
"interval",
"=",
"deriveTokenInterval",
"(",
"m_tokensMap",
".",
"get",
"(",
")",
".",
"keySet",
"(... | Add the given tokens to the ring and generate the new hashinator. The current hashinator is not changed.
@param tokensToAdd Tokens to add as a map of tokens to partitions
@return The new hashinator | [
"Add",
"the",
"given",
"tokens",
"to",
"the",
"ring",
"and",
"generate",
"the",
"new",
"hashinator",
".",
"The",
"current",
"hashinator",
"is",
"not",
"changed",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/ElasticHashinator.java#L314-L342 |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/GVRRenderData.java | GVRRenderData.bindShader | public synchronized void bindShader(GVRScene scene, boolean isMultiview)
{
GVRRenderPass pass = mRenderPassList.get(0);
GVRShaderId shader = pass.getMaterial().getShaderType();
GVRShader template = shader.getTemplate(getGVRContext());
if (template != null)
{
template.bindShader(getGVRContext(), this, scene, isMultiview);
}
for (int i = 1; i < mRenderPassList.size(); ++i)
{
pass = mRenderPassList.get(i);
shader = pass.getMaterial().getShaderType();
template = shader.getTemplate(getGVRContext());
if (template != null)
{
template.bindShader(getGVRContext(), pass, scene, isMultiview);
}
}
} | java | public synchronized void bindShader(GVRScene scene, boolean isMultiview)
{
GVRRenderPass pass = mRenderPassList.get(0);
GVRShaderId shader = pass.getMaterial().getShaderType();
GVRShader template = shader.getTemplate(getGVRContext());
if (template != null)
{
template.bindShader(getGVRContext(), this, scene, isMultiview);
}
for (int i = 1; i < mRenderPassList.size(); ++i)
{
pass = mRenderPassList.get(i);
shader = pass.getMaterial().getShaderType();
template = shader.getTemplate(getGVRContext());
if (template != null)
{
template.bindShader(getGVRContext(), pass, scene, isMultiview);
}
}
} | [
"public",
"synchronized",
"void",
"bindShader",
"(",
"GVRScene",
"scene",
",",
"boolean",
"isMultiview",
")",
"{",
"GVRRenderPass",
"pass",
"=",
"mRenderPassList",
".",
"get",
"(",
"0",
")",
";",
"GVRShaderId",
"shader",
"=",
"pass",
".",
"getMaterial",
"(",
... | Selects a specific vertex and fragment shader to use for rendering.
If a shader template has been specified, it is used to generate
a vertex and fragment shader based on mesh attributes, bound textures
and light sources. If the textures bound to the material are changed
or a new light source is added, this function must be called again
to select the appropriate shaders. This function may cause recompilation
of shaders which is quite slow.
@param scene scene being rendered
@see GVRShaderTemplate GVRMaterialShader.getShaderType | [
"Selects",
"a",
"specific",
"vertex",
"and",
"fragment",
"shader",
"to",
"use",
"for",
"rendering",
"."
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRRenderData.java#L264-L283 |
Chorus-bdd/Chorus | interpreter/chorus-interpreter/src/main/java/org/chorusbdd/chorus/interpreter/interpreter/HandlerManager.java | HandlerManager.getMethodScope | private Scope getMethodScope(boolean isDestroy, Method method) {
Scope methodScope;
if ( isDestroy ) {
Destroy annotation = method.getAnnotation(Destroy.class);
methodScope = annotation != null ? annotation.scope() : null;
} else {
Initialize annotation = method.getAnnotation(Initialize.class);
methodScope = annotation != null ? annotation.scope() : null;
}
return methodScope;
} | java | private Scope getMethodScope(boolean isDestroy, Method method) {
Scope methodScope;
if ( isDestroy ) {
Destroy annotation = method.getAnnotation(Destroy.class);
methodScope = annotation != null ? annotation.scope() : null;
} else {
Initialize annotation = method.getAnnotation(Initialize.class);
methodScope = annotation != null ? annotation.scope() : null;
}
return methodScope;
} | [
"private",
"Scope",
"getMethodScope",
"(",
"boolean",
"isDestroy",
",",
"Method",
"method",
")",
"{",
"Scope",
"methodScope",
";",
"if",
"(",
"isDestroy",
")",
"{",
"Destroy",
"annotation",
"=",
"method",
".",
"getAnnotation",
"(",
"Destroy",
".",
"class",
"... | return the scope of a lifecycle method, or null if the method is not a lifecycle method | [
"return",
"the",
"scope",
"of",
"a",
"lifecycle",
"method",
"or",
"null",
"if",
"the",
"method",
"is",
"not",
"a",
"lifecycle",
"method"
] | train | https://github.com/Chorus-bdd/Chorus/blob/1eea7ca858876bce821bb49b43fd5b6ba1737997/interpreter/chorus-interpreter/src/main/java/org/chorusbdd/chorus/interpreter/interpreter/HandlerManager.java#L190-L200 |
jbundle/jbundle | thin/base/screen/util-misc/src/main/java/org/jbundle/thin/base/screen/util/html/JHtmlView.java | JHtmlView.getURLFromPath | public static URL getURLFromPath(String path, BaseApplet applet)
{
URL url = null;
try {
if ((url == null) && (path != null))
url = new URL(path);
} catch (MalformedURLException ex) {
Application app = null;
if (applet == null)
applet = (BaseApplet)BaseApplet.getSharedInstance().getApplet();
if (applet != null)
app = applet.getApplication();
if ((app != null) && (url == null) && (path != null))
url = app.getResourceURL(path, applet);
else
ex.printStackTrace();
}
return url;
} | java | public static URL getURLFromPath(String path, BaseApplet applet)
{
URL url = null;
try {
if ((url == null) && (path != null))
url = new URL(path);
} catch (MalformedURLException ex) {
Application app = null;
if (applet == null)
applet = (BaseApplet)BaseApplet.getSharedInstance().getApplet();
if (applet != null)
app = applet.getApplication();
if ((app != null) && (url == null) && (path != null))
url = app.getResourceURL(path, applet);
else
ex.printStackTrace();
}
return url;
} | [
"public",
"static",
"URL",
"getURLFromPath",
"(",
"String",
"path",
",",
"BaseApplet",
"applet",
")",
"{",
"URL",
"url",
"=",
"null",
";",
"try",
"{",
"if",
"(",
"(",
"url",
"==",
"null",
")",
"&&",
"(",
"path",
"!=",
"null",
")",
")",
"url",
"=",
... | Get the URL from the path.
@param The resource path.
@return The URL. | [
"Get",
"the",
"URL",
"from",
"the",
"path",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/util-misc/src/main/java/org/jbundle/thin/base/screen/util/html/JHtmlView.java#L110-L128 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java | KeyVaultClientBaseImpl.backupStorageAccountAsync | public ServiceFuture<BackupStorageResult> backupStorageAccountAsync(String vaultBaseUrl, String storageAccountName, final ServiceCallback<BackupStorageResult> serviceCallback) {
return ServiceFuture.fromResponse(backupStorageAccountWithServiceResponseAsync(vaultBaseUrl, storageAccountName), serviceCallback);
} | java | public ServiceFuture<BackupStorageResult> backupStorageAccountAsync(String vaultBaseUrl, String storageAccountName, final ServiceCallback<BackupStorageResult> serviceCallback) {
return ServiceFuture.fromResponse(backupStorageAccountWithServiceResponseAsync(vaultBaseUrl, storageAccountName), serviceCallback);
} | [
"public",
"ServiceFuture",
"<",
"BackupStorageResult",
">",
"backupStorageAccountAsync",
"(",
"String",
"vaultBaseUrl",
",",
"String",
"storageAccountName",
",",
"final",
"ServiceCallback",
"<",
"BackupStorageResult",
">",
"serviceCallback",
")",
"{",
"return",
"ServiceFu... | Backs up the specified storage account.
Requests that a backup of the specified storage account be downloaded to the client. This operation requires the storage/backup permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param storageAccountName The name of the storage account.
@param serviceCallback the async ServiceCallback to handle successful and failed responses.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceFuture} object | [
"Backs",
"up",
"the",
"specified",
"storage",
"account",
".",
"Requests",
"that",
"a",
"backup",
"of",
"the",
"specified",
"storage",
"account",
"be",
"downloaded",
"to",
"the",
"client",
".",
"This",
"operation",
"requires",
"the",
"storage",
"/",
"backup",
... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L9534-L9536 |
Azure/azure-sdk-for-java | appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java | AppServiceEnvironmentsInner.listWorkerPoolInstanceMetricDefinitionsWithServiceResponseAsync | public Observable<ServiceResponse<Page<ResourceMetricDefinitionInner>>> listWorkerPoolInstanceMetricDefinitionsWithServiceResponseAsync(final String resourceGroupName, final String name, final String workerPoolName, final String instance) {
return listWorkerPoolInstanceMetricDefinitionsSinglePageAsync(resourceGroupName, name, workerPoolName, instance)
.concatMap(new Func1<ServiceResponse<Page<ResourceMetricDefinitionInner>>, Observable<ServiceResponse<Page<ResourceMetricDefinitionInner>>>>() {
@Override
public Observable<ServiceResponse<Page<ResourceMetricDefinitionInner>>> call(ServiceResponse<Page<ResourceMetricDefinitionInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listWorkerPoolInstanceMetricDefinitionsNextWithServiceResponseAsync(nextPageLink));
}
});
} | java | public Observable<ServiceResponse<Page<ResourceMetricDefinitionInner>>> listWorkerPoolInstanceMetricDefinitionsWithServiceResponseAsync(final String resourceGroupName, final String name, final String workerPoolName, final String instance) {
return listWorkerPoolInstanceMetricDefinitionsSinglePageAsync(resourceGroupName, name, workerPoolName, instance)
.concatMap(new Func1<ServiceResponse<Page<ResourceMetricDefinitionInner>>, Observable<ServiceResponse<Page<ResourceMetricDefinitionInner>>>>() {
@Override
public Observable<ServiceResponse<Page<ResourceMetricDefinitionInner>>> call(ServiceResponse<Page<ResourceMetricDefinitionInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listWorkerPoolInstanceMetricDefinitionsNextWithServiceResponseAsync(nextPageLink));
}
});
} | [
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"Page",
"<",
"ResourceMetricDefinitionInner",
">",
">",
">",
"listWorkerPoolInstanceMetricDefinitionsWithServiceResponseAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"name",
",",
"final",
... | Get metric definitions for a specific instance of a worker pool of an App Service Environment.
Get metric definitions for a specific instance of a worker pool of an App Service Environment.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param name Name of the App Service Environment.
@param workerPoolName Name of the worker pool.
@param instance Name of the instance in the worker pool.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<ResourceMetricDefinitionInner> object | [
"Get",
"metric",
"definitions",
"for",
"a",
"specific",
"instance",
"of",
"a",
"worker",
"pool",
"of",
"an",
"App",
"Service",
"Environment",
".",
"Get",
"metric",
"definitions",
"for",
"a",
"specific",
"instance",
"of",
"a",
"worker",
"pool",
"of",
"an",
... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java#L5562-L5574 |
gmessner/gitlab4j-api | src/main/java/org/gitlab4j/api/CommitsApi.java | CommitsApi.addCommitStatus | public CommitStatus addCommitStatus(Object projectIdOrPath, String sha, CommitBuildState state, CommitStatus status) throws GitLabApiException {
if (projectIdOrPath == null) {
throw new RuntimeException("projectIdOrPath cannot be null");
}
if (sha == null || sha.trim().isEmpty()) {
throw new RuntimeException("sha cannot be null");
}
GitLabApiForm formData = new GitLabApiForm().withParam("state", state, true);
if (status != null) {
formData.withParam("ref", status.getRef())
.withParam("name", status.getName())
.withParam("target_url", status.getTargetUrl())
.withParam("description", status.getDescription())
.withParam("coverage", status.getCoverage());
}
Response response = post(Response.Status.OK, formData, "projects", getProjectIdOrPath(projectIdOrPath), "statuses", sha);
return (response.readEntity(CommitStatus.class));
} | java | public CommitStatus addCommitStatus(Object projectIdOrPath, String sha, CommitBuildState state, CommitStatus status) throws GitLabApiException {
if (projectIdOrPath == null) {
throw new RuntimeException("projectIdOrPath cannot be null");
}
if (sha == null || sha.trim().isEmpty()) {
throw new RuntimeException("sha cannot be null");
}
GitLabApiForm formData = new GitLabApiForm().withParam("state", state, true);
if (status != null) {
formData.withParam("ref", status.getRef())
.withParam("name", status.getName())
.withParam("target_url", status.getTargetUrl())
.withParam("description", status.getDescription())
.withParam("coverage", status.getCoverage());
}
Response response = post(Response.Status.OK, formData, "projects", getProjectIdOrPath(projectIdOrPath), "statuses", sha);
return (response.readEntity(CommitStatus.class));
} | [
"public",
"CommitStatus",
"addCommitStatus",
"(",
"Object",
"projectIdOrPath",
",",
"String",
"sha",
",",
"CommitBuildState",
"state",
",",
"CommitStatus",
"status",
")",
"throws",
"GitLabApiException",
"{",
"if",
"(",
"projectIdOrPath",
"==",
"null",
")",
"{",
"t... | <p>Add or update the build status of a commit. The following fluent methods are available on the
CommitStatus instance for setting up the status:</p>
<pre><code>
withCoverage(Float)
withDescription(String)
withName(String)
withRef(String)
withTargetUrl(String)
</code></pre>
<pre><code>GitLab Endpoint: POST /projects/:id/statuses/:sha</code></pre>
@param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance (required)
@param sha a commit SHA (required)
@param state the state of the status. Can be one of the following: PENDING, RUNNING, SUCCESS, FAILED, CANCELED (required)
@param status the CommitSatus instance hoilding the optional parms: ref, name, target_url, description, and coverage
@return a CommitStatus instance with the updated info
@throws GitLabApiException GitLabApiException if any exception occurs during execution | [
"<p",
">",
"Add",
"or",
"update",
"the",
"build",
"status",
"of",
"a",
"commit",
".",
"The",
"following",
"fluent",
"methods",
"are",
"available",
"on",
"the",
"CommitStatus",
"instance",
"for",
"setting",
"up",
"the",
"status",
":",
"<",
"/",
"p",
">",
... | train | https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/CommitsApi.java#L430-L451 |
baratine/baratine | kraken/src/main/java/com/caucho/v5/kelp/TableWriterServiceImpl.java | TableWriterServiceImpl.calculateSegmentSize | private int calculateSegmentSize(int factor, int segmentSizeOld)
{
DatabaseKelp db = _table.database();
long segmentFactor = _tableLength / db.getSegmentSizeMin();
long segmentFactorNew = segmentFactor / factor;
// segment size is (tableSize / factor), restricted to a power of 4
// over the min segment size.
if (segmentFactorNew > 0) {
int bit = 63 - Long.numberOfLeadingZeros(segmentFactorNew);
bit &= ~0x1;
long segmentFactorPower = (1 << bit);
if (segmentFactorPower < segmentFactorNew) {
segmentFactorNew = 4 * segmentFactorPower;
}
}
long segmentSizeNew = segmentFactorNew * db.getSegmentSizeMin();
segmentSizeNew = Math.max(db.getSegmentSizeMin(), segmentSizeNew);
long segmentSizeBlob = _blobSizeMax * 4;
while (segmentSizeNew < segmentSizeBlob) {
segmentSizeNew *= 4;
}
segmentSizeNew = Math.min(db.getSegmentSizeMax(), segmentSizeNew);
return (int) Math.max(segmentSizeNew, segmentSizeOld);
} | java | private int calculateSegmentSize(int factor, int segmentSizeOld)
{
DatabaseKelp db = _table.database();
long segmentFactor = _tableLength / db.getSegmentSizeMin();
long segmentFactorNew = segmentFactor / factor;
// segment size is (tableSize / factor), restricted to a power of 4
// over the min segment size.
if (segmentFactorNew > 0) {
int bit = 63 - Long.numberOfLeadingZeros(segmentFactorNew);
bit &= ~0x1;
long segmentFactorPower = (1 << bit);
if (segmentFactorPower < segmentFactorNew) {
segmentFactorNew = 4 * segmentFactorPower;
}
}
long segmentSizeNew = segmentFactorNew * db.getSegmentSizeMin();
segmentSizeNew = Math.max(db.getSegmentSizeMin(), segmentSizeNew);
long segmentSizeBlob = _blobSizeMax * 4;
while (segmentSizeNew < segmentSizeBlob) {
segmentSizeNew *= 4;
}
segmentSizeNew = Math.min(db.getSegmentSizeMax(), segmentSizeNew);
return (int) Math.max(segmentSizeNew, segmentSizeOld);
} | [
"private",
"int",
"calculateSegmentSize",
"(",
"int",
"factor",
",",
"int",
"segmentSizeOld",
")",
"{",
"DatabaseKelp",
"db",
"=",
"_table",
".",
"database",
"(",
")",
";",
"long",
"segmentFactor",
"=",
"_tableLength",
"/",
"db",
".",
"getSegmentSizeMin",
"(",... | Calculate the dynamic segment size.
The new segment size is a fraction of the current table size.
@param factor the target ratio compared to the table size
@param segmentSizeOld the previous segment size | [
"Calculate",
"the",
"dynamic",
"segment",
"size",
"."
] | train | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/kelp/TableWriterServiceImpl.java#L600-L635 |
kuali/ojb-1.0.4 | src/xdoclet/java/src/xdoclet/modules/ojb/constraints/ModelConstraints.java | ModelConstraints.isEqual | private boolean isEqual(FieldDescriptorDef first, FieldDescriptorDef second)
{
return first.getName().equals(second.getName()) &&
first.getProperty(PropertyHelper.OJB_PROPERTY_COLUMN).equals(second.getProperty(PropertyHelper.OJB_PROPERTY_COLUMN)) &&
first.getProperty(PropertyHelper.OJB_PROPERTY_JDBC_TYPE).equals(second.getProperty(PropertyHelper.OJB_PROPERTY_JDBC_TYPE));
} | java | private boolean isEqual(FieldDescriptorDef first, FieldDescriptorDef second)
{
return first.getName().equals(second.getName()) &&
first.getProperty(PropertyHelper.OJB_PROPERTY_COLUMN).equals(second.getProperty(PropertyHelper.OJB_PROPERTY_COLUMN)) &&
first.getProperty(PropertyHelper.OJB_PROPERTY_JDBC_TYPE).equals(second.getProperty(PropertyHelper.OJB_PROPERTY_JDBC_TYPE));
} | [
"private",
"boolean",
"isEqual",
"(",
"FieldDescriptorDef",
"first",
",",
"FieldDescriptorDef",
"second",
")",
"{",
"return",
"first",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"second",
".",
"getName",
"(",
")",
")",
"&&",
"first",
".",
"getProperty",
... | Tests whether the two field descriptors are equal, i.e. have same name, same column
and same jdbc-type.
@param first The first field
@param second The second field
@return <code>true</code> if they are equal | [
"Tests",
"whether",
"the",
"two",
"field",
"descriptors",
"are",
"equal",
"i",
".",
"e",
".",
"have",
"same",
"name",
"same",
"column",
"and",
"same",
"jdbc",
"-",
"type",
"."
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/xdoclet/java/src/xdoclet/modules/ojb/constraints/ModelConstraints.java#L354-L359 |
apiman/apiman | manager/api/es/src/main/java/io/apiman/manager/api/es/EsMarshalling.java | EsMarshalling.unmarshallPlan | public static PlanBean unmarshallPlan(Map<String, Object> source) {
if (source == null) {
return null;
}
PlanBean bean = new PlanBean();
bean.setId(asString(source.get("id")));
bean.setName(asString(source.get("name")));
bean.setDescription(asString(source.get("description")));
bean.setCreatedBy(asString(source.get("createdBy")));
bean.setCreatedOn(asDate(source.get("createdOn")));
postMarshall(bean);
return bean;
} | java | public static PlanBean unmarshallPlan(Map<String, Object> source) {
if (source == null) {
return null;
}
PlanBean bean = new PlanBean();
bean.setId(asString(source.get("id")));
bean.setName(asString(source.get("name")));
bean.setDescription(asString(source.get("description")));
bean.setCreatedBy(asString(source.get("createdBy")));
bean.setCreatedOn(asDate(source.get("createdOn")));
postMarshall(bean);
return bean;
} | [
"public",
"static",
"PlanBean",
"unmarshallPlan",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"source",
")",
"{",
"if",
"(",
"source",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"PlanBean",
"bean",
"=",
"new",
"PlanBean",
"(",
")",
";",
"... | Unmarshals the given map source into a bean.
@param source the source
@return the plan | [
"Unmarshals",
"the",
"given",
"map",
"source",
"into",
"a",
"bean",
"."
] | train | https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/manager/api/es/src/main/java/io/apiman/manager/api/es/EsMarshalling.java#L826-L838 |
javamelody/javamelody | javamelody-core/src/main/java/net/bull/javamelody/internal/common/I18N.java | I18N.htmlEncode | public static String htmlEncode(String text, boolean encodeSpace) {
// ces encodages html sont incomplets mais suffisants pour le monitoring
String result = text.replaceAll("[&]", "&").replaceAll("[<]", "<")
.replaceAll("[>]", ">").replaceAll("[\n]", "<br/>");
if (encodeSpace) {
result = result.replaceAll(" ", " ");
}
return result;
} | java | public static String htmlEncode(String text, boolean encodeSpace) {
// ces encodages html sont incomplets mais suffisants pour le monitoring
String result = text.replaceAll("[&]", "&").replaceAll("[<]", "<")
.replaceAll("[>]", ">").replaceAll("[\n]", "<br/>");
if (encodeSpace) {
result = result.replaceAll(" ", " ");
}
return result;
} | [
"public",
"static",
"String",
"htmlEncode",
"(",
"String",
"text",
",",
"boolean",
"encodeSpace",
")",
"{",
"// ces encodages html sont incomplets mais suffisants pour le monitoring\r",
"String",
"result",
"=",
"text",
".",
"replaceAll",
"(",
"\"[&]\"",
",",
"\"&\"",
... | Encode pour affichage en html.
@param text message à encoder
@param encodeSpace booléen selon que les espaces sont encodés en nbsp (insécables)
@return String | [
"Encode",
"pour",
"affichage",
"en",
"html",
"."
] | train | https://github.com/javamelody/javamelody/blob/18ad583ddeb5dcadd797dfda295409c6983ffd71/javamelody-core/src/main/java/net/bull/javamelody/internal/common/I18N.java#L156-L164 |
devnied/EMV-NFC-Paycard-Enrollment | library/src/main/java/com/github/devnied/emvnfccard/utils/ResponseUtils.java | ResponseUtils.contains | public static boolean contains(final byte[] pByte, final SwEnum... pEnum) {
SwEnum val = SwEnum.getSW(pByte);
if (LOGGER.isDebugEnabled() && pByte != null) {
LOGGER.debug("Response Status <"
+ BytesUtils.bytesToStringNoSpace(Arrays.copyOfRange(pByte, Math.max(pByte.length - 2, 0), pByte.length)) + "> : "
+ (val != null ? val.getDetail() : "Unknow"));
}
return val != null && ArrayUtils.contains(pEnum, val);
} | java | public static boolean contains(final byte[] pByte, final SwEnum... pEnum) {
SwEnum val = SwEnum.getSW(pByte);
if (LOGGER.isDebugEnabled() && pByte != null) {
LOGGER.debug("Response Status <"
+ BytesUtils.bytesToStringNoSpace(Arrays.copyOfRange(pByte, Math.max(pByte.length - 2, 0), pByte.length)) + "> : "
+ (val != null ? val.getDetail() : "Unknow"));
}
return val != null && ArrayUtils.contains(pEnum, val);
} | [
"public",
"static",
"boolean",
"contains",
"(",
"final",
"byte",
"[",
"]",
"pByte",
",",
"final",
"SwEnum",
"...",
"pEnum",
")",
"{",
"SwEnum",
"val",
"=",
"SwEnum",
".",
"getSW",
"(",
"pByte",
")",
";",
"if",
"(",
"LOGGER",
".",
"isDebugEnabled",
"(",... | Method used to check equality with the last command return SW1SW2 ==
pEnum
@param pByte
response to the last command
@param pEnum
responses to check
@return true if the response of the last command is contained in pEnum | [
"Method",
"used",
"to",
"check",
"equality",
"with",
"the",
"last",
"command",
"return",
"SW1SW2",
"==",
"pEnum"
] | train | https://github.com/devnied/EMV-NFC-Paycard-Enrollment/blob/bfbd3960708689154a7a75c8a9a934197d738a5b/library/src/main/java/com/github/devnied/emvnfccard/utils/ResponseUtils.java#L75-L83 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java | KeyVaultClientBaseImpl.getDeletedSasDefinitionAsync | public ServiceFuture<DeletedSasDefinitionBundle> getDeletedSasDefinitionAsync(String vaultBaseUrl, String storageAccountName, String sasDefinitionName, final ServiceCallback<DeletedSasDefinitionBundle> serviceCallback) {
return ServiceFuture.fromResponse(getDeletedSasDefinitionWithServiceResponseAsync(vaultBaseUrl, storageAccountName, sasDefinitionName), serviceCallback);
} | java | public ServiceFuture<DeletedSasDefinitionBundle> getDeletedSasDefinitionAsync(String vaultBaseUrl, String storageAccountName, String sasDefinitionName, final ServiceCallback<DeletedSasDefinitionBundle> serviceCallback) {
return ServiceFuture.fromResponse(getDeletedSasDefinitionWithServiceResponseAsync(vaultBaseUrl, storageAccountName, sasDefinitionName), serviceCallback);
} | [
"public",
"ServiceFuture",
"<",
"DeletedSasDefinitionBundle",
">",
"getDeletedSasDefinitionAsync",
"(",
"String",
"vaultBaseUrl",
",",
"String",
"storageAccountName",
",",
"String",
"sasDefinitionName",
",",
"final",
"ServiceCallback",
"<",
"DeletedSasDefinitionBundle",
">",
... | Gets the specified deleted sas definition.
The Get Deleted SAS Definition operation returns the specified deleted SAS definition along with its attributes. This operation requires the storage/getsas permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param storageAccountName The name of the storage account.
@param sasDefinitionName The name of the SAS definition.
@param serviceCallback the async ServiceCallback to handle successful and failed responses.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceFuture} object | [
"Gets",
"the",
"specified",
"deleted",
"sas",
"definition",
".",
"The",
"Get",
"Deleted",
"SAS",
"Definition",
"operation",
"returns",
"the",
"specified",
"deleted",
"SAS",
"definition",
"along",
"with",
"its",
"attributes",
".",
"This",
"operation",
"requires",
... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L10895-L10897 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.