repository_name stringlengths 7 54 | func_path_in_repository stringlengths 18 196 | func_name stringlengths 7 107 | whole_func_string stringlengths 76 3.82k | language stringclasses 1
value | func_code_string stringlengths 76 3.82k | func_code_tokens listlengths 22 717 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 508 | split_name stringclasses 1
value | func_code_url stringlengths 111 310 |
|---|---|---|---|---|---|---|---|---|---|---|
sarxos/v4l4j | src/main/java/au/edu/jcu/v4l4j/PushSource.java | PushSource.stopCapture | public final void stopCapture() {
synchronized (this) {
// make sure we are running
if ((state == STATE_STOPPED) || (state == STATE_ABOUT_TO_STOP))
//throw new StateException("The capture is about to stop");
return;
// update our state
state = STATE_ABOUT_TO_STOP;
}
if (thread.isAlive()) {
thread.interrupt();
// wait for thread to exit if the push thread is not the one
// trying to join
if (! Thread.currentThread().equals(thread)) {
while (state == STATE_ABOUT_TO_STOP) {
try {
// wait for thread to exit
thread.join();
//thread = null;
} catch (InterruptedException e) {
// interrupted while waiting for the thread to join
// keep waiting
// System.err.println("interrupted while waiting for frame pusher thread to complete");
// e.printStackTrace();
// throw new StateException("interrupted while waiting for frame pusher thread to complete", e);
}
}
}
}
} | java | public final void stopCapture() {
synchronized (this) {
// make sure we are running
if ((state == STATE_STOPPED) || (state == STATE_ABOUT_TO_STOP))
//throw new StateException("The capture is about to stop");
return;
// update our state
state = STATE_ABOUT_TO_STOP;
}
if (thread.isAlive()) {
thread.interrupt();
// wait for thread to exit if the push thread is not the one
// trying to join
if (! Thread.currentThread().equals(thread)) {
while (state == STATE_ABOUT_TO_STOP) {
try {
// wait for thread to exit
thread.join();
//thread = null;
} catch (InterruptedException e) {
// interrupted while waiting for the thread to join
// keep waiting
// System.err.println("interrupted while waiting for frame pusher thread to complete");
// e.printStackTrace();
// throw new StateException("interrupted while waiting for frame pusher thread to complete", e);
}
}
}
}
} | [
"public",
"final",
"void",
"stopCapture",
"(",
")",
"{",
"synchronized",
"(",
"this",
")",
"{",
"// make sure we are running",
"if",
"(",
"(",
"state",
"==",
"STATE_STOPPED",
")",
"||",
"(",
"state",
"==",
"STATE_ABOUT_TO_STOP",
")",
")",
"//throw new StateExcep... | This method instructs this source to stop frame delivery
to the {@link CaptureCallback} object.
@throws StateException if the capture has already been stopped | [
"This",
"method",
"instructs",
"this",
"source",
"to",
"stop",
"frame",
"delivery",
"to",
"the",
"{"
] | train | https://github.com/sarxos/v4l4j/blob/4fc0eec2c3a1a4260593f6ac03b7a8013e3804c9/src/main/java/au/edu/jcu/v4l4j/PushSource.java#L89-L122 |
CloudSlang/cs-actions | cs-postgres/src/main/java/io/cloudslang/content/postgres/actions/UpdatePgHbaConfigAction.java | UpdatePgHbaConfigAction.execute | @Action(name = "Update pg_hba.config",
outputs = {
@Output(RETURN_CODE),
@Output(RETURN_RESULT),
@Output(EXCEPTION),
@Output(STDERR)
},
responses = {
@Response(text = ResponseNames.SUCCESS, field = RETURN_CODE, value = SUCCESS,
matchType = MatchType.COMPARE_EQUAL,
responseType = ResponseType.RESOLVED),
@Response(text = ResponseNames.FAILURE, field = RETURN_CODE, value = FAILURE,
matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.ERROR, isOnFail = true)
})
public Map<String, String> execute(
@Param(value = FILE_PATH, required = true) String installationPath,
@Param(value = ALLOWED_HOSTS) String allowedHosts,
@Param(value = ALLOWED_USERS) String allowedUsers
) {
try {
if (allowedHosts == null && allowedUsers == null) {
return getSuccessResultsMap("No changes in pg_hba.conf");
}
if (allowedHosts == null || allowedHosts.trim().length() == 0) {
allowedHosts = "localhost";
}
allowedHosts = allowedHosts.replace("\'", "").trim();
if (allowedUsers == null || allowedUsers.trim().length() == 0) {
allowedUsers = "all";
} else {
allowedUsers = allowedUsers.replace("\'", "").trim();
}
ConfigService.changeProperty(installationPath, allowedHosts.split(";"), allowedUsers.split(";"));
return getSuccessResultsMap("Updated pg_hba.conf successfully");
} catch (Exception e) {
return getFailureResultsMap("Failed to update pg_hba.conf", e);
}
} | java | @Action(name = "Update pg_hba.config",
outputs = {
@Output(RETURN_CODE),
@Output(RETURN_RESULT),
@Output(EXCEPTION),
@Output(STDERR)
},
responses = {
@Response(text = ResponseNames.SUCCESS, field = RETURN_CODE, value = SUCCESS,
matchType = MatchType.COMPARE_EQUAL,
responseType = ResponseType.RESOLVED),
@Response(text = ResponseNames.FAILURE, field = RETURN_CODE, value = FAILURE,
matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.ERROR, isOnFail = true)
})
public Map<String, String> execute(
@Param(value = FILE_PATH, required = true) String installationPath,
@Param(value = ALLOWED_HOSTS) String allowedHosts,
@Param(value = ALLOWED_USERS) String allowedUsers
) {
try {
if (allowedHosts == null && allowedUsers == null) {
return getSuccessResultsMap("No changes in pg_hba.conf");
}
if (allowedHosts == null || allowedHosts.trim().length() == 0) {
allowedHosts = "localhost";
}
allowedHosts = allowedHosts.replace("\'", "").trim();
if (allowedUsers == null || allowedUsers.trim().length() == 0) {
allowedUsers = "all";
} else {
allowedUsers = allowedUsers.replace("\'", "").trim();
}
ConfigService.changeProperty(installationPath, allowedHosts.split(";"), allowedUsers.split(";"));
return getSuccessResultsMap("Updated pg_hba.conf successfully");
} catch (Exception e) {
return getFailureResultsMap("Failed to update pg_hba.conf", e);
}
} | [
"@",
"Action",
"(",
"name",
"=",
"\"Update pg_hba.config\"",
",",
"outputs",
"=",
"{",
"@",
"Output",
"(",
"RETURN_CODE",
")",
",",
"@",
"Output",
"(",
"RETURN_RESULT",
")",
",",
"@",
"Output",
"(",
"EXCEPTION",
")",
",",
"@",
"Output",
"(",
"STDERR",
... | Updates the Postgres config pg_hba.config
@param installationPath The full path to the PostgreSQL configuration file in the local machine to be updated.
@param allowedHosts A wildcard or a comma-separated list of hostnames or IPs (IPv4 or IPv6).
@param allowedUsers A comma-separated list of PostgreSQL users. If no value is specified for this input,
all users will have access to the server.
@return A map with strings as keys and strings as values that contains: outcome of the action (or failure message
and the exception if there is one), returnCode of the operation and the ID of the request | [
"Updates",
"the",
"Postgres",
"config",
"pg_hba",
".",
"config"
] | train | https://github.com/CloudSlang/cs-actions/blob/9a1be1e99ad88286a6c153d5f2275df6ae1a57a1/cs-postgres/src/main/java/io/cloudslang/content/postgres/actions/UpdatePgHbaConfigAction.java#L49-L91 |
JRebirth/JRebirth | org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/service/AbstractService.java | AbstractService.bindTitle | private void bindTitle(final ServiceTask<?> task, final StringProperty titleProperty) {
// Perform this binding into the JAT to respect widget and task API
JRebirth.runIntoJAT("Bind Title for " + task.getServiceHandlerName(),
// Bind the task title
() -> titleProperty.bind(task.titleProperty()));
} | java | private void bindTitle(final ServiceTask<?> task, final StringProperty titleProperty) {
// Perform this binding into the JAT to respect widget and task API
JRebirth.runIntoJAT("Bind Title for " + task.getServiceHandlerName(),
// Bind the task title
() -> titleProperty.bind(task.titleProperty()));
} | [
"private",
"void",
"bindTitle",
"(",
"final",
"ServiceTask",
"<",
"?",
">",
"task",
",",
"final",
"StringProperty",
"titleProperty",
")",
"{",
"// Perform this binding into the JAT to respect widget and task API",
"JRebirth",
".",
"runIntoJAT",
"(",
"\"Bind Title for \"",
... | Bind a task to a string property that will display the task title.
@param task the service task that we need to follow the progression
@param titleProperty the title presenter | [
"Bind",
"a",
"task",
"to",
"a",
"string",
"property",
"that",
"will",
"display",
"the",
"task",
"title",
"."
] | train | https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/service/AbstractService.java#L224-L230 |
osmdroid/osmdroid | osmdroid-android/src/main/java/org/osmdroid/tileprovider/cachemanager/CacheManager.java | CacheManager.getTilesRect | public static Rect getTilesRect(final BoundingBox pBB,
final int pZoomLevel){
final int mapTileUpperBound = 1 << pZoomLevel;
final int right = MapView.getTileSystem().getTileXFromLongitude(pBB.getLonEast(), pZoomLevel);
final int bottom = MapView.getTileSystem().getTileYFromLatitude(pBB.getLatSouth(), pZoomLevel);
final int left = MapView.getTileSystem().getTileXFromLongitude(pBB.getLonWest(), pZoomLevel);
final int top = MapView.getTileSystem().getTileYFromLatitude(pBB.getLatNorth(), pZoomLevel);
int width = right - left + 1; // handling the modulo
if (width <= 0) {
width += mapTileUpperBound;
}
int height = bottom - top + 1; // handling the modulo
if (height <= 0) {
height += mapTileUpperBound;
}
return new Rect(left, top, left + width - 1, top + height - 1);
} | java | public static Rect getTilesRect(final BoundingBox pBB,
final int pZoomLevel){
final int mapTileUpperBound = 1 << pZoomLevel;
final int right = MapView.getTileSystem().getTileXFromLongitude(pBB.getLonEast(), pZoomLevel);
final int bottom = MapView.getTileSystem().getTileYFromLatitude(pBB.getLatSouth(), pZoomLevel);
final int left = MapView.getTileSystem().getTileXFromLongitude(pBB.getLonWest(), pZoomLevel);
final int top = MapView.getTileSystem().getTileYFromLatitude(pBB.getLatNorth(), pZoomLevel);
int width = right - left + 1; // handling the modulo
if (width <= 0) {
width += mapTileUpperBound;
}
int height = bottom - top + 1; // handling the modulo
if (height <= 0) {
height += mapTileUpperBound;
}
return new Rect(left, top, left + width - 1, top + height - 1);
} | [
"public",
"static",
"Rect",
"getTilesRect",
"(",
"final",
"BoundingBox",
"pBB",
",",
"final",
"int",
"pZoomLevel",
")",
"{",
"final",
"int",
"mapTileUpperBound",
"=",
"1",
"<<",
"pZoomLevel",
";",
"final",
"int",
"right",
"=",
"MapView",
".",
"getTileSystem",
... | Retrieve upper left and lower right points(exclusive) corresponding to the tiles coverage for
the selected zoom level.
@param pBB the given bounding box
@param pZoomLevel the given zoom level
@return the {@link Rect} reflecting the tiles coverage | [
"Retrieve",
"upper",
"left",
"and",
"lower",
"right",
"points",
"(",
"exclusive",
")",
"corresponding",
"to",
"the",
"tiles",
"coverage",
"for",
"the",
"selected",
"zoom",
"level",
"."
] | train | https://github.com/osmdroid/osmdroid/blob/3b178b2f078497dd88c137110e87aafe45ad2b16/osmdroid-android/src/main/java/org/osmdroid/tileprovider/cachemanager/CacheManager.java#L246-L262 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java | KeyVaultClientBaseImpl.updateCertificateAsync | public ServiceFuture<CertificateBundle> updateCertificateAsync(String vaultBaseUrl, String certificateName, String certificateVersion, final ServiceCallback<CertificateBundle> serviceCallback) {
return ServiceFuture.fromResponse(updateCertificateWithServiceResponseAsync(vaultBaseUrl, certificateName, certificateVersion), serviceCallback);
} | java | public ServiceFuture<CertificateBundle> updateCertificateAsync(String vaultBaseUrl, String certificateName, String certificateVersion, final ServiceCallback<CertificateBundle> serviceCallback) {
return ServiceFuture.fromResponse(updateCertificateWithServiceResponseAsync(vaultBaseUrl, certificateName, certificateVersion), serviceCallback);
} | [
"public",
"ServiceFuture",
"<",
"CertificateBundle",
">",
"updateCertificateAsync",
"(",
"String",
"vaultBaseUrl",
",",
"String",
"certificateName",
",",
"String",
"certificateVersion",
",",
"final",
"ServiceCallback",
"<",
"CertificateBundle",
">",
"serviceCallback",
")"... | Updates the specified attributes associated with the given certificate.
The UpdateCertificate operation applies the specified update on the given certificate; the only elements updated are the certificate's attributes. This operation requires the certificates/update permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param certificateName The name of the certificate in the given key vault.
@param certificateVersion The version of the certificate.
@param serviceCallback the async ServiceCallback to handle successful and failed responses.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceFuture} object | [
"Updates",
"the",
"specified",
"attributes",
"associated",
"with",
"the",
"given",
"certificate",
".",
"The",
"UpdateCertificate",
"operation",
"applies",
"the",
"specified",
"update",
"on",
"the",
"given",
"certificate",
";",
"the",
"only",
"elements",
"updated",
... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L7352-L7354 |
Erudika/para | para-core/src/main/java/com/erudika/para/core/User.java | User.isValidEmailConfirmationToken | public final boolean isValidEmailConfirmationToken(String token) {
Sysprop s = CoreUtils.getInstance().getDao().read(getAppid(), identifier);
return isValidToken(s, Config._EMAIL_TOKEN, token);
} | java | public final boolean isValidEmailConfirmationToken(String token) {
Sysprop s = CoreUtils.getInstance().getDao().read(getAppid(), identifier);
return isValidToken(s, Config._EMAIL_TOKEN, token);
} | [
"public",
"final",
"boolean",
"isValidEmailConfirmationToken",
"(",
"String",
"token",
")",
"{",
"Sysprop",
"s",
"=",
"CoreUtils",
".",
"getInstance",
"(",
")",
".",
"getDao",
"(",
")",
".",
"read",
"(",
"getAppid",
"(",
")",
",",
"identifier",
")",
";",
... | Validates a token sent for email confirmation.
@param token a token
@return true if valid | [
"Validates",
"a",
"token",
"sent",
"for",
"email",
"confirmation",
"."
] | train | https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-core/src/main/java/com/erudika/para/core/User.java#L728-L731 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java | ImgUtil.convert | public static void convert(InputStream srcStream, String formatName, OutputStream destStream) {
write(read(srcStream), formatName, getImageOutputStream(destStream));
} | java | public static void convert(InputStream srcStream, String formatName, OutputStream destStream) {
write(read(srcStream), formatName, getImageOutputStream(destStream));
} | [
"public",
"static",
"void",
"convert",
"(",
"InputStream",
"srcStream",
",",
"String",
"formatName",
",",
"OutputStream",
"destStream",
")",
"{",
"write",
"(",
"read",
"(",
"srcStream",
")",
",",
"formatName",
",",
"getImageOutputStream",
"(",
"destStream",
")",... | 图像类型转换:GIF=》JPG、GIF=》PNG、PNG=》JPG、PNG=》GIF(X)、BMP=》PNG<br>
此方法并不关闭流
@param srcStream 源图像流
@param formatName 包含格式非正式名称的 String:如JPG、JPEG、GIF等
@param destStream 目标图像输出流
@since 3.0.9 | [
"图像类型转换:GIF",
"=",
"》JPG、GIF",
"=",
"》PNG、PNG",
"=",
"》JPG、PNG",
"=",
"》GIF",
"(",
"X",
")",
"、BMP",
"=",
"》PNG<br",
">",
"此方法并不关闭流"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L521-L523 |
messagebird/java-rest-api | api/src/main/java/com/messagebird/MessageBirdClient.java | MessageBirdClient.getRequestHlr | public Hlr getRequestHlr(final BigInteger msisdn, final String reference) throws GeneralException, UnauthorizedException {
if (msisdn == null) {
throw new IllegalArgumentException("msisdn must be specified.");
}
if (reference == null) {
throw new IllegalArgumentException("Reference must be specified.");
}
final Map<String, Object> payload = new LinkedHashMap<String, Object>();
payload.put("msisdn", msisdn);
payload.put("reference", reference);
return messageBirdService.sendPayLoad(HLRPATH, payload, Hlr.class);
} | java | public Hlr getRequestHlr(final BigInteger msisdn, final String reference) throws GeneralException, UnauthorizedException {
if (msisdn == null) {
throw new IllegalArgumentException("msisdn must be specified.");
}
if (reference == null) {
throw new IllegalArgumentException("Reference must be specified.");
}
final Map<String, Object> payload = new LinkedHashMap<String, Object>();
payload.put("msisdn", msisdn);
payload.put("reference", reference);
return messageBirdService.sendPayLoad(HLRPATH, payload, Hlr.class);
} | [
"public",
"Hlr",
"getRequestHlr",
"(",
"final",
"BigInteger",
"msisdn",
",",
"final",
"String",
"reference",
")",
"throws",
"GeneralException",
",",
"UnauthorizedException",
"{",
"if",
"(",
"msisdn",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentExceptio... | MessageBird provides an API to send Network Queries to any mobile number across the world.
An HLR allows you to view which mobile number (MSISDN) belongs to what operator in real time and see whether the number is active.
@param msisdn The telephone number.
@param reference A client reference
@return Hlr Object
@throws UnauthorizedException if client is unauthorized
@throws GeneralException general exception | [
"MessageBird",
"provides",
"an",
"API",
"to",
"send",
"Network",
"Queries",
"to",
"any",
"mobile",
"number",
"across",
"the",
"world",
".",
"An",
"HLR",
"allows",
"you",
"to",
"view",
"which",
"mobile",
"number",
"(",
"MSISDN",
")",
"belongs",
"to",
"what"... | train | https://github.com/messagebird/java-rest-api/blob/f92cd93afff413e6dc12aa6e41e69f26cbae8941/api/src/main/java/com/messagebird/MessageBirdClient.java#L100-L111 |
jbundle/jbundle | app/program/db/src/main/java/org/jbundle/app/program/db/IncludeScopeField.java | IncludeScopeField.setupDefaultView | public ScreenComponent setupDefaultView(ScreenLoc itsLocation, ComponentParent targetScreen, Convert converter, int iDisplayFieldDesc, Map<String, Object> properties)
{
ScreenComponent screenField = null;
createScreenComponent(ScreenModel.STATIC_STRING, itsLocation, targetScreen, converter, iDisplayFieldDesc, properties);
String strDisplay = converter.getFieldDesc();
if ((strDisplay != null) && (strDisplay.length() > 0))
{
ScreenLoc descLocation = targetScreen.getNextLocation(ScreenConstants.FIELD_DESC, ScreenConstants.DONT_SET_ANCHOR);
Map<String, Object> descProps = new HashMap<String, Object>();
descProps.put(ScreenModel.DISPLAY_STRING, strDisplay);
createScreenComponent(ScreenModel.STATIC_STRING, descLocation, targetScreen, null, 0, properties);
}
Converter dayConverter = (Converter)converter;
dayConverter = new FieldDescConverter(dayConverter, "Thick");
dayConverter = new BitConverter(dayConverter, 0, true, true);
itsLocation = targetScreen.getNextLocation(ScreenConstants.RIGHT_OF_LAST_CHECKBOX, ScreenConstants.DONT_SET_ANCHOR);
screenField = dayConverter.setupDefaultView(itsLocation, targetScreen, iDisplayFieldDesc);
dayConverter = new FieldDescConverter(dayConverter, "Thin");
dayConverter = new BitConverter(dayConverter, 1, true, true);
itsLocation = targetScreen.getNextLocation(ScreenConstants.RIGHT_OF_LAST_CHECKBOX, ScreenConstants.DONT_SET_ANCHOR);
screenField = dayConverter.setupDefaultView(itsLocation, targetScreen, iDisplayFieldDesc);
dayConverter = new FieldDescConverter(dayConverter, "Interface");
dayConverter = new BitConverter(dayConverter, 2, true, true);
itsLocation = targetScreen.getNextLocation(ScreenConstants.RIGHT_OF_LAST_CHECKBOX, ScreenConstants.DONT_SET_ANCHOR);
screenField = dayConverter.setupDefaultView(itsLocation, targetScreen, iDisplayFieldDesc);
return screenField;
} | java | public ScreenComponent setupDefaultView(ScreenLoc itsLocation, ComponentParent targetScreen, Convert converter, int iDisplayFieldDesc, Map<String, Object> properties)
{
ScreenComponent screenField = null;
createScreenComponent(ScreenModel.STATIC_STRING, itsLocation, targetScreen, converter, iDisplayFieldDesc, properties);
String strDisplay = converter.getFieldDesc();
if ((strDisplay != null) && (strDisplay.length() > 0))
{
ScreenLoc descLocation = targetScreen.getNextLocation(ScreenConstants.FIELD_DESC, ScreenConstants.DONT_SET_ANCHOR);
Map<String, Object> descProps = new HashMap<String, Object>();
descProps.put(ScreenModel.DISPLAY_STRING, strDisplay);
createScreenComponent(ScreenModel.STATIC_STRING, descLocation, targetScreen, null, 0, properties);
}
Converter dayConverter = (Converter)converter;
dayConverter = new FieldDescConverter(dayConverter, "Thick");
dayConverter = new BitConverter(dayConverter, 0, true, true);
itsLocation = targetScreen.getNextLocation(ScreenConstants.RIGHT_OF_LAST_CHECKBOX, ScreenConstants.DONT_SET_ANCHOR);
screenField = dayConverter.setupDefaultView(itsLocation, targetScreen, iDisplayFieldDesc);
dayConverter = new FieldDescConverter(dayConverter, "Thin");
dayConverter = new BitConverter(dayConverter, 1, true, true);
itsLocation = targetScreen.getNextLocation(ScreenConstants.RIGHT_OF_LAST_CHECKBOX, ScreenConstants.DONT_SET_ANCHOR);
screenField = dayConverter.setupDefaultView(itsLocation, targetScreen, iDisplayFieldDesc);
dayConverter = new FieldDescConverter(dayConverter, "Interface");
dayConverter = new BitConverter(dayConverter, 2, true, true);
itsLocation = targetScreen.getNextLocation(ScreenConstants.RIGHT_OF_LAST_CHECKBOX, ScreenConstants.DONT_SET_ANCHOR);
screenField = dayConverter.setupDefaultView(itsLocation, targetScreen, iDisplayFieldDesc);
return screenField;
} | [
"public",
"ScreenComponent",
"setupDefaultView",
"(",
"ScreenLoc",
"itsLocation",
",",
"ComponentParent",
"targetScreen",
",",
"Convert",
"converter",
",",
"int",
"iDisplayFieldDesc",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
")",
"{",
"ScreenComp... | Set up the default screen control for this field.
@param itsLocation Location of this component on screen (ie., GridBagConstraint).
@param targetScreen Where to place this component (ie., Parent screen or GridBagLayout).
@param converter The converter to set the screenfield to.
@param iDisplayFieldDesc Display the label? (optional).
@param properties Extra properties
@return Return the component or ScreenField that is created for this field. | [
"Set",
"up",
"the",
"default",
"screen",
"control",
"for",
"this",
"field",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/db/src/main/java/org/jbundle/app/program/db/IncludeScopeField.java#L66-L96 |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/BootstrapConfig.java | BootstrapConfig.assertDirectory | protected File assertDirectory(String dirName, String locName) {
File d = new File(dirName);
if (d.isFile())
throw new LocationException("Path must reference a directory", MessageFormat.format(BootstrapConstants.messages.getString("error.specifiedLocation"), locName,
d.getAbsolutePath()));
return d;
} | java | protected File assertDirectory(String dirName, String locName) {
File d = new File(dirName);
if (d.isFile())
throw new LocationException("Path must reference a directory", MessageFormat.format(BootstrapConstants.messages.getString("error.specifiedLocation"), locName,
d.getAbsolutePath()));
return d;
} | [
"protected",
"File",
"assertDirectory",
"(",
"String",
"dirName",
",",
"String",
"locName",
")",
"{",
"File",
"d",
"=",
"new",
"File",
"(",
"dirName",
")",
";",
"if",
"(",
"d",
".",
"isFile",
"(",
")",
")",
"throw",
"new",
"LocationException",
"(",
"\"... | Ensure that the given directory either does not yet exists,
or exists as a directory.
@param dirName
Name/path to directory
@param locName
Symbol/location associated with directory
@return File for directory location
@throws LocationException
if dirName references an existing File (isFile). | [
"Ensure",
"that",
"the",
"given",
"directory",
"either",
"does",
"not",
"yet",
"exists",
"or",
"exists",
"as",
"a",
"directory",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/BootstrapConfig.java#L372-L378 |
graphhopper/graphhopper | core/src/main/java/com/graphhopper/reader/dem/AbstractTiffElevationProvider.java | AbstractTiffElevationProvider.downloadFile | private void downloadFile(File downloadFile, String url) throws IOException {
if (!downloadFile.exists()) {
int max = 3;
for (int trial = 0; trial < max; trial++) {
try {
downloader.downloadFile(url, downloadFile.getAbsolutePath());
return;
} catch (SocketTimeoutException ex) {
if (trial >= max - 1)
throw new RuntimeException(ex);
try {
Thread.sleep(sleep);
} catch (InterruptedException ignored) {
}
}
}
}
} | java | private void downloadFile(File downloadFile, String url) throws IOException {
if (!downloadFile.exists()) {
int max = 3;
for (int trial = 0; trial < max; trial++) {
try {
downloader.downloadFile(url, downloadFile.getAbsolutePath());
return;
} catch (SocketTimeoutException ex) {
if (trial >= max - 1)
throw new RuntimeException(ex);
try {
Thread.sleep(sleep);
} catch (InterruptedException ignored) {
}
}
}
}
} | [
"private",
"void",
"downloadFile",
"(",
"File",
"downloadFile",
",",
"String",
"url",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"downloadFile",
".",
"exists",
"(",
")",
")",
"{",
"int",
"max",
"=",
"3",
";",
"for",
"(",
"int",
"trial",
"=",
... | Download a file at the provided url and save it as the given downloadFile if the downloadFile does not exist. | [
"Download",
"a",
"file",
"at",
"the",
"provided",
"url",
"and",
"save",
"it",
"as",
"the",
"given",
"downloadFile",
"if",
"the",
"downloadFile",
"does",
"not",
"exist",
"."
] | train | https://github.com/graphhopper/graphhopper/blob/c235e306e6e823043cadcc41ead0e685bdebf737/core/src/main/java/com/graphhopper/reader/dem/AbstractTiffElevationProvider.java#L150-L167 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDBaseOps.java | SDBaseOps.squaredNorm | public SDVariable squaredNorm(String name, SDVariable x, boolean keepDims, int... dimensions) {
validateNumerical("squaredNorm", x);
SDVariable result = f().squaredNorm(x, keepDims, dimensions);
return updateVariableNameAndReference(result, name);
} | java | public SDVariable squaredNorm(String name, SDVariable x, boolean keepDims, int... dimensions) {
validateNumerical("squaredNorm", x);
SDVariable result = f().squaredNorm(x, keepDims, dimensions);
return updateVariableNameAndReference(result, name);
} | [
"public",
"SDVariable",
"squaredNorm",
"(",
"String",
"name",
",",
"SDVariable",
"x",
",",
"boolean",
"keepDims",
",",
"int",
"...",
"dimensions",
")",
"{",
"validateNumerical",
"(",
"\"squaredNorm\"",
",",
"x",
")",
";",
"SDVariable",
"result",
"=",
"f",
"(... | Squared L2 norm: see {@link #norm2(String, SDVariable, boolean, int...)} | [
"Squared",
"L2",
"norm",
":",
"see",
"{"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDBaseOps.java#L2497-L2501 |
redisson/redisson | redisson/src/main/java/org/redisson/api/CronSchedule.java | CronSchedule.dailyAtHourAndMinute | public static CronSchedule dailyAtHourAndMinute(int hour, int minute) {
String expression = String.format("0 %d %d ? * *", minute, hour);
return of(expression);
} | java | public static CronSchedule dailyAtHourAndMinute(int hour, int minute) {
String expression = String.format("0 %d %d ? * *", minute, hour);
return of(expression);
} | [
"public",
"static",
"CronSchedule",
"dailyAtHourAndMinute",
"(",
"int",
"hour",
",",
"int",
"minute",
")",
"{",
"String",
"expression",
"=",
"String",
".",
"format",
"(",
"\"0 %d %d ? * *\"",
",",
"minute",
",",
"hour",
")",
";",
"return",
"of",
"(",
"expres... | Creates cron expression which schedule task execution
every day at the given time
@param hour of schedule
@param minute of schedule
@return object
@throws IllegalArgumentException
wrapping a ParseException if the expression is invalid | [
"Creates",
"cron",
"expression",
"which",
"schedule",
"task",
"execution",
"every",
"day",
"at",
"the",
"given",
"time"
] | train | https://github.com/redisson/redisson/blob/d3acc0249b2d5d658d36d99e2c808ce49332ea44/redisson/src/main/java/org/redisson/api/CronSchedule.java#L60-L63 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java | ModelsImpl.getPrebuilt | public PrebuiltEntityExtractor getPrebuilt(UUID appId, String versionId, UUID prebuiltId) {
return getPrebuiltWithServiceResponseAsync(appId, versionId, prebuiltId).toBlocking().single().body();
} | java | public PrebuiltEntityExtractor getPrebuilt(UUID appId, String versionId, UUID prebuiltId) {
return getPrebuiltWithServiceResponseAsync(appId, versionId, prebuiltId).toBlocking().single().body();
} | [
"public",
"PrebuiltEntityExtractor",
"getPrebuilt",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"UUID",
"prebuiltId",
")",
"{",
"return",
"getPrebuiltWithServiceResponseAsync",
"(",
"appId",
",",
"versionId",
",",
"prebuiltId",
")",
".",
"toBlocking",
"("... | Gets information about the prebuilt entity model.
@param appId The application ID.
@param versionId The version ID.
@param prebuiltId The prebuilt entity extractor ID.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the PrebuiltEntityExtractor object if successful. | [
"Gets",
"information",
"about",
"the",
"prebuilt",
"entity",
"model",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L4689-L4691 |
Azure/azure-sdk-for-java | appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/AppServiceCertificateOrdersInner.java | AppServiceCertificateOrdersInner.beginCreateOrUpdate | public AppServiceCertificateOrderInner beginCreateOrUpdate(String resourceGroupName, String certificateOrderName, AppServiceCertificateOrderInner certificateDistinguishedName) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, certificateOrderName, certificateDistinguishedName).toBlocking().single().body();
} | java | public AppServiceCertificateOrderInner beginCreateOrUpdate(String resourceGroupName, String certificateOrderName, AppServiceCertificateOrderInner certificateDistinguishedName) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, certificateOrderName, certificateDistinguishedName).toBlocking().single().body();
} | [
"public",
"AppServiceCertificateOrderInner",
"beginCreateOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"certificateOrderName",
",",
"AppServiceCertificateOrderInner",
"certificateDistinguishedName",
")",
"{",
"return",
"beginCreateOrUpdateWithServiceResponseAsync",
"(... | Create or update a certificate purchase order.
Create or update a certificate purchase order.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param certificateOrderName Name of the certificate order.
@param certificateDistinguishedName Distinguished name to to use for the certificate order.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws DefaultErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the AppServiceCertificateOrderInner object if successful. | [
"Create",
"or",
"update",
"a",
"certificate",
"purchase",
"order",
".",
"Create",
"or",
"update",
"a",
"certificate",
"purchase",
"order",
"."
] | 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/AppServiceCertificateOrdersInner.java#L675-L677 |
lightblueseas/jcommons-lang | src/main/java/de/alpharogroup/lang/BooleanExtensions.java | BooleanExtensions.trueOrFalse | public static <T> T trueOrFalse(final T trueCase, final T falseCase, final boolean... flags)
{
boolean interlink = true;
if (flags != null && 0 < flags.length)
{
interlink = false;
}
for (int i = 0; i < flags.length; i++)
{
if (i == 0)
{
interlink = !flags[i];
continue;
}
interlink &= !flags[i];
}
if (interlink)
{
return falseCase;
}
return trueCase;
} | java | public static <T> T trueOrFalse(final T trueCase, final T falseCase, final boolean... flags)
{
boolean interlink = true;
if (flags != null && 0 < flags.length)
{
interlink = false;
}
for (int i = 0; i < flags.length; i++)
{
if (i == 0)
{
interlink = !flags[i];
continue;
}
interlink &= !flags[i];
}
if (interlink)
{
return falseCase;
}
return trueCase;
} | [
"public",
"static",
"<",
"T",
">",
"T",
"trueOrFalse",
"(",
"final",
"T",
"trueCase",
",",
"final",
"T",
"falseCase",
",",
"final",
"boolean",
"...",
"flags",
")",
"{",
"boolean",
"interlink",
"=",
"true",
";",
"if",
"(",
"flags",
"!=",
"null",
"&&",
... | Decides over the given flags if the true-case or the false-case will be return.
@param <T>
the generic type
@param trueCase
the object to return in true case
@param falseCase
the object to return in false case
@param flags
the flags whice decide what to return
@return the false-case if all false or empty otherwise the true-case. | [
"Decides",
"over",
"the",
"given",
"flags",
"if",
"the",
"true",
"-",
"case",
"or",
"the",
"false",
"-",
"case",
"will",
"be",
"return",
"."
] | train | https://github.com/lightblueseas/jcommons-lang/blob/000e1f198e949ec3e721fd0fc3f5946e945232a3/src/main/java/de/alpharogroup/lang/BooleanExtensions.java#L49-L70 |
trustathsh/ifmapj | src/main/java/util/CanonicalXML.java | CanonicalXML.toCanonicalXml2 | public String toCanonicalXml2(XMLReader parser, InputSource inputSource, boolean stripSpace) throws Exception {
mStrip = stripSpace;
mOut = new StringWriter();
parser.setContentHandler(this);
parser.setErrorHandler(this);
parser.parse(inputSource);
return mOut.toString();
} | java | public String toCanonicalXml2(XMLReader parser, InputSource inputSource, boolean stripSpace) throws Exception {
mStrip = stripSpace;
mOut = new StringWriter();
parser.setContentHandler(this);
parser.setErrorHandler(this);
parser.parse(inputSource);
return mOut.toString();
} | [
"public",
"String",
"toCanonicalXml2",
"(",
"XMLReader",
"parser",
",",
"InputSource",
"inputSource",
",",
"boolean",
"stripSpace",
")",
"throws",
"Exception",
"{",
"mStrip",
"=",
"stripSpace",
";",
"mOut",
"=",
"new",
"StringWriter",
"(",
")",
";",
"parser",
... | Create canonical XML silently, throwing exceptions rather than displaying messages
@param parser
@param inputSource
@param stripSpace
@return
@throws Exception | [
"Create",
"canonical",
"XML",
"silently",
"throwing",
"exceptions",
"rather",
"than",
"displaying",
"messages"
] | train | https://github.com/trustathsh/ifmapj/blob/44ece9e95a3d2a1b7019573ba6178598a6cbdaa3/src/main/java/util/CanonicalXML.java#L132-L139 |
LAW-Unimi/BUbiNG | src/it/unimi/di/law/bubing/util/URLRespectsRobots.java | URLRespectsRobots.apply | public static boolean apply(final char[][] robotsFilter, final URI url) {
if (robotsFilter.length == 0) return true;
final String pathQuery = BURL.pathAndQuery(url);
int from = 0;
int to = robotsFilter.length - 1;
while (from <= to) {
final int mid = (from + to) >>> 1;
final int cmp = compare(robotsFilter[mid], pathQuery);
if (cmp < 0) from = mid + 1;
else if (cmp > 0) to = mid - 1;
else return false; // key found (unlikely, but possible)
}
return from == 0 ? true : doesNotStartsWith(pathQuery, robotsFilter[from - 1]);
} | java | public static boolean apply(final char[][] robotsFilter, final URI url) {
if (robotsFilter.length == 0) return true;
final String pathQuery = BURL.pathAndQuery(url);
int from = 0;
int to = robotsFilter.length - 1;
while (from <= to) {
final int mid = (from + to) >>> 1;
final int cmp = compare(robotsFilter[mid], pathQuery);
if (cmp < 0) from = mid + 1;
else if (cmp > 0) to = mid - 1;
else return false; // key found (unlikely, but possible)
}
return from == 0 ? true : doesNotStartsWith(pathQuery, robotsFilter[from - 1]);
} | [
"public",
"static",
"boolean",
"apply",
"(",
"final",
"char",
"[",
"]",
"[",
"]",
"robotsFilter",
",",
"final",
"URI",
"url",
")",
"{",
"if",
"(",
"robotsFilter",
".",
"length",
"==",
"0",
")",
"return",
"true",
";",
"final",
"String",
"pathQuery",
"="... | Checks whether a specified URL passes a specified robots filter.
@param robotsFilter a robot filter.
@param url a URL to check against {@code robotsFilter}.
@return true if {@code url} passes {@code robotsFilter}. | [
"Checks",
"whether",
"a",
"specified",
"URL",
"passes",
"a",
"specified",
"robots",
"filter",
"."
] | train | https://github.com/LAW-Unimi/BUbiNG/blob/e148acc90031a4f3967422705a9fb07ddaf155e4/src/it/unimi/di/law/bubing/util/URLRespectsRobots.java#L214-L227 |
salesforce/Argus | ArgusCore/src/main/java/com/salesforce/dva/argus/entity/SubsystemSuspensionLevels.java | SubsystemSuspensionLevels.getSuspensionLevelsBySubsystem | public static Map<Integer, Long> getSuspensionLevelsBySubsystem(EntityManager em, SubSystem subSystem) {
return findBySubsystem(em, subSystem).getLevels();
} | java | public static Map<Integer, Long> getSuspensionLevelsBySubsystem(EntityManager em, SubSystem subSystem) {
return findBySubsystem(em, subSystem).getLevels();
} | [
"public",
"static",
"Map",
"<",
"Integer",
",",
"Long",
">",
"getSuspensionLevelsBySubsystem",
"(",
"EntityManager",
"em",
",",
"SubSystem",
"subSystem",
")",
"{",
"return",
"findBySubsystem",
"(",
"em",
",",
"subSystem",
")",
".",
"getLevels",
"(",
")",
";",
... | Retrieves the suspension levels for the given subsystem.
@param em The EntityManager to use.
@param subSystem The subsystem for which to retrieve suspension levels.
@return The suspension levels for the given subsystem. | [
"Retrieves",
"the",
"suspension",
"levels",
"for",
"the",
"given",
"subsystem",
"."
] | train | https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusCore/src/main/java/com/salesforce/dva/argus/entity/SubsystemSuspensionLevels.java#L156-L158 |
apereo/cas | support/cas-server-support-pm-webflow/src/main/java/org/apereo/cas/pm/web/flow/actions/SendPasswordResetInstructionsAction.java | SendPasswordResetInstructionsAction.sendPasswordResetEmailToAccount | protected boolean sendPasswordResetEmailToAccount(final String to, final String url) {
val reset = casProperties.getAuthn().getPm().getReset().getMail();
val text = reset.getFormattedBody(url);
return this.communicationsManager.email(reset, to, text);
} | java | protected boolean sendPasswordResetEmailToAccount(final String to, final String url) {
val reset = casProperties.getAuthn().getPm().getReset().getMail();
val text = reset.getFormattedBody(url);
return this.communicationsManager.email(reset, to, text);
} | [
"protected",
"boolean",
"sendPasswordResetEmailToAccount",
"(",
"final",
"String",
"to",
",",
"final",
"String",
"url",
")",
"{",
"val",
"reset",
"=",
"casProperties",
".",
"getAuthn",
"(",
")",
".",
"getPm",
"(",
")",
".",
"getReset",
"(",
")",
".",
"getM... | Send password reset email to account.
@param to the to
@param url the url
@return true/false | [
"Send",
"password",
"reset",
"email",
"to",
"account",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-pm-webflow/src/main/java/org/apereo/cas/pm/web/flow/actions/SendPasswordResetInstructionsAction.java#L137-L141 |
ops4j/org.ops4j.pax.logging | pax-logging-api/src/main/java/org/apache/logging/log4j/LogManager.java | LogManager.getContext | public static LoggerContext getContext(final ClassLoader loader, final boolean currentContext) {
try {
return factory.getContext(FQCN, loader, null, currentContext);
} catch (final IllegalStateException ex) {
LOGGER.warn(ex.getMessage() + " Using SimpleLogger");
return new SimpleLoggerContextFactory().getContext(FQCN, loader, null, currentContext);
}
} | java | public static LoggerContext getContext(final ClassLoader loader, final boolean currentContext) {
try {
return factory.getContext(FQCN, loader, null, currentContext);
} catch (final IllegalStateException ex) {
LOGGER.warn(ex.getMessage() + " Using SimpleLogger");
return new SimpleLoggerContextFactory().getContext(FQCN, loader, null, currentContext);
}
} | [
"public",
"static",
"LoggerContext",
"getContext",
"(",
"final",
"ClassLoader",
"loader",
",",
"final",
"boolean",
"currentContext",
")",
"{",
"try",
"{",
"return",
"factory",
".",
"getContext",
"(",
"FQCN",
",",
"loader",
",",
"null",
",",
"currentContext",
"... | Returns a LoggerContext.
@param loader The ClassLoader for the context. If null the context will attempt to determine the appropriate
ClassLoader.
@param currentContext if false the LoggerContext appropriate for the caller of this method is returned. For
example, in a web application if the caller is a class in WEB-INF/lib then one LoggerContext may be
returned and if the caller is a class in the container's classpath then a different LoggerContext may
be returned. If true then only a single LoggerContext will be returned.
@return a LoggerContext. | [
"Returns",
"a",
"LoggerContext",
"."
] | train | https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/apache/logging/log4j/LogManager.java#L134-L141 |
m-m-m/util | text/src/main/java/net/sf/mmm/util/text/base/UnicodeUtilImpl.java | UnicodeUtilImpl.initIso843 | private static void initIso843(Map<Character, String> map) {
// Greek letters
map.put(GREEK_CAPITAL_LETTER_ALPHA, "A");
map.put(GREEK_CAPITAL_LETTER_BETA, "B");
map.put(GREEK_CAPITAL_LETTER_GAMMA, "G");
map.put(GREEK_CAPITAL_LETTER_DELTA, "D");
map.put(GREEK_CAPITAL_LETTER_EPSILON, "E");
map.put(GREEK_CAPITAL_LETTER_ZETA, "Z");
map.put(GREEK_CAPITAL_LETTER_ETA, Character.toString(LATIN_CAPITAL_LETTER_E_WITH_MACRON));
map.put(GREEK_CAPITAL_LETTER_THETA, "Th");
map.put(GREEK_CAPITAL_LETTER_IOTA, "I");
map.put(GREEK_CAPITAL_LETTER_KAPPA, "K");
map.put(GREEK_CAPITAL_LETTER_LAMDA, "L");
map.put(GREEK_CAPITAL_LETTER_MU, "M");
map.put(GREEK_CAPITAL_LETTER_NU, "N");
map.put(GREEK_CAPITAL_LETTER_XI, "X");
map.put(GREEK_CAPITAL_LETTER_OMICRON, "O");
map.put(GREEK_CAPITAL_LETTER_PI, "P");
map.put(GREEK_CAPITAL_LETTER_RHO, "R");
map.put(GREEK_CAPITAL_LETTER_SIGMA, "S");
map.put(GREEK_CAPITAL_LETTER_TAU, "T");
map.put(GREEK_CAPITAL_LETTER_UPSILON, "Y");
map.put(GREEK_CAPITAL_LETTER_PHI, "F");
map.put(GREEK_CAPITAL_LETTER_CHI, "Ch");
map.put(GREEK_CAPITAL_LETTER_PSI, "Ps");
map.put(GREEK_CAPITAL_LETTER_OMEGA, Character.toString(LATIN_CAPITAL_LETTER_O_WITH_MACRON));
// greek specials
map.put(GREEK_LETTER_DIGAMMA, "F");
map.put(GREEK_CAPITAL_LETTER_HETA, "H");
map.put(GREEK_CAPITAL_LETTER_KAPPA, "Q");
map.put(GREEK_CAPITAL_LETTER_SAN, "S");
map.put(GREEK_LETTER_SAMPI, "Ss");
map.put(GREEK_SMALL_LETTER_ALPHA, "a");
map.put(GREEK_SMALL_LETTER_BETA, "b");
map.put(GREEK_SMALL_LETTER_GAMMA, "g");
map.put(GREEK_SMALL_LETTER_DELTA, "d");
map.put(GREEK_SMALL_LETTER_EPSILON, "e");
map.put(GREEK_SMALL_LETTER_ZETA, "z");
map.put(GREEK_SMALL_LETTER_ETA, Character.toString(LATIN_SMALL_LETTER_E_WITH_MACRON));
map.put(GREEK_SMALL_LETTER_ETA_WITH_TONOS, Character.toString(LATIN_SMALL_LETTER_E_WITH_MACRON_AND_ACUTE));
map.put(GREEK_SMALL_LETTER_THETA, "th");
map.put(GREEK_SMALL_LETTER_IOTA, "i");
map.put(GREEK_SMALL_LETTER_IOTA_WITH_TONOS, Character.toString(LATIN_SMALL_LETTER_I_WITH_ACUTE));
map.put(GREEK_SMALL_LETTER_KAPPA, "k");
map.put(GREEK_SMALL_LETTER_LAMDA, "l");
map.put(GREEK_SMALL_LETTER_MU, "m");
map.put(GREEK_SMALL_LETTER_NU, "n");
map.put(GREEK_SMALL_LETTER_XI, "x");
map.put(GREEK_SMALL_LETTER_OMICRON, "o");
map.put(GREEK_SMALL_LETTER_PI, "p");
map.put(GREEK_SMALL_LETTER_RHO, "r");
map.put(GREEK_SMALL_LETTER_SIGMA, "s");
map.put(GREEK_SMALL_LETTER_TAU, "t");
map.put(GREEK_SMALL_LETTER_UPSILON, "y");
map.put(GREEK_SMALL_LETTER_PHI, "f");
map.put(GREEK_SMALL_LETTER_CHI, "ch");
map.put(GREEK_SMALL_LETTER_PSI, "ps");
map.put(GREEK_SMALL_LETTER_OMEGA, Character.toString(LATIN_SMALL_LETTER_O_WITH_MACRON));
// greek specials
map.put(GREEK_SMALL_LETTER_DIGAMMA, "f");
map.put(GREEK_SMALL_LETTER_HETA, "h");
map.put(GREEK_SMALL_LETTER_KOPPA, "q");
map.put(GREEK_SMALL_LETTER_SAN, "s");
map.put(GREEK_SMALL_LETTER_SAMPI, "ss");
} | java | private static void initIso843(Map<Character, String> map) {
// Greek letters
map.put(GREEK_CAPITAL_LETTER_ALPHA, "A");
map.put(GREEK_CAPITAL_LETTER_BETA, "B");
map.put(GREEK_CAPITAL_LETTER_GAMMA, "G");
map.put(GREEK_CAPITAL_LETTER_DELTA, "D");
map.put(GREEK_CAPITAL_LETTER_EPSILON, "E");
map.put(GREEK_CAPITAL_LETTER_ZETA, "Z");
map.put(GREEK_CAPITAL_LETTER_ETA, Character.toString(LATIN_CAPITAL_LETTER_E_WITH_MACRON));
map.put(GREEK_CAPITAL_LETTER_THETA, "Th");
map.put(GREEK_CAPITAL_LETTER_IOTA, "I");
map.put(GREEK_CAPITAL_LETTER_KAPPA, "K");
map.put(GREEK_CAPITAL_LETTER_LAMDA, "L");
map.put(GREEK_CAPITAL_LETTER_MU, "M");
map.put(GREEK_CAPITAL_LETTER_NU, "N");
map.put(GREEK_CAPITAL_LETTER_XI, "X");
map.put(GREEK_CAPITAL_LETTER_OMICRON, "O");
map.put(GREEK_CAPITAL_LETTER_PI, "P");
map.put(GREEK_CAPITAL_LETTER_RHO, "R");
map.put(GREEK_CAPITAL_LETTER_SIGMA, "S");
map.put(GREEK_CAPITAL_LETTER_TAU, "T");
map.put(GREEK_CAPITAL_LETTER_UPSILON, "Y");
map.put(GREEK_CAPITAL_LETTER_PHI, "F");
map.put(GREEK_CAPITAL_LETTER_CHI, "Ch");
map.put(GREEK_CAPITAL_LETTER_PSI, "Ps");
map.put(GREEK_CAPITAL_LETTER_OMEGA, Character.toString(LATIN_CAPITAL_LETTER_O_WITH_MACRON));
// greek specials
map.put(GREEK_LETTER_DIGAMMA, "F");
map.put(GREEK_CAPITAL_LETTER_HETA, "H");
map.put(GREEK_CAPITAL_LETTER_KAPPA, "Q");
map.put(GREEK_CAPITAL_LETTER_SAN, "S");
map.put(GREEK_LETTER_SAMPI, "Ss");
map.put(GREEK_SMALL_LETTER_ALPHA, "a");
map.put(GREEK_SMALL_LETTER_BETA, "b");
map.put(GREEK_SMALL_LETTER_GAMMA, "g");
map.put(GREEK_SMALL_LETTER_DELTA, "d");
map.put(GREEK_SMALL_LETTER_EPSILON, "e");
map.put(GREEK_SMALL_LETTER_ZETA, "z");
map.put(GREEK_SMALL_LETTER_ETA, Character.toString(LATIN_SMALL_LETTER_E_WITH_MACRON));
map.put(GREEK_SMALL_LETTER_ETA_WITH_TONOS, Character.toString(LATIN_SMALL_LETTER_E_WITH_MACRON_AND_ACUTE));
map.put(GREEK_SMALL_LETTER_THETA, "th");
map.put(GREEK_SMALL_LETTER_IOTA, "i");
map.put(GREEK_SMALL_LETTER_IOTA_WITH_TONOS, Character.toString(LATIN_SMALL_LETTER_I_WITH_ACUTE));
map.put(GREEK_SMALL_LETTER_KAPPA, "k");
map.put(GREEK_SMALL_LETTER_LAMDA, "l");
map.put(GREEK_SMALL_LETTER_MU, "m");
map.put(GREEK_SMALL_LETTER_NU, "n");
map.put(GREEK_SMALL_LETTER_XI, "x");
map.put(GREEK_SMALL_LETTER_OMICRON, "o");
map.put(GREEK_SMALL_LETTER_PI, "p");
map.put(GREEK_SMALL_LETTER_RHO, "r");
map.put(GREEK_SMALL_LETTER_SIGMA, "s");
map.put(GREEK_SMALL_LETTER_TAU, "t");
map.put(GREEK_SMALL_LETTER_UPSILON, "y");
map.put(GREEK_SMALL_LETTER_PHI, "f");
map.put(GREEK_SMALL_LETTER_CHI, "ch");
map.put(GREEK_SMALL_LETTER_PSI, "ps");
map.put(GREEK_SMALL_LETTER_OMEGA, Character.toString(LATIN_SMALL_LETTER_O_WITH_MACRON));
// greek specials
map.put(GREEK_SMALL_LETTER_DIGAMMA, "f");
map.put(GREEK_SMALL_LETTER_HETA, "h");
map.put(GREEK_SMALL_LETTER_KOPPA, "q");
map.put(GREEK_SMALL_LETTER_SAN, "s");
map.put(GREEK_SMALL_LETTER_SAMPI, "ss");
} | [
"private",
"static",
"void",
"initIso843",
"(",
"Map",
"<",
"Character",
",",
"String",
">",
"map",
")",
"{",
"// Greek letters",
"map",
".",
"put",
"(",
"GREEK_CAPITAL_LETTER_ALPHA",
",",
"\"A\"",
")",
";",
"map",
".",
"put",
"(",
"GREEK_CAPITAL_LETTER_BETA",... | Implementation of <a href="http://en.wikipedia.org/wiki/ISO_843">ISO 843</a> (Greek transliteration).
@param map is where to add the transliteration mapping. | [
"Implementation",
"of",
"<a",
"href",
"=",
"http",
":",
"//",
"en",
".",
"wikipedia",
".",
"org",
"/",
"wiki",
"/",
"ISO_843",
">",
"ISO",
"843<",
"/",
"a",
">",
"(",
"Greek",
"transliteration",
")",
"."
] | train | https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/text/src/main/java/net/sf/mmm/util/text/base/UnicodeUtilImpl.java#L304-L370 |
vakinge/jeesuite-libs | jeesuite-common/src/main/java/com/jeesuite/common/crypt/DES.java | DES.decrypt | public static String decrypt(String key,String data) {
if(data == null)
return null;
try {
DESKeySpec dks = new DESKeySpec(key.getBytes());
SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DES");
//key的长度不能够小于8位字节
Key secretKey = keyFactory.generateSecret(dks);
Cipher cipher = Cipher.getInstance(ALGORITHM_DES);
AlgorithmParameterSpec paramSpec = new IvParameterSpec(IV_PARAMS_BYTES);
cipher.init(Cipher.DECRYPT_MODE, secretKey, paramSpec);
return new String(cipher.doFinal(hex2byte(data.getBytes())));
} catch (Exception e){
e.printStackTrace();
return data;
}
} | java | public static String decrypt(String key,String data) {
if(data == null)
return null;
try {
DESKeySpec dks = new DESKeySpec(key.getBytes());
SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DES");
//key的长度不能够小于8位字节
Key secretKey = keyFactory.generateSecret(dks);
Cipher cipher = Cipher.getInstance(ALGORITHM_DES);
AlgorithmParameterSpec paramSpec = new IvParameterSpec(IV_PARAMS_BYTES);
cipher.init(Cipher.DECRYPT_MODE, secretKey, paramSpec);
return new String(cipher.doFinal(hex2byte(data.getBytes())));
} catch (Exception e){
e.printStackTrace();
return data;
}
} | [
"public",
"static",
"String",
"decrypt",
"(",
"String",
"key",
",",
"String",
"data",
")",
"{",
"if",
"(",
"data",
"==",
"null",
")",
"return",
"null",
";",
"try",
"{",
"DESKeySpec",
"dks",
"=",
"new",
"DESKeySpec",
"(",
"key",
".",
"getBytes",
"(",
... | DES算法,解密
@param data 待解密字符串
@param key 解密私钥,长度不能够小于8位
@return 解密后的字节数组
@throws Exception 异常 | [
"DES算法,解密"
] | train | https://github.com/vakinge/jeesuite-libs/blob/c48fe2c7fbd294892cf4030dbec96e744dd3e386/jeesuite-common/src/main/java/com/jeesuite/common/crypt/DES.java#L55-L71 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Query.java | Query.convertReference | private Object convertReference(Object fieldValue) {
DocumentReference reference;
if (fieldValue instanceof String) {
reference = new DocumentReference(firestore, path.append((String) fieldValue));
} else if (fieldValue instanceof DocumentReference) {
reference = (DocumentReference) fieldValue;
} else {
throw new IllegalArgumentException(
"The corresponding value for FieldPath.documentId() must be a String or a "
+ "DocumentReference.");
}
if (!this.path.isPrefixOf(reference.getResourcePath())) {
throw new IllegalArgumentException(
String.format(
"'%s' is not part of the query result set and cannot be used as a query boundary.",
reference.getPath()));
}
if (!reference.getParent().getResourcePath().equals(this.path)) {
throw new IllegalArgumentException(
String.format(
"Only a direct child can be used as a query boundary. Found: '%s'",
reference.getPath()));
}
return reference;
} | java | private Object convertReference(Object fieldValue) {
DocumentReference reference;
if (fieldValue instanceof String) {
reference = new DocumentReference(firestore, path.append((String) fieldValue));
} else if (fieldValue instanceof DocumentReference) {
reference = (DocumentReference) fieldValue;
} else {
throw new IllegalArgumentException(
"The corresponding value for FieldPath.documentId() must be a String or a "
+ "DocumentReference.");
}
if (!this.path.isPrefixOf(reference.getResourcePath())) {
throw new IllegalArgumentException(
String.format(
"'%s' is not part of the query result set and cannot be used as a query boundary.",
reference.getPath()));
}
if (!reference.getParent().getResourcePath().equals(this.path)) {
throw new IllegalArgumentException(
String.format(
"Only a direct child can be used as a query boundary. Found: '%s'",
reference.getPath()));
}
return reference;
} | [
"private",
"Object",
"convertReference",
"(",
"Object",
"fieldValue",
")",
"{",
"DocumentReference",
"reference",
";",
"if",
"(",
"fieldValue",
"instanceof",
"String",
")",
"{",
"reference",
"=",
"new",
"DocumentReference",
"(",
"firestore",
",",
"path",
".",
"a... | Validates that a value used with FieldValue.documentId() is either a string or a
DocumentReference that is part of the query`s result set. Throws a validation error or returns
a DocumentReference that can directly be used in the Query. | [
"Validates",
"that",
"a",
"value",
"used",
"with",
"FieldValue",
".",
"documentId",
"()",
"is",
"either",
"a",
"string",
"or",
"a",
"DocumentReference",
"that",
"is",
"part",
"of",
"the",
"query",
"s",
"result",
"set",
".",
"Throws",
"a",
"validation",
"er... | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Query.java#L380-L406 |
validator/validator | src/nu/validator/datatype/AbstractDatatype.java | AbstractDatatype.newDatatypeException | protected DatatypeException newDatatypeException(String message, boolean warning) {
return new Html5DatatypeException(this.getClass(), this.getName(), message, warning);
} | java | protected DatatypeException newDatatypeException(String message, boolean warning) {
return new Html5DatatypeException(this.getClass(), this.getName(), message, warning);
} | [
"protected",
"DatatypeException",
"newDatatypeException",
"(",
"String",
"message",
",",
"boolean",
"warning",
")",
"{",
"return",
"new",
"Html5DatatypeException",
"(",
"this",
".",
"getClass",
"(",
")",
",",
"this",
".",
"getName",
"(",
")",
",",
"message",
"... | /* for datatype exceptions that are handled as warnings, the following are
alternative forms of all the above, with an additional "warning" parameter | [
"/",
"*",
"for",
"datatype",
"exceptions",
"that",
"are",
"handled",
"as",
"warnings",
"the",
"following",
"are",
"alternative",
"forms",
"of",
"all",
"the",
"above",
"with",
"an",
"additional",
"warning",
"parameter"
] | train | https://github.com/validator/validator/blob/c7b7f85b3a364df7d9944753fb5b2cd0ce642889/src/nu/validator/datatype/AbstractDatatype.java#L241-L243 |
grails/grails-core | grails-encoder/src/main/groovy/org/grails/charsequences/CharSequences.java | CharSequences.canUseOriginalForSubSequence | public static boolean canUseOriginalForSubSequence(CharSequence str, int start, int count) {
if (start != 0) return false;
final Class<?> csqClass = str.getClass();
return (csqClass == String.class || csqClass == StringBuilder.class || csqClass == StringBuffer.class) && count == str.length();
} | java | public static boolean canUseOriginalForSubSequence(CharSequence str, int start, int count) {
if (start != 0) return false;
final Class<?> csqClass = str.getClass();
return (csqClass == String.class || csqClass == StringBuilder.class || csqClass == StringBuffer.class) && count == str.length();
} | [
"public",
"static",
"boolean",
"canUseOriginalForSubSequence",
"(",
"CharSequence",
"str",
",",
"int",
"start",
",",
"int",
"count",
")",
"{",
"if",
"(",
"start",
"!=",
"0",
")",
"return",
"false",
";",
"final",
"Class",
"<",
"?",
">",
"csqClass",
"=",
"... | Checks if start == 0 and count == length of CharSequence
It does this check only for String, StringBuilder and StringBuffer classes which have a fast way to check length
Calculating length on GStringImpl requires building the result which is costly.
This helper method is to avoid calling length on other that String, StringBuilder and StringBuffer classes
when checking if the input CharSequence instance is already the same as the requested sub sequence
@param str CharSequence input
@param start start index
@param count length on sub sequence
@return true if input is String, StringBuilder or StringBuffer class, start is 0 and count is length of input sequence | [
"Checks",
"if",
"start",
"==",
"0",
"and",
"count",
"==",
"length",
"of",
"CharSequence",
"It",
"does",
"this",
"check",
"only",
"for",
"String",
"StringBuilder",
"and",
"StringBuffer",
"classes",
"which",
"have",
"a",
"fast",
"way",
"to",
"check",
"length"
... | train | https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-encoder/src/main/groovy/org/grails/charsequences/CharSequences.java#L62-L66 |
alkacon/opencms-core | src/org/opencms/ade/sitemap/shared/CmsClientSitemapEntry.java | CmsClientSitemapEntry.addSubEntry | public void addSubEntry(CmsClientSitemapEntry entry, I_CmsSitemapController controller) {
entry.setPosition(m_subEntries.size());
entry.updateSitePath(CmsStringUtil.joinPaths(m_sitePath, entry.getName()), controller);
entry.setFolderDefaultPage(entry.isLeafType() && getVfsPath().equals(entry.getVfsPath()));
m_subEntries.add(entry);
} | java | public void addSubEntry(CmsClientSitemapEntry entry, I_CmsSitemapController controller) {
entry.setPosition(m_subEntries.size());
entry.updateSitePath(CmsStringUtil.joinPaths(m_sitePath, entry.getName()), controller);
entry.setFolderDefaultPage(entry.isLeafType() && getVfsPath().equals(entry.getVfsPath()));
m_subEntries.add(entry);
} | [
"public",
"void",
"addSubEntry",
"(",
"CmsClientSitemapEntry",
"entry",
",",
"I_CmsSitemapController",
"controller",
")",
"{",
"entry",
".",
"setPosition",
"(",
"m_subEntries",
".",
"size",
"(",
")",
")",
";",
"entry",
".",
"updateSitePath",
"(",
"CmsStringUtil",
... | Adds the given entry to the children.<p>
@param entry the entry to add
@param controller a sitemap controller instance | [
"Adds",
"the",
"given",
"entry",
"to",
"the",
"children",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/sitemap/shared/CmsClientSitemapEntry.java#L209-L215 |
nemerosa/ontrack | ontrack-ui/src/main/java/net/nemerosa/ontrack/boot/ui/PropertyController.java | PropertyController.editProperty | @RequestMapping(value = "{entityType}/{id}/{propertyTypeName}/edit", method = RequestMethod.PUT)
@ResponseStatus(HttpStatus.ACCEPTED)
public Ack editProperty(@PathVariable ProjectEntityType entityType, @PathVariable ID id, @PathVariable String propertyTypeName, @RequestBody JsonNode data) {
return propertyService.editProperty(
getEntity(entityType, id),
propertyTypeName,
data
);
} | java | @RequestMapping(value = "{entityType}/{id}/{propertyTypeName}/edit", method = RequestMethod.PUT)
@ResponseStatus(HttpStatus.ACCEPTED)
public Ack editProperty(@PathVariable ProjectEntityType entityType, @PathVariable ID id, @PathVariable String propertyTypeName, @RequestBody JsonNode data) {
return propertyService.editProperty(
getEntity(entityType, id),
propertyTypeName,
data
);
} | [
"@",
"RequestMapping",
"(",
"value",
"=",
"\"{entityType}/{id}/{propertyTypeName}/edit\"",
",",
"method",
"=",
"RequestMethod",
".",
"PUT",
")",
"@",
"ResponseStatus",
"(",
"HttpStatus",
".",
"ACCEPTED",
")",
"public",
"Ack",
"editProperty",
"(",
"@",
"PathVariable"... | Edits the value of a property.
@param entityType Type of the entity to edit
@param id ID of the entity to edit
@param propertyTypeName Fully qualified name of the property to edit
@param data Raw JSON data for the property value | [
"Edits",
"the",
"value",
"of",
"a",
"property",
"."
] | train | https://github.com/nemerosa/ontrack/blob/37b0874cbf387b58aba95cd3c1bc3b15e11bc913/ontrack-ui/src/main/java/net/nemerosa/ontrack/boot/ui/PropertyController.java#L110-L118 |
infinispan/infinispan | commons/src/main/java/org/infinispan/commons/io/ExposedByteArrayOutputStream.java | ExposedByteArrayOutputStream.getNewBufferSize | public final int getNewBufferSize(int curSize, int minNewSize) {
if (curSize <= maxDoublingSize)
return Math.max(curSize << 1, minNewSize);
else
return Math.max(curSize + (curSize >> 2), minNewSize);
} | java | public final int getNewBufferSize(int curSize, int minNewSize) {
if (curSize <= maxDoublingSize)
return Math.max(curSize << 1, minNewSize);
else
return Math.max(curSize + (curSize >> 2), minNewSize);
} | [
"public",
"final",
"int",
"getNewBufferSize",
"(",
"int",
"curSize",
",",
"int",
"minNewSize",
")",
"{",
"if",
"(",
"curSize",
"<=",
"maxDoublingSize",
")",
"return",
"Math",
".",
"max",
"(",
"curSize",
"<<",
"1",
",",
"minNewSize",
")",
";",
"else",
"re... | Gets the number of bytes to which the internal buffer should be resized.
@param curSize the current number of bytes
@param minNewSize the minimum number of bytes required
@return the size to which the internal buffer should be resized | [
"Gets",
"the",
"number",
"of",
"bytes",
"to",
"which",
"the",
"internal",
"buffer",
"should",
"be",
"resized",
"."
] | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/commons/src/main/java/org/infinispan/commons/io/ExposedByteArrayOutputStream.java#L107-L112 |
jMetal/jMetal | jmetal-core/src/main/java/org/uma/jmetal/util/SolutionUtils.java | SolutionUtils.getBestSolution | public static <S extends Solution<?>> S getBestSolution(S solution1, S solution2, Comparator<S> comparator) {
return getBestSolution(solution1, solution2, comparator, () -> JMetalRandom.getInstance().nextDouble());
} | java | public static <S extends Solution<?>> S getBestSolution(S solution1, S solution2, Comparator<S> comparator) {
return getBestSolution(solution1, solution2, comparator, () -> JMetalRandom.getInstance().nextDouble());
} | [
"public",
"static",
"<",
"S",
"extends",
"Solution",
"<",
"?",
">",
">",
"S",
"getBestSolution",
"(",
"S",
"solution1",
",",
"S",
"solution2",
",",
"Comparator",
"<",
"S",
">",
"comparator",
")",
"{",
"return",
"getBestSolution",
"(",
"solution1",
",",
"... | Return the best solution between those passed as arguments. If they are equal or incomparable
one of them is chosen randomly.
@return The best solution | [
"Return",
"the",
"best",
"solution",
"between",
"those",
"passed",
"as",
"arguments",
".",
"If",
"they",
"are",
"equal",
"or",
"incomparable",
"one",
"of",
"them",
"is",
"chosen",
"randomly",
"."
] | train | https://github.com/jMetal/jMetal/blob/bc981e6aede275d26c5216c9a01227d9675b0cf7/jmetal-core/src/main/java/org/uma/jmetal/util/SolutionUtils.java#L23-L25 |
baratine/baratine | web/src/main/java/com/caucho/v5/http/protocol/RequestHttpBase.java | RequestHttpBase.headerOut | public void headerOut(String key, String value)
{
Objects.requireNonNull(value);
if (isOutCommitted()) {
return;
}
if (headerOutSpecial(key, value)) {
return;
}
setHeaderOutImpl(key, value);
} | java | public void headerOut(String key, String value)
{
Objects.requireNonNull(value);
if (isOutCommitted()) {
return;
}
if (headerOutSpecial(key, value)) {
return;
}
setHeaderOutImpl(key, value);
} | [
"public",
"void",
"headerOut",
"(",
"String",
"key",
",",
"String",
"value",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"value",
")",
";",
"if",
"(",
"isOutCommitted",
"(",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"headerOutSpecial",
"(",
"k... | Sets a header, replacing an already-existing header.
@param key the header key to set.
@param value the header value to set. | [
"Sets",
"a",
"header",
"replacing",
"an",
"already",
"-",
"existing",
"header",
"."
] | train | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/web/src/main/java/com/caucho/v5/http/protocol/RequestHttpBase.java#L1852-L1865 |
rzwitserloot/lombok | src/core/lombok/javac/handlers/JavacHandlerUtil.java | JavacHandlerUtil.injectMethod | public static void injectMethod(JavacNode typeNode, JCMethodDecl method, List<Type> paramTypes, Type returnType) {
JCClassDecl type = (JCClassDecl) typeNode.get();
if (method.getName().contentEquals("<init>")) {
//Scan for default constructor, and remove it.
int idx = 0;
for (JCTree def : type.defs) {
if (def instanceof JCMethodDecl) {
if ((((JCMethodDecl) def).mods.flags & Flags.GENERATEDCONSTR) != 0) {
JavacNode tossMe = typeNode.getNodeFor(def);
if (tossMe != null) tossMe.up().removeChild(tossMe);
type.defs = addAllButOne(type.defs, idx);
ClassSymbolMembersField.remove(type.sym, ((JCMethodDecl) def).sym);
break;
}
}
idx++;
}
}
addSuppressWarningsAll(method.mods, typeNode, method.pos, getGeneratedBy(method), typeNode.getContext());
addGenerated(method.mods, typeNode, method.pos, getGeneratedBy(method), typeNode.getContext());
type.defs = type.defs.append(method);
fixMethodMirror(typeNode.getContext(), typeNode.getElement(), method.getModifiers().flags, method.getName(), paramTypes, returnType);
typeNode.add(method, Kind.METHOD);
} | java | public static void injectMethod(JavacNode typeNode, JCMethodDecl method, List<Type> paramTypes, Type returnType) {
JCClassDecl type = (JCClassDecl) typeNode.get();
if (method.getName().contentEquals("<init>")) {
//Scan for default constructor, and remove it.
int idx = 0;
for (JCTree def : type.defs) {
if (def instanceof JCMethodDecl) {
if ((((JCMethodDecl) def).mods.flags & Flags.GENERATEDCONSTR) != 0) {
JavacNode tossMe = typeNode.getNodeFor(def);
if (tossMe != null) tossMe.up().removeChild(tossMe);
type.defs = addAllButOne(type.defs, idx);
ClassSymbolMembersField.remove(type.sym, ((JCMethodDecl) def).sym);
break;
}
}
idx++;
}
}
addSuppressWarningsAll(method.mods, typeNode, method.pos, getGeneratedBy(method), typeNode.getContext());
addGenerated(method.mods, typeNode, method.pos, getGeneratedBy(method), typeNode.getContext());
type.defs = type.defs.append(method);
fixMethodMirror(typeNode.getContext(), typeNode.getElement(), method.getModifiers().flags, method.getName(), paramTypes, returnType);
typeNode.add(method, Kind.METHOD);
} | [
"public",
"static",
"void",
"injectMethod",
"(",
"JavacNode",
"typeNode",
",",
"JCMethodDecl",
"method",
",",
"List",
"<",
"Type",
">",
"paramTypes",
",",
"Type",
"returnType",
")",
"{",
"JCClassDecl",
"type",
"=",
"(",
"JCClassDecl",
")",
"typeNode",
".",
"... | Adds the given new method declaration to the provided type AST Node.
Can also inject constructors.
Also takes care of updating the JavacAST. | [
"Adds",
"the",
"given",
"new",
"method",
"declaration",
"to",
"the",
"provided",
"type",
"AST",
"Node",
".",
"Can",
"also",
"inject",
"constructors",
"."
] | train | https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/core/lombok/javac/handlers/JavacHandlerUtil.java#L1162-L1189 |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/filter/WebAppFilterManager.java | WebAppFilterManager.getFilterChain | public WebAppFilterChain getFilterChain(String reqURI, ServletWrapper reqServlet) throws ServletException {
return this.getFilterChain(reqURI, reqServlet, DispatcherType.REQUEST);
} | java | public WebAppFilterChain getFilterChain(String reqURI, ServletWrapper reqServlet) throws ServletException {
return this.getFilterChain(reqURI, reqServlet, DispatcherType.REQUEST);
} | [
"public",
"WebAppFilterChain",
"getFilterChain",
"(",
"String",
"reqURI",
",",
"ServletWrapper",
"reqServlet",
")",
"throws",
"ServletException",
"{",
"return",
"this",
".",
"getFilterChain",
"(",
"reqURI",
",",
"reqServlet",
",",
"DispatcherType",
".",
"REQUEST",
"... | Returns a WebAppFilterChain object corresponding to the passed in uri and
servlet. If the filter chain has previously been created, return that
instance...if not, then create a new filter chain instance, ensuring that
all filters in the chain are loaded
@param uri
- String containing the uri for which a filter chain is
desired
@return a WebAppFilterChain object corresponding to the passed in uri
@throws ServletException | [
"Returns",
"a",
"WebAppFilterChain",
"object",
"corresponding",
"to",
"the",
"passed",
"in",
"uri",
"and",
"servlet",
".",
"If",
"the",
"filter",
"chain",
"has",
"previously",
"been",
"created",
"return",
"that",
"instance",
"...",
"if",
"not",
"then",
"create... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/filter/WebAppFilterManager.java#L414-L417 |
sendgrid/sendgrid-java | src/main/java/com/sendgrid/helpers/mail/Mail.java | Mail.addSection | public void addSection(String key, String value) {
this.sections = addToMap(key, value, this.sections);
} | java | public void addSection(String key, String value) {
this.sections = addToMap(key, value, this.sections);
} | [
"public",
"void",
"addSection",
"(",
"String",
"key",
",",
"String",
"value",
")",
"{",
"this",
".",
"sections",
"=",
"addToMap",
"(",
"key",
",",
"value",
",",
"this",
".",
"sections",
")",
";",
"}"
] | Add a section to the email.
@param key the section's key.
@param value the section's value. | [
"Add",
"a",
"section",
"to",
"the",
"email",
"."
] | train | https://github.com/sendgrid/sendgrid-java/blob/22292142bf243d1a838744ee43902b5050bb6e5b/src/main/java/com/sendgrid/helpers/mail/Mail.java#L300-L302 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/PdfFileSpecification.java | PdfFileSpecification.fileExtern | public static PdfFileSpecification fileExtern(PdfWriter writer, String filePath) {
PdfFileSpecification fs = new PdfFileSpecification();
fs.writer = writer;
fs.put(PdfName.F, new PdfString(filePath));
fs.setUnicodeFileName(filePath, false);
return fs;
} | java | public static PdfFileSpecification fileExtern(PdfWriter writer, String filePath) {
PdfFileSpecification fs = new PdfFileSpecification();
fs.writer = writer;
fs.put(PdfName.F, new PdfString(filePath));
fs.setUnicodeFileName(filePath, false);
return fs;
} | [
"public",
"static",
"PdfFileSpecification",
"fileExtern",
"(",
"PdfWriter",
"writer",
",",
"String",
"filePath",
")",
"{",
"PdfFileSpecification",
"fs",
"=",
"new",
"PdfFileSpecification",
"(",
")",
";",
"fs",
".",
"writer",
"=",
"writer",
";",
"fs",
".",
"put... | Creates a file specification for an external file.
@param writer the <CODE>PdfWriter</CODE>
@param filePath the file path
@return the file specification | [
"Creates",
"a",
"file",
"specification",
"for",
"an",
"external",
"file",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfFileSpecification.java#L231-L237 |
dadoonet/elasticsearch-beyonder | src/main/java/fr/pilato/elasticsearch/tools/index/IndexElasticsearchUpdater.java | IndexElasticsearchUpdater.createIndexWithSettings | @Deprecated
public static void createIndexWithSettings(Client client, String index, String settings, boolean force) throws Exception {
if (force && isIndexExist(client, index)) {
logger.debug("Index [{}] already exists but force set to true. Removing all data!", index);
removeIndexInElasticsearch(client, index);
}
if (force || !isIndexExist(client, index)) {
logger.debug("Index [{}] doesn't exist. Creating it.", index);
createIndexWithSettingsInElasticsearch(client, index, settings);
} else {
logger.debug("Index [{}] already exists.", index);
}
} | java | @Deprecated
public static void createIndexWithSettings(Client client, String index, String settings, boolean force) throws Exception {
if (force && isIndexExist(client, index)) {
logger.debug("Index [{}] already exists but force set to true. Removing all data!", index);
removeIndexInElasticsearch(client, index);
}
if (force || !isIndexExist(client, index)) {
logger.debug("Index [{}] doesn't exist. Creating it.", index);
createIndexWithSettingsInElasticsearch(client, index, settings);
} else {
logger.debug("Index [{}] already exists.", index);
}
} | [
"@",
"Deprecated",
"public",
"static",
"void",
"createIndexWithSettings",
"(",
"Client",
"client",
",",
"String",
"index",
",",
"String",
"settings",
",",
"boolean",
"force",
")",
"throws",
"Exception",
"{",
"if",
"(",
"force",
"&&",
"isIndexExist",
"(",
"clie... | Create a new index in Elasticsearch
@param client Elasticsearch client
@param index Index name
@param settings Settings if any, null if no specific settings
@param force Remove index if exists (Warning: remove all data)
@throws Exception if the elasticsearch API call is failing | [
"Create",
"a",
"new",
"index",
"in",
"Elasticsearch"
] | train | https://github.com/dadoonet/elasticsearch-beyonder/blob/275bf63432b97169a90a266e983143cca9ad7629/src/main/java/fr/pilato/elasticsearch/tools/index/IndexElasticsearchUpdater.java#L76-L88 |
sirthias/parboiled | parboiled-core/src/main/java/org/parboiled/common/Utils.java | Utils.isBoxedType | public static boolean isBoxedType(Class<?> primitive, Class<?> boxed) {
return (primitive.equals(boolean.class) && boxed.equals(Boolean.class)) ||
(primitive.equals(byte.class) && boxed.equals(Byte.class)) ||
(primitive.equals(char.class) && boxed.equals(Character.class)) ||
(primitive.equals(double.class) && boxed.equals(Double.class)) ||
(primitive.equals(float.class) && boxed.equals(Float.class)) ||
(primitive.equals(int.class) && boxed.equals(Integer.class)) ||
(primitive.equals(long.class) && boxed.equals(Long.class)) ||
(primitive.equals(short.class) && boxed.equals(Short.class)) ||
(primitive.equals(void.class) && boxed.equals(Void.class));
} | java | public static boolean isBoxedType(Class<?> primitive, Class<?> boxed) {
return (primitive.equals(boolean.class) && boxed.equals(Boolean.class)) ||
(primitive.equals(byte.class) && boxed.equals(Byte.class)) ||
(primitive.equals(char.class) && boxed.equals(Character.class)) ||
(primitive.equals(double.class) && boxed.equals(Double.class)) ||
(primitive.equals(float.class) && boxed.equals(Float.class)) ||
(primitive.equals(int.class) && boxed.equals(Integer.class)) ||
(primitive.equals(long.class) && boxed.equals(Long.class)) ||
(primitive.equals(short.class) && boxed.equals(Short.class)) ||
(primitive.equals(void.class) && boxed.equals(Void.class));
} | [
"public",
"static",
"boolean",
"isBoxedType",
"(",
"Class",
"<",
"?",
">",
"primitive",
",",
"Class",
"<",
"?",
">",
"boxed",
")",
"{",
"return",
"(",
"primitive",
".",
"equals",
"(",
"boolean",
".",
"class",
")",
"&&",
"boxed",
".",
"equals",
"(",
"... | Determines if the primitive type is boxed as the boxed type
@param primitive the primitive type to check if boxed is the boxed type
@param boxed the possible boxed type of the primitive
@return true if boxed is the boxed type of primitive, false otherwise. | [
"Determines",
"if",
"the",
"primitive",
"type",
"is",
"boxed",
"as",
"the",
"boxed",
"type"
] | train | https://github.com/sirthias/parboiled/blob/84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a/parboiled-core/src/main/java/org/parboiled/common/Utils.java#L282-L292 |
line/centraldogma | server/src/main/java/com/linecorp/centraldogma/server/internal/metadata/MetadataService.java | MetadataService.updateTokenRole | public CompletableFuture<Revision> updateTokenRole(Author author, String projectName,
Token token, ProjectRole role) {
requireNonNull(author, "author");
requireNonNull(projectName, "projectName");
requireNonNull(token, "token");
requireNonNull(role, "role");
final TokenRegistration registration = new TokenRegistration(token.appId(), role,
UserAndTimestamp.of(author));
final JsonPointer path = JsonPointer.compile("/tokens" + encodeSegment(registration.id()));
final Change<JsonNode> change =
Change.ofJsonPatch(METADATA_JSON,
new ReplaceOperation(path, Jackson.valueToTree(registration))
.toJsonNode());
final String commitSummary = "Update the role of a token '" + token.appId() +
"' as '" + role + "' for the project " + projectName;
return metadataRepo.push(projectName, Project.REPO_DOGMA, author, commitSummary, change);
} | java | public CompletableFuture<Revision> updateTokenRole(Author author, String projectName,
Token token, ProjectRole role) {
requireNonNull(author, "author");
requireNonNull(projectName, "projectName");
requireNonNull(token, "token");
requireNonNull(role, "role");
final TokenRegistration registration = new TokenRegistration(token.appId(), role,
UserAndTimestamp.of(author));
final JsonPointer path = JsonPointer.compile("/tokens" + encodeSegment(registration.id()));
final Change<JsonNode> change =
Change.ofJsonPatch(METADATA_JSON,
new ReplaceOperation(path, Jackson.valueToTree(registration))
.toJsonNode());
final String commitSummary = "Update the role of a token '" + token.appId() +
"' as '" + role + "' for the project " + projectName;
return metadataRepo.push(projectName, Project.REPO_DOGMA, author, commitSummary, change);
} | [
"public",
"CompletableFuture",
"<",
"Revision",
">",
"updateTokenRole",
"(",
"Author",
"author",
",",
"String",
"projectName",
",",
"Token",
"token",
",",
"ProjectRole",
"role",
")",
"{",
"requireNonNull",
"(",
"author",
",",
"\"author\"",
")",
";",
"requireNonN... | Updates a {@link ProjectRole} for the {@link Token} of the specified {@code appId}. | [
"Updates",
"a",
"{"
] | train | https://github.com/line/centraldogma/blob/b9e46c67fbc26628c2186ce2f46e7fb303c831e9/server/src/main/java/com/linecorp/centraldogma/server/internal/metadata/MetadataService.java#L407-L424 |
kazocsaba/matrix | src/main/java/hu/kazocsaba/math/matrix/MatrixFactory.java | MatrixFactory.createVector | public static Vector3 createVector(double x, double y, double z) {
Vector3 v=new Vector3Impl();
v.setX(x);
v.setY(y);
v.setZ(z);
return v;
} | java | public static Vector3 createVector(double x, double y, double z) {
Vector3 v=new Vector3Impl();
v.setX(x);
v.setY(y);
v.setZ(z);
return v;
} | [
"public",
"static",
"Vector3",
"createVector",
"(",
"double",
"x",
",",
"double",
"y",
",",
"double",
"z",
")",
"{",
"Vector3",
"v",
"=",
"new",
"Vector3Impl",
"(",
")",
";",
"v",
".",
"setX",
"(",
"x",
")",
";",
"v",
".",
"setY",
"(",
"y",
")",
... | Creates and initializes a new 3D column vector.
@param x the x coordinate of the new vector
@param y the y coordinate of the new vector
@param z the z coordinate of the new vector
@return the new vector | [
"Creates",
"and",
"initializes",
"a",
"new",
"3D",
"column",
"vector",
"."
] | train | https://github.com/kazocsaba/matrix/blob/018570db945fe616b25606fe605fa6e0c180ab5b/src/main/java/hu/kazocsaba/math/matrix/MatrixFactory.java#L38-L44 |
fengwenyi/JavaLib | src/main/java/com/fengwenyi/javalib/util/DateTimeUtil.java | DateTimeUtil.stringToDate | public static Date stringToDate(String source, String format) throws ParseException {
if (StringUtils.isEmpty(source))
return null;
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(format);
return simpleDateFormat.parse(source);
} | java | public static Date stringToDate(String source, String format) throws ParseException {
if (StringUtils.isEmpty(source))
return null;
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(format);
return simpleDateFormat.parse(source);
} | [
"public",
"static",
"Date",
"stringToDate",
"(",
"String",
"source",
",",
"String",
"format",
")",
"throws",
"ParseException",
"{",
"if",
"(",
"StringUtils",
".",
"isEmpty",
"(",
"source",
")",
")",
"return",
"null",
";",
"SimpleDateFormat",
"simpleDateFormat",
... | 时间字符串转时间类型({@link Date})
@param source 时间字符串(需要满足指定格式)
@param format 指定格式
@return 时间类型({@link java.util.Date})
@throws ParseException 格式化出错 | [
"时间字符串转时间类型",
"(",
"{"
] | train | https://github.com/fengwenyi/JavaLib/blob/14838b13fb11c024e41be766aa3e13ead4be1703/src/main/java/com/fengwenyi/javalib/util/DateTimeUtil.java#L39-L46 |
alkacon/opencms-core | src-modules/org/opencms/workplace/tools/modules/CmsCloneModuleThread.java | CmsCloneModuleThread.replacesMessages | private void replacesMessages(Map<String, String> descKeys, List<CmsResource> resources)
throws CmsException, UnsupportedEncodingException {
for (CmsResource resource : resources) {
CmsFile file = getCms().readFile(resource);
String encoding = CmsLocaleManager.getResourceEncoding(getCms(), file);
String content = new String(file.getContents(), encoding);
for (Map.Entry<String, String> entry : descKeys.entrySet()) {
content = content.replaceAll(entry.getKey(), entry.getValue());
}
file.setContents(content.getBytes(encoding));
getCms().writeFile(file);
}
} | java | private void replacesMessages(Map<String, String> descKeys, List<CmsResource> resources)
throws CmsException, UnsupportedEncodingException {
for (CmsResource resource : resources) {
CmsFile file = getCms().readFile(resource);
String encoding = CmsLocaleManager.getResourceEncoding(getCms(), file);
String content = new String(file.getContents(), encoding);
for (Map.Entry<String, String> entry : descKeys.entrySet()) {
content = content.replaceAll(entry.getKey(), entry.getValue());
}
file.setContents(content.getBytes(encoding));
getCms().writeFile(file);
}
} | [
"private",
"void",
"replacesMessages",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"descKeys",
",",
"List",
"<",
"CmsResource",
">",
"resources",
")",
"throws",
"CmsException",
",",
"UnsupportedEncodingException",
"{",
"for",
"(",
"CmsResource",
"resource",
"... | Replaces the messages for the given resources.<p>
@param descKeys the replacement mapping
@param resources the resources to consult
@throws CmsException if something goes wrong
@throws UnsupportedEncodingException if the file content could not be read with the determined encoding | [
"Replaces",
"the",
"messages",
"for",
"the",
"given",
"resources",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/tools/modules/CmsCloneModuleThread.java#L1026-L1039 |
bartprokop/rxtx | src/main/java/gnu/io/RXTXPort.java | RXTXPort.staticSetDTR | public static boolean staticSetDTR(String port, boolean flag)
throws UnsupportedCommOperationException {
logger.fine("RXTXPort:staticSetDTR( " + port
+ " " + flag);
return (nativeStaticSetDTR(port, flag));
} | java | public static boolean staticSetDTR(String port, boolean flag)
throws UnsupportedCommOperationException {
logger.fine("RXTXPort:staticSetDTR( " + port
+ " " + flag);
return (nativeStaticSetDTR(port, flag));
} | [
"public",
"static",
"boolean",
"staticSetDTR",
"(",
"String",
"port",
",",
"boolean",
"flag",
")",
"throws",
"UnsupportedCommOperationException",
"{",
"logger",
".",
"fine",
"(",
"\"RXTXPort:staticSetDTR( \"",
"+",
"port",
"+",
"\" \"",
"+",
"flag",
")",
";",
"r... | Extension to CommAPI This is an extension to CommAPI. It may not be
supported on all operating systems.
Open the port and set DTR. remove lockfile and do not close This is so
some software can appear to set the DTR before 'opening' the port a
second time later on.
@param port port name
@param flag flag value
@return true on success
@throws UnsupportedCommOperationException on error | [
"Extension",
"to",
"CommAPI",
"This",
"is",
"an",
"extension",
"to",
"CommAPI",
".",
"It",
"may",
"not",
"be",
"supported",
"on",
"all",
"operating",
"systems",
"."
] | train | https://github.com/bartprokop/rxtx/blob/7b2c7857c262743e9dd15e9779c880b93c650890/src/main/java/gnu/io/RXTXPort.java#L1763-L1769 |
BioPAX/Paxtools | paxtools-core/src/main/java/org/biopax/paxtools/io/SimpleIOHandler.java | SimpleIOHandler.bindValue | private void bindValue(Triple triple, Model model)
{
if (log.isDebugEnabled())
log.debug(String.valueOf(triple));
BioPAXElement domain = model.getByID(triple.domain);
PropertyEditor editor = this.getEditorMap().getEditorForProperty(triple.property, domain.getModelInterface());
bindValue(triple.range, editor, domain, model);
} | java | private void bindValue(Triple triple, Model model)
{
if (log.isDebugEnabled())
log.debug(String.valueOf(triple));
BioPAXElement domain = model.getByID(triple.domain);
PropertyEditor editor = this.getEditorMap().getEditorForProperty(triple.property, domain.getModelInterface());
bindValue(triple.range, editor, domain, model);
} | [
"private",
"void",
"bindValue",
"(",
"Triple",
"triple",
",",
"Model",
"model",
")",
"{",
"if",
"(",
"log",
".",
"isDebugEnabled",
"(",
")",
")",
"log",
".",
"debug",
"(",
"String",
".",
"valueOf",
"(",
"triple",
")",
")",
";",
"BioPAXElement",
"domain... | Binds property.
This method also throws exceptions related to binding.
@param triple A java object that represents an RDF Triple - domain-property-range.
@param model that is being populated. | [
"Binds",
"property",
"."
] | train | https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/paxtools-core/src/main/java/org/biopax/paxtools/io/SimpleIOHandler.java#L338-L348 |
Jasig/uPortal | uPortal-rendering/src/main/java/org/apereo/portal/url/xml/XsltPortalUrlProvider.java | XsltPortalUrlProvider.addParameter | public static void addParameter(IUrlBuilder urlBuilder, String name, String value) {
urlBuilder.addParameter(name, value);
} | java | public static void addParameter(IUrlBuilder urlBuilder, String name, String value) {
urlBuilder.addParameter(name, value);
} | [
"public",
"static",
"void",
"addParameter",
"(",
"IUrlBuilder",
"urlBuilder",
",",
"String",
"name",
",",
"String",
"value",
")",
"{",
"urlBuilder",
".",
"addParameter",
"(",
"name",
",",
"value",
")",
";",
"}"
] | Needed due to compile-time type checking limitations of the XSLTC compiler | [
"Needed",
"due",
"to",
"compile",
"-",
"time",
"type",
"checking",
"limitations",
"of",
"the",
"XSLTC",
"compiler"
] | train | https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-rendering/src/main/java/org/apereo/portal/url/xml/XsltPortalUrlProvider.java#L50-L52 |
elastic/elasticsearch-hadoop | hive/src/main/java/org/elasticsearch/hadoop/hive/HiveUtils.java | HiveUtils.discoverJsonFieldName | static String discoverJsonFieldName(Settings settings, FieldAlias alias) {
Set<String> virtualColumnsToBeRemoved = new HashSet<String>(HiveConstants.VIRTUAL_COLUMNS.length);
Collections.addAll(virtualColumnsToBeRemoved, HiveConstants.VIRTUAL_COLUMNS);
List<String> columnNames = StringUtils.tokenize(settings.getProperty(HiveConstants.COLUMNS), ",");
Iterator<String> nameIter = columnNames.iterator();
List<String> columnTypes = StringUtils.tokenize(settings.getProperty(HiveConstants.COLUMNS_TYPES), ":");
Iterator<String> typeIter = columnTypes.iterator();
String candidateField = null;
while(nameIter.hasNext() && candidateField == null) {
String columnName = nameIter.next();
String type = typeIter.next();
if ("string".equalsIgnoreCase(type) && !virtualColumnsToBeRemoved.contains(columnName)) {
candidateField = columnName;
}
}
Assert.hasText(candidateField, "Could not identify a field to insert JSON data into " +
"from the given fields : {" + columnNames + "} of types {" + columnTypes + "}");
// If the candidate field is aliased to something else, find the alias name and use that for the field name:
candidateField = alias.toES(candidateField);
return candidateField;
} | java | static String discoverJsonFieldName(Settings settings, FieldAlias alias) {
Set<String> virtualColumnsToBeRemoved = new HashSet<String>(HiveConstants.VIRTUAL_COLUMNS.length);
Collections.addAll(virtualColumnsToBeRemoved, HiveConstants.VIRTUAL_COLUMNS);
List<String> columnNames = StringUtils.tokenize(settings.getProperty(HiveConstants.COLUMNS), ",");
Iterator<String> nameIter = columnNames.iterator();
List<String> columnTypes = StringUtils.tokenize(settings.getProperty(HiveConstants.COLUMNS_TYPES), ":");
Iterator<String> typeIter = columnTypes.iterator();
String candidateField = null;
while(nameIter.hasNext() && candidateField == null) {
String columnName = nameIter.next();
String type = typeIter.next();
if ("string".equalsIgnoreCase(type) && !virtualColumnsToBeRemoved.contains(columnName)) {
candidateField = columnName;
}
}
Assert.hasText(candidateField, "Could not identify a field to insert JSON data into " +
"from the given fields : {" + columnNames + "} of types {" + columnTypes + "}");
// If the candidate field is aliased to something else, find the alias name and use that for the field name:
candidateField = alias.toES(candidateField);
return candidateField;
} | [
"static",
"String",
"discoverJsonFieldName",
"(",
"Settings",
"settings",
",",
"FieldAlias",
"alias",
")",
"{",
"Set",
"<",
"String",
">",
"virtualColumnsToBeRemoved",
"=",
"new",
"HashSet",
"<",
"String",
">",
"(",
"HiveConstants",
".",
"VIRTUAL_COLUMNS",
".",
... | Selects an appropriate field from the given Hive table schema to insert JSON data into if the feature is enabled
@param settings Settings to read schema information from
@return A FieldAlias object that projects the json source field into the select destination field | [
"Selects",
"an",
"appropriate",
"field",
"from",
"the",
"given",
"Hive",
"table",
"schema",
"to",
"insert",
"JSON",
"data",
"into",
"if",
"the",
"feature",
"is",
"enabled"
] | train | https://github.com/elastic/elasticsearch-hadoop/blob/f3acaba268ff96efae8eb946088c748c777c22cc/hive/src/main/java/org/elasticsearch/hadoop/hive/HiveUtils.java#L138-L166 |
lessthanoptimal/ejml | main/ejml-simple/src/org/ejml/equation/Equation.java | Equation.parseBracketCreateMatrix | protected void parseBracketCreateMatrix(TokenList tokens, Sequence sequence) {
List<TokenList.Token> left = new ArrayList<TokenList.Token>();
TokenList.Token t = tokens.getFirst();
while( t != null ) {
TokenList.Token next = t.next;
if( t.getSymbol() == Symbol.BRACKET_LEFT ) {
left.add(t);
} else if( t.getSymbol() == Symbol.BRACKET_RIGHT ) {
if( left.isEmpty() )
throw new RuntimeException("No matching left bracket for right");
TokenList.Token start = left.remove(left.size() - 1);
// Compute everything inside the [ ], this will leave a
// series of variables and semi-colons hopefully
TokenList bracketLet = tokens.extractSubList(start.next,t.previous);
parseBlockNoParentheses(bracketLet, sequence, true);
MatrixConstructor constructor = constructMatrix(bracketLet);
// define the matrix op and inject into token list
Operation.Info info = Operation.matrixConstructor(constructor);
sequence.addOperation(info.op);
tokens.insert(start.previous, new TokenList.Token(info.output));
// remove the brackets
tokens.remove(start);
tokens.remove(t);
}
t = next;
}
if( !left.isEmpty() )
throw new RuntimeException("Dangling [");
} | java | protected void parseBracketCreateMatrix(TokenList tokens, Sequence sequence) {
List<TokenList.Token> left = new ArrayList<TokenList.Token>();
TokenList.Token t = tokens.getFirst();
while( t != null ) {
TokenList.Token next = t.next;
if( t.getSymbol() == Symbol.BRACKET_LEFT ) {
left.add(t);
} else if( t.getSymbol() == Symbol.BRACKET_RIGHT ) {
if( left.isEmpty() )
throw new RuntimeException("No matching left bracket for right");
TokenList.Token start = left.remove(left.size() - 1);
// Compute everything inside the [ ], this will leave a
// series of variables and semi-colons hopefully
TokenList bracketLet = tokens.extractSubList(start.next,t.previous);
parseBlockNoParentheses(bracketLet, sequence, true);
MatrixConstructor constructor = constructMatrix(bracketLet);
// define the matrix op and inject into token list
Operation.Info info = Operation.matrixConstructor(constructor);
sequence.addOperation(info.op);
tokens.insert(start.previous, new TokenList.Token(info.output));
// remove the brackets
tokens.remove(start);
tokens.remove(t);
}
t = next;
}
if( !left.isEmpty() )
throw new RuntimeException("Dangling [");
} | [
"protected",
"void",
"parseBracketCreateMatrix",
"(",
"TokenList",
"tokens",
",",
"Sequence",
"sequence",
")",
"{",
"List",
"<",
"TokenList",
".",
"Token",
">",
"left",
"=",
"new",
"ArrayList",
"<",
"TokenList",
".",
"Token",
">",
"(",
")",
";",
"TokenList",... | Searches for brackets which are only used to construct new matrices by concatenating
1 or more matrices together | [
"Searches",
"for",
"brackets",
"which",
"are",
"only",
"used",
"to",
"construct",
"new",
"matrices",
"by",
"concatenating",
"1",
"or",
"more",
"matrices",
"together"
] | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-simple/src/org/ejml/equation/Equation.java#L1115-L1152 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java | ModelsImpl.updatePrebuiltEntityRoleWithServiceResponseAsync | public Observable<ServiceResponse<OperationStatus>> updatePrebuiltEntityRoleWithServiceResponseAsync(UUID appId, String versionId, UUID entityId, UUID roleId, UpdatePrebuiltEntityRoleOptionalParameter updatePrebuiltEntityRoleOptionalParameter) {
if (this.client.endpoint() == null) {
throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null.");
}
if (appId == null) {
throw new IllegalArgumentException("Parameter appId is required and cannot be null.");
}
if (versionId == null) {
throw new IllegalArgumentException("Parameter versionId is required and cannot be null.");
}
if (entityId == null) {
throw new IllegalArgumentException("Parameter entityId is required and cannot be null.");
}
if (roleId == null) {
throw new IllegalArgumentException("Parameter roleId is required and cannot be null.");
}
final String name = updatePrebuiltEntityRoleOptionalParameter != null ? updatePrebuiltEntityRoleOptionalParameter.name() : null;
return updatePrebuiltEntityRoleWithServiceResponseAsync(appId, versionId, entityId, roleId, name);
} | java | public Observable<ServiceResponse<OperationStatus>> updatePrebuiltEntityRoleWithServiceResponseAsync(UUID appId, String versionId, UUID entityId, UUID roleId, UpdatePrebuiltEntityRoleOptionalParameter updatePrebuiltEntityRoleOptionalParameter) {
if (this.client.endpoint() == null) {
throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null.");
}
if (appId == null) {
throw new IllegalArgumentException("Parameter appId is required and cannot be null.");
}
if (versionId == null) {
throw new IllegalArgumentException("Parameter versionId is required and cannot be null.");
}
if (entityId == null) {
throw new IllegalArgumentException("Parameter entityId is required and cannot be null.");
}
if (roleId == null) {
throw new IllegalArgumentException("Parameter roleId is required and cannot be null.");
}
final String name = updatePrebuiltEntityRoleOptionalParameter != null ? updatePrebuiltEntityRoleOptionalParameter.name() : null;
return updatePrebuiltEntityRoleWithServiceResponseAsync(appId, versionId, entityId, roleId, name);
} | [
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"OperationStatus",
">",
">",
"updatePrebuiltEntityRoleWithServiceResponseAsync",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"UUID",
"entityId",
",",
"UUID",
"roleId",
",",
"UpdatePrebuiltEntityRoleOptionalPa... | Update an entity role for a given entity.
@param appId The application ID.
@param versionId The version ID.
@param entityId The entity ID.
@param roleId The entity role ID.
@param updatePrebuiltEntityRoleOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the OperationStatus object | [
"Update",
"an",
"entity",
"role",
"for",
"a",
"given",
"entity",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L11296-L11315 |
soi-toolkit/soi-toolkit-mule | commons/components/module-logger/src/main/java/org/soitoolkit/commons/module/logger/SoitoolkitLoggerModule.java | SoitoolkitLoggerModule.logDebug | @Processor
public Object logDebug(
String message,
@Optional String integrationScenario,
@Optional String contractId,
@Optional String correlationId,
@Optional Map<String, String> extra) {
return doLog(LogLevelType.DEBUG, message, integrationScenario, contractId, correlationId, extra);
} | java | @Processor
public Object logDebug(
String message,
@Optional String integrationScenario,
@Optional String contractId,
@Optional String correlationId,
@Optional Map<String, String> extra) {
return doLog(LogLevelType.DEBUG, message, integrationScenario, contractId, correlationId, extra);
} | [
"@",
"Processor",
"public",
"Object",
"logDebug",
"(",
"String",
"message",
",",
"@",
"Optional",
"String",
"integrationScenario",
",",
"@",
"Optional",
"String",
"contractId",
",",
"@",
"Optional",
"String",
"correlationId",
",",
"@",
"Optional",
"Map",
"<",
... | Log processor for level DEBUG
{@sample.xml ../../../doc/SoitoolkitLogger-connector.xml.sample soitoolkitlogger:log}
@param message Log-message to be processed
@param integrationScenario Optional name of the integration scenario or business process
@param contractId Optional name of the contract in use
@param correlationId Optional correlation identity of the message
@param extra Optional extra info
@return The incoming payload | [
"Log",
"processor",
"for",
"level",
"DEBUG"
] | train | https://github.com/soi-toolkit/soi-toolkit-mule/blob/e891350dbf55e6307be94d193d056bdb785b37d3/commons/components/module-logger/src/main/java/org/soitoolkit/commons/module/logger/SoitoolkitLoggerModule.java#L121-L130 |
sarl/sarl | sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/JanusConfig.java | JanusConfig.getSystemPropertyAsEnum | public static <S extends Enum<S>> S getSystemPropertyAsEnum(Class<S> type, String name) {
return getSystemPropertyAsEnum(type, name, null);
} | java | public static <S extends Enum<S>> S getSystemPropertyAsEnum(Class<S> type, String name) {
return getSystemPropertyAsEnum(type, name, null);
} | [
"public",
"static",
"<",
"S",
"extends",
"Enum",
"<",
"S",
">",
">",
"S",
"getSystemPropertyAsEnum",
"(",
"Class",
"<",
"S",
">",
"type",
",",
"String",
"name",
")",
"{",
"return",
"getSystemPropertyAsEnum",
"(",
"type",
",",
"name",
",",
"null",
")",
... | Replies the value of the enumeration system property.
@param <S>
- type of the enumeration to read.
@param type
- type of the enumeration.
@param name
- name of the property.
@return the value, or <code>null</code> if no property found. | [
"Replies",
"the",
"value",
"of",
"the",
"enumeration",
"system",
"property",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/JanusConfig.java#L440-L442 |
eddi888/camel-tinkerforge | src/main/java/org/atomspace/camel/component/tinkerforge/TinkerforgeEndpoint.java | TinkerforgeEndpoint.getValue | public <T> T getValue(Class<T> type, String parameter, Message message, T uriParameterValue){
if(message==null && uriParameterValue!=null){
return uriParameterValue;
}
T value = message.getHeader(parameter, type);
if(value==null){
value = uriParameterValue;
}
return value;
} | java | public <T> T getValue(Class<T> type, String parameter, Message message, T uriParameterValue){
if(message==null && uriParameterValue!=null){
return uriParameterValue;
}
T value = message.getHeader(parameter, type);
if(value==null){
value = uriParameterValue;
}
return value;
} | [
"public",
"<",
"T",
">",
"T",
"getValue",
"(",
"Class",
"<",
"T",
">",
"type",
",",
"String",
"parameter",
",",
"Message",
"message",
",",
"T",
"uriParameterValue",
")",
"{",
"if",
"(",
"message",
"==",
"null",
"&&",
"uriParameterValue",
"!=",
"null",
... | Get Header-Parameter or alternative Configured URI Parameter Value | [
"Get",
"Header",
"-",
"Parameter",
"or",
"alternative",
"Configured",
"URI",
"Parameter",
"Value"
] | train | https://github.com/eddi888/camel-tinkerforge/blob/b003f272fc77c6a8aa3d18025702b6182161b90a/src/main/java/org/atomspace/camel/component/tinkerforge/TinkerforgeEndpoint.java#L79-L88 |
JodaOrg/joda-money | src/main/java/org/joda/money/CurrencyUnitDataProvider.java | CurrencyUnitDataProvider.registerCurrency | protected final void registerCurrency(String currencyCode, int numericCurrencyCode, int decimalPlaces) {
CurrencyUnit.registerCurrency(currencyCode, numericCurrencyCode, decimalPlaces, true);
} | java | protected final void registerCurrency(String currencyCode, int numericCurrencyCode, int decimalPlaces) {
CurrencyUnit.registerCurrency(currencyCode, numericCurrencyCode, decimalPlaces, true);
} | [
"protected",
"final",
"void",
"registerCurrency",
"(",
"String",
"currencyCode",
",",
"int",
"numericCurrencyCode",
",",
"int",
"decimalPlaces",
")",
"{",
"CurrencyUnit",
".",
"registerCurrency",
"(",
"currencyCode",
",",
"numericCurrencyCode",
",",
"decimalPlaces",
"... | Registers a currency allowing it to be used.
<p>
This method is called by {@link #registerCurrencies()} to perform the
actual creation of a currency.
@param currencyCode the currency code, not null
@param numericCurrencyCode the numeric currency code, -1 if none
@param decimalPlaces the number of decimal places that the currency
normally has, from 0 to 3, or -1 for a pseudo-currency | [
"Registers",
"a",
"currency",
"allowing",
"it",
"to",
"be",
"used",
".",
"<p",
">",
"This",
"method",
"is",
"called",
"by",
"{",
"@link",
"#registerCurrencies",
"()",
"}",
"to",
"perform",
"the",
"actual",
"creation",
"of",
"a",
"currency",
"."
] | train | https://github.com/JodaOrg/joda-money/blob/e1f2de75aa36610a695358696c8a88a18ca66cde/src/main/java/org/joda/money/CurrencyUnitDataProvider.java#L41-L43 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/jita/handler/impl/CudaZeroHandler.java | CudaZeroHandler.synchronizeThreadDevice | @Override
public void synchronizeThreadDevice(Long threadId, Integer deviceId, AllocationPoint point) {
// we synchronize only if this AllocationPoint was used within device context, so for multiple consequent syncs only first one will be issued
flowController.synchronizeToHost(point);
} | java | @Override
public void synchronizeThreadDevice(Long threadId, Integer deviceId, AllocationPoint point) {
// we synchronize only if this AllocationPoint was used within device context, so for multiple consequent syncs only first one will be issued
flowController.synchronizeToHost(point);
} | [
"@",
"Override",
"public",
"void",
"synchronizeThreadDevice",
"(",
"Long",
"threadId",
",",
"Integer",
"deviceId",
",",
"AllocationPoint",
"point",
")",
"{",
"// we synchronize only if this AllocationPoint was used within device context, so for multiple consequent syncs only first on... | This method causes memory synchronization on host side.
Viable only for Device-dependant MemoryHandlers
@param threadId
@param deviceId
@param point | [
"This",
"method",
"causes",
"memory",
"synchronization",
"on",
"host",
"side",
".",
"Viable",
"only",
"for",
"Device",
"-",
"dependant",
"MemoryHandlers"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/jita/handler/impl/CudaZeroHandler.java#L1289-L1293 |
goldmansachs/gs-collections | collections/src/main/java/com/gs/collections/impl/utility/StringIterate.java | StringIterate.reverseForEach | @Deprecated
public static void reverseForEach(String string, CodePointProcedure procedure)
{
StringIterate.reverseForEachCodePoint(string, procedure);
} | java | @Deprecated
public static void reverseForEach(String string, CodePointProcedure procedure)
{
StringIterate.reverseForEachCodePoint(string, procedure);
} | [
"@",
"Deprecated",
"public",
"static",
"void",
"reverseForEach",
"(",
"String",
"string",
",",
"CodePointProcedure",
"procedure",
")",
"{",
"StringIterate",
".",
"reverseForEachCodePoint",
"(",
"string",
",",
"procedure",
")",
";",
"}"
] | For each int code point in the {@code string} in reverse order, execute the {@link CodePointProcedure}.
@deprecated since 7.0. Use {@link #reverseForEachCodePoint(String, CodePointProcedure)} instead. | [
"For",
"each",
"int",
"code",
"point",
"in",
"the",
"{",
"@code",
"string",
"}",
"in",
"reverse",
"order",
"execute",
"the",
"{",
"@link",
"CodePointProcedure",
"}",
"."
] | train | https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/StringIterate.java#L425-L429 |
groupe-sii/ogham | ogham-email-javamail/src/main/java/fr/sii/ogham/email/sender/impl/JavaMailSender.java | JavaMailSender.setFrom | private void setFrom(Email email, MimeMessage mimeMsg) throws MessagingException, AddressException, UnsupportedEncodingException {
if (email.getFrom() == null) {
throw new IllegalArgumentException("The sender address has not been set");
}
mimeMsg.setFrom(toInternetAddress(email.getFrom()));
} | java | private void setFrom(Email email, MimeMessage mimeMsg) throws MessagingException, AddressException, UnsupportedEncodingException {
if (email.getFrom() == null) {
throw new IllegalArgumentException("The sender address has not been set");
}
mimeMsg.setFrom(toInternetAddress(email.getFrom()));
} | [
"private",
"void",
"setFrom",
"(",
"Email",
"email",
",",
"MimeMessage",
"mimeMsg",
")",
"throws",
"MessagingException",
",",
"AddressException",
",",
"UnsupportedEncodingException",
"{",
"if",
"(",
"email",
".",
"getFrom",
"(",
")",
"==",
"null",
")",
"{",
"t... | Set the sender address on the mime message.
@param email
the source email
@param mimeMsg
the mime message to fill
@throws MessagingException
when the email address is not valid
@throws AddressException
when the email address is not valid
@throws UnsupportedEncodingException
when the email address is not valid | [
"Set",
"the",
"sender",
"address",
"on",
"the",
"mime",
"message",
"."
] | train | https://github.com/groupe-sii/ogham/blob/e273b845604add74b5a25dfd931cb3c166b1008f/ogham-email-javamail/src/main/java/fr/sii/ogham/email/sender/impl/JavaMailSender.java#L144-L149 |
zackpollard/JavaTelegramBot-API | core/src/main/java/pro/zackpollard/telegrambot/api/TelegramBot.java | TelegramBot.startUpdates | public boolean startUpdates(boolean getPreviousUpdates) {
if(updateManager == null) updateManager = new RequestUpdatesManager(this, getPreviousUpdates);
if(!updateManager.isRunning()) {
updateManager.startUpdates();
return true;
}
return false;
} | java | public boolean startUpdates(boolean getPreviousUpdates) {
if(updateManager == null) updateManager = new RequestUpdatesManager(this, getPreviousUpdates);
if(!updateManager.isRunning()) {
updateManager.startUpdates();
return true;
}
return false;
} | [
"public",
"boolean",
"startUpdates",
"(",
"boolean",
"getPreviousUpdates",
")",
"{",
"if",
"(",
"updateManager",
"==",
"null",
")",
"updateManager",
"=",
"new",
"RequestUpdatesManager",
"(",
"this",
",",
"getPreviousUpdates",
")",
";",
"if",
"(",
"!",
"updateMan... | Use this method to start the update thread which will begin retrieving messages from the API and firing the
relevant events for you to process the data
@param getPreviousUpdates Whether you want to retrieve any updates that haven't been processed before, but were
created prior to calling the startUpdates method
@return True if the updater was started, otherwise False | [
"Use",
"this",
"method",
"to",
"start",
"the",
"update",
"thread",
"which",
"will",
"begin",
"retrieving",
"messages",
"from",
"the",
"API",
"and",
"firing",
"the",
"relevant",
"events",
"for",
"you",
"to",
"process",
"the",
"data"
] | train | https://github.com/zackpollard/JavaTelegramBot-API/blob/9d100f351824042ca5fc0ea735d1fa376a13e81d/core/src/main/java/pro/zackpollard/telegrambot/api/TelegramBot.java#L1166-L1177 |
spring-projects/spring-social-facebook | spring-social-facebook/src/main/java/org/springframework/social/facebook/api/FqlResult.java | FqlResult.getObject | public <T> T getObject(String fieldName, FqlResultMapper<T> mapper) {
if (!hasValue(fieldName)) {
return null;
}
try {
@SuppressWarnings("unchecked")
Map<String, Object> value = (Map<String, Object>) resultMap.get(fieldName);
return mapper.mapObject(new FqlResult(value));
} catch (ClassCastException e) {
throw new FqlException("Field '" + fieldName +"' is not an object.", e);
}
} | java | public <T> T getObject(String fieldName, FqlResultMapper<T> mapper) {
if (!hasValue(fieldName)) {
return null;
}
try {
@SuppressWarnings("unchecked")
Map<String, Object> value = (Map<String, Object>) resultMap.get(fieldName);
return mapper.mapObject(new FqlResult(value));
} catch (ClassCastException e) {
throw new FqlException("Field '" + fieldName +"' is not an object.", e);
}
} | [
"public",
"<",
"T",
">",
"T",
"getObject",
"(",
"String",
"fieldName",
",",
"FqlResultMapper",
"<",
"T",
">",
"mapper",
")",
"{",
"if",
"(",
"!",
"hasValue",
"(",
"fieldName",
")",
")",
"{",
"return",
"null",
";",
"}",
"try",
"{",
"@",
"SuppressWarni... | Returns the value of the identified field as an object mapped by a given {@link FqlResultMapper}.
@param fieldName the name of the field
@param mapper an {@link FqlResultMapper} used to map the object date into a specific type.
@param <T> the Java type to bind the Facebook object to
@return the value of the field as an object of a type the same as the parameterized type of the given {@link FqlResultMapper}.
@throws FqlException if the value of the field is not a nested object. | [
"Returns",
"the",
"value",
"of",
"the",
"identified",
"field",
"as",
"an",
"object",
"mapped",
"by",
"a",
"given",
"{"
] | train | https://github.com/spring-projects/spring-social-facebook/blob/ae2234d94367eaa3adbba251ec7790d5ba7ffa41/spring-social-facebook/src/main/java/org/springframework/social/facebook/api/FqlResult.java#L136-L147 |
ops4j/org.ops4j.pax.logging | pax-logging-service/src/main/java/org/apache/log4j/Category.java | Category.l7dlog | public void l7dlog(Priority priority, String key, Throwable t) {
if (repository.isDisabled(priority.level)) {
return;
}
if (priority.isGreaterOrEqual(this.getEffectiveLevel())) {
String msg = getResourceBundleString(key);
// if message corresponding to 'key' could not be found in the
// resource bundle, then default to 'key'.
if (msg == null) {
msg = key;
}
forcedLog(FQCN, priority, msg, t);
}
} | java | public void l7dlog(Priority priority, String key, Throwable t) {
if (repository.isDisabled(priority.level)) {
return;
}
if (priority.isGreaterOrEqual(this.getEffectiveLevel())) {
String msg = getResourceBundleString(key);
// if message corresponding to 'key' could not be found in the
// resource bundle, then default to 'key'.
if (msg == null) {
msg = key;
}
forcedLog(FQCN, priority, msg, t);
}
} | [
"public",
"void",
"l7dlog",
"(",
"Priority",
"priority",
",",
"String",
"key",
",",
"Throwable",
"t",
")",
"{",
"if",
"(",
"repository",
".",
"isDisabled",
"(",
"priority",
".",
"level",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"priority",
".",
... | Log a localized message. The user supplied parameter <code>key</code> is replaced by its localized version from the resource bundle.
@see #setResourceBundle
@since 0.8.4 | [
"Log",
"a",
"localized",
"message",
".",
"The",
"user",
"supplied",
"parameter",
"<code",
">",
"key<",
"/",
"code",
">",
"is",
"replaced",
"by",
"its",
"localized",
"version",
"from",
"the",
"resource",
"bundle",
"."
] | train | https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-service/src/main/java/org/apache/log4j/Category.java#L652-L665 |
alkacon/opencms-core | src/org/opencms/xml/A_CmsXmlDocument.java | A_CmsXmlDocument.getBookmark | protected I_CmsXmlContentValue getBookmark(String path, Locale locale) {
return m_bookmarks.get(getBookmarkName(path, locale));
} | java | protected I_CmsXmlContentValue getBookmark(String path, Locale locale) {
return m_bookmarks.get(getBookmarkName(path, locale));
} | [
"protected",
"I_CmsXmlContentValue",
"getBookmark",
"(",
"String",
"path",
",",
"Locale",
"locale",
")",
"{",
"return",
"m_bookmarks",
".",
"get",
"(",
"getBookmarkName",
"(",
"path",
",",
"locale",
")",
")",
";",
"}"
] | Returns the bookmarked value for the given name.<p>
@param path the lookup path to use for the bookmark
@param locale the locale to get the bookmark for
@return the bookmarked value | [
"Returns",
"the",
"bookmarked",
"value",
"for",
"the",
"given",
"name",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/A_CmsXmlDocument.java#L804-L807 |
alipay/sofa-rpc | core-impl/client/src/main/java/com/alipay/sofa/rpc/client/AbstractCluster.java | AbstractCluster.filterChain | protected SofaResponse filterChain(ProviderInfo providerInfo, SofaRequest request) throws SofaRpcException {
RpcInternalContext context = RpcInternalContext.getContext();
context.setProviderInfo(providerInfo);
return filterChain.invoke(request);
} | java | protected SofaResponse filterChain(ProviderInfo providerInfo, SofaRequest request) throws SofaRpcException {
RpcInternalContext context = RpcInternalContext.getContext();
context.setProviderInfo(providerInfo);
return filterChain.invoke(request);
} | [
"protected",
"SofaResponse",
"filterChain",
"(",
"ProviderInfo",
"providerInfo",
",",
"SofaRequest",
"request",
")",
"throws",
"SofaRpcException",
"{",
"RpcInternalContext",
"context",
"=",
"RpcInternalContext",
".",
"getContext",
"(",
")",
";",
"context",
".",
"setPr... | 发起调用链
@param providerInfo 服务端信息
@param request 请求对象
@return 执行后返回的响应
@throws SofaRpcException 请求RPC异常 | [
"发起调用链"
] | train | https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/core-impl/client/src/main/java/com/alipay/sofa/rpc/client/AbstractCluster.java#L475-L479 |
lucee/Lucee | core/src/main/java/lucee/runtime/converter/WDDXConverter.java | WDDXConverter._serializeStruct | private String _serializeStruct(Struct struct, Set<Object> done) throws ConverterException {
StringBuilder sb = new StringBuilder(goIn() + "<struct>");
Iterator<Key> it = struct.keyIterator();
deep++;
while (it.hasNext()) {
Key key = it.next();
sb.append(goIn() + "<var name=" + del + XMLUtil.escapeXMLString(key.toString()) + del + ">");
sb.append(_serialize(struct.get(key, null), done));
sb.append(goIn() + "</var>");
}
deep--;
sb.append(goIn() + "</struct>");
return sb.toString();
} | java | private String _serializeStruct(Struct struct, Set<Object> done) throws ConverterException {
StringBuilder sb = new StringBuilder(goIn() + "<struct>");
Iterator<Key> it = struct.keyIterator();
deep++;
while (it.hasNext()) {
Key key = it.next();
sb.append(goIn() + "<var name=" + del + XMLUtil.escapeXMLString(key.toString()) + del + ">");
sb.append(_serialize(struct.get(key, null), done));
sb.append(goIn() + "</var>");
}
deep--;
sb.append(goIn() + "</struct>");
return sb.toString();
} | [
"private",
"String",
"_serializeStruct",
"(",
"Struct",
"struct",
",",
"Set",
"<",
"Object",
">",
"done",
")",
"throws",
"ConverterException",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
"goIn",
"(",
")",
"+",
"\"<struct>\"",
")",
";",
"Ite... | serialize a Struct
@param struct Struct to serialize
@param done
@return serialized struct
@throws ConverterException | [
"serialize",
"a",
"Struct"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/converter/WDDXConverter.java#L271-L287 |
apereo/cas | support/cas-server-support-consent-core/src/main/java/org/apereo/cas/consent/AttributeConsentReportEndpoint.java | AttributeConsentReportEndpoint.revokeConsents | @DeleteOperation
public boolean revokeConsents(@Selector final String principal, @Selector final long decisionId) {
LOGGER.debug("Deleting consent decisions for principal [{}].", principal);
return this.consentRepository.deleteConsentDecision(decisionId, principal);
} | java | @DeleteOperation
public boolean revokeConsents(@Selector final String principal, @Selector final long decisionId) {
LOGGER.debug("Deleting consent decisions for principal [{}].", principal);
return this.consentRepository.deleteConsentDecision(decisionId, principal);
} | [
"@",
"DeleteOperation",
"public",
"boolean",
"revokeConsents",
"(",
"@",
"Selector",
"final",
"String",
"principal",
",",
"@",
"Selector",
"final",
"long",
"decisionId",
")",
"{",
"LOGGER",
".",
"debug",
"(",
"\"Deleting consent decisions for principal [{}].\"",
",",
... | Revoke consents.
@param principal the principal
@param decisionId the decision id
@return the boolean | [
"Revoke",
"consents",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-consent-core/src/main/java/org/apereo/cas/consent/AttributeConsentReportEndpoint.java#L68-L72 |
padrig64/ValidationFramework | validationframework-core/src/main/java/com/google/code/validationframework/base/validator/generalvalidator/GeneralValidator.java | GeneralValidator.processEachRuleWithEachResultHandler | @SuppressWarnings("unchecked") // NOSONAR (Avoid Duplicate Literals)
private void processEachRuleWithEachResultHandler(RI ruleInput) {
// For each rule
for (Rule<RI, RO> rule : rules) {
// Validate the data and get the rule output
Object ruleOutput = rule.validate(ruleInput);
// Transform the rule output
if (ruleOutputTransformers != null) {
for (Transformer transformer : ruleOutputTransformers) {
ruleOutput = transformer.transform(ruleOutput);
}
}
// Transform the transformed rule output to result handler input
if (resultHandlerInputTransformers != null) {
for (Transformer transformer : resultHandlerInputTransformers) {
ruleOutput = transformer.transform(ruleOutput);
}
}
RHI resultHandlerInput = (RHI) ruleOutput;
// Process the result handler input with the result handlers
processResultHandlers(resultHandlerInput);
}
} | java | @SuppressWarnings("unchecked") // NOSONAR (Avoid Duplicate Literals)
private void processEachRuleWithEachResultHandler(RI ruleInput) {
// For each rule
for (Rule<RI, RO> rule : rules) {
// Validate the data and get the rule output
Object ruleOutput = rule.validate(ruleInput);
// Transform the rule output
if (ruleOutputTransformers != null) {
for (Transformer transformer : ruleOutputTransformers) {
ruleOutput = transformer.transform(ruleOutput);
}
}
// Transform the transformed rule output to result handler input
if (resultHandlerInputTransformers != null) {
for (Transformer transformer : resultHandlerInputTransformers) {
ruleOutput = transformer.transform(ruleOutput);
}
}
RHI resultHandlerInput = (RHI) ruleOutput;
// Process the result handler input with the result handlers
processResultHandlers(resultHandlerInput);
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"// NOSONAR (Avoid Duplicate Literals)",
"private",
"void",
"processEachRuleWithEachResultHandler",
"(",
"RI",
"ruleInput",
")",
"{",
"// For each rule",
"for",
"(",
"Rule",
"<",
"RI",
",",
"RO",
">",
"rule",
":",
... | Processes the specified rule input with each rule, and processes the results of each rule one by one with each
result handler.
@param ruleInput Rule input to be validated. | [
"Processes",
"the",
"specified",
"rule",
"input",
"with",
"each",
"rule",
"and",
"processes",
"the",
"results",
"of",
"each",
"rule",
"one",
"by",
"one",
"with",
"each",
"result",
"handler",
"."
] | train | https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-core/src/main/java/com/google/code/validationframework/base/validator/generalvalidator/GeneralValidator.java#L454-L479 |
salesforce/Argus | ArgusCore/src/main/java/com/salesforce/dva/argus/entity/Trigger.java | Trigger.setInertia | public void setInertia(Long inertiaMillis) {
if (this.alert == null) { // Only during deserialization.
this.inertia = inertiaMillis;
} else {
requireArgument(inertiaMillis != null && inertiaMillis >= 0, "Inertia cannot be negative.");
Long longestIntervalLength = AlertUtils.getMaximumIntervalLength(this.alert.getExpression());
if (inertiaMillis > longestIntervalLength)
throw new IllegalArgumentException(String.format("Inertia %d cannot be more than width of the longest interval %d.", inertiaMillis, longestIntervalLength));
this.inertia = inertiaMillis;
}
} | java | public void setInertia(Long inertiaMillis) {
if (this.alert == null) { // Only during deserialization.
this.inertia = inertiaMillis;
} else {
requireArgument(inertiaMillis != null && inertiaMillis >= 0, "Inertia cannot be negative.");
Long longestIntervalLength = AlertUtils.getMaximumIntervalLength(this.alert.getExpression());
if (inertiaMillis > longestIntervalLength)
throw new IllegalArgumentException(String.format("Inertia %d cannot be more than width of the longest interval %d.", inertiaMillis, longestIntervalLength));
this.inertia = inertiaMillis;
}
} | [
"public",
"void",
"setInertia",
"(",
"Long",
"inertiaMillis",
")",
"{",
"if",
"(",
"this",
".",
"alert",
"==",
"null",
")",
"{",
"// Only during deserialization.",
"this",
".",
"inertia",
"=",
"inertiaMillis",
";",
"}",
"else",
"{",
"requireArgument",
"(",
"... | Sets the inertia associated with the trigger in milliseconds.
@param inertiaMillis The inertia associated with the trigger in milliseconds. Cannot be null or negative. | [
"Sets",
"the",
"inertia",
"associated",
"with",
"the",
"trigger",
"in",
"milliseconds",
"."
] | train | https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusCore/src/main/java/com/salesforce/dva/argus/entity/Trigger.java#L364-L374 |
webmetrics/browsermob-proxy | src/main/java/org/browsermob/proxy/jetty/xml/XmlConfiguration.java | XmlConfiguration.refObj | private Object refObj(Object obj, XmlParser.Node node) throws NoSuchMethodException,
ClassNotFoundException, InvocationTargetException, IllegalAccessException
{
String id = node.getAttribute("id");
obj = _idMap.get(id);
if (obj == null) throw new IllegalStateException("No object for id=" + id);
configure(obj, node, 0);
return obj;
} | java | private Object refObj(Object obj, XmlParser.Node node) throws NoSuchMethodException,
ClassNotFoundException, InvocationTargetException, IllegalAccessException
{
String id = node.getAttribute("id");
obj = _idMap.get(id);
if (obj == null) throw new IllegalStateException("No object for id=" + id);
configure(obj, node, 0);
return obj;
} | [
"private",
"Object",
"refObj",
"(",
"Object",
"obj",
",",
"XmlParser",
".",
"Node",
"node",
")",
"throws",
"NoSuchMethodException",
",",
"ClassNotFoundException",
",",
"InvocationTargetException",
",",
"IllegalAccessException",
"{",
"String",
"id",
"=",
"node",
".",... | /*
Reference an id value object.
@param obj @param node @return @exception NoSuchMethodException @exception
ClassNotFoundException @exception InvocationTargetException | [
"/",
"*",
"Reference",
"an",
"id",
"value",
"object",
"."
] | train | https://github.com/webmetrics/browsermob-proxy/blob/a9252e62246ac33d55d51b993ba1159404e7d389/src/main/java/org/browsermob/proxy/jetty/xml/XmlConfiguration.java#L632-L640 |
facebookarchive/hadoop-20 | src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/AvatarNode.java | AvatarNode.initializeGenericKeys | public static void initializeGenericKeys(Configuration conf, String serviceKey) {
if ((serviceKey == null) || serviceKey.isEmpty()) {
return;
}
NameNode.initializeGenericKeys(conf, serviceKey);
DFSUtil.setGenericConf(conf, serviceKey, AVATARSERVICE_SPECIFIC_KEYS);
// adjust meta directory names for this service
adjustMetaDirectoryNames(conf, serviceKey);
} | java | public static void initializeGenericKeys(Configuration conf, String serviceKey) {
if ((serviceKey == null) || serviceKey.isEmpty()) {
return;
}
NameNode.initializeGenericKeys(conf, serviceKey);
DFSUtil.setGenericConf(conf, serviceKey, AVATARSERVICE_SPECIFIC_KEYS);
// adjust meta directory names for this service
adjustMetaDirectoryNames(conf, serviceKey);
} | [
"public",
"static",
"void",
"initializeGenericKeys",
"(",
"Configuration",
"conf",
",",
"String",
"serviceKey",
")",
"{",
"if",
"(",
"(",
"serviceKey",
"==",
"null",
")",
"||",
"serviceKey",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
";",
"}",
"NameNode... | In federation configuration is set for a set of
avartanodes, namenodes etc, which are
grouped under a logical nameservice ID. The configuration keys specific
to them have suffix set to configured nameserviceId.
This method copies the value from specific key of format key.nameserviceId
to key, to set up the generic configuration. Once this is done, only
generic version of the configuration is read in rest of the code, for
backward compatibility and simpler code changes.
@param conf
Configuration object to lookup specific key and to set the value
to the key passed. Note the conf object is modified
@see DFSUtil#setGenericConf(Configuration, String, String...) | [
"In",
"federation",
"configuration",
"is",
"set",
"for",
"a",
"set",
"of",
"avartanodes",
"namenodes",
"etc",
"which",
"are",
"grouped",
"under",
"a",
"logical",
"nameservice",
"ID",
".",
"The",
"configuration",
"keys",
"specific",
"to",
"them",
"have",
"suffi... | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/namenode/AvatarNode.java#L1581-L1591 |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/subdoc/MutateInBuilder.java | MutateInBuilder.arrayPrependAll | public <T> MutateInBuilder arrayPrependAll(String path, T... values) {
asyncBuilder.arrayPrependAll(path, values);
return this;
} | java | public <T> MutateInBuilder arrayPrependAll(String path, T... values) {
asyncBuilder.arrayPrependAll(path, values);
return this;
} | [
"public",
"<",
"T",
">",
"MutateInBuilder",
"arrayPrependAll",
"(",
"String",
"path",
",",
"T",
"...",
"values",
")",
"{",
"asyncBuilder",
".",
"arrayPrependAll",
"(",
"path",
",",
"values",
")",
";",
"return",
"this",
";",
"}"
] | Prepend multiple values at once in an existing array, pushing all values to the front/start of the array.
This is provided as a convenience alternative to {@link #arrayPrependAll(String, Collection, boolean)}.
Note that parent nodes are not created when using this method (ie. createPath = false).
First value becomes the first element of the array, second value the second, etc... All existing values
are shifted right in the array, by the number of inserted elements.
Each item in the collection is inserted as an individual element of the array, but a bit of overhead
is saved compared to individual {@link #arrayPrepend(String, Object, boolean)} (String, Object)} by grouping
mutations in a single packet.
For example given an array [ A, B, C ], prepending the values X and Y yields [ X, Y, A, B, C ]
and not [ [ X, Y ], A, B, C ].
@param path the path of the array.
@param values the values to insert at the front of the array as individual elements.
@param <T> the type of data in the collection (must be JSON serializable).
@see #arrayPrependAll(String, Collection, boolean) if you need to create missing intermediary nodes. | [
"Prepend",
"multiple",
"values",
"at",
"once",
"in",
"an",
"existing",
"array",
"pushing",
"all",
"values",
"to",
"the",
"front",
"/",
"start",
"of",
"the",
"array",
".",
"This",
"is",
"provided",
"as",
"a",
"convenience",
"alternative",
"to",
"{",
"@link"... | train | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/subdoc/MutateInBuilder.java#L795-L798 |
citrusframework/citrus | modules/citrus-model/model-core/src/main/java/com/consol/citrus/model/config/core/SchemaRepositoryModelBuilder.java | SchemaRepositoryModelBuilder.addSchema | public SchemaRepositoryModelBuilder addSchema(String id, String location) {
SchemaModel schema = new SchemaModel();
schema.setId(id);
schema.setLocation(location);
if (model.getSchemas() == null) {
model.setSchemas(new SchemaRepositoryModel.Schemas());
}
model.getSchemas().getSchemas().add(schema);
return this;
} | java | public SchemaRepositoryModelBuilder addSchema(String id, String location) {
SchemaModel schema = new SchemaModel();
schema.setId(id);
schema.setLocation(location);
if (model.getSchemas() == null) {
model.setSchemas(new SchemaRepositoryModel.Schemas());
}
model.getSchemas().getSchemas().add(schema);
return this;
} | [
"public",
"SchemaRepositoryModelBuilder",
"addSchema",
"(",
"String",
"id",
",",
"String",
"location",
")",
"{",
"SchemaModel",
"schema",
"=",
"new",
"SchemaModel",
"(",
")",
";",
"schema",
".",
"setId",
"(",
"id",
")",
";",
"schema",
".",
"setLocation",
"("... | Adds new schema by id and location.
@param id
@param location
@return | [
"Adds",
"new",
"schema",
"by",
"id",
"and",
"location",
"."
] | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-model/model-core/src/main/java/com/consol/citrus/model/config/core/SchemaRepositoryModelBuilder.java#L52-L63 |
prestodb/presto | presto-main/src/main/java/com/facebook/presto/sql/gen/VarArgsToMapAdapterGenerator.java | VarArgsToMapAdapterGenerator.generateVarArgsToMapAdapter | public static MethodHandle generateVarArgsToMapAdapter(Class<?> returnType, List<Class<?>> javaTypes, List<String> names, Function<Map<String, Object>, Object> function)
{
checkCondition(javaTypes.size() <= 254, NOT_SUPPORTED, "Too many arguments for vararg function");
CallSiteBinder callSiteBinder = new CallSiteBinder();
ClassDefinition classDefinition = new ClassDefinition(a(PUBLIC, FINAL), makeClassName("VarArgsToMapAdapter"), type(Object.class));
ImmutableList.Builder<Parameter> parameterListBuilder = ImmutableList.builder();
for (int i = 0; i < javaTypes.size(); i++) {
Class<?> javaType = javaTypes.get(i);
parameterListBuilder.add(arg("input_" + i, javaType));
}
ImmutableList<Parameter> parameterList = parameterListBuilder.build();
MethodDefinition methodDefinition = classDefinition.declareMethod(a(PUBLIC, STATIC), "varArgsToMap", type(returnType), parameterList);
BytecodeBlock body = methodDefinition.getBody();
// ImmutableMap.Builder can not be used here because it doesn't allow nulls.
Variable map = methodDefinition.getScope().declareVariable(
"map",
methodDefinition.getBody(),
invokeStatic(Maps.class, "newHashMapWithExpectedSize", HashMap.class, constantInt(javaTypes.size())));
for (int i = 0; i < javaTypes.size(); i++) {
body.append(map.invoke("put", Object.class, constantString(names.get(i)).cast(Object.class), parameterList.get(i).cast(Object.class)));
}
body.append(
loadConstant(callSiteBinder, function, Function.class)
.invoke("apply", Object.class, map.cast(Object.class))
.cast(returnType)
.ret());
Class<?> generatedClass = defineClass(classDefinition, Object.class, callSiteBinder.getBindings(), new DynamicClassLoader(VarArgsToMapAdapterGenerator.class.getClassLoader()));
return Reflection.methodHandle(generatedClass, "varArgsToMap", javaTypes.toArray(new Class<?>[javaTypes.size()]));
} | java | public static MethodHandle generateVarArgsToMapAdapter(Class<?> returnType, List<Class<?>> javaTypes, List<String> names, Function<Map<String, Object>, Object> function)
{
checkCondition(javaTypes.size() <= 254, NOT_SUPPORTED, "Too many arguments for vararg function");
CallSiteBinder callSiteBinder = new CallSiteBinder();
ClassDefinition classDefinition = new ClassDefinition(a(PUBLIC, FINAL), makeClassName("VarArgsToMapAdapter"), type(Object.class));
ImmutableList.Builder<Parameter> parameterListBuilder = ImmutableList.builder();
for (int i = 0; i < javaTypes.size(); i++) {
Class<?> javaType = javaTypes.get(i);
parameterListBuilder.add(arg("input_" + i, javaType));
}
ImmutableList<Parameter> parameterList = parameterListBuilder.build();
MethodDefinition methodDefinition = classDefinition.declareMethod(a(PUBLIC, STATIC), "varArgsToMap", type(returnType), parameterList);
BytecodeBlock body = methodDefinition.getBody();
// ImmutableMap.Builder can not be used here because it doesn't allow nulls.
Variable map = methodDefinition.getScope().declareVariable(
"map",
methodDefinition.getBody(),
invokeStatic(Maps.class, "newHashMapWithExpectedSize", HashMap.class, constantInt(javaTypes.size())));
for (int i = 0; i < javaTypes.size(); i++) {
body.append(map.invoke("put", Object.class, constantString(names.get(i)).cast(Object.class), parameterList.get(i).cast(Object.class)));
}
body.append(
loadConstant(callSiteBinder, function, Function.class)
.invoke("apply", Object.class, map.cast(Object.class))
.cast(returnType)
.ret());
Class<?> generatedClass = defineClass(classDefinition, Object.class, callSiteBinder.getBindings(), new DynamicClassLoader(VarArgsToMapAdapterGenerator.class.getClassLoader()));
return Reflection.methodHandle(generatedClass, "varArgsToMap", javaTypes.toArray(new Class<?>[javaTypes.size()]));
} | [
"public",
"static",
"MethodHandle",
"generateVarArgsToMapAdapter",
"(",
"Class",
"<",
"?",
">",
"returnType",
",",
"List",
"<",
"Class",
"<",
"?",
">",
">",
"javaTypes",
",",
"List",
"<",
"String",
">",
"names",
",",
"Function",
"<",
"Map",
"<",
"String",
... | Generate byte code that
<p><ul>
<li>takes a specified number of variables as arguments (types of the arguments are provided in {@code javaTypes})
<li>put the variables in a map (keys of the map are provided in {@code names})
<li>invoke the provided {@code function} with the map
<li>return with the result of the function call (type must match {@code returnType})
</ul></p> | [
"Generate",
"byte",
"code",
"that",
"<p",
">",
"<ul",
">",
"<li",
">",
"takes",
"a",
"specified",
"number",
"of",
"variables",
"as",
"arguments",
"(",
"types",
"of",
"the",
"arguments",
"are",
"provided",
"in",
"{"
] | train | https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/sql/gen/VarArgsToMapAdapterGenerator.java#L62-L95 |
Azure/azure-sdk-for-java | sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobExecutionsInner.java | JobExecutionsInner.createOrUpdate | public JobExecutionInner createOrUpdate(String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId).toBlocking().last().body();
} | java | public JobExecutionInner createOrUpdate(String resourceGroupName, String serverName, String jobAgentName, String jobName, UUID jobExecutionId) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, jobAgentName, jobName, jobExecutionId).toBlocking().last().body();
} | [
"public",
"JobExecutionInner",
"createOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"jobAgentName",
",",
"String",
"jobName",
",",
"UUID",
"jobExecutionId",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"... | Creates or updatess a job execution.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param jobAgentName The name of the job agent.
@param jobName The name of the job to get.
@param jobExecutionId The job execution id to create the job execution under.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the JobExecutionInner object if successful. | [
"Creates",
"or",
"updatess",
"a",
"job",
"execution",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobExecutionsInner.java#L1126-L1128 |
google/error-prone-javac | src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ClassDocImpl.java | ClassDocImpl.findMethod | public MethodDocImpl findMethod(String methodName, String[] paramTypes) {
// Use hash table 'searched' to avoid searching same class twice.
//### It is not clear how this could happen.
return searchMethod(methodName, paramTypes, new HashSet<ClassDocImpl>());
} | java | public MethodDocImpl findMethod(String methodName, String[] paramTypes) {
// Use hash table 'searched' to avoid searching same class twice.
//### It is not clear how this could happen.
return searchMethod(methodName, paramTypes, new HashSet<ClassDocImpl>());
} | [
"public",
"MethodDocImpl",
"findMethod",
"(",
"String",
"methodName",
",",
"String",
"[",
"]",
"paramTypes",
")",
"{",
"// Use hash table 'searched' to avoid searching same class twice.",
"//### It is not clear how this could happen.",
"return",
"searchMethod",
"(",
"methodName",... | Find a method in this class scope.
Search order: this class, interfaces, superclasses, outerclasses.
Note that this is not necessarily what the compiler would do!
@param methodName the unqualified name to search for.
@param paramTypes the array of Strings for method parameter types.
@return the first MethodDocImpl which matches, null if not found. | [
"Find",
"a",
"method",
"in",
"this",
"class",
"scope",
".",
"Search",
"order",
":",
"this",
"class",
"interfaces",
"superclasses",
"outerclasses",
".",
"Note",
"that",
"this",
"is",
"not",
"necessarily",
"what",
"the",
"compiler",
"would",
"do!"
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ClassDocImpl.java#L874-L878 |
openskynetwork/java-adsb | src/main/java/org/opensky/libadsb/PositionDecoder.java | PositionDecoder.decodePosition | public Position decodePosition(SurfacePositionV0Msg msg, Position reference) {
return decodePosition(System.currentTimeMillis()/1000.0, msg, reference);
} | java | public Position decodePosition(SurfacePositionV0Msg msg, Position reference) {
return decodePosition(System.currentTimeMillis()/1000.0, msg, reference);
} | [
"public",
"Position",
"decodePosition",
"(",
"SurfacePositionV0Msg",
"msg",
",",
"Position",
"reference",
")",
"{",
"return",
"decodePosition",
"(",
"System",
".",
"currentTimeMillis",
"(",
")",
"/",
"1000.0",
",",
"msg",
",",
"reference",
")",
";",
"}"
] | Shortcut for live decoding; no reasonableness check on distance to receiver
@param reference used for reasonableness test and to decide which of the four resulting positions of the CPR algorithm is the right one
@param msg airborne position message
@return WGS84 coordinates with latitude and longitude in dec degrees, and altitude in meters. altitude might be null if unavailable
On error, the returned position is null. Check the .isReasonable() flag before using the position. | [
"Shortcut",
"for",
"live",
"decoding",
";",
"no",
"reasonableness",
"check",
"on",
"distance",
"to",
"receiver"
] | train | https://github.com/openskynetwork/java-adsb/blob/01d497d3e74ad10063ab443ab583e9c8653a8b8d/src/main/java/org/opensky/libadsb/PositionDecoder.java#L461-L463 |
VoltDB/voltdb | third_party/java/src/org/HdrHistogram_voltpatches/SynchronizedHistogram.java | SynchronizedHistogram.decodeFromCompressedByteBuffer | public static SynchronizedHistogram decodeFromCompressedByteBuffer(final ByteBuffer buffer,
final long minBarForHighestTrackableValue) throws DataFormatException {
return decodeFromCompressedByteBuffer(buffer, SynchronizedHistogram.class, minBarForHighestTrackableValue);
} | java | public static SynchronizedHistogram decodeFromCompressedByteBuffer(final ByteBuffer buffer,
final long minBarForHighestTrackableValue) throws DataFormatException {
return decodeFromCompressedByteBuffer(buffer, SynchronizedHistogram.class, minBarForHighestTrackableValue);
} | [
"public",
"static",
"SynchronizedHistogram",
"decodeFromCompressedByteBuffer",
"(",
"final",
"ByteBuffer",
"buffer",
",",
"final",
"long",
"minBarForHighestTrackableValue",
")",
"throws",
"DataFormatException",
"{",
"return",
"decodeFromCompressedByteBuffer",
"(",
"buffer",
"... | Construct a new histogram by decoding it from a compressed form in a ByteBuffer.
@param buffer The buffer to decode from
@param minBarForHighestTrackableValue Force highestTrackableValue to be set at least this high
@return The newly constructed histogram
@throws DataFormatException on error parsing/decompressing the buffer | [
"Construct",
"a",
"new",
"histogram",
"by",
"decoding",
"it",
"from",
"a",
"compressed",
"form",
"in",
"a",
"ByteBuffer",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/org/HdrHistogram_voltpatches/SynchronizedHistogram.java#L115-L118 |
aws/aws-sdk-java | aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/document/utils/ValueMap.java | ValueMap.withMap | public ValueMap withMap(String key, Map<String, ?> val) {
super.put(key, val);
return this;
} | java | public ValueMap withMap(String key, Map<String, ?> val) {
super.put(key, val);
return this;
} | [
"public",
"ValueMap",
"withMap",
"(",
"String",
"key",
",",
"Map",
"<",
"String",
",",
"?",
">",
"val",
")",
"{",
"super",
".",
"put",
"(",
"key",
",",
"val",
")",
";",
"return",
"this",
";",
"}"
] | Sets the value of the specified key in the current ValueMap to the
given value. | [
"Sets",
"the",
"value",
"of",
"the",
"specified",
"key",
"in",
"the",
"current",
"ValueMap",
"to",
"the",
"given",
"value",
"."
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/document/utils/ValueMap.java#L177-L180 |
beangle/beangle3 | orm/hibernate/src/main/java/org/beangle/orm/hibernate/tool/HbmGenerator.java | HbmGenerator.findAnnotation | private <T extends Annotation> T findAnnotation(Class<?> cls, Class<T> annotationClass, String name) {
Class<?> curr = cls;
T ann = null;
while (ann == null && curr != null && !curr.equals(Object.class)) {
ann = findAnnotationLocal(curr, annotationClass, name);
curr = curr.getSuperclass();
}
return ann;
} | java | private <T extends Annotation> T findAnnotation(Class<?> cls, Class<T> annotationClass, String name) {
Class<?> curr = cls;
T ann = null;
while (ann == null && curr != null && !curr.equals(Object.class)) {
ann = findAnnotationLocal(curr, annotationClass, name);
curr = curr.getSuperclass();
}
return ann;
} | [
"private",
"<",
"T",
"extends",
"Annotation",
">",
"T",
"findAnnotation",
"(",
"Class",
"<",
"?",
">",
"cls",
",",
"Class",
"<",
"T",
">",
"annotationClass",
",",
"String",
"name",
")",
"{",
"Class",
"<",
"?",
">",
"curr",
"=",
"cls",
";",
"T",
"an... | find annotation on specified member
@param cls
@param annotationClass
@param name
@return | [
"find",
"annotation",
"on",
"specified",
"member"
] | train | https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/orm/hibernate/src/main/java/org/beangle/orm/hibernate/tool/HbmGenerator.java#L106-L114 |
ops4j/org.ops4j.base | ops4j-base-util/src/main/java/org/ops4j/util/i18n/ResourceManager.java | ResourceManager.getBaseResources | public static Resources getBaseResources( String baseName, ClassLoader classLoader )
{
synchronized( ResourceManager.class )
{
Resources resources = getCachedResource( baseName );
if( null == resources )
{
resources = new Resources( baseName, classLoader );
putCachedResource( baseName, resources );
}
return resources;
}
} | java | public static Resources getBaseResources( String baseName, ClassLoader classLoader )
{
synchronized( ResourceManager.class )
{
Resources resources = getCachedResource( baseName );
if( null == resources )
{
resources = new Resources( baseName, classLoader );
putCachedResource( baseName, resources );
}
return resources;
}
} | [
"public",
"static",
"Resources",
"getBaseResources",
"(",
"String",
"baseName",
",",
"ClassLoader",
"classLoader",
")",
"{",
"synchronized",
"(",
"ResourceManager",
".",
"class",
")",
"{",
"Resources",
"resources",
"=",
"getCachedResource",
"(",
"baseName",
")",
"... | Retrieve resource with specified basename.
@param baseName the basename
@param classLoader the classLoader to load resources from
@return the Resources | [
"Retrieve",
"resource",
"with",
"specified",
"basename",
"."
] | train | https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-util/src/main/java/org/ops4j/util/i18n/ResourceManager.java#L72-L85 |
google/closure-templates | java/src/com/google/template/soy/jbcsrc/ProtoUtils.java | ProtoUtils.getHasserMethod | private static MethodRef getHasserMethod(FieldDescriptor descriptor) {
TypeInfo message = messageRuntimeType(descriptor.getContainingType());
return MethodRef.createInstanceMethod(
message,
new Method("has" + getFieldName(descriptor, true), Type.BOOLEAN_TYPE, NO_METHOD_ARGS))
.asCheap();
} | java | private static MethodRef getHasserMethod(FieldDescriptor descriptor) {
TypeInfo message = messageRuntimeType(descriptor.getContainingType());
return MethodRef.createInstanceMethod(
message,
new Method("has" + getFieldName(descriptor, true), Type.BOOLEAN_TYPE, NO_METHOD_ARGS))
.asCheap();
} | [
"private",
"static",
"MethodRef",
"getHasserMethod",
"(",
"FieldDescriptor",
"descriptor",
")",
"{",
"TypeInfo",
"message",
"=",
"messageRuntimeType",
"(",
"descriptor",
".",
"getContainingType",
"(",
")",
")",
";",
"return",
"MethodRef",
".",
"createInstanceMethod",
... | Returns the {@link MethodRef} for the generated hasser method. | [
"Returns",
"the",
"{"
] | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/ProtoUtils.java#L1223-L1229 |
CenturyLinkCloud/mdw | mdw-services/src/com/centurylink/mdw/services/event/EventServicesImpl.java | EventServicesImpl.getWorkTransitionInstance | public TransitionInstance getWorkTransitionInstance(Long pId)
throws DataAccessException, ProcessException {
TransitionInstance wti;
TransactionWrapper transaction = null;
EngineDataAccessDB edao = new EngineDataAccessDB();
try {
transaction = edao.startTransaction();
wti = edao.getWorkTransitionInstance(pId);
} catch (SQLException e) {
throw new ProcessException(0, "Failed to get work transition instance", e);
} finally {
edao.stopTransaction(transaction);
}
return wti;
} | java | public TransitionInstance getWorkTransitionInstance(Long pId)
throws DataAccessException, ProcessException {
TransitionInstance wti;
TransactionWrapper transaction = null;
EngineDataAccessDB edao = new EngineDataAccessDB();
try {
transaction = edao.startTransaction();
wti = edao.getWorkTransitionInstance(pId);
} catch (SQLException e) {
throw new ProcessException(0, "Failed to get work transition instance", e);
} finally {
edao.stopTransaction(transaction);
}
return wti;
} | [
"public",
"TransitionInstance",
"getWorkTransitionInstance",
"(",
"Long",
"pId",
")",
"throws",
"DataAccessException",
",",
"ProcessException",
"{",
"TransitionInstance",
"wti",
";",
"TransactionWrapper",
"transaction",
"=",
"null",
";",
"EngineDataAccessDB",
"edao",
"=",... | Returns the WorkTransitionVO based on the passed in params
@param pId
@return WorkTransitionINstance | [
"Returns",
"the",
"WorkTransitionVO",
"based",
"on",
"the",
"passed",
"in",
"params"
] | train | https://github.com/CenturyLinkCloud/mdw/blob/91167fe65a25a5d7022cdcf8b0fae8506f5b87ce/mdw-services/src/com/centurylink/mdw/services/event/EventServicesImpl.java#L463-L477 |
Azure/azure-sdk-for-java | mediaservices/resource-manager/v2015_10_01/src/main/java/com/microsoft/azure/management/mediaservices/v2015_10_01/implementation/MediaServicesInner.java | MediaServicesInner.regenerateKey | public RegenerateKeyOutputInner regenerateKey(String resourceGroupName, String mediaServiceName, KeyType keyType) {
return regenerateKeyWithServiceResponseAsync(resourceGroupName, mediaServiceName, keyType).toBlocking().single().body();
} | java | public RegenerateKeyOutputInner regenerateKey(String resourceGroupName, String mediaServiceName, KeyType keyType) {
return regenerateKeyWithServiceResponseAsync(resourceGroupName, mediaServiceName, keyType).toBlocking().single().body();
} | [
"public",
"RegenerateKeyOutputInner",
"regenerateKey",
"(",
"String",
"resourceGroupName",
",",
"String",
"mediaServiceName",
",",
"KeyType",
"keyType",
")",
"{",
"return",
"regenerateKeyWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"mediaServiceName",
",",
"key... | Regenerates a primary or secondary key for a Media Service.
@param resourceGroupName Name of the resource group within the Azure subscription.
@param mediaServiceName Name of the Media Service.
@param keyType The keyType indicating which key you want to regenerate, Primary or Secondary. Possible values include: 'Primary', 'Secondary'
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ApiErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the RegenerateKeyOutputInner object if successful. | [
"Regenerates",
"a",
"primary",
"or",
"secondary",
"key",
"for",
"a",
"Media",
"Service",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mediaservices/resource-manager/v2015_10_01/src/main/java/com/microsoft/azure/management/mediaservices/v2015_10_01/implementation/MediaServicesInner.java#L647-L649 |
alexa/alexa-skills-kit-sdk-for-java | ask-sdk-core/src/com/amazon/ask/attributes/AttributesManager.java | AttributesManager.setPersistentAttributes | public void setPersistentAttributes(Map<String, Object> persistentAttributes) {
if (persistenceAdapter == null) {
throw new IllegalStateException("Attempting to set persistence attributes without configured persistence adapter");
}
this.persistentAttributes = persistentAttributes;
persistenceAttributesSet = true;
} | java | public void setPersistentAttributes(Map<String, Object> persistentAttributes) {
if (persistenceAdapter == null) {
throw new IllegalStateException("Attempting to set persistence attributes without configured persistence adapter");
}
this.persistentAttributes = persistentAttributes;
persistenceAttributesSet = true;
} | [
"public",
"void",
"setPersistentAttributes",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"persistentAttributes",
")",
"{",
"if",
"(",
"persistenceAdapter",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Attempting to set persistence attrib... | Sets persistent attributes. The attributes set using this method will replace any existing persistent attributes,
but the changes will not be persisted back until {@link #savePersistentAttributes()} is called. Use this method
when bulk replacing attributes is desired. An exception is thrown if this method is called when a
{@link PersistenceAdapter} is not configured on the SDK.
@param persistentAttributes persistent attributes to set
@throws IllegalStateException if no {@link PersistenceAdapter} is configured | [
"Sets",
"persistent",
"attributes",
".",
"The",
"attributes",
"set",
"using",
"this",
"method",
"will",
"replace",
"any",
"existing",
"persistent",
"attributes",
"but",
"the",
"changes",
"will",
"not",
"be",
"persisted",
"back",
"until",
"{",
"@link",
"#savePers... | train | https://github.com/alexa/alexa-skills-kit-sdk-for-java/blob/c49194da0693898c70f3f2c4a372f5a12da04e3e/ask-sdk-core/src/com/amazon/ask/attributes/AttributesManager.java#L149-L155 |
lucee/Lucee | core/src/main/java/lucee/runtime/converter/WDDXConverter.java | WDDXConverter._deserializeQueryField | private void _deserializeQueryField(Query query, Element field) throws PageException, ConverterException {
String name = field.getAttribute("name");
NodeList list = field.getChildNodes();
int len = list.getLength();
int count = 0;
for (int i = 0; i < len; i++) {
Node node = list.item(i);
if (node instanceof Element) {
query.setAt(KeyImpl.init(name), ++count, _deserialize((Element) node));
}
}
} | java | private void _deserializeQueryField(Query query, Element field) throws PageException, ConverterException {
String name = field.getAttribute("name");
NodeList list = field.getChildNodes();
int len = list.getLength();
int count = 0;
for (int i = 0; i < len; i++) {
Node node = list.item(i);
if (node instanceof Element) {
query.setAt(KeyImpl.init(name), ++count, _deserialize((Element) node));
}
}
} | [
"private",
"void",
"_deserializeQueryField",
"(",
"Query",
"query",
",",
"Element",
"field",
")",
"throws",
"PageException",
",",
"ConverterException",
"{",
"String",
"name",
"=",
"field",
".",
"getAttribute",
"(",
"\"name\"",
")",
";",
"NodeList",
"list",
"=",
... | deserilize a single Field of a query WDDX Object
@param query
@param field
@throws ConverterException
@throws PageException | [
"deserilize",
"a",
"single",
"Field",
"of",
"a",
"query",
"WDDX",
"Object"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/converter/WDDXConverter.java#L702-L714 |
crawljax/crawljax | core/src/main/java/com/crawljax/core/configuration/Form.java | Form.inputField | public FormInput inputField(InputType type, Identification identification) {
FormInput input = new FormInput(type, identification);
this.formInputs.add(input);
return input;
} | java | public FormInput inputField(InputType type, Identification identification) {
FormInput input = new FormInput(type, identification);
this.formInputs.add(input);
return input;
} | [
"public",
"FormInput",
"inputField",
"(",
"InputType",
"type",
",",
"Identification",
"identification",
")",
"{",
"FormInput",
"input",
"=",
"new",
"FormInput",
"(",
"type",
",",
"identification",
")",
";",
"this",
".",
"formInputs",
".",
"add",
"(",
"input",
... | Specifies an input field to assign a value to. Crawljax first tries to match the found HTML
input element's id and then the name attribute.
@param type
the type of input field
@param identification
the locator of the input field
@return an InputField | [
"Specifies",
"an",
"input",
"field",
"to",
"assign",
"a",
"value",
"to",
".",
"Crawljax",
"first",
"tries",
"to",
"match",
"the",
"found",
"HTML",
"input",
"element",
"s",
"id",
"and",
"then",
"the",
"name",
"attribute",
"."
] | train | https://github.com/crawljax/crawljax/blob/d339f4f622ca902ccd35322065821e52a62ec543/core/src/main/java/com/crawljax/core/configuration/Form.java#L55-L59 |
belaban/JGroups | src/org/jgroups/util/Bits.java | Bits.readString | public static String readString(ByteBuffer buf) {
if(buf.get() == 0)
return null;
int len=readInt(buf);
if(buf.isDirect()) {
byte[] bytes=new byte[len];
buf.get(bytes);
return new String(bytes);
}
else {
byte[] bytes=buf.array();
return new String(bytes, buf.arrayOffset() + buf.position(), len);
}
} | java | public static String readString(ByteBuffer buf) {
if(buf.get() == 0)
return null;
int len=readInt(buf);
if(buf.isDirect()) {
byte[] bytes=new byte[len];
buf.get(bytes);
return new String(bytes);
}
else {
byte[] bytes=buf.array();
return new String(bytes, buf.arrayOffset() + buf.position(), len);
}
} | [
"public",
"static",
"String",
"readString",
"(",
"ByteBuffer",
"buf",
")",
"{",
"if",
"(",
"buf",
".",
"get",
"(",
")",
"==",
"0",
")",
"return",
"null",
";",
"int",
"len",
"=",
"readInt",
"(",
"buf",
")",
";",
"if",
"(",
"buf",
".",
"isDirect",
... | Reads a string from buf. The length is read first, followed by the chars. Each char is a single byte
@param buf the buffer
@return the string read from buf | [
"Reads",
"a",
"string",
"from",
"buf",
".",
"The",
"length",
"is",
"read",
"first",
"followed",
"by",
"the",
"chars",
".",
"Each",
"char",
"is",
"a",
"single",
"byte"
] | train | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/Bits.java#L630-L643 |
lightblueseas/file-worker | src/main/java/de/alpharogroup/file/write/WriteFileExtensions.java | WriteFileExtensions.write2File | public static void write2File(final Reader reader, final Writer writer) throws IOException
{
int byt;
while ((byt = reader.read()) != -1)
{
writer.write(byt);
}
} | java | public static void write2File(final Reader reader, final Writer writer) throws IOException
{
int byt;
while ((byt = reader.read()) != -1)
{
writer.write(byt);
}
} | [
"public",
"static",
"void",
"write2File",
"(",
"final",
"Reader",
"reader",
",",
"final",
"Writer",
"writer",
")",
"throws",
"IOException",
"{",
"int",
"byt",
";",
"while",
"(",
"(",
"byt",
"=",
"reader",
".",
"read",
"(",
")",
")",
"!=",
"-",
"1",
"... | The Method write2File() reads from an opened Reader and writes it to the opened Writer.
@param reader
The opened Reader.
@param writer
The opened Writer.
@throws IOException
Signals that an I/O exception has occurred. | [
"The",
"Method",
"write2File",
"()",
"reads",
"from",
"an",
"opened",
"Reader",
"and",
"writes",
"it",
"to",
"the",
"opened",
"Writer",
"."
] | train | https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/write/WriteFileExtensions.java#L252-L259 |
geomajas/geomajas-project-client-gwt | client/src/main/java/org/geomajas/gwt/client/spatial/geometry/GeometryFactory.java | GeometryFactory.createPolygon | public Polygon createPolygon(LinearRing exteriorRing, LinearRing[] interiorRings) {
if (exteriorRing == null) {
return new Polygon(srid, precision);
}
LinearRing[] clones = null;
if (interiorRings != null) {
clones = new LinearRing[interiorRings.length];
for (int i = 0; i < interiorRings.length; i++) {
clones[i] = (LinearRing) interiorRings[i].clone();
}
}
return new Polygon(srid, precision, (LinearRing) exteriorRing.clone(), clones);
} | java | public Polygon createPolygon(LinearRing exteriorRing, LinearRing[] interiorRings) {
if (exteriorRing == null) {
return new Polygon(srid, precision);
}
LinearRing[] clones = null;
if (interiorRings != null) {
clones = new LinearRing[interiorRings.length];
for (int i = 0; i < interiorRings.length; i++) {
clones[i] = (LinearRing) interiorRings[i].clone();
}
}
return new Polygon(srid, precision, (LinearRing) exteriorRing.clone(), clones);
} | [
"public",
"Polygon",
"createPolygon",
"(",
"LinearRing",
"exteriorRing",
",",
"LinearRing",
"[",
"]",
"interiorRings",
")",
"{",
"if",
"(",
"exteriorRing",
"==",
"null",
")",
"{",
"return",
"new",
"Polygon",
"(",
"srid",
",",
"precision",
")",
";",
"}",
"L... | Create a new {@link Polygon}, given a shell and and array of holes.
@param exteriorRing
A {@link LinearRing} object that represents the outer ring.
@param interiorRings
An array of {@link LinearRing} objects representing the holes.
@return Returns a {@link Polygon} object. | [
"Create",
"a",
"new",
"{",
"@link",
"Polygon",
"}",
"given",
"a",
"shell",
"and",
"and",
"array",
"of",
"holes",
"."
] | train | https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/spatial/geometry/GeometryFactory.java#L175-L187 |
Mozu/mozu-java | mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/LocationInventoryUrl.java | LocationInventoryUrl.addLocationInventoryUrl | public static MozuUrl addLocationInventoryUrl(String locationCode, Boolean performUpserts)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/locationinventory/{locationCode}?performUpserts={performUpserts}");
formatter.formatUrl("locationCode", locationCode);
formatter.formatUrl("performUpserts", performUpserts);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java | public static MozuUrl addLocationInventoryUrl(String locationCode, Boolean performUpserts)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/locationinventory/{locationCode}?performUpserts={performUpserts}");
formatter.formatUrl("locationCode", locationCode);
formatter.formatUrl("performUpserts", performUpserts);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | [
"public",
"static",
"MozuUrl",
"addLocationInventoryUrl",
"(",
"String",
"locationCode",
",",
"Boolean",
"performUpserts",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
"(",
"\"/api/commerce/catalog/admin/locationinventory/{locationCode}?performUpserts={perfo... | Get Resource Url for AddLocationInventory
@param locationCode The unique, user-defined code that identifies a location.
@param performUpserts Query string parameter lets the service perform an update for a new or existing record. When run, the update occurs without throwing a conflict exception that the record exists. If true, the updates completes regardless of the record currently existing. By default, if no value is specified, the service assumes this value is false.
@return String Resource Url | [
"Get",
"Resource",
"Url",
"for",
"AddLocationInventory"
] | train | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/LocationInventoryUrl.java#L62-L68 |
apache/flink | flink-optimizer/src/main/java/org/apache/flink/optimizer/dag/OptimizerNode.java | OptimizerNode.addBroadcastConnection | public void addBroadcastConnection(String name, DagConnection broadcastConnection) {
this.broadcastConnectionNames.add(name);
this.broadcastConnections.add(broadcastConnection);
} | java | public void addBroadcastConnection(String name, DagConnection broadcastConnection) {
this.broadcastConnectionNames.add(name);
this.broadcastConnections.add(broadcastConnection);
} | [
"public",
"void",
"addBroadcastConnection",
"(",
"String",
"name",
",",
"DagConnection",
"broadcastConnection",
")",
"{",
"this",
".",
"broadcastConnectionNames",
".",
"add",
"(",
"name",
")",
";",
"this",
".",
"broadcastConnections",
".",
"add",
"(",
"broadcastCo... | Adds the broadcast connection identified by the given {@code name} to this node.
@param broadcastConnection The connection to add. | [
"Adds",
"the",
"broadcast",
"connection",
"identified",
"by",
"the",
"given",
"{",
"@code",
"name",
"}",
"to",
"this",
"node",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-optimizer/src/main/java/org/apache/flink/optimizer/dag/OptimizerNode.java#L318-L321 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/XPathParser.java | XPathParser.initMatchPattern | public void initMatchPattern(
Compiler compiler, String expression, PrefixResolver namespaceContext)
throws javax.xml.transform.TransformerException
{
m_ops = compiler;
m_namespaceContext = namespaceContext;
m_functionTable = compiler.getFunctionTable();
Lexer lexer = new Lexer(compiler, namespaceContext, this);
lexer.tokenize(expression);
m_ops.setOp(0, OpCodes.OP_MATCHPATTERN);
m_ops.setOp(OpMap.MAPINDEX_LENGTH, 2);
nextToken();
Pattern();
if (null != m_token)
{
String extraTokens = "";
while (null != m_token)
{
extraTokens += "'" + m_token + "'";
nextToken();
if (null != m_token)
extraTokens += ", ";
}
error(XPATHErrorResources.ER_EXTRA_ILLEGAL_TOKENS,
new Object[]{ extraTokens }); //"Extra illegal tokens: "+extraTokens);
}
// Terminate for safety.
m_ops.setOp(m_ops.getOp(OpMap.MAPINDEX_LENGTH), OpCodes.ENDOP);
m_ops.setOp(OpMap.MAPINDEX_LENGTH, m_ops.getOp(OpMap.MAPINDEX_LENGTH)+1);
m_ops.shrink();
} | java | public void initMatchPattern(
Compiler compiler, String expression, PrefixResolver namespaceContext)
throws javax.xml.transform.TransformerException
{
m_ops = compiler;
m_namespaceContext = namespaceContext;
m_functionTable = compiler.getFunctionTable();
Lexer lexer = new Lexer(compiler, namespaceContext, this);
lexer.tokenize(expression);
m_ops.setOp(0, OpCodes.OP_MATCHPATTERN);
m_ops.setOp(OpMap.MAPINDEX_LENGTH, 2);
nextToken();
Pattern();
if (null != m_token)
{
String extraTokens = "";
while (null != m_token)
{
extraTokens += "'" + m_token + "'";
nextToken();
if (null != m_token)
extraTokens += ", ";
}
error(XPATHErrorResources.ER_EXTRA_ILLEGAL_TOKENS,
new Object[]{ extraTokens }); //"Extra illegal tokens: "+extraTokens);
}
// Terminate for safety.
m_ops.setOp(m_ops.getOp(OpMap.MAPINDEX_LENGTH), OpCodes.ENDOP);
m_ops.setOp(OpMap.MAPINDEX_LENGTH, m_ops.getOp(OpMap.MAPINDEX_LENGTH)+1);
m_ops.shrink();
} | [
"public",
"void",
"initMatchPattern",
"(",
"Compiler",
"compiler",
",",
"String",
"expression",
",",
"PrefixResolver",
"namespaceContext",
")",
"throws",
"javax",
".",
"xml",
".",
"transform",
".",
"TransformerException",
"{",
"m_ops",
"=",
"compiler",
";",
"m_nam... | Given an string, init an XPath object for pattern matches,
in order that a parse doesn't
have to be done each time the expression is evaluated.
@param compiler The XPath object to be initialized.
@param expression A String representing the XPath.
@param namespaceContext An object that is able to resolve prefixes in
the XPath to namespaces.
@throws javax.xml.transform.TransformerException | [
"Given",
"an",
"string",
"init",
"an",
"XPath",
"object",
"for",
"pattern",
"matches",
"in",
"order",
"that",
"a",
"parse",
"doesn",
"t",
"have",
"to",
"be",
"done",
"each",
"time",
"the",
"expression",
"is",
"evaluated",
".",
"@param",
"compiler",
"The",
... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/XPathParser.java#L177-L219 |
spring-projects/spring-ldap | samples/user-admin/src/main/java/org/springframework/ldap/samples/useradmin/service/UserService.java | UserService.updateUserStandard | private User updateUserStandard(LdapName originalId, User existingUser) {
User savedUser = userRepo.save(existingUser);
if(!originalId.equals(savedUser.getId())) {
// The user has moved - we need to update group references.
LdapName oldMemberDn = toAbsoluteDn(originalId);
LdapName newMemberDn = toAbsoluteDn(savedUser.getId());
Collection<Group> groups = groupRepo.findByMember(oldMemberDn);
updateGroupReferences(groups, oldMemberDn, newMemberDn);
}
return savedUser;
} | java | private User updateUserStandard(LdapName originalId, User existingUser) {
User savedUser = userRepo.save(existingUser);
if(!originalId.equals(savedUser.getId())) {
// The user has moved - we need to update group references.
LdapName oldMemberDn = toAbsoluteDn(originalId);
LdapName newMemberDn = toAbsoluteDn(savedUser.getId());
Collection<Group> groups = groupRepo.findByMember(oldMemberDn);
updateGroupReferences(groups, oldMemberDn, newMemberDn);
}
return savedUser;
} | [
"private",
"User",
"updateUserStandard",
"(",
"LdapName",
"originalId",
",",
"User",
"existingUser",
")",
"{",
"User",
"savedUser",
"=",
"userRepo",
".",
"save",
"(",
"existingUser",
")",
";",
"if",
"(",
"!",
"originalId",
".",
"equals",
"(",
"savedUser",
".... | Update the user and - if its id changed - update all group references to the user.
@param originalId the original id of the user.
@param existingUser the user, populated with new data
@return the updated entry | [
"Update",
"the",
"user",
"and",
"-",
"if",
"its",
"id",
"changed",
"-",
"update",
"all",
"group",
"references",
"to",
"the",
"user",
"."
] | train | https://github.com/spring-projects/spring-ldap/blob/15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0/samples/user-admin/src/main/java/org/springframework/ldap/samples/useradmin/service/UserService.java#L141-L153 |
BotMill/fb-botmill | src/main/java/co/aurasphere/botmill/fb/model/outcoming/factory/ButtonTemplateBuilder.java | ButtonTemplateBuilder.addPostbackButton | public ButtonTemplateBuilder addPostbackButton(String title, String payload) {
Button button = ButtonFactory.createPostbackButton(title, payload);
this.payload.addButton(button);
return this;
} | java | public ButtonTemplateBuilder addPostbackButton(String title, String payload) {
Button button = ButtonFactory.createPostbackButton(title, payload);
this.payload.addButton(button);
return this;
} | [
"public",
"ButtonTemplateBuilder",
"addPostbackButton",
"(",
"String",
"title",
",",
"String",
"payload",
")",
"{",
"Button",
"button",
"=",
"ButtonFactory",
".",
"createPostbackButton",
"(",
"title",
",",
"payload",
")",
";",
"this",
".",
"payload",
".",
"addBu... | Adds a button which sends a payload back when clicked to the current
template. There can be at most 3 buttons.
@param title
the button label.
@param payload
the payload to send back when clicked.
@return this builder. | [
"Adds",
"a",
"button",
"which",
"sends",
"a",
"payload",
"back",
"when",
"clicked",
"to",
"the",
"current",
"template",
".",
"There",
"can",
"be",
"at",
"most",
"3",
"buttons",
"."
] | train | https://github.com/BotMill/fb-botmill/blob/d94da3615a7339822c137ef75c92a03d791ee969/src/main/java/co/aurasphere/botmill/fb/model/outcoming/factory/ButtonTemplateBuilder.java#L128-L132 |
mabe02/lanterna | src/main/java/com/googlecode/lanterna/gui2/dialogs/ActionListDialog.java | ActionListDialog.showDialog | public static void showDialog(WindowBasedTextGUI textGUI, String title, String description, Runnable... items) {
ActionListDialog actionListDialog = new ActionListDialogBuilder()
.setTitle(title)
.setDescription(description)
.addActions(items)
.build();
actionListDialog.showDialog(textGUI);
} | java | public static void showDialog(WindowBasedTextGUI textGUI, String title, String description, Runnable... items) {
ActionListDialog actionListDialog = new ActionListDialogBuilder()
.setTitle(title)
.setDescription(description)
.addActions(items)
.build();
actionListDialog.showDialog(textGUI);
} | [
"public",
"static",
"void",
"showDialog",
"(",
"WindowBasedTextGUI",
"textGUI",
",",
"String",
"title",
",",
"String",
"description",
",",
"Runnable",
"...",
"items",
")",
"{",
"ActionListDialog",
"actionListDialog",
"=",
"new",
"ActionListDialogBuilder",
"(",
")",
... | Helper method for immediately displaying a {@code ActionListDialog}, the method will return when the dialog is
closed
@param textGUI Text GUI the dialog should be added to
@param title Title of the dialog
@param description Description of the dialog
@param items Items in the {@code ActionListBox}, the label will be taken from each {@code Runnable} by calling
{@code toString()} on each one | [
"Helper",
"method",
"for",
"immediately",
"displaying",
"a",
"{"
] | train | https://github.com/mabe02/lanterna/blob/8dfd62206ff46ab10223b2ef2dbb0a2c51850954/src/main/java/com/googlecode/lanterna/gui2/dialogs/ActionListDialog.java#L106-L113 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/LoadBalancersInner.java | LoadBalancersInner.beginCreateOrUpdateAsync | public Observable<LoadBalancerInner> beginCreateOrUpdateAsync(String resourceGroupName, String loadBalancerName, LoadBalancerInner parameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, loadBalancerName, parameters).map(new Func1<ServiceResponse<LoadBalancerInner>, LoadBalancerInner>() {
@Override
public LoadBalancerInner call(ServiceResponse<LoadBalancerInner> response) {
return response.body();
}
});
} | java | public Observable<LoadBalancerInner> beginCreateOrUpdateAsync(String resourceGroupName, String loadBalancerName, LoadBalancerInner parameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, loadBalancerName, parameters).map(new Func1<ServiceResponse<LoadBalancerInner>, LoadBalancerInner>() {
@Override
public LoadBalancerInner call(ServiceResponse<LoadBalancerInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"LoadBalancerInner",
">",
"beginCreateOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"loadBalancerName",
",",
"LoadBalancerInner",
"parameters",
")",
"{",
"return",
"beginCreateOrUpdateWithServiceResponseAsync",
"(",
"resourceG... | Creates or updates a load balancer.
@param resourceGroupName The name of the resource group.
@param loadBalancerName The name of the load balancer.
@param parameters Parameters supplied to the create or update load balancer operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the LoadBalancerInner object | [
"Creates",
"or",
"updates",
"a",
"load",
"balancer",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/LoadBalancersInner.java#L546-L553 |
pravega/pravega | segmentstore/storage/impl/src/main/java/io/pravega/segmentstore/storage/impl/bookkeeper/BookKeeperLog.java | BookKeeperLog.fetchLastAddConfirmed | @SneakyThrows(DurableDataLogException.class)
private long fetchLastAddConfirmed(WriteLedger writeLedger, Map<Long, Long> lastAddsConfirmed) {
long ledgerId = writeLedger.ledger.getId();
long lac = lastAddsConfirmed.getOrDefault(ledgerId, -1L);
long traceId = LoggerHelpers.traceEnterWithContext(log, this.traceObjectId, "fetchLastAddConfirmed", ledgerId, lac);
if (lac < 0) {
if (writeLedger.isRolledOver()) {
// This close was not due to failure, rather a rollover - hence lastAddConfirmed can be relied upon.
lac = writeLedger.ledger.getLastAddConfirmed();
} else {
// Ledger got closed. This could be due to some external factor, and lastAddConfirmed can't be relied upon.
// We need to re-open the ledger to get fresh data.
lac = Ledgers.readLastAddConfirmed(ledgerId, this.bookKeeper, this.config);
}
lastAddsConfirmed.put(ledgerId, lac);
log.info("{}: Fetched actual LastAddConfirmed ({}) for LedgerId {}.", this.traceObjectId, lac, ledgerId);
}
LoggerHelpers.traceLeave(log, this.traceObjectId, "fetchLastAddConfirmed", traceId, ledgerId, lac);
return lac;
} | java | @SneakyThrows(DurableDataLogException.class)
private long fetchLastAddConfirmed(WriteLedger writeLedger, Map<Long, Long> lastAddsConfirmed) {
long ledgerId = writeLedger.ledger.getId();
long lac = lastAddsConfirmed.getOrDefault(ledgerId, -1L);
long traceId = LoggerHelpers.traceEnterWithContext(log, this.traceObjectId, "fetchLastAddConfirmed", ledgerId, lac);
if (lac < 0) {
if (writeLedger.isRolledOver()) {
// This close was not due to failure, rather a rollover - hence lastAddConfirmed can be relied upon.
lac = writeLedger.ledger.getLastAddConfirmed();
} else {
// Ledger got closed. This could be due to some external factor, and lastAddConfirmed can't be relied upon.
// We need to re-open the ledger to get fresh data.
lac = Ledgers.readLastAddConfirmed(ledgerId, this.bookKeeper, this.config);
}
lastAddsConfirmed.put(ledgerId, lac);
log.info("{}: Fetched actual LastAddConfirmed ({}) for LedgerId {}.", this.traceObjectId, lac, ledgerId);
}
LoggerHelpers.traceLeave(log, this.traceObjectId, "fetchLastAddConfirmed", traceId, ledgerId, lac);
return lac;
} | [
"@",
"SneakyThrows",
"(",
"DurableDataLogException",
".",
"class",
")",
"private",
"long",
"fetchLastAddConfirmed",
"(",
"WriteLedger",
"writeLedger",
",",
"Map",
"<",
"Long",
",",
"Long",
">",
"lastAddsConfirmed",
")",
"{",
"long",
"ledgerId",
"=",
"writeLedger",... | Reliably gets the LastAddConfirmed for the WriteLedger
@param writeLedger The WriteLedger to query.
@param lastAddsConfirmed A Map of LedgerIds to LastAddConfirmed for each known ledger id. This is used as a cache
and will be updated if necessary.
@return The LastAddConfirmed for the WriteLedger. | [
"Reliably",
"gets",
"the",
"LastAddConfirmed",
"for",
"the",
"WriteLedger"
] | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/storage/impl/src/main/java/io/pravega/segmentstore/storage/impl/bookkeeper/BookKeeperLog.java#L523-L544 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/PdfStamper.java | PdfStamper.setThumbnail | public void setThumbnail(Image image, int page) throws PdfException, DocumentException {
stamper.setThumbnail(image, page);
} | java | public void setThumbnail(Image image, int page) throws PdfException, DocumentException {
stamper.setThumbnail(image, page);
} | [
"public",
"void",
"setThumbnail",
"(",
"Image",
"image",
",",
"int",
"page",
")",
"throws",
"PdfException",
",",
"DocumentException",
"{",
"stamper",
".",
"setThumbnail",
"(",
"image",
",",
"page",
")",
";",
"}"
] | Sets the thumbnail image for a page.
@param image the image
@param page the page
@throws PdfException on error
@throws DocumentException on error | [
"Sets",
"the",
"thumbnail",
"image",
"for",
"a",
"page",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfStamper.java#L468-L470 |
javagl/CommonUI | src/main/java/de/javagl/common/ui/SpinnerDraggingHandler.java | SpinnerDraggingHandler.handleWrapping | private boolean handleWrapping(MouseEvent e)
{
if (robot == null)
{
return false;
}
PointerInfo pointerInfo = null;
try
{
pointerInfo = MouseInfo.getPointerInfo();
}
catch (SecurityException ex)
{
return false;
}
Rectangle r =
pointerInfo.getDevice().getDefaultConfiguration().getBounds();
Point onScreen = pointerInfo.getLocation();
if (onScreen.y == 0)
{
robot.mouseMove(onScreen.x, r.height-2);
previousPoint = new Point(onScreen.x, r.height-2);
SwingUtilities.convertPointFromScreen(previousPoint, spinner);
return true;
}
else if (onScreen.y == r.height - 1)
{
robot.mouseMove(onScreen.x, 1);
previousPoint = new Point(onScreen.x, 1);
SwingUtilities.convertPointFromScreen(previousPoint, spinner);
return true;
}
return false;
} | java | private boolean handleWrapping(MouseEvent e)
{
if (robot == null)
{
return false;
}
PointerInfo pointerInfo = null;
try
{
pointerInfo = MouseInfo.getPointerInfo();
}
catch (SecurityException ex)
{
return false;
}
Rectangle r =
pointerInfo.getDevice().getDefaultConfiguration().getBounds();
Point onScreen = pointerInfo.getLocation();
if (onScreen.y == 0)
{
robot.mouseMove(onScreen.x, r.height-2);
previousPoint = new Point(onScreen.x, r.height-2);
SwingUtilities.convertPointFromScreen(previousPoint, spinner);
return true;
}
else if (onScreen.y == r.height - 1)
{
robot.mouseMove(onScreen.x, 1);
previousPoint = new Point(onScreen.x, 1);
SwingUtilities.convertPointFromScreen(previousPoint, spinner);
return true;
}
return false;
} | [
"private",
"boolean",
"handleWrapping",
"(",
"MouseEvent",
"e",
")",
"{",
"if",
"(",
"robot",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"PointerInfo",
"pointerInfo",
"=",
"null",
";",
"try",
"{",
"pointerInfo",
"=",
"MouseInfo",
".",
"getPointer... | Let the mouse wrap from the top of the screen to the bottom
or vice versa
@param e The mouse event
@return Whether the mouse wrapped | [
"Let",
"the",
"mouse",
"wrap",
"from",
"the",
"top",
"of",
"the",
"screen",
"to",
"the",
"bottom",
"or",
"vice",
"versa"
] | train | https://github.com/javagl/CommonUI/blob/b2c7a7637d4e288271392ba148dc17e4c9780255/src/main/java/de/javagl/common/ui/SpinnerDraggingHandler.java#L187-L220 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/SourceLineAnnotation.java | SourceLineAnnotation.fromVisitedInstruction | public static SourceLineAnnotation fromVisitedInstruction(MethodDescriptor methodDescriptor, Location location) {
return fromVisitedInstruction(methodDescriptor, location.getHandle().getPosition());
} | java | public static SourceLineAnnotation fromVisitedInstruction(MethodDescriptor methodDescriptor, Location location) {
return fromVisitedInstruction(methodDescriptor, location.getHandle().getPosition());
} | [
"public",
"static",
"SourceLineAnnotation",
"fromVisitedInstruction",
"(",
"MethodDescriptor",
"methodDescriptor",
",",
"Location",
"location",
")",
"{",
"return",
"fromVisitedInstruction",
"(",
"methodDescriptor",
",",
"location",
".",
"getHandle",
"(",
")",
".",
"getP... | Create from MethodDescriptor and Location of visited instruction.
@param methodDescriptor
MethodDescriptor identifying analyzed method
@param location
Location of instruction within analyed method
@return SourceLineAnnotation describing visited instruction | [
"Create",
"from",
"MethodDescriptor",
"and",
"Location",
"of",
"visited",
"instruction",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/SourceLineAnnotation.java#L427-L429 |
recommenders/rival | rival-evaluate/src/main/java/net/recommenders/rival/evaluation/metric/ranking/MAP.java | MAP.getValueAt | @Override
public double getValueAt(final U user, final int at) {
if (userMAPAtCutoff.containsKey(at) && userMAPAtCutoff.get(at).containsKey(user)) {
double map = userMAPAtCutoff.get(at).get(user);
return map;
}
return Double.NaN;
} | java | @Override
public double getValueAt(final U user, final int at) {
if (userMAPAtCutoff.containsKey(at) && userMAPAtCutoff.get(at).containsKey(user)) {
double map = userMAPAtCutoff.get(at).get(user);
return map;
}
return Double.NaN;
} | [
"@",
"Override",
"public",
"double",
"getValueAt",
"(",
"final",
"U",
"user",
",",
"final",
"int",
"at",
")",
"{",
"if",
"(",
"userMAPAtCutoff",
".",
"containsKey",
"(",
"at",
")",
"&&",
"userMAPAtCutoff",
".",
"get",
"(",
"at",
")",
".",
"containsKey",
... | Method to return the AP (average precision) value at a particular cutoff
level for a given user.
@param user the user
@param at cutoff level
@return the AP (average precision) corresponding to the requested user at
the cutoff level | [
"Method",
"to",
"return",
"the",
"AP",
"(",
"average",
"precision",
")",
"value",
"at",
"a",
"particular",
"cutoff",
"level",
"for",
"a",
"given",
"user",
"."
] | train | https://github.com/recommenders/rival/blob/6ee8223e91810ae1c6052899595af3906e0c34c6/rival-evaluate/src/main/java/net/recommenders/rival/evaluation/metric/ranking/MAP.java#L178-L185 |
JOML-CI/JOML | src/org/joml/Matrix4f.java | Matrix4f.scaleAround | public Matrix4f scaleAround(float sx, float sy, float sz, float ox, float oy, float oz) {
return scaleAround(sx, sy, sz, ox, oy, oz, thisOrNew());
} | java | public Matrix4f scaleAround(float sx, float sy, float sz, float ox, float oy, float oz) {
return scaleAround(sx, sy, sz, ox, oy, oz, thisOrNew());
} | [
"public",
"Matrix4f",
"scaleAround",
"(",
"float",
"sx",
",",
"float",
"sy",
",",
"float",
"sz",
",",
"float",
"ox",
",",
"float",
"oy",
",",
"float",
"oz",
")",
"{",
"return",
"scaleAround",
"(",
"sx",
",",
"sy",
",",
"sz",
",",
"ox",
",",
"oy",
... | Apply scaling to this matrix by scaling the base axes by the given sx,
sy and sz factors while using <code>(ox, oy, oz)</code> as the scaling origin.
<p>
If <code>M</code> is <code>this</code> matrix and <code>S</code> the scaling matrix,
then the new matrix will be <code>M * S</code>. So when transforming a
vector <code>v</code> with the new matrix by using <code>M * S * v</code>, the
scaling will be applied first!
<p>
This method is equivalent to calling: <code>translate(ox, oy, oz).scale(sx, sy, sz).translate(-ox, -oy, -oz)</code>
@param sx
the scaling factor of the x component
@param sy
the scaling factor of the y component
@param sz
the scaling factor of the z component
@param ox
the x coordinate of the scaling origin
@param oy
the y coordinate of the scaling origin
@param oz
the z coordinate of the scaling origin
@return a matrix holding the result | [
"Apply",
"scaling",
"to",
"this",
"matrix",
"by",
"scaling",
"the",
"base",
"axes",
"by",
"the",
"given",
"sx",
"sy",
"and",
"sz",
"factors",
"while",
"using",
"<code",
">",
"(",
"ox",
"oy",
"oz",
")",
"<",
"/",
"code",
">",
"as",
"the",
"scaling",
... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4f.java#L4841-L4843 |
atomix/copycat | server/src/main/java/io/atomix/copycat/server/storage/Storage.java | Storage.openLog | public Log openLog(String name) {
return new Log(name, this, ThreadContext.currentContextOrThrow().serializer().clone());
} | java | public Log openLog(String name) {
return new Log(name, this, ThreadContext.currentContextOrThrow().serializer().clone());
} | [
"public",
"Log",
"openLog",
"(",
"String",
"name",
")",
"{",
"return",
"new",
"Log",
"(",
"name",
",",
"this",
",",
"ThreadContext",
".",
"currentContextOrThrow",
"(",
")",
".",
"serializer",
"(",
")",
".",
"clone",
"(",
")",
")",
";",
"}"
] | Opens a new {@link Log}, recovering the log from disk if it exists.
<p>
When a log is opened, the log will attempt to load {@link Segment}s from the storage {@link #directory()}
according to the provided log {@code name}. If segments for the given log name are present on disk, segments
will be loaded and indexes will be rebuilt from disk. If no segments are found, an empty log will be created.
<p>
When log files are loaded from disk, the file names are expected to be based on the provided log {@code name}.
@param name The log name.
@return The opened log. | [
"Opens",
"a",
"new",
"{",
"@link",
"Log",
"}",
"recovering",
"the",
"log",
"from",
"disk",
"if",
"it",
"exists",
".",
"<p",
">",
"When",
"a",
"log",
"is",
"opened",
"the",
"log",
"will",
"attempt",
"to",
"load",
"{",
"@link",
"Segment",
"}",
"s",
"... | train | https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/storage/Storage.java#L321-L323 |
mlhartme/sushi | src/main/java/net/oneandone/sushi/fs/World.java | World.locatePathEntry | public FileNode locatePathEntry(Class<?> c) {
return locateEntry(c, Reflect.resourceName(c), true);
} | java | public FileNode locatePathEntry(Class<?> c) {
return locateEntry(c, Reflect.resourceName(c), true);
} | [
"public",
"FileNode",
"locatePathEntry",
"(",
"Class",
"<",
"?",
">",
"c",
")",
"{",
"return",
"locateEntry",
"(",
"c",
",",
"Reflect",
".",
"resourceName",
"(",
"c",
")",
",",
"true",
")",
";",
"}"
] | Returns the file or directory or module containing the specified class.
@param c the source class
@return the physical file defining the class | [
"Returns",
"the",
"file",
"or",
"directory",
"or",
"module",
"containing",
"the",
"specified",
"class",
"."
] | train | https://github.com/mlhartme/sushi/blob/4af33414b04bd58584d4febe5cc63ef6c7346a75/src/main/java/net/oneandone/sushi/fs/World.java#L550-L552 |
apollographql/apollo-android | apollo-api/src/main/java/com/apollographql/apollo/api/ResponseField.java | ResponseField.forCustomType | public static CustomTypeField forCustomType(String responseName, String fieldName, Map<String, Object> arguments,
boolean optional, ScalarType scalarType, List<Condition> conditions) {
return new CustomTypeField(responseName, fieldName, arguments, optional, scalarType, conditions);
} | java | public static CustomTypeField forCustomType(String responseName, String fieldName, Map<String, Object> arguments,
boolean optional, ScalarType scalarType, List<Condition> conditions) {
return new CustomTypeField(responseName, fieldName, arguments, optional, scalarType, conditions);
} | [
"public",
"static",
"CustomTypeField",
"forCustomType",
"(",
"String",
"responseName",
",",
"String",
"fieldName",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"arguments",
",",
"boolean",
"optional",
",",
"ScalarType",
"scalarType",
",",
"List",
"<",
"Conditi... | Factory method for creating a Field instance representing a custom GraphQL Scalar type, {@link Type#CUSTOM}
@param responseName alias for the result of a field
@param fieldName name of the field in the GraphQL operation
@param arguments arguments to be passed along with the field
@param optional whether the arguments passed along are optional or required
@param scalarType the custom scalar type of the field
@param conditions list of conditions for this field
@return Field instance representing {@link Type#CUSTOM} | [
"Factory",
"method",
"for",
"creating",
"a",
"Field",
"instance",
"representing",
"a",
"custom",
"GraphQL",
"Scalar",
"type",
"{",
"@link",
"Type#CUSTOM",
"}"
] | train | https://github.com/apollographql/apollo-android/blob/a78869a76e17f77e42c7a88f0099914fe7ffa5b6/apollo-api/src/main/java/com/apollographql/apollo/api/ResponseField.java#L161-L164 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.