repository_name stringlengths 7 54 | func_path_in_repository stringlengths 18 196 | func_name stringlengths 7 107 | whole_func_string stringlengths 76 3.82k | language stringclasses 1
value | func_code_string stringlengths 76 3.82k | func_code_tokens listlengths 22 717 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 508 | split_name stringclasses 1
value | func_code_url stringlengths 111 310 |
|---|---|---|---|---|---|---|---|---|---|---|
elki-project/elki | elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/spacefillingcurves/BinarySplitSpatialSorter.java | BinarySplitSpatialSorter.binarySplitSort | private void binarySplitSort(List<? extends SpatialComparable> objs, final int start, final int end, int depth, final int numdim, int[] dims, Sorter comp) {
final int mid = start + ((end - start) >>> 1);
// Make invariant
comp.setDimension(dims != null ? dims[depth] : depth);
QuickSelect.quickSelect(objs, comp, start, end, mid);
// Recurse
final int nextdim = (depth + 1) % numdim;
if(start < mid - 1) {
binarySplitSort(objs, start, mid, nextdim, numdim, dims, comp);
}
if(mid + 2 < end) {
binarySplitSort(objs, mid + 1, end, nextdim, numdim, dims, comp);
}
} | java | private void binarySplitSort(List<? extends SpatialComparable> objs, final int start, final int end, int depth, final int numdim, int[] dims, Sorter comp) {
final int mid = start + ((end - start) >>> 1);
// Make invariant
comp.setDimension(dims != null ? dims[depth] : depth);
QuickSelect.quickSelect(objs, comp, start, end, mid);
// Recurse
final int nextdim = (depth + 1) % numdim;
if(start < mid - 1) {
binarySplitSort(objs, start, mid, nextdim, numdim, dims, comp);
}
if(mid + 2 < end) {
binarySplitSort(objs, mid + 1, end, nextdim, numdim, dims, comp);
}
} | [
"private",
"void",
"binarySplitSort",
"(",
"List",
"<",
"?",
"extends",
"SpatialComparable",
">",
"objs",
",",
"final",
"int",
"start",
",",
"final",
"int",
"end",
",",
"int",
"depth",
",",
"final",
"int",
"numdim",
",",
"int",
"[",
"]",
"dims",
",",
"... | Sort the array using a binary split in dimension curdim, then recurse with
the next dimension.
@param objs List of objects
@param start Interval start
@param end Interval end (exclusive)
@param depth Recursion depth
@param numdim Number of dimensions
@param dims Dimension indexes to sort by.
@param comp Comparator to use | [
"Sort",
"the",
"array",
"using",
"a",
"binary",
"split",
"in",
"dimension",
"curdim",
"then",
"recurse",
"with",
"the",
"next",
"dimension",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/spacefillingcurves/BinarySplitSpatialSorter.java#L86-L99 |
GenesysPureEngage/provisioning-client-java | src/main/java/com/genesys/internal/provisioning/api/SamlSettingsApi.java | SamlSettingsApi.setEnabledAsync | public com.squareup.okhttp.Call setEnabledAsync(Boolean saMLEnabled, final ApiCallback<SetEnabledResponse> callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
com.squareup.okhttp.Call call = setEnabledValidateBeforeCall(saMLEnabled, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken<SetEnabledResponse>(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
} | java | public com.squareup.okhttp.Call setEnabledAsync(Boolean saMLEnabled, final ApiCallback<SetEnabledResponse> callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null;
if (callback != null) {
progressListener = new ProgressResponseBody.ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, boolean done) {
callback.onDownloadProgress(bytesRead, contentLength, done);
}
};
progressRequestListener = new ProgressRequestBody.ProgressRequestListener() {
@Override
public void onRequestProgress(long bytesWritten, long contentLength, boolean done) {
callback.onUploadProgress(bytesWritten, contentLength, done);
}
};
}
com.squareup.okhttp.Call call = setEnabledValidateBeforeCall(saMLEnabled, progressListener, progressRequestListener);
Type localVarReturnType = new TypeToken<SetEnabledResponse>(){}.getType();
apiClient.executeAsync(call, localVarReturnType, callback);
return call;
} | [
"public",
"com",
".",
"squareup",
".",
"okhttp",
".",
"Call",
"setEnabledAsync",
"(",
"Boolean",
"saMLEnabled",
",",
"final",
"ApiCallback",
"<",
"SetEnabledResponse",
">",
"callback",
")",
"throws",
"ApiException",
"{",
"ProgressResponseBody",
".",
"ProgressListene... | Set SAML state. (asynchronously)
Change current SAML state.
@param saMLEnabled Value that define SAML state. (required)
@param callback The callback to be executed when the API call finishes
@return The request call
@throws ApiException If fail to process the API call, e.g. serializing the request body object | [
"Set",
"SAML",
"state",
".",
"(",
"asynchronously",
")",
"Change",
"current",
"SAML",
"state",
"."
] | train | https://github.com/GenesysPureEngage/provisioning-client-java/blob/1ad594c3767cec83052168e350994f922a26f75e/src/main/java/com/genesys/internal/provisioning/api/SamlSettingsApi.java#L1270-L1295 |
QSFT/Doradus | doradus-server/src/main/java/com/dell/doradus/service/schema/SchemaService.java | SchemaService.deleteApplication | public void deleteApplication(ApplicationDefinition appDef, String key) {
checkServiceState();
String appKey = appDef.getKey();
if (Utils.isEmpty(appKey)) {
Utils.require(Utils.isEmpty(key), "Application key does not match: %s", key);
} else {
Utils.require(appKey.equals(key), "Application key does not match: %s", key);
}
assert Tenant.getTenant(appDef) != null;
// Delete storage service-specific data first.
m_logger.info("Deleting application: {}", appDef.getAppName());
StorageService storageService = getStorageService(appDef);
storageService.deleteApplication(appDef);
TaskManagerService.instance().deleteApplicationTasks(appDef);
deleteAppProperties(appDef);
} | java | public void deleteApplication(ApplicationDefinition appDef, String key) {
checkServiceState();
String appKey = appDef.getKey();
if (Utils.isEmpty(appKey)) {
Utils.require(Utils.isEmpty(key), "Application key does not match: %s", key);
} else {
Utils.require(appKey.equals(key), "Application key does not match: %s", key);
}
assert Tenant.getTenant(appDef) != null;
// Delete storage service-specific data first.
m_logger.info("Deleting application: {}", appDef.getAppName());
StorageService storageService = getStorageService(appDef);
storageService.deleteApplication(appDef);
TaskManagerService.instance().deleteApplicationTasks(appDef);
deleteAppProperties(appDef);
} | [
"public",
"void",
"deleteApplication",
"(",
"ApplicationDefinition",
"appDef",
",",
"String",
"key",
")",
"{",
"checkServiceState",
"(",
")",
";",
"String",
"appKey",
"=",
"appDef",
".",
"getKey",
"(",
")",
";",
"if",
"(",
"Utils",
".",
"isEmpty",
"(",
"ap... | Delete the application with the given definition, including all of its data. The
given {@link ApplicationDefinition} must define the tenant in which the application
resides. If the given application doesn't exist, the call is a no-op. If the
application exists, the given key must match the current key, if one is defined, or
be null/empty if no key is defined.
@param appDef {@link ApplicationDefinition} of application to delete.
@param key Application key of existing application, if any. | [
"Delete",
"the",
"application",
"with",
"the",
"given",
"definition",
"including",
"all",
"of",
"its",
"data",
".",
"The",
"given",
"{",
"@link",
"ApplicationDefinition",
"}",
"must",
"define",
"the",
"tenant",
"in",
"which",
"the",
"application",
"resides",
"... | train | https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/service/schema/SchemaService.java#L262-L278 |
nguillaumin/slick2d-maven | slick2d-core/src/main/java/org/newdawn/slick/ImageBuffer.java | ImageBuffer.setRGBA | public void setRGBA(int x, int y, int r, int g, int b, int a) {
if ((x < 0) || (x >= width) || (y < 0) || (y >= height)) {
throw new RuntimeException("Specified location: "+x+","+y+" outside of image");
}
int ofs = ((x + (y * texWidth)) * 4);
if (ByteOrder.nativeOrder() == ByteOrder.BIG_ENDIAN) {
rawData[ofs] = (byte) b;
rawData[ofs + 1] = (byte) g;
rawData[ofs + 2] = (byte) r;
rawData[ofs + 3] = (byte) a;
} else {
rawData[ofs] = (byte) r;
rawData[ofs + 1] = (byte) g;
rawData[ofs + 2] = (byte) b;
rawData[ofs + 3] = (byte) a;
}
} | java | public void setRGBA(int x, int y, int r, int g, int b, int a) {
if ((x < 0) || (x >= width) || (y < 0) || (y >= height)) {
throw new RuntimeException("Specified location: "+x+","+y+" outside of image");
}
int ofs = ((x + (y * texWidth)) * 4);
if (ByteOrder.nativeOrder() == ByteOrder.BIG_ENDIAN) {
rawData[ofs] = (byte) b;
rawData[ofs + 1] = (byte) g;
rawData[ofs + 2] = (byte) r;
rawData[ofs + 3] = (byte) a;
} else {
rawData[ofs] = (byte) r;
rawData[ofs + 1] = (byte) g;
rawData[ofs + 2] = (byte) b;
rawData[ofs + 3] = (byte) a;
}
} | [
"public",
"void",
"setRGBA",
"(",
"int",
"x",
",",
"int",
"y",
",",
"int",
"r",
",",
"int",
"g",
",",
"int",
"b",
",",
"int",
"a",
")",
"{",
"if",
"(",
"(",
"x",
"<",
"0",
")",
"||",
"(",
"x",
">=",
"width",
")",
"||",
"(",
"y",
"<",
"0... | Set a pixel in the image buffer
@param x The x position of the pixel to set
@param y The y position of the pixel to set
@param r The red component to set (0->255)
@param g The green component to set (0->255)
@param b The blue component to set (0->255)
@param a The alpha component to set (0->255) | [
"Set",
"a",
"pixel",
"in",
"the",
"image",
"buffer"
] | train | https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/ImageBuffer.java#L114-L132 |
astrapi69/jaulp-wicket | jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/termofuse/TermOfUsePanel.java | TermOfUsePanel.newDataProtectionPanel | protected Component newDataProtectionPanel(final String id,
final IModel<HeaderContentListModelBean> model)
{
return new DataProtectionPanel(id, Model.of(model.getObject()));
} | java | protected Component newDataProtectionPanel(final String id,
final IModel<HeaderContentListModelBean> model)
{
return new DataProtectionPanel(id, Model.of(model.getObject()));
} | [
"protected",
"Component",
"newDataProtectionPanel",
"(",
"final",
"String",
"id",
",",
"final",
"IModel",
"<",
"HeaderContentListModelBean",
">",
"model",
")",
"{",
"return",
"new",
"DataProtectionPanel",
"(",
"id",
",",
"Model",
".",
"of",
"(",
"model",
".",
... | Factory method for creating the new {@link Component} for the data protection. This method is
invoked in the constructor from the derived classes and can be overridden so users can
provide their own version of a new {@link Component} for the data protection.
@param id
the id
@param model
the model
@return the new {@link Component} for the data protection | [
"Factory",
"method",
"for",
"creating",
"the",
"new",
"{",
"@link",
"Component",
"}",
"for",
"the",
"data",
"protection",
".",
"This",
"method",
"is",
"invoked",
"in",
"the",
"constructor",
"from",
"the",
"derived",
"classes",
"and",
"can",
"be",
"overridden... | train | https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/termofuse/TermOfUsePanel.java#L225-L229 |
igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/bob/BoBHash.java | BoBHash.fromCid | public static BoBHash fromCid(String cid) {
String hashType = cid.substring(0, cid.indexOf("+"));
String hash = cid.substring(cid.indexOf("+") + 1, cid.indexOf("@bob.xmpp.org"));
return new BoBHash(hash, hashType);
} | java | public static BoBHash fromCid(String cid) {
String hashType = cid.substring(0, cid.indexOf("+"));
String hash = cid.substring(cid.indexOf("+") + 1, cid.indexOf("@bob.xmpp.org"));
return new BoBHash(hash, hashType);
} | [
"public",
"static",
"BoBHash",
"fromCid",
"(",
"String",
"cid",
")",
"{",
"String",
"hashType",
"=",
"cid",
".",
"substring",
"(",
"0",
",",
"cid",
".",
"indexOf",
"(",
"\"+\"",
")",
")",
";",
"String",
"hash",
"=",
"cid",
".",
"substring",
"(",
"cid... | Get BoB hash from cid attribute string.
@param cid
@return the BoB hash | [
"Get",
"BoB",
"hash",
"from",
"cid",
"attribute",
"string",
"."
] | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/bob/BoBHash.java#L115-L119 |
Azure/azure-sdk-for-java | datalakeanalytics/resource-manager/v2015_10_01_preview/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2015_10_01_preview/implementation/AccountsInner.java | AccountsInner.listStorageAccountsWithServiceResponseAsync | public Observable<ServiceResponse<Page<StorageAccountInfoInner>>> listStorageAccountsWithServiceResponseAsync(final String resourceGroupName, final String accountName, final String filter, final Integer top, final Integer skip, final String expand, final String select, final String orderby, final Boolean count, final String search, final String format) {
return listStorageAccountsSinglePageAsync(resourceGroupName, accountName, filter, top, skip, expand, select, orderby, count, search, format)
.concatMap(new Func1<ServiceResponse<Page<StorageAccountInfoInner>>, Observable<ServiceResponse<Page<StorageAccountInfoInner>>>>() {
@Override
public Observable<ServiceResponse<Page<StorageAccountInfoInner>>> call(ServiceResponse<Page<StorageAccountInfoInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listStorageAccountsNextWithServiceResponseAsync(nextPageLink));
}
});
} | java | public Observable<ServiceResponse<Page<StorageAccountInfoInner>>> listStorageAccountsWithServiceResponseAsync(final String resourceGroupName, final String accountName, final String filter, final Integer top, final Integer skip, final String expand, final String select, final String orderby, final Boolean count, final String search, final String format) {
return listStorageAccountsSinglePageAsync(resourceGroupName, accountName, filter, top, skip, expand, select, orderby, count, search, format)
.concatMap(new Func1<ServiceResponse<Page<StorageAccountInfoInner>>, Observable<ServiceResponse<Page<StorageAccountInfoInner>>>>() {
@Override
public Observable<ServiceResponse<Page<StorageAccountInfoInner>>> call(ServiceResponse<Page<StorageAccountInfoInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listStorageAccountsNextWithServiceResponseAsync(nextPageLink));
}
});
} | [
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"Page",
"<",
"StorageAccountInfoInner",
">",
">",
">",
"listStorageAccountsWithServiceResponseAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"accountName",
",",
"final",
"String",
"filter... | Gets the first page of Azure Storage accounts, if any, linked to the specified Data Lake Analytics account. The response includes a link to the next page, if any.
@param resourceGroupName The name of the Azure resource group that contains the Data Lake Analytics account.
@param accountName The name of the Data Lake Analytics account for which to list Azure Storage accounts.
@param filter The OData filter. Optional.
@param top The number of items to return. Optional.
@param skip The number of items to skip over before returning elements. Optional.
@param expand OData expansion. Expand related resources in line with the retrieved resources, e.g. Categories/$expand=Products would expand Product data in line with each Category entry. Optional.
@param select OData Select statement. Limits the properties on each entry to just those requested, e.g. Categories?$select=CategoryName,Description. Optional.
@param orderby OrderBy clause. One or more comma-separated expressions with an optional "asc" (the default) or "desc" depending on the order you'd like the values sorted, e.g. Categories?$orderby=CategoryName desc. Optional.
@param count The Boolean value of true or false to request a count of the matching resources included with the resources in the response, e.g. Categories?$count=true. Optional.
@param search A free form search. A free-text search expression to match for whether a particular entry should be included in the feed, e.g. Categories?$search=blue OR green. Optional.
@param format The desired return format. Return the response in particular formatxii without access to request headers for standard content-type negotiation (e.g Orders?$format=json). Optional.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<StorageAccountInfoInner> object | [
"Gets",
"the",
"first",
"page",
"of",
"Azure",
"Storage",
"accounts",
"if",
"any",
"linked",
"to",
"the",
"specified",
"Data",
"Lake",
"Analytics",
"account",
".",
"The",
"response",
"includes",
"a",
"link",
"to",
"the",
"next",
"page",
"if",
"any",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datalakeanalytics/resource-manager/v2015_10_01_preview/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2015_10_01_preview/implementation/AccountsInner.java#L1449-L1461 |
fcrepo3/fcrepo | fcrepo-installer/src/main/java/org/fcrepo/utilities/install/InstallOptions.java | InstallOptions.validateAll | private void validateAll() throws OptionValidationException {
boolean unattended = getBooleanValue(UNATTENDED, false);
for (String optionId : getOptionNames()) {
OptionDefinition opt = OptionDefinition.get(optionId, this);
if (opt == null) {
throw new OptionValidationException("Option is not defined", optionId);
}
opt.validateValue(getValue(optionId), unattended);
}
} | java | private void validateAll() throws OptionValidationException {
boolean unattended = getBooleanValue(UNATTENDED, false);
for (String optionId : getOptionNames()) {
OptionDefinition opt = OptionDefinition.get(optionId, this);
if (opt == null) {
throw new OptionValidationException("Option is not defined", optionId);
}
opt.validateValue(getValue(optionId), unattended);
}
} | [
"private",
"void",
"validateAll",
"(",
")",
"throws",
"OptionValidationException",
"{",
"boolean",
"unattended",
"=",
"getBooleanValue",
"(",
"UNATTENDED",
",",
"false",
")",
";",
"for",
"(",
"String",
"optionId",
":",
"getOptionNames",
"(",
")",
")",
"{",
"Op... | Validate the options, assuming defaults have already been applied.
Validation for a given option might entail more than a syntax check. It
might check whether a given directory exists, for example. | [
"Validate",
"the",
"options",
"assuming",
"defaults",
"have",
"already",
"been",
"applied",
".",
"Validation",
"for",
"a",
"given",
"option",
"might",
"entail",
"more",
"than",
"a",
"syntax",
"check",
".",
"It",
"might",
"check",
"whether",
"a",
"given",
"di... | train | https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-installer/src/main/java/org/fcrepo/utilities/install/InstallOptions.java#L474-L483 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/ValueEnforcer.java | ValueEnforcer.notEmpty | public static <T> T [] notEmpty (final T [] aValue, final String sName)
{
return notEmpty (aValue, () -> sName);
} | java | public static <T> T [] notEmpty (final T [] aValue, final String sName)
{
return notEmpty (aValue, () -> sName);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"[",
"]",
"notEmpty",
"(",
"final",
"T",
"[",
"]",
"aValue",
",",
"final",
"String",
"sName",
")",
"{",
"return",
"notEmpty",
"(",
"aValue",
",",
"(",
")",
"->",
"sName",
")",
";",
"}"
] | Check that the passed Array is neither <code>null</code> nor empty.
@param <T>
Type to be checked and returned
@param aValue
The Array to check.
@param sName
The name of the value (e.g. the parameter name)
@return The passed value.
@throws IllegalArgumentException
if the passed value is empty | [
"Check",
"that",
"the",
"passed",
"Array",
"is",
"neither",
"<code",
">",
"null<",
"/",
"code",
">",
"nor",
"empty",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/ValueEnforcer.java#L390-L393 |
Stratio/bdt | src/main/java/com/stratio/qa/specs/CommonG.java | CommonG.removeJSONPathElement | public String removeJSONPathElement(String jsonString, String expr) {
Configuration conf = Configuration.builder().jsonProvider(new GsonJsonProvider()).mappingProvider(new GsonMappingProvider()).build();
DocumentContext context = JsonPath.using(conf).parse(jsonString);
context.delete(expr);
return context.jsonString();
} | java | public String removeJSONPathElement(String jsonString, String expr) {
Configuration conf = Configuration.builder().jsonProvider(new GsonJsonProvider()).mappingProvider(new GsonMappingProvider()).build();
DocumentContext context = JsonPath.using(conf).parse(jsonString);
context.delete(expr);
return context.jsonString();
} | [
"public",
"String",
"removeJSONPathElement",
"(",
"String",
"jsonString",
",",
"String",
"expr",
")",
"{",
"Configuration",
"conf",
"=",
"Configuration",
".",
"builder",
"(",
")",
".",
"jsonProvider",
"(",
"new",
"GsonJsonProvider",
"(",
")",
")",
".",
"mappin... | Remove a subelement in a JsonPath
@param jsonString String of the json
@param expr regex to be removed | [
"Remove",
"a",
"subelement",
"in",
"a",
"JsonPath"
] | train | https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/specs/CommonG.java#L1911-L1917 |
apereo/cas | support/cas-server-support-oauth-uma-core/src/main/java/org/apereo/cas/uma/web/controllers/BaseUmaEndpointController.java | BaseUmaEndpointController.getAuthenticatedProfile | protected CommonProfile getAuthenticatedProfile(final HttpServletRequest request,
final HttpServletResponse response,
final String requiredPermission) {
val context = new J2EContext(request, response, getUmaConfigurationContext().getSessionStore());
val manager = new ProfileManager<>(context, context.getSessionStore());
val profile = manager.get(true).orElse(null);
if (profile == null) {
throw new AuthenticationException("Unable to locate authenticated profile");
}
if (!profile.getPermissions().contains(requiredPermission)) {
throw new AuthenticationException("Authenticated profile does not carry the UMA protection scope");
}
return profile;
} | java | protected CommonProfile getAuthenticatedProfile(final HttpServletRequest request,
final HttpServletResponse response,
final String requiredPermission) {
val context = new J2EContext(request, response, getUmaConfigurationContext().getSessionStore());
val manager = new ProfileManager<>(context, context.getSessionStore());
val profile = manager.get(true).orElse(null);
if (profile == null) {
throw new AuthenticationException("Unable to locate authenticated profile");
}
if (!profile.getPermissions().contains(requiredPermission)) {
throw new AuthenticationException("Authenticated profile does not carry the UMA protection scope");
}
return profile;
} | [
"protected",
"CommonProfile",
"getAuthenticatedProfile",
"(",
"final",
"HttpServletRequest",
"request",
",",
"final",
"HttpServletResponse",
"response",
",",
"final",
"String",
"requiredPermission",
")",
"{",
"val",
"context",
"=",
"new",
"J2EContext",
"(",
"request",
... | Gets authenticated profile.
@param request the request
@param response the response
@param requiredPermission the required permission
@return the authenticated profile | [
"Gets",
"authenticated",
"profile",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-oauth-uma-core/src/main/java/org/apereo/cas/uma/web/controllers/BaseUmaEndpointController.java#L47-L60 |
jenkinsci/artifactory-plugin | src/main/java/org/jfrog/hudson/release/DistributionUtils.java | DistributionUtils.checkSuccess | private static boolean checkSuccess(HttpResponse response, boolean dryRun, TaskListener listener) {
StatusLine status = response.getStatusLine();
String content = "";
try {
content = ExtractorUtils.entityToString(response.getEntity());
ExtractorUtils.validateStringNotBlank(content);
JSONObject json = JSONObject.fromObject(content);
String message = json.getString("message");
if (assertResponseStatus(dryRun, listener, status, message)) {
listener.getLogger().println(message);
return true;
}
} catch (IOException e) {
String parsingErrorStr = "Failed parsing distribution response";
if (StringUtils.isNotBlank(content)) {
parsingErrorStr = ": " + content;
}
e.printStackTrace(listener.error(parsingErrorStr));
}
return false;
} | java | private static boolean checkSuccess(HttpResponse response, boolean dryRun, TaskListener listener) {
StatusLine status = response.getStatusLine();
String content = "";
try {
content = ExtractorUtils.entityToString(response.getEntity());
ExtractorUtils.validateStringNotBlank(content);
JSONObject json = JSONObject.fromObject(content);
String message = json.getString("message");
if (assertResponseStatus(dryRun, listener, status, message)) {
listener.getLogger().println(message);
return true;
}
} catch (IOException e) {
String parsingErrorStr = "Failed parsing distribution response";
if (StringUtils.isNotBlank(content)) {
parsingErrorStr = ": " + content;
}
e.printStackTrace(listener.error(parsingErrorStr));
}
return false;
} | [
"private",
"static",
"boolean",
"checkSuccess",
"(",
"HttpResponse",
"response",
",",
"boolean",
"dryRun",
",",
"TaskListener",
"listener",
")",
"{",
"StatusLine",
"status",
"=",
"response",
".",
"getStatusLine",
"(",
")",
";",
"String",
"content",
"=",
"\"\"",
... | Checks the status of promotion response and return true on success
@param response
@param dryRun
@param listener
@return | [
"Checks",
"the",
"status",
"of",
"promotion",
"response",
"and",
"return",
"true",
"on",
"success"
] | train | https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/release/DistributionUtils.java#L61-L81 |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/bos/BosClient.java | BosClient.completeMultipartUpload | public CompleteMultipartUploadResponse completeMultipartUpload(String bucketName, String key, String uploadId,
List<PartETag> partETags) {
return this.completeMultipartUpload(new CompleteMultipartUploadRequest(bucketName, key, uploadId, partETags));
} | java | public CompleteMultipartUploadResponse completeMultipartUpload(String bucketName, String key, String uploadId,
List<PartETag> partETags) {
return this.completeMultipartUpload(new CompleteMultipartUploadRequest(bucketName, key, uploadId, partETags));
} | [
"public",
"CompleteMultipartUploadResponse",
"completeMultipartUpload",
"(",
"String",
"bucketName",
",",
"String",
"key",
",",
"String",
"uploadId",
",",
"List",
"<",
"PartETag",
">",
"partETags",
")",
"{",
"return",
"this",
".",
"completeMultipartUpload",
"(",
"ne... | Completes a multipart upload by assembling previously uploaded parts.
@param bucketName The name of the bucket containing the multipart upload to complete.
@param key The key of the multipart upload to complete.
@param uploadId The ID of the multipart upload to complete.
@param partETags The list of part numbers and ETags to use when completing the multipart upload.
@return A CompleteMultipartUploadResponse from Bos containing the ETag for
the new object composed of the individual parts. | [
"Completes",
"a",
"multipart",
"upload",
"by",
"assembling",
"previously",
"uploaded",
"parts",
"."
] | train | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bos/BosClient.java#L1223-L1226 |
JRebirth/JRebirth | org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/util/ObjectUtility.java | ObjectUtility.equalsOrBothNull | public static boolean equalsOrBothNull(final Object object1, final Object object2) {
return object1 == null && object2 == null || object1 != null && object1.equals(object2);
} | java | public static boolean equalsOrBothNull(final Object object1, final Object object2) {
return object1 == null && object2 == null || object1 != null && object1.equals(object2);
} | [
"public",
"static",
"boolean",
"equalsOrBothNull",
"(",
"final",
"Object",
"object1",
",",
"final",
"Object",
"object2",
")",
"{",
"return",
"object1",
"==",
"null",
"&&",
"object2",
"==",
"null",
"||",
"object1",
"!=",
"null",
"&&",
"object1",
".",
"equals"... | Return true if the object are equals or both null.
@param object1 first object to compare
@param object2 second object to compare
@return true if the object are equals or both null | [
"Return",
"true",
"if",
"the",
"object",
"are",
"equals",
"or",
"both",
"null",
"."
] | train | https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/util/ObjectUtility.java#L49-L51 |
google/error-prone-javac | src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java | HtmlDocletWriter.addPreQualifiedClassLink | public void addPreQualifiedClassLink(LinkInfoImpl.Kind context, ClassDoc cd, Content contentTree) {
addPreQualifiedClassLink(context, cd, false, contentTree);
} | java | public void addPreQualifiedClassLink(LinkInfoImpl.Kind context, ClassDoc cd, Content contentTree) {
addPreQualifiedClassLink(context, cd, false, contentTree);
} | [
"public",
"void",
"addPreQualifiedClassLink",
"(",
"LinkInfoImpl",
".",
"Kind",
"context",
",",
"ClassDoc",
"cd",
",",
"Content",
"contentTree",
")",
"{",
"addPreQualifiedClassLink",
"(",
"context",
",",
"cd",
",",
"false",
",",
"contentTree",
")",
";",
"}"
] | Add the class link.
@param context the id of the context where the link will be added
@param cd the class doc to link to
@param contentTree the content tree to which the link will be added | [
"Add",
"the",
"class",
"link",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java#L1109-L1111 |
knowm/XChange | xchange-cexio/src/main/java/org/knowm/xchange/cexio/CexIOAdapters.java | CexIOAdapters.adaptTicker | public static Ticker adaptTicker(CexIOTicker ticker) {
if (ticker.getPair() == null) {
throw new IllegalArgumentException("Missing currency pair in ticker: " + ticker);
}
return adaptTicker(ticker, adaptCurrencyPair(ticker.getPair()));
} | java | public static Ticker adaptTicker(CexIOTicker ticker) {
if (ticker.getPair() == null) {
throw new IllegalArgumentException("Missing currency pair in ticker: " + ticker);
}
return adaptTicker(ticker, adaptCurrencyPair(ticker.getPair()));
} | [
"public",
"static",
"Ticker",
"adaptTicker",
"(",
"CexIOTicker",
"ticker",
")",
"{",
"if",
"(",
"ticker",
".",
"getPair",
"(",
")",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Missing currency pair in ticker: \"",
"+",
"ticker",
"... | Adapts a CexIOTicker to a Ticker Object
@param ticker The exchange specific ticker
@return The ticker | [
"Adapts",
"a",
"CexIOTicker",
"to",
"a",
"Ticker",
"Object"
] | train | https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-cexio/src/main/java/org/knowm/xchange/cexio/CexIOAdapters.java#L83-L88 |
looly/hutool | hutool-cron/src/main/java/cn/hutool/cron/Scheduler.java | Scheduler.schedule | public Scheduler schedule(String id, String pattern, Task task) {
return schedule(id, new CronPattern(pattern), task);
} | java | public Scheduler schedule(String id, String pattern, Task task) {
return schedule(id, new CronPattern(pattern), task);
} | [
"public",
"Scheduler",
"schedule",
"(",
"String",
"id",
",",
"String",
"pattern",
",",
"Task",
"task",
")",
"{",
"return",
"schedule",
"(",
"id",
",",
"new",
"CronPattern",
"(",
"pattern",
")",
",",
"task",
")",
";",
"}"
] | 新增Task
@param id ID,为每一个Task定义一个ID
@param pattern {@link CronPattern}对应的String表达式
@param task {@link Task}
@return this | [
"新增Task"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-cron/src/main/java/cn/hutool/cron/Scheduler.java#L243-L245 |
xmlet/XsdAsmFaster | src/main/java/org/xmlet/xsdasmfaster/classes/XsdAsmInterfaces.java | XsdAsmInterfaces.addToCreateElements | private void addToCreateElements(String elementName) {
HashMap<String, String> elementAttributes = new HashMap<>();
elementAttributes.put(XsdAbstractElement.NAME_TAG, elementName);
if (!createdElements.containsKey(getCleanName(elementName))){
createdElements.put(getCleanName(elementName), new XsdElement(null, elementAttributes));
}
} | java | private void addToCreateElements(String elementName) {
HashMap<String, String> elementAttributes = new HashMap<>();
elementAttributes.put(XsdAbstractElement.NAME_TAG, elementName);
if (!createdElements.containsKey(getCleanName(elementName))){
createdElements.put(getCleanName(elementName), new XsdElement(null, elementAttributes));
}
} | [
"private",
"void",
"addToCreateElements",
"(",
"String",
"elementName",
")",
"{",
"HashMap",
"<",
"String",
",",
"String",
">",
"elementAttributes",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"elementAttributes",
".",
"put",
"(",
"XsdAbstractElement",
".",
"N... | Creates a class based on a {@link XsdElement} if it wasn't been already.
@param elementName The name of the element. | [
"Creates",
"a",
"class",
"based",
"on",
"a",
"{"
] | train | https://github.com/xmlet/XsdAsmFaster/blob/ccb78f9dd4b957ad5ac1ca349eaf24338c421e94/src/main/java/org/xmlet/xsdasmfaster/classes/XsdAsmInterfaces.java#L811-L819 |
Azure/azure-sdk-for-java | cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/DatabaseAccountsInner.java | DatabaseAccountsInner.beginCreateOrUpdateAsync | public Observable<DatabaseAccountInner> beginCreateOrUpdateAsync(String resourceGroupName, String accountName, DatabaseAccountCreateUpdateParameters createUpdateParameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, createUpdateParameters).map(new Func1<ServiceResponse<DatabaseAccountInner>, DatabaseAccountInner>() {
@Override
public DatabaseAccountInner call(ServiceResponse<DatabaseAccountInner> response) {
return response.body();
}
});
} | java | public Observable<DatabaseAccountInner> beginCreateOrUpdateAsync(String resourceGroupName, String accountName, DatabaseAccountCreateUpdateParameters createUpdateParameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, createUpdateParameters).map(new Func1<ServiceResponse<DatabaseAccountInner>, DatabaseAccountInner>() {
@Override
public DatabaseAccountInner call(ServiceResponse<DatabaseAccountInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"DatabaseAccountInner",
">",
"beginCreateOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
",",
"DatabaseAccountCreateUpdateParameters",
"createUpdateParameters",
")",
"{",
"return",
"beginCreateOrUpdateWithServiceRespo... | Creates or updates an Azure Cosmos DB database account.
@param resourceGroupName Name of an Azure resource group.
@param accountName Cosmos DB database account name.
@param createUpdateParameters The parameters to provide for the current database account.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the DatabaseAccountInner object | [
"Creates",
"or",
"updates",
"an",
"Azure",
"Cosmos",
"DB",
"database",
"account",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/DatabaseAccountsInner.java#L549-L556 |
strator-dev/greenpepper | greenpepper-open/confluence/greenpepper-confluence-code/src/main/java/com/greenpepper/confluence/macros/GreenPepperWiki.java | GreenPepperWiki.execute | @Override
public String execute(@SuppressWarnings("rawtypes") Map parameters, String body, RenderContext renderContext) throws MacroException
{
try
{
return body;
}
catch (Exception e)
{
return getErrorView("greenpepper.info.macroid", e.getMessage());
}
} | java | @Override
public String execute(@SuppressWarnings("rawtypes") Map parameters, String body, RenderContext renderContext) throws MacroException
{
try
{
return body;
}
catch (Exception e)
{
return getErrorView("greenpepper.info.macroid", e.getMessage());
}
} | [
"@",
"Override",
"public",
"String",
"execute",
"(",
"@",
"SuppressWarnings",
"(",
"\"rawtypes\"",
")",
"Map",
"parameters",
",",
"String",
"body",
",",
"RenderContext",
"renderContext",
")",
"throws",
"MacroException",
"{",
"try",
"{",
"return",
"body",
";",
... | Confluence 2 and 3
@param parameters
@param body
@param renderContext
@return
@throws MacroException | [
"Confluence",
"2",
"and",
"3"
] | train | https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper-open/confluence/greenpepper-confluence-code/src/main/java/com/greenpepper/confluence/macros/GreenPepperWiki.java#L59-L70 |
b3dgs/lionengine | lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/TilesExtractor.java | TilesExtractor.updateProgress | private int updateProgress(int checkedTiles, int tilesNumber, int oldPercent, Collection<ImageBuffer> tiles)
{
final int percent = getProgressPercent(checkedTiles, tilesNumber);
if (percent != oldPercent)
{
for (final ProgressListener listener : listeners)
{
listener.notifyProgress(percent, tiles);
}
}
return percent;
} | java | private int updateProgress(int checkedTiles, int tilesNumber, int oldPercent, Collection<ImageBuffer> tiles)
{
final int percent = getProgressPercent(checkedTiles, tilesNumber);
if (percent != oldPercent)
{
for (final ProgressListener listener : listeners)
{
listener.notifyProgress(percent, tiles);
}
}
return percent;
} | [
"private",
"int",
"updateProgress",
"(",
"int",
"checkedTiles",
",",
"int",
"tilesNumber",
",",
"int",
"oldPercent",
",",
"Collection",
"<",
"ImageBuffer",
">",
"tiles",
")",
"{",
"final",
"int",
"percent",
"=",
"getProgressPercent",
"(",
"checkedTiles",
",",
... | Update progress and notify if needed.
@param checkedTiles The current number of checked tiles.
@param tilesNumber The total number of tile to extract.
@param oldPercent The old progress value.
@param tiles The extracted tiles image.
@return The last progress percent value. | [
"Update",
"progress",
"and",
"notify",
"if",
"needed",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/TilesExtractor.java#L281-L292 |
jsilland/piezo | src/main/java/io/soliton/protobuf/json/Messages.java | Messages.fromJson | public static Message fromJson(Message.Builder builder, JsonObject input) throws Exception {
Descriptors.Descriptor descriptor = builder.getDescriptorForType();
for (Map.Entry<String, JsonElement> entry : input.entrySet()) {
String protoName = CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, entry.getKey());
Descriptors.FieldDescriptor field = descriptor.findFieldByName(protoName);
if (field == null) {
throw new Exception("Can't find descriptor for field " + protoName);
}
if (field.isRepeated()) {
if (!entry.getValue().isJsonArray()) {
// fail
}
JsonArray array = entry.getValue().getAsJsonArray();
for (JsonElement item : array) {
builder.addRepeatedField(field, parseField(field, item, builder));
}
} else {
builder.setField(field, parseField(field, entry.getValue(), builder));
}
}
return builder.build();
} | java | public static Message fromJson(Message.Builder builder, JsonObject input) throws Exception {
Descriptors.Descriptor descriptor = builder.getDescriptorForType();
for (Map.Entry<String, JsonElement> entry : input.entrySet()) {
String protoName = CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, entry.getKey());
Descriptors.FieldDescriptor field = descriptor.findFieldByName(protoName);
if (field == null) {
throw new Exception("Can't find descriptor for field " + protoName);
}
if (field.isRepeated()) {
if (!entry.getValue().isJsonArray()) {
// fail
}
JsonArray array = entry.getValue().getAsJsonArray();
for (JsonElement item : array) {
builder.addRepeatedField(field, parseField(field, item, builder));
}
} else {
builder.setField(field, parseField(field, entry.getValue(), builder));
}
}
return builder.build();
} | [
"public",
"static",
"Message",
"fromJson",
"(",
"Message",
".",
"Builder",
"builder",
",",
"JsonObject",
"input",
")",
"throws",
"Exception",
"{",
"Descriptors",
".",
"Descriptor",
"descriptor",
"=",
"builder",
".",
"getDescriptorForType",
"(",
")",
";",
"for",
... | Converts a JSON object to a protobuf message
@param builder the proto message type builder
@param input the JSON object to convert | [
"Converts",
"a",
"JSON",
"object",
"to",
"a",
"protobuf",
"message"
] | train | https://github.com/jsilland/piezo/blob/9a340f1460d25e07ec475dd24128b838667c959b/src/main/java/io/soliton/protobuf/json/Messages.java#L110-L131 |
h2oai/h2o-3 | h2o-persist-s3/src/main/java/water/persist/PersistS3.java | PersistS3.encodeKey | public static Key encodeKey(String bucket, String key) {
Key res = encodeKeyImpl(bucket, key);
// assert checkBijection(res, bucket, key);
return res;
} | java | public static Key encodeKey(String bucket, String key) {
Key res = encodeKeyImpl(bucket, key);
// assert checkBijection(res, bucket, key);
return res;
} | [
"public",
"static",
"Key",
"encodeKey",
"(",
"String",
"bucket",
",",
"String",
"key",
")",
"{",
"Key",
"res",
"=",
"encodeKeyImpl",
"(",
"bucket",
",",
"key",
")",
";",
"// assert checkBijection(res, bucket, key);",
"return",
"res",
";",
"}"
] | Creates the key for given S3 bucket and key. Returns the H2O key, or null if the key cannot be
created.
@param bucket
Bucket name
@param key
Key name (S3)
@return H2O key pointing to the given bucket and key. | [
"Creates",
"the",
"key",
"for",
"given",
"S3",
"bucket",
"and",
"key",
".",
"Returns",
"the",
"H2O",
"key",
"or",
"null",
"if",
"the",
"key",
"cannot",
"be",
"created",
"."
] | train | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-persist-s3/src/main/java/water/persist/PersistS3.java#L279-L283 |
fcrepo3/fcrepo | fcrepo-common/src/main/java/org/fcrepo/utilities/xml/DOM.java | DOM.selectNodeList | public static NodeList selectNodeList(Node node, String xpath) {
return selector.selectNodeList(node, xpath);
} | java | public static NodeList selectNodeList(Node node, String xpath) {
return selector.selectNodeList(node, xpath);
} | [
"public",
"static",
"NodeList",
"selectNodeList",
"(",
"Node",
"node",
",",
"String",
"xpath",
")",
"{",
"return",
"selector",
".",
"selectNodeList",
"(",
"node",
",",
"xpath",
")",
";",
"}"
] | <p>Select the {@link NodeList} with the given XPath.
</p><p>
Note: This is a convenience method that logs exceptions instead of
throwing them.
</p>
@param node the root document.
@param xpath the xpath for the Node list.
@return the NodeList requested or an empty NodeList if unattainable | [
"<p",
">",
"Select",
"the",
"{"
] | train | https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-common/src/main/java/org/fcrepo/utilities/xml/DOM.java#L336-L338 |
seedstack/seed | security/core/src/main/java/org/seedstack/seed/security/internal/authorization/ConfigurationRoleMapping.java | ConfigurationRoleMapping.findScope | private String findScope(String wildcard, String wildcardAuth, String auth) {
String scope;
String before = StringUtils.substringBefore(wildcardAuth, wildcard);
String after = StringUtils.substringAfter(wildcardAuth, wildcard);
if (StringUtils.startsWith(wildcardAuth, wildcard)) {
scope = StringUtils.substringBefore(auth, after);
} else if (StringUtils.endsWith(wildcardAuth, wildcard)) {
scope = StringUtils.substringAfter(auth, before);
} else {
scope = StringUtils.substringBetween(auth, before, after);
}
return scope;
} | java | private String findScope(String wildcard, String wildcardAuth, String auth) {
String scope;
String before = StringUtils.substringBefore(wildcardAuth, wildcard);
String after = StringUtils.substringAfter(wildcardAuth, wildcard);
if (StringUtils.startsWith(wildcardAuth, wildcard)) {
scope = StringUtils.substringBefore(auth, after);
} else if (StringUtils.endsWith(wildcardAuth, wildcard)) {
scope = StringUtils.substringAfter(auth, before);
} else {
scope = StringUtils.substringBetween(auth, before, after);
}
return scope;
} | [
"private",
"String",
"findScope",
"(",
"String",
"wildcard",
",",
"String",
"wildcardAuth",
",",
"String",
"auth",
")",
"{",
"String",
"scope",
";",
"String",
"before",
"=",
"StringUtils",
".",
"substringBefore",
"(",
"wildcardAuth",
",",
"wildcard",
")",
";",... | Finds the scope in a string that corresponds to a role with {wildcard}.<br>
For example, if wildcardAuth is toto.{SCOPE} and auth is toto.foo then
scope is foo.
@param wildcard the wildcard to search for
@param wildcardAuth auth with {wildcard}
@param auth auth that corresponds
@return the scope. | [
"Finds",
"the",
"scope",
"in",
"a",
"string",
"that",
"corresponds",
"to",
"a",
"role",
"with",
"{",
"wildcard",
"}",
".",
"<br",
">",
"For",
"example",
"if",
"wildcardAuth",
"is",
"toto",
".",
"{",
"SCOPE",
"}",
"and",
"auth",
"is",
"toto",
".",
"fo... | train | https://github.com/seedstack/seed/blob/d9cf33bfb2fffcdbb0976f4726e943acda90e828/security/core/src/main/java/org/seedstack/seed/security/internal/authorization/ConfigurationRoleMapping.java#L162-L174 |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/auth/BoxAuthentication.java | BoxAuthentication.getAuthInfo | public BoxAuthenticationInfo getAuthInfo(String userId, Context context) {
return userId == null ? null : getAuthInfoMap(context).get(userId);
} | java | public BoxAuthenticationInfo getAuthInfo(String userId, Context context) {
return userId == null ? null : getAuthInfoMap(context).get(userId);
} | [
"public",
"BoxAuthenticationInfo",
"getAuthInfo",
"(",
"String",
"userId",
",",
"Context",
"context",
")",
"{",
"return",
"userId",
"==",
"null",
"?",
"null",
":",
"getAuthInfoMap",
"(",
"context",
")",
".",
"get",
"(",
"userId",
")",
";",
"}"
] | Get the BoxAuthenticationInfo for a given user.
@param userId the user id to get auth info for.
@param context current context used for accessing resource.
@return the BoxAuthenticationInfo for a given user. | [
"Get",
"the",
"BoxAuthenticationInfo",
"for",
"a",
"given",
"user",
"."
] | train | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/auth/BoxAuthentication.java#L83-L85 |
dkpro/dkpro-jwpl | de.tudarmstadt.ukp.wikipedia.util/src/main/java/de/tudarmstadt/ukp/wikipedia/util/templates/WikipediaTemplateInfo.java | WikipediaTemplateInfo.revisionContainsTemplateFragment | public boolean revisionContainsTemplateFragment(int revId, String templateFragment) throws WikiApiException{
List<String> tplList = getTemplateNamesFromRevision(revId);
for(String tpl:tplList){
if(tpl.toLowerCase().startsWith(templateFragment.toLowerCase())){
return true;
}
}
return false;
} | java | public boolean revisionContainsTemplateFragment(int revId, String templateFragment) throws WikiApiException{
List<String> tplList = getTemplateNamesFromRevision(revId);
for(String tpl:tplList){
if(tpl.toLowerCase().startsWith(templateFragment.toLowerCase())){
return true;
}
}
return false;
} | [
"public",
"boolean",
"revisionContainsTemplateFragment",
"(",
"int",
"revId",
",",
"String",
"templateFragment",
")",
"throws",
"WikiApiException",
"{",
"List",
"<",
"String",
">",
"tplList",
"=",
"getTemplateNamesFromRevision",
"(",
"revId",
")",
";",
"for",
"(",
... | Determines whether a given revision contains a template starting witht the given fragment
@param revId
@param templateFragment
@return
@throws WikiApiException | [
"Determines",
"whether",
"a",
"given",
"revision",
"contains",
"a",
"template",
"starting",
"witht",
"the",
"given",
"fragment"
] | train | https://github.com/dkpro/dkpro-jwpl/blob/0a0304b6a0aa13acc18838957994e06dd4613a58/de.tudarmstadt.ukp.wikipedia.util/src/main/java/de/tudarmstadt/ukp/wikipedia/util/templates/WikipediaTemplateInfo.java#L1285-L1293 |
alkacon/opencms-core | src-gwt/org/opencms/ade/sitemap/client/control/CmsSitemapController.java | CmsSitemapController.getInheritedProperty | public String getInheritedProperty(CmsClientSitemapEntry entry, String name) {
CmsClientProperty prop = getInheritedPropertyObject(entry, name);
if (prop == null) {
return null;
}
return prop.getEffectiveValue();
} | java | public String getInheritedProperty(CmsClientSitemapEntry entry, String name) {
CmsClientProperty prop = getInheritedPropertyObject(entry, name);
if (prop == null) {
return null;
}
return prop.getEffectiveValue();
} | [
"public",
"String",
"getInheritedProperty",
"(",
"CmsClientSitemapEntry",
"entry",
",",
"String",
"name",
")",
"{",
"CmsClientProperty",
"prop",
"=",
"getInheritedPropertyObject",
"(",
"entry",
",",
"name",
")",
";",
"if",
"(",
"prop",
"==",
"null",
")",
"{",
... | Gets the value for a property which a sitemap entry would inherit if it didn't have its own properties.<p>
@param entry the sitemap entry
@param name the property name
@return the inherited property value | [
"Gets",
"the",
"value",
"for",
"a",
"property",
"which",
"a",
"sitemap",
"entry",
"would",
"inherit",
"if",
"it",
"didn",
"t",
"have",
"its",
"own",
"properties",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/sitemap/client/control/CmsSitemapController.java#L1176-L1183 |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/CmsEditorBase.java | CmsEditorBase.saveEntities | public void saveEntities(List<CmsEntity> entities, final boolean clearOnSuccess, final Command callback) {
AsyncCallback<CmsValidationResult> asyncCallback = new AsyncCallback<CmsValidationResult>() {
public void onFailure(Throwable caught) {
onRpcError(caught);
}
public void onSuccess(CmsValidationResult result) {
callback.execute();
if ((result != null) && result.hasErrors()) {
// CmsValidationHandler.getInstance().displayErrors(null, result)
}
if (clearOnSuccess) {
destroyForm(true);
}
}
};
getService().saveEntities(entities, asyncCallback);
} | java | public void saveEntities(List<CmsEntity> entities, final boolean clearOnSuccess, final Command callback) {
AsyncCallback<CmsValidationResult> asyncCallback = new AsyncCallback<CmsValidationResult>() {
public void onFailure(Throwable caught) {
onRpcError(caught);
}
public void onSuccess(CmsValidationResult result) {
callback.execute();
if ((result != null) && result.hasErrors()) {
// CmsValidationHandler.getInstance().displayErrors(null, result)
}
if (clearOnSuccess) {
destroyForm(true);
}
}
};
getService().saveEntities(entities, asyncCallback);
} | [
"public",
"void",
"saveEntities",
"(",
"List",
"<",
"CmsEntity",
">",
"entities",
",",
"final",
"boolean",
"clearOnSuccess",
",",
"final",
"Command",
"callback",
")",
"{",
"AsyncCallback",
"<",
"CmsValidationResult",
">",
"asyncCallback",
"=",
"new",
"AsyncCallbac... | Saves the given entities.<p>
@param entities the entities to save
@param clearOnSuccess <code>true</code> to clear the entity back-end instance on success
@param callback the call back command | [
"Saves",
"the",
"given",
"entities",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/CmsEditorBase.java#L507-L528 |
kakawait/cas-security-spring-boot-starter | spring-security-cas-extension/src/main/java/com/kakawait/spring/security/cas/client/ticket/AttributePrincipalProxyTicketProvider.java | AttributePrincipalProxyTicketProvider.getProxyTicket | @Override
public String getProxyTicket(String service) {
Assert.hasText(service, "service cannot not be null or blank");
Assertion assertion = assertionProvider.getAssertion();
AttributePrincipal principal = assertion.getPrincipal();
if (principal == null) {
throw new IllegalStateException(String.format(EXCEPTION_MESSAGE, AttributePrincipal.class.getSimpleName()));
}
return principal.getProxyTicketFor(service);
} | java | @Override
public String getProxyTicket(String service) {
Assert.hasText(service, "service cannot not be null or blank");
Assertion assertion = assertionProvider.getAssertion();
AttributePrincipal principal = assertion.getPrincipal();
if (principal == null) {
throw new IllegalStateException(String.format(EXCEPTION_MESSAGE, AttributePrincipal.class.getSimpleName()));
}
return principal.getProxyTicketFor(service);
} | [
"@",
"Override",
"public",
"String",
"getProxyTicket",
"(",
"String",
"service",
")",
"{",
"Assert",
".",
"hasText",
"(",
"service",
",",
"\"service cannot not be null or blank\"",
")",
";",
"Assertion",
"assertion",
"=",
"assertionProvider",
".",
"getAssertion",
"(... | {@inheritDoc}
@throws IllegalArgumentException if {@code service} is null or blank
@throws IllegalStateException if {@link Assertion} from {@link AssertionProvider#getAssertion()} is
{@code null} or {@link AttributePrincipal} from previous
{@link Assertion#getPrincipal()} is {@code null}. | [
"{",
"@inheritDoc",
"}"
] | train | https://github.com/kakawait/cas-security-spring-boot-starter/blob/f42e7829f6f3ff1f64803a09577bca3c6f60e347/spring-security-cas-extension/src/main/java/com/kakawait/spring/security/cas/client/ticket/AttributePrincipalProxyTicketProvider.java#L34-L45 |
redkale/redkale | src/org/redkale/net/http/WebSocket.java | WebSocket.send | public final CompletableFuture<Integer> send(Object message, boolean last) {
return send(false, message, last);
} | java | public final CompletableFuture<Integer> send(Object message, boolean last) {
return send(false, message, last);
} | [
"public",
"final",
"CompletableFuture",
"<",
"Integer",
">",
"send",
"(",
"Object",
"message",
",",
"boolean",
"last",
")",
"{",
"return",
"send",
"(",
"false",
",",
"message",
",",
"last",
")",
";",
"}"
] | 给自身发送消息, 消息类型是String或byte[]或可JavaBean对象
@param message 不可为空, 只能是String或byte[]或可JavaBean对象
@param last 是否最后一条
@return 0表示成功, 非0表示错误码 | [
"给自身发送消息",
"消息类型是String或byte",
"[]",
"或可JavaBean对象"
] | train | https://github.com/redkale/redkale/blob/ea5169b5c5ea7412fd762331c0c497165832e901/src/org/redkale/net/http/WebSocket.java#L162-L164 |
hawkular/hawkular-agent | hawkular-agent-core/src/main/java/org/hawkular/agent/monitor/inventory/IDObject.java | IDObject.addProperty | public void addProperty(String name, Object value) {
if (value != null) {
properties.put(name, value);
} else {
removeProperty(name);
}
} | java | public void addProperty(String name, Object value) {
if (value != null) {
properties.put(name, value);
} else {
removeProperty(name);
}
} | [
"public",
"void",
"addProperty",
"(",
"String",
"name",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"properties",
".",
"put",
"(",
"name",
",",
"value",
")",
";",
"}",
"else",
"{",
"removeProperty",
"(",
"name",
")",... | Adds an optional property to this object.
If null, any property with the given name will be removed.
If the property already exists, this new value will replace the old value.
@param name the name of the property
@param value the value of the property; must be JSON-serializable if not-null | [
"Adds",
"an",
"optional",
"property",
"to",
"this",
"object",
".",
"If",
"null",
"any",
"property",
"with",
"the",
"given",
"name",
"will",
"be",
"removed",
".",
"If",
"the",
"property",
"already",
"exists",
"this",
"new",
"value",
"will",
"replace",
"the"... | train | https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-agent-core/src/main/java/org/hawkular/agent/monitor/inventory/IDObject.java#L69-L75 |
undertow-io/undertow | core/src/main/java/io/undertow/util/LegacyCookieSupport.java | LegacyCookieSupport.escapeDoubleQuotes | private static String escapeDoubleQuotes(String s, int beginIndex, int endIndex) {
if (s == null || s.length() == 0 || s.indexOf('"') == -1) {
return s;
}
StringBuilder b = new StringBuilder();
for (int i = beginIndex; i < endIndex; i++) {
char c = s.charAt(i);
if (c == '\\' ) {
b.append(c);
//ignore the character after an escape, just append it
if (++i>=endIndex) throw UndertowMessages.MESSAGES.invalidEscapeCharacter();
b.append(s.charAt(i));
} else if (c == '"')
b.append('\\').append('"');
else
b.append(c);
}
return b.toString();
} | java | private static String escapeDoubleQuotes(String s, int beginIndex, int endIndex) {
if (s == null || s.length() == 0 || s.indexOf('"') == -1) {
return s;
}
StringBuilder b = new StringBuilder();
for (int i = beginIndex; i < endIndex; i++) {
char c = s.charAt(i);
if (c == '\\' ) {
b.append(c);
//ignore the character after an escape, just append it
if (++i>=endIndex) throw UndertowMessages.MESSAGES.invalidEscapeCharacter();
b.append(s.charAt(i));
} else if (c == '"')
b.append('\\').append('"');
else
b.append(c);
}
return b.toString();
} | [
"private",
"static",
"String",
"escapeDoubleQuotes",
"(",
"String",
"s",
",",
"int",
"beginIndex",
",",
"int",
"endIndex",
")",
"{",
"if",
"(",
"s",
"==",
"null",
"||",
"s",
".",
"length",
"(",
")",
"==",
"0",
"||",
"s",
".",
"indexOf",
"(",
"'",
"... | Escapes any double quotes in the given string.
@param s the input string
@param beginIndex start index inclusive
@param endIndex exclusive
@return The (possibly) escaped string | [
"Escapes",
"any",
"double",
"quotes",
"in",
"the",
"given",
"string",
"."
] | train | https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/util/LegacyCookieSupport.java#L211-L232 |
twitter/hraven | hraven-core/src/main/java/com/twitter/hraven/datasource/JobHistoryRawService.java | JobHistoryRawService.getAggregatedStatusPut | public Put getAggregatedStatusPut(byte[] row, byte[] col, Boolean status) {
Put put = new Put(row);
put.addColumn(Constants.INFO_FAM_BYTES, col, Bytes.toBytes(status));
try {
LOG.info(" agg status " + status + " and put " + put.toJSON());
} catch (IOException e) {
// ignore json exception
}
return put;
} | java | public Put getAggregatedStatusPut(byte[] row, byte[] col, Boolean status) {
Put put = new Put(row);
put.addColumn(Constants.INFO_FAM_BYTES, col, Bytes.toBytes(status));
try {
LOG.info(" agg status " + status + " and put " + put.toJSON());
} catch (IOException e) {
// ignore json exception
}
return put;
} | [
"public",
"Put",
"getAggregatedStatusPut",
"(",
"byte",
"[",
"]",
"row",
",",
"byte",
"[",
"]",
"col",
",",
"Boolean",
"status",
")",
"{",
"Put",
"put",
"=",
"new",
"Put",
"(",
"row",
")",
";",
"put",
".",
"addColumn",
"(",
"Constants",
".",
"INFO_FA... | creates a put to be updated into the RAW table for aggregation status
@param row key
@param status of aggregation
@return {@link Put} | [
"creates",
"a",
"put",
"to",
"be",
"updated",
"into",
"the",
"RAW",
"table",
"for",
"aggregation",
"status"
] | train | https://github.com/twitter/hraven/blob/e35996b6e2f016bcd18db0bad320be7c93d95208/hraven-core/src/main/java/com/twitter/hraven/datasource/JobHistoryRawService.java#L591-L600 |
infinispan/infinispan | core/src/main/java/org/infinispan/expiration/impl/ClusterExpirationManager.java | ClusterExpirationManager.handleLifespanExpireEntry | CompletableFuture<Void> handleLifespanExpireEntry(K key, V value, long lifespan, boolean skipLocking) {
// The most used case will be a miss so no extra read before
if (expiring.putIfAbsent(key, key) == null) {
if (trace) {
log.tracef("Submitting expiration removal for key %s which had lifespan of %s", toStr(key), lifespan);
}
AdvancedCache<K, V> cacheToUse = skipLocking ? cache.withFlags(Flag.SKIP_LOCKING) : cache;
CompletableFuture<Void> future = cacheToUse.removeLifespanExpired(key, value, lifespan);
return future.whenComplete((v, t) -> expiring.remove(key, key));
}
return CompletableFutures.completedNull();
} | java | CompletableFuture<Void> handleLifespanExpireEntry(K key, V value, long lifespan, boolean skipLocking) {
// The most used case will be a miss so no extra read before
if (expiring.putIfAbsent(key, key) == null) {
if (trace) {
log.tracef("Submitting expiration removal for key %s which had lifespan of %s", toStr(key), lifespan);
}
AdvancedCache<K, V> cacheToUse = skipLocking ? cache.withFlags(Flag.SKIP_LOCKING) : cache;
CompletableFuture<Void> future = cacheToUse.removeLifespanExpired(key, value, lifespan);
return future.whenComplete((v, t) -> expiring.remove(key, key));
}
return CompletableFutures.completedNull();
} | [
"CompletableFuture",
"<",
"Void",
">",
"handleLifespanExpireEntry",
"(",
"K",
"key",
",",
"V",
"value",
",",
"long",
"lifespan",
",",
"boolean",
"skipLocking",
")",
"{",
"// The most used case will be a miss so no extra read before",
"if",
"(",
"expiring",
".",
"putIf... | holds the lock until this CompletableFuture completes. Without lock skipping this would deadlock. | [
"holds",
"the",
"lock",
"until",
"this",
"CompletableFuture",
"completes",
".",
"Without",
"lock",
"skipping",
"this",
"would",
"deadlock",
"."
] | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/expiration/impl/ClusterExpirationManager.java#L137-L148 |
maochen/NLP | CoreNLP-NLP/src/main/java/org/maochen/nlp/ml/classifier/perceptron/PerceptronClassifier.java | PerceptronClassifier.onlineTrain | public void onlineTrain(final double[] x, final int labelIndex) {
Map<Integer, Double> result = predict(x);
Map.Entry<Integer, Double> maxResult = result.entrySet().stream().max((e1, e2) -> e1.getValue().compareTo(e2.getValue())).orElse(null);
if (maxResult.getKey() != labelIndex) {
double e_correction_d = 1;
model.weights[labelIndex] = reweight(x, model.weights[labelIndex], e_correction_d);
model.bias[labelIndex] = e_correction_d;
double w_correction_d = -1;
model.weights[maxResult.getKey()] = reweight(x, model.weights[maxResult.getKey()], w_correction_d);
model.bias[maxResult.getKey()] = w_correction_d;
}
if (LOG.isDebugEnabled()) {
LOG.debug("New bias: " + Arrays.toString(model.bias));
LOG.debug("New weight: " + Arrays.stream(model.weights).map(Arrays::toString).reduce((wi, wii) -> wi + ", " + wii).get());
}
} | java | public void onlineTrain(final double[] x, final int labelIndex) {
Map<Integer, Double> result = predict(x);
Map.Entry<Integer, Double> maxResult = result.entrySet().stream().max((e1, e2) -> e1.getValue().compareTo(e2.getValue())).orElse(null);
if (maxResult.getKey() != labelIndex) {
double e_correction_d = 1;
model.weights[labelIndex] = reweight(x, model.weights[labelIndex], e_correction_d);
model.bias[labelIndex] = e_correction_d;
double w_correction_d = -1;
model.weights[maxResult.getKey()] = reweight(x, model.weights[maxResult.getKey()], w_correction_d);
model.bias[maxResult.getKey()] = w_correction_d;
}
if (LOG.isDebugEnabled()) {
LOG.debug("New bias: " + Arrays.toString(model.bias));
LOG.debug("New weight: " + Arrays.stream(model.weights).map(Arrays::toString).reduce((wi, wii) -> wi + ", " + wii).get());
}
} | [
"public",
"void",
"onlineTrain",
"(",
"final",
"double",
"[",
"]",
"x",
",",
"final",
"int",
"labelIndex",
")",
"{",
"Map",
"<",
"Integer",
",",
"Double",
">",
"result",
"=",
"predict",
"(",
"x",
")",
";",
"Map",
".",
"Entry",
"<",
"Integer",
",",
... | public use for doing one training sample.
@param x Feature Vector
@param labelIndex label's index, from PerceptronModel.LabelIndexer | [
"public",
"use",
"for",
"doing",
"one",
"training",
"sample",
"."
] | train | https://github.com/maochen/NLP/blob/38ae7b384d5295334d9efa9dc4cd901b19d9c27e/CoreNLP-NLP/src/main/java/org/maochen/nlp/ml/classifier/perceptron/PerceptronClassifier.java#L65-L83 |
HotelsDotCom/corc | corc-cascading/src/main/java/com/hotels/corc/cascading/OrcFile.java | OrcFile.sinkPrepare | @Override
public void sinkPrepare(FlowProcess<? extends Configuration> flowProcess, SinkCall<Corc, OutputCollector> sinkCall)
throws IOException {
sinkCall.setContext(new Corc(typeInfo, converterFactory));
} | java | @Override
public void sinkPrepare(FlowProcess<? extends Configuration> flowProcess, SinkCall<Corc, OutputCollector> sinkCall)
throws IOException {
sinkCall.setContext(new Corc(typeInfo, converterFactory));
} | [
"@",
"Override",
"public",
"void",
"sinkPrepare",
"(",
"FlowProcess",
"<",
"?",
"extends",
"Configuration",
">",
"flowProcess",
",",
"SinkCall",
"<",
"Corc",
",",
"OutputCollector",
">",
"sinkCall",
")",
"throws",
"IOException",
"{",
"sinkCall",
".",
"setContext... | Creates an {@link Corc} instance and stores it in the context to be reused for all rows. | [
"Creates",
"an",
"{"
] | train | https://github.com/HotelsDotCom/corc/blob/37ecb5966315e4cf630a878ffcbada61c50bdcd3/corc-cascading/src/main/java/com/hotels/corc/cascading/OrcFile.java#L206-L210 |
querydsl/querydsl | querydsl-sql/src/main/java/com/querydsl/sql/dml/SQLMergeClause.java | SQLMergeClause.addFlag | public SQLMergeClause addFlag(Position position, Expression<?> flag) {
metadata.addFlag(new QueryFlag(position, flag));
return this;
} | java | public SQLMergeClause addFlag(Position position, Expression<?> flag) {
metadata.addFlag(new QueryFlag(position, flag));
return this;
} | [
"public",
"SQLMergeClause",
"addFlag",
"(",
"Position",
"position",
",",
"Expression",
"<",
"?",
">",
"flag",
")",
"{",
"metadata",
".",
"addFlag",
"(",
"new",
"QueryFlag",
"(",
"position",
",",
"flag",
")",
")",
";",
"return",
"this",
";",
"}"
] | Add the given Expression at the given position as a query flag
@param position position
@param flag query flag
@return the current object | [
"Add",
"the",
"given",
"Expression",
"at",
"the",
"given",
"position",
"as",
"a",
"query",
"flag"
] | train | https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/dml/SQLMergeClause.java#L100-L103 |
ibm-bluemix-mobile-services/bms-clientsdk-android-core | lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/security/mca/internal/AuthorizationHeaderHelper.java | AuthorizationHeaderHelper.isAuthorizationRequired | private static boolean isAuthorizationRequired(int statusCode, List<String> wwwAuthenticateHeaders) {
if (statusCode == 401 || statusCode == 403) {
//It is possible that there will be more then one header for this header-name. This is why we need the loop here.
for (String header : wwwAuthenticateHeaders) {
if (header.toLowerCase().startsWith(BEARER.toLowerCase()) && header.toLowerCase().contains(AUTH_REALM.toLowerCase())) {
return true;
}
}
}
return false;
} | java | private static boolean isAuthorizationRequired(int statusCode, List<String> wwwAuthenticateHeaders) {
if (statusCode == 401 || statusCode == 403) {
//It is possible that there will be more then one header for this header-name. This is why we need the loop here.
for (String header : wwwAuthenticateHeaders) {
if (header.toLowerCase().startsWith(BEARER.toLowerCase()) && header.toLowerCase().contains(AUTH_REALM.toLowerCase())) {
return true;
}
}
}
return false;
} | [
"private",
"static",
"boolean",
"isAuthorizationRequired",
"(",
"int",
"statusCode",
",",
"List",
"<",
"String",
">",
"wwwAuthenticateHeaders",
")",
"{",
"if",
"(",
"statusCode",
"==",
"401",
"||",
"statusCode",
"==",
"403",
")",
"{",
"//It is possible that there ... | Check if the params came from response that requires authorization
@param statusCode status code of the responce
@param wwwAuthenticateHeaders list of WWW-Authenticate headers
@return true if status is 401 or 403 and The value of the header starts with 'Bearer' and that it contains ""imfAuthentication"" | [
"Check",
"if",
"the",
"params",
"came",
"from",
"response",
"that",
"requires",
"authorization"
] | train | https://github.com/ibm-bluemix-mobile-services/bms-clientsdk-android-core/blob/8db4f00d0d564792397bfc0e5bd57d52a238b858/lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/security/mca/internal/AuthorizationHeaderHelper.java#L72-L85 |
aws/aws-sdk-java | aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/model/ScanRequest.java | ScanRequest.withExclusiveStartKey | public ScanRequest withExclusiveStartKey(java.util.Map.Entry<String, AttributeValue> hashKey, java.util.Map.Entry<String, AttributeValue> rangeKey)
throws IllegalArgumentException {
setExclusiveStartKey(hashKey, rangeKey);
return this;
} | java | public ScanRequest withExclusiveStartKey(java.util.Map.Entry<String, AttributeValue> hashKey, java.util.Map.Entry<String, AttributeValue> rangeKey)
throws IllegalArgumentException {
setExclusiveStartKey(hashKey, rangeKey);
return this;
} | [
"public",
"ScanRequest",
"withExclusiveStartKey",
"(",
"java",
".",
"util",
".",
"Map",
".",
"Entry",
"<",
"String",
",",
"AttributeValue",
">",
"hashKey",
",",
"java",
".",
"util",
".",
"Map",
".",
"Entry",
"<",
"String",
",",
"AttributeValue",
">",
"rang... | The primary hash and range keys of the first item that this operation will evaluate. Use the value that was
returned for <i>LastEvaluatedKey</i> in the previous operation.
<p>
The data type for <i>ExclusiveStartKey</i> must be String, Number or Binary. No set data types are allowed.
<p>
Returns a reference to this object so that method calls can be chained together.
@param hashKey
a map entry including the name and value of the primary hash key.
@param rangeKey
a map entry including the name and value of the primary range key, or null if it is a hash-only table. | [
"The",
"primary",
"hash",
"and",
"range",
"keys",
"of",
"the",
"first",
"item",
"that",
"this",
"operation",
"will",
"evaluate",
".",
"Use",
"the",
"value",
"that",
"was",
"returned",
"for",
"<i",
">",
"LastEvaluatedKey<",
"/",
"i",
">",
"in",
"the",
"pr... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/model/ScanRequest.java#L2952-L2956 |
ironjacamar/ironjacamar | codegenerator/src/main/java/org/ironjacamar/codegenerator/BaseProfile.java | BaseProfile.generateGradle | void generateGradle(Definition def, String outputDir)
{
try
{
FileWriter bgfw = Utils.createFile("build.gradle", outputDir);
BuildGradleGen bgGen = new BuildGradleGen();
bgGen.generate(def, bgfw);
bgfw.close();
}
catch (IOException ioe)
{
ioe.printStackTrace();
}
} | java | void generateGradle(Definition def, String outputDir)
{
try
{
FileWriter bgfw = Utils.createFile("build.gradle", outputDir);
BuildGradleGen bgGen = new BuildGradleGen();
bgGen.generate(def, bgfw);
bgfw.close();
}
catch (IOException ioe)
{
ioe.printStackTrace();
}
} | [
"void",
"generateGradle",
"(",
"Definition",
"def",
",",
"String",
"outputDir",
")",
"{",
"try",
"{",
"FileWriter",
"bgfw",
"=",
"Utils",
".",
"createFile",
"(",
"\"build.gradle\"",
",",
"outputDir",
")",
";",
"BuildGradleGen",
"bgGen",
"=",
"new",
"BuildGradl... | generate gradle build.gradle
@param def Definition
@param outputDir output directory | [
"generate",
"gradle",
"build",
".",
"gradle"
] | train | https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/codegenerator/src/main/java/org/ironjacamar/codegenerator/BaseProfile.java#L410-L423 |
lecho/hellocharts-android | hellocharts-library/src/lecho/lib/hellocharts/model/Viewport.java | Viewport.offsetTo | public void offsetTo(float newLeft, float newTop) {
right += newLeft - left;
bottom += newTop - top;
left = newLeft;
top = newTop;
} | java | public void offsetTo(float newLeft, float newTop) {
right += newLeft - left;
bottom += newTop - top;
left = newLeft;
top = newTop;
} | [
"public",
"void",
"offsetTo",
"(",
"float",
"newLeft",
",",
"float",
"newTop",
")",
"{",
"right",
"+=",
"newLeft",
"-",
"left",
";",
"bottom",
"+=",
"newTop",
"-",
"top",
";",
"left",
"=",
"newLeft",
";",
"top",
"=",
"newTop",
";",
"}"
] | Offset the viewport to a specific (left, top) position, keeping its width and height the same.
@param newLeft The new "left" coordinate for the viewport
@param newTop The new "top" coordinate for the viewport | [
"Offset",
"the",
"viewport",
"to",
"a",
"specific",
"(",
"left",
"top",
")",
"position",
"keeping",
"its",
"width",
"and",
"height",
"the",
"same",
"."
] | train | https://github.com/lecho/hellocharts-android/blob/c41419c9afa097452dee823c7eba0e5136aa96bd/hellocharts-library/src/lecho/lib/hellocharts/model/Viewport.java#L189-L194 |
liferay/com-liferay-commerce | commerce-price-list-service/src/main/java/com/liferay/commerce/price/list/service/persistence/impl/CommercePriceEntryPersistenceImpl.java | CommercePriceEntryPersistenceImpl.findByCompanyId | @Override
public List<CommercePriceEntry> findByCompanyId(long companyId, int start,
int end) {
return findByCompanyId(companyId, start, end, null);
} | java | @Override
public List<CommercePriceEntry> findByCompanyId(long companyId, int start,
int end) {
return findByCompanyId(companyId, start, end, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CommercePriceEntry",
">",
"findByCompanyId",
"(",
"long",
"companyId",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"return",
"findByCompanyId",
"(",
"companyId",
",",
"start",
",",
"end",
",",
"null",
")",
";"... | Returns a range of all the commerce price entries where companyId = ?.
<p>
Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommercePriceEntryModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
</p>
@param companyId the company ID
@param start the lower bound of the range of commerce price entries
@param end the upper bound of the range of commerce price entries (not inclusive)
@return the range of matching commerce price entries | [
"Returns",
"a",
"range",
"of",
"all",
"the",
"commerce",
"price",
"entries",
"where",
"companyId",
"=",
"?",
";",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-price-list-service/src/main/java/com/liferay/commerce/price/list/service/persistence/impl/CommercePriceEntryPersistenceImpl.java#L2046-L2050 |
apache/groovy | subprojects/groovy-templates/src/main/groovy/groovy/text/markup/BaseTemplate.java | BaseTemplate.methodMissing | public Object methodMissing(String tagName, Object args) throws IOException {
Object o = model.get(tagName);
if (o instanceof Closure) {
if (args instanceof Object[]) {
yieldUnescaped(((Closure) o).call((Object[])args));
return this;
}
yieldUnescaped(((Closure) o).call(args));
return this;
} else if (args instanceof Object[]) {
final Writer wrt = out;
TagData tagData = new TagData(args).invoke();
Object body = tagData.getBody();
writeIndent();
wrt.write('<');
wrt.write(tagName);
writeAttributes(tagData.getAttributes());
if (body != null) {
wrt.write('>');
writeBody(body);
writeIndent();
wrt.write("</");
wrt.write(tagName);
wrt.write('>');
} else {
if (configuration.isExpandEmptyElements()) {
wrt.write("></");
wrt.write(tagName);
wrt.write('>');
} else {
wrt.write("/>");
}
}
}
return this;
} | java | public Object methodMissing(String tagName, Object args) throws IOException {
Object o = model.get(tagName);
if (o instanceof Closure) {
if (args instanceof Object[]) {
yieldUnescaped(((Closure) o).call((Object[])args));
return this;
}
yieldUnescaped(((Closure) o).call(args));
return this;
} else if (args instanceof Object[]) {
final Writer wrt = out;
TagData tagData = new TagData(args).invoke();
Object body = tagData.getBody();
writeIndent();
wrt.write('<');
wrt.write(tagName);
writeAttributes(tagData.getAttributes());
if (body != null) {
wrt.write('>');
writeBody(body);
writeIndent();
wrt.write("</");
wrt.write(tagName);
wrt.write('>');
} else {
if (configuration.isExpandEmptyElements()) {
wrt.write("></");
wrt.write(tagName);
wrt.write('>');
} else {
wrt.write("/>");
}
}
}
return this;
} | [
"public",
"Object",
"methodMissing",
"(",
"String",
"tagName",
",",
"Object",
"args",
")",
"throws",
"IOException",
"{",
"Object",
"o",
"=",
"model",
".",
"get",
"(",
"tagName",
")",
";",
"if",
"(",
"o",
"instanceof",
"Closure",
")",
"{",
"if",
"(",
"a... | This is the main method responsible for writing a tag and its attributes.
The arguments may be:
<ul>
<li>a closure</li> in which case the closure is rendered inside the tag body
<li>a string</li>, in which case the string is rendered as the tag body
<li>a map of attributes</li> in which case the attributes are rendered inside the opening tag
</ul>
<p>or a combination of (attributes,string), (attributes,closure)</p>
@param tagName the name of the tag
@param args tag generation arguments
@return this template instance
@throws IOException | [
"This",
"is",
"the",
"main",
"method",
"responsible",
"for",
"writing",
"a",
"tag",
"and",
"its",
"attributes",
".",
"The",
"arguments",
"may",
"be",
":",
"<ul",
">",
"<li",
">",
"a",
"closure<",
"/",
"li",
">",
"in",
"which",
"case",
"the",
"closure",... | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-templates/src/main/groovy/groovy/text/markup/BaseTemplate.java#L232-L267 |
RestComm/sipunit | src/main/java/org/cafesip/sipunit/SipSession.java | SipSession.sendReply | public SipTransaction sendReply(RequestEvent request, int statusCode, String reasonPhrase,
String toTag, Address contact, int expires) {
return sendReply(request, statusCode, reasonPhrase, toTag, contact, expires, null, null, null);
} | java | public SipTransaction sendReply(RequestEvent request, int statusCode, String reasonPhrase,
String toTag, Address contact, int expires) {
return sendReply(request, statusCode, reasonPhrase, toTag, contact, expires, null, null, null);
} | [
"public",
"SipTransaction",
"sendReply",
"(",
"RequestEvent",
"request",
",",
"int",
"statusCode",
",",
"String",
"reasonPhrase",
",",
"String",
"toTag",
",",
"Address",
"contact",
",",
"int",
"expires",
")",
"{",
"return",
"sendReply",
"(",
"request",
",",
"s... | This method sends a basic, stateful response to a previously received request. Call this method
after calling waitRequest(). The response is constructed based on the parameters passed in. The
returned SipTransaction object must be used in any subsequent calls to sendReply() for the same
received request, if there are any.
@param request The RequestEvent object that was returned by a previous call to waitRequest().
@param statusCode The status code of the response to send (may use SipResponse constants).
@param reasonPhrase If not null, the reason phrase to send.
@param toTag If not null, it will be put into the 'To' header of the response. Required by
final responses such as OK.
@param contact If not null, it will be used to create a 'Contact' header to be added to the
response.
@param expires If not -1, an 'Expires' header is added to the response containing this value,
which is the time the message is valid, in seconds.
@return A SipTransaction object that must be passed in to any subsequent call to sendReply()
for the same received request, or null if an error was encountered while sending the
response. The calling program doesn't need to do anything with the returned
SipTransaction other than pass it in to a subsequent call to sendReply() for the same
received request. | [
"This",
"method",
"sends",
"a",
"basic",
"stateful",
"response",
"to",
"a",
"previously",
"received",
"request",
".",
"Call",
"this",
"method",
"after",
"calling",
"waitRequest",
"()",
".",
"The",
"response",
"is",
"constructed",
"based",
"on",
"the",
"paramet... | train | https://github.com/RestComm/sipunit/blob/18a6be2e29be3fbdc14226e8c41b25e2d57378b1/src/main/java/org/cafesip/sipunit/SipSession.java#L1250-L1253 |
jbundle/jbundle | thin/base/db/misc/src/main/java/org/jbundle/thin/base/db/client/memory/MemoryRemoteTable.java | MemoryRemoteTable.get | public Object get(int iRowIndex, int iRowCount) throws DBException, RemoteException
{
if ((m_iterator == null)
|| (m_iCurrentRecord == -1)
|| (iRowIndex <= m_iCurrentRecord))
{
m_iterator = m_mDataMap.keySet().iterator();
m_iCurrentRecord = -1;
}
while (m_iterator.hasNext())
{
m_iCurrentRecord++;
m_objCurrentKey = m_iterator.next();
if (m_iCurrentRecord == iRowIndex)
return m_mDataMap.get(m_objCurrentKey);
}
m_iterator = null;
m_iCurrentRecord = -1;
m_objCurrentKey = null;
return m_objCurrentKey;
} | java | public Object get(int iRowIndex, int iRowCount) throws DBException, RemoteException
{
if ((m_iterator == null)
|| (m_iCurrentRecord == -1)
|| (iRowIndex <= m_iCurrentRecord))
{
m_iterator = m_mDataMap.keySet().iterator();
m_iCurrentRecord = -1;
}
while (m_iterator.hasNext())
{
m_iCurrentRecord++;
m_objCurrentKey = m_iterator.next();
if (m_iCurrentRecord == iRowIndex)
return m_mDataMap.get(m_objCurrentKey);
}
m_iterator = null;
m_iCurrentRecord = -1;
m_objCurrentKey = null;
return m_objCurrentKey;
} | [
"public",
"Object",
"get",
"(",
"int",
"iRowIndex",
",",
"int",
"iRowCount",
")",
"throws",
"DBException",
",",
"RemoteException",
"{",
"if",
"(",
"(",
"m_iterator",
"==",
"null",
")",
"||",
"(",
"m_iCurrentRecord",
"==",
"-",
"1",
")",
"||",
"(",
"iRowI... | Receive this relative record in the table.
<p>Note: This is usually used only by thin clients, as thick clients have the code to
fake absolute access.
@param iRowIndex The row to retrieve.
@param iRowCount The number of rows to retrieve (Used only by EjbCachedTable).
@return The record(s) or an error code as an Integer.
@exception Exception File exception. | [
"Receive",
"this",
"relative",
"record",
"in",
"the",
"table",
".",
"<p",
">",
"Note",
":",
"This",
"is",
"usually",
"used",
"only",
"by",
"thin",
"clients",
"as",
"thick",
"clients",
"have",
"the",
"code",
"to",
"fake",
"absolute",
"access",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/misc/src/main/java/org/jbundle/thin/base/db/client/memory/MemoryRemoteTable.java#L253-L273 |
dlemmermann/CalendarFX | CalendarFXView/src/main/java/com/calendarfx/model/Calendar.java | Calendar.stopBatchUpdates | public final void stopBatchUpdates() {
batchUpdates = false;
if (dirty) {
dirty = false;
fireEvent(new CalendarEvent(CalendarEvent.CALENDAR_CHANGED, this));
}
} | java | public final void stopBatchUpdates() {
batchUpdates = false;
if (dirty) {
dirty = false;
fireEvent(new CalendarEvent(CalendarEvent.CALENDAR_CHANGED, this));
}
} | [
"public",
"final",
"void",
"stopBatchUpdates",
"(",
")",
"{",
"batchUpdates",
"=",
"false",
";",
"if",
"(",
"dirty",
")",
"{",
"dirty",
"=",
"false",
";",
"fireEvent",
"(",
"new",
"CalendarEvent",
"(",
"CalendarEvent",
".",
"CALENDAR_CHANGED",
",",
"this",
... | Tells the calendar that the application is done making big changes. Invoking
this method will trigger a calendar event of type {@link CalendarEvent#CALENDAR_CHANGED} which
will then force an update of the views. | [
"Tells",
"the",
"calendar",
"that",
"the",
"application",
"is",
"done",
"making",
"big",
"changes",
".",
"Invoking",
"this",
"method",
"will",
"trigger",
"a",
"calendar",
"event",
"of",
"type",
"{"
] | train | https://github.com/dlemmermann/CalendarFX/blob/f2b91c2622c3f29d004485b6426b23b86c331f96/CalendarFXView/src/main/java/com/calendarfx/model/Calendar.java#L252-L259 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/spi/properties/HazelcastProperties.java | HazelcastProperties.getPositiveMillisOrDefault | public long getPositiveMillisOrDefault(HazelcastProperty property, long defaultValue) {
long millis = getMillis(property);
return millis > 0 ? millis : defaultValue;
} | java | public long getPositiveMillisOrDefault(HazelcastProperty property, long defaultValue) {
long millis = getMillis(property);
return millis > 0 ? millis : defaultValue;
} | [
"public",
"long",
"getPositiveMillisOrDefault",
"(",
"HazelcastProperty",
"property",
",",
"long",
"defaultValue",
")",
"{",
"long",
"millis",
"=",
"getMillis",
"(",
"property",
")",
";",
"return",
"millis",
">",
"0",
"?",
"millis",
":",
"defaultValue",
";",
"... | Returns the configured value of a {@link HazelcastProperty} converted to milliseconds if
it is positive, otherwise returns the passed default value.
@param property the {@link HazelcastProperty} to get the value from
@param defaultValue the default value to return if property has non positive value.
@return the value in milliseconds if it is positive, otherwise the passed default value.
@throws IllegalArgumentException if the {@link HazelcastProperty} has no {@link TimeUnit} | [
"Returns",
"the",
"configured",
"value",
"of",
"a",
"{",
"@link",
"HazelcastProperty",
"}",
"converted",
"to",
"milliseconds",
"if",
"it",
"is",
"positive",
"otherwise",
"returns",
"the",
"passed",
"default",
"value",
"."
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/spi/properties/HazelcastProperties.java#L262-L265 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/renderkit/html/HtmlMessageRenderer.java | HtmlMessageRenderer.encodeEnd | @Override
public void encodeEnd(FacesContext facesContext, UIComponent component) throws IOException
{
super.encodeEnd(facesContext, component); // check for NP
Map<String, List<ClientBehavior>> behaviors = null;
if (component instanceof ClientBehaviorHolder)
{
behaviors = ((ClientBehaviorHolder) component).getClientBehaviors();
if (!behaviors.isEmpty())
{
ResourceUtils.renderDefaultJsfJsInlineIfNecessary(facesContext, facesContext.getResponseWriter());
}
}
renderMessage(facesContext, component, false, true);
} | java | @Override
public void encodeEnd(FacesContext facesContext, UIComponent component) throws IOException
{
super.encodeEnd(facesContext, component); // check for NP
Map<String, List<ClientBehavior>> behaviors = null;
if (component instanceof ClientBehaviorHolder)
{
behaviors = ((ClientBehaviorHolder) component).getClientBehaviors();
if (!behaviors.isEmpty())
{
ResourceUtils.renderDefaultJsfJsInlineIfNecessary(facesContext, facesContext.getResponseWriter());
}
}
renderMessage(facesContext, component, false, true);
} | [
"@",
"Override",
"public",
"void",
"encodeEnd",
"(",
"FacesContext",
"facesContext",
",",
"UIComponent",
"component",
")",
"throws",
"IOException",
"{",
"super",
".",
"encodeEnd",
"(",
"facesContext",
",",
"component",
")",
";",
"// check for NP",
"Map",
"<",
"S... | private static final Log log = LogFactory.getLog(HtmlMessageRenderer.class); | [
"private",
"static",
"final",
"Log",
"log",
"=",
"LogFactory",
".",
"getLog",
"(",
"HtmlMessageRenderer",
".",
"class",
")",
";"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/renderkit/html/HtmlMessageRenderer.java#L46-L62 |
baasbox/Android-SDK | library/src/main/java/com/baasbox/android/BaasDocument.java | BaasDocument.getString | public String getString(String name, String otherwise) {
return data.getString(name, otherwise);
} | java | public String getString(String name, String otherwise) {
return data.getString(name, otherwise);
} | [
"public",
"String",
"getString",
"(",
"String",
"name",
",",
"String",
"otherwise",
")",
"{",
"return",
"data",
".",
"getString",
"(",
"name",
",",
"otherwise",
")",
";",
"}"
] | Returns the value mapped to <code>name</code> as a {@link java.lang.String}
or <code>otherwise</code> if the mapping is absent.
@param name a non <code>null</code> key
@param otherwise a default value
@return the value mapped to <code>name</code> or <code>otherwise</code> | [
"Returns",
"the",
"value",
"mapped",
"to",
"<code",
">",
"name<",
"/",
"code",
">",
"as",
"a",
"{",
"@link",
"java",
".",
"lang",
".",
"String",
"}",
"or",
"<code",
">",
"otherwise<",
"/",
"code",
">",
"if",
"the",
"mapping",
"is",
"absent",
"."
] | train | https://github.com/baasbox/Android-SDK/blob/6bb2203246b885b2ad63a7bfaf37c83caf15e0d8/library/src/main/java/com/baasbox/android/BaasDocument.java#L971-L973 |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/javac/file/ZipFileIndex.java | ZipFileIndex.get4ByteLittleEndian | private static int get4ByteLittleEndian(byte[] buf, int pos) {
return (buf[pos] & 0xFF) + ((buf[pos + 1] & 0xFF) << 8) +
((buf[pos + 2] & 0xFF) << 16) + ((buf[pos + 3] & 0xFF) << 24);
} | java | private static int get4ByteLittleEndian(byte[] buf, int pos) {
return (buf[pos] & 0xFF) + ((buf[pos + 1] & 0xFF) << 8) +
((buf[pos + 2] & 0xFF) << 16) + ((buf[pos + 3] & 0xFF) << 24);
} | [
"private",
"static",
"int",
"get4ByteLittleEndian",
"(",
"byte",
"[",
"]",
"buf",
",",
"int",
"pos",
")",
"{",
"return",
"(",
"buf",
"[",
"pos",
"]",
"&",
"0xFF",
")",
"+",
"(",
"(",
"buf",
"[",
"pos",
"+",
"1",
"]",
"&",
"0xFF",
")",
"<<",
"8"... | return the 4 bytes buf[i..i+3] as an integer in little endian format. | [
"return",
"the",
"4",
"bytes",
"buf",
"[",
"i",
"..",
"i",
"+",
"3",
"]",
"as",
"an",
"integer",
"in",
"little",
"endian",
"format",
"."
] | train | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/file/ZipFileIndex.java#L474-L477 |
UrielCh/ovh-java-sdk | ovh-java-sdk-status/src/main/java/net/minidev/ovh/api/ApiOvhStatus.java | ApiOvhStatus.task_GET | public ArrayList<OvhTask> task_GET(OvhTaskImpactEnum impact, OvhTaskStatusEnum status, OvhTaskTypeEnum type) throws IOException {
String qPath = "/status/task";
StringBuilder sb = path(qPath);
query(sb, "impact", impact);
query(sb, "status", status);
query(sb, "type", type);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t1);
} | java | public ArrayList<OvhTask> task_GET(OvhTaskImpactEnum impact, OvhTaskStatusEnum status, OvhTaskTypeEnum type) throws IOException {
String qPath = "/status/task";
StringBuilder sb = path(qPath);
query(sb, "impact", impact);
query(sb, "status", status);
query(sb, "type", type);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t1);
} | [
"public",
"ArrayList",
"<",
"OvhTask",
">",
"task_GET",
"(",
"OvhTaskImpactEnum",
"impact",
",",
"OvhTaskStatusEnum",
"status",
",",
"OvhTaskTypeEnum",
"type",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/status/task\"",
";",
"StringBuilder",
"sb",... | Find all the incidents or maintenances linked to your services
REST: GET /status/task
@param impact [required] Filter by impact
@param status [required] Filter by status
@param type [required] Filter by type
API beta | [
"Find",
"all",
"the",
"incidents",
"or",
"maintenances",
"linked",
"to",
"your",
"services"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-status/src/main/java/net/minidev/ovh/api/ApiOvhStatus.java#L33-L41 |
apache/incubator-gobblin | gobblin-cluster/src/main/java/org/apache/gobblin/cluster/GobblinClusterUtils.java | GobblinClusterUtils.getAppWorkDirPath | public static String getAppWorkDirPath(String applicationName, String applicationId) {
return applicationName + Path.SEPARATOR + applicationId;
} | java | public static String getAppWorkDirPath(String applicationName, String applicationId) {
return applicationName + Path.SEPARATOR + applicationId;
} | [
"public",
"static",
"String",
"getAppWorkDirPath",
"(",
"String",
"applicationName",
",",
"String",
"applicationId",
")",
"{",
"return",
"applicationName",
"+",
"Path",
".",
"SEPARATOR",
"+",
"applicationId",
";",
"}"
] | Get the application working directory {@link String}.
@param applicationName the application name
@param applicationId the application ID in string form
@return the cluster application working directory {@link String} | [
"Get",
"the",
"application",
"working",
"directory",
"{",
"@link",
"String",
"}",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-cluster/src/main/java/org/apache/gobblin/cluster/GobblinClusterUtils.java#L79-L81 |
aeshell/aesh-readline | readline/src/main/java/org/aesh/readline/util/Parser.java | Parser.formatDisplayList | public static String formatDisplayList(String[] displayList, int termHeight, int termWidth) {
return formatDisplayList(Arrays.asList(displayList), termHeight, termWidth);
} | java | public static String formatDisplayList(String[] displayList, int termHeight, int termWidth) {
return formatDisplayList(Arrays.asList(displayList), termHeight, termWidth);
} | [
"public",
"static",
"String",
"formatDisplayList",
"(",
"String",
"[",
"]",
"displayList",
",",
"int",
"termHeight",
",",
"int",
"termWidth",
")",
"{",
"return",
"formatDisplayList",
"(",
"Arrays",
".",
"asList",
"(",
"displayList",
")",
",",
"termHeight",
","... | Format completions so that they look similar to GNU Readline
@param displayList to format
@param termHeight max height
@param termWidth max width
@return formatted string to be outputted | [
"Format",
"completions",
"so",
"that",
"they",
"look",
"similar",
"to",
"GNU",
"Readline"
] | train | https://github.com/aeshell/aesh-readline/blob/3d7258f6490a422658ec85c8457514390c03232d/readline/src/main/java/org/aesh/readline/util/Parser.java#L60-L62 |
jbossas/jboss-invocation | src/main/java/org/jboss/invocation/proxy/AbstractSubclassFactory.java | AbstractSubclassFactory.overrideMethod | protected boolean overrideMethod(Method method, MethodIdentifier identifier, MethodBodyCreator creator) {
if (!overriddenMethods.contains(identifier)) {
overriddenMethods.add(identifier);
creator.overrideMethod(classFile.addMethod(method), method);
return true;
}
return false;
} | java | protected boolean overrideMethod(Method method, MethodIdentifier identifier, MethodBodyCreator creator) {
if (!overriddenMethods.contains(identifier)) {
overriddenMethods.add(identifier);
creator.overrideMethod(classFile.addMethod(method), method);
return true;
}
return false;
} | [
"protected",
"boolean",
"overrideMethod",
"(",
"Method",
"method",
",",
"MethodIdentifier",
"identifier",
",",
"MethodBodyCreator",
"creator",
")",
"{",
"if",
"(",
"!",
"overriddenMethods",
".",
"contains",
"(",
"identifier",
")",
")",
"{",
"overriddenMethods",
".... | Creates a new method on the generated class that overrides the given methods, unless a method with the same signature has
already been overridden.
@param method The method to override
@param identifier The identifier of the method to override
@param creator The {@link MethodBodyCreator} used to create the method body
@return {@code true} if the method was successfully overridden, {@code false} otherwise | [
"Creates",
"a",
"new",
"method",
"on",
"the",
"generated",
"class",
"that",
"overrides",
"the",
"given",
"methods",
"unless",
"a",
"method",
"with",
"the",
"same",
"signature",
"has",
"already",
"been",
"overridden",
"."
] | train | https://github.com/jbossas/jboss-invocation/blob/f72586a554264cbc78fcdad9fdd3e84b833249c9/src/main/java/org/jboss/invocation/proxy/AbstractSubclassFactory.java#L116-L123 |
maguro/aunit | junit/src/main/java/com/toolazydogs/aunit/Assert.java | Assert.assertToken | public static void assertToken(String message, int expectedChannel, int expectedType, String expectedText, Token token)
{
assertEquals(message + " (channel check)", expectedChannel, token.getChannel());
assertEquals(message + " (type check)", expectedType, token.getType());
assertEquals(message + " (text check)", expectedText, token.getText());
} | java | public static void assertToken(String message, int expectedChannel, int expectedType, String expectedText, Token token)
{
assertEquals(message + " (channel check)", expectedChannel, token.getChannel());
assertEquals(message + " (type check)", expectedType, token.getType());
assertEquals(message + " (text check)", expectedText, token.getText());
} | [
"public",
"static",
"void",
"assertToken",
"(",
"String",
"message",
",",
"int",
"expectedChannel",
",",
"int",
"expectedType",
",",
"String",
"expectedText",
",",
"Token",
"token",
")",
"{",
"assertEquals",
"(",
"message",
"+",
"\" (channel check)\"",
",",
"exp... | Asserts properties of a token.
@param message the message to display on failure.
@param expectedChannel the channel the token should appear on.
@param expectedType the expected type of the token.
@param expectedText the expected text of the token.
@param token the token to assert. | [
"Asserts",
"properties",
"of",
"a",
"token",
"."
] | train | https://github.com/maguro/aunit/blob/1f972e35b28327e5e2e7881befc928df0546d74c/junit/src/main/java/com/toolazydogs/aunit/Assert.java#L115-L120 |
Stratio/deep-spark | deep-cassandra/src/main/java/com/stratio/deep/cassandra/thrift/ThriftRangeUtils.java | ThriftRangeUtils.build | public static ThriftRangeUtils build(CassandraDeepJobConfig config) {
String host = config.getHost();
int rpcPort = config.getRpcPort();
int splitSize = config.getSplitSize();
String keyspace = config.getKeyspace();
String columnFamily = config.getColumnFamily();
String partitionerClassName = config.getPartitionerClassName();
IPartitioner partitioner = Utils.newTypeInstance(partitionerClassName, IPartitioner.class);
return new ThriftRangeUtils(partitioner, host, rpcPort, keyspace, columnFamily, splitSize);
} | java | public static ThriftRangeUtils build(CassandraDeepJobConfig config) {
String host = config.getHost();
int rpcPort = config.getRpcPort();
int splitSize = config.getSplitSize();
String keyspace = config.getKeyspace();
String columnFamily = config.getColumnFamily();
String partitionerClassName = config.getPartitionerClassName();
IPartitioner partitioner = Utils.newTypeInstance(partitionerClassName, IPartitioner.class);
return new ThriftRangeUtils(partitioner, host, rpcPort, keyspace, columnFamily, splitSize);
} | [
"public",
"static",
"ThriftRangeUtils",
"build",
"(",
"CassandraDeepJobConfig",
"config",
")",
"{",
"String",
"host",
"=",
"config",
".",
"getHost",
"(",
")",
";",
"int",
"rpcPort",
"=",
"config",
".",
"getRpcPort",
"(",
")",
";",
"int",
"splitSize",
"=",
... | Returns a new {@link ThriftRangeUtils} using the specified configuration.
@param config the Deep configuration object. | [
"Returns",
"a",
"new",
"{",
"@link",
"ThriftRangeUtils",
"}",
"using",
"the",
"specified",
"configuration",
"."
] | train | https://github.com/Stratio/deep-spark/blob/b9621c9b7a6d996f80fce1d073d696a157bed095/deep-cassandra/src/main/java/com/stratio/deep/cassandra/thrift/ThriftRangeUtils.java#L88-L97 |
apache/incubator-gobblin | gobblin-metrics-libs/gobblin-metrics-base/src/main/java/org/apache/gobblin/metrics/event/MultiTimingEvent.java | MultiTimingEvent.endStage | public void endStage() {
if (this.currentStage != null) {
long time = System.currentTimeMillis() - this.currentStageStart;
this.timings.add(new Stage(this.currentStage, time));
if (reportAsMetrics && submitter.getMetricContext().isPresent()) {
String timerName = submitter.getNamespace() + "." + name + "." + this.currentStage;
submitter.getMetricContext().get().timer(timerName).update(time, TimeUnit.MILLISECONDS);
}
}
this.currentStage = null;
} | java | public void endStage() {
if (this.currentStage != null) {
long time = System.currentTimeMillis() - this.currentStageStart;
this.timings.add(new Stage(this.currentStage, time));
if (reportAsMetrics && submitter.getMetricContext().isPresent()) {
String timerName = submitter.getNamespace() + "." + name + "." + this.currentStage;
submitter.getMetricContext().get().timer(timerName).update(time, TimeUnit.MILLISECONDS);
}
}
this.currentStage = null;
} | [
"public",
"void",
"endStage",
"(",
")",
"{",
"if",
"(",
"this",
".",
"currentStage",
"!=",
"null",
")",
"{",
"long",
"time",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
"-",
"this",
".",
"currentStageStart",
";",
"this",
".",
"timings",
".",
"ad... | End the previous stage and record the time spent in that stage. | [
"End",
"the",
"previous",
"stage",
"and",
"record",
"the",
"time",
"spent",
"in",
"that",
"stage",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-metrics-libs/gobblin-metrics-base/src/main/java/org/apache/gobblin/metrics/event/MultiTimingEvent.java#L97-L107 |
intive-FDV/DynamicJasper | src/main/java/ar/com/fdvs/dj/domain/builders/DynamicReportBuilder.java | DynamicReportBuilder.setTemplateFile | public DynamicReportBuilder setTemplateFile(String path, boolean importFields, boolean importVariables, boolean importParameters, boolean importDatasets) {
report.setTemplateFileName(path);
report.setTemplateImportFields(importFields);
report.setTemplateImportParameters(importParameters);
report.setTemplateImportVariables(importVariables);
report.setTemplateImportDatasets(importDatasets);
return this;
} | java | public DynamicReportBuilder setTemplateFile(String path, boolean importFields, boolean importVariables, boolean importParameters, boolean importDatasets) {
report.setTemplateFileName(path);
report.setTemplateImportFields(importFields);
report.setTemplateImportParameters(importParameters);
report.setTemplateImportVariables(importVariables);
report.setTemplateImportDatasets(importDatasets);
return this;
} | [
"public",
"DynamicReportBuilder",
"setTemplateFile",
"(",
"String",
"path",
",",
"boolean",
"importFields",
",",
"boolean",
"importVariables",
",",
"boolean",
"importParameters",
",",
"boolean",
"importDatasets",
")",
"{",
"report",
".",
"setTemplateFileName",
"(",
"p... | The full path of a jrxml file, or the path in the classpath of a jrxml
resource.
@param path
@return | [
"The",
"full",
"path",
"of",
"a",
"jrxml",
"file",
"or",
"the",
"path",
"in",
"the",
"classpath",
"of",
"a",
"jrxml",
"resource",
"."
] | train | https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/domain/builders/DynamicReportBuilder.java#L1003-L1010 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/config/Config.java | Config.setSemaphoreConfigs | public Config setSemaphoreConfigs(Map<String, SemaphoreConfig> semaphoreConfigs) {
this.semaphoreConfigs.clear();
this.semaphoreConfigs.putAll(semaphoreConfigs);
for (final Entry<String, SemaphoreConfig> entry : this.semaphoreConfigs.entrySet()) {
entry.getValue().setName(entry.getKey());
}
return this;
} | java | public Config setSemaphoreConfigs(Map<String, SemaphoreConfig> semaphoreConfigs) {
this.semaphoreConfigs.clear();
this.semaphoreConfigs.putAll(semaphoreConfigs);
for (final Entry<String, SemaphoreConfig> entry : this.semaphoreConfigs.entrySet()) {
entry.getValue().setName(entry.getKey());
}
return this;
} | [
"public",
"Config",
"setSemaphoreConfigs",
"(",
"Map",
"<",
"String",
",",
"SemaphoreConfig",
">",
"semaphoreConfigs",
")",
"{",
"this",
".",
"semaphoreConfigs",
".",
"clear",
"(",
")",
";",
"this",
".",
"semaphoreConfigs",
".",
"putAll",
"(",
"semaphoreConfigs"... | Sets the map of semaphore configurations, mapped by config name.
The config name may be a pattern with which the configuration will be
obtained in the future.
@param semaphoreConfigs the semaphore configuration map to set
@return this config instance | [
"Sets",
"the",
"map",
"of",
"semaphore",
"configurations",
"mapped",
"by",
"config",
"name",
".",
"The",
"config",
"name",
"may",
"be",
"a",
"pattern",
"with",
"which",
"the",
"configuration",
"will",
"be",
"obtained",
"in",
"the",
"future",
"."
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/config/Config.java#L2376-L2383 |
lessthanoptimal/BoofCV | integration/boofcv-swing/src/main/java/boofcv/gui/StandardAlgConfigPanel.java | StandardAlgConfigPanel.removeChildInsidePanel | protected static void removeChildInsidePanel( JComponent root , JComponent target ) {
int N = root.getComponentCount();
for (int i = 0; i < N; i++) {
try {
JPanel p = (JPanel)root.getComponent(i);
Component[] children = p.getComponents();
for (int j = 0; j < children.length; j++) {
if( children[j] == target ) {
root.remove(i);
return;
}
}
}catch( ClassCastException ignore){}
}
} | java | protected static void removeChildInsidePanel( JComponent root , JComponent target ) {
int N = root.getComponentCount();
for (int i = 0; i < N; i++) {
try {
JPanel p = (JPanel)root.getComponent(i);
Component[] children = p.getComponents();
for (int j = 0; j < children.length; j++) {
if( children[j] == target ) {
root.remove(i);
return;
}
}
}catch( ClassCastException ignore){}
}
} | [
"protected",
"static",
"void",
"removeChildInsidePanel",
"(",
"JComponent",
"root",
",",
"JComponent",
"target",
")",
"{",
"int",
"N",
"=",
"root",
".",
"getComponentCount",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"N",
";",
"i",... | Searches inside the children of "root" for a component that's a JPanel. Then inside the JPanel it
looks for the target. If the target is inside the JPanel the JPanel is removed from root. | [
"Searches",
"inside",
"the",
"children",
"of",
"root",
"for",
"a",
"component",
"that",
"s",
"a",
"JPanel",
".",
"Then",
"inside",
"the",
"JPanel",
"it",
"looks",
"for",
"the",
"target",
".",
"If",
"the",
"target",
"is",
"inside",
"the",
"JPanel",
"the",... | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/integration/boofcv-swing/src/main/java/boofcv/gui/StandardAlgConfigPanel.java#L263-L278 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/learning/AdaDeltaUpdater.java | AdaDeltaUpdater.applyUpdater | @Override
public void applyUpdater(INDArray gradient, int iteration, int epoch) {
if (msg == null || msdx == null)
throw new IllegalStateException("Updater has not been initialized with view state");
double rho = config.getRho();
double epsilon = config.getEpsilon();
//Line 4 of Algorithm 1: https://arxiv.org/pdf/1212.5701v1.pdf
//E[g^2]_t = rho * E[g^2]_{t−1} + (1-rho)*g^2_t
msg.muli(rho).addi(gradient.mul(gradient).muli(1 - rho));
//Calculate update:
//dX = - g * RMS[delta x]_{t-1} / RMS[g]_t
//Note: negative is applied in the DL4J step function: params -= update rather than params += update
INDArray rmsdx_t1 = Transforms.sqrt(msdx.add(epsilon), false);
INDArray rmsg_t = Transforms.sqrt(msg.add(epsilon), false);
INDArray update = gradient.muli(rmsdx_t1.divi(rmsg_t));
//Accumulate gradients: E[delta x^2]_t = rho * E[delta x^2]_{t-1} + (1-rho)* (delta x_t)^2
msdx.muli(rho).addi(update.mul(update).muli(1 - rho));
} | java | @Override
public void applyUpdater(INDArray gradient, int iteration, int epoch) {
if (msg == null || msdx == null)
throw new IllegalStateException("Updater has not been initialized with view state");
double rho = config.getRho();
double epsilon = config.getEpsilon();
//Line 4 of Algorithm 1: https://arxiv.org/pdf/1212.5701v1.pdf
//E[g^2]_t = rho * E[g^2]_{t−1} + (1-rho)*g^2_t
msg.muli(rho).addi(gradient.mul(gradient).muli(1 - rho));
//Calculate update:
//dX = - g * RMS[delta x]_{t-1} / RMS[g]_t
//Note: negative is applied in the DL4J step function: params -= update rather than params += update
INDArray rmsdx_t1 = Transforms.sqrt(msdx.add(epsilon), false);
INDArray rmsg_t = Transforms.sqrt(msg.add(epsilon), false);
INDArray update = gradient.muli(rmsdx_t1.divi(rmsg_t));
//Accumulate gradients: E[delta x^2]_t = rho * E[delta x^2]_{t-1} + (1-rho)* (delta x_t)^2
msdx.muli(rho).addi(update.mul(update).muli(1 - rho));
} | [
"@",
"Override",
"public",
"void",
"applyUpdater",
"(",
"INDArray",
"gradient",
",",
"int",
"iteration",
",",
"int",
"epoch",
")",
"{",
"if",
"(",
"msg",
"==",
"null",
"||",
"msdx",
"==",
"null",
")",
"throw",
"new",
"IllegalStateException",
"(",
"\"Update... | Get the updated gradient for the given gradient
and also update the state of ada delta.
@param gradient the gradient to get the
updated gradient for
@param iteration
@return the update gradient | [
"Get",
"the",
"updated",
"gradient",
"for",
"the",
"given",
"gradient",
"and",
"also",
"update",
"the",
"state",
"of",
"ada",
"delta",
"."
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/learning/AdaDeltaUpdater.java#L75-L96 |
Faylixe/googlecodejam-client | src/main/java/fr/faylixe/googlecodejam/client/executor/HttpRequestExecutor.java | HttpRequestExecutor.readResolve | private Object readResolve() throws ObjectStreamException {
try {
return create(hostname, cookieValue);
}
catch (final IOException | GeneralSecurityException e) {
throw new ObjectStreamException(e.getMessage()) {
/** Serialization index. **/
private static final long serialVersionUID = 1L;
};
}
} | java | private Object readResolve() throws ObjectStreamException {
try {
return create(hostname, cookieValue);
}
catch (final IOException | GeneralSecurityException e) {
throw new ObjectStreamException(e.getMessage()) {
/** Serialization index. **/
private static final long serialVersionUID = 1L;
};
}
} | [
"private",
"Object",
"readResolve",
"(",
")",
"throws",
"ObjectStreamException",
"{",
"try",
"{",
"return",
"create",
"(",
"hostname",
",",
"cookieValue",
")",
";",
"}",
"catch",
"(",
"final",
"IOException",
"|",
"GeneralSecurityException",
"e",
")",
"{",
"thr... | Custom deserialization processing method that
create a new valid {@link HttpRequestExecutor}
instance from the internally stored cookie value.
@return Valid {@link HttpRequestExecutor} instance.
@throws ObjectStreamException If any error occurs during deserialization process. | [
"Custom",
"deserialization",
"processing",
"method",
"that",
"create",
"a",
"new",
"valid",
"{",
"@link",
"HttpRequestExecutor",
"}",
"instance",
"from",
"the",
"internally",
"stored",
"cookie",
"value",
"."
] | train | https://github.com/Faylixe/googlecodejam-client/blob/84a5fed4e049dca48994dc3f70213976aaff4bd3/src/main/java/fr/faylixe/googlecodejam/client/executor/HttpRequestExecutor.java#L164-L176 |
mikepenz/Android-Iconics | library-core/src/main/java/com/mikepenz/iconics/IconicsDrawable.java | IconicsDrawable.contourColorListRes | @NonNull
public IconicsDrawable contourColorListRes(@ColorRes int colorResId) {
return contourColor(ContextCompat.getColorStateList(mContext, colorResId));
} | java | @NonNull
public IconicsDrawable contourColorListRes(@ColorRes int colorResId) {
return contourColor(ContextCompat.getColorStateList(mContext, colorResId));
} | [
"@",
"NonNull",
"public",
"IconicsDrawable",
"contourColorListRes",
"(",
"@",
"ColorRes",
"int",
"colorResId",
")",
"{",
"return",
"contourColor",
"(",
"ContextCompat",
".",
"getColorStateList",
"(",
"mContext",
",",
"colorResId",
")",
")",
";",
"}"
] | Set contour colors from color res.
@return The current IconicsDrawable for chaining. | [
"Set",
"contour",
"colors",
"from",
"color",
"res",
"."
] | train | https://github.com/mikepenz/Android-Iconics/blob/0b2c8f7d07b6d2715a417563c66311e7e1fcc7d8/library-core/src/main/java/com/mikepenz/iconics/IconicsDrawable.java#L812-L815 |
alkacon/opencms-core | src/org/opencms/jsp/CmsJspTagHeadIncludes.java | CmsJspTagHeadIncludes.getInlineData | protected static String getInlineData(I_CmsFormatterBean formatter, String type) {
if (TYPE_CSS.equals(type)) {
return formatter.getInlineCss();
} else if (TYPE_JAVASCRIPT.equals(type)) {
return formatter.getInlineJavascript();
}
return null;
} | java | protected static String getInlineData(I_CmsFormatterBean formatter, String type) {
if (TYPE_CSS.equals(type)) {
return formatter.getInlineCss();
} else if (TYPE_JAVASCRIPT.equals(type)) {
return formatter.getInlineJavascript();
}
return null;
} | [
"protected",
"static",
"String",
"getInlineData",
"(",
"I_CmsFormatterBean",
"formatter",
",",
"String",
"type",
")",
"{",
"if",
"(",
"TYPE_CSS",
".",
"equals",
"(",
"type",
")",
")",
"{",
"return",
"formatter",
".",
"getInlineCss",
"(",
")",
";",
"}",
"el... | Gets the inline CSS/Javascrip for the given formatter bean.<p>
@param formatter the formatter bean
@param type the type (CSS or Javascript)
@return the inline data for the given formatter bean | [
"Gets",
"the",
"inline",
"CSS",
"/",
"Javascrip",
"for",
"the",
"given",
"formatter",
"bean",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/CmsJspTagHeadIncludes.java#L172-L180 |
smartsheet-platform/smartsheet-java-sdk | src/main/java/com/smartsheet/api/internal/SheetResourcesImpl.java | SheetResourcesImpl.sortSheet | public Sheet sortSheet(long sheetId, SortSpecifier sortSpecifier, Integer level) throws SmartsheetException {
Util.throwIfNull(sortSpecifier);
String path = "sheets/" + sheetId + "/sort";
if (level != null) {
path += "?level=" + level;
}
HttpRequest request = createHttpRequest(smartsheet.getBaseURI().resolve(path), HttpMethod.POST);
ByteArrayOutputStream objectBytesStream = new ByteArrayOutputStream();
this.smartsheet.getJsonSerializer().serialize(sortSpecifier, objectBytesStream);
HttpEntity entity = new HttpEntity();
entity.setContentType("application/json");
entity.setContent(new ByteArrayInputStream(objectBytesStream.toByteArray()));
entity.setContentLength(objectBytesStream.size());
request.setEntity(entity);
Sheet obj = null;
try {
HttpResponse response = this.smartsheet.getHttpClient().request(request);
switch (response.getStatusCode()) {
case 200: {
InputStream inputStream = response.getEntity().getContent();
try {
obj = this.smartsheet.getJsonSerializer().deserialize(Sheet.class, inputStream);
} catch (IOException e) {
throw new SmartsheetException(e);
}
break;
}
default:
handleError(response);
}
} finally {
smartsheet.getHttpClient().releaseConnection();
}
return obj;
} | java | public Sheet sortSheet(long sheetId, SortSpecifier sortSpecifier, Integer level) throws SmartsheetException {
Util.throwIfNull(sortSpecifier);
String path = "sheets/" + sheetId + "/sort";
if (level != null) {
path += "?level=" + level;
}
HttpRequest request = createHttpRequest(smartsheet.getBaseURI().resolve(path), HttpMethod.POST);
ByteArrayOutputStream objectBytesStream = new ByteArrayOutputStream();
this.smartsheet.getJsonSerializer().serialize(sortSpecifier, objectBytesStream);
HttpEntity entity = new HttpEntity();
entity.setContentType("application/json");
entity.setContent(new ByteArrayInputStream(objectBytesStream.toByteArray()));
entity.setContentLength(objectBytesStream.size());
request.setEntity(entity);
Sheet obj = null;
try {
HttpResponse response = this.smartsheet.getHttpClient().request(request);
switch (response.getStatusCode()) {
case 200: {
InputStream inputStream = response.getEntity().getContent();
try {
obj = this.smartsheet.getJsonSerializer().deserialize(Sheet.class, inputStream);
} catch (IOException e) {
throw new SmartsheetException(e);
}
break;
}
default:
handleError(response);
}
} finally {
smartsheet.getHttpClient().releaseConnection();
}
return obj;
} | [
"public",
"Sheet",
"sortSheet",
"(",
"long",
"sheetId",
",",
"SortSpecifier",
"sortSpecifier",
",",
"Integer",
"level",
")",
"throws",
"SmartsheetException",
"{",
"Util",
".",
"throwIfNull",
"(",
"sortSpecifier",
")",
";",
"String",
"path",
"=",
"\"sheets/\"",
"... | Sort a sheet according to the sort criteria.
It mirrors to the following Smartsheet REST API method: POST /sheet/{sheetId}/sort
Exceptions:
- IllegalArgumentException : if any argument is null
- InvalidRequestException : if there is any problem with the REST API request
- AuthorizationException : if there is any problem with the REST API authorization(access token)
- ServiceUnavailableException : if the REST API service is not available (possibly due to rate limiting)
- SmartsheetRestException : if there is any other REST API related error occurred during the operation
- SmartsheetException : if there is any other error occurred during the operation
@param sheetId the sheet id
@param sortSpecifier the sort criteria
@param level compatibility level
@return the update request object
@throws SmartsheetException the smartsheet exception | [
"Sort",
"a",
"sheet",
"according",
"to",
"the",
"sort",
"criteria",
"."
] | train | https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/SheetResourcesImpl.java#L1161-L1200 |
io7m/ieee754b16 | com.io7m.ieee754b16.core/src/main/java/com/io7m/ieee754b16/Binary16.java | Binary16.unpackFloat | public static float unpackFloat(
final char k)
{
final int f16_mantissa = (int) k & MASK_MANTISSA;
final int f16_exponent = (int) k & MASK_EXPONENT;
final int f16_sign = (int) k & MASK_SIGN;
/*
* If the exponent is zero, and the mantissa is zero, the number is zero.
* The sign is preserved.
*/
if (f16_exponent == 0 && f16_mantissa == 0) {
return unpackFloatZero(f16_sign);
}
/*
* If the exponent indicates that the number is infinite or NaN,
* then return a similar infinite or NaN.
*/
if (f16_exponent == MASK_EXPONENT) {
return unpackFloatInfiniteNaN(f16_mantissa, f16_sign);
}
/*
* If the exponent is nonzero, then the number is normal in 16 bits and can
* therefore be translated to a normal value in 32 bits.
*/
if (f16_exponent != 0) {
return unpackFloatNormal(f16_mantissa, f16_exponent, f16_sign);
}
/*
* If the exponent is zero, and the mantissa not zero, the number is
* a 16-bit subnormal but can be transformed to a 32-bit normal.
*/
return unpackFloatSubnormal(f16_mantissa, f16_sign);
} | java | public static float unpackFloat(
final char k)
{
final int f16_mantissa = (int) k & MASK_MANTISSA;
final int f16_exponent = (int) k & MASK_EXPONENT;
final int f16_sign = (int) k & MASK_SIGN;
/*
* If the exponent is zero, and the mantissa is zero, the number is zero.
* The sign is preserved.
*/
if (f16_exponent == 0 && f16_mantissa == 0) {
return unpackFloatZero(f16_sign);
}
/*
* If the exponent indicates that the number is infinite or NaN,
* then return a similar infinite or NaN.
*/
if (f16_exponent == MASK_EXPONENT) {
return unpackFloatInfiniteNaN(f16_mantissa, f16_sign);
}
/*
* If the exponent is nonzero, then the number is normal in 16 bits and can
* therefore be translated to a normal value in 32 bits.
*/
if (f16_exponent != 0) {
return unpackFloatNormal(f16_mantissa, f16_exponent, f16_sign);
}
/*
* If the exponent is zero, and the mantissa not zero, the number is
* a 16-bit subnormal but can be transformed to a 32-bit normal.
*/
return unpackFloatSubnormal(f16_mantissa, f16_sign);
} | [
"public",
"static",
"float",
"unpackFloat",
"(",
"final",
"char",
"k",
")",
"{",
"final",
"int",
"f16_mantissa",
"=",
"(",
"int",
")",
"k",
"&",
"MASK_MANTISSA",
";",
"final",
"int",
"f16_exponent",
"=",
"(",
"int",
")",
"k",
"&",
"MASK_EXPONENT",
";",
... | <p>
Convert a packed {@code binary16} value {@code k} to a
single-precision floating point value.
</p>
<p>
The function returns:
</p>
<ul>
<li>{@code NaN} iff {@code isNaN(k)}</li>
<li>{@link Double#POSITIVE_INFINITY} iff
<code>k == {@link #POSITIVE_INFINITY}</code></li>
<li>{@link Double#NEGATIVE_INFINITY} iff
<code>k == {@link #NEGATIVE_INFINITY}</code></li>
<li>{@code -0.0} iff <code>k == {@link #NEGATIVE_ZERO}</code></li>
<li>{@code 0.0} iff <code>k == {@link #POSITIVE_ZERO}</code></li>
<li>{@code (-1.0 * n) * (2 ^ e) * 1.s}, for the decoded sign
{@code n} of {@code k}, the decoded exponent {@code e} of
{@code k}, and the decoded significand {@code s} of
{@code k}.</li>
</ul>
@param k A packed {@code binary16} value
@return A floating point value
@see #packDouble(double) | [
"<p",
">",
"Convert",
"a",
"packed",
"{",
"@code",
"binary16",
"}",
"value",
"{",
"@code",
"k",
"}",
"to",
"a",
"single",
"-",
"precision",
"floating",
"point",
"value",
".",
"<",
"/",
"p",
">",
"<p",
">",
"The",
"function",
"returns",
":",
"<",
"/... | train | https://github.com/io7m/ieee754b16/blob/39474026e6d069695adf5a14c5c326aadb7b4cf4/com.io7m.ieee754b16.core/src/main/java/com/io7m/ieee754b16/Binary16.java#L231-L271 |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.filemonitor/src/com/ibm/ws/kernel/filemonitor/internal/UpdateMonitor.java | UpdateMonitor.getMonitor | public static UpdateMonitor getMonitor(File monitoredFile, MonitorType type, String filter) {
if (monitoredFile == null)
throw new NullPointerException("MonitoredFile must be non-null");
if (type == null)
throw new NullPointerException("MonitorType must be non-null");
switch (type) {
case DIRECTORY:
case DIRECTORY_RECURSE:
case DIRECTORY_SELF:
case DIRECTORY_RECURSE_SELF:
return new DirectoryUpdateMonitor(monitoredFile, type, filter);
case FILE:
return new FileUpdateMonitor(monitoredFile);
default:
throw new IllegalArgumentException("Unknown monitor type: " + type);
}
} | java | public static UpdateMonitor getMonitor(File monitoredFile, MonitorType type, String filter) {
if (monitoredFile == null)
throw new NullPointerException("MonitoredFile must be non-null");
if (type == null)
throw new NullPointerException("MonitorType must be non-null");
switch (type) {
case DIRECTORY:
case DIRECTORY_RECURSE:
case DIRECTORY_SELF:
case DIRECTORY_RECURSE_SELF:
return new DirectoryUpdateMonitor(monitoredFile, type, filter);
case FILE:
return new FileUpdateMonitor(monitoredFile);
default:
throw new IllegalArgumentException("Unknown monitor type: " + type);
}
} | [
"public",
"static",
"UpdateMonitor",
"getMonitor",
"(",
"File",
"monitoredFile",
",",
"MonitorType",
"type",
",",
"String",
"filter",
")",
"{",
"if",
"(",
"monitoredFile",
"==",
"null",
")",
"throw",
"new",
"NullPointerException",
"(",
"\"MonitoredFile must be non-n... | Obtain an instance of an update monitor that uses the specified cache location, and
monitors the specified resource with the specified properties. Caller must call {@link #init()} on
this monitor before the first scheduled scan.
@param monitoredFile
The name of the resource to monitor (file or directory, may or may not exist)
@param filter A regex filter limiting the types of resources that will be monitored.
Only applicable if the primary monitored file is a directory
@param recurse
If true, all resources in all subdirectories will be monitored
@return an instance of the UpdateMonitor appropriate for the monitored resource (e.g. File, Directory, or non-existant) | [
"Obtain",
"an",
"instance",
"of",
"an",
"update",
"monitor",
"that",
"uses",
"the",
"specified",
"cache",
"location",
"and",
"monitors",
"the",
"specified",
"resource",
"with",
"the",
"specified",
"properties",
".",
"Caller",
"must",
"call",
"{",
"@link",
"#in... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.filemonitor/src/com/ibm/ws/kernel/filemonitor/internal/UpdateMonitor.java#L53-L71 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/LoadBalancerBackendAddressPoolsInner.java | LoadBalancerBackendAddressPoolsInner.listAsync | public Observable<Page<BackendAddressPoolInner>> listAsync(final String resourceGroupName, final String loadBalancerName) {
return listWithServiceResponseAsync(resourceGroupName, loadBalancerName)
.map(new Func1<ServiceResponse<Page<BackendAddressPoolInner>>, Page<BackendAddressPoolInner>>() {
@Override
public Page<BackendAddressPoolInner> call(ServiceResponse<Page<BackendAddressPoolInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<BackendAddressPoolInner>> listAsync(final String resourceGroupName, final String loadBalancerName) {
return listWithServiceResponseAsync(resourceGroupName, loadBalancerName)
.map(new Func1<ServiceResponse<Page<BackendAddressPoolInner>>, Page<BackendAddressPoolInner>>() {
@Override
public Page<BackendAddressPoolInner> call(ServiceResponse<Page<BackendAddressPoolInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"BackendAddressPoolInner",
">",
">",
"listAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"loadBalancerName",
")",
"{",
"return",
"listWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"loa... | Gets all the load balancer backed address pools.
@param resourceGroupName The name of the resource group.
@param loadBalancerName The name of the load balancer.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<BackendAddressPoolInner> object | [
"Gets",
"all",
"the",
"load",
"balancer",
"backed",
"address",
"pools",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/LoadBalancerBackendAddressPoolsInner.java#L123-L131 |
TheCoder4eu/BootsFaces-OSP | src/main/java/net/bootsfaces/component/selectBooleanCheckbox/SelectBooleanCheckboxRenderer.java | SelectBooleanCheckboxRenderer.addLabel | protected void addLabel(ResponseWriter rw, String clientId, SelectBooleanCheckbox selectBooleanCheckbox)
throws IOException {
if (selectBooleanCheckbox.isRenderLabel()) {
String label = selectBooleanCheckbox.getLabel();
if (label != null) {
rw.startElement("label", selectBooleanCheckbox);
generateErrorAndRequiredClass(selectBooleanCheckbox, rw, clientId, selectBooleanCheckbox.getLabelStyleClass(), Responsive.getResponsiveLabelClass(selectBooleanCheckbox), "control-label");
writeAttribute(rw, "style", selectBooleanCheckbox.getLabelStyle());
if (null != selectBooleanCheckbox.getDir()) {
rw.writeAttribute("dir", selectBooleanCheckbox.getDir(), "dir");
}
rw.writeAttribute("for", "input_" + clientId, "for");
rw.writeText(label, null);
rw.endElement("label");
}
}
} | java | protected void addLabel(ResponseWriter rw, String clientId, SelectBooleanCheckbox selectBooleanCheckbox)
throws IOException {
if (selectBooleanCheckbox.isRenderLabel()) {
String label = selectBooleanCheckbox.getLabel();
if (label != null) {
rw.startElement("label", selectBooleanCheckbox);
generateErrorAndRequiredClass(selectBooleanCheckbox, rw, clientId, selectBooleanCheckbox.getLabelStyleClass(), Responsive.getResponsiveLabelClass(selectBooleanCheckbox), "control-label");
writeAttribute(rw, "style", selectBooleanCheckbox.getLabelStyle());
if (null != selectBooleanCheckbox.getDir()) {
rw.writeAttribute("dir", selectBooleanCheckbox.getDir(), "dir");
}
rw.writeAttribute("for", "input_" + clientId, "for");
rw.writeText(label, null);
rw.endElement("label");
}
}
} | [
"protected",
"void",
"addLabel",
"(",
"ResponseWriter",
"rw",
",",
"String",
"clientId",
",",
"SelectBooleanCheckbox",
"selectBooleanCheckbox",
")",
"throws",
"IOException",
"{",
"if",
"(",
"selectBooleanCheckbox",
".",
"isRenderLabel",
"(",
")",
")",
"{",
"String",... | Renders the optional label. This method is protected in order to allow
third-party frameworks to derive from it.
@param rw
the response writer
@param clientId
the id used by the label to reference the input field
@param selectBooleanCheckbox
the component to render
@throws IOException
may be thrown by the response writer | [
"Renders",
"the",
"optional",
"label",
".",
"This",
"method",
"is",
"protected",
"in",
"order",
"to",
"allow",
"third",
"-",
"party",
"frameworks",
"to",
"derive",
"from",
"it",
"."
] | train | https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/component/selectBooleanCheckbox/SelectBooleanCheckboxRenderer.java#L147-L165 |
qatools/properties | src/main/java/ru/qatools/properties/PropertyLoader.java | PropertyLoader.getCollectionElementType | protected Class<?> getCollectionElementType(Type genericType) throws ConversionException {
if (genericType instanceof ParameterizedType) {
ParameterizedType parameterizedType = (ParameterizedType) genericType;
Type[] typeArguments = parameterizedType.getActualTypeArguments();
if (typeArguments.length != 1) {
throw new ConversionException("Types with more then one generic are not supported");
}
Type type = typeArguments[0];
if (type instanceof Class) {
return (Class<?>) type;
}
throw new ConversionException(String.format("Could not resolve generic type <%s>", type));
}
return String.class;
} | java | protected Class<?> getCollectionElementType(Type genericType) throws ConversionException {
if (genericType instanceof ParameterizedType) {
ParameterizedType parameterizedType = (ParameterizedType) genericType;
Type[] typeArguments = parameterizedType.getActualTypeArguments();
if (typeArguments.length != 1) {
throw new ConversionException("Types with more then one generic are not supported");
}
Type type = typeArguments[0];
if (type instanceof Class) {
return (Class<?>) type;
}
throw new ConversionException(String.format("Could not resolve generic type <%s>", type));
}
return String.class;
} | [
"protected",
"Class",
"<",
"?",
">",
"getCollectionElementType",
"(",
"Type",
"genericType",
")",
"throws",
"ConversionException",
"{",
"if",
"(",
"genericType",
"instanceof",
"ParameterizedType",
")",
"{",
"ParameterizedType",
"parameterizedType",
"=",
"(",
"Paramete... | Get collection element type for given type. Given type type should
be assignable from {@link Collection}. For collections without
generic returns {@link String}. | [
"Get",
"collection",
"element",
"type",
"for",
"given",
"type",
".",
"Given",
"type",
"type",
"should",
"be",
"assignable",
"from",
"{"
] | train | https://github.com/qatools/properties/blob/ae50b460a6bb4fcb21afe888b2e86a7613cd2115/src/main/java/ru/qatools/properties/PropertyLoader.java#L319-L335 |
jayantk/jklol | src/com/jayantkrish/jklol/ccg/lexinduct/CfgAlignmentModel.java | CfgAlignmentModel.getBestAlignment | public AlignedExpressionTree getBestAlignment(AlignmentExample example) {
CfgParser parser = getCfgParser(example);
ExpressionTree tree = example.getTree();
Factor rootFactor = getRootFactor(tree, parser.getParentVariable());
CfgParseChart chart = parser.parseMarginal(example.getWords(), rootFactor, false);
CfgParseTree parseTree = chart.getBestParseTree();
return decodeCfgParse(parseTree, 0);
} | java | public AlignedExpressionTree getBestAlignment(AlignmentExample example) {
CfgParser parser = getCfgParser(example);
ExpressionTree tree = example.getTree();
Factor rootFactor = getRootFactor(tree, parser.getParentVariable());
CfgParseChart chart = parser.parseMarginal(example.getWords(), rootFactor, false);
CfgParseTree parseTree = chart.getBestParseTree();
return decodeCfgParse(parseTree, 0);
} | [
"public",
"AlignedExpressionTree",
"getBestAlignment",
"(",
"AlignmentExample",
"example",
")",
"{",
"CfgParser",
"parser",
"=",
"getCfgParser",
"(",
"example",
")",
";",
"ExpressionTree",
"tree",
"=",
"example",
".",
"getTree",
"(",
")",
";",
"Factor",
"rootFacto... | Get the highest-scoring logical form derivation for {@code example}
according to this model.
@param example
@return | [
"Get",
"the",
"highest",
"-",
"scoring",
"logical",
"form",
"derivation",
"for",
"{",
"@code",
"example",
"}",
"according",
"to",
"this",
"model",
"."
] | train | https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/ccg/lexinduct/CfgAlignmentModel.java#L110-L119 |
NoraUi/NoraUi | src/main/java/com/github/noraui/application/steps/Step.java | Step.updateList | protected void updateList(PageElement pageElement, String textOrKey) throws TechnicalException, FailureException {
String value = getTextOrKey(textOrKey);
try {
setDropDownValue(pageElement, value);
} catch (final Exception e) {
new Result.Failure<>(e.getMessage(), Messages.format(Messages.getMessage(Messages.FAIL_MESSAGE_ERROR_ON_INPUT), pageElement, pageElement.getPage().getApplication()), true,
pageElement.getPage().getCallBack());
}
} | java | protected void updateList(PageElement pageElement, String textOrKey) throws TechnicalException, FailureException {
String value = getTextOrKey(textOrKey);
try {
setDropDownValue(pageElement, value);
} catch (final Exception e) {
new Result.Failure<>(e.getMessage(), Messages.format(Messages.getMessage(Messages.FAIL_MESSAGE_ERROR_ON_INPUT), pageElement, pageElement.getPage().getApplication()), true,
pageElement.getPage().getCallBack());
}
} | [
"protected",
"void",
"updateList",
"(",
"PageElement",
"pageElement",
",",
"String",
"textOrKey",
")",
"throws",
"TechnicalException",
",",
"FailureException",
"{",
"String",
"value",
"=",
"getTextOrKey",
"(",
"textOrKey",
")",
";",
"try",
"{",
"setDropDownValue",
... | Update a html select with a text value.
@param pageElement
Is target element
@param textOrKey
Is the new data (text or text in context (after a save))
@throws TechnicalException
is thrown if you have a technical error (format, configuration, datas, ...) in NoraUi.
Exception with {@value com.github.noraui.utils.Messages#FAIL_MESSAGE_ERROR_ON_INPUT} message (with screenshot, no exception)
or
Exception with {@value com.github.noraui.utils.Messages#FAIL_MESSAGE_VALUE_NOT_AVAILABLE_IN_THE_LIST} message (no screenshot, no exception)
@throws FailureException
if the scenario encounters a functional error | [
"Update",
"a",
"html",
"select",
"with",
"a",
"text",
"value",
"."
] | train | https://github.com/NoraUi/NoraUi/blob/5f491a3339c7d3c20d7207760bdaf2acdb8f260c/src/main/java/com/github/noraui/application/steps/Step.java#L457-L465 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/FilesImpl.java | FilesImpl.listFromComputeNodeAsync | public ServiceFuture<List<NodeFile>> listFromComputeNodeAsync(final String poolId, final String nodeId, final Boolean recursive, final FileListFromComputeNodeOptions fileListFromComputeNodeOptions, final ListOperationCallback<NodeFile> serviceCallback) {
return AzureServiceFuture.fromHeaderPageResponse(
listFromComputeNodeSinglePageAsync(poolId, nodeId, recursive, fileListFromComputeNodeOptions),
new Func1<String, Observable<ServiceResponseWithHeaders<Page<NodeFile>, FileListFromComputeNodeHeaders>>>() {
@Override
public Observable<ServiceResponseWithHeaders<Page<NodeFile>, FileListFromComputeNodeHeaders>> call(String nextPageLink) {
FileListFromComputeNodeNextOptions fileListFromComputeNodeNextOptions = null;
if (fileListFromComputeNodeOptions != null) {
fileListFromComputeNodeNextOptions = new FileListFromComputeNodeNextOptions();
fileListFromComputeNodeNextOptions.withClientRequestId(fileListFromComputeNodeOptions.clientRequestId());
fileListFromComputeNodeNextOptions.withReturnClientRequestId(fileListFromComputeNodeOptions.returnClientRequestId());
fileListFromComputeNodeNextOptions.withOcpDate(fileListFromComputeNodeOptions.ocpDate());
}
return listFromComputeNodeNextSinglePageAsync(nextPageLink, fileListFromComputeNodeNextOptions);
}
},
serviceCallback);
} | java | public ServiceFuture<List<NodeFile>> listFromComputeNodeAsync(final String poolId, final String nodeId, final Boolean recursive, final FileListFromComputeNodeOptions fileListFromComputeNodeOptions, final ListOperationCallback<NodeFile> serviceCallback) {
return AzureServiceFuture.fromHeaderPageResponse(
listFromComputeNodeSinglePageAsync(poolId, nodeId, recursive, fileListFromComputeNodeOptions),
new Func1<String, Observable<ServiceResponseWithHeaders<Page<NodeFile>, FileListFromComputeNodeHeaders>>>() {
@Override
public Observable<ServiceResponseWithHeaders<Page<NodeFile>, FileListFromComputeNodeHeaders>> call(String nextPageLink) {
FileListFromComputeNodeNextOptions fileListFromComputeNodeNextOptions = null;
if (fileListFromComputeNodeOptions != null) {
fileListFromComputeNodeNextOptions = new FileListFromComputeNodeNextOptions();
fileListFromComputeNodeNextOptions.withClientRequestId(fileListFromComputeNodeOptions.clientRequestId());
fileListFromComputeNodeNextOptions.withReturnClientRequestId(fileListFromComputeNodeOptions.returnClientRequestId());
fileListFromComputeNodeNextOptions.withOcpDate(fileListFromComputeNodeOptions.ocpDate());
}
return listFromComputeNodeNextSinglePageAsync(nextPageLink, fileListFromComputeNodeNextOptions);
}
},
serviceCallback);
} | [
"public",
"ServiceFuture",
"<",
"List",
"<",
"NodeFile",
">",
">",
"listFromComputeNodeAsync",
"(",
"final",
"String",
"poolId",
",",
"final",
"String",
"nodeId",
",",
"final",
"Boolean",
"recursive",
",",
"final",
"FileListFromComputeNodeOptions",
"fileListFromComput... | Lists all of the files in task directories on the specified compute node.
@param poolId The ID of the pool that contains the compute node.
@param nodeId The ID of the compute node whose files you want to list.
@param recursive Whether to list children of a directory.
@param fileListFromComputeNodeOptions Additional parameters for the operation
@param serviceCallback the async ServiceCallback to handle successful and failed responses.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceFuture} object | [
"Lists",
"all",
"of",
"the",
"files",
"in",
"task",
"directories",
"on",
"the",
"specified",
"compute",
"node",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/FilesImpl.java#L2077-L2094 |
pf4j/pf4j | pf4j/src/main/java/org/pf4j/DefaultPluginLoader.java | DefaultPluginLoader.loadJars | protected void loadJars(Path pluginPath, PluginClassLoader pluginClassLoader) {
for (String libDirectory : pluginClasspath.getLibDirectories()) {
Path file = pluginPath.resolve(libDirectory);
List<File> jars = FileUtils.getJars(file);
for (File jar : jars) {
pluginClassLoader.addFile(jar);
}
}
} | java | protected void loadJars(Path pluginPath, PluginClassLoader pluginClassLoader) {
for (String libDirectory : pluginClasspath.getLibDirectories()) {
Path file = pluginPath.resolve(libDirectory);
List<File> jars = FileUtils.getJars(file);
for (File jar : jars) {
pluginClassLoader.addFile(jar);
}
}
} | [
"protected",
"void",
"loadJars",
"(",
"Path",
"pluginPath",
",",
"PluginClassLoader",
"pluginClassLoader",
")",
"{",
"for",
"(",
"String",
"libDirectory",
":",
"pluginClasspath",
".",
"getLibDirectories",
"(",
")",
")",
"{",
"Path",
"file",
"=",
"pluginPath",
".... | Add all {@code *.jar} files from {@code lib} directories to plugin class loader. | [
"Add",
"all",
"{"
] | train | https://github.com/pf4j/pf4j/blob/6dd7a6069f0e2fbd842c81e2c8c388918b88ea81/pf4j/src/main/java/org/pf4j/DefaultPluginLoader.java#L76-L84 |
google/closure-compiler | src/com/google/javascript/refactoring/Matchers.java | Matchers.functionCallWithNumArgs | public static Matcher functionCallWithNumArgs(final int numArgs) {
return new Matcher() {
@Override public boolean matches(Node node, NodeMetadata metadata) {
return node.isCall() && (node.getChildCount() - 1) == numArgs;
}
};
} | java | public static Matcher functionCallWithNumArgs(final int numArgs) {
return new Matcher() {
@Override public boolean matches(Node node, NodeMetadata metadata) {
return node.isCall() && (node.getChildCount() - 1) == numArgs;
}
};
} | [
"public",
"static",
"Matcher",
"functionCallWithNumArgs",
"(",
"final",
"int",
"numArgs",
")",
"{",
"return",
"new",
"Matcher",
"(",
")",
"{",
"@",
"Override",
"public",
"boolean",
"matches",
"(",
"Node",
"node",
",",
"NodeMetadata",
"metadata",
")",
"{",
"r... | Returns a Matcher that matches any function call that has the given
number of arguments. | [
"Returns",
"a",
"Matcher",
"that",
"matches",
"any",
"function",
"call",
"that",
"has",
"the",
"given",
"number",
"of",
"arguments",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/refactoring/Matchers.java#L192-L198 |
OpenTSDB/opentsdb | src/tsd/QueryRpc.java | QueryRpc.parseQuery | public static TSQuery parseQuery(final TSDB tsdb, final HttpQuery query) {
return parseQuery(tsdb, query, null);
} | java | public static TSQuery parseQuery(final TSDB tsdb, final HttpQuery query) {
return parseQuery(tsdb, query, null);
} | [
"public",
"static",
"TSQuery",
"parseQuery",
"(",
"final",
"TSDB",
"tsdb",
",",
"final",
"HttpQuery",
"query",
")",
"{",
"return",
"parseQuery",
"(",
"tsdb",
",",
"query",
",",
"null",
")",
";",
"}"
] | Parses a query string legacy style query from the URI
@param tsdb The TSDB we belong to
@param query The HTTP Query for parsing
@return A TSQuery if parsing was successful
@throws BadRequestException if parsing was unsuccessful
@since 2.3 | [
"Parses",
"a",
"query",
"string",
"legacy",
"style",
"query",
"from",
"the",
"URI"
] | train | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tsd/QueryRpc.java#L521-L523 |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java | JBBPDslBuilder.Long | public JBBPDslBuilder Long(final String name) {
final Item item = new Item(BinType.LONG, name, this.byteOrder);
this.addItem(item);
return this;
} | java | public JBBPDslBuilder Long(final String name) {
final Item item = new Item(BinType.LONG, name, this.byteOrder);
this.addItem(item);
return this;
} | [
"public",
"JBBPDslBuilder",
"Long",
"(",
"final",
"String",
"name",
")",
"{",
"final",
"Item",
"item",
"=",
"new",
"Item",
"(",
"BinType",
".",
"LONG",
",",
"name",
",",
"this",
".",
"byteOrder",
")",
";",
"this",
".",
"addItem",
"(",
"item",
")",
";... | Add named long field.
@param name name of the field, can be null for anonymous
@return the builder instance, must not be null | [
"Add",
"named",
"long",
"field",
"."
] | train | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java#L1157-L1161 |
nhurion/vaadin-for-heroku | src/main/java/eu/hurion/vaadin/heroku/FilterDefinitionBuilder.java | FilterDefinitionBuilder.withParameter | public FilterDefinitionBuilder withParameter(final String name, final String value) {
if (parameters.containsKey(name)) {
// The spec does not define this but the TCK expects the first
// definition to take precedence
return this;
}
this.parameters.put(name, value);
return this;
} | java | public FilterDefinitionBuilder withParameter(final String name, final String value) {
if (parameters.containsKey(name)) {
// The spec does not define this but the TCK expects the first
// definition to take precedence
return this;
}
this.parameters.put(name, value);
return this;
} | [
"public",
"FilterDefinitionBuilder",
"withParameter",
"(",
"final",
"String",
"name",
",",
"final",
"String",
"value",
")",
"{",
"if",
"(",
"parameters",
".",
"containsKey",
"(",
"name",
")",
")",
"{",
"// The spec does not define this but the TCK expects the first",
... | Add a parameter with its associated value.
One a parameter has been added, its value cannot be changed.
@param name the name of the parameter
@param value the value of the parameter
@return this | [
"Add",
"a",
"parameter",
"with",
"its",
"associated",
"value",
".",
"One",
"a",
"parameter",
"has",
"been",
"added",
"its",
"value",
"cannot",
"be",
"changed",
"."
] | train | https://github.com/nhurion/vaadin-for-heroku/blob/51b1c22827934eb6105b0cfb0254cc15df23e991/src/main/java/eu/hurion/vaadin/heroku/FilterDefinitionBuilder.java#L72-L80 |
facebook/fresco | imagepipeline/src/main/java/com/facebook/imagepipeline/request/BasePostprocessor.java | BasePostprocessor.internalCopyBitmap | private static void internalCopyBitmap(Bitmap destBitmap, Bitmap sourceBitmap) {
if (destBitmap.getConfig() == sourceBitmap.getConfig()) {
Bitmaps.copyBitmap(destBitmap, sourceBitmap);
} else {
// The bitmap configurations might be different when the source bitmap's configuration is
// null, because it uses an internal configuration and the destination bitmap's configuration
// is the FALLBACK_BITMAP_CONFIGURATION. This is the case for static images for animated GIFs.
Canvas canvas = new Canvas(destBitmap);
canvas.drawBitmap(sourceBitmap, 0, 0, null);
}
} | java | private static void internalCopyBitmap(Bitmap destBitmap, Bitmap sourceBitmap) {
if (destBitmap.getConfig() == sourceBitmap.getConfig()) {
Bitmaps.copyBitmap(destBitmap, sourceBitmap);
} else {
// The bitmap configurations might be different when the source bitmap's configuration is
// null, because it uses an internal configuration and the destination bitmap's configuration
// is the FALLBACK_BITMAP_CONFIGURATION. This is the case for static images for animated GIFs.
Canvas canvas = new Canvas(destBitmap);
canvas.drawBitmap(sourceBitmap, 0, 0, null);
}
} | [
"private",
"static",
"void",
"internalCopyBitmap",
"(",
"Bitmap",
"destBitmap",
",",
"Bitmap",
"sourceBitmap",
")",
"{",
"if",
"(",
"destBitmap",
".",
"getConfig",
"(",
")",
"==",
"sourceBitmap",
".",
"getConfig",
"(",
")",
")",
"{",
"Bitmaps",
".",
"copyBit... | Copies the content of {@code sourceBitmap} to {@code destBitmap}. Both bitmaps must have the
same width and height. If their {@link Bitmap.Config} are identical, the memory is directly
copied. Otherwise, the {@code sourceBitmap} is drawn into {@code destBitmap}. | [
"Copies",
"the",
"content",
"of",
"{"
] | train | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/imagepipeline/src/main/java/com/facebook/imagepipeline/request/BasePostprocessor.java#L114-L124 |
pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/logs/OperationProcessor.java | OperationProcessor.processOperation | private void processOperation(CompletableOperation operation) throws Exception {
Preconditions.checkState(!operation.isDone(), "The Operation has already been processed.");
Operation entry = operation.getOperation();
synchronized (this.stateLock) {
// Update Metadata and Operations with any missing data (offsets, lengths, etc) - the Metadata Updater
// has all the knowledge for that task.
this.metadataUpdater.preProcessOperation(entry);
// Entry is ready to be serialized; assign a sequence number.
entry.setSequenceNumber(this.metadataUpdater.nextOperationSequenceNumber());
this.dataFrameBuilder.append(entry);
this.metadataUpdater.acceptOperation(entry);
}
log.trace("{}: DataFrameBuilder.Append {}.", this.traceObjectId, entry);
} | java | private void processOperation(CompletableOperation operation) throws Exception {
Preconditions.checkState(!operation.isDone(), "The Operation has already been processed.");
Operation entry = operation.getOperation();
synchronized (this.stateLock) {
// Update Metadata and Operations with any missing data (offsets, lengths, etc) - the Metadata Updater
// has all the knowledge for that task.
this.metadataUpdater.preProcessOperation(entry);
// Entry is ready to be serialized; assign a sequence number.
entry.setSequenceNumber(this.metadataUpdater.nextOperationSequenceNumber());
this.dataFrameBuilder.append(entry);
this.metadataUpdater.acceptOperation(entry);
}
log.trace("{}: DataFrameBuilder.Append {}.", this.traceObjectId, entry);
} | [
"private",
"void",
"processOperation",
"(",
"CompletableOperation",
"operation",
")",
"throws",
"Exception",
"{",
"Preconditions",
".",
"checkState",
"(",
"!",
"operation",
".",
"isDone",
"(",
")",
",",
"\"The Operation has already been processed.\"",
")",
";",
"Opera... | Processes a single operation.
Steps:
<ol>
<li> Pre-processes operation (in MetadataUpdater).
<li> Assigns Sequence Number.
<li> Appends to DataFrameBuilder.
<li> Accepts operation in MetadataUpdater.
</ol>
@param operation The operation to process.
@throws Exception If an exception occurred while processing this operation. Depending on the type of the exception,
this could be due to the operation itself being invalid, or because we are unable to process any more operations. | [
"Processes",
"a",
"single",
"operation",
".",
"Steps",
":",
"<ol",
">",
"<li",
">",
"Pre",
"-",
"processes",
"operation",
"(",
"in",
"MetadataUpdater",
")",
".",
"<li",
">",
"Assigns",
"Sequence",
"Number",
".",
"<li",
">",
"Appends",
"to",
"DataFrameBuild... | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/logs/OperationProcessor.java#L351-L367 |
Alluxio/alluxio | core/common/src/main/java/alluxio/resource/DynamicResourcePool.java | DynamicResourcePool.checkHealthyAndRetry | private T checkHealthyAndRetry(T resource, long endTimeMs) throws TimeoutException, IOException {
if (isHealthy(resource)) {
return resource;
} else {
LOG.info("Clearing unhealthy resource {}.", resource);
remove(resource);
closeResource(resource);
return acquire(endTimeMs - mClock.millis(), TimeUnit.MILLISECONDS);
}
} | java | private T checkHealthyAndRetry(T resource, long endTimeMs) throws TimeoutException, IOException {
if (isHealthy(resource)) {
return resource;
} else {
LOG.info("Clearing unhealthy resource {}.", resource);
remove(resource);
closeResource(resource);
return acquire(endTimeMs - mClock.millis(), TimeUnit.MILLISECONDS);
}
} | [
"private",
"T",
"checkHealthyAndRetry",
"(",
"T",
"resource",
",",
"long",
"endTimeMs",
")",
"throws",
"TimeoutException",
",",
"IOException",
"{",
"if",
"(",
"isHealthy",
"(",
"resource",
")",
")",
"{",
"return",
"resource",
";",
"}",
"else",
"{",
"LOG",
... | Checks whether the resource is healthy. If not retry. When this called, the resource
is not in mAvailableResources.
@param resource the resource to check
@param endTimeMs the end time to wait till
@return the resource
@throws TimeoutException if it times out to wait for a resource | [
"Checks",
"whether",
"the",
"resource",
"is",
"healthy",
".",
"If",
"not",
"retry",
".",
"When",
"this",
"called",
"the",
"resource",
"is",
"not",
"in",
"mAvailableResources",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/resource/DynamicResourcePool.java#L474-L483 |
Coveros/selenified | src/main/java/com/coveros/selenified/utilities/Property.java | Property.getProxy | public static String getProxy() throws InvalidProxyException {
String proxy = getProgramProperty(PROXY);
if (proxy == null) {
throw new InvalidProxyException(PROXY_ISNT_SET);
}
String[] proxyParts = proxy.split(":");
if (proxyParts.length != 2) {
throw new InvalidProxyException("Proxy '" + proxy + "' isn't valid. Must contain address and port, without protocol");
}
try {
Integer.parseInt(proxyParts[1]);
} catch (NumberFormatException e) {
throw new InvalidProxyException("Proxy '" + proxy + "' isn't valid. Must contain address and port, without protocol. Invalid port provided. " + e);
}
return proxy;
} | java | public static String getProxy() throws InvalidProxyException {
String proxy = getProgramProperty(PROXY);
if (proxy == null) {
throw new InvalidProxyException(PROXY_ISNT_SET);
}
String[] proxyParts = proxy.split(":");
if (proxyParts.length != 2) {
throw new InvalidProxyException("Proxy '" + proxy + "' isn't valid. Must contain address and port, without protocol");
}
try {
Integer.parseInt(proxyParts[1]);
} catch (NumberFormatException e) {
throw new InvalidProxyException("Proxy '" + proxy + "' isn't valid. Must contain address and port, without protocol. Invalid port provided. " + e);
}
return proxy;
} | [
"public",
"static",
"String",
"getProxy",
"(",
")",
"throws",
"InvalidProxyException",
"{",
"String",
"proxy",
"=",
"getProgramProperty",
"(",
"PROXY",
")",
";",
"if",
"(",
"proxy",
"==",
"null",
")",
"{",
"throw",
"new",
"InvalidProxyException",
"(",
"PROXY_I... | Retrieves the proxy property if it is set. This could be to something local, or in the cloud.
Provide the protocol, address, and port
@return String: the set proxy address, null if none are set | [
"Retrieves",
"the",
"proxy",
"property",
"if",
"it",
"is",
"set",
".",
"This",
"could",
"be",
"to",
"something",
"local",
"or",
"in",
"the",
"cloud",
".",
"Provide",
"the",
"protocol",
"address",
"and",
"port"
] | train | https://github.com/Coveros/selenified/blob/396cc1f010dd69eed33cc5061c41253de246a4cd/src/main/java/com/coveros/selenified/utilities/Property.java#L168-L183 |
UrielCh/ovh-java-sdk | ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java | ApiOvhTelephony.billingAccount_line_serviceName_phone_phonebook_bookKey_phonebookContact_id_GET | public OvhPhonebookContact billingAccount_line_serviceName_phone_phonebook_bookKey_phonebookContact_id_GET(String billingAccount, String serviceName, String bookKey, Long id) throws IOException {
String qPath = "/telephony/{billingAccount}/line/{serviceName}/phone/phonebook/{bookKey}/phonebookContact/{id}";
StringBuilder sb = path(qPath, billingAccount, serviceName, bookKey, id);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhPhonebookContact.class);
} | java | public OvhPhonebookContact billingAccount_line_serviceName_phone_phonebook_bookKey_phonebookContact_id_GET(String billingAccount, String serviceName, String bookKey, Long id) throws IOException {
String qPath = "/telephony/{billingAccount}/line/{serviceName}/phone/phonebook/{bookKey}/phonebookContact/{id}";
StringBuilder sb = path(qPath, billingAccount, serviceName, bookKey, id);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhPhonebookContact.class);
} | [
"public",
"OvhPhonebookContact",
"billingAccount_line_serviceName_phone_phonebook_bookKey_phonebookContact_id_GET",
"(",
"String",
"billingAccount",
",",
"String",
"serviceName",
",",
"String",
"bookKey",
",",
"Long",
"id",
")",
"throws",
"IOException",
"{",
"String",
"qPath"... | Get this object properties
REST: GET /telephony/{billingAccount}/line/{serviceName}/phone/phonebook/{bookKey}/phonebookContact/{id}
@param billingAccount [required] The name of your billingAccount
@param serviceName [required]
@param bookKey [required] Identifier of the phonebook
@param id [required] Contact identifier | [
"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#L1305-L1310 |
liferay/com-liferay-commerce | commerce-discount-service/src/main/java/com/liferay/commerce/discount/service/persistence/impl/CommerceDiscountUsageEntryPersistenceImpl.java | CommerceDiscountUsageEntryPersistenceImpl.findByGroupId | @Override
public List<CommerceDiscountUsageEntry> findByGroupId(long groupId) {
return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
} | java | @Override
public List<CommerceDiscountUsageEntry> findByGroupId(long groupId) {
return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CommerceDiscountUsageEntry",
">",
"findByGroupId",
"(",
"long",
"groupId",
")",
"{",
"return",
"findByGroupId",
"(",
"groupId",
",",
"QueryUtil",
".",
"ALL_POS",
",",
"QueryUtil",
".",
"ALL_POS",
",",
"null",
")",
";",
... | Returns all the commerce discount usage entries where groupId = ?.
@param groupId the group ID
@return the matching commerce discount usage entries | [
"Returns",
"all",
"the",
"commerce",
"discount",
"usage",
"entries",
"where",
"groupId",
"=",
"?",
";",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-discount-service/src/main/java/com/liferay/commerce/discount/service/persistence/impl/CommerceDiscountUsageEntryPersistenceImpl.java#L124-L127 |
apache/incubator-gobblin | gobblin-runtime/src/main/java/org/apache/gobblin/runtime/TaskContext.java | TaskContext.getWriterOutputFormat | public WriterOutputFormat getWriterOutputFormat(int branches, int index) {
String writerOutputFormatValue = this.taskState.getProp(
ForkOperatorUtils.getPropertyNameForBranch(ConfigurationKeys.WRITER_OUTPUT_FORMAT_KEY, branches, index),
WriterOutputFormat.OTHER.name());
log.debug("Found writer output format value = {}", writerOutputFormatValue);
WriterOutputFormat wof = Enums.getIfPresent(WriterOutputFormat.class, writerOutputFormatValue.toUpperCase())
.or(WriterOutputFormat.OTHER);
log.debug("Returning writer output format = {}", wof);
return wof;
} | java | public WriterOutputFormat getWriterOutputFormat(int branches, int index) {
String writerOutputFormatValue = this.taskState.getProp(
ForkOperatorUtils.getPropertyNameForBranch(ConfigurationKeys.WRITER_OUTPUT_FORMAT_KEY, branches, index),
WriterOutputFormat.OTHER.name());
log.debug("Found writer output format value = {}", writerOutputFormatValue);
WriterOutputFormat wof = Enums.getIfPresent(WriterOutputFormat.class, writerOutputFormatValue.toUpperCase())
.or(WriterOutputFormat.OTHER);
log.debug("Returning writer output format = {}", wof);
return wof;
} | [
"public",
"WriterOutputFormat",
"getWriterOutputFormat",
"(",
"int",
"branches",
",",
"int",
"index",
")",
"{",
"String",
"writerOutputFormatValue",
"=",
"this",
".",
"taskState",
".",
"getProp",
"(",
"ForkOperatorUtils",
".",
"getPropertyNameForBranch",
"(",
"Configu... | Get the output format of the writer of type {@link WriterOutputFormat}.
@param branches number of forked branches
@param index branch index
@return output format of the writer | [
"Get",
"the",
"output",
"format",
"of",
"the",
"writer",
"of",
"type",
"{",
"@link",
"WriterOutputFormat",
"}",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-runtime/src/main/java/org/apache/gobblin/runtime/TaskContext.java#L174-L184 |
autermann/yaml | src/main/java/com/github/autermann/yaml/nodes/YamlMappingNode.java | YamlMappingNode.put | public T put(YamlNode key, DateTime value) {
return put(key, getNodeFactory().dateTimeNode(value));
} | java | public T put(YamlNode key, DateTime value) {
return put(key, getNodeFactory().dateTimeNode(value));
} | [
"public",
"T",
"put",
"(",
"YamlNode",
"key",
",",
"DateTime",
"value",
")",
"{",
"return",
"put",
"(",
"key",
",",
"getNodeFactory",
"(",
")",
".",
"dateTimeNode",
"(",
"value",
")",
")",
";",
"}"
] | Adds the specified {@code key}/{@code value} pair to this mapping.
@param key the key
@param value the value
@return {@code this} | [
"Adds",
"the",
"specified",
"{",
"@code",
"key",
"}",
"/",
"{",
"@code",
"value",
"}",
"pair",
"to",
"this",
"mapping",
"."
] | train | https://github.com/autermann/yaml/blob/5f8ab03e4fec3a2abe72c03561cdaa3a3936634d/src/main/java/com/github/autermann/yaml/nodes/YamlMappingNode.java#L756-L758 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/AcroFields.java | AcroFields.setListSelection | public boolean setListSelection(String name, String[] value) throws IOException, DocumentException {
Item item = getFieldItem(name);
if (item == null)
return false;
PdfName type = item.getMerged(0).getAsName(PdfName.FT);
if (!PdfName.CH.equals(type)) {
return false;
}
String[] options = getListOptionExport(name);
PdfArray array = new PdfArray();
for (int i = 0; i < value.length; i++) {
for (int j = 0; j < options.length; j++) {
if (options[j].equals(value[i])) {
array.add(new PdfNumber(j));
}
}
}
item.writeToAll(PdfName.I, array, Item.WRITE_MERGED | Item.WRITE_VALUE);
item.writeToAll(PdfName.V, null, Item.WRITE_MERGED | Item.WRITE_VALUE);
item.writeToAll(PdfName.AP, null, Item.WRITE_MERGED | Item.WRITE_WIDGET);
item.markUsed( this, Item.WRITE_VALUE | Item.WRITE_WIDGET );
return true;
} | java | public boolean setListSelection(String name, String[] value) throws IOException, DocumentException {
Item item = getFieldItem(name);
if (item == null)
return false;
PdfName type = item.getMerged(0).getAsName(PdfName.FT);
if (!PdfName.CH.equals(type)) {
return false;
}
String[] options = getListOptionExport(name);
PdfArray array = new PdfArray();
for (int i = 0; i < value.length; i++) {
for (int j = 0; j < options.length; j++) {
if (options[j].equals(value[i])) {
array.add(new PdfNumber(j));
}
}
}
item.writeToAll(PdfName.I, array, Item.WRITE_MERGED | Item.WRITE_VALUE);
item.writeToAll(PdfName.V, null, Item.WRITE_MERGED | Item.WRITE_VALUE);
item.writeToAll(PdfName.AP, null, Item.WRITE_MERGED | Item.WRITE_WIDGET);
item.markUsed( this, Item.WRITE_VALUE | Item.WRITE_WIDGET );
return true;
} | [
"public",
"boolean",
"setListSelection",
"(",
"String",
"name",
",",
"String",
"[",
"]",
"value",
")",
"throws",
"IOException",
",",
"DocumentException",
"{",
"Item",
"item",
"=",
"getFieldItem",
"(",
"name",
")",
";",
"if",
"(",
"item",
"==",
"null",
")",... | Sets different values in a list selection.
No appearance is generated yet; nor does the code check if multiple select is allowed.
@param name the name of the field
@param value an array with values that need to be selected
@return true only if the field value was changed
@since 2.1.4 | [
"Sets",
"different",
"values",
"in",
"a",
"list",
"selection",
".",
"No",
"appearance",
"is",
"generated",
"yet",
";",
"nor",
"does",
"the",
"code",
"check",
"if",
"multiple",
"select",
"is",
"allowed",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/AcroFields.java#L1431-L1453 |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/VirtualHost.java | VirtualHost.addMapping | protected synchronized void addMapping(String contextRoot, WebGroup group) throws Exception {
if (TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) {
logger.logp(Level.FINE, CLASS_NAME, "addMapping", " contextRoot -->" + contextRoot + " group -->" + group.getName() + " : " + this.hashCode());
}
requestMapper.addMapping(contextRoot, group);
} | java | protected synchronized void addMapping(String contextRoot, WebGroup group) throws Exception {
if (TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) {
logger.logp(Level.FINE, CLASS_NAME, "addMapping", " contextRoot -->" + contextRoot + " group -->" + group.getName() + " : " + this.hashCode());
}
requestMapper.addMapping(contextRoot, group);
} | [
"protected",
"synchronized",
"void",
"addMapping",
"(",
"String",
"contextRoot",
",",
"WebGroup",
"group",
")",
"throws",
"Exception",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"logger",
".",
"isLoggable",
"(",
"Level",
".",
... | end 280649 SERVICE: clean up separation of core and shell WASCC.web.webcontainer | [
"end",
"280649",
"SERVICE",
":",
"clean",
"up",
"separation",
"of",
"core",
"and",
"shell",
"WASCC",
".",
"web",
".",
"webcontainer"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/VirtualHost.java#L280-L285 |
google/error-prone-javac | src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/MemberSummaryBuilder.java | MemberSummaryBuilder.buildConstructorsSummary | public void buildConstructorsSummary(XMLNode node, Content memberSummaryTree) {
MemberSummaryWriter writer =
memberSummaryWriters.get(VisibleMemberMap.Kind.CONSTRUCTORS);
VisibleMemberMap visibleMemberMap =
getVisibleMemberMap(VisibleMemberMap.Kind.CONSTRUCTORS);
addSummary(writer, visibleMemberMap, false, memberSummaryTree);
} | java | public void buildConstructorsSummary(XMLNode node, Content memberSummaryTree) {
MemberSummaryWriter writer =
memberSummaryWriters.get(VisibleMemberMap.Kind.CONSTRUCTORS);
VisibleMemberMap visibleMemberMap =
getVisibleMemberMap(VisibleMemberMap.Kind.CONSTRUCTORS);
addSummary(writer, visibleMemberMap, false, memberSummaryTree);
} | [
"public",
"void",
"buildConstructorsSummary",
"(",
"XMLNode",
"node",
",",
"Content",
"memberSummaryTree",
")",
"{",
"MemberSummaryWriter",
"writer",
"=",
"memberSummaryWriters",
".",
"get",
"(",
"VisibleMemberMap",
".",
"Kind",
".",
"CONSTRUCTORS",
")",
";",
"Visib... | Build the constructor summary.
@param node the XML element that specifies which components to document
@param memberSummaryTree the content tree to which the documentation will be added | [
"Build",
"the",
"constructor",
"summary",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/MemberSummaryBuilder.java#L318-L324 |
google/jimfs | jimfs/src/main/java/com/google/common/jimfs/FileSystemView.java | FileSystemView.checkAccess | public void checkAccess(JimfsPath path) throws IOException {
// just check that the file exists
lookUpWithLock(path, Options.FOLLOW_LINKS).requireExists(path);
} | java | public void checkAccess(JimfsPath path) throws IOException {
// just check that the file exists
lookUpWithLock(path, Options.FOLLOW_LINKS).requireExists(path);
} | [
"public",
"void",
"checkAccess",
"(",
"JimfsPath",
"path",
")",
"throws",
"IOException",
"{",
"// just check that the file exists",
"lookUpWithLock",
"(",
"path",
",",
"Options",
".",
"FOLLOW_LINKS",
")",
".",
"requireExists",
"(",
"path",
")",
";",
"}"
] | Checks access to the file at the given path for the given modes. Since access controls are not
implemented for this file system, this just checks that the file exists. | [
"Checks",
"access",
"to",
"the",
"file",
"at",
"the",
"given",
"path",
"for",
"the",
"given",
"modes",
".",
"Since",
"access",
"controls",
"are",
"not",
"implemented",
"for",
"this",
"file",
"system",
"this",
"just",
"checks",
"that",
"the",
"file",
"exist... | train | https://github.com/google/jimfs/blob/3eadff747a3afa7b498030f420d2d04ce700534a/jimfs/src/main/java/com/google/common/jimfs/FileSystemView.java#L382-L385 |
Swagger2Markup/swagger2markup | src/main/java/io/github/swagger2markup/internal/utils/PathUtils.java | PathUtils.toPathOperationsList | public static List<PathOperation> toPathOperationsList(String path, Path pathModel) {
List<PathOperation> pathOperations = new ArrayList<>();
getOperationMap(pathModel).forEach((httpMethod, operation) ->
pathOperations.add(new PathOperation(httpMethod, path, operation)));
return pathOperations;
} | java | public static List<PathOperation> toPathOperationsList(String path, Path pathModel) {
List<PathOperation> pathOperations = new ArrayList<>();
getOperationMap(pathModel).forEach((httpMethod, operation) ->
pathOperations.add(new PathOperation(httpMethod, path, operation)));
return pathOperations;
} | [
"public",
"static",
"List",
"<",
"PathOperation",
">",
"toPathOperationsList",
"(",
"String",
"path",
",",
"Path",
"pathModel",
")",
"{",
"List",
"<",
"PathOperation",
">",
"pathOperations",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"getOperationMap",
"(",... | Converts a Swagger path into a PathOperation.
@param path the path
@param pathModel the Swagger Path model
@return the path operations | [
"Converts",
"a",
"Swagger",
"path",
"into",
"a",
"PathOperation",
"."
] | train | https://github.com/Swagger2Markup/swagger2markup/blob/da83465f19a2f8a0f1fba873b5762bca8587896b/src/main/java/io/github/swagger2markup/internal/utils/PathUtils.java#L91-L96 |
carewebframework/carewebframework-core | org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/query/QueryUtil.java | QueryUtil.packageResult | public static <T> IQueryResult<T> packageResult(List<T> results, CompletionStatus status) {
return packageResult(results, status, null);
} | java | public static <T> IQueryResult<T> packageResult(List<T> results, CompletionStatus status) {
return packageResult(results, status, null);
} | [
"public",
"static",
"<",
"T",
">",
"IQueryResult",
"<",
"T",
">",
"packageResult",
"(",
"List",
"<",
"T",
">",
"results",
",",
"CompletionStatus",
"status",
")",
"{",
"return",
"packageResult",
"(",
"results",
",",
"status",
",",
"null",
")",
";",
"}"
] | Convenience method for packaging query results.
@param <T> Class of query result.
@param results Results to package.
@param status The completion status.
@return Packaged results. | [
"Convenience",
"method",
"for",
"packaging",
"query",
"results",
"."
] | train | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/query/QueryUtil.java#L115-L117 |
kite-sdk/kite | kite-morphlines/kite-morphlines-core/src/main/java/org/kitesdk/morphline/shaded/org/apache/commons/codec/binary/binary/Base64.java | Base64.encodeBase64 | public static byte[] encodeBase64(final byte[] binaryData, final boolean isChunked, final boolean urlSafe) {
return encodeBase64(binaryData, isChunked, urlSafe, Integer.MAX_VALUE);
} | java | public static byte[] encodeBase64(final byte[] binaryData, final boolean isChunked, final boolean urlSafe) {
return encodeBase64(binaryData, isChunked, urlSafe, Integer.MAX_VALUE);
} | [
"public",
"static",
"byte",
"[",
"]",
"encodeBase64",
"(",
"final",
"byte",
"[",
"]",
"binaryData",
",",
"final",
"boolean",
"isChunked",
",",
"final",
"boolean",
"urlSafe",
")",
"{",
"return",
"encodeBase64",
"(",
"binaryData",
",",
"isChunked",
",",
"urlSa... | Encodes binary data using the base64 algorithm, optionally chunking the output into 76 character blocks.
@param binaryData
Array containing binary data to encode.
@param isChunked
if {@code true} this encoder will chunk the base64 output into 76 character blocks
@param urlSafe
if {@code true} this encoder will emit - and _ instead of the usual + and / characters.
<b>Note: no padding is added when encoding using the URL-safe alphabet.</b>
@return Base64-encoded data.
@throws IllegalArgumentException
Thrown when the input array needs an output array bigger than {@link Integer#MAX_VALUE}
@since 1.4 | [
"Encodes",
"binary",
"data",
"using",
"the",
"base64",
"algorithm",
"optionally",
"chunking",
"the",
"output",
"into",
"76",
"character",
"blocks",
"."
] | train | https://github.com/kite-sdk/kite/blob/72bfb4b1a881af85808cd7f14bc3e15160a1e811/kite-morphlines/kite-morphlines-core/src/main/java/org/kitesdk/morphline/shaded/org/apache/commons/codec/binary/binary/Base64.java#L638-L640 |
SeleniumHQ/selenium | java/client/src/org/openqa/selenium/safari/SafariOptions.java | SafariOptions.fromCapabilities | public static SafariOptions fromCapabilities(Capabilities capabilities)
throws WebDriverException {
if (capabilities instanceof SafariOptions) {
return (SafariOptions) capabilities;
}
Object cap = capabilities.getCapability(SafariOptions.CAPABILITY);
if (cap instanceof SafariOptions) {
return (SafariOptions) cap;
} else if (cap instanceof Map) {
return new SafariOptions(new MutableCapabilities(((Map<String, ?>) cap)));
} else {
return new SafariOptions();
}
} | java | public static SafariOptions fromCapabilities(Capabilities capabilities)
throws WebDriverException {
if (capabilities instanceof SafariOptions) {
return (SafariOptions) capabilities;
}
Object cap = capabilities.getCapability(SafariOptions.CAPABILITY);
if (cap instanceof SafariOptions) {
return (SafariOptions) cap;
} else if (cap instanceof Map) {
return new SafariOptions(new MutableCapabilities(((Map<String, ?>) cap)));
} else {
return new SafariOptions();
}
} | [
"public",
"static",
"SafariOptions",
"fromCapabilities",
"(",
"Capabilities",
"capabilities",
")",
"throws",
"WebDriverException",
"{",
"if",
"(",
"capabilities",
"instanceof",
"SafariOptions",
")",
"{",
"return",
"(",
"SafariOptions",
")",
"capabilities",
";",
"}",
... | Construct a {@link SafariOptions} instance from given capabilities.
When the {@link #CAPABILITY} capability is set, all other capabilities will be ignored!
@param capabilities Desired capabilities from which the options are derived.
@return SafariOptions
@throws WebDriverException If an error occurred during the reconstruction of the options | [
"Construct",
"a",
"{",
"@link",
"SafariOptions",
"}",
"instance",
"from",
"given",
"capabilities",
".",
"When",
"the",
"{",
"@link",
"#CAPABILITY",
"}",
"capability",
"is",
"set",
"all",
"other",
"capabilities",
"will",
"be",
"ignored!"
] | train | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/safari/SafariOptions.java#L102-L115 |
querydsl/querydsl | querydsl-sql/src/main/java/com/querydsl/sql/ProjectableSQLQuery.java | ProjectableSQLQuery.addFlag | @Override
public Q addFlag(Position position, String prefix, Expression<?> expr) {
Expression<?> flag = Expressions.template(expr.getType(), prefix + "{0}", expr);
return queryMixin.addFlag(new QueryFlag(position, flag));
} | java | @Override
public Q addFlag(Position position, String prefix, Expression<?> expr) {
Expression<?> flag = Expressions.template(expr.getType(), prefix + "{0}", expr);
return queryMixin.addFlag(new QueryFlag(position, flag));
} | [
"@",
"Override",
"public",
"Q",
"addFlag",
"(",
"Position",
"position",
",",
"String",
"prefix",
",",
"Expression",
"<",
"?",
">",
"expr",
")",
"{",
"Expression",
"<",
"?",
">",
"flag",
"=",
"Expressions",
".",
"template",
"(",
"expr",
".",
"getType",
... | Add the given prefix and expression as a general query flag
@param position position of the flag
@param prefix prefix for the flag
@param expr expression of the flag
@return the current object | [
"Add",
"the",
"given",
"prefix",
"and",
"expression",
"as",
"a",
"general",
"query",
"flag"
] | train | https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/ProjectableSQLQuery.java#L110-L114 |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/legacy/backpressure/StackTraceSampleCoordinator.java | StackTraceSampleCoordinator.cancelStackTraceSample | public void cancelStackTraceSample(int sampleId, Throwable cause) {
synchronized (lock) {
if (isShutDown) {
return;
}
PendingStackTraceSample sample = pendingSamples.remove(sampleId);
if (sample != null) {
if (cause != null) {
LOG.info("Cancelling sample " + sampleId, cause);
} else {
LOG.info("Cancelling sample {}", sampleId);
}
sample.discard(cause);
rememberRecentSampleId(sampleId);
}
}
} | java | public void cancelStackTraceSample(int sampleId, Throwable cause) {
synchronized (lock) {
if (isShutDown) {
return;
}
PendingStackTraceSample sample = pendingSamples.remove(sampleId);
if (sample != null) {
if (cause != null) {
LOG.info("Cancelling sample " + sampleId, cause);
} else {
LOG.info("Cancelling sample {}", sampleId);
}
sample.discard(cause);
rememberRecentSampleId(sampleId);
}
}
} | [
"public",
"void",
"cancelStackTraceSample",
"(",
"int",
"sampleId",
",",
"Throwable",
"cause",
")",
"{",
"synchronized",
"(",
"lock",
")",
"{",
"if",
"(",
"isShutDown",
")",
"{",
"return",
";",
"}",
"PendingStackTraceSample",
"sample",
"=",
"pendingSamples",
"... | Cancels a pending sample.
@param sampleId ID of the sample to cancel.
@param cause Cause of the cancelling (can be <code>null</code>). | [
"Cancels",
"a",
"pending",
"sample",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/legacy/backpressure/StackTraceSampleCoordinator.java#L192-L210 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/config/ProjectFilterSettings.java | ProjectFilterSettings.hiddenFromEncodedString | public static void hiddenFromEncodedString(ProjectFilterSettings result, String s) {
if (s.length() > 0) {
int bar = s.indexOf(FIELD_DELIMITER);
String categories;
if (bar >= 0) {
categories = s.substring(0, bar);
} else {
categories = s;
}
StringTokenizer t = new StringTokenizer(categories, LISTITEM_DELIMITER);
while (t.hasMoreTokens()) {
String category = t.nextToken();
result.removeCategory(category);
}
}
} | java | public static void hiddenFromEncodedString(ProjectFilterSettings result, String s) {
if (s.length() > 0) {
int bar = s.indexOf(FIELD_DELIMITER);
String categories;
if (bar >= 0) {
categories = s.substring(0, bar);
} else {
categories = s;
}
StringTokenizer t = new StringTokenizer(categories, LISTITEM_DELIMITER);
while (t.hasMoreTokens()) {
String category = t.nextToken();
result.removeCategory(category);
}
}
} | [
"public",
"static",
"void",
"hiddenFromEncodedString",
"(",
"ProjectFilterSettings",
"result",
",",
"String",
"s",
")",
"{",
"if",
"(",
"s",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"int",
"bar",
"=",
"s",
".",
"indexOf",
"(",
"FIELD_DELIMITER",
")",... | set the hidden bug categories on the specifed ProjectFilterSettings from
an encoded string
@param result
the ProjectFilterSettings from which to remove bug categories
@param s
the encoded string
@see ProjectFilterSettings#hiddenFromEncodedString(ProjectFilterSettings,
String) | [
"set",
"the",
"hidden",
"bug",
"categories",
"on",
"the",
"specifed",
"ProjectFilterSettings",
"from",
"an",
"encoded",
"string"
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/config/ProjectFilterSettings.java#L236-L253 |
pac4j/pac4j | pac4j-oauth/src/main/java/org/pac4j/oauth/profile/generic/GenericOAuth20ProfileDefinition.java | GenericOAuth20ProfileDefinition.profileAttribute | public void profileAttribute(final String name, final AttributeConverter<? extends Object> converter) {
profileAttribute(name, name, converter);
} | java | public void profileAttribute(final String name, final AttributeConverter<? extends Object> converter) {
profileAttribute(name, name, converter);
} | [
"public",
"void",
"profileAttribute",
"(",
"final",
"String",
"name",
",",
"final",
"AttributeConverter",
"<",
"?",
"extends",
"Object",
">",
"converter",
")",
"{",
"profileAttribute",
"(",
"name",
",",
"name",
",",
"converter",
")",
";",
"}"
] | Add an attribute as a primary one and its converter.
@param name name of the attribute
@param converter converter | [
"Add",
"an",
"attribute",
"as",
"a",
"primary",
"one",
"and",
"its",
"converter",
"."
] | train | https://github.com/pac4j/pac4j/blob/d9cd029f8783792b31dd48bf1e32f80628f2c4a3/pac4j-oauth/src/main/java/org/pac4j/oauth/profile/generic/GenericOAuth20ProfileDefinition.java#L94-L96 |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/doclets/formats/html/ProfileWriterImpl.java | ProfileWriterImpl.addPackageDeprecationInfo | public void addPackageDeprecationInfo(Content li, PackageDoc pkg) {
Tag[] deprs;
if (Util.isDeprecated(pkg)) {
deprs = pkg.tags("deprecated");
HtmlTree deprDiv = new HtmlTree(HtmlTag.DIV);
deprDiv.addStyle(HtmlStyle.deprecatedContent);
Content deprPhrase = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, deprecatedPhrase);
deprDiv.addContent(deprPhrase);
if (deprs.length > 0) {
Tag[] commentTags = deprs[0].inlineTags();
if (commentTags.length > 0) {
addInlineDeprecatedComment(pkg, deprs[0], deprDiv);
}
}
li.addContent(deprDiv);
}
} | java | public void addPackageDeprecationInfo(Content li, PackageDoc pkg) {
Tag[] deprs;
if (Util.isDeprecated(pkg)) {
deprs = pkg.tags("deprecated");
HtmlTree deprDiv = new HtmlTree(HtmlTag.DIV);
deprDiv.addStyle(HtmlStyle.deprecatedContent);
Content deprPhrase = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, deprecatedPhrase);
deprDiv.addContent(deprPhrase);
if (deprs.length > 0) {
Tag[] commentTags = deprs[0].inlineTags();
if (commentTags.length > 0) {
addInlineDeprecatedComment(pkg, deprs[0], deprDiv);
}
}
li.addContent(deprDiv);
}
} | [
"public",
"void",
"addPackageDeprecationInfo",
"(",
"Content",
"li",
",",
"PackageDoc",
"pkg",
")",
"{",
"Tag",
"[",
"]",
"deprs",
";",
"if",
"(",
"Util",
".",
"isDeprecated",
"(",
"pkg",
")",
")",
"{",
"deprs",
"=",
"pkg",
".",
"tags",
"(",
"\"depreca... | Add the profile package deprecation information to the documentation tree.
@param li the content tree to which the deprecation information will be added
@param pkg the PackageDoc that is added | [
"Add",
"the",
"profile",
"package",
"deprecation",
"information",
"to",
"the",
"documentation",
"tree",
"."
] | train | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/doclets/formats/html/ProfileWriterImpl.java#L184-L200 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.