repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 192 | func_name stringlengths 5 108 | whole_func_string stringlengths 75 3.91k | language stringclasses 1
value | func_code_string stringlengths 75 3.91k | func_code_tokens listlengths 21 629 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 647 | split_name stringclasses 1
value | func_code_url stringlengths 111 306 |
|---|---|---|---|---|---|---|---|---|---|---|
apache/incubator-druid | extensions-core/s3-extensions/src/main/java/org/apache/druid/storage/s3/S3Utils.java | S3Utils.getSingleObjectSummary | public static S3ObjectSummary getSingleObjectSummary(ServerSideEncryptingAmazonS3 s3Client, String bucket, String key)
{
final ListObjectsV2Request request = new ListObjectsV2Request()
.withBucketName(bucket)
.withPrefix(key)
.withMaxKeys(1);
final ListObjectsV2Result result = s3Client.listObjectsV2(request);
// Using getObjectSummaries().size() instead of getKeyCount as, in some cases
// it is observed that even though the getObjectSummaries returns some data
// keyCount is still zero.
if (result.getObjectSummaries().size() == 0) {
throw new ISE("Cannot find object for bucket[%s] and key[%s]", bucket, key);
}
final S3ObjectSummary objectSummary = result.getObjectSummaries().get(0);
if (!objectSummary.getBucketName().equals(bucket) || !objectSummary.getKey().equals(key)) {
throw new ISE("Wrong object[%s] for bucket[%s] and key[%s]", objectSummary, bucket, key);
}
return objectSummary;
} | java | public static S3ObjectSummary getSingleObjectSummary(ServerSideEncryptingAmazonS3 s3Client, String bucket, String key)
{
final ListObjectsV2Request request = new ListObjectsV2Request()
.withBucketName(bucket)
.withPrefix(key)
.withMaxKeys(1);
final ListObjectsV2Result result = s3Client.listObjectsV2(request);
// Using getObjectSummaries().size() instead of getKeyCount as, in some cases
// it is observed that even though the getObjectSummaries returns some data
// keyCount is still zero.
if (result.getObjectSummaries().size() == 0) {
throw new ISE("Cannot find object for bucket[%s] and key[%s]", bucket, key);
}
final S3ObjectSummary objectSummary = result.getObjectSummaries().get(0);
if (!objectSummary.getBucketName().equals(bucket) || !objectSummary.getKey().equals(key)) {
throw new ISE("Wrong object[%s] for bucket[%s] and key[%s]", objectSummary, bucket, key);
}
return objectSummary;
} | [
"public",
"static",
"S3ObjectSummary",
"getSingleObjectSummary",
"(",
"ServerSideEncryptingAmazonS3",
"s3Client",
",",
"String",
"bucket",
",",
"String",
"key",
")",
"{",
"final",
"ListObjectsV2Request",
"request",
"=",
"new",
"ListObjectsV2Request",
"(",
")",
".",
"w... | Gets a single {@link S3ObjectSummary} from s3. Since this method might return a wrong object if there are multiple
objects that match the given key, this method should be used only when it's guaranteed that the given key is unique
in the given bucket.
@param s3Client s3 client
@param bucket s3 bucket
@param key unique key for the object to be retrieved | [
"Gets",
"a",
"single",
"{",
"@link",
"S3ObjectSummary",
"}",
"from",
"s3",
".",
"Since",
"this",
"method",
"might",
"return",
"a",
"wrong",
"object",
"if",
"there",
"are",
"multiple",
"objects",
"that",
"match",
"the",
"given",
"key",
"this",
"method",
"sh... | train | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/extensions-core/s3-extensions/src/main/java/org/apache/druid/storage/s3/S3Utils.java#L241-L261 |
redisson/redisson | redisson/src/main/java/org/redisson/executor/CronExpression.java | CronExpression.setCalendarHour | protected void setCalendarHour(Calendar cal, int hour) {
cal.set(java.util.Calendar.HOUR_OF_DAY, hour);
if (cal.get(java.util.Calendar.HOUR_OF_DAY) != hour && hour != 24) {
cal.set(java.util.Calendar.HOUR_OF_DAY, hour + 1);
}
} | java | protected void setCalendarHour(Calendar cal, int hour) {
cal.set(java.util.Calendar.HOUR_OF_DAY, hour);
if (cal.get(java.util.Calendar.HOUR_OF_DAY) != hour && hour != 24) {
cal.set(java.util.Calendar.HOUR_OF_DAY, hour + 1);
}
} | [
"protected",
"void",
"setCalendarHour",
"(",
"Calendar",
"cal",
",",
"int",
"hour",
")",
"{",
"cal",
".",
"set",
"(",
"java",
".",
"util",
".",
"Calendar",
".",
"HOUR_OF_DAY",
",",
"hour",
")",
";",
"if",
"(",
"cal",
".",
"get",
"(",
"java",
".",
"... | Advance the calendar to the particular hour paying particular attention
to daylight saving problems.
@param cal the calendar to operate on
@param hour the hour to set | [
"Advance",
"the",
"calendar",
"to",
"the",
"particular",
"hour",
"paying",
"particular",
"attention",
"to",
"daylight",
"saving",
"problems",
"."
] | train | https://github.com/redisson/redisson/blob/d3acc0249b2d5d658d36d99e2c808ce49332ea44/redisson/src/main/java/org/redisson/executor/CronExpression.java#L1434-L1439 |
eFaps/eFaps-Kernel | src/main/java/org/efaps/db/wrapper/SQLSelect.java | SQLSelect.addTablePart | public SQLSelect addTablePart(final String _tableName,
final Integer _tableIndex)
{
parts.add(new FromTable(tablePrefix, _tableName, _tableIndex));
return this;
} | java | public SQLSelect addTablePart(final String _tableName,
final Integer _tableIndex)
{
parts.add(new FromTable(tablePrefix, _tableName, _tableIndex));
return this;
} | [
"public",
"SQLSelect",
"addTablePart",
"(",
"final",
"String",
"_tableName",
",",
"final",
"Integer",
"_tableIndex",
")",
"{",
"parts",
".",
"add",
"(",
"new",
"FromTable",
"(",
"tablePrefix",
",",
"_tableName",
",",
"_tableIndex",
")",
")",
";",
"return",
"... | Add a table as part.
@param _tableName name of the table
@param _tableIndex index of the table
@return this | [
"Add",
"a",
"table",
"as",
"part",
"."
] | train | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/db/wrapper/SQLSelect.java#L405-L410 |
Azure/azure-sdk-for-java | network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/VirtualNetworkGatewayConnectionsInner.java | VirtualNetworkGatewayConnectionsInner.beginSetSharedKey | public ConnectionSharedKeyInner beginSetSharedKey(String resourceGroupName, String virtualNetworkGatewayConnectionName, String value) {
return beginSetSharedKeyWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayConnectionName, value).toBlocking().single().body();
} | java | public ConnectionSharedKeyInner beginSetSharedKey(String resourceGroupName, String virtualNetworkGatewayConnectionName, String value) {
return beginSetSharedKeyWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayConnectionName, value).toBlocking().single().body();
} | [
"public",
"ConnectionSharedKeyInner",
"beginSetSharedKey",
"(",
"String",
"resourceGroupName",
",",
"String",
"virtualNetworkGatewayConnectionName",
",",
"String",
"value",
")",
"{",
"return",
"beginSetSharedKeyWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"virtualN... | The Put VirtualNetworkGatewayConnectionSharedKey operation sets the virtual network gateway connection shared key for passed virtual network gateway connection in the specified resource group through Network resource provider.
@param resourceGroupName The name of the resource group.
@param virtualNetworkGatewayConnectionName The virtual network gateway connection name.
@param value The virtual network connection shared key value.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the ConnectionSharedKeyInner object if successful. | [
"The",
"Put",
"VirtualNetworkGatewayConnectionSharedKey",
"operation",
"sets",
"the",
"virtual",
"network",
"gateway",
"connection",
"shared",
"key",
"for",
"passed",
"virtual",
"network",
"gateway",
"connection",
"in",
"the",
"specified",
"resource",
"group",
"through"... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/VirtualNetworkGatewayConnectionsInner.java#L932-L934 |
apache/groovy | src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java | DefaultGroovyMethods.getAt | @SuppressWarnings("unchecked")
public static List<Character> getAt(char[] array, Collection indices) {
return primitiveArrayGet(array, indices);
} | java | @SuppressWarnings("unchecked")
public static List<Character> getAt(char[] array, Collection indices) {
return primitiveArrayGet(array, indices);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"List",
"<",
"Character",
">",
"getAt",
"(",
"char",
"[",
"]",
"array",
",",
"Collection",
"indices",
")",
"{",
"return",
"primitiveArrayGet",
"(",
"array",
",",
"indices",
")",
";",
"... | Support the subscript operator with a collection for a char array
@param array a char array
@param indices a collection of indices for the items to retrieve
@return list of the chars at the given indices
@since 1.0 | [
"Support",
"the",
"subscript",
"operator",
"with",
"a",
"collection",
"for",
"a",
"char",
"array"
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L13951-L13954 |
Alluxio/alluxio | core/common/src/main/java/alluxio/util/UnderFileSystemUtils.java | UnderFileSystemUtils.deleteDirIfExists | public static void deleteDirIfExists(UnderFileSystem ufs, String path) throws IOException {
if (ufs.isDirectory(path)
&& !ufs.deleteDirectory(path, DeleteOptions.defaults().setRecursive(true))) {
throw new IOException("Folder " + path + " already exists but can not be deleted.");
}
} | java | public static void deleteDirIfExists(UnderFileSystem ufs, String path) throws IOException {
if (ufs.isDirectory(path)
&& !ufs.deleteDirectory(path, DeleteOptions.defaults().setRecursive(true))) {
throw new IOException("Folder " + path + " already exists but can not be deleted.");
}
} | [
"public",
"static",
"void",
"deleteDirIfExists",
"(",
"UnderFileSystem",
"ufs",
",",
"String",
"path",
")",
"throws",
"IOException",
"{",
"if",
"(",
"ufs",
".",
"isDirectory",
"(",
"path",
")",
"&&",
"!",
"ufs",
".",
"deleteDirectory",
"(",
"path",
",",
"D... | Deletes the directory at the given path if it exists.
@param ufs instance of {@link UnderFileSystem}
@param path path to the directory | [
"Deletes",
"the",
"directory",
"at",
"the",
"given",
"path",
"if",
"it",
"exists",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/util/UnderFileSystemUtils.java#L36-L41 |
jboss-integration/fuse-bxms-integ | switchyard/switchyard-component-common-knowledge/src/main/java/org/switchyard/component/common/knowledge/exchange/KnowledgeExchangeHandler.java | KnowledgeExchangeHandler.getObject | protected Object getObject(Exchange exchange, Message message, String name) {
Context context = message != null ? exchange.getContext(message) : exchange.getContext();
return context.getPropertyValue(name);
} | java | protected Object getObject(Exchange exchange, Message message, String name) {
Context context = message != null ? exchange.getContext(message) : exchange.getContext();
return context.getPropertyValue(name);
} | [
"protected",
"Object",
"getObject",
"(",
"Exchange",
"exchange",
",",
"Message",
"message",
",",
"String",
"name",
")",
"{",
"Context",
"context",
"=",
"message",
"!=",
"null",
"?",
"exchange",
".",
"getContext",
"(",
"message",
")",
":",
"exchange",
".",
... | Gets an Object context property.
@param exchange the exchange
@param message the message
@param name the name
@return the property | [
"Gets",
"an",
"Object",
"context",
"property",
"."
] | train | https://github.com/jboss-integration/fuse-bxms-integ/blob/ca5c012bf867ea15d1250f0991af3cd7e708aaaf/switchyard/switchyard-component-common-knowledge/src/main/java/org/switchyard/component/common/knowledge/exchange/KnowledgeExchangeHandler.java#L254-L257 |
threerings/narya | core/src/main/java/com/threerings/presents/dobj/DObject.java | DObject.clearLock | protected void clearLock (String name)
{
// clear the lock from the list
if (ListUtil.clear(_locks, name) == null) {
// complain if we didn't find the lock
log.info("Unable to clear non-existent lock", "lock", name, "dobj", this);
}
} | java | protected void clearLock (String name)
{
// clear the lock from the list
if (ListUtil.clear(_locks, name) == null) {
// complain if we didn't find the lock
log.info("Unable to clear non-existent lock", "lock", name, "dobj", this);
}
} | [
"protected",
"void",
"clearLock",
"(",
"String",
"name",
")",
"{",
"// clear the lock from the list",
"if",
"(",
"ListUtil",
".",
"clear",
"(",
"_locks",
",",
"name",
")",
"==",
"null",
")",
"{",
"// complain if we didn't find the lock",
"log",
".",
"info",
"(",... | Don't call this function! It is called by a remove lock event when that event is processed
and shouldn't be called at any other time. If you mean to release a lock that was acquired
with <code>acquireLock</code> you should be using <code>releaseLock</code>.
@see #acquireLock
@see #releaseLock | [
"Don",
"t",
"call",
"this",
"function!",
"It",
"is",
"called",
"by",
"a",
"remove",
"lock",
"event",
"when",
"that",
"event",
"is",
"processed",
"and",
"shouldn",
"t",
"be",
"called",
"at",
"any",
"other",
"time",
".",
"If",
"you",
"mean",
"to",
"relea... | train | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/dobj/DObject.java#L341-L348 |
feedzai/pdb | src/main/java/com/feedzai/commons/sql/abstraction/dml/With.java | With.andWith | public With andWith(final String alias, final Expression expression) {
this.clauses.add(new ImmutablePair<>(new Name(alias), expression));
return this;
} | java | public With andWith(final String alias, final Expression expression) {
this.clauses.add(new ImmutablePair<>(new Name(alias), expression));
return this;
} | [
"public",
"With",
"andWith",
"(",
"final",
"String",
"alias",
",",
"final",
"Expression",
"expression",
")",
"{",
"this",
".",
"clauses",
".",
"add",
"(",
"new",
"ImmutablePair",
"<>",
"(",
"new",
"Name",
"(",
"alias",
")",
",",
"expression",
")",
")",
... | Adds an alias and expression to the with clause.
@param alias expression alias
@param expression expression to be aliased.
@return this object. | [
"Adds",
"an",
"alias",
"and",
"expression",
"to",
"the",
"with",
"clause",
"."
] | train | https://github.com/feedzai/pdb/blob/fe07ca08417e0ddcd620a36aa1fdbca7f338be98/src/main/java/com/feedzai/commons/sql/abstraction/dml/With.java#L76-L79 |
ineunetOS/knife-commons | knife-commons-qlmap/src/main/java/com/ineunet/knife/qlmap/criteria/Restrictors.java | Restrictors.and | public static Restrictor and(Restrictor c1, Restrictor c2) {
return new LogicRestrictor(c1, c2, RestrictType.and);
} | java | public static Restrictor and(Restrictor c1, Restrictor c2) {
return new LogicRestrictor(c1, c2, RestrictType.and);
} | [
"public",
"static",
"Restrictor",
"and",
"(",
"Restrictor",
"c1",
",",
"Restrictor",
"c2",
")",
"{",
"return",
"new",
"LogicRestrictor",
"(",
"c1",
",",
"c2",
",",
"RestrictType",
".",
"and",
")",
";",
"}"
] | 对两个ICriterion进行 "逻辑与" 合并
@param c1 Restrictor left
@param c2 Restrictor right
@return Restrictor | [
"对两个ICriterion进行",
"逻辑与",
"合并"
] | train | https://github.com/ineunetOS/knife-commons/blob/eae9e59afa020a00ae8977c10d43ac8ae46ae236/knife-commons-qlmap/src/main/java/com/ineunet/knife/qlmap/criteria/Restrictors.java#L42-L44 |
JodaOrg/joda-time | src/main/java/org/joda/time/LocalDate.java | LocalDate.withField | public LocalDate withField(DateTimeFieldType fieldType, int value) {
if (fieldType == null) {
throw new IllegalArgumentException("Field must not be null");
}
if (isSupported(fieldType) == false) {
throw new IllegalArgumentException("Field '" + fieldType + "' is not supported");
}
long instant = fieldType.getField(getChronology()).set(getLocalMillis(), value);
return withLocalMillis(instant);
} | java | public LocalDate withField(DateTimeFieldType fieldType, int value) {
if (fieldType == null) {
throw new IllegalArgumentException("Field must not be null");
}
if (isSupported(fieldType) == false) {
throw new IllegalArgumentException("Field '" + fieldType + "' is not supported");
}
long instant = fieldType.getField(getChronology()).set(getLocalMillis(), value);
return withLocalMillis(instant);
} | [
"public",
"LocalDate",
"withField",
"(",
"DateTimeFieldType",
"fieldType",
",",
"int",
"value",
")",
"{",
"if",
"(",
"fieldType",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Field must not be null\"",
")",
";",
"}",
"if",
"(",
"... | Returns a copy of this date with the specified field set to a new value.
<p>
For example, if the field type is <code>monthOfYear</code> then the
month of year field will be changed in the returned instance.
If the field type is null, then <code>this</code> is returned.
<p>
These two lines are equivalent:
<pre>
LocalDate updated = dt.withDayOfMonth(6);
LocalDate updated = dt.withField(DateTimeFieldType.dayOfMonth(), 6);
</pre>
@param fieldType the field type to set, not null
@param value the value to set
@return a copy of this date with the field set
@throws IllegalArgumentException if the field is null or unsupported | [
"Returns",
"a",
"copy",
"of",
"this",
"date",
"with",
"the",
"specified",
"field",
"set",
"to",
"a",
"new",
"value",
".",
"<p",
">",
"For",
"example",
"if",
"the",
"field",
"type",
"is",
"<code",
">",
"monthOfYear<",
"/",
"code",
">",
"then",
"the",
... | train | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/LocalDate.java#L1097-L1106 |
googlegenomics/gatk-tools-java | src/main/java/com/google/cloud/genomics/gatk/picard/runner/GA4GHPicardRunner.java | GA4GHPicardRunner.processGA4GHInput | private Input processGA4GHInput(String input) throws IOException, GeneralSecurityException, URISyntaxException {
GA4GHUrl url = new GA4GHUrl(input);
SAMFilePump pump;
if (usingGrpc) {
factoryGrpc.configure(url.getRootUrl(),
new Settings(clientSecretsFilename, apiKey, noLocalServer));
pump = new ReadIteratorToSAMFilePump<
com.google.genomics.v1.Read,
com.google.genomics.v1.ReadGroupSet,
com.google.genomics.v1.Reference>(
factoryGrpc
.get(url.getRootUrl())
.getReads(url));
} else {
factoryRest.configure(url.getRootUrl(),
new Settings(clientSecretsFilename, apiKey, noLocalServer));
pump = new ReadIteratorToSAMFilePump<
com.google.api.services.genomics.model.Read,
com.google.api.services.genomics.model.ReadGroupSet,
com.google.api.services.genomics.model.Reference>(
factoryRest
.get(url.getRootUrl())
.getReads(url));
}
return new Input(input, STDIN_FILE_NAME, pump);
} | java | private Input processGA4GHInput(String input) throws IOException, GeneralSecurityException, URISyntaxException {
GA4GHUrl url = new GA4GHUrl(input);
SAMFilePump pump;
if (usingGrpc) {
factoryGrpc.configure(url.getRootUrl(),
new Settings(clientSecretsFilename, apiKey, noLocalServer));
pump = new ReadIteratorToSAMFilePump<
com.google.genomics.v1.Read,
com.google.genomics.v1.ReadGroupSet,
com.google.genomics.v1.Reference>(
factoryGrpc
.get(url.getRootUrl())
.getReads(url));
} else {
factoryRest.configure(url.getRootUrl(),
new Settings(clientSecretsFilename, apiKey, noLocalServer));
pump = new ReadIteratorToSAMFilePump<
com.google.api.services.genomics.model.Read,
com.google.api.services.genomics.model.ReadGroupSet,
com.google.api.services.genomics.model.Reference>(
factoryRest
.get(url.getRootUrl())
.getReads(url));
}
return new Input(input, STDIN_FILE_NAME, pump);
} | [
"private",
"Input",
"processGA4GHInput",
"(",
"String",
"input",
")",
"throws",
"IOException",
",",
"GeneralSecurityException",
",",
"URISyntaxException",
"{",
"GA4GHUrl",
"url",
"=",
"new",
"GA4GHUrl",
"(",
"input",
")",
";",
"SAMFilePump",
"pump",
";",
"if",
"... | Processes GA4GH based input, creates required API connections and data pump | [
"Processes",
"GA4GH",
"based",
"input",
"creates",
"required",
"API",
"connections",
"and",
"data",
"pump"
] | train | https://github.com/googlegenomics/gatk-tools-java/blob/5521664e8d6274b113962659f2737c27cc361065/src/main/java/com/google/cloud/genomics/gatk/picard/runner/GA4GHPicardRunner.java#L212-L237 |
audit4j/audit4j-core | src/main/java/org/audit4j/core/annotation/DeIdentifyUtil.java | DeIdentifyUtil.deidentifyEdge | public static String deidentifyEdge(String str, int start, int end) {
return deidentifyLeft(deidentifyRight(str, end), start);
} | java | public static String deidentifyEdge(String str, int start, int end) {
return deidentifyLeft(deidentifyRight(str, end), start);
} | [
"public",
"static",
"String",
"deidentifyEdge",
"(",
"String",
"str",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"return",
"deidentifyLeft",
"(",
"deidentifyRight",
"(",
"str",
",",
"end",
")",
",",
"start",
")",
";",
"}"
] | Deidentify edge.
@param str the str
@param start the start
@param end the end
@return the string
@since 2.0.0 | [
"Deidentify",
"edge",
"."
] | train | https://github.com/audit4j/audit4j-core/blob/dc8569108851e64cb0ecc7a39048db0ad070fba2/src/main/java/org/audit4j/core/annotation/DeIdentifyUtil.java#L150-L152 |
jeremybrooks/jinx | src/main/java/net/jeremybrooks/jinx/api/PandaApi.java | PandaApi.getPhotos | public Photos getPhotos(String pandaName, EnumSet<JinxConstants.PhotoExtras> extras, int perPage, int page, boolean sign) throws Exception {
JinxUtils.validateParams(pandaName);
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.panda.getPhotos");
params.put("panda_name", pandaName);
if (!JinxUtils.isNullOrEmpty(extras)) {
params.put("extras", JinxUtils.buildCommaDelimitedList(extras));
}
if (perPage > 0) {
params.put("per_page", Integer.toString(perPage));
}
if (page > 0) {
params.put("page", Integer.toString(page));
}
return jinx.flickrGet(params, Photos.class, sign);
} | java | public Photos getPhotos(String pandaName, EnumSet<JinxConstants.PhotoExtras> extras, int perPage, int page, boolean sign) throws Exception {
JinxUtils.validateParams(pandaName);
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.panda.getPhotos");
params.put("panda_name", pandaName);
if (!JinxUtils.isNullOrEmpty(extras)) {
params.put("extras", JinxUtils.buildCommaDelimitedList(extras));
}
if (perPage > 0) {
params.put("per_page", Integer.toString(perPage));
}
if (page > 0) {
params.put("page", Integer.toString(page));
}
return jinx.flickrGet(params, Photos.class, sign);
} | [
"public",
"Photos",
"getPhotos",
"(",
"String",
"pandaName",
",",
"EnumSet",
"<",
"JinxConstants",
".",
"PhotoExtras",
">",
"extras",
",",
"int",
"perPage",
",",
"int",
"page",
",",
"boolean",
"sign",
")",
"throws",
"Exception",
"{",
"JinxUtils",
".",
"valid... | Ask the Flickr Pandas for a list of recent public (and "safe") photos.
<br>
More information about the pandas can be found on the
<a href="http://code.flickr.com/blog/2009/03/03/panda-tuesday-the-history-of-the-panda-new-apis-explore-and-you/">dev blog</a>. Authentication
<br>
This method does not require authentication.
<br>
You can fetch a list of all the current pandas using the {@link #getList()} API method.
@param pandaName (Required) The name of the panda to ask for photos from.
@param extras extra information to fetch for each returned record.
@param perPage Number of photos to return per page. If this argument is less than 1, it defaults to 100. The maximum allowed value is 500.
@param page The page of results to return. If this argument is less than 1, it defaults to 1.
@param sign if true, the request will be signed.
@return photos object from the panda.
@throws Exception if required parameter is missing, or if there are any errors.
@see <a href="https://www.flickr.com/services/api/flickr.panda.getPhotos.html">flickr.panda.getPhotos</a> | [
"Ask",
"the",
"Flickr",
"Pandas",
"for",
"a",
"list",
"of",
"recent",
"public",
"(",
"and",
"safe",
")",
"photos",
".",
"<br",
">",
"More",
"information",
"about",
"the",
"pandas",
"can",
"be",
"found",
"on",
"the",
"<a",
"href",
"=",
"http",
":",
"/... | train | https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/api/PandaApi.java#L82-L97 |
johncarl81/transfuse | transfuse-support/src/main/java/org/androidtransfuse/util/Contract.java | Contract.notZero | public static void notZero(final Integer input, final String inputName) {
notNull(input, inputName);
if (input == 0) {
throw new IllegalArgumentException("a zero value for was unexpected for " + maskNullArgument(inputName) + ", it is expected to be non zero");
}
} | java | public static void notZero(final Integer input, final String inputName) {
notNull(input, inputName);
if (input == 0) {
throw new IllegalArgumentException("a zero value for was unexpected for " + maskNullArgument(inputName) + ", it is expected to be non zero");
}
} | [
"public",
"static",
"void",
"notZero",
"(",
"final",
"Integer",
"input",
",",
"final",
"String",
"inputName",
")",
"{",
"notNull",
"(",
"input",
",",
"inputName",
")",
";",
"if",
"(",
"input",
"==",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException"... | Checks that the input value is non-zero
@param input the input to check
@param inputName the name of the input
@throws IllegalArgumentException if input is null or if the input is zero | [
"Checks",
"that",
"the",
"input",
"value",
"is",
"non",
"-",
"zero"
] | train | https://github.com/johncarl81/transfuse/blob/a5f837504797a6c4f8628f7e1dde09b8e6368c8b/transfuse-support/src/main/java/org/androidtransfuse/util/Contract.java#L177-L183 |
before/uadetector | modules/uadetector-core/src/main/java/net/sf/uadetector/datastore/CachingXmlDataStore.java | CachingXmlDataStore.createCachingXmlDataStore | @Nonnull
public static CachingXmlDataStore createCachingXmlDataStore(@Nonnull final URL dataUrl, @Nonnull final URL versionURL, @Nonnull final DataStore fallback) {
return createCachingXmlDataStore(findOrCreateCacheFile(), dataUrl, versionURL, DEFAULT_CHARSET,
fallback);
} | java | @Nonnull
public static CachingXmlDataStore createCachingXmlDataStore(@Nonnull final URL dataUrl, @Nonnull final URL versionURL, @Nonnull final DataStore fallback) {
return createCachingXmlDataStore(findOrCreateCacheFile(), dataUrl, versionURL, DEFAULT_CHARSET,
fallback);
} | [
"@",
"Nonnull",
"public",
"static",
"CachingXmlDataStore",
"createCachingXmlDataStore",
"(",
"@",
"Nonnull",
"final",
"URL",
"dataUrl",
",",
"@",
"Nonnull",
"final",
"URL",
"versionURL",
",",
"@",
"Nonnull",
"final",
"DataStore",
"fallback",
")",
"{",
"return",
... | Constructs a new instance of {@code CachingXmlDataStore} with the given arguments. The given {@code cacheFile}
can be empty or filled with previously cached data in XML format. The file must be writable otherwise an
exception will be thrown.
@param dataUrl
URL for online version of <em>UAS data</em>
@param versionURL
URL for version information of online <em>UAS data</em>
@param fallback
<em>UAS data</em> as fallback in case the data on the specified resource can not be read correctly
@return new instance of {@link CachingXmlDataStore}
@throws net.sf.qualitycheck.exception.IllegalNullArgumentException
if one of the given arguments is {@code null}
@throws net.sf.qualitycheck.exception.IllegalStateOfArgumentException
if the given cache file can not be read
@throws net.sf.qualitycheck.exception.IllegalStateOfArgumentException
if no URL can be resolved to the given given file | [
"Constructs",
"a",
"new",
"instance",
"of",
"{",
"@code",
"CachingXmlDataStore",
"}",
"with",
"the",
"given",
"arguments",
".",
"The",
"given",
"{",
"@code",
"cacheFile",
"}",
"can",
"be",
"empty",
"or",
"filled",
"with",
"previously",
"cached",
"data",
"in"... | train | https://github.com/before/uadetector/blob/215fb652723c52866572cff885f52a3fe67b9db5/modules/uadetector-core/src/main/java/net/sf/uadetector/datastore/CachingXmlDataStore.java#L115-L119 |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPUtils.java | JBBPUtils.assertNotNull | public static void assertNotNull(final Object object, final String message) {
if (object == null) {
throw new NullPointerException(message == null ? "Object is null" : message);
}
} | java | public static void assertNotNull(final Object object, final String message) {
if (object == null) {
throw new NullPointerException(message == null ? "Object is null" : message);
}
} | [
"public",
"static",
"void",
"assertNotNull",
"(",
"final",
"Object",
"object",
",",
"final",
"String",
"message",
")",
"{",
"if",
"(",
"object",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"message",
"==",
"null",
"?",
"\"Object is n... | Check that an object is null and throw NullPointerException in the case.
@param object an object to be checked
@param message message to be used as the exception message
@throws NullPointerException it will be thrown if the object is null | [
"Check",
"that",
"an",
"object",
"is",
"null",
"and",
"throw",
"NullPointerException",
"in",
"the",
"case",
"."
] | train | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPUtils.java#L478-L482 |
cdapio/tigon | tigon-api/src/main/java/co/cask/tigon/internal/io/SchemaTypeAdapter.java | SchemaTypeAdapter.readArray | private Schema readArray(JsonReader reader, Set<String> knownRecords) throws IOException {
return Schema.arrayOf(readInnerSchema(reader, "items", knownRecords));
} | java | private Schema readArray(JsonReader reader, Set<String> knownRecords) throws IOException {
return Schema.arrayOf(readInnerSchema(reader, "items", knownRecords));
} | [
"private",
"Schema",
"readArray",
"(",
"JsonReader",
"reader",
",",
"Set",
"<",
"String",
">",
"knownRecords",
")",
"throws",
"IOException",
"{",
"return",
"Schema",
".",
"arrayOf",
"(",
"readInnerSchema",
"(",
"reader",
",",
"\"items\"",
",",
"knownRecords",
... | Constructs {@link Schema.Type#ARRAY ARRAY} type schema from the json input.
@param reader The {@link JsonReader} for streaming json input tokens.
@param knownRecords Set of record name already encountered during the reading.
@return A {@link Schema} of type {@link Schema.Type#ARRAY ARRAY}.
@throws java.io.IOException When fails to construct a valid schema from the input. | [
"Constructs",
"{",
"@link",
"Schema",
".",
"Type#ARRAY",
"ARRAY",
"}",
"type",
"schema",
"from",
"the",
"json",
"input",
"."
] | train | https://github.com/cdapio/tigon/blob/5be6dffd7c79519d1211bb08f75be7dcfbbad392/tigon-api/src/main/java/co/cask/tigon/internal/io/SchemaTypeAdapter.java#L165-L167 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/text/StrBuilder.java | StrBuilder.lastIndexOf | public int lastIndexOf(final StrMatcher matcher, int startIndex) {
startIndex = (startIndex >= size ? size - 1 : startIndex);
if (matcher == null || startIndex < 0) {
return -1;
}
final char[] buf = buffer;
final int endIndex = startIndex + 1;
for (int i = startIndex; i >= 0; i--) {
if (matcher.isMatch(buf, i, 0, endIndex) > 0) {
return i;
}
}
return -1;
} | java | public int lastIndexOf(final StrMatcher matcher, int startIndex) {
startIndex = (startIndex >= size ? size - 1 : startIndex);
if (matcher == null || startIndex < 0) {
return -1;
}
final char[] buf = buffer;
final int endIndex = startIndex + 1;
for (int i = startIndex; i >= 0; i--) {
if (matcher.isMatch(buf, i, 0, endIndex) > 0) {
return i;
}
}
return -1;
} | [
"public",
"int",
"lastIndexOf",
"(",
"final",
"StrMatcher",
"matcher",
",",
"int",
"startIndex",
")",
"{",
"startIndex",
"=",
"(",
"startIndex",
">=",
"size",
"?",
"size",
"-",
"1",
":",
"startIndex",
")",
";",
"if",
"(",
"matcher",
"==",
"null",
"||",
... | Searches the string builder using the matcher to find the last
match searching from the given index.
<p>
Matchers can be used to perform advanced searching behaviour.
For example you could write a matcher to find the character 'a'
followed by a number.
@param matcher the matcher to use, null returns -1
@param startIndex the index to start at, invalid index rounded to edge
@return the last index matched, or -1 if not found | [
"Searches",
"the",
"string",
"builder",
"using",
"the",
"matcher",
"to",
"find",
"the",
"last",
"match",
"searching",
"from",
"the",
"given",
"index",
".",
"<p",
">",
"Matchers",
"can",
"be",
"used",
"to",
"perform",
"advanced",
"searching",
"behaviour",
"."... | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/text/StrBuilder.java#L2629-L2642 |
jbundle/jbundle | thin/base/remote/src/main/java/org/jbundle/thin/base/remote/proxy/BaseSessionProxy.java | BaseSessionProxy.doRemoteAction | public Object doRemoteAction(String strCommand, Map<String, Object> properties) throws DBException, RemoteException
{
BaseTransport transport = this.createProxyTransport(DO_REMOTE_ACTION);
transport.addParam(NAME, strCommand); // Don't use COMMAND
transport.addParam(PROPERTIES, properties);
Object strReturn = transport.sendMessageAndGetReply();
if (strReturn instanceof String)
{ // Could be returning a session
BaseSessionProxy session = this.checkForSession((String)strReturn);
if (session != null)
return session;
}
Object objReturn = transport.convertReturnObject(strReturn);
return this.checkDBException(objReturn);
} | java | public Object doRemoteAction(String strCommand, Map<String, Object> properties) throws DBException, RemoteException
{
BaseTransport transport = this.createProxyTransport(DO_REMOTE_ACTION);
transport.addParam(NAME, strCommand); // Don't use COMMAND
transport.addParam(PROPERTIES, properties);
Object strReturn = transport.sendMessageAndGetReply();
if (strReturn instanceof String)
{ // Could be returning a session
BaseSessionProxy session = this.checkForSession((String)strReturn);
if (session != null)
return session;
}
Object objReturn = transport.convertReturnObject(strReturn);
return this.checkDBException(objReturn);
} | [
"public",
"Object",
"doRemoteAction",
"(",
"String",
"strCommand",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
")",
"throws",
"DBException",
",",
"RemoteException",
"{",
"BaseTransport",
"transport",
"=",
"this",
".",
"createProxyTransport",
"(",
... | Do a remote action.
@param strCommand Command to perform remotely.
@return boolean success. | [
"Do",
"a",
"remote",
"action",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/remote/src/main/java/org/jbundle/thin/base/remote/proxy/BaseSessionProxy.java#L82-L96 |
inloop/easygcm | easygcm-lib/src/main/java/eu/inloop/easygcm/EasyGcm.java | EasyGcm.storeRegistrationId | private static void storeRegistrationId(Context context, String regId) {
final int appVersion = GcmUtils.getAppVersion(context);
Logger.d("Saving regId on app version " + appVersion);
final SharedPreferences.Editor editor = getGcmPreferences(context).edit();
editor.putString(PROPERTY_REG_ID, regId);
editor.putInt(PROPERTY_APP_VERSION, appVersion);
editor.apply();
} | java | private static void storeRegistrationId(Context context, String regId) {
final int appVersion = GcmUtils.getAppVersion(context);
Logger.d("Saving regId on app version " + appVersion);
final SharedPreferences.Editor editor = getGcmPreferences(context).edit();
editor.putString(PROPERTY_REG_ID, regId);
editor.putInt(PROPERTY_APP_VERSION, appVersion);
editor.apply();
} | [
"private",
"static",
"void",
"storeRegistrationId",
"(",
"Context",
"context",
",",
"String",
"regId",
")",
"{",
"final",
"int",
"appVersion",
"=",
"GcmUtils",
".",
"getAppVersion",
"(",
"context",
")",
";",
"Logger",
".",
"d",
"(",
"\"Saving regId on app versio... | Stores the registration ID and the app versionCode in the application's
{@code SharedPreferences}.
@param context application's context.
@param regId registration ID | [
"Stores",
"the",
"registration",
"ID",
"and",
"the",
"app",
"versionCode",
"in",
"the",
"application",
"s",
"{",
"@code",
"SharedPreferences",
"}",
"."
] | train | https://github.com/inloop/easygcm/blob/d06bbff11e52b956c3a7b1a2dc4f9799f20cf2c6/easygcm-lib/src/main/java/eu/inloop/easygcm/EasyGcm.java#L89-L97 |
nohana/Amalgam | amalgam/src/main/java/com/amalgam/os/BundleUtils.java | BundleUtils.optBinder | @Nullable
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
public static IBinder optBinder(@Nullable Bundle bundle, @Nullable String key) {
return optBinder(bundle, key, null);
} | java | @Nullable
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
public static IBinder optBinder(@Nullable Bundle bundle, @Nullable String key) {
return optBinder(bundle, key, null);
} | [
"@",
"Nullable",
"@",
"TargetApi",
"(",
"Build",
".",
"VERSION_CODES",
".",
"JELLY_BEAN_MR2",
")",
"public",
"static",
"IBinder",
"optBinder",
"(",
"@",
"Nullable",
"Bundle",
"bundle",
",",
"@",
"Nullable",
"String",
"key",
")",
"{",
"return",
"optBinder",
"... | Returns a optional {@link android.os.IBinder} value. In other words, returns the value mapped by key if it exists and is a {@link android.os.IBinder}.
The bundle argument is allowed to be {@code null}. If the bundle is null, this method returns null.
@param bundle a bundle. If the bundle is null, this method will return null.
@param key a key for the value.
@return a {@link android.os.IBinder} value if exists, null otherwise.
@see android.os.Bundle#getBinder(String) | [
"Returns",
"a",
"optional",
"{"
] | train | https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/os/BundleUtils.java#L93-L97 |
google/j2objc | translator/src/main/java/com/google/devtools/j2objc/javac/JavacParser.java | JavacParser.filterJavaFileObject | private static JavaFileObject filterJavaFileObject(JavaFileObject fobj) {
String path = fobj.getName();
if (path.endsWith("module-info.java")) {
String pkgName = null;
try {
pkgName = moduleName(fobj.getCharContent(true).toString());
String source = "package " + pkgName + ";";
return new MemoryFileObject(path, JavaFileObject.Kind.SOURCE, source);
} catch (IOException e) {
// Fall-through
}
}
return fobj;
} | java | private static JavaFileObject filterJavaFileObject(JavaFileObject fobj) {
String path = fobj.getName();
if (path.endsWith("module-info.java")) {
String pkgName = null;
try {
pkgName = moduleName(fobj.getCharContent(true).toString());
String source = "package " + pkgName + ";";
return new MemoryFileObject(path, JavaFileObject.Kind.SOURCE, source);
} catch (IOException e) {
// Fall-through
}
}
return fobj;
} | [
"private",
"static",
"JavaFileObject",
"filterJavaFileObject",
"(",
"JavaFileObject",
"fobj",
")",
"{",
"String",
"path",
"=",
"fobj",
".",
"getName",
"(",
")",
";",
"if",
"(",
"path",
".",
"endsWith",
"(",
"\"module-info.java\"",
")",
")",
"{",
"String",
"p... | To allow Java 9 libraries like GSON to be transpiled using -source 1.8, stub out
the module-info source. This creates an empty .o file, like package-info.java
files without annotations. Skipping the file isn't feasible because of build tool
output file expectations. | [
"To",
"allow",
"Java",
"9",
"libraries",
"like",
"GSON",
"to",
"be",
"transpiled",
"using",
"-",
"source",
"1",
".",
"8",
"stub",
"out",
"the",
"module",
"-",
"info",
"source",
".",
"This",
"creates",
"an",
"empty",
".",
"o",
"file",
"like",
"package",... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/javac/JavacParser.java#L220-L233 |
gfk-ba/senbot | SenBotRunner/src/main/java/com/gfk/senbot/framework/services/selenium/FormService.java | FormService.fillFormField_locator | public WebElement fillFormField_locator(String locator, String value) {
WebElement fieldEl = seleniumElementService.translateLocatorToWebElement(locator);
fieldEl.clear();
fieldEl.sendKeys(getReferenceService().namespaceString(value));
return fieldEl;
} | java | public WebElement fillFormField_locator(String locator, String value) {
WebElement fieldEl = seleniumElementService.translateLocatorToWebElement(locator);
fieldEl.clear();
fieldEl.sendKeys(getReferenceService().namespaceString(value));
return fieldEl;
} | [
"public",
"WebElement",
"fillFormField_locator",
"(",
"String",
"locator",
",",
"String",
"value",
")",
"{",
"WebElement",
"fieldEl",
"=",
"seleniumElementService",
".",
"translateLocatorToWebElement",
"(",
"locator",
")",
";",
"fieldEl",
".",
"clear",
"(",
")",
"... | Fill out a form field with the passed value
@param locator as specified in {@link ElementService#translateLocatorToWebElement(String)}
@param value the value to fill the field with
@return the {@link WebElement} representing the form field | [
"Fill",
"out",
"a",
"form",
"field",
"with",
"the",
"passed",
"value"
] | train | https://github.com/gfk-ba/senbot/blob/e9a152aa67be48b1bb13a4691655caf6d873b553/SenBotRunner/src/main/java/com/gfk/senbot/framework/services/selenium/FormService.java#L32-L37 |
jlinn/quartz-redis-jobstore | src/main/java/net/joelinn/quartz/jobstore/AbstractRedisStorage.java | AbstractRedisStorage.settLastTriggerReleaseTime | protected void settLastTriggerReleaseTime(long time, T jedis){
jedis.set(redisSchema.lastTriggerReleaseTime(), Long.toString(time));
} | java | protected void settLastTriggerReleaseTime(long time, T jedis){
jedis.set(redisSchema.lastTriggerReleaseTime(), Long.toString(time));
} | [
"protected",
"void",
"settLastTriggerReleaseTime",
"(",
"long",
"time",
",",
"T",
"jedis",
")",
"{",
"jedis",
".",
"set",
"(",
"redisSchema",
".",
"lastTriggerReleaseTime",
"(",
")",
",",
"Long",
".",
"toString",
"(",
"time",
")",
")",
";",
"}"
] | Set the last time at which orphaned triggers were released
@param time a unix timestamp in milliseconds
@param jedis a thread-safe Redis connection | [
"Set",
"the",
"last",
"time",
"at",
"which",
"orphaned",
"triggers",
"were",
"released"
] | train | https://github.com/jlinn/quartz-redis-jobstore/blob/be9a52ee776d8a09866fe99fd9718bc13a0cb992/src/main/java/net/joelinn/quartz/jobstore/AbstractRedisStorage.java#L726-L728 |
UrielCh/ovh-java-sdk | ovh-java-sdk-emailpro/src/main/java/net/minidev/ovh/api/ApiOvhEmailpro.java | ApiOvhEmailpro.service_domain_domainName_disclaimer_PUT | public void service_domain_domainName_disclaimer_PUT(String service, String domainName, OvhDisclaimer body) throws IOException {
String qPath = "/email/pro/{service}/domain/{domainName}/disclaimer";
StringBuilder sb = path(qPath, service, domainName);
exec(qPath, "PUT", sb.toString(), body);
} | java | public void service_domain_domainName_disclaimer_PUT(String service, String domainName, OvhDisclaimer body) throws IOException {
String qPath = "/email/pro/{service}/domain/{domainName}/disclaimer";
StringBuilder sb = path(qPath, service, domainName);
exec(qPath, "PUT", sb.toString(), body);
} | [
"public",
"void",
"service_domain_domainName_disclaimer_PUT",
"(",
"String",
"service",
",",
"String",
"domainName",
",",
"OvhDisclaimer",
"body",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/email/pro/{service}/domain/{domainName}/disclaimer\"",
";",
"Str... | Alter this object properties
REST: PUT /email/pro/{service}/domain/{domainName}/disclaimer
@param body [required] New object properties
@param service [required] The internal name of your pro organization
@param domainName [required] Domain name
API beta | [
"Alter",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emailpro/src/main/java/net/minidev/ovh/api/ApiOvhEmailpro.java#L788-L792 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/ba/deref/UnconditionalValueDerefAnalysis.java | UnconditionalValueDerefAnalysis.checkUnconditionalDerefDatabase | private void checkUnconditionalDerefDatabase(Location location, ValueNumberFrame vnaFrame, UnconditionalValueDerefSet fact)
throws DataflowAnalysisException {
ConstantPoolGen constantPool = methodGen.getConstantPool();
for (ValueNumber vn : checkUnconditionalDerefDatabase(location, vnaFrame, constantPool,
invDataflow.getFactAtLocation(location), typeDataflow)) {
fact.addDeref(vn, location);
}
} | java | private void checkUnconditionalDerefDatabase(Location location, ValueNumberFrame vnaFrame, UnconditionalValueDerefSet fact)
throws DataflowAnalysisException {
ConstantPoolGen constantPool = methodGen.getConstantPool();
for (ValueNumber vn : checkUnconditionalDerefDatabase(location, vnaFrame, constantPool,
invDataflow.getFactAtLocation(location), typeDataflow)) {
fact.addDeref(vn, location);
}
} | [
"private",
"void",
"checkUnconditionalDerefDatabase",
"(",
"Location",
"location",
",",
"ValueNumberFrame",
"vnaFrame",
",",
"UnconditionalValueDerefSet",
"fact",
")",
"throws",
"DataflowAnalysisException",
"{",
"ConstantPoolGen",
"constantPool",
"=",
"methodGen",
".",
"get... | Check method call at given location to see if it unconditionally
dereferences a parameter. Mark any such arguments as derefs.
@param location
the Location of the method call
@param vnaFrame
ValueNumberFrame at the Location
@param fact
the dataflow value to modify
@throws DataflowAnalysisException | [
"Check",
"method",
"call",
"at",
"given",
"location",
"to",
"see",
"if",
"it",
"unconditionally",
"dereferences",
"a",
"parameter",
".",
"Mark",
"any",
"such",
"arguments",
"as",
"derefs",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/deref/UnconditionalValueDerefAnalysis.java#L319-L327 |
elki-project/elki | elki-data-generator/src/main/java/de/lmu/ifi/dbs/elki/datasource/GeneratorXMLDatabaseConnection.java | GeneratorXMLDatabaseConnection.processElementPoint | private void processElementPoint(List<double[]> points, Node cur) {
double[] point = null;
String vstr = ((Element) cur).getAttribute(ATTR_VECTOR);
if(vstr != null && vstr.length() > 0) {
point = parseVector(vstr);
}
if(point == null) {
throw new AbortException("No translation vector given.");
}
// *** add new point
points.add(point);
// TODO: check for unknown attributes.
XMLNodeIterator iter = new XMLNodeIterator(cur.getFirstChild());
while(iter.hasNext()) {
Node child = iter.next();
if(child.getNodeType() == Node.ELEMENT_NODE) {
LOG.warning("Unknown element in XML specification file: " + child.getNodeName());
}
}
} | java | private void processElementPoint(List<double[]> points, Node cur) {
double[] point = null;
String vstr = ((Element) cur).getAttribute(ATTR_VECTOR);
if(vstr != null && vstr.length() > 0) {
point = parseVector(vstr);
}
if(point == null) {
throw new AbortException("No translation vector given.");
}
// *** add new point
points.add(point);
// TODO: check for unknown attributes.
XMLNodeIterator iter = new XMLNodeIterator(cur.getFirstChild());
while(iter.hasNext()) {
Node child = iter.next();
if(child.getNodeType() == Node.ELEMENT_NODE) {
LOG.warning("Unknown element in XML specification file: " + child.getNodeName());
}
}
} | [
"private",
"void",
"processElementPoint",
"(",
"List",
"<",
"double",
"[",
"]",
">",
"points",
",",
"Node",
"cur",
")",
"{",
"double",
"[",
"]",
"point",
"=",
"null",
";",
"String",
"vstr",
"=",
"(",
"(",
"Element",
")",
"cur",
")",
".",
"getAttribut... | Parse a 'point' element (point vector for a static cluster)
@param points current list of points (to append to)
@param cur Current document nod | [
"Parse",
"a",
"point",
"element",
"(",
"point",
"vector",
"for",
"a",
"static",
"cluster",
")"
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-data-generator/src/main/java/de/lmu/ifi/dbs/elki/datasource/GeneratorXMLDatabaseConnection.java#L668-L689 |
grails/grails-core | buildSrc/src/main/groovy/JavadocFixTool.java | JavadocFixTool.replaceStringInFile | public void replaceStringInFile(File folder, File file, String template, String[] replacement)
throws IOException {
System.out.println("Patching file: "+file.getCanonicalPath());
String name = file.getName();
File origFile = new File(folder, name+".orig");
file.renameTo(origFile);
File temporaryFile = new File(folder, name+".tmp");
if (temporaryFile.exists()) {
temporaryFile.delete();
}
temporaryFile.createNewFile();
String line;
FileInputStream fis = new FileInputStream(origFile);
PrintWriter pw = new PrintWriter(temporaryFile);
BufferedReader br = new BufferedReader(new InputStreamReader(fis));
while ((line = br.readLine()) != null) {
if (line.trim().equals(template)) {
for (String s : replacement) {
pw.println(s);
}
} else {
pw.println(line);
}
}
pw.flush();
pw.close();
if (!temporaryFile.renameTo(new File(folder, name))) {
throw new IOException("Unable to rename file in folder "+folder.getName()+
" from \""+temporaryFile.getName()+"\" into \""+name +
"\n Original file saved as "+origFile.getName());
}
origFile.delete();
} | java | public void replaceStringInFile(File folder, File file, String template, String[] replacement)
throws IOException {
System.out.println("Patching file: "+file.getCanonicalPath());
String name = file.getName();
File origFile = new File(folder, name+".orig");
file.renameTo(origFile);
File temporaryFile = new File(folder, name+".tmp");
if (temporaryFile.exists()) {
temporaryFile.delete();
}
temporaryFile.createNewFile();
String line;
FileInputStream fis = new FileInputStream(origFile);
PrintWriter pw = new PrintWriter(temporaryFile);
BufferedReader br = new BufferedReader(new InputStreamReader(fis));
while ((line = br.readLine()) != null) {
if (line.trim().equals(template)) {
for (String s : replacement) {
pw.println(s);
}
} else {
pw.println(line);
}
}
pw.flush();
pw.close();
if (!temporaryFile.renameTo(new File(folder, name))) {
throw new IOException("Unable to rename file in folder "+folder.getName()+
" from \""+temporaryFile.getName()+"\" into \""+name +
"\n Original file saved as "+origFile.getName());
}
origFile.delete();
} | [
"public",
"void",
"replaceStringInFile",
"(",
"File",
"folder",
",",
"File",
"file",
",",
"String",
"template",
",",
"String",
"[",
"]",
"replacement",
")",
"throws",
"IOException",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"Patching file: \"",
"+",
... | /*
Replace one line in the given file in the given folder with the lines given
@param folder Folder in which file should be created
@param file Original file to patch
@param template Trimmed String with the pattern we are have to find
@param replacement Array of String that has to be written in the place of first line matching the template | [
"/",
"*",
"Replace",
"one",
"line",
"in",
"the",
"given",
"file",
"in",
"the",
"given",
"folder",
"with",
"the",
"lines",
"given"
] | train | https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/buildSrc/src/main/groovy/JavadocFixTool.java#L317-L349 |
Javacord/Javacord | javacord-api/src/main/java/org/javacord/api/entity/server/ServerUpdater.java | ServerUpdater.setIcon | public ServerUpdater setIcon(InputStream icon, String fileType) {
delegate.setIcon(icon, fileType);
return this;
} | java | public ServerUpdater setIcon(InputStream icon, String fileType) {
delegate.setIcon(icon, fileType);
return this;
} | [
"public",
"ServerUpdater",
"setIcon",
"(",
"InputStream",
"icon",
",",
"String",
"fileType",
")",
"{",
"delegate",
".",
"setIcon",
"(",
"icon",
",",
"fileType",
")",
";",
"return",
"this",
";",
"}"
] | Queues the icon to be updated.
@param icon The new icon of the server.
@param fileType The type of the icon, e.g. "png" or "jpg".
@return The current instance in order to chain call methods. | [
"Queues",
"the",
"icon",
"to",
"be",
"updated",
"."
] | train | https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-api/src/main/java/org/javacord/api/entity/server/ServerUpdater.java#L238-L241 |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/ssl/jdbc4/LibPQFactory.java | LibPQFactory.verifyHostName | @Deprecated
public static boolean verifyHostName(String hostname, String pattern) {
String canonicalHostname;
if (hostname.startsWith("[") && hostname.endsWith("]")) {
// IPv6 address like [2001:db8:0:1:1:1:1:1]
canonicalHostname = hostname.substring(1, hostname.length() - 1);
} else {
// This converts unicode domain name to ASCII
try {
canonicalHostname = IDN.toASCII(hostname);
} catch (IllegalArgumentException e) {
// e.g. hostname is invalid
return false;
}
}
return PGjdbcHostnameVerifier.INSTANCE.verifyHostName(canonicalHostname, pattern);
} | java | @Deprecated
public static boolean verifyHostName(String hostname, String pattern) {
String canonicalHostname;
if (hostname.startsWith("[") && hostname.endsWith("]")) {
// IPv6 address like [2001:db8:0:1:1:1:1:1]
canonicalHostname = hostname.substring(1, hostname.length() - 1);
} else {
// This converts unicode domain name to ASCII
try {
canonicalHostname = IDN.toASCII(hostname);
} catch (IllegalArgumentException e) {
// e.g. hostname is invalid
return false;
}
}
return PGjdbcHostnameVerifier.INSTANCE.verifyHostName(canonicalHostname, pattern);
} | [
"@",
"Deprecated",
"public",
"static",
"boolean",
"verifyHostName",
"(",
"String",
"hostname",
",",
"String",
"pattern",
")",
"{",
"String",
"canonicalHostname",
";",
"if",
"(",
"hostname",
".",
"startsWith",
"(",
"\"[\"",
")",
"&&",
"hostname",
".",
"endsWith... | Verifies if given hostname matches pattern.
@deprecated use {@link PGjdbcHostnameVerifier}
@param hostname input hostname
@param pattern domain name pattern
@return true when domain matches pattern | [
"Verifies",
"if",
"given",
"hostname",
"matches",
"pattern",
"."
] | train | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/ssl/jdbc4/LibPQFactory.java#L45-L61 |
baratine/baratine | framework/src/main/java/com/caucho/v5/vfs/VfsOld.java | VfsOld.lookup | public static PathImpl lookup(String url, Map<String,Object> attr)
{
return getPwd().lookup(url, attr);
} | java | public static PathImpl lookup(String url, Map<String,Object> attr)
{
return getPwd().lookup(url, attr);
} | [
"public",
"static",
"PathImpl",
"lookup",
"(",
"String",
"url",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"attr",
")",
"{",
"return",
"getPwd",
"(",
")",
".",
"lookup",
"(",
"url",
",",
"attr",
")",
";",
"}"
] | Returns a new path, including attributes.
<p>For example, an application may want to set locale headers
for an HTTP request.
@param url the relative url
@param attr attributes used in searching for the url | [
"Returns",
"a",
"new",
"path",
"including",
"attributes",
".",
"<p",
">",
"For",
"example",
"an",
"application",
"may",
"want",
"to",
"set",
"locale",
"headers",
"for",
"an",
"HTTP",
"request",
"."
] | train | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/vfs/VfsOld.java#L191-L194 |
stackify/stackify-api-java | src/main/java/com/stackify/api/common/lang/Throwables.java | Throwables.toErrorItemBuilderWithoutCause | private static ErrorItem.Builder toErrorItemBuilderWithoutCause(final String logMessage, final Throwable t) {
ErrorItem.Builder builder = ErrorItem.newBuilder();
builder.message(toErrorItemMessage(logMessage, t.getMessage()));
builder.errorType(t.getClass().getCanonicalName());
List<TraceFrame> stackFrames = new ArrayList<TraceFrame>();
StackTraceElement[] stackTrace = t.getStackTrace();
if ((stackTrace != null) && (0 < stackTrace.length)) {
StackTraceElement firstFrame = stackTrace[0];
builder.sourceMethod(firstFrame.getClassName() + "." + firstFrame.getMethodName());
for (int i = 0; i < stackTrace.length; ++i) {
TraceFrame stackFrame = StackTraceElements.toTraceFrame(stackTrace[i]);
stackFrames.add(stackFrame);
}
}
builder.stackTrace(stackFrames);
return builder;
} | java | private static ErrorItem.Builder toErrorItemBuilderWithoutCause(final String logMessage, final Throwable t) {
ErrorItem.Builder builder = ErrorItem.newBuilder();
builder.message(toErrorItemMessage(logMessage, t.getMessage()));
builder.errorType(t.getClass().getCanonicalName());
List<TraceFrame> stackFrames = new ArrayList<TraceFrame>();
StackTraceElement[] stackTrace = t.getStackTrace();
if ((stackTrace != null) && (0 < stackTrace.length)) {
StackTraceElement firstFrame = stackTrace[0];
builder.sourceMethod(firstFrame.getClassName() + "." + firstFrame.getMethodName());
for (int i = 0; i < stackTrace.length; ++i) {
TraceFrame stackFrame = StackTraceElements.toTraceFrame(stackTrace[i]);
stackFrames.add(stackFrame);
}
}
builder.stackTrace(stackFrames);
return builder;
} | [
"private",
"static",
"ErrorItem",
".",
"Builder",
"toErrorItemBuilderWithoutCause",
"(",
"final",
"String",
"logMessage",
",",
"final",
"Throwable",
"t",
")",
"{",
"ErrorItem",
".",
"Builder",
"builder",
"=",
"ErrorItem",
".",
"newBuilder",
"(",
")",
";",
"build... | Converts a Throwable to an ErrorItem.Builder and ignores the cause
@param logMessage The log message
@param t The Throwable to be converted
@return The ErrorItem.Builder without the innerError populated | [
"Converts",
"a",
"Throwable",
"to",
"an",
"ErrorItem",
".",
"Builder",
"and",
"ignores",
"the",
"cause"
] | train | https://github.com/stackify/stackify-api-java/blob/d3000b7c87ed53a88b302939b0c88405d63d7b67/src/main/java/com/stackify/api/common/lang/Throwables.java#L109-L131 |
js-lib-com/commons | src/main/java/js/util/Strings.java | Strings.save | public static void save(CharSequence chars, Writer writer) throws IOException
{
if(chars != null) {
StringReader reader = new StringReader(chars.toString());
Files.copy(reader, writer);
}
} | java | public static void save(CharSequence chars, Writer writer) throws IOException
{
if(chars != null) {
StringReader reader = new StringReader(chars.toString());
Files.copy(reader, writer);
}
} | [
"public",
"static",
"void",
"save",
"(",
"CharSequence",
"chars",
",",
"Writer",
"writer",
")",
"throws",
"IOException",
"{",
"if",
"(",
"chars",
"!=",
"null",
")",
"{",
"StringReader",
"reader",
"=",
"new",
"StringReader",
"(",
"chars",
".",
"toString",
"... | Copy source characters to requested output characters stream. If given <code>chars</code> parameter is null or
empty this method does nothing.
@param chars source characters stream,
@param writer target writer.
@throws IOException if copy operation fails. | [
"Copy",
"source",
"characters",
"to",
"requested",
"output",
"characters",
"stream",
".",
"If",
"given",
"<code",
">",
"chars<",
"/",
"code",
">",
"parameter",
"is",
"null",
"or",
"empty",
"this",
"method",
"does",
"nothing",
"."
] | train | https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Strings.java#L1509-L1515 |
btrplace/scheduler | choco/src/main/java/org/btrplace/scheduler/choco/transition/TransitionFactory.java | TransitionFactory.getBuilder | public VMTransitionBuilder getBuilder(VMState srcState, VMState dstState) {
Map<VMState, VMTransitionBuilder> dstCompliant = vmAMB2.get(dstState);
if (dstCompliant == null) {
return null;
}
return dstCompliant.get(srcState);
} | java | public VMTransitionBuilder getBuilder(VMState srcState, VMState dstState) {
Map<VMState, VMTransitionBuilder> dstCompliant = vmAMB2.get(dstState);
if (dstCompliant == null) {
return null;
}
return dstCompliant.get(srcState);
} | [
"public",
"VMTransitionBuilder",
"getBuilder",
"(",
"VMState",
"srcState",
",",
"VMState",
"dstState",
")",
"{",
"Map",
"<",
"VMState",
",",
"VMTransitionBuilder",
">",
"dstCompliant",
"=",
"vmAMB2",
".",
"get",
"(",
"dstState",
")",
";",
"if",
"(",
"dstCompli... | Get the model builder for a given transition
@param srcState the current VM state
@param dstState the current VM state
@return the list of possible transitions. {@code null} if no transition is available | [
"Get",
"the",
"model",
"builder",
"for",
"a",
"given",
"transition"
] | train | https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/choco/src/main/java/org/btrplace/scheduler/choco/transition/TransitionFactory.java#L108-L114 |
biojava/biojava | biojava-core/src/main/java/org/biojava/nbio/core/sequence/CDSComparator.java | CDSComparator.compare | @Override
public int compare(CDSSequence o1, CDSSequence o2) {
if(o1.getStrand() != o2.getStrand()){
return o1.getBioBegin() - o2.getBioBegin();
}
if(o1.getStrand() == Strand.NEGATIVE){
return -1 * (o1.getBioBegin() - o2.getBioBegin());
}
return o1.getBioBegin() - o2.getBioBegin();
} | java | @Override
public int compare(CDSSequence o1, CDSSequence o2) {
if(o1.getStrand() != o2.getStrand()){
return o1.getBioBegin() - o2.getBioBegin();
}
if(o1.getStrand() == Strand.NEGATIVE){
return -1 * (o1.getBioBegin() - o2.getBioBegin());
}
return o1.getBioBegin() - o2.getBioBegin();
} | [
"@",
"Override",
"public",
"int",
"compare",
"(",
"CDSSequence",
"o1",
",",
"CDSSequence",
"o2",
")",
"{",
"if",
"(",
"o1",
".",
"getStrand",
"(",
")",
"!=",
"o2",
".",
"getStrand",
"(",
")",
")",
"{",
"return",
"o1",
".",
"getBioBegin",
"(",
")",
... | Used to sort two CDSSequences where Negative Strand makes it tough
@param o1
@param o2
@return val | [
"Used",
"to",
"sort",
"two",
"CDSSequences",
"where",
"Negative",
"Strand",
"makes",
"it",
"tough"
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/CDSComparator.java#L40-L50 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/codec/CCITTG4Encoder.java | CCITTG4Encoder.fax4Encode | public void fax4Encode(byte[] data, int offset, int size) {
dataBp = data;
offsetData = offset;
sizeData = size;
while (sizeData > 0) {
Fax3Encode2DRow();
System.arraycopy(dataBp, offsetData, refline, 0, rowbytes);
offsetData += rowbytes;
sizeData -= rowbytes;
}
} | java | public void fax4Encode(byte[] data, int offset, int size) {
dataBp = data;
offsetData = offset;
sizeData = size;
while (sizeData > 0) {
Fax3Encode2DRow();
System.arraycopy(dataBp, offsetData, refline, 0, rowbytes);
offsetData += rowbytes;
sizeData -= rowbytes;
}
} | [
"public",
"void",
"fax4Encode",
"(",
"byte",
"[",
"]",
"data",
",",
"int",
"offset",
",",
"int",
"size",
")",
"{",
"dataBp",
"=",
"data",
";",
"offsetData",
"=",
"offset",
";",
"sizeData",
"=",
"size",
";",
"while",
"(",
"sizeData",
">",
"0",
")",
... | Encodes a number of lines.
@param data the data to be encoded
@param offset the offset into the data
@param size the size of the data to be encoded | [
"Encodes",
"a",
"number",
"of",
"lines",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/codec/CCITTG4Encoder.java#L83-L93 |
google/flatbuffers | java/com/google/flatbuffers/Utf8Safe.java | Utf8Safe.decodeUtf8 | @Override
public String decodeUtf8(ByteBuffer buffer, int offset, int length)
throws IllegalArgumentException {
if (buffer.hasArray()) {
return decodeUtf8Array(buffer.array(), buffer.arrayOffset() + offset, length);
} else {
return decodeUtf8Buffer(buffer, offset, length);
}
} | java | @Override
public String decodeUtf8(ByteBuffer buffer, int offset, int length)
throws IllegalArgumentException {
if (buffer.hasArray()) {
return decodeUtf8Array(buffer.array(), buffer.arrayOffset() + offset, length);
} else {
return decodeUtf8Buffer(buffer, offset, length);
}
} | [
"@",
"Override",
"public",
"String",
"decodeUtf8",
"(",
"ByteBuffer",
"buffer",
",",
"int",
"offset",
",",
"int",
"length",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"buffer",
".",
"hasArray",
"(",
")",
")",
"{",
"return",
"decodeUtf8Array",
... | Decodes the given UTF-8 portion of the {@link ByteBuffer} into a {@link String}.
@throws IllegalArgumentException if the input is not valid UTF-8. | [
"Decodes",
"the",
"given",
"UTF",
"-",
"8",
"portion",
"of",
"the",
"{",
"@link",
"ByteBuffer",
"}",
"into",
"a",
"{",
"@link",
"String",
"}",
"."
] | train | https://github.com/google/flatbuffers/blob/6cc30b3272d79c85db7d4871ac0aa69541dc89de/java/com/google/flatbuffers/Utf8Safe.java#L286-L294 |
Abnaxos/markdown-doclet | doclet/jdk8/src/main/java/ch/raffael/mddoclet/Options.java | Options.validOptions | public static boolean validOptions(String[][] options, DocErrorReporter errorReporter) {
options = new Options().load(options, errorReporter);
if ( options != null ) {
return Standard.validOptions(options, errorReporter);
}
else {
return false;
}
} | java | public static boolean validOptions(String[][] options, DocErrorReporter errorReporter) {
options = new Options().load(options, errorReporter);
if ( options != null ) {
return Standard.validOptions(options, errorReporter);
}
else {
return false;
}
} | [
"public",
"static",
"boolean",
"validOptions",
"(",
"String",
"[",
"]",
"[",
"]",
"options",
",",
"DocErrorReporter",
"errorReporter",
")",
"{",
"options",
"=",
"new",
"Options",
"(",
")",
".",
"load",
"(",
"options",
",",
"errorReporter",
")",
";",
"if",
... | As specified by the Doclet specification.
@param options The command line options.
@param errorReporter An error reporter to print messages.
@return `true` if the options are valid.
@see com.sun.javadoc.Doclet#validOptions(String[][], com.sun.javadoc.DocErrorReporter) | [
"As",
"specified",
"by",
"the",
"Doclet",
"specification",
"."
] | train | https://github.com/Abnaxos/markdown-doclet/blob/e98a9630206fc9c8d813cf2349ff594be8630054/doclet/jdk8/src/main/java/ch/raffael/mddoclet/Options.java#L577-L585 |
box/box-java-sdk | src/main/java/com/box/sdk/BoxLegalHoldPolicy.java | BoxLegalHoldPolicy.createOngoing | public static BoxLegalHoldPolicy.Info createOngoing(BoxAPIConnection api, String name, String description) {
URL url = ALL_LEGAL_HOLD_URL_TEMPLATE.build(api.getBaseURL());
BoxJSONRequest request = new BoxJSONRequest(api, url, "POST");
JsonObject requestJSON = new JsonObject()
.add("policy_name", name)
.add("is_ongoing", true);
if (description != null) {
requestJSON.add("description", description);
}
request.setBody(requestJSON.toString());
BoxJSONResponse response = (BoxJSONResponse) request.send();
JsonObject responseJSON = JsonObject.readFrom(response.getJSON());
BoxLegalHoldPolicy createdPolicy = new BoxLegalHoldPolicy(api, responseJSON.get("id").asString());
return createdPolicy.new Info(responseJSON);
} | java | public static BoxLegalHoldPolicy.Info createOngoing(BoxAPIConnection api, String name, String description) {
URL url = ALL_LEGAL_HOLD_URL_TEMPLATE.build(api.getBaseURL());
BoxJSONRequest request = new BoxJSONRequest(api, url, "POST");
JsonObject requestJSON = new JsonObject()
.add("policy_name", name)
.add("is_ongoing", true);
if (description != null) {
requestJSON.add("description", description);
}
request.setBody(requestJSON.toString());
BoxJSONResponse response = (BoxJSONResponse) request.send();
JsonObject responseJSON = JsonObject.readFrom(response.getJSON());
BoxLegalHoldPolicy createdPolicy = new BoxLegalHoldPolicy(api, responseJSON.get("id").asString());
return createdPolicy.new Info(responseJSON);
} | [
"public",
"static",
"BoxLegalHoldPolicy",
".",
"Info",
"createOngoing",
"(",
"BoxAPIConnection",
"api",
",",
"String",
"name",
",",
"String",
"description",
")",
"{",
"URL",
"url",
"=",
"ALL_LEGAL_HOLD_URL_TEMPLATE",
".",
"build",
"(",
"api",
".",
"getBaseURL",
... | Creates a new ongoing Legal Hold Policy.
@param api the API connection to be used by the resource.
@param name the name of Legal Hold Policy.
@param description the description of Legal Hold Policy.
@return information about the Legal Hold Policy created. | [
"Creates",
"a",
"new",
"ongoing",
"Legal",
"Hold",
"Policy",
"."
] | train | https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/BoxLegalHoldPolicy.java#L116-L130 |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/mps/current_hostname.java | current_hostname.get_nitro_bulk_response | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
current_hostname_responses result = (current_hostname_responses) service.get_payload_formatter().string_to_resource(current_hostname_responses.class, response);
if(result.errorcode != 0)
{
if (result.errorcode == SESSION_NOT_EXISTS)
service.clear_session();
throw new nitro_exception(result.message, result.errorcode, (base_response [])result.current_hostname_response_array);
}
current_hostname[] result_current_hostname = new current_hostname[result.current_hostname_response_array.length];
for(int i = 0; i < result.current_hostname_response_array.length; i++)
{
result_current_hostname[i] = result.current_hostname_response_array[i].current_hostname[0];
}
return result_current_hostname;
} | java | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
current_hostname_responses result = (current_hostname_responses) service.get_payload_formatter().string_to_resource(current_hostname_responses.class, response);
if(result.errorcode != 0)
{
if (result.errorcode == SESSION_NOT_EXISTS)
service.clear_session();
throw new nitro_exception(result.message, result.errorcode, (base_response [])result.current_hostname_response_array);
}
current_hostname[] result_current_hostname = new current_hostname[result.current_hostname_response_array.length];
for(int i = 0; i < result.current_hostname_response_array.length; i++)
{
result_current_hostname[i] = result.current_hostname_response_array[i].current_hostname[0];
}
return result_current_hostname;
} | [
"protected",
"base_resource",
"[",
"]",
"get_nitro_bulk_response",
"(",
"nitro_service",
"service",
",",
"String",
"response",
")",
"throws",
"Exception",
"{",
"current_hostname_responses",
"result",
"=",
"(",
"current_hostname_responses",
")",
"service",
".",
"get_payl... | <pre>
Converts API response of bulk operation into object and returns the object array in case of get request.
</pre> | [
"<pre",
">",
"Converts",
"API",
"response",
"of",
"bulk",
"operation",
"into",
"object",
"and",
"returns",
"the",
"object",
"array",
"in",
"case",
"of",
"get",
"request",
".",
"<",
"/",
"pre",
">"
] | train | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/mps/current_hostname.java#L226-L243 |
dasein-cloud/dasein-cloud-aws | src/main/java/org/dasein/cloud/aws/AWSCloud.java | AWSCloud.addIndexedParameters | public static void addIndexedParameters( @Nonnull Map<String, String> parameters, @Nonnull String prefix, Map<String, String> extraParameters ) {
if( extraParameters == null || extraParameters.size() == 0 ) {
return;
}
int i = 1;
for( Map.Entry<String, String> entry : extraParameters.entrySet() ) {
parameters.put(prefix + i + ".Name", entry.getKey());
if( entry.getValue() != null ) {
parameters.put(prefix + i + ".Value", entry.getValue());
}
i++;
}
} | java | public static void addIndexedParameters( @Nonnull Map<String, String> parameters, @Nonnull String prefix, Map<String, String> extraParameters ) {
if( extraParameters == null || extraParameters.size() == 0 ) {
return;
}
int i = 1;
for( Map.Entry<String, String> entry : extraParameters.entrySet() ) {
parameters.put(prefix + i + ".Name", entry.getKey());
if( entry.getValue() != null ) {
parameters.put(prefix + i + ".Value", entry.getValue());
}
i++;
}
} | [
"public",
"static",
"void",
"addIndexedParameters",
"(",
"@",
"Nonnull",
"Map",
"<",
"String",
",",
"String",
">",
"parameters",
",",
"@",
"Nonnull",
"String",
"prefix",
",",
"Map",
"<",
"String",
",",
"String",
">",
"extraParameters",
")",
"{",
"if",
"(",... | Helper method for adding indexed member parameters, e.g. <i>AlarmNames.member.N</i>. Will overwrite existing
parameters if present. Assumes indexing starts at 1.
@param parameters the existing parameters map to add to
@param prefix the prefix value for each parameter key
@param extraParameters the values to add | [
"Helper",
"method",
"for",
"adding",
"indexed",
"member",
"parameters",
"e",
".",
"g",
".",
"<i",
">",
"AlarmNames",
".",
"member",
".",
"N<",
"/",
"i",
">",
".",
"Will",
"overwrite",
"existing",
"parameters",
"if",
"present",
".",
"Assumes",
"indexing",
... | train | https://github.com/dasein-cloud/dasein-cloud-aws/blob/05098574197a1f573f77447cadc39a76bf00b99d/src/main/java/org/dasein/cloud/aws/AWSCloud.java#L1415-L1427 |
openbase/jul | exception/src/main/java/org/openbase/jul/exception/MultiException.java | MultiException.checkAndThrow | @Deprecated
public static void checkAndThrow(final String message, final ExceptionStack exceptionStack) throws MultiException {
if (exceptionStack == null || exceptionStack.isEmpty()) {
return;
}
throw new MultiException(message, exceptionStack);
} | java | @Deprecated
public static void checkAndThrow(final String message, final ExceptionStack exceptionStack) throws MultiException {
if (exceptionStack == null || exceptionStack.isEmpty()) {
return;
}
throw new MultiException(message, exceptionStack);
} | [
"@",
"Deprecated",
"public",
"static",
"void",
"checkAndThrow",
"(",
"final",
"String",
"message",
",",
"final",
"ExceptionStack",
"exceptionStack",
")",
"throws",
"MultiException",
"{",
"if",
"(",
"exceptionStack",
"==",
"null",
"||",
"exceptionStack",
".",
"isEm... | @param message the message used as {@code MultiException} headline message..
@param exceptionStack the stack to check.
@throws MultiException
@deprecated since v2.0 and will be removed in v3.0. Please use {@code checkAndThrow(final Callable<String> messageProvider, final ExceptionStack exceptionStack)} out of performance reasons. | [
"@param",
"message",
"the",
"message",
"used",
"as",
"{",
"@code",
"MultiException",
"}",
"headline",
"message",
"..",
"@param",
"exceptionStack",
"the",
"stack",
"to",
"check",
"."
] | train | https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/exception/src/main/java/org/openbase/jul/exception/MultiException.java#L92-L98 |
ggrandes/packer | src/main/java/org/javastack/packer/Packer.java | Packer.getHexStringLower | public String getHexStringLower() {
int len = getVInt();
byte[] hex = new byte[len];
System.arraycopy(buf, bufPosition, hex, 0, hex.length);
bufPosition += hex.length;
return toHex(hex, false);
} | java | public String getHexStringLower() {
int len = getVInt();
byte[] hex = new byte[len];
System.arraycopy(buf, bufPosition, hex, 0, hex.length);
bufPosition += hex.length;
return toHex(hex, false);
} | [
"public",
"String",
"getHexStringLower",
"(",
")",
"{",
"int",
"len",
"=",
"getVInt",
"(",
")",
";",
"byte",
"[",
"]",
"hex",
"=",
"new",
"byte",
"[",
"len",
"]",
";",
"System",
".",
"arraycopy",
"(",
"buf",
",",
"bufPosition",
",",
"hex",
",",
"0"... | Get Hex String in lower case ("0123456789abcdef")
@return
@see #putHexString(String)
@see #getHexStringUpper() | [
"Get",
"Hex",
"String",
"in",
"lower",
"case",
"(",
"0123456789abcdef",
")"
] | train | https://github.com/ggrandes/packer/blob/0b37b286a3d0555050eb2e65419dd74f8d8d3e78/src/main/java/org/javastack/packer/Packer.java#L1221-L1227 |
Azure/azure-sdk-for-java | servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/management/ManagementClient.java | ManagementClient.ruleExists | public Boolean ruleExists(String topicPath, String subscriptionName, String ruleName) throws ServiceBusException, InterruptedException {
return Utils.completeFuture(this.asyncClient.ruleExistsAsync(topicPath, subscriptionName, ruleName));
} | java | public Boolean ruleExists(String topicPath, String subscriptionName, String ruleName) throws ServiceBusException, InterruptedException {
return Utils.completeFuture(this.asyncClient.ruleExistsAsync(topicPath, subscriptionName, ruleName));
} | [
"public",
"Boolean",
"ruleExists",
"(",
"String",
"topicPath",
",",
"String",
"subscriptionName",
",",
"String",
"ruleName",
")",
"throws",
"ServiceBusException",
",",
"InterruptedException",
"{",
"return",
"Utils",
".",
"completeFuture",
"(",
"this",
".",
"asyncCli... | Checks whether a given rule exists or not for a given subscription.
@param topicPath - Path of the topic
@param subscriptionName - Name of the subscription.
@param ruleName - Name of the rule
@return - True if the entity exists. False otherwise.
@throws IllegalArgumentException - path is not null / empty / too long / invalid.
@throws TimeoutException - The operation times out. The timeout period is initiated through ClientSettings.operationTimeout
@throws AuthorizationFailedException - No sufficient permission to perform this operation. Please check ClientSettings.tokenProvider has correct details.
@throws ServerBusyException - The server is busy. You should wait before you retry the operation.
@throws ServiceBusException - An internal error or an unexpected exception occurred.
@throws InterruptedException if the current thread was interrupted | [
"Checks",
"whether",
"a",
"given",
"rule",
"exists",
"or",
"not",
"for",
"a",
"given",
"subscription",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/management/ManagementClient.java#L552-L554 |
jfoenixadmin/JFoenix | jfoenix/src/main/java/com/jfoenix/skins/PromptLinesWrapper.java | PromptLinesWrapper.animateFloatingLabel | private void animateFloatingLabel(boolean up, boolean animation) {
if (promptTextSupplier.get() == null) {
return;
}
if (up) {
if (promptTextSupplier.get().getTranslateY() != -contentHeight) {
unfocusTimer.stop();
runTimer(focusTimer, animation);
}
} else {
if (promptTextSupplier.get().getTranslateY() != 0) {
focusTimer.stop();
runTimer(unfocusTimer, animation);
}
}
} | java | private void animateFloatingLabel(boolean up, boolean animation) {
if (promptTextSupplier.get() == null) {
return;
}
if (up) {
if (promptTextSupplier.get().getTranslateY() != -contentHeight) {
unfocusTimer.stop();
runTimer(focusTimer, animation);
}
} else {
if (promptTextSupplier.get().getTranslateY() != 0) {
focusTimer.stop();
runTimer(unfocusTimer, animation);
}
}
} | [
"private",
"void",
"animateFloatingLabel",
"(",
"boolean",
"up",
",",
"boolean",
"animation",
")",
"{",
"if",
"(",
"promptTextSupplier",
".",
"get",
"(",
")",
"==",
"null",
")",
"{",
"return",
";",
"}",
"if",
"(",
"up",
")",
"{",
"if",
"(",
"promptText... | this method is called when the text property is changed when the
field is not focused (changed in code)
@param up | [
"this",
"method",
"is",
"called",
"when",
"the",
"text",
"property",
"is",
"changed",
"when",
"the",
"field",
"is",
"not",
"focused",
"(",
"changed",
"in",
"code",
")"
] | train | https://github.com/jfoenixadmin/JFoenix/blob/53235b5f561da4a515ef716059b8a8df5239ffa1/jfoenix/src/main/java/com/jfoenix/skins/PromptLinesWrapper.java#L271-L286 |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.mp.jwt_fat/fat/src/com/ibm/ws/security/mp/jwt/fat/CommonMpJwtFat.java | CommonMpJwtFat.setUpAndStartBuilderServer | protected static void setUpAndStartBuilderServer(LibertyServer server, String configFile, boolean jwtEnabled) throws Exception {
bootstrapUtils.writeBootstrapProperty(server, "oidcJWKEnabled", String.valueOf(jwtEnabled));
serverTracker.addServer(server);
server.startServerUsingExpandedConfiguration(configFile);
SecurityFatHttpUtils.saveServerPorts(server, MpJwtFatConstants.BVT_SERVER_2_PORT_NAME_ROOT);
} | java | protected static void setUpAndStartBuilderServer(LibertyServer server, String configFile, boolean jwtEnabled) throws Exception {
bootstrapUtils.writeBootstrapProperty(server, "oidcJWKEnabled", String.valueOf(jwtEnabled));
serverTracker.addServer(server);
server.startServerUsingExpandedConfiguration(configFile);
SecurityFatHttpUtils.saveServerPorts(server, MpJwtFatConstants.BVT_SERVER_2_PORT_NAME_ROOT);
} | [
"protected",
"static",
"void",
"setUpAndStartBuilderServer",
"(",
"LibertyServer",
"server",
",",
"String",
"configFile",
",",
"boolean",
"jwtEnabled",
")",
"throws",
"Exception",
"{",
"bootstrapUtils",
".",
"writeBootstrapProperty",
"(",
"server",
",",
"\"oidcJWKEnable... | Startup a Liberty Server with the JWT Builder enabled
@param server - the server to startup
@param configFile - the config file to use when starting the serever
@param jwtEnabled - flag indicating if jwt should be enabled (used to set a bootstrap property that the config will use)
@throws Exception | [
"Startup",
"a",
"Liberty",
"Server",
"with",
"the",
"JWT",
"Builder",
"enabled"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.mp.jwt_fat/fat/src/com/ibm/ws/security/mp/jwt/fat/CommonMpJwtFat.java#L67-L72 |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/utils/CodecUtils.java | CodecUtils.hexSHA512 | public static String hexSHA512(String data, String salt) {
Objects.requireNonNull(data, Required.DATA.toString());
Objects.requireNonNull(salt, Required.SALT.toString());
return DigestUtils.sha512Hex(data + salt);
} | java | public static String hexSHA512(String data, String salt) {
Objects.requireNonNull(data, Required.DATA.toString());
Objects.requireNonNull(salt, Required.SALT.toString());
return DigestUtils.sha512Hex(data + salt);
} | [
"public",
"static",
"String",
"hexSHA512",
"(",
"String",
"data",
",",
"String",
"salt",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"data",
",",
"Required",
".",
"DATA",
".",
"toString",
"(",
")",
")",
";",
"Objects",
".",
"requireNonNull",
"(",
"s... | Hashes a given cleartext data with SHA512 and an appended salt
@param data The cleartext data
@param salt The salt to use
@return SHA512 hashed value | [
"Hashes",
"a",
"given",
"cleartext",
"data",
"with",
"SHA512",
"and",
"an",
"appended",
"salt"
] | train | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/utils/CodecUtils.java#L57-L62 |
JOML-CI/JOML | src/org/joml/Vector4i.java | Vector4i.setComponent | public Vector4i setComponent(int component, int value) throws IllegalArgumentException {
switch (component) {
case 0:
x = value;
break;
case 1:
y = value;
break;
case 2:
z = value;
break;
case 3:
w = value;
break;
default:
throw new IllegalArgumentException();
}
return this;
} | java | public Vector4i setComponent(int component, int value) throws IllegalArgumentException {
switch (component) {
case 0:
x = value;
break;
case 1:
y = value;
break;
case 2:
z = value;
break;
case 3:
w = value;
break;
default:
throw new IllegalArgumentException();
}
return this;
} | [
"public",
"Vector4i",
"setComponent",
"(",
"int",
"component",
",",
"int",
"value",
")",
"throws",
"IllegalArgumentException",
"{",
"switch",
"(",
"component",
")",
"{",
"case",
"0",
":",
"x",
"=",
"value",
";",
"break",
";",
"case",
"1",
":",
"y",
"=",
... | Set the value of the specified component of this vector.
@param component
the component whose value to set, within <code>[0..3]</code>
@param value
the value to set
@return this
@throws IllegalArgumentException if <code>component</code> is not within <code>[0..3]</code> | [
"Set",
"the",
"value",
"of",
"the",
"specified",
"component",
"of",
"this",
"vector",
"."
] | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Vector4i.java#L504-L522 |
op4j/op4j | src/main/java/org/op4j/functions/FnFunc.java | FnFunc.ifNullOrTrueThen | public static final <T> Function<T,T> ifNullOrTrueThen(final Type<T> targetType, final IFunction<? super T, Boolean> condition, final IFunction<? super T,? extends T> thenFunction) {
return ifTrueThen(targetType, FnBoolean.or(FnObject.isNull(),condition), thenFunction);
} | java | public static final <T> Function<T,T> ifNullOrTrueThen(final Type<T> targetType, final IFunction<? super T, Boolean> condition, final IFunction<? super T,? extends T> thenFunction) {
return ifTrueThen(targetType, FnBoolean.or(FnObject.isNull(),condition), thenFunction);
} | [
"public",
"static",
"final",
"<",
"T",
">",
"Function",
"<",
"T",
",",
"T",
">",
"ifNullOrTrueThen",
"(",
"final",
"Type",
"<",
"T",
">",
"targetType",
",",
"final",
"IFunction",
"<",
"?",
"super",
"T",
",",
"Boolean",
">",
"condition",
",",
"final",
... | <p>
Builds a function that will execute the specified function <tt>thenFunction</tt>
only if the target object is null or the result of executing <tt>condition</tt> on
it is true.
</p>
<p>
The built function cannot change the return type (receives <tt>T</tt> and returns <tt>T</tt>)
because the <tt>thenFunction</tt> could remain unexecuted, and so the type returned by
<tt>thenFunction</tt> must be the same as the type required as input, in order to keep
consistency.
</p>
@param targetType the target type
@param condition the condition to be executed on the target object
@param thenFunction the function to be executed on the target object if
target is null or the result of executing condition on it is true
@return a function that executes the "thenFunction" if target is null or "condition" is true. | [
"<p",
">",
"Builds",
"a",
"function",
"that",
"will",
"execute",
"the",
"specified",
"function",
"<tt",
">",
"thenFunction<",
"/",
"tt",
">",
"only",
"if",
"the",
"target",
"object",
"is",
"null",
"or",
"the",
"result",
"of",
"executing",
"<tt",
">",
"co... | train | https://github.com/op4j/op4j/blob/b577596dfe462089d3dd169666defc6de7ad289a/src/main/java/org/op4j/functions/FnFunc.java#L269-L271 |
aws/aws-sdk-java | aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/internal/S3RequestEndpointResolver.java | S3RequestEndpointResolver.convertToVirtualHostEndpoint | private static URI convertToVirtualHostEndpoint(URI endpoint, String bucketName) {
try {
return new URI(String.format("%s://%s.%s", endpoint.getScheme(), bucketName, endpoint.getAuthority()));
} catch (URISyntaxException e) {
throw new IllegalArgumentException("Invalid bucket name: " + bucketName, e);
}
} | java | private static URI convertToVirtualHostEndpoint(URI endpoint, String bucketName) {
try {
return new URI(String.format("%s://%s.%s", endpoint.getScheme(), bucketName, endpoint.getAuthority()));
} catch (URISyntaxException e) {
throw new IllegalArgumentException("Invalid bucket name: " + bucketName, e);
}
} | [
"private",
"static",
"URI",
"convertToVirtualHostEndpoint",
"(",
"URI",
"endpoint",
",",
"String",
"bucketName",
")",
"{",
"try",
"{",
"return",
"new",
"URI",
"(",
"String",
".",
"format",
"(",
"\"%s://%s.%s\"",
",",
"endpoint",
".",
"getScheme",
"(",
")",
"... | Converts the current endpoint set for this client into virtual addressing style, by placing
the name of the specified bucket before the S3 service endpoint.
@param bucketName The name of the bucket to use in the virtual addressing style of the returned URI.
@return A new URI, creating from the current service endpoint URI and the specified bucket. | [
"Converts",
"the",
"current",
"endpoint",
"set",
"for",
"this",
"client",
"into",
"virtual",
"addressing",
"style",
"by",
"placing",
"the",
"name",
"of",
"the",
"specified",
"bucket",
"before",
"the",
"S3",
"service",
"endpoint",
"."
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/internal/S3RequestEndpointResolver.java#L73-L79 |
realexpayments/rxp-hpp-java | src/main/java/com/realexpayments/hpp/sdk/RealexHpp.java | RealexHpp.requestFromJson | public HppRequest requestFromJson(String json, boolean encoded) {
LOGGER.info("Converting JSON to HppRequest.");
//convert to HppRequest from JSON
HppRequest hppRequest = JsonUtils.fromJsonHppRequest(json);
//decode if necessary
if (encoded) {
LOGGER.debug("Decoding object.");
try {
hppRequest = hppRequest.decode(ENCODING_CHARSET);
} catch (UnsupportedEncodingException ex) {
LOGGER.error("Exception encoding HPP request.", ex);
throw new RealexException("Exception decoding HPP request.", ex);
}
}
//validate HPP request
LOGGER.debug("Validating request.");
ValidationUtils.validate(hppRequest);
return hppRequest;
} | java | public HppRequest requestFromJson(String json, boolean encoded) {
LOGGER.info("Converting JSON to HppRequest.");
//convert to HppRequest from JSON
HppRequest hppRequest = JsonUtils.fromJsonHppRequest(json);
//decode if necessary
if (encoded) {
LOGGER.debug("Decoding object.");
try {
hppRequest = hppRequest.decode(ENCODING_CHARSET);
} catch (UnsupportedEncodingException ex) {
LOGGER.error("Exception encoding HPP request.", ex);
throw new RealexException("Exception decoding HPP request.", ex);
}
}
//validate HPP request
LOGGER.debug("Validating request.");
ValidationUtils.validate(hppRequest);
return hppRequest;
} | [
"public",
"HppRequest",
"requestFromJson",
"(",
"String",
"json",
",",
"boolean",
"encoded",
")",
"{",
"LOGGER",
".",
"info",
"(",
"\"Converting JSON to HppRequest.\"",
")",
";",
"//convert to HppRequest from JSON",
"HppRequest",
"hppRequest",
"=",
"JsonUtils",
".",
"... | <p>
Method produces <code>HppRequest</code> object from JSON.
Carries out the following actions:
<ul>
<li>Deserialises JSON to request object</li>
<li>Decodes Base64 inputs</li>
<li>Validates inputs</li>
</ul>
</p>
@param json
@param encoded <code>true</code> if the JSON values have been encoded.
@return HppRequest | [
"<p",
">",
"Method",
"produces",
"<code",
">",
"HppRequest<",
"/",
"code",
">",
"object",
"from",
"JSON",
".",
"Carries",
"out",
"the",
"following",
"actions",
":",
"<ul",
">",
"<li",
">",
"Deserialises",
"JSON",
"to",
"request",
"object<",
"/",
"li",
">... | train | https://github.com/realexpayments/rxp-hpp-java/blob/29cc5df036af09a6d8ea16ccd7e02e856f72620f/src/main/java/com/realexpayments/hpp/sdk/RealexHpp.java#L147-L170 |
Azure/azure-sdk-for-java | policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyStatesInner.java | PolicyStatesInner.summarizeForSubscriptionAsync | public Observable<SummarizeResultsInner> summarizeForSubscriptionAsync(String subscriptionId, QueryOptions queryOptions) {
return summarizeForSubscriptionWithServiceResponseAsync(subscriptionId, queryOptions).map(new Func1<ServiceResponse<SummarizeResultsInner>, SummarizeResultsInner>() {
@Override
public SummarizeResultsInner call(ServiceResponse<SummarizeResultsInner> response) {
return response.body();
}
});
} | java | public Observable<SummarizeResultsInner> summarizeForSubscriptionAsync(String subscriptionId, QueryOptions queryOptions) {
return summarizeForSubscriptionWithServiceResponseAsync(subscriptionId, queryOptions).map(new Func1<ServiceResponse<SummarizeResultsInner>, SummarizeResultsInner>() {
@Override
public SummarizeResultsInner call(ServiceResponse<SummarizeResultsInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"SummarizeResultsInner",
">",
"summarizeForSubscriptionAsync",
"(",
"String",
"subscriptionId",
",",
"QueryOptions",
"queryOptions",
")",
"{",
"return",
"summarizeForSubscriptionWithServiceResponseAsync",
"(",
"subscriptionId",
",",
"queryOptions",
... | Summarizes policy states for the resources under the subscription.
@param subscriptionId Microsoft Azure subscription ID.
@param queryOptions Additional parameters for the operation
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the SummarizeResultsInner object | [
"Summarizes",
"policy",
"states",
"for",
"the",
"resources",
"under",
"the",
"subscription",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyStatesInner.java#L816-L823 |
JadiraOrg/jadira | cloning/src/main/java/org/jadira/reflection/cloning/BasicCloner.java | BasicCloner.setImplementors | public void setImplementors(Map<Class<?>, CloneImplementor> implementors) {
// this.implementors = implementors;
this.allImplementors = new HashMap<Class<?>, CloneImplementor>();
allImplementors.putAll(builtInImplementors);
allImplementors.putAll(implementors);
} | java | public void setImplementors(Map<Class<?>, CloneImplementor> implementors) {
// this.implementors = implementors;
this.allImplementors = new HashMap<Class<?>, CloneImplementor>();
allImplementors.putAll(builtInImplementors);
allImplementors.putAll(implementors);
} | [
"public",
"void",
"setImplementors",
"(",
"Map",
"<",
"Class",
"<",
"?",
">",
",",
"CloneImplementor",
">",
"implementors",
")",
"{",
"// this.implementors = implementors;",
"this",
".",
"allImplementors",
"=",
"new",
"HashMap",
"<",
"Class",
"<",
"?",
">",
",... | Sets CloneImplementors to be used.
@param implementors The implementors | [
"Sets",
"CloneImplementors",
"to",
"be",
"used",
"."
] | train | https://github.com/JadiraOrg/jadira/blob/d55d0238395f0cb900531f1f08b4b2d87fa9a4f6/cloning/src/main/java/org/jadira/reflection/cloning/BasicCloner.java#L248-L254 |
liferay/com-liferay-commerce | commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDisplayLayoutPersistenceImpl.java | CPDisplayLayoutPersistenceImpl.removeByC_C | @Override
public CPDisplayLayout removeByC_C(long classNameId, long classPK)
throws NoSuchCPDisplayLayoutException {
CPDisplayLayout cpDisplayLayout = findByC_C(classNameId, classPK);
return remove(cpDisplayLayout);
} | java | @Override
public CPDisplayLayout removeByC_C(long classNameId, long classPK)
throws NoSuchCPDisplayLayoutException {
CPDisplayLayout cpDisplayLayout = findByC_C(classNameId, classPK);
return remove(cpDisplayLayout);
} | [
"@",
"Override",
"public",
"CPDisplayLayout",
"removeByC_C",
"(",
"long",
"classNameId",
",",
"long",
"classPK",
")",
"throws",
"NoSuchCPDisplayLayoutException",
"{",
"CPDisplayLayout",
"cpDisplayLayout",
"=",
"findByC_C",
"(",
"classNameId",
",",
"classPK",
")",
";",... | Removes the cp display layout where classNameId = ? and classPK = ? from the database.
@param classNameId the class name ID
@param classPK the class pk
@return the cp display layout that was removed | [
"Removes",
"the",
"cp",
"display",
"layout",
"where",
"classNameId",
"=",
"?",
";",
"and",
"classPK",
"=",
"?",
";",
"from",
"the",
"database",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDisplayLayoutPersistenceImpl.java#L1633-L1639 |
javamelody/javamelody | javamelody-swing/src/main/java/net/bull/javamelody/swing/print/MPdfWriter.java | MPdfWriter.renderList | protected void renderList(final MBasicTable table, final Table datatable)
throws BadElementException {
final int columnCount = table.getColumnCount();
final int rowCount = table.getRowCount();
// data rows
final Font font = FontFactory.getFont(FontFactory.HELVETICA, 10, Font.NORMAL);
datatable.getDefaultCell().setBorderWidth(1);
datatable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT);
// datatable.setDefaultCellGrayFill(0);
Object value;
String text;
int horizontalAlignment;
for (int k = 0; k < rowCount; k++) {
for (int i = 0; i < columnCount; i++) {
value = getValueAt(table, k, i);
if (value instanceof Number || value instanceof Date) {
horizontalAlignment = Element.ALIGN_RIGHT;
} else if (value instanceof Boolean) {
horizontalAlignment = Element.ALIGN_CENTER;
} else {
horizontalAlignment = Element.ALIGN_LEFT;
}
datatable.getDefaultCell().setHorizontalAlignment(horizontalAlignment);
text = getTextAt(table, k, i);
datatable.addCell(new Phrase(8, text != null ? text : "", font));
}
}
} | java | protected void renderList(final MBasicTable table, final Table datatable)
throws BadElementException {
final int columnCount = table.getColumnCount();
final int rowCount = table.getRowCount();
// data rows
final Font font = FontFactory.getFont(FontFactory.HELVETICA, 10, Font.NORMAL);
datatable.getDefaultCell().setBorderWidth(1);
datatable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT);
// datatable.setDefaultCellGrayFill(0);
Object value;
String text;
int horizontalAlignment;
for (int k = 0; k < rowCount; k++) {
for (int i = 0; i < columnCount; i++) {
value = getValueAt(table, k, i);
if (value instanceof Number || value instanceof Date) {
horizontalAlignment = Element.ALIGN_RIGHT;
} else if (value instanceof Boolean) {
horizontalAlignment = Element.ALIGN_CENTER;
} else {
horizontalAlignment = Element.ALIGN_LEFT;
}
datatable.getDefaultCell().setHorizontalAlignment(horizontalAlignment);
text = getTextAt(table, k, i);
datatable.addCell(new Phrase(8, text != null ? text : "", font));
}
}
} | [
"protected",
"void",
"renderList",
"(",
"final",
"MBasicTable",
"table",
",",
"final",
"Table",
"datatable",
")",
"throws",
"BadElementException",
"{",
"final",
"int",
"columnCount",
"=",
"table",
".",
"getColumnCount",
"(",
")",
";",
"final",
"int",
"rowCount",... | Effectue le rendu de la liste.
@param table
MBasicTable
@param datatable
Table
@throws BadElementException
e | [
"Effectue",
"le",
"rendu",
"de",
"la",
"liste",
"."
] | train | https://github.com/javamelody/javamelody/blob/18ad583ddeb5dcadd797dfda295409c6983ffd71/javamelody-swing/src/main/java/net/bull/javamelody/swing/print/MPdfWriter.java#L289-L316 |
b3log/latke | latke-core/src/main/java/org/json/JSONArray.java | JSONArray.optFloat | public float optFloat(int index, float defaultValue) {
final Number val = this.optNumber(index, null);
if (val == null) {
return defaultValue;
}
final float floatValue = val.floatValue();
// if (Float.isNaN(floatValue) || Float.isInfinite(floatValue)) {
// return floatValue;
// }
return floatValue;
} | java | public float optFloat(int index, float defaultValue) {
final Number val = this.optNumber(index, null);
if (val == null) {
return defaultValue;
}
final float floatValue = val.floatValue();
// if (Float.isNaN(floatValue) || Float.isInfinite(floatValue)) {
// return floatValue;
// }
return floatValue;
} | [
"public",
"float",
"optFloat",
"(",
"int",
"index",
",",
"float",
"defaultValue",
")",
"{",
"final",
"Number",
"val",
"=",
"this",
".",
"optNumber",
"(",
"index",
",",
"null",
")",
";",
"if",
"(",
"val",
"==",
"null",
")",
"{",
"return",
"defaultValue"... | Get the optional float value associated with an index. The defaultValue
is returned if there is no value for the index, or if the value is not a
number and cannot be converted to a number.
@param index
subscript
@param defaultValue
The default value.
@return The value. | [
"Get",
"the",
"optional",
"float",
"value",
"associated",
"with",
"an",
"index",
".",
"The",
"defaultValue",
"is",
"returned",
"if",
"there",
"is",
"no",
"value",
"for",
"the",
"index",
"or",
"if",
"the",
"value",
"is",
"not",
"a",
"number",
"and",
"cann... | train | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/json/JSONArray.java#L605-L615 |
matthewhorridge/owlapi-gwt | owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLObjectUnionOfImpl_CustomFieldSerializer.java | OWLObjectUnionOfImpl_CustomFieldSerializer.serializeInstance | @Override
public void serializeInstance(SerializationStreamWriter streamWriter, OWLObjectUnionOfImpl instance) throws SerializationException {
serialize(streamWriter, instance);
} | java | @Override
public void serializeInstance(SerializationStreamWriter streamWriter, OWLObjectUnionOfImpl instance) throws SerializationException {
serialize(streamWriter, instance);
} | [
"@",
"Override",
"public",
"void",
"serializeInstance",
"(",
"SerializationStreamWriter",
"streamWriter",
",",
"OWLObjectUnionOfImpl",
"instance",
")",
"throws",
"SerializationException",
"{",
"serialize",
"(",
"streamWriter",
",",
"instance",
")",
";",
"}"
] | Serializes the content of the object into the
{@link com.google.gwt.user.client.rpc.SerializationStreamWriter}.
@param streamWriter the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter} to write the
object's content to
@param instance the object instance to serialize
@throws com.google.gwt.user.client.rpc.SerializationException
if the serialization operation is not
successful | [
"Serializes",
"the",
"content",
"of",
"the",
"object",
"into",
"the",
"{",
"@link",
"com",
".",
"google",
".",
"gwt",
".",
"user",
".",
"client",
".",
"rpc",
".",
"SerializationStreamWriter",
"}",
"."
] | train | https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLObjectUnionOfImpl_CustomFieldSerializer.java#L69-L72 |
alkacon/opencms-core | src/org/opencms/ui/login/CmsLoginUI.java | CmsLoginUI.generateLoginHtmlFragment | public static String generateLoginHtmlFragment(CmsObject cms, VaadinRequest request) throws IOException {
LoginParameters parameters = CmsLoginHelper.getLoginParameters(cms, (HttpServletRequest)request, true);
request.getWrappedSession().setAttribute(CmsLoginUI.INIT_DATA_SESSION_ATTR, parameters);
byte[] pageBytes;
pageBytes = CmsFileUtil.readFully(
Thread.currentThread().getContextClassLoader().getResourceAsStream(
"org/opencms/ui/login/login-fragment.html"));
String html = new String(pageBytes, "UTF-8");
String autocomplete = ((parameters.getPcType() == null)
|| parameters.getPcType().equals(CmsLoginHelper.PCTYPE_PRIVATE)) ? "on" : "off";
CmsMacroResolver resolver = new CmsMacroResolver();
resolver.addMacro("autocompplete", autocomplete);
if ((parameters.getPcType() == null) || parameters.getPcType().equals(CmsLoginHelper.PCTYPE_PRIVATE)) {
resolver.addMacro(
"hiddenPasswordField",
" <input type=\"password\" id=\"hidden-password\" name=\"ocPword\" autocomplete=\"%(autocomplete)\" >");
}
if (parameters.getUsername() != null) {
resolver.addMacro("predefUser", "value=\"" + CmsEncoder.escapeXml(parameters.getUsername()) + "\"");
}
html = resolver.resolveMacros(html);
return html;
} | java | public static String generateLoginHtmlFragment(CmsObject cms, VaadinRequest request) throws IOException {
LoginParameters parameters = CmsLoginHelper.getLoginParameters(cms, (HttpServletRequest)request, true);
request.getWrappedSession().setAttribute(CmsLoginUI.INIT_DATA_SESSION_ATTR, parameters);
byte[] pageBytes;
pageBytes = CmsFileUtil.readFully(
Thread.currentThread().getContextClassLoader().getResourceAsStream(
"org/opencms/ui/login/login-fragment.html"));
String html = new String(pageBytes, "UTF-8");
String autocomplete = ((parameters.getPcType() == null)
|| parameters.getPcType().equals(CmsLoginHelper.PCTYPE_PRIVATE)) ? "on" : "off";
CmsMacroResolver resolver = new CmsMacroResolver();
resolver.addMacro("autocompplete", autocomplete);
if ((parameters.getPcType() == null) || parameters.getPcType().equals(CmsLoginHelper.PCTYPE_PRIVATE)) {
resolver.addMacro(
"hiddenPasswordField",
" <input type=\"password\" id=\"hidden-password\" name=\"ocPword\" autocomplete=\"%(autocomplete)\" >");
}
if (parameters.getUsername() != null) {
resolver.addMacro("predefUser", "value=\"" + CmsEncoder.escapeXml(parameters.getUsername()) + "\"");
}
html = resolver.resolveMacros(html);
return html;
} | [
"public",
"static",
"String",
"generateLoginHtmlFragment",
"(",
"CmsObject",
"cms",
",",
"VaadinRequest",
"request",
")",
"throws",
"IOException",
"{",
"LoginParameters",
"parameters",
"=",
"CmsLoginHelper",
".",
"getLoginParameters",
"(",
"cms",
",",
"(",
"HttpServle... | Returns the bootstrap html fragment required to display the login dialog.<p>
@param cms the cms context
@param request the request
@return the html fragment
@throws IOException in case reading the html template fails | [
"Returns",
"the",
"bootstrap",
"html",
"fragment",
"required",
"to",
"display",
"the",
"login",
"dialog",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/login/CmsLoginUI.java#L308-L333 |
james-hu/jabb-core | src/main/java/net/sf/jabb/util/perf/RunTime.java | RunTime.addDetail | public void addDetail(String desc, long milliStartTime, long nanoDurationTime){
this.getDetail(desc).add(milliStartTime, nanoDurationTime);
} | java | public void addDetail(String desc, long milliStartTime, long nanoDurationTime){
this.getDetail(desc).add(milliStartTime, nanoDurationTime);
} | [
"public",
"void",
"addDetail",
"(",
"String",
"desc",
",",
"long",
"milliStartTime",
",",
"long",
"nanoDurationTime",
")",
"{",
"this",
".",
"getDetail",
"(",
"desc",
")",
".",
"add",
"(",
"milliStartTime",
",",
"nanoDurationTime",
")",
";",
"}"
] | Add one run time to a specified detail record.<br>
给指定的详细记录增加一次RunTime。
@param desc Description of the detail record.<br>
详细记录的Description
@param milliStartTime Start time in milliseconds (usually from System.currentTimeMillis())
@param nanoDurationTime Run time duration in nanoseconds. | [
"Add",
"one",
"run",
"time",
"to",
"a",
"specified",
"detail",
"record",
".",
"<br",
">",
"给指定的详细记录增加一次RunTime。"
] | train | https://github.com/james-hu/jabb-core/blob/bceed441595c5e5195a7418795f03b69fa7b61e4/src/main/java/net/sf/jabb/util/perf/RunTime.java#L197-L199 |
RobertStewart/privateer | src/main/java/com/wombatnation/privateer/Privateer.java | Privateer.findSupertypeMethod | private Method findSupertypeMethod(Object o, String methodName, Class<?>[] types) {
Method matchingMethod = null;
Method[] methods = o.getClass().getDeclaredMethods();
methodloop:
for (Method method : methods) {
if (methodName.equals(method.getName())) {
Class<?>[] params = method.getParameterTypes();
if (params.length == types.length) {
for (int i = 0; i < params.length; i++) {
// Check if param is supertype of arg in the same position
if (!params[i].isAssignableFrom(types[i])) {
break methodloop;
}
}
}
// If we reach here, then all params and args were compatible
matchingMethod = method;
break;
}
}
return matchingMethod;
} | java | private Method findSupertypeMethod(Object o, String methodName, Class<?>[] types) {
Method matchingMethod = null;
Method[] methods = o.getClass().getDeclaredMethods();
methodloop:
for (Method method : methods) {
if (methodName.equals(method.getName())) {
Class<?>[] params = method.getParameterTypes();
if (params.length == types.length) {
for (int i = 0; i < params.length; i++) {
// Check if param is supertype of arg in the same position
if (!params[i].isAssignableFrom(types[i])) {
break methodloop;
}
}
}
// If we reach here, then all params and args were compatible
matchingMethod = method;
break;
}
}
return matchingMethod;
} | [
"private",
"Method",
"findSupertypeMethod",
"(",
"Object",
"o",
",",
"String",
"methodName",
",",
"Class",
"<",
"?",
">",
"[",
"]",
"types",
")",
"{",
"Method",
"matchingMethod",
"=",
"null",
";",
"Method",
"[",
"]",
"methods",
"=",
"o",
".",
"getClass",... | Examines each argument to see if a param in the same position is a supertype. This method is
needed because getDeclaredMethod() does a formal type match. For example, if the method takes
a java.util.List as a parameter, getDeclaredMethod() will never match, since the formal type
of whatever you pass will be a concrete class.
@param o
@param methodName
@param types
@return A matching Method or null | [
"Examines",
"each",
"argument",
"to",
"see",
"if",
"a",
"param",
"in",
"the",
"same",
"position",
"is",
"a",
"supertype",
".",
"This",
"method",
"is",
"needed",
"because",
"getDeclaredMethod",
"()",
"does",
"a",
"formal",
"type",
"match",
".",
"For",
"exam... | train | https://github.com/RobertStewart/privateer/blob/766603021ff406c950e798ce3fb259c9f1f460c7/src/main/java/com/wombatnation/privateer/Privateer.java#L163-L187 |
groupon/monsoon | intf/src/main/java/com/groupon/lex/metrics/timeseries/TimeSeriesMetricDeltaSet.java | TimeSeriesMetricDeltaSet.mapOptional | public TimeSeriesMetricDeltaSet mapOptional(Function<? super MetricValue, Optional<? extends MetricValue>> fn) {
return values_
.map(
fn,
(x) -> x.entrySet().stream()
.map((entry) -> apply_fn_optional_(entry, fn))
)
.mapCombine(
opt_scalar -> opt_scalar.map(TimeSeriesMetricDeltaSet::new).orElseGet(() -> new TimeSeriesMetricDeltaSet(MetricValue.EMPTY)),
TimeSeriesMetricDeltaSet::new
);
} | java | public TimeSeriesMetricDeltaSet mapOptional(Function<? super MetricValue, Optional<? extends MetricValue>> fn) {
return values_
.map(
fn,
(x) -> x.entrySet().stream()
.map((entry) -> apply_fn_optional_(entry, fn))
)
.mapCombine(
opt_scalar -> opt_scalar.map(TimeSeriesMetricDeltaSet::new).orElseGet(() -> new TimeSeriesMetricDeltaSet(MetricValue.EMPTY)),
TimeSeriesMetricDeltaSet::new
);
} | [
"public",
"TimeSeriesMetricDeltaSet",
"mapOptional",
"(",
"Function",
"<",
"?",
"super",
"MetricValue",
",",
"Optional",
"<",
"?",
"extends",
"MetricValue",
">",
">",
"fn",
")",
"{",
"return",
"values_",
".",
"map",
"(",
"fn",
",",
"(",
"x",
")",
"-",
">... | Apply a single-argument function to the set.
@param fn A function that takes a TimeSeriesMetricDelta and returns a TimeSeriesMetricDelta.
@return The mapped TimeSeriesMetricDelta from this set. | [
"Apply",
"a",
"single",
"-",
"argument",
"function",
"to",
"the",
"set",
"."
] | train | https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/intf/src/main/java/com/groupon/lex/metrics/timeseries/TimeSeriesMetricDeltaSet.java#L173-L184 |
operasoftware/operaprestodriver | src/com/opera/core/systems/scope/stp/services/desktop/ScopeDesktopWindowManager.java | ScopeDesktopWindowManager.getQuickWindow | public QuickWindow getQuickWindow(QuickWidgetSearchType property, String value) {
QuickWindow lastFound = null;
List<QuickWindow> windows = getQuickWindowList();
for (QuickWindow window : windows) {
if (property.equals(QuickWidgetSearchType.NAME)) {
if (window.getName().equals(value)) {
if (window.isOnScreen()) {
return window;
} else {
lastFound = window;
}
}
}
}
return lastFound;
} | java | public QuickWindow getQuickWindow(QuickWidgetSearchType property, String value) {
QuickWindow lastFound = null;
List<QuickWindow> windows = getQuickWindowList();
for (QuickWindow window : windows) {
if (property.equals(QuickWidgetSearchType.NAME)) {
if (window.getName().equals(value)) {
if (window.isOnScreen()) {
return window;
} else {
lastFound = window;
}
}
}
}
return lastFound;
} | [
"public",
"QuickWindow",
"getQuickWindow",
"(",
"QuickWidgetSearchType",
"property",
",",
"String",
"value",
")",
"{",
"QuickWindow",
"lastFound",
"=",
"null",
";",
"List",
"<",
"QuickWindow",
">",
"windows",
"=",
"getQuickWindowList",
"(",
")",
";",
"for",
"(",... | Note: This grabs the first window with a matching name, there might be more | [
"Note",
":",
"This",
"grabs",
"the",
"first",
"window",
"with",
"a",
"matching",
"name",
"there",
"might",
"be",
"more"
] | train | https://github.com/operasoftware/operaprestodriver/blob/1ccceda80f1c1a0489171d17dcaa6e7b18fb4c01/src/com/opera/core/systems/scope/stp/services/desktop/ScopeDesktopWindowManager.java#L78-L94 |
dkpro/dkpro-jwpl | de.tudarmstadt.ukp.wikipedia.revisionmachine/src/main/java/de/tudarmstadt/ukp/wikipedia/revisionmachine/difftool/data/codec/BitWriter.java | BitWriter.writeValue | public void writeValue(final int length, final int value)
throws EncodingException
{
if (length > 31) {
throw ErrorFactory.createEncodingException(
ErrorKeys.DIFFTOOL_ENCODING_VALUE_OUT_OF_RANGE,
"more than maximum length: " + value);
}
for (int i = length - 1; i >= 0; i--) {
writeBit((value >> i) & 1);
}
} | java | public void writeValue(final int length, final int value)
throws EncodingException
{
if (length > 31) {
throw ErrorFactory.createEncodingException(
ErrorKeys.DIFFTOOL_ENCODING_VALUE_OUT_OF_RANGE,
"more than maximum length: " + value);
}
for (int i = length - 1; i >= 0; i--) {
writeBit((value >> i) & 1);
}
} | [
"public",
"void",
"writeValue",
"(",
"final",
"int",
"length",
",",
"final",
"int",
"value",
")",
"throws",
"EncodingException",
"{",
"if",
"(",
"length",
">",
"31",
")",
"{",
"throw",
"ErrorFactory",
".",
"createEncodingException",
"(",
"ErrorKeys",
".",
"D... | Writes a positive integer to the buffer.
@param length
the number of bits to write
@param value
an integer value
@throws EncodingException
if the length of the input is more than 31 bits. | [
"Writes",
"a",
"positive",
"integer",
"to",
"the",
"buffer",
"."
] | train | https://github.com/dkpro/dkpro-jwpl/blob/0a0304b6a0aa13acc18838957994e06dd4613a58/de.tudarmstadt.ukp.wikipedia.revisionmachine/src/main/java/de/tudarmstadt/ukp/wikipedia/revisionmachine/difftool/data/codec/BitWriter.java#L127-L139 |
spring-cloud/spring-cloud-sleuth | spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/annotation/SleuthAnnotationUtils.java | SleuthAnnotationUtils.findAnnotation | static <T extends Annotation> T findAnnotation(Method method, Class<T> clazz) {
T annotation = AnnotationUtils.findAnnotation(method, clazz);
if (annotation == null) {
try {
annotation = AnnotationUtils.findAnnotation(method.getDeclaringClass()
.getMethod(method.getName(), method.getParameterTypes()), clazz);
}
catch (NoSuchMethodException | SecurityException ex) {
if (log.isDebugEnabled()) {
log.debug("Exception occurred while tyring to find the annotation",
ex);
}
}
}
return annotation;
} | java | static <T extends Annotation> T findAnnotation(Method method, Class<T> clazz) {
T annotation = AnnotationUtils.findAnnotation(method, clazz);
if (annotation == null) {
try {
annotation = AnnotationUtils.findAnnotation(method.getDeclaringClass()
.getMethod(method.getName(), method.getParameterTypes()), clazz);
}
catch (NoSuchMethodException | SecurityException ex) {
if (log.isDebugEnabled()) {
log.debug("Exception occurred while tyring to find the annotation",
ex);
}
}
}
return annotation;
} | [
"static",
"<",
"T",
"extends",
"Annotation",
">",
"T",
"findAnnotation",
"(",
"Method",
"method",
",",
"Class",
"<",
"T",
">",
"clazz",
")",
"{",
"T",
"annotation",
"=",
"AnnotationUtils",
".",
"findAnnotation",
"(",
"method",
",",
"clazz",
")",
";",
"if... | Searches for an annotation either on a method or inside the method parameters.
@param <T> - annotation
@param clazz - class with annotation
@param method - annotated method
@return annotation | [
"Searches",
"for",
"an",
"annotation",
"either",
"on",
"a",
"method",
"or",
"inside",
"the",
"method",
"parameters",
"."
] | train | https://github.com/spring-cloud/spring-cloud-sleuth/blob/f29c05fb8fba33e23aa21bb13aeb13ab8d27b485/spring-cloud-sleuth-core/src/main/java/org/springframework/cloud/sleuth/annotation/SleuthAnnotationUtils.java#L77-L92 |
cdk/cdk | tool/group/src/main/java/org/openscience/cdk/group/AtomContainerDiscretePartitionRefinerImpl.java | AtomContainerDiscretePartitionRefinerImpl.getAutomorphismGroup | public PermutationGroup getAutomorphismGroup(IAtomContainer atomContainer, Partition initialPartition) {
setup(atomContainer);
super.refine(initialPartition);
return super.getAutomorphismGroup();
} | java | public PermutationGroup getAutomorphismGroup(IAtomContainer atomContainer, Partition initialPartition) {
setup(atomContainer);
super.refine(initialPartition);
return super.getAutomorphismGroup();
} | [
"public",
"PermutationGroup",
"getAutomorphismGroup",
"(",
"IAtomContainer",
"atomContainer",
",",
"Partition",
"initialPartition",
")",
"{",
"setup",
"(",
"atomContainer",
")",
";",
"super",
".",
"refine",
"(",
"initialPartition",
")",
";",
"return",
"super",
".",
... | Get the automorphism group of the molecule given an initial partition.
@param atomContainer the atom container to use
@param initialPartition an initial partition of the atoms
@return the automorphism group starting with this partition | [
"Get",
"the",
"automorphism",
"group",
"of",
"the",
"molecule",
"given",
"an",
"initial",
"partition",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/group/src/main/java/org/openscience/cdk/group/AtomContainerDiscretePartitionRefinerImpl.java#L115-L119 |
aspectran/aspectran | shell/src/main/java/com/aspectran/shell/command/option/DefaultOptionParser.java | DefaultOptionParser.isShortOption | private boolean isShortOption(String token) {
// short options (-S, -SV, -S=V, -SV1=V2, -S1S2)
if (!token.startsWith("-") || token.length() == 1) {
return false;
}
// remove leading "-" and "=value"
int pos = token.indexOf("=");
String name = (pos == -1 ? token.substring(1) : token.substring(1, pos));
if (options.hasShortOption(name)) {
return true;
}
// check for several concatenated short options
return (name.length() > 0 && options.hasShortOption(String.valueOf(name.charAt(0))));
} | java | private boolean isShortOption(String token) {
// short options (-S, -SV, -S=V, -SV1=V2, -S1S2)
if (!token.startsWith("-") || token.length() == 1) {
return false;
}
// remove leading "-" and "=value"
int pos = token.indexOf("=");
String name = (pos == -1 ? token.substring(1) : token.substring(1, pos));
if (options.hasShortOption(name)) {
return true;
}
// check for several concatenated short options
return (name.length() > 0 && options.hasShortOption(String.valueOf(name.charAt(0))));
} | [
"private",
"boolean",
"isShortOption",
"(",
"String",
"token",
")",
"{",
"// short options (-S, -SV, -S=V, -SV1=V2, -S1S2)",
"if",
"(",
"!",
"token",
".",
"startsWith",
"(",
"\"-\"",
")",
"||",
"token",
".",
"length",
"(",
")",
"==",
"1",
")",
"{",
"return",
... | Tells if the token looks like a short option.
@param token the command line token to handle
@return true if the token like a short option | [
"Tells",
"if",
"the",
"token",
"looks",
"like",
"a",
"short",
"option",
"."
] | train | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/shell/src/main/java/com/aspectran/shell/command/option/DefaultOptionParser.java#L493-L506 |
liferay/com-liferay-commerce | commerce-price-list-service/src/main/java/com/liferay/commerce/price/list/service/persistence/impl/CommercePriceEntryPersistenceImpl.java | CommercePriceEntryPersistenceImpl.findByCompanyId | @Override
public List<CommercePriceEntry> findByCompanyId(long companyId, int start,
int end, OrderByComparator<CommercePriceEntry> orderByComparator) {
return findByCompanyId(companyId, start, end, orderByComparator, true);
} | java | @Override
public List<CommercePriceEntry> findByCompanyId(long companyId, int start,
int end, OrderByComparator<CommercePriceEntry> orderByComparator) {
return findByCompanyId(companyId, start, end, orderByComparator, true);
} | [
"@",
"Override",
"public",
"List",
"<",
"CommercePriceEntry",
">",
"findByCompanyId",
"(",
"long",
"companyId",
",",
"int",
"start",
",",
"int",
"end",
",",
"OrderByComparator",
"<",
"CommercePriceEntry",
">",
"orderByComparator",
")",
"{",
"return",
"findByCompan... | Returns an ordered range of all the commerce price entries where companyId = ?.
<p>
Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommercePriceEntryModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
</p>
@param companyId the company ID
@param start the lower bound of the range of commerce price entries
@param end the upper bound of the range of commerce price entries (not inclusive)
@param orderByComparator the comparator to order the results by (optionally <code>null</code>)
@return the ordered range of matching commerce price entries | [
"Returns",
"an",
"ordered",
"range",
"of",
"all",
"the",
"commerce",
"price",
"entries",
"where",
"companyId",
"=",
"?",
";",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-price-list-service/src/main/java/com/liferay/commerce/price/list/service/persistence/impl/CommercePriceEntryPersistenceImpl.java#L2065-L2069 |
moparisthebest/beehive | beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/internal/InternalUtils.java | InternalUtils.ensureModuleConfig | public static ModuleConfig ensureModuleConfig( String modulePath, ServletContext context )
{
try
{
ModuleConfig ret = getModuleConfig( modulePath, context );
if ( ret != null )
{
return ret;
}
else
{
ActionServlet as = getActionServlet( context );
if ( as instanceof AutoRegisterActionServlet )
{
return ( ( AutoRegisterActionServlet ) as ).ensureModuleRegistered( modulePath );
}
}
}
catch ( IOException e )
{
_log.error( "Error while registering Struts module " + modulePath, e );
}
catch ( ServletException e )
{
_log.error( "Error while registering Struts module " + modulePath, e );
}
return null;
} | java | public static ModuleConfig ensureModuleConfig( String modulePath, ServletContext context )
{
try
{
ModuleConfig ret = getModuleConfig( modulePath, context );
if ( ret != null )
{
return ret;
}
else
{
ActionServlet as = getActionServlet( context );
if ( as instanceof AutoRegisterActionServlet )
{
return ( ( AutoRegisterActionServlet ) as ).ensureModuleRegistered( modulePath );
}
}
}
catch ( IOException e )
{
_log.error( "Error while registering Struts module " + modulePath, e );
}
catch ( ServletException e )
{
_log.error( "Error while registering Struts module " + modulePath, e );
}
return null;
} | [
"public",
"static",
"ModuleConfig",
"ensureModuleConfig",
"(",
"String",
"modulePath",
",",
"ServletContext",
"context",
")",
"{",
"try",
"{",
"ModuleConfig",
"ret",
"=",
"getModuleConfig",
"(",
"modulePath",
",",
"context",
")",
";",
"if",
"(",
"ret",
"!=",
"... | Get the Struts ModuleConfig for the given module path. If there is none registered,
and if it is possible to register one automatically, do so. | [
"Get",
"the",
"Struts",
"ModuleConfig",
"for",
"the",
"given",
"module",
"path",
".",
"If",
"there",
"is",
"none",
"registered",
"and",
"if",
"it",
"is",
"possible",
"to",
"register",
"one",
"automatically",
"do",
"so",
"."
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/internal/InternalUtils.java#L473-L503 |
TestFX/Monocle | src/main/java/com/sun/glass/ui/monocle/TouchState.java | TouchState.canBeFoldedWith | boolean canBeFoldedWith(TouchState ts, boolean ignoreIDs) {
if (ts.pointCount != pointCount) {
return false;
}
if (ignoreIDs) {
return true;
}
for (int i = 0; i < pointCount; i++) {
if (ts.points[i].id != points[i].id) {
return false;
}
}
return true;
} | java | boolean canBeFoldedWith(TouchState ts, boolean ignoreIDs) {
if (ts.pointCount != pointCount) {
return false;
}
if (ignoreIDs) {
return true;
}
for (int i = 0; i < pointCount; i++) {
if (ts.points[i].id != points[i].id) {
return false;
}
}
return true;
} | [
"boolean",
"canBeFoldedWith",
"(",
"TouchState",
"ts",
",",
"boolean",
"ignoreIDs",
")",
"{",
"if",
"(",
"ts",
".",
"pointCount",
"!=",
"pointCount",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"ignoreIDs",
")",
"{",
"return",
"true",
";",
"}",
"... | Finds out whether two non-null states are identical in everything but
their touch point coordinates
@param ts the TouchState to compare to
@param ignoreIDs if true, ignore IDs when comparing points | [
"Finds",
"out",
"whether",
"two",
"non",
"-",
"null",
"states",
"are",
"identical",
"in",
"everything",
"but",
"their",
"touch",
"point",
"coordinates"
] | train | https://github.com/TestFX/Monocle/blob/267ccba8889cab244bf8c562dbaa0345a612874c/src/main/java/com/sun/glass/ui/monocle/TouchState.java#L272-L285 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/db/event/RecountOnValidHandler.java | RecountOnValidHandler.init | public void init(Record record, Record recordSub, boolean bRestoreCurrentRecord)
{
m_recordSub = recordSub;
m_bRestoreCurrentRecord = bRestoreCurrentRecord;
super.init(record);
} | java | public void init(Record record, Record recordSub, boolean bRestoreCurrentRecord)
{
m_recordSub = recordSub;
m_bRestoreCurrentRecord = bRestoreCurrentRecord;
super.init(record);
} | [
"public",
"void",
"init",
"(",
"Record",
"record",
",",
"Record",
"recordSub",
",",
"boolean",
"bRestoreCurrentRecord",
")",
"{",
"m_recordSub",
"=",
"recordSub",
";",
"m_bRestoreCurrentRecord",
"=",
"bRestoreCurrentRecord",
";",
"super",
".",
"init",
"(",
"record... | Constructor.
@param record My owner (usually passed as null, and set on addListener in setOwner()).
@param recordSub The sub-record. | [
"Constructor",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/event/RecountOnValidHandler.java#L65-L70 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/tuple/Triple.java | Triple.compareTo | @Override
public int compareTo(final Triple<L, M, R> other) {
return new CompareToBuilder().append(getLeft(), other.getLeft())
.append(getMiddle(), other.getMiddle())
.append(getRight(), other.getRight()).toComparison();
} | java | @Override
public int compareTo(final Triple<L, M, R> other) {
return new CompareToBuilder().append(getLeft(), other.getLeft())
.append(getMiddle(), other.getMiddle())
.append(getRight(), other.getRight()).toComparison();
} | [
"@",
"Override",
"public",
"int",
"compareTo",
"(",
"final",
"Triple",
"<",
"L",
",",
"M",
",",
"R",
">",
"other",
")",
"{",
"return",
"new",
"CompareToBuilder",
"(",
")",
".",
"append",
"(",
"getLeft",
"(",
")",
",",
"other",
".",
"getLeft",
"(",
... | <p>Compares the triple based on the left element, followed by the middle element,
finally the right element.
The types must be {@code Comparable}.</p>
@param other the other triple, not null
@return negative if this is less, zero if equal, positive if greater | [
"<p",
">",
"Compares",
"the",
"triple",
"based",
"on",
"the",
"left",
"element",
"followed",
"by",
"the",
"middle",
"element",
"finally",
"the",
"right",
"element",
".",
"The",
"types",
"must",
"be",
"{",
"@code",
"Comparable",
"}",
".",
"<",
"/",
"p",
... | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/tuple/Triple.java#L96-L101 |
voldemort/voldemort | src/java/voldemort/versioning/VectorClock.java | VectorClock.incrementVersion | public void incrementVersion(int node, long time) {
if(node < 0 || node > Short.MAX_VALUE)
throw new IllegalArgumentException(node
+ " is outside the acceptable range of node ids.");
this.timestamp = time;
Long version = versionMap.get((short) node);
if(version == null) {
version = 1L;
} else {
version = version + 1L;
}
versionMap.put((short) node, version);
if(versionMap.size() >= MAX_NUMBER_OF_VERSIONS) {
throw new IllegalStateException("Vector clock is full!");
}
} | java | public void incrementVersion(int node, long time) {
if(node < 0 || node > Short.MAX_VALUE)
throw new IllegalArgumentException(node
+ " is outside the acceptable range of node ids.");
this.timestamp = time;
Long version = versionMap.get((short) node);
if(version == null) {
version = 1L;
} else {
version = version + 1L;
}
versionMap.put((short) node, version);
if(versionMap.size() >= MAX_NUMBER_OF_VERSIONS) {
throw new IllegalStateException("Vector clock is full!");
}
} | [
"public",
"void",
"incrementVersion",
"(",
"int",
"node",
",",
"long",
"time",
")",
"{",
"if",
"(",
"node",
"<",
"0",
"||",
"node",
">",
"Short",
".",
"MAX_VALUE",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"node",
"+",
"\" is outside the acceptab... | Increment the version info associated with the given node
@param node The node | [
"Increment",
"the",
"version",
"info",
"associated",
"with",
"the",
"given",
"node"
] | train | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/versioning/VectorClock.java#L205-L224 |
bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/core/Address.java | Address.fromKey | public static Address fromKey(final NetworkParameters params, final ECKey key, final ScriptType outputScriptType) {
if (outputScriptType == Script.ScriptType.P2PKH)
return LegacyAddress.fromKey(params, key);
else if (outputScriptType == Script.ScriptType.P2WPKH)
return SegwitAddress.fromKey(params, key);
else
throw new IllegalArgumentException(outputScriptType.toString());
} | java | public static Address fromKey(final NetworkParameters params, final ECKey key, final ScriptType outputScriptType) {
if (outputScriptType == Script.ScriptType.P2PKH)
return LegacyAddress.fromKey(params, key);
else if (outputScriptType == Script.ScriptType.P2WPKH)
return SegwitAddress.fromKey(params, key);
else
throw new IllegalArgumentException(outputScriptType.toString());
} | [
"public",
"static",
"Address",
"fromKey",
"(",
"final",
"NetworkParameters",
"params",
",",
"final",
"ECKey",
"key",
",",
"final",
"ScriptType",
"outputScriptType",
")",
"{",
"if",
"(",
"outputScriptType",
"==",
"Script",
".",
"ScriptType",
".",
"P2PKH",
")",
... | Construct an {@link Address} that represents the public part of the given {@link ECKey}.
@param params
network this address is valid for
@param key
only the public part is used
@param outputScriptType
script type the address should use
@return constructed address | [
"Construct",
"an",
"{",
"@link",
"Address",
"}",
"that",
"represents",
"the",
"public",
"part",
"of",
"the",
"given",
"{",
"@link",
"ECKey",
"}",
"."
] | train | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/Address.java#L82-L89 |
ggrandes/kvstore | src/main/java/org/javastack/kvstore/structures/btree/BplusTree.java | BplusTree.ceilingEntry | public synchronized TreeEntry<K, V> ceilingEntry(final K key) {
// Retorna la clave mas cercana mayor o igual a la clave indicada
return getRoundEntry(key, true, true);
} | java | public synchronized TreeEntry<K, V> ceilingEntry(final K key) {
// Retorna la clave mas cercana mayor o igual a la clave indicada
return getRoundEntry(key, true, true);
} | [
"public",
"synchronized",
"TreeEntry",
"<",
"K",
",",
"V",
">",
"ceilingEntry",
"(",
"final",
"K",
"key",
")",
"{",
"// Retorna la clave mas cercana mayor o igual a la clave indicada",
"return",
"getRoundEntry",
"(",
"key",
",",
"true",
",",
"true",
")",
";",
"}"
... | Returns the least key greater than or equal to the given key, or null if there is no such key.
@param key the key
@return the Entry with least key greater than or equal to key, or null if there is no such key | [
"Returns",
"the",
"least",
"key",
"greater",
"than",
"or",
"equal",
"to",
"the",
"given",
"key",
"or",
"null",
"if",
"there",
"is",
"no",
"such",
"key",
"."
] | train | https://github.com/ggrandes/kvstore/blob/c79277f79f4604e0fec8349a98519838e3de38f0/src/main/java/org/javastack/kvstore/structures/btree/BplusTree.java#L649-L652 |
jparsec/jparsec | jparsec/src/main/java/org/jparsec/SourceLocator.java | SourceLocator.scanTo | @Private Location scanTo(int index) {
boolean eof = false;
if (index == source.length()) { // The eof has index size() + 1
eof = true;
index--;
}
int columnIndex = nextColumnIndex;
for (int i = nextIndex; i <= index; i++) {
char c = source.charAt(i);
if (c == LINE_BREAK) {
lineBreakIndices.add(i);
columnIndex = 0;
}
else columnIndex++;
}
this.nextIndex = index + 1;
this.nextColumnIndex = columnIndex;
int lines = lineBreakIndices.size();
if (eof) return location(lines, columnIndex);
if (columnIndex == 0) return getLineBreakLocation(lines - 1);
return location(lines, columnIndex - 1);
} | java | @Private Location scanTo(int index) {
boolean eof = false;
if (index == source.length()) { // The eof has index size() + 1
eof = true;
index--;
}
int columnIndex = nextColumnIndex;
for (int i = nextIndex; i <= index; i++) {
char c = source.charAt(i);
if (c == LINE_BREAK) {
lineBreakIndices.add(i);
columnIndex = 0;
}
else columnIndex++;
}
this.nextIndex = index + 1;
this.nextColumnIndex = columnIndex;
int lines = lineBreakIndices.size();
if (eof) return location(lines, columnIndex);
if (columnIndex == 0) return getLineBreakLocation(lines - 1);
return location(lines, columnIndex - 1);
} | [
"@",
"Private",
"Location",
"scanTo",
"(",
"int",
"index",
")",
"{",
"boolean",
"eof",
"=",
"false",
";",
"if",
"(",
"index",
"==",
"source",
".",
"length",
"(",
")",
")",
"{",
"// The eof has index size() + 1",
"eof",
"=",
"true",
";",
"index",
"--",
... | Scans from {@code nextIndex} to {@code ind} and saves all indices of line break characters
into {@code lineBreakIndices} and adjusts the current column number as it goes. The location of
the character on {@code ind} is returned.
<p> After this method returns, {@code nextIndex} and {@code nextColumnIndex} will point to the
next character to be scanned or the EOF if the end of input is encountered. | [
"Scans",
"from",
"{",
"@code",
"nextIndex",
"}",
"to",
"{",
"@code",
"ind",
"}",
"and",
"saves",
"all",
"indices",
"of",
"line",
"break",
"characters",
"into",
"{",
"@code",
"lineBreakIndices",
"}",
"and",
"adjusts",
"the",
"current",
"column",
"number",
"... | train | https://github.com/jparsec/jparsec/blob/df1280259f5da9eb5ffc537437569dddba66cb94/jparsec/src/main/java/org/jparsec/SourceLocator.java#L102-L123 |
terrestris/shogun-core | src/shogun-core-main/src/main/java/de/terrestris/shoguncore/util/http/HttpUtil.java | HttpUtil.getHeadersFromRequest | public static Header[] getHeadersFromRequest(HttpServletRequest request) {
List<Header> returnHeaderList = new ArrayList<>();
Enumeration<String> headerNames = request.getHeaderNames();
while (headerNames.hasMoreElements()) {
String headerName = headerNames.nextElement();
Enumeration<String> headerValues = request.getHeaders(headerName);
while (headerValues.hasMoreElements()) {
String headerValue = headerValues.nextElement();
// as cookies are sent in headers, we'll also have to check for unsupported cookies here
if (headerName.toLowerCase().equals("cookie")) {
String[] cookies = headerValue.split(";");
List<String> newCookieList = new ArrayList<>();
for (int i = 0; i < cookies.length; i++) {
final String cookieFromArray = cookies[i];
newCookieList.add(cookieFromArray);
}
// rewrite the cookie value
headerValue = StringUtils.join(newCookieList, ";");
}
if (headerValue.isEmpty()) {
LOG.debug("Skipping request header '" + headerName + "' as it's value is empty (possibly an "
+ "unsupported cookie value has been removed)");
} else {
LOG.debug("Adding request header: " + headerName + "=" + headerValue);
returnHeaderList.add(new BasicHeader(headerName, headerValue));
}
}
}
Header[] headersArray = new Header[returnHeaderList.size()];
headersArray = returnHeaderList.toArray(headersArray);
return headersArray;
} | java | public static Header[] getHeadersFromRequest(HttpServletRequest request) {
List<Header> returnHeaderList = new ArrayList<>();
Enumeration<String> headerNames = request.getHeaderNames();
while (headerNames.hasMoreElements()) {
String headerName = headerNames.nextElement();
Enumeration<String> headerValues = request.getHeaders(headerName);
while (headerValues.hasMoreElements()) {
String headerValue = headerValues.nextElement();
// as cookies are sent in headers, we'll also have to check for unsupported cookies here
if (headerName.toLowerCase().equals("cookie")) {
String[] cookies = headerValue.split(";");
List<String> newCookieList = new ArrayList<>();
for (int i = 0; i < cookies.length; i++) {
final String cookieFromArray = cookies[i];
newCookieList.add(cookieFromArray);
}
// rewrite the cookie value
headerValue = StringUtils.join(newCookieList, ";");
}
if (headerValue.isEmpty()) {
LOG.debug("Skipping request header '" + headerName + "' as it's value is empty (possibly an "
+ "unsupported cookie value has been removed)");
} else {
LOG.debug("Adding request header: " + headerName + "=" + headerValue);
returnHeaderList.add(new BasicHeader(headerName, headerValue));
}
}
}
Header[] headersArray = new Header[returnHeaderList.size()];
headersArray = returnHeaderList.toArray(headersArray);
return headersArray;
} | [
"public",
"static",
"Header",
"[",
"]",
"getHeadersFromRequest",
"(",
"HttpServletRequest",
"request",
")",
"{",
"List",
"<",
"Header",
">",
"returnHeaderList",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"Enumeration",
"<",
"String",
">",
"headerNames",
"="... | Extract headers from {@link HttpServletRequest}
@param request {@link HttpServletRequest} to extract headers from
@return Array with {@link Header}s | [
"Extract",
"headers",
"from",
"{",
"@link",
"HttpServletRequest",
"}"
] | train | https://github.com/terrestris/shogun-core/blob/3dbabda35ae63235265913c865dba389b050b6e6/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/util/http/HttpUtil.java#L2001-L2037 |
protostuff/protostuff | protostuff-core/src/main/java/io/protostuff/GraphIOUtil.java | GraphIOUtil.mergeDelimitedFrom | public static <T> int mergeDelimitedFrom(InputStream in, T message, Schema<T> schema)
throws IOException
{
final int size = in.read();
if (size == -1)
throw ProtobufException.truncatedMessage();
final int len = size < 0x80 ? size : CodedInput.readRawVarint32(in, size);
if (len < 0)
throw ProtobufException.negativeSize();
if (len != 0)
{
// not an empty message
if (len > CodedInput.DEFAULT_BUFFER_SIZE)
{
// message too big
final CodedInput input = new CodedInput(new LimitedInputStream(in, len),
true);
final GraphCodedInput graphInput = new GraphCodedInput(input);
schema.mergeFrom(graphInput, message);
input.checkLastTagWas(0);
return len;
}
final byte[] buf = new byte[len];
IOUtil.fillBufferFrom(in, buf, 0, len);
final ByteArrayInput input = new ByteArrayInput(buf, 0, len,
true);
final GraphByteArrayInput graphInput = new GraphByteArrayInput(input);
try
{
schema.mergeFrom(graphInput, message);
}
catch (ArrayIndexOutOfBoundsException e)
{
throw ProtobufException.truncatedMessage(e);
}
input.checkLastTagWas(0);
}
return len;
} | java | public static <T> int mergeDelimitedFrom(InputStream in, T message, Schema<T> schema)
throws IOException
{
final int size = in.read();
if (size == -1)
throw ProtobufException.truncatedMessage();
final int len = size < 0x80 ? size : CodedInput.readRawVarint32(in, size);
if (len < 0)
throw ProtobufException.negativeSize();
if (len != 0)
{
// not an empty message
if (len > CodedInput.DEFAULT_BUFFER_SIZE)
{
// message too big
final CodedInput input = new CodedInput(new LimitedInputStream(in, len),
true);
final GraphCodedInput graphInput = new GraphCodedInput(input);
schema.mergeFrom(graphInput, message);
input.checkLastTagWas(0);
return len;
}
final byte[] buf = new byte[len];
IOUtil.fillBufferFrom(in, buf, 0, len);
final ByteArrayInput input = new ByteArrayInput(buf, 0, len,
true);
final GraphByteArrayInput graphInput = new GraphByteArrayInput(input);
try
{
schema.mergeFrom(graphInput, message);
}
catch (ArrayIndexOutOfBoundsException e)
{
throw ProtobufException.truncatedMessage(e);
}
input.checkLastTagWas(0);
}
return len;
} | [
"public",
"static",
"<",
"T",
">",
"int",
"mergeDelimitedFrom",
"(",
"InputStream",
"in",
",",
"T",
"message",
",",
"Schema",
"<",
"T",
">",
"schema",
")",
"throws",
"IOException",
"{",
"final",
"int",
"size",
"=",
"in",
".",
"read",
"(",
")",
";",
"... | Merges the {@code message} (delimited) from the {@link InputStream} using the given {@code schema}.
@return the size of the message | [
"Merges",
"the",
"{",
"@code",
"message",
"}",
"(",
"delimited",
")",
"from",
"the",
"{",
"@link",
"InputStream",
"}",
"using",
"the",
"given",
"{",
"@code",
"schema",
"}",
"."
] | train | https://github.com/protostuff/protostuff/blob/af669cf089057d0ec83220266131ce411854af7b/protostuff-core/src/main/java/io/protostuff/GraphIOUtil.java#L99-L142 |
google/truth | extensions/proto/src/main/java/com/google/common/truth/extensions/proto/MapWithProtoValuesSubject.java | MapWithProtoValuesSubject.usingFloatToleranceForFieldsForValues | public MapWithProtoValuesFluentAssertion<M> usingFloatToleranceForFieldsForValues(
float tolerance, Iterable<Integer> fieldNumbers) {
return usingConfig(config.usingFloatToleranceForFields(tolerance, fieldNumbers));
} | java | public MapWithProtoValuesFluentAssertion<M> usingFloatToleranceForFieldsForValues(
float tolerance, Iterable<Integer> fieldNumbers) {
return usingConfig(config.usingFloatToleranceForFields(tolerance, fieldNumbers));
} | [
"public",
"MapWithProtoValuesFluentAssertion",
"<",
"M",
">",
"usingFloatToleranceForFieldsForValues",
"(",
"float",
"tolerance",
",",
"Iterable",
"<",
"Integer",
">",
"fieldNumbers",
")",
"{",
"return",
"usingConfig",
"(",
"config",
".",
"usingFloatToleranceForFields",
... | Compares float fields with these explicitly specified top-level field numbers using the
provided absolute tolerance.
@param tolerance A finite, non-negative tolerance. | [
"Compares",
"float",
"fields",
"with",
"these",
"explicitly",
"specified",
"top",
"-",
"level",
"field",
"numbers",
"using",
"the",
"provided",
"absolute",
"tolerance",
"."
] | train | https://github.com/google/truth/blob/60eceffd2e8c3297655d33ed87d965cf5af51108/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/MapWithProtoValuesSubject.java#L585-L588 |
aws/aws-sdk-java | aws-java-sdk-ec2/src/main/java/com/amazonaws/services/ec2/model/ModifyInstanceAttributeRequest.java | ModifyInstanceAttributeRequest.getBlockDeviceMappings | public java.util.List<InstanceBlockDeviceMappingSpecification> getBlockDeviceMappings() {
if (blockDeviceMappings == null) {
blockDeviceMappings = new com.amazonaws.internal.SdkInternalList<InstanceBlockDeviceMappingSpecification>();
}
return blockDeviceMappings;
} | java | public java.util.List<InstanceBlockDeviceMappingSpecification> getBlockDeviceMappings() {
if (blockDeviceMappings == null) {
blockDeviceMappings = new com.amazonaws.internal.SdkInternalList<InstanceBlockDeviceMappingSpecification>();
}
return blockDeviceMappings;
} | [
"public",
"java",
".",
"util",
".",
"List",
"<",
"InstanceBlockDeviceMappingSpecification",
">",
"getBlockDeviceMappings",
"(",
")",
"{",
"if",
"(",
"blockDeviceMappings",
"==",
"null",
")",
"{",
"blockDeviceMappings",
"=",
"new",
"com",
".",
"amazonaws",
".",
"... | <p>
Modifies the <code>DeleteOnTermination</code> attribute for volumes that are currently attached. The volume must
be owned by the caller. If no value is specified for <code>DeleteOnTermination</code>, the default is
<code>true</code> and the volume is deleted when the instance is terminated.
</p>
<p>
To add instance store volumes to an Amazon EBS-backed instance, you must add them when you launch the instance.
For more information, see <a href=
"https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/block-device-mapping-concepts.html#Using_OverridingAMIBDM"
>Updating the Block Device Mapping when Launching an Instance</a> in the <i>Amazon Elastic Compute Cloud User
Guide</i>.
</p>
@return Modifies the <code>DeleteOnTermination</code> attribute for volumes that are currently attached. The
volume must be owned by the caller. If no value is specified for <code>DeleteOnTermination</code>, the
default is <code>true</code> and the volume is deleted when the instance is terminated.</p>
<p>
To add instance store volumes to an Amazon EBS-backed instance, you must add them when you launch the
instance. For more information, see <a href=
"https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/block-device-mapping-concepts.html#Using_OverridingAMIBDM"
>Updating the Block Device Mapping when Launching an Instance</a> in the <i>Amazon Elastic Compute Cloud
User Guide</i>. | [
"<p",
">",
"Modifies",
"the",
"<code",
">",
"DeleteOnTermination<",
"/",
"code",
">",
"attribute",
"for",
"volumes",
"that",
"are",
"currently",
"attached",
".",
"The",
"volume",
"must",
"be",
"owned",
"by",
"the",
"caller",
".",
"If",
"no",
"value",
"is",... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-ec2/src/main/java/com/amazonaws/services/ec2/model/ModifyInstanceAttributeRequest.java#L357-L362 |
weld/core | impl/src/main/java/org/jboss/weld/injection/producer/AbstractMemberProducer.java | AbstractMemberProducer.getReceiver | protected Object getReceiver(CreationalContext<?> productCreationalContext, CreationalContext<?> receiverCreationalContext) {
// This is a bit dangerous, as it means that producer methods can end up
// executing on partially constructed instances. Also, it's not required
// by the spec...
if (getAnnotated().isStatic()) {
return null;
} else {
if (productCreationalContext instanceof WeldCreationalContext<?>) {
WeldCreationalContext<?> creationalContextImpl = (WeldCreationalContext<?>) productCreationalContext;
final Object incompleteInstance = creationalContextImpl.getIncompleteInstance(getDeclaringBean());
if (incompleteInstance != null) {
BeanLogger.LOG.circularCall(getAnnotated(), getDeclaringBean());
return incompleteInstance;
}
}
return getBeanManager().getReference(getDeclaringBean(), null, receiverCreationalContext, true);
}
} | java | protected Object getReceiver(CreationalContext<?> productCreationalContext, CreationalContext<?> receiverCreationalContext) {
// This is a bit dangerous, as it means that producer methods can end up
// executing on partially constructed instances. Also, it's not required
// by the spec...
if (getAnnotated().isStatic()) {
return null;
} else {
if (productCreationalContext instanceof WeldCreationalContext<?>) {
WeldCreationalContext<?> creationalContextImpl = (WeldCreationalContext<?>) productCreationalContext;
final Object incompleteInstance = creationalContextImpl.getIncompleteInstance(getDeclaringBean());
if (incompleteInstance != null) {
BeanLogger.LOG.circularCall(getAnnotated(), getDeclaringBean());
return incompleteInstance;
}
}
return getBeanManager().getReference(getDeclaringBean(), null, receiverCreationalContext, true);
}
} | [
"protected",
"Object",
"getReceiver",
"(",
"CreationalContext",
"<",
"?",
">",
"productCreationalContext",
",",
"CreationalContext",
"<",
"?",
">",
"receiverCreationalContext",
")",
"{",
"// This is a bit dangerous, as it means that producer methods can end up",
"// executing on ... | Gets the receiver of the product. The two creational contexts need to be separated because the receiver only serves the product
creation (it is not a dependent instance of the created instance).
@param productCreationalContext the creational context of the produced instance
@param receiverCreationalContext the creational context of the receiver
@return The receiver | [
"Gets",
"the",
"receiver",
"of",
"the",
"product",
".",
"The",
"two",
"creational",
"contexts",
"need",
"to",
"be",
"separated",
"because",
"the",
"receiver",
"only",
"serves",
"the",
"product",
"creation",
"(",
"it",
"is",
"not",
"a",
"dependent",
"instance... | train | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/injection/producer/AbstractMemberProducer.java#L108-L125 |
UrielCh/ovh-java-sdk | ovh-java-sdk-xdsl/src/main/java/net/minidev/ovh/api/ApiOvhXdsl.java | ApiOvhXdsl.serviceName_modem_lan_lanName_GET | public OvhLAN serviceName_modem_lan_lanName_GET(String serviceName, String lanName) throws IOException {
String qPath = "/xdsl/{serviceName}/modem/lan/{lanName}";
StringBuilder sb = path(qPath, serviceName, lanName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhLAN.class);
} | java | public OvhLAN serviceName_modem_lan_lanName_GET(String serviceName, String lanName) throws IOException {
String qPath = "/xdsl/{serviceName}/modem/lan/{lanName}";
StringBuilder sb = path(qPath, serviceName, lanName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhLAN.class);
} | [
"public",
"OvhLAN",
"serviceName_modem_lan_lanName_GET",
"(",
"String",
"serviceName",
",",
"String",
"lanName",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/xdsl/{serviceName}/modem/lan/{lanName}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPat... | Get this object properties
REST: GET /xdsl/{serviceName}/modem/lan/{lanName}
@param serviceName [required] The internal name of your XDSL offer
@param lanName [required] Name of the LAN | [
"Get",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-xdsl/src/main/java/net/minidev/ovh/api/ApiOvhXdsl.java#L979-L984 |
fhoeben/hsac-fitnesse-fixtures | src/main/java/nl/hsac/fitnesse/fixture/fit/SoapCallMapColumnFixture.java | SoapCallMapColumnFixture.callSoapService | protected void callSoapService(String url, String templateName, String soapAction, XmlHttpResponse response) {
Map<String, Object> headers = soapAction != null ? Collections.singletonMap("SOAPAction", (Object) soapAction) : null;
getEnvironment().callService(url, templateName, getCurrentRowValues(), response, headers);
} | java | protected void callSoapService(String url, String templateName, String soapAction, XmlHttpResponse response) {
Map<String, Object> headers = soapAction != null ? Collections.singletonMap("SOAPAction", (Object) soapAction) : null;
getEnvironment().callService(url, templateName, getCurrentRowValues(), response, headers);
} | [
"protected",
"void",
"callSoapService",
"(",
"String",
"url",
",",
"String",
"templateName",
",",
"String",
"soapAction",
",",
"XmlHttpResponse",
"response",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"headers",
"=",
"soapAction",
"!=",
"null",
"?",
... | Calls SOAP service using template and current row's values.
@param url url of service to call.
@param templateName name of template to use to create POST body.
@param soapAction SOAPAction header value (null if no header is required).
@param response response to fill based on call. | [
"Calls",
"SOAP",
"service",
"using",
"template",
"and",
"current",
"row",
"s",
"values",
"."
] | train | https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/fit/SoapCallMapColumnFixture.java#L83-L86 |
querydsl/querydsl | querydsl-core/src/main/java/com/querydsl/core/types/dsl/MapExpressionBase.java | MapExpressionBase.contains | @SuppressWarnings("unchecked")
public final BooleanExpression contains(Expression<K> key, Expression<V> value) {
return get(key).eq((Expression) value);
} | java | @SuppressWarnings("unchecked")
public final BooleanExpression contains(Expression<K> key, Expression<V> value) {
return get(key).eq((Expression) value);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"final",
"BooleanExpression",
"contains",
"(",
"Expression",
"<",
"K",
">",
"key",
",",
"Expression",
"<",
"V",
">",
"value",
")",
"{",
"return",
"get",
"(",
"key",
")",
".",
"eq",
"(",
"(",
... | Create a {@code (key, value) in this} expression
@param key key of entry
@param value value of entry
@return expression | [
"Create",
"a",
"{",
"@code",
"(",
"key",
"value",
")",
"in",
"this",
"}",
"expression"
] | train | https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-core/src/main/java/com/querydsl/core/types/dsl/MapExpressionBase.java#L66-L69 |
RestComm/media-core | rtp/src/main/java/org/restcomm/media/core/rtp/crypto/SRTPCryptoContext.java | SRTPCryptoContext.deriveContext | public SRTPCryptoContext deriveContext(long ssrc, int roc, long deriveRate) {
return new SRTPCryptoContext(ssrc, roc, deriveRate, masterKey, masterSalt, policy);
} | java | public SRTPCryptoContext deriveContext(long ssrc, int roc, long deriveRate) {
return new SRTPCryptoContext(ssrc, roc, deriveRate, masterKey, masterSalt, policy);
} | [
"public",
"SRTPCryptoContext",
"deriveContext",
"(",
"long",
"ssrc",
",",
"int",
"roc",
",",
"long",
"deriveRate",
")",
"{",
"return",
"new",
"SRTPCryptoContext",
"(",
"ssrc",
",",
"roc",
",",
"deriveRate",
",",
"masterKey",
",",
"masterSalt",
",",
"policy",
... | Derive a new SRTPCryptoContext for use with a new SSRC
This method returns a new SRTPCryptoContext initialized with the data of
this SRTPCryptoContext. Replacing the SSRC, Roll-over-Counter, and the
key derivation rate the application cab use this SRTPCryptoContext to
encrypt / decrypt a new stream (Synchronization source) inside one RTP
session.
Before the application can use this SRTPCryptoContext it must call the
deriveSrtpKeys method.
@param ssrc
The SSRC for this context
@param roc
The Roll-Over-Counter for this context
@param deriveRate
The key derivation rate for this context
@return a new SRTPCryptoContext with all relevant data set. | [
"Derive",
"a",
"new",
"SRTPCryptoContext",
"for",
"use",
"with",
"a",
"new",
"SSRC"
] | train | https://github.com/RestComm/media-core/blob/07b8703343708599f60af66bae62aded77ee81b5/rtp/src/main/java/org/restcomm/media/core/rtp/crypto/SRTPCryptoContext.java#L731-L733 |
jMetal/jMetal | jmetal-algorithm/src/main/java/org/uma/jmetal/algorithm/multiobjective/moead/AbstractMOEAD.java | AbstractMOEAD.updateNeighborhood | @SuppressWarnings("unchecked")
protected void updateNeighborhood(S individual, int subProblemId, NeighborType neighborType) throws JMetalException {
int size;
int time;
time = 0;
if (neighborType == NeighborType.NEIGHBOR) {
size = neighborhood[subProblemId].length;
} else {
size = population.size();
}
int[] perm = new int[size];
MOEADUtils.randomPermutation(perm, size);
for (int i = 0; i < size; i++) {
int k;
if (neighborType == NeighborType.NEIGHBOR) {
k = neighborhood[subProblemId][perm[i]];
} else {
k = perm[i];
}
double f1, f2;
f1 = fitnessFunction(population.get(k), lambda[k]);
f2 = fitnessFunction(individual, lambda[k]);
if (f2 < f1) {
population.set(k, (S)individual.copy());
time++;
}
if (time >= maximumNumberOfReplacedSolutions) {
return;
}
}
} | java | @SuppressWarnings("unchecked")
protected void updateNeighborhood(S individual, int subProblemId, NeighborType neighborType) throws JMetalException {
int size;
int time;
time = 0;
if (neighborType == NeighborType.NEIGHBOR) {
size = neighborhood[subProblemId].length;
} else {
size = population.size();
}
int[] perm = new int[size];
MOEADUtils.randomPermutation(perm, size);
for (int i = 0; i < size; i++) {
int k;
if (neighborType == NeighborType.NEIGHBOR) {
k = neighborhood[subProblemId][perm[i]];
} else {
k = perm[i];
}
double f1, f2;
f1 = fitnessFunction(population.get(k), lambda[k]);
f2 = fitnessFunction(individual, lambda[k]);
if (f2 < f1) {
population.set(k, (S)individual.copy());
time++;
}
if (time >= maximumNumberOfReplacedSolutions) {
return;
}
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"protected",
"void",
"updateNeighborhood",
"(",
"S",
"individual",
",",
"int",
"subProblemId",
",",
"NeighborType",
"neighborType",
")",
"throws",
"JMetalException",
"{",
"int",
"size",
";",
"int",
"time",
";",
... | Update neighborhood method
@param individual
@param subProblemId
@param neighborType
@throws JMetalException | [
"Update",
"neighborhood",
"method"
] | train | https://github.com/jMetal/jMetal/blob/bc981e6aede275d26c5216c9a01227d9675b0cf7/jmetal-algorithm/src/main/java/org/uma/jmetal/algorithm/multiobjective/moead/AbstractMOEAD.java#L230-L267 |
op4j/op4j | src/main/java/org/op4j/Op.java | Op.onArray | public static <T> Level0ArrayOperator<Short[],Short> onArray(final Short[] target) {
return onArrayOf(Types.SHORT, target);
} | java | public static <T> Level0ArrayOperator<Short[],Short> onArray(final Short[] target) {
return onArrayOf(Types.SHORT, target);
} | [
"public",
"static",
"<",
"T",
">",
"Level0ArrayOperator",
"<",
"Short",
"[",
"]",
",",
"Short",
">",
"onArray",
"(",
"final",
"Short",
"[",
"]",
"target",
")",
"{",
"return",
"onArrayOf",
"(",
"Types",
".",
"SHORT",
",",
"target",
")",
";",
"}"
] | <p>
Creates an <i>operation expression</i> on the specified target object.
</p>
@param target the target object on which the expression will execute
@return an operator, ready for chaining | [
"<p",
">",
"Creates",
"an",
"<i",
">",
"operation",
"expression<",
"/",
"i",
">",
"on",
"the",
"specified",
"target",
"object",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/op4j/op4j/blob/b577596dfe462089d3dd169666defc6de7ad289a/src/main/java/org/op4j/Op.java#L676-L678 |
BlueBrain/bluima | modules/bluima_typesystem/src/main/java/de/julielab/jules/types/OntRelationMention.java | OntRelationMention.setDomainList | public void setDomainList(int i, Annotation v) {
if (OntRelationMention_Type.featOkTst && ((OntRelationMention_Type)jcasType).casFeat_domainList == null)
jcasType.jcas.throwFeatMissing("domainList", "de.julielab.jules.types.OntRelationMention");
jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((OntRelationMention_Type)jcasType).casFeatCode_domainList), i);
jcasType.ll_cas.ll_setRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((OntRelationMention_Type)jcasType).casFeatCode_domainList), i, jcasType.ll_cas.ll_getFSRef(v));} | java | public void setDomainList(int i, Annotation v) {
if (OntRelationMention_Type.featOkTst && ((OntRelationMention_Type)jcasType).casFeat_domainList == null)
jcasType.jcas.throwFeatMissing("domainList", "de.julielab.jules.types.OntRelationMention");
jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((OntRelationMention_Type)jcasType).casFeatCode_domainList), i);
jcasType.ll_cas.ll_setRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((OntRelationMention_Type)jcasType).casFeatCode_domainList), i, jcasType.ll_cas.ll_getFSRef(v));} | [
"public",
"void",
"setDomainList",
"(",
"int",
"i",
",",
"Annotation",
"v",
")",
"{",
"if",
"(",
"OntRelationMention_Type",
".",
"featOkTst",
"&&",
"(",
"(",
"OntRelationMention_Type",
")",
"jcasType",
")",
".",
"casFeat_domainList",
"==",
"null",
")",
"jcasTy... | indexed setter for domainList - sets an indexed value -
@generated
@param i index in the array to set
@param v value to set into the array | [
"indexed",
"setter",
"for",
"domainList",
"-",
"sets",
"an",
"indexed",
"value",
"-"
] | train | https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_typesystem/src/main/java/de/julielab/jules/types/OntRelationMention.java#L160-L164 |
xetorthio/jedis | src/main/java/redis/clients/jedis/BinaryJedis.java | BinaryJedis.hincrBy | @Override
public Long hincrBy(final byte[] key, final byte[] field, final long value) {
checkIsInMultiOrPipeline();
client.hincrBy(key, field, value);
return client.getIntegerReply();
} | java | @Override
public Long hincrBy(final byte[] key, final byte[] field, final long value) {
checkIsInMultiOrPipeline();
client.hincrBy(key, field, value);
return client.getIntegerReply();
} | [
"@",
"Override",
"public",
"Long",
"hincrBy",
"(",
"final",
"byte",
"[",
"]",
"key",
",",
"final",
"byte",
"[",
"]",
"field",
",",
"final",
"long",
"value",
")",
"{",
"checkIsInMultiOrPipeline",
"(",
")",
";",
"client",
".",
"hincrBy",
"(",
"key",
",",... | Increment the number stored at field in the hash at key by value. If key does not exist, a new
key holding a hash is created. If field does not exist or holds a string, the value is set to 0
before applying the operation. Since the value argument is signed you can use this command to
perform both increments and decrements.
<p>
The range of values supported by HINCRBY is limited to 64 bit signed integers.
<p>
<b>Time complexity:</b> O(1)
@param key
@param field
@param value
@return Integer reply The new value at field after the increment operation. | [
"Increment",
"the",
"number",
"stored",
"at",
"field",
"in",
"the",
"hash",
"at",
"key",
"by",
"value",
".",
"If",
"key",
"does",
"not",
"exist",
"a",
"new",
"key",
"holding",
"a",
"hash",
"is",
"created",
".",
"If",
"field",
"does",
"not",
"exist",
... | train | https://github.com/xetorthio/jedis/blob/ef4ab403f9d8fd88bd05092fea96de2e9db0bede/src/main/java/redis/clients/jedis/BinaryJedis.java#L990-L995 |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/alg/transform/pyramid/PyramidOps.java | PyramidOps.reshapeOutput | public static <O extends ImageGray<O>>
void reshapeOutput( ImagePyramid<?> pyramid , O[] output ) {
for( int i = 0; i < output.length; i++ ) {
int w = pyramid.getWidth(i);
int h = pyramid.getHeight(i);
output[i].reshape(w, h);
}
} | java | public static <O extends ImageGray<O>>
void reshapeOutput( ImagePyramid<?> pyramid , O[] output ) {
for( int i = 0; i < output.length; i++ ) {
int w = pyramid.getWidth(i);
int h = pyramid.getHeight(i);
output[i].reshape(w, h);
}
} | [
"public",
"static",
"<",
"O",
"extends",
"ImageGray",
"<",
"O",
">",
">",
"void",
"reshapeOutput",
"(",
"ImagePyramid",
"<",
"?",
">",
"pyramid",
",",
"O",
"[",
"]",
"output",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"output",
"... | Reshapes each image in the array to match the layers in the pyramid
@param pyramid (Input) Image pyramid
@param output (Output) List of images which is to be resized
@param <O> Image type | [
"Reshapes",
"each",
"image",
"in",
"the",
"array",
"to",
"match",
"the",
"layers",
"in",
"the",
"pyramid"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/transform/pyramid/PyramidOps.java#L70-L78 |
cloudant/sync-android | cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/documentstore/AttachmentManager.java | AttachmentManager.fileFromKey | public static File fileFromKey(SQLDatabase db, byte[] key, String attachmentsDir,
boolean allowCreateName)
throws AttachmentException {
String keyString = keyToString(key);
String filename = null;
db.beginTransaction();
Cursor c = null;
try {
c = db.rawQuery(SQL_FILENAME_LOOKUP_QUERY, new String[]{ keyString });
if (c.moveToFirst()) {
filename = c.getString(0);
logger.finest(String.format("Found filename %s for key %s", filename, keyString));
} else if (allowCreateName) {
filename = generateFilenameForKey(db, keyString);
logger.finest(String.format("Added filename %s for key %s", filename, keyString));
}
db.setTransactionSuccessful();
} catch (SQLException e) {
logger.log(Level.WARNING, "Couldn't read key,filename mapping database", e);
filename = null;
} finally {
DatabaseUtils.closeCursorQuietly(c);
db.endTransaction();
}
if (filename != null) {
return new File(attachmentsDir, filename);
} else {
// generateFilenameForKey throws an exception if we couldn't generate, this
// means we couldn't get one from the database.
throw new AttachmentException("Couldn't retrieve filename for attachment");
}
} | java | public static File fileFromKey(SQLDatabase db, byte[] key, String attachmentsDir,
boolean allowCreateName)
throws AttachmentException {
String keyString = keyToString(key);
String filename = null;
db.beginTransaction();
Cursor c = null;
try {
c = db.rawQuery(SQL_FILENAME_LOOKUP_QUERY, new String[]{ keyString });
if (c.moveToFirst()) {
filename = c.getString(0);
logger.finest(String.format("Found filename %s for key %s", filename, keyString));
} else if (allowCreateName) {
filename = generateFilenameForKey(db, keyString);
logger.finest(String.format("Added filename %s for key %s", filename, keyString));
}
db.setTransactionSuccessful();
} catch (SQLException e) {
logger.log(Level.WARNING, "Couldn't read key,filename mapping database", e);
filename = null;
} finally {
DatabaseUtils.closeCursorQuietly(c);
db.endTransaction();
}
if (filename != null) {
return new File(attachmentsDir, filename);
} else {
// generateFilenameForKey throws an exception if we couldn't generate, this
// means we couldn't get one from the database.
throw new AttachmentException("Couldn't retrieve filename for attachment");
}
} | [
"public",
"static",
"File",
"fileFromKey",
"(",
"SQLDatabase",
"db",
",",
"byte",
"[",
"]",
"key",
",",
"String",
"attachmentsDir",
",",
"boolean",
"allowCreateName",
")",
"throws",
"AttachmentException",
"{",
"String",
"keyString",
"=",
"keyToString",
"(",
"key... | Lookup or create a on disk File representation of blob, in {@code db} using {@code key}.
Existing attachments will have an entry in db, so the method just looks this up
and returns the File object for the path.
For new attachments, the {@code key} doesn't already have an associated filename,
one is generated and inserted into the database before returning a File object
for blob associated with {@code key}.
@param db database to use.
@param key key to lookup filename for.
@param attachmentsDir Root directory for attachment blobs.
@param allowCreateName if the is no existing mapping, whether one should be created
and returned. If false, and no existing mapping, AttachmentException
is thrown.
@return File object for blob associated with {@code key}.
@throws AttachmentException if a mapping doesn't exist and {@code allowCreateName} is
false or if the name generation process fails. | [
"Lookup",
"or",
"create",
"a",
"on",
"disk",
"File",
"representation",
"of",
"blob",
"in",
"{",
"@code",
"db",
"}",
"using",
"{",
"@code",
"key",
"}",
"."
] | train | https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/documentstore/AttachmentManager.java#L497-L531 |
google/error-prone | core/src/main/java/com/google/errorprone/bugpatterns/nullness/NullnessFixes.java | NullnessFixes.makeFix | static SuggestedFix makeFix(VisitorState state, Tree declaration) {
SuggestedFix.Builder builder = SuggestedFix.builder();
String qualifiedName = getQualifiedName(state, builder);
return builder.prefixWith(declaration, "@" + qualifiedName + " ").build();
} | java | static SuggestedFix makeFix(VisitorState state, Tree declaration) {
SuggestedFix.Builder builder = SuggestedFix.builder();
String qualifiedName = getQualifiedName(state, builder);
return builder.prefixWith(declaration, "@" + qualifiedName + " ").build();
} | [
"static",
"SuggestedFix",
"makeFix",
"(",
"VisitorState",
"state",
",",
"Tree",
"declaration",
")",
"{",
"SuggestedFix",
".",
"Builder",
"builder",
"=",
"SuggestedFix",
".",
"builder",
"(",
")",
";",
"String",
"qualifiedName",
"=",
"getQualifiedName",
"(",
"stat... | Make the {@link SuggestedFix} to add the {@code Nullable} annotation. | [
"Make",
"the",
"{"
] | train | https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/core/src/main/java/com/google/errorprone/bugpatterns/nullness/NullnessFixes.java#L36-L40 |
mockito/mockito | src/main/java/org/mockito/internal/util/reflection/Fields.java | Fields.declaredFieldsOf | public static InstanceFields declaredFieldsOf(Object instance) {
List<InstanceField> instanceFields = new ArrayList<InstanceField>();
instanceFields.addAll(instanceFieldsIn(instance, instance.getClass().getDeclaredFields()));
return new InstanceFields(instance, instanceFields);
} | java | public static InstanceFields declaredFieldsOf(Object instance) {
List<InstanceField> instanceFields = new ArrayList<InstanceField>();
instanceFields.addAll(instanceFieldsIn(instance, instance.getClass().getDeclaredFields()));
return new InstanceFields(instance, instanceFields);
} | [
"public",
"static",
"InstanceFields",
"declaredFieldsOf",
"(",
"Object",
"instance",
")",
"{",
"List",
"<",
"InstanceField",
">",
"instanceFields",
"=",
"new",
"ArrayList",
"<",
"InstanceField",
">",
"(",
")",
";",
"instanceFields",
".",
"addAll",
"(",
"instance... | Instance fields declared in the class of the given instance.
@param instance Instance from which declared fields will be retrieved.
@return InstanceFields of this object instance. | [
"Instance",
"fields",
"declared",
"in",
"the",
"class",
"of",
"the",
"given",
"instance",
"."
] | train | https://github.com/mockito/mockito/blob/c5e2b80af76e3192cae7c9550b70c4d1ab312034/src/main/java/org/mockito/internal/util/reflection/Fields.java#L43-L47 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/NetworkInterfacesInner.java | NetworkInterfacesInner.beginListEffectiveNetworkSecurityGroupsAsync | public Observable<EffectiveNetworkSecurityGroupListResultInner> beginListEffectiveNetworkSecurityGroupsAsync(String resourceGroupName, String networkInterfaceName) {
return beginListEffectiveNetworkSecurityGroupsWithServiceResponseAsync(resourceGroupName, networkInterfaceName).map(new Func1<ServiceResponse<EffectiveNetworkSecurityGroupListResultInner>, EffectiveNetworkSecurityGroupListResultInner>() {
@Override
public EffectiveNetworkSecurityGroupListResultInner call(ServiceResponse<EffectiveNetworkSecurityGroupListResultInner> response) {
return response.body();
}
});
} | java | public Observable<EffectiveNetworkSecurityGroupListResultInner> beginListEffectiveNetworkSecurityGroupsAsync(String resourceGroupName, String networkInterfaceName) {
return beginListEffectiveNetworkSecurityGroupsWithServiceResponseAsync(resourceGroupName, networkInterfaceName).map(new Func1<ServiceResponse<EffectiveNetworkSecurityGroupListResultInner>, EffectiveNetworkSecurityGroupListResultInner>() {
@Override
public EffectiveNetworkSecurityGroupListResultInner call(ServiceResponse<EffectiveNetworkSecurityGroupListResultInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"EffectiveNetworkSecurityGroupListResultInner",
">",
"beginListEffectiveNetworkSecurityGroupsAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"networkInterfaceName",
")",
"{",
"return",
"beginListEffectiveNetworkSecurityGroupsWithServiceResponseAs... | Gets all network security groups applied to a network interface.
@param resourceGroupName The name of the resource group.
@param networkInterfaceName The name of the network interface.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the EffectiveNetworkSecurityGroupListResultInner object | [
"Gets",
"all",
"network",
"security",
"groups",
"applied",
"to",
"a",
"network",
"interface",
"."
] | 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/NetworkInterfacesInner.java#L1436-L1443 |
JavaMoney/jsr354-ri | moneta-core/src/main/java/org/javamoney/moneta/format/MonetaryAmountDecimalFormatBuilder.java | MonetaryAmountDecimalFormatBuilder.build | public MonetaryAmountFormat build() {
if (Objects.isNull(locale)) {
locale = Locale.getDefault();
}
if (Objects.isNull(decimalFormat)) {
decimalFormat = (DecimalFormat) NumberFormat.getCurrencyInstance(locale);
}
if (Objects.isNull(currencyUnit)) {
currencyUnit = Monetary.getCurrency(locale);
}
if (Objects.isNull(producer)) {
producer = new MoneyProducer();
}
decimalFormat.setCurrency(Currency.getInstance(currencyUnit.getCurrencyCode()));
return new MonetaryAmountDecimalFormat(decimalFormat, producer, currencyUnit);
} | java | public MonetaryAmountFormat build() {
if (Objects.isNull(locale)) {
locale = Locale.getDefault();
}
if (Objects.isNull(decimalFormat)) {
decimalFormat = (DecimalFormat) NumberFormat.getCurrencyInstance(locale);
}
if (Objects.isNull(currencyUnit)) {
currencyUnit = Monetary.getCurrency(locale);
}
if (Objects.isNull(producer)) {
producer = new MoneyProducer();
}
decimalFormat.setCurrency(Currency.getInstance(currencyUnit.getCurrencyCode()));
return new MonetaryAmountDecimalFormat(decimalFormat, producer, currencyUnit);
} | [
"public",
"MonetaryAmountFormat",
"build",
"(",
")",
"{",
"if",
"(",
"Objects",
".",
"isNull",
"(",
"locale",
")",
")",
"{",
"locale",
"=",
"Locale",
".",
"getDefault",
"(",
")",
";",
"}",
"if",
"(",
"Objects",
".",
"isNull",
"(",
"decimalFormat",
")",... | Creates the {@link MonetaryAmountFormat}
If @{link Locale} didn't set the default value is {@link Locale#getDefault()}
If @{link MonetaryAmountProducer} didn't set the default value is {@link MoneyProducer}
If @{link CurrencyUnit} didn't set the default value is a currency from {@link Locale}
@return {@link MonetaryAmountFormat} | [
"Creates",
"the",
"{"
] | train | https://github.com/JavaMoney/jsr354-ri/blob/cf8ff2bbaf9b115acc05eb9b0c76c8397c308284/moneta-core/src/main/java/org/javamoney/moneta/format/MonetaryAmountDecimalFormatBuilder.java#L129-L144 |
census-instrumentation/opencensus-java | api/src/main/java/io/opencensus/trace/SpanId.java | SpanId.fromLowerBase16 | public static SpanId fromLowerBase16(CharSequence src) {
Utils.checkNotNull(src, "src");
// TODO: Remove this extra condition.
Utils.checkArgument(
src.length() == BASE16_SIZE,
"Invalid size: expected %s, got %s",
BASE16_SIZE,
src.length());
return fromLowerBase16(src, 0);
} | java | public static SpanId fromLowerBase16(CharSequence src) {
Utils.checkNotNull(src, "src");
// TODO: Remove this extra condition.
Utils.checkArgument(
src.length() == BASE16_SIZE,
"Invalid size: expected %s, got %s",
BASE16_SIZE,
src.length());
return fromLowerBase16(src, 0);
} | [
"public",
"static",
"SpanId",
"fromLowerBase16",
"(",
"CharSequence",
"src",
")",
"{",
"Utils",
".",
"checkNotNull",
"(",
"src",
",",
"\"src\"",
")",
";",
"// TODO: Remove this extra condition.",
"Utils",
".",
"checkArgument",
"(",
"src",
".",
"length",
"(",
")"... | Returns a {@code SpanId} built from a lowercase base16 representation.
@param src the lowercase base16 representation.
@return a {@code SpanId} built from a lowercase base16 representation.
@throws NullPointerException if {@code src} is null.
@throws IllegalArgumentException if {@code src.length} is not {@code 2 * SpanId.SIZE} OR if the
{@code str} has invalid characters.
@since 0.11 | [
"Returns",
"a",
"{",
"@code",
"SpanId",
"}",
"built",
"from",
"a",
"lowercase",
"base16",
"representation",
"."
] | train | https://github.com/census-instrumentation/opencensus-java/blob/deefac9bed77e40a2297bff1ca5ec5aa48a5f755/api/src/main/java/io/opencensus/trace/SpanId.java#L100-L109 |
box/box-java-sdk | src/main/java/com/box/sdk/BoxUser.java | BoxUser.createEnterpriseUser | public static BoxUser.Info createEnterpriseUser(BoxAPIConnection api, String login, String name) {
return createEnterpriseUser(api, login, name, null);
} | java | public static BoxUser.Info createEnterpriseUser(BoxAPIConnection api, String login, String name) {
return createEnterpriseUser(api, login, name, null);
} | [
"public",
"static",
"BoxUser",
".",
"Info",
"createEnterpriseUser",
"(",
"BoxAPIConnection",
"api",
",",
"String",
"login",
",",
"String",
"name",
")",
"{",
"return",
"createEnterpriseUser",
"(",
"api",
",",
"login",
",",
"name",
",",
"null",
")",
";",
"}"
] | Provisions a new user in an enterprise.
@param api the API connection to be used by the created user.
@param login the email address the user will use to login.
@param name the name of the user.
@return the created user's info. | [
"Provisions",
"a",
"new",
"user",
"in",
"an",
"enterprise",
"."
] | train | https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/BoxUser.java#L108-L110 |
iig-uni-freiburg/SEWOL | ext/org/deckfour/xes/extension/std/XOrganizationalExtension.java | XOrganizationalExtension.assignResource | public void assignResource(XEvent event, String resource) {
if (resource != null && resource.trim().length() > 0) {
XAttributeLiteral attr = (XAttributeLiteral) ATTR_RESOURCE.clone();
attr.setValue(resource.trim());
event.getAttributes().put(KEY_RESOURCE, attr);
}
} | java | public void assignResource(XEvent event, String resource) {
if (resource != null && resource.trim().length() > 0) {
XAttributeLiteral attr = (XAttributeLiteral) ATTR_RESOURCE.clone();
attr.setValue(resource.trim());
event.getAttributes().put(KEY_RESOURCE, attr);
}
} | [
"public",
"void",
"assignResource",
"(",
"XEvent",
"event",
",",
"String",
"resource",
")",
"{",
"if",
"(",
"resource",
"!=",
"null",
"&&",
"resource",
".",
"trim",
"(",
")",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"XAttributeLiteral",
"attr",
"="... | Assigns the resource attribute value for a given event.
@param event
Event to be modified.
@param resource
Resource string to be assigned. | [
"Assigns",
"the",
"resource",
"attribute",
"value",
"for",
"a",
"given",
"event",
"."
] | train | https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/ext/org/deckfour/xes/extension/std/XOrganizationalExtension.java#L195-L201 |
feedzai/pdb | src/main/java/com/feedzai/commons/sql/abstraction/engine/AbstractDatabaseEngine.java | AbstractDatabaseEngine.addBatch | @Override
public synchronized void addBatch(final String name, final EntityEntry entry) throws DatabaseEngineException {
try {
final MappedEntity me = entities.get(name);
if (me == null) {
throw new DatabaseEngineException(String.format("Unknown entity '%s'", name));
}
PreparedStatement ps = me.getInsert();
entityToPreparedStatement(me.getEntity(), ps, entry, true);
ps.addBatch();
} catch (final Exception ex) {
throw new DatabaseEngineException("Error adding to batch", ex);
}
} | java | @Override
public synchronized void addBatch(final String name, final EntityEntry entry) throws DatabaseEngineException {
try {
final MappedEntity me = entities.get(name);
if (me == null) {
throw new DatabaseEngineException(String.format("Unknown entity '%s'", name));
}
PreparedStatement ps = me.getInsert();
entityToPreparedStatement(me.getEntity(), ps, entry, true);
ps.addBatch();
} catch (final Exception ex) {
throw new DatabaseEngineException("Error adding to batch", ex);
}
} | [
"@",
"Override",
"public",
"synchronized",
"void",
"addBatch",
"(",
"final",
"String",
"name",
",",
"final",
"EntityEntry",
"entry",
")",
"throws",
"DatabaseEngineException",
"{",
"try",
"{",
"final",
"MappedEntity",
"me",
"=",
"entities",
".",
"get",
"(",
"na... | Add an entry to the batch.
@param name The entity name.
@param entry The entry to persist.
@throws DatabaseEngineException If something goes wrong while persisting data. | [
"Add",
"an",
"entry",
"to",
"the",
"batch",
"."
] | train | https://github.com/feedzai/pdb/blob/fe07ca08417e0ddcd620a36aa1fdbca7f338be98/src/main/java/com/feedzai/commons/sql/abstraction/engine/AbstractDatabaseEngine.java#L1026-L1045 |
contentful/contentful-management.java | src/main/java/com/contentful/java/cma/model/CMAEntry.java | CMAEntry.getField | @SuppressWarnings("unchecked")
public <T> T getField(String key, String locale) {
if (fields == null) {
return null;
}
LinkedHashMap<String, Object> field = fields.get(key);
if (field == null) {
return null;
} else {
return (T) field.get(locale);
}
} | java | @SuppressWarnings("unchecked")
public <T> T getField(String key, String locale) {
if (fields == null) {
return null;
}
LinkedHashMap<String, Object> field = fields.get(key);
if (field == null) {
return null;
} else {
return (T) field.get(locale);
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"T",
">",
"T",
"getField",
"(",
"String",
"key",
",",
"String",
"locale",
")",
"{",
"if",
"(",
"fields",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"LinkedHashMap",
"<",
"Strin... | Return a specific localized field.
@param key the key of the field
@param locale the locale of the key
@param <T> the type of the return value
@return the value requested or null, if something (fields, key, locale) was not found. | [
"Return",
"a",
"specific",
"localized",
"field",
"."
] | train | https://github.com/contentful/contentful-management.java/blob/ca310fb9ea9577fcff0ca57949ab7c2315fa2534/src/main/java/com/contentful/java/cma/model/CMAEntry.java#L122-L134 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.