repo stringlengths 7 59 | path stringlengths 3 222 | func_name stringlengths 3 127 | original_string stringlengths 0 466k | language stringclasses 1
value | code stringlengths 0 466k | code_tokens listlengths 0 68.3k | docstring stringlengths 0 21.3k | docstring_tokens listlengths 0 1.93k | sha stringlengths 0 40 | url stringlengths 0 339 | partition stringclasses 3
values | summary stringlengths 0 250 | instruction stringlengths 38 3.13k | input stringclasses 1
value | output stringlengths 146 466k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
arquillian/arquillian-extension-warp | impl/src/main/java/org/jboss/arquillian/warp/impl/client/commandBus/CommandBusOnClient.java | CommandBusOnClient.execute | private <T> T execute(String url, Class<T> returnType, Object requestObject) throws Exception {
URLConnection connection = new URL(url).openConnection();
if (!(connection instanceof HttpURLConnection)) {
throw new IllegalStateException("Not an http connection! " + connection);
}
... | java | private <T> T execute(String url, Class<T> returnType, Object requestObject) throws Exception {
URLConnection connection = new URL(url).openConnection();
if (!(connection instanceof HttpURLConnection)) {
throw new IllegalStateException("Not an http connection! " + connection);
}
... | [
"private",
"<",
"T",
">",
"T",
"execute",
"(",
"String",
"url",
",",
"Class",
"<",
"T",
">",
"returnType",
",",
"Object",
"requestObject",
")",
"throws",
"Exception",
"{",
"URLConnection",
"connection",
"=",
"new",
"URL",
"(",
"url",
")",
".",
"openConne... | Executes the request to the remote url | [
"Executes",
"the",
"request",
"to",
"the",
"remote",
"url"
] | e958f4d782851baf7f40e39835d3d1ad185b74dd | https://github.com/arquillian/arquillian-extension-warp/blob/e958f4d782851baf7f40e39835d3d1ad185b74dd/impl/src/main/java/org/jboss/arquillian/warp/impl/client/commandBus/CommandBusOnClient.java#L196-L268 | train | Execute a HTTP request to the URL and return the result. | Create a Java method that does the following: "Execute a HTTP request to the URL and return the result.". | Of course, here is the Java code you requested:
```java
private <T> T execute(String url, Class<T> returnType, Object requestObject) throws Exception {
URLConnection connection = new URL(url).openConnection();
if (!(connection instanceof HttpURLConnection)) {
throw new IllegalStateException... | |
otto-de/edison-microservice | edison-core/src/main/java/de/otto/edison/authentication/Credentials.java | Credentials.readFrom | public static Optional<Credentials> readFrom(HttpServletRequest request) {
String authorizationHeader = request.getHeader("Authorization");
if (!StringUtils.isEmpty(authorizationHeader)) {
String credentials = authorizationHeader.substring(6, authorizationHeader.length());
String... | java | public static Optional<Credentials> readFrom(HttpServletRequest request) {
String authorizationHeader = request.getHeader("Authorization");
if (!StringUtils.isEmpty(authorizationHeader)) {
String credentials = authorizationHeader.substring(6, authorizationHeader.length());
String... | [
"public",
"static",
"Optional",
"<",
"Credentials",
">",
"readFrom",
"(",
"HttpServletRequest",
"request",
")",
"{",
"String",
"authorizationHeader",
"=",
"request",
".",
"getHeader",
"(",
"\"Authorization\"",
")",
";",
"if",
"(",
"!",
"StringUtils",
".",
"isEmp... | Read username and password from the request's {@code Authorization} header and create a {@code Credentials}
object. Requires authorization header to be base64 encoded.
@param request incoming http request
@return {@code Optional} with parsed {@code Credentials} if {@code Authorization} header and credentials
are prese... | [
"Read",
"username",
"and",
"password",
"from",
"the",
"request",
"s",
"{",
"@code",
"Authorization",
"}",
"header",
"and",
"create",
"a",
"{",
"@code",
"Credentials",
"}",
"object",
".",
"Requires",
"authorization",
"header",
"to",
"be",
"base64",
"encoded",
... | 89ecf0a0dee40977f004370b0b474a36c699e8a2 | https://github.com/otto-de/edison-microservice/blob/89ecf0a0dee40977f004370b0b474a36c699e8a2/edison-core/src/main/java/de/otto/edison/authentication/Credentials.java#L38-L48 | train | Reads the credentials from the request. | Create a Java method that does the following: "Reads the credentials from the request.". | Of course, here is the Java code you requested:
```java
public static Optional<Credentials> readFrom(HttpServletRequest request) {
String authorizationHeader = request.getHeader("Authorization");
if (!StringUtils.isEmpty(authorizationHeader)) {
String credentials = authorizationHeader.subst... | |
code4everything/util | src/main/java/com/zhazhapan/util/Checker.java | Checker.isOnlyLowerCase | public static boolean isOnlyLowerCase(String string) {
boolean result = isNotEmpty(string);
int idx = 0;
int len = string.length();
while (result) {
if (idx >= len) {
break;
}
result = isLowerCase(string.charAt(idx));
idx++;... | java | public static boolean isOnlyLowerCase(String string) {
boolean result = isNotEmpty(string);
int idx = 0;
int len = string.length();
while (result) {
if (idx >= len) {
break;
}
result = isLowerCase(string.charAt(idx));
idx++;... | [
"public",
"static",
"boolean",
"isOnlyLowerCase",
"(",
"String",
"string",
")",
"{",
"boolean",
"result",
"=",
"isNotEmpty",
"(",
"string",
")",
";",
"int",
"idx",
"=",
"0",
";",
"int",
"len",
"=",
"string",
".",
"length",
"(",
")",
";",
"while",
"(",
... | 检测字符串是否全部是小写字母
@param string 字符串
@return {@link Boolean}
@since 1.0.9 | [
"检测字符串是否全部是小写字母"
] | 1fc9f0ead1108f4d7208ba7c000df4244f708418 | https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/Checker.java#L456-L468 | train | Check if a String is only lowercase. | Create a Java method that does the following: "Check if a String is only lowercase.". | Of course, here is the Java code you requested:
```java
public static boolean isOnlyLowerCase(String string) {
boolean result = isNotEmpty(string);
int idx = 0;
int len = string.length();
while (result) {
if (idx >= len) {
break;
}
res... | |
alkacon/opencms-core | src/org/opencms/module/CmsModuleUpdater.java | CmsModuleUpdater.isLinkParsable | private boolean isLinkParsable(CmsResource importRes) throws CmsException {
int typeId = importRes.getTypeId();
I_CmsResourceType type = OpenCms.getResourceManager().getResourceType(typeId);
return type instanceof I_CmsLinkParseable;
} | java | private boolean isLinkParsable(CmsResource importRes) throws CmsException {
int typeId = importRes.getTypeId();
I_CmsResourceType type = OpenCms.getResourceManager().getResourceType(typeId);
return type instanceof I_CmsLinkParseable;
} | [
"private",
"boolean",
"isLinkParsable",
"(",
"CmsResource",
"importRes",
")",
"throws",
"CmsException",
"{",
"int",
"typeId",
"=",
"importRes",
".",
"getTypeId",
"(",
")",
";",
"I_CmsResourceType",
"type",
"=",
"OpenCms",
".",
"getResourceManager",
"(",
")",
"."... | Checks if a resource is link parseable.<P>
@param importRes the resource to check
@return true if the resource is link parseable
@throws CmsException if something goes wrong | [
"Checks",
"if",
"a",
"resource",
"is",
"link",
"parseable",
".",
"<P",
">"
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/module/CmsModuleUpdater.java#L705-L711 | train | Checks if the link is parsable. | Create a Java method that does the following: "Checks if the link is parsable.". | Of course, here is the Java code you requested:
```java
private boolean isLinkParsable(CmsResource importRes) throws CmsException {
int typeId = importRes.getTypeId();
I_CmsResourceType type = OpenCms.getResourceManager().getResourceType(typeId);
return type instanceof I_CmsLinkParseable;
... | |
GenesysPureEngage/authentication-client-java | src/main/java/com/genesys/authentication/AuthenticationApi.java | AuthenticationApi.signOutGet | public ModelApiResponse signOutGet(String authorization, Boolean global, String redirectUri) throws AuthenticationApiException {
try {
return authenticationApi.signOut1(authorization, global, redirectUri);
} catch (ApiException e) {
throw new AuthenticationApiException("Error sig... | java | public ModelApiResponse signOutGet(String authorization, Boolean global, String redirectUri) throws AuthenticationApiException {
try {
return authenticationApi.signOut1(authorization, global, redirectUri);
} catch (ApiException e) {
throw new AuthenticationApiException("Error sig... | [
"public",
"ModelApiResponse",
"signOutGet",
"(",
"String",
"authorization",
",",
"Boolean",
"global",
",",
"String",
"redirectUri",
")",
"throws",
"AuthenticationApiException",
"{",
"try",
"{",
"return",
"authenticationApi",
".",
"signOut1",
"(",
"authorization",
",",... | Sign-out a logged in user
Sign-out the current user and invalidate either the current token or all tokens associated with the user.
@param authorization The OAuth 2 bearer access token you received from [/auth/v3/oauth/token](/reference/authentication/Authentication/index.html#retrieveToken). For example: \"Autho... | [
"Sign",
"-",
"out",
"a",
"logged",
"in",
"user",
"Sign",
"-",
"out",
"the",
"current",
"user",
"and",
"invalidate",
"either",
"the",
"current",
"token",
"or",
"all",
"tokens",
"associated",
"with",
"the",
"user",
"."
] | eb0d58343ee42ebd3c037163c1137f611dfcbb3a | https://github.com/GenesysPureEngage/authentication-client-java/blob/eb0d58343ee42ebd3c037163c1137f611dfcbb3a/src/main/java/com/genesys/authentication/AuthenticationApi.java#L152-L158 | train | Sign out the user. | Create a Java method that does the following: "Sign out the user.". | Of course, here is the Java code you requested:
```java
public ModelApiResponse signOutGet(String authorization, Boolean global, String redirectUri) throws AuthenticationApiException {
try {
return authenticationApi.signOut1(authorization, global, redirectUri);
} catch (ApiException e) {
... | |
forge/javaee-descriptors | impl/src/main/java/org/jboss/shrinkwrap/descriptor/impl/orm20/IdImpl.java | IdImpl.getOrCreateGeneratedValue | public GeneratedValue<Id<T>> getOrCreateGeneratedValue()
{
Node node = childNode.getOrCreate("generated-value");
GeneratedValue<Id<T>> generatedValue = new GeneratedValueImpl<Id<T>>(this, "generated-value", childNode, node);
return generatedValue;
} | java | public GeneratedValue<Id<T>> getOrCreateGeneratedValue()
{
Node node = childNode.getOrCreate("generated-value");
GeneratedValue<Id<T>> generatedValue = new GeneratedValueImpl<Id<T>>(this, "generated-value", childNode, node);
return generatedValue;
} | [
"public",
"GeneratedValue",
"<",
"Id",
"<",
"T",
">",
">",
"getOrCreateGeneratedValue",
"(",
")",
"{",
"Node",
"node",
"=",
"childNode",
".",
"getOrCreate",
"(",
"\"generated-value\"",
")",
";",
"GeneratedValue",
"<",
"Id",
"<",
"T",
">",
">",
"generatedValu... | If not already created, a new <code>generated-value</code> element with the given value will be created.
Otherwise, the existing <code>generated-value</code> element will be returned.
@return a new or existing instance of <code>GeneratedValue<Id<T>></code> | [
"If",
"not",
"already",
"created",
"a",
"new",
"<code",
">",
"generated",
"-",
"value<",
"/",
"code",
">",
"element",
"with",
"the",
"given",
"value",
"will",
"be",
"created",
".",
"Otherwise",
"the",
"existing",
"<code",
">",
"generated",
"-",
"value<",
... | cb914330a1a0b04bfc1d0f199bd9cde3bbf0b3ed | https://github.com/forge/javaee-descriptors/blob/cb914330a1a0b04bfc1d0f199bd9cde3bbf0b3ed/impl/src/main/java/org/jboss/shrinkwrap/descriptor/impl/orm20/IdImpl.java#L86-L91 | train | Get the GeneratedValue object from the Node. | Create a Java method that does the following: "Get the GeneratedValue object from the Node.". | Of course, here is the Java code you requested:
```java
public GeneratedValue<Id<T>> getOrCreateGeneratedValue()
{
Node node = childNode.getOrCreate("generated-value");
GeneratedValue<Id<T>> generatedValue = new GeneratedValueImpl<Id<T>>(this, "generated-value", childNode, node);
return generatedV... | |
knowm/XChange | xchange-bitz/src/main/java/org/knowm/xchange/bitz/BitZUtils.java | BitZUtils.toPairString | public static String toPairString(CurrencyPair currency) {
return String.format(
"%s_%s",
currency.base.getCurrencyCode().toLowerCase(),
currency.counter.getCurrencyCode().toLowerCase());
} | java | public static String toPairString(CurrencyPair currency) {
return String.format(
"%s_%s",
currency.base.getCurrencyCode().toLowerCase(),
currency.counter.getCurrencyCode().toLowerCase());
} | [
"public",
"static",
"String",
"toPairString",
"(",
"CurrencyPair",
"currency",
")",
"{",
"return",
"String",
".",
"format",
"(",
"\"%s_%s\"",
",",
"currency",
".",
"base",
".",
"getCurrencyCode",
"(",
")",
".",
"toLowerCase",
"(",
")",
",",
"currency",
".",
... | TODO: Add Test | [
"TODO",
":",
"Add",
"Test"
] | e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186 | https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-bitz/src/main/java/org/knowm/xchange/bitz/BitZUtils.java#L9-L14 | train | Returns a string representation of a CurrencyPair object. | Create a Java method that does the following: "Returns a string representation of a CurrencyPair object.". | Of course, here is the Java code you requested:
```java
public static String toPairString(CurrencyPair currency) {
return String.format(
"%s_%s",
currency.base.getCurrencyCode().toLowerCase(),
currency.counter.getCurrencyCode().toLowerCase());
}
```
Hope this helps! | |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/sampling/ReservoirItemsSketch.java | ReservoirItemsSketch.downsampledCopy | ReservoirItemsSketch<T> downsampledCopy(final int maxK) {
final ReservoirItemsSketch<T> ris = new ReservoirItemsSketch<>(maxK, rf_);
for (final T item : getSamples()) {
// Pretending old implicit weights are all 1. Not true in general, but they're all
// equal so update should work properly as long ... | java | ReservoirItemsSketch<T> downsampledCopy(final int maxK) {
final ReservoirItemsSketch<T> ris = new ReservoirItemsSketch<>(maxK, rf_);
for (final T item : getSamples()) {
// Pretending old implicit weights are all 1. Not true in general, but they're all
// equal so update should work properly as long ... | [
"ReservoirItemsSketch",
"<",
"T",
">",
"downsampledCopy",
"(",
"final",
"int",
"maxK",
")",
"{",
"final",
"ReservoirItemsSketch",
"<",
"T",
">",
"ris",
"=",
"new",
"ReservoirItemsSketch",
"<>",
"(",
"maxK",
",",
"rf_",
")",
";",
"for",
"(",
"final",
"T",
... | temporary violation of maxK, we're avoiding violating it at all. | [
"temporary",
"violation",
"of",
"maxK",
"we",
"re",
"avoiding",
"violating",
"it",
"at",
"all",
"."
] | 900c8c9668a1e2f1d54d453e956caad54702e540 | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/sampling/ReservoirItemsSketch.java#L610-L624 | train | Downsampled copy of the ReservoirItemsSketch. | Create a Java method that does the following: "Downsampled copy of the ReservoirItemsSketch.". | Of course, here is the Java code you requested:
```java
ReservoirItemsSketch<T> downsampledCopy(final int maxK) {
final ReservoirItemsSketch<T> ris = new ReservoirItemsSketch<>(maxK, rf_);
for (final T item : getSamples()) {
// Pretending old implicit weights are all 1. Not true in general, but they're a... | |
googleapis/google-cloud-java | google-cloud-examples/src/main/java/com/google/cloud/examples/datastore/snippets/QuerySnippets.java | QuerySnippets.newEntityQuery | public QueryResults<Entity> newEntityQuery(String kind) {
// [START newEntityQuery]
Query<Entity> query = Query.newEntityQueryBuilder().setKind(kind).build();
QueryResults<Entity> results = datastore.run(query);
// Use results
// [END newEntityQuery]
return results;
} | java | public QueryResults<Entity> newEntityQuery(String kind) {
// [START newEntityQuery]
Query<Entity> query = Query.newEntityQueryBuilder().setKind(kind).build();
QueryResults<Entity> results = datastore.run(query);
// Use results
// [END newEntityQuery]
return results;
} | [
"public",
"QueryResults",
"<",
"Entity",
">",
"newEntityQuery",
"(",
"String",
"kind",
")",
"{",
"// [START newEntityQuery]",
"Query",
"<",
"Entity",
">",
"query",
"=",
"Query",
".",
"newEntityQueryBuilder",
"(",
")",
".",
"setKind",
"(",
"kind",
")",
".",
"... | [VARIABLE "my_kind"] | [
"[",
"VARIABLE",
"my_kind",
"]"
] | d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-examples/src/main/java/com/google/cloud/examples/datastore/snippets/QuerySnippets.java#L70-L77 | train | Create a new entity query. | Create a Java method that does the following: "Create a new entity query.". | Of course, here is the Java code you requested:
```java
public QueryResults<Entity> newEntityQuery(String kind) {
// [START newEntityQuery]
Query<Entity> query = Query.newEntityQueryBuilder().setKind(kind).build();
QueryResults<Entity> results = datastore.run(query);
// Use results
// [END newEntit... | |
intellimate/Izou | src/main/java/org/intellimate/izou/security/FilePermissionModule.java | FilePermissionModule.fileWriteCheck | void fileWriteCheck(String filePath, AddOnModel addOnModel) {
File request;
try {
request = new File(filePath).getCanonicalFile();
} catch (IOException e) {
error("Error getting canonical path", e);
throw getException(filePath);
}
isForbidden... | java | void fileWriteCheck(String filePath, AddOnModel addOnModel) {
File request;
try {
request = new File(filePath).getCanonicalFile();
} catch (IOException e) {
error("Error getting canonical path", e);
throw getException(filePath);
}
isForbidden... | [
"void",
"fileWriteCheck",
"(",
"String",
"filePath",
",",
"AddOnModel",
"addOnModel",
")",
"{",
"File",
"request",
";",
"try",
"{",
"request",
"=",
"new",
"File",
"(",
"filePath",
")",
".",
"getCanonicalFile",
"(",
")",
";",
"}",
"catch",
"(",
"IOException... | Determines if the file at the given file path is safe to write to in all aspects, if so returns true, else false
@param filePath the path to the file to write to
@param addOnModel the AddonModel | [
"Determines",
"if",
"the",
"file",
"at",
"the",
"given",
"file",
"path",
"is",
"safe",
"to",
"write",
"to",
"in",
"all",
"aspects",
"if",
"so",
"returns",
"true",
"else",
"false"
] | 40a808b97998e17655c4a78e30ce7326148aed27 | https://github.com/intellimate/Izou/blob/40a808b97998e17655c4a78e30ce7326148aed27/src/main/java/org/intellimate/izou/security/FilePermissionModule.java#L116-L147 | train | File write check. | Create a Java method that does the following: "File write check.". | Of course, here is the Java code you requested:
```java
void fileWriteCheck(String filePath, AddOnModel addOnModel) {
File request;
try {
request = new File(filePath).getCanonicalFile();
} catch (IOException e) {
error("Error getting canonical path", e);
thr... | |
javadev/underscore-java | src/main/java/com/github/underscore/U.java | U.concat | @SuppressWarnings("unchecked")
public static <T> List<T> concat(final Iterable<T> first, final Iterable<T> ... other) {
List<T> list = newArrayList(first);
for (Iterable<T> iter : other) {
list.addAll(newArrayList(iter));
}
return list;
} | java | @SuppressWarnings("unchecked")
public static <T> List<T> concat(final Iterable<T> first, final Iterable<T> ... other) {
List<T> list = newArrayList(first);
for (Iterable<T> iter : other) {
list.addAll(newArrayList(iter));
}
return list;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"List",
"<",
"T",
">",
"concat",
"(",
"final",
"Iterable",
"<",
"T",
">",
"first",
",",
"final",
"Iterable",
"<",
"T",
">",
"...",
"other",
")",
"{",
"List",
"<",
... | /*
Documented, #concat | [
"/",
"*",
"Documented",
"#concat"
] | 4d49fe282626f5904aaa7d5b34fd78524b4932e9 | https://github.com/javadev/underscore-java/blob/4d49fe282626f5904aaa7d5b34fd78524b4932e9/src/main/java/com/github/underscore/U.java#L3238-L3245 | train | Concatenate two Iterable objects into a single List. | Create a Java method that does the following: "Concatenate two Iterable objects into a single List.". | Of course, here is the Java code you requested:
```java
@SuppressWarnings("unchecked")
public static <T> List<T> concat(final Iterable<T> first, final Iterable<T> ... other) {
List<T> list = newArrayList(first);
for (Iterable<T> iter : other) {
list.addAll(newArrayList(iter));
}... | |
wildfly/wildfly | ejb3/src/main/java/org/jboss/as/ejb3/suspend/EJBSuspendHandlerService.java | EJBSuspendHandlerService.acceptInvocation | public boolean acceptInvocation(InterceptorContext context) throws SystemException {
if (suspended) {
if (!gracefulTxnShutdown)
return false;
// a null listener means that we are done suspending;
if (listenerUpdater.get(this) == null || activeTransactionCountU... | java | public boolean acceptInvocation(InterceptorContext context) throws SystemException {
if (suspended) {
if (!gracefulTxnShutdown)
return false;
// a null listener means that we are done suspending;
if (listenerUpdater.get(this) == null || activeTransactionCountU... | [
"public",
"boolean",
"acceptInvocation",
"(",
"InterceptorContext",
"context",
")",
"throws",
"SystemException",
"{",
"if",
"(",
"suspended",
")",
"{",
"if",
"(",
"!",
"gracefulTxnShutdown",
")",
"return",
"false",
";",
"// a null listener means that we are done suspend... | Indicates if a invocation should be accepted: which will happen only if server is not suspended, or if the invocation
involves a still active transaction.
@param context interceptor context
@return {@code true} if invocation can be accepted by invoking interceptor | [
"Indicates",
"if",
"a",
"invocation",
"should",
"be",
"accepted",
":",
"which",
"will",
"happen",
"only",
"if",
"server",
"is",
"not",
"suspended",
"or",
"if",
"the",
"invocation",
"involves",
"a",
"still",
"active",
"transaction",
"."
] | 64896f1500fe465ad83d96ede9fa19d0c3747f18 | https://github.com/wildfly/wildfly/blob/64896f1500fe465ad83d96ede9fa19d0c3747f18/ejb3/src/main/java/org/jboss/as/ejb3/suspend/EJBSuspendHandlerService.java#L242-L261 | test | This method is called by the interceptor to determine if the invocation should be accepted. | Create a Java method that does the following: "This method is called by the interceptor to determine if the invocation should be accepted.". | Of course, here is the Java code you requested:
```java
public boolean acceptInvocation(InterceptorContext context) throws SystemException {
if (suspended) {
if (!gracefulTxnShutdown)
return false;
// a null listener means that we are done suspending;
if (lis... | |
hypfvieh/java-utils | src/main/java/com/github/hypfvieh/util/TypeUtil.java | TypeUtil.defaultIfNotInteger | public static int defaultIfNotInteger(String _possibleInt, int _default) {
if (isInteger(_possibleInt)) {
return Integer.parseInt(_possibleInt);
}
return _default;
} | java | public static int defaultIfNotInteger(String _possibleInt, int _default) {
if (isInteger(_possibleInt)) {
return Integer.parseInt(_possibleInt);
}
return _default;
} | [
"public",
"static",
"int",
"defaultIfNotInteger",
"(",
"String",
"_possibleInt",
",",
"int",
"_default",
")",
"{",
"if",
"(",
"isInteger",
"(",
"_possibleInt",
")",
")",
"{",
"return",
"Integer",
".",
"parseInt",
"(",
"_possibleInt",
")",
";",
"}",
"return",... | Returns integer converted from string or default if string could not be converted to int.
@param _possibleInt string to convert
@param _default default to use if string cannot be converted
@return int | [
"Returns",
"integer",
"converted",
"from",
"string",
"or",
"default",
"if",
"string",
"could",
"not",
"be",
"converted",
"to",
"int",
"."
] | 407c32d6b485596d4d2b644f5f7fc7a02d0169c6 | https://github.com/hypfvieh/java-utils/blob/407c32d6b485596d4d2b644f5f7fc7a02d0169c6/src/main/java/com/github/hypfvieh/util/TypeUtil.java#L367-L372 | train | Default if possible int is not an integer. | Create a Java method that does the following: "Default if possible int is not an integer.". | Of course, here is the Java code you requested:
```java
public static int defaultIfNotInteger(String _possibleInt, int _default) {
if (isInteger(_possibleInt)) {
return Integer.parseInt(_possibleInt);
}
return _default;
}
```
Hope this helps! | |
aws/aws-sdk-java | aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/datamodeling/ConvertibleType.java | ConvertibleType.of | private static <T> ConvertibleType<T> of(final DynamoDBTypeConverter<?,T> converter) {
final Class<?> clazz = converter.getClass();
if (!clazz.isInterface()) {
for (Class<?> c = clazz; Object.class != c; c = c.getSuperclass()) {
for (final Type genericType : c.getGenericInter... | java | private static <T> ConvertibleType<T> of(final DynamoDBTypeConverter<?,T> converter) {
final Class<?> clazz = converter.getClass();
if (!clazz.isInterface()) {
for (Class<?> c = clazz; Object.class != c; c = c.getSuperclass()) {
for (final Type genericType : c.getGenericInter... | [
"private",
"static",
"<",
"T",
">",
"ConvertibleType",
"<",
"T",
">",
"of",
"(",
"final",
"DynamoDBTypeConverter",
"<",
"?",
",",
"T",
">",
"converter",
")",
"{",
"final",
"Class",
"<",
"?",
">",
"clazz",
"=",
"converter",
".",
"getClass",
"(",
")",
... | Returns the conversion type for the converter. | [
"Returns",
"the",
"conversion",
"type",
"for",
"the",
"converter",
"."
] | aa38502458969b2d13a1c3665a56aba600e4dbd0 | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/datamodeling/ConvertibleType.java#L175-L196 | train | Returns the type of the converter. | Create a Java method that does the following: "Returns the type of the converter.". | Of course, here is the Java code you requested:
```java
private static <T> ConvertibleType<T> of(final DynamoDBTypeConverter<?,T> converter) {
final Class<?> clazz = converter.getClass();
if (!clazz.isInterface()) {
for (Class<?> c = clazz; Object.class != c; c = c.getSuperclass()) {
... | |
graknlabs/grakn | console/ConsoleSession.java | ConsoleSession.openTextEditor | private String openTextEditor() throws IOException, InterruptedException {
String editor = Optional.ofNullable(System.getenv().get("EDITOR")).orElse(EDITOR_DEFAULT);
File tempFile = new File(StandardSystemProperty.JAVA_IO_TMPDIR.value() + EDITOR_FILE);
tempFile.createNewFile();
// Run t... | java | private String openTextEditor() throws IOException, InterruptedException {
String editor = Optional.ofNullable(System.getenv().get("EDITOR")).orElse(EDITOR_DEFAULT);
File tempFile = new File(StandardSystemProperty.JAVA_IO_TMPDIR.value() + EDITOR_FILE);
tempFile.createNewFile();
// Run t... | [
"private",
"String",
"openTextEditor",
"(",
")",
"throws",
"IOException",
",",
"InterruptedException",
"{",
"String",
"editor",
"=",
"Optional",
".",
"ofNullable",
"(",
"System",
".",
"getenv",
"(",
")",
".",
"get",
"(",
"\"EDITOR\"",
")",
")",
".",
"orElse"... | Open the user's preferred editor to write a query
@return the string written in the editor | [
"Open",
"the",
"user",
"s",
"preferred",
"editor",
"to",
"write",
"a",
"query"
] | 6aaee75ea846202474d591f8809d62028262fac5 | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/console/ConsoleSession.java#L269-L282 | train | Open the text editor | Create a Java method that does the following: "Open the text editor". | Of course, here is the Java code you requested:
```java
private String openTextEditor() throws IOException, InterruptedException {
String editor = Optional.ofNullable(System.getenv().get("EDITOR")).orElse(EDITOR_DEFAULT);
File tempFile = new File(StandardSystemProperty.JAVA_IO_TMPDIR.value() + EDITOR_F... | |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WTabSet.java | WTabSet.handleRequest | @Override
public void handleRequest(final Request request) {
if (isDisabled()) {
// Protect against client-side tampering of disabled/read-only fields.
return;
}
// Remember which client side tab we were on.
String[] indicesStr = request.getParameterValues(getId());
if (indicesStr != null && indicesS... | java | @Override
public void handleRequest(final Request request) {
if (isDisabled()) {
// Protect against client-side tampering of disabled/read-only fields.
return;
}
// Remember which client side tab we were on.
String[] indicesStr = request.getParameterValues(getId());
if (indicesStr != null && indicesS... | [
"@",
"Override",
"public",
"void",
"handleRequest",
"(",
"final",
"Request",
"request",
")",
"{",
"if",
"(",
"isDisabled",
"(",
")",
")",
"{",
"// Protect against client-side tampering of disabled/read-only fields.",
"return",
";",
"}",
"// Remember which client side tab ... | Override handleRequest in order to perform processing specific to this component.
@param request the request being responded to. | [
"Override",
"handleRequest",
"in",
"order",
"to",
"perform",
"processing",
"specific",
"to",
"this",
"component",
"."
] | d1a2b2243270067db030feb36ca74255aaa94436 | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WTabSet.java#L624-L690 | train | Override handleRequest to handle the request. | Create a Java method that does the following: "Override handleRequest to handle the request.". | Of course, here is the Java code you requested:
```java
@Override
public void handleRequest(final Request request) {
if (isDisabled()) {
// Protect against client-side tampering of disabled/read-only fields.
return;
}
// Remember which client side tab we were on.
String[] indicesStr = request.getParame... | |
VoltDB/voltdb | src/frontend/org/voltdb/planner/SelectSubPlanAssembler.java | SelectSubPlanAssembler.generateFullJoinOrdersForTree | private static List<JoinNode> generateFullJoinOrdersForTree(JoinNode subTree) {
assert(subTree != null);
List<JoinNode> joinOrders = new ArrayList<>();
if (!(subTree instanceof BranchNode)) {
// End of recursion
joinOrders.add(subTree);
return joinOrders;
... | java | private static List<JoinNode> generateFullJoinOrdersForTree(JoinNode subTree) {
assert(subTree != null);
List<JoinNode> joinOrders = new ArrayList<>();
if (!(subTree instanceof BranchNode)) {
// End of recursion
joinOrders.add(subTree);
return joinOrders;
... | [
"private",
"static",
"List",
"<",
"JoinNode",
">",
"generateFullJoinOrdersForTree",
"(",
"JoinNode",
"subTree",
")",
"{",
"assert",
"(",
"subTree",
"!=",
"null",
")",
";",
"List",
"<",
"JoinNode",
">",
"joinOrders",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
... | Helper method to generate join orders for a join tree containing only FULL joins.
The only allowed permutation is a join order that has original left and right nodes
swapped.
@param subTree join tree
@return list of valid join orders | [
"Helper",
"method",
"to",
"generate",
"join",
"orders",
"for",
"a",
"join",
"tree",
"containing",
"only",
"FULL",
"joins",
".",
"The",
"only",
"allowed",
"permutation",
"is",
"a",
"join",
"order",
"that",
"has",
"original",
"left",
"and",
"right",
"nodes",
... | 8afc1031e475835344b5497ea9e7203bc95475ac | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/planner/SelectSubPlanAssembler.java#L230-L267 | train | Generate full join orders for a sub - tree. | Create a Java method that does the following: "Generate full join orders for a sub - tree.". | Of course, here is the Java code you requested:
```java
private static List<JoinNode> generateFullJoinOrdersForTree(JoinNode subTree) {
assert(subTree != null);
List<JoinNode> joinOrders = new ArrayList<>();
if (!(subTree instanceof BranchNode)) {
// End of recursion
joi... | |
dashorst/wicket-stuff-markup-validator | whattf/src/main/java/org/whattf/checker/TextContentChecker.java | TextContentChecker.streamingValidatorFor | private DatatypeStreamingValidator streamingValidatorFor(String uri,
String localName, Attributes atts) {
if ("http://www.w3.org/1999/xhtml".equals(uri)) {
if ("time".equals(localName)) {
if (atts.getIndex("", "datetime") < 0) {
return TimeDatetime.THE... | java | private DatatypeStreamingValidator streamingValidatorFor(String uri,
String localName, Attributes atts) {
if ("http://www.w3.org/1999/xhtml".equals(uri)) {
if ("time".equals(localName)) {
if (atts.getIndex("", "datetime") < 0) {
return TimeDatetime.THE... | [
"private",
"DatatypeStreamingValidator",
"streamingValidatorFor",
"(",
"String",
"uri",
",",
"String",
"localName",
",",
"Attributes",
"atts",
")",
"{",
"if",
"(",
"\"http://www.w3.org/1999/xhtml\"",
".",
"equals",
"(",
"uri",
")",
")",
"{",
"if",
"(",
"\"time\"",... | Returns a <code>DatatypeStreamingValidator</code> for the element if it
needs <code>textContent</code> checking or <code>null</code> if it does
not.
@param uri
the namespace URI of the element
@param localName
the local name of the element
@param atts
the attributes
@return a <code>DatatypeStreamingValidator</code> or... | [
"Returns",
"a",
"<code",
">",
"DatatypeStreamingValidator<",
"/",
"code",
">",
"for",
"the",
"element",
"if",
"it",
"needs",
"<code",
">",
"textContent<",
"/",
"code",
">",
"checking",
"or",
"<code",
">",
"null<",
"/",
"code",
">",
"if",
"it",
"does",
"n... | 9e529a4dc8bfdbbe4c794f3132ef400a006560a1 | https://github.com/dashorst/wicket-stuff-markup-validator/blob/9e529a4dc8bfdbbe4c794f3132ef400a006560a1/whattf/src/main/java/org/whattf/checker/TextContentChecker.java#L80-L101 | train | This method is called to create a DatatypeStreamingValidator object for a particular element. | Create a Java method that does the following: "This method is called to create a DatatypeStreamingValidator object for a particular element.". | Of course, here is the Java code you requested:
```java
private DatatypeStreamingValidator streamingValidatorFor(String uri,
String localName, Attributes atts) {
if ("http://www.w3.org/1999/xhtml".equals(uri)) {
if ("time".equals(localName)) {
if (atts.getIndex("", "date... | |
yan74/afplib | org.afplib/src/main/java/org/afplib/afplib/impl/AfplibPackageImpl.java | AfplibPackageImpl.getGBOX | public EClass getGBOX() {
if (gboxEClass == null) {
gboxEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(441);
}
return gboxEClass;
} | java | public EClass getGBOX() {
if (gboxEClass == null) {
gboxEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(441);
}
return gboxEClass;
} | [
"public",
"EClass",
"getGBOX",
"(",
")",
"{",
"if",
"(",
"gboxEClass",
"==",
"null",
")",
"{",
"gboxEClass",
"=",
"(",
"EClass",
")",
"EPackage",
".",
"Registry",
".",
"INSTANCE",
".",
"getEPackage",
"(",
"AfplibPackage",
".",
"eNS_URI",
")",
".",
"getEC... | <!-- begin-user-doc -->
<!-- end-user-doc -->
@generated | [
"<!",
"--",
"begin",
"-",
"user",
"-",
"doc",
"--",
">",
"<!",
"--",
"end",
"-",
"user",
"-",
"doc",
"--",
">"
] | 9ff0513f9448bdf8c0b0e31dc4910c094c48fb2f | https://github.com/yan74/afplib/blob/9ff0513f9448bdf8c0b0e31dc4910c094c48fb2f/org.afplib/src/main/java/org/afplib/afplib/impl/AfplibPackageImpl.java#L13012-L13017 | train | Get the GBOXEClass. | Create a Java method that does the following: "Get the GBOXEClass.". | Of course, here is the Java code you requested:
```java
public EClass getGBOX() {
if (gboxEClass == null) {
gboxEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(441);
}
return gboxEClass;
}
```
Hope this helps! | |
ironjacamar/ironjacamar | core/src/main/java/org/ironjacamar/core/security/DefaultCallback.java | DefaultCallback.start | public void start() throws Throwable
{
InputStream is = null;
try
{
if (file != null)
{
File f = new File(file);
if (f.exists())
{
if (trace)
log.trace("callback.properties: Using file: " + file);
... | java | public void start() throws Throwable
{
InputStream is = null;
try
{
if (file != null)
{
File f = new File(file);
if (f.exists())
{
if (trace)
log.trace("callback.properties: Using file: " + file);
... | [
"public",
"void",
"start",
"(",
")",
"throws",
"Throwable",
"{",
"InputStream",
"is",
"=",
"null",
";",
"try",
"{",
"if",
"(",
"file",
"!=",
"null",
")",
"{",
"File",
"f",
"=",
"new",
"File",
"(",
"file",
")",
";",
"if",
"(",
"f",
".",
"exists",
... | {@inheritDoc} | [
"{"
] | f0389ee7e62aa8b40ba09b251edad76d220ea796 | https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/core/src/main/java/org/ironjacamar/core/security/DefaultCallback.java#L241-L359 | train | Start the processing of the callback. | Create a Java method that does the following: "Start the processing of the callback.". | Of course, here is the Java code you requested:
```java
public void start() throws Throwable
{
InputStream is = null;
try
{
if (file != null)
{
File f = new File(file);
if (f.exists())
{
if (trace)
log.trace("... | |
liferay/com-liferay-commerce | commerce-user-segment-service/src/main/java/com/liferay/commerce/user/segment/service/persistence/impl/CommerceUserSegmentEntryPersistenceImpl.java | CommerceUserSegmentEntryPersistenceImpl.findByGroupId_First | @Override
public CommerceUserSegmentEntry findByGroupId_First(long groupId,
OrderByComparator<CommerceUserSegmentEntry> orderByComparator)
throws NoSuchUserSegmentEntryException {
CommerceUserSegmentEntry commerceUserSegmentEntry = fetchByGroupId_First(groupId,
orderByComparator);
if (commerceUserSegmentE... | java | @Override
public CommerceUserSegmentEntry findByGroupId_First(long groupId,
OrderByComparator<CommerceUserSegmentEntry> orderByComparator)
throws NoSuchUserSegmentEntryException {
CommerceUserSegmentEntry commerceUserSegmentEntry = fetchByGroupId_First(groupId,
orderByComparator);
if (commerceUserSegmentE... | [
"@",
"Override",
"public",
"CommerceUserSegmentEntry",
"findByGroupId_First",
"(",
"long",
"groupId",
",",
"OrderByComparator",
"<",
"CommerceUserSegmentEntry",
">",
"orderByComparator",
")",
"throws",
"NoSuchUserSegmentEntryException",
"{",
"CommerceUserSegmentEntry",
"commerc... | Returns the first commerce user segment entry in the ordered set where groupId = ?.
@param groupId the group ID
@param orderByComparator the comparator to order the set by (optionally <code>null</code>)
@return the first matching commerce user segment entry
@throws NoSuchUserSegmentEntryException if a matching com... | [
"Returns",
"the",
"first",
"commerce",
"user",
"segment",
"entry",
"in",
"the",
"ordered",
"set",
"where",
"groupId",
"=",
"?",
";",
"."
] | 9e54362d7f59531fc684016ba49ee7cdc3a2f22b | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-user-segment-service/src/main/java/com/liferay/commerce/user/segment/service/persistence/impl/CommerceUserSegmentEntryPersistenceImpl.java#L296-L317 | train | Returns the commerce user segment entry in the ordered set where groupId = ? ; and orderByComparator = ? ;. | Create a Java method that does the following: "Returns the commerce user segment entry in the ordered set where groupId = ? ; and orderByComparator = ? ;.". | Of course, here is the Java code you requested:
```java
@Override
public CommerceUserSegmentEntry findByGroupId_First(long groupId,
OrderByComparator<CommerceUserSegmentEntry> orderByComparator)
throws NoSuchUserSegmentEntryException {
CommerceUserSegmentEntry commerceUserSegmentEntry = fetchByGroupId_First(gro... | |
OpenLiberty/open-liberty | dev/com.ibm.ws.monitor/src/com/ibm/ws/pmi/server/PmiRegistry.java | PmiRegistry.findModuleItem | public static ModuleItem findModuleItem(String[] path) {
if (disabled)
return null;
if (path == null || path[0].equals(APPSERVER_MODULE)) {
return moduleRoot;
}
return moduleRoot.find(path, 0);
} | java | public static ModuleItem findModuleItem(String[] path) {
if (disabled)
return null;
if (path == null || path[0].equals(APPSERVER_MODULE)) {
return moduleRoot;
}
return moduleRoot.find(path, 0);
} | [
"public",
"static",
"ModuleItem",
"findModuleItem",
"(",
"String",
"[",
"]",
"path",
")",
"{",
"if",
"(",
"disabled",
")",
"return",
"null",
";",
"if",
"(",
"path",
"==",
"null",
"||",
"path",
"[",
"0",
"]",
".",
"equals",
"(",
"APPSERVER_MODULE",
")",... | find a ModuleItem | [
"find",
"a",
"ModuleItem"
] | ca725d9903e63645018f9fa8cbda25f60af83a5d | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.monitor/src/com/ibm/ws/pmi/server/PmiRegistry.java#L411-L418 | train | Find the ModuleItem for the given path. | Create a Java method that does the following: "Find the ModuleItem for the given path.". | Of course, here is the Java code you requested:
```java
public static ModuleItem findModuleItem(String[] path) {
if (disabled)
return null;
if (path == null || path[0].equals(APPSERVER_MODULE)) {
return moduleRoot;
}
return moduleRoot.find(path, 0);
}
```
Ho... | |
citrusframework/citrus | modules/citrus-ws/src/main/java/com/consol/citrus/ws/client/WebServiceEndpointConfiguration.java | WebServiceEndpointConfiguration.setInterceptors | public void setInterceptors(List<ClientInterceptor> interceptors) {
this.interceptors = interceptors;
getWebServiceTemplate().setInterceptors(interceptors.toArray(new ClientInterceptor[interceptors.size()]));
} | java | public void setInterceptors(List<ClientInterceptor> interceptors) {
this.interceptors = interceptors;
getWebServiceTemplate().setInterceptors(interceptors.toArray(new ClientInterceptor[interceptors.size()]));
} | [
"public",
"void",
"setInterceptors",
"(",
"List",
"<",
"ClientInterceptor",
">",
"interceptors",
")",
"{",
"this",
".",
"interceptors",
"=",
"interceptors",
";",
"getWebServiceTemplate",
"(",
")",
".",
"setInterceptors",
"(",
"interceptors",
".",
"toArray",
"(",
... | Sets the client interceptors.
@param interceptors | [
"Sets",
"the",
"client",
"interceptors",
"."
] | 55c58ef74c01d511615e43646ca25c1b2301c56d | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-ws/src/main/java/com/consol/citrus/ws/client/WebServiceEndpointConfiguration.java#L217-L220 | train | Sets the interceptors for this class. | Create a Java method that does the following: "Sets the interceptors for this class.". | Of course, here is the Java code you requested:
```java
public void setInterceptors(List<ClientInterceptor> interceptors) {
this.interceptors = interceptors;
getWebServiceTemplate().setInterceptors(interceptors.toArray(new ClientInterceptor[interceptors.size()]));
}
```
Hope this helps! | |
Waikato/moa | moa/src/main/java/moa/classifiers/rules/AbstractAMRules.java | AbstractAMRules.getModelDescription | @Override
public void getModelDescription(StringBuilder out, int indent) {
indent=0;
if(!this.unorderedRulesOption.isSet()){
StringUtils.appendIndented(out, indent, "Method Ordered");
StringUtils.appendNewline(out);
}else{
StringUtils.appendIndented(out, indent, "Method Unordered");
StringUtils.appen... | java | @Override
public void getModelDescription(StringBuilder out, int indent) {
indent=0;
if(!this.unorderedRulesOption.isSet()){
StringUtils.appendIndented(out, indent, "Method Ordered");
StringUtils.appendNewline(out);
}else{
StringUtils.appendIndented(out, indent, "Method Unordered");
StringUtils.appen... | [
"@",
"Override",
"public",
"void",
"getModelDescription",
"(",
"StringBuilder",
"out",
",",
"int",
"indent",
")",
"{",
"indent",
"=",
"0",
";",
"if",
"(",
"!",
"this",
".",
"unorderedRulesOption",
".",
"isSet",
"(",
")",
")",
"{",
"StringUtils",
".",
"ap... | print GUI learn model | [
"print",
"GUI",
"learn",
"model"
] | 395982e5100bfe75a3a4d26115462ce2cc74cbb0 | https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/rules/AbstractAMRules.java#L305-L331 | train | Get the description of the rule set. | Create a Java method that does the following: "Get the description of the rule set.". | Of course, here is the Java code you requested:
```java
@Override
public void getModelDescription(StringBuilder out, int indent) {
indent=0;
if(!this.unorderedRulesOption.isSet()){
StringUtils.appendIndented(out, indent, "Method Ordered");
StringUtils.appendNewline(out);
}else{
StringUtils.appendIndent... | |
UrielCh/ovh-java-sdk | ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java | ApiOvhIp.ip_firewall_GET | public ArrayList<String> ip_firewall_GET(String ip, Boolean enabled, OvhFirewallStateEnum state) throws IOException {
String qPath = "/ip/{ip}/firewall";
StringBuilder sb = path(qPath, ip);
query(sb, "enabled", enabled);
query(sb, "state", state);
String resp = exec(qPath, "GET", sb.toString(), null);
retur... | java | public ArrayList<String> ip_firewall_GET(String ip, Boolean enabled, OvhFirewallStateEnum state) throws IOException {
String qPath = "/ip/{ip}/firewall";
StringBuilder sb = path(qPath, ip);
query(sb, "enabled", enabled);
query(sb, "state", state);
String resp = exec(qPath, "GET", sb.toString(), null);
retur... | [
"public",
"ArrayList",
"<",
"String",
">",
"ip_firewall_GET",
"(",
"String",
"ip",
",",
"Boolean",
"enabled",
",",
"OvhFirewallStateEnum",
"state",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/ip/{ip}/firewall\"",
";",
"StringBuilder",
"sb",
"=",... | Ip under firewall
REST: GET /ip/{ip}/firewall
@param enabled [required] Filter the value of enabled property (=)
@param state [required] Filter the value of state property (=)
@param ip [required] | [
"Ip",
"under",
"firewall"
] | 6d531a40e56e09701943e334c25f90f640c55701 | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java#L973-L980 | train | List of IPs firewall | Create a Java method that does the following: "List of IPs firewall". | Of course, here is the Java code you requested:
```java
public ArrayList<String> ip_firewall_GET(String ip, Boolean enabled, OvhFirewallStateEnum state) throws IOException {
String qPath = "/ip/{ip}/firewall";
StringBuilder sb = path(qPath, ip);
query(sb, "enabled", enabled);
query(sb, "state", state);
Strin... | |
facebook/nailgun | nailgun-examples/src/main/java/com/facebook/nailgun/examples/Hash.java | Hash.nailMain | public static void nailMain(NGContext context)
throws java.security.NoSuchAlgorithmException, java.io.IOException {
String[] args = context.getArgs();
if (args.length == 0) {
// display available algorithms
Set algs = getCryptoImpls("MessageDigest");
for (Object alg : algs) {
co... | java | public static void nailMain(NGContext context)
throws java.security.NoSuchAlgorithmException, java.io.IOException {
String[] args = context.getArgs();
if (args.length == 0) {
// display available algorithms
Set algs = getCryptoImpls("MessageDigest");
for (Object alg : algs) {
co... | [
"public",
"static",
"void",
"nailMain",
"(",
"NGContext",
"context",
")",
"throws",
"java",
".",
"security",
".",
"NoSuchAlgorithmException",
",",
"java",
".",
"io",
".",
"IOException",
"{",
"String",
"[",
"]",
"args",
"=",
"context",
".",
"getArgs",
"(",
... | Hashes client stdin, displays hash result to client stdout. Requires one command line
parameter, either the name of the hash algorithm to use (e.g., "MD5") or "?" to request a list
of available algorithms. Any exceptions become the problem of the user. | [
"Hashes",
"client",
"stdin",
"displays",
"hash",
"result",
"to",
"client",
"stdout",
".",
"Requires",
"one",
"command",
"line",
"parameter",
"either",
"the",
"name",
"of",
"the",
"hash",
"algorithm",
"to",
"use",
"(",
"e",
".",
"g",
".",
"MD5",
")",
"or"... | 948c51c5fce138c65bb3df369c3f7b4d01440605 | https://github.com/facebook/nailgun/blob/948c51c5fce138c65bb3df369c3f7b4d01440605/nailgun-examples/src/main/java/com/facebook/nailgun/examples/Hash.java#L78-L109 | train | Main method for the NailMain class. | Create a Java method that does the following: "Main method for the NailMain class.". | Of course, here is the Java code you requested:
```java
public static void nailMain(NGContext context)
throws java.security.NoSuchAlgorithmException, java.io.IOException {
String[] args = context.getArgs();
if (args.length == 0) {
// display available algorithms
Set algs = getCryptoImpls("Me... | |
kite-sdk/kite | kite-tools-parent/kite-tools/src/main/java/org/kitesdk/cli/commands/JSONSchemaCommand.java | JSONSchemaCommand.run | @Override
public int run() throws IOException {
Preconditions.checkArgument(samplePaths != null && !samplePaths.isEmpty(),
"Sample JSON path is required");
Preconditions.checkArgument(samplePaths.size() == 1,
"Only one JSON sample can be given");
// assume fields are nullable by default, ... | java | @Override
public int run() throws IOException {
Preconditions.checkArgument(samplePaths != null && !samplePaths.isEmpty(),
"Sample JSON path is required");
Preconditions.checkArgument(samplePaths.size() == 1,
"Only one JSON sample can be given");
// assume fields are nullable by default, ... | [
"@",
"Override",
"public",
"int",
"run",
"(",
")",
"throws",
"IOException",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"samplePaths",
"!=",
"null",
"&&",
"!",
"samplePaths",
".",
"isEmpty",
"(",
")",
",",
"\"Sample JSON path is required\"",
")",
";",
"Pr... | By default we look at first 10 records | [
"By",
"default",
"we",
"look",
"at",
"first",
"10",
"records"
] | 72bfb4b1a881af85808cd7f14bc3e15160a1e811 | https://github.com/kite-sdk/kite/blob/72bfb4b1a881af85808cd7f14bc3e15160a1e811/kite-tools-parent/kite-tools/src/main/java/org/kitesdk/cli/commands/JSONSchemaCommand.java#L70-L88 | train | This method is called by the base class to run the command. | Create a Java method that does the following: "This method is called by the base class to run the command.". | Of course, here is the Java code you requested:
```java
@Override
public int run() throws IOException {
Preconditions.checkArgument(samplePaths != null && !samplePaths.isEmpty(),
"Sample JSON path is required");
Preconditions.checkArgument(samplePaths.size() == 1,
"Only one JSON sample can be... | |
morimekta/providence | providence-thrift-compat/src/main/java/net/morimekta/providence/thrift/io/FramedBufferOutputStream.java | FramedBufferOutputStream.completeFrame | public void completeFrame() throws IOException {
int frameSize = buffer.position();
if (frameSize > 0) {
frameSizeBuffer.rewind();
try (ByteBufferOutputStream bos = new ByteBufferOutputStream(frameSizeBuffer);
BinaryWriter writer = new BigEndianBinaryWriter(bos))... | java | public void completeFrame() throws IOException {
int frameSize = buffer.position();
if (frameSize > 0) {
frameSizeBuffer.rewind();
try (ByteBufferOutputStream bos = new ByteBufferOutputStream(frameSizeBuffer);
BinaryWriter writer = new BigEndianBinaryWriter(bos))... | [
"public",
"void",
"completeFrame",
"(",
")",
"throws",
"IOException",
"{",
"int",
"frameSize",
"=",
"buffer",
".",
"position",
"(",
")",
";",
"if",
"(",
"frameSize",
">",
"0",
")",
"{",
"frameSizeBuffer",
".",
"rewind",
"(",
")",
";",
"try",
"(",
"Byte... | Write the frame at the current state, and reset the buffer to be able to
generate a new frame.
@throws IOException On failed write. | [
"Write",
"the",
"frame",
"at",
"the",
"current",
"state",
"and",
"reset",
"the",
"buffer",
"to",
"be",
"able",
"to",
"generate",
"a",
"new",
"frame",
"."
] | 7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa | https://github.com/morimekta/providence/blob/7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa/providence-thrift-compat/src/main/java/net/morimekta/providence/thrift/io/FramedBufferOutputStream.java#L90-L112 | train | Complete the frame. | Create a Java method that does the following: "Complete the frame.". | Of course, here is the Java code you requested:
```java
public void completeFrame() throws IOException {
int frameSize = buffer.position();
if (frameSize > 0) {
frameSizeBuffer.rewind();
try (ByteBufferOutputStream bos = new ByteBufferOutputStream(frameSizeBuffer);
... | |
lazy-koala/java-toolkit | fast-toolkit3d/src/main/java/com/thankjava/toolkit3d/core/encrypit/RSAWithBase64.java | RSAWithBase64.sign | public static String sign(String content, String priKey) {
return Base64Util.encode2String(RSA.sign(content.getBytes(), decryptPrivateKey(priKey)));
} | java | public static String sign(String content, String priKey) {
return Base64Util.encode2String(RSA.sign(content.getBytes(), decryptPrivateKey(priKey)));
} | [
"public",
"static",
"String",
"sign",
"(",
"String",
"content",
",",
"String",
"priKey",
")",
"{",
"return",
"Base64Util",
".",
"encode2String",
"(",
"RSA",
".",
"sign",
"(",
"content",
".",
"getBytes",
"(",
")",
",",
"decryptPrivateKey",
"(",
"priKey",
")... | 对内容进行加签,并base64字符串
@param content
@param priKey
@return | [
"对内容进行加签,并base64字符串"
] | f46055fae0cc73049597a3708e515f5c6582d27a | https://github.com/lazy-koala/java-toolkit/blob/f46055fae0cc73049597a3708e515f5c6582d27a/fast-toolkit3d/src/main/java/com/thankjava/toolkit3d/core/encrypit/RSAWithBase64.java#L140-L142 | train | Sign content with private key | Create a Java method that does the following: "Sign content with private key". | Of course, here is the Java code you requested:
```java
public static String sign(String content, String priKey) {
return Base64Util.encode2String(RSA.sign(content.getBytes(), decryptPrivateKey(priKey)));
}
```
Hope this helps! | |
ironjacamar/ironjacamar | sjc/src/main/java/org/ironjacamar/sjc/Main.java | Main.main | public static void main(final String[] args)
{
long l1 = System.currentTimeMillis();
try
{
final ThreadGroup threads = new ThreadGroup("ironjacamar");
Main.boot(args, threads);
LifeThread lifeThread = new LifeThread(threads);
lifeThread.start();
Runti... | java | public static void main(final String[] args)
{
long l1 = System.currentTimeMillis();
try
{
final ThreadGroup threads = new ThreadGroup("ironjacamar");
Main.boot(args, threads);
LifeThread lifeThread = new LifeThread(threads);
lifeThread.start();
Runti... | [
"public",
"static",
"void",
"main",
"(",
"final",
"String",
"[",
"]",
"args",
")",
"{",
"long",
"l1",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"try",
"{",
"final",
"ThreadGroup",
"threads",
"=",
"new",
"ThreadGroup",
"(",
"\"ironjacamar\"",
... | Main
@param args The arguments | [
"Main"
] | f0389ee7e62aa8b40ba09b251edad76d220ea796 | https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/sjc/src/main/java/org/ironjacamar/sjc/Main.java#L498-L537 | train | Main method of the IronJacamar application. | Create a Java method that does the following: "Main method of the IronJacamar application.". | Of course, here is the Java code you requested:
```java
public static void main(final String[] args)
{
long l1 = System.currentTimeMillis();
try
{
final ThreadGroup threads = new ThreadGroup("ironjacamar");
Main.boot(args, threads);
LifeThread lifeThread = new LifeThre... | |
aws/aws-sdk-java | aws-java-sdk-ecs/src/main/java/com/amazonaws/services/ecs/AmazonECSClient.java | AmazonECSClient.listAccountSettings | @Override
public ListAccountSettingsResult listAccountSettings(ListAccountSettingsRequest request) {
request = beforeClientExecution(request);
return executeListAccountSettings(request);
} | java | @Override
public ListAccountSettingsResult listAccountSettings(ListAccountSettingsRequest request) {
request = beforeClientExecution(request);
return executeListAccountSettings(request);
} | [
"@",
"Override",
"public",
"ListAccountSettingsResult",
"listAccountSettings",
"(",
"ListAccountSettingsRequest",
"request",
")",
"{",
"request",
"=",
"beforeClientExecution",
"(",
"request",
")",
";",
"return",
"executeListAccountSettings",
"(",
"request",
")",
";",
"}... | <p>
Lists the account settings for an Amazon ECS resource for a specified principal.
</p>
@param listAccountSettingsRequest
@return Result of the ListAccountSettings operation returned by the service.
@throws ServerException
These errors are usually caused by a server issue.
@throws ClientException
These errors are us... | [
"<p",
">",
"Lists",
"the",
"account",
"settings",
"for",
"an",
"Amazon",
"ECS",
"resource",
"for",
"a",
"specified",
"principal",
".",
"<",
"/",
"p",
">"
] | aa38502458969b2d13a1c3665a56aba600e4dbd0 | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-ecs/src/main/java/com/amazonaws/services/ecs/AmazonECSClient.java#L1711-L1715 | train | Retrieves a list of the settings for an account. | Create a Java method that does the following: "Retrieves a list of the settings for an account.". | Of course, here is the Java code you requested:
```java
@Override
public ListAccountSettingsResult listAccountSettings(ListAccountSettingsRequest request) {
request = beforeClientExecution(request);
return executeListAccountSettings(request);
}
```
Hope this helps! | |
Azure/azure-sdk-for-java | sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobStepsInner.java | JobStepsInner.listByVersionNext | public PagedList<JobStepInner> listByVersionNext(final String nextPageLink) {
ServiceResponse<Page<JobStepInner>> response = listByVersionNextSinglePageAsync(nextPageLink).toBlocking().single();
return new PagedList<JobStepInner>(response.body()) {
@Override
public Page<JobStepIn... | java | public PagedList<JobStepInner> listByVersionNext(final String nextPageLink) {
ServiceResponse<Page<JobStepInner>> response = listByVersionNextSinglePageAsync(nextPageLink).toBlocking().single();
return new PagedList<JobStepInner>(response.body()) {
@Override
public Page<JobStepIn... | [
"public",
"PagedList",
"<",
"JobStepInner",
">",
"listByVersionNext",
"(",
"final",
"String",
"nextPageLink",
")",
"{",
"ServiceResponse",
"<",
"Page",
"<",
"JobStepInner",
">>",
"response",
"=",
"listByVersionNextSinglePageAsync",
"(",
"nextPageLink",
")",
".",
"to... | Gets all job steps in the specified job version.
@param nextPageLink The NextLink from the previous successful call to List operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped ... | [
"Gets",
"all",
"job",
"steps",
"in",
"the",
"specified",
"job",
"version",
"."
] | aab183ddc6686c82ec10386d5a683d2691039626 | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobStepsInner.java#L831-L839 | train | Gets a list of all the job steps in a version of the application. | Create a Java method that does the following: "Gets a list of all the job steps in a version of the application.". | Of course, here is the Java code you requested:
```java
public PagedList<JobStepInner> listByVersionNext(final String nextPageLink) {
ServiceResponse<Page<JobStepInner>> response = listByVersionNextSinglePageAsync(nextPageLink).toBlocking().single();
return new PagedList<JobStepInner>(response.body()) ... | |
mebigfatguy/fb-contrib | src/main/java/com/mebigfatguy/fbcontrib/detect/UseSplit.java | UseSplit.visitCode | @Override
public void visitCode(Code obj) {
stack.resetForMethodEntry(this);
regValueType.clear();
state = State.SEEN_NOTHING;
loopStart = -1;
loopEnd = -1;
super.visitCode(obj);
} | java | @Override
public void visitCode(Code obj) {
stack.resetForMethodEntry(this);
regValueType.clear();
state = State.SEEN_NOTHING;
loopStart = -1;
loopEnd = -1;
super.visitCode(obj);
} | [
"@",
"Override",
"public",
"void",
"visitCode",
"(",
"Code",
"obj",
")",
"{",
"stack",
".",
"resetForMethodEntry",
"(",
"this",
")",
";",
"regValueType",
".",
"clear",
"(",
")",
";",
"state",
"=",
"State",
".",
"SEEN_NOTHING",
";",
"loopStart",
"=",
"-",... | implements the visitor to reset the stack
@param obj
the context object of the currently parsed code block | [
"implements",
"the",
"visitor",
"to",
"reset",
"the",
"stack"
] | 3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8 | https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/UseSplit.java#L92-L100 | train | implements the visitor to reset the stack and reset the regValueType | Create a Java method that does the following: "implements the visitor to reset the stack and reset the regValueType". | Of course, here is the Java code you requested:
```java
@Override
public void visitCode(Code obj) {
stack.resetForMethodEntry(this);
regValueType.clear();
state = State.SEEN_NOTHING;
loopStart = -1;
loopEnd = -1;
super.visitCode(obj);
}
```
Hope this helps! | |
Waikato/moa | moa/src/main/java/moa/clusterers/kmeanspm/ClusteringTreeHeadNode.java | ClusteringTreeHeadNode.addChild | @Override
public boolean addChild(ClusteringTreeNode e) {
assert (this.projections.get(0).length == e.getClusteringFeature()
.getCenter().length);
super.addChild(e);
Iterator<double[]> iIterProjections = this.projections.iterator();
Iterator<CuckooHashing<List<ClusteringTreeNode>>> iIterBuckets = this.buck... | java | @Override
public boolean addChild(ClusteringTreeNode e) {
assert (this.projections.get(0).length == e.getClusteringFeature()
.getCenter().length);
super.addChild(e);
Iterator<double[]> iIterProjections = this.projections.iterator();
Iterator<CuckooHashing<List<ClusteringTreeNode>>> iIterBuckets = this.buck... | [
"@",
"Override",
"public",
"boolean",
"addChild",
"(",
"ClusteringTreeNode",
"e",
")",
"{",
"assert",
"(",
"this",
".",
"projections",
".",
"get",
"(",
"0",
")",
".",
"length",
"==",
"e",
".",
"getClusteringFeature",
"(",
")",
".",
"getCenter",
"(",
")",... | /*
(non-Javadoc)
@see moa.evaluation.bico.ClusteringTreeNode#addChild(moa.evaluation.bico.
ClusteringTreeNode) | [
"/",
"*",
"(",
"non",
"-",
"Javadoc",
")"
] | 395982e5100bfe75a3a4d26115462ce2cc74cbb0 | https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/clusterers/kmeanspm/ClusteringTreeHeadNode.java#L189-L211 | train | Add a child to this node. | Create a Java method that does the following: "Add a child to this node.". | Of course, here is the Java code you requested:
```java
@Override
public boolean addChild(ClusteringTreeNode e) {
assert (this.projections.get(0).length == e.getClusteringFeature()
.getCenter().length);
super.addChild(e);
Iterator<double[]> iIterProjections = this.projections.iterator();
Iterator<CuckooHa... | |
Chorus-bdd/Chorus | extensions/chorus-selenium/src/main/java/org/chorusbdd/chorus/selenium/SeleniumLoggingSuppression.java | SeleniumLoggingSuppression.suppressLog4jLogging | private void suppressLog4jLogging() {
if ( ! log4jLoggingSuppressed.getAndSet(true) ) {
Logger logger = Logger.getLogger("org.apache.http");
logger.setLevel(Level.ERROR);
logger.addAppender(new ConsoleAppender());
}
} | java | private void suppressLog4jLogging() {
if ( ! log4jLoggingSuppressed.getAndSet(true) ) {
Logger logger = Logger.getLogger("org.apache.http");
logger.setLevel(Level.ERROR);
logger.addAppender(new ConsoleAppender());
}
} | [
"private",
"void",
"suppressLog4jLogging",
"(",
")",
"{",
"if",
"(",
"!",
"log4jLoggingSuppressed",
".",
"getAndSet",
"(",
"true",
")",
")",
"{",
"Logger",
"logger",
"=",
"Logger",
".",
"getLogger",
"(",
"\"org.apache.http\"",
")",
";",
"logger",
".",
"setLe... | We don't want this in the Chorus interpreter output by default | [
"We",
"don",
"t",
"want",
"this",
"in",
"the",
"Chorus",
"interpreter",
"output",
"by",
"default"
] | 1eea7ca858876bce821bb49b43fd5b6ba1737997 | https://github.com/Chorus-bdd/Chorus/blob/1eea7ca858876bce821bb49b43fd5b6ba1737997/extensions/chorus-selenium/src/main/java/org/chorusbdd/chorus/selenium/SeleniumLoggingSuppression.java#L52-L58 | train | Set the log4j logging flag to true. | Create a Java method that does the following: "Set the log4j logging flag to true.". | Of course, here is the Java code you requested:
```java
private void suppressLog4jLogging() {
if ( ! log4jLoggingSuppressed.getAndSet(true) ) {
Logger logger = Logger.getLogger("org.apache.http");
logger.setLevel(Level.ERROR);
logger.addAppender(new ConsoleAppender());
... | |
JDBDT/jdbdt | src/main/java/org/jdbdt/QueryBuilder.java | QueryBuilder.arguments | @SafeVarargs
public final QueryBuilder arguments(Object...args) {
set(Param.QUERY_ARGS, "");
queryArgs = args.clone();
return this;
} | java | @SafeVarargs
public final QueryBuilder arguments(Object...args) {
set(Param.QUERY_ARGS, "");
queryArgs = args.clone();
return this;
} | [
"@",
"SafeVarargs",
"public",
"final",
"QueryBuilder",
"arguments",
"(",
"Object",
"...",
"args",
")",
"{",
"set",
"(",
"Param",
".",
"QUERY_ARGS",
",",
"\"\"",
")",
";",
"queryArgs",
"=",
"args",
".",
"clone",
"(",
")",
";",
"return",
"this",
";",
"}"... | Set arguments for query.
@param args Arguments.
@return The query builder instance for chained calls. | [
"Set",
"arguments",
"for",
"query",
"."
] | 7e32845ad41dfbc5d6fd0fd561e3613697186df4 | https://github.com/JDBDT/jdbdt/blob/7e32845ad41dfbc5d6fd0fd561e3613697186df4/src/main/java/org/jdbdt/QueryBuilder.java#L225-L230 | train | Set the query arguments. | Create a Java method that does the following: "Set the query arguments.". | Of course, here is the Java code you requested:
```java
@SafeVarargs
public final QueryBuilder arguments(Object...args) {
set(Param.QUERY_ARGS, "");
queryArgs = args.clone();
return this;
}
```
Hope this helps! | |
teatrove/teatrove | teaservlet/src/main/java/org/teatrove/teaservlet/ApplicationDepot.java | ApplicationDepot.cleanName | public static String cleanName(String name) {
int index = name.indexOf('-');
if (index > 0) {
name = name.substring(0, index);
}
int length = name.length();
StringBuffer buf = new StringBuffer(length + 1);
if (!Character.isJavaIdentifierStart(name.charAt(0))... | java | public static String cleanName(String name) {
int index = name.indexOf('-');
if (index > 0) {
name = name.substring(0, index);
}
int length = name.length();
StringBuffer buf = new StringBuffer(length + 1);
if (!Character.isJavaIdentifierStart(name.charAt(0))... | [
"public",
"static",
"String",
"cleanName",
"(",
"String",
"name",
")",
"{",
"int",
"index",
"=",
"name",
".",
"indexOf",
"(",
"'",
"'",
")",
";",
"if",
"(",
"index",
">",
"0",
")",
"{",
"name",
"=",
"name",
".",
"substring",
"(",
"0",
",",
"index... | Ensures that name only contains valid Java identifiers by converting
non identifier characters to '$' characters. If name begins with a
numeral, name is prefixed with an underscore. The returned name is also
trimmed at the first hyphen character, if there is one. This allows
multiple applications to appear to provide a... | [
"Ensures",
"that",
"name",
"only",
"contains",
"valid",
"Java",
"identifiers",
"by",
"converting",
"non",
"identifier",
"characters",
"to",
"$",
"characters",
".",
"If",
"name",
"begins",
"with",
"a",
"numeral",
"name",
"is",
"prefixed",
"with",
"an",
"undersc... | 7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea | https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/teaservlet/src/main/java/org/teatrove/teaservlet/ApplicationDepot.java#L258-L285 | train | Clean a name for a class. | Create a Java method that does the following: "Clean a name for a class.". | Of course, here is the Java code you requested:
```java
public static String cleanName(String name) {
int index = name.indexOf('-');
if (index > 0) {
name = name.substring(0, index);
}
int length = name.length();
StringBuffer buf = new StringBuffer(length + 1);
... | |
arquillian/arquillian-algeron | common/git/src/main/java/org/arquillian/algeron/git/GitOperations.java | GitOperations.isLocalBranch | public boolean isLocalBranch(final Git git, final String branch) {
try {
final List<Ref> refs = git.branchList().call();
return refs.stream()
.anyMatch(ref -> ref.getName().endsWith(branch));
} catch (GitAPIException e) {
throw new IllegalStateExceptio... | java | public boolean isLocalBranch(final Git git, final String branch) {
try {
final List<Ref> refs = git.branchList().call();
return refs.stream()
.anyMatch(ref -> ref.getName().endsWith(branch));
} catch (GitAPIException e) {
throw new IllegalStateExceptio... | [
"public",
"boolean",
"isLocalBranch",
"(",
"final",
"Git",
"git",
",",
"final",
"String",
"branch",
")",
"{",
"try",
"{",
"final",
"List",
"<",
"Ref",
">",
"refs",
"=",
"git",
".",
"branchList",
"(",
")",
".",
"call",
"(",
")",
";",
"return",
"refs",... | Checks if given branch has been checkedout locally too.
@param git
instance.
@param branch
to check.
@return True if it is local, false otherwise. | [
"Checks",
"if",
"given",
"branch",
"has",
"been",
"checkedout",
"locally",
"too",
"."
] | ec79372defdafe99ab2f7bb696f1c1eabdbbacb6 | https://github.com/arquillian/arquillian-algeron/blob/ec79372defdafe99ab2f7bb696f1c1eabdbbacb6/common/git/src/main/java/org/arquillian/algeron/git/GitOperations.java#L97-L105 | train | Check if a branch is local. | Create a Java method that does the following: "Check if a branch is local.". | Of course, here is the Java code you requested:
```java
public boolean isLocalBranch(final Git git, final String branch) {
try {
final List<Ref> refs = git.branchList().call();
return refs.stream()
.anyMatch(ref -> ref.getName().endsWith(branch));
} catch (GitAPI... | |
b3dgs/lionengine | lionengine-network/src/main/java/com/b3dgs/lionengine/network/ClientSocket.java | ClientSocket.sendMessage | public void sendMessage(byte data)
{
try
{
out.write(data);
out.flush();
}
catch (final IOException exception)
{
Verbose.exception(exception);
}
} | java | public void sendMessage(byte data)
{
try
{
out.write(data);
out.flush();
}
catch (final IOException exception)
{
Verbose.exception(exception);
}
} | [
"public",
"void",
"sendMessage",
"(",
"byte",
"data",
")",
"{",
"try",
"{",
"out",
".",
"write",
"(",
"data",
")",
";",
"out",
".",
"flush",
"(",
")",
";",
"}",
"catch",
"(",
"final",
"IOException",
"exception",
")",
"{",
"Verbose",
".",
"exception",... | Send message to the client.
@param data The messages data. | [
"Send",
"message",
"to",
"the",
"client",
"."
] | cac3d5578532cf11724a737b9f09e71bf9995ab2 | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-network/src/main/java/com/b3dgs/lionengine/network/ClientSocket.java#L175-L186 | train | Send a message to the underlying stream. | Create a Java method that does the following: "Send a message to the underlying stream.". | Of course, here is the Java code you requested:
```java
public void sendMessage(byte data)
{
try
{
out.write(data);
out.flush();
}
catch (final IOException exception)
{
Verbose.exception(exception);
}
}
```
Hope this helps! | |
opensourceBIM/BIMserver | PluginBase/generated/org/bimserver/models/ifc4/impl/Ifc4PackageImpl.java | Ifc4PackageImpl.getIfcDoorStyleOperationEnum | @Override
public EEnum getIfcDoorStyleOperationEnum() {
if (ifcDoorStyleOperationEnumEEnum == null) {
ifcDoorStyleOperationEnumEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(968);
}
return ifcDoorStyleOperationEnumEEnum;
} | java | @Override
public EEnum getIfcDoorStyleOperationEnum() {
if (ifcDoorStyleOperationEnumEEnum == null) {
ifcDoorStyleOperationEnumEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(968);
}
return ifcDoorStyleOperationEnumEEnum;
} | [
"@",
"Override",
"public",
"EEnum",
"getIfcDoorStyleOperationEnum",
"(",
")",
"{",
"if",
"(",
"ifcDoorStyleOperationEnumEEnum",
"==",
"null",
")",
"{",
"ifcDoorStyleOperationEnumEEnum",
"=",
"(",
"EEnum",
")",
"EPackage",
".",
"Registry",
".",
"INSTANCE",
".",
"ge... | <!-- begin-user-doc -->
<!-- end-user-doc -->
@generated | [
"<!",
"--",
"begin",
"-",
"user",
"-",
"doc",
"--",
">",
"<!",
"--",
"end",
"-",
"user",
"-",
"doc",
"--",
">"
] | 116803c3047d1b32217366757cee1bb3880fda63 | https://github.com/opensourceBIM/BIMserver/blob/116803c3047d1b32217366757cee1bb3880fda63/PluginBase/generated/org/bimserver/models/ifc4/impl/Ifc4PackageImpl.java#L45186-L45193 | train | Override the method to get the related docbook style operation enum. | Create a Java method that does the following: "Override the method to get the related docbook style operation enum.". | Of course, here is the Java code you requested:
```java
@Override
public EEnum getIfcDoorStyleOperationEnum() {
if (ifcDoorStyleOperationEnumEEnum == null) {
ifcDoorStyleOperationEnumEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(968);
}
return i... | |
Impetus/Kundera | src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/schemamanager/CassandraDataTranslator.java | CassandraDataTranslator.compose | public static byte[] compose(Class<?> dataTypeClazz, Object dataValue, boolean isCql3Enabled)
{
if (isCql3Enabled || (!isCql3Enabled && dataValue != null))
{
switch (getCassandraDataTypeClass(dataTypeClazz))
{
case INT:
return IntegerTypeBuilder.... | java | public static byte[] compose(Class<?> dataTypeClazz, Object dataValue, boolean isCql3Enabled)
{
if (isCql3Enabled || (!isCql3Enabled && dataValue != null))
{
switch (getCassandraDataTypeClass(dataTypeClazz))
{
case INT:
return IntegerTypeBuilder.... | [
"public",
"static",
"byte",
"[",
"]",
"compose",
"(",
"Class",
"<",
"?",
">",
"dataTypeClazz",
",",
"Object",
"dataValue",
",",
"boolean",
"isCql3Enabled",
")",
"{",
"if",
"(",
"isCql3Enabled",
"||",
"(",
"!",
"isCql3Enabled",
"&&",
"dataValue",
"!=",
"nul... | Calls compose function of respective data type of object.
@param dataTypeClazz
the data type clazz
@param dataValue
the data value
@param isCql3Enabled
the is cql3 enabled
@return the byte[] | [
"Calls",
"compose",
"function",
"of",
"respective",
"data",
"type",
"of",
"object",
"."
] | 268958ab1ec09d14ec4d9184f0c8ded7a9158908 | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/schemamanager/CassandraDataTranslator.java#L288-L343 | train | compose the data type from the given data value using the CQL3 implementation. | Create a Java method that does the following: "compose the data type from the given data value using the CQL3 implementation.". | Of course, here is the Java code you requested:
```java
public static byte[] compose(Class<?> dataTypeClazz, Object dataValue, boolean isCql3Enabled)
{
if (isCql3Enabled || (!isCql3Enabled && dataValue != null))
{
switch (getCassandraDataTypeClass(dataTypeClazz))
{
... | |
RuedigerMoeller/fast-serialization | src/main/java/org/nustaq/offheap/structs/FSTStructChange.java | FSTStructChange.snapshotChanges | public void snapshotChanges(int originBase, Bytez origin) {
int sumLen = 0;
for (int i = 0; i < curIndex; i++) {
sumLen += changeLength[i];
}
snapshot = new byte[sumLen];
int targetIdx = 0;
for (int i = 0; i < curIndex; i++) {
int changeOffset = ch... | java | public void snapshotChanges(int originBase, Bytez origin) {
int sumLen = 0;
for (int i = 0; i < curIndex; i++) {
sumLen += changeLength[i];
}
snapshot = new byte[sumLen];
int targetIdx = 0;
for (int i = 0; i < curIndex; i++) {
int changeOffset = ch... | [
"public",
"void",
"snapshotChanges",
"(",
"int",
"originBase",
",",
"Bytez",
"origin",
")",
"{",
"int",
"sumLen",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"curIndex",
";",
"i",
"++",
")",
"{",
"sumLen",
"+=",
"changeLength",
... | collects all changes and rebases.
@param originBase
@param origin | [
"collects",
"all",
"changes",
"and",
"rebases",
"."
] | 59f8f800b79479d0b9c80901cf55903d9b027f26 | https://github.com/RuedigerMoeller/fast-serialization/blob/59f8f800b79479d0b9c80901cf55903d9b027f26/src/main/java/org/nustaq/offheap/structs/FSTStructChange.java#L98-L113 | test | Snapshot the changes of the source file to the target file. | Create a Java method that does the following: "Snapshot the changes of the source file to the target file.". | Of course, here is the Java code you requested:
```java
public void snapshotChanges(int originBase, Bytez origin) {
int sumLen = 0;
for (int i = 0; i < curIndex; i++) {
sumLen += changeLength[i];
}
snapshot = new byte[sumLen];
int targetIdx = 0;
for (int i = ... | |
fozziethebeat/S-Space | src/main/java/edu/ucla/sspace/util/primitive/IntIntHashMultiMap.java | IntIntHashMultiMap.containsMapping | public boolean containsMapping(Object key, Object value) {
if (!(key instanceof Integer && value instanceof Integer))
return false;
Integer i = (Integer)key;
Integer j = (Integer)value;
return containsMapping(i.intValue(), j.intValue());
} | java | public boolean containsMapping(Object key, Object value) {
if (!(key instanceof Integer && value instanceof Integer))
return false;
Integer i = (Integer)key;
Integer j = (Integer)value;
return containsMapping(i.intValue(), j.intValue());
} | [
"public",
"boolean",
"containsMapping",
"(",
"Object",
"key",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"!",
"(",
"key",
"instanceof",
"Integer",
"&&",
"value",
"instanceof",
"Integer",
")",
")",
"return",
"false",
";",
"Integer",
"i",
"=",
"(",
"Inte... | {@inheritDoc} | [
"{"
] | a608102737dfd3d59038a9ead33fe60356bc6029 | https://github.com/fozziethebeat/S-Space/blob/a608102737dfd3d59038a9ead33fe60356bc6029/src/main/java/edu/ucla/sspace/util/primitive/IntIntHashMultiMap.java#L125-L131 | train | Check if the mapping is present in the cache. | Create a Java method that does the following: "Check if the mapping is present in the cache.". | Of course, here is the Java code you requested:
```java
public boolean containsMapping(Object key, Object value) {
if (!(key instanceof Integer && value instanceof Integer))
return false;
Integer i = (Integer)key;
Integer j = (Integer)value;
return containsMapping(i.intValue... | |
oblac/jodd | jodd-core/src/main/java/jodd/exception/ExceptionUtil.java | ExceptionUtil.getCurrentStackTrace | @SuppressWarnings({"ThrowCaughtLocally"})
public static StackTraceElement[] getCurrentStackTrace() {
StackTraceElement[] ste = new Exception().getStackTrace();
if (ste.length > 1) {
StackTraceElement[] result = new StackTraceElement[ste.length - 1];
System.arraycopy(ste, 1, result, 0, ste.length - 1);
ret... | java | @SuppressWarnings({"ThrowCaughtLocally"})
public static StackTraceElement[] getCurrentStackTrace() {
StackTraceElement[] ste = new Exception().getStackTrace();
if (ste.length > 1) {
StackTraceElement[] result = new StackTraceElement[ste.length - 1];
System.arraycopy(ste, 1, result, 0, ste.length - 1);
ret... | [
"@",
"SuppressWarnings",
"(",
"{",
"\"ThrowCaughtLocally\"",
"}",
")",
"public",
"static",
"StackTraceElement",
"[",
"]",
"getCurrentStackTrace",
"(",
")",
"{",
"StackTraceElement",
"[",
"]",
"ste",
"=",
"new",
"Exception",
"(",
")",
".",
"getStackTrace",
"(",
... | Returns current stack trace in form of array of stack trace elements.
First stack trace element is removed.
Since an exception is thrown internally, this method is slow. | [
"Returns",
"current",
"stack",
"trace",
"in",
"form",
"of",
"array",
"of",
"stack",
"trace",
"elements",
".",
"First",
"stack",
"trace",
"element",
"is",
"removed",
".",
"Since",
"an",
"exception",
"is",
"thrown",
"internally",
"this",
"method",
"is",
"slow"... | 85ad7f813ec0e07ecd27042aeb47ff2047631fa5 | https://github.com/oblac/jodd/blob/85ad7f813ec0e07ecd27042aeb47ff2047631fa5/jodd-core/src/main/java/jodd/exception/ExceptionUtil.java#L49-L59 | test | Get the current stack trace. | Create a Java method that does the following: "Get the current stack trace.". | Of course, here is the Java code you requested:
```java
@SuppressWarnings({"ThrowCaughtLocally"})
public static StackTraceElement[] getCurrentStackTrace() {
StackTraceElement[] ste = new Exception().getStackTrace();
if (ste.length > 1) {
StackTraceElement[] result = new StackTraceElement[ste.length - 1];
Sy... | |
jalkanen/speed4j | src/main/java/com/ecyrd/speed4j/log/PeriodicalLog.java | PeriodicalLog.rebuildJmx | private void rebuildJmx()
{
m_mbeanServer = ManagementFactory.getPlatformMBeanServer();
try
{
buildMBeanInfo();
//
// Remove and reinstall from the MBean registry if it already exists. Also
// remove previous instances.
//
... | java | private void rebuildJmx()
{
m_mbeanServer = ManagementFactory.getPlatformMBeanServer();
try
{
buildMBeanInfo();
//
// Remove and reinstall from the MBean registry if it already exists. Also
// remove previous instances.
//
... | [
"private",
"void",
"rebuildJmx",
"(",
")",
"{",
"m_mbeanServer",
"=",
"ManagementFactory",
".",
"getPlatformMBeanServer",
"(",
")",
";",
"try",
"{",
"buildMBeanInfo",
"(",
")",
";",
"//",
"// Remove and reinstall from the MBean registry if it already exists. Also",
"// ... | Rebuild the JMX bean. | [
"Rebuild",
"the",
"JMX",
"bean",
"."
] | 1d2db9c9b9def869c25fedb9bbd7cf95c39023bd | https://github.com/jalkanen/speed4j/blob/1d2db9c9b9def869c25fedb9bbd7cf95c39023bd/src/main/java/com/ecyrd/speed4j/log/PeriodicalLog.java#L279-L322 | train | Rebuilds the JMX bean. | Create a Java method that does the following: "Rebuilds the JMX bean.". | Of course, here is the Java code you requested:
```java
private void rebuildJmx()
{
m_mbeanServer = ManagementFactory.getPlatformMBeanServer();
try
{
buildMBeanInfo();
//
// Remove and reinstall from the MBean registry if it already exists. Also
... | |
tupilabs/tap4j | tap4j/src/main/java/org/tap4j/representer/TapJunitRepresenter.java | TapJunitRepresenter.representData | public String representData(TestSet testSet) {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
pw.println("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>"); // TBD: get
// encoding
... | java | public String representData(TestSet testSet) {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
pw.println("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>"); // TBD: get
// encoding
... | [
"public",
"String",
"representData",
"(",
"TestSet",
"testSet",
")",
"{",
"StringWriter",
"sw",
"=",
"new",
"StringWriter",
"(",
")",
";",
"PrintWriter",
"pw",
"=",
"new",
"PrintWriter",
"(",
"sw",
")",
";",
"pw",
".",
"println",
"(",
"\"<?xml version=\\\"1.... | {@inheritDoc} | [
"{"
] | 1793b653ce7f3a06a7b5c9557cdf601e28dd1f55 | https://github.com/tupilabs/tap4j/blob/1793b653ce7f3a06a7b5c9557cdf601e28dd1f55/tap4j/src/main/java/org/tap4j/representer/TapJunitRepresenter.java#L59-L103 | train | This method is used to represent the XML data for a single TestSet. | Create a Java method that does the following: "This method is used to represent the XML data for a single TestSet.". | Of course, here is the Java code you requested:
```java
public String representData(TestSet testSet) {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
pw.println("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>"); // TBD: get
... | |
boonproject/boon | boon/src/main/java/org/boon/core/reflection/Invoker.java | Invoker.invokeMethodFromObjectArg | public static Object invokeMethodFromObjectArg(Object object, MethodAccess method, Object args) {
return invokeMethodFromObjectArg(false, null, null, object, method, args);
} | java | public static Object invokeMethodFromObjectArg(Object object, MethodAccess method, Object args) {
return invokeMethodFromObjectArg(false, null, null, object, method, args);
} | [
"public",
"static",
"Object",
"invokeMethodFromObjectArg",
"(",
"Object",
"object",
",",
"MethodAccess",
"method",
",",
"Object",
"args",
")",
"{",
"return",
"invokeMethodFromObjectArg",
"(",
"false",
",",
"null",
",",
"null",
",",
"object",
",",
"method",
",",
... | Invokes method from list or map depending on what the Object arg is.
@param object
@param method
@param args
@return | [
"Invokes",
"method",
"from",
"list",
"or",
"map",
"depending",
"on",
"what",
"the",
"Object",
"arg",
"is",
"."
] | 9bc6870dbe5dd58c45c18d8edb493e8efc089463 | https://github.com/boonproject/boon/blob/9bc6870dbe5dd58c45c18d8edb493e8efc089463/boon/src/main/java/org/boon/core/reflection/Invoker.java#L125-L128 | test | Invoke a method from an object. | Create a Java method that does the following: "Invoke a method from an object.". | Of course, here is the Java code you requested:
```java
public static Object invokeMethodFromObjectArg(Object object, MethodAccess method, Object args) {
return invokeMethodFromObjectArg(false, null, null, object, method, args);
}
```
Hope this helps! | |
carewebframework/carewebframework-core | org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/spring/FrameworkBeanFactory.java | FrameworkBeanFactory.registerBeanDefinition | @Override
public void registerBeanDefinition(String beanName, BeanDefinition beanDefinition) throws BeanDefinitionStoreException {
boolean canOverride = defaultOverriding;
BeanDefinition oldBeanDefinition = containsBeanDefinition(beanName) ? getBeanDefinition(beanName) : null;
String overrid... | java | @Override
public void registerBeanDefinition(String beanName, BeanDefinition beanDefinition) throws BeanDefinitionStoreException {
boolean canOverride = defaultOverriding;
BeanDefinition oldBeanDefinition = containsBeanDefinition(beanName) ? getBeanDefinition(beanName) : null;
String overrid... | [
"@",
"Override",
"public",
"void",
"registerBeanDefinition",
"(",
"String",
"beanName",
",",
"BeanDefinition",
"beanDefinition",
")",
"throws",
"BeanDefinitionStoreException",
"{",
"boolean",
"canOverride",
"=",
"defaultOverriding",
";",
"BeanDefinition",
"oldBeanDefinition... | Intercepts the call set the override behavior of the bean factory prior to registering the
bean. The override behavior is set to the cwf:override setting of the bean definition or, in
the absence of this setting, to the default override behavior for the bean factory and by the
cwf:final setting which can be used to pre... | [
"Intercepts",
"the",
"call",
"set",
"the",
"override",
"behavior",
"of",
"the",
"bean",
"factory",
"prior",
"to",
"registering",
"the",
"bean",
".",
"The",
"override",
"behavior",
"is",
"set",
"to",
"the",
"cwf",
":",
"override",
"setting",
"of",
"the",
"b... | fa3252d4f7541dbe151b92c3d4f6f91433cd1673 | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/spring/FrameworkBeanFactory.java#L143-L174 | train | Override the beanDefinition with the CDI - specific attributes. | Create a Java method that does the following: "Override the beanDefinition with the CDI - specific attributes.". | Of course, here is the Java code you requested:
```java
@Override
public void registerBeanDefinition(String beanName, BeanDefinition beanDefinition) throws BeanDefinitionStoreException {
boolean canOverride = defaultOverriding;
BeanDefinition oldBeanDefinition = containsBeanDefinition(beanName) ? g... | |
google/closure-compiler | src/com/google/javascript/rhino/HamtPMap.java | HamtPMap.get | private V get(K key, int hash) {
if (hash == this.hash && key.equals(this.key)) {
return this.value;
}
int bucket = bucket(hash);
int bucketMask = 1 << bucket;
return (mask & bucketMask) != 0 ? children[index(bucketMask)].get(key, shift(hash)) : null;
} | java | private V get(K key, int hash) {
if (hash == this.hash && key.equals(this.key)) {
return this.value;
}
int bucket = bucket(hash);
int bucketMask = 1 << bucket;
return (mask & bucketMask) != 0 ? children[index(bucketMask)].get(key, shift(hash)) : null;
} | [
"private",
"V",
"get",
"(",
"K",
"key",
",",
"int",
"hash",
")",
"{",
"if",
"(",
"hash",
"==",
"this",
".",
"hash",
"&&",
"key",
".",
"equals",
"(",
"this",
".",
"key",
")",
")",
"{",
"return",
"this",
".",
"value",
";",
"}",
"int",
"bucket",
... | Internal recursive implementation of get(K). | [
"Internal",
"recursive",
"implementation",
"of",
"get",
"(",
"K",
")",
"."
] | d81e36740f6a9e8ac31a825ee8758182e1dc5aae | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/HamtPMap.java#L171-L178 | train | Get the value for the given key and hash. | Create a Java method that does the following: "Get the value for the given key and hash.". | Of course, here is the Java code you requested:
```java
private V get(K key, int hash) {
if (hash == this.hash && key.equals(this.key)) {
return this.value;
}
int bucket = bucket(hash);
int bucketMask = 1 << bucket;
return (mask & bucketMask) != 0 ? children[index(bucketMask)].get(key, shift(... | |
jbossas/jboss-vfs | src/main/java/org/jboss/vfs/VFSUtils.java | VFSUtils.safeClose | public static void safeClose(final ZipFile zipFile) {
if (zipFile != null) {
try {
zipFile.close();
} catch (Exception e) {
VFSLogger.ROOT_LOGGER.trace("Failed to close resource", e);
}
}
} | java | public static void safeClose(final ZipFile zipFile) {
if (zipFile != null) {
try {
zipFile.close();
} catch (Exception e) {
VFSLogger.ROOT_LOGGER.trace("Failed to close resource", e);
}
}
} | [
"public",
"static",
"void",
"safeClose",
"(",
"final",
"ZipFile",
"zipFile",
")",
"{",
"if",
"(",
"zipFile",
"!=",
"null",
")",
"{",
"try",
"{",
"zipFile",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"VFSLogger",
".",
... | Safely close some resource without throwing an exception. Any exception will be logged at TRACE level.
@param zipFile the resource | [
"Safely",
"close",
"some",
"resource",
"without",
"throwing",
"an",
"exception",
".",
"Any",
"exception",
"will",
"be",
"logged",
"at",
"TRACE",
"level",
"."
] | 420f4b896d6178ee5f6758f3421e9f350d2b8ab5 | https://github.com/jbossas/jboss-vfs/blob/420f4b896d6178ee5f6758f3421e9f350d2b8ab5/src/main/java/org/jboss/vfs/VFSUtils.java#L629-L637 | train | Close the zip file. | Create a Java method that does the following: "Close the zip file.". | Of course, here is the Java code you requested:
```java
public static void safeClose(final ZipFile zipFile) {
if (zipFile != null) {
try {
zipFile.close();
} catch (Exception e) {
VFSLogger.ROOT_LOGGER.trace("Failed to close resource", e);
}
... | |
strator-dev/greenpepper | greenpepper/greenpepper-client/src/main/java/com/greenpepper/server/domain/Specification.java | Specification.marshallize | public Vector<Object> marshallize()
{
Vector<Object> parameters = super.marshallize();
Vector<Object> suts = XmlRpcDataMarshaller.toXmlRpcSystemUnderTestsParameters(targetedSystemUnderTests);
parameters.add(SPECIFICATION_SUTS_IDX, suts);
if (isNotBlank(dialectClass)) {
pa... | java | public Vector<Object> marshallize()
{
Vector<Object> parameters = super.marshallize();
Vector<Object> suts = XmlRpcDataMarshaller.toXmlRpcSystemUnderTestsParameters(targetedSystemUnderTests);
parameters.add(SPECIFICATION_SUTS_IDX, suts);
if (isNotBlank(dialectClass)) {
pa... | [
"public",
"Vector",
"<",
"Object",
">",
"marshallize",
"(",
")",
"{",
"Vector",
"<",
"Object",
">",
"parameters",
"=",
"super",
".",
"marshallize",
"(",
")",
";",
"Vector",
"<",
"Object",
">",
"suts",
"=",
"XmlRpcDataMarshaller",
".",
"toXmlRpcSystemUnderTes... | <p>marshallize.</p>
@return a {@link java.util.Vector} object. | [
"<p",
">",
"marshallize",
".",
"<",
"/",
"p",
">"
] | 2a61e6c179b74085babcc559d677490b0cad2d30 | https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper/greenpepper-client/src/main/java/com/greenpepper/server/domain/Specification.java#L183-L192 | train | This method is overridden to add the parameters to the result vector. | Create a Java method that does the following: "This method is overridden to add the parameters to the result vector.". | Of course, here is the Java code you requested:
```java
public Vector<Object> marshallize()
{
Vector<Object> parameters = super.marshallize();
Vector<Object> suts = XmlRpcDataMarshaller.toXmlRpcSystemUnderTestsParameters(targetedSystemUnderTests);
parameters.add(SPECIFICATION_SUTS_IDX, suts... | |
rey5137/material | material/src/main/java/com/rey/material/app/Dialog.java | Dialog.contentMargin | public Dialog contentMargin(int left, int top, int right, int bottom){
mCardView.setContentMargin(left, top, right, bottom);
return this;
} | java | public Dialog contentMargin(int left, int top, int right, int bottom){
mCardView.setContentMargin(left, top, right, bottom);
return this;
} | [
"public",
"Dialog",
"contentMargin",
"(",
"int",
"left",
",",
"int",
"top",
",",
"int",
"right",
",",
"int",
"bottom",
")",
"{",
"mCardView",
".",
"setContentMargin",
"(",
"left",
",",
"top",
",",
"right",
",",
"bottom",
")",
";",
"return",
"this",
";"... | Set the margin between content view and Dialog border.
@param left The left margin size in pixels.
@param top The top margin size in pixels.
@param right The right margin size in pixels.
@param bottom The bottom margin size in pixels.
@return The Dialog for chaining methods. | [
"Set",
"the",
"margin",
"between",
"content",
"view",
"and",
"Dialog",
"border",
"."
] | 1bbcac2686a0023ef7720d3fe455bb116d115af8 | https://github.com/rey5137/material/blob/1bbcac2686a0023ef7720d3fe455bb116d115af8/material/src/main/java/com/rey/material/app/Dialog.java#L986-L989 | train | Set the margin of the content of the dialog. | Create a Java method that does the following: "Set the margin of the content of the dialog.". | Of course, here is the Java code you requested:
```java
public Dialog contentMargin(int left, int top, int right, int bottom){
mCardView.setContentMargin(left, top, right, bottom);
return this;
}
```
Hope this helps! | |
oblac/jodd | jodd-bean/src/main/java/jodd/bean/BeanUtilUtil.java | BeanUtilUtil.createBeanProperty | protected Object createBeanProperty(final BeanProperty bp) {
Setter setter = bp.getSetter(true);
if (setter == null) {
return null;
}
Class type = setter.getSetterRawType();
Object newInstance;
try {
newInstance = ClassUtil.newInstance(type);
} catch (Exception ex) {
if (isSilent) {
return ... | java | protected Object createBeanProperty(final BeanProperty bp) {
Setter setter = bp.getSetter(true);
if (setter == null) {
return null;
}
Class type = setter.getSetterRawType();
Object newInstance;
try {
newInstance = ClassUtil.newInstance(type);
} catch (Exception ex) {
if (isSilent) {
return ... | [
"protected",
"Object",
"createBeanProperty",
"(",
"final",
"BeanProperty",
"bp",
")",
"{",
"Setter",
"setter",
"=",
"bp",
".",
"getSetter",
"(",
"true",
")",
";",
"if",
"(",
"setter",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"Class",
"type",
... | Creates new instance for current property name through its setter.
It uses default constructor! | [
"Creates",
"new",
"instance",
"for",
"current",
"property",
"name",
"through",
"its",
"setter",
".",
"It",
"uses",
"default",
"constructor!"
] | 85ad7f813ec0e07ecd27042aeb47ff2047631fa5 | https://github.com/oblac/jodd/blob/85ad7f813ec0e07ecd27042aeb47ff2047631fa5/jodd-bean/src/main/java/jodd/bean/BeanUtilUtil.java#L262-L283 | test | Creates a new instance of the BeanProperty. | Create a Java method that does the following: "Creates a new instance of the BeanProperty.". | Of course, here is the Java code you requested:
```java
protected Object createBeanProperty(final BeanProperty bp) {
Setter setter = bp.getSetter(true);
if (setter == null) {
return null;
}
Class type = setter.getSetterRawType();
Object newInstance;
try {
newInstance = ClassUtil.newInstance(type);
... | |
smartsheet-platform/smartsheet-java-sdk | src/main/java/com/smartsheet/api/internal/AbstractResources.java | AbstractResources.postAndReceiveRowObject | protected CopyOrMoveRowResult postAndReceiveRowObject(String path, CopyOrMoveRowDirective objectToPost) throws SmartsheetException {
Util.throwIfNull(path, objectToPost);
Util.throwIfEmpty(path);
HttpRequest request = createHttpRequest(smartsheet.getBaseURI().resolve(path), HttpMethod.POST);
... | java | protected CopyOrMoveRowResult postAndReceiveRowObject(String path, CopyOrMoveRowDirective objectToPost) throws SmartsheetException {
Util.throwIfNull(path, objectToPost);
Util.throwIfEmpty(path);
HttpRequest request = createHttpRequest(smartsheet.getBaseURI().resolve(path), HttpMethod.POST);
... | [
"protected",
"CopyOrMoveRowResult",
"postAndReceiveRowObject",
"(",
"String",
"path",
",",
"CopyOrMoveRowDirective",
"objectToPost",
")",
"throws",
"SmartsheetException",
"{",
"Util",
".",
"throwIfNull",
"(",
"path",
",",
"objectToPost",
")",
";",
"Util",
".",
"throwI... | Post an object to Smartsheet REST API and receive a CopyOrMoveRowResult object from response.
Parameters: - path : the relative path of the resource collections - objectToPost : the object to post -
Returns: the object
Exceptions:
IllegalArgumentException : if any argument is null, or path is empty string
InvalidReq... | [
"Post",
"an",
"object",
"to",
"Smartsheet",
"REST",
"API",
"and",
"receive",
"a",
"CopyOrMoveRowResult",
"object",
"from",
"response",
"."
] | f60e264412076271f83b65889ef9b891fad83df8 | https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/AbstractResources.java#L669-L700 | train | Post and receive a single row object. | Create a Java method that does the following: "Post and receive a single row object.". | Of course, here is the Java code you requested:
```java
protected CopyOrMoveRowResult postAndReceiveRowObject(String path, CopyOrMoveRowDirective objectToPost) throws SmartsheetException {
Util.throwIfNull(path, objectToPost);
Util.throwIfEmpty(path);
HttpRequest request = createHttpRequest(sm... | |
wuman/orientdb-android | core/src/main/java/com/orientechnologies/orient/core/storage/impl/local/ODataLocalHole.java | ODataLocalHole.deleteHole | public synchronized void deleteHole(int iHolePosition) throws IOException {
// IN MEMORY
final ODataHoleInfo hole = availableHolesList.get(iHolePosition);
availableHolesBySize.remove(hole);
availableHolesByPosition.remove(hole);
hole.dataOffset = -1;
freeHoles.add(iHolePosition);
... | java | public synchronized void deleteHole(int iHolePosition) throws IOException {
// IN MEMORY
final ODataHoleInfo hole = availableHolesList.get(iHolePosition);
availableHolesBySize.remove(hole);
availableHolesByPosition.remove(hole);
hole.dataOffset = -1;
freeHoles.add(iHolePosition);
... | [
"public",
"synchronized",
"void",
"deleteHole",
"(",
"int",
"iHolePosition",
")",
"throws",
"IOException",
"{",
"// IN MEMORY\r",
"final",
"ODataHoleInfo",
"hole",
"=",
"availableHolesList",
".",
"get",
"(",
"iHolePosition",
")",
";",
"availableHolesBySize",
".",
"r... | Delete the hole
@param iRemoveAlsoFromMemory
@throws IOException | [
"Delete",
"the",
"hole"
] | ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0 | https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/core/src/main/java/com/orientechnologies/orient/core/storage/impl/local/ODataLocalHole.java#L273-L285 | train | Deletes the hole at the given position. | Create a Java method that does the following: "Deletes the hole at the given position.". | Of course, here is the Java code you requested:
```java
public synchronized void deleteHole(int iHolePosition) throws IOException {
// IN MEMORY
final ODataHoleInfo hole = availableHolesList.get(iHolePosition);
availableHolesBySize.remove(hole);
availableHolesByPosition.remove(hole);
hole.da... | |
Evol-Instruct | N/A | N/A | java | [] | [] | train | Write a Java program to convert a binary string to a decimal number. The binary string can have a maximum length of 32 characters. Additionally, the program should handle cases where the binary string contains leading or trailing whitespace characters. | Here is a Java program that converts a binary string to a decimal number while handling leading and trailing whitespace characters:
```java
public class BinaryToDecimal {
public static void main(String[] args) {
String binaryString = " 1010110 "; // example binary string with leading and trailing whitespac... | |||||||
phax/ph-commons | ph-datetime/src/main/java/com/helger/datetime/util/PDTHelper.java | PDTHelper.birthdayEquals | public static boolean birthdayEquals (@Nullable final LocalDate aDate1, @Nullable final LocalDate aDate2)
{
return birthdayCompare (aDate1, aDate2) == 0;
} | java | public static boolean birthdayEquals (@Nullable final LocalDate aDate1, @Nullable final LocalDate aDate2)
{
return birthdayCompare (aDate1, aDate2) == 0;
} | [
"public",
"static",
"boolean",
"birthdayEquals",
"(",
"@",
"Nullable",
"final",
"LocalDate",
"aDate1",
",",
"@",
"Nullable",
"final",
"LocalDate",
"aDate2",
")",
"{",
"return",
"birthdayCompare",
"(",
"aDate1",
",",
"aDate2",
")",
"==",
"0",
";",
"}"
] | Check if the two birthdays are equal. Equal birthdays are identified by
equal months and equal days.
@param aDate1
First date. May be <code>null</code>.
@param aDate2
Second date. May be <code>null</code>.
@return <code>true</code> if month and day are equal | [
"Check",
"if",
"the",
"two",
"birthdays",
"are",
"equal",
".",
"Equal",
"birthdays",
"are",
"identified",
"by",
"equal",
"months",
"and",
"equal",
"days",
"."
] | d28c03565f44a0b804d96028d0969f9bb38c4313 | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-datetime/src/main/java/com/helger/datetime/util/PDTHelper.java#L310-L313 | train | Check if two dates are equal. | Create a Java method that does the following: "Check if two dates are equal.". | Of course, here is the Java code you requested:
```java
public static boolean birthdayEquals (@Nullable final LocalDate aDate1, @Nullable final LocalDate aDate2)
{
return birthdayCompare (aDate1, aDate2) == 0;
}
```
Hope this helps! | |
Azure/azure-sdk-for-java | batchai/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/batchai/v2018_05_01/implementation/WorkspacesInner.java | WorkspacesInner.create | public WorkspaceInner create(String resourceGroupName, String workspaceName, WorkspaceCreateParameters parameters) {
return createWithServiceResponseAsync(resourceGroupName, workspaceName, parameters).toBlocking().last().body();
} | java | public WorkspaceInner create(String resourceGroupName, String workspaceName, WorkspaceCreateParameters parameters) {
return createWithServiceResponseAsync(resourceGroupName, workspaceName, parameters).toBlocking().last().body();
} | [
"public",
"WorkspaceInner",
"create",
"(",
"String",
"resourceGroupName",
",",
"String",
"workspaceName",
",",
"WorkspaceCreateParameters",
"parameters",
")",
"{",
"return",
"createWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"workspaceName",
",",
"parameters",... | Creates a Workspace.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param workspaceName The name of the workspace. Workspace names can only contain a combination of alphanumeric characters along with dash (-) and underscore (_). The name must be from 1 through 64 characters long.
@... | [
"Creates",
"a",
"Workspace",
"."
] | aab183ddc6686c82ec10386d5a683d2691039626 | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batchai/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/batchai/v2018_05_01/implementation/WorkspacesInner.java#L573-L575 | train | Creates a new CDN image source. | Create a Java method that does the following: "Creates a new CDN image source.". | Of course, here is the Java code you requested:
```java
public WorkspaceInner create(String resourceGroupName, String workspaceName, WorkspaceCreateParameters parameters) {
return createWithServiceResponseAsync(resourceGroupName, workspaceName, parameters).toBlocking().last().body();
}
```
Hope this helps... | |
iipc/webarchive-commons | src/main/java/org/archive/util/iterator/LookaheadIterator.java | LookaheadIterator.next | public T next() {
if (!hasNext()) {
throw new NoSuchElementException();
}
// 'next' is guaranteed non-null by a hasNext() which returned true
T returnObj = this.next;
this.next = null;
return returnObj;
} | java | public T next() {
if (!hasNext()) {
throw new NoSuchElementException();
}
// 'next' is guaranteed non-null by a hasNext() which returned true
T returnObj = this.next;
this.next = null;
return returnObj;
} | [
"public",
"T",
"next",
"(",
")",
"{",
"if",
"(",
"!",
"hasNext",
"(",
")",
")",
"{",
"throw",
"new",
"NoSuchElementException",
"(",
")",
";",
"}",
"// 'next' is guaranteed non-null by a hasNext() which returned true",
"T",
"returnObj",
"=",
"this",
".",
"next",
... | Return the next item.
@see java.util.Iterator#next() | [
"Return",
"the",
"next",
"item",
"."
] | 988bec707c27a01333becfc3bd502af4441ea1e1 | https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/util/iterator/LookaheadIterator.java#L57-L65 | train | Returns the next object in the iterator. | Create a Java method that does the following: "Returns the next object in the iterator.". | Of course, here is the Java code you requested:
```java
public T next() {
if (!hasNext()) {
throw new NoSuchElementException();
}
// 'next' is guaranteed non-null by a hasNext() which returned true
T returnObj = this.next;
this.next = null;
return returnObj;
... | |
asterisk-java/asterisk-java | src/main/java/org/asteriskjava/util/AstUtil.java | AstUtil.isTrue | public static boolean isTrue(Object o)
{
if (o == null)
{
return false;
}
if (o instanceof Boolean)
{
return (Boolean) o;
}
return TRUE_LITERALS.contains(o.toString().toLowerCase(Locale.US));
} | java | public static boolean isTrue(Object o)
{
if (o == null)
{
return false;
}
if (o instanceof Boolean)
{
return (Boolean) o;
}
return TRUE_LITERALS.contains(o.toString().toLowerCase(Locale.US));
} | [
"public",
"static",
"boolean",
"isTrue",
"(",
"Object",
"o",
")",
"{",
"if",
"(",
"o",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"o",
"instanceof",
"Boolean",
")",
"{",
"return",
"(",
"Boolean",
")",
"o",
";",
"}",
"return",
... | Checks if a String represents <code>true</code> or <code>false</code>
according to Asterisk's logic. <br>
The original implementation is <code>util.c</code> is as follows: <br>
<pre>
int ast_true(const char *s)
{
if (!s || ast_strlen_zero(s))
return 0;
<br>
if (!strcasecmp(s, "yes") ||
!strcasecmp(s, "t... | [
"Checks",
"if",
"a",
"String",
"represents",
"<code",
">",
"true<",
"/",
"code",
">",
"or",
"<code",
">",
"false<",
"/",
"code",
">",
"according",
"to",
"Asterisk",
"s",
"logic",
".",
"<br",
">",
"The",
"original",
"implementation",
"is",
"<code",
">",
... | cdc9849270d97ef75afa447a02c5194ed29121eb | https://github.com/asterisk-java/asterisk-java/blob/cdc9849270d97ef75afa447a02c5194ed29121eb/src/main/java/org/asteriskjava/util/AstUtil.java#L83-L96 | train | Returns true if the object o is a true object. | Create a Java method that does the following: "Returns true if the object o is a true object.". | Of course, here is the Java code you requested:
```java
public static boolean isTrue(Object o)
{
if (o == null)
{
return false;
}
if (o instanceof Boolean)
{
return (Boolean) o;
}
return TRUE_LITERALS.contains(o.toString().toLowerCas... | |
line/centraldogma | server/src/main/java/com/linecorp/centraldogma/server/internal/api/MetadataApiService.java | MetadataApiService.updateSpecificTokenPermission | @Patch("/metadata/{projectName}/repos/{repoName}/perm/tokens/{appId}")
@Consumes("application/json-patch+json")
public CompletableFuture<Revision> updateSpecificTokenPermission(@Param("projectName") String projectName,
@Param("repoName") Strin... | java | @Patch("/metadata/{projectName}/repos/{repoName}/perm/tokens/{appId}")
@Consumes("application/json-patch+json")
public CompletableFuture<Revision> updateSpecificTokenPermission(@Param("projectName") String projectName,
@Param("repoName") Strin... | [
"@",
"Patch",
"(",
"\"/metadata/{projectName}/repos/{repoName}/perm/tokens/{appId}\"",
")",
"@",
"Consumes",
"(",
"\"application/json-patch+json\"",
")",
"public",
"CompletableFuture",
"<",
"Revision",
">",
"updateSpecificTokenPermission",
"(",
"@",
"Param",
"(",
"\"projectNa... | PATCH /metadata/{projectName}/repos/{repoName}/perm/tokens/{appId}
<p>Updates {@link Permission}s for the specified {@code appId} of the specified {@code repoName}
in the specified {@code projectName}. | [
"PATCH",
"/",
"metadata",
"/",
"{",
"projectName",
"}",
"/",
"repos",
"/",
"{",
"repoName",
"}",
"/",
"perm",
"/",
"tokens",
"/",
"{",
"appId",
"}"
] | b9e46c67fbc26628c2186ce2f46e7fb303c831e9 | https://github.com/line/centraldogma/blob/b9e46c67fbc26628c2186ce2f46e7fb303c831e9/server/src/main/java/com/linecorp/centraldogma/server/internal/api/MetadataApiService.java#L258-L270 | train | Updates a specific token permission. | Create a Java method that does the following: "Updates a specific token permission.". | Of course, here is the Java code you requested:
```java
@Patch("/metadata/{projectName}/repos/{repoName}/perm/tokens/{appId}")
@Consumes("application/json-patch+json")
public CompletableFuture<Revision> updateSpecificTokenPermission(@Param("projectName") String projectName,
... | |
lemire/javaewah | src/main/java/com/googlecode/javaewah32/FastAggregation32.java | FastAggregation32.bufferedor | public static EWAHCompressedBitmap32 bufferedor(final int bufSize,
final EWAHCompressedBitmap32... bitmaps) {
EWAHCompressedBitmap32 answer = new EWAHCompressedBitmap32();
bufferedorWithContainer(answer, bufSize, bitmaps);
return answer;
} | java | public static EWAHCompressedBitmap32 bufferedor(final int bufSize,
final EWAHCompressedBitmap32... bitmaps) {
EWAHCompressedBitmap32 answer = new EWAHCompressedBitmap32();
bufferedorWithContainer(answer, bufSize, bitmaps);
return answer;
} | [
"public",
"static",
"EWAHCompressedBitmap32",
"bufferedor",
"(",
"final",
"int",
"bufSize",
",",
"final",
"EWAHCompressedBitmap32",
"...",
"bitmaps",
")",
"{",
"EWAHCompressedBitmap32",
"answer",
"=",
"new",
"EWAHCompressedBitmap32",
"(",
")",
";",
"bufferedorWithContai... | Compute the or aggregate using a temporary uncompressed bitmap.
@param bitmaps the source bitmaps
@param bufSize buffer size used during the computation in 64-bit
words
@return the or aggregate. | [
"Compute",
"the",
"or",
"aggregate",
"using",
"a",
"temporary",
"uncompressed",
"bitmap",
"."
] | ff04f8eb03eb1193842cf8009d0e94c5d2e3e70e | https://github.com/lemire/javaewah/blob/ff04f8eb03eb1193842cf8009d0e94c5d2e3e70e/src/main/java/com/googlecode/javaewah32/FastAggregation32.java#L98-L103 | valid | Create a new EWAH compressed bitmap. | Create a Java method that does the following: "Create a new EWAH compressed bitmap.". | Of course, here is the Java code you requested:
```java
public static EWAHCompressedBitmap32 bufferedor(final int bufSize,
final EWAHCompressedBitmap32... bitmaps) {
EWAHCompressedBitmap32 answer = new EWAHCompressedBitmap32();
bufferedorWithContainer... | |
ArpNetworking/commons | src/main/java/com/arpnetworking/commons/java/util/concurrent/CompletableFutures.java | CompletableFutures.allOf | public static CompletableFuture<?> allOf(final Collection<?> futures) {
@SuppressWarnings({"unchecked", "rawtypes"})
final CompletableFuture[] futuresArray = futures.toArray(new CompletableFuture[0]);
return CompletableFuture.allOf(futuresArray);
} | java | public static CompletableFuture<?> allOf(final Collection<?> futures) {
@SuppressWarnings({"unchecked", "rawtypes"})
final CompletableFuture[] futuresArray = futures.toArray(new CompletableFuture[0]);
return CompletableFuture.allOf(futuresArray);
} | [
"public",
"static",
"CompletableFuture",
"<",
"?",
">",
"allOf",
"(",
"final",
"Collection",
"<",
"?",
">",
"futures",
")",
"{",
"@",
"SuppressWarnings",
"(",
"{",
"\"unchecked\"",
",",
"\"rawtypes\"",
"}",
")",
"final",
"CompletableFuture",
"[",
"]",
"futur... | Variant of {@code CompletableFuture.allOf(CompletableFuture<?>...)}
that accepts a list of {@code CompletableFuture<T>} instead of an array.
Encapsulates the array creation and associated unsafe casting and raw
types warnings.
@param futures the CompletableFutures
@return a new CompletableFuture that is completed when... | [
"Variant",
"of",
"{",
"@code",
"CompletableFuture",
".",
"allOf",
"(",
"CompletableFuture<?",
">",
"...",
")",
"}",
"that",
"accepts",
"a",
"list",
"of",
"{",
"@code",
"CompletableFuture<T",
">",
"}",
"instead",
"of",
"an",
"array",
".",
"Encapsulates",
"the... | 36e18ee63312921551ade91dfbf769eccd04dc96 | https://github.com/ArpNetworking/commons/blob/36e18ee63312921551ade91dfbf769eccd04dc96/src/main/java/com/arpnetworking/commons/java/util/concurrent/CompletableFutures.java#L41-L45 | train | All of CompletableFuture. | Create a Java method that does the following: "All of CompletableFuture.". | Of course, here is the Java code you requested:
```java
public static CompletableFuture<?> allOf(final Collection<?> futures) {
@SuppressWarnings({"unchecked", "rawtypes"})
final CompletableFuture[] futuresArray = futures.toArray(new CompletableFuture[0]);
return CompletableFuture.allOf(futures... | |
haraldk/TwelveMonkeys | common/common-image/src/main/java/com/twelvemonkeys/image/ResampleOp.java | ResampleOp.calcXContrib | private ContributorList calcXContrib(double xscale, double fwidth, int srcwidth, InterpolationFilter pFilter, int i) {
// TODO: What to do when fwidth > srcwidyj or dstwidth
double width;
double fscale;
double center;
double weight;
ContributorList contribX = ne... | java | private ContributorList calcXContrib(double xscale, double fwidth, int srcwidth, InterpolationFilter pFilter, int i) {
// TODO: What to do when fwidth > srcwidyj or dstwidth
double width;
double fscale;
double center;
double weight;
ContributorList contribX = ne... | [
"private",
"ContributorList",
"calcXContrib",
"(",
"double",
"xscale",
",",
"double",
"fwidth",
",",
"int",
"srcwidth",
",",
"InterpolationFilter",
"pFilter",
",",
"int",
"i",
")",
"{",
"// TODO: What to do when fwidth > srcwidyj or dstwidth\r",
"double",
"width",
";",
... | /*
calcXContrib()
Calculates the filter weights for a single target column.
contribX->p must be freed afterwards.
Returns -1 if error, 0 otherwise. | [
"/",
"*",
"calcXContrib",
"()"
] | 7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/common/common-image/src/main/java/com/twelvemonkeys/image/ResampleOp.java#L1319-L1429 | train | Calculates the contributions for a single image. | Create a Java method that does the following: "Calculates the contributions for a single image.". | Of course, here is the Java code you requested:
```java
private ContributorList calcXContrib(double xscale, double fwidth, int srcwidth, InterpolationFilter pFilter, int i) {
// TODO: What to do when fwidth > srcwidyj or dstwidth
double width;
double fscale;
double center;
... | |
wildfly/wildfly-core | server/src/main/java/org/jboss/as/server/deployment/SimpleAttachable.java | SimpleAttachable.addToAttachmentList | public synchronized <T> void addToAttachmentList(final AttachmentKey<AttachmentList<T>> key, final T value) {
if (key != null) {
final Map<AttachmentKey<?>, Object> attachments = this.attachments;
final AttachmentList<T> list = key.cast(attachments.get(key));
if (list == null... | java | public synchronized <T> void addToAttachmentList(final AttachmentKey<AttachmentList<T>> key, final T value) {
if (key != null) {
final Map<AttachmentKey<?>, Object> attachments = this.attachments;
final AttachmentList<T> list = key.cast(attachments.get(key));
if (list == null... | [
"public",
"synchronized",
"<",
"T",
">",
"void",
"addToAttachmentList",
"(",
"final",
"AttachmentKey",
"<",
"AttachmentList",
"<",
"T",
">",
">",
"key",
",",
"final",
"T",
"value",
")",
"{",
"if",
"(",
"key",
"!=",
"null",
")",
"{",
"final",
"Map",
"<"... | {@inheritDoc} | [
"{"
] | cfaf0479dcbb2d320a44c5374b93b944ec39fade | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/deployment/SimpleAttachable.java#L87-L99 | train | Add to attachment list. | Create a Java method that does the following: "Add to attachment list.". | Of course, here is the Java code you requested:
```java
public synchronized <T> void addToAttachmentList(final AttachmentKey<AttachmentList<T>> key, final T value) {
if (key != null) {
final Map<AttachmentKey<?>, Object> attachments = this.attachments;
final AttachmentList<T> list = key... | |
bignerdranch/expandable-recycler-view | expandablerecyclerview/src/main/java/com/bignerdranch/expandablerecyclerview/ParentViewHolder.java | ParentViewHolder.expandView | @UiThread
protected void expandView() {
setExpanded(true);
onExpansionToggled(false);
if (mParentViewHolderExpandCollapseListener != null) {
mParentViewHolderExpandCollapseListener.onParentExpanded(getAdapterPosition());
}
} | java | @UiThread
protected void expandView() {
setExpanded(true);
onExpansionToggled(false);
if (mParentViewHolderExpandCollapseListener != null) {
mParentViewHolderExpandCollapseListener.onParentExpanded(getAdapterPosition());
}
} | [
"@",
"UiThread",
"protected",
"void",
"expandView",
"(",
")",
"{",
"setExpanded",
"(",
"true",
")",
";",
"onExpansionToggled",
"(",
"false",
")",
";",
"if",
"(",
"mParentViewHolderExpandCollapseListener",
"!=",
"null",
")",
"{",
"mParentViewHolderExpandCollapseListe... | Triggers expansion of the parent. | [
"Triggers",
"expansion",
"of",
"the",
"parent",
"."
] | 930912510620894c531d236856fa79d646e2f1ed | https://github.com/bignerdranch/expandable-recycler-view/blob/930912510620894c531d236856fa79d646e2f1ed/expandablerecyclerview/src/main/java/com/bignerdranch/expandablerecyclerview/ParentViewHolder.java#L180-L188 | train | Expand the view. | Create a Java method that does the following: "Expand the view.". | Of course, here is the Java code you requested:
```java
@UiThread
protected void expandView() {
setExpanded(true);
onExpansionToggled(false);
if (mParentViewHolderExpandCollapseListener != null) {
mParentViewHolderExpandCollapseListener.onParentExpanded(getAdapterPosition());
... | |
nakamura5akihito/six-util | src/main/java/jp/go/aist/six/util/search/Limit.java | Limit.apply | public <T> List<T> apply(
final List<T> objects
)
{
List<T> results = new ArrayList<T>();
if (objects == null || objects.size() == 0) {
return results;
}
int size = objects.size();
int fromIndex = getOffset();
... | java | public <T> List<T> apply(
final List<T> objects
)
{
List<T> results = new ArrayList<T>();
if (objects == null || objects.size() == 0) {
return results;
}
int size = objects.size();
int fromIndex = getOffset();
... | [
"public",
"<",
"T",
">",
"List",
"<",
"T",
">",
"apply",
"(",
"final",
"List",
"<",
"T",
">",
"objects",
")",
"{",
"List",
"<",
"T",
">",
"results",
"=",
"new",
"ArrayList",
"<",
"T",
">",
"(",
")",
";",
"if",
"(",
"objects",
"==",
"null",
"|... | Extracts a range from the specified object list
according to this LIMIT constraint.
@param objects
the object list.
@return
the result range (not null). | [
"Extracts",
"a",
"range",
"from",
"the",
"specified",
"object",
"list",
"according",
"to",
"this",
"LIMIT",
"constraint",
"."
] | a6db388a345e220cea2b1fa6324d15c80c6278b6 | https://github.com/nakamura5akihito/six-util/blob/a6db388a345e220cea2b1fa6324d15c80c6278b6/src/main/java/jp/go/aist/six/util/search/Limit.java#L182-L204 | train | This method is used to apply the filter to a list of objects. | Create a Java method that does the following: "This method is used to apply the filter to a list of objects.". | Of course, here is the Java code you requested:
```java
public <T> List<T> apply(
final List<T> objects
)
{
List<T> results = new ArrayList<T>();
if (objects == null || objects.size() == 0) {
return results;
}
int size = obje... | |
alkacon/opencms-core | src/org/opencms/widgets/serialdate/CmsSerialDateBeanMonthly.java | CmsSerialDateBeanMonthly.setCorrectDay | private void setCorrectDay(Calendar date) {
if (monthHasNotDay(date)) {
date.set(Calendar.DAY_OF_MONTH, date.getActualMaximum(Calendar.DAY_OF_MONTH));
} else {
date.set(Calendar.DAY_OF_MONTH, m_dayOfMonth);
}
} | java | private void setCorrectDay(Calendar date) {
if (monthHasNotDay(date)) {
date.set(Calendar.DAY_OF_MONTH, date.getActualMaximum(Calendar.DAY_OF_MONTH));
} else {
date.set(Calendar.DAY_OF_MONTH, m_dayOfMonth);
}
} | [
"private",
"void",
"setCorrectDay",
"(",
"Calendar",
"date",
")",
"{",
"if",
"(",
"monthHasNotDay",
"(",
"date",
")",
")",
"{",
"date",
".",
"set",
"(",
"Calendar",
".",
"DAY_OF_MONTH",
",",
"date",
".",
"getActualMaximum",
"(",
"Calendar",
".",
"DAY_OF_MO... | Set the correct day for the date with year and month already fixed.
@param date the date, where year and month are already correct. | [
"Set",
"the",
"correct",
"day",
"for",
"the",
"date",
"with",
"year",
"and",
"month",
"already",
"fixed",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/widgets/serialdate/CmsSerialDateBeanMonthly.java#L126-L133 | train | Set correct day of month. | Create a Java method that does the following: "Set correct day of month.". | Of course, here is the Java code you requested:
```java
private void setCorrectDay(Calendar date) {
if (monthHasNotDay(date)) {
date.set(Calendar.DAY_OF_MONTH, date.getActualMaximum(Calendar.DAY_OF_MONTH));
} else {
date.set(Calendar.DAY_OF_MONTH, m_dayOfMonth);
}
}... | |
devnied/Bit-lib4j | src/main/java/fr/devnied/bitlib/BitUtils.java | BitUtils.getData | public byte[] getData() {
byte[] ret = new byte[byteTab.length];
System.arraycopy(byteTab, 0, ret, 0, byteTab.length);
return ret;
} | java | public byte[] getData() {
byte[] ret = new byte[byteTab.length];
System.arraycopy(byteTab, 0, ret, 0, byteTab.length);
return ret;
} | [
"public",
"byte",
"[",
"]",
"getData",
"(",
")",
"{",
"byte",
"[",
"]",
"ret",
"=",
"new",
"byte",
"[",
"byteTab",
".",
"length",
"]",
";",
"System",
".",
"arraycopy",
"(",
"byteTab",
",",
"0",
",",
"ret",
",",
"0",
",",
"byteTab",
".",
"length",... | Method to get all data
@return a byte tab which contain all data | [
"Method",
"to",
"get",
"all",
"data"
] | bdfa79fd12e7e3d5cf1196291825ef1bb12a1ee0 | https://github.com/devnied/Bit-lib4j/blob/bdfa79fd12e7e3d5cf1196291825ef1bb12a1ee0/src/main/java/fr/devnied/bitlib/BitUtils.java#L111-L115 | train | Returns the data of the
byte array. | Create a Java method that does the following: "Returns the data of the
byte array.". | Of course, here is the Java code you requested:
```java
public byte[] getData() {
byte[] ret = new byte[byteTab.length];
System.arraycopy(byteTab, 0, ret, 0, byteTab.length);
return ret;
}
```
Hope this helps! | |
jmeetsma/Iglu-Util | src/main/java/org/ijsberg/iglu/util/io/FileSupport.java | FileSupport.getClassZipEntryFromZipInClassPath | public static ZipEntry getClassZipEntryFromZipInClassPath(String className) throws IOException {
String fileName = StringSupport.replaceAll(className, ".", "/");
fileName += ".class";
Collection<String> jars = StringSupport.split(System.getProperty("java.class.path"), ";:", false);
for(String jarFileName : jar... | java | public static ZipEntry getClassZipEntryFromZipInClassPath(String className) throws IOException {
String fileName = StringSupport.replaceAll(className, ".", "/");
fileName += ".class";
Collection<String> jars = StringSupport.split(System.getProperty("java.class.path"), ";:", false);
for(String jarFileName : jar... | [
"public",
"static",
"ZipEntry",
"getClassZipEntryFromZipInClassPath",
"(",
"String",
"className",
")",
"throws",
"IOException",
"{",
"String",
"fileName",
"=",
"StringSupport",
".",
"replaceAll",
"(",
"className",
",",
"\".\"",
",",
"\"/\"",
")",
";",
"fileName",
... | Tries to retrieve a class as ZipEntry from all jars mentioned in system property java.class.path
@param className class name as retrieved in myObject.getClass().getName()
@return a ZipEntry if the class file was found or null otherwise | [
"Tries",
"to",
"retrieve",
"a",
"class",
"as",
"ZipEntry",
"from",
"all",
"jars",
"mentioned",
"in",
"system",
"property",
"java",
".",
"class",
".",
"path"
] | 971eb022115247b1e34dc26dd02e7e621e29e910 | https://github.com/jmeetsma/Iglu-Util/blob/971eb022115247b1e34dc26dd02e7e621e29e910/src/main/java/org/ijsberg/iglu/util/io/FileSupport.java#L279-L293 | train | Get the ZipEntry from the jar in the classpath. | Create a Java method that does the following: "Get the ZipEntry from the jar in the classpath.". | Of course, here is the Java code you requested:
```java
public static ZipEntry getClassZipEntryFromZipInClassPath(String className) throws IOException {
String fileName = StringSupport.replaceAll(className, ".", "/");
fileName += ".class";
Collection<String> jars = StringSupport.split(System.getProperty("java.c... | |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/KerasModelImport.java | KerasModelImport.importKerasSequentialModelAndWeights | public static MultiLayerNetwork importKerasSequentialModelAndWeights(String modelHdf5Filename,
int[] inputShape,
boolean enforceTrainingConfig)
throws IOException... | java | public static MultiLayerNetwork importKerasSequentialModelAndWeights(String modelHdf5Filename,
int[] inputShape,
boolean enforceTrainingConfig)
throws IOException... | [
"public",
"static",
"MultiLayerNetwork",
"importKerasSequentialModelAndWeights",
"(",
"String",
"modelHdf5Filename",
",",
"int",
"[",
"]",
"inputShape",
",",
"boolean",
"enforceTrainingConfig",
")",
"throws",
"IOException",
",",
"InvalidKerasConfigurationException",
",",
"U... | Load Keras Sequential model saved using model.save_model(...).
@param modelHdf5Filename path to HDF5 archive storing Keras Sequential model
@param inputShape optional input shape for models that come without such (e.g. notop = false models)
@param enforceTrainingConfig whether to enforce training config... | [
"Load",
"Keras",
"Sequential",
"model",
"saved",
"using",
"model",
".",
"save_model",
"(",
"...",
")",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/KerasModelImport.java#L186-L193 | train | Import Keras Sequential Model and weights from KerasSequentialModel and return MultiLayerNetwork. | Create a Java method that does the following: "Import Keras Sequential Model and weights from KerasSequentialModel and return MultiLayerNetwork.". | Of course, here is the Java code you requested:
```java
public static MultiLayerNetwork importKerasSequentialModelAndWeights(String modelHdf5Filename,
int[] inputShape,
bool... | |
elvishew/xLog | library/src/main/java/com/elvishew/xlog/XLog.java | XLog.init | public static void init(int logLevel, Printer... printers) {
init(new LogConfiguration.Builder().logLevel(logLevel).build(), printers);
} | java | public static void init(int logLevel, Printer... printers) {
init(new LogConfiguration.Builder().logLevel(logLevel).build(), printers);
} | [
"public",
"static",
"void",
"init",
"(",
"int",
"logLevel",
",",
"Printer",
"...",
"printers",
")",
"{",
"init",
"(",
"new",
"LogConfiguration",
".",
"Builder",
"(",
")",
".",
"logLevel",
"(",
"logLevel",
")",
".",
"build",
"(",
")",
",",
"printers",
"... | Initialize log system, should be called only once.
@param logLevel the log level, logs with a lower level than which would not be printed
@param printers the printers, each log would be printed by all of the printers | [
"Initialize",
"log",
"system",
"should",
"be",
"called",
"only",
"once",
"."
] | c6fb95555ce619d3e527f5ba6c45d4d247c5a838 | https://github.com/elvishew/xLog/blob/c6fb95555ce619d3e527f5ba6c45d4d247c5a838/library/src/main/java/com/elvishew/xlog/XLog.java#L210-L212 | train | Initialize the log with the specified log level and printers. | Create a Java method that does the following: "Initialize the log with the specified log level and printers.". | Of course, here is the Java code you requested:
```java
public static void init(int logLevel, Printer... printers) {
init(new LogConfiguration.Builder().logLevel(logLevel).build(), printers);
}
```
Hope this helps! | |
netty/netty | codec-http/src/main/java/io/netty/handler/codec/http/cookie/ServerCookieEncoder.java | ServerCookieEncoder.encode | public String encode(Cookie cookie) {
final String name = checkNotNull(cookie, "cookie").name();
final String value = cookie.value() != null ? cookie.value() : "";
validateCookie(name, value);
StringBuilder buf = stringBuilder();
if (cookie.wrap()) {
addQuoted(buf,... | java | public String encode(Cookie cookie) {
final String name = checkNotNull(cookie, "cookie").name();
final String value = cookie.value() != null ? cookie.value() : "";
validateCookie(name, value);
StringBuilder buf = stringBuilder();
if (cookie.wrap()) {
addQuoted(buf,... | [
"public",
"String",
"encode",
"(",
"Cookie",
"cookie",
")",
"{",
"final",
"String",
"name",
"=",
"checkNotNull",
"(",
"cookie",
",",
"\"cookie\"",
")",
".",
"name",
"(",
")",
";",
"final",
"String",
"value",
"=",
"cookie",
".",
"value",
"(",
")",
"!=",... | Encodes the specified cookie into a Set-Cookie header value.
@param cookie the cookie
@return a single Set-Cookie header value | [
"Encodes",
"the",
"specified",
"cookie",
"into",
"a",
"Set",
"-",
"Cookie",
"header",
"value",
"."
] | ba06eafa1c1824bd154f1a380019e7ea2edf3c4c | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/cookie/ServerCookieEncoder.java#L90-L129 | train | Encode a Cookie object into a String. | Create a Java method that does the following: "Encode a Cookie object into a String.". | Of course, here is the Java code you requested:
```java
public String encode(Cookie cookie) {
final String name = checkNotNull(cookie, "cookie").name();
final String value = cookie.value() != null ? cookie.value() : "";
validateCookie(name, value);
StringBuilder buf = stringBuilder();... | |
facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | FSNamesystem.countCorruptNodes | private int countCorruptNodes(Block b,
Iterator<DatanodeDescriptor> nodeIter) {
int corrupt = 0;
Collection<DatanodeDescriptor> nodesCorrupt = corruptReplicas.getNodes(b);
while (nodeIter.hasNext()) {
DatanodeDescriptor node = nodeIter.next();
if ((nodesCorru... | java | private int countCorruptNodes(Block b,
Iterator<DatanodeDescriptor> nodeIter) {
int corrupt = 0;
Collection<DatanodeDescriptor> nodesCorrupt = corruptReplicas.getNodes(b);
while (nodeIter.hasNext()) {
DatanodeDescriptor node = nodeIter.next();
if ((nodesCorru... | [
"private",
"int",
"countCorruptNodes",
"(",
"Block",
"b",
",",
"Iterator",
"<",
"DatanodeDescriptor",
">",
"nodeIter",
")",
"{",
"int",
"corrupt",
"=",
"0",
";",
"Collection",
"<",
"DatanodeDescriptor",
">",
"nodesCorrupt",
"=",
"corruptReplicas",
".",
"getNodes... | Counts the number of nodes in the given list into active and decommissioned
counters. | [
"Counts",
"the",
"number",
"of",
"nodes",
"in",
"the",
"given",
"list",
"into",
"active",
"and",
"decommissioned",
"counters",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L8127-L8138 | train | Count the number of corrupt nodes in a block | Create a Java method that does the following: "Count the number of corrupt nodes in a block". | Of course, here is the Java code you requested:
```java
private int countCorruptNodes(Block b,
Iterator<DatanodeDescriptor> nodeIter) {
int corrupt = 0;
Collection<DatanodeDescriptor> nodesCorrupt = corruptReplicas.getNodes(b);
while (nodeIter.hasNext()) {
Datanod... | |
sebastiangraf/jSCSI | bundles/commons/src/main/java/org/jscsi/parser/login/LoginRequestParser.java | LoginRequestParser.deserializeBytes20to23 | @Override
protected void deserializeBytes20to23 (final int line) throws InternetSCSIException {
connectionID = (line & Constants.FIRST_TWO_BYTES_MASK) >>> Constants.TWO_BYTES_SHIFT;
Utils.isReserved(line & Constants.LAST_TWO_BYTES_MASK);
} | java | @Override
protected void deserializeBytes20to23 (final int line) throws InternetSCSIException {
connectionID = (line & Constants.FIRST_TWO_BYTES_MASK) >>> Constants.TWO_BYTES_SHIFT;
Utils.isReserved(line & Constants.LAST_TWO_BYTES_MASK);
} | [
"@",
"Override",
"protected",
"void",
"deserializeBytes20to23",
"(",
"final",
"int",
"line",
")",
"throws",
"InternetSCSIException",
"{",
"connectionID",
"=",
"(",
"line",
"&",
"Constants",
".",
"FIRST_TWO_BYTES_MASK",
")",
">>>",
"Constants",
".",
"TWO_BYTES_SHIFT"... | {@inheritDoc} | [
"{"
] | 6169bfe73f0b15de7d6485453555389e782ae888 | https://github.com/sebastiangraf/jSCSI/blob/6169bfe73f0b15de7d6485453555389e782ae888/bundles/commons/src/main/java/org/jscsi/parser/login/LoginRequestParser.java#L448-L453 | train | Deserialize the bytes 20 to 23. | Create a Java method that does the following: "Deserialize the bytes 20 to 23.". | Of course, here is the Java code you requested:
```java
@Override
protected void deserializeBytes20to23 (final int line) throws InternetSCSIException {
connectionID = (line & Constants.FIRST_TWO_BYTES_MASK) >>> Constants.TWO_BYTES_SHIFT;
Utils.isReserved(line & Constants.LAST_TWO_BYTES_MASK);
... | |
jclawson/hazeltask | hazeltask-core/src/main/java/com/hazeltask/executor/DistributedFutureTracker.java | DistributedFutureTracker.errorFuture | public void errorFuture(UUID taskId, Exception e) {
DistributedFuture<GROUP, Serializable> future = remove(taskId);
if(future != null) {
future.setException(e);
}
} | java | public void errorFuture(UUID taskId, Exception e) {
DistributedFuture<GROUP, Serializable> future = remove(taskId);
if(future != null) {
future.setException(e);
}
} | [
"public",
"void",
"errorFuture",
"(",
"UUID",
"taskId",
",",
"Exception",
"e",
")",
"{",
"DistributedFuture",
"<",
"GROUP",
",",
"Serializable",
">",
"future",
"=",
"remove",
"(",
"taskId",
")",
";",
"if",
"(",
"future",
"!=",
"null",
")",
"{",
"future",... | handles when a member leaves and hazelcast partition data is lost. We want
to find the Futures that are waiting on lost data and error them | [
"handles",
"when",
"a",
"member",
"leaves",
"and",
"hazelcast",
"partition",
"data",
"is",
"lost",
".",
"We",
"want",
"to",
"find",
"the",
"Futures",
"that",
"are",
"waiting",
"on",
"lost",
"data",
"and",
"error",
"them"
] | 801162bc54c5f1d5744a28a2844b24289d9495d7 | https://github.com/jclawson/hazeltask/blob/801162bc54c5f1d5744a28a2844b24289d9495d7/hazeltask-core/src/main/java/com/hazeltask/executor/DistributedFutureTracker.java#L116-L121 | train | Set an exception for a task. | Create a Java method that does the following: "Set an exception for a task.". | Of course, here is the Java code you requested:
```java
public void errorFuture(UUID taskId, Exception e) {
DistributedFuture<GROUP, Serializable> future = remove(taskId);
if(future != null) {
future.setException(e);
}
}
```
Hope this helps! | |
joniles/mpxj | src/main/java/net/sf/mpxj/ganttproject/GanttProjectReader.java | GanttProjectReader.readCalendars | private void readCalendars(Project ganttProject)
{
m_mpxjCalendar = m_projectFile.addCalendar();
m_mpxjCalendar.setName(ProjectCalendar.DEFAULT_BASE_CALENDAR_NAME);
Calendars gpCalendar = ganttProject.getCalendars();
setWorkingDays(m_mpxjCalendar, gpCalendar);
setExceptions(m_mpxjCalen... | java | private void readCalendars(Project ganttProject)
{
m_mpxjCalendar = m_projectFile.addCalendar();
m_mpxjCalendar.setName(ProjectCalendar.DEFAULT_BASE_CALENDAR_NAME);
Calendars gpCalendar = ganttProject.getCalendars();
setWorkingDays(m_mpxjCalendar, gpCalendar);
setExceptions(m_mpxjCalen... | [
"private",
"void",
"readCalendars",
"(",
"Project",
"ganttProject",
")",
"{",
"m_mpxjCalendar",
"=",
"m_projectFile",
".",
"addCalendar",
"(",
")",
";",
"m_mpxjCalendar",
".",
"setName",
"(",
"ProjectCalendar",
".",
"DEFAULT_BASE_CALENDAR_NAME",
")",
";",
"Calendars... | This method extracts calendar data from a GanttProject file.
@param ganttProject Root node of the GanttProject file | [
"This",
"method",
"extracts",
"calendar",
"data",
"from",
"a",
"GanttProject",
"file",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ganttproject/GanttProjectReader.java#L222-L231 | train | Read calendar data from a GanttProject file. | Create a Java method that does the following: "Read calendar data from a GanttProject file.". | Of course, here is the Java code you requested:
```java
private void readCalendars(Project ganttProject)
{
m_mpxjCalendar = m_projectFile.addCalendar();
m_mpxjCalendar.setName(ProjectCalendar.DEFAULT_BASE_CALENDAR_NAME);
Calendars gpCalendar = ganttProject.getCalendars();
setWorkingDays(m_m... | |
geomajas/geomajas-project-server | plugin/rasterizing/rasterizing/src/main/java/org/geomajas/plugin/rasterizing/sld/SymbolizerFilterVisitor.java | SymbolizerFilterVisitor.visit | @Override
public void visit(FeatureTypeStyle fts) {
FeatureTypeStyle copy = new FeatureTypeStyleImpl(
(FeatureTypeStyleImpl) fts);
Rule[] rules = fts.getRules();
int length = rules.length;
Rule[] rulesCopy = new Rule[length];
for (int i = 0; i < length; i++) {
if (rules[i] != null) {
rules[i].acc... | java | @Override
public void visit(FeatureTypeStyle fts) {
FeatureTypeStyle copy = new FeatureTypeStyleImpl(
(FeatureTypeStyleImpl) fts);
Rule[] rules = fts.getRules();
int length = rules.length;
Rule[] rulesCopy = new Rule[length];
for (int i = 0; i < length; i++) {
if (rules[i] != null) {
rules[i].acc... | [
"@",
"Override",
"public",
"void",
"visit",
"(",
"FeatureTypeStyle",
"fts",
")",
"{",
"FeatureTypeStyle",
"copy",
"=",
"new",
"FeatureTypeStyleImpl",
"(",
"(",
"FeatureTypeStyleImpl",
")",
"fts",
")",
";",
"Rule",
"[",
"]",
"rules",
"=",
"fts",
".",
"getRule... | Overridden to add transform. | [
"Overridden",
"to",
"add",
"transform",
"."
] | 904b7d7deed1350d28955589098dd1e0a786d76e | https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/plugin/rasterizing/rasterizing/src/main/java/org/geomajas/plugin/rasterizing/sld/SymbolizerFilterVisitor.java#L49-L72 | train | Visit a FeatureTypeStyle. | Create a Java method that does the following: "Visit a FeatureTypeStyle.". | Of course, here is the Java code you requested:
```java
@Override
public void visit(FeatureTypeStyle fts) {
FeatureTypeStyle copy = new FeatureTypeStyleImpl(
(FeatureTypeStyleImpl) fts);
Rule[] rules = fts.getRules();
int length = rules.length;
Rule[] rulesCopy = new Rule[length];
for (int i = 0; i < l... | |
gwtbootstrap3/gwtbootstrap3-extras | src/main/java/org/gwtbootstrap3/extras/bootbox/client/options/DialogOptions.java | DialogOptions.newOptions | public static DialogOptions newOptions(final String message) {
DialogOptions options = JavaScriptObject.createObject().cast();
options.setMessage(message);
return options;
} | java | public static DialogOptions newOptions(final String message) {
DialogOptions options = JavaScriptObject.createObject().cast();
options.setMessage(message);
return options;
} | [
"public",
"static",
"DialogOptions",
"newOptions",
"(",
"final",
"String",
"message",
")",
"{",
"DialogOptions",
"options",
"=",
"JavaScriptObject",
".",
"createObject",
"(",
")",
".",
"cast",
"(",
")",
";",
"options",
".",
"setMessage",
"(",
"message",
")",
... | Creates a new {@link DialogOptions}.
@param message
@return | [
"Creates",
"a",
"new",
"{",
"@link",
"DialogOptions",
"}",
"."
] | 8e42aaffd2a082e9cb23a14c37a3c87b7cbdfa94 | https://github.com/gwtbootstrap3/gwtbootstrap3-extras/blob/8e42aaffd2a082e9cb23a14c37a3c87b7cbdfa94/src/main/java/org/gwtbootstrap3/extras/bootbox/client/options/DialogOptions.java#L46-L50 | train | Creates a new options object with the specified message. | Create a Java method that does the following: "Creates a new options object with the specified message.". | Of course, here is the Java code you requested:
```java
public static DialogOptions newOptions(final String message) {
DialogOptions options = JavaScriptObject.createObject().cast();
options.setMessage(message);
return options;
}
```
Hope this helps! | |
apache/flink | flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/Graph.java | Graph.fromTupleDataSet | public static <K, VV, EV> Graph<K, VV, EV> fromTupleDataSet(DataSet<Tuple3<K, K, EV>> edges,
final MapFunction<K, VV> vertexValueInitializer, ExecutionEnvironment context) {
DataSet<Edge<K, EV>> edgeDataSet = edges
.map(new Tuple3ToEdgeMap<>())
.name("Type conversion");
return fromDataSet(edgeDataSet, v... | java | public static <K, VV, EV> Graph<K, VV, EV> fromTupleDataSet(DataSet<Tuple3<K, K, EV>> edges,
final MapFunction<K, VV> vertexValueInitializer, ExecutionEnvironment context) {
DataSet<Edge<K, EV>> edgeDataSet = edges
.map(new Tuple3ToEdgeMap<>())
.name("Type conversion");
return fromDataSet(edgeDataSet, v... | [
"public",
"static",
"<",
"K",
",",
"VV",
",",
"EV",
">",
"Graph",
"<",
"K",
",",
"VV",
",",
"EV",
">",
"fromTupleDataSet",
"(",
"DataSet",
"<",
"Tuple3",
"<",
"K",
",",
"K",
",",
"EV",
">",
">",
"edges",
",",
"final",
"MapFunction",
"<",
"K",
"... | Creates a graph from a DataSet of Tuple3 objects for edges.
<p>Each Tuple3 will become one Edge, where the source ID will be the first field of the Tuple2,
the target ID will be the second field of the Tuple2
and the Edge value will be the third field of the Tuple3.
<p>Vertices are created automatically and their val... | [
"Creates",
"a",
"graph",
"from",
"a",
"DataSet",
"of",
"Tuple3",
"objects",
"for",
"edges",
"."
] | b62db93bf63cb3bb34dd03d611a779d9e3fc61ac | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/Graph.java#L321-L329 | train | Creates a graph from a DataSet of Tuple3 objects. | Create a Java method that does the following: "Creates a graph from a DataSet of Tuple3 objects.". | Of course, here is the Java code you requested:
```java
public static <K, VV, EV> Graph<K, VV, EV> fromTupleDataSet(DataSet<Tuple3<K, K, EV>> edges,
final MapFunction<K, VV> vertexValueInitializer, ExecutionEnvironment context) {
DataSet<Edge<K, EV>> edgeDataSet = edges
.map(new Tuple3ToEdgeMap<>())
.name... | |
ModeShape/modeshape | modeshape-jcr/src/main/java/org/modeshape/jcr/query/plan/PlanNode.java | PlanNode.findAllAtOrBelow | public List<PlanNode> findAllAtOrBelow( Set<Type> typesToFind ) {
return findAllAtOrBelow(Traversal.PRE_ORDER, typesToFind);
} | java | public List<PlanNode> findAllAtOrBelow( Set<Type> typesToFind ) {
return findAllAtOrBelow(Traversal.PRE_ORDER, typesToFind);
} | [
"public",
"List",
"<",
"PlanNode",
">",
"findAllAtOrBelow",
"(",
"Set",
"<",
"Type",
">",
"typesToFind",
")",
"{",
"return",
"findAllAtOrBelow",
"(",
"Traversal",
".",
"PRE_ORDER",
",",
"typesToFind",
")",
";",
"}"
] | Find all of the nodes with one of the specified types that are at or below this node.
@param typesToFind the types of node to find; may not be null
@return the collection of nodes that are at or below this node that all have one of the supplied types; never null but
possibly empty | [
"Find",
"all",
"of",
"the",
"nodes",
"with",
"one",
"of",
"the",
"specified",
"types",
"that",
"are",
"at",
"or",
"below",
"this",
"node",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/query/plan/PlanNode.java#L1373-L1375 | train | Find all the nodes that are at or below the given types. | Create a Java method that does the following: "Find all the nodes that are at or below the given types.". | Of course, here is the Java code you requested:
```java
public List<PlanNode> findAllAtOrBelow( Set<Type> typesToFind ) {
return findAllAtOrBelow(Traversal.PRE_ORDER, typesToFind);
}
```
Hope this helps! | |
michael-rapp/AndroidMaterialPreferences | library/src/main/java/de/mrapp/android/preference/AbstractColorPickerPreference.java | AbstractColorPickerPreference.setColorFormat | public final void setColorFormat(@NonNull final ColorFormat colorFormat) {
Condition.INSTANCE.ensureNotNull(colorFormat, "The color format may not be null");
this.colorFormat = colorFormat;
} | java | public final void setColorFormat(@NonNull final ColorFormat colorFormat) {
Condition.INSTANCE.ensureNotNull(colorFormat, "The color format may not be null");
this.colorFormat = colorFormat;
} | [
"public",
"final",
"void",
"setColorFormat",
"(",
"@",
"NonNull",
"final",
"ColorFormat",
"colorFormat",
")",
"{",
"Condition",
".",
"INSTANCE",
".",
"ensureNotNull",
"(",
"colorFormat",
",",
"\"The color format may not be null\"",
")",
";",
"this",
".",
"colorForma... | Sets the format, which should be used to print a textual representation of the preference's
color.
@param colorFormat
The format, which should be set, as a value of the enum {@link ColorFormat}. The
format may not be null | [
"Sets",
"the",
"format",
"which",
"should",
"be",
"used",
"to",
"print",
"a",
"textual",
"representation",
"of",
"the",
"preference",
"s",
"color",
"."
] | 73a7e449458313bd041fc8d6038e290506b68eb1 | https://github.com/michael-rapp/AndroidMaterialPreferences/blob/73a7e449458313bd041fc8d6038e290506b68eb1/library/src/main/java/de/mrapp/android/preference/AbstractColorPickerPreference.java#L821-L824 | train | Sets the color format which should be used to format the banner. | Create a Java method that does the following: "Sets the color format which should be used to format the banner.". | Of course, here is the Java code you requested:
```java
public final void setColorFormat(@NonNull final ColorFormat colorFormat) {
Condition.INSTANCE.ensureNotNull(colorFormat, "The color format may not be null");
this.colorFormat = colorFormat;
}
```
Hope this helps! | |
b3log/latke | latke-core/src/main/java/org/b3log/latke/plugin/PluginManager.java | PluginManager.getPlugins | public List<AbstractPlugin> getPlugins() {
if (pluginCache.isEmpty()) {
LOGGER.info("Plugin cache miss, reload");
load();
}
final List<AbstractPlugin> ret = new ArrayList<>();
for (final Map.Entry<String, HashSet<AbstractPlugin>> entry : pluginCache.entrySet())... | java | public List<AbstractPlugin> getPlugins() {
if (pluginCache.isEmpty()) {
LOGGER.info("Plugin cache miss, reload");
load();
}
final List<AbstractPlugin> ret = new ArrayList<>();
for (final Map.Entry<String, HashSet<AbstractPlugin>> entry : pluginCache.entrySet())... | [
"public",
"List",
"<",
"AbstractPlugin",
">",
"getPlugins",
"(",
")",
"{",
"if",
"(",
"pluginCache",
".",
"isEmpty",
"(",
")",
")",
"{",
"LOGGER",
".",
"info",
"(",
"\"Plugin cache miss, reload\"",
")",
";",
"load",
"(",
")",
";",
"}",
"final",
"List",
... | Gets all plugins.
@return all plugins, returns an empty list if not found | [
"Gets",
"all",
"plugins",
"."
] | f7e08a47eeecea5f7c94006382c24f353585de33 | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/plugin/PluginManager.java#L86-L100 | train | Get the list of all plugins. | Create a Java method that does the following: "Get the list of all plugins.". | Of course, here is the Java code you requested:
```java
public List<AbstractPlugin> getPlugins() {
if (pluginCache.isEmpty()) {
LOGGER.info("Plugin cache miss, reload");
load();
}
final List<AbstractPlugin> ret = new ArrayList<>();
for (final Map.Entry<String,... | |
orientechnologies/orientdb | core/src/main/java/com/orientechnologies/orient/core/sql/parser/OCreateIndexStatement.java | OCreateIndexStatement.calculateProperties | private String[] calculateProperties(OCommandContext ctx) {
if (propertyList == null) {
return null;
}
return propertyList.stream().map(x -> x.getCompleteKey()).collect(Collectors.toList()).toArray(new String[] {});
} | java | private String[] calculateProperties(OCommandContext ctx) {
if (propertyList == null) {
return null;
}
return propertyList.stream().map(x -> x.getCompleteKey()).collect(Collectors.toList()).toArray(new String[] {});
} | [
"private",
"String",
"[",
"]",
"calculateProperties",
"(",
"OCommandContext",
"ctx",
")",
"{",
"if",
"(",
"propertyList",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"propertyList",
".",
"stream",
"(",
")",
".",
"map",
"(",
"x",
"->",
... | *
returns the list of property names to be indexed
@param ctx
@return | [
"*",
"returns",
"the",
"list",
"of",
"property",
"names",
"to",
"be",
"indexed"
] | d970b12033f0462f0239ea0ad8ed41207e6e26f1 | https://github.com/orientechnologies/orientdb/blob/d970b12033f0462f0239ea0ad8ed41207e6e26f1/core/src/main/java/com/orientechnologies/orient/core/sql/parser/OCreateIndexStatement.java#L164-L169 | test | Calculate the property list. | Create a Java method that does the following: "Calculate the property list.". | Of course, here is the Java code you requested:
```java
private String[] calculateProperties(OCommandContext ctx) {
if (propertyList == null) {
return null;
}
return propertyList.stream().map(x -> x.getCompleteKey()).collect(Collectors.toList()).toArray(new String[] {});
}
```
Hope this helps! | |
andkulikov/Transitions-Everywhere | library(1.x)/src/main/java/com/transitionseverywhere/Visibility.java | Visibility.onAppear | @Nullable
public Animator onAppear(@NonNull ViewGroup sceneRoot,
@NonNull View view,
@Nullable TransitionValues startValues,
@Nullable TransitionValues endValues) {
return null;
} | java | @Nullable
public Animator onAppear(@NonNull ViewGroup sceneRoot,
@NonNull View view,
@Nullable TransitionValues startValues,
@Nullable TransitionValues endValues) {
return null;
} | [
"@",
"Nullable",
"public",
"Animator",
"onAppear",
"(",
"@",
"NonNull",
"ViewGroup",
"sceneRoot",
",",
"@",
"NonNull",
"View",
"view",
",",
"@",
"Nullable",
"TransitionValues",
"startValues",
",",
"@",
"Nullable",
"TransitionValues",
"endValues",
")",
"{",
"retu... | The default implementation of this method returns a null Animator. Subclasses should
override this method to make targets appear with the desired transition. The
method should only be called from
{@link #onAppear(ViewGroup, TransitionValues, int, TransitionValues, int)}.
@param sceneRoot The root of the transition hie... | [
"The",
"default",
"implementation",
"of",
"this",
"method",
"returns",
"a",
"null",
"Animator",
".",
"Subclasses",
"should",
"override",
"this",
"method",
"to",
"make",
"targets",
"appear",
"with",
"the",
"desired",
"transition",
".",
"The",
"method",
"should",
... | 828efe5f152a2f05e2bfeee6254b74ad2269d4f1 | https://github.com/andkulikov/Transitions-Everywhere/blob/828efe5f152a2f05e2bfeee6254b74ad2269d4f1/library(1.x)/src/main/java/com/transitionseverywhere/Visibility.java#L346-L352 | train | Animator which should be used to animate a page of content. | Create a Java method that does the following: "Animator which should be used to animate a page of content.". | Of course, here is the Java code you requested:
```java
@Nullable
public Animator onAppear(@NonNull ViewGroup sceneRoot,
@NonNull View view,
@Nullable TransitionValues startValues,
@Nullable TransitionValues endValues) {
... | |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/scheduler/Scheduler.java | Scheduler.isStarted | public boolean isStarted() throws MangooSchedulerException {
boolean started;
try {
started = this.quartzScheduler != null && this.quartzScheduler.isStarted();
} catch (SchedulerException e) {
throw new MangooSchedulerException(e);
}
return starte... | java | public boolean isStarted() throws MangooSchedulerException {
boolean started;
try {
started = this.quartzScheduler != null && this.quartzScheduler.isStarted();
} catch (SchedulerException e) {
throw new MangooSchedulerException(e);
}
return starte... | [
"public",
"boolean",
"isStarted",
"(",
")",
"throws",
"MangooSchedulerException",
"{",
"boolean",
"started",
";",
"try",
"{",
"started",
"=",
"this",
".",
"quartzScheduler",
"!=",
"null",
"&&",
"this",
".",
"quartzScheduler",
".",
"isStarted",
"(",
")",
";",
... | Checks if the scheduler is initialized and started
@return true if the scheduler is started, false otherwise
@throws MangooSchedulerException if an error occurred accessing the scheduler | [
"Checks",
"if",
"the",
"scheduler",
"is",
"initialized",
"and",
"started"
] | b3beb6d09510dbbab0ed947d5069c463e1fda6e7 | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/scheduler/Scheduler.java#L75-L84 | train | Returns true if the scheduler is started. | Create a Java method that does the following: "Returns true if the scheduler is started.". | Of course, here is the Java code you requested:
```java
public boolean isStarted() throws MangooSchedulerException {
boolean started;
try {
started = this.quartzScheduler != null && this.quartzScheduler.isStarted();
} catch (SchedulerException e) {
throw new MangooSchedu... | |
jcuda/jcublas | JCublasJava/src/main/java/jcuda/jcublas/JCublas.java | JCublas.cublasDswap | public static void cublasDswap(int n, Pointer x, int incx, Pointer y, int incy)
{
cublasDswapNative(n, x, incx, y, incy);
checkResultBLAS();
} | java | public static void cublasDswap(int n, Pointer x, int incx, Pointer y, int incy)
{
cublasDswapNative(n, x, incx, y, incy);
checkResultBLAS();
} | [
"public",
"static",
"void",
"cublasDswap",
"(",
"int",
"n",
",",
"Pointer",
"x",
",",
"int",
"incx",
",",
"Pointer",
"y",
",",
"int",
"incy",
")",
"{",
"cublasDswapNative",
"(",
"n",
",",
"x",
",",
"incx",
",",
"y",
",",
"incy",
")",
";",
"checkRes... | <pre>
void
cublasDswap (int n, double *x, int incx, double *y, int incy)
interchanges the double-precision vector x with the double-precision vector y.
For i = 0 to n-1, interchanges x[lx + i * incx] with y[ly + i * incy], where
lx = 1 if incx >= 0, else lx = 1 + (1 - n) * incx, and ly is defined in a
similar way usin... | [
"<pre",
">",
"void",
"cublasDswap",
"(",
"int",
"n",
"double",
"*",
"x",
"int",
"incx",
"double",
"*",
"y",
"int",
"incy",
")"
] | 80875235d24562073f4d66651dd17263f306427d | https://github.com/jcuda/jcublas/blob/80875235d24562073f4d66651dd17263f306427d/JCublasJava/src/main/java/jcuda/jcublas/JCublas.java#L7431-L7435 | test | D swap for a matrix. | Create a Java method that does the following: "D swap for a matrix.". | Of course, here is the Java code you requested:
```java
public static void cublasDswap(int n, Pointer x, int incx, Pointer y, int incy)
{
cublasDswapNative(n, x, incx, y, incy);
checkResultBLAS();
}
```
Hope this helps! | |
e-amzallag/dajlab-core | src/main/java/org/dajlab/gui/ModelManager.java | ModelManager.loadModel | public static <T extends DajlabModelInterface> DajlabModel loadModel(final File file) {
Gson fxGson = FxGson.fullBuilder().create();
DajlabModel model = new DajlabModel();
try {
JsonParser jsonParser = new JsonParser();
JsonReader jsonReader = new JsonReader(new FileReader(file));
jsonReader.begi... | java | public static <T extends DajlabModelInterface> DajlabModel loadModel(final File file) {
Gson fxGson = FxGson.fullBuilder().create();
DajlabModel model = new DajlabModel();
try {
JsonParser jsonParser = new JsonParser();
JsonReader jsonReader = new JsonReader(new FileReader(file));
jsonReader.begi... | [
"public",
"static",
"<",
"T",
"extends",
"DajlabModelInterface",
">",
"DajlabModel",
"loadModel",
"(",
"final",
"File",
"file",
")",
"{",
"Gson",
"fxGson",
"=",
"FxGson",
".",
"fullBuilder",
"(",
")",
".",
"create",
"(",
")",
";",
"DajlabModel",
"model",
"... | Load a model from a file.
@param file
file
@param <T>
model will implement DajlabModelInterface
@return the model | [
"Load",
"a",
"model",
"from",
"a",
"file",
"."
] | 2fe25e5f861d426ff68f65728427f80b96a72905 | https://github.com/e-amzallag/dajlab-core/blob/2fe25e5f861d426ff68f65728427f80b96a72905/src/main/java/org/dajlab/gui/ModelManager.java#L92-L122 | train | Load a DajlabModel from a file. | Create a Java method that does the following: "Load a DajlabModel from a file.". | Of course, here is the Java code you requested:
```java
public static <T extends DajlabModelInterface> DajlabModel loadModel(final File file) {
Gson fxGson = FxGson.fullBuilder().create();
DajlabModel model = new DajlabModel();
try {
JsonParser jsonParser = new JsonParser();
JsonReader jsonReader = ... | |
onelogin/onelogin-java-sdk | src/main/java/com/onelogin/sdk/conn/Client.java | Client.getRoles | public List<Role> getRoles(HashMap<String, String> queryParameters) throws OAuthSystemException, OAuthProblemException, URISyntaxException {
return getRoles(queryParameters, this.maxResults);
} | java | public List<Role> getRoles(HashMap<String, String> queryParameters) throws OAuthSystemException, OAuthProblemException, URISyntaxException {
return getRoles(queryParameters, this.maxResults);
} | [
"public",
"List",
"<",
"Role",
">",
"getRoles",
"(",
"HashMap",
"<",
"String",
",",
"String",
">",
"queryParameters",
")",
"throws",
"OAuthSystemException",
",",
"OAuthProblemException",
",",
"URISyntaxException",
"{",
"return",
"getRoles",
"(",
"queryParameters",
... | Gets a list of Role resources.
@param queryParameters Query parameters of the Resource
Parameters to filter the result of the list
@return List of Role
@throws OAuthSystemException - if there is a IOException reading parameters of the httpURLConnection
@throws OAuthProblemException - if there are errors validating t... | [
"Gets",
"a",
"list",
"of",
"Role",
"resources",
"."
] | 1570b78033dcc1c7387099e77fe41b6b0638df8c | https://github.com/onelogin/onelogin-java-sdk/blob/1570b78033dcc1c7387099e77fe41b6b0638df8c/src/main/java/com/onelogin/sdk/conn/Client.java#L1821-L1823 | train | Get a list of roles based on the query parameters. | Create a Java method that does the following: "Get a list of roles based on the query parameters.". | Of course, here is the Java code you requested:
```java
public List<Role> getRoles(HashMap<String, String> queryParameters) throws OAuthSystemException, OAuthProblemException, URISyntaxException {
return getRoles(queryParameters, this.maxResults);
}
```
Hope this helps! | |
alkacon/opencms-core | src/org/opencms/util/CmsFileUtil.java | CmsFileUtil.getExtension | public static String getExtension(String resourceName) {
// if the resource name indicates a folder
if (resourceName.charAt(resourceName.length() - 1) == '/') {
// folders have no extensions
return "";
}
// get just the name of the resource
String name = ... | java | public static String getExtension(String resourceName) {
// if the resource name indicates a folder
if (resourceName.charAt(resourceName.length() - 1) == '/') {
// folders have no extensions
return "";
}
// get just the name of the resource
String name = ... | [
"public",
"static",
"String",
"getExtension",
"(",
"String",
"resourceName",
")",
"{",
"// if the resource name indicates a folder",
"if",
"(",
"resourceName",
".",
"charAt",
"(",
"resourceName",
".",
"length",
"(",
")",
"-",
"1",
")",
"==",
"'",
"'",
")",
"{"... | Returns the extension of the given resource name, that is the part behind the last '.' char,
converted to lower case letters.<p>
The extension of a file is the part of the name after the last dot, including the dot.
The extension of a folder is empty.
All extensions are returned as lower case<p>
Please note: No check... | [
"Returns",
"the",
"extension",
"of",
"the",
"given",
"resource",
"name",
"that",
"is",
"the",
"part",
"behind",
"the",
"last",
".",
"char",
"converted",
"to",
"lower",
"case",
"letters",
".",
"<p",
">"
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/util/CmsFileUtil.java#L326-L343 | train | Returns the extension of the resource name. | Create a Java method that does the following: "Returns the extension of the resource name.". | Of course, here is the Java code you requested:
```java
public static String getExtension(String resourceName) {
// if the resource name indicates a folder
if (resourceName.charAt(resourceName.length() - 1) == '/') {
// folders have no extensions
return "";
}
//... | |
evant/binding-collection-adapter | bindingcollectionadapter/src/main/java/me/tatarka/bindingcollectionadapter2/Utils.java | Utils.createClass | @SuppressWarnings("unchecked")
static <T, A extends BindingCollectionAdapter<T>> A createClass(Class<? extends BindingCollectionAdapter> adapterClass, ItemBinding<T> itemBinding) {
try {
return (A) adapterClass.getConstructor(ItemBinding.class).newInstance(itemBinding);
} catch (Exceptio... | java | @SuppressWarnings("unchecked")
static <T, A extends BindingCollectionAdapter<T>> A createClass(Class<? extends BindingCollectionAdapter> adapterClass, ItemBinding<T> itemBinding) {
try {
return (A) adapterClass.getConstructor(ItemBinding.class).newInstance(itemBinding);
} catch (Exceptio... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"static",
"<",
"T",
",",
"A",
"extends",
"BindingCollectionAdapter",
"<",
"T",
">",
">",
"A",
"createClass",
"(",
"Class",
"<",
"?",
"extends",
"BindingCollectionAdapter",
">",
"adapterClass",
",",
"ItemBinding... | Constructs a binding adapter class from it's class name using reflection. | [
"Constructs",
"a",
"binding",
"adapter",
"class",
"from",
"it",
"s",
"class",
"name",
"using",
"reflection",
"."
] | f669eda0a7002128bb504dcba012c51531f1bedd | https://github.com/evant/binding-collection-adapter/blob/f669eda0a7002128bb504dcba012c51531f1bedd/bindingcollectionadapter/src/main/java/me/tatarka/bindingcollectionadapter2/Utils.java#L99-L106 | train | Create a class from a class. | Create a Java method that does the following: "Create a class from a class.". | Of course, here is the Java code you requested:
```java
@SuppressWarnings("unchecked")
static <T, A extends BindingCollectionAdapter<T>> A createClass(Class<? extends BindingCollectionAdapter> adapterClass, ItemBinding<T> itemBinding) {
try {
return (A) adapterClass.getConstructor(ItemBinding.c... | |
aws/aws-sdk-java | aws-java-sdk-ec2/src/main/java/com/amazonaws/services/ec2/model/ModifyVpcEndpointRequest.java | ModifyVpcEndpointRequest.getDryRunRequest | @Override
public Request<ModifyVpcEndpointRequest> getDryRunRequest() {
Request<ModifyVpcEndpointRequest> request = new ModifyVpcEndpointRequestMarshaller().marshall(this);
request.addParameter("DryRun", Boolean.toString(true));
return request;
} | java | @Override
public Request<ModifyVpcEndpointRequest> getDryRunRequest() {
Request<ModifyVpcEndpointRequest> request = new ModifyVpcEndpointRequestMarshaller().marshall(this);
request.addParameter("DryRun", Boolean.toString(true));
return request;
} | [
"@",
"Override",
"public",
"Request",
"<",
"ModifyVpcEndpointRequest",
">",
"getDryRunRequest",
"(",
")",
"{",
"Request",
"<",
"ModifyVpcEndpointRequest",
">",
"request",
"=",
"new",
"ModifyVpcEndpointRequestMarshaller",
"(",
")",
".",
"marshall",
"(",
"this",
")",
... | This method is intended for internal use only. Returns the marshaled request configured with additional
parameters to enable operation dry-run. | [
"This",
"method",
"is",
"intended",
"for",
"internal",
"use",
"only",
".",
"Returns",
"the",
"marshaled",
"request",
"configured",
"with",
"additional",
"parameters",
"to",
"enable",
"operation",
"dry",
"-",
"run",
"."
] | aa38502458969b2d13a1c3665a56aba600e4dbd0 | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-ec2/src/main/java/com/amazonaws/services/ec2/model/ModifyVpcEndpointRequest.java#L736-L741 | train | Gets the request that will be used to delete the vpc endpoint from the cache. | Create a Java method that does the following: "Gets the request that will be used to delete the vpc endpoint from the cache.". | Of course, here is the Java code you requested:
```java
@Override
public Request<ModifyVpcEndpointRequest> getDryRunRequest() {
Request<ModifyVpcEndpointRequest> request = new ModifyVpcEndpointRequestMarshaller().marshall(this);
request.addParameter("DryRun", Boolean.toString(true));
return... | |
Evol-Instruct | N/A | N/A | java | [] | [] | train | Create a Java class to represent a new type of vehicle called hovercar, which can only be powered by a specific type of energy called "ion fuel" and has a maximum speed of 500 km/h. Additionally, the hovercar should have the ability to levitate at a certain height above the ground, with the height being adjustable by t... | Here's an example implementation of the Hovercar class in Java:
```java
public class Hovercar {
private static final String POWER_SOURCE = "ion fuel";
private static final int MAX_SPEED = 500; // km/h
private static final int MIN_ALTITUDE = 1; // meters
private static final int MAX_ALTITUDE = 10; // me... | |||||||
aws/aws-sdk-java | aws-java-sdk-api-gateway/src/main/java/com/amazonaws/services/apigateway/AmazonApiGatewayClient.java | AmazonApiGatewayClient.getApiKey | @Override
public GetApiKeyResult getApiKey(GetApiKeyRequest request) {
request = beforeClientExecution(request);
return executeGetApiKey(request);
} | java | @Override
public GetApiKeyResult getApiKey(GetApiKeyRequest request) {
request = beforeClientExecution(request);
return executeGetApiKey(request);
} | [
"@",
"Override",
"public",
"GetApiKeyResult",
"getApiKey",
"(",
"GetApiKeyRequest",
"request",
")",
"{",
"request",
"=",
"beforeClientExecution",
"(",
"request",
")",
";",
"return",
"executeGetApiKey",
"(",
"request",
")",
";",
"}"
] | <p>
Gets information about the current <a>ApiKey</a> resource.
</p>
@param getApiKeyRequest
A request to get information about the current <a>ApiKey</a> resource.
@return Result of the GetApiKey operation returned by the service.
@throws UnauthorizedException
The request is denied because the caller has insufficient p... | [
"<p",
">",
"Gets",
"information",
"about",
"the",
"current",
"<a",
">",
"ApiKey<",
"/",
"a",
">",
"resource",
".",
"<",
"/",
"p",
">"
] | aa38502458969b2d13a1c3665a56aba600e4dbd0 | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-api-gateway/src/main/java/com/amazonaws/services/apigateway/AmazonApiGatewayClient.java#L2792-L2796 | train | Retrieves the API key for an app. | Create a Java method that does the following: "Retrieves the API key for an app.". | Of course, here is the Java code you requested:
```java
@Override
public GetApiKeyResult getApiKey(GetApiKeyRequest request) {
request = beforeClientExecution(request);
return executeGetApiKey(request);
}
```
Hope this helps! | |
joniles/mpxj | src/main/java/net/sf/mpxj/asta/DatatypeConverter.java | DatatypeConverter.parseBoolean | public static Boolean parseBoolean(String value) throws ParseException
{
Boolean result = null;
Integer number = parseInteger(value);
if (number != null)
{
result = number.intValue() == 0 ? Boolean.FALSE : Boolean.TRUE;
}
return result;
} | java | public static Boolean parseBoolean(String value) throws ParseException
{
Boolean result = null;
Integer number = parseInteger(value);
if (number != null)
{
result = number.intValue() == 0 ? Boolean.FALSE : Boolean.TRUE;
}
return result;
} | [
"public",
"static",
"Boolean",
"parseBoolean",
"(",
"String",
"value",
")",
"throws",
"ParseException",
"{",
"Boolean",
"result",
"=",
"null",
";",
"Integer",
"number",
"=",
"parseInteger",
"(",
"value",
")",
";",
"if",
"(",
"number",
"!=",
"null",
")",
"{... | Parse a string representation of a Boolean value.
@param value string representation
@return Boolean value | [
"Parse",
"a",
"string",
"representation",
"of",
"a",
"Boolean",
"value",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/asta/DatatypeConverter.java#L106-L116 | train | Parse a String containing a Boolean value. | Create a Java method that does the following: "Parse a String containing a Boolean value.". | Of course, here is the Java code you requested:
```java
public static Boolean parseBoolean(String value) throws ParseException
{
Boolean result = null;
Integer number = parseInteger(value);
if (number != null)
{
result = number.intValue() == 0 ? Boolean.FALSE : Boolean.TRUE;
}... | |
alkacon/opencms-core | src/org/opencms/security/CmsRole.java | CmsRole.createRoleViolationExceptionForOrgUnit | public CmsRoleViolationException createRoleViolationExceptionForOrgUnit(
CmsRequestContext requestContext,
String orgUnitFqn) {
return new CmsRoleViolationException(
Messages.get().container(
Messages.ERR_USER_NOT_IN_ROLE_FOR_ORGUNIT_3,
requestContext... | java | public CmsRoleViolationException createRoleViolationExceptionForOrgUnit(
CmsRequestContext requestContext,
String orgUnitFqn) {
return new CmsRoleViolationException(
Messages.get().container(
Messages.ERR_USER_NOT_IN_ROLE_FOR_ORGUNIT_3,
requestContext... | [
"public",
"CmsRoleViolationException",
"createRoleViolationExceptionForOrgUnit",
"(",
"CmsRequestContext",
"requestContext",
",",
"String",
"orgUnitFqn",
")",
"{",
"return",
"new",
"CmsRoleViolationException",
"(",
"Messages",
".",
"get",
"(",
")",
".",
"container",
"(",
... | Returns a role violation exception configured with a localized, role specific message
for this role.<p>
@param requestContext the current users OpenCms request context
@param orgUnitFqn the organizational unit used for the role check, it may be <code>null</code>
@return a role violation exception configured with a lo... | [
"Returns",
"a",
"role",
"violation",
"exception",
"configured",
"with",
"a",
"localized",
"role",
"specific",
"message",
"for",
"this",
"role",
".",
"<p",
">"
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/security/CmsRole.java#L474-L484 | train | Creates a CmsRoleViolationException for the given org unit. | Create a Java method that does the following: "Creates a CmsRoleViolationException for the given org unit.". | Of course, here is the Java code you requested:
```java
public CmsRoleViolationException createRoleViolationExceptionForOrgUnit(
CmsRequestContext requestContext,
String orgUnitFqn) {
return new CmsRoleViolationException(
Messages.get().container(
Messages.ERR_USER_... | |
aws/aws-sdk-java | aws-java-sdk-workdocs/src/main/java/com/amazonaws/services/workdocs/model/transform/GetDocumentPathRequestMarshaller.java | GetDocumentPathRequestMarshaller.marshall | public void marshall(GetDocumentPathRequest getDocumentPathRequest, ProtocolMarshaller protocolMarshaller) {
if (getDocumentPathRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(getDocumentPa... | java | public void marshall(GetDocumentPathRequest getDocumentPathRequest, ProtocolMarshaller protocolMarshaller) {
if (getDocumentPathRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(getDocumentPa... | [
"public",
"void",
"marshall",
"(",
"GetDocumentPathRequest",
"getDocumentPathRequest",
",",
"ProtocolMarshaller",
"protocolMarshaller",
")",
"{",
"if",
"(",
"getDocumentPathRequest",
"==",
"null",
")",
"{",
"throw",
"new",
"SdkClientException",
"(",
"\"Invalid argument pa... | Marshall the given parameter object. | [
"Marshall",
"the",
"given",
"parameter",
"object",
"."
] | aa38502458969b2d13a1c3665a56aba600e4dbd0 | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-workdocs/src/main/java/com/amazonaws/services/workdocs/model/transform/GetDocumentPathRequestMarshaller.java#L50-L65 | train | marshalls the given getDocumentPathRequest to the JSON object. | Create a Java method that does the following: "marshalls the given getDocumentPathRequest to the JSON object.". | Of course, here is the Java code you requested:
```java
public void marshall(GetDocumentPathRequest getDocumentPathRequest, ProtocolMarshaller protocolMarshaller) {
if (getDocumentPathRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
tr... | |
h2oai/h2o-2 | src/main/java/water/UDPReceiverThread.java | UDPReceiverThread.run | @SuppressWarnings("resource")
public void run() {
Thread.currentThread().setPriority(Thread.MAX_PRIORITY-1);
DatagramChannel sock = H2O._udpSocket, errsock = null;
boolean saw_error = false;
while( true ) {
try {
// Cleanup from any prior socket failures. Rare unless we're really sick.... | java | @SuppressWarnings("resource")
public void run() {
Thread.currentThread().setPriority(Thread.MAX_PRIORITY-1);
DatagramChannel sock = H2O._udpSocket, errsock = null;
boolean saw_error = false;
while( true ) {
try {
// Cleanup from any prior socket failures. Rare unless we're really sick.... | [
"@",
"SuppressWarnings",
"(",
"\"resource\"",
")",
"public",
"void",
"run",
"(",
")",
"{",
"Thread",
".",
"currentThread",
"(",
")",
".",
"setPriority",
"(",
"Thread",
".",
"MAX_PRIORITY",
"-",
"1",
")",
";",
"DatagramChannel",
"sock",
"=",
"H2O",
".",
"... | Started by main() on a single thread, this code manages reading UDP packets | [
"Started",
"by",
"main",
"()",
"on",
"a",
"single",
"thread",
"this",
"code",
"manages",
"reading",
"UDP",
"packets"
] | be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1 | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/UDPReceiverThread.java#L29-L66 | train | Run the main loop of the H2O application. | Create a Java method that does the following: "Run the main loop of the H2O application.". | Of course, here is the Java code you requested:
```java
@SuppressWarnings("resource")
public void run() {
Thread.currentThread().setPriority(Thread.MAX_PRIORITY-1);
DatagramChannel sock = H2O._udpSocket, errsock = null;
boolean saw_error = false;
while( true ) {
try {
// Cleanup from a... | |
grpc/grpc-java | benchmarks/src/main/java/io/grpc/benchmarks/Utils.java | Utils.saveHistogram | public static void saveHistogram(Histogram histogram, String filename) throws IOException {
File file;
PrintStream log = null;
try {
file = new File(filename);
if (file.exists() && !file.delete()) {
System.err.println("Failed deleting previous histogram file: " + file.getAbsolutePath());... | java | public static void saveHistogram(Histogram histogram, String filename) throws IOException {
File file;
PrintStream log = null;
try {
file = new File(filename);
if (file.exists() && !file.delete()) {
System.err.println("Failed deleting previous histogram file: " + file.getAbsolutePath());... | [
"public",
"static",
"void",
"saveHistogram",
"(",
"Histogram",
"histogram",
",",
"String",
"filename",
")",
"throws",
"IOException",
"{",
"File",
"file",
";",
"PrintStream",
"log",
"=",
"null",
";",
"try",
"{",
"file",
"=",
"new",
"File",
"(",
"filename",
... | Save a {@link Histogram} to a file. | [
"Save",
"a",
"{"
] | 973885457f9609de232d2553b82c67f6c3ff57bf | https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/benchmarks/src/main/java/io/grpc/benchmarks/Utils.java#L229-L244 | train | Saves a histogram to a file. | Create a Java method that does the following: "Saves a histogram to a file.". | Of course, here is the Java code you requested:
```java
public static void saveHistogram(Histogram histogram, String filename) throws IOException {
File file;
PrintStream log = null;
try {
file = new File(filename);
if (file.exists() && !file.delete()) {
System.err.println("Failed delet... | |
stagemonitor/stagemonitor | stagemonitor-core/src/main/java/org/stagemonitor/core/metrics/metrics2/ScheduledMetrics2Reporter.java | ScheduledMetrics2Reporter.start | public void start(long period, TimeUnit unit) {
synchronized (this) {
if (started) {
throw new IllegalStateException("This reporter has already been started");
}
final long periodInMS = unit.toMillis(period);
executor.scheduleAtFixedRate(new Runnable() {
@Override
public void run() {
try ... | java | public void start(long period, TimeUnit unit) {
synchronized (this) {
if (started) {
throw new IllegalStateException("This reporter has already been started");
}
final long periodInMS = unit.toMillis(period);
executor.scheduleAtFixedRate(new Runnable() {
@Override
public void run() {
try ... | [
"public",
"void",
"start",
"(",
"long",
"period",
",",
"TimeUnit",
"unit",
")",
"{",
"synchronized",
"(",
"this",
")",
"{",
"if",
"(",
"started",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"This reporter has already been started\"",
")",
";",
"}... | Starts the reporter polling at the given period.
@param period the amount of time between polls
@param unit the unit for {@code period} | [
"Starts",
"the",
"reporter",
"polling",
"at",
"the",
"given",
"period",
"."
] | 7a1bf6848906f816aa465983f602ea1f1e8f2b7b | https://github.com/stagemonitor/stagemonitor/blob/7a1bf6848906f816aa465983f602ea1f1e8f2b7b/stagemonitor-core/src/main/java/org/stagemonitor/core/metrics/metrics2/ScheduledMetrics2Reporter.java#L91-L110 | train | Start the reporter. | Create a Java method that does the following: "Start the reporter.". | Of course, here is the Java code you requested:
```java
public void start(long period, TimeUnit unit) {
synchronized (this) {
if (started) {
throw new IllegalStateException("This reporter has already been started");
}
final long periodInMS = unit.toMillis(period);
executor.scheduleAtFixedRate(new Run... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.