repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 192 | func_name stringlengths 5 108 | whole_func_string stringlengths 75 3.91k | language stringclasses 1
value | func_code_string stringlengths 75 3.91k | func_code_tokens listlengths 21 629 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 647 | split_name stringclasses 1
value | func_code_url stringlengths 111 306 |
|---|---|---|---|---|---|---|---|---|---|---|
NoraUi/NoraUi | src/main/java/com/github/noraui/utils/Messages.java | Messages.countWildcardsOccurrences | private static int countWildcardsOccurrences(String templateMessage, String occurrence) {
if (templateMessage != null && occurrence != null) {
final Pattern pattern = Pattern.compile(occurrence);
final Matcher matcher = pattern.matcher(templateMessage);
int count = 0;
while (matcher.find()) {
count++;
}
return count;
} else {
return 0;
}
} | java | private static int countWildcardsOccurrences(String templateMessage, String occurrence) {
if (templateMessage != null && occurrence != null) {
final Pattern pattern = Pattern.compile(occurrence);
final Matcher matcher = pattern.matcher(templateMessage);
int count = 0;
while (matcher.find()) {
count++;
}
return count;
} else {
return 0;
}
} | [
"private",
"static",
"int",
"countWildcardsOccurrences",
"(",
"String",
"templateMessage",
",",
"String",
"occurrence",
")",
"{",
"if",
"(",
"templateMessage",
"!=",
"null",
"&&",
"occurrence",
"!=",
"null",
")",
"{",
"final",
"Pattern",
"pattern",
"=",
"Pattern... | Count the number of occurrences of a given wildcard.
@param templateMessage
Input string
@param occurrence
String searched.
@return The number of occurrences. | [
"Count",
"the",
"number",
"of",
"occurrences",
"of",
"a",
"given",
"wildcard",
"."
] | train | https://github.com/NoraUi/NoraUi/blob/5f491a3339c7d3c20d7207760bdaf2acdb8f260c/src/main/java/com/github/noraui/utils/Messages.java#L166-L178 |
VoltDB/voltdb | src/hsqldb19b3/org/hsqldb_voltpatches/SubQuery.java | SubQuery.compare | @Override
public int compare(Object a, Object b) {
SubQuery sqa = (SubQuery) a;
SubQuery sqb = (SubQuery) b;
if (sqa.parentView == null && sqb.parentView == null) {
return sqb.level - sqa.level;
} else if (sqa.parentView != null && sqb.parentView != null) {
int ia = database.schemaManager.getTableIndex(sqa.parentView);
int ib = database.schemaManager.getTableIndex(sqb.parentView);
if (ia == -1) {
ia = database.schemaManager.getTables(
sqa.parentView.getSchemaName().name).size();
}
if (ib == -1) {
ib = database.schemaManager.getTables(
sqb.parentView.getSchemaName().name).size();
}
int diff = ia - ib;
return diff == 0 ? sqb.level - sqa.level
: diff;
} else {
return sqa.parentView == null ? 1
: -1;
}
} | java | @Override
public int compare(Object a, Object b) {
SubQuery sqa = (SubQuery) a;
SubQuery sqb = (SubQuery) b;
if (sqa.parentView == null && sqb.parentView == null) {
return sqb.level - sqa.level;
} else if (sqa.parentView != null && sqb.parentView != null) {
int ia = database.schemaManager.getTableIndex(sqa.parentView);
int ib = database.schemaManager.getTableIndex(sqb.parentView);
if (ia == -1) {
ia = database.schemaManager.getTables(
sqa.parentView.getSchemaName().name).size();
}
if (ib == -1) {
ib = database.schemaManager.getTables(
sqb.parentView.getSchemaName().name).size();
}
int diff = ia - ib;
return diff == 0 ? sqb.level - sqa.level
: diff;
} else {
return sqa.parentView == null ? 1
: -1;
}
} | [
"@",
"Override",
"public",
"int",
"compare",
"(",
"Object",
"a",
",",
"Object",
"b",
")",
"{",
"SubQuery",
"sqa",
"=",
"(",
"SubQuery",
")",
"a",
";",
"SubQuery",
"sqb",
"=",
"(",
"SubQuery",
")",
"b",
";",
"if",
"(",
"sqa",
".",
"parentView",
"=="... | This results in the following sort order:
view subqueries, then other subqueries
view subqueries:
views sorted by creation order (earlier declaration first)
other subqueries:
subqueries sorted by depth within select query (deep == higher level) | [
"This",
"results",
"in",
"the",
"following",
"sort",
"order",
":"
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/SubQuery.java#L250-L280 |
JosePaumard/streams-utils | src/main/java/org/paumard/streams/StreamsUtils.java | StreamsUtils.gate | @Deprecated(since="2.0")
public static <E> Stream<E> gate(Stream<E> stream, Predicate<? super E> validator) {
Objects.requireNonNull(stream);
Objects.requireNonNull(validator);
GatingSpliterator<E> spliterator = GatingSpliterator.of(stream.spliterator(), validator);
return StreamSupport.stream(spliterator, stream.isParallel()).onClose(stream::close);
} | java | @Deprecated(since="2.0")
public static <E> Stream<E> gate(Stream<E> stream, Predicate<? super E> validator) {
Objects.requireNonNull(stream);
Objects.requireNonNull(validator);
GatingSpliterator<E> spliterator = GatingSpliterator.of(stream.spliterator(), validator);
return StreamSupport.stream(spliterator, stream.isParallel()).onClose(stream::close);
} | [
"@",
"Deprecated",
"(",
"since",
"=",
"\"2.0\"",
")",
"public",
"static",
"<",
"E",
">",
"Stream",
"<",
"E",
">",
"gate",
"(",
"Stream",
"<",
"E",
">",
"stream",
",",
"Predicate",
"<",
"?",
"super",
"E",
">",
"validator",
")",
"{",
"Objects",
".",
... | <p>Generates a stream that does not generate any element, until the validator becomes true for an element of
the provided stream. From this point, the returns stream is identical to the provided stream. </p>
<p>If you are using Java 9, then yo should use <code>Stream.dropWhile(Predicate)</code>. </p>
<p>A <code>NullPointerException</code> will be thrown if the provided stream of the validator predicate is null.</p>
@param stream the input stream. Will throw a <code>NullPointerException</code> if <code>null</code>.
@param validator the predicate applied to the elements of the input stream.
Will throw a <code>NullPointerException</code> if <code>null</code>.
@param <E> the type of the stream and the returned stream.
@return a stream that starts when the validator becomes true.
@deprecated Java 9 added the
<a href="https://docs.oracle.com/javase/9/docs/api/java/util/stream/Stream.html#dropWhile-java.util.function.Predicate-">
Stream.dropWhile(Predicate)</a> that does the same. | [
"<p",
">",
"Generates",
"a",
"stream",
"that",
"does",
"not",
"generate",
"any",
"element",
"until",
"the",
"validator",
"becomes",
"true",
"for",
"an",
"element",
"of",
"the",
"provided",
"stream",
".",
"From",
"this",
"point",
"the",
"returns",
"stream",
... | train | https://github.com/JosePaumard/streams-utils/blob/56152574af0aca44c5f679761202a8f90984ab73/src/main/java/org/paumard/streams/StreamsUtils.java#L509-L516 |
udoprog/ffwd-client-java | src/main/java/com/google/protobuf250/DynamicMessage.java | DynamicMessage.getDefaultInstance | public static DynamicMessage getDefaultInstance(Descriptor type) {
return new DynamicMessage(type, FieldSet.<FieldDescriptor>emptySet(),
UnknownFieldSet.getDefaultInstance());
} | java | public static DynamicMessage getDefaultInstance(Descriptor type) {
return new DynamicMessage(type, FieldSet.<FieldDescriptor>emptySet(),
UnknownFieldSet.getDefaultInstance());
} | [
"public",
"static",
"DynamicMessage",
"getDefaultInstance",
"(",
"Descriptor",
"type",
")",
"{",
"return",
"new",
"DynamicMessage",
"(",
"type",
",",
"FieldSet",
".",
"<",
"FieldDescriptor",
">",
"emptySet",
"(",
")",
",",
"UnknownFieldSet",
".",
"getDefaultInstan... | Get a {@code DynamicMessage} representing the default instance of the
given type. | [
"Get",
"a",
"{"
] | train | https://github.com/udoprog/ffwd-client-java/blob/b4161d2b138e3edb8fa9420cc3cc653d5764cf5b/src/main/java/com/google/protobuf250/DynamicMessage.java#L67-L70 |
gallandarakhneorg/afc | maven/maventools/src/main/java/org/arakhne/maven/AbstractArakhneMojo.java | AbstractArakhneMojo.getLString | public static final String getLString(Class<?> source, String label, Object... params) {
final ResourceBundle rb = ResourceBundle.getBundle(source.getCanonicalName());
String text = rb.getString(label);
text = text.replaceAll("[\\n\\r]", "\n"); //$NON-NLS-1$ //$NON-NLS-2$
text = text.replaceAll("\\t", "\t"); //$NON-NLS-1$ //$NON-NLS-2$
text = MessageFormat.format(text, params);
return text;
} | java | public static final String getLString(Class<?> source, String label, Object... params) {
final ResourceBundle rb = ResourceBundle.getBundle(source.getCanonicalName());
String text = rb.getString(label);
text = text.replaceAll("[\\n\\r]", "\n"); //$NON-NLS-1$ //$NON-NLS-2$
text = text.replaceAll("\\t", "\t"); //$NON-NLS-1$ //$NON-NLS-2$
text = MessageFormat.format(text, params);
return text;
} | [
"public",
"static",
"final",
"String",
"getLString",
"(",
"Class",
"<",
"?",
">",
"source",
",",
"String",
"label",
",",
"Object",
"...",
"params",
")",
"{",
"final",
"ResourceBundle",
"rb",
"=",
"ResourceBundle",
".",
"getBundle",
"(",
"source",
".",
"get... | Read a resource property and replace the parametrized macros by the given parameters.
@param source
is the source of the properties.
@param label
is the name of the property.
@param params
are the parameters to replace.
@return the read text. | [
"Read",
"a",
"resource",
"property",
"and",
"replace",
"the",
"parametrized",
"macros",
"by",
"the",
"given",
"parameters",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/maven/maventools/src/main/java/org/arakhne/maven/AbstractArakhneMojo.java#L382-L389 |
OWASP/java-html-sanitizer | src/main/java/org/owasp/html/HtmlStreamRenderer.java | HtmlStreamRenderer.error | private final void error(String message, CharSequence identifier) {
if (badHtmlHandler != Handler.DO_NOTHING) { // Avoid string append.
badHtmlHandler.handle(message + " : " + identifier);
}
} | java | private final void error(String message, CharSequence identifier) {
if (badHtmlHandler != Handler.DO_NOTHING) { // Avoid string append.
badHtmlHandler.handle(message + " : " + identifier);
}
} | [
"private",
"final",
"void",
"error",
"(",
"String",
"message",
",",
"CharSequence",
"identifier",
")",
"{",
"if",
"(",
"badHtmlHandler",
"!=",
"Handler",
".",
"DO_NOTHING",
")",
"{",
"// Avoid string append.",
"badHtmlHandler",
".",
"handle",
"(",
"message",
"+"... | Called when the series of calls make no sense.
May be overridden to throw an unchecked throwable, to log, or to take some
other action.
@param message for human consumption.
@param identifier an HTML identifier associated with the message. | [
"Called",
"when",
"the",
"series",
"of",
"calls",
"make",
"no",
"sense",
".",
"May",
"be",
"overridden",
"to",
"throw",
"an",
"unchecked",
"throwable",
"to",
"log",
"or",
"to",
"take",
"some",
"other",
"action",
"."
] | train | https://github.com/OWASP/java-html-sanitizer/blob/a30315fe9a41e19c449628e7ef3488b3a7856009/src/main/java/org/owasp/html/HtmlStreamRenderer.java#L115-L119 |
krummas/DrizzleJDBC | src/main/java/org/drizzle/jdbc/DrizzlePreparedStatement.java | DrizzlePreparedStatement.setCharacterStream | public void setCharacterStream(final int parameterIndex, final Reader reader, final int length) throws SQLException {
try {
setParameter(parameterIndex, new ReaderParameter(reader, length));
} catch (IOException e) {
throw SQLExceptionMapper.getSQLException("Could not read stream: " + e.getMessage(), e);
}
} | java | public void setCharacterStream(final int parameterIndex, final Reader reader, final int length) throws SQLException {
try {
setParameter(parameterIndex, new ReaderParameter(reader, length));
} catch (IOException e) {
throw SQLExceptionMapper.getSQLException("Could not read stream: " + e.getMessage(), e);
}
} | [
"public",
"void",
"setCharacterStream",
"(",
"final",
"int",
"parameterIndex",
",",
"final",
"Reader",
"reader",
",",
"final",
"int",
"length",
")",
"throws",
"SQLException",
"{",
"try",
"{",
"setParameter",
"(",
"parameterIndex",
",",
"new",
"ReaderParameter",
... | Sets the designated parameter to the given <code>Reader</code> object, which is the given number of characters
long. When a very large UNICODE value is input to a <code>LONGVARCHAR</code> parameter, it may be more practical
to send it via a <code>java.io.Reader</code> object. The data will be read from the stream as needed until
end-of-file is reached. The JDBC driver will do any necessary conversion from UNICODE to the database char
format.
<p/>
<P><B>Note:</B> This stream object can either be a standard Java stream object or your own subclass that
implements the standard interface.
@param parameterIndex the first parameter is 1, the second is 2, ...
@param reader the <code>java.io.Reader</code> object that contains the Unicode data
@param length the number of characters in the stream
@throws java.sql.SQLException if parameterIndex does not correspond to a parameter marker in the SQL statement;
if a database access error occurs or this method is called on a closed
<code>PreparedStatement</code>
@since 1.2 | [
"Sets",
"the",
"designated",
"parameter",
"to",
"the",
"given",
"<code",
">",
"Reader<",
"/",
"code",
">",
"object",
"which",
"is",
"the",
"given",
"number",
"of",
"characters",
"long",
".",
"When",
"a",
"very",
"large",
"UNICODE",
"value",
"is",
"input",
... | train | https://github.com/krummas/DrizzleJDBC/blob/716f31fd71f3cc289edf69844d8117deb86d98d6/src/main/java/org/drizzle/jdbc/DrizzlePreparedStatement.java#L224-L231 |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/mappers/CollectionMapperFactory.java | CollectionMapperFactory.createMapper | private Mapper createMapper(Field field, boolean indexed) {
lock.lock();
try {
Mapper mapper;
Class<?> fieldType = field.getType();
Type genericType = field.getGenericType();
String cacheKey = computeCacheKey(genericType, indexed);
mapper = cache.get(cacheKey);
if (mapper != null) {
return mapper;
}
if (List.class.isAssignableFrom(fieldType)) {
mapper = new ListMapper(genericType, indexed);
} else if (Set.class.isAssignableFrom(fieldType)) {
mapper = new SetMapper(genericType, indexed);
} else {
// we shouldn't be getting here
throw new IllegalArgumentException(
String.format("Field type must be List or Set, found %s", fieldType));
}
cache.put(cacheKey, mapper);
return mapper;
} finally {
lock.unlock();
}
} | java | private Mapper createMapper(Field field, boolean indexed) {
lock.lock();
try {
Mapper mapper;
Class<?> fieldType = field.getType();
Type genericType = field.getGenericType();
String cacheKey = computeCacheKey(genericType, indexed);
mapper = cache.get(cacheKey);
if (mapper != null) {
return mapper;
}
if (List.class.isAssignableFrom(fieldType)) {
mapper = new ListMapper(genericType, indexed);
} else if (Set.class.isAssignableFrom(fieldType)) {
mapper = new SetMapper(genericType, indexed);
} else {
// we shouldn't be getting here
throw new IllegalArgumentException(
String.format("Field type must be List or Set, found %s", fieldType));
}
cache.put(cacheKey, mapper);
return mapper;
} finally {
lock.unlock();
}
} | [
"private",
"Mapper",
"createMapper",
"(",
"Field",
"field",
",",
"boolean",
"indexed",
")",
"{",
"lock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"Mapper",
"mapper",
";",
"Class",
"<",
"?",
">",
"fieldType",
"=",
"field",
".",
"getType",
"(",
")",
";"... | Creates a new Mapper for the given field.
@param field
the field
@param indexed
whether or not the field is to be indexed
@return the Mapper | [
"Creates",
"a",
"new",
"Mapper",
"for",
"the",
"given",
"field",
"."
] | train | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/mappers/CollectionMapperFactory.java#L104-L129 |
apache/groovy | src/main/java/org/codehaus/groovy/runtime/ResourceGroovyMethods.java | ResourceGroovyMethods.newReader | public static BufferedReader newReader(File file, String charset)
throws FileNotFoundException, UnsupportedEncodingException {
return new BufferedReader(new InputStreamReader(new FileInputStream(file), charset));
} | java | public static BufferedReader newReader(File file, String charset)
throws FileNotFoundException, UnsupportedEncodingException {
return new BufferedReader(new InputStreamReader(new FileInputStream(file), charset));
} | [
"public",
"static",
"BufferedReader",
"newReader",
"(",
"File",
"file",
",",
"String",
"charset",
")",
"throws",
"FileNotFoundException",
",",
"UnsupportedEncodingException",
"{",
"return",
"new",
"BufferedReader",
"(",
"new",
"InputStreamReader",
"(",
"new",
"FileInp... | Create a buffered reader for this file, using the specified
charset as the encoding.
@param file a File
@param charset the charset for this File
@return a BufferedReader
@throws FileNotFoundException if the File was not found
@throws UnsupportedEncodingException if the encoding specified is not supported
@since 1.0 | [
"Create",
"a",
"buffered",
"reader",
"for",
"this",
"file",
"using",
"the",
"specified",
"charset",
"as",
"the",
"encoding",
"."
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/ResourceGroovyMethods.java#L1756-L1759 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java | ModelsImpl.deleteHierarchicalEntity | public OperationStatus deleteHierarchicalEntity(UUID appId, String versionId, UUID hEntityId) {
return deleteHierarchicalEntityWithServiceResponseAsync(appId, versionId, hEntityId).toBlocking().single().body();
} | java | public OperationStatus deleteHierarchicalEntity(UUID appId, String versionId, UUID hEntityId) {
return deleteHierarchicalEntityWithServiceResponseAsync(appId, versionId, hEntityId).toBlocking().single().body();
} | [
"public",
"OperationStatus",
"deleteHierarchicalEntity",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"UUID",
"hEntityId",
")",
"{",
"return",
"deleteHierarchicalEntityWithServiceResponseAsync",
"(",
"appId",
",",
"versionId",
",",
"hEntityId",
")",
".",
"to... | Deletes a hierarchical entity extractor from the application version.
@param appId The application ID.
@param versionId The version ID.
@param hEntityId The hierarchical entity extractor ID.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the OperationStatus object if successful. | [
"Deletes",
"a",
"hierarchical",
"entity",
"extractor",
"from",
"the",
"application",
"version",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L3846-L3848 |
onelogin/onelogin-java-sdk | src/main/java/com/onelogin/sdk/conn/Client.java | Client.verifyFactor | public Boolean verifyFactor(long userId, long deviceId, String otpToken, String stateToken) throws OAuthSystemException, OAuthProblemException, URISyntaxException
{
cleanError();
prepareToken();
URIBuilder url = new URIBuilder(settings.getURL(Constants.VERIFY_FACTOR_URL, userId, deviceId));
url = new URIBuilder("http://pitbulk.no-ip.org/newonelogin/demo1/data.json");
OneloginURLConnectionClient httpClient = new OneloginURLConnectionClient();
OAuthClient oAuthClient = new OAuthClient(httpClient);
OAuthClientRequest bearerRequest = new OAuthBearerClientRequest(url.toString())
.buildHeaderMessage();
Map<String, String> headers = getAuthorizedHeader();
bearerRequest.setHeaders(headers);
HashMap<String, Object> params = new HashMap<String, Object>();
if (otpToken!= null && !otpToken.isEmpty()) {
params.put("otp_token", otpToken);
}
if (stateToken!= null && !stateToken.isEmpty()) {
params.put("state_token", stateToken);
}
if (!params.isEmpty()) {
String body = JSONUtils.buildJSON(params);
bearerRequest.setBody(body);
}
Boolean success = true;
OneloginOAuthJSONResourceResponse oAuthResponse = oAuthClient.resource(bearerRequest, OAuth.HttpMethod.POST, OneloginOAuthJSONResourceResponse.class);
if (oAuthResponse.getResponseCode() != 200) {
success = false;
error = oAuthResponse.getError();
errorDescription = oAuthResponse.getErrorDescription();
}
return success;
} | java | public Boolean verifyFactor(long userId, long deviceId, String otpToken, String stateToken) throws OAuthSystemException, OAuthProblemException, URISyntaxException
{
cleanError();
prepareToken();
URIBuilder url = new URIBuilder(settings.getURL(Constants.VERIFY_FACTOR_URL, userId, deviceId));
url = new URIBuilder("http://pitbulk.no-ip.org/newonelogin/demo1/data.json");
OneloginURLConnectionClient httpClient = new OneloginURLConnectionClient();
OAuthClient oAuthClient = new OAuthClient(httpClient);
OAuthClientRequest bearerRequest = new OAuthBearerClientRequest(url.toString())
.buildHeaderMessage();
Map<String, String> headers = getAuthorizedHeader();
bearerRequest.setHeaders(headers);
HashMap<String, Object> params = new HashMap<String, Object>();
if (otpToken!= null && !otpToken.isEmpty()) {
params.put("otp_token", otpToken);
}
if (stateToken!= null && !stateToken.isEmpty()) {
params.put("state_token", stateToken);
}
if (!params.isEmpty()) {
String body = JSONUtils.buildJSON(params);
bearerRequest.setBody(body);
}
Boolean success = true;
OneloginOAuthJSONResourceResponse oAuthResponse = oAuthClient.resource(bearerRequest, OAuth.HttpMethod.POST, OneloginOAuthJSONResourceResponse.class);
if (oAuthResponse.getResponseCode() != 200) {
success = false;
error = oAuthResponse.getError();
errorDescription = oAuthResponse.getErrorDescription();
}
return success;
} | [
"public",
"Boolean",
"verifyFactor",
"(",
"long",
"userId",
",",
"long",
"deviceId",
",",
"String",
"otpToken",
",",
"String",
"stateToken",
")",
"throws",
"OAuthSystemException",
",",
"OAuthProblemException",
",",
"URISyntaxException",
"{",
"cleanError",
"(",
")",
... | Authenticates a one-time password (OTP) code provided by a multifactor authentication (MFA) device.
@param userId
The id of the user.
@param deviceId
The id of the MFA device.
@param otpToken
OTP code provided by the device or SMS message sent to user.
When a device like OneLogin Protect that supports Push has
been used you do not need to provide the otp_token.
@param stateToken
The state_token is returned after a successful request
to Enroll a Factor or Activate a Factor.
MUST be provided if the needs_trigger attribute from
the proceeding calls is set to true.
@return Boolean True if Factor is verified
@throws OAuthSystemException - if there is a IOException reading parameters of the httpURLConnection
@throws OAuthProblemException - if there are errors validating the OneloginOAuthJSONResourceResponse and throwOAuthProblemException is enabled
@throws URISyntaxException - if there is an error when generating the target URL at the URIBuilder constructor
@see <a target="_blank" href="https://developers.onelogin.com/api-docs/1/multi-factor-authentication/verify-factor">Verify an Authentication Factor documentation</a> | [
"Authenticates",
"a",
"one",
"-",
"time",
"password",
"(",
"OTP",
")",
"code",
"provided",
"by",
"a",
"multifactor",
"authentication",
"(",
"MFA",
")",
"device",
"."
] | train | https://github.com/onelogin/onelogin-java-sdk/blob/1570b78033dcc1c7387099e77fe41b6b0638df8c/src/main/java/com/onelogin/sdk/conn/Client.java#L2838-L2875 |
geomajas/geomajas-project-geometry | core/src/main/java/org/geomajas/geometry/service/GeometryService.java | GeometryService.toPolygon | public static Geometry toPolygon(Bbox bounds) {
double minX = bounds.getX();
double minY = bounds.getY();
double maxX = bounds.getMaxX();
double maxY = bounds.getMaxY();
Geometry polygon = new Geometry(Geometry.POLYGON, 0, -1);
Geometry linearRing = new Geometry(Geometry.LINEAR_RING, 0, -1);
linearRing.setCoordinates(new Coordinate[] { new Coordinate(minX, minY), new Coordinate(maxX, minY),
new Coordinate(maxX, maxY), new Coordinate(minX, maxY), new Coordinate(minX, minY) });
polygon.setGeometries(new Geometry[] { linearRing });
return polygon;
} | java | public static Geometry toPolygon(Bbox bounds) {
double minX = bounds.getX();
double minY = bounds.getY();
double maxX = bounds.getMaxX();
double maxY = bounds.getMaxY();
Geometry polygon = new Geometry(Geometry.POLYGON, 0, -1);
Geometry linearRing = new Geometry(Geometry.LINEAR_RING, 0, -1);
linearRing.setCoordinates(new Coordinate[] { new Coordinate(minX, minY), new Coordinate(maxX, minY),
new Coordinate(maxX, maxY), new Coordinate(minX, maxY), new Coordinate(minX, minY) });
polygon.setGeometries(new Geometry[] { linearRing });
return polygon;
} | [
"public",
"static",
"Geometry",
"toPolygon",
"(",
"Bbox",
"bounds",
")",
"{",
"double",
"minX",
"=",
"bounds",
".",
"getX",
"(",
")",
";",
"double",
"minY",
"=",
"bounds",
".",
"getY",
"(",
")",
";",
"double",
"maxX",
"=",
"bounds",
".",
"getMaxX",
"... | Transform the given bounding box into a polygon geometry.
@param bounds The bounding box to transform.
@return Returns the polygon equivalent of the given bounding box. | [
"Transform",
"the",
"given",
"bounding",
"box",
"into",
"a",
"polygon",
"geometry",
"."
] | train | https://github.com/geomajas/geomajas-project-geometry/blob/09a214fede69c9c01e41630828c4abbb551a557d/core/src/main/java/org/geomajas/geometry/service/GeometryService.java#L140-L153 |
code4everything/util | src/main/java/com/zhazhapan/util/NetUtils.java | NetUtils.removeCookie | public static boolean removeCookie(String name, Cookie[] cookies, HttpServletResponse response) {
if (Checker.isNotEmpty(name) && Checker.isNotEmpty(cookies)) {
for (Cookie cookie : cookies) {
if (name.equals(cookie.getName())) {
return removeCookie(cookie, response);
}
}
}
return false;
} | java | public static boolean removeCookie(String name, Cookie[] cookies, HttpServletResponse response) {
if (Checker.isNotEmpty(name) && Checker.isNotEmpty(cookies)) {
for (Cookie cookie : cookies) {
if (name.equals(cookie.getName())) {
return removeCookie(cookie, response);
}
}
}
return false;
} | [
"public",
"static",
"boolean",
"removeCookie",
"(",
"String",
"name",
",",
"Cookie",
"[",
"]",
"cookies",
",",
"HttpServletResponse",
"response",
")",
"{",
"if",
"(",
"Checker",
".",
"isNotEmpty",
"(",
"name",
")",
"&&",
"Checker",
".",
"isNotEmpty",
"(",
... | 删除指定Cookie
@param name Cookie名
@param cookies {@link Cookie}
@param response {@link HttpServletResponse}
@return {@link Boolean}
@since 1.0.8 | [
"删除指定Cookie"
] | train | https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/NetUtils.java#L533-L542 |
QSFT/Doradus | doradus-server/src/main/java/com/dell/doradus/olap/ParsedQuery.java | ParsedQuery.getInt | public int getInt(String key, int defaultValue) {
String value = get(key);
if(value == null) return defaultValue;
try {
return Integer.parseInt(value);
} catch (NumberFormatException e) {
throw new IllegalArgumentException(key + " parameter should be a number");
}
} | java | public int getInt(String key, int defaultValue) {
String value = get(key);
if(value == null) return defaultValue;
try {
return Integer.parseInt(value);
} catch (NumberFormatException e) {
throw new IllegalArgumentException(key + " parameter should be a number");
}
} | [
"public",
"int",
"getInt",
"(",
"String",
"key",
",",
"int",
"defaultValue",
")",
"{",
"String",
"value",
"=",
"get",
"(",
"key",
")",
";",
"if",
"(",
"value",
"==",
"null",
")",
"return",
"defaultValue",
";",
"try",
"{",
"return",
"Integer",
".",
"p... | Returns an integer value by the key specified or defaultValue if the key was not provided | [
"Returns",
"an",
"integer",
"value",
"by",
"the",
"key",
"specified",
"or",
"defaultValue",
"if",
"the",
"key",
"was",
"not",
"provided"
] | train | https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/olap/ParsedQuery.java#L123-L131 |
Alluxio/alluxio | shell/src/main/java/alluxio/cli/fs/command/DuCommand.java | DuCommand.getFormattedValues | private String getFormattedValues(boolean readable, long size, long totalSize) {
// If size is 1, total size is 5, and readable is true, it will
// return a string as "1B (20%)"
int percent = totalSize == 0 ? 0 : (int) (size * 100 / totalSize);
String subSizeMessage = readable ? FormatUtils.getSizeFromBytes(size)
: String.valueOf(size);
return String.format(VALUE_AND_PERCENT_FORMAT, subSizeMessage, percent);
} | java | private String getFormattedValues(boolean readable, long size, long totalSize) {
// If size is 1, total size is 5, and readable is true, it will
// return a string as "1B (20%)"
int percent = totalSize == 0 ? 0 : (int) (size * 100 / totalSize);
String subSizeMessage = readable ? FormatUtils.getSizeFromBytes(size)
: String.valueOf(size);
return String.format(VALUE_AND_PERCENT_FORMAT, subSizeMessage, percent);
} | [
"private",
"String",
"getFormattedValues",
"(",
"boolean",
"readable",
",",
"long",
"size",
",",
"long",
"totalSize",
")",
"{",
"// If size is 1, total size is 5, and readable is true, it will",
"// return a string as \"1B (20%)\"",
"int",
"percent",
"=",
"totalSize",
"==",
... | Gets the size and its percentage information, if readable option is provided,
get the size in human readable format.
@param readable whether to print info of human readable format
@param size the size to get information from
@param totalSize the total size to calculate percentage information
@return the formatted value and percentage information | [
"Gets",
"the",
"size",
"and",
"its",
"percentage",
"information",
"if",
"readable",
"option",
"is",
"provided",
"get",
"the",
"size",
"in",
"human",
"readable",
"format",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/shell/src/main/java/alluxio/cli/fs/command/DuCommand.java#L156-L163 |
albfernandez/itext2 | src/main/java/com/lowagie/text/rtf/parser/RtfParser.java | RtfParser.convertRtfDocument | public void convertRtfDocument(InputStream readerIn, Document doc) throws IOException {
if(readerIn == null || doc == null) return;
this.init(TYPE_CONVERT, null, readerIn, doc, null);
this.setCurrentDestination(RtfDestinationMgr.DESTINATION_DOCUMENT);
this.groupLevel = 0;
this.tokenise();
} | java | public void convertRtfDocument(InputStream readerIn, Document doc) throws IOException {
if(readerIn == null || doc == null) return;
this.init(TYPE_CONVERT, null, readerIn, doc, null);
this.setCurrentDestination(RtfDestinationMgr.DESTINATION_DOCUMENT);
this.groupLevel = 0;
this.tokenise();
} | [
"public",
"void",
"convertRtfDocument",
"(",
"InputStream",
"readerIn",
",",
"Document",
"doc",
")",
"throws",
"IOException",
"{",
"if",
"(",
"readerIn",
"==",
"null",
"||",
"doc",
"==",
"null",
")",
"return",
";",
"this",
".",
"init",
"(",
"TYPE_CONVERT",
... | Converts an RTF document to an iText document.
Usage: Create a parser object and call this method with the input stream and the iText Document object
@param readerIn
The Reader to read the RTF file from.
@param doc
The iText document that the RTF file is to be added to.
@throws IOException
On I/O errors.
@since 2.1.3 | [
"Converts",
"an",
"RTF",
"document",
"to",
"an",
"iText",
"document",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/rtf/parser/RtfParser.java#L538-L544 |
Crab2died/Excel4J | src/main/java/com/github/crab2died/ExcelUtils.java | ExcelUtils.simpleSheet2Excel | public void simpleSheet2Excel(List<SimpleSheetWrapper> sheets, String targetPath)
throws IOException {
try (OutputStream fos = new FileOutputStream(targetPath);
Workbook workbook = exportExcelBySimpleHandler(sheets, true)) {
workbook.write(fos);
}
} | java | public void simpleSheet2Excel(List<SimpleSheetWrapper> sheets, String targetPath)
throws IOException {
try (OutputStream fos = new FileOutputStream(targetPath);
Workbook workbook = exportExcelBySimpleHandler(sheets, true)) {
workbook.write(fos);
}
} | [
"public",
"void",
"simpleSheet2Excel",
"(",
"List",
"<",
"SimpleSheetWrapper",
">",
"sheets",
",",
"String",
"targetPath",
")",
"throws",
"IOException",
"{",
"try",
"(",
"OutputStream",
"fos",
"=",
"new",
"FileOutputStream",
"(",
"targetPath",
")",
";",
"Workboo... | 无模板、无注解、多sheet数据
@param sheets 待导出sheet数据
@param targetPath 生成的Excel输出全路径
@throws IOException 异常 | [
"无模板、无注解、多sheet数据"
] | train | https://github.com/Crab2died/Excel4J/blob/2ab0a3b8226a69ff868c3ead6e724f3a774f5f77/src/main/java/com/github/crab2died/ExcelUtils.java#L1386-L1393 |
alipay/sofa-rpc | extension-impl/remoting-bolt/src/main/java/com/alipay/sofa/rpc/transport/bolt/AloneBoltClientConnectionManager.java | AloneBoltClientConnectionManager.getConnection | public Connection getConnection(RpcClient rpcClient, ClientTransportConfig transportConfig, Url url) {
if (rpcClient == null || transportConfig == null || url == null) {
return null;
}
Connection connection;
try {
connection = rpcClient.getConnection(url, url.getConnectTimeout());
} catch (InterruptedException e) {
throw new SofaRpcRuntimeException(e);
} catch (RemotingException e) {
throw new SofaRpcRuntimeException(e);
}
if (connection == null) {
return null;
}
return connection;
} | java | public Connection getConnection(RpcClient rpcClient, ClientTransportConfig transportConfig, Url url) {
if (rpcClient == null || transportConfig == null || url == null) {
return null;
}
Connection connection;
try {
connection = rpcClient.getConnection(url, url.getConnectTimeout());
} catch (InterruptedException e) {
throw new SofaRpcRuntimeException(e);
} catch (RemotingException e) {
throw new SofaRpcRuntimeException(e);
}
if (connection == null) {
return null;
}
return connection;
} | [
"public",
"Connection",
"getConnection",
"(",
"RpcClient",
"rpcClient",
",",
"ClientTransportConfig",
"transportConfig",
",",
"Url",
"url",
")",
"{",
"if",
"(",
"rpcClient",
"==",
"null",
"||",
"transportConfig",
"==",
"null",
"||",
"url",
"==",
"null",
")",
"... | 通过配置获取长连接
@param rpcClient bolt客户端
@param transportConfig 传输层配置
@param url 传输层地址
@return 长连接 | [
"通过配置获取长连接"
] | train | https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/extension-impl/remoting-bolt/src/main/java/com/alipay/sofa/rpc/transport/bolt/AloneBoltClientConnectionManager.java#L48-L65 |
blackfizz/EazeGraph | EazeGraphLibrary/src/main/java/org/eazegraph/lib/utils/Utils.java | Utils.vectorToScalarScroll | public static float vectorToScalarScroll(float _Dx, float _Dy, float _X, float _Y) {
// get the length of the vector
float l = (float) Math.sqrt(_Dx * _Dx + _Dy * _Dy);
// decide if the scalar should be negative or positive by finding
// the dot product of the vector perpendicular to (_X,_Y).
float crossX = -_Y;
float crossY = _X;
float dot = (crossX * _Dx + crossY * _Dy);
float sign = Math.signum(dot);
return l * sign;
} | java | public static float vectorToScalarScroll(float _Dx, float _Dy, float _X, float _Y) {
// get the length of the vector
float l = (float) Math.sqrt(_Dx * _Dx + _Dy * _Dy);
// decide if the scalar should be negative or positive by finding
// the dot product of the vector perpendicular to (_X,_Y).
float crossX = -_Y;
float crossY = _X;
float dot = (crossX * _Dx + crossY * _Dy);
float sign = Math.signum(dot);
return l * sign;
} | [
"public",
"static",
"float",
"vectorToScalarScroll",
"(",
"float",
"_Dx",
",",
"float",
"_Dy",
",",
"float",
"_X",
",",
"float",
"_Y",
")",
"{",
"// get the length of the vector",
"float",
"l",
"=",
"(",
"float",
")",
"Math",
".",
"sqrt",
"(",
"_Dx",
"*",
... | Helper method for translating (_X,_Y) scroll vectors into scalar rotation of a circle.
@param _Dx The _X component of the current scroll vector.
@param _Dy The _Y component of the current scroll vector.
@param _X The _X position of the current touch, relative to the circle center.
@param _Y The _Y position of the current touch, relative to the circle center.
@return The scalar representing the change in angular position for this scroll. | [
"Helper",
"method",
"for",
"translating",
"(",
"_X",
"_Y",
")",
"scroll",
"vectors",
"into",
"scalar",
"rotation",
"of",
"a",
"circle",
"."
] | train | https://github.com/blackfizz/EazeGraph/blob/ce5e68ecc70e154f83bbb2fcce1a970db125c1e6/EazeGraphLibrary/src/main/java/org/eazegraph/lib/utils/Utils.java#L74-L87 |
Wikidata/Wikidata-Toolkit | wdtk-examples/src/main/java/org/wikidata/wdtk/examples/ClassPropertyUsageAnalyzer.java | ClassPropertyUsageAnalyzer.printRelatedProperties | private void printRelatedProperties(PrintStream out, UsageRecord usageRecord) {
List<ImmutablePair<PropertyIdValue, Double>> list = new ArrayList<ImmutablePair<PropertyIdValue, Double>>(
usageRecord.propertyCoCounts.size());
for (Entry<PropertyIdValue, Integer> coCountEntry : usageRecord.propertyCoCounts
.entrySet()) {
double otherThisItemRate = (double) coCountEntry.getValue()
/ usageRecord.itemCount;
double otherGlobalItemRate = (double) this.propertyRecords
.get(coCountEntry.getKey()).itemCount
/ this.countPropertyItems;
double otherThisItemRateStep = 1 / (1 + Math.exp(6 * (-2
* otherThisItemRate + 0.5)));
double otherInvGlobalItemRateStep = 1 / (1 + Math.exp(6 * (-2
* (1 - otherGlobalItemRate) + 0.5)));
list.add(new ImmutablePair<PropertyIdValue, Double>(coCountEntry
.getKey(), otherThisItemRateStep
* otherInvGlobalItemRateStep * otherThisItemRate
/ otherGlobalItemRate));
}
Collections.sort(list,
new Comparator<ImmutablePair<PropertyIdValue, Double>>() {
@Override
public int compare(
ImmutablePair<PropertyIdValue, Double> o1,
ImmutablePair<PropertyIdValue, Double> o2) {
return o2.getValue().compareTo(o1.getValue());
}
});
out.print(",\"");
int count = 0;
for (ImmutablePair<PropertyIdValue, Double> relatedProperty : list) {
if (relatedProperty.right < 1.5) {
break;
}
if (count > 0) {
out.print("@");
}
// makeshift escaping for Miga:
out.print(getPropertyLabel(relatedProperty.left).replace("@", "@"));
count++;
}
out.print("\"");
} | java | private void printRelatedProperties(PrintStream out, UsageRecord usageRecord) {
List<ImmutablePair<PropertyIdValue, Double>> list = new ArrayList<ImmutablePair<PropertyIdValue, Double>>(
usageRecord.propertyCoCounts.size());
for (Entry<PropertyIdValue, Integer> coCountEntry : usageRecord.propertyCoCounts
.entrySet()) {
double otherThisItemRate = (double) coCountEntry.getValue()
/ usageRecord.itemCount;
double otherGlobalItemRate = (double) this.propertyRecords
.get(coCountEntry.getKey()).itemCount
/ this.countPropertyItems;
double otherThisItemRateStep = 1 / (1 + Math.exp(6 * (-2
* otherThisItemRate + 0.5)));
double otherInvGlobalItemRateStep = 1 / (1 + Math.exp(6 * (-2
* (1 - otherGlobalItemRate) + 0.5)));
list.add(new ImmutablePair<PropertyIdValue, Double>(coCountEntry
.getKey(), otherThisItemRateStep
* otherInvGlobalItemRateStep * otherThisItemRate
/ otherGlobalItemRate));
}
Collections.sort(list,
new Comparator<ImmutablePair<PropertyIdValue, Double>>() {
@Override
public int compare(
ImmutablePair<PropertyIdValue, Double> o1,
ImmutablePair<PropertyIdValue, Double> o2) {
return o2.getValue().compareTo(o1.getValue());
}
});
out.print(",\"");
int count = 0;
for (ImmutablePair<PropertyIdValue, Double> relatedProperty : list) {
if (relatedProperty.right < 1.5) {
break;
}
if (count > 0) {
out.print("@");
}
// makeshift escaping for Miga:
out.print(getPropertyLabel(relatedProperty.left).replace("@", "@"));
count++;
}
out.print("\"");
} | [
"private",
"void",
"printRelatedProperties",
"(",
"PrintStream",
"out",
",",
"UsageRecord",
"usageRecord",
")",
"{",
"List",
"<",
"ImmutablePair",
"<",
"PropertyIdValue",
",",
"Double",
">",
">",
"list",
"=",
"new",
"ArrayList",
"<",
"ImmutablePair",
"<",
"Prope... | Prints a list of related properties to the output. The list is encoded as
a single CSV value, using "@" as a separator. Miga can decode this.
Standard CSV processors do not support lists of entries as values,
however.
@param out
the output to write to
@param usageRecord
the data to write | [
"Prints",
"a",
"list",
"of",
"related",
"properties",
"to",
"the",
"output",
".",
"The",
"list",
"is",
"encoded",
"as",
"a",
"single",
"CSV",
"value",
"using",
"@",
"as",
"a",
"separator",
".",
"Miga",
"can",
"decode",
"this",
".",
"Standard",
"CSV",
"... | train | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-examples/src/main/java/org/wikidata/wdtk/examples/ClassPropertyUsageAnalyzer.java#L798-L844 |
google/error-prone-javac | src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AnnotationTypeRequiredMemberBuilder.java | AnnotationTypeRequiredMemberBuilder.buildMemberComments | public void buildMemberComments(XMLNode node, Content annotationDocTree) {
if(! configuration.nocomment) {
writer.addComments(currentMember, annotationDocTree);
}
} | java | public void buildMemberComments(XMLNode node, Content annotationDocTree) {
if(! configuration.nocomment) {
writer.addComments(currentMember, annotationDocTree);
}
} | [
"public",
"void",
"buildMemberComments",
"(",
"XMLNode",
"node",
",",
"Content",
"annotationDocTree",
")",
"{",
"if",
"(",
"!",
"configuration",
".",
"nocomment",
")",
"{",
"writer",
".",
"addComments",
"(",
"currentMember",
",",
"annotationDocTree",
")",
";",
... | Build the comments for the member. Do nothing if
{@link Configuration#nocomment} is set to true.
@param node the XML element that specifies which components to document
@param annotationDocTree the content tree to which the documentation will be added | [
"Build",
"the",
"comments",
"for",
"the",
"member",
".",
"Do",
"nothing",
"if",
"{",
"@link",
"Configuration#nocomment",
"}",
"is",
"set",
"to",
"true",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/AnnotationTypeRequiredMemberBuilder.java#L200-L204 |
infinispan/infinispan | client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/transaction/SyncModeTransactionTable.java | SyncModeTransactionTable.createSynchronizationAdapter | private SynchronizationAdapter createSynchronizationAdapter(Transaction transaction) {
SynchronizationAdapter adapter = new SynchronizationAdapter(transaction, RemoteXid.create(uuid));
try {
transaction.registerSynchronization(adapter);
} catch (RollbackException | SystemException e) {
throw new CacheException(e);
}
if (trace) {
log.tracef("Registered synchronization for transaction %s. Sync=%s", transaction, adapter);
}
return adapter;
} | java | private SynchronizationAdapter createSynchronizationAdapter(Transaction transaction) {
SynchronizationAdapter adapter = new SynchronizationAdapter(transaction, RemoteXid.create(uuid));
try {
transaction.registerSynchronization(adapter);
} catch (RollbackException | SystemException e) {
throw new CacheException(e);
}
if (trace) {
log.tracef("Registered synchronization for transaction %s. Sync=%s", transaction, adapter);
}
return adapter;
} | [
"private",
"SynchronizationAdapter",
"createSynchronizationAdapter",
"(",
"Transaction",
"transaction",
")",
"{",
"SynchronizationAdapter",
"adapter",
"=",
"new",
"SynchronizationAdapter",
"(",
"transaction",
",",
"RemoteXid",
".",
"create",
"(",
"uuid",
")",
")",
";",
... | Creates and registers the {@link SynchronizationAdapter} in the {@link Transaction}. | [
"Creates",
"and",
"registers",
"the",
"{"
] | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/transaction/SyncModeTransactionTable.java#L78-L89 |
landawn/AbacusUtil | src/com/landawn/abacus/util/HBaseExecutor.java | HBaseExecutor.get | <T> T get(final Class<T> targetClass, final String tableName, final Object rowKey) throws UncheckedIOException {
return get(targetClass, tableName, AnyGet.of(rowKey));
} | java | <T> T get(final Class<T> targetClass, final String tableName, final Object rowKey) throws UncheckedIOException {
return get(targetClass, tableName, AnyGet.of(rowKey));
} | [
"<",
"T",
">",
"T",
"get",
"(",
"final",
"Class",
"<",
"T",
">",
"targetClass",
",",
"final",
"String",
"tableName",
",",
"final",
"Object",
"rowKey",
")",
"throws",
"UncheckedIOException",
"{",
"return",
"get",
"(",
"targetClass",
",",
"tableName",
",",
... | And it may cause error because the "Object" is ambiguous to any type. | [
"And",
"it",
"may",
"cause",
"error",
"because",
"the",
"Object",
"is",
"ambiguous",
"to",
"any",
"type",
"."
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/HBaseExecutor.java#L802-L804 |
ltearno/hexa.tools | hexa.css-maven-plugin/src/main/java/fr/lteconsulting/hexacssmaven/CssMapper.java | CssMapper.processFile | public static void processFile( String input, String mappingPath, String outputFile, boolean doPrune, Log log ) throws IOException
{
Set<String> usedClassNames = new HashSet<>();
input = replaceClassNames( input, mappingPath, usedClassNames, log );
log.debug( usedClassNames.size() + " used css classes in the mapping file" );
log.debug( "used css classes : " + usedClassNames );
CssRewriter cssRewriter = new CssRewriter( usedClassNames, doPrune, log );
input = cssRewriter.process( input );
input += "\r\n// generated by HexaCss maven plugin, see http://www.lteconsulting.fr/hexacss";
writeFile( outputFile, input, log );
} | java | public static void processFile( String input, String mappingPath, String outputFile, boolean doPrune, Log log ) throws IOException
{
Set<String> usedClassNames = new HashSet<>();
input = replaceClassNames( input, mappingPath, usedClassNames, log );
log.debug( usedClassNames.size() + " used css classes in the mapping file" );
log.debug( "used css classes : " + usedClassNames );
CssRewriter cssRewriter = new CssRewriter( usedClassNames, doPrune, log );
input = cssRewriter.process( input );
input += "\r\n// generated by HexaCss maven plugin, see http://www.lteconsulting.fr/hexacss";
writeFile( outputFile, input, log );
} | [
"public",
"static",
"void",
"processFile",
"(",
"String",
"input",
",",
"String",
"mappingPath",
",",
"String",
"outputFile",
",",
"boolean",
"doPrune",
",",
"Log",
"log",
")",
"throws",
"IOException",
"{",
"Set",
"<",
"String",
">",
"usedClassNames",
"=",
"... | Process an input file
@throws IOException In case there is a problem
@param input
The input file content
@param mappingPath
The file containing mapping information (lines in the form of
newName=oldName)
@param outputFile
Path to the output file
@param doPrune
<code>true</code> if pruning unused CSS rules is needed
@param log
Maven logger | [
"Process",
"an",
"input",
"file"
] | train | https://github.com/ltearno/hexa.tools/blob/604c804901b1bb13fe10b3823cc4a639f8993363/hexa.css-maven-plugin/src/main/java/fr/lteconsulting/hexacssmaven/CssMapper.java#L43-L58 |
google/error-prone-javac | src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlTree.java | HtmlTree.CAPTION | public static HtmlTree CAPTION(Content body) {
HtmlTree htmltree = new HtmlTree(HtmlTag.CAPTION, nullCheck(body));
return htmltree;
} | java | public static HtmlTree CAPTION(Content body) {
HtmlTree htmltree = new HtmlTree(HtmlTag.CAPTION, nullCheck(body));
return htmltree;
} | [
"public",
"static",
"HtmlTree",
"CAPTION",
"(",
"Content",
"body",
")",
"{",
"HtmlTree",
"htmltree",
"=",
"new",
"HtmlTree",
"(",
"HtmlTag",
".",
"CAPTION",
",",
"nullCheck",
"(",
"body",
")",
")",
";",
"return",
"htmltree",
";",
"}"
] | Generates a CAPTION tag with some content.
@param body content for the tag
@return an HtmlTree object for the CAPTION tag | [
"Generates",
"a",
"CAPTION",
"tag",
"with",
"some",
"content",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlTree.java#L288-L291 |
xebia/Xebium | src/main/java/com/xebia/incubator/xebium/SeleniumDriverFixture.java | SeleniumDriverFixture.startBrowserOnUrlUsingRemoteServerOnHost | public void startBrowserOnUrlUsingRemoteServerOnHost(final String browser, final String browserUrl, final String serverHost) {
startBrowserOnUrlUsingRemoteServerOnHostOnPort(browser, browserUrl, serverHost, 4444);
} | java | public void startBrowserOnUrlUsingRemoteServerOnHost(final String browser, final String browserUrl, final String serverHost) {
startBrowserOnUrlUsingRemoteServerOnHostOnPort(browser, browserUrl, serverHost, 4444);
} | [
"public",
"void",
"startBrowserOnUrlUsingRemoteServerOnHost",
"(",
"final",
"String",
"browser",
",",
"final",
"String",
"browserUrl",
",",
"final",
"String",
"serverHost",
")",
"{",
"startBrowserOnUrlUsingRemoteServerOnHostOnPort",
"(",
"browser",
",",
"browserUrl",
",",... | <p><code>
| start browser | <i>firefox</i> | on url | <i>http://localhost</i> | using remote server on host | <i>localhost</i> |
</code></p>
@param browser
@param browserUrl
@param serverHost
@deprecated This call requires a Selenium 1 server. It is advised to use WebDriver. | [
"<p",
">",
"<code",
">",
"|",
"start",
"browser",
"|",
"<i",
">",
"firefox<",
"/",
"i",
">",
"|",
"on",
"url",
"|",
"<i",
">",
"http",
":",
"//",
"localhost<",
"/",
"i",
">",
"|",
"using",
"remote",
"server",
"on",
"host",
"|",
"<i",
">",
"loca... | train | https://github.com/xebia/Xebium/blob/594f6d9e65622acdbd03dba0700b17645981da1f/src/main/java/com/xebia/incubator/xebium/SeleniumDriverFixture.java#L210-L212 |
grpc/grpc-java | core/src/main/java/io/grpc/internal/AutoConfiguredLoadBalancerFactory.java | AutoConfiguredLoadBalancerFactory.selectLoadBalancerPolicy | @Nullable
ConfigOrError selectLoadBalancerPolicy(Map<String, ?> serviceConfig) {
try {
List<LbConfig> loadBalancerConfigs = null;
if (serviceConfig != null) {
List<Map<String, ?>> rawLbConfigs =
ServiceConfigUtil.getLoadBalancingConfigsFromServiceConfig(serviceConfig);
loadBalancerConfigs = ServiceConfigUtil.unwrapLoadBalancingConfigList(rawLbConfigs);
}
if (loadBalancerConfigs != null && !loadBalancerConfigs.isEmpty()) {
List<String> policiesTried = new ArrayList<>();
for (LbConfig lbConfig : loadBalancerConfigs) {
String policy = lbConfig.getPolicyName();
LoadBalancerProvider provider = registry.getProvider(policy);
if (provider == null) {
policiesTried.add(policy);
} else {
return ConfigOrError.fromConfig(new PolicySelection(
provider,
/* serverList= */ null,
lbConfig.getRawConfigValue()));
}
}
return ConfigOrError.fromError(
Status.UNKNOWN.withDescription(
"None of " + policiesTried + " specified by Service Config are available."));
}
return null;
} catch (RuntimeException e) {
return ConfigOrError.fromError(
Status.UNKNOWN.withDescription("can't parse load balancer configuration").withCause(e));
}
} | java | @Nullable
ConfigOrError selectLoadBalancerPolicy(Map<String, ?> serviceConfig) {
try {
List<LbConfig> loadBalancerConfigs = null;
if (serviceConfig != null) {
List<Map<String, ?>> rawLbConfigs =
ServiceConfigUtil.getLoadBalancingConfigsFromServiceConfig(serviceConfig);
loadBalancerConfigs = ServiceConfigUtil.unwrapLoadBalancingConfigList(rawLbConfigs);
}
if (loadBalancerConfigs != null && !loadBalancerConfigs.isEmpty()) {
List<String> policiesTried = new ArrayList<>();
for (LbConfig lbConfig : loadBalancerConfigs) {
String policy = lbConfig.getPolicyName();
LoadBalancerProvider provider = registry.getProvider(policy);
if (provider == null) {
policiesTried.add(policy);
} else {
return ConfigOrError.fromConfig(new PolicySelection(
provider,
/* serverList= */ null,
lbConfig.getRawConfigValue()));
}
}
return ConfigOrError.fromError(
Status.UNKNOWN.withDescription(
"None of " + policiesTried + " specified by Service Config are available."));
}
return null;
} catch (RuntimeException e) {
return ConfigOrError.fromError(
Status.UNKNOWN.withDescription("can't parse load balancer configuration").withCause(e));
}
} | [
"@",
"Nullable",
"ConfigOrError",
"selectLoadBalancerPolicy",
"(",
"Map",
"<",
"String",
",",
"?",
">",
"serviceConfig",
")",
"{",
"try",
"{",
"List",
"<",
"LbConfig",
">",
"loadBalancerConfigs",
"=",
"null",
";",
"if",
"(",
"serviceConfig",
"!=",
"null",
")... | Unlike a normal {@link LoadBalancer.Factory}, this accepts a full service config rather than
the LoadBalancingConfig.
@return null if no selection could be made. | [
"Unlike",
"a",
"normal",
"{",
"@link",
"LoadBalancer",
".",
"Factory",
"}",
"this",
"accepts",
"a",
"full",
"service",
"config",
"rather",
"than",
"the",
"LoadBalancingConfig",
"."
] | train | https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/core/src/main/java/io/grpc/internal/AutoConfiguredLoadBalancerFactory.java#L310-L342 |
lonnyj/liquibase-spatial | src/main/java/liquibase/ext/spatial/sqlgenerator/OracleSpatialUtils.java | OracleSpatialUtils.loadOracleSrid | public static String loadOracleSrid(final String srid, final Database database) {
final String oracleSrid;
final JdbcConnection jdbcConnection = (JdbcConnection) database.getConnection();
final Connection connection = jdbcConnection.getUnderlyingConnection();
Statement statement = null;
try {
statement = connection.createStatement();
final ResultSet resultSet = statement.executeQuery("SELECT " + EPSG_TO_ORACLE_FUNCTION
+ "(" + srid + ") FROM dual");
resultSet.next();
oracleSrid = resultSet.getString(1);
} catch (final SQLException e) {
throw new UnexpectedLiquibaseException("Failed to find the Oracle SRID for EPSG:" + srid,
e);
} finally {
try {
statement.close();
} catch (final SQLException ignore) {
}
}
return oracleSrid;
} | java | public static String loadOracleSrid(final String srid, final Database database) {
final String oracleSrid;
final JdbcConnection jdbcConnection = (JdbcConnection) database.getConnection();
final Connection connection = jdbcConnection.getUnderlyingConnection();
Statement statement = null;
try {
statement = connection.createStatement();
final ResultSet resultSet = statement.executeQuery("SELECT " + EPSG_TO_ORACLE_FUNCTION
+ "(" + srid + ") FROM dual");
resultSet.next();
oracleSrid = resultSet.getString(1);
} catch (final SQLException e) {
throw new UnexpectedLiquibaseException("Failed to find the Oracle SRID for EPSG:" + srid,
e);
} finally {
try {
statement.close();
} catch (final SQLException ignore) {
}
}
return oracleSrid;
} | [
"public",
"static",
"String",
"loadOracleSrid",
"(",
"final",
"String",
"srid",
",",
"final",
"Database",
"database",
")",
"{",
"final",
"String",
"oracleSrid",
";",
"final",
"JdbcConnection",
"jdbcConnection",
"=",
"(",
"JdbcConnection",
")",
"database",
".",
"... | Queries to the database to convert the given EPSG SRID to the corresponding Oracle SRID.
@param srid
the EPSG SRID.
@param database
the database instance.
@return the corresponding Oracle SRID. | [
"Queries",
"to",
"the",
"database",
"to",
"convert",
"the",
"given",
"EPSG",
"SRID",
"to",
"the",
"corresponding",
"Oracle",
"SRID",
"."
] | train | https://github.com/lonnyj/liquibase-spatial/blob/36ae41b0d3d08bb00a22c856e51ffeed08891c0e/src/main/java/liquibase/ext/spatial/sqlgenerator/OracleSpatialUtils.java#L104-L125 |
awslabs/amazon-sqs-java-messaging-lib | src/main/java/com/amazon/sqs/javamessaging/acknowledge/NegativeAcknowledger.java | NegativeAcknowledger.bulkAction | public void bulkAction(ArrayDeque<MessageManager> messageQueue, String queueUrl) throws JMSException {
List<String> receiptHandles = new ArrayList<String>();
while (!messageQueue.isEmpty()) {
receiptHandles.add(((SQSMessage) (messageQueue.pollFirst().getMessage())).getReceiptHandle());
// If there is more than 10 stop can call action
if (receiptHandles.size() == SQSMessagingClientConstants.MAX_BATCH) {
action(queueUrl, receiptHandles);
receiptHandles.clear();
}
}
action(queueUrl, receiptHandles);
} | java | public void bulkAction(ArrayDeque<MessageManager> messageQueue, String queueUrl) throws JMSException {
List<String> receiptHandles = new ArrayList<String>();
while (!messageQueue.isEmpty()) {
receiptHandles.add(((SQSMessage) (messageQueue.pollFirst().getMessage())).getReceiptHandle());
// If there is more than 10 stop can call action
if (receiptHandles.size() == SQSMessagingClientConstants.MAX_BATCH) {
action(queueUrl, receiptHandles);
receiptHandles.clear();
}
}
action(queueUrl, receiptHandles);
} | [
"public",
"void",
"bulkAction",
"(",
"ArrayDeque",
"<",
"MessageManager",
">",
"messageQueue",
",",
"String",
"queueUrl",
")",
"throws",
"JMSException",
"{",
"List",
"<",
"String",
">",
"receiptHandles",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
... | Bulk action for negative acknowledge on the list of messages of a
specific queue.
@param messageQueue
Container for the list of message managers.
@param queueUrl
The queueUrl of the messages, which they received from.
@throws JMSException
If <code>action</code> throws. | [
"Bulk",
"action",
"for",
"negative",
"acknowledge",
"on",
"the",
"list",
"of",
"messages",
"of",
"a",
"specific",
"queue",
"."
] | train | https://github.com/awslabs/amazon-sqs-java-messaging-lib/blob/efa716d34d51ef1c5572790626cdb795419cb342/src/main/java/com/amazon/sqs/javamessaging/acknowledge/NegativeAcknowledger.java#L60-L72 |
spring-projects/spring-boot | spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/MapConfigurationPropertySource.java | MapConfigurationPropertySource.put | public void put(Object name, Object value) {
this.source.put((name != null) ? name.toString() : null, value);
} | java | public void put(Object name, Object value) {
this.source.put((name != null) ? name.toString() : null, value);
} | [
"public",
"void",
"put",
"(",
"Object",
"name",
",",
"Object",
"value",
")",
"{",
"this",
".",
"source",
".",
"put",
"(",
"(",
"name",
"!=",
"null",
")",
"?",
"name",
".",
"toString",
"(",
")",
":",
"null",
",",
"value",
")",
";",
"}"
] | Add an individual entry.
@param name the name
@param value the value | [
"Add",
"an",
"individual",
"entry",
"."
] | train | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/MapConfigurationPropertySource.java#L77-L79 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/EmulatedFields.java | EmulatedFields.get | public float get(String name, float defaultValue) throws IllegalArgumentException {
ObjectSlot slot = findMandatorySlot(name, float.class);
return slot.defaulted ? defaultValue : ((Float) slot.fieldValue).floatValue();
} | java | public float get(String name, float defaultValue) throws IllegalArgumentException {
ObjectSlot slot = findMandatorySlot(name, float.class);
return slot.defaulted ? defaultValue : ((Float) slot.fieldValue).floatValue();
} | [
"public",
"float",
"get",
"(",
"String",
"name",
",",
"float",
"defaultValue",
")",
"throws",
"IllegalArgumentException",
"{",
"ObjectSlot",
"slot",
"=",
"findMandatorySlot",
"(",
"name",
",",
"float",
".",
"class",
")",
";",
"return",
"slot",
".",
"defaulted"... | Finds and returns the float value of a given field named {@code name} in
the receiver. If the field has not been assigned any value yet, the
default value {@code defaultValue} is returned instead.
@param name
the name of the field to find.
@param defaultValue
return value in case the field has not been assigned to yet.
@return the value of the given field if it has been assigned, the default
value otherwise.
@throws IllegalArgumentException
if the corresponding field can not be found. | [
"Finds",
"and",
"returns",
"the",
"float",
"value",
"of",
"a",
"given",
"field",
"named",
"{",
"@code",
"name",
"}",
"in",
"the",
"receiver",
".",
"If",
"the",
"field",
"has",
"not",
"been",
"assigned",
"any",
"value",
"yet",
"the",
"default",
"value",
... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/EmulatedFields.java#L268-L271 |
google/error-prone-javac | src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ClassDocImpl.java | ClassDocImpl.serializationMethods | public MethodDoc[] serializationMethods() {
if (serializedForm == null) {
serializedForm = new SerializedForm(env, tsym, this);
}
//### Clone this?
return serializedForm.methods();
} | java | public MethodDoc[] serializationMethods() {
if (serializedForm == null) {
serializedForm = new SerializedForm(env, tsym, this);
}
//### Clone this?
return serializedForm.methods();
} | [
"public",
"MethodDoc",
"[",
"]",
"serializationMethods",
"(",
")",
"{",
"if",
"(",
"serializedForm",
"==",
"null",
")",
"{",
"serializedForm",
"=",
"new",
"SerializedForm",
"(",
"env",
",",
"tsym",
",",
"this",
")",
";",
"}",
"//### Clone this?",
"return",
... | Return the serialization methods for this class.
@return an array of <code>MethodDocImpl</code> that represents
the serialization methods for this class. | [
"Return",
"the",
"serialization",
"methods",
"for",
"this",
"class",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ClassDocImpl.java#L1258-L1264 |
twilio/twilio-java | src/main/java/com/twilio/rest/authy/v1/service/EntityReader.java | EntityReader.previousPage | @Override
public Page<Entity> previousPage(final Page<Entity> page,
final TwilioRestClient client) {
Request request = new Request(
HttpMethod.GET,
page.getPreviousPageUrl(
Domains.AUTHY.toString(),
client.getRegion()
)
);
return pageForRequest(client, request);
} | java | @Override
public Page<Entity> previousPage(final Page<Entity> page,
final TwilioRestClient client) {
Request request = new Request(
HttpMethod.GET,
page.getPreviousPageUrl(
Domains.AUTHY.toString(),
client.getRegion()
)
);
return pageForRequest(client, request);
} | [
"@",
"Override",
"public",
"Page",
"<",
"Entity",
">",
"previousPage",
"(",
"final",
"Page",
"<",
"Entity",
">",
"page",
",",
"final",
"TwilioRestClient",
"client",
")",
"{",
"Request",
"request",
"=",
"new",
"Request",
"(",
"HttpMethod",
".",
"GET",
",",
... | Retrieve the previous page from the Twilio API.
@param page current page
@param client TwilioRestClient with which to make the request
@return Previous Page | [
"Retrieve",
"the",
"previous",
"page",
"from",
"the",
"Twilio",
"API",
"."
] | train | https://github.com/twilio/twilio-java/blob/0318974c0a6a152994af167d430255684d5e9b9f/src/main/java/com/twilio/rest/authy/v1/service/EntityReader.java#L115-L126 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/chrono/IsoChronology.java | IsoChronology.dateYearDay | @Override // override with covariant return type
public LocalDate dateYearDay(Era era, int yearOfEra, int dayOfYear) {
return dateYearDay(prolepticYear(era, yearOfEra), dayOfYear);
} | java | @Override // override with covariant return type
public LocalDate dateYearDay(Era era, int yearOfEra, int dayOfYear) {
return dateYearDay(prolepticYear(era, yearOfEra), dayOfYear);
} | [
"@",
"Override",
"// override with covariant return type",
"public",
"LocalDate",
"dateYearDay",
"(",
"Era",
"era",
",",
"int",
"yearOfEra",
",",
"int",
"dayOfYear",
")",
"{",
"return",
"dateYearDay",
"(",
"prolepticYear",
"(",
"era",
",",
"yearOfEra",
")",
",",
... | Obtains an ISO local date from the era, year-of-era and day-of-year fields.
@param era the ISO era, not null
@param yearOfEra the ISO year-of-era
@param dayOfYear the ISO day-of-year
@return the ISO local date, not null
@throws DateTimeException if unable to create the date | [
"Obtains",
"an",
"ISO",
"local",
"date",
"from",
"the",
"era",
"year",
"-",
"of",
"-",
"era",
"and",
"day",
"-",
"of",
"-",
"year",
"fields",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/chrono/IsoChronology.java#L217-L220 |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/auth/BoxAuthentication.java | BoxAuthentication.onAuthenticationFailure | public void onAuthenticationFailure(BoxAuthenticationInfo infoOriginal, Exception ex) {
String msg = "failure:";
if (getAuthStorage() != null) {
msg += "auth storage :" + getAuthStorage().toString();
}
BoxAuthenticationInfo info = BoxAuthenticationInfo.unmodifiableObject(infoOriginal);
if (info != null) {
msg += info.getUser() == null ? "null user" : info.getUser().getId() == null ? "null user id" : info.getUser().getId().length();
}
BoxLogUtils.nonFatalE("BoxAuthfail", msg , ex);
Set<AuthListener> listeners = getListeners();
for (AuthListener listener : listeners) {
listener.onAuthFailure(info, ex);
}
} | java | public void onAuthenticationFailure(BoxAuthenticationInfo infoOriginal, Exception ex) {
String msg = "failure:";
if (getAuthStorage() != null) {
msg += "auth storage :" + getAuthStorage().toString();
}
BoxAuthenticationInfo info = BoxAuthenticationInfo.unmodifiableObject(infoOriginal);
if (info != null) {
msg += info.getUser() == null ? "null user" : info.getUser().getId() == null ? "null user id" : info.getUser().getId().length();
}
BoxLogUtils.nonFatalE("BoxAuthfail", msg , ex);
Set<AuthListener> listeners = getListeners();
for (AuthListener listener : listeners) {
listener.onAuthFailure(info, ex);
}
} | [
"public",
"void",
"onAuthenticationFailure",
"(",
"BoxAuthenticationInfo",
"infoOriginal",
",",
"Exception",
"ex",
")",
"{",
"String",
"msg",
"=",
"\"failure:\"",
";",
"if",
"(",
"getAuthStorage",
"(",
")",
"!=",
"null",
")",
"{",
"msg",
"+=",
"\"auth storage :\... | Callback method to be called if authentication process fails.
@param infoOriginal the authentication information associated with the failed authentication.
@param ex the exception if appliable that caused the logout. | [
"Callback",
"method",
"to",
"be",
"called",
"if",
"authentication",
"process",
"fails",
"."
] | train | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/auth/BoxAuthentication.java#L180-L195 |
boncey/Flickr4Java | src/main/java/com/flickr4java/flickr/photos/licenses/LicensesInterface.java | LicensesInterface.setLicense | public void setLicense(String photoId, int licenseId) throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_SET_LICENSE);
parameters.put("photo_id", photoId);
parameters.put("license_id", Integer.toString(licenseId));
// Note: This method requires an HTTP POST request.
Response response = transportAPI.post(transportAPI.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
// This method has no specific response - It returns an empty sucess response if it completes without error.
} | java | public void setLicense(String photoId, int licenseId) throws FlickrException {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("method", METHOD_SET_LICENSE);
parameters.put("photo_id", photoId);
parameters.put("license_id", Integer.toString(licenseId));
// Note: This method requires an HTTP POST request.
Response response = transportAPI.post(transportAPI.getPath(), parameters, apiKey, sharedSecret);
if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
// This method has no specific response - It returns an empty sucess response if it completes without error.
} | [
"public",
"void",
"setLicense",
"(",
"String",
"photoId",
",",
"int",
"licenseId",
")",
"throws",
"FlickrException",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"parameters",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"pa... | Sets the license for a photo.
This method requires authentication with 'write' permission.
@param photoId
The photo to update the license for.
@param licenseId
The license to apply, or 0 (zero) to remove the current license.
@throws FlickrException | [
"Sets",
"the",
"license",
"for",
"a",
"photo",
"."
] | train | https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photos/licenses/LicensesInterface.java#L82-L95 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/PoolOperations.java | PoolOperations.removeNodeFromPool | public void removeNodeFromPool(String poolId, String computeNodeId) throws BatchErrorException, IOException {
removeNodeFromPool(poolId, computeNodeId, null, null, null);
} | java | public void removeNodeFromPool(String poolId, String computeNodeId) throws BatchErrorException, IOException {
removeNodeFromPool(poolId, computeNodeId, null, null, null);
} | [
"public",
"void",
"removeNodeFromPool",
"(",
"String",
"poolId",
",",
"String",
"computeNodeId",
")",
"throws",
"BatchErrorException",
",",
"IOException",
"{",
"removeNodeFromPool",
"(",
"poolId",
",",
"computeNodeId",
",",
"null",
",",
"null",
",",
"null",
")",
... | Removes the specified compute node from the specified pool.
@param poolId
The ID of the pool.
@param computeNodeId
The ID of the compute node to remove from the pool.
@throws BatchErrorException
Exception thrown when an error response is received from the
Batch service.
@throws IOException
Exception thrown when there is an error in
serialization/deserialization of data sent to/received from the
Batch service. | [
"Removes",
"the",
"specified",
"compute",
"node",
"from",
"the",
"specified",
"pool",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/PoolOperations.java#L858-L860 |
UrielCh/ovh-java-sdk | ovh-java-sdk-licensevirtuozzo/src/main/java/net/minidev/ovh/api/ApiOvhLicensevirtuozzo.java | ApiOvhLicensevirtuozzo.serviceName_canLicenseBeMovedTo_GET | public OvhChangeIpStatus serviceName_canLicenseBeMovedTo_GET(String serviceName, String destinationIp) throws IOException {
String qPath = "/license/virtuozzo/{serviceName}/canLicenseBeMovedTo";
StringBuilder sb = path(qPath, serviceName);
query(sb, "destinationIp", destinationIp);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhChangeIpStatus.class);
} | java | public OvhChangeIpStatus serviceName_canLicenseBeMovedTo_GET(String serviceName, String destinationIp) throws IOException {
String qPath = "/license/virtuozzo/{serviceName}/canLicenseBeMovedTo";
StringBuilder sb = path(qPath, serviceName);
query(sb, "destinationIp", destinationIp);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhChangeIpStatus.class);
} | [
"public",
"OvhChangeIpStatus",
"serviceName_canLicenseBeMovedTo_GET",
"(",
"String",
"serviceName",
",",
"String",
"destinationIp",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/license/virtuozzo/{serviceName}/canLicenseBeMovedTo\"",
";",
"StringBuilder",
"sb",... | Will tell if the ip can accept the license
REST: GET /license/virtuozzo/{serviceName}/canLicenseBeMovedTo
@param destinationIp [required] The Ip on which you want to move this license
@param serviceName [required] The name of your Virtuozzo license | [
"Will",
"tell",
"if",
"the",
"ip",
"can",
"accept",
"the",
"license"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-licensevirtuozzo/src/main/java/net/minidev/ovh/api/ApiOvhLicensevirtuozzo.java#L227-L233 |
eserating/siren4j | src/main/java/com/google/code/siren4j/converter/ReflectingConverter.java | ReflectingConverter.getSubEntityAnnotation | private Siren4JSubEntity getSubEntityAnnotation(Field currentField, List<ReflectedInfo> fieldInfo) {
Siren4JSubEntity result = null;
result = currentField.getAnnotation(Siren4JSubEntity.class);
if (result == null && fieldInfo != null) {
ReflectedInfo info = ReflectionUtils.getFieldInfoByName(fieldInfo, currentField.getName());
if (info != null && info.getGetter() != null) {
result = info.getGetter().getAnnotation(Siren4JSubEntity.class);
}
}
return result;
} | java | private Siren4JSubEntity getSubEntityAnnotation(Field currentField, List<ReflectedInfo> fieldInfo) {
Siren4JSubEntity result = null;
result = currentField.getAnnotation(Siren4JSubEntity.class);
if (result == null && fieldInfo != null) {
ReflectedInfo info = ReflectionUtils.getFieldInfoByName(fieldInfo, currentField.getName());
if (info != null && info.getGetter() != null) {
result = info.getGetter().getAnnotation(Siren4JSubEntity.class);
}
}
return result;
} | [
"private",
"Siren4JSubEntity",
"getSubEntityAnnotation",
"(",
"Field",
"currentField",
",",
"List",
"<",
"ReflectedInfo",
">",
"fieldInfo",
")",
"{",
"Siren4JSubEntity",
"result",
"=",
"null",
";",
"result",
"=",
"currentField",
".",
"getAnnotation",
"(",
"Siren4JSu... | Helper to retrieve a sub entity annotation from either the field itself or the getter.
If an annotation exists on both, then the field wins.
@param currentField assumed not <code>null</code>.
@param fieldInfo assumed not <code>null</code>.
@return the annotation if found else <code>null</code>. | [
"Helper",
"to",
"retrieve",
"a",
"sub",
"entity",
"annotation",
"from",
"either",
"the",
"field",
"itself",
"or",
"the",
"getter",
".",
"If",
"an",
"annotation",
"exists",
"on",
"both",
"then",
"the",
"field",
"wins",
"."
] | train | https://github.com/eserating/siren4j/blob/f12e3185076ad920352ec4f6eb2a071a3683505f/src/main/java/com/google/code/siren4j/converter/ReflectingConverter.java#L561-L571 |
tobato/FastDFS_Client | src/main/java/com/github/tobato/fastdfs/domain/proto/mapper/FdfsParamMapper.java | FdfsParamMapper.mapByIndex | private static <T> T mapByIndex(byte[] content, Class<T> genericType, ObjectMetaData objectMap, Charset charset)
throws InstantiationException, IllegalAccessException, InvocationTargetException {
List<FieldMetaData> mappingFields = objectMap.getFieldList();
T obj = genericType.newInstance();
for (int i = 0; i < mappingFields.size(); i++) {
FieldMetaData field = mappingFields.get(i);
// 设置属性值
LOGGER.debug("设置值是 " + field + field.getValue(content, charset));
BeanUtils.setProperty(obj, field.getFieldName(), field.getValue(content, charset));
}
return obj;
} | java | private static <T> T mapByIndex(byte[] content, Class<T> genericType, ObjectMetaData objectMap, Charset charset)
throws InstantiationException, IllegalAccessException, InvocationTargetException {
List<FieldMetaData> mappingFields = objectMap.getFieldList();
T obj = genericType.newInstance();
for (int i = 0; i < mappingFields.size(); i++) {
FieldMetaData field = mappingFields.get(i);
// 设置属性值
LOGGER.debug("设置值是 " + field + field.getValue(content, charset));
BeanUtils.setProperty(obj, field.getFieldName(), field.getValue(content, charset));
}
return obj;
} | [
"private",
"static",
"<",
"T",
">",
"T",
"mapByIndex",
"(",
"byte",
"[",
"]",
"content",
",",
"Class",
"<",
"T",
">",
"genericType",
",",
"ObjectMetaData",
"objectMap",
",",
"Charset",
"charset",
")",
"throws",
"InstantiationException",
",",
"IllegalAccessExce... | 按列顺序映射
@param content
@param genericType
@param objectMap
@return
@throws InstantiationException
@throws IllegalAccessException
@throws InvocationTargetException | [
"按列顺序映射"
] | train | https://github.com/tobato/FastDFS_Client/blob/8e3bfe712f1739028beed7f3a6b2cc4579a231e4/src/main/java/com/github/tobato/fastdfs/domain/proto/mapper/FdfsParamMapper.java#L90-L103 |
elki-project/elki | elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/linearalgebra/VMath.java | VMath.setCol | public static void setCol(final double[][] m1, final int c, final double[] column) {
assert column.length == m1.length : ERR_DIMENSIONS;
for(int i = 0; i < m1.length; i++) {
m1[i][c] = column[i];
}
} | java | public static void setCol(final double[][] m1, final int c, final double[] column) {
assert column.length == m1.length : ERR_DIMENSIONS;
for(int i = 0; i < m1.length; i++) {
m1[i][c] = column[i];
}
} | [
"public",
"static",
"void",
"setCol",
"(",
"final",
"double",
"[",
"]",
"[",
"]",
"m1",
",",
"final",
"int",
"c",
",",
"final",
"double",
"[",
"]",
"column",
")",
"{",
"assert",
"column",
".",
"length",
"==",
"m1",
".",
"length",
":",
"ERR_DIMENSIONS... | Sets the <code>c</code>th column of this matrix to the specified column.
@param m1 Input matrix
@param c the index of the column to be set
@param column the value of the column to be set | [
"Sets",
"the",
"<code",
">",
"c<",
"/",
"code",
">",
"th",
"column",
"of",
"this",
"matrix",
"to",
"the",
"specified",
"column",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/linearalgebra/VMath.java#L1106-L1111 |
anotheria/moskito | moskito-extensions/moskito-monitoring-plugin/src/main/java/net/anotheria/moskito/extensions/monitoring/stats/GenericStats.java | GenericStats.getStatValueAsInteger | public int getStatValueAsInteger(T metric, String interval) {
if (metric.isRateMetric()) {
return (int)(getStatValueAsDouble(metric, interval));
}
return getMonitoredStatValue(metric).getValueAsInt(interval);
} | java | public int getStatValueAsInteger(T metric, String interval) {
if (metric.isRateMetric()) {
return (int)(getStatValueAsDouble(metric, interval));
}
return getMonitoredStatValue(metric).getValueAsInt(interval);
} | [
"public",
"int",
"getStatValueAsInteger",
"(",
"T",
"metric",
",",
"String",
"interval",
")",
"{",
"if",
"(",
"metric",
".",
"isRateMetric",
"(",
")",
")",
"{",
"return",
"(",
"int",
")",
"(",
"getStatValueAsDouble",
"(",
"metric",
",",
"interval",
")",
... | Get value of provided metric for the given interval as int value.
@param metric metric which value we wanna get
@param interval the name of the Interval or <code>null</code> to get the absolute value
@return the current value | [
"Get",
"value",
"of",
"provided",
"metric",
"for",
"the",
"given",
"interval",
"as",
"int",
"value",
"."
] | train | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-extensions/moskito-monitoring-plugin/src/main/java/net/anotheria/moskito/extensions/monitoring/stats/GenericStats.java#L178-L183 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/field/DateField.java | DateField.getSQLFromField | public void getSQLFromField(PreparedStatement statement, int iType, int iParamColumn) throws SQLException
{
if (this.isNull())
{
if ((!this.isNullable())
|| (iType == DBConstants.SQL_SELECT_TYPE)
|| (DBConstants.FALSE.equals(this.getRecord().getTable().getDatabase().getProperties().get(SQLParams.NULL_TIMESTAMP_SUPPORTED)))) // HACK for Access
{ // Access does not allow you to pass a null for a timestamp (must pass a 0)
java.sql.Timestamp sqlDate = new java.sql.Timestamp(0);
statement.setTimestamp(iParamColumn, sqlDate);
}
else
statement.setNull(iParamColumn, Types.DATE);
}
else
{
java.sql.Date sqlDate = new java.sql.Date((long)this.getValue());
statement.setDate(iParamColumn, sqlDate);
}
} | java | public void getSQLFromField(PreparedStatement statement, int iType, int iParamColumn) throws SQLException
{
if (this.isNull())
{
if ((!this.isNullable())
|| (iType == DBConstants.SQL_SELECT_TYPE)
|| (DBConstants.FALSE.equals(this.getRecord().getTable().getDatabase().getProperties().get(SQLParams.NULL_TIMESTAMP_SUPPORTED)))) // HACK for Access
{ // Access does not allow you to pass a null for a timestamp (must pass a 0)
java.sql.Timestamp sqlDate = new java.sql.Timestamp(0);
statement.setTimestamp(iParamColumn, sqlDate);
}
else
statement.setNull(iParamColumn, Types.DATE);
}
else
{
java.sql.Date sqlDate = new java.sql.Date((long)this.getValue());
statement.setDate(iParamColumn, sqlDate);
}
} | [
"public",
"void",
"getSQLFromField",
"(",
"PreparedStatement",
"statement",
",",
"int",
"iType",
",",
"int",
"iParamColumn",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"this",
".",
"isNull",
"(",
")",
")",
"{",
"if",
"(",
"(",
"!",
"this",
".",
"isNu... | Move the physical binary data to this SQL parameter row.
@param statement The SQL prepare statement.
@param iType the type of SQL statement.
@param iParamColumn The column in the prepared statement to set the data.
@exception SQLException From SQL calls. | [
"Move",
"the",
"physical",
"binary",
"data",
"to",
"this",
"SQL",
"parameter",
"row",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/DateField.java#L188-L207 |
Axway/Grapes | server/src/main/java/org/axway/grapes/server/webapp/resources/OrganizationResource.java | OrganizationResource.getNames | @GET
@Produces({MediaType.TEXT_HTML, MediaType.APPLICATION_JSON})
@Path(ServerAPI.GET_NAMES)
public Response getNames(){
LOG.info("Got a get organization names request.");
final ListView view = new ListView("Organization Ids list", "Organizations");
final List<String> names = getOrganizationHandler().getOrganizationNames();
view.addAll(names);
return Response.ok(view).build();
} | java | @GET
@Produces({MediaType.TEXT_HTML, MediaType.APPLICATION_JSON})
@Path(ServerAPI.GET_NAMES)
public Response getNames(){
LOG.info("Got a get organization names request.");
final ListView view = new ListView("Organization Ids list", "Organizations");
final List<String> names = getOrganizationHandler().getOrganizationNames();
view.addAll(names);
return Response.ok(view).build();
} | [
"@",
"GET",
"@",
"Produces",
"(",
"{",
"MediaType",
".",
"TEXT_HTML",
",",
"MediaType",
".",
"APPLICATION_JSON",
"}",
")",
"@",
"Path",
"(",
"ServerAPI",
".",
"GET_NAMES",
")",
"public",
"Response",
"getNames",
"(",
")",
"{",
"LOG",
".",
"info",
"(",
"... | Return the list of available organization name.
This method is call via GET <dm_url>/organization/names
@return Response A list of organization name in HTML or JSON | [
"Return",
"the",
"list",
"of",
"available",
"organization",
"name",
".",
"This",
"method",
"is",
"call",
"via",
"GET",
"<dm_url",
">",
"/",
"organization",
"/",
"names"
] | train | https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/server/src/main/java/org/axway/grapes/server/webapp/resources/OrganizationResource.java#L69-L80 |
j-easy/easy-random | easy-random-core/src/main/java/org/jeasy/random/EasyRandomParameters.java | EasyRandomParameters.timeRange | public EasyRandomParameters timeRange(final LocalTime min, final LocalTime max) {
if (min.isAfter(max)) {
throw new IllegalArgumentException("Min time should be before max time");
}
setTimeRange(new Range<>(min, max));
return this;
} | java | public EasyRandomParameters timeRange(final LocalTime min, final LocalTime max) {
if (min.isAfter(max)) {
throw new IllegalArgumentException("Min time should be before max time");
}
setTimeRange(new Range<>(min, max));
return this;
} | [
"public",
"EasyRandomParameters",
"timeRange",
"(",
"final",
"LocalTime",
"min",
",",
"final",
"LocalTime",
"max",
")",
"{",
"if",
"(",
"min",
".",
"isAfter",
"(",
"max",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Min time should be befor... | Set the time range.
@param min time
@param max time
@return the current {@link EasyRandomParameters} instance for method chaining | [
"Set",
"the",
"time",
"range",
"."
] | train | https://github.com/j-easy/easy-random/blob/816b0d6a74c7288af111e70ae1b0b57d7fe3b59d/easy-random-core/src/main/java/org/jeasy/random/EasyRandomParameters.java#L470-L476 |
netty/netty | codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java | HttpHeaders.setDate | @Deprecated
public static void setDate(HttpMessage message, Date value) {
message.headers().set(HttpHeaderNames.DATE, value);
} | java | @Deprecated
public static void setDate(HttpMessage message, Date value) {
message.headers().set(HttpHeaderNames.DATE, value);
} | [
"@",
"Deprecated",
"public",
"static",
"void",
"setDate",
"(",
"HttpMessage",
"message",
",",
"Date",
"value",
")",
"{",
"message",
".",
"headers",
"(",
")",
".",
"set",
"(",
"HttpHeaderNames",
".",
"DATE",
",",
"value",
")",
";",
"}"
] | @deprecated Use {@link #set(CharSequence, Object)} instead.
Sets the {@code "Date"} header. | [
"@deprecated",
"Use",
"{",
"@link",
"#set",
"(",
"CharSequence",
"Object",
")",
"}",
"instead",
"."
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java#L1069-L1072 |
ineunetOS/knife-commons | knife-commons-utils/src/main/java/com/ineunet/knife/util/StringUtils.java | StringUtils.abbreviateMiddle | public static String abbreviateMiddle(String str, String middle, int length) {
if (isEmpty(str) || isEmpty(middle)) {
return str;
}
if (length >= str.length() || length < (middle.length()+2)) {
return str;
}
int targetSting = length-middle.length();
int startOffset = targetSting/2+targetSting%2;
int endOffset = str.length()-targetSting/2;
StringBuilder builder = new StringBuilder(length);
builder.append(str.substring(0,startOffset));
builder.append(middle);
builder.append(str.substring(endOffset));
return builder.toString();
} | java | public static String abbreviateMiddle(String str, String middle, int length) {
if (isEmpty(str) || isEmpty(middle)) {
return str;
}
if (length >= str.length() || length < (middle.length()+2)) {
return str;
}
int targetSting = length-middle.length();
int startOffset = targetSting/2+targetSting%2;
int endOffset = str.length()-targetSting/2;
StringBuilder builder = new StringBuilder(length);
builder.append(str.substring(0,startOffset));
builder.append(middle);
builder.append(str.substring(endOffset));
return builder.toString();
} | [
"public",
"static",
"String",
"abbreviateMiddle",
"(",
"String",
"str",
",",
"String",
"middle",
",",
"int",
"length",
")",
"{",
"if",
"(",
"isEmpty",
"(",
"str",
")",
"||",
"isEmpty",
"(",
"middle",
")",
")",
"{",
"return",
"str",
";",
"}",
"if",
"(... | <p>Abbreviates a String to the length passed, replacing the middle characters with the supplied
replacement String.</p>
<p>This abbreviation only occurs if the following criteria is met:
<ul>
<li>Neither the String for abbreviation nor the replacement String are null or empty </li>
<li>The length to truncate to is less than the length of the supplied String</li>
<li>The length to truncate to is greater than 0</li>
<li>The abbreviated String will have enough room for the length supplied replacement String
and the first and last characters of the supplied String for abbreviation</li>
</ul>
Otherwise, the returned String will be the same as the supplied String for abbreviation.
</p>
<pre>
StringUtils.abbreviateMiddle(null, null, 0) = null
StringUtils.abbreviateMiddle("abc", null, 0) = "abc"
StringUtils.abbreviateMiddle("abc", ".", 0) = "abc"
StringUtils.abbreviateMiddle("abc", ".", 3) = "abc"
StringUtils.abbreviateMiddle("abcdef", ".", 4) = "ab.f"
</pre>
@param str the String to abbreviate, may be null
@param middle the String to replace the middle characters with, may be null
@param length the length to abbreviate <code>str</code> to.
@return the abbreviated String if the above criteria is met, or the original String supplied for abbreviation.
@since 2.5 | [
"<p",
">",
"Abbreviates",
"a",
"String",
"to",
"the",
"length",
"passed",
"replacing",
"the",
"middle",
"characters",
"with",
"the",
"supplied",
"replacement",
"String",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/ineunetOS/knife-commons/blob/eae9e59afa020a00ae8977c10d43ac8ae46ae236/knife-commons-utils/src/main/java/com/ineunet/knife/util/StringUtils.java#L5833-L5852 |
alkacon/opencms-core | src-gwt/org/opencms/gwt/client/ui/input/form/CmsForm.java | CmsForm.addField | public void addField(String fieldGroup, I_CmsFormField formField, String initialValue) {
if (initialValue != null) {
formField.getWidget().setFormValueAsString(initialValue);
}
addField(fieldGroup, formField);
} | java | public void addField(String fieldGroup, I_CmsFormField formField, String initialValue) {
if (initialValue != null) {
formField.getWidget().setFormValueAsString(initialValue);
}
addField(fieldGroup, formField);
} | [
"public",
"void",
"addField",
"(",
"String",
"fieldGroup",
",",
"I_CmsFormField",
"formField",
",",
"String",
"initialValue",
")",
"{",
"if",
"(",
"initialValue",
"!=",
"null",
")",
"{",
"formField",
".",
"getWidget",
"(",
")",
".",
"setFormValueAsString",
"("... | Adds a form field to the form and sets its initial value.<p>
@param fieldGroup the form field group key
@param formField the form field which should be added
@param initialValue the initial value of the form field, or null if the field shouldn't have an initial value | [
"Adds",
"a",
"form",
"field",
"to",
"the",
"form",
"and",
"sets",
"its",
"initial",
"value",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/input/form/CmsForm.java#L158-L164 |
Azure/azure-sdk-for-java | authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/RoleAssignmentsInner.java | RoleAssignmentsInner.deleteAsync | public Observable<RoleAssignmentInner> deleteAsync(String scope, String roleAssignmentName) {
return deleteWithServiceResponseAsync(scope, roleAssignmentName).map(new Func1<ServiceResponse<RoleAssignmentInner>, RoleAssignmentInner>() {
@Override
public RoleAssignmentInner call(ServiceResponse<RoleAssignmentInner> response) {
return response.body();
}
});
} | java | public Observable<RoleAssignmentInner> deleteAsync(String scope, String roleAssignmentName) {
return deleteWithServiceResponseAsync(scope, roleAssignmentName).map(new Func1<ServiceResponse<RoleAssignmentInner>, RoleAssignmentInner>() {
@Override
public RoleAssignmentInner call(ServiceResponse<RoleAssignmentInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"RoleAssignmentInner",
">",
"deleteAsync",
"(",
"String",
"scope",
",",
"String",
"roleAssignmentName",
")",
"{",
"return",
"deleteWithServiceResponseAsync",
"(",
"scope",
",",
"roleAssignmentName",
")",
".",
"map",
"(",
"new",
"Func1",
... | Deletes a role assignment.
@param scope The scope of the role assignment to delete.
@param roleAssignmentName The name of the role assignment to delete.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the RoleAssignmentInner object | [
"Deletes",
"a",
"role",
"assignment",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/authorization/resource-manager/v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/RoleAssignmentsInner.java#L683-L690 |
Jasig/uPortal | uPortal-groups/uPortal-groups-core/src/main/java/org/apereo/portal/groups/ReferenceCompositeGroupService.java | ReferenceCompositeGroupService.getGroupMember | @Override
public IGroupMember getGroupMember(String key, Class type) throws GroupsException {
IGroupMember gm = null;
if (type == ICompositeGroupService.GROUP_ENTITY_TYPE) gm = findGroup(key);
else gm = getEntity(key, type);
return gm;
} | java | @Override
public IGroupMember getGroupMember(String key, Class type) throws GroupsException {
IGroupMember gm = null;
if (type == ICompositeGroupService.GROUP_ENTITY_TYPE) gm = findGroup(key);
else gm = getEntity(key, type);
return gm;
} | [
"@",
"Override",
"public",
"IGroupMember",
"getGroupMember",
"(",
"String",
"key",
",",
"Class",
"type",
")",
"throws",
"GroupsException",
"{",
"IGroupMember",
"gm",
"=",
"null",
";",
"if",
"(",
"type",
"==",
"ICompositeGroupService",
".",
"GROUP_ENTITY_TYPE",
"... | Returns an <code>IGroupMember</code> representing either a group or a portal entity. If the
parm <code>type</code> is the group type, the <code>IGroupMember</code> is an <code>
IEntityGroup</code> else it is an <code>IEntity</code>. | [
"Returns",
"an",
"<code",
">",
"IGroupMember<",
"/",
"code",
">",
"representing",
"either",
"a",
"group",
"or",
"a",
"portal",
"entity",
".",
"If",
"the",
"parm",
"<code",
">",
"type<",
"/",
"code",
">",
"is",
"the",
"group",
"type",
"the",
"<code",
">... | train | https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-groups/uPortal-groups-core/src/main/java/org/apereo/portal/groups/ReferenceCompositeGroupService.java#L135-L141 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/query/impl/QueryContext.java | QueryContext.matchIndex | public Index matchIndex(String pattern, IndexMatchHint matchHint) {
return indexes.matchIndex(pattern, matchHint);
} | java | public Index matchIndex(String pattern, IndexMatchHint matchHint) {
return indexes.matchIndex(pattern, matchHint);
} | [
"public",
"Index",
"matchIndex",
"(",
"String",
"pattern",
",",
"IndexMatchHint",
"matchHint",
")",
"{",
"return",
"indexes",
".",
"matchIndex",
"(",
"pattern",
",",
"matchHint",
")",
";",
"}"
] | Matches an index for the given pattern and match hint.
@param pattern the pattern to match an index for. May be either an
attribute name or an exact index name.
@param matchHint the match hint.
@return the matched index or {@code null} if nothing matched.
@see QueryContext.IndexMatchHint | [
"Matches",
"an",
"index",
"for",
"the",
"given",
"pattern",
"and",
"match",
"hint",
"."
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/query/impl/QueryContext.java#L78-L80 |
dihedron/dihedron-commons | src/main/java/org/dihedron/patterns/activities/base/CompoundActivity.java | CompoundActivity.perform | @Override
public ActivityData perform(ActivityContext context, ActivityData data) throws ActivityException {
TypedVector<ActivityInfo> infos = new TypedVector<ActivityInfo>();
int i = 0;
for(Activity activity : activities) {
logger.trace("adding activity number {} with id '{}'...", i, activity.getId());
ActivityInfo info = new ActivityInfo();
info
.setActivity(activity)
.setContext(context)
//.setData(i == 0 ? data : null);
.setData(data);
infos.add(info);
logger.trace("... activity {} added!", i);
++i;
}
logger.trace("launching activity execution...");
return engine.execute(infos);
} | java | @Override
public ActivityData perform(ActivityContext context, ActivityData data) throws ActivityException {
TypedVector<ActivityInfo> infos = new TypedVector<ActivityInfo>();
int i = 0;
for(Activity activity : activities) {
logger.trace("adding activity number {} with id '{}'...", i, activity.getId());
ActivityInfo info = new ActivityInfo();
info
.setActivity(activity)
.setContext(context)
//.setData(i == 0 ? data : null);
.setData(data);
infos.add(info);
logger.trace("... activity {} added!", i);
++i;
}
logger.trace("launching activity execution...");
return engine.execute(infos);
} | [
"@",
"Override",
"public",
"ActivityData",
"perform",
"(",
"ActivityContext",
"context",
",",
"ActivityData",
"data",
")",
"throws",
"ActivityException",
"{",
"TypedVector",
"<",
"ActivityInfo",
">",
"infos",
"=",
"new",
"TypedVector",
"<",
"ActivityInfo",
">",
"(... | Runs a set of sub-activities in a sequence (one at a time), with no parallelism.
As soon as one of the activities throws an exception the whole processing
is aborted and the exception is propagated to its wrapping activities.
@see org.dihedron.tasks.Task#execute(org.dihedron.tasks.ExecutionContext) | [
"Runs",
"a",
"set",
"of",
"sub",
"-",
"activities",
"in",
"a",
"sequence",
"(",
"one",
"at",
"a",
"time",
")",
"with",
"no",
"parallelism",
".",
"As",
"soon",
"as",
"one",
"of",
"the",
"activities",
"throws",
"an",
"exception",
"the",
"whole",
"process... | train | https://github.com/dihedron/dihedron-commons/blob/a5194cdaa0d6417ef4aade6ea407a1cad6e8458e/src/main/java/org/dihedron/patterns/activities/base/CompoundActivity.java#L64-L83 |
Azure/azure-sdk-for-java | eventgrid/resource-manager/v2018_09_15_preview/src/main/java/com/microsoft/azure/management/eventgrid/v2018_09_15_preview/implementation/DomainsInner.java | DomainsInner.regenerateKeyAsync | public Observable<DomainSharedAccessKeysInner> regenerateKeyAsync(String resourceGroupName, String domainName, String keyName) {
return regenerateKeyWithServiceResponseAsync(resourceGroupName, domainName, keyName).map(new Func1<ServiceResponse<DomainSharedAccessKeysInner>, DomainSharedAccessKeysInner>() {
@Override
public DomainSharedAccessKeysInner call(ServiceResponse<DomainSharedAccessKeysInner> response) {
return response.body();
}
});
} | java | public Observable<DomainSharedAccessKeysInner> regenerateKeyAsync(String resourceGroupName, String domainName, String keyName) {
return regenerateKeyWithServiceResponseAsync(resourceGroupName, domainName, keyName).map(new Func1<ServiceResponse<DomainSharedAccessKeysInner>, DomainSharedAccessKeysInner>() {
@Override
public DomainSharedAccessKeysInner call(ServiceResponse<DomainSharedAccessKeysInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"DomainSharedAccessKeysInner",
">",
"regenerateKeyAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"domainName",
",",
"String",
"keyName",
")",
"{",
"return",
"regenerateKeyWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"d... | Regenerate key for a domain.
Regenerate a shared access key for a domain.
@param resourceGroupName The name of the resource group within the user's subscription.
@param domainName Name of the domain
@param keyName Key name to regenerate key1 or key2
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the DomainSharedAccessKeysInner object | [
"Regenerate",
"key",
"for",
"a",
"domain",
".",
"Regenerate",
"a",
"shared",
"access",
"key",
"for",
"a",
"domain",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/eventgrid/resource-manager/v2018_09_15_preview/src/main/java/com/microsoft/azure/management/eventgrid/v2018_09_15_preview/implementation/DomainsInner.java#L1192-L1199 |
Samsung/GearVRf | GVRf/Extensions/gvrf-physics/src/main/java/org/gearvrf/physics/GVRRigidBody.java | GVRRigidBody.applyCentralImpulse | public void applyCentralImpulse(final float x, final float y, final float z) {
mPhysicsContext.runOnPhysicsThread(new Runnable() {
@Override
public void run() {
Native3DRigidBody.applyCentralImpulse(getNative(), x, y, z);
}
});
} | java | public void applyCentralImpulse(final float x, final float y, final float z) {
mPhysicsContext.runOnPhysicsThread(new Runnable() {
@Override
public void run() {
Native3DRigidBody.applyCentralImpulse(getNative(), x, y, z);
}
});
} | [
"public",
"void",
"applyCentralImpulse",
"(",
"final",
"float",
"x",
",",
"final",
"float",
"y",
",",
"final",
"float",
"z",
")",
"{",
"mPhysicsContext",
".",
"runOnPhysicsThread",
"(",
"new",
"Runnable",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"... | Apply a central vector vector [X, Y, Z] to this {@linkplain GVRRigidBody rigid body}
@param x impulse factor on the 'X' axis.
@param y impulse factor on the 'Y' axis.
@param z impulse factor on the 'Z' axis. | [
"Apply",
"a",
"central",
"vector",
"vector",
"[",
"X",
"Y",
"Z",
"]",
"to",
"this",
"{",
"@linkplain",
"GVRRigidBody",
"rigid",
"body",
"}"
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/gvrf-physics/src/main/java/org/gearvrf/physics/GVRRigidBody.java#L217-L224 |
apache/flink | flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java | Configuration.getLong | public long getLong(String name, long defaultValue) {
String valueString = getTrimmed(name);
if (valueString == null)
return defaultValue;
String hexString = getHexDigits(valueString);
if (hexString != null) {
return Long.parseLong(hexString, 16);
}
return Long.parseLong(valueString);
} | java | public long getLong(String name, long defaultValue) {
String valueString = getTrimmed(name);
if (valueString == null)
return defaultValue;
String hexString = getHexDigits(valueString);
if (hexString != null) {
return Long.parseLong(hexString, 16);
}
return Long.parseLong(valueString);
} | [
"public",
"long",
"getLong",
"(",
"String",
"name",
",",
"long",
"defaultValue",
")",
"{",
"String",
"valueString",
"=",
"getTrimmed",
"(",
"name",
")",
";",
"if",
"(",
"valueString",
"==",
"null",
")",
"return",
"defaultValue",
";",
"String",
"hexString",
... | Get the value of the <code>name</code> property as a <code>long</code>.
If no such property exists, the provided default value is returned,
or if the specified value is not a valid <code>long</code>,
then an error is thrown.
@param name property name.
@param defaultValue default value.
@throws NumberFormatException when the value is invalid
@return property value as a <code>long</code>,
or <code>defaultValue</code>. | [
"Get",
"the",
"value",
"of",
"the",
"<code",
">",
"name<",
"/",
"code",
">",
"property",
"as",
"a",
"<code",
">",
"long<",
"/",
"code",
">",
".",
"If",
"no",
"such",
"property",
"exists",
"the",
"provided",
"default",
"value",
"is",
"returned",
"or",
... | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java#L1406-L1415 |
FXMisc/Flowless | src/main/java/org/fxmisc/flowless/CellPositioner.java | CellPositioner.placeStartAt | public C placeStartAt(int itemIndex, double startOffStart) {
C cell = getSizedCell(itemIndex);
relocate(cell, 0, startOffStart);
cell.getNode().setVisible(true);
return cell;
} | java | public C placeStartAt(int itemIndex, double startOffStart) {
C cell = getSizedCell(itemIndex);
relocate(cell, 0, startOffStart);
cell.getNode().setVisible(true);
return cell;
} | [
"public",
"C",
"placeStartAt",
"(",
"int",
"itemIndex",
",",
"double",
"startOffStart",
")",
"{",
"C",
"cell",
"=",
"getSizedCell",
"(",
"itemIndex",
")",
";",
"relocate",
"(",
"cell",
",",
"0",
",",
"startOffStart",
")",
";",
"cell",
".",
"getNode",
"("... | Properly resizes the cell's node, and sets its "layoutY" value, so that is the first visible
node in the viewport, and further offsets this value by {@code startOffStart}, so that
the node's <em>top</em> edge appears (if negative) "above," (if 0) "at," or (if negative) "below" the viewport's
"top" edge. See {@link OrientationHelper}'s javadoc for more explanation on what quoted terms mean.
<pre><code>
--------- top of cell's node if startOffStart is negative
__________ "top edge" of viewport / top of cell's node if startOffStart = 0
|
|
|--------- top of cell's node if startOffStart is positive
|
</code></pre>
@param itemIndex the index of the item in the list of all (not currently visible) cells
@param startOffStart the amount by which to offset the "layoutY" value of the cell's node | [
"Properly",
"resizes",
"the",
"cell",
"s",
"node",
"and",
"sets",
"its",
"layoutY",
"value",
"so",
"that",
"is",
"the",
"first",
"visible",
"node",
"in",
"the",
"viewport",
"and",
"further",
"offsets",
"this",
"value",
"by",
"{",
"@code",
"startOffStart",
... | train | https://github.com/FXMisc/Flowless/blob/dce2269ebafed8f79203d00085af41f06f3083bc/src/main/java/org/fxmisc/flowless/CellPositioner.java#L126-L131 |
mgormley/pacaya | src/main/java/edu/jhu/pacaya/gm/eval/MseMarginalEvaluator.java | MseMarginalEvaluator.evaluate | public double evaluate(VarConfig goldConfig, FgInferencer inf) {
Algebra s = RealAlgebra.getInstance();
double sum = s.zero();
for (Var v : goldConfig.getVars()) {
if (v.getType() == VarType.PREDICTED) {
VarTensor marg = inf.getMarginals(v);
int goldState = goldConfig.getState(v);
for (int c=0; c<marg.size(); c++) {
double goldMarg = (c == goldState) ? s.one() : s.zero();
double predMarg = marg.getValue(c);
double diff = s.minus(Math.max(goldMarg, predMarg), Math.min(goldMarg, predMarg));
sum = s.plus(sum, s.times(diff, diff));
}
}
}
return s.toReal(sum);
} | java | public double evaluate(VarConfig goldConfig, FgInferencer inf) {
Algebra s = RealAlgebra.getInstance();
double sum = s.zero();
for (Var v : goldConfig.getVars()) {
if (v.getType() == VarType.PREDICTED) {
VarTensor marg = inf.getMarginals(v);
int goldState = goldConfig.getState(v);
for (int c=0; c<marg.size(); c++) {
double goldMarg = (c == goldState) ? s.one() : s.zero();
double predMarg = marg.getValue(c);
double diff = s.minus(Math.max(goldMarg, predMarg), Math.min(goldMarg, predMarg));
sum = s.plus(sum, s.times(diff, diff));
}
}
}
return s.toReal(sum);
} | [
"public",
"double",
"evaluate",
"(",
"VarConfig",
"goldConfig",
",",
"FgInferencer",
"inf",
")",
"{",
"Algebra",
"s",
"=",
"RealAlgebra",
".",
"getInstance",
"(",
")",
";",
"double",
"sum",
"=",
"s",
".",
"zero",
"(",
")",
";",
"for",
"(",
"Var",
"v",
... | Computes the mean squared error between the true marginals (as
represented by the goldConfig) and the predicted marginals (as
represented by an inferencer).
@param goldConfig The gold configuration of the variables.
@param inf The (already run) inferencer storing the predicted marginals.
@return The UNORMALIZED mean squared error. | [
"Computes",
"the",
"mean",
"squared",
"error",
"between",
"the",
"true",
"marginals",
"(",
"as",
"represented",
"by",
"the",
"goldConfig",
")",
"and",
"the",
"predicted",
"marginals",
"(",
"as",
"represented",
"by",
"an",
"inferencer",
")",
"."
] | train | https://github.com/mgormley/pacaya/blob/786294cbac7cc65dbc32210c10acc32ed0c69233/src/main/java/edu/jhu/pacaya/gm/eval/MseMarginalEvaluator.java#L22-L39 |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/geo/structure/ProjectiveStructureByFactorization.java | ProjectiveStructureByFactorization.setPixels | public void setPixels(int view , List<Point2D_F64> pixelsInView ) {
if( pixelsInView.size() != pixels.numCols )
throw new IllegalArgumentException("Pixel count must be constant and match "+pixels.numCols);
int row = view*2;
for (int i = 0; i < pixelsInView.size(); i++) {
Point2D_F64 p = pixelsInView.get(i);
pixels.set(row,i,p.x);
pixels.set(row+1,i,p.y);
pixelScale = Math.max(Math.abs(p.x),Math.abs(p.y));
}
} | java | public void setPixels(int view , List<Point2D_F64> pixelsInView ) {
if( pixelsInView.size() != pixels.numCols )
throw new IllegalArgumentException("Pixel count must be constant and match "+pixels.numCols);
int row = view*2;
for (int i = 0; i < pixelsInView.size(); i++) {
Point2D_F64 p = pixelsInView.get(i);
pixels.set(row,i,p.x);
pixels.set(row+1,i,p.y);
pixelScale = Math.max(Math.abs(p.x),Math.abs(p.y));
}
} | [
"public",
"void",
"setPixels",
"(",
"int",
"view",
",",
"List",
"<",
"Point2D_F64",
">",
"pixelsInView",
")",
"{",
"if",
"(",
"pixelsInView",
".",
"size",
"(",
")",
"!=",
"pixels",
".",
"numCols",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Pi... | Sets pixel observations for a paricular view
@param view the view
@param pixelsInView list of 2D pixel observations | [
"Sets",
"pixel",
"observations",
"for",
"a",
"paricular",
"view"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/structure/ProjectiveStructureByFactorization.java#L109-L120 |
UrielCh/ovh-java-sdk | ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java | ApiOvhIpLoadbalancing.serviceName_tcp_route_routeId_rule_ruleId_GET | public OvhRouteRule serviceName_tcp_route_routeId_rule_ruleId_GET(String serviceName, Long routeId, Long ruleId) throws IOException {
String qPath = "/ipLoadbalancing/{serviceName}/tcp/route/{routeId}/rule/{ruleId}";
StringBuilder sb = path(qPath, serviceName, routeId, ruleId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhRouteRule.class);
} | java | public OvhRouteRule serviceName_tcp_route_routeId_rule_ruleId_GET(String serviceName, Long routeId, Long ruleId) throws IOException {
String qPath = "/ipLoadbalancing/{serviceName}/tcp/route/{routeId}/rule/{ruleId}";
StringBuilder sb = path(qPath, serviceName, routeId, ruleId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhRouteRule.class);
} | [
"public",
"OvhRouteRule",
"serviceName_tcp_route_routeId_rule_ruleId_GET",
"(",
"String",
"serviceName",
",",
"Long",
"routeId",
",",
"Long",
"ruleId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/ipLoadbalancing/{serviceName}/tcp/route/{routeId}/rule/{ruleId}... | Get this object properties
REST: GET /ipLoadbalancing/{serviceName}/tcp/route/{routeId}/rule/{ruleId}
@param serviceName [required] The internal name of your IP load balancing
@param routeId [required] Id of your route
@param ruleId [required] Id of your rule | [
"Get",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java#L1389-L1394 |
b3dgs/lionengine | lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/TileSheetsConfig.java | TileSheetsConfig.exportSheets | private static void exportSheets(Xml nodeSheets, Collection<String> sheets)
{
for (final String sheet : sheets)
{
final Xml nodeSheet = nodeSheets.createChild(NODE_TILE_SHEET);
nodeSheet.setText(sheet);
}
} | java | private static void exportSheets(Xml nodeSheets, Collection<String> sheets)
{
for (final String sheet : sheets)
{
final Xml nodeSheet = nodeSheets.createChild(NODE_TILE_SHEET);
nodeSheet.setText(sheet);
}
} | [
"private",
"static",
"void",
"exportSheets",
"(",
"Xml",
"nodeSheets",
",",
"Collection",
"<",
"String",
">",
"sheets",
")",
"{",
"for",
"(",
"final",
"String",
"sheet",
":",
"sheets",
")",
"{",
"final",
"Xml",
"nodeSheet",
"=",
"nodeSheets",
".",
"createC... | Export the defined sheets.
@param nodeSheets Sheets node (must not be <code>null</code>).
@param sheets Sheets defined (must not be <code>null</code>). | [
"Export",
"the",
"defined",
"sheets",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/TileSheetsConfig.java#L123-L130 |
powermock/powermock | powermock-core/src/main/java/org/powermock/core/ClassReplicaCreator.java | ClassReplicaCreator.getReplicaMethodDelegationCode | private String getReplicaMethodDelegationCode(Class<?> clazz, CtMethod ctMethod, String classOrInstanceToDelegateTo)
throws NotFoundException {
StringBuilder builder = new StringBuilder();
builder.append("{java.lang.reflect.Method originalMethod = ");
builder.append(clazz.getName());
builder.append(".class.getDeclaredMethod(\"");
builder.append(ctMethod.getName());
builder.append("\", ");
final String parametersAsString = getParametersAsString(getParameterTypes(ctMethod));
if ("".equals(parametersAsString)) {
builder.append("null");
} else {
builder.append(parametersAsString);
}
builder.append(");\n");
builder.append("originalMethod.setAccessible(true);\n");
final CtClass returnType = ctMethod.getReturnType();
final boolean isVoid = returnType.equals(CtClass.voidType);
if (!isVoid) {
builder.append("return (");
builder.append(returnType.getName());
builder.append(") ");
}
builder.append("originalMethod.invoke(");
if (Modifier.isStatic(ctMethod.getModifiers()) || classOrInstanceToDelegateTo == null) {
builder.append(clazz.getName());
builder.append(".class");
} else {
builder.append(classOrInstanceToDelegateTo);
}
builder.append(", $args);}");
return builder.toString();
} | java | private String getReplicaMethodDelegationCode(Class<?> clazz, CtMethod ctMethod, String classOrInstanceToDelegateTo)
throws NotFoundException {
StringBuilder builder = new StringBuilder();
builder.append("{java.lang.reflect.Method originalMethod = ");
builder.append(clazz.getName());
builder.append(".class.getDeclaredMethod(\"");
builder.append(ctMethod.getName());
builder.append("\", ");
final String parametersAsString = getParametersAsString(getParameterTypes(ctMethod));
if ("".equals(parametersAsString)) {
builder.append("null");
} else {
builder.append(parametersAsString);
}
builder.append(");\n");
builder.append("originalMethod.setAccessible(true);\n");
final CtClass returnType = ctMethod.getReturnType();
final boolean isVoid = returnType.equals(CtClass.voidType);
if (!isVoid) {
builder.append("return (");
builder.append(returnType.getName());
builder.append(") ");
}
builder.append("originalMethod.invoke(");
if (Modifier.isStatic(ctMethod.getModifiers()) || classOrInstanceToDelegateTo == null) {
builder.append(clazz.getName());
builder.append(".class");
} else {
builder.append(classOrInstanceToDelegateTo);
}
builder.append(", $args);}");
return builder.toString();
} | [
"private",
"String",
"getReplicaMethodDelegationCode",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"CtMethod",
"ctMethod",
",",
"String",
"classOrInstanceToDelegateTo",
")",
"throws",
"NotFoundException",
"{",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(... | /*
Invokes a instance method of the original instance. This enables partial
mocking of system classes. | [
"/",
"*",
"Invokes",
"a",
"instance",
"method",
"of",
"the",
"original",
"instance",
".",
"This",
"enables",
"partial",
"mocking",
"of",
"system",
"classes",
"."
] | train | https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-core/src/main/java/org/powermock/core/ClassReplicaCreator.java#L147-L179 |
google/closure-compiler | src/com/google/javascript/jscomp/graph/FixedPointGraphTraversal.java | FixedPointGraphTraversal.computeFixedPoint | public void computeFixedPoint(DiGraph<N, E> graph, Set<N> entrySet) {
int cycleCount = 0;
long nodeCount = graph.getNodeCount();
// Choose a bail-out heuristically in case the computation
// doesn't converge.
long maxIterations = Math.max(nodeCount * nodeCount * nodeCount, 100);
// Use a LinkedHashSet, so that the traversal is deterministic.
LinkedHashSet<DiGraphNode<N, E>> workSet = new LinkedHashSet<>();
for (N n : entrySet) {
workSet.add(graph.getDirectedGraphNode(n));
}
for (; !workSet.isEmpty() && cycleCount < maxIterations; cycleCount++) {
// For every out edge in the workSet, traverse that edge. If that
// edge updates the state of the graph, then add the destination
// node to the resultSet, so that we can update all of its out edges
// on the next iteration.
DiGraphNode<N, E> source = workSet.iterator().next();
N sourceValue = source.getValue();
workSet.remove(source);
List<DiGraphEdge<N, E>> outEdges = source.getOutEdges();
for (DiGraphEdge<N, E> edge : outEdges) {
N destNode = edge.getDestination().getValue();
if (callback.traverseEdge(sourceValue, edge.getValue(), destNode)) {
workSet.add(edge.getDestination());
}
}
}
checkState(cycleCount != maxIterations, NON_HALTING_ERROR_MSG);
} | java | public void computeFixedPoint(DiGraph<N, E> graph, Set<N> entrySet) {
int cycleCount = 0;
long nodeCount = graph.getNodeCount();
// Choose a bail-out heuristically in case the computation
// doesn't converge.
long maxIterations = Math.max(nodeCount * nodeCount * nodeCount, 100);
// Use a LinkedHashSet, so that the traversal is deterministic.
LinkedHashSet<DiGraphNode<N, E>> workSet = new LinkedHashSet<>();
for (N n : entrySet) {
workSet.add(graph.getDirectedGraphNode(n));
}
for (; !workSet.isEmpty() && cycleCount < maxIterations; cycleCount++) {
// For every out edge in the workSet, traverse that edge. If that
// edge updates the state of the graph, then add the destination
// node to the resultSet, so that we can update all of its out edges
// on the next iteration.
DiGraphNode<N, E> source = workSet.iterator().next();
N sourceValue = source.getValue();
workSet.remove(source);
List<DiGraphEdge<N, E>> outEdges = source.getOutEdges();
for (DiGraphEdge<N, E> edge : outEdges) {
N destNode = edge.getDestination().getValue();
if (callback.traverseEdge(sourceValue, edge.getValue(), destNode)) {
workSet.add(edge.getDestination());
}
}
}
checkState(cycleCount != maxIterations, NON_HALTING_ERROR_MSG);
} | [
"public",
"void",
"computeFixedPoint",
"(",
"DiGraph",
"<",
"N",
",",
"E",
">",
"graph",
",",
"Set",
"<",
"N",
">",
"entrySet",
")",
"{",
"int",
"cycleCount",
"=",
"0",
";",
"long",
"nodeCount",
"=",
"graph",
".",
"getNodeCount",
"(",
")",
";",
"// C... | Compute a fixed point for the given graph, entering from the given nodes.
@param graph The graph to traverse.
@param entrySet The nodes to begin traversing from. | [
"Compute",
"a",
"fixed",
"point",
"for",
"the",
"given",
"graph",
"entering",
"from",
"the",
"given",
"nodes",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/graph/FixedPointGraphTraversal.java#L91-L124 |
b3dgs/lionengine | lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/collision/CollisionRangeConfig.java | CollisionRangeConfig.exports | public static void exports(Xml root, CollisionRange range)
{
Check.notNull(root);
Check.notNull(range);
final Xml node = root.createChild(NODE_RANGE);
node.writeString(ATT_AXIS, range.getOutput().name());
node.writeInteger(ATT_MIN_X, range.getMinX());
node.writeInteger(ATT_MIN_Y, range.getMinY());
node.writeInteger(ATT_MAX_X, range.getMaxX());
node.writeInteger(ATT_MAX_Y, range.getMaxY());
} | java | public static void exports(Xml root, CollisionRange range)
{
Check.notNull(root);
Check.notNull(range);
final Xml node = root.createChild(NODE_RANGE);
node.writeString(ATT_AXIS, range.getOutput().name());
node.writeInteger(ATT_MIN_X, range.getMinX());
node.writeInteger(ATT_MIN_Y, range.getMinY());
node.writeInteger(ATT_MAX_X, range.getMaxX());
node.writeInteger(ATT_MAX_Y, range.getMaxY());
} | [
"public",
"static",
"void",
"exports",
"(",
"Xml",
"root",
",",
"CollisionRange",
"range",
")",
"{",
"Check",
".",
"notNull",
"(",
"root",
")",
";",
"Check",
".",
"notNull",
"(",
"range",
")",
";",
"final",
"Xml",
"node",
"=",
"root",
".",
"createChild... | Export the collision range as a node.
@param root The node root (must not be <code>null</code>).
@param range The collision range to export (must not be <code>null</code>).
@throws LionEngineException If error on writing. | [
"Export",
"the",
"collision",
"range",
"as",
"a",
"node",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/collision/CollisionRangeConfig.java#L86-L97 |
Mozu/mozu-java | mozu-java-core/src/main/java/com/mozu/api/urls/commerce/customer/CustomerAccountUrl.java | CustomerAccountUrl.getCustomersPurchaseOrderAccountsUrl | public static MozuUrl getCustomersPurchaseOrderAccountsUrl(String accountType, Integer pageSize, String responseFields, String sortBy, Integer startIndex)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/customer/accounts/purchaseOrderAccounts?startIndex={startIndex}&pageSize={pageSize}&sortBy={sortBy}&accountType={accountType}&responseFields={responseFields}");
formatter.formatUrl("accountType", accountType);
formatter.formatUrl("pageSize", pageSize);
formatter.formatUrl("responseFields", responseFields);
formatter.formatUrl("sortBy", sortBy);
formatter.formatUrl("startIndex", startIndex);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java | public static MozuUrl getCustomersPurchaseOrderAccountsUrl(String accountType, Integer pageSize, String responseFields, String sortBy, Integer startIndex)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/customer/accounts/purchaseOrderAccounts?startIndex={startIndex}&pageSize={pageSize}&sortBy={sortBy}&accountType={accountType}&responseFields={responseFields}");
formatter.formatUrl("accountType", accountType);
formatter.formatUrl("pageSize", pageSize);
formatter.formatUrl("responseFields", responseFields);
formatter.formatUrl("sortBy", sortBy);
formatter.formatUrl("startIndex", startIndex);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | [
"public",
"static",
"MozuUrl",
"getCustomersPurchaseOrderAccountsUrl",
"(",
"String",
"accountType",
",",
"Integer",
"pageSize",
",",
"String",
"responseFields",
",",
"String",
"sortBy",
",",
"Integer",
"startIndex",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
... | Get Resource Url for GetCustomersPurchaseOrderAccounts
@param accountType
@param pageSize When creating paged results from a query, this value indicates the zero-based offset in the complete result set where the returned entities begin. For example, with this parameter set to 25, to get the 51st through the 75th items, set startIndex to 50.
@param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss.
@param sortBy The element to sort the results by and the channel in which the results appear. Either ascending (a-z) or descending (z-a) channel. Optional. Refer to [Sorting and Filtering](../../../../Developer/api-guides/sorting-filtering.htm) for more information.
@param startIndex When creating paged results from a query, this value indicates the zero-based offset in the complete result set where the returned entities begin. For example, with pageSize set to 25, to get the 51st through the 75th items, set this parameter to 50.
@return String Resource Url | [
"Get",
"Resource",
"Url",
"for",
"GetCustomersPurchaseOrderAccounts"
] | train | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/customer/CustomerAccountUrl.java#L235-L244 |
igniterealtime/Smack | smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/RTPBridge.java | RTPBridge.relaySession | @SuppressWarnings("deprecation")
public static RTPBridge relaySession(XMPPConnection connection, String sessionID, String pass, TransportCandidate proxyCandidate, TransportCandidate localCandidate) throws NotConnectedException, InterruptedException {
if (!connection.isConnected()) {
return null;
}
RTPBridge rtpPacket = new RTPBridge(sessionID, RTPBridge.BridgeAction.change);
rtpPacket.setTo(RTPBridge.NAME + "." + connection.getXMPPServiceDomain());
rtpPacket.setType(Type.set);
rtpPacket.setPass(pass);
rtpPacket.setPortA(localCandidate.getPort());
rtpPacket.setPortB(proxyCandidate.getPort());
rtpPacket.setHostA(localCandidate.getIp());
rtpPacket.setHostB(proxyCandidate.getIp());
// LOGGER.debug("Relayed to: " + candidate.getIp() + ":" + candidate.getPort());
StanzaCollector collector = connection.createStanzaCollectorAndSend(rtpPacket);
RTPBridge response = collector.nextResult();
// Cancel the collector.
collector.cancel();
return response;
} | java | @SuppressWarnings("deprecation")
public static RTPBridge relaySession(XMPPConnection connection, String sessionID, String pass, TransportCandidate proxyCandidate, TransportCandidate localCandidate) throws NotConnectedException, InterruptedException {
if (!connection.isConnected()) {
return null;
}
RTPBridge rtpPacket = new RTPBridge(sessionID, RTPBridge.BridgeAction.change);
rtpPacket.setTo(RTPBridge.NAME + "." + connection.getXMPPServiceDomain());
rtpPacket.setType(Type.set);
rtpPacket.setPass(pass);
rtpPacket.setPortA(localCandidate.getPort());
rtpPacket.setPortB(proxyCandidate.getPort());
rtpPacket.setHostA(localCandidate.getIp());
rtpPacket.setHostB(proxyCandidate.getIp());
// LOGGER.debug("Relayed to: " + candidate.getIp() + ":" + candidate.getPort());
StanzaCollector collector = connection.createStanzaCollectorAndSend(rtpPacket);
RTPBridge response = collector.nextResult();
// Cancel the collector.
collector.cancel();
return response;
} | [
"@",
"SuppressWarnings",
"(",
"\"deprecation\"",
")",
"public",
"static",
"RTPBridge",
"relaySession",
"(",
"XMPPConnection",
"connection",
",",
"String",
"sessionID",
",",
"String",
"pass",
",",
"TransportCandidate",
"proxyCandidate",
",",
"TransportCandidate",
"localC... | Check if the server support RTPBridge Service.
@param connection
@return the RTPBridge
@throws NotConnectedException
@throws InterruptedException | [
"Check",
"if",
"the",
"server",
"support",
"RTPBridge",
"Service",
"."
] | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/RTPBridge.java#L467-L494 |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPBitOutputStream.java | JBBPBitOutputStream.writeLong | public void writeLong(final long value, final JBBPByteOrder byteOrder) throws IOException {
if (byteOrder == JBBPByteOrder.BIG_ENDIAN) {
this.writeInt((int) (value >>> 32), byteOrder);
this.writeInt((int) value, byteOrder);
} else {
this.writeInt((int) value, byteOrder);
this.writeInt((int) (value >>> 32), byteOrder);
}
} | java | public void writeLong(final long value, final JBBPByteOrder byteOrder) throws IOException {
if (byteOrder == JBBPByteOrder.BIG_ENDIAN) {
this.writeInt((int) (value >>> 32), byteOrder);
this.writeInt((int) value, byteOrder);
} else {
this.writeInt((int) value, byteOrder);
this.writeInt((int) (value >>> 32), byteOrder);
}
} | [
"public",
"void",
"writeLong",
"(",
"final",
"long",
"value",
",",
"final",
"JBBPByteOrder",
"byteOrder",
")",
"throws",
"IOException",
"{",
"if",
"(",
"byteOrder",
"==",
"JBBPByteOrder",
".",
"BIG_ENDIAN",
")",
"{",
"this",
".",
"writeInt",
"(",
"(",
"int",... | Write a long value into the output stream.
@param value a value to be written into the output stream.
@param byteOrder the byte order of the value bytes to be used for writing.
@throws IOException it will be thrown for transport errors
@see JBBPByteOrder#BIG_ENDIAN
@see JBBPByteOrder#LITTLE_ENDIAN | [
"Write",
"a",
"long",
"value",
"into",
"the",
"output",
"stream",
"."
] | train | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPBitOutputStream.java#L151-L159 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/accesslayer/sql/SqlQueryStatement.java | SqlQueryStatement.appendHavingClause | protected void appendHavingClause(StringBuffer having, Criteria crit, StringBuffer stmt)
{
if (having.length() == 0)
{
having = null;
}
if (having != null || crit != null)
{
stmt.append(" HAVING ");
appendClause(having, crit, stmt);
}
} | java | protected void appendHavingClause(StringBuffer having, Criteria crit, StringBuffer stmt)
{
if (having.length() == 0)
{
having = null;
}
if (having != null || crit != null)
{
stmt.append(" HAVING ");
appendClause(having, crit, stmt);
}
} | [
"protected",
"void",
"appendHavingClause",
"(",
"StringBuffer",
"having",
",",
"Criteria",
"crit",
",",
"StringBuffer",
"stmt",
")",
"{",
"if",
"(",
"having",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"having",
"=",
"null",
";",
"}",
"if",
"(",
"ha... | appends a HAVING-clause to the Statement
@param having
@param crit
@param stmt | [
"appends",
"a",
"HAVING",
"-",
"clause",
"to",
"the",
"Statement"
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/accesslayer/sql/SqlQueryStatement.java#L561-L573 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/stream/streamidentifier_binding.java | streamidentifier_binding.get | public static streamidentifier_binding get(nitro_service service, String name) throws Exception{
streamidentifier_binding obj = new streamidentifier_binding();
obj.set_name(name);
streamidentifier_binding response = (streamidentifier_binding) obj.get_resource(service);
return response;
} | java | public static streamidentifier_binding get(nitro_service service, String name) throws Exception{
streamidentifier_binding obj = new streamidentifier_binding();
obj.set_name(name);
streamidentifier_binding response = (streamidentifier_binding) obj.get_resource(service);
return response;
} | [
"public",
"static",
"streamidentifier_binding",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"name",
")",
"throws",
"Exception",
"{",
"streamidentifier_binding",
"obj",
"=",
"new",
"streamidentifier_binding",
"(",
")",
";",
"obj",
".",
"set_name",
"(",
"... | Use this API to fetch streamidentifier_binding resource of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"streamidentifier_binding",
"resource",
"of",
"given",
"name",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/stream/streamidentifier_binding.java#L103-L108 |
mgormley/pacaya | src/main/java/edu/jhu/pacaya/gm/model/globalfac/ProjDepTreeFactor.java | ProjDepTreeFactor.getMsgs | private Tensor getMsgs(VarTensor[] inMsgs, int tf) {
Algebra s = inMsgs[0].getAlgebra();
EdgeScores es = new EdgeScores(n, s.zero());
for (VarTensor inMsg : inMsgs) {
LinkVar link = (LinkVar) inMsg.getVars().get(0);
double val = inMsg.getValue(tf);
es.setScore(link.getParent(), link.getChild(), val);
}
return es.toTensor(s);
} | java | private Tensor getMsgs(VarTensor[] inMsgs, int tf) {
Algebra s = inMsgs[0].getAlgebra();
EdgeScores es = new EdgeScores(n, s.zero());
for (VarTensor inMsg : inMsgs) {
LinkVar link = (LinkVar) inMsg.getVars().get(0);
double val = inMsg.getValue(tf);
es.setScore(link.getParent(), link.getChild(), val);
}
return es.toTensor(s);
} | [
"private",
"Tensor",
"getMsgs",
"(",
"VarTensor",
"[",
"]",
"inMsgs",
",",
"int",
"tf",
")",
"{",
"Algebra",
"s",
"=",
"inMsgs",
"[",
"0",
"]",
".",
"getAlgebra",
"(",
")",
";",
"EdgeScores",
"es",
"=",
"new",
"EdgeScores",
"(",
"n",
",",
"s",
".",... | Gets messages from the Messages[].
@param inMsgs The input messages.
@param tf Whether to get TRUE or FALSE messages.
@return The messages as a Tensor. | [
"Gets",
"messages",
"from",
"the",
"Messages",
"[]",
"."
] | train | https://github.com/mgormley/pacaya/blob/786294cbac7cc65dbc32210c10acc32ed0c69233/src/main/java/edu/jhu/pacaya/gm/model/globalfac/ProjDepTreeFactor.java#L283-L292 |
bbottema/simple-java-mail | modules/simple-java-mail/src/main/java/org/simplejavamail/mailer/internal/mailsender/MailSenderImpl.java | MailSenderImpl.configureSessionWithTimeout | private void configureSessionWithTimeout(final Session session, final int sessionTimeout) {
if (transportStrategy != null) {
// socket timeouts handling
final Properties sessionProperties = session.getProperties();
sessionProperties.put(transportStrategy.propertyNameConnectionTimeout(), String.valueOf(sessionTimeout));
sessionProperties.put(transportStrategy.propertyNameTimeout(), String.valueOf(sessionTimeout));
sessionProperties.put(transportStrategy.propertyNameWriteTimeout(), String.valueOf(sessionTimeout));
} else {
LOGGER.debug("No transport strategy provided, skipping defaults for .connectiontimout, .timout and .writetimeout");
}
} | java | private void configureSessionWithTimeout(final Session session, final int sessionTimeout) {
if (transportStrategy != null) {
// socket timeouts handling
final Properties sessionProperties = session.getProperties();
sessionProperties.put(transportStrategy.propertyNameConnectionTimeout(), String.valueOf(sessionTimeout));
sessionProperties.put(transportStrategy.propertyNameTimeout(), String.valueOf(sessionTimeout));
sessionProperties.put(transportStrategy.propertyNameWriteTimeout(), String.valueOf(sessionTimeout));
} else {
LOGGER.debug("No transport strategy provided, skipping defaults for .connectiontimout, .timout and .writetimeout");
}
} | [
"private",
"void",
"configureSessionWithTimeout",
"(",
"final",
"Session",
"session",
",",
"final",
"int",
"sessionTimeout",
")",
"{",
"if",
"(",
"transportStrategy",
"!=",
"null",
")",
"{",
"// socket timeouts handling",
"final",
"Properties",
"sessionProperties",
"=... | Configures the {@link Session} with the same timeout for socket connection timeout, read and write timeout. | [
"Configures",
"the",
"{"
] | train | https://github.com/bbottema/simple-java-mail/blob/b03635328aeecd525e35eddfef8f5b9a184559d8/modules/simple-java-mail/src/main/java/org/simplejavamail/mailer/internal/mailsender/MailSenderImpl.java#L198-L208 |
looly/hutool | hutool-extra/src/main/java/cn/hutool/extra/ssh/JschUtil.java | JschUtil.openChannel | public static Channel openChannel(Session session, ChannelType channelType) {
final Channel channel = createChannel(session, channelType);
try {
channel.connect();
} catch (JSchException e) {
throw new JschRuntimeException(e);
}
return channel;
} | java | public static Channel openChannel(Session session, ChannelType channelType) {
final Channel channel = createChannel(session, channelType);
try {
channel.connect();
} catch (JSchException e) {
throw new JschRuntimeException(e);
}
return channel;
} | [
"public",
"static",
"Channel",
"openChannel",
"(",
"Session",
"session",
",",
"ChannelType",
"channelType",
")",
"{",
"final",
"Channel",
"channel",
"=",
"createChannel",
"(",
"session",
",",
"channelType",
")",
";",
"try",
"{",
"channel",
".",
"connect",
"(",... | 打开Channel连接
@param session Session会话
@param channelType 通道类型,可以是shell或sftp等,见{@link ChannelType}
@return {@link Channel}
@since 4.5.2 | [
"打开Channel连接"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/ssh/JschUtil.java#L218-L226 |
OpenLiberty/open-liberty | dev/com.ibm.ws.microprofile.metrics/src/com/ibm/ws/microprofile/metrics/impl/MetricRegistryImpl.java | MetricRegistryImpl.getGauges | @Override
public SortedMap<String, Gauge> getGauges(MetricFilter filter) {
return getMetrics(Gauge.class, filter);
} | java | @Override
public SortedMap<String, Gauge> getGauges(MetricFilter filter) {
return getMetrics(Gauge.class, filter);
} | [
"@",
"Override",
"public",
"SortedMap",
"<",
"String",
",",
"Gauge",
">",
"getGauges",
"(",
"MetricFilter",
"filter",
")",
"{",
"return",
"getMetrics",
"(",
"Gauge",
".",
"class",
",",
"filter",
")",
";",
"}"
] | Returns a map of all the gauges in the registry and their names which match the given filter.
@param filter the metric filter to match
@return all the gauges in the registry | [
"Returns",
"a",
"map",
"of",
"all",
"the",
"gauges",
"in",
"the",
"registry",
"and",
"their",
"names",
"which",
"match",
"the",
"given",
"filter",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.metrics/src/com/ibm/ws/microprofile/metrics/impl/MetricRegistryImpl.java#L340-L343 |
osmdroid/osmdroid | osmdroid-android/src/main/java/org/osmdroid/util/SegmentIntersection.java | SegmentIntersection.parallelSideEffect | private static boolean parallelSideEffect(
final double pXA, final double pYA, final double pXB, final double pYB,
final double pXC, final double pYC, final double pXD, final double pYD,
final PointL pIntersection
) {
if (pXA == pXB) {
return parallelSideEffectSameX(pXA, pYA, pXB, pYB, pXC, pYC, pXD, pYD, pIntersection);
}
if (pXC == pXD) {
return parallelSideEffectSameX(pXC, pYC, pXD, pYD, pXA, pYA, pXB, pYB, pIntersection);
}
// formula like "y = k*x + b"
final double k1 = (pYB - pYA) / (pXB - pXA);
final double k2 = (pYD - pYC) / (pXD - pXC);
if (k1 != k2) { // not parallel
return false;
}
final double b1 = pYA - k1 * pXA;
final double b2 = pYC - k2 * pXC;
if (b1 != b2) { // strictly parallel, no overlap
return false;
}
final double xi = middle(pXA, pXB, pXC, pXD);
final double yi = middle(pYA, pYB, pYC, pYD);
return check(pXA, pYA, pXB, pYB, pXC, pYC, pXD, pYD, pIntersection, xi, yi);
} | java | private static boolean parallelSideEffect(
final double pXA, final double pYA, final double pXB, final double pYB,
final double pXC, final double pYC, final double pXD, final double pYD,
final PointL pIntersection
) {
if (pXA == pXB) {
return parallelSideEffectSameX(pXA, pYA, pXB, pYB, pXC, pYC, pXD, pYD, pIntersection);
}
if (pXC == pXD) {
return parallelSideEffectSameX(pXC, pYC, pXD, pYD, pXA, pYA, pXB, pYB, pIntersection);
}
// formula like "y = k*x + b"
final double k1 = (pYB - pYA) / (pXB - pXA);
final double k2 = (pYD - pYC) / (pXD - pXC);
if (k1 != k2) { // not parallel
return false;
}
final double b1 = pYA - k1 * pXA;
final double b2 = pYC - k2 * pXC;
if (b1 != b2) { // strictly parallel, no overlap
return false;
}
final double xi = middle(pXA, pXB, pXC, pXD);
final double yi = middle(pYA, pYB, pYC, pYD);
return check(pXA, pYA, pXB, pYB, pXC, pYC, pXD, pYD, pIntersection, xi, yi);
} | [
"private",
"static",
"boolean",
"parallelSideEffect",
"(",
"final",
"double",
"pXA",
",",
"final",
"double",
"pYA",
",",
"final",
"double",
"pXB",
",",
"final",
"double",
"pYB",
",",
"final",
"double",
"pXC",
",",
"final",
"double",
"pYC",
",",
"final",
"d... | When the segments are parallels and overlap, the middle of the overlap is considered as the intersection | [
"When",
"the",
"segments",
"are",
"parallels",
"and",
"overlap",
"the",
"middle",
"of",
"the",
"overlap",
"is",
"considered",
"as",
"the",
"intersection"
] | train | https://github.com/osmdroid/osmdroid/blob/3b178b2f078497dd88c137110e87aafe45ad2b16/osmdroid-android/src/main/java/org/osmdroid/util/SegmentIntersection.java#L47-L72 |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/ejbcontainer/util/ParsedScheduleExpression.java | ParsedScheduleExpression.getNextTimeout | public long getNextTimeout(long lastTimeout)
{
// Perform basic validation of lastTimeout, which should be a value that
// was previously returned from getFirstTimeout.
if (lastTimeout < start)
{
throw new IllegalArgumentException("last timeout " + lastTimeout + " is before start time " + start);
}
if (lastTimeout > end)
{
throw new IllegalArgumentException("last timeout " + lastTimeout + " is after end time " + end);
}
if (lastTimeout % 1000 != 0) // d666295
{
throw new IllegalArgumentException("last timeout " + lastTimeout + " is mid-second");
}
return getTimeout(lastTimeout, true);
} | java | public long getNextTimeout(long lastTimeout)
{
// Perform basic validation of lastTimeout, which should be a value that
// was previously returned from getFirstTimeout.
if (lastTimeout < start)
{
throw new IllegalArgumentException("last timeout " + lastTimeout + " is before start time " + start);
}
if (lastTimeout > end)
{
throw new IllegalArgumentException("last timeout " + lastTimeout + " is after end time " + end);
}
if (lastTimeout % 1000 != 0) // d666295
{
throw new IllegalArgumentException("last timeout " + lastTimeout + " is mid-second");
}
return getTimeout(lastTimeout, true);
} | [
"public",
"long",
"getNextTimeout",
"(",
"long",
"lastTimeout",
")",
"{",
"// Perform basic validation of lastTimeout, which should be a value that",
"// was previously returned from getFirstTimeout.",
"if",
"(",
"lastTimeout",
"<",
"start",
")",
"{",
"throw",
"new",
"IllegalAr... | Determines the next timeout for the schedule expression.
@param lastTimeout the last timeout in milliseconds
@return the next timeout in milliseconds, or -1 if there are no more
future timeouts for the expression
@throws IllegalArgumentException if lastTimeout is before the start time
of the expression | [
"Determines",
"the",
"next",
"timeout",
"for",
"the",
"schedule",
"expression",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/ejbcontainer/util/ParsedScheduleExpression.java#L466-L487 |
BlueBrain/bluima | modules/bluima_lexica/src/main/java/ch/epfl/bbp/uima/obo/OBOOntology.java | OBOOntology.directIsA | public boolean directIsA(String hypoID, String hyperID) {
if (!terms.containsKey(hypoID))
return false;
OntologyTerm term = terms.get(hypoID);
if (term.getIsA().contains(hyperID))
return true;
return false;
} | java | public boolean directIsA(String hypoID, String hyperID) {
if (!terms.containsKey(hypoID))
return false;
OntologyTerm term = terms.get(hypoID);
if (term.getIsA().contains(hyperID))
return true;
return false;
} | [
"public",
"boolean",
"directIsA",
"(",
"String",
"hypoID",
",",
"String",
"hyperID",
")",
"{",
"if",
"(",
"!",
"terms",
".",
"containsKey",
"(",
"hypoID",
")",
")",
"return",
"false",
";",
"OntologyTerm",
"term",
"=",
"terms",
".",
"get",
"(",
"hypoID",
... | Tests whether there is a direct is_a (or has_role) relationship between
two IDs.
@param hypoID
The potential hyponym (child term).
@param hyperID
The potential hypernym (parent term).
@return Whether that direct relationship exists. | [
"Tests",
"whether",
"there",
"is",
"a",
"direct",
"is_a",
"(",
"or",
"has_role",
")",
"relationship",
"between",
"two",
"IDs",
"."
] | train | https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_lexica/src/main/java/ch/epfl/bbp/uima/obo/OBOOntology.java#L322-L329 |
astrapi69/jaulp-wicket | jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/labeled/textfield/LabeledDateTimeFieldPanel.java | LabeledDateTimeFieldPanel.newDateTimeField | protected DateTimeField newDateTimeField(final String id, final IModel<M> model)
{
final IModel<Date> textFieldModel = new PropertyModel<>(model.getObject(), getId());
return ComponentFactory.newDateTimeField(id, textFieldModel);
} | java | protected DateTimeField newDateTimeField(final String id, final IModel<M> model)
{
final IModel<Date> textFieldModel = new PropertyModel<>(model.getObject(), getId());
return ComponentFactory.newDateTimeField(id, textFieldModel);
} | [
"protected",
"DateTimeField",
"newDateTimeField",
"(",
"final",
"String",
"id",
",",
"final",
"IModel",
"<",
"M",
">",
"model",
")",
"{",
"final",
"IModel",
"<",
"Date",
">",
"textFieldModel",
"=",
"new",
"PropertyModel",
"<>",
"(",
"model",
".",
"getObject"... | Factory method for create the new {@link DateTimeField}. This method is invoked in the
constructor from the derived classes and can be overridden so users can provide their own
version of a new {@link DateTimeField}.
@param id
the id
@param model
the model
@return the new {@link DateTimeField} | [
"Factory",
"method",
"for",
"create",
"the",
"new",
"{",
"@link",
"DateTimeField",
"}",
".",
"This",
"method",
"is",
"invoked",
"in",
"the",
"constructor",
"from",
"the",
"derived",
"classes",
"and",
"can",
"be",
"overridden",
"so",
"users",
"can",
"provide"... | train | https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/labeled/textfield/LabeledDateTimeFieldPanel.java#L93-L97 |
apereo/cas | support/cas-server-support-aws/src/main/java/org/apereo/cas/aws/AmazonEnvironmentAwareClientBuilder.java | AmazonEnvironmentAwareClientBuilder.getSetting | public String getSetting(final String key, final String defaultValue) {
val result = environment.getProperty(this.propertyPrefix + '.' + key);
return StringUtils.defaultIfBlank(result, defaultValue);
} | java | public String getSetting(final String key, final String defaultValue) {
val result = environment.getProperty(this.propertyPrefix + '.' + key);
return StringUtils.defaultIfBlank(result, defaultValue);
} | [
"public",
"String",
"getSetting",
"(",
"final",
"String",
"key",
",",
"final",
"String",
"defaultValue",
")",
"{",
"val",
"result",
"=",
"environment",
".",
"getProperty",
"(",
"this",
".",
"propertyPrefix",
"+",
"'",
"'",
"+",
"key",
")",
";",
"return",
... | Gets setting.
@param key the key
@param defaultValue the default value
@return the setting | [
"Gets",
"setting",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-aws/src/main/java/org/apereo/cas/aws/AmazonEnvironmentAwareClientBuilder.java#L43-L46 |
querydsl/querydsl | querydsl-core/src/main/java/com/querydsl/core/types/dsl/BeanPath.java | BeanPath.createArray | protected <A, E> ArrayPath<A, E> createArray(String property, Class<? super A> type) {
return add(new ArrayPath<A, E>(type, forProperty(property)));
} | java | protected <A, E> ArrayPath<A, E> createArray(String property, Class<? super A> type) {
return add(new ArrayPath<A, E>(type, forProperty(property)));
} | [
"protected",
"<",
"A",
",",
"E",
">",
"ArrayPath",
"<",
"A",
",",
"E",
">",
"createArray",
"(",
"String",
"property",
",",
"Class",
"<",
"?",
"super",
"A",
">",
"type",
")",
"{",
"return",
"add",
"(",
"new",
"ArrayPath",
"<",
"A",
",",
"E",
">",
... | Create a new array path
@param <A>
@param property property name
@param type property type
@return property path | [
"Create",
"a",
"new",
"array",
"path"
] | train | https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-core/src/main/java/com/querydsl/core/types/dsl/BeanPath.java#L127-L129 |
facebookarchive/hadoop-20 | src/contrib/raid/src/java/org/apache/hadoop/raid/HarIndex.java | HarIndex.getHarIndex | public static HarIndex getHarIndex(FileSystem fs, Path initializer)
throws IOException {
if (!initializer.getName().endsWith(HAR)) {
initializer = initializer.getParent();
}
InputStream in = null;
try {
Path indexFile = new Path(initializer, INDEX);
FileStatus indexStat = fs.getFileStatus(indexFile);
in = fs.open(indexFile);
HarIndex harIndex = new HarIndex(in, indexStat.getLen());
harIndex.harDirectory = initializer;
return harIndex;
} finally {
if (in != null) {
in.close();
}
}
} | java | public static HarIndex getHarIndex(FileSystem fs, Path initializer)
throws IOException {
if (!initializer.getName().endsWith(HAR)) {
initializer = initializer.getParent();
}
InputStream in = null;
try {
Path indexFile = new Path(initializer, INDEX);
FileStatus indexStat = fs.getFileStatus(indexFile);
in = fs.open(indexFile);
HarIndex harIndex = new HarIndex(in, indexStat.getLen());
harIndex.harDirectory = initializer;
return harIndex;
} finally {
if (in != null) {
in.close();
}
}
} | [
"public",
"static",
"HarIndex",
"getHarIndex",
"(",
"FileSystem",
"fs",
",",
"Path",
"initializer",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"initializer",
".",
"getName",
"(",
")",
".",
"endsWith",
"(",
"HAR",
")",
")",
"{",
"initializer",
"=",
... | Creates a HarIndex object with the path to either the HAR
or a part file in the HAR. | [
"Creates",
"a",
"HarIndex",
"object",
"with",
"the",
"path",
"to",
"either",
"the",
"HAR",
"or",
"a",
"part",
"file",
"in",
"the",
"HAR",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/raid/src/java/org/apache/hadoop/raid/HarIndex.java#L77-L95 |
apache/incubator-gobblin | gobblin-restli/gobblin-flow-config-service/gobblin-flow-config-service-server/src/main/java/org/apache/gobblin/service/FlowConfigsResource.java | FlowConfigsResource.get | @Override
public FlowConfig get(ComplexResourceKey<FlowId, EmptyRecord> key) {
String flowGroup = key.getKey().getFlowGroup();
String flowName = key.getKey().getFlowName();
FlowId flowId = new FlowId().setFlowGroup(flowGroup).setFlowName(flowName);
return this.flowConfigsResourceHandler.getFlowConfig(flowId);
} | java | @Override
public FlowConfig get(ComplexResourceKey<FlowId, EmptyRecord> key) {
String flowGroup = key.getKey().getFlowGroup();
String flowName = key.getKey().getFlowName();
FlowId flowId = new FlowId().setFlowGroup(flowGroup).setFlowName(flowName);
return this.flowConfigsResourceHandler.getFlowConfig(flowId);
} | [
"@",
"Override",
"public",
"FlowConfig",
"get",
"(",
"ComplexResourceKey",
"<",
"FlowId",
",",
"EmptyRecord",
">",
"key",
")",
"{",
"String",
"flowGroup",
"=",
"key",
".",
"getKey",
"(",
")",
".",
"getFlowGroup",
"(",
")",
";",
"String",
"flowName",
"=",
... | Retrieve the flow configuration with the given key
@param key flow config id key containing group name and flow name
@return {@link FlowConfig} with flow configuration | [
"Retrieve",
"the",
"flow",
"configuration",
"with",
"the",
"given",
"key"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-restli/gobblin-flow-config-service/gobblin-flow-config-service-server/src/main/java/org/apache/gobblin/service/FlowConfigsResource.java#L76-L82 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WDataTable.java | WDataTable.updateBeanValue | @Override
public void updateBeanValue() {
TableDataModel model = getDataModel();
if (model instanceof ScrollableTableDataModel) {
LOG.warn("UpdateBeanValue only updating the current page for ScrollableTableDataModel");
updateBeanValueCurrentPageOnly();
} else if (model.getRowCount() > 0) {
// Temporarily widen the pagination on the repeater to hold all rows
// Calling setBean with a non-null value overrides the DataTableBeanProvider
repeater.setBean(new RowIdList(0, model.getRowCount() - 1));
updateBeanValueCurrentPageOnly();
repeater.setBean(null);
}
} | java | @Override
public void updateBeanValue() {
TableDataModel model = getDataModel();
if (model instanceof ScrollableTableDataModel) {
LOG.warn("UpdateBeanValue only updating the current page for ScrollableTableDataModel");
updateBeanValueCurrentPageOnly();
} else if (model.getRowCount() > 0) {
// Temporarily widen the pagination on the repeater to hold all rows
// Calling setBean with a non-null value overrides the DataTableBeanProvider
repeater.setBean(new RowIdList(0, model.getRowCount() - 1));
updateBeanValueCurrentPageOnly();
repeater.setBean(null);
}
} | [
"@",
"Override",
"public",
"void",
"updateBeanValue",
"(",
")",
"{",
"TableDataModel",
"model",
"=",
"getDataModel",
"(",
")",
";",
"if",
"(",
"model",
"instanceof",
"ScrollableTableDataModel",
")",
"{",
"LOG",
".",
"warn",
"(",
"\"UpdateBeanValue only updating th... | Updates the bean using the table data model's {@link TableDataModel#setValueAt(Object, int, int)} method. | [
"Updates",
"the",
"bean",
"using",
"the",
"table",
"data",
"model",
"s",
"{"
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WDataTable.java#L342-L356 |
RestComm/jss7 | cap/cap-impl/src/main/java/org/restcomm/protocols/ss7/cap/CAPServiceBaseImpl.java | CAPServiceBaseImpl.createNewTCAPDialog | protected Dialog createNewTCAPDialog(SccpAddress origAddress, SccpAddress destAddress, Long localTrId) throws CAPException {
try {
return this.capProviderImpl.getTCAPProvider().getNewDialog(origAddress, destAddress, localTrId);
} catch (TCAPException e) {
throw new CAPException(e.getMessage(), e);
}
} | java | protected Dialog createNewTCAPDialog(SccpAddress origAddress, SccpAddress destAddress, Long localTrId) throws CAPException {
try {
return this.capProviderImpl.getTCAPProvider().getNewDialog(origAddress, destAddress, localTrId);
} catch (TCAPException e) {
throw new CAPException(e.getMessage(), e);
}
} | [
"protected",
"Dialog",
"createNewTCAPDialog",
"(",
"SccpAddress",
"origAddress",
",",
"SccpAddress",
"destAddress",
",",
"Long",
"localTrId",
")",
"throws",
"CAPException",
"{",
"try",
"{",
"return",
"this",
".",
"capProviderImpl",
".",
"getTCAPProvider",
"(",
")",
... | Creating new outgoing TCAP Dialog. Used when creating a new outgoing CAP Dialog
@param origAddress
@param destAddress
@return
@throws CAPException | [
"Creating",
"new",
"outgoing",
"TCAP",
"Dialog",
".",
"Used",
"when",
"creating",
"a",
"new",
"outgoing",
"CAP",
"Dialog"
] | train | https://github.com/RestComm/jss7/blob/402b4b3984e581c581e309cb5f6a858fde6dbc33/cap/cap-impl/src/main/java/org/restcomm/protocols/ss7/cap/CAPServiceBaseImpl.java#L82-L88 |
facebookarchive/hadoop-20 | src/core/org/apache/hadoop/security/UnixUserGroupInformation.java | UnixUserGroupInformation.setUserGroupNames | private void setUserGroupNames(String userName, String[] groupNames) {
if (userName==null || userName.length()==0 ||
groupNames== null || groupNames.length==0) {
throw new IllegalArgumentException(
"Parameters should not be null or an empty string/array");
}
for (int i=0; i<groupNames.length; i++) {
if(groupNames[i] == null || groupNames[i].length() == 0) {
throw new IllegalArgumentException("A null group name at index " + i);
}
}
this.userName = userName;
this.groupNames = groupNames;
} | java | private void setUserGroupNames(String userName, String[] groupNames) {
if (userName==null || userName.length()==0 ||
groupNames== null || groupNames.length==0) {
throw new IllegalArgumentException(
"Parameters should not be null or an empty string/array");
}
for (int i=0; i<groupNames.length; i++) {
if(groupNames[i] == null || groupNames[i].length() == 0) {
throw new IllegalArgumentException("A null group name at index " + i);
}
}
this.userName = userName;
this.groupNames = groupNames;
} | [
"private",
"void",
"setUserGroupNames",
"(",
"String",
"userName",
",",
"String",
"[",
"]",
"groupNames",
")",
"{",
"if",
"(",
"userName",
"==",
"null",
"||",
"userName",
".",
"length",
"(",
")",
"==",
"0",
"||",
"groupNames",
"==",
"null",
"||",
"groupN... | /* Set this object's user name and group names
@param userName a user's name
@param groupNames groups list, the first of which is the default group
@exception IllegalArgumentException if any argument is null | [
"/",
"*",
"Set",
"this",
"object",
"s",
"user",
"name",
"and",
"group",
"names"
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/security/UnixUserGroupInformation.java#L109-L122 |
dbmdz/iiif-presentation-api | iiif-presentation-frontend-impl-springmvc/src/main/java/de/digitalcollections/iiif/presentation/frontend/impl/springmvc/controller/v2/IIIFPresentationApiController.java | IIIFPresentationApiController.getManifest | @CrossOrigin(allowedHeaders = {"*"}, origins = {"*"})
@RequestMapping(value = {"{identifier}/manifest", "{identifier}"}, method = RequestMethod.GET,
produces = "application/json")
@ResponseBody
public Manifest getManifest(@PathVariable String identifier, HttpServletRequest request) throws NotFoundException, InvalidDataException {
HttpLoggingUtilities.addRequestClientInfoToMDC(request);
MDC.put("manifestId", identifier);
try {
Manifest manifest = presentationService.getManifest(identifier);
LOGGER.info("Serving manifest for {}", identifier);
return manifest;
} catch (NotFoundException e) {
LOGGER.info("Did not find manifest for {}", identifier);
throw e;
} catch (InvalidDataException e) {
LOGGER.error("Bad data for {}", identifier);
throw e;
} finally {
MDC.clear();
}
} | java | @CrossOrigin(allowedHeaders = {"*"}, origins = {"*"})
@RequestMapping(value = {"{identifier}/manifest", "{identifier}"}, method = RequestMethod.GET,
produces = "application/json")
@ResponseBody
public Manifest getManifest(@PathVariable String identifier, HttpServletRequest request) throws NotFoundException, InvalidDataException {
HttpLoggingUtilities.addRequestClientInfoToMDC(request);
MDC.put("manifestId", identifier);
try {
Manifest manifest = presentationService.getManifest(identifier);
LOGGER.info("Serving manifest for {}", identifier);
return manifest;
} catch (NotFoundException e) {
LOGGER.info("Did not find manifest for {}", identifier);
throw e;
} catch (InvalidDataException e) {
LOGGER.error("Bad data for {}", identifier);
throw e;
} finally {
MDC.clear();
}
} | [
"@",
"CrossOrigin",
"(",
"allowedHeaders",
"=",
"{",
"\"*\"",
"}",
",",
"origins",
"=",
"{",
"\"*\"",
"}",
")",
"@",
"RequestMapping",
"(",
"value",
"=",
"{",
"\"{identifier}/manifest\"",
",",
"\"{identifier}\"",
"}",
",",
"method",
"=",
"RequestMethod",
"."... | The manifest response contains sufficient information for the client to initialize itself and begin to display
something quickly to the user. The manifest resource represents a single object and any intellectual work or works
embodied within that object. In particular it includes the descriptive, rights and linking information for the
object. It then embeds the sequence(s) of canvases that should be rendered to the user.
@param identifier unique id of object to be shown
@param request request containing client information for logging
@return the JSON-Manifest
@throws NotFoundException if manifest can not be delivered
@throws de.digitalcollections.iiif.presentation.model.api.exceptions.InvalidDataException if manifest can not be read
@see <a href="http://iiif.io/api/presentation/2.0/#manifest">IIIF 2.0</a> | [
"The",
"manifest",
"response",
"contains",
"sufficient",
"information",
"for",
"the",
"client",
"to",
"initialize",
"itself",
"and",
"begin",
"to",
"display",
"something",
"quickly",
"to",
"the",
"user",
".",
"The",
"manifest",
"resource",
"represents",
"a",
"si... | train | https://github.com/dbmdz/iiif-presentation-api/blob/8b551d3717eed2620bc9e50b4c23f945b73b9cea/iiif-presentation-frontend-impl-springmvc/src/main/java/de/digitalcollections/iiif/presentation/frontend/impl/springmvc/controller/v2/IIIFPresentationApiController.java#L55-L75 |
apollographql/apollo-android | apollo-runtime/src/main/java/com/apollographql/apollo/internal/ApolloCallTracker.java | ApolloCallTracker.activeMutationCalls | @NotNull Set<ApolloMutationCall> activeMutationCalls(@NotNull OperationName operationName) {
return activeCalls(activeMutationCalls, operationName);
} | java | @NotNull Set<ApolloMutationCall> activeMutationCalls(@NotNull OperationName operationName) {
return activeCalls(activeMutationCalls, operationName);
} | [
"@",
"NotNull",
"Set",
"<",
"ApolloMutationCall",
">",
"activeMutationCalls",
"(",
"@",
"NotNull",
"OperationName",
"operationName",
")",
"{",
"return",
"activeCalls",
"(",
"activeMutationCalls",
",",
"operationName",
")",
";",
"}"
] | Returns currently active {@link ApolloMutationCall} calls by operation name.
@param operationName query operation name
@return set of active mutation calls | [
"Returns",
"currently",
"active",
"{",
"@link",
"ApolloMutationCall",
"}",
"calls",
"by",
"operation",
"name",
"."
] | train | https://github.com/apollographql/apollo-android/blob/a78869a76e17f77e42c7a88f0099914fe7ffa5b6/apollo-runtime/src/main/java/com/apollographql/apollo/internal/ApolloCallTracker.java#L187-L189 |
michael-rapp/AndroidBottomSheet | library/src/main/java/de/mrapp/android/bottomsheet/view/DraggableView.java | DraggableView.createAnimationListener | private AnimationListener createAnimationListener(final boolean show, final boolean cancel) {
return new AnimationListener() {
@Override
public void onAnimationStart(final Animation animation) {
}
@Override
public void onAnimationEnd(final Animation animation) {
clearAnimation();
maximized = show;
if (maximized) {
notifyOnMaximized();
} else {
notifyOnHidden(cancel);
}
}
@Override
public void onAnimationRepeat(final Animation animation) {
}
};
} | java | private AnimationListener createAnimationListener(final boolean show, final boolean cancel) {
return new AnimationListener() {
@Override
public void onAnimationStart(final Animation animation) {
}
@Override
public void onAnimationEnd(final Animation animation) {
clearAnimation();
maximized = show;
if (maximized) {
notifyOnMaximized();
} else {
notifyOnHidden(cancel);
}
}
@Override
public void onAnimationRepeat(final Animation animation) {
}
};
} | [
"private",
"AnimationListener",
"createAnimationListener",
"(",
"final",
"boolean",
"show",
",",
"final",
"boolean",
"cancel",
")",
"{",
"return",
"new",
"AnimationListener",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"onAnimationStart",
"(",
"final",
"Anim... | Creates and returns a listener, which allows to handle the end of an animation, which has
been used to show or hide the view.
@param show
True, if the view should be shown at the end of the animation, false otherwise
@param cancel
True, if the view should be canceled, false otherwise
@return The listener, which has been created, as an instance of the type {@link
AnimationListener} | [
"Creates",
"and",
"returns",
"a",
"listener",
"which",
"allows",
"to",
"handle",
"the",
"end",
"of",
"an",
"animation",
"which",
"has",
"been",
"used",
"to",
"show",
"or",
"hide",
"the",
"view",
"."
] | train | https://github.com/michael-rapp/AndroidBottomSheet/blob/6e4690ee9f63b14a7b143d3a3717b5f8a11ca503/library/src/main/java/de/mrapp/android/bottomsheet/view/DraggableView.java#L331-L357 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/utils/KerasConstraintUtils.java | KerasConstraintUtils.mapConstraint | public static LayerConstraint mapConstraint(String kerasConstraint, KerasLayerConfiguration conf,
Map<String, Object> constraintConfig)
throws UnsupportedKerasConfigurationException {
LayerConstraint constraint;
if (kerasConstraint.equals(conf.getLAYER_FIELD_MINMAX_NORM_CONSTRAINT())
|| kerasConstraint.equals(conf.getLAYER_FIELD_MINMAX_NORM_CONSTRAINT_ALIAS())) {
double min = (double) constraintConfig.get(conf.getLAYER_FIELD_MINMAX_MIN_CONSTRAINT());
double max = (double) constraintConfig.get(conf.getLAYER_FIELD_MINMAX_MAX_CONSTRAINT());
double rate = (double) constraintConfig.get(conf.getLAYER_FIELD_CONSTRAINT_RATE());
int dim = (int) constraintConfig.get(conf.getLAYER_FIELD_CONSTRAINT_DIM());
constraint = new MinMaxNormConstraint(min, max, rate, dim + 1);
} else if (kerasConstraint.equals(conf.getLAYER_FIELD_MAX_NORM_CONSTRAINT())
|| kerasConstraint.equals(conf.getLAYER_FIELD_MAX_NORM_CONSTRAINT_ALIAS())
|| kerasConstraint.equals(conf.getLAYER_FIELD_MAX_NORM_CONSTRAINT_ALIAS_2())) {
double max = (double) constraintConfig.get(conf.getLAYER_FIELD_MAX_CONSTRAINT());
int dim = (int) constraintConfig.get(conf.getLAYER_FIELD_CONSTRAINT_DIM());
constraint = new MaxNormConstraint(max, dim + 1);
} else if (kerasConstraint.equals(conf.getLAYER_FIELD_UNIT_NORM_CONSTRAINT())
|| kerasConstraint.equals(conf.getLAYER_FIELD_UNIT_NORM_CONSTRAINT_ALIAS())
|| kerasConstraint.equals(conf.getLAYER_FIELD_UNIT_NORM_CONSTRAINT_ALIAS_2())) {
int dim = (int) constraintConfig.get(conf.getLAYER_FIELD_CONSTRAINT_DIM());
constraint = new UnitNormConstraint(dim + 1);
} else if (kerasConstraint.equals(conf.getLAYER_FIELD_NON_NEG_CONSTRAINT())
|| kerasConstraint.equals(conf.getLAYER_FIELD_NON_NEG_CONSTRAINT_ALIAS())
|| kerasConstraint.equals(conf.getLAYER_FIELD_NON_NEG_CONSTRAINT_ALIAS_2())) {
constraint = new NonNegativeConstraint();
} else {
throw new UnsupportedKerasConfigurationException("Unknown keras constraint " + kerasConstraint);
}
return constraint;
} | java | public static LayerConstraint mapConstraint(String kerasConstraint, KerasLayerConfiguration conf,
Map<String, Object> constraintConfig)
throws UnsupportedKerasConfigurationException {
LayerConstraint constraint;
if (kerasConstraint.equals(conf.getLAYER_FIELD_MINMAX_NORM_CONSTRAINT())
|| kerasConstraint.equals(conf.getLAYER_FIELD_MINMAX_NORM_CONSTRAINT_ALIAS())) {
double min = (double) constraintConfig.get(conf.getLAYER_FIELD_MINMAX_MIN_CONSTRAINT());
double max = (double) constraintConfig.get(conf.getLAYER_FIELD_MINMAX_MAX_CONSTRAINT());
double rate = (double) constraintConfig.get(conf.getLAYER_FIELD_CONSTRAINT_RATE());
int dim = (int) constraintConfig.get(conf.getLAYER_FIELD_CONSTRAINT_DIM());
constraint = new MinMaxNormConstraint(min, max, rate, dim + 1);
} else if (kerasConstraint.equals(conf.getLAYER_FIELD_MAX_NORM_CONSTRAINT())
|| kerasConstraint.equals(conf.getLAYER_FIELD_MAX_NORM_CONSTRAINT_ALIAS())
|| kerasConstraint.equals(conf.getLAYER_FIELD_MAX_NORM_CONSTRAINT_ALIAS_2())) {
double max = (double) constraintConfig.get(conf.getLAYER_FIELD_MAX_CONSTRAINT());
int dim = (int) constraintConfig.get(conf.getLAYER_FIELD_CONSTRAINT_DIM());
constraint = new MaxNormConstraint(max, dim + 1);
} else if (kerasConstraint.equals(conf.getLAYER_FIELD_UNIT_NORM_CONSTRAINT())
|| kerasConstraint.equals(conf.getLAYER_FIELD_UNIT_NORM_CONSTRAINT_ALIAS())
|| kerasConstraint.equals(conf.getLAYER_FIELD_UNIT_NORM_CONSTRAINT_ALIAS_2())) {
int dim = (int) constraintConfig.get(conf.getLAYER_FIELD_CONSTRAINT_DIM());
constraint = new UnitNormConstraint(dim + 1);
} else if (kerasConstraint.equals(conf.getLAYER_FIELD_NON_NEG_CONSTRAINT())
|| kerasConstraint.equals(conf.getLAYER_FIELD_NON_NEG_CONSTRAINT_ALIAS())
|| kerasConstraint.equals(conf.getLAYER_FIELD_NON_NEG_CONSTRAINT_ALIAS_2())) {
constraint = new NonNegativeConstraint();
} else {
throw new UnsupportedKerasConfigurationException("Unknown keras constraint " + kerasConstraint);
}
return constraint;
} | [
"public",
"static",
"LayerConstraint",
"mapConstraint",
"(",
"String",
"kerasConstraint",
",",
"KerasLayerConfiguration",
"conf",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"constraintConfig",
")",
"throws",
"UnsupportedKerasConfigurationException",
"{",
"LayerConstra... | Map Keras to DL4J constraint.
@param kerasConstraint String containing Keras constraint name
@param conf Keras layer configuration
@return DL4J LayerConstraint
@see LayerConstraint | [
"Map",
"Keras",
"to",
"DL4J",
"constraint",
"."
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/utils/KerasConstraintUtils.java#L48-L79 |
ngageoint/geopackage-android-map | geopackage-map/src/main/java/mil/nga/geopackage/map/tiles/overlay/GeoPackageOverlayFactory.java | GeoPackageOverlayFactory.getLinkedFeatureOverlay | public static BoundedOverlay getLinkedFeatureOverlay(FeatureOverlay featureOverlay, GeoPackage geoPackage) {
BoundedOverlay overlay;
// Get the linked tile daos
FeatureTileTableLinker linker = new FeatureTileTableLinker(geoPackage);
List<TileDao> tileDaos = linker.getTileDaosForFeatureTable(featureOverlay.getFeatureTiles().getFeatureDao().getTableName());
if (!tileDaos.isEmpty()) {
// Create a composite overlay to search for existing tiles before drawing from features
overlay = getCompositeOverlay(tileDaos, featureOverlay);
} else {
overlay = featureOverlay;
}
return overlay;
} | java | public static BoundedOverlay getLinkedFeatureOverlay(FeatureOverlay featureOverlay, GeoPackage geoPackage) {
BoundedOverlay overlay;
// Get the linked tile daos
FeatureTileTableLinker linker = new FeatureTileTableLinker(geoPackage);
List<TileDao> tileDaos = linker.getTileDaosForFeatureTable(featureOverlay.getFeatureTiles().getFeatureDao().getTableName());
if (!tileDaos.isEmpty()) {
// Create a composite overlay to search for existing tiles before drawing from features
overlay = getCompositeOverlay(tileDaos, featureOverlay);
} else {
overlay = featureOverlay;
}
return overlay;
} | [
"public",
"static",
"BoundedOverlay",
"getLinkedFeatureOverlay",
"(",
"FeatureOverlay",
"featureOverlay",
",",
"GeoPackage",
"geoPackage",
")",
"{",
"BoundedOverlay",
"overlay",
";",
"// Get the linked tile daos",
"FeatureTileTableLinker",
"linker",
"=",
"new",
"FeatureTileTa... | Create a composite overlay linking the feature overly with
@param featureOverlay feature overlay
@param geoPackage GeoPackage
@return linked bounded overlay | [
"Create",
"a",
"composite",
"overlay",
"linking",
"the",
"feature",
"overly",
"with"
] | train | https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/tiles/overlay/GeoPackageOverlayFactory.java#L165-L181 |
alkacon/opencms-core | src/org/opencms/db/generic/CmsSqlManager.java | CmsSqlManager.getPreparedStatement | public PreparedStatement getPreparedStatement(Connection con, CmsUUID projectId, String queryKey)
throws SQLException {
String rawSql = readQuery(projectId, queryKey);
return getPreparedStatementForSql(con, rawSql);
} | java | public PreparedStatement getPreparedStatement(Connection con, CmsUUID projectId, String queryKey)
throws SQLException {
String rawSql = readQuery(projectId, queryKey);
return getPreparedStatementForSql(con, rawSql);
} | [
"public",
"PreparedStatement",
"getPreparedStatement",
"(",
"Connection",
"con",
",",
"CmsUUID",
"projectId",
",",
"String",
"queryKey",
")",
"throws",
"SQLException",
"{",
"String",
"rawSql",
"=",
"readQuery",
"(",
"projectId",
",",
"queryKey",
")",
";",
"return"... | Returns a PreparedStatement for a JDBC connection specified by the key of a SQL query
and the project-ID.<p>
@param con the JDBC connection
@param projectId the ID of the specified CmsProject
@param queryKey the key of the SQL query
@return PreparedStatement a new PreparedStatement containing the pre-compiled SQL statement
@throws SQLException if a database access error occurs | [
"Returns",
"a",
"PreparedStatement",
"for",
"a",
"JDBC",
"connection",
"specified",
"by",
"the",
"key",
"of",
"a",
"SQL",
"query",
"and",
"the",
"project",
"-",
"ID",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/generic/CmsSqlManager.java#L257-L262 |
GCRC/nunaliit | nunaliit2-couch-command/src/main/java/ca/carleton/gcrc/couch/command/impl/PathComputer.java | PathComputer.computeBinDir | static public File computeBinDir(File installDir) {
if( null != installDir ) {
// Command-line package
File binDir = new File(installDir, "bin");
if( binDir.exists() && binDir.isDirectory() ) {
return binDir;
}
// Development environment
File nunaliit2Dir = computeNunaliitDir(installDir);
binDir = new File(nunaliit2Dir, "nunaliit2-couch-sdk/target/appassembler/bin");
if( binDir.exists() && binDir.isDirectory() ) {
return binDir;
}
}
return null;
} | java | static public File computeBinDir(File installDir) {
if( null != installDir ) {
// Command-line package
File binDir = new File(installDir, "bin");
if( binDir.exists() && binDir.isDirectory() ) {
return binDir;
}
// Development environment
File nunaliit2Dir = computeNunaliitDir(installDir);
binDir = new File(nunaliit2Dir, "nunaliit2-couch-sdk/target/appassembler/bin");
if( binDir.exists() && binDir.isDirectory() ) {
return binDir;
}
}
return null;
} | [
"static",
"public",
"File",
"computeBinDir",
"(",
"File",
"installDir",
")",
"{",
"if",
"(",
"null",
"!=",
"installDir",
")",
"{",
"// Command-line package",
"File",
"binDir",
"=",
"new",
"File",
"(",
"installDir",
",",
"\"bin\"",
")",
";",
"if",
"(",
"bin... | Finds the "bin" directory from the installation location
and returns it. If the command-line tool is packaged and
deployed, then the "bin" directory is found at the
root of the installation. If the command-line tool is run
from the development environment, then the "bin" directory
is found in the SDK sub-project.
@param installDir Directory where the command-line tool is run from.
@return Directory where binaries are located or null if not found. | [
"Finds",
"the",
"bin",
"directory",
"from",
"the",
"installation",
"location",
"and",
"returns",
"it",
".",
"If",
"the",
"command",
"-",
"line",
"tool",
"is",
"packaged",
"and",
"deployed",
"then",
"the",
"bin",
"directory",
"is",
"found",
"at",
"the",
"ro... | train | https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-couch-command/src/main/java/ca/carleton/gcrc/couch/command/impl/PathComputer.java#L174-L191 |
ralscha/wampspring | src/main/java/ch/rasc/wampspring/EventMessenger.java | EventMessenger.sendToDirect | public void sendToDirect(String topicURI, Object event, String webSocketSessionId) {
Assert.notNull(webSocketSessionId, "WebSocket session id must not be null");
sendToDirect(topicURI, event, Collections.singleton(webSocketSessionId));
} | java | public void sendToDirect(String topicURI, Object event, String webSocketSessionId) {
Assert.notNull(webSocketSessionId, "WebSocket session id must not be null");
sendToDirect(topicURI, event, Collections.singleton(webSocketSessionId));
} | [
"public",
"void",
"sendToDirect",
"(",
"String",
"topicURI",
",",
"Object",
"event",
",",
"String",
"webSocketSessionId",
")",
"{",
"Assert",
".",
"notNull",
"(",
"webSocketSessionId",
",",
"\"WebSocket session id must not be null\"",
")",
";",
"sendToDirect",
"(",
... | Send an EventMessage directly to the client specified with the webSocketSessionId
parameter.
<p>
In contrast to {@link #sendTo(String, Object, String)} this method does not check
if the receiver is subscribed to the destination. The
{@link SimpleBrokerMessageHandler} is not involved in sending this message.
@param topicURI the name of the topic
@param event the payload of the {@link EventMessage}
@param webSocketSessionId receiver of the EVENT message | [
"Send",
"an",
"EventMessage",
"directly",
"to",
"the",
"client",
"specified",
"with",
"the",
"webSocketSessionId",
"parameter",
".",
"<p",
">",
"In",
"contrast",
"to",
"{",
"@link",
"#sendTo",
"(",
"String",
"Object",
"String",
")",
"}",
"this",
"method",
"d... | train | https://github.com/ralscha/wampspring/blob/7571bb6773b848c580b29890587eb35397bfe5b5/src/main/java/ch/rasc/wampspring/EventMessenger.java#L172-L176 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/ListFormatter.java | ListFormatter.getInstance | @Deprecated
public static ListFormatter getInstance(ULocale locale, Style style) {
return cache.get(locale, style.getName());
} | java | @Deprecated
public static ListFormatter getInstance(ULocale locale, Style style) {
return cache.get(locale, style.getName());
} | [
"@",
"Deprecated",
"public",
"static",
"ListFormatter",
"getInstance",
"(",
"ULocale",
"locale",
",",
"Style",
"style",
")",
"{",
"return",
"cache",
".",
"get",
"(",
"locale",
",",
"style",
".",
"getName",
"(",
")",
")",
";",
"}"
] | Create a list formatter that is appropriate for a locale and style.
@param locale the locale in question.
@param style the style
@return ListFormatter
@deprecated This API is ICU internal only.
@hide draft / provisional / internal are hidden on Android | [
"Create",
"a",
"list",
"formatter",
"that",
"is",
"appropriate",
"for",
"a",
"locale",
"and",
"style",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/ListFormatter.java#L164-L167 |
Azure/azure-sdk-for-java | mediaservices/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/implementation/AssetsInner.java | AssetsInner.listStreamingLocatorsAsync | public Observable<ListStreamingLocatorsResponseInner> listStreamingLocatorsAsync(String resourceGroupName, String accountName, String assetName) {
return listStreamingLocatorsWithServiceResponseAsync(resourceGroupName, accountName, assetName).map(new Func1<ServiceResponse<ListStreamingLocatorsResponseInner>, ListStreamingLocatorsResponseInner>() {
@Override
public ListStreamingLocatorsResponseInner call(ServiceResponse<ListStreamingLocatorsResponseInner> response) {
return response.body();
}
});
} | java | public Observable<ListStreamingLocatorsResponseInner> listStreamingLocatorsAsync(String resourceGroupName, String accountName, String assetName) {
return listStreamingLocatorsWithServiceResponseAsync(resourceGroupName, accountName, assetName).map(new Func1<ServiceResponse<ListStreamingLocatorsResponseInner>, ListStreamingLocatorsResponseInner>() {
@Override
public ListStreamingLocatorsResponseInner call(ServiceResponse<ListStreamingLocatorsResponseInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ListStreamingLocatorsResponseInner",
">",
"listStreamingLocatorsAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
",",
"String",
"assetName",
")",
"{",
"return",
"listStreamingLocatorsWithServiceResponseAsync",
"(",
"resou... | List Streaming Locators.
Lists Streaming Locators which are associated with this asset.
@param resourceGroupName The name of the resource group within the Azure subscription.
@param accountName The Media Services account name.
@param assetName The Asset name.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ListStreamingLocatorsResponseInner object | [
"List",
"Streaming",
"Locators",
".",
"Lists",
"Streaming",
"Locators",
"which",
"are",
"associated",
"with",
"this",
"asset",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mediaservices/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/implementation/AssetsInner.java#L1021-L1028 |
mgormley/prim | src/main/java_generated/edu/jhu/prim/vector/IntFloatDenseVector.java | IntFloatDenseVector.add | public void add(IntFloatVector other) {
if (other instanceof IntFloatUnsortedVector) {
IntFloatUnsortedVector vec = (IntFloatUnsortedVector) other;
for (int i=0; i<vec.top; i++) {
this.add(vec.idx[i], vec.vals[i]);
}
} else {
// TODO: Add special case for IntFloatDenseVector.
other.iterate(new SparseBinaryOpApplier(this, new Lambda.FloatAdd()));
}
} | java | public void add(IntFloatVector other) {
if (other instanceof IntFloatUnsortedVector) {
IntFloatUnsortedVector vec = (IntFloatUnsortedVector) other;
for (int i=0; i<vec.top; i++) {
this.add(vec.idx[i], vec.vals[i]);
}
} else {
// TODO: Add special case for IntFloatDenseVector.
other.iterate(new SparseBinaryOpApplier(this, new Lambda.FloatAdd()));
}
} | [
"public",
"void",
"add",
"(",
"IntFloatVector",
"other",
")",
"{",
"if",
"(",
"other",
"instanceof",
"IntFloatUnsortedVector",
")",
"{",
"IntFloatUnsortedVector",
"vec",
"=",
"(",
"IntFloatUnsortedVector",
")",
"other",
";",
"for",
"(",
"int",
"i",
"=",
"0",
... | Updates this vector to be the entrywise sum of this vector with the other. | [
"Updates",
"this",
"vector",
"to",
"be",
"the",
"entrywise",
"sum",
"of",
"this",
"vector",
"with",
"the",
"other",
"."
] | train | https://github.com/mgormley/prim/blob/5dce5e1ae94a9ae558a6262fc246e1a24f56686c/src/main/java_generated/edu/jhu/prim/vector/IntFloatDenseVector.java#L143-L153 |
xhsun/gw2wrapper | src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java | AsynchronousRequest.getCharacterBackStory | public void getCharacterBackStory(String API, String name, Callback<CharacterBackStory> callback) throws GuildWars2Exception, NullPointerException {
isParamValid(new ParamChecker(ParamType.API, API), new ParamChecker(ParamType.CHAR, name));
gw2API.getCharacterBackStory(name, API).enqueue(callback);
} | java | public void getCharacterBackStory(String API, String name, Callback<CharacterBackStory> callback) throws GuildWars2Exception, NullPointerException {
isParamValid(new ParamChecker(ParamType.API, API), new ParamChecker(ParamType.CHAR, name));
gw2API.getCharacterBackStory(name, API).enqueue(callback);
} | [
"public",
"void",
"getCharacterBackStory",
"(",
"String",
"API",
",",
"String",
"name",
",",
"Callback",
"<",
"CharacterBackStory",
">",
"callback",
")",
"throws",
"GuildWars2Exception",
",",
"NullPointerException",
"{",
"isParamValid",
"(",
"new",
"ParamChecker",
"... | For more info on character back story API go <a href="https://wiki.guildwars2.com/wiki/API:2/characters#Backstory">here</a><br/>
@param API API key
@param name name of character
@param callback callback that is going to be used for {@link Call#enqueue(Callback)}
@throws GuildWars2Exception invalid API key | empty character name
@throws NullPointerException if given {@link Callback} is empty
@see CharacterBackStory back store answer info | [
"For",
"more",
"info",
"on",
"character",
"back",
"story",
"API",
"go",
"<a",
"href",
"=",
"https",
":",
"//",
"wiki",
".",
"guildwars2",
".",
"com",
"/",
"wiki",
"/",
"API",
":",
"2",
"/",
"characters#Backstory",
">",
"here<",
"/",
"a",
">",
"<br",
... | train | https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java#L705-L708 |
Impetus/Kundera | src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/thrift/ThriftClient.java | ThriftClient.indexNode | @Override
protected void indexNode(Node node, EntityMetadata entityMetadata)
{
super.indexNode(node, entityMetadata);
// Write to inverted index table if applicable
invertedIndexHandler.write(node, entityMetadata, getPersistenceUnit(), getConsistencyLevel(), dataHandler);
} | java | @Override
protected void indexNode(Node node, EntityMetadata entityMetadata)
{
super.indexNode(node, entityMetadata);
// Write to inverted index table if applicable
invertedIndexHandler.write(node, entityMetadata, getPersistenceUnit(), getConsistencyLevel(), dataHandler);
} | [
"@",
"Override",
"protected",
"void",
"indexNode",
"(",
"Node",
"node",
",",
"EntityMetadata",
"entityMetadata",
")",
"{",
"super",
".",
"indexNode",
"(",
"node",
",",
"entityMetadata",
")",
";",
"// Write to inverted index table if applicable",
"invertedIndexHandler",
... | Indexes a {@link Node} to database.
@param node
the node
@param entityMetadata
the entity metadata | [
"Indexes",
"a",
"{",
"@link",
"Node",
"}",
"to",
"database",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/thrift/ThriftClient.java#L329-L336 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/NodeSetDTM.java | NodeSetDTM.setItem | public void setItem(int node, int index)
{
if (!m_mutable)
throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESETDTM_NOT_MUTABLE, null)); //"This NodeSetDTM is not mutable!");
super.setElementAt(node, index);
} | java | public void setItem(int node, int index)
{
if (!m_mutable)
throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESETDTM_NOT_MUTABLE, null)); //"This NodeSetDTM is not mutable!");
super.setElementAt(node, index);
} | [
"public",
"void",
"setItem",
"(",
"int",
"node",
",",
"int",
"index",
")",
"{",
"if",
"(",
"!",
"m_mutable",
")",
"throw",
"new",
"RuntimeException",
"(",
"XSLMessages",
".",
"createXPATHMessage",
"(",
"XPATHErrorResources",
".",
"ER_NODESETDTM_NOT_MUTABLE",
","... | Same as setElementAt.
@param node The node to be set.
@param index The index of the node to be replaced.
@throws RuntimeException thrown if this NodeSetDTM is not of
a mutable type. | [
"Same",
"as",
"setElementAt",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/NodeSetDTM.java#L1025-L1032 |
NoraUi/NoraUi | src/main/java/com/github/noraui/application/steps/Step.java | Step.clickOn | protected void clickOn(PageElement toClick, Object... args) throws TechnicalException, FailureException {
displayMessageAtTheBeginningOfMethod("clickOn: %s in %s", toClick.toString(), toClick.getPage().getApplication());
try {
Context.waitUntil(ExpectedConditions.elementToBeClickable(Utilities.getLocator(toClick, args))).click();
} catch (final Exception e) {
new Result.Failure<>(e.getMessage(), Messages.format(Messages.getMessage(Messages.FAIL_MESSAGE_UNABLE_TO_OPEN_ON_CLICK), toClick, toClick.getPage().getApplication()), true,
toClick.getPage().getCallBack());
}
} | java | protected void clickOn(PageElement toClick, Object... args) throws TechnicalException, FailureException {
displayMessageAtTheBeginningOfMethod("clickOn: %s in %s", toClick.toString(), toClick.getPage().getApplication());
try {
Context.waitUntil(ExpectedConditions.elementToBeClickable(Utilities.getLocator(toClick, args))).click();
} catch (final Exception e) {
new Result.Failure<>(e.getMessage(), Messages.format(Messages.getMessage(Messages.FAIL_MESSAGE_UNABLE_TO_OPEN_ON_CLICK), toClick, toClick.getPage().getApplication()), true,
toClick.getPage().getCallBack());
}
} | [
"protected",
"void",
"clickOn",
"(",
"PageElement",
"toClick",
",",
"Object",
"...",
"args",
")",
"throws",
"TechnicalException",
",",
"FailureException",
"{",
"displayMessageAtTheBeginningOfMethod",
"(",
"\"clickOn: %s in %s\"",
",",
"toClick",
".",
"toString",
"(",
... | Click on html element.
@param toClick
html element
@param args
list of arguments to format the found selector with
@throws TechnicalException
is thrown if you have a technical error (format, configuration, datas, ...) in NoraUi.
Exception with {@value com.github.noraui.utils.Messages#FAIL_MESSAGE_UNABLE_TO_OPEN_ON_CLICK} message (with screenshot, with exception)
@throws FailureException
if the scenario encounters a functional error | [
"Click",
"on",
"html",
"element",
"."
] | train | https://github.com/NoraUi/NoraUi/blob/5f491a3339c7d3c20d7207760bdaf2acdb8f260c/src/main/java/com/github/noraui/application/steps/Step.java#L113-L121 |
aspectran/aspectran | core/src/main/java/com/aspectran/core/util/StringUtils.java | StringUtils.parseLocaleString | public static Locale parseLocaleString(String localeString) {
String[] parts = tokenize(localeString, "_ ", false);
String language = (parts.length > 0 ? parts[0] : EMPTY);
String country = (parts.length > 1 ? parts[1] : EMPTY);
validateLocalePart(language);
validateLocalePart(country);
String variant = EMPTY;
if (parts.length > 2) {
// There is definitely a variant, and it is everything after the country
// code sans the separator between the country code and the variant.
int endIndexOfCountryCode = localeString.indexOf(country, language.length()) + country.length();
// Strip off any leading '_' and whitespace, what's left is the variant.
variant = trimLeadingWhitespace(localeString.substring(endIndexOfCountryCode));
if (variant.startsWith("_")) {
variant = trimLeadingCharacter(variant, '_');
}
}
return (language.length() > 0 ? new Locale(language, country, variant) : null);
} | java | public static Locale parseLocaleString(String localeString) {
String[] parts = tokenize(localeString, "_ ", false);
String language = (parts.length > 0 ? parts[0] : EMPTY);
String country = (parts.length > 1 ? parts[1] : EMPTY);
validateLocalePart(language);
validateLocalePart(country);
String variant = EMPTY;
if (parts.length > 2) {
// There is definitely a variant, and it is everything after the country
// code sans the separator between the country code and the variant.
int endIndexOfCountryCode = localeString.indexOf(country, language.length()) + country.length();
// Strip off any leading '_' and whitespace, what's left is the variant.
variant = trimLeadingWhitespace(localeString.substring(endIndexOfCountryCode));
if (variant.startsWith("_")) {
variant = trimLeadingCharacter(variant, '_');
}
}
return (language.length() > 0 ? new Locale(language, country, variant) : null);
} | [
"public",
"static",
"Locale",
"parseLocaleString",
"(",
"String",
"localeString",
")",
"{",
"String",
"[",
"]",
"parts",
"=",
"tokenize",
"(",
"localeString",
",",
"\"_ \"",
",",
"false",
")",
";",
"String",
"language",
"=",
"(",
"parts",
".",
"length",
">... | Parse the given {@code localeString} value into a {@link Locale}.
<p>This is the inverse operation of {@link Locale#toString Locale's toString}.
@param localeString the locale {@code String}, following {@code Locale's}
{@code toString()} format ("en", "en_UK", etc);
also accepts spaces as separators, as an alternative to underscores
@return a corresponding {@code Locale} instance
@throws IllegalArgumentException in case of an invalid locale specification | [
"Parse",
"the",
"given",
"{",
"@code",
"localeString",
"}",
"value",
"into",
"a",
"{",
"@link",
"Locale",
"}",
".",
"<p",
">",
"This",
"is",
"the",
"inverse",
"operation",
"of",
"{",
"@link",
"Locale#toString",
"Locale",
"s",
"toString",
"}",
"."
] | train | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/util/StringUtils.java#L747-L765 |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/shapes/ellipse/BinaryEllipseDetector.java | BinaryEllipseDetector.setLensDistortion | public void setLensDistortion(PixelTransform<Point2D_F32> distToUndist , PixelTransform<Point2D_F32> undistToDist ) {
this.ellipseDetector.setLensDistortion(distToUndist);
if( this.ellipseRefiner != null )
this.ellipseRefiner.setTransform(undistToDist);
this.intensityCheck.setTransform(undistToDist);
} | java | public void setLensDistortion(PixelTransform<Point2D_F32> distToUndist , PixelTransform<Point2D_F32> undistToDist ) {
this.ellipseDetector.setLensDistortion(distToUndist);
if( this.ellipseRefiner != null )
this.ellipseRefiner.setTransform(undistToDist);
this.intensityCheck.setTransform(undistToDist);
} | [
"public",
"void",
"setLensDistortion",
"(",
"PixelTransform",
"<",
"Point2D_F32",
">",
"distToUndist",
",",
"PixelTransform",
"<",
"Point2D_F32",
">",
"undistToDist",
")",
"{",
"this",
".",
"ellipseDetector",
".",
"setLensDistortion",
"(",
"distToUndist",
")",
";",
... | <p>Specifies transforms which can be used to change coordinates from distorted to undistorted.
The undistorted image is never explicitly created.</p>
<p>
WARNING: The undistorted image must have the same bounds as the distorted input image. This is because
several of the bounds checks use the image shape. This are simplified greatly by this assumption.
</p>
@param distToUndist Transform from distorted to undistorted image.
@param undistToDist Transform from undistorted to distorted image. | [
"<p",
">",
"Specifies",
"transforms",
"which",
"can",
"be",
"used",
"to",
"change",
"coordinates",
"from",
"distorted",
"to",
"undistorted",
".",
"The",
"undistorted",
"image",
"is",
"never",
"explicitly",
"created",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/shapes/ellipse/BinaryEllipseDetector.java#L87-L92 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.