repository_name stringlengths 7 54 | func_path_in_repository stringlengths 18 218 | func_name stringlengths 5 140 | whole_func_string stringlengths 79 3.99k | language stringclasses 1
value | func_code_string stringlengths 79 3.99k | func_code_tokens listlengths 20 624 | func_documentation_string stringlengths 61 1.96k | func_documentation_tokens listlengths 1 478 | split_name stringclasses 1
value | func_code_url stringlengths 107 339 |
|---|---|---|---|---|---|---|---|---|---|---|
minio/minio-java | api/src/main/java/io/minio/MinioClient.java | MinioClient.presignedGetObject | public String presignedGetObject(String bucketName, String objectName, Integer expires,
Map<String, String> reqParams)
throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException,
InvalidKeyException, NoResponseException, XmlPullParserException, ErrorResponseException,
InternalException, InvalidExpiresRangeException {
return getPresignedObjectUrl(Method.GET, bucketName, objectName, expires, reqParams);
} | java | public String presignedGetObject(String bucketName, String objectName, Integer expires,
Map<String, String> reqParams)
throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException,
InvalidKeyException, NoResponseException, XmlPullParserException, ErrorResponseException,
InternalException, InvalidExpiresRangeException {
return getPresignedObjectUrl(Method.GET, bucketName, objectName, expires, reqParams);
} | [
"public",
"String",
"presignedGetObject",
"(",
"String",
"bucketName",
",",
"String",
"objectName",
",",
"Integer",
"expires",
",",
"Map",
"<",
"String",
",",
"String",
">",
"reqParams",
")",
"throws",
"InvalidBucketNameException",
",",
"NoSuchAlgorithmException",
"... | Returns an presigned URL to download the object in the bucket with given expiry time with custom request params.
</p><b>Example:</b><br>
<pre>{@code String url = minioClient.presignedGetObject("my-bucketname", "my-objectname", 60 * 60 * 24, reqParams);
System.out.println(url); }</pre>
@param bucketName Bucket name.
@param objectName Object name in the bucket.
@param expires Expiration time in seconds of presigned URL.
@param reqParams Override values for set of response headers. Currently supported request parameters are
[response-expires, response-content-type, response-cache-control, response-content-disposition]
@return string contains URL to download the object.
@throws InvalidBucketNameException upon invalid bucket name is given
@throws NoSuchAlgorithmException
upon requested algorithm was not found during signature calculation
@throws InsufficientDataException upon getting EOFException while reading given
InputStream even before reading given length
@throws IOException upon connection error
@throws InvalidKeyException
upon an invalid access key or secret key
@throws NoResponseException upon no response from server
@throws XmlPullParserException upon parsing response xml
@throws ErrorResponseException upon unsuccessful execution
@throws InternalException upon internal library error
@throws InvalidExpiresRangeException upon input expires is out of range | [
"Returns",
"an",
"presigned",
"URL",
"to",
"download",
"the",
"object",
"in",
"the",
"bucket",
"with",
"given",
"expiry",
"time",
"with",
"custom",
"request",
"params",
"."
] | train | https://github.com/minio/minio-java/blob/b2028f56403c89ce2d5900ae813bc1314c87bc7f/api/src/main/java/io/minio/MinioClient.java#L2401-L2407 |
UrielCh/ovh-java-sdk | ovh-java-sdk-hostingprivateDatabase/src/main/java/net/minidev/ovh/api/ApiOvhHostingprivateDatabase.java | ApiOvhHostingprivateDatabase.serviceName_dump_GET | public ArrayList<Long> serviceName_dump_GET(String serviceName, String databaseName, Boolean orphan) throws IOException {
String qPath = "/hosting/privateDatabase/{serviceName}/dump";
StringBuilder sb = path(qPath, serviceName);
query(sb, "databaseName", databaseName);
query(sb, "orphan", orphan);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t3);
} | java | public ArrayList<Long> serviceName_dump_GET(String serviceName, String databaseName, Boolean orphan) throws IOException {
String qPath = "/hosting/privateDatabase/{serviceName}/dump";
StringBuilder sb = path(qPath, serviceName);
query(sb, "databaseName", databaseName);
query(sb, "orphan", orphan);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t3);
} | [
"public",
"ArrayList",
"<",
"Long",
">",
"serviceName_dump_GET",
"(",
"String",
"serviceName",
",",
"String",
"databaseName",
",",
"Boolean",
"orphan",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/hosting/privateDatabase/{serviceName}/dump\"",
";",
"... | Dumps available for your private database service
REST: GET /hosting/privateDatabase/{serviceName}/dump
@param databaseName [required] Filter the value of databaseName property (like)
@param orphan [required] Filter the value of orphan property (=)
@param serviceName [required] The internal name of your private database | [
"Dumps",
"available",
"for",
"your",
"private",
"database",
"service"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-hostingprivateDatabase/src/main/java/net/minidev/ovh/api/ApiOvhHostingprivateDatabase.java#L655-L662 |
kiegroup/drools | drools-core/src/main/java/org/drools/core/util/DroolsStreamUtils.java | DroolsStreamUtils.streamIn | public static Object streamIn(byte[] bytes, ClassLoader classLoader)
throws IOException, ClassNotFoundException {
return streamIn(bytes, classLoader, false);
} | java | public static Object streamIn(byte[] bytes, ClassLoader classLoader)
throws IOException, ClassNotFoundException {
return streamIn(bytes, classLoader, false);
} | [
"public",
"static",
"Object",
"streamIn",
"(",
"byte",
"[",
"]",
"bytes",
",",
"ClassLoader",
"classLoader",
")",
"throws",
"IOException",
",",
"ClassNotFoundException",
"{",
"return",
"streamIn",
"(",
"bytes",
",",
"classLoader",
",",
"false",
")",
";",
"}"
] | This method reads the contents from the given byte array and returns the object. It is expected that
the contents in the given buffer was not compressed, and the content stream was written by the corresponding
streamOut methods of this class.
@param bytes
@param classLoader
@return
@throws IOException
@throws ClassNotFoundException | [
"This",
"method",
"reads",
"the",
"contents",
"from",
"the",
"given",
"byte",
"array",
"and",
"returns",
"the",
"object",
".",
"It",
"is",
"expected",
"that",
"the",
"contents",
"in",
"the",
"given",
"buffer",
"was",
"not",
"compressed",
"and",
"the",
"con... | train | https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-core/src/main/java/org/drools/core/util/DroolsStreamUtils.java#L129-L132 |
podio/podio-java | src/main/java/com/podio/task/TaskAPI.java | TaskAPI.createTask | public int createTask(TaskCreate task, boolean silent, boolean hook) {
TaskCreateResponse response = getResourceFactory()
.getApiResource("/task/")
.queryParam("silent", silent ? "1" : "0")
.queryParam("hook", hook ? "1" : "0")
.entity(task, MediaType.APPLICATION_JSON_TYPE)
.post(TaskCreateResponse.class);
return response.getId();
} | java | public int createTask(TaskCreate task, boolean silent, boolean hook) {
TaskCreateResponse response = getResourceFactory()
.getApiResource("/task/")
.queryParam("silent", silent ? "1" : "0")
.queryParam("hook", hook ? "1" : "0")
.entity(task, MediaType.APPLICATION_JSON_TYPE)
.post(TaskCreateResponse.class);
return response.getId();
} | [
"public",
"int",
"createTask",
"(",
"TaskCreate",
"task",
",",
"boolean",
"silent",
",",
"boolean",
"hook",
")",
"{",
"TaskCreateResponse",
"response",
"=",
"getResourceFactory",
"(",
")",
".",
"getApiResource",
"(",
"\"/task/\"",
")",
".",
"queryParam",
"(",
... | Creates a new task with no reference to other objects.
@param task
The data of the task to be created
@param silent
Disable notifications
@param hook
Execute hooks for the change
@return The id of the newly created task | [
"Creates",
"a",
"new",
"task",
"with",
"no",
"reference",
"to",
"other",
"objects",
"."
] | train | https://github.com/podio/podio-java/blob/a520b23bac118c957ce02cdd8ff42a6c7d17b49a/src/main/java/com/podio/task/TaskAPI.java#L174-L183 |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.fat.common.jwt/src/com/ibm/ws/security/fat/common/jwt/actions/JwtTokenActions.java | JwtTokenActions.getJwtTokenUsingBuilder | public String getJwtTokenUsingBuilder(String testName, LibertyServer server, String builderId, List<NameValuePair> extraClaims) throws Exception {
String jwtBuilderUrl = SecurityFatHttpUtils.getServerUrlBase(server) + "/jwtbuilder/build";
List<NameValuePair> requestParams = setRequestParms(builderId, extraClaims);
WebClient webClient = new WebClient();
Page response = invokeUrlWithParameters(testName, webClient, jwtBuilderUrl, requestParams);
Log.info(thisClass, testName, "JWT builder app response: " + WebResponseUtils.getResponseText(response));
Cookie jwtCookie = webClient.getCookieManager().getCookie("JWT");
Log.info(thisClass, testName, "Built JWT cookie: " + jwtCookie);
Log.info(thisClass, testName, "Cookie value: " + jwtCookie.getValue());
return jwtCookie.getValue();
} | java | public String getJwtTokenUsingBuilder(String testName, LibertyServer server, String builderId, List<NameValuePair> extraClaims) throws Exception {
String jwtBuilderUrl = SecurityFatHttpUtils.getServerUrlBase(server) + "/jwtbuilder/build";
List<NameValuePair> requestParams = setRequestParms(builderId, extraClaims);
WebClient webClient = new WebClient();
Page response = invokeUrlWithParameters(testName, webClient, jwtBuilderUrl, requestParams);
Log.info(thisClass, testName, "JWT builder app response: " + WebResponseUtils.getResponseText(response));
Cookie jwtCookie = webClient.getCookieManager().getCookie("JWT");
Log.info(thisClass, testName, "Built JWT cookie: " + jwtCookie);
Log.info(thisClass, testName, "Cookie value: " + jwtCookie.getValue());
return jwtCookie.getValue();
} | [
"public",
"String",
"getJwtTokenUsingBuilder",
"(",
"String",
"testName",
",",
"LibertyServer",
"server",
",",
"String",
"builderId",
",",
"List",
"<",
"NameValuePair",
">",
"extraClaims",
")",
"throws",
"Exception",
"{",
"String",
"jwtBuilderUrl",
"=",
"SecurityFat... | anyone calling this method needs to add upn to the extraClaims that it passes in (if they need it) | [
"anyone",
"calling",
"this",
"method",
"needs",
"to",
"add",
"upn",
"to",
"the",
"extraClaims",
"that",
"it",
"passes",
"in",
"(",
"if",
"they",
"need",
"it",
")"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.fat.common.jwt/src/com/ibm/ws/security/fat/common/jwt/actions/JwtTokenActions.java#L32-L47 |
jaxio/celerio | celerio-engine/src/main/java/com/jaxio/celerio/util/MiscUtil.java | MiscUtil.endsWithIgnoreCase | public static boolean endsWithIgnoreCase(String name, Iterable<String> patterns) {
String nameUpper = name.toUpperCase();
for (String pattern : patterns) {
String patternUpper = pattern.toUpperCase();
if (nameUpper.equals(patternUpper) || nameUpper.endsWith(patternUpper)) {
return true;
}
}
return false;
} | java | public static boolean endsWithIgnoreCase(String name, Iterable<String> patterns) {
String nameUpper = name.toUpperCase();
for (String pattern : patterns) {
String patternUpper = pattern.toUpperCase();
if (nameUpper.equals(patternUpper) || nameUpper.endsWith(patternUpper)) {
return true;
}
}
return false;
} | [
"public",
"static",
"boolean",
"endsWithIgnoreCase",
"(",
"String",
"name",
",",
"Iterable",
"<",
"String",
">",
"patterns",
")",
"{",
"String",
"nameUpper",
"=",
"name",
".",
"toUpperCase",
"(",
")",
";",
"for",
"(",
"String",
"pattern",
":",
"patterns",
... | Does the given column name ends with one of pattern given in parameter. Not case sensitive | [
"Does",
"the",
"given",
"column",
"name",
"ends",
"with",
"one",
"of",
"pattern",
"given",
"in",
"parameter",
".",
"Not",
"case",
"sensitive"
] | train | https://github.com/jaxio/celerio/blob/fbfacb639e286f9f3f3a18986f74ea275bebd887/celerio-engine/src/main/java/com/jaxio/celerio/util/MiscUtil.java#L162-L172 |
BorderTech/wcomponents | wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/theme/WRadioButtonSelectExample.java | WRadioButtonSelectExample.addReadOnlyExamples | private void addReadOnlyExamples() {
add(new WHeading(HeadingLevel.H3, "Read-only WRadioButtonSelect examples"));
add(new ExplanatoryText("These examples all use the same list of options: the states and territories list from the editable examples above. "
+ "When the readOnly state is specified only that option which is selected is output.\n"
+ "Since no more than one option is able to be selected the layout and frame settings are ignored in the read only state."));
WFieldLayout layout = new WFieldLayout();
add(layout);
WRadioButtonSelect select = new WRadioButtonSelect("australian_state");
select.setReadOnly(true);
layout.addField("Read only with no selection", select);
select = new SelectWithSelection("australian_state");
select.setReadOnly(true);
layout.addField("Read only with selection", select);
} | java | private void addReadOnlyExamples() {
add(new WHeading(HeadingLevel.H3, "Read-only WRadioButtonSelect examples"));
add(new ExplanatoryText("These examples all use the same list of options: the states and territories list from the editable examples above. "
+ "When the readOnly state is specified only that option which is selected is output.\n"
+ "Since no more than one option is able to be selected the layout and frame settings are ignored in the read only state."));
WFieldLayout layout = new WFieldLayout();
add(layout);
WRadioButtonSelect select = new WRadioButtonSelect("australian_state");
select.setReadOnly(true);
layout.addField("Read only with no selection", select);
select = new SelectWithSelection("australian_state");
select.setReadOnly(true);
layout.addField("Read only with selection", select);
} | [
"private",
"void",
"addReadOnlyExamples",
"(",
")",
"{",
"add",
"(",
"new",
"WHeading",
"(",
"HeadingLevel",
".",
"H3",
",",
"\"Read-only WRadioButtonSelect examples\"",
")",
")",
";",
"add",
"(",
"new",
"ExplanatoryText",
"(",
"\"These examples all use the same list ... | Examples of readonly states. When in a read only state only the selected option is output. Since a
WRadioButtonSeelct can only have 0 or 1 selected option the LAYOUT and FRAME are ignored. | [
"Examples",
"of",
"readonly",
"states",
".",
"When",
"in",
"a",
"read",
"only",
"state",
"only",
"the",
"selected",
"option",
"is",
"output",
".",
"Since",
"a",
"WRadioButtonSeelct",
"can",
"only",
"have",
"0",
"or",
"1",
"selected",
"option",
"the",
"LAYO... | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/theme/WRadioButtonSelectExample.java#L279-L295 |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/routing/bindings/Validator.java | Validator.validateTrue | public void validateTrue(boolean value, String name, String message) {
if (!value) {
addError(name, Optional.ofNullable(message).orElse(messages.get(Validation.TRUE_KEY.name(), name)));
}
} | java | public void validateTrue(boolean value, String name, String message) {
if (!value) {
addError(name, Optional.ofNullable(message).orElse(messages.get(Validation.TRUE_KEY.name(), name)));
}
} | [
"public",
"void",
"validateTrue",
"(",
"boolean",
"value",
",",
"String",
"name",
",",
"String",
"message",
")",
"{",
"if",
"(",
"!",
"value",
")",
"{",
"addError",
"(",
"name",
",",
"Optional",
".",
"ofNullable",
"(",
"message",
")",
".",
"orElse",
"(... | Validates a given value to be true
@param value The value to check
@param name The name of the field to display the error message
@param message A custom error message instead of the default one | [
"Validates",
"a",
"given",
"value",
"to",
"be",
"true"
] | train | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/bindings/Validator.java#L429-L433 |
elki-project/elki | elki/src/main/java/de/lmu/ifi/dbs/elki/index/idistance/InMemoryIDistanceIndex.java | InMemoryIDistanceIndex.rankReferencePoints | protected static <O> DoubleIntPair[] rankReferencePoints(DistanceQuery<O> distanceQuery, O obj, ArrayDBIDs referencepoints) {
DoubleIntPair[] priority = new DoubleIntPair[referencepoints.size()];
// Compute distances to reference points.
for(DBIDArrayIter iter = referencepoints.iter(); iter.valid(); iter.advance()) {
final int i = iter.getOffset();
final double dist = distanceQuery.distance(obj, iter);
priority[i] = new DoubleIntPair(dist, i);
}
Arrays.sort(priority);
return priority;
} | java | protected static <O> DoubleIntPair[] rankReferencePoints(DistanceQuery<O> distanceQuery, O obj, ArrayDBIDs referencepoints) {
DoubleIntPair[] priority = new DoubleIntPair[referencepoints.size()];
// Compute distances to reference points.
for(DBIDArrayIter iter = referencepoints.iter(); iter.valid(); iter.advance()) {
final int i = iter.getOffset();
final double dist = distanceQuery.distance(obj, iter);
priority[i] = new DoubleIntPair(dist, i);
}
Arrays.sort(priority);
return priority;
} | [
"protected",
"static",
"<",
"O",
">",
"DoubleIntPair",
"[",
"]",
"rankReferencePoints",
"(",
"DistanceQuery",
"<",
"O",
">",
"distanceQuery",
",",
"O",
"obj",
",",
"ArrayDBIDs",
"referencepoints",
")",
"{",
"DoubleIntPair",
"[",
"]",
"priority",
"=",
"new",
... | Sort the reference points by distance to the query object
@param distanceQuery Distance query
@param obj Query object
@param referencepoints Iterator for reference points
@return Sorted array. | [
"Sort",
"the",
"reference",
"points",
"by",
"distance",
"to",
"the",
"query",
"object"
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki/src/main/java/de/lmu/ifi/dbs/elki/index/idistance/InMemoryIDistanceIndex.java#L258-L268 |
TakahikoKawasaki/nv-bluetooth | src/main/java/com/neovisionaries/bluetooth/ble/advertising/ADPayloadParser.java | ADPayloadParser.registerBuilder | public void registerBuilder(int type, ADStructureBuilder builder)
{
if (type < 0 || 0xFF < type)
{
String message = String.format("'type' is out of the valid range: %d", type);
throw new IllegalArgumentException(message);
}
if (builder == null)
{
return;
}
// Use the AD type as the key for the builder.
Integer key = Integer.valueOf(type);
// Get the existing list of builders for the AD type.
List<ADStructureBuilder> builders = mBuilders.get(key);
// If no builder has been registered for the AD type yet.
if (builders == null)
{
builders = new ArrayList<ADStructureBuilder>();
mBuilders.put(key, builders);
}
// Register the builder at the beginning of the builder list.
builders.add(0, builder);
} | java | public void registerBuilder(int type, ADStructureBuilder builder)
{
if (type < 0 || 0xFF < type)
{
String message = String.format("'type' is out of the valid range: %d", type);
throw new IllegalArgumentException(message);
}
if (builder == null)
{
return;
}
// Use the AD type as the key for the builder.
Integer key = Integer.valueOf(type);
// Get the existing list of builders for the AD type.
List<ADStructureBuilder> builders = mBuilders.get(key);
// If no builder has been registered for the AD type yet.
if (builders == null)
{
builders = new ArrayList<ADStructureBuilder>();
mBuilders.put(key, builders);
}
// Register the builder at the beginning of the builder list.
builders.add(0, builder);
} | [
"public",
"void",
"registerBuilder",
"(",
"int",
"type",
",",
"ADStructureBuilder",
"builder",
")",
"{",
"if",
"(",
"type",
"<",
"0",
"||",
"0xFF",
"<",
"type",
")",
"{",
"String",
"message",
"=",
"String",
".",
"format",
"(",
"\"'type' is out of the valid r... | Register an AD structure builder for the AD type. The given builder
is added at the beginning of the list of the builders for the AD type.
<p>
Note that a builder for the type <i>Manufacturer Specific Data</i>
(0xFF) should not be registered by this method. Instead, use
{@link #registerManufacturerSpecificBuilder(int,
ADManufacturerSpecificBuilder)}.
</p>
@param type
AD type. The value must be in the range from 0 to 0xFF.
@param builder
AD structure builder. | [
"Register",
"an",
"AD",
"structure",
"builder",
"for",
"the",
"AD",
"type",
".",
"The",
"given",
"builder",
"is",
"added",
"at",
"the",
"beginning",
"of",
"the",
"list",
"of",
"the",
"builders",
"for",
"the",
"AD",
"type",
"."
] | train | https://github.com/TakahikoKawasaki/nv-bluetooth/blob/ef0099e941cd377571398615ea5e18cfc84cadd3/src/main/java/com/neovisionaries/bluetooth/ble/advertising/ADPayloadParser.java#L152-L180 |
box/box-java-sdk | src/main/java/com/box/sdk/BoxUser.java | BoxUser.getMemberships | public Collection<BoxGroupMembership.Info> getMemberships() {
BoxAPIConnection api = this.getAPI();
URL url = USER_MEMBERSHIPS_URL_TEMPLATE.build(this.getAPI().getBaseURL(), this.getID());
BoxAPIRequest request = new BoxAPIRequest(api, url, "GET");
BoxJSONResponse response = (BoxJSONResponse) request.send();
JsonObject responseJSON = JsonObject.readFrom(response.getJSON());
int entriesCount = responseJSON.get("total_count").asInt();
Collection<BoxGroupMembership.Info> memberships = new ArrayList<BoxGroupMembership.Info>(entriesCount);
JsonArray entries = responseJSON.get("entries").asArray();
for (JsonValue entry : entries) {
JsonObject entryObject = entry.asObject();
BoxGroupMembership membership = new BoxGroupMembership(api, entryObject.get("id").asString());
BoxGroupMembership.Info info = membership.new Info(entryObject);
memberships.add(info);
}
return memberships;
} | java | public Collection<BoxGroupMembership.Info> getMemberships() {
BoxAPIConnection api = this.getAPI();
URL url = USER_MEMBERSHIPS_URL_TEMPLATE.build(this.getAPI().getBaseURL(), this.getID());
BoxAPIRequest request = new BoxAPIRequest(api, url, "GET");
BoxJSONResponse response = (BoxJSONResponse) request.send();
JsonObject responseJSON = JsonObject.readFrom(response.getJSON());
int entriesCount = responseJSON.get("total_count").asInt();
Collection<BoxGroupMembership.Info> memberships = new ArrayList<BoxGroupMembership.Info>(entriesCount);
JsonArray entries = responseJSON.get("entries").asArray();
for (JsonValue entry : entries) {
JsonObject entryObject = entry.asObject();
BoxGroupMembership membership = new BoxGroupMembership(api, entryObject.get("id").asString());
BoxGroupMembership.Info info = membership.new Info(entryObject);
memberships.add(info);
}
return memberships;
} | [
"public",
"Collection",
"<",
"BoxGroupMembership",
".",
"Info",
">",
"getMemberships",
"(",
")",
"{",
"BoxAPIConnection",
"api",
"=",
"this",
".",
"getAPI",
"(",
")",
";",
"URL",
"url",
"=",
"USER_MEMBERSHIPS_URL_TEMPLATE",
".",
"build",
"(",
"this",
".",
"g... | Gets information about all of the group memberships for this user.
Does not support paging.
<p>Note: This method is only available to enterprise admins.</p>
@return a collection of information about the group memberships for this user. | [
"Gets",
"information",
"about",
"all",
"of",
"the",
"group",
"memberships",
"for",
"this",
"user",
".",
"Does",
"not",
"support",
"paging",
"."
] | train | https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/BoxUser.java#L301-L320 |
apache/incubator-gobblin | gobblin-utility/src/main/java/org/apache/gobblin/util/PathUtils.java | PathUtils.addExtension | public static Path addExtension(Path path, String... extensions) {
StringBuilder pathStringBuilder = new StringBuilder(path.toString());
for (String extension : extensions) {
if (!Strings.isNullOrEmpty(extension)) {
pathStringBuilder.append(extension);
}
}
return new Path(pathStringBuilder.toString());
} | java | public static Path addExtension(Path path, String... extensions) {
StringBuilder pathStringBuilder = new StringBuilder(path.toString());
for (String extension : extensions) {
if (!Strings.isNullOrEmpty(extension)) {
pathStringBuilder.append(extension);
}
}
return new Path(pathStringBuilder.toString());
} | [
"public",
"static",
"Path",
"addExtension",
"(",
"Path",
"path",
",",
"String",
"...",
"extensions",
")",
"{",
"StringBuilder",
"pathStringBuilder",
"=",
"new",
"StringBuilder",
"(",
"path",
".",
"toString",
"(",
")",
")",
";",
"for",
"(",
"String",
"extensi... | Suffix all <code>extensions</code> to <code>path</code>.
<pre>
PathUtils.addExtension("/tmp/data/file", ".txt") = file.txt
PathUtils.addExtension("/tmp/data/file.txt.gpg", ".zip") = file.txt.gpg.zip
PathUtils.addExtension("/tmp/data/file.txt", ".tar", ".gz") = file.txt.tar.gz
PathUtils.addExtension("/tmp/data/file.txt.gpg", ".tar.txt") = file.txt.gpg.tar.txt
</pre>
@param path to which the <code>extensions</code> need to be added
@param extensions to be added
@return a new {@link Path} with <code>extensions</code> | [
"Suffix",
"all",
"<code",
">",
"extensions<",
"/",
"code",
">",
"to",
"<code",
">",
"path<",
"/",
"code",
">",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/PathUtils.java#L151-L159 |
google/Accessibility-Test-Framework-for-Android | src/main/java/com/googlecode/eyesfree/utils/WebInterfaceUtils.java | WebInterfaceUtils.setSpecialContentModeEnabled | public static boolean setSpecialContentModeEnabled(
AccessibilityNodeInfoCompat node, boolean enabled) {
final int direction = (enabled) ? DIRECTION_FORWARD : DIRECTION_BACKWARD;
return performSpecialAction(node, ACTION_TOGGLE_SPECIAL_CONTENT, direction);
} | java | public static boolean setSpecialContentModeEnabled(
AccessibilityNodeInfoCompat node, boolean enabled) {
final int direction = (enabled) ? DIRECTION_FORWARD : DIRECTION_BACKWARD;
return performSpecialAction(node, ACTION_TOGGLE_SPECIAL_CONTENT, direction);
} | [
"public",
"static",
"boolean",
"setSpecialContentModeEnabled",
"(",
"AccessibilityNodeInfoCompat",
"node",
",",
"boolean",
"enabled",
")",
"{",
"final",
"int",
"direction",
"=",
"(",
"enabled",
")",
"?",
"DIRECTION_FORWARD",
":",
"DIRECTION_BACKWARD",
";",
"return",
... | Sends a message to ChromeVox indicating that it should enter or exit
special content navigation. This is applicable for things like tables and
math expressions.
<p>
NOTE: further navigation should occur at the default movement
granularity.
@param node The node representing the web content
@param enabled Whether this mode should be entered or exited
@return {@code true} if the action was performed, {@code false}
otherwise. | [
"Sends",
"a",
"message",
"to",
"ChromeVox",
"indicating",
"that",
"it",
"should",
"enter",
"or",
"exit",
"special",
"content",
"navigation",
".",
"This",
"is",
"applicable",
"for",
"things",
"like",
"tables",
"and",
"math",
"expressions",
".",
"<p",
">",
"NO... | train | https://github.com/google/Accessibility-Test-Framework-for-Android/blob/a6117fe0059c82dd764fa628d3817d724570f69e/src/main/java/com/googlecode/eyesfree/utils/WebInterfaceUtils.java#L251-L255 |
timewalker74/ffmq | core/src/main/java/net/timewalker/ffmq4/local/connection/LocalQueueConnection.java | LocalQueueConnection.createDurableConnectionConsumer | @Override
public ConnectionConsumer createDurableConnectionConsumer(Topic topic, String subscriptionName, String messageSelector, ServerSessionPool sessionPool, int maxMessages) throws JMSException
{
throw new IllegalStateException("Method not available on this domain.");
} | java | @Override
public ConnectionConsumer createDurableConnectionConsumer(Topic topic, String subscriptionName, String messageSelector, ServerSessionPool sessionPool, int maxMessages) throws JMSException
{
throw new IllegalStateException("Method not available on this domain.");
} | [
"@",
"Override",
"public",
"ConnectionConsumer",
"createDurableConnectionConsumer",
"(",
"Topic",
"topic",
",",
"String",
"subscriptionName",
",",
"String",
"messageSelector",
",",
"ServerSessionPool",
"sessionPool",
",",
"int",
"maxMessages",
")",
"throws",
"JMSException... | /* (non-Javadoc)
@see net.timewalker.ffmq4.common.connection.AbstractConnection#createDurableConnectionConsumer(javax.jms.Topic, java.lang.String, java.lang.String, javax.jms.ServerSessionPool, int) | [
"/",
"*",
"(",
"non",
"-",
"Javadoc",
")"
] | train | https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/local/connection/LocalQueueConnection.java#L74-L78 |
ZenHarbinger/l2fprod-properties-editor | src/main/java/com/l2fprod/common/beans/BeanUtils.java | BeanUtils.getReadMethod | public static Method getReadMethod(Class<?> clazz, String propertyName) {
Method readMethod = null;
try {
PropertyDescriptor[] thisProps = Introspector.getBeanInfo(clazz).getPropertyDescriptors();
for (PropertyDescriptor pd : thisProps) {
if (pd.getName().equals(propertyName) && pd.getReadMethod() != null) {
readMethod = pd.getReadMethod();
break;
}
}
} catch (IntrospectionException ex) {
Logger.getLogger(BeanUtils.class.getName()).log(Level.SEVERE, null, ex);
}
return readMethod;
} | java | public static Method getReadMethod(Class<?> clazz, String propertyName) {
Method readMethod = null;
try {
PropertyDescriptor[] thisProps = Introspector.getBeanInfo(clazz).getPropertyDescriptors();
for (PropertyDescriptor pd : thisProps) {
if (pd.getName().equals(propertyName) && pd.getReadMethod() != null) {
readMethod = pd.getReadMethod();
break;
}
}
} catch (IntrospectionException ex) {
Logger.getLogger(BeanUtils.class.getName()).log(Level.SEVERE, null, ex);
}
return readMethod;
} | [
"public",
"static",
"Method",
"getReadMethod",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"String",
"propertyName",
")",
"{",
"Method",
"readMethod",
"=",
"null",
";",
"try",
"{",
"PropertyDescriptor",
"[",
"]",
"thisProps",
"=",
"Introspector",
".",
"getBea... | Helper method for getting a read method for a property.
@param clazz the type to get the method for.
@param propertyName the name of the property.
@return the method for reading the property. | [
"Helper",
"method",
"for",
"getting",
"a",
"read",
"method",
"for",
"a",
"property",
"."
] | train | https://github.com/ZenHarbinger/l2fprod-properties-editor/blob/d9b15c3f0b6ac1d9a2a9d315be073d2a4a419c32/src/main/java/com/l2fprod/common/beans/BeanUtils.java#L45-L59 |
looly/hutool | hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelUtil.java | ExcelUtil.read07BySax | public static Excel07SaxReader read07BySax(String path, int sheetIndex, RowHandler rowHandler) {
try {
return new Excel07SaxReader(rowHandler).read(path, sheetIndex);
} catch (NoClassDefFoundError e) {
throw new DependencyException(ObjectUtil.defaultIfNull(e.getCause(), e), PoiChecker.NO_POI_ERROR_MSG);
}
} | java | public static Excel07SaxReader read07BySax(String path, int sheetIndex, RowHandler rowHandler) {
try {
return new Excel07SaxReader(rowHandler).read(path, sheetIndex);
} catch (NoClassDefFoundError e) {
throw new DependencyException(ObjectUtil.defaultIfNull(e.getCause(), e), PoiChecker.NO_POI_ERROR_MSG);
}
} | [
"public",
"static",
"Excel07SaxReader",
"read07BySax",
"(",
"String",
"path",
",",
"int",
"sheetIndex",
",",
"RowHandler",
"rowHandler",
")",
"{",
"try",
"{",
"return",
"new",
"Excel07SaxReader",
"(",
"rowHandler",
")",
".",
"read",
"(",
"path",
",",
"sheetInd... | Sax方式读取Excel07
@param path 路径
@param sheetIndex Sheet索引,-1表示全部Sheet, 0表示第一个Sheet
@param rowHandler 行处理器
@return {@link Excel07SaxReader}
@since 3.2.0 | [
"Sax方式读取Excel07"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelUtil.java#L123-L129 |
lightblueseas/swing-components | src/main/java/de/alpharogroup/swing/paint/PainterExtensions.java | PainterExtensions.getCompoundPainter | @SuppressWarnings("rawtypes")
public static CompoundPainter getCompoundPainter(final Color color,
final GlossPainter.GlossPosition position, final double angle)
{
final MattePainter mp = new MattePainter(color);
final GlossPainter gp = new GlossPainter(color, position);
final PinstripePainter pp = new PinstripePainter(color, angle);
final CompoundPainter compoundPainter = new CompoundPainter(mp, pp, gp);
return compoundPainter;
} | java | @SuppressWarnings("rawtypes")
public static CompoundPainter getCompoundPainter(final Color color,
final GlossPainter.GlossPosition position, final double angle)
{
final MattePainter mp = new MattePainter(color);
final GlossPainter gp = new GlossPainter(color, position);
final PinstripePainter pp = new PinstripePainter(color, angle);
final CompoundPainter compoundPainter = new CompoundPainter(mp, pp, gp);
return compoundPainter;
} | [
"@",
"SuppressWarnings",
"(",
"\"rawtypes\"",
")",
"public",
"static",
"CompoundPainter",
"getCompoundPainter",
"(",
"final",
"Color",
"color",
",",
"final",
"GlossPainter",
".",
"GlossPosition",
"position",
",",
"final",
"double",
"angle",
")",
"{",
"final",
"Mat... | Gets the compound painter.
@param color
the color
@param position
the position
@param angle
the angle
@return the compound painter | [
"Gets",
"the",
"compound",
"painter",
"."
] | train | https://github.com/lightblueseas/swing-components/blob/4045e85cabd8f0ce985cbfff134c3c9873930c79/src/main/java/de/alpharogroup/swing/paint/PainterExtensions.java#L79-L89 |
elki-project/elki | addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/VisualizerContext.java | VisualizerContext.makeStyleResult | protected void makeStyleResult(StyleLibrary stylelib) {
final Database db = ResultUtil.findDatabase(hier);
stylelibrary = stylelib;
List<Clustering<? extends Model>> clusterings = Clustering.getClusteringResults(db);
if(!clusterings.isEmpty()) {
stylepolicy = new ClusterStylingPolicy(clusterings.get(0), stylelib);
}
else {
Clustering<Model> c = generateDefaultClustering();
stylepolicy = new ClusterStylingPolicy(c, stylelib);
}
} | java | protected void makeStyleResult(StyleLibrary stylelib) {
final Database db = ResultUtil.findDatabase(hier);
stylelibrary = stylelib;
List<Clustering<? extends Model>> clusterings = Clustering.getClusteringResults(db);
if(!clusterings.isEmpty()) {
stylepolicy = new ClusterStylingPolicy(clusterings.get(0), stylelib);
}
else {
Clustering<Model> c = generateDefaultClustering();
stylepolicy = new ClusterStylingPolicy(c, stylelib);
}
} | [
"protected",
"void",
"makeStyleResult",
"(",
"StyleLibrary",
"stylelib",
")",
"{",
"final",
"Database",
"db",
"=",
"ResultUtil",
".",
"findDatabase",
"(",
"hier",
")",
";",
"stylelibrary",
"=",
"stylelib",
";",
"List",
"<",
"Clustering",
"<",
"?",
"extends",
... | Generate a new style result for the given style library.
@param stylelib Style library | [
"Generate",
"a",
"new",
"style",
"result",
"for",
"the",
"given",
"style",
"library",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/VisualizerContext.java#L171-L182 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/tools/javac/util/ByteBuffer.java | ByteBuffer.appendBytes | public void appendBytes(byte[] bs, int start, int len) {
elems = ArrayUtils.ensureCapacity(elems, length + len);
System.arraycopy(bs, start, elems, length, len);
length += len;
} | java | public void appendBytes(byte[] bs, int start, int len) {
elems = ArrayUtils.ensureCapacity(elems, length + len);
System.arraycopy(bs, start, elems, length, len);
length += len;
} | [
"public",
"void",
"appendBytes",
"(",
"byte",
"[",
"]",
"bs",
",",
"int",
"start",
",",
"int",
"len",
")",
"{",
"elems",
"=",
"ArrayUtils",
".",
"ensureCapacity",
"(",
"elems",
",",
"length",
"+",
"len",
")",
";",
"System",
".",
"arraycopy",
"(",
"bs... | Append `len' bytes from byte array,
starting at given `start' offset. | [
"Append",
"len",
"bytes",
"from",
"byte",
"array",
"starting",
"at",
"given",
"start",
"offset",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/util/ByteBuffer.java#L73-L77 |
banq/jdonframework | JdonAccessory/jdon-remote/src/main/java/com/jdon/bussinessproxy/remote/hessian/io/LazyUtil.java | LazyUtil.isPropertyInitialized | public static boolean isPropertyInitialized(Object object) {
Class < ? > cl = getHibernateClass();
if (cl == null) {
return true;
}
Method method = getInitializeMethod(cl);
return checkInitialize(method, object);
} | java | public static boolean isPropertyInitialized(Object object) {
Class < ? > cl = getHibernateClass();
if (cl == null) {
return true;
}
Method method = getInitializeMethod(cl);
return checkInitialize(method, object);
} | [
"public",
"static",
"boolean",
"isPropertyInitialized",
"(",
"Object",
"object",
")",
"{",
"Class",
"<",
"?",
">",
"cl",
"=",
"getHibernateClass",
"(",
")",
";",
"if",
"(",
"cl",
"==",
"null",
")",
"{",
"return",
"true",
";",
"}",
"Method",
"method",
"... | Check is current object was initialized
@param object - object, which need check
@return boolean value | [
"Check",
"is",
"current",
"object",
"was",
"initialized"
] | train | https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/JdonAccessory/jdon-remote/src/main/java/com/jdon/bussinessproxy/remote/hessian/io/LazyUtil.java#L98-L107 |
kkopacz/agiso-core | bundles/agiso-core-beans/src/main/java/org/agiso/core/beans/util/BeanUtils.java | BeanUtils.getBean | public static Object getBean(String name, long waitTime) {
checkBeanFactory(waitTime, name);
return beanFactory.getBean(name);
} | java | public static Object getBean(String name, long waitTime) {
checkBeanFactory(waitTime, name);
return beanFactory.getBean(name);
} | [
"public",
"static",
"Object",
"getBean",
"(",
"String",
"name",
",",
"long",
"waitTime",
")",
"{",
"checkBeanFactory",
"(",
"waitTime",
",",
"name",
")",
";",
"return",
"beanFactory",
".",
"getBean",
"(",
"name",
")",
";",
"}"
] | Pobiera z kontekstu aplikacji obiekt o wskazanej nazwie w razie
potrzeby wstrzymując bieżący wątek w oczekiwaniu na inicjalizację fabryki
obiektów (poprzez wywołanie metody {@link #setBeanFactory(IBeanFactory)}).
@param name Nazwa jednoznacznie identyfikująca obiekt.
@param waitTime Maksymalny czas oczekiwania na inicjalizację fabryki
obiektów (w sekundach). Wartość ujemna oznacza czas nieograniczony.
@return Obiekt o wskazanej nazwie lub <code>null</code> jeśli nie znaleziono.
@throws BeanRetrievalException jeśli nie została ustawiona fabryka obiektów
lub nie udało się pozyskać żądanego obiektu. | [
"Pobiera",
"z",
"kontekstu",
"aplikacji",
"obiekt",
"o",
"wskazanej",
"nazwie",
"w",
"razie",
"potrzeby",
"wstrzymując",
"bieżący",
"wątek",
"w",
"oczekiwaniu",
"na",
"inicjalizację",
"fabryki",
"obiektów",
"(",
"poprzez",
"wywołanie",
"metody",
"{",
"@link",
"#se... | train | https://github.com/kkopacz/agiso-core/blob/b994ec0146be1fe3f10829d69cd719bdbdebe1c5/bundles/agiso-core-beans/src/main/java/org/agiso/core/beans/util/BeanUtils.java#L85-L89 |
google/error-prone-javac | src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java | HtmlDocletWriter.addTagsInfo | protected void addTagsInfo(Element e, Content htmltree) {
if (configuration.nocomment) {
return;
}
Content dl = new HtmlTree(HtmlTag.DL);
if (utils.isExecutableElement(e) && !utils.isConstructor(e)) {
addMethodInfo((ExecutableElement)e, dl);
}
Content output = new ContentBuilder();
TagletWriter.genTagOutput(configuration.tagletManager, e,
configuration.tagletManager.getCustomTaglets(e),
getTagletWriterInstance(false), output);
dl.addContent(output);
htmltree.addContent(dl);
} | java | protected void addTagsInfo(Element e, Content htmltree) {
if (configuration.nocomment) {
return;
}
Content dl = new HtmlTree(HtmlTag.DL);
if (utils.isExecutableElement(e) && !utils.isConstructor(e)) {
addMethodInfo((ExecutableElement)e, dl);
}
Content output = new ContentBuilder();
TagletWriter.genTagOutput(configuration.tagletManager, e,
configuration.tagletManager.getCustomTaglets(e),
getTagletWriterInstance(false), output);
dl.addContent(output);
htmltree.addContent(dl);
} | [
"protected",
"void",
"addTagsInfo",
"(",
"Element",
"e",
",",
"Content",
"htmltree",
")",
"{",
"if",
"(",
"configuration",
".",
"nocomment",
")",
"{",
"return",
";",
"}",
"Content",
"dl",
"=",
"new",
"HtmlTree",
"(",
"HtmlTag",
".",
"DL",
")",
";",
"if... | Adds the tags information.
@param e the Element for which the tags will be generated
@param htmltree the documentation tree to which the tags will be added | [
"Adds",
"the",
"tags",
"information",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java#L310-L324 |
osglworks/java-tool | src/main/java/org/osgl/Lang.java | F3.lift | public F3<P1, P2, P3, Option<R>> lift() {
final F3<P1, P2, P3, R> me = this;
return new F3<P1, P2, P3, Option<R>>() {
@Override
public Option<R> apply(P1 p1, P2 p2, P3 p3) {
try {
return some(me.apply(p1, p2, p3));
} catch (RuntimeException e) {
return none();
}
}
};
} | java | public F3<P1, P2, P3, Option<R>> lift() {
final F3<P1, P2, P3, R> me = this;
return new F3<P1, P2, P3, Option<R>>() {
@Override
public Option<R> apply(P1 p1, P2 p2, P3 p3) {
try {
return some(me.apply(p1, p2, p3));
} catch (RuntimeException e) {
return none();
}
}
};
} | [
"public",
"F3",
"<",
"P1",
",",
"P2",
",",
"P3",
",",
"Option",
"<",
"R",
">",
">",
"lift",
"(",
")",
"{",
"final",
"F3",
"<",
"P1",
",",
"P2",
",",
"P3",
",",
"R",
">",
"me",
"=",
"this",
";",
"return",
"new",
"F3",
"<",
"P1",
",",
"P2",... | Turns this partial function into a plain function returning an Option result.
@return a function that takes an argument x to Some(this.apply(x)) if this can be applied, and to None otherwise. | [
"Turns",
"this",
"partial",
"function",
"into",
"a",
"plain",
"function",
"returning",
"an",
"Option",
"result",
"."
] | train | https://github.com/osglworks/java-tool/blob/8b6eee2bccb067eb32e6a7bc4a4dfef7a7d9008b/src/main/java/org/osgl/Lang.java#L1327-L1339 |
lucee/Lucee | core/src/main/java/lucee/transformer/library/function/FunctionLibEntityResolver.java | FunctionLibEntityResolver.resolveEntity | @Override
public InputSource resolveEntity(String publicId, String systemId) {
for (int i = 0; i < Constants.DTDS_FLD.length; i++) {
if (publicId.equals(Constants.DTDS_FLD[i])) {
return new InputSource(getClass().getResourceAsStream(DTD_1_0));
}
}
return null;
} | java | @Override
public InputSource resolveEntity(String publicId, String systemId) {
for (int i = 0; i < Constants.DTDS_FLD.length; i++) {
if (publicId.equals(Constants.DTDS_FLD[i])) {
return new InputSource(getClass().getResourceAsStream(DTD_1_0));
}
}
return null;
} | [
"@",
"Override",
"public",
"InputSource",
"resolveEntity",
"(",
"String",
"publicId",
",",
"String",
"systemId",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"Constants",
".",
"DTDS_FLD",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"... | Laedt die DTD vom lokalen System.
@see org.xml.sax.EntityResolver#resolveEntity(java.lang.String, java.lang.String) | [
"Laedt",
"die",
"DTD",
"vom",
"lokalen",
"System",
"."
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/transformer/library/function/FunctionLibEntityResolver.java#L43-L51 |
hawkular/hawkular-agent | hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/InfinispanJBossASClient.java | InfinispanJBossASClient.createNewCacheContainerRequest | public ModelNode createNewCacheContainerRequest(String name, String defaultCacheName) {
String dmrTemplate = "" //
+ "{" //
+ "\"default-cache-name\" => \"%s\" ," //
+ "\"jndi-name\" => \"%s\" " //
+ "}";
String jndiName = "java:jboss/infinispan/" + name;
String dmr = String.format(dmrTemplate, defaultCacheName, jndiName);
Address addr = Address.root().add(SUBSYSTEM, SUBSYSTEM_INFINISPAN, CACHE_CONTAINER, name);
final ModelNode result = ModelNode.fromString(dmr);
result.get(OPERATION).set(ADD);
result.get(ADDRESS).set(addr.getAddressNode());
return result;
} | java | public ModelNode createNewCacheContainerRequest(String name, String defaultCacheName) {
String dmrTemplate = "" //
+ "{" //
+ "\"default-cache-name\" => \"%s\" ," //
+ "\"jndi-name\" => \"%s\" " //
+ "}";
String jndiName = "java:jboss/infinispan/" + name;
String dmr = String.format(dmrTemplate, defaultCacheName, jndiName);
Address addr = Address.root().add(SUBSYSTEM, SUBSYSTEM_INFINISPAN, CACHE_CONTAINER, name);
final ModelNode result = ModelNode.fromString(dmr);
result.get(OPERATION).set(ADD);
result.get(ADDRESS).set(addr.getAddressNode());
return result;
} | [
"public",
"ModelNode",
"createNewCacheContainerRequest",
"(",
"String",
"name",
",",
"String",
"defaultCacheName",
")",
"{",
"String",
"dmrTemplate",
"=",
"\"\"",
"//",
"+",
"\"{\"",
"//",
"+",
"\"\\\"default-cache-name\\\" => \\\"%s\\\" ,\"",
"//",
"+",
"\"\\\"jndi-nam... | Returns a ModelNode that can be used to create a cache container configuration for
subsequent cache configuration. Callers are free to tweak the request that is returned,
if they so choose, before asking the client to execute the request.
<p>
The JNDI name will be java:jboss/infinispan/<cacheContainerName>
</p>
@param name the name of the cache container
@param defaultCacheName the name of the default cache. The referenced cache must be
subsequently created.
@return the request to create the cache container configuration. | [
"Returns",
"a",
"ModelNode",
"that",
"can",
"be",
"used",
"to",
"create",
"a",
"cache",
"container",
"configuration",
"for",
"subsequent",
"cache",
"configuration",
".",
"Callers",
"are",
"free",
"to",
"tweak",
"the",
"request",
"that",
"is",
"returned",
"if",... | train | https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/InfinispanJBossASClient.java#L83-L99 |
Azure/azure-sdk-for-java | compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetExtensionsInner.java | VirtualMachineScaleSetExtensionsInner.listAsync | public Observable<Page<VirtualMachineScaleSetExtensionInner>> listAsync(final String resourceGroupName, final String vmScaleSetName) {
return listWithServiceResponseAsync(resourceGroupName, vmScaleSetName)
.map(new Func1<ServiceResponse<Page<VirtualMachineScaleSetExtensionInner>>, Page<VirtualMachineScaleSetExtensionInner>>() {
@Override
public Page<VirtualMachineScaleSetExtensionInner> call(ServiceResponse<Page<VirtualMachineScaleSetExtensionInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<VirtualMachineScaleSetExtensionInner>> listAsync(final String resourceGroupName, final String vmScaleSetName) {
return listWithServiceResponseAsync(resourceGroupName, vmScaleSetName)
.map(new Func1<ServiceResponse<Page<VirtualMachineScaleSetExtensionInner>>, Page<VirtualMachineScaleSetExtensionInner>>() {
@Override
public Page<VirtualMachineScaleSetExtensionInner> call(ServiceResponse<Page<VirtualMachineScaleSetExtensionInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"VirtualMachineScaleSetExtensionInner",
">",
">",
"listAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"vmScaleSetName",
")",
"{",
"return",
"listWithServiceResponseAsync",
"(",
"resourceGroupName",
... | Gets a list of all extensions in a VM scale set.
@param resourceGroupName The name of the resource group.
@param vmScaleSetName The name of the VM scale set containing the extension.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<VirtualMachineScaleSetExtensionInner> object | [
"Gets",
"a",
"list",
"of",
"all",
"extensions",
"in",
"a",
"VM",
"scale",
"set",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetExtensionsInner.java#L684-L692 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/v1/FirestoreAdminClient.java | FirestoreAdminClient.createIndex | public final Operation createIndex(ParentName parent, Index index) {
CreateIndexRequest request =
CreateIndexRequest.newBuilder()
.setParent(parent == null ? null : parent.toString())
.setIndex(index)
.build();
return createIndex(request);
} | java | public final Operation createIndex(ParentName parent, Index index) {
CreateIndexRequest request =
CreateIndexRequest.newBuilder()
.setParent(parent == null ? null : parent.toString())
.setIndex(index)
.build();
return createIndex(request);
} | [
"public",
"final",
"Operation",
"createIndex",
"(",
"ParentName",
"parent",
",",
"Index",
"index",
")",
"{",
"CreateIndexRequest",
"request",
"=",
"CreateIndexRequest",
".",
"newBuilder",
"(",
")",
".",
"setParent",
"(",
"parent",
"==",
"null",
"?",
"null",
":... | Creates a composite index. This returns a
[google.longrunning.Operation][google.longrunning.Operation] which may be used to track the
status of the creation. The metadata for the operation will be the type
[IndexOperationMetadata][google.firestore.admin.v1.IndexOperationMetadata].
<p>Sample code:
<pre><code>
try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
ParentName parent = ParentName.of("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]");
Index index = Index.newBuilder().build();
Operation response = firestoreAdminClient.createIndex(parent, index);
}
</code></pre>
@param parent A parent name of the form
`projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}`
@param index The composite index to create.
@throws com.google.api.gax.rpc.ApiException if the remote call fails | [
"Creates",
"a",
"composite",
"index",
".",
"This",
"returns",
"a",
"[",
"google",
".",
"longrunning",
".",
"Operation",
"]",
"[",
"google",
".",
"longrunning",
".",
"Operation",
"]",
"which",
"may",
"be",
"used",
"to",
"track",
"the",
"status",
"of",
"th... | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/v1/FirestoreAdminClient.java#L199-L207 |
jamesagnew/hapi-fhir | hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/module/subscriber/BaseResourceMessage.java | BaseResourceMessage.setAttribute | public void setAttribute(String theKey, String theValue) {
Validate.notBlank(theKey);
Validate.notNull(theValue);
if (myAttributes == null) {
myAttributes = new HashMap<>();
}
myAttributes.put(theKey, theValue);
} | java | public void setAttribute(String theKey, String theValue) {
Validate.notBlank(theKey);
Validate.notNull(theValue);
if (myAttributes == null) {
myAttributes = new HashMap<>();
}
myAttributes.put(theKey, theValue);
} | [
"public",
"void",
"setAttribute",
"(",
"String",
"theKey",
",",
"String",
"theValue",
")",
"{",
"Validate",
".",
"notBlank",
"(",
"theKey",
")",
";",
"Validate",
".",
"notNull",
"(",
"theValue",
")",
";",
"if",
"(",
"myAttributes",
"==",
"null",
")",
"{"... | Sets an attribute stored in this message.
<p>
Attributes are just a spot for user data of any kind to be
added to the message for passing along the subscription processing
pipeline (typically by interceptors). Values will be carried from the beginning to the end.
</p>
<p>
Note that messages are designed to be passed into queueing systems
and serialized as JSON. As a result, only strings are currently allowed
as values.
</p>
@param theKey The key (must not be null or blank)
@param theValue The value (must not be null) | [
"Sets",
"an",
"attribute",
"stored",
"in",
"this",
"message",
".",
"<p",
">",
"Attributes",
"are",
"just",
"a",
"spot",
"for",
"user",
"data",
"of",
"any",
"kind",
"to",
"be",
"added",
"to",
"the",
"message",
"for",
"passing",
"along",
"the",
"subscripti... | train | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/module/subscriber/BaseResourceMessage.java#L77-L84 |
aws/aws-sdk-java | aws-java-sdk-opsworks/src/main/java/com/amazonaws/services/opsworks/model/WeeklyAutoScalingSchedule.java | WeeklyAutoScalingSchedule.withSunday | public WeeklyAutoScalingSchedule withSunday(java.util.Map<String, String> sunday) {
setSunday(sunday);
return this;
} | java | public WeeklyAutoScalingSchedule withSunday(java.util.Map<String, String> sunday) {
setSunday(sunday);
return this;
} | [
"public",
"WeeklyAutoScalingSchedule",
"withSunday",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"sunday",
")",
"{",
"setSunday",
"(",
"sunday",
")",
";",
"return",
"this",
";",
"}"
] | <p>
The schedule for Sunday.
</p>
@param sunday
The schedule for Sunday.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"The",
"schedule",
"for",
"Sunday",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-opsworks/src/main/java/com/amazonaws/services/opsworks/model/WeeklyAutoScalingSchedule.java#L521-L524 |
nguillaumin/slick2d-maven | slick2d-core/src/main/java/org/newdawn/slick/util/pathfinding/navmesh/Space.java | Space.pickLowestCost | public boolean pickLowestCost(Space target, NavPath path) {
if (target == this) {
return true;
}
if (links.size() == 0) {
return false;
}
Link bestLink = null;
for (int i=0;i<getLinkCount();i++) {
Link link = getLink(i);
if ((bestLink == null) || (link.getTarget().getCost() < bestLink.getTarget().getCost())) {
bestLink = link;
}
}
path.push(bestLink);
return bestLink.getTarget().pickLowestCost(target, path);
} | java | public boolean pickLowestCost(Space target, NavPath path) {
if (target == this) {
return true;
}
if (links.size() == 0) {
return false;
}
Link bestLink = null;
for (int i=0;i<getLinkCount();i++) {
Link link = getLink(i);
if ((bestLink == null) || (link.getTarget().getCost() < bestLink.getTarget().getCost())) {
bestLink = link;
}
}
path.push(bestLink);
return bestLink.getTarget().pickLowestCost(target, path);
} | [
"public",
"boolean",
"pickLowestCost",
"(",
"Space",
"target",
",",
"NavPath",
"path",
")",
"{",
"if",
"(",
"target",
"==",
"this",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"links",
".",
"size",
"(",
")",
"==",
"0",
")",
"{",
"return",
"fal... | Pick the lowest cost route from this space to another on the path
@param target The target space we're looking for
@param path The path to add the steps to
@return True if the path was found | [
"Pick",
"the",
"lowest",
"cost",
"route",
"from",
"this",
"space",
"to",
"another",
"on",
"the",
"path"
] | train | https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/util/pathfinding/navmesh/Space.java#L291-L309 |
wealthfront/magellan | magellan-library/src/main/java/com/wealthfront/magellan/Navigator.java | Navigator.onCreate | public void onCreate(Activity activity, Bundle savedInstanceState) {
this.activity = activity;
container = (ScreenContainer) activity.findViewById(R.id.magellan_container);
checkState(container != null, "There must be a ScreenContainer whose id is R.id.magellan_container in the view hierarchy");
for (Screen screen : backStack) {
screen.restore(savedInstanceState);
screen.onRestore(savedInstanceState);
}
showCurrentScreen(FORWARD);
} | java | public void onCreate(Activity activity, Bundle savedInstanceState) {
this.activity = activity;
container = (ScreenContainer) activity.findViewById(R.id.magellan_container);
checkState(container != null, "There must be a ScreenContainer whose id is R.id.magellan_container in the view hierarchy");
for (Screen screen : backStack) {
screen.restore(savedInstanceState);
screen.onRestore(savedInstanceState);
}
showCurrentScreen(FORWARD);
} | [
"public",
"void",
"onCreate",
"(",
"Activity",
"activity",
",",
"Bundle",
"savedInstanceState",
")",
"{",
"this",
".",
"activity",
"=",
"activity",
";",
"container",
"=",
"(",
"ScreenContainer",
")",
"activity",
".",
"findViewById",
"(",
"R",
".",
"id",
".",... | Initializes the Navigator with Activity instance and Bundle for saved instance state.
Call this method from {@link Activity#onCreate(Bundle) onCreate} of the Activity associated with this Navigator.
@param activity Activity associated with application
@param savedInstanceState state to restore from previously destroyed activity
@throws IllegalStateException when no {@link ScreenContainer} view present in hierarchy with view id of container | [
"Initializes",
"the",
"Navigator",
"with",
"Activity",
"instance",
"and",
"Bundle",
"for",
"saved",
"instance",
"state",
"."
] | train | https://github.com/wealthfront/magellan/blob/f690979161a97e40fb9d11dc9d7e3c8cf85ba312/magellan-library/src/main/java/com/wealthfront/magellan/Navigator.java#L86-L95 |
pressgang-ccms/PressGangCCMSCommonUtilities | src/main/java/org/jboss/pressgang/ccms/utils/common/ExecUtilities.java | ExecUtilities.runCommand | public static boolean runCommand(final Process p, final OutputStream output) {
return runCommand(p, output, output, new ArrayList<String>());
} | java | public static boolean runCommand(final Process p, final OutputStream output) {
return runCommand(p, output, output, new ArrayList<String>());
} | [
"public",
"static",
"boolean",
"runCommand",
"(",
"final",
"Process",
"p",
",",
"final",
"OutputStream",
"output",
")",
"{",
"return",
"runCommand",
"(",
"p",
",",
"output",
",",
"output",
",",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
")",
";",
... | Run a Process, and read the various streams so there is not a buffer
overrun.
@param p The Process to be executed
@param output The Stream to receive the Process' output stream
@return true if the Process returned 0, false otherwise | [
"Run",
"a",
"Process",
"and",
"read",
"the",
"various",
"streams",
"so",
"there",
"is",
"not",
"a",
"buffer",
"overrun",
"."
] | train | https://github.com/pressgang-ccms/PressGangCCMSCommonUtilities/blob/5ebf5ed30a94c34c33f4708caa04a8da99cbb15c/src/main/java/org/jboss/pressgang/ccms/utils/common/ExecUtilities.java#L48-L50 |
ksclarke/vertx-pairtree | src/main/java/info/freelibrary/pairtree/PairtreeFactory.java | PairtreeFactory.getPairtree | public Pairtree getPairtree(final String aBucket, final String aBucketPath) throws PairtreeException {
if (myAccessKey.isPresent() && mySecretKey.isPresent()) {
final String accessKey = myAccessKey.get();
final String secretKey = mySecretKey.get();
if (myRegion.isPresent()) {
return new S3Pairtree(myVertx, aBucket, aBucketPath, accessKey, secretKey, myRegion.get());
} else {
return new S3Pairtree(myVertx, aBucket, aBucketPath, accessKey, secretKey);
}
} else {
throw new PairtreeException(MessageCodes.PT_021);
}
} | java | public Pairtree getPairtree(final String aBucket, final String aBucketPath) throws PairtreeException {
if (myAccessKey.isPresent() && mySecretKey.isPresent()) {
final String accessKey = myAccessKey.get();
final String secretKey = mySecretKey.get();
if (myRegion.isPresent()) {
return new S3Pairtree(myVertx, aBucket, aBucketPath, accessKey, secretKey, myRegion.get());
} else {
return new S3Pairtree(myVertx, aBucket, aBucketPath, accessKey, secretKey);
}
} else {
throw new PairtreeException(MessageCodes.PT_021);
}
} | [
"public",
"Pairtree",
"getPairtree",
"(",
"final",
"String",
"aBucket",
",",
"final",
"String",
"aBucketPath",
")",
"throws",
"PairtreeException",
"{",
"if",
"(",
"myAccessKey",
".",
"isPresent",
"(",
")",
"&&",
"mySecretKey",
".",
"isPresent",
"(",
")",
")",
... | Gets the S3 based Pairtree using the supplied S3 bucket and bucket path.
@param aBucket An S3 bucket in which to create the Pairtree
@param aBucketPath A path in the S3 bucket at which to put the Pairtree
@return A Pairtree root
@throws PairtreeException If there is trouble creating the Pairtree | [
"Gets",
"the",
"S3",
"based",
"Pairtree",
"using",
"the",
"supplied",
"S3",
"bucket",
"and",
"bucket",
"path",
"."
] | train | https://github.com/ksclarke/vertx-pairtree/blob/b2ea1e32057e5df262e9265540d346a732b718df/src/main/java/info/freelibrary/pairtree/PairtreeFactory.java#L140-L153 |
phax/ph-commons | ph-xml/src/main/java/com/helger/xml/xpath/XPathHelper.java | XPathHelper.createNewXPath | @Nonnull
public static XPath createNewXPath (@Nonnull final XPathFactory aXPathFactory,
@Nullable final XPathFunctionResolver aFunctionResolver)
{
return createNewXPath (aXPathFactory, (XPathVariableResolver) null, aFunctionResolver, (NamespaceContext) null);
} | java | @Nonnull
public static XPath createNewXPath (@Nonnull final XPathFactory aXPathFactory,
@Nullable final XPathFunctionResolver aFunctionResolver)
{
return createNewXPath (aXPathFactory, (XPathVariableResolver) null, aFunctionResolver, (NamespaceContext) null);
} | [
"@",
"Nonnull",
"public",
"static",
"XPath",
"createNewXPath",
"(",
"@",
"Nonnull",
"final",
"XPathFactory",
"aXPathFactory",
",",
"@",
"Nullable",
"final",
"XPathFunctionResolver",
"aFunctionResolver",
")",
"{",
"return",
"createNewXPath",
"(",
"aXPathFactory",
",",
... | Create a new {@link XPath} with the passed function resolver.
@param aXPathFactory
The XPath factory object to use. May not be <code>null</code>.
@param aFunctionResolver
Function resolver to be used. May be <code>null</code>.
@return The created non-<code>null</code> {@link XPath} object | [
"Create",
"a",
"new",
"{",
"@link",
"XPath",
"}",
"with",
"the",
"passed",
"function",
"resolver",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-xml/src/main/java/com/helger/xml/xpath/XPathHelper.java#L193-L198 |
blackdoor/blackdoor | src/main/java/black/door/struct/GenericMap.java | GenericMap.get | public <T> T get(String key, Class<T> type) {
return type.cast(grab(key));
} | java | public <T> T get(String key, Class<T> type) {
return type.cast(grab(key));
} | [
"public",
"<",
"T",
">",
"T",
"get",
"(",
"String",
"key",
",",
"Class",
"<",
"T",
">",
"type",
")",
"{",
"return",
"type",
".",
"cast",
"(",
"grab",
"(",
"key",
")",
")",
";",
"}"
] | Returns the value to which the specified key is mapped, or null if this
map contains no mapping for the key. More formally, if this map contains
a mapping from a key k to a value v such that (key==null ? k==null :
key.equals(k)), then this method returns v; otherwise it returns null.
(There can be at most one such mapping.)
@param key
@param type
@return the value to which the specified key is mapped, or null if this
map contains no mapping for the key | [
"Returns",
"the",
"value",
"to",
"which",
"the",
"specified",
"key",
"is",
"mapped",
"or",
"null",
"if",
"this",
"map",
"contains",
"no",
"mapping",
"for",
"the",
"key",
".",
"More",
"formally",
"if",
"this",
"map",
"contains",
"a",
"mapping",
"from",
"a... | train | https://github.com/blackdoor/blackdoor/blob/060c7a71dfafb85e10e8717736e6d3160262e96b/src/main/java/black/door/struct/GenericMap.java#L89-L91 |
ujmp/universal-java-matrix-package | ujmp-core/src/main/java/org/ujmp/core/doublematrix/calculation/general/decomposition/Ginv.java | Ginv.swapCols | public static void swapCols(DenseDoubleMatrix2D matrix, long col1, long col2) {
double temp = 0;
long rows = matrix.getRowCount();
for (long row = 0; row < rows; row++) {
temp = matrix.getDouble(row, col1);
matrix.setDouble(matrix.getDouble(row, col2), row, col1);
matrix.setDouble(temp, row, col2);
}
} | java | public static void swapCols(DenseDoubleMatrix2D matrix, long col1, long col2) {
double temp = 0;
long rows = matrix.getRowCount();
for (long row = 0; row < rows; row++) {
temp = matrix.getDouble(row, col1);
matrix.setDouble(matrix.getDouble(row, col2), row, col1);
matrix.setDouble(temp, row, col2);
}
} | [
"public",
"static",
"void",
"swapCols",
"(",
"DenseDoubleMatrix2D",
"matrix",
",",
"long",
"col1",
",",
"long",
"col2",
")",
"{",
"double",
"temp",
"=",
"0",
";",
"long",
"rows",
"=",
"matrix",
".",
"getRowCount",
"(",
")",
";",
"for",
"(",
"long",
"ro... | Swap components in the two columns.
@param matrix
the matrix to modify
@param col1
the first row
@param col2
the second row | [
"Swap",
"components",
"in",
"the",
"two",
"columns",
"."
] | train | https://github.com/ujmp/universal-java-matrix-package/blob/b7e1d293adeadaf35d208ffe8884028d6c06b63b/ujmp-core/src/main/java/org/ujmp/core/doublematrix/calculation/general/decomposition/Ginv.java#L164-L172 |
classgraph/classgraph | src/main/java/nonapi/io/github/classgraph/utils/FileUtils.java | FileUtils.readAllBytesAsString | public static String readAllBytesAsString(final InputStream inputStream, final long fileSize)
throws IOException {
final SimpleEntry<byte[], Integer> ent = readAllBytes(inputStream, fileSize);
final byte[] buf = ent.getKey();
final int bufBytesUsed = ent.getValue();
return new String(buf, 0, bufBytesUsed, StandardCharsets.UTF_8);
} | java | public static String readAllBytesAsString(final InputStream inputStream, final long fileSize)
throws IOException {
final SimpleEntry<byte[], Integer> ent = readAllBytes(inputStream, fileSize);
final byte[] buf = ent.getKey();
final int bufBytesUsed = ent.getValue();
return new String(buf, 0, bufBytesUsed, StandardCharsets.UTF_8);
} | [
"public",
"static",
"String",
"readAllBytesAsString",
"(",
"final",
"InputStream",
"inputStream",
",",
"final",
"long",
"fileSize",
")",
"throws",
"IOException",
"{",
"final",
"SimpleEntry",
"<",
"byte",
"[",
"]",
",",
"Integer",
">",
"ent",
"=",
"readAllBytes",... | Read all the bytes in an {@link InputStream} as a String.
@param inputStream
The {@link InputStream}.
@param fileSize
The file size, if known, otherwise -1L.
@return The contents of the {@link InputStream} as a String.
@throws IOException
If the contents could not be read. | [
"Read",
"all",
"the",
"bytes",
"in",
"an",
"{",
"@link",
"InputStream",
"}",
"as",
"a",
"String",
"."
] | train | https://github.com/classgraph/classgraph/blob/c8c8b2ca1eb76339f69193fdac33d735c864215c/src/main/java/nonapi/io/github/classgraph/utils/FileUtils.java#L241-L247 |
bazaarvoice/emodb | auth/auth-core/src/main/java/com/bazaarvoice/emodb/auth/apikey/ApiKeyRealm.java | ApiKeyRealm.hasPermissionById | public boolean hasPermissionById(String id, Permission permission) {
return hasPermissionsById(id, ImmutableList.of(permission));
} | java | public boolean hasPermissionById(String id, Permission permission) {
return hasPermissionsById(id, ImmutableList.of(permission));
} | [
"public",
"boolean",
"hasPermissionById",
"(",
"String",
"id",
",",
"Permission",
"permission",
")",
"{",
"return",
"hasPermissionsById",
"(",
"id",
",",
"ImmutableList",
".",
"of",
"(",
"permission",
")",
")",
";",
"}"
] | Test for whether an API key has a specific permission using its ID. | [
"Test",
"for",
"whether",
"an",
"API",
"key",
"has",
"a",
"specific",
"permission",
"using",
"its",
"ID",
"."
] | train | https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/auth/auth-core/src/main/java/com/bazaarvoice/emodb/auth/apikey/ApiKeyRealm.java#L440-L442 |
alkacon/opencms-core | src/org/opencms/loader/CmsResourceManager.java | CmsResourceManager.getMimeType | public String getMimeType(String filename, String encoding, String defaultMimeType) {
String mimeType = null;
int lastDot = filename.lastIndexOf('.');
// check the MIME type for the file extension
if ((lastDot > 0) && (lastDot < (filename.length() - 1))) {
mimeType = m_mimeTypes.get(filename.substring(lastDot).toLowerCase(Locale.ENGLISH));
}
if (mimeType == null) {
mimeType = defaultMimeType;
if (mimeType == null) {
// no default MIME type was provided
return null;
}
}
StringBuffer result = new StringBuffer(mimeType);
if ((encoding != null)
&& (mimeType.startsWith("text") || mimeType.endsWith("javascript"))
&& (mimeType.indexOf("charset") == -1)) {
result.append("; charset=");
result.append(encoding);
}
return result.toString();
} | java | public String getMimeType(String filename, String encoding, String defaultMimeType) {
String mimeType = null;
int lastDot = filename.lastIndexOf('.');
// check the MIME type for the file extension
if ((lastDot > 0) && (lastDot < (filename.length() - 1))) {
mimeType = m_mimeTypes.get(filename.substring(lastDot).toLowerCase(Locale.ENGLISH));
}
if (mimeType == null) {
mimeType = defaultMimeType;
if (mimeType == null) {
// no default MIME type was provided
return null;
}
}
StringBuffer result = new StringBuffer(mimeType);
if ((encoding != null)
&& (mimeType.startsWith("text") || mimeType.endsWith("javascript"))
&& (mimeType.indexOf("charset") == -1)) {
result.append("; charset=");
result.append(encoding);
}
return result.toString();
} | [
"public",
"String",
"getMimeType",
"(",
"String",
"filename",
",",
"String",
"encoding",
",",
"String",
"defaultMimeType",
")",
"{",
"String",
"mimeType",
"=",
"null",
";",
"int",
"lastDot",
"=",
"filename",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
";",
"//... | Returns the MIME type for a specified file name.<p>
If an encoding parameter that is not <code>null</code> is provided,
the returned MIME type is extended with a <code>; charset={encoding}</code> setting.<p>
If no MIME type for the given filename can be determined, the
provided default is used.<p>
@param filename the file name to check the MIME type for
@param encoding the default encoding (charset) in case of MIME types is of type "text"
@param defaultMimeType the default MIME type to use if no matching type for the filename is found
@return the MIME type for a specified file | [
"Returns",
"the",
"MIME",
"type",
"for",
"a",
"specified",
"file",
"name",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/loader/CmsResourceManager.java#L810-L833 |
PrashamTrivedi/SharedPreferenceInspector | sharedpreferenceinspector/src/main/java/com/ceelites/sharedpreferenceinspector/PrefsAdapter.java | PrefsAdapter.getView | @Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder;
Pair<String, ?> keyVal = getItem(position);
if (convertView == null) {
holder = new ViewHolder();
convertView = inflater.inflate(R.layout.preference_item, parent, false);
holder.key = (TextView) convertView.findViewById(R.id.key);
holder.value = (TextView) convertView.findViewById(R.id.value);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
holder.key.setText(keyVal.first);
String value = "";
Object second = keyVal.second;
if (second != null) {
value = second.toString() + " (" + second.getClass().getSimpleName() + ")";
}
holder.value.setText(value);
return convertView;
} | java | @Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder;
Pair<String, ?> keyVal = getItem(position);
if (convertView == null) {
holder = new ViewHolder();
convertView = inflater.inflate(R.layout.preference_item, parent, false);
holder.key = (TextView) convertView.findViewById(R.id.key);
holder.value = (TextView) convertView.findViewById(R.id.value);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
holder.key.setText(keyVal.first);
String value = "";
Object second = keyVal.second;
if (second != null) {
value = second.toString() + " (" + second.getClass().getSimpleName() + ")";
}
holder.value.setText(value);
return convertView;
} | [
"@",
"Override",
"public",
"View",
"getView",
"(",
"int",
"position",
",",
"View",
"convertView",
",",
"ViewGroup",
"parent",
")",
"{",
"ViewHolder",
"holder",
";",
"Pair",
"<",
"String",
",",
"?",
">",
"keyVal",
"=",
"getItem",
"(",
"position",
")",
";"... | Get a View that displays the data at the specified position in the data set. You can either create a View manually or inflate it from an XML
layout file. When the View is inflated, the parent View (GridView, ListView...) will apply default layout parameters unless you use {@link
android.view.LayoutInflater#inflate(int, android.view.ViewGroup, boolean)} to specify a root view and to prevent attachment to the root.
@param position
The position of the item within the adapter's data set of the item whose view we want.
@param convertView
The old view to reuse, if possible. Note: You should check that this view is non-null and of an appropriate type before using. If it is not
possible to convert this view to display the correct data, this method can create a new view. Heterogeneous lists can specify their number of
view types, so that this View is always of the right type (see {@link #getViewTypeCount()} and {@link #getItemViewType(int)}).
@param parent
The parent that this view will eventually be attached to
@return A View corresponding to the data at the specified position. | [
"Get",
"a",
"View",
"that",
"displays",
"the",
"data",
"at",
"the",
"specified",
"position",
"in",
"the",
"data",
"set",
".",
"You",
"can",
"either",
"create",
"a",
"View",
"manually",
"or",
"inflate",
"it",
"from",
"an",
"XML",
"layout",
"file",
".",
... | train | https://github.com/PrashamTrivedi/SharedPreferenceInspector/blob/c04d567c4d0fc5e0f8cda308ca85df19c6b3b838/sharedpreferenceinspector/src/main/java/com/ceelites/sharedpreferenceinspector/PrefsAdapter.java#L87-L110 |
codecentric/zucchini | zucchini-bdd/src/main/java/de/codecentric/zucchini/bdd/util/Assert.java | Assert.assertEquals | public static void assertEquals(String message, Object expected, Object actual) {
if (expected == null && actual != null || expected != null && !expected.equals(actual)) {
fail(message);
}
} | java | public static void assertEquals(String message, Object expected, Object actual) {
if (expected == null && actual != null || expected != null && !expected.equals(actual)) {
fail(message);
}
} | [
"public",
"static",
"void",
"assertEquals",
"(",
"String",
"message",
",",
"Object",
"expected",
",",
"Object",
"actual",
")",
"{",
"if",
"(",
"expected",
"==",
"null",
"&&",
"actual",
"!=",
"null",
"||",
"expected",
"!=",
"null",
"&&",
"!",
"expected",
... | Asserts that two objects are equal, i.e. {@code expected.equals(actual) == true}, and fails otherwise.
@param message The message of the thrown {@link java.lang.AssertionError}.
@param expected The expected object.
@param actual The actual object. | [
"Asserts",
"that",
"two",
"objects",
"are",
"equal",
"i",
".",
"e",
".",
"{",
"@code",
"expected",
".",
"equals",
"(",
"actual",
")",
"==",
"true",
"}",
"and",
"fails",
"otherwise",
"."
] | train | https://github.com/codecentric/zucchini/blob/61541cd8ce666ef21ad943486a7c0eb53310ed5a/zucchini-bdd/src/main/java/de/codecentric/zucchini/bdd/util/Assert.java#L50-L54 |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/RandomMatrices_DDRM.java | RandomMatrices_DDRM.span | public static DMatrixRMaj[] span(int dimen, int numVectors , Random rand ) {
if( dimen < numVectors )
throw new IllegalArgumentException("The number of vectors must be less than or equal to the dimension");
DMatrixRMaj u[] = new DMatrixRMaj[numVectors];
u[0] = RandomMatrices_DDRM.rectangle(dimen,1,-1,1,rand);
NormOps_DDRM.normalizeF(u[0]);
for( int i = 1; i < numVectors; i++ ) {
// System.out.println(" i = "+i);
DMatrixRMaj a = new DMatrixRMaj(dimen,1);
DMatrixRMaj r=null;
for( int j = 0; j < i; j++ ) {
// System.out.println("j = "+j);
if( j == 0 )
r = RandomMatrices_DDRM.rectangle(dimen,1,-1,1,rand);
// find a vector that is normal to vector j
// u[i] = (1/2)*(r + Q[j]*r)
a.set(r);
VectorVectorMult_DDRM.householder(-2.0,u[j],r,a);
CommonOps_DDRM.add(r,a,a);
CommonOps_DDRM.scale(0.5,a);
// UtilEjml.print(a);
DMatrixRMaj t = a;
a = r;
r = t;
// normalize it so it doesn't get too small
double val = NormOps_DDRM.normF(r);
if( val == 0 || Double.isNaN(val) || Double.isInfinite(val))
throw new RuntimeException("Failed sanity check");
CommonOps_DDRM.divide(r,val);
}
u[i] = r;
}
return u;
} | java | public static DMatrixRMaj[] span(int dimen, int numVectors , Random rand ) {
if( dimen < numVectors )
throw new IllegalArgumentException("The number of vectors must be less than or equal to the dimension");
DMatrixRMaj u[] = new DMatrixRMaj[numVectors];
u[0] = RandomMatrices_DDRM.rectangle(dimen,1,-1,1,rand);
NormOps_DDRM.normalizeF(u[0]);
for( int i = 1; i < numVectors; i++ ) {
// System.out.println(" i = "+i);
DMatrixRMaj a = new DMatrixRMaj(dimen,1);
DMatrixRMaj r=null;
for( int j = 0; j < i; j++ ) {
// System.out.println("j = "+j);
if( j == 0 )
r = RandomMatrices_DDRM.rectangle(dimen,1,-1,1,rand);
// find a vector that is normal to vector j
// u[i] = (1/2)*(r + Q[j]*r)
a.set(r);
VectorVectorMult_DDRM.householder(-2.0,u[j],r,a);
CommonOps_DDRM.add(r,a,a);
CommonOps_DDRM.scale(0.5,a);
// UtilEjml.print(a);
DMatrixRMaj t = a;
a = r;
r = t;
// normalize it so it doesn't get too small
double val = NormOps_DDRM.normF(r);
if( val == 0 || Double.isNaN(val) || Double.isInfinite(val))
throw new RuntimeException("Failed sanity check");
CommonOps_DDRM.divide(r,val);
}
u[i] = r;
}
return u;
} | [
"public",
"static",
"DMatrixRMaj",
"[",
"]",
"span",
"(",
"int",
"dimen",
",",
"int",
"numVectors",
",",
"Random",
"rand",
")",
"{",
"if",
"(",
"dimen",
"<",
"numVectors",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"The number of vectors must be les... | is there a faster algorithm out there? This one is a bit sluggish | [
"is",
"there",
"a",
"faster",
"algorithm",
"out",
"there?",
"This",
"one",
"is",
"a",
"bit",
"sluggish"
] | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/RandomMatrices_DDRM.java#L58-L101 |
Impetus/Kundera | src/jpa-engine/core/src/main/java/com/impetus/kundera/persistence/context/EventLogQueue.java | EventLogQueue.onEvent | void onEvent(EventLog log, EventType eventType)
{
switch (eventType)
{
case INSERT:
onInsert(log);
break;
case UPDATE:
onUpdate(log);
break;
case DELETE:
onDelete(log);
break;
default:
throw new KunderaException("Invalid event type:" + eventType);
}
} | java | void onEvent(EventLog log, EventType eventType)
{
switch (eventType)
{
case INSERT:
onInsert(log);
break;
case UPDATE:
onUpdate(log);
break;
case DELETE:
onDelete(log);
break;
default:
throw new KunderaException("Invalid event type:" + eventType);
}
} | [
"void",
"onEvent",
"(",
"EventLog",
"log",
",",
"EventType",
"eventType",
")",
"{",
"switch",
"(",
"eventType",
")",
"{",
"case",
"INSERT",
":",
"onInsert",
"(",
"log",
")",
";",
"break",
";",
"case",
"UPDATE",
":",
"onUpdate",
"(",
"log",
")",
";",
... | On event.
@param log
the log
@param eventType
the event type | [
"On",
"event",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/persistence/context/EventLogQueue.java#L49-L72 |
apache/groovy | src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java | DefaultGroovyMethods.getAt | public static List getAt(Collection coll, String property) {
List<Object> answer = new ArrayList<Object>(coll.size());
return getAtIterable(coll, property, answer);
} | java | public static List getAt(Collection coll, String property) {
List<Object> answer = new ArrayList<Object>(coll.size());
return getAtIterable(coll, property, answer);
} | [
"public",
"static",
"List",
"getAt",
"(",
"Collection",
"coll",
",",
"String",
"property",
")",
"{",
"List",
"<",
"Object",
">",
"answer",
"=",
"new",
"ArrayList",
"<",
"Object",
">",
"(",
"coll",
".",
"size",
"(",
")",
")",
";",
"return",
"getAtIterab... | Support the subscript operator for Collection.
<pre class="groovyTestCase">
assert [String, Long, Integer] == ["a",5L,2]["class"]
</pre>
@param coll a Collection
@param property a String
@return a List
@since 1.0 | [
"Support",
"the",
"subscript",
"operator",
"for",
"Collection",
".",
"<pre",
"class",
"=",
"groovyTestCase",
">",
"assert",
"[",
"String",
"Long",
"Integer",
"]",
"==",
"[",
"a",
"5L",
"2",
"]",
"[",
"class",
"]",
"<",
"/",
"pre",
">"
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L8222-L8225 |
samskivert/samskivert | src/main/java/com/samskivert/util/FileUtil.java | FileUtil.newFile | public static File newFile (File root, String... parts)
{
File path = root;
for (String part : parts) {
path = new File(path, part);
}
return path;
} | java | public static File newFile (File root, String... parts)
{
File path = root;
for (String part : parts) {
path = new File(path, part);
}
return path;
} | [
"public",
"static",
"File",
"newFile",
"(",
"File",
"root",
",",
"String",
"...",
"parts",
")",
"{",
"File",
"path",
"=",
"root",
";",
"for",
"(",
"String",
"part",
":",
"parts",
")",
"{",
"path",
"=",
"new",
"File",
"(",
"path",
",",
"part",
")",
... | Creates a file from the supplied root using the specified child components. For example:
<code>fromPath(new File("dir"), "subdir", "anotherdir", "file.txt")</code> creates a file
with the Unix path <code>dir/subdir/anotherdir/file.txt</code>. | [
"Creates",
"a",
"file",
"from",
"the",
"supplied",
"root",
"using",
"the",
"specified",
"child",
"components",
".",
"For",
"example",
":",
"<code",
">",
"fromPath",
"(",
"new",
"File",
"(",
"dir",
")",
"subdir",
"anotherdir",
"file",
".",
"txt",
")",
"<"... | train | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/FileUtil.java#L31-L38 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/util/ClassHelper.java | ClassHelper.newInstance | public static Object newInstance(String className, Class type, Object arg) throws InstantiationException,
IllegalAccessException,
IllegalArgumentException,
InvocationTargetException,
NoSuchMethodException,
SecurityException,
ClassNotFoundException
{
return newInstance(className, new Class[]{type}, new Object[]{arg});
} | java | public static Object newInstance(String className, Class type, Object arg) throws InstantiationException,
IllegalAccessException,
IllegalArgumentException,
InvocationTargetException,
NoSuchMethodException,
SecurityException,
ClassNotFoundException
{
return newInstance(className, new Class[]{type}, new Object[]{arg});
} | [
"public",
"static",
"Object",
"newInstance",
"(",
"String",
"className",
",",
"Class",
"type",
",",
"Object",
"arg",
")",
"throws",
"InstantiationException",
",",
"IllegalAccessException",
",",
"IllegalArgumentException",
",",
"InvocationTargetException",
",",
"NoSuchMe... | Returns a new instance of the class with the given qualified name using the constructor with
the specified parameter.
@param className The qualified name of the class to instantiate
@param type The types of the single parameter of the constructor
@param arg The argument
@return The instance | [
"Returns",
"a",
"new",
"instance",
"of",
"the",
"class",
"with",
"the",
"given",
"qualified",
"name",
"using",
"the",
"constructor",
"with",
"the",
"specified",
"parameter",
"."
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/util/ClassHelper.java#L339-L348 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/config/Config.java | Config.setCountDownLatchConfigs | public Config setCountDownLatchConfigs(Map<String, CountDownLatchConfig> countDownLatchConfigs) {
this.countDownLatchConfigs.clear();
this.countDownLatchConfigs.putAll(countDownLatchConfigs);
for (Entry<String, CountDownLatchConfig> entry : countDownLatchConfigs.entrySet()) {
entry.getValue().setName(entry.getKey());
}
return this;
} | java | public Config setCountDownLatchConfigs(Map<String, CountDownLatchConfig> countDownLatchConfigs) {
this.countDownLatchConfigs.clear();
this.countDownLatchConfigs.putAll(countDownLatchConfigs);
for (Entry<String, CountDownLatchConfig> entry : countDownLatchConfigs.entrySet()) {
entry.getValue().setName(entry.getKey());
}
return this;
} | [
"public",
"Config",
"setCountDownLatchConfigs",
"(",
"Map",
"<",
"String",
",",
"CountDownLatchConfig",
">",
"countDownLatchConfigs",
")",
"{",
"this",
".",
"countDownLatchConfigs",
".",
"clear",
"(",
")",
";",
"this",
".",
"countDownLatchConfigs",
".",
"putAll",
... | Sets the map of CountDownLatch configurations, mapped by config name.
The config name may be a pattern with which the configuration will be obtained in the future.
@param countDownLatchConfigs the CountDownLatch configuration map to set
@return this config instance | [
"Sets",
"the",
"map",
"of",
"CountDownLatch",
"configurations",
"mapped",
"by",
"config",
"name",
".",
"The",
"config",
"name",
"may",
"be",
"a",
"pattern",
"with",
"which",
"the",
"configuration",
"will",
"be",
"obtained",
"in",
"the",
"future",
"."
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/config/Config.java#L1578-L1585 |
apache/incubator-shardingsphere | sharding-core/sharding-core-api/src/main/java/org/apache/shardingsphere/api/hint/HintManager.java | HintManager.addDatabaseShardingValue | public void addDatabaseShardingValue(final String logicTable, final Comparable<?> value) {
databaseShardingValues.put(logicTable, value);
databaseShardingOnly = false;
} | java | public void addDatabaseShardingValue(final String logicTable, final Comparable<?> value) {
databaseShardingValues.put(logicTable, value);
databaseShardingOnly = false;
} | [
"public",
"void",
"addDatabaseShardingValue",
"(",
"final",
"String",
"logicTable",
",",
"final",
"Comparable",
"<",
"?",
">",
"value",
")",
"{",
"databaseShardingValues",
".",
"put",
"(",
"logicTable",
",",
"value",
")",
";",
"databaseShardingOnly",
"=",
"false... | Add sharding value for database.
<p>The sharding operator is {@code =}</p>
@param logicTable logic table name
@param value sharding value | [
"Add",
"sharding",
"value",
"for",
"database",
"."
] | train | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-api/src/main/java/org/apache/shardingsphere/api/hint/HintManager.java#L82-L85 |
xwiki/xwiki-commons | xwiki-commons-core/xwiki-commons-crypto/xwiki-commons-crypto-store/xwiki-commons-crypto-store-filesystem/src/main/java/org/xwiki/crypto/store/filesystem/internal/AbstractX509FileSystemStore.java | AbstractX509FileSystemStore.processObject | protected Object processObject(BufferedReader in, String line, byte[] password)
throws IOException, GeneralSecurityException
{
if (line.contains(PEM_BEGIN + CERTIFICATE + DASHES)) {
return this.certificateFactory.decode(readBytes(in, PEM_END + CERTIFICATE + DASHES));
}
return null;
} | java | protected Object processObject(BufferedReader in, String line, byte[] password)
throws IOException, GeneralSecurityException
{
if (line.contains(PEM_BEGIN + CERTIFICATE + DASHES)) {
return this.certificateFactory.decode(readBytes(in, PEM_END + CERTIFICATE + DASHES));
}
return null;
} | [
"protected",
"Object",
"processObject",
"(",
"BufferedReader",
"in",
",",
"String",
"line",
",",
"byte",
"[",
"]",
"password",
")",
"throws",
"IOException",
",",
"GeneralSecurityException",
"{",
"if",
"(",
"line",
".",
"contains",
"(",
"PEM_BEGIN",
"+",
"CERTI... | Process an object from a PEM like file.
@param in the input reader to read from.
@param line the last read line.
@param password a password to decrypt encrypted objects. May be null if the object is not encrypted.
@return the object read, or null if the line was not a recognized PEM header.
@throws IOException on I/O error.
@throws GeneralSecurityException on decryption error. | [
"Process",
"an",
"object",
"from",
"a",
"PEM",
"like",
"file",
"."
] | train | https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-crypto/xwiki-commons-crypto-store/xwiki-commons-crypto-store-filesystem/src/main/java/org/xwiki/crypto/store/filesystem/internal/AbstractX509FileSystemStore.java#L232-L239 |
lkwg82/enforcer-rules | src/main/java/org/apache/maven/plugins/enforcer/RequirePluginVersions.java | RequirePluginVersions.parsePluginString | protected Plugin parsePluginString( String pluginString, String field )
throws MojoExecutionException
{
if ( pluginString != null )
{
String[] pluginStrings = pluginString.split( ":" );
if ( pluginStrings.length == 2 )
{
Plugin plugin = new Plugin();
plugin.setGroupId( StringUtils.strip( pluginStrings[0] ) );
plugin.setArtifactId( StringUtils.strip( pluginStrings[1] ) );
return plugin;
}
else
{
throw new MojoExecutionException( "Invalid " + field + " string: " + pluginString );
}
}
else
{
throw new MojoExecutionException( "Invalid " + field + " string: " + pluginString );
}
} | java | protected Plugin parsePluginString( String pluginString, String field )
throws MojoExecutionException
{
if ( pluginString != null )
{
String[] pluginStrings = pluginString.split( ":" );
if ( pluginStrings.length == 2 )
{
Plugin plugin = new Plugin();
plugin.setGroupId( StringUtils.strip( pluginStrings[0] ) );
plugin.setArtifactId( StringUtils.strip( pluginStrings[1] ) );
return plugin;
}
else
{
throw new MojoExecutionException( "Invalid " + field + " string: " + pluginString );
}
}
else
{
throw new MojoExecutionException( "Invalid " + field + " string: " + pluginString );
}
} | [
"protected",
"Plugin",
"parsePluginString",
"(",
"String",
"pluginString",
",",
"String",
"field",
")",
"throws",
"MojoExecutionException",
"{",
"if",
"(",
"pluginString",
"!=",
"null",
")",
"{",
"String",
"[",
"]",
"pluginStrings",
"=",
"pluginString",
".",
"sp... | Helper method to parse and inject a Plugin.
@param pluginString
@param field
@throws MojoExecutionException
@return the plugin | [
"Helper",
"method",
"to",
"parse",
"and",
"inject",
"a",
"Plugin",
"."
] | train | https://github.com/lkwg82/enforcer-rules/blob/fa2d309af7907b17fc8eaf386f8056d77b654749/src/main/java/org/apache/maven/plugins/enforcer/RequirePluginVersions.java#L461-L485 |
aNNiMON/Lightweight-Stream-API | stream/src/main/java/com/annimon/stream/DoubleStream.java | DoubleStream.takeWhile | @NotNull
public DoubleStream takeWhile(@NotNull final DoublePredicate predicate) {
return new DoubleStream(params, new DoubleTakeWhile(iterator, predicate));
} | java | @NotNull
public DoubleStream takeWhile(@NotNull final DoublePredicate predicate) {
return new DoubleStream(params, new DoubleTakeWhile(iterator, predicate));
} | [
"@",
"NotNull",
"public",
"DoubleStream",
"takeWhile",
"(",
"@",
"NotNull",
"final",
"DoublePredicate",
"predicate",
")",
"{",
"return",
"new",
"DoubleStream",
"(",
"params",
",",
"new",
"DoubleTakeWhile",
"(",
"iterator",
",",
"predicate",
")",
")",
";",
"}"
... | Takes elements while the predicate returns {@code true}.
<p>This is an intermediate operation.
<p>Example:
<pre>
predicate: (a) -> a < 3
stream: [1, 2, 3, 4, 1, 2, 3, 4]
result: [1, 2]
</pre>
@param predicate the predicate used to take elements
@return the new {@code DoubleStream} | [
"Takes",
"elements",
"while",
"the",
"predicate",
"returns",
"{",
"@code",
"true",
"}",
"."
] | train | https://github.com/aNNiMON/Lightweight-Stream-API/blob/f29fd57208c20252a4549b084d55ed082c3e58f0/stream/src/main/java/com/annimon/stream/DoubleStream.java#L696-L699 |
kaazing/gateway | transport/http/src/main/java/org/kaazing/gateway/transport/http/bridge/filter/HttpMergeRequestFilter.java | HttpMergeRequestFilter.writeHttpResponse | private WriteFuture writeHttpResponse(NextFilter nextFilter, IoSession session, HttpRequestMessage httpRequest, final HttpStatus httpStatus, final String reason) {
HttpResponseMessage httpResponse = new HttpResponseMessage();
httpResponse.setVersion(httpRequest.getVersion());
httpResponse.setStatus(httpStatus);
if (reason != null) {
httpResponse.setReason(reason);
}
final DefaultWriteFutureEx future = new DefaultWriteFutureEx(session);
nextFilter.filterWrite(session, new DefaultWriteRequestEx(httpResponse, future));
return future;
} | java | private WriteFuture writeHttpResponse(NextFilter nextFilter, IoSession session, HttpRequestMessage httpRequest, final HttpStatus httpStatus, final String reason) {
HttpResponseMessage httpResponse = new HttpResponseMessage();
httpResponse.setVersion(httpRequest.getVersion());
httpResponse.setStatus(httpStatus);
if (reason != null) {
httpResponse.setReason(reason);
}
final DefaultWriteFutureEx future = new DefaultWriteFutureEx(session);
nextFilter.filterWrite(session, new DefaultWriteRequestEx(httpResponse, future));
return future;
} | [
"private",
"WriteFuture",
"writeHttpResponse",
"(",
"NextFilter",
"nextFilter",
",",
"IoSession",
"session",
",",
"HttpRequestMessage",
"httpRequest",
",",
"final",
"HttpStatus",
"httpStatus",
",",
"final",
"String",
"reason",
")",
"{",
"HttpResponseMessage",
"httpRespo... | Write a fresh HttpResponse from this filter down the filter chain, based on the provided request, with the specified http status code.
@param nextFilter the next filter in the chain
@param session the IO session
@param httpRequest the request that the response corresponds to
@param httpStatus the desired status of the http response
@param reason the reason description (optional)
@return a write future for the response written | [
"Write",
"a",
"fresh",
"HttpResponse",
"from",
"this",
"filter",
"down",
"the",
"filter",
"chain",
"based",
"on",
"the",
"provided",
"request",
"with",
"the",
"specified",
"http",
"status",
"code",
"."
] | train | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/transport/http/src/main/java/org/kaazing/gateway/transport/http/bridge/filter/HttpMergeRequestFilter.java#L311-L321 |
GenesysPureEngage/workspace-client-java | src/main/java/com/genesys/internal/workspace/api/NotificationsApi.java | NotificationsApi.notificationsDisconnectWithHttpInfo | public ApiResponse<Void> notificationsDisconnectWithHttpInfo() throws ApiException {
com.squareup.okhttp.Call call = notificationsDisconnectValidateBeforeCall(null, null);
return apiClient.execute(call);
} | java | public ApiResponse<Void> notificationsDisconnectWithHttpInfo() throws ApiException {
com.squareup.okhttp.Call call = notificationsDisconnectValidateBeforeCall(null, null);
return apiClient.execute(call);
} | [
"public",
"ApiResponse",
"<",
"Void",
">",
"notificationsDisconnectWithHttpInfo",
"(",
")",
"throws",
"ApiException",
"{",
"com",
".",
"squareup",
".",
"okhttp",
".",
"Call",
"call",
"=",
"notificationsDisconnectValidateBeforeCall",
"(",
"null",
",",
"null",
")",
... | CometD disconnect
See the [CometD documentation](https://docs.cometd.org/current/reference/#_bayeux_meta_disconnect) for details.
@return ApiResponse<Void>
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body | [
"CometD",
"disconnect",
"See",
"the",
"[",
"CometD",
"documentation",
"]",
"(",
"https",
":",
"//",
"docs",
".",
"cometd",
".",
"org",
"/",
"current",
"/",
"reference",
"/",
"#_bayeux_meta_disconnect",
")",
"for",
"details",
"."
] | train | https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/NotificationsApi.java#L346-L349 |
davetcc/tcMenu | tcMenuGenerator/src/main/java/com/thecoderscorner/menu/editorui/generator/arduino/ArduinoLibraryInstaller.java | ArduinoLibraryInstaller.getVersionOfLibrary | public VersionInfo getVersionOfLibrary(String name, boolean inEmbeddedDir) throws IOException {
Path startPath;
if(inEmbeddedDir) {
startPath = Paths.get(embeddedDirectory, name);
}
else {
Path ardDir = getArduinoDirectory().orElseThrow(IOException::new);
startPath = ardDir.resolve("libraries").resolve(name);
}
Path libProps = startPath.resolve(LIBRARY_PROPERTIES_NAME);
if(!Files.exists(libProps)) {
return new VersionInfo("0.0.0");
}
Properties propsSrc = new Properties();
try(FileReader reader = new FileReader(libProps.toFile())) {
propsSrc.load(reader);
}
return new VersionInfo(propsSrc.getProperty("version", "0.0.0"));
} | java | public VersionInfo getVersionOfLibrary(String name, boolean inEmbeddedDir) throws IOException {
Path startPath;
if(inEmbeddedDir) {
startPath = Paths.get(embeddedDirectory, name);
}
else {
Path ardDir = getArduinoDirectory().orElseThrow(IOException::new);
startPath = ardDir.resolve("libraries").resolve(name);
}
Path libProps = startPath.resolve(LIBRARY_PROPERTIES_NAME);
if(!Files.exists(libProps)) {
return new VersionInfo("0.0.0");
}
Properties propsSrc = new Properties();
try(FileReader reader = new FileReader(libProps.toFile())) {
propsSrc.load(reader);
}
return new VersionInfo(propsSrc.getProperty("version", "0.0.0"));
} | [
"public",
"VersionInfo",
"getVersionOfLibrary",
"(",
"String",
"name",
",",
"boolean",
"inEmbeddedDir",
")",
"throws",
"IOException",
"{",
"Path",
"startPath",
";",
"if",
"(",
"inEmbeddedDir",
")",
"{",
"startPath",
"=",
"Paths",
".",
"get",
"(",
"embeddedDirect... | Get the version of a library, either from the packaged version or currently installed depending
how it's called.
@param name the library name
@param inEmbeddedDir true for the packaged version, false for the installed version
@return the version of the library or 0.0.0 if it cannot be found.
@throws IOException in the event of an unexpected IO issue. Not finding the library is not an IO issue. | [
"Get",
"the",
"version",
"of",
"a",
"library",
"either",
"from",
"the",
"packaged",
"version",
"or",
"currently",
"installed",
"depending",
"how",
"it",
"s",
"called",
"."
] | train | https://github.com/davetcc/tcMenu/blob/61546e4b982b25ceaff384073fe9ec1fff55e64a/tcMenuGenerator/src/main/java/com/thecoderscorner/menu/editorui/generator/arduino/ArduinoLibraryInstaller.java#L187-L208 |
igniterealtime/Smack | smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/agent/AgentSession.java | AgentSession.dequeueUser | public void dequeueUser(EntityJid userID) throws XMPPException, NotConnectedException, InterruptedException {
// todo: this method simply won't work right now.
DepartQueuePacket departPacket = new DepartQueuePacket(workgroupJID, userID);
// PENDING
this.connection.sendStanza(departPacket);
} | java | public void dequeueUser(EntityJid userID) throws XMPPException, NotConnectedException, InterruptedException {
// todo: this method simply won't work right now.
DepartQueuePacket departPacket = new DepartQueuePacket(workgroupJID, userID);
// PENDING
this.connection.sendStanza(departPacket);
} | [
"public",
"void",
"dequeueUser",
"(",
"EntityJid",
"userID",
")",
"throws",
"XMPPException",
",",
"NotConnectedException",
",",
"InterruptedException",
"{",
"// todo: this method simply won't work right now.",
"DepartQueuePacket",
"departPacket",
"=",
"new",
"DepartQueuePacket"... | Removes a user from the workgroup queue. This is an administrative action that the
The agent is not guaranteed of having privileges to perform this action; an exception
denying the request may be thrown.
@param userID the ID of the user to remove.
@throws XMPPException if an exception occurs.
@throws NotConnectedException
@throws InterruptedException | [
"Removes",
"a",
"user",
"from",
"the",
"workgroup",
"queue",
".",
"This",
"is",
"an",
"administrative",
"action",
"that",
"the"
] | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/agent/AgentSession.java#L507-L513 |
xhsun/gw2wrapper | src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java | AsynchronousRequest.getGliderInfo | public void getGliderInfo(int[] ids, Callback<List<Glider>> callback) throws GuildWars2Exception, NullPointerException {
isParamValid(new ParamChecker(ids));
gw2API.getGliderInfo(processIds(ids), GuildWars2.lang.getValue()).enqueue(callback);
} | java | public void getGliderInfo(int[] ids, Callback<List<Glider>> callback) throws GuildWars2Exception, NullPointerException {
isParamValid(new ParamChecker(ids));
gw2API.getGliderInfo(processIds(ids), GuildWars2.lang.getValue()).enqueue(callback);
} | [
"public",
"void",
"getGliderInfo",
"(",
"int",
"[",
"]",
"ids",
",",
"Callback",
"<",
"List",
"<",
"Glider",
">",
">",
"callback",
")",
"throws",
"GuildWars2Exception",
",",
"NullPointerException",
"{",
"isParamValid",
"(",
"new",
"ParamChecker",
"(",
"ids",
... | For more info on gliders API go <a href="https://wiki.guildwars2.com/wiki/API:2/gliders">here</a><br/>
Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions
@param ids list of glider id
@param callback callback that is going to be used for {@link Call#enqueue(Callback)}
@throws GuildWars2Exception empty ID list
@throws NullPointerException if given {@link Callback} is empty
@see Glider glider info | [
"For",
"more",
"info",
"on",
"gliders",
"API",
"go",
"<a",
"href",
"=",
"https",
":",
"//",
"wiki",
".",
"guildwars2",
".",
"com",
"/",
"wiki",
"/",
"API",
":",
"2",
"/",
"gliders",
">",
"here<",
"/",
"a",
">",
"<br",
"/",
">",
"Give",
"user",
... | train | https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java#L1419-L1422 |
alkacon/opencms-core | src-gwt/org/opencms/ade/containerpage/client/CmsContainerpageController.java | CmsContainerpageController.getContainerElementWidgetForElement | public Optional<CmsContainerPageElementPanel> getContainerElementWidgetForElement(Element element) {
final Element parentContainerElement = CmsDomUtil.getAncestor(
element,
I_CmsLayoutBundle.INSTANCE.dragdropCss().dragElement());
if (parentContainerElement == null) {
return Optional.absent();
}
final List<CmsContainerPageElementPanel> result = Lists.newArrayList();
processPageContent(new I_PageContentVisitor() {
public boolean beginContainer(String name, CmsContainer container) {
// we don't need to look into the container if we have already found our container element
return result.isEmpty();
}
public void endContainer() {
// do nothing
}
public void handleElement(CmsContainerPageElementPanel current) {
if ((current.getElement() == parentContainerElement) && result.isEmpty()) {
result.add(current);
}
}
});
if (result.isEmpty()) {
return Optional.absent();
} else {
return Optional.fromNullable(result.get(0));
}
} | java | public Optional<CmsContainerPageElementPanel> getContainerElementWidgetForElement(Element element) {
final Element parentContainerElement = CmsDomUtil.getAncestor(
element,
I_CmsLayoutBundle.INSTANCE.dragdropCss().dragElement());
if (parentContainerElement == null) {
return Optional.absent();
}
final List<CmsContainerPageElementPanel> result = Lists.newArrayList();
processPageContent(new I_PageContentVisitor() {
public boolean beginContainer(String name, CmsContainer container) {
// we don't need to look into the container if we have already found our container element
return result.isEmpty();
}
public void endContainer() {
// do nothing
}
public void handleElement(CmsContainerPageElementPanel current) {
if ((current.getElement() == parentContainerElement) && result.isEmpty()) {
result.add(current);
}
}
});
if (result.isEmpty()) {
return Optional.absent();
} else {
return Optional.fromNullable(result.get(0));
}
} | [
"public",
"Optional",
"<",
"CmsContainerPageElementPanel",
">",
"getContainerElementWidgetForElement",
"(",
"Element",
"element",
")",
"{",
"final",
"Element",
"parentContainerElement",
"=",
"CmsDomUtil",
".",
"getAncestor",
"(",
"element",
",",
"I_CmsLayoutBundle",
".",
... | Gets the container element widget to which the given element belongs, or Optional.absent if none could be found.<p>
@param element the element for which the container element widget should be found
@return the container element widget, or Optional.absent if none can be found | [
"Gets",
"the",
"container",
"element",
"widget",
"to",
"which",
"the",
"given",
"element",
"belongs",
"or",
"Optional",
".",
"absent",
"if",
"none",
"could",
"be",
"found",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/containerpage/client/CmsContainerpageController.java#L1284-L1318 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/ValueEnforcer.java | ValueEnforcer.notNullNoNullValue | public static <T> T [] notNullNoNullValue (final T [] aValue, final String sName)
{
if (isEnabled ())
return notNullNoNullValue (aValue, () -> sName);
return aValue;
} | java | public static <T> T [] notNullNoNullValue (final T [] aValue, final String sName)
{
if (isEnabled ())
return notNullNoNullValue (aValue, () -> sName);
return aValue;
} | [
"public",
"static",
"<",
"T",
">",
"T",
"[",
"]",
"notNullNoNullValue",
"(",
"final",
"T",
"[",
"]",
"aValue",
",",
"final",
"String",
"sName",
")",
"{",
"if",
"(",
"isEnabled",
"(",
")",
")",
"return",
"notNullNoNullValue",
"(",
"aValue",
",",
"(",
... | Check that the passed Array is not <code>null</code> and that no
<code>null</code> value is contained.
@param <T>
Type to be checked and returned
@param aValue
The Array to check.
@param sName
The name of the value (e.g. the parameter name)
@return The passed value.
@throws IllegalArgumentException
if the passed value is null or a <code>null</code> value is
contained | [
"Check",
"that",
"the",
"passed",
"Array",
"is",
"not",
"<code",
">",
"null<",
"/",
"code",
">",
"and",
"that",
"no",
"<code",
">",
"null<",
"/",
"code",
">",
"value",
"is",
"contained",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/ValueEnforcer.java#L1044-L1049 |
krotscheck/data-file-reader | data-file-reader-csv/src/main/java/net/krotscheck/dfr/csv/CSVDataEncoder.java | CSVDataEncoder.buildCsvSchema | public CsvSchema buildCsvSchema(final Map<String, Object> row) {
CsvSchema.Builder builder = CsvSchema.builder();
Set<String> fields = row.keySet();
for (String field : fields) {
builder.addColumn(field);
}
return builder.build();
} | java | public CsvSchema buildCsvSchema(final Map<String, Object> row) {
CsvSchema.Builder builder = CsvSchema.builder();
Set<String> fields = row.keySet();
for (String field : fields) {
builder.addColumn(field);
}
return builder.build();
} | [
"public",
"CsvSchema",
"buildCsvSchema",
"(",
"final",
"Map",
"<",
"String",
",",
"Object",
">",
"row",
")",
"{",
"CsvSchema",
".",
"Builder",
"builder",
"=",
"CsvSchema",
".",
"builder",
"(",
")",
";",
"Set",
"<",
"String",
">",
"fields",
"=",
"row",
... | Extrapolate the CSV columns from the row keys.
@param row A row.
@return A constructed CSV schema. | [
"Extrapolate",
"the",
"CSV",
"columns",
"from",
"the",
"row",
"keys",
"."
] | train | https://github.com/krotscheck/data-file-reader/blob/b9a85bd07dc9f9b8291ffbfb6945443d96371811/data-file-reader-csv/src/main/java/net/krotscheck/dfr/csv/CSVDataEncoder.java#L77-L86 |
opoo/opoopress | core/src/main/java/org/opoo/press/util/ClassUtils.java | ClassUtils.newInstance | public static <T> T newInstance(String className, Site site) {
return newInstance(className, null, site, site != null ? site.getConfig() : null);
} | java | public static <T> T newInstance(String className, Site site) {
return newInstance(className, null, site, site != null ? site.getConfig() : null);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"newInstance",
"(",
"String",
"className",
",",
"Site",
"site",
")",
"{",
"return",
"newInstance",
"(",
"className",
",",
"null",
",",
"site",
",",
"site",
"!=",
"null",
"?",
"site",
".",
"getConfig",
"(",
")",
... | Create a new instance for the specified class name.
@param className class name
@param site site object
@return new instance | [
"Create",
"a",
"new",
"instance",
"for",
"the",
"specified",
"class",
"name",
"."
] | train | https://github.com/opoo/opoopress/blob/4ed0265d294c8b748be48cf097949aa905ff1df2/core/src/main/java/org/opoo/press/util/ClassUtils.java#L44-L46 |
facebookarchive/hadoop-20 | src/tools/org/apache/hadoop/tools/rumen/ZombieJob.java | ZombieJob.maskTaskID | private TaskID maskTaskID(TaskID taskId) {
JobID jobId = new JobID();
return new TaskID(jobId, taskId.isMap(), taskId.getId());
} | java | private TaskID maskTaskID(TaskID taskId) {
JobID jobId = new JobID();
return new TaskID(jobId, taskId.isMap(), taskId.getId());
} | [
"private",
"TaskID",
"maskTaskID",
"(",
"TaskID",
"taskId",
")",
"{",
"JobID",
"jobId",
"=",
"new",
"JobID",
"(",
")",
";",
"return",
"new",
"TaskID",
"(",
"jobId",
",",
"taskId",
".",
"isMap",
"(",
")",
",",
"taskId",
".",
"getId",
"(",
")",
")",
... | Mask the job ID part in a {@link TaskID}.
@param taskId
raw {@link TaskID} read from trace
@return masked {@link TaskID} with empty {@link JobID}. | [
"Mask",
"the",
"job",
"ID",
"part",
"in",
"a",
"{",
"@link",
"TaskID",
"}",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/tools/org/apache/hadoop/tools/rumen/ZombieJob.java#L279-L282 |
OpenLiberty/open-liberty | dev/com.ibm.ws.collector/src/com/ibm/ws/collector/Collector.java | Collector.validateTags | private static void validateTags(String[] tagList, ArrayList<String> validList, ArrayList<String> invalidList) {
for (String tag : tagList) {
tag = tag.trim();
if (tag.contains("\\") || tag.contains(" ") || tag.contains("\n") || tag.contains("-") || tag.equals("")) {
invalidList.add(tag);
} else {
validList.add(tag);
}
}
} | java | private static void validateTags(String[] tagList, ArrayList<String> validList, ArrayList<String> invalidList) {
for (String tag : tagList) {
tag = tag.trim();
if (tag.contains("\\") || tag.contains(" ") || tag.contains("\n") || tag.contains("-") || tag.equals("")) {
invalidList.add(tag);
} else {
validList.add(tag);
}
}
} | [
"private",
"static",
"void",
"validateTags",
"(",
"String",
"[",
"]",
"tagList",
",",
"ArrayList",
"<",
"String",
">",
"validList",
",",
"ArrayList",
"<",
"String",
">",
"invalidList",
")",
"{",
"for",
"(",
"String",
"tag",
":",
"tagList",
")",
"{",
"tag... | Filter out tags with escaping characters and invalid characters, restrict to only alphabetical and numeric characters
@param tagList
@return | [
"Filter",
"out",
"tags",
"with",
"escaping",
"characters",
"and",
"invalid",
"characters",
"restrict",
"to",
"only",
"alphabetical",
"and",
"numeric",
"characters"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.collector/src/com/ibm/ws/collector/Collector.java#L279-L288 |
cogroo/cogroo4 | cogroo-gc/src/main/java/org/cogroo/tools/checker/rules/util/EqualsUtils.java | EqualsUtils.areStringEquals | public static boolean areStringEquals(String string1, String string2) {
/* string1 string2 outcome
* null null true
* null x false
* x null false
* x y false
* x x true
*/
// XXX both null must be unequal? If yes, boolean must be too?
if (string1 == null && string2 == null) {
return false;
} else if (string1 != null && !string1.equals(string2)) {
return false;
} else if (string2 != null && !string2.equals(string1)) {
return false;
}
return true;
} | java | public static boolean areStringEquals(String string1, String string2) {
/* string1 string2 outcome
* null null true
* null x false
* x null false
* x y false
* x x true
*/
// XXX both null must be unequal? If yes, boolean must be too?
if (string1 == null && string2 == null) {
return false;
} else if (string1 != null && !string1.equals(string2)) {
return false;
} else if (string2 != null && !string2.equals(string1)) {
return false;
}
return true;
} | [
"public",
"static",
"boolean",
"areStringEquals",
"(",
"String",
"string1",
",",
"String",
"string2",
")",
"{",
"/* string1\tstring2\toutcome\r\n\t\t * null\t\tnull\ttrue\r\n\t\t * null\t\tx\t\tfalse\r\n\t\t * x\t\tnull\tfalse\r\n\t\t * x\t\ty\t\tfalse\r\n\t\t * x\t\tx\t\ttrue\r\n\t\t */",
... | Checks if two strings are equals.
The strings can be both null, one of them null or none of them null.
@param string1 from tree element
@param string2 from rule element
@return true if and only if the two strings are equal (both equal or both null) | [
"Checks",
"if",
"two",
"strings",
"are",
"equals",
".",
"The",
"strings",
"can",
"be",
"both",
"null",
"one",
"of",
"them",
"null",
"or",
"none",
"of",
"them",
"null",
"."
] | train | https://github.com/cogroo/cogroo4/blob/b6228900c20c6b37eac10a03708a9669dd562f52/cogroo-gc/src/main/java/org/cogroo/tools/checker/rules/util/EqualsUtils.java#L152-L169 |
joniles/mpxj | src/main/java/net/sf/mpxj/mpp/MPP14Reader.java | MPP14Reader.processViewPropertyData | private void processViewPropertyData() throws IOException
{
Props14 props = new Props14(m_inputStreamFactory.getInstance(m_viewDir, "Props"));
byte[] data = props.getByteArray(Props.FONT_BASES);
if (data != null)
{
processBaseFonts(data);
}
ProjectProperties properties = m_file.getProjectProperties();
properties.setShowProjectSummaryTask(props.getBoolean(Props.SHOW_PROJECT_SUMMARY_TASK));
} | java | private void processViewPropertyData() throws IOException
{
Props14 props = new Props14(m_inputStreamFactory.getInstance(m_viewDir, "Props"));
byte[] data = props.getByteArray(Props.FONT_BASES);
if (data != null)
{
processBaseFonts(data);
}
ProjectProperties properties = m_file.getProjectProperties();
properties.setShowProjectSummaryTask(props.getBoolean(Props.SHOW_PROJECT_SUMMARY_TASK));
} | [
"private",
"void",
"processViewPropertyData",
"(",
")",
"throws",
"IOException",
"{",
"Props14",
"props",
"=",
"new",
"Props14",
"(",
"m_inputStreamFactory",
".",
"getInstance",
"(",
"m_viewDir",
",",
"\"Props\"",
")",
")",
";",
"byte",
"[",
"]",
"data",
"=",
... | This method process the data held in the props file specific to the
visual appearance of the project data. | [
"This",
"method",
"process",
"the",
"data",
"held",
"in",
"the",
"props",
"file",
"specific",
"to",
"the",
"visual",
"appearance",
"of",
"the",
"project",
"data",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPP14Reader.java#L755-L766 |
cdk/cdk | tool/formula/src/main/java/org/openscience/cdk/tools/manipulator/MolecularFormulaRangeManipulator.java | MolecularFormulaRangeManipulator.getMinimalFormula | public static IMolecularFormula getMinimalFormula(MolecularFormulaRange mfRange, IChemObjectBuilder builder) {
IMolecularFormula formula = builder.newInstance(IMolecularFormula.class);
for (IIsotope isotope : mfRange.isotopes()) {
formula.addIsotope(isotope, mfRange.getIsotopeCountMin(isotope));
}
return formula;
} | java | public static IMolecularFormula getMinimalFormula(MolecularFormulaRange mfRange, IChemObjectBuilder builder) {
IMolecularFormula formula = builder.newInstance(IMolecularFormula.class);
for (IIsotope isotope : mfRange.isotopes()) {
formula.addIsotope(isotope, mfRange.getIsotopeCountMin(isotope));
}
return formula;
} | [
"public",
"static",
"IMolecularFormula",
"getMinimalFormula",
"(",
"MolecularFormulaRange",
"mfRange",
",",
"IChemObjectBuilder",
"builder",
")",
"{",
"IMolecularFormula",
"formula",
"=",
"builder",
".",
"newInstance",
"(",
"IMolecularFormula",
".",
"class",
")",
";",
... | Returns the minimal occurrence of the IIsotope into IMolecularFormula
from this MolelecularFormulaRange.
@param mfRange The MolecularFormulaRange to analyze
@return A IMolecularFormula containing the minimal occurrence of each isotope | [
"Returns",
"the",
"minimal",
"occurrence",
"of",
"the",
"IIsotope",
"into",
"IMolecularFormula",
"from",
"this",
"MolelecularFormulaRange",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/formula/src/main/java/org/openscience/cdk/tools/manipulator/MolecularFormulaRangeManipulator.java#L108-L116 |
dita-ot/dita-ot | src/main/java/org/dita/dost/module/DebugAndFilterModule.java | DebugAndFilterModule.getRelativePathFromOut | private static String getRelativePathFromOut(final File overflowingFile, final Job job) {
final URI relativePath = URLUtils.getRelativePath(job.getInputFile(), overflowingFile.toURI());
final File outputDir = job.getOutputDir().getAbsoluteFile();
final File outputPathName = new File(outputDir, "index.html");
final File finalOutFilePathName = resolve(outputDir, relativePath.getPath());
final File finalRelativePathName = FileUtils.getRelativePath(finalOutFilePathName, outputPathName);
File parentDir = finalRelativePathName.getParentFile();
if (parentDir == null || parentDir.getPath().isEmpty()) {
parentDir = new File(".");
}
return parentDir.getPath() + File.separator;
} | java | private static String getRelativePathFromOut(final File overflowingFile, final Job job) {
final URI relativePath = URLUtils.getRelativePath(job.getInputFile(), overflowingFile.toURI());
final File outputDir = job.getOutputDir().getAbsoluteFile();
final File outputPathName = new File(outputDir, "index.html");
final File finalOutFilePathName = resolve(outputDir, relativePath.getPath());
final File finalRelativePathName = FileUtils.getRelativePath(finalOutFilePathName, outputPathName);
File parentDir = finalRelativePathName.getParentFile();
if (parentDir == null || parentDir.getPath().isEmpty()) {
parentDir = new File(".");
}
return parentDir.getPath() + File.separator;
} | [
"private",
"static",
"String",
"getRelativePathFromOut",
"(",
"final",
"File",
"overflowingFile",
",",
"final",
"Job",
"job",
")",
"{",
"final",
"URI",
"relativePath",
"=",
"URLUtils",
".",
"getRelativePath",
"(",
"job",
".",
"getInputFile",
"(",
")",
",",
"ov... | Just for the overflowing files.
@param overflowingFile overflowingFile
@return relative system path to out which ends in {@link java.io.File#separator File.separator} | [
"Just",
"for",
"the",
"overflowing",
"files",
"."
] | train | https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/module/DebugAndFilterModule.java#L527-L538 |
RestComm/sip-servlets | containers/tomcat-7/src/main/java/org/mobicents/servlet/sip/startup/SipStandardContext.java | SipStandardContext.addInjectionTarget | private void addInjectionTarget(Injectable resource, Map<String, Map<String, String>> injectionMap) {
List<InjectionTarget> injectionTargets = resource.getInjectionTargets();
if (injectionTargets != null && injectionTargets.size() > 0) {
String jndiName = resource.getName();
for (InjectionTarget injectionTarget: injectionTargets) {
String clazz = injectionTarget.getTargetClass();
Map<String, String> injections = injectionMap.get(clazz);
if (injections == null) {
injections = new HashMap<String, String>();
injectionMap.put(clazz, injections);
}
injections.put(injectionTarget.getTargetName(), jndiName);
}
}
} | java | private void addInjectionTarget(Injectable resource, Map<String, Map<String, String>> injectionMap) {
List<InjectionTarget> injectionTargets = resource.getInjectionTargets();
if (injectionTargets != null && injectionTargets.size() > 0) {
String jndiName = resource.getName();
for (InjectionTarget injectionTarget: injectionTargets) {
String clazz = injectionTarget.getTargetClass();
Map<String, String> injections = injectionMap.get(clazz);
if (injections == null) {
injections = new HashMap<String, String>();
injectionMap.put(clazz, injections);
}
injections.put(injectionTarget.getTargetName(), jndiName);
}
}
} | [
"private",
"void",
"addInjectionTarget",
"(",
"Injectable",
"resource",
",",
"Map",
"<",
"String",
",",
"Map",
"<",
"String",
",",
"String",
">",
">",
"injectionMap",
")",
"{",
"List",
"<",
"InjectionTarget",
">",
"injectionTargets",
"=",
"resource",
".",
"g... | Copied from Tomcat 7 StandardContext
@param resource
@param injectionMap | [
"Copied",
"from",
"Tomcat",
"7",
"StandardContext"
] | train | https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/containers/tomcat-7/src/main/java/org/mobicents/servlet/sip/startup/SipStandardContext.java#L1501-L1515 |
aws/aws-sdk-java | aws-java-sdk-api-gateway/src/main/java/com/amazonaws/services/apigateway/model/MethodResponse.java | MethodResponse.withResponseModels | public MethodResponse withResponseModels(java.util.Map<String, String> responseModels) {
setResponseModels(responseModels);
return this;
} | java | public MethodResponse withResponseModels(java.util.Map<String, String> responseModels) {
setResponseModels(responseModels);
return this;
} | [
"public",
"MethodResponse",
"withResponseModels",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"responseModels",
")",
"{",
"setResponseModels",
"(",
"responseModels",
")",
";",
"return",
"this",
";",
"}"
] | <p>
Specifies the <a>Model</a> resources used for the response's content-type. Response models are represented as a
key/value map, with a content-type as the key and a <a>Model</a> name as the value.
</p>
@param responseModels
Specifies the <a>Model</a> resources used for the response's content-type. Response models are represented
as a key/value map, with a content-type as the key and a <a>Model</a> name as the value.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"Specifies",
"the",
"<a",
">",
"Model<",
"/",
"a",
">",
"resources",
"used",
"for",
"the",
"response",
"s",
"content",
"-",
"type",
".",
"Response",
"models",
"are",
"represented",
"as",
"a",
"key",
"/",
"value",
"map",
"with",
"a",
"content... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-api-gateway/src/main/java/com/amazonaws/services/apigateway/model/MethodResponse.java#L280-L283 |
looly/hutool | hutool-db/src/main/java/cn/hutool/db/SqlConnRunner.java | SqlConnRunner.del | public int del(Connection conn, Entity where) throws SQLException {
checkConn(conn);
if(CollectionUtil.isEmpty(where)){
//不允许做全表删除
throw new SQLException("Empty entity provided!");
}
final Query query = new Query(SqlUtil.buildConditions(where), where.getTableName());
PreparedStatement ps = null;
try {
ps = dialect.psForDelete(conn, query);
return ps.executeUpdate();
} catch (SQLException e) {
throw e;
} finally {
DbUtil.close(ps);
}
} | java | public int del(Connection conn, Entity where) throws SQLException {
checkConn(conn);
if(CollectionUtil.isEmpty(where)){
//不允许做全表删除
throw new SQLException("Empty entity provided!");
}
final Query query = new Query(SqlUtil.buildConditions(where), where.getTableName());
PreparedStatement ps = null;
try {
ps = dialect.psForDelete(conn, query);
return ps.executeUpdate();
} catch (SQLException e) {
throw e;
} finally {
DbUtil.close(ps);
}
} | [
"public",
"int",
"del",
"(",
"Connection",
"conn",
",",
"Entity",
"where",
")",
"throws",
"SQLException",
"{",
"checkConn",
"(",
"conn",
")",
";",
"if",
"(",
"CollectionUtil",
".",
"isEmpty",
"(",
"where",
")",
")",
"{",
"//不允许做全表删除\r",
"throw",
"new",
"... | 删除数据<br>
此方法不会关闭Connection
@param conn 数据库连接
@param where 条件
@return 影响行数
@throws SQLException SQL执行异常 | [
"删除数据<br",
">",
"此方法不会关闭Connection"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/SqlConnRunner.java#L235-L252 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/JFAPCommunicator.java | JFAPCommunicator.defaultChecker | public void defaultChecker(CommsByteBuffer buffer, short exceptionCode)
throws SIErrorException
{
if (exceptionCode != CommsConstants.SI_NO_EXCEPTION)
{
throw new SIErrorException(buffer.getException(con));
}
} | java | public void defaultChecker(CommsByteBuffer buffer, short exceptionCode)
throws SIErrorException
{
if (exceptionCode != CommsConstants.SI_NO_EXCEPTION)
{
throw new SIErrorException(buffer.getException(con));
}
} | [
"public",
"void",
"defaultChecker",
"(",
"CommsByteBuffer",
"buffer",
",",
"short",
"exceptionCode",
")",
"throws",
"SIErrorException",
"{",
"if",
"(",
"exceptionCode",
"!=",
"CommsConstants",
".",
"SI_NO_EXCEPTION",
")",
"{",
"throw",
"new",
"SIErrorException",
"("... | The default checker. Should always be called last after all the checkers.
@param buffer
@param exceptionCode
@throws SIErrorException if the exception code is <strong>not</strong>
the enumerated value for "throw no exception". | [
"The",
"default",
"checker",
".",
"Should",
"always",
"be",
"called",
"last",
"after",
"all",
"the",
"checkers",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/JFAPCommunicator.java#L1415-L1422 |
XDean/Java-EX | src/main/java/xdean/jex/util/reflect/GenericUtil.java | GenericUtil.getGenericTypes | public static Type[] getGenericTypes(Type sourceType, Class<?> targetClass) {
TypeVariable<?>[] targetTypeParameters = targetClass.getTypeParameters();
if (targetTypeParameters.length == 0) {
return EMPTY_TYPE_ARRAY;
}
Map<TypeVariable<?>, Type> map = getGenericReferenceMap(sourceType);
// If the sourceType is Class, there may left TypeVariable.
List<TypeVariable<?>> leftTypeParameters = sourceType instanceof Class
? Arrays.asList(((Class<?>) sourceType).getTypeParameters())
: Collections.emptyList();
return Arrays.stream(targetTypeParameters)
.map(tv -> {
Type actualType = getActualType(map, tv);
// If actualType equals tv, that means it doesn't implement the targetClass
return Objects.equals(actualType, tv) && !leftTypeParameters.contains(actualType) ? null : actualType;
})
.toArray(Type[]::new);
} | java | public static Type[] getGenericTypes(Type sourceType, Class<?> targetClass) {
TypeVariable<?>[] targetTypeParameters = targetClass.getTypeParameters();
if (targetTypeParameters.length == 0) {
return EMPTY_TYPE_ARRAY;
}
Map<TypeVariable<?>, Type> map = getGenericReferenceMap(sourceType);
// If the sourceType is Class, there may left TypeVariable.
List<TypeVariable<?>> leftTypeParameters = sourceType instanceof Class
? Arrays.asList(((Class<?>) sourceType).getTypeParameters())
: Collections.emptyList();
return Arrays.stream(targetTypeParameters)
.map(tv -> {
Type actualType = getActualType(map, tv);
// If actualType equals tv, that means it doesn't implement the targetClass
return Objects.equals(actualType, tv) && !leftTypeParameters.contains(actualType) ? null : actualType;
})
.toArray(Type[]::new);
} | [
"public",
"static",
"Type",
"[",
"]",
"getGenericTypes",
"(",
"Type",
"sourceType",
",",
"Class",
"<",
"?",
">",
"targetClass",
")",
"{",
"TypeVariable",
"<",
"?",
">",
"[",
"]",
"targetTypeParameters",
"=",
"targetClass",
".",
"getTypeParameters",
"(",
")",... | Get the actual generic types.<br>
For example:
<pre>
<code>
class IntList extends ArrayList<Integer>{}
getGenericType(IntList.class, List.class);// {Integer.class}
getGenericType(IntList.class, Collection.class);// {Integer.class}
getGenericType(Integer.class, Comparable.class);// {Integer.class}
</code>
</pre>
And nested situation
<pre>
<code>
class A<E,T>{}
class B<E> extends A<E,Integer>{}
class C extends B<B<Boolean>>{}
class D<T> extends B<B<? extends T>>{}
class E extends D<Number>{}
getGenericType(B.class, A.class);// {E(TypeVariable), Integer.class}
getGenericType(C.class, A.class);// {B<Boolean>(ParameterizedType), Integer.class}
getGenericType(E.class, A.class);// {B<? extends Number>(ParameterizedType), Integer.class}
</code>
</pre>
@param sourceType The type to find generic type. May Class or ParameterizedType
@param targetClass Find the actual generic type on this type.
@return A type array. Its length equals targetClass's generic parameters' length. Its elements can be
{@code Class, TypeVariable, ParameterizedType}. | [
"Get",
"the",
"actual",
"generic",
"types",
".",
"<br",
">",
"For",
"example",
":"
] | train | https://github.com/XDean/Java-EX/blob/9208ba71c5b2af9f9bd979d01fab2ff5e433b3e7/src/main/java/xdean/jex/util/reflect/GenericUtil.java#L106-L123 |
jayantk/jklol | src/com/jayantkrish/jklol/lisp/ParametricBfgBuilder.java | ParametricBfgBuilder.addConstantFactor | public void addConstantFactor(String factorName, Factor factor) {
if (variables.containsAll(factor.getVars())) {
int factorNum = factors.size();
factors.add(factor);
factorNames.add(factorName);
VariableNumMap factorVars = factor.getVars();
for (Integer varNum : factorVars.getVariableNums()) {
variableFactorMap.put(varNum, factorNum);
factorVariableMap.put(factorNum, varNum);
}
} else {
Preconditions.checkState(!isRoot);
crossingFactors.add(factor);
}
} | java | public void addConstantFactor(String factorName, Factor factor) {
if (variables.containsAll(factor.getVars())) {
int factorNum = factors.size();
factors.add(factor);
factorNames.add(factorName);
VariableNumMap factorVars = factor.getVars();
for (Integer varNum : factorVars.getVariableNums()) {
variableFactorMap.put(varNum, factorNum);
factorVariableMap.put(factorNum, varNum);
}
} else {
Preconditions.checkState(!isRoot);
crossingFactors.add(factor);
}
} | [
"public",
"void",
"addConstantFactor",
"(",
"String",
"factorName",
",",
"Factor",
"factor",
")",
"{",
"if",
"(",
"variables",
".",
"containsAll",
"(",
"factor",
".",
"getVars",
"(",
")",
")",
")",
"{",
"int",
"factorNum",
"=",
"factors",
".",
"size",
"(... | Adds an unparameterized factor to the model under construction.
@param factor | [
"Adds",
"an",
"unparameterized",
"factor",
"to",
"the",
"model",
"under",
"construction",
"."
] | train | https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/lisp/ParametricBfgBuilder.java#L77-L92 |
eFaps/eFaps-Kernel | src/main/java/org/efaps/update/schema/program/esjp/ESJPCompiler.java | ESJPCompiler.readESJPClasses | protected void readESJPClasses()
throws InstallationException
{
try {
final QueryBuilder queryBldr = new QueryBuilder(this.classType);
final MultiPrintQuery multi = queryBldr.getPrint();
multi.addAttribute("Name");
multi.executeWithoutAccessCheck();
while (multi.next()) {
final String name = multi.<String>getAttribute("Name");
final Long id = multi.getCurrentInstance().getId();
this.class2id.put(name, id);
}
} catch (final EFapsException e) {
throw new InstallationException("Could not fetch the information about compiled ESJP's", e);
}
} | java | protected void readESJPClasses()
throws InstallationException
{
try {
final QueryBuilder queryBldr = new QueryBuilder(this.classType);
final MultiPrintQuery multi = queryBldr.getPrint();
multi.addAttribute("Name");
multi.executeWithoutAccessCheck();
while (multi.next()) {
final String name = multi.<String>getAttribute("Name");
final Long id = multi.getCurrentInstance().getId();
this.class2id.put(name, id);
}
} catch (final EFapsException e) {
throw new InstallationException("Could not fetch the information about compiled ESJP's", e);
}
} | [
"protected",
"void",
"readESJPClasses",
"(",
")",
"throws",
"InstallationException",
"{",
"try",
"{",
"final",
"QueryBuilder",
"queryBldr",
"=",
"new",
"QueryBuilder",
"(",
"this",
".",
"classType",
")",
";",
"final",
"MultiPrintQuery",
"multi",
"=",
"queryBldr",
... | All stored compiled ESJP's classes in the eFaps database are stored in
the mapping {@link #class2id}. If a ESJP's program is compiled and
stored with {@link ESJPCompiler.StoreObject#write()}, the class is
removed. After the compile, {@link ESJPCompiler#compile(String)} removes
all stored classes which are not needed anymore.
@throws InstallationException if read of the ESJP classes failed
@see #class2id | [
"All",
"stored",
"compiled",
"ESJP",
"s",
"classes",
"in",
"the",
"eFaps",
"database",
"are",
"stored",
"in",
"the",
"mapping",
"{",
"@link",
"#class2id",
"}",
".",
"If",
"a",
"ESJP",
"s",
"program",
"is",
"compiled",
"and",
"stored",
"with",
"{",
"@link... | train | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/update/schema/program/esjp/ESJPCompiler.java#L282-L298 |
podio/podio-java | src/main/java/com/podio/conversation/ConversationAPI.java | ConversationAPI.createConversation | public int createConversation(String subject, String text,
List<Integer> participants) {
return createConversation(subject, text, participants, null);
} | java | public int createConversation(String subject, String text,
List<Integer> participants) {
return createConversation(subject, text, participants, null);
} | [
"public",
"int",
"createConversation",
"(",
"String",
"subject",
",",
"String",
"text",
",",
"List",
"<",
"Integer",
">",
"participants",
")",
"{",
"return",
"createConversation",
"(",
"subject",
",",
"text",
",",
"participants",
",",
"null",
")",
";",
"}"
] | Creates a new conversation with a list of users. Once a conversation is
started, the participants cannot (yet) be changed.
@param subject
The subject of the conversation
@param text
The text of the first message in the conversation
@param participants
List of participants in the conversation (not including the
sender)
@return The id of the newly created conversation | [
"Creates",
"a",
"new",
"conversation",
"with",
"a",
"list",
"of",
"users",
".",
"Once",
"a",
"conversation",
"is",
"started",
"the",
"participants",
"cannot",
"(",
"yet",
")",
"be",
"changed",
"."
] | train | https://github.com/podio/podio-java/blob/a520b23bac118c957ce02cdd8ff42a6c7d17b49a/src/main/java/com/podio/conversation/ConversationAPI.java#L32-L35 |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java | StreamExecutionEnvironment.createRemoteEnvironment | public static StreamExecutionEnvironment createRemoteEnvironment(
String host, int port, Configuration clientConfig, String... jarFiles) {
return new RemoteStreamEnvironment(host, port, clientConfig, jarFiles);
} | java | public static StreamExecutionEnvironment createRemoteEnvironment(
String host, int port, Configuration clientConfig, String... jarFiles) {
return new RemoteStreamEnvironment(host, port, clientConfig, jarFiles);
} | [
"public",
"static",
"StreamExecutionEnvironment",
"createRemoteEnvironment",
"(",
"String",
"host",
",",
"int",
"port",
",",
"Configuration",
"clientConfig",
",",
"String",
"...",
"jarFiles",
")",
"{",
"return",
"new",
"RemoteStreamEnvironment",
"(",
"host",
",",
"p... | Creates a {@link RemoteStreamEnvironment}. The remote environment sends
(parts of) the program to a cluster for execution. Note that all file
paths used in the program must be accessible from the cluster. The
execution will use the specified parallelism.
@param host
The host name or address of the master (JobManager), where the
program should be executed.
@param port
The port of the master (JobManager), where the program should
be executed.
@param clientConfig
The configuration used by the client that connects to the remote cluster.
@param jarFiles
The JAR files with code that needs to be shipped to the
cluster. If the program uses user-defined functions,
user-defined input formats, or any libraries, those must be
provided in the JAR files.
@return A remote environment that executes the program on a cluster. | [
"Creates",
"a",
"{",
"@link",
"RemoteStreamEnvironment",
"}",
".",
"The",
"remote",
"environment",
"sends",
"(",
"parts",
"of",
")",
"the",
"program",
"to",
"a",
"cluster",
"for",
"execution",
".",
"Note",
"that",
"all",
"file",
"paths",
"used",
"in",
"the... | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java#L1736-L1739 |
rey5137/material | material/src/main/java/com/rey/material/app/ThemeManager.java | ThemeManager.getStyleId | public static int getStyleId(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes){
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ThemableView, defStyleAttr, defStyleRes);
int styleId = a.getResourceId(R.styleable.ThemableView_v_styleId, 0);
a.recycle();
return styleId;
} | java | public static int getStyleId(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes){
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ThemableView, defStyleAttr, defStyleRes);
int styleId = a.getResourceId(R.styleable.ThemableView_v_styleId, 0);
a.recycle();
return styleId;
} | [
"public",
"static",
"int",
"getStyleId",
"(",
"Context",
"context",
",",
"AttributeSet",
"attrs",
",",
"int",
"defStyleAttr",
",",
"int",
"defStyleRes",
")",
"{",
"TypedArray",
"a",
"=",
"context",
".",
"obtainStyledAttributes",
"(",
"attrs",
",",
"R",
".",
... | Get the styleId from attributes.
@param context
@param attrs
@param defStyleAttr
@param defStyleRes
@return The styleId. | [
"Get",
"the",
"styleId",
"from",
"attributes",
"."
] | train | https://github.com/rey5137/material/blob/1bbcac2686a0023ef7720d3fe455bb116d115af8/material/src/main/java/com/rey/material/app/ThemeManager.java#L45-L51 |
amzn/ion-java | src/com/amazon/ion/Timestamp.java | Timestamp.addMonthForPrecision | private Timestamp addMonthForPrecision(int amount, Precision precision) {
Calendar cal = calendarValue();
cal.add(Calendar.MONTH, amount);
return new Timestamp(cal, precision, _fraction, _offset);
} | java | private Timestamp addMonthForPrecision(int amount, Precision precision) {
Calendar cal = calendarValue();
cal.add(Calendar.MONTH, amount);
return new Timestamp(cal, precision, _fraction, _offset);
} | [
"private",
"Timestamp",
"addMonthForPrecision",
"(",
"int",
"amount",
",",
"Precision",
"precision",
")",
"{",
"Calendar",
"cal",
"=",
"calendarValue",
"(",
")",
";",
"cal",
".",
"add",
"(",
"Calendar",
".",
"MONTH",
",",
"amount",
")",
";",
"return",
"new... | Adds the given number of months, extending (if necessary) the resulting Timestamp to the given
precision.
@param amount the number of months to add.
@param precision the precision that the Timestamp will be extended to, if it does not already include that
precision.
@return a new Timestamp. | [
"Adds",
"the",
"given",
"number",
"of",
"months",
"extending",
"(",
"if",
"necessary",
")",
"the",
"resulting",
"Timestamp",
"to",
"the",
"given",
"precision",
"."
] | train | https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/Timestamp.java#L2480-L2484 |
aws/aws-sdk-java | aws-java-sdk-opsworks/src/main/java/com/amazonaws/services/opsworks/model/WeeklyAutoScalingSchedule.java | WeeklyAutoScalingSchedule.setThursday | public void setThursday(java.util.Map<String, String> thursday) {
this.thursday = thursday == null ? null : new com.amazonaws.internal.SdkInternalMap<String, String>(thursday);
} | java | public void setThursday(java.util.Map<String, String> thursday) {
this.thursday = thursday == null ? null : new com.amazonaws.internal.SdkInternalMap<String, String>(thursday);
} | [
"public",
"void",
"setThursday",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"thursday",
")",
"{",
"this",
".",
"thursday",
"=",
"thursday",
"==",
"null",
"?",
"null",
":",
"new",
"com",
".",
"amazonaws",
".",
"internal",
... | <p>
The schedule for Thursday.
</p>
@param thursday
The schedule for Thursday. | [
"<p",
">",
"The",
"schedule",
"for",
"Thursday",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-opsworks/src/main/java/com/amazonaws/services/opsworks/model/WeeklyAutoScalingSchedule.java#L315-L317 |
h2oai/h2o-2 | src/main/java/water/TimeLine.java | TimeLine.record_IOclose | public static void record_IOclose( AutoBuffer b, int flavor ) {
H2ONode h2o = b._h2o==null ? H2O.SELF : b._h2o;
// First long word going out has sender-port and a 'bad' control packet
long b0 = UDP.udp.i_o.ordinal(); // Special flag to indicate io-record and not a rpc-record
b0 |= H2O.SELF._key.udp_port()<<8;
b0 |= flavor<<24; // I/O flavor; one of the Value.persist backends
long iotime = b._time_start_ms > 0 ? (b._time_close_ms - b._time_start_ms) : 0;
b0 |= iotime<<32; // msec from start-to-finish, including non-i/o overheads
long b8 = b._size; // byte's transfered in this I/O
long ns = b._time_io_ns; // nano's blocked doing I/O
record2(h2o,ns,true,b.readMode()?1:0,0,b0,b8);
} | java | public static void record_IOclose( AutoBuffer b, int flavor ) {
H2ONode h2o = b._h2o==null ? H2O.SELF : b._h2o;
// First long word going out has sender-port and a 'bad' control packet
long b0 = UDP.udp.i_o.ordinal(); // Special flag to indicate io-record and not a rpc-record
b0 |= H2O.SELF._key.udp_port()<<8;
b0 |= flavor<<24; // I/O flavor; one of the Value.persist backends
long iotime = b._time_start_ms > 0 ? (b._time_close_ms - b._time_start_ms) : 0;
b0 |= iotime<<32; // msec from start-to-finish, including non-i/o overheads
long b8 = b._size; // byte's transfered in this I/O
long ns = b._time_io_ns; // nano's blocked doing I/O
record2(h2o,ns,true,b.readMode()?1:0,0,b0,b8);
} | [
"public",
"static",
"void",
"record_IOclose",
"(",
"AutoBuffer",
"b",
",",
"int",
"flavor",
")",
"{",
"H2ONode",
"h2o",
"=",
"b",
".",
"_h2o",
"==",
"null",
"?",
"H2O",
".",
"SELF",
":",
"b",
".",
"_h2o",
";",
"// First long word going out has sender-port an... | Record a completed I/O event. The nanosecond time slot is actually nano's-blocked-on-io | [
"Record",
"a",
"completed",
"I",
"/",
"O",
"event",
".",
"The",
"nanosecond",
"time",
"slot",
"is",
"actually",
"nano",
"s",
"-",
"blocked",
"-",
"on",
"-",
"io"
] | train | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/TimeLine.java#L103-L114 |
xiancloud/xian | xian-core/src/main/java/info/xiancloud/core/support/cache/api/CacheMapUtil.java | CacheMapUtil.batchRemove | @SuppressWarnings("all")
public static Completable batchRemove(CacheConfigBean cacheConfigBean, Map<String, List<String>> batchRemoves) {
return SingleRxXian
.call(CacheService.CACHE_SERVICE, "cacheMapBatchRemove", new JSONObject() {{
put("cacheConfig", cacheConfigBean);
put("batchRemoves", batchRemoves);
}})
.map(UnitResponse::throwExceptionIfNotSuccess)
.toCompletable();
} | java | @SuppressWarnings("all")
public static Completable batchRemove(CacheConfigBean cacheConfigBean, Map<String, List<String>> batchRemoves) {
return SingleRxXian
.call(CacheService.CACHE_SERVICE, "cacheMapBatchRemove", new JSONObject() {{
put("cacheConfig", cacheConfigBean);
put("batchRemoves", batchRemoves);
}})
.map(UnitResponse::throwExceptionIfNotSuccess)
.toCompletable();
} | [
"@",
"SuppressWarnings",
"(",
"\"all\"",
")",
"public",
"static",
"Completable",
"batchRemove",
"(",
"CacheConfigBean",
"cacheConfigBean",
",",
"Map",
"<",
"String",
",",
"List",
"<",
"String",
">",
">",
"batchRemoves",
")",
"{",
"return",
"SingleRxXian",
".",
... | batch remove the elements in the cached map
@param cacheConfigBean cacheConfigBean
@param batchRemoves Map(key, fields) the sub map you want to remvoe | [
"batch",
"remove",
"the",
"elements",
"in",
"the",
"cached",
"map"
] | train | https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-core/src/main/java/info/xiancloud/core/support/cache/api/CacheMapUtil.java#L253-L262 |
lamydev/Android-Notification | core/src/zemin/notification/NotificationViewCallback.java | NotificationViewCallback.onContentViewChanged | public void onContentViewChanged(NotificationView view, View contentView, int layoutId) {
if (DBG) Log.v(TAG, "onContentViewChanged");
ChildViewManager mgr = view.getChildViewManager();
if (layoutId == R.layout.notification_simple ||
layoutId == R.layout.notification_large_icon ||
layoutId == R.layout.notification_full) {
view.setNotificationTransitionEnabled(false);
mgr.setView(ICON, contentView.findViewById(R.id.switcher_icon));
mgr.setView(TITLE, contentView.findViewById(R.id.switcher_title));
mgr.setView(TEXT, contentView.findViewById(R.id.switcher_text));
mgr.setView(WHEN, contentView.findViewById(R.id.switcher_when));
} else if (layoutId == R.layout.notification_simple_2) {
view.setNotificationTransitionEnabled(true);
mgr.setView(ICON, contentView.findViewById(R.id.icon));
mgr.setView(TITLE, contentView.findViewById(R.id.title));
mgr.setView(TEXT, contentView.findViewById(R.id.text));
mgr.setView(WHEN, contentView.findViewById(R.id.when));
}
} | java | public void onContentViewChanged(NotificationView view, View contentView, int layoutId) {
if (DBG) Log.v(TAG, "onContentViewChanged");
ChildViewManager mgr = view.getChildViewManager();
if (layoutId == R.layout.notification_simple ||
layoutId == R.layout.notification_large_icon ||
layoutId == R.layout.notification_full) {
view.setNotificationTransitionEnabled(false);
mgr.setView(ICON, contentView.findViewById(R.id.switcher_icon));
mgr.setView(TITLE, contentView.findViewById(R.id.switcher_title));
mgr.setView(TEXT, contentView.findViewById(R.id.switcher_text));
mgr.setView(WHEN, contentView.findViewById(R.id.switcher_when));
} else if (layoutId == R.layout.notification_simple_2) {
view.setNotificationTransitionEnabled(true);
mgr.setView(ICON, contentView.findViewById(R.id.icon));
mgr.setView(TITLE, contentView.findViewById(R.id.title));
mgr.setView(TEXT, contentView.findViewById(R.id.text));
mgr.setView(WHEN, contentView.findViewById(R.id.when));
}
} | [
"public",
"void",
"onContentViewChanged",
"(",
"NotificationView",
"view",
",",
"View",
"contentView",
",",
"int",
"layoutId",
")",
"{",
"if",
"(",
"DBG",
")",
"Log",
".",
"v",
"(",
"TAG",
",",
"\"onContentViewChanged\"",
")",
";",
"ChildViewManager",
"mgr",
... | Called when content view is changed. All child-views were cleared due the
change of content view. You need to re-setup the associated child-views.
@param view
@param contentView
@param layoutId | [
"Called",
"when",
"content",
"view",
"is",
"changed",
".",
"All",
"child",
"-",
"views",
"were",
"cleared",
"due",
"the",
"change",
"of",
"content",
"view",
".",
"You",
"need",
"to",
"re",
"-",
"setup",
"the",
"associated",
"child",
"-",
"views",
"."
] | train | https://github.com/lamydev/Android-Notification/blob/6d6571d2862cb6edbacf9a78125418f7d621c3f8/core/src/zemin/notification/NotificationViewCallback.java#L72-L97 |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/state/filesystem/AbstractFsCheckpointStorage.java | AbstractFsCheckpointStorage.initializeLocationForSavepoint | @Override
public CheckpointStorageLocation initializeLocationForSavepoint(
@SuppressWarnings("unused") long checkpointId,
@Nullable String externalLocationPointer) throws IOException {
// determine where to write the savepoint to
final Path savepointBasePath;
if (externalLocationPointer != null) {
savepointBasePath = new Path(externalLocationPointer);
}
else if (defaultSavepointDirectory != null) {
savepointBasePath = defaultSavepointDirectory;
}
else {
throw new IllegalArgumentException("No savepoint location given and no default location configured.");
}
// generate the savepoint directory
final FileSystem fs = savepointBasePath.getFileSystem();
final String prefix = "savepoint-" + jobId.toString().substring(0, 6) + '-';
Exception latestException = null;
for (int attempt = 0; attempt < 10; attempt++) {
final Path path = new Path(savepointBasePath, FileUtils.getRandomFilename(prefix));
try {
if (fs.mkdirs(path)) {
// we make the path qualified, to make it independent of default schemes and authorities
final Path qp = path.makeQualified(fs);
return createSavepointLocation(fs, qp);
}
} catch (Exception e) {
latestException = e;
}
}
throw new IOException("Failed to create savepoint directory at " + savepointBasePath, latestException);
} | java | @Override
public CheckpointStorageLocation initializeLocationForSavepoint(
@SuppressWarnings("unused") long checkpointId,
@Nullable String externalLocationPointer) throws IOException {
// determine where to write the savepoint to
final Path savepointBasePath;
if (externalLocationPointer != null) {
savepointBasePath = new Path(externalLocationPointer);
}
else if (defaultSavepointDirectory != null) {
savepointBasePath = defaultSavepointDirectory;
}
else {
throw new IllegalArgumentException("No savepoint location given and no default location configured.");
}
// generate the savepoint directory
final FileSystem fs = savepointBasePath.getFileSystem();
final String prefix = "savepoint-" + jobId.toString().substring(0, 6) + '-';
Exception latestException = null;
for (int attempt = 0; attempt < 10; attempt++) {
final Path path = new Path(savepointBasePath, FileUtils.getRandomFilename(prefix));
try {
if (fs.mkdirs(path)) {
// we make the path qualified, to make it independent of default schemes and authorities
final Path qp = path.makeQualified(fs);
return createSavepointLocation(fs, qp);
}
} catch (Exception e) {
latestException = e;
}
}
throw new IOException("Failed to create savepoint directory at " + savepointBasePath, latestException);
} | [
"@",
"Override",
"public",
"CheckpointStorageLocation",
"initializeLocationForSavepoint",
"(",
"@",
"SuppressWarnings",
"(",
"\"unused\"",
")",
"long",
"checkpointId",
",",
"@",
"Nullable",
"String",
"externalLocationPointer",
")",
"throws",
"IOException",
"{",
"// determ... | Creates a file system based storage location for a savepoint.
<p>This methods implements the logic that decides which location to use (given optional
parameters for a configured location and a location passed for this specific savepoint)
and how to name and initialize the savepoint directory.
@param externalLocationPointer The target location pointer for the savepoint.
Must be a valid URI. Null, if not supplied.
@param checkpointId The checkpoint ID of the savepoint.
@return The checkpoint storage location for the savepoint.
@throws IOException Thrown if the target directory could not be created. | [
"Creates",
"a",
"file",
"system",
"based",
"storage",
"location",
"for",
"a",
"savepoint",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/state/filesystem/AbstractFsCheckpointStorage.java#L127-L167 |
nohana/Amalgam | amalgam/src/main/java/com/amalgam/content/ContentProviderUtils.java | ContentProviderUtils.notifyChange | public static void notifyChange(Context context, Uri uri, ContentObserver observer) {
ContentResolver resolver = context.getContentResolver();
resolver.notifyChange(uri, observer);
} | java | public static void notifyChange(Context context, Uri uri, ContentObserver observer) {
ContentResolver resolver = context.getContentResolver();
resolver.notifyChange(uri, observer);
} | [
"public",
"static",
"void",
"notifyChange",
"(",
"Context",
"context",
",",
"Uri",
"uri",
",",
"ContentObserver",
"observer",
")",
"{",
"ContentResolver",
"resolver",
"=",
"context",
".",
"getContentResolver",
"(",
")",
";",
"resolver",
".",
"notifyChange",
"(",... | Notify data-set change to the observer.
@param context the context, must not be null.
@param uri the changed uri.
@param observer the observer, can be null. | [
"Notify",
"data",
"-",
"set",
"change",
"to",
"the",
"observer",
"."
] | train | https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/content/ContentProviderUtils.java#L67-L70 |
sebastiangraf/treetank | interfacemodules/xml/src/main/java/org/treetank/service/xml/xpath/parser/XPathParser.java | XPathParser.parseAbbrevForwardStep | private AbsAxis parseAbbrevForwardStep() {
AbsAxis axis;
boolean isAttribute;
if (is(TokenType.AT, true) || mToken.getContent().equals("attribute")
|| mToken.getContent().equals("schema-attribute")) {
// in case of .../attribute(..), or .../schema-attribute() the
// default
// axis
// is the attribute axis
axis = new AttributeAxis(getTransaction());
isAttribute = true;
} else {
// default axis is the child axis
axis = new ChildAxis(getTransaction());
isAttribute = false;
}
final AbsFilter filter = parseNodeTest(isAttribute);
return new FilterAxis(axis, mRTX, filter);
} | java | private AbsAxis parseAbbrevForwardStep() {
AbsAxis axis;
boolean isAttribute;
if (is(TokenType.AT, true) || mToken.getContent().equals("attribute")
|| mToken.getContent().equals("schema-attribute")) {
// in case of .../attribute(..), or .../schema-attribute() the
// default
// axis
// is the attribute axis
axis = new AttributeAxis(getTransaction());
isAttribute = true;
} else {
// default axis is the child axis
axis = new ChildAxis(getTransaction());
isAttribute = false;
}
final AbsFilter filter = parseNodeTest(isAttribute);
return new FilterAxis(axis, mRTX, filter);
} | [
"private",
"AbsAxis",
"parseAbbrevForwardStep",
"(",
")",
"{",
"AbsAxis",
"axis",
";",
"boolean",
"isAttribute",
";",
"if",
"(",
"is",
"(",
"TokenType",
".",
"AT",
",",
"true",
")",
"||",
"mToken",
".",
"getContent",
"(",
")",
".",
"equals",
"(",
"\"attr... | Parses the the rule AbrevForwardStep according to the following
production rule:
<p>
[31] AbbrevForwardStep ::= "@"? NodeTest .
</p>
@return FilterAxis | [
"Parses",
"the",
"the",
"rule",
"AbrevForwardStep",
"according",
"to",
"the",
"following",
"production",
"rule",
":",
"<p",
">",
"[",
"31",
"]",
"AbbrevForwardStep",
"::",
"=",
"@",
"?",
"NodeTest",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/xml/src/main/java/org/treetank/service/xml/xpath/parser/XPathParser.java#L921-L943 |
mnlipp/jgrapes | org.jgrapes.http/src/org/jgrapes/http/SessionManager.java | SessionManager.createSessionId | protected String createSessionId(HttpResponse response) {
StringBuilder sessionIdBuilder = new StringBuilder();
byte[] bytes = new byte[16];
secureRandom.nextBytes(bytes);
for (byte b : bytes) {
sessionIdBuilder.append(Integer.toHexString(b & 0xff));
}
String sessionId = sessionIdBuilder.toString();
HttpCookie sessionCookie = new HttpCookie(idName(), sessionId);
sessionCookie.setPath(path);
sessionCookie.setHttpOnly(true);
response.computeIfAbsent(HttpField.SET_COOKIE, CookieList::new)
.value().add(sessionCookie);
response.computeIfAbsent(
HttpField.CACHE_CONTROL, CacheControlDirectives::new)
.value().add(new Directive("no-cache", "SetCookie, Set-Cookie2"));
return sessionId;
} | java | protected String createSessionId(HttpResponse response) {
StringBuilder sessionIdBuilder = new StringBuilder();
byte[] bytes = new byte[16];
secureRandom.nextBytes(bytes);
for (byte b : bytes) {
sessionIdBuilder.append(Integer.toHexString(b & 0xff));
}
String sessionId = sessionIdBuilder.toString();
HttpCookie sessionCookie = new HttpCookie(idName(), sessionId);
sessionCookie.setPath(path);
sessionCookie.setHttpOnly(true);
response.computeIfAbsent(HttpField.SET_COOKIE, CookieList::new)
.value().add(sessionCookie);
response.computeIfAbsent(
HttpField.CACHE_CONTROL, CacheControlDirectives::new)
.value().add(new Directive("no-cache", "SetCookie, Set-Cookie2"));
return sessionId;
} | [
"protected",
"String",
"createSessionId",
"(",
"HttpResponse",
"response",
")",
"{",
"StringBuilder",
"sessionIdBuilder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"byte",
"[",
"]",
"bytes",
"=",
"new",
"byte",
"[",
"16",
"]",
";",
"secureRandom",
".",
"ne... | Creates a session id and adds the corresponding cookie to the
response.
@param response the response
@return the session id | [
"Creates",
"a",
"session",
"id",
"and",
"adds",
"the",
"corresponding",
"cookie",
"to",
"the",
"response",
"."
] | train | https://github.com/mnlipp/jgrapes/blob/8b5d874935d84c34a52d3e3d3745e869b5203fa0/org.jgrapes.http/src/org/jgrapes/http/SessionManager.java#L343-L360 |
relayrides/pushy | pushy/src/main/java/com/turo/pushy/apns/ApnsClientBuilder.java | ApnsClientBuilder.setClientCredentials | public ApnsClientBuilder setClientCredentials(final InputStream p12InputStream, final String p12Password) throws SSLException, IOException {
final X509Certificate x509Certificate;
final PrivateKey privateKey;
try {
final KeyStore.PrivateKeyEntry privateKeyEntry = P12Util.getFirstPrivateKeyEntryFromP12InputStream(p12InputStream, p12Password);
final Certificate certificate = privateKeyEntry.getCertificate();
if (!(certificate instanceof X509Certificate)) {
throw new KeyStoreException("Found a certificate in the provided PKCS#12 file, but it was not an X.509 certificate.");
}
x509Certificate = (X509Certificate) certificate;
privateKey = privateKeyEntry.getPrivateKey();
} catch (final KeyStoreException e) {
throw new SSLException(e);
}
return this.setClientCredentials(x509Certificate, privateKey, p12Password);
} | java | public ApnsClientBuilder setClientCredentials(final InputStream p12InputStream, final String p12Password) throws SSLException, IOException {
final X509Certificate x509Certificate;
final PrivateKey privateKey;
try {
final KeyStore.PrivateKeyEntry privateKeyEntry = P12Util.getFirstPrivateKeyEntryFromP12InputStream(p12InputStream, p12Password);
final Certificate certificate = privateKeyEntry.getCertificate();
if (!(certificate instanceof X509Certificate)) {
throw new KeyStoreException("Found a certificate in the provided PKCS#12 file, but it was not an X.509 certificate.");
}
x509Certificate = (X509Certificate) certificate;
privateKey = privateKeyEntry.getPrivateKey();
} catch (final KeyStoreException e) {
throw new SSLException(e);
}
return this.setClientCredentials(x509Certificate, privateKey, p12Password);
} | [
"public",
"ApnsClientBuilder",
"setClientCredentials",
"(",
"final",
"InputStream",
"p12InputStream",
",",
"final",
"String",
"p12Password",
")",
"throws",
"SSLException",
",",
"IOException",
"{",
"final",
"X509Certificate",
"x509Certificate",
";",
"final",
"PrivateKey",
... | <p>Sets the TLS credentials for the client under construction using the data from the given PKCS#12 input stream.
Clients constructed with TLS credentials will use TLS-based authentication when sending push notifications. The
PKCS#12 data <em>must</em> contain a certificate/private key pair.</p>
<p>Clients may not have both TLS credentials and a signing key.</p>
@param p12InputStream an input stream to a PKCS#12-formatted file containing the certificate and private key to
be used to identify the client to the APNs server
@param p12Password the password to be used to decrypt the contents of the given PKCS#12 file; passwords may be
blank (i.e. {@code ""}), but must not be {@code null}
@throws SSLException if the given PKCS#12 file could not be loaded or if any other SSL-related problem arises
when constructing the context
@throws IOException if any IO problem occurred while attempting to read the given PKCS#12 input stream
@return a reference to this builder
@since 0.8 | [
"<p",
">",
"Sets",
"the",
"TLS",
"credentials",
"for",
"the",
"client",
"under",
"construction",
"using",
"the",
"data",
"from",
"the",
"given",
"PKCS#12",
"input",
"stream",
".",
"Clients",
"constructed",
"with",
"TLS",
"credentials",
"will",
"use",
"TLS",
... | train | https://github.com/relayrides/pushy/blob/1f6f9a0e07d785c815d74c2320a8d87c80231d36/pushy/src/main/java/com/turo/pushy/apns/ApnsClientBuilder.java#L216-L236 |
GoogleCloudPlatform/appengine-pipelines | java/src/main/java/com/google/appengine/tools/pipeline/Job.java | Job.futureCall | public <T, T1, T2, T3> FutureValue<T> futureCall(Job3<T, T1, T2, T3> jobInstance,
Value<? extends T1> v1, Value<? extends T2> v2, Value<? extends T3> v3,
JobSetting... settings) {
return futureCallUnchecked(settings, jobInstance, v1, v2, v3);
} | java | public <T, T1, T2, T3> FutureValue<T> futureCall(Job3<T, T1, T2, T3> jobInstance,
Value<? extends T1> v1, Value<? extends T2> v2, Value<? extends T3> v3,
JobSetting... settings) {
return futureCallUnchecked(settings, jobInstance, v1, v2, v3);
} | [
"public",
"<",
"T",
",",
"T1",
",",
"T2",
",",
"T3",
">",
"FutureValue",
"<",
"T",
">",
"futureCall",
"(",
"Job3",
"<",
"T",
",",
"T1",
",",
"T2",
",",
"T3",
">",
"jobInstance",
",",
"Value",
"<",
"?",
"extends",
"T1",
">",
"v1",
",",
"Value",
... | Invoke this method from within the {@code run} method of a <b>generator
job</b> in order to specify a job node in the generated child job graph.
This version of the method is for child jobs that take three arguments.
@param <T> The return type of the child job being specified
@param <T1> The type of the first input to the child job
@param <T2> The type of the second input to the child job
@param <T3> The type of the third input to the child job
@param jobInstance A user-written job object
@param v1 the first input to the child job
@param v2 the second input to the child job
@param v3 the third input to the child job
@param settings Optional one or more {@code JobSetting}
@return a {@code FutureValue} representing an empty value slot that will be
filled by the output of {@code jobInstance} when it finalizes. This
may be passed in to further invocations of {@code futureCall()} in
order to specify a data dependency. | [
"Invoke",
"this",
"method",
"from",
"within",
"the",
"{",
"@code",
"run",
"}",
"method",
"of",
"a",
"<b",
">",
"generator",
"job<",
"/",
"b",
">",
"in",
"order",
"to",
"specify",
"a",
"job",
"node",
"in",
"the",
"generated",
"child",
"job",
"graph",
... | train | https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/java/src/main/java/com/google/appengine/tools/pipeline/Job.java#L264-L268 |
gallandarakhneorg/afc | advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/primitive/RoadNetworkConstants.java | RoadNetworkConstants.setPreferredAttributeValueForTrafficDirection | public static void setPreferredAttributeValueForTrafficDirection(TrafficDirection direction, int index, String value) {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
if (prefs != null) {
final StringBuilder keyName = new StringBuilder();
keyName.append("TRAFFIC_DIRECTION_VALUE_"); //$NON-NLS-1$
keyName.append(direction.name());
keyName.append("_"); //$NON-NLS-1$
keyName.append(index);
String sysDef;
try {
sysDef = getSystemDefault(direction, index);
} catch (IndexOutOfBoundsException exception) {
sysDef = null;
}
if (value == null || "".equals(value) //$NON-NLS-1$
|| (sysDef != null && sysDef.equalsIgnoreCase(value))) {
prefs.remove(keyName.toString());
return;
}
prefs.put(keyName.toString(), value);
}
} | java | public static void setPreferredAttributeValueForTrafficDirection(TrafficDirection direction, int index, String value) {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
if (prefs != null) {
final StringBuilder keyName = new StringBuilder();
keyName.append("TRAFFIC_DIRECTION_VALUE_"); //$NON-NLS-1$
keyName.append(direction.name());
keyName.append("_"); //$NON-NLS-1$
keyName.append(index);
String sysDef;
try {
sysDef = getSystemDefault(direction, index);
} catch (IndexOutOfBoundsException exception) {
sysDef = null;
}
if (value == null || "".equals(value) //$NON-NLS-1$
|| (sysDef != null && sysDef.equalsIgnoreCase(value))) {
prefs.remove(keyName.toString());
return;
}
prefs.put(keyName.toString(), value);
}
} | [
"public",
"static",
"void",
"setPreferredAttributeValueForTrafficDirection",
"(",
"TrafficDirection",
"direction",
",",
"int",
"index",
",",
"String",
"value",
")",
"{",
"final",
"Preferences",
"prefs",
"=",
"Preferences",
".",
"userNodeForPackage",
"(",
"RoadNetworkCon... | Set the preferred value of traffic direction
used in the attributes for the traffic direction on the roads.
@param direction a direction.
@param index is the index of the supported string to reply
@param value is the preferred name for the traffic direction on the roads. | [
"Set",
"the",
"preferred",
"value",
"of",
"traffic",
"direction",
"used",
"in",
"the",
"attributes",
"for",
"the",
"traffic",
"direction",
"on",
"the",
"roads",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/primitive/RoadNetworkConstants.java#L550-L571 |
HsiangLeekwok/hlklib | hlklib/src/main/java/com/hlk/hlklib/lib/emoji/EmojiUtility.java | EmojiUtility.getEmojiString | public static SpannableString getEmojiString(Context context, String string, boolean adjustEmoji) {
if (null == EmojiList) {
initEmojiItems(context);
}
// 转换 Html,去掉两个表情之间的多个空格
Spanned spanned = Html.fromHtml(string.replace(" ", ""));
SpannableString spannableString = new SpannableString(spanned);
// 通过传入的正则表达式来生成一个pattern
Pattern emojiPatten = Pattern.compile(FACE_REGULAR, Pattern.CASE_INSENSITIVE);
try {
dealExpression(context, spannableString, emojiPatten, 0, adjustEmoji);
} catch (Exception e) {
e.printStackTrace();
}
return spannableString;
} | java | public static SpannableString getEmojiString(Context context, String string, boolean adjustEmoji) {
if (null == EmojiList) {
initEmojiItems(context);
}
// 转换 Html,去掉两个表情之间的多个空格
Spanned spanned = Html.fromHtml(string.replace(" ", ""));
SpannableString spannableString = new SpannableString(spanned);
// 通过传入的正则表达式来生成一个pattern
Pattern emojiPatten = Pattern.compile(FACE_REGULAR, Pattern.CASE_INSENSITIVE);
try {
dealExpression(context, spannableString, emojiPatten, 0, adjustEmoji);
} catch (Exception e) {
e.printStackTrace();
}
return spannableString;
} | [
"public",
"static",
"SpannableString",
"getEmojiString",
"(",
"Context",
"context",
",",
"String",
"string",
",",
"boolean",
"adjustEmoji",
")",
"{",
"if",
"(",
"null",
"==",
"EmojiList",
")",
"{",
"initEmojiItems",
"(",
"context",
")",
";",
"}",
"// 转换 Html,去... | 得到一个SpanableString对象。通过传入的字符串进行正则判断,将其中的表情符号转换成表情图片
@param context context
@param string original text
@param adjustEmoji 是否将表情图片缩放成文字大小
@return SpannableStringBuilder | [
"得到一个SpanableString对象。通过传入的字符串进行正则判断,将其中的表情符号转换成表情图片"
] | train | https://github.com/HsiangLeekwok/hlklib/blob/b122f6dcab7cec60c8e5455e0c31613d08bec6ad/hlklib/src/main/java/com/hlk/hlklib/lib/emoji/EmojiUtility.java#L85-L100 |
ibm-bluemix-mobile-services/bms-clientsdk-android-core | lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/security/mca/internal/AuthorizationProcessManager.java | AuthorizationProcessManager.startAuthorizationProcess | public void startAuthorizationProcess(final Context context, ResponseListener listener) {
authorizationQueue.add(listener);
//start the authorization process only if this is the first time we ask for authorization
if (authorizationQueue.size() == 1) {
try {
if (preferences.clientId.get() == null) {
logger.info("starting registration process");
invokeInstanceRegistrationRequest(context);
} else {
logger.info("starting authorization process");
invokeAuthorizationRequest(context);
}
} catch (Throwable t) {
handleAuthorizationFailure(t);
}
}
else{
logger.info("authorization process already running, adding response listener to the queue");
logger.debug(String.format("authorization process currently handling %d requests", authorizationQueue.size()));
}
} | java | public void startAuthorizationProcess(final Context context, ResponseListener listener) {
authorizationQueue.add(listener);
//start the authorization process only if this is the first time we ask for authorization
if (authorizationQueue.size() == 1) {
try {
if (preferences.clientId.get() == null) {
logger.info("starting registration process");
invokeInstanceRegistrationRequest(context);
} else {
logger.info("starting authorization process");
invokeAuthorizationRequest(context);
}
} catch (Throwable t) {
handleAuthorizationFailure(t);
}
}
else{
logger.info("authorization process already running, adding response listener to the queue");
logger.debug(String.format("authorization process currently handling %d requests", authorizationQueue.size()));
}
} | [
"public",
"void",
"startAuthorizationProcess",
"(",
"final",
"Context",
"context",
",",
"ResponseListener",
"listener",
")",
"{",
"authorizationQueue",
".",
"add",
"(",
"listener",
")",
";",
"//start the authorization process only if this is the first time we ask for authorizat... | Main method to start authorization process
@param context android context
@param listener response listener that will get the result of the process | [
"Main",
"method",
"to",
"start",
"authorization",
"process"
] | train | https://github.com/ibm-bluemix-mobile-services/bms-clientsdk-android-core/blob/8db4f00d0d564792397bfc0e5bd57d52a238b858/lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/security/mca/internal/AuthorizationProcessManager.java#L94-L116 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/config/TcpIpConfig.java | TcpIpConfig.addMember | public TcpIpConfig addMember(String member) {
String memberText = checkHasText(member, "member must contain text");
StringTokenizer tokenizer = new StringTokenizer(memberText, ",");
while (tokenizer.hasMoreTokens()) {
String s = tokenizer.nextToken();
this.members.add(s.trim());
}
return this;
} | java | public TcpIpConfig addMember(String member) {
String memberText = checkHasText(member, "member must contain text");
StringTokenizer tokenizer = new StringTokenizer(memberText, ",");
while (tokenizer.hasMoreTokens()) {
String s = tokenizer.nextToken();
this.members.add(s.trim());
}
return this;
} | [
"public",
"TcpIpConfig",
"addMember",
"(",
"String",
"member",
")",
"{",
"String",
"memberText",
"=",
"checkHasText",
"(",
"member",
",",
"\"member must contain text\"",
")",
";",
"StringTokenizer",
"tokenizer",
"=",
"new",
"StringTokenizer",
"(",
"memberText",
",",... | Adds a 'well known' member.
<p>
Each HazelcastInstance will try to connect to at least one of the members, to find all other members,
and create a cluster.
<p>
A member can be a comma separated string, e..g '10.11.12.1,10.11.12.2' which indicates multiple members
are going to be added.
@param member the member to add
@return the updated configuration
@throws IllegalArgumentException if member is {@code null} or empty
@see #getMembers() | [
"Adds",
"a",
"well",
"known",
"member",
".",
"<p",
">",
"Each",
"HazelcastInstance",
"will",
"try",
"to",
"connect",
"to",
"at",
"least",
"one",
"of",
"the",
"members",
"to",
"find",
"all",
"other",
"members",
"and",
"create",
"a",
"cluster",
".",
"<p",
... | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/config/TcpIpConfig.java#L145-L155 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-translate/src/main/java/com/google/cloud/translate/v3beta1/TranslationServiceClient.java | TranslationServiceClient.formatLocationName | @Deprecated
public static final String formatLocationName(String project, String location) {
return LOCATION_PATH_TEMPLATE.instantiate(
"project", project,
"location", location);
} | java | @Deprecated
public static final String formatLocationName(String project, String location) {
return LOCATION_PATH_TEMPLATE.instantiate(
"project", project,
"location", location);
} | [
"@",
"Deprecated",
"public",
"static",
"final",
"String",
"formatLocationName",
"(",
"String",
"project",
",",
"String",
"location",
")",
"{",
"return",
"LOCATION_PATH_TEMPLATE",
".",
"instantiate",
"(",
"\"project\"",
",",
"project",
",",
"\"location\"",
",",
"lo... | Formats a string containing the fully-qualified path to represent a location resource.
@deprecated Use the {@link LocationName} class instead. | [
"Formats",
"a",
"string",
"containing",
"the",
"fully",
"-",
"qualified",
"path",
"to",
"represent",
"a",
"location",
"resource",
"."
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-translate/src/main/java/com/google/cloud/translate/v3beta1/TranslationServiceClient.java#L142-L147 |
cdapio/tigon | tigon-api/src/main/java/co/cask/tigon/internal/io/Schema.java | Schema.unionOf | public static Schema unionOf(Iterable<Schema> schemas) {
List<Schema> schemaList = ImmutableList.copyOf(schemas);
Preconditions.checkArgument(schemaList.size() > 0, "No union schema provided.");
return new Schema(Type.UNION, null, null, null, null, null, null, schemaList);
} | java | public static Schema unionOf(Iterable<Schema> schemas) {
List<Schema> schemaList = ImmutableList.copyOf(schemas);
Preconditions.checkArgument(schemaList.size() > 0, "No union schema provided.");
return new Schema(Type.UNION, null, null, null, null, null, null, schemaList);
} | [
"public",
"static",
"Schema",
"unionOf",
"(",
"Iterable",
"<",
"Schema",
">",
"schemas",
")",
"{",
"List",
"<",
"Schema",
">",
"schemaList",
"=",
"ImmutableList",
".",
"copyOf",
"(",
"schemas",
")",
";",
"Preconditions",
".",
"checkArgument",
"(",
"schemaLis... | Creates a {@link Type#UNION UNION} {@link Schema} which represents a union of all the given schemas.
The ordering of the schemas inside the union would be the same as the {@link Iterable#iterator()} order.
@param schemas All the {@link Schema Schemas} constitutes the union.
@return A {@link Schema} of {@link Type#UNION UNION} type. | [
"Creates",
"a",
"{",
"@link",
"Type#UNION",
"UNION",
"}",
"{",
"@link",
"Schema",
"}",
"which",
"represents",
"a",
"union",
"of",
"all",
"the",
"given",
"schemas",
".",
"The",
"ordering",
"of",
"the",
"schemas",
"inside",
"the",
"union",
"would",
"be",
"... | train | https://github.com/cdapio/tigon/blob/5be6dffd7c79519d1211bb08f75be7dcfbbad392/tigon-api/src/main/java/co/cask/tigon/internal/io/Schema.java#L251-L255 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/VpnSitesConfigurationsInner.java | VpnSitesConfigurationsInner.downloadAsync | public Observable<Void> downloadAsync(String resourceGroupName, String virtualWANName, GetVpnSitesConfigurationRequest request) {
return downloadWithServiceResponseAsync(resourceGroupName, virtualWANName, request).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | java | public Observable<Void> downloadAsync(String resourceGroupName, String virtualWANName, GetVpnSitesConfigurationRequest request) {
return downloadWithServiceResponseAsync(resourceGroupName, virtualWANName, request).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"downloadAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"virtualWANName",
",",
"GetVpnSitesConfigurationRequest",
"request",
")",
"{",
"return",
"downloadWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"virtu... | Gives the sas-url to download the configurations for vpn-sites in a resource group.
@param resourceGroupName The resource group name.
@param virtualWANName The name of the VirtualWAN for which configuration of all vpn-sites is needed.
@param request Parameters supplied to download vpn-sites configuration.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Gives",
"the",
"sas",
"-",
"url",
"to",
"download",
"the",
"configurations",
"for",
"vpn",
"-",
"sites",
"in",
"a",
"resource",
"group",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/VpnSitesConfigurationsInner.java#L104-L111 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/date/DateTime.java | DateTime.parse | private static Date parse(String dateStr, DateFormat dateFormat) {
try {
return dateFormat.parse(dateStr);
} catch (Exception e) {
String pattern;
if (dateFormat instanceof SimpleDateFormat) {
pattern = ((SimpleDateFormat) dateFormat).toPattern();
} else {
pattern = dateFormat.toString();
}
throw new DateException(StrUtil.format("Parse [{}] with format [{}] error!", dateStr, pattern), e);
}
} | java | private static Date parse(String dateStr, DateFormat dateFormat) {
try {
return dateFormat.parse(dateStr);
} catch (Exception e) {
String pattern;
if (dateFormat instanceof SimpleDateFormat) {
pattern = ((SimpleDateFormat) dateFormat).toPattern();
} else {
pattern = dateFormat.toString();
}
throw new DateException(StrUtil.format("Parse [{}] with format [{}] error!", dateStr, pattern), e);
}
} | [
"private",
"static",
"Date",
"parse",
"(",
"String",
"dateStr",
",",
"DateFormat",
"dateFormat",
")",
"{",
"try",
"{",
"return",
"dateFormat",
".",
"parse",
"(",
"dateStr",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"String",
"pattern",
";"... | 转换字符串为Date
@param dateStr 日期字符串
@param dateFormat {@link SimpleDateFormat}
@return {@link Date} | [
"转换字符串为Date"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/DateTime.java#L875-L887 |
Alluxio/alluxio | core/client/fs/src/main/java/alluxio/client/file/FileSystemUtils.java | FileSystemUtils.persistAndWait | public static void persistAndWait(final FileSystem fs, final AlluxioURI uri, int timeoutMs)
throws FileDoesNotExistException, IOException, AlluxioException, TimeoutException,
InterruptedException {
fs.persist(uri);
CommonUtils.waitFor(String.format("%s to be persisted", uri) , () -> {
try {
return fs.getStatus(uri).isPersisted();
} catch (Exception e) {
Throwables.throwIfUnchecked(e);
throw new RuntimeException(e);
}
}, WaitForOptions.defaults().setTimeoutMs(timeoutMs)
.setInterval(Constants.SECOND_MS));
} | java | public static void persistAndWait(final FileSystem fs, final AlluxioURI uri, int timeoutMs)
throws FileDoesNotExistException, IOException, AlluxioException, TimeoutException,
InterruptedException {
fs.persist(uri);
CommonUtils.waitFor(String.format("%s to be persisted", uri) , () -> {
try {
return fs.getStatus(uri).isPersisted();
} catch (Exception e) {
Throwables.throwIfUnchecked(e);
throw new RuntimeException(e);
}
}, WaitForOptions.defaults().setTimeoutMs(timeoutMs)
.setInterval(Constants.SECOND_MS));
} | [
"public",
"static",
"void",
"persistAndWait",
"(",
"final",
"FileSystem",
"fs",
",",
"final",
"AlluxioURI",
"uri",
",",
"int",
"timeoutMs",
")",
"throws",
"FileDoesNotExistException",
",",
"IOException",
",",
"AlluxioException",
",",
"TimeoutException",
",",
"Interr... | Persists the given path to the under file system and returns once the persist is complete.
Note that if this method times out, the persist may still occur after the timeout period.
@param fs {@link FileSystem} to carry out Alluxio operations
@param uri the uri of the file to persist
@param timeoutMs max amount of time to wait for persist in milliseconds. -1 to wait
indefinitely
@throws TimeoutException if the persist takes longer than the timeout | [
"Persists",
"the",
"given",
"path",
"to",
"the",
"under",
"file",
"system",
"and",
"returns",
"once",
"the",
"persist",
"is",
"complete",
".",
"Note",
"that",
"if",
"this",
"method",
"times",
"out",
"the",
"persist",
"may",
"still",
"occur",
"after",
"the"... | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/client/fs/src/main/java/alluxio/client/file/FileSystemUtils.java#L150-L163 |
thorntail/thorntail | arquillian/gradle-adapter/src/main/java/org/wildfly/swarm/arquillian/adapter/gradle/GradleDependencyAdapter.java | GradleDependencyAdapter.computeProjectDependencies | @SuppressWarnings("UnstableApiUsage")
private void computeProjectDependencies(IdeaModule module) {
ARTIFACT_DEPS_OF_PRJ.computeIfAbsent(module.getName(), moduleName -> {
Map<String, Set<ArtifactSpec>> dependencies = new HashMap<>();
module.getDependencies().forEach(dep -> {
if (dep instanceof IdeaModuleDependency) {
// Add the dependency to the list.
String name = ((IdeaModuleDependency) dep).getTargetModuleName();
PRJ_DEPS_OF_PRJ.computeIfAbsent(moduleName, key -> new HashSet<>()).add(name);
} else if (dep instanceof ExternalDependency) {
ExternalDependency extDep = (ExternalDependency) dep;
GradleModuleVersion gav = extDep.getGradleModuleVersion();
ArtifactSpec spec = new ArtifactSpec("compile", gav.getGroup(), gav.getName(), gav.getVersion(),
"jar", null, extDep.getFile());
String depScope = dep.getScope().getScope();
dependencies.computeIfAbsent(depScope, s -> new HashSet<>()).add(spec);
}
});
return dependencies;
});
} | java | @SuppressWarnings("UnstableApiUsage")
private void computeProjectDependencies(IdeaModule module) {
ARTIFACT_DEPS_OF_PRJ.computeIfAbsent(module.getName(), moduleName -> {
Map<String, Set<ArtifactSpec>> dependencies = new HashMap<>();
module.getDependencies().forEach(dep -> {
if (dep instanceof IdeaModuleDependency) {
// Add the dependency to the list.
String name = ((IdeaModuleDependency) dep).getTargetModuleName();
PRJ_DEPS_OF_PRJ.computeIfAbsent(moduleName, key -> new HashSet<>()).add(name);
} else if (dep instanceof ExternalDependency) {
ExternalDependency extDep = (ExternalDependency) dep;
GradleModuleVersion gav = extDep.getGradleModuleVersion();
ArtifactSpec spec = new ArtifactSpec("compile", gav.getGroup(), gav.getName(), gav.getVersion(),
"jar", null, extDep.getFile());
String depScope = dep.getScope().getScope();
dependencies.computeIfAbsent(depScope, s -> new HashSet<>()).add(spec);
}
});
return dependencies;
});
} | [
"@",
"SuppressWarnings",
"(",
"\"UnstableApiUsage\"",
")",
"private",
"void",
"computeProjectDependencies",
"(",
"IdeaModule",
"module",
")",
"{",
"ARTIFACT_DEPS_OF_PRJ",
".",
"computeIfAbsent",
"(",
"module",
".",
"getName",
"(",
")",
",",
"moduleName",
"->",
"{",
... | Compute the dependencies of a given {@code IdeaModule} and group them by their scope.
Note: This method does not follow project->project dependencies. It just makes a note of them in a separate collection.
@param module the IdeaModule reference. | [
"Compute",
"the",
"dependencies",
"of",
"a",
"given",
"{",
"@code",
"IdeaModule",
"}",
"and",
"group",
"them",
"by",
"their",
"scope",
"."
] | train | https://github.com/thorntail/thorntail/blob/4a391b68ffae98c6e66d30a3bfb99dadc9509f14/arquillian/gradle-adapter/src/main/java/org/wildfly/swarm/arquillian/adapter/gradle/GradleDependencyAdapter.java#L148-L168 |
jbundle/osgi | obr/src/main/java/org/jbundle/util/osgi/obr/ObrClassFinderService.java | ObrClassFinderService.deployResources | public void deployResources(Resource[] resources, int options)
{
if (resources != null)
{
for (Resource resource : resources)
{
this.deployResource(resource, options);
}
}
} | java | public void deployResources(Resource[] resources, int options)
{
if (resources != null)
{
for (Resource resource : resources)
{
this.deployResource(resource, options);
}
}
} | [
"public",
"void",
"deployResources",
"(",
"Resource",
"[",
"]",
"resources",
",",
"int",
"options",
")",
"{",
"if",
"(",
"resources",
"!=",
"null",
")",
"{",
"for",
"(",
"Resource",
"resource",
":",
"resources",
")",
"{",
"this",
".",
"deployResource",
"... | Deploy this list of resources.
@param resources
@param options | [
"Deploy",
"this",
"list",
"of",
"resources",
"."
] | train | https://github.com/jbundle/osgi/blob/beb02aef78736a4f799aaac001c8f0327bf0536c/obr/src/main/java/org/jbundle/util/osgi/obr/ObrClassFinderService.java#L248-L257 |
ocelotds/ocelot | ocelot-web/src/main/java/org/ocelotds/cache/CacheManager.java | CacheManager.processCacheAnnotations | public long processCacheAnnotations(Method nonProxiedMethod, List<String> parameters) {
if (isJsCached(nonProxiedMethod)) {
return jsCacheAnnotationServices.getJsCacheResultDeadline(nonProxiedMethod.getAnnotation(JsCacheResult.class));
}
return 0L;
} | java | public long processCacheAnnotations(Method nonProxiedMethod, List<String> parameters) {
if (isJsCached(nonProxiedMethod)) {
return jsCacheAnnotationServices.getJsCacheResultDeadline(nonProxiedMethod.getAnnotation(JsCacheResult.class));
}
return 0L;
} | [
"public",
"long",
"processCacheAnnotations",
"(",
"Method",
"nonProxiedMethod",
",",
"List",
"<",
"String",
">",
"parameters",
")",
"{",
"if",
"(",
"isJsCached",
"(",
"nonProxiedMethod",
")",
")",
"{",
"return",
"jsCacheAnnotationServices",
".",
"getJsCacheResultDea... | Process annotations JsCacheResult, JsCacheRemove and JsCacheRemoves
@param nonProxiedMethod
@param parameters
@return | [
"Process",
"annotations",
"JsCacheResult",
"JsCacheRemove",
"and",
"JsCacheRemoves"
] | train | https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-web/src/main/java/org/ocelotds/cache/CacheManager.java#L33-L38 |
mapfish/mapfish-print | core/src/main/java/org/mapfish/print/ImageUtils.java | ImageUtils.writeImage | public static void writeImage(final BufferedImage im, final String formatName, final File output)
throws IOException {
if (!ImageIO.write(im, formatName, output)) {
throw new RuntimeException("Image format not supported: " + formatName);
}
} | java | public static void writeImage(final BufferedImage im, final String formatName, final File output)
throws IOException {
if (!ImageIO.write(im, formatName, output)) {
throw new RuntimeException("Image format not supported: " + formatName);
}
} | [
"public",
"static",
"void",
"writeImage",
"(",
"final",
"BufferedImage",
"im",
",",
"final",
"String",
"formatName",
",",
"final",
"File",
"output",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"ImageIO",
".",
"write",
"(",
"im",
",",
"formatName",
"... | Equivalent to {@link ImageIO#write}, but handle errors.
@param im a <code>RenderedImage</code> to be written.
@param formatName a <code>String</code> containing the informal name of the format.
@param output a <code>File</code> to be written to.
@throws IOException if an error occurs during writing. | [
"Equivalent",
"to",
"{",
"@link",
"ImageIO#write",
"}",
"but",
"handle",
"errors",
"."
] | train | https://github.com/mapfish/mapfish-print/blob/25a452cb39f592bd8a53b20db1037703898e1e22/core/src/main/java/org/mapfish/print/ImageUtils.java#L25-L30 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.