repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 194 | func_name stringlengths 6 111 | whole_func_string stringlengths 80 3.8k | language stringclasses 1
value | func_code_string stringlengths 80 3.8k | func_code_tokens listlengths 20 697 | func_documentation_string stringlengths 61 2k | func_documentation_tokens listlengths 1 434 | split_name stringclasses 1
value | func_code_url stringlengths 111 308 |
|---|---|---|---|---|---|---|---|---|---|---|
mebigfatguy/fb-contrib | src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java | BloatedAssignmentScope.findScopeBlockWithTarget | private ScopeBlock findScopeBlockWithTarget(ScopeBlock sb, int start, int target) {
ScopeBlock parentBlock = null;
int finishLocation = sb.getFinish();
if ((sb.getStart() < start) && (finishLocation >= start) && ((finishLocation <= target) || (sb.isGoto() && !sb.isLoop()))) {
parentBlock = sb;
}
List<ScopeBlock> children = sb.getChildren();
if (children != null) {
for (ScopeBlock child : children) {
ScopeBlock targetBlock = findScopeBlockWithTarget(child, start, target);
if (targetBlock != null) {
return targetBlock;
}
}
}
return parentBlock;
} | java | private ScopeBlock findScopeBlockWithTarget(ScopeBlock sb, int start, int target) {
ScopeBlock parentBlock = null;
int finishLocation = sb.getFinish();
if ((sb.getStart() < start) && (finishLocation >= start) && ((finishLocation <= target) || (sb.isGoto() && !sb.isLoop()))) {
parentBlock = sb;
}
List<ScopeBlock> children = sb.getChildren();
if (children != null) {
for (ScopeBlock child : children) {
ScopeBlock targetBlock = findScopeBlockWithTarget(child, start, target);
if (targetBlock != null) {
return targetBlock;
}
}
}
return parentBlock;
} | [
"private",
"ScopeBlock",
"findScopeBlockWithTarget",
"(",
"ScopeBlock",
"sb",
",",
"int",
"start",
",",
"int",
"target",
")",
"{",
"ScopeBlock",
"parentBlock",
"=",
"null",
";",
"int",
"finishLocation",
"=",
"sb",
".",
"getFinish",
"(",
")",
";",
"if",
"(",
... | returns an existing scope block that has the same target as the one looked for
@param sb
the scope block to start with
@param start
the current pc
@param target
the target to look for
@return the scope block found or null | [
"returns",
"an",
"existing",
"scope",
"block",
"that",
"has",
"the",
"same",
"target",
"as",
"the",
"one",
"looked",
"for"
] | train | https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java#L659-L677 |
phax/ph-masterdata | ph-masterdata/src/main/java/com/helger/masterdata/currency/CurrencyHelper.java | CurrencyHelper.parseCurrencyFormatUnchanged | @Nullable
public static BigDecimal parseCurrencyFormatUnchanged (@Nullable final ECurrency eCurrency,
@Nullable final String sTextValue,
@Nullable final BigDecimal aDefault)
{
final PerCurrencySettings aPCS = getSettings (eCurrency);
final DecimalFormat aCurrencyFormat = aPCS.getCurrencyFormat ();
return parseCurrency (sTextValue, aCurrencyFormat, aDefault, aPCS.getRoundingMode ());
} | java | @Nullable
public static BigDecimal parseCurrencyFormatUnchanged (@Nullable final ECurrency eCurrency,
@Nullable final String sTextValue,
@Nullable final BigDecimal aDefault)
{
final PerCurrencySettings aPCS = getSettings (eCurrency);
final DecimalFormat aCurrencyFormat = aPCS.getCurrencyFormat ();
return parseCurrency (sTextValue, aCurrencyFormat, aDefault, aPCS.getRoundingMode ());
} | [
"@",
"Nullable",
"public",
"static",
"BigDecimal",
"parseCurrencyFormatUnchanged",
"(",
"@",
"Nullable",
"final",
"ECurrency",
"eCurrency",
",",
"@",
"Nullable",
"final",
"String",
"sTextValue",
",",
"@",
"Nullable",
"final",
"BigDecimal",
"aDefault",
")",
"{",
"f... | Try to parse a string value formatted by the {@link NumberFormat} object
returned from {@link #getCurrencyFormat(ECurrency)}. E.g.
<code>€ 5,00</code>
@param eCurrency
The currency it is about. If <code>null</code> is provided
{@link #DEFAULT_CURRENCY} is used instead.
@param sTextValue
The string value. It will be parsed unmodified!
@param aDefault
The default value to be used in case parsing fails. May be
<code>null</code>.
@return The {@link BigDecimal} value matching the string value or the
passed default value. | [
"Try",
"to",
"parse",
"a",
"string",
"value",
"formatted",
"by",
"the",
"{",
"@link",
"NumberFormat",
"}",
"object",
"returned",
"from",
"{",
"@link",
"#getCurrencyFormat",
"(",
"ECurrency",
")",
"}",
".",
"E",
".",
"g",
".",
"<code",
">",
"&euro",
";",
... | train | https://github.com/phax/ph-masterdata/blob/ca5e0b03c735b30b47930c018bfb5e71f00d0ff4/ph-masterdata/src/main/java/com/helger/masterdata/currency/CurrencyHelper.java#L502-L510 |
samskivert/pythagoras | src/main/java/pythagoras/d/MathUtil.java | MathUtil.angularDifference | public static double angularDifference (double a1, double a2) {
double ma1 = mirrorAngle(a1), ma2 = mirrorAngle(a2);
double diff = a1 - a2, mdiff = ma2 - ma1;
return (Math.abs(diff) < Math.abs(mdiff)) ? diff : mdiff;
} | java | public static double angularDifference (double a1, double a2) {
double ma1 = mirrorAngle(a1), ma2 = mirrorAngle(a2);
double diff = a1 - a2, mdiff = ma2 - ma1;
return (Math.abs(diff) < Math.abs(mdiff)) ? diff : mdiff;
} | [
"public",
"static",
"double",
"angularDifference",
"(",
"double",
"a1",
",",
"double",
"a2",
")",
"{",
"double",
"ma1",
"=",
"mirrorAngle",
"(",
"a1",
")",
",",
"ma2",
"=",
"mirrorAngle",
"(",
"a2",
")",
";",
"double",
"diff",
"=",
"a1",
"-",
"a2",
"... | Returns the (shortest) difference between two angles, assuming that both angles are in
[-pi, +pi]. | [
"Returns",
"the",
"(",
"shortest",
")",
"difference",
"between",
"two",
"angles",
"assuming",
"that",
"both",
"angles",
"are",
"in",
"[",
"-",
"pi",
"+",
"pi",
"]",
"."
] | train | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/d/MathUtil.java#L136-L140 |
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.resendEmail | public void resendEmail(String resourceGroupName, String certificateOrderName) {
resendEmailWithServiceResponseAsync(resourceGroupName, certificateOrderName).toBlocking().single().body();
} | java | public void resendEmail(String resourceGroupName, String certificateOrderName) {
resendEmailWithServiceResponseAsync(resourceGroupName, certificateOrderName).toBlocking().single().body();
} | [
"public",
"void",
"resendEmail",
"(",
"String",
"resourceGroupName",
",",
"String",
"certificateOrderName",
")",
"{",
"resendEmailWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"certificateOrderName",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")... | Resend certificate email.
Resend certificate email.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param certificateOrderName Name of the certificate order.
@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 | [
"Resend",
"certificate",
"email",
".",
"Resend",
"certificate",
"email",
"."
] | 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#L1777-L1779 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/jdbc/WSJdbcResultSet.java | WSJdbcResultSet.updateCharacterStream | public void updateCharacterStream(String arg0, Reader arg1, int arg2) throws SQLException {
try {
rsetImpl.updateCharacterStream(arg0, arg1, arg2);
} catch (SQLException ex) {
FFDCFilter.processException(ex, "com.ibm.ws.rsadapter.jdbc.WSJdbcResultSet.updateCharacterStream", "3317", this);
throw WSJdbcUtil.mapException(this, ex);
} catch (NullPointerException nullX) {
// No FFDC code needed; we might be closed.
throw runtimeXIfNotClosed(nullX);
}
} | java | public void updateCharacterStream(String arg0, Reader arg1, int arg2) throws SQLException {
try {
rsetImpl.updateCharacterStream(arg0, arg1, arg2);
} catch (SQLException ex) {
FFDCFilter.processException(ex, "com.ibm.ws.rsadapter.jdbc.WSJdbcResultSet.updateCharacterStream", "3317", this);
throw WSJdbcUtil.mapException(this, ex);
} catch (NullPointerException nullX) {
// No FFDC code needed; we might be closed.
throw runtimeXIfNotClosed(nullX);
}
} | [
"public",
"void",
"updateCharacterStream",
"(",
"String",
"arg0",
",",
"Reader",
"arg1",
",",
"int",
"arg2",
")",
"throws",
"SQLException",
"{",
"try",
"{",
"rsetImpl",
".",
"updateCharacterStream",
"(",
"arg0",
",",
"arg1",
",",
"arg2",
")",
";",
"}",
"ca... | Updates a column with a character stream value. The updateXXX methods are used to update column
values in the current row, or the insert row. The updateXXX methods do not update the underlying database; instead
the updateRow or insertRow methods are called to update the database.
@param columnName - the name of the column
x - the new column value
length - of the stream
@throws SQLException if a database access error occurs. | [
"Updates",
"a",
"column",
"with",
"a",
"character",
"stream",
"value",
".",
"The",
"updateXXX",
"methods",
"are",
"used",
"to",
"update",
"column",
"values",
"in",
"the",
"current",
"row",
"or",
"the",
"insert",
"row",
".",
"The",
"updateXXX",
"methods",
"... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/jdbc/WSJdbcResultSet.java#L3258-L3268 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/LoadJobConfiguration.java | LoadJobConfiguration.of | public static LoadJobConfiguration of(TableId destinationTable, List<String> sourceUris) {
return newBuilder(destinationTable, sourceUris).build();
} | java | public static LoadJobConfiguration of(TableId destinationTable, List<String> sourceUris) {
return newBuilder(destinationTable, sourceUris).build();
} | [
"public",
"static",
"LoadJobConfiguration",
"of",
"(",
"TableId",
"destinationTable",
",",
"List",
"<",
"String",
">",
"sourceUris",
")",
"{",
"return",
"newBuilder",
"(",
"destinationTable",
",",
"sourceUris",
")",
".",
"build",
"(",
")",
";",
"}"
] | Returns a BigQuery Load Job Configuration for the given destination table and source URIs. | [
"Returns",
"a",
"BigQuery",
"Load",
"Job",
"Configuration",
"for",
"the",
"given",
"destination",
"table",
"and",
"source",
"URIs",
"."
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/LoadJobConfiguration.java#L532-L534 |
svenkubiak/mangooio | mangooio-core/src/main/java/io/mangoo/routing/routes/ControllerRoute.java | ControllerRoute.withBasicAuthentication | public ControllerRoute withBasicAuthentication(String username, String password) {
Objects.requireNonNull(username, Required.USERNAME.toString());
Objects.requireNonNull(password, Required.PASSWORD.toString());
this.username = username;
this.password = password;
return this;
} | java | public ControllerRoute withBasicAuthentication(String username, String password) {
Objects.requireNonNull(username, Required.USERNAME.toString());
Objects.requireNonNull(password, Required.PASSWORD.toString());
this.username = username;
this.password = password;
return this;
} | [
"public",
"ControllerRoute",
"withBasicAuthentication",
"(",
"String",
"username",
",",
"String",
"password",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"username",
",",
"Required",
".",
"USERNAME",
".",
"toString",
"(",
")",
")",
";",
"Objects",
".",
"r... | Sets Basic HTTP authentication to all method on the given controller class
@param username The username for basic authentication in clear text
@param password The password for basic authentication in clear text
@return controller route instance | [
"Sets",
"Basic",
"HTTP",
"authentication",
"to",
"all",
"method",
"on",
"the",
"given",
"controller",
"class"
] | train | https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/routes/ControllerRoute.java#L89-L97 |
threerings/nenya | core/src/main/java/com/threerings/media/util/BackgroundTiler.java | BackgroundTiler.paint | public void paint (Graphics g, int x, int y, int width, int height)
{
// bail out now if we were passed a bogus source image at construct time
if (_tiles == null) {
return;
}
int rwid = width-2*_w3, rhei = height-2*_h3;
g.drawImage(_tiles[0], x, y, _w3, _h3, null);
g.drawImage(_tiles[1], x + _w3, y, rwid, _h3, null);
g.drawImage(_tiles[2], x + _w3 + rwid, y, _w3, _h3, null);
y += _h3;
g.drawImage(_tiles[3], x, y, _w3, rhei, null);
g.drawImage(_tiles[4], x + _w3, y, rwid, rhei, null);
g.drawImage(_tiles[5], x + _w3 + rwid, y, _w3, rhei, null);
y += rhei;
g.drawImage(_tiles[6], x, y, _w3, _h3, null);
g.drawImage(_tiles[7], x + _w3, y, rwid, _h3, null);
g.drawImage(_tiles[8], x + _w3 + rwid, y, _w3, _h3, null);
} | java | public void paint (Graphics g, int x, int y, int width, int height)
{
// bail out now if we were passed a bogus source image at construct time
if (_tiles == null) {
return;
}
int rwid = width-2*_w3, rhei = height-2*_h3;
g.drawImage(_tiles[0], x, y, _w3, _h3, null);
g.drawImage(_tiles[1], x + _w3, y, rwid, _h3, null);
g.drawImage(_tiles[2], x + _w3 + rwid, y, _w3, _h3, null);
y += _h3;
g.drawImage(_tiles[3], x, y, _w3, rhei, null);
g.drawImage(_tiles[4], x + _w3, y, rwid, rhei, null);
g.drawImage(_tiles[5], x + _w3 + rwid, y, _w3, rhei, null);
y += rhei;
g.drawImage(_tiles[6], x, y, _w3, _h3, null);
g.drawImage(_tiles[7], x + _w3, y, rwid, _h3, null);
g.drawImage(_tiles[8], x + _w3 + rwid, y, _w3, _h3, null);
} | [
"public",
"void",
"paint",
"(",
"Graphics",
"g",
",",
"int",
"x",
",",
"int",
"y",
",",
"int",
"width",
",",
"int",
"height",
")",
"{",
"// bail out now if we were passed a bogus source image at construct time",
"if",
"(",
"_tiles",
"==",
"null",
")",
"{",
"re... | Fills the requested region with the background defined by our source image. | [
"Fills",
"the",
"requested",
"region",
"with",
"the",
"background",
"defined",
"by",
"our",
"source",
"image",
"."
] | train | https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/util/BackgroundTiler.java#L92-L114 |
jeremylong/DependencyCheck | core/src/main/java/org/owasp/dependencycheck/xml/pom/PomProjectInputStream.java | PomProjectInputStream.findSequence | protected static int findSequence(byte[] sequence, byte[] buffer) {
int pos = -1;
for (int i = 0; i < buffer.length - sequence.length + 1; i++) {
if (buffer[i] == sequence[0] && testRemaining(sequence, buffer, i)) {
pos = i;
break;
}
}
return pos;
} | java | protected static int findSequence(byte[] sequence, byte[] buffer) {
int pos = -1;
for (int i = 0; i < buffer.length - sequence.length + 1; i++) {
if (buffer[i] == sequence[0] && testRemaining(sequence, buffer, i)) {
pos = i;
break;
}
}
return pos;
} | [
"protected",
"static",
"int",
"findSequence",
"(",
"byte",
"[",
"]",
"sequence",
",",
"byte",
"[",
"]",
"buffer",
")",
"{",
"int",
"pos",
"=",
"-",
"1",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"buffer",
".",
"length",
"-",
"sequence... | Finds the start of the given sequence in the buffer. If not found, -1 is
returned.
@param sequence the sequence to locate
@param buffer the buffer to search
@return the starting position of the sequence in the buffer if found;
otherwise -1 | [
"Finds",
"the",
"start",
"of",
"the",
"given",
"sequence",
"in",
"the",
"buffer",
".",
"If",
"not",
"found",
"-",
"1",
"is",
"returned",
"."
] | train | https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/xml/pom/PomProjectInputStream.java#L114-L123 |
wildfly/wildfly-core | patching/src/main/java/org/jboss/as/patching/runner/IdentityPatchContext.java | IdentityPatchContext.recordContentLoader | protected void recordContentLoader(final String patchID, final PatchContentLoader contentLoader) {
if (contentLoaders.containsKey(patchID)) {
throw new IllegalStateException("Content loader already registered for patch " + patchID); // internal wrong usage, no i18n
}
contentLoaders.put(patchID, contentLoader);
} | java | protected void recordContentLoader(final String patchID, final PatchContentLoader contentLoader) {
if (contentLoaders.containsKey(patchID)) {
throw new IllegalStateException("Content loader already registered for patch " + patchID); // internal wrong usage, no i18n
}
contentLoaders.put(patchID, contentLoader);
} | [
"protected",
"void",
"recordContentLoader",
"(",
"final",
"String",
"patchID",
",",
"final",
"PatchContentLoader",
"contentLoader",
")",
"{",
"if",
"(",
"contentLoaders",
".",
"containsKey",
"(",
"patchID",
")",
")",
"{",
"throw",
"new",
"IllegalStateException",
"... | Record a content loader for a given patch id.
@param patchID the patch id
@param contentLoader the content loader | [
"Record",
"a",
"content",
"loader",
"for",
"a",
"given",
"patch",
"id",
"."
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/runner/IdentityPatchContext.java#L533-L538 |
eurekaclinical/eurekaclinical-common | src/main/java/org/eurekaclinical/common/comm/clients/EurekaClinicalClient.java | EurekaClinicalClient.doPostCreateMultipart | protected URI doPostCreateMultipart(String path, InputStream inputStream, MultivaluedMap<String, String> headers) throws ClientException {
this.readLock.lock();
try {
WebResource.Builder requestBuilder = getResourceWrapper().rewritten(path, HttpMethod.POST).getRequestBuilder();
requestBuilder = ensurePostCreateMultipartHeaders(headers, requestBuilder);
ClientResponse response = requestBuilder.post(ClientResponse.class, inputStream);
errorIfStatusNotEqualTo(response, ClientResponse.Status.OK, ClientResponse.Status.CREATED);
try {
return response.getLocation();
} finally {
response.close();
}
} catch (ClientHandlerException ex) {
throw new ClientException(ClientResponse.Status.INTERNAL_SERVER_ERROR, ex.getMessage());
} finally {
this.readLock.unlock();
}
} | java | protected URI doPostCreateMultipart(String path, InputStream inputStream, MultivaluedMap<String, String> headers) throws ClientException {
this.readLock.lock();
try {
WebResource.Builder requestBuilder = getResourceWrapper().rewritten(path, HttpMethod.POST).getRequestBuilder();
requestBuilder = ensurePostCreateMultipartHeaders(headers, requestBuilder);
ClientResponse response = requestBuilder.post(ClientResponse.class, inputStream);
errorIfStatusNotEqualTo(response, ClientResponse.Status.OK, ClientResponse.Status.CREATED);
try {
return response.getLocation();
} finally {
response.close();
}
} catch (ClientHandlerException ex) {
throw new ClientException(ClientResponse.Status.INTERNAL_SERVER_ERROR, ex.getMessage());
} finally {
this.readLock.unlock();
}
} | [
"protected",
"URI",
"doPostCreateMultipart",
"(",
"String",
"path",
",",
"InputStream",
"inputStream",
",",
"MultivaluedMap",
"<",
"String",
",",
"String",
">",
"headers",
")",
"throws",
"ClientException",
"{",
"this",
".",
"readLock",
".",
"lock",
"(",
")",
"... | Creates a resource specified as a multi-part form in an input stream.
@param path the the API to call.
@param inputStream the multi-part form content.
@param headers any headers to send. If no Accepts header is provided,
this method as an Accepts header for text/plain. If no Content Type
header is provided, this method adds a Content Type header for multi-part
forms data.
@return the URI representing the created resource, for use in subsequent
operations on the resource.
@throws ClientException if a status code other than 200 (OK) and 201
(Created) is returned. | [
"Creates",
"a",
"resource",
"specified",
"as",
"a",
"multi",
"-",
"part",
"form",
"in",
"an",
"input",
"stream",
"."
] | train | https://github.com/eurekaclinical/eurekaclinical-common/blob/1867102ff43fe94e519f76a074d5f5923e9be61c/src/main/java/org/eurekaclinical/common/comm/clients/EurekaClinicalClient.java#L802-L819 |
jeremybrooks/jinx | src/main/java/net/jeremybrooks/jinx/api/PhotosLicensesApi.java | PhotosLicensesApi.setLicense | public Response setLicense(String photoId, Integer licenseId) throws JinxException {
JinxUtils.validateParams(photoId, licenseId);
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.photos.licenses.setLicense");
params.put("photo_id", photoId);
params.put("license_id", licenseId.toString());
return jinx.flickrPost(params, Response.class);
} | java | public Response setLicense(String photoId, Integer licenseId) throws JinxException {
JinxUtils.validateParams(photoId, licenseId);
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.photos.licenses.setLicense");
params.put("photo_id", photoId);
params.put("license_id", licenseId.toString());
return jinx.flickrPost(params, Response.class);
} | [
"public",
"Response",
"setLicense",
"(",
"String",
"photoId",
",",
"Integer",
"licenseId",
")",
"throws",
"JinxException",
"{",
"JinxUtils",
".",
"validateParams",
"(",
"photoId",
",",
"licenseId",
")",
";",
"Map",
"<",
"String",
",",
"String",
">",
"params",
... | Sets the license for a photo.
<br>
This method requires authentication with 'write' permission.
@param photoId (Required) The photo to update the license for.
@param licenseId (Required) The license to apply, or 0 (zero) to remove the current license.
Note: as of this writing the "no known copyright restrictions" license (7) is not a valid argument.
@return object with the status of the requested operation.
@throws JinxException if required parameters are missing, or if there are any errors.
@see <a href="https://www.flickr.com/services/api/flickr.photos.licenses.setLicense.html">flickr.photos.licenses.setLicense</a> | [
"Sets",
"the",
"license",
"for",
"a",
"photo",
".",
"<br",
">",
"This",
"method",
"requires",
"authentication",
"with",
"write",
"permission",
"."
] | train | https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/api/PhotosLicensesApi.java#L71-L78 |
samskivert/samskivert | src/main/java/com/samskivert/servlet/user/UserRepository.java | UserRepository.loadAllRealNames | public String[] loadAllRealNames ()
throws PersistenceException
{
final ArrayList<String> names = new ArrayList<String>();
// do the query
execute(new Operation<Object>() {
public Object invoke (Connection conn, DatabaseLiaison liaison)
throws PersistenceException, SQLException
{
Statement stmt = conn.createStatement();
try {
String query = "select realname from users";
ResultSet rs = stmt.executeQuery(query);
while (rs.next()) {
names.add(rs.getString(1));
}
// nothing to return
return null;
} finally {
JDBCUtil.close(stmt);
}
}
});
// finally construct our result
return names.toArray(new String[names.size()]);
} | java | public String[] loadAllRealNames ()
throws PersistenceException
{
final ArrayList<String> names = new ArrayList<String>();
// do the query
execute(new Operation<Object>() {
public Object invoke (Connection conn, DatabaseLiaison liaison)
throws PersistenceException, SQLException
{
Statement stmt = conn.createStatement();
try {
String query = "select realname from users";
ResultSet rs = stmt.executeQuery(query);
while (rs.next()) {
names.add(rs.getString(1));
}
// nothing to return
return null;
} finally {
JDBCUtil.close(stmt);
}
}
});
// finally construct our result
return names.toArray(new String[names.size()]);
} | [
"public",
"String",
"[",
"]",
"loadAllRealNames",
"(",
")",
"throws",
"PersistenceException",
"{",
"final",
"ArrayList",
"<",
"String",
">",
"names",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"// do the query",
"execute",
"(",
"new",
"Opera... | Returns an array with the real names of every user in the system. | [
"Returns",
"an",
"array",
"with",
"the",
"real",
"names",
"of",
"every",
"user",
"in",
"the",
"system",
"."
] | train | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/servlet/user/UserRepository.java#L341-L370 |
spring-projects/spring-shell | spring-shell-table/src/main/java/org/springframework/shell/table/Tables.java | Tables.configureKeyValueRendering | public static TableBuilder configureKeyValueRendering(TableBuilder builder, String delimiter) {
return builder.on(CellMatchers.ofType(Map.class))
.addFormatter(new MapFormatter(delimiter))
.addAligner(new KeyValueHorizontalAligner(delimiter.trim()))
.addSizer(new KeyValueSizeConstraints(delimiter))
.addWrapper(new KeyValueTextWrapper(delimiter)).and();
} | java | public static TableBuilder configureKeyValueRendering(TableBuilder builder, String delimiter) {
return builder.on(CellMatchers.ofType(Map.class))
.addFormatter(new MapFormatter(delimiter))
.addAligner(new KeyValueHorizontalAligner(delimiter.trim()))
.addSizer(new KeyValueSizeConstraints(delimiter))
.addWrapper(new KeyValueTextWrapper(delimiter)).and();
} | [
"public",
"static",
"TableBuilder",
"configureKeyValueRendering",
"(",
"TableBuilder",
"builder",
",",
"String",
"delimiter",
")",
"{",
"return",
"builder",
".",
"on",
"(",
"CellMatchers",
".",
"ofType",
"(",
"Map",
".",
"class",
")",
")",
".",
"addFormatter",
... | Install all the necessary formatters, aligners, etc for key-value rendering of Maps.
@param builder the builder to configure
@param delimiter the delimiter to apply between keys and values
@return buider for method chaining | [
"Install",
"all",
"the",
"necessary",
"formatters",
"aligners",
"etc",
"for",
"key",
"-",
"value",
"rendering",
"of",
"Maps",
"."
] | train | https://github.com/spring-projects/spring-shell/blob/23d99f45eb8f487e31a1f080c837061313bbfafa/spring-shell-table/src/main/java/org/springframework/shell/table/Tables.java#L35-L41 |
aalmiray/Json-lib | src/main/java/net/sf/json/JSONObject.java | JSONObject.element | public JSONObject element( String key, Map value ) {
return element( key, value, new JsonConfig() );
} | java | public JSONObject element( String key, Map value ) {
return element( key, value, new JsonConfig() );
} | [
"public",
"JSONObject",
"element",
"(",
"String",
"key",
",",
"Map",
"value",
")",
"{",
"return",
"element",
"(",
"key",
",",
"value",
",",
"new",
"JsonConfig",
"(",
")",
")",
";",
"}"
] | Put a key/value pair in the JSONObject, where the value will be a
JSONObject which is produced from a Map.
@param key A key string.
@param value A Map value.
@return this.
@throws JSONException | [
"Put",
"a",
"key",
"/",
"value",
"pair",
"in",
"the",
"JSONObject",
"where",
"the",
"value",
"will",
"be",
"a",
"JSONObject",
"which",
"is",
"produced",
"from",
"a",
"Map",
"."
] | train | https://github.com/aalmiray/Json-lib/blob/9e2b3376ee8f511a48aa7ac05f75a7414e02280f/src/main/java/net/sf/json/JSONObject.java#L1654-L1656 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Query.java | Query.startAfter | @Nonnull
public Query startAfter(@Nonnull DocumentSnapshot snapshot) {
QueryOptions newOptions = new QueryOptions(options);
newOptions.fieldOrders = createImplicitOrderBy();
newOptions.startCursor = createCursor(newOptions.fieldOrders, snapshot, false);
return new Query(firestore, path, newOptions);
} | java | @Nonnull
public Query startAfter(@Nonnull DocumentSnapshot snapshot) {
QueryOptions newOptions = new QueryOptions(options);
newOptions.fieldOrders = createImplicitOrderBy();
newOptions.startCursor = createCursor(newOptions.fieldOrders, snapshot, false);
return new Query(firestore, path, newOptions);
} | [
"@",
"Nonnull",
"public",
"Query",
"startAfter",
"(",
"@",
"Nonnull",
"DocumentSnapshot",
"snapshot",
")",
"{",
"QueryOptions",
"newOptions",
"=",
"new",
"QueryOptions",
"(",
"options",
")",
";",
"newOptions",
".",
"fieldOrders",
"=",
"createImplicitOrderBy",
"(",... | Creates and returns a new Query that starts after the provided document (exclusive). The
starting position is relative to the order of the query. The document must contain all of the
fields provided in the orderBy of this query.
@param snapshot The snapshot of the document to start after.
@return The created Query. | [
"Creates",
"and",
"returns",
"a",
"new",
"Query",
"that",
"starts",
"after",
"the",
"provided",
"document",
"(",
"exclusive",
")",
".",
"The",
"starting",
"position",
"is",
"relative",
"to",
"the",
"order",
"of",
"the",
"query",
".",
"The",
"document",
"mu... | 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#L781-L787 |
xwiki/xwiki-commons | xwiki-commons-core/xwiki-commons-legacy/xwiki-commons-legacy-component/xwiki-commons-legacy-component-default/src/main/java/org/xwiki/component/logging/AbstractLogger.java | AbstractLogger.formatMessage | protected String formatMessage(String message, Object... objects)
{
try {
return MessageFormat.format(message, objects);
} catch (IllegalArgumentException e) {
debug("Caught exception while formatting logging message: " + message, e);
// Try to save the message for logging output and just append the passed objects instead
if (objects != null) {
StringBuffer sb = new StringBuffer(message);
for (Object object : objects) {
if (object != null) {
sb.append(object);
} else {
sb.append("(null)");
}
sb.append(" ");
}
return sb.toString();
}
return message;
}
} | java | protected String formatMessage(String message, Object... objects)
{
try {
return MessageFormat.format(message, objects);
} catch (IllegalArgumentException e) {
debug("Caught exception while formatting logging message: " + message, e);
// Try to save the message for logging output and just append the passed objects instead
if (objects != null) {
StringBuffer sb = new StringBuffer(message);
for (Object object : objects) {
if (object != null) {
sb.append(object);
} else {
sb.append("(null)");
}
sb.append(" ");
}
return sb.toString();
}
return message;
}
} | [
"protected",
"String",
"formatMessage",
"(",
"String",
"message",
",",
"Object",
"...",
"objects",
")",
"{",
"try",
"{",
"return",
"MessageFormat",
".",
"format",
"(",
"message",
",",
"objects",
")",
";",
"}",
"catch",
"(",
"IllegalArgumentException",
"e",
"... | Formats the message like {@code MessageFormat.format(String, Object...)} but also checks for Exceptions and
catches them as logging should be robust and not interfere with normal program flow. The Exception caught will be
passed to the loggers debug output.
@param message message in Formatter format syntax
@param objects Objects to fill in
@return the formatted String if possible, else the message and all objects concatenated.
@see java.text.MessageFormat | [
"Formats",
"the",
"message",
"like",
"{",
"@code",
"MessageFormat",
".",
"format",
"(",
"String",
"Object",
"...",
")",
"}",
"but",
"also",
"checks",
"for",
"Exceptions",
"and",
"catches",
"them",
"as",
"logging",
"should",
"be",
"robust",
"and",
"not",
"i... | train | https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-legacy/xwiki-commons-legacy-component/xwiki-commons-legacy-component-default/src/main/java/org/xwiki/component/logging/AbstractLogger.java#L44-L66 |
thymeleaf/thymeleaf | src/main/java/org/thymeleaf/TemplateEngine.java | TemplateEngine.addDialect | public void addDialect(final String prefix, final IDialect dialect) {
Validate.notNull(dialect, "Dialect cannot be null");
checkNotInitialized();
this.dialectConfigurations.add(new DialectConfiguration(prefix, dialect));
} | java | public void addDialect(final String prefix, final IDialect dialect) {
Validate.notNull(dialect, "Dialect cannot be null");
checkNotInitialized();
this.dialectConfigurations.add(new DialectConfiguration(prefix, dialect));
} | [
"public",
"void",
"addDialect",
"(",
"final",
"String",
"prefix",
",",
"final",
"IDialect",
"dialect",
")",
"{",
"Validate",
".",
"notNull",
"(",
"dialect",
",",
"\"Dialect cannot be null\"",
")",
";",
"checkNotInitialized",
"(",
")",
";",
"this",
".",
"dialec... | <p>
Adds a new dialect for this template engine, using the specified prefix.
</p>
<p>
This dialect will be added to the set of currently configured ones.
</p>
<p>
This operation can only be executed before processing templates for the first
time. Once a template is processed, the template engine is considered to be
<i>initialized</i>, and from then on any attempt to change its configuration
will result in an exception.
</p>
@param prefix the prefix that will be used for this dialect
@param dialect the new {@link IDialect} to be added to the existing ones. | [
"<p",
">",
"Adds",
"a",
"new",
"dialect",
"for",
"this",
"template",
"engine",
"using",
"the",
"specified",
"prefix",
".",
"<",
"/",
"p",
">",
"<p",
">",
"This",
"dialect",
"will",
"be",
"added",
"to",
"the",
"set",
"of",
"currently",
"configured",
"on... | train | https://github.com/thymeleaf/thymeleaf/blob/2b0e6d6d7571fbe638904b5fd222fc9e77188879/src/main/java/org/thymeleaf/TemplateEngine.java#L500-L504 |
vnesek/nmote-iim4j | src/main/java/com/nmote/iim4j/IIMFile.java | IIMFile.getDateTimeHelper | public Date getDateTimeHelper(int dateDataSet, int timeDataSet) throws SerializationException {
DataSet dateDS = null;
DataSet timeDS = null;
for (Iterator<DataSet> i = dataSets.iterator(); (dateDS == null || timeDS == null) && i.hasNext();) {
DataSet ds = i.next();
DataSetInfo info = ds.getInfo();
if (info.getDataSetNumber() == dateDataSet) {
dateDS = ds;
} else if (info.getDataSetNumber() == timeDataSet) {
timeDS = ds;
}
}
Date result = null;
if (dateDS != null && timeDS != null) {
DataSetInfo dateDSI = dateDS.getInfo();
DataSetInfo timeDSI = timeDS.getInfo();
SimpleDateFormat format = new SimpleDateFormat(dateDSI.getSerializer().toString()
+ timeDSI.getSerializer().toString());
StringBuffer date = new StringBuffer(20);
try {
date.append(getData(dateDS));
date.append(getData(timeDS));
result = format.parse(date.toString());
} catch (ParseException e) {
throw new SerializationException("Failed to read date (" + e.getMessage() + ") with format " + date);
}
}
return result;
} | java | public Date getDateTimeHelper(int dateDataSet, int timeDataSet) throws SerializationException {
DataSet dateDS = null;
DataSet timeDS = null;
for (Iterator<DataSet> i = dataSets.iterator(); (dateDS == null || timeDS == null) && i.hasNext();) {
DataSet ds = i.next();
DataSetInfo info = ds.getInfo();
if (info.getDataSetNumber() == dateDataSet) {
dateDS = ds;
} else if (info.getDataSetNumber() == timeDataSet) {
timeDS = ds;
}
}
Date result = null;
if (dateDS != null && timeDS != null) {
DataSetInfo dateDSI = dateDS.getInfo();
DataSetInfo timeDSI = timeDS.getInfo();
SimpleDateFormat format = new SimpleDateFormat(dateDSI.getSerializer().toString()
+ timeDSI.getSerializer().toString());
StringBuffer date = new StringBuffer(20);
try {
date.append(getData(dateDS));
date.append(getData(timeDS));
result = format.parse(date.toString());
} catch (ParseException e) {
throw new SerializationException("Failed to read date (" + e.getMessage() + ") with format " + date);
}
}
return result;
} | [
"public",
"Date",
"getDateTimeHelper",
"(",
"int",
"dateDataSet",
",",
"int",
"timeDataSet",
")",
"throws",
"SerializationException",
"{",
"DataSet",
"dateDS",
"=",
"null",
";",
"DataSet",
"timeDS",
"=",
"null",
";",
"for",
"(",
"Iterator",
"<",
"DataSet",
">"... | Gets combined date/time value from two data sets.
@param dateDataSet
data set containing date value
@param timeDataSet
data set containing time value
@return date/time instance
@throws SerializationException
if data sets can't be deserialized from binary format or
can't be parsed | [
"Gets",
"combined",
"date",
"/",
"time",
"value",
"from",
"two",
"data",
"sets",
"."
] | train | https://github.com/vnesek/nmote-iim4j/blob/ec55b02fc644cd722e93051ac0bdb96b00cb42a8/src/main/java/com/nmote/iim4j/IIMFile.java#L203-L233 |
sporniket/core | sporniket-core-lang/src/main/java/com/sporniket/libre/lang/functor/FunctorFactory.java | FunctorFactory.instanciateFunctorAsAnInstanceMethodWrapper | public static Functor instanciateFunctorAsAnInstanceMethodWrapper(final Object instance, String methodName) throws Exception
{
if (null == instance)
{
throw new NullPointerException("Instance is null");
}
Method _method = instance.getClass().getMethod(methodName, (Class<?>[]) null);
return instanciateFunctorAsAMethodWrapper(instance, _method);
} | java | public static Functor instanciateFunctorAsAnInstanceMethodWrapper(final Object instance, String methodName) throws Exception
{
if (null == instance)
{
throw new NullPointerException("Instance is null");
}
Method _method = instance.getClass().getMethod(methodName, (Class<?>[]) null);
return instanciateFunctorAsAMethodWrapper(instance, _method);
} | [
"public",
"static",
"Functor",
"instanciateFunctorAsAnInstanceMethodWrapper",
"(",
"final",
"Object",
"instance",
",",
"String",
"methodName",
")",
"throws",
"Exception",
"{",
"if",
"(",
"null",
"==",
"instance",
")",
"{",
"throw",
"new",
"NullPointerException",
"("... | Create a functor without parameter, wrapping a call to another method.
@param instance
instance to call the method upon. Should not be null.
@param methodName
Name of the method, it must exist.
@return a Functor that call the specified method on the specified instance.
@throws Exception if there is a problem to deal with. | [
"Create",
"a",
"functor",
"without",
"parameter",
"wrapping",
"a",
"call",
"to",
"another",
"method",
"."
] | train | https://github.com/sporniket/core/blob/3480ebd72a07422fcc09971be2607ee25efb2c26/sporniket-core-lang/src/main/java/com/sporniket/libre/lang/functor/FunctorFactory.java#L99-L107 |
lagom/lagom | service/javadsl/server/src/main/java/com/lightbend/lagom/javadsl/server/status/Latency.java | Latency.withPercentile99th | public final Latency withPercentile99th(double value) {
double newValue = value;
return new Latency(this.median, this.percentile98th, newValue, this.percentile999th, this.mean, this.min, this.max);
} | java | public final Latency withPercentile99th(double value) {
double newValue = value;
return new Latency(this.median, this.percentile98th, newValue, this.percentile999th, this.mean, this.min, this.max);
} | [
"public",
"final",
"Latency",
"withPercentile99th",
"(",
"double",
"value",
")",
"{",
"double",
"newValue",
"=",
"value",
";",
"return",
"new",
"Latency",
"(",
"this",
".",
"median",
",",
"this",
".",
"percentile98th",
",",
"newValue",
",",
"this",
".",
"p... | Copy the current immutable object by setting a value for the {@link AbstractLatency#getPercentile99th() percentile99th} attribute.
@param value A new value for percentile99th
@return A modified copy of the {@code this} object | [
"Copy",
"the",
"current",
"immutable",
"object",
"by",
"setting",
"a",
"value",
"for",
"the",
"{"
] | train | https://github.com/lagom/lagom/blob/3763055a9d1aace793a5d970f4e688aea61b1a5a/service/javadsl/server/src/main/java/com/lightbend/lagom/javadsl/server/status/Latency.java#L147-L150 |
kiswanij/jk-util | src/main/java/com/jk/util/JKDateTimeUtil.java | JKDateTimeUtil.getHoursDifference | public static long getHoursDifference(Date startDate, Date endDate) {
long startTime = startDate.getTime();
long endTime = endDate.getTime();
long diffTime = endTime - startTime;
long diffInHours = TimeUnit.MILLISECONDS.toHours(diffTime);
return diffInHours;
} | java | public static long getHoursDifference(Date startDate, Date endDate) {
long startTime = startDate.getTime();
long endTime = endDate.getTime();
long diffTime = endTime - startTime;
long diffInHours = TimeUnit.MILLISECONDS.toHours(diffTime);
return diffInHours;
} | [
"public",
"static",
"long",
"getHoursDifference",
"(",
"Date",
"startDate",
",",
"Date",
"endDate",
")",
"{",
"long",
"startTime",
"=",
"startDate",
".",
"getTime",
"(",
")",
";",
"long",
"endTime",
"=",
"endDate",
".",
"getTime",
"(",
")",
";",
"long",
... | Gets the hours difference.
@param startDate the start date
@param endDate the end date
@return the hours difference | [
"Gets",
"the",
"hours",
"difference",
"."
] | train | https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKDateTimeUtil.java#L457-L463 |
lettuce-io/lettuce-core | src/main/java/io/lettuce/core/RedisClient.java | RedisClient.connectAsync | public <K, V> ConnectionFuture<StatefulRedisConnection<K, V>> connectAsync(RedisCodec<K, V> codec, RedisURI redisURI) {
assertNotNull(redisURI);
return transformAsyncConnectionException(connectStandaloneAsync(codec, redisURI, redisURI.getTimeout()));
} | java | public <K, V> ConnectionFuture<StatefulRedisConnection<K, V>> connectAsync(RedisCodec<K, V> codec, RedisURI redisURI) {
assertNotNull(redisURI);
return transformAsyncConnectionException(connectStandaloneAsync(codec, redisURI, redisURI.getTimeout()));
} | [
"public",
"<",
"K",
",",
"V",
">",
"ConnectionFuture",
"<",
"StatefulRedisConnection",
"<",
"K",
",",
"V",
">",
">",
"connectAsync",
"(",
"RedisCodec",
"<",
"K",
",",
"V",
">",
"codec",
",",
"RedisURI",
"redisURI",
")",
"{",
"assertNotNull",
"(",
"redisU... | Open asynchronously a new connection to a Redis server using the supplied {@link RedisURI} and the supplied
{@link RedisCodec codec} to encode/decode keys.
@param codec Use this codec to encode/decode keys and values, must not be {@literal null}
@param redisURI the Redis server to connect to, must not be {@literal null}
@param <K> Key type
@param <V> Value type
@return {@link ConnectionFuture} to indicate success or failure to connect.
@since 5.0 | [
"Open",
"asynchronously",
"a",
"new",
"connection",
"to",
"a",
"Redis",
"server",
"using",
"the",
"supplied",
"{",
"@link",
"RedisURI",
"}",
"and",
"the",
"supplied",
"{",
"@link",
"RedisCodec",
"codec",
"}",
"to",
"encode",
"/",
"decode",
"keys",
"."
] | train | https://github.com/lettuce-io/lettuce-core/blob/b6de74e384dea112e3656684ca3f50cdfd6c8e0d/src/main/java/io/lettuce/core/RedisClient.java#L250-L255 |
BorderTech/wcomponents | wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/datatable/SelectableDataTableExample.java | SelectableDataTableExample.createTable | private WDataTable createTable() {
WDataTable table = new WDataTable();
table.addColumn(new WTableColumn("First name", new WText()));
table.addColumn(new WTableColumn("Last name", new WText()));
table.addColumn(new WTableColumn("DOB", new WText()));
String[][] data = new String[][]{
new String[]{"Joe", "Bloggs", "01/02/1973"},
new String[]{"Jane", "Bloggs", "04/05/1976"},
new String[]{"Kid", "Bloggs", "31/12/1999"}
};
table.setDataModel(new SimpleTableDataModel(data));
return table;
} | java | private WDataTable createTable() {
WDataTable table = new WDataTable();
table.addColumn(new WTableColumn("First name", new WText()));
table.addColumn(new WTableColumn("Last name", new WText()));
table.addColumn(new WTableColumn("DOB", new WText()));
String[][] data = new String[][]{
new String[]{"Joe", "Bloggs", "01/02/1973"},
new String[]{"Jane", "Bloggs", "04/05/1976"},
new String[]{"Kid", "Bloggs", "31/12/1999"}
};
table.setDataModel(new SimpleTableDataModel(data));
return table;
} | [
"private",
"WDataTable",
"createTable",
"(",
")",
"{",
"WDataTable",
"table",
"=",
"new",
"WDataTable",
"(",
")",
";",
"table",
".",
"addColumn",
"(",
"new",
"WTableColumn",
"(",
"\"First name\"",
",",
"new",
"WText",
"(",
")",
")",
")",
";",
"table",
".... | Creates and configures the table to be used by the example. The table is configured with global rather than user
data. Although this is not a realistic scenario, it will suffice for this example.
@return a new configured table. | [
"Creates",
"and",
"configures",
"the",
"table",
"to",
"be",
"used",
"by",
"the",
"example",
".",
"The",
"table",
"is",
"configured",
"with",
"global",
"rather",
"than",
"user",
"data",
".",
"Although",
"this",
"is",
"not",
"a",
"realistic",
"scenario",
"it... | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/datatable/SelectableDataTableExample.java#L76-L91 |
UrielCh/ovh-java-sdk | ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java | ApiOvhTelephony.billingAccount_service_serviceName_previousVoiceConsumption_consumptionId_GET | public OvhPreviousVoiceConsumption billingAccount_service_serviceName_previousVoiceConsumption_consumptionId_GET(String billingAccount, String serviceName, Long consumptionId) throws IOException {
String qPath = "/telephony/{billingAccount}/service/{serviceName}/previousVoiceConsumption/{consumptionId}";
StringBuilder sb = path(qPath, billingAccount, serviceName, consumptionId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhPreviousVoiceConsumption.class);
} | java | public OvhPreviousVoiceConsumption billingAccount_service_serviceName_previousVoiceConsumption_consumptionId_GET(String billingAccount, String serviceName, Long consumptionId) throws IOException {
String qPath = "/telephony/{billingAccount}/service/{serviceName}/previousVoiceConsumption/{consumptionId}";
StringBuilder sb = path(qPath, billingAccount, serviceName, consumptionId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhPreviousVoiceConsumption.class);
} | [
"public",
"OvhPreviousVoiceConsumption",
"billingAccount_service_serviceName_previousVoiceConsumption_consumptionId_GET",
"(",
"String",
"billingAccount",
",",
"String",
"serviceName",
",",
"Long",
"consumptionId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/... | Get this object properties
REST: GET /telephony/{billingAccount}/service/{serviceName}/previousVoiceConsumption/{consumptionId}
@param billingAccount [required] The name of your billingAccount
@param serviceName [required]
@param consumptionId [required] | [
"Get",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L3844-L3849 |
beders/Resty | src/main/java/us/monoid/web/Resty.java | Resty.ignoreAllCerts | public static void ignoreAllCerts() {
try {
HttpsURLConnection.setDefaultSSLSocketFactory(TrustAllX509SocketFactory.getSSLSocketFactory());
HttpsURLConnection.setDefaultHostnameVerifier(AllowAllHostnameVerifier.ALLOW_ALL_HOSTNAMES);
} catch (Exception e) {
throw new RuntimeException("Failed to set 'Trust all' default SSL SocketFactory and Hostname Verifier", e);
}
} | java | public static void ignoreAllCerts() {
try {
HttpsURLConnection.setDefaultSSLSocketFactory(TrustAllX509SocketFactory.getSSLSocketFactory());
HttpsURLConnection.setDefaultHostnameVerifier(AllowAllHostnameVerifier.ALLOW_ALL_HOSTNAMES);
} catch (Exception e) {
throw new RuntimeException("Failed to set 'Trust all' default SSL SocketFactory and Hostname Verifier", e);
}
} | [
"public",
"static",
"void",
"ignoreAllCerts",
"(",
")",
"{",
"try",
"{",
"HttpsURLConnection",
".",
"setDefaultSSLSocketFactory",
"(",
"TrustAllX509SocketFactory",
".",
"getSSLSocketFactory",
"(",
")",
")",
";",
"HttpsURLConnection",
".",
"setDefaultHostnameVerifier",
"... | Defines the HttpsURLConnection's default SSLSocketFactory and HostnameVerifier so that all subsequence HttpsURLConnection instances
will trusts all certificates and accept all certificate hostnames.
<p/>
WARNING: Using this is dangerous as it bypasses most of what ssl certificates are made for. However, self-signed certificate, testing, and
domains with multiple sub-domains will not fail handshake verification when this setting is applied. | [
"Defines",
"the",
"HttpsURLConnection",
"s",
"default",
"SSLSocketFactory",
"and",
"HostnameVerifier",
"so",
"that",
"all",
"subsequence",
"HttpsURLConnection",
"instances",
"will",
"trusts",
"all",
"certificates",
"and",
"accept",
"all",
"certificate",
"hostnames",
"."... | train | https://github.com/beders/Resty/blob/4493603e9689c942cc3e53b9c5018010e414a364/src/main/java/us/monoid/web/Resty.java#L662-L669 |
landawn/AbacusUtil | src/com/landawn/abacus/util/Sheet.java | Sheet.moveRow | public void moveRow(Object rowKey, int newRowIndex) {
checkFrozen();
this.checkRowIndex(newRowIndex);
final int rowIndex = this.getRowIndex(rowKey);
final List<R> tmp = new ArrayList<>(rowLength());
tmp.addAll(_rowKeySet);
tmp.add(newRowIndex, tmp.remove(rowIndex));
_rowKeySet.clear();
_rowKeySet.addAll(tmp);
_rowKeyIndexMap = null;
if (_initialized && _columnList.size() > 0) {
for (List<E> column : _columnList) {
column.add(newRowIndex, column.remove(rowIndex));
}
}
} | java | public void moveRow(Object rowKey, int newRowIndex) {
checkFrozen();
this.checkRowIndex(newRowIndex);
final int rowIndex = this.getRowIndex(rowKey);
final List<R> tmp = new ArrayList<>(rowLength());
tmp.addAll(_rowKeySet);
tmp.add(newRowIndex, tmp.remove(rowIndex));
_rowKeySet.clear();
_rowKeySet.addAll(tmp);
_rowKeyIndexMap = null;
if (_initialized && _columnList.size() > 0) {
for (List<E> column : _columnList) {
column.add(newRowIndex, column.remove(rowIndex));
}
}
} | [
"public",
"void",
"moveRow",
"(",
"Object",
"rowKey",
",",
"int",
"newRowIndex",
")",
"{",
"checkFrozen",
"(",
")",
";",
"this",
".",
"checkRowIndex",
"(",
"newRowIndex",
")",
";",
"final",
"int",
"rowIndex",
"=",
"this",
".",
"getRowIndex",
"(",
"rowKey",... | Move the specified row to the new position.
@param rowKey
@param newRowIndex | [
"Move",
"the",
"specified",
"row",
"to",
"the",
"new",
"position",
"."
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/Sheet.java#L554-L574 |
wisdom-framework/wisdom | core/wisdom-vertx-engine/src/main/java/org/wisdom/framework/vertx/RequestFromVertx.java | RequestFromVertx.mediaTypes | @Override
public Collection<MediaType> mediaTypes() {
String contentType = request.headers().get(HeaderNames.ACCEPT);
if (contentType == null) {
// Any text by default.
return ImmutableList.of(MediaType.ANY_TEXT_TYPE);
}
TreeSet<MediaType> set = new TreeSet<>(new Comparator<MediaType>() {
@Override
public int compare(MediaType o1, MediaType o2) {
double q1 = 1.0, q2 = 1.0;
List<String> ql1 = o1.parameters().get("q");
List<String> ql2 = o2.parameters().get("q");
if (ql1 != null && !ql1.isEmpty()) {
q1 = Double.parseDouble(ql1.get(0));
}
if (ql2 != null && !ql2.isEmpty()) {
q2 = Double.parseDouble(ql2.get(0));
}
return new Double(q2).compareTo(q1);
}
});
// Split and sort.
String[] segments = contentType.split(",");
for (String segment : segments) {
MediaType type = MediaType.parse(segment.trim());
set.add(type);
}
return set;
} | java | @Override
public Collection<MediaType> mediaTypes() {
String contentType = request.headers().get(HeaderNames.ACCEPT);
if (contentType == null) {
// Any text by default.
return ImmutableList.of(MediaType.ANY_TEXT_TYPE);
}
TreeSet<MediaType> set = new TreeSet<>(new Comparator<MediaType>() {
@Override
public int compare(MediaType o1, MediaType o2) {
double q1 = 1.0, q2 = 1.0;
List<String> ql1 = o1.parameters().get("q");
List<String> ql2 = o2.parameters().get("q");
if (ql1 != null && !ql1.isEmpty()) {
q1 = Double.parseDouble(ql1.get(0));
}
if (ql2 != null && !ql2.isEmpty()) {
q2 = Double.parseDouble(ql2.get(0));
}
return new Double(q2).compareTo(q1);
}
});
// Split and sort.
String[] segments = contentType.split(",");
for (String segment : segments) {
MediaType type = MediaType.parse(segment.trim());
set.add(type);
}
return set;
} | [
"@",
"Override",
"public",
"Collection",
"<",
"MediaType",
">",
"mediaTypes",
"(",
")",
"{",
"String",
"contentType",
"=",
"request",
".",
"headers",
"(",
")",
".",
"get",
"(",
"HeaderNames",
".",
"ACCEPT",
")",
";",
"if",
"(",
"contentType",
"==",
"null... | Get the content media type that is acceptable for the client. E.g. Accept: text/*;q=0.3, text/html;q=0.7,
text/html;level=1,text/html;level=2;q=0.4
<p/>
The Accept request-header field can be used to specify certain media
types which are acceptable for the response. Accept headers can be used
to indicate that the request is specifically limited to a small set of
desired types, as in the case of a request for an in-line image.
@return a MediaType that is acceptable for the
client or {@see MediaType#ANY_TEXT_TYPE} if not set
@see <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html"
>http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html</a> | [
"Get",
"the",
"content",
"media",
"type",
"that",
"is",
"acceptable",
"for",
"the",
"client",
".",
"E",
".",
"g",
".",
"Accept",
":",
"text",
"/",
"*",
";",
"q",
"=",
"0",
".",
"3",
"text",
"/",
"html",
";",
"q",
"=",
"0",
".",
"7",
"text",
"... | train | https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-vertx-engine/src/main/java/org/wisdom/framework/vertx/RequestFromVertx.java#L247-L283 |
geomajas/geomajas-project-client-gwt | client/src/main/java/org/geomajas/gwt/client/map/feature/Feature.java | Feature.setLongAttribute | public void setLongAttribute(String name, Long value) {
Attribute attribute = getAttributes().get(name);
if (!(attribute instanceof LongAttribute)) {
throw new IllegalStateException("Cannot set boolean value on attribute with different type, " +
attribute.getClass().getName() + " setting value " + value);
}
((LongAttribute) attribute).setValue(value);
} | java | public void setLongAttribute(String name, Long value) {
Attribute attribute = getAttributes().get(name);
if (!(attribute instanceof LongAttribute)) {
throw new IllegalStateException("Cannot set boolean value on attribute with different type, " +
attribute.getClass().getName() + " setting value " + value);
}
((LongAttribute) attribute).setValue(value);
} | [
"public",
"void",
"setLongAttribute",
"(",
"String",
"name",
",",
"Long",
"value",
")",
"{",
"Attribute",
"attribute",
"=",
"getAttributes",
"(",
")",
".",
"get",
"(",
"name",
")",
";",
"if",
"(",
"!",
"(",
"attribute",
"instanceof",
"LongAttribute",
")",
... | Set attribute value of given type.
@param name attribute name
@param value attribute value | [
"Set",
"attribute",
"value",
"of",
"given",
"type",
"."
] | train | https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/map/feature/Feature.java#L320-L327 |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/AbstractIndex.java | AbstractIndex.getIndexReader | protected synchronized CommittableIndexReader getIndexReader() throws IOException
{
if (indexWriter != null)
{
indexWriter.close();
log.debug("closing IndexWriter.");
indexWriter = null;
}
if (indexReader == null || !indexReader.isCurrent())
{
IndexReader reader = IndexReader.open(getDirectory(), null, false, termInfosIndexDivisor);
// if modeHandler != null and mode==READ_ONLY, then reader should be with transient deletions.
// This is used to transiently update reader in clustered environment when some documents have
// been deleted. If index reader not null and already contains some transient deletions, but it
// is no more current, it will be re-created loosing deletions. They will already be applied by
// coordinator node in the cluster. And there is no need to inject them into the new reader
indexReader =
new CommittableIndexReader(reader, modeHandler != null && modeHandler.getMode() == IndexerIoMode.READ_ONLY);
}
return indexReader;
} | java | protected synchronized CommittableIndexReader getIndexReader() throws IOException
{
if (indexWriter != null)
{
indexWriter.close();
log.debug("closing IndexWriter.");
indexWriter = null;
}
if (indexReader == null || !indexReader.isCurrent())
{
IndexReader reader = IndexReader.open(getDirectory(), null, false, termInfosIndexDivisor);
// if modeHandler != null and mode==READ_ONLY, then reader should be with transient deletions.
// This is used to transiently update reader in clustered environment when some documents have
// been deleted. If index reader not null and already contains some transient deletions, but it
// is no more current, it will be re-created loosing deletions. They will already be applied by
// coordinator node in the cluster. And there is no need to inject them into the new reader
indexReader =
new CommittableIndexReader(reader, modeHandler != null && modeHandler.getMode() == IndexerIoMode.READ_ONLY);
}
return indexReader;
} | [
"protected",
"synchronized",
"CommittableIndexReader",
"getIndexReader",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"indexWriter",
"!=",
"null",
")",
"{",
"indexWriter",
".",
"close",
"(",
")",
";",
"log",
".",
"debug",
"(",
"\"closing IndexWriter.\"",
"... | Returns an <code>IndexReader</code> on this index. This index reader
may be used to delete documents.
@return an <code>IndexReader</code> on this index.
@throws IOException if the reader cannot be obtained. | [
"Returns",
"an",
"<code",
">",
"IndexReader<",
"/",
"code",
">",
"on",
"this",
"index",
".",
"This",
"index",
"reader",
"may",
"be",
"used",
"to",
"delete",
"documents",
"."
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/AbstractIndex.java#L239-L261 |
EvidentSolutions/dalesbred | dalesbred/src/main/java/org/dalesbred/Database.java | Database.executeQuery | public <T> T executeQuery(@NotNull ResultSetProcessor<T> processor, @NotNull @SQL String sql, Object... args) {
return executeQuery(processor, SqlQuery.query(sql, args));
} | java | public <T> T executeQuery(@NotNull ResultSetProcessor<T> processor, @NotNull @SQL String sql, Object... args) {
return executeQuery(processor, SqlQuery.query(sql, args));
} | [
"public",
"<",
"T",
">",
"T",
"executeQuery",
"(",
"@",
"NotNull",
"ResultSetProcessor",
"<",
"T",
">",
"processor",
",",
"@",
"NotNull",
"@",
"SQL",
"String",
"sql",
",",
"Object",
"...",
"args",
")",
"{",
"return",
"executeQuery",
"(",
"processor",
","... | Executes a query and processes the results with given {@link ResultSetProcessor}.
@see #executeQuery(ResultSetProcessor, SqlQuery) | [
"Executes",
"a",
"query",
"and",
"processes",
"the",
"results",
"with",
"given",
"{",
"@link",
"ResultSetProcessor",
"}",
"."
] | train | https://github.com/EvidentSolutions/dalesbred/blob/713f5b6e152d97e1672ca68b9ff9c7c6c288ceb1/dalesbred/src/main/java/org/dalesbred/Database.java#L292-L294 |
Omertron/api-themoviedb | src/main/java/com/omertron/themoviedbapi/methods/TmdbPeople.java | TmdbPeople.getPersonImages | public ResultList<Artwork> getPersonImages(int personId) throws MovieDbException {
TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.ID, personId);
URL url = new ApiUrl(apiKey, MethodBase.PERSON).subMethod(MethodSub.IMAGES).buildUrl(parameters);
String webpage = httpTools.getRequest(url);
try {
WrapperImages wrapper = MAPPER.readValue(webpage, WrapperImages.class);
ResultList<Artwork> results = new ResultList<>(wrapper.getAll(ArtworkType.PROFILE));
wrapper.setResultProperties(results);
return results;
} catch (IOException ex) {
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get person images", url, ex);
}
} | java | public ResultList<Artwork> getPersonImages(int personId) throws MovieDbException {
TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.ID, personId);
URL url = new ApiUrl(apiKey, MethodBase.PERSON).subMethod(MethodSub.IMAGES).buildUrl(parameters);
String webpage = httpTools.getRequest(url);
try {
WrapperImages wrapper = MAPPER.readValue(webpage, WrapperImages.class);
ResultList<Artwork> results = new ResultList<>(wrapper.getAll(ArtworkType.PROFILE));
wrapper.setResultProperties(results);
return results;
} catch (IOException ex) {
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get person images", url, ex);
}
} | [
"public",
"ResultList",
"<",
"Artwork",
">",
"getPersonImages",
"(",
"int",
"personId",
")",
"throws",
"MovieDbException",
"{",
"TmdbParameters",
"parameters",
"=",
"new",
"TmdbParameters",
"(",
")",
";",
"parameters",
".",
"add",
"(",
"Param",
".",
"ID",
",",... | Get the images for a specific person id.
@param personId
@return
@throws MovieDbException | [
"Get",
"the",
"images",
"for",
"a",
"specific",
"person",
"id",
"."
] | train | https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/methods/TmdbPeople.java#L216-L231 |
Baidu-AIP/java-sdk | src/main/java/com/baidu/aip/face/AipFace.java | AipFace.detect | public JSONObject detect(String image, String imageType, HashMap<String, String> options) {
AipRequest request = new AipRequest();
preOperation(request);
request.addBody("image", image);
request.addBody("image_type", imageType);
if (options != null) {
request.addBody(options);
}
request.setUri(FaceConsts.DETECT);
request.setBodyFormat(EBodyFormat.RAW_JSON);
postOperation(request);
return requestServer(request);
} | java | public JSONObject detect(String image, String imageType, HashMap<String, String> options) {
AipRequest request = new AipRequest();
preOperation(request);
request.addBody("image", image);
request.addBody("image_type", imageType);
if (options != null) {
request.addBody(options);
}
request.setUri(FaceConsts.DETECT);
request.setBodyFormat(EBodyFormat.RAW_JSON);
postOperation(request);
return requestServer(request);
} | [
"public",
"JSONObject",
"detect",
"(",
"String",
"image",
",",
"String",
"imageType",
",",
"HashMap",
"<",
"String",
",",
"String",
">",
"options",
")",
"{",
"AipRequest",
"request",
"=",
"new",
"AipRequest",
"(",
")",
";",
"preOperation",
"(",
"request",
... | 人脸检测接口
@param image - 图片信息(**总数据大小应小于10M**),图片上传方式根据image_type来判断
@param imageType - 图片类型 **BASE64**:图片的base64值,base64编码后的图片数据,需urlencode,编码后的图片大小不超过2M;**URL**:图片的 URL地址( 可能由于网络等原因导致下载图片时间过长)**;FACE_TOKEN**: 人脸图片的唯一标识,调用人脸检测接口时,会为每个人脸图片赋予一个唯一的FACE_TOKEN,同一张图片多次检测得到的FACE_TOKEN是同一个
@param options - 可选参数对象,key: value都为string类型
options - options列表:
face_field 包括**age,beauty,expression,faceshape,gender,glasses,landmark,race,quality,facetype信息** <br> 逗号分隔. 默认只返回face_token、人脸框、概率和旋转角度
max_face_num 最多处理人脸的数目,默认值为1,仅检测图片中面积最大的那个人脸;**最大值10**,检测图片中面积最大的几张人脸。
face_type 人脸的类型 **LIVE**表示生活照:通常为手机、相机拍摄的人像图片、或从网络获取的人像图片等**IDCARD**表示身份证芯片照:二代身份证内置芯片中的人像照片 **WATERMARK**表示带水印证件照:一般为带水印的小图,如公安网小图 **CERT**表示证件照片:如拍摄的身份证、工卡、护照、学生证等证件图片 默认**LIVE**
@return JSONObject | [
"人脸检测接口"
] | train | https://github.com/Baidu-AIP/java-sdk/blob/16bb8b7bb8f9bbcb7c8af62d0a67a1e79eecad90/src/main/java/com/baidu/aip/face/AipFace.java#L47-L61 |
redkale/redkale | src/org/redkale/source/EntityInfo.java | EntityInfo.getSQLValue | public Serializable getSQLValue(Attribute<T, Serializable> attr, T entity) {
Serializable val = attr.get(entity);
CryptHandler cryptHandler = attr.attach();
if (cryptHandler != null) val = (Serializable) cryptHandler.encrypt(val);
return val;
} | java | public Serializable getSQLValue(Attribute<T, Serializable> attr, T entity) {
Serializable val = attr.get(entity);
CryptHandler cryptHandler = attr.attach();
if (cryptHandler != null) val = (Serializable) cryptHandler.encrypt(val);
return val;
} | [
"public",
"Serializable",
"getSQLValue",
"(",
"Attribute",
"<",
"T",
",",
"Serializable",
">",
"attr",
",",
"T",
"entity",
")",
"{",
"Serializable",
"val",
"=",
"attr",
".",
"get",
"(",
"entity",
")",
";",
"CryptHandler",
"cryptHandler",
"=",
"attr",
".",
... | 字段值转换成数据库的值
@param attr Attribute
@param entity 记录对象
@return Object | [
"字段值转换成数据库的值"
] | train | https://github.com/redkale/redkale/blob/ea5169b5c5ea7412fd762331c0c497165832e901/src/org/redkale/source/EntityInfo.java#L905-L910 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/velocity/VelocityEngineFactory.java | VelocityEngineFactory.getVelocityEngine | public static synchronized VelocityEngine getVelocityEngine() {
if (engine == null) {
String fileTemplates = ConfigurationProperties.getVelocityFileTemplates();
boolean cacheTemplates = ConfigurationProperties.getVelocityCacheTemplates();
VelocityEngine newEngine = new VelocityEngine();
Properties props = new Properties();
// Configure the velocity template differently according to whether we are in
// "source mode" or not
if (fileTemplates != null && !"".equals(fileTemplates)) {
// Source mode
LOG.info("Velocity engine running in source mode from " + fileTemplates);
props.setProperty("resource.loader", "file,class");
props.setProperty("file.resource.loader.path", fileTemplates);
props.setProperty("file.resource.loader.cache", "false");
props.setProperty("file.resource.loader.modificationCheckInterval", "2");
props.setProperty("class.resource.loader.cache", "false");
props.setProperty("class.resource.loader.modificationCheckInterval", "2");
props.setProperty("class.resource.loader.class",
"org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
} else {
String cache = String.valueOf(cacheTemplates);
props.setProperty("class.resource.loader.cache", cache);
props.setProperty("resource.loader", "class");
props.setProperty("class.resource.loader.class",
"org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
}
// Setup commons logging for velocity
props.setProperty(RuntimeConstants.RUNTIME_LOG_LOGSYSTEM_CLASS,
"com.github.bordertech.wcomponents.velocity.VelocityLogger");
// Set up access to the common velocity macros.
props.setProperty(RuntimeConstants.VM_LIBRARY, ConfigurationProperties.getVelocityMacroLibrary());
try {
if (LOG.isInfoEnabled()) {
// Dump properties
StringWriter writer = new StringWriter();
props.list(new PrintWriter(writer));
LOG.info("Configuring velocity with the following properties...\n" + writer);
}
newEngine.init(props);
} catch (Exception ex) {
throw new SystemException("Failed to configure VelocityEngine", ex);
}
engine = newEngine;
}
return engine;
} | java | public static synchronized VelocityEngine getVelocityEngine() {
if (engine == null) {
String fileTemplates = ConfigurationProperties.getVelocityFileTemplates();
boolean cacheTemplates = ConfigurationProperties.getVelocityCacheTemplates();
VelocityEngine newEngine = new VelocityEngine();
Properties props = new Properties();
// Configure the velocity template differently according to whether we are in
// "source mode" or not
if (fileTemplates != null && !"".equals(fileTemplates)) {
// Source mode
LOG.info("Velocity engine running in source mode from " + fileTemplates);
props.setProperty("resource.loader", "file,class");
props.setProperty("file.resource.loader.path", fileTemplates);
props.setProperty("file.resource.loader.cache", "false");
props.setProperty("file.resource.loader.modificationCheckInterval", "2");
props.setProperty("class.resource.loader.cache", "false");
props.setProperty("class.resource.loader.modificationCheckInterval", "2");
props.setProperty("class.resource.loader.class",
"org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
} else {
String cache = String.valueOf(cacheTemplates);
props.setProperty("class.resource.loader.cache", cache);
props.setProperty("resource.loader", "class");
props.setProperty("class.resource.loader.class",
"org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
}
// Setup commons logging for velocity
props.setProperty(RuntimeConstants.RUNTIME_LOG_LOGSYSTEM_CLASS,
"com.github.bordertech.wcomponents.velocity.VelocityLogger");
// Set up access to the common velocity macros.
props.setProperty(RuntimeConstants.VM_LIBRARY, ConfigurationProperties.getVelocityMacroLibrary());
try {
if (LOG.isInfoEnabled()) {
// Dump properties
StringWriter writer = new StringWriter();
props.list(new PrintWriter(writer));
LOG.info("Configuring velocity with the following properties...\n" + writer);
}
newEngine.init(props);
} catch (Exception ex) {
throw new SystemException("Failed to configure VelocityEngine", ex);
}
engine = newEngine;
}
return engine;
} | [
"public",
"static",
"synchronized",
"VelocityEngine",
"getVelocityEngine",
"(",
")",
"{",
"if",
"(",
"engine",
"==",
"null",
")",
"{",
"String",
"fileTemplates",
"=",
"ConfigurationProperties",
".",
"getVelocityFileTemplates",
"(",
")",
";",
"boolean",
"cacheTemplat... | <p>
Returns the VelocityEngine associated with this factory. If this is the first time we are using the engine,
create it and initialise it.</p>
<p>
Note that velocity engines are hugely resource intensive, so we don't want too many of them. For the time being
we have a single instance stored as a static variable. This would only be a problem if the VelocityLayout class
ever wanted to use different engine configurations (unlikely).</p>
@return the VelocityEngine associated with this factory. | [
"<p",
">",
"Returns",
"the",
"VelocityEngine",
"associated",
"with",
"this",
"factory",
".",
"If",
"this",
"is",
"the",
"first",
"time",
"we",
"are",
"using",
"the",
"engine",
"create",
"it",
"and",
"initialise",
"it",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/velocity/VelocityEngineFactory.java#L51-L107 |
esigate/esigate | esigate-core/src/main/java/org/esigate/impl/FragmentRedirectStrategy.java | FragmentRedirectStrategy.getLocationURI | @Override
public URI getLocationURI(HttpRequest request, HttpResponse response, HttpContext context) throws ProtocolException {
URI uri = this.redirectStrategy.getLocationURI(request, response, context);
String resultingPageUrl = uri.toString();
DriverRequest driverRequest = ((OutgoingRequest) request).getOriginalRequest();
// Remove context if present
if (StringUtils.startsWith(resultingPageUrl, driverRequest.getVisibleBaseUrl())) {
resultingPageUrl =
"/"
+ StringUtils.stripStart(
StringUtils.replace(resultingPageUrl, driverRequest.getVisibleBaseUrl(), ""), "/");
}
resultingPageUrl = ResourceUtils.getHttpUrlWithQueryString(resultingPageUrl, driverRequest, false);
return UriUtils.createURI(ResourceUtils.getHttpUrlWithQueryString(resultingPageUrl, driverRequest, false));
} | java | @Override
public URI getLocationURI(HttpRequest request, HttpResponse response, HttpContext context) throws ProtocolException {
URI uri = this.redirectStrategy.getLocationURI(request, response, context);
String resultingPageUrl = uri.toString();
DriverRequest driverRequest = ((OutgoingRequest) request).getOriginalRequest();
// Remove context if present
if (StringUtils.startsWith(resultingPageUrl, driverRequest.getVisibleBaseUrl())) {
resultingPageUrl =
"/"
+ StringUtils.stripStart(
StringUtils.replace(resultingPageUrl, driverRequest.getVisibleBaseUrl(), ""), "/");
}
resultingPageUrl = ResourceUtils.getHttpUrlWithQueryString(resultingPageUrl, driverRequest, false);
return UriUtils.createURI(ResourceUtils.getHttpUrlWithQueryString(resultingPageUrl, driverRequest, false));
} | [
"@",
"Override",
"public",
"URI",
"getLocationURI",
"(",
"HttpRequest",
"request",
",",
"HttpResponse",
"response",
",",
"HttpContext",
"context",
")",
"throws",
"ProtocolException",
"{",
"URI",
"uri",
"=",
"this",
".",
"redirectStrategy",
".",
"getLocationURI",
"... | For local redirects, converts to relative urls.
@param request
must be an {@link OutgoingRequest}. | [
"For",
"local",
"redirects",
"converts",
"to",
"relative",
"urls",
"."
] | train | https://github.com/esigate/esigate/blob/50421fb224f16e1ec42715425109a72b3b55527b/esigate-core/src/main/java/org/esigate/impl/FragmentRedirectStrategy.java#L78-L96 |
Cornutum/tcases | tcases-maven-plugin/src/main/java/org/cornutum/tcases/maven/TcasesMojo.java | TcasesMojo.getBaseDir | private File getBaseDir( File path)
{
return
path == null?
baseDir_ :
path.isAbsolute()?
path :
new File( baseDir_, path.getPath());
} | java | private File getBaseDir( File path)
{
return
path == null?
baseDir_ :
path.isAbsolute()?
path :
new File( baseDir_, path.getPath());
} | [
"private",
"File",
"getBaseDir",
"(",
"File",
"path",
")",
"{",
"return",
"path",
"==",
"null",
"?",
"baseDir_",
":",
"path",
".",
"isAbsolute",
"(",
")",
"?",
"path",
":",
"new",
"File",
"(",
"baseDir_",
",",
"path",
".",
"getPath",
"(",
")",
")",
... | If the given path is not absolute, returns it as an absolute path relative to the
project base directory. Otherwise, returns the given absolute path. | [
"If",
"the",
"given",
"path",
"is",
"not",
"absolute",
"returns",
"it",
"as",
"an",
"absolute",
"path",
"relative",
"to",
"the",
"project",
"base",
"directory",
".",
"Otherwise",
"returns",
"the",
"given",
"absolute",
"path",
"."
] | train | https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-maven-plugin/src/main/java/org/cornutum/tcases/maven/TcasesMojo.java#L181-L191 |
google/error-prone | check_api/src/main/java/com/google/errorprone/matchers/Matchers.java | Matchers.booleanConstant | public static Matcher<ExpressionTree> booleanConstant(final boolean value) {
return new Matcher<ExpressionTree>() {
@Override
public boolean matches(ExpressionTree expressionTree, VisitorState state) {
if (expressionTree instanceof JCFieldAccess) {
Symbol symbol = ASTHelpers.getSymbol(expressionTree);
if (symbol.isStatic()
&& state.getTypes().unboxedTypeOrType(symbol.type).getTag() == TypeTag.BOOLEAN) {
return ((value && symbol.getSimpleName().contentEquals("TRUE"))
|| symbol.getSimpleName().contentEquals("FALSE"));
}
}
return false;
}
};
} | java | public static Matcher<ExpressionTree> booleanConstant(final boolean value) {
return new Matcher<ExpressionTree>() {
@Override
public boolean matches(ExpressionTree expressionTree, VisitorState state) {
if (expressionTree instanceof JCFieldAccess) {
Symbol symbol = ASTHelpers.getSymbol(expressionTree);
if (symbol.isStatic()
&& state.getTypes().unboxedTypeOrType(symbol.type).getTag() == TypeTag.BOOLEAN) {
return ((value && symbol.getSimpleName().contentEquals("TRUE"))
|| symbol.getSimpleName().contentEquals("FALSE"));
}
}
return false;
}
};
} | [
"public",
"static",
"Matcher",
"<",
"ExpressionTree",
">",
"booleanConstant",
"(",
"final",
"boolean",
"value",
")",
"{",
"return",
"new",
"Matcher",
"<",
"ExpressionTree",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"boolean",
"matches",
"(",
"ExpressionTr... | Matches the boolean constant ({@link Boolean#TRUE} or {@link Boolean#FALSE}) corresponding to
the given value. | [
"Matches",
"the",
"boolean",
"constant",
"(",
"{"
] | train | https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/check_api/src/main/java/com/google/errorprone/matchers/Matchers.java#L653-L668 |
lucee/Lucee | core/src/main/java/lucee/commons/sql/SQLUtil.java | SQLUtil.toBlob | public static Blob toBlob(Connection conn, Object value) throws PageException, SQLException {
if (value instanceof Blob) return (Blob) value;
// Java >= 1.6
if (SystemUtil.JAVA_VERSION >= SystemUtil.JAVA_VERSION_6) {
try {
Blob blob = conn.createBlob();
blob.setBytes(1, Caster.toBinary(value));
return blob;
}
catch (Throwable t) {
ExceptionUtil.rethrowIfNecessary(t);
return BlobImpl.toBlob(value);
}
}
// Java < 1.6
if (isOracle(conn)) {
Blob blob = OracleBlob.createBlob(conn, Caster.toBinary(value), null);
if (blob != null) return blob;
}
return BlobImpl.toBlob(value);
} | java | public static Blob toBlob(Connection conn, Object value) throws PageException, SQLException {
if (value instanceof Blob) return (Blob) value;
// Java >= 1.6
if (SystemUtil.JAVA_VERSION >= SystemUtil.JAVA_VERSION_6) {
try {
Blob blob = conn.createBlob();
blob.setBytes(1, Caster.toBinary(value));
return blob;
}
catch (Throwable t) {
ExceptionUtil.rethrowIfNecessary(t);
return BlobImpl.toBlob(value);
}
}
// Java < 1.6
if (isOracle(conn)) {
Blob blob = OracleBlob.createBlob(conn, Caster.toBinary(value), null);
if (blob != null) return blob;
}
return BlobImpl.toBlob(value);
} | [
"public",
"static",
"Blob",
"toBlob",
"(",
"Connection",
"conn",
",",
"Object",
"value",
")",
"throws",
"PageException",
",",
"SQLException",
"{",
"if",
"(",
"value",
"instanceof",
"Blob",
")",
"return",
"(",
"Blob",
")",
"value",
";",
"// Java >= 1.6",
"if"... | create a blog Object
@param conn
@param value
@return
@throws PageException
@throws SQLException | [
"create",
"a",
"blog",
"Object"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/sql/SQLUtil.java#L124-L146 |
jnidzwetzki/bitfinex-v2-wss-api-java | src/main/java/com/github/jnidzwetzki/bitfinex/v2/manager/QuoteManager.java | QuoteManager.handleCandlestickCollection | public void handleCandlestickCollection(final BitfinexCandlestickSymbol symbol, final Collection<BitfinexCandle> ticksBuffer) {
candleCallbacks.handleEventsCollection(symbol, ticksBuffer);
} | java | public void handleCandlestickCollection(final BitfinexCandlestickSymbol symbol, final Collection<BitfinexCandle> ticksBuffer) {
candleCallbacks.handleEventsCollection(symbol, ticksBuffer);
} | [
"public",
"void",
"handleCandlestickCollection",
"(",
"final",
"BitfinexCandlestickSymbol",
"symbol",
",",
"final",
"Collection",
"<",
"BitfinexCandle",
">",
"ticksBuffer",
")",
"{",
"candleCallbacks",
".",
"handleEventsCollection",
"(",
"symbol",
",",
"ticksBuffer",
")... | Process a list with candlesticks
@param symbol
@param ticksArray | [
"Process",
"a",
"list",
"with",
"candlesticks"
] | train | https://github.com/jnidzwetzki/bitfinex-v2-wss-api-java/blob/2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee/src/main/java/com/github/jnidzwetzki/bitfinex/v2/manager/QuoteManager.java#L238-L240 |
alipay/sofa-rpc | core/api/src/main/java/com/alipay/sofa/rpc/filter/FilterInvoker.java | FilterInvoker.getIntMethodParam | protected int getIntMethodParam(String methodName, String paramKey, int defaultValue) {
if (CommonUtils.isEmpty(configContext)) {
return defaultValue;
}
Integer o = (Integer) configContext.get(buildMethodKey(methodName, paramKey));
if (o == null) {
o = (Integer) configContext.get(paramKey);
return o == null ? defaultValue : o;
} else {
return o;
}
} | java | protected int getIntMethodParam(String methodName, String paramKey, int defaultValue) {
if (CommonUtils.isEmpty(configContext)) {
return defaultValue;
}
Integer o = (Integer) configContext.get(buildMethodKey(methodName, paramKey));
if (o == null) {
o = (Integer) configContext.get(paramKey);
return o == null ? defaultValue : o;
} else {
return o;
}
} | [
"protected",
"int",
"getIntMethodParam",
"(",
"String",
"methodName",
",",
"String",
"paramKey",
",",
"int",
"defaultValue",
")",
"{",
"if",
"(",
"CommonUtils",
".",
"isEmpty",
"(",
"configContext",
")",
")",
"{",
"return",
"defaultValue",
";",
"}",
"Integer",... | 取得方法的特殊参数配置
@param methodName 方法名
@param paramKey 参数关键字
@param defaultValue 默认值
@return 都找不到为defaultValue int method param | [
"取得方法的特殊参数配置"
] | train | https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/core/api/src/main/java/com/alipay/sofa/rpc/filter/FilterInvoker.java#L182-L193 |
JodaOrg/joda-time | src/main/java/org/joda/time/DateMidnight.java | DateMidnight.withMillis | public DateMidnight withMillis(long newMillis) {
Chronology chrono = getChronology();
newMillis = checkInstant(newMillis, chrono);
return (newMillis == getMillis() ? this : new DateMidnight(newMillis, chrono));
} | java | public DateMidnight withMillis(long newMillis) {
Chronology chrono = getChronology();
newMillis = checkInstant(newMillis, chrono);
return (newMillis == getMillis() ? this : new DateMidnight(newMillis, chrono));
} | [
"public",
"DateMidnight",
"withMillis",
"(",
"long",
"newMillis",
")",
"{",
"Chronology",
"chrono",
"=",
"getChronology",
"(",
")",
";",
"newMillis",
"=",
"checkInstant",
"(",
"newMillis",
",",
"chrono",
")",
";",
"return",
"(",
"newMillis",
"==",
"getMillis",... | Returns a copy of this date with a different millisecond instant.
The returned object will have a local time of midnight.
<p>
Only the millis will change, the chronology and time zone are kept.
The returned object will be either be a new instance or <code>this</code>.
@param newMillis the new millis, from 1970-01-01T00:00:00Z
@return a copy of this instant with different millis | [
"Returns",
"a",
"copy",
"of",
"this",
"date",
"with",
"a",
"different",
"millisecond",
"instant",
".",
"The",
"returned",
"object",
"will",
"have",
"a",
"local",
"time",
"of",
"midnight",
".",
"<p",
">",
"Only",
"the",
"millis",
"will",
"change",
"the",
... | train | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/DateMidnight.java#L375-L379 |
facebookarchive/hadoop-20 | src/core/org/apache/hadoop/fs/InMemoryFileSystem.java | InMemoryFileSystem.reserveSpaceWithCheckSum | public boolean reserveSpaceWithCheckSum(Path f, long size) {
RawInMemoryFileSystem mfs = (RawInMemoryFileSystem)getRawFileSystem();
synchronized(mfs) {
boolean b = mfs.reserveSpace(f, size);
if (b) {
long checksumSize = getChecksumFileLength(f, size);
b = mfs.reserveSpace(getChecksumFile(f), checksumSize);
if (!b) {
mfs.unreserveSpace(f);
}
}
return b;
}
} | java | public boolean reserveSpaceWithCheckSum(Path f, long size) {
RawInMemoryFileSystem mfs = (RawInMemoryFileSystem)getRawFileSystem();
synchronized(mfs) {
boolean b = mfs.reserveSpace(f, size);
if (b) {
long checksumSize = getChecksumFileLength(f, size);
b = mfs.reserveSpace(getChecksumFile(f), checksumSize);
if (!b) {
mfs.unreserveSpace(f);
}
}
return b;
}
} | [
"public",
"boolean",
"reserveSpaceWithCheckSum",
"(",
"Path",
"f",
",",
"long",
"size",
")",
"{",
"RawInMemoryFileSystem",
"mfs",
"=",
"(",
"RawInMemoryFileSystem",
")",
"getRawFileSystem",
"(",
")",
";",
"synchronized",
"(",
"mfs",
")",
"{",
"boolean",
"b",
"... | Register a file with its size. This will also register a checksum for the
file that the user is trying to create. This is required since none of
the FileSystem APIs accept the size of the file as argument. But since it
is required for us to apriori know the size of the file we are going to
create, the user must call this method for each file he wants to create
and reserve memory for that file. We either succeed in reserving memory
for both the main file and the checksum file and return true, or return
false. | [
"Register",
"a",
"file",
"with",
"its",
"size",
".",
"This",
"will",
"also",
"register",
"a",
"checksum",
"for",
"the",
"file",
"that",
"the",
"user",
"is",
"trying",
"to",
"create",
".",
"This",
"is",
"required",
"since",
"none",
"of",
"the",
"FileSyste... | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/InMemoryFileSystem.java#L416-L429 |
nohana/Amalgam | amalgam/src/main/java/com/amalgam/os/BundleUtils.java | BundleUtils.optFloat | public static float optFloat(@Nullable Bundle bundle, @Nullable String key) {
return optFloat(bundle, key, 0.f);
} | java | public static float optFloat(@Nullable Bundle bundle, @Nullable String key) {
return optFloat(bundle, key, 0.f);
} | [
"public",
"static",
"float",
"optFloat",
"(",
"@",
"Nullable",
"Bundle",
"bundle",
",",
"@",
"Nullable",
"String",
"key",
")",
"{",
"return",
"optFloat",
"(",
"bundle",
",",
"key",
",",
"0.f",
")",
";",
"}"
] | Returns a optional float value. In other words, returns the value mapped by key if it exists and is a float.
The bundle argument is allowed to be {@code null}. If the bundle is null, this method returns 0.0.
@param bundle a bundle. If the bundle is null, this method will return 0.0.
@param key a key for the value.
@return a float value if exists, 0.0 otherwise.
@see android.os.Bundle#getFloat(String) | [
"Returns",
"a",
"optional",
"float",
"value",
".",
"In",
"other",
"words",
"returns",
"the",
"value",
"mapped",
"by",
"key",
"if",
"it",
"exists",
"and",
"is",
"a",
"float",
".",
"The",
"bundle",
"argument",
"is",
"allowed",
"to",
"be",
"{"
] | train | https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/os/BundleUtils.java#L483-L485 |
google/closure-templates | java/src/com/google/template/soy/jssrc/internal/JsSrcNameGenerators.java | JsSrcNameGenerators.forLocalVariables | public static UniqueNameGenerator forLocalVariables() {
UniqueNameGenerator generator = new UniqueNameGenerator(DANGEROUS_CHARACTERS, "$$");
generator.reserve(JsSrcUtils.JS_LITERALS);
generator.reserve(JsSrcUtils.JS_RESERVED_WORDS);
return generator;
} | java | public static UniqueNameGenerator forLocalVariables() {
UniqueNameGenerator generator = new UniqueNameGenerator(DANGEROUS_CHARACTERS, "$$");
generator.reserve(JsSrcUtils.JS_LITERALS);
generator.reserve(JsSrcUtils.JS_RESERVED_WORDS);
return generator;
} | [
"public",
"static",
"UniqueNameGenerator",
"forLocalVariables",
"(",
")",
"{",
"UniqueNameGenerator",
"generator",
"=",
"new",
"UniqueNameGenerator",
"(",
"DANGEROUS_CHARACTERS",
",",
"\"$$\"",
")",
";",
"generator",
".",
"reserve",
"(",
"JsSrcUtils",
".",
"JS_LITERAL... | Returns a name generator suitable for generating local variable names. | [
"Returns",
"a",
"name",
"generator",
"suitable",
"for",
"generating",
"local",
"variable",
"names",
"."
] | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jssrc/internal/JsSrcNameGenerators.java#L34-L39 |
segmentio/analytics-android | analytics/src/main/java/com/segment/analytics/Options.java | Options.putContext | public Options putContext(String key, Object value) {
context.put(key, value);
return this;
} | java | public Options putContext(String key, Object value) {
context.put(key, value);
return this;
} | [
"public",
"Options",
"putContext",
"(",
"String",
"key",
",",
"Object",
"value",
")",
"{",
"context",
".",
"put",
"(",
"key",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | Attach some additional context information. Unlike with {@link
com.segment.analytics.Analytics#getAnalyticsContext()}, this only has effect for this call.
@param key The key of the extra context data
@param value The value of the extra context data
@return This options object for chaining | [
"Attach",
"some",
"additional",
"context",
"information",
".",
"Unlike",
"with",
"{",
"@link",
"com",
".",
"segment",
".",
"analytics",
".",
"Analytics#getAnalyticsContext",
"()",
"}",
"this",
"only",
"has",
"effect",
"for",
"this",
"call",
"."
] | train | https://github.com/segmentio/analytics-android/blob/93c7d5bb09b593440a2347a6089db3e9f74012da/analytics/src/main/java/com/segment/analytics/Options.java#L127-L130 |
VoltDB/voltdb | src/frontend/org/voltdb/export/ExportGeneration.java | ExportGeneration.onSourceDrained | @Override
public void onSourceDrained(int partitionId, String tableName) {
ExportDataSource source;
synchronized(m_dataSourcesByPartition) {
Map<String, ExportDataSource> sources = m_dataSourcesByPartition.get(partitionId);
if (sources == null) {
if (!m_removingPartitions.contains(partitionId)) {
exportLog.error("Could not find export data sources for partition "
+ partitionId + ". The export cleanup stream is being discarded.");
}
return;
}
source = sources.get(tableName);
if (source == null) {
exportLog.warn("Could not find export data source for signature " + partitionId +
" name " + tableName + ". The export cleanup stream is being discarded.");
return;
}
// Remove source and partition entry if empty
sources.remove(tableName);
if (sources.isEmpty()) {
m_dataSourcesByPartition.remove(partitionId);
removeMailbox(partitionId);
}
}
//Do closing outside the synchronized block. Do not wait on future since
// we're invoked from the source's executor thread.
exportLog.info("Drained on unused partition " + partitionId + ": " + source);
source.closeAndDelete();
} | java | @Override
public void onSourceDrained(int partitionId, String tableName) {
ExportDataSource source;
synchronized(m_dataSourcesByPartition) {
Map<String, ExportDataSource> sources = m_dataSourcesByPartition.get(partitionId);
if (sources == null) {
if (!m_removingPartitions.contains(partitionId)) {
exportLog.error("Could not find export data sources for partition "
+ partitionId + ". The export cleanup stream is being discarded.");
}
return;
}
source = sources.get(tableName);
if (source == null) {
exportLog.warn("Could not find export data source for signature " + partitionId +
" name " + tableName + ". The export cleanup stream is being discarded.");
return;
}
// Remove source and partition entry if empty
sources.remove(tableName);
if (sources.isEmpty()) {
m_dataSourcesByPartition.remove(partitionId);
removeMailbox(partitionId);
}
}
//Do closing outside the synchronized block. Do not wait on future since
// we're invoked from the source's executor thread.
exportLog.info("Drained on unused partition " + partitionId + ": " + source);
source.closeAndDelete();
} | [
"@",
"Override",
"public",
"void",
"onSourceDrained",
"(",
"int",
"partitionId",
",",
"String",
"tableName",
")",
"{",
"ExportDataSource",
"source",
";",
"synchronized",
"(",
"m_dataSourcesByPartition",
")",
"{",
"Map",
"<",
"String",
",",
"ExportDataSource",
">",... | The Export Data Source reports it is drained on an unused partition. | [
"The",
"Export",
"Data",
"Source",
"reports",
"it",
"is",
"drained",
"on",
"an",
"unused",
"partition",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/export/ExportGeneration.java#L845-L878 |
algolia/instantsearch-android | ui/src/main/java/com/algolia/instantsearch/ui/databinding/RenderingHelper.java | RenderingHelper.shouldHighlight | public boolean shouldHighlight(@NonNull View view, @NonNull String attribute) {
return highlightedAttributes.contains(new Pair<>(view.getId(), attribute));
} | java | public boolean shouldHighlight(@NonNull View view, @NonNull String attribute) {
return highlightedAttributes.contains(new Pair<>(view.getId(), attribute));
} | [
"public",
"boolean",
"shouldHighlight",
"(",
"@",
"NonNull",
"View",
"view",
",",
"@",
"NonNull",
"String",
"attribute",
")",
"{",
"return",
"highlightedAttributes",
".",
"contains",
"(",
"new",
"Pair",
"<>",
"(",
"view",
".",
"getId",
"(",
")",
",",
"attr... | Checks if an attribute should be highlighted in a view.
@param view the view using this attribute.
@param attribute the attribute's name.
@return {@code true} if the attribute was marked for highlighting. | [
"Checks",
"if",
"an",
"attribute",
"should",
"be",
"highlighted",
"in",
"a",
"view",
"."
] | train | https://github.com/algolia/instantsearch-android/blob/12092ec30140df9ffc2bf916339b433372034616/ui/src/main/java/com/algolia/instantsearch/ui/databinding/RenderingHelper.java#L86-L88 |
alibaba/canal | driver/src/main/java/com/alibaba/otter/canal/parse/driver/mysql/packets/client/ClientAuthenticationPacket.java | ClientAuthenticationPacket.toBytes | public byte[] toBytes() throws IOException {
ByteArrayOutputStream out = new ByteArrayOutputStream();
// 1. write client_flags
ByteHelper.writeUnsignedIntLittleEndian(clientCapability, out); // remove
// client_interactive
// feature
// 2. write max_packet_size
ByteHelper.writeUnsignedIntLittleEndian(MSC.MAX_PACKET_LENGTH, out);
// 3. write charset_number
out.write(this.charsetNumber);
// 4. write (filler) always 0x00...
out.write(new byte[23]);
// 5. write (Null-Terminated String) user
ByteHelper.writeNullTerminatedString(getUsername(), out);
// 6. write (Length Coded Binary) scramble_buff (1 + x bytes)
if (StringUtils.isEmpty(getPassword())) {
out.write(0x00);
} else {
try {
byte[] encryptedPassword = MySQLPasswordEncrypter.scramble411(getPassword().getBytes(), scrumbleBuff);
ByteHelper.writeBinaryCodedLengthBytes(encryptedPassword, out);
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException("can't encrypt password that will be sent to MySQL server.", e);
}
}
// 7 . (Null-Terminated String) databasename (optional)
if (getDatabaseName() != null) {
ByteHelper.writeNullTerminatedString(getDatabaseName(), out);
}
// 8 . (Null-Terminated String) auth plugin name (optional)
if (getAuthPluginName() != null) {
ByteHelper.writeNullTerminated(getAuthPluginName(), out);
}
// end write
return out.toByteArray();
} | java | public byte[] toBytes() throws IOException {
ByteArrayOutputStream out = new ByteArrayOutputStream();
// 1. write client_flags
ByteHelper.writeUnsignedIntLittleEndian(clientCapability, out); // remove
// client_interactive
// feature
// 2. write max_packet_size
ByteHelper.writeUnsignedIntLittleEndian(MSC.MAX_PACKET_LENGTH, out);
// 3. write charset_number
out.write(this.charsetNumber);
// 4. write (filler) always 0x00...
out.write(new byte[23]);
// 5. write (Null-Terminated String) user
ByteHelper.writeNullTerminatedString(getUsername(), out);
// 6. write (Length Coded Binary) scramble_buff (1 + x bytes)
if (StringUtils.isEmpty(getPassword())) {
out.write(0x00);
} else {
try {
byte[] encryptedPassword = MySQLPasswordEncrypter.scramble411(getPassword().getBytes(), scrumbleBuff);
ByteHelper.writeBinaryCodedLengthBytes(encryptedPassword, out);
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException("can't encrypt password that will be sent to MySQL server.", e);
}
}
// 7 . (Null-Terminated String) databasename (optional)
if (getDatabaseName() != null) {
ByteHelper.writeNullTerminatedString(getDatabaseName(), out);
}
// 8 . (Null-Terminated String) auth plugin name (optional)
if (getAuthPluginName() != null) {
ByteHelper.writeNullTerminated(getAuthPluginName(), out);
}
// end write
return out.toByteArray();
} | [
"public",
"byte",
"[",
"]",
"toBytes",
"(",
")",
"throws",
"IOException",
"{",
"ByteArrayOutputStream",
"out",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"// 1. write client_flags",
"ByteHelper",
".",
"writeUnsignedIntLittleEndian",
"(",
"clientCapability",
"... | <pre>
VERSION 4.1
Bytes Name
----- ----
4 client_flags
4 max_packet_size
1 charset_number
23 (filler) always 0x00...
n (Null-Terminated String) user
n (Length Coded Binary) scramble_buff (1 + x bytes)
n (Null-Terminated String) databasename (optional)
n (Null-Terminated String) auth plugin name (optional)
</pre>
@throws IOException | [
"<pre",
">",
"VERSION",
"4",
".",
"1",
"Bytes",
"Name",
"-----",
"----",
"4",
"client_flags",
"4",
"max_packet_size",
"1",
"charset_number",
"23",
"(",
"filler",
")",
"always",
"0x00",
"...",
"n",
"(",
"Null",
"-",
"Terminated",
"String",
")",
"user",
"n... | train | https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/driver/src/main/java/com/alibaba/otter/canal/parse/driver/mysql/packets/client/ClientAuthenticationPacket.java#L50-L86 |
lotaris/jee-validation | src/main/java/com/lotaris/jee/validation/preprocessing/ApiPreprocessingContext.java | ApiPreprocessingContext.withState | public <T> ApiPreprocessingContext withState(T state, Class<? extends T> stateClass) {
validationContext.addState(state, stateClass);
return this;
} | java | public <T> ApiPreprocessingContext withState(T state, Class<? extends T> stateClass) {
validationContext.addState(state, stateClass);
return this;
} | [
"public",
"<",
"T",
">",
"ApiPreprocessingContext",
"withState",
"(",
"T",
"state",
",",
"Class",
"<",
"?",
"extends",
"T",
">",
"stateClass",
")",
"{",
"validationContext",
".",
"addState",
"(",
"state",
",",
"stateClass",
")",
";",
"return",
"this",
";",... | Adds the specified state object to the validation context. It can be retrieved by passing
the identifying class to {@link #getState(java.lang.Class)}.
@param <T> the type of state
@param state the state object
@param stateClass the class identifying the state
@return this context
@throws IllegalArgumentException if a state is already registered for that class | [
"Adds",
"the",
"specified",
"state",
"object",
"to",
"the",
"validation",
"context",
".",
"It",
"can",
"be",
"retrieved",
"by",
"passing",
"the",
"identifying",
"class",
"to",
"{",
"@link",
"#getState",
"(",
"java",
".",
"lang",
".",
"Class",
")",
"}",
"... | train | https://github.com/lotaris/jee-validation/blob/feefff820b5a67c7471a13e08fdaf2d60bb3ad16/src/main/java/com/lotaris/jee/validation/preprocessing/ApiPreprocessingContext.java#L168-L171 |
dlemmermann/CalendarFX | CalendarFXView/src/main/java/com/calendarfx/model/Entry.java | Entry.locationProperty | public final StringProperty locationProperty() {
if (location == null) {
location = new SimpleStringProperty(null, "location") { //$NON-NLS-1$
@Override
public void set(String newLocation) {
String oldLocation = get();
if (!Util.equals(oldLocation, newLocation)) {
super.set(newLocation);
Calendar calendar = getCalendar();
if (calendar != null) {
calendar.fireEvent(new CalendarEvent(CalendarEvent.ENTRY_LOCATION_CHANGED, calendar, Entry.this, oldLocation));
}
}
}
};
}
return location;
} | java | public final StringProperty locationProperty() {
if (location == null) {
location = new SimpleStringProperty(null, "location") { //$NON-NLS-1$
@Override
public void set(String newLocation) {
String oldLocation = get();
if (!Util.equals(oldLocation, newLocation)) {
super.set(newLocation);
Calendar calendar = getCalendar();
if (calendar != null) {
calendar.fireEvent(new CalendarEvent(CalendarEvent.ENTRY_LOCATION_CHANGED, calendar, Entry.this, oldLocation));
}
}
}
};
}
return location;
} | [
"public",
"final",
"StringProperty",
"locationProperty",
"(",
")",
"{",
"if",
"(",
"location",
"==",
"null",
")",
"{",
"location",
"=",
"new",
"SimpleStringProperty",
"(",
"null",
",",
"\"location\"",
")",
"{",
"//$NON-NLS-1$",
"@",
"Override",
"public",
"void... | A property used to store a free-text location specification for the given
entry. This could be as simple as "New York" or a full address as in
"128 Madison Avenue, New York, USA".
@return the location of the event specified by the entry | [
"A",
"property",
"used",
"to",
"store",
"a",
"free",
"-",
"text",
"location",
"specification",
"for",
"the",
"given",
"entry",
".",
"This",
"could",
"be",
"as",
"simple",
"as",
"New",
"York",
"or",
"a",
"full",
"address",
"as",
"in",
"128",
"Madison",
... | train | https://github.com/dlemmermann/CalendarFX/blob/f2b91c2622c3f29d004485b6426b23b86c331f96/CalendarFXView/src/main/java/com/calendarfx/model/Entry.java#L1062-L1083 |
casbin/jcasbin | src/main/java/org/casbin/jcasbin/main/ManagementEnforcer.java | ManagementEnforcer.hasNamedGroupingPolicy | public boolean hasNamedGroupingPolicy(String ptype, String... params) {
return hasNamedGroupingPolicy(ptype, Arrays.asList(params));
} | java | public boolean hasNamedGroupingPolicy(String ptype, String... params) {
return hasNamedGroupingPolicy(ptype, Arrays.asList(params));
} | [
"public",
"boolean",
"hasNamedGroupingPolicy",
"(",
"String",
"ptype",
",",
"String",
"...",
"params",
")",
"{",
"return",
"hasNamedGroupingPolicy",
"(",
"ptype",
",",
"Arrays",
".",
"asList",
"(",
"params",
")",
")",
";",
"}"
] | hasNamedGroupingPolicy determines whether a named role inheritance rule exists.
@param ptype the policy type, can be "g", "g2", "g3", ..
@param params the "g" policy rule.
@return whether the rule exists. | [
"hasNamedGroupingPolicy",
"determines",
"whether",
"a",
"named",
"role",
"inheritance",
"rule",
"exists",
"."
] | train | https://github.com/casbin/jcasbin/blob/b46d7a756b6c39cdb17e0600607e5fcdc66edd11/src/main/java/org/casbin/jcasbin/main/ManagementEnforcer.java#L411-L413 |
Azure/azure-sdk-for-java | sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ManagedInstancesInner.java | ManagedInstancesInner.beginUpdate | public ManagedInstanceInner beginUpdate(String resourceGroupName, String managedInstanceName, ManagedInstanceUpdate parameters) {
return beginUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters).toBlocking().single().body();
} | java | public ManagedInstanceInner beginUpdate(String resourceGroupName, String managedInstanceName, ManagedInstanceUpdate parameters) {
return beginUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters).toBlocking().single().body();
} | [
"public",
"ManagedInstanceInner",
"beginUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"managedInstanceName",
",",
"ManagedInstanceUpdate",
"parameters",
")",
"{",
"return",
"beginUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"managedInstanceName"... | Updates a managed instance.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param managedInstanceName The name of the managed instance.
@param parameters The requested managed instance resource state.
@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 ManagedInstanceInner object if successful. | [
"Updates",
"a",
"managed",
"instance",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ManagedInstancesInner.java#L839-L841 |
cdk/cdk | misc/extra/src/main/java/org/openscience/cdk/tools/GridGenerator.java | GridGenerator.getCoordinatesFromGridPoint | public Point3d getCoordinatesFromGridPoint(int gridPoint) {
int dimCounter = 0;
Point3d point = new Point3d(0, 0, 0);
for (int z = 0; z < grid[0][0].length; z++) {
for (int y = 0; y < grid[0].length; y++) {
for (int x = 0; x < grid.length; x++) {
if (dimCounter == gridPoint) {
point.x = minx + latticeConstant * x;
point.y = miny + latticeConstant * y;
point.z = minz + latticeConstant * z;
return point;
}
dimCounter++;
}
}
}
return point;
} | java | public Point3d getCoordinatesFromGridPoint(int gridPoint) {
int dimCounter = 0;
Point3d point = new Point3d(0, 0, 0);
for (int z = 0; z < grid[0][0].length; z++) {
for (int y = 0; y < grid[0].length; y++) {
for (int x = 0; x < grid.length; x++) {
if (dimCounter == gridPoint) {
point.x = minx + latticeConstant * x;
point.y = miny + latticeConstant * y;
point.z = minz + latticeConstant * z;
return point;
}
dimCounter++;
}
}
}
return point;
} | [
"public",
"Point3d",
"getCoordinatesFromGridPoint",
"(",
"int",
"gridPoint",
")",
"{",
"int",
"dimCounter",
"=",
"0",
";",
"Point3d",
"point",
"=",
"new",
"Point3d",
"(",
"0",
",",
"0",
",",
"0",
")",
";",
"for",
"(",
"int",
"z",
"=",
"0",
";",
"z",
... | Method calculates coordinates from a given grid array position. | [
"Method",
"calculates",
"coordinates",
"from",
"a",
"given",
"grid",
"array",
"position",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/misc/extra/src/main/java/org/openscience/cdk/tools/GridGenerator.java#L200-L217 |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/MariaDbStatement.java | MariaDbStatement.executeInternal | private boolean executeInternal(String sql, int fetchSize, int autoGeneratedKeys)
throws SQLException {
lock.lock();
try {
executeQueryPrologue(false);
results = new Results(this,
fetchSize,
false,
1,
false,
resultSetScrollType,
resultSetConcurrency,
autoGeneratedKeys,
protocol.getAutoIncrementIncrement());
protocol.executeQuery(protocol.isMasterConnection(), results,
getTimeoutSql(Utils.nativeSql(sql, protocol.noBackslashEscapes())));
results.commandEnd();
return results.getResultSet() != null;
} catch (SQLException exception) {
throw executeExceptionEpilogue(exception);
} finally {
executeEpilogue();
lock.unlock();
}
} | java | private boolean executeInternal(String sql, int fetchSize, int autoGeneratedKeys)
throws SQLException {
lock.lock();
try {
executeQueryPrologue(false);
results = new Results(this,
fetchSize,
false,
1,
false,
resultSetScrollType,
resultSetConcurrency,
autoGeneratedKeys,
protocol.getAutoIncrementIncrement());
protocol.executeQuery(protocol.isMasterConnection(), results,
getTimeoutSql(Utils.nativeSql(sql, protocol.noBackslashEscapes())));
results.commandEnd();
return results.getResultSet() != null;
} catch (SQLException exception) {
throw executeExceptionEpilogue(exception);
} finally {
executeEpilogue();
lock.unlock();
}
} | [
"private",
"boolean",
"executeInternal",
"(",
"String",
"sql",
",",
"int",
"fetchSize",
",",
"int",
"autoGeneratedKeys",
")",
"throws",
"SQLException",
"{",
"lock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"executeQueryPrologue",
"(",
"false",
")",
";",
"resu... | Executes a query.
@param sql the query
@param fetchSize fetch size
@param autoGeneratedKeys a flag indicating whether auto-generated keys should be returned; one
of
<code>Statement.RETURN_GENERATED_KEYS</code>
or <code>Statement.NO_GENERATED_KEYS</code>
@return true if there was a result set, false otherwise.
@throws SQLException the error description | [
"Executes",
"a",
"query",
"."
] | train | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/MariaDbStatement.java#L304-L333 |
OpenLiberty/open-liberty | dev/com.ibm.ws.management.j2ee.mejb/src/com/ibm/ws/management/j2ee/mejb/ManagementEJB.java | ManagementEJB.getAttribute | public Object getAttribute(ObjectName name, String attribute)
throws MBeanException, AttributeNotFoundException, InstanceNotFoundException,
ReflectionException {
Object o = getMBeanServer().getAttribute(name, attribute);
return o;
} | java | public Object getAttribute(ObjectName name, String attribute)
throws MBeanException, AttributeNotFoundException, InstanceNotFoundException,
ReflectionException {
Object o = getMBeanServer().getAttribute(name, attribute);
return o;
} | [
"public",
"Object",
"getAttribute",
"(",
"ObjectName",
"name",
",",
"String",
"attribute",
")",
"throws",
"MBeanException",
",",
"AttributeNotFoundException",
",",
"InstanceNotFoundException",
",",
"ReflectionException",
"{",
"Object",
"o",
"=",
"getMBeanServer",
"(",
... | /*
Gets the value of a specific attribute of a named managed object. The
managed object is identified by its object name.
Throws:
javax.management.MBeanException
javax.management.AttributeNotFoundException
javax.management.InstanceNotFoundException
javax.management.ReflectionException
java.rmi.RemoteException
Parameters:
name - The object name of the managed object from which the attribute
is to be retrieved.
attribute - A String specifying the name of the attribute to be
retrieved.
Returns:
The value of the retrieved attribute. | [
"/",
"*",
"Gets",
"the",
"value",
"of",
"a",
"specific",
"attribute",
"of",
"a",
"named",
"managed",
"object",
".",
"The",
"managed",
"object",
"is",
"identified",
"by",
"its",
"object",
"name",
".",
"Throws",
":",
"javax",
".",
"management",
".",
"MBean... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.management.j2ee.mejb/src/com/ibm/ws/management/j2ee/mejb/ManagementEJB.java#L171-L178 |
drinkjava2/jDialects | core/src/main/java/com/github/drinkjava2/jdialects/springsrc/utils/ReflectionUtils.java | ReflectionUtils.shallowCopyFieldState | public static void shallowCopyFieldState(final Object src, final Object dest) {
if (src == null) {
throw new IllegalArgumentException("Source for field copy cannot be null");
}
if (dest == null) {
throw new IllegalArgumentException("Destination for field copy cannot be null");
}
if (!src.getClass().isAssignableFrom(dest.getClass())) {
throw new IllegalArgumentException("Destination class [" + dest.getClass().getName() +
"] must be same or subclass as source class [" + src.getClass().getName() + "]");
}
doWithFields(src.getClass(), new FieldCallback() {
@Override
public void doWith(Field field) throws IllegalArgumentException, IllegalAccessException {
makeAccessible(field);
Object srcValue = field.get(src);
field.set(dest, srcValue);
}
}, COPYABLE_FIELDS);
} | java | public static void shallowCopyFieldState(final Object src, final Object dest) {
if (src == null) {
throw new IllegalArgumentException("Source for field copy cannot be null");
}
if (dest == null) {
throw new IllegalArgumentException("Destination for field copy cannot be null");
}
if (!src.getClass().isAssignableFrom(dest.getClass())) {
throw new IllegalArgumentException("Destination class [" + dest.getClass().getName() +
"] must be same or subclass as source class [" + src.getClass().getName() + "]");
}
doWithFields(src.getClass(), new FieldCallback() {
@Override
public void doWith(Field field) throws IllegalArgumentException, IllegalAccessException {
makeAccessible(field);
Object srcValue = field.get(src);
field.set(dest, srcValue);
}
}, COPYABLE_FIELDS);
} | [
"public",
"static",
"void",
"shallowCopyFieldState",
"(",
"final",
"Object",
"src",
",",
"final",
"Object",
"dest",
")",
"{",
"if",
"(",
"src",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Source for field copy cannot be null\"",
")"... | Given the source object and the destination, which must be the same class
or a subclass, copy all fields, including inherited fields. Designed to
work on objects with public no-arg constructors. | [
"Given",
"the",
"source",
"object",
"and",
"the",
"destination",
"which",
"must",
"be",
"the",
"same",
"class",
"or",
"a",
"subclass",
"copy",
"all",
"fields",
"including",
"inherited",
"fields",
".",
"Designed",
"to",
"work",
"on",
"objects",
"with",
"publi... | train | https://github.com/drinkjava2/jDialects/blob/1c165f09c6042a599b681c279024abcc1b848b88/core/src/main/java/com/github/drinkjava2/jdialects/springsrc/utils/ReflectionUtils.java#L727-L746 |
alkacon/opencms-core | src-gwt/org/opencms/ade/containerpage/client/CmsContainerpageController.java | CmsContainerpageController.loadContextMenu | public void loadContextMenu(final CmsUUID structureId, final AdeContext context) {
/** The RPC menu action for the container page dialog. */
CmsRpcAction<List<CmsContextMenuEntryBean>> menuAction = new CmsRpcAction<List<CmsContextMenuEntryBean>>() {
/**
* @see org.opencms.gwt.client.rpc.CmsRpcAction#execute()
*/
@Override
public void execute() {
getCoreService().getContextMenuEntries(structureId, context, this);
}
/**
* @see org.opencms.gwt.client.rpc.CmsRpcAction#onResponse(java.lang.Object)
*/
@Override
public void onResponse(List<CmsContextMenuEntryBean> menuBeans) {
m_handler.insertContextMenu(menuBeans, structureId);
}
};
menuAction.execute();
} | java | public void loadContextMenu(final CmsUUID structureId, final AdeContext context) {
/** The RPC menu action for the container page dialog. */
CmsRpcAction<List<CmsContextMenuEntryBean>> menuAction = new CmsRpcAction<List<CmsContextMenuEntryBean>>() {
/**
* @see org.opencms.gwt.client.rpc.CmsRpcAction#execute()
*/
@Override
public void execute() {
getCoreService().getContextMenuEntries(structureId, context, this);
}
/**
* @see org.opencms.gwt.client.rpc.CmsRpcAction#onResponse(java.lang.Object)
*/
@Override
public void onResponse(List<CmsContextMenuEntryBean> menuBeans) {
m_handler.insertContextMenu(menuBeans, structureId);
}
};
menuAction.execute();
} | [
"public",
"void",
"loadContextMenu",
"(",
"final",
"CmsUUID",
"structureId",
",",
"final",
"AdeContext",
"context",
")",
"{",
"/** The RPC menu action for the container page dialog. */",
"CmsRpcAction",
"<",
"List",
"<",
"CmsContextMenuEntryBean",
">>",
"menuAction",
"=",
... | Loads the context menu entries.<p>
@param structureId the structure id of the resource to get the context menu entries for
@param context the ade context (sitemap or containerpae) | [
"Loads",
"the",
"context",
"menu",
"entries",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/containerpage/client/CmsContainerpageController.java#L2237-L2262 |
dain/leveldb | leveldb/src/main/java/org/iq80/leveldb/impl/VersionEdit.java | VersionEdit.addFile | public void addFile(int level, long fileNumber,
long fileSize,
InternalKey smallest,
InternalKey largest)
{
FileMetaData fileMetaData = new FileMetaData(fileNumber, fileSize, smallest, largest);
addFile(level, fileMetaData);
} | java | public void addFile(int level, long fileNumber,
long fileSize,
InternalKey smallest,
InternalKey largest)
{
FileMetaData fileMetaData = new FileMetaData(fileNumber, fileSize, smallest, largest);
addFile(level, fileMetaData);
} | [
"public",
"void",
"addFile",
"(",
"int",
"level",
",",
"long",
"fileNumber",
",",
"long",
"fileSize",
",",
"InternalKey",
"smallest",
",",
"InternalKey",
"largest",
")",
"{",
"FileMetaData",
"fileMetaData",
"=",
"new",
"FileMetaData",
"(",
"fileNumber",
",",
"... | REQUIRES: "smallest" and "largest" are smallest and largest keys in file | [
"REQUIRES",
":",
"smallest",
"and",
"largest",
"are",
"smallest",
"and",
"largest",
"keys",
"in",
"file"
] | train | https://github.com/dain/leveldb/blob/7994065b48eada2ef29e7fefd172c2ad1e0110eb/leveldb/src/main/java/org/iq80/leveldb/impl/VersionEdit.java#L130-L137 |
structr/structr | structr-core/src/main/java/org/structr/core/graph/SyncCommand.java | SyncCommand.serializeData | public static void serializeData(DataOutputStream outputStream, byte[] data) throws IOException {
outputStream.writeInt(data.length);
outputStream.write(data);
outputStream.flush();
} | java | public static void serializeData(DataOutputStream outputStream, byte[] data) throws IOException {
outputStream.writeInt(data.length);
outputStream.write(data);
outputStream.flush();
} | [
"public",
"static",
"void",
"serializeData",
"(",
"DataOutputStream",
"outputStream",
",",
"byte",
"[",
"]",
"data",
")",
"throws",
"IOException",
"{",
"outputStream",
".",
"writeInt",
"(",
"data",
".",
"length",
")",
";",
"outputStream",
".",
"write",
"(",
... | Serializes the given object into the given writer. The following format will
be used to serialize objects. The first two characters are the type index, see
typeMap above. After that, a single digit that indicates the length of the following
length field follows. After that, the length field is serialized, followed by the
string value of the given object and a space character for human readability.
@param outputStream
@param obj | [
"Serializes",
"the",
"given",
"object",
"into",
"the",
"given",
"writer",
".",
"The",
"following",
"format",
"will",
"be",
"used",
"to",
"serialize",
"objects",
".",
"The",
"first",
"two",
"characters",
"are",
"the",
"type",
"index",
"see",
"typeMap",
"above... | train | https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-core/src/main/java/org/structr/core/graph/SyncCommand.java#L359-L365 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/tools/javac/util/AbstractLog.java | AbstractLog.note | public void note(JavaFileObject file, String key, Object ... args) {
note(file, diags.noteKey(key, args));
} | java | public void note(JavaFileObject file, String key, Object ... args) {
note(file, diags.noteKey(key, args));
} | [
"public",
"void",
"note",
"(",
"JavaFileObject",
"file",
",",
"String",
"key",
",",
"Object",
"...",
"args",
")",
"{",
"note",
"(",
"file",
",",
"diags",
".",
"noteKey",
"(",
"key",
",",
"args",
")",
")",
";",
"}"
] | Provide a non-fatal notification, unless suppressed by the -nowarn option.
@param key The key for the localized notification message.
@param args Fields of the notification message. | [
"Provide",
"a",
"non",
"-",
"fatal",
"notification",
"unless",
"suppressed",
"by",
"the",
"-",
"nowarn",
"option",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/util/AbstractLog.java#L370-L372 |
kaichunlin/android-transition | core/src/main/java/com/kaichunlin/transition/internal/TransitionControllerManager.java | TransitionControllerManager.addAnimatorAsTransition | public TransitionController addAnimatorAsTransition(@NonNull Animator mAnim) {
AnimatorSet as = new AnimatorSet();
as.play(mAnim);
return addAnimatorSetAsTransition(null, as);
} | java | public TransitionController addAnimatorAsTransition(@NonNull Animator mAnim) {
AnimatorSet as = new AnimatorSet();
as.play(mAnim);
return addAnimatorSetAsTransition(null, as);
} | [
"public",
"TransitionController",
"addAnimatorAsTransition",
"(",
"@",
"NonNull",
"Animator",
"mAnim",
")",
"{",
"AnimatorSet",
"as",
"=",
"new",
"AnimatorSet",
"(",
")",
";",
"as",
".",
"play",
"(",
"mAnim",
")",
";",
"return",
"addAnimatorSetAsTransition",
"("... | Adds an Animator as {@link TransitionController}
@param mAnim
@return | [
"Adds",
"an",
"Animator",
"as",
"{",
"@link",
"TransitionController",
"}"
] | train | https://github.com/kaichunlin/android-transition/blob/7b53074206622f5cf5d82091d891a7ed8b9f06cd/core/src/main/java/com/kaichunlin/transition/internal/TransitionControllerManager.java#L40-L44 |
Impetus/Kundera | src/jpa-engine/core/src/main/java/com/impetus/kundera/validation/rules/AttributeConstraintRule.java | AttributeConstraintRule.validateMinValue | private boolean validateMinValue(Object validationObject, Annotation annotate)
{
if (checkNullObject(validationObject))
{
return true;
}
Long minValue = ((Min) annotate).value();
if (checkvalidDigitTypes(validationObject.getClass()))
{
if ((NumberUtils.toLong(toString(validationObject))) < minValue)
{
throwValidationException(((Min) annotate).message());
}
}
return true;
} | java | private boolean validateMinValue(Object validationObject, Annotation annotate)
{
if (checkNullObject(validationObject))
{
return true;
}
Long minValue = ((Min) annotate).value();
if (checkvalidDigitTypes(validationObject.getClass()))
{
if ((NumberUtils.toLong(toString(validationObject))) < minValue)
{
throwValidationException(((Min) annotate).message());
}
}
return true;
} | [
"private",
"boolean",
"validateMinValue",
"(",
"Object",
"validationObject",
",",
"Annotation",
"annotate",
")",
"{",
"if",
"(",
"checkNullObject",
"(",
"validationObject",
")",
")",
"{",
"return",
"true",
";",
"}",
"Long",
"minValue",
"=",
"(",
"(",
"Min",
... | Checks whether a given value is greater than given min value or not
@param validationObject
@param annotate
@return | [
"Checks",
"whether",
"a",
"given",
"value",
"is",
"greater",
"than",
"given",
"min",
"value",
"or",
"not"
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/validation/rules/AttributeConstraintRule.java#L401-L419 |
couchbase/couchbase-lite-java | src/main/java/com/couchbase/lite/MutableArray.java | MutableArray.setValue | @NonNull
@Override
public MutableArray setValue(int index, Object value) {
synchronized (lock) {
if (Fleece.valueWouldChange(value, internalArray.get(index), internalArray)
&& (!internalArray.set(index, Fleece.toCBLObject(value)))) {
throwRangeException(index);
}
return this;
}
} | java | @NonNull
@Override
public MutableArray setValue(int index, Object value) {
synchronized (lock) {
if (Fleece.valueWouldChange(value, internalArray.get(index), internalArray)
&& (!internalArray.set(index, Fleece.toCBLObject(value)))) {
throwRangeException(index);
}
return this;
}
} | [
"@",
"NonNull",
"@",
"Override",
"public",
"MutableArray",
"setValue",
"(",
"int",
"index",
",",
"Object",
"value",
")",
"{",
"synchronized",
"(",
"lock",
")",
"{",
"if",
"(",
"Fleece",
".",
"valueWouldChange",
"(",
"value",
",",
"internalArray",
".",
"get... | Set an object at the given index.
@param index the index. This value must not exceed the bounds of the array.
@param value the object
@return The self object | [
"Set",
"an",
"object",
"at",
"the",
"given",
"index",
"."
] | train | https://github.com/couchbase/couchbase-lite-java/blob/cb72c44186456e6191a9ad0a7feb310011d0b081/src/main/java/com/couchbase/lite/MutableArray.java#L98-L108 |
BotMill/fb-botmill | src/main/java/co/aurasphere/botmill/fb/api/UploadApi.java | UploadApi.uploadAttachment | public static UploadAttachmentResponse uploadAttachment(
AttachmentType attachmentType, String attachmentUrl) {
AttachmentPayload payload = new AttachmentPayload(attachmentUrl, true);
Attachment attachment = new Attachment(attachmentType, payload);
AttachmentMessage message = new AttachmentMessage(attachment);
FbBotMillMessageResponse toSend = new FbBotMillMessageResponse(null, message);
return FbBotMillNetworkController.postUploadAttachment(toSend);
} | java | public static UploadAttachmentResponse uploadAttachment(
AttachmentType attachmentType, String attachmentUrl) {
AttachmentPayload payload = new AttachmentPayload(attachmentUrl, true);
Attachment attachment = new Attachment(attachmentType, payload);
AttachmentMessage message = new AttachmentMessage(attachment);
FbBotMillMessageResponse toSend = new FbBotMillMessageResponse(null, message);
return FbBotMillNetworkController.postUploadAttachment(toSend);
} | [
"public",
"static",
"UploadAttachmentResponse",
"uploadAttachment",
"(",
"AttachmentType",
"attachmentType",
",",
"String",
"attachmentUrl",
")",
"{",
"AttachmentPayload",
"payload",
"=",
"new",
"AttachmentPayload",
"(",
"attachmentUrl",
",",
"true",
")",
";",
"Attachme... | Method to upload an attachment to Facebook's server in order to use it
later. Requires the pages_messaging permission.
@param attachmentType
the type of attachment to upload to Facebook. Please notice
that currently Facebook supports only image, audio, video and
file attachments.
@param attachmentUrl
the URL of the attachment to upload to Facebook.
@return nonexpiring ID for the attachment. | [
"Method",
"to",
"upload",
"an",
"attachment",
"to",
"Facebook",
"s",
"server",
"in",
"order",
"to",
"use",
"it",
"later",
".",
"Requires",
"the",
"pages_messaging",
"permission",
"."
] | train | https://github.com/BotMill/fb-botmill/blob/d94da3615a7339822c137ef75c92a03d791ee969/src/main/java/co/aurasphere/botmill/fb/api/UploadApi.java#L61-L68 |
lucee/Lucee | core/src/main/java/lucee/runtime/ComponentImpl.java | ComponentImpl._set | private Object _set(PageContext pc, Collection.Key key, Object value) throws ExpressionException {
if (value instanceof Member) {
Member m = (Member) value;
if (m instanceof UDFPlus) {
UDFPlus udf = (UDFPlus) m;
if (udf.getAccess() > Component.ACCESS_PUBLIC) udf.setAccess(Component.ACCESS_PUBLIC);
_data.put(key, udf);
_udfs.put(key, udf);
hasInjectedFunctions = true;
}
else _data.put(key, m);
}
else {
Member existing = _data.get(key);
if (loaded && !isAccessible(pc, existing != null ? existing.getAccess() : dataMemberDefaultAccess))
throw new ExpressionException("Component [" + getCallName() + "] has no accessible Member with name [" + key + "]",
"enable [trigger data member] in administrator to also invoke getters and setters");
_data.put(key,
new DataMember(existing != null ? existing.getAccess() : dataMemberDefaultAccess, existing != null ? existing.getModifier() : Member.MODIFIER_NONE, value));
}
return value;
} | java | private Object _set(PageContext pc, Collection.Key key, Object value) throws ExpressionException {
if (value instanceof Member) {
Member m = (Member) value;
if (m instanceof UDFPlus) {
UDFPlus udf = (UDFPlus) m;
if (udf.getAccess() > Component.ACCESS_PUBLIC) udf.setAccess(Component.ACCESS_PUBLIC);
_data.put(key, udf);
_udfs.put(key, udf);
hasInjectedFunctions = true;
}
else _data.put(key, m);
}
else {
Member existing = _data.get(key);
if (loaded && !isAccessible(pc, existing != null ? existing.getAccess() : dataMemberDefaultAccess))
throw new ExpressionException("Component [" + getCallName() + "] has no accessible Member with name [" + key + "]",
"enable [trigger data member] in administrator to also invoke getters and setters");
_data.put(key,
new DataMember(existing != null ? existing.getAccess() : dataMemberDefaultAccess, existing != null ? existing.getModifier() : Member.MODIFIER_NONE, value));
}
return value;
} | [
"private",
"Object",
"_set",
"(",
"PageContext",
"pc",
",",
"Collection",
".",
"Key",
"key",
",",
"Object",
"value",
")",
"throws",
"ExpressionException",
"{",
"if",
"(",
"value",
"instanceof",
"Member",
")",
"{",
"Member",
"m",
"=",
"(",
"Member",
")",
... | sets a value to the current Component, dont to base Component
@param key
@param value
@return value set
@throws ExpressionException | [
"sets",
"a",
"value",
"to",
"the",
"current",
"Component",
"dont",
"to",
"base",
"Component"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/ComponentImpl.java#L1634-L1655 |
mike10004/common-helper | imnetio-helper/src/main/java/com/github/mike10004/common/io/ByteSources.java | ByteSources.concatOpenable | public static ByteSource concatOpenable(ByteSource first, ByteSource...others) {
return concatOpenable(Lists.asList(first, others));
} | java | public static ByteSource concatOpenable(ByteSource first, ByteSource...others) {
return concatOpenable(Lists.asList(first, others));
} | [
"public",
"static",
"ByteSource",
"concatOpenable",
"(",
"ByteSource",
"first",
",",
"ByteSource",
"...",
"others",
")",
"{",
"return",
"concatOpenable",
"(",
"Lists",
".",
"asList",
"(",
"first",
",",
"others",
")",
")",
";",
"}"
] | Concatenates multiple byte sources, skipping sources for which
opening an input stream fails.
@param first the first byte source
@param others other byte sources
@return the concatenated source | [
"Concatenates",
"multiple",
"byte",
"sources",
"skipping",
"sources",
"for",
"which",
"opening",
"an",
"input",
"stream",
"fails",
"."
] | train | https://github.com/mike10004/common-helper/blob/744f82d9b0768a9ad9c63a57a37ab2c93bf408f4/imnetio-helper/src/main/java/com/github/mike10004/common/io/ByteSources.java#L30-L32 |
geomajas/geomajas-project-server | impl/src/main/java/org/geomajas/internal/service/CommandDispatcherImpl.java | CommandDispatcherImpl.getErrorMessage | private String getErrorMessage(final Throwable throwable, final Locale locale) {
String message;
if (!(throwable instanceof GeomajasException)) {
message = throwable.getMessage();
} else {
message = ((GeomajasException) throwable).getMessage(locale);
}
if (null == message || 0 == message.length()) {
message = throwable.getClass().getName();
}
return message;
} | java | private String getErrorMessage(final Throwable throwable, final Locale locale) {
String message;
if (!(throwable instanceof GeomajasException)) {
message = throwable.getMessage();
} else {
message = ((GeomajasException) throwable).getMessage(locale);
}
if (null == message || 0 == message.length()) {
message = throwable.getClass().getName();
}
return message;
} | [
"private",
"String",
"getErrorMessage",
"(",
"final",
"Throwable",
"throwable",
",",
"final",
"Locale",
"locale",
")",
"{",
"String",
"message",
";",
"if",
"(",
"!",
"(",
"throwable",
"instanceof",
"GeomajasException",
")",
")",
"{",
"message",
"=",
"throwable... | Get localized error message for a {@link Throwable}.
@param throwable throwable to get message for
@param locale locale to use for message
@return exception message | [
"Get",
"localized",
"error",
"message",
"for",
"a",
"{",
"@link",
"Throwable",
"}",
"."
] | train | https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/impl/src/main/java/org/geomajas/internal/service/CommandDispatcherImpl.java#L208-L219 |
looly/hutool | hutool-poi/src/main/java/cn/hutool/poi/word/Word07Writer.java | Word07Writer.flush | public Word07Writer flush(OutputStream out, boolean isCloseOut) throws IORuntimeException {
Assert.isFalse(this.isClosed, "WordWriter has been closed!");
try {
this.doc.write(out);
out.flush();
} catch (IOException e) {
throw new IORuntimeException(e);
} finally {
if (isCloseOut) {
IoUtil.close(out);
}
}
return this;
} | java | public Word07Writer flush(OutputStream out, boolean isCloseOut) throws IORuntimeException {
Assert.isFalse(this.isClosed, "WordWriter has been closed!");
try {
this.doc.write(out);
out.flush();
} catch (IOException e) {
throw new IORuntimeException(e);
} finally {
if (isCloseOut) {
IoUtil.close(out);
}
}
return this;
} | [
"public",
"Word07Writer",
"flush",
"(",
"OutputStream",
"out",
",",
"boolean",
"isCloseOut",
")",
"throws",
"IORuntimeException",
"{",
"Assert",
".",
"isFalse",
"(",
"this",
".",
"isClosed",
",",
"\"WordWriter has been closed!\"",
")",
";",
"try",
"{",
"this",
"... | 将Word Document刷出到输出流
@param out 输出流
@param isCloseOut 是否关闭输出流
@return this
@throws IORuntimeException IO异常 | [
"将Word",
"Document刷出到输出流"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/word/Word07Writer.java#L174-L187 |
derari/cthul | strings/src/main/java/org/cthul/strings/format/conversion/FormatConversionBase.java | FormatConversionBase.justifyRight | protected static String justifyRight(CharSequence csq, char pad, int width) {
try {
StringBuilder sb = new StringBuilder(width);
justifyRight(sb, csq, pad, width);
return sb.toString();
} catch (IOException e) {
throw new AssertionError("StringBuilder failed", e);
}
} | java | protected static String justifyRight(CharSequence csq, char pad, int width) {
try {
StringBuilder sb = new StringBuilder(width);
justifyRight(sb, csq, pad, width);
return sb.toString();
} catch (IOException e) {
throw new AssertionError("StringBuilder failed", e);
}
} | [
"protected",
"static",
"String",
"justifyRight",
"(",
"CharSequence",
"csq",
",",
"char",
"pad",
",",
"int",
"width",
")",
"{",
"try",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
"width",
")",
";",
"justifyRight",
"(",
"sb",
",",
"csq",
... | Right-justifies {@code csq}.
@param csq
@param pad padding character
@param width minimum of characters that will be written
@return justified string | [
"Right",
"-",
"justifies",
"{"
] | train | https://github.com/derari/cthul/blob/74a31e3cb6a94f5f25cc5253d1dbd42e19a17ebc/strings/src/main/java/org/cthul/strings/format/conversion/FormatConversionBase.java#L66-L74 |
UrielCh/ovh-java-sdk | ovh-java-sdk-xdsl/src/main/java/net/minidev/ovh/api/ApiOvhXdsl.java | ApiOvhXdsl.serviceName_modem_wifi_wifiName_PUT | public void serviceName_modem_wifi_wifiName_PUT(String serviceName, String wifiName, OvhWLAN body) throws IOException {
String qPath = "/xdsl/{serviceName}/modem/wifi/{wifiName}";
StringBuilder sb = path(qPath, serviceName, wifiName);
exec(qPath, "PUT", sb.toString(), body);
} | java | public void serviceName_modem_wifi_wifiName_PUT(String serviceName, String wifiName, OvhWLAN body) throws IOException {
String qPath = "/xdsl/{serviceName}/modem/wifi/{wifiName}";
StringBuilder sb = path(qPath, serviceName, wifiName);
exec(qPath, "PUT", sb.toString(), body);
} | [
"public",
"void",
"serviceName_modem_wifi_wifiName_PUT",
"(",
"String",
"serviceName",
",",
"String",
"wifiName",
",",
"OvhWLAN",
"body",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/xdsl/{serviceName}/modem/wifi/{wifiName}\"",
";",
"StringBuilder",
"sb"... | Alter this object properties
REST: PUT /xdsl/{serviceName}/modem/wifi/{wifiName}
@param body [required] New object properties
@param serviceName [required] The internal name of your XDSL offer
@param wifiName [required] Name of the Wifi | [
"Alter",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-xdsl/src/main/java/net/minidev/ovh/api/ApiOvhXdsl.java#L1176-L1180 |
UrielCh/ovh-java-sdk | ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java | ApiOvhEmailexchange.organizationName_service_exchangeService_license_GET | public ArrayList<OvhDailyLicense> organizationName_service_exchangeService_license_GET(String organizationName, String exchangeService, Date fromDate, OvhOvhLicenceEnum license, Date toDate) throws IOException {
String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/license";
StringBuilder sb = path(qPath, organizationName, exchangeService);
query(sb, "fromDate", fromDate);
query(sb, "license", license);
query(sb, "toDate", toDate);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t5);
} | java | public ArrayList<OvhDailyLicense> organizationName_service_exchangeService_license_GET(String organizationName, String exchangeService, Date fromDate, OvhOvhLicenceEnum license, Date toDate) throws IOException {
String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/license";
StringBuilder sb = path(qPath, organizationName, exchangeService);
query(sb, "fromDate", fromDate);
query(sb, "license", license);
query(sb, "toDate", toDate);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t5);
} | [
"public",
"ArrayList",
"<",
"OvhDailyLicense",
">",
"organizationName_service_exchangeService_license_GET",
"(",
"String",
"organizationName",
",",
"String",
"exchangeService",
",",
"Date",
"fromDate",
",",
"OvhOvhLicenceEnum",
"license",
",",
"Date",
"toDate",
")",
"thro... | Get active licenses for specific period of time
REST: GET /email/exchange/{organizationName}/service/{exchangeService}/license
@param license [required] License type
@param fromDate [required] Get active licenses since date
@param toDate [required] Get active licenses until date
@param organizationName [required] The internal name of your exchange organization
@param exchangeService [required] The internal name of your exchange service | [
"Get",
"active",
"licenses",
"for",
"specific",
"period",
"of",
"time"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java#L2572-L2580 |
Azure/azure-sdk-for-java | kusto/resource-manager/v2018_09_07_preview/src/main/java/com/microsoft/azure/management/kusto/v2018_09_07_preview/implementation/DatabasesInner.java | DatabasesInner.beginCreateOrUpdateAsync | public Observable<DatabaseInner> beginCreateOrUpdateAsync(String resourceGroupName, String clusterName, String databaseName, DatabaseInner parameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, clusterName, databaseName, parameters).map(new Func1<ServiceResponse<DatabaseInner>, DatabaseInner>() {
@Override
public DatabaseInner call(ServiceResponse<DatabaseInner> response) {
return response.body();
}
});
} | java | public Observable<DatabaseInner> beginCreateOrUpdateAsync(String resourceGroupName, String clusterName, String databaseName, DatabaseInner parameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, clusterName, databaseName, parameters).map(new Func1<ServiceResponse<DatabaseInner>, DatabaseInner>() {
@Override
public DatabaseInner call(ServiceResponse<DatabaseInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"DatabaseInner",
">",
"beginCreateOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"clusterName",
",",
"String",
"databaseName",
",",
"DatabaseInner",
"parameters",
")",
"{",
"return",
"beginCreateOrUpdateWithServiceResponseAsy... | Creates or updates a database.
@param resourceGroupName The name of the resource group containing the Kusto cluster.
@param clusterName The name of the Kusto cluster.
@param databaseName The name of the database in the Kusto cluster.
@param parameters The database parameters supplied to the CreateOrUpdate operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the DatabaseInner object | [
"Creates",
"or",
"updates",
"a",
"database",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/kusto/resource-manager/v2018_09_07_preview/src/main/java/com/microsoft/azure/management/kusto/v2018_09_07_preview/implementation/DatabasesInner.java#L518-L525 |
jeremybrooks/jinx | src/main/java/net/jeremybrooks/jinx/api/TagsApi.java | TagsApi.getListUserPopular | public TagsForUser getListUserPopular(String userId, Integer count) throws JinxException {
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.tags.getListUserPopular");
if (!JinxUtils.isNullOrEmpty(userId)) {
params.put("user_id", userId);
}
if (count != null) {
params.put("count", count.toString());
}
return jinx.flickrGet(params, TagsForUser.class);
} | java | public TagsForUser getListUserPopular(String userId, Integer count) throws JinxException {
Map<String, String> params = new TreeMap<>();
params.put("method", "flickr.tags.getListUserPopular");
if (!JinxUtils.isNullOrEmpty(userId)) {
params.put("user_id", userId);
}
if (count != null) {
params.put("count", count.toString());
}
return jinx.flickrGet(params, TagsForUser.class);
} | [
"public",
"TagsForUser",
"getListUserPopular",
"(",
"String",
"userId",
",",
"Integer",
"count",
")",
"throws",
"JinxException",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"params",
"=",
"new",
"TreeMap",
"<>",
"(",
")",
";",
"params",
".",
"put",
"(",... | Get the popular tags for a given user (or the currently logged in user).
This method does not require authentication.
@param userId NSID of the user to fetch the tag list for. If this argument is not
specified, the currently logged in user (if any) is assumed. Optional.
@param count number of popular tags to return. defaults to 10 when this argument is not present. Optional.
@return popular tags for the given user.
@throws JinxException if there are any errors.
@see <a href="https://www.flickr.com/services/api/flickr.tags.getListUserPopular.html">flickr.tags.getListUserPopular</a> | [
"Get",
"the",
"popular",
"tags",
"for",
"a",
"given",
"user",
"(",
"or",
"the",
"currently",
"logged",
"in",
"user",
")",
"."
] | train | https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/api/TagsApi.java#L188-L198 |
Wolfgang-Schuetzelhofer/jcypher | src/main/java/iot/jcypher/query/values/JcCollection.java | JcCollection.head | @SuppressWarnings("unchecked")
public T head() {
T ret;
if (JcRelation.class.equals(type)) {
ret = (T) new JcRelation(null, this,
new FunctionInstance(FUNCTION.Collection.HEAD, 1));
} else if (JcNode.class.equals(type)) {
ret = (T) new JcNode(null, this,
new FunctionInstance(FUNCTION.Collection.HEAD, 1));
} else {
ret = (T) new JcValue(null, this,
new FunctionInstance(FUNCTION.Collection.HEAD, 1));
}
QueryRecorder.recordInvocationConditional(this, "head", ret);
return ret;
} | java | @SuppressWarnings("unchecked")
public T head() {
T ret;
if (JcRelation.class.equals(type)) {
ret = (T) new JcRelation(null, this,
new FunctionInstance(FUNCTION.Collection.HEAD, 1));
} else if (JcNode.class.equals(type)) {
ret = (T) new JcNode(null, this,
new FunctionInstance(FUNCTION.Collection.HEAD, 1));
} else {
ret = (T) new JcValue(null, this,
new FunctionInstance(FUNCTION.Collection.HEAD, 1));
}
QueryRecorder.recordInvocationConditional(this, "head", ret);
return ret;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"T",
"head",
"(",
")",
"{",
"T",
"ret",
";",
"if",
"(",
"JcRelation",
".",
"class",
".",
"equals",
"(",
"type",
")",
")",
"{",
"ret",
"=",
"(",
"T",
")",
"new",
"JcRelation",
"(",
"null"... | <div color='red' style="font-size:24px;color:red"><b><i><u>JCYPHER</u></i></b></div>
<div color='red' style="font-size:18px;color:red"><i>return the first element of a collection</i></div>
<br/> | [
"<div",
"color",
"=",
"red",
"style",
"=",
"font",
"-",
"size",
":",
"24px",
";",
"color",
":",
"red",
">",
"<b",
">",
"<i",
">",
"<u",
">",
"JCYPHER<",
"/",
"u",
">",
"<",
"/",
"i",
">",
"<",
"/",
"b",
">",
"<",
"/",
"div",
">",
"<div",
... | train | https://github.com/Wolfgang-Schuetzelhofer/jcypher/blob/0f36914b4d6993a004cc235bb18dd3e02a59d253/src/main/java/iot/jcypher/query/values/JcCollection.java#L152-L167 |
virgo47/javasimon | console-embed/src/main/java/org/javasimon/console/SimonCallbacks.java | SimonCallbacks.getCallbackByType | private static <T extends Callback> T getCallbackByType(Iterable<Callback> callbacks, Class<T> callbackType) {
T foundCallback = null;
Iterator<Callback> callbackIterator = callbacks.iterator();
while (foundCallback == null && callbackIterator.hasNext()) {
Callback callback = callbackIterator.next();
// Remove callback wrappers
while ((callback instanceof Delegating) && (!callbackType.isInstance(callback))) {
callback = ((Delegating<Callback>) callback).getDelegate();
}
if (callbackType.isInstance(callback)) {
// Callback found
foundCallback = callbackType.cast(callback);
} else if (callback instanceof CompositeCallback) {
// Visit the composite callback
foundCallback = getCallbackByType(((CompositeCallback) callback).callbacks(), callbackType);
}
}
return foundCallback;
} | java | private static <T extends Callback> T getCallbackByType(Iterable<Callback> callbacks, Class<T> callbackType) {
T foundCallback = null;
Iterator<Callback> callbackIterator = callbacks.iterator();
while (foundCallback == null && callbackIterator.hasNext()) {
Callback callback = callbackIterator.next();
// Remove callback wrappers
while ((callback instanceof Delegating) && (!callbackType.isInstance(callback))) {
callback = ((Delegating<Callback>) callback).getDelegate();
}
if (callbackType.isInstance(callback)) {
// Callback found
foundCallback = callbackType.cast(callback);
} else if (callback instanceof CompositeCallback) {
// Visit the composite callback
foundCallback = getCallbackByType(((CompositeCallback) callback).callbacks(), callbackType);
}
}
return foundCallback;
} | [
"private",
"static",
"<",
"T",
"extends",
"Callback",
">",
"T",
"getCallbackByType",
"(",
"Iterable",
"<",
"Callback",
">",
"callbacks",
",",
"Class",
"<",
"T",
">",
"callbackType",
")",
"{",
"T",
"foundCallback",
"=",
"null",
";",
"Iterator",
"<",
"Callba... | Search callback by type in list of callbacks
@param callbacks List of callback
@param callbackType Callback type
@return Callback matching type | [
"Search",
"callback",
"by",
"type",
"in",
"list",
"of",
"callbacks"
] | train | https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/console-embed/src/main/java/org/javasimon/console/SimonCallbacks.java#L35-L53 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/collection/ArrayHelper.java | ArrayHelper.getAllExcept | @Nullable
@ReturnsMutableCopy
@SafeVarargs
public static <ELEMENTTYPE> ELEMENTTYPE [] getAllExcept (@Nullable final ELEMENTTYPE [] aArray,
@Nullable final ELEMENTTYPE... aElementsToRemove)
{
if (isEmpty (aArray) || isEmpty (aElementsToRemove))
return aArray;
final ELEMENTTYPE [] tmp = getCopy (aArray);
int nDst = 0;
for (int nSrc = 0; nSrc < tmp.length; ++nSrc)
if (!contains (aElementsToRemove, tmp[nSrc]))
tmp[nDst++] = tmp[nSrc];
return getCopy (tmp, 0, nDst);
} | java | @Nullable
@ReturnsMutableCopy
@SafeVarargs
public static <ELEMENTTYPE> ELEMENTTYPE [] getAllExcept (@Nullable final ELEMENTTYPE [] aArray,
@Nullable final ELEMENTTYPE... aElementsToRemove)
{
if (isEmpty (aArray) || isEmpty (aElementsToRemove))
return aArray;
final ELEMENTTYPE [] tmp = getCopy (aArray);
int nDst = 0;
for (int nSrc = 0; nSrc < tmp.length; ++nSrc)
if (!contains (aElementsToRemove, tmp[nSrc]))
tmp[nDst++] = tmp[nSrc];
return getCopy (tmp, 0, nDst);
} | [
"@",
"Nullable",
"@",
"ReturnsMutableCopy",
"@",
"SafeVarargs",
"public",
"static",
"<",
"ELEMENTTYPE",
">",
"ELEMENTTYPE",
"[",
"]",
"getAllExcept",
"(",
"@",
"Nullable",
"final",
"ELEMENTTYPE",
"[",
"]",
"aArray",
",",
"@",
"Nullable",
"final",
"ELEMENTTYPE",
... | Get an array that contains all elements, except for the passed elements.
@param <ELEMENTTYPE>
Array element type
@param aArray
The source array. May be <code>null</code>.
@param aElementsToRemove
The elements to skip.
@return <code>null</code> if the passed array is <code>null</code>. The
original array, if no elements need to be skipped. A non-
<code>null</code> copy of the array without the passed elements
otherwise. | [
"Get",
"an",
"array",
"that",
"contains",
"all",
"elements",
"except",
"for",
"the",
"passed",
"elements",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/collection/ArrayHelper.java#L2787-L2802 |
icode/ameba-utils | src/main/java/ameba/util/FileUtils.java | FileUtils.byteCountToDisplaySize | public static String byteCountToDisplaySize(BigInteger size, int maxChars) {
String displaySize;
BigDecimal bdSize = new BigDecimal(size);
SizeSuffix selectedSuffix = SizeSuffix.B;
for (SizeSuffix sizeSuffix : SizeSuffix.values()) {
if (sizeSuffix.equals(SizeSuffix.B)) {
continue;
}
if (bdSize.setScale(0, RoundingMode.HALF_UP).toString().length() <= maxChars) {
break;
}
selectedSuffix = sizeSuffix;
bdSize = bdSize.divide(ONE_KB_BD);
}
displaySize = bdSize.setScale(0, RoundingMode.HALF_UP).toString();
if (displaySize.length() < maxChars - 1) {
displaySize = bdSize.setScale(
maxChars - 1 - displaySize.length(), RoundingMode.HALF_UP).toString();
}
return displaySize + " " + selectedSuffix.toString();
} | java | public static String byteCountToDisplaySize(BigInteger size, int maxChars) {
String displaySize;
BigDecimal bdSize = new BigDecimal(size);
SizeSuffix selectedSuffix = SizeSuffix.B;
for (SizeSuffix sizeSuffix : SizeSuffix.values()) {
if (sizeSuffix.equals(SizeSuffix.B)) {
continue;
}
if (bdSize.setScale(0, RoundingMode.HALF_UP).toString().length() <= maxChars) {
break;
}
selectedSuffix = sizeSuffix;
bdSize = bdSize.divide(ONE_KB_BD);
}
displaySize = bdSize.setScale(0, RoundingMode.HALF_UP).toString();
if (displaySize.length() < maxChars - 1) {
displaySize = bdSize.setScale(
maxChars - 1 - displaySize.length(), RoundingMode.HALF_UP).toString();
}
return displaySize + " " + selectedSuffix.toString();
} | [
"public",
"static",
"String",
"byteCountToDisplaySize",
"(",
"BigInteger",
"size",
",",
"int",
"maxChars",
")",
"{",
"String",
"displaySize",
";",
"BigDecimal",
"bdSize",
"=",
"new",
"BigDecimal",
"(",
"size",
")",
";",
"SizeSuffix",
"selectedSuffix",
"=",
"Size... | Adopted and improved version of
{@link org.apache.commons.io.FileUtils#byteCountToDisplaySize(BigInteger)}.
<p>
Warning! it is not advised to use <code>maxChars < 3</code> because it produces
correctly rounded, but non-intuitive results like "0 KB" for 100 bytes.
@param size a {@link java.math.BigInteger} object.
@param maxChars maximum length of digit part, ie. '1.2'
@return rounded byte size as {@link java.lang.String} | [
"Adopted",
"and",
"improved",
"version",
"of",
"{",
"@link",
"org",
".",
"apache",
".",
"commons",
".",
"io",
".",
"FileUtils#byteCountToDisplaySize",
"(",
"BigInteger",
")",
"}",
".",
"<p",
">",
"Warning!",
"it",
"is",
"not",
"advised",
"to",
"use",
"<cod... | train | https://github.com/icode/ameba-utils/blob/1aad5317a22e546c83dfe2dc0c80a1dc1fa0ea35/src/main/java/ameba/util/FileUtils.java#L35-L55 |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.mp.jwt/src/com/ibm/ws/security/mp/jwt/impl/utils/ClaimsUtils.java | ClaimsUtils.convertToList | @FFDCIgnore({ MalformedClaimException.class })
private void convertToList(String claimName, JwtClaims claimsSet) {
List<String> list = null;
try {
list = claimsSet.getStringListClaimValue(claimName);
} catch (MalformedClaimException e) {
try {
String value = claimsSet.getStringClaimValue(claimName);
if (value != null) {
list = new ArrayList<String>();
list.add(value);
claimsSet.setClaim(claimName, list);
}
} catch (MalformedClaimException e1) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "The value for the claim [" + claimName + "] could not be convered to a string list: " + e1.getLocalizedMessage());
}
}
}
} | java | @FFDCIgnore({ MalformedClaimException.class })
private void convertToList(String claimName, JwtClaims claimsSet) {
List<String> list = null;
try {
list = claimsSet.getStringListClaimValue(claimName);
} catch (MalformedClaimException e) {
try {
String value = claimsSet.getStringClaimValue(claimName);
if (value != null) {
list = new ArrayList<String>();
list.add(value);
claimsSet.setClaim(claimName, list);
}
} catch (MalformedClaimException e1) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "The value for the claim [" + claimName + "] could not be convered to a string list: " + e1.getLocalizedMessage());
}
}
}
} | [
"@",
"FFDCIgnore",
"(",
"{",
"MalformedClaimException",
".",
"class",
"}",
")",
"private",
"void",
"convertToList",
"(",
"String",
"claimName",
",",
"JwtClaims",
"claimsSet",
")",
"{",
"List",
"<",
"String",
">",
"list",
"=",
"null",
";",
"try",
"{",
"list... | Converts the value for the specified claim into a String list. | [
"Converts",
"the",
"value",
"for",
"the",
"specified",
"claim",
"into",
"a",
"String",
"list",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.mp.jwt/src/com/ibm/ws/security/mp/jwt/impl/utils/ClaimsUtils.java#L177-L196 |
b3dgs/lionengine | lionengine-network/src/main/java/com/b3dgs/lionengine/network/ClientImpl.java | ClientImpl.readString | private String readString() throws IOException
{
final int size = in.readByte();
if (size > 0)
{
final byte[] name = new byte[size];
if (in.read(name) != -1)
{
return new String(name, NetworkMessage.CHARSET);
}
}
return null;
} | java | private String readString() throws IOException
{
final int size = in.readByte();
if (size > 0)
{
final byte[] name = new byte[size];
if (in.read(name) != -1)
{
return new String(name, NetworkMessage.CHARSET);
}
}
return null;
} | [
"private",
"String",
"readString",
"(",
")",
"throws",
"IOException",
"{",
"final",
"int",
"size",
"=",
"in",
".",
"readByte",
"(",
")",
";",
"if",
"(",
"size",
">",
"0",
")",
"{",
"final",
"byte",
"[",
"]",
"name",
"=",
"new",
"byte",
"[",
"size",... | Get the name value read from the stream.
@return The name string.
@throws IOException In case of error. | [
"Get",
"the",
"name",
"value",
"read",
"from",
"the",
"stream",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-network/src/main/java/com/b3dgs/lionengine/network/ClientImpl.java#L135-L147 |
apache/incubator-gobblin | gobblin-runtime/src/main/java/org/apache/gobblin/scheduler/PathAlterationListenerAdaptorForMonitor.java | PathAlterationListenerAdaptorForMonitor.checkCommonPropExistance | private boolean checkCommonPropExistance(Path rootPath, String noExtFileName)
throws IOException {
Configuration conf = new Configuration();
FileStatus[] children = rootPath.getFileSystem(conf).listStatus(rootPath);
for (FileStatus aChild : children) {
if (aChild.getPath().getName().contains(noExtFileName)) {
return false;
}
}
return true;
} | java | private boolean checkCommonPropExistance(Path rootPath, String noExtFileName)
throws IOException {
Configuration conf = new Configuration();
FileStatus[] children = rootPath.getFileSystem(conf).listStatus(rootPath);
for (FileStatus aChild : children) {
if (aChild.getPath().getName().contains(noExtFileName)) {
return false;
}
}
return true;
} | [
"private",
"boolean",
"checkCommonPropExistance",
"(",
"Path",
"rootPath",
",",
"String",
"noExtFileName",
")",
"throws",
"IOException",
"{",
"Configuration",
"conf",
"=",
"new",
"Configuration",
"(",
")",
";",
"FileStatus",
"[",
"]",
"children",
"=",
"rootPath",
... | Given the target rootPath, check if there's common properties existed. Return false if so.
@param rootPath
@return | [
"Given",
"the",
"target",
"rootPath",
"check",
"if",
"there",
"s",
"common",
"properties",
"existed",
".",
"Return",
"false",
"if",
"so",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-runtime/src/main/java/org/apache/gobblin/scheduler/PathAlterationListenerAdaptorForMonitor.java#L246-L257 |
elki-project/elki | addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/visualizers/scatterplot/index/TreeSphereVisualization.java | TreeSphereVisualization.getLPNormP | public static double getLPNormP(AbstractMTree<?, ?, ?, ?> tree) {
// Note: we deliberately lose generics here, so the compilers complain
// less on the next typecheck and cast!
DistanceFunction<?> distanceFunction = tree.getDistanceFunction();
if(LPNormDistanceFunction.class.isInstance(distanceFunction)) {
return ((LPNormDistanceFunction) distanceFunction).getP();
}
return 0;
} | java | public static double getLPNormP(AbstractMTree<?, ?, ?, ?> tree) {
// Note: we deliberately lose generics here, so the compilers complain
// less on the next typecheck and cast!
DistanceFunction<?> distanceFunction = tree.getDistanceFunction();
if(LPNormDistanceFunction.class.isInstance(distanceFunction)) {
return ((LPNormDistanceFunction) distanceFunction).getP();
}
return 0;
} | [
"public",
"static",
"double",
"getLPNormP",
"(",
"AbstractMTree",
"<",
"?",
",",
"?",
",",
"?",
",",
"?",
">",
"tree",
")",
"{",
"// Note: we deliberately lose generics here, so the compilers complain",
"// less on the next typecheck and cast!",
"DistanceFunction",
"<",
"... | Get the "p" value of an Lp norm.
@param tree Tree to visualize
@return p value | [
"Get",
"the",
"p",
"value",
"of",
"an",
"Lp",
"norm",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/visualizers/scatterplot/index/TreeSphereVisualization.java#L129-L137 |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java | JBBPDslBuilder.Int | public JBBPDslBuilder Int(final String name) {
final Item item = new Item(BinType.INT, name, this.byteOrder);
this.addItem(item);
return this;
} | java | public JBBPDslBuilder Int(final String name) {
final Item item = new Item(BinType.INT, name, this.byteOrder);
this.addItem(item);
return this;
} | [
"public",
"JBBPDslBuilder",
"Int",
"(",
"final",
"String",
"name",
")",
"{",
"final",
"Item",
"item",
"=",
"new",
"Item",
"(",
"BinType",
".",
"INT",
",",
"name",
",",
"this",
".",
"byteOrder",
")",
";",
"this",
".",
"addItem",
"(",
"item",
")",
";",... | Add named integer field.
@param name name of the field, can be null for anonymous
@return the builder instance, must not be null | [
"Add",
"named",
"integer",
"field",
"."
] | train | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java#L1091-L1095 |
facebookarchive/hadoop-20 | src/core/org/apache/hadoop/record/compiler/JFile.java | JFile.genCode | public int genCode(String language, String destDir, ArrayList<String> options)
throws IOException {
CodeGenerator gen = CodeGenerator.get(language);
if (gen != null) {
gen.genCode(mName, mInclFiles, mRecords, destDir, options);
} else {
System.err.println("Cannnot recognize language:"+language);
return 1;
}
return 0;
} | java | public int genCode(String language, String destDir, ArrayList<String> options)
throws IOException {
CodeGenerator gen = CodeGenerator.get(language);
if (gen != null) {
gen.genCode(mName, mInclFiles, mRecords, destDir, options);
} else {
System.err.println("Cannnot recognize language:"+language);
return 1;
}
return 0;
} | [
"public",
"int",
"genCode",
"(",
"String",
"language",
",",
"String",
"destDir",
",",
"ArrayList",
"<",
"String",
">",
"options",
")",
"throws",
"IOException",
"{",
"CodeGenerator",
"gen",
"=",
"CodeGenerator",
".",
"get",
"(",
"language",
")",
";",
"if",
... | Generate record code in given language. Language should be all
lowercase. | [
"Generate",
"record",
"code",
"in",
"given",
"language",
".",
"Language",
"should",
"be",
"all",
"lowercase",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/record/compiler/JFile.java#L59-L69 |
craftercms/core | src/main/java/org/craftercms/core/util/UrlUtils.java | UrlUtils.getShortName | public static String getShortName(String longName, String containsShortNameRegex, int shortNameRegexGroup) {
Pattern pattern = Pattern.compile(containsShortNameRegex);
Matcher matcher = pattern.matcher(longName);
if (matcher.matches()) {
return matcher.group(shortNameRegexGroup);
} else {
return longName;
}
} | java | public static String getShortName(String longName, String containsShortNameRegex, int shortNameRegexGroup) {
Pattern pattern = Pattern.compile(containsShortNameRegex);
Matcher matcher = pattern.matcher(longName);
if (matcher.matches()) {
return matcher.group(shortNameRegexGroup);
} else {
return longName;
}
} | [
"public",
"static",
"String",
"getShortName",
"(",
"String",
"longName",
",",
"String",
"containsShortNameRegex",
",",
"int",
"shortNameRegexGroup",
")",
"{",
"Pattern",
"pattern",
"=",
"Pattern",
".",
"compile",
"(",
"containsShortNameRegex",
")",
";",
"Matcher",
... | Returns the short name representation of a long name.
@param longName
@param containsShortNameRegex the regex that identifies whether the long name contains a short name. This
regex should also contain
a group expression that can be use to capture for the short name (see the
Pattern class javadoc).
@param shortNameRegexGroup the index of the captured group that represents the short name (see the Pattern
class javadoc)
@return the short name, or the long name if there was no short name match
@see Pattern | [
"Returns",
"the",
"short",
"name",
"representation",
"of",
"a",
"long",
"name",
"."
] | train | https://github.com/craftercms/core/blob/d3ec74d669d3f8cfcf995177615d5f126edfa237/src/main/java/org/craftercms/core/util/UrlUtils.java#L48-L57 |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/distort/brown/AddBrownNtoN_F64.java | AddBrownNtoN_F64.setDistortion | public AddBrownNtoN_F64 setDistortion( /**/double[] radial, /**/double t1, /**/double t2) {
params = new RadialTangential_F64(radial,t1,t2);
return this;
} | java | public AddBrownNtoN_F64 setDistortion( /**/double[] radial, /**/double t1, /**/double t2) {
params = new RadialTangential_F64(radial,t1,t2);
return this;
} | [
"public",
"AddBrownNtoN_F64",
"setDistortion",
"(",
"/**/",
"double",
"[",
"]",
"radial",
",",
"/**/",
"double",
"t1",
",",
"/**/",
"double",
"t2",
")",
"{",
"params",
"=",
"new",
"RadialTangential_F64",
"(",
"radial",
",",
"t1",
",",
"t2",
")",
";",
"re... | Specify intrinsic camera parameters
@param radial Radial distortion parameters | [
"Specify",
"intrinsic",
"camera",
"parameters"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/distort/brown/AddBrownNtoN_F64.java#L41-L44 |
wdullaer/SwipeActionAdapter | library/src/main/java/com/wdullaer/swipeactionadapter/SwipeActionAdapter.java | SwipeActionAdapter.onPreAction | @Override
public boolean onPreAction(ListView listView, int position, SwipeDirection direction){
return mSwipeActionListener != null && mSwipeActionListener.shouldDismiss(position, direction);
} | java | @Override
public boolean onPreAction(ListView listView, int position, SwipeDirection direction){
return mSwipeActionListener != null && mSwipeActionListener.shouldDismiss(position, direction);
} | [
"@",
"Override",
"public",
"boolean",
"onPreAction",
"(",
"ListView",
"listView",
",",
"int",
"position",
",",
"SwipeDirection",
"direction",
")",
"{",
"return",
"mSwipeActionListener",
"!=",
"null",
"&&",
"mSwipeActionListener",
".",
"shouldDismiss",
"(",
"position... | SwipeActionTouchListener.ActionCallbacks callback
We just link it through to our own interface
@param listView The originating {@link ListView}.
@param position The position to perform the action on, sorted in descending order
for convenience.
@param direction The type of swipe that triggered the action
@return boolean that indicates whether the list item should be dismissed or shown again. | [
"SwipeActionTouchListener",
".",
"ActionCallbacks",
"callback",
"We",
"just",
"link",
"it",
"through",
"to",
"our",
"own",
"interface"
] | train | https://github.com/wdullaer/SwipeActionAdapter/blob/24a7e2ed953ac11ea0d8875d375bba571ffeba55/library/src/main/java/com/wdullaer/swipeactionadapter/SwipeActionAdapter.java#L91-L94 |
BorderTech/wcomponents | wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/theme/WListExample.java | WListExample.preparePaintComponent | @Override
public void preparePaintComponent(final Request request) {
if (!isInitialised()) {
List<SimpleTableBean> items = new ArrayList<>();
items.add(new SimpleTableBean("A", "none", "thing"));
items.add(new SimpleTableBean("B", "some", "thing2"));
items.add(new SimpleTableBean("C", "little", "thing3"));
items.add(new SimpleTableBean("D", "lots", "thing4"));
for (WList list : lists) {
list.setData(items);
}
setInitialised(true);
}
} | java | @Override
public void preparePaintComponent(final Request request) {
if (!isInitialised()) {
List<SimpleTableBean> items = new ArrayList<>();
items.add(new SimpleTableBean("A", "none", "thing"));
items.add(new SimpleTableBean("B", "some", "thing2"));
items.add(new SimpleTableBean("C", "little", "thing3"));
items.add(new SimpleTableBean("D", "lots", "thing4"));
for (WList list : lists) {
list.setData(items);
}
setInitialised(true);
}
} | [
"@",
"Override",
"public",
"void",
"preparePaintComponent",
"(",
"final",
"Request",
"request",
")",
"{",
"if",
"(",
"!",
"isInitialised",
"(",
")",
")",
"{",
"List",
"<",
"SimpleTableBean",
">",
"items",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"it... | Override preparePaintComponent to perform initialisation the first time through.
@param request the request being responded to. | [
"Override",
"preparePaintComponent",
"to",
"perform",
"initialisation",
"the",
"first",
"time",
"through",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/theme/WListExample.java#L107-L122 |
strator-dev/greenpepper | greenpepper-open/confluence/greenpepper-confluence-code/src/main/java/com/greenpepper/confluence/macros/AbstractGreenPepperMacro.java | AbstractGreenPepperMacro.getPage | protected Page getPage(Map<String,String> parameters, RenderContext renderContext, String spaceKey) throws GreenPepperServerException
{
String pageTitle = parameters.get("pageTitle");
if(StringUtil.isEmpty(pageTitle))
{
ContentEntityObject owner = ((PageContext)renderContext).getEntity();
return (Page)owner;
}
Page page = gpUtil.getPageManager().getPage(spaceKey, pageTitle);
if(page == null)
throw new GreenPepperServerException("greenpepper.children.pagenotfound", String.format("'%s' in space '%s'", pageTitle, spaceKey));
return page;
} | java | protected Page getPage(Map<String,String> parameters, RenderContext renderContext, String spaceKey) throws GreenPepperServerException
{
String pageTitle = parameters.get("pageTitle");
if(StringUtil.isEmpty(pageTitle))
{
ContentEntityObject owner = ((PageContext)renderContext).getEntity();
return (Page)owner;
}
Page page = gpUtil.getPageManager().getPage(spaceKey, pageTitle);
if(page == null)
throw new GreenPepperServerException("greenpepper.children.pagenotfound", String.format("'%s' in space '%s'", pageTitle, spaceKey));
return page;
} | [
"protected",
"Page",
"getPage",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"parameters",
",",
"RenderContext",
"renderContext",
",",
"String",
"spaceKey",
")",
"throws",
"GreenPepperServerException",
"{",
"String",
"pageTitle",
"=",
"parameters",
".",
"get",
... | <p>getPage.</p>
@param parameters a {@link java.util.Map} object.
@param renderContext a {@link com.atlassian.renderer.RenderContext} object.
@param spaceKey a {@link java.lang.String} object.
@return a {@link com.atlassian.confluence.pages.Page} object.
@throws com.greenpepper.server.GreenPepperServerException if any. | [
"<p",
">",
"getPage",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper-open/confluence/greenpepper-confluence-code/src/main/java/com/greenpepper/confluence/macros/AbstractGreenPepperMacro.java#L192-L206 |
auth0/Auth0.Android | auth0/src/main/java/com/auth0/android/authentication/request/ProfileRequest.java | ProfileRequest.execute | @Override
public Authentication execute() throws Auth0Exception {
Credentials credentials = credentialsRequest.execute();
UserProfile profile = userInfoRequest
.addHeader(HEADER_AUTHORIZATION, "Bearer " + credentials.getAccessToken())
.execute();
return new Authentication(profile, credentials);
} | java | @Override
public Authentication execute() throws Auth0Exception {
Credentials credentials = credentialsRequest.execute();
UserProfile profile = userInfoRequest
.addHeader(HEADER_AUTHORIZATION, "Bearer " + credentials.getAccessToken())
.execute();
return new Authentication(profile, credentials);
} | [
"@",
"Override",
"public",
"Authentication",
"execute",
"(",
")",
"throws",
"Auth0Exception",
"{",
"Credentials",
"credentials",
"=",
"credentialsRequest",
".",
"execute",
"(",
")",
";",
"UserProfile",
"profile",
"=",
"userInfoRequest",
".",
"addHeader",
"(",
"HEA... | Logs in the user with Auth0 and fetches it's profile.
@return authentication object containing the user's tokens and profile
@throws Auth0Exception when either authentication or profile fetch fails | [
"Logs",
"in",
"the",
"user",
"with",
"Auth0",
"and",
"fetches",
"it",
"s",
"profile",
"."
] | train | https://github.com/auth0/Auth0.Android/blob/ee37b7f94d989c1fbab2cb1378c87fdcaf7a8156/auth0/src/main/java/com/auth0/android/authentication/request/ProfileRequest.java#L125-L132 |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/geo/MultiViewOps.java | MultiViewOps.createFundamental | public static DMatrixRMaj createFundamental(DMatrixRMaj E, CameraPinhole intrinsic ) {
DMatrixRMaj K = PerspectiveOps.pinholeToMatrix(intrinsic,(DMatrixRMaj)null);
return createFundamental(E,K);
} | java | public static DMatrixRMaj createFundamental(DMatrixRMaj E, CameraPinhole intrinsic ) {
DMatrixRMaj K = PerspectiveOps.pinholeToMatrix(intrinsic,(DMatrixRMaj)null);
return createFundamental(E,K);
} | [
"public",
"static",
"DMatrixRMaj",
"createFundamental",
"(",
"DMatrixRMaj",
"E",
",",
"CameraPinhole",
"intrinsic",
")",
"{",
"DMatrixRMaj",
"K",
"=",
"PerspectiveOps",
".",
"pinholeToMatrix",
"(",
"intrinsic",
",",
"(",
"DMatrixRMaj",
")",
"null",
")",
";",
"re... | Computes a Fundamental matrix given an Essential matrix and the camera's intrinsic
parameters.
@see #createFundamental(DMatrixRMaj, DMatrixRMaj)
@param E Essential matrix
@param intrinsic Intrinsic camera calibration
@return Fundamental matrix | [
"Computes",
"a",
"Fundamental",
"matrix",
"given",
"an",
"Essential",
"matrix",
"and",
"the",
"camera",
"s",
"intrinsic",
"parameters",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/MultiViewOps.java#L707-L710 |
UrielCh/ovh-java-sdk | ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java | ApiOvhIpLoadbalancing.serviceName_quota_zone_PUT | public void serviceName_quota_zone_PUT(String serviceName, String zone, OvhQuota body) throws IOException {
String qPath = "/ipLoadbalancing/{serviceName}/quota/{zone}";
StringBuilder sb = path(qPath, serviceName, zone);
exec(qPath, "PUT", sb.toString(), body);
} | java | public void serviceName_quota_zone_PUT(String serviceName, String zone, OvhQuota body) throws IOException {
String qPath = "/ipLoadbalancing/{serviceName}/quota/{zone}";
StringBuilder sb = path(qPath, serviceName, zone);
exec(qPath, "PUT", sb.toString(), body);
} | [
"public",
"void",
"serviceName_quota_zone_PUT",
"(",
"String",
"serviceName",
",",
"String",
"zone",
",",
"OvhQuota",
"body",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/ipLoadbalancing/{serviceName}/quota/{zone}\"",
";",
"StringBuilder",
"sb",
"=",
... | Alter this object properties
REST: PUT /ipLoadbalancing/{serviceName}/quota/{zone}
@param body [required] New object properties
@param serviceName [required] The internal name of your IP load balancing
@param zone [required] Zone of your quota | [
"Alter",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java#L1845-L1849 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/UnicodeSet.java | UnicodeSet._appendToPat | private static <T extends Appendable> T _appendToPat(T buf, String s, boolean escapeUnprintable) {
int cp;
for (int i = 0; i < s.length(); i += Character.charCount(cp)) {
cp = s.codePointAt(i);
_appendToPat(buf, cp, escapeUnprintable);
}
return buf;
} | java | private static <T extends Appendable> T _appendToPat(T buf, String s, boolean escapeUnprintable) {
int cp;
for (int i = 0; i < s.length(); i += Character.charCount(cp)) {
cp = s.codePointAt(i);
_appendToPat(buf, cp, escapeUnprintable);
}
return buf;
} | [
"private",
"static",
"<",
"T",
"extends",
"Appendable",
">",
"T",
"_appendToPat",
"(",
"T",
"buf",
",",
"String",
"s",
",",
"boolean",
"escapeUnprintable",
")",
"{",
"int",
"cp",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"s",
".",
"leng... | Append the <code>toPattern()</code> representation of a
string to the given <code>Appendable</code>. | [
"Append",
"the",
"<code",
">",
"toPattern",
"()",
"<",
"/",
"code",
">",
"representation",
"of",
"a",
"string",
"to",
"the",
"given",
"<code",
">",
"Appendable<",
"/",
"code",
">",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/UnicodeSet.java#L623-L630 |
mangstadt/biweekly | src/main/java/biweekly/util/com/google/ical/util/TimeUtils.java | TimeUtils.toDateTimeValue | public static DateTimeValue toDateTimeValue(long millisFromEpoch, TimeZone zone) {
GregorianCalendar c = new GregorianCalendar(zone);
c.clear();
c.setTimeInMillis(millisFromEpoch);
//@formatter:off
return new DateTimeValueImpl (
c.get(Calendar.YEAR),
c.get(Calendar.MONTH) + 1,
c.get(Calendar.DAY_OF_MONTH),
c.get(Calendar.HOUR_OF_DAY),
c.get(Calendar.MINUTE),
c.get(Calendar.SECOND)
);
//@formatter:on
} | java | public static DateTimeValue toDateTimeValue(long millisFromEpoch, TimeZone zone) {
GregorianCalendar c = new GregorianCalendar(zone);
c.clear();
c.setTimeInMillis(millisFromEpoch);
//@formatter:off
return new DateTimeValueImpl (
c.get(Calendar.YEAR),
c.get(Calendar.MONTH) + 1,
c.get(Calendar.DAY_OF_MONTH),
c.get(Calendar.HOUR_OF_DAY),
c.get(Calendar.MINUTE),
c.get(Calendar.SECOND)
);
//@formatter:on
} | [
"public",
"static",
"DateTimeValue",
"toDateTimeValue",
"(",
"long",
"millisFromEpoch",
",",
"TimeZone",
"zone",
")",
"{",
"GregorianCalendar",
"c",
"=",
"new",
"GregorianCalendar",
"(",
"zone",
")",
";",
"c",
".",
"clear",
"(",
")",
";",
"c",
".",
"setTimeI... | Builds a {@link DateTimeValue} object from the given data.
@param millisFromEpoch the number of milliseconds from the epoch
@param zone the timezone the number of milliseconds is in
@return the {@link DateTimeValue} object | [
"Builds",
"a",
"{"
] | train | https://github.com/mangstadt/biweekly/blob/2e21350f85c13dfff52fdef98fdbebe2976fcf61/src/main/java/biweekly/util/com/google/ical/util/TimeUtils.java#L414-L428 |
protostuff/protostuff | protostuff-api/src/main/java/io/protostuff/IntSerializer.java | IntSerializer.writeInt64 | public static void writeInt64(final long value, final byte[] buffer, int offset)
{
buffer[offset++] = (byte) (value >>> 56);
buffer[offset++] = (byte) (value >>> 48);
buffer[offset++] = (byte) (value >>> 40);
buffer[offset++] = (byte) (value >>> 32);
buffer[offset++] = (byte) (value >>> 24);
buffer[offset++] = (byte) (value >>> 16);
buffer[offset++] = (byte) (value >>> 8);
buffer[offset] = (byte) (value >>> 0);
} | java | public static void writeInt64(final long value, final byte[] buffer, int offset)
{
buffer[offset++] = (byte) (value >>> 56);
buffer[offset++] = (byte) (value >>> 48);
buffer[offset++] = (byte) (value >>> 40);
buffer[offset++] = (byte) (value >>> 32);
buffer[offset++] = (byte) (value >>> 24);
buffer[offset++] = (byte) (value >>> 16);
buffer[offset++] = (byte) (value >>> 8);
buffer[offset] = (byte) (value >>> 0);
} | [
"public",
"static",
"void",
"writeInt64",
"(",
"final",
"long",
"value",
",",
"final",
"byte",
"[",
"]",
"buffer",
",",
"int",
"offset",
")",
"{",
"buffer",
"[",
"offset",
"++",
"]",
"=",
"(",
"byte",
")",
"(",
"value",
">>>",
"56",
")",
";",
"buff... | Writes the 64-bit int into the buffer starting with the most significant byte. | [
"Writes",
"the",
"64",
"-",
"bit",
"int",
"into",
"the",
"buffer",
"starting",
"with",
"the",
"most",
"significant",
"byte",
"."
] | train | https://github.com/protostuff/protostuff/blob/af669cf089057d0ec83220266131ce411854af7b/protostuff-api/src/main/java/io/protostuff/IntSerializer.java#L89-L99 |
actorapp/actor-platform | actor-sdk/sdk-core/core/core-shared/src/main/java/im/actor/core/i18n/I18nEngine.java | I18nEngine.formatContentText | @ObjectiveCName("formatContentTextWithSenderId:withContentType:withText:withRelatedUid:withIsChannel:")
public String formatContentText(int senderId, ContentType contentType, String text, int relatedUid,
boolean isChannel) {
String groupKey = isChannel ? "channels" : "groups";
switch (contentType) {
case TEXT:
return text;
case DOCUMENT:
if (text == null || text.length() == 0) {
return get("content.document");
}
return text;// File name
case DOCUMENT_PHOTO:
return get("content.photo");
case DOCUMENT_VIDEO:
return get("content.video");
case DOCUMENT_AUDIO:
return get("content.audio");
case CONTACT:
return get("content.contact");
case LOCATION:
return get("content.location");
case STICKER:
if (text != null && !"".equals(text)) {
return text + " " + get("content.sticker");
} else {
return get("content.sticker");
}
case SERVICE:
return text;// Should be service message
case SERVICE_REGISTERED:
return getTemplateNamed(senderId, "content.service.registered.compact")
.replace("{app_name}", getAppName());
case SERVICE_CREATED:
return getTemplateNamed(senderId, "content.service." + groupKey + ".created");
case SERVICE_ADD:
return getTemplateNamed(senderId, "content.service." + groupKey + ".invited")
.replace("{name_added}", getSubjectName(relatedUid));
case SERVICE_LEAVE:
return getTemplateNamed(senderId, "content.service." + groupKey + ".left");
case SERVICE_KICK:
return getTemplateNamed(senderId, "content.service." + groupKey + ".kicked")
.replace("{name_kicked}", getSubjectName(relatedUid));
case SERVICE_AVATAR:
return getTemplateNamed(senderId, "content.service." + groupKey + ".avatar_changed");
case SERVICE_AVATAR_REMOVED:
return getTemplateNamed(senderId, "content.service." + groupKey + ".avatar_removed");
case SERVICE_TITLE:
return getTemplateNamed(senderId, "content.service." + groupKey + ".title_changed.compact");
case SERVICE_TOPIC:
return getTemplateNamed(senderId, "content.service." + groupKey + ".topic_changed.compact");
case SERVICE_ABOUT:
return getTemplateNamed(senderId, "content.service." + groupKey + ".about_changed.compact");
case SERVICE_JOINED:
return getTemplateNamed(senderId, "content.service." + groupKey + ".joined");
case SERVICE_CALL_ENDED:
return get("content.service.calls.ended");
case SERVICE_CALL_MISSED:
return get("content.service.calls.missed");
case NONE:
return "";
default:
case UNKNOWN_CONTENT:
return get("content.unsupported");
}
} | java | @ObjectiveCName("formatContentTextWithSenderId:withContentType:withText:withRelatedUid:withIsChannel:")
public String formatContentText(int senderId, ContentType contentType, String text, int relatedUid,
boolean isChannel) {
String groupKey = isChannel ? "channels" : "groups";
switch (contentType) {
case TEXT:
return text;
case DOCUMENT:
if (text == null || text.length() == 0) {
return get("content.document");
}
return text;// File name
case DOCUMENT_PHOTO:
return get("content.photo");
case DOCUMENT_VIDEO:
return get("content.video");
case DOCUMENT_AUDIO:
return get("content.audio");
case CONTACT:
return get("content.contact");
case LOCATION:
return get("content.location");
case STICKER:
if (text != null && !"".equals(text)) {
return text + " " + get("content.sticker");
} else {
return get("content.sticker");
}
case SERVICE:
return text;// Should be service message
case SERVICE_REGISTERED:
return getTemplateNamed(senderId, "content.service.registered.compact")
.replace("{app_name}", getAppName());
case SERVICE_CREATED:
return getTemplateNamed(senderId, "content.service." + groupKey + ".created");
case SERVICE_ADD:
return getTemplateNamed(senderId, "content.service." + groupKey + ".invited")
.replace("{name_added}", getSubjectName(relatedUid));
case SERVICE_LEAVE:
return getTemplateNamed(senderId, "content.service." + groupKey + ".left");
case SERVICE_KICK:
return getTemplateNamed(senderId, "content.service." + groupKey + ".kicked")
.replace("{name_kicked}", getSubjectName(relatedUid));
case SERVICE_AVATAR:
return getTemplateNamed(senderId, "content.service." + groupKey + ".avatar_changed");
case SERVICE_AVATAR_REMOVED:
return getTemplateNamed(senderId, "content.service." + groupKey + ".avatar_removed");
case SERVICE_TITLE:
return getTemplateNamed(senderId, "content.service." + groupKey + ".title_changed.compact");
case SERVICE_TOPIC:
return getTemplateNamed(senderId, "content.service." + groupKey + ".topic_changed.compact");
case SERVICE_ABOUT:
return getTemplateNamed(senderId, "content.service." + groupKey + ".about_changed.compact");
case SERVICE_JOINED:
return getTemplateNamed(senderId, "content.service." + groupKey + ".joined");
case SERVICE_CALL_ENDED:
return get("content.service.calls.ended");
case SERVICE_CALL_MISSED:
return get("content.service.calls.missed");
case NONE:
return "";
default:
case UNKNOWN_CONTENT:
return get("content.unsupported");
}
} | [
"@",
"ObjectiveCName",
"(",
"\"formatContentTextWithSenderId:withContentType:withText:withRelatedUid:withIsChannel:\"",
")",
"public",
"String",
"formatContentText",
"(",
"int",
"senderId",
",",
"ContentType",
"contentType",
",",
"String",
"text",
",",
"int",
"relatedUid",
",... | Formatting content for Dialog List and Notifications
@param senderId sender of message (used in service messages)
@param contentType type of content
@param text text of message
@param relatedUid optional related uid
@return formatted content | [
"Formatting",
"content",
"for",
"Dialog",
"List",
"and",
"Notifications"
] | train | https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core/core/core-shared/src/main/java/im/actor/core/i18n/I18nEngine.java#L296-L363 |
Gagravarr/VorbisJava | core/src/main/java/org/gagravarr/ogg/OggFile.java | OggFile.getPacketWriter | public OggPacketWriter getPacketWriter(int sid) {
if(!writing) {
throw new IllegalStateException("Can only write to a file opened with an OutputStream");
}
seenSIDs.add(sid);
return new OggPacketWriter(this, sid);
} | java | public OggPacketWriter getPacketWriter(int sid) {
if(!writing) {
throw new IllegalStateException("Can only write to a file opened with an OutputStream");
}
seenSIDs.add(sid);
return new OggPacketWriter(this, sid);
} | [
"public",
"OggPacketWriter",
"getPacketWriter",
"(",
"int",
"sid",
")",
"{",
"if",
"(",
"!",
"writing",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Can only write to a file opened with an OutputStream\"",
")",
";",
"}",
"seenSIDs",
".",
"add",
"(",
... | Creates a new Logical Bit Stream in the file,
and returns a Writer for putting data
into it. | [
"Creates",
"a",
"new",
"Logical",
"Bit",
"Stream",
"in",
"the",
"file",
"and",
"returns",
"a",
"Writer",
"for",
"putting",
"data",
"into",
"it",
"."
] | train | https://github.com/Gagravarr/VorbisJava/blob/22b4d645b00386d59d17a336a2bc9d54db08df16/core/src/main/java/org/gagravarr/ogg/OggFile.java#L128-L134 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/Normalizer.java | Normalizer.quickCheck | @Deprecated
public static QuickCheckResult quickCheck(char[] source, Mode mode, int options) {
return quickCheck(source, 0, source.length, mode, options);
} | java | @Deprecated
public static QuickCheckResult quickCheck(char[] source, Mode mode, int options) {
return quickCheck(source, 0, source.length, mode, options);
} | [
"@",
"Deprecated",
"public",
"static",
"QuickCheckResult",
"quickCheck",
"(",
"char",
"[",
"]",
"source",
",",
"Mode",
"mode",
",",
"int",
"options",
")",
"{",
"return",
"quickCheck",
"(",
"source",
",",
"0",
",",
"source",
".",
"length",
",",
"mode",
",... | Convenience method.
@param source Array of characters for determining if it is in a
normalized format
@param mode normalization format (Normalizer.NFC,Normalizer.NFD,
Normalizer.NFKC,Normalizer.NFKD)
@param options Options for use with exclusion set and tailored Normalization
The only option that is currently recognized is UNICODE_3_2
@return Return code to specify if the text is normalized or not
(Normalizer.YES, Normalizer.NO or Normalizer.MAYBE)
@deprecated ICU 56 Use {@link Normalizer2} instead.
@hide original deprecated declaration | [
"Convenience",
"method",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/Normalizer.java#L1027-L1030 |
FedericoPecora/meta-csp-framework | src/main/java/org/metacsp/multi/spatioTemporal/paths/TrajectoryEnvelope.java | TrajectoryEnvelope.updateDuration | public void updateDuration() {
long minDuration = 0;
Trajectory traj = this.getTrajectory();
for (int i = 0; i < traj.getDTs().length; i++) {
minDuration += traj.getDTs()[i]*RESOLUTION;
}
duration = new AllenIntervalConstraint(AllenIntervalConstraint.Type.Duration, new Bounds(minDuration,APSPSolver.INF));
duration.setFrom(this);
duration.setTo(this);
boolean conAdd = this.getConstraintSolver().addConstraint(duration);
if (conAdd) logger.fine("Added duration constriant " + duration);
else throw new Error("Failed to add duration constriant " + duration);
} | java | public void updateDuration() {
long minDuration = 0;
Trajectory traj = this.getTrajectory();
for (int i = 0; i < traj.getDTs().length; i++) {
minDuration += traj.getDTs()[i]*RESOLUTION;
}
duration = new AllenIntervalConstraint(AllenIntervalConstraint.Type.Duration, new Bounds(minDuration,APSPSolver.INF));
duration.setFrom(this);
duration.setTo(this);
boolean conAdd = this.getConstraintSolver().addConstraint(duration);
if (conAdd) logger.fine("Added duration constriant " + duration);
else throw new Error("Failed to add duration constriant " + duration);
} | [
"public",
"void",
"updateDuration",
"(",
")",
"{",
"long",
"minDuration",
"=",
"0",
";",
"Trajectory",
"traj",
"=",
"this",
".",
"getTrajectory",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"traj",
".",
"getDTs",
"(",
")",
".",
... | Imposes a temporal constraint that models the minimum duration
of this {@link TrajectoryEnvelope}, derived from the minimum transition times
between path poses (deltaTs). | [
"Imposes",
"a",
"temporal",
"constraint",
"that",
"models",
"the",
"minimum",
"duration",
"of",
"this",
"{"
] | train | https://github.com/FedericoPecora/meta-csp-framework/blob/42aaef2e2b76d0f738427f0dd9653c4f62b40517/src/main/java/org/metacsp/multi/spatioTemporal/paths/TrajectoryEnvelope.java#L836-L848 |
Impetus/Kundera | src/jpa-engine/core/src/main/java/com/impetus/kundera/metadata/model/type/AbstractManagedType.java | AbstractManagedType.isCollectionAttribute | private boolean isCollectionAttribute(PluralAttribute<? super X, ?, ?> attribute)
{
return attribute != null && attribute.getCollectionType().equals(CollectionType.COLLECTION);
} | java | private boolean isCollectionAttribute(PluralAttribute<? super X, ?, ?> attribute)
{
return attribute != null && attribute.getCollectionType().equals(CollectionType.COLLECTION);
} | [
"private",
"boolean",
"isCollectionAttribute",
"(",
"PluralAttribute",
"<",
"?",
"super",
"X",
",",
"?",
",",
"?",
">",
"attribute",
")",
"{",
"return",
"attribute",
"!=",
"null",
"&&",
"attribute",
".",
"getCollectionType",
"(",
")",
".",
"equals",
"(",
"... | Checks if is collection attribute.
@param attribute
the attribute
@return true, if is collection attribute | [
"Checks",
"if",
"is",
"collection",
"attribute",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/metadata/model/type/AbstractManagedType.java#L1027-L1030 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.