repository_name
stringlengths 7
58
| func_path_in_repository
stringlengths 11
218
| func_name
stringlengths 4
140
| whole_func_string
stringlengths 153
5.32k
| language
stringclasses 1
value | func_code_string
stringlengths 72
4k
| func_code_tokens
listlengths 20
832
| func_documentation_string
stringlengths 61
2k
| func_documentation_tokens
listlengths 1
647
| split_name
stringclasses 1
value | func_code_url
stringlengths 102
339
|
---|---|---|---|---|---|---|---|---|---|---|
DDTH/ddth-dao | ddth-dao-core/src/main/java/com/github/ddth/dao/BaseBo.java | BaseBo.removeAttribute | protected BaseBo removeAttribute(String attrName, boolean triggerChange) {
"""
Remove a BO's attribute.
@param attrName
@param triggerChange
if set to {@code true} {@link #triggerChange(String)} will be
called
@return
@since 0.7.1
"""
Lock lock = lockForWrite();
try {
attributes.remove(attrName);
if (triggerChange) {
triggerChange(attrName);
}
markDirty();
return this;
} finally {
lock.unlock();
}
} | java | protected BaseBo removeAttribute(String attrName, boolean triggerChange) {
Lock lock = lockForWrite();
try {
attributes.remove(attrName);
if (triggerChange) {
triggerChange(attrName);
}
markDirty();
return this;
} finally {
lock.unlock();
}
} | [
"protected",
"BaseBo",
"removeAttribute",
"(",
"String",
"attrName",
",",
"boolean",
"triggerChange",
")",
"{",
"Lock",
"lock",
"=",
"lockForWrite",
"(",
")",
";",
"try",
"{",
"attributes",
".",
"remove",
"(",
"attrName",
")",
";",
"if",
"(",
"triggerChange",
")",
"{",
"triggerChange",
"(",
"attrName",
")",
";",
"}",
"markDirty",
"(",
")",
";",
"return",
"this",
";",
"}",
"finally",
"{",
"lock",
".",
"unlock",
"(",
")",
";",
"}",
"}"
]
| Remove a BO's attribute.
@param attrName
@param triggerChange
if set to {@code true} {@link #triggerChange(String)} will be
called
@return
@since 0.7.1 | [
"Remove",
"a",
"BO",
"s",
"attribute",
"."
]
| train | https://github.com/DDTH/ddth-dao/blob/8d059ddf641a1629aa53851f9d1b41abf175a180/ddth-dao-core/src/main/java/com/github/ddth/dao/BaseBo.java#L360-L372 |
VoltDB/voltdb | src/hsqldb19b3/org/hsqldb_voltpatches/jdbc/JDBCCallableStatement.java | JDBCCallableStatement.getBlob | public synchronized Blob getBlob(int parameterIndex) throws SQLException {
"""
<!-- start generic documentation -->
Retrieves the value of the designated JDBC <code>BLOB</code> parameter as a
{@link java.sql.Blob} object in the Java programming language.
<!-- end generic documentation -->
<!-- start release-specific documentation -->
<div class="ReleaseSpecificDocumentation">
<h3>HSQLDB-Specific Information:</h3> <p>
HSQLDB supports this feature. <p>
</div>
<!-- end release-specific documentation -->
@param parameterIndex the first parameter is 1, the second is 2,
and so on
@return the parameter value as a <code>Blob</code> object in the
Java programming language. If the value was SQL <code>NULL</code>, the value
<code>null</code> is returned.
@exception SQLException if a database access error occurs or
this method is called on a closed <code>CallableStatement</code>
@exception SQLFeatureNotSupportedException if the JDBC driver does not support
this method
@since JDK 1.2 (JDK 1.1.x developers: read the overview for
JDBCParameterMetaData)
"""
Object o = getObject(parameterIndex);
if (o == null) {
return null;
}
if (o instanceof BlobDataID) {
return new JDBCBlobClient(session, (BlobDataID) o);
}
throw Util.sqlException(ErrorCode.X_42561);
} | java | public synchronized Blob getBlob(int parameterIndex) throws SQLException {
Object o = getObject(parameterIndex);
if (o == null) {
return null;
}
if (o instanceof BlobDataID) {
return new JDBCBlobClient(session, (BlobDataID) o);
}
throw Util.sqlException(ErrorCode.X_42561);
} | [
"public",
"synchronized",
"Blob",
"getBlob",
"(",
"int",
"parameterIndex",
")",
"throws",
"SQLException",
"{",
"Object",
"o",
"=",
"getObject",
"(",
"parameterIndex",
")",
";",
"if",
"(",
"o",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"o",
"instanceof",
"BlobDataID",
")",
"{",
"return",
"new",
"JDBCBlobClient",
"(",
"session",
",",
"(",
"BlobDataID",
")",
"o",
")",
";",
"}",
"throw",
"Util",
".",
"sqlException",
"(",
"ErrorCode",
".",
"X_42561",
")",
";",
"}"
]
| <!-- start generic documentation -->
Retrieves the value of the designated JDBC <code>BLOB</code> parameter as a
{@link java.sql.Blob} object in the Java programming language.
<!-- end generic documentation -->
<!-- start release-specific documentation -->
<div class="ReleaseSpecificDocumentation">
<h3>HSQLDB-Specific Information:</h3> <p>
HSQLDB supports this feature. <p>
</div>
<!-- end release-specific documentation -->
@param parameterIndex the first parameter is 1, the second is 2,
and so on
@return the parameter value as a <code>Blob</code> object in the
Java programming language. If the value was SQL <code>NULL</code>, the value
<code>null</code> is returned.
@exception SQLException if a database access error occurs or
this method is called on a closed <code>CallableStatement</code>
@exception SQLFeatureNotSupportedException if the JDBC driver does not support
this method
@since JDK 1.2 (JDK 1.1.x developers: read the overview for
JDBCParameterMetaData) | [
"<!",
"--",
"start",
"generic",
"documentation",
"--",
">"
]
| train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/jdbc/JDBCCallableStatement.java#L1125-L1138 |
google/j2objc | jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/helpers/ParserAdapter.java | ParserAdapter.makeException | private SAXParseException makeException (String message) {
"""
Construct an exception for the current context.
@param message The error message.
"""
if (locator != null) {
return new SAXParseException(message, locator);
} else {
return new SAXParseException(message, null, null, -1, -1);
}
} | java | private SAXParseException makeException (String message)
{
if (locator != null) {
return new SAXParseException(message, locator);
} else {
return new SAXParseException(message, null, null, -1, -1);
}
} | [
"private",
"SAXParseException",
"makeException",
"(",
"String",
"message",
")",
"{",
"if",
"(",
"locator",
"!=",
"null",
")",
"{",
"return",
"new",
"SAXParseException",
"(",
"message",
",",
"locator",
")",
";",
"}",
"else",
"{",
"return",
"new",
"SAXParseException",
"(",
"message",
",",
"null",
",",
"null",
",",
"-",
"1",
",",
"-",
"1",
")",
";",
"}",
"}"
]
| Construct an exception for the current context.
@param message The error message. | [
"Construct",
"an",
"exception",
"for",
"the",
"current",
"context",
"."
]
| train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/helpers/ParserAdapter.java#L776-L783 |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/jdbc/PgCallableStatement.java | PgCallableStatement.checkIndex | protected void checkIndex(int parameterIndex, int type, String getName) throws SQLException {
"""
Helper function for the getXXX calls to check isFunction and index == 1.
@param parameterIndex parameter index (1-based)
@param type type
@param getName getter name
@throws SQLException if given index is not valid
"""
checkIndex(parameterIndex);
if (type != this.testReturn[parameterIndex - 1]) {
throw new PSQLException(
GT.tr("Parameter of type {0} was registered, but call to get{1} (sqltype={2}) was made.",
"java.sql.Types=" + testReturn[parameterIndex - 1], getName,
"java.sql.Types=" + type),
PSQLState.MOST_SPECIFIC_TYPE_DOES_NOT_MATCH);
}
} | java | protected void checkIndex(int parameterIndex, int type, String getName) throws SQLException {
checkIndex(parameterIndex);
if (type != this.testReturn[parameterIndex - 1]) {
throw new PSQLException(
GT.tr("Parameter of type {0} was registered, but call to get{1} (sqltype={2}) was made.",
"java.sql.Types=" + testReturn[parameterIndex - 1], getName,
"java.sql.Types=" + type),
PSQLState.MOST_SPECIFIC_TYPE_DOES_NOT_MATCH);
}
} | [
"protected",
"void",
"checkIndex",
"(",
"int",
"parameterIndex",
",",
"int",
"type",
",",
"String",
"getName",
")",
"throws",
"SQLException",
"{",
"checkIndex",
"(",
"parameterIndex",
")",
";",
"if",
"(",
"type",
"!=",
"this",
".",
"testReturn",
"[",
"parameterIndex",
"-",
"1",
"]",
")",
"{",
"throw",
"new",
"PSQLException",
"(",
"GT",
".",
"tr",
"(",
"\"Parameter of type {0} was registered, but call to get{1} (sqltype={2}) was made.\"",
",",
"\"java.sql.Types=\"",
"+",
"testReturn",
"[",
"parameterIndex",
"-",
"1",
"]",
",",
"getName",
",",
"\"java.sql.Types=\"",
"+",
"type",
")",
",",
"PSQLState",
".",
"MOST_SPECIFIC_TYPE_DOES_NOT_MATCH",
")",
";",
"}",
"}"
]
| Helper function for the getXXX calls to check isFunction and index == 1.
@param parameterIndex parameter index (1-based)
@param type type
@param getName getter name
@throws SQLException if given index is not valid | [
"Helper",
"function",
"for",
"the",
"getXXX",
"calls",
"to",
"check",
"isFunction",
"and",
"index",
"==",
"1",
"."
]
| train | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/jdbc/PgCallableStatement.java#L382-L391 |
rapidpro/expressions | java/src/main/java/io/rapidpro/expressions/evaluator/Conversions.java | Conversions.toRepr | public static String toRepr(Object value, EvaluationContext ctx) {
"""
Converts a value back to its representation form, e.g. x -> "x"
"""
String asString = Conversions.toString(value, ctx);
if (value instanceof String || value instanceof LocalDate || value instanceof OffsetTime || value instanceof ZonedDateTime) {
asString = asString.replace("\"", "\"\""); // escape quotes by doubling
asString = "\"" + asString + "\"";
}
return asString;
} | java | public static String toRepr(Object value, EvaluationContext ctx) {
String asString = Conversions.toString(value, ctx);
if (value instanceof String || value instanceof LocalDate || value instanceof OffsetTime || value instanceof ZonedDateTime) {
asString = asString.replace("\"", "\"\""); // escape quotes by doubling
asString = "\"" + asString + "\"";
}
return asString;
} | [
"public",
"static",
"String",
"toRepr",
"(",
"Object",
"value",
",",
"EvaluationContext",
"ctx",
")",
"{",
"String",
"asString",
"=",
"Conversions",
".",
"toString",
"(",
"value",
",",
"ctx",
")",
";",
"if",
"(",
"value",
"instanceof",
"String",
"||",
"value",
"instanceof",
"LocalDate",
"||",
"value",
"instanceof",
"OffsetTime",
"||",
"value",
"instanceof",
"ZonedDateTime",
")",
"{",
"asString",
"=",
"asString",
".",
"replace",
"(",
"\"\\\"\"",
",",
"\"\\\"\\\"\"",
")",
";",
"// escape quotes by doubling",
"asString",
"=",
"\"\\\"\"",
"+",
"asString",
"+",
"\"\\\"\"",
";",
"}",
"return",
"asString",
";",
"}"
]
| Converts a value back to its representation form, e.g. x -> "x" | [
"Converts",
"a",
"value",
"back",
"to",
"its",
"representation",
"form",
"e",
".",
"g",
".",
"x",
"-",
">",
"x"
]
| train | https://github.com/rapidpro/expressions/blob/b03d91ec58fc328960bce90ecb5fa49dcf467627/java/src/main/java/io/rapidpro/expressions/evaluator/Conversions.java#L247-L256 |
bugsnag/bugsnag-java | bugsnag/src/main/java/com/bugsnag/Configuration.java | Configuration.setEndpoints | public void setEndpoints(String notify, String sessions) throws IllegalArgumentException {
"""
Set the endpoints to send data to. By default we'll send error reports to
https://notify.bugsnag.com, and sessions to https://sessions.bugsnag.com, but you can
override this if you are using Bugsnag Enterprise to point to your own Bugsnag endpoint.
Please note that it is recommended that you set both endpoints. If the notify endpoint is
missing, an exception will be thrown. If the session endpoint is missing, a warning will be
logged and sessions will not be sent automatically.
Note that if you are setting a custom {@link Delivery}, this method should be called after
the custom implementation has been set.
@param notify the notify endpoint
@param sessions the sessions endpoint
@throws IllegalArgumentException if the notify endpoint is empty or null
"""
if (notify == null || notify.isEmpty()) {
throw new IllegalArgumentException("Notify endpoint cannot be empty or null.");
} else {
if (delivery instanceof HttpDelivery) {
((HttpDelivery) delivery).setEndpoint(notify);
} else {
LOGGER.warn("Delivery is not instance of HttpDelivery, cannot set notify endpoint");
}
}
boolean invalidSessionsEndpoint = sessions == null || sessions.isEmpty();
String sessionEndpoint = null;
if (invalidSessionsEndpoint && this.autoCaptureSessions.get()) {
LOGGER.warn("The session tracking endpoint has not been"
+ " set. Session tracking is disabled");
this.autoCaptureSessions.set(false);
} else {
sessionEndpoint = sessions;
}
if (sessionDelivery instanceof HttpDelivery) {
// sessionEndpoint may be invalid (e.g. typo in the protocol) here, which
// should result in the default
// HttpDelivery throwing a MalformedUrlException which prevents delivery.
((HttpDelivery) sessionDelivery).setEndpoint(sessionEndpoint);
} else {
LOGGER.warn("Delivery is not instance of HttpDelivery, cannot set sessions endpoint");
}
} | java | public void setEndpoints(String notify, String sessions) throws IllegalArgumentException {
if (notify == null || notify.isEmpty()) {
throw new IllegalArgumentException("Notify endpoint cannot be empty or null.");
} else {
if (delivery instanceof HttpDelivery) {
((HttpDelivery) delivery).setEndpoint(notify);
} else {
LOGGER.warn("Delivery is not instance of HttpDelivery, cannot set notify endpoint");
}
}
boolean invalidSessionsEndpoint = sessions == null || sessions.isEmpty();
String sessionEndpoint = null;
if (invalidSessionsEndpoint && this.autoCaptureSessions.get()) {
LOGGER.warn("The session tracking endpoint has not been"
+ " set. Session tracking is disabled");
this.autoCaptureSessions.set(false);
} else {
sessionEndpoint = sessions;
}
if (sessionDelivery instanceof HttpDelivery) {
// sessionEndpoint may be invalid (e.g. typo in the protocol) here, which
// should result in the default
// HttpDelivery throwing a MalformedUrlException which prevents delivery.
((HttpDelivery) sessionDelivery).setEndpoint(sessionEndpoint);
} else {
LOGGER.warn("Delivery is not instance of HttpDelivery, cannot set sessions endpoint");
}
} | [
"public",
"void",
"setEndpoints",
"(",
"String",
"notify",
",",
"String",
"sessions",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"notify",
"==",
"null",
"||",
"notify",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Notify endpoint cannot be empty or null.\"",
")",
";",
"}",
"else",
"{",
"if",
"(",
"delivery",
"instanceof",
"HttpDelivery",
")",
"{",
"(",
"(",
"HttpDelivery",
")",
"delivery",
")",
".",
"setEndpoint",
"(",
"notify",
")",
";",
"}",
"else",
"{",
"LOGGER",
".",
"warn",
"(",
"\"Delivery is not instance of HttpDelivery, cannot set notify endpoint\"",
")",
";",
"}",
"}",
"boolean",
"invalidSessionsEndpoint",
"=",
"sessions",
"==",
"null",
"||",
"sessions",
".",
"isEmpty",
"(",
")",
";",
"String",
"sessionEndpoint",
"=",
"null",
";",
"if",
"(",
"invalidSessionsEndpoint",
"&&",
"this",
".",
"autoCaptureSessions",
".",
"get",
"(",
")",
")",
"{",
"LOGGER",
".",
"warn",
"(",
"\"The session tracking endpoint has not been\"",
"+",
"\" set. Session tracking is disabled\"",
")",
";",
"this",
".",
"autoCaptureSessions",
".",
"set",
"(",
"false",
")",
";",
"}",
"else",
"{",
"sessionEndpoint",
"=",
"sessions",
";",
"}",
"if",
"(",
"sessionDelivery",
"instanceof",
"HttpDelivery",
")",
"{",
"// sessionEndpoint may be invalid (e.g. typo in the protocol) here, which",
"// should result in the default",
"// HttpDelivery throwing a MalformedUrlException which prevents delivery.",
"(",
"(",
"HttpDelivery",
")",
"sessionDelivery",
")",
".",
"setEndpoint",
"(",
"sessionEndpoint",
")",
";",
"}",
"else",
"{",
"LOGGER",
".",
"warn",
"(",
"\"Delivery is not instance of HttpDelivery, cannot set sessions endpoint\"",
")",
";",
"}",
"}"
]
| Set the endpoints to send data to. By default we'll send error reports to
https://notify.bugsnag.com, and sessions to https://sessions.bugsnag.com, but you can
override this if you are using Bugsnag Enterprise to point to your own Bugsnag endpoint.
Please note that it is recommended that you set both endpoints. If the notify endpoint is
missing, an exception will be thrown. If the session endpoint is missing, a warning will be
logged and sessions will not be sent automatically.
Note that if you are setting a custom {@link Delivery}, this method should be called after
the custom implementation has been set.
@param notify the notify endpoint
@param sessions the sessions endpoint
@throws IllegalArgumentException if the notify endpoint is empty or null | [
"Set",
"the",
"endpoints",
"to",
"send",
"data",
"to",
".",
"By",
"default",
"we",
"ll",
"send",
"error",
"reports",
"to",
"https",
":",
"//",
"notify",
".",
"bugsnag",
".",
"com",
"and",
"sessions",
"to",
"https",
":",
"//",
"sessions",
".",
"bugsnag",
".",
"com",
"but",
"you",
"can",
"override",
"this",
"if",
"you",
"are",
"using",
"Bugsnag",
"Enterprise",
"to",
"point",
"to",
"your",
"own",
"Bugsnag",
"endpoint",
"."
]
| train | https://github.com/bugsnag/bugsnag-java/blob/11817d63949bcf2b2b6b765a1d37305cdec356f2/bugsnag/src/main/java/com/bugsnag/Configuration.java#L132-L162 |
xiancloud/xian | xian-zookeeper/xian-curator/xian-curator-recipes/src/main/java/org/apache/curator/framework/recipes/queue/DistributedQueue.java | DistributedQueue.putMulti | public boolean putMulti(MultiItem<T> items, int maxWait, TimeUnit unit) throws Exception {
"""
Same as {@link #putMulti(MultiItem)} but allows a maximum wait time if an upper bound was set
via {@link QueueBuilder#maxItems}.
@param items items to add
@param maxWait maximum wait
@param unit wait unit
@return true if items was added, false if timed out
@throws Exception
"""
checkState();
String path = makeItemPath();
return internalPut(null, items, path, maxWait, unit);
} | java | public boolean putMulti(MultiItem<T> items, int maxWait, TimeUnit unit) throws Exception
{
checkState();
String path = makeItemPath();
return internalPut(null, items, path, maxWait, unit);
} | [
"public",
"boolean",
"putMulti",
"(",
"MultiItem",
"<",
"T",
">",
"items",
",",
"int",
"maxWait",
",",
"TimeUnit",
"unit",
")",
"throws",
"Exception",
"{",
"checkState",
"(",
")",
";",
"String",
"path",
"=",
"makeItemPath",
"(",
")",
";",
"return",
"internalPut",
"(",
"null",
",",
"items",
",",
"path",
",",
"maxWait",
",",
"unit",
")",
";",
"}"
]
| Same as {@link #putMulti(MultiItem)} but allows a maximum wait time if an upper bound was set
via {@link QueueBuilder#maxItems}.
@param items items to add
@param maxWait maximum wait
@param unit wait unit
@return true if items was added, false if timed out
@throws Exception | [
"Same",
"as",
"{",
"@link",
"#putMulti",
"(",
"MultiItem",
")",
"}",
"but",
"allows",
"a",
"maximum",
"wait",
"time",
"if",
"an",
"upper",
"bound",
"was",
"set",
"via",
"{",
"@link",
"QueueBuilder#maxItems",
"}",
"."
]
| train | https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-zookeeper/xian-curator/xian-curator-recipes/src/main/java/org/apache/curator/framework/recipes/queue/DistributedQueue.java#L348-L354 |
prestodb/presto | presto-main/src/main/java/com/facebook/presto/util/DateTimeUtils.java | DateTimeUtils.parseTimestampLiteral | @Deprecated
public static long parseTimestampLiteral(TimeZoneKey timeZoneKey, String value) {
"""
Parse a string (optionally containing a zone) as a value of either TIMESTAMP or TIMESTAMP WITH TIME ZONE type.
If the string doesn't specify a zone, it is interpreted in {@code timeZoneKey} zone.
@return stack representation of legacy TIMESTAMP or TIMESTAMP WITH TIME ZONE type, depending on input
"""
try {
DateTime dateTime = TIMESTAMP_WITH_TIME_ZONE_FORMATTER.parseDateTime(value);
return packDateTimeWithZone(dateTime);
}
catch (RuntimeException e) {
return LEGACY_TIMESTAMP_WITHOUT_TIME_ZONE_FORMATTER.withChronology(getChronology(timeZoneKey)).parseMillis(value);
}
} | java | @Deprecated
public static long parseTimestampLiteral(TimeZoneKey timeZoneKey, String value)
{
try {
DateTime dateTime = TIMESTAMP_WITH_TIME_ZONE_FORMATTER.parseDateTime(value);
return packDateTimeWithZone(dateTime);
}
catch (RuntimeException e) {
return LEGACY_TIMESTAMP_WITHOUT_TIME_ZONE_FORMATTER.withChronology(getChronology(timeZoneKey)).parseMillis(value);
}
} | [
"@",
"Deprecated",
"public",
"static",
"long",
"parseTimestampLiteral",
"(",
"TimeZoneKey",
"timeZoneKey",
",",
"String",
"value",
")",
"{",
"try",
"{",
"DateTime",
"dateTime",
"=",
"TIMESTAMP_WITH_TIME_ZONE_FORMATTER",
".",
"parseDateTime",
"(",
"value",
")",
";",
"return",
"packDateTimeWithZone",
"(",
"dateTime",
")",
";",
"}",
"catch",
"(",
"RuntimeException",
"e",
")",
"{",
"return",
"LEGACY_TIMESTAMP_WITHOUT_TIME_ZONE_FORMATTER",
".",
"withChronology",
"(",
"getChronology",
"(",
"timeZoneKey",
")",
")",
".",
"parseMillis",
"(",
"value",
")",
";",
"}",
"}"
]
| Parse a string (optionally containing a zone) as a value of either TIMESTAMP or TIMESTAMP WITH TIME ZONE type.
If the string doesn't specify a zone, it is interpreted in {@code timeZoneKey} zone.
@return stack representation of legacy TIMESTAMP or TIMESTAMP WITH TIME ZONE type, depending on input | [
"Parse",
"a",
"string",
"(",
"optionally",
"containing",
"a",
"zone",
")",
"as",
"a",
"value",
"of",
"either",
"TIMESTAMP",
"or",
"TIMESTAMP",
"WITH",
"TIME",
"ZONE",
"type",
".",
"If",
"the",
"string",
"doesn",
"t",
"specify",
"a",
"zone",
"it",
"is",
"interpreted",
"in",
"{",
"@code",
"timeZoneKey",
"}",
"zone",
"."
]
| train | https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/util/DateTimeUtils.java#L172-L182 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateFormat.java | DateFormat.getDateInstance | static final public DateFormat getDateInstance(Calendar cal, int dateStyle, Locale locale) {
"""
Creates a {@link DateFormat} object that can be used to format dates in
the calendar system specified by <code>cal</code>.
<p>
@param cal The calendar system for which a date format is desired.
@param dateStyle The type of date format desired. This can be
{@link DateFormat#SHORT}, {@link DateFormat#MEDIUM},
etc.
@param locale The locale for which the date format is desired.
"""
return getDateTimeInstance(cal, dateStyle, -1, ULocale.forLocale(locale));
} | java | static final public DateFormat getDateInstance(Calendar cal, int dateStyle, Locale locale)
{
return getDateTimeInstance(cal, dateStyle, -1, ULocale.forLocale(locale));
} | [
"static",
"final",
"public",
"DateFormat",
"getDateInstance",
"(",
"Calendar",
"cal",
",",
"int",
"dateStyle",
",",
"Locale",
"locale",
")",
"{",
"return",
"getDateTimeInstance",
"(",
"cal",
",",
"dateStyle",
",",
"-",
"1",
",",
"ULocale",
".",
"forLocale",
"(",
"locale",
")",
")",
";",
"}"
]
| Creates a {@link DateFormat} object that can be used to format dates in
the calendar system specified by <code>cal</code>.
<p>
@param cal The calendar system for which a date format is desired.
@param dateStyle The type of date format desired. This can be
{@link DateFormat#SHORT}, {@link DateFormat#MEDIUM},
etc.
@param locale The locale for which the date format is desired. | [
"Creates",
"a",
"{",
"@link",
"DateFormat",
"}",
"object",
"that",
"can",
"be",
"used",
"to",
"format",
"dates",
"in",
"the",
"calendar",
"system",
"specified",
"by",
"<code",
">",
"cal<",
"/",
"code",
">",
".",
"<p",
">",
"@param",
"cal",
"The",
"calendar",
"system",
"for",
"which",
"a",
"date",
"format",
"is",
"desired",
"."
]
| train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateFormat.java#L1753-L1756 |
sarl/sarl | main/coreplugins/io.sarl.lang/src/io/sarl/lang/jvmmodel/SARLJvmModelInferrer.java | SARLJvmModelInferrer.setBody | protected void setBody(JvmExecutable executable, Procedure1<ITreeAppendable> expression) {
"""
Set the body of the executable.
@param executable the executable.
@param expression the body definition.
"""
this.typeBuilder.setBody(executable, expression);
} | java | protected void setBody(JvmExecutable executable, Procedure1<ITreeAppendable> expression) {
this.typeBuilder.setBody(executable, expression);
} | [
"protected",
"void",
"setBody",
"(",
"JvmExecutable",
"executable",
",",
"Procedure1",
"<",
"ITreeAppendable",
">",
"expression",
")",
"{",
"this",
".",
"typeBuilder",
".",
"setBody",
"(",
"executable",
",",
"expression",
")",
";",
"}"
]
| Set the body of the executable.
@param executable the executable.
@param expression the body definition. | [
"Set",
"the",
"body",
"of",
"the",
"executable",
"."
]
| train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/jvmmodel/SARLJvmModelInferrer.java#L510-L512 |
datastax/java-driver | core/src/main/java/com/datastax/oss/driver/api/core/session/SessionBuilder.java | SessionBuilder.withLocalDatacenter | public SelfT withLocalDatacenter(@NonNull String profileName, @NonNull String localDatacenter) {
"""
Specifies the datacenter that is considered "local" by the load balancing policy.
<p>This is a programmatic alternative to the configuration option {@code
basic.load-balancing-policy.local-datacenter}. If this method is used, it takes precedence and
overrides the configuration.
<p>Note that this setting may or may not be relevant depending on the load balancing policy
implementation in use. The driver's built-in {@code DefaultLoadBalancingPolicy} relies on it;
if you use a third-party implementation, refer to their documentation.
"""
this.localDatacenters.put(profileName, localDatacenter);
return self;
} | java | public SelfT withLocalDatacenter(@NonNull String profileName, @NonNull String localDatacenter) {
this.localDatacenters.put(profileName, localDatacenter);
return self;
} | [
"public",
"SelfT",
"withLocalDatacenter",
"(",
"@",
"NonNull",
"String",
"profileName",
",",
"@",
"NonNull",
"String",
"localDatacenter",
")",
"{",
"this",
".",
"localDatacenters",
".",
"put",
"(",
"profileName",
",",
"localDatacenter",
")",
";",
"return",
"self",
";",
"}"
]
| Specifies the datacenter that is considered "local" by the load balancing policy.
<p>This is a programmatic alternative to the configuration option {@code
basic.load-balancing-policy.local-datacenter}. If this method is used, it takes precedence and
overrides the configuration.
<p>Note that this setting may or may not be relevant depending on the load balancing policy
implementation in use. The driver's built-in {@code DefaultLoadBalancingPolicy} relies on it;
if you use a third-party implementation, refer to their documentation. | [
"Specifies",
"the",
"datacenter",
"that",
"is",
"considered",
"local",
"by",
"the",
"load",
"balancing",
"policy",
"."
]
| train | https://github.com/datastax/java-driver/blob/612a63f2525618e2020e86c9ad75ab37adba6132/core/src/main/java/com/datastax/oss/driver/api/core/session/SessionBuilder.java#L237-L240 |
op4j/op4j | src/main/java/org/op4j/functions/FnString.java | FnString.startsWith | public static final Function<String, Boolean> startsWith(final String prefix, final int offset) {
"""
<p>
It checks whether the input substring after the given offset starts
with the given prefix or not.
</p>
@param prefix the prefix to be search after the specified offset
@param offset where to begin looking for the prefix
@return
"""
return new StartsWith(prefix, offset);
} | java | public static final Function<String, Boolean> startsWith(final String prefix, final int offset) {
return new StartsWith(prefix, offset);
} | [
"public",
"static",
"final",
"Function",
"<",
"String",
",",
"Boolean",
">",
"startsWith",
"(",
"final",
"String",
"prefix",
",",
"final",
"int",
"offset",
")",
"{",
"return",
"new",
"StartsWith",
"(",
"prefix",
",",
"offset",
")",
";",
"}"
]
| <p>
It checks whether the input substring after the given offset starts
with the given prefix or not.
</p>
@param prefix the prefix to be search after the specified offset
@param offset where to begin looking for the prefix
@return | [
"<p",
">",
"It",
"checks",
"whether",
"the",
"input",
"substring",
"after",
"the",
"given",
"offset",
"starts",
"with",
"the",
"given",
"prefix",
"or",
"not",
".",
"<",
"/",
"p",
">"
]
| train | https://github.com/op4j/op4j/blob/b577596dfe462089d3dd169666defc6de7ad289a/src/main/java/org/op4j/functions/FnString.java#L4297-L4299 |
apereo/cas | core/cas-server-core-services-authentication/src/main/java/org/apereo/cas/authentication/principal/DefaultResponse.java | DefaultResponse.getPostResponse | public static Response getPostResponse(final String url, final Map<String, String> attributes) {
"""
Gets the post response.
@param url the url
@param attributes the attributes
@return the post response
"""
return new DefaultResponse(ResponseType.POST, url, attributes);
} | java | public static Response getPostResponse(final String url, final Map<String, String> attributes) {
return new DefaultResponse(ResponseType.POST, url, attributes);
} | [
"public",
"static",
"Response",
"getPostResponse",
"(",
"final",
"String",
"url",
",",
"final",
"Map",
"<",
"String",
",",
"String",
">",
"attributes",
")",
"{",
"return",
"new",
"DefaultResponse",
"(",
"ResponseType",
".",
"POST",
",",
"url",
",",
"attributes",
")",
";",
"}"
]
| Gets the post response.
@param url the url
@param attributes the attributes
@return the post response | [
"Gets",
"the",
"post",
"response",
"."
]
| train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-services-authentication/src/main/java/org/apereo/cas/authentication/principal/DefaultResponse.java#L49-L51 |
ops4j/org.ops4j.pax.logging | pax-logging-api/src/main/java/org/jboss/logging/Logger.java | Logger.warnv | public void warnv(String format, Object param1, Object param2, Object param3) {
"""
Issue a log message with a level of WARN using {@link java.text.MessageFormat}-style formatting.
@param format the message format string
@param param1 the first parameter
@param param2 the second parameter
@param param3 the third parameter
"""
if (isEnabled(Level.WARN)) {
doLog(Level.WARN, FQCN, format, new Object[] { param1, param2, param3 }, null);
}
} | java | public void warnv(String format, Object param1, Object param2, Object param3) {
if (isEnabled(Level.WARN)) {
doLog(Level.WARN, FQCN, format, new Object[] { param1, param2, param3 }, null);
}
} | [
"public",
"void",
"warnv",
"(",
"String",
"format",
",",
"Object",
"param1",
",",
"Object",
"param2",
",",
"Object",
"param3",
")",
"{",
"if",
"(",
"isEnabled",
"(",
"Level",
".",
"WARN",
")",
")",
"{",
"doLog",
"(",
"Level",
".",
"WARN",
",",
"FQCN",
",",
"format",
",",
"new",
"Object",
"[",
"]",
"{",
"param1",
",",
"param2",
",",
"param3",
"}",
",",
"null",
")",
";",
"}",
"}"
]
| Issue a log message with a level of WARN using {@link java.text.MessageFormat}-style formatting.
@param format the message format string
@param param1 the first parameter
@param param2 the second parameter
@param param3 the third parameter | [
"Issue",
"a",
"log",
"message",
"with",
"a",
"level",
"of",
"WARN",
"using",
"{",
"@link",
"java",
".",
"text",
".",
"MessageFormat",
"}",
"-",
"style",
"formatting",
"."
]
| train | https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/jboss/logging/Logger.java#L1330-L1334 |
inkstand-io/scribble | scribble-http/src/main/java/io/inkstand/scribble/http/rules/HttpServerBuilder.java | HttpServerBuilder.contentFrom | public HttpServerBuilder contentFrom(String path, TemporaryFile contentFile) {
"""
Defines a file resource that is dynamically created for the test using the {@link io.inkstand.scribble.rules
.TemporaryFile}
rule.
@param path
the root path to the content
@param contentFile
the rule that creates the temporary file that should be hosted by the http server. If the file is a zip
file, it's contents are hosted, not the file itself
@return
this builder
"""
resources.put(path, contentFile);
return this;
} | java | public HttpServerBuilder contentFrom(String path, TemporaryFile contentFile){
resources.put(path, contentFile);
return this;
} | [
"public",
"HttpServerBuilder",
"contentFrom",
"(",
"String",
"path",
",",
"TemporaryFile",
"contentFile",
")",
"{",
"resources",
".",
"put",
"(",
"path",
",",
"contentFile",
")",
";",
"return",
"this",
";",
"}"
]
| Defines a file resource that is dynamically created for the test using the {@link io.inkstand.scribble.rules
.TemporaryFile}
rule.
@param path
the root path to the content
@param contentFile
the rule that creates the temporary file that should be hosted by the http server. If the file is a zip
file, it's contents are hosted, not the file itself
@return
this builder | [
"Defines",
"a",
"file",
"resource",
"that",
"is",
"dynamically",
"created",
"for",
"the",
"test",
"using",
"the",
"{"
]
| train | https://github.com/inkstand-io/scribble/blob/66e67553bad4b1ff817e1715fd1d3dd833406744/scribble-http/src/main/java/io/inkstand/scribble/http/rules/HttpServerBuilder.java#L104-L107 |
stratosphere/stratosphere | stratosphere-runtime/src/main/java/eu/stratosphere/nephele/jobmanager/EventCollector.java | EventCollector.updateManagementGraph | private void updateManagementGraph(final JobID jobID, final VertexAssignmentEvent vertexAssignmentEvent) {
"""
Applies changes in the vertex assignment to the stored management graph.
@param jobID
the ID of the job whose management graph shall be updated
@param vertexAssignmentEvent
the event describing the changes in the vertex assignment
"""
synchronized (this.recentManagementGraphs) {
final ManagementGraph managementGraph = this.recentManagementGraphs.get(jobID);
if (managementGraph == null) {
return;
}
final ManagementVertex vertex = managementGraph.getVertexByID(vertexAssignmentEvent.getVertexID());
if (vertex == null) {
return;
}
vertex.setInstanceName(vertexAssignmentEvent.getInstanceName());
vertex.setInstanceType(vertexAssignmentEvent.getInstanceType());
}
} | java | private void updateManagementGraph(final JobID jobID, final VertexAssignmentEvent vertexAssignmentEvent) {
synchronized (this.recentManagementGraphs) {
final ManagementGraph managementGraph = this.recentManagementGraphs.get(jobID);
if (managementGraph == null) {
return;
}
final ManagementVertex vertex = managementGraph.getVertexByID(vertexAssignmentEvent.getVertexID());
if (vertex == null) {
return;
}
vertex.setInstanceName(vertexAssignmentEvent.getInstanceName());
vertex.setInstanceType(vertexAssignmentEvent.getInstanceType());
}
} | [
"private",
"void",
"updateManagementGraph",
"(",
"final",
"JobID",
"jobID",
",",
"final",
"VertexAssignmentEvent",
"vertexAssignmentEvent",
")",
"{",
"synchronized",
"(",
"this",
".",
"recentManagementGraphs",
")",
"{",
"final",
"ManagementGraph",
"managementGraph",
"=",
"this",
".",
"recentManagementGraphs",
".",
"get",
"(",
"jobID",
")",
";",
"if",
"(",
"managementGraph",
"==",
"null",
")",
"{",
"return",
";",
"}",
"final",
"ManagementVertex",
"vertex",
"=",
"managementGraph",
".",
"getVertexByID",
"(",
"vertexAssignmentEvent",
".",
"getVertexID",
"(",
")",
")",
";",
"if",
"(",
"vertex",
"==",
"null",
")",
"{",
"return",
";",
"}",
"vertex",
".",
"setInstanceName",
"(",
"vertexAssignmentEvent",
".",
"getInstanceName",
"(",
")",
")",
";",
"vertex",
".",
"setInstanceType",
"(",
"vertexAssignmentEvent",
".",
"getInstanceType",
"(",
")",
")",
";",
"}",
"}"
]
| Applies changes in the vertex assignment to the stored management graph.
@param jobID
the ID of the job whose management graph shall be updated
@param vertexAssignmentEvent
the event describing the changes in the vertex assignment | [
"Applies",
"changes",
"in",
"the",
"vertex",
"assignment",
"to",
"the",
"stored",
"management",
"graph",
"."
]
| train | https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/jobmanager/EventCollector.java#L598-L614 |
ThreeTen/threetenbp | src/main/java/org/threeten/bp/LocalDateTime.java | LocalDateTime.plus | @Override
public LocalDateTime plus(long amountToAdd, TemporalUnit unit) {
"""
Returns a copy of this date-time with the specified period added.
<p>
This method returns a new date-time based on this date-time with the specified period added.
This can be used to add any period that is defined by a unit, for example to add years, months or days.
The unit is responsible for the details of the calculation, including the resolution
of any edge cases in the calculation.
<p>
This instance is immutable and unaffected by this method call.
@param amountToAdd the amount of the unit to add to the result, may be negative
@param unit the unit of the period to add, not null
@return a {@code LocalDateTime} based on this date-time with the specified period added, not null
@throws DateTimeException if the unit cannot be added to this type
"""
if (unit instanceof ChronoUnit) {
ChronoUnit f = (ChronoUnit) unit;
switch (f) {
case NANOS: return plusNanos(amountToAdd);
case MICROS: return plusDays(amountToAdd / MICROS_PER_DAY).plusNanos((amountToAdd % MICROS_PER_DAY) * 1000);
case MILLIS: return plusDays(amountToAdd / MILLIS_PER_DAY).plusNanos((amountToAdd % MILLIS_PER_DAY) * 1000000);
case SECONDS: return plusSeconds(amountToAdd);
case MINUTES: return plusMinutes(amountToAdd);
case HOURS: return plusHours(amountToAdd);
case HALF_DAYS: return plusDays(amountToAdd / 256).plusHours((amountToAdd % 256) * 12); // no overflow (256 is multiple of 2)
}
return with(date.plus(amountToAdd, unit), time);
}
return unit.addTo(this, amountToAdd);
} | java | @Override
public LocalDateTime plus(long amountToAdd, TemporalUnit unit) {
if (unit instanceof ChronoUnit) {
ChronoUnit f = (ChronoUnit) unit;
switch (f) {
case NANOS: return plusNanos(amountToAdd);
case MICROS: return plusDays(amountToAdd / MICROS_PER_DAY).plusNanos((amountToAdd % MICROS_PER_DAY) * 1000);
case MILLIS: return plusDays(amountToAdd / MILLIS_PER_DAY).plusNanos((amountToAdd % MILLIS_PER_DAY) * 1000000);
case SECONDS: return plusSeconds(amountToAdd);
case MINUTES: return plusMinutes(amountToAdd);
case HOURS: return plusHours(amountToAdd);
case HALF_DAYS: return plusDays(amountToAdd / 256).plusHours((amountToAdd % 256) * 12); // no overflow (256 is multiple of 2)
}
return with(date.plus(amountToAdd, unit), time);
}
return unit.addTo(this, amountToAdd);
} | [
"@",
"Override",
"public",
"LocalDateTime",
"plus",
"(",
"long",
"amountToAdd",
",",
"TemporalUnit",
"unit",
")",
"{",
"if",
"(",
"unit",
"instanceof",
"ChronoUnit",
")",
"{",
"ChronoUnit",
"f",
"=",
"(",
"ChronoUnit",
")",
"unit",
";",
"switch",
"(",
"f",
")",
"{",
"case",
"NANOS",
":",
"return",
"plusNanos",
"(",
"amountToAdd",
")",
";",
"case",
"MICROS",
":",
"return",
"plusDays",
"(",
"amountToAdd",
"/",
"MICROS_PER_DAY",
")",
".",
"plusNanos",
"(",
"(",
"amountToAdd",
"%",
"MICROS_PER_DAY",
")",
"*",
"1000",
")",
";",
"case",
"MILLIS",
":",
"return",
"plusDays",
"(",
"amountToAdd",
"/",
"MILLIS_PER_DAY",
")",
".",
"plusNanos",
"(",
"(",
"amountToAdd",
"%",
"MILLIS_PER_DAY",
")",
"*",
"1000000",
")",
";",
"case",
"SECONDS",
":",
"return",
"plusSeconds",
"(",
"amountToAdd",
")",
";",
"case",
"MINUTES",
":",
"return",
"plusMinutes",
"(",
"amountToAdd",
")",
";",
"case",
"HOURS",
":",
"return",
"plusHours",
"(",
"amountToAdd",
")",
";",
"case",
"HALF_DAYS",
":",
"return",
"plusDays",
"(",
"amountToAdd",
"/",
"256",
")",
".",
"plusHours",
"(",
"(",
"amountToAdd",
"%",
"256",
")",
"*",
"12",
")",
";",
"// no overflow (256 is multiple of 2)",
"}",
"return",
"with",
"(",
"date",
".",
"plus",
"(",
"amountToAdd",
",",
"unit",
")",
",",
"time",
")",
";",
"}",
"return",
"unit",
".",
"addTo",
"(",
"this",
",",
"amountToAdd",
")",
";",
"}"
]
| Returns a copy of this date-time with the specified period added.
<p>
This method returns a new date-time based on this date-time with the specified period added.
This can be used to add any period that is defined by a unit, for example to add years, months or days.
The unit is responsible for the details of the calculation, including the resolution
of any edge cases in the calculation.
<p>
This instance is immutable and unaffected by this method call.
@param amountToAdd the amount of the unit to add to the result, may be negative
@param unit the unit of the period to add, not null
@return a {@code LocalDateTime} based on this date-time with the specified period added, not null
@throws DateTimeException if the unit cannot be added to this type | [
"Returns",
"a",
"copy",
"of",
"this",
"date",
"-",
"time",
"with",
"the",
"specified",
"period",
"added",
".",
"<p",
">",
"This",
"method",
"returns",
"a",
"new",
"date",
"-",
"time",
"based",
"on",
"this",
"date",
"-",
"time",
"with",
"the",
"specified",
"period",
"added",
".",
"This",
"can",
"be",
"used",
"to",
"add",
"any",
"period",
"that",
"is",
"defined",
"by",
"a",
"unit",
"for",
"example",
"to",
"add",
"years",
"months",
"or",
"days",
".",
"The",
"unit",
"is",
"responsible",
"for",
"the",
"details",
"of",
"the",
"calculation",
"including",
"the",
"resolution",
"of",
"any",
"edge",
"cases",
"in",
"the",
"calculation",
".",
"<p",
">",
"This",
"instance",
"is",
"immutable",
"and",
"unaffected",
"by",
"this",
"method",
"call",
"."
]
| train | https://github.com/ThreeTen/threetenbp/blob/5f05b649f89f205aabd96b2f83c36796ec616fe6/src/main/java/org/threeten/bp/LocalDateTime.java#L1034-L1050 |
azkaban/azkaban | azkaban-web-server/src/main/java/azkaban/webapp/servlet/AbstractAzkabanServlet.java | AbstractAzkabanServlet.getIntParam | public int getIntParam(final HttpServletRequest request, final String name)
throws ServletException {
"""
Returns the param and parses it into an int. Will throw an exception if not found, or a parse
error if the type is incorrect.
"""
return HttpRequestUtils.getIntParam(request, name);
} | java | public int getIntParam(final HttpServletRequest request, final String name)
throws ServletException {
return HttpRequestUtils.getIntParam(request, name);
} | [
"public",
"int",
"getIntParam",
"(",
"final",
"HttpServletRequest",
"request",
",",
"final",
"String",
"name",
")",
"throws",
"ServletException",
"{",
"return",
"HttpRequestUtils",
".",
"getIntParam",
"(",
"request",
",",
"name",
")",
";",
"}"
]
| Returns the param and parses it into an int. Will throw an exception if not found, or a parse
error if the type is incorrect. | [
"Returns",
"the",
"param",
"and",
"parses",
"it",
"into",
"an",
"int",
".",
"Will",
"throw",
"an",
"exception",
"if",
"not",
"found",
"or",
"a",
"parse",
"error",
"if",
"the",
"type",
"is",
"incorrect",
"."
]
| train | https://github.com/azkaban/azkaban/blob/d258ea7d6e66807c6eff79c5325d6d3443618dff/azkaban-web-server/src/main/java/azkaban/webapp/servlet/AbstractAzkabanServlet.java#L147-L150 |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/streamstatus/StatusWatermarkValve.java | StatusWatermarkValve.inputWatermark | public void inputWatermark(Watermark watermark, int channelIndex) {
"""
Feed a {@link Watermark} into the valve. If the input triggers the valve to output a new Watermark,
{@link ValveOutputHandler#handleWatermark(Watermark)} will be called to process the new Watermark.
@param watermark the watermark to feed to the valve
@param channelIndex the index of the channel that the fed watermark belongs to (index starting from 0)
"""
// ignore the input watermark if its input channel, or all input channels are idle (i.e. overall the valve is idle).
if (lastOutputStreamStatus.isActive() && channelStatuses[channelIndex].streamStatus.isActive()) {
long watermarkMillis = watermark.getTimestamp();
// if the input watermark's value is less than the last received watermark for its input channel, ignore it also.
if (watermarkMillis > channelStatuses[channelIndex].watermark) {
channelStatuses[channelIndex].watermark = watermarkMillis;
// previously unaligned input channels are now aligned if its watermark has caught up
if (!channelStatuses[channelIndex].isWatermarkAligned && watermarkMillis >= lastOutputWatermark) {
channelStatuses[channelIndex].isWatermarkAligned = true;
}
// now, attempt to find a new min watermark across all aligned channels
findAndOutputNewMinWatermarkAcrossAlignedChannels();
}
}
} | java | public void inputWatermark(Watermark watermark, int channelIndex) {
// ignore the input watermark if its input channel, or all input channels are idle (i.e. overall the valve is idle).
if (lastOutputStreamStatus.isActive() && channelStatuses[channelIndex].streamStatus.isActive()) {
long watermarkMillis = watermark.getTimestamp();
// if the input watermark's value is less than the last received watermark for its input channel, ignore it also.
if (watermarkMillis > channelStatuses[channelIndex].watermark) {
channelStatuses[channelIndex].watermark = watermarkMillis;
// previously unaligned input channels are now aligned if its watermark has caught up
if (!channelStatuses[channelIndex].isWatermarkAligned && watermarkMillis >= lastOutputWatermark) {
channelStatuses[channelIndex].isWatermarkAligned = true;
}
// now, attempt to find a new min watermark across all aligned channels
findAndOutputNewMinWatermarkAcrossAlignedChannels();
}
}
} | [
"public",
"void",
"inputWatermark",
"(",
"Watermark",
"watermark",
",",
"int",
"channelIndex",
")",
"{",
"// ignore the input watermark if its input channel, or all input channels are idle (i.e. overall the valve is idle).",
"if",
"(",
"lastOutputStreamStatus",
".",
"isActive",
"(",
")",
"&&",
"channelStatuses",
"[",
"channelIndex",
"]",
".",
"streamStatus",
".",
"isActive",
"(",
")",
")",
"{",
"long",
"watermarkMillis",
"=",
"watermark",
".",
"getTimestamp",
"(",
")",
";",
"// if the input watermark's value is less than the last received watermark for its input channel, ignore it also.",
"if",
"(",
"watermarkMillis",
">",
"channelStatuses",
"[",
"channelIndex",
"]",
".",
"watermark",
")",
"{",
"channelStatuses",
"[",
"channelIndex",
"]",
".",
"watermark",
"=",
"watermarkMillis",
";",
"// previously unaligned input channels are now aligned if its watermark has caught up",
"if",
"(",
"!",
"channelStatuses",
"[",
"channelIndex",
"]",
".",
"isWatermarkAligned",
"&&",
"watermarkMillis",
">=",
"lastOutputWatermark",
")",
"{",
"channelStatuses",
"[",
"channelIndex",
"]",
".",
"isWatermarkAligned",
"=",
"true",
";",
"}",
"// now, attempt to find a new min watermark across all aligned channels",
"findAndOutputNewMinWatermarkAcrossAlignedChannels",
"(",
")",
";",
"}",
"}",
"}"
]
| Feed a {@link Watermark} into the valve. If the input triggers the valve to output a new Watermark,
{@link ValveOutputHandler#handleWatermark(Watermark)} will be called to process the new Watermark.
@param watermark the watermark to feed to the valve
@param channelIndex the index of the channel that the fed watermark belongs to (index starting from 0) | [
"Feed",
"a",
"{",
"@link",
"Watermark",
"}",
"into",
"the",
"valve",
".",
"If",
"the",
"input",
"triggers",
"the",
"valve",
"to",
"output",
"a",
"new",
"Watermark",
"{",
"@link",
"ValveOutputHandler#handleWatermark",
"(",
"Watermark",
")",
"}",
"will",
"be",
"called",
"to",
"process",
"the",
"new",
"Watermark",
"."
]
| train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/streamstatus/StatusWatermarkValve.java#L96-L114 |
Azure/azure-sdk-for-java | network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/NetworkWatchersInner.java | NetworkWatchersInner.updateTagsAsync | public Observable<NetworkWatcherInner> updateTagsAsync(String resourceGroupName, String networkWatcherName) {
"""
Updates a network watcher tags.
@param resourceGroupName The name of the resource group.
@param networkWatcherName The name of the network watcher.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the NetworkWatcherInner object
"""
return updateTagsWithServiceResponseAsync(resourceGroupName, networkWatcherName).map(new Func1<ServiceResponse<NetworkWatcherInner>, NetworkWatcherInner>() {
@Override
public NetworkWatcherInner call(ServiceResponse<NetworkWatcherInner> response) {
return response.body();
}
});
} | java | public Observable<NetworkWatcherInner> updateTagsAsync(String resourceGroupName, String networkWatcherName) {
return updateTagsWithServiceResponseAsync(resourceGroupName, networkWatcherName).map(new Func1<ServiceResponse<NetworkWatcherInner>, NetworkWatcherInner>() {
@Override
public NetworkWatcherInner call(ServiceResponse<NetworkWatcherInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"NetworkWatcherInner",
">",
"updateTagsAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"networkWatcherName",
")",
"{",
"return",
"updateTagsWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"networkWatcherName",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"NetworkWatcherInner",
">",
",",
"NetworkWatcherInner",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"NetworkWatcherInner",
"call",
"(",
"ServiceResponse",
"<",
"NetworkWatcherInner",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
]
| Updates a network watcher tags.
@param resourceGroupName The name of the resource group.
@param networkWatcherName The name of the network watcher.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the NetworkWatcherInner object | [
"Updates",
"a",
"network",
"watcher",
"tags",
"."
]
| train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/NetworkWatchersInner.java#L554-L561 |
elvishew/xLog | library/src/main/java/com/elvishew/xlog/Logger.java | Logger.printlnInternal | private void printlnInternal(int logLevel, String msg) {
"""
Print a log in a new line internally.
@param logLevel the log level of the printing log
@param msg the message you would like to log
"""
String tag = logConfiguration.tag;
String thread = logConfiguration.withThread
? logConfiguration.threadFormatter.format(Thread.currentThread())
: null;
String stackTrace = logConfiguration.withStackTrace
? logConfiguration.stackTraceFormatter.format(
StackTraceUtil.getCroppedRealStackTrack(new Throwable().getStackTrace(),
logConfiguration.stackTraceOrigin,
logConfiguration.stackTraceDepth))
: null;
if (logConfiguration.interceptors != null) {
LogItem log = new LogItem(logLevel, tag, thread, stackTrace, msg);
for (Interceptor interceptor : logConfiguration.interceptors) {
log = interceptor.intercept(log);
if (log == null) {
// Log is eaten, don't print this log.
return;
}
// Check if the log still healthy.
if (log.tag == null || log.msg == null) {
throw new IllegalStateException("Interceptor " + interceptor
+ " should not remove the tag or message of a log,"
+ " if you don't want to print this log,"
+ " just return a null when intercept.");
}
}
// Use fields after interception.
logLevel = log.level;
tag = log.tag;
thread = log.threadInfo;
stackTrace = log.stackTraceInfo;
msg = log.msg;
}
printer.println(logLevel, tag, logConfiguration.withBorder
? logConfiguration.borderFormatter.format(new String[]{thread, stackTrace, msg})
: ((thread != null ? (thread + SystemCompat.lineSeparator) : "")
+ (stackTrace != null ? (stackTrace + SystemCompat.lineSeparator) : "")
+ msg));
} | java | private void printlnInternal(int logLevel, String msg) {
String tag = logConfiguration.tag;
String thread = logConfiguration.withThread
? logConfiguration.threadFormatter.format(Thread.currentThread())
: null;
String stackTrace = logConfiguration.withStackTrace
? logConfiguration.stackTraceFormatter.format(
StackTraceUtil.getCroppedRealStackTrack(new Throwable().getStackTrace(),
logConfiguration.stackTraceOrigin,
logConfiguration.stackTraceDepth))
: null;
if (logConfiguration.interceptors != null) {
LogItem log = new LogItem(logLevel, tag, thread, stackTrace, msg);
for (Interceptor interceptor : logConfiguration.interceptors) {
log = interceptor.intercept(log);
if (log == null) {
// Log is eaten, don't print this log.
return;
}
// Check if the log still healthy.
if (log.tag == null || log.msg == null) {
throw new IllegalStateException("Interceptor " + interceptor
+ " should not remove the tag or message of a log,"
+ " if you don't want to print this log,"
+ " just return a null when intercept.");
}
}
// Use fields after interception.
logLevel = log.level;
tag = log.tag;
thread = log.threadInfo;
stackTrace = log.stackTraceInfo;
msg = log.msg;
}
printer.println(logLevel, tag, logConfiguration.withBorder
? logConfiguration.borderFormatter.format(new String[]{thread, stackTrace, msg})
: ((thread != null ? (thread + SystemCompat.lineSeparator) : "")
+ (stackTrace != null ? (stackTrace + SystemCompat.lineSeparator) : "")
+ msg));
} | [
"private",
"void",
"printlnInternal",
"(",
"int",
"logLevel",
",",
"String",
"msg",
")",
"{",
"String",
"tag",
"=",
"logConfiguration",
".",
"tag",
";",
"String",
"thread",
"=",
"logConfiguration",
".",
"withThread",
"?",
"logConfiguration",
".",
"threadFormatter",
".",
"format",
"(",
"Thread",
".",
"currentThread",
"(",
")",
")",
":",
"null",
";",
"String",
"stackTrace",
"=",
"logConfiguration",
".",
"withStackTrace",
"?",
"logConfiguration",
".",
"stackTraceFormatter",
".",
"format",
"(",
"StackTraceUtil",
".",
"getCroppedRealStackTrack",
"(",
"new",
"Throwable",
"(",
")",
".",
"getStackTrace",
"(",
")",
",",
"logConfiguration",
".",
"stackTraceOrigin",
",",
"logConfiguration",
".",
"stackTraceDepth",
")",
")",
":",
"null",
";",
"if",
"(",
"logConfiguration",
".",
"interceptors",
"!=",
"null",
")",
"{",
"LogItem",
"log",
"=",
"new",
"LogItem",
"(",
"logLevel",
",",
"tag",
",",
"thread",
",",
"stackTrace",
",",
"msg",
")",
";",
"for",
"(",
"Interceptor",
"interceptor",
":",
"logConfiguration",
".",
"interceptors",
")",
"{",
"log",
"=",
"interceptor",
".",
"intercept",
"(",
"log",
")",
";",
"if",
"(",
"log",
"==",
"null",
")",
"{",
"// Log is eaten, don't print this log.",
"return",
";",
"}",
"// Check if the log still healthy.",
"if",
"(",
"log",
".",
"tag",
"==",
"null",
"||",
"log",
".",
"msg",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Interceptor \"",
"+",
"interceptor",
"+",
"\" should not remove the tag or message of a log,\"",
"+",
"\" if you don't want to print this log,\"",
"+",
"\" just return a null when intercept.\"",
")",
";",
"}",
"}",
"// Use fields after interception.",
"logLevel",
"=",
"log",
".",
"level",
";",
"tag",
"=",
"log",
".",
"tag",
";",
"thread",
"=",
"log",
".",
"threadInfo",
";",
"stackTrace",
"=",
"log",
".",
"stackTraceInfo",
";",
"msg",
"=",
"log",
".",
"msg",
";",
"}",
"printer",
".",
"println",
"(",
"logLevel",
",",
"tag",
",",
"logConfiguration",
".",
"withBorder",
"?",
"logConfiguration",
".",
"borderFormatter",
".",
"format",
"(",
"new",
"String",
"[",
"]",
"{",
"thread",
",",
"stackTrace",
",",
"msg",
"}",
")",
":",
"(",
"(",
"thread",
"!=",
"null",
"?",
"(",
"thread",
"+",
"SystemCompat",
".",
"lineSeparator",
")",
":",
"\"\"",
")",
"+",
"(",
"stackTrace",
"!=",
"null",
"?",
"(",
"stackTrace",
"+",
"SystemCompat",
".",
"lineSeparator",
")",
":",
"\"\"",
")",
"+",
"msg",
")",
")",
";",
"}"
]
| Print a log in a new line internally.
@param logLevel the log level of the printing log
@param msg the message you would like to log | [
"Print",
"a",
"log",
"in",
"a",
"new",
"line",
"internally",
"."
]
| train | https://github.com/elvishew/xLog/blob/c6fb95555ce619d3e527f5ba6c45d4d247c5a838/library/src/main/java/com/elvishew/xlog/Logger.java#L557-L600 |
samskivert/samskivert | src/main/java/com/samskivert/swing/EnablingAdapter.java | EnablingAdapter.getPropChangeEnabler | public static PropertyChangeListener getPropChangeEnabler (
String property, JComponent target, boolean invert) {
"""
Creates and returns an enabler that listens for changes in the
specified property (which must be a {@link Boolean} valued
property) and updates the target's enabled state accordingly.
"""
return new PropertyChangeEnabler(property, target, invert);
} | java | public static PropertyChangeListener getPropChangeEnabler (
String property, JComponent target, boolean invert)
{
return new PropertyChangeEnabler(property, target, invert);
} | [
"public",
"static",
"PropertyChangeListener",
"getPropChangeEnabler",
"(",
"String",
"property",
",",
"JComponent",
"target",
",",
"boolean",
"invert",
")",
"{",
"return",
"new",
"PropertyChangeEnabler",
"(",
"property",
",",
"target",
",",
"invert",
")",
";",
"}"
]
| Creates and returns an enabler that listens for changes in the
specified property (which must be a {@link Boolean} valued
property) and updates the target's enabled state accordingly. | [
"Creates",
"and",
"returns",
"an",
"enabler",
"that",
"listens",
"for",
"changes",
"in",
"the",
"specified",
"property",
"(",
"which",
"must",
"be",
"a",
"{"
]
| train | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/swing/EnablingAdapter.java#L26-L30 |
soi-toolkit/soi-toolkit-mule | tools/soitoolkit-generator/soitoolkit-generator/src/main/java/org/soitoolkit/tools/generator/util/FileUtil.java | FileUtil.copyFile | public static void copyFile(File srcFile, File destFile) {
"""
Copy a file to new destination.
@param srcFile
@param destFile
"""
OutputStream out = null;
InputStream in = null;
try {
if (!destFile.getParentFile().exists())
destFile.getParentFile().mkdirs();
in = new FileInputStream(srcFile);
out = new FileOutputStream(destFile);
// Transfer bytes from in to out
byte[] buf = new byte[1024];
int len;
while ((len = in.read(buf)) > 0) {
out.write(buf, 0, len);
}
in.close();
out.close();
} catch (IOException e) {
throw new RuntimeException(e);
}
} | java | public static void copyFile(File srcFile, File destFile) {
OutputStream out = null;
InputStream in = null;
try {
if (!destFile.getParentFile().exists())
destFile.getParentFile().mkdirs();
in = new FileInputStream(srcFile);
out = new FileOutputStream(destFile);
// Transfer bytes from in to out
byte[] buf = new byte[1024];
int len;
while ((len = in.read(buf)) > 0) {
out.write(buf, 0, len);
}
in.close();
out.close();
} catch (IOException e) {
throw new RuntimeException(e);
}
} | [
"public",
"static",
"void",
"copyFile",
"(",
"File",
"srcFile",
",",
"File",
"destFile",
")",
"{",
"OutputStream",
"out",
"=",
"null",
";",
"InputStream",
"in",
"=",
"null",
";",
"try",
"{",
"if",
"(",
"!",
"destFile",
".",
"getParentFile",
"(",
")",
".",
"exists",
"(",
")",
")",
"destFile",
".",
"getParentFile",
"(",
")",
".",
"mkdirs",
"(",
")",
";",
"in",
"=",
"new",
"FileInputStream",
"(",
"srcFile",
")",
";",
"out",
"=",
"new",
"FileOutputStream",
"(",
"destFile",
")",
";",
"// Transfer bytes from in to out",
"byte",
"[",
"]",
"buf",
"=",
"new",
"byte",
"[",
"1024",
"]",
";",
"int",
"len",
";",
"while",
"(",
"(",
"len",
"=",
"in",
".",
"read",
"(",
"buf",
")",
")",
">",
"0",
")",
"{",
"out",
".",
"write",
"(",
"buf",
",",
"0",
",",
"len",
")",
";",
"}",
"in",
".",
"close",
"(",
")",
";",
"out",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"e",
")",
";",
"}",
"}"
]
| Copy a file to new destination.
@param srcFile
@param destFile | [
"Copy",
"a",
"file",
"to",
"new",
"destination",
"."
]
| train | https://github.com/soi-toolkit/soi-toolkit-mule/blob/e891350dbf55e6307be94d193d056bdb785b37d3/tools/soitoolkit-generator/soitoolkit-generator/src/main/java/org/soitoolkit/tools/generator/util/FileUtil.java#L79-L100 |
michel-kraemer/citeproc-java | citeproc-java/src/main/java/de/undercouch/citeproc/helper/CSLUtils.java | CSLUtils.readURLToString | public static String readURLToString(URL u, String encoding) throws IOException {
"""
Reads a string from a URL
@param u the URL
@param encoding the character encoding
@return the string
@throws IOException if the URL contents could not be read
"""
for (int i = 0; i < 30; ++i) {
URLConnection conn = u.openConnection();
// handle HTTP URLs
if (conn instanceof HttpURLConnection) {
HttpURLConnection hconn = (HttpURLConnection)conn;
// set timeouts
hconn.setConnectTimeout(15000);
hconn.setReadTimeout(15000);
// handle redirects
switch (hconn.getResponseCode()) {
case HttpURLConnection.HTTP_MOVED_PERM:
case HttpURLConnection.HTTP_MOVED_TEMP:
String location = hconn.getHeaderField("Location");
u = new URL(u, location);
continue;
}
}
return readStreamToString(conn.getInputStream(), encoding);
}
throw new IOException("Too many HTTP redirects");
} | java | public static String readURLToString(URL u, String encoding) throws IOException {
for (int i = 0; i < 30; ++i) {
URLConnection conn = u.openConnection();
// handle HTTP URLs
if (conn instanceof HttpURLConnection) {
HttpURLConnection hconn = (HttpURLConnection)conn;
// set timeouts
hconn.setConnectTimeout(15000);
hconn.setReadTimeout(15000);
// handle redirects
switch (hconn.getResponseCode()) {
case HttpURLConnection.HTTP_MOVED_PERM:
case HttpURLConnection.HTTP_MOVED_TEMP:
String location = hconn.getHeaderField("Location");
u = new URL(u, location);
continue;
}
}
return readStreamToString(conn.getInputStream(), encoding);
}
throw new IOException("Too many HTTP redirects");
} | [
"public",
"static",
"String",
"readURLToString",
"(",
"URL",
"u",
",",
"String",
"encoding",
")",
"throws",
"IOException",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"30",
";",
"++",
"i",
")",
"{",
"URLConnection",
"conn",
"=",
"u",
".",
"openConnection",
"(",
")",
";",
"// handle HTTP URLs",
"if",
"(",
"conn",
"instanceof",
"HttpURLConnection",
")",
"{",
"HttpURLConnection",
"hconn",
"=",
"(",
"HttpURLConnection",
")",
"conn",
";",
"// set timeouts",
"hconn",
".",
"setConnectTimeout",
"(",
"15000",
")",
";",
"hconn",
".",
"setReadTimeout",
"(",
"15000",
")",
";",
"// handle redirects",
"switch",
"(",
"hconn",
".",
"getResponseCode",
"(",
")",
")",
"{",
"case",
"HttpURLConnection",
".",
"HTTP_MOVED_PERM",
":",
"case",
"HttpURLConnection",
".",
"HTTP_MOVED_TEMP",
":",
"String",
"location",
"=",
"hconn",
".",
"getHeaderField",
"(",
"\"Location\"",
")",
";",
"u",
"=",
"new",
"URL",
"(",
"u",
",",
"location",
")",
";",
"continue",
";",
"}",
"}",
"return",
"readStreamToString",
"(",
"conn",
".",
"getInputStream",
"(",
")",
",",
"encoding",
")",
";",
"}",
"throw",
"new",
"IOException",
"(",
"\"Too many HTTP redirects\"",
")",
";",
"}"
]
| Reads a string from a URL
@param u the URL
@param encoding the character encoding
@return the string
@throws IOException if the URL contents could not be read | [
"Reads",
"a",
"string",
"from",
"a",
"URL"
]
| train | https://github.com/michel-kraemer/citeproc-java/blob/1d5bf0e7bbb2bdc47309530babf0ecaba838bf10/citeproc-java/src/main/java/de/undercouch/citeproc/helper/CSLUtils.java#L38-L64 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/rewrite/rewritepolicylabel_binding.java | rewritepolicylabel_binding.get | public static rewritepolicylabel_binding get(nitro_service service, String labelname) throws Exception {
"""
Use this API to fetch rewritepolicylabel_binding resource of given name .
"""
rewritepolicylabel_binding obj = new rewritepolicylabel_binding();
obj.set_labelname(labelname);
rewritepolicylabel_binding response = (rewritepolicylabel_binding) obj.get_resource(service);
return response;
} | java | public static rewritepolicylabel_binding get(nitro_service service, String labelname) throws Exception{
rewritepolicylabel_binding obj = new rewritepolicylabel_binding();
obj.set_labelname(labelname);
rewritepolicylabel_binding response = (rewritepolicylabel_binding) obj.get_resource(service);
return response;
} | [
"public",
"static",
"rewritepolicylabel_binding",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"labelname",
")",
"throws",
"Exception",
"{",
"rewritepolicylabel_binding",
"obj",
"=",
"new",
"rewritepolicylabel_binding",
"(",
")",
";",
"obj",
".",
"set_labelname",
"(",
"labelname",
")",
";",
"rewritepolicylabel_binding",
"response",
"=",
"(",
"rewritepolicylabel_binding",
")",
"obj",
".",
"get_resource",
"(",
"service",
")",
";",
"return",
"response",
";",
"}"
]
| Use this API to fetch rewritepolicylabel_binding resource of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"rewritepolicylabel_binding",
"resource",
"of",
"given",
"name",
"."
]
| train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/rewrite/rewritepolicylabel_binding.java#L114-L119 |
teatrove/teatrove | trove/src/main/java/org/teatrove/trove/net/HttpClient.java | HttpClient.addHeader | public HttpClient addHeader(String name, Object value) {
"""
Add a header name-value pair to the request in order for multiple values
to be specified.
@return 'this', so that addtional calls may be chained together
"""
if (mHeaders == null) {
mHeaders = new HttpHeaderMap();
}
mHeaders.add(name, value);
return this;
} | java | public HttpClient addHeader(String name, Object value) {
if (mHeaders == null) {
mHeaders = new HttpHeaderMap();
}
mHeaders.add(name, value);
return this;
} | [
"public",
"HttpClient",
"addHeader",
"(",
"String",
"name",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"mHeaders",
"==",
"null",
")",
"{",
"mHeaders",
"=",
"new",
"HttpHeaderMap",
"(",
")",
";",
"}",
"mHeaders",
".",
"add",
"(",
"name",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
]
| Add a header name-value pair to the request in order for multiple values
to be specified.
@return 'this', so that addtional calls may be chained together | [
"Add",
"a",
"header",
"name",
"-",
"value",
"pair",
"to",
"the",
"request",
"in",
"order",
"for",
"multiple",
"values",
"to",
"be",
"specified",
"."
]
| train | https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/net/HttpClient.java#L130-L136 |
deeplearning4j/deeplearning4j | datavec/datavec-data/datavec-data-image/src/main/java/org/datavec/image/loader/NativeImageLoader.java | NativeImageLoader.asMatrix | private INDArray asMatrix(BytePointer bytes, long length) throws IOException {
"""
Read multipage tiff and load into INDArray
@param bytes
@return INDArray
@throws IOException
"""
PIXA pixa;
pixa = pixaReadMemMultipageTiff(bytes, length);
INDArray data;
INDArray currentD;
INDArrayIndex[] index = null;
switch (this.multiPageMode) {
case MINIBATCH:
data = Nd4j.create(pixa.n(), 1, pixa.pix(0).h(), pixa.pix(0).w());
break;
case CHANNELS:
data = Nd4j.create(1, pixa.n(), pixa.pix(0).h(), pixa.pix(0).w());
break;
case FIRST:
data = Nd4j.create(1, 1, pixa.pix(0).h(), pixa.pix(0).w());
PIX pix = pixa.pix(0);
currentD = asMatrix(convert(pix));
pixDestroy(pix);
index = new INDArrayIndex[]{NDArrayIndex.point(0), NDArrayIndex.point(0),NDArrayIndex.all(),NDArrayIndex.all()};
data.put(index , currentD.get(NDArrayIndex.all(), NDArrayIndex.all(),NDArrayIndex.all()));
return data;
default: throw new UnsupportedOperationException("Unsupported MultiPageMode: " + multiPageMode);
}
for (int i = 0; i < pixa.n(); i++) {
PIX pix = pixa.pix(i);
currentD = asMatrix(convert(pix));
pixDestroy(pix);
//TODO to change when 16-bit image is supported
switch (this.multiPageMode) {
case MINIBATCH:
index = new INDArrayIndex[]{NDArrayIndex.point(i), NDArrayIndex.all(),NDArrayIndex.all(),NDArrayIndex.all()};
break;
case CHANNELS:
index = new INDArrayIndex[]{NDArrayIndex.all(), NDArrayIndex.point(i),NDArrayIndex.all(),NDArrayIndex.all()};
break;
default: throw new UnsupportedOperationException("Unsupported MultiPageMode: " + multiPageMode);
}
data.put(index , currentD.get(NDArrayIndex.all(), NDArrayIndex.all(),NDArrayIndex.all()));
}
return data;
} | java | private INDArray asMatrix(BytePointer bytes, long length) throws IOException {
PIXA pixa;
pixa = pixaReadMemMultipageTiff(bytes, length);
INDArray data;
INDArray currentD;
INDArrayIndex[] index = null;
switch (this.multiPageMode) {
case MINIBATCH:
data = Nd4j.create(pixa.n(), 1, pixa.pix(0).h(), pixa.pix(0).w());
break;
case CHANNELS:
data = Nd4j.create(1, pixa.n(), pixa.pix(0).h(), pixa.pix(0).w());
break;
case FIRST:
data = Nd4j.create(1, 1, pixa.pix(0).h(), pixa.pix(0).w());
PIX pix = pixa.pix(0);
currentD = asMatrix(convert(pix));
pixDestroy(pix);
index = new INDArrayIndex[]{NDArrayIndex.point(0), NDArrayIndex.point(0),NDArrayIndex.all(),NDArrayIndex.all()};
data.put(index , currentD.get(NDArrayIndex.all(), NDArrayIndex.all(),NDArrayIndex.all()));
return data;
default: throw new UnsupportedOperationException("Unsupported MultiPageMode: " + multiPageMode);
}
for (int i = 0; i < pixa.n(); i++) {
PIX pix = pixa.pix(i);
currentD = asMatrix(convert(pix));
pixDestroy(pix);
//TODO to change when 16-bit image is supported
switch (this.multiPageMode) {
case MINIBATCH:
index = new INDArrayIndex[]{NDArrayIndex.point(i), NDArrayIndex.all(),NDArrayIndex.all(),NDArrayIndex.all()};
break;
case CHANNELS:
index = new INDArrayIndex[]{NDArrayIndex.all(), NDArrayIndex.point(i),NDArrayIndex.all(),NDArrayIndex.all()};
break;
default: throw new UnsupportedOperationException("Unsupported MultiPageMode: " + multiPageMode);
}
data.put(index , currentD.get(NDArrayIndex.all(), NDArrayIndex.all(),NDArrayIndex.all()));
}
return data;
} | [
"private",
"INDArray",
"asMatrix",
"(",
"BytePointer",
"bytes",
",",
"long",
"length",
")",
"throws",
"IOException",
"{",
"PIXA",
"pixa",
";",
"pixa",
"=",
"pixaReadMemMultipageTiff",
"(",
"bytes",
",",
"length",
")",
";",
"INDArray",
"data",
";",
"INDArray",
"currentD",
";",
"INDArrayIndex",
"[",
"]",
"index",
"=",
"null",
";",
"switch",
"(",
"this",
".",
"multiPageMode",
")",
"{",
"case",
"MINIBATCH",
":",
"data",
"=",
"Nd4j",
".",
"create",
"(",
"pixa",
".",
"n",
"(",
")",
",",
"1",
",",
"pixa",
".",
"pix",
"(",
"0",
")",
".",
"h",
"(",
")",
",",
"pixa",
".",
"pix",
"(",
"0",
")",
".",
"w",
"(",
")",
")",
";",
"break",
";",
"case",
"CHANNELS",
":",
"data",
"=",
"Nd4j",
".",
"create",
"(",
"1",
",",
"pixa",
".",
"n",
"(",
")",
",",
"pixa",
".",
"pix",
"(",
"0",
")",
".",
"h",
"(",
")",
",",
"pixa",
".",
"pix",
"(",
"0",
")",
".",
"w",
"(",
")",
")",
";",
"break",
";",
"case",
"FIRST",
":",
"data",
"=",
"Nd4j",
".",
"create",
"(",
"1",
",",
"1",
",",
"pixa",
".",
"pix",
"(",
"0",
")",
".",
"h",
"(",
")",
",",
"pixa",
".",
"pix",
"(",
"0",
")",
".",
"w",
"(",
")",
")",
";",
"PIX",
"pix",
"=",
"pixa",
".",
"pix",
"(",
"0",
")",
";",
"currentD",
"=",
"asMatrix",
"(",
"convert",
"(",
"pix",
")",
")",
";",
"pixDestroy",
"(",
"pix",
")",
";",
"index",
"=",
"new",
"INDArrayIndex",
"[",
"]",
"{",
"NDArrayIndex",
".",
"point",
"(",
"0",
")",
",",
"NDArrayIndex",
".",
"point",
"(",
"0",
")",
",",
"NDArrayIndex",
".",
"all",
"(",
")",
",",
"NDArrayIndex",
".",
"all",
"(",
")",
"}",
";",
"data",
".",
"put",
"(",
"index",
",",
"currentD",
".",
"get",
"(",
"NDArrayIndex",
".",
"all",
"(",
")",
",",
"NDArrayIndex",
".",
"all",
"(",
")",
",",
"NDArrayIndex",
".",
"all",
"(",
")",
")",
")",
";",
"return",
"data",
";",
"default",
":",
"throw",
"new",
"UnsupportedOperationException",
"(",
"\"Unsupported MultiPageMode: \"",
"+",
"multiPageMode",
")",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"pixa",
".",
"n",
"(",
")",
";",
"i",
"++",
")",
"{",
"PIX",
"pix",
"=",
"pixa",
".",
"pix",
"(",
"i",
")",
";",
"currentD",
"=",
"asMatrix",
"(",
"convert",
"(",
"pix",
")",
")",
";",
"pixDestroy",
"(",
"pix",
")",
";",
"//TODO to change when 16-bit image is supported",
"switch",
"(",
"this",
".",
"multiPageMode",
")",
"{",
"case",
"MINIBATCH",
":",
"index",
"=",
"new",
"INDArrayIndex",
"[",
"]",
"{",
"NDArrayIndex",
".",
"point",
"(",
"i",
")",
",",
"NDArrayIndex",
".",
"all",
"(",
")",
",",
"NDArrayIndex",
".",
"all",
"(",
")",
",",
"NDArrayIndex",
".",
"all",
"(",
")",
"}",
";",
"break",
";",
"case",
"CHANNELS",
":",
"index",
"=",
"new",
"INDArrayIndex",
"[",
"]",
"{",
"NDArrayIndex",
".",
"all",
"(",
")",
",",
"NDArrayIndex",
".",
"point",
"(",
"i",
")",
",",
"NDArrayIndex",
".",
"all",
"(",
")",
",",
"NDArrayIndex",
".",
"all",
"(",
")",
"}",
";",
"break",
";",
"default",
":",
"throw",
"new",
"UnsupportedOperationException",
"(",
"\"Unsupported MultiPageMode: \"",
"+",
"multiPageMode",
")",
";",
"}",
"data",
".",
"put",
"(",
"index",
",",
"currentD",
".",
"get",
"(",
"NDArrayIndex",
".",
"all",
"(",
")",
",",
"NDArrayIndex",
".",
"all",
"(",
")",
",",
"NDArrayIndex",
".",
"all",
"(",
")",
")",
")",
";",
"}",
"return",
"data",
";",
"}"
]
| Read multipage tiff and load into INDArray
@param bytes
@return INDArray
@throws IOException | [
"Read",
"multipage",
"tiff",
"and",
"load",
"into",
"INDArray"
]
| train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-data/datavec-data-image/src/main/java/org/datavec/image/loader/NativeImageLoader.java#L819-L860 |
tcurdt/jdeb | src/main/java/org/vafer/jdeb/producers/Producers.java | Producers.defaultDirEntryWithName | static TarArchiveEntry defaultDirEntryWithName( final String dirName ) {
"""
Creates a tar directory entry with defaults parameters.
@param dirName the directory name
@return dir entry with reasonable defaults
"""
TarArchiveEntry entry = new TarArchiveEntry(dirName, true);
entry.setUserId(ROOT_UID);
entry.setUserName(ROOT_NAME);
entry.setGroupId(ROOT_UID);
entry.setGroupName(ROOT_NAME);
entry.setMode(TarArchiveEntry.DEFAULT_DIR_MODE);
return entry;
} | java | static TarArchiveEntry defaultDirEntryWithName( final String dirName ) {
TarArchiveEntry entry = new TarArchiveEntry(dirName, true);
entry.setUserId(ROOT_UID);
entry.setUserName(ROOT_NAME);
entry.setGroupId(ROOT_UID);
entry.setGroupName(ROOT_NAME);
entry.setMode(TarArchiveEntry.DEFAULT_DIR_MODE);
return entry;
} | [
"static",
"TarArchiveEntry",
"defaultDirEntryWithName",
"(",
"final",
"String",
"dirName",
")",
"{",
"TarArchiveEntry",
"entry",
"=",
"new",
"TarArchiveEntry",
"(",
"dirName",
",",
"true",
")",
";",
"entry",
".",
"setUserId",
"(",
"ROOT_UID",
")",
";",
"entry",
".",
"setUserName",
"(",
"ROOT_NAME",
")",
";",
"entry",
".",
"setGroupId",
"(",
"ROOT_UID",
")",
";",
"entry",
".",
"setGroupName",
"(",
"ROOT_NAME",
")",
";",
"entry",
".",
"setMode",
"(",
"TarArchiveEntry",
".",
"DEFAULT_DIR_MODE",
")",
";",
"return",
"entry",
";",
"}"
]
| Creates a tar directory entry with defaults parameters.
@param dirName the directory name
@return dir entry with reasonable defaults | [
"Creates",
"a",
"tar",
"directory",
"entry",
"with",
"defaults",
"parameters",
"."
]
| train | https://github.com/tcurdt/jdeb/blob/b899a7b1b3391356aafc491ab601f258961f67f0/src/main/java/org/vafer/jdeb/producers/Producers.java#L57-L65 |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/spatial/volume/GeometryExtrude.java | GeometryExtrude.extrudeLineStringAsGeometry | public static GeometryCollection extrudeLineStringAsGeometry(LineString lineString, double height) {
"""
Extrude the linestring as a collection of geometries
The output geometryCollection contains the floor, the walls and the roof.
@param lineString
@param height
@return
"""
Geometry[] geometries = new Geometry[3];
GeometryFactory factory = lineString.getFactory();
//Extract the walls
Coordinate[] coords = lineString.getCoordinates();
Polygon[] walls = new Polygon[coords.length - 1];
for (int i = 0; i < coords.length - 1; i++) {
walls[i] = extrudeEdge(coords[i], coords[i + 1], height, factory);
}
lineString.apply(new TranslateCoordinateSequenceFilter(0));
geometries[0]= lineString;
geometries[1]= factory.createMultiPolygon(walls);
geometries[2]= extractRoof(lineString, height);
return factory.createGeometryCollection(geometries);
} | java | public static GeometryCollection extrudeLineStringAsGeometry(LineString lineString, double height){
Geometry[] geometries = new Geometry[3];
GeometryFactory factory = lineString.getFactory();
//Extract the walls
Coordinate[] coords = lineString.getCoordinates();
Polygon[] walls = new Polygon[coords.length - 1];
for (int i = 0; i < coords.length - 1; i++) {
walls[i] = extrudeEdge(coords[i], coords[i + 1], height, factory);
}
lineString.apply(new TranslateCoordinateSequenceFilter(0));
geometries[0]= lineString;
geometries[1]= factory.createMultiPolygon(walls);
geometries[2]= extractRoof(lineString, height);
return factory.createGeometryCollection(geometries);
} | [
"public",
"static",
"GeometryCollection",
"extrudeLineStringAsGeometry",
"(",
"LineString",
"lineString",
",",
"double",
"height",
")",
"{",
"Geometry",
"[",
"]",
"geometries",
"=",
"new",
"Geometry",
"[",
"3",
"]",
";",
"GeometryFactory",
"factory",
"=",
"lineString",
".",
"getFactory",
"(",
")",
";",
"//Extract the walls ",
"Coordinate",
"[",
"]",
"coords",
"=",
"lineString",
".",
"getCoordinates",
"(",
")",
";",
"Polygon",
"[",
"]",
"walls",
"=",
"new",
"Polygon",
"[",
"coords",
".",
"length",
"-",
"1",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"coords",
".",
"length",
"-",
"1",
";",
"i",
"++",
")",
"{",
"walls",
"[",
"i",
"]",
"=",
"extrudeEdge",
"(",
"coords",
"[",
"i",
"]",
",",
"coords",
"[",
"i",
"+",
"1",
"]",
",",
"height",
",",
"factory",
")",
";",
"}",
"lineString",
".",
"apply",
"(",
"new",
"TranslateCoordinateSequenceFilter",
"(",
"0",
")",
")",
";",
"geometries",
"[",
"0",
"]",
"=",
"lineString",
";",
"geometries",
"[",
"1",
"]",
"=",
"factory",
".",
"createMultiPolygon",
"(",
"walls",
")",
";",
"geometries",
"[",
"2",
"]",
"=",
"extractRoof",
"(",
"lineString",
",",
"height",
")",
";",
"return",
"factory",
".",
"createGeometryCollection",
"(",
"geometries",
")",
";",
"}"
]
| Extrude the linestring as a collection of geometries
The output geometryCollection contains the floor, the walls and the roof.
@param lineString
@param height
@return | [
"Extrude",
"the",
"linestring",
"as",
"a",
"collection",
"of",
"geometries",
"The",
"output",
"geometryCollection",
"contains",
"the",
"floor",
"the",
"walls",
"and",
"the",
"roof",
"."
]
| train | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/volume/GeometryExtrude.java#L84-L98 |
pravega/pravega | controller/src/main/java/io/pravega/controller/store/stream/ZkOrderedStore.java | ZkOrderedStore.removeEntities | CompletableFuture<Void> removeEntities(String scope, String stream, Collection<Long> entities) {
"""
Method to remove entities from the ordered set. Entities are referred to by their position pointer.
@param scope scope
@param stream stream
@param entities list of entities' positions to remove
@return CompletableFuture which when completed will indicate that entities are removed from the set.
"""
Set<Integer> collections = entities.stream().collect(Collectors.groupingBy(x -> new Position(x).collectionNumber)).keySet();
return Futures.allOf(entities.stream()
.map(entity -> storeHelper.deletePath(getEntityPath(scope, stream, entity), false))
.collect(Collectors.toList()))
.thenCompose(v -> Futures.allOf(
collections.stream().map(collectionNum -> isSealed(scope, stream, collectionNum)
.thenCompose(sealed -> {
if (sealed) {
return tryDeleteSealedCollection(scope, stream, collectionNum);
} else {
return CompletableFuture.completedFuture(null);
}
})).collect(Collectors.toList())))
.whenComplete((r, e) -> {
if (e != null) {
log.error("error encountered while trying to remove entity positions {} for stream {}/{}", entities, scope, stream, e);
} else {
log.debug("entities at positions {} removed for stream {}/{}", entities, scope, stream);
}
});
} | java | CompletableFuture<Void> removeEntities(String scope, String stream, Collection<Long> entities) {
Set<Integer> collections = entities.stream().collect(Collectors.groupingBy(x -> new Position(x).collectionNumber)).keySet();
return Futures.allOf(entities.stream()
.map(entity -> storeHelper.deletePath(getEntityPath(scope, stream, entity), false))
.collect(Collectors.toList()))
.thenCompose(v -> Futures.allOf(
collections.stream().map(collectionNum -> isSealed(scope, stream, collectionNum)
.thenCompose(sealed -> {
if (sealed) {
return tryDeleteSealedCollection(scope, stream, collectionNum);
} else {
return CompletableFuture.completedFuture(null);
}
})).collect(Collectors.toList())))
.whenComplete((r, e) -> {
if (e != null) {
log.error("error encountered while trying to remove entity positions {} for stream {}/{}", entities, scope, stream, e);
} else {
log.debug("entities at positions {} removed for stream {}/{}", entities, scope, stream);
}
});
} | [
"CompletableFuture",
"<",
"Void",
">",
"removeEntities",
"(",
"String",
"scope",
",",
"String",
"stream",
",",
"Collection",
"<",
"Long",
">",
"entities",
")",
"{",
"Set",
"<",
"Integer",
">",
"collections",
"=",
"entities",
".",
"stream",
"(",
")",
".",
"collect",
"(",
"Collectors",
".",
"groupingBy",
"(",
"x",
"->",
"new",
"Position",
"(",
"x",
")",
".",
"collectionNumber",
")",
")",
".",
"keySet",
"(",
")",
";",
"return",
"Futures",
".",
"allOf",
"(",
"entities",
".",
"stream",
"(",
")",
".",
"map",
"(",
"entity",
"->",
"storeHelper",
".",
"deletePath",
"(",
"getEntityPath",
"(",
"scope",
",",
"stream",
",",
"entity",
")",
",",
"false",
")",
")",
".",
"collect",
"(",
"Collectors",
".",
"toList",
"(",
")",
")",
")",
".",
"thenCompose",
"(",
"v",
"->",
"Futures",
".",
"allOf",
"(",
"collections",
".",
"stream",
"(",
")",
".",
"map",
"(",
"collectionNum",
"->",
"isSealed",
"(",
"scope",
",",
"stream",
",",
"collectionNum",
")",
".",
"thenCompose",
"(",
"sealed",
"->",
"{",
"if",
"(",
"sealed",
")",
"{",
"return",
"tryDeleteSealedCollection",
"(",
"scope",
",",
"stream",
",",
"collectionNum",
")",
";",
"}",
"else",
"{",
"return",
"CompletableFuture",
".",
"completedFuture",
"(",
"null",
")",
";",
"}",
"}",
")",
")",
".",
"collect",
"(",
"Collectors",
".",
"toList",
"(",
")",
")",
")",
")",
".",
"whenComplete",
"(",
"(",
"r",
",",
"e",
")",
"->",
"{",
"if",
"(",
"e",
"!=",
"null",
")",
"{",
"log",
".",
"error",
"(",
"\"error encountered while trying to remove entity positions {} for stream {}/{}\"",
",",
"entities",
",",
"scope",
",",
"stream",
",",
"e",
")",
";",
"}",
"else",
"{",
"log",
".",
"debug",
"(",
"\"entities at positions {} removed for stream {}/{}\"",
",",
"entities",
",",
"scope",
",",
"stream",
")",
";",
"}",
"}",
")",
";",
"}"
]
| Method to remove entities from the ordered set. Entities are referred to by their position pointer.
@param scope scope
@param stream stream
@param entities list of entities' positions to remove
@return CompletableFuture which when completed will indicate that entities are removed from the set. | [
"Method",
"to",
"remove",
"entities",
"from",
"the",
"ordered",
"set",
".",
"Entities",
"are",
"referred",
"to",
"by",
"their",
"position",
"pointer",
"."
]
| train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/controller/src/main/java/io/pravega/controller/store/stream/ZkOrderedStore.java#L137-L158 |
sawano/java-commons | src/main/java/se/sawano/java/commons/lang/validate/Validate.java | Validate.notEmpty | public static <T extends Collection<?>> T notEmpty(final T collection, final String message, final Object... values) {
"""
<p>Validate that the specified argument collection is neither {@code null} nor a size of zero (no elements); otherwise throwing an exception with the specified message.
<pre>Validate.notEmpty(myCollection, "The collection must not be empty");</pre>
@param <T>
the collection type
@param collection
the collection to check, validated not null by this method
@param message
the {@link String#format(String, Object...)} exception message if invalid, not null
@param values
the optional values for the formatted exception message, null array not recommended
@return the validated collection (never {@code null} method for chaining)
@throws NullPointerValidationException
if the collection is {@code null}
@throws IllegalArgumentException
if the collection is empty
@see #notEmpty(Object[])
"""
return INSTANCE.notEmpty(collection, message, values);
} | java | public static <T extends Collection<?>> T notEmpty(final T collection, final String message, final Object... values) {
return INSTANCE.notEmpty(collection, message, values);
} | [
"public",
"static",
"<",
"T",
"extends",
"Collection",
"<",
"?",
">",
">",
"T",
"notEmpty",
"(",
"final",
"T",
"collection",
",",
"final",
"String",
"message",
",",
"final",
"Object",
"...",
"values",
")",
"{",
"return",
"INSTANCE",
".",
"notEmpty",
"(",
"collection",
",",
"message",
",",
"values",
")",
";",
"}"
]
| <p>Validate that the specified argument collection is neither {@code null} nor a size of zero (no elements); otherwise throwing an exception with the specified message.
<pre>Validate.notEmpty(myCollection, "The collection must not be empty");</pre>
@param <T>
the collection type
@param collection
the collection to check, validated not null by this method
@param message
the {@link String#format(String, Object...)} exception message if invalid, not null
@param values
the optional values for the formatted exception message, null array not recommended
@return the validated collection (never {@code null} method for chaining)
@throws NullPointerValidationException
if the collection is {@code null}
@throws IllegalArgumentException
if the collection is empty
@see #notEmpty(Object[]) | [
"<p",
">",
"Validate",
"that",
"the",
"specified",
"argument",
"collection",
"is",
"neither",
"{",
"@code",
"null",
"}",
"nor",
"a",
"size",
"of",
"zero",
"(",
"no",
"elements",
")",
";",
"otherwise",
"throwing",
"an",
"exception",
"with",
"the",
"specified",
"message",
".",
"<pre",
">",
"Validate",
".",
"notEmpty",
"(",
"myCollection",
"The",
"collection",
"must",
"not",
"be",
"empty",
")",
";",
"<",
"/",
"pre",
">"
]
| train | https://github.com/sawano/java-commons/blob/6f219c9e8dec4401dbe528d17ae6ec1ef9c0d284/src/main/java/se/sawano/java/commons/lang/validate/Validate.java#L866-L868 |
datacleaner/DataCleaner | engine/utils/src/main/java/org/datacleaner/util/StringUtils.java | StringUtils.replaceAll | public static String replaceAll(String str, final String searchToken, final String replacement) {
"""
Utility method that will do replacement multiple times until no more
occurrences are left.
Note that this is NOT the same as
{@link String#replaceAll(String, String)} which will only do one
run-through of the string, and it will use regexes instead of exact
searching.
@param str
@param searchToken
@param replacement
@return
"""
if (str == null) {
return str;
}
str = str.replace(searchToken, replacement);
return str;
} | java | public static String replaceAll(String str, final String searchToken, final String replacement) {
if (str == null) {
return str;
}
str = str.replace(searchToken, replacement);
return str;
} | [
"public",
"static",
"String",
"replaceAll",
"(",
"String",
"str",
",",
"final",
"String",
"searchToken",
",",
"final",
"String",
"replacement",
")",
"{",
"if",
"(",
"str",
"==",
"null",
")",
"{",
"return",
"str",
";",
"}",
"str",
"=",
"str",
".",
"replace",
"(",
"searchToken",
",",
"replacement",
")",
";",
"return",
"str",
";",
"}"
]
| Utility method that will do replacement multiple times until no more
occurrences are left.
Note that this is NOT the same as
{@link String#replaceAll(String, String)} which will only do one
run-through of the string, and it will use regexes instead of exact
searching.
@param str
@param searchToken
@param replacement
@return | [
"Utility",
"method",
"that",
"will",
"do",
"replacement",
"multiple",
"times",
"until",
"no",
"more",
"occurrences",
"are",
"left",
"."
]
| train | https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/engine/utils/src/main/java/org/datacleaner/util/StringUtils.java#L158-L164 |
google/closure-templates | java/src/com/google/template/soy/jbcsrc/PrintDirectives.java | PrintDirectives.applyStreamingPrintDirectives | static AppendableAndOptions applyStreamingPrintDirectives(
List<PrintDirectiveNode> directives,
Expression appendable,
BasicExpressionCompiler basic,
JbcSrcPluginContext renderContext,
TemplateVariableManager variables) {
"""
Applies all the streaming print directives to the appendable.
@param directives The directives. All are required to be {@link
com.google.template.soy.jbcsrc.restricted.SoyJbcSrcPrintDirective.Streamable streamable}
@param appendable The appendable to wrap
@param basic The expression compiler to use for compiling the arguments
@param renderContext The render context for the plugins
@param variables The local variable manager
@return The wrapped appendable
"""
List<DirectiveWithArgs> directivesToApply = new ArrayList<>();
for (PrintDirectiveNode directive : directives) {
directivesToApply.add(
DirectiveWithArgs.create(
(SoyJbcSrcPrintDirective.Streamable) directive.getPrintDirective(),
basic.compileToList(directive.getArgs())));
}
return applyStreamingPrintDirectivesTo(directivesToApply, appendable, renderContext, variables);
} | java | static AppendableAndOptions applyStreamingPrintDirectives(
List<PrintDirectiveNode> directives,
Expression appendable,
BasicExpressionCompiler basic,
JbcSrcPluginContext renderContext,
TemplateVariableManager variables) {
List<DirectiveWithArgs> directivesToApply = new ArrayList<>();
for (PrintDirectiveNode directive : directives) {
directivesToApply.add(
DirectiveWithArgs.create(
(SoyJbcSrcPrintDirective.Streamable) directive.getPrintDirective(),
basic.compileToList(directive.getArgs())));
}
return applyStreamingPrintDirectivesTo(directivesToApply, appendable, renderContext, variables);
} | [
"static",
"AppendableAndOptions",
"applyStreamingPrintDirectives",
"(",
"List",
"<",
"PrintDirectiveNode",
">",
"directives",
",",
"Expression",
"appendable",
",",
"BasicExpressionCompiler",
"basic",
",",
"JbcSrcPluginContext",
"renderContext",
",",
"TemplateVariableManager",
"variables",
")",
"{",
"List",
"<",
"DirectiveWithArgs",
">",
"directivesToApply",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"PrintDirectiveNode",
"directive",
":",
"directives",
")",
"{",
"directivesToApply",
".",
"add",
"(",
"DirectiveWithArgs",
".",
"create",
"(",
"(",
"SoyJbcSrcPrintDirective",
".",
"Streamable",
")",
"directive",
".",
"getPrintDirective",
"(",
")",
",",
"basic",
".",
"compileToList",
"(",
"directive",
".",
"getArgs",
"(",
")",
")",
")",
")",
";",
"}",
"return",
"applyStreamingPrintDirectivesTo",
"(",
"directivesToApply",
",",
"appendable",
",",
"renderContext",
",",
"variables",
")",
";",
"}"
]
| Applies all the streaming print directives to the appendable.
@param directives The directives. All are required to be {@link
com.google.template.soy.jbcsrc.restricted.SoyJbcSrcPrintDirective.Streamable streamable}
@param appendable The appendable to wrap
@param basic The expression compiler to use for compiling the arguments
@param renderContext The render context for the plugins
@param variables The local variable manager
@return The wrapped appendable | [
"Applies",
"all",
"the",
"streaming",
"print",
"directives",
"to",
"the",
"appendable",
"."
]
| train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/PrintDirectives.java#L116-L130 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/PtoPInputHandler.java | PtoPInputHandler.reportResolvedGap | @Override
public void reportResolvedGap(String sourceMEUuid, long filledGap) {
"""
Issue an all clear on a previously reported gap in a GD stream (510343)
@param sourceMEUuid
@param filledGap
"""
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "reportResolvedGap", new Object[] { sourceMEUuid, new Long(filledGap) });
if (_isLink)
{
//The gap starting at sequence id {0} in the message stream from bus {1} on link {2} has been resolved on message engine {3}.
SibTr.info(tc, "RESOLVED_GAP_IN_LINK_TRANSMITTER_CWSIP0791",
new Object[] { (new Long(filledGap)).toString(),
((LinkHandler) _destination).getBusName(),
_destination.getName(),
_messageProcessor.getMessagingEngineName() });
}
else
{
//The gap starting at sequence id {0} in the message stream for destination {1} from messaging engine {2} has been resolved on message engine {3}.
SibTr.info(tc, "RESOLVED_GAP_IN_DESTINATION_TRANSMITTER_CWSIP0793",
new Object[] { (new Long(filledGap)).toString(),
_destination.getName(),
SIMPUtils.getMENameFromUuid(sourceMEUuid),
_messageProcessor.getMessagingEngineName() });
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "reportResolvedGap");
} | java | @Override
public void reportResolvedGap(String sourceMEUuid, long filledGap)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "reportResolvedGap", new Object[] { sourceMEUuid, new Long(filledGap) });
if (_isLink)
{
//The gap starting at sequence id {0} in the message stream from bus {1} on link {2} has been resolved on message engine {3}.
SibTr.info(tc, "RESOLVED_GAP_IN_LINK_TRANSMITTER_CWSIP0791",
new Object[] { (new Long(filledGap)).toString(),
((LinkHandler) _destination).getBusName(),
_destination.getName(),
_messageProcessor.getMessagingEngineName() });
}
else
{
//The gap starting at sequence id {0} in the message stream for destination {1} from messaging engine {2} has been resolved on message engine {3}.
SibTr.info(tc, "RESOLVED_GAP_IN_DESTINATION_TRANSMITTER_CWSIP0793",
new Object[] { (new Long(filledGap)).toString(),
_destination.getName(),
SIMPUtils.getMENameFromUuid(sourceMEUuid),
_messageProcessor.getMessagingEngineName() });
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "reportResolvedGap");
} | [
"@",
"Override",
"public",
"void",
"reportResolvedGap",
"(",
"String",
"sourceMEUuid",
",",
"long",
"filledGap",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"reportResolvedGap\"",
",",
"new",
"Object",
"[",
"]",
"{",
"sourceMEUuid",
",",
"new",
"Long",
"(",
"filledGap",
")",
"}",
")",
";",
"if",
"(",
"_isLink",
")",
"{",
"//The gap starting at sequence id {0} in the message stream from bus {1} on link {2} has been resolved on message engine {3}.",
"SibTr",
".",
"info",
"(",
"tc",
",",
"\"RESOLVED_GAP_IN_LINK_TRANSMITTER_CWSIP0791\"",
",",
"new",
"Object",
"[",
"]",
"{",
"(",
"new",
"Long",
"(",
"filledGap",
")",
")",
".",
"toString",
"(",
")",
",",
"(",
"(",
"LinkHandler",
")",
"_destination",
")",
".",
"getBusName",
"(",
")",
",",
"_destination",
".",
"getName",
"(",
")",
",",
"_messageProcessor",
".",
"getMessagingEngineName",
"(",
")",
"}",
")",
";",
"}",
"else",
"{",
"//The gap starting at sequence id {0} in the message stream for destination {1} from messaging engine {2} has been resolved on message engine {3}.",
"SibTr",
".",
"info",
"(",
"tc",
",",
"\"RESOLVED_GAP_IN_DESTINATION_TRANSMITTER_CWSIP0793\"",
",",
"new",
"Object",
"[",
"]",
"{",
"(",
"new",
"Long",
"(",
"filledGap",
")",
")",
".",
"toString",
"(",
")",
",",
"_destination",
".",
"getName",
"(",
")",
",",
"SIMPUtils",
".",
"getMENameFromUuid",
"(",
"sourceMEUuid",
")",
",",
"_messageProcessor",
".",
"getMessagingEngineName",
"(",
")",
"}",
")",
";",
"}",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"reportResolvedGap\"",
")",
";",
"}"
]
| Issue an all clear on a previously reported gap in a GD stream (510343)
@param sourceMEUuid
@param filledGap | [
"Issue",
"an",
"all",
"clear",
"on",
"a",
"previously",
"reported",
"gap",
"in",
"a",
"GD",
"stream",
"(",
"510343",
")"
]
| train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/PtoPInputHandler.java#L3538-L3565 |
salesforce/Argus | ArgusCore/src/main/java/com/salesforce/dva/argus/service/tsdb/CachedTSDBService.java | CachedTSDBService.constructMetricQueryKey | private String constructMetricQueryKey(Long startTimeStampBoundary, MetricQuery query) {
"""
Constructs a cache key from start time stamp boundary, and tags in metric query.
@param startTimeStampBoundary The start time stamp boundary.
@param query The query to use to construct the cache key.
@return The cache key.
"""
StringBuilder sb = new StringBuilder();
sb.append(startTimeStampBoundary).append(":");
sb.append(query.getNamespace()).append(":");
sb.append(query.getScope()).append(":");
sb.append(query.getMetric()).append(":");
// sort the tag key and values within each tag key alphabetically
Map<String, String> treeMap = new TreeMap<String, String>();
for (Map.Entry<String, String> tag : query.getTags().entrySet()) {
String[] tagValues = tag.getValue().split("\\|");
Arrays.sort(tagValues);
StringBuilder sbTag = new StringBuilder();
String separator = "";
for (String tagValue : tagValues) {
sbTag.append(separator);
separator = "|";
sbTag.append(tagValue);
}
treeMap.put(tag.getKey(), sbTag.toString());
}
sb.append(treeMap).append(":");
sb.append(query.getAggregator()).append(":");
sb.append(query.getDownsampler()).append(":");
sb.append(query.getDownsamplingPeriod());
return sb.toString();
} | java | private String constructMetricQueryKey(Long startTimeStampBoundary, MetricQuery query) {
StringBuilder sb = new StringBuilder();
sb.append(startTimeStampBoundary).append(":");
sb.append(query.getNamespace()).append(":");
sb.append(query.getScope()).append(":");
sb.append(query.getMetric()).append(":");
// sort the tag key and values within each tag key alphabetically
Map<String, String> treeMap = new TreeMap<String, String>();
for (Map.Entry<String, String> tag : query.getTags().entrySet()) {
String[] tagValues = tag.getValue().split("\\|");
Arrays.sort(tagValues);
StringBuilder sbTag = new StringBuilder();
String separator = "";
for (String tagValue : tagValues) {
sbTag.append(separator);
separator = "|";
sbTag.append(tagValue);
}
treeMap.put(tag.getKey(), sbTag.toString());
}
sb.append(treeMap).append(":");
sb.append(query.getAggregator()).append(":");
sb.append(query.getDownsampler()).append(":");
sb.append(query.getDownsamplingPeriod());
return sb.toString();
} | [
"private",
"String",
"constructMetricQueryKey",
"(",
"Long",
"startTimeStampBoundary",
",",
"MetricQuery",
"query",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"sb",
".",
"append",
"(",
"startTimeStampBoundary",
")",
".",
"append",
"(",
"\":\"",
")",
";",
"sb",
".",
"append",
"(",
"query",
".",
"getNamespace",
"(",
")",
")",
".",
"append",
"(",
"\":\"",
")",
";",
"sb",
".",
"append",
"(",
"query",
".",
"getScope",
"(",
")",
")",
".",
"append",
"(",
"\":\"",
")",
";",
"sb",
".",
"append",
"(",
"query",
".",
"getMetric",
"(",
")",
")",
".",
"append",
"(",
"\":\"",
")",
";",
"// sort the tag key and values within each tag key alphabetically",
"Map",
"<",
"String",
",",
"String",
">",
"treeMap",
"=",
"new",
"TreeMap",
"<",
"String",
",",
"String",
">",
"(",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"String",
">",
"tag",
":",
"query",
".",
"getTags",
"(",
")",
".",
"entrySet",
"(",
")",
")",
"{",
"String",
"[",
"]",
"tagValues",
"=",
"tag",
".",
"getValue",
"(",
")",
".",
"split",
"(",
"\"\\\\|\"",
")",
";",
"Arrays",
".",
"sort",
"(",
"tagValues",
")",
";",
"StringBuilder",
"sbTag",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"String",
"separator",
"=",
"\"\"",
";",
"for",
"(",
"String",
"tagValue",
":",
"tagValues",
")",
"{",
"sbTag",
".",
"append",
"(",
"separator",
")",
";",
"separator",
"=",
"\"|\"",
";",
"sbTag",
".",
"append",
"(",
"tagValue",
")",
";",
"}",
"treeMap",
".",
"put",
"(",
"tag",
".",
"getKey",
"(",
")",
",",
"sbTag",
".",
"toString",
"(",
")",
")",
";",
"}",
"sb",
".",
"append",
"(",
"treeMap",
")",
".",
"append",
"(",
"\":\"",
")",
";",
"sb",
".",
"append",
"(",
"query",
".",
"getAggregator",
"(",
")",
")",
".",
"append",
"(",
"\":\"",
")",
";",
"sb",
".",
"append",
"(",
"query",
".",
"getDownsampler",
"(",
")",
")",
".",
"append",
"(",
"\":\"",
")",
";",
"sb",
".",
"append",
"(",
"query",
".",
"getDownsamplingPeriod",
"(",
")",
")",
";",
"return",
"sb",
".",
"toString",
"(",
")",
";",
"}"
]
| Constructs a cache key from start time stamp boundary, and tags in metric query.
@param startTimeStampBoundary The start time stamp boundary.
@param query The query to use to construct the cache key.
@return The cache key. | [
"Constructs",
"a",
"cache",
"key",
"from",
"start",
"time",
"stamp",
"boundary",
"and",
"tags",
"in",
"metric",
"query",
"."
]
| train | https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusCore/src/main/java/com/salesforce/dva/argus/service/tsdb/CachedTSDBService.java#L306-L337 |
Domo42/saga-lib | saga-lib/src/main/java/com/codebullets/sagalib/processing/SagaExecutionTask.java | SagaExecutionTask.updateStateStorage | private void updateStateStorage(final SagaInstanceInfo description, final CurrentExecutionContext context) {
"""
Updates the state storage depending on whether the saga is completed or keeps on running.
"""
Saga saga = description.getSaga();
String sagaId = saga.state().getSagaId();
// if saga has finished delete existing state and possible timeouts
// if saga has just been created state has never been save and there
// is no need to delete it.
if (saga.isFinished() && !description.isStarting()) {
cleanupSagaSate(sagaId);
} else if (saga.isFinished() && description.isStarting()) {
// check storage on whether saga has been saved via
// a recursive child contexts.
if (context.hasBeenStored(sagaId)) {
cleanupSagaSate(sagaId);
}
}
if (!saga.isFinished()) {
context.recordSagaStateStored(sagaId);
env.storage().save(saga.state());
}
} | java | private void updateStateStorage(final SagaInstanceInfo description, final CurrentExecutionContext context) {
Saga saga = description.getSaga();
String sagaId = saga.state().getSagaId();
// if saga has finished delete existing state and possible timeouts
// if saga has just been created state has never been save and there
// is no need to delete it.
if (saga.isFinished() && !description.isStarting()) {
cleanupSagaSate(sagaId);
} else if (saga.isFinished() && description.isStarting()) {
// check storage on whether saga has been saved via
// a recursive child contexts.
if (context.hasBeenStored(sagaId)) {
cleanupSagaSate(sagaId);
}
}
if (!saga.isFinished()) {
context.recordSagaStateStored(sagaId);
env.storage().save(saga.state());
}
} | [
"private",
"void",
"updateStateStorage",
"(",
"final",
"SagaInstanceInfo",
"description",
",",
"final",
"CurrentExecutionContext",
"context",
")",
"{",
"Saga",
"saga",
"=",
"description",
".",
"getSaga",
"(",
")",
";",
"String",
"sagaId",
"=",
"saga",
".",
"state",
"(",
")",
".",
"getSagaId",
"(",
")",
";",
"// if saga has finished delete existing state and possible timeouts",
"// if saga has just been created state has never been save and there",
"// is no need to delete it.",
"if",
"(",
"saga",
".",
"isFinished",
"(",
")",
"&&",
"!",
"description",
".",
"isStarting",
"(",
")",
")",
"{",
"cleanupSagaSate",
"(",
"sagaId",
")",
";",
"}",
"else",
"if",
"(",
"saga",
".",
"isFinished",
"(",
")",
"&&",
"description",
".",
"isStarting",
"(",
")",
")",
"{",
"// check storage on whether saga has been saved via",
"// a recursive child contexts.",
"if",
"(",
"context",
".",
"hasBeenStored",
"(",
"sagaId",
")",
")",
"{",
"cleanupSagaSate",
"(",
"sagaId",
")",
";",
"}",
"}",
"if",
"(",
"!",
"saga",
".",
"isFinished",
"(",
")",
")",
"{",
"context",
".",
"recordSagaStateStored",
"(",
"sagaId",
")",
";",
"env",
".",
"storage",
"(",
")",
".",
"save",
"(",
"saga",
".",
"state",
"(",
")",
")",
";",
"}",
"}"
]
| Updates the state storage depending on whether the saga is completed or keeps on running. | [
"Updates",
"the",
"state",
"storage",
"depending",
"on",
"whether",
"the",
"saga",
"is",
"completed",
"or",
"keeps",
"on",
"running",
"."
]
| train | https://github.com/Domo42/saga-lib/blob/c8f232e2a51fcb6a3fe0082cfbf105c1e6bf90ef/saga-lib/src/main/java/com/codebullets/sagalib/processing/SagaExecutionTask.java#L201-L222 |
alkacon/opencms-core | src/org/opencms/ui/apps/scheduler/CmsJobTable.java | CmsJobTable.onItemClick | @SuppressWarnings("unchecked")
void onItemClick(MouseEvents.ClickEvent event, Object itemId, Object propertyId) {
"""
Handles the table item clicks, including clicks on images inside of a table item.<p>
@param event the click event
@param itemId of the clicked row
@param propertyId column id
"""
if (!event.isCtrlKey() && !event.isShiftKey()) {
changeValueIfNotMultiSelect(itemId);
// don't interfere with multi-selection using control key
if (event.getButton().equals(MouseButton.RIGHT) || (propertyId == null)) {
Set<String> jobIds = new HashSet<String>();
for (CmsJobBean job : (Set<CmsJobBean>)getValue()) {
jobIds.add(job.getJob().getId());
}
m_menu.setEntries(getMenuEntries(), jobIds);
m_menu.openForTable(event, itemId, propertyId, this);
} else if (event.getButton().equals(MouseButton.LEFT)
&& TableProperty.className.toString().equals(propertyId)) {
String jobId = ((Set<CmsJobBean>)getValue()).iterator().next().getJob().getId();
m_manager.defaultAction(jobId);
}
}
} | java | @SuppressWarnings("unchecked")
void onItemClick(MouseEvents.ClickEvent event, Object itemId, Object propertyId) {
if (!event.isCtrlKey() && !event.isShiftKey()) {
changeValueIfNotMultiSelect(itemId);
// don't interfere with multi-selection using control key
if (event.getButton().equals(MouseButton.RIGHT) || (propertyId == null)) {
Set<String> jobIds = new HashSet<String>();
for (CmsJobBean job : (Set<CmsJobBean>)getValue()) {
jobIds.add(job.getJob().getId());
}
m_menu.setEntries(getMenuEntries(), jobIds);
m_menu.openForTable(event, itemId, propertyId, this);
} else if (event.getButton().equals(MouseButton.LEFT)
&& TableProperty.className.toString().equals(propertyId)) {
String jobId = ((Set<CmsJobBean>)getValue()).iterator().next().getJob().getId();
m_manager.defaultAction(jobId);
}
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"void",
"onItemClick",
"(",
"MouseEvents",
".",
"ClickEvent",
"event",
",",
"Object",
"itemId",
",",
"Object",
"propertyId",
")",
"{",
"if",
"(",
"!",
"event",
".",
"isCtrlKey",
"(",
")",
"&&",
"!",
"event",
".",
"isShiftKey",
"(",
")",
")",
"{",
"changeValueIfNotMultiSelect",
"(",
"itemId",
")",
";",
"// don't interfere with multi-selection using control key",
"if",
"(",
"event",
".",
"getButton",
"(",
")",
".",
"equals",
"(",
"MouseButton",
".",
"RIGHT",
")",
"||",
"(",
"propertyId",
"==",
"null",
")",
")",
"{",
"Set",
"<",
"String",
">",
"jobIds",
"=",
"new",
"HashSet",
"<",
"String",
">",
"(",
")",
";",
"for",
"(",
"CmsJobBean",
"job",
":",
"(",
"Set",
"<",
"CmsJobBean",
">",
")",
"getValue",
"(",
")",
")",
"{",
"jobIds",
".",
"add",
"(",
"job",
".",
"getJob",
"(",
")",
".",
"getId",
"(",
")",
")",
";",
"}",
"m_menu",
".",
"setEntries",
"(",
"getMenuEntries",
"(",
")",
",",
"jobIds",
")",
";",
"m_menu",
".",
"openForTable",
"(",
"event",
",",
"itemId",
",",
"propertyId",
",",
"this",
")",
";",
"}",
"else",
"if",
"(",
"event",
".",
"getButton",
"(",
")",
".",
"equals",
"(",
"MouseButton",
".",
"LEFT",
")",
"&&",
"TableProperty",
".",
"className",
".",
"toString",
"(",
")",
".",
"equals",
"(",
"propertyId",
")",
")",
"{",
"String",
"jobId",
"=",
"(",
"(",
"Set",
"<",
"CmsJobBean",
">",
")",
"getValue",
"(",
")",
")",
".",
"iterator",
"(",
")",
".",
"next",
"(",
")",
".",
"getJob",
"(",
")",
".",
"getId",
"(",
")",
";",
"m_manager",
".",
"defaultAction",
"(",
"jobId",
")",
";",
"}",
"}",
"}"
]
| Handles the table item clicks, including clicks on images inside of a table item.<p>
@param event the click event
@param itemId of the clicked row
@param propertyId column id | [
"Handles",
"the",
"table",
"item",
"clicks",
"including",
"clicks",
"on",
"images",
"inside",
"of",
"a",
"table",
"item",
".",
"<p",
">"
]
| train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/scheduler/CmsJobTable.java#L646-L666 |
ocelotds/ocelot | ocelot-web/src/main/java/org/ocelotds/topic/topicAccess/TopicAccessManager.java | TopicAccessManager.checkAccessTopicFromJsTopicAccessControllers | boolean checkAccessTopicFromJsTopicAccessControllers(UserContext ctx, String topic, Iterable<JsTopicAccessController> controllers) throws IllegalAccessException {
"""
Check if specific access control is allowed from controllers
@param ctx
@param topic
@param controllers
@return true if at least one specific topicAccessControl exist
@throws IllegalAccessException
"""
logger.debug("Looking for accessController for topic '{}' from JsTopicAccessControllers", topic);
for (JsTopicAccessController jsTopicAccessController : controllers) {
if(checkAccessTopicFromController(ctx, topic, jsTopicAccessController)) {
return true;
}
}
return false;
} | java | boolean checkAccessTopicFromJsTopicAccessControllers(UserContext ctx, String topic, Iterable<JsTopicAccessController> controllers) throws IllegalAccessException {
logger.debug("Looking for accessController for topic '{}' from JsTopicAccessControllers", topic);
for (JsTopicAccessController jsTopicAccessController : controllers) {
if(checkAccessTopicFromController(ctx, topic, jsTopicAccessController)) {
return true;
}
}
return false;
} | [
"boolean",
"checkAccessTopicFromJsTopicAccessControllers",
"(",
"UserContext",
"ctx",
",",
"String",
"topic",
",",
"Iterable",
"<",
"JsTopicAccessController",
">",
"controllers",
")",
"throws",
"IllegalAccessException",
"{",
"logger",
".",
"debug",
"(",
"\"Looking for accessController for topic '{}' from JsTopicAccessControllers\"",
",",
"topic",
")",
";",
"for",
"(",
"JsTopicAccessController",
"jsTopicAccessController",
":",
"controllers",
")",
"{",
"if",
"(",
"checkAccessTopicFromController",
"(",
"ctx",
",",
"topic",
",",
"jsTopicAccessController",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}"
]
| Check if specific access control is allowed from controllers
@param ctx
@param topic
@param controllers
@return true if at least one specific topicAccessControl exist
@throws IllegalAccessException | [
"Check",
"if",
"specific",
"access",
"control",
"is",
"allowed",
"from",
"controllers"
]
| train | https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-web/src/main/java/org/ocelotds/topic/topicAccess/TopicAccessManager.java#L110-L118 |
google/closure-compiler | src/com/google/javascript/jscomp/JsIterables.java | JsIterables.createIterableTypeOf | static final JSType createIterableTypeOf(JSType elementType, JSTypeRegistry typeRegistry) {
"""
Returns an `Iterable` type templated on {@code elementType}.
<p>Example: `number' => `Iterable<number>`.
"""
return typeRegistry.createTemplatizedType(
typeRegistry.getNativeObjectType(ITERABLE_TYPE), elementType);
} | java | static final JSType createIterableTypeOf(JSType elementType, JSTypeRegistry typeRegistry) {
return typeRegistry.createTemplatizedType(
typeRegistry.getNativeObjectType(ITERABLE_TYPE), elementType);
} | [
"static",
"final",
"JSType",
"createIterableTypeOf",
"(",
"JSType",
"elementType",
",",
"JSTypeRegistry",
"typeRegistry",
")",
"{",
"return",
"typeRegistry",
".",
"createTemplatizedType",
"(",
"typeRegistry",
".",
"getNativeObjectType",
"(",
"ITERABLE_TYPE",
")",
",",
"elementType",
")",
";",
"}"
]
| Returns an `Iterable` type templated on {@code elementType}.
<p>Example: `number' => `Iterable<number>`. | [
"Returns",
"an",
"Iterable",
"type",
"templated",
"on",
"{",
"@code",
"elementType",
"}",
"."
]
| train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/JsIterables.java#L71-L74 |
lessthanoptimal/BoofCV | applications/src/main/java/boofcv/app/calib/ImageSelectorAndSaver.java | ImageSelectorAndSaver.updateScore | public synchronized void updateScore(GrayF32 image, List<Point2D_F64> sides) {
"""
Used when you just want to update the score for visualization purposes but not update the best image.
"""
removePerspective.apply(image,sides.get(0),sides.get(1),sides.get(2),sides.get(3));
GrayF32 current = removePerspective.getOutput();
float mean = (float)ImageStatistics.mean(current);
PixelMath.divide(current,mean,tempImage);
PixelMath.diffAbs(tempImage,template,difference);
PixelMath.multiply(difference,weights,difference);
// compute score as a weighted average of the difference
currentScore = ImageStatistics.sum(difference)/totalWeight;
} | java | public synchronized void updateScore(GrayF32 image, List<Point2D_F64> sides) {
removePerspective.apply(image,sides.get(0),sides.get(1),sides.get(2),sides.get(3));
GrayF32 current = removePerspective.getOutput();
float mean = (float)ImageStatistics.mean(current);
PixelMath.divide(current,mean,tempImage);
PixelMath.diffAbs(tempImage,template,difference);
PixelMath.multiply(difference,weights,difference);
// compute score as a weighted average of the difference
currentScore = ImageStatistics.sum(difference)/totalWeight;
} | [
"public",
"synchronized",
"void",
"updateScore",
"(",
"GrayF32",
"image",
",",
"List",
"<",
"Point2D_F64",
">",
"sides",
")",
"{",
"removePerspective",
".",
"apply",
"(",
"image",
",",
"sides",
".",
"get",
"(",
"0",
")",
",",
"sides",
".",
"get",
"(",
"1",
")",
",",
"sides",
".",
"get",
"(",
"2",
")",
",",
"sides",
".",
"get",
"(",
"3",
")",
")",
";",
"GrayF32",
"current",
"=",
"removePerspective",
".",
"getOutput",
"(",
")",
";",
"float",
"mean",
"=",
"(",
"float",
")",
"ImageStatistics",
".",
"mean",
"(",
"current",
")",
";",
"PixelMath",
".",
"divide",
"(",
"current",
",",
"mean",
",",
"tempImage",
")",
";",
"PixelMath",
".",
"diffAbs",
"(",
"tempImage",
",",
"template",
",",
"difference",
")",
";",
"PixelMath",
".",
"multiply",
"(",
"difference",
",",
"weights",
",",
"difference",
")",
";",
"// compute score as a weighted average of the difference",
"currentScore",
"=",
"ImageStatistics",
".",
"sum",
"(",
"difference",
")",
"/",
"totalWeight",
";",
"}"
]
| Used when you just want to update the score for visualization purposes but not update the best image. | [
"Used",
"when",
"you",
"just",
"want",
"to",
"update",
"the",
"score",
"for",
"visualization",
"purposes",
"but",
"not",
"update",
"the",
"best",
"image",
"."
]
| train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/applications/src/main/java/boofcv/app/calib/ImageSelectorAndSaver.java#L143-L155 |
fabric8io/fabric8-forge | addons/camel/src/main/java/io/fabric8/forge/camel/commands/project/helper/CamelCatalogHelper.java | CamelCatalogHelper.getModelJavaType | public static String getModelJavaType(CamelCatalog camelCatalog, String modelName) {
"""
Gets the java type of the given model
@param modelName the model name
@return the java type
"""
// use the camel catalog
String json = camelCatalog.modelJSonSchema(modelName);
if (json == null) {
throw new IllegalArgumentException("Could not find catalog entry for model name: " + modelName);
}
List<Map<String, String>> data = JSonSchemaHelper.parseJsonSchema("model", json, false);
if (data != null) {
for (Map<String, String> propertyMap : data) {
String javaType = propertyMap.get("javaType");
if (javaType != null) {
return javaType;
}
}
}
return null;
} | java | public static String getModelJavaType(CamelCatalog camelCatalog, String modelName) {
// use the camel catalog
String json = camelCatalog.modelJSonSchema(modelName);
if (json == null) {
throw new IllegalArgumentException("Could not find catalog entry for model name: " + modelName);
}
List<Map<String, String>> data = JSonSchemaHelper.parseJsonSchema("model", json, false);
if (data != null) {
for (Map<String, String> propertyMap : data) {
String javaType = propertyMap.get("javaType");
if (javaType != null) {
return javaType;
}
}
}
return null;
} | [
"public",
"static",
"String",
"getModelJavaType",
"(",
"CamelCatalog",
"camelCatalog",
",",
"String",
"modelName",
")",
"{",
"// use the camel catalog",
"String",
"json",
"=",
"camelCatalog",
".",
"modelJSonSchema",
"(",
"modelName",
")",
";",
"if",
"(",
"json",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Could not find catalog entry for model name: \"",
"+",
"modelName",
")",
";",
"}",
"List",
"<",
"Map",
"<",
"String",
",",
"String",
">",
">",
"data",
"=",
"JSonSchemaHelper",
".",
"parseJsonSchema",
"(",
"\"model\"",
",",
"json",
",",
"false",
")",
";",
"if",
"(",
"data",
"!=",
"null",
")",
"{",
"for",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"propertyMap",
":",
"data",
")",
"{",
"String",
"javaType",
"=",
"propertyMap",
".",
"get",
"(",
"\"javaType\"",
")",
";",
"if",
"(",
"javaType",
"!=",
"null",
")",
"{",
"return",
"javaType",
";",
"}",
"}",
"}",
"return",
"null",
";",
"}"
]
| Gets the java type of the given model
@param modelName the model name
@return the java type | [
"Gets",
"the",
"java",
"type",
"of",
"the",
"given",
"model"
]
| train | https://github.com/fabric8io/fabric8-forge/blob/a59871bae4d5c5d3ece10f1e8758e73663087f19/addons/camel/src/main/java/io/fabric8/forge/camel/commands/project/helper/CamelCatalogHelper.java#L404-L421 |
lessthanoptimal/ddogleg | src/org/ddogleg/optimization/FactoryOptimization.java | FactoryOptimization.doglegSchur | public static UnconstrainedLeastSquaresSchur<DMatrixRMaj> doglegSchur(boolean robust, @Nullable ConfigTrustRegion config ) {
"""
Creates a sparse Schur Complement trust region optimization using dogleg steps.
@see UnconLeastSqTrustRegionSchur_F64
@param config Trust region configuration
@return The new optimization routine
"""
if( config == null )
config = new ConfigTrustRegion();
HessianSchurComplement_DDRM hessian;
if( robust ) {
LinearSolverDense<DMatrixRMaj> solverA = LinearSolverFactory_DDRM.pseudoInverse(true);
LinearSolverDense<DMatrixRMaj> solverD = LinearSolverFactory_DDRM.pseudoInverse(true);
hessian = new HessianSchurComplement_DDRM(solverA,solverD);
} else {
// defaults to cholesky
hessian = new HessianSchurComplement_DDRM();
}
TrustRegionUpdateDogleg_F64<DMatrixRMaj> update = new TrustRegionUpdateDogleg_F64<>();
UnconLeastSqTrustRegionSchur_F64<DMatrixRMaj> alg = new UnconLeastSqTrustRegionSchur_F64<>(update,hessian);
alg.configure(config);
return alg;
} | java | public static UnconstrainedLeastSquaresSchur<DMatrixRMaj> doglegSchur(boolean robust, @Nullable ConfigTrustRegion config ) {
if( config == null )
config = new ConfigTrustRegion();
HessianSchurComplement_DDRM hessian;
if( robust ) {
LinearSolverDense<DMatrixRMaj> solverA = LinearSolverFactory_DDRM.pseudoInverse(true);
LinearSolverDense<DMatrixRMaj> solverD = LinearSolverFactory_DDRM.pseudoInverse(true);
hessian = new HessianSchurComplement_DDRM(solverA,solverD);
} else {
// defaults to cholesky
hessian = new HessianSchurComplement_DDRM();
}
TrustRegionUpdateDogleg_F64<DMatrixRMaj> update = new TrustRegionUpdateDogleg_F64<>();
UnconLeastSqTrustRegionSchur_F64<DMatrixRMaj> alg = new UnconLeastSqTrustRegionSchur_F64<>(update,hessian);
alg.configure(config);
return alg;
} | [
"public",
"static",
"UnconstrainedLeastSquaresSchur",
"<",
"DMatrixRMaj",
">",
"doglegSchur",
"(",
"boolean",
"robust",
",",
"@",
"Nullable",
"ConfigTrustRegion",
"config",
")",
"{",
"if",
"(",
"config",
"==",
"null",
")",
"config",
"=",
"new",
"ConfigTrustRegion",
"(",
")",
";",
"HessianSchurComplement_DDRM",
"hessian",
";",
"if",
"(",
"robust",
")",
"{",
"LinearSolverDense",
"<",
"DMatrixRMaj",
">",
"solverA",
"=",
"LinearSolverFactory_DDRM",
".",
"pseudoInverse",
"(",
"true",
")",
";",
"LinearSolverDense",
"<",
"DMatrixRMaj",
">",
"solverD",
"=",
"LinearSolverFactory_DDRM",
".",
"pseudoInverse",
"(",
"true",
")",
";",
"hessian",
"=",
"new",
"HessianSchurComplement_DDRM",
"(",
"solverA",
",",
"solverD",
")",
";",
"}",
"else",
"{",
"// defaults to cholesky",
"hessian",
"=",
"new",
"HessianSchurComplement_DDRM",
"(",
")",
";",
"}",
"TrustRegionUpdateDogleg_F64",
"<",
"DMatrixRMaj",
">",
"update",
"=",
"new",
"TrustRegionUpdateDogleg_F64",
"<>",
"(",
")",
";",
"UnconLeastSqTrustRegionSchur_F64",
"<",
"DMatrixRMaj",
">",
"alg",
"=",
"new",
"UnconLeastSqTrustRegionSchur_F64",
"<>",
"(",
"update",
",",
"hessian",
")",
";",
"alg",
".",
"configure",
"(",
"config",
")",
";",
"return",
"alg",
";",
"}"
]
| Creates a sparse Schur Complement trust region optimization using dogleg steps.
@see UnconLeastSqTrustRegionSchur_F64
@param config Trust region configuration
@return The new optimization routine | [
"Creates",
"a",
"sparse",
"Schur",
"Complement",
"trust",
"region",
"optimization",
"using",
"dogleg",
"steps",
"."
]
| train | https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/optimization/FactoryOptimization.java#L54-L72 |
biojava/biojava | biojava-genome/src/main/java/org/biojava/nbio/genome/GeneFeatureHelper.java | GeneFeatureHelper.outputFastaSequenceLengthGFF3 | static public void outputFastaSequenceLengthGFF3(File fastaSequenceFile, File gffFile) throws Exception {
"""
Output a gff3 feature file that will give the length of each scaffold/chromosome in the fasta file.
Used for gbrowse so it knows length.
@param fastaSequenceFile
@param gffFile
@throws Exception
"""
LinkedHashMap<String, DNASequence> dnaSequenceList = FastaReaderHelper.readFastaDNASequence(fastaSequenceFile);
String fileName = fastaSequenceFile.getName();
FileWriter fw = new FileWriter(gffFile);
String newLine = System.getProperty("line.separator");
fw.write("##gff-version 3" + newLine);
for (DNASequence dnaSequence : dnaSequenceList.values()) {
String gff3line = dnaSequence.getAccession().getID() + "\t" + fileName + "\t" + "contig" + "\t" + "1" + "\t" + dnaSequence.getBioEnd() + "\t.\t.\t.\tName=" + dnaSequence.getAccession().getID() + newLine;
fw.write(gff3line);
}
fw.close();
} | java | static public void outputFastaSequenceLengthGFF3(File fastaSequenceFile, File gffFile) throws Exception {
LinkedHashMap<String, DNASequence> dnaSequenceList = FastaReaderHelper.readFastaDNASequence(fastaSequenceFile);
String fileName = fastaSequenceFile.getName();
FileWriter fw = new FileWriter(gffFile);
String newLine = System.getProperty("line.separator");
fw.write("##gff-version 3" + newLine);
for (DNASequence dnaSequence : dnaSequenceList.values()) {
String gff3line = dnaSequence.getAccession().getID() + "\t" + fileName + "\t" + "contig" + "\t" + "1" + "\t" + dnaSequence.getBioEnd() + "\t.\t.\t.\tName=" + dnaSequence.getAccession().getID() + newLine;
fw.write(gff3line);
}
fw.close();
} | [
"static",
"public",
"void",
"outputFastaSequenceLengthGFF3",
"(",
"File",
"fastaSequenceFile",
",",
"File",
"gffFile",
")",
"throws",
"Exception",
"{",
"LinkedHashMap",
"<",
"String",
",",
"DNASequence",
">",
"dnaSequenceList",
"=",
"FastaReaderHelper",
".",
"readFastaDNASequence",
"(",
"fastaSequenceFile",
")",
";",
"String",
"fileName",
"=",
"fastaSequenceFile",
".",
"getName",
"(",
")",
";",
"FileWriter",
"fw",
"=",
"new",
"FileWriter",
"(",
"gffFile",
")",
";",
"String",
"newLine",
"=",
"System",
".",
"getProperty",
"(",
"\"line.separator\"",
")",
";",
"fw",
".",
"write",
"(",
"\"##gff-version 3\"",
"+",
"newLine",
")",
";",
"for",
"(",
"DNASequence",
"dnaSequence",
":",
"dnaSequenceList",
".",
"values",
"(",
")",
")",
"{",
"String",
"gff3line",
"=",
"dnaSequence",
".",
"getAccession",
"(",
")",
".",
"getID",
"(",
")",
"+",
"\"\\t\"",
"+",
"fileName",
"+",
"\"\\t\"",
"+",
"\"contig\"",
"+",
"\"\\t\"",
"+",
"\"1\"",
"+",
"\"\\t\"",
"+",
"dnaSequence",
".",
"getBioEnd",
"(",
")",
"+",
"\"\\t.\\t.\\t.\\tName=\"",
"+",
"dnaSequence",
".",
"getAccession",
"(",
")",
".",
"getID",
"(",
")",
"+",
"newLine",
";",
"fw",
".",
"write",
"(",
"gff3line",
")",
";",
"}",
"fw",
".",
"close",
"(",
")",
";",
"}"
]
| Output a gff3 feature file that will give the length of each scaffold/chromosome in the fasta file.
Used for gbrowse so it knows length.
@param fastaSequenceFile
@param gffFile
@throws Exception | [
"Output",
"a",
"gff3",
"feature",
"file",
"that",
"will",
"give",
"the",
"length",
"of",
"each",
"scaffold",
"/",
"chromosome",
"in",
"the",
"fasta",
"file",
".",
"Used",
"for",
"gbrowse",
"so",
"it",
"knows",
"length",
"."
]
| train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-genome/src/main/java/org/biojava/nbio/genome/GeneFeatureHelper.java#L164-L175 |
primefaces/primefaces | src/main/java/org/primefaces/expression/SearchExpressionFacade.java | SearchExpressionFacade.resolveClientIds | public static String resolveClientIds(FacesContext context, UIComponent source, String expressions) {
"""
Resolves a list of {@link UIComponent} clientIds and/or passtrough expressions for the given expression or expressions.
@param context The {@link FacesContext}.
@param source The source component. E.g. a button.
@param expressions The search expressions.
@return A {@link List} with resolved clientIds and/or passtrough expression (like PFS, widgetVar).
"""
return resolveClientIds(context, source, expressions, SearchExpressionHint.NONE);
} | java | public static String resolveClientIds(FacesContext context, UIComponent source, String expressions) {
return resolveClientIds(context, source, expressions, SearchExpressionHint.NONE);
} | [
"public",
"static",
"String",
"resolveClientIds",
"(",
"FacesContext",
"context",
",",
"UIComponent",
"source",
",",
"String",
"expressions",
")",
"{",
"return",
"resolveClientIds",
"(",
"context",
",",
"source",
",",
"expressions",
",",
"SearchExpressionHint",
".",
"NONE",
")",
";",
"}"
]
| Resolves a list of {@link UIComponent} clientIds and/or passtrough expressions for the given expression or expressions.
@param context The {@link FacesContext}.
@param source The source component. E.g. a button.
@param expressions The search expressions.
@return A {@link List} with resolved clientIds and/or passtrough expression (like PFS, widgetVar). | [
"Resolves",
"a",
"list",
"of",
"{",
"@link",
"UIComponent",
"}",
"clientIds",
"and",
"/",
"or",
"passtrough",
"expressions",
"for",
"the",
"given",
"expression",
"or",
"expressions",
"."
]
| train | https://github.com/primefaces/primefaces/blob/b8cdd5ed395d09826e40e3302d6b14901d3ef4e7/src/main/java/org/primefaces/expression/SearchExpressionFacade.java#L152-L155 |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/document/json/JsonObject.java | JsonObject.getAndDecryptLong | public Long getAndDecryptLong(String name, String providerName) throws Exception {
"""
Retrieves the decrypted value from the field name and casts it to {@link Long}.
Note that if value was stored as another numerical type, some truncation or rounding may occur.
Note: Use of the Field Level Encryption functionality provided in the
com.couchbase.client.encryption namespace provided by Couchbase is
subject to the Couchbase Inc. Enterprise Subscription License Agreement
at https://www.couchbase.com/ESLA-11132015.
@param name the name of the field.
@param providerName the crypto provider name for decryption
@return the result or null if it does not exist.
"""
//let it fail in the more general case where it isn't actually a number
Number number = (Number) getAndDecrypt(name, providerName);
if (number == null) {
return null;
} else if (number instanceof Long) {
return (Long) number;
} else {
return number.longValue(); //autoboxing to Long
}
} | java | public Long getAndDecryptLong(String name, String providerName) throws Exception {
//let it fail in the more general case where it isn't actually a number
Number number = (Number) getAndDecrypt(name, providerName);
if (number == null) {
return null;
} else if (number instanceof Long) {
return (Long) number;
} else {
return number.longValue(); //autoboxing to Long
}
} | [
"public",
"Long",
"getAndDecryptLong",
"(",
"String",
"name",
",",
"String",
"providerName",
")",
"throws",
"Exception",
"{",
"//let it fail in the more general case where it isn't actually a number",
"Number",
"number",
"=",
"(",
"Number",
")",
"getAndDecrypt",
"(",
"name",
",",
"providerName",
")",
";",
"if",
"(",
"number",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"else",
"if",
"(",
"number",
"instanceof",
"Long",
")",
"{",
"return",
"(",
"Long",
")",
"number",
";",
"}",
"else",
"{",
"return",
"number",
".",
"longValue",
"(",
")",
";",
"//autoboxing to Long",
"}",
"}"
]
| Retrieves the decrypted value from the field name and casts it to {@link Long}.
Note that if value was stored as another numerical type, some truncation or rounding may occur.
Note: Use of the Field Level Encryption functionality provided in the
com.couchbase.client.encryption namespace provided by Couchbase is
subject to the Couchbase Inc. Enterprise Subscription License Agreement
at https://www.couchbase.com/ESLA-11132015.
@param name the name of the field.
@param providerName the crypto provider name for decryption
@return the result or null if it does not exist. | [
"Retrieves",
"the",
"decrypted",
"value",
"from",
"the",
"field",
"name",
"and",
"casts",
"it",
"to",
"{",
"@link",
"Long",
"}",
"."
]
| train | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/document/json/JsonObject.java#L522-L532 |
coursera/courier | generator-api/src/main/java/org/coursera/courier/api/ClassTemplateSpecs.java | ClassTemplateSpecs.findAllReferencedTypes | private static Set<ClassTemplateSpec> findAllReferencedTypes(
Set<ClassTemplateSpec> current,
Set<ClassTemplateSpec> visited,
Set<ClassTemplateSpec> acc) {
"""
traverses the directReferencedTypes graph, keeping track of already visited ClassTemplateSpecs
"""
//val nextUnvisited = current.flatMap(_.directReferencedTypes).filterNot(visited.contains);
Set<ClassTemplateSpec> nextUnvisited = new HashSet<ClassTemplateSpec>();
for (ClassTemplateSpec currentSpec: current) {
for (ClassTemplateSpec maybeNext: directReferencedTypes(currentSpec)) {
if (!visited.contains(maybeNext)) {
nextUnvisited.add(maybeNext);
}
}
}
Set<ClassTemplateSpec> accAndCurrent = new HashSet<ClassTemplateSpec>(acc);
accAndCurrent.addAll(current);
if (nextUnvisited.size() > 0) {
Set<ClassTemplateSpec> currentAndVisited = new HashSet<ClassTemplateSpec>(current);
currentAndVisited.addAll(visited);
return findAllReferencedTypes(nextUnvisited, currentAndVisited, accAndCurrent);
} else {
return accAndCurrent;
}
} | java | private static Set<ClassTemplateSpec> findAllReferencedTypes(
Set<ClassTemplateSpec> current,
Set<ClassTemplateSpec> visited,
Set<ClassTemplateSpec> acc) {
//val nextUnvisited = current.flatMap(_.directReferencedTypes).filterNot(visited.contains);
Set<ClassTemplateSpec> nextUnvisited = new HashSet<ClassTemplateSpec>();
for (ClassTemplateSpec currentSpec: current) {
for (ClassTemplateSpec maybeNext: directReferencedTypes(currentSpec)) {
if (!visited.contains(maybeNext)) {
nextUnvisited.add(maybeNext);
}
}
}
Set<ClassTemplateSpec> accAndCurrent = new HashSet<ClassTemplateSpec>(acc);
accAndCurrent.addAll(current);
if (nextUnvisited.size() > 0) {
Set<ClassTemplateSpec> currentAndVisited = new HashSet<ClassTemplateSpec>(current);
currentAndVisited.addAll(visited);
return findAllReferencedTypes(nextUnvisited, currentAndVisited, accAndCurrent);
} else {
return accAndCurrent;
}
} | [
"private",
"static",
"Set",
"<",
"ClassTemplateSpec",
">",
"findAllReferencedTypes",
"(",
"Set",
"<",
"ClassTemplateSpec",
">",
"current",
",",
"Set",
"<",
"ClassTemplateSpec",
">",
"visited",
",",
"Set",
"<",
"ClassTemplateSpec",
">",
"acc",
")",
"{",
"//val nextUnvisited = current.flatMap(_.directReferencedTypes).filterNot(visited.contains);",
"Set",
"<",
"ClassTemplateSpec",
">",
"nextUnvisited",
"=",
"new",
"HashSet",
"<",
"ClassTemplateSpec",
">",
"(",
")",
";",
"for",
"(",
"ClassTemplateSpec",
"currentSpec",
":",
"current",
")",
"{",
"for",
"(",
"ClassTemplateSpec",
"maybeNext",
":",
"directReferencedTypes",
"(",
"currentSpec",
")",
")",
"{",
"if",
"(",
"!",
"visited",
".",
"contains",
"(",
"maybeNext",
")",
")",
"{",
"nextUnvisited",
".",
"add",
"(",
"maybeNext",
")",
";",
"}",
"}",
"}",
"Set",
"<",
"ClassTemplateSpec",
">",
"accAndCurrent",
"=",
"new",
"HashSet",
"<",
"ClassTemplateSpec",
">",
"(",
"acc",
")",
";",
"accAndCurrent",
".",
"addAll",
"(",
"current",
")",
";",
"if",
"(",
"nextUnvisited",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"Set",
"<",
"ClassTemplateSpec",
">",
"currentAndVisited",
"=",
"new",
"HashSet",
"<",
"ClassTemplateSpec",
">",
"(",
"current",
")",
";",
"currentAndVisited",
".",
"addAll",
"(",
"visited",
")",
";",
"return",
"findAllReferencedTypes",
"(",
"nextUnvisited",
",",
"currentAndVisited",
",",
"accAndCurrent",
")",
";",
"}",
"else",
"{",
"return",
"accAndCurrent",
";",
"}",
"}"
]
| traverses the directReferencedTypes graph, keeping track of already visited ClassTemplateSpecs | [
"traverses",
"the",
"directReferencedTypes",
"graph",
"keeping",
"track",
"of",
"already",
"visited",
"ClassTemplateSpecs"
]
| train | https://github.com/coursera/courier/blob/749674fa7ee33804ad11b6c8ecb560f455cb4c22/generator-api/src/main/java/org/coursera/courier/api/ClassTemplateSpecs.java#L121-L147 |
openwms/org.openwms | org.openwms.core.util/src/main/java/org/openwms/core/aop/FireAfterTransactionAspect.java | FireAfterTransactionAspect.fireEvent | public void fireEvent(Object publisher, FireAfterTransaction events) throws RuntimeException {
"""
Only {@link ApplicationEvent}s are created and published over Springs
{@link ApplicationContext}.
@param publisher The instance that is publishing the event
@param events A list of event classes to fire
@throws RuntimeException Any exception is re-thrown
"""
try {
for (int i = 0; i < events.events().length; i++) {
Class<? extends EventObject> event = events.events()[i];
if (ApplicationEvent.class.isAssignableFrom(event)) {
ctx.publishEvent((ApplicationEvent) event.getConstructor(Object.class).newInstance(publisher));
}
}
} catch (Exception e) {
throw new RuntimeException(e);
}
} | java | public void fireEvent(Object publisher, FireAfterTransaction events) throws RuntimeException {
try {
for (int i = 0; i < events.events().length; i++) {
Class<? extends EventObject> event = events.events()[i];
if (ApplicationEvent.class.isAssignableFrom(event)) {
ctx.publishEvent((ApplicationEvent) event.getConstructor(Object.class).newInstance(publisher));
}
}
} catch (Exception e) {
throw new RuntimeException(e);
}
} | [
"public",
"void",
"fireEvent",
"(",
"Object",
"publisher",
",",
"FireAfterTransaction",
"events",
")",
"throws",
"RuntimeException",
"{",
"try",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"events",
".",
"events",
"(",
")",
".",
"length",
";",
"i",
"++",
")",
"{",
"Class",
"<",
"?",
"extends",
"EventObject",
">",
"event",
"=",
"events",
".",
"events",
"(",
")",
"[",
"i",
"]",
";",
"if",
"(",
"ApplicationEvent",
".",
"class",
".",
"isAssignableFrom",
"(",
"event",
")",
")",
"{",
"ctx",
".",
"publishEvent",
"(",
"(",
"ApplicationEvent",
")",
"event",
".",
"getConstructor",
"(",
"Object",
".",
"class",
")",
".",
"newInstance",
"(",
"publisher",
")",
")",
";",
"}",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"e",
")",
";",
"}",
"}"
]
| Only {@link ApplicationEvent}s are created and published over Springs
{@link ApplicationContext}.
@param publisher The instance that is publishing the event
@param events A list of event classes to fire
@throws RuntimeException Any exception is re-thrown | [
"Only",
"{",
"@link",
"ApplicationEvent",
"}",
"s",
"are",
"created",
"and",
"published",
"over",
"Springs",
"{",
"@link",
"ApplicationContext",
"}",
"."
]
| train | https://github.com/openwms/org.openwms/blob/b24a95c5d09a7ec3c723d7e107d1cb0039d06a7e/org.openwms.core.util/src/main/java/org/openwms/core/aop/FireAfterTransactionAspect.java#L73-L84 |
igniterealtime/Smack | smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoManager.java | OmemoManager.serverSupportsOmemo | public static boolean serverSupportsOmemo(XMPPConnection connection, DomainBareJid server)
throws XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException,
SmackException.NoResponseException {
"""
Returns true, if the Server supports PEP.
@param connection XMPPConnection
@param server domainBareJid of the server to test
@return true if server supports pep
@throws XMPPException.XMPPErrorException
@throws SmackException.NotConnectedException
@throws InterruptedException
@throws SmackException.NoResponseException
"""
return ServiceDiscoveryManager.getInstanceFor(connection)
.discoverInfo(server).containsFeature(PubSub.NAMESPACE);
} | java | public static boolean serverSupportsOmemo(XMPPConnection connection, DomainBareJid server)
throws XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException,
SmackException.NoResponseException {
return ServiceDiscoveryManager.getInstanceFor(connection)
.discoverInfo(server).containsFeature(PubSub.NAMESPACE);
} | [
"public",
"static",
"boolean",
"serverSupportsOmemo",
"(",
"XMPPConnection",
"connection",
",",
"DomainBareJid",
"server",
")",
"throws",
"XMPPException",
".",
"XMPPErrorException",
",",
"SmackException",
".",
"NotConnectedException",
",",
"InterruptedException",
",",
"SmackException",
".",
"NoResponseException",
"{",
"return",
"ServiceDiscoveryManager",
".",
"getInstanceFor",
"(",
"connection",
")",
".",
"discoverInfo",
"(",
"server",
")",
".",
"containsFeature",
"(",
"PubSub",
".",
"NAMESPACE",
")",
";",
"}"
]
| Returns true, if the Server supports PEP.
@param connection XMPPConnection
@param server domainBareJid of the server to test
@return true if server supports pep
@throws XMPPException.XMPPErrorException
@throws SmackException.NotConnectedException
@throws InterruptedException
@throws SmackException.NoResponseException | [
"Returns",
"true",
"if",
"the",
"Server",
"supports",
"PEP",
"."
]
| train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoManager.java#L558-L563 |
lettuce-io/lettuce-core | src/main/java/io/lettuce/core/masterslave/MasterSlaveUtils.java | MasterSlaveUtils.isChanged | static boolean isChanged(Collection<RedisNodeDescription> o1, Collection<RedisNodeDescription> o2) {
"""
Check if properties changed.
@param o1 the first object to be compared.
@param o2 the second object to be compared.
@return {@literal true} if {@code MASTER} or {@code SLAVE} flags changed or the URIs are changed.
"""
if (o1.size() != o2.size()) {
return true;
}
for (RedisNodeDescription base : o2) {
if (!essentiallyEqualsTo(base, findNodeByUri(o1, base.getUri()))) {
return true;
}
}
return false;
} | java | static boolean isChanged(Collection<RedisNodeDescription> o1, Collection<RedisNodeDescription> o2) {
if (o1.size() != o2.size()) {
return true;
}
for (RedisNodeDescription base : o2) {
if (!essentiallyEqualsTo(base, findNodeByUri(o1, base.getUri()))) {
return true;
}
}
return false;
} | [
"static",
"boolean",
"isChanged",
"(",
"Collection",
"<",
"RedisNodeDescription",
">",
"o1",
",",
"Collection",
"<",
"RedisNodeDescription",
">",
"o2",
")",
"{",
"if",
"(",
"o1",
".",
"size",
"(",
")",
"!=",
"o2",
".",
"size",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"for",
"(",
"RedisNodeDescription",
"base",
":",
"o2",
")",
"{",
"if",
"(",
"!",
"essentiallyEqualsTo",
"(",
"base",
",",
"findNodeByUri",
"(",
"o1",
",",
"base",
".",
"getUri",
"(",
")",
")",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}"
]
| Check if properties changed.
@param o1 the first object to be compared.
@param o2 the second object to be compared.
@return {@literal true} if {@code MASTER} or {@code SLAVE} flags changed or the URIs are changed. | [
"Check",
"if",
"properties",
"changed",
"."
]
| train | https://github.com/lettuce-io/lettuce-core/blob/b6de74e384dea112e3656684ca3f50cdfd6c8e0d/src/main/java/io/lettuce/core/masterslave/MasterSlaveUtils.java#L38-L51 |
kaazing/java.client | amqp-0-9-1/amqp/src/main/java/org/kaazing/net/ws/amqp/AmqpChannel.java | AmqpChannel.deleteQueue | public AmqpChannel deleteQueue(String queue, boolean ifUnused, boolean ifEmpty, boolean noWait) {
"""
This method deletes a queue. When a queue is deleted any pending messages are sent to a dead-letter queue if this is defined in the server configuration,
and all consumers on the queue are canceled.
@param queue
@param ifUnused
@param ifEmpty
@param noWait
@return AmqpChannel
"""
Object[] args = {0, queue, ifUnused, ifEmpty, noWait};
WrappedByteBuffer bodyArg = null;
HashMap<String, Object> headersArg = null;
String methodName = "deleteQueue";
String methodId = "50" + "40";
AmqpMethod amqpMethod = MethodLookup.LookupMethod(methodId);
Object[] arguments = {this, amqpMethod, this.id, args, bodyArg, headersArg};
boolean hasnowait = false;
for (int i = 0; i < amqpMethod.allParameters.size(); i++) {
String argname = amqpMethod.allParameters.get(i).name;
if (argname == "noWait") {
hasnowait = true;
break;
}
}
asyncClient.enqueueAction(methodName, "channelWrite", arguments, null, null);
if (hasnowait && noWait) {
asyncClient.enqueueAction("nowait", null, null, null, null);
}
return this;
} | java | public AmqpChannel deleteQueue(String queue, boolean ifUnused, boolean ifEmpty, boolean noWait) {
Object[] args = {0, queue, ifUnused, ifEmpty, noWait};
WrappedByteBuffer bodyArg = null;
HashMap<String, Object> headersArg = null;
String methodName = "deleteQueue";
String methodId = "50" + "40";
AmqpMethod amqpMethod = MethodLookup.LookupMethod(methodId);
Object[] arguments = {this, amqpMethod, this.id, args, bodyArg, headersArg};
boolean hasnowait = false;
for (int i = 0; i < amqpMethod.allParameters.size(); i++) {
String argname = amqpMethod.allParameters.get(i).name;
if (argname == "noWait") {
hasnowait = true;
break;
}
}
asyncClient.enqueueAction(methodName, "channelWrite", arguments, null, null);
if (hasnowait && noWait) {
asyncClient.enqueueAction("nowait", null, null, null, null);
}
return this;
} | [
"public",
"AmqpChannel",
"deleteQueue",
"(",
"String",
"queue",
",",
"boolean",
"ifUnused",
",",
"boolean",
"ifEmpty",
",",
"boolean",
"noWait",
")",
"{",
"Object",
"[",
"]",
"args",
"=",
"{",
"0",
",",
"queue",
",",
"ifUnused",
",",
"ifEmpty",
",",
"noWait",
"}",
";",
"WrappedByteBuffer",
"bodyArg",
"=",
"null",
";",
"HashMap",
"<",
"String",
",",
"Object",
">",
"headersArg",
"=",
"null",
";",
"String",
"methodName",
"=",
"\"deleteQueue\"",
";",
"String",
"methodId",
"=",
"\"50\"",
"+",
"\"40\"",
";",
"AmqpMethod",
"amqpMethod",
"=",
"MethodLookup",
".",
"LookupMethod",
"(",
"methodId",
")",
";",
"Object",
"[",
"]",
"arguments",
"=",
"{",
"this",
",",
"amqpMethod",
",",
"this",
".",
"id",
",",
"args",
",",
"bodyArg",
",",
"headersArg",
"}",
";",
"boolean",
"hasnowait",
"=",
"false",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"amqpMethod",
".",
"allParameters",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"String",
"argname",
"=",
"amqpMethod",
".",
"allParameters",
".",
"get",
"(",
"i",
")",
".",
"name",
";",
"if",
"(",
"argname",
"==",
"\"noWait\"",
")",
"{",
"hasnowait",
"=",
"true",
";",
"break",
";",
"}",
"}",
"asyncClient",
".",
"enqueueAction",
"(",
"methodName",
",",
"\"channelWrite\"",
",",
"arguments",
",",
"null",
",",
"null",
")",
";",
"if",
"(",
"hasnowait",
"&&",
"noWait",
")",
"{",
"asyncClient",
".",
"enqueueAction",
"(",
"\"nowait\"",
",",
"null",
",",
"null",
",",
"null",
",",
"null",
")",
";",
"}",
"return",
"this",
";",
"}"
]
| This method deletes a queue. When a queue is deleted any pending messages are sent to a dead-letter queue if this is defined in the server configuration,
and all consumers on the queue are canceled.
@param queue
@param ifUnused
@param ifEmpty
@param noWait
@return AmqpChannel | [
"This",
"method",
"deletes",
"a",
"queue",
".",
"When",
"a",
"queue",
"is",
"deleted",
"any",
"pending",
"messages",
"are",
"sent",
"to",
"a",
"dead",
"-",
"letter",
"queue",
"if",
"this",
"is",
"defined",
"in",
"the",
"server",
"configuration",
"and",
"all",
"consumers",
"on",
"the",
"queue",
"are",
"canceled",
"."
]
| train | https://github.com/kaazing/java.client/blob/25ad2ae5bb24aa9d6b79400fce649b518dcfbe26/amqp-0-9-1/amqp/src/main/java/org/kaazing/net/ws/amqp/AmqpChannel.java#L563-L589 |
gosu-lang/gosu-lang | gosu-core/src/main/java/gw/internal/gosu/ir/transform/util/RequiresReflectionDeterminer.java | RequiresReflectionDeterminer.isGosuClassAccessingProtectedOrInternalMethodOfClassInDifferentClassloader | private static boolean isGosuClassAccessingProtectedOrInternalMethodOfClassInDifferentClassloader( ICompilableTypeInternal callingClass, IType declaringClass, IRelativeTypeInfo.Accessibility accessibility ) {
"""
Java will blow up if the package-level access is relied upon across class loaders, though, so we make the call reflectively.
"""
return (accessibility != IRelativeTypeInfo.Accessibility.PUBLIC ||
AccessibilityUtil.forType( declaringClass ) == IRelativeTypeInfo.Accessibility.INTERNAL ||
AccessibilityUtil.forType( declaringClass ) == IRelativeTypeInfo.Accessibility.PRIVATE)
&& getTopLevelNamespace( callingClass ).equals( getTopLevelNamespace( declaringClass ) )
&& (isInSeparateClassLoader( callingClass, declaringClass ) ||
classesLoadInSeparateLoader( callingClass, declaringClass ));
} | java | private static boolean isGosuClassAccessingProtectedOrInternalMethodOfClassInDifferentClassloader( ICompilableTypeInternal callingClass, IType declaringClass, IRelativeTypeInfo.Accessibility accessibility )
{
return (accessibility != IRelativeTypeInfo.Accessibility.PUBLIC ||
AccessibilityUtil.forType( declaringClass ) == IRelativeTypeInfo.Accessibility.INTERNAL ||
AccessibilityUtil.forType( declaringClass ) == IRelativeTypeInfo.Accessibility.PRIVATE)
&& getTopLevelNamespace( callingClass ).equals( getTopLevelNamespace( declaringClass ) )
&& (isInSeparateClassLoader( callingClass, declaringClass ) ||
classesLoadInSeparateLoader( callingClass, declaringClass ));
} | [
"private",
"static",
"boolean",
"isGosuClassAccessingProtectedOrInternalMethodOfClassInDifferentClassloader",
"(",
"ICompilableTypeInternal",
"callingClass",
",",
"IType",
"declaringClass",
",",
"IRelativeTypeInfo",
".",
"Accessibility",
"accessibility",
")",
"{",
"return",
"(",
"accessibility",
"!=",
"IRelativeTypeInfo",
".",
"Accessibility",
".",
"PUBLIC",
"||",
"AccessibilityUtil",
".",
"forType",
"(",
"declaringClass",
")",
"==",
"IRelativeTypeInfo",
".",
"Accessibility",
".",
"INTERNAL",
"||",
"AccessibilityUtil",
".",
"forType",
"(",
"declaringClass",
")",
"==",
"IRelativeTypeInfo",
".",
"Accessibility",
".",
"PRIVATE",
")",
"&&",
"getTopLevelNamespace",
"(",
"callingClass",
")",
".",
"equals",
"(",
"getTopLevelNamespace",
"(",
"declaringClass",
")",
")",
"&&",
"(",
"isInSeparateClassLoader",
"(",
"callingClass",
",",
"declaringClass",
")",
"||",
"classesLoadInSeparateLoader",
"(",
"callingClass",
",",
"declaringClass",
")",
")",
";",
"}"
]
| Java will blow up if the package-level access is relied upon across class loaders, though, so we make the call reflectively. | [
"Java",
"will",
"blow",
"up",
"if",
"the",
"package",
"-",
"level",
"access",
"is",
"relied",
"upon",
"across",
"class",
"loaders",
"though",
"so",
"we",
"make",
"the",
"call",
"reflectively",
"."
]
| train | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core/src/main/java/gw/internal/gosu/ir/transform/util/RequiresReflectionDeterminer.java#L173-L182 |
Azure/azure-sdk-for-java | sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerAzureADAdministratorsInner.java | ServerAzureADAdministratorsInner.beginCreateOrUpdate | public ServerAzureADAdministratorInner beginCreateOrUpdate(String resourceGroupName, String serverName, ServerAzureADAdministratorInner properties) {
"""
Creates a new Server Active Directory Administrator or updates an existing server Active Directory Administrator.
@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 serverName The name of the server.
@param properties The required parameters for creating or updating an Active Directory Administrator.
@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 ServerAzureADAdministratorInner object if successful.
"""
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, properties).toBlocking().single().body();
} | java | public ServerAzureADAdministratorInner beginCreateOrUpdate(String resourceGroupName, String serverName, ServerAzureADAdministratorInner properties) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, properties).toBlocking().single().body();
} | [
"public",
"ServerAzureADAdministratorInner",
"beginCreateOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"ServerAzureADAdministratorInner",
"properties",
")",
"{",
"return",
"beginCreateOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"serverName",
",",
"properties",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
]
| Creates a new Server Active Directory Administrator or updates an existing server Active Directory Administrator.
@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 serverName The name of the server.
@param properties The required parameters for creating or updating an Active Directory Administrator.
@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 ServerAzureADAdministratorInner object if successful. | [
"Creates",
"a",
"new",
"Server",
"Active",
"Directory",
"Administrator",
"or",
"updates",
"an",
"existing",
"server",
"Active",
"Directory",
"Administrator",
"."
]
| train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerAzureADAdministratorsInner.java#L175-L177 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUResourceBundle.java | ICUResourceBundle.getFullLocaleNameSet | public static Set<String> getFullLocaleNameSet(String bundlePrefix, ClassLoader loader) {
"""
Return a set of all the locale names supported by a collection of
resource bundles.
@param bundlePrefix the prefix of the resource bundles to use.
"""
return getAvailEntry(bundlePrefix, loader).getFullLocaleNameSet();
} | java | public static Set<String> getFullLocaleNameSet(String bundlePrefix, ClassLoader loader) {
return getAvailEntry(bundlePrefix, loader).getFullLocaleNameSet();
} | [
"public",
"static",
"Set",
"<",
"String",
">",
"getFullLocaleNameSet",
"(",
"String",
"bundlePrefix",
",",
"ClassLoader",
"loader",
")",
"{",
"return",
"getAvailEntry",
"(",
"bundlePrefix",
",",
"loader",
")",
".",
"getFullLocaleNameSet",
"(",
")",
";",
"}"
]
| Return a set of all the locale names supported by a collection of
resource bundles.
@param bundlePrefix the prefix of the resource bundles to use. | [
"Return",
"a",
"set",
"of",
"all",
"the",
"locale",
"names",
"supported",
"by",
"a",
"collection",
"of",
"resource",
"bundles",
"."
]
| train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUResourceBundle.java#L459-L461 |
liferay/com-liferay-commerce | commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceOrderItemPersistenceImpl.java | CommerceOrderItemPersistenceImpl.removeByC_S | @Override
public void removeByC_S(long commerceOrderId, boolean subscription) {
"""
Removes all the commerce order items where commerceOrderId = ? and subscription = ? from the database.
@param commerceOrderId the commerce order ID
@param subscription the subscription
"""
for (CommerceOrderItem commerceOrderItem : findByC_S(commerceOrderId,
subscription, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
remove(commerceOrderItem);
}
} | java | @Override
public void removeByC_S(long commerceOrderId, boolean subscription) {
for (CommerceOrderItem commerceOrderItem : findByC_S(commerceOrderId,
subscription, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
remove(commerceOrderItem);
}
} | [
"@",
"Override",
"public",
"void",
"removeByC_S",
"(",
"long",
"commerceOrderId",
",",
"boolean",
"subscription",
")",
"{",
"for",
"(",
"CommerceOrderItem",
"commerceOrderItem",
":",
"findByC_S",
"(",
"commerceOrderId",
",",
"subscription",
",",
"QueryUtil",
".",
"ALL_POS",
",",
"QueryUtil",
".",
"ALL_POS",
",",
"null",
")",
")",
"{",
"remove",
"(",
"commerceOrderItem",
")",
";",
"}",
"}"
]
| Removes all the commerce order items where commerceOrderId = ? and subscription = ? from the database.
@param commerceOrderId the commerce order ID
@param subscription the subscription | [
"Removes",
"all",
"the",
"commerce",
"order",
"items",
"where",
"commerceOrderId",
"=",
"?",
";",
"and",
"subscription",
"=",
"?",
";",
"from",
"the",
"database",
"."
]
| train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceOrderItemPersistenceImpl.java#L2682-L2688 |
undertow-io/undertow | core/src/main/java/io/undertow/websockets/core/WebSockets.java | WebSockets.sendPing | public static void sendPing(final ByteBuffer[] data, final WebSocketChannel wsChannel, final WebSocketCallback<Void> callback) {
"""
Sends a complete ping message, invoking the callback when complete
@param data The data to send
@param wsChannel The web socket channel
@param callback The callback to invoke on completion
"""
sendInternal(mergeBuffers(data), WebSocketFrameType.PING, wsChannel, callback, null, -1);
} | java | public static void sendPing(final ByteBuffer[] data, final WebSocketChannel wsChannel, final WebSocketCallback<Void> callback) {
sendInternal(mergeBuffers(data), WebSocketFrameType.PING, wsChannel, callback, null, -1);
} | [
"public",
"static",
"void",
"sendPing",
"(",
"final",
"ByteBuffer",
"[",
"]",
"data",
",",
"final",
"WebSocketChannel",
"wsChannel",
",",
"final",
"WebSocketCallback",
"<",
"Void",
">",
"callback",
")",
"{",
"sendInternal",
"(",
"mergeBuffers",
"(",
"data",
")",
",",
"WebSocketFrameType",
".",
"PING",
",",
"wsChannel",
",",
"callback",
",",
"null",
",",
"-",
"1",
")",
";",
"}"
]
| Sends a complete ping message, invoking the callback when complete
@param data The data to send
@param wsChannel The web socket channel
@param callback The callback to invoke on completion | [
"Sends",
"a",
"complete",
"ping",
"message",
"invoking",
"the",
"callback",
"when",
"complete"
]
| train | https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/websockets/core/WebSockets.java#L279-L281 |
atomix/atomix | cluster/src/main/java/io/atomix/cluster/NodeBuilder.java | NodeBuilder.withAddress | @Deprecated
public NodeBuilder withAddress(String host, int port) {
"""
Sets the node host/port.
@param host the host name
@param port the port number
@return the node builder
@throws io.atomix.utils.net.MalformedAddressException if a valid {@link Address} cannot be constructed from the arguments
@deprecated since 3.1. Use {@link #withHost(String)} and {@link #withPort(int)} instead
"""
return withAddress(Address.from(host, port));
} | java | @Deprecated
public NodeBuilder withAddress(String host, int port) {
return withAddress(Address.from(host, port));
} | [
"@",
"Deprecated",
"public",
"NodeBuilder",
"withAddress",
"(",
"String",
"host",
",",
"int",
"port",
")",
"{",
"return",
"withAddress",
"(",
"Address",
".",
"from",
"(",
"host",
",",
"port",
")",
")",
";",
"}"
]
| Sets the node host/port.
@param host the host name
@param port the port number
@return the node builder
@throws io.atomix.utils.net.MalformedAddressException if a valid {@link Address} cannot be constructed from the arguments
@deprecated since 3.1. Use {@link #withHost(String)} and {@link #withPort(int)} instead | [
"Sets",
"the",
"node",
"host",
"/",
"port",
"."
]
| train | https://github.com/atomix/atomix/blob/3a94b7c80576d762dd0d396d4645df07a0b37c31/cluster/src/main/java/io/atomix/cluster/NodeBuilder.java#L97-L100 |
akarnokd/akarnokd-xml | src/main/java/hu/akarnokd/xml/XSerializables.java | XSerializables.storeList | public static XElement storeList(String container, String item, Iterable<? extends XSerializable> source) {
"""
Create an XElement with the given name and items stored from the source sequence.
@param container the container name
@param item the item name
@param source the source of items
@return the list in XElement
"""
XElement result = new XElement(container);
for (XSerializable e : source) {
e.save(result.add(item));
}
return result;
} | java | public static XElement storeList(String container, String item, Iterable<? extends XSerializable> source) {
XElement result = new XElement(container);
for (XSerializable e : source) {
e.save(result.add(item));
}
return result;
} | [
"public",
"static",
"XElement",
"storeList",
"(",
"String",
"container",
",",
"String",
"item",
",",
"Iterable",
"<",
"?",
"extends",
"XSerializable",
">",
"source",
")",
"{",
"XElement",
"result",
"=",
"new",
"XElement",
"(",
"container",
")",
";",
"for",
"(",
"XSerializable",
"e",
":",
"source",
")",
"{",
"e",
".",
"save",
"(",
"result",
".",
"add",
"(",
"item",
")",
")",
";",
"}",
"return",
"result",
";",
"}"
]
| Create an XElement with the given name and items stored from the source sequence.
@param container the container name
@param item the item name
@param source the source of items
@return the list in XElement | [
"Create",
"an",
"XElement",
"with",
"the",
"given",
"name",
"and",
"items",
"stored",
"from",
"the",
"source",
"sequence",
"."
]
| train | https://github.com/akarnokd/akarnokd-xml/blob/57466a5a9cb455a13d7121557c165287b31ee870/src/main/java/hu/akarnokd/xml/XSerializables.java#L92-L98 |
Wadpam/guja | guja-core/src/main/java/com/wadpam/guja/i18n/dao/GeneratedDi18nDaoImpl.java | GeneratedDi18nDaoImpl.queryByUpdatedBy | public Iterable<Di18n> queryByUpdatedBy(java.lang.String updatedBy) {
"""
query-by method for field updatedBy
@param updatedBy the specified attribute
@return an Iterable of Di18ns for the specified updatedBy
"""
return queryByField(null, Di18nMapper.Field.UPDATEDBY.getFieldName(), updatedBy);
} | java | public Iterable<Di18n> queryByUpdatedBy(java.lang.String updatedBy) {
return queryByField(null, Di18nMapper.Field.UPDATEDBY.getFieldName(), updatedBy);
} | [
"public",
"Iterable",
"<",
"Di18n",
">",
"queryByUpdatedBy",
"(",
"java",
".",
"lang",
".",
"String",
"updatedBy",
")",
"{",
"return",
"queryByField",
"(",
"null",
",",
"Di18nMapper",
".",
"Field",
".",
"UPDATEDBY",
".",
"getFieldName",
"(",
")",
",",
"updatedBy",
")",
";",
"}"
]
| query-by method for field updatedBy
@param updatedBy the specified attribute
@return an Iterable of Di18ns for the specified updatedBy | [
"query",
"-",
"by",
"method",
"for",
"field",
"updatedBy"
]
| train | https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/i18n/dao/GeneratedDi18nDaoImpl.java#L97-L99 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java | JavacParser.superSuffix | JCExpression superSuffix(List<JCExpression> typeArgs, JCExpression t) {
"""
SuperSuffix = Arguments | "." [TypeArguments] Ident [Arguments]
"""
nextToken();
if (token.kind == LPAREN || typeArgs != null) {
t = arguments(typeArgs, t);
} else if (token.kind == COLCOL) {
if (typeArgs != null) return illegal();
t = memberReferenceSuffix(t);
} else {
int pos = token.pos;
accept(DOT);
typeArgs = (token.kind == LT) ? typeArguments(false) : null;
t = toP(F.at(pos).Select(t, ident()));
t = argumentsOpt(typeArgs, t);
}
return t;
} | java | JCExpression superSuffix(List<JCExpression> typeArgs, JCExpression t) {
nextToken();
if (token.kind == LPAREN || typeArgs != null) {
t = arguments(typeArgs, t);
} else if (token.kind == COLCOL) {
if (typeArgs != null) return illegal();
t = memberReferenceSuffix(t);
} else {
int pos = token.pos;
accept(DOT);
typeArgs = (token.kind == LT) ? typeArguments(false) : null;
t = toP(F.at(pos).Select(t, ident()));
t = argumentsOpt(typeArgs, t);
}
return t;
} | [
"JCExpression",
"superSuffix",
"(",
"List",
"<",
"JCExpression",
">",
"typeArgs",
",",
"JCExpression",
"t",
")",
"{",
"nextToken",
"(",
")",
";",
"if",
"(",
"token",
".",
"kind",
"==",
"LPAREN",
"||",
"typeArgs",
"!=",
"null",
")",
"{",
"t",
"=",
"arguments",
"(",
"typeArgs",
",",
"t",
")",
";",
"}",
"else",
"if",
"(",
"token",
".",
"kind",
"==",
"COLCOL",
")",
"{",
"if",
"(",
"typeArgs",
"!=",
"null",
")",
"return",
"illegal",
"(",
")",
";",
"t",
"=",
"memberReferenceSuffix",
"(",
"t",
")",
";",
"}",
"else",
"{",
"int",
"pos",
"=",
"token",
".",
"pos",
";",
"accept",
"(",
"DOT",
")",
";",
"typeArgs",
"=",
"(",
"token",
".",
"kind",
"==",
"LT",
")",
"?",
"typeArguments",
"(",
"false",
")",
":",
"null",
";",
"t",
"=",
"toP",
"(",
"F",
".",
"at",
"(",
"pos",
")",
".",
"Select",
"(",
"t",
",",
"ident",
"(",
")",
")",
")",
";",
"t",
"=",
"argumentsOpt",
"(",
"typeArgs",
",",
"t",
")",
";",
"}",
"return",
"t",
";",
"}"
]
| SuperSuffix = Arguments | "." [TypeArguments] Ident [Arguments] | [
"SuperSuffix",
"=",
"Arguments",
"|",
".",
"[",
"TypeArguments",
"]",
"Ident",
"[",
"Arguments",
"]"
]
| train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java#L1775-L1790 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/UTF16.java | UTF16.charAt | public static int charAt(CharSequence source, int offset16) {
"""
Extract a single UTF-32 value from a string. Used when iterating forwards or backwards (with
<code>UTF16.getCharCount()</code>, as well as random access. If a validity check is
required, use <code><a href="../lang/UCharacter.html#isLegal(char)">
UCharacter.isLegal()</a></code>
on the return value. If the char retrieved is part of a surrogate pair, its supplementary
character will be returned. If a complete supplementary character is not found the incomplete
character will be returned
@param source Array of UTF-16 chars
@param offset16 UTF-16 offset to the start of the character.
@return UTF-32 value for the UTF-32 value that contains the char at offset16. The boundaries
of that codepoint are the same as in <code>bounds32()</code>.
@exception IndexOutOfBoundsException Thrown if offset16 is out of bounds.
"""
char single = source.charAt(offset16);
if (single < UTF16.LEAD_SURROGATE_MIN_VALUE) {
return single;
}
return _charAt(source, offset16, single);
} | java | public static int charAt(CharSequence source, int offset16) {
char single = source.charAt(offset16);
if (single < UTF16.LEAD_SURROGATE_MIN_VALUE) {
return single;
}
return _charAt(source, offset16, single);
} | [
"public",
"static",
"int",
"charAt",
"(",
"CharSequence",
"source",
",",
"int",
"offset16",
")",
"{",
"char",
"single",
"=",
"source",
".",
"charAt",
"(",
"offset16",
")",
";",
"if",
"(",
"single",
"<",
"UTF16",
".",
"LEAD_SURROGATE_MIN_VALUE",
")",
"{",
"return",
"single",
";",
"}",
"return",
"_charAt",
"(",
"source",
",",
"offset16",
",",
"single",
")",
";",
"}"
]
| Extract a single UTF-32 value from a string. Used when iterating forwards or backwards (with
<code>UTF16.getCharCount()</code>, as well as random access. If a validity check is
required, use <code><a href="../lang/UCharacter.html#isLegal(char)">
UCharacter.isLegal()</a></code>
on the return value. If the char retrieved is part of a surrogate pair, its supplementary
character will be returned. If a complete supplementary character is not found the incomplete
character will be returned
@param source Array of UTF-16 chars
@param offset16 UTF-16 offset to the start of the character.
@return UTF-32 value for the UTF-32 value that contains the char at offset16. The boundaries
of that codepoint are the same as in <code>bounds32()</code>.
@exception IndexOutOfBoundsException Thrown if offset16 is out of bounds. | [
"Extract",
"a",
"single",
"UTF",
"-",
"32",
"value",
"from",
"a",
"string",
".",
"Used",
"when",
"iterating",
"forwards",
"or",
"backwards",
"(",
"with",
"<code",
">",
"UTF16",
".",
"getCharCount",
"()",
"<",
"/",
"code",
">",
"as",
"well",
"as",
"random",
"access",
".",
"If",
"a",
"validity",
"check",
"is",
"required",
"use",
"<code",
">",
"<a",
"href",
"=",
"..",
"/",
"lang",
"/",
"UCharacter",
".",
"html#isLegal",
"(",
"char",
")",
">",
"UCharacter",
".",
"isLegal",
"()",
"<",
"/",
"a",
">",
"<",
"/",
"code",
">",
"on",
"the",
"return",
"value",
".",
"If",
"the",
"char",
"retrieved",
"is",
"part",
"of",
"a",
"surrogate",
"pair",
"its",
"supplementary",
"character",
"will",
"be",
"returned",
".",
"If",
"a",
"complete",
"supplementary",
"character",
"is",
"not",
"found",
"the",
"incomplete",
"character",
"will",
"be",
"returned"
]
| train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/UTF16.java#L252-L258 |
jenkinsci/jenkins | core/src/main/java/hudson/model/ParameterValue.java | ParameterValue.buildEnvironment | public void buildEnvironment(Run<?,?> build, EnvVars env) {
"""
Adds environmental variables for the builds to the given map.
<p>
This provides a means for a parameter to pass the parameter
values to the build to be performed.
<p>
When this method is invoked, the map already contains the
current "planned export" list. The implementation is
expected to add more values to this map (or do nothing)
@param env
never null.
@param build
The build for which this parameter is being used. Never null.
@since 1.556
"""
if (build instanceof AbstractBuild) {
buildEnvVars((AbstractBuild) build, env);
}
// else do not know how to do it
} | java | public void buildEnvironment(Run<?,?> build, EnvVars env) {
if (build instanceof AbstractBuild) {
buildEnvVars((AbstractBuild) build, env);
}
// else do not know how to do it
} | [
"public",
"void",
"buildEnvironment",
"(",
"Run",
"<",
"?",
",",
"?",
">",
"build",
",",
"EnvVars",
"env",
")",
"{",
"if",
"(",
"build",
"instanceof",
"AbstractBuild",
")",
"{",
"buildEnvVars",
"(",
"(",
"AbstractBuild",
")",
"build",
",",
"env",
")",
";",
"}",
"// else do not know how to do it",
"}"
]
| Adds environmental variables for the builds to the given map.
<p>
This provides a means for a parameter to pass the parameter
values to the build to be performed.
<p>
When this method is invoked, the map already contains the
current "planned export" list. The implementation is
expected to add more values to this map (or do nothing)
@param env
never null.
@param build
The build for which this parameter is being used. Never null.
@since 1.556 | [
"Adds",
"environmental",
"variables",
"for",
"the",
"builds",
"to",
"the",
"given",
"map",
"."
]
| train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/ParameterValue.java#L193-L198 |
RestComm/media-core | rtp/src/main/java/org/restcomm/media/core/rtp/sdp/MediaDescriptorField.java | MediaDescriptorField.createAudioFormat | private RTPFormat createAudioFormat(int payload, Text description) {
"""
Creates or updates audio format using payload number and text format description.
@param payload the payload number of the format.
@param description text description of the format
@return format object
"""
Iterator<Text> it = description.split('/').iterator();
//encoding name
Text token = it.next();
token.trim();
EncodingName name = new EncodingName(token);
//clock rate
//TODO : convert to sample rate
token = it.next();
token.trim();
int clockRate = token.toInteger();
//channels
int channels = 1;
if (it.hasNext()) {
token = it.next();
token.trim();
channels = token.toInteger();
}
RTPFormat rtpFormat = getFormat(payload);
if (rtpFormat == null) {
formats.add(new RTPFormat(payload, FormatFactory.createAudioFormat(name, clockRate, -1, channels)));
} else {
//TODO: recreate format anyway. it is illegal to use clock rate as sample rate
((AudioFormat)rtpFormat.getFormat()).setName(name);
((AudioFormat)rtpFormat.getFormat()).setSampleRate(clockRate);
((AudioFormat)rtpFormat.getFormat()).setChannels(channels);
}
return rtpFormat;
} | java | private RTPFormat createAudioFormat(int payload, Text description) {
Iterator<Text> it = description.split('/').iterator();
//encoding name
Text token = it.next();
token.trim();
EncodingName name = new EncodingName(token);
//clock rate
//TODO : convert to sample rate
token = it.next();
token.trim();
int clockRate = token.toInteger();
//channels
int channels = 1;
if (it.hasNext()) {
token = it.next();
token.trim();
channels = token.toInteger();
}
RTPFormat rtpFormat = getFormat(payload);
if (rtpFormat == null) {
formats.add(new RTPFormat(payload, FormatFactory.createAudioFormat(name, clockRate, -1, channels)));
} else {
//TODO: recreate format anyway. it is illegal to use clock rate as sample rate
((AudioFormat)rtpFormat.getFormat()).setName(name);
((AudioFormat)rtpFormat.getFormat()).setSampleRate(clockRate);
((AudioFormat)rtpFormat.getFormat()).setChannels(channels);
}
return rtpFormat;
} | [
"private",
"RTPFormat",
"createAudioFormat",
"(",
"int",
"payload",
",",
"Text",
"description",
")",
"{",
"Iterator",
"<",
"Text",
">",
"it",
"=",
"description",
".",
"split",
"(",
"'",
"'",
")",
".",
"iterator",
"(",
")",
";",
"//encoding name",
"Text",
"token",
"=",
"it",
".",
"next",
"(",
")",
";",
"token",
".",
"trim",
"(",
")",
";",
"EncodingName",
"name",
"=",
"new",
"EncodingName",
"(",
"token",
")",
";",
"//clock rate",
"//TODO : convert to sample rate",
"token",
"=",
"it",
".",
"next",
"(",
")",
";",
"token",
".",
"trim",
"(",
")",
";",
"int",
"clockRate",
"=",
"token",
".",
"toInteger",
"(",
")",
";",
"//channels",
"int",
"channels",
"=",
"1",
";",
"if",
"(",
"it",
".",
"hasNext",
"(",
")",
")",
"{",
"token",
"=",
"it",
".",
"next",
"(",
")",
";",
"token",
".",
"trim",
"(",
")",
";",
"channels",
"=",
"token",
".",
"toInteger",
"(",
")",
";",
"}",
"RTPFormat",
"rtpFormat",
"=",
"getFormat",
"(",
"payload",
")",
";",
"if",
"(",
"rtpFormat",
"==",
"null",
")",
"{",
"formats",
".",
"add",
"(",
"new",
"RTPFormat",
"(",
"payload",
",",
"FormatFactory",
".",
"createAudioFormat",
"(",
"name",
",",
"clockRate",
",",
"-",
"1",
",",
"channels",
")",
")",
")",
";",
"}",
"else",
"{",
"//TODO: recreate format anyway. it is illegal to use clock rate as sample rate",
"(",
"(",
"AudioFormat",
")",
"rtpFormat",
".",
"getFormat",
"(",
")",
")",
".",
"setName",
"(",
"name",
")",
";",
"(",
"(",
"AudioFormat",
")",
"rtpFormat",
".",
"getFormat",
"(",
")",
")",
".",
"setSampleRate",
"(",
"clockRate",
")",
";",
"(",
"(",
"AudioFormat",
")",
"rtpFormat",
".",
"getFormat",
"(",
")",
")",
".",
"setChannels",
"(",
"channels",
")",
";",
"}",
"return",
"rtpFormat",
";",
"}"
]
| Creates or updates audio format using payload number and text format description.
@param payload the payload number of the format.
@param description text description of the format
@return format object | [
"Creates",
"or",
"updates",
"audio",
"format",
"using",
"payload",
"number",
"and",
"text",
"format",
"description",
"."
]
| train | https://github.com/RestComm/media-core/blob/07b8703343708599f60af66bae62aded77ee81b5/rtp/src/main/java/org/restcomm/media/core/rtp/sdp/MediaDescriptorField.java#L421-L454 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/odmg/locking/ReadCommittedStrategy.java | ReadCommittedStrategy.checkRead | public boolean checkRead(TransactionImpl tx, Object obj) {
"""
checks whether the specified Object obj is read-locked by Transaction tx.
@param tx the transaction
@param obj the Object to be checked
@return true if lock exists, else false
"""
if (hasReadLock(tx, obj))
{
return true;
}
LockEntry writer = getWriter(obj);
if (writer.isOwnedBy(tx))
{
return true;
}
return false;
} | java | public boolean checkRead(TransactionImpl tx, Object obj)
{
if (hasReadLock(tx, obj))
{
return true;
}
LockEntry writer = getWriter(obj);
if (writer.isOwnedBy(tx))
{
return true;
}
return false;
} | [
"public",
"boolean",
"checkRead",
"(",
"TransactionImpl",
"tx",
",",
"Object",
"obj",
")",
"{",
"if",
"(",
"hasReadLock",
"(",
"tx",
",",
"obj",
")",
")",
"{",
"return",
"true",
";",
"}",
"LockEntry",
"writer",
"=",
"getWriter",
"(",
"obj",
")",
";",
"if",
"(",
"writer",
".",
"isOwnedBy",
"(",
"tx",
")",
")",
"{",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
]
| checks whether the specified Object obj is read-locked by Transaction tx.
@param tx the transaction
@param obj the Object to be checked
@return true if lock exists, else false | [
"checks",
"whether",
"the",
"specified",
"Object",
"obj",
"is",
"read",
"-",
"locked",
"by",
"Transaction",
"tx",
"."
]
| train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/odmg/locking/ReadCommittedStrategy.java#L156-L168 |
sababado/CircularView | library/src/main/java/com/sababado/circularview/CircularViewObject.java | CircularViewObject.updateDrawableState | public void updateDrawableState(int state, boolean flag) {
"""
Either remove or add a state to the combined state.
@param state State to add or remove.
@param flag True to add, false to remove.
"""
final int oldState = mCombinedState;
// Update the combined state flag
if (flag) mCombinedState |= state;
else mCombinedState &= ~state;
// Set the combined state
if (oldState != mCombinedState) {
setState(VIEW_STATE_SETS[mCombinedState]);
}
} | java | public void updateDrawableState(int state, boolean flag) {
final int oldState = mCombinedState;
// Update the combined state flag
if (flag) mCombinedState |= state;
else mCombinedState &= ~state;
// Set the combined state
if (oldState != mCombinedState) {
setState(VIEW_STATE_SETS[mCombinedState]);
}
} | [
"public",
"void",
"updateDrawableState",
"(",
"int",
"state",
",",
"boolean",
"flag",
")",
"{",
"final",
"int",
"oldState",
"=",
"mCombinedState",
";",
"// Update the combined state flag",
"if",
"(",
"flag",
")",
"mCombinedState",
"|=",
"state",
";",
"else",
"mCombinedState",
"&=",
"~",
"state",
";",
"// Set the combined state",
"if",
"(",
"oldState",
"!=",
"mCombinedState",
")",
"{",
"setState",
"(",
"VIEW_STATE_SETS",
"[",
"mCombinedState",
"]",
")",
";",
"}",
"}"
]
| Either remove or add a state to the combined state.
@param state State to add or remove.
@param flag True to add, false to remove. | [
"Either",
"remove",
"or",
"add",
"a",
"state",
"to",
"the",
"combined",
"state",
"."
]
| train | https://github.com/sababado/CircularView/blob/c9ab818d063bcc0796183616f8a82166a9b80aac/library/src/main/java/com/sababado/circularview/CircularViewObject.java#L230-L240 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/MachineTypeId.java | MachineTypeId.of | public static MachineTypeId of(String zone, String type) {
"""
Returns a machine type identity given the zone and type names.
"""
return new MachineTypeId(null, zone, type);
} | java | public static MachineTypeId of(String zone, String type) {
return new MachineTypeId(null, zone, type);
} | [
"public",
"static",
"MachineTypeId",
"of",
"(",
"String",
"zone",
",",
"String",
"type",
")",
"{",
"return",
"new",
"MachineTypeId",
"(",
"null",
",",
"zone",
",",
"type",
")",
";",
"}"
]
| Returns a machine type identity given the zone and type names. | [
"Returns",
"a",
"machine",
"type",
"identity",
"given",
"the",
"zone",
"and",
"type",
"names",
"."
]
| train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/MachineTypeId.java#L111-L113 |
jcuda/jcuda | JCudaJava/src/main/java/jcuda/runtime/JCuda.java | JCuda.cudaConfigureCall | @Deprecated
public static int cudaConfigureCall(dim3 gridDim, dim3 blockDim, long sharedMem, cudaStream_t stream) {
"""
Configure a device-launch.
<pre>
cudaError_t cudaConfigureCall (
dim3 gridDim,
dim3 blockDim,
size_t sharedMem = 0,
cudaStream_t stream = 0 )
</pre>
<div>
<p>Configure a device-launch. Specifies
the grid and block dimensions for the device call to be executed
similar to the execution
configuration syntax. cudaConfigureCall()
is stack based. Each call pushes data on top of an execution stack.
This data contains the dimension for the grid and thread
blocks, together with any arguments for
the call.
</p>
<div>
<span>Note:</span>
<p>Note that this
function may also return error codes from previous, asynchronous
launches.
</p>
</div>
</p>
</div>
@param gridDim Grid dimensions
@param blockDim Block dimensions
@param sharedMem Shared memory
@param stream Stream identifier
@return cudaSuccess, cudaErrorInvalidConfiguration
@see JCuda#cudaDeviceSetCacheConfig
@see JCuda#cudaFuncGetAttributes
@see JCuda#cudaLaunch
@see JCuda#cudaSetDoubleForDevice
@see JCuda#cudaSetDoubleForHost
@see JCuda#cudaSetupArgument
@deprecated This function is deprecated as of CUDA 7.0
"""
return checkResult(cudaConfigureCallNative(gridDim, blockDim, sharedMem, stream));
} | java | @Deprecated
public static int cudaConfigureCall(dim3 gridDim, dim3 blockDim, long sharedMem, cudaStream_t stream)
{
return checkResult(cudaConfigureCallNative(gridDim, blockDim, sharedMem, stream));
} | [
"@",
"Deprecated",
"public",
"static",
"int",
"cudaConfigureCall",
"(",
"dim3",
"gridDim",
",",
"dim3",
"blockDim",
",",
"long",
"sharedMem",
",",
"cudaStream_t",
"stream",
")",
"{",
"return",
"checkResult",
"(",
"cudaConfigureCallNative",
"(",
"gridDim",
",",
"blockDim",
",",
"sharedMem",
",",
"stream",
")",
")",
";",
"}"
]
| Configure a device-launch.
<pre>
cudaError_t cudaConfigureCall (
dim3 gridDim,
dim3 blockDim,
size_t sharedMem = 0,
cudaStream_t stream = 0 )
</pre>
<div>
<p>Configure a device-launch. Specifies
the grid and block dimensions for the device call to be executed
similar to the execution
configuration syntax. cudaConfigureCall()
is stack based. Each call pushes data on top of an execution stack.
This data contains the dimension for the grid and thread
blocks, together with any arguments for
the call.
</p>
<div>
<span>Note:</span>
<p>Note that this
function may also return error codes from previous, asynchronous
launches.
</p>
</div>
</p>
</div>
@param gridDim Grid dimensions
@param blockDim Block dimensions
@param sharedMem Shared memory
@param stream Stream identifier
@return cudaSuccess, cudaErrorInvalidConfiguration
@see JCuda#cudaDeviceSetCacheConfig
@see JCuda#cudaFuncGetAttributes
@see JCuda#cudaLaunch
@see JCuda#cudaSetDoubleForDevice
@see JCuda#cudaSetDoubleForHost
@see JCuda#cudaSetupArgument
@deprecated This function is deprecated as of CUDA 7.0 | [
"Configure",
"a",
"device",
"-",
"launch",
"."
]
| train | https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/runtime/JCuda.java#L10220-L10224 |
momokan/LWJGFont | src/main/java/net/chocolapod/lwjgfont/LWJGFont.java | LWJGFont.drawParagraph | public final void drawParagraph(String text, float dstX, float dstY, float dstZ, float paragraphWidth) throws IOException {
"""
Draws the paragraph given by the specified string, using this font instance's current color.<br>
if the specified string protrudes from paragraphWidth, protruded substring is auto wrapped with left align.<br>
Note that the specified destination coordinates is a left point of the rendered string's baseline.
@param text the string to be drawn.
@param dstX the x coordinate to render the string.
@param dstY the y coordinate to render the string.
@param dstZ the z coordinate to render the string.
@param paragraphWidth the max width to draw the paragraph.
@throws IOException Indicates a failure to read font images as textures.
"""
this.drawParagraph(text, dstX, dstY, dstZ, paragraphWidth, ALIGN.LEGT);
} | java | public final void drawParagraph(String text, float dstX, float dstY, float dstZ, float paragraphWidth) throws IOException {
this.drawParagraph(text, dstX, dstY, dstZ, paragraphWidth, ALIGN.LEGT);
} | [
"public",
"final",
"void",
"drawParagraph",
"(",
"String",
"text",
",",
"float",
"dstX",
",",
"float",
"dstY",
",",
"float",
"dstZ",
",",
"float",
"paragraphWidth",
")",
"throws",
"IOException",
"{",
"this",
".",
"drawParagraph",
"(",
"text",
",",
"dstX",
",",
"dstY",
",",
"dstZ",
",",
"paragraphWidth",
",",
"ALIGN",
".",
"LEGT",
")",
";",
"}"
]
| Draws the paragraph given by the specified string, using this font instance's current color.<br>
if the specified string protrudes from paragraphWidth, protruded substring is auto wrapped with left align.<br>
Note that the specified destination coordinates is a left point of the rendered string's baseline.
@param text the string to be drawn.
@param dstX the x coordinate to render the string.
@param dstY the y coordinate to render the string.
@param dstZ the z coordinate to render the string.
@param paragraphWidth the max width to draw the paragraph.
@throws IOException Indicates a failure to read font images as textures. | [
"Draws",
"the",
"paragraph",
"given",
"by",
"the",
"specified",
"string",
"using",
"this",
"font",
"instance",
"s",
"current",
"color",
".",
"<br",
">",
"if",
"the",
"specified",
"string",
"protrudes",
"from",
"paragraphWidth",
"protruded",
"substring",
"is",
"auto",
"wrapped",
"with",
"left",
"align",
".",
"<br",
">",
"Note",
"that",
"the",
"specified",
"destination",
"coordinates",
"is",
"a",
"left",
"point",
"of",
"the",
"rendered",
"string",
"s",
"baseline",
"."
]
| train | https://github.com/momokan/LWJGFont/blob/f2d6138b73d84a7e2c1271bae25b4c76488d9ec2/src/main/java/net/chocolapod/lwjgfont/LWJGFont.java#L171-L173 |
UrielCh/ovh-java-sdk | ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java | ApiOvhOrder.license_virtuozzo_serviceName_upgrade_duration_POST | public OvhOrder license_virtuozzo_serviceName_upgrade_duration_POST(String serviceName, String duration, OvhOrderableVirtuozzoContainerNumberEnum containerNumber) throws IOException {
"""
Create order
REST: POST /order/license/virtuozzo/{serviceName}/upgrade/{duration}
@param containerNumber [required] How much container is this license able to manage ...
@param serviceName [required] The name of your Virtuozzo license
@param duration [required] Duration
"""
String qPath = "/order/license/virtuozzo/{serviceName}/upgrade/{duration}";
StringBuilder sb = path(qPath, serviceName, duration);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "containerNumber", containerNumber);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhOrder.class);
} | java | public OvhOrder license_virtuozzo_serviceName_upgrade_duration_POST(String serviceName, String duration, OvhOrderableVirtuozzoContainerNumberEnum containerNumber) throws IOException {
String qPath = "/order/license/virtuozzo/{serviceName}/upgrade/{duration}";
StringBuilder sb = path(qPath, serviceName, duration);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "containerNumber", containerNumber);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhOrder.class);
} | [
"public",
"OvhOrder",
"license_virtuozzo_serviceName_upgrade_duration_POST",
"(",
"String",
"serviceName",
",",
"String",
"duration",
",",
"OvhOrderableVirtuozzoContainerNumberEnum",
"containerNumber",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/order/license/virtuozzo/{serviceName}/upgrade/{duration}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"serviceName",
",",
"duration",
")",
";",
"HashMap",
"<",
"String",
",",
"Object",
">",
"o",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"addBody",
"(",
"o",
",",
"\"containerNumber\"",
",",
"containerNumber",
")",
";",
"String",
"resp",
"=",
"exec",
"(",
"qPath",
",",
"\"POST\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"o",
")",
";",
"return",
"convertTo",
"(",
"resp",
",",
"OvhOrder",
".",
"class",
")",
";",
"}"
]
| Create order
REST: POST /order/license/virtuozzo/{serviceName}/upgrade/{duration}
@param containerNumber [required] How much container is this license able to manage ...
@param serviceName [required] The name of your Virtuozzo license
@param duration [required] Duration | [
"Create",
"order"
]
| train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L1086-L1093 |
camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/util/ResourceTypeUtil.java | ResourceTypeUtil.getPermissionByNameAndResourceType | public static Permission getPermissionByNameAndResourceType(String permissionName, int resourceType) {
"""
Currently used only in the Rest API
Returns a {@link Permission} based on the specified <code>permissionName</code> and <code>resourceType</code>
@throws BadUserRequestException in case the permission is not valid for the specified resource type
"""
for (Permission permission : getPermissionsByResourceType(resourceType)) {
if (permission.getName().equals(permissionName)) {
return permission;
}
}
throw new BadUserRequestException(
String.format("The permission '%s' is not valid for '%s' resource type.", permissionName, getResourceByType(resourceType))
);
} | java | public static Permission getPermissionByNameAndResourceType(String permissionName, int resourceType) {
for (Permission permission : getPermissionsByResourceType(resourceType)) {
if (permission.getName().equals(permissionName)) {
return permission;
}
}
throw new BadUserRequestException(
String.format("The permission '%s' is not valid for '%s' resource type.", permissionName, getResourceByType(resourceType))
);
} | [
"public",
"static",
"Permission",
"getPermissionByNameAndResourceType",
"(",
"String",
"permissionName",
",",
"int",
"resourceType",
")",
"{",
"for",
"(",
"Permission",
"permission",
":",
"getPermissionsByResourceType",
"(",
"resourceType",
")",
")",
"{",
"if",
"(",
"permission",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"permissionName",
")",
")",
"{",
"return",
"permission",
";",
"}",
"}",
"throw",
"new",
"BadUserRequestException",
"(",
"String",
".",
"format",
"(",
"\"The permission '%s' is not valid for '%s' resource type.\"",
",",
"permissionName",
",",
"getResourceByType",
"(",
"resourceType",
")",
")",
")",
";",
"}"
]
| Currently used only in the Rest API
Returns a {@link Permission} based on the specified <code>permissionName</code> and <code>resourceType</code>
@throws BadUserRequestException in case the permission is not valid for the specified resource type | [
"Currently",
"used",
"only",
"in",
"the",
"Rest",
"API",
"Returns",
"a",
"{"
]
| train | https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/util/ResourceTypeUtil.java#L92-L101 |
Jasig/uPortal | uPortal-layout/uPortal-layout-impl/src/main/java/org/apereo/portal/layout/dlm/TabColumnPrefsHandler.java | TabColumnPrefsHandler.deleteNode | public static void deleteNode(Element compViewNode, IPerson person) throws PortalException {
"""
Handles user requests to delete UI elements. For ILF owned nodes it delegates to the
DeleteManager to add a delete directive. For PLF owned nodes it deletes the node outright.
"""
String ID = compViewNode.getAttribute(Constants.ATT_ID);
if (ID.startsWith(Constants.FRAGMENT_ID_USER_PREFIX)) // ilf node
DeleteManager.addDeleteDirective(compViewNode, ID, person);
else {
// plf node
Document plf = (Document) person.getAttribute(Constants.PLF);
Element node = plf.getElementById(ID);
if (node == null) return;
Element parent = (Element) node.getParentNode();
if (parent == null) return;
parent.removeChild(node);
}
} | java | public static void deleteNode(Element compViewNode, IPerson person) throws PortalException {
String ID = compViewNode.getAttribute(Constants.ATT_ID);
if (ID.startsWith(Constants.FRAGMENT_ID_USER_PREFIX)) // ilf node
DeleteManager.addDeleteDirective(compViewNode, ID, person);
else {
// plf node
Document plf = (Document) person.getAttribute(Constants.PLF);
Element node = plf.getElementById(ID);
if (node == null) return;
Element parent = (Element) node.getParentNode();
if (parent == null) return;
parent.removeChild(node);
}
} | [
"public",
"static",
"void",
"deleteNode",
"(",
"Element",
"compViewNode",
",",
"IPerson",
"person",
")",
"throws",
"PortalException",
"{",
"String",
"ID",
"=",
"compViewNode",
".",
"getAttribute",
"(",
"Constants",
".",
"ATT_ID",
")",
";",
"if",
"(",
"ID",
".",
"startsWith",
"(",
"Constants",
".",
"FRAGMENT_ID_USER_PREFIX",
")",
")",
"// ilf node",
"DeleteManager",
".",
"addDeleteDirective",
"(",
"compViewNode",
",",
"ID",
",",
"person",
")",
";",
"else",
"{",
"// plf node",
"Document",
"plf",
"=",
"(",
"Document",
")",
"person",
".",
"getAttribute",
"(",
"Constants",
".",
"PLF",
")",
";",
"Element",
"node",
"=",
"plf",
".",
"getElementById",
"(",
"ID",
")",
";",
"if",
"(",
"node",
"==",
"null",
")",
"return",
";",
"Element",
"parent",
"=",
"(",
"Element",
")",
"node",
".",
"getParentNode",
"(",
")",
";",
"if",
"(",
"parent",
"==",
"null",
")",
"return",
";",
"parent",
".",
"removeChild",
"(",
"node",
")",
";",
"}",
"}"
]
| Handles user requests to delete UI elements. For ILF owned nodes it delegates to the
DeleteManager to add a delete directive. For PLF owned nodes it deletes the node outright. | [
"Handles",
"user",
"requests",
"to",
"delete",
"UI",
"elements",
".",
"For",
"ILF",
"owned",
"nodes",
"it",
"delegates",
"to",
"the",
"DeleteManager",
"to",
"add",
"a",
"delete",
"directive",
".",
"For",
"PLF",
"owned",
"nodes",
"it",
"deletes",
"the",
"node",
"outright",
"."
]
| train | https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-layout/uPortal-layout-impl/src/main/java/org/apereo/portal/layout/dlm/TabColumnPrefsHandler.java#L101-L116 |
ZieIony/Carbon | carbon/src/main/java/carbon/drawable/ripple/LayerDrawable.java | LayerDrawable.setDrawable | public void setDrawable(int index, Drawable drawable) {
"""
Sets the drawable for the layer at the specified index.
@param index The index of the layer to modify, must be in the range {@code
0...getNumberOfLayers()-1}.
@param drawable The drawable to set for the layer.
@attr ref android.R.styleable#LayerDrawableItem_drawable
@see #getDrawable(int)
"""
if (index >= mLayerState.mNum) {
throw new IndexOutOfBoundsException();
}
final ChildDrawable[] layers = mLayerState.mChildren;
final ChildDrawable childDrawable = layers[index];
if (childDrawable.mDrawable != null) {
if (drawable != null) {
final Rect bounds = childDrawable.mDrawable.getBounds();
drawable.setBounds(bounds);
}
childDrawable.mDrawable.setCallback(null);
}
if (drawable != null) {
drawable.setCallback(this);
}
childDrawable.mDrawable = drawable;
mLayerState.invalidateCache();
refreshChildPadding(index, childDrawable);
} | java | public void setDrawable(int index, Drawable drawable) {
if (index >= mLayerState.mNum) {
throw new IndexOutOfBoundsException();
}
final ChildDrawable[] layers = mLayerState.mChildren;
final ChildDrawable childDrawable = layers[index];
if (childDrawable.mDrawable != null) {
if (drawable != null) {
final Rect bounds = childDrawable.mDrawable.getBounds();
drawable.setBounds(bounds);
}
childDrawable.mDrawable.setCallback(null);
}
if (drawable != null) {
drawable.setCallback(this);
}
childDrawable.mDrawable = drawable;
mLayerState.invalidateCache();
refreshChildPadding(index, childDrawable);
} | [
"public",
"void",
"setDrawable",
"(",
"int",
"index",
",",
"Drawable",
"drawable",
")",
"{",
"if",
"(",
"index",
">=",
"mLayerState",
".",
"mNum",
")",
"{",
"throw",
"new",
"IndexOutOfBoundsException",
"(",
")",
";",
"}",
"final",
"ChildDrawable",
"[",
"]",
"layers",
"=",
"mLayerState",
".",
"mChildren",
";",
"final",
"ChildDrawable",
"childDrawable",
"=",
"layers",
"[",
"index",
"]",
";",
"if",
"(",
"childDrawable",
".",
"mDrawable",
"!=",
"null",
")",
"{",
"if",
"(",
"drawable",
"!=",
"null",
")",
"{",
"final",
"Rect",
"bounds",
"=",
"childDrawable",
".",
"mDrawable",
".",
"getBounds",
"(",
")",
";",
"drawable",
".",
"setBounds",
"(",
"bounds",
")",
";",
"}",
"childDrawable",
".",
"mDrawable",
".",
"setCallback",
"(",
"null",
")",
";",
"}",
"if",
"(",
"drawable",
"!=",
"null",
")",
"{",
"drawable",
".",
"setCallback",
"(",
"this",
")",
";",
"}",
"childDrawable",
".",
"mDrawable",
"=",
"drawable",
";",
"mLayerState",
".",
"invalidateCache",
"(",
")",
";",
"refreshChildPadding",
"(",
"index",
",",
"childDrawable",
")",
";",
"}"
]
| Sets the drawable for the layer at the specified index.
@param index The index of the layer to modify, must be in the range {@code
0...getNumberOfLayers()-1}.
@param drawable The drawable to set for the layer.
@attr ref android.R.styleable#LayerDrawableItem_drawable
@see #getDrawable(int) | [
"Sets",
"the",
"drawable",
"for",
"the",
"layer",
"at",
"the",
"specified",
"index",
"."
]
| train | https://github.com/ZieIony/Carbon/blob/78b0a432bd49edc7a6a13ce111cab274085d1693/carbon/src/main/java/carbon/drawable/ripple/LayerDrawable.java#L523-L547 |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ProfileSummaryBuilder.java | ProfileSummaryBuilder.buildClassSummary | public void buildClassSummary(XMLNode node, Content packageSummaryContentTree) {
"""
Build the summary for the classes in the package.
@param node the XML element that specifies which components to document
@param packageSummaryContentTree the tree to which the class summary will
be added
"""
String classTableSummary =
configuration.getText("doclet.Member_Table_Summary",
configuration.getText("doclet.Class_Summary"),
configuration.getText("doclet.classes"));
String[] classTableHeader = new String[] {
configuration.getText("doclet.Class"),
configuration.getText("doclet.Description")
};
ClassDoc[] classes = pkg.ordinaryClasses();
if (classes.length > 0) {
profileWriter.addClassesSummary(
classes,
configuration.getText("doclet.Class_Summary"),
classTableSummary, classTableHeader, packageSummaryContentTree);
}
} | java | public void buildClassSummary(XMLNode node, Content packageSummaryContentTree) {
String classTableSummary =
configuration.getText("doclet.Member_Table_Summary",
configuration.getText("doclet.Class_Summary"),
configuration.getText("doclet.classes"));
String[] classTableHeader = new String[] {
configuration.getText("doclet.Class"),
configuration.getText("doclet.Description")
};
ClassDoc[] classes = pkg.ordinaryClasses();
if (classes.length > 0) {
profileWriter.addClassesSummary(
classes,
configuration.getText("doclet.Class_Summary"),
classTableSummary, classTableHeader, packageSummaryContentTree);
}
} | [
"public",
"void",
"buildClassSummary",
"(",
"XMLNode",
"node",
",",
"Content",
"packageSummaryContentTree",
")",
"{",
"String",
"classTableSummary",
"=",
"configuration",
".",
"getText",
"(",
"\"doclet.Member_Table_Summary\"",
",",
"configuration",
".",
"getText",
"(",
"\"doclet.Class_Summary\"",
")",
",",
"configuration",
".",
"getText",
"(",
"\"doclet.classes\"",
")",
")",
";",
"String",
"[",
"]",
"classTableHeader",
"=",
"new",
"String",
"[",
"]",
"{",
"configuration",
".",
"getText",
"(",
"\"doclet.Class\"",
")",
",",
"configuration",
".",
"getText",
"(",
"\"doclet.Description\"",
")",
"}",
";",
"ClassDoc",
"[",
"]",
"classes",
"=",
"pkg",
".",
"ordinaryClasses",
"(",
")",
";",
"if",
"(",
"classes",
".",
"length",
">",
"0",
")",
"{",
"profileWriter",
".",
"addClassesSummary",
"(",
"classes",
",",
"configuration",
".",
"getText",
"(",
"\"doclet.Class_Summary\"",
")",
",",
"classTableSummary",
",",
"classTableHeader",
",",
"packageSummaryContentTree",
")",
";",
"}",
"}"
]
| Build the summary for the classes in the package.
@param node the XML element that specifies which components to document
@param packageSummaryContentTree the tree to which the class summary will
be added | [
"Build",
"the",
"summary",
"for",
"the",
"classes",
"in",
"the",
"package",
"."
]
| train | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ProfileSummaryBuilder.java#L210-L226 |
gallandarakhneorg/afc | core/maths/mathgeom/tobeincluded/src/d3/continuous/AlignedBox3f.java | AlignedBox3f.setX | @Override
public void setX(double min, double max) {
"""
Set the x bounds of the box.
@param min the min value for the x axis.
@param max the max value for the x axis.
"""
if (min <= max) {
this.minx = min;
this.maxx = max;
} else {
this.minx = max;
this.maxx = min;
}
} | java | @Override
public void setX(double min, double max) {
if (min <= max) {
this.minx = min;
this.maxx = max;
} else {
this.minx = max;
this.maxx = min;
}
} | [
"@",
"Override",
"public",
"void",
"setX",
"(",
"double",
"min",
",",
"double",
"max",
")",
"{",
"if",
"(",
"min",
"<=",
"max",
")",
"{",
"this",
".",
"minx",
"=",
"min",
";",
"this",
".",
"maxx",
"=",
"max",
";",
"}",
"else",
"{",
"this",
".",
"minx",
"=",
"max",
";",
"this",
".",
"maxx",
"=",
"min",
";",
"}",
"}"
]
| Set the x bounds of the box.
@param min the min value for the x axis.
@param max the max value for the x axis. | [
"Set",
"the",
"x",
"bounds",
"of",
"the",
"box",
"."
]
| train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/AlignedBox3f.java#L603-L612 |
jboss/jboss-jsf-api_spec | src/main/java/javax/faces/application/ResourceHandlerWrapper.java | ResourceHandlerWrapper.createResource | @Override
public Resource createResource(String resourceName, String libraryName) {
"""
<p class="changed_added_2_0">The default behavior of this method
is to call {@link ResourceHandler#createResource(String, String)} on the wrapped
{@link ResourceHandler} object.</p>
"""
return getWrapped().createResource(resourceName, libraryName);
} | java | @Override
public Resource createResource(String resourceName, String libraryName) {
return getWrapped().createResource(resourceName, libraryName);
} | [
"@",
"Override",
"public",
"Resource",
"createResource",
"(",
"String",
"resourceName",
",",
"String",
"libraryName",
")",
"{",
"return",
"getWrapped",
"(",
")",
".",
"createResource",
"(",
"resourceName",
",",
"libraryName",
")",
";",
"}"
]
| <p class="changed_added_2_0">The default behavior of this method
is to call {@link ResourceHandler#createResource(String, String)} on the wrapped
{@link ResourceHandler} object.</p> | [
"<p",
"class",
"=",
"changed_added_2_0",
">",
"The",
"default",
"behavior",
"of",
"this",
"method",
"is",
"to",
"call",
"{"
]
| train | https://github.com/jboss/jboss-jsf-api_spec/blob/cb33d215acbab847f2db5cdf2c6fe4d99c0a01c3/src/main/java/javax/faces/application/ResourceHandlerWrapper.java#L109-L114 |
killbilling/recurly-java-library | src/main/java/com/ning/billing/recurly/RecurlyClient.java | RecurlyClient.updateAddOn | public AddOn updateAddOn(final String planCode, final String addOnCode, final AddOn addOn) {
"""
Updates an {@link AddOn} for a Plan
<p>
@param planCode The {@link Plan} object.
@param addOnCode The {@link AddOn} object to update.
@param addOn The updated {@link AddOn} data.
@return the updated {@link AddOn} object.
"""
return doPUT(Plan.PLANS_RESOURCE +
"/" +
planCode +
AddOn.ADDONS_RESOURCE +
"/" +
addOnCode,
addOn,
AddOn.class);
} | java | public AddOn updateAddOn(final String planCode, final String addOnCode, final AddOn addOn) {
return doPUT(Plan.PLANS_RESOURCE +
"/" +
planCode +
AddOn.ADDONS_RESOURCE +
"/" +
addOnCode,
addOn,
AddOn.class);
} | [
"public",
"AddOn",
"updateAddOn",
"(",
"final",
"String",
"planCode",
",",
"final",
"String",
"addOnCode",
",",
"final",
"AddOn",
"addOn",
")",
"{",
"return",
"doPUT",
"(",
"Plan",
".",
"PLANS_RESOURCE",
"+",
"\"/\"",
"+",
"planCode",
"+",
"AddOn",
".",
"ADDONS_RESOURCE",
"+",
"\"/\"",
"+",
"addOnCode",
",",
"addOn",
",",
"AddOn",
".",
"class",
")",
";",
"}"
]
| Updates an {@link AddOn} for a Plan
<p>
@param planCode The {@link Plan} object.
@param addOnCode The {@link AddOn} object to update.
@param addOn The updated {@link AddOn} data.
@return the updated {@link AddOn} object. | [
"Updates",
"an",
"{",
"@link",
"AddOn",
"}",
"for",
"a",
"Plan",
"<p",
">"
]
| train | https://github.com/killbilling/recurly-java-library/blob/5e05eedd91885a51e1aa8293bd41139d082cf7f4/src/main/java/com/ning/billing/recurly/RecurlyClient.java#L1525-L1534 |
Microsoft/malmo | Minecraft/src/main/java/com/microsoft/Malmo/MissionHandlers/RewardForStructureCopyingImplementation.java | RewardForStructureCopyingImplementation.getReward | @Override
public void getReward(MissionInit missionInit, MultidimensionalReward multidimReward) {
"""
Get the reward value for the current Minecraft state.
@param missionInit the MissionInit object for the currently running mission,
which may contain parameters for the reward requirements.
@param multidimReward
"""
super.getReward(missionInit, multidimReward);
if (this.rewardDensity == RewardDensityForBuildAndBreak.MISSION_END)
{
// Only send the reward at the very end of the mission.
if (multidimReward.isFinalReward() && this.reward != 0)
{
float adjusted_reward = adjustAndDistributeReward(this.reward, this.dimension, this.rscparams.getRewardDistribution());
multidimReward.add(this.dimension, adjusted_reward);
}
}
else
{
// Send reward immediately.
if (this.reward != 0)
{
synchronized (this)
{
float adjusted_reward = adjustAndDistributeReward(this.reward, this.dimension, this.rscparams.getRewardDistribution());
multidimReward.add(this.dimension, adjusted_reward);
this.reward = 0;
}
}
}
} | java | @Override
public void getReward(MissionInit missionInit, MultidimensionalReward multidimReward)
{
super.getReward(missionInit, multidimReward);
if (this.rewardDensity == RewardDensityForBuildAndBreak.MISSION_END)
{
// Only send the reward at the very end of the mission.
if (multidimReward.isFinalReward() && this.reward != 0)
{
float adjusted_reward = adjustAndDistributeReward(this.reward, this.dimension, this.rscparams.getRewardDistribution());
multidimReward.add(this.dimension, adjusted_reward);
}
}
else
{
// Send reward immediately.
if (this.reward != 0)
{
synchronized (this)
{
float adjusted_reward = adjustAndDistributeReward(this.reward, this.dimension, this.rscparams.getRewardDistribution());
multidimReward.add(this.dimension, adjusted_reward);
this.reward = 0;
}
}
}
} | [
"@",
"Override",
"public",
"void",
"getReward",
"(",
"MissionInit",
"missionInit",
",",
"MultidimensionalReward",
"multidimReward",
")",
"{",
"super",
".",
"getReward",
"(",
"missionInit",
",",
"multidimReward",
")",
";",
"if",
"(",
"this",
".",
"rewardDensity",
"==",
"RewardDensityForBuildAndBreak",
".",
"MISSION_END",
")",
"{",
"// Only send the reward at the very end of the mission.",
"if",
"(",
"multidimReward",
".",
"isFinalReward",
"(",
")",
"&&",
"this",
".",
"reward",
"!=",
"0",
")",
"{",
"float",
"adjusted_reward",
"=",
"adjustAndDistributeReward",
"(",
"this",
".",
"reward",
",",
"this",
".",
"dimension",
",",
"this",
".",
"rscparams",
".",
"getRewardDistribution",
"(",
")",
")",
";",
"multidimReward",
".",
"add",
"(",
"this",
".",
"dimension",
",",
"adjusted_reward",
")",
";",
"}",
"}",
"else",
"{",
"// Send reward immediately.",
"if",
"(",
"this",
".",
"reward",
"!=",
"0",
")",
"{",
"synchronized",
"(",
"this",
")",
"{",
"float",
"adjusted_reward",
"=",
"adjustAndDistributeReward",
"(",
"this",
".",
"reward",
",",
"this",
".",
"dimension",
",",
"this",
".",
"rscparams",
".",
"getRewardDistribution",
"(",
")",
")",
";",
"multidimReward",
".",
"add",
"(",
"this",
".",
"dimension",
",",
"adjusted_reward",
")",
";",
"this",
".",
"reward",
"=",
"0",
";",
"}",
"}",
"}",
"}"
]
| Get the reward value for the current Minecraft state.
@param missionInit the MissionInit object for the currently running mission,
which may contain parameters for the reward requirements.
@param multidimReward | [
"Get",
"the",
"reward",
"value",
"for",
"the",
"current",
"Minecraft",
"state",
"."
]
| train | https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/MissionHandlers/RewardForStructureCopyingImplementation.java#L52-L78 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/JSchemaInterpreterImpl.java | JSchemaInterpreterImpl.getMessageMap | static public MessageMap getMessageMap(JSchema sfs, int[] choices) throws JMFUninitializedAccessException {
"""
Method to retrieve (and possibly construct) the MessageMap for a particular
combination of choices.
"""
BigInteger multiChoice = MessageMap.getMultiChoice(choices, sfs);
return getMessageMap(sfs, multiChoice);
} | java | static public MessageMap getMessageMap(JSchema sfs, int[] choices) throws JMFUninitializedAccessException {
BigInteger multiChoice = MessageMap.getMultiChoice(choices, sfs);
return getMessageMap(sfs, multiChoice);
} | [
"static",
"public",
"MessageMap",
"getMessageMap",
"(",
"JSchema",
"sfs",
",",
"int",
"[",
"]",
"choices",
")",
"throws",
"JMFUninitializedAccessException",
"{",
"BigInteger",
"multiChoice",
"=",
"MessageMap",
".",
"getMultiChoice",
"(",
"choices",
",",
"sfs",
")",
";",
"return",
"getMessageMap",
"(",
"sfs",
",",
"multiChoice",
")",
";",
"}"
]
| Method to retrieve (and possibly construct) the MessageMap for a particular
combination of choices. | [
"Method",
"to",
"retrieve",
"(",
"and",
"possibly",
"construct",
")",
"the",
"MessageMap",
"for",
"a",
"particular",
"combination",
"of",
"choices",
"."
]
| train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/JSchemaInterpreterImpl.java#L133-L136 |
stagemonitor/stagemonitor | stagemonitor-configuration/src/main/java/org/stagemonitor/configuration/ConfigurationRegistry.java | ConfigurationRegistry.scheduleReloadAtRate | public void scheduleReloadAtRate(final long rate, TimeUnit timeUnit) {
"""
Schedules {@link #reloadDynamicConfigurationOptions()} at a fixed rate
@param rate the period between reloads
@param timeUnit the time unit of rate
"""
initThreadPool();
configurationReloader.scheduleAtFixedRate(new Runnable() {
@Override
public void run() {
logger.debug("Beginning scheduled configuration reload (interval is {} sec)...", rate);
reloadDynamicConfigurationOptions();
logger.debug("Finished scheduled configuration reload");
}
}, rate, rate, timeUnit);
} | java | public void scheduleReloadAtRate(final long rate, TimeUnit timeUnit) {
initThreadPool();
configurationReloader.scheduleAtFixedRate(new Runnable() {
@Override
public void run() {
logger.debug("Beginning scheduled configuration reload (interval is {} sec)...", rate);
reloadDynamicConfigurationOptions();
logger.debug("Finished scheduled configuration reload");
}
}, rate, rate, timeUnit);
} | [
"public",
"void",
"scheduleReloadAtRate",
"(",
"final",
"long",
"rate",
",",
"TimeUnit",
"timeUnit",
")",
"{",
"initThreadPool",
"(",
")",
";",
"configurationReloader",
".",
"scheduleAtFixedRate",
"(",
"new",
"Runnable",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"run",
"(",
")",
"{",
"logger",
".",
"debug",
"(",
"\"Beginning scheduled configuration reload (interval is {} sec)...\"",
",",
"rate",
")",
";",
"reloadDynamicConfigurationOptions",
"(",
")",
";",
"logger",
".",
"debug",
"(",
"\"Finished scheduled configuration reload\"",
")",
";",
"}",
"}",
",",
"rate",
",",
"rate",
",",
"timeUnit",
")",
";",
"}"
]
| Schedules {@link #reloadDynamicConfigurationOptions()} at a fixed rate
@param rate the period between reloads
@param timeUnit the time unit of rate | [
"Schedules",
"{",
"@link",
"#reloadDynamicConfigurationOptions",
"()",
"}",
"at",
"a",
"fixed",
"rate"
]
| train | https://github.com/stagemonitor/stagemonitor/blob/7a1bf6848906f816aa465983f602ea1f1e8f2b7b/stagemonitor-configuration/src/main/java/org/stagemonitor/configuration/ConfigurationRegistry.java#L261-L271 |
fozziethebeat/S-Space | src/main/java/edu/ucla/sspace/common/Similarity.java | Similarity.jaccardIndex | public static double jaccardIndex(IntegerVector a, IntegerVector b) {
"""
Computes the <a href="http://en.wikipedia.org/wiki/Jaccard_index">Jaccard
index</a> comparing the similarity both {@code IntegerVector}s when viewed
as sets of samples.
"""
Set<Integer> intersection = new HashSet<Integer>();
Set<Integer> union = new HashSet<Integer>();
for (int i = 0; i < a.length(); ++i) {
int d = a.get(i);
intersection.add(d);
union.add(d);
}
Set<Integer> tmp = new HashSet<Integer>();
for (int i = 0; i < b.length(); ++i) {
int d = b.get(i);
tmp.add(d);
union.add(d);
}
intersection.retainAll(tmp);
return ((double)(intersection.size())) / union.size();
} | java | public static double jaccardIndex(IntegerVector a, IntegerVector b) {
Set<Integer> intersection = new HashSet<Integer>();
Set<Integer> union = new HashSet<Integer>();
for (int i = 0; i < a.length(); ++i) {
int d = a.get(i);
intersection.add(d);
union.add(d);
}
Set<Integer> tmp = new HashSet<Integer>();
for (int i = 0; i < b.length(); ++i) {
int d = b.get(i);
tmp.add(d);
union.add(d);
}
intersection.retainAll(tmp);
return ((double)(intersection.size())) / union.size();
} | [
"public",
"static",
"double",
"jaccardIndex",
"(",
"IntegerVector",
"a",
",",
"IntegerVector",
"b",
")",
"{",
"Set",
"<",
"Integer",
">",
"intersection",
"=",
"new",
"HashSet",
"<",
"Integer",
">",
"(",
")",
";",
"Set",
"<",
"Integer",
">",
"union",
"=",
"new",
"HashSet",
"<",
"Integer",
">",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"a",
".",
"length",
"(",
")",
";",
"++",
"i",
")",
"{",
"int",
"d",
"=",
"a",
".",
"get",
"(",
"i",
")",
";",
"intersection",
".",
"add",
"(",
"d",
")",
";",
"union",
".",
"add",
"(",
"d",
")",
";",
"}",
"Set",
"<",
"Integer",
">",
"tmp",
"=",
"new",
"HashSet",
"<",
"Integer",
">",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"b",
".",
"length",
"(",
")",
";",
"++",
"i",
")",
"{",
"int",
"d",
"=",
"b",
".",
"get",
"(",
"i",
")",
";",
"tmp",
".",
"add",
"(",
"d",
")",
";",
"union",
".",
"add",
"(",
"d",
")",
";",
"}",
"intersection",
".",
"retainAll",
"(",
"tmp",
")",
";",
"return",
"(",
"(",
"double",
")",
"(",
"intersection",
".",
"size",
"(",
")",
")",
")",
"/",
"union",
".",
"size",
"(",
")",
";",
"}"
]
| Computes the <a href="http://en.wikipedia.org/wiki/Jaccard_index">Jaccard
index</a> comparing the similarity both {@code IntegerVector}s when viewed
as sets of samples. | [
"Computes",
"the",
"<a",
"href",
"=",
"http",
":",
"//",
"en",
".",
"wikipedia",
".",
"org",
"/",
"wiki",
"/",
"Jaccard_index",
">",
"Jaccard",
"index<",
"/",
"a",
">",
"comparing",
"the",
"similarity",
"both",
"{"
]
| train | https://github.com/fozziethebeat/S-Space/blob/a608102737dfd3d59038a9ead33fe60356bc6029/src/main/java/edu/ucla/sspace/common/Similarity.java#L981-L998 |
cdk/cdk | base/core/src/main/java/org/openscience/cdk/graph/Cycles.java | Cycles.markRingAtomsAndBonds | public static int markRingAtomsAndBonds(IAtomContainer mol, int[][] adjList, EdgeToBondMap bondMap) {
"""
Find and mark all cyclic atoms and bonds in the provided molecule. This optimised version
allows the caller to optionally provided indexed fast access structure which would otherwise
be created.
@param mol molecule
@see IBond#isInRing()
@see IAtom#isInRing()
@return Number of rings found (circuit rank)
@see <a href="https://en.wikipedia.org/wiki/Circuit_rank">Circuit Rank</a>
"""
RingSearch ringSearch = new RingSearch(mol, adjList);
for (int v = 0; v < mol.getAtomCount(); v++) {
mol.getAtom(v).setIsInRing(false);
for (int w : adjList[v]) {
// note we only mark the bond on second visit (first v < w) and
// clear flag on first visit (or if non-cyclic)
if (v > w && ringSearch.cyclic(v, w)) {
bondMap.get(v, w).setIsInRing(true);
mol.getAtom(v).setIsInRing(true);
mol.getAtom(w).setIsInRing(true);
} else {
bondMap.get(v, w).setIsInRing(false);
}
}
}
return ringSearch.numRings();
} | java | public static int markRingAtomsAndBonds(IAtomContainer mol, int[][] adjList, EdgeToBondMap bondMap) {
RingSearch ringSearch = new RingSearch(mol, adjList);
for (int v = 0; v < mol.getAtomCount(); v++) {
mol.getAtom(v).setIsInRing(false);
for (int w : adjList[v]) {
// note we only mark the bond on second visit (first v < w) and
// clear flag on first visit (or if non-cyclic)
if (v > w && ringSearch.cyclic(v, w)) {
bondMap.get(v, w).setIsInRing(true);
mol.getAtom(v).setIsInRing(true);
mol.getAtom(w).setIsInRing(true);
} else {
bondMap.get(v, w).setIsInRing(false);
}
}
}
return ringSearch.numRings();
} | [
"public",
"static",
"int",
"markRingAtomsAndBonds",
"(",
"IAtomContainer",
"mol",
",",
"int",
"[",
"]",
"[",
"]",
"adjList",
",",
"EdgeToBondMap",
"bondMap",
")",
"{",
"RingSearch",
"ringSearch",
"=",
"new",
"RingSearch",
"(",
"mol",
",",
"adjList",
")",
";",
"for",
"(",
"int",
"v",
"=",
"0",
";",
"v",
"<",
"mol",
".",
"getAtomCount",
"(",
")",
";",
"v",
"++",
")",
"{",
"mol",
".",
"getAtom",
"(",
"v",
")",
".",
"setIsInRing",
"(",
"false",
")",
";",
"for",
"(",
"int",
"w",
":",
"adjList",
"[",
"v",
"]",
")",
"{",
"// note we only mark the bond on second visit (first v < w) and",
"// clear flag on first visit (or if non-cyclic)",
"if",
"(",
"v",
">",
"w",
"&&",
"ringSearch",
".",
"cyclic",
"(",
"v",
",",
"w",
")",
")",
"{",
"bondMap",
".",
"get",
"(",
"v",
",",
"w",
")",
".",
"setIsInRing",
"(",
"true",
")",
";",
"mol",
".",
"getAtom",
"(",
"v",
")",
".",
"setIsInRing",
"(",
"true",
")",
";",
"mol",
".",
"getAtom",
"(",
"w",
")",
".",
"setIsInRing",
"(",
"true",
")",
";",
"}",
"else",
"{",
"bondMap",
".",
"get",
"(",
"v",
",",
"w",
")",
".",
"setIsInRing",
"(",
"false",
")",
";",
"}",
"}",
"}",
"return",
"ringSearch",
".",
"numRings",
"(",
")",
";",
"}"
]
| Find and mark all cyclic atoms and bonds in the provided molecule. This optimised version
allows the caller to optionally provided indexed fast access structure which would otherwise
be created.
@param mol molecule
@see IBond#isInRing()
@see IAtom#isInRing()
@return Number of rings found (circuit rank)
@see <a href="https://en.wikipedia.org/wiki/Circuit_rank">Circuit Rank</a> | [
"Find",
"and",
"mark",
"all",
"cyclic",
"atoms",
"and",
"bonds",
"in",
"the",
"provided",
"molecule",
".",
"This",
"optimised",
"version",
"allows",
"the",
"caller",
"to",
"optionally",
"provided",
"indexed",
"fast",
"access",
"structure",
"which",
"would",
"otherwise",
"be",
"created",
"."
]
| train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/core/src/main/java/org/openscience/cdk/graph/Cycles.java#L439-L456 |
alkacon/opencms-core | src-gwt/org/opencms/ade/containerpage/client/CmsContainerpageDNDController.java | CmsContainerpageDNDController.prepareDragInfo | private void prepareDragInfo(Element placeholder, I_CmsDropContainer target, CmsDNDHandler handler) {
"""
Sets styles of helper elements, appends the to the drop target and puts them into a drag info bean.<p>
@param placeholder the placeholder element
@param target the drop target
@param handler the drag and drop handler
"""
target.getElement().addClassName(I_CmsLayoutBundle.INSTANCE.dragdropCss().dragging());
String positioning = CmsDomUtil.getCurrentStyle(
target.getElement(),
org.opencms.gwt.client.util.CmsDomUtil.Style.position);
// set target relative, if not absolute or fixed
if (!Position.ABSOLUTE.getCssName().equals(positioning) && !Position.FIXED.getCssName().equals(positioning)) {
target.getElement().getStyle().setPosition(Position.RELATIVE);
// check for empty containers that don't have a minimum top and bottom margin to avoid containers overlapping
if (target.getElement().getFirstChildElement() == null) {
if (CmsDomUtil.getCurrentStyleInt(
target.getElement(),
CmsDomUtil.Style.marginTop) < MINIMUM_CONTAINER_MARGIN) {
target.getElement().getStyle().setMarginTop(MINIMUM_CONTAINER_MARGIN, Unit.PX);
}
if (CmsDomUtil.getCurrentStyleInt(
target.getElement(),
CmsDomUtil.Style.marginBottom) < MINIMUM_CONTAINER_MARGIN) {
target.getElement().getStyle().setMarginBottom(MINIMUM_CONTAINER_MARGIN, Unit.PX);
}
}
}
m_dragInfos.put(target, placeholder);
handler.addTarget(target);
} | java | private void prepareDragInfo(Element placeholder, I_CmsDropContainer target, CmsDNDHandler handler) {
target.getElement().addClassName(I_CmsLayoutBundle.INSTANCE.dragdropCss().dragging());
String positioning = CmsDomUtil.getCurrentStyle(
target.getElement(),
org.opencms.gwt.client.util.CmsDomUtil.Style.position);
// set target relative, if not absolute or fixed
if (!Position.ABSOLUTE.getCssName().equals(positioning) && !Position.FIXED.getCssName().equals(positioning)) {
target.getElement().getStyle().setPosition(Position.RELATIVE);
// check for empty containers that don't have a minimum top and bottom margin to avoid containers overlapping
if (target.getElement().getFirstChildElement() == null) {
if (CmsDomUtil.getCurrentStyleInt(
target.getElement(),
CmsDomUtil.Style.marginTop) < MINIMUM_CONTAINER_MARGIN) {
target.getElement().getStyle().setMarginTop(MINIMUM_CONTAINER_MARGIN, Unit.PX);
}
if (CmsDomUtil.getCurrentStyleInt(
target.getElement(),
CmsDomUtil.Style.marginBottom) < MINIMUM_CONTAINER_MARGIN) {
target.getElement().getStyle().setMarginBottom(MINIMUM_CONTAINER_MARGIN, Unit.PX);
}
}
}
m_dragInfos.put(target, placeholder);
handler.addTarget(target);
} | [
"private",
"void",
"prepareDragInfo",
"(",
"Element",
"placeholder",
",",
"I_CmsDropContainer",
"target",
",",
"CmsDNDHandler",
"handler",
")",
"{",
"target",
".",
"getElement",
"(",
")",
".",
"addClassName",
"(",
"I_CmsLayoutBundle",
".",
"INSTANCE",
".",
"dragdropCss",
"(",
")",
".",
"dragging",
"(",
")",
")",
";",
"String",
"positioning",
"=",
"CmsDomUtil",
".",
"getCurrentStyle",
"(",
"target",
".",
"getElement",
"(",
")",
",",
"org",
".",
"opencms",
".",
"gwt",
".",
"client",
".",
"util",
".",
"CmsDomUtil",
".",
"Style",
".",
"position",
")",
";",
"// set target relative, if not absolute or fixed",
"if",
"(",
"!",
"Position",
".",
"ABSOLUTE",
".",
"getCssName",
"(",
")",
".",
"equals",
"(",
"positioning",
")",
"&&",
"!",
"Position",
".",
"FIXED",
".",
"getCssName",
"(",
")",
".",
"equals",
"(",
"positioning",
")",
")",
"{",
"target",
".",
"getElement",
"(",
")",
".",
"getStyle",
"(",
")",
".",
"setPosition",
"(",
"Position",
".",
"RELATIVE",
")",
";",
"// check for empty containers that don't have a minimum top and bottom margin to avoid containers overlapping",
"if",
"(",
"target",
".",
"getElement",
"(",
")",
".",
"getFirstChildElement",
"(",
")",
"==",
"null",
")",
"{",
"if",
"(",
"CmsDomUtil",
".",
"getCurrentStyleInt",
"(",
"target",
".",
"getElement",
"(",
")",
",",
"CmsDomUtil",
".",
"Style",
".",
"marginTop",
")",
"<",
"MINIMUM_CONTAINER_MARGIN",
")",
"{",
"target",
".",
"getElement",
"(",
")",
".",
"getStyle",
"(",
")",
".",
"setMarginTop",
"(",
"MINIMUM_CONTAINER_MARGIN",
",",
"Unit",
".",
"PX",
")",
";",
"}",
"if",
"(",
"CmsDomUtil",
".",
"getCurrentStyleInt",
"(",
"target",
".",
"getElement",
"(",
")",
",",
"CmsDomUtil",
".",
"Style",
".",
"marginBottom",
")",
"<",
"MINIMUM_CONTAINER_MARGIN",
")",
"{",
"target",
".",
"getElement",
"(",
")",
".",
"getStyle",
"(",
")",
".",
"setMarginBottom",
"(",
"MINIMUM_CONTAINER_MARGIN",
",",
"Unit",
".",
"PX",
")",
";",
"}",
"}",
"}",
"m_dragInfos",
".",
"put",
"(",
"target",
",",
"placeholder",
")",
";",
"handler",
".",
"addTarget",
"(",
"target",
")",
";",
"}"
]
| Sets styles of helper elements, appends the to the drop target and puts them into a drag info bean.<p>
@param placeholder the placeholder element
@param target the drop target
@param handler the drag and drop handler | [
"Sets",
"styles",
"of",
"helper",
"elements",
"appends",
"the",
"to",
"the",
"drop",
"target",
"and",
"puts",
"them",
"into",
"a",
"drag",
"info",
"bean",
".",
"<p",
">"
]
| train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/containerpage/client/CmsContainerpageDNDController.java#L851-L876 |
VoltDB/voltdb | src/frontend/org/voltdb/sysprocs/saverestore/HashinatorSnapshotData.java | HashinatorSnapshotData.restoreFromBuffer | public InstanceId restoreFromBuffer(ByteBuffer buf)
throws IOException {
"""
Restore and check hashinator config data.
@param buf input buffer
@return instance ID read from buffer
@throws I/O exception on failure
"""
buf.rewind();
// Assumes config data is the last field.
int dataSize = buf.remaining() - OFFSET_DATA;
if (dataSize <= 0) {
throw new IOException("Hashinator snapshot data is too small.");
}
// Get the CRC, zero out its buffer field, and compare to calculated CRC.
long crcHeader = buf.getLong(OFFSET_CRC);
buf.putLong(OFFSET_CRC, 0);
final PureJavaCrc32 crcBuffer = new PureJavaCrc32();
assert(buf.hasArray());
crcBuffer.update(buf.array());
if (crcHeader != crcBuffer.getValue()) {
throw new IOException("Hashinator snapshot data CRC mismatch.");
}
// Slurp the data.
int coord = buf.getInt(OFFSET_INSTID_COORD);
long timestamp = buf.getLong(OFFSET_INSTID_TIMESTAMP);
InstanceId instId = new InstanceId(coord, timestamp);
m_version = buf.getLong(OFFSET_VERSION);
m_serData = new byte[dataSize];
buf.position(OFFSET_DATA);
buf.get(m_serData);
return instId;
} | java | public InstanceId restoreFromBuffer(ByteBuffer buf)
throws IOException
{
buf.rewind();
// Assumes config data is the last field.
int dataSize = buf.remaining() - OFFSET_DATA;
if (dataSize <= 0) {
throw new IOException("Hashinator snapshot data is too small.");
}
// Get the CRC, zero out its buffer field, and compare to calculated CRC.
long crcHeader = buf.getLong(OFFSET_CRC);
buf.putLong(OFFSET_CRC, 0);
final PureJavaCrc32 crcBuffer = new PureJavaCrc32();
assert(buf.hasArray());
crcBuffer.update(buf.array());
if (crcHeader != crcBuffer.getValue()) {
throw new IOException("Hashinator snapshot data CRC mismatch.");
}
// Slurp the data.
int coord = buf.getInt(OFFSET_INSTID_COORD);
long timestamp = buf.getLong(OFFSET_INSTID_TIMESTAMP);
InstanceId instId = new InstanceId(coord, timestamp);
m_version = buf.getLong(OFFSET_VERSION);
m_serData = new byte[dataSize];
buf.position(OFFSET_DATA);
buf.get(m_serData);
return instId;
} | [
"public",
"InstanceId",
"restoreFromBuffer",
"(",
"ByteBuffer",
"buf",
")",
"throws",
"IOException",
"{",
"buf",
".",
"rewind",
"(",
")",
";",
"// Assumes config data is the last field.",
"int",
"dataSize",
"=",
"buf",
".",
"remaining",
"(",
")",
"-",
"OFFSET_DATA",
";",
"if",
"(",
"dataSize",
"<=",
"0",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"Hashinator snapshot data is too small.\"",
")",
";",
"}",
"// Get the CRC, zero out its buffer field, and compare to calculated CRC.",
"long",
"crcHeader",
"=",
"buf",
".",
"getLong",
"(",
"OFFSET_CRC",
")",
";",
"buf",
".",
"putLong",
"(",
"OFFSET_CRC",
",",
"0",
")",
";",
"final",
"PureJavaCrc32",
"crcBuffer",
"=",
"new",
"PureJavaCrc32",
"(",
")",
";",
"assert",
"(",
"buf",
".",
"hasArray",
"(",
")",
")",
";",
"crcBuffer",
".",
"update",
"(",
"buf",
".",
"array",
"(",
")",
")",
";",
"if",
"(",
"crcHeader",
"!=",
"crcBuffer",
".",
"getValue",
"(",
")",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"Hashinator snapshot data CRC mismatch.\"",
")",
";",
"}",
"// Slurp the data.",
"int",
"coord",
"=",
"buf",
".",
"getInt",
"(",
"OFFSET_INSTID_COORD",
")",
";",
"long",
"timestamp",
"=",
"buf",
".",
"getLong",
"(",
"OFFSET_INSTID_TIMESTAMP",
")",
";",
"InstanceId",
"instId",
"=",
"new",
"InstanceId",
"(",
"coord",
",",
"timestamp",
")",
";",
"m_version",
"=",
"buf",
".",
"getLong",
"(",
"OFFSET_VERSION",
")",
";",
"m_serData",
"=",
"new",
"byte",
"[",
"dataSize",
"]",
";",
"buf",
".",
"position",
"(",
"OFFSET_DATA",
")",
";",
"buf",
".",
"get",
"(",
"m_serData",
")",
";",
"return",
"instId",
";",
"}"
]
| Restore and check hashinator config data.
@param buf input buffer
@return instance ID read from buffer
@throws I/O exception on failure | [
"Restore",
"and",
"check",
"hashinator",
"config",
"data",
"."
]
| train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/sysprocs/saverestore/HashinatorSnapshotData.java#L110-L141 |
javagl/CommonUI | src/main/java/de/javagl/common/ui/text/JTextComponents.java | JTextComponents.findPrevious | static Point findPrevious(
String text, String query, int startIndex, boolean ignoreCase) {
"""
Find the previous appearance of the given query in the given text,
starting at the given index. The result will be a point
<code>(startIndex, endIndex)</code> indicating the appearance,
or <code>null</code> if none is found.
@param text The text
@param query The query
@param startIndex The start index
@param ignoreCase Whether the case should be ignored
@return The previous appearance
"""
int offset = StringUtils.lastIndexOf(
text, query, startIndex, ignoreCase);
int length = query.length();
while (offset != -1)
{
return new Point(offset, offset + length);
}
return null;
} | java | static Point findPrevious(
String text, String query, int startIndex, boolean ignoreCase)
{
int offset = StringUtils.lastIndexOf(
text, query, startIndex, ignoreCase);
int length = query.length();
while (offset != -1)
{
return new Point(offset, offset + length);
}
return null;
} | [
"static",
"Point",
"findPrevious",
"(",
"String",
"text",
",",
"String",
"query",
",",
"int",
"startIndex",
",",
"boolean",
"ignoreCase",
")",
"{",
"int",
"offset",
"=",
"StringUtils",
".",
"lastIndexOf",
"(",
"text",
",",
"query",
",",
"startIndex",
",",
"ignoreCase",
")",
";",
"int",
"length",
"=",
"query",
".",
"length",
"(",
")",
";",
"while",
"(",
"offset",
"!=",
"-",
"1",
")",
"{",
"return",
"new",
"Point",
"(",
"offset",
",",
"offset",
"+",
"length",
")",
";",
"}",
"return",
"null",
";",
"}"
]
| Find the previous appearance of the given query in the given text,
starting at the given index. The result will be a point
<code>(startIndex, endIndex)</code> indicating the appearance,
or <code>null</code> if none is found.
@param text The text
@param query The query
@param startIndex The start index
@param ignoreCase Whether the case should be ignored
@return The previous appearance | [
"Find",
"the",
"previous",
"appearance",
"of",
"the",
"given",
"query",
"in",
"the",
"given",
"text",
"starting",
"at",
"the",
"given",
"index",
".",
"The",
"result",
"will",
"be",
"a",
"point",
"<code",
">",
"(",
"startIndex",
"endIndex",
")",
"<",
"/",
"code",
">",
"indicating",
"the",
"appearance",
"or",
"<code",
">",
"null<",
"/",
"code",
">",
"if",
"none",
"is",
"found",
"."
]
| train | https://github.com/javagl/CommonUI/blob/b2c7a7637d4e288271392ba148dc17e4c9780255/src/main/java/de/javagl/common/ui/text/JTextComponents.java#L90-L101 |
jferard/fastods | fastods/src/main/java/com/github/jferard/fastods/odselement/OdsElements.java | OdsElements.writeMeta | public void writeMeta(final XMLUtil xmlUtil, final ZipUTF8Writer writer) throws IOException {
"""
Write the meta element to a writer.
@param xmlUtil the xml util
@param writer the writer
@throws IOException if write fails
"""
this.logger.log(Level.FINER, "Writing odselement: metaElement to zip file");
this.metaElement.write(xmlUtil, writer);
} | java | public void writeMeta(final XMLUtil xmlUtil, final ZipUTF8Writer writer) throws IOException {
this.logger.log(Level.FINER, "Writing odselement: metaElement to zip file");
this.metaElement.write(xmlUtil, writer);
} | [
"public",
"void",
"writeMeta",
"(",
"final",
"XMLUtil",
"xmlUtil",
",",
"final",
"ZipUTF8Writer",
"writer",
")",
"throws",
"IOException",
"{",
"this",
".",
"logger",
".",
"log",
"(",
"Level",
".",
"FINER",
",",
"\"Writing odselement: metaElement to zip file\"",
")",
";",
"this",
".",
"metaElement",
".",
"write",
"(",
"xmlUtil",
",",
"writer",
")",
";",
"}"
]
| Write the meta element to a writer.
@param xmlUtil the xml util
@param writer the writer
@throws IOException if write fails | [
"Write",
"the",
"meta",
"element",
"to",
"a",
"writer",
"."
]
| train | https://github.com/jferard/fastods/blob/a034d173083ffa602dc525699b97f753082eaef9/fastods/src/main/java/com/github/jferard/fastods/odselement/OdsElements.java#L399-L402 |
apache/incubator-gobblin | gobblin-salesforce/src/main/java/org/apache/gobblin/salesforce/SalesforceSource.java | SalesforceSource.getHistogramRecursively | private void getHistogramRecursively(TableCountProbingContext probingContext, Histogram histogram, StrSubstitutor sub,
Map<String, String> values, int count, long startEpoch, long endEpoch) {
"""
Split a histogram bucket along the midpoint if it is larger than the bucket size limit.
"""
long midpointEpoch = startEpoch + (endEpoch - startEpoch) / 2;
// don't split further if small, above the probe limit, or less than 1 second difference between the midpoint and start
if (count <= probingContext.bucketSizeLimit
|| probingContext.probeCount > probingContext.probeLimit
|| (midpointEpoch - startEpoch < MIN_SPLIT_TIME_MILLIS)) {
histogram.add(new HistogramGroup(Utils.epochToDate(startEpoch, SECONDS_FORMAT), count));
return;
}
int countLeft = getCountForRange(probingContext, sub, values, startEpoch, midpointEpoch);
getHistogramRecursively(probingContext, histogram, sub, values, countLeft, startEpoch, midpointEpoch);
log.debug("Count {} for left partition {} to {}", countLeft, startEpoch, midpointEpoch);
int countRight = count - countLeft;
getHistogramRecursively(probingContext, histogram, sub, values, countRight, midpointEpoch, endEpoch);
log.debug("Count {} for right partition {} to {}", countRight, midpointEpoch, endEpoch);
} | java | private void getHistogramRecursively(TableCountProbingContext probingContext, Histogram histogram, StrSubstitutor sub,
Map<String, String> values, int count, long startEpoch, long endEpoch) {
long midpointEpoch = startEpoch + (endEpoch - startEpoch) / 2;
// don't split further if small, above the probe limit, or less than 1 second difference between the midpoint and start
if (count <= probingContext.bucketSizeLimit
|| probingContext.probeCount > probingContext.probeLimit
|| (midpointEpoch - startEpoch < MIN_SPLIT_TIME_MILLIS)) {
histogram.add(new HistogramGroup(Utils.epochToDate(startEpoch, SECONDS_FORMAT), count));
return;
}
int countLeft = getCountForRange(probingContext, sub, values, startEpoch, midpointEpoch);
getHistogramRecursively(probingContext, histogram, sub, values, countLeft, startEpoch, midpointEpoch);
log.debug("Count {} for left partition {} to {}", countLeft, startEpoch, midpointEpoch);
int countRight = count - countLeft;
getHistogramRecursively(probingContext, histogram, sub, values, countRight, midpointEpoch, endEpoch);
log.debug("Count {} for right partition {} to {}", countRight, midpointEpoch, endEpoch);
} | [
"private",
"void",
"getHistogramRecursively",
"(",
"TableCountProbingContext",
"probingContext",
",",
"Histogram",
"histogram",
",",
"StrSubstitutor",
"sub",
",",
"Map",
"<",
"String",
",",
"String",
">",
"values",
",",
"int",
"count",
",",
"long",
"startEpoch",
",",
"long",
"endEpoch",
")",
"{",
"long",
"midpointEpoch",
"=",
"startEpoch",
"+",
"(",
"endEpoch",
"-",
"startEpoch",
")",
"/",
"2",
";",
"// don't split further if small, above the probe limit, or less than 1 second difference between the midpoint and start",
"if",
"(",
"count",
"<=",
"probingContext",
".",
"bucketSizeLimit",
"||",
"probingContext",
".",
"probeCount",
">",
"probingContext",
".",
"probeLimit",
"||",
"(",
"midpointEpoch",
"-",
"startEpoch",
"<",
"MIN_SPLIT_TIME_MILLIS",
")",
")",
"{",
"histogram",
".",
"add",
"(",
"new",
"HistogramGroup",
"(",
"Utils",
".",
"epochToDate",
"(",
"startEpoch",
",",
"SECONDS_FORMAT",
")",
",",
"count",
")",
")",
";",
"return",
";",
"}",
"int",
"countLeft",
"=",
"getCountForRange",
"(",
"probingContext",
",",
"sub",
",",
"values",
",",
"startEpoch",
",",
"midpointEpoch",
")",
";",
"getHistogramRecursively",
"(",
"probingContext",
",",
"histogram",
",",
"sub",
",",
"values",
",",
"countLeft",
",",
"startEpoch",
",",
"midpointEpoch",
")",
";",
"log",
".",
"debug",
"(",
"\"Count {} for left partition {} to {}\"",
",",
"countLeft",
",",
"startEpoch",
",",
"midpointEpoch",
")",
";",
"int",
"countRight",
"=",
"count",
"-",
"countLeft",
";",
"getHistogramRecursively",
"(",
"probingContext",
",",
"histogram",
",",
"sub",
",",
"values",
",",
"countRight",
",",
"midpointEpoch",
",",
"endEpoch",
")",
";",
"log",
".",
"debug",
"(",
"\"Count {} for right partition {} to {}\"",
",",
"countRight",
",",
"midpointEpoch",
",",
"endEpoch",
")",
";",
"}"
]
| Split a histogram bucket along the midpoint if it is larger than the bucket size limit. | [
"Split",
"a",
"histogram",
"bucket",
"along",
"the",
"midpoint",
"if",
"it",
"is",
"larger",
"than",
"the",
"bucket",
"size",
"limit",
"."
]
| train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-salesforce/src/main/java/org/apache/gobblin/salesforce/SalesforceSource.java#L341-L362 |
HanSolo/SteelSeries-Swing | src/main/java/eu/hansolo/steelseries/gauges/SparkLine.java | SparkLine.continuousAverage | private double continuousAverage(final double Y0, final double Y1, final double Y2) {
"""
Returns the value smoothed by a continuous average function
@param Y0
@param Y1
@param Y2
@return the value smoothed by a continous average function
"""
final double A = 1;
final double B = 1;
final double C = 1;
return ((A * Y0) + (B * Y1) + (C * Y2)) / (A + B + C);
} | java | private double continuousAverage(final double Y0, final double Y1, final double Y2) {
final double A = 1;
final double B = 1;
final double C = 1;
return ((A * Y0) + (B * Y1) + (C * Y2)) / (A + B + C);
} | [
"private",
"double",
"continuousAverage",
"(",
"final",
"double",
"Y0",
",",
"final",
"double",
"Y1",
",",
"final",
"double",
"Y2",
")",
"{",
"final",
"double",
"A",
"=",
"1",
";",
"final",
"double",
"B",
"=",
"1",
";",
"final",
"double",
"C",
"=",
"1",
";",
"return",
"(",
"(",
"A",
"*",
"Y0",
")",
"+",
"(",
"B",
"*",
"Y1",
")",
"+",
"(",
"C",
"*",
"Y2",
")",
")",
"/",
"(",
"A",
"+",
"B",
"+",
"C",
")",
";",
"}"
]
| Returns the value smoothed by a continuous average function
@param Y0
@param Y1
@param Y2
@return the value smoothed by a continous average function | [
"Returns",
"the",
"value",
"smoothed",
"by",
"a",
"continuous",
"average",
"function"
]
| train | https://github.com/HanSolo/SteelSeries-Swing/blob/c2f7b45a477757ef21bbb6a1174ddedb2250ae57/src/main/java/eu/hansolo/steelseries/gauges/SparkLine.java#L1068-L1074 |
indeedeng/util | util-core/src/main/java/com/indeed/util/core/io/Closeables2.java | Closeables2.forIterable2 | public static <C extends Closeable, T extends Iterable<C>> Closeable forIterable2(
@Nonnull final Logger log,
@Nonnull final Iterable<T> closeables
) {
"""
Create a composite {@link Closeable} that will close all the wrapped
{@code closeables} references. The {@link Closeable#close()} method will
perform a safe close of all wrapped Closeable objects. This is needed
since successive calls of the {@link #closeAll(Logger, Closeable...)}
method is not exception safe without an extra layer of try / finally.
This method iterates the provided
{@code Iterable<? extends Iterable<? extends Closeable>>} and closes
all subsequent Closeable objects.
@param log The logger to write error messages out to.
@param closeables An iterator over iterable Closeables.
@param <C> A class that implements the {@link Closeable} interface.
@param <T> An iterable collection that contains {@link Closeable} objects.
@return A composite closeable that wraps all underlying {@code closeables}.
"""
return new Closeable() {
public void close() throws IOException {
closeAll(log, Iterables.transform(closeables, new Function<T, Closeable>() {
public Closeable apply(final @Nullable T input) {
if (input == null) {
return new Closeable() {
public void close() throws IOException {}
};
} else {
return forIterable(log, input);
}
}
}));
}
};
} | java | public static <C extends Closeable, T extends Iterable<C>> Closeable forIterable2(
@Nonnull final Logger log,
@Nonnull final Iterable<T> closeables
) {
return new Closeable() {
public void close() throws IOException {
closeAll(log, Iterables.transform(closeables, new Function<T, Closeable>() {
public Closeable apply(final @Nullable T input) {
if (input == null) {
return new Closeable() {
public void close() throws IOException {}
};
} else {
return forIterable(log, input);
}
}
}));
}
};
} | [
"public",
"static",
"<",
"C",
"extends",
"Closeable",
",",
"T",
"extends",
"Iterable",
"<",
"C",
">",
">",
"Closeable",
"forIterable2",
"(",
"@",
"Nonnull",
"final",
"Logger",
"log",
",",
"@",
"Nonnull",
"final",
"Iterable",
"<",
"T",
">",
"closeables",
")",
"{",
"return",
"new",
"Closeable",
"(",
")",
"{",
"public",
"void",
"close",
"(",
")",
"throws",
"IOException",
"{",
"closeAll",
"(",
"log",
",",
"Iterables",
".",
"transform",
"(",
"closeables",
",",
"new",
"Function",
"<",
"T",
",",
"Closeable",
">",
"(",
")",
"{",
"public",
"Closeable",
"apply",
"(",
"final",
"@",
"Nullable",
"T",
"input",
")",
"{",
"if",
"(",
"input",
"==",
"null",
")",
"{",
"return",
"new",
"Closeable",
"(",
")",
"{",
"public",
"void",
"close",
"(",
")",
"throws",
"IOException",
"{",
"}",
"}",
";",
"}",
"else",
"{",
"return",
"forIterable",
"(",
"log",
",",
"input",
")",
";",
"}",
"}",
"}",
")",
")",
";",
"}",
"}",
";",
"}"
]
| Create a composite {@link Closeable} that will close all the wrapped
{@code closeables} references. The {@link Closeable#close()} method will
perform a safe close of all wrapped Closeable objects. This is needed
since successive calls of the {@link #closeAll(Logger, Closeable...)}
method is not exception safe without an extra layer of try / finally.
This method iterates the provided
{@code Iterable<? extends Iterable<? extends Closeable>>} and closes
all subsequent Closeable objects.
@param log The logger to write error messages out to.
@param closeables An iterator over iterable Closeables.
@param <C> A class that implements the {@link Closeable} interface.
@param <T> An iterable collection that contains {@link Closeable} objects.
@return A composite closeable that wraps all underlying {@code closeables}. | [
"Create",
"a",
"composite",
"{",
"@link",
"Closeable",
"}",
"that",
"will",
"close",
"all",
"the",
"wrapped",
"{",
"@code",
"closeables",
"}",
"references",
".",
"The",
"{",
"@link",
"Closeable#close",
"()",
"}",
"method",
"will",
"perform",
"a",
"safe",
"close",
"of",
"all",
"wrapped",
"Closeable",
"objects",
".",
"This",
"is",
"needed",
"since",
"successive",
"calls",
"of",
"the",
"{",
"@link",
"#closeAll",
"(",
"Logger",
"Closeable",
"...",
")",
"}",
"method",
"is",
"not",
"exception",
"safe",
"without",
"an",
"extra",
"layer",
"of",
"try",
"/",
"finally",
"."
]
| train | https://github.com/indeedeng/util/blob/332008426cf14b57e7fc3e817d9423e3f84fb922/util-core/src/main/java/com/indeed/util/core/io/Closeables2.java#L139-L158 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/lang/Validator.java | Validator.validatePlateNumber | public static <T extends CharSequence> T validatePlateNumber(T value, String errorMsg) throws ValidateException {
"""
验证是否为中国车牌号
@param <T> 字符串类型
@param value 值
@param errorMsg 验证错误的信息
@return 验证后的值
@throws ValidateException 验证异常
@since 3.0.6
"""
if (false == isPlateNumber(value)) {
throw new ValidateException(errorMsg);
}
return value;
} | java | public static <T extends CharSequence> T validatePlateNumber(T value, String errorMsg) throws ValidateException {
if (false == isPlateNumber(value)) {
throw new ValidateException(errorMsg);
}
return value;
} | [
"public",
"static",
"<",
"T",
"extends",
"CharSequence",
">",
"T",
"validatePlateNumber",
"(",
"T",
"value",
",",
"String",
"errorMsg",
")",
"throws",
"ValidateException",
"{",
"if",
"(",
"false",
"==",
"isPlateNumber",
"(",
"value",
")",
")",
"{",
"throw",
"new",
"ValidateException",
"(",
"errorMsg",
")",
";",
"}",
"return",
"value",
";",
"}"
]
| 验证是否为中国车牌号
@param <T> 字符串类型
@param value 值
@param errorMsg 验证错误的信息
@return 验证后的值
@throws ValidateException 验证异常
@since 3.0.6 | [
"验证是否为中国车牌号"
]
| train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Validator.java#L891-L896 |
arquillian/arquillian-cube | kubernetes/kubernetes/src/main/java/org/arquillian/cube/kubernetes/impl/KubernetesAssistant.java | KubernetesAssistant.deployAll | public void deployAll(String applicationName, String pattern) {
"""
Deploys application reading resources from classpath, matching the given regular expression.
For example kubernetes/.*\\.json will deploy all resources ending with json placed at kubernetes classpath directory.
@param applicationName to configure the cluster
@param pattern to match the resources.
"""
this.applicationName = applicationName;
final FastClasspathScanner fastClasspathScanner = new FastClasspathScanner();
fastClasspathScanner.matchFilenamePattern(pattern, (FileMatchProcessor) (relativePath, inputStream, lengthBytes) -> {
deploy(inputStream);
}).scan();
} | java | public void deployAll(String applicationName, String pattern) {
this.applicationName = applicationName;
final FastClasspathScanner fastClasspathScanner = new FastClasspathScanner();
fastClasspathScanner.matchFilenamePattern(pattern, (FileMatchProcessor) (relativePath, inputStream, lengthBytes) -> {
deploy(inputStream);
}).scan();
} | [
"public",
"void",
"deployAll",
"(",
"String",
"applicationName",
",",
"String",
"pattern",
")",
"{",
"this",
".",
"applicationName",
"=",
"applicationName",
";",
"final",
"FastClasspathScanner",
"fastClasspathScanner",
"=",
"new",
"FastClasspathScanner",
"(",
")",
";",
"fastClasspathScanner",
".",
"matchFilenamePattern",
"(",
"pattern",
",",
"(",
"FileMatchProcessor",
")",
"(",
"relativePath",
",",
"inputStream",
",",
"lengthBytes",
")",
"->",
"{",
"deploy",
"(",
"inputStream",
")",
";",
"}",
")",
".",
"scan",
"(",
")",
";",
"}"
]
| Deploys application reading resources from classpath, matching the given regular expression.
For example kubernetes/.*\\.json will deploy all resources ending with json placed at kubernetes classpath directory.
@param applicationName to configure the cluster
@param pattern to match the resources. | [
"Deploys",
"application",
"reading",
"resources",
"from",
"classpath",
"matching",
"the",
"given",
"regular",
"expression",
".",
"For",
"example",
"kubernetes",
"/",
".",
"*",
"\\\\",
".",
"json",
"will",
"deploy",
"all",
"resources",
"ending",
"with",
"json",
"placed",
"at",
"kubernetes",
"classpath",
"directory",
"."
]
| train | https://github.com/arquillian/arquillian-cube/blob/ce6b08062cc6ba2a68ecc29606bbae9acda5be13/kubernetes/kubernetes/src/main/java/org/arquillian/cube/kubernetes/impl/KubernetesAssistant.java#L153-L161 |
RestComm/sipunit | src/main/java/org/cafesip/sipunit/PresenceNotifySender.java | PresenceNotifySender.processSubscribe | public void processSubscribe(long timeout, int statusCode, String reasonPhrase,
int overrideDuration, EventHeader overrideEvent) {
"""
Same as the other processSubscribe() except allows for a couple of overrides for testing error
handling by the far end outbound SUBSCRIBE side: (a) this method takes a duration for
overriding what would normally/correctly be sent back in the response (which is the same as
what was received in the SUBSCRIBE request or default 3600 if none was received). Observed if
>= 0. (b) this method takes an EventHeader for overriding what would normally/correctly be
sent back in the respone (same as what was received in the request).
"""
setErrorMessage("");
PhoneB b = new PhoneB(timeout + 500, statusCode, reasonPhrase, overrideDuration, overrideEvent);
b.start();
} | java | public void processSubscribe(long timeout, int statusCode, String reasonPhrase,
int overrideDuration, EventHeader overrideEvent) {
setErrorMessage("");
PhoneB b = new PhoneB(timeout + 500, statusCode, reasonPhrase, overrideDuration, overrideEvent);
b.start();
} | [
"public",
"void",
"processSubscribe",
"(",
"long",
"timeout",
",",
"int",
"statusCode",
",",
"String",
"reasonPhrase",
",",
"int",
"overrideDuration",
",",
"EventHeader",
"overrideEvent",
")",
"{",
"setErrorMessage",
"(",
"\"\"",
")",
";",
"PhoneB",
"b",
"=",
"new",
"PhoneB",
"(",
"timeout",
"+",
"500",
",",
"statusCode",
",",
"reasonPhrase",
",",
"overrideDuration",
",",
"overrideEvent",
")",
";",
"b",
".",
"start",
"(",
")",
";",
"}"
]
| Same as the other processSubscribe() except allows for a couple of overrides for testing error
handling by the far end outbound SUBSCRIBE side: (a) this method takes a duration for
overriding what would normally/correctly be sent back in the response (which is the same as
what was received in the SUBSCRIBE request or default 3600 if none was received). Observed if
>= 0. (b) this method takes an EventHeader for overriding what would normally/correctly be
sent back in the respone (same as what was received in the request). | [
"Same",
"as",
"the",
"other",
"processSubscribe",
"()",
"except",
"allows",
"for",
"a",
"couple",
"of",
"overrides",
"for",
"testing",
"error",
"handling",
"by",
"the",
"far",
"end",
"outbound",
"SUBSCRIBE",
"side",
":",
"(",
"a",
")",
"this",
"method",
"takes",
"a",
"duration",
"for",
"overriding",
"what",
"would",
"normally",
"/",
"correctly",
"be",
"sent",
"back",
"in",
"the",
"response",
"(",
"which",
"is",
"the",
"same",
"as",
"what",
"was",
"received",
"in",
"the",
"SUBSCRIBE",
"request",
"or",
"default",
"3600",
"if",
"none",
"was",
"received",
")",
".",
"Observed",
"if",
">",
";",
"=",
"0",
".",
"(",
"b",
")",
"this",
"method",
"takes",
"an",
"EventHeader",
"for",
"overriding",
"what",
"would",
"normally",
"/",
"correctly",
"be",
"sent",
"back",
"in",
"the",
"respone",
"(",
"same",
"as",
"what",
"was",
"received",
"in",
"the",
"request",
")",
"."
]
| train | https://github.com/RestComm/sipunit/blob/18a6be2e29be3fbdc14226e8c41b25e2d57378b1/src/main/java/org/cafesip/sipunit/PresenceNotifySender.java#L142-L148 |
deeplearning4j/deeplearning4j | datavec/datavec-local/src/main/java/org/datavec/local/transforms/LocalTransformExecutor.java | LocalTransformExecutor.executeSequenceToSeparate | public static List<List<Writable>> executeSequenceToSeparate(List<List<List<Writable>>> inputSequence,
TransformProcess transformProcess) {
"""
Execute the specified TransformProcess with the given <i>sequence</i> input data<br>
Note: this method can only be used if the TransformProcess starts with sequence data, but returns <i>non-sequential</i>
data (after reducing or converting sequential data to individual examples)
@param inputSequence Input sequence data to process
@param transformProcess TransformProcess to execute
@return Processed (non-sequential) data
"""
if (transformProcess.getFinalSchema() instanceof SequenceSchema) {
throw new IllegalStateException("Cannot return sequence data with this method");
}
return execute(null, inputSequence, transformProcess).getFirst();
} | java | public static List<List<Writable>> executeSequenceToSeparate(List<List<List<Writable>>> inputSequence,
TransformProcess transformProcess) {
if (transformProcess.getFinalSchema() instanceof SequenceSchema) {
throw new IllegalStateException("Cannot return sequence data with this method");
}
return execute(null, inputSequence, transformProcess).getFirst();
} | [
"public",
"static",
"List",
"<",
"List",
"<",
"Writable",
">",
">",
"executeSequenceToSeparate",
"(",
"List",
"<",
"List",
"<",
"List",
"<",
"Writable",
">",
">",
">",
"inputSequence",
",",
"TransformProcess",
"transformProcess",
")",
"{",
"if",
"(",
"transformProcess",
".",
"getFinalSchema",
"(",
")",
"instanceof",
"SequenceSchema",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Cannot return sequence data with this method\"",
")",
";",
"}",
"return",
"execute",
"(",
"null",
",",
"inputSequence",
",",
"transformProcess",
")",
".",
"getFirst",
"(",
")",
";",
"}"
]
| Execute the specified TransformProcess with the given <i>sequence</i> input data<br>
Note: this method can only be used if the TransformProcess starts with sequence data, but returns <i>non-sequential</i>
data (after reducing or converting sequential data to individual examples)
@param inputSequence Input sequence data to process
@param transformProcess TransformProcess to execute
@return Processed (non-sequential) data | [
"Execute",
"the",
"specified",
"TransformProcess",
"with",
"the",
"given",
"<i",
">",
"sequence<",
"/",
"i",
">",
"input",
"data<br",
">",
"Note",
":",
"this",
"method",
"can",
"only",
"be",
"used",
"if",
"the",
"TransformProcess",
"starts",
"with",
"sequence",
"data",
"but",
"returns",
"<i",
">",
"non",
"-",
"sequential<",
"/",
"i",
">",
"data",
"(",
"after",
"reducing",
"or",
"converting",
"sequential",
"data",
"to",
"individual",
"examples",
")"
]
| train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-local/src/main/java/org/datavec/local/transforms/LocalTransformExecutor.java#L125-L132 |
adorsys/hbci4java-adorsys | src/main/java/org/kapott/hbci/GV/AbstractHBCIJob.java | AbstractHBCIJob.fillJobResult | public void fillJobResult(HBCIMsgStatus status, int offset) {
"""
/* füllt das Objekt mit den Rückgabedaten. Dazu wird zuerst eine Liste aller
Segmente erstellt, die Rückgabedaten für diesen Task enthalten. Anschließend
werden die HBCI-Rückgabewerte (RetSegs) im outStore gespeichert. Danach werden
die GV-spezifischen Daten im outStore abgelegt
"""
try {
executed = true;
// nachsehen, welche antwortsegmente ueberhaupt
// zu diesem task gehoeren
// res-num --> segmentheader (wird für sortierung der
// antwort-segmente benötigt)
HashMap<Integer, String> keyHeaders = new HashMap<>();
status.getData().keySet().forEach(key -> {
if (key.startsWith("GVRes") && key.endsWith(".SegHead.ref")) {
String segref = status.getData().get(key);
if ((Integer.parseInt(segref)) - offset == idx) {
// nummer des antwortsegments ermitteln
int resnum = 0;
if (key.startsWith("GVRes_")) {
resnum = Integer.parseInt(key.substring(key.indexOf('_') + 1, key.indexOf('.')));
}
keyHeaders.put(
resnum,
key.substring(0, key.length() - (".SegHead.ref").length()));
}
}
});
saveBasicValues(status.getData(), idx + offset);
saveReturnValues(status, idx + offset);
// segment-header-namen der antwortsegmente in der reihenfolge des
// eintreffens sortieren
Object[] resnums = keyHeaders.keySet().toArray(new Object[0]);
Arrays.sort(resnums);
// alle antwortsegmente durchlaufen
for (Object resnum : resnums) {
// dabei reihenfolge des eintreffens beachten
String header = keyHeaders.get(resnum);
extractPlaintextResults(status, header, contentCounter);
extractResults(status, header, contentCounter++);
// der contentCounter wird fuer jedes antwortsegment um 1 erhoeht
}
} catch (Exception e) {
String msg = HBCIUtils.getLocMsg("EXCMSG_CANTSTORERES", getName());
throw new HBCI_Exception(msg, e);
}
} | java | public void fillJobResult(HBCIMsgStatus status, int offset) {
try {
executed = true;
// nachsehen, welche antwortsegmente ueberhaupt
// zu diesem task gehoeren
// res-num --> segmentheader (wird für sortierung der
// antwort-segmente benötigt)
HashMap<Integer, String> keyHeaders = new HashMap<>();
status.getData().keySet().forEach(key -> {
if (key.startsWith("GVRes") && key.endsWith(".SegHead.ref")) {
String segref = status.getData().get(key);
if ((Integer.parseInt(segref)) - offset == idx) {
// nummer des antwortsegments ermitteln
int resnum = 0;
if (key.startsWith("GVRes_")) {
resnum = Integer.parseInt(key.substring(key.indexOf('_') + 1, key.indexOf('.')));
}
keyHeaders.put(
resnum,
key.substring(0, key.length() - (".SegHead.ref").length()));
}
}
});
saveBasicValues(status.getData(), idx + offset);
saveReturnValues(status, idx + offset);
// segment-header-namen der antwortsegmente in der reihenfolge des
// eintreffens sortieren
Object[] resnums = keyHeaders.keySet().toArray(new Object[0]);
Arrays.sort(resnums);
// alle antwortsegmente durchlaufen
for (Object resnum : resnums) {
// dabei reihenfolge des eintreffens beachten
String header = keyHeaders.get(resnum);
extractPlaintextResults(status, header, contentCounter);
extractResults(status, header, contentCounter++);
// der contentCounter wird fuer jedes antwortsegment um 1 erhoeht
}
} catch (Exception e) {
String msg = HBCIUtils.getLocMsg("EXCMSG_CANTSTORERES", getName());
throw new HBCI_Exception(msg, e);
}
} | [
"public",
"void",
"fillJobResult",
"(",
"HBCIMsgStatus",
"status",
",",
"int",
"offset",
")",
"{",
"try",
"{",
"executed",
"=",
"true",
";",
"// nachsehen, welche antwortsegmente ueberhaupt",
"// zu diesem task gehoeren",
"// res-num --> segmentheader (wird für sortierung der",
"// antwort-segmente benötigt)",
"HashMap",
"<",
"Integer",
",",
"String",
">",
"keyHeaders",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"status",
".",
"getData",
"(",
")",
".",
"keySet",
"(",
")",
".",
"forEach",
"(",
"key",
"->",
"{",
"if",
"(",
"key",
".",
"startsWith",
"(",
"\"GVRes\"",
")",
"&&",
"key",
".",
"endsWith",
"(",
"\".SegHead.ref\"",
")",
")",
"{",
"String",
"segref",
"=",
"status",
".",
"getData",
"(",
")",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"(",
"Integer",
".",
"parseInt",
"(",
"segref",
")",
")",
"-",
"offset",
"==",
"idx",
")",
"{",
"// nummer des antwortsegments ermitteln",
"int",
"resnum",
"=",
"0",
";",
"if",
"(",
"key",
".",
"startsWith",
"(",
"\"GVRes_\"",
")",
")",
"{",
"resnum",
"=",
"Integer",
".",
"parseInt",
"(",
"key",
".",
"substring",
"(",
"key",
".",
"indexOf",
"(",
"'",
"'",
")",
"+",
"1",
",",
"key",
".",
"indexOf",
"(",
"'",
"'",
")",
")",
")",
";",
"}",
"keyHeaders",
".",
"put",
"(",
"resnum",
",",
"key",
".",
"substring",
"(",
"0",
",",
"key",
".",
"length",
"(",
")",
"-",
"(",
"\".SegHead.ref\"",
")",
".",
"length",
"(",
")",
")",
")",
";",
"}",
"}",
"}",
")",
";",
"saveBasicValues",
"(",
"status",
".",
"getData",
"(",
")",
",",
"idx",
"+",
"offset",
")",
";",
"saveReturnValues",
"(",
"status",
",",
"idx",
"+",
"offset",
")",
";",
"// segment-header-namen der antwortsegmente in der reihenfolge des",
"// eintreffens sortieren",
"Object",
"[",
"]",
"resnums",
"=",
"keyHeaders",
".",
"keySet",
"(",
")",
".",
"toArray",
"(",
"new",
"Object",
"[",
"0",
"]",
")",
";",
"Arrays",
".",
"sort",
"(",
"resnums",
")",
";",
"// alle antwortsegmente durchlaufen",
"for",
"(",
"Object",
"resnum",
":",
"resnums",
")",
"{",
"// dabei reihenfolge des eintreffens beachten",
"String",
"header",
"=",
"keyHeaders",
".",
"get",
"(",
"resnum",
")",
";",
"extractPlaintextResults",
"(",
"status",
",",
"header",
",",
"contentCounter",
")",
";",
"extractResults",
"(",
"status",
",",
"header",
",",
"contentCounter",
"++",
")",
";",
"// der contentCounter wird fuer jedes antwortsegment um 1 erhoeht",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"String",
"msg",
"=",
"HBCIUtils",
".",
"getLocMsg",
"(",
"\"EXCMSG_CANTSTORERES\"",
",",
"getName",
"(",
")",
")",
";",
"throw",
"new",
"HBCI_Exception",
"(",
"msg",
",",
"e",
")",
";",
"}",
"}"
]
| /* füllt das Objekt mit den Rückgabedaten. Dazu wird zuerst eine Liste aller
Segmente erstellt, die Rückgabedaten für diesen Task enthalten. Anschließend
werden die HBCI-Rückgabewerte (RetSegs) im outStore gespeichert. Danach werden
die GV-spezifischen Daten im outStore abgelegt | [
"/",
"*",
"füllt",
"das",
"Objekt",
"mit",
"den",
"Rückgabedaten",
".",
"Dazu",
"wird",
"zuerst",
"eine",
"Liste",
"aller",
"Segmente",
"erstellt",
"die",
"Rückgabedaten",
"für",
"diesen",
"Task",
"enthalten",
".",
"Anschließend",
"werden",
"die",
"HBCI",
"-",
"Rückgabewerte",
"(",
"RetSegs",
")",
"im",
"outStore",
"gespeichert",
".",
"Danach",
"werden",
"die",
"GV",
"-",
"spezifischen",
"Daten",
"im",
"outStore",
"abgelegt"
]
| train | https://github.com/adorsys/hbci4java-adorsys/blob/5e24f7e429d6b555e1d993196b4cf1adda6433cf/src/main/java/org/kapott/hbci/GV/AbstractHBCIJob.java#L698-L745 |
grpc/grpc-java | okhttp/third_party/okhttp/main/java/io/grpc/okhttp/internal/OptionalMethod.java | OptionalMethod.invokeOptional | public Object invokeOptional(T target, Object... args) throws InvocationTargetException {
"""
Invokes the method on {@code target} with {@code args}. If the method does not exist or is not
public then {@code null} is returned. See also
{@link #invokeOptionalWithoutCheckedException(Object, Object...)}.
@throws IllegalArgumentException if the arguments are invalid
@throws InvocationTargetException if the invocation throws an exception
"""
Method m = getMethod(target.getClass());
if (m == null) {
return null;
}
try {
return m.invoke(target, args);
} catch (IllegalAccessException e) {
return null;
}
} | java | public Object invokeOptional(T target, Object... args) throws InvocationTargetException {
Method m = getMethod(target.getClass());
if (m == null) {
return null;
}
try {
return m.invoke(target, args);
} catch (IllegalAccessException e) {
return null;
}
} | [
"public",
"Object",
"invokeOptional",
"(",
"T",
"target",
",",
"Object",
"...",
"args",
")",
"throws",
"InvocationTargetException",
"{",
"Method",
"m",
"=",
"getMethod",
"(",
"target",
".",
"getClass",
"(",
")",
")",
";",
"if",
"(",
"m",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"try",
"{",
"return",
"m",
".",
"invoke",
"(",
"target",
",",
"args",
")",
";",
"}",
"catch",
"(",
"IllegalAccessException",
"e",
")",
"{",
"return",
"null",
";",
"}",
"}"
]
| Invokes the method on {@code target} with {@code args}. If the method does not exist or is not
public then {@code null} is returned. See also
{@link #invokeOptionalWithoutCheckedException(Object, Object...)}.
@throws IllegalArgumentException if the arguments are invalid
@throws InvocationTargetException if the invocation throws an exception | [
"Invokes",
"the",
"method",
"on",
"{",
"@code",
"target",
"}",
"with",
"{",
"@code",
"args",
"}",
".",
"If",
"the",
"method",
"does",
"not",
"exist",
"or",
"is",
"not",
"public",
"then",
"{",
"@code",
"null",
"}",
"is",
"returned",
".",
"See",
"also",
"{",
"@link",
"#invokeOptionalWithoutCheckedException",
"(",
"Object",
"Object",
"...",
")",
"}",
"."
]
| train | https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/okhttp/third_party/okhttp/main/java/io/grpc/okhttp/internal/OptionalMethod.java#L71-L81 |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/segmentation/fh04/SegmentFelzenszwalbHuttenlocher04.java | SegmentFelzenszwalbHuttenlocher04.initialize | protected void initialize(T input , GrayS32 output ) {
"""
Predeclares all memory required and sets data structures to their initial values
"""
this.graph = output;
final int N = input.width*input.height;
regionSize.resize(N);
threshold.resize(N);
for( int i = 0; i < N; i++ ) {
regionSize.data[i] = 1;
threshold.data[i] = K;
graph.data[i] = i; // assign a unique label to each pixel since they are all their own region initially
}
edges.reset();
edgesNotMatched.reset();
} | java | protected void initialize(T input , GrayS32 output ) {
this.graph = output;
final int N = input.width*input.height;
regionSize.resize(N);
threshold.resize(N);
for( int i = 0; i < N; i++ ) {
regionSize.data[i] = 1;
threshold.data[i] = K;
graph.data[i] = i; // assign a unique label to each pixel since they are all their own region initially
}
edges.reset();
edgesNotMatched.reset();
} | [
"protected",
"void",
"initialize",
"(",
"T",
"input",
",",
"GrayS32",
"output",
")",
"{",
"this",
".",
"graph",
"=",
"output",
";",
"final",
"int",
"N",
"=",
"input",
".",
"width",
"*",
"input",
".",
"height",
";",
"regionSize",
".",
"resize",
"(",
"N",
")",
";",
"threshold",
".",
"resize",
"(",
"N",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"N",
";",
"i",
"++",
")",
"{",
"regionSize",
".",
"data",
"[",
"i",
"]",
"=",
"1",
";",
"threshold",
".",
"data",
"[",
"i",
"]",
"=",
"K",
";",
"graph",
".",
"data",
"[",
"i",
"]",
"=",
"i",
";",
"// assign a unique label to each pixel since they are all their own region initially",
"}",
"edges",
".",
"reset",
"(",
")",
";",
"edgesNotMatched",
".",
"reset",
"(",
")",
";",
"}"
]
| Predeclares all memory required and sets data structures to their initial values | [
"Predeclares",
"all",
"memory",
"required",
"and",
"sets",
"data",
"structures",
"to",
"their",
"initial",
"values"
]
| train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/segmentation/fh04/SegmentFelzenszwalbHuttenlocher04.java#L170-L184 |
jbundle/jbundle | thin/base/screen/util/src/main/java/org/jbundle/thin/base/screen/util/JMultiFieldPanel.java | JMultiFieldPanel.init | public void init(Convert converter, JComponent component1, JComponent component2) {
"""
Creates new JCalendarDualField.
@param The field this component is tied to.
"""
m_converter = converter;
this.setBorder(null);
this.setOpaque(false);
this.setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
if (component1 != null)
this.addComponent(component1, true);
if (component2 != null)
this.addComponent(component2, true);
} | java | public void init(Convert converter, JComponent component1, JComponent component2)
{
m_converter = converter;
this.setBorder(null);
this.setOpaque(false);
this.setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
if (component1 != null)
this.addComponent(component1, true);
if (component2 != null)
this.addComponent(component2, true);
} | [
"public",
"void",
"init",
"(",
"Convert",
"converter",
",",
"JComponent",
"component1",
",",
"JComponent",
"component2",
")",
"{",
"m_converter",
"=",
"converter",
";",
"this",
".",
"setBorder",
"(",
"null",
")",
";",
"this",
".",
"setOpaque",
"(",
"false",
")",
";",
"this",
".",
"setLayout",
"(",
"new",
"BoxLayout",
"(",
"this",
",",
"BoxLayout",
".",
"X_AXIS",
")",
")",
";",
"if",
"(",
"component1",
"!=",
"null",
")",
"this",
".",
"addComponent",
"(",
"component1",
",",
"true",
")",
";",
"if",
"(",
"component2",
"!=",
"null",
")",
"this",
".",
"addComponent",
"(",
"component2",
",",
"true",
")",
";",
"}"
]
| Creates new JCalendarDualField.
@param The field this component is tied to. | [
"Creates",
"new",
"JCalendarDualField",
"."
]
| train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/util/src/main/java/org/jbundle/thin/base/screen/util/JMultiFieldPanel.java#L81-L93 |
UrielCh/ovh-java-sdk | ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java | ApiOvhOrder.dedicated_server_serviceName_firewall_GET | public ArrayList<String> dedicated_server_serviceName_firewall_GET(String serviceName, OvhFirewallModelEnum firewallModel) throws IOException {
"""
Get allowed durations for 'firewall' option
REST: GET /order/dedicated/server/{serviceName}/firewall
@param firewallModel [required] Firewall type
@param serviceName [required] The internal name of your dedicated server
"""
String qPath = "/order/dedicated/server/{serviceName}/firewall";
StringBuilder sb = path(qPath, serviceName);
query(sb, "firewallModel", firewallModel);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t1);
} | java | public ArrayList<String> dedicated_server_serviceName_firewall_GET(String serviceName, OvhFirewallModelEnum firewallModel) throws IOException {
String qPath = "/order/dedicated/server/{serviceName}/firewall";
StringBuilder sb = path(qPath, serviceName);
query(sb, "firewallModel", firewallModel);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t1);
} | [
"public",
"ArrayList",
"<",
"String",
">",
"dedicated_server_serviceName_firewall_GET",
"(",
"String",
"serviceName",
",",
"OvhFirewallModelEnum",
"firewallModel",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/order/dedicated/server/{serviceName}/firewall\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"serviceName",
")",
";",
"query",
"(",
"sb",
",",
"\"firewallModel\"",
",",
"firewallModel",
")",
";",
"String",
"resp",
"=",
"exec",
"(",
"qPath",
",",
"\"GET\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"null",
")",
";",
"return",
"convertTo",
"(",
"resp",
",",
"t1",
")",
";",
"}"
]
| Get allowed durations for 'firewall' option
REST: GET /order/dedicated/server/{serviceName}/firewall
@param firewallModel [required] Firewall type
@param serviceName [required] The internal name of your dedicated server | [
"Get",
"allowed",
"durations",
"for",
"firewall",
"option"
]
| train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L2818-L2824 |
javagl/CommonUI | src/main/java/de/javagl/common/ui/JTables.java | JTables.adjustColumnWidths | public static void adjustColumnWidths(JTable table, int maxWidth) {
"""
Adjust the preferred widths of the columns of the given table
depending on the contents of the cells and headers.
@param table The table to adjust
@param maxWidth The maximum width a column may have
"""
final int safety = 20;
for (int c = 0; c < table.getColumnCount(); c++)
{
TableColumn column = table.getColumnModel().getColumn(c);
TableCellRenderer headerRenderer = column.getHeaderRenderer();
if (headerRenderer == null) {
headerRenderer = table.getTableHeader().getDefaultRenderer();
}
Component headerComponent =
headerRenderer.getTableCellRendererComponent(
table, column.getHeaderValue(), false, false, 0, 0);
int width = headerComponent.getPreferredSize().width;
for (int r = 0; r < table.getRowCount(); r++)
{
TableCellRenderer cellRenderer = table.getCellRenderer(r, c);
Component cellComponent =
cellRenderer.getTableCellRendererComponent(
table, table.getValueAt(r, c),
false, false, r, c);
Dimension d = cellComponent.getPreferredSize();
//System.out.println(
// "Preferred is "+d.width+" for "+cellComponent);
width = Math.max(width, d.width);
}
column.setPreferredWidth(Math.min(maxWidth, width + safety));
}
} | java | public static void adjustColumnWidths(JTable table, int maxWidth)
{
final int safety = 20;
for (int c = 0; c < table.getColumnCount(); c++)
{
TableColumn column = table.getColumnModel().getColumn(c);
TableCellRenderer headerRenderer = column.getHeaderRenderer();
if (headerRenderer == null) {
headerRenderer = table.getTableHeader().getDefaultRenderer();
}
Component headerComponent =
headerRenderer.getTableCellRendererComponent(
table, column.getHeaderValue(), false, false, 0, 0);
int width = headerComponent.getPreferredSize().width;
for (int r = 0; r < table.getRowCount(); r++)
{
TableCellRenderer cellRenderer = table.getCellRenderer(r, c);
Component cellComponent =
cellRenderer.getTableCellRendererComponent(
table, table.getValueAt(r, c),
false, false, r, c);
Dimension d = cellComponent.getPreferredSize();
//System.out.println(
// "Preferred is "+d.width+" for "+cellComponent);
width = Math.max(width, d.width);
}
column.setPreferredWidth(Math.min(maxWidth, width + safety));
}
} | [
"public",
"static",
"void",
"adjustColumnWidths",
"(",
"JTable",
"table",
",",
"int",
"maxWidth",
")",
"{",
"final",
"int",
"safety",
"=",
"20",
";",
"for",
"(",
"int",
"c",
"=",
"0",
";",
"c",
"<",
"table",
".",
"getColumnCount",
"(",
")",
";",
"c",
"++",
")",
"{",
"TableColumn",
"column",
"=",
"table",
".",
"getColumnModel",
"(",
")",
".",
"getColumn",
"(",
"c",
")",
";",
"TableCellRenderer",
"headerRenderer",
"=",
"column",
".",
"getHeaderRenderer",
"(",
")",
";",
"if",
"(",
"headerRenderer",
"==",
"null",
")",
"{",
"headerRenderer",
"=",
"table",
".",
"getTableHeader",
"(",
")",
".",
"getDefaultRenderer",
"(",
")",
";",
"}",
"Component",
"headerComponent",
"=",
"headerRenderer",
".",
"getTableCellRendererComponent",
"(",
"table",
",",
"column",
".",
"getHeaderValue",
"(",
")",
",",
"false",
",",
"false",
",",
"0",
",",
"0",
")",
";",
"int",
"width",
"=",
"headerComponent",
".",
"getPreferredSize",
"(",
")",
".",
"width",
";",
"for",
"(",
"int",
"r",
"=",
"0",
";",
"r",
"<",
"table",
".",
"getRowCount",
"(",
")",
";",
"r",
"++",
")",
"{",
"TableCellRenderer",
"cellRenderer",
"=",
"table",
".",
"getCellRenderer",
"(",
"r",
",",
"c",
")",
";",
"Component",
"cellComponent",
"=",
"cellRenderer",
".",
"getTableCellRendererComponent",
"(",
"table",
",",
"table",
".",
"getValueAt",
"(",
"r",
",",
"c",
")",
",",
"false",
",",
"false",
",",
"r",
",",
"c",
")",
";",
"Dimension",
"d",
"=",
"cellComponent",
".",
"getPreferredSize",
"(",
")",
";",
"//System.out.println(\r",
"// \"Preferred is \"+d.width+\" for \"+cellComponent);\r",
"width",
"=",
"Math",
".",
"max",
"(",
"width",
",",
"d",
".",
"width",
")",
";",
"}",
"column",
".",
"setPreferredWidth",
"(",
"Math",
".",
"min",
"(",
"maxWidth",
",",
"width",
"+",
"safety",
")",
")",
";",
"}",
"}"
]
| Adjust the preferred widths of the columns of the given table
depending on the contents of the cells and headers.
@param table The table to adjust
@param maxWidth The maximum width a column may have | [
"Adjust",
"the",
"preferred",
"widths",
"of",
"the",
"columns",
"of",
"the",
"given",
"table",
"depending",
"on",
"the",
"contents",
"of",
"the",
"cells",
"and",
"headers",
"."
]
| train | https://github.com/javagl/CommonUI/blob/b2c7a7637d4e288271392ba148dc17e4c9780255/src/main/java/de/javagl/common/ui/JTables.java#L51-L81 |
wcm-io/wcm-io-handler | media/src/main/java/io/wcm/handler/media/impl/AbstractMediaFileServlet.java | AbstractMediaFileServlet.sendBinaryData | protected void sendBinaryData(byte[] binaryData, String contentType,
SlingHttpServletRequest request, SlingHttpServletResponse response) throws IOException {
"""
Send binary data to output stream. Respect optional content disposition header handling.
@param binaryData Binary data array.
@param contentType Content type
@param request Request
@param response Response
@throws IOException
"""
// set content type and length
response.setContentType(contentType);
response.setContentLength(binaryData.length);
// Handling of the "force download" selector
if (RequestPath.hasSelector(request, SELECTOR_DOWNLOAD)) {
// Overwrite MIME type with one suited for downloads
response.setContentType(ContentType.DOWNLOAD);
// Construct disposition header
StringBuilder dispositionHeader = new StringBuilder("attachment;");
String suffix = request.getRequestPathInfo().getSuffix();
suffix = StringUtils.stripStart(suffix, "/");
if (StringUtils.isNotEmpty(suffix)) {
dispositionHeader.append("filename=\"").append(suffix).append('\"');
}
response.setHeader(HEADER_CONTENT_DISPOSITION, dispositionHeader.toString());
}
// write binary data
OutputStream out = response.getOutputStream();
out.write(binaryData);
out.flush();
} | java | protected void sendBinaryData(byte[] binaryData, String contentType,
SlingHttpServletRequest request, SlingHttpServletResponse response) throws IOException {
// set content type and length
response.setContentType(contentType);
response.setContentLength(binaryData.length);
// Handling of the "force download" selector
if (RequestPath.hasSelector(request, SELECTOR_DOWNLOAD)) {
// Overwrite MIME type with one suited for downloads
response.setContentType(ContentType.DOWNLOAD);
// Construct disposition header
StringBuilder dispositionHeader = new StringBuilder("attachment;");
String suffix = request.getRequestPathInfo().getSuffix();
suffix = StringUtils.stripStart(suffix, "/");
if (StringUtils.isNotEmpty(suffix)) {
dispositionHeader.append("filename=\"").append(suffix).append('\"');
}
response.setHeader(HEADER_CONTENT_DISPOSITION, dispositionHeader.toString());
}
// write binary data
OutputStream out = response.getOutputStream();
out.write(binaryData);
out.flush();
} | [
"protected",
"void",
"sendBinaryData",
"(",
"byte",
"[",
"]",
"binaryData",
",",
"String",
"contentType",
",",
"SlingHttpServletRequest",
"request",
",",
"SlingHttpServletResponse",
"response",
")",
"throws",
"IOException",
"{",
"// set content type and length",
"response",
".",
"setContentType",
"(",
"contentType",
")",
";",
"response",
".",
"setContentLength",
"(",
"binaryData",
".",
"length",
")",
";",
"// Handling of the \"force download\" selector",
"if",
"(",
"RequestPath",
".",
"hasSelector",
"(",
"request",
",",
"SELECTOR_DOWNLOAD",
")",
")",
"{",
"// Overwrite MIME type with one suited for downloads",
"response",
".",
"setContentType",
"(",
"ContentType",
".",
"DOWNLOAD",
")",
";",
"// Construct disposition header",
"StringBuilder",
"dispositionHeader",
"=",
"new",
"StringBuilder",
"(",
"\"attachment;\"",
")",
";",
"String",
"suffix",
"=",
"request",
".",
"getRequestPathInfo",
"(",
")",
".",
"getSuffix",
"(",
")",
";",
"suffix",
"=",
"StringUtils",
".",
"stripStart",
"(",
"suffix",
",",
"\"/\"",
")",
";",
"if",
"(",
"StringUtils",
".",
"isNotEmpty",
"(",
"suffix",
")",
")",
"{",
"dispositionHeader",
".",
"append",
"(",
"\"filename=\\\"\"",
")",
".",
"append",
"(",
"suffix",
")",
".",
"append",
"(",
"'",
"'",
")",
";",
"}",
"response",
".",
"setHeader",
"(",
"HEADER_CONTENT_DISPOSITION",
",",
"dispositionHeader",
".",
"toString",
"(",
")",
")",
";",
"}",
"// write binary data",
"OutputStream",
"out",
"=",
"response",
".",
"getOutputStream",
"(",
")",
";",
"out",
".",
"write",
"(",
"binaryData",
")",
";",
"out",
".",
"flush",
"(",
")",
";",
"}"
]
| Send binary data to output stream. Respect optional content disposition header handling.
@param binaryData Binary data array.
@param contentType Content type
@param request Request
@param response Response
@throws IOException | [
"Send",
"binary",
"data",
"to",
"output",
"stream",
".",
"Respect",
"optional",
"content",
"disposition",
"header",
"handling",
"."
]
| train | https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/media/src/main/java/io/wcm/handler/media/impl/AbstractMediaFileServlet.java#L150-L178 |
jayantk/jklol | src/com/jayantkrish/jklol/models/dynamic/DynamicAssignment.java | DynamicAssignment.fromAssignment | public static DynamicAssignment fromAssignment(Assignment assignment) {
"""
Creates a {@code DynamicAssignment} without any replicated structure.
@param assignment
@return
"""
return new DynamicAssignment(assignment, Collections.<String>emptyList(),
Collections.<List<DynamicAssignment>>emptyList());
} | java | public static DynamicAssignment fromAssignment(Assignment assignment) {
return new DynamicAssignment(assignment, Collections.<String>emptyList(),
Collections.<List<DynamicAssignment>>emptyList());
} | [
"public",
"static",
"DynamicAssignment",
"fromAssignment",
"(",
"Assignment",
"assignment",
")",
"{",
"return",
"new",
"DynamicAssignment",
"(",
"assignment",
",",
"Collections",
".",
"<",
"String",
">",
"emptyList",
"(",
")",
",",
"Collections",
".",
"<",
"List",
"<",
"DynamicAssignment",
">",
">",
"emptyList",
"(",
")",
")",
";",
"}"
]
| Creates a {@code DynamicAssignment} without any replicated structure.
@param assignment
@return | [
"Creates",
"a",
"{",
"@code",
"DynamicAssignment",
"}",
"without",
"any",
"replicated",
"structure",
"."
]
| train | https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/models/dynamic/DynamicAssignment.java#L69-L72 |
OpenTSDB/opentsdb | src/uid/UniqueId.java | UniqueId.addIdToRegexp | public static void addIdToRegexp(final StringBuilder buf, final byte[] id) {
"""
Appends the given UID to the given string buffer, followed by "\\E".
@param buf The buffer to append
@param id The UID to add as a binary regex pattern
@since 2.1
"""
boolean backslash = false;
for (final byte b : id) {
buf.append((char) (b & 0xFF));
if (b == 'E' && backslash) { // If we saw a `\' and now we have a `E'.
// So we just terminated the quoted section because we just added \E
// to `buf'. So let's put a literal \E now and start quoting again.
buf.append("\\\\E\\Q");
} else {
backslash = b == '\\';
}
}
buf.append("\\E");
} | java | public static void addIdToRegexp(final StringBuilder buf, final byte[] id) {
boolean backslash = false;
for (final byte b : id) {
buf.append((char) (b & 0xFF));
if (b == 'E' && backslash) { // If we saw a `\' and now we have a `E'.
// So we just terminated the quoted section because we just added \E
// to `buf'. So let's put a literal \E now and start quoting again.
buf.append("\\\\E\\Q");
} else {
backslash = b == '\\';
}
}
buf.append("\\E");
} | [
"public",
"static",
"void",
"addIdToRegexp",
"(",
"final",
"StringBuilder",
"buf",
",",
"final",
"byte",
"[",
"]",
"id",
")",
"{",
"boolean",
"backslash",
"=",
"false",
";",
"for",
"(",
"final",
"byte",
"b",
":",
"id",
")",
"{",
"buf",
".",
"append",
"(",
"(",
"char",
")",
"(",
"b",
"&",
"0xFF",
")",
")",
";",
"if",
"(",
"b",
"==",
"'",
"'",
"&&",
"backslash",
")",
"{",
"// If we saw a `\\' and now we have a `E'.",
"// So we just terminated the quoted section because we just added \\E",
"// to `buf'. So let's put a literal \\E now and start quoting again.",
"buf",
".",
"append",
"(",
"\"\\\\\\\\E\\\\Q\"",
")",
";",
"}",
"else",
"{",
"backslash",
"=",
"b",
"==",
"'",
"'",
";",
"}",
"}",
"buf",
".",
"append",
"(",
"\"\\\\E\"",
")",
";",
"}"
]
| Appends the given UID to the given string buffer, followed by "\\E".
@param buf The buffer to append
@param id The UID to add as a binary regex pattern
@since 2.1 | [
"Appends",
"the",
"given",
"UID",
"to",
"the",
"given",
"string",
"buffer",
"followed",
"by",
"\\\\",
"E",
"."
]
| train | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/uid/UniqueId.java#L1498-L1511 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.