repository_name stringlengths 7 58 | func_path_in_repository stringlengths 11 218 | func_name stringlengths 4 140 | whole_func_string stringlengths 153 5.32k | language stringclasses 1
value | func_code_string stringlengths 72 4k | func_code_tokens listlengths 20 832 | func_documentation_string stringlengths 61 2k | func_documentation_tokens listlengths 1 647 | split_name stringclasses 1
value | func_code_url stringlengths 102 339 |
|---|---|---|---|---|---|---|---|---|---|---|
Whiley/WhileyCompiler | src/main/java/wyil/type/util/ReadWriteTypeExtractor.java | ReadWriteTypeExtractor.intersectionHelper | protected static SemanticType intersectionHelper(SemanticType lhs, SemanticType rhs) {
"""
Provides a simplistic form of type intersect which, in some cases, does
slightly better than simply creating a new intersection. For example,
intersecting <code>int</code> with <code>int</code> will return
<code>int</code> rather than <code>int&int</code>.
@param lhs
@param rhs
@return
"""
if (lhs.equals(rhs)) {
return lhs;
} else if (lhs instanceof Type.Void) {
return lhs;
} else if (rhs instanceof Type.Void) {
return rhs;
} else {
return new SemanticType.Intersection(new SemanticType[] { lhs, rhs });
}
} | java | protected static SemanticType intersectionHelper(SemanticType lhs, SemanticType rhs) {
if (lhs.equals(rhs)) {
return lhs;
} else if (lhs instanceof Type.Void) {
return lhs;
} else if (rhs instanceof Type.Void) {
return rhs;
} else {
return new SemanticType.Intersection(new SemanticType[] { lhs, rhs });
}
} | [
"protected",
"static",
"SemanticType",
"intersectionHelper",
"(",
"SemanticType",
"lhs",
",",
"SemanticType",
"rhs",
")",
"{",
"if",
"(",
"lhs",
".",
"equals",
"(",
"rhs",
")",
")",
"{",
"return",
"lhs",
";",
"}",
"else",
"if",
"(",
"lhs",
"instanceof",
... | Provides a simplistic form of type intersect which, in some cases, does
slightly better than simply creating a new intersection. For example,
intersecting <code>int</code> with <code>int</code> will return
<code>int</code> rather than <code>int&int</code>.
@param lhs
@param rhs
@return | [
"Provides",
"a",
"simplistic",
"form",
"of",
"type",
"intersect",
"which",
"in",
"some",
"cases",
"does",
"slightly",
"better",
"than",
"simply",
"creating",
"a",
"new",
"intersection",
".",
"For",
"example",
"intersecting",
"<code",
">",
"int<",
"/",
"code",
... | train | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/type/util/ReadWriteTypeExtractor.java#L872-L882 |
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) {
"""
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
"""
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 |
apache/incubator-gobblin | gobblin-modules/google-ingestion/src/main/java/org/apache/gobblin/ingestion/google/webmaster/TrieBasedProducerJob.java | TrieBasedProducerJob.partitionJobs | @Override
public List<? extends ProducerJob> partitionJobs() {
"""
The implementation here will first partition the job by pages, and then by dates.
@return
"""
UrlTrieNode root = _jobNode.getRight();
if (isOperatorEquals() || root.getSize() == 1) {
//Either at an Equals-Node or a Leaf-Node, both of which actually has actual size 1.
return super.partitionJobs();
} else {
if (_groupSize <= 1) {
throw new RuntimeException("This is impossible. When group size is 1, the operator must be equals");
}
UrlTrie trie = new UrlTrie(getPage(), root);
int gs = Math.min(root.getSize(), _groupSize);
UrlTriePrefixGrouper grouper = new UrlTriePrefixGrouper(trie, (int) Math.ceil(gs / 2.0));
List<TrieBasedProducerJob> jobs = new ArrayList<>();
while (grouper.hasNext()) {
jobs.add(new TrieBasedProducerJob(_startDate, _endDate, grouper.next(), grouper.getGroupSize()));
}
return jobs;
}
} | java | @Override
public List<? extends ProducerJob> partitionJobs() {
UrlTrieNode root = _jobNode.getRight();
if (isOperatorEquals() || root.getSize() == 1) {
//Either at an Equals-Node or a Leaf-Node, both of which actually has actual size 1.
return super.partitionJobs();
} else {
if (_groupSize <= 1) {
throw new RuntimeException("This is impossible. When group size is 1, the operator must be equals");
}
UrlTrie trie = new UrlTrie(getPage(), root);
int gs = Math.min(root.getSize(), _groupSize);
UrlTriePrefixGrouper grouper = new UrlTriePrefixGrouper(trie, (int) Math.ceil(gs / 2.0));
List<TrieBasedProducerJob> jobs = new ArrayList<>();
while (grouper.hasNext()) {
jobs.add(new TrieBasedProducerJob(_startDate, _endDate, grouper.next(), grouper.getGroupSize()));
}
return jobs;
}
} | [
"@",
"Override",
"public",
"List",
"<",
"?",
"extends",
"ProducerJob",
">",
"partitionJobs",
"(",
")",
"{",
"UrlTrieNode",
"root",
"=",
"_jobNode",
".",
"getRight",
"(",
")",
";",
"if",
"(",
"isOperatorEquals",
"(",
")",
"||",
"root",
".",
"getSize",
"("... | The implementation here will first partition the job by pages, and then by dates.
@return | [
"The",
"implementation",
"here",
"will",
"first",
"partition",
"the",
"job",
"by",
"pages",
"and",
"then",
"by",
"dates",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-modules/google-ingestion/src/main/java/org/apache/gobblin/ingestion/google/webmaster/TrieBasedProducerJob.java#L73-L95 |
threerings/nenya | tools/src/main/java/com/threerings/media/tile/tools/xml/XMLTileSetParser.java | XMLTileSetParser.loadTileSets | public void loadTileSets (String path, Map<String, TileSet> tilesets)
throws IOException {
"""
Loads all of the tilesets specified in the supplied XML tileset
description file and places them into the supplied map indexed
by tileset name. This method is not reentrant, so don't go calling
it from multiple threads.
@param path a path, relative to the classpath, at which the tileset
definition file can be found.
@param tilesets the map into which the tilesets will be placed,
indexed by tileset name.
"""
// get an input stream for this XML file
InputStream is = ConfigUtil.getStream(path);
if (is == null) {
String errmsg = "Can't load tileset description file from " +
"classpath [path=" + path + "].";
throw new FileNotFoundException(errmsg);
}
// load up the tilesets
loadTileSets(is, tilesets);
} | java | public void loadTileSets (String path, Map<String, TileSet> tilesets)
throws IOException
{
// get an input stream for this XML file
InputStream is = ConfigUtil.getStream(path);
if (is == null) {
String errmsg = "Can't load tileset description file from " +
"classpath [path=" + path + "].";
throw new FileNotFoundException(errmsg);
}
// load up the tilesets
loadTileSets(is, tilesets);
} | [
"public",
"void",
"loadTileSets",
"(",
"String",
"path",
",",
"Map",
"<",
"String",
",",
"TileSet",
">",
"tilesets",
")",
"throws",
"IOException",
"{",
"// get an input stream for this XML file",
"InputStream",
"is",
"=",
"ConfigUtil",
".",
"getStream",
"(",
"path... | Loads all of the tilesets specified in the supplied XML tileset
description file and places them into the supplied map indexed
by tileset name. This method is not reentrant, so don't go calling
it from multiple threads.
@param path a path, relative to the classpath, at which the tileset
definition file can be found.
@param tilesets the map into which the tilesets will be placed,
indexed by tileset name. | [
"Loads",
"all",
"of",
"the",
"tilesets",
"specified",
"in",
"the",
"supplied",
"XML",
"tileset",
"description",
"file",
"and",
"places",
"them",
"into",
"the",
"supplied",
"map",
"indexed",
"by",
"tileset",
"name",
".",
"This",
"method",
"is",
"not",
"reentr... | train | https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/tools/src/main/java/com/threerings/media/tile/tools/xml/XMLTileSetParser.java#L97-L110 |
openengsb/openengsb | components/util/src/main/java/org/openengsb/core/util/OsgiUtils.java | OsgiUtils.getFilterForLocation | public static Filter getFilterForLocation(Class<?> clazz, String location, String context)
throws IllegalArgumentException {
"""
returns a filter that matches services with the given class and location in both the given context and the
root-context
@throws IllegalArgumentException if the location contains special characters that prevent the filter from
compiling
"""
String filter = makeLocationFilterString(location, context);
return FilterUtils.makeFilter(clazz, filter);
} | java | public static Filter getFilterForLocation(Class<?> clazz, String location, String context)
throws IllegalArgumentException {
String filter = makeLocationFilterString(location, context);
return FilterUtils.makeFilter(clazz, filter);
} | [
"public",
"static",
"Filter",
"getFilterForLocation",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"String",
"location",
",",
"String",
"context",
")",
"throws",
"IllegalArgumentException",
"{",
"String",
"filter",
"=",
"makeLocationFilterString",
"(",
"location",
"... | returns a filter that matches services with the given class and location in both the given context and the
root-context
@throws IllegalArgumentException if the location contains special characters that prevent the filter from
compiling | [
"returns",
"a",
"filter",
"that",
"matches",
"services",
"with",
"the",
"given",
"class",
"and",
"location",
"in",
"both",
"the",
"given",
"context",
"and",
"the",
"root",
"-",
"context"
] | train | https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/components/util/src/main/java/org/openengsb/core/util/OsgiUtils.java#L40-L44 |
liferay/com-liferay-commerce | commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceOrderItemPersistenceImpl.java | CommerceOrderItemPersistenceImpl.findByCommerceOrderId | @Override
public List<CommerceOrderItem> findByCommerceOrderId(long commerceOrderId,
int start, int end) {
"""
Returns a range of all the commerce order items where commerceOrderId = ?.
<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 CommerceOrderItemModelImpl}. 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 commerceOrderId the commerce order ID
@param start the lower bound of the range of commerce order items
@param end the upper bound of the range of commerce order items (not inclusive)
@return the range of matching commerce order items
"""
return findByCommerceOrderId(commerceOrderId, start, end, null);
} | java | @Override
public List<CommerceOrderItem> findByCommerceOrderId(long commerceOrderId,
int start, int end) {
return findByCommerceOrderId(commerceOrderId, start, end, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CommerceOrderItem",
">",
"findByCommerceOrderId",
"(",
"long",
"commerceOrderId",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"return",
"findByCommerceOrderId",
"(",
"commerceOrderId",
",",
"start",
",",
"end",
",",... | Returns a range of all the commerce order items where commerceOrderId = ?.
<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 CommerceOrderItemModelImpl}. 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 commerceOrderId the commerce order ID
@param start the lower bound of the range of commerce order items
@param end the upper bound of the range of commerce order items (not inclusive)
@return the range of matching commerce order items | [
"Returns",
"a",
"range",
"of",
"all",
"the",
"commerce",
"order",
"items",
"where",
"commerceOrderId",
"=",
"?",
";",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceOrderItemPersistenceImpl.java#L143-L147 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/string/StringHelper.java | StringHelper.getOccurrenceCount | @Nonnegative
public static int getOccurrenceCount (@Nullable final String sText, @Nullable final String sSearch) {
"""
Count the number of occurrences of sSearch within sText.
@param sText
The text to search in. May be <code>null</code>.
@param sSearch
The text to search for. May be <code>null</code>.
@return A non-negative number of occurrences.
"""
int ret = 0;
final int nTextLength = getLength (sText);
final int nSearchLength = getLength (sSearch);
if (nSearchLength > 0 && nTextLength >= nSearchLength)
{
int nLastIndex = 0;
int nIndex;
do
{
// Start searching from the last result
nIndex = getIndexOf (sText, nLastIndex, sSearch);
if (nIndex != STRING_NOT_FOUND)
{
// Match found
++ret;
// Identify the next starting position (relative index + number of
// search strings)
nLastIndex = nIndex + nSearchLength;
}
} while (nIndex != STRING_NOT_FOUND);
}
return ret;
} | java | @Nonnegative
public static int getOccurrenceCount (@Nullable final String sText, @Nullable final String sSearch)
{
int ret = 0;
final int nTextLength = getLength (sText);
final int nSearchLength = getLength (sSearch);
if (nSearchLength > 0 && nTextLength >= nSearchLength)
{
int nLastIndex = 0;
int nIndex;
do
{
// Start searching from the last result
nIndex = getIndexOf (sText, nLastIndex, sSearch);
if (nIndex != STRING_NOT_FOUND)
{
// Match found
++ret;
// Identify the next starting position (relative index + number of
// search strings)
nLastIndex = nIndex + nSearchLength;
}
} while (nIndex != STRING_NOT_FOUND);
}
return ret;
} | [
"@",
"Nonnegative",
"public",
"static",
"int",
"getOccurrenceCount",
"(",
"@",
"Nullable",
"final",
"String",
"sText",
",",
"@",
"Nullable",
"final",
"String",
"sSearch",
")",
"{",
"int",
"ret",
"=",
"0",
";",
"final",
"int",
"nTextLength",
"=",
"getLength",... | Count the number of occurrences of sSearch within sText.
@param sText
The text to search in. May be <code>null</code>.
@param sSearch
The text to search for. May be <code>null</code>.
@return A non-negative number of occurrences. | [
"Count",
"the",
"number",
"of",
"occurrences",
"of",
"sSearch",
"within",
"sText",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L3136-L3162 |
alkacon/opencms-core | src-modules/org/opencms/workplace/tools/modules/CmsModulesDelete.java | CmsModulesDelete.actionReport | public void actionReport() throws JspException {
"""
Performs the re-initialization report, will be called by the JSP page.<p>
@throws JspException if including the error JSP element fails
"""
// save initialized instance of this class in request attribute for included sub-elements
getJsp().getRequest().setAttribute(SESSION_WORKPLACE_CLASS, this);
switch (getAction()) {
case ACTION_CONFIRMED:
default:
try {
Map params = new HashMap();
params.put(PARAM_MODULE, getParamModule());
// set style to display report in correct layout
params.put(PARAM_STYLE, CmsToolDialog.STYLE_NEW);
// set close link to get back to overview after finishing the import
params.put(PARAM_CLOSELINK, CmsToolManager.linkForToolPath(getJsp(), "/modules"));
// redirect to the report output JSP
getToolManager().jspForwardPage(this, DELETE_ACTION_REPORT, params);
actionCloseDialog();
} catch (Throwable e) {
// create a new Exception with custom message
includeErrorpage(this, e);
}
break;
}
} | java | public void actionReport() throws JspException {
// save initialized instance of this class in request attribute for included sub-elements
getJsp().getRequest().setAttribute(SESSION_WORKPLACE_CLASS, this);
switch (getAction()) {
case ACTION_CONFIRMED:
default:
try {
Map params = new HashMap();
params.put(PARAM_MODULE, getParamModule());
// set style to display report in correct layout
params.put(PARAM_STYLE, CmsToolDialog.STYLE_NEW);
// set close link to get back to overview after finishing the import
params.put(PARAM_CLOSELINK, CmsToolManager.linkForToolPath(getJsp(), "/modules"));
// redirect to the report output JSP
getToolManager().jspForwardPage(this, DELETE_ACTION_REPORT, params);
actionCloseDialog();
} catch (Throwable e) {
// create a new Exception with custom message
includeErrorpage(this, e);
}
break;
}
} | [
"public",
"void",
"actionReport",
"(",
")",
"throws",
"JspException",
"{",
"// save initialized instance of this class in request attribute for included sub-elements",
"getJsp",
"(",
")",
".",
"getRequest",
"(",
")",
".",
"setAttribute",
"(",
"SESSION_WORKPLACE_CLASS",
",",
... | Performs the re-initialization report, will be called by the JSP page.<p>
@throws JspException if including the error JSP element fails | [
"Performs",
"the",
"re",
"-",
"initialization",
"report",
"will",
"be",
"called",
"by",
"the",
"JSP",
"page",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/tools/modules/CmsModulesDelete.java#L90-L114 |
bmelnychuk/AndroidTreeView | library/src/main/java/com/unnamed/b/atv/view/TwoDScrollView.java | TwoDScrollView.scrollToChildRect | private boolean scrollToChildRect(Rect rect, boolean immediate) {
"""
If rect is off screen, scroll just enough to get it (or at least the
first screen size chunk of it) on screen.
@param rect The rectangle.
@param immediate True to scroll immediately without animation
@return true if scrolling was performed
"""
final int delta = computeScrollDeltaToGetChildRectOnScreen(rect);
final boolean scroll = delta != 0;
if (scroll) {
if (immediate) {
scrollBy(0, delta);
} else {
smoothScrollBy(0, delta);
}
}
return scroll;
} | java | private boolean scrollToChildRect(Rect rect, boolean immediate) {
final int delta = computeScrollDeltaToGetChildRectOnScreen(rect);
final boolean scroll = delta != 0;
if (scroll) {
if (immediate) {
scrollBy(0, delta);
} else {
smoothScrollBy(0, delta);
}
}
return scroll;
} | [
"private",
"boolean",
"scrollToChildRect",
"(",
"Rect",
"rect",
",",
"boolean",
"immediate",
")",
"{",
"final",
"int",
"delta",
"=",
"computeScrollDeltaToGetChildRectOnScreen",
"(",
"rect",
")",
";",
"final",
"boolean",
"scroll",
"=",
"delta",
"!=",
"0",
";",
... | If rect is off screen, scroll just enough to get it (or at least the
first screen size chunk of it) on screen.
@param rect The rectangle.
@param immediate True to scroll immediately without animation
@return true if scrolling was performed | [
"If",
"rect",
"is",
"off",
"screen",
"scroll",
"just",
"enough",
"to",
"get",
"it",
"(",
"or",
"at",
"least",
"the",
"first",
"screen",
"size",
"chunk",
"of",
"it",
")",
"on",
"screen",
"."
] | train | https://github.com/bmelnychuk/AndroidTreeView/blob/d051ce75f5c9bd5206481808f6133b51f581c8f1/library/src/main/java/com/unnamed/b/atv/view/TwoDScrollView.java#L858-L869 |
aws/aws-sdk-java | aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/model/Get.java | Get.withExpressionAttributeNames | public Get withExpressionAttributeNames(java.util.Map<String, String> expressionAttributeNames) {
"""
<p>
One or more substitution tokens for attribute names in the ProjectionExpression parameter.
</p>
@param expressionAttributeNames
One or more substitution tokens for attribute names in the ProjectionExpression parameter.
@return Returns a reference to this object so that method calls can be chained together.
"""
setExpressionAttributeNames(expressionAttributeNames);
return this;
} | java | public Get withExpressionAttributeNames(java.util.Map<String, String> expressionAttributeNames) {
setExpressionAttributeNames(expressionAttributeNames);
return this;
} | [
"public",
"Get",
"withExpressionAttributeNames",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"expressionAttributeNames",
")",
"{",
"setExpressionAttributeNames",
"(",
"expressionAttributeNames",
")",
";",
"return",
"this",
";",
"}"
] | <p>
One or more substitution tokens for attribute names in the ProjectionExpression parameter.
</p>
@param expressionAttributeNames
One or more substitution tokens for attribute names in the ProjectionExpression parameter.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"One",
"or",
"more",
"substitution",
"tokens",
"for",
"attribute",
"names",
"in",
"the",
"ProjectionExpression",
"parameter",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/model/Get.java#L255-L258 |
rwl/CSparseJ | src/main/java/edu/emory/mathcs/csparsej/tdouble/Dcs_entry.java | Dcs_entry.cs_entry | public static boolean cs_entry(Dcs T, int i, int j, double x) {
"""
Adds an entry to a triplet matrix. Memory-space and dimension of T are
increased if necessary.
@param T
triplet matrix; new entry added on output
@param i
row index of new entry
@param j
column index of new entry
@param x
numerical value of new entry
@return true if successful, false otherwise
"""
if (!Dcs_util.CS_TRIPLET(T) || i < 0 || j < 0)
return (false); /* check inputs */
if (T.nz >= T.nzmax) {
Dcs_util.cs_sprealloc(T, 2 * (T.nzmax));
}
if (T.x != null)
T.x[T.nz] = x;
T.i[T.nz] = i;
T.p[T.nz++] = j;
T.m = Math.max(T.m, i + 1);
T.n = Math.max(T.n, j + 1);
return (true);
} | java | public static boolean cs_entry(Dcs T, int i, int j, double x) {
if (!Dcs_util.CS_TRIPLET(T) || i < 0 || j < 0)
return (false); /* check inputs */
if (T.nz >= T.nzmax) {
Dcs_util.cs_sprealloc(T, 2 * (T.nzmax));
}
if (T.x != null)
T.x[T.nz] = x;
T.i[T.nz] = i;
T.p[T.nz++] = j;
T.m = Math.max(T.m, i + 1);
T.n = Math.max(T.n, j + 1);
return (true);
} | [
"public",
"static",
"boolean",
"cs_entry",
"(",
"Dcs",
"T",
",",
"int",
"i",
",",
"int",
"j",
",",
"double",
"x",
")",
"{",
"if",
"(",
"!",
"Dcs_util",
".",
"CS_TRIPLET",
"(",
"T",
")",
"||",
"i",
"<",
"0",
"||",
"j",
"<",
"0",
")",
"return",
... | Adds an entry to a triplet matrix. Memory-space and dimension of T are
increased if necessary.
@param T
triplet matrix; new entry added on output
@param i
row index of new entry
@param j
column index of new entry
@param x
numerical value of new entry
@return true if successful, false otherwise | [
"Adds",
"an",
"entry",
"to",
"a",
"triplet",
"matrix",
".",
"Memory",
"-",
"space",
"and",
"dimension",
"of",
"T",
"are",
"increased",
"if",
"necessary",
"."
] | train | https://github.com/rwl/CSparseJ/blob/6a6f66bccce1558156a961494358952603b0ac84/src/main/java/edu/emory/mathcs/csparsej/tdouble/Dcs_entry.java#L50-L63 |
redisson/redisson | redisson/src/main/java/org/redisson/executor/CronExpression.java | CronExpression.setCalendarHour | protected void setCalendarHour(Calendar cal, int hour) {
"""
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
"""
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 |
jamesagnew/hapi-fhir | hapi-fhir-base/src/main/java/ca/uhn/fhir/util/FhirTerser.java | FhirTerser.getValues | public List<Object> getValues(IBaseResource theResource, String thePath) {
"""
Returns values stored in an element identified by its path. The list of values is of
type {@link Object}.
@param theResource The resource instance to be accessed. Must not be null.
@param thePath The path for the element to be accessed.
@return A list of values of type {@link Object}.
"""
Class<Object> wantedClass = Object.class;
return getValues(theResource, thePath, wantedClass);
} | java | public List<Object> getValues(IBaseResource theResource, String thePath) {
Class<Object> wantedClass = Object.class;
return getValues(theResource, thePath, wantedClass);
} | [
"public",
"List",
"<",
"Object",
">",
"getValues",
"(",
"IBaseResource",
"theResource",
",",
"String",
"thePath",
")",
"{",
"Class",
"<",
"Object",
">",
"wantedClass",
"=",
"Object",
".",
"class",
";",
"return",
"getValues",
"(",
"theResource",
",",
"thePath... | Returns values stored in an element identified by its path. The list of values is of
type {@link Object}.
@param theResource The resource instance to be accessed. Must not be null.
@param thePath The path for the element to be accessed.
@return A list of values of type {@link Object}. | [
"Returns",
"values",
"stored",
"in",
"an",
"element",
"identified",
"by",
"its",
"path",
".",
"The",
"list",
"of",
"values",
"is",
"of",
"type",
"{",
"@link",
"Object",
"}",
"."
] | train | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/FhirTerser.java#L485-L489 |
b3dgs/lionengine | lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/Factory.java | Factory.createSetup | @SuppressWarnings("unchecked")
private Setup createSetup(Media media) {
"""
Create a setup from its media.
@param media The media reference.
@return The setup instance.
"""
final Configurer configurer = new Configurer(media);
try
{
final FeaturableConfig config = FeaturableConfig.imports(configurer);
final String setup = config.getSetupName();
final Class<? extends Setup> setupClass;
if (setup.isEmpty())
{
final Class<?> clazz = classLoader.loadClass(config.getClassName());
final Constructor<?> constructor = UtilReflection.getCompatibleConstructorParent(clazz, new Class<?>[]
{
Services.class, Setup.class
});
setupClass = (Class<? extends Setup>) constructor.getParameterTypes()[SETUP_INDEX];
}
else
{
setupClass = (Class<? extends Setup>) classLoader.loadClass(config.getSetupName());
}
return UtilReflection.create(setupClass, new Class<?>[]
{
Media.class
}, media);
}
catch (final ClassNotFoundException exception)
{
throw new LionEngineException(exception, ERROR_SETUP_CLASS);
}
catch (final NoSuchMethodException exception)
{
throw new LionEngineException(exception, ERROR_CONSTRUCTOR_MISSING + media.getPath());
}
} | java | @SuppressWarnings("unchecked")
private Setup createSetup(Media media)
{
final Configurer configurer = new Configurer(media);
try
{
final FeaturableConfig config = FeaturableConfig.imports(configurer);
final String setup = config.getSetupName();
final Class<? extends Setup> setupClass;
if (setup.isEmpty())
{
final Class<?> clazz = classLoader.loadClass(config.getClassName());
final Constructor<?> constructor = UtilReflection.getCompatibleConstructorParent(clazz, new Class<?>[]
{
Services.class, Setup.class
});
setupClass = (Class<? extends Setup>) constructor.getParameterTypes()[SETUP_INDEX];
}
else
{
setupClass = (Class<? extends Setup>) classLoader.loadClass(config.getSetupName());
}
return UtilReflection.create(setupClass, new Class<?>[]
{
Media.class
}, media);
}
catch (final ClassNotFoundException exception)
{
throw new LionEngineException(exception, ERROR_SETUP_CLASS);
}
catch (final NoSuchMethodException exception)
{
throw new LionEngineException(exception, ERROR_CONSTRUCTOR_MISSING + media.getPath());
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"Setup",
"createSetup",
"(",
"Media",
"media",
")",
"{",
"final",
"Configurer",
"configurer",
"=",
"new",
"Configurer",
"(",
"media",
")",
";",
"try",
"{",
"final",
"FeaturableConfig",
"config",
"=... | Create a setup from its media.
@param media The media reference.
@return The setup instance. | [
"Create",
"a",
"setup",
"from",
"its",
"media",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/Factory.java#L215-L250 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/AzureFirewallsInner.java | AzureFirewallsInner.getByResourceGroup | public AzureFirewallInner getByResourceGroup(String resourceGroupName, String azureFirewallName) {
"""
Gets the specified Azure Firewall.
@param resourceGroupName The name of the resource group.
@param azureFirewallName The name of the Azure Firewall.
@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 AzureFirewallInner object if successful.
"""
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, azureFirewallName).toBlocking().single().body();
} | java | public AzureFirewallInner getByResourceGroup(String resourceGroupName, String azureFirewallName) {
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, azureFirewallName).toBlocking().single().body();
} | [
"public",
"AzureFirewallInner",
"getByResourceGroup",
"(",
"String",
"resourceGroupName",
",",
"String",
"azureFirewallName",
")",
"{",
"return",
"getByResourceGroupWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"azureFirewallName",
")",
".",
"toBlocking",
"(",
"... | Gets the specified Azure Firewall.
@param resourceGroupName The name of the resource group.
@param azureFirewallName The name of the Azure Firewall.
@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 AzureFirewallInner object if successful. | [
"Gets",
"the",
"specified",
"Azure",
"Firewall",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/AzureFirewallsInner.java#L266-L268 |
EdwardRaff/JSAT | JSAT/src/jsat/utils/concurrent/ParallelUtils.java | ParallelUtils.getStartBlock | public static int getStartBlock(int N, int ID, int P) {
"""
Gets the starting index (inclusive) for splitting up a list of items into
{@code P} evenly sized blocks. In the event that {@code N} is not evenly
divisible by {@code P}, the size of ranges will differ by at most 1.
@param N the number of items to split up
@param ID the block number in [0, {@code P})
@param P the number of blocks to break up the items into
@return the starting index (inclusive) of the blocks owned by the
{@code ID}'th process.
"""
int rem = N%P;
int start = (N/P)*ID+min(rem, ID);
return start;
} | java | public static int getStartBlock(int N, int ID, int P)
{
int rem = N%P;
int start = (N/P)*ID+min(rem, ID);
return start;
} | [
"public",
"static",
"int",
"getStartBlock",
"(",
"int",
"N",
",",
"int",
"ID",
",",
"int",
"P",
")",
"{",
"int",
"rem",
"=",
"N",
"%",
"P",
";",
"int",
"start",
"=",
"(",
"N",
"/",
"P",
")",
"*",
"ID",
"+",
"min",
"(",
"rem",
",",
"ID",
")"... | Gets the starting index (inclusive) for splitting up a list of items into
{@code P} evenly sized blocks. In the event that {@code N} is not evenly
divisible by {@code P}, the size of ranges will differ by at most 1.
@param N the number of items to split up
@param ID the block number in [0, {@code P})
@param P the number of blocks to break up the items into
@return the starting index (inclusive) of the blocks owned by the
{@code ID}'th process. | [
"Gets",
"the",
"starting",
"index",
"(",
"inclusive",
")",
"for",
"splitting",
"up",
"a",
"list",
"of",
"items",
"into",
"{"
] | train | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/utils/concurrent/ParallelUtils.java#L287-L292 |
michaelwittig/java-q | src/main/java/info/michaelwittig/javaq/connector/impl/QConnectorFactory.java | QConnectorFactory.create | public static QConnectorSync create(final String host, final int port) {
"""
Reconnect on error and is thread-safe.
@param host Host
@param port Port
@return QConnector
"""
return create(host, port, true, true);
} | java | public static QConnectorSync create(final String host, final int port) {
return create(host, port, true, true);
} | [
"public",
"static",
"QConnectorSync",
"create",
"(",
"final",
"String",
"host",
",",
"final",
"int",
"port",
")",
"{",
"return",
"create",
"(",
"host",
",",
"port",
",",
"true",
",",
"true",
")",
";",
"}"
] | Reconnect on error and is thread-safe.
@param host Host
@param port Port
@return QConnector | [
"Reconnect",
"on",
"error",
"and",
"is",
"thread",
"-",
"safe",
"."
] | train | https://github.com/michaelwittig/java-q/blob/f71fc95b185caa85c6fbdc7179cb4f5f7733b630/src/main/java/info/michaelwittig/javaq/connector/impl/QConnectorFactory.java#L89-L91 |
opentok/Opentok-Java-SDK | src/main/java/com/opentok/OpenTok.java | OpenTok.setStreamLayouts | public void setStreamLayouts(String sessionId, StreamListProperties properties) throws OpenTokException {
"""
Sets the layout class list for streams in a session. Layout classes are used in
the layout for composed archives and live streaming broadcasts. For more information, see
<a href="https://tokbox.com/developer/guides/archiving/layout-control.html">Customizing
the video layout for composed archives</a> and
<a href="https://tokbox.com/developer/guides/broadcast/live-streaming/#configuring-video-layout-for-opentok-live-streaming-broadcasts">Configuring
video layout for OpenTok live streaming broadcasts</a>.
<p>
You can set the initial layout class list for streams published by a client when you generate
used by the client. See the {@link #generateToken(String, TokenOptions)} method.
@param sessionId {String} The session ID of the session the streams belong to.
@param properties This StreamListProperties object defines class lists for one or more
streams in the session.
"""
if (StringUtils.isEmpty(sessionId) || properties == null) {
throw new InvalidArgumentException("SessionId is not valid or properties are null");
}
this.client.setStreamLayouts(sessionId, properties);
} | java | public void setStreamLayouts(String sessionId, StreamListProperties properties) throws OpenTokException {
if (StringUtils.isEmpty(sessionId) || properties == null) {
throw new InvalidArgumentException("SessionId is not valid or properties are null");
}
this.client.setStreamLayouts(sessionId, properties);
} | [
"public",
"void",
"setStreamLayouts",
"(",
"String",
"sessionId",
",",
"StreamListProperties",
"properties",
")",
"throws",
"OpenTokException",
"{",
"if",
"(",
"StringUtils",
".",
"isEmpty",
"(",
"sessionId",
")",
"||",
"properties",
"==",
"null",
")",
"{",
"thr... | Sets the layout class list for streams in a session. Layout classes are used in
the layout for composed archives and live streaming broadcasts. For more information, see
<a href="https://tokbox.com/developer/guides/archiving/layout-control.html">Customizing
the video layout for composed archives</a> and
<a href="https://tokbox.com/developer/guides/broadcast/live-streaming/#configuring-video-layout-for-opentok-live-streaming-broadcasts">Configuring
video layout for OpenTok live streaming broadcasts</a>.
<p>
You can set the initial layout class list for streams published by a client when you generate
used by the client. See the {@link #generateToken(String, TokenOptions)} method.
@param sessionId {String} The session ID of the session the streams belong to.
@param properties This StreamListProperties object defines class lists for one or more
streams in the session. | [
"Sets",
"the",
"layout",
"class",
"list",
"for",
"streams",
"in",
"a",
"session",
".",
"Layout",
"classes",
"are",
"used",
"in",
"the",
"layout",
"for",
"composed",
"archives",
"and",
"live",
"streaming",
"broadcasts",
".",
"For",
"more",
"information",
"see... | train | https://github.com/opentok/Opentok-Java-SDK/blob/d71b7999facc3131c415aebea874ea55776d477f/src/main/java/com/opentok/OpenTok.java#L618-L623 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/functions/DifferentialFunctionFactory.java | DifferentialFunctionFactory.avgPooling3d | public SDVariable avgPooling3d(SDVariable input, Pooling3DConfig pooling3DConfig) {
"""
Avg pooling 3d operation.
@param input the inputs to pooling
@param pooling3DConfig the configuration
@return
"""
pooling3DConfig.setType(Pooling3D.Pooling3DType.AVG);
return pooling3d(input, pooling3DConfig);
} | java | public SDVariable avgPooling3d(SDVariable input, Pooling3DConfig pooling3DConfig) {
pooling3DConfig.setType(Pooling3D.Pooling3DType.AVG);
return pooling3d(input, pooling3DConfig);
} | [
"public",
"SDVariable",
"avgPooling3d",
"(",
"SDVariable",
"input",
",",
"Pooling3DConfig",
"pooling3DConfig",
")",
"{",
"pooling3DConfig",
".",
"setType",
"(",
"Pooling3D",
".",
"Pooling3DType",
".",
"AVG",
")",
";",
"return",
"pooling3d",
"(",
"input",
",",
"p... | Avg pooling 3d operation.
@param input the inputs to pooling
@param pooling3DConfig the configuration
@return | [
"Avg",
"pooling",
"3d",
"operation",
"."
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/functions/DifferentialFunctionFactory.java#L351-L354 |
Blazebit/blaze-utils | blaze-common-utils/src/main/java/com/blazebit/annotation/AnnotationUtils.java | AnnotationUtils.findAnnotation | public static <T extends Annotation> T findAnnotation(Method m, Class<T> annotationClazz) {
"""
Returns the annotation object for the specified annotation class of the
method if it can be found, otherwise null. The annotation is searched in
the method which and if a stereotype annotation is found, the annotations
present on an annotation are also examined. If the annotation can not be
found, null is returned.
@param <T> The annotation type
@param m The method in which to look for the annotation
@param annotationClazz The type of the annotation to look for
@return The annotation with the given type if found, otherwise null
"""
T annotation = m.getAnnotation(annotationClazz);
if (annotation != null) {
return annotation;
}
if (stereotypeAnnotationClass != null) {
List<Class<?>> annotations = new ArrayList<>();
for (Annotation a : m.getAnnotations()) {
annotations.add(a.annotationType());
}
return findAnnotation(annotations, annotationClazz);
}
return null;
} | java | public static <T extends Annotation> T findAnnotation(Method m, Class<T> annotationClazz) {
T annotation = m.getAnnotation(annotationClazz);
if (annotation != null) {
return annotation;
}
if (stereotypeAnnotationClass != null) {
List<Class<?>> annotations = new ArrayList<>();
for (Annotation a : m.getAnnotations()) {
annotations.add(a.annotationType());
}
return findAnnotation(annotations, annotationClazz);
}
return null;
} | [
"public",
"static",
"<",
"T",
"extends",
"Annotation",
">",
"T",
"findAnnotation",
"(",
"Method",
"m",
",",
"Class",
"<",
"T",
">",
"annotationClazz",
")",
"{",
"T",
"annotation",
"=",
"m",
".",
"getAnnotation",
"(",
"annotationClazz",
")",
";",
"if",
"(... | Returns the annotation object for the specified annotation class of the
method if it can be found, otherwise null. The annotation is searched in
the method which and if a stereotype annotation is found, the annotations
present on an annotation are also examined. If the annotation can not be
found, null is returned.
@param <T> The annotation type
@param m The method in which to look for the annotation
@param annotationClazz The type of the annotation to look for
@return The annotation with the given type if found, otherwise null | [
"Returns",
"the",
"annotation",
"object",
"for",
"the",
"specified",
"annotation",
"class",
"of",
"the",
"method",
"if",
"it",
"can",
"be",
"found",
"otherwise",
"null",
".",
"The",
"annotation",
"is",
"searched",
"in",
"the",
"method",
"which",
"and",
"if",... | train | https://github.com/Blazebit/blaze-utils/blob/3e35a694a8f71d515aad066196acd523994d6aaa/blaze-common-utils/src/main/java/com/blazebit/annotation/AnnotationUtils.java#L165-L180 |
aws/aws-sdk-java | aws-java-sdk-simpledb/src/main/java/com/amazonaws/services/simpledb/util/SimpleDBUtils.java | SimpleDBUtils.decodeRealNumberRangeFloat | public static float decodeRealNumberRangeFloat(String value, int maxDigitsRight, int offsetValue) {
"""
Decodes float value from the string representation that was created by using
encodeRealNumberRange(..) function.
@param value
string representation of the integer value
@param maxDigitsRight
maximum number of digits left of the decimal point in the largest absolute value
in the data set (must be the same as the one used for encoding).
@param offsetValue
offset value that was used in the original encoding
@return original float value
"""
long offsetNumber = Long.parseLong(value, 10);
int shiftMultiplier = (int) Math.pow(10, maxDigitsRight);
double tempVal = (double) (offsetNumber - offsetValue * shiftMultiplier);
return (float) (tempVal / (double) (shiftMultiplier));
} | java | public static float decodeRealNumberRangeFloat(String value, int maxDigitsRight, int offsetValue) {
long offsetNumber = Long.parseLong(value, 10);
int shiftMultiplier = (int) Math.pow(10, maxDigitsRight);
double tempVal = (double) (offsetNumber - offsetValue * shiftMultiplier);
return (float) (tempVal / (double) (shiftMultiplier));
} | [
"public",
"static",
"float",
"decodeRealNumberRangeFloat",
"(",
"String",
"value",
",",
"int",
"maxDigitsRight",
",",
"int",
"offsetValue",
")",
"{",
"long",
"offsetNumber",
"=",
"Long",
".",
"parseLong",
"(",
"value",
",",
"10",
")",
";",
"int",
"shiftMultipl... | Decodes float value from the string representation that was created by using
encodeRealNumberRange(..) function.
@param value
string representation of the integer value
@param maxDigitsRight
maximum number of digits left of the decimal point in the largest absolute value
in the data set (must be the same as the one used for encoding).
@param offsetValue
offset value that was used in the original encoding
@return original float value | [
"Decodes",
"float",
"value",
"from",
"the",
"string",
"representation",
"that",
"was",
"created",
"by",
"using",
"encodeRealNumberRange",
"(",
"..",
")",
"function",
"."
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-simpledb/src/main/java/com/amazonaws/services/simpledb/util/SimpleDBUtils.java#L274-L279 |
eFaps/eFaps-Kernel | src/main/java/org/efaps/db/wrapper/SQLSelect.java | SQLSelect.addTablePart | public SQLSelect addTablePart(final String _tableName,
final Integer _tableIndex) {
"""
Add a table as part.
@param _tableName name of the table
@param _tableIndex index of the table
@return this
"""
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 |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/io/network/netty/PartitionRequestQueue.java | PartitionRequestQueue.addCredit | void addCredit(InputChannelID receiverId, int credit) throws Exception {
"""
Adds unannounced credits from the consumer and enqueues the corresponding reader for this
consumer (if not enqueued yet).
@param receiverId The input channel id to identify the consumer.
@param credit The unannounced credits of the consumer.
"""
if (fatalError) {
return;
}
NetworkSequenceViewReader reader = allReaders.get(receiverId);
if (reader != null) {
reader.addCredit(credit);
enqueueAvailableReader(reader);
} else {
throw new IllegalStateException("No reader for receiverId = " + receiverId + " exists.");
}
} | java | void addCredit(InputChannelID receiverId, int credit) throws Exception {
if (fatalError) {
return;
}
NetworkSequenceViewReader reader = allReaders.get(receiverId);
if (reader != null) {
reader.addCredit(credit);
enqueueAvailableReader(reader);
} else {
throw new IllegalStateException("No reader for receiverId = " + receiverId + " exists.");
}
} | [
"void",
"addCredit",
"(",
"InputChannelID",
"receiverId",
",",
"int",
"credit",
")",
"throws",
"Exception",
"{",
"if",
"(",
"fatalError",
")",
"{",
"return",
";",
"}",
"NetworkSequenceViewReader",
"reader",
"=",
"allReaders",
".",
"get",
"(",
"receiverId",
")"... | Adds unannounced credits from the consumer and enqueues the corresponding reader for this
consumer (if not enqueued yet).
@param receiverId The input channel id to identify the consumer.
@param credit The unannounced credits of the consumer. | [
"Adds",
"unannounced",
"credits",
"from",
"the",
"consumer",
"and",
"enqueues",
"the",
"corresponding",
"reader",
"for",
"this",
"consumer",
"(",
"if",
"not",
"enqueued",
"yet",
")",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/io/network/netty/PartitionRequestQueue.java#L155-L168 |
CubeEngine/Dirigent | src/main/java/org/cubeengine/dirigent/builder/MessageBuilder.java | MessageBuilder.buildGroup | public void buildGroup(ComponentGroup group, BuilderT builder, Context context) {
"""
Appends a chain of Components to the builder
@param group the chained Components
@param builder the builder
@param context the context
"""
for (Component component : group.getComponents())
{
buildAny(component, builder, context);
}
} | java | public void buildGroup(ComponentGroup group, BuilderT builder, Context context)
{
for (Component component : group.getComponents())
{
buildAny(component, builder, context);
}
} | [
"public",
"void",
"buildGroup",
"(",
"ComponentGroup",
"group",
",",
"BuilderT",
"builder",
",",
"Context",
"context",
")",
"{",
"for",
"(",
"Component",
"component",
":",
"group",
".",
"getComponents",
"(",
")",
")",
"{",
"buildAny",
"(",
"component",
",",
... | Appends a chain of Components to the builder
@param group the chained Components
@param builder the builder
@param context the context | [
"Appends",
"a",
"chain",
"of",
"Components",
"to",
"the",
"builder"
] | train | https://github.com/CubeEngine/Dirigent/blob/68587a8202754a6a6b629cc15e14c516806badaa/src/main/java/org/cubeengine/dirigent/builder/MessageBuilder.java#L65-L71 |
Azure/azure-sdk-for-java | automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/DscNodesInner.java | DscNodesInner.updateAsync | public Observable<DscNodeInner> updateAsync(String resourceGroupName, String automationAccountName, String nodeId, DscNodeUpdateParameters parameters) {
"""
Update the dsc node.
@param resourceGroupName Name of an Azure Resource group.
@param automationAccountName The name of the automation account.
@param nodeId Parameters supplied to the update dsc node.
@param parameters Parameters supplied to the update dsc node.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the DscNodeInner object
"""
return updateWithServiceResponseAsync(resourceGroupName, automationAccountName, nodeId, parameters).map(new Func1<ServiceResponse<DscNodeInner>, DscNodeInner>() {
@Override
public DscNodeInner call(ServiceResponse<DscNodeInner> response) {
return response.body();
}
});
} | java | public Observable<DscNodeInner> updateAsync(String resourceGroupName, String automationAccountName, String nodeId, DscNodeUpdateParameters parameters) {
return updateWithServiceResponseAsync(resourceGroupName, automationAccountName, nodeId, parameters).map(new Func1<ServiceResponse<DscNodeInner>, DscNodeInner>() {
@Override
public DscNodeInner call(ServiceResponse<DscNodeInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"DscNodeInner",
">",
"updateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"automationAccountName",
",",
"String",
"nodeId",
",",
"DscNodeUpdateParameters",
"parameters",
")",
"{",
"return",
"updateWithServiceResponseAsync",
"(",
... | Update the dsc node.
@param resourceGroupName Name of an Azure Resource group.
@param automationAccountName The name of the automation account.
@param nodeId Parameters supplied to the update dsc node.
@param parameters Parameters supplied to the update dsc node.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the DscNodeInner object | [
"Update",
"the",
"dsc",
"node",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/DscNodesInner.java#L310-L317 |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/labeling/SARLImages.java | SARLImages.getTypeImageDescriptor | public ImageDescriptor getTypeImageDescriptor(
SarlElementType type,
boolean isInner) {
"""
Replies the image descriptor for the given element.
@param type the type of the SARL element, or <code>null</code> if unknown.
@param isInner indicates if the element is inner.
@return the image descriptor.
"""
return getTypeImageDescriptor(type, isInner, false, 0, USE_LIGHT_ICONS);
} | java | public ImageDescriptor getTypeImageDescriptor(
SarlElementType type,
boolean isInner) {
return getTypeImageDescriptor(type, isInner, false, 0, USE_LIGHT_ICONS);
} | [
"public",
"ImageDescriptor",
"getTypeImageDescriptor",
"(",
"SarlElementType",
"type",
",",
"boolean",
"isInner",
")",
"{",
"return",
"getTypeImageDescriptor",
"(",
"type",
",",
"isInner",
",",
"false",
",",
"0",
",",
"USE_LIGHT_ICONS",
")",
";",
"}"
] | Replies the image descriptor for the given element.
@param type the type of the SARL element, or <code>null</code> if unknown.
@param isInner indicates if the element is inner.
@return the image descriptor. | [
"Replies",
"the",
"image",
"descriptor",
"for",
"the",
"given",
"element",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/labeling/SARLImages.java#L100-L104 |
GerdHolz/TOVAL | src/de/invation/code/toval/graphic/diagrams/panels/ScatterChartPanel.java | ScatterChartPanel.setTickSpacing | public void setTickSpacing(ValueDimension dim, double minorTickSpacing, boolean repaint) {
"""
Sets the tick spacing for the coordinate axis of the given dimension.<br>
<value>minorTickSpacing</value> sets the minor tick spacing,
major tick spacing is a multiple of minor tick spacing and determined with the help of a multiplicator.
@param dim Reference dimension for calculation
@param minorTickSpacing Minor tick spacing
@see TickInfo#getTickMultiplicator()
"""
setTickSpacing(dim, minorTickSpacing, getTickInfo(dim).getTickMultiplicator(), repaint);
} | java | public void setTickSpacing(ValueDimension dim, double minorTickSpacing, boolean repaint) {
setTickSpacing(dim, minorTickSpacing, getTickInfo(dim).getTickMultiplicator(), repaint);
} | [
"public",
"void",
"setTickSpacing",
"(",
"ValueDimension",
"dim",
",",
"double",
"minorTickSpacing",
",",
"boolean",
"repaint",
")",
"{",
"setTickSpacing",
"(",
"dim",
",",
"minorTickSpacing",
",",
"getTickInfo",
"(",
"dim",
")",
".",
"getTickMultiplicator",
"(",
... | Sets the tick spacing for the coordinate axis of the given dimension.<br>
<value>minorTickSpacing</value> sets the minor tick spacing,
major tick spacing is a multiple of minor tick spacing and determined with the help of a multiplicator.
@param dim Reference dimension for calculation
@param minorTickSpacing Minor tick spacing
@see TickInfo#getTickMultiplicator() | [
"Sets",
"the",
"tick",
"spacing",
"for",
"the",
"coordinate",
"axis",
"of",
"the",
"given",
"dimension",
".",
"<br",
">",
"<value",
">",
"minorTickSpacing<",
"/",
"value",
">",
"sets",
"the",
"minor",
"tick",
"spacing",
"major",
"tick",
"spacing",
"is",
"a... | train | https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/graphic/diagrams/panels/ScatterChartPanel.java#L211-L213 |
alkacon/opencms-core | src/org/opencms/db/CmsSecurityManager.java | CmsSecurityManager.setPassword | public void setPassword(CmsRequestContext context, String username, String newPassword)
throws CmsException, CmsRoleViolationException {
"""
Sets the password for a user.<p>
@param context the current request context
@param username the name of the user
@param newPassword the new password
@throws CmsException if operation was not successful
@throws CmsRoleViolationException if the current user does not own the rule {@link CmsRole#ACCOUNT_MANAGER}
"""
CmsDbContext dbc = m_dbContextFactory.getDbContext(context);
try {
CmsRole role = CmsRole.ACCOUNT_MANAGER.forOrgUnit(getParentOrganizationalUnit(username));
checkRoleForUserModification(dbc, username, role);
m_driverManager.setPassword(dbc, CmsOrganizationalUnit.removeLeadingSeparator(username), newPassword);
} catch (Exception e) {
dbc.report(null, Messages.get().container(Messages.ERR_SET_PASSWORD_1, username), e);
} finally {
dbc.clear();
}
} | java | public void setPassword(CmsRequestContext context, String username, String newPassword)
throws CmsException, CmsRoleViolationException {
CmsDbContext dbc = m_dbContextFactory.getDbContext(context);
try {
CmsRole role = CmsRole.ACCOUNT_MANAGER.forOrgUnit(getParentOrganizationalUnit(username));
checkRoleForUserModification(dbc, username, role);
m_driverManager.setPassword(dbc, CmsOrganizationalUnit.removeLeadingSeparator(username), newPassword);
} catch (Exception e) {
dbc.report(null, Messages.get().container(Messages.ERR_SET_PASSWORD_1, username), e);
} finally {
dbc.clear();
}
} | [
"public",
"void",
"setPassword",
"(",
"CmsRequestContext",
"context",
",",
"String",
"username",
",",
"String",
"newPassword",
")",
"throws",
"CmsException",
",",
"CmsRoleViolationException",
"{",
"CmsDbContext",
"dbc",
"=",
"m_dbContextFactory",
".",
"getDbContext",
... | Sets the password for a user.<p>
@param context the current request context
@param username the name of the user
@param newPassword the new password
@throws CmsException if operation was not successful
@throws CmsRoleViolationException if the current user does not own the rule {@link CmsRole#ACCOUNT_MANAGER} | [
"Sets",
"the",
"password",
"for",
"a",
"user",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSecurityManager.java#L6080-L6093 |
HeidelTime/heideltime | src/jvnsensegmenter/FeatureGenerator.java | FeatureGenerator.doFeatureGen | public static List doFeatureGen(Map map, String text , List markList, boolean label) {
"""
Generate context predicates for a specified text, return string representing the context predicates.
@param map the map
@param text the text
@param markList the mark list
@param label the label
@return the list
"""
markList.clear();
//Find out positions of .!? and store them in the markList
int nextPos = 0;
while( (nextPos = StringUtils.findFirstOf(text, ".!?", nextPos + 1)) != -1)
markList.add(new Integer(nextPos));
//Generate context predicates at those positions
List results = new ArrayList();
for (int i = 0; i < markList.size(); ++i){
int curPos = ((Integer) markList.get(i)).intValue();
String record = genCPs(map, text, curPos);
//Assign label to feature string if it is specified
if (label){
int idx = StringUtils.findFirstNotOf(text, " \t", curPos + 1);
if (idx == -1 || (text.charAt(idx) == '\n')){
//end of sentence
record += " " + "y";
}
else record += " " + "n";
}
results.add(record);
}
return results;
} | java | public static List doFeatureGen(Map map, String text , List markList, boolean label){
markList.clear();
//Find out positions of .!? and store them in the markList
int nextPos = 0;
while( (nextPos = StringUtils.findFirstOf(text, ".!?", nextPos + 1)) != -1)
markList.add(new Integer(nextPos));
//Generate context predicates at those positions
List results = new ArrayList();
for (int i = 0; i < markList.size(); ++i){
int curPos = ((Integer) markList.get(i)).intValue();
String record = genCPs(map, text, curPos);
//Assign label to feature string if it is specified
if (label){
int idx = StringUtils.findFirstNotOf(text, " \t", curPos + 1);
if (idx == -1 || (text.charAt(idx) == '\n')){
//end of sentence
record += " " + "y";
}
else record += " " + "n";
}
results.add(record);
}
return results;
} | [
"public",
"static",
"List",
"doFeatureGen",
"(",
"Map",
"map",
",",
"String",
"text",
",",
"List",
"markList",
",",
"boolean",
"label",
")",
"{",
"markList",
".",
"clear",
"(",
")",
";",
"//Find out positions of .!? and store them in the markList\r",
"int",
"nextP... | Generate context predicates for a specified text, return string representing the context predicates.
@param map the map
@param text the text
@param markList the mark list
@param label the label
@return the list | [
"Generate",
"context",
"predicates",
"for",
"a",
"specified",
"text",
"return",
"string",
"representing",
"the",
"context",
"predicates",
"."
] | train | https://github.com/HeidelTime/heideltime/blob/4ef5002eb5ecfeb818086ff7e394e792ee360335/src/jvnsensegmenter/FeatureGenerator.java#L185-L214 |
Azure/azure-sdk-for-java | applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/implementation/WorkItemConfigurationsInner.java | WorkItemConfigurationsInner.listAsync | public Observable<List<WorkItemConfigurationInner>> listAsync(String resourceGroupName, String resourceName) {
"""
Gets the list work item configurations that exist for the application.
@param resourceGroupName The name of the resource group.
@param resourceName The name of the Application Insights component resource.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the List<WorkItemConfigurationInner> object
"""
return listWithServiceResponseAsync(resourceGroupName, resourceName).map(new Func1<ServiceResponse<List<WorkItemConfigurationInner>>, List<WorkItemConfigurationInner>>() {
@Override
public List<WorkItemConfigurationInner> call(ServiceResponse<List<WorkItemConfigurationInner>> response) {
return response.body();
}
});
} | java | public Observable<List<WorkItemConfigurationInner>> listAsync(String resourceGroupName, String resourceName) {
return listWithServiceResponseAsync(resourceGroupName, resourceName).map(new Func1<ServiceResponse<List<WorkItemConfigurationInner>>, List<WorkItemConfigurationInner>>() {
@Override
public List<WorkItemConfigurationInner> call(ServiceResponse<List<WorkItemConfigurationInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"List",
"<",
"WorkItemConfigurationInner",
">",
">",
"listAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"resourceName",
")",
"{",
"return",
"listWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"resourceName",
")",
".... | Gets the list work item configurations that exist for the application.
@param resourceGroupName The name of the resource group.
@param resourceName The name of the Application Insights component resource.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the List<WorkItemConfigurationInner> object | [
"Gets",
"the",
"list",
"work",
"item",
"configurations",
"that",
"exist",
"for",
"the",
"application",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/implementation/WorkItemConfigurationsInner.java#L114-L121 |
google/closure-compiler | src/com/google/javascript/jscomp/CheckAccessControls.java | CheckAccessControls.checkPropertyDeprecation | private void checkPropertyDeprecation(NodeTraversal t, PropertyReference propRef) {
"""
Checks the given GETPROP node to ensure that access restrictions are obeyed.
"""
if (!shouldEmitDeprecationWarning(t, propRef)) {
return;
}
// Don't bother checking constructors.
if (propRef.getSourceNode().getParent().isNew()) {
return;
}
ObjectType objectType = castToObject(dereference(propRef.getReceiverType()));
String propertyName = propRef.getName();
if (objectType != null) {
String deprecationInfo
= getPropertyDeprecationInfo(objectType, propertyName);
if (deprecationInfo != null) {
if (!deprecationInfo.isEmpty()) {
compiler.report(
JSError.make(
propRef.getSourceNode(),
DEPRECATED_PROP_REASON,
propertyName,
propRef.getReadableTypeNameOrDefault(),
deprecationInfo));
} else {
compiler.report(
JSError.make(
propRef.getSourceNode(),
DEPRECATED_PROP,
propertyName,
propRef.getReadableTypeNameOrDefault()));
}
}
}
} | java | private void checkPropertyDeprecation(NodeTraversal t, PropertyReference propRef) {
if (!shouldEmitDeprecationWarning(t, propRef)) {
return;
}
// Don't bother checking constructors.
if (propRef.getSourceNode().getParent().isNew()) {
return;
}
ObjectType objectType = castToObject(dereference(propRef.getReceiverType()));
String propertyName = propRef.getName();
if (objectType != null) {
String deprecationInfo
= getPropertyDeprecationInfo(objectType, propertyName);
if (deprecationInfo != null) {
if (!deprecationInfo.isEmpty()) {
compiler.report(
JSError.make(
propRef.getSourceNode(),
DEPRECATED_PROP_REASON,
propertyName,
propRef.getReadableTypeNameOrDefault(),
deprecationInfo));
} else {
compiler.report(
JSError.make(
propRef.getSourceNode(),
DEPRECATED_PROP,
propertyName,
propRef.getReadableTypeNameOrDefault()));
}
}
}
} | [
"private",
"void",
"checkPropertyDeprecation",
"(",
"NodeTraversal",
"t",
",",
"PropertyReference",
"propRef",
")",
"{",
"if",
"(",
"!",
"shouldEmitDeprecationWarning",
"(",
"t",
",",
"propRef",
")",
")",
"{",
"return",
";",
"}",
"// Don't bother checking constructo... | Checks the given GETPROP node to ensure that access restrictions are obeyed. | [
"Checks",
"the",
"given",
"GETPROP",
"node",
"to",
"ensure",
"that",
"access",
"restrictions",
"are",
"obeyed",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/CheckAccessControls.java#L471-L508 |
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) {
"""
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.
"""
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 |
mapsforge/mapsforge | sqlite-android/src/main/java/org/sqlite/database/DatabaseUtils.java | DatabaseUtils.getCollationKey | public static String getCollationKey(String name) {
"""
return the collation key
@param name
@return the collation key
"""
byte [] arr = getCollationKeyInBytes(name);
try {
return new String(arr, 0, getKeyLen(arr), "ISO8859_1");
} catch (Exception ex) {
return "";
}
} | java | public static String getCollationKey(String name) {
byte [] arr = getCollationKeyInBytes(name);
try {
return new String(arr, 0, getKeyLen(arr), "ISO8859_1");
} catch (Exception ex) {
return "";
}
} | [
"public",
"static",
"String",
"getCollationKey",
"(",
"String",
"name",
")",
"{",
"byte",
"[",
"]",
"arr",
"=",
"getCollationKeyInBytes",
"(",
"name",
")",
";",
"try",
"{",
"return",
"new",
"String",
"(",
"arr",
",",
"0",
",",
"getKeyLen",
"(",
"arr",
... | return the collation key
@param name
@return the collation key | [
"return",
"the",
"collation",
"key"
] | train | https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/sqlite-android/src/main/java/org/sqlite/database/DatabaseUtils.java#L407-L414 |
GenesysPureEngage/workspace-client-java | src/main/java/com/genesys/internal/workspace/api/UcsApi.java | UcsApi.findOrCreatePhoneCall | public ApiSuccessResponse findOrCreatePhoneCall(String id, FindOrCreateData findOrCreateData) throws ApiException {
"""
Find or create phone call in UCS
@param id id of the Voice Interaction (required)
@param findOrCreateData Request parameters. (optional)
@return ApiSuccessResponse
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
"""
ApiResponse<ApiSuccessResponse> resp = findOrCreatePhoneCallWithHttpInfo(id, findOrCreateData);
return resp.getData();
} | java | public ApiSuccessResponse findOrCreatePhoneCall(String id, FindOrCreateData findOrCreateData) throws ApiException {
ApiResponse<ApiSuccessResponse> resp = findOrCreatePhoneCallWithHttpInfo(id, findOrCreateData);
return resp.getData();
} | [
"public",
"ApiSuccessResponse",
"findOrCreatePhoneCall",
"(",
"String",
"id",
",",
"FindOrCreateData",
"findOrCreateData",
")",
"throws",
"ApiException",
"{",
"ApiResponse",
"<",
"ApiSuccessResponse",
">",
"resp",
"=",
"findOrCreatePhoneCallWithHttpInfo",
"(",
"id",
",",
... | Find or create phone call in UCS
@param id id of the Voice Interaction (required)
@param findOrCreateData Request parameters. (optional)
@return ApiSuccessResponse
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body | [
"Find",
"or",
"create",
"phone",
"call",
"in",
"UCS"
] | train | https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/UcsApi.java#L652-L655 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/PdfAction.java | PdfAction.gotoEmbedded | public static PdfAction gotoEmbedded(String filename, PdfTargetDictionary target, String dest, boolean isName, boolean newWindow) {
"""
Creates a GoToE action to an embedded file.
@param filename the root document of the target (null if the target is in the same document)
@param dest the named destination
@param isName if true sets the destination as a name, if false sets it as a String
@return a GoToE action
"""
if (isName)
return gotoEmbedded(filename, target, new PdfName(dest), newWindow);
else
return gotoEmbedded(filename, target, new PdfString(dest, null), newWindow);
} | java | public static PdfAction gotoEmbedded(String filename, PdfTargetDictionary target, String dest, boolean isName, boolean newWindow) {
if (isName)
return gotoEmbedded(filename, target, new PdfName(dest), newWindow);
else
return gotoEmbedded(filename, target, new PdfString(dest, null), newWindow);
} | [
"public",
"static",
"PdfAction",
"gotoEmbedded",
"(",
"String",
"filename",
",",
"PdfTargetDictionary",
"target",
",",
"String",
"dest",
",",
"boolean",
"isName",
",",
"boolean",
"newWindow",
")",
"{",
"if",
"(",
"isName",
")",
"return",
"gotoEmbedded",
"(",
"... | Creates a GoToE action to an embedded file.
@param filename the root document of the target (null if the target is in the same document)
@param dest the named destination
@param isName if true sets the destination as a name, if false sets it as a String
@return a GoToE action | [
"Creates",
"a",
"GoToE",
"action",
"to",
"an",
"embedded",
"file",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfAction.java#L508-L513 |
JoeKerouac/utils | src/main/java/com/joe/utils/common/StringUtils.java | StringUtils.replace | public static String replace(String str, int start, int end, String rp) {
"""
替换指定区间位置的所有字符
@param str 字符串
@param start 要替换的起始位置(包含该位置)
@param end 要替换的结束位置(包含该位置)
@param rp 替换字符串
@return 替换后的字符串,例如对123456替换1,3,*,结果为1*56
"""
if (str == null || start < 0 || start > end || end >= str.length()) {
throw new IllegalArgumentException("参数非法");
}
return str.substring(0, start) + rp + str.substring(end + 1);
} | java | public static String replace(String str, int start, int end, String rp) {
if (str == null || start < 0 || start > end || end >= str.length()) {
throw new IllegalArgumentException("参数非法");
}
return str.substring(0, start) + rp + str.substring(end + 1);
} | [
"public",
"static",
"String",
"replace",
"(",
"String",
"str",
",",
"int",
"start",
",",
"int",
"end",
",",
"String",
"rp",
")",
"{",
"if",
"(",
"str",
"==",
"null",
"||",
"start",
"<",
"0",
"||",
"start",
">",
"end",
"||",
"end",
">=",
"str",
".... | 替换指定区间位置的所有字符
@param str 字符串
@param start 要替换的起始位置(包含该位置)
@param end 要替换的结束位置(包含该位置)
@param rp 替换字符串
@return 替换后的字符串,例如对123456替换1,3,*,结果为1*56 | [
"替换指定区间位置的所有字符"
] | train | https://github.com/JoeKerouac/utils/blob/45e1b2dc4d736956674fc4dcbe6cf84eaee69278/src/main/java/com/joe/utils/common/StringUtils.java#L106-L112 |
looly/hutool | hutool-poi/src/main/java/cn/hutool/poi/word/Word07Writer.java | Word07Writer.addText | public Word07Writer addText(Font font, String... texts) {
"""
增加一个段落
@param font 字体信息{@link Font}
@param texts 段落中的文本,支持多个文本作为一个段落
@return this
"""
return addText(null, font, texts);
} | java | public Word07Writer addText(Font font, String... texts) {
return addText(null, font, texts);
} | [
"public",
"Word07Writer",
"addText",
"(",
"Font",
"font",
",",
"String",
"...",
"texts",
")",
"{",
"return",
"addText",
"(",
"null",
",",
"font",
",",
"texts",
")",
";",
"}"
] | 增加一个段落
@param font 字体信息{@link Font}
@param texts 段落中的文本,支持多个文本作为一个段落
@return this | [
"增加一个段落"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/word/Word07Writer.java#L97-L99 |
Shusshu/Android-RecurrencePicker | library/src/main/java/be/billington/calendar/recurrencepicker/Utils.java | Utils.isSaturday | public static boolean isSaturday(int column, int firstDayOfWeek) {
"""
Determine whether the column position is Saturday or not.
@param column the column position
@param firstDayOfWeek the first day of week in android.text.format.Time
@return true if the column is Saturday position
"""
return (firstDayOfWeek == Time.SUNDAY && column == 6)
|| (firstDayOfWeek == Time.MONDAY && column == 5)
|| (firstDayOfWeek == Time.SATURDAY && column == 0);
} | java | public static boolean isSaturday(int column, int firstDayOfWeek) {
return (firstDayOfWeek == Time.SUNDAY && column == 6)
|| (firstDayOfWeek == Time.MONDAY && column == 5)
|| (firstDayOfWeek == Time.SATURDAY && column == 0);
} | [
"public",
"static",
"boolean",
"isSaturday",
"(",
"int",
"column",
",",
"int",
"firstDayOfWeek",
")",
"{",
"return",
"(",
"firstDayOfWeek",
"==",
"Time",
".",
"SUNDAY",
"&&",
"column",
"==",
"6",
")",
"||",
"(",
"firstDayOfWeek",
"==",
"Time",
".",
"MONDAY... | Determine whether the column position is Saturday or not.
@param column the column position
@param firstDayOfWeek the first day of week in android.text.format.Time
@return true if the column is Saturday position | [
"Determine",
"whether",
"the",
"column",
"position",
"is",
"Saturday",
"or",
"not",
"."
] | train | https://github.com/Shusshu/Android-RecurrencePicker/blob/4f0ae74482e4d46d57a8fb13b4b7980a8613f4af/library/src/main/java/be/billington/calendar/recurrencepicker/Utils.java#L434-L438 |
azkaban/azkaban | azkaban-common/src/main/java/azkaban/utils/StringUtils.java | StringUtils.join | public static String join(final Collection<String> list, final String delimiter) {
"""
Use this when you don't want to include Apache Common's string for plugins.
"""
final StringBuffer buffer = new StringBuffer();
for (final String str : list) {
buffer.append(str);
buffer.append(delimiter);
}
return buffer.toString();
} | java | public static String join(final Collection<String> list, final String delimiter) {
final StringBuffer buffer = new StringBuffer();
for (final String str : list) {
buffer.append(str);
buffer.append(delimiter);
}
return buffer.toString();
} | [
"public",
"static",
"String",
"join",
"(",
"final",
"Collection",
"<",
"String",
">",
"list",
",",
"final",
"String",
"delimiter",
")",
"{",
"final",
"StringBuffer",
"buffer",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"for",
"(",
"final",
"String",
"str",... | Use this when you don't want to include Apache Common's string for plugins. | [
"Use",
"this",
"when",
"you",
"don",
"t",
"want",
"to",
"include",
"Apache",
"Common",
"s",
"string",
"for",
"plugins",
"."
] | train | https://github.com/azkaban/azkaban/blob/d258ea7d6e66807c6eff79c5325d6d3443618dff/azkaban-common/src/main/java/azkaban/utils/StringUtils.java#L60-L68 |
actorapp/actor-platform | actor-sdk/sdk-core-android/android-sdk/src/main/java/android/support/v7/widget/ChatLinearLayoutManager.java | ChatLinearLayoutManager.scrollToPositionWithOffset | public void scrollToPositionWithOffset(int position, int offset) {
"""
Scroll to the specified adapter position with the given offset from resolved layout
start. Resolved layout start depends on {@link #getReverseLayout()},
{@link ViewCompat#getLayoutDirection(View)} and {@link #getStackFromEnd()}.
<p>
For example, if layout is {@link #VERTICAL} and {@link #getStackFromEnd()} is true, calling
<code>scrollToPositionWithOffset(10, 20)</code> will layout such that
<code>item[10]</code>'s bottom is 20 pixels above the RecyclerView's bottom.
<p>
Note that scroll position change will not be reflected until the next layout call.
<p>
If you are just trying to make a position visible, use {@link #scrollToPosition(int)}.
@param position Index (starting at 0) of the reference item.
@param offset The distance (in pixels) between the start edge of the item view and
start edge of the RecyclerView.
@see #setReverseLayout(boolean)
@see #scrollToPosition(int)
"""
scrollToPositionWithOffsetCalled = true;
mPendingScrollPosition = position;
mPendingScrollPositionOffset = offset;
if (mPendingSavedState != null) {
mPendingSavedState.invalidateAnchor();
}
requestLayout();
} | java | public void scrollToPositionWithOffset(int position, int offset) {
scrollToPositionWithOffsetCalled = true;
mPendingScrollPosition = position;
mPendingScrollPositionOffset = offset;
if (mPendingSavedState != null) {
mPendingSavedState.invalidateAnchor();
}
requestLayout();
} | [
"public",
"void",
"scrollToPositionWithOffset",
"(",
"int",
"position",
",",
"int",
"offset",
")",
"{",
"scrollToPositionWithOffsetCalled",
"=",
"true",
";",
"mPendingScrollPosition",
"=",
"position",
";",
"mPendingScrollPositionOffset",
"=",
"offset",
";",
"if",
"(",... | Scroll to the specified adapter position with the given offset from resolved layout
start. Resolved layout start depends on {@link #getReverseLayout()},
{@link ViewCompat#getLayoutDirection(View)} and {@link #getStackFromEnd()}.
<p>
For example, if layout is {@link #VERTICAL} and {@link #getStackFromEnd()} is true, calling
<code>scrollToPositionWithOffset(10, 20)</code> will layout such that
<code>item[10]</code>'s bottom is 20 pixels above the RecyclerView's bottom.
<p>
Note that scroll position change will not be reflected until the next layout call.
<p>
If you are just trying to make a position visible, use {@link #scrollToPosition(int)}.
@param position Index (starting at 0) of the reference item.
@param offset The distance (in pixels) between the start edge of the item view and
start edge of the RecyclerView.
@see #setReverseLayout(boolean)
@see #scrollToPosition(int) | [
"Scroll",
"to",
"the",
"specified",
"adapter",
"position",
"with",
"the",
"given",
"offset",
"from",
"resolved",
"layout",
"start",
".",
"Resolved",
"layout",
"start",
"depends",
"on",
"{",
"@link",
"#getReverseLayout",
"()",
"}",
"{",
"@link",
"ViewCompat#getLa... | train | https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core-android/android-sdk/src/main/java/android/support/v7/widget/ChatLinearLayoutManager.java#L968-L976 |
xmlet/XsdAsmFaster | src/main/java/org/xmlet/xsdasmfaster/classes/XsdAsmVisitor.java | XsdAsmVisitor.generateVisitors | static void generateVisitors(Set<String> elementNames, List<XsdAttribute> attributes, String apiName) {
"""
Generates both the abstract visitor class with methods for each element from the list.
@param elementNames The elements names list.
@param apiName The name of the generated fluent interface.
"""
generateVisitorInterface(elementNames, filterAttributes(attributes), apiName);
} | java | static void generateVisitors(Set<String> elementNames, List<XsdAttribute> attributes, String apiName){
generateVisitorInterface(elementNames, filterAttributes(attributes), apiName);
} | [
"static",
"void",
"generateVisitors",
"(",
"Set",
"<",
"String",
">",
"elementNames",
",",
"List",
"<",
"XsdAttribute",
">",
"attributes",
",",
"String",
"apiName",
")",
"{",
"generateVisitorInterface",
"(",
"elementNames",
",",
"filterAttributes",
"(",
"attribute... | Generates both the abstract visitor class with methods for each element from the list.
@param elementNames The elements names list.
@param apiName The name of the generated fluent interface. | [
"Generates",
"both",
"the",
"abstract",
"visitor",
"class",
"with",
"methods",
"for",
"each",
"element",
"from",
"the",
"list",
"."
] | train | https://github.com/xmlet/XsdAsmFaster/blob/ccb78f9dd4b957ad5ac1ca349eaf24338c421e94/src/main/java/org/xmlet/xsdasmfaster/classes/XsdAsmVisitor.java#L34-L36 |
apache/groovy | src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java | DefaultGroovyMethods.getAt | @SuppressWarnings("unchecked")
public static List<Character> getAt(char[] array, Collection 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
"""
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 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DurableOutputHandler.java | DurableOutputHandler.initializeControlMessage | protected static void initializeControlMessage(SIBUuid8 sourceME, ControlMessage msg, SIBUuid8 remoteMEId) {
"""
Common initialization for all messages sent by the DurableOutputHandler.
@param msg Message to initialize.
@param remoteMEId The ME the message will be sent to.
"""
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "initializeControlMessage", new Object[] {msg, remoteMEId});
SIMPUtils.setGuaranteedDeliveryProperties(msg,
sourceME,
remoteMEId,
null,
null,
null,
ProtocolType.DURABLEINPUT,
GDConfig.PROTOCOL_VERSION);
msg.setPriority(SIMPConstants.CONTROL_MESSAGE_PRIORITY);
msg.setReliability(SIMPConstants.CONTROL_MESSAGE_RELIABILITY);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "initializeControlMessage");
} | java | protected static void initializeControlMessage(SIBUuid8 sourceME, ControlMessage msg, SIBUuid8 remoteMEId)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "initializeControlMessage", new Object[] {msg, remoteMEId});
SIMPUtils.setGuaranteedDeliveryProperties(msg,
sourceME,
remoteMEId,
null,
null,
null,
ProtocolType.DURABLEINPUT,
GDConfig.PROTOCOL_VERSION);
msg.setPriority(SIMPConstants.CONTROL_MESSAGE_PRIORITY);
msg.setReliability(SIMPConstants.CONTROL_MESSAGE_RELIABILITY);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "initializeControlMessage");
} | [
"protected",
"static",
"void",
"initializeControlMessage",
"(",
"SIBUuid8",
"sourceME",
",",
"ControlMessage",
"msg",
",",
"SIBUuid8",
"remoteMEId",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"("... | Common initialization for all messages sent by the DurableOutputHandler.
@param msg Message to initialize.
@param remoteMEId The ME the message will be sent to. | [
"Common",
"initialization",
"for",
"all",
"messages",
"sent",
"by",
"the",
"DurableOutputHandler",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DurableOutputHandler.java#L547-L566 |
matthewhorridge/owlapi-gwt | owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLObjectOneOfImpl_CustomFieldSerializer.java | OWLObjectOneOfImpl_CustomFieldSerializer.deserializeInstance | @Override
public void deserializeInstance(SerializationStreamReader streamReader, OWLObjectOneOfImpl instance) throws SerializationException {
"""
Deserializes the content of the object from the
{@link com.google.gwt.user.client.rpc.SerializationStreamReader}.
@param streamReader the {@link com.google.gwt.user.client.rpc.SerializationStreamReader} to read the
object's content from
@param instance the object instance to deserialize
@throws com.google.gwt.user.client.rpc.SerializationException
if the deserialization operation is not
successful
"""
deserialize(streamReader, instance);
} | java | @Override
public void deserializeInstance(SerializationStreamReader streamReader, OWLObjectOneOfImpl instance) throws SerializationException {
deserialize(streamReader, instance);
} | [
"@",
"Override",
"public",
"void",
"deserializeInstance",
"(",
"SerializationStreamReader",
"streamReader",
",",
"OWLObjectOneOfImpl",
"instance",
")",
"throws",
"SerializationException",
"{",
"deserialize",
"(",
"streamReader",
",",
"instance",
")",
";",
"}"
] | Deserializes the content of the object from the
{@link com.google.gwt.user.client.rpc.SerializationStreamReader}.
@param streamReader the {@link com.google.gwt.user.client.rpc.SerializationStreamReader} to read the
object's content from
@param instance the object instance to deserialize
@throws com.google.gwt.user.client.rpc.SerializationException
if the deserialization operation is not
successful | [
"Deserializes",
"the",
"content",
"of",
"the",
"object",
"from",
"the",
"{",
"@link",
"com",
".",
"google",
".",
"gwt",
".",
"user",
".",
"client",
".",
"rpc",
".",
"SerializationStreamReader",
"}",
"."
] | train | https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLObjectOneOfImpl_CustomFieldSerializer.java#L89-L92 |
jbossws/jbossws-common | src/main/java/org/jboss/ws/common/injection/finders/ReflectionUtils.java | ReflectionUtils.assertNotStatic | public static void assertNotStatic(final Field field, Class<? extends Annotation> annotation) {
"""
Asserts field is not static.
@param field to validate
@param annotation annotation to propagate in exception message
"""
if (Modifier.isStatic(field.getModifiers()))
{
throw annotation == null ? MESSAGES.fieldCannotBeStaticOrFinal(field) : MESSAGES.fieldCannotBeStaticOrFinal2(field, annotation);
}
} | java | public static void assertNotStatic(final Field field, Class<? extends Annotation> annotation)
{
if (Modifier.isStatic(field.getModifiers()))
{
throw annotation == null ? MESSAGES.fieldCannotBeStaticOrFinal(field) : MESSAGES.fieldCannotBeStaticOrFinal2(field, annotation);
}
} | [
"public",
"static",
"void",
"assertNotStatic",
"(",
"final",
"Field",
"field",
",",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"annotation",
")",
"{",
"if",
"(",
"Modifier",
".",
"isStatic",
"(",
"field",
".",
"getModifiers",
"(",
")",
")",
")",
"{... | Asserts field is not static.
@param field to validate
@param annotation annotation to propagate in exception message | [
"Asserts",
"field",
"is",
"not",
"static",
"."
] | train | https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/injection/finders/ReflectionUtils.java#L229-L235 |
davetcc/tcMenu | tcMenuJavaApi/src/main/java/com/thecoderscorner/menu/remote/protocol/TagValTextParser.java | TagValTextParser.getValueWithDefault | public String getValueWithDefault(String keyMsgType, String defaultVal) {
"""
Gets the value associated with the key from the message if it exists in the underlying map.
This version returns the default value if it does not exist.
@param keyMsgType the key to obtain
@return the associated value or the default
"""
return keyToValue.getOrDefault(keyMsgType, defaultVal);
} | java | public String getValueWithDefault(String keyMsgType, String defaultVal) {
return keyToValue.getOrDefault(keyMsgType, defaultVal);
} | [
"public",
"String",
"getValueWithDefault",
"(",
"String",
"keyMsgType",
",",
"String",
"defaultVal",
")",
"{",
"return",
"keyToValue",
".",
"getOrDefault",
"(",
"keyMsgType",
",",
"defaultVal",
")",
";",
"}"
] | Gets the value associated with the key from the message if it exists in the underlying map.
This version returns the default value if it does not exist.
@param keyMsgType the key to obtain
@return the associated value or the default | [
"Gets",
"the",
"value",
"associated",
"with",
"the",
"key",
"from",
"the",
"message",
"if",
"it",
"exists",
"in",
"the",
"underlying",
"map",
".",
"This",
"version",
"returns",
"the",
"default",
"value",
"if",
"it",
"does",
"not",
"exist",
"."
] | train | https://github.com/davetcc/tcMenu/blob/61546e4b982b25ceaff384073fe9ec1fff55e64a/tcMenuJavaApi/src/main/java/com/thecoderscorner/menu/remote/protocol/TagValTextParser.java#L92-L94 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/embeddings/loader/WordVectorSerializer.java | WordVectorSerializer.loadTxtVectors | @Deprecated
public static WordVectors loadTxtVectors(@NonNull InputStream stream, boolean skipFirstLine) throws IOException {
"""
This method can be used to load previously saved model from InputStream (like a HDFS-stream)
<p>
Deprecation note: Please, consider using readWord2VecModel() or loadStaticModel() method instead
@param stream InputStream that contains previously serialized model
@param skipFirstLine Set this TRUE if first line contains csv header, FALSE otherwise
@return
@throws IOException
@deprecated Use readWord2VecModel() or loadStaticModel() method instead
"""
AbstractCache<VocabWord> cache = new AbstractCache.Builder<VocabWord>().build();
BufferedReader reader = new BufferedReader(new InputStreamReader(stream));
String line = "";
List<INDArray> arrays = new ArrayList<>();
if (skipFirstLine)
reader.readLine();
while ((line = reader.readLine()) != null) {
String[] split = line.split(" ");
String word = split[0].replaceAll(WHITESPACE_REPLACEMENT, " ");
VocabWord word1 = new VocabWord(1.0, word);
word1.setIndex(cache.numWords());
cache.addToken(word1);
cache.addWordToIndex(word1.getIndex(), word);
cache.putVocabWord(word);
float[] vector = new float[split.length - 1];
for (int i = 1; i < split.length; i++) {
vector[i - 1] = Float.parseFloat(split[i]);
}
INDArray row = Nd4j.create(vector);
arrays.add(row);
}
InMemoryLookupTable<VocabWord> lookupTable =
(InMemoryLookupTable<VocabWord>) new InMemoryLookupTable.Builder<VocabWord>()
.vectorLength(arrays.get(0).columns()).cache(cache).build();
INDArray syn = Nd4j.vstack(arrays);
Nd4j.clearNans(syn);
lookupTable.setSyn0(syn);
return fromPair(Pair.makePair((InMemoryLookupTable) lookupTable, (VocabCache) cache));
} | java | @Deprecated
public static WordVectors loadTxtVectors(@NonNull InputStream stream, boolean skipFirstLine) throws IOException {
AbstractCache<VocabWord> cache = new AbstractCache.Builder<VocabWord>().build();
BufferedReader reader = new BufferedReader(new InputStreamReader(stream));
String line = "";
List<INDArray> arrays = new ArrayList<>();
if (skipFirstLine)
reader.readLine();
while ((line = reader.readLine()) != null) {
String[] split = line.split(" ");
String word = split[0].replaceAll(WHITESPACE_REPLACEMENT, " ");
VocabWord word1 = new VocabWord(1.0, word);
word1.setIndex(cache.numWords());
cache.addToken(word1);
cache.addWordToIndex(word1.getIndex(), word);
cache.putVocabWord(word);
float[] vector = new float[split.length - 1];
for (int i = 1; i < split.length; i++) {
vector[i - 1] = Float.parseFloat(split[i]);
}
INDArray row = Nd4j.create(vector);
arrays.add(row);
}
InMemoryLookupTable<VocabWord> lookupTable =
(InMemoryLookupTable<VocabWord>) new InMemoryLookupTable.Builder<VocabWord>()
.vectorLength(arrays.get(0).columns()).cache(cache).build();
INDArray syn = Nd4j.vstack(arrays);
Nd4j.clearNans(syn);
lookupTable.setSyn0(syn);
return fromPair(Pair.makePair((InMemoryLookupTable) lookupTable, (VocabCache) cache));
} | [
"@",
"Deprecated",
"public",
"static",
"WordVectors",
"loadTxtVectors",
"(",
"@",
"NonNull",
"InputStream",
"stream",
",",
"boolean",
"skipFirstLine",
")",
"throws",
"IOException",
"{",
"AbstractCache",
"<",
"VocabWord",
">",
"cache",
"=",
"new",
"AbstractCache",
... | This method can be used to load previously saved model from InputStream (like a HDFS-stream)
<p>
Deprecation note: Please, consider using readWord2VecModel() or loadStaticModel() method instead
@param stream InputStream that contains previously serialized model
@param skipFirstLine Set this TRUE if first line contains csv header, FALSE otherwise
@return
@throws IOException
@deprecated Use readWord2VecModel() or loadStaticModel() method instead | [
"This",
"method",
"can",
"be",
"used",
"to",
"load",
"previously",
"saved",
"model",
"from",
"InputStream",
"(",
"like",
"a",
"HDFS",
"-",
"stream",
")",
"<p",
">",
"Deprecation",
"note",
":",
"Please",
"consider",
"using",
"readWord2VecModel",
"()",
"or",
... | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/embeddings/loader/WordVectorSerializer.java#L1764-L1809 |
PureSolTechnologies/graphs | trees/src/main/java/com/puresoltechnologies/graphs/trees/RedBlackTree.java | RedBlackTree.put | @Override
public void put(Key key, Value value) {
"""
Inserts the specified key-value pair into the symbol table, overwriting the
old value with the new value if the symbol table already contains the
specified key. Deletes the specified key (and its associated value) from this
symbol table if the specified value is <code>null</code>.
@param key
the key
@param value
the value
"""
if (value == null) {
delete(key);
return;
}
root = put(root, key, value);
root.setParent(null);
root.setColor(BLACK);
} | java | @Override
public void put(Key key, Value value) {
if (value == null) {
delete(key);
return;
}
root = put(root, key, value);
root.setParent(null);
root.setColor(BLACK);
} | [
"@",
"Override",
"public",
"void",
"put",
"(",
"Key",
"key",
",",
"Value",
"value",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"delete",
"(",
"key",
")",
";",
"return",
";",
"}",
"root",
"=",
"put",
"(",
"root",
",",
"key",
",",
"val... | Inserts the specified key-value pair into the symbol table, overwriting the
old value with the new value if the symbol table already contains the
specified key. Deletes the specified key (and its associated value) from this
symbol table if the specified value is <code>null</code>.
@param key
the key
@param value
the value | [
"Inserts",
"the",
"specified",
"key",
"-",
"value",
"pair",
"into",
"the",
"symbol",
"table",
"overwriting",
"the",
"old",
"value",
"with",
"the",
"new",
"value",
"if",
"the",
"symbol",
"table",
"already",
"contains",
"the",
"specified",
"key",
".",
"Deletes... | train | https://github.com/PureSolTechnologies/graphs/blob/35dbbd11ccaacbbc6321dcdcd4d31e9a1090d6f1/trees/src/main/java/com/puresoltechnologies/graphs/trees/RedBlackTree.java#L68-L77 |
paypal/SeLion | server/src/main/java/com/paypal/selion/utils/AuthenticationHelper.java | AuthenticationHelper.changePassword | public static boolean changePassword(String userName, String newPassword) {
"""
Changes the password for the given user to the new password
@param userName
@param newPassword
@return <code>true</code> if the password was successfully changed.
"""
LOGGER.entering(userName, newPassword.replaceAll(".", "*"));
boolean changeSucceeded = false;
File authFile = new File(AUTH_FILE_LOCATION);
try {
authFile.delete();
authFile.createNewFile();
createAuthFile(authFile, userName, newPassword);
changeSucceeded = true;
} catch (Exception e) {
changeSucceeded = false;
}
LOGGER.exiting(changeSucceeded);
return changeSucceeded;
} | java | public static boolean changePassword(String userName, String newPassword) {
LOGGER.entering(userName, newPassword.replaceAll(".", "*"));
boolean changeSucceeded = false;
File authFile = new File(AUTH_FILE_LOCATION);
try {
authFile.delete();
authFile.createNewFile();
createAuthFile(authFile, userName, newPassword);
changeSucceeded = true;
} catch (Exception e) {
changeSucceeded = false;
}
LOGGER.exiting(changeSucceeded);
return changeSucceeded;
} | [
"public",
"static",
"boolean",
"changePassword",
"(",
"String",
"userName",
",",
"String",
"newPassword",
")",
"{",
"LOGGER",
".",
"entering",
"(",
"userName",
",",
"newPassword",
".",
"replaceAll",
"(",
"\".\"",
",",
"\"*\"",
")",
")",
";",
"boolean",
"chan... | Changes the password for the given user to the new password
@param userName
@param newPassword
@return <code>true</code> if the password was successfully changed. | [
"Changes",
"the",
"password",
"for",
"the",
"given",
"user",
"to",
"the",
"new",
"password"
] | train | https://github.com/paypal/SeLion/blob/694d12d0df76db48d0360b16192770c6a4fbdfd2/server/src/main/java/com/paypal/selion/utils/AuthenticationHelper.java#L99-L113 |
aws/aws-sdk-java | aws-java-sdk-medialive/src/main/java/com/amazonaws/services/medialive/model/StartChannelResult.java | StartChannelResult.withTags | public StartChannelResult withTags(java.util.Map<String, String> tags) {
"""
A collection of key-value pairs.
@param tags
A collection of key-value pairs.
@return Returns a reference to this object so that method calls can be chained together.
"""
setTags(tags);
return this;
} | java | public StartChannelResult withTags(java.util.Map<String, String> tags) {
setTags(tags);
return this;
} | [
"public",
"StartChannelResult",
"withTags",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"tags",
")",
"{",
"setTags",
"(",
"tags",
")",
";",
"return",
"this",
";",
"}"
] | A collection of key-value pairs.
@param tags
A collection of key-value pairs.
@return Returns a reference to this object so that method calls can be chained together. | [
"A",
"collection",
"of",
"key",
"-",
"value",
"pairs",
"."
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-medialive/src/main/java/com/amazonaws/services/medialive/model/StartChannelResult.java#L658-L661 |
infinispan/infinispan | core/src/main/java/org/infinispan/util/concurrent/locks/StripedLock.java | StripedLock.acquireAllLocks | public void acquireAllLocks(List<Object> keys, boolean exclusive) {
"""
Acquires locks on keys passed in. Makes multiple calls to {@link #acquireLock(Object, boolean)}
@param keys keys to unlock
@param exclusive whether locks are exclusive.
"""
for (Object k : keys) {
acquireLock(k, exclusive);
}
} | java | public void acquireAllLocks(List<Object> keys, boolean exclusive) {
for (Object k : keys) {
acquireLock(k, exclusive);
}
} | [
"public",
"void",
"acquireAllLocks",
"(",
"List",
"<",
"Object",
">",
"keys",
",",
"boolean",
"exclusive",
")",
"{",
"for",
"(",
"Object",
"k",
":",
"keys",
")",
"{",
"acquireLock",
"(",
"k",
",",
"exclusive",
")",
";",
"}",
"}"
] | Acquires locks on keys passed in. Makes multiple calls to {@link #acquireLock(Object, boolean)}
@param keys keys to unlock
@param exclusive whether locks are exclusive. | [
"Acquires",
"locks",
"on",
"keys",
"passed",
"in",
".",
"Makes",
"multiple",
"calls",
"to",
"{",
"@link",
"#acquireLock",
"(",
"Object",
"boolean",
")",
"}"
] | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/util/concurrent/locks/StripedLock.java#L171-L175 |
Alluxio/alluxio | core/common/src/main/java/alluxio/util/UnderFileSystemUtils.java | UnderFileSystemUtils.deleteDirIfExists | public static void deleteDirIfExists(UnderFileSystem ufs, String path) throws IOException {
"""
Deletes the directory at the given path if it exists.
@param ufs instance of {@link UnderFileSystem}
@param path path to the directory
"""
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 |
liferay/com-liferay-commerce | commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceWarehousePersistenceImpl.java | CommerceWarehousePersistenceImpl.findByG_A_C | @Override
public List<CommerceWarehouse> findByG_A_C(long groupId, boolean active,
long commerceCountryId, int start, int end) {
"""
Returns a range of all the commerce warehouses where groupId = ? and active = ? and commerceCountryId = ?.
<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 CommerceWarehouseModelImpl}. 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 groupId the group ID
@param active the active
@param commerceCountryId the commerce country ID
@param start the lower bound of the range of commerce warehouses
@param end the upper bound of the range of commerce warehouses (not inclusive)
@return the range of matching commerce warehouses
"""
return findByG_A_C(groupId, active, commerceCountryId, start, end, null);
} | java | @Override
public List<CommerceWarehouse> findByG_A_C(long groupId, boolean active,
long commerceCountryId, int start, int end) {
return findByG_A_C(groupId, active, commerceCountryId, start, end, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CommerceWarehouse",
">",
"findByG_A_C",
"(",
"long",
"groupId",
",",
"boolean",
"active",
",",
"long",
"commerceCountryId",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"return",
"findByG_A_C",
"(",
"groupId",
",... | Returns a range of all the commerce warehouses where groupId = ? and active = ? and commerceCountryId = ?.
<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 CommerceWarehouseModelImpl}. 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 groupId the group ID
@param active the active
@param commerceCountryId the commerce country ID
@param start the lower bound of the range of commerce warehouses
@param end the upper bound of the range of commerce warehouses (not inclusive)
@return the range of matching commerce warehouses | [
"Returns",
"a",
"range",
"of",
"all",
"the",
"commerce",
"warehouses",
"where",
"groupId",
"=",
"?",
";",
"and",
"active",
"=",
"?",
";",
"and",
"commerceCountryId",
"=",
"?",
";",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceWarehousePersistenceImpl.java#L2308-L2312 |
lightblueseas/swing-components | src/main/java/de/alpharogroup/swing/robot/RobotExtensions.java | RobotExtensions.typeCharacter | public static void typeCharacter(final Robot robot, final char character)
throws IllegalAccessException, NoSuchFieldException {
"""
Types the given char with the given robot.
@param robot
the robot
@param character
the character
@throws IllegalAccessException
the illegal access exception
@throws NoSuchFieldException
the no such field exception
"""
final boolean upperCase = Character.isUpperCase(character);
final int keyCode = getKeyCode(character);
if (upperCase)
{
robot.keyPress(KeyEvent.VK_SHIFT);
}
robot.keyPress(keyCode);
robot.keyRelease(keyCode);
if (upperCase)
{
robot.keyRelease(KeyEvent.VK_SHIFT);
}
} | java | public static void typeCharacter(final Robot robot, final char character)
throws IllegalAccessException, NoSuchFieldException
{
final boolean upperCase = Character.isUpperCase(character);
final int keyCode = getKeyCode(character);
if (upperCase)
{
robot.keyPress(KeyEvent.VK_SHIFT);
}
robot.keyPress(keyCode);
robot.keyRelease(keyCode);
if (upperCase)
{
robot.keyRelease(KeyEvent.VK_SHIFT);
}
} | [
"public",
"static",
"void",
"typeCharacter",
"(",
"final",
"Robot",
"robot",
",",
"final",
"char",
"character",
")",
"throws",
"IllegalAccessException",
",",
"NoSuchFieldException",
"{",
"final",
"boolean",
"upperCase",
"=",
"Character",
".",
"isUpperCase",
"(",
"... | Types the given char with the given robot.
@param robot
the robot
@param character
the character
@throws IllegalAccessException
the illegal access exception
@throws NoSuchFieldException
the no such field exception | [
"Types",
"the",
"given",
"char",
"with",
"the",
"given",
"robot",
"."
] | train | https://github.com/lightblueseas/swing-components/blob/4045e85cabd8f0ce985cbfff134c3c9873930c79/src/main/java/de/alpharogroup/swing/robot/RobotExtensions.java#L71-L86 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/XmlUtil.java | XmlUtil.transform | public static void transform(Source source, Result result, String charset, int indent) {
"""
将XML文档写出<br>
格式化输出逻辑参考:https://stackoverflow.com/questions/139076/how-to-pretty-print-xml-from-java
@param source 源
@param result 目标
@param charset 编码
@param indent 格式化输出中缩进量,小于1表示不格式化输出
@since 4.0.9
"""
final TransformerFactory factory = TransformerFactory.newInstance();
try {
final Transformer xformer = factory.newTransformer();
if (indent > 0) {
xformer.setOutputProperty(OutputKeys.INDENT, "yes");
xformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", String.valueOf(indent));
}
if (StrUtil.isNotBlank(charset)) {
xformer.setOutputProperty(OutputKeys.ENCODING, charset);
}
xformer.transform(source, result);
} catch (Exception e) {
throw new UtilException(e, "Trans xml document to string error!");
}
} | java | public static void transform(Source source, Result result, String charset, int indent) {
final TransformerFactory factory = TransformerFactory.newInstance();
try {
final Transformer xformer = factory.newTransformer();
if (indent > 0) {
xformer.setOutputProperty(OutputKeys.INDENT, "yes");
xformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", String.valueOf(indent));
}
if (StrUtil.isNotBlank(charset)) {
xformer.setOutputProperty(OutputKeys.ENCODING, charset);
}
xformer.transform(source, result);
} catch (Exception e) {
throw new UtilException(e, "Trans xml document to string error!");
}
} | [
"public",
"static",
"void",
"transform",
"(",
"Source",
"source",
",",
"Result",
"result",
",",
"String",
"charset",
",",
"int",
"indent",
")",
"{",
"final",
"TransformerFactory",
"factory",
"=",
"TransformerFactory",
".",
"newInstance",
"(",
")",
";",
"try",
... | 将XML文档写出<br>
格式化输出逻辑参考:https://stackoverflow.com/questions/139076/how-to-pretty-print-xml-from-java
@param source 源
@param result 目标
@param charset 编码
@param indent 格式化输出中缩进量,小于1表示不格式化输出
@since 4.0.9 | [
"将XML文档写出<br",
">",
"格式化输出逻辑参考:https",
":",
"//",
"stackoverflow",
".",
"com",
"/",
"questions",
"/",
"139076",
"/",
"how",
"-",
"to",
"-",
"pretty",
"-",
"print",
"-",
"xml",
"-",
"from",
"-",
"java"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/XmlUtil.java#L351-L366 |
Alluxio/alluxio | shell/src/main/java/alluxio/cli/fs/FileSystemShellUtils.java | FileSystemShellUtils.getAlluxioURIs | public static List<AlluxioURI> getAlluxioURIs(FileSystem alluxioClient, AlluxioURI inputURI)
throws IOException {
"""
Gets all the {@link AlluxioURI}s that match inputURI. If the path is a regular path, the
returned list only contains the corresponding URI; Else if the path contains wildcards, the
returned list contains all the matched URIs It supports any number of wildcards in inputURI
@param alluxioClient the client used to fetch information of Alluxio files
@param inputURI the input URI (could contain wildcards)
@return a list of {@link AlluxioURI}s that matches the inputURI
"""
if (!inputURI.getPath().contains(AlluxioURI.WILDCARD)) {
return Lists.newArrayList(inputURI);
} else {
String inputPath = inputURI.getPath();
AlluxioURI parentURI = new AlluxioURI(inputURI.getScheme(), inputURI.getAuthority(),
inputPath.substring(0, inputPath.indexOf(AlluxioURI.WILDCARD) + 1),
inputURI.getQueryMap()).getParent();
return getAlluxioURIs(alluxioClient, inputURI, parentURI);
}
} | java | public static List<AlluxioURI> getAlluxioURIs(FileSystem alluxioClient, AlluxioURI inputURI)
throws IOException {
if (!inputURI.getPath().contains(AlluxioURI.WILDCARD)) {
return Lists.newArrayList(inputURI);
} else {
String inputPath = inputURI.getPath();
AlluxioURI parentURI = new AlluxioURI(inputURI.getScheme(), inputURI.getAuthority(),
inputPath.substring(0, inputPath.indexOf(AlluxioURI.WILDCARD) + 1),
inputURI.getQueryMap()).getParent();
return getAlluxioURIs(alluxioClient, inputURI, parentURI);
}
} | [
"public",
"static",
"List",
"<",
"AlluxioURI",
">",
"getAlluxioURIs",
"(",
"FileSystem",
"alluxioClient",
",",
"AlluxioURI",
"inputURI",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"inputURI",
".",
"getPath",
"(",
")",
".",
"contains",
"(",
"AlluxioURI"... | Gets all the {@link AlluxioURI}s that match inputURI. If the path is a regular path, the
returned list only contains the corresponding URI; Else if the path contains wildcards, the
returned list contains all the matched URIs It supports any number of wildcards in inputURI
@param alluxioClient the client used to fetch information of Alluxio files
@param inputURI the input URI (could contain wildcards)
@return a list of {@link AlluxioURI}s that matches the inputURI | [
"Gets",
"all",
"the",
"{",
"@link",
"AlluxioURI",
"}",
"s",
"that",
"match",
"inputURI",
".",
"If",
"the",
"path",
"is",
"a",
"regular",
"path",
"the",
"returned",
"list",
"only",
"contains",
"the",
"corresponding",
"URI",
";",
"Else",
"if",
"the",
"path... | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/shell/src/main/java/alluxio/cli/fs/FileSystemShellUtils.java#L108-L119 |
pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/attributes/SegmentAttributeBTreeIndex.java | SegmentAttributeBTreeIndex.executeConditionallyOnce | private CompletableFuture<Long> executeConditionallyOnce(Function<Duration, CompletableFuture<Long>> indexOperation, TimeoutTimer timer) {
"""
Executes the given Index Operation once, without performing retries. In case of failure with BadOffsetException
(which indicates a conditional update failure), the BTreeIndex is reinitialized to the most up-to-date state.
@param indexOperation A Function, that, when invoked, returns a CompletableFuture which indicates when the index
operation completes.
@param timer Timer for the operation.
@return A CompletableFuture that will indicate when the operation completes.
"""
return Futures.exceptionallyCompose(
indexOperation.apply(timer.getRemaining()),
ex -> {
if (Exceptions.unwrap(ex) instanceof BadOffsetException) {
BadOffsetException boe = (BadOffsetException) Exceptions.unwrap(ex);
if (boe.getExpectedOffset() != this.index.getIndexLength()) {
log.warn("{}: Conditional Index Update failed (expected {}, given {}). Reinitializing index.",
this.traceObjectId, boe.getExpectedOffset(), boe.getGivenOffset());
return this.index.initialize(timer.getRemaining())
.thenCompose(v -> Futures.failedFuture(ex));
}
}
// Make sure the exception bubbles up.
return Futures.failedFuture(ex);
});
} | java | private CompletableFuture<Long> executeConditionallyOnce(Function<Duration, CompletableFuture<Long>> indexOperation, TimeoutTimer timer) {
return Futures.exceptionallyCompose(
indexOperation.apply(timer.getRemaining()),
ex -> {
if (Exceptions.unwrap(ex) instanceof BadOffsetException) {
BadOffsetException boe = (BadOffsetException) Exceptions.unwrap(ex);
if (boe.getExpectedOffset() != this.index.getIndexLength()) {
log.warn("{}: Conditional Index Update failed (expected {}, given {}). Reinitializing index.",
this.traceObjectId, boe.getExpectedOffset(), boe.getGivenOffset());
return this.index.initialize(timer.getRemaining())
.thenCompose(v -> Futures.failedFuture(ex));
}
}
// Make sure the exception bubbles up.
return Futures.failedFuture(ex);
});
} | [
"private",
"CompletableFuture",
"<",
"Long",
">",
"executeConditionallyOnce",
"(",
"Function",
"<",
"Duration",
",",
"CompletableFuture",
"<",
"Long",
">",
">",
"indexOperation",
",",
"TimeoutTimer",
"timer",
")",
"{",
"return",
"Futures",
".",
"exceptionallyCompose... | Executes the given Index Operation once, without performing retries. In case of failure with BadOffsetException
(which indicates a conditional update failure), the BTreeIndex is reinitialized to the most up-to-date state.
@param indexOperation A Function, that, when invoked, returns a CompletableFuture which indicates when the index
operation completes.
@param timer Timer for the operation.
@return A CompletableFuture that will indicate when the operation completes. | [
"Executes",
"the",
"given",
"Index",
"Operation",
"once",
"without",
"performing",
"retries",
".",
"In",
"case",
"of",
"failure",
"with",
"BadOffsetException",
"(",
"which",
"indicates",
"a",
"conditional",
"update",
"failure",
")",
"the",
"BTreeIndex",
"is",
"r... | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/attributes/SegmentAttributeBTreeIndex.java#L389-L406 |
j-a-w-r/jawr-main-repo | jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/generator/GeneratorRegistry.java | GeneratorRegistry.getAvailableVariants | public Map<String, VariantSet> getAvailableVariants(String path) {
"""
Returns the available variant for a path
@param path
the path
@return the available variant for a path
"""
Map<String, VariantSet> availableVariants = new TreeMap<>();
ResourceGenerator generator = resolveResourceGenerator(path);
if (generator != null) {
if (generator instanceof VariantResourceGenerator) {
Map<String, VariantSet> tempResult = ((VariantResourceGenerator) generator)
.getAvailableVariants(generator.getResolver().getResourcePath(path));
if (tempResult != null) {
availableVariants = tempResult;
}
} else if (generator instanceof LocaleAwareResourceGenerator) {
List<String> availableLocales = ((LocaleAwareResourceGenerator) generator)
.getAvailableLocales(generator.getResolver().getResourcePath(path));
if (availableLocales != null) {
VariantSet variantSet = new VariantSet(JawrConstant.LOCALE_VARIANT_TYPE, "", availableLocales);
availableVariants.put(JawrConstant.LOCALE_VARIANT_TYPE, variantSet);
}
}
}
return availableVariants;
} | java | public Map<String, VariantSet> getAvailableVariants(String path) {
Map<String, VariantSet> availableVariants = new TreeMap<>();
ResourceGenerator generator = resolveResourceGenerator(path);
if (generator != null) {
if (generator instanceof VariantResourceGenerator) {
Map<String, VariantSet> tempResult = ((VariantResourceGenerator) generator)
.getAvailableVariants(generator.getResolver().getResourcePath(path));
if (tempResult != null) {
availableVariants = tempResult;
}
} else if (generator instanceof LocaleAwareResourceGenerator) {
List<String> availableLocales = ((LocaleAwareResourceGenerator) generator)
.getAvailableLocales(generator.getResolver().getResourcePath(path));
if (availableLocales != null) {
VariantSet variantSet = new VariantSet(JawrConstant.LOCALE_VARIANT_TYPE, "", availableLocales);
availableVariants.put(JawrConstant.LOCALE_VARIANT_TYPE, variantSet);
}
}
}
return availableVariants;
} | [
"public",
"Map",
"<",
"String",
",",
"VariantSet",
">",
"getAvailableVariants",
"(",
"String",
"path",
")",
"{",
"Map",
"<",
"String",
",",
"VariantSet",
">",
"availableVariants",
"=",
"new",
"TreeMap",
"<>",
"(",
")",
";",
"ResourceGenerator",
"generator",
... | Returns the available variant for a path
@param path
the path
@return the available variant for a path | [
"Returns",
"the",
"available",
"variant",
"for",
"a",
"path"
] | train | https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/generator/GeneratorRegistry.java#L595-L618 |
gfk-ba/senbot | SenBotRunner/src/main/java/com/gfk/senbot/framework/data/SenBotReferenceService.java | SenBotReferenceService.addLocatorReference | public void addLocatorReference(String locatorReference, By locator) {
"""
Map a {@link By} element locator to a reference name
@param locatorReference
@param locator
@deprecated use {@link SenBotReferenceService#addPageRepresentationReference(String, Class)} in stead to define views. Referencing elements at a global level
is a bad idea as it becomes congested within no time and the element context is completely lost
"""
Map<String, By> objectReferenceMap = getObjectReferenceMap(By.class);
objectReferenceMap.put(locatorReference, locator);
} | java | public void addLocatorReference(String locatorReference, By locator) {
Map<String, By> objectReferenceMap = getObjectReferenceMap(By.class);
objectReferenceMap.put(locatorReference, locator);
} | [
"public",
"void",
"addLocatorReference",
"(",
"String",
"locatorReference",
",",
"By",
"locator",
")",
"{",
"Map",
"<",
"String",
",",
"By",
">",
"objectReferenceMap",
"=",
"getObjectReferenceMap",
"(",
"By",
".",
"class",
")",
";",
"objectReferenceMap",
".",
... | Map a {@link By} element locator to a reference name
@param locatorReference
@param locator
@deprecated use {@link SenBotReferenceService#addPageRepresentationReference(String, Class)} in stead to define views. Referencing elements at a global level
is a bad idea as it becomes congested within no time and the element context is completely lost | [
"Map",
"a",
"{",
"@link",
"By",
"}",
"element",
"locator",
"to",
"a",
"reference",
"name"
] | train | https://github.com/gfk-ba/senbot/blob/e9a152aa67be48b1bb13a4691655caf6d873b553/SenBotRunner/src/main/java/com/gfk/senbot/framework/data/SenBotReferenceService.java#L138-L141 |
composable-systems/dropwizard-cassandra | src/main/java/systems/composable/dropwizard/cassandra/CassandraBundle.java | CassandraBundle.run | @Override
public void run(T configuration, Environment environment) throws Exception {
"""
Initializes the Cassandra environment: registers context binder for
{@link com.datastax.driver.core.Cluster} and {@link com.datastax.driver.core.Session} instances.
@param configuration The configuration object
@param environment The application's Environment
"""
environment.jersey().register(CassandraProvider.binder(getCassandraFactory(configuration), environment));
} | java | @Override
public void run(T configuration, Environment environment) throws Exception {
environment.jersey().register(CassandraProvider.binder(getCassandraFactory(configuration), environment));
} | [
"@",
"Override",
"public",
"void",
"run",
"(",
"T",
"configuration",
",",
"Environment",
"environment",
")",
"throws",
"Exception",
"{",
"environment",
".",
"jersey",
"(",
")",
".",
"register",
"(",
"CassandraProvider",
".",
"binder",
"(",
"getCassandraFactory",... | Initializes the Cassandra environment: registers context binder for
{@link com.datastax.driver.core.Cluster} and {@link com.datastax.driver.core.Session} instances.
@param configuration The configuration object
@param environment The application's Environment | [
"Initializes",
"the",
"Cassandra",
"environment",
":",
"registers",
"context",
"binder",
"for",
"{",
"@link",
"com",
".",
"datastax",
".",
"driver",
".",
"core",
".",
"Cluster",
"}",
"and",
"{",
"@link",
"com",
".",
"datastax",
".",
"driver",
".",
"core",
... | train | https://github.com/composable-systems/dropwizard-cassandra/blob/3f3ac96ec64bd26c14dc3111f343f87054621fe2/src/main/java/systems/composable/dropwizard/cassandra/CassandraBundle.java#L102-L105 |
JOML-CI/JOML | src/org/joml/Matrix4f.java | Matrix4f.setOrtho | public Matrix4f setOrtho(float left, float right, float bottom, float top, float zNear, float zFar, boolean zZeroToOne) {
"""
Set this matrix to be an orthographic projection transformation for a right-handed coordinate system
using the given NDC z range.
<p>
In order to apply the orthographic projection to an already existing transformation,
use {@link #ortho(float, float, float, float, float, float, boolean) ortho()}.
<p>
Reference: <a href="http://www.songho.ca/opengl/gl_projectionmatrix.html#ortho">http://www.songho.ca</a>
@see #ortho(float, float, float, float, float, float, boolean)
@param left
the distance from the center to the left frustum edge
@param right
the distance from the center to the right frustum edge
@param bottom
the distance from the center to the bottom frustum edge
@param top
the distance from the center to the top frustum edge
@param zNear
near clipping plane distance
@param zFar
far clipping plane distance
@param zZeroToOne
whether to use Vulkan's and Direct3D's NDC z range of <code>[0..+1]</code> when <code>true</code>
or whether to use OpenGL's NDC z range of <code>[-1..+1]</code> when <code>false</code>
@return this
"""
if ((properties & PROPERTY_IDENTITY) == 0)
MemUtil.INSTANCE.identity(this);
this._m00(2.0f / (right - left));
this._m11(2.0f / (top - bottom));
this._m22((zZeroToOne ? 1.0f : 2.0f) / (zNear - zFar));
this._m30((right + left) / (left - right));
this._m31((top + bottom) / (bottom - top));
this._m32((zZeroToOne ? zNear : (zFar + zNear)) / (zNear - zFar));
_properties(PROPERTY_AFFINE);
return this;
} | java | public Matrix4f setOrtho(float left, float right, float bottom, float top, float zNear, float zFar, boolean zZeroToOne) {
if ((properties & PROPERTY_IDENTITY) == 0)
MemUtil.INSTANCE.identity(this);
this._m00(2.0f / (right - left));
this._m11(2.0f / (top - bottom));
this._m22((zZeroToOne ? 1.0f : 2.0f) / (zNear - zFar));
this._m30((right + left) / (left - right));
this._m31((top + bottom) / (bottom - top));
this._m32((zZeroToOne ? zNear : (zFar + zNear)) / (zNear - zFar));
_properties(PROPERTY_AFFINE);
return this;
} | [
"public",
"Matrix4f",
"setOrtho",
"(",
"float",
"left",
",",
"float",
"right",
",",
"float",
"bottom",
",",
"float",
"top",
",",
"float",
"zNear",
",",
"float",
"zFar",
",",
"boolean",
"zZeroToOne",
")",
"{",
"if",
"(",
"(",
"properties",
"&",
"PROPERTY_... | Set this matrix to be an orthographic projection transformation for a right-handed coordinate system
using the given NDC z range.
<p>
In order to apply the orthographic projection to an already existing transformation,
use {@link #ortho(float, float, float, float, float, float, boolean) ortho()}.
<p>
Reference: <a href="http://www.songho.ca/opengl/gl_projectionmatrix.html#ortho">http://www.songho.ca</a>
@see #ortho(float, float, float, float, float, float, boolean)
@param left
the distance from the center to the left frustum edge
@param right
the distance from the center to the right frustum edge
@param bottom
the distance from the center to the bottom frustum edge
@param top
the distance from the center to the top frustum edge
@param zNear
near clipping plane distance
@param zFar
far clipping plane distance
@param zZeroToOne
whether to use Vulkan's and Direct3D's NDC z range of <code>[0..+1]</code> when <code>true</code>
or whether to use OpenGL's NDC z range of <code>[-1..+1]</code> when <code>false</code>
@return this | [
"Set",
"this",
"matrix",
"to",
"be",
"an",
"orthographic",
"projection",
"transformation",
"for",
"a",
"right",
"-",
"handed",
"coordinate",
"system",
"using",
"the",
"given",
"NDC",
"z",
"range",
".",
"<p",
">",
"In",
"order",
"to",
"apply",
"the",
"ortho... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4f.java#L7188-L7199 |
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) {
"""
Gets an Object context property.
@param exchange the exchange
@param message the message
@param name the name
@return the property
"""
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 |
alkacon/opencms-core | src/org/opencms/jsp/CmsJspTagDisplay.java | CmsJspTagDisplay.getFormatterForType | private I_CmsFormatterBean getFormatterForType(CmsObject cms, CmsResource resource, boolean isOnline) {
"""
Returns the config for the requested resource, or <code>null</code> if not available.<p>
@param cms the cms context
@param resource the resource
@param isOnline the is online flag
@return the formatter configuration bean
"""
String typeName = OpenCms.getResourceManager().getResourceType(resource).getTypeName();
I_CmsFormatterBean result = null;
if (m_displayFormatterPaths.containsKey(typeName)) {
try {
CmsResource res = cms.readResource(m_displayFormatterPaths.get(typeName));
result = OpenCms.getADEManager().getCachedFormatters(isOnline).getFormatters().get(
res.getStructureId());
} catch (CmsException e) {
LOG.error(e.getLocalizedMessage(), e);
}
} else if (m_displayFormatterIds.containsKey(typeName)) {
result = OpenCms.getADEManager().getCachedFormatters(isOnline).getFormatters().get(
m_displayFormatterIds.get(typeName));
} else {
CmsADEConfigData config = OpenCms.getADEManager().lookupConfiguration(
cms,
cms.addSiteRoot(cms.getRequestContext().getFolderUri()));
if (config != null) {
CmsFormatterConfiguration formatters = config.getFormatters(cms, resource);
if (formatters != null) {
result = formatters.getDisplayFormatter();
}
}
}
return result;
} | java | private I_CmsFormatterBean getFormatterForType(CmsObject cms, CmsResource resource, boolean isOnline) {
String typeName = OpenCms.getResourceManager().getResourceType(resource).getTypeName();
I_CmsFormatterBean result = null;
if (m_displayFormatterPaths.containsKey(typeName)) {
try {
CmsResource res = cms.readResource(m_displayFormatterPaths.get(typeName));
result = OpenCms.getADEManager().getCachedFormatters(isOnline).getFormatters().get(
res.getStructureId());
} catch (CmsException e) {
LOG.error(e.getLocalizedMessage(), e);
}
} else if (m_displayFormatterIds.containsKey(typeName)) {
result = OpenCms.getADEManager().getCachedFormatters(isOnline).getFormatters().get(
m_displayFormatterIds.get(typeName));
} else {
CmsADEConfigData config = OpenCms.getADEManager().lookupConfiguration(
cms,
cms.addSiteRoot(cms.getRequestContext().getFolderUri()));
if (config != null) {
CmsFormatterConfiguration formatters = config.getFormatters(cms, resource);
if (formatters != null) {
result = formatters.getDisplayFormatter();
}
}
}
return result;
} | [
"private",
"I_CmsFormatterBean",
"getFormatterForType",
"(",
"CmsObject",
"cms",
",",
"CmsResource",
"resource",
",",
"boolean",
"isOnline",
")",
"{",
"String",
"typeName",
"=",
"OpenCms",
".",
"getResourceManager",
"(",
")",
".",
"getResourceType",
"(",
"resource",... | Returns the config for the requested resource, or <code>null</code> if not available.<p>
@param cms the cms context
@param resource the resource
@param isOnline the is online flag
@return the formatter configuration bean | [
"Returns",
"the",
"config",
"for",
"the",
"requested",
"resource",
"or",
"<code",
">",
"null<",
"/",
"code",
">",
"if",
"not",
"available",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/CmsJspTagDisplay.java#L586-L613 |
lessthanoptimal/BoofCV | integration/boofcv-android/src/main/java/boofcv/android/camera2/VisualizeCamera2Activity.java | VisualizeCamera2Activity.renderBitmapImage | protected void renderBitmapImage( BitmapMode mode , ImageBase image ) {
"""
Renders the bitmap image to output. If you don't wish to have this behavior then override this function.
Jsut make sure you respect the bitmap mode or the image might not render as desired or you could crash the app.
"""
switch( mode ) {
case UNSAFE: {
if (image.getWidth() == bitmap.getWidth() && image.getHeight() == bitmap.getHeight())
ConvertBitmap.boofToBitmap(image, bitmap, bitmapTmp);
} break;
case DOUBLE_BUFFER: {
// TODO if there are multiple processing threads bad stuff will happen here. Need one work buffer
// per thread
// convert the image. this can be a slow operation
if (image.getWidth() == bitmapWork.getWidth() && image.getHeight() == bitmapWork.getHeight())
ConvertBitmap.boofToBitmap(image, bitmapWork, bitmapTmp);
// swap the two buffers. If it's locked don't swap. This will skip a frame but will not cause
// a significant slow down
if( bitmapLock.tryLock() ) {
try {
Bitmap tmp = bitmapWork;
bitmapWork = bitmap;
bitmap = tmp;
} finally {
bitmapLock.unlock();
}
}
} break;
}
} | java | protected void renderBitmapImage( BitmapMode mode , ImageBase image ) {
switch( mode ) {
case UNSAFE: {
if (image.getWidth() == bitmap.getWidth() && image.getHeight() == bitmap.getHeight())
ConvertBitmap.boofToBitmap(image, bitmap, bitmapTmp);
} break;
case DOUBLE_BUFFER: {
// TODO if there are multiple processing threads bad stuff will happen here. Need one work buffer
// per thread
// convert the image. this can be a slow operation
if (image.getWidth() == bitmapWork.getWidth() && image.getHeight() == bitmapWork.getHeight())
ConvertBitmap.boofToBitmap(image, bitmapWork, bitmapTmp);
// swap the two buffers. If it's locked don't swap. This will skip a frame but will not cause
// a significant slow down
if( bitmapLock.tryLock() ) {
try {
Bitmap tmp = bitmapWork;
bitmapWork = bitmap;
bitmap = tmp;
} finally {
bitmapLock.unlock();
}
}
} break;
}
} | [
"protected",
"void",
"renderBitmapImage",
"(",
"BitmapMode",
"mode",
",",
"ImageBase",
"image",
")",
"{",
"switch",
"(",
"mode",
")",
"{",
"case",
"UNSAFE",
":",
"{",
"if",
"(",
"image",
".",
"getWidth",
"(",
")",
"==",
"bitmap",
".",
"getWidth",
"(",
... | Renders the bitmap image to output. If you don't wish to have this behavior then override this function.
Jsut make sure you respect the bitmap mode or the image might not render as desired or you could crash the app. | [
"Renders",
"the",
"bitmap",
"image",
"to",
"output",
".",
"If",
"you",
"don",
"t",
"wish",
"to",
"have",
"this",
"behavior",
"then",
"override",
"this",
"function",
".",
"Jsut",
"make",
"sure",
"you",
"respect",
"the",
"bitmap",
"mode",
"or",
"the",
"ima... | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/integration/boofcv-android/src/main/java/boofcv/android/camera2/VisualizeCamera2Activity.java#L420-L447 |
h2oai/h2o-3 | h2o-persist-s3/src/main/java/water/persist/PersistS3.java | PersistS3.getObjectForKey | private static S3Object getObjectForKey(Key k, long offset, long length) throws IOException {
"""
Gets the S3 object associated with the key that can read length bytes from offset
"""
String[] bk = decodeKey(k);
GetObjectRequest r = new GetObjectRequest(bk[0], bk[1]);
r.setRange(offset, offset + length - 1); // Range is *inclusive* according to docs???
return getClient().getObject(r);
} | java | private static S3Object getObjectForKey(Key k, long offset, long length) throws IOException {
String[] bk = decodeKey(k);
GetObjectRequest r = new GetObjectRequest(bk[0], bk[1]);
r.setRange(offset, offset + length - 1); // Range is *inclusive* according to docs???
return getClient().getObject(r);
} | [
"private",
"static",
"S3Object",
"getObjectForKey",
"(",
"Key",
"k",
",",
"long",
"offset",
",",
"long",
"length",
")",
"throws",
"IOException",
"{",
"String",
"[",
"]",
"bk",
"=",
"decodeKey",
"(",
"k",
")",
";",
"GetObjectRequest",
"r",
"=",
"new",
"Ge... | Gets the S3 object associated with the key that can read length bytes from offset | [
"Gets",
"the",
"S3",
"object",
"associated",
"with",
"the",
"key",
"that",
"can",
"read",
"length",
"bytes",
"from",
"offset"
] | train | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-persist-s3/src/main/java/water/persist/PersistS3.java#L336-L341 |
lkwg82/enforcer-rules | src/main/java/org/apache/maven/plugins/enforcer/EvaluateBeanshell.java | EvaluateBeanshell.evaluateCondition | protected boolean evaluateCondition( String script, Log log )
throws EnforcerRuleException {
"""
Evaluate expression using Beanshell.
@param script the expression to be evaluated
@param log the logger
@return boolean the evaluation of the expression
@throws EnforcerRuleException if the script could not be evaluated
"""
Boolean evaluation = Boolean.FALSE;
try
{
evaluation = (Boolean) bsh.eval( script );
log.debug( "Echo evaluating : " + evaluation );
}
catch ( EvalError ex )
{
throw new EnforcerRuleException( "Couldn't evaluate condition: " + script, ex );
}
return evaluation.booleanValue();
} | java | protected boolean evaluateCondition( String script, Log log )
throws EnforcerRuleException
{
Boolean evaluation = Boolean.FALSE;
try
{
evaluation = (Boolean) bsh.eval( script );
log.debug( "Echo evaluating : " + evaluation );
}
catch ( EvalError ex )
{
throw new EnforcerRuleException( "Couldn't evaluate condition: " + script, ex );
}
return evaluation.booleanValue();
} | [
"protected",
"boolean",
"evaluateCondition",
"(",
"String",
"script",
",",
"Log",
"log",
")",
"throws",
"EnforcerRuleException",
"{",
"Boolean",
"evaluation",
"=",
"Boolean",
".",
"FALSE",
";",
"try",
"{",
"evaluation",
"=",
"(",
"Boolean",
")",
"bsh",
".",
... | Evaluate expression using Beanshell.
@param script the expression to be evaluated
@param log the logger
@return boolean the evaluation of the expression
@throws EnforcerRuleException if the script could not be evaluated | [
"Evaluate",
"expression",
"using",
"Beanshell",
"."
] | train | https://github.com/lkwg82/enforcer-rules/blob/fa2d309af7907b17fc8eaf386f8056d77b654749/src/main/java/org/apache/maven/plugins/enforcer/EvaluateBeanshell.java#L103-L117 |
bbossgroups/bboss-elasticsearch | bboss-elasticsearch-rest/src/main/java/org/frameworkset/elasticsearch/client/ConfigRestClientUtil.java | ConfigRestClientUtil.executeHttp | public String executeHttp(String path, String templateName,Object bean, String action) throws ElasticSearchException {
"""
发送es restful请求,返回String类型json报文
@param path
@param templateName 请求报文dsl名称,在配置文件中指定
@param action get,post,put,delete
@return
@throws ElasticSearchException
"""
return super.executeHttp( path, ESTemplateHelper.evalTemplate(esUtil,templateName, bean), action);
} | java | public String executeHttp(String path, String templateName,Object bean, String action) throws ElasticSearchException{
return super.executeHttp( path, ESTemplateHelper.evalTemplate(esUtil,templateName, bean), action);
} | [
"public",
"String",
"executeHttp",
"(",
"String",
"path",
",",
"String",
"templateName",
",",
"Object",
"bean",
",",
"String",
"action",
")",
"throws",
"ElasticSearchException",
"{",
"return",
"super",
".",
"executeHttp",
"(",
"path",
",",
"ESTemplateHelper",
".... | 发送es restful请求,返回String类型json报文
@param path
@param templateName 请求报文dsl名称,在配置文件中指定
@param action get,post,put,delete
@return
@throws ElasticSearchException | [
"发送es",
"restful请求,返回String类型json报文"
] | train | https://github.com/bbossgroups/bboss-elasticsearch/blob/31717c8aa2c4c880987be53aeeb8a0cf5183c3a7/bboss-elasticsearch-rest/src/main/java/org/frameworkset/elasticsearch/client/ConfigRestClientUtil.java#L396-L398 |
cdk/cdk | display/renderbasic/src/main/java/org/openscience/cdk/renderer/elements/Bounds.java | Bounds.add | public void add(double x, double y) {
"""
Ensure the point x,y is included in the bounding box.
@param x x-coordinate
@param y y-coordinate
"""
if (x < minX) minX = x;
if (y < minY) minY = y;
if (x > maxX) maxX = x;
if (y > maxY) maxY = y;
} | java | public void add(double x, double y) {
if (x < minX) minX = x;
if (y < minY) minY = y;
if (x > maxX) maxX = x;
if (y > maxY) maxY = y;
} | [
"public",
"void",
"add",
"(",
"double",
"x",
",",
"double",
"y",
")",
"{",
"if",
"(",
"x",
"<",
"minX",
")",
"minX",
"=",
"x",
";",
"if",
"(",
"y",
"<",
"minY",
")",
"minY",
"=",
"y",
";",
"if",
"(",
"x",
">",
"maxX",
")",
"maxX",
"=",
"x... | Ensure the point x,y is included in the bounding box.
@param x x-coordinate
@param y y-coordinate | [
"Ensure",
"the",
"point",
"x",
"y",
"is",
"included",
"in",
"the",
"bounding",
"box",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/display/renderbasic/src/main/java/org/openscience/cdk/renderer/elements/Bounds.java#L106-L111 |
hal/elemento | core/src/main/java/org/jboss/gwt/elemento/core/Elements.java | Elements.insertAfter | public static void insertAfter(Element newElement, Element after) {
"""
Inserts the specified element into the parent of the after element.
"""
after.parentNode.insertBefore(newElement, after.nextSibling);
} | java | public static void insertAfter(Element newElement, Element after) {
after.parentNode.insertBefore(newElement, after.nextSibling);
} | [
"public",
"static",
"void",
"insertAfter",
"(",
"Element",
"newElement",
",",
"Element",
"after",
")",
"{",
"after",
".",
"parentNode",
".",
"insertBefore",
"(",
"newElement",
",",
"after",
".",
"nextSibling",
")",
";",
"}"
] | Inserts the specified element into the parent of the after element. | [
"Inserts",
"the",
"specified",
"element",
"into",
"the",
"parent",
"of",
"the",
"after",
"element",
"."
] | train | https://github.com/hal/elemento/blob/26da2d5a1fe2ec55b779737dbaeda25a942eee61/core/src/main/java/org/jboss/gwt/elemento/core/Elements.java#L655-L657 |
apereo/cas | core/cas-server-core-webflow-api/src/main/java/org/apereo/cas/web/flow/configurer/AbstractCasWebflowConfigurer.java | AbstractCasWebflowConfigurer.createTransitionsForState | public void createTransitionsForState(final Flow flow, final String stateId, final Map<String, String> criteriaAndTargets) {
"""
Create transitions for state.
@param flow the flow
@param stateId the state id
@param criteriaAndTargets the criteria and targets
"""
if (containsFlowState(flow, stateId)) {
val state = getState(flow, stateId);
criteriaAndTargets.forEach((k, v) -> createTransitionForState(state, k, v));
}
} | java | public void createTransitionsForState(final Flow flow, final String stateId, final Map<String, String> criteriaAndTargets) {
if (containsFlowState(flow, stateId)) {
val state = getState(flow, stateId);
criteriaAndTargets.forEach((k, v) -> createTransitionForState(state, k, v));
}
} | [
"public",
"void",
"createTransitionsForState",
"(",
"final",
"Flow",
"flow",
",",
"final",
"String",
"stateId",
",",
"final",
"Map",
"<",
"String",
",",
"String",
">",
"criteriaAndTargets",
")",
"{",
"if",
"(",
"containsFlowState",
"(",
"flow",
",",
"stateId",... | Create transitions for state.
@param flow the flow
@param stateId the state id
@param criteriaAndTargets the criteria and targets | [
"Create",
"transitions",
"for",
"state",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-webflow-api/src/main/java/org/apereo/cas/web/flow/configurer/AbstractCasWebflowConfigurer.java#L783-L788 |
kiswanij/jk-util | src/main/java/com/jk/util/exceptions/handler/JKExceptionHandlerFactory.java | JKExceptionHandlerFactory.setHandler | public void setHandler(final Class<? extends Throwable> clas, final JKExceptionHandler handler) {
"""
Sets the handler.
@param clas the clas
@param handler the handler
"""
this.handlers.put(clas, handler);
} | java | public void setHandler(final Class<? extends Throwable> clas, final JKExceptionHandler handler) {
this.handlers.put(clas, handler);
} | [
"public",
"void",
"setHandler",
"(",
"final",
"Class",
"<",
"?",
"extends",
"Throwable",
">",
"clas",
",",
"final",
"JKExceptionHandler",
"handler",
")",
"{",
"this",
".",
"handlers",
".",
"put",
"(",
"clas",
",",
"handler",
")",
";",
"}"
] | Sets the handler.
@param clas the clas
@param handler the handler | [
"Sets",
"the",
"handler",
"."
] | train | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/exceptions/handler/JKExceptionHandlerFactory.java#L113-L115 |
threerings/narya | core/src/main/java/com/threerings/presents/dobj/DObject.java | DObject.clearLock | protected void clearLock (String name) {
"""
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
"""
// 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 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/internal/RowSetUtil.java | RowSetUtil.shard | @Nonnull
public static List<RowSet> shard(
@Nonnull RowSet rowSet, @Nonnull SortedSet<ByteString> splitPoints) {
"""
Splits the provided {@link RowSet} into segments partitioned by the provided {@code
splitPoints}. Each split point represents the last row of the corresponding segment. The row
keys contained in the provided {@link RowSet} will be distributed across the segments. Each
range in the {@link RowSet} will be split up across each segment.
@see #split(RowSet, SortedSet, boolean) for more details.
"""
return split(rowSet, splitPoints, false);
} | java | @Nonnull
public static List<RowSet> shard(
@Nonnull RowSet rowSet, @Nonnull SortedSet<ByteString> splitPoints) {
return split(rowSet, splitPoints, false);
} | [
"@",
"Nonnull",
"public",
"static",
"List",
"<",
"RowSet",
">",
"shard",
"(",
"@",
"Nonnull",
"RowSet",
"rowSet",
",",
"@",
"Nonnull",
"SortedSet",
"<",
"ByteString",
">",
"splitPoints",
")",
"{",
"return",
"split",
"(",
"rowSet",
",",
"splitPoints",
",",
... | Splits the provided {@link RowSet} into segments partitioned by the provided {@code
splitPoints}. Each split point represents the last row of the corresponding segment. The row
keys contained in the provided {@link RowSet} will be distributed across the segments. Each
range in the {@link RowSet} will be split up across each segment.
@see #split(RowSet, SortedSet, boolean) for more details. | [
"Splits",
"the",
"provided",
"{",
"@link",
"RowSet",
"}",
"into",
"segments",
"partitioned",
"by",
"the",
"provided",
"{",
"@code",
"splitPoints",
"}",
".",
"Each",
"split",
"point",
"represents",
"the",
"last",
"row",
"of",
"the",
"corresponding",
"segment",
... | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/internal/RowSetUtil.java#L75-L79 |
jhy/jsoup | src/main/java/org/jsoup/nodes/Document.java | Document.normaliseStructure | private void normaliseStructure(String tag, Element htmlEl) {
"""
merge multiple <head> or <body> contents into one, delete the remainder, and ensure they are owned by <html>
"""
Elements elements = this.getElementsByTag(tag);
Element master = elements.first(); // will always be available as created above if not existent
if (elements.size() > 1) { // dupes, move contents to master
List<Node> toMove = new ArrayList<>();
for (int i = 1; i < elements.size(); i++) {
Node dupe = elements.get(i);
toMove.addAll(dupe.ensureChildNodes());
dupe.remove();
}
for (Node dupe : toMove)
master.appendChild(dupe);
}
// ensure parented by <html>
if (!master.parent().equals(htmlEl)) {
htmlEl.appendChild(master); // includes remove()
}
} | java | private void normaliseStructure(String tag, Element htmlEl) {
Elements elements = this.getElementsByTag(tag);
Element master = elements.first(); // will always be available as created above if not existent
if (elements.size() > 1) { // dupes, move contents to master
List<Node> toMove = new ArrayList<>();
for (int i = 1; i < elements.size(); i++) {
Node dupe = elements.get(i);
toMove.addAll(dupe.ensureChildNodes());
dupe.remove();
}
for (Node dupe : toMove)
master.appendChild(dupe);
}
// ensure parented by <html>
if (!master.parent().equals(htmlEl)) {
htmlEl.appendChild(master); // includes remove()
}
} | [
"private",
"void",
"normaliseStructure",
"(",
"String",
"tag",
",",
"Element",
"htmlEl",
")",
"{",
"Elements",
"elements",
"=",
"this",
".",
"getElementsByTag",
"(",
"tag",
")",
";",
"Element",
"master",
"=",
"elements",
".",
"first",
"(",
")",
";",
"// wi... | merge multiple <head> or <body> contents into one, delete the remainder, and ensure they are owned by <html> | [
"merge",
"multiple",
"<head",
">",
"or",
"<body",
">",
"contents",
"into",
"one",
"delete",
"the",
"remainder",
"and",
"ensure",
"they",
"are",
"owned",
"by",
"<html",
">"
] | train | https://github.com/jhy/jsoup/blob/68ff8cbe7ad847059737a09c567a501a7f1d251f/src/main/java/org/jsoup/nodes/Document.java#L161-L179 |
lessthanoptimal/ejml | main/ejml-core/src/org/ejml/ops/ComplexMath_F64.java | ComplexMath_F64.multiply | public static void multiply(Complex_F64 a, Complex_F64 b, Complex_F64 result) {
"""
<p>
Multiplication: result = a * b
</p>
@param a Complex number. Not modified.
@param b Complex number. Not modified.
@param result Storage for output
"""
result.real = a.real * b.real - a.imaginary*b.imaginary;
result.imaginary = a.real*b.imaginary + a.imaginary*b.real;
} | java | public static void multiply(Complex_F64 a, Complex_F64 b, Complex_F64 result) {
result.real = a.real * b.real - a.imaginary*b.imaginary;
result.imaginary = a.real*b.imaginary + a.imaginary*b.real;
} | [
"public",
"static",
"void",
"multiply",
"(",
"Complex_F64",
"a",
",",
"Complex_F64",
"b",
",",
"Complex_F64",
"result",
")",
"{",
"result",
".",
"real",
"=",
"a",
".",
"real",
"*",
"b",
".",
"real",
"-",
"a",
".",
"imaginary",
"*",
"b",
".",
"imagina... | <p>
Multiplication: result = a * b
</p>
@param a Complex number. Not modified.
@param b Complex number. Not modified.
@param result Storage for output | [
"<p",
">",
"Multiplication",
":",
"result",
"=",
"a",
"*",
"b",
"<",
"/",
"p",
">"
] | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-core/src/org/ejml/ops/ComplexMath_F64.java#L80-L83 |
jcuda/jcuda | JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java | JCudaDriver.cuMemRangeGetAttributes | public static int cuMemRangeGetAttributes(Pointer data[], long dataSizes[], int attributes[], long numAttributes, CUdeviceptr devPtr, long count) {
"""
Query attributes of a given memory range.<br>
<br>
Query attributes of the memory range starting at devPtr with a size of
count bytes. The memory range must refer to managed memory allocated via
cuMemAllocManaged or declared via __managed__ variables. The attributes
array will be interpreted to have numAttributes entries. The dataSizes
array will also be interpreted to have numAttributes entries. The results
of the query will be stored in data.<br>
<br>
<br>
The list of supported attributes are given below. Please refer to
{@link JCudaDriver#cuMemRangeGetAttribute} for attribute descriptions and
restrictions.
<ul>
<li>CU_MEM_RANGE_ATTRIBUTE_READ_MOSTLY</li>
<li>CU_MEM_RANGE_ATTRIBUTE_PREFERRED_LOCATION</li>
<li>CU_MEM_RANGE_ATTRIBUTE_ACCESSED_BY</li>
<li>CU_MEM_RANGE_ATTRIBUTE_LAST_PREFETCH_LOCATION</li>
</ul>
@param data A two-dimensional array containing pointers to memory
locations where the result of each attribute query will be written
to.
@param dataSizes Array containing the sizes of each result
@param attributes An array of attributes to query (numAttributes and the
number of attributes in this array should match)
@param numAttributes Number of attributes to query
@param devPtr Start of the range to query
@param count Size of the range to query
@return CUDA_SUCCESS, CUDA_ERROR_DEINITIALIZED,
CUDA_ERROR_INVALID_CONTEXT, CUDA_ERROR_INVALID_VALUE,
CUDA_ERROR_INVALID_DEVICE
"""
return checkResult(cuMemRangeGetAttributesNative(data, dataSizes, attributes, numAttributes, devPtr, count));
} | java | public static int cuMemRangeGetAttributes(Pointer data[], long dataSizes[], int attributes[], long numAttributes, CUdeviceptr devPtr, long count)
{
return checkResult(cuMemRangeGetAttributesNative(data, dataSizes, attributes, numAttributes, devPtr, count));
} | [
"public",
"static",
"int",
"cuMemRangeGetAttributes",
"(",
"Pointer",
"data",
"[",
"]",
",",
"long",
"dataSizes",
"[",
"]",
",",
"int",
"attributes",
"[",
"]",
",",
"long",
"numAttributes",
",",
"CUdeviceptr",
"devPtr",
",",
"long",
"count",
")",
"{",
"ret... | Query attributes of a given memory range.<br>
<br>
Query attributes of the memory range starting at devPtr with a size of
count bytes. The memory range must refer to managed memory allocated via
cuMemAllocManaged or declared via __managed__ variables. The attributes
array will be interpreted to have numAttributes entries. The dataSizes
array will also be interpreted to have numAttributes entries. The results
of the query will be stored in data.<br>
<br>
<br>
The list of supported attributes are given below. Please refer to
{@link JCudaDriver#cuMemRangeGetAttribute} for attribute descriptions and
restrictions.
<ul>
<li>CU_MEM_RANGE_ATTRIBUTE_READ_MOSTLY</li>
<li>CU_MEM_RANGE_ATTRIBUTE_PREFERRED_LOCATION</li>
<li>CU_MEM_RANGE_ATTRIBUTE_ACCESSED_BY</li>
<li>CU_MEM_RANGE_ATTRIBUTE_LAST_PREFETCH_LOCATION</li>
</ul>
@param data A two-dimensional array containing pointers to memory
locations where the result of each attribute query will be written
to.
@param dataSizes Array containing the sizes of each result
@param attributes An array of attributes to query (numAttributes and the
number of attributes in this array should match)
@param numAttributes Number of attributes to query
@param devPtr Start of the range to query
@param count Size of the range to query
@return CUDA_SUCCESS, CUDA_ERROR_DEINITIALIZED,
CUDA_ERROR_INVALID_CONTEXT, CUDA_ERROR_INVALID_VALUE,
CUDA_ERROR_INVALID_DEVICE | [
"Query",
"attributes",
"of",
"a",
"given",
"memory",
"range",
".",
"<br",
">",
"<br",
">",
"Query",
"attributes",
"of",
"the",
"memory",
"range",
"starting",
"at",
"devPtr",
"with",
"a",
"size",
"of",
"count",
"bytes",
".",
"The",
"memory",
"range",
"mus... | train | https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java#L14251-L14254 |
m-m-m/util | exception/src/main/java/net/sf/mmm/util/exception/api/ValueOutOfRangeException.java | ValueOutOfRangeException.verifyComparable | @SuppressWarnings( {
"""
Verifies that the {@code value} is actually out of range.
@param <V> is the generic type of the values.
@param value is the number that is out of range.
@param minimum is the minimum value allowed
@param maximum is the maximum value allowed.
""" "rawtypes", "unchecked" })
private <V extends Comparable> void verifyComparable(V value, V minimum, V maximum) {
if (minimum != null) {
if (maximum != null) {
assert ((value.compareTo(minimum) < 0) || (value.compareTo(maximum) > 0));
} else {
assert (value.compareTo(minimum) < 0);
}
} else if (maximum != null) {
assert (value.compareTo(maximum) > 0);
} else {
throw new NlsNullPointerException("minimum & maximum");
}
} | java | @SuppressWarnings({ "rawtypes", "unchecked" })
private <V extends Comparable> void verifyComparable(V value, V minimum, V maximum) {
if (minimum != null) {
if (maximum != null) {
assert ((value.compareTo(minimum) < 0) || (value.compareTo(maximum) > 0));
} else {
assert (value.compareTo(minimum) < 0);
}
} else if (maximum != null) {
assert (value.compareTo(maximum) > 0);
} else {
throw new NlsNullPointerException("minimum & maximum");
}
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"rawtypes\"",
",",
"\"unchecked\"",
"}",
")",
"private",
"<",
"V",
"extends",
"Comparable",
">",
"void",
"verifyComparable",
"(",
"V",
"value",
",",
"V",
"minimum",
",",
"V",
"maximum",
")",
"{",
"if",
"(",
"minimum",
... | Verifies that the {@code value} is actually out of range.
@param <V> is the generic type of the values.
@param value is the number that is out of range.
@param minimum is the minimum value allowed
@param maximum is the maximum value allowed. | [
"Verifies",
"that",
"the",
"{",
"@code",
"value",
"}",
"is",
"actually",
"out",
"of",
"range",
"."
] | train | https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/exception/src/main/java/net/sf/mmm/util/exception/api/ValueOutOfRangeException.java#L82-L96 |
knowm/XChange | xchange-wex/src/main/java/org/knowm/xchange/wex/v3/service/WexMarketDataService.java | WexMarketDataService.getTrades | @Override
public Trades getTrades(CurrencyPair currencyPair, Object... args) throws IOException {
"""
Get recent trades from exchange
@param args Optional arguments. This implementation assumes args[0] is integer value limiting
number of trade items to get. -1 or missing -> use default 2000 max fetch value int from 1
to 2000 -> use API v.3 to get corresponding number of trades
@return Trades object
@throws IOException
"""
String pairs = WexAdapters.getPair(currencyPair);
int numberOfItems = FULL_SIZE;
if (args != null && args.length > 0) {
if (args[0] instanceof Integer) {
numberOfItems = (Integer) args[0];
}
}
WexTrade[] bTCETrades =
getBTCETrades(pairs, numberOfItems).getTrades(WexAdapters.getPair(currencyPair));
return WexAdapters.adaptTrades(bTCETrades, currencyPair);
} | java | @Override
public Trades getTrades(CurrencyPair currencyPair, Object... args) throws IOException {
String pairs = WexAdapters.getPair(currencyPair);
int numberOfItems = FULL_SIZE;
if (args != null && args.length > 0) {
if (args[0] instanceof Integer) {
numberOfItems = (Integer) args[0];
}
}
WexTrade[] bTCETrades =
getBTCETrades(pairs, numberOfItems).getTrades(WexAdapters.getPair(currencyPair));
return WexAdapters.adaptTrades(bTCETrades, currencyPair);
} | [
"@",
"Override",
"public",
"Trades",
"getTrades",
"(",
"CurrencyPair",
"currencyPair",
",",
"Object",
"...",
"args",
")",
"throws",
"IOException",
"{",
"String",
"pairs",
"=",
"WexAdapters",
".",
"getPair",
"(",
"currencyPair",
")",
";",
"int",
"numberOfItems",
... | Get recent trades from exchange
@param args Optional arguments. This implementation assumes args[0] is integer value limiting
number of trade items to get. -1 or missing -> use default 2000 max fetch value int from 1
to 2000 -> use API v.3 to get corresponding number of trades
@return Trades object
@throws IOException | [
"Get",
"recent",
"trades",
"from",
"exchange"
] | train | https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-wex/src/main/java/org/knowm/xchange/wex/v3/service/WexMarketDataService.java#L93-L107 |
facebookarchive/hadoop-20 | src/core/org/apache/hadoop/fs/HarFileSystem.java | HarFileSystem.getPathInHar | public Path getPathInHar(Path path) {
"""
this method returns the path
inside the har filesystem.
this is relative path inside
the har filesystem.
@param path the fully qualified path in the har filesystem.
@return relative path in the filesystem.
"""
Path harPath = new Path(path.toUri().getPath());
if (archivePath.compareTo(harPath) == 0)
return new Path(Path.SEPARATOR);
Path tmp = new Path(harPath.getName());
Path parent = harPath.getParent();
while (!(parent.compareTo(archivePath) == 0)) {
if (parent.toString().equals(Path.SEPARATOR)) {
tmp = null;
break;
}
tmp = new Path(parent.getName(), tmp);
parent = parent.getParent();
}
if (tmp != null)
tmp = new Path(Path.SEPARATOR, tmp);
return tmp;
} | java | public Path getPathInHar(Path path) {
Path harPath = new Path(path.toUri().getPath());
if (archivePath.compareTo(harPath) == 0)
return new Path(Path.SEPARATOR);
Path tmp = new Path(harPath.getName());
Path parent = harPath.getParent();
while (!(parent.compareTo(archivePath) == 0)) {
if (parent.toString().equals(Path.SEPARATOR)) {
tmp = null;
break;
}
tmp = new Path(parent.getName(), tmp);
parent = parent.getParent();
}
if (tmp != null)
tmp = new Path(Path.SEPARATOR, tmp);
return tmp;
} | [
"public",
"Path",
"getPathInHar",
"(",
"Path",
"path",
")",
"{",
"Path",
"harPath",
"=",
"new",
"Path",
"(",
"path",
".",
"toUri",
"(",
")",
".",
"getPath",
"(",
")",
")",
";",
"if",
"(",
"archivePath",
".",
"compareTo",
"(",
"harPath",
")",
"==",
... | this method returns the path
inside the har filesystem.
this is relative path inside
the har filesystem.
@param path the fully qualified path in the har filesystem.
@return relative path in the filesystem. | [
"this",
"method",
"returns",
"the",
"path",
"inside",
"the",
"har",
"filesystem",
".",
"this",
"is",
"relative",
"path",
"inside",
"the",
"har",
"filesystem",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/HarFileSystem.java#L330-L347 |
morimekta/utils | io-util/src/main/java/net/morimekta/util/FileWatcher.java | FileWatcher.weakAddWatcher | public void weakAddWatcher(Path file, Listener watcher) {
"""
Start watching file path and notify watcher for updates on that file.
The watcher will be kept in a weak reference and will allow GC to delete
the instance.
@param file The file path to watch.
@param watcher The watcher to be notified.
"""
synchronized (mutex) {
startWatchingInternal(file).add(new WeakReference<>(watcher)::get);
}
} | java | public void weakAddWatcher(Path file, Listener watcher) {
synchronized (mutex) {
startWatchingInternal(file).add(new WeakReference<>(watcher)::get);
}
} | [
"public",
"void",
"weakAddWatcher",
"(",
"Path",
"file",
",",
"Listener",
"watcher",
")",
"{",
"synchronized",
"(",
"mutex",
")",
"{",
"startWatchingInternal",
"(",
"file",
")",
".",
"add",
"(",
"new",
"WeakReference",
"<>",
"(",
"watcher",
")",
"::",
"get... | Start watching file path and notify watcher for updates on that file.
The watcher will be kept in a weak reference and will allow GC to delete
the instance.
@param file The file path to watch.
@param watcher The watcher to be notified. | [
"Start",
"watching",
"file",
"path",
"and",
"notify",
"watcher",
"for",
"updates",
"on",
"that",
"file",
".",
"The",
"watcher",
"will",
"be",
"kept",
"in",
"a",
"weak",
"reference",
"and",
"will",
"allow",
"GC",
"to",
"delete",
"the",
"instance",
"."
] | train | https://github.com/morimekta/utils/blob/dc987485902f1a7d58169c89c61db97425a6226d/io-util/src/main/java/net/morimekta/util/FileWatcher.java#L290-L294 |
Azure/azure-sdk-for-java | kusto/resource-manager/v2018_09_07_preview/src/main/java/com/microsoft/azure/management/kusto/v2018_09_07_preview/implementation/EventHubConnectionsInner.java | EventHubConnectionsInner.beginUpdateAsync | public Observable<EventHubConnectionInner> beginUpdateAsync(String resourceGroupName, String clusterName, String databaseName, String eventHubConnectionName, EventHubConnectionUpdate parameters) {
"""
Updates a Event Hub connection.
@param resourceGroupName The name of the resource group containing the Kusto cluster.
@param clusterName The name of the Kusto cluster.
@param databaseName The name of the database in the Kusto cluster.
@param eventHubConnectionName The name of the event hub connection.
@param parameters The Event Hub connection parameters supplied to the Update operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the EventHubConnectionInner object
"""
return beginUpdateWithServiceResponseAsync(resourceGroupName, clusterName, databaseName, eventHubConnectionName, parameters).map(new Func1<ServiceResponse<EventHubConnectionInner>, EventHubConnectionInner>() {
@Override
public EventHubConnectionInner call(ServiceResponse<EventHubConnectionInner> response) {
return response.body();
}
});
} | java | public Observable<EventHubConnectionInner> beginUpdateAsync(String resourceGroupName, String clusterName, String databaseName, String eventHubConnectionName, EventHubConnectionUpdate parameters) {
return beginUpdateWithServiceResponseAsync(resourceGroupName, clusterName, databaseName, eventHubConnectionName, parameters).map(new Func1<ServiceResponse<EventHubConnectionInner>, EventHubConnectionInner>() {
@Override
public EventHubConnectionInner call(ServiceResponse<EventHubConnectionInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"EventHubConnectionInner",
">",
"beginUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"clusterName",
",",
"String",
"databaseName",
",",
"String",
"eventHubConnectionName",
",",
"EventHubConnectionUpdate",
"parameters",
")",
"... | Updates a Event Hub connection.
@param resourceGroupName The name of the resource group containing the Kusto cluster.
@param clusterName The name of the Kusto cluster.
@param databaseName The name of the database in the Kusto cluster.
@param eventHubConnectionName The name of the event hub connection.
@param parameters The Event Hub connection parameters supplied to the Update operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the EventHubConnectionInner object | [
"Updates",
"a",
"Event",
"Hub",
"connection",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/kusto/resource-manager/v2018_09_07_preview/src/main/java/com/microsoft/azure/management/kusto/v2018_09_07_preview/implementation/EventHubConnectionsInner.java#L736-L743 |
feedzai/pdb | src/main/java/com/feedzai/commons/sql/abstraction/dml/With.java | With.andWith | public With andWith(final String alias, final Expression expression) {
"""
Adds an alias and expression to the with clause.
@param alias expression alias
@param expression expression to be aliased.
@return this object.
"""
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 |
Hygieia/Hygieia | collectors/scm/github-graphql/src/main/java/com/capitalone/dashboard/collector/DefaultGitHubClient.java | DefaultGitHubClient.getRunDate | private String getRunDate(GitHubRepo repo, boolean firstRun, boolean missingCommits) {
"""
Get run date based off of firstRun boolean
@param repo
@param firstRun
@return
"""
if (missingCommits) {
long repoOffsetTime = getRepoOffsetTime(repo);
if (repoOffsetTime > 0) {
return getDate(new DateTime(getRepoOffsetTime(repo)), 0, settings.getOffsetMinutes()).toString();
} else {
return getDate(new DateTime(repo.getLastUpdated()), 0, settings.getOffsetMinutes()).toString();
}
}
if (firstRun) {
int firstRunDaysHistory = settings.getFirstRunHistoryDays();
if (firstRunDaysHistory > 0) {
return getDate(new DateTime(), firstRunDaysHistory, 0).toString();
} else {
return getDate(new DateTime(), FIRST_RUN_HISTORY_DEFAULT, 0).toString();
}
} else {
return getDate(new DateTime(repo.getLastUpdated()), 0, settings.getOffsetMinutes()).toString();
}
} | java | private String getRunDate(GitHubRepo repo, boolean firstRun, boolean missingCommits) {
if (missingCommits) {
long repoOffsetTime = getRepoOffsetTime(repo);
if (repoOffsetTime > 0) {
return getDate(new DateTime(getRepoOffsetTime(repo)), 0, settings.getOffsetMinutes()).toString();
} else {
return getDate(new DateTime(repo.getLastUpdated()), 0, settings.getOffsetMinutes()).toString();
}
}
if (firstRun) {
int firstRunDaysHistory = settings.getFirstRunHistoryDays();
if (firstRunDaysHistory > 0) {
return getDate(new DateTime(), firstRunDaysHistory, 0).toString();
} else {
return getDate(new DateTime(), FIRST_RUN_HISTORY_DEFAULT, 0).toString();
}
} else {
return getDate(new DateTime(repo.getLastUpdated()), 0, settings.getOffsetMinutes()).toString();
}
} | [
"private",
"String",
"getRunDate",
"(",
"GitHubRepo",
"repo",
",",
"boolean",
"firstRun",
",",
"boolean",
"missingCommits",
")",
"{",
"if",
"(",
"missingCommits",
")",
"{",
"long",
"repoOffsetTime",
"=",
"getRepoOffsetTime",
"(",
"repo",
")",
";",
"if",
"(",
... | Get run date based off of firstRun boolean
@param repo
@param firstRun
@return | [
"Get",
"run",
"date",
"based",
"off",
"of",
"firstRun",
"boolean"
] | train | https://github.com/Hygieia/Hygieia/blob/d8b67a590da2744acf59bcd99d9b34ef1bb84890/collectors/scm/github-graphql/src/main/java/com/capitalone/dashboard/collector/DefaultGitHubClient.java#L1013-L1032 |
watchrabbit/rabbit-commons | src/main/java/com/watchrabbit/commons/sleep/Sleep.java | Sleep.untilNull | public static <T> T untilNull(Callable<T> callable, long timeout, TimeUnit unit) {
"""
Causes the current thread to wait until the callable is returning
{@code null}, or the specified waiting time elapses.
<p>
If the callable returns not null then this method returns immediately
with the value returned by callable.
<p>
Any {@code InterruptedException}'s are suppress and logged. Any
{@code Exception}'s thrown by callable are propagate as SystemException
@param callable callable checked by this method
@param timeout the maximum time to wait
@param unit the time unit of the {@code timeout} argument
@return value returned by callable method
@throws SystemException if callable throws exception
"""
return SleepBuilder.<T>sleep()
.withComparer(argument -> argument == null)
.withTimeout(timeout, unit)
.withStatement(callable)
.build();
} | java | public static <T> T untilNull(Callable<T> callable, long timeout, TimeUnit unit) {
return SleepBuilder.<T>sleep()
.withComparer(argument -> argument == null)
.withTimeout(timeout, unit)
.withStatement(callable)
.build();
} | [
"public",
"static",
"<",
"T",
">",
"T",
"untilNull",
"(",
"Callable",
"<",
"T",
">",
"callable",
",",
"long",
"timeout",
",",
"TimeUnit",
"unit",
")",
"{",
"return",
"SleepBuilder",
".",
"<",
"T",
">",
"sleep",
"(",
")",
".",
"withComparer",
"(",
"ar... | Causes the current thread to wait until the callable is returning
{@code null}, or the specified waiting time elapses.
<p>
If the callable returns not null then this method returns immediately
with the value returned by callable.
<p>
Any {@code InterruptedException}'s are suppress and logged. Any
{@code Exception}'s thrown by callable are propagate as SystemException
@param callable callable checked by this method
@param timeout the maximum time to wait
@param unit the time unit of the {@code timeout} argument
@return value returned by callable method
@throws SystemException if callable throws exception | [
"Causes",
"the",
"current",
"thread",
"to",
"wait",
"until",
"the",
"callable",
"is",
"returning",
"{",
"@code",
"null",
"}",
"or",
"the",
"specified",
"waiting",
"time",
"elapses",
"."
] | train | https://github.com/watchrabbit/rabbit-commons/blob/b11c9f804b5ab70b9264635c34a02f5029bd2a5d/src/main/java/com/watchrabbit/commons/sleep/Sleep.java#L117-L123 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/ba/deref/UnconditionalValueDerefAnalysis.java | UnconditionalValueDerefAnalysis.findValueKnownNonnullOnBranch | private @CheckForNull
ValueNumber findValueKnownNonnullOnBranch(UnconditionalValueDerefSet fact, Edge edge) {
"""
Clear deref sets of values if this edge is the non-null branch of an if
comparison.
@param fact
a datflow fact
@param edge
edge to check
@return possibly-modified dataflow fact
"""
IsNullValueFrame invFrame = invDataflow.getResultFact(edge.getSource());
if (!invFrame.isValid()) {
return null;
}
IsNullConditionDecision decision = invFrame.getDecision();
if (decision == null) {
return null;
}
IsNullValue inv = decision.getDecision(edge.getType());
if (inv == null || !inv.isDefinitelyNotNull()) {
return null;
}
ValueNumber value = decision.getValue();
if (DEBUG) {
System.out.println("Value number " + value + " is known nonnull on " + edge);
}
return value;
} | java | private @CheckForNull
ValueNumber findValueKnownNonnullOnBranch(UnconditionalValueDerefSet fact, Edge edge) {
IsNullValueFrame invFrame = invDataflow.getResultFact(edge.getSource());
if (!invFrame.isValid()) {
return null;
}
IsNullConditionDecision decision = invFrame.getDecision();
if (decision == null) {
return null;
}
IsNullValue inv = decision.getDecision(edge.getType());
if (inv == null || !inv.isDefinitelyNotNull()) {
return null;
}
ValueNumber value = decision.getValue();
if (DEBUG) {
System.out.println("Value number " + value + " is known nonnull on " + edge);
}
return value;
} | [
"private",
"@",
"CheckForNull",
"ValueNumber",
"findValueKnownNonnullOnBranch",
"(",
"UnconditionalValueDerefSet",
"fact",
",",
"Edge",
"edge",
")",
"{",
"IsNullValueFrame",
"invFrame",
"=",
"invDataflow",
".",
"getResultFact",
"(",
"edge",
".",
"getSource",
"(",
")",... | Clear deref sets of values if this edge is the non-null branch of an if
comparison.
@param fact
a datflow fact
@param edge
edge to check
@return possibly-modified dataflow fact | [
"Clear",
"deref",
"sets",
"of",
"values",
"if",
"this",
"edge",
"is",
"the",
"non",
"-",
"null",
"branch",
"of",
"an",
"if",
"comparison",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/deref/UnconditionalValueDerefAnalysis.java#L909-L931 |
ehcache/ehcache3 | impl/src/main/java/org/ehcache/config/builders/CacheConfigurationBuilder.java | CacheConfigurationBuilder.withSizeOfMaxObjectSize | public CacheConfigurationBuilder<K, V> withSizeOfMaxObjectSize(long size, MemoryUnit unit) {
"""
Adds or updates the {@link DefaultSizeOfEngineConfiguration} with the specified maximum mapping size to the configured
builder.
<p>
{@link SizeOfEngine} is what enables the heap tier to be sized in {@link MemoryUnit}.
@param size the maximum mapping size
@param unit the memory unit
@return a new builder with the added / updated configuration
"""
return mapServiceConfiguration(DefaultSizeOfEngineConfiguration.class, existing -> ofNullable(existing)
.map(e -> new DefaultSizeOfEngineConfiguration(size, unit, e.getMaxObjectGraphSize()))
.orElse(new DefaultSizeOfEngineConfiguration(size, unit, DEFAULT_OBJECT_GRAPH_SIZE)));
} | java | public CacheConfigurationBuilder<K, V> withSizeOfMaxObjectSize(long size, MemoryUnit unit) {
return mapServiceConfiguration(DefaultSizeOfEngineConfiguration.class, existing -> ofNullable(existing)
.map(e -> new DefaultSizeOfEngineConfiguration(size, unit, e.getMaxObjectGraphSize()))
.orElse(new DefaultSizeOfEngineConfiguration(size, unit, DEFAULT_OBJECT_GRAPH_SIZE)));
} | [
"public",
"CacheConfigurationBuilder",
"<",
"K",
",",
"V",
">",
"withSizeOfMaxObjectSize",
"(",
"long",
"size",
",",
"MemoryUnit",
"unit",
")",
"{",
"return",
"mapServiceConfiguration",
"(",
"DefaultSizeOfEngineConfiguration",
".",
"class",
",",
"existing",
"->",
"o... | Adds or updates the {@link DefaultSizeOfEngineConfiguration} with the specified maximum mapping size to the configured
builder.
<p>
{@link SizeOfEngine} is what enables the heap tier to be sized in {@link MemoryUnit}.
@param size the maximum mapping size
@param unit the memory unit
@return a new builder with the added / updated configuration | [
"Adds",
"or",
"updates",
"the",
"{",
"@link",
"DefaultSizeOfEngineConfiguration",
"}",
"with",
"the",
"specified",
"maximum",
"mapping",
"size",
"to",
"the",
"configured",
"builder",
".",
"<p",
">",
"{",
"@link",
"SizeOfEngine",
"}",
"is",
"what",
"enables",
"... | train | https://github.com/ehcache/ehcache3/blob/3cceda57185e522f8d241ddb75146d67ee2af898/impl/src/main/java/org/ehcache/config/builders/CacheConfigurationBuilder.java#L555-L559 |
Impetus/Kundera | src/kundera-elastic-search/src/main/java/com/impetus/client/es/ESFilterBuilder.java | ESFilterBuilder.getAndFilterBuilder | private AndQueryBuilder getAndFilterBuilder(Expression logicalExp, EntityMetadata m) {
"""
Gets the and filter builder.
@param logicalExp
the logical exp
@param m
the m
@param entity
the entity
@return the and filter builder
"""
AndExpression andExp = (AndExpression) logicalExp;
Expression leftExpression = andExp.getLeftExpression();
Expression rightExpression = andExp.getRightExpression();
return new AndQueryBuilder(populateFilterBuilder(leftExpression, m), populateFilterBuilder(rightExpression, m));
} | java | private AndQueryBuilder getAndFilterBuilder(Expression logicalExp, EntityMetadata m)
{
AndExpression andExp = (AndExpression) logicalExp;
Expression leftExpression = andExp.getLeftExpression();
Expression rightExpression = andExp.getRightExpression();
return new AndQueryBuilder(populateFilterBuilder(leftExpression, m), populateFilterBuilder(rightExpression, m));
} | [
"private",
"AndQueryBuilder",
"getAndFilterBuilder",
"(",
"Expression",
"logicalExp",
",",
"EntityMetadata",
"m",
")",
"{",
"AndExpression",
"andExp",
"=",
"(",
"AndExpression",
")",
"logicalExp",
";",
"Expression",
"leftExpression",
"=",
"andExp",
".",
"getLeftExpres... | Gets the and filter builder.
@param logicalExp
the logical exp
@param m
the m
@param entity
the entity
@return the and filter builder | [
"Gets",
"the",
"and",
"filter",
"builder",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-elastic-search/src/main/java/com/impetus/client/es/ESFilterBuilder.java#L358-L365 |
raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/utility/visitor/StackAwareMethodVisitor.java | StackAwareMethodVisitor.drainStack | public int drainStack(int store, int load, StackSize size) {
"""
Drains the stack to only contain the top value. For this, the value on top of the stack is temporarily stored
in the local variable array until all values on the stack are popped off. Subsequently, the top value is pushed
back onto the operand stack.
@param store The opcode used for storing the top value.
@param load The opcode used for loading the top value.
@param size The size of the value on top of the operand stack.
@return The minimal size of the local variable array that is required to perform the operation.
"""
int difference = current.get(current.size() - 1).getSize() - size.getSize();
if (current.size() == 1 && difference == 0) {
return 0;
} else {
super.visitVarInsn(store, freeIndex);
if (difference == 1) {
super.visitInsn(Opcodes.POP);
} else if (difference != 0) {
throw new IllegalStateException("Unexpected remainder on the operand stack: " + difference);
}
doDrain(current.subList(0, current.size() - 1));
super.visitVarInsn(load, freeIndex);
return freeIndex + size.getSize();
}
} | java | public int drainStack(int store, int load, StackSize size) {
int difference = current.get(current.size() - 1).getSize() - size.getSize();
if (current.size() == 1 && difference == 0) {
return 0;
} else {
super.visitVarInsn(store, freeIndex);
if (difference == 1) {
super.visitInsn(Opcodes.POP);
} else if (difference != 0) {
throw new IllegalStateException("Unexpected remainder on the operand stack: " + difference);
}
doDrain(current.subList(0, current.size() - 1));
super.visitVarInsn(load, freeIndex);
return freeIndex + size.getSize();
}
} | [
"public",
"int",
"drainStack",
"(",
"int",
"store",
",",
"int",
"load",
",",
"StackSize",
"size",
")",
"{",
"int",
"difference",
"=",
"current",
".",
"get",
"(",
"current",
".",
"size",
"(",
")",
"-",
"1",
")",
".",
"getSize",
"(",
")",
"-",
"size"... | Drains the stack to only contain the top value. For this, the value on top of the stack is temporarily stored
in the local variable array until all values on the stack are popped off. Subsequently, the top value is pushed
back onto the operand stack.
@param store The opcode used for storing the top value.
@param load The opcode used for loading the top value.
@param size The size of the value on top of the operand stack.
@return The minimal size of the local variable array that is required to perform the operation. | [
"Drains",
"the",
"stack",
"to",
"only",
"contain",
"the",
"top",
"value",
".",
"For",
"this",
"the",
"value",
"on",
"top",
"of",
"the",
"stack",
"is",
"temporarily",
"stored",
"in",
"the",
"local",
"variable",
"array",
"until",
"all",
"values",
"on",
"th... | train | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/utility/visitor/StackAwareMethodVisitor.java#L147-L162 |
stratosphere/stratosphere | stratosphere-runtime/src/main/java/eu/stratosphere/pact/runtime/io/SpillingBuffer.java | SpillingBuffer.moveAll | private static final <E> void moveAll(ArrayList<E> source, ArrayList<E> target) {
"""
Utility method that moves elements. It avoids copying the data into a dedicated array first, as
the {@link ArrayList#addAll(java.util.Collection)} method does.
@param <E>
@param source
@param target
"""
target.ensureCapacity(target.size() + source.size());
for (int i = source.size() - 1; i >= 0; i--) {
target.add(source.remove(i));
}
} | java | private static final <E> void moveAll(ArrayList<E> source, ArrayList<E> target) {
target.ensureCapacity(target.size() + source.size());
for (int i = source.size() - 1; i >= 0; i--) {
target.add(source.remove(i));
}
} | [
"private",
"static",
"final",
"<",
"E",
">",
"void",
"moveAll",
"(",
"ArrayList",
"<",
"E",
">",
"source",
",",
"ArrayList",
"<",
"E",
">",
"target",
")",
"{",
"target",
".",
"ensureCapacity",
"(",
"target",
".",
"size",
"(",
")",
"+",
"source",
".",... | Utility method that moves elements. It avoids copying the data into a dedicated array first, as
the {@link ArrayList#addAll(java.util.Collection)} method does.
@param <E>
@param source
@param target | [
"Utility",
"method",
"that",
"moves",
"elements",
".",
"It",
"avoids",
"copying",
"the",
"data",
"into",
"a",
"dedicated",
"array",
"first",
"as",
"the",
"{",
"@link",
"ArrayList#addAll",
"(",
"java",
".",
"util",
".",
"Collection",
")",
"}",
"method",
"do... | train | https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-runtime/src/main/java/eu/stratosphere/pact/runtime/io/SpillingBuffer.java#L185-L190 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/odmg/ObjectEnvelopeOrdering.java | ObjectEnvelopeOrdering.buildConcrete11Edge | protected Edge buildConcrete11Edge(Vertex vertex1, Vertex vertex2, boolean fkToRef) {
"""
Checks if the database operations associated with two object envelopes
that are related via an 1:1 (or n:1) reference needs to be performed
in a particular order and if so builds and returns a corresponding
directed edge weighted with <code>CONCRETE_EDGE_WEIGHT</code>.
The following cases are considered (* means object needs update, + means
object needs insert, - means object needs to be deleted):
<table>
<tr><td>(1)* -(1:1)-> (2)*</td><td>no edge</td></tr>
<tr><td>(1)* -(1:1)-> (2)+</td><td>(2)->(1) edge</td></tr>
<tr><td>(1)* -(1:1)-> (2)-</td><td>no edge (cannot occur)</td></tr>
<tr><td>(1)+ -(1:1)-> (2)*</td><td>no edge</td></tr>
<tr><td>(1)+ -(1:1)-> (2)+</td><td>(2)->(1) edge</td></tr>
<tr><td>(1)+ -(1:1)-> (2)-</td><td>no edge (cannot occur)</td></tr>
<tr><td>(1)- -(1:1)-> (2)*</td><td>no edge</td></tr>
<tr><td>(1)- -(1:1)-> (2)+</td><td>no edge</td></tr>
<tr><td>(1)- -(1:1)-> (2)-</td><td>(1)->(2) edge</td></tr>
<table>
@param vertex1 object envelope vertex of the object holding the reference
@param vertex2 object envelope vertex of the referenced object
@return an Edge object or null if the two database operations can
be performed in any order
"""
ModificationState state1 = vertex1.getEnvelope().getModificationState();
ModificationState state2 = vertex2.getEnvelope().getModificationState();
if (state1.needsUpdate() || state1.needsInsert())
{
if (state2.needsInsert())
{
// (2) must be inserted before (1) can point to it
return new Edge(vertex2, vertex1, fkToRef ? CONCRETE_EDGE_WEIGHT_WITH_FK : CONCRETE_EDGE_WEIGHT);
}
}
else if (state1.needsDelete())
{
if (state2.needsDelete())
{
// (1) points to (2) and must be deleted first
return new Edge(vertex1, vertex2, fkToRef ? CONCRETE_EDGE_WEIGHT_WITH_FK : CONCRETE_EDGE_WEIGHT);
}
}
return null;
} | java | protected Edge buildConcrete11Edge(Vertex vertex1, Vertex vertex2, boolean fkToRef)
{
ModificationState state1 = vertex1.getEnvelope().getModificationState();
ModificationState state2 = vertex2.getEnvelope().getModificationState();
if (state1.needsUpdate() || state1.needsInsert())
{
if (state2.needsInsert())
{
// (2) must be inserted before (1) can point to it
return new Edge(vertex2, vertex1, fkToRef ? CONCRETE_EDGE_WEIGHT_WITH_FK : CONCRETE_EDGE_WEIGHT);
}
}
else if (state1.needsDelete())
{
if (state2.needsDelete())
{
// (1) points to (2) and must be deleted first
return new Edge(vertex1, vertex2, fkToRef ? CONCRETE_EDGE_WEIGHT_WITH_FK : CONCRETE_EDGE_WEIGHT);
}
}
return null;
} | [
"protected",
"Edge",
"buildConcrete11Edge",
"(",
"Vertex",
"vertex1",
",",
"Vertex",
"vertex2",
",",
"boolean",
"fkToRef",
")",
"{",
"ModificationState",
"state1",
"=",
"vertex1",
".",
"getEnvelope",
"(",
")",
".",
"getModificationState",
"(",
")",
";",
"Modific... | Checks if the database operations associated with two object envelopes
that are related via an 1:1 (or n:1) reference needs to be performed
in a particular order and if so builds and returns a corresponding
directed edge weighted with <code>CONCRETE_EDGE_WEIGHT</code>.
The following cases are considered (* means object needs update, + means
object needs insert, - means object needs to be deleted):
<table>
<tr><td>(1)* -(1:1)-> (2)*</td><td>no edge</td></tr>
<tr><td>(1)* -(1:1)-> (2)+</td><td>(2)->(1) edge</td></tr>
<tr><td>(1)* -(1:1)-> (2)-</td><td>no edge (cannot occur)</td></tr>
<tr><td>(1)+ -(1:1)-> (2)*</td><td>no edge</td></tr>
<tr><td>(1)+ -(1:1)-> (2)+</td><td>(2)->(1) edge</td></tr>
<tr><td>(1)+ -(1:1)-> (2)-</td><td>no edge (cannot occur)</td></tr>
<tr><td>(1)- -(1:1)-> (2)*</td><td>no edge</td></tr>
<tr><td>(1)- -(1:1)-> (2)+</td><td>no edge</td></tr>
<tr><td>(1)- -(1:1)-> (2)-</td><td>(1)->(2) edge</td></tr>
<table>
@param vertex1 object envelope vertex of the object holding the reference
@param vertex2 object envelope vertex of the referenced object
@return an Edge object or null if the two database operations can
be performed in any order | [
"Checks",
"if",
"the",
"database",
"operations",
"associated",
"with",
"two",
"object",
"envelopes",
"that",
"are",
"related",
"via",
"an",
"1",
":",
"1",
"(",
"or",
"n",
":",
"1",
")",
"reference",
"needs",
"to",
"be",
"performed",
"in",
"a",
"particula... | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/odmg/ObjectEnvelopeOrdering.java#L424-L445 |
xcesco/kripton | kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/InsertRawHelper.java | InsertRawHelper.generateJavaDocReturnType | public static void generateJavaDocReturnType(MethodSpec.Builder methodBuilder, TypeName returnType) {
"""
Generate javadoc about return type of method.
@param methodBuilder the method builder
@param returnType the return type
"""
if (returnType == TypeName.VOID) {
} else if (TypeUtility.isTypeIncludedIn(returnType, Boolean.TYPE, Boolean.class)) {
methodBuilder.addJavadoc("\n");
methodBuilder.addJavadoc("@return <code>true</code> if record is inserted, <code>false</code> otherwise");
} else if (TypeUtility.isTypeIncludedIn(returnType, Long.TYPE, Long.class)) {
methodBuilder.addJavadoc("\n");
methodBuilder.addJavadoc("@return <strong>id</strong> of inserted record");
} else if (TypeUtility.isTypeIncludedIn(returnType, Integer.TYPE, Integer.class)) {
methodBuilder.addJavadoc("\n");
methodBuilder.addJavadoc("@return <strong>id</strong> of inserted record");
}
methodBuilder.addJavadoc("\n");
} | java | public static void generateJavaDocReturnType(MethodSpec.Builder methodBuilder, TypeName returnType) {
if (returnType == TypeName.VOID) {
} else if (TypeUtility.isTypeIncludedIn(returnType, Boolean.TYPE, Boolean.class)) {
methodBuilder.addJavadoc("\n");
methodBuilder.addJavadoc("@return <code>true</code> if record is inserted, <code>false</code> otherwise");
} else if (TypeUtility.isTypeIncludedIn(returnType, Long.TYPE, Long.class)) {
methodBuilder.addJavadoc("\n");
methodBuilder.addJavadoc("@return <strong>id</strong> of inserted record");
} else if (TypeUtility.isTypeIncludedIn(returnType, Integer.TYPE, Integer.class)) {
methodBuilder.addJavadoc("\n");
methodBuilder.addJavadoc("@return <strong>id</strong> of inserted record");
}
methodBuilder.addJavadoc("\n");
} | [
"public",
"static",
"void",
"generateJavaDocReturnType",
"(",
"MethodSpec",
".",
"Builder",
"methodBuilder",
",",
"TypeName",
"returnType",
")",
"{",
"if",
"(",
"returnType",
"==",
"TypeName",
".",
"VOID",
")",
"{",
"}",
"else",
"if",
"(",
"TypeUtility",
".",
... | Generate javadoc about return type of method.
@param methodBuilder the method builder
@param returnType the return type | [
"Generate",
"javadoc",
"about",
"return",
"type",
"of",
"method",
"."
] | train | https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/InsertRawHelper.java#L287-L301 |
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) {
"""
对两个ICriterion进行 "逻辑与" 合并
@param c1 Restrictor left
@param c2 Restrictor right
@return Restrictor
"""
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 |
facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/MapTaskStatus.java | MapTaskStatus.calculateRate | private double calculateRate(long cumulative, long currentTime) {
"""
Helper function that calculate the rate, given the total so far and the
current time
@param cumulative
@param currentTime
@return
"""
long timeSinceMapStart = 0;
assert getPhase() == Phase.MAP : "MapTaskStatus not in map phase!";
long startTime = getStartTime();
timeSinceMapStart = currentTime - startTime;
if (timeSinceMapStart <= 0) {
LOG.error("Current time is " + currentTime +
" but start time is " + startTime);
return 0;
}
return cumulative/timeSinceMapStart;
} | java | private double calculateRate(long cumulative, long currentTime) {
long timeSinceMapStart = 0;
assert getPhase() == Phase.MAP : "MapTaskStatus not in map phase!";
long startTime = getStartTime();
timeSinceMapStart = currentTime - startTime;
if (timeSinceMapStart <= 0) {
LOG.error("Current time is " + currentTime +
" but start time is " + startTime);
return 0;
}
return cumulative/timeSinceMapStart;
} | [
"private",
"double",
"calculateRate",
"(",
"long",
"cumulative",
",",
"long",
"currentTime",
")",
"{",
"long",
"timeSinceMapStart",
"=",
"0",
";",
"assert",
"getPhase",
"(",
")",
"==",
"Phase",
".",
"MAP",
":",
"\"MapTaskStatus not in map phase!\"",
";",
"long",... | Helper function that calculate the rate, given the total so far and the
current time
@param cumulative
@param currentTime
@return | [
"Helper",
"function",
"that",
"calculate",
"the",
"rate",
"given",
"the",
"total",
"so",
"far",
"and",
"the",
"current",
"time"
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/MapTaskStatus.java#L65-L78 |
b3dgs/lionengine | lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/HandlablesImpl.java | HandlablesImpl.addType | private void addType(Class<?> type, Object object) {
"""
Add a type from its interface.
@param type The type interface.
@param object The type value.
"""
if (!items.containsKey(type))
{
items.put(type, new HashSet<>());
}
items.get(type).add(object);
} | java | private void addType(Class<?> type, Object object)
{
if (!items.containsKey(type))
{
items.put(type, new HashSet<>());
}
items.get(type).add(object);
} | [
"private",
"void",
"addType",
"(",
"Class",
"<",
"?",
">",
"type",
",",
"Object",
"object",
")",
"{",
"if",
"(",
"!",
"items",
".",
"containsKey",
"(",
"type",
")",
")",
"{",
"items",
".",
"put",
"(",
"type",
",",
"new",
"HashSet",
"<>",
"(",
")"... | Add a type from its interface.
@param type The type interface.
@param object The type value. | [
"Add",
"a",
"type",
"from",
"its",
"interface",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/HandlablesImpl.java#L124-L131 |
kuali/kc-s2sgen | coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/PHS398FellowshipSupplementalV1_2Generator.java | PHS398FellowshipSupplementalV1_2Generator.getInstitutionalBaseSalary | private void getInstitutionalBaseSalary(Budget budget, Map<Integer, String> budgetMap) {
"""
/*
This method is used to set data to InstitutionalBaseSalary XMLObject from budgetMap data for Budget
"""
InstitutionalBaseSalary institutionalBaseSalary = InstitutionalBaseSalary.Factory.newInstance();
if (budgetMap.get(SENIOR_FELL) != null && budgetMap.get(SENIOR_FELL).equals(YnqConstant.YES.code())) {
if (budgetMap.get(BASE_SALARY) != null) {
institutionalBaseSalary.setAmount(new BigDecimal(budgetMap.get(BASE_SALARY)));
}
if (budgetMap.get(ACAD_PERIOD) != null) {
institutionalBaseSalary.setAcademicPeriod(AcademicPeriod.Enum.forString(budgetMap.get(ACAD_PERIOD)));
}
if (budgetMap.get(SALARY_MONTHS) != null) {
institutionalBaseSalary.setNumberOfMonths(new BigDecimal(budgetMap.get(SALARY_MONTHS)));
}
budget.setInstitutionalBaseSalary(institutionalBaseSalary);
}
} | java | private void getInstitutionalBaseSalary(Budget budget, Map<Integer, String> budgetMap) {
InstitutionalBaseSalary institutionalBaseSalary = InstitutionalBaseSalary.Factory.newInstance();
if (budgetMap.get(SENIOR_FELL) != null && budgetMap.get(SENIOR_FELL).equals(YnqConstant.YES.code())) {
if (budgetMap.get(BASE_SALARY) != null) {
institutionalBaseSalary.setAmount(new BigDecimal(budgetMap.get(BASE_SALARY)));
}
if (budgetMap.get(ACAD_PERIOD) != null) {
institutionalBaseSalary.setAcademicPeriod(AcademicPeriod.Enum.forString(budgetMap.get(ACAD_PERIOD)));
}
if (budgetMap.get(SALARY_MONTHS) != null) {
institutionalBaseSalary.setNumberOfMonths(new BigDecimal(budgetMap.get(SALARY_MONTHS)));
}
budget.setInstitutionalBaseSalary(institutionalBaseSalary);
}
} | [
"private",
"void",
"getInstitutionalBaseSalary",
"(",
"Budget",
"budget",
",",
"Map",
"<",
"Integer",
",",
"String",
">",
"budgetMap",
")",
"{",
"InstitutionalBaseSalary",
"institutionalBaseSalary",
"=",
"InstitutionalBaseSalary",
".",
"Factory",
".",
"newInstance",
"... | /*
This method is used to set data to InstitutionalBaseSalary XMLObject from budgetMap data for Budget | [
"/",
"*",
"This",
"method",
"is",
"used",
"to",
"set",
"data",
"to",
"InstitutionalBaseSalary",
"XMLObject",
"from",
"budgetMap",
"data",
"for",
"Budget"
] | train | https://github.com/kuali/kc-s2sgen/blob/2886380e1e3cb8bdd732ba99b2afa6ffc630bb37/coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/PHS398FellowshipSupplementalV1_2Generator.java#L600-L614 |
phax/ph-schedule | ph-mini-quartz/src/main/java/com/helger/quartz/DailyTimeIntervalScheduleBuilder.java | DailyTimeIntervalScheduleBuilder.withInterval | public DailyTimeIntervalScheduleBuilder withInterval (final int timeInterval, final EIntervalUnit unit) {
"""
Specify the time unit and interval for the Trigger to be produced.
@param timeInterval
the interval at which the trigger should repeat.
@param unit
the time unit (IntervalUnit) of the interval. The only intervals
that are valid for this type of trigger are
{@link EIntervalUnit#SECOND}, {@link EIntervalUnit#MINUTE}, and
{@link EIntervalUnit#HOUR}.
@return the updated DailyTimeIntervalScheduleBuilder
@see IDailyTimeIntervalTrigger#getRepeatInterval()
@see IDailyTimeIntervalTrigger#getRepeatIntervalUnit()
"""
if (unit == null ||
!(unit.equals (EIntervalUnit.SECOND) || unit.equals (EIntervalUnit.MINUTE) || unit.equals (EIntervalUnit.HOUR)))
throw new IllegalArgumentException ("Invalid repeat IntervalUnit (must be SECOND, MINUTE or HOUR).");
_validateInterval (timeInterval);
m_nInterval = timeInterval;
m_eIntervalUnit = unit;
return this;
} | java | public DailyTimeIntervalScheduleBuilder withInterval (final int timeInterval, final EIntervalUnit unit)
{
if (unit == null ||
!(unit.equals (EIntervalUnit.SECOND) || unit.equals (EIntervalUnit.MINUTE) || unit.equals (EIntervalUnit.HOUR)))
throw new IllegalArgumentException ("Invalid repeat IntervalUnit (must be SECOND, MINUTE or HOUR).");
_validateInterval (timeInterval);
m_nInterval = timeInterval;
m_eIntervalUnit = unit;
return this;
} | [
"public",
"DailyTimeIntervalScheduleBuilder",
"withInterval",
"(",
"final",
"int",
"timeInterval",
",",
"final",
"EIntervalUnit",
"unit",
")",
"{",
"if",
"(",
"unit",
"==",
"null",
"||",
"!",
"(",
"unit",
".",
"equals",
"(",
"EIntervalUnit",
".",
"SECOND",
")"... | Specify the time unit and interval for the Trigger to be produced.
@param timeInterval
the interval at which the trigger should repeat.
@param unit
the time unit (IntervalUnit) of the interval. The only intervals
that are valid for this type of trigger are
{@link EIntervalUnit#SECOND}, {@link EIntervalUnit#MINUTE}, and
{@link EIntervalUnit#HOUR}.
@return the updated DailyTimeIntervalScheduleBuilder
@see IDailyTimeIntervalTrigger#getRepeatInterval()
@see IDailyTimeIntervalTrigger#getRepeatIntervalUnit() | [
"Specify",
"the",
"time",
"unit",
"and",
"interval",
"for",
"the",
"Trigger",
"to",
"be",
"produced",
"."
] | train | https://github.com/phax/ph-schedule/blob/b000790b46a9f8d23ad44cc20591f753d07c0229/ph-mini-quartz/src/main/java/com/helger/quartz/DailyTimeIntervalScheduleBuilder.java#L176-L185 |
icode/ameba | src/main/java/ameba/db/ebean/support/ModelResourceStructure.java | ModelResourceStructure.fetchHistoryAsOf | public Response fetchHistoryAsOf(@PathParam("id") URI_ID id,
@PathParam("asof") final Timestamp asOf) throws Exception {
"""
find history as of timestamp
@param id model id
@param asOf Timestamp
@return history model
@throws java.lang.Exception any error
"""
final MODEL_ID mId = tryConvertId(id);
matchedFetchHistoryAsOf(mId, asOf);
final Query<MODEL> query = server.find(modelType);
defaultFindOrderBy(query);
Object entity = executeTx(t -> {
configDefaultQuery(query);
configFetchHistoryAsOfQuery(query, mId, asOf);
applyUriQuery(query, false);
MODEL model = query.asOf(asOf).setId(mId).findOne();
return processFetchedHistoryAsOfModel(mId, model, asOf);
});
if (isEmptyEntity(entity)) {
return Response.noContent().build();
}
return Response.ok(entity).build();
} | java | public Response fetchHistoryAsOf(@PathParam("id") URI_ID id,
@PathParam("asof") final Timestamp asOf) throws Exception {
final MODEL_ID mId = tryConvertId(id);
matchedFetchHistoryAsOf(mId, asOf);
final Query<MODEL> query = server.find(modelType);
defaultFindOrderBy(query);
Object entity = executeTx(t -> {
configDefaultQuery(query);
configFetchHistoryAsOfQuery(query, mId, asOf);
applyUriQuery(query, false);
MODEL model = query.asOf(asOf).setId(mId).findOne();
return processFetchedHistoryAsOfModel(mId, model, asOf);
});
if (isEmptyEntity(entity)) {
return Response.noContent().build();
}
return Response.ok(entity).build();
} | [
"public",
"Response",
"fetchHistoryAsOf",
"(",
"@",
"PathParam",
"(",
"\"id\"",
")",
"URI_ID",
"id",
",",
"@",
"PathParam",
"(",
"\"asof\"",
")",
"final",
"Timestamp",
"asOf",
")",
"throws",
"Exception",
"{",
"final",
"MODEL_ID",
"mId",
"=",
"tryConvertId",
... | find history as of timestamp
@param id model id
@param asOf Timestamp
@return history model
@throws java.lang.Exception any error | [
"find",
"history",
"as",
"of",
"timestamp"
] | train | https://github.com/icode/ameba/blob/9d4956e935898e41331b2745e400ef869cd265e0/src/main/java/ameba/db/ebean/support/ModelResourceStructure.java#L904-L924 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/io/stream/StreamHelper.java | StreamHelper.readFully | @Nonnegative
public static int readFully (@Nonnull final InputStream aIS, @Nonnull final byte [] aBuffer) throws IOException {
"""
Read the whole buffer from the input stream.
@param aIS
The input stream to read from. May not be <code>null</code>.
@param aBuffer
The buffer to write to. May not be <code>null</code>. Must be ≥
than the content to be read.
@return The number of read bytes
@throws IOException
In case reading fails
"""
return readFully (aIS, aBuffer, 0, aBuffer.length);
} | java | @Nonnegative
public static int readFully (@Nonnull final InputStream aIS, @Nonnull final byte [] aBuffer) throws IOException
{
return readFully (aIS, aBuffer, 0, aBuffer.length);
} | [
"@",
"Nonnegative",
"public",
"static",
"int",
"readFully",
"(",
"@",
"Nonnull",
"final",
"InputStream",
"aIS",
",",
"@",
"Nonnull",
"final",
"byte",
"[",
"]",
"aBuffer",
")",
"throws",
"IOException",
"{",
"return",
"readFully",
"(",
"aIS",
",",
"aBuffer",
... | Read the whole buffer from the input stream.
@param aIS
The input stream to read from. May not be <code>null</code>.
@param aBuffer
The buffer to write to. May not be <code>null</code>. Must be ≥
than the content to be read.
@return The number of read bytes
@throws IOException
In case reading fails | [
"Read",
"the",
"whole",
"buffer",
"from",
"the",
"input",
"stream",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/io/stream/StreamHelper.java#L1413-L1417 |
apache/incubator-druid | processing/src/main/java/org/apache/druid/query/groupby/strategy/GroupByStrategyV2.java | GroupByStrategyV2.getUniversalTimestamp | public static DateTime getUniversalTimestamp(final GroupByQuery query) {
"""
If "query" has a single universal timestamp, return it. Otherwise return null. This is useful
for keeping timestamps in sync across partial queries that may have different intervals.
@param query the query
@return universal timestamp, or null
"""
final Granularity gran = query.getGranularity();
final String timestampStringFromContext = query.getContextValue(CTX_KEY_FUDGE_TIMESTAMP, "");
if (!timestampStringFromContext.isEmpty()) {
return DateTimes.utc(Long.parseLong(timestampStringFromContext));
} else if (Granularities.ALL.equals(gran)) {
final DateTime timeStart = query.getIntervals().get(0).getStart();
return gran.getIterable(new Interval(timeStart, timeStart.plus(1))).iterator().next().getStart();
} else {
return null;
}
} | java | public static DateTime getUniversalTimestamp(final GroupByQuery query)
{
final Granularity gran = query.getGranularity();
final String timestampStringFromContext = query.getContextValue(CTX_KEY_FUDGE_TIMESTAMP, "");
if (!timestampStringFromContext.isEmpty()) {
return DateTimes.utc(Long.parseLong(timestampStringFromContext));
} else if (Granularities.ALL.equals(gran)) {
final DateTime timeStart = query.getIntervals().get(0).getStart();
return gran.getIterable(new Interval(timeStart, timeStart.plus(1))).iterator().next().getStart();
} else {
return null;
}
} | [
"public",
"static",
"DateTime",
"getUniversalTimestamp",
"(",
"final",
"GroupByQuery",
"query",
")",
"{",
"final",
"Granularity",
"gran",
"=",
"query",
".",
"getGranularity",
"(",
")",
";",
"final",
"String",
"timestampStringFromContext",
"=",
"query",
".",
"getCo... | If "query" has a single universal timestamp, return it. Otherwise return null. This is useful
for keeping timestamps in sync across partial queries that may have different intervals.
@param query the query
@return universal timestamp, or null | [
"If",
"query",
"has",
"a",
"single",
"universal",
"timestamp",
"return",
"it",
".",
"Otherwise",
"return",
"null",
".",
"This",
"is",
"useful",
"for",
"keeping",
"timestamps",
"in",
"sync",
"across",
"partial",
"queries",
"that",
"may",
"have",
"different",
... | train | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/processing/src/main/java/org/apache/druid/query/groupby/strategy/GroupByStrategyV2.java#L125-L138 |
wildfly-extras/wildfly-camel | subsystem/core/src/main/java/org/wildfly/extension/camel/SpringCamelContextFactory.java | SpringCamelContextFactory.createSingleCamelContext | public static SpringCamelContext createSingleCamelContext(URL contextUrl, ClassLoader classsLoader) throws Exception {
"""
Create a single {@link SpringCamelContext} from the given URL
@throws IllegalStateException if the given URL does not contain a single context definition
"""
SpringCamelContextBootstrap bootstrap = new SpringCamelContextBootstrap(contextUrl, classsLoader);
List<SpringCamelContext> list = bootstrap.createSpringCamelContexts();
IllegalStateAssertion.assertEquals(1, list.size(), "Single context expected in: " + contextUrl);
return list.get(0);
} | java | public static SpringCamelContext createSingleCamelContext(URL contextUrl, ClassLoader classsLoader) throws Exception {
SpringCamelContextBootstrap bootstrap = new SpringCamelContextBootstrap(contextUrl, classsLoader);
List<SpringCamelContext> list = bootstrap.createSpringCamelContexts();
IllegalStateAssertion.assertEquals(1, list.size(), "Single context expected in: " + contextUrl);
return list.get(0);
} | [
"public",
"static",
"SpringCamelContext",
"createSingleCamelContext",
"(",
"URL",
"contextUrl",
",",
"ClassLoader",
"classsLoader",
")",
"throws",
"Exception",
"{",
"SpringCamelContextBootstrap",
"bootstrap",
"=",
"new",
"SpringCamelContextBootstrap",
"(",
"contextUrl",
","... | Create a single {@link SpringCamelContext} from the given URL
@throws IllegalStateException if the given URL does not contain a single context definition | [
"Create",
"a",
"single",
"{"
] | train | https://github.com/wildfly-extras/wildfly-camel/blob/9ebd7e28574f277a6d5b583e8a4c357e1538c370/subsystem/core/src/main/java/org/wildfly/extension/camel/SpringCamelContextFactory.java#L46-L51 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.