repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 188 | func_name stringlengths 7 127 | whole_func_string stringlengths 77 3.91k | language stringclasses 1
value | func_code_string stringlengths 77 3.91k | func_code_tokens listlengths 20 745 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 477 | split_name stringclasses 1
value | func_code_url stringlengths 111 288 |
|---|---|---|---|---|---|---|---|---|---|---|
eclipse/xtext-extras | org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/typesystem/conformance/RawTypeConformanceComputer.java | RawTypeConformanceComputer.doIsConformantTypeArguments | protected int doIsConformantTypeArguments(LightweightTypeReference left, LightweightTypeReference right, int flags) {
if (left.isRawType() != right.isRawType()) {
return flags | SUCCESS | RAW_TYPE_CONVERSION;
}
return flags | SUCCESS;
} | java | protected int doIsConformantTypeArguments(LightweightTypeReference left, LightweightTypeReference right, int flags) {
if (left.isRawType() != right.isRawType()) {
return flags | SUCCESS | RAW_TYPE_CONVERSION;
}
return flags | SUCCESS;
} | [
"protected",
"int",
"doIsConformantTypeArguments",
"(",
"LightweightTypeReference",
"left",
",",
"LightweightTypeReference",
"right",
",",
"int",
"flags",
")",
"{",
"if",
"(",
"left",
".",
"isRawType",
"(",
")",
"!=",
"right",
".",
"isRawType",
"(",
")",
")",
... | This is a hook for the {@link TypeConformanceComputer} to implement the type argument check. | [
"This",
"is",
"a",
"hook",
"for",
"the",
"{"
] | train | https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/typesystem/conformance/RawTypeConformanceComputer.java#L1172-L1177 |
EdwardRaff/JSAT | JSAT/src/jsat/SimpleDataSet.java | SimpleDataSet.asRegressionDataSet | public RegressionDataSet asRegressionDataSet(int index)
{
if(index < 0)
throw new IllegalArgumentException("Index must be a non-negative value");
else if(getNumNumericalVars()== 0)
throw new IllegalArgumentException("Dataset has no numeric variables, can not create regression dataset");
else if(index >= getNumNumericalVars())
throw new IllegalArgumentException("Index " + index + " i larger than number of numeric features " + getNumNumericalVars());
RegressionDataSet rds = new RegressionDataSet(this.datapoints.toList(), index);
for(int i = 0; i < size(); i++)
rds.setWeight(i, this.getWeight(i));
return rds;
} | java | public RegressionDataSet asRegressionDataSet(int index)
{
if(index < 0)
throw new IllegalArgumentException("Index must be a non-negative value");
else if(getNumNumericalVars()== 0)
throw new IllegalArgumentException("Dataset has no numeric variables, can not create regression dataset");
else if(index >= getNumNumericalVars())
throw new IllegalArgumentException("Index " + index + " i larger than number of numeric features " + getNumNumericalVars());
RegressionDataSet rds = new RegressionDataSet(this.datapoints.toList(), index);
for(int i = 0; i < size(); i++)
rds.setWeight(i, this.getWeight(i));
return rds;
} | [
"public",
"RegressionDataSet",
"asRegressionDataSet",
"(",
"int",
"index",
")",
"{",
"if",
"(",
"index",
"<",
"0",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Index must be a non-negative value\"",
")",
";",
"else",
"if",
"(",
"getNumNumericalVars",
"("... | Converts this dataset into one meant for regression problems. The
given numeric feature index is removed from the data and made the
target variable for the regression problem.
@param index the regression variable index, should be in the range
[0, {@link #getNumNumericalVars() })
@return a new dataset where one numeric variable is removed and made
the target of a regression dataset | [
"Converts",
"this",
"dataset",
"into",
"one",
"meant",
"for",
"regression",
"problems",
".",
"The",
"given",
"numeric",
"feature",
"index",
"is",
"removed",
"from",
"the",
"data",
"and",
"made",
"the",
"target",
"variable",
"for",
"the",
"regression",
"problem... | train | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/SimpleDataSet.java#L109-L122 |
aws/aws-sdk-java | aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/model/QueryRequest.java | QueryRequest.withKeyConditions | public QueryRequest withKeyConditions(java.util.Map<String, Condition> keyConditions) {
setKeyConditions(keyConditions);
return this;
} | java | public QueryRequest withKeyConditions(java.util.Map<String, Condition> keyConditions) {
setKeyConditions(keyConditions);
return this;
} | [
"public",
"QueryRequest",
"withKeyConditions",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"Condition",
">",
"keyConditions",
")",
"{",
"setKeyConditions",
"(",
"keyConditions",
")",
";",
"return",
"this",
";",
"}"
] | <p>
This is a legacy parameter. Use <code>KeyConditionExpression</code> instead. For more information, see <a href=
"https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/LegacyConditionalParameters.KeyConditions.html"
>KeyConditions</a> in the <i>Amazon DynamoDB Developer Guide</i>.
</p>
@param keyConditions
This is a legacy parameter. Use <code>KeyConditionExpression</code> instead. For more information, see <a
href=
"https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/LegacyConditionalParameters.KeyConditions.html"
>KeyConditions</a> in the <i>Amazon DynamoDB Developer Guide</i>.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"This",
"is",
"a",
"legacy",
"parameter",
".",
"Use",
"<code",
">",
"KeyConditionExpression<",
"/",
"code",
">",
"instead",
".",
"For",
"more",
"information",
"see",
"<a",
"href",
"=",
"https",
":",
"//",
"docs",
".",
"aws",
".",
"amazon",
"... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/model/QueryRequest.java#L1471-L1474 |
boncey/Flickr4Java | src/main/java/com/flickr4java/flickr/util/UrlUtilities.java | UrlUtilities.buildUrl | @Deprecated
public static URL buildUrl(String host, int port, String path, Map<String, String> parameters) throws MalformedURLException {
return buildUrl("http", port, path, parameters);
} | java | @Deprecated
public static URL buildUrl(String host, int port, String path, Map<String, String> parameters) throws MalformedURLException {
return buildUrl("http", port, path, parameters);
} | [
"@",
"Deprecated",
"public",
"static",
"URL",
"buildUrl",
"(",
"String",
"host",
",",
"int",
"port",
",",
"String",
"path",
",",
"Map",
"<",
"String",
",",
"String",
">",
"parameters",
")",
"throws",
"MalformedURLException",
"{",
"return",
"buildUrl",
"(",
... | Build a request URL.
@param host
The host
@param port
The port
@param path
The path
@param parameters
The parameters
@return The URL
@throws MalformedURLException
@deprecated use {@link #buildSecureUrl(java.lang.String, int, java.lang.String, java.util.Map) } | [
"Build",
"a",
"request",
"URL",
"."
] | train | https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/util/UrlUtilities.java#L34-L37 |
dmerkushov/log-helper | src/main/java/ru/dmerkushov/loghelper/LoggerWrapper.java | LoggerWrapper.logDomNode | public void logDomNode (String msg, Node node) {
StackTraceElement caller = StackTraceUtils.getCallerStackTraceElement ();
logDomNode (msg, node, Level.FINER, caller);
} | java | public void logDomNode (String msg, Node node) {
StackTraceElement caller = StackTraceUtils.getCallerStackTraceElement ();
logDomNode (msg, node, Level.FINER, caller);
} | [
"public",
"void",
"logDomNode",
"(",
"String",
"msg",
",",
"Node",
"node",
")",
"{",
"StackTraceElement",
"caller",
"=",
"StackTraceUtils",
".",
"getCallerStackTraceElement",
"(",
")",
";",
"logDomNode",
"(",
"msg",
",",
"node",
",",
"Level",
".",
"FINER",
"... | Log a DOM node at the FINER level
@param msg The message to show with the node, or null if no message needed
@param node
@see Node | [
"Log",
"a",
"DOM",
"node",
"at",
"the",
"FINER",
"level"
] | train | https://github.com/dmerkushov/log-helper/blob/3b7d3d30faa7f1437b27cd07c10fa579a995de23/src/main/java/ru/dmerkushov/loghelper/LoggerWrapper.java#L440-L444 |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/io/las/utils/LasUtils.java | LasUtils.distance3D | public static double distance3D( LasRecord r1, LasRecord r2 ) {
double deltaElev = Math.abs(r1.z - r2.z);
double projectedDistance = NumericsUtilities.pythagoras(r1.x - r2.x, r1.y - r2.y);
double distance = NumericsUtilities.pythagoras(projectedDistance, deltaElev);
return distance;
} | java | public static double distance3D( LasRecord r1, LasRecord r2 ) {
double deltaElev = Math.abs(r1.z - r2.z);
double projectedDistance = NumericsUtilities.pythagoras(r1.x - r2.x, r1.y - r2.y);
double distance = NumericsUtilities.pythagoras(projectedDistance, deltaElev);
return distance;
} | [
"public",
"static",
"double",
"distance3D",
"(",
"LasRecord",
"r1",
",",
"LasRecord",
"r2",
")",
"{",
"double",
"deltaElev",
"=",
"Math",
".",
"abs",
"(",
"r1",
".",
"z",
"-",
"r2",
".",
"z",
")",
";",
"double",
"projectedDistance",
"=",
"NumericsUtiliti... | Distance between two points.
@param r1 the first point.
@param r2 the second point.
@return the 3D distance. | [
"Distance",
"between",
"two",
"points",
"."
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/las/utils/LasUtils.java#L309-L314 |
intendia-oss/rxjava-gwt | src/main/modified/io/reactivex/super/io/reactivex/Maybe.java | Maybe.observeOn | @CheckReturnValue
@SchedulerSupport(SchedulerSupport.CUSTOM)
public final Maybe<T> observeOn(final Scheduler scheduler) {
ObjectHelper.requireNonNull(scheduler, "scheduler is null");
return RxJavaPlugins.onAssembly(new MaybeObserveOn<T>(this, scheduler));
} | java | @CheckReturnValue
@SchedulerSupport(SchedulerSupport.CUSTOM)
public final Maybe<T> observeOn(final Scheduler scheduler) {
ObjectHelper.requireNonNull(scheduler, "scheduler is null");
return RxJavaPlugins.onAssembly(new MaybeObserveOn<T>(this, scheduler));
} | [
"@",
"CheckReturnValue",
"@",
"SchedulerSupport",
"(",
"SchedulerSupport",
".",
"CUSTOM",
")",
"public",
"final",
"Maybe",
"<",
"T",
">",
"observeOn",
"(",
"final",
"Scheduler",
"scheduler",
")",
"{",
"ObjectHelper",
".",
"requireNonNull",
"(",
"scheduler",
",",... | Wraps a Maybe to emit its item (or notify of its error) on a specified {@link Scheduler},
asynchronously.
<p>
<img width="640" height="182" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/Maybe.observeOn.png" alt="">
<dl>
<dt><b>Scheduler:</b></dt>
<dd>you specify which {@link Scheduler} this operator will use.</dd>
</dl>
@param scheduler
the {@link Scheduler} to notify subscribers on
@return the new Maybe instance that its subscribers are notified on the specified
{@link Scheduler}
@see <a href="http://reactivex.io/documentation/operators/observeon.html">ReactiveX operators documentation: ObserveOn</a>
@see <a href="http://www.grahamlea.com/2014/07/rxjava-threading-examples/">RxJava Threading Examples</a>
@see #subscribeOn | [
"Wraps",
"a",
"Maybe",
"to",
"emit",
"its",
"item",
"(",
"or",
"notify",
"of",
"its",
"error",
")",
"on",
"a",
"specified",
"{",
"@link",
"Scheduler",
"}",
"asynchronously",
".",
"<p",
">",
"<img",
"width",
"=",
"640",
"height",
"=",
"182",
"src",
"=... | train | https://github.com/intendia-oss/rxjava-gwt/blob/8d5635b12ce40da99e76b59dc6bfe6fc2fffc1fa/src/main/modified/io/reactivex/super/io/reactivex/Maybe.java#L3425-L3430 |
LGoodDatePicker/LGoodDatePicker | Project/src/main/java/com/privatejgoodies/forms/layout/CellConstraints.java | CellConstraints.ensureValidOrientations | private static void ensureValidOrientations(Alignment horizontalAlignment, Alignment verticalAlignment) {
if (!horizontalAlignment.isHorizontal()) {
throw new IllegalArgumentException("The horizontal alignment must be one of: left, center, right, fill, default.");
}
if (!verticalAlignment.isVertical()) {
throw new IllegalArgumentException("The vertical alignment must be one of: top, center, bottom, fill, default.");
}
} | java | private static void ensureValidOrientations(Alignment horizontalAlignment, Alignment verticalAlignment) {
if (!horizontalAlignment.isHorizontal()) {
throw new IllegalArgumentException("The horizontal alignment must be one of: left, center, right, fill, default.");
}
if (!verticalAlignment.isVertical()) {
throw new IllegalArgumentException("The vertical alignment must be one of: top, center, bottom, fill, default.");
}
} | [
"private",
"static",
"void",
"ensureValidOrientations",
"(",
"Alignment",
"horizontalAlignment",
",",
"Alignment",
"verticalAlignment",
")",
"{",
"if",
"(",
"!",
"horizontalAlignment",
".",
"isHorizontal",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException"... | Checks and verifies that the horizontal alignment is a horizontal and the vertical alignment
is vertical.
@param horizontalAlignment the horizontal alignment
@param verticalAlignment the vertical alignment
@throws IllegalArgumentException if an alignment is invalid | [
"Checks",
"and",
"verifies",
"that",
"the",
"horizontal",
"alignment",
"is",
"a",
"horizontal",
"and",
"the",
"vertical",
"alignment",
"is",
"vertical",
"."
] | train | https://github.com/LGoodDatePicker/LGoodDatePicker/blob/c7df05a5fe382e1e08a6237e9391d8dc5fd48692/Project/src/main/java/com/privatejgoodies/forms/layout/CellConstraints.java#L915-L922 |
Mozu/mozu-java | mozu-java-core/src/main/java/com/mozu/api/urls/content/documentlists/DocumentUrl.java | DocumentUrl.updateDocumentUrl | public static MozuUrl updateDocumentUrl(String documentId, String documentListName, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/content/documentlists/{documentListName}/documents/{documentId}?responseFields={responseFields}");
formatter.formatUrl("documentId", documentId);
formatter.formatUrl("documentListName", documentListName);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java | public static MozuUrl updateDocumentUrl(String documentId, String documentListName, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/content/documentlists/{documentListName}/documents/{documentId}?responseFields={responseFields}");
formatter.formatUrl("documentId", documentId);
formatter.formatUrl("documentListName", documentListName);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | [
"public",
"static",
"MozuUrl",
"updateDocumentUrl",
"(",
"String",
"documentId",
",",
"String",
"documentListName",
",",
"String",
"responseFields",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
"(",
"\"/api/content/documentlists/{documentListName}/docu... | Get Resource Url for UpdateDocument
@param documentId Unique identifier for a document, used by content and document calls. Document IDs are associated with document types, document type lists, sites, and tenants.
@param documentListName Name of content documentListName to delete
@param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss.
@return String Resource Url | [
"Get",
"Resource",
"Url",
"for",
"UpdateDocument"
] | train | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/content/documentlists/DocumentUrl.java#L135-L142 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/query/SearchFilter.java | SearchFilter.matchSet | public void matchSet(Hashtable elements, int combine_op, int compare_op) throws DBException
{
// Delete the old search filter
m_filter = null;
// If combine_op is not a logical operator, throw an exception
if ((combine_op & LOGICAL_OPER_MASK) == 0)
{
throw new DBException();
// If compare_op is not a binary operator, throw an exception
}
if ((compare_op & BINARY_OPER_MASK) == 0)
{
throw new DBException();
// Create a vector that will hold the comparison nodes for all elements in the hashtable
}
Vector compareVector = new Vector();
// For each of the elements in the hashtable, create a comparison node for the match
for (Enumeration e = elements.keys(); e.hasMoreElements();)
{
// Get the element name from the enumerator
// and its value
String elementName = (String) e.nextElement();
String elementValue = (String) elements.get(elementName);
// Create a comparison node for this list and store it as the filter
SearchBaseLeafComparison comparenode = new SearchBaseLeafComparison(elementName,
compare_op, elementValue);
// Add this leaf node to the vector
compareVector.addElement(comparenode);
}
// Now return a node that holds this set of leaf nodes
m_filter = new SearchBaseNode(combine_op, compareVector);
} | java | public void matchSet(Hashtable elements, int combine_op, int compare_op) throws DBException
{
// Delete the old search filter
m_filter = null;
// If combine_op is not a logical operator, throw an exception
if ((combine_op & LOGICAL_OPER_MASK) == 0)
{
throw new DBException();
// If compare_op is not a binary operator, throw an exception
}
if ((compare_op & BINARY_OPER_MASK) == 0)
{
throw new DBException();
// Create a vector that will hold the comparison nodes for all elements in the hashtable
}
Vector compareVector = new Vector();
// For each of the elements in the hashtable, create a comparison node for the match
for (Enumeration e = elements.keys(); e.hasMoreElements();)
{
// Get the element name from the enumerator
// and its value
String elementName = (String) e.nextElement();
String elementValue = (String) elements.get(elementName);
// Create a comparison node for this list and store it as the filter
SearchBaseLeafComparison comparenode = new SearchBaseLeafComparison(elementName,
compare_op, elementValue);
// Add this leaf node to the vector
compareVector.addElement(comparenode);
}
// Now return a node that holds this set of leaf nodes
m_filter = new SearchBaseNode(combine_op, compareVector);
} | [
"public",
"void",
"matchSet",
"(",
"Hashtable",
"elements",
",",
"int",
"combine_op",
",",
"int",
"compare_op",
")",
"throws",
"DBException",
"{",
"// Delete the old search filter\r",
"m_filter",
"=",
"null",
";",
"// If combine_op is not a logical operator, throw an except... | Change the search filter to one that specifies a set of elements and their values
that must match, and the operator to use to combine the elements.
Each key is compared for an equal match to the value, and all
comparisons are combined by the specified logical operator (OR or AND).
The old search filter is deleted.
@param elements is a hashtable holding key-value pairs
@param combine_op is the logical operator to be used to combine the comparisons
@param compare_op is the binary operator to be used for the comparisons
@exception DBException | [
"Change",
"the",
"search",
"filter",
"to",
"one",
"that",
"specifies",
"a",
"set",
"of",
"elements",
"and",
"their",
"values",
"that",
"must",
"match",
"and",
"the",
"operator",
"to",
"use",
"to",
"combine",
"the",
"elements",
".",
"Each",
"key",
"is",
"... | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/query/SearchFilter.java#L221-L252 |
fcrepo3/fcrepo | fcrepo-security/fcrepo-security-pdp/src/main/java/org/fcrepo/server/security/xacml/pdp/data/XPathPolicyIndex.java | XPathPolicyIndex.getXpath | protected static String getXpath(Map<String, Collection<AttributeBean>> attributeMap) {
StringBuilder sb = new StringBuilder();
getXpath(attributeMap, sb);
return sb.toString();
} | java | protected static String getXpath(Map<String, Collection<AttributeBean>> attributeMap) {
StringBuilder sb = new StringBuilder();
getXpath(attributeMap, sb);
return sb.toString();
} | [
"protected",
"static",
"String",
"getXpath",
"(",
"Map",
"<",
"String",
",",
"Collection",
"<",
"AttributeBean",
">",
">",
"attributeMap",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"getXpath",
"(",
"attributeMap",
",",
"sb"... | Creates an XPath query from the attributes
@param attributeMap attributes from request
@return String | [
"Creates",
"an",
"XPath",
"query",
"from",
"the",
"attributes"
] | train | https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-security/fcrepo-security-pdp/src/main/java/org/fcrepo/server/security/xacml/pdp/data/XPathPolicyIndex.java#L119-L123 |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java | HtmlTree.FRAMESET | public static HtmlTree FRAMESET(String cols, String rows, String title, String onload) {
HtmlTree htmltree = new HtmlTree(HtmlTag.FRAMESET);
if (cols != null)
htmltree.addAttr(HtmlAttr.COLS, cols);
if (rows != null)
htmltree.addAttr(HtmlAttr.ROWS, rows);
htmltree.addAttr(HtmlAttr.TITLE, nullCheck(title));
htmltree.addAttr(HtmlAttr.ONLOAD, nullCheck(onload));
return htmltree;
} | java | public static HtmlTree FRAMESET(String cols, String rows, String title, String onload) {
HtmlTree htmltree = new HtmlTree(HtmlTag.FRAMESET);
if (cols != null)
htmltree.addAttr(HtmlAttr.COLS, cols);
if (rows != null)
htmltree.addAttr(HtmlAttr.ROWS, rows);
htmltree.addAttr(HtmlAttr.TITLE, nullCheck(title));
htmltree.addAttr(HtmlAttr.ONLOAD, nullCheck(onload));
return htmltree;
} | [
"public",
"static",
"HtmlTree",
"FRAMESET",
"(",
"String",
"cols",
",",
"String",
"rows",
",",
"String",
"title",
",",
"String",
"onload",
")",
"{",
"HtmlTree",
"htmltree",
"=",
"new",
"HtmlTree",
"(",
"HtmlTag",
".",
"FRAMESET",
")",
";",
"if",
"(",
"co... | Generates a FRAMESET tag.
@param cols the size of columns in the frameset
@param rows the size of rows in the frameset
@param title the title for the frameset
@param onload the script to run when the document loads
@return an HtmlTree object for the FRAMESET tag | [
"Generates",
"a",
"FRAMESET",
"tag",
"."
] | train | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java#L370-L379 |
jbundle/jbundle | thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/BaseApplet.java | BaseApplet.onChangePassword | public int onChangePassword()
{
String strDisplay = "Login required";
strDisplay = this.getTask().getString(strDisplay);
for (int i = 1; i < 3; i++)
{
String strUserName = this.getProperty(Params.USER_NAME);
Frame frame = ScreenUtil.getFrame(this);
ChangePasswordDialog dialog = new ChangePasswordDialog(frame, true, strDisplay, strUserName);
ScreenUtil.centerDialogInFrame(dialog, frame);
dialog.setVisible(true);
int iOption = dialog.getReturnStatus();
if (iOption != JOptionPane.OK_OPTION)
return iOption; // Canceled dialog = You don't get in.
strUserName = dialog.getUserName();
String strPassword = dialog.getCurrentPassword();
String strNewPassword = dialog.getNewPassword();
try {
byte[] bytes = strPassword.getBytes(Base64.DEFAULT_ENCODING);
bytes = Base64.encodeSHA(bytes);
char[] chars = Base64.encode(bytes);
strPassword = new String(chars);
bytes = strNewPassword.getBytes(Base64.DEFAULT_ENCODING);
bytes = Base64.encodeSHA(bytes);
chars = Base64.encode(bytes);
strNewPassword = new String(chars);
} catch (NoSuchAlgorithmException ex) {
ex.printStackTrace();
} catch (UnsupportedEncodingException ex) {
ex.printStackTrace();
}
int errorCode = this.getApplication().createNewUser(this, strUserName, strPassword, strNewPassword);
if (errorCode == Constants.NORMAL_RETURN)
return errorCode;
}
return this.setLastError(strDisplay);
} | java | public int onChangePassword()
{
String strDisplay = "Login required";
strDisplay = this.getTask().getString(strDisplay);
for (int i = 1; i < 3; i++)
{
String strUserName = this.getProperty(Params.USER_NAME);
Frame frame = ScreenUtil.getFrame(this);
ChangePasswordDialog dialog = new ChangePasswordDialog(frame, true, strDisplay, strUserName);
ScreenUtil.centerDialogInFrame(dialog, frame);
dialog.setVisible(true);
int iOption = dialog.getReturnStatus();
if (iOption != JOptionPane.OK_OPTION)
return iOption; // Canceled dialog = You don't get in.
strUserName = dialog.getUserName();
String strPassword = dialog.getCurrentPassword();
String strNewPassword = dialog.getNewPassword();
try {
byte[] bytes = strPassword.getBytes(Base64.DEFAULT_ENCODING);
bytes = Base64.encodeSHA(bytes);
char[] chars = Base64.encode(bytes);
strPassword = new String(chars);
bytes = strNewPassword.getBytes(Base64.DEFAULT_ENCODING);
bytes = Base64.encodeSHA(bytes);
chars = Base64.encode(bytes);
strNewPassword = new String(chars);
} catch (NoSuchAlgorithmException ex) {
ex.printStackTrace();
} catch (UnsupportedEncodingException ex) {
ex.printStackTrace();
}
int errorCode = this.getApplication().createNewUser(this, strUserName, strPassword, strNewPassword);
if (errorCode == Constants.NORMAL_RETURN)
return errorCode;
}
return this.setLastError(strDisplay);
} | [
"public",
"int",
"onChangePassword",
"(",
")",
"{",
"String",
"strDisplay",
"=",
"\"Login required\"",
";",
"strDisplay",
"=",
"this",
".",
"getTask",
"(",
")",
".",
"getString",
"(",
"strDisplay",
")",
";",
"for",
"(",
"int",
"i",
"=",
"1",
";",
"i",
... | Display the change password dialog and change the password.
@return | [
"Display",
"the",
"change",
"password",
"dialog",
"and",
"change",
"the",
"password",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/BaseApplet.java#L478-L517 |
morimekta/providence | providence-core/src/main/java/net/morimekta/providence/serializer/binary/BinaryFormatUtils.java | BinaryFormatUtils.writeMessage | public static <Message extends PMessage<Message, Field>, Field extends PField>
int writeMessage(BigEndianBinaryWriter writer, Message message)
throws IOException {
if (message instanceof BinaryWriter) {
return ((BinaryWriter) message).writeBinary(writer);
}
int len = 0;
if (message instanceof PUnion) {
if (((PUnion) message).unionFieldIsSet()) {
PField field = ((PUnion) message).unionField();
len += writeFieldSpec(writer, forType(field.getDescriptor().getType()), field.getId());
len += writeFieldValue(writer,
message.get(field.getId()),
field.getDescriptor());
}
} else {
for (PField field : message.descriptor().getFields()) {
if (message.has(field.getId())) {
len += writeFieldSpec(writer, forType(field.getDescriptor().getType()), field.getId());
len += writeFieldValue(writer,
message.get(field.getId()),
field.getDescriptor());
}
}
}
len += writer.writeUInt8(BinaryType.STOP);
return len;
} | java | public static <Message extends PMessage<Message, Field>, Field extends PField>
int writeMessage(BigEndianBinaryWriter writer, Message message)
throws IOException {
if (message instanceof BinaryWriter) {
return ((BinaryWriter) message).writeBinary(writer);
}
int len = 0;
if (message instanceof PUnion) {
if (((PUnion) message).unionFieldIsSet()) {
PField field = ((PUnion) message).unionField();
len += writeFieldSpec(writer, forType(field.getDescriptor().getType()), field.getId());
len += writeFieldValue(writer,
message.get(field.getId()),
field.getDescriptor());
}
} else {
for (PField field : message.descriptor().getFields()) {
if (message.has(field.getId())) {
len += writeFieldSpec(writer, forType(field.getDescriptor().getType()), field.getId());
len += writeFieldValue(writer,
message.get(field.getId()),
field.getDescriptor());
}
}
}
len += writer.writeUInt8(BinaryType.STOP);
return len;
} | [
"public",
"static",
"<",
"Message",
"extends",
"PMessage",
"<",
"Message",
",",
"Field",
">",
",",
"Field",
"extends",
"PField",
">",
"int",
"writeMessage",
"(",
"BigEndianBinaryWriter",
"writer",
",",
"Message",
"message",
")",
"throws",
"IOException",
"{",
"... | Write message to writer.
@param writer The binary writer.
@param message The message to write.
@param <Message> The message type.
@param <Field> The field type.
@return The number of bytes written.
@throws IOException If write failed. | [
"Write",
"message",
"to",
"writer",
"."
] | train | https://github.com/morimekta/providence/blob/7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa/providence-core/src/main/java/net/morimekta/providence/serializer/binary/BinaryFormatUtils.java#L340-L368 |
datacleaner/DataCleaner | desktop/ui/src/main/java/org/datacleaner/widgets/tabs/CloseableTabbedPaneUI.java | CloseableTabbedPaneUI.closeRectFor | public Rectangle closeRectFor(final int tabIndex) {
final Rectangle rect = rects[tabIndex];
final int x = rect.x + rect.width - CLOSE_ICON_WIDTH - CLOSE_ICON_RIGHT_MARGIN;
final int y = rect.y + (rect.height - CLOSE_ICON_WIDTH) / 2;
final int width = CLOSE_ICON_WIDTH;
return new Rectangle(x, y, width, width);
} | java | public Rectangle closeRectFor(final int tabIndex) {
final Rectangle rect = rects[tabIndex];
final int x = rect.x + rect.width - CLOSE_ICON_WIDTH - CLOSE_ICON_RIGHT_MARGIN;
final int y = rect.y + (rect.height - CLOSE_ICON_WIDTH) / 2;
final int width = CLOSE_ICON_WIDTH;
return new Rectangle(x, y, width, width);
} | [
"public",
"Rectangle",
"closeRectFor",
"(",
"final",
"int",
"tabIndex",
")",
"{",
"final",
"Rectangle",
"rect",
"=",
"rects",
"[",
"tabIndex",
"]",
";",
"final",
"int",
"x",
"=",
"rect",
".",
"x",
"+",
"rect",
".",
"width",
"-",
"CLOSE_ICON_WIDTH",
"-",
... | Helper-method to get a rectangle definition for the close-icon
@param tabIndex
@return | [
"Helper",
"-",
"method",
"to",
"get",
"a",
"rectangle",
"definition",
"for",
"the",
"close",
"-",
"icon"
] | train | https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/desktop/ui/src/main/java/org/datacleaner/widgets/tabs/CloseableTabbedPaneUI.java#L120-L126 |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/impl/MainLogRepositoryBrowserImpl.java | MainLogRepositoryBrowserImpl.findNext | private LogRepositoryBrowser findNext(long cur, long timelimit) {
File[] files = listFiles(instanceFilter);
if (files == null) {
return null;
}
File result = null;
long min = Long.MAX_VALUE;
for (File file : files) {
long time = parseTimeStamp(file.getName());
// Select directory with a smallest time stamp bigger than time stamp of the 'current'.
if (cur < time && time < min) {
min = time;
result = file;
}
}
// return 'null' if found directory has time stamp outside of the time limit.
if (result == null || (timelimit > 0 && timelimit < min)) {
return null;
}
return new LogRepositoryBrowserImpl(result, new String[] { result.getName() });
} | java | private LogRepositoryBrowser findNext(long cur, long timelimit) {
File[] files = listFiles(instanceFilter);
if (files == null) {
return null;
}
File result = null;
long min = Long.MAX_VALUE;
for (File file : files) {
long time = parseTimeStamp(file.getName());
// Select directory with a smallest time stamp bigger than time stamp of the 'current'.
if (cur < time && time < min) {
min = time;
result = file;
}
}
// return 'null' if found directory has time stamp outside of the time limit.
if (result == null || (timelimit > 0 && timelimit < min)) {
return null;
}
return new LogRepositoryBrowserImpl(result, new String[] { result.getName() });
} | [
"private",
"LogRepositoryBrowser",
"findNext",
"(",
"long",
"cur",
",",
"long",
"timelimit",
")",
"{",
"File",
"[",
"]",
"files",
"=",
"listFiles",
"(",
"instanceFilter",
")",
";",
"if",
"(",
"files",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
... | Find instance with a smallest timestamp bigger than value of <code>cur</code>.
@param cur time stamp of the previous instance.
@param timelimit time limit after which we are not interested in the result.
@return LogFileBrowser instance or <code>null</code> if there's not such instance or
if its timestamp is bigger than <code>timelimit</code>. | [
"Find",
"instance",
"with",
"a",
"smallest",
"timestamp",
"bigger",
"than",
"value",
"of",
"<code",
">",
"cur<",
"/",
"code",
">",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/impl/MainLogRepositoryBrowserImpl.java#L152-L175 |
elki-project/elki | elki-database/src/main/java/de/lmu/ifi/dbs/elki/database/query/knn/LinearScanPrimitiveDistanceKNNQuery.java | LinearScanPrimitiveDistanceKNNQuery.linearScan | private KNNHeap linearScan(Relation<? extends O> relation, DBIDIter iter, final O obj, KNNHeap heap) {
final PrimitiveDistanceFunction<? super O> rawdist = this.rawdist;
double max = Double.POSITIVE_INFINITY;
while(iter.valid()) {
final double dist = rawdist.distance(obj, relation.get(iter));
if(dist <= max) {
max = heap.insert(dist, iter);
}
iter.advance();
}
return heap;
} | java | private KNNHeap linearScan(Relation<? extends O> relation, DBIDIter iter, final O obj, KNNHeap heap) {
final PrimitiveDistanceFunction<? super O> rawdist = this.rawdist;
double max = Double.POSITIVE_INFINITY;
while(iter.valid()) {
final double dist = rawdist.distance(obj, relation.get(iter));
if(dist <= max) {
max = heap.insert(dist, iter);
}
iter.advance();
}
return heap;
} | [
"private",
"KNNHeap",
"linearScan",
"(",
"Relation",
"<",
"?",
"extends",
"O",
">",
"relation",
",",
"DBIDIter",
"iter",
",",
"final",
"O",
"obj",
",",
"KNNHeap",
"heap",
")",
"{",
"final",
"PrimitiveDistanceFunction",
"<",
"?",
"super",
"O",
">",
"rawdist... | Main loop of the linear scan.
@param relation Data relation
@param iter ID iterator
@param obj Query object
@param heap Output heap
@return Heap | [
"Main",
"loop",
"of",
"the",
"linear",
"scan",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-database/src/main/java/de/lmu/ifi/dbs/elki/database/query/knn/LinearScanPrimitiveDistanceKNNQuery.java#L86-L97 |
grails/grails-core | grails-web-common/src/main/groovy/org/grails/web/pages/GroovyPagesUriSupport.java | GroovyPagesUriSupport.getTemplateURI | public String getTemplateURI(String controllerName, String templateName) {
return getTemplateURI(controllerName, templateName, true);
} | java | public String getTemplateURI(String controllerName, String templateName) {
return getTemplateURI(controllerName, templateName, true);
} | [
"public",
"String",
"getTemplateURI",
"(",
"String",
"controllerName",
",",
"String",
"templateName",
")",
"{",
"return",
"getTemplateURI",
"(",
"controllerName",
",",
"templateName",
",",
"true",
")",
";",
"}"
] | Obtains the URI to a template using the controller name and template name
@param controllerName The controller name
@param templateName The template name
@return The template URI | [
"Obtains",
"the",
"URI",
"to",
"a",
"template",
"using",
"the",
"controller",
"name",
"and",
"template",
"name"
] | train | https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-web-common/src/main/groovy/org/grails/web/pages/GroovyPagesUriSupport.java#L106-L108 |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/MariaDbDatabaseMetaData.java | MariaDbDatabaseMetaData.getSuperTypes | public ResultSet getSuperTypes(String catalog, String schemaPattern, String typeNamePattern)
throws SQLException {
String sql =
"SELECT ' ' TYPE_CAT, NULL TYPE_SCHEM, ' ' TYPE_NAME, ' ' SUPERTYPE_CAT, ' ' SUPERTYPE_SCHEM, ' ' SUPERTYPE_NAME"
+ " FROM DUAL WHERE 1=0";
return executeQuery(sql);
} | java | public ResultSet getSuperTypes(String catalog, String schemaPattern, String typeNamePattern)
throws SQLException {
String sql =
"SELECT ' ' TYPE_CAT, NULL TYPE_SCHEM, ' ' TYPE_NAME, ' ' SUPERTYPE_CAT, ' ' SUPERTYPE_SCHEM, ' ' SUPERTYPE_NAME"
+ " FROM DUAL WHERE 1=0";
return executeQuery(sql);
} | [
"public",
"ResultSet",
"getSuperTypes",
"(",
"String",
"catalog",
",",
"String",
"schemaPattern",
",",
"String",
"typeNamePattern",
")",
"throws",
"SQLException",
"{",
"String",
"sql",
"=",
"\"SELECT ' ' TYPE_CAT, NULL TYPE_SCHEM, ' ' TYPE_NAME, ' ' SUPERTYPE_CAT, ' ' SUPERTYP... | Retrieves a description of the user-defined type (UDT) hierarchies defined in a particular
schema in this database. Only the immediate super type/ sub type relationship is modeled. Only
supertype information for UDTs matching the catalog, schema, and type name is returned. The
type name parameter may be a fully-qualified name. When the UDT name supplied is a
fully-qualified name, the catalog and schemaPattern parameters are ignored. If a UDT does not
have a direct super type, it is not listed here. A row of the <code>ResultSet</code> object
returned by this method describes the designated UDT and a direct supertype. A row has the
following columns:
<OL>
<li><B>TYPE_CAT</B> String {@code =>} the UDT's catalog (may
be <code>null</code>) <li><B>TYPE_SCHEM</B> String {@code =>} UDT's schema (may be
<code>null</code>)
<li><B>TYPE_NAME</B> String {@code =>} type name of the UDT <li><B>SUPERTYPE_CAT</B>
String {@code =>} the direct super type's catalog (may be <code>null</code>)
<li><B>SUPERTYPE_SCHEM</B> String {@code =>} the direct super type's schema (may be
<code>null</code>)
<li><B>SUPERTYPE_NAME</B> String {@code
=>} the direct super type's name </OL>
<P><B>Note:</B> If the driver does not support type hierarchies, an empty result set is
returned.</p>
@param catalog a catalog name; "" retrieves those without a catalog; <code>null</code>
means drop catalog name from the selection criteria
@param schemaPattern a schema name pattern; "" retrieves those without a schema
@param typeNamePattern a UDT name pattern; may be a fully-qualified name
@return a <code>ResultSet</code> object in which a row gives information about the designated
UDT
@throws SQLException if a database access error occurs
@see #getSearchStringEscape
@since 1.4 | [
"Retrieves",
"a",
"description",
"of",
"the",
"user",
"-",
"defined",
"type",
"(",
"UDT",
")",
"hierarchies",
"defined",
"in",
"a",
"particular",
"schema",
"in",
"this",
"database",
".",
"Only",
"the",
"immediate",
"super",
"type",
"/",
"sub",
"type",
"rel... | train | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/MariaDbDatabaseMetaData.java#L2746-L2753 |
apiman/apiman | gateway/engine/jdbc/src/main/java/io/apiman/gateway/engine/jdbc/JdbcRegistry.java | JdbcRegistry.getApiId | protected String getApiId(String orgId, String apiId, String version) {
return orgId + "|" + apiId + "|" + version; //$NON-NLS-1$ //$NON-NLS-2$
} | java | protected String getApiId(String orgId, String apiId, String version) {
return orgId + "|" + apiId + "|" + version; //$NON-NLS-1$ //$NON-NLS-2$
} | [
"protected",
"String",
"getApiId",
"(",
"String",
"orgId",
",",
"String",
"apiId",
",",
"String",
"version",
")",
"{",
"return",
"orgId",
"+",
"\"|\"",
"+",
"apiId",
"+",
"\"|\"",
"+",
"version",
";",
"//$NON-NLS-1$ //$NON-NLS-2$",
"}"
] | Generates a valid document ID for a api, used to index the api in ES.
@param orgId
@param apiId
@param version
@return a api key | [
"Generates",
"a",
"valid",
"document",
"ID",
"for",
"a",
"api",
"used",
"to",
"index",
"the",
"api",
"in",
"ES",
"."
] | train | https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/gateway/engine/jdbc/src/main/java/io/apiman/gateway/engine/jdbc/JdbcRegistry.java#L410-L412 |
rundeck/rundeck | core/src/main/java/com/dtolabs/rundeck/core/tasks/net/ExtSSHExec.java | ExtSSHExec.writeToFile | private void writeToFile(String from, boolean append, File to)
throws IOException {
FileWriter out = null;
try {
out = new FileWriter(to.getAbsolutePath(), append);
StringReader in = new StringReader(from);
char[] buffer = new char[BUFFER_SIZE];
int bytesRead;
while (true) {
bytesRead = in.read(buffer);
if (bytesRead == -1) {
break;
}
out.write(buffer, 0, bytesRead);
}
out.flush();
} finally {
if (out != null) {
out.close();
}
}
} | java | private void writeToFile(String from, boolean append, File to)
throws IOException {
FileWriter out = null;
try {
out = new FileWriter(to.getAbsolutePath(), append);
StringReader in = new StringReader(from);
char[] buffer = new char[BUFFER_SIZE];
int bytesRead;
while (true) {
bytesRead = in.read(buffer);
if (bytesRead == -1) {
break;
}
out.write(buffer, 0, bytesRead);
}
out.flush();
} finally {
if (out != null) {
out.close();
}
}
} | [
"private",
"void",
"writeToFile",
"(",
"String",
"from",
",",
"boolean",
"append",
",",
"File",
"to",
")",
"throws",
"IOException",
"{",
"FileWriter",
"out",
"=",
"null",
";",
"try",
"{",
"out",
"=",
"new",
"FileWriter",
"(",
"to",
".",
"getAbsolutePath",
... | Writes a string to a file. If destination file exists, it may be
overwritten depending on the "append" value.
@param from string to write
@param to file to write to
@param append if true, append to existing file, else overwrite
@exception IOException on io error | [
"Writes",
"a",
"string",
"to",
"a",
"file",
".",
"If",
"destination",
"file",
"exists",
"it",
"may",
"be",
"overwritten",
"depending",
"on",
"the",
"append",
"value",
"."
] | train | https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/tasks/net/ExtSSHExec.java#L547-L568 |
evernote/android-job | library/src/main/java/com/evernote/android/job/util/JobPreconditions.java | JobPreconditions.checkFlagsArgument | public static void checkFlagsArgument(final int requestedFlags, final int allowedFlags) {
if ((requestedFlags & allowedFlags) != requestedFlags) {
throw new IllegalArgumentException("Requested flags 0x"
+ Integer.toHexString(requestedFlags) + ", but only 0x"
+ Integer.toHexString(allowedFlags) + " are allowed");
}
} | java | public static void checkFlagsArgument(final int requestedFlags, final int allowedFlags) {
if ((requestedFlags & allowedFlags) != requestedFlags) {
throw new IllegalArgumentException("Requested flags 0x"
+ Integer.toHexString(requestedFlags) + ", but only 0x"
+ Integer.toHexString(allowedFlags) + " are allowed");
}
} | [
"public",
"static",
"void",
"checkFlagsArgument",
"(",
"final",
"int",
"requestedFlags",
",",
"final",
"int",
"allowedFlags",
")",
"{",
"if",
"(",
"(",
"requestedFlags",
"&",
"allowedFlags",
")",
"!=",
"requestedFlags",
")",
"{",
"throw",
"new",
"IllegalArgument... | Check the requested flags, throwing if any requested flags are outside
the allowed set. | [
"Check",
"the",
"requested",
"flags",
"throwing",
"if",
"any",
"requested",
"flags",
"are",
"outside",
"the",
"allowed",
"set",
"."
] | train | https://github.com/evernote/android-job/blob/5ae3d776ad9d80b5b7f60ae3e382d44d0d193faf/library/src/main/java/com/evernote/android/job/util/JobPreconditions.java#L101-L107 |
xiancloud/xian | xian-core/src/main/java/info/xiancloud/core/LocalUnitsManager.java | LocalUnitsManager.getLocalUnit | public static Unit getLocalUnit(String groupName, String unitName) {
return getLocalUnit(Unit.fullName(groupName, unitName));
} | java | public static Unit getLocalUnit(String groupName, String unitName) {
return getLocalUnit(Unit.fullName(groupName, unitName));
} | [
"public",
"static",
"Unit",
"getLocalUnit",
"(",
"String",
"groupName",
",",
"String",
"unitName",
")",
"{",
"return",
"getLocalUnit",
"(",
"Unit",
".",
"fullName",
"(",
"groupName",
",",
"unitName",
")",
")",
";",
"}"
] | Get local cached unit singleton.
the same as {@link #getLocalUnit(String)} | [
"Get",
"local",
"cached",
"unit",
"singleton",
".",
"the",
"same",
"as",
"{"
] | train | https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-core/src/main/java/info/xiancloud/core/LocalUnitsManager.java#L253-L255 |
jbundle/jbundle | thin/base/db/base/src/main/java/org/jbundle/thin/base/db/FieldList.java | FieldList.makeScreen | public ScreenParent makeScreen(ScreenLoc itsLocation, ComponentParent parentScreen, int iDocMode, Map<String, Object> properties)
{
return null; // Not implemented in thin.
} | java | public ScreenParent makeScreen(ScreenLoc itsLocation, ComponentParent parentScreen, int iDocMode, Map<String, Object> properties)
{
return null; // Not implemented in thin.
} | [
"public",
"ScreenParent",
"makeScreen",
"(",
"ScreenLoc",
"itsLocation",
",",
"ComponentParent",
"parentScreen",
",",
"int",
"iDocMode",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
")",
"{",
"return",
"null",
";",
"// Not implemented in thin.",
"}... | Create a default document for file maintenance or file display.
Usually overidden in the file's record class.
@param itsLocation The location of the screen in the parentScreen (usually null here).
@param parentScreen The parent screen.
@param iDocMode The type of screen to create (MAINT/DISPLAY/SELECT/MENU/etc).
@return The new screen. | [
"Create",
"a",
"default",
"document",
"for",
"file",
"maintenance",
"or",
"file",
"display",
".",
"Usually",
"overidden",
"in",
"the",
"file",
"s",
"record",
"class",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/base/src/main/java/org/jbundle/thin/base/db/FieldList.java#L876-L879 |
jtrfp/javamod | src/main/java/de/quippy/jflac/io/BitInputStream.java | BitInputStream.peekBitToInt | public int peekBitToInt(int val, int bit) throws IOException {
while (true) {
if (bit < availBits) {
val <<= 1;
if ((getBit + bit) >= BITS_PER_BLURB) {
bit = (getBit + bit) % BITS_PER_BLURB;
val |= ((buffer[getByte + 1] & (0x80 >> bit)) != 0) ? 1 : 0;
} else {
val |= ((buffer[getByte] & (0x80 >> (getBit + bit))) != 0) ? 1 : 0;
}
return val;
} else {
readFromStream();
}
}
} | java | public int peekBitToInt(int val, int bit) throws IOException {
while (true) {
if (bit < availBits) {
val <<= 1;
if ((getBit + bit) >= BITS_PER_BLURB) {
bit = (getBit + bit) % BITS_PER_BLURB;
val |= ((buffer[getByte + 1] & (0x80 >> bit)) != 0) ? 1 : 0;
} else {
val |= ((buffer[getByte] & (0x80 >> (getBit + bit))) != 0) ? 1 : 0;
}
return val;
} else {
readFromStream();
}
}
} | [
"public",
"int",
"peekBitToInt",
"(",
"int",
"val",
",",
"int",
"bit",
")",
"throws",
"IOException",
"{",
"while",
"(",
"true",
")",
"{",
"if",
"(",
"bit",
"<",
"availBits",
")",
"{",
"val",
"<<=",
"1",
";",
"if",
"(",
"(",
"getBit",
"+",
"bit",
... | peek at the next bit and add it to the input integer.
The bits of the input integer are shifted left and the
read bit is placed into bit 0.
@param val The input integer
@param bit The bit to peek at
@return The updated integer value
@throws IOException Thrown if error reading input stream | [
"peek",
"at",
"the",
"next",
"bit",
"and",
"add",
"it",
"to",
"the",
"input",
"integer",
".",
"The",
"bits",
"of",
"the",
"input",
"integer",
"are",
"shifted",
"left",
"and",
"the",
"read",
"bit",
"is",
"placed",
"into",
"bit",
"0",
"."
] | train | https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/jflac/io/BitInputStream.java#L255-L270 |
VoltDB/voltdb | third_party/java/src/org/apache/zookeeper_voltpatches/ZooKeeper.java | ZooKeeper.getData | public byte[] getData(String path, boolean watch, Stat stat)
throws KeeperException, InterruptedException {
verbotenThreadCheck();
return getData(path, watch ? watchManager.defaultWatcher : null, stat);
} | java | public byte[] getData(String path, boolean watch, Stat stat)
throws KeeperException, InterruptedException {
verbotenThreadCheck();
return getData(path, watch ? watchManager.defaultWatcher : null, stat);
} | [
"public",
"byte",
"[",
"]",
"getData",
"(",
"String",
"path",
",",
"boolean",
"watch",
",",
"Stat",
"stat",
")",
"throws",
"KeeperException",
",",
"InterruptedException",
"{",
"verbotenThreadCheck",
"(",
")",
";",
"return",
"getData",
"(",
"path",
",",
"watc... | Return the data and the stat of the node of the given path.
<p>
If the watch is true and the call is successful (no exception is thrown),
a watch will be left on the node with the given path. The watch will be
triggered by a successful operation that sets data on the node, or
deletes the node.
<p>
A KeeperException with error code KeeperException.NoNode will be thrown
if no node with the given path exists.
@param path
the given path
@param watch
whether need to watch this node
@param stat
the stat of the node
@return the data of the node
@throws KeeperException
If the server signals an error with a non-zero error code
@throws InterruptedException
If the server transaction is interrupted. | [
"Return",
"the",
"data",
"and",
"the",
"stat",
"of",
"the",
"node",
"of",
"the",
"given",
"path",
".",
"<p",
">",
"If",
"the",
"watch",
"is",
"true",
"and",
"the",
"call",
"is",
"successful",
"(",
"no",
"exception",
"is",
"thrown",
")",
"a",
"watch",... | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/org/apache/zookeeper_voltpatches/ZooKeeper.java#L997-L1001 |
VoltDB/voltdb | src/frontend/org/voltdb/VoltDB.java | VoltDB.printStackTraces | public static void printStackTraces(PrintWriter writer, List<String> currentStacktrace) {
if (currentStacktrace == null) {
currentStacktrace = new ArrayList<>();
}
Map<Thread, StackTraceElement[]> traces = Thread.getAllStackTraces();
StackTraceElement[] myTrace = traces.get(Thread.currentThread());
for (StackTraceElement ste : myTrace) {
currentStacktrace.add(ste.toString());
}
writer.println();
writer.println("****** Current Thread ****** ");
for (String currentStackElem : currentStacktrace) {
writer.println(currentStackElem);
}
writer.println("****** All Threads ******");
Iterator<Thread> it = traces.keySet().iterator();
while (it.hasNext())
{
Thread key = it.next();
writer.println();
StackTraceElement[] st = traces.get(key);
writer.println("****** " + key + " ******");
for (StackTraceElement ste : st) {
writer.println(ste);
}
}
} | java | public static void printStackTraces(PrintWriter writer, List<String> currentStacktrace) {
if (currentStacktrace == null) {
currentStacktrace = new ArrayList<>();
}
Map<Thread, StackTraceElement[]> traces = Thread.getAllStackTraces();
StackTraceElement[] myTrace = traces.get(Thread.currentThread());
for (StackTraceElement ste : myTrace) {
currentStacktrace.add(ste.toString());
}
writer.println();
writer.println("****** Current Thread ****** ");
for (String currentStackElem : currentStacktrace) {
writer.println(currentStackElem);
}
writer.println("****** All Threads ******");
Iterator<Thread> it = traces.keySet().iterator();
while (it.hasNext())
{
Thread key = it.next();
writer.println();
StackTraceElement[] st = traces.get(key);
writer.println("****** " + key + " ******");
for (StackTraceElement ste : st) {
writer.println(ste);
}
}
} | [
"public",
"static",
"void",
"printStackTraces",
"(",
"PrintWriter",
"writer",
",",
"List",
"<",
"String",
">",
"currentStacktrace",
")",
"{",
"if",
"(",
"currentStacktrace",
"==",
"null",
")",
"{",
"currentStacktrace",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
... | /*
Print stack traces for all threads in the process to the supplied writer.
If a List is supplied then the stack frames for the current thread will be placed in it | [
"/",
"*",
"Print",
"stack",
"traces",
"for",
"all",
"threads",
"in",
"the",
"process",
"to",
"the",
"supplied",
"writer",
".",
"If",
"a",
"List",
"is",
"supplied",
"then",
"the",
"stack",
"frames",
"for",
"the",
"current",
"thread",
"will",
"be",
"placed... | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/VoltDB.java#L1176-L1205 |
OpenLiberty/open-liberty | dev/com.ibm.ws.monitor/src/com/ibm/ws/pmi/server/NLS.java | NLS.getString | public String getString(String key, String defaultString) {
if (key == null) {
return defaultString;
}
try {
String result = getString(key);
return result;
} catch (MissingResourceException e) {
return defaultString;
}
} | java | public String getString(String key, String defaultString) {
if (key == null) {
return defaultString;
}
try {
String result = getString(key);
return result;
} catch (MissingResourceException e) {
return defaultString;
}
} | [
"public",
"String",
"getString",
"(",
"String",
"key",
",",
"String",
"defaultString",
")",
"{",
"if",
"(",
"key",
"==",
"null",
")",
"{",
"return",
"defaultString",
";",
"}",
"try",
"{",
"String",
"result",
"=",
"getString",
"(",
"key",
")",
";",
"ret... | Overrides ResourceBundle.getString. Adds some error checking to ensure that
we got a non-null key and resource bundle.
Adds default string functionality. If the key for the resource
was not found, return the default string passed in. This way
something displays, even if it is in English.
@param key Name portion of "name=value" pair.
@param defaultString String to return if the key was null, or if
resource was not found
(MissingResourceException thrown). | [
"Overrides",
"ResourceBundle",
".",
"getString",
".",
"Adds",
"some",
"error",
"checking",
"to",
"ensure",
"that",
"we",
"got",
"a",
"non",
"-",
"null",
"key",
"and",
"resource",
"bundle",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.monitor/src/com/ibm/ws/pmi/server/NLS.java#L357-L367 |
nguyenq/tess4j | src/main/java/net/sourceforge/tess4j/Tesseract.java | Tesseract.doOCR | @Override
public String doOCR(List<IIOImage> imageList, String filename, Rectangle rect) throws TesseractException {
init();
setTessVariables();
try {
StringBuilder sb = new StringBuilder();
int pageNum = 0;
for (IIOImage oimage : imageList) {
pageNum++;
try {
setImage(oimage.getRenderedImage(), rect);
sb.append(getOCRText(filename, pageNum));
} catch (IOException ioe) {
// skip the problematic image
logger.error(ioe.getMessage(), ioe);
}
}
if (renderedFormat == RenderedFormat.HOCR) {
sb.insert(0, htmlBeginTag).append(htmlEndTag);
}
return sb.toString();
} finally {
dispose();
}
} | java | @Override
public String doOCR(List<IIOImage> imageList, String filename, Rectangle rect) throws TesseractException {
init();
setTessVariables();
try {
StringBuilder sb = new StringBuilder();
int pageNum = 0;
for (IIOImage oimage : imageList) {
pageNum++;
try {
setImage(oimage.getRenderedImage(), rect);
sb.append(getOCRText(filename, pageNum));
} catch (IOException ioe) {
// skip the problematic image
logger.error(ioe.getMessage(), ioe);
}
}
if (renderedFormat == RenderedFormat.HOCR) {
sb.insert(0, htmlBeginTag).append(htmlEndTag);
}
return sb.toString();
} finally {
dispose();
}
} | [
"@",
"Override",
"public",
"String",
"doOCR",
"(",
"List",
"<",
"IIOImage",
">",
"imageList",
",",
"String",
"filename",
",",
"Rectangle",
"rect",
")",
"throws",
"TesseractException",
"{",
"init",
"(",
")",
";",
"setTessVariables",
"(",
")",
";",
"try",
"{... | Performs OCR operation.
@param imageList a list of <code>IIOImage</code> objects
@param filename input file name. Needed only for training and reading a
UNLV zone file.
@param rect the bounding rectangle defines the region of the image to be
recognized. A rectangle of zero dimension or <code>null</code> indicates
the whole image.
@return the recognized text
@throws TesseractException | [
"Performs",
"OCR",
"operation",
"."
] | train | https://github.com/nguyenq/tess4j/blob/cfcd4a8a44042f150b4aaf7bdf5ffc485a2236e1/src/main/java/net/sourceforge/tess4j/Tesseract.java#L308-L336 |
playn/playn | core/src/playn/core/json/JsonParser.java | JsonParser.stringHexChar | private int stringHexChar() throws JsonParserException {
// GWT-compatible Character.digit(char, int)
int c = "0123456789abcdef0123456789ABCDEF".indexOf(advanceChar()) % 16;
if (c == -1)
throw createParseException(null, "Expected unicode hex escape character", false);
return c;
} | java | private int stringHexChar() throws JsonParserException {
// GWT-compatible Character.digit(char, int)
int c = "0123456789abcdef0123456789ABCDEF".indexOf(advanceChar()) % 16;
if (c == -1)
throw createParseException(null, "Expected unicode hex escape character", false);
return c;
} | [
"private",
"int",
"stringHexChar",
"(",
")",
"throws",
"JsonParserException",
"{",
"// GWT-compatible Character.digit(char, int)",
"int",
"c",
"=",
"\"0123456789abcdef0123456789ABCDEF\"",
".",
"indexOf",
"(",
"advanceChar",
"(",
")",
")",
"%",
"16",
";",
"if",
"(",
... | Advances a character, throwing if it is illegal in the context of a JSON string hex unicode escape. | [
"Advances",
"a",
"character",
"throwing",
"if",
"it",
"is",
"illegal",
"in",
"the",
"context",
"of",
"a",
"JSON",
"string",
"hex",
"unicode",
"escape",
"."
] | train | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/core/src/playn/core/json/JsonParser.java#L386-L392 |
JakeWharton/ProcessPhoenix | process-phoenix/src/main/java/com/jakewharton/processphoenix/ProcessPhoenix.java | ProcessPhoenix.triggerRebirth | public static void triggerRebirth(Context context, Intent... nextIntents) {
Intent intent = new Intent(context, ProcessPhoenix.class);
intent.addFlags(FLAG_ACTIVITY_NEW_TASK); // In case we are called with non-Activity context.
intent.putParcelableArrayListExtra(KEY_RESTART_INTENTS, new ArrayList<>(Arrays.asList(nextIntents)));
context.startActivity(intent);
if (context instanceof Activity) {
((Activity) context).finish();
}
Runtime.getRuntime().exit(0); // Kill kill kill!
} | java | public static void triggerRebirth(Context context, Intent... nextIntents) {
Intent intent = new Intent(context, ProcessPhoenix.class);
intent.addFlags(FLAG_ACTIVITY_NEW_TASK); // In case we are called with non-Activity context.
intent.putParcelableArrayListExtra(KEY_RESTART_INTENTS, new ArrayList<>(Arrays.asList(nextIntents)));
context.startActivity(intent);
if (context instanceof Activity) {
((Activity) context).finish();
}
Runtime.getRuntime().exit(0); // Kill kill kill!
} | [
"public",
"static",
"void",
"triggerRebirth",
"(",
"Context",
"context",
",",
"Intent",
"...",
"nextIntents",
")",
"{",
"Intent",
"intent",
"=",
"new",
"Intent",
"(",
"context",
",",
"ProcessPhoenix",
".",
"class",
")",
";",
"intent",
".",
"addFlags",
"(",
... | Call to restart the application process using the specified intents.
<p>
Behavior of the current process after invoking this method is undefined. | [
"Call",
"to",
"restart",
"the",
"application",
"process",
"using",
"the",
"specified",
"intents",
".",
"<p",
">",
"Behavior",
"of",
"the",
"current",
"process",
"after",
"invoking",
"this",
"method",
"is",
"undefined",
"."
] | train | https://github.com/JakeWharton/ProcessPhoenix/blob/c89c622f8883812e7112e676e88ff307add4bad1/process-phoenix/src/main/java/com/jakewharton/processphoenix/ProcessPhoenix.java#L56-L65 |
OpenLiberty/open-liberty | dev/com.ibm.ws.microprofile.metrics_fat/fat/src/com/ibm/ws/microprofile/metrics/fat/utils/MetricsConnection.java | MetricsConnection.connection_invalidUser | public static MetricsConnection connection_invalidUser(LibertyServer server) {
return new MetricsConnection(server, METRICS_ENDPOINT).secure(true)
.header("Authorization",
"Basic " + Base64Coder.base64Encode(INVALID_USER_USERNAME + ":" + INVALID_USER_PASSWORD));
} | java | public static MetricsConnection connection_invalidUser(LibertyServer server) {
return new MetricsConnection(server, METRICS_ENDPOINT).secure(true)
.header("Authorization",
"Basic " + Base64Coder.base64Encode(INVALID_USER_USERNAME + ":" + INVALID_USER_PASSWORD));
} | [
"public",
"static",
"MetricsConnection",
"connection_invalidUser",
"(",
"LibertyServer",
"server",
")",
"{",
"return",
"new",
"MetricsConnection",
"(",
"server",
",",
"METRICS_ENDPOINT",
")",
".",
"secure",
"(",
"true",
")",
".",
"header",
"(",
"\"Authorization\"",
... | Creates a connection for private (authorized) docs endpoint using HTTPS
and an invalid user ID
@param server - server to connect to
@return | [
"Creates",
"a",
"connection",
"for",
"private",
"(",
"authorized",
")",
"docs",
"endpoint",
"using",
"HTTPS",
"and",
"an",
"invalid",
"user",
"ID"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.metrics_fat/fat/src/com/ibm/ws/microprofile/metrics/fat/utils/MetricsConnection.java#L241-L245 |
google/error-prone-javac | src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractMemberWriter.java | AbstractMemberWriter.getSummaryTableTree | public Content getSummaryTableTree(TypeElement tElement, List<Content> tableContents) {
return writer.getSummaryTableTree(this, tElement, tableContents, showTabs());
} | java | public Content getSummaryTableTree(TypeElement tElement, List<Content> tableContents) {
return writer.getSummaryTableTree(this, tElement, tableContents, showTabs());
} | [
"public",
"Content",
"getSummaryTableTree",
"(",
"TypeElement",
"tElement",
",",
"List",
"<",
"Content",
">",
"tableContents",
")",
"{",
"return",
"writer",
".",
"getSummaryTableTree",
"(",
"this",
",",
"tElement",
",",
"tableContents",
",",
"showTabs",
"(",
")"... | Get the summary table tree for the given class.
@param tElement the class for which the summary table is generated
@param tableContents list of contents to be displayed in the summary table
@return a content tree for the summary table | [
"Get",
"the",
"summary",
"table",
"tree",
"for",
"the",
"given",
"class",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractMemberWriter.java#L637-L639 |
phax/ph-commons | ph-xml/src/main/java/com/helger/xml/microdom/serialize/MicroWriter.java | MicroWriter.writeToWriter | @Nonnull
public static ESuccess writeToWriter (@Nonnull final IMicroNode aNode, @Nonnull @WillClose final Writer aWriter)
{
return writeToWriter (aNode, aWriter, XMLWriterSettings.DEFAULT_XML_SETTINGS);
} | java | @Nonnull
public static ESuccess writeToWriter (@Nonnull final IMicroNode aNode, @Nonnull @WillClose final Writer aWriter)
{
return writeToWriter (aNode, aWriter, XMLWriterSettings.DEFAULT_XML_SETTINGS);
} | [
"@",
"Nonnull",
"public",
"static",
"ESuccess",
"writeToWriter",
"(",
"@",
"Nonnull",
"final",
"IMicroNode",
"aNode",
",",
"@",
"Nonnull",
"@",
"WillClose",
"final",
"Writer",
"aWriter",
")",
"{",
"return",
"writeToWriter",
"(",
"aNode",
",",
"aWriter",
",",
... | Write a Micro Node to a {@link Writer} using the default
{@link XMLWriterSettings#DEFAULT_XML_SETTINGS}.
@param aNode
The node to be serialized. May be any kind of node (incl.
documents). May not be <code>null</code>.
@param aWriter
The writer to write to. May not be <code>null</code>. The writer is
closed anyway directly after the operation finishes (on success and
on error).
@return {@link ESuccess}
@since 8.6.3 | [
"Write",
"a",
"Micro",
"Node",
"to",
"a",
"{",
"@link",
"Writer",
"}",
"using",
"the",
"default",
"{",
"@link",
"XMLWriterSettings#DEFAULT_XML_SETTINGS",
"}",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-xml/src/main/java/com/helger/xml/microdom/serialize/MicroWriter.java#L247-L251 |
qiniu/java-sdk | src/main/java/com/qiniu/streaming/StreamingManager.java | StreamingManager.disableTill | public void disableTill(String streamKey, long expireAtTimestamp) throws QiniuException {
String path = encodeKey(streamKey) + "/disabled";
String body = String.format("{\"disabledTill\":%d}", expireAtTimestamp);
post(path, body, null);
} | java | public void disableTill(String streamKey, long expireAtTimestamp) throws QiniuException {
String path = encodeKey(streamKey) + "/disabled";
String body = String.format("{\"disabledTill\":%d}", expireAtTimestamp);
post(path, body, null);
} | [
"public",
"void",
"disableTill",
"(",
"String",
"streamKey",
",",
"long",
"expireAtTimestamp",
")",
"throws",
"QiniuException",
"{",
"String",
"path",
"=",
"encodeKey",
"(",
"streamKey",
")",
"+",
"\"/disabled\"",
";",
"String",
"body",
"=",
"String",
".",
"fo... | 禁用流
@param streamKey 流名称
@param expireAtTimestamp 禁用截至时间戳,单位秒 | [
"禁用流"
] | train | https://github.com/qiniu/java-sdk/blob/6c05f3fb718403a496c725b048e9241f80171499/src/main/java/com/qiniu/streaming/StreamingManager.java#L110-L114 |
jbundle/jbundle | base/screen/model/src/main/java/org/jbundle/base/screen/model/report/parser/XMLParser.java | XMLParser.printHtmlData | public void printHtmlData(PrintWriter out, InputStream streamIn)
{
String str = null;
if (streamIn != null)
str = Utility.transferURLStream(null, null, new InputStreamReader(streamIn));
if ((str == null) || (str.length() == 0))
str = this.getDefaultXML();
this.parseHtmlData(out, str);
} | java | public void printHtmlData(PrintWriter out, InputStream streamIn)
{
String str = null;
if (streamIn != null)
str = Utility.transferURLStream(null, null, new InputStreamReader(streamIn));
if ((str == null) || (str.length() == 0))
str = this.getDefaultXML();
this.parseHtmlData(out, str);
} | [
"public",
"void",
"printHtmlData",
"(",
"PrintWriter",
"out",
",",
"InputStream",
"streamIn",
")",
"{",
"String",
"str",
"=",
"null",
";",
"if",
"(",
"streamIn",
"!=",
"null",
")",
"str",
"=",
"Utility",
".",
"transferURLStream",
"(",
"null",
",",
"null",
... | Output this screen using HTML.
Override this to print your XML. | [
"Output",
"this",
"screen",
"using",
"HTML",
".",
"Override",
"this",
"to",
"print",
"your",
"XML",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/model/report/parser/XMLParser.java#L60-L68 |
elki-project/elki | elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/io/ParseUtil.java | ParseUtil.matchNaN | private static boolean matchNaN(byte[] str, byte firstchar, int start, int end) {
final int len = end - start;
if(len < 2 || len > 3 || (firstchar != 'N' && firstchar != 'n')) {
return false;
}
final byte c1 = str[start + 1];
if(c1 != 'a' && c1 != 'A') {
return false;
}
// Accept just "NA", too:
if(len == 2) {
return true;
}
final byte c2 = str[start + 2];
return c2 == 'N' || c2 == 'n';
} | java | private static boolean matchNaN(byte[] str, byte firstchar, int start, int end) {
final int len = end - start;
if(len < 2 || len > 3 || (firstchar != 'N' && firstchar != 'n')) {
return false;
}
final byte c1 = str[start + 1];
if(c1 != 'a' && c1 != 'A') {
return false;
}
// Accept just "NA", too:
if(len == 2) {
return true;
}
final byte c2 = str[start + 2];
return c2 == 'N' || c2 == 'n';
} | [
"private",
"static",
"boolean",
"matchNaN",
"(",
"byte",
"[",
"]",
"str",
",",
"byte",
"firstchar",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"final",
"int",
"len",
"=",
"end",
"-",
"start",
";",
"if",
"(",
"len",
"<",
"2",
"||",
"len",
"... | Match "NaN" in a number of different capitalizations.
@param str String to match
@param firstchar First character
@param start Interval begin
@param end Interval end
@return {@code true} when NaN was recognized. | [
"Match",
"NaN",
"in",
"a",
"number",
"of",
"different",
"capitalizations",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/io/ParseUtil.java#L543-L558 |
KyoriPowered/text | api/src/main/java/net/kyori/text/TextComponent.java | TextComponent.of | public static TextComponent of(final @NonNull String content, final @Nullable TextColor color) {
return of(content, color, Collections.emptySet());
} | java | public static TextComponent of(final @NonNull String content, final @Nullable TextColor color) {
return of(content, color, Collections.emptySet());
} | [
"public",
"static",
"TextComponent",
"of",
"(",
"final",
"@",
"NonNull",
"String",
"content",
",",
"final",
"@",
"Nullable",
"TextColor",
"color",
")",
"{",
"return",
"of",
"(",
"content",
",",
"color",
",",
"Collections",
".",
"emptySet",
"(",
")",
")",
... | Creates a text component with content, and optional color.
@param content the plain text content
@param color the color
@return the text component | [
"Creates",
"a",
"text",
"component",
"with",
"content",
"and",
"optional",
"color",
"."
] | train | https://github.com/KyoriPowered/text/blob/4496c593bf89e8fb036dd6efe26f8ac60f7655c9/api/src/main/java/net/kyori/text/TextComponent.java#L151-L153 |
Pi4J/pi4j | pi4j-gpio-extension/src/main/java/com/pi4j/gpio/extension/base/AdcGpioProviderBase.java | AdcGpioProviderBase.setEventThreshold | @Override
public void setEventThreshold(double threshold, GpioPinAnalogInput...pin){
for(GpioPin p : pin){
setEventThreshold(threshold, p.getPin());
}
} | java | @Override
public void setEventThreshold(double threshold, GpioPinAnalogInput...pin){
for(GpioPin p : pin){
setEventThreshold(threshold, p.getPin());
}
} | [
"@",
"Override",
"public",
"void",
"setEventThreshold",
"(",
"double",
"threshold",
",",
"GpioPinAnalogInput",
"...",
"pin",
")",
"{",
"for",
"(",
"GpioPin",
"p",
":",
"pin",
")",
"{",
"setEventThreshold",
"(",
"threshold",
",",
"p",
".",
"getPin",
"(",
")... | Set the event threshold value for a given analog input pin.
The event threshold value determines how much change in the
analog input pin's conversion value must occur before the
framework issues an analog input pin change event. A threshold
is necessary to prevent a significant number of analog input
change events from getting propagated and dispatched for input
values that may have an expected range of drift.
see the DEFAULT_THRESHOLD constant for the default threshold value.
@param threshold threshold value for requested analog input pin.
@param pin analog input pin (vararg, one or more inputs can be defined.) | [
"Set",
"the",
"event",
"threshold",
"value",
"for",
"a",
"given",
"analog",
"input",
"pin",
"."
] | train | https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-gpio-extension/src/main/java/com/pi4j/gpio/extension/base/AdcGpioProviderBase.java#L258-L263 |
aws/aws-sdk-java | aws-java-sdk-iot1clickprojects/src/main/java/com/amazonaws/services/iot1clickprojects/model/ProjectDescription.java | ProjectDescription.withTags | public ProjectDescription withTags(java.util.Map<String, String> tags) {
setTags(tags);
return this;
} | java | public ProjectDescription withTags(java.util.Map<String, String> tags) {
setTags(tags);
return this;
} | [
"public",
"ProjectDescription",
"withTags",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"tags",
")",
"{",
"setTags",
"(",
"tags",
")",
";",
"return",
"this",
";",
"}"
] | <p>
The tags (metadata key/value pairs) associated with the project.
</p>
@param tags
The tags (metadata key/value pairs) associated with the project.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"The",
"tags",
"(",
"metadata",
"key",
"/",
"value",
"pairs",
")",
"associated",
"with",
"the",
"project",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-iot1clickprojects/src/main/java/com/amazonaws/services/iot1clickprojects/model/ProjectDescription.java#L356-L359 |
google/closure-templates | java/src/com/google/template/soy/passes/PluginResolver.java | PluginResolver.lookupSoyFunction | public Object lookupSoyFunction(String name, int numArgs, SourceLocation location) {
Object soyFunction = functions.get(name);
if (soyFunction == null) {
reportMissing(location, "function", name, functions.keySet());
return ERROR_PLACEHOLDER_FUNCTION;
}
Set<Integer> validArgsSize;
if (soyFunction instanceof SoyFunction) {
validArgsSize = ((SoyFunction) soyFunction).getValidArgsSizes();
} else {
validArgsSize =
getValidArgsSizes(
soyFunction.getClass().getAnnotation(SoyFunctionSignature.class).value());
}
checkNumArgs("function", validArgsSize, numArgs, location);
warnIfDeprecated(name, soyFunction, location);
return soyFunction;
} | java | public Object lookupSoyFunction(String name, int numArgs, SourceLocation location) {
Object soyFunction = functions.get(name);
if (soyFunction == null) {
reportMissing(location, "function", name, functions.keySet());
return ERROR_PLACEHOLDER_FUNCTION;
}
Set<Integer> validArgsSize;
if (soyFunction instanceof SoyFunction) {
validArgsSize = ((SoyFunction) soyFunction).getValidArgsSizes();
} else {
validArgsSize =
getValidArgsSizes(
soyFunction.getClass().getAnnotation(SoyFunctionSignature.class).value());
}
checkNumArgs("function", validArgsSize, numArgs, location);
warnIfDeprecated(name, soyFunction, location);
return soyFunction;
} | [
"public",
"Object",
"lookupSoyFunction",
"(",
"String",
"name",
",",
"int",
"numArgs",
",",
"SourceLocation",
"location",
")",
"{",
"Object",
"soyFunction",
"=",
"functions",
".",
"get",
"(",
"name",
")",
";",
"if",
"(",
"soyFunction",
"==",
"null",
")",
"... | Returns a function with the given name and arity.
<p>An error will be reported according to the current {@link Mode} and a placeholder function
will be returned if it cannot be found. | [
"Returns",
"a",
"function",
"with",
"the",
"given",
"name",
"and",
"arity",
"."
] | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/passes/PluginResolver.java#L194-L211 |
jbossas/remoting-jmx | src/main/java/org/jboss/remotingjmx/DelegatingRemotingConnectorServer.java | DelegatingRemotingConnectorServer.writeVersionHeader | private void writeVersionHeader(final Channel channel, final boolean fullVersionList) throws IOException {
CancellableDataOutputStream dos = new CancellableDataOutputStream(channel.writeMessage());
try {
dos.writeBytes(JMX);
byte[] versions = getSupportedVersions(fullVersionList);
dos.writeInt(versions.length);
dos.write(versions);
if (Version.isSnapshot()) {
dos.write(SNAPSHOT);
} else {
dos.write(STABLE);
}
if (fullVersionList) {
String remotingJMXVersion = Version.getVersionString();
byte[] versionBytes = remotingJMXVersion.getBytes("UTF-8");
dos.writeInt(versionBytes.length);
dos.write(versionBytes);
}
} catch (IOException e) {
dos.cancel();
throw e;
} finally {
dos.close();
}
} | java | private void writeVersionHeader(final Channel channel, final boolean fullVersionList) throws IOException {
CancellableDataOutputStream dos = new CancellableDataOutputStream(channel.writeMessage());
try {
dos.writeBytes(JMX);
byte[] versions = getSupportedVersions(fullVersionList);
dos.writeInt(versions.length);
dos.write(versions);
if (Version.isSnapshot()) {
dos.write(SNAPSHOT);
} else {
dos.write(STABLE);
}
if (fullVersionList) {
String remotingJMXVersion = Version.getVersionString();
byte[] versionBytes = remotingJMXVersion.getBytes("UTF-8");
dos.writeInt(versionBytes.length);
dos.write(versionBytes);
}
} catch (IOException e) {
dos.cancel();
throw e;
} finally {
dos.close();
}
} | [
"private",
"void",
"writeVersionHeader",
"(",
"final",
"Channel",
"channel",
",",
"final",
"boolean",
"fullVersionList",
")",
"throws",
"IOException",
"{",
"CancellableDataOutputStream",
"dos",
"=",
"new",
"CancellableDataOutputStream",
"(",
"channel",
".",
"writeMessag... | Write the header message to the client.
<p/>
The header message will contain the following items to allow the client to select a version: -
<p/>
- The bytes for the characters 'JMX' - not completely fail safe but will allow early detection the client is connected to
the correct channel. - The number of versions supported by the server. (single byte) - The versions listed sequentially.
- A single byte to identify if the server is a SNAPSHOT release 0x00 = Stable, 0x01 - Snapshot
@param channel
@throws IOException | [
"Write",
"the",
"header",
"message",
"to",
"the",
"client",
".",
"<p",
"/",
">",
"The",
"header",
"message",
"will",
"contain",
"the",
"following",
"items",
"to",
"allow",
"the",
"client",
"to",
"select",
"a",
"version",
":",
"-",
"<p",
"/",
">",
"-",
... | train | https://github.com/jbossas/remoting-jmx/blob/dbc87bfed47e5bb9e37c355a77ca0ae9a6ea1363/src/main/java/org/jboss/remotingjmx/DelegatingRemotingConnectorServer.java#L185-L210 |
UrielCh/ovh-java-sdk | ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java | ApiOvhDedicatedserver.serviceName_statistics_disk_disk_smart_GET | public OvhRtmDiskSmart serviceName_statistics_disk_disk_smart_GET(String serviceName, String disk) throws IOException {
String qPath = "/dedicated/server/{serviceName}/statistics/disk/{disk}/smart";
StringBuilder sb = path(qPath, serviceName, disk);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhRtmDiskSmart.class);
} | java | public OvhRtmDiskSmart serviceName_statistics_disk_disk_smart_GET(String serviceName, String disk) throws IOException {
String qPath = "/dedicated/server/{serviceName}/statistics/disk/{disk}/smart";
StringBuilder sb = path(qPath, serviceName, disk);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhRtmDiskSmart.class);
} | [
"public",
"OvhRtmDiskSmart",
"serviceName_statistics_disk_disk_smart_GET",
"(",
"String",
"serviceName",
",",
"String",
"disk",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/dedicated/server/{serviceName}/statistics/disk/{disk}/smart\"",
";",
"StringBuilder",
"... | Get disk smart informations
REST: GET /dedicated/server/{serviceName}/statistics/disk/{disk}/smart
@param serviceName [required] The internal name of your dedicated server
@param disk [required] Disk | [
"Get",
"disk",
"smart",
"informations"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java#L1346-L1351 |
RobAustin/low-latency-primitive-concurrent-queues | src/main/java/uk/co/boundedbuffer/ConcurrentBlockingFloatQueue.java | ConcurrentBlockingFloatQueue.offer | public boolean offer(float value, long timeout, TimeUnit unit)
throws InterruptedException {
// non volatile read ( which is quicker )
final int writeLocation = this.producerWriteLocation;
// sets the nextWriteLocation my moving it on by 1, this may cause it it wrap back to the start.
final int nextWriteLocation = (writeLocation + 1 == capacity) ? 0 : writeLocation + 1;
if (nextWriteLocation == capacity - 1) {
final long timeoutAt = System.nanoTime() + unit.toNanos(timeout);
while (readLocation == 0)
// this condition handles the case where writer has caught up with the read,
// we will wait for a read, ( which will cause a change on the read location )
{
if (!blockAtAdd(timeoutAt))
return false;
}
} else {
final long timeoutAt = System.nanoTime() + unit.toNanos(timeout);
while (nextWriteLocation == readLocation)
// this condition handles the case general case where the read is at the start of the backing array and we are at the end,
// blocks as our backing array is full, we will wait for a read, ( which will cause a change on the read location )
{
if (!blockAtAdd(timeoutAt))
return false;
}
}
// purposely not volatile see the comment below
data[writeLocation] = value;
// the line below, is where the write memory barrier occurs,
// we have just written back the data in the line above ( which is not require to have a memory barrier as we will be doing that in the line below
setWriteLocation(nextWriteLocation);
return true;
} | java | public boolean offer(float value, long timeout, TimeUnit unit)
throws InterruptedException {
// non volatile read ( which is quicker )
final int writeLocation = this.producerWriteLocation;
// sets the nextWriteLocation my moving it on by 1, this may cause it it wrap back to the start.
final int nextWriteLocation = (writeLocation + 1 == capacity) ? 0 : writeLocation + 1;
if (nextWriteLocation == capacity - 1) {
final long timeoutAt = System.nanoTime() + unit.toNanos(timeout);
while (readLocation == 0)
// this condition handles the case where writer has caught up with the read,
// we will wait for a read, ( which will cause a change on the read location )
{
if (!blockAtAdd(timeoutAt))
return false;
}
} else {
final long timeoutAt = System.nanoTime() + unit.toNanos(timeout);
while (nextWriteLocation == readLocation)
// this condition handles the case general case where the read is at the start of the backing array and we are at the end,
// blocks as our backing array is full, we will wait for a read, ( which will cause a change on the read location )
{
if (!blockAtAdd(timeoutAt))
return false;
}
}
// purposely not volatile see the comment below
data[writeLocation] = value;
// the line below, is where the write memory barrier occurs,
// we have just written back the data in the line above ( which is not require to have a memory barrier as we will be doing that in the line below
setWriteLocation(nextWriteLocation);
return true;
} | [
"public",
"boolean",
"offer",
"(",
"float",
"value",
",",
"long",
"timeout",
",",
"TimeUnit",
"unit",
")",
"throws",
"InterruptedException",
"{",
"// non volatile read ( which is quicker )",
"final",
"int",
"writeLocation",
"=",
"this",
".",
"producerWriteLocation",
... | Inserts the specified element into this queue, waiting up to the specified wait time if necessary for
space to become available.
@param value the element to add
@param timeout how long to wait before giving up, in units of <tt>unit</tt>
@param unit a <tt>TimeUnit</tt> determining how to interpret the <tt>timeout</tt> parameter
@return <tt>true</tt> if successful, or <tt>false</tt> if the specified waiting time elapses before
space is available
@throws InterruptedException if interrupted while waiting | [
"Inserts",
"the",
"specified",
"element",
"into",
"this",
"queue",
"waiting",
"up",
"to",
"the",
"specified",
"wait",
"time",
"if",
"necessary",
"for",
"space",
"to",
"become",
"available",
"."
] | train | https://github.com/RobAustin/low-latency-primitive-concurrent-queues/blob/ffcf95a8135750c0b23cd486346a1f68a4724b1c/src/main/java/uk/co/boundedbuffer/ConcurrentBlockingFloatQueue.java#L240-L283 |
pmlopes/yoke | framework/src/main/java/com/jetdrone/vertx/yoke/YokeSecurity.java | YokeSecurity.unsign | public static String unsign(@NotNull String val, @NotNull Mac mac) {
int idx = val.lastIndexOf('.');
if (idx == -1) {
return null;
}
String str = val.substring(0, idx);
if (val.equals(sign(str, mac))) {
return str;
}
return null;
} | java | public static String unsign(@NotNull String val, @NotNull Mac mac) {
int idx = val.lastIndexOf('.');
if (idx == -1) {
return null;
}
String str = val.substring(0, idx);
if (val.equals(sign(str, mac))) {
return str;
}
return null;
} | [
"public",
"static",
"String",
"unsign",
"(",
"@",
"NotNull",
"String",
"val",
",",
"@",
"NotNull",
"Mac",
"mac",
")",
"{",
"int",
"idx",
"=",
"val",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
";",
"if",
"(",
"idx",
"==",
"-",
"1",
")",
"{",
"return"... | Returns the original value is the signature is correct. Null otherwise. | [
"Returns",
"the",
"original",
"value",
"is",
"the",
"signature",
"is",
"correct",
".",
"Null",
"otherwise",
"."
] | train | https://github.com/pmlopes/yoke/blob/fe8a64036f09fb745f0644faddd46162d64faf3c/framework/src/main/java/com/jetdrone/vertx/yoke/YokeSecurity.java#L52-L64 |
apache/flink | flink-libraries/flink-python/src/main/java/org/apache/flink/python/api/streaming/data/PythonDualInputSender.java | PythonDualInputSender.sendBuffer1 | public int sendBuffer1(SingleElementPushBackIterator<IN1> input) throws IOException {
if (serializer1 == null) {
IN1 value = input.next();
serializer1 = getSerializer(value);
input.pushBack(value);
}
return sendBuffer(input, serializer1);
} | java | public int sendBuffer1(SingleElementPushBackIterator<IN1> input) throws IOException {
if (serializer1 == null) {
IN1 value = input.next();
serializer1 = getSerializer(value);
input.pushBack(value);
}
return sendBuffer(input, serializer1);
} | [
"public",
"int",
"sendBuffer1",
"(",
"SingleElementPushBackIterator",
"<",
"IN1",
">",
"input",
")",
"throws",
"IOException",
"{",
"if",
"(",
"serializer1",
"==",
"null",
")",
"{",
"IN1",
"value",
"=",
"input",
".",
"next",
"(",
")",
";",
"serializer1",
"=... | Extracts records from an iterator and writes them to the memory-mapped file. This method assumes that all values
in the iterator are of the same type. This method does NOT take care of synchronization. The caller must
guarantee that the file may be written to before calling this method.
@param input iterator containing records
@return size of the written buffer
@throws IOException | [
"Extracts",
"records",
"from",
"an",
"iterator",
"and",
"writes",
"them",
"to",
"the",
"memory",
"-",
"mapped",
"file",
".",
"This",
"method",
"assumes",
"that",
"all",
"values",
"in",
"the",
"iterator",
"are",
"of",
"the",
"same",
"type",
".",
"This",
"... | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-python/src/main/java/org/apache/flink/python/api/streaming/data/PythonDualInputSender.java#L51-L58 |
salesforce/Argus | ArgusCore/src/main/java/com/salesforce/dva/argus/entity/ServiceManagementRecord.java | ServiceManagementRecord.updateServiceManagementRecord | @Transactional
public static ServiceManagementRecord updateServiceManagementRecord(EntityManager em, ServiceManagementRecord record) {
SystemAssert.requireArgument(em != null, "Entity manager can not be null.");
SystemAssert.requireArgument(record != null, "ServiceManagementRecord cannot be null.");
TypedQuery<ServiceManagementRecord> query = em.createNamedQuery("ServiceManagementRecord.findByService", ServiceManagementRecord.class);
query.setParameter("service", record.getService());
try {
ServiceManagementRecord oldRecord = query.getSingleResult();
oldRecord.setEnabled(record.isEnabled());
return em.merge(oldRecord);
} catch (NoResultException ex) {
return em.merge(record);
}
} | java | @Transactional
public static ServiceManagementRecord updateServiceManagementRecord(EntityManager em, ServiceManagementRecord record) {
SystemAssert.requireArgument(em != null, "Entity manager can not be null.");
SystemAssert.requireArgument(record != null, "ServiceManagementRecord cannot be null.");
TypedQuery<ServiceManagementRecord> query = em.createNamedQuery("ServiceManagementRecord.findByService", ServiceManagementRecord.class);
query.setParameter("service", record.getService());
try {
ServiceManagementRecord oldRecord = query.getSingleResult();
oldRecord.setEnabled(record.isEnabled());
return em.merge(oldRecord);
} catch (NoResultException ex) {
return em.merge(record);
}
} | [
"@",
"Transactional",
"public",
"static",
"ServiceManagementRecord",
"updateServiceManagementRecord",
"(",
"EntityManager",
"em",
",",
"ServiceManagementRecord",
"record",
")",
"{",
"SystemAssert",
".",
"requireArgument",
"(",
"em",
"!=",
"null",
",",
"\"Entity manager ca... | Updates the ServiceManagementRecord entity.
@param em Entity manager. Cannot be null.
@param record serviceManagementRecord object. Cannot be null.
@return updated ServiceManagementRecord entity. | [
"Updates",
"the",
"ServiceManagementRecord",
"entity",
"."
] | train | https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusCore/src/main/java/com/salesforce/dva/argus/entity/ServiceManagementRecord.java#L153-L169 |
stripe/stripe-android | stripe/src/main/java/com/stripe/android/Stripe.java | Stripe.createToken | public void createToken(@NonNull final Card card, @NonNull final TokenCallback callback) {
createToken(card, mDefaultPublishableKey, callback);
} | java | public void createToken(@NonNull final Card card, @NonNull final TokenCallback callback) {
createToken(card, mDefaultPublishableKey, callback);
} | [
"public",
"void",
"createToken",
"(",
"@",
"NonNull",
"final",
"Card",
"card",
",",
"@",
"NonNull",
"final",
"TokenCallback",
"callback",
")",
"{",
"createToken",
"(",
"card",
",",
"mDefaultPublishableKey",
",",
"callback",
")",
";",
"}"
] | The simplest way to create a token, using a {@link Card} and {@link TokenCallback}. This
runs on the default {@link Executor} and with the
currently set {@link #mDefaultPublishableKey}.
@param card the {@link Card} used to create this payment token
@param callback a {@link TokenCallback} to receive either the token or an error | [
"The",
"simplest",
"way",
"to",
"create",
"a",
"token",
"using",
"a",
"{",
"@link",
"Card",
"}",
"and",
"{",
"@link",
"TokenCallback",
"}",
".",
"This",
"runs",
"on",
"the",
"default",
"{",
"@link",
"Executor",
"}",
"and",
"with",
"the",
"currently",
"... | train | https://github.com/stripe/stripe-android/blob/0f199255f3769a3b84583fe3ace47bfae8c3b1c8/stripe/src/main/java/com/stripe/android/Stripe.java#L321-L323 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/main/java/org/deeplearning4j/spark/impl/graph/SparkComputationGraph.java | SparkComputationGraph.doEvaluation | public IEvaluation[] doEvaluation(JavaRDD<String> data, MultiDataSetLoader loader, IEvaluation... emptyEvaluations) {
return doEvaluation(data, DEFAULT_EVAL_WORKERS, DEFAULT_EVAL_SCORE_BATCH_SIZE, null, loader, emptyEvaluations);
} | java | public IEvaluation[] doEvaluation(JavaRDD<String> data, MultiDataSetLoader loader, IEvaluation... emptyEvaluations) {
return doEvaluation(data, DEFAULT_EVAL_WORKERS, DEFAULT_EVAL_SCORE_BATCH_SIZE, null, loader, emptyEvaluations);
} | [
"public",
"IEvaluation",
"[",
"]",
"doEvaluation",
"(",
"JavaRDD",
"<",
"String",
">",
"data",
",",
"MultiDataSetLoader",
"loader",
",",
"IEvaluation",
"...",
"emptyEvaluations",
")",
"{",
"return",
"doEvaluation",
"(",
"data",
",",
"DEFAULT_EVAL_WORKERS",
",",
... | Perform evaluation on serialized MultiDataSet objects on disk, (potentially in any format), that are loaded using an {@link MultiDataSetLoader}.<br>
Uses the default number of workers (model replicas per JVM) of {@link #DEFAULT_EVAL_WORKERS} with the default
minibatch size of {@link #DEFAULT_EVAL_SCORE_BATCH_SIZE}
@param data List of paths to the data (that can be loaded as / converted to DataSets)
@param loader Used to load MultiDataSets from their paths
@param emptyEvaluations Evaluations to perform
@return Evaluation | [
"Perform",
"evaluation",
"on",
"serialized",
"MultiDataSet",
"objects",
"on",
"disk",
"(",
"potentially",
"in",
"any",
"format",
")",
"that",
"are",
"loaded",
"using",
"an",
"{"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/main/java/org/deeplearning4j/spark/impl/graph/SparkComputationGraph.java#L894-L896 |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/fixed/CommonOps_DDF3.java | CommonOps_DDF3.elementDiv | public static void elementDiv( DMatrix3 a , DMatrix3 b , DMatrix3 c ) {
c.a1 = a.a1/b.a1;
c.a2 = a.a2/b.a2;
c.a3 = a.a3/b.a3;
} | java | public static void elementDiv( DMatrix3 a , DMatrix3 b , DMatrix3 c ) {
c.a1 = a.a1/b.a1;
c.a2 = a.a2/b.a2;
c.a3 = a.a3/b.a3;
} | [
"public",
"static",
"void",
"elementDiv",
"(",
"DMatrix3",
"a",
",",
"DMatrix3",
"b",
",",
"DMatrix3",
"c",
")",
"{",
"c",
".",
"a1",
"=",
"a",
".",
"a1",
"/",
"b",
".",
"a1",
";",
"c",
".",
"a2",
"=",
"a",
".",
"a2",
"/",
"b",
".",
"a2",
"... | <p>Performs an element by element division operation:<br>
<br>
c<sub>i</sub> = a<sub>i</sub> / b<sub>i</sub> <br>
</p>
@param a The left vector in the division operation. Not modified.
@param b The right vector in the division operation. Not modified.
@param c Where the results of the operation are stored. Modified. | [
"<p",
">",
"Performs",
"an",
"element",
"by",
"element",
"division",
"operation",
":",
"<br",
">",
"<br",
">",
"c<sub",
">",
"i<",
"/",
"sub",
">",
"=",
"a<sub",
">",
"i<",
"/",
"sub",
">",
"/",
"b<sub",
">",
"i<",
"/",
"sub",
">",
"<br",
">",
... | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/fixed/CommonOps_DDF3.java#L1141-L1145 |
lessthanoptimal/BoofCV | main/boofcv-calibration/src/main/java/boofcv/alg/geo/selfcalib/SelfCalibrationGuessAndCheckFocus.java | SelfCalibrationGuessAndCheckFocus.computeRectifyH | boolean computeRectifyH( double f1 , double f2 , DMatrixRMaj P2, DMatrixRMaj H ) {
estimatePlaneInf.setCamera1(f1,f1,0,0,0);
estimatePlaneInf.setCamera2(f2,f2,0,0,0);
if( !estimatePlaneInf.estimatePlaneAtInfinity(P2,planeInf) )
return false;
// TODO add a cost for distance from nominal and scale other cost by focal length fx for each view
// RefineDualQuadraticConstraint refine = new RefineDualQuadraticConstraint();
// refine.setZeroSkew(true);
// refine.setAspectRatio(true);
// refine.setZeroPrinciplePoint(true);
// refine.setKnownIntrinsic1(true);
// refine.setFixedCamera(false);
//
// CameraPinhole intrinsic = new CameraPinhole(f1,f1,0,0,0,0,0);
// if( !refine.refine(normalizedP.toList(),intrinsic,planeInf))
// return false;
K1.zero();
K1.set(0,0,f1);
K1.set(1,1,f1);
K1.set(2,2,1);
MultiViewOps.createProjectiveToMetric(K1,planeInf.x,planeInf.y,planeInf.z,1,H);
return true;
} | java | boolean computeRectifyH( double f1 , double f2 , DMatrixRMaj P2, DMatrixRMaj H ) {
estimatePlaneInf.setCamera1(f1,f1,0,0,0);
estimatePlaneInf.setCamera2(f2,f2,0,0,0);
if( !estimatePlaneInf.estimatePlaneAtInfinity(P2,planeInf) )
return false;
// TODO add a cost for distance from nominal and scale other cost by focal length fx for each view
// RefineDualQuadraticConstraint refine = new RefineDualQuadraticConstraint();
// refine.setZeroSkew(true);
// refine.setAspectRatio(true);
// refine.setZeroPrinciplePoint(true);
// refine.setKnownIntrinsic1(true);
// refine.setFixedCamera(false);
//
// CameraPinhole intrinsic = new CameraPinhole(f1,f1,0,0,0,0,0);
// if( !refine.refine(normalizedP.toList(),intrinsic,planeInf))
// return false;
K1.zero();
K1.set(0,0,f1);
K1.set(1,1,f1);
K1.set(2,2,1);
MultiViewOps.createProjectiveToMetric(K1,planeInf.x,planeInf.y,planeInf.z,1,H);
return true;
} | [
"boolean",
"computeRectifyH",
"(",
"double",
"f1",
",",
"double",
"f2",
",",
"DMatrixRMaj",
"P2",
",",
"DMatrixRMaj",
"H",
")",
"{",
"estimatePlaneInf",
".",
"setCamera1",
"(",
"f1",
",",
"f1",
",",
"0",
",",
"0",
",",
"0",
")",
";",
"estimatePlaneInf",
... | Given the focal lengths for the first two views compute homography H
@param f1 view 1 focal length
@param f2 view 2 focal length
@param P2 projective camera matrix for view 2
@param H (Output) homography
@return true if successful | [
"Given",
"the",
"focal",
"lengths",
"for",
"the",
"first",
"two",
"views",
"compute",
"homography",
"H"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-calibration/src/main/java/boofcv/alg/geo/selfcalib/SelfCalibrationGuessAndCheckFocus.java#L302-L329 |
belaban/JGroups | src/org/jgroups/blocks/MessageDispatcher.java | MessageDispatcher.sendMessage | public <T> T sendMessage(Address dest, byte[] data, int offset, int length, RequestOptions opts) throws Exception {
return sendMessage(dest, new Buffer(data, offset, length), opts);
} | java | public <T> T sendMessage(Address dest, byte[] data, int offset, int length, RequestOptions opts) throws Exception {
return sendMessage(dest, new Buffer(data, offset, length), opts);
} | [
"public",
"<",
"T",
">",
"T",
"sendMessage",
"(",
"Address",
"dest",
",",
"byte",
"[",
"]",
"data",
",",
"int",
"offset",
",",
"int",
"length",
",",
"RequestOptions",
"opts",
")",
"throws",
"Exception",
"{",
"return",
"sendMessage",
"(",
"dest",
",",
"... | Sends a unicast message and - depending on the options - returns a result
@param dest the target to which to send the unicast message. Must not be null.
@param data the payload to send
@param offset the offset at which the data starts
@param length the number of bytes to send
@param opts the options to be used
@return T the result. Null if the call is asynchronous (non-blocking) or if the response is null
@throws Exception If there was problem sending the request, processing it at the receiver, or processing
it at the sender.
@throws TimeoutException If the call didn't succeed within the timeout defined in options (if set) | [
"Sends",
"a",
"unicast",
"message",
"and",
"-",
"depending",
"on",
"the",
"options",
"-",
"returns",
"a",
"result"
] | train | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/blocks/MessageDispatcher.java#L344-L346 |
box/box-java-sdk | src/main/java/com/box/sdk/BoxConfig.java | BoxConfig.readFrom | public static BoxConfig readFrom(Reader reader) throws IOException {
JsonObject config = JsonObject.readFrom(reader);
JsonObject settings = (JsonObject) config.get("boxAppSettings");
String clientId = settings.get("clientID").asString();
String clientSecret = settings.get("clientSecret").asString();
JsonObject appAuth = (JsonObject) settings.get("appAuth");
String publicKeyId = appAuth.get("publicKeyID").asString();
String privateKey = appAuth.get("privateKey").asString();
String passphrase = appAuth.get("passphrase").asString();
String enterpriseId = config.get("enterpriseID").asString();
return new BoxConfig(clientId, clientSecret, enterpriseId, publicKeyId, privateKey, passphrase);
} | java | public static BoxConfig readFrom(Reader reader) throws IOException {
JsonObject config = JsonObject.readFrom(reader);
JsonObject settings = (JsonObject) config.get("boxAppSettings");
String clientId = settings.get("clientID").asString();
String clientSecret = settings.get("clientSecret").asString();
JsonObject appAuth = (JsonObject) settings.get("appAuth");
String publicKeyId = appAuth.get("publicKeyID").asString();
String privateKey = appAuth.get("privateKey").asString();
String passphrase = appAuth.get("passphrase").asString();
String enterpriseId = config.get("enterpriseID").asString();
return new BoxConfig(clientId, clientSecret, enterpriseId, publicKeyId, privateKey, passphrase);
} | [
"public",
"static",
"BoxConfig",
"readFrom",
"(",
"Reader",
"reader",
")",
"throws",
"IOException",
"{",
"JsonObject",
"config",
"=",
"JsonObject",
".",
"readFrom",
"(",
"reader",
")",
";",
"JsonObject",
"settings",
"=",
"(",
"JsonObject",
")",
"config",
".",
... | Reads OAuth 2.0 with JWT app configurations from the reader. The file should be in JSON format.
@param reader a reader object which points to a JSON formatted configuration file
@return a new Instance of BoxConfig
@throws IOException when unable to access the mapping file's content of the reader | [
"Reads",
"OAuth",
"2",
".",
"0",
"with",
"JWT",
"app",
"configurations",
"from",
"the",
"reader",
".",
"The",
"file",
"should",
"be",
"in",
"JSON",
"format",
"."
] | train | https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/BoxConfig.java#L98-L109 |
micronaut-projects/micronaut-core | jdbc/src/main/java/io/micronaut/jdbc/CalculatedSettings.java | CalculatedSettings.getUrl | public String getUrl() {
final String url = basicJdbcConfiguration.getConfiguredUrl();
if (calculatedUrl == null || StringUtils.hasText(url)) {
calculatedUrl = url;
if (!StringUtils.hasText(calculatedUrl) && embeddedDatabaseConnection.isPresent()) {
calculatedUrl = embeddedDatabaseConnection.get().getUrl(basicJdbcConfiguration.getName());
}
if (!StringUtils.hasText(calculatedUrl)) {
throw new ConfigurationException(String.format("Error configuring data source '%s'. No URL specified", basicJdbcConfiguration.getName()));
}
}
return calculatedUrl;
} | java | public String getUrl() {
final String url = basicJdbcConfiguration.getConfiguredUrl();
if (calculatedUrl == null || StringUtils.hasText(url)) {
calculatedUrl = url;
if (!StringUtils.hasText(calculatedUrl) && embeddedDatabaseConnection.isPresent()) {
calculatedUrl = embeddedDatabaseConnection.get().getUrl(basicJdbcConfiguration.getName());
}
if (!StringUtils.hasText(calculatedUrl)) {
throw new ConfigurationException(String.format("Error configuring data source '%s'. No URL specified", basicJdbcConfiguration.getName()));
}
}
return calculatedUrl;
} | [
"public",
"String",
"getUrl",
"(",
")",
"{",
"final",
"String",
"url",
"=",
"basicJdbcConfiguration",
".",
"getConfiguredUrl",
"(",
")",
";",
"if",
"(",
"calculatedUrl",
"==",
"null",
"||",
"StringUtils",
".",
"hasText",
"(",
"url",
")",
")",
"{",
"calcula... | Determines the URL based on the configured value. If the URL is
not configured, search for an embedded database driver on the
classpath and retrieve a default URL for it.
@return The calculated URL | [
"Determines",
"the",
"URL",
"based",
"on",
"the",
"configured",
"value",
".",
"If",
"the",
"URL",
"is",
"not",
"configured",
"search",
"for",
"an",
"embedded",
"database",
"driver",
"on",
"the",
"classpath",
"and",
"retrieve",
"a",
"default",
"URL",
"for",
... | train | https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/jdbc/src/main/java/io/micronaut/jdbc/CalculatedSettings.java#L101-L114 |
j-a-w-r/jawr-main-repo | jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/postprocess/impl/css/base64/Base64ImageEncoderPostProcessor.java | Base64ImageEncoderPostProcessor.prependBase64EncodedResources | protected void prependBase64EncodedResources(StringBuffer sb, Map<String, Base64EncodedResource> encodedImages) {
Iterator<Entry<String, Base64EncodedResource>> it = encodedImages.entrySet().iterator();
StringBuilder mhtml = new StringBuilder();
String lineSeparator = StringUtils.STR_LINE_FEED;
mhtml.append("/*!").append(lineSeparator);
mhtml.append("Content-Type: multipart/related; boundary=\"" + BOUNDARY_SEPARATOR + "\"").append(lineSeparator)
.append(lineSeparator);
while (it.hasNext()) {
Entry<String, Base64EncodedResource> pair = it.next();
Base64EncodedResource encodedResource = (Base64EncodedResource) pair.getValue();
mhtml.append(BOUNDARY_SEPARATOR_PREFIX + BOUNDARY_SEPARATOR).append(lineSeparator);
mhtml.append("Content-Type:").append(encodedResource.getType()).append(lineSeparator);
mhtml.append("Content-Location:").append(encodedResource.getId()).append(lineSeparator);
mhtml.append("Content-Transfer-Encoding:base64").append(lineSeparator).append(lineSeparator);
mhtml.append(encodedResource.getBase64Encoding()).append(lineSeparator).append(lineSeparator);
}
mhtml.append(BOUNDARY_SEPARATOR_PREFIX + BOUNDARY_SEPARATOR + BOUNDARY_SEPARATOR_PREFIX).append(lineSeparator);
mhtml.append("*/").append(lineSeparator).append(lineSeparator);
sb.insert(0, mhtml.toString());
} | java | protected void prependBase64EncodedResources(StringBuffer sb, Map<String, Base64EncodedResource> encodedImages) {
Iterator<Entry<String, Base64EncodedResource>> it = encodedImages.entrySet().iterator();
StringBuilder mhtml = new StringBuilder();
String lineSeparator = StringUtils.STR_LINE_FEED;
mhtml.append("/*!").append(lineSeparator);
mhtml.append("Content-Type: multipart/related; boundary=\"" + BOUNDARY_SEPARATOR + "\"").append(lineSeparator)
.append(lineSeparator);
while (it.hasNext()) {
Entry<String, Base64EncodedResource> pair = it.next();
Base64EncodedResource encodedResource = (Base64EncodedResource) pair.getValue();
mhtml.append(BOUNDARY_SEPARATOR_PREFIX + BOUNDARY_SEPARATOR).append(lineSeparator);
mhtml.append("Content-Type:").append(encodedResource.getType()).append(lineSeparator);
mhtml.append("Content-Location:").append(encodedResource.getId()).append(lineSeparator);
mhtml.append("Content-Transfer-Encoding:base64").append(lineSeparator).append(lineSeparator);
mhtml.append(encodedResource.getBase64Encoding()).append(lineSeparator).append(lineSeparator);
}
mhtml.append(BOUNDARY_SEPARATOR_PREFIX + BOUNDARY_SEPARATOR + BOUNDARY_SEPARATOR_PREFIX).append(lineSeparator);
mhtml.append("*/").append(lineSeparator).append(lineSeparator);
sb.insert(0, mhtml.toString());
} | [
"protected",
"void",
"prependBase64EncodedResources",
"(",
"StringBuffer",
"sb",
",",
"Map",
"<",
"String",
",",
"Base64EncodedResource",
">",
"encodedImages",
")",
"{",
"Iterator",
"<",
"Entry",
"<",
"String",
",",
"Base64EncodedResource",
">",
">",
"it",
"=",
... | Prepend the base64 encoded resources to the bundle data
@param sb
the string buffer containing the processed bundle data
@param encodedImages
a map of encoded images | [
"Prepend",
"the",
"base64",
"encoded",
"resources",
"to",
"the",
"bundle",
"data"
] | train | https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/postprocess/impl/css/base64/Base64ImageEncoderPostProcessor.java#L152-L173 |
lightblueseas/vintage-time | src/main/java/de/alpharogroup/date/CalculateDateExtensions.java | CalculateDateExtensions.substractDaysFromDate | public static Date substractDaysFromDate(final Date date, final int substractDays)
{
final Calendar dateOnCalendar = Calendar.getInstance();
dateOnCalendar.setTime(date);
dateOnCalendar.add(Calendar.DATE, substractDays * -1);
return dateOnCalendar.getTime();
} | java | public static Date substractDaysFromDate(final Date date, final int substractDays)
{
final Calendar dateOnCalendar = Calendar.getInstance();
dateOnCalendar.setTime(date);
dateOnCalendar.add(Calendar.DATE, substractDays * -1);
return dateOnCalendar.getTime();
} | [
"public",
"static",
"Date",
"substractDaysFromDate",
"(",
"final",
"Date",
"date",
",",
"final",
"int",
"substractDays",
")",
"{",
"final",
"Calendar",
"dateOnCalendar",
"=",
"Calendar",
".",
"getInstance",
"(",
")",
";",
"dateOnCalendar",
".",
"setTime",
"(",
... | Substract days to the given Date object and returns it.
@param date
The Date object to substract the days.
@param substractDays
The days to substract.
@return The resulted Date object. | [
"Substract",
"days",
"to",
"the",
"given",
"Date",
"object",
"and",
"returns",
"it",
"."
] | train | https://github.com/lightblueseas/vintage-time/blob/fbf201e679d9f9b92e7b5771f3eea1413cc2e113/src/main/java/de/alpharogroup/date/CalculateDateExtensions.java#L388-L394 |
eduarddrenth/ConfigurableReports | src/main/java/com/vectorprint/report/itext/BaseReportGenerator.java | BaseReportGenerator.handleException | protected int handleException(Exception ex, OutputStream output) throws VectorPrintRuntimeException {
if (getSettings().getBooleanProperty(Boolean.TRUE, ReportConstants.STOPONERROR)) {
throw (ex instanceof VectorPrintRuntimeException)
? (VectorPrintRuntimeException) ex
: new VectorPrintRuntimeException("failed to generate the report: " + ex.getMessage(), ex);
} else {
PrintStream out;
ByteArrayOutputStream bo = new ByteArrayOutputStream();
out = new PrintStream(bo);
ex.printStackTrace(out);
out.close();
try {
Font f = FontFactory.getFont(FontFactory.COURIER, 8);
f.setColor(itextHelper.fromColor(getSettings().getColorProperty(Color.MAGENTA, "debugcolor")));
String s = getSettings().getProperty(bo.toString(), "renderfault");
eventHelper.setLastPage(writer.getCurrentPageNumber());
document.setPageSize(new Rectangle(ItextHelper.mmToPts(297), ItextHelper.mmToPts(210)));
document.setMargins(5, 5, 5, 5);
document.newPage();
eventHelper.setFailuresHereAfter(true);
document.add(new Chunk("Below you find information that help solving the problems in this report.", f).setLocalDestination(FAILUREPAGE));
newLine();
document.add(new Paragraph(new Chunk(s, f)));
document.newPage();
DebugHelper.appendDebugInfo(writer, document, settings, stylerFactory);
} catch (VectorPrintException | DocumentException e) {
log.severe("Could not append to PDF:\n" + bo.toString());
log.log(java.util.logging.Level.SEVERE, null, e);
} finally {
document.close();
writer.close();
}
}
return ERRORINREPORT;
} | java | protected int handleException(Exception ex, OutputStream output) throws VectorPrintRuntimeException {
if (getSettings().getBooleanProperty(Boolean.TRUE, ReportConstants.STOPONERROR)) {
throw (ex instanceof VectorPrintRuntimeException)
? (VectorPrintRuntimeException) ex
: new VectorPrintRuntimeException("failed to generate the report: " + ex.getMessage(), ex);
} else {
PrintStream out;
ByteArrayOutputStream bo = new ByteArrayOutputStream();
out = new PrintStream(bo);
ex.printStackTrace(out);
out.close();
try {
Font f = FontFactory.getFont(FontFactory.COURIER, 8);
f.setColor(itextHelper.fromColor(getSettings().getColorProperty(Color.MAGENTA, "debugcolor")));
String s = getSettings().getProperty(bo.toString(), "renderfault");
eventHelper.setLastPage(writer.getCurrentPageNumber());
document.setPageSize(new Rectangle(ItextHelper.mmToPts(297), ItextHelper.mmToPts(210)));
document.setMargins(5, 5, 5, 5);
document.newPage();
eventHelper.setFailuresHereAfter(true);
document.add(new Chunk("Below you find information that help solving the problems in this report.", f).setLocalDestination(FAILUREPAGE));
newLine();
document.add(new Paragraph(new Chunk(s, f)));
document.newPage();
DebugHelper.appendDebugInfo(writer, document, settings, stylerFactory);
} catch (VectorPrintException | DocumentException e) {
log.severe("Could not append to PDF:\n" + bo.toString());
log.log(java.util.logging.Level.SEVERE, null, e);
} finally {
document.close();
writer.close();
}
}
return ERRORINREPORT;
} | [
"protected",
"int",
"handleException",
"(",
"Exception",
"ex",
",",
"OutputStream",
"output",
")",
"throws",
"VectorPrintRuntimeException",
"{",
"if",
"(",
"getSettings",
"(",
")",
".",
"getBooleanProperty",
"(",
"Boolean",
".",
"TRUE",
",",
"ReportConstants",
"."... | This method will be called when exceptions are thrown in
{@link #createReportBody(com.itextpdf.text.Document, com.vectorprint.report.data.ReportDataHolder)} or
{@link DebugHelper#appendDebugInfo(com.itextpdf.text.pdf.PdfWriter, com.itextpdf.text.Document, com.vectorprint.configuration.EnhancedMap, com.vectorprint.report.itext.style.StylerFactory) },
it will rethrow the exception by default. If you provide a property {@link ReportConstants#STOPONERROR} with a
value of false, the stacktrace will be appended to the pdf and the document and writer will be closed.
@param ex
@param output the pdf document output stream
@return 1 | [
"This",
"method",
"will",
"be",
"called",
"when",
"exceptions",
"are",
"thrown",
"in",
"{",
"@link",
"#createReportBody",
"(",
"com",
".",
"itextpdf",
".",
"text",
".",
"Document",
"com",
".",
"vectorprint",
".",
"report",
".",
"data",
".",
"ReportDataHolder... | train | https://github.com/eduarddrenth/ConfigurableReports/blob/b5fb7a89e16d9b35f557f3bf620594f821fa1552/src/main/java/com/vectorprint/report/itext/BaseReportGenerator.java#L279-L321 |
pravega/pravega | common/src/main/java/io/pravega/common/util/BitConverter.java | BitConverter.writeLong | public static int writeLong(byte[] target, int offset, long value) {
target[offset] = (byte) (value >>> 56);
target[offset + 1] = (byte) (value >>> 48);
target[offset + 2] = (byte) (value >>> 40);
target[offset + 3] = (byte) (value >>> 32);
target[offset + 4] = (byte) (value >>> 24);
target[offset + 5] = (byte) (value >>> 16);
target[offset + 6] = (byte) (value >>> 8);
target[offset + 7] = (byte) value;
return Long.BYTES;
} | java | public static int writeLong(byte[] target, int offset, long value) {
target[offset] = (byte) (value >>> 56);
target[offset + 1] = (byte) (value >>> 48);
target[offset + 2] = (byte) (value >>> 40);
target[offset + 3] = (byte) (value >>> 32);
target[offset + 4] = (byte) (value >>> 24);
target[offset + 5] = (byte) (value >>> 16);
target[offset + 6] = (byte) (value >>> 8);
target[offset + 7] = (byte) value;
return Long.BYTES;
} | [
"public",
"static",
"int",
"writeLong",
"(",
"byte",
"[",
"]",
"target",
",",
"int",
"offset",
",",
"long",
"value",
")",
"{",
"target",
"[",
"offset",
"]",
"=",
"(",
"byte",
")",
"(",
"value",
">>>",
"56",
")",
";",
"target",
"[",
"offset",
"+",
... | Writes the given 64-bit Long to the given byte array at the given offset.
@param target The byte array to write to.
@param offset The offset within the byte array to write at.
@param value The value to write.
@return The number of bytes written. | [
"Writes",
"the",
"given",
"64",
"-",
"bit",
"Long",
"to",
"the",
"given",
"byte",
"array",
"at",
"the",
"given",
"offset",
"."
] | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/util/BitConverter.java#L183-L193 |
xiaosunzhu/resource-utils | src/main/java/net/sunyijun/resource/config/Configs.java | Configs.getSelfConfig | public static String getSelfConfig(String configAbsoluteClassPath, IConfigKey key) {
OneProperties configs = otherConfigs.get(configAbsoluteClassPath);
if (configs == null) {
addSelfConfigs(configAbsoluteClassPath, null);
configs = otherConfigs.get(configAbsoluteClassPath);
if (configs == null) {
return VOID_CONFIGS.getConfig(key);
}
}
return configs.getConfig(key);
} | java | public static String getSelfConfig(String configAbsoluteClassPath, IConfigKey key) {
OneProperties configs = otherConfigs.get(configAbsoluteClassPath);
if (configs == null) {
addSelfConfigs(configAbsoluteClassPath, null);
configs = otherConfigs.get(configAbsoluteClassPath);
if (configs == null) {
return VOID_CONFIGS.getConfig(key);
}
}
return configs.getConfig(key);
} | [
"public",
"static",
"String",
"getSelfConfig",
"(",
"String",
"configAbsoluteClassPath",
",",
"IConfigKey",
"key",
")",
"{",
"OneProperties",
"configs",
"=",
"otherConfigs",
".",
"get",
"(",
"configAbsoluteClassPath",
")",
";",
"if",
"(",
"configs",
"==",
"null",
... | Get self config string.
@param configAbsoluteClassPath config path.
@param key config key in configAbsoluteClassPath config file
@return config value string. Return null if not add config file or not config in config file.
@see #addSelfConfigs(String, OneProperties) | [
"Get",
"self",
"config",
"string",
"."
] | train | https://github.com/xiaosunzhu/resource-utils/blob/4f2bf3f36df10195a978f122ed682ba1eb0462b5/src/main/java/net/sunyijun/resource/config/Configs.java#L205-L215 |
gallandarakhneorg/afc | advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/mapelement/MapComposedElement.java | MapComposedElement.setPointAt | public boolean setPointAt(int groupIndex, int indexInGroup, double x, double y, boolean canonize) {
final int startIndex = firstInGroup(groupIndex);
// Besure that the member's index is in the group index's range
final int groupMemberCount = getPointCountInGroup(groupIndex);
if (indexInGroup < 0) {
throw new IndexOutOfBoundsException(indexInGroup + "<0"); //$NON-NLS-1$
}
if (indexInGroup >= groupMemberCount) {
throw new IndexOutOfBoundsException(indexInGroup + ">=" + groupMemberCount); //$NON-NLS-1$
}
final PointFusionValidator validator = getPointFusionValidator();
final int idx1 = startIndex + indexInGroup * 2;
final int idx2 = idx1 + 1;
if (!validator.isSame(x, y, this.pointCoordinates[idx1], this.pointCoordinates[idx2])) {
this.pointCoordinates[idx1] = x;
this.pointCoordinates[idx2] = y;
if (canonize) {
canonize(idx1 / 2);
}
fireShapeChanged();
fireElementChanged();
return true;
}
return false;
} | java | public boolean setPointAt(int groupIndex, int indexInGroup, double x, double y, boolean canonize) {
final int startIndex = firstInGroup(groupIndex);
// Besure that the member's index is in the group index's range
final int groupMemberCount = getPointCountInGroup(groupIndex);
if (indexInGroup < 0) {
throw new IndexOutOfBoundsException(indexInGroup + "<0"); //$NON-NLS-1$
}
if (indexInGroup >= groupMemberCount) {
throw new IndexOutOfBoundsException(indexInGroup + ">=" + groupMemberCount); //$NON-NLS-1$
}
final PointFusionValidator validator = getPointFusionValidator();
final int idx1 = startIndex + indexInGroup * 2;
final int idx2 = idx1 + 1;
if (!validator.isSame(x, y, this.pointCoordinates[idx1], this.pointCoordinates[idx2])) {
this.pointCoordinates[idx1] = x;
this.pointCoordinates[idx2] = y;
if (canonize) {
canonize(idx1 / 2);
}
fireShapeChanged();
fireElementChanged();
return true;
}
return false;
} | [
"public",
"boolean",
"setPointAt",
"(",
"int",
"groupIndex",
",",
"int",
"indexInGroup",
",",
"double",
"x",
",",
"double",
"y",
",",
"boolean",
"canonize",
")",
"{",
"final",
"int",
"startIndex",
"=",
"firstInGroup",
"(",
"groupIndex",
")",
";",
"// Besure ... | Set the specified point at the given index in the specified group.
@param groupIndex is the index of the group
@param indexInGroup is the index of the ponit in the group (0 for the
first point of the group...).
@param x is the new value.
@param y is the new value.
@param canonize indicates if the function {@link #canonize(int)} must be called.
@return <code>true</code> if the point was set, <code>false</code> if
the specified coordinates correspond to the already existing point.
@throws IndexOutOfBoundsException in case of error. | [
"Set",
"the",
"specified",
"point",
"at",
"the",
"given",
"index",
"in",
"the",
"specified",
"group",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/mapelement/MapComposedElement.java#L1025-L1054 |
Azure/azure-sdk-for-java | compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/implementation/LogAnalyticsInner.java | LogAnalyticsInner.beginExportThrottledRequests | public LogAnalyticsOperationResultInner beginExportThrottledRequests(String location, ThrottledRequestsInput parameters) {
return beginExportThrottledRequestsWithServiceResponseAsync(location, parameters).toBlocking().single().body();
} | java | public LogAnalyticsOperationResultInner beginExportThrottledRequests(String location, ThrottledRequestsInput parameters) {
return beginExportThrottledRequestsWithServiceResponseAsync(location, parameters).toBlocking().single().body();
} | [
"public",
"LogAnalyticsOperationResultInner",
"beginExportThrottledRequests",
"(",
"String",
"location",
",",
"ThrottledRequestsInput",
"parameters",
")",
"{",
"return",
"beginExportThrottledRequestsWithServiceResponseAsync",
"(",
"location",
",",
"parameters",
")",
".",
"toBlo... | Export logs that show total throttled Api requests for this subscription in the given time window.
@param location The location upon which virtual-machine-sizes is queried.
@param parameters Parameters supplied to the LogAnalytics getThrottledRequests Api.
@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 LogAnalyticsOperationResultInner object if successful. | [
"Export",
"logs",
"that",
"show",
"total",
"throttled",
"Api",
"requests",
"for",
"this",
"subscription",
"in",
"the",
"given",
"time",
"window",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/implementation/LogAnalyticsInner.java#L314-L316 |
ksclarke/freelib-utils | src/main/java/info/freelibrary/util/XMLResourceBundle.java | XMLResourceBundle.get | public String get(final String aMessage, final String... aArray) {
return StringUtils.format(super.getString(aMessage), aArray);
} | java | public String get(final String aMessage, final String... aArray) {
return StringUtils.format(super.getString(aMessage), aArray);
} | [
"public",
"String",
"get",
"(",
"final",
"String",
"aMessage",
",",
"final",
"String",
"...",
"aArray",
")",
"{",
"return",
"StringUtils",
".",
"format",
"(",
"super",
".",
"getString",
"(",
"aMessage",
")",
",",
"aArray",
")",
";",
"}"
] | Return a message value with the supplied values integrated into it.
@param aMessage A message in which to include the supplied string values
@param aArray The string values to insert into the supplied message
@return A message with the supplied values integrated into it | [
"Return",
"a",
"message",
"value",
"with",
"the",
"supplied",
"values",
"integrated",
"into",
"it",
"."
] | train | https://github.com/ksclarke/freelib-utils/blob/54e822ae4c11b3d74793fd82a1a535ffafffaf45/src/main/java/info/freelibrary/util/XMLResourceBundle.java#L91-L93 |
steveash/jopenfst | src/main/java/com/github/steveash/jopenfst/operations/Compose.java | Compose.precomputeInner | public static PrecomputedComposeFst precomputeInner(Fst fst2, Semiring semiring) {
fst2.throwIfInvalid();
MutableFst mutableFst = MutableFst.copyFrom(fst2);
WriteableSymbolTable table = mutableFst.getInputSymbols();
int e1index = getOrAddEps(table, true);
int e2index = getOrAddEps(table, false);
String eps1 = table.invert().keyForId(e1index);
String eps2 = table.invert().keyForId(e2index);
augment(AugmentLabels.INPUT, mutableFst, semiring, eps1, eps2);
ArcSort.sortByInput(mutableFst);
MutableFst filter = makeFilter(table, semiring, eps1, eps2);
ArcSort.sortByInput(filter);
return new PrecomputedComposeFst(eps1, eps2, new ImmutableFst(mutableFst), semiring, new ImmutableFst(filter));
} | java | public static PrecomputedComposeFst precomputeInner(Fst fst2, Semiring semiring) {
fst2.throwIfInvalid();
MutableFst mutableFst = MutableFst.copyFrom(fst2);
WriteableSymbolTable table = mutableFst.getInputSymbols();
int e1index = getOrAddEps(table, true);
int e2index = getOrAddEps(table, false);
String eps1 = table.invert().keyForId(e1index);
String eps2 = table.invert().keyForId(e2index);
augment(AugmentLabels.INPUT, mutableFst, semiring, eps1, eps2);
ArcSort.sortByInput(mutableFst);
MutableFst filter = makeFilter(table, semiring, eps1, eps2);
ArcSort.sortByInput(filter);
return new PrecomputedComposeFst(eps1, eps2, new ImmutableFst(mutableFst), semiring, new ImmutableFst(filter));
} | [
"public",
"static",
"PrecomputedComposeFst",
"precomputeInner",
"(",
"Fst",
"fst2",
",",
"Semiring",
"semiring",
")",
"{",
"fst2",
".",
"throwIfInvalid",
"(",
")",
";",
"MutableFst",
"mutableFst",
"=",
"MutableFst",
".",
"copyFrom",
"(",
"fst2",
")",
";",
"Wri... | Pre-processes a FST that is going to be used on the right hand side of a compose operator many times
@param fst2 the fst that will appear on the right hand side
@param semiring the semiring that will be used for the compose operation
@return a pre-processed form of the inner fst that can be passed to `composeWithPrecomputed` | [
"Pre",
"-",
"processes",
"a",
"FST",
"that",
"is",
"going",
"to",
"be",
"used",
"on",
"the",
"right",
"hand",
"side",
"of",
"a",
"compose",
"operator",
"many",
"times"
] | train | https://github.com/steveash/jopenfst/blob/4c675203015c1cfad2072556cb532b6edc73261d/src/main/java/com/github/steveash/jopenfst/operations/Compose.java#L62-L77 |
Impetus/Kundera | src/jpa-engine/core/src/main/java/com/impetus/kundera/query/KunderaQuery.java | KunderaQuery.filterJPAParameterInfo | private void filterJPAParameterInfo(Type type, String name, String fieldName) {
String attributeName = getAttributeName(fieldName);
Attribute entityAttribute =
((MetamodelImpl) kunderaMetadata.getApplicationMetadata().getMetamodel(persistenceUnit))
.getEntityAttribute(entityClass, attributeName);
Class fieldType = entityAttribute.getJavaType();
if (type.equals(Type.INDEXED)) {
typedParameter.addJPAParameter(new JPAParameter(null, Integer.valueOf(name), fieldType));
} else {
typedParameter.addJPAParameter(new JPAParameter(name, null, fieldType));
}
} | java | private void filterJPAParameterInfo(Type type, String name, String fieldName) {
String attributeName = getAttributeName(fieldName);
Attribute entityAttribute =
((MetamodelImpl) kunderaMetadata.getApplicationMetadata().getMetamodel(persistenceUnit))
.getEntityAttribute(entityClass, attributeName);
Class fieldType = entityAttribute.getJavaType();
if (type.equals(Type.INDEXED)) {
typedParameter.addJPAParameter(new JPAParameter(null, Integer.valueOf(name), fieldType));
} else {
typedParameter.addJPAParameter(new JPAParameter(name, null, fieldType));
}
} | [
"private",
"void",
"filterJPAParameterInfo",
"(",
"Type",
"type",
",",
"String",
"name",
",",
"String",
"fieldName",
")",
"{",
"String",
"attributeName",
"=",
"getAttributeName",
"(",
"fieldName",
")",
";",
"Attribute",
"entityAttribute",
"=",
"(",
"(",
"Metamod... | Filter jpa parameter info.
@param type
the type
@param name
the name
@param fieldName
the field name | [
"Filter",
"jpa",
"parameter",
"info",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/query/KunderaQuery.java#L783-L795 |
jMetal/jMetal | jmetal-exec/src/main/java/org/uma/jmetal/qualityIndicator/CommandLineIndicatorRunner.java | CommandLineIndicatorRunner.calculateAndPrintIndicators | private static void calculateAndPrintIndicators(String[] args, boolean normalize)
throws FileNotFoundException {
Front referenceFront = new ArrayFront(args[1]);
Front front = new ArrayFront(args[2]);
if (normalize) {
FrontNormalizer frontNormalizer = new FrontNormalizer(referenceFront);
referenceFront = frontNormalizer.normalize(referenceFront);
front = frontNormalizer.normalize(front);
JMetalLogger.logger.info("The fronts are NORMALIZED before computing the indicators"); ;
} else {
JMetalLogger.logger.info("The fronts are NOT NORMALIZED before computing the indicators") ;
}
List<QualityIndicator<List<PointSolution>, Double>> indicatorList =
getAvailableIndicators(referenceFront);
if (!args[0].equals("ALL")) {
QualityIndicator<List<PointSolution>, Double> indicator = getIndicatorFromName(
args[0], indicatorList);
System.out.println(indicator.evaluate(FrontUtils.convertFrontToSolutionList(front)));
} else {
for (QualityIndicator<List<PointSolution>, Double> indicator : indicatorList) {
System.out.println(indicator.getName() + ": " +
indicator.evaluate(FrontUtils.convertFrontToSolutionList(front)));
}
SetCoverage sc = new SetCoverage() ;
JMetalLogger.logger.info("SC(refPF, front): " + sc.evaluate(
FrontUtils.convertFrontToSolutionList(referenceFront),
FrontUtils.convertFrontToSolutionList(front))) ;
JMetalLogger.logger.info("SC(front, refPF): " + sc.evaluate(
FrontUtils.convertFrontToSolutionList(front),
FrontUtils.convertFrontToSolutionList(referenceFront))) ;
}
} | java | private static void calculateAndPrintIndicators(String[] args, boolean normalize)
throws FileNotFoundException {
Front referenceFront = new ArrayFront(args[1]);
Front front = new ArrayFront(args[2]);
if (normalize) {
FrontNormalizer frontNormalizer = new FrontNormalizer(referenceFront);
referenceFront = frontNormalizer.normalize(referenceFront);
front = frontNormalizer.normalize(front);
JMetalLogger.logger.info("The fronts are NORMALIZED before computing the indicators"); ;
} else {
JMetalLogger.logger.info("The fronts are NOT NORMALIZED before computing the indicators") ;
}
List<QualityIndicator<List<PointSolution>, Double>> indicatorList =
getAvailableIndicators(referenceFront);
if (!args[0].equals("ALL")) {
QualityIndicator<List<PointSolution>, Double> indicator = getIndicatorFromName(
args[0], indicatorList);
System.out.println(indicator.evaluate(FrontUtils.convertFrontToSolutionList(front)));
} else {
for (QualityIndicator<List<PointSolution>, Double> indicator : indicatorList) {
System.out.println(indicator.getName() + ": " +
indicator.evaluate(FrontUtils.convertFrontToSolutionList(front)));
}
SetCoverage sc = new SetCoverage() ;
JMetalLogger.logger.info("SC(refPF, front): " + sc.evaluate(
FrontUtils.convertFrontToSolutionList(referenceFront),
FrontUtils.convertFrontToSolutionList(front))) ;
JMetalLogger.logger.info("SC(front, refPF): " + sc.evaluate(
FrontUtils.convertFrontToSolutionList(front),
FrontUtils.convertFrontToSolutionList(referenceFront))) ;
}
} | [
"private",
"static",
"void",
"calculateAndPrintIndicators",
"(",
"String",
"[",
"]",
"args",
",",
"boolean",
"normalize",
")",
"throws",
"FileNotFoundException",
"{",
"Front",
"referenceFront",
"=",
"new",
"ArrayFront",
"(",
"args",
"[",
"1",
"]",
")",
";",
"F... | Compute the quality indicator(s) and prints it (them)
@param args
@param normalize
@throws FileNotFoundException | [
"Compute",
"the",
"quality",
"indicator",
"(",
"s",
")",
"and",
"prints",
"it",
"(",
"them",
")"
] | train | https://github.com/jMetal/jMetal/blob/bc981e6aede275d26c5216c9a01227d9675b0cf7/jmetal-exec/src/main/java/org/uma/jmetal/qualityIndicator/CommandLineIndicatorRunner.java#L92-L126 |
JDBDT/jdbdt | src/main/java/org/jdbdt/JDBDT.java | JDBDT.assertDelta | public static void assertDelta(String message, DataSet oldData, DataSet newData) throws DBAssertionError {
DBAssert.deltaAssertion(CallInfo.create(message), oldData, newData);
} | java | public static void assertDelta(String message, DataSet oldData, DataSet newData) throws DBAssertionError {
DBAssert.deltaAssertion(CallInfo.create(message), oldData, newData);
} | [
"public",
"static",
"void",
"assertDelta",
"(",
"String",
"message",
",",
"DataSet",
"oldData",
",",
"DataSet",
"newData",
")",
"throws",
"DBAssertionError",
"{",
"DBAssert",
".",
"deltaAssertion",
"(",
"CallInfo",
".",
"create",
"(",
"message",
")",
",",
"old... | Assert database delta expressed by 'old' and 'new' data sets (error message variant).
@param message The error message for the assertion error.
@param oldData Expected 'old' data.
@param newData Expected 'new' data.
@throws DBAssertionError if the assertion fails.
@see #assertUnchanged(String,DataSource)
@see #assertDeleted(String,DataSet)
@see #assertInserted(String,DataSet) | [
"Assert",
"database",
"delta",
"expressed",
"by",
"old",
"and",
"new",
"data",
"sets",
"(",
"error",
"message",
"variant",
")",
"."
] | train | https://github.com/JDBDT/jdbdt/blob/7e32845ad41dfbc5d6fd0fd561e3613697186df4/src/main/java/org/jdbdt/JDBDT.java#L585-L587 |
looly/hutool | hutool-crypto/src/main/java/cn/hutool/crypto/SecureUtil.java | SecureUtil.readKeyStore | public static KeyStore readKeyStore(String type, InputStream in, char[] password) {
return KeyUtil.readKeyStore(type, in, password);
} | java | public static KeyStore readKeyStore(String type, InputStream in, char[] password) {
return KeyUtil.readKeyStore(type, in, password);
} | [
"public",
"static",
"KeyStore",
"readKeyStore",
"(",
"String",
"type",
",",
"InputStream",
"in",
",",
"char",
"[",
"]",
"password",
")",
"{",
"return",
"KeyUtil",
".",
"readKeyStore",
"(",
"type",
",",
"in",
",",
"password",
")",
";",
"}"
] | 读取KeyStore文件<br>
KeyStore文件用于数字证书的密钥对保存<br>
see: http://snowolf.iteye.com/blog/391931
@param type 类型
@param in {@link InputStream} 如果想从文件读取.keystore文件,使用 {@link FileUtil#getInputStream(java.io.File)} 读取
@param password 密码
@return {@link KeyStore} | [
"读取KeyStore文件<br",
">",
"KeyStore文件用于数字证书的密钥对保存<br",
">",
"see",
":",
"http",
":",
"//",
"snowolf",
".",
"iteye",
".",
"com",
"/",
"blog",
"/",
"391931"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/SecureUtil.java#L320-L322 |
opencb/biodata | biodata-tools/src/main/java/org/opencb/biodata/tools/alignment/BamUtils.java | BamUtils.getCoverageFromBigWig | public static RegionCoverage getCoverageFromBigWig(Region region, int windowSize, Path bigwigPath) throws IOException {
FileUtils.checkFile(bigwigPath);
BigWigManager bigWigManager = new BigWigManager(bigwigPath);
float[] avgCoverage = bigWigManager.groupBy(region, windowSize);
return new RegionCoverage(region, windowSize, avgCoverage);
} | java | public static RegionCoverage getCoverageFromBigWig(Region region, int windowSize, Path bigwigPath) throws IOException {
FileUtils.checkFile(bigwigPath);
BigWigManager bigWigManager = new BigWigManager(bigwigPath);
float[] avgCoverage = bigWigManager.groupBy(region, windowSize);
return new RegionCoverage(region, windowSize, avgCoverage);
} | [
"public",
"static",
"RegionCoverage",
"getCoverageFromBigWig",
"(",
"Region",
"region",
",",
"int",
"windowSize",
",",
"Path",
"bigwigPath",
")",
"throws",
"IOException",
"{",
"FileUtils",
".",
"checkFile",
"(",
"bigwigPath",
")",
";",
"BigWigManager",
"bigWigManage... | Return the coverage average given a window size from the BigWig file passed.
@param region Region from which return the coverage
@param windowSize Window size to average
@param bigwigPath BigWig path with coverage
@return One average score per window size spanning the region
@throws IOException If any error happens reading BigWig file | [
"Return",
"the",
"coverage",
"average",
"given",
"a",
"window",
"size",
"from",
"the",
"BigWig",
"file",
"passed",
"."
] | train | https://github.com/opencb/biodata/blob/21b3d51d71f578efab908422aca4bab7a73097b1/biodata-tools/src/main/java/org/opencb/biodata/tools/alignment/BamUtils.java#L168-L174 |
dkpro/dkpro-argumentation | dkpro-argumentation-misc/src/main/java/org/dkpro/argumentation/misc/uima/JCasUtil2.java | JCasUtil2.findTokenByBeginPosition | public static Token findTokenByBeginPosition(JCas jCas, int begin)
{
for (Token token : JCasUtil.select(getInitialView(jCas), Token.class)) {
if (token.getBegin() == begin) {
return token;
}
}
return null;
} | java | public static Token findTokenByBeginPosition(JCas jCas, int begin)
{
for (Token token : JCasUtil.select(getInitialView(jCas), Token.class)) {
if (token.getBegin() == begin) {
return token;
}
}
return null;
} | [
"public",
"static",
"Token",
"findTokenByBeginPosition",
"(",
"JCas",
"jCas",
",",
"int",
"begin",
")",
"{",
"for",
"(",
"Token",
"token",
":",
"JCasUtil",
".",
"select",
"(",
"getInitialView",
"(",
"jCas",
")",
",",
"Token",
".",
"class",
")",
")",
"{",... | Returns token at the given position
@param jCas jCas
@param begin token begin position
@return Token or null | [
"Returns",
"token",
"at",
"the",
"given",
"position"
] | train | https://github.com/dkpro/dkpro-argumentation/blob/57ce6f5e73d8075b7088aeeebb107c85b3d4bbcb/dkpro-argumentation-misc/src/main/java/org/dkpro/argumentation/misc/uima/JCasUtil2.java#L332-L341 |
google/error-prone-javac | src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/scan/Scan.java | Scan.checkClasses | void checkClasses(ClassFile cf, CPEntries entries) throws ConstantPoolException {
for (ConstantPool.CONSTANT_Class_info ci : entries.classes) {
String name = nameFromRefType(ci.getName());
if (name != null) {
DeprData dd = db.getTypeDeprecated(name);
if (dd != null) {
printType("scan.out.usesclass", cf, name, dd.isForRemoval());
}
}
}
} | java | void checkClasses(ClassFile cf, CPEntries entries) throws ConstantPoolException {
for (ConstantPool.CONSTANT_Class_info ci : entries.classes) {
String name = nameFromRefType(ci.getName());
if (name != null) {
DeprData dd = db.getTypeDeprecated(name);
if (dd != null) {
printType("scan.out.usesclass", cf, name, dd.isForRemoval());
}
}
}
} | [
"void",
"checkClasses",
"(",
"ClassFile",
"cf",
",",
"CPEntries",
"entries",
")",
"throws",
"ConstantPoolException",
"{",
"for",
"(",
"ConstantPool",
".",
"CONSTANT_Class_info",
"ci",
":",
"entries",
".",
"classes",
")",
"{",
"String",
"name",
"=",
"nameFromRefT... | Checks Class_info entries in the constant pool.
@param cf the ClassFile of this class
@param entries constant pool entries collected from this class
@throws ConstantPoolException if a constant pool entry cannot be found | [
"Checks",
"Class_info",
"entries",
"in",
"the",
"constant",
"pool",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/scan/Scan.java#L437-L447 |
bazaarvoice/emodb | auth/auth-core/src/main/java/com/bazaarvoice/emodb/auth/apikey/ApiKeyRealm.java | ApiKeyRealm.getUncachedAuthenticationInfoForKey | private AuthenticationInfo getUncachedAuthenticationInfoForKey(String authenicationId) {
ApiKey apiKey = _authIdentityReader.getIdentityByAuthenticationId(authenicationId);
if (apiKey == null) {
return null;
}
return createAuthenticationInfo(authenicationId, apiKey);
} | java | private AuthenticationInfo getUncachedAuthenticationInfoForKey(String authenicationId) {
ApiKey apiKey = _authIdentityReader.getIdentityByAuthenticationId(authenicationId);
if (apiKey == null) {
return null;
}
return createAuthenticationInfo(authenicationId, apiKey);
} | [
"private",
"AuthenticationInfo",
"getUncachedAuthenticationInfoForKey",
"(",
"String",
"authenicationId",
")",
"{",
"ApiKey",
"apiKey",
"=",
"_authIdentityReader",
".",
"getIdentityByAuthenticationId",
"(",
"authenicationId",
")",
";",
"if",
"(",
"apiKey",
"==",
"null",
... | Gets the authentication info for an API key from the source (not from cache). | [
"Gets",
"the",
"authentication",
"info",
"for",
"an",
"API",
"key",
"from",
"the",
"source",
"(",
"not",
"from",
"cache",
")",
"."
] | train | https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/auth/auth-core/src/main/java/com/bazaarvoice/emodb/auth/apikey/ApiKeyRealm.java#L213-L220 |
logic-ng/LogicNG | src/main/java/org/logicng/solvers/maxsat/encodings/Encoding.java | Encoding.addQuaternaryClause | private void addQuaternaryClause(final MiniSatStyleSolver s, int a, int b, int c, int d, int blocking) {
assert this.clause.size() == 0;
assert a != LIT_UNDEF && b != LIT_UNDEF && c != LIT_UNDEF && d != LIT_UNDEF;
assert var(a) < s.nVars() && var(b) < s.nVars() && var(c) < s.nVars() && var(d) < s.nVars();
this.clause.push(a);
this.clause.push(b);
this.clause.push(c);
this.clause.push(d);
if (blocking != LIT_UNDEF)
this.clause.push(blocking);
s.addClause(this.clause, null);
this.clause.clear();
} | java | private void addQuaternaryClause(final MiniSatStyleSolver s, int a, int b, int c, int d, int blocking) {
assert this.clause.size() == 0;
assert a != LIT_UNDEF && b != LIT_UNDEF && c != LIT_UNDEF && d != LIT_UNDEF;
assert var(a) < s.nVars() && var(b) < s.nVars() && var(c) < s.nVars() && var(d) < s.nVars();
this.clause.push(a);
this.clause.push(b);
this.clause.push(c);
this.clause.push(d);
if (blocking != LIT_UNDEF)
this.clause.push(blocking);
s.addClause(this.clause, null);
this.clause.clear();
} | [
"private",
"void",
"addQuaternaryClause",
"(",
"final",
"MiniSatStyleSolver",
"s",
",",
"int",
"a",
",",
"int",
"b",
",",
"int",
"c",
",",
"int",
"d",
",",
"int",
"blocking",
")",
"{",
"assert",
"this",
".",
"clause",
".",
"size",
"(",
")",
"==",
"0"... | Adds a quaterary clause to the given SAT solver.
@param s the sat solver
@param a the first literal
@param b the second literal
@param c the third literal
@param d the fourth literal
@param blocking the blocking literal | [
"Adds",
"a",
"quaterary",
"clause",
"to",
"the",
"given",
"SAT",
"solver",
"."
] | train | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/maxsat/encodings/Encoding.java#L183-L195 |
UrielCh/ovh-java-sdk | ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java | ApiOvhOrder.cart_cartId_item_itemId_configuration_configurationId_DELETE | public void cart_cartId_item_itemId_configuration_configurationId_DELETE(String cartId, Long itemId, Long configurationId) throws IOException {
String qPath = "/order/cart/{cartId}/item/{itemId}/configuration/{configurationId}";
StringBuilder sb = path(qPath, cartId, itemId, configurationId);
execN(qPath, "DELETE", sb.toString(), null);
} | java | public void cart_cartId_item_itemId_configuration_configurationId_DELETE(String cartId, Long itemId, Long configurationId) throws IOException {
String qPath = "/order/cart/{cartId}/item/{itemId}/configuration/{configurationId}";
StringBuilder sb = path(qPath, cartId, itemId, configurationId);
execN(qPath, "DELETE", sb.toString(), null);
} | [
"public",
"void",
"cart_cartId_item_itemId_configuration_configurationId_DELETE",
"(",
"String",
"cartId",
",",
"Long",
"itemId",
",",
"Long",
"configurationId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/order/cart/{cartId}/item/{itemId}/configuration/{conf... | Delete configuration item
REST: DELETE /order/cart/{cartId}/item/{itemId}/configuration/{configurationId}
@param cartId [required] Cart identifier
@param itemId [required] Product item identifier
@param configurationId [required] Configuration item identifier | [
"Delete",
"configuration",
"item"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L8103-L8107 |
undertow-io/undertow | core/src/main/java/io/undertow/server/handlers/PathHandler.java | PathHandler.addPath | @Deprecated
public synchronized PathHandler addPath(final String path, final HttpHandler handler) {
return addPrefixPath(path, handler);
} | java | @Deprecated
public synchronized PathHandler addPath(final String path, final HttpHandler handler) {
return addPrefixPath(path, handler);
} | [
"@",
"Deprecated",
"public",
"synchronized",
"PathHandler",
"addPath",
"(",
"final",
"String",
"path",
",",
"final",
"HttpHandler",
"handler",
")",
"{",
"return",
"addPrefixPath",
"(",
"path",
",",
"handler",
")",
";",
"}"
] | Adds a path prefix and a handler for that path. If the path does not start
with a / then one will be prepended.
<p>
The match is done on a prefix bases, so registering /foo will also match /bar. Exact
path matches are taken into account first.
<p>
If / is specified as the path then it will replace the default handler.
@param path The path
@param handler The handler
@see #addPrefixPath(String, io.undertow.server.HttpHandler)
@deprecated Superseded by {@link #addPrefixPath(String, io.undertow.server.HttpHandler)}. | [
"Adds",
"a",
"path",
"prefix",
"and",
"a",
"handler",
"for",
"that",
"path",
".",
"If",
"the",
"path",
"does",
"not",
"start",
"with",
"a",
"/",
"then",
"one",
"will",
"be",
"prepended",
".",
"<p",
">",
"The",
"match",
"is",
"done",
"on",
"a",
"pre... | train | https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/server/handlers/PathHandler.java#L108-L111 |
pierre/serialization | thrift/src/main/java/com/ning/metrics/serialization/event/ThriftToThriftEnvelopeEvent.java | ThriftToThriftEnvelopeEvent.extractEvent | public static ThriftEnvelopeEvent extractEvent(final String type, final DateTime eventDateTime, final byte[] payload) throws TException
{
final List<ThriftField> list = new ThriftFieldListDeserializer().readPayload(payload);
final ThriftEnvelope envelope = new ThriftEnvelope(type, list);
return new ThriftEnvelopeEvent(eventDateTime, envelope);
} | java | public static ThriftEnvelopeEvent extractEvent(final String type, final DateTime eventDateTime, final byte[] payload) throws TException
{
final List<ThriftField> list = new ThriftFieldListDeserializer().readPayload(payload);
final ThriftEnvelope envelope = new ThriftEnvelope(type, list);
return new ThriftEnvelopeEvent(eventDateTime, envelope);
} | [
"public",
"static",
"ThriftEnvelopeEvent",
"extractEvent",
"(",
"final",
"String",
"type",
",",
"final",
"DateTime",
"eventDateTime",
",",
"final",
"byte",
"[",
"]",
"payload",
")",
"throws",
"TException",
"{",
"final",
"List",
"<",
"ThriftField",
">",
"list",
... | Given a serialized Thrift, generate a ThrifTEnvelopeEvent
@param type Thrift schema name
@param eventDateTime the event timestamp
@param payload serialized Thrift
@return ThriftEnvelopeEvent representing the Thrift
@throws TException if the payload is not a valid Thrift | [
"Given",
"a",
"serialized",
"Thrift",
"generate",
"a",
"ThrifTEnvelopeEvent"
] | train | https://github.com/pierre/serialization/blob/b15b7c749ba78bfe94dce8fc22f31b30b2e6830b/thrift/src/main/java/com/ning/metrics/serialization/event/ThriftToThriftEnvelopeEvent.java#L100-L106 |
mangstadt/biweekly | src/main/java/biweekly/io/ParseContext.java | ParseContext.addWarning | public void addWarning(int code, Object... args) {
//@formatter:off
warnings.add(new ParseWarning.Builder(this)
.message(code, args)
.build());
//@formatter:on
} | java | public void addWarning(int code, Object... args) {
//@formatter:off
warnings.add(new ParseWarning.Builder(this)
.message(code, args)
.build());
//@formatter:on
} | [
"public",
"void",
"addWarning",
"(",
"int",
"code",
",",
"Object",
"...",
"args",
")",
"{",
"//@formatter:off",
"warnings",
".",
"add",
"(",
"new",
"ParseWarning",
".",
"Builder",
"(",
"this",
")",
".",
"message",
"(",
"code",
",",
"args",
")",
".",
"b... | Adds a parse warning.
@param code the warning code
@param args the warning message arguments | [
"Adds",
"a",
"parse",
"warning",
"."
] | train | https://github.com/mangstadt/biweekly/blob/2e21350f85c13dfff52fdef98fdbebe2976fcf61/src/main/java/biweekly/io/ParseContext.java#L171-L177 |
ironjacamar/ironjacamar | common/src/main/java/org/ironjacamar/common/metadata/common/CommonIronJacamarParser.java | CommonIronJacamarParser.storeValidation | protected void storeValidation(Validation v, XMLStreamWriter writer) throws Exception
{
writer.writeStartElement(CommonXML.ELEMENT_VALIDATION);
if (v.isValidateOnMatch() != null)
{
writer.writeStartElement(CommonXML.ELEMENT_VALIDATE_ON_MATCH);
writer.writeCharacters(v.getValue(CommonXML.ELEMENT_VALIDATE_ON_MATCH, v.isValidateOnMatch().toString()));
writer.writeEndElement();
}
if (v.isBackgroundValidation() != null)
{
writer.writeStartElement(CommonXML.ELEMENT_BACKGROUND_VALIDATION);
writer.writeCharacters(v.getValue(CommonXML.ELEMENT_BACKGROUND_VALIDATION,
v.isBackgroundValidation().toString()));
writer.writeEndElement();
}
if (v.getBackgroundValidationMillis() != null)
{
writer.writeStartElement(CommonXML.ELEMENT_BACKGROUND_VALIDATION_MILLIS);
writer.writeCharacters(v.getValue(CommonXML.ELEMENT_BACKGROUND_VALIDATION_MILLIS,
v.getBackgroundValidationMillis().toString()));
writer.writeEndElement();
}
if (v.isUseFastFail() != null)
{
writer.writeStartElement(CommonXML.ELEMENT_USE_FAST_FAIL);
writer.writeCharacters(v.getValue(CommonXML.ELEMENT_USE_FAST_FAIL, v.isUseFastFail().toString()));
writer.writeEndElement();
}
writer.writeEndElement();
} | java | protected void storeValidation(Validation v, XMLStreamWriter writer) throws Exception
{
writer.writeStartElement(CommonXML.ELEMENT_VALIDATION);
if (v.isValidateOnMatch() != null)
{
writer.writeStartElement(CommonXML.ELEMENT_VALIDATE_ON_MATCH);
writer.writeCharacters(v.getValue(CommonXML.ELEMENT_VALIDATE_ON_MATCH, v.isValidateOnMatch().toString()));
writer.writeEndElement();
}
if (v.isBackgroundValidation() != null)
{
writer.writeStartElement(CommonXML.ELEMENT_BACKGROUND_VALIDATION);
writer.writeCharacters(v.getValue(CommonXML.ELEMENT_BACKGROUND_VALIDATION,
v.isBackgroundValidation().toString()));
writer.writeEndElement();
}
if (v.getBackgroundValidationMillis() != null)
{
writer.writeStartElement(CommonXML.ELEMENT_BACKGROUND_VALIDATION_MILLIS);
writer.writeCharacters(v.getValue(CommonXML.ELEMENT_BACKGROUND_VALIDATION_MILLIS,
v.getBackgroundValidationMillis().toString()));
writer.writeEndElement();
}
if (v.isUseFastFail() != null)
{
writer.writeStartElement(CommonXML.ELEMENT_USE_FAST_FAIL);
writer.writeCharacters(v.getValue(CommonXML.ELEMENT_USE_FAST_FAIL, v.isUseFastFail().toString()));
writer.writeEndElement();
}
writer.writeEndElement();
} | [
"protected",
"void",
"storeValidation",
"(",
"Validation",
"v",
",",
"XMLStreamWriter",
"writer",
")",
"throws",
"Exception",
"{",
"writer",
".",
"writeStartElement",
"(",
"CommonXML",
".",
"ELEMENT_VALIDATION",
")",
";",
"if",
"(",
"v",
".",
"isValidateOnMatch",
... | Store validation
@param v The validation
@param writer The writer
@exception Exception Thrown if an error occurs | [
"Store",
"validation"
] | train | https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/common/src/main/java/org/ironjacamar/common/metadata/common/CommonIronJacamarParser.java#L1002-L1037 |
Wikidata/Wikidata-Toolkit | wdtk-datamodel/src/main/java/org/wikidata/wdtk/datamodel/helpers/Datamodel.java | Datamodel.makeQuantityValue | public static QuantityValue makeQuantityValue(BigDecimal numericValue, String unit) {
return factory.getQuantityValue(numericValue, unit);
} | java | public static QuantityValue makeQuantityValue(BigDecimal numericValue, String unit) {
return factory.getQuantityValue(numericValue, unit);
} | [
"public",
"static",
"QuantityValue",
"makeQuantityValue",
"(",
"BigDecimal",
"numericValue",
",",
"String",
"unit",
")",
"{",
"return",
"factory",
".",
"getQuantityValue",
"(",
"numericValue",
",",
"unit",
")",
";",
"}"
] | Creates a {@link QuantityValue} without bounds.
@param numericValue
the numeric value of this quantity
@param unit
the unit identifier to use for this quantity
@return a {@link QuantityValue} corresponding to the input | [
"Creates",
"a",
"{",
"@link",
"QuantityValue",
"}",
"without",
"bounds",
"."
] | train | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-datamodel/src/main/java/org/wikidata/wdtk/datamodel/helpers/Datamodel.java#L366-L368 |
SonarSource/sonarqube | server/sonar-server-common/src/main/java/org/sonar/server/rule/index/RuleIndexer.java | RuleIndexer.commitAndIndex | public void commitAndIndex(DbSession dbSession, int ruleId, OrganizationDto organization) {
List<EsQueueDto> items = asList(createQueueDtoForRule(ruleId), createQueueDtoForRuleExtension(ruleId, organization));
dbClient.esQueueDao().insert(dbSession, items);
dbSession.commit();
postCommit(dbSession, items);
} | java | public void commitAndIndex(DbSession dbSession, int ruleId, OrganizationDto organization) {
List<EsQueueDto> items = asList(createQueueDtoForRule(ruleId), createQueueDtoForRuleExtension(ruleId, organization));
dbClient.esQueueDao().insert(dbSession, items);
dbSession.commit();
postCommit(dbSession, items);
} | [
"public",
"void",
"commitAndIndex",
"(",
"DbSession",
"dbSession",
",",
"int",
"ruleId",
",",
"OrganizationDto",
"organization",
")",
"{",
"List",
"<",
"EsQueueDto",
">",
"items",
"=",
"asList",
"(",
"createQueueDtoForRule",
"(",
"ruleId",
")",
",",
"createQueue... | Commit a change on a rule and its extension on the given organization | [
"Commit",
"a",
"change",
"on",
"a",
"rule",
"and",
"its",
"extension",
"on",
"the",
"given",
"organization"
] | train | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-server-common/src/main/java/org/sonar/server/rule/index/RuleIndexer.java#L105-L110 |
lightblueseas/file-worker | src/main/java/de/alpharogroup/file/search/PathFinder.java | PathFinder.getRelativePath | public static File getRelativePath(final File parent, final String... folders)
{
return getRelativePathTo(parent, Arrays.asList(folders));
} | java | public static File getRelativePath(final File parent, final String... folders)
{
return getRelativePathTo(parent, Arrays.asList(folders));
} | [
"public",
"static",
"File",
"getRelativePath",
"(",
"final",
"File",
"parent",
",",
"final",
"String",
"...",
"folders",
")",
"{",
"return",
"getRelativePathTo",
"(",
"parent",
",",
"Arrays",
".",
"asList",
"(",
"folders",
")",
")",
";",
"}"
] | Gets the file or directory from the given parent File object and the relative path given over
the list as String objects.
@param parent
The parent directory.
@param folders
The list with the directories and optional a filename.
@return the resulted file or directory from the given arguments. | [
"Gets",
"the",
"file",
"or",
"directory",
"from",
"the",
"given",
"parent",
"File",
"object",
"and",
"the",
"relative",
"path",
"given",
"over",
"the",
"list",
"as",
"String",
"objects",
"."
] | train | https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/search/PathFinder.java#L123-L126 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/time/DateFormatUtils.java | DateFormatUtils.formatUTC | public static String formatUTC(final long millis, final String pattern) {
return format(new Date(millis), pattern, UTC_TIME_ZONE, null);
} | java | public static String formatUTC(final long millis, final String pattern) {
return format(new Date(millis), pattern, UTC_TIME_ZONE, null);
} | [
"public",
"static",
"String",
"formatUTC",
"(",
"final",
"long",
"millis",
",",
"final",
"String",
"pattern",
")",
"{",
"return",
"format",
"(",
"new",
"Date",
"(",
"millis",
")",
",",
"pattern",
",",
"UTC_TIME_ZONE",
",",
"null",
")",
";",
"}"
] | <p>Formats a date/time into a specific pattern using the UTC time zone.</p>
@param millis the date to format expressed in milliseconds
@param pattern the pattern to use to format the date, not null
@return the formatted date | [
"<p",
">",
"Formats",
"a",
"date",
"/",
"time",
"into",
"a",
"specific",
"pattern",
"using",
"the",
"UTC",
"time",
"zone",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/time/DateFormatUtils.java#L217-L219 |
stratosphere/stratosphere | stratosphere-core/src/main/java/eu/stratosphere/configuration/Configuration.java | Configuration.getInteger | public int getInteger(String key, int defaultValue) {
String val = getStringInternal(key);
if (val == null) {
return defaultValue;
} else {
return Integer.parseInt(val);
}
} | java | public int getInteger(String key, int defaultValue) {
String val = getStringInternal(key);
if (val == null) {
return defaultValue;
} else {
return Integer.parseInt(val);
}
} | [
"public",
"int",
"getInteger",
"(",
"String",
"key",
",",
"int",
"defaultValue",
")",
"{",
"String",
"val",
"=",
"getStringInternal",
"(",
"key",
")",
";",
"if",
"(",
"val",
"==",
"null",
")",
"{",
"return",
"defaultValue",
";",
"}",
"else",
"{",
"retu... | Returns the value associated with the given key as an integer.
@param key
the key pointing to the associated value
@param defaultValue
the default value which is returned in case there is no value associated with the given key
@return the (default) value associated with the given key | [
"Returns",
"the",
"value",
"associated",
"with",
"the",
"given",
"key",
"as",
"an",
"integer",
"."
] | train | https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-core/src/main/java/eu/stratosphere/configuration/Configuration.java#L182-L189 |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/rpc/akka/AkkaInvocationHandler.java | AkkaInvocationHandler.extractRpcTimeout | private static Time extractRpcTimeout(Annotation[][] parameterAnnotations, Object[] args, Time defaultTimeout) {
if (args != null) {
Preconditions.checkArgument(parameterAnnotations.length == args.length);
for (int i = 0; i < parameterAnnotations.length; i++) {
if (isRpcTimeout(parameterAnnotations[i])) {
if (args[i] instanceof Time) {
return (Time) args[i];
} else {
throw new RuntimeException("The rpc timeout parameter must be of type " +
Time.class.getName() + ". The type " + args[i].getClass().getName() +
" is not supported.");
}
}
}
}
return defaultTimeout;
} | java | private static Time extractRpcTimeout(Annotation[][] parameterAnnotations, Object[] args, Time defaultTimeout) {
if (args != null) {
Preconditions.checkArgument(parameterAnnotations.length == args.length);
for (int i = 0; i < parameterAnnotations.length; i++) {
if (isRpcTimeout(parameterAnnotations[i])) {
if (args[i] instanceof Time) {
return (Time) args[i];
} else {
throw new RuntimeException("The rpc timeout parameter must be of type " +
Time.class.getName() + ". The type " + args[i].getClass().getName() +
" is not supported.");
}
}
}
}
return defaultTimeout;
} | [
"private",
"static",
"Time",
"extractRpcTimeout",
"(",
"Annotation",
"[",
"]",
"[",
"]",
"parameterAnnotations",
",",
"Object",
"[",
"]",
"args",
",",
"Time",
"defaultTimeout",
")",
"{",
"if",
"(",
"args",
"!=",
"null",
")",
"{",
"Preconditions",
".",
"che... | Extracts the {@link RpcTimeout} annotated rpc timeout value from the list of given method
arguments. If no {@link RpcTimeout} annotated parameter could be found, then the default
timeout is returned.
@param parameterAnnotations Parameter annotations
@param args Array of arguments
@param defaultTimeout Default timeout to return if no {@link RpcTimeout} annotated parameter
has been found
@return Timeout extracted from the array of arguments or the default timeout | [
"Extracts",
"the",
"{",
"@link",
"RpcTimeout",
"}",
"annotated",
"rpc",
"timeout",
"value",
"from",
"the",
"list",
"of",
"given",
"method",
"arguments",
".",
"If",
"no",
"{",
"@link",
"RpcTimeout",
"}",
"annotated",
"parameter",
"could",
"be",
"found",
"then... | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/rpc/akka/AkkaInvocationHandler.java#L298-L316 |
jMotif/SAX | src/main/java/net/seninp/util/UCRUtils.java | UCRUtils.saveData | public static void saveData(Map<String, List<double[]>> data, File file) throws IOException {
BufferedWriter bw = new BufferedWriter(new FileWriter(file));
for (Entry<String, List<double[]>> classEntry : data.entrySet()) {
String classLabel = classEntry.getKey();
for (double[] arr : classEntry.getValue()) {
String arrStr = Arrays.toString(arr).replaceAll("[\\]\\[\\s]+", "");
bw.write(classLabel + "," + arrStr + CR);
}
}
bw.close();
} | java | public static void saveData(Map<String, List<double[]>> data, File file) throws IOException {
BufferedWriter bw = new BufferedWriter(new FileWriter(file));
for (Entry<String, List<double[]>> classEntry : data.entrySet()) {
String classLabel = classEntry.getKey();
for (double[] arr : classEntry.getValue()) {
String arrStr = Arrays.toString(arr).replaceAll("[\\]\\[\\s]+", "");
bw.write(classLabel + "," + arrStr + CR);
}
}
bw.close();
} | [
"public",
"static",
"void",
"saveData",
"(",
"Map",
"<",
"String",
",",
"List",
"<",
"double",
"[",
"]",
">",
">",
"data",
",",
"File",
"file",
")",
"throws",
"IOException",
"{",
"BufferedWriter",
"bw",
"=",
"new",
"BufferedWriter",
"(",
"new",
"FileWrit... | Saves the dataset.
@param data the dataset.
@param file the file handler.
@throws IOException if error occurs. | [
"Saves",
"the",
"dataset",
"."
] | train | https://github.com/jMotif/SAX/blob/39ee07a69facaa330def5130b8790aeda85f1061/src/main/java/net/seninp/util/UCRUtils.java#L133-L146 |
Impetus/Kundera | src/kundera-neo4j/src/main/java/com/impetus/client/neo4j/GraphEntityMapper.java | GraphEntityMapper.getOrCreateRelationshipWithUniqueFactory | private Relationship getOrCreateRelationshipWithUniqueFactory(Object entity, EntityMetadata m,
GraphDatabaseService graphDb)
{
Object id = PropertyAccessorHelper.getObject(entity, (Field) m.getIdAttribute().getJavaMember());
final String idFieldName = m.getIdAttribute().getName();
UniqueFactory<Relationship> factory = new UniqueFactory.UniqueRelationshipFactory(graphDb, m.getIndexName())
{
@Override
protected Relationship create(Map<String, Object> paramMap)
{
return null;
}
@Override
protected void initialize(Relationship relationship, Map<String, Object> properties)
{
relationship.setProperty(idFieldName, properties.get(idFieldName));
}
};
return factory.getOrCreate(idFieldName, id);
} | java | private Relationship getOrCreateRelationshipWithUniqueFactory(Object entity, EntityMetadata m,
GraphDatabaseService graphDb)
{
Object id = PropertyAccessorHelper.getObject(entity, (Field) m.getIdAttribute().getJavaMember());
final String idFieldName = m.getIdAttribute().getName();
UniqueFactory<Relationship> factory = new UniqueFactory.UniqueRelationshipFactory(graphDb, m.getIndexName())
{
@Override
protected Relationship create(Map<String, Object> paramMap)
{
return null;
}
@Override
protected void initialize(Relationship relationship, Map<String, Object> properties)
{
relationship.setProperty(idFieldName, properties.get(idFieldName));
}
};
return factory.getOrCreate(idFieldName, id);
} | [
"private",
"Relationship",
"getOrCreateRelationshipWithUniqueFactory",
"(",
"Object",
"entity",
",",
"EntityMetadata",
"m",
",",
"GraphDatabaseService",
"graphDb",
")",
"{",
"Object",
"id",
"=",
"PropertyAccessorHelper",
".",
"getObject",
"(",
"entity",
",",
"(",
"Fie... | Gets (if available) or creates a relationship for the given entity | [
"Gets",
"(",
"if",
"available",
")",
"or",
"creates",
"a",
"relationship",
"for",
"the",
"given",
"entity"
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-neo4j/src/main/java/com/impetus/client/neo4j/GraphEntityMapper.java#L575-L598 |
ReactiveX/RxJavaAsyncUtil | src/main/java/rx/util/async/Async.java | Async.fromCallable | public static <R> Observable<R> fromCallable(Callable<? extends R> callable, Scheduler scheduler) {
return Observable.create(OperatorFromFunctionals.fromCallable(callable)).subscribeOn(scheduler);
} | java | public static <R> Observable<R> fromCallable(Callable<? extends R> callable, Scheduler scheduler) {
return Observable.create(OperatorFromFunctionals.fromCallable(callable)).subscribeOn(scheduler);
} | [
"public",
"static",
"<",
"R",
">",
"Observable",
"<",
"R",
">",
"fromCallable",
"(",
"Callable",
"<",
"?",
"extends",
"R",
">",
"callable",
",",
"Scheduler",
"scheduler",
")",
"{",
"return",
"Observable",
".",
"create",
"(",
"OperatorFromFunctionals",
".",
... | Return an Observable that calls the given Callable and emits its result or Exception when an Observer
subscribes.
<p>
<img width="640" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/fromCallable.s.png" alt="">
@param <R> the return type
@param callable the callable to call on each subscription
@param scheduler the Scheduler where the function is called and the result is emitted
@return an Observable that calls the given Callable and emits its result or Exception when an Observer
subscribes
@see #start(rx.functions.Func0)
@see <a href="https://github.com/ReactiveX/RxJava/wiki/Async-Operators#wiki-fromcallable">RxJava Wiki: fromCallable()</a> | [
"Return",
"an",
"Observable",
"that",
"calls",
"the",
"given",
"Callable",
"and",
"emits",
"its",
"result",
"or",
"Exception",
"when",
"an",
"Observer",
"subscribes",
".",
"<p",
">",
"<img",
"width",
"=",
"640",
"src",
"=",
"https",
":",
"//",
"raw",
"."... | train | https://github.com/ReactiveX/RxJavaAsyncUtil/blob/6294e1da30e639df79f76399906229314c14e74d/src/main/java/rx/util/async/Async.java#L2059-L2061 |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/javac/parser/JavacParser.java | JavacParser.classOrInterfaceBody | List<JCTree> classOrInterfaceBody(Name className, boolean isInterface) {
accept(LBRACE);
if (token.pos <= endPosTable.errorEndPos) {
// error recovery
skip(false, true, false, false);
if (token.kind == LBRACE)
nextToken();
}
ListBuffer<JCTree> defs = new ListBuffer<JCTree>();
while (token.kind != RBRACE && token.kind != EOF) {
defs.appendList(classOrInterfaceBodyDeclaration(className, isInterface));
if (token.pos <= endPosTable.errorEndPos) {
// error recovery
skip(false, true, true, false);
}
}
accept(RBRACE);
return defs.toList();
} | java | List<JCTree> classOrInterfaceBody(Name className, boolean isInterface) {
accept(LBRACE);
if (token.pos <= endPosTable.errorEndPos) {
// error recovery
skip(false, true, false, false);
if (token.kind == LBRACE)
nextToken();
}
ListBuffer<JCTree> defs = new ListBuffer<JCTree>();
while (token.kind != RBRACE && token.kind != EOF) {
defs.appendList(classOrInterfaceBodyDeclaration(className, isInterface));
if (token.pos <= endPosTable.errorEndPos) {
// error recovery
skip(false, true, true, false);
}
}
accept(RBRACE);
return defs.toList();
} | [
"List",
"<",
"JCTree",
">",
"classOrInterfaceBody",
"(",
"Name",
"className",
",",
"boolean",
"isInterface",
")",
"{",
"accept",
"(",
"LBRACE",
")",
";",
"if",
"(",
"token",
".",
"pos",
"<=",
"endPosTable",
".",
"errorEndPos",
")",
"{",
"// error recovery",
... | ClassBody = "{" {ClassBodyDeclaration} "}"
InterfaceBody = "{" {InterfaceBodyDeclaration} "}" | [
"ClassBody",
"=",
"{",
"{",
"ClassBodyDeclaration",
"}",
"}",
"InterfaceBody",
"=",
"{",
"{",
"InterfaceBodyDeclaration",
"}",
"}"
] | train | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/parser/JavacParser.java#L3484-L3502 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/VirtualWANsInner.java | VirtualWANsInner.getByResourceGroup | public VirtualWANInner getByResourceGroup(String resourceGroupName, String virtualWANName) {
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, virtualWANName).toBlocking().single().body();
} | java | public VirtualWANInner getByResourceGroup(String resourceGroupName, String virtualWANName) {
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, virtualWANName).toBlocking().single().body();
} | [
"public",
"VirtualWANInner",
"getByResourceGroup",
"(",
"String",
"resourceGroupName",
",",
"String",
"virtualWANName",
")",
"{",
"return",
"getByResourceGroupWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"virtualWANName",
")",
".",
"toBlocking",
"(",
")",
"."... | Retrieves the details of a VirtualWAN.
@param resourceGroupName The resource group name of the VirtualWan.
@param virtualWANName The name of the VirtualWAN being retrieved.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the VirtualWANInner object if successful. | [
"Retrieves",
"the",
"details",
"of",
"a",
"VirtualWAN",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/VirtualWANsInner.java#L126-L128 |
ttddyy/datasource-proxy | src/main/java/net/ttddyy/dsproxy/proxy/GeneratedKeysUtils.java | GeneratedKeysUtils.isAutoGenerateEnabledParameters | public static boolean isAutoGenerateEnabledParameters(Object[] args) {
if (args == null || args.length != 2 || args[1] == null) {
return false;
}
Object arg = args[1];
if (arg instanceof Integer) {
// for method(String sql, int autoGeneratedKeys)
return (Integer) arg == Statement.RETURN_GENERATED_KEYS;
} else if (arg instanceof int[]) {
// for method(String sql, int columnIndexes[])
return ((int[]) arg).length != 0;
} else if (arg instanceof String[]) {
// for method(String sql, String columnNames[])
return ((String[]) arg).length != 0;
}
return false;
}
} | java | public static boolean isAutoGenerateEnabledParameters(Object[] args) {
if (args == null || args.length != 2 || args[1] == null) {
return false;
}
Object arg = args[1];
if (arg instanceof Integer) {
// for method(String sql, int autoGeneratedKeys)
return (Integer) arg == Statement.RETURN_GENERATED_KEYS;
} else if (arg instanceof int[]) {
// for method(String sql, int columnIndexes[])
return ((int[]) arg).length != 0;
} else if (arg instanceof String[]) {
// for method(String sql, String columnNames[])
return ((String[]) arg).length != 0;
}
return false;
}
} | [
"public",
"static",
"boolean",
"isAutoGenerateEnabledParameters",
"(",
"Object",
"[",
"]",
"args",
")",
"{",
"if",
"(",
"args",
"==",
"null",
"||",
"args",
".",
"length",
"!=",
"2",
"||",
"args",
"[",
"1",
"]",
"==",
"null",
")",
"{",
"return",
"false"... | Whether given method arguments intend to enable auto-generated keys.
@param args method parameters for methods that can enable auto-generated keys.
@return true if method params indicate to enable auto-generated keys
@see #isMethodToRetrieveGeneratedKeys(Method) | [
"Whether",
"given",
"method",
"arguments",
"intend",
"to",
"enable",
"auto",
"-",
"generated",
"keys",
"."
] | train | https://github.com/ttddyy/datasource-proxy/blob/62163ccf9a569a99aa3ad9f9151a32567447a62e/src/main/java/net/ttddyy/dsproxy/proxy/GeneratedKeysUtils.java#L64-L84 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/misc/FDBigInteger.java | FDBigInteger.multDiffMe | private /*@ helper @*/ long multDiffMe(long q, FDBigInteger S) {
long diff = 0L;
if (q != 0) {
int deltaSize = S.offset - this.offset;
if (deltaSize >= 0) {
int[] sd = S.data;
int[] td = this.data;
for (int sIndex = 0, tIndex = deltaSize; sIndex < S.nWords; sIndex++, tIndex++) {
diff += (td[tIndex] & LONG_MASK) - q * (sd[sIndex] & LONG_MASK);
td[tIndex] = (int) diff;
diff >>= 32; // N.B. SIGNED shift.
}
} else {
deltaSize = -deltaSize;
int[] rd = new int[nWords + deltaSize];
int sIndex = 0;
int rIndex = 0;
int[] sd = S.data;
for (; rIndex < deltaSize && sIndex < S.nWords; sIndex++, rIndex++) {
diff -= q * (sd[sIndex] & LONG_MASK);
rd[rIndex] = (int) diff;
diff >>= 32; // N.B. SIGNED shift.
}
int tIndex = 0;
int[] td = this.data;
for (; sIndex < S.nWords; sIndex++, tIndex++, rIndex++) {
diff += (td[tIndex] & LONG_MASK) - q * (sd[sIndex] & LONG_MASK);
rd[rIndex] = (int) diff;
diff >>= 32; // N.B. SIGNED shift.
}
this.nWords += deltaSize;
this.offset -= deltaSize;
this.data = rd;
}
}
return diff;
} | java | private /*@ helper @*/ long multDiffMe(long q, FDBigInteger S) {
long diff = 0L;
if (q != 0) {
int deltaSize = S.offset - this.offset;
if (deltaSize >= 0) {
int[] sd = S.data;
int[] td = this.data;
for (int sIndex = 0, tIndex = deltaSize; sIndex < S.nWords; sIndex++, tIndex++) {
diff += (td[tIndex] & LONG_MASK) - q * (sd[sIndex] & LONG_MASK);
td[tIndex] = (int) diff;
diff >>= 32; // N.B. SIGNED shift.
}
} else {
deltaSize = -deltaSize;
int[] rd = new int[nWords + deltaSize];
int sIndex = 0;
int rIndex = 0;
int[] sd = S.data;
for (; rIndex < deltaSize && sIndex < S.nWords; sIndex++, rIndex++) {
diff -= q * (sd[sIndex] & LONG_MASK);
rd[rIndex] = (int) diff;
diff >>= 32; // N.B. SIGNED shift.
}
int tIndex = 0;
int[] td = this.data;
for (; sIndex < S.nWords; sIndex++, tIndex++, rIndex++) {
diff += (td[tIndex] & LONG_MASK) - q * (sd[sIndex] & LONG_MASK);
rd[rIndex] = (int) diff;
diff >>= 32; // N.B. SIGNED shift.
}
this.nWords += deltaSize;
this.offset -= deltaSize;
this.data = rd;
}
}
return diff;
} | [
"private",
"/*@ helper @*/",
"long",
"multDiffMe",
"(",
"long",
"q",
",",
"FDBigInteger",
"S",
")",
"{",
"long",
"diff",
"=",
"0L",
";",
"if",
"(",
"q",
"!=",
"0",
")",
"{",
"int",
"deltaSize",
"=",
"S",
".",
"offset",
"-",
"this",
".",
"offset",
"... | /*@
@ requires 0 < q && q <= (1L << 31);
@ requires data != null;
@ requires 0 <= nWords && nWords <= data.length && offset >= 0;
@ requires !this.isImmutable;
@ requires this.size() == S.size();
@ requires this != S;
@ assignable this.nWords, this.offset, this.data, this.data[*];
@ ensures -q <= \result && \result <= 0;
@ ensures this.size() == \old(this.size());
@ ensures this.value() + (\result << (this.size()*32)) == \old(this.value() - q*S.value());
@ ensures this.offset == \old(Math.min(this.offset, S.offset));
@ ensures \old(this.offset <= S.offset) ==> this.nWords == \old(this.nWords);
@ ensures \old(this.offset <= S.offset) ==> this.offset == \old(this.offset);
@ ensures \old(this.offset <= S.offset) ==> this.data == \old(this.data);
@
@ also
@
@ requires q == 0;
@ assignable \nothing;
@ ensures \result == 0;
@ | [
"/",
"*"
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/misc/FDBigInteger.java#L1289-L1325 |
Omertron/api-rottentomatoes | src/main/java/com/omertron/rottentomatoesapi/RottenTomatoesApi.java | RottenTomatoesApi.getUpcomingDvds | public List<RTMovie> getUpcomingDvds(String country) throws RottenTomatoesException {
return getUpcomingDvds(country, DEFAULT_PAGE, DEFAULT_PAGE_LIMIT);
} | java | public List<RTMovie> getUpcomingDvds(String country) throws RottenTomatoesException {
return getUpcomingDvds(country, DEFAULT_PAGE, DEFAULT_PAGE_LIMIT);
} | [
"public",
"List",
"<",
"RTMovie",
">",
"getUpcomingDvds",
"(",
"String",
"country",
")",
"throws",
"RottenTomatoesException",
"{",
"return",
"getUpcomingDvds",
"(",
"country",
",",
"DEFAULT_PAGE",
",",
"DEFAULT_PAGE_LIMIT",
")",
";",
"}"
] | Retrieves current release DVDs
@param country Provides localized data for the selected country
@return
@throws RottenTomatoesException | [
"Retrieves",
"current",
"release",
"DVDs"
] | train | https://github.com/Omertron/api-rottentomatoes/blob/abaf1833acafc6ada593d52b14ff1bacb4e441ee/src/main/java/com/omertron/rottentomatoesapi/RottenTomatoesApi.java#L484-L486 |
mygreen/xlsmapper | src/main/java/com/gh/mygreen/xlsmapper/util/POIUtils.java | POIUtils.getCellContents | public static String getCellContents(final Cell cell, final CellFormatter cellFormatter) {
ArgUtils.notNull(cell, "cell");
ArgUtils.notNull(cellFormatter, "cellFormatter");
return cellFormatter.format(cell);
} | java | public static String getCellContents(final Cell cell, final CellFormatter cellFormatter) {
ArgUtils.notNull(cell, "cell");
ArgUtils.notNull(cellFormatter, "cellFormatter");
return cellFormatter.format(cell);
} | [
"public",
"static",
"String",
"getCellContents",
"(",
"final",
"Cell",
"cell",
",",
"final",
"CellFormatter",
"cellFormatter",
")",
"{",
"ArgUtils",
".",
"notNull",
"(",
"cell",
",",
"\"cell\"",
")",
";",
"ArgUtils",
".",
"notNull",
"(",
"cellFormatter",
",",
... | フォーマッターを指定してセルの値を取得する
@param cell
@param cellFormatter
@return フォーマットした文字列
@throws IllegalArgumentException {@literal cell or cellFormatter is null.} | [
"フォーマッターを指定してセルの値を取得する"
] | train | https://github.com/mygreen/xlsmapper/blob/a0c6b25c622e5f3a50b199ef685d2ee46ad5483c/src/main/java/com/gh/mygreen/xlsmapper/util/POIUtils.java#L253-L259 |
alkacon/opencms-core | src-setup/org/opencms/setup/xml/CmsSetupXmlHelper.java | CmsSetupXmlHelper.setAttribute | public static boolean setAttribute(Document document, String xPath, String attribute, String value) {
Node node = document.selectSingleNode(xPath);
Element e = (Element)node;
@SuppressWarnings("unchecked")
List<Attribute> attributes = e.attributes();
for (Attribute a : attributes) {
if (a.getName().equals(attribute)) {
a.setValue(value);
return true;
}
}
return false;
} | java | public static boolean setAttribute(Document document, String xPath, String attribute, String value) {
Node node = document.selectSingleNode(xPath);
Element e = (Element)node;
@SuppressWarnings("unchecked")
List<Attribute> attributes = e.attributes();
for (Attribute a : attributes) {
if (a.getName().equals(attribute)) {
a.setValue(value);
return true;
}
}
return false;
} | [
"public",
"static",
"boolean",
"setAttribute",
"(",
"Document",
"document",
",",
"String",
"xPath",
",",
"String",
"attribute",
",",
"String",
"value",
")",
"{",
"Node",
"node",
"=",
"document",
".",
"selectSingleNode",
"(",
"xPath",
")",
";",
"Element",
"e"... | Replaces a attibute's value in the given node addressed by the xPath.<p>
@param document the document to replace the node attribute
@param xPath the xPath to the node
@param attribute the attribute to replace the value of
@param value the new value to set
@return <code>true</code> if successful <code>false</code> otherwise | [
"Replaces",
"a",
"attibute",
"s",
"value",
"in",
"the",
"given",
"node",
"addressed",
"by",
"the",
"xPath",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-setup/org/opencms/setup/xml/CmsSetupXmlHelper.java#L158-L171 |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/base/login.java | login.get_nitro_bulk_response | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
login_responses result = (login_responses) service.get_payload_formatter().string_to_resource(login_responses.class, response);
if(result.errorcode != 0)
{
if (result.errorcode == SESSION_NOT_EXISTS)
service.clear_session();
throw new nitro_exception(result.message, result.errorcode, (base_response [])result.login_response_array);
}
login[] result_login = new login[result.login_response_array.length];
for(int i = 0; i < result.login_response_array.length; i++)
{
result_login[i] = result.login_response_array[i].login[0];
}
return result_login;
} | java | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
login_responses result = (login_responses) service.get_payload_formatter().string_to_resource(login_responses.class, response);
if(result.errorcode != 0)
{
if (result.errorcode == SESSION_NOT_EXISTS)
service.clear_session();
throw new nitro_exception(result.message, result.errorcode, (base_response [])result.login_response_array);
}
login[] result_login = new login[result.login_response_array.length];
for(int i = 0; i < result.login_response_array.length; i++)
{
result_login[i] = result.login_response_array[i].login[0];
}
return result_login;
} | [
"protected",
"base_resource",
"[",
"]",
"get_nitro_bulk_response",
"(",
"nitro_service",
"service",
",",
"String",
"response",
")",
"throws",
"Exception",
"{",
"login_responses",
"result",
"=",
"(",
"login_responses",
")",
"service",
".",
"get_payload_formatter",
"(",... | <pre>
Converts API response of bulk operation into object and returns the object array in case of get request.
</pre> | [
"<pre",
">",
"Converts",
"API",
"response",
"of",
"bulk",
"operation",
"into",
"object",
"and",
"returns",
"the",
"object",
"array",
"in",
"case",
"of",
"get",
"request",
".",
"<",
"/",
"pre",
">"
] | train | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/base/login.java#L236-L253 |
DDTH/ddth-commons | ddth-commons-core/src/main/java/com/github/ddth/commons/utils/SerializationUtils.java | SerializationUtils.fromJson | public static Object fromJson(JsonNode json, ClassLoader classLoader) {
return fromJson(json, Object.class, classLoader);
} | java | public static Object fromJson(JsonNode json, ClassLoader classLoader) {
return fromJson(json, Object.class, classLoader);
} | [
"public",
"static",
"Object",
"fromJson",
"(",
"JsonNode",
"json",
",",
"ClassLoader",
"classLoader",
")",
"{",
"return",
"fromJson",
"(",
"json",
",",
"Object",
".",
"class",
",",
"classLoader",
")",
";",
"}"
] | Deserialize a {@link JsonNode}, with custom class loader.
@param json
@param classLoader
@return
@since 0.6.2 | [
"Deserialize",
"a",
"{",
"@link",
"JsonNode",
"}",
"with",
"custom",
"class",
"loader",
"."
] | train | https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/utils/SerializationUtils.java#L702-L704 |
OpenLiberty/open-liberty | dev/com.ibm.ws.session/src/com/ibm/ws/session/SessionManager.java | SessionManager.adaptAndSetCookie | protected Object adaptAndSetCookie(ServletRequest req, ServletResponse res, SessionAffinityContext sac, ISession isess) {
Object adaptedSession = null;
if (isess != null) {
adaptedSession = _adapter.adapt(isess);
sac.setResponseSessionID(isess.getId());
sac.setResponseSessionVersion(isess.getVersion());
_sam.setCookie(req, res, sac, adaptedSession);
}
return adaptedSession;
} | java | protected Object adaptAndSetCookie(ServletRequest req, ServletResponse res, SessionAffinityContext sac, ISession isess) {
Object adaptedSession = null;
if (isess != null) {
adaptedSession = _adapter.adapt(isess);
sac.setResponseSessionID(isess.getId());
sac.setResponseSessionVersion(isess.getVersion());
_sam.setCookie(req, res, sac, adaptedSession);
}
return adaptedSession;
} | [
"protected",
"Object",
"adaptAndSetCookie",
"(",
"ServletRequest",
"req",
",",
"ServletResponse",
"res",
",",
"SessionAffinityContext",
"sac",
",",
"ISession",
"isess",
")",
"{",
"Object",
"adaptedSession",
"=",
"null",
";",
"if",
"(",
"isess",
"!=",
"null",
")"... | /*
Method used to get the HttpSession object, do some crossover checking, and
then
set the cookie. | [
"/",
"*",
"Method",
"used",
"to",
"get",
"the",
"HttpSession",
"object",
"do",
"some",
"crossover",
"checking",
"and",
"then",
"set",
"the",
"cookie",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.session/src/com/ibm/ws/session/SessionManager.java#L754-L763 |
deeplearning4j/deeplearning4j | nd4j/nd4j-serde/nd4j-grpc/src/main/java/org/nd4j/graph/GraphInferenceGrpcClient.java | GraphInferenceGrpcClient.registerGraph | public void registerGraph(long graphId, @NonNull SameDiff graph, ExecutorConfiguration configuration) {
val g = graph.asFlatGraph(graphId, configuration);
val v = blockingStub.registerGraph(g);
if (v.status() != 0)
throw new ND4JIllegalStateException("registerGraph() gRPC call failed");
} | java | public void registerGraph(long graphId, @NonNull SameDiff graph, ExecutorConfiguration configuration) {
val g = graph.asFlatGraph(graphId, configuration);
val v = blockingStub.registerGraph(g);
if (v.status() != 0)
throw new ND4JIllegalStateException("registerGraph() gRPC call failed");
} | [
"public",
"void",
"registerGraph",
"(",
"long",
"graphId",
",",
"@",
"NonNull",
"SameDiff",
"graph",
",",
"ExecutorConfiguration",
"configuration",
")",
"{",
"val",
"g",
"=",
"graph",
".",
"asFlatGraph",
"(",
"graphId",
",",
"configuration",
")",
";",
"val",
... | This method adds given graph to the GraphServer storage
PLEASE NOTE: You don't need to register graph more then once
PLEASE NOTE: You don't need to register graph if GraphServer was used with -f argument
@param graphId id of the graph, if not 0 - should be used in subsequent output() requests
@param graph | [
"This",
"method",
"adds",
"given",
"graph",
"to",
"the",
"GraphServer",
"storage"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-serde/nd4j-grpc/src/main/java/org/nd4j/graph/GraphInferenceGrpcClient.java#L103-L108 |
micronaut-projects/micronaut-core | core/src/main/java/io/micronaut/core/reflect/ReflectionUtils.java | ReflectionUtils.isSetter | public static boolean isSetter(String name, Class[] args) {
if (StringUtils.isEmpty(name) || args == null) {
return false;
}
if (args.length != 1) {
return false;
}
return NameUtils.isSetterName(name);
} | java | public static boolean isSetter(String name, Class[] args) {
if (StringUtils.isEmpty(name) || args == null) {
return false;
}
if (args.length != 1) {
return false;
}
return NameUtils.isSetterName(name);
} | [
"public",
"static",
"boolean",
"isSetter",
"(",
"String",
"name",
",",
"Class",
"[",
"]",
"args",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isEmpty",
"(",
"name",
")",
"||",
"args",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"a... | Is the method a setter.
@param name The method name
@param args The arguments
@return True if it is | [
"Is",
"the",
"method",
"a",
"setter",
"."
] | train | https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/core/src/main/java/io/micronaut/core/reflect/ReflectionUtils.java#L100-L109 |
microfocus-idol/java-idol-indexing-api | src/main/java/com/autonomy/nonaci/ServerDetails.java | ServerDetails.setCharsetName | public void setCharsetName(final String charsetName) {
if(Charset.isSupported(charsetName)) {
this.charsetName = charsetName;
}
else {
throw new UnsupportedCharsetException("No support for, " + charsetName + ", is available in this instance of the JVM");
}
} | java | public void setCharsetName(final String charsetName) {
if(Charset.isSupported(charsetName)) {
this.charsetName = charsetName;
}
else {
throw new UnsupportedCharsetException("No support for, " + charsetName + ", is available in this instance of the JVM");
}
} | [
"public",
"void",
"setCharsetName",
"(",
"final",
"String",
"charsetName",
")",
"{",
"if",
"(",
"Charset",
".",
"isSupported",
"(",
"charsetName",
")",
")",
"{",
"this",
".",
"charsetName",
"=",
"charsetName",
";",
"}",
"else",
"{",
"throw",
"new",
"Unsupp... | Setter for property charsetName.
@param charsetName The name of the requested charset; may be either a canonical name or an alias
@throws java.lang.IllegalArgumentException If <tt>charsetName</tt> is null
@throws java.nio.charset.IllegalCharsetNameException If the given charset name is illegal
@throws java.nio.charset.UnsupportedCharsetException If no support for the named charset is available in this
instance of the Java virtual machine | [
"Setter",
"for",
"property",
"charsetName",
"."
] | train | https://github.com/microfocus-idol/java-idol-indexing-api/blob/178ea844da501318d8d797a35b2f72ff40786b8c/src/main/java/com/autonomy/nonaci/ServerDetails.java#L216-L223 |
m-m-m/util | gwt/src/main/java/net/sf/mmm/util/nls/impl/rebind/AbstractNlsBundleGenerator.java | AbstractNlsBundleGenerator.generateCreateMessageBlock | private void generateCreateMessageBlock(SourceWriter sourceWriter, boolean hasArguments) {
// return NlsAccess.getFactory().create(message, arguments);
if (hasArguments) {
sourceWriter.print("return ");
sourceWriter.print(NlsAccess.class.getSimpleName());
sourceWriter.print(".getFactory().create(");
sourceWriter.print(VARIABLE_MESSAGE);
sourceWriter.print(", ");
sourceWriter.print(VARIABLE_ARGUMENTS);
sourceWriter.println(");");
} else {
sourceWriter.print("return new ");
sourceWriter.print(NlsMessagePlain.class.getSimpleName());
sourceWriter.print("(");
sourceWriter.print(VARIABLE_MESSAGE);
sourceWriter.println(");");
}
} | java | private void generateCreateMessageBlock(SourceWriter sourceWriter, boolean hasArguments) {
// return NlsAccess.getFactory().create(message, arguments);
if (hasArguments) {
sourceWriter.print("return ");
sourceWriter.print(NlsAccess.class.getSimpleName());
sourceWriter.print(".getFactory().create(");
sourceWriter.print(VARIABLE_MESSAGE);
sourceWriter.print(", ");
sourceWriter.print(VARIABLE_ARGUMENTS);
sourceWriter.println(");");
} else {
sourceWriter.print("return new ");
sourceWriter.print(NlsMessagePlain.class.getSimpleName());
sourceWriter.print("(");
sourceWriter.print(VARIABLE_MESSAGE);
sourceWriter.println(");");
}
} | [
"private",
"void",
"generateCreateMessageBlock",
"(",
"SourceWriter",
"sourceWriter",
",",
"boolean",
"hasArguments",
")",
"{",
"// return NlsAccess.getFactory().create(message, arguments);",
"if",
"(",
"hasArguments",
")",
"{",
"sourceWriter",
".",
"print",
"(",
"\"return ... | Generates the source code block to create a new {@link NlsMessage}.
@param sourceWriter is the {@link SourceWriter}.
@param hasArguments - {@code true} if {@link NlsMessage#getArgument(String) arguments} are given, {@code false}
otherwise. | [
"Generates",
"the",
"source",
"code",
"block",
"to",
"create",
"a",
"new",
"{",
"@link",
"NlsMessage",
"}",
"."
] | train | https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/gwt/src/main/java/net/sf/mmm/util/nls/impl/rebind/AbstractNlsBundleGenerator.java#L230-L248 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.