repository_name stringlengths 7 58 | func_path_in_repository stringlengths 11 218 | func_name stringlengths 4 140 | whole_func_string stringlengths 153 5.32k | language stringclasses 1
value | func_code_string stringlengths 72 4k | func_code_tokens listlengths 20 832 | func_documentation_string stringlengths 61 2k | func_documentation_tokens listlengths 1 647 | split_name stringclasses 1
value | func_code_url stringlengths 102 339 |
|---|---|---|---|---|---|---|---|---|---|---|
apache/incubator-gobblin | gobblin-hive-registration/src/main/java/org/apache/gobblin/hive/HiveSerDeWrapper.java | HiveSerDeWrapper.getSerDe | public SerDe getSerDe() throws IOException {
"""
Get the {@link SerDe} instance associated with this {@link HiveSerDeWrapper}.
This method performs lazy initialization.
"""
if (!this.serDe.isPresent()) {
try {
this.serDe = Optional.of(SerDe.class.cast(Class.forName(this.serDeClassName).newInstance()));
} catch (Throwable t) {
throw new IOException("Failed to instantiate SerDe " + this.serDeClassName, t);
}
}
return this.serDe.get();
} | java | public SerDe getSerDe() throws IOException {
if (!this.serDe.isPresent()) {
try {
this.serDe = Optional.of(SerDe.class.cast(Class.forName(this.serDeClassName).newInstance()));
} catch (Throwable t) {
throw new IOException("Failed to instantiate SerDe " + this.serDeClassName, t);
}
}
return this.serDe.get();
} | [
"public",
"SerDe",
"getSerDe",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"this",
".",
"serDe",
".",
"isPresent",
"(",
")",
")",
"{",
"try",
"{",
"this",
".",
"serDe",
"=",
"Optional",
".",
"of",
"(",
"SerDe",
".",
"class",
".",
"cast"... | Get the {@link SerDe} instance associated with this {@link HiveSerDeWrapper}.
This method performs lazy initialization. | [
"Get",
"the",
"{"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-hive-registration/src/main/java/org/apache/gobblin/hive/HiveSerDeWrapper.java#L110-L119 |
lievendoclo/Valkyrie-RCP | valkyrie-rcp-core/src/main/java/org/valkyriercp/application/config/support/UIManagerConfigurer.java | UIManagerConfigurer.installPrePackagedUIManagerDefaults | private void installPrePackagedUIManagerDefaults() {
"""
Initializes the UIManager defaults to values based on recommended,
best-practices user interface design. This should generally be called
once by an initializing application class.
"""
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
UIManager.put("Tree.line", "Angled");
UIManager.put("Tree.leafIcon", null);
UIManager.put("Tree.closedIcon", null);
UIManager.put("Tree.openIcon", null);
UIManager.put("Tree.rightChildIndent", new Integer(10));
} catch (Exception e) {
throw new ApplicationException("Unable to set defaults", e);
}
} | java | private void installPrePackagedUIManagerDefaults() {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
UIManager.put("Tree.line", "Angled");
UIManager.put("Tree.leafIcon", null);
UIManager.put("Tree.closedIcon", null);
UIManager.put("Tree.openIcon", null);
UIManager.put("Tree.rightChildIndent", new Integer(10));
} catch (Exception e) {
throw new ApplicationException("Unable to set defaults", e);
}
} | [
"private",
"void",
"installPrePackagedUIManagerDefaults",
"(",
")",
"{",
"try",
"{",
"UIManager",
".",
"setLookAndFeel",
"(",
"UIManager",
".",
"getSystemLookAndFeelClassName",
"(",
")",
")",
";",
"UIManager",
".",
"put",
"(",
"\"Tree.line\"",
",",
"\"Angled\"",
"... | Initializes the UIManager defaults to values based on recommended,
best-practices user interface design. This should generally be called
once by an initializing application class. | [
"Initializes",
"the",
"UIManager",
"defaults",
"to",
"values",
"based",
"on",
"recommended",
"best",
"-",
"practices",
"user",
"interface",
"design",
".",
"This",
"should",
"generally",
"be",
"called",
"once",
"by",
"an",
"initializing",
"application",
"class",
... | train | https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/application/config/support/UIManagerConfigurer.java#L82-L93 |
SeleniumHQ/selenium | java/server/src/org/openqa/selenium/remote/server/log/PerSessionLogHandler.java | PerSessionLogHandler.fetchAndStoreLogsFromDriver | public synchronized void fetchAndStoreLogsFromDriver(SessionId sessionId, WebDriver driver)
throws IOException {
"""
Fetches and stores available logs from the given session and driver.
@param sessionId The id of the session.
@param driver The driver to get the logs from.
@throws IOException If there was a problem reading from file.
"""
if (!perSessionDriverEntries.containsKey(sessionId)) {
perSessionDriverEntries.put(sessionId, new HashMap<>());
}
Map<String, LogEntries> typeToEntriesMap = perSessionDriverEntries.get(sessionId);
if (storeLogsOnSessionQuit) {
typeToEntriesMap.put(LogType.SERVER, getSessionLog(sessionId));
Set<String> logTypeSet = driver.manage().logs().getAvailableLogTypes();
for (String logType : logTypeSet) {
typeToEntriesMap.put(logType, driver.manage().logs().get(logType));
}
}
} | java | public synchronized void fetchAndStoreLogsFromDriver(SessionId sessionId, WebDriver driver)
throws IOException {
if (!perSessionDriverEntries.containsKey(sessionId)) {
perSessionDriverEntries.put(sessionId, new HashMap<>());
}
Map<String, LogEntries> typeToEntriesMap = perSessionDriverEntries.get(sessionId);
if (storeLogsOnSessionQuit) {
typeToEntriesMap.put(LogType.SERVER, getSessionLog(sessionId));
Set<String> logTypeSet = driver.manage().logs().getAvailableLogTypes();
for (String logType : logTypeSet) {
typeToEntriesMap.put(logType, driver.manage().logs().get(logType));
}
}
} | [
"public",
"synchronized",
"void",
"fetchAndStoreLogsFromDriver",
"(",
"SessionId",
"sessionId",
",",
"WebDriver",
"driver",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"perSessionDriverEntries",
".",
"containsKey",
"(",
"sessionId",
")",
")",
"{",
"perSession... | Fetches and stores available logs from the given session and driver.
@param sessionId The id of the session.
@param driver The driver to get the logs from.
@throws IOException If there was a problem reading from file. | [
"Fetches",
"and",
"stores",
"available",
"logs",
"from",
"the",
"given",
"session",
"and",
"driver",
"."
] | train | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/server/src/org/openqa/selenium/remote/server/log/PerSessionLogHandler.java#L236-L249 |
icode/ameba | src/main/java/ameba/db/ebean/internal/ModelInterceptor.java | ModelInterceptor.applyRowCountHeader | public static void applyRowCountHeader(MultivaluedMap<String, Object> headerParams, Query query, FutureRowCount rowCount) {
"""
<p>applyRowCountHeader.</p>
@param headerParams a {@link javax.ws.rs.core.MultivaluedMap} object.
@param query a {@link io.ebean.Query} object.
@param rowCount a {@link io.ebean.FutureRowCount} object.
"""
if (rowCount != null) {
try {
headerParams.putSingle(REQ_TOTAL_COUNT_HEADER_NAME, rowCount.get());
} catch (InterruptedException | ExecutionException e) {
headerParams.putSingle(REQ_TOTAL_COUNT_HEADER_NAME, query.findCount());
}
}
} | java | public static void applyRowCountHeader(MultivaluedMap<String, Object> headerParams, Query query, FutureRowCount rowCount) {
if (rowCount != null) {
try {
headerParams.putSingle(REQ_TOTAL_COUNT_HEADER_NAME, rowCount.get());
} catch (InterruptedException | ExecutionException e) {
headerParams.putSingle(REQ_TOTAL_COUNT_HEADER_NAME, query.findCount());
}
}
} | [
"public",
"static",
"void",
"applyRowCountHeader",
"(",
"MultivaluedMap",
"<",
"String",
",",
"Object",
">",
"headerParams",
",",
"Query",
"query",
",",
"FutureRowCount",
"rowCount",
")",
"{",
"if",
"(",
"rowCount",
"!=",
"null",
")",
"{",
"try",
"{",
"heade... | <p>applyRowCountHeader.</p>
@param headerParams a {@link javax.ws.rs.core.MultivaluedMap} object.
@param query a {@link io.ebean.Query} object.
@param rowCount a {@link io.ebean.FutureRowCount} object. | [
"<p",
">",
"applyRowCountHeader",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/icode/ameba/blob/9d4956e935898e41331b2745e400ef869cd265e0/src/main/java/ameba/db/ebean/internal/ModelInterceptor.java#L390-L398 |
vanniktech/Emoji | emoji/src/main/java/com/vanniktech/emoji/EmojiUtils.java | EmojiUtils.emojiInformation | @NonNull public static EmojiInformation emojiInformation(@Nullable final String text) {
"""
returns a class that contains all of the emoji information that was found in the given text
"""
final List<EmojiRange> emojis = EmojiManager.getInstance().findAllEmojis(text);
final boolean isOnlyEmojis = isOnlyEmojis(text);
return new EmojiInformation(isOnlyEmojis, emojis);
} | java | @NonNull public static EmojiInformation emojiInformation(@Nullable final String text) {
final List<EmojiRange> emojis = EmojiManager.getInstance().findAllEmojis(text);
final boolean isOnlyEmojis = isOnlyEmojis(text);
return new EmojiInformation(isOnlyEmojis, emojis);
} | [
"@",
"NonNull",
"public",
"static",
"EmojiInformation",
"emojiInformation",
"(",
"@",
"Nullable",
"final",
"String",
"text",
")",
"{",
"final",
"List",
"<",
"EmojiRange",
">",
"emojis",
"=",
"EmojiManager",
".",
"getInstance",
"(",
")",
".",
"findAllEmojis",
"... | returns a class that contains all of the emoji information that was found in the given text | [
"returns",
"a",
"class",
"that",
"contains",
"all",
"of",
"the",
"emoji",
"information",
"that",
"was",
"found",
"in",
"the",
"given",
"text"
] | train | https://github.com/vanniktech/Emoji/blob/6d53773c1e018a4d19065b9dc1092de4308dd6f3/emoji/src/main/java/com/vanniktech/emoji/EmojiUtils.java#L39-L43 |
Deep-Symmetry/beat-link | src/main/java/org/deepsymmetry/beatlink/data/TimeFinder.java | TimeFinder.addTrackPositionListener | public void addTrackPositionListener(int player, TrackPositionListener listener) {
"""
Add a listener that wants to closely follow track playback for a particular player. The listener will be called
as soon as there is an initial {@link TrackPositionUpdate} for the specified player, and whenever there is an
unexpected change in playback position, speed, or state on that player.
@param player the player number that the listener is interested in
@param listener the interface that will be called when there are changes in track playback on the player
"""
listenerPlayerNumbers.put(listener, player);
TrackPositionUpdate currentPosition = positions.get(player);
if (currentPosition != null) {
listener.movementChanged(currentPosition);
trackPositionListeners.put(listener, currentPosition);
} else {
trackPositionListeners.put(listener, NO_INFORMATION);
}
} | java | public void addTrackPositionListener(int player, TrackPositionListener listener) {
listenerPlayerNumbers.put(listener, player);
TrackPositionUpdate currentPosition = positions.get(player);
if (currentPosition != null) {
listener.movementChanged(currentPosition);
trackPositionListeners.put(listener, currentPosition);
} else {
trackPositionListeners.put(listener, NO_INFORMATION);
}
} | [
"public",
"void",
"addTrackPositionListener",
"(",
"int",
"player",
",",
"TrackPositionListener",
"listener",
")",
"{",
"listenerPlayerNumbers",
".",
"put",
"(",
"listener",
",",
"player",
")",
";",
"TrackPositionUpdate",
"currentPosition",
"=",
"positions",
".",
"g... | Add a listener that wants to closely follow track playback for a particular player. The listener will be called
as soon as there is an initial {@link TrackPositionUpdate} for the specified player, and whenever there is an
unexpected change in playback position, speed, or state on that player.
@param player the player number that the listener is interested in
@param listener the interface that will be called when there are changes in track playback on the player | [
"Add",
"a",
"listener",
"that",
"wants",
"to",
"closely",
"follow",
"track",
"playback",
"for",
"a",
"particular",
"player",
".",
"The",
"listener",
"will",
"be",
"called",
"as",
"soon",
"as",
"there",
"is",
"an",
"initial",
"{",
"@link",
"TrackPositionUpdat... | train | https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/TimeFinder.java#L302-L311 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/thread/RemoteRecordOwner.java | RemoteRecordOwner.handleRemoteCommand | public Object handleRemoteCommand(String strCommand, Map<String,Object> properties, Object sourceSession) throws RemoteException, DBException {
"""
Process the command.
Step 1 - Process the command if possible and return true if processed.
Step 2 - If I can't process, pass to all children (with me as the source).
Step 3 - If children didn't process, pass to parent (with me as the source).
Note: Never pass to a parent or child that matches the source (to avoid an endless loop).
@param strCommand The command to process.
@param sourceSField The source screen field (to avoid echos).
@param bUseSameWindow If this command creates a new screen, create in a new window?
@return true if success.
"""
if (m_sessionObjectParent != null)
if (m_sessionObjectParent != sourceSession)
return ((RemoteRecordOwner)m_sessionObjectParent).handleRemoteCommand(strCommand, properties, this);
return Boolean.FALSE;
} | java | public Object handleRemoteCommand(String strCommand, Map<String,Object> properties, Object sourceSession) throws RemoteException, DBException
{
if (m_sessionObjectParent != null)
if (m_sessionObjectParent != sourceSession)
return ((RemoteRecordOwner)m_sessionObjectParent).handleRemoteCommand(strCommand, properties, this);
return Boolean.FALSE;
} | [
"public",
"Object",
"handleRemoteCommand",
"(",
"String",
"strCommand",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
",",
"Object",
"sourceSession",
")",
"throws",
"RemoteException",
",",
"DBException",
"{",
"if",
"(",
"m_sessionObjectParent",
"!="... | Process the command.
Step 1 - Process the command if possible and return true if processed.
Step 2 - If I can't process, pass to all children (with me as the source).
Step 3 - If children didn't process, pass to parent (with me as the source).
Note: Never pass to a parent or child that matches the source (to avoid an endless loop).
@param strCommand The command to process.
@param sourceSField The source screen field (to avoid echos).
@param bUseSameWindow If this command creates a new screen, create in a new window?
@return true if success. | [
"Process",
"the",
"command",
".",
"Step",
"1",
"-",
"Process",
"the",
"command",
"if",
"possible",
"and",
"return",
"true",
"if",
"processed",
".",
"Step",
"2",
"-",
"If",
"I",
"can",
"t",
"process",
"pass",
"to",
"all",
"children",
"(",
"with",
"me",
... | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/thread/RemoteRecordOwner.java#L473-L479 |
Alluxio/alluxio | core/server/common/src/main/java/alluxio/master/journal/JournalUtils.java | JournalUtils.writeToCheckpoint | public static void writeToCheckpoint(OutputStream output, List<? extends Checkpointed> components)
throws IOException, InterruptedException {
"""
Writes a composite checkpoint for the given checkpointed components.
This is the complement of {@link #restoreFromCheckpoint(CheckpointInputStream, List)}.
@param output the stream to write to
@param components the components to checkpoint
"""
OutputChunked chunked = new OutputChunked(
new CheckpointOutputStream(output, CheckpointType.COMPOUND), 64 * Constants.KB);
for (Checkpointed component : components) {
chunked.writeString(component.getCheckpointName().toString());
component.writeToCheckpoint(chunked);
chunked.endChunks();
}
chunked.flush();
} | java | public static void writeToCheckpoint(OutputStream output, List<? extends Checkpointed> components)
throws IOException, InterruptedException {
OutputChunked chunked = new OutputChunked(
new CheckpointOutputStream(output, CheckpointType.COMPOUND), 64 * Constants.KB);
for (Checkpointed component : components) {
chunked.writeString(component.getCheckpointName().toString());
component.writeToCheckpoint(chunked);
chunked.endChunks();
}
chunked.flush();
} | [
"public",
"static",
"void",
"writeToCheckpoint",
"(",
"OutputStream",
"output",
",",
"List",
"<",
"?",
"extends",
"Checkpointed",
">",
"components",
")",
"throws",
"IOException",
",",
"InterruptedException",
"{",
"OutputChunked",
"chunked",
"=",
"new",
"OutputChunke... | Writes a composite checkpoint for the given checkpointed components.
This is the complement of {@link #restoreFromCheckpoint(CheckpointInputStream, List)}.
@param output the stream to write to
@param components the components to checkpoint | [
"Writes",
"a",
"composite",
"checkpoint",
"for",
"the",
"given",
"checkpointed",
"components",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/common/src/main/java/alluxio/master/journal/JournalUtils.java#L124-L134 |
opsgenie/opsgenieclient | sdk-swagger/src/main/java/com/ifountain/opsgenie/client/swagger/ApiClient.java | ApiClient.invokeAPI | public <T> T invokeAPI(String path, String method, List<Pair> queryParams, Object body, Map<String, String> headerParams, Map<String, Object> formParams, String accept, String contentType, String[] authNames, GenericType<T> returnType) throws ApiException {
"""
Invoke API by sending HTTP request with the given options.
@param <T> Type
@param path The sub-path of the HTTP URL
@param method The request method, one of "GET", "POST", "PUT", and "DELETE"
@param queryParams The query parameters
@param body The request body object - if it is not binary, otherwise null
@param headerParams The header parameters
@param formParams The form parameters
@param accept The request's Accept header
@param contentType The request's Content-Type header
@param authNames The authentications to apply
@param returnType Return type
@return The response body in type of string
@throws ApiException API exception
"""
ClientResponse response = getAPIResponse(path, method, queryParams, body, headerParams, formParams, accept, contentType, authNames);
statusCode = response.getStatusInfo().getStatusCode();
responseHeaders = response.getHeaders();
if (response.getStatusInfo().getStatusCode() == ClientResponse.Status.NO_CONTENT.getStatusCode()) {
return null;
} else if (response.getStatusInfo().getFamily() == Family.SUCCESSFUL) {
if (returnType == null)
return null;
else
return response.getEntity(returnType);
} else {
String message = "error";
String respBody = null;
if (response.hasEntity()) {
try {
respBody = response.getEntity(String.class);
message = respBody;
} catch (RuntimeException e) {
// e.printStackTrace();
}
}
throw new ApiException(
response.getStatusInfo().getStatusCode(),
message,
response.getHeaders(),
respBody);
}
} | java | public <T> T invokeAPI(String path, String method, List<Pair> queryParams, Object body, Map<String, String> headerParams, Map<String, Object> formParams, String accept, String contentType, String[] authNames, GenericType<T> returnType) throws ApiException {
ClientResponse response = getAPIResponse(path, method, queryParams, body, headerParams, formParams, accept, contentType, authNames);
statusCode = response.getStatusInfo().getStatusCode();
responseHeaders = response.getHeaders();
if (response.getStatusInfo().getStatusCode() == ClientResponse.Status.NO_CONTENT.getStatusCode()) {
return null;
} else if (response.getStatusInfo().getFamily() == Family.SUCCESSFUL) {
if (returnType == null)
return null;
else
return response.getEntity(returnType);
} else {
String message = "error";
String respBody = null;
if (response.hasEntity()) {
try {
respBody = response.getEntity(String.class);
message = respBody;
} catch (RuntimeException e) {
// e.printStackTrace();
}
}
throw new ApiException(
response.getStatusInfo().getStatusCode(),
message,
response.getHeaders(),
respBody);
}
} | [
"public",
"<",
"T",
">",
"T",
"invokeAPI",
"(",
"String",
"path",
",",
"String",
"method",
",",
"List",
"<",
"Pair",
">",
"queryParams",
",",
"Object",
"body",
",",
"Map",
"<",
"String",
",",
"String",
">",
"headerParams",
",",
"Map",
"<",
"String",
... | Invoke API by sending HTTP request with the given options.
@param <T> Type
@param path The sub-path of the HTTP URL
@param method The request method, one of "GET", "POST", "PUT", and "DELETE"
@param queryParams The query parameters
@param body The request body object - if it is not binary, otherwise null
@param headerParams The header parameters
@param formParams The form parameters
@param accept The request's Accept header
@param contentType The request's Content-Type header
@param authNames The authentications to apply
@param returnType Return type
@return The response body in type of string
@throws ApiException API exception | [
"Invoke",
"API",
"by",
"sending",
"HTTP",
"request",
"with",
"the",
"given",
"options",
"."
] | train | https://github.com/opsgenie/opsgenieclient/blob/6d94efb16bbc74be189c86e9329af510ac8a048c/sdk-swagger/src/main/java/com/ifountain/opsgenie/client/swagger/ApiClient.java#L653-L684 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateFormat.java | DateFormat.getInstanceForSkeleton | public final static DateFormat getInstanceForSkeleton(String skeleton, ULocale locale) {
"""
<strong>[icu]</strong> Returns a {@link DateFormat} object that can be used to format dates and times in
the given locale.
@param skeleton The skeleton that selects the fields to be formatted. (Uses the
{@link DateTimePatternGenerator}.) This can be {@link DateFormat#ABBR_MONTH},
{@link DateFormat#MONTH_WEEKDAY_DAY}, etc.
@param locale The locale for which the date/time format is desired.
"""
DateTimePatternGenerator generator = DateTimePatternGenerator.getInstance(locale);
final String bestPattern = generator.getBestPattern(skeleton);
return new SimpleDateFormat(bestPattern, locale);
} | java | public final static DateFormat getInstanceForSkeleton(String skeleton, ULocale locale) {
DateTimePatternGenerator generator = DateTimePatternGenerator.getInstance(locale);
final String bestPattern = generator.getBestPattern(skeleton);
return new SimpleDateFormat(bestPattern, locale);
} | [
"public",
"final",
"static",
"DateFormat",
"getInstanceForSkeleton",
"(",
"String",
"skeleton",
",",
"ULocale",
"locale",
")",
"{",
"DateTimePatternGenerator",
"generator",
"=",
"DateTimePatternGenerator",
".",
"getInstance",
"(",
"locale",
")",
";",
"final",
"String"... | <strong>[icu]</strong> Returns a {@link DateFormat} object that can be used to format dates and times in
the given locale.
@param skeleton The skeleton that selects the fields to be formatted. (Uses the
{@link DateTimePatternGenerator}.) This can be {@link DateFormat#ABBR_MONTH},
{@link DateFormat#MONTH_WEEKDAY_DAY}, etc.
@param locale The locale for which the date/time format is desired. | [
"<strong",
">",
"[",
"icu",
"]",
"<",
"/",
"strong",
">",
"Returns",
"a",
"{",
"@link",
"DateFormat",
"}",
"object",
"that",
"can",
"be",
"used",
"to",
"format",
"dates",
"and",
"times",
"in",
"the",
"given",
"locale",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateFormat.java#L1977-L1981 |
micronaut-projects/micronaut-core | inject-java/src/main/java/io/micronaut/annotation/processing/JavaAnnotationMetadataBuilder.java | JavaAnnotationMetadataBuilder.hasAnnotation | public static boolean hasAnnotation(ExecutableElement method, Class<? extends Annotation> ann) {
"""
Checks if a method has an annotation.
@param method The method
@param ann The annotation to look for
@return Whether if the method has the annotation
"""
List<? extends AnnotationMirror> annotationMirrors = method.getAnnotationMirrors();
for (AnnotationMirror annotationMirror : annotationMirrors) {
if (annotationMirror.getAnnotationType().toString().equals(ann.getName())) {
return true;
}
}
return false;
} | java | public static boolean hasAnnotation(ExecutableElement method, Class<? extends Annotation> ann) {
List<? extends AnnotationMirror> annotationMirrors = method.getAnnotationMirrors();
for (AnnotationMirror annotationMirror : annotationMirrors) {
if (annotationMirror.getAnnotationType().toString().equals(ann.getName())) {
return true;
}
}
return false;
} | [
"public",
"static",
"boolean",
"hasAnnotation",
"(",
"ExecutableElement",
"method",
",",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"ann",
")",
"{",
"List",
"<",
"?",
"extends",
"AnnotationMirror",
">",
"annotationMirrors",
"=",
"method",
".",
"getAnnotati... | Checks if a method has an annotation.
@param method The method
@param ann The annotation to look for
@return Whether if the method has the annotation | [
"Checks",
"if",
"a",
"method",
"has",
"an",
"annotation",
"."
] | train | https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/inject-java/src/main/java/io/micronaut/annotation/processing/JavaAnnotationMetadataBuilder.java#L422-L430 |
voldemort/voldemort | src/java/voldemort/utils/RebalanceUtils.java | RebalanceUtils.validateClusterZonesSame | public static void validateClusterZonesSame(final Cluster lhs, final Cluster rhs) {
"""
Confirms that both clusters have the same set of zones defined.
@param lhs
@param rhs
"""
Set<Zone> lhsSet = new HashSet<Zone>(lhs.getZones());
Set<Zone> rhsSet = new HashSet<Zone>(rhs.getZones());
if(!lhsSet.equals(rhsSet))
throw new VoldemortException("Zones are not the same [ lhs cluster zones ("
+ lhs.getZones() + ") not equal to rhs cluster zones ("
+ rhs.getZones() + ") ]");
} | java | public static void validateClusterZonesSame(final Cluster lhs, final Cluster rhs) {
Set<Zone> lhsSet = new HashSet<Zone>(lhs.getZones());
Set<Zone> rhsSet = new HashSet<Zone>(rhs.getZones());
if(!lhsSet.equals(rhsSet))
throw new VoldemortException("Zones are not the same [ lhs cluster zones ("
+ lhs.getZones() + ") not equal to rhs cluster zones ("
+ rhs.getZones() + ") ]");
} | [
"public",
"static",
"void",
"validateClusterZonesSame",
"(",
"final",
"Cluster",
"lhs",
",",
"final",
"Cluster",
"rhs",
")",
"{",
"Set",
"<",
"Zone",
">",
"lhsSet",
"=",
"new",
"HashSet",
"<",
"Zone",
">",
"(",
"lhs",
".",
"getZones",
"(",
")",
")",
";... | Confirms that both clusters have the same set of zones defined.
@param lhs
@param rhs | [
"Confirms",
"that",
"both",
"clusters",
"have",
"the",
"same",
"set",
"of",
"zones",
"defined",
"."
] | train | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/utils/RebalanceUtils.java#L205-L212 |
tvesalainen/lpg | src/main/java/org/vesalainen/parser/util/Input.java | Input.getInstance | public static <T> InputReader getInstance(T input) throws IOException {
"""
Returns InputReader for input
@param <T>
@param input Any supported input type
@return
@throws IOException
"""
return getInstance(input, -1, UTF_8, NO_FEATURES);
} | java | public static <T> InputReader getInstance(T input) throws IOException
{
return getInstance(input, -1, UTF_8, NO_FEATURES);
} | [
"public",
"static",
"<",
"T",
">",
"InputReader",
"getInstance",
"(",
"T",
"input",
")",
"throws",
"IOException",
"{",
"return",
"getInstance",
"(",
"input",
",",
"-",
"1",
",",
"UTF_8",
",",
"NO_FEATURES",
")",
";",
"}"
] | Returns InputReader for input
@param <T>
@param input Any supported input type
@return
@throws IOException | [
"Returns",
"InputReader",
"for",
"input"
] | train | https://github.com/tvesalainen/lpg/blob/0917b8d295e9772b9f8a0affc258a08530cd567a/src/main/java/org/vesalainen/parser/util/Input.java#L166-L169 |
WolfgangFahl/Mediawiki-Japi | src/main/java/com/bitplan/mediawiki/japi/user/WikiUser.java | WikiUser.getPropertyFile | public static File getPropertyFile(String wikiId) {
"""
get the propertyFile for the given wikiId
@param wikiId
@return the propertyFile
"""
String user = System.getProperty("user.name");
return getPropertyFile(wikiId, user);
} | java | public static File getPropertyFile(String wikiId) {
String user = System.getProperty("user.name");
return getPropertyFile(wikiId, user);
} | [
"public",
"static",
"File",
"getPropertyFile",
"(",
"String",
"wikiId",
")",
"{",
"String",
"user",
"=",
"System",
".",
"getProperty",
"(",
"\"user.name\"",
")",
";",
"return",
"getPropertyFile",
"(",
"wikiId",
",",
"user",
")",
";",
"}"
] | get the propertyFile for the given wikiId
@param wikiId
@return the propertyFile | [
"get",
"the",
"propertyFile",
"for",
"the",
"given",
"wikiId"
] | train | https://github.com/WolfgangFahl/Mediawiki-Japi/blob/78d0177ebfe02eb05da5550839727861f1e888a5/src/main/java/com/bitplan/mediawiki/japi/user/WikiUser.java#L104-L107 |
aragozin/jvm-tools | mxdump/src/main/java/org/gridkit/jvmtool/jackson/WriterBasedGenerator.java | WriterBasedGenerator._writePPFieldName | protected final void _writePPFieldName(String name, boolean commaBefore)
throws IOException, JsonGenerationException {
"""
Specialized version of <code>_writeFieldName</code>, off-lined
to keep the "fast path" as simple (and hopefully fast) as possible.
"""
if (commaBefore) {
_cfgPrettyPrinter.writeObjectEntrySeparator(this);
} else {
_cfgPrettyPrinter.beforeObjectEntries(this);
}
if (isEnabled(Feature.QUOTE_FIELD_NAMES)) { // standard
if (_outputTail >= _outputEnd) {
_flushBuffer();
}
_outputBuffer[_outputTail++] = '"';
_writeString(name);
if (_outputTail >= _outputEnd) {
_flushBuffer();
}
_outputBuffer[_outputTail++] = '"';
} else { // non-standard, omit quotes
_writeString(name);
}
} | java | protected final void _writePPFieldName(String name, boolean commaBefore)
throws IOException, JsonGenerationException
{
if (commaBefore) {
_cfgPrettyPrinter.writeObjectEntrySeparator(this);
} else {
_cfgPrettyPrinter.beforeObjectEntries(this);
}
if (isEnabled(Feature.QUOTE_FIELD_NAMES)) { // standard
if (_outputTail >= _outputEnd) {
_flushBuffer();
}
_outputBuffer[_outputTail++] = '"';
_writeString(name);
if (_outputTail >= _outputEnd) {
_flushBuffer();
}
_outputBuffer[_outputTail++] = '"';
} else { // non-standard, omit quotes
_writeString(name);
}
} | [
"protected",
"final",
"void",
"_writePPFieldName",
"(",
"String",
"name",
",",
"boolean",
"commaBefore",
")",
"throws",
"IOException",
",",
"JsonGenerationException",
"{",
"if",
"(",
"commaBefore",
")",
"{",
"_cfgPrettyPrinter",
".",
"writeObjectEntrySeparator",
"(",
... | Specialized version of <code>_writeFieldName</code>, off-lined
to keep the "fast path" as simple (and hopefully fast) as possible. | [
"Specialized",
"version",
"of",
"<code",
">",
"_writeFieldName<",
"/",
"code",
">",
"off",
"-",
"lined",
"to",
"keep",
"the",
"fast",
"path",
"as",
"simple",
"(",
"and",
"hopefully",
"fast",
")",
"as",
"possible",
"."
] | train | https://github.com/aragozin/jvm-tools/blob/d3a4d0c6a47fb9317f274988569655f30dcd2f76/mxdump/src/main/java/org/gridkit/jvmtool/jackson/WriterBasedGenerator.java#L300-L322 |
OpenLiberty/open-liberty | dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/config/WSKeyStore.java | WSKeyStore.openKeyStore | public static InputStream openKeyStore(String fileName) throws MalformedURLException, IOException {
"""
The purpose of this method is to open the passed in file which represents
the key store.
@param fileName
@return InputStream
@throws MalformedURLException
@throws IOException
"""
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.entry(tc, "openKeyStore: " + fileName);
URL urlFile = null;
// Check if the filename exists as a File.
File kfile = new File(fileName);
if (kfile.exists() && kfile.length() == 0) {
throw new IOException("Keystore file exists, but is empty: " + fileName);
} else if (!kfile.exists()) {
urlFile = new URL(fileName);
} else {
// kfile exists
urlFile = new URL("file:" + kfile.getCanonicalPath());
}
// Finally open the file.
InputStream fis = urlFile.openStream();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.exit(tc, "openKeyStore: " + (null != fis));
return fis;
} | java | public static InputStream openKeyStore(String fileName) throws MalformedURLException, IOException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.entry(tc, "openKeyStore: " + fileName);
URL urlFile = null;
// Check if the filename exists as a File.
File kfile = new File(fileName);
if (kfile.exists() && kfile.length() == 0) {
throw new IOException("Keystore file exists, but is empty: " + fileName);
} else if (!kfile.exists()) {
urlFile = new URL(fileName);
} else {
// kfile exists
urlFile = new URL("file:" + kfile.getCanonicalPath());
}
// Finally open the file.
InputStream fis = urlFile.openStream();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.exit(tc, "openKeyStore: " + (null != fis));
return fis;
} | [
"public",
"static",
"InputStream",
"openKeyStore",
"(",
"String",
"fileName",
")",
"throws",
"MalformedURLException",
",",
"IOException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"T... | The purpose of this method is to open the passed in file which represents
the key store.
@param fileName
@return InputStream
@throws MalformedURLException
@throws IOException | [
"The",
"purpose",
"of",
"this",
"method",
"is",
"to",
"open",
"the",
"passed",
"in",
"file",
"which",
"represents",
"the",
"key",
"store",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/config/WSKeyStore.java#L1126-L1150 |
Azure/azure-sdk-for-java | edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/DevicesInner.java | DevicesInner.getByResourceGroupAsync | public Observable<DataBoxEdgeDeviceInner> getByResourceGroupAsync(String deviceName, String resourceGroupName) {
"""
Gets the properties of the data box edge/gateway device.
@param deviceName The device name.
@param resourceGroupName The resource group name.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the DataBoxEdgeDeviceInner object
"""
return getByResourceGroupWithServiceResponseAsync(deviceName, resourceGroupName).map(new Func1<ServiceResponse<DataBoxEdgeDeviceInner>, DataBoxEdgeDeviceInner>() {
@Override
public DataBoxEdgeDeviceInner call(ServiceResponse<DataBoxEdgeDeviceInner> response) {
return response.body();
}
});
} | java | public Observable<DataBoxEdgeDeviceInner> getByResourceGroupAsync(String deviceName, String resourceGroupName) {
return getByResourceGroupWithServiceResponseAsync(deviceName, resourceGroupName).map(new Func1<ServiceResponse<DataBoxEdgeDeviceInner>, DataBoxEdgeDeviceInner>() {
@Override
public DataBoxEdgeDeviceInner call(ServiceResponse<DataBoxEdgeDeviceInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"DataBoxEdgeDeviceInner",
">",
"getByResourceGroupAsync",
"(",
"String",
"deviceName",
",",
"String",
"resourceGroupName",
")",
"{",
"return",
"getByResourceGroupWithServiceResponseAsync",
"(",
"deviceName",
",",
"resourceGroupName",
")",
".",
... | Gets the properties of the data box edge/gateway device.
@param deviceName The device name.
@param resourceGroupName The resource group name.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the DataBoxEdgeDeviceInner object | [
"Gets",
"the",
"properties",
"of",
"the",
"data",
"box",
"edge",
"/",
"gateway",
"device",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/DevicesInner.java#L641-L648 |
code4everything/util | src/main/java/com/zhazhapan/util/LoggerUtils.java | LoggerUtils.warn | public static void warn(Class<?> clazz, String message, String... values) {
"""
警告
@param clazz 类
@param message 消息
@param values 格式化参数
@since 1.0.8
"""
getLogger(clazz).warn(formatString(message, values));
} | java | public static void warn(Class<?> clazz, String message, String... values) {
getLogger(clazz).warn(formatString(message, values));
} | [
"public",
"static",
"void",
"warn",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"String",
"message",
",",
"String",
"...",
"values",
")",
"{",
"getLogger",
"(",
"clazz",
")",
".",
"warn",
"(",
"formatString",
"(",
"message",
",",
"values",
")",
")",
"... | 警告
@param clazz 类
@param message 消息
@param values 格式化参数
@since 1.0.8 | [
"警告"
] | train | https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/LoggerUtils.java#L135-L137 |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/sampling/SimpleRandomSampling.java | SimpleRandomSampling.xbarVariance | public static double xbarVariance(double variance, int sampleN, int populationN) {
"""
Calculates Variance for Xbar for a finite population size
@param variance
@param sampleN
@param populationN
@return
"""
if(populationN<=0 || sampleN<=0 || sampleN>populationN) {
throw new IllegalArgumentException("All the parameters must be positive and sampleN smaller than populationN.");
}
double xbarVariance=(1.0 - (double)sampleN/populationN)*variance/sampleN;
return xbarVariance;
} | java | public static double xbarVariance(double variance, int sampleN, int populationN) {
if(populationN<=0 || sampleN<=0 || sampleN>populationN) {
throw new IllegalArgumentException("All the parameters must be positive and sampleN smaller than populationN.");
}
double xbarVariance=(1.0 - (double)sampleN/populationN)*variance/sampleN;
return xbarVariance;
} | [
"public",
"static",
"double",
"xbarVariance",
"(",
"double",
"variance",
",",
"int",
"sampleN",
",",
"int",
"populationN",
")",
"{",
"if",
"(",
"populationN",
"<=",
"0",
"||",
"sampleN",
"<=",
"0",
"||",
"sampleN",
">",
"populationN",
")",
"{",
"throw",
... | Calculates Variance for Xbar for a finite population size
@param variance
@param sampleN
@param populationN
@return | [
"Calculates",
"Variance",
"for",
"Xbar",
"for",
"a",
"finite",
"population",
"size"
] | train | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/sampling/SimpleRandomSampling.java#L161-L169 |
facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/DistributedFileSystem.java | DistributedFileSystem.recoverLease | public boolean recoverLease(Path f, boolean discardLastBlock) throws IOException {
"""
Start lease recovery
@param f the name of the file to start lease recovery
@param discardLastBlock discard last block if it is not yet hsync-ed.
@return if the file is closed or not
@throws IOException
"""
return dfs.recoverLease(getPathName(f), discardLastBlock);
} | java | public boolean recoverLease(Path f, boolean discardLastBlock) throws IOException {
return dfs.recoverLease(getPathName(f), discardLastBlock);
} | [
"public",
"boolean",
"recoverLease",
"(",
"Path",
"f",
",",
"boolean",
"discardLastBlock",
")",
"throws",
"IOException",
"{",
"return",
"dfs",
".",
"recoverLease",
"(",
"getPathName",
"(",
"f",
")",
",",
"discardLastBlock",
")",
";",
"}"
] | Start lease recovery
@param f the name of the file to start lease recovery
@param discardLastBlock discard last block if it is not yet hsync-ed.
@return if the file is closed or not
@throws IOException | [
"Start",
"lease",
"recovery"
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/DistributedFileSystem.java#L251-L253 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/UnImplNode.java | UnImplNode.replaceChild | public Node replaceChild(Node newChild, Node oldChild) throws DOMException {
"""
Unimplemented. See org.w3c.dom.Node
@param newChild Replace existing child with this one
@param oldChild Existing child to be replaced
@return null
@throws DOMException
"""
error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"replaceChild not supported!");
return null;
} | java | public Node replaceChild(Node newChild, Node oldChild) throws DOMException
{
error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"replaceChild not supported!");
return null;
} | [
"public",
"Node",
"replaceChild",
"(",
"Node",
"newChild",
",",
"Node",
"oldChild",
")",
"throws",
"DOMException",
"{",
"error",
"(",
"XMLErrorResources",
".",
"ER_FUNCTION_NOT_SUPPORTED",
")",
";",
"//\"replaceChild not supported!\");",
"return",
"null",
";",
"}"
] | Unimplemented. See org.w3c.dom.Node
@param newChild Replace existing child with this one
@param oldChild Existing child to be replaced
@return null
@throws DOMException | [
"Unimplemented",
".",
"See",
"org",
".",
"w3c",
".",
"dom",
".",
"Node"
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/UnImplNode.java#L674-L680 |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/cluster/api/RestBuilder.java | RestBuilder.withParam | public RestBuilder withParam(String key, String value) {
"""
Adds an URL query parameter to the request. Using a key twice will
result in the last call being taken into account.
@param key the parameter key.
@param value the parameter value.
"""
delegate.withParam(key, value);
return this;
} | java | public RestBuilder withParam(String key, String value) {
delegate.withParam(key, value);
return this;
} | [
"public",
"RestBuilder",
"withParam",
"(",
"String",
"key",
",",
"String",
"value",
")",
"{",
"delegate",
".",
"withParam",
"(",
"key",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | Adds an URL query parameter to the request. Using a key twice will
result in the last call being taken into account.
@param key the parameter key.
@param value the parameter value. | [
"Adds",
"an",
"URL",
"query",
"parameter",
"to",
"the",
"request",
".",
"Using",
"a",
"key",
"twice",
"will",
"result",
"in",
"the",
"last",
"call",
"being",
"taken",
"into",
"account",
"."
] | train | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/cluster/api/RestBuilder.java#L66-L69 |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/ns/ns_ssl_certkey_policy.java | ns_ssl_certkey_policy.update | public static ns_ssl_certkey_policy update(nitro_service client, ns_ssl_certkey_policy resource) throws Exception {
"""
<pre>
Use this operation to set the polling frequency of the NetScaler SSL certificates.
</pre>
"""
resource.validate("modify");
return ((ns_ssl_certkey_policy[]) resource.update_resource(client))[0];
} | java | public static ns_ssl_certkey_policy update(nitro_service client, ns_ssl_certkey_policy resource) throws Exception
{
resource.validate("modify");
return ((ns_ssl_certkey_policy[]) resource.update_resource(client))[0];
} | [
"public",
"static",
"ns_ssl_certkey_policy",
"update",
"(",
"nitro_service",
"client",
",",
"ns_ssl_certkey_policy",
"resource",
")",
"throws",
"Exception",
"{",
"resource",
".",
"validate",
"(",
"\"modify\"",
")",
";",
"return",
"(",
"(",
"ns_ssl_certkey_policy",
"... | <pre>
Use this operation to set the polling frequency of the NetScaler SSL certificates.
</pre> | [
"<pre",
">",
"Use",
"this",
"operation",
"to",
"set",
"the",
"polling",
"frequency",
"of",
"the",
"NetScaler",
"SSL",
"certificates",
".",
"<",
"/",
"pre",
">"
] | train | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/ns/ns_ssl_certkey_policy.java#L126-L130 |
Azure/azure-sdk-for-java | appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/DiagnosticsInner.java | DiagnosticsInner.executeSiteAnalysisSlotAsync | public Observable<DiagnosticAnalysisInner> executeSiteAnalysisSlotAsync(String resourceGroupName, String siteName, String diagnosticCategory, String analysisName, String slot, DateTime startTime, DateTime endTime, String timeGrain) {
"""
Execute Analysis.
Execute Analysis.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param siteName Site Name
@param diagnosticCategory Category Name
@param analysisName Analysis Resource Name
@param slot Slot Name
@param startTime Start Time
@param endTime End Time
@param timeGrain Time Grain
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the DiagnosticAnalysisInner object
"""
return executeSiteAnalysisSlotWithServiceResponseAsync(resourceGroupName, siteName, diagnosticCategory, analysisName, slot, startTime, endTime, timeGrain).map(new Func1<ServiceResponse<DiagnosticAnalysisInner>, DiagnosticAnalysisInner>() {
@Override
public DiagnosticAnalysisInner call(ServiceResponse<DiagnosticAnalysisInner> response) {
return response.body();
}
});
} | java | public Observable<DiagnosticAnalysisInner> executeSiteAnalysisSlotAsync(String resourceGroupName, String siteName, String diagnosticCategory, String analysisName, String slot, DateTime startTime, DateTime endTime, String timeGrain) {
return executeSiteAnalysisSlotWithServiceResponseAsync(resourceGroupName, siteName, diagnosticCategory, analysisName, slot, startTime, endTime, timeGrain).map(new Func1<ServiceResponse<DiagnosticAnalysisInner>, DiagnosticAnalysisInner>() {
@Override
public DiagnosticAnalysisInner call(ServiceResponse<DiagnosticAnalysisInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"DiagnosticAnalysisInner",
">",
"executeSiteAnalysisSlotAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"siteName",
",",
"String",
"diagnosticCategory",
",",
"String",
"analysisName",
",",
"String",
"slot",
",",
"DateTime",
"start... | Execute Analysis.
Execute Analysis.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param siteName Site Name
@param diagnosticCategory Category Name
@param analysisName Analysis Resource Name
@param slot Slot Name
@param startTime Start Time
@param endTime End Time
@param timeGrain Time Grain
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the DiagnosticAnalysisInner object | [
"Execute",
"Analysis",
".",
"Execute",
"Analysis",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/DiagnosticsInner.java#L1995-L2002 |
agmip/translator-dssat | src/main/java/org/agmip/translators/dssat/DssatXFileOutput.java | DssatXFileOutput.setSecDataArr | private int setSecDataArr(ArrayList inArr, ArrayList outArr) {
"""
Get index value of the record and set new id value in the array
@param inArr sub array of data
@param outArr array of sub data
@return current index value of the sub data
"""
if (!inArr.isEmpty()) {
for (int j = 0; j < outArr.size(); j++) {
if (outArr.get(j).equals(inArr)) {
return j + 1;
}
}
outArr.add(inArr);
return outArr.size();
} else {
return 0;
}
} | java | private int setSecDataArr(ArrayList inArr, ArrayList outArr) {
if (!inArr.isEmpty()) {
for (int j = 0; j < outArr.size(); j++) {
if (outArr.get(j).equals(inArr)) {
return j + 1;
}
}
outArr.add(inArr);
return outArr.size();
} else {
return 0;
}
} | [
"private",
"int",
"setSecDataArr",
"(",
"ArrayList",
"inArr",
",",
"ArrayList",
"outArr",
")",
"{",
"if",
"(",
"!",
"inArr",
".",
"isEmpty",
"(",
")",
")",
"{",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"outArr",
".",
"size",
"(",
")",
";"... | Get index value of the record and set new id value in the array
@param inArr sub array of data
@param outArr array of sub data
@return current index value of the sub data | [
"Get",
"index",
"value",
"of",
"the",
"record",
"and",
"set",
"new",
"id",
"value",
"in",
"the",
"array"
] | train | https://github.com/agmip/translator-dssat/blob/4be61d998f106eb7234ea8701b63c3746ae688f4/src/main/java/org/agmip/translators/dssat/DssatXFileOutput.java#L1496-L1509 |
xwiki/xwiki-commons | xwiki-commons-core/xwiki-commons-xml/src/main/java/org/xwiki/xml/html/HTMLUtils.java | HTMLUtils.stripFirstElementInside | public static void stripFirstElementInside(Document document, String parentTagName, String elementTagName) {
"""
Remove the first element inside a parent element and copy the element's children in the parent.
@param document the w3c document from which to remove the top level paragraph
@param parentTagName the name of the parent tag to look under
@param elementTagName the name of the first element to remove
"""
NodeList parentNodes = document.getElementsByTagName(parentTagName);
if (parentNodes.getLength() > 0) {
Node parentNode = parentNodes.item(0);
// Look for a p element below the first parent element
Node pNode = parentNode.getFirstChild();
if (elementTagName.equalsIgnoreCase(pNode.getNodeName())) {
// Move all children of p node under the root element
NodeList pChildrenNodes = pNode.getChildNodes();
while (pChildrenNodes.getLength() > 0) {
parentNode.insertBefore(pChildrenNodes.item(0), null);
}
parentNode.removeChild(pNode);
}
}
} | java | public static void stripFirstElementInside(Document document, String parentTagName, String elementTagName)
{
NodeList parentNodes = document.getElementsByTagName(parentTagName);
if (parentNodes.getLength() > 0) {
Node parentNode = parentNodes.item(0);
// Look for a p element below the first parent element
Node pNode = parentNode.getFirstChild();
if (elementTagName.equalsIgnoreCase(pNode.getNodeName())) {
// Move all children of p node under the root element
NodeList pChildrenNodes = pNode.getChildNodes();
while (pChildrenNodes.getLength() > 0) {
parentNode.insertBefore(pChildrenNodes.item(0), null);
}
parentNode.removeChild(pNode);
}
}
} | [
"public",
"static",
"void",
"stripFirstElementInside",
"(",
"Document",
"document",
",",
"String",
"parentTagName",
",",
"String",
"elementTagName",
")",
"{",
"NodeList",
"parentNodes",
"=",
"document",
".",
"getElementsByTagName",
"(",
"parentTagName",
")",
";",
"i... | Remove the first element inside a parent element and copy the element's children in the parent.
@param document the w3c document from which to remove the top level paragraph
@param parentTagName the name of the parent tag to look under
@param elementTagName the name of the first element to remove | [
"Remove",
"the",
"first",
"element",
"inside",
"a",
"parent",
"element",
"and",
"copy",
"the",
"element",
"s",
"children",
"in",
"the",
"parent",
"."
] | train | https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-xml/src/main/java/org/xwiki/xml/html/HTMLUtils.java#L308-L324 |
pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/reading/StreamSegmentReadIndex.java | StreamSegmentReadIndex.getMultiReadResultEntry | private CompletableReadResultEntry getMultiReadResultEntry(long resultStartOffset, int maxLength) {
"""
Returns a ReadResultEntry that matches the specified search parameters.
<p>
Compared to getSingleMemoryReadResultEntry(), this method may return a direct entry or a collection of entries.
If the first entry to be returned would constitute a cache hit, then this method will attempt to return data from
subsequent (congruent) entries, as long as they are cache hits. If at any time a cache miss occurs, the data collected
so far is returned as a single entry, excluding the cache miss entry (exception if the first entry is a miss,
then that entry is returned).
@param resultStartOffset The Offset within the StreamSegment where to start returning data from.
@param maxLength The maximum number of bytes to return.
@return A ReadResultEntry representing the data to return.
"""
int readLength = 0;
CompletableReadResultEntry nextEntry = getSingleReadResultEntry(resultStartOffset, maxLength);
if (nextEntry == null || !(nextEntry instanceof CacheReadResultEntry)) {
// We can only coalesce CacheReadResultEntries.
return nextEntry;
}
// Collect the contents of congruent Index Entries into a list, as long as we still encounter data in the cache.
ArrayList<InputStream> contents = new ArrayList<>();
do {
assert Futures.isSuccessful(nextEntry.getContent()) : "Found CacheReadResultEntry that is not completed yet: " + nextEntry;
val entryContents = nextEntry.getContent().join();
contents.add(entryContents.getData());
readLength += entryContents.getLength();
if (readLength >= this.config.getMemoryReadMinLength() || readLength >= maxLength) {
break;
}
nextEntry = getSingleMemoryReadResultEntry(resultStartOffset + readLength, maxLength - readLength);
} while (nextEntry != null);
// Coalesce the results into a single InputStream and return the result.
return new CacheReadResultEntry(resultStartOffset, new SequenceInputStream(Iterators.asEnumeration(contents.iterator())), readLength);
} | java | private CompletableReadResultEntry getMultiReadResultEntry(long resultStartOffset, int maxLength) {
int readLength = 0;
CompletableReadResultEntry nextEntry = getSingleReadResultEntry(resultStartOffset, maxLength);
if (nextEntry == null || !(nextEntry instanceof CacheReadResultEntry)) {
// We can only coalesce CacheReadResultEntries.
return nextEntry;
}
// Collect the contents of congruent Index Entries into a list, as long as we still encounter data in the cache.
ArrayList<InputStream> contents = new ArrayList<>();
do {
assert Futures.isSuccessful(nextEntry.getContent()) : "Found CacheReadResultEntry that is not completed yet: " + nextEntry;
val entryContents = nextEntry.getContent().join();
contents.add(entryContents.getData());
readLength += entryContents.getLength();
if (readLength >= this.config.getMemoryReadMinLength() || readLength >= maxLength) {
break;
}
nextEntry = getSingleMemoryReadResultEntry(resultStartOffset + readLength, maxLength - readLength);
} while (nextEntry != null);
// Coalesce the results into a single InputStream and return the result.
return new CacheReadResultEntry(resultStartOffset, new SequenceInputStream(Iterators.asEnumeration(contents.iterator())), readLength);
} | [
"private",
"CompletableReadResultEntry",
"getMultiReadResultEntry",
"(",
"long",
"resultStartOffset",
",",
"int",
"maxLength",
")",
"{",
"int",
"readLength",
"=",
"0",
";",
"CompletableReadResultEntry",
"nextEntry",
"=",
"getSingleReadResultEntry",
"(",
"resultStartOffset",... | Returns a ReadResultEntry that matches the specified search parameters.
<p>
Compared to getSingleMemoryReadResultEntry(), this method may return a direct entry or a collection of entries.
If the first entry to be returned would constitute a cache hit, then this method will attempt to return data from
subsequent (congruent) entries, as long as they are cache hits. If at any time a cache miss occurs, the data collected
so far is returned as a single entry, excluding the cache miss entry (exception if the first entry is a miss,
then that entry is returned).
@param resultStartOffset The Offset within the StreamSegment where to start returning data from.
@param maxLength The maximum number of bytes to return.
@return A ReadResultEntry representing the data to return. | [
"Returns",
"a",
"ReadResultEntry",
"that",
"matches",
"the",
"specified",
"search",
"parameters",
".",
"<p",
">",
"Compared",
"to",
"getSingleMemoryReadResultEntry",
"()",
"this",
"method",
"may",
"return",
"a",
"direct",
"entry",
"or",
"a",
"collection",
"of",
... | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/reading/StreamSegmentReadIndex.java#L799-L824 |
redkale/redkale | src/org/redkale/util/ResourceFactory.java | ResourceFactory.register | public <A> A register(final boolean autoSync, final String name, final A rs) {
"""
将对象以指定资源名注入到资源池中
@param <A> 泛型
@param autoSync 是否同步已被注入的资源
@param name 资源名
@param rs 资源对象
@return 旧资源对象
"""
checkResourceName(name);
final Class<?> claz = rs.getClass();
ResourceType rtype = claz.getAnnotation(ResourceType.class);
if (rtype == null) {
return (A) register(autoSync, name, claz, rs);
} else {
A old = null;
A t = (A) register(autoSync, name, rtype.value(), rs);
if (t != null) old = t;
return old;
}
} | java | public <A> A register(final boolean autoSync, final String name, final A rs) {
checkResourceName(name);
final Class<?> claz = rs.getClass();
ResourceType rtype = claz.getAnnotation(ResourceType.class);
if (rtype == null) {
return (A) register(autoSync, name, claz, rs);
} else {
A old = null;
A t = (A) register(autoSync, name, rtype.value(), rs);
if (t != null) old = t;
return old;
}
} | [
"public",
"<",
"A",
">",
"A",
"register",
"(",
"final",
"boolean",
"autoSync",
",",
"final",
"String",
"name",
",",
"final",
"A",
"rs",
")",
"{",
"checkResourceName",
"(",
"name",
")",
";",
"final",
"Class",
"<",
"?",
">",
"claz",
"=",
"rs",
".",
"... | 将对象以指定资源名注入到资源池中
@param <A> 泛型
@param autoSync 是否同步已被注入的资源
@param name 资源名
@param rs 资源对象
@return 旧资源对象 | [
"将对象以指定资源名注入到资源池中"
] | train | https://github.com/redkale/redkale/blob/ea5169b5c5ea7412fd762331c0c497165832e901/src/org/redkale/util/ResourceFactory.java#L348-L360 |
zamrokk/fabric-sdk-java | src/main/java/org/hyperledger/fabric/sdk/shim/Handler.java | Handler.markIsTransaction | public synchronized boolean markIsTransaction(String uuid, boolean isTransaction) {
"""
Marks a UUID as either a transaction or a query
@param uuid ID to be marked
@param isTransaction true for transaction, false for query
@return whether or not the UUID was successfully marked
"""
if (this.isTransaction == null) {
return false;
}
this.isTransaction.put(uuid, isTransaction);
return true;
} | java | public synchronized boolean markIsTransaction(String uuid, boolean isTransaction) {
if (this.isTransaction == null) {
return false;
}
this.isTransaction.put(uuid, isTransaction);
return true;
} | [
"public",
"synchronized",
"boolean",
"markIsTransaction",
"(",
"String",
"uuid",
",",
"boolean",
"isTransaction",
")",
"{",
"if",
"(",
"this",
".",
"isTransaction",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"this",
".",
"isTransaction",
".",
"put"... | Marks a UUID as either a transaction or a query
@param uuid ID to be marked
@param isTransaction true for transaction, false for query
@return whether or not the UUID was successfully marked | [
"Marks",
"a",
"UUID",
"as",
"either",
"a",
"transaction",
"or",
"a",
"query"
] | train | https://github.com/zamrokk/fabric-sdk-java/blob/d4993ca602f72d412cd682e1b92e805e48b27afa/src/main/java/org/hyperledger/fabric/sdk/shim/Handler.java#L168-L175 |
Axway/Grapes | server/src/main/java/org/axway/grapes/server/webapp/resources/ArtifactResource.java | ArtifactResource.getGavcs | @GET
@Produces( {
"""
Return a list of gavc, stored in Grapes, regarding the filters passed in the query parameters.
This method is call via GET <grapes_url>/artifact/gavcs
@return Response A list (in HTML or JSON) of gavc
"""MediaType.TEXT_HTML, MediaType.APPLICATION_JSON})
@Path(ServerAPI.GET_GAVCS)
public Response getGavcs(@Context final UriInfo uriInfo){
LOG.info("Got a get GAVCs request");
final ListView view = new ListView("GAVCS view", "gavc");
final FiltersHolder filters = new FiltersHolder();
filters.init(uriInfo.getQueryParameters());
final List<String> gavcs = getArtifactHandler().getArtifactGavcs(filters);
Collections.sort(gavcs);
view.addAll(gavcs);
return Response.ok(view).build();
} | java | @GET
@Produces({MediaType.TEXT_HTML, MediaType.APPLICATION_JSON})
@Path(ServerAPI.GET_GAVCS)
public Response getGavcs(@Context final UriInfo uriInfo){
LOG.info("Got a get GAVCs request");
final ListView view = new ListView("GAVCS view", "gavc");
final FiltersHolder filters = new FiltersHolder();
filters.init(uriInfo.getQueryParameters());
final List<String> gavcs = getArtifactHandler().getArtifactGavcs(filters);
Collections.sort(gavcs);
view.addAll(gavcs);
return Response.ok(view).build();
} | [
"@",
"GET",
"@",
"Produces",
"(",
"{",
"MediaType",
".",
"TEXT_HTML",
",",
"MediaType",
".",
"APPLICATION_JSON",
"}",
")",
"@",
"Path",
"(",
"ServerAPI",
".",
"GET_GAVCS",
")",
"public",
"Response",
"getGavcs",
"(",
"@",
"Context",
"final",
"UriInfo",
"uri... | Return a list of gavc, stored in Grapes, regarding the filters passed in the query parameters.
This method is call via GET <grapes_url>/artifact/gavcs
@return Response A list (in HTML or JSON) of gavc | [
"Return",
"a",
"list",
"of",
"gavc",
"stored",
"in",
"Grapes",
"regarding",
"the",
"filters",
"passed",
"in",
"the",
"query",
"parameters",
".",
"This",
"method",
"is",
"call",
"via",
"GET",
"<grapes_url",
">",
"/",
"artifact",
"/",
"gavcs"
] | train | https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/server/src/main/java/org/axway/grapes/server/webapp/resources/ArtifactResource.java#L122-L136 |
artikcloud/artikcloud-java | src/main/java/cloud/artik/api/WhitelistingApi.java | WhitelistingApi.getUploadStatus | public UploadStatusEnvelope getUploadStatus(String dtid, String uploadId) throws ApiException {
"""
Get the status of a uploaded CSV file.
Get the status of a uploaded CSV file.
@param dtid Device type id related to the uploaded CSV file. (required)
@param uploadId Upload id related to the uploaded CSV file. (required)
@return UploadStatusEnvelope
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
"""
ApiResponse<UploadStatusEnvelope> resp = getUploadStatusWithHttpInfo(dtid, uploadId);
return resp.getData();
} | java | public UploadStatusEnvelope getUploadStatus(String dtid, String uploadId) throws ApiException {
ApiResponse<UploadStatusEnvelope> resp = getUploadStatusWithHttpInfo(dtid, uploadId);
return resp.getData();
} | [
"public",
"UploadStatusEnvelope",
"getUploadStatus",
"(",
"String",
"dtid",
",",
"String",
"uploadId",
")",
"throws",
"ApiException",
"{",
"ApiResponse",
"<",
"UploadStatusEnvelope",
">",
"resp",
"=",
"getUploadStatusWithHttpInfo",
"(",
"dtid",
",",
"uploadId",
")",
... | Get the status of a uploaded CSV file.
Get the status of a uploaded CSV file.
@param dtid Device type id related to the uploaded CSV file. (required)
@param uploadId Upload id related to the uploaded CSV file. (required)
@return UploadStatusEnvelope
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body | [
"Get",
"the",
"status",
"of",
"a",
"uploaded",
"CSV",
"file",
".",
"Get",
"the",
"status",
"of",
"a",
"uploaded",
"CSV",
"file",
"."
] | train | https://github.com/artikcloud/artikcloud-java/blob/412f447573e7796ab4f685c0bdd5eb76185a365c/src/main/java/cloud/artik/api/WhitelistingApi.java#L658-L661 |
getsentry/sentry-java | sentry/src/main/java/io/sentry/DefaultSentryClientFactory.java | DefaultSentryClientFactory.createHttpConnection | protected Connection createHttpConnection(Dsn dsn) {
"""
Creates an HTTP connection to the Sentry server.
@param dsn Data Source Name of the Sentry server.
@return an {@link HttpConnection} to the server.
"""
URL sentryApiUrl = HttpConnection.getSentryApiUrl(dsn.getUri(), dsn.getProjectId());
String proxyHost = getProxyHost(dsn);
String proxyUser = getProxyUser(dsn);
String proxyPass = getProxyPass(dsn);
int proxyPort = getProxyPort(dsn);
Proxy proxy = null;
if (proxyHost != null) {
InetSocketAddress proxyAddr = new InetSocketAddress(proxyHost, proxyPort);
proxy = new Proxy(Proxy.Type.HTTP, proxyAddr);
if (proxyUser != null && proxyPass != null) {
Authenticator.setDefault(new ProxyAuthenticator(proxyUser, proxyPass));
}
}
Double sampleRate = getSampleRate(dsn);
EventSampler eventSampler = null;
if (sampleRate != null) {
eventSampler = new RandomEventSampler(sampleRate);
}
HttpConnection httpConnection = new HttpConnection(sentryApiUrl, dsn.getPublicKey(),
dsn.getSecretKey(), proxy, eventSampler);
Marshaller marshaller = createMarshaller(dsn);
httpConnection.setMarshaller(marshaller);
int timeout = getTimeout(dsn);
httpConnection.setConnectionTimeout(timeout);
boolean bypassSecurityEnabled = getBypassSecurityEnabled(dsn);
httpConnection.setBypassSecurity(bypassSecurityEnabled);
return httpConnection;
} | java | protected Connection createHttpConnection(Dsn dsn) {
URL sentryApiUrl = HttpConnection.getSentryApiUrl(dsn.getUri(), dsn.getProjectId());
String proxyHost = getProxyHost(dsn);
String proxyUser = getProxyUser(dsn);
String proxyPass = getProxyPass(dsn);
int proxyPort = getProxyPort(dsn);
Proxy proxy = null;
if (proxyHost != null) {
InetSocketAddress proxyAddr = new InetSocketAddress(proxyHost, proxyPort);
proxy = new Proxy(Proxy.Type.HTTP, proxyAddr);
if (proxyUser != null && proxyPass != null) {
Authenticator.setDefault(new ProxyAuthenticator(proxyUser, proxyPass));
}
}
Double sampleRate = getSampleRate(dsn);
EventSampler eventSampler = null;
if (sampleRate != null) {
eventSampler = new RandomEventSampler(sampleRate);
}
HttpConnection httpConnection = new HttpConnection(sentryApiUrl, dsn.getPublicKey(),
dsn.getSecretKey(), proxy, eventSampler);
Marshaller marshaller = createMarshaller(dsn);
httpConnection.setMarshaller(marshaller);
int timeout = getTimeout(dsn);
httpConnection.setConnectionTimeout(timeout);
boolean bypassSecurityEnabled = getBypassSecurityEnabled(dsn);
httpConnection.setBypassSecurity(bypassSecurityEnabled);
return httpConnection;
} | [
"protected",
"Connection",
"createHttpConnection",
"(",
"Dsn",
"dsn",
")",
"{",
"URL",
"sentryApiUrl",
"=",
"HttpConnection",
".",
"getSentryApiUrl",
"(",
"dsn",
".",
"getUri",
"(",
")",
",",
"dsn",
".",
"getProjectId",
"(",
")",
")",
";",
"String",
"proxyHo... | Creates an HTTP connection to the Sentry server.
@param dsn Data Source Name of the Sentry server.
@return an {@link HttpConnection} to the server. | [
"Creates",
"an",
"HTTP",
"connection",
"to",
"the",
"Sentry",
"server",
"."
] | train | https://github.com/getsentry/sentry-java/blob/2e01461775cbd5951ff82b566069c349146d8aca/sentry/src/main/java/io/sentry/DefaultSentryClientFactory.java#L401-L437 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/FuzzyBugComparator.java | FuzzyBugComparator.compareSourceLines | public int compareSourceLines(BugCollection lhsCollection, BugCollection rhsCollection, SourceLineAnnotation lhs,
SourceLineAnnotation rhs) {
"""
Compare source line annotations.
@param rhsCollection
lhs BugCollection
@param lhsCollection
rhs BugCollection
@param lhs
a SourceLineAnnotation
@param rhs
another SourceLineAnnotation
@return comparison of lhs and rhs
"""
if (lhs == null || rhs == null) {
return compareNullElements(lhs, rhs);
}
// Classes must match fuzzily.
int cmp = compareClassesByName(lhsCollection, rhsCollection, lhs.getClassName(), rhs.getClassName());
if (cmp != 0) {
return cmp;
}
return 0;
} | java | public int compareSourceLines(BugCollection lhsCollection, BugCollection rhsCollection, SourceLineAnnotation lhs,
SourceLineAnnotation rhs) {
if (lhs == null || rhs == null) {
return compareNullElements(lhs, rhs);
}
// Classes must match fuzzily.
int cmp = compareClassesByName(lhsCollection, rhsCollection, lhs.getClassName(), rhs.getClassName());
if (cmp != 0) {
return cmp;
}
return 0;
} | [
"public",
"int",
"compareSourceLines",
"(",
"BugCollection",
"lhsCollection",
",",
"BugCollection",
"rhsCollection",
",",
"SourceLineAnnotation",
"lhs",
",",
"SourceLineAnnotation",
"rhs",
")",
"{",
"if",
"(",
"lhs",
"==",
"null",
"||",
"rhs",
"==",
"null",
")",
... | Compare source line annotations.
@param rhsCollection
lhs BugCollection
@param lhsCollection
rhs BugCollection
@param lhs
a SourceLineAnnotation
@param rhs
another SourceLineAnnotation
@return comparison of lhs and rhs | [
"Compare",
"source",
"line",
"annotations",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/FuzzyBugComparator.java#L298-L311 |
alkacon/opencms-core | src-gwt/org/opencms/ade/contenteditor/client/CmsContentEditor.java | CmsContentEditor.saveAndDeleteEntities | public void saveAndDeleteEntities(final boolean clearOnSuccess, final I_CmsSimpleCallback<Boolean> callback) {
"""
Saves the given entities.<p>
@param clearOnSuccess <code>true</code> to clear the VIE instance on success
@param callback the call back command
"""
final CmsEntity entity = m_entityBackend.getEntity(m_entityId);
saveAndDeleteEntities(entity, new ArrayList<String>(m_deletedEntities), clearOnSuccess, callback);
} | java | public void saveAndDeleteEntities(final boolean clearOnSuccess, final I_CmsSimpleCallback<Boolean> callback) {
final CmsEntity entity = m_entityBackend.getEntity(m_entityId);
saveAndDeleteEntities(entity, new ArrayList<String>(m_deletedEntities), clearOnSuccess, callback);
} | [
"public",
"void",
"saveAndDeleteEntities",
"(",
"final",
"boolean",
"clearOnSuccess",
",",
"final",
"I_CmsSimpleCallback",
"<",
"Boolean",
">",
"callback",
")",
"{",
"final",
"CmsEntity",
"entity",
"=",
"m_entityBackend",
".",
"getEntity",
"(",
"m_entityId",
")",
... | Saves the given entities.<p>
@param clearOnSuccess <code>true</code> to clear the VIE instance on success
@param callback the call back command | [
"Saves",
"the",
"given",
"entities",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/contenteditor/client/CmsContentEditor.java#L1025-L1029 |
ehcache/ehcache3 | 107/src/main/java/org/ehcache/jsr107/EhcacheCachingProvider.java | EhcacheCachingProvider.getCacheManager | public CacheManager getCacheManager(URI uri, Configuration config) {
"""
Enables to create a JSR-107 {@link CacheManager} based on the provided Ehcache {@link Configuration}.
@param uri the URI identifying this cache manager
@param config the Ehcache configuration to use
@return a cache manager
"""
return getCacheManager(new ConfigSupplier(uri, config), new Properties());
} | java | public CacheManager getCacheManager(URI uri, Configuration config) {
return getCacheManager(new ConfigSupplier(uri, config), new Properties());
} | [
"public",
"CacheManager",
"getCacheManager",
"(",
"URI",
"uri",
",",
"Configuration",
"config",
")",
"{",
"return",
"getCacheManager",
"(",
"new",
"ConfigSupplier",
"(",
"uri",
",",
"config",
")",
",",
"new",
"Properties",
"(",
")",
")",
";",
"}"
] | Enables to create a JSR-107 {@link CacheManager} based on the provided Ehcache {@link Configuration}.
@param uri the URI identifying this cache manager
@param config the Ehcache configuration to use
@return a cache manager | [
"Enables",
"to",
"create",
"a",
"JSR",
"-",
"107",
"{",
"@link",
"CacheManager",
"}",
"based",
"on",
"the",
"provided",
"Ehcache",
"{",
"@link",
"Configuration",
"}",
"."
] | train | https://github.com/ehcache/ehcache3/blob/3cceda57185e522f8d241ddb75146d67ee2af898/107/src/main/java/org/ehcache/jsr107/EhcacheCachingProvider.java#L96-L98 |
Impetus/Kundera | src/jpa-engine/core/src/main/java/com/impetus/kundera/graph/Node.java | Node.getParentNode | @Override
public Node getParentNode(String parentNodeId) {
"""
Retrieves parent node of this node for a given parent node ID
"""
NodeLink link = new NodeLink(parentNodeId, getNodeId());
if (this.parents == null)
{
return null;
}
else
{
return this.parents.get(link);
}
} | java | @Override
public Node getParentNode(String parentNodeId)
{
NodeLink link = new NodeLink(parentNodeId, getNodeId());
if (this.parents == null)
{
return null;
}
else
{
return this.parents.get(link);
}
} | [
"@",
"Override",
"public",
"Node",
"getParentNode",
"(",
"String",
"parentNodeId",
")",
"{",
"NodeLink",
"link",
"=",
"new",
"NodeLink",
"(",
"parentNodeId",
",",
"getNodeId",
"(",
")",
")",
";",
"if",
"(",
"this",
".",
"parents",
"==",
"null",
")",
"{",... | Retrieves parent node of this node for a given parent node ID | [
"Retrieves",
"parent",
"node",
"of",
"this",
"node",
"for",
"a",
"given",
"parent",
"node",
"ID"
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/graph/Node.java#L281-L294 |
b3log/latke | latke-core/src/main/java/org/b3log/latke/servlet/renderer/AbstractFreeMarkerRenderer.java | AbstractFreeMarkerRenderer.genHTML | protected String genHTML(final HttpServletRequest request, final Map<String, Object> dataModel, final Template template)
throws Exception {
"""
Processes the specified FreeMarker template with the specified request, data model.
@param request the specified request
@param dataModel the specified data model
@param template the specified FreeMarker template
@return generated HTML
@throws Exception exception
"""
final StringWriter stringWriter = new StringWriter();
template.setOutputEncoding("UTF-8");
template.process(dataModel, stringWriter);
final StringBuilder pageContentBuilder = new StringBuilder(stringWriter.toString());
final long endimeMillis = System.currentTimeMillis();
final String dateString = DateFormatUtils.format(endimeMillis, "yyyy/MM/dd HH:mm:ss");
final long startTimeMillis = (Long) request.getAttribute(Keys.HttpRequest.START_TIME_MILLIS);
final String msg = String.format("\n<!-- Generated by Latke (https://github.com/b3log/latke) in %1$dms, %2$s -->",
endimeMillis - startTimeMillis, dateString);
pageContentBuilder.append(msg);
return pageContentBuilder.toString();
} | java | protected String genHTML(final HttpServletRequest request, final Map<String, Object> dataModel, final Template template)
throws Exception {
final StringWriter stringWriter = new StringWriter();
template.setOutputEncoding("UTF-8");
template.process(dataModel, stringWriter);
final StringBuilder pageContentBuilder = new StringBuilder(stringWriter.toString());
final long endimeMillis = System.currentTimeMillis();
final String dateString = DateFormatUtils.format(endimeMillis, "yyyy/MM/dd HH:mm:ss");
final long startTimeMillis = (Long) request.getAttribute(Keys.HttpRequest.START_TIME_MILLIS);
final String msg = String.format("\n<!-- Generated by Latke (https://github.com/b3log/latke) in %1$dms, %2$s -->",
endimeMillis - startTimeMillis, dateString);
pageContentBuilder.append(msg);
return pageContentBuilder.toString();
} | [
"protected",
"String",
"genHTML",
"(",
"final",
"HttpServletRequest",
"request",
",",
"final",
"Map",
"<",
"String",
",",
"Object",
">",
"dataModel",
",",
"final",
"Template",
"template",
")",
"throws",
"Exception",
"{",
"final",
"StringWriter",
"stringWriter",
... | Processes the specified FreeMarker template with the specified request, data model.
@param request the specified request
@param dataModel the specified data model
@param template the specified FreeMarker template
@return generated HTML
@throws Exception exception | [
"Processes",
"the",
"specified",
"FreeMarker",
"template",
"with",
"the",
"specified",
"request",
"data",
"model",
"."
] | train | https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/servlet/renderer/AbstractFreeMarkerRenderer.java#L150-L165 |
Azure/azure-sdk-for-java | datalakeanalytics/resource-manager/v2016_11_01/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2016_11_01/implementation/AccountsInner.java | AccountsInner.updateAsync | public Observable<DataLakeAnalyticsAccountInner> updateAsync(String resourceGroupName, String accountName, UpdateDataLakeAnalyticsAccountParameters parameters) {
"""
Updates the Data Lake Analytics account object specified by the accountName with the contents of the account object.
@param resourceGroupName The name of the Azure resource group.
@param accountName The name of the Data Lake Analytics account.
@param parameters Parameters supplied to the update Data Lake Analytics account operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request
"""
return updateWithServiceResponseAsync(resourceGroupName, accountName, parameters).map(new Func1<ServiceResponse<DataLakeAnalyticsAccountInner>, DataLakeAnalyticsAccountInner>() {
@Override
public DataLakeAnalyticsAccountInner call(ServiceResponse<DataLakeAnalyticsAccountInner> response) {
return response.body();
}
});
} | java | public Observable<DataLakeAnalyticsAccountInner> updateAsync(String resourceGroupName, String accountName, UpdateDataLakeAnalyticsAccountParameters parameters) {
return updateWithServiceResponseAsync(resourceGroupName, accountName, parameters).map(new Func1<ServiceResponse<DataLakeAnalyticsAccountInner>, DataLakeAnalyticsAccountInner>() {
@Override
public DataLakeAnalyticsAccountInner call(ServiceResponse<DataLakeAnalyticsAccountInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"DataLakeAnalyticsAccountInner",
">",
"updateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
",",
"UpdateDataLakeAnalyticsAccountParameters",
"parameters",
")",
"{",
"return",
"updateWithServiceResponseAsync",
"(",
"resou... | Updates the Data Lake Analytics account object specified by the accountName with the contents of the account object.
@param resourceGroupName The name of the Azure resource group.
@param accountName The name of the Data Lake Analytics account.
@param parameters Parameters supplied to the update Data Lake Analytics account operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Updates",
"the",
"Data",
"Lake",
"Analytics",
"account",
"object",
"specified",
"by",
"the",
"accountName",
"with",
"the",
"contents",
"of",
"the",
"account",
"object",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datalakeanalytics/resource-manager/v2016_11_01/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2016_11_01/implementation/AccountsInner.java#L989-L996 |
jbossws/jbossws-common | src/main/java/org/jboss/ws/common/injection/InjectionHelper.java | InjectionHelper.invokeMethod | private static void invokeMethod(final Object instance, final Method method, final Object[] args) {
"""
Invokes method on object with specified arguments.
@param instance to invoke method on
@param method method to invoke
@param args arguments to pass
"""
final boolean accessability = method.isAccessible();
try
{
method.setAccessible(true);
method.invoke(instance, args);
}
catch (Exception e)
{
InjectionException.rethrow(e);
}
finally
{
method.setAccessible(accessability);
}
} | java | private static void invokeMethod(final Object instance, final Method method, final Object[] args)
{
final boolean accessability = method.isAccessible();
try
{
method.setAccessible(true);
method.invoke(instance, args);
}
catch (Exception e)
{
InjectionException.rethrow(e);
}
finally
{
method.setAccessible(accessability);
}
} | [
"private",
"static",
"void",
"invokeMethod",
"(",
"final",
"Object",
"instance",
",",
"final",
"Method",
"method",
",",
"final",
"Object",
"[",
"]",
"args",
")",
"{",
"final",
"boolean",
"accessability",
"=",
"method",
".",
"isAccessible",
"(",
")",
";",
"... | Invokes method on object with specified arguments.
@param instance to invoke method on
@param method method to invoke
@param args arguments to pass | [
"Invokes",
"method",
"on",
"object",
"with",
"specified",
"arguments",
"."
] | train | https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/injection/InjectionHelper.java#L162-L179 |
gsi-upm/BeastTool | beast-tool/src/main/java/es/upm/dit/gsi/beast/reader/Reader.java | Reader.fileDoesNotExist | protected static boolean fileDoesNotExist(String file, String path,
String dest_dir) {
"""
Method to know if already exists one file with the same name in the same
folder
@param scenario_name
@param path
@param dest_dir
@return true when the file does not exist
"""
File f = new File(dest_dir);
if (!f.isDirectory())
return false;
String folderPath = createFolderPath(path);
f = new File(f, folderPath);
File javaFile = new File(f, file);
boolean result = !javaFile.exists();
return result;
} | java | protected static boolean fileDoesNotExist(String file, String path,
String dest_dir) {
File f = new File(dest_dir);
if (!f.isDirectory())
return false;
String folderPath = createFolderPath(path);
f = new File(f, folderPath);
File javaFile = new File(f, file);
boolean result = !javaFile.exists();
return result;
} | [
"protected",
"static",
"boolean",
"fileDoesNotExist",
"(",
"String",
"file",
",",
"String",
"path",
",",
"String",
"dest_dir",
")",
"{",
"File",
"f",
"=",
"new",
"File",
"(",
"dest_dir",
")",
";",
"if",
"(",
"!",
"f",
".",
"isDirectory",
"(",
")",
")",... | Method to know if already exists one file with the same name in the same
folder
@param scenario_name
@param path
@param dest_dir
@return true when the file does not exist | [
"Method",
"to",
"know",
"if",
"already",
"exists",
"one",
"file",
"with",
"the",
"same",
"name",
"in",
"the",
"same",
"folder"
] | train | https://github.com/gsi-upm/BeastTool/blob/cc7fdc75cb818c5d60802aaf32c27829e0ca144c/beast-tool/src/main/java/es/upm/dit/gsi/beast/reader/Reader.java#L176-L191 |
sarl/sarl | contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyGenerator.java | PyGenerator.generateGuardEvaluators | protected void generateGuardEvaluators(String container, PyAppendable it, IExtraLanguageGeneratorContext context) {
"""
Generate the memorized guard evaluators.
@param container the fully qualified name of the container of the guards.
@param it the output.
@param context the generation context.
"""
final Map<String, Map<String, List<Pair<XExpression, String>>>> allGuardEvaluators = context.getMapData(EVENT_GUARDS_MEMENTO);
final Map<String, List<Pair<XExpression, String>>> guardEvaluators = allGuardEvaluators.get(container);
if (guardEvaluators == null) {
return;
}
boolean first = true;
for (final Entry<String, List<Pair<XExpression, String>>> entry : guardEvaluators.entrySet()) {
if (first) {
first = false;
} else {
it.newLine();
}
it.append("def __guard_"); //$NON-NLS-1$
it.append(entry.getKey().replaceAll("[^a-zA-Z0-9_]+", "_")); //$NON-NLS-1$ //$NON-NLS-2$
it.append("__(self, occurrence):"); //$NON-NLS-1$
it.increaseIndentation().newLine();
it.append("it = occurrence").newLine(); //$NON-NLS-1$
final String eventHandleName = it.declareUniqueNameVariable(new Object(), "__event_handles"); //$NON-NLS-1$
it.append(eventHandleName).append(" = list"); //$NON-NLS-1$
for (final Pair<XExpression, String> guardDesc : entry.getValue()) {
it.newLine();
if (guardDesc.getKey() == null) {
it.append(eventHandleName).append(".add(").append(guardDesc.getValue()).append(")"); //$NON-NLS-1$ //$NON-NLS-2$
} else {
it.append("if "); //$NON-NLS-1$
generate(guardDesc.getKey(), null, it, context);
it.append(":").increaseIndentation().newLine(); //$NON-NLS-1$
it.append(eventHandleName).append(".add(").append(guardDesc.getValue()).append(")"); //$NON-NLS-1$ //$NON-NLS-2$
it.decreaseIndentation();
}
}
it.newLine().append("return ").append(eventHandleName); //$NON-NLS-1$
it.decreaseIndentation().newLine();
}
} | java | protected void generateGuardEvaluators(String container, PyAppendable it, IExtraLanguageGeneratorContext context) {
final Map<String, Map<String, List<Pair<XExpression, String>>>> allGuardEvaluators = context.getMapData(EVENT_GUARDS_MEMENTO);
final Map<String, List<Pair<XExpression, String>>> guardEvaluators = allGuardEvaluators.get(container);
if (guardEvaluators == null) {
return;
}
boolean first = true;
for (final Entry<String, List<Pair<XExpression, String>>> entry : guardEvaluators.entrySet()) {
if (first) {
first = false;
} else {
it.newLine();
}
it.append("def __guard_"); //$NON-NLS-1$
it.append(entry.getKey().replaceAll("[^a-zA-Z0-9_]+", "_")); //$NON-NLS-1$ //$NON-NLS-2$
it.append("__(self, occurrence):"); //$NON-NLS-1$
it.increaseIndentation().newLine();
it.append("it = occurrence").newLine(); //$NON-NLS-1$
final String eventHandleName = it.declareUniqueNameVariable(new Object(), "__event_handles"); //$NON-NLS-1$
it.append(eventHandleName).append(" = list"); //$NON-NLS-1$
for (final Pair<XExpression, String> guardDesc : entry.getValue()) {
it.newLine();
if (guardDesc.getKey() == null) {
it.append(eventHandleName).append(".add(").append(guardDesc.getValue()).append(")"); //$NON-NLS-1$ //$NON-NLS-2$
} else {
it.append("if "); //$NON-NLS-1$
generate(guardDesc.getKey(), null, it, context);
it.append(":").increaseIndentation().newLine(); //$NON-NLS-1$
it.append(eventHandleName).append(".add(").append(guardDesc.getValue()).append(")"); //$NON-NLS-1$ //$NON-NLS-2$
it.decreaseIndentation();
}
}
it.newLine().append("return ").append(eventHandleName); //$NON-NLS-1$
it.decreaseIndentation().newLine();
}
} | [
"protected",
"void",
"generateGuardEvaluators",
"(",
"String",
"container",
",",
"PyAppendable",
"it",
",",
"IExtraLanguageGeneratorContext",
"context",
")",
"{",
"final",
"Map",
"<",
"String",
",",
"Map",
"<",
"String",
",",
"List",
"<",
"Pair",
"<",
"XExpressi... | Generate the memorized guard evaluators.
@param container the fully qualified name of the container of the guards.
@param it the output.
@param context the generation context. | [
"Generate",
"the",
"memorized",
"guard",
"evaluators",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyGenerator.java#L601-L636 |
Pi4J/pi4j | pi4j-core/src/main/java/com/pi4j/temperature/TemperatureConversion.java | TemperatureConversion.convertFromRankine | public static double convertFromRankine(TemperatureScale to, double temperature) {
"""
Convert a temperature value from the Rankine temperature scale to another.
@param to TemperatureScale
@param temperature value in degrees Rankine
@return converted temperature value in the requested to scale
"""
switch(to) {
case FARENHEIT:
return convertRankineToFarenheit(temperature);
case CELSIUS:
return convertRankineToCelsius(temperature);
case KELVIN:
return convertRankineToKelvin(temperature);
case RANKINE:
return temperature;
default:
throw(new RuntimeException("Invalid termpature conversion"));
}
} | java | public static double convertFromRankine(TemperatureScale to, double temperature) {
switch(to) {
case FARENHEIT:
return convertRankineToFarenheit(temperature);
case CELSIUS:
return convertRankineToCelsius(temperature);
case KELVIN:
return convertRankineToKelvin(temperature);
case RANKINE:
return temperature;
default:
throw(new RuntimeException("Invalid termpature conversion"));
}
} | [
"public",
"static",
"double",
"convertFromRankine",
"(",
"TemperatureScale",
"to",
",",
"double",
"temperature",
")",
"{",
"switch",
"(",
"to",
")",
"{",
"case",
"FARENHEIT",
":",
"return",
"convertRankineToFarenheit",
"(",
"temperature",
")",
";",
"case",
"CELS... | Convert a temperature value from the Rankine temperature scale to another.
@param to TemperatureScale
@param temperature value in degrees Rankine
@return converted temperature value in the requested to scale | [
"Convert",
"a",
"temperature",
"value",
"from",
"the",
"Rankine",
"temperature",
"scale",
"to",
"another",
"."
] | train | https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-core/src/main/java/com/pi4j/temperature/TemperatureConversion.java#L217-L232 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/optimize/listeners/CheckpointListener.java | CheckpointListener.loadLastCheckpointCG | public static ComputationGraph loadLastCheckpointCG(File rootDir) {
"""
Load the last (most recent) checkpoint from the specified root directory
@param rootDir Root directory to load checpoint from
@return ComputationGraph for last checkpoint
"""
Checkpoint last = lastCheckpoint(rootDir);
return loadCheckpointCG(rootDir, last);
} | java | public static ComputationGraph loadLastCheckpointCG(File rootDir){
Checkpoint last = lastCheckpoint(rootDir);
return loadCheckpointCG(rootDir, last);
} | [
"public",
"static",
"ComputationGraph",
"loadLastCheckpointCG",
"(",
"File",
"rootDir",
")",
"{",
"Checkpoint",
"last",
"=",
"lastCheckpoint",
"(",
"rootDir",
")",
";",
"return",
"loadCheckpointCG",
"(",
"rootDir",
",",
"last",
")",
";",
"}"
] | Load the last (most recent) checkpoint from the specified root directory
@param rootDir Root directory to load checpoint from
@return ComputationGraph for last checkpoint | [
"Load",
"the",
"last",
"(",
"most",
"recent",
")",
"checkpoint",
"from",
"the",
"specified",
"root",
"directory"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/optimize/listeners/CheckpointListener.java#L535-L538 |
elki-project/elki | addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/css/CSSClassManager.java | CSSClassManager.updateStyleElement | public void updateStyleElement(Document document, Element style) {
"""
Update the text contents of an existing style element.
@param document Document element (factory)
@param style Style element
"""
StringBuilder buf = new StringBuilder();
serialize(buf);
Text cont = document.createTextNode(buf.toString());
while (style.hasChildNodes()) {
style.removeChild(style.getFirstChild());
}
style.appendChild(cont);
} | java | public void updateStyleElement(Document document, Element style) {
StringBuilder buf = new StringBuilder();
serialize(buf);
Text cont = document.createTextNode(buf.toString());
while (style.hasChildNodes()) {
style.removeChild(style.getFirstChild());
}
style.appendChild(cont);
} | [
"public",
"void",
"updateStyleElement",
"(",
"Document",
"document",
",",
"Element",
"style",
")",
"{",
"StringBuilder",
"buf",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"serialize",
"(",
"buf",
")",
";",
"Text",
"cont",
"=",
"document",
".",
"createTextNo... | Update the text contents of an existing style element.
@param document Document element (factory)
@param style Style element | [
"Update",
"the",
"text",
"contents",
"of",
"an",
"existing",
"style",
"element",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/css/CSSClassManager.java#L192-L200 |
lucee/Lucee | core/src/main/java/lucee/runtime/config/XMLConfigFactory.java | XMLConfigFactory.createConfigFile | static void createConfigFile(String xmlName, Resource configFile) throws IOException {
"""
creates the Config File, if File not exist
@param xmlName
@param configFile
@throws IOException
"""
configFile.createFile(true);
createFileFromResource("/resource/config/" + xmlName + ".xml", configFile.getAbsoluteResource());
} | java | static void createConfigFile(String xmlName, Resource configFile) throws IOException {
configFile.createFile(true);
createFileFromResource("/resource/config/" + xmlName + ".xml", configFile.getAbsoluteResource());
} | [
"static",
"void",
"createConfigFile",
"(",
"String",
"xmlName",
",",
"Resource",
"configFile",
")",
"throws",
"IOException",
"{",
"configFile",
".",
"createFile",
"(",
"true",
")",
";",
"createFileFromResource",
"(",
"\"/resource/config/\"",
"+",
"xmlName",
"+",
"... | creates the Config File, if File not exist
@param xmlName
@param configFile
@throws IOException | [
"creates",
"the",
"Config",
"File",
"if",
"File",
"not",
"exist"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/config/XMLConfigFactory.java#L185-L188 |
xwiki/xwiki-commons | xwiki-commons-core/xwiki-commons-crypto/xwiki-commons-crypto-pkix/src/main/java/org/xwiki/crypto/pkix/CertifyingSigner.java | CertifyingSigner.getInstance | public static CertifyingSigner getInstance(boolean forSigning, CertifiedKeyPair certifier, SignerFactory factory) {
"""
Get a certifying signer instance from the given signer factory for a given certifier.
@param forSigning true for signing, and false for verifying.
@param certifier the certified key pair of the certifier.
@param factory a signer factory to create the signer.
@return a certifying signer.
"""
return new CertifyingSigner(certifier.getCertificate(),
factory.getInstance(forSigning, certifier.getPrivateKey()));
} | java | public static CertifyingSigner getInstance(boolean forSigning, CertifiedKeyPair certifier, SignerFactory factory)
{
return new CertifyingSigner(certifier.getCertificate(),
factory.getInstance(forSigning, certifier.getPrivateKey()));
} | [
"public",
"static",
"CertifyingSigner",
"getInstance",
"(",
"boolean",
"forSigning",
",",
"CertifiedKeyPair",
"certifier",
",",
"SignerFactory",
"factory",
")",
"{",
"return",
"new",
"CertifyingSigner",
"(",
"certifier",
".",
"getCertificate",
"(",
")",
",",
"factor... | Get a certifying signer instance from the given signer factory for a given certifier.
@param forSigning true for signing, and false for verifying.
@param certifier the certified key pair of the certifier.
@param factory a signer factory to create the signer.
@return a certifying signer. | [
"Get",
"a",
"certifying",
"signer",
"instance",
"from",
"the",
"given",
"signer",
"factory",
"for",
"a",
"given",
"certifier",
"."
] | train | https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-crypto/xwiki-commons-crypto-pkix/src/main/java/org/xwiki/crypto/pkix/CertifyingSigner.java#L67-L71 |
twitter/hraven | hraven-etl/src/main/java/com/twitter/hraven/etl/FileLister.java | FileLister.getListFilesToProcess | public static FileStatus[] getListFilesToProcess(long maxFileSize, boolean recurse,
FileSystem hdfs, Path inputPath, JobFileModifiedRangePathFilter pathFilter)
throws IOException {
"""
looks at the src path and fetches the list of files to process
confirms that the size of files
is less than the maxFileSize
hbase cell can't store files bigger than maxFileSize,
hence no need to consider them for rawloading
Reference: {@link https://github.com/twitter/hraven/issues/59}
@param maxFileSize - max #bytes to be stored in an hbase cell
@param recurse - whether to recurse or not
@param hdfs - filesystem to be looked at
@param inputPath - root dir of the path containing history files
@param jobFileModifiedRangePathFilter - to filter out files
@return - array of FileStatus of files to be processed
@throws IOException
"""
LOG.info(" in getListFilesToProcess maxFileSize=" + maxFileSize
+ " inputPath= " + inputPath.toUri());
FileStatus[] origList = listFiles(recurse, hdfs, inputPath, pathFilter);
if (origList == null) {
LOG.info(" No files found, orig list returning 0");
return new FileStatus[0];
}
return pruneFileListBySize(maxFileSize, origList, hdfs, inputPath);
} | java | public static FileStatus[] getListFilesToProcess(long maxFileSize, boolean recurse,
FileSystem hdfs, Path inputPath, JobFileModifiedRangePathFilter pathFilter)
throws IOException {
LOG.info(" in getListFilesToProcess maxFileSize=" + maxFileSize
+ " inputPath= " + inputPath.toUri());
FileStatus[] origList = listFiles(recurse, hdfs, inputPath, pathFilter);
if (origList == null) {
LOG.info(" No files found, orig list returning 0");
return new FileStatus[0];
}
return pruneFileListBySize(maxFileSize, origList, hdfs, inputPath);
} | [
"public",
"static",
"FileStatus",
"[",
"]",
"getListFilesToProcess",
"(",
"long",
"maxFileSize",
",",
"boolean",
"recurse",
",",
"FileSystem",
"hdfs",
",",
"Path",
"inputPath",
",",
"JobFileModifiedRangePathFilter",
"pathFilter",
")",
"throws",
"IOException",
"{",
"... | looks at the src path and fetches the list of files to process
confirms that the size of files
is less than the maxFileSize
hbase cell can't store files bigger than maxFileSize,
hence no need to consider them for rawloading
Reference: {@link https://github.com/twitter/hraven/issues/59}
@param maxFileSize - max #bytes to be stored in an hbase cell
@param recurse - whether to recurse or not
@param hdfs - filesystem to be looked at
@param inputPath - root dir of the path containing history files
@param jobFileModifiedRangePathFilter - to filter out files
@return - array of FileStatus of files to be processed
@throws IOException | [
"looks",
"at",
"the",
"src",
"path",
"and",
"fetches",
"the",
"list",
"of",
"files",
"to",
"process",
"confirms",
"that",
"the",
"size",
"of",
"files",
"is",
"less",
"than",
"the",
"maxFileSize",
"hbase",
"cell",
"can",
"t",
"store",
"files",
"bigger",
"... | train | https://github.com/twitter/hraven/blob/e35996b6e2f016bcd18db0bad320be7c93d95208/hraven-etl/src/main/java/com/twitter/hraven/etl/FileLister.java#L115-L127 |
scribejava/scribejava | scribejava-core/src/main/java/com/github/scribejava/core/oauth/OAuth20Service.java | OAuth20Service.getAccessTokenClientCredentialsGrant | public Future<OAuth2AccessToken> getAccessTokenClientCredentialsGrant(
OAuthAsyncRequestCallback<OAuth2AccessToken> callback) {
"""
Start the request to retrieve the access token using client-credentials grant. The optionally provided callback
will be called with the Token when it is available.
@param callback optional callback
@return Future
"""
final OAuthRequest request = createAccessTokenClientCredentialsGrantRequest(null);
return sendAccessTokenRequestAsync(request, callback);
} | java | public Future<OAuth2AccessToken> getAccessTokenClientCredentialsGrant(
OAuthAsyncRequestCallback<OAuth2AccessToken> callback) {
final OAuthRequest request = createAccessTokenClientCredentialsGrantRequest(null);
return sendAccessTokenRequestAsync(request, callback);
} | [
"public",
"Future",
"<",
"OAuth2AccessToken",
">",
"getAccessTokenClientCredentialsGrant",
"(",
"OAuthAsyncRequestCallback",
"<",
"OAuth2AccessToken",
">",
"callback",
")",
"{",
"final",
"OAuthRequest",
"request",
"=",
"createAccessTokenClientCredentialsGrantRequest",
"(",
"n... | Start the request to retrieve the access token using client-credentials grant. The optionally provided callback
will be called with the Token when it is available.
@param callback optional callback
@return Future | [
"Start",
"the",
"request",
"to",
"retrieve",
"the",
"access",
"token",
"using",
"client",
"-",
"credentials",
"grant",
".",
"The",
"optionally",
"provided",
"callback",
"will",
"be",
"called",
"with",
"the",
"Token",
"when",
"it",
"is",
"available",
"."
] | train | https://github.com/scribejava/scribejava/blob/030d76872fe371a84b5d05c6c3c33c34e8f611f1/scribejava-core/src/main/java/com/github/scribejava/core/oauth/OAuth20Service.java#L266-L271 |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/internal/VirtualHostMap.java | VirtualHostMap.notifyStarted | public static synchronized void notifyStarted(HttpEndpointImpl endpoint, String resolvedHostName, int port, boolean isHttps) {
"""
Add an endpoint that has started listening, and notify associated virtual hosts
@param endpoint The HttpEndpointImpl that owns the started chain/listener
@param resolvedHostName A hostname that can be used in messages (based on endpoint configuration, something other than *)
@param port The port the endpoint is listening on
@param isHttps True if this is an SSL port
@see HttpChain#chainStarted(com.ibm.websphere.channelfw.ChainData)
"""
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(tc, "Notify endpoint started: " + endpoint, resolvedHostName, port, isHttps, defaultHost.get(), alternateHostSelector);
}
if (alternateHostSelector.get() == null) {
if (defaultHost.get() != null) {
defaultHost.get().listenerStarted(endpoint, resolvedHostName, port, isHttps);
}
} else {
alternateHostSelector.get().alternateNotifyStarted(endpoint, resolvedHostName, port, isHttps);
}
} | java | public static synchronized void notifyStarted(HttpEndpointImpl endpoint, String resolvedHostName, int port, boolean isHttps) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(tc, "Notify endpoint started: " + endpoint, resolvedHostName, port, isHttps, defaultHost.get(), alternateHostSelector);
}
if (alternateHostSelector.get() == null) {
if (defaultHost.get() != null) {
defaultHost.get().listenerStarted(endpoint, resolvedHostName, port, isHttps);
}
} else {
alternateHostSelector.get().alternateNotifyStarted(endpoint, resolvedHostName, port, isHttps);
}
} | [
"public",
"static",
"synchronized",
"void",
"notifyStarted",
"(",
"HttpEndpointImpl",
"endpoint",
",",
"String",
"resolvedHostName",
",",
"int",
"port",
",",
"boolean",
"isHttps",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
... | Add an endpoint that has started listening, and notify associated virtual hosts
@param endpoint The HttpEndpointImpl that owns the started chain/listener
@param resolvedHostName A hostname that can be used in messages (based on endpoint configuration, something other than *)
@param port The port the endpoint is listening on
@param isHttps True if this is an SSL port
@see HttpChain#chainStarted(com.ibm.websphere.channelfw.ChainData) | [
"Add",
"an",
"endpoint",
"that",
"has",
"started",
"listening",
"and",
"notify",
"associated",
"virtual",
"hosts"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/internal/VirtualHostMap.java#L198-L210 |
nguillaumin/slick2d-maven | slick2d-core/src/main/java/org/newdawn/slick/Animation.java | Animation.addFrame | public void addFrame(Image frame, int duration) {
"""
Add animation frame to the animation
@param frame The image to display for the frame
@param duration The duration to display the frame for
"""
if (duration == 0) {
Log.error("Invalid duration: "+duration);
throw new RuntimeException("Invalid duration: "+duration);
}
if (frames.isEmpty()) {
nextChange = (int) (duration / speed);
}
frames.add(new Frame(frame, duration));
currentFrame = 0;
} | java | public void addFrame(Image frame, int duration) {
if (duration == 0) {
Log.error("Invalid duration: "+duration);
throw new RuntimeException("Invalid duration: "+duration);
}
if (frames.isEmpty()) {
nextChange = (int) (duration / speed);
}
frames.add(new Frame(frame, duration));
currentFrame = 0;
} | [
"public",
"void",
"addFrame",
"(",
"Image",
"frame",
",",
"int",
"duration",
")",
"{",
"if",
"(",
"duration",
"==",
"0",
")",
"{",
"Log",
".",
"error",
"(",
"\"Invalid duration: \"",
"+",
"duration",
")",
";",
"throw",
"new",
"RuntimeException",
"(",
"\"... | Add animation frame to the animation
@param frame The image to display for the frame
@param duration The duration to display the frame for | [
"Add",
"animation",
"frame",
"to",
"the",
"animation"
] | train | https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Animation.java#L298-L310 |
threerings/nenya | core/src/main/java/com/threerings/chat/SubtitleChatOverlay.java | SubtitleChatOverlay.getHistorySubtitle | protected ChatGlyph getHistorySubtitle (int index, Graphics2D layoutGfx) {
"""
Get the glyph for the specified history index, creating if necessary.
"""
// do a brute search (over a small set) for an already-created subtitle
for (int ii = 0, nn = _showingHistory.size(); ii < nn; ii++) {
ChatGlyph cg = _showingHistory.get(ii);
if (cg.histIndex == index) {
return cg;
}
}
// it looks like we have to create a new one: expensive!
ChatGlyph cg = createHistorySubtitle(index, layoutGfx);
cg.histIndex = index;
cg.setDim(_dimmed);
_showingHistory.add(cg);
return cg;
} | java | protected ChatGlyph getHistorySubtitle (int index, Graphics2D layoutGfx)
{
// do a brute search (over a small set) for an already-created subtitle
for (int ii = 0, nn = _showingHistory.size(); ii < nn; ii++) {
ChatGlyph cg = _showingHistory.get(ii);
if (cg.histIndex == index) {
return cg;
}
}
// it looks like we have to create a new one: expensive!
ChatGlyph cg = createHistorySubtitle(index, layoutGfx);
cg.histIndex = index;
cg.setDim(_dimmed);
_showingHistory.add(cg);
return cg;
} | [
"protected",
"ChatGlyph",
"getHistorySubtitle",
"(",
"int",
"index",
",",
"Graphics2D",
"layoutGfx",
")",
"{",
"// do a brute search (over a small set) for an already-created subtitle",
"for",
"(",
"int",
"ii",
"=",
"0",
",",
"nn",
"=",
"_showingHistory",
".",
"size",
... | Get the glyph for the specified history index, creating if necessary. | [
"Get",
"the",
"glyph",
"for",
"the",
"specified",
"history",
"index",
"creating",
"if",
"necessary",
"."
] | train | https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/chat/SubtitleChatOverlay.java#L484-L500 |
osmdroid/osmdroid | OpenStreetMapViewer/src/main/java/org/osmdroid/samplefragments/data/HeatMap.java | HeatMap.createPolygon | private Overlay createPolygon(BoundingBox key, Integer value, int redthreshold, int orangethreshold) {
"""
converts the bounding box into a color filled polygon
@param key
@param value
@param redthreshold
@param orangethreshold
@return
"""
Polygon polygon = new Polygon(mMapView);
if (value < orangethreshold)
polygon.setFillColor(Color.parseColor(alpha + yellow));
else if (value < redthreshold)
polygon.setFillColor(Color.parseColor(alpha + orange));
else if (value >= redthreshold)
polygon.setFillColor(Color.parseColor(alpha + red));
else {
//no polygon
}
polygon.setStrokeColor(polygon.getFillColor());
//if you set this to something like 20f and have a low alpha setting,
// you'll end with a gaussian blur like effect
polygon.setStrokeWidth(0f);
List<GeoPoint> pts = new ArrayList<GeoPoint>();
pts.add(new GeoPoint(key.getLatNorth(), key.getLonWest()));
pts.add(new GeoPoint(key.getLatNorth(), key.getLonEast()));
pts.add(new GeoPoint(key.getLatSouth(), key.getLonEast()));
pts.add(new GeoPoint(key.getLatSouth(), key.getLonWest()));
polygon.setPoints(pts);
return polygon;
} | java | private Overlay createPolygon(BoundingBox key, Integer value, int redthreshold, int orangethreshold) {
Polygon polygon = new Polygon(mMapView);
if (value < orangethreshold)
polygon.setFillColor(Color.parseColor(alpha + yellow));
else if (value < redthreshold)
polygon.setFillColor(Color.parseColor(alpha + orange));
else if (value >= redthreshold)
polygon.setFillColor(Color.parseColor(alpha + red));
else {
//no polygon
}
polygon.setStrokeColor(polygon.getFillColor());
//if you set this to something like 20f and have a low alpha setting,
// you'll end with a gaussian blur like effect
polygon.setStrokeWidth(0f);
List<GeoPoint> pts = new ArrayList<GeoPoint>();
pts.add(new GeoPoint(key.getLatNorth(), key.getLonWest()));
pts.add(new GeoPoint(key.getLatNorth(), key.getLonEast()));
pts.add(new GeoPoint(key.getLatSouth(), key.getLonEast()));
pts.add(new GeoPoint(key.getLatSouth(), key.getLonWest()));
polygon.setPoints(pts);
return polygon;
} | [
"private",
"Overlay",
"createPolygon",
"(",
"BoundingBox",
"key",
",",
"Integer",
"value",
",",
"int",
"redthreshold",
",",
"int",
"orangethreshold",
")",
"{",
"Polygon",
"polygon",
"=",
"new",
"Polygon",
"(",
"mMapView",
")",
";",
"if",
"(",
"value",
"<",
... | converts the bounding box into a color filled polygon
@param key
@param value
@param redthreshold
@param orangethreshold
@return | [
"converts",
"the",
"bounding",
"box",
"into",
"a",
"color",
"filled",
"polygon"
] | train | https://github.com/osmdroid/osmdroid/blob/3b178b2f078497dd88c137110e87aafe45ad2b16/OpenStreetMapViewer/src/main/java/org/osmdroid/samplefragments/data/HeatMap.java#L289-L312 |
ltearno/hexa.tools | hexa.persistence/src/main/java/fr/lteconsulting/hexa/persistence/client/hqlParser.java | hqlParser.selectStatement | public final hqlParser.selectStatement_return selectStatement() throws RecognitionException {
"""
hql.g:208:1: selectStatement : q= queryRule -> ^( QUERY[\"query\"] $q) ;
"""
hqlParser.selectStatement_return retval = new hqlParser.selectStatement_return();
retval.start = input.LT(1);
CommonTree root_0 = null;
ParserRuleReturnScope q =null;
RewriteRuleSubtreeStream stream_queryRule=new RewriteRuleSubtreeStream(adaptor,"rule queryRule");
try {
// hql.g:209:2: (q= queryRule -> ^( QUERY[\"query\"] $q) )
// hql.g:209:4: q= queryRule
{
pushFollow(FOLLOW_queryRule_in_selectStatement802);
q=queryRule();
state._fsp--;
stream_queryRule.add(q.getTree());
// AST REWRITE
// elements: q
// token labels:
// rule labels: retval, q
// token list labels:
// rule list labels:
// wildcard labels:
retval.tree = root_0;
RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
RewriteRuleSubtreeStream stream_q=new RewriteRuleSubtreeStream(adaptor,"rule q",q!=null?q.getTree():null);
root_0 = (CommonTree)adaptor.nil();
// 210:2: -> ^( QUERY[\"query\"] $q)
{
// hql.g:210:5: ^( QUERY[\"query\"] $q)
{
CommonTree root_1 = (CommonTree)adaptor.nil();
root_1 = (CommonTree)adaptor.becomeRoot(adaptor.create(QUERY, "query"), root_1);
adaptor.addChild(root_1, stream_q.nextTree());
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
retval.stop = input.LT(-1);
retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
}
finally {
// do for sure before leaving
}
return retval;
} | java | public final hqlParser.selectStatement_return selectStatement() throws RecognitionException {
hqlParser.selectStatement_return retval = new hqlParser.selectStatement_return();
retval.start = input.LT(1);
CommonTree root_0 = null;
ParserRuleReturnScope q =null;
RewriteRuleSubtreeStream stream_queryRule=new RewriteRuleSubtreeStream(adaptor,"rule queryRule");
try {
// hql.g:209:2: (q= queryRule -> ^( QUERY[\"query\"] $q) )
// hql.g:209:4: q= queryRule
{
pushFollow(FOLLOW_queryRule_in_selectStatement802);
q=queryRule();
state._fsp--;
stream_queryRule.add(q.getTree());
// AST REWRITE
// elements: q
// token labels:
// rule labels: retval, q
// token list labels:
// rule list labels:
// wildcard labels:
retval.tree = root_0;
RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null);
RewriteRuleSubtreeStream stream_q=new RewriteRuleSubtreeStream(adaptor,"rule q",q!=null?q.getTree():null);
root_0 = (CommonTree)adaptor.nil();
// 210:2: -> ^( QUERY[\"query\"] $q)
{
// hql.g:210:5: ^( QUERY[\"query\"] $q)
{
CommonTree root_1 = (CommonTree)adaptor.nil();
root_1 = (CommonTree)adaptor.becomeRoot(adaptor.create(QUERY, "query"), root_1);
adaptor.addChild(root_1, stream_q.nextTree());
adaptor.addChild(root_0, root_1);
}
}
retval.tree = root_0;
}
retval.stop = input.LT(-1);
retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
}
finally {
// do for sure before leaving
}
return retval;
} | [
"public",
"final",
"hqlParser",
".",
"selectStatement_return",
"selectStatement",
"(",
")",
"throws",
"RecognitionException",
"{",
"hqlParser",
".",
"selectStatement_return",
"retval",
"=",
"new",
"hqlParser",
".",
"selectStatement_return",
"(",
")",
";",
"retval",
".... | hql.g:208:1: selectStatement : q= queryRule -> ^( QUERY[\"query\"] $q) ; | [
"hql",
".",
"g",
":",
"208",
":",
"1",
":",
"selectStatement",
":",
"q",
"=",
"queryRule",
"-",
">",
"^",
"(",
"QUERY",
"[",
"\\",
"query",
"\\",
"]",
"$q",
")",
";"
] | train | https://github.com/ltearno/hexa.tools/blob/604c804901b1bb13fe10b3823cc4a639f8993363/hexa.persistence/src/main/java/fr/lteconsulting/hexa/persistence/client/hqlParser.java#L1025-L1088 |
apache/incubator-gobblin | gobblin-utility/src/main/java/org/apache/gobblin/broker/SharedResourcesBrokerUtils.java | SharedResourcesBrokerUtils.isScopeAncestor | static <S extends ScopeType<S>> boolean isScopeAncestor(ScopeWrapper<S> scope, ScopeWrapper<S> possibleAncestor) {
"""
Determine if a {@link ScopeWrapper} is an ancestor of another {@link ScopeWrapper}.
"""
Queue<ScopeWrapper<S>> ancestors = new LinkedList<>();
ancestors.add(scope);
while (true) {
if (ancestors.isEmpty()) {
return false;
}
if (ancestors.peek().equals(possibleAncestor)) {
return true;
}
ancestors.addAll(ancestors.poll().getParentScopes());
}
} | java | static <S extends ScopeType<S>> boolean isScopeAncestor(ScopeWrapper<S> scope, ScopeWrapper<S> possibleAncestor) {
Queue<ScopeWrapper<S>> ancestors = new LinkedList<>();
ancestors.add(scope);
while (true) {
if (ancestors.isEmpty()) {
return false;
}
if (ancestors.peek().equals(possibleAncestor)) {
return true;
}
ancestors.addAll(ancestors.poll().getParentScopes());
}
} | [
"static",
"<",
"S",
"extends",
"ScopeType",
"<",
"S",
">",
">",
"boolean",
"isScopeAncestor",
"(",
"ScopeWrapper",
"<",
"S",
">",
"scope",
",",
"ScopeWrapper",
"<",
"S",
">",
"possibleAncestor",
")",
"{",
"Queue",
"<",
"ScopeWrapper",
"<",
"S",
">>",
"an... | Determine if a {@link ScopeWrapper} is an ancestor of another {@link ScopeWrapper}. | [
"Determine",
"if",
"a",
"{"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/broker/SharedResourcesBrokerUtils.java#L61-L73 |
google/j2objc | jre_emul/openjdk/src/share/classes/java/math/BigDecimal.java | BigDecimal.divideAndRound | private static BigDecimal divideAndRound(BigInteger bdividend,
long ldivisor, int scale, int roundingMode, int preferredScale) {
"""
Internally used for division operation for division {@code BigInteger}
by {@code long}.
The returned {@code BigDecimal} object is the quotient whose scale is set
to the passed in scale. If the remainder is not zero, it will be rounded
based on the passed in roundingMode. Also, if the remainder is zero and
the last parameter, i.e. preferredScale is NOT equal to scale, the
trailing zeros of the result is stripped to match the preferredScale.
"""
boolean isRemainderZero; // record remainder is zero or not
int qsign; // quotient sign
long r = 0; // store quotient & remainder in long
MutableBigInteger mq = null; // store quotient
// Descend into mutables for faster remainder checks
MutableBigInteger mdividend = new MutableBigInteger(bdividend.mag);
mq = new MutableBigInteger();
r = mdividend.divide(ldivisor, mq);
isRemainderZero = (r == 0);
qsign = (ldivisor < 0) ? -bdividend.signum : bdividend.signum;
if (!isRemainderZero) {
if(needIncrement(ldivisor, roundingMode, qsign, mq, r)) {
mq.add(MutableBigInteger.ONE);
}
return mq.toBigDecimal(qsign, scale);
} else {
if (preferredScale != scale) {
long compactVal = mq.toCompactValue(qsign);
if(compactVal!=INFLATED) {
return createAndStripZerosToMatchScale(compactVal, scale, preferredScale);
}
BigInteger intVal = mq.toBigInteger(qsign);
return createAndStripZerosToMatchScale(intVal,scale, preferredScale);
} else {
return mq.toBigDecimal(qsign, scale);
}
}
} | java | private static BigDecimal divideAndRound(BigInteger bdividend,
long ldivisor, int scale, int roundingMode, int preferredScale) {
boolean isRemainderZero; // record remainder is zero or not
int qsign; // quotient sign
long r = 0; // store quotient & remainder in long
MutableBigInteger mq = null; // store quotient
// Descend into mutables for faster remainder checks
MutableBigInteger mdividend = new MutableBigInteger(bdividend.mag);
mq = new MutableBigInteger();
r = mdividend.divide(ldivisor, mq);
isRemainderZero = (r == 0);
qsign = (ldivisor < 0) ? -bdividend.signum : bdividend.signum;
if (!isRemainderZero) {
if(needIncrement(ldivisor, roundingMode, qsign, mq, r)) {
mq.add(MutableBigInteger.ONE);
}
return mq.toBigDecimal(qsign, scale);
} else {
if (preferredScale != scale) {
long compactVal = mq.toCompactValue(qsign);
if(compactVal!=INFLATED) {
return createAndStripZerosToMatchScale(compactVal, scale, preferredScale);
}
BigInteger intVal = mq.toBigInteger(qsign);
return createAndStripZerosToMatchScale(intVal,scale, preferredScale);
} else {
return mq.toBigDecimal(qsign, scale);
}
}
} | [
"private",
"static",
"BigDecimal",
"divideAndRound",
"(",
"BigInteger",
"bdividend",
",",
"long",
"ldivisor",
",",
"int",
"scale",
",",
"int",
"roundingMode",
",",
"int",
"preferredScale",
")",
"{",
"boolean",
"isRemainderZero",
";",
"// record remainder is zero or no... | Internally used for division operation for division {@code BigInteger}
by {@code long}.
The returned {@code BigDecimal} object is the quotient whose scale is set
to the passed in scale. If the remainder is not zero, it will be rounded
based on the passed in roundingMode. Also, if the remainder is zero and
the last parameter, i.e. preferredScale is NOT equal to scale, the
trailing zeros of the result is stripped to match the preferredScale. | [
"Internally",
"used",
"for",
"division",
"operation",
"for",
"division",
"{"
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/openjdk/src/share/classes/java/math/BigDecimal.java#L4241-L4270 |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/algorithm/ahocorasick/trie/Trie.java | Trie.getState | private static State getState(State currentState, Character character) {
"""
跳转到下一个状态
@param currentState 当前状态
@param character 接受字符
@return 跳转结果
"""
State newCurrentState = currentState.nextState(character); // 先按success跳转
while (newCurrentState == null) // 跳转失败的话,按failure跳转
{
currentState = currentState.failure();
newCurrentState = currentState.nextState(character);
}
return newCurrentState;
} | java | private static State getState(State currentState, Character character)
{
State newCurrentState = currentState.nextState(character); // 先按success跳转
while (newCurrentState == null) // 跳转失败的话,按failure跳转
{
currentState = currentState.failure();
newCurrentState = currentState.nextState(character);
}
return newCurrentState;
} | [
"private",
"static",
"State",
"getState",
"(",
"State",
"currentState",
",",
"Character",
"character",
")",
"{",
"State",
"newCurrentState",
"=",
"currentState",
".",
"nextState",
"(",
"character",
")",
";",
"// 先按success跳转",
"while",
"(",
"newCurrentState",
"==",... | 跳转到下一个状态
@param currentState 当前状态
@param character 接受字符
@return 跳转结果 | [
"跳转到下一个状态"
] | train | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/algorithm/ahocorasick/trie/Trie.java#L208-L217 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/cr/crvserver_binding.java | crvserver_binding.get | public static crvserver_binding get(nitro_service service, String name) throws Exception {
"""
Use this API to fetch crvserver_binding resource of given name .
"""
crvserver_binding obj = new crvserver_binding();
obj.set_name(name);
crvserver_binding response = (crvserver_binding) obj.get_resource(service);
return response;
} | java | public static crvserver_binding get(nitro_service service, String name) throws Exception{
crvserver_binding obj = new crvserver_binding();
obj.set_name(name);
crvserver_binding response = (crvserver_binding) obj.get_resource(service);
return response;
} | [
"public",
"static",
"crvserver_binding",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"name",
")",
"throws",
"Exception",
"{",
"crvserver_binding",
"obj",
"=",
"new",
"crvserver_binding",
"(",
")",
";",
"obj",
".",
"set_name",
"(",
"name",
")",
";",
... | Use this API to fetch crvserver_binding resource of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"crvserver_binding",
"resource",
"of",
"given",
"name",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/cr/crvserver_binding.java#L158-L163 |
languagetool-org/languagetool | languagetool-core/src/main/java/org/languagetool/JLanguageTool.java | JLanguageTool.getUnknownWords | public List<String> getUnknownWords() {
"""
Get the alphabetically sorted list of unknown words in the latest run of one of the {@link #check(String)} methods.
@throws IllegalStateException if {@link #setListUnknownWords(boolean)} has been set to {@code false}
"""
if (!listUnknownWords) {
throw new IllegalStateException("listUnknownWords is set to false, unknown words not stored");
}
List<String> words = new ArrayList<>(unknownWords);
Collections.sort(words);
return words;
} | java | public List<String> getUnknownWords() {
if (!listUnknownWords) {
throw new IllegalStateException("listUnknownWords is set to false, unknown words not stored");
}
List<String> words = new ArrayList<>(unknownWords);
Collections.sort(words);
return words;
} | [
"public",
"List",
"<",
"String",
">",
"getUnknownWords",
"(",
")",
"{",
"if",
"(",
"!",
"listUnknownWords",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"listUnknownWords is set to false, unknown words not stored\"",
")",
";",
"}",
"List",
"<",
"String"... | Get the alphabetically sorted list of unknown words in the latest run of one of the {@link #check(String)} methods.
@throws IllegalStateException if {@link #setListUnknownWords(boolean)} has been set to {@code false} | [
"Get",
"the",
"alphabetically",
"sorted",
"list",
"of",
"unknown",
"words",
"in",
"the",
"latest",
"run",
"of",
"one",
"of",
"the",
"{"
] | train | https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/JLanguageTool.java#L918-L925 |
lessthanoptimal/BoofCV | integration/boofcv-swing/src/main/java/boofcv/gui/BoofSwingUtil.java | BoofSwingUtil.selectZoomToFitInDisplay | public static double selectZoomToFitInDisplay( int width , int height ) {
"""
Figures out what the scale should be to fit the window inside the default display
"""
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
double w = screenSize.getWidth();
double h = screenSize.getHeight();
double scale = Math.max(width/w,height/h);
if( scale > 1.0 ) {
return 1.0/scale;
} else {
return 1.0;
}
} | java | public static double selectZoomToFitInDisplay( int width , int height ) {
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
double w = screenSize.getWidth();
double h = screenSize.getHeight();
double scale = Math.max(width/w,height/h);
if( scale > 1.0 ) {
return 1.0/scale;
} else {
return 1.0;
}
} | [
"public",
"static",
"double",
"selectZoomToFitInDisplay",
"(",
"int",
"width",
",",
"int",
"height",
")",
"{",
"Dimension",
"screenSize",
"=",
"Toolkit",
".",
"getDefaultToolkit",
"(",
")",
".",
"getScreenSize",
"(",
")",
";",
"double",
"w",
"=",
"screenSize",... | Figures out what the scale should be to fit the window inside the default display | [
"Figures",
"out",
"what",
"the",
"scale",
"should",
"be",
"to",
"fit",
"the",
"window",
"inside",
"the",
"default",
"display"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/integration/boofcv-swing/src/main/java/boofcv/gui/BoofSwingUtil.java#L228-L240 |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/WebAppSecurityCollaboratorImpl.java | WebAppSecurityCollaboratorImpl.logAuditEntriesBeforeAuthn | private void logAuditEntriesBeforeAuthn(WebReply webReply, Subject receivedSubject, String uriName, WebRequest webRequest) {
"""
no null check for webReply object, so make sure it is not null upon calling this method.
"""
AuthenticationResult authResult;
if (webReply instanceof PermitReply) {
authResult = new AuthenticationResult(AuthResult.SUCCESS, receivedSubject, null, null, AuditEvent.OUTCOME_SUCCESS);
} else {
authResult = new AuthenticationResult(AuthResult.FAILURE, receivedSubject, null, null, AuditEvent.OUTCOME_FAILURE);
}
int statusCode = Integer.valueOf(webReply.getStatusCode());
Audit.audit(Audit.EventID.SECURITY_AUTHN_01, webRequest, authResult, statusCode);
Audit.audit(Audit.EventID.SECURITY_AUTHZ_01, webRequest, authResult, uriName, statusCode);
} | java | private void logAuditEntriesBeforeAuthn(WebReply webReply, Subject receivedSubject, String uriName, WebRequest webRequest) {
AuthenticationResult authResult;
if (webReply instanceof PermitReply) {
authResult = new AuthenticationResult(AuthResult.SUCCESS, receivedSubject, null, null, AuditEvent.OUTCOME_SUCCESS);
} else {
authResult = new AuthenticationResult(AuthResult.FAILURE, receivedSubject, null, null, AuditEvent.OUTCOME_FAILURE);
}
int statusCode = Integer.valueOf(webReply.getStatusCode());
Audit.audit(Audit.EventID.SECURITY_AUTHN_01, webRequest, authResult, statusCode);
Audit.audit(Audit.EventID.SECURITY_AUTHZ_01, webRequest, authResult, uriName, statusCode);
} | [
"private",
"void",
"logAuditEntriesBeforeAuthn",
"(",
"WebReply",
"webReply",
",",
"Subject",
"receivedSubject",
",",
"String",
"uriName",
",",
"WebRequest",
"webRequest",
")",
"{",
"AuthenticationResult",
"authResult",
";",
"if",
"(",
"webReply",
"instanceof",
"Permi... | no null check for webReply object, so make sure it is not null upon calling this method. | [
"no",
"null",
"check",
"for",
"webReply",
"object",
"so",
"make",
"sure",
"it",
"is",
"not",
"null",
"upon",
"calling",
"this",
"method",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/WebAppSecurityCollaboratorImpl.java#L1696-L1706 |
apache/incubator-gobblin | gobblin-modules/gobblin-kafka-common/src/main/java/org/apache/gobblin/source/extractor/extract/kafka/KafkaUtils.java | KafkaUtils.setPartitionAvgRecordMillis | public static void setPartitionAvgRecordMillis(State state, KafkaPartition partition, double millis) {
"""
Set the average time in milliseconds to pull a record of a partition, which will be stored in property
"[topicname].[partitionid].avg.record.millis".
"""
state.setProp(
getPartitionPropName(partition.getTopicName(), partition.getId()) + "." + KafkaSource.AVG_RECORD_MILLIS,
millis);
} | java | public static void setPartitionAvgRecordMillis(State state, KafkaPartition partition, double millis) {
state.setProp(
getPartitionPropName(partition.getTopicName(), partition.getId()) + "." + KafkaSource.AVG_RECORD_MILLIS,
millis);
} | [
"public",
"static",
"void",
"setPartitionAvgRecordMillis",
"(",
"State",
"state",
",",
"KafkaPartition",
"partition",
",",
"double",
"millis",
")",
"{",
"state",
".",
"setProp",
"(",
"getPartitionPropName",
"(",
"partition",
".",
"getTopicName",
"(",
")",
",",
"... | Set the average time in milliseconds to pull a record of a partition, which will be stored in property
"[topicname].[partitionid].avg.record.millis". | [
"Set",
"the",
"average",
"time",
"in",
"milliseconds",
"to",
"pull",
"a",
"record",
"of",
"a",
"partition",
"which",
"will",
"be",
"stored",
"in",
"property",
"[",
"topicname",
"]",
".",
"[",
"partitionid",
"]",
".",
"avg",
".",
"record",
".",
"millis",
... | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-modules/gobblin-kafka-common/src/main/java/org/apache/gobblin/source/extractor/extract/kafka/KafkaUtils.java#L167-L171 |
Appendium/objectlabkit | utils/src/main/java/net/objectlab/kit/util/BigDecimalUtil.java | BigDecimalUtil.setScale | public static BigDecimal setScale(final BigDecimal bd, final int scale) {
"""
returns a new BigDecimal with correct scale.
@param bd
@return new bd or null
"""
return setScale(bd, scale, BigDecimal.ROUND_HALF_UP);
} | java | public static BigDecimal setScale(final BigDecimal bd, final int scale) {
return setScale(bd, scale, BigDecimal.ROUND_HALF_UP);
} | [
"public",
"static",
"BigDecimal",
"setScale",
"(",
"final",
"BigDecimal",
"bd",
",",
"final",
"int",
"scale",
")",
"{",
"return",
"setScale",
"(",
"bd",
",",
"scale",
",",
"BigDecimal",
".",
"ROUND_HALF_UP",
")",
";",
"}"
] | returns a new BigDecimal with correct scale.
@param bd
@return new bd or null | [
"returns",
"a",
"new",
"BigDecimal",
"with",
"correct",
"scale",
"."
] | train | https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/utils/src/main/java/net/objectlab/kit/util/BigDecimalUtil.java#L407-L409 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/dns/dnszone_domain_binding.java | dnszone_domain_binding.count_filtered | public static long count_filtered(nitro_service service, String zonename, String filter) throws Exception {
"""
Use this API to count the filtered set of dnszone_domain_binding resources.
filter string should be in JSON format.eg: "port:80,servicetype:HTTP".
"""
dnszone_domain_binding obj = new dnszone_domain_binding();
obj.set_zonename(zonename);
options option = new options();
option.set_count(true);
option.set_filter(filter);
dnszone_domain_binding[] response = (dnszone_domain_binding[]) obj.getfiltered(service, option);
if (response != null) {
return response[0].__count;
}
return 0;
} | java | public static long count_filtered(nitro_service service, String zonename, String filter) throws Exception{
dnszone_domain_binding obj = new dnszone_domain_binding();
obj.set_zonename(zonename);
options option = new options();
option.set_count(true);
option.set_filter(filter);
dnszone_domain_binding[] response = (dnszone_domain_binding[]) obj.getfiltered(service, option);
if (response != null) {
return response[0].__count;
}
return 0;
} | [
"public",
"static",
"long",
"count_filtered",
"(",
"nitro_service",
"service",
",",
"String",
"zonename",
",",
"String",
"filter",
")",
"throws",
"Exception",
"{",
"dnszone_domain_binding",
"obj",
"=",
"new",
"dnszone_domain_binding",
"(",
")",
";",
"obj",
".",
... | Use this API to count the filtered set of dnszone_domain_binding resources.
filter string should be in JSON format.eg: "port:80,servicetype:HTTP". | [
"Use",
"this",
"API",
"to",
"count",
"the",
"filtered",
"set",
"of",
"dnszone_domain_binding",
"resources",
".",
"filter",
"string",
"should",
"be",
"in",
"JSON",
"format",
".",
"eg",
":",
"port",
":",
"80",
"servicetype",
":",
"HTTP",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/dns/dnszone_domain_binding.java#L174-L185 |
GwtMaterialDesign/gwt-material-addins | src/main/java/gwt/material/design/addins/client/cutout/MaterialCutOut.java | MaterialCutOut.setupCutOutPosition | protected void setupCutOutPosition(Element cutOut, Element relativeTo, int padding, boolean circle) {
"""
Setups the cut out position when the screen changes size or is scrolled.
"""
float top = relativeTo.getOffsetTop() - (Math.max($("html").scrollTop(), $("body").scrollTop()));
float left = relativeTo.getAbsoluteLeft();
float width = relativeTo.getOffsetWidth();
float height = relativeTo.getOffsetHeight();
if (circle) {
if (width != height) {
float dif = width - height;
if (width > height) {
height += dif;
top -= dif / 2;
} else {
dif = -dif;
width += dif;
left -= dif / 2;
}
}
}
top -= padding;
left -= padding;
width += padding * 2;
height += padding * 2;
$(cutOut).css("top", top + "px");
$(cutOut).css("left", left + "px");
$(cutOut).css("width", width + "px");
$(cutOut).css("height", height + "px");
} | java | protected void setupCutOutPosition(Element cutOut, Element relativeTo, int padding, boolean circle) {
float top = relativeTo.getOffsetTop() - (Math.max($("html").scrollTop(), $("body").scrollTop()));
float left = relativeTo.getAbsoluteLeft();
float width = relativeTo.getOffsetWidth();
float height = relativeTo.getOffsetHeight();
if (circle) {
if (width != height) {
float dif = width - height;
if (width > height) {
height += dif;
top -= dif / 2;
} else {
dif = -dif;
width += dif;
left -= dif / 2;
}
}
}
top -= padding;
left -= padding;
width += padding * 2;
height += padding * 2;
$(cutOut).css("top", top + "px");
$(cutOut).css("left", left + "px");
$(cutOut).css("width", width + "px");
$(cutOut).css("height", height + "px");
} | [
"protected",
"void",
"setupCutOutPosition",
"(",
"Element",
"cutOut",
",",
"Element",
"relativeTo",
",",
"int",
"padding",
",",
"boolean",
"circle",
")",
"{",
"float",
"top",
"=",
"relativeTo",
".",
"getOffsetTop",
"(",
")",
"-",
"(",
"Math",
".",
"max",
"... | Setups the cut out position when the screen changes size or is scrolled. | [
"Setups",
"the",
"cut",
"out",
"position",
"when",
"the",
"screen",
"changes",
"size",
"or",
"is",
"scrolled",
"."
] | train | https://github.com/GwtMaterialDesign/gwt-material-addins/blob/11aec9d92918225f70f936285d0ae94f2178c36e/src/main/java/gwt/material/design/addins/client/cutout/MaterialCutOut.java#L371-L401 |
alkacon/opencms-core | src/org/opencms/db/generic/CmsUserQueryBuilder.java | CmsUserQueryBuilder.createFlagCondition | protected I_CmsQueryFragment createFlagCondition(TableAlias users, int flags) {
"""
Creates an SQL flag check condition.<p>
@param users the user table alias
@param flags the flags to check
@return the resulting SQL expression
"""
return new CmsSimpleQueryFragment(
users.column(colFlags()) + " & ? = ? ",
new Integer(flags),
new Integer(flags));
} | java | protected I_CmsQueryFragment createFlagCondition(TableAlias users, int flags) {
return new CmsSimpleQueryFragment(
users.column(colFlags()) + " & ? = ? ",
new Integer(flags),
new Integer(flags));
} | [
"protected",
"I_CmsQueryFragment",
"createFlagCondition",
"(",
"TableAlias",
"users",
",",
"int",
"flags",
")",
"{",
"return",
"new",
"CmsSimpleQueryFragment",
"(",
"users",
".",
"column",
"(",
"colFlags",
"(",
")",
")",
"+",
"\" & ? = ? \"",
",",
"new",
"Intege... | Creates an SQL flag check condition.<p>
@param users the user table alias
@param flags the flags to check
@return the resulting SQL expression | [
"Creates",
"an",
"SQL",
"flag",
"check",
"condition",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/generic/CmsUserQueryBuilder.java#L517-L523 |
meltmedia/cadmium | core/src/main/java/com/meltmedia/cadmium/core/util/Jsr250Utils.java | Jsr250Utils.preDestroyQuietly | public static void preDestroyQuietly(Object obj, Logger log) {
"""
Calls preDestroy with the same arguments, logging any exceptions that are thrown at the level warn.
"""
try {
preDestroy(obj, log);
}
catch( Throwable t ) {
log.warn("Could not @PreDestroy object", t);
}
} | java | public static void preDestroyQuietly(Object obj, Logger log) {
try {
preDestroy(obj, log);
}
catch( Throwable t ) {
log.warn("Could not @PreDestroy object", t);
}
} | [
"public",
"static",
"void",
"preDestroyQuietly",
"(",
"Object",
"obj",
",",
"Logger",
"log",
")",
"{",
"try",
"{",
"preDestroy",
"(",
"obj",
",",
"log",
")",
";",
"}",
"catch",
"(",
"Throwable",
"t",
")",
"{",
"log",
".",
"warn",
"(",
"\"Could not @Pre... | Calls preDestroy with the same arguments, logging any exceptions that are thrown at the level warn. | [
"Calls",
"preDestroy",
"with",
"the",
"same",
"arguments",
"logging",
"any",
"exceptions",
"that",
"are",
"thrown",
"at",
"the",
"level",
"warn",
"."
] | train | https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/core/src/main/java/com/meltmedia/cadmium/core/util/Jsr250Utils.java#L96-L103 |
UrielCh/ovh-java-sdk | ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java | ApiOvhTelephony.billingAccount_line_serviceName_lastRegistrations_GET | public ArrayList<OvhRegistrationInformations> billingAccount_line_serviceName_lastRegistrations_GET(String billingAccount, String serviceName) throws IOException {
"""
List the informations about the last registrations (i.e. IP, port, User-Agent...)
REST: GET /telephony/{billingAccount}/line/{serviceName}/lastRegistrations
@param billingAccount [required] The name of your billingAccount
@param serviceName [required]
"""
String qPath = "/telephony/{billingAccount}/line/{serviceName}/lastRegistrations";
StringBuilder sb = path(qPath, billingAccount, serviceName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t11);
} | java | public ArrayList<OvhRegistrationInformations> billingAccount_line_serviceName_lastRegistrations_GET(String billingAccount, String serviceName) throws IOException {
String qPath = "/telephony/{billingAccount}/line/{serviceName}/lastRegistrations";
StringBuilder sb = path(qPath, billingAccount, serviceName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t11);
} | [
"public",
"ArrayList",
"<",
"OvhRegistrationInformations",
">",
"billingAccount_line_serviceName_lastRegistrations_GET",
"(",
"String",
"billingAccount",
",",
"String",
"serviceName",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/telephony/{billingAccount}/line... | List the informations about the last registrations (i.e. IP, port, User-Agent...)
REST: GET /telephony/{billingAccount}/line/{serviceName}/lastRegistrations
@param billingAccount [required] The name of your billingAccount
@param serviceName [required] | [
"List",
"the",
"informations",
"about",
"the",
"last",
"registrations",
"(",
"i",
".",
"e",
".",
"IP",
"port",
"User",
"-",
"Agent",
"...",
")"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L2145-L2150 |
networknt/light-4j | dump/src/main/java/com/networknt/dump/BodyDumper.java | BodyDumper.dumpResponse | @Override
public void dumpResponse(Map<String, Object> result) {
"""
impl of dumping response body to result
@param result A map you want to put dump information to
"""
byte[] responseBodyAttachment = exchange.getAttachment(StoreResponseStreamSinkConduit.RESPONSE);
if(responseBodyAttachment != null) {
this.bodyContent = config.isMaskEnabled() ? Mask.maskJson(new ByteArrayInputStream(responseBodyAttachment), "responseBody") : new String(responseBodyAttachment, UTF_8);
}
this.putDumpInfoTo(result);
} | java | @Override
public void dumpResponse(Map<String, Object> result) {
byte[] responseBodyAttachment = exchange.getAttachment(StoreResponseStreamSinkConduit.RESPONSE);
if(responseBodyAttachment != null) {
this.bodyContent = config.isMaskEnabled() ? Mask.maskJson(new ByteArrayInputStream(responseBodyAttachment), "responseBody") : new String(responseBodyAttachment, UTF_8);
}
this.putDumpInfoTo(result);
} | [
"@",
"Override",
"public",
"void",
"dumpResponse",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"result",
")",
"{",
"byte",
"[",
"]",
"responseBodyAttachment",
"=",
"exchange",
".",
"getAttachment",
"(",
"StoreResponseStreamSinkConduit",
".",
"RESPONSE",
")",
... | impl of dumping response body to result
@param result A map you want to put dump information to | [
"impl",
"of",
"dumping",
"response",
"body",
"to",
"result"
] | train | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/dump/src/main/java/com/networknt/dump/BodyDumper.java#L85-L92 |
alibaba/simpleimage | simpleimage.core/src/main/java/com/alibaba/simpleimage/CompositeImageProcessor.java | CompositeImageProcessor.process | public OutputStream process(InputStream inputStream, DrawTextParameter drawParam, int maxWidth, int maxHeight)
throws SimpleImageException {
"""
根据输入的流的, 完成写水印, 缩放, 写输出流。
@param is 输入图像流, 需要主动关闭
@param dp 水印参数
@param scaleParam 缩放参数
@param wjp 写文件参数
@return 输出图像流, 需要主动关闭. 如果中间处理出错, 抛出异常;
@throws IOException
@throws IOException
"""
ImageRender wr = null;
ByteArrayOutputStream output = null;
try {
inputStream = ImageUtils.createMemoryStream(inputStream);
output = new ByteArrayOutputStream();
ImageFormat outputFormat = ImageUtils.isGIF(inputStream) ? ImageFormat.GIF : ImageFormat.JPEG;
ScaleParameter scaleParam = new ScaleParameter(maxWidth, maxHeight, Algorithm.AUTO);
ImageRender rr = new ReadRender(inputStream, true);
ImageRender dtr = new DrawTextRender(rr, drawParam);
ImageRender sr = new ScaleRender(dtr, scaleParam);
wr = new WriteRender(sr, output, outputFormat);
wr.render();
} catch (Exception e) {
errorLog(inputStream);
IOUtils.closeQuietly(output);
if (e instanceof SimpleImageException) {
throw (SimpleImageException) e;
} else {
throw new SimpleImageException(e);
}
} finally {
try {
if (wr != null) {
wr.dispose();
}
} catch (SimpleImageException ignore) {
}
}
return output;
} | java | public OutputStream process(InputStream inputStream, DrawTextParameter drawParam, int maxWidth, int maxHeight)
throws SimpleImageException {
ImageRender wr = null;
ByteArrayOutputStream output = null;
try {
inputStream = ImageUtils.createMemoryStream(inputStream);
output = new ByteArrayOutputStream();
ImageFormat outputFormat = ImageUtils.isGIF(inputStream) ? ImageFormat.GIF : ImageFormat.JPEG;
ScaleParameter scaleParam = new ScaleParameter(maxWidth, maxHeight, Algorithm.AUTO);
ImageRender rr = new ReadRender(inputStream, true);
ImageRender dtr = new DrawTextRender(rr, drawParam);
ImageRender sr = new ScaleRender(dtr, scaleParam);
wr = new WriteRender(sr, output, outputFormat);
wr.render();
} catch (Exception e) {
errorLog(inputStream);
IOUtils.closeQuietly(output);
if (e instanceof SimpleImageException) {
throw (SimpleImageException) e;
} else {
throw new SimpleImageException(e);
}
} finally {
try {
if (wr != null) {
wr.dispose();
}
} catch (SimpleImageException ignore) {
}
}
return output;
} | [
"public",
"OutputStream",
"process",
"(",
"InputStream",
"inputStream",
",",
"DrawTextParameter",
"drawParam",
",",
"int",
"maxWidth",
",",
"int",
"maxHeight",
")",
"throws",
"SimpleImageException",
"{",
"ImageRender",
"wr",
"=",
"null",
";",
"ByteArrayOutputStream",
... | 根据输入的流的, 完成写水印, 缩放, 写输出流。
@param is 输入图像流, 需要主动关闭
@param dp 水印参数
@param scaleParam 缩放参数
@param wjp 写文件参数
@return 输出图像流, 需要主动关闭. 如果中间处理出错, 抛出异常;
@throws IOException
@throws IOException | [
"根据输入的流的,",
"完成写水印,",
"缩放,",
"写输出流。"
] | train | https://github.com/alibaba/simpleimage/blob/aabe559c267402b754c2ad606b796c4c6570788c/simpleimage.core/src/main/java/com/alibaba/simpleimage/CompositeImageProcessor.java#L77-L114 |
VoltDB/voltdb | src/hsqldb19b3/org/hsqldb_voltpatches/QuerySpecification.java | QuerySpecification.getMaxRowCount | private int getMaxRowCount(Session session, int rowCount) {
"""
translate the rowCount into total number of rows needed from query,
including any rows skipped at the beginning
"""
int limitStart = getLimitStart(session);
int limitCount = getLimitCount(session, rowCount);
if (simpleLimit) {
if (rowCount == 0) {
rowCount = limitCount;
}
// A VoltDB extension to support LIMIT 0
if (rowCount > Integer.MAX_VALUE - limitStart) {
/* disable 1 line ...
if (rowCount == 0 || rowCount > Integer.MAX_VALUE - limitStart) {
... disabled 1 line */
// End of VoltDB extension
rowCount = Integer.MAX_VALUE;
} else {
rowCount += limitStart;
}
} else {
rowCount = Integer.MAX_VALUE;
// A VoltDB extension to support LIMIT 0
// limitCount == 0 can be enforced/optimized as rowCount == 0 regardless of offset
// even in non-simpleLimit cases (SELECT DISTINCT, GROUP BY, and/or ORDER BY).
// This is an optimal handling of a hard-coded LIMIT 0, but it really shouldn't be the ONLY
// enforcement for zero LIMITs -- what about "LIMIT ?" with 0 passed later as a parameter?
// The HSQL executor ("HSQL back end") also needs runtime enforcement of zero limits.
// The VoltDB executor has such enforcement.
if (limitCount == 0) {
rowCount = 0;
}
// End of VoltDB extension
}
return rowCount;
} | java | private int getMaxRowCount(Session session, int rowCount) {
int limitStart = getLimitStart(session);
int limitCount = getLimitCount(session, rowCount);
if (simpleLimit) {
if (rowCount == 0) {
rowCount = limitCount;
}
// A VoltDB extension to support LIMIT 0
if (rowCount > Integer.MAX_VALUE - limitStart) {
/* disable 1 line ...
if (rowCount == 0 || rowCount > Integer.MAX_VALUE - limitStart) {
... disabled 1 line */
// End of VoltDB extension
rowCount = Integer.MAX_VALUE;
} else {
rowCount += limitStart;
}
} else {
rowCount = Integer.MAX_VALUE;
// A VoltDB extension to support LIMIT 0
// limitCount == 0 can be enforced/optimized as rowCount == 0 regardless of offset
// even in non-simpleLimit cases (SELECT DISTINCT, GROUP BY, and/or ORDER BY).
// This is an optimal handling of a hard-coded LIMIT 0, but it really shouldn't be the ONLY
// enforcement for zero LIMITs -- what about "LIMIT ?" with 0 passed later as a parameter?
// The HSQL executor ("HSQL back end") also needs runtime enforcement of zero limits.
// The VoltDB executor has such enforcement.
if (limitCount == 0) {
rowCount = 0;
}
// End of VoltDB extension
}
return rowCount;
} | [
"private",
"int",
"getMaxRowCount",
"(",
"Session",
"session",
",",
"int",
"rowCount",
")",
"{",
"int",
"limitStart",
"=",
"getLimitStart",
"(",
"session",
")",
";",
"int",
"limitCount",
"=",
"getLimitCount",
"(",
"session",
",",
"rowCount",
")",
";",
"if",
... | translate the rowCount into total number of rows needed from query,
including any rows skipped at the beginning | [
"translate",
"the",
"rowCount",
"into",
"total",
"number",
"of",
"rows",
"needed",
"from",
"query",
"including",
"any",
"rows",
"skipped",
"at",
"the",
"beginning"
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/QuerySpecification.java#L1210-L1246 |
google/closure-templates | java/src/com/google/template/soy/conformance/Rule.java | Rule.checkConformance | final void checkConformance(Node node, ErrorReporter errorReporter) {
"""
Checks whether the given node is relevant for this rule, and, if so, checks whether the node
conforms to the rule. Intended to be called only from {@link SoyConformance}.
"""
if (nodeClass.isAssignableFrom(node.getClass())) {
doCheckConformance(nodeClass.cast(node), errorReporter);
}
} | java | final void checkConformance(Node node, ErrorReporter errorReporter) {
if (nodeClass.isAssignableFrom(node.getClass())) {
doCheckConformance(nodeClass.cast(node), errorReporter);
}
} | [
"final",
"void",
"checkConformance",
"(",
"Node",
"node",
",",
"ErrorReporter",
"errorReporter",
")",
"{",
"if",
"(",
"nodeClass",
".",
"isAssignableFrom",
"(",
"node",
".",
"getClass",
"(",
")",
")",
")",
"{",
"doCheckConformance",
"(",
"nodeClass",
".",
"c... | Checks whether the given node is relevant for this rule, and, if so, checks whether the node
conforms to the rule. Intended to be called only from {@link SoyConformance}. | [
"Checks",
"whether",
"the",
"given",
"node",
"is",
"relevant",
"for",
"this",
"rule",
"and",
"if",
"so",
"checks",
"whether",
"the",
"node",
"conforms",
"to",
"the",
"rule",
".",
"Intended",
"to",
"be",
"called",
"only",
"from",
"{"
] | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/conformance/Rule.java#L56-L60 |
BlueBrain/bluima | modules/bluima_utils/src/main/java/ds/tree/RadixTreeImpl.java | RadixTreeImpl.formatTo | @Override
public void formatTo(Formatter formatter, int flags, int width, int precision) {
"""
Writes a textual representation of this tree to the given formatter.
Currently, all options are simply ignored.
WARNING! Do not use this for a large Trie, it's for testing purpose only.
"""
formatNodeTo(formatter, 0, root);
} | java | @Override
public void formatTo(Formatter formatter, int flags, int width, int precision) {
formatNodeTo(formatter, 0, root);
} | [
"@",
"Override",
"public",
"void",
"formatTo",
"(",
"Formatter",
"formatter",
",",
"int",
"flags",
",",
"int",
"width",
",",
"int",
"precision",
")",
"{",
"formatNodeTo",
"(",
"formatter",
",",
"0",
",",
"root",
")",
";",
"}"
] | Writes a textual representation of this tree to the given formatter.
Currently, all options are simply ignored.
WARNING! Do not use this for a large Trie, it's for testing purpose only. | [
"Writes",
"a",
"textual",
"representation",
"of",
"this",
"tree",
"to",
"the",
"given",
"formatter",
"."
] | train | https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_utils/src/main/java/ds/tree/RadixTreeImpl.java#L400-L403 |
facebookarchive/nifty | nifty-ssl/src/main/java/com/facebook/nifty/ssl/CryptoUtil.java | CryptoUtil.initHmacSha256 | private static Mac initHmacSha256(byte[] key) {
"""
Initializes a {@link Mac} object using the given key.
@param key the HMAC key.
@return the initialized Mac object.
@throws IllegalArgumentException if the provided key is invalid.
"""
try {
SecretKeySpec keySpec = new SecretKeySpec(key, MAC_ALGORITHM);
Mac mac = Mac.getInstance(MAC_ALGORITHM);
mac.init(keySpec);
return mac;
}
catch (GeneralSecurityException e) {
throw new IllegalArgumentException(e);
}
} | java | private static Mac initHmacSha256(byte[] key) {
try {
SecretKeySpec keySpec = new SecretKeySpec(key, MAC_ALGORITHM);
Mac mac = Mac.getInstance(MAC_ALGORITHM);
mac.init(keySpec);
return mac;
}
catch (GeneralSecurityException e) {
throw new IllegalArgumentException(e);
}
} | [
"private",
"static",
"Mac",
"initHmacSha256",
"(",
"byte",
"[",
"]",
"key",
")",
"{",
"try",
"{",
"SecretKeySpec",
"keySpec",
"=",
"new",
"SecretKeySpec",
"(",
"key",
",",
"MAC_ALGORITHM",
")",
";",
"Mac",
"mac",
"=",
"Mac",
".",
"getInstance",
"(",
"MAC... | Initializes a {@link Mac} object using the given key.
@param key the HMAC key.
@return the initialized Mac object.
@throws IllegalArgumentException if the provided key is invalid. | [
"Initializes",
"a",
"{",
"@link",
"Mac",
"}",
"object",
"using",
"the",
"given",
"key",
"."
] | train | https://github.com/facebookarchive/nifty/blob/ccacff7f0a723abe0b9ed399bcc3bc85784e7396/nifty-ssl/src/main/java/com/facebook/nifty/ssl/CryptoUtil.java#L53-L63 |
Azure/azure-sdk-for-java | automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/JobStreamsInner.java | JobStreamsInner.get | public JobStreamInner get(String resourceGroupName, String automationAccountName, String jobId, String jobStreamId) {
"""
Retrieve the job stream identified by job stream id.
@param resourceGroupName Name of an Azure Resource group.
@param automationAccountName The name of the automation account.
@param jobId The job id.
@param jobStreamId The job stream 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 JobStreamInner object if successful.
"""
return getWithServiceResponseAsync(resourceGroupName, automationAccountName, jobId, jobStreamId).toBlocking().single().body();
} | java | public JobStreamInner get(String resourceGroupName, String automationAccountName, String jobId, String jobStreamId) {
return getWithServiceResponseAsync(resourceGroupName, automationAccountName, jobId, jobStreamId).toBlocking().single().body();
} | [
"public",
"JobStreamInner",
"get",
"(",
"String",
"resourceGroupName",
",",
"String",
"automationAccountName",
",",
"String",
"jobId",
",",
"String",
"jobStreamId",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"automationAccountName",
... | Retrieve the job stream identified by job stream id.
@param resourceGroupName Name of an Azure Resource group.
@param automationAccountName The name of the automation account.
@param jobId The job id.
@param jobStreamId The job stream 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 JobStreamInner object if successful. | [
"Retrieve",
"the",
"job",
"stream",
"identified",
"by",
"job",
"stream",
"id",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/JobStreamsInner.java#L86-L88 |
WiQuery/wiquery | wiquery-core/src/main/java/org/odlabs/wiquery/core/options/Options.java | Options.putInteger | public Options putInteger(String key, IModel<Integer> value) {
"""
<p>
Puts an int value for the given option name.
</p>
@param key
the option name.
@param value
the int value.
"""
putOption(key, new IntegerOption(value));
return this;
} | java | public Options putInteger(String key, IModel<Integer> value)
{
putOption(key, new IntegerOption(value));
return this;
} | [
"public",
"Options",
"putInteger",
"(",
"String",
"key",
",",
"IModel",
"<",
"Integer",
">",
"value",
")",
"{",
"putOption",
"(",
"key",
",",
"new",
"IntegerOption",
"(",
"value",
")",
")",
";",
"return",
"this",
";",
"}"
] | <p>
Puts an int value for the given option name.
</p>
@param key
the option name.
@param value
the int value. | [
"<p",
">",
"Puts",
"an",
"int",
"value",
"for",
"the",
"given",
"option",
"name",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/WiQuery/wiquery/blob/1b8d60c7a3c37b90fd68c9cd0ff97178fcbcbb08/wiquery-core/src/main/java/org/odlabs/wiquery/core/options/Options.java#L484-L488 |
santhosh-tekuri/jlibs | core/src/main/java/jlibs/core/lang/BeanUtil.java | BeanUtil.getSetterMethod | public static Method getSetterMethod(Class<?> beanClass, String property, Class propertyType) {
"""
Returns setter method for <code>property</code> in specified <code>beanClass</code>
@param beanClass bean class
@param property name of the property
@param propertyType type of the property. This is used to compute setter method name.
@return setter method. null if <code>property</code> is not found, or it is readonly property
@see #getSetterMethod(Class, String)
"""
try{
return beanClass.getMethod(SET+getMethodSuffix(property), propertyType);
} catch(NoSuchMethodException ex){
return null;
}
} | java | public static Method getSetterMethod(Class<?> beanClass, String property, Class propertyType){
try{
return beanClass.getMethod(SET+getMethodSuffix(property), propertyType);
} catch(NoSuchMethodException ex){
return null;
}
} | [
"public",
"static",
"Method",
"getSetterMethod",
"(",
"Class",
"<",
"?",
">",
"beanClass",
",",
"String",
"property",
",",
"Class",
"propertyType",
")",
"{",
"try",
"{",
"return",
"beanClass",
".",
"getMethod",
"(",
"SET",
"+",
"getMethodSuffix",
"(",
"prope... | Returns setter method for <code>property</code> in specified <code>beanClass</code>
@param beanClass bean class
@param property name of the property
@param propertyType type of the property. This is used to compute setter method name.
@return setter method. null if <code>property</code> is not found, or it is readonly property
@see #getSetterMethod(Class, String) | [
"Returns",
"setter",
"method",
"for",
"<code",
">",
"property<",
"/",
"code",
">",
"in",
"specified",
"<code",
">",
"beanClass<",
"/",
"code",
">"
] | train | https://github.com/santhosh-tekuri/jlibs/blob/59c28719f054123cf778278154e1b92e943ad232/core/src/main/java/jlibs/core/lang/BeanUtil.java#L168-L174 |
datoin/http-requests | src/main/java/org/datoin/net/http/Request.java | Request.setHeader | public Request setHeader(String name, String value) {
"""
seat a header and return modified request
@param name : header name
@param value : header value
@return : Request Object with header value set
"""
this.headers.put(name, value);
return this;
} | java | public Request setHeader(String name, String value) {
this.headers.put(name, value);
return this;
} | [
"public",
"Request",
"setHeader",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"this",
".",
"headers",
".",
"put",
"(",
"name",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | seat a header and return modified request
@param name : header name
@param value : header value
@return : Request Object with header value set | [
"seat",
"a",
"header",
"and",
"return",
"modified",
"request"
] | train | https://github.com/datoin/http-requests/blob/660a4bc516c594f321019df94451fead4dea19b6/src/main/java/org/datoin/net/http/Request.java#L183-L186 |
TheHortonMachine/hortonmachine | gears/src/main/java/oms3/Compound.java | Compound.out2in | public void out2in(Object from, String from_out, Object... tos) {
"""
Connects field1 of cmd1 with the same named fields in cmds
@param from component1
@param from_out field
@param tos other components
"""
for (Object co : tos) {
out2in(from, from_out, co, from_out);
}
} | java | public void out2in(Object from, String from_out, Object... tos) {
for (Object co : tos) {
out2in(from, from_out, co, from_out);
}
} | [
"public",
"void",
"out2in",
"(",
"Object",
"from",
",",
"String",
"from_out",
",",
"Object",
"...",
"tos",
")",
"{",
"for",
"(",
"Object",
"co",
":",
"tos",
")",
"{",
"out2in",
"(",
"from",
",",
"from_out",
",",
"co",
",",
"from_out",
")",
";",
"}"... | Connects field1 of cmd1 with the same named fields in cmds
@param from component1
@param from_out field
@param tos other components | [
"Connects",
"field1",
"of",
"cmd1",
"with",
"the",
"same",
"named",
"fields",
"in",
"cmds"
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/oms3/Compound.java#L110-L114 |
rundeck/rundeck | core/src/main/java/com/dtolabs/rundeck/core/execution/impl/common/DefaultFileCopierUtil.java | DefaultFileCopierUtil.writeScriptTempFile | @Override
public File writeScriptTempFile(
final ExecutionContext context,
final File original,
final InputStream input,
final String script,
final INodeEntry node,
final boolean expandTokens
) throws FileCopierException {
"""
Copy a script file, script source stream, or script string into a temp file, and replace \
embedded tokens with values from the dataContext for the latter two. Marks the file as
executable and delete-on-exit. This will not rewrite any content if the input is originally a
file.
@param context execution context
@param original local system file, or null
@param input input stream to write, or null
@param script file content string, or null
@param node destination node entry, to provide node data context
@return file where the script was stored, this file should later be cleaned up by calling
{@link com.dtolabs.rundeck.core.execution.script.ScriptfileUtils#releaseTempFile(java.io.File)}
@throws com.dtolabs.rundeck.core.execution.service.FileCopierException
if an IO problem occurs
"""
return writeScriptTempFile(context, original, input, script, node, null, expandTokens);
} | java | @Override
public File writeScriptTempFile(
final ExecutionContext context,
final File original,
final InputStream input,
final String script,
final INodeEntry node,
final boolean expandTokens
) throws FileCopierException
{
return writeScriptTempFile(context, original, input, script, node, null, expandTokens);
} | [
"@",
"Override",
"public",
"File",
"writeScriptTempFile",
"(",
"final",
"ExecutionContext",
"context",
",",
"final",
"File",
"original",
",",
"final",
"InputStream",
"input",
",",
"final",
"String",
"script",
",",
"final",
"INodeEntry",
"node",
",",
"final",
"bo... | Copy a script file, script source stream, or script string into a temp file, and replace \
embedded tokens with values from the dataContext for the latter two. Marks the file as
executable and delete-on-exit. This will not rewrite any content if the input is originally a
file.
@param context execution context
@param original local system file, or null
@param input input stream to write, or null
@param script file content string, or null
@param node destination node entry, to provide node data context
@return file where the script was stored, this file should later be cleaned up by calling
{@link com.dtolabs.rundeck.core.execution.script.ScriptfileUtils#releaseTempFile(java.io.File)}
@throws com.dtolabs.rundeck.core.execution.service.FileCopierException
if an IO problem occurs | [
"Copy",
"a",
"script",
"file",
"script",
"source",
"stream",
"or",
"script",
"string",
"into",
"a",
"temp",
"file",
"and",
"replace",
"\\",
"embedded",
"tokens",
"with",
"values",
"from",
"the",
"dataContext",
"for",
"the",
"latter",
"two",
".",
"Marks",
"... | train | https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/execution/impl/common/DefaultFileCopierUtil.java#L73-L84 |
CloudSlang/cs-actions | cs-amazon/src/main/java/io/cloudslang/content/amazon/services/helpers/AwsSignatureHelper.java | AwsSignatureHelper.canonicalizedHeadersString | public String canonicalizedHeadersString(Map<String, String> headers) {
"""
Canonicalized (standardized) headers string is formed by first sorting all the header
parameters, then converting all header names to lowercase and
trimming excess white space characters out of the header values
@param headers Headers to be canonicalized.
@return A canonicalized form for the specified headers.
"""
List<Map.Entry<String, String>> sortedList = getSortedMapEntries(headers);
String header;
String headerValue;
StringBuilder headerString = new StringBuilder();
for (Map.Entry<String, String> ent : sortedList) {
header = nullToEmpty(ent.getKey()).toLowerCase();
headerValue = nullToEmpty(ent.getValue()).trim();
headerString.append(header).append(COLON).append(headerValue).append(LINE_SEPARATOR);
}
return headerString.toString();
} | java | public String canonicalizedHeadersString(Map<String, String> headers) {
List<Map.Entry<String, String>> sortedList = getSortedMapEntries(headers);
String header;
String headerValue;
StringBuilder headerString = new StringBuilder();
for (Map.Entry<String, String> ent : sortedList) {
header = nullToEmpty(ent.getKey()).toLowerCase();
headerValue = nullToEmpty(ent.getValue()).trim();
headerString.append(header).append(COLON).append(headerValue).append(LINE_SEPARATOR);
}
return headerString.toString();
} | [
"public",
"String",
"canonicalizedHeadersString",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"headers",
")",
"{",
"List",
"<",
"Map",
".",
"Entry",
"<",
"String",
",",
"String",
">",
">",
"sortedList",
"=",
"getSortedMapEntries",
"(",
"headers",
")",
"... | Canonicalized (standardized) headers string is formed by first sorting all the header
parameters, then converting all header names to lowercase and
trimming excess white space characters out of the header values
@param headers Headers to be canonicalized.
@return A canonicalized form for the specified headers. | [
"Canonicalized",
"(",
"standardized",
")",
"headers",
"string",
"is",
"formed",
"by",
"first",
"sorting",
"all",
"the",
"header",
"parameters",
"then",
"converting",
"all",
"header",
"names",
"to",
"lowercase",
"and",
"trimming",
"excess",
"white",
"space",
"cha... | train | https://github.com/CloudSlang/cs-actions/blob/9a1be1e99ad88286a6c153d5f2275df6ae1a57a1/cs-amazon/src/main/java/io/cloudslang/content/amazon/services/helpers/AwsSignatureHelper.java#L89-L103 |
JavaMoney/jsr354-ri-bp | src/main/java/org/javamoney/moneta/function/MonetaryFunctions.java | MonetaryFunctions.sortNumberDesc | public static Comparator<MonetaryAmount> sortNumberDesc() {
"""
Get a comparator for sorting amount by number value descending.
@return the Comparator to sort by number in descending way, not null.
"""
return new Comparator<MonetaryAmount>() {
@Override
public int compare(MonetaryAmount o1, MonetaryAmount o2) {
return sortNumber().compare(o1, o2) * -1;
}
};
} | java | public static Comparator<MonetaryAmount> sortNumberDesc(){
return new Comparator<MonetaryAmount>() {
@Override
public int compare(MonetaryAmount o1, MonetaryAmount o2) {
return sortNumber().compare(o1, o2) * -1;
}
};
} | [
"public",
"static",
"Comparator",
"<",
"MonetaryAmount",
">",
"sortNumberDesc",
"(",
")",
"{",
"return",
"new",
"Comparator",
"<",
"MonetaryAmount",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"int",
"compare",
"(",
"MonetaryAmount",
"o1",
",",
"MonetaryAmo... | Get a comparator for sorting amount by number value descending.
@return the Comparator to sort by number in descending way, not null. | [
"Get",
"a",
"comparator",
"for",
"sorting",
"amount",
"by",
"number",
"value",
"descending",
"."
] | train | https://github.com/JavaMoney/jsr354-ri-bp/blob/9c147ef5623d8032a6dc4c0e5eefdfb41641a9a2/src/main/java/org/javamoney/moneta/function/MonetaryFunctions.java#L152-L159 |
camunda/camunda-commons | logging/src/main/java/org/camunda/commons/logging/BaseLogger.java | BaseLogger.formatMessageTemplate | protected String formatMessageTemplate(String id, String messageTemplate) {
"""
Formats a message template
@param id the id of the message
@param messageTemplate the message template to use
@return the formatted template
"""
return projectCode + "-" + componentId + id + " " + messageTemplate;
} | java | protected String formatMessageTemplate(String id, String messageTemplate) {
return projectCode + "-" + componentId + id + " " + messageTemplate;
} | [
"protected",
"String",
"formatMessageTemplate",
"(",
"String",
"id",
",",
"String",
"messageTemplate",
")",
"{",
"return",
"projectCode",
"+",
"\"-\"",
"+",
"componentId",
"+",
"id",
"+",
"\" \"",
"+",
"messageTemplate",
";",
"}"
] | Formats a message template
@param id the id of the message
@param messageTemplate the message template to use
@return the formatted template | [
"Formats",
"a",
"message",
"template"
] | train | https://github.com/camunda/camunda-commons/blob/bd3195db47c92c25717288fe9e6735f8e882f247/logging/src/main/java/org/camunda/commons/logging/BaseLogger.java#L200-L202 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/contact/GroupContactSet.java | GroupContactSet.hasContact | public boolean hasContact(ResidueNumber resNumber1, ResidueNumber resNumber2) {
"""
Tell whether the given pair is a contact in this GroupContactSet,
the comparison is done by matching residue numbers and chain identifiers
@param resNumber1
@param resNumber2
@return
"""
return contacts.containsKey(new Pair<ResidueNumber>(resNumber1, resNumber2));
} | java | public boolean hasContact(ResidueNumber resNumber1, ResidueNumber resNumber2) {
return contacts.containsKey(new Pair<ResidueNumber>(resNumber1, resNumber2));
} | [
"public",
"boolean",
"hasContact",
"(",
"ResidueNumber",
"resNumber1",
",",
"ResidueNumber",
"resNumber2",
")",
"{",
"return",
"contacts",
".",
"containsKey",
"(",
"new",
"Pair",
"<",
"ResidueNumber",
">",
"(",
"resNumber1",
",",
"resNumber2",
")",
")",
";",
"... | Tell whether the given pair is a contact in this GroupContactSet,
the comparison is done by matching residue numbers and chain identifiers
@param resNumber1
@param resNumber2
@return | [
"Tell",
"whether",
"the",
"given",
"pair",
"is",
"a",
"contact",
"in",
"this",
"GroupContactSet",
"the",
"comparison",
"is",
"done",
"by",
"matching",
"residue",
"numbers",
"and",
"chain",
"identifiers"
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/contact/GroupContactSet.java#L116-L118 |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/launching/runner/AbstractSARLLaunchConfigurationDelegate.java | AbstractSARLLaunchConfigurationDelegate.getProgramArguments | @Override
@SuppressWarnings("checkstyle:variabledeclarationusagedistance")
public final String getProgramArguments(ILaunchConfiguration configuration) throws CoreException {
"""
Replies the arguments of the program including the boot agent name.
{@inheritDoc}
"""
// The following line get the standard arguments
final String standardProgramArguments = super.getProgramArguments(configuration);
// Get the specific SRE arguments
final ISREInstall sre = getSREInstallFor(configuration, this.configAccessor, cfg -> getJavaProject(cfg));
assert sre != null;
return getProgramArguments(configuration, sre, standardProgramArguments);
} | java | @Override
@SuppressWarnings("checkstyle:variabledeclarationusagedistance")
public final String getProgramArguments(ILaunchConfiguration configuration) throws CoreException {
// The following line get the standard arguments
final String standardProgramArguments = super.getProgramArguments(configuration);
// Get the specific SRE arguments
final ISREInstall sre = getSREInstallFor(configuration, this.configAccessor, cfg -> getJavaProject(cfg));
assert sre != null;
return getProgramArguments(configuration, sre, standardProgramArguments);
} | [
"@",
"Override",
"@",
"SuppressWarnings",
"(",
"\"checkstyle:variabledeclarationusagedistance\"",
")",
"public",
"final",
"String",
"getProgramArguments",
"(",
"ILaunchConfiguration",
"configuration",
")",
"throws",
"CoreException",
"{",
"// The following line get the standard ar... | Replies the arguments of the program including the boot agent name.
{@inheritDoc} | [
"Replies",
"the",
"arguments",
"of",
"the",
"program",
"including",
"the",
"boot",
"agent",
"name",
".",
"{"
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/launching/runner/AbstractSARLLaunchConfigurationDelegate.java#L296-L307 |
lucee/Lucee | core/src/main/java/lucee/runtime/schedule/StorageUtil.java | StorageUtil.toTime | public Time toTime(Element el, String attributeName, Time defaultValue) {
"""
reads a XML Element Attribute ans cast it to a Date
@param el XML Element to read Attribute from it
@param attributeName Name of the Attribute to read
@param defaultValue if attribute doesn't exist return default value
@return Attribute Value
"""
return new TimeImpl(toDateTime(el, attributeName, defaultValue));
} | java | public Time toTime(Element el, String attributeName, Time defaultValue) {
return new TimeImpl(toDateTime(el, attributeName, defaultValue));
} | [
"public",
"Time",
"toTime",
"(",
"Element",
"el",
",",
"String",
"attributeName",
",",
"Time",
"defaultValue",
")",
"{",
"return",
"new",
"TimeImpl",
"(",
"toDateTime",
"(",
"el",
",",
"attributeName",
",",
"defaultValue",
")",
")",
";",
"}"
] | reads a XML Element Attribute ans cast it to a Date
@param el XML Element to read Attribute from it
@param attributeName Name of the Attribute to read
@param defaultValue if attribute doesn't exist return default value
@return Attribute Value | [
"reads",
"a",
"XML",
"Element",
"Attribute",
"ans",
"cast",
"it",
"to",
"a",
"Date"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/schedule/StorageUtil.java#L313-L315 |
igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/iqprivate/PrivateDataManager.java | PrivateDataManager.getPrivateData | public PrivateData getPrivateData(final String elementName, final String namespace) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
"""
Returns the private data specified by the given element name and namespace. Each chunk
of private data is uniquely identified by an element name and namespace pair.<p>
If a PrivateDataProvider is registered for the specified element name/namespace pair then
that provider will determine the specific object type that is returned. If no provider
is registered, a {@link DefaultPrivateData} instance will be returned.
@param elementName the element name.
@param namespace the namespace.
@return the private data.
@throws XMPPErrorException
@throws NoResponseException
@throws NotConnectedException
@throws InterruptedException
"""
// Create an IQ packet to get the private data.
IQ privateDataGet = new PrivateDataIQ(elementName, namespace);
PrivateDataIQ response = connection().createStanzaCollectorAndSend(
privateDataGet).nextResultOrThrow();
return response.getPrivateData();
} | java | public PrivateData getPrivateData(final String elementName, final String namespace) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
// Create an IQ packet to get the private data.
IQ privateDataGet = new PrivateDataIQ(elementName, namespace);
PrivateDataIQ response = connection().createStanzaCollectorAndSend(
privateDataGet).nextResultOrThrow();
return response.getPrivateData();
} | [
"public",
"PrivateData",
"getPrivateData",
"(",
"final",
"String",
"elementName",
",",
"final",
"String",
"namespace",
")",
"throws",
"NoResponseException",
",",
"XMPPErrorException",
",",
"NotConnectedException",
",",
"InterruptedException",
"{",
"// Create an IQ packet to... | Returns the private data specified by the given element name and namespace. Each chunk
of private data is uniquely identified by an element name and namespace pair.<p>
If a PrivateDataProvider is registered for the specified element name/namespace pair then
that provider will determine the specific object type that is returned. If no provider
is registered, a {@link DefaultPrivateData} instance will be returned.
@param elementName the element name.
@param namespace the namespace.
@return the private data.
@throws XMPPErrorException
@throws NoResponseException
@throws NotConnectedException
@throws InterruptedException | [
"Returns",
"the",
"private",
"data",
"specified",
"by",
"the",
"given",
"element",
"name",
"and",
"namespace",
".",
"Each",
"chunk",
"of",
"private",
"data",
"is",
"uniquely",
"identified",
"by",
"an",
"element",
"name",
"and",
"namespace",
"pair",
".",
"<p"... | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/iqprivate/PrivateDataManager.java#L161-L168 |
JOML-CI/JOML | src/org/joml/Matrix4f.java | Matrix4f.setFrustumLH | public Matrix4f setFrustumLH(float left, float right, float bottom, float top, float zNear, float zFar, boolean zZeroToOne) {
"""
Set this matrix to be an arbitrary perspective projection frustum transformation for a left-handed coordinate system
using OpenGL's NDC z range of <code>[-1..+1]</code>.
<p>
In order to apply the perspective frustum transformation to an existing transformation,
use {@link #frustumLH(float, float, float, float, float, float, boolean) frustumLH()}.
<p>
Reference: <a href="http://www.songho.ca/opengl/gl_projectionmatrix.html#perspective">http://www.songho.ca</a>
@see #frustumLH(float, float, float, float, float, float, boolean)
@param left
the distance along the x-axis to the left frustum edge
@param right
the distance along the x-axis to the right frustum edge
@param bottom
the distance along the y-axis to the bottom frustum edge
@param top
the distance along the y-axis to the top frustum edge
@param zNear
near clipping plane distance. If the special value {@link Float#POSITIVE_INFINITY} is used, the near clipping plane will be at positive infinity.
In that case, <code>zFar</code> may not also be {@link Float#POSITIVE_INFINITY}.
@param zFar
far clipping plane distance. If the special value {@link Float#POSITIVE_INFINITY} is used, the far clipping plane will be at positive infinity.
In that case, <code>zNear</code> may not also be {@link Float#POSITIVE_INFINITY}.
@param zZeroToOne
whether to use Vulkan's and Direct3D's NDC z range of <code>[0..+1]</code> when <code>true</code>
or whether to use OpenGL's NDC z range of <code>[-1..+1]</code> when <code>false</code>
@return this
"""
if ((properties & PROPERTY_IDENTITY) == 0)
MemUtil.INSTANCE.identity(this);
this._m00((zNear + zNear) / (right - left));
this._m11((zNear + zNear) / (top - bottom));
this._m20((right + left) / (right - left));
this._m21((top + bottom) / (top - bottom));
boolean farInf = zFar > 0 && Float.isInfinite(zFar);
boolean nearInf = zNear > 0 && Float.isInfinite(zNear);
if (farInf) {
// See: "Infinite Projection Matrix" (http://www.terathon.com/gdc07_lengyel.pdf)
float e = 1E-6f;
this._m22(1.0f - e);
this._m32((e - (zZeroToOne ? 1.0f : 2.0f)) * zNear);
} else if (nearInf) {
float e = 1E-6f;
this._m22((zZeroToOne ? 0.0f : 1.0f) - e);
this._m32(((zZeroToOne ? 1.0f : 2.0f) - e) * zFar);
} else {
this._m22((zZeroToOne ? zFar : zFar + zNear) / (zFar - zNear));
this._m32((zZeroToOne ? zFar : zFar + zFar) * zNear / (zNear - zFar));
}
this._m23(1.0f);
this._m33(0.0f);
_properties(0);
return this;
} | java | public Matrix4f setFrustumLH(float left, float right, float bottom, float top, float zNear, float zFar, boolean zZeroToOne) {
if ((properties & PROPERTY_IDENTITY) == 0)
MemUtil.INSTANCE.identity(this);
this._m00((zNear + zNear) / (right - left));
this._m11((zNear + zNear) / (top - bottom));
this._m20((right + left) / (right - left));
this._m21((top + bottom) / (top - bottom));
boolean farInf = zFar > 0 && Float.isInfinite(zFar);
boolean nearInf = zNear > 0 && Float.isInfinite(zNear);
if (farInf) {
// See: "Infinite Projection Matrix" (http://www.terathon.com/gdc07_lengyel.pdf)
float e = 1E-6f;
this._m22(1.0f - e);
this._m32((e - (zZeroToOne ? 1.0f : 2.0f)) * zNear);
} else if (nearInf) {
float e = 1E-6f;
this._m22((zZeroToOne ? 0.0f : 1.0f) - e);
this._m32(((zZeroToOne ? 1.0f : 2.0f) - e) * zFar);
} else {
this._m22((zZeroToOne ? zFar : zFar + zNear) / (zFar - zNear));
this._m32((zZeroToOne ? zFar : zFar + zFar) * zNear / (zNear - zFar));
}
this._m23(1.0f);
this._m33(0.0f);
_properties(0);
return this;
} | [
"public",
"Matrix4f",
"setFrustumLH",
"(",
"float",
"left",
",",
"float",
"right",
",",
"float",
"bottom",
",",
"float",
"top",
",",
"float",
"zNear",
",",
"float",
"zFar",
",",
"boolean",
"zZeroToOne",
")",
"{",
"if",
"(",
"(",
"properties",
"&",
"PROPE... | Set this matrix to be an arbitrary perspective projection frustum transformation for a left-handed coordinate system
using OpenGL's NDC z range of <code>[-1..+1]</code>.
<p>
In order to apply the perspective frustum transformation to an existing transformation,
use {@link #frustumLH(float, float, float, float, float, float, boolean) frustumLH()}.
<p>
Reference: <a href="http://www.songho.ca/opengl/gl_projectionmatrix.html#perspective">http://www.songho.ca</a>
@see #frustumLH(float, float, float, float, float, float, boolean)
@param left
the distance along the x-axis to the left frustum edge
@param right
the distance along the x-axis to the right frustum edge
@param bottom
the distance along the y-axis to the bottom frustum edge
@param top
the distance along the y-axis to the top frustum edge
@param zNear
near clipping plane distance. If the special value {@link Float#POSITIVE_INFINITY} is used, the near clipping plane will be at positive infinity.
In that case, <code>zFar</code> may not also be {@link Float#POSITIVE_INFINITY}.
@param zFar
far clipping plane distance. If the special value {@link Float#POSITIVE_INFINITY} is used, the far clipping plane will be at positive infinity.
In that case, <code>zNear</code> may not also be {@link Float#POSITIVE_INFINITY}.
@param zZeroToOne
whether to use Vulkan's and Direct3D's NDC z range of <code>[0..+1]</code> when <code>true</code>
or whether to use OpenGL's NDC z range of <code>[-1..+1]</code> when <code>false</code>
@return this | [
"Set",
"this",
"matrix",
"to",
"be",
"an",
"arbitrary",
"perspective",
"projection",
"frustum",
"transformation",
"for",
"a",
"left",
"-",
"handed",
"coordinate",
"system",
"using",
"OpenGL",
"s",
"NDC",
"z",
"range",
"of",
"<code",
">",
"[",
"-",
"1",
"..... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4f.java#L10818-L10844 |
tango-controls/JTango | server/src/main/java/org/tango/server/build/BuilderUtils.java | BuilderUtils.getAttributeName | static String getAttributeName(final String fieldName, final Attribute annot) {
"""
Get attribute name from annotation {@link Attribute}
@param fieldName
@param annot
@return
"""
String attributeName = null;
if (annot.name().equals("")) {
attributeName = fieldName;
} else {
attributeName = annot.name();
}
return attributeName;
} | java | static String getAttributeName(final String fieldName, final Attribute annot) {
String attributeName = null;
if (annot.name().equals("")) {
attributeName = fieldName;
} else {
attributeName = annot.name();
}
return attributeName;
} | [
"static",
"String",
"getAttributeName",
"(",
"final",
"String",
"fieldName",
",",
"final",
"Attribute",
"annot",
")",
"{",
"String",
"attributeName",
"=",
"null",
";",
"if",
"(",
"annot",
".",
"name",
"(",
")",
".",
"equals",
"(",
"\"\"",
")",
")",
"{",
... | Get attribute name from annotation {@link Attribute}
@param fieldName
@param annot
@return | [
"Get",
"attribute",
"name",
"from",
"annotation",
"{",
"@link",
"Attribute",
"}"
] | train | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/server/build/BuilderUtils.java#L75-L83 |
Samsung/GearVRf | GVRf/Extensions/gvrf-physics/src/main/java/org/gearvrf/physics/PhysicsDragger.java | PhysicsDragger.startDrag | public GVRSceneObject startDrag(GVRSceneObject dragMe, float relX, float relY, float relZ) {
"""
Start the drag of the pivot object.
@param dragMe Scene object with a rigid body.
@param relX rel position in x-axis.
@param relY rel position in y-axis.
@param relZ rel position in z-axis.
@return Pivot instance if success, otherwise returns null.
"""
synchronized (mLock) {
if (mCursorController == null) {
Log.w(TAG, "Physics drag failed: Cursor controller not found!");
return null;
}
if (mDragMe != null) {
Log.w(TAG, "Physics drag failed: Previous drag wasn't finished!");
return null;
}
if (mPivotObject == null) {
mPivotObject = onCreatePivotObject(mContext);
}
mDragMe = dragMe;
GVRTransform t = dragMe.getTransform();
/* It is not possible to drag a rigid body directly, we need a pivot object.
We are using the pivot object's position as pivot of the dragging's physics constraint.
*/
mPivotObject.getTransform().setPosition(t.getPositionX() + relX,
t.getPositionY() + relY, t.getPositionZ() + relZ);
mCursorController.startDrag(mPivotObject);
}
return mPivotObject;
} | java | public GVRSceneObject startDrag(GVRSceneObject dragMe, float relX, float relY, float relZ) {
synchronized (mLock) {
if (mCursorController == null) {
Log.w(TAG, "Physics drag failed: Cursor controller not found!");
return null;
}
if (mDragMe != null) {
Log.w(TAG, "Physics drag failed: Previous drag wasn't finished!");
return null;
}
if (mPivotObject == null) {
mPivotObject = onCreatePivotObject(mContext);
}
mDragMe = dragMe;
GVRTransform t = dragMe.getTransform();
/* It is not possible to drag a rigid body directly, we need a pivot object.
We are using the pivot object's position as pivot of the dragging's physics constraint.
*/
mPivotObject.getTransform().setPosition(t.getPositionX() + relX,
t.getPositionY() + relY, t.getPositionZ() + relZ);
mCursorController.startDrag(mPivotObject);
}
return mPivotObject;
} | [
"public",
"GVRSceneObject",
"startDrag",
"(",
"GVRSceneObject",
"dragMe",
",",
"float",
"relX",
",",
"float",
"relY",
",",
"float",
"relZ",
")",
"{",
"synchronized",
"(",
"mLock",
")",
"{",
"if",
"(",
"mCursorController",
"==",
"null",
")",
"{",
"Log",
"."... | Start the drag of the pivot object.
@param dragMe Scene object with a rigid body.
@param relX rel position in x-axis.
@param relY rel position in y-axis.
@param relZ rel position in z-axis.
@return Pivot instance if success, otherwise returns null. | [
"Start",
"the",
"drag",
"of",
"the",
"pivot",
"object",
"."
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/gvrf-physics/src/main/java/org/gearvrf/physics/PhysicsDragger.java#L67-L97 |
jsilland/piezo | src/main/java/io/soliton/protobuf/json/JsonRpcServerHandler.java | JsonRpcServerHandler.validateTransport | private JsonRpcError validateTransport(HttpRequest request) throws URISyntaxException,
JsonRpcError {
"""
In charge of validating all the transport-related aspects of the incoming
HTTP request.
<p/>
<p>The checks include:</p>
<p/>
<ul>
<li>that the request's path matches that of this handler;</li>
<li>that the request's method is {@code POST};</li>
<li>that the request's content-type is {@code application/json};</li>
</ul>
@param request the received HTTP request
@return {@code null} if the request passes the transport checks, an error
to return to the client otherwise.
@throws URISyntaxException if the URI of the request cannot be parsed
"""
URI uri = new URI(request.getUri());
JsonRpcError error = null;
if (!uri.getPath().equals(rpcPath)) {
error = new JsonRpcError(HttpResponseStatus.NOT_FOUND, "Not Found");
}
if (!request.getMethod().equals(HttpMethod.POST)) {
error = new JsonRpcError(HttpResponseStatus.METHOD_NOT_ALLOWED,
"Method not allowed");
}
if (!request.headers().get(HttpHeaders.Names.CONTENT_TYPE)
.equals(JsonRpcProtocol.CONTENT_TYPE)) {
error = new JsonRpcError(HttpResponseStatus.UNSUPPORTED_MEDIA_TYPE,
"Unsupported media type");
}
return error;
} | java | private JsonRpcError validateTransport(HttpRequest request) throws URISyntaxException,
JsonRpcError {
URI uri = new URI(request.getUri());
JsonRpcError error = null;
if (!uri.getPath().equals(rpcPath)) {
error = new JsonRpcError(HttpResponseStatus.NOT_FOUND, "Not Found");
}
if (!request.getMethod().equals(HttpMethod.POST)) {
error = new JsonRpcError(HttpResponseStatus.METHOD_NOT_ALLOWED,
"Method not allowed");
}
if (!request.headers().get(HttpHeaders.Names.CONTENT_TYPE)
.equals(JsonRpcProtocol.CONTENT_TYPE)) {
error = new JsonRpcError(HttpResponseStatus.UNSUPPORTED_MEDIA_TYPE,
"Unsupported media type");
}
return error;
} | [
"private",
"JsonRpcError",
"validateTransport",
"(",
"HttpRequest",
"request",
")",
"throws",
"URISyntaxException",
",",
"JsonRpcError",
"{",
"URI",
"uri",
"=",
"new",
"URI",
"(",
"request",
".",
"getUri",
"(",
")",
")",
";",
"JsonRpcError",
"error",
"=",
"nul... | In charge of validating all the transport-related aspects of the incoming
HTTP request.
<p/>
<p>The checks include:</p>
<p/>
<ul>
<li>that the request's path matches that of this handler;</li>
<li>that the request's method is {@code POST};</li>
<li>that the request's content-type is {@code application/json};</li>
</ul>
@param request the received HTTP request
@return {@code null} if the request passes the transport checks, an error
to return to the client otherwise.
@throws URISyntaxException if the URI of the request cannot be parsed | [
"In",
"charge",
"of",
"validating",
"all",
"the",
"transport",
"-",
"related",
"aspects",
"of",
"the",
"incoming",
"HTTP",
"request",
".",
"<p",
"/",
">",
"<p",
">",
"The",
"checks",
"include",
":",
"<",
"/",
"p",
">",
"<p",
"/",
">",
"<ul",
">",
"... | train | https://github.com/jsilland/piezo/blob/9a340f1460d25e07ec475dd24128b838667c959b/src/main/java/io/soliton/protobuf/json/JsonRpcServerHandler.java#L150-L171 |
realtime-framework/RealtimeStorage-Android | library/src/main/java/co/realtime/storage/StorageRef.java | StorageRef.isAuthenticated | public StorageRef isAuthenticated(String authenticationToken, OnBooleanResponse onBooleanResponse, OnError onError) {
"""
Checks if a specified authentication token is authenticated.
<pre>
StorageRef storage = new StorageRef("your_app_key", "your_token");
storage.isAuthenticated("authToken",new OnBooleanResponse() {
@Override
public void run(Boolean aBoolean) {
Log.d("StorageRef", "Is Authenticated? : " + aBoolean);
}
}, new OnError() {
@Override
public void run(Integer integer, String errorMessage) {
Log.e("StorageRef","Error checking authentication: " + errorMessage);
}
});
</pre>
@param authenticationToken
The token to verify.
@param onBooleanResponse
The callback to call when the operation is completed, with an argument as a result of verification.
@param onError
The callback to call if an exception occurred
@return Current storage reference
"""
PostBodyBuilder pbb = new PostBodyBuilder(context);
Rest r = new Rest(context, RestType.ISAUTHENTICATED, pbb, null);
r.onError = onError;
r.onBooleanResponse = onBooleanResponse;
r.rawBody = "{\"applicationKey\":\""+context.applicationKey+"\", \"authenticationToken\":\""+authenticationToken+"\"}";
context.processRest(r);
return this;
} | java | public StorageRef isAuthenticated(String authenticationToken, OnBooleanResponse onBooleanResponse, OnError onError){
PostBodyBuilder pbb = new PostBodyBuilder(context);
Rest r = new Rest(context, RestType.ISAUTHENTICATED, pbb, null);
r.onError = onError;
r.onBooleanResponse = onBooleanResponse;
r.rawBody = "{\"applicationKey\":\""+context.applicationKey+"\", \"authenticationToken\":\""+authenticationToken+"\"}";
context.processRest(r);
return this;
} | [
"public",
"StorageRef",
"isAuthenticated",
"(",
"String",
"authenticationToken",
",",
"OnBooleanResponse",
"onBooleanResponse",
",",
"OnError",
"onError",
")",
"{",
"PostBodyBuilder",
"pbb",
"=",
"new",
"PostBodyBuilder",
"(",
"context",
")",
";",
"Rest",
"r",
"=",
... | Checks if a specified authentication token is authenticated.
<pre>
StorageRef storage = new StorageRef("your_app_key", "your_token");
storage.isAuthenticated("authToken",new OnBooleanResponse() {
@Override
public void run(Boolean aBoolean) {
Log.d("StorageRef", "Is Authenticated? : " + aBoolean);
}
}, new OnError() {
@Override
public void run(Integer integer, String errorMessage) {
Log.e("StorageRef","Error checking authentication: " + errorMessage);
}
});
</pre>
@param authenticationToken
The token to verify.
@param onBooleanResponse
The callback to call when the operation is completed, with an argument as a result of verification.
@param onError
The callback to call if an exception occurred
@return Current storage reference | [
"Checks",
"if",
"a",
"specified",
"authentication",
"token",
"is",
"authenticated",
"."
] | train | https://github.com/realtime-framework/RealtimeStorage-Android/blob/05816a6b7a6dcc83f9e7400ac3048494dadca302/library/src/main/java/co/realtime/storage/StorageRef.java#L408-L416 |
facebookarchive/hadoop-20 | src/contrib/streaming/src/java/org/apache/hadoop/streaming/UTF8ByteArrayUtils.java | UTF8ByteArrayUtils.findByte | @Deprecated
public static int findByte(byte [] utf, int start, int end, byte b) {
"""
Find the first occurrence of the given byte b in a UTF-8 encoded string
@param utf a byte array containing a UTF-8 encoded string
@param start starting offset
@param end ending position
@param b the byte to find
@return position that first byte occures otherwise -1
@deprecated use
{@link org.apache.hadoop.util.UTF8ByteArrayUtils#findByte(byte[], int,
int, byte)}
"""
return org.apache.hadoop.util.UTF8ByteArrayUtils.findByte(utf, start, end, b);
} | java | @Deprecated
public static int findByte(byte [] utf, int start, int end, byte b) {
return org.apache.hadoop.util.UTF8ByteArrayUtils.findByte(utf, start, end, b);
} | [
"@",
"Deprecated",
"public",
"static",
"int",
"findByte",
"(",
"byte",
"[",
"]",
"utf",
",",
"int",
"start",
",",
"int",
"end",
",",
"byte",
"b",
")",
"{",
"return",
"org",
".",
"apache",
".",
"hadoop",
".",
"util",
".",
"UTF8ByteArrayUtils",
".",
"f... | Find the first occurrence of the given byte b in a UTF-8 encoded string
@param utf a byte array containing a UTF-8 encoded string
@param start starting offset
@param end ending position
@param b the byte to find
@return position that first byte occures otherwise -1
@deprecated use
{@link org.apache.hadoop.util.UTF8ByteArrayUtils#findByte(byte[], int,
int, byte)} | [
"Find",
"the",
"first",
"occurrence",
"of",
"the",
"given",
"byte",
"b",
"in",
"a",
"UTF",
"-",
"8",
"encoded",
"string"
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/streaming/src/java/org/apache/hadoop/streaming/UTF8ByteArrayUtils.java#L57-L60 |
Wadpam/guja | guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDConnectionDaoImpl.java | GeneratedDConnectionDaoImpl.queryBySecret | public Iterable<DConnection> queryBySecret(java.lang.String secret) {
"""
query-by method for field secret
@param secret the specified attribute
@return an Iterable of DConnections for the specified secret
"""
return queryByField(null, DConnectionMapper.Field.SECRET.getFieldName(), secret);
} | java | public Iterable<DConnection> queryBySecret(java.lang.String secret) {
return queryByField(null, DConnectionMapper.Field.SECRET.getFieldName(), secret);
} | [
"public",
"Iterable",
"<",
"DConnection",
">",
"queryBySecret",
"(",
"java",
".",
"lang",
".",
"String",
"secret",
")",
"{",
"return",
"queryByField",
"(",
"null",
",",
"DConnectionMapper",
".",
"Field",
".",
"SECRET",
".",
"getFieldName",
"(",
")",
",",
"... | query-by method for field secret
@param secret the specified attribute
@return an Iterable of DConnections for the specified secret | [
"query",
"-",
"by",
"method",
"for",
"field",
"secret"
] | train | https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDConnectionDaoImpl.java#L142-L144 |
elki-project/elki | elki/src/main/java/de/lmu/ifi/dbs/elki/algorithm/statistics/EvaluateRetrievalPerformance.java | EvaluateRetrievalPerformance.computeDistances | private void computeDistances(ModifiableDoubleDBIDList nlist, DBIDIter query, final DistanceQuery<O> distQuery, Relation<O> relation) {
"""
Compute the distances to the neighbor objects.
@param nlist Neighbor list (output)
@param query Query object
@param distQuery Distance function
@param relation Data relation
"""
nlist.clear();
O qo = relation.get(query);
for(DBIDIter ri = relation.iterDBIDs(); ri.valid(); ri.advance()) {
if(!includeSelf && DBIDUtil.equal(ri, query)) {
continue;
}
double dist = distQuery.distance(qo, ri);
if(dist != dist) { /* NaN */
dist = Double.POSITIVE_INFINITY;
}
nlist.add(dist, ri);
}
nlist.sort();
} | java | private void computeDistances(ModifiableDoubleDBIDList nlist, DBIDIter query, final DistanceQuery<O> distQuery, Relation<O> relation) {
nlist.clear();
O qo = relation.get(query);
for(DBIDIter ri = relation.iterDBIDs(); ri.valid(); ri.advance()) {
if(!includeSelf && DBIDUtil.equal(ri, query)) {
continue;
}
double dist = distQuery.distance(qo, ri);
if(dist != dist) { /* NaN */
dist = Double.POSITIVE_INFINITY;
}
nlist.add(dist, ri);
}
nlist.sort();
} | [
"private",
"void",
"computeDistances",
"(",
"ModifiableDoubleDBIDList",
"nlist",
",",
"DBIDIter",
"query",
",",
"final",
"DistanceQuery",
"<",
"O",
">",
"distQuery",
",",
"Relation",
"<",
"O",
">",
"relation",
")",
"{",
"nlist",
".",
"clear",
"(",
")",
";",
... | Compute the distances to the neighbor objects.
@param nlist Neighbor list (output)
@param query Query object
@param distQuery Distance function
@param relation Data relation | [
"Compute",
"the",
"distances",
"to",
"the",
"neighbor",
"objects",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki/src/main/java/de/lmu/ifi/dbs/elki/algorithm/statistics/EvaluateRetrievalPerformance.java#L244-L258 |
greatman/GreatmancodeTools | src/main/java/com/greatmancode/tools/utils/Vector.java | Vector.getMidpoint | public Vector getMidpoint(Vector other) {
"""
Gets a new midpoint vector between this vector and another.
@param other The other vector
@return a new midpoint vector
"""
double x = (this.x + other.x) / 2;
double y = (this.y + other.y) / 2;
double z = (this.z + other.z) / 2;
return new Vector(x, y, z);
} | java | public Vector getMidpoint(Vector other) {
double x = (this.x + other.x) / 2;
double y = (this.y + other.y) / 2;
double z = (this.z + other.z) / 2;
return new Vector(x, y, z);
} | [
"public",
"Vector",
"getMidpoint",
"(",
"Vector",
"other",
")",
"{",
"double",
"x",
"=",
"(",
"this",
".",
"x",
"+",
"other",
".",
"x",
")",
"/",
"2",
";",
"double",
"y",
"=",
"(",
"this",
".",
"y",
"+",
"other",
".",
"y",
")",
"/",
"2",
";",... | Gets a new midpoint vector between this vector and another.
@param other The other vector
@return a new midpoint vector | [
"Gets",
"a",
"new",
"midpoint",
"vector",
"between",
"this",
"vector",
"and",
"another",
"."
] | train | https://github.com/greatman/GreatmancodeTools/blob/4c9d2656c5c8298ff9e1f235c9be8b148e43c9f1/src/main/java/com/greatmancode/tools/utils/Vector.java#L237-L242 |
knowm/XChange | xchange-coingi/src/main/java/org/knowm/xchange/coingi/CoingiAdapters.java | CoingiAdapters.adaptTrade | public static Trade adaptTrade(
CoingiUserTransaction tx, CurrencyPair currencyPair, int timeScale) {
"""
Adapts a Transaction to a Trade Object
@param tx The Coingi transaction
@param currencyPair (e.g. BTC/USD)
@param timeScale polled order books provide a timestamp in seconds, stream in ms
@return The XChange Trade
"""
OrderType orderType = tx.getType() == 0 ? OrderType.BID : OrderType.ASK;
final String tradeId = tx.getId();
Date date =
DateUtils.fromMillisUtc(
tx.getTimestamp()
* timeScale); // polled order books provide a timestamp in seconds, stream in ms
return new Trade(orderType, tx.getBaseAmount(), currencyPair, tx.getPrice(), date, tradeId);
} | java | public static Trade adaptTrade(
CoingiUserTransaction tx, CurrencyPair currencyPair, int timeScale) {
OrderType orderType = tx.getType() == 0 ? OrderType.BID : OrderType.ASK;
final String tradeId = tx.getId();
Date date =
DateUtils.fromMillisUtc(
tx.getTimestamp()
* timeScale); // polled order books provide a timestamp in seconds, stream in ms
return new Trade(orderType, tx.getBaseAmount(), currencyPair, tx.getPrice(), date, tradeId);
} | [
"public",
"static",
"Trade",
"adaptTrade",
"(",
"CoingiUserTransaction",
"tx",
",",
"CurrencyPair",
"currencyPair",
",",
"int",
"timeScale",
")",
"{",
"OrderType",
"orderType",
"=",
"tx",
".",
"getType",
"(",
")",
"==",
"0",
"?",
"OrderType",
".",
"BID",
":"... | Adapts a Transaction to a Trade Object
@param tx The Coingi transaction
@param currencyPair (e.g. BTC/USD)
@param timeScale polled order books provide a timestamp in seconds, stream in ms
@return The XChange Trade | [
"Adapts",
"a",
"Transaction",
"to",
"a",
"Trade",
"Object"
] | train | https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-coingi/src/main/java/org/knowm/xchange/coingi/CoingiAdapters.java#L160-L170 |
neoremind/fluent-validator | fluent-validator/src/main/java/com/baidu/unbiz/fluentvalidator/util/ReflectionUtil.java | ReflectionUtil.getMethod | public static Method getMethod(Class<?> clazz, String methodName, Class<?>... parameterTypes) {
"""
获取方法
@param clazz 类
@param methodName 方法名
@param parameterTypes 方法参数
@return 方法
"""
if (clazz == null || methodName == null || methodName.length() == 0) {
return null;
}
for (Class<?> itr = clazz; hasSuperClass(itr); ) {
Method[] methods = itr.getDeclaredMethods();
for (Method method : methods) {
if (method.getName().equals(methodName) && Arrays.equals(method.getParameterTypes(), parameterTypes)) {
return method;
}
}
itr = itr.getSuperclass();
}
return null;
} | java | public static Method getMethod(Class<?> clazz, String methodName, Class<?>... parameterTypes) {
if (clazz == null || methodName == null || methodName.length() == 0) {
return null;
}
for (Class<?> itr = clazz; hasSuperClass(itr); ) {
Method[] methods = itr.getDeclaredMethods();
for (Method method : methods) {
if (method.getName().equals(methodName) && Arrays.equals(method.getParameterTypes(), parameterTypes)) {
return method;
}
}
itr = itr.getSuperclass();
}
return null;
} | [
"public",
"static",
"Method",
"getMethod",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"String",
"methodName",
",",
"Class",
"<",
"?",
">",
"...",
"parameterTypes",
")",
"{",
"if",
"(",
"clazz",
"==",
"null",
"||",
"methodName",
"==",
"null",
"||",
"met... | 获取方法
@param clazz 类
@param methodName 方法名
@param parameterTypes 方法参数
@return 方法 | [
"获取方法"
] | train | https://github.com/neoremind/fluent-validator/blob/b516970591aa9468b44ba63938b98ec341fd6ead/fluent-validator/src/main/java/com/baidu/unbiz/fluentvalidator/util/ReflectionUtil.java#L142-L159 |
alibaba/canal | driver/src/main/java/com/alibaba/otter/canal/parse/driver/mysql/packets/server/FieldPacket.java | FieldPacket.fromBytes | public void fromBytes(byte[] data) throws IOException {
"""
<pre>
VERSION 4.1
Bytes Name
----- ----
n (Length Coded String) catalog
n (Length Coded String) db
n (Length Coded String) table
n (Length Coded String) org_table
n (Length Coded String) name
n (Length Coded String) org_name
1 (filler)
2 charsetnr
4 length
1 type
2 flags
1 decimals
2 (filler), always 0x00
n (Length Coded Binary) default
</pre>
"""
int index = 0;
LengthCodedStringReader reader = new LengthCodedStringReader(null, index);
// 1.
catalog = reader.readLengthCodedString(data);
// 2.
db = reader.readLengthCodedString(data);
this.table = reader.readLengthCodedString(data);
this.originalTable = reader.readLengthCodedString(data);
this.name = reader.readLengthCodedString(data);
this.originalName = reader.readLengthCodedString(data);
index = reader.getIndex();
//
index++;
//
this.character = ByteHelper.readUnsignedShortLittleEndian(data, index);
index += 2;
//
this.length = ByteHelper.readUnsignedIntLittleEndian(data, index);
index += 4;
//
this.type = data[index];
index++;
//
this.flags = ByteHelper.readUnsignedShortLittleEndian(data, index);
index += 2;
//
this.decimals = data[index];
index++;
//
index += 2;// skip filter
//
if (index < data.length) {
reader.setIndex(index);
this.definition = reader.readLengthCodedString(data);
}
} | java | public void fromBytes(byte[] data) throws IOException {
int index = 0;
LengthCodedStringReader reader = new LengthCodedStringReader(null, index);
// 1.
catalog = reader.readLengthCodedString(data);
// 2.
db = reader.readLengthCodedString(data);
this.table = reader.readLengthCodedString(data);
this.originalTable = reader.readLengthCodedString(data);
this.name = reader.readLengthCodedString(data);
this.originalName = reader.readLengthCodedString(data);
index = reader.getIndex();
//
index++;
//
this.character = ByteHelper.readUnsignedShortLittleEndian(data, index);
index += 2;
//
this.length = ByteHelper.readUnsignedIntLittleEndian(data, index);
index += 4;
//
this.type = data[index];
index++;
//
this.flags = ByteHelper.readUnsignedShortLittleEndian(data, index);
index += 2;
//
this.decimals = data[index];
index++;
//
index += 2;// skip filter
//
if (index < data.length) {
reader.setIndex(index);
this.definition = reader.readLengthCodedString(data);
}
} | [
"public",
"void",
"fromBytes",
"(",
"byte",
"[",
"]",
"data",
")",
"throws",
"IOException",
"{",
"int",
"index",
"=",
"0",
";",
"LengthCodedStringReader",
"reader",
"=",
"new",
"LengthCodedStringReader",
"(",
"null",
",",
"index",
")",
";",
"// 1.",
"catalog... | <pre>
VERSION 4.1
Bytes Name
----- ----
n (Length Coded String) catalog
n (Length Coded String) db
n (Length Coded String) table
n (Length Coded String) org_table
n (Length Coded String) name
n (Length Coded String) org_name
1 (filler)
2 charsetnr
4 length
1 type
2 flags
1 decimals
2 (filler), always 0x00
n (Length Coded Binary) default
</pre> | [
"<pre",
">",
"VERSION",
"4",
".",
"1",
"Bytes",
"Name",
"-----",
"----",
"n",
"(",
"Length",
"Coded",
"String",
")",
"catalog",
"n",
"(",
"Length",
"Coded",
"String",
")",
"db",
"n",
"(",
"Length",
"Coded",
"String",
")",
"table",
"n",
"(",
"Length",... | train | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/driver/src/main/java/com/alibaba/otter/canal/parse/driver/mysql/packets/server/FieldPacket.java#L46-L83 |
overturetool/overture | core/codegen/platform/src/main/java/org/overture/codegen/ir/CodeGenBase.java | CodeGenBase.emitCode | public static void emitCode(File outputFolder, String fileName, String code) {
"""
Emits generated code to a file. The file will be encoded using UTF-8.
@param outputFolder
The output folder that will store the generated code.
@param fileName
The name of the file that will store the generated code.
@param code
The generated code.
"""
emitCode(outputFolder, fileName, code, "UTF-8");
} | java | public static void emitCode(File outputFolder, String fileName, String code)
{
emitCode(outputFolder, fileName, code, "UTF-8");
} | [
"public",
"static",
"void",
"emitCode",
"(",
"File",
"outputFolder",
",",
"String",
"fileName",
",",
"String",
"code",
")",
"{",
"emitCode",
"(",
"outputFolder",
",",
"fileName",
",",
"code",
",",
"\"UTF-8\"",
")",
";",
"}"
] | Emits generated code to a file. The file will be encoded using UTF-8.
@param outputFolder
The output folder that will store the generated code.
@param fileName
The name of the file that will store the generated code.
@param code
The generated code. | [
"Emits",
"generated",
"code",
"to",
"a",
"file",
".",
"The",
"file",
"will",
"be",
"encoded",
"using",
"UTF",
"-",
"8",
"."
] | train | https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/core/codegen/platform/src/main/java/org/overture/codegen/ir/CodeGenBase.java#L594-L597 |
dropwizard/dropwizard | dropwizard-jersey/src/main/java/io/dropwizard/jersey/validation/ConstraintMessage.java | ConstraintMessage.determineStatus | public static <T extends ConstraintViolation<?>> int determineStatus(Set<T> violations, Invocable invocable) {
"""
Given a set of constraint violations and a Jersey {@link Invocable} where the constraint
occurred, determine the HTTP Status code for the response. A return value violation is an
internal server error, an invalid request body is unprocessable entity, and any params that
are invalid means a bad request
"""
if (violations.size() > 0) {
final ConstraintViolation<?> violation = violations.iterator().next();
for (Path.Node node : violation.getPropertyPath()) {
switch (node.getKind()) {
case RETURN_VALUE:
return 500;
case PARAMETER:
// Now determine if the parameter is the request entity
final int index = node.as(Path.ParameterNode.class).getParameterIndex();
final Parameter parameter = invocable.getParameters().get(index);
return parameter.getSource().equals(Parameter.Source.UNKNOWN) ? 422 : 400;
default:
continue;
}
}
}
// This shouldn't hit, but if it does, we'll return a unprocessable entity
return 422;
} | java | public static <T extends ConstraintViolation<?>> int determineStatus(Set<T> violations, Invocable invocable) {
if (violations.size() > 0) {
final ConstraintViolation<?> violation = violations.iterator().next();
for (Path.Node node : violation.getPropertyPath()) {
switch (node.getKind()) {
case RETURN_VALUE:
return 500;
case PARAMETER:
// Now determine if the parameter is the request entity
final int index = node.as(Path.ParameterNode.class).getParameterIndex();
final Parameter parameter = invocable.getParameters().get(index);
return parameter.getSource().equals(Parameter.Source.UNKNOWN) ? 422 : 400;
default:
continue;
}
}
}
// This shouldn't hit, but if it does, we'll return a unprocessable entity
return 422;
} | [
"public",
"static",
"<",
"T",
"extends",
"ConstraintViolation",
"<",
"?",
">",
">",
"int",
"determineStatus",
"(",
"Set",
"<",
"T",
">",
"violations",
",",
"Invocable",
"invocable",
")",
"{",
"if",
"(",
"violations",
".",
"size",
"(",
")",
">",
"0",
")... | Given a set of constraint violations and a Jersey {@link Invocable} where the constraint
occurred, determine the HTTP Status code for the response. A return value violation is an
internal server error, an invalid request body is unprocessable entity, and any params that
are invalid means a bad request | [
"Given",
"a",
"set",
"of",
"constraint",
"violations",
"and",
"a",
"Jersey",
"{"
] | train | https://github.com/dropwizard/dropwizard/blob/7ee09a410476b9681e8072ab684788bb440877bd/dropwizard-jersey/src/main/java/io/dropwizard/jersey/validation/ConstraintMessage.java#L176-L196 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.