repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 201 | func_name stringlengths 4 126 | whole_func_string stringlengths 75 3.57k | language stringclasses 1
value | func_code_string stringlengths 75 3.57k | func_code_tokens listlengths 21 599 | func_documentation_string stringlengths 61 1.95k | func_documentation_tokens listlengths 1 478 | split_name stringclasses 1
value | func_code_url stringlengths 111 308 |
|---|---|---|---|---|---|---|---|---|---|---|
moparisthebest/beehive | beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/ExpressionHandling.java | ExpressionHandling.evaluateExpressionInternal | private Object evaluateExpressionInternal(String expression, String attrName, PageContext pageContext)
throws JspException
{
if (logger.isDebugEnabled())
logger.debug("evaluate expression=\"" + expression + "\"");
Object result = null;
try {
VariableResolver vr = ImplicitObjectUtil.getReadVariableResolver(pageContext);
result = getExpressionEvaluator().evaluateStrict(expression, vr);
}
catch (ExpressionEvaluationException ee) {
// if there is an expression evaluation error set the error and return null
if (logger.isWarnEnabled())
logger.warn(Bundle.getString("Tags_ExpressionEvaluationFailure", expression));
// create the expression info an add it to the error tracking
EvalErrorInfo info = new EvalErrorInfo();
info.evalExcp = ee;
info.expression = expression;
info.attr = attrName;
info.tagType = _tag.getTagName();
// report the error
_tag.registerTagError(info);
return null;
}
catch (Exception e) {
String s = Bundle.getString("Tags_ExpressionEvaluationException", new Object[]{expression, e.toString()});
_tag.registerTagError(s, e);
return null;
}
if (logger.isDebugEnabled()) logger.debug("resulting object: " + result);
return result;
} | java | private Object evaluateExpressionInternal(String expression, String attrName, PageContext pageContext)
throws JspException
{
if (logger.isDebugEnabled())
logger.debug("evaluate expression=\"" + expression + "\"");
Object result = null;
try {
VariableResolver vr = ImplicitObjectUtil.getReadVariableResolver(pageContext);
result = getExpressionEvaluator().evaluateStrict(expression, vr);
}
catch (ExpressionEvaluationException ee) {
// if there is an expression evaluation error set the error and return null
if (logger.isWarnEnabled())
logger.warn(Bundle.getString("Tags_ExpressionEvaluationFailure", expression));
// create the expression info an add it to the error tracking
EvalErrorInfo info = new EvalErrorInfo();
info.evalExcp = ee;
info.expression = expression;
info.attr = attrName;
info.tagType = _tag.getTagName();
// report the error
_tag.registerTagError(info);
return null;
}
catch (Exception e) {
String s = Bundle.getString("Tags_ExpressionEvaluationException", new Object[]{expression, e.toString()});
_tag.registerTagError(s, e);
return null;
}
if (logger.isDebugEnabled()) logger.debug("resulting object: " + result);
return result;
} | [
"private",
"Object",
"evaluateExpressionInternal",
"(",
"String",
"expression",
",",
"String",
"attrName",
",",
"PageContext",
"pageContext",
")",
"throws",
"JspException",
"{",
"if",
"(",
"logger",
".",
"isDebugEnabled",
"(",
")",
")",
"logger",
".",
"debug",
"... | This is the real implementation of evaluateExpression.
@param expression
@param attrName
@return
@throws JspException | [
"This",
"is",
"the",
"real",
"implementation",
"of",
"evaluateExpression",
"."
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/ExpressionHandling.java#L157-L192 |
groovy/groovy-core | subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java | Sql.eachRow | public void eachRow(String sql, Closure closure) throws SQLException {
eachRow(sql, (Closure) null, closure);
} | java | public void eachRow(String sql, Closure closure) throws SQLException {
eachRow(sql, (Closure) null, closure);
} | [
"public",
"void",
"eachRow",
"(",
"String",
"sql",
",",
"Closure",
"closure",
")",
"throws",
"SQLException",
"{",
"eachRow",
"(",
"sql",
",",
"(",
"Closure",
")",
"null",
",",
"closure",
")",
";",
"}"
] | Performs the given SQL query calling the given Closure with each row of the result set.
The row will be a <code>GroovyResultSet</code> which is a <code>ResultSet</code>
that supports accessing the fields using property style notation and ordinal index values.
<p>
Example usages:
<pre>
sql.eachRow("select * from PERSON where firstname like 'S%'") { row ->
println "$row.firstname ${row[2]}}"
}
sql.eachRow "call my_stored_proc_returning_resultset()", {
println it.firstname
}
</pre>
<p>
Resource handling is performed automatically where appropriate.
@param sql the sql statement
@param closure called for each row with a GroovyResultSet
@throws SQLException if a database access error occurs | [
"Performs",
"the",
"given",
"SQL",
"query",
"calling",
"the",
"given",
"Closure",
"with",
"each",
"row",
"of",
"the",
"result",
"set",
".",
"The",
"row",
"will",
"be",
"a",
"<code",
">",
"GroovyResultSet<",
"/",
"code",
">",
"which",
"is",
"a",
"<code",
... | train | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java#L1089-L1091 |
apache/incubator-gobblin | gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/CopyResourcePool.java | CopyResourcePool.fromConfig | public static CopyResourcePool fromConfig(Config limitedScopeConfig) {
try {
String sizeStr = limitedScopeConfig.hasPath(SIZE_KEY) ? limitedScopeConfig.getString(SIZE_KEY) : DEFAULT_MAX_SIZE;
long maxSize = StringParsingUtils.humanReadableToByteCount(sizeStr);
int maxEntities = limitedScopeConfig.hasPath(ENTITIES_KEY) ? limitedScopeConfig.getInt(ENTITIES_KEY) : DEFAULT_MAX_ENTITIES;
double tolerance = limitedScopeConfig.hasPath(TOLERANCE_KEY) ? limitedScopeConfig.getDouble(TOLERANCE_KEY) : DEFAULT_TOLERANCE;
return new CopyResourcePool(ImmutableMap.of(ENTITIES_DIMENSION, (double) maxEntities, BYTES_DIMENSION, (double) maxSize),
ImmutableMap.of(ENTITIES_DIMENSION, tolerance, BYTES_DIMENSION, tolerance),
ImmutableMap.<String, Double>of());
} catch (StringParsingUtils.FormatException fe) {
throw new RuntimeException(fe);
}
} | java | public static CopyResourcePool fromConfig(Config limitedScopeConfig) {
try {
String sizeStr = limitedScopeConfig.hasPath(SIZE_KEY) ? limitedScopeConfig.getString(SIZE_KEY) : DEFAULT_MAX_SIZE;
long maxSize = StringParsingUtils.humanReadableToByteCount(sizeStr);
int maxEntities = limitedScopeConfig.hasPath(ENTITIES_KEY) ? limitedScopeConfig.getInt(ENTITIES_KEY) : DEFAULT_MAX_ENTITIES;
double tolerance = limitedScopeConfig.hasPath(TOLERANCE_KEY) ? limitedScopeConfig.getDouble(TOLERANCE_KEY) : DEFAULT_TOLERANCE;
return new CopyResourcePool(ImmutableMap.of(ENTITIES_DIMENSION, (double) maxEntities, BYTES_DIMENSION, (double) maxSize),
ImmutableMap.of(ENTITIES_DIMENSION, tolerance, BYTES_DIMENSION, tolerance),
ImmutableMap.<String, Double>of());
} catch (StringParsingUtils.FormatException fe) {
throw new RuntimeException(fe);
}
} | [
"public",
"static",
"CopyResourcePool",
"fromConfig",
"(",
"Config",
"limitedScopeConfig",
")",
"{",
"try",
"{",
"String",
"sizeStr",
"=",
"limitedScopeConfig",
".",
"hasPath",
"(",
"SIZE_KEY",
")",
"?",
"limitedScopeConfig",
".",
"getString",
"(",
"SIZE_KEY",
")"... | Parse a {@link CopyResourcePool} from an input {@link Config}. | [
"Parse",
"a",
"{"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/CopyResourcePool.java#L50-L63 |
michel-kraemer/citeproc-java | citeproc-java/src/main/java/de/undercouch/citeproc/bibtex/DateParser.java | DateParser.tryParseMonth | private static int tryParseMonth(String month, Locale locale) {
Map<String, Integer> names = getMonthNames(locale);
Integer r = names.get(month.toUpperCase());
if (r != null) {
return r;
}
return -1;
} | java | private static int tryParseMonth(String month, Locale locale) {
Map<String, Integer> names = getMonthNames(locale);
Integer r = names.get(month.toUpperCase());
if (r != null) {
return r;
}
return -1;
} | [
"private",
"static",
"int",
"tryParseMonth",
"(",
"String",
"month",
",",
"Locale",
"locale",
")",
"{",
"Map",
"<",
"String",
",",
"Integer",
">",
"names",
"=",
"getMonthNames",
"(",
"locale",
")",
";",
"Integer",
"r",
"=",
"names",
".",
"get",
"(",
"m... | Tries to parse the given month string using the month names
of the given locale
@param month the month string
@param locale the locale
@return the month's number (<code>1-12</code>) or <code>-1</code> if
the string could not be parsed | [
"Tries",
"to",
"parse",
"the",
"given",
"month",
"string",
"using",
"the",
"month",
"names",
"of",
"the",
"given",
"locale"
] | train | https://github.com/michel-kraemer/citeproc-java/blob/1d5bf0e7bbb2bdc47309530babf0ecaba838bf10/citeproc-java/src/main/java/de/undercouch/citeproc/bibtex/DateParser.java#L328-L335 |
gallandarakhneorg/afc | advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/layer/BusNetworkLayer.java | BusNetworkLayer.onBusLineAdded | protected boolean onBusLineAdded(BusLine line, int index) {
if (this.autoUpdate.get()) {
try {
addMapLayer(index, new BusLineLayer(line, isLayerAutoUpdated()));
return true;
} catch (Throwable exception) {
//
}
}
return false;
} | java | protected boolean onBusLineAdded(BusLine line, int index) {
if (this.autoUpdate.get()) {
try {
addMapLayer(index, new BusLineLayer(line, isLayerAutoUpdated()));
return true;
} catch (Throwable exception) {
//
}
}
return false;
} | [
"protected",
"boolean",
"onBusLineAdded",
"(",
"BusLine",
"line",
",",
"int",
"index",
")",
"{",
"if",
"(",
"this",
".",
"autoUpdate",
".",
"get",
"(",
")",
")",
"{",
"try",
"{",
"addMapLayer",
"(",
"index",
",",
"new",
"BusLineLayer",
"(",
"line",
","... | Invoked when a bus line was added in the attached network.
<p>This function exists to allow be override to provide a specific behaviour
when a bus line has been added.
@param line is the new line.
@param index is the index of the bus line.
@return <code>true</code> if the events was fired, otherwise <code>false</code>. | [
"Invoked",
"when",
"a",
"bus",
"line",
"was",
"added",
"in",
"the",
"attached",
"network",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/layer/BusNetworkLayer.java#L264-L274 |
looly/hutool | hutool-crypto/src/main/java/cn/hutool/crypto/digest/HMac.java | HMac.init | public HMac init(String algorithm, byte[] key){
return init(algorithm, (null == key) ? null : new SecretKeySpec(key, algorithm));
} | java | public HMac init(String algorithm, byte[] key){
return init(algorithm, (null == key) ? null : new SecretKeySpec(key, algorithm));
} | [
"public",
"HMac",
"init",
"(",
"String",
"algorithm",
",",
"byte",
"[",
"]",
"key",
")",
"{",
"return",
"init",
"(",
"algorithm",
",",
"(",
"null",
"==",
"key",
")",
"?",
"null",
":",
"new",
"SecretKeySpec",
"(",
"key",
",",
"algorithm",
")",
")",
... | 初始化
@param algorithm 算法
@param key 密钥
@return {@link HMac}
@throws CryptoException Cause by IOException | [
"初始化"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/digest/HMac.java#L69-L71 |
LearnLib/automatalib | visualization/dot-visualizer/src/main/java/net/automatalib/visualization/dot/DOT.java | DOT.runDOT | public static InputStream runDOT(Reader r, String format, String... additionalOpts) throws IOException {
String[] dotCommand = buildDOTCommand(format, additionalOpts);
Process p = ProcessUtil.buildProcess(dotCommand, r, null, LOGGER::warn);
return p.getInputStream();
} | java | public static InputStream runDOT(Reader r, String format, String... additionalOpts) throws IOException {
String[] dotCommand = buildDOTCommand(format, additionalOpts);
Process p = ProcessUtil.buildProcess(dotCommand, r, null, LOGGER::warn);
return p.getInputStream();
} | [
"public",
"static",
"InputStream",
"runDOT",
"(",
"Reader",
"r",
",",
"String",
"format",
",",
"String",
"...",
"additionalOpts",
")",
"throws",
"IOException",
"{",
"String",
"[",
"]",
"dotCommand",
"=",
"buildDOTCommand",
"(",
"format",
",",
"additionalOpts",
... | Invokes the GraphVIZ DOT utility for rendering graphs.
@param r
the reader from which the GraphVIZ description is obtained.
@param format
the output format, as understood by the dot utility, e.g., png, ps, ...
@return an input stream from which the image data can be read.
@throws IOException
if reading from the specified reader fails. | [
"Invokes",
"the",
"GraphVIZ",
"DOT",
"utility",
"for",
"rendering",
"graphs",
"."
] | train | https://github.com/LearnLib/automatalib/blob/8a462ec52f6eaab9f8996e344f2163a72cb8aa6e/visualization/dot-visualizer/src/main/java/net/automatalib/visualization/dot/DOT.java#L138-L144 |
marklogic/java-client-api | marklogic-client-api/src/main/java/com/marklogic/client/query/StructuredQueryBuilder.java | StructuredQueryBuilder.rangeConstraint | public StructuredQueryDefinition rangeConstraint(String constraintName, Operator operator, String... values) {
return new RangeConstraintQuery(constraintName, operator, values);
} | java | public StructuredQueryDefinition rangeConstraint(String constraintName, Operator operator, String... values) {
return new RangeConstraintQuery(constraintName, operator, values);
} | [
"public",
"StructuredQueryDefinition",
"rangeConstraint",
"(",
"String",
"constraintName",
",",
"Operator",
"operator",
",",
"String",
"...",
"values",
")",
"{",
"return",
"new",
"RangeConstraintQuery",
"(",
"constraintName",
",",
"operator",
",",
"values",
")",
";"... | Matches the container specified by the constraint
whose value that has the correct datatyped comparison with
one of the criteria values.
@param constraintName the constraint definition
@param operator the comparison with the criteria values
@param values the possible datatyped values for the comparison
@return the StructuredQueryDefinition for the range constraint query | [
"Matches",
"the",
"container",
"specified",
"by",
"the",
"constraint",
"whose",
"value",
"that",
"has",
"the",
"correct",
"datatyped",
"comparison",
"with",
"one",
"of",
"the",
"criteria",
"values",
"."
] | train | https://github.com/marklogic/java-client-api/blob/acf60229a928abd4a8cc4b21b641d56957467da7/marklogic-client-api/src/main/java/com/marklogic/client/query/StructuredQueryBuilder.java#L1080-L1082 |
Impetus/Kundera | src/kundera-cassandra/cassandra-pelops/src/main/java/com/impetus/client/cassandra/pelops/PelopsUtils.java | PelopsUtils.getAuthenticationRequest | public static SimpleConnectionAuthenticator getAuthenticationRequest(String userName, String password)
{
SimpleConnectionAuthenticator authenticator = null;
if (userName != null || password != null)
{
authenticator = new SimpleConnectionAuthenticator(userName, password);
}
return authenticator;
} | java | public static SimpleConnectionAuthenticator getAuthenticationRequest(String userName, String password)
{
SimpleConnectionAuthenticator authenticator = null;
if (userName != null || password != null)
{
authenticator = new SimpleConnectionAuthenticator(userName, password);
}
return authenticator;
} | [
"public",
"static",
"SimpleConnectionAuthenticator",
"getAuthenticationRequest",
"(",
"String",
"userName",
",",
"String",
"password",
")",
"{",
"SimpleConnectionAuthenticator",
"authenticator",
"=",
"null",
";",
"if",
"(",
"userName",
"!=",
"null",
"||",
"password",
... | If userName and password provided, Method prepares for
AuthenticationRequest.
@param props
properties
@return simple authenticator request. returns null if userName/password
are not provided. | [
"If",
"userName",
"and",
"password",
"provided",
"Method",
"prepares",
"for",
"AuthenticationRequest",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-cassandra/cassandra-pelops/src/main/java/com/impetus/client/cassandra/pelops/PelopsUtils.java#L89-L97 |
alkacon/opencms-core | src-gwt/org/opencms/gwt/client/seo/CmsAliasList.java | CmsAliasList.validate | public void validate(final Runnable nextAction) {
validateFull(m_structureId, getAliasPaths(), new AsyncCallback<Map<String, String>>() {
public void onFailure(Throwable caught) {
// do nothing
}
public void onSuccess(Map<String, String> result) {
for (Map.Entry<String, String> entry : result.entrySet()) {
if (entry.getValue() != null) {
m_hasValidationErrors = true;
}
}
m_defaultValidationHandler.onSuccess(result);
nextAction.run();
}
});
} | java | public void validate(final Runnable nextAction) {
validateFull(m_structureId, getAliasPaths(), new AsyncCallback<Map<String, String>>() {
public void onFailure(Throwable caught) {
// do nothing
}
public void onSuccess(Map<String, String> result) {
for (Map.Entry<String, String> entry : result.entrySet()) {
if (entry.getValue() != null) {
m_hasValidationErrors = true;
}
}
m_defaultValidationHandler.onSuccess(result);
nextAction.run();
}
});
} | [
"public",
"void",
"validate",
"(",
"final",
"Runnable",
"nextAction",
")",
"{",
"validateFull",
"(",
"m_structureId",
",",
"getAliasPaths",
"(",
")",
",",
"new",
"AsyncCallback",
"<",
"Map",
"<",
"String",
",",
"String",
">",
">",
"(",
")",
"{",
"public",
... | Simplified method to perform a full validation of the aliases in the list and execute an action afterwards.<p>
@param nextAction the action to execute after the validation finished | [
"Simplified",
"method",
"to",
"perform",
"a",
"full",
"validation",
"of",
"the",
"aliases",
"in",
"the",
"list",
"and",
"execute",
"an",
"action",
"afterwards",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/seo/CmsAliasList.java#L393-L414 |
FasterXML/woodstox | src/main/java/com/ctc/wstx/sr/StreamScanner.java | StreamScanner.initInputSource | protected void initInputSource(WstxInputSource newInput, boolean isExt,
String entityId)
throws XMLStreamException
{
// Let's make sure new input will be read next time input is needed:
mInputPtr = 0;
mInputEnd = 0;
/* Plus, reset the input location so that'll be accurate for
* error reporting etc.
*/
mInputTopDepth = mCurrDepth;
// [WSTX-296]: Check for entity expansion depth against configurable limit
int entityDepth = mInput.getEntityDepth() + 1;
verifyLimit("Maximum entity expansion depth", mConfig.getMaxEntityDepth(), entityDepth);
mInput = newInput;
mInput.initInputLocation(this, mCurrDepth, entityDepth);
/* 21-Feb-2006, TSa: Linefeeds are NOT normalized when expanding
* internal entities (XML, 2.11)
*/
if (isExt) {
mNormalizeLFs = true;
} else {
mNormalizeLFs = false;
}
} | java | protected void initInputSource(WstxInputSource newInput, boolean isExt,
String entityId)
throws XMLStreamException
{
// Let's make sure new input will be read next time input is needed:
mInputPtr = 0;
mInputEnd = 0;
/* Plus, reset the input location so that'll be accurate for
* error reporting etc.
*/
mInputTopDepth = mCurrDepth;
// [WSTX-296]: Check for entity expansion depth against configurable limit
int entityDepth = mInput.getEntityDepth() + 1;
verifyLimit("Maximum entity expansion depth", mConfig.getMaxEntityDepth(), entityDepth);
mInput = newInput;
mInput.initInputLocation(this, mCurrDepth, entityDepth);
/* 21-Feb-2006, TSa: Linefeeds are NOT normalized when expanding
* internal entities (XML, 2.11)
*/
if (isExt) {
mNormalizeLFs = true;
} else {
mNormalizeLFs = false;
}
} | [
"protected",
"void",
"initInputSource",
"(",
"WstxInputSource",
"newInput",
",",
"boolean",
"isExt",
",",
"String",
"entityId",
")",
"throws",
"XMLStreamException",
"{",
"// Let's make sure new input will be read next time input is needed:",
"mInputPtr",
"=",
"0",
";",
"mIn... | Method called when an entity has been expanded (new input source
has been created). Needs to initialize location information and change
active input source.
@param entityId Name of the entity being expanded | [
"Method",
"called",
"when",
"an",
"entity",
"has",
"been",
"expanded",
"(",
"new",
"input",
"source",
"has",
"been",
"created",
")",
".",
"Needs",
"to",
"initialize",
"location",
"information",
"and",
"change",
"active",
"input",
"source",
"."
] | train | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/sr/StreamScanner.java#L962-L988 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java | ImgUtil.flip | public static void flip(Image image, OutputStream out) throws IORuntimeException {
flip(image, getImageOutputStream(out));
} | java | public static void flip(Image image, OutputStream out) throws IORuntimeException {
flip(image, getImageOutputStream(out));
} | [
"public",
"static",
"void",
"flip",
"(",
"Image",
"image",
",",
"OutputStream",
"out",
")",
"throws",
"IORuntimeException",
"{",
"flip",
"(",
"image",
",",
"getImageOutputStream",
"(",
"out",
")",
")",
";",
"}"
] | 水平翻转图像
@param image 图像
@param out 输出
@throws IORuntimeException IO异常
@since 3.2.2 | [
"水平翻转图像"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L1094-L1096 |
aws/aws-sdk-java | aws-java-sdk-ssm/src/main/java/com/amazonaws/services/simplesystemsmanagement/model/ListInventoryEntriesResult.java | ListInventoryEntriesResult.setEntries | public void setEntries(java.util.Collection<java.util.Map<String, String>> entries) {
if (entries == null) {
this.entries = null;
return;
}
this.entries = new com.amazonaws.internal.SdkInternalList<java.util.Map<String, String>>(entries);
} | java | public void setEntries(java.util.Collection<java.util.Map<String, String>> entries) {
if (entries == null) {
this.entries = null;
return;
}
this.entries = new com.amazonaws.internal.SdkInternalList<java.util.Map<String, String>>(entries);
} | [
"public",
"void",
"setEntries",
"(",
"java",
".",
"util",
".",
"Collection",
"<",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
">",
"entries",
")",
"{",
"if",
"(",
"entries",
"==",
"null",
")",
"{",
"this",
".",
"entries",
"=... | <p>
A list of inventory items on the instance(s).
</p>
@param entries
A list of inventory items on the instance(s). | [
"<p",
">",
"A",
"list",
"of",
"inventory",
"items",
"on",
"the",
"instance",
"(",
"s",
")",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-ssm/src/main/java/com/amazonaws/services/simplesystemsmanagement/model/ListInventoryEntriesResult.java#L248-L255 |
haraldk/TwelveMonkeys | servlet/src/main/java/com/twelvemonkeys/servlet/cache/HTTPCache.java | HTTPCache.doCached | public void doCached(final CacheRequest pRequest, final CacheResponse pResponse, final ResponseResolver pResolver) throws IOException, CacheException {
// TODO: Expire cached items on PUT/POST/DELETE/PURGE
// If not cachable request, resolve directly
if (!isCacheable(pRequest)) {
pResolver.resolve(pRequest, pResponse);
}
else {
// Generate cacheURI
String cacheURI = generateCacheURI(pRequest);
// System.out.println(" ## HTTPCache ## Request Id (cacheURI): " + cacheURI);
// Get/create cached entity
CachedEntity cached;
synchronized (entityCache) {
cached = entityCache.get(cacheURI);
if (cached == null) {
cached = new CachedEntityImpl(cacheURI, this);
entityCache.put(cacheURI, cached);
}
}
// else if (not cached || stale), resolve through wrapped (caching) response
// else render to response
// TODO: This is a bottleneck for uncachable resources. Should not
// synchronize, if we know (HOW?) the resource is not cachable.
synchronized (cached) {
if (cached.isStale(pRequest) /* TODO: NOT CACHED?! */) {
// Go fetch...
WritableCachedResponse cachedResponse = cached.createCachedResponse();
pResolver.resolve(pRequest, cachedResponse);
if (isCachable(cachedResponse)) {
// System.out.println("Registering content: " + cachedResponse.getCachedResponse());
registerContent(cacheURI, pRequest, cachedResponse.getCachedResponse());
}
else {
// TODO: What about non-cachable responses? We need to either remove them from cache, or mark them as stale...
// Best is probably to mark as non-cacheable for later, and NOT store content (performance)
// System.out.println("Non-cacheable response: " + cachedResponse);
// TODO: Write, but should really do this unbuffered.... And some resolver might be able to do just that?
// Might need a resolver.isWriteThroughForUncachableResources() method...
pResponse.setStatus(cachedResponse.getStatus());
cachedResponse.writeHeadersTo(pResponse);
cachedResponse.writeContentsTo(pResponse.getOutputStream());
return;
}
}
}
cached.render(pRequest, pResponse);
}
} | java | public void doCached(final CacheRequest pRequest, final CacheResponse pResponse, final ResponseResolver pResolver) throws IOException, CacheException {
// TODO: Expire cached items on PUT/POST/DELETE/PURGE
// If not cachable request, resolve directly
if (!isCacheable(pRequest)) {
pResolver.resolve(pRequest, pResponse);
}
else {
// Generate cacheURI
String cacheURI = generateCacheURI(pRequest);
// System.out.println(" ## HTTPCache ## Request Id (cacheURI): " + cacheURI);
// Get/create cached entity
CachedEntity cached;
synchronized (entityCache) {
cached = entityCache.get(cacheURI);
if (cached == null) {
cached = new CachedEntityImpl(cacheURI, this);
entityCache.put(cacheURI, cached);
}
}
// else if (not cached || stale), resolve through wrapped (caching) response
// else render to response
// TODO: This is a bottleneck for uncachable resources. Should not
// synchronize, if we know (HOW?) the resource is not cachable.
synchronized (cached) {
if (cached.isStale(pRequest) /* TODO: NOT CACHED?! */) {
// Go fetch...
WritableCachedResponse cachedResponse = cached.createCachedResponse();
pResolver.resolve(pRequest, cachedResponse);
if (isCachable(cachedResponse)) {
// System.out.println("Registering content: " + cachedResponse.getCachedResponse());
registerContent(cacheURI, pRequest, cachedResponse.getCachedResponse());
}
else {
// TODO: What about non-cachable responses? We need to either remove them from cache, or mark them as stale...
// Best is probably to mark as non-cacheable for later, and NOT store content (performance)
// System.out.println("Non-cacheable response: " + cachedResponse);
// TODO: Write, but should really do this unbuffered.... And some resolver might be able to do just that?
// Might need a resolver.isWriteThroughForUncachableResources() method...
pResponse.setStatus(cachedResponse.getStatus());
cachedResponse.writeHeadersTo(pResponse);
cachedResponse.writeContentsTo(pResponse.getOutputStream());
return;
}
}
}
cached.render(pRequest, pResponse);
}
} | [
"public",
"void",
"doCached",
"(",
"final",
"CacheRequest",
"pRequest",
",",
"final",
"CacheResponse",
"pResponse",
",",
"final",
"ResponseResolver",
"pResolver",
")",
"throws",
"IOException",
",",
"CacheException",
"{",
"// TODO: Expire cached items on PUT/POST/DELETE/PURG... | Looks up the {@code CachedEntity} for the given request.
@param pRequest the request
@param pResponse the response
@param pResolver the resolver
@throws java.io.IOException if an I/O error occurs
@throws CacheException if the cached entity can't be resolved for some reason | [
"Looks",
"up",
"the",
"{",
"@code",
"CachedEntity",
"}",
"for",
"the",
"given",
"request",
"."
] | train | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/servlet/src/main/java/com/twelvemonkeys/servlet/cache/HTTPCache.java#L339-L392 |
Wadpam/guja | guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDUserDaoImpl.java | GeneratedDUserDaoImpl.queryByUpdatedDate | public Iterable<DUser> queryByUpdatedDate(java.util.Date updatedDate) {
return queryByField(null, DUserMapper.Field.UPDATEDDATE.getFieldName(), updatedDate);
} | java | public Iterable<DUser> queryByUpdatedDate(java.util.Date updatedDate) {
return queryByField(null, DUserMapper.Field.UPDATEDDATE.getFieldName(), updatedDate);
} | [
"public",
"Iterable",
"<",
"DUser",
">",
"queryByUpdatedDate",
"(",
"java",
".",
"util",
".",
"Date",
"updatedDate",
")",
"{",
"return",
"queryByField",
"(",
"null",
",",
"DUserMapper",
".",
"Field",
".",
"UPDATEDDATE",
".",
"getFieldName",
"(",
")",
",",
... | query-by method for field updatedDate
@param updatedDate the specified attribute
@return an Iterable of DUsers for the specified updatedDate | [
"query",
"-",
"by",
"method",
"for",
"field",
"updatedDate"
] | train | https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDUserDaoImpl.java#L268-L270 |
aws/aws-sdk-java | aws-java-sdk-apigatewayv2/src/main/java/com/amazonaws/services/apigatewayv2/model/CreateIntegrationRequest.java | CreateIntegrationRequest.withRequestParameters | public CreateIntegrationRequest withRequestParameters(java.util.Map<String, String> requestParameters) {
setRequestParameters(requestParameters);
return this;
} | java | public CreateIntegrationRequest withRequestParameters(java.util.Map<String, String> requestParameters) {
setRequestParameters(requestParameters);
return this;
} | [
"public",
"CreateIntegrationRequest",
"withRequestParameters",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"requestParameters",
")",
"{",
"setRequestParameters",
"(",
"requestParameters",
")",
";",
"return",
"this",
";",
"}"
] | <p>
A key-value map specifying request parameters that are passed from the method request to the backend. The key is
an integration request parameter name and the associated value is a method request parameter value or static
value that must be enclosed within single quotes and pre-encoded as required by the backend. The method request
parameter value must match the pattern of method.request.{location}.{name} , where {location} is querystring,
path, or header; and {name} must be a valid and unique method request parameter name.
</p>
@param requestParameters
A key-value map specifying request parameters that are passed from the method request to the backend. The
key is an integration request parameter name and the associated value is a method request parameter value
or static value that must be enclosed within single quotes and pre-encoded as required by the backend. The
method request parameter value must match the pattern of method.request.{location}.{name} , where
{location} is querystring, path, or header; and {name} must be a valid and unique method request parameter
name.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"A",
"key",
"-",
"value",
"map",
"specifying",
"request",
"parameters",
"that",
"are",
"passed",
"from",
"the",
"method",
"request",
"to",
"the",
"backend",
".",
"The",
"key",
"is",
"an",
"integration",
"request",
"parameter",
"name",
"and",
"th... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-apigatewayv2/src/main/java/com/amazonaws/services/apigatewayv2/model/CreateIntegrationRequest.java#L1088-L1091 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/IntTrie.java | IntTrie.getTrailValue | public final int getTrailValue(int leadvalue, char trail)
{
if (m_dataManipulate_ == null) {
throw new NullPointerException(
"The field DataManipulate in this Trie is null");
}
int offset = m_dataManipulate_.getFoldingOffset(leadvalue);
if (offset > 0) {
return m_data_[getRawOffset(offset,
(char)(trail & SURROGATE_MASK_))];
}
return m_initialValue_;
} | java | public final int getTrailValue(int leadvalue, char trail)
{
if (m_dataManipulate_ == null) {
throw new NullPointerException(
"The field DataManipulate in this Trie is null");
}
int offset = m_dataManipulate_.getFoldingOffset(leadvalue);
if (offset > 0) {
return m_data_[getRawOffset(offset,
(char)(trail & SURROGATE_MASK_))];
}
return m_initialValue_;
} | [
"public",
"final",
"int",
"getTrailValue",
"(",
"int",
"leadvalue",
",",
"char",
"trail",
")",
"{",
"if",
"(",
"m_dataManipulate_",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"The field DataManipulate in this Trie is null\"",
")",
";",
... | Get a value from a folding offset (from the value of a lead surrogate)
and a trail surrogate.
@param leadvalue the value of a lead surrogate that contains the
folding offset
@param trail surrogate
@return trie data value associated with the trail character | [
"Get",
"a",
"value",
"from",
"a",
"folding",
"offset",
"(",
"from",
"the",
"value",
"of",
"a",
"lead",
"surrogate",
")",
"and",
"a",
"trail",
"surrogate",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/IntTrie.java#L193-L205 |
apache/reef | lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/driver/YarnContainerManager.java | YarnContainerManager.onStart | void onStart() {
LOG.log(Level.FINEST, "YARN registration: begin");
this.nodeManager.init(this.yarnConf);
this.nodeManager.start();
try {
this.yarnProxyUser.doAs(
new PrivilegedExceptionAction<Object>() {
@Override
public Object run() throws Exception {
resourceManager.init(yarnConf);
resourceManager.start();
return null;
}
});
LOG.log(Level.FINE, "YARN registration: register AM at \"{0}:{1}\" tracking URL \"{2}\"",
new Object[] {amRegistrationHost, AM_REGISTRATION_PORT, this.trackingUrl});
this.registration.setRegistration(this.resourceManager.registerApplicationMaster(
amRegistrationHost, AM_REGISTRATION_PORT, this.trackingUrl));
LOG.log(Level.FINE, "YARN registration: AM registered: {0}", this.registration);
final FileSystem fs = FileSystem.get(this.yarnConf);
final Path outputFileName = new Path(this.jobSubmissionDirectory, this.reefFileNames.getDriverHttpEndpoint());
try (final FSDataOutputStream out = fs.create(outputFileName)) {
out.writeBytes(this.trackingUrl + '\n');
}
} catch (final Exception e) {
LOG.log(Level.WARNING, "Unable to register application master.", e);
onRuntimeError(e);
}
LOG.log(Level.FINEST, "YARN registration: done: {0}", this.registration);
} | java | void onStart() {
LOG.log(Level.FINEST, "YARN registration: begin");
this.nodeManager.init(this.yarnConf);
this.nodeManager.start();
try {
this.yarnProxyUser.doAs(
new PrivilegedExceptionAction<Object>() {
@Override
public Object run() throws Exception {
resourceManager.init(yarnConf);
resourceManager.start();
return null;
}
});
LOG.log(Level.FINE, "YARN registration: register AM at \"{0}:{1}\" tracking URL \"{2}\"",
new Object[] {amRegistrationHost, AM_REGISTRATION_PORT, this.trackingUrl});
this.registration.setRegistration(this.resourceManager.registerApplicationMaster(
amRegistrationHost, AM_REGISTRATION_PORT, this.trackingUrl));
LOG.log(Level.FINE, "YARN registration: AM registered: {0}", this.registration);
final FileSystem fs = FileSystem.get(this.yarnConf);
final Path outputFileName = new Path(this.jobSubmissionDirectory, this.reefFileNames.getDriverHttpEndpoint());
try (final FSDataOutputStream out = fs.create(outputFileName)) {
out.writeBytes(this.trackingUrl + '\n');
}
} catch (final Exception e) {
LOG.log(Level.WARNING, "Unable to register application master.", e);
onRuntimeError(e);
}
LOG.log(Level.FINEST, "YARN registration: done: {0}", this.registration);
} | [
"void",
"onStart",
"(",
")",
"{",
"LOG",
".",
"log",
"(",
"Level",
".",
"FINEST",
",",
"\"YARN registration: begin\"",
")",
";",
"this",
".",
"nodeManager",
".",
"init",
"(",
"this",
".",
"yarnConf",
")",
";",
"this",
".",
"nodeManager",
".",
"start",
... | Start the YARN container manager.
This method is called from DriverRuntimeStartHandler via YARNRuntimeStartHandler. | [
"Start",
"the",
"YARN",
"container",
"manager",
".",
"This",
"method",
"is",
"called",
"from",
"DriverRuntimeStartHandler",
"via",
"YARNRuntimeStartHandler",
"."
] | train | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/driver/YarnContainerManager.java#L318-L358 |
mozilla/rhino | src/org/mozilla/javascript/ScriptRuntime.java | ScriptRuntime.getObjectProp | @Deprecated
public static Object getObjectProp(Object obj, String property,
Context cx)
{
return getObjectProp(obj, property, cx, getTopCallScope(cx));
} | java | @Deprecated
public static Object getObjectProp(Object obj, String property,
Context cx)
{
return getObjectProp(obj, property, cx, getTopCallScope(cx));
} | [
"@",
"Deprecated",
"public",
"static",
"Object",
"getObjectProp",
"(",
"Object",
"obj",
",",
"String",
"property",
",",
"Context",
"cx",
")",
"{",
"return",
"getObjectProp",
"(",
"obj",
",",
"property",
",",
"cx",
",",
"getTopCallScope",
"(",
"cx",
")",
")... | Version of getObjectElem when elem is a valid JS identifier name.
@deprecated Use {@link #getObjectProp(Object, String, Context, Scriptable)} instead | [
"Version",
"of",
"getObjectElem",
"when",
"elem",
"is",
"a",
"valid",
"JS",
"identifier",
"name",
"."
] | train | https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/ScriptRuntime.java#L1563-L1568 |
stevespringett/Alpine | alpine/src/main/java/alpine/persistence/AbstractAlpineQueryManager.java | AbstractAlpineQueryManager.getCount | public long getCount(final Query query, final Map parameters) {
final String ordering = ((JDOQuery) query).getInternalQuery().getOrdering();
query.setResult("count(id)");
query.setOrdering(null);
final long count = (Long) query.executeWithMap(parameters);
query.setOrdering(ordering);
return count;
} | java | public long getCount(final Query query, final Map parameters) {
final String ordering = ((JDOQuery) query).getInternalQuery().getOrdering();
query.setResult("count(id)");
query.setOrdering(null);
final long count = (Long) query.executeWithMap(parameters);
query.setOrdering(ordering);
return count;
} | [
"public",
"long",
"getCount",
"(",
"final",
"Query",
"query",
",",
"final",
"Map",
"parameters",
")",
"{",
"final",
"String",
"ordering",
"=",
"(",
"(",
"JDOQuery",
")",
"query",
")",
".",
"getInternalQuery",
"(",
")",
".",
"getOrdering",
"(",
")",
";",
... | Returns the number of items that would have resulted from returning all object.
This method is performant in that the objects are not actually retrieved, only
the count.
@param query the query to return a count from
@param parameters the <code>Map</code> containing all of the parameters.
@return the number of items
@since 1.0.0 | [
"Returns",
"the",
"number",
"of",
"items",
"that",
"would",
"have",
"resulted",
"from",
"returning",
"all",
"object",
".",
"This",
"method",
"is",
"performant",
"in",
"that",
"the",
"objects",
"are",
"not",
"actually",
"retrieved",
"only",
"the",
"count",
".... | train | https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/persistence/AbstractAlpineQueryManager.java#L362-L369 |
timols/java-gitlab-api | src/main/java/org/gitlab/api/GitlabAPI.java | GitlabAPI.getRunners | public List<GitlabRunner> getRunners(GitlabRunner.RunnerScope scope) throws IOException {
return getRunnersWithPagination(scope, null);
} | java | public List<GitlabRunner> getRunners(GitlabRunner.RunnerScope scope) throws IOException {
return getRunnersWithPagination(scope, null);
} | [
"public",
"List",
"<",
"GitlabRunner",
">",
"getRunners",
"(",
"GitlabRunner",
".",
"RunnerScope",
"scope",
")",
"throws",
"IOException",
"{",
"return",
"getRunnersWithPagination",
"(",
"scope",
",",
"null",
")",
";",
"}"
] | Returns a List of GitlabRunners.
@param scope Can be null. Defines type of Runner to retrieve.
@return List of GitLabRunners
@throws IOException on Gitlab API call error | [
"Returns",
"a",
"List",
"of",
"GitlabRunners",
"."
] | train | https://github.com/timols/java-gitlab-api/blob/f03eedf952cfbb40306be3bf9234dcf78fab029e/src/main/java/org/gitlab/api/GitlabAPI.java#L3954-L3956 |
guardtime/ksi-java-sdk | ksi-common/src/main/java/com/guardtime/ksi/hashing/DataHasher.java | DataHasher.addData | public final DataHasher addData(File file, int bufferSize) {
Util.notNull(file, "File");
FileInputStream inStream = null;
try {
inStream = new FileInputStream(file);
return addData(inStream, bufferSize);
} catch (FileNotFoundException e) {
throw new IllegalArgumentException("File not found, when calculating data hash", e);
} finally {
Util.closeQuietly(inStream);
}
} | java | public final DataHasher addData(File file, int bufferSize) {
Util.notNull(file, "File");
FileInputStream inStream = null;
try {
inStream = new FileInputStream(file);
return addData(inStream, bufferSize);
} catch (FileNotFoundException e) {
throw new IllegalArgumentException("File not found, when calculating data hash", e);
} finally {
Util.closeQuietly(inStream);
}
} | [
"public",
"final",
"DataHasher",
"addData",
"(",
"File",
"file",
",",
"int",
"bufferSize",
")",
"{",
"Util",
".",
"notNull",
"(",
"file",
",",
"\"File\"",
")",
";",
"FileInputStream",
"inStream",
"=",
"null",
";",
"try",
"{",
"inStream",
"=",
"new",
"Fil... | Adds data to the digest using the specified file, starting at the offset 0.
@param file input file.
@param bufferSize size of buffer for reading data.
@return The same {@link DataHasher} object for chaining calls.
@throws HashException when hash calculation fails.
@throws NullPointerException when input file is null. | [
"Adds",
"data",
"to",
"the",
"digest",
"using",
"the",
"specified",
"file",
"starting",
"at",
"the",
"offset",
"0",
"."
] | train | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-common/src/main/java/com/guardtime/ksi/hashing/DataHasher.java#L246-L257 |
sarl/sarl | main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/externalspec/AbstractExternalHighlightingFragment2.java | AbstractExternalHighlightingFragment2.writeFile | protected void writeFile(String basename, byte[] content,
Function2<? super File, ? super String, ? extends File> outputDirectoryFilter) {
for (final String output : getOutputs()) {
File directory = new File(output).getAbsoluteFile();
if (outputDirectoryFilter != null) {
directory = outputDirectoryFilter.apply(directory, basename);
}
try {
final File outputFile = new File(directory, basename);
outputFile.getParentFile().mkdirs();
Files.write(Paths.get(outputFile.getAbsolutePath()), content);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
} | java | protected void writeFile(String basename, byte[] content,
Function2<? super File, ? super String, ? extends File> outputDirectoryFilter) {
for (final String output : getOutputs()) {
File directory = new File(output).getAbsoluteFile();
if (outputDirectoryFilter != null) {
directory = outputDirectoryFilter.apply(directory, basename);
}
try {
final File outputFile = new File(directory, basename);
outputFile.getParentFile().mkdirs();
Files.write(Paths.get(outputFile.getAbsolutePath()), content);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
} | [
"protected",
"void",
"writeFile",
"(",
"String",
"basename",
",",
"byte",
"[",
"]",
"content",
",",
"Function2",
"<",
"?",
"super",
"File",
",",
"?",
"super",
"String",
",",
"?",
"extends",
"File",
">",
"outputDirectoryFilter",
")",
"{",
"for",
"(",
"fin... | Write the given lines into the file.
@param basename the basename of the file.
@param content the content of the style file.
@param outputDirectoryFilter the output directory.
@since 0.6 | [
"Write",
"the",
"given",
"lines",
"into",
"the",
"file",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/externalspec/AbstractExternalHighlightingFragment2.java#L644-L659 |
aNNiMON/Lightweight-Stream-API | stream/src/main/java/com/annimon/stream/RandomCompat.java | RandomCompat.ints | @NotNull
public IntStream ints(final int randomNumberOrigin, final int randomNumberBound) {
if (randomNumberOrigin >= randomNumberBound) {
throw new IllegalArgumentException();
}
return IntStream.generate(new IntSupplier() {
private final int bound = randomNumberBound - randomNumberOrigin;
@Override
public int getAsInt() {
if (bound < 0) {
// range not representable as int
int result;
do {
result = random.nextInt();
} while (randomNumberOrigin >= result || result >= randomNumberBound);
return result;
}
return randomNumberOrigin + random.nextInt(bound);
}
});
} | java | @NotNull
public IntStream ints(final int randomNumberOrigin, final int randomNumberBound) {
if (randomNumberOrigin >= randomNumberBound) {
throw new IllegalArgumentException();
}
return IntStream.generate(new IntSupplier() {
private final int bound = randomNumberBound - randomNumberOrigin;
@Override
public int getAsInt() {
if (bound < 0) {
// range not representable as int
int result;
do {
result = random.nextInt();
} while (randomNumberOrigin >= result || result >= randomNumberBound);
return result;
}
return randomNumberOrigin + random.nextInt(bound);
}
});
} | [
"@",
"NotNull",
"public",
"IntStream",
"ints",
"(",
"final",
"int",
"randomNumberOrigin",
",",
"final",
"int",
"randomNumberBound",
")",
"{",
"if",
"(",
"randomNumberOrigin",
">=",
"randomNumberBound",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
")"... | Returns an effectively unlimited stream of pseudorandom {@code int}
values, each conforming to the given origin (inclusive) and bound (exclusive)
@param randomNumberOrigin the origin (inclusive) of each random value
@param randomNumberBound the bound (exclusive) of each random value
@return a stream of pseudorandom {@code int} values,
each with the given origin (inclusive) and bound (exclusive)
@throws IllegalArgumentException if {@code randomNumberOrigin}
is greater than or equal to {@code randomNumberBound} | [
"Returns",
"an",
"effectively",
"unlimited",
"stream",
"of",
"pseudorandom",
"{",
"@code",
"int",
"}",
"values",
"each",
"conforming",
"to",
"the",
"given",
"origin",
"(",
"inclusive",
")",
"and",
"bound",
"(",
"exclusive",
")"
] | train | https://github.com/aNNiMON/Lightweight-Stream-API/blob/f29fd57208c20252a4549b084d55ed082c3e58f0/stream/src/main/java/com/annimon/stream/RandomCompat.java#L258-L280 |
OpenLiberty/open-liberty | dev/com.ibm.ws.ras.instrument/src/com/ibm/ws/ras/instrument/internal/main/LibertyTracePreprocessInstrumentation.java | LibertyTracePreprocessInstrumentation.getAnnotation | private AnnotationNode getAnnotation(String desc, List<AnnotationNode> annotations) {
if (annotations == null) {
return null;
}
for (AnnotationNode an : annotations) {
if (desc.equals(an.desc)) {
return an;
}
}
return null;
} | java | private AnnotationNode getAnnotation(String desc, List<AnnotationNode> annotations) {
if (annotations == null) {
return null;
}
for (AnnotationNode an : annotations) {
if (desc.equals(an.desc)) {
return an;
}
}
return null;
} | [
"private",
"AnnotationNode",
"getAnnotation",
"(",
"String",
"desc",
",",
"List",
"<",
"AnnotationNode",
">",
"annotations",
")",
"{",
"if",
"(",
"annotations",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"for",
"(",
"AnnotationNode",
"an",
":",
"a... | Find the described annotation in the list of {@code AnnotationNode}s.
@param desc the annotation descriptor
@param annotations the list of annotations
@return the annotation that matches the provided descriptor or null
if no matching annotation was found | [
"Find",
"the",
"described",
"annotation",
"in",
"the",
"list",
"of",
"{",
"@code",
"AnnotationNode",
"}",
"s",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ras.instrument/src/com/ibm/ws/ras/instrument/internal/main/LibertyTracePreprocessInstrumentation.java#L126-L136 |
zaproxy/zaproxy | src/org/parosproxy/paros/view/View.java | View.addPanelForContext | private void addPanelForContext(Context context, ContextPanelFactory contextPanelFactory, String[] panelPath) {
AbstractContextPropertiesPanel panel = contextPanelFactory.getContextPanel(context);
panel.setSessionDialog(getSessionDialog());
getSessionDialog().addParamPanel(panelPath, panel, false);
this.contextPanels.add(panel);
List<AbstractContextPropertiesPanel> panels = contextPanelFactoriesPanels.get(contextPanelFactory);
if (panels == null) {
panels = new ArrayList<>();
contextPanelFactoriesPanels.put(contextPanelFactory, panels);
}
panels.add(panel);
} | java | private void addPanelForContext(Context context, ContextPanelFactory contextPanelFactory, String[] panelPath) {
AbstractContextPropertiesPanel panel = contextPanelFactory.getContextPanel(context);
panel.setSessionDialog(getSessionDialog());
getSessionDialog().addParamPanel(panelPath, panel, false);
this.contextPanels.add(panel);
List<AbstractContextPropertiesPanel> panels = contextPanelFactoriesPanels.get(contextPanelFactory);
if (panels == null) {
panels = new ArrayList<>();
contextPanelFactoriesPanels.put(contextPanelFactory, panels);
}
panels.add(panel);
} | [
"private",
"void",
"addPanelForContext",
"(",
"Context",
"context",
",",
"ContextPanelFactory",
"contextPanelFactory",
",",
"String",
"[",
"]",
"panelPath",
")",
"{",
"AbstractContextPropertiesPanel",
"panel",
"=",
"contextPanelFactory",
".",
"getContextPanel",
"(",
"co... | Adds a custom context panel for the given context, created form the given context panel factory and placed under the
given path.
@param contextPanelFactory context panel factory used to create the panel, must not be {@code null}
@param panelPath the path where to add the created panel, must not be {@code null}
@param context the target context, must not be {@code null} | [
"Adds",
"a",
"custom",
"context",
"panel",
"for",
"the",
"given",
"context",
"created",
"form",
"the",
"given",
"context",
"panel",
"factory",
"and",
"placed",
"under",
"the",
"given",
"path",
"."
] | train | https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/parosproxy/paros/view/View.java#L764-L776 |
ManfredTremmel/gwt-bean-validators | mt-bean-validators/src/main/java/de/knightsoftnet/validators/shared/impl/Isbn10FormatedValidator.java | Isbn10FormatedValidator.isValid | @Override
public final boolean isValid(final Object pvalue, final ConstraintValidatorContext pcontext) {
final String valueAsString = Objects.toString(pvalue, null);
if (StringUtils.isEmpty(valueAsString)) {
return true;
}
if (valueAsString.length() != ISBN10_LENGTH) {
// ISBN10 size is wrong, but that's handled by size annotation
return true;
}
// calculate and check checksum (ISBN10)
return CHECK_ISBN.isValidISBN10(valueAsString);
} | java | @Override
public final boolean isValid(final Object pvalue, final ConstraintValidatorContext pcontext) {
final String valueAsString = Objects.toString(pvalue, null);
if (StringUtils.isEmpty(valueAsString)) {
return true;
}
if (valueAsString.length() != ISBN10_LENGTH) {
// ISBN10 size is wrong, but that's handled by size annotation
return true;
}
// calculate and check checksum (ISBN10)
return CHECK_ISBN.isValidISBN10(valueAsString);
} | [
"@",
"Override",
"public",
"final",
"boolean",
"isValid",
"(",
"final",
"Object",
"pvalue",
",",
"final",
"ConstraintValidatorContext",
"pcontext",
")",
"{",
"final",
"String",
"valueAsString",
"=",
"Objects",
".",
"toString",
"(",
"pvalue",
",",
"null",
")",
... | {@inheritDoc} check if given string is a valid isbn.
@see javax.validation.ConstraintValidator#isValid(java.lang.Object,
javax.validation.ConstraintValidatorContext) | [
"{",
"@inheritDoc",
"}",
"check",
"if",
"given",
"string",
"is",
"a",
"valid",
"isbn",
"."
] | train | https://github.com/ManfredTremmel/gwt-bean-validators/blob/cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c/mt-bean-validators/src/main/java/de/knightsoftnet/validators/shared/impl/Isbn10FormatedValidator.java#L61-L73 |
cloudant/sync-android | cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/documentstore/DocumentRevisionTree.java | DocumentRevisionTree.lookupChildByRevId | public InternalDocumentRevision lookupChildByRevId(InternalDocumentRevision parentNode, String childRevision) {
Misc.checkNotNull(parentNode, "Parent node");
Misc.checkArgument(sequenceMap.containsKey(parentNode.getSequence()),
"The given parent DocumentRevision must be in the tree.");
DocumentRevisionNode p = sequenceMap.get(parentNode.getSequence());
Iterator i = p.iterateChildren();
while(i.hasNext()) {
DocumentRevisionNode n = (DocumentRevisionNode) i.next();
if(n.getData().getRevision().equals(childRevision)) {
return n.getData();
}
}
return null;
} | java | public InternalDocumentRevision lookupChildByRevId(InternalDocumentRevision parentNode, String childRevision) {
Misc.checkNotNull(parentNode, "Parent node");
Misc.checkArgument(sequenceMap.containsKey(parentNode.getSequence()),
"The given parent DocumentRevision must be in the tree.");
DocumentRevisionNode p = sequenceMap.get(parentNode.getSequence());
Iterator i = p.iterateChildren();
while(i.hasNext()) {
DocumentRevisionNode n = (DocumentRevisionNode) i.next();
if(n.getData().getRevision().equals(childRevision)) {
return n.getData();
}
}
return null;
} | [
"public",
"InternalDocumentRevision",
"lookupChildByRevId",
"(",
"InternalDocumentRevision",
"parentNode",
",",
"String",
"childRevision",
")",
"{",
"Misc",
".",
"checkNotNull",
"(",
"parentNode",
",",
"\"Parent node\"",
")",
";",
"Misc",
".",
"checkArgument",
"(",
"s... | <p>Returns the child with a given revision ID of a parent
{@link InternalDocumentRevision}.</p>
@param parentNode parent {@code DocumentRevision}
@param childRevision revision to look for in child nodes
@return the child with a given revision ID of a {@code DocumentRevision}. | [
"<p",
">",
"Returns",
"the",
"child",
"with",
"a",
"given",
"revision",
"ID",
"of",
"a",
"parent",
"{",
"@link",
"InternalDocumentRevision",
"}",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/documentstore/DocumentRevisionTree.java#L280-L294 |
fabric8io/docker-maven-plugin | src/main/java/io/fabric8/maven/docker/access/DockerConnectionDetector.java | DockerConnectionDetector.detectConnectionParameter | public ConnectionParameter detectConnectionParameter(String dockerHost, String certPath) throws IOException {
if (dockerHost != null) {
return new ConnectionParameter(dockerHost, certPath);
}
for (DockerHostProvider provider : dockerHostProviders) {
ConnectionParameter value = provider.getConnectionParameter(certPath);
if (value != null) {
return value;
}
}
throw new IllegalArgumentException("No <dockerHost> given, no DOCKER_HOST environment variable, " +
"no read/writable '/var/run/docker.sock' or '//./pipe/docker_engine' " +
"and no external provider like Docker machine configured");
} | java | public ConnectionParameter detectConnectionParameter(String dockerHost, String certPath) throws IOException {
if (dockerHost != null) {
return new ConnectionParameter(dockerHost, certPath);
}
for (DockerHostProvider provider : dockerHostProviders) {
ConnectionParameter value = provider.getConnectionParameter(certPath);
if (value != null) {
return value;
}
}
throw new IllegalArgumentException("No <dockerHost> given, no DOCKER_HOST environment variable, " +
"no read/writable '/var/run/docker.sock' or '//./pipe/docker_engine' " +
"and no external provider like Docker machine configured");
} | [
"public",
"ConnectionParameter",
"detectConnectionParameter",
"(",
"String",
"dockerHost",
",",
"String",
"certPath",
")",
"throws",
"IOException",
"{",
"if",
"(",
"dockerHost",
"!=",
"null",
")",
"{",
"return",
"new",
"ConnectionParameter",
"(",
"dockerHost",
",",
... | Get the docker host url.
<ol>
<li>From <dockerHost> configuration</li>
<li>From <machine> configuration</li>
<li>From DOCKER_HOST environment variable</li>
<li>Default to /var/run/docker.sock</li>
</ol>
@param dockerHost The dockerHost configuration setting
@return The docker host url
@throws IOException when URL handling fails | [
"Get",
"the",
"docker",
"host",
"url",
".",
"<ol",
">",
"<li",
">",
"From",
"<",
";",
"dockerHost>",
";",
"configuration<",
"/",
"li",
">",
"<li",
">",
"From",
"<",
";",
"machine>",
";",
"configuration<",
"/",
"li",
">",
"<li",
">",
"From",
"... | train | https://github.com/fabric8io/docker-maven-plugin/blob/70ce4f56125d8efb8ddcf2ad4dbb5d6e2c7642b3/src/main/java/io/fabric8/maven/docker/access/DockerConnectionDetector.java#L73-L86 |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/AttributeDefinition.java | AttributeDefinition.marshallAsElement | public void marshallAsElement(final ModelNode resourceModel, final XMLStreamWriter writer) throws XMLStreamException {
marshallAsElement(resourceModel, true, writer);
} | java | public void marshallAsElement(final ModelNode resourceModel, final XMLStreamWriter writer) throws XMLStreamException {
marshallAsElement(resourceModel, true, writer);
} | [
"public",
"void",
"marshallAsElement",
"(",
"final",
"ModelNode",
"resourceModel",
",",
"final",
"XMLStreamWriter",
"writer",
")",
"throws",
"XMLStreamException",
"{",
"marshallAsElement",
"(",
"resourceModel",
",",
"true",
",",
"writer",
")",
";",
"}"
] | Marshalls the value from the given {@code resourceModel} as an xml element, if it
{@link #isMarshallable(org.jboss.dmr.ModelNode, boolean) is marshallable}.
@param resourceModel the model, a non-null node of {@link org.jboss.dmr.ModelType#OBJECT}.
@param writer stream writer to use for writing the attribute
@throws javax.xml.stream.XMLStreamException if thrown by {@code writer} | [
"Marshalls",
"the",
"value",
"from",
"the",
"given",
"{",
"@code",
"resourceModel",
"}",
"as",
"an",
"xml",
"element",
"if",
"it",
"{",
"@link",
"#isMarshallable",
"(",
"org",
".",
"jboss",
".",
"dmr",
".",
"ModelNode",
"boolean",
")",
"is",
"marshallable"... | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/AttributeDefinition.java#L743-L745 |
alkacon/opencms-core | src/org/opencms/util/CmsRequestUtil.java | CmsRequestUtil.getNotEmptyDecodedParameter | public static String getNotEmptyDecodedParameter(HttpServletRequest request, String paramName) {
String result = getNotEmptyParameter(request, paramName);
if (result != null) {
result = CmsEncoder.decode(result.trim());
}
return result;
} | java | public static String getNotEmptyDecodedParameter(HttpServletRequest request, String paramName) {
String result = getNotEmptyParameter(request, paramName);
if (result != null) {
result = CmsEncoder.decode(result.trim());
}
return result;
} | [
"public",
"static",
"String",
"getNotEmptyDecodedParameter",
"(",
"HttpServletRequest",
"request",
",",
"String",
"paramName",
")",
"{",
"String",
"result",
"=",
"getNotEmptyParameter",
"(",
"request",
",",
"paramName",
")",
";",
"if",
"(",
"result",
"!=",
"null",... | Reads value from the request parameters,
will return <code>null</code> if the value is not available or only white space.<p>
The value of the request will also be decoded using <code>{@link CmsEncoder#decode(String)}</code>
and also trimmed using <code>{@link String#trim()}</code>.<p>
@param request the request to read the parameter from
@param paramName the parameter name to read
@return the request parameter value for the given parameter | [
"Reads",
"value",
"from",
"the",
"request",
"parameters",
"will",
"return",
"<code",
">",
"null<",
"/",
"code",
">",
"if",
"the",
"value",
"is",
"not",
"available",
"or",
"only",
"white",
"space",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/util/CmsRequestUtil.java#L608-L615 |
LGoodDatePicker/LGoodDatePicker | Project/src/main/java/com/privatejgoodies/common/base/Preconditions.java | Preconditions.checkState | public static void checkState(
boolean expression, String messageFormat, Object... messageArgs) {
if (!expression) {
throw new IllegalStateException(format(messageFormat, messageArgs));
}
} | java | public static void checkState(
boolean expression, String messageFormat, Object... messageArgs) {
if (!expression) {
throw new IllegalStateException(format(messageFormat, messageArgs));
}
} | [
"public",
"static",
"void",
"checkState",
"(",
"boolean",
"expression",
",",
"String",
"messageFormat",
",",
"Object",
"...",
"messageArgs",
")",
"{",
"if",
"(",
"!",
"expression",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"format",
"(",
"message... | Checks the truth of the given expression and throws a customized
{@link IllegalStateException} if it is false. Intended for doing validation in methods
involving the state of the calling instance, but not involving parameters of the calling
method, e.g.:
<blockquote><pre>
public void unlock() {
Preconditions.checkState(locked,
"Must be locked to be unlocked. Most recent lock: %s",
mostRecentLock);
}
</pre></blockquote>
@param expression the precondition to check involving the state of the calling instance
@param messageFormat a {@link Formatter format} string for the detail message to be used in
the event that an exception is thrown.
@param messageArgs the arguments referenced by the format specifiers in the
{@code messageFormat}
@throws IllegalStateException if {@code expression} is false | [
"Checks",
"the",
"truth",
"of",
"the",
"given",
"expression",
"and",
"throws",
"a",
"customized",
"{",
"@link",
"IllegalStateException",
"}",
"if",
"it",
"is",
"false",
".",
"Intended",
"for",
"doing",
"validation",
"in",
"methods",
"involving",
"the",
"state"... | train | https://github.com/LGoodDatePicker/LGoodDatePicker/blob/c7df05a5fe382e1e08a6237e9391d8dc5fd48692/Project/src/main/java/com/privatejgoodies/common/base/Preconditions.java#L187-L192 |
adamfisk/littleshoot-util | src/main/java/org/littleshoot/util/MapUtils.java | MapUtils.removeFromMapValues | public static Object removeFromMapValues(final Map map, final Object value)
{
synchronized (map)
{
final Collection entries = map.entrySet();
for (final Iterator iter = entries.iterator(); iter.hasNext();)
{
final Map.Entry entry = (Entry) iter.next();
if (entry.getValue().equals(value))
{
final Object key = entry.getKey();
iter.remove();
return key;
}
}
return null;
}
} | java | public static Object removeFromMapValues(final Map map, final Object value)
{
synchronized (map)
{
final Collection entries = map.entrySet();
for (final Iterator iter = entries.iterator(); iter.hasNext();)
{
final Map.Entry entry = (Entry) iter.next();
if (entry.getValue().equals(value))
{
final Object key = entry.getKey();
iter.remove();
return key;
}
}
return null;
}
} | [
"public",
"static",
"Object",
"removeFromMapValues",
"(",
"final",
"Map",
"map",
",",
"final",
"Object",
"value",
")",
"{",
"synchronized",
"(",
"map",
")",
"{",
"final",
"Collection",
"entries",
"=",
"map",
".",
"entrySet",
"(",
")",
";",
"for",
"(",
"f... | Removes the specified reader/writer from the values of the specified
reader/writer map. Many times classes will contain maps of some key
to reader/writers, and this method simply allows those classes to easily
remove those values.
@param map The map mapping some key to reader/writers.
@param value The reader/writer to remove.
@return The key for the object removed, or <code>null</code> if nothing
was removed. | [
"Removes",
"the",
"specified",
"reader",
"/",
"writer",
"from",
"the",
"values",
"of",
"the",
"specified",
"reader",
"/",
"writer",
"map",
".",
"Many",
"times",
"classes",
"will",
"contain",
"maps",
"of",
"some",
"key",
"to",
"reader",
"/",
"writers",
"and... | train | https://github.com/adamfisk/littleshoot-util/blob/3c0dc4955116b3382d6b0575d2f164b7508a4f73/src/main/java/org/littleshoot/util/MapUtils.java#L25-L42 |
BioPAX/Paxtools | sbgn-converter/src/main/java/org/biopax/paxtools/io/sbgn/L3ToSBGNPDConverter.java | L3ToSBGNPDConverter.writeSBGN | public void writeSBGN(Model model, OutputStream stream) {
Sbgn sbgn = createSBGN(model);
try {
JAXBContext context = JAXBContext.newInstance("org.sbgn.bindings");
Marshaller marshaller = context.createMarshaller();
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
marshaller.marshal(sbgn, stream);
} catch (JAXBException e) {
throw new RuntimeException("writeSBGN: JAXB marshalling failed", e);
}
} | java | public void writeSBGN(Model model, OutputStream stream) {
Sbgn sbgn = createSBGN(model);
try {
JAXBContext context = JAXBContext.newInstance("org.sbgn.bindings");
Marshaller marshaller = context.createMarshaller();
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
marshaller.marshal(sbgn, stream);
} catch (JAXBException e) {
throw new RuntimeException("writeSBGN: JAXB marshalling failed", e);
}
} | [
"public",
"void",
"writeSBGN",
"(",
"Model",
"model",
",",
"OutputStream",
"stream",
")",
"{",
"Sbgn",
"sbgn",
"=",
"createSBGN",
"(",
"model",
")",
";",
"try",
"{",
"JAXBContext",
"context",
"=",
"JAXBContext",
".",
"newInstance",
"(",
"\"org.sbgn.bindings\""... | Converts the given model to SBGN, and writes in the specified output stream.
@param model model to convert
@param stream output stream to write | [
"Converts",
"the",
"given",
"model",
"to",
"SBGN",
"and",
"writes",
"in",
"the",
"specified",
"output",
"stream",
"."
] | train | https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/sbgn-converter/src/main/java/org/biopax/paxtools/io/sbgn/L3ToSBGNPDConverter.java#L243-L253 |
jayantk/jklol | src/com/jayantkrish/jklol/inference/GibbsSampler.java | GibbsSampler.doSample | private Assignment doSample(FactorGraph factorGraph, Assignment curAssignment, int varNum) {
// Retain the assignments to all other variables.
Assignment otherVarAssignment = curAssignment.removeAll(varNum);
// Multiply together all of the factors which define a probability distribution over
// variable varNum, conditioned on all other variables.
Set<Integer> factorNums = factorGraph.getFactorsWithVariable(varNum);
Preconditions.checkState(factorNums.size() > 0, "Variable not in factor: " + varNum + " " + factorNums);
List<Factor> factorsToCombine = new ArrayList<Factor>();
for (Integer factorNum : factorNums) {
Factor conditional = factorGraph.getFactor(factorNum)
.conditional(otherVarAssignment);
factorsToCombine.add(conditional.marginalize(otherVarAssignment.getVariableNums()));
}
Factor toSampleFrom = factorsToCombine.get(0).product(factorsToCombine.subList(1, factorsToCombine.size()));
// Draw the sample and update the sampler's current assignment.
Assignment subsetValues = toSampleFrom.sample();
return otherVarAssignment.union(subsetValues);
} | java | private Assignment doSample(FactorGraph factorGraph, Assignment curAssignment, int varNum) {
// Retain the assignments to all other variables.
Assignment otherVarAssignment = curAssignment.removeAll(varNum);
// Multiply together all of the factors which define a probability distribution over
// variable varNum, conditioned on all other variables.
Set<Integer> factorNums = factorGraph.getFactorsWithVariable(varNum);
Preconditions.checkState(factorNums.size() > 0, "Variable not in factor: " + varNum + " " + factorNums);
List<Factor> factorsToCombine = new ArrayList<Factor>();
for (Integer factorNum : factorNums) {
Factor conditional = factorGraph.getFactor(factorNum)
.conditional(otherVarAssignment);
factorsToCombine.add(conditional.marginalize(otherVarAssignment.getVariableNums()));
}
Factor toSampleFrom = factorsToCombine.get(0).product(factorsToCombine.subList(1, factorsToCombine.size()));
// Draw the sample and update the sampler's current assignment.
Assignment subsetValues = toSampleFrom.sample();
return otherVarAssignment.union(subsetValues);
} | [
"private",
"Assignment",
"doSample",
"(",
"FactorGraph",
"factorGraph",
",",
"Assignment",
"curAssignment",
",",
"int",
"varNum",
")",
"{",
"// Retain the assignments to all other variables.",
"Assignment",
"otherVarAssignment",
"=",
"curAssignment",
".",
"removeAll",
"(",
... | /*
Resample the specified variable conditioned on all of the other variables. | [
"/",
"*",
"Resample",
"the",
"specified",
"variable",
"conditioned",
"on",
"all",
"of",
"the",
"other",
"variables",
"."
] | train | https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/inference/GibbsSampler.java#L92-L112 |
Azure/azure-sdk-for-java | sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstanceVulnerabilityAssessmentsInner.java | ManagedInstanceVulnerabilityAssessmentsInner.listByInstanceAsync | public Observable<Page<ManagedInstanceVulnerabilityAssessmentInner>> listByInstanceAsync(final String resourceGroupName, final String managedInstanceName) {
return listByInstanceWithServiceResponseAsync(resourceGroupName, managedInstanceName)
.map(new Func1<ServiceResponse<Page<ManagedInstanceVulnerabilityAssessmentInner>>, Page<ManagedInstanceVulnerabilityAssessmentInner>>() {
@Override
public Page<ManagedInstanceVulnerabilityAssessmentInner> call(ServiceResponse<Page<ManagedInstanceVulnerabilityAssessmentInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<ManagedInstanceVulnerabilityAssessmentInner>> listByInstanceAsync(final String resourceGroupName, final String managedInstanceName) {
return listByInstanceWithServiceResponseAsync(resourceGroupName, managedInstanceName)
.map(new Func1<ServiceResponse<Page<ManagedInstanceVulnerabilityAssessmentInner>>, Page<ManagedInstanceVulnerabilityAssessmentInner>>() {
@Override
public Page<ManagedInstanceVulnerabilityAssessmentInner> call(ServiceResponse<Page<ManagedInstanceVulnerabilityAssessmentInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"ManagedInstanceVulnerabilityAssessmentInner",
">",
">",
"listByInstanceAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"managedInstanceName",
")",
"{",
"return",
"listByInstanceWithServiceResponseAsync",
... | Gets the managed instance's vulnerability assessment policies.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param managedInstanceName The name of the managed instance for which the vulnerability assessments is defined.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<ManagedInstanceVulnerabilityAssessmentInner> object | [
"Gets",
"the",
"managed",
"instance",
"s",
"vulnerability",
"assessment",
"policies",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/sql/v2018_06_01_preview/implementation/ManagedInstanceVulnerabilityAssessmentsInner.java#L405-L413 |
ironjacamar/ironjacamar | core/src/main/java/org/ironjacamar/core/workmanager/WorkManagerImpl.java | WorkManagerImpl.doFirstChecks | public void doFirstChecks(Work work, long startTimeout, ExecutionContext execContext) throws WorkException
{
if (isShutdown())
throw new WorkRejectedException(bundle.workmanagerShutdown());
if (work == null)
throw new WorkRejectedException(bundle.workIsNull());
if (startTimeout < 0)
throw new WorkRejectedException(bundle.startTimeoutIsNegative(startTimeout));
checkAndVerifyWork(work, execContext);
} | java | public void doFirstChecks(Work work, long startTimeout, ExecutionContext execContext) throws WorkException
{
if (isShutdown())
throw new WorkRejectedException(bundle.workmanagerShutdown());
if (work == null)
throw new WorkRejectedException(bundle.workIsNull());
if (startTimeout < 0)
throw new WorkRejectedException(bundle.startTimeoutIsNegative(startTimeout));
checkAndVerifyWork(work, execContext);
} | [
"public",
"void",
"doFirstChecks",
"(",
"Work",
"work",
",",
"long",
"startTimeout",
",",
"ExecutionContext",
"execContext",
")",
"throws",
"WorkException",
"{",
"if",
"(",
"isShutdown",
"(",
")",
")",
"throw",
"new",
"WorkRejectedException",
"(",
"bundle",
".",... | Do first checks for work starting methods
@param work to check
@param startTimeout to check
@param execContext to check
@throws WorkException in case of check don't pass | [
"Do",
"first",
"checks",
"for",
"work",
"starting",
"methods"
] | train | https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/core/src/main/java/org/ironjacamar/core/workmanager/WorkManagerImpl.java#L811-L823 |
jirutka/spring-rest-exception-handler | src/main/java/cz/jirutka/spring/exhandler/handlers/AbstractRestExceptionHandler.java | AbstractRestExceptionHandler.logException | protected void logException(E ex, HttpServletRequest req) {
if (LOG.isErrorEnabled() && getStatus().value() >= 500 || LOG.isInfoEnabled()) {
Marker marker = MarkerFactory.getMarker(ex.getClass().getName());
String uri = req.getRequestURI();
if (req.getQueryString() != null) {
uri += '?' + req.getQueryString();
}
String msg = String.format("%s %s ~> %s", req.getMethod(), uri, getStatus());
if (getStatus().value() >= 500) {
LOG.error(marker, msg, ex);
} else if (LOG.isDebugEnabled()) {
LOG.debug(marker, msg, ex);
} else {
LOG.info(marker, msg);
}
}
} | java | protected void logException(E ex, HttpServletRequest req) {
if (LOG.isErrorEnabled() && getStatus().value() >= 500 || LOG.isInfoEnabled()) {
Marker marker = MarkerFactory.getMarker(ex.getClass().getName());
String uri = req.getRequestURI();
if (req.getQueryString() != null) {
uri += '?' + req.getQueryString();
}
String msg = String.format("%s %s ~> %s", req.getMethod(), uri, getStatus());
if (getStatus().value() >= 500) {
LOG.error(marker, msg, ex);
} else if (LOG.isDebugEnabled()) {
LOG.debug(marker, msg, ex);
} else {
LOG.info(marker, msg);
}
}
} | [
"protected",
"void",
"logException",
"(",
"E",
"ex",
",",
"HttpServletRequest",
"req",
")",
"{",
"if",
"(",
"LOG",
".",
"isErrorEnabled",
"(",
")",
"&&",
"getStatus",
"(",
")",
".",
"value",
"(",
")",
">=",
"500",
"||",
"LOG",
".",
"isInfoEnabled",
"("... | Logs the exception; on ERROR level when status is 5xx, otherwise on INFO level without stack
trace, or DEBUG level with stack trace. The logger name is
{@code cz.jirutka.spring.exhandler.handlers.RestExceptionHandler}.
@param ex The exception to log.
@param req The current web request. | [
"Logs",
"the",
"exception",
";",
"on",
"ERROR",
"level",
"when",
"status",
"is",
"5xx",
"otherwise",
"on",
"INFO",
"level",
"without",
"stack",
"trace",
"or",
"DEBUG",
"level",
"with",
"stack",
"trace",
".",
"The",
"logger",
"name",
"is",
"{",
"@code",
"... | train | https://github.com/jirutka/spring-rest-exception-handler/blob/f171956e59fe866f1a853c7d38444f136acc7a3b/src/main/java/cz/jirutka/spring/exhandler/handlers/AbstractRestExceptionHandler.java#L96-L117 |
Coveros/selenified | src/main/java/com/coveros/selenified/element/check/wait/WaitForEquals.java | WaitForEquals.selectOptions | public void selectOptions(String[] expectedOptions, double seconds) {
double end = System.currentTimeMillis() + (seconds * 1000);
try {
elementPresent(seconds);
if (!element.is().select()) {
throw new TimeoutException(ELEMENT_NOT_SELECT);
}
while (!Arrays.toString(element.get().selectOptions()).equals(Arrays.toString(expectedOptions)) && System.currentTimeMillis() < end) ;
double timeTook = Math.min((seconds * 1000) - (end - System.currentTimeMillis()), seconds * 1000) / 1000;
checkSelectOptions(expectedOptions, seconds, timeTook);
} catch (TimeoutException e) {
checkSelectOptions(expectedOptions, seconds, seconds);
}
} | java | public void selectOptions(String[] expectedOptions, double seconds) {
double end = System.currentTimeMillis() + (seconds * 1000);
try {
elementPresent(seconds);
if (!element.is().select()) {
throw new TimeoutException(ELEMENT_NOT_SELECT);
}
while (!Arrays.toString(element.get().selectOptions()).equals(Arrays.toString(expectedOptions)) && System.currentTimeMillis() < end) ;
double timeTook = Math.min((seconds * 1000) - (end - System.currentTimeMillis()), seconds * 1000) / 1000;
checkSelectOptions(expectedOptions, seconds, timeTook);
} catch (TimeoutException e) {
checkSelectOptions(expectedOptions, seconds, seconds);
}
} | [
"public",
"void",
"selectOptions",
"(",
"String",
"[",
"]",
"expectedOptions",
",",
"double",
"seconds",
")",
"{",
"double",
"end",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
"+",
"(",
"seconds",
"*",
"1000",
")",
";",
"try",
"{",
"elementPresent",... | Waits for the element's select options equal the provided expected
options. If the element isn't present or a select, this will constitute a
failure, same as a mismatch.
The provided wait time will be used and if the element doesn't
have the desired match count at that time, it will fail, and log
the issue with a screenshot for traceability and added debugging support.
@param expectedOptions - the expected input value of the element
@param seconds - how many seconds to wait for | [
"Waits",
"for",
"the",
"element",
"s",
"select",
"options",
"equal",
"the",
"provided",
"expected",
"options",
".",
"If",
"the",
"element",
"isn",
"t",
"present",
"or",
"a",
"select",
"this",
"will",
"constitute",
"a",
"failure",
"same",
"as",
"a",
"mismat... | train | https://github.com/Coveros/selenified/blob/396cc1f010dd69eed33cc5061c41253de246a4cd/src/main/java/com/coveros/selenified/element/check/wait/WaitForEquals.java#L486-L499 |
strator-dev/greenpepper | greenpepper/greenpepper-client/src/main/java/com/greenpepper/server/domain/RepositoryType.java | RepositoryType.registerClassForEnvironment | public void registerClassForEnvironment(String className, EnvironmentType envType)
{
RepositoryTypeClass repoTypeClass = RepositoryTypeClass.newInstance(this, envType, className);
repositoryTypeClasses.add(repoTypeClass);
} | java | public void registerClassForEnvironment(String className, EnvironmentType envType)
{
RepositoryTypeClass repoTypeClass = RepositoryTypeClass.newInstance(this, envType, className);
repositoryTypeClasses.add(repoTypeClass);
} | [
"public",
"void",
"registerClassForEnvironment",
"(",
"String",
"className",
",",
"EnvironmentType",
"envType",
")",
"{",
"RepositoryTypeClass",
"repoTypeClass",
"=",
"RepositoryTypeClass",
".",
"newInstance",
"(",
"this",
",",
"envType",
",",
"className",
")",
";",
... | <p>registerClassForEnvironment.</p>
@param className a {@link java.lang.String} object.
@param envType a {@link com.greenpepper.server.domain.EnvironmentType} object. | [
"<p",
">",
"registerClassForEnvironment",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper/greenpepper-client/src/main/java/com/greenpepper/server/domain/RepositoryType.java#L191-L195 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/PdfDictionary.java | PdfDictionary.put | public void put(PdfName key, PdfObject object) {
if (object == null || object.isNull()) {
remove(key);
}
else {
hashMap.put(key, object);
}
} | java | public void put(PdfName key, PdfObject object) {
if (object == null || object.isNull()) {
remove(key);
}
else {
hashMap.put(key, object);
}
} | [
"public",
"void",
"put",
"(",
"PdfName",
"key",
",",
"PdfObject",
"object",
")",
"{",
"if",
"(",
"object",
"==",
"null",
"||",
"object",
".",
"isNull",
"(",
")",
")",
"{",
"remove",
"(",
"key",
")",
";",
"}",
"else",
"{",
"hashMap",
".",
"put",
"... | Associates the specified <CODE>PdfObject</CODE> as <VAR>value</VAR> with
the specified <CODE>PdfName</CODE> as <VAR>key</VAR> in this map.
If the map previously contained a mapping for this <VAR>key</VAR>, the
old <VAR>value</VAR> is replaced. If the <VAR>value</VAR> is
<CODE>null</CODE> or <CODE>PdfNull</CODE> the key is deleted.
@param key a <CODE>PdfName</CODE>
@param object the <CODE>PdfObject</CODE> to be associated with the
<VAR>key</VAR> | [
"Associates",
"the",
"specified",
"<CODE",
">",
"PdfObject<",
"/",
"CODE",
">",
"as",
"<VAR",
">",
"value<",
"/",
"VAR",
">",
"with",
"the",
"specified",
"<CODE",
">",
"PdfName<",
"/",
"CODE",
">",
"as",
"<VAR",
">",
"key<",
"/",
"VAR",
">",
"in",
"t... | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfDictionary.java#L189-L196 |
apache/flink | flink-formats/flink-parquet/src/main/java/org/apache/flink/formats/parquet/utils/ParquetTimestampUtils.java | ParquetTimestampUtils.getTimestampMillis | public static long getTimestampMillis(Binary timestampBinary) {
if (timestampBinary.length() != 12) {
throw new IllegalArgumentException("Parquet timestamp must be 12 bytes, actual " + timestampBinary.length());
}
byte[] bytes = timestampBinary.getBytes();
// little endian encoding - need to invert byte order
long timeOfDayNanos = ByteBuffer.wrap(new byte[] {bytes[7], bytes[6], bytes[5], bytes[4],
bytes[3], bytes[2], bytes[1], bytes[0]}).getLong();
int julianDay = ByteBuffer.wrap(new byte[] {bytes[11], bytes[10], bytes[9], bytes[8]}).getInt();
return julianDayToMillis(julianDay) + (timeOfDayNanos / NANOS_PER_MILLISECOND);
} | java | public static long getTimestampMillis(Binary timestampBinary) {
if (timestampBinary.length() != 12) {
throw new IllegalArgumentException("Parquet timestamp must be 12 bytes, actual " + timestampBinary.length());
}
byte[] bytes = timestampBinary.getBytes();
// little endian encoding - need to invert byte order
long timeOfDayNanos = ByteBuffer.wrap(new byte[] {bytes[7], bytes[6], bytes[5], bytes[4],
bytes[3], bytes[2], bytes[1], bytes[0]}).getLong();
int julianDay = ByteBuffer.wrap(new byte[] {bytes[11], bytes[10], bytes[9], bytes[8]}).getInt();
return julianDayToMillis(julianDay) + (timeOfDayNanos / NANOS_PER_MILLISECOND);
} | [
"public",
"static",
"long",
"getTimestampMillis",
"(",
"Binary",
"timestampBinary",
")",
"{",
"if",
"(",
"timestampBinary",
".",
"length",
"(",
")",
"!=",
"12",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Parquet timestamp must be 12 bytes, actual \"... | Returns GMT timestamp from binary encoded parquet timestamp (12 bytes - julian date + time of day nanos).
@param timestampBinary INT96 parquet timestamp
@return timestamp in millis, GMT timezone | [
"Returns",
"GMT",
"timestamp",
"from",
"binary",
"encoded",
"parquet",
"timestamp",
"(",
"12",
"bytes",
"-",
"julian",
"date",
"+",
"time",
"of",
"day",
"nanos",
")",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-formats/flink-parquet/src/main/java/org/apache/flink/formats/parquet/utils/ParquetTimestampUtils.java#L44-L56 |
Pi4J/pi4j | pi4j-core/src/main/java/com/pi4j/util/CommandArgumentParser.java | CommandArgumentParser.getPin | public static Pin getPin(Class<? extends PinProvider> pinProviderClass, Pin defaultPin, String ... args){
// search all arguments for the "--pin" or "-p" option
// we skip the last argument in the array because we expect a value defined after the option designator
for(int index = 0; index < (args.length-1); index++){
if(args[index].toLowerCase().equals("--pin") ||
args[index].toLowerCase().equals("-p")){
try {
int pinAddress = Integer.parseInt(args[index+1]);
Method m = pinProviderClass.getDeclaredMethod("getPinByAddress", int.class);
Object pin = m.invoke(null, pinAddress);
return (Pin)pin;
}
catch(Exception ex){
System.err.println(ex.getMessage());
}
}
}
return defaultPin;
} | java | public static Pin getPin(Class<? extends PinProvider> pinProviderClass, Pin defaultPin, String ... args){
// search all arguments for the "--pin" or "-p" option
// we skip the last argument in the array because we expect a value defined after the option designator
for(int index = 0; index < (args.length-1); index++){
if(args[index].toLowerCase().equals("--pin") ||
args[index].toLowerCase().equals("-p")){
try {
int pinAddress = Integer.parseInt(args[index+1]);
Method m = pinProviderClass.getDeclaredMethod("getPinByAddress", int.class);
Object pin = m.invoke(null, pinAddress);
return (Pin)pin;
}
catch(Exception ex){
System.err.println(ex.getMessage());
}
}
}
return defaultPin;
} | [
"public",
"static",
"Pin",
"getPin",
"(",
"Class",
"<",
"?",
"extends",
"PinProvider",
">",
"pinProviderClass",
",",
"Pin",
"defaultPin",
",",
"String",
"...",
"args",
")",
"{",
"// search all arguments for the \"--pin\" or \"-p\" option",
"// we skip the last argument in... | This utility method searches for "--pin (#)" or "-p (#)" in the command
arguments array and returns a Pin instance based on the pin
address/number specified.
@param pinProviderClass pin provider class to get pin instance from
@param defaultPin default pin instance to use if no --pin argument is found
@param args the argument array to search in
@return GPIO pin instance | [
"This",
"utility",
"method",
"searches",
"for",
"--",
"pin",
"(",
"#",
")",
"or",
"-",
"p",
"(",
"#",
")",
"in",
"the",
"command",
"arguments",
"array",
"and",
"returns",
"a",
"Pin",
"instance",
"based",
"on",
"the",
"pin",
"address",
"/",
"number",
... | train | https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-core/src/main/java/com/pi4j/util/CommandArgumentParser.java#L54-L72 |
twitter/hraven | hraven-etl/src/main/java/com/twitter/hraven/etl/JobHistoryFileParserHadoop2.java | JobHistoryFileParserHadoop2.getStandardizedCounterValue | @Deprecated
private Long getStandardizedCounterValue(String counterName, Long counterValue) {
if (jobConf == null) {
throw new ProcessingException("While correcting slot millis, jobConf is null");
}
long yarnSchedulerMinMB = this.jobConf.getLong(Constants.YARN_SCHEDULER_MIN_MB,
Constants.DEFAULT_YARN_SCHEDULER_MIN_MB);
long updatedCounterValue = 0L;
long memoryMb = 0L;
String key;
if (Constants.SLOTS_MILLIS_MAPS.equals(counterName)) {
key = Constants.MAP_MEMORY_MB_CONF_KEY;
memoryMb = getMemoryMb(key);
updatedCounterValue = counterValue * yarnSchedulerMinMB / memoryMb;
this.jobDetails.setMapSlotMillis(updatedCounterValue);
} else {
key = Constants.REDUCE_MEMORY_MB_CONF_KEY;
memoryMb = getMemoryMb(key);
updatedCounterValue = counterValue * yarnSchedulerMinMB / memoryMb;
this.jobDetails.setReduceSlotMillis(updatedCounterValue);
}
LOG.info("Updated " + counterName + " from " + counterValue + " to " + updatedCounterValue
+ " based on " + Constants.YARN_SCHEDULER_MIN_MB + ": " + yarnSchedulerMinMB
+ " and " + key + ": " + memoryMb);
return updatedCounterValue;
} | java | @Deprecated
private Long getStandardizedCounterValue(String counterName, Long counterValue) {
if (jobConf == null) {
throw new ProcessingException("While correcting slot millis, jobConf is null");
}
long yarnSchedulerMinMB = this.jobConf.getLong(Constants.YARN_SCHEDULER_MIN_MB,
Constants.DEFAULT_YARN_SCHEDULER_MIN_MB);
long updatedCounterValue = 0L;
long memoryMb = 0L;
String key;
if (Constants.SLOTS_MILLIS_MAPS.equals(counterName)) {
key = Constants.MAP_MEMORY_MB_CONF_KEY;
memoryMb = getMemoryMb(key);
updatedCounterValue = counterValue * yarnSchedulerMinMB / memoryMb;
this.jobDetails.setMapSlotMillis(updatedCounterValue);
} else {
key = Constants.REDUCE_MEMORY_MB_CONF_KEY;
memoryMb = getMemoryMb(key);
updatedCounterValue = counterValue * yarnSchedulerMinMB / memoryMb;
this.jobDetails.setReduceSlotMillis(updatedCounterValue);
}
LOG.info("Updated " + counterName + " from " + counterValue + " to " + updatedCounterValue
+ " based on " + Constants.YARN_SCHEDULER_MIN_MB + ": " + yarnSchedulerMinMB
+ " and " + key + ": " + memoryMb);
return updatedCounterValue;
} | [
"@",
"Deprecated",
"private",
"Long",
"getStandardizedCounterValue",
"(",
"String",
"counterName",
",",
"Long",
"counterValue",
")",
"{",
"if",
"(",
"jobConf",
"==",
"null",
")",
"{",
"throw",
"new",
"ProcessingException",
"(",
"\"While correcting slot millis, jobConf... | Issue #51 in hraven on github
map and reduce slot millis in Hadoop 2.0 are not calculated properly.
They are aproximately 4X off by actual value.
calculate the correct map slot millis as
hadoop2ReportedMapSlotMillis * yarn.scheduler.minimum-allocation-mb
/ mapreduce.mapreduce.memory.mb
similarly for reduce slot millis
Marking method as deprecated as noted in Pull Request #132
@param counterName
@param counterValue
@return corrected counter value | [
"Issue",
"#51",
"in",
"hraven",
"on",
"github",
"map",
"and",
"reduce",
"slot",
"millis",
"in",
"Hadoop",
"2",
".",
"0",
"are",
"not",
"calculated",
"properly",
".",
"They",
"are",
"aproximately",
"4X",
"off",
"by",
"actual",
"value",
".",
"calculate",
"... | train | https://github.com/twitter/hraven/blob/e35996b6e2f016bcd18db0bad320be7c93d95208/hraven-etl/src/main/java/com/twitter/hraven/etl/JobHistoryFileParserHadoop2.java#L761-L787 |
d-sauer/JCalcAPI | src/main/java/org/jdice/calc/Num.java | Num.toObject | public <T> T toObject(Class<T> toClass, Class<? extends NumConverter> converterClass) {
return (T) toObject(toClass, null, converterClass);
} | java | public <T> T toObject(Class<T> toClass, Class<? extends NumConverter> converterClass) {
return (T) toObject(toClass, null, converterClass);
} | [
"public",
"<",
"T",
">",
"T",
"toObject",
"(",
"Class",
"<",
"T",
">",
"toClass",
",",
"Class",
"<",
"?",
"extends",
"NumConverter",
">",
"converterClass",
")",
"{",
"return",
"(",
"T",
")",
"toObject",
"(",
"toClass",
",",
"null",
",",
"converterClass... | Convert <tt>Num</tt> to defined custom object
@param customObject
@return | [
"Convert",
"<tt",
">",
"Num<",
"/",
"tt",
">",
"to",
"defined",
"custom",
"object"
] | train | https://github.com/d-sauer/JCalcAPI/blob/36ae1f9adfe611a6f1bd8ef87cf1dc0ec88ac035/src/main/java/org/jdice/calc/Num.java#L501-L503 |
googleads/googleads-java-lib | modules/ads_lib/src/main/java/com/google/api/ads/admanager/lib/utils/QueryBuilder.java | QueryBuilder.removeKeyword | static String removeKeyword(String clause, String keyword) {
keyword = keyword + " ";
if (clause.regionMatches(true, 0, keyword, 0, keyword.length())) {
return clause.substring(keyword.length());
}
return clause;
} | java | static String removeKeyword(String clause, String keyword) {
keyword = keyword + " ";
if (clause.regionMatches(true, 0, keyword, 0, keyword.length())) {
return clause.substring(keyword.length());
}
return clause;
} | [
"static",
"String",
"removeKeyword",
"(",
"String",
"clause",
",",
"String",
"keyword",
")",
"{",
"keyword",
"=",
"keyword",
"+",
"\" \"",
";",
"if",
"(",
"clause",
".",
"regionMatches",
"(",
"true",
",",
"0",
",",
"keyword",
",",
"0",
",",
"keyword",
... | Removes the {@code keyword} from the {@code clause} if present. Will
remove {@code keyword + " "}.
@param clause the clause to remove from
@param keyword the keyword to remove
@return a new string with the keyword + " " removed | [
"Removes",
"the",
"{"
] | train | https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/modules/ads_lib/src/main/java/com/google/api/ads/admanager/lib/utils/QueryBuilder.java#L60-L66 |
cdk/cdk | storage/inchi/src/main/java/org/openscience/cdk/inchi/InChIGeneratorFactory.java | InChIGeneratorFactory.getInChIToStructure | public InChIToStructure getInChIToStructure(String inchi, IChemObjectBuilder builder, List<String> options)
throws CDKException {
return (new InChIToStructure(inchi, builder, options));
} | java | public InChIToStructure getInChIToStructure(String inchi, IChemObjectBuilder builder, List<String> options)
throws CDKException {
return (new InChIToStructure(inchi, builder, options));
} | [
"public",
"InChIToStructure",
"getInChIToStructure",
"(",
"String",
"inchi",
",",
"IChemObjectBuilder",
"builder",
",",
"List",
"<",
"String",
">",
"options",
")",
"throws",
"CDKException",
"{",
"return",
"(",
"new",
"InChIToStructure",
"(",
"inchi",
",",
"builder... | <p>Gets structure generator for an InChI string.
@param inchi InChI to generate structure from.
@param options List of options (net.sf.jniinchi.INCHI_OPTION) for structure generation.
@param builder the builder to employ
@return the InChI structure generator object
@throws CDKException if the generator cannot be instantiated | [
"<p",
">",
"Gets",
"structure",
"generator",
"for",
"an",
"InChI",
"string",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/storage/inchi/src/main/java/org/openscience/cdk/inchi/InChIGeneratorFactory.java#L210-L213 |
mapbox/mapbox-navigation-android | libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/utils/DistanceFormatter.java | DistanceFormatter.getDistanceString | private SpannableString getDistanceString(String distance, String unit) {
SpannableString spannableString = new SpannableString(String.format("%s %s", distance, unitStrings.get(unit)));
spannableString.setSpan(new StyleSpan(Typeface.BOLD), 0, distance.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
spannableString.setSpan(new RelativeSizeSpan(0.65f), distance.length() + 1,
spannableString.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
return spannableString;
} | java | private SpannableString getDistanceString(String distance, String unit) {
SpannableString spannableString = new SpannableString(String.format("%s %s", distance, unitStrings.get(unit)));
spannableString.setSpan(new StyleSpan(Typeface.BOLD), 0, distance.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
spannableString.setSpan(new RelativeSizeSpan(0.65f), distance.length() + 1,
spannableString.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
return spannableString;
} | [
"private",
"SpannableString",
"getDistanceString",
"(",
"String",
"distance",
",",
"String",
"unit",
")",
"{",
"SpannableString",
"spannableString",
"=",
"new",
"SpannableString",
"(",
"String",
".",
"format",
"(",
"\"%s %s\"",
",",
"distance",
",",
"unitStrings",
... | Takes in a distance and units and returns a formatted SpannableString where the number is bold
and the unit is shrunked to .65 times the size
@param distance formatted with appropriate decimal places
@param unit string from TurfConstants. This will be converted to the abbreviated form.
@return String with bolded distance and shrunken units | [
"Takes",
"in",
"a",
"distance",
"and",
"units",
"and",
"returns",
"a",
"formatted",
"SpannableString",
"where",
"the",
"number",
"is",
"bold",
"and",
"the",
"unit",
"is",
"shrunked",
"to",
".",
"65",
"times",
"the",
"size"
] | train | https://github.com/mapbox/mapbox-navigation-android/blob/375a89c017d360b9defc2c90d0c03468165162ec/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/utils/DistanceFormatter.java#L155-L163 |
Azure/azure-sdk-for-java | privatedns/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/privatedns/v2018_09_01/implementation/PrivateZonesInner.java | PrivateZonesInner.beginUpdate | public PrivateZoneInner beginUpdate(String resourceGroupName, String privateZoneName, PrivateZoneInner parameters, String ifMatch) {
return beginUpdateWithServiceResponseAsync(resourceGroupName, privateZoneName, parameters, ifMatch).toBlocking().single().body();
} | java | public PrivateZoneInner beginUpdate(String resourceGroupName, String privateZoneName, PrivateZoneInner parameters, String ifMatch) {
return beginUpdateWithServiceResponseAsync(resourceGroupName, privateZoneName, parameters, ifMatch).toBlocking().single().body();
} | [
"public",
"PrivateZoneInner",
"beginUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"privateZoneName",
",",
"PrivateZoneInner",
"parameters",
",",
"String",
"ifMatch",
")",
"{",
"return",
"beginUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"p... | Updates a Private DNS zone. Does not modify virtual network links or DNS records within the zone.
@param resourceGroupName The name of the resource group.
@param privateZoneName The name of the Private DNS zone (without a terminating dot).
@param parameters Parameters supplied to the Update operation.
@param ifMatch The ETag of the Private DNS zone. Omit this value to always overwrite the current zone. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent changes.
@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 PrivateZoneInner object if successful. | [
"Updates",
"a",
"Private",
"DNS",
"zone",
".",
"Does",
"not",
"modify",
"virtual",
"network",
"links",
"or",
"DNS",
"records",
"within",
"the",
"zone",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/privatedns/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/privatedns/v2018_09_01/implementation/PrivateZonesInner.java#L728-L730 |
landawn/AbacusUtil | src/com/landawn/abacus/util/DateUtil.java | DateUtil.addMilliseconds | public static <T extends Calendar> T addMilliseconds(final T calendar, final int amount) {
return roll(calendar, amount, CalendarUnit.MILLISECOND);
} | java | public static <T extends Calendar> T addMilliseconds(final T calendar, final int amount) {
return roll(calendar, amount, CalendarUnit.MILLISECOND);
} | [
"public",
"static",
"<",
"T",
"extends",
"Calendar",
">",
"T",
"addMilliseconds",
"(",
"final",
"T",
"calendar",
",",
"final",
"int",
"amount",
")",
"{",
"return",
"roll",
"(",
"calendar",
",",
"amount",
",",
"CalendarUnit",
".",
"MILLISECOND",
")",
";",
... | Adds a number of milliseconds to a calendar returning a new object.
The original {@code Date} is unchanged.
@param calendar the calendar, not null
@param amount the amount to add, may be negative
@return the new {@code Date} with the amount added
@throws IllegalArgumentException if the calendar is null | [
"Adds",
"a",
"number",
"of",
"milliseconds",
"to",
"a",
"calendar",
"returning",
"a",
"new",
"object",
".",
"The",
"original",
"{",
"@code",
"Date",
"}",
"is",
"unchanged",
"."
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/DateUtil.java#L1161-L1163 |
omadahealth/CircularBarPager | library/src/main/java/com/github/omadahealth/circularbarpager/library/CircularBar.java | CircularBar.animateProgress | public void animateProgress(int start, int end, int duration) {
List<Boolean> list = new ArrayList<>();
list.add(true);
mCirclePieceFillList = list;
setProgress(0);
AnimatorSet set = new AnimatorSet();
set.playTogether(Glider.glide(Skill.QuadEaseInOut, duration, ObjectAnimator.ofFloat(this, "progress", start, end)));
set.setDuration(duration);
set = addListenersToSet(set);
set.start();
} | java | public void animateProgress(int start, int end, int duration) {
List<Boolean> list = new ArrayList<>();
list.add(true);
mCirclePieceFillList = list;
setProgress(0);
AnimatorSet set = new AnimatorSet();
set.playTogether(Glider.glide(Skill.QuadEaseInOut, duration, ObjectAnimator.ofFloat(this, "progress", start, end)));
set.setDuration(duration);
set = addListenersToSet(set);
set.start();
} | [
"public",
"void",
"animateProgress",
"(",
"int",
"start",
",",
"int",
"end",
",",
"int",
"duration",
")",
"{",
"List",
"<",
"Boolean",
">",
"list",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"list",
".",
"add",
"(",
"true",
")",
";",
"mCirclePiece... | Animate the change in progress of this view
@param start The value to start from, between 0-100
@param end The value to set it to, between 0-100
@param duration The the time to run the animation over | [
"Animate",
"the",
"change",
"in",
"progress",
"of",
"this",
"view"
] | train | https://github.com/omadahealth/CircularBarPager/blob/3a43e8828849da727fd13345e83b8432f7271155/library/src/main/java/com/github/omadahealth/circularbarpager/library/CircularBar.java#L602-L612 |
alkacon/opencms-core | src/org/opencms/db/CmsSubscriptionManager.java | CmsSubscriptionManager.getDateLastVisitedBy | public long getDateLastVisitedBy(CmsObject cms, CmsUser user, String resourcePath) throws CmsException {
CmsResource resource = cms.readResource(resourcePath, CmsResourceFilter.ALL);
return m_securityManager.getDateLastVisitedBy(cms.getRequestContext(), getPoolName(), user, resource);
} | java | public long getDateLastVisitedBy(CmsObject cms, CmsUser user, String resourcePath) throws CmsException {
CmsResource resource = cms.readResource(resourcePath, CmsResourceFilter.ALL);
return m_securityManager.getDateLastVisitedBy(cms.getRequestContext(), getPoolName(), user, resource);
} | [
"public",
"long",
"getDateLastVisitedBy",
"(",
"CmsObject",
"cms",
",",
"CmsUser",
"user",
",",
"String",
"resourcePath",
")",
"throws",
"CmsException",
"{",
"CmsResource",
"resource",
"=",
"cms",
".",
"readResource",
"(",
"resourcePath",
",",
"CmsResourceFilter",
... | Returns the date when the resource was last visited by the user.<p>
@param cms the current users context
@param user the user to check the date
@param resourcePath the name of the resource to check the date
@return the date when the resource was last visited by the user
@throws CmsException if something goes wrong | [
"Returns",
"the",
"date",
"when",
"the",
"resource",
"was",
"last",
"visited",
"by",
"the",
"user",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSubscriptionManager.java#L106-L110 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/ExpressRouteCrossConnectionsInner.java | ExpressRouteCrossConnectionsInner.beginUpdateTagsAsync | public Observable<ExpressRouteCrossConnectionInner> beginUpdateTagsAsync(String resourceGroupName, String crossConnectionName) {
return beginUpdateTagsWithServiceResponseAsync(resourceGroupName, crossConnectionName).map(new Func1<ServiceResponse<ExpressRouteCrossConnectionInner>, ExpressRouteCrossConnectionInner>() {
@Override
public ExpressRouteCrossConnectionInner call(ServiceResponse<ExpressRouteCrossConnectionInner> response) {
return response.body();
}
});
} | java | public Observable<ExpressRouteCrossConnectionInner> beginUpdateTagsAsync(String resourceGroupName, String crossConnectionName) {
return beginUpdateTagsWithServiceResponseAsync(resourceGroupName, crossConnectionName).map(new Func1<ServiceResponse<ExpressRouteCrossConnectionInner>, ExpressRouteCrossConnectionInner>() {
@Override
public ExpressRouteCrossConnectionInner call(ServiceResponse<ExpressRouteCrossConnectionInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ExpressRouteCrossConnectionInner",
">",
"beginUpdateTagsAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"crossConnectionName",
")",
"{",
"return",
"beginUpdateTagsWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"crossConnection... | Updates an express route cross connection tags.
@param resourceGroupName The name of the resource group.
@param crossConnectionName The name of the cross connection.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ExpressRouteCrossConnectionInner object | [
"Updates",
"an",
"express",
"route",
"cross",
"connection",
"tags",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/ExpressRouteCrossConnectionsInner.java#L778-L785 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/cache/impl/CacheProxyUtil.java | CacheProxyUtil.validateNotNull | public static <K, V> void validateNotNull(Map<? extends K, ? extends V> map) {
checkNotNull(map, "map is null");
boolean containsNullKey = false;
boolean containsNullValue = false;
// we catch possible NPE since the Map implementation could not support null values
// TODO: is it possible to validate a map more efficiently without try-catch blocks?
try {
containsNullKey = map.containsKey(null);
} catch (NullPointerException e) {
// ignore if null key is not allowed for this map
ignore(e);
}
try {
containsNullValue = map.containsValue(null);
} catch (NullPointerException e) {
// ignore if null value is not allowed for this map
ignore(e);
}
if (containsNullKey) {
throw new NullPointerException(NULL_KEY_IS_NOT_ALLOWED);
}
if (containsNullValue) {
throw new NullPointerException(NULL_VALUE_IS_NOT_ALLOWED);
}
} | java | public static <K, V> void validateNotNull(Map<? extends K, ? extends V> map) {
checkNotNull(map, "map is null");
boolean containsNullKey = false;
boolean containsNullValue = false;
// we catch possible NPE since the Map implementation could not support null values
// TODO: is it possible to validate a map more efficiently without try-catch blocks?
try {
containsNullKey = map.containsKey(null);
} catch (NullPointerException e) {
// ignore if null key is not allowed for this map
ignore(e);
}
try {
containsNullValue = map.containsValue(null);
} catch (NullPointerException e) {
// ignore if null value is not allowed for this map
ignore(e);
}
if (containsNullKey) {
throw new NullPointerException(NULL_KEY_IS_NOT_ALLOWED);
}
if (containsNullValue) {
throw new NullPointerException(NULL_VALUE_IS_NOT_ALLOWED);
}
} | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"void",
"validateNotNull",
"(",
"Map",
"<",
"?",
"extends",
"K",
",",
"?",
"extends",
"V",
">",
"map",
")",
"{",
"checkNotNull",
"(",
"map",
",",
"\"map is null\"",
")",
";",
"boolean",
"containsNullKey",
"=... | This validator ensures that no key or value is null in the provided map.
@param map the map to be validated.
@param <K> the type of key.
@param <V> the type of value.
@throws java.lang.NullPointerException if provided map contains a null key or value in the map. | [
"This",
"validator",
"ensures",
"that",
"no",
"key",
"or",
"value",
"is",
"null",
"in",
"the",
"provided",
"map",
"."
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/cache/impl/CacheProxyUtil.java#L129-L154 |
alkacon/opencms-core | src/org/opencms/file/CmsObject.java | CmsObject.deleteGroup | public void deleteGroup(CmsUUID groupId, CmsUUID replacementId) throws CmsException {
m_securityManager.deleteGroup(m_context, groupId, replacementId);
} | java | public void deleteGroup(CmsUUID groupId, CmsUUID replacementId) throws CmsException {
m_securityManager.deleteGroup(m_context, groupId, replacementId);
} | [
"public",
"void",
"deleteGroup",
"(",
"CmsUUID",
"groupId",
",",
"CmsUUID",
"replacementId",
")",
"throws",
"CmsException",
"{",
"m_securityManager",
".",
"deleteGroup",
"(",
"m_context",
",",
"groupId",
",",
"replacementId",
")",
";",
"}"
] | Deletes a group, where all permissions, users and children of the group
are transfered to a replacement group.<p>
@param groupId the id of the group to be deleted
@param replacementId the id of the group to be transfered, can be <code>null</code>
@throws CmsException if operation was not successful | [
"Deletes",
"a",
"group",
"where",
"all",
"permissions",
"users",
"and",
"children",
"of",
"the",
"group",
"are",
"transfered",
"to",
"a",
"replacement",
"group",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/CmsObject.java#L923-L926 |
citrusframework/citrus | modules/citrus-ftp/src/main/java/com/consol/citrus/ftp/client/FtpClient.java | FtpClient.getLocalFileInputStream | protected InputStream getLocalFileInputStream(String path, String dataType, TestContext context) throws IOException {
if (dataType.equals(DataType.ASCII.name())) {
String content = context.replaceDynamicContentInString(FileUtils.readToString(FileUtils.getFileResource(path)));
return new ByteArrayInputStream(content.getBytes(FileUtils.getDefaultCharset()));
} else {
return FileUtils.getFileResource(path).getInputStream();
}
} | java | protected InputStream getLocalFileInputStream(String path, String dataType, TestContext context) throws IOException {
if (dataType.equals(DataType.ASCII.name())) {
String content = context.replaceDynamicContentInString(FileUtils.readToString(FileUtils.getFileResource(path)));
return new ByteArrayInputStream(content.getBytes(FileUtils.getDefaultCharset()));
} else {
return FileUtils.getFileResource(path).getInputStream();
}
} | [
"protected",
"InputStream",
"getLocalFileInputStream",
"(",
"String",
"path",
",",
"String",
"dataType",
",",
"TestContext",
"context",
")",
"throws",
"IOException",
"{",
"if",
"(",
"dataType",
".",
"equals",
"(",
"DataType",
".",
"ASCII",
".",
"name",
"(",
")... | Constructs local file input stream. When using ASCII data type the test variable replacement is activated otherwise
plain byte stream is used.
@param path
@param dataType
@param context
@return
@throws IOException | [
"Constructs",
"local",
"file",
"input",
"stream",
".",
"When",
"using",
"ASCII",
"data",
"type",
"the",
"test",
"variable",
"replacement",
"is",
"activated",
"otherwise",
"plain",
"byte",
"stream",
"is",
"used",
"."
] | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-ftp/src/main/java/com/consol/citrus/ftp/client/FtpClient.java#L295-L302 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/coll/CollationRootElements.java | CollationRootElements.getPrimaryBefore | long getPrimaryBefore(long p, boolean isCompressible) {
int index = findPrimary(p);
int step;
long q = elements[index];
if(p == (q & 0xffffff00L)) {
// Found p itself. Return the previous primary.
// See if p is at the end of a previous range.
step = (int)q & PRIMARY_STEP_MASK;
if(step == 0) {
// p is not at the end of a range. Look for the previous primary.
do {
p = elements[--index];
} while((p & SEC_TER_DELTA_FLAG) != 0);
return p & 0xffffff00L;
}
} else {
// p is in a range, and not at the start.
long nextElement = elements[index + 1];
assert(isEndOfPrimaryRange(nextElement));
step = (int)nextElement & PRIMARY_STEP_MASK;
}
// Return the previous range primary.
if((p & 0xffff) == 0) {
return Collation.decTwoBytePrimaryByOneStep(p, isCompressible, step);
} else {
return Collation.decThreeBytePrimaryByOneStep(p, isCompressible, step);
}
} | java | long getPrimaryBefore(long p, boolean isCompressible) {
int index = findPrimary(p);
int step;
long q = elements[index];
if(p == (q & 0xffffff00L)) {
// Found p itself. Return the previous primary.
// See if p is at the end of a previous range.
step = (int)q & PRIMARY_STEP_MASK;
if(step == 0) {
// p is not at the end of a range. Look for the previous primary.
do {
p = elements[--index];
} while((p & SEC_TER_DELTA_FLAG) != 0);
return p & 0xffffff00L;
}
} else {
// p is in a range, and not at the start.
long nextElement = elements[index + 1];
assert(isEndOfPrimaryRange(nextElement));
step = (int)nextElement & PRIMARY_STEP_MASK;
}
// Return the previous range primary.
if((p & 0xffff) == 0) {
return Collation.decTwoBytePrimaryByOneStep(p, isCompressible, step);
} else {
return Collation.decThreeBytePrimaryByOneStep(p, isCompressible, step);
}
} | [
"long",
"getPrimaryBefore",
"(",
"long",
"p",
",",
"boolean",
"isCompressible",
")",
"{",
"int",
"index",
"=",
"findPrimary",
"(",
"p",
")",
";",
"int",
"step",
";",
"long",
"q",
"=",
"elements",
"[",
"index",
"]",
";",
"if",
"(",
"p",
"==",
"(",
"... | Returns the primary weight before p.
p must be greater than the first root primary. | [
"Returns",
"the",
"primary",
"weight",
"before",
"p",
".",
"p",
"must",
"be",
"greater",
"than",
"the",
"first",
"root",
"primary",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/coll/CollationRootElements.java#L220-L247 |
petergeneric/stdlib | guice/hibernate/src/main/java/com/peterphi/std/guice/hibernate/module/logging/HibernateObservingInterceptor.java | HibernateObservingInterceptor.startSQLLogger | public HibernateSQLLogger startSQLLogger(final String tracingOperationId)
{
final HibernateSQLLogger logger = new HibernateSQLLogger(this, tracingOperationId);
logger.start();
return logger;
} | java | public HibernateSQLLogger startSQLLogger(final String tracingOperationId)
{
final HibernateSQLLogger logger = new HibernateSQLLogger(this, tracingOperationId);
logger.start();
return logger;
} | [
"public",
"HibernateSQLLogger",
"startSQLLogger",
"(",
"final",
"String",
"tracingOperationId",
")",
"{",
"final",
"HibernateSQLLogger",
"logger",
"=",
"new",
"HibernateSQLLogger",
"(",
"this",
",",
"tracingOperationId",
")",
";",
"logger",
".",
"start",
"(",
")",
... | Start a new logger which records SQL Prepared Statements created by Hibernate in this Thread. Must be closed (or treated as
autoclose)
@param tracingOperationId the tracing operation this sql logger should be associated with
@return | [
"Start",
"a",
"new",
"logger",
"which",
"records",
"SQL",
"Prepared",
"Statements",
"created",
"by",
"Hibernate",
"in",
"this",
"Thread",
".",
"Must",
"be",
"closed",
"(",
"or",
"treated",
"as",
"autoclose",
")"
] | train | https://github.com/petergeneric/stdlib/blob/d4025d2f881bc0542b1e004c5f65a1ccaf895836/guice/hibernate/src/main/java/com/peterphi/std/guice/hibernate/module/logging/HibernateObservingInterceptor.java#L73-L80 |
apereo/cas | core/cas-server-core-authentication-mfa-api/src/main/java/org/apereo/cas/authentication/trigger/RestEndpointMultifactorAuthenticationTrigger.java | RestEndpointMultifactorAuthenticationTrigger.callRestEndpointForMultifactor | protected String callRestEndpointForMultifactor(final Principal principal, final Service resolvedService) {
val restTemplate = new RestTemplate();
val restEndpoint = casProperties.getAuthn().getMfa().getRestEndpoint();
val entity = new RestEndpointEntity(principal.getId(), resolvedService.getId());
val responseEntity = restTemplate.postForEntity(restEndpoint, entity, String.class);
if (responseEntity.getStatusCode() == HttpStatus.OK) {
return responseEntity.getBody();
}
return null;
} | java | protected String callRestEndpointForMultifactor(final Principal principal, final Service resolvedService) {
val restTemplate = new RestTemplate();
val restEndpoint = casProperties.getAuthn().getMfa().getRestEndpoint();
val entity = new RestEndpointEntity(principal.getId(), resolvedService.getId());
val responseEntity = restTemplate.postForEntity(restEndpoint, entity, String.class);
if (responseEntity.getStatusCode() == HttpStatus.OK) {
return responseEntity.getBody();
}
return null;
} | [
"protected",
"String",
"callRestEndpointForMultifactor",
"(",
"final",
"Principal",
"principal",
",",
"final",
"Service",
"resolvedService",
")",
"{",
"val",
"restTemplate",
"=",
"new",
"RestTemplate",
"(",
")",
";",
"val",
"restEndpoint",
"=",
"casProperties",
".",... | Call rest endpoint for multifactor.
@param principal the principal
@param resolvedService the resolved service
@return return the rest response, typically the mfa id. | [
"Call",
"rest",
"endpoint",
"for",
"multifactor",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-authentication-mfa-api/src/main/java/org/apereo/cas/authentication/trigger/RestEndpointMultifactorAuthenticationTrigger.java#L84-L93 |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/failover/AbstractMastersListener.java | AbstractMastersListener.syncConnection | public void syncConnection(Protocol from, Protocol to) throws SQLException {
if (from != null) {
proxy.lock.lock();
try {
to.resetStateAfterFailover(from.getMaxRows(), from.getTransactionIsolationLevel(),
from.getDatabase(), from.getAutocommit());
} finally {
proxy.lock.unlock();
}
}
} | java | public void syncConnection(Protocol from, Protocol to) throws SQLException {
if (from != null) {
proxy.lock.lock();
try {
to.resetStateAfterFailover(from.getMaxRows(), from.getTransactionIsolationLevel(),
from.getDatabase(), from.getAutocommit());
} finally {
proxy.lock.unlock();
}
}
} | [
"public",
"void",
"syncConnection",
"(",
"Protocol",
"from",
",",
"Protocol",
"to",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"from",
"!=",
"null",
")",
"{",
"proxy",
".",
"lock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"to",
".",
"resetStateAfter... | When switching between 2 connections, report existing connection parameter to the new used
connection.
@param from used connection
@param to will-be-current connection
@throws SQLException if catalog cannot be set | [
"When",
"switching",
"between",
"2",
"connections",
"report",
"existing",
"connection",
"parameter",
"to",
"the",
"new",
"used",
"connection",
"."
] | train | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/failover/AbstractMastersListener.java#L409-L422 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/collection/impl/queue/QueueContainer.java | QueueContainer.offerBackup | public void offerBackup(Data data, long itemId) {
QueueItem item = new QueueItem(this, itemId, null);
if (!store.isEnabled() || store.getMemoryLimit() > getItemQueue().size()) {
item.setData(data);
}
getBackupMap().put(itemId, item);
} | java | public void offerBackup(Data data, long itemId) {
QueueItem item = new QueueItem(this, itemId, null);
if (!store.isEnabled() || store.getMemoryLimit() > getItemQueue().size()) {
item.setData(data);
}
getBackupMap().put(itemId, item);
} | [
"public",
"void",
"offerBackup",
"(",
"Data",
"data",
",",
"long",
"itemId",
")",
"{",
"QueueItem",
"item",
"=",
"new",
"QueueItem",
"(",
"this",
",",
"itemId",
",",
"null",
")",
";",
"if",
"(",
"!",
"store",
".",
"isEnabled",
"(",
")",
"||",
"store"... | Offers the item to the backup map. If the memory limit
has been achieved the item data will not be kept in-memory.
Executed on the backup replica
@param data the item data
@param itemId the item ID as determined by the primary replica | [
"Offers",
"the",
"item",
"to",
"the",
"backup",
"map",
".",
"If",
"the",
"memory",
"limit",
"has",
"been",
"achieved",
"the",
"item",
"data",
"will",
"not",
"be",
"kept",
"in",
"-",
"memory",
".",
"Executed",
"on",
"the",
"backup",
"replica"
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/collection/impl/queue/QueueContainer.java#L463-L469 |
xmlunit/xmlunit | xmlunit-placeholders/src/main/java/org/xmlunit/placeholder/PlaceholderSupport.java | PlaceholderSupport.withPlaceholderSupport | public static <D extends DifferenceEngineConfigurer<D>>
D withPlaceholderSupport(D configurer) {
return withPlaceholderSupportUsingDelimiters(configurer, null, null);
} | java | public static <D extends DifferenceEngineConfigurer<D>>
D withPlaceholderSupport(D configurer) {
return withPlaceholderSupportUsingDelimiters(configurer, null, null);
} | [
"public",
"static",
"<",
"D",
"extends",
"DifferenceEngineConfigurer",
"<",
"D",
">",
">",
"D",
"withPlaceholderSupport",
"(",
"D",
"configurer",
")",
"{",
"return",
"withPlaceholderSupportUsingDelimiters",
"(",
"configurer",
",",
"null",
",",
"null",
")",
";",
... | Adds placeholder support to a {@link DifferenceEngineConfigurer}.
@param configurer the configurer to add support to
@return the configurer with placeholder support added in | [
"Adds",
"placeholder",
"support",
"to",
"a",
"{"
] | train | https://github.com/xmlunit/xmlunit/blob/fe3d701d43f57ee83dcba336e4c1555619d3084b/xmlunit-placeholders/src/main/java/org/xmlunit/placeholder/PlaceholderSupport.java#L39-L42 |
super-csv/super-csv | super-csv/src/main/java/org/supercsv/util/MethodCache.java | MethodCache.getSetMethod | public <T> Method getSetMethod(final Object object, final String fieldName, final Class<?> argumentType) {
if( object == null ) {
throw new NullPointerException("object should not be null");
} else if( fieldName == null ) {
throw new NullPointerException("fieldName should not be null");
} else if( argumentType == null ) {
throw new NullPointerException("argumentType should not be null");
}
Method method = setMethodsCache.get(object.getClass(), argumentType, fieldName);
if( method == null ) {
method = ReflectionUtils.findSetter(object, fieldName, argumentType);
setMethodsCache.set(object.getClass(), argumentType, fieldName, method);
}
return method;
} | java | public <T> Method getSetMethod(final Object object, final String fieldName, final Class<?> argumentType) {
if( object == null ) {
throw new NullPointerException("object should not be null");
} else if( fieldName == null ) {
throw new NullPointerException("fieldName should not be null");
} else if( argumentType == null ) {
throw new NullPointerException("argumentType should not be null");
}
Method method = setMethodsCache.get(object.getClass(), argumentType, fieldName);
if( method == null ) {
method = ReflectionUtils.findSetter(object, fieldName, argumentType);
setMethodsCache.set(object.getClass(), argumentType, fieldName, method);
}
return method;
} | [
"public",
"<",
"T",
">",
"Method",
"getSetMethod",
"(",
"final",
"Object",
"object",
",",
"final",
"String",
"fieldName",
",",
"final",
"Class",
"<",
"?",
">",
"argumentType",
")",
"{",
"if",
"(",
"object",
"==",
"null",
")",
"{",
"throw",
"new",
"Null... | Returns the setter method for the field on an object.
@param object
the object
@param fieldName
the field name
@param argumentType
the type to be passed to the setter
@param <T>
the object type
@return the setter method associated with the field on the object
@throws NullPointerException
if object, fieldName or fieldType is null
@throws SuperCsvReflectionException
if the setter doesn't exist or is not visible | [
"Returns",
"the",
"setter",
"method",
"for",
"the",
"field",
"on",
"an",
"object",
"."
] | train | https://github.com/super-csv/super-csv/blob/f18db724674dc1c4116e25142c1b5403ebf43e96/super-csv/src/main/java/org/supercsv/util/MethodCache.java#L85-L100 |
OpenLiberty/open-liberty | dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheUnitImpl.java | CacheUnitImpl.createEventSource | public EventSource createEventSource(boolean createAsyncEventSource, String cacheName) throws DynamicCacheServiceNotStarted {
if (objectCacheUnit == null) {
throw new DynamicCacheServiceNotStarted("Object cache service has not been started.");
}
return objectCacheUnit.createEventSource(createAsyncEventSource, cacheName);
} | java | public EventSource createEventSource(boolean createAsyncEventSource, String cacheName) throws DynamicCacheServiceNotStarted {
if (objectCacheUnit == null) {
throw new DynamicCacheServiceNotStarted("Object cache service has not been started.");
}
return objectCacheUnit.createEventSource(createAsyncEventSource, cacheName);
} | [
"public",
"EventSource",
"createEventSource",
"(",
"boolean",
"createAsyncEventSource",
",",
"String",
"cacheName",
")",
"throws",
"DynamicCacheServiceNotStarted",
"{",
"if",
"(",
"objectCacheUnit",
"==",
"null",
")",
"{",
"throw",
"new",
"DynamicCacheServiceNotStarted",
... | This implements the method in the CacheUnit interface.
This is called to create event source object.
It calls ObjectCacheUnit to perform this operation.
@param createAsyncEventSource boolean true - using async thread context for callback; false - using caller thread for callback
@param cacheName The cache name
@return EventSourceIntf The event source | [
"This",
"implements",
"the",
"method",
"in",
"the",
"CacheUnit",
"interface",
".",
"This",
"is",
"called",
"to",
"create",
"event",
"source",
"object",
".",
"It",
"calls",
"ObjectCacheUnit",
"to",
"perform",
"this",
"operation",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheUnitImpl.java#L457-L462 |
modelmapper/modelmapper | core/src/main/java/org/modelmapper/internal/ImplicitMappingBuilder.java | ImplicitMappingBuilder.disambiguateMappings | private PropertyMappingImpl disambiguateMappings() {
List<WeightPropertyMappingImpl> weightMappings = new ArrayList<WeightPropertyMappingImpl>(mappings.size());
for (PropertyMappingImpl mapping : mappings) {
SourceTokensMatcher matcher = createSourceTokensMatcher(mapping);
DestTokenIterator destTokenIterator = new DestTokenIterator(mapping);
while (destTokenIterator.hasNext())
matcher.match(destTokenIterator.next());
double matchRatio = (((double) matcher.matches()) * matcher.orderMatchWeight())
/ ((double) matcher.total() + destTokenIterator.total());
weightMappings.add(new WeightPropertyMappingImpl(mapping, matchRatio));
}
Collections.sort(weightMappings);
if (weightMappings.get(0).ratio == weightMappings.get(1).ratio)
return null;
return weightMappings.get(0).mapping;
} | java | private PropertyMappingImpl disambiguateMappings() {
List<WeightPropertyMappingImpl> weightMappings = new ArrayList<WeightPropertyMappingImpl>(mappings.size());
for (PropertyMappingImpl mapping : mappings) {
SourceTokensMatcher matcher = createSourceTokensMatcher(mapping);
DestTokenIterator destTokenIterator = new DestTokenIterator(mapping);
while (destTokenIterator.hasNext())
matcher.match(destTokenIterator.next());
double matchRatio = (((double) matcher.matches()) * matcher.orderMatchWeight())
/ ((double) matcher.total() + destTokenIterator.total());
weightMappings.add(new WeightPropertyMappingImpl(mapping, matchRatio));
}
Collections.sort(weightMappings);
if (weightMappings.get(0).ratio == weightMappings.get(1).ratio)
return null;
return weightMappings.get(0).mapping;
} | [
"private",
"PropertyMappingImpl",
"disambiguateMappings",
"(",
")",
"{",
"List",
"<",
"WeightPropertyMappingImpl",
">",
"weightMappings",
"=",
"new",
"ArrayList",
"<",
"WeightPropertyMappingImpl",
">",
"(",
"mappings",
".",
"size",
"(",
")",
")",
";",
"for",
"(",
... | Disambiguates the captured mappings by looking for the mapping with property tokens that most
closely match the destination. Match closeness is calculated as the total number of matched
source to destination tokens * the weight that the order of properties are matched /
the total number of source and destination tokens. Currently this algorithm does not consider
class name tokens.
@return closest matching mapping, else {@code null} if one could not be determined | [
"Disambiguates",
"the",
"captured",
"mappings",
"by",
"looking",
"for",
"the",
"mapping",
"with",
"property",
"tokens",
"that",
"most",
"closely",
"match",
"the",
"destination",
".",
"Match",
"closeness",
"is",
"calculated",
"as",
"the",
"total",
"number",
"of",... | train | https://github.com/modelmapper/modelmapper/blob/491d165ded9dc9aba7ce8b56984249e1a1363204/core/src/main/java/org/modelmapper/internal/ImplicitMappingBuilder.java#L252-L269 |
twilio/twilio-java | src/main/java/com/twilio/rest/api/v2010/AccountReader.java | AccountReader.firstPage | @Override
@SuppressWarnings("checkstyle:linelength")
public Page<Account> firstPage(final TwilioRestClient client) {
Request request = new Request(
HttpMethod.GET,
Domains.API.toString(),
"/2010-04-01/Accounts.json",
client.getRegion()
);
addQueryParams(request);
return pageForRequest(client, request);
} | java | @Override
@SuppressWarnings("checkstyle:linelength")
public Page<Account> firstPage(final TwilioRestClient client) {
Request request = new Request(
HttpMethod.GET,
Domains.API.toString(),
"/2010-04-01/Accounts.json",
client.getRegion()
);
addQueryParams(request);
return pageForRequest(client, request);
} | [
"@",
"Override",
"@",
"SuppressWarnings",
"(",
"\"checkstyle:linelength\"",
")",
"public",
"Page",
"<",
"Account",
">",
"firstPage",
"(",
"final",
"TwilioRestClient",
"client",
")",
"{",
"Request",
"request",
"=",
"new",
"Request",
"(",
"HttpMethod",
".",
"GET",... | Make the request to the Twilio API to perform the read.
@param client TwilioRestClient with which to make the request
@return Account ResourceSet | [
"Make",
"the",
"request",
"to",
"the",
"Twilio",
"API",
"to",
"perform",
"the",
"read",
"."
] | train | https://github.com/twilio/twilio-java/blob/0318974c0a6a152994af167d430255684d5e9b9f/src/main/java/com/twilio/rest/api/v2010/AccountReader.java#L67-L79 |
smanikandan14/ThinDownloadManager | ThinDownloadManager/src/main/java/com/thin/downloadmanager/DownloadDispatcher.java | DownloadDispatcher.cleanupDestination | private void cleanupDestination(DownloadRequest request, boolean forceClean) {
if (!request.isResumable() || forceClean) {
Log.d("cleanupDestination() deleting " + request.getDestinationURI().getPath());
File destinationFile = new File(request.getDestinationURI().getPath());
if (destinationFile.exists()) {
destinationFile.delete();
}
}
} | java | private void cleanupDestination(DownloadRequest request, boolean forceClean) {
if (!request.isResumable() || forceClean) {
Log.d("cleanupDestination() deleting " + request.getDestinationURI().getPath());
File destinationFile = new File(request.getDestinationURI().getPath());
if (destinationFile.exists()) {
destinationFile.delete();
}
}
} | [
"private",
"void",
"cleanupDestination",
"(",
"DownloadRequest",
"request",
",",
"boolean",
"forceClean",
")",
"{",
"if",
"(",
"!",
"request",
".",
"isResumable",
"(",
")",
"||",
"forceClean",
")",
"{",
"Log",
".",
"d",
"(",
"\"cleanupDestination() deleting \"",... | Called just before the thread finishes, regardless of status, to take any necessary action on
the downloaded file with mDownloadedCacheSize file.
@param forceClean - It will delete downloaded cache, Even streaming is enabled, If user intentionally cancelled. | [
"Called",
"just",
"before",
"the",
"thread",
"finishes",
"regardless",
"of",
"status",
"to",
"take",
"any",
"necessary",
"action",
"on",
"the",
"downloaded",
"file",
"with",
"mDownloadedCacheSize",
"file",
"."
] | train | https://github.com/smanikandan14/ThinDownloadManager/blob/63c153c918eff0b1c9de384171563d2c70baea5e/ThinDownloadManager/src/main/java/com/thin/downloadmanager/DownloadDispatcher.java#L438-L446 |
micronaut-projects/micronaut-core | inject/src/main/java/io/micronaut/context/StaticMessageSource.java | StaticMessageSource.addMessage | public @Nonnull StaticMessageSource addMessage(@Nonnull String code, @Nonnull String message) {
if (StringUtils.isNotEmpty(code) && StringUtils.isNotEmpty(message)) {
messageMap.put(new MessageKey(Locale.getDefault(), code), message);
}
return this;
} | java | public @Nonnull StaticMessageSource addMessage(@Nonnull String code, @Nonnull String message) {
if (StringUtils.isNotEmpty(code) && StringUtils.isNotEmpty(message)) {
messageMap.put(new MessageKey(Locale.getDefault(), code), message);
}
return this;
} | [
"public",
"@",
"Nonnull",
"StaticMessageSource",
"addMessage",
"(",
"@",
"Nonnull",
"String",
"code",
",",
"@",
"Nonnull",
"String",
"message",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isNotEmpty",
"(",
"code",
")",
"&&",
"StringUtils",
".",
"isNotEmpty",
"... | Adds a message to the default locale.
@param code The code
@param message The the message
@return This message source | [
"Adds",
"a",
"message",
"to",
"the",
"default",
"locale",
"."
] | train | https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/inject/src/main/java/io/micronaut/context/StaticMessageSource.java#L44-L49 |
fabric8io/ipaas-quickstarts | archetype-builder/src/main/java/io/fabric8/tooling/archetype/ArchetypeUtils.java | ArchetypeUtils.isValidFileToCopy | public boolean isValidFileToCopy(File projectDir, File src, Set<String> ignoreFileSet) throws IOException {
if (isValidSourceFileOrDir(src)) {
if (src.equals(projectDir)) {
return true;
}
String relative = relativePath(projectDir, src);
return !sourceCodeDirPaths.contains(relative) && !ignoreFileSet.contains(relative);
}
return false;
} | java | public boolean isValidFileToCopy(File projectDir, File src, Set<String> ignoreFileSet) throws IOException {
if (isValidSourceFileOrDir(src)) {
if (src.equals(projectDir)) {
return true;
}
String relative = relativePath(projectDir, src);
return !sourceCodeDirPaths.contains(relative) && !ignoreFileSet.contains(relative);
}
return false;
} | [
"public",
"boolean",
"isValidFileToCopy",
"(",
"File",
"projectDir",
",",
"File",
"src",
",",
"Set",
"<",
"String",
">",
"ignoreFileSet",
")",
"throws",
"IOException",
"{",
"if",
"(",
"isValidSourceFileOrDir",
"(",
"src",
")",
")",
"{",
"if",
"(",
"src",
"... | Is the file a valid file to copy (excludes files starting with a dot, build output
or java/groovy/kotlin/scala source code | [
"Is",
"the",
"file",
"a",
"valid",
"file",
"to",
"copy",
"(",
"excludes",
"files",
"starting",
"with",
"a",
"dot",
"build",
"output",
"or",
"java",
"/",
"groovy",
"/",
"kotlin",
"/",
"scala",
"source",
"code"
] | train | https://github.com/fabric8io/ipaas-quickstarts/blob/cf9a9aa09204a82ac996304ab8c96791f7e5db22/archetype-builder/src/main/java/io/fabric8/tooling/archetype/ArchetypeUtils.java#L159-L168 |
osglworks/java-tool | src/main/java/org/osgl/util/E.java | E.invalidArgIfNot | public static void invalidArgIfNot(boolean tester, String msg, Object... args) {
if (!tester) {
throw invalidArg(msg, args);
}
} | java | public static void invalidArgIfNot(boolean tester, String msg, Object... args) {
if (!tester) {
throw invalidArg(msg, args);
}
} | [
"public",
"static",
"void",
"invalidArgIfNot",
"(",
"boolean",
"tester",
",",
"String",
"msg",
",",
"Object",
"...",
"args",
")",
"{",
"if",
"(",
"!",
"tester",
")",
"{",
"throw",
"invalidArg",
"(",
"msg",
",",
"args",
")",
";",
"}",
"}"
] | Throws out an {@link InvalidArgException} with error message specified
when `tester` is `false`.
@param tester
when `false` then throws out the exception.
@param msg
the error message format pattern.
@param args
the error message format arguments. | [
"Throws",
"out",
"an",
"{",
"@link",
"InvalidArgException",
"}",
"with",
"error",
"message",
"specified",
"when",
"tester",
"is",
"false",
"."
] | train | https://github.com/osglworks/java-tool/blob/8b6eee2bccb067eb32e6a7bc4a4dfef7a7d9008b/src/main/java/org/osgl/util/E.java#L420-L424 |
BranchMetrics/android-branch-deep-linking | Branch-SDK/src/io/branch/referral/ExtendedAnswerProvider.java | ExtendedAnswerProvider.provideData | public void provideData(String eventName, JSONObject eventData, String identityID) {
try {
KitEvent kitEvent = new KitEvent(eventName);
if (eventData != null) {
addJsonObjectToKitEvent(kitEvent, eventData, "");
kitEvent.putAttribute(Defines.Jsonkey.BranchIdentity.getKey(), identityID);
AnswersOptionalLogger.get().logKitEvent(kitEvent);
}
} catch (Throwable ignore) {
}
} | java | public void provideData(String eventName, JSONObject eventData, String identityID) {
try {
KitEvent kitEvent = new KitEvent(eventName);
if (eventData != null) {
addJsonObjectToKitEvent(kitEvent, eventData, "");
kitEvent.putAttribute(Defines.Jsonkey.BranchIdentity.getKey(), identityID);
AnswersOptionalLogger.get().logKitEvent(kitEvent);
}
} catch (Throwable ignore) {
}
} | [
"public",
"void",
"provideData",
"(",
"String",
"eventName",
",",
"JSONObject",
"eventData",
",",
"String",
"identityID",
")",
"{",
"try",
"{",
"KitEvent",
"kitEvent",
"=",
"new",
"KitEvent",
"(",
"eventName",
")",
";",
"if",
"(",
"eventData",
"!=",
"null",
... | <p>
Method for sending the kit events to Answers for Branch Events.
Method create a Json Object to flatten and create the {@link KitEvent} with key-values
</p>
@param eventName {@link String} name of the KitEvent
@param eventData {@link JSONObject} JsonObject containing the event data | [
"<p",
">",
"Method",
"for",
"sending",
"the",
"kit",
"events",
"to",
"Answers",
"for",
"Branch",
"Events",
".",
"Method",
"create",
"a",
"Json",
"Object",
"to",
"flatten",
"and",
"create",
"the",
"{",
"@link",
"KitEvent",
"}",
"with",
"key",
"-",
"values... | train | https://github.com/BranchMetrics/android-branch-deep-linking/blob/e3bee2ccfcbf6d4bf1a5815b5b86666e4ff8f848/Branch-SDK/src/io/branch/referral/ExtendedAnswerProvider.java#L41-L51 |
grycap/coreutils | coreutils-common/src/main/java/es/upv/grycap/coreutils/common/config/OptionalConfig.java | OptionalConfig.getDuration | public Optional<Long> getDuration(final String path, final TimeUnit unit) {
return config.hasPath(requireNonNull(path, "A non-null path expected"))
? ofNullable(config.getDuration(path, requireNonNull(unit, "A non-null unit expected"))) : empty();
} | java | public Optional<Long> getDuration(final String path, final TimeUnit unit) {
return config.hasPath(requireNonNull(path, "A non-null path expected"))
? ofNullable(config.getDuration(path, requireNonNull(unit, "A non-null unit expected"))) : empty();
} | [
"public",
"Optional",
"<",
"Long",
">",
"getDuration",
"(",
"final",
"String",
"path",
",",
"final",
"TimeUnit",
"unit",
")",
"{",
"return",
"config",
".",
"hasPath",
"(",
"requireNonNull",
"(",
"path",
",",
"\"A non-null path expected\"",
")",
")",
"?",
"of... | Description copied from the method {@link Config#getDuration(String, TimeUnit)}: Gets a value as a duration in a specified TimeUnit. If the value
is already a number, then it's taken as milliseconds and then converted to the requested TimeUnit; if it's a string, it's parsed understanding
units suffixes like "10m" or "5ns" as documented in <a href="https://github.com/typesafehub/config/blob/master/HOCON.md">the spec</a>.
@param path - path expression
@param unit - convert the return value to this time unit
@return the duration value at the requested path, in the given TimeUnit | [
"Description",
"copied",
"from",
"the",
"method",
"{"
] | train | https://github.com/grycap/coreutils/blob/e6db61dc50b49ea7276c0c29c7401204681a10c2/coreutils-common/src/main/java/es/upv/grycap/coreutils/common/config/OptionalConfig.java#L56-L59 |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/registry/NotificationHandlerNodeSubregistry.java | NotificationHandlerNodeSubregistry.registerEntry | void registerEntry(ListIterator<PathElement> iterator, String elementValue, ConcreteNotificationHandlerRegistration.NotificationHandlerEntry entry) {
final NotificationHandlerNodeRegistry newRegistry = new NotificationHandlerNodeRegistry(elementValue, this);
final NotificationHandlerNodeRegistry existingRegistry = childRegistriesUpdater.putIfAbsent(this, elementValue, newRegistry);
final NotificationHandlerNodeRegistry registry = existingRegistry != null ? existingRegistry : newRegistry;
registry.registerEntry(iterator, entry);
} | java | void registerEntry(ListIterator<PathElement> iterator, String elementValue, ConcreteNotificationHandlerRegistration.NotificationHandlerEntry entry) {
final NotificationHandlerNodeRegistry newRegistry = new NotificationHandlerNodeRegistry(elementValue, this);
final NotificationHandlerNodeRegistry existingRegistry = childRegistriesUpdater.putIfAbsent(this, elementValue, newRegistry);
final NotificationHandlerNodeRegistry registry = existingRegistry != null ? existingRegistry : newRegistry;
registry.registerEntry(iterator, entry);
} | [
"void",
"registerEntry",
"(",
"ListIterator",
"<",
"PathElement",
">",
"iterator",
",",
"String",
"elementValue",
",",
"ConcreteNotificationHandlerRegistration",
".",
"NotificationHandlerEntry",
"entry",
")",
"{",
"final",
"NotificationHandlerNodeRegistry",
"newRegistry",
"... | Get or create a new registry child for the given {@code elementValue} and traverse it to register the entry. | [
"Get",
"or",
"create",
"a",
"new",
"registry",
"child",
"for",
"the",
"given",
"{"
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/registry/NotificationHandlerNodeSubregistry.java#L71-L77 |
DDTH/ddth-dao | ddth-dao-core/src/main/java/com/github/ddth/dao/jdbc/GenericBoJdbcDao.java | GenericBoJdbcDao.get | protected T get(Connection conn, BoId id) {
if (id == null || id.values == null || id.values.length == 0) {
return null;
}
final String cacheKey = cacheKey(id);
T bo = getFromCache(getCacheName(), cacheKey, typeClass);
if (bo == null) {
bo = executeSelectOne(rowMapper, conn, calcSqlSelectOne(id), id.values);
putToCache(getCacheName(), cacheKey, bo);
}
return bo;
} | java | protected T get(Connection conn, BoId id) {
if (id == null || id.values == null || id.values.length == 0) {
return null;
}
final String cacheKey = cacheKey(id);
T bo = getFromCache(getCacheName(), cacheKey, typeClass);
if (bo == null) {
bo = executeSelectOne(rowMapper, conn, calcSqlSelectOne(id), id.values);
putToCache(getCacheName(), cacheKey, bo);
}
return bo;
} | [
"protected",
"T",
"get",
"(",
"Connection",
"conn",
",",
"BoId",
"id",
")",
"{",
"if",
"(",
"id",
"==",
"null",
"||",
"id",
".",
"values",
"==",
"null",
"||",
"id",
".",
"values",
".",
"length",
"==",
"0",
")",
"{",
"return",
"null",
";",
"}",
... | Fetch an existing BO from storage by id.
@param conn
@param id
@return | [
"Fetch",
"an",
"existing",
"BO",
"from",
"storage",
"by",
"id",
"."
] | train | https://github.com/DDTH/ddth-dao/blob/8d059ddf641a1629aa53851f9d1b41abf175a180/ddth-dao-core/src/main/java/com/github/ddth/dao/jdbc/GenericBoJdbcDao.java#L521-L532 |
srikalyc/Sql4D | IndexerAgent/src/main/java/com/yahoo/sql4d/indexeragent/sql/SqlFileSniffer.java | SqlFileSniffer.processSql | private DataSource processSql(String insertStmntStr) {
Program pgm = DCompiler.compileSql(insertStmntStr);
if (!(pgm instanceof InsertProgram)) {
log.error("Ignoring program {} . Only inserts are supported", insertStmntStr);
return null;
}
InsertProgram insertPgm = (InsertProgram)pgm;
DataSource ds = new DataSource();
switch(insertPgm.getStmntType()) {
case INSERT:
BasicInsertMeta stmt = (BasicInsertMeta)insertPgm.nthStmnt(0);
Interval interval = stmt.granularitySpec.interval;
// Round to nearest hour(zero out the mins, secs and millis)
long startTime = getDateTime(interval.startTime).withMinuteOfHour(0).withSecondOfMinute(0).withMillisOfSecond(0).getMillis();
ds.setName(stmt.dataSource).
setDelimiter(stmt.delimiter).
setListDelimiter(stmt.listDelimiter).
setTemplatePath(stmt.dataPath).
setStartTime(startTime).
setSpinFromTime(startTime).
setFrequency(JobFreq.valueOf(stmt.granularitySpec.gran)).
setEndTime(getDateTime(interval.endTime).getMillis()).
setStatus(JobStatus.not_done).
setTemplateSql(templatizeSql(insertStmntStr, interval));
break;
case INSERT_HADOOP:
BatchInsertMeta bStmt = (BatchInsertMeta)insertPgm.nthStmnt(0);
Interval bInterval = bStmt.granularitySpec.interval;
// Round to nearest hour(zero out the mins, secs and millis)
long startBTime = getDateTime(bInterval.startTime).withMinuteOfHour(0).withSecondOfMinute(0).withMillisOfSecond(0).getMillis();
ds.setName(bStmt.dataSource).
setDelimiter(bStmt.delimiter).
setListDelimiter(bStmt.listDelimiter).
setTemplatePath(bStmt.inputSpec.getRawPath()).
setStartTime(startBTime).
setSpinFromTime(startBTime).
setFrequency(JobFreq.valueOf(bStmt.granularitySpec.gran)).
setEndTime(getDateTime(bInterval.endTime).getMillis()).
setStatus(JobStatus.not_done).
setTemplateSql(templatizeSql(insertStmntStr, bInterval));
break;
case INSERT_REALTIME:
log.error("Realtime insert currently unsupported {}", pgm);
return null;
}
return ds;
} | java | private DataSource processSql(String insertStmntStr) {
Program pgm = DCompiler.compileSql(insertStmntStr);
if (!(pgm instanceof InsertProgram)) {
log.error("Ignoring program {} . Only inserts are supported", insertStmntStr);
return null;
}
InsertProgram insertPgm = (InsertProgram)pgm;
DataSource ds = new DataSource();
switch(insertPgm.getStmntType()) {
case INSERT:
BasicInsertMeta stmt = (BasicInsertMeta)insertPgm.nthStmnt(0);
Interval interval = stmt.granularitySpec.interval;
// Round to nearest hour(zero out the mins, secs and millis)
long startTime = getDateTime(interval.startTime).withMinuteOfHour(0).withSecondOfMinute(0).withMillisOfSecond(0).getMillis();
ds.setName(stmt.dataSource).
setDelimiter(stmt.delimiter).
setListDelimiter(stmt.listDelimiter).
setTemplatePath(stmt.dataPath).
setStartTime(startTime).
setSpinFromTime(startTime).
setFrequency(JobFreq.valueOf(stmt.granularitySpec.gran)).
setEndTime(getDateTime(interval.endTime).getMillis()).
setStatus(JobStatus.not_done).
setTemplateSql(templatizeSql(insertStmntStr, interval));
break;
case INSERT_HADOOP:
BatchInsertMeta bStmt = (BatchInsertMeta)insertPgm.nthStmnt(0);
Interval bInterval = bStmt.granularitySpec.interval;
// Round to nearest hour(zero out the mins, secs and millis)
long startBTime = getDateTime(bInterval.startTime).withMinuteOfHour(0).withSecondOfMinute(0).withMillisOfSecond(0).getMillis();
ds.setName(bStmt.dataSource).
setDelimiter(bStmt.delimiter).
setListDelimiter(bStmt.listDelimiter).
setTemplatePath(bStmt.inputSpec.getRawPath()).
setStartTime(startBTime).
setSpinFromTime(startBTime).
setFrequency(JobFreq.valueOf(bStmt.granularitySpec.gran)).
setEndTime(getDateTime(bInterval.endTime).getMillis()).
setStatus(JobStatus.not_done).
setTemplateSql(templatizeSql(insertStmntStr, bInterval));
break;
case INSERT_REALTIME:
log.error("Realtime insert currently unsupported {}", pgm);
return null;
}
return ds;
} | [
"private",
"DataSource",
"processSql",
"(",
"String",
"insertStmntStr",
")",
"{",
"Program",
"pgm",
"=",
"DCompiler",
".",
"compileSql",
"(",
"insertStmntStr",
")",
";",
"if",
"(",
"!",
"(",
"pgm",
"instanceof",
"InsertProgram",
")",
")",
"{",
"log",
".",
... | Creates DataSource for the given Sql insert statement.
@param insertStmntStr
@return | [
"Creates",
"DataSource",
"for",
"the",
"given",
"Sql",
"insert",
"statement",
"."
] | train | https://github.com/srikalyc/Sql4D/blob/2c052fe60ead5a16277c798a3440de7d4f6f24f6/IndexerAgent/src/main/java/com/yahoo/sql4d/indexeragent/sql/SqlFileSniffer.java#L95-L141 |
softindex/datakernel | core-promise/src/main/java/io/datakernel/file/AsyncFile.java | AsyncFile.createDirectories | public static Promise<Void> createDirectories(Executor executor, Path dir, FileAttribute... attrs) {
return ofBlockingRunnable(executor, () -> {
try {
Files.createDirectories(dir, attrs);
} catch (IOException e) {
throw new UncheckedException(e);
}
});
} | java | public static Promise<Void> createDirectories(Executor executor, Path dir, FileAttribute... attrs) {
return ofBlockingRunnable(executor, () -> {
try {
Files.createDirectories(dir, attrs);
} catch (IOException e) {
throw new UncheckedException(e);
}
});
} | [
"public",
"static",
"Promise",
"<",
"Void",
">",
"createDirectories",
"(",
"Executor",
"executor",
",",
"Path",
"dir",
",",
"FileAttribute",
"...",
"attrs",
")",
"{",
"return",
"ofBlockingRunnable",
"(",
"executor",
",",
"(",
")",
"->",
"{",
"try",
"{",
"F... | Creates a directory by creating all nonexistent parent directories first.
@param executor executor for running tasks in other thread
@param dir the directory to create
@param attrs an optional list of file attributes to set atomically when creating the directory | [
"Creates",
"a",
"directory",
"by",
"creating",
"all",
"nonexistent",
"parent",
"directories",
"first",
"."
] | train | https://github.com/softindex/datakernel/blob/090ca1116416c14d463d49d275cb1daaafa69c56/core-promise/src/main/java/io/datakernel/file/AsyncFile.java#L186-L194 |
netheosgithub/pcs_api | java/src/main/java/net/netheos/pcsapi/models/CMetadata.java | CMetadata.put | public void put( String key, String value )
throws IllegalArgumentException
{
if ( !key.matches( "[a-z-]*" ) ) {
throw new IllegalArgumentException( "The key must contains letters and dash" );
}
// Check value is ASCII
for ( char c : value.toCharArray() ) {
if ( c < 32 || c > 127 ) {
throw new IllegalArgumentException( "The metadata value is not ASCII encoded" );
}
}
map.put( key, value );
} | java | public void put( String key, String value )
throws IllegalArgumentException
{
if ( !key.matches( "[a-z-]*" ) ) {
throw new IllegalArgumentException( "The key must contains letters and dash" );
}
// Check value is ASCII
for ( char c : value.toCharArray() ) {
if ( c < 32 || c > 127 ) {
throw new IllegalArgumentException( "The metadata value is not ASCII encoded" );
}
}
map.put( key, value );
} | [
"public",
"void",
"put",
"(",
"String",
"key",
",",
"String",
"value",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"!",
"key",
".",
"matches",
"(",
"\"[a-z-]*\"",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"The key must co... | Add a value in metadata
@param key The unique key linked to the value (must be lower case)
@param value The metadata value (must contains only ASCII characters)
@throws IllegalArgumentException If the key or value is badly formatted | [
"Add",
"a",
"value",
"in",
"metadata"
] | train | https://github.com/netheosgithub/pcs_api/blob/20691e52e144014f99ca75cb7dedc7ba0c18586c/java/src/main/java/net/netheos/pcsapi/models/CMetadata.java#L47-L60 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDBaseOps.java | SDBaseOps.unsortedSegmentMax | public SDVariable unsortedSegmentMax(String name, SDVariable data, SDVariable segmentIds, int numSegments) {
validateNumerical("unsortedSegmentMax", "data", data);
validateInteger("unsortedSegmentMax", "segmentIds", segmentIds);
SDVariable ret = f().unsortedSegmentMax(data, segmentIds, numSegments);
return updateVariableNameAndReference(ret, name);
} | java | public SDVariable unsortedSegmentMax(String name, SDVariable data, SDVariable segmentIds, int numSegments) {
validateNumerical("unsortedSegmentMax", "data", data);
validateInteger("unsortedSegmentMax", "segmentIds", segmentIds);
SDVariable ret = f().unsortedSegmentMax(data, segmentIds, numSegments);
return updateVariableNameAndReference(ret, name);
} | [
"public",
"SDVariable",
"unsortedSegmentMax",
"(",
"String",
"name",
",",
"SDVariable",
"data",
",",
"SDVariable",
"segmentIds",
",",
"int",
"numSegments",
")",
"{",
"validateNumerical",
"(",
"\"unsortedSegmentMax\"",
",",
"\"data\"",
",",
"data",
")",
";",
"valid... | Unsorted segment max operation. As per {@link #segmentMax(String, SDVariable, SDVariable)} but without
the requirement for the indices to be sorted.<br>
If data = [1, 3, 2, 6, 4, 9, 8]<br>
segmentIds = [1, 0, 2, 0, 1, 1, 2]<br>
then output = [6, 9, 8] = [max(3,6), max(1,4,9), max(2,8)]<br>
@param name Name of the output variable
@param data Data (variable) to perform unsorted segment max on
@param segmentIds Variable for the segment IDs
@param numSegments Number of segments
@return Unsorted segment max output | [
"Unsorted",
"segment",
"max",
"operation",
".",
"As",
"per",
"{",
"@link",
"#segmentMax",
"(",
"String",
"SDVariable",
"SDVariable",
")",
"}",
"but",
"without",
"the",
"requirement",
"for",
"the",
"indices",
"to",
"be",
"sorted",
".",
"<br",
">",
"If",
"da... | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDBaseOps.java#L2856-L2861 |
joniles/mpxj | src/main/java/net/sf/mpxj/mpx/LocaleData.java | LocaleData.getObject | public static final Object getObject(Locale locale, String key)
{
ResourceBundle bundle = ResourceBundle.getBundle(LocaleData.class.getName(), locale);
return (bundle.getObject(key));
} | java | public static final Object getObject(Locale locale, String key)
{
ResourceBundle bundle = ResourceBundle.getBundle(LocaleData.class.getName(), locale);
return (bundle.getObject(key));
} | [
"public",
"static",
"final",
"Object",
"getObject",
"(",
"Locale",
"locale",
",",
"String",
"key",
")",
"{",
"ResourceBundle",
"bundle",
"=",
"ResourceBundle",
".",
"getBundle",
"(",
"LocaleData",
".",
"class",
".",
"getName",
"(",
")",
",",
"locale",
")",
... | Convenience method for retrieving an Object resource.
@param locale locale identifier
@param key resource key
@return resource value | [
"Convenience",
"method",
"for",
"retrieving",
"an",
"Object",
"resource",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/LocaleData.java#L99-L103 |
google/j2objc | jre_emul/apache_harmony/classlib/modules/beans/src/main/java/java/beans/Introspector.java | Introspector.getBeanInfo | public static BeanInfo getBeanInfo(Class<?> beanClass, Class<?> stopClass)
throws IntrospectionException {
if(stopClass == null){
//try to use cache
return getBeanInfo(beanClass);
}
return getBeanInfoImplAndInit(beanClass, stopClass, USE_ALL_BEANINFO);
} | java | public static BeanInfo getBeanInfo(Class<?> beanClass, Class<?> stopClass)
throws IntrospectionException {
if(stopClass == null){
//try to use cache
return getBeanInfo(beanClass);
}
return getBeanInfoImplAndInit(beanClass, stopClass, USE_ALL_BEANINFO);
} | [
"public",
"static",
"BeanInfo",
"getBeanInfo",
"(",
"Class",
"<",
"?",
">",
"beanClass",
",",
"Class",
"<",
"?",
">",
"stopClass",
")",
"throws",
"IntrospectionException",
"{",
"if",
"(",
"stopClass",
"==",
"null",
")",
"{",
"//try to use cache",
"return",
"... | Gets the <code>BeanInfo</code> object which contains the information of
the properties, events and methods of the specified bean class. It will
not introspect the "stopclass" and its super class.
<p>
The <code>Introspector</code> will cache the <code>BeanInfo</code>
object. Subsequent calls to this method will be answered with the cached
data.
</p>
@param beanClass
the specified beanClass.
@param stopClass
the sopt class which should be super class of the bean class.
May be null.
@return the <code>BeanInfo</code> of the bean class.
@throws IntrospectionException | [
"Gets",
"the",
"<code",
">",
"BeanInfo<",
"/",
"code",
">",
"object",
"which",
"contains",
"the",
"information",
"of",
"the",
"properties",
"events",
"and",
"methods",
"of",
"the",
"specified",
"bean",
"class",
".",
"It",
"will",
"not",
"introspect",
"the",
... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/apache_harmony/classlib/modules/beans/src/main/java/java/beans/Introspector.java#L187-L194 |
GeoLatte/geolatte-common | src/main/java/org/geolatte/common/dataformats/json/jackson/PointSerializer.java | PointSerializer.writeShapeSpecificSerialization | @Override
public void writeShapeSpecificSerialization(Point value, JsonGenerator jgen, SerializerProvider provider)
throws IOException {
jgen.writeFieldName("type");
jgen.writeString("Point");
jgen.writeArrayFieldStart("coordinates");
// set beanproperty to null since we are not serializing a real property
JsonSerializer<Object> ser = provider.findValueSerializer(Float.class, null);
ser.serialize((float)value.getX(), jgen, provider);
ser.serialize((float)value.getY(), jgen, provider);
jgen.writeEndArray();
} | java | @Override
public void writeShapeSpecificSerialization(Point value, JsonGenerator jgen, SerializerProvider provider)
throws IOException {
jgen.writeFieldName("type");
jgen.writeString("Point");
jgen.writeArrayFieldStart("coordinates");
// set beanproperty to null since we are not serializing a real property
JsonSerializer<Object> ser = provider.findValueSerializer(Float.class, null);
ser.serialize((float)value.getX(), jgen, provider);
ser.serialize((float)value.getY(), jgen, provider);
jgen.writeEndArray();
} | [
"@",
"Override",
"public",
"void",
"writeShapeSpecificSerialization",
"(",
"Point",
"value",
",",
"JsonGenerator",
"jgen",
",",
"SerializerProvider",
"provider",
")",
"throws",
"IOException",
"{",
"jgen",
".",
"writeFieldName",
"(",
"\"type\"",
")",
";",
"jgen",
"... | Method that can be called to ask implementation to serialize values of type this serializer handles.
@param value Value to serialize; can not be null.
@param jgen Generator used to output resulting Json content
@param provider Provider that can be used to get serializers for serializing Objects value contains, if any.
@throws java.io.IOException If serialization failed. | [
"Method",
"that",
"can",
"be",
"called",
"to",
"ask",
"implementation",
"to",
"serialize",
"values",
"of",
"type",
"this",
"serializer",
"handles",
"."
] | train | https://github.com/GeoLatte/geolatte-common/blob/dc7f92b04d8c6cb706e78cb95e746d8f12089d95/src/main/java/org/geolatte/common/dataformats/json/jackson/PointSerializer.java#L57-L68 |
integration-technology/amazon-mws-orders | src/main/java/com/amazonservices/mws/client/MwsConnection.java | MwsConnection.includeRequestHeader | public void includeRequestHeader(String name, String value) {
checkUpdatable();
this.headers.put(name, value);
} | java | public void includeRequestHeader(String name, String value) {
checkUpdatable();
this.headers.put(name, value);
} | [
"public",
"void",
"includeRequestHeader",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"checkUpdatable",
"(",
")",
";",
"this",
".",
"headers",
".",
"put",
"(",
"name",
",",
"value",
")",
";",
"}"
] | Sets the value of a request header to be included on every request
@param name the name of the header to set
@param value value to send with header | [
"Sets",
"the",
"value",
"of",
"a",
"request",
"header",
"to",
"be",
"included",
"on",
"every",
"request"
] | train | https://github.com/integration-technology/amazon-mws-orders/blob/042e8cd5b10588a30150222bf9c91faf4f130b3c/src/main/java/com/amazonservices/mws/client/MwsConnection.java#L973-L976 |
RobotiumTech/robotium | robotium-solo/src/main/java/com/robotium/solo/Waiter.java | Waiter.waitForText | public TextView waitForText(String text, int expectedMinimumNumberOfMatches, long timeout, boolean scroll) {
return waitForText(TextView.class, text, expectedMinimumNumberOfMatches, timeout, scroll, false, true);
} | java | public TextView waitForText(String text, int expectedMinimumNumberOfMatches, long timeout, boolean scroll) {
return waitForText(TextView.class, text, expectedMinimumNumberOfMatches, timeout, scroll, false, true);
} | [
"public",
"TextView",
"waitForText",
"(",
"String",
"text",
",",
"int",
"expectedMinimumNumberOfMatches",
",",
"long",
"timeout",
",",
"boolean",
"scroll",
")",
"{",
"return",
"waitForText",
"(",
"TextView",
".",
"class",
",",
"text",
",",
"expectedMinimumNumberOf... | Waits for a text to be shown.
@param text the text that needs to be shown, specified as a regular expression
@param expectedMinimumNumberOfMatches the minimum number of matches of text that must be shown. {@code 0} means any number of matches
@param timeout the amount of time in milliseconds to wait
@param scroll {@code true} if scrolling should be performed
@return {@code true} if text is found and {@code false} if it is not found before the timeout | [
"Waits",
"for",
"a",
"text",
"to",
"be",
"shown",
"."
] | train | https://github.com/RobotiumTech/robotium/blob/75e567c38f26a6a87dc8bef90b3886a20e28d291/robotium-solo/src/main/java/com/robotium/solo/Waiter.java#L567-L569 |
opsmatters/opsmatters-core | src/main/java/com/opsmatters/core/documents/FileColumn.java | FileColumn.parseDateTime | private long parseDateTime(String str, String format)
{
return FormatUtilities.getDateTime(str, format, false, true);
} | java | private long parseDateTime(String str, String format)
{
return FormatUtilities.getDateTime(str, format, false, true);
} | [
"private",
"long",
"parseDateTime",
"(",
"String",
"str",
",",
"String",
"format",
")",
"{",
"return",
"FormatUtilities",
".",
"getDateTime",
"(",
"str",
",",
"format",
",",
"false",
",",
"true",
")",
";",
"}"
] | Parses the given date string in the given format to a milliseconds vale.
@param str The formatted date to be parsed
@param format The format to use when parsing the date
@return The date in milliseconds | [
"Parses",
"the",
"given",
"date",
"string",
"in",
"the",
"given",
"format",
"to",
"a",
"milliseconds",
"vale",
"."
] | train | https://github.com/opsmatters/opsmatters-core/blob/c48904f7e8d029fd45357811ec38a735e261e3fd/src/main/java/com/opsmatters/core/documents/FileColumn.java#L690-L693 |
google/error-prone | core/src/main/java/com/google/errorprone/bugpatterns/MustBeClosedChecker.java | MustBeClosedChecker.matchMethodInvocation | @Override
public Description matchMethodInvocation(MethodInvocationTree tree, VisitorState state) {
if (!HAS_MUST_BE_CLOSED_ANNOTATION.matches(tree, state)) {
return NO_MATCH;
}
if (CONSTRUCTOR.matches(tree, state)) {
return NO_MATCH;
}
return matchNewClassOrMethodInvocation(tree, state);
} | java | @Override
public Description matchMethodInvocation(MethodInvocationTree tree, VisitorState state) {
if (!HAS_MUST_BE_CLOSED_ANNOTATION.matches(tree, state)) {
return NO_MATCH;
}
if (CONSTRUCTOR.matches(tree, state)) {
return NO_MATCH;
}
return matchNewClassOrMethodInvocation(tree, state);
} | [
"@",
"Override",
"public",
"Description",
"matchMethodInvocation",
"(",
"MethodInvocationTree",
"tree",
",",
"VisitorState",
"state",
")",
"{",
"if",
"(",
"!",
"HAS_MUST_BE_CLOSED_ANNOTATION",
".",
"matches",
"(",
"tree",
",",
"state",
")",
")",
"{",
"return",
"... | Check that invocations of methods annotated with {@link MustBeClosed} are called within the
resource variable initializer of a try-with-resources statement. | [
"Check",
"that",
"invocations",
"of",
"methods",
"annotated",
"with",
"{"
] | train | https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/core/src/main/java/com/google/errorprone/bugpatterns/MustBeClosedChecker.java#L108-L117 |
groupon/monsoon | impl/src/main/java/com/groupon/lex/metrics/misc/MonitorMonitor.java | MonitorMonitor.transform | @Override
public void transform(Context<MutableTimeSeriesCollectionPair> ctx) {
DateTime now = ctx.getTSData().getCurrentCollection().getTimestamp();
ctx.getTSData().getCurrentCollection().addMetrics(MONITOR_GROUP, get_metrics_(now, ctx));
ctx.getAlertManager().accept(new Alert(now, MONITOR_DOWN_ALERT, () -> "builtin rule", Optional.of(false), Duration.ZERO, "builtin rule: monitor is not running for some time", EMPTY_MAP));
} | java | @Override
public void transform(Context<MutableTimeSeriesCollectionPair> ctx) {
DateTime now = ctx.getTSData().getCurrentCollection().getTimestamp();
ctx.getTSData().getCurrentCollection().addMetrics(MONITOR_GROUP, get_metrics_(now, ctx));
ctx.getAlertManager().accept(new Alert(now, MONITOR_DOWN_ALERT, () -> "builtin rule", Optional.of(false), Duration.ZERO, "builtin rule: monitor is not running for some time", EMPTY_MAP));
} | [
"@",
"Override",
"public",
"void",
"transform",
"(",
"Context",
"<",
"MutableTimeSeriesCollectionPair",
">",
"ctx",
")",
"{",
"DateTime",
"now",
"=",
"ctx",
".",
"getTSData",
"(",
")",
".",
"getCurrentCollection",
"(",
")",
".",
"getTimestamp",
"(",
")",
";"... | Emit an alert monitor.down, which is in the OK state.
@param ctx Rule evaluation context. | [
"Emit",
"an",
"alert",
"monitor",
".",
"down",
"which",
"is",
"in",
"the",
"OK",
"state",
"."
] | train | https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/impl/src/main/java/com/groupon/lex/metrics/misc/MonitorMonitor.java#L136-L143 |
ujmp/universal-java-matrix-package | ujmp-core/src/main/java/org/ujmp/core/io/ImportMatrixM.java | ImportMatrixM.fromString | public static Matrix fromString(String string, Object... parameters) {
string = string.replaceAll(StringUtil.BRACKETS, "");
String[] rows = string.split(StringUtil.SEMICOLONORNEWLINE);
String[] cols = rows[0].split(StringUtil.COLONORSPACES);
Object[][] values = new String[rows.length][cols.length];
for (int r = 0; r < rows.length; r++) {
cols = rows[r].split(StringUtil.COLONORSPACES);
for (int c = 0; c < cols.length; c++) {
values[r][c] = cols[c];
}
}
return Matrix.Factory.linkToArray(values);
} | java | public static Matrix fromString(String string, Object... parameters) {
string = string.replaceAll(StringUtil.BRACKETS, "");
String[] rows = string.split(StringUtil.SEMICOLONORNEWLINE);
String[] cols = rows[0].split(StringUtil.COLONORSPACES);
Object[][] values = new String[rows.length][cols.length];
for (int r = 0; r < rows.length; r++) {
cols = rows[r].split(StringUtil.COLONORSPACES);
for (int c = 0; c < cols.length; c++) {
values[r][c] = cols[c];
}
}
return Matrix.Factory.linkToArray(values);
} | [
"public",
"static",
"Matrix",
"fromString",
"(",
"String",
"string",
",",
"Object",
"...",
"parameters",
")",
"{",
"string",
"=",
"string",
".",
"replaceAll",
"(",
"StringUtil",
".",
"BRACKETS",
",",
"\"\"",
")",
";",
"String",
"[",
"]",
"rows",
"=",
"st... | Creates a DefaultDenseStringMatrix2D from a given String. The string
contains the rows of the matrix separated by semicolons or new lines. The
columns of the matrix are separated by spaces or commas. All types of
brackets are ignored.
<p>
Examples: "[1 2 3; 4 5 6]" or "(test1,test2);(test3,test4)"
@param string
the string to parse
@return a StringMatrix with the desired values | [
"Creates",
"a",
"DefaultDenseStringMatrix2D",
"from",
"a",
"given",
"String",
".",
"The",
"string",
"contains",
"the",
"rows",
"of",
"the",
"matrix",
"separated",
"by",
"semicolons",
"or",
"new",
"lines",
".",
"The",
"columns",
"of",
"the",
"matrix",
"are",
... | train | https://github.com/ujmp/universal-java-matrix-package/blob/b7e1d293adeadaf35d208ffe8884028d6c06b63b/ujmp-core/src/main/java/org/ujmp/core/io/ImportMatrixM.java#L52-L64 |
Wikidata/Wikidata-Toolkit | wdtk-rdf/src/main/java/org/wikidata/wdtk/rdf/values/TimeValueConverter.java | TimeValueConverter.writeValue | @Override
public void writeValue(TimeValue value, Resource resource)
throws RDFHandlerException {
this.rdfWriter.writeTripleValueObject(resource, RdfWriter.RDF_TYPE,
RdfWriter.WB_TIME_VALUE);
this.rdfWriter.writeTripleValueObject(resource, RdfWriter.WB_TIME,
TimeValueConverter.getTimeLiteral(value, this.rdfWriter));
this.rdfWriter.writeTripleIntegerObject(resource,
RdfWriter.WB_TIME_PRECISION, value.getPrecision());
this.rdfWriter.writeTripleIntegerObject(resource,
RdfWriter.WB_TIME_TIMEZONE,
value.getTimezoneOffset());
this.rdfWriter.writeTripleUriObject(resource,
RdfWriter.WB_TIME_CALENDAR_MODEL,
value.getPreferredCalendarModel());
} | java | @Override
public void writeValue(TimeValue value, Resource resource)
throws RDFHandlerException {
this.rdfWriter.writeTripleValueObject(resource, RdfWriter.RDF_TYPE,
RdfWriter.WB_TIME_VALUE);
this.rdfWriter.writeTripleValueObject(resource, RdfWriter.WB_TIME,
TimeValueConverter.getTimeLiteral(value, this.rdfWriter));
this.rdfWriter.writeTripleIntegerObject(resource,
RdfWriter.WB_TIME_PRECISION, value.getPrecision());
this.rdfWriter.writeTripleIntegerObject(resource,
RdfWriter.WB_TIME_TIMEZONE,
value.getTimezoneOffset());
this.rdfWriter.writeTripleUriObject(resource,
RdfWriter.WB_TIME_CALENDAR_MODEL,
value.getPreferredCalendarModel());
} | [
"@",
"Override",
"public",
"void",
"writeValue",
"(",
"TimeValue",
"value",
",",
"Resource",
"resource",
")",
"throws",
"RDFHandlerException",
"{",
"this",
".",
"rdfWriter",
".",
"writeTripleValueObject",
"(",
"resource",
",",
"RdfWriter",
".",
"RDF_TYPE",
",",
... | Write the auxiliary RDF data for encoding the given value.
@param value
the value to write
@param resource
the (subject) URI to use to represent this value in RDF
@throws RDFHandlerException | [
"Write",
"the",
"auxiliary",
"RDF",
"data",
"for",
"encoding",
"the",
"given",
"value",
"."
] | train | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-rdf/src/main/java/org/wikidata/wdtk/rdf/values/TimeValueConverter.java#L78-L95 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java | TrainingsImpl.deleteImageRegions | public void deleteImageRegions(UUID projectId, List<String> regionIds) {
deleteImageRegionsWithServiceResponseAsync(projectId, regionIds).toBlocking().single().body();
} | java | public void deleteImageRegions(UUID projectId, List<String> regionIds) {
deleteImageRegionsWithServiceResponseAsync(projectId, regionIds).toBlocking().single().body();
} | [
"public",
"void",
"deleteImageRegions",
"(",
"UUID",
"projectId",
",",
"List",
"<",
"String",
">",
"regionIds",
")",
"{",
"deleteImageRegionsWithServiceResponseAsync",
"(",
"projectId",
",",
"regionIds",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",... | Delete a set of image regions.
@param projectId The project id
@param regionIds Regions to delete. Limited to 64
@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 | [
"Delete",
"a",
"set",
"of",
"image",
"regions",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java#L3257-L3259 |
dain/leveldb | leveldb/src/main/java/org/iq80/leveldb/util/Slice.java | Slice.setBytes | public void setBytes(int index, Slice src, int srcIndex, int length)
{
setBytes(index, src.data, src.offset + srcIndex, length);
} | java | public void setBytes(int index, Slice src, int srcIndex, int length)
{
setBytes(index, src.data, src.offset + srcIndex, length);
} | [
"public",
"void",
"setBytes",
"(",
"int",
"index",
",",
"Slice",
"src",
",",
"int",
"srcIndex",
",",
"int",
"length",
")",
"{",
"setBytes",
"(",
"index",
",",
"src",
".",
"data",
",",
"src",
".",
"offset",
"+",
"srcIndex",
",",
"length",
")",
";",
... | Transfers the specified source buffer's data to this buffer starting at
the specified absolute {@code index}.
@param srcIndex the first index of the source
@param length the number of bytes to transfer
@throws IndexOutOfBoundsException if the specified {@code index} is less than {@code 0},
if the specified {@code srcIndex} is less than {@code 0},
if {@code index + length} is greater than
{@code this.capacity}, or
if {@code srcIndex + length} is greater than
{@code src.capacity} | [
"Transfers",
"the",
"specified",
"source",
"buffer",
"s",
"data",
"to",
"this",
"buffer",
"starting",
"at",
"the",
"specified",
"absolute",
"{",
"@code",
"index",
"}",
"."
] | train | https://github.com/dain/leveldb/blob/7994065b48eada2ef29e7fefd172c2ad1e0110eb/leveldb/src/main/java/org/iq80/leveldb/util/Slice.java#L367-L370 |
msteiger/jxmapviewer2 | jxmapviewer2/src/main/java/org/jxmapviewer/util/GraphicsUtilities.java | GraphicsUtilities.mergeClip | @Deprecated
public static Shape mergeClip(Graphics g, Shape clip) {
return ShapeUtils.mergeClip(g, clip);
} | java | @Deprecated
public static Shape mergeClip(Graphics g, Shape clip) {
return ShapeUtils.mergeClip(g, clip);
} | [
"@",
"Deprecated",
"public",
"static",
"Shape",
"mergeClip",
"(",
"Graphics",
"g",
",",
"Shape",
"clip",
")",
"{",
"return",
"ShapeUtils",
".",
"mergeClip",
"(",
"g",
",",
"clip",
")",
";",
"}"
] | Sets the clip on a graphics object by merging a supplied clip with the existing one. The new
clip will be an intersection of the old clip and the supplied clip. The old clip shape will
be returned. This is useful for resetting the old clip after an operation is performed.
@param g
the graphics object to update
@param clip
a new clipping region to add to the graphics clip.
@return the current clipping region of the supplied graphics object. This may return {@code
null} if the current clip is {@code null}.
@throws NullPointerException
if any parameter is {@code null}
@deprecated Use {@link ShapeUtils#mergeClip(Graphics,Shape)} instead | [
"Sets",
"the",
"clip",
"on",
"a",
"graphics",
"object",
"by",
"merging",
"a",
"supplied",
"clip",
"with",
"the",
"existing",
"one",
".",
"The",
"new",
"clip",
"will",
"be",
"an",
"intersection",
"of",
"the",
"old",
"clip",
"and",
"the",
"supplied",
"clip... | train | https://github.com/msteiger/jxmapviewer2/blob/82639273b0aac983b6026fb90aa925c0cf596410/jxmapviewer2/src/main/java/org/jxmapviewer/util/GraphicsUtilities.java#L788-L791 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/secstruc/SecStrucCalc.java | SecStrucCalc.isBonded | private boolean isBonded(int i, int j) {
SecStrucState one = getSecStrucState(i);
SecStrucState two = getSecStrucState(j);
double don1e = one.getDonor1().getEnergy();
double don2e = one.getDonor2().getEnergy();
double acc1e = two.getAccept1().getEnergy();
double acc2e = two.getAccept2().getEnergy();
int don1p = one.getDonor1().getPartner();
int don2p = one.getDonor2().getPartner();
int acc1p = two.getAccept1().getPartner();
int acc2p = two.getAccept2().getPartner();
//Either donor from i is j, or accept from j is i
boolean hbond = (don1p == j && don1e < HBONDHIGHENERGY) ||
(don2p == j && don2e < HBONDHIGHENERGY) ||
(acc1p == i && acc1e < HBONDHIGHENERGY) ||
(acc2p == i && acc2e < HBONDHIGHENERGY);
if (hbond){
logger.debug("*** H-bond from CO of {} to NH of {}", i, j);
return true;
}
return false ;
} | java | private boolean isBonded(int i, int j) {
SecStrucState one = getSecStrucState(i);
SecStrucState two = getSecStrucState(j);
double don1e = one.getDonor1().getEnergy();
double don2e = one.getDonor2().getEnergy();
double acc1e = two.getAccept1().getEnergy();
double acc2e = two.getAccept2().getEnergy();
int don1p = one.getDonor1().getPartner();
int don2p = one.getDonor2().getPartner();
int acc1p = two.getAccept1().getPartner();
int acc2p = two.getAccept2().getPartner();
//Either donor from i is j, or accept from j is i
boolean hbond = (don1p == j && don1e < HBONDHIGHENERGY) ||
(don2p == j && don2e < HBONDHIGHENERGY) ||
(acc1p == i && acc1e < HBONDHIGHENERGY) ||
(acc2p == i && acc2e < HBONDHIGHENERGY);
if (hbond){
logger.debug("*** H-bond from CO of {} to NH of {}", i, j);
return true;
}
return false ;
} | [
"private",
"boolean",
"isBonded",
"(",
"int",
"i",
",",
"int",
"j",
")",
"{",
"SecStrucState",
"one",
"=",
"getSecStrucState",
"(",
"i",
")",
";",
"SecStrucState",
"two",
"=",
"getSecStrucState",
"(",
"j",
")",
";",
"double",
"don1e",
"=",
"one",
".",
... | Test if two groups are forming an H-Bond. The bond tested is
from the CO of group i to the NH of group j. Acceptor (i) and
donor (j). The donor of i has to be j, and the acceptor of j
has to be i.
DSSP defines H-Bonds if the energy < -500 cal/mol.
@param i group one
@param j group two
@return flag if the two are forming an Hbond | [
"Test",
"if",
"two",
"groups",
"are",
"forming",
"an",
"H",
"-",
"Bond",
".",
"The",
"bond",
"tested",
"is",
"from",
"the",
"CO",
"of",
"group",
"i",
"to",
"the",
"NH",
"of",
"group",
"j",
".",
"Acceptor",
"(",
"i",
")",
"and",
"donor",
"(",
"j",... | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/secstruc/SecStrucCalc.java#L974-L1000 |
joniles/mpxj | src/main/java/net/sf/mpxj/mpd/MPD9AbstractReader.java | MPD9AbstractReader.processCalendarException | private void processCalendarException(ProjectCalendar calendar, Row row)
{
Date fromDate = row.getDate("CD_FROM_DATE");
Date toDate = row.getDate("CD_TO_DATE");
boolean working = row.getInt("CD_WORKING") != 0;
ProjectCalendarException exception = calendar.addCalendarException(fromDate, toDate);
if (working)
{
exception.addRange(new DateRange(row.getDate("CD_FROM_TIME1"), row.getDate("CD_TO_TIME1")));
exception.addRange(new DateRange(row.getDate("CD_FROM_TIME2"), row.getDate("CD_TO_TIME2")));
exception.addRange(new DateRange(row.getDate("CD_FROM_TIME3"), row.getDate("CD_TO_TIME3")));
exception.addRange(new DateRange(row.getDate("CD_FROM_TIME4"), row.getDate("CD_TO_TIME4")));
exception.addRange(new DateRange(row.getDate("CD_FROM_TIME5"), row.getDate("CD_TO_TIME5")));
}
} | java | private void processCalendarException(ProjectCalendar calendar, Row row)
{
Date fromDate = row.getDate("CD_FROM_DATE");
Date toDate = row.getDate("CD_TO_DATE");
boolean working = row.getInt("CD_WORKING") != 0;
ProjectCalendarException exception = calendar.addCalendarException(fromDate, toDate);
if (working)
{
exception.addRange(new DateRange(row.getDate("CD_FROM_TIME1"), row.getDate("CD_TO_TIME1")));
exception.addRange(new DateRange(row.getDate("CD_FROM_TIME2"), row.getDate("CD_TO_TIME2")));
exception.addRange(new DateRange(row.getDate("CD_FROM_TIME3"), row.getDate("CD_TO_TIME3")));
exception.addRange(new DateRange(row.getDate("CD_FROM_TIME4"), row.getDate("CD_TO_TIME4")));
exception.addRange(new DateRange(row.getDate("CD_FROM_TIME5"), row.getDate("CD_TO_TIME5")));
}
} | [
"private",
"void",
"processCalendarException",
"(",
"ProjectCalendar",
"calendar",
",",
"Row",
"row",
")",
"{",
"Date",
"fromDate",
"=",
"row",
".",
"getDate",
"(",
"\"CD_FROM_DATE\"",
")",
";",
"Date",
"toDate",
"=",
"row",
".",
"getDate",
"(",
"\"CD_TO_DATE\... | Process a calendar exception.
@param calendar parent calendar
@param row calendar exception data | [
"Process",
"a",
"calendar",
"exception",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpd/MPD9AbstractReader.java#L291-L305 |
actframework/actframework | src/main/java/act/util/LogSupport.java | LogSupport.printCenter | protected void printCenter(String format, Object... args) {
String text = S.fmt(format, args);
info(S.center(text, 80));
} | java | protected void printCenter(String format, Object... args) {
String text = S.fmt(format, args);
info(S.center(text, 80));
} | [
"protected",
"void",
"printCenter",
"(",
"String",
"format",
",",
"Object",
"...",
"args",
")",
"{",
"String",
"text",
"=",
"S",
".",
"fmt",
"(",
"format",
",",
"args",
")",
";",
"info",
"(",
"S",
".",
"center",
"(",
"text",
",",
"80",
")",
")",
... | Print formatted string in the center of 80 chars line, left and right padded.
@param format
The string format pattern
@param args
The string format arguments | [
"Print",
"formatted",
"string",
"in",
"the",
"center",
"of",
"80",
"chars",
"line",
"left",
"and",
"right",
"padded",
"."
] | train | https://github.com/actframework/actframework/blob/55a8f8b45e71159a79ec6e157c02f71700f8cd54/src/main/java/act/util/LogSupport.java#L95-L98 |
xwiki/xwiki-rendering | xwiki-rendering-wikimodel/src/main/java/org/xwiki/rendering/wikimodel/impl/WikiScannerUtil.java | WikiScannerUtil.removeSpaces | private static int removeSpaces(char[] array, int pos, StringBuffer buf)
{
buf.delete(0, buf.length());
for (; pos < array.length
&& (array[pos] == '=' || Character.isSpaceChar(array[pos])); pos++)
{
if (array[pos] == '=') {
buf.append(array[pos]);
}
}
return pos;
} | java | private static int removeSpaces(char[] array, int pos, StringBuffer buf)
{
buf.delete(0, buf.length());
for (; pos < array.length
&& (array[pos] == '=' || Character.isSpaceChar(array[pos])); pos++)
{
if (array[pos] == '=') {
buf.append(array[pos]);
}
}
return pos;
} | [
"private",
"static",
"int",
"removeSpaces",
"(",
"char",
"[",
"]",
"array",
",",
"int",
"pos",
",",
"StringBuffer",
"buf",
")",
"{",
"buf",
".",
"delete",
"(",
"0",
",",
"buf",
".",
"length",
"(",
")",
")",
";",
"for",
"(",
";",
"pos",
"<",
"arra... | Moves forward the current position in the array until the first not empty
character is found.
@param array the array of characters where the spaces are searched
@param pos the current position in the array; starting from this position
the spaces will be searched
@param buf to this buffer all not empty characters will be added
@return the new position int the array of characters | [
"Moves",
"forward",
"the",
"current",
"position",
"in",
"the",
"array",
"until",
"the",
"first",
"not",
"empty",
"character",
"is",
"found",
"."
] | train | https://github.com/xwiki/xwiki-rendering/blob/a21cdfcb64ef5b76872e3eedf78c530f26d7beb0/xwiki-rendering-wikimodel/src/main/java/org/xwiki/rendering/wikimodel/impl/WikiScannerUtil.java#L278-L289 |
UrielCh/ovh-java-sdk | ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java | ApiOvhTelephony.billingAccount_easyPabx_serviceName_hunting_PUT | public void billingAccount_easyPabx_serviceName_hunting_PUT(String billingAccount, String serviceName, OvhEasyPabxHunting body) throws IOException {
String qPath = "/telephony/{billingAccount}/easyPabx/{serviceName}/hunting";
StringBuilder sb = path(qPath, billingAccount, serviceName);
exec(qPath, "PUT", sb.toString(), body);
} | java | public void billingAccount_easyPabx_serviceName_hunting_PUT(String billingAccount, String serviceName, OvhEasyPabxHunting body) throws IOException {
String qPath = "/telephony/{billingAccount}/easyPabx/{serviceName}/hunting";
StringBuilder sb = path(qPath, billingAccount, serviceName);
exec(qPath, "PUT", sb.toString(), body);
} | [
"public",
"void",
"billingAccount_easyPabx_serviceName_hunting_PUT",
"(",
"String",
"billingAccount",
",",
"String",
"serviceName",
",",
"OvhEasyPabxHunting",
"body",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/telephony/{billingAccount}/easyPabx/{serviceName... | Alter this object properties
REST: PUT /telephony/{billingAccount}/easyPabx/{serviceName}/hunting
@param body [required] New object properties
@param billingAccount [required] The name of your billingAccount
@param serviceName [required] | [
"Alter",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L3491-L3495 |
brianwhu/xillium | core/src/main/java/org/xillium/core/ServicePlatform.java | ServicePlatform.contextInitialized | @Override
public void contextInitialized(ServletContextEvent event) {
super.contextInitialized(event);
_dict.addTypeSet(org.xillium.data.validation.StandardDataTypes.class);
_packaged = _context.getResourcePaths("/WEB-INF/lib/");
_extended = discover(System.getProperty("xillium.service.ExtensionsRoot"));
// servlet mappings must be registered before this method returns
Functor<Void, ServiceModule> functor = new Functor<Void, ServiceModule>() {
public Void invoke(ServiceModule module) {
_context.getServletRegistration("dispatcher").addMapping("/" + module.simple + "/*");
return null;
}
};
ServiceModule.scan(_context, _packaged, functor, _logger);
ServiceModule.scan(_context, _extended, functor, _logger);
try {
XmlWebApplicationContext wac = new XmlWebApplicationContext();
wac.setServletContext(_context);
wac.refresh();
wac.start();
try {
// let the life cycle control take over
PlatformControl controlling = wac.getBean(CONTROLLING, PlatformControl.class);
ManagementFactory.getPlatformMBeanServer().registerMBean(
controlling.bind(this, wac, Thread.currentThread().getContextClassLoader()),
new ObjectName(controlling.getClass().getPackage().getName(), "type", controlling.getClass().getSimpleName())
);
if (controlling.isAutomatic()) {
controlling.reload();
}
} catch (BeansException x) {
// go ahead with platform realization
realize(wac, null);
} catch (Exception x) {
_logger.warning(Throwables.getFirstMessage(x));
}
} catch (BeanDefinitionStoreException x) {
_logger.warning(Throwables.getFirstMessage(x));
}
} | java | @Override
public void contextInitialized(ServletContextEvent event) {
super.contextInitialized(event);
_dict.addTypeSet(org.xillium.data.validation.StandardDataTypes.class);
_packaged = _context.getResourcePaths("/WEB-INF/lib/");
_extended = discover(System.getProperty("xillium.service.ExtensionsRoot"));
// servlet mappings must be registered before this method returns
Functor<Void, ServiceModule> functor = new Functor<Void, ServiceModule>() {
public Void invoke(ServiceModule module) {
_context.getServletRegistration("dispatcher").addMapping("/" + module.simple + "/*");
return null;
}
};
ServiceModule.scan(_context, _packaged, functor, _logger);
ServiceModule.scan(_context, _extended, functor, _logger);
try {
XmlWebApplicationContext wac = new XmlWebApplicationContext();
wac.setServletContext(_context);
wac.refresh();
wac.start();
try {
// let the life cycle control take over
PlatformControl controlling = wac.getBean(CONTROLLING, PlatformControl.class);
ManagementFactory.getPlatformMBeanServer().registerMBean(
controlling.bind(this, wac, Thread.currentThread().getContextClassLoader()),
new ObjectName(controlling.getClass().getPackage().getName(), "type", controlling.getClass().getSimpleName())
);
if (controlling.isAutomatic()) {
controlling.reload();
}
} catch (BeansException x) {
// go ahead with platform realization
realize(wac, null);
} catch (Exception x) {
_logger.warning(Throwables.getFirstMessage(x));
}
} catch (BeanDefinitionStoreException x) {
_logger.warning(Throwables.getFirstMessage(x));
}
} | [
"@",
"Override",
"public",
"void",
"contextInitialized",
"(",
"ServletContextEvent",
"event",
")",
"{",
"super",
".",
"contextInitialized",
"(",
"event",
")",
";",
"_dict",
".",
"addTypeSet",
"(",
"org",
".",
"xillium",
".",
"data",
".",
"validation",
".",
"... | Tries to load an XML web application contenxt upon servlet context initialization. If a PlatformControl is detected
in the web application contenxt, registers it with the platform MBean server and stop. Otherwise, continues to load all
module contexts in the application. | [
"Tries",
"to",
"load",
"an",
"XML",
"web",
"application",
"contenxt",
"upon",
"servlet",
"context",
"initialization",
".",
"If",
"a",
"PlatformControl",
"is",
"detected",
"in",
"the",
"web",
"application",
"contenxt",
"registers",
"it",
"with",
"the",
"platform"... | train | https://github.com/brianwhu/xillium/blob/e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799/core/src/main/java/org/xillium/core/ServicePlatform.java#L89-L131 |
spotbugs/spotbugs | eclipsePlugin/src/de/tobject/findbugs/actions/LoadXmlAction.java | LoadXmlAction.work | private void work(final IProject project, final String fileName) {
FindBugsJob runFindBugs = new FindBugsJob("Loading XML data from " + fileName + "...", project) {
@Override
protected void runWithProgress(IProgressMonitor monitor) throws CoreException {
FindBugsWorker worker = new FindBugsWorker(project, monitor);
worker.loadXml(fileName);
}
};
runFindBugs.setRule(project);
runFindBugs.scheduleInteractive();
} | java | private void work(final IProject project, final String fileName) {
FindBugsJob runFindBugs = new FindBugsJob("Loading XML data from " + fileName + "...", project) {
@Override
protected void runWithProgress(IProgressMonitor monitor) throws CoreException {
FindBugsWorker worker = new FindBugsWorker(project, monitor);
worker.loadXml(fileName);
}
};
runFindBugs.setRule(project);
runFindBugs.scheduleInteractive();
} | [
"private",
"void",
"work",
"(",
"final",
"IProject",
"project",
",",
"final",
"String",
"fileName",
")",
"{",
"FindBugsJob",
"runFindBugs",
"=",
"new",
"FindBugsJob",
"(",
"\"Loading XML data from \"",
"+",
"fileName",
"+",
"\"...\"",
",",
"project",
")",
"{",
... | Run a FindBugs import on the given project, displaying a progress
monitor.
@param project
The resource to load XMl to. | [
"Run",
"a",
"FindBugs",
"import",
"on",
"the",
"given",
"project",
"displaying",
"a",
"progress",
"monitor",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/eclipsePlugin/src/de/tobject/findbugs/actions/LoadXmlAction.java#L115-L125 |
gocd/gocd | base/src/main/java/com/thoughtworks/go/util/DirectoryScanner.java | DirectoryScanner.isDeeper | private boolean isDeeper(String pattern, String name) {
Vector p = SelectorUtils.tokenizePath(pattern);
Vector n = SelectorUtils.tokenizePath(name);
return p.contains("**") || p.size() > n.size();
} | java | private boolean isDeeper(String pattern, String name) {
Vector p = SelectorUtils.tokenizePath(pattern);
Vector n = SelectorUtils.tokenizePath(name);
return p.contains("**") || p.size() > n.size();
} | [
"private",
"boolean",
"isDeeper",
"(",
"String",
"pattern",
",",
"String",
"name",
")",
"{",
"Vector",
"p",
"=",
"SelectorUtils",
".",
"tokenizePath",
"(",
"pattern",
")",
";",
"Vector",
"n",
"=",
"SelectorUtils",
".",
"tokenizePath",
"(",
"name",
")",
";"... | Verify that a pattern specifies files deeper
than the level of the specified file.
@param pattern the pattern to check.
@param name the name to check.
@return whether the pattern is deeper than the name.
@since Ant 1.6.3 | [
"Verify",
"that",
"a",
"pattern",
"specifies",
"files",
"deeper",
"than",
"the",
"level",
"of",
"the",
"specified",
"file",
"."
] | train | https://github.com/gocd/gocd/blob/59a8480e23d6c06de39127635108dff57603cb71/base/src/main/java/com/thoughtworks/go/util/DirectoryScanner.java#L1219-L1223 |
UrielCh/ovh-java-sdk | ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java | ApiOvhCloud.project_serviceName_stack_GET | public ArrayList<OvhStack> project_serviceName_stack_GET(String serviceName) throws IOException {
String qPath = "/cloud/project/{serviceName}/stack";
StringBuilder sb = path(qPath, serviceName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t15);
} | java | public ArrayList<OvhStack> project_serviceName_stack_GET(String serviceName) throws IOException {
String qPath = "/cloud/project/{serviceName}/stack";
StringBuilder sb = path(qPath, serviceName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t15);
} | [
"public",
"ArrayList",
"<",
"OvhStack",
">",
"project_serviceName_stack_GET",
"(",
"String",
"serviceName",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/cloud/project/{serviceName}/stack\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",... | Get stacks
REST: GET /cloud/project/{serviceName}/stack
@param serviceName [required] Project id
API beta | [
"Get",
"stacks"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java#L1384-L1389 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.