repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 188 | func_name stringlengths 7 127 | whole_func_string stringlengths 77 3.91k | language stringclasses 1
value | func_code_string stringlengths 77 3.91k | func_code_tokens listlengths 20 745 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 477 | split_name stringclasses 1
value | func_code_url stringlengths 111 288 |
|---|---|---|---|---|---|---|---|---|---|---|
googleapis/google-cloud-java | google-cloud-clients/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1alpha/WebSecurityScannerClient.java | WebSecurityScannerClient.listFindings | public final ListFindingsPagedResponse listFindings(ScanRunName parent, String filter) {
ListFindingsRequest request =
ListFindingsRequest.newBuilder()
.setParent(parent == null ? null : parent.toString())
.setFilter(filter)
.build();
return listFindings(request);
} | java | public final ListFindingsPagedResponse listFindings(ScanRunName parent, String filter) {
ListFindingsRequest request =
ListFindingsRequest.newBuilder()
.setParent(parent == null ? null : parent.toString())
.setFilter(filter)
.build();
return listFindings(request);
} | [
"public",
"final",
"ListFindingsPagedResponse",
"listFindings",
"(",
"ScanRunName",
"parent",
",",
"String",
"filter",
")",
"{",
"ListFindingsRequest",
"request",
"=",
"ListFindingsRequest",
".",
"newBuilder",
"(",
")",
".",
"setParent",
"(",
"parent",
"==",
"null",... | List Findings under a given ScanRun.
<p>Sample code:
<pre><code>
try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) {
ScanRunName parent = ScanRunName.of("[PROJECT]", "[SCAN_CONFIG]", "[SCAN_RUN]");
String filter = "";
for (Finding element : webSecurityScannerClient.listFindings(parent, filter).iterateAll()) {
// doThingsWith(element);
}
}
</code></pre>
@param parent Required. The parent resource name, which should be a scan run resource name in
the format 'projects/{projectId}/scanConfigs/{scanConfigId}/scanRuns/{scanRunId}'.
@param filter The filter expression. The expression must be in the format: <field>
<operator> <value>. Supported field: 'finding_type'. Supported operator: '='.
@throws com.google.api.gax.rpc.ApiException if the remote call fails | [
"List",
"Findings",
"under",
"a",
"given",
"ScanRun",
"."
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1alpha/WebSecurityScannerClient.java#L1321-L1328 |
gallandarakhneorg/afc | advanced/dbasefile/src/main/java/org/arakhne/afc/io/dbase/attr/DBaseFileAttributePool.java | DBaseFileAttributePool.getProvider | @Pure
public static DBaseFileAttributeProvider getProvider(String resource, int recordNumber) {
final DBaseFileAttributePool pool = getPool(resource);
if (pool != null) {
final DBaseFileAttributeAccessor accessor = pool.getAccessor(recordNumber);
if (accessor != null) {
return new DBaseFileAttributeProvider(accessor);
}
}
return null;
} | java | @Pure
public static DBaseFileAttributeProvider getProvider(String resource, int recordNumber) {
final DBaseFileAttributePool pool = getPool(resource);
if (pool != null) {
final DBaseFileAttributeAccessor accessor = pool.getAccessor(recordNumber);
if (accessor != null) {
return new DBaseFileAttributeProvider(accessor);
}
}
return null;
} | [
"@",
"Pure",
"public",
"static",
"DBaseFileAttributeProvider",
"getProvider",
"(",
"String",
"resource",
",",
"int",
"recordNumber",
")",
"{",
"final",
"DBaseFileAttributePool",
"pool",
"=",
"getPool",
"(",
"resource",
")",
";",
"if",
"(",
"pool",
"!=",
"null",
... | Get an attribute container that corresponds to the specified file
<p>The resource should be located according to the
{@link Class#getResource(String)} or
{@link Class#getResourceAsStream(String)} functions.
@param resource is the resource to read
@param recordNumber is the index of the record inside the file ({@code 0..size-1}).
@return a container or <code>null</code> on error | [
"Get",
"an",
"attribute",
"container",
"that",
"corresponds",
"to",
"the",
"specified",
"file"
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/dbasefile/src/main/java/org/arakhne/afc/io/dbase/attr/DBaseFileAttributePool.java#L222-L232 |
OpenLiberty/open-liberty | dev/com.ibm.ws.injection/src/com/ibm/ws/injectionengine/osgi/internal/OSGiInjectionEngineImpl.java | OSGiInjectionEngineImpl.createDefinitionResourceBindingListenerReference | private Reference createDefinitionResourceBindingListenerReference(String refName,
String bindingName,
String type,
@Sensitive Map<String, Object> properties) {
Boolean transactional = (Boolean) properties.get("transactional");
Map<String, Object> bindingProperties = Collections.<String, Object> singletonMap("transactional", transactional == null || transactional);
ResourceBindingImpl binding = resourceBindingListenerManager.binding(refName, bindingName, type, bindingProperties);
if (binding != null) {
return new IndirectReference(refName, binding.getBindingName(), type, null, binding.getBindingListenerName(), false);
}
return null;
} | java | private Reference createDefinitionResourceBindingListenerReference(String refName,
String bindingName,
String type,
@Sensitive Map<String, Object> properties) {
Boolean transactional = (Boolean) properties.get("transactional");
Map<String, Object> bindingProperties = Collections.<String, Object> singletonMap("transactional", transactional == null || transactional);
ResourceBindingImpl binding = resourceBindingListenerManager.binding(refName, bindingName, type, bindingProperties);
if (binding != null) {
return new IndirectReference(refName, binding.getBindingName(), type, null, binding.getBindingListenerName(), false);
}
return null;
} | [
"private",
"Reference",
"createDefinitionResourceBindingListenerReference",
"(",
"String",
"refName",
",",
"String",
"bindingName",
",",
"String",
"type",
",",
"@",
"Sensitive",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
")",
"{",
"Boolean",
"transactio... | Attempt to create an indirect reference for a resource definition from a
resource binding provider.
@return an indirect reference object based on a binding provider, or null | [
"Attempt",
"to",
"create",
"an",
"indirect",
"reference",
"for",
"a",
"resource",
"definition",
"from",
"a",
"resource",
"binding",
"provider",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.injection/src/com/ibm/ws/injectionengine/osgi/internal/OSGiInjectionEngineImpl.java#L550-L563 |
landawn/AbacusUtil | src/com/landawn/abacus/util/JdbcUtil.java | JdbcUtil.importData | @SuppressWarnings("rawtypes")
public static int importData(final DataSet dataset, final int offset, final int count, final PreparedStatement stmt,
final Map<String, ? extends Type> columnTypeMap) throws UncheckedSQLException {
return importData(dataset, offset, count, stmt, 200, 0, columnTypeMap);
} | java | @SuppressWarnings("rawtypes")
public static int importData(final DataSet dataset, final int offset, final int count, final PreparedStatement stmt,
final Map<String, ? extends Type> columnTypeMap) throws UncheckedSQLException {
return importData(dataset, offset, count, stmt, 200, 0, columnTypeMap);
} | [
"@",
"SuppressWarnings",
"(",
"\"rawtypes\"",
")",
"public",
"static",
"int",
"importData",
"(",
"final",
"DataSet",
"dataset",
",",
"final",
"int",
"offset",
",",
"final",
"int",
"count",
",",
"final",
"PreparedStatement",
"stmt",
",",
"final",
"Map",
"<",
... | Imports the data from <code>DataSet</code> to database.
@param dataset
@param offset
@param count
@param stmt the column order in the sql must be consistent with the column order in the DataSet.
@param columnTypeMap
@return
@throws UncheckedSQLException | [
"Imports",
"the",
"data",
"from",
"<code",
">",
"DataSet<",
"/",
"code",
">",
"to",
"database",
"."
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/JdbcUtil.java#L2277-L2281 |
thelinmichael/spotify-web-api-java | src/main/java/com/wrapper/spotify/SpotifyApi.java | SpotifyApi.searchItem | public SearchItemRequest.Builder searchItem(String q, String type) {
return new SearchItemRequest.Builder(accessToken)
.setDefaults(httpManager, scheme, host, port)
.q(q)
.type(type);
} | java | public SearchItemRequest.Builder searchItem(String q, String type) {
return new SearchItemRequest.Builder(accessToken)
.setDefaults(httpManager, scheme, host, port)
.q(q)
.type(type);
} | [
"public",
"SearchItemRequest",
".",
"Builder",
"searchItem",
"(",
"String",
"q",
",",
"String",
"type",
")",
"{",
"return",
"new",
"SearchItemRequest",
".",
"Builder",
"(",
"accessToken",
")",
".",
"setDefaults",
"(",
"httpManager",
",",
"scheme",
",",
"host",... | Get Spotify catalog information about artists, albums, tracks or playlists that match a keyword string.
@param q The search query's keywords (and optional field filters and operators).
@param type A comma-separated list of item types to search across. Valid types are: album, artist, playlist, and
track.
@return A {@link SearchItemRequest.Builder}. | [
"Get",
"Spotify",
"catalog",
"information",
"about",
"artists",
"albums",
"tracks",
"or",
"playlists",
"that",
"match",
"a",
"keyword",
"string",
"."
] | train | https://github.com/thelinmichael/spotify-web-api-java/blob/c06b8512344c0310d0c1df362fa267879021da2e/src/main/java/com/wrapper/spotify/SpotifyApi.java#L1476-L1481 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/cluster/SubunitExtractor.java | SubunitExtractor.extractSubunits | public static List<Subunit> extractSubunits(Structure structure,
int absMinLen, double fraction, int minLen) {
// The extracted subunit container
List<Subunit> subunits = new ArrayList<Subunit>();
for (Chain c : structure.getPolyChains()) {
// Only take protein chains
if (c.isProtein()) {
Atom[] ca = StructureTools.getRepresentativeAtomArray(c);
logger.debug("Chain " + c.getId() + "; CA Atoms: " + ca.length + "; SEQRES: " + c.getSeqResSequence());
if (ca.length==0)
continue;
subunits.add(new Subunit(ca, c.getId(), null, structure));
}
}
// Calculate the minimum length of a Subunit
int adjustedMinLen = calcAdjustedMinimumSequenceLength(subunits,
absMinLen, fraction, minLen);
logger.debug("Adjusted minimum sequence length: " + adjustedMinLen);
// Filter out short Subunits
for (int s = subunits.size() - 1; s >= 0; s--) {
if (subunits.get(s).size() < adjustedMinLen)
subunits.remove(s);
}
return subunits;
} | java | public static List<Subunit> extractSubunits(Structure structure,
int absMinLen, double fraction, int minLen) {
// The extracted subunit container
List<Subunit> subunits = new ArrayList<Subunit>();
for (Chain c : structure.getPolyChains()) {
// Only take protein chains
if (c.isProtein()) {
Atom[] ca = StructureTools.getRepresentativeAtomArray(c);
logger.debug("Chain " + c.getId() + "; CA Atoms: " + ca.length + "; SEQRES: " + c.getSeqResSequence());
if (ca.length==0)
continue;
subunits.add(new Subunit(ca, c.getId(), null, structure));
}
}
// Calculate the minimum length of a Subunit
int adjustedMinLen = calcAdjustedMinimumSequenceLength(subunits,
absMinLen, fraction, minLen);
logger.debug("Adjusted minimum sequence length: " + adjustedMinLen);
// Filter out short Subunits
for (int s = subunits.size() - 1; s >= 0; s--) {
if (subunits.get(s).size() < adjustedMinLen)
subunits.remove(s);
}
return subunits;
} | [
"public",
"static",
"List",
"<",
"Subunit",
">",
"extractSubunits",
"(",
"Structure",
"structure",
",",
"int",
"absMinLen",
",",
"double",
"fraction",
",",
"int",
"minLen",
")",
"{",
"// The extracted subunit container",
"List",
"<",
"Subunit",
">",
"subunits",
... | Extract the information of each protein Chain in a Structure and converts
them into a List of Subunit. The name of the Subunits is set to
{@link Chain#getId()}.
@param structure
Structure object with protein Chains
@param absMinLen
{@link SubunitClustererParameters#getAbsoluteMinimumSequenceLength()}
@param fraction
{@link SubunitClustererParameters#getMinimumSequenceLengthFraction()}
@param minLen
{@link SubunitClustererParameters#getMinimumSequenceLength()}
@return List of Subunits | [
"Extract",
"the",
"information",
"of",
"each",
"protein",
"Chain",
"in",
"a",
"Structure",
"and",
"converts",
"them",
"into",
"a",
"List",
"of",
"Subunit",
".",
"The",
"name",
"of",
"the",
"Subunits",
"is",
"set",
"to",
"{",
"@link",
"Chain#getId",
"()",
... | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/cluster/SubunitExtractor.java#L65-L94 |
khuxtable/seaglass | src/main/java/com/seaglasslookandfeel/ui/SeaGlassTextFieldUI.java | SeaGlassTextFieldUI.getComponentState | private int getComponentState(JComponent c, Region region) {
if (region == SeaGlassRegion.SEARCH_FIELD_CANCEL_BUTTON && c.isEnabled()) {
if (((JTextComponent) c).getText().length() == 0) {
return DISABLED;
} else if (isCancelArmed) {
return PRESSED;
}
return ENABLED;
}
return SeaGlassLookAndFeel.getComponentState(c);
} | java | private int getComponentState(JComponent c, Region region) {
if (region == SeaGlassRegion.SEARCH_FIELD_CANCEL_BUTTON && c.isEnabled()) {
if (((JTextComponent) c).getText().length() == 0) {
return DISABLED;
} else if (isCancelArmed) {
return PRESSED;
}
return ENABLED;
}
return SeaGlassLookAndFeel.getComponentState(c);
} | [
"private",
"int",
"getComponentState",
"(",
"JComponent",
"c",
",",
"Region",
"region",
")",
"{",
"if",
"(",
"region",
"==",
"SeaGlassRegion",
".",
"SEARCH_FIELD_CANCEL_BUTTON",
"&&",
"c",
".",
"isEnabled",
"(",
")",
")",
"{",
"if",
"(",
"(",
"(",
"JTextCo... | DOCUMENT ME!
@param c DOCUMENT ME!
@param region DOCUMENT ME!
@return DOCUMENT ME! | [
"DOCUMENT",
"ME!"
] | train | https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/ui/SeaGlassTextFieldUI.java#L409-L421 |
Azure/azure-sdk-for-java | appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/DomainsInner.java | DomainsInner.deleteOwnershipIdentifierAsync | public Observable<Void> deleteOwnershipIdentifierAsync(String resourceGroupName, String domainName, String name) {
return deleteOwnershipIdentifierWithServiceResponseAsync(resourceGroupName, domainName, name).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | java | public Observable<Void> deleteOwnershipIdentifierAsync(String resourceGroupName, String domainName, String name) {
return deleteOwnershipIdentifierWithServiceResponseAsync(resourceGroupName, domainName, name).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"deleteOwnershipIdentifierAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"domainName",
",",
"String",
"name",
")",
"{",
"return",
"deleteOwnershipIdentifierWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"dom... | Delete ownership identifier for domain.
Delete ownership identifier for domain.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param domainName Name of domain.
@param name Name of identifier.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponse} object if successful. | [
"Delete",
"ownership",
"identifier",
"for",
"domain",
".",
"Delete",
"ownership",
"identifier",
"for",
"domain",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/DomainsInner.java#L1653-L1660 |
liferay/com-liferay-commerce | commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CPDefinitionInventoryPersistenceImpl.java | CPDefinitionInventoryPersistenceImpl.findByUUID_G | @Override
public CPDefinitionInventory findByUUID_G(String uuid, long groupId)
throws NoSuchCPDefinitionInventoryException {
CPDefinitionInventory cpDefinitionInventory = fetchByUUID_G(uuid,
groupId);
if (cpDefinitionInventory == null) {
StringBundler msg = new StringBundler(6);
msg.append(_NO_SUCH_ENTITY_WITH_KEY);
msg.append("uuid=");
msg.append(uuid);
msg.append(", groupId=");
msg.append(groupId);
msg.append("}");
if (_log.isDebugEnabled()) {
_log.debug(msg.toString());
}
throw new NoSuchCPDefinitionInventoryException(msg.toString());
}
return cpDefinitionInventory;
} | java | @Override
public CPDefinitionInventory findByUUID_G(String uuid, long groupId)
throws NoSuchCPDefinitionInventoryException {
CPDefinitionInventory cpDefinitionInventory = fetchByUUID_G(uuid,
groupId);
if (cpDefinitionInventory == null) {
StringBundler msg = new StringBundler(6);
msg.append(_NO_SUCH_ENTITY_WITH_KEY);
msg.append("uuid=");
msg.append(uuid);
msg.append(", groupId=");
msg.append(groupId);
msg.append("}");
if (_log.isDebugEnabled()) {
_log.debug(msg.toString());
}
throw new NoSuchCPDefinitionInventoryException(msg.toString());
}
return cpDefinitionInventory;
} | [
"@",
"Override",
"public",
"CPDefinitionInventory",
"findByUUID_G",
"(",
"String",
"uuid",
",",
"long",
"groupId",
")",
"throws",
"NoSuchCPDefinitionInventoryException",
"{",
"CPDefinitionInventory",
"cpDefinitionInventory",
"=",
"fetchByUUID_G",
"(",
"uuid",
",",
"groupI... | Returns the cp definition inventory where uuid = ? and groupId = ? or throws a {@link NoSuchCPDefinitionInventoryException} if it could not be found.
@param uuid the uuid
@param groupId the group ID
@return the matching cp definition inventory
@throws NoSuchCPDefinitionInventoryException if a matching cp definition inventory could not be found | [
"Returns",
"the",
"cp",
"definition",
"inventory",
"where",
"uuid",
"=",
"?",
";",
"and",
"groupId",
"=",
"?",
";",
"or",
"throws",
"a",
"{",
"@link",
"NoSuchCPDefinitionInventoryException",
"}",
"if",
"it",
"could",
"not",
"be",
"found",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CPDefinitionInventoryPersistenceImpl.java#L669-L696 |
OpenNTF/JavascriptAggregator | jaggr-service/src/main/java/com/ibm/jaggr/service/impl/AggregatorImpl.java | AggregatorImpl.initWorkingDirectory | protected void initWorkingDirectory(Map<String, String> configMap, IConfig config) throws FileNotFoundException {
final String sourceMethod = "initWorkingDirectory"; //$NON-NLS-1$
boolean isTraceLogging = log.isLoggable(Level.FINER);
if (isTraceLogging) {
log.entering(sourceClass, sourceMethod, new Object[]{configMap});
}
String versionString = Long.toString(contributingBundle.getBundleId());
if (TypeUtil.asBoolean(config.getProperty(DISABLEBUNDLEIDDIRSCOPING_PROPNAME, null)) ||
TypeUtil.asBoolean(getOptions().getOption(DISABLEBUNDLEIDDIRSCOPING_PROPNAME))) {
versionString = null;
}
// Add the list of bundle ids with the same symbolic name as the contributing bundle so
// that the subdirectories for any bundles still installed on the system won't be deleted.
Collection<String> versionsToRetain = new HashSet<String>();
Bundle[] bundles = Platform.getBundles(contributingBundle.getSymbolicName(), null);
for (Bundle bundle : bundles) {
versionsToRetain.add(Long.toString(bundle.getBundleId()));
}
File baseDir = new File(Platform.getStateLocation(contributingBundle).toFile(), "JAGGR"); //$NON-NLS-1$
baseDir.mkdir();
workdir = super.initWorkingDirectory(baseDir, configMap, versionString, versionsToRetain);
if (isTraceLogging) {
log.exiting(sourceClass, sourceMethod);
}
} | java | protected void initWorkingDirectory(Map<String, String> configMap, IConfig config) throws FileNotFoundException {
final String sourceMethod = "initWorkingDirectory"; //$NON-NLS-1$
boolean isTraceLogging = log.isLoggable(Level.FINER);
if (isTraceLogging) {
log.entering(sourceClass, sourceMethod, new Object[]{configMap});
}
String versionString = Long.toString(contributingBundle.getBundleId());
if (TypeUtil.asBoolean(config.getProperty(DISABLEBUNDLEIDDIRSCOPING_PROPNAME, null)) ||
TypeUtil.asBoolean(getOptions().getOption(DISABLEBUNDLEIDDIRSCOPING_PROPNAME))) {
versionString = null;
}
// Add the list of bundle ids with the same symbolic name as the contributing bundle so
// that the subdirectories for any bundles still installed on the system won't be deleted.
Collection<String> versionsToRetain = new HashSet<String>();
Bundle[] bundles = Platform.getBundles(contributingBundle.getSymbolicName(), null);
for (Bundle bundle : bundles) {
versionsToRetain.add(Long.toString(bundle.getBundleId()));
}
File baseDir = new File(Platform.getStateLocation(contributingBundle).toFile(), "JAGGR"); //$NON-NLS-1$
baseDir.mkdir();
workdir = super.initWorkingDirectory(baseDir, configMap, versionString, versionsToRetain);
if (isTraceLogging) {
log.exiting(sourceClass, sourceMethod);
}
} | [
"protected",
"void",
"initWorkingDirectory",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"configMap",
",",
"IConfig",
"config",
")",
"throws",
"FileNotFoundException",
"{",
"final",
"String",
"sourceMethod",
"=",
"\"initWorkingDirectory\"",
";",
"//$NON-NLS-1$\r",
... | Initialize the working directory for the servlet. The working directory is in the plugin's
workspace directory (returned by {@link Platform#getStateLocation(Bundle)} and is
qualified with the id of the contributing bundle (so that multiple versions can co-exist
in the framework without stepping on each other and so that new versions will start with
a clean cache).
@param configMap
Map of config name/value pairs
@param config
aggregator config object
@throws FileNotFoundException | [
"Initialize",
"the",
"working",
"directory",
"for",
"the",
"servlet",
".",
"The",
"working",
"directory",
"is",
"in",
"the",
"plugin",
"s",
"workspace",
"directory",
"(",
"returned",
"by",
"{",
"@link",
"Platform#getStateLocation",
"(",
"Bundle",
")",
"}",
"an... | train | https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-service/src/main/java/com/ibm/jaggr/service/impl/AggregatorImpl.java#L348-L374 |
TrueNight/Utils | android-utils/src/main/java/xyz/truenight/utils/PermissionRequest.java | PermissionRequest.onRequestPermissionsResult | public static void onRequestPermissionsResult(int requestCode, String permissions[], @NonNull int[] grantResults) {
ResponseWrapper responseWrapper = map.get(requestCode);
if (responseWrapper == null) return;
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
// permission was granted, yay! Do the
responseWrapper.response.permissionGranted();
} else {
// permission denied, boo! Disable the
// functionality that depends on this permission.
responseWrapper.response.permissionDenied();
}
} | java | public static void onRequestPermissionsResult(int requestCode, String permissions[], @NonNull int[] grantResults) {
ResponseWrapper responseWrapper = map.get(requestCode);
if (responseWrapper == null) return;
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
// permission was granted, yay! Do the
responseWrapper.response.permissionGranted();
} else {
// permission denied, boo! Disable the
// functionality that depends on this permission.
responseWrapper.response.permissionDenied();
}
} | [
"public",
"static",
"void",
"onRequestPermissionsResult",
"(",
"int",
"requestCode",
",",
"String",
"permissions",
"[",
"]",
",",
"@",
"NonNull",
"int",
"[",
"]",
"grantResults",
")",
"{",
"ResponseWrapper",
"responseWrapper",
"=",
"map",
".",
"get",
"(",
"req... | Must bee called by Activity.onRequestPermissionsResult
@param requestCode The automatically generated request code
@param permissions The requested permissions
@param grantResults The result codes of the request
@see Activity | [
"Must",
"bee",
"called",
"by",
"Activity",
".",
"onRequestPermissionsResult"
] | train | https://github.com/TrueNight/Utils/blob/78a11faa16258b09f08826797370310ab650530c/android-utils/src/main/java/xyz/truenight/utils/PermissionRequest.java#L199-L216 |
grails/gorm-hibernate5 | grails-datastore-gorm-hibernate5/src/main/groovy/org/grails/orm/hibernate/cfg/GrailsDomainBinder.java | GrailsDomainBinder.bindSimpleValue | protected void bindSimpleValue(PersistentProperty property, PersistentProperty parentProperty,
SimpleValue simpleValue, String path, InFlightMetadataCollector mappings, String sessionFactoryBeanName) {
// set type
bindSimpleValue(property,parentProperty, simpleValue, path, getPropertyConfig(property), sessionFactoryBeanName);
} | java | protected void bindSimpleValue(PersistentProperty property, PersistentProperty parentProperty,
SimpleValue simpleValue, String path, InFlightMetadataCollector mappings, String sessionFactoryBeanName) {
// set type
bindSimpleValue(property,parentProperty, simpleValue, path, getPropertyConfig(property), sessionFactoryBeanName);
} | [
"protected",
"void",
"bindSimpleValue",
"(",
"PersistentProperty",
"property",
",",
"PersistentProperty",
"parentProperty",
",",
"SimpleValue",
"simpleValue",
",",
"String",
"path",
",",
"InFlightMetadataCollector",
"mappings",
",",
"String",
"sessionFactoryBeanName",
")",
... | Binds a simple value to the Hibernate metamodel. A simple value is
any type within the Hibernate type system
@param property
@param parentProperty
@param simpleValue The simple value to bind
@param path
@param mappings The Hibernate mappings instance
@param sessionFactoryBeanName the session factory bean name | [
"Binds",
"a",
"simple",
"value",
"to",
"the",
"Hibernate",
"metamodel",
".",
"A",
"simple",
"value",
"is",
"any",
"type",
"within",
"the",
"Hibernate",
"type",
"system"
] | train | https://github.com/grails/gorm-hibernate5/blob/0ebb80cd769ef2bea955723d4543828a3e9542ef/grails-datastore-gorm-hibernate5/src/main/groovy/org/grails/orm/hibernate/cfg/GrailsDomainBinder.java#L2806-L2810 |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java | StreamExecutionEnvironment.socketTextStream | @Deprecated
@SuppressWarnings("deprecation")
public DataStreamSource<String> socketTextStream(String hostname, int port, char delimiter) {
return socketTextStream(hostname, port, delimiter, 0);
} | java | @Deprecated
@SuppressWarnings("deprecation")
public DataStreamSource<String> socketTextStream(String hostname, int port, char delimiter) {
return socketTextStream(hostname, port, delimiter, 0);
} | [
"@",
"Deprecated",
"@",
"SuppressWarnings",
"(",
"\"deprecation\"",
")",
"public",
"DataStreamSource",
"<",
"String",
">",
"socketTextStream",
"(",
"String",
"hostname",
",",
"int",
"port",
",",
"char",
"delimiter",
")",
"{",
"return",
"socketTextStream",
"(",
"... | Creates a new data stream that contains the strings received infinitely from a socket. Received strings are
decoded by the system's default character set. The reader is terminated immediately when the socket is down.
@param hostname
The host name which a server socket binds
@param port
The port number which a server socket binds. A port number of 0 means that the port number is automatically
allocated.
@param delimiter
A character which splits received strings into records
@return A data stream containing the strings received from the socket
@deprecated Use {@link #socketTextStream(String, int, String)} instead. | [
"Creates",
"a",
"new",
"data",
"stream",
"that",
"contains",
"the",
"strings",
"received",
"infinitely",
"from",
"a",
"socket",
".",
"Received",
"strings",
"are",
"decoded",
"by",
"the",
"system",
"s",
"default",
"character",
"set",
".",
"The",
"reader",
"is... | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java#L1235-L1239 |
windup/windup | utils/src/main/java/org/jboss/windup/util/PathUtil.java | PathUtil.isInSubDirectory | public static boolean isInSubDirectory(File dir, File file)
{
if (file == null)
return false;
if (file.equals(dir))
return true;
return isInSubDirectory(dir, file.getParentFile());
} | java | public static boolean isInSubDirectory(File dir, File file)
{
if (file == null)
return false;
if (file.equals(dir))
return true;
return isInSubDirectory(dir, file.getParentFile());
} | [
"public",
"static",
"boolean",
"isInSubDirectory",
"(",
"File",
"dir",
",",
"File",
"file",
")",
"{",
"if",
"(",
"file",
"==",
"null",
")",
"return",
"false",
";",
"if",
"(",
"file",
".",
"equals",
"(",
"dir",
")",
")",
"return",
"true",
";",
"return... | Returns true if "file" is a subfile or subdirectory of "dir".
For example with the directory /path/to/a, the following return values would occur:
/path/to/a/foo.txt - true /path/to/a/bar/zoo/boo/team.txt - true /path/to/b/foo.txt - false | [
"Returns",
"true",
"if",
"file",
"is",
"a",
"subfile",
"or",
"subdirectory",
"of",
"dir",
"."
] | train | https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/utils/src/main/java/org/jboss/windup/util/PathUtil.java#L241-L250 |
alkacon/opencms-core | src-modules/org/opencms/workplace/tools/database/CmsHtmlImportDialog.java | CmsHtmlImportDialog.getLocales | private List getLocales() {
ArrayList ret = new ArrayList();
try {
Iterator i = OpenCms.getLocaleManager().getAvailableLocales().iterator();
// loop through all local's and build the entries
while (i.hasNext()) {
Locale locale = (Locale)i.next();
String language = locale.getLanguage();
String displayLanguage = locale.getDisplayLanguage();
ret.add(new CmsSelectWidgetOption(language, false, displayLanguage));
}
} catch (Exception e) {
// not necessary
}
return ret;
} | java | private List getLocales() {
ArrayList ret = new ArrayList();
try {
Iterator i = OpenCms.getLocaleManager().getAvailableLocales().iterator();
// loop through all local's and build the entries
while (i.hasNext()) {
Locale locale = (Locale)i.next();
String language = locale.getLanguage();
String displayLanguage = locale.getDisplayLanguage();
ret.add(new CmsSelectWidgetOption(language, false, displayLanguage));
}
} catch (Exception e) {
// not necessary
}
return ret;
} | [
"private",
"List",
"getLocales",
"(",
")",
"{",
"ArrayList",
"ret",
"=",
"new",
"ArrayList",
"(",
")",
";",
"try",
"{",
"Iterator",
"i",
"=",
"OpenCms",
".",
"getLocaleManager",
"(",
")",
".",
"getAvailableLocales",
"(",
")",
".",
"iterator",
"(",
")",
... | Returns a list with all available local's.<p>
@return a list with all available local's | [
"Returns",
"a",
"list",
"with",
"all",
"available",
"local",
"s",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/tools/database/CmsHtmlImportDialog.java#L510-L529 |
joniles/mpxj | src/main/java/net/sf/mpxj/explorer/ProjectTreeController.java | ProjectTreeController.addCalendarDay | private void addCalendarDay(MpxjTreeNode parentNode, ProjectCalendar calendar, final Day day)
{
MpxjTreeNode dayNode = new MpxjTreeNode(day)
{
@Override public String toString()
{
return day.name();
}
};
parentNode.add(dayNode);
addHours(dayNode, calendar.getHours(day));
} | java | private void addCalendarDay(MpxjTreeNode parentNode, ProjectCalendar calendar, final Day day)
{
MpxjTreeNode dayNode = new MpxjTreeNode(day)
{
@Override public String toString()
{
return day.name();
}
};
parentNode.add(dayNode);
addHours(dayNode, calendar.getHours(day));
} | [
"private",
"void",
"addCalendarDay",
"(",
"MpxjTreeNode",
"parentNode",
",",
"ProjectCalendar",
"calendar",
",",
"final",
"Day",
"day",
")",
"{",
"MpxjTreeNode",
"dayNode",
"=",
"new",
"MpxjTreeNode",
"(",
"day",
")",
"{",
"@",
"Override",
"public",
"String",
... | Add a calendar day node.
@param parentNode parent node
@param calendar ProjectCalendar instance
@param day calendar day | [
"Add",
"a",
"calendar",
"day",
"node",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/explorer/ProjectTreeController.java#L292-L303 |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/extralanguage/properties/AbstractConversionTable.java | AbstractConversionTable.addTypeConversion | protected void addTypeConversion(String javaType, String targetType, boolean updateSelection) {
final ConversionMapping entry = new ConversionMapping(javaType, targetType);
this.conversions.add(entry);
//refresh from model
refreshListUI();
if (updateSelection) {
this.list.setSelection(new StructuredSelection(entry));
}
//ensure labels are updated
if (!this.list.isBusy()) {
this.list.refresh(true);
}
enableButtons();
preferenceValueChanged();
} | java | protected void addTypeConversion(String javaType, String targetType, boolean updateSelection) {
final ConversionMapping entry = new ConversionMapping(javaType, targetType);
this.conversions.add(entry);
//refresh from model
refreshListUI();
if (updateSelection) {
this.list.setSelection(new StructuredSelection(entry));
}
//ensure labels are updated
if (!this.list.isBusy()) {
this.list.refresh(true);
}
enableButtons();
preferenceValueChanged();
} | [
"protected",
"void",
"addTypeConversion",
"(",
"String",
"javaType",
",",
"String",
"targetType",
",",
"boolean",
"updateSelection",
")",
"{",
"final",
"ConversionMapping",
"entry",
"=",
"new",
"ConversionMapping",
"(",
"javaType",
",",
"targetType",
")",
";",
"th... | Add a type conversion.
@param javaType the name of the java type.
@param targetType the name of the target type.
@param updateSelection indicates if the selection should be updated. | [
"Add",
"a",
"type",
"conversion",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/extralanguage/properties/AbstractConversionTable.java#L442-L456 |
stefanbirkner/fishbowl | src/main/java/com/github/stefanbirkner/fishbowl/Fishbowl.java | Fishbowl.exceptionThrownBy | public static <T extends Throwable> T exceptionThrownBy(
Statement statement, Class<T> type) {
try {
statement.evaluate();
} catch (Throwable e) {
if (type.isAssignableFrom(e.getClass()))
return (T) e;
else
throw new ExceptionWithWrongTypeThrownFailure(type, e);
}
throw new ExceptionNotThrownFailure();
} | java | public static <T extends Throwable> T exceptionThrownBy(
Statement statement, Class<T> type) {
try {
statement.evaluate();
} catch (Throwable e) {
if (type.isAssignableFrom(e.getClass()))
return (T) e;
else
throw new ExceptionWithWrongTypeThrownFailure(type, e);
}
throw new ExceptionNotThrownFailure();
} | [
"public",
"static",
"<",
"T",
"extends",
"Throwable",
">",
"T",
"exceptionThrownBy",
"(",
"Statement",
"statement",
",",
"Class",
"<",
"T",
">",
"type",
")",
"{",
"try",
"{",
"statement",
".",
"evaluate",
"(",
")",
";",
"}",
"catch",
"(",
"Throwable",
... | Executes the provided statement and returns the exception that
has been thrown by the statement if it has the specified type.
This is useful for writing tests for exceptions according to the
AAA (Arrange-Act-Assert) pattern in case that you need to check
properties of the exception.
<p>Example:
<pre>
FooException exception = exceptionThrownBy(
() -> { throw new FooException(3); }, FooException.class);
assertEquals(3, exception.getValue())
</pre>
@param statement an arbitrary piece of code.
@param type the type of the exception that should be exposed.
@param <T> the type of the exception that should be exposed.
@return The exception thrown by the statement.
@throws ExceptionNotThrownFailure if the statement didn't throw
an exception.
@throws ExceptionWithWrongTypeThrownFailure if the statement
threw an exception of a different type.
@see #exceptionThrownBy(Statement) | [
"Executes",
"the",
"provided",
"statement",
"and",
"returns",
"the",
"exception",
"that",
"has",
"been",
"thrown",
"by",
"the",
"statement",
"if",
"it",
"has",
"the",
"specified",
"type",
".",
"This",
"is",
"useful",
"for",
"writing",
"tests",
"for",
"except... | train | https://github.com/stefanbirkner/fishbowl/blob/0ef001f1fc38822ffbe74679ee3001504eb5f23c/src/main/java/com/github/stefanbirkner/fishbowl/Fishbowl.java#L134-L145 |
wellner/jcarafe | jcarafe-core/src/main/java/cern/colt/GenericSorting.java | GenericSorting.quickSort | public static void quickSort(int fromIndex, int toIndex, IntComparator c, Swapper swapper) {
quickSort1(fromIndex, toIndex-fromIndex, c, swapper);
} | java | public static void quickSort(int fromIndex, int toIndex, IntComparator c, Swapper swapper) {
quickSort1(fromIndex, toIndex-fromIndex, c, swapper);
} | [
"public",
"static",
"void",
"quickSort",
"(",
"int",
"fromIndex",
",",
"int",
"toIndex",
",",
"IntComparator",
"c",
",",
"Swapper",
"swapper",
")",
"{",
"quickSort1",
"(",
"fromIndex",
",",
"toIndex",
"-",
"fromIndex",
",",
"c",
",",
"swapper",
")",
";",
... | Sorts the specified range of elements according
to the order induced by the specified comparator. All elements in the
range must be <i>mutually comparable</i> by the specified comparator
(that is, <tt>c.compare(a, b)</tt> must not throw an
exception for any indexes <tt>a</tt> and
<tt>b</tt> in the range).<p>
The sorting algorithm is a tuned quicksort,
adapted from Jon L. Bentley and M. Douglas McIlroy's "Engineering a
Sort Function", Software-Practice and Experience, Vol. 23(11)
P. 1249-1265 (November 1993). This algorithm offers n*log(n)
performance on many data sets that cause other quicksorts to degrade to
quadratic performance.
@param fromIndex the index of the first element (inclusive) to be sorted.
@param toIndex the index of the last element (exclusive) to be sorted.
@param c the comparator to determine the order of the generic data.
@param swapper an object that knows how to swap the elements at any two indexes (a,b).
@see IntComparator
@see Swapper | [
"Sorts",
"the",
"specified",
"range",
"of",
"elements",
"according",
"to",
"the",
"order",
"induced",
"by",
"the",
"specified",
"comparator",
".",
"All",
"elements",
"in",
"the",
"range",
"must",
"be",
"<i",
">",
"mutually",
"comparable<",
"/",
"i",
">",
"... | train | https://github.com/wellner/jcarafe/blob/ab8b0a83dbf600fe80c27711815c90bd3055b217/jcarafe-core/src/main/java/cern/colt/GenericSorting.java#L324-L326 |
milaboratory/milib | src/main/java/com/milaboratory/core/io/util/IOUtil.java | IOUtil.readRawVarint64 | public static long readRawVarint64(final InputStream is, long eofValue) throws IOException {
int shift = 0;
long result = 0;
while (shift < 64) {
final int b = is.read();
if (b == -1)
if (shift == 0)
return eofValue;
else
throw new IOException("Malformed Varint");
result |= (long) (b & 0x7F) << shift;
if ((b & 0x80) == 0) {
return result;
}
shift += 7;
}
throw new IOException("Malformed Varint");
} | java | public static long readRawVarint64(final InputStream is, long eofValue) throws IOException {
int shift = 0;
long result = 0;
while (shift < 64) {
final int b = is.read();
if (b == -1)
if (shift == 0)
return eofValue;
else
throw new IOException("Malformed Varint");
result |= (long) (b & 0x7F) << shift;
if ((b & 0x80) == 0) {
return result;
}
shift += 7;
}
throw new IOException("Malformed Varint");
} | [
"public",
"static",
"long",
"readRawVarint64",
"(",
"final",
"InputStream",
"is",
",",
"long",
"eofValue",
")",
"throws",
"IOException",
"{",
"int",
"shift",
"=",
"0",
";",
"long",
"result",
"=",
"0",
";",
"while",
"(",
"shift",
"<",
"64",
")",
"{",
"f... | Read a raw Varint from the stream.
<p>Based on com.google.protobuf.CodedInputStream class from Google's protobuf library.</p> | [
"Read",
"a",
"raw",
"Varint",
"from",
"the",
"stream",
"."
] | train | https://github.com/milaboratory/milib/blob/2349b3dccdd3c7948643760e570238d6e30d5a34/src/main/java/com/milaboratory/core/io/util/IOUtil.java#L58-L77 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/watch/WatchUtil.java | WatchUtil.createModify | public static WatchMonitor createModify(URL url, int maxDepth, Watcher watcher) {
return createModify(URLUtil.toURI(url), maxDepth, watcher);
} | java | public static WatchMonitor createModify(URL url, int maxDepth, Watcher watcher) {
return createModify(URLUtil.toURI(url), maxDepth, watcher);
} | [
"public",
"static",
"WatchMonitor",
"createModify",
"(",
"URL",
"url",
",",
"int",
"maxDepth",
",",
"Watcher",
"watcher",
")",
"{",
"return",
"createModify",
"(",
"URLUtil",
".",
"toURI",
"(",
"url",
")",
",",
"maxDepth",
",",
"watcher",
")",
";",
"}"
] | 创建并初始化监听,监听修改事件
@param url URL
@param maxDepth 当监听目录时,监听目录的最大深度,当设置值为1(或小于1)时,表示不递归监听子目录
@param watcher {@link Watcher}
@return {@link WatchMonitor}
@since 4.5.2 | [
"创建并初始化监听,监听修改事件"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/watch/WatchUtil.java#L275-L277 |
jhalterman/failsafe | src/main/java/net/jodah/failsafe/RetryPolicy.java | RetryPolicy.isAbortable | public boolean isAbortable(R result, Throwable failure) {
for (BiPredicate<R, Throwable> predicate : abortConditions) {
try {
if (predicate.test(result, failure))
return true;
} catch (Exception t) {
// Ignore confused user-supplied predicates.
// They should not be allowed to halt execution of the operation.
}
}
return false;
} | java | public boolean isAbortable(R result, Throwable failure) {
for (BiPredicate<R, Throwable> predicate : abortConditions) {
try {
if (predicate.test(result, failure))
return true;
} catch (Exception t) {
// Ignore confused user-supplied predicates.
// They should not be allowed to halt execution of the operation.
}
}
return false;
} | [
"public",
"boolean",
"isAbortable",
"(",
"R",
"result",
",",
"Throwable",
"failure",
")",
"{",
"for",
"(",
"BiPredicate",
"<",
"R",
",",
"Throwable",
">",
"predicate",
":",
"abortConditions",
")",
"{",
"try",
"{",
"if",
"(",
"predicate",
".",
"test",
"("... | Returns whether an execution result can be aborted given the configured abort conditions.
@see #abortOn(Class...)
@see #abortOn(List)
@see #abortOn(Predicate)
@see #abortIf(BiPredicate)
@see #abortIf(Predicate)
@see #abortWhen(R) | [
"Returns",
"whether",
"an",
"execution",
"result",
"can",
"be",
"aborted",
"given",
"the",
"configured",
"abort",
"conditions",
"."
] | train | https://github.com/jhalterman/failsafe/blob/65fcd3a82f7b232d2ff59bc525a59d693dd8e223/src/main/java/net/jodah/failsafe/RetryPolicy.java#L243-L254 |
rzwitserloot/lombok | src/installer/lombok/installer/WindowsDriveInfo.java | WindowsDriveInfo.isFixedDisk | public boolean isFixedDisk(String letter) {
if (letter.length() != 1) throw new IllegalArgumentException("Supply 1 letter, not: " + letter);
char drive = Character.toUpperCase(letter.charAt(0));
if (drive < 'A' || drive > 'Z') throw new IllegalArgumentException(
"A drive is indicated by a letter, so A-Z inclusive. Not " + drive);
return getDriveType(drive + ":\\") == 3L;
} | java | public boolean isFixedDisk(String letter) {
if (letter.length() != 1) throw new IllegalArgumentException("Supply 1 letter, not: " + letter);
char drive = Character.toUpperCase(letter.charAt(0));
if (drive < 'A' || drive > 'Z') throw new IllegalArgumentException(
"A drive is indicated by a letter, so A-Z inclusive. Not " + drive);
return getDriveType(drive + ":\\") == 3L;
} | [
"public",
"boolean",
"isFixedDisk",
"(",
"String",
"letter",
")",
"{",
"if",
"(",
"letter",
".",
"length",
"(",
")",
"!=",
"1",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Supply 1 letter, not: \"",
"+",
"letter",
")",
";",
"char",
"drive",
"=",... | Feed it a drive letter (such as 'A') to see if it is a fixed disk. | [
"Feed",
"it",
"a",
"drive",
"letter",
"(",
"such",
"as",
"A",
")",
"to",
"see",
"if",
"it",
"is",
"a",
"fixed",
"disk",
"."
] | train | https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/installer/lombok/installer/WindowsDriveInfo.java#L96-L102 |
Ordinastie/MalisisCore | src/main/java/net/malisis/core/renderer/animation/transformation/ColorTransform.java | ColorTransform.doTransform | @Override
protected void doTransform(ITransformable.Color transformable, float comp)
{
if (comp <= 0)
return;
int from = reversed ? toColor : fromColor;
int to = reversed ? fromColor : toColor;
int r = (int) (red(from) + (red(to) - red(from)) * comp);
int g = (int) (green(from) + (green(to) - green(from)) * comp);
int b = (int) (blue(from) + (blue(to) - blue(from)) * comp);
transformable.setColor((r & 0xFF) << 16 | (g & 0xFF) << 8 | b & 0xFF);
} | java | @Override
protected void doTransform(ITransformable.Color transformable, float comp)
{
if (comp <= 0)
return;
int from = reversed ? toColor : fromColor;
int to = reversed ? fromColor : toColor;
int r = (int) (red(from) + (red(to) - red(from)) * comp);
int g = (int) (green(from) + (green(to) - green(from)) * comp);
int b = (int) (blue(from) + (blue(to) - blue(from)) * comp);
transformable.setColor((r & 0xFF) << 16 | (g & 0xFF) << 8 | b & 0xFF);
} | [
"@",
"Override",
"protected",
"void",
"doTransform",
"(",
"ITransformable",
".",
"Color",
"transformable",
",",
"float",
"comp",
")",
"{",
"if",
"(",
"comp",
"<=",
"0",
")",
"return",
";",
"int",
"from",
"=",
"reversed",
"?",
"toColor",
":",
"fromColor",
... | Calculates the transformation.
@param transformable the transformable
@param comp the comp | [
"Calculates",
"the",
"transformation",
"."
] | train | https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/renderer/animation/transformation/ColorTransform.java#L124-L138 |
jbundle/jbundle | base/message/trx/src/main/java/org/jbundle/base/message/trx/transport/email/EmailMessageTransport.java | EmailMessageTransport.createExternalMessage | public ExternalMessage createExternalMessage(BaseMessage message, Object rawData)
{
ExternalMessage externalTrxMessage = super.createExternalMessage(message, rawData);
if (externalTrxMessage == null)
{
if ((message.getMessageHeader() != null)
&& (MessageTypeModel.MESSAGE_IN.equals((String)message.getMessageHeader().get(TrxMessageHeader.MESSAGE_PROCESS_TYPE))))
externalTrxMessage = new EMailTrxMessageIn(message, (String)rawData);
else
externalTrxMessage = new EMailTrxMessageOut(message, rawData);
}
return externalTrxMessage;
} | java | public ExternalMessage createExternalMessage(BaseMessage message, Object rawData)
{
ExternalMessage externalTrxMessage = super.createExternalMessage(message, rawData);
if (externalTrxMessage == null)
{
if ((message.getMessageHeader() != null)
&& (MessageTypeModel.MESSAGE_IN.equals((String)message.getMessageHeader().get(TrxMessageHeader.MESSAGE_PROCESS_TYPE))))
externalTrxMessage = new EMailTrxMessageIn(message, (String)rawData);
else
externalTrxMessage = new EMailTrxMessageOut(message, rawData);
}
return externalTrxMessage;
} | [
"public",
"ExternalMessage",
"createExternalMessage",
"(",
"BaseMessage",
"message",
",",
"Object",
"rawData",
")",
"{",
"ExternalMessage",
"externalTrxMessage",
"=",
"super",
".",
"createExternalMessage",
"(",
"message",
",",
"rawData",
")",
";",
"if",
"(",
"extern... | Get the external message container for this Internal message.
Typically, the overriding class supplies a default format for the transport type.
<br/>NOTE: The message header from the internal message is copies, but not the message itself.
@param The internalTrxMessage that I will convert to this external format.
@return The (empty) External message. | [
"Get",
"the",
"external",
"message",
"container",
"for",
"this",
"Internal",
"message",
".",
"Typically",
"the",
"overriding",
"class",
"supplies",
"a",
"default",
"format",
"for",
"the",
"transport",
"type",
".",
"<br",
"/",
">",
"NOTE",
":",
"The",
"messag... | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/message/trx/src/main/java/org/jbundle/base/message/trx/transport/email/EmailMessageTransport.java#L107-L119 |
digipost/signature-api-client-java | src/main/java/no/digipost/signature/client/direct/StatusReference.java | StatusReference.ofUrl | public static StatusUrlContruction ofUrl(final String statusUrl) {
return new StatusUrlContruction() {
@Override
public StatusReference withStatusQueryToken(String token) {
return new StatusReference(statusUrl, token);
}
};
} | java | public static StatusUrlContruction ofUrl(final String statusUrl) {
return new StatusUrlContruction() {
@Override
public StatusReference withStatusQueryToken(String token) {
return new StatusReference(statusUrl, token);
}
};
} | [
"public",
"static",
"StatusUrlContruction",
"ofUrl",
"(",
"final",
"String",
"statusUrl",
")",
"{",
"return",
"new",
"StatusUrlContruction",
"(",
")",
"{",
"@",
"Override",
"public",
"StatusReference",
"withStatusQueryToken",
"(",
"String",
"token",
")",
"{",
"ret... | Start constructing a new {@link StatusReference}.
@param statusUrl the status url for the job
@return partially constructed {@link StatusReference} which
must be completed with a status query token using
{@link StatusUrlContruction#withStatusQueryToken(String) .withStatusQueryToken(token)} | [
"Start",
"constructing",
"a",
"new",
"{",
"@link",
"StatusReference",
"}",
"."
] | train | https://github.com/digipost/signature-api-client-java/blob/246207571641fbac6beda5ffc585eec188825c45/src/main/java/no/digipost/signature/client/direct/StatusReference.java#L35-L42 |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/abst/geo/bundle/SceneStructureMetric.java | SceneStructureMetric.setRigid | public void setRigid( int which , boolean fixed , Se3_F64 worldToObject , int totalPoints ) {
Rigid r = rigids[which] = new Rigid();
r.known = fixed;
r.objectToWorld.set(worldToObject);
r.points = new Point[totalPoints];
for (int i = 0; i < totalPoints; i++) {
r.points[i] = new Point(pointSize);
}
} | java | public void setRigid( int which , boolean fixed , Se3_F64 worldToObject , int totalPoints ) {
Rigid r = rigids[which] = new Rigid();
r.known = fixed;
r.objectToWorld.set(worldToObject);
r.points = new Point[totalPoints];
for (int i = 0; i < totalPoints; i++) {
r.points[i] = new Point(pointSize);
}
} | [
"public",
"void",
"setRigid",
"(",
"int",
"which",
",",
"boolean",
"fixed",
",",
"Se3_F64",
"worldToObject",
",",
"int",
"totalPoints",
")",
"{",
"Rigid",
"r",
"=",
"rigids",
"[",
"which",
"]",
"=",
"new",
"Rigid",
"(",
")",
";",
"r",
".",
"known",
"... | Declares the data structure for a rigid object. Location of points are set by accessing the object directly.
Rigid objects are useful in known scenes with calibration targets.
@param which Index of rigid object
@param fixed If the pose is known or not
@param worldToObject Initial estimated location of rigid object
@param totalPoints Total number of points attached to this rigid object | [
"Declares",
"the",
"data",
"structure",
"for",
"a",
"rigid",
"object",
".",
"Location",
"of",
"points",
"are",
"set",
"by",
"accessing",
"the",
"object",
"directly",
".",
"Rigid",
"objects",
"are",
"useful",
"in",
"known",
"scenes",
"with",
"calibration",
"t... | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/abst/geo/bundle/SceneStructureMetric.java#L168-L176 |
UrielCh/ovh-java-sdk | ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java | ApiOvhTelephony.billingAccount_line_serviceName_phone_rma_id_PUT | public void billingAccount_line_serviceName_phone_rma_id_PUT(String billingAccount, String serviceName, String id, OvhRma body) throws IOException {
String qPath = "/telephony/{billingAccount}/line/{serviceName}/phone/rma/{id}";
StringBuilder sb = path(qPath, billingAccount, serviceName, id);
exec(qPath, "PUT", sb.toString(), body);
} | java | public void billingAccount_line_serviceName_phone_rma_id_PUT(String billingAccount, String serviceName, String id, OvhRma body) throws IOException {
String qPath = "/telephony/{billingAccount}/line/{serviceName}/phone/rma/{id}";
StringBuilder sb = path(qPath, billingAccount, serviceName, id);
exec(qPath, "PUT", sb.toString(), body);
} | [
"public",
"void",
"billingAccount_line_serviceName_phone_rma_id_PUT",
"(",
"String",
"billingAccount",
",",
"String",
"serviceName",
",",
"String",
"id",
",",
"OvhRma",
"body",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/telephony/{billingAccount}/line/... | Alter this object properties
REST: PUT /telephony/{billingAccount}/line/{serviceName}/phone/rma/{id}
@param body [required] New object properties
@param billingAccount [required] The name of your billingAccount
@param serviceName [required]
@param id [required] Return merchandise authorisation identifier | [
"Alter",
"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#L1012-L1016 |
DavidPizarro/PinView | library/src/main/java/com/dpizarro/pinview/library/PinView.java | PinView.onFocusChange | @Override
public void onFocusChange(View v, boolean hasFocus) {
if (getOnFocusChangeListener() != null) {
getOnFocusChangeListener().onFocusChange(v, hasFocus);
}
EditText et = (EditText) v;
if (et.getText().toString().length() >= 1 && hasFocus && isDeleteOnClick()) {
et.getText().clear();
}
if (hasFocus) {
setImeVisibility(true);
if (onCompleteListener != null && lastCompleted) {
lastCompleted = false;
if (isDeleteOnClick()) {
onCompleteListener.onComplete(false, null);
}
}
}
} | java | @Override
public void onFocusChange(View v, boolean hasFocus) {
if (getOnFocusChangeListener() != null) {
getOnFocusChangeListener().onFocusChange(v, hasFocus);
}
EditText et = (EditText) v;
if (et.getText().toString().length() >= 1 && hasFocus && isDeleteOnClick()) {
et.getText().clear();
}
if (hasFocus) {
setImeVisibility(true);
if (onCompleteListener != null && lastCompleted) {
lastCompleted = false;
if (isDeleteOnClick()) {
onCompleteListener.onComplete(false, null);
}
}
}
} | [
"@",
"Override",
"public",
"void",
"onFocusChange",
"(",
"View",
"v",
",",
"boolean",
"hasFocus",
")",
"{",
"if",
"(",
"getOnFocusChangeListener",
"(",
")",
"!=",
"null",
")",
"{",
"getOnFocusChangeListener",
"(",
")",
".",
"onFocusChange",
"(",
"v",
",",
... | Called when the focus state of a PinBox {@link EditText} has changed.
@param v The PinBox {@link EditText} whose state has changed.
@param hasFocus The new focus state of v. | [
"Called",
"when",
"the",
"focus",
"state",
"of",
"a",
"PinBox",
"{",
"@link",
"EditText",
"}",
"has",
"changed",
"."
] | train | https://github.com/DavidPizarro/PinView/blob/b171a89694921475b5442585810b8475ef1cfe35/library/src/main/java/com/dpizarro/pinview/library/PinView.java#L150-L171 |
basho/riak-java-client | src/main/java/com/basho/riak/client/api/commands/kv/KvResponseBase.java | KvResponseBase.getValue | public <T> T getValue(Converter<T> converter, ConflictResolver<T> resolver) throws UnresolvedConflictException
{
List<T> convertedValues = convertValues(converter);
T resolved = resolver.resolve(convertedValues);
if (hasValues() && resolved != null)
{
VClock vclock = values.get(0).getVClock();
AnnotationUtil.setVClock(resolved, vclock);
}
return resolved;
} | java | public <T> T getValue(Converter<T> converter, ConflictResolver<T> resolver) throws UnresolvedConflictException
{
List<T> convertedValues = convertValues(converter);
T resolved = resolver.resolve(convertedValues);
if (hasValues() && resolved != null)
{
VClock vclock = values.get(0).getVClock();
AnnotationUtil.setVClock(resolved, vclock);
}
return resolved;
} | [
"public",
"<",
"T",
">",
"T",
"getValue",
"(",
"Converter",
"<",
"T",
">",
"converter",
",",
"ConflictResolver",
"<",
"T",
">",
"resolver",
")",
"throws",
"UnresolvedConflictException",
"{",
"List",
"<",
"T",
">",
"convertedValues",
"=",
"convertValues",
"("... | Get a single, resolved object from this response.
<p>
The values will be converted to objects using the supplied
{@link com.basho.riak.client.api.convert.Converter} rather than one registered
with the {@link com.basho.riak.client.api.convert.ConverterFactory}.
</p>
<p>If there are multiple
values present (siblings), they will then be resolved using the supplied
{@link com.basho.riak.client.api.cap.ConflictResolver} rather than one
registered with the {@link com.basho.riak.client.api.cap.ConflictResolverFactory}.
</p>
@param converter The converter to use.
@param resolver The conflict resolver to use.
@return the single, resolved value.
@throws UnresolvedConflictException if the resolver fails to resolve siblings.
@see Converter
@see ConflictResolver | [
"Get",
"a",
"single",
"resolved",
"object",
"from",
"this",
"response",
".",
"<p",
">",
"The",
"values",
"will",
"be",
"converted",
"to",
"objects",
"using",
"the",
"supplied",
"{"
] | train | https://github.com/basho/riak-java-client/blob/bed6cd60f360bacf1b873ab92dd74f2526651e71/src/main/java/com/basho/riak/client/api/commands/kv/KvResponseBase.java#L176-L188 |
VoltDB/voltdb | src/frontend/org/voltdb/utils/VoltBaseServlet.java | VoltBaseServlet.handleReportPage | void handleReportPage(HttpServletRequest request, HttpServletResponse response) {
try {
String report = ReportMaker.liveReport();
response.setContentType(HTML_CONTENT_TYPE);
response.setStatus(HttpServletResponse.SC_OK);
response.getWriter().print(report);
} catch (IOException ex) {
m_log.warn("Failed to get catalog report.", ex);
}
} | java | void handleReportPage(HttpServletRequest request, HttpServletResponse response) {
try {
String report = ReportMaker.liveReport();
response.setContentType(HTML_CONTENT_TYPE);
response.setStatus(HttpServletResponse.SC_OK);
response.getWriter().print(report);
} catch (IOException ex) {
m_log.warn("Failed to get catalog report.", ex);
}
} | [
"void",
"handleReportPage",
"(",
"HttpServletRequest",
"request",
",",
"HttpServletResponse",
"response",
")",
"{",
"try",
"{",
"String",
"report",
"=",
"ReportMaker",
".",
"liveReport",
"(",
")",
";",
"response",
".",
"setContentType",
"(",
"HTML_CONTENT_TYPE",
"... | Draw the catalog report page, mostly by pulling it from the JAR. | [
"Draw",
"the",
"catalog",
"report",
"page",
"mostly",
"by",
"pulling",
"it",
"from",
"the",
"JAR",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/utils/VoltBaseServlet.java#L118-L129 |
3redronin/mu-server | src/main/java/io/muserver/Mutils.java | Mutils.copy | public static void copy(InputStream from, OutputStream to, int bufferSize) throws IOException {
byte[] buffer = new byte[bufferSize];
int read;
while ((read = from.read(buffer)) > -1) {
to.write(buffer, 0, read);
}
} | java | public static void copy(InputStream from, OutputStream to, int bufferSize) throws IOException {
byte[] buffer = new byte[bufferSize];
int read;
while ((read = from.read(buffer)) > -1) {
to.write(buffer, 0, read);
}
} | [
"public",
"static",
"void",
"copy",
"(",
"InputStream",
"from",
",",
"OutputStream",
"to",
",",
"int",
"bufferSize",
")",
"throws",
"IOException",
"{",
"byte",
"[",
"]",
"buffer",
"=",
"new",
"byte",
"[",
"bufferSize",
"]",
";",
"int",
"read",
";",
"whil... | Copies an input stream to another stream
@param from The source of the bytes
@param to The destination of the bytes
@param bufferSize The size of the byte buffer to use as bytes are copied
@throws IOException Thrown if there is a problem reading from or writing to either stream | [
"Copies",
"an",
"input",
"stream",
"to",
"another",
"stream"
] | train | https://github.com/3redronin/mu-server/blob/51598606a3082a121fbd785348ee9770b40308e6/src/main/java/io/muserver/Mutils.java#L59-L65 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java | KeyVaultClientBaseImpl.deleteSasDefinition | public DeletedSasDefinitionBundle deleteSasDefinition(String vaultBaseUrl, String storageAccountName, String sasDefinitionName) {
return deleteSasDefinitionWithServiceResponseAsync(vaultBaseUrl, storageAccountName, sasDefinitionName).toBlocking().single().body();
} | java | public DeletedSasDefinitionBundle deleteSasDefinition(String vaultBaseUrl, String storageAccountName, String sasDefinitionName) {
return deleteSasDefinitionWithServiceResponseAsync(vaultBaseUrl, storageAccountName, sasDefinitionName).toBlocking().single().body();
} | [
"public",
"DeletedSasDefinitionBundle",
"deleteSasDefinition",
"(",
"String",
"vaultBaseUrl",
",",
"String",
"storageAccountName",
",",
"String",
"sasDefinitionName",
")",
"{",
"return",
"deleteSasDefinitionWithServiceResponseAsync",
"(",
"vaultBaseUrl",
",",
"storageAccountNam... | Deletes a SAS definition from a specified storage account. This operation requires the storage/deletesas permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param storageAccountName The name of the storage account.
@param sasDefinitionName The name of the SAS definition.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws KeyVaultErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the DeletedSasDefinitionBundle object if successful. | [
"Deletes",
"a",
"SAS",
"definition",
"from",
"a",
"specified",
"storage",
"account",
".",
"This",
"operation",
"requires",
"the",
"storage",
"/",
"deletesas",
"permission",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L11069-L11071 |
moparisthebest/beehive | beehive-jdbc-control/src/main/java/org/apache/beehive/controls/system/jdbc/parser/SqlStatement.java | SqlStatement.loadSQLAnnotationStatmentOptions | private void loadSQLAnnotationStatmentOptions(ControlBeanContext context, Method method) {
final JdbcControl.SQL methodSQL = (JdbcControl.SQL) context.getMethodPropertySet(method, JdbcControl.SQL.class);
_batchUpdate = methodSQL.batchUpdate();
_getGeneratedKeys = methodSQL.getGeneratedKeys();
_genKeyColumnNames = methodSQL.generatedKeyColumnNames();
_genKeyColumnIndexes = methodSQL.generatedKeyColumnIndexes();
_scrollType = methodSQL.scrollableResultSet();
_fetchDirection = methodSQL.fetchDirection();
_fetchSize = methodSQL.fetchSize();
_maxRows = methodSQL.maxRows();
_maxArray = methodSQL.arrayMaxLength();
_holdability = methodSQL.resultSetHoldabilityOverride();
} | java | private void loadSQLAnnotationStatmentOptions(ControlBeanContext context, Method method) {
final JdbcControl.SQL methodSQL = (JdbcControl.SQL) context.getMethodPropertySet(method, JdbcControl.SQL.class);
_batchUpdate = methodSQL.batchUpdate();
_getGeneratedKeys = methodSQL.getGeneratedKeys();
_genKeyColumnNames = methodSQL.generatedKeyColumnNames();
_genKeyColumnIndexes = methodSQL.generatedKeyColumnIndexes();
_scrollType = methodSQL.scrollableResultSet();
_fetchDirection = methodSQL.fetchDirection();
_fetchSize = methodSQL.fetchSize();
_maxRows = methodSQL.maxRows();
_maxArray = methodSQL.arrayMaxLength();
_holdability = methodSQL.resultSetHoldabilityOverride();
} | [
"private",
"void",
"loadSQLAnnotationStatmentOptions",
"(",
"ControlBeanContext",
"context",
",",
"Method",
"method",
")",
"{",
"final",
"JdbcControl",
".",
"SQL",
"methodSQL",
"=",
"(",
"JdbcControl",
".",
"SQL",
")",
"context",
".",
"getMethodPropertySet",
"(",
... | Load element values from the SQL annotation which apply to Statements.
@param context ControlBeanContext instance.
@param method Annotated method. | [
"Load",
"element",
"values",
"from",
"the",
"SQL",
"annotation",
"which",
"apply",
"to",
"Statements",
"."
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-jdbc-control/src/main/java/org/apache/beehive/controls/system/jdbc/parser/SqlStatement.java#L455-L470 |
threerings/playn | core/src/playn/core/gl/GLContext.java | GLContext.pushScissorState | protected Rectangle pushScissorState (int x, int y, int width, int height) {
// grow the scissors buffer if necessary
if (scissorDepth == scissors.size()) {
scissors.add(new Rectangle());
}
Rectangle r = scissors.get(scissorDepth);
if (scissorDepth == 0) {
r.setBounds(x, y, width, height);
} else {
// intersect current with previous
Rectangle pr = scissors.get(scissorDepth - 1);
r.setLocation(Math.max(pr.x, x), Math.max(pr.y, y));
r.setSize(Math.min(pr.maxX(), x + width - 1) - r.x,
Math.min(pr.maxY(), y + height - 1) - r.y);
}
scissorDepth++;
return r;
} | java | protected Rectangle pushScissorState (int x, int y, int width, int height) {
// grow the scissors buffer if necessary
if (scissorDepth == scissors.size()) {
scissors.add(new Rectangle());
}
Rectangle r = scissors.get(scissorDepth);
if (scissorDepth == 0) {
r.setBounds(x, y, width, height);
} else {
// intersect current with previous
Rectangle pr = scissors.get(scissorDepth - 1);
r.setLocation(Math.max(pr.x, x), Math.max(pr.y, y));
r.setSize(Math.min(pr.maxX(), x + width - 1) - r.x,
Math.min(pr.maxY(), y + height - 1) - r.y);
}
scissorDepth++;
return r;
} | [
"protected",
"Rectangle",
"pushScissorState",
"(",
"int",
"x",
",",
"int",
"y",
",",
"int",
"width",
",",
"int",
"height",
")",
"{",
"// grow the scissors buffer if necessary",
"if",
"(",
"scissorDepth",
"==",
"scissors",
".",
"size",
"(",
")",
")",
"{",
"sc... | Adds the given rectangle to the scissors stack, intersecting with the previous one if it
exists. Intended for use by subclasses to implement {@link #startClipped} and {@link
#endClipped}.
<p>NOTE: calls to this method <b>must</b> be matched by a corresponding call {@link
#popScissorState}, or all hell will break loose.</p>
@return the new clipping rectangle to use | [
"Adds",
"the",
"given",
"rectangle",
"to",
"the",
"scissors",
"stack",
"intersecting",
"with",
"the",
"previous",
"one",
"if",
"it",
"exists",
".",
"Intended",
"for",
"use",
"by",
"subclasses",
"to",
"implement",
"{",
"@link",
"#startClipped",
"}",
"and",
"{... | train | https://github.com/threerings/playn/blob/c266eeb39188dcada4b00992a0d1199759e03d42/core/src/playn/core/gl/GLContext.java#L361-L379 |
ngageoint/geopackage-java | src/main/java/mil/nga/geopackage/io/TileProperties.java | TileProperties.getDoubleProperty | public Double getDoubleProperty(String property, boolean required) {
Double doubleValue = null;
String value = getProperty(property, required);
if (value != null) {
try {
doubleValue = Double.valueOf(value);
} catch (NumberFormatException e) {
throw new GeoPackageException(GEOPACKAGE_PROPERTIES_FILE
+ " property file property '" + property
+ "' must be a double");
}
}
return doubleValue;
} | java | public Double getDoubleProperty(String property, boolean required) {
Double doubleValue = null;
String value = getProperty(property, required);
if (value != null) {
try {
doubleValue = Double.valueOf(value);
} catch (NumberFormatException e) {
throw new GeoPackageException(GEOPACKAGE_PROPERTIES_FILE
+ " property file property '" + property
+ "' must be a double");
}
}
return doubleValue;
} | [
"public",
"Double",
"getDoubleProperty",
"(",
"String",
"property",
",",
"boolean",
"required",
")",
"{",
"Double",
"doubleValue",
"=",
"null",
";",
"String",
"value",
"=",
"getProperty",
"(",
"property",
",",
"required",
")",
";",
"if",
"(",
"value",
"!=",
... | Get the Double property
@param property
property
@param required
required flag
@return double property | [
"Get",
"the",
"Double",
"property"
] | train | https://github.com/ngageoint/geopackage-java/blob/889bffb5d18330a3f4bd89443acf7959ebe3a376/src/main/java/mil/nga/geopackage/io/TileProperties.java#L160-L173 |
kaazing/java.client | amqp-0-9-1/amqp/src/main/java/org/kaazing/net/ws/amqp/AmqpChannel.java | AmqpChannel.closeChannel | public AmqpChannel closeChannel(int replyCode, String replyText, int classId, int methodId1) {
if (readyState == ReadyState.CLOSED) {
return this;
}
Object[] args = {replyCode, replyText, classId, methodId1};
WrappedByteBuffer bodyArg = null;
HashMap<String, Object> headersArg = null;
String methodName = "closeChannel";
String methodId = "20" + "40";
AmqpMethod amqpMethod = MethodLookup.LookupMethod(methodId);
Object[] arguments = {this, amqpMethod, this.id, args, bodyArg, headersArg};
asyncClient.enqueueAction(methodName, "channelWrite", arguments, null, null);
return this;
} | java | public AmqpChannel closeChannel(int replyCode, String replyText, int classId, int methodId1) {
if (readyState == ReadyState.CLOSED) {
return this;
}
Object[] args = {replyCode, replyText, classId, methodId1};
WrappedByteBuffer bodyArg = null;
HashMap<String, Object> headersArg = null;
String methodName = "closeChannel";
String methodId = "20" + "40";
AmqpMethod amqpMethod = MethodLookup.LookupMethod(methodId);
Object[] arguments = {this, amqpMethod, this.id, args, bodyArg, headersArg};
asyncClient.enqueueAction(methodName, "channelWrite", arguments, null, null);
return this;
} | [
"public",
"AmqpChannel",
"closeChannel",
"(",
"int",
"replyCode",
",",
"String",
"replyText",
",",
"int",
"classId",
",",
"int",
"methodId1",
")",
"{",
"if",
"(",
"readyState",
"==",
"ReadyState",
".",
"CLOSED",
")",
"{",
"return",
"this",
";",
"}",
"Objec... | This method indicates that the sender wants to close the channel.
@param replyCode
@param replyText
@param classId
@param methodId1
@return AmqpChannel | [
"This",
"method",
"indicates",
"that",
"the",
"sender",
"wants",
"to",
"close",
"the",
"channel",
"."
] | train | https://github.com/kaazing/java.client/blob/25ad2ae5bb24aa9d6b79400fce649b518dcfbe26/amqp-0-9-1/amqp/src/main/java/org/kaazing/net/ws/amqp/AmqpChannel.java#L395-L410 |
vlingo/vlingo-actors | src/main/java/io/vlingo/actors/World.java | World.actorFor | public <T> T actorFor(final Class<T> protocol, final Class<? extends Actor> type, final Object...parameters) {
if (isTerminated()) {
throw new IllegalStateException("vlingo/actors: Stopped.");
}
return stage().actorFor(protocol, type, parameters);
} | java | public <T> T actorFor(final Class<T> protocol, final Class<? extends Actor> type, final Object...parameters) {
if (isTerminated()) {
throw new IllegalStateException("vlingo/actors: Stopped.");
}
return stage().actorFor(protocol, type, parameters);
} | [
"public",
"<",
"T",
">",
"T",
"actorFor",
"(",
"final",
"Class",
"<",
"T",
">",
"protocol",
",",
"final",
"Class",
"<",
"?",
"extends",
"Actor",
">",
"type",
",",
"final",
"Object",
"...",
"parameters",
")",
"{",
"if",
"(",
"isTerminated",
"(",
")",
... | Answers the {@code T} protocol of the newly created {@code Actor} that implements the {@code protocol}.
@param protocol the {@code Class<T>} protocol
@param type the {@code Class<? extends Actor>} of the {@code Actor} to create
@param parameters the {@code Object[]} of constructor parameters
@param <T> the protocol type
@return T | [
"Answers",
"the",
"{"
] | train | https://github.com/vlingo/vlingo-actors/blob/c7d046fd139c0490cf0fd2588d7dc2f792f13493/src/main/java/io/vlingo/actors/World.java#L104-L110 |
OpenTSDB/opentsdb | src/core/Internal.java | Internal.decodeHistogramDataPoint | public static HistogramDataPoint decodeHistogramDataPoint(final TSDB tsdb,
final KeyValue kv) {
long timestamp = Internal.baseTime(kv.key());
return decodeHistogramDataPoint(tsdb, timestamp, kv.qualifier(), kv.value());
} | java | public static HistogramDataPoint decodeHistogramDataPoint(final TSDB tsdb,
final KeyValue kv) {
long timestamp = Internal.baseTime(kv.key());
return decodeHistogramDataPoint(tsdb, timestamp, kv.qualifier(), kv.value());
} | [
"public",
"static",
"HistogramDataPoint",
"decodeHistogramDataPoint",
"(",
"final",
"TSDB",
"tsdb",
",",
"final",
"KeyValue",
"kv",
")",
"{",
"long",
"timestamp",
"=",
"Internal",
".",
"baseTime",
"(",
"kv",
".",
"key",
"(",
")",
")",
";",
"return",
"decodeH... | Decode the histogram point from the given key value
@param kv the key value that contains a histogram
@return the decoded {@code HistogramDataPoint} | [
"Decode",
"the",
"histogram",
"point",
"from",
"the",
"given",
"key",
"value"
] | train | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/core/Internal.java#L1060-L1064 |
attribyte/wpdb | src/main/java/org/attribyte/wp/model/Shortcode.java | Shortcode.appendAttributeValue | private StringBuilder appendAttributeValue(final String value, final StringBuilder buf) {
if(value.contains("\"")) {
buf.append("\'").append(escapeAttribute(value)).append("\'");
} else if(value.contains(" ") || value.contains("\'") || value.contains("=")) {
buf.append("\"").append(escapeAttribute(value)).append("\"");
} else {
buf.append(escapeAttribute(value));
}
return buf;
} | java | private StringBuilder appendAttributeValue(final String value, final StringBuilder buf) {
if(value.contains("\"")) {
buf.append("\'").append(escapeAttribute(value)).append("\'");
} else if(value.contains(" ") || value.contains("\'") || value.contains("=")) {
buf.append("\"").append(escapeAttribute(value)).append("\"");
} else {
buf.append(escapeAttribute(value));
}
return buf;
} | [
"private",
"StringBuilder",
"appendAttributeValue",
"(",
"final",
"String",
"value",
",",
"final",
"StringBuilder",
"buf",
")",
"{",
"if",
"(",
"value",
".",
"contains",
"(",
"\"\\\"\"",
")",
")",
"{",
"buf",
".",
"append",
"(",
"\"\\'\"",
")",
".",
"appen... | Appends an attribute value with appropriate quoting.
@param value The value.
@param buf The buffer to append to.
@return The input buffer. | [
"Appends",
"an",
"attribute",
"value",
"with",
"appropriate",
"quoting",
"."
] | train | https://github.com/attribyte/wpdb/blob/b9adf6131dfb67899ebff770c9bfeb001cc42f30/src/main/java/org/attribyte/wp/model/Shortcode.java#L141-L150 |
lessthanoptimal/BoofCV | main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/QrPose3DUtils.java | QrPose3DUtils.setPair | private void setPair(int which, int row, int col, int N , Point2D_F64 pixel ) {
set3D(row,col,N,point23.get(which).location);
pixelToNorm.compute(pixel.x,pixel.y,point23.get(which).observation);
} | java | private void setPair(int which, int row, int col, int N , Point2D_F64 pixel ) {
set3D(row,col,N,point23.get(which).location);
pixelToNorm.compute(pixel.x,pixel.y,point23.get(which).observation);
} | [
"private",
"void",
"setPair",
"(",
"int",
"which",
",",
"int",
"row",
",",
"int",
"col",
",",
"int",
"N",
",",
"Point2D_F64",
"pixel",
")",
"{",
"set3D",
"(",
"row",
",",
"col",
",",
"N",
",",
"point23",
".",
"get",
"(",
"which",
")",
".",
"locat... | Specifies PNP parameters for a single feature
@param which Landmark's index
@param row row in the QR code's grid coordinate system
@param col column in the QR code's grid coordinate system
@param N width of grid
@param pixel observed pixel coordinate of feature | [
"Specifies",
"PNP",
"parameters",
"for",
"a",
"single",
"feature"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/QrPose3DUtils.java#L149-L152 |
roboconf/roboconf-platform | core/roboconf-messaging-rabbitmq/src/main/java/net/roboconf/messaging/rabbitmq/internal/RabbitMqClientFactory.java | RabbitMqClientFactory.setConfiguration | public void setConfiguration( Dictionary<?,?> properties ) {
// Ignore iPojo properties
final List<String> propertiesToSkip = Arrays.asList(
"component",
"felix.fileinstall.filename" );
// Convert the dictionary into a map
Map<String,String> map = new LinkedHashMap<> ();
for( Enumeration<?> en = properties.keys(); en.hasMoreElements(); ) {
Object key = en.nextElement();
String keyAsString = String.valueOf( key );
if( propertiesToSkip.contains( keyAsString ))
continue;
// "null" are not acceptable values in dictionaries
// (OSGi often use Hash tables)
Object value = properties.get( key );
map.put( keyAsString, String.valueOf( value ));
}
// Invoked by iPojo => the messaging type is the right one in this method
map.put( MessagingConstants.MESSAGING_TYPE_PROPERTY, FACTORY_RABBITMQ );
setConfiguration( map );
} | java | public void setConfiguration( Dictionary<?,?> properties ) {
// Ignore iPojo properties
final List<String> propertiesToSkip = Arrays.asList(
"component",
"felix.fileinstall.filename" );
// Convert the dictionary into a map
Map<String,String> map = new LinkedHashMap<> ();
for( Enumeration<?> en = properties.keys(); en.hasMoreElements(); ) {
Object key = en.nextElement();
String keyAsString = String.valueOf( key );
if( propertiesToSkip.contains( keyAsString ))
continue;
// "null" are not acceptable values in dictionaries
// (OSGi often use Hash tables)
Object value = properties.get( key );
map.put( keyAsString, String.valueOf( value ));
}
// Invoked by iPojo => the messaging type is the right one in this method
map.put( MessagingConstants.MESSAGING_TYPE_PROPERTY, FACTORY_RABBITMQ );
setConfiguration( map );
} | [
"public",
"void",
"setConfiguration",
"(",
"Dictionary",
"<",
"?",
",",
"?",
">",
"properties",
")",
"{",
"// Ignore iPojo properties",
"final",
"List",
"<",
"String",
">",
"propertiesToSkip",
"=",
"Arrays",
".",
"asList",
"(",
"\"component\"",
",",
"\"felix.fil... | Invoked by iPojo when one or several properties were updated from Config Admin.
@param properties | [
"Invoked",
"by",
"iPojo",
"when",
"one",
"or",
"several",
"properties",
"were",
"updated",
"from",
"Config",
"Admin",
"."
] | train | https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-messaging-rabbitmq/src/main/java/net/roboconf/messaging/rabbitmq/internal/RabbitMqClientFactory.java#L153-L178 |
graknlabs/grakn | daemon/GraknDaemon.java | GraknDaemon.assertEnvironment | private static void assertEnvironment(Path graknHome, Path graknProperties) {
String javaVersion = System.getProperty("java.specification.version");
if (!javaVersion.equals("1.8")) {
throw new RuntimeException(ErrorMessage.UNSUPPORTED_JAVA_VERSION.getMessage(javaVersion));
}
if (!graknHome.resolve("conf").toFile().exists()) {
throw new RuntimeException(ErrorMessage.UNABLE_TO_GET_GRAKN_HOME_FOLDER.getMessage());
}
if (!graknProperties.toFile().exists()) {
throw new RuntimeException(ErrorMessage.UNABLE_TO_GET_GRAKN_CONFIG_FOLDER.getMessage());
}
} | java | private static void assertEnvironment(Path graknHome, Path graknProperties) {
String javaVersion = System.getProperty("java.specification.version");
if (!javaVersion.equals("1.8")) {
throw new RuntimeException(ErrorMessage.UNSUPPORTED_JAVA_VERSION.getMessage(javaVersion));
}
if (!graknHome.resolve("conf").toFile().exists()) {
throw new RuntimeException(ErrorMessage.UNABLE_TO_GET_GRAKN_HOME_FOLDER.getMessage());
}
if (!graknProperties.toFile().exists()) {
throw new RuntimeException(ErrorMessage.UNABLE_TO_GET_GRAKN_CONFIG_FOLDER.getMessage());
}
} | [
"private",
"static",
"void",
"assertEnvironment",
"(",
"Path",
"graknHome",
",",
"Path",
"graknProperties",
")",
"{",
"String",
"javaVersion",
"=",
"System",
".",
"getProperty",
"(",
"\"java.specification.version\"",
")",
";",
"if",
"(",
"!",
"javaVersion",
".",
... | Basic environment checks. Grakn should only be ran if users are running Java 8,
home folder can be detected, and the configuration file 'grakn.properties' exists.
@param graknHome path to $GRAKN_HOME
@param graknProperties path to the 'grakn.properties' file | [
"Basic",
"environment",
"checks",
".",
"Grakn",
"should",
"only",
"be",
"ran",
"if",
"users",
"are",
"running",
"Java",
"8",
"home",
"folder",
"can",
"be",
"detected",
"and",
"the",
"configuration",
"file",
"grakn",
".",
"properties",
"exists",
"."
] | train | https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/daemon/GraknDaemon.java#L94-L105 |
google/closure-templates | java/src/com/google/template/soy/jbcsrc/restricted/BytecodeUtils.java | BytecodeUtils.compareSoyEquals | public static Expression compareSoyEquals(final SoyExpression left, final SoyExpression right) {
// We can special case when we know the types.
// If either is a string, we run special logic so test for that first
// otherwise we special case primitives and eventually fall back to our runtime.
SoyRuntimeType leftRuntimeType = left.soyRuntimeType();
SoyRuntimeType rightRuntimeType = right.soyRuntimeType();
if (leftRuntimeType.isKnownString()) {
return doEqualsString(left.unboxAsString(), right);
}
if (rightRuntimeType.isKnownString()) {
// TODO(lukes): we are changing the order of evaluation here.
return doEqualsString(right.unboxAsString(), left);
}
if (leftRuntimeType.isKnownInt()
&& rightRuntimeType.isKnownInt()
&& left.isNonNullable()
&& right.isNonNullable()) {
return compare(Opcodes.IFEQ, left.unboxAsLong(), right.unboxAsLong());
}
if (leftRuntimeType.isKnownNumber()
&& rightRuntimeType.isKnownNumber()
&& left.isNonNullable()
&& right.isNonNullable()
&& (leftRuntimeType.isKnownFloat() || rightRuntimeType.isKnownFloat())) {
return compare(Opcodes.IFEQ, left.coerceToDouble(), right.coerceToDouble());
}
return MethodRef.RUNTIME_EQUAL.invoke(left.box(), right.box());
} | java | public static Expression compareSoyEquals(final SoyExpression left, final SoyExpression right) {
// We can special case when we know the types.
// If either is a string, we run special logic so test for that first
// otherwise we special case primitives and eventually fall back to our runtime.
SoyRuntimeType leftRuntimeType = left.soyRuntimeType();
SoyRuntimeType rightRuntimeType = right.soyRuntimeType();
if (leftRuntimeType.isKnownString()) {
return doEqualsString(left.unboxAsString(), right);
}
if (rightRuntimeType.isKnownString()) {
// TODO(lukes): we are changing the order of evaluation here.
return doEqualsString(right.unboxAsString(), left);
}
if (leftRuntimeType.isKnownInt()
&& rightRuntimeType.isKnownInt()
&& left.isNonNullable()
&& right.isNonNullable()) {
return compare(Opcodes.IFEQ, left.unboxAsLong(), right.unboxAsLong());
}
if (leftRuntimeType.isKnownNumber()
&& rightRuntimeType.isKnownNumber()
&& left.isNonNullable()
&& right.isNonNullable()
&& (leftRuntimeType.isKnownFloat() || rightRuntimeType.isKnownFloat())) {
return compare(Opcodes.IFEQ, left.coerceToDouble(), right.coerceToDouble());
}
return MethodRef.RUNTIME_EQUAL.invoke(left.box(), right.box());
} | [
"public",
"static",
"Expression",
"compareSoyEquals",
"(",
"final",
"SoyExpression",
"left",
",",
"final",
"SoyExpression",
"right",
")",
"{",
"// We can special case when we know the types.",
"// If either is a string, we run special logic so test for that first",
"// otherwise we s... | Compares two {@link SoyExpression}s for equality using soy == semantics. | [
"Compares",
"two",
"{"
] | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/restricted/BytecodeUtils.java#L576-L603 |
DiUS/pact-jvm | pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslJsonArray.java | PactDslJsonArray.arrayMinLike | public static PactDslJsonArray arrayMinLike(int minSize, int numberExamples, PactDslJsonRootValue value) {
if (numberExamples < minSize) {
throw new IllegalArgumentException(String.format("Number of example %d is less than the minimum size of %d",
numberExamples, minSize));
}
PactDslJsonArray parent = new PactDslJsonArray("", "", null, true);
parent.setNumberExamples(numberExamples);
parent.matchers.addRule("", parent.matchMin(minSize));
parent.putObject(value);
return parent;
} | java | public static PactDslJsonArray arrayMinLike(int minSize, int numberExamples, PactDslJsonRootValue value) {
if (numberExamples < minSize) {
throw new IllegalArgumentException(String.format("Number of example %d is less than the minimum size of %d",
numberExamples, minSize));
}
PactDslJsonArray parent = new PactDslJsonArray("", "", null, true);
parent.setNumberExamples(numberExamples);
parent.matchers.addRule("", parent.matchMin(minSize));
parent.putObject(value);
return parent;
} | [
"public",
"static",
"PactDslJsonArray",
"arrayMinLike",
"(",
"int",
"minSize",
",",
"int",
"numberExamples",
",",
"PactDslJsonRootValue",
"value",
")",
"{",
"if",
"(",
"numberExamples",
"<",
"minSize",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"St... | Root level array with minimum size where each item must match the provided matcher
@param minSize minimum size
@param numberExamples Number of examples to generate | [
"Root",
"level",
"array",
"with",
"minimum",
"size",
"where",
"each",
"item",
"must",
"match",
"the",
"provided",
"matcher"
] | train | https://github.com/DiUS/pact-jvm/blob/2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef/pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslJsonArray.java#L802-L812 |
stratosphere/stratosphere | stratosphere-runtime/src/main/java/eu/stratosphere/nephele/event/task/EventNotificationManager.java | EventNotificationManager.unsubscribeFromEvent | public void unsubscribeFromEvent(final EventListener eventListener, final Class<? extends AbstractEvent> eventType) {
synchronized (this.subscriptions) {
List<EventListener> subscribers = this.subscriptions.get(eventType);
if (subscribers == null) {
return;
}
subscribers.remove(eventListener);
if (subscribers.isEmpty()) {
this.subscriptions.remove(eventType);
}
}
} | java | public void unsubscribeFromEvent(final EventListener eventListener, final Class<? extends AbstractEvent> eventType) {
synchronized (this.subscriptions) {
List<EventListener> subscribers = this.subscriptions.get(eventType);
if (subscribers == null) {
return;
}
subscribers.remove(eventListener);
if (subscribers.isEmpty()) {
this.subscriptions.remove(eventType);
}
}
} | [
"public",
"void",
"unsubscribeFromEvent",
"(",
"final",
"EventListener",
"eventListener",
",",
"final",
"Class",
"<",
"?",
"extends",
"AbstractEvent",
">",
"eventType",
")",
"{",
"synchronized",
"(",
"this",
".",
"subscriptions",
")",
"{",
"List",
"<",
"EventLis... | Removes a subscription of an {@link EventListener} object for the given event type.
@param eventListener
the event listener to remove the subscription for
@param eventType
the event type to remove the subscription for | [
"Removes",
"a",
"subscription",
"of",
"an",
"{",
"@link",
"EventListener",
"}",
"object",
"for",
"the",
"given",
"event",
"type",
"."
] | train | https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/event/task/EventNotificationManager.java#L65-L79 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/audit/auditsyslogpolicy_binding.java | auditsyslogpolicy_binding.get | public static auditsyslogpolicy_binding get(nitro_service service, String name) throws Exception{
auditsyslogpolicy_binding obj = new auditsyslogpolicy_binding();
obj.set_name(name);
auditsyslogpolicy_binding response = (auditsyslogpolicy_binding) obj.get_resource(service);
return response;
} | java | public static auditsyslogpolicy_binding get(nitro_service service, String name) throws Exception{
auditsyslogpolicy_binding obj = new auditsyslogpolicy_binding();
obj.set_name(name);
auditsyslogpolicy_binding response = (auditsyslogpolicy_binding) obj.get_resource(service);
return response;
} | [
"public",
"static",
"auditsyslogpolicy_binding",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"name",
")",
"throws",
"Exception",
"{",
"auditsyslogpolicy_binding",
"obj",
"=",
"new",
"auditsyslogpolicy_binding",
"(",
")",
";",
"obj",
".",
"set_name",
"(",
... | Use this API to fetch auditsyslogpolicy_binding resource of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"auditsyslogpolicy_binding",
"resource",
"of",
"given",
"name",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/audit/auditsyslogpolicy_binding.java#L191-L196 |
alkacon/opencms-core | src-gwt/org/opencms/ade/sitemap/client/CmsModelPageTreeItem.java | CmsModelPageTreeItem.createRootItem | public static CmsModelPageTreeItem createRootItem(boolean isModelGroup, String title, String subTitle) {
return new CmsModelPageTreeItem(isModelGroup, title, subTitle);
} | java | public static CmsModelPageTreeItem createRootItem(boolean isModelGroup, String title, String subTitle) {
return new CmsModelPageTreeItem(isModelGroup, title, subTitle);
} | [
"public",
"static",
"CmsModelPageTreeItem",
"createRootItem",
"(",
"boolean",
"isModelGroup",
",",
"String",
"title",
",",
"String",
"subTitle",
")",
"{",
"return",
"new",
"CmsModelPageTreeItem",
"(",
"isModelGroup",
",",
"title",
",",
"subTitle",
")",
";",
"}"
] | Creates the fake model page tree item used as a root for the tree view.<p>
@param isModelGroup in case of a model group page
@param title the title
@param subTitle the sub title
@return the root tree item | [
"Creates",
"the",
"fake",
"model",
"page",
"tree",
"item",
"used",
"as",
"a",
"root",
"for",
"the",
"tree",
"view",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/sitemap/client/CmsModelPageTreeItem.java#L132-L135 |
microfocus-idol/java-idol-user-service | src/main/java/com/hp/autonomy/user/UserServiceImpl.java | UserServiceImpl.createUserRoles | private List<UserRoles> createUserRoles(final Iterable<String> roleList, final boolean includeEmpty) {
final List<User> userDetails = getUsers();
final Map<String, List<String>> userNamesRolesMap = createUsernameRolesMap(roleList);
final List<UserRoles> userRoles = new ArrayList<>();
for (final User user : userDetails) {
final String username = user.getUsername();
final long uid = user.getUid();
final String securityInfo = user.getSecurityinfo();
final List<String> roles = userNamesRolesMap.get(username);
if (roles != null) {
userRoles.add(new UserRoles(username, uid, securityInfo, roles, user.getFields()));
} else if (includeEmpty) {
userRoles.add(new UserRoles(username, uid, securityInfo, new ArrayList<>(), user.getFields()));
}
}
return userRoles;
} | java | private List<UserRoles> createUserRoles(final Iterable<String> roleList, final boolean includeEmpty) {
final List<User> userDetails = getUsers();
final Map<String, List<String>> userNamesRolesMap = createUsernameRolesMap(roleList);
final List<UserRoles> userRoles = new ArrayList<>();
for (final User user : userDetails) {
final String username = user.getUsername();
final long uid = user.getUid();
final String securityInfo = user.getSecurityinfo();
final List<String> roles = userNamesRolesMap.get(username);
if (roles != null) {
userRoles.add(new UserRoles(username, uid, securityInfo, roles, user.getFields()));
} else if (includeEmpty) {
userRoles.add(new UserRoles(username, uid, securityInfo, new ArrayList<>(), user.getFields()));
}
}
return userRoles;
} | [
"private",
"List",
"<",
"UserRoles",
">",
"createUserRoles",
"(",
"final",
"Iterable",
"<",
"String",
">",
"roleList",
",",
"final",
"boolean",
"includeEmpty",
")",
"{",
"final",
"List",
"<",
"User",
">",
"userDetails",
"=",
"getUsers",
"(",
")",
";",
"fin... | <p>If includeEmpty is false, returns a list of UserRoles containing only users with one or more of the roles
listed in roleList. If it is true, the list also includes users without any of the given roles. In either case,
the UserRoles' roles lists only contain roles contained in roleList.</p>
<p>Given a role list, it gets all the users belonging to each role then extracts uids from UserReadUserListDetails.
This should minimize the number of calls to community since it's most likely that num(users) >> num(roles).</p>
@param roleList List of roles
@param includeEmpty Whether to include users who have none of the roles in roleList.
@return List of users and uids, with roles taken from roleList. | [
"<p",
">",
"If",
"includeEmpty",
"is",
"false",
"returns",
"a",
"list",
"of",
"UserRoles",
"containing",
"only",
"users",
"with",
"one",
"or",
"more",
"of",
"the",
"roles",
"listed",
"in",
"roleList",
".",
"If",
"it",
"is",
"true",
"the",
"list",
"also",... | train | https://github.com/microfocus-idol/java-idol-user-service/blob/8eb5d00b3359b69891893c54f8201c16e7910322/src/main/java/com/hp/autonomy/user/UserServiceImpl.java#L318-L337 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/StylesheetHandler.java | StylesheetHandler.endDocument | public void endDocument() throws org.xml.sax.SAXException
{
try
{
if (null != getStylesheetRoot())
{
if (0 == m_stylesheetLevel)
getStylesheetRoot().recompose();
}
else
throw new TransformerException(XSLMessages.createMessage(XSLTErrorResources.ER_NO_STYLESHEETROOT, null)); //"Did not find the stylesheet root!");
XSLTElementProcessor elemProcessor = getCurrentProcessor();
if (null != elemProcessor)
elemProcessor.startNonText(this);
m_stylesheetLevel--;
popSpaceHandling();
// WARNING: This test works only as long as stylesheets are parsed
// more or less recursively. If we switch to an iterative "work-list"
// model, this will become true prematurely. In that case,
// isStylesheetParsingComplete() will have to be adjusted to be aware
// of the worklist.
m_parsingComplete = (m_stylesheetLevel < 0);
}
catch (TransformerException te)
{
throw new org.xml.sax.SAXException(te);
}
} | java | public void endDocument() throws org.xml.sax.SAXException
{
try
{
if (null != getStylesheetRoot())
{
if (0 == m_stylesheetLevel)
getStylesheetRoot().recompose();
}
else
throw new TransformerException(XSLMessages.createMessage(XSLTErrorResources.ER_NO_STYLESHEETROOT, null)); //"Did not find the stylesheet root!");
XSLTElementProcessor elemProcessor = getCurrentProcessor();
if (null != elemProcessor)
elemProcessor.startNonText(this);
m_stylesheetLevel--;
popSpaceHandling();
// WARNING: This test works only as long as stylesheets are parsed
// more or less recursively. If we switch to an iterative "work-list"
// model, this will become true prematurely. In that case,
// isStylesheetParsingComplete() will have to be adjusted to be aware
// of the worklist.
m_parsingComplete = (m_stylesheetLevel < 0);
}
catch (TransformerException te)
{
throw new org.xml.sax.SAXException(te);
}
} | [
"public",
"void",
"endDocument",
"(",
")",
"throws",
"org",
".",
"xml",
".",
"sax",
".",
"SAXException",
"{",
"try",
"{",
"if",
"(",
"null",
"!=",
"getStylesheetRoot",
"(",
")",
")",
"{",
"if",
"(",
"0",
"==",
"m_stylesheetLevel",
")",
"getStylesheetRoot... | Receive notification of the end of the document.
@see org.xml.sax.ContentHandler#endDocument
@throws org.xml.sax.SAXException Any SAX exception, possibly
wrapping another exception. | [
"Receive",
"notification",
"of",
"the",
"end",
"of",
"the",
"document",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/StylesheetHandler.java#L463-L496 |
belaban/JGroups | src/org/jgroups/protocols/pbcast/ServerGmsImpl.java | ServerGmsImpl.handleViewChange | public void handleViewChange(View view, Digest digest) {
if(gms.isLeaving() && !view.containsMember(gms.local_addr))
return;
View prev_view=gms.view();
gms.installView(view, digest);
Address prev_coord=prev_view != null? prev_view.getCoord() : null, curr_coord=view.getCoord();
if(!Objects.equals(curr_coord, prev_coord))
coordChanged(prev_coord, curr_coord);
} | java | public void handleViewChange(View view, Digest digest) {
if(gms.isLeaving() && !view.containsMember(gms.local_addr))
return;
View prev_view=gms.view();
gms.installView(view, digest);
Address prev_coord=prev_view != null? prev_view.getCoord() : null, curr_coord=view.getCoord();
if(!Objects.equals(curr_coord, prev_coord))
coordChanged(prev_coord, curr_coord);
} | [
"public",
"void",
"handleViewChange",
"(",
"View",
"view",
",",
"Digest",
"digest",
")",
"{",
"if",
"(",
"gms",
".",
"isLeaving",
"(",
")",
"&&",
"!",
"view",
".",
"containsMember",
"(",
"gms",
".",
"local_addr",
")",
")",
"return",
";",
"View",
"prev_... | Called by the GMS when a VIEW is received.
@param view The view to be installed
@param digest If view is a MergeView, the digest contains the seqnos of all members and has to be set by GMS | [
"Called",
"by",
"the",
"GMS",
"when",
"a",
"VIEW",
"is",
"received",
"."
] | train | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/protocols/pbcast/ServerGmsImpl.java#L63-L71 |
timols/java-gitlab-api | src/main/java/org/gitlab/api/GitlabAPI.java | GitlabAPI.cherryPick | public GitlabCommit cherryPick(Serializable projectId, String sha, String targetBranchName) throws IOException {
String tailUrl = GitlabProject.URL + "/" + sanitizeProjectId(projectId) + "/repository/commits/" + sha + "/cherry_pick";
return retrieve().with("branch", targetBranchName).to(tailUrl, GitlabCommit.class);
} | java | public GitlabCommit cherryPick(Serializable projectId, String sha, String targetBranchName) throws IOException {
String tailUrl = GitlabProject.URL + "/" + sanitizeProjectId(projectId) + "/repository/commits/" + sha + "/cherry_pick";
return retrieve().with("branch", targetBranchName).to(tailUrl, GitlabCommit.class);
} | [
"public",
"GitlabCommit",
"cherryPick",
"(",
"Serializable",
"projectId",
",",
"String",
"sha",
",",
"String",
"targetBranchName",
")",
"throws",
"IOException",
"{",
"String",
"tailUrl",
"=",
"GitlabProject",
".",
"URL",
"+",
"\"/\"",
"+",
"sanitizeProjectId",
"("... | Cherry picks a commit.
@param projectId The id of the project
@param sha The sha of the commit
@param targetBranchName The branch on which the commit must be cherry-picked
@return the commit of the cherry-pick.
@throws IOException on gitlab api call error | [
"Cherry",
"picks",
"a",
"commit",
"."
] | train | https://github.com/timols/java-gitlab-api/blob/f03eedf952cfbb40306be3bf9234dcf78fab029e/src/main/java/org/gitlab/api/GitlabAPI.java#L1539-L1542 |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/tools/HELM2NotationUtils.java | HELM2NotationUtils.combineHELM2notation | public final static void combineHELM2notation(HELM2Notation helm2notation, HELM2Notation newHELM2Notation) throws NotationException {
HELM2NotationUtils.helm2notation = helm2notation;
Map<String, String> mapIds = generateMapChangeIds(newHELM2Notation.getPolymerAndGroupingIDs());
/* method to merge the new HELM2Notation into the existing one */
/* section 1 */
/* id's have to changed */
section1(newHELM2Notation.getListOfPolymers(), mapIds);
/* section 2 */
section2(newHELM2Notation.getListOfConnections(), mapIds);
/* section 3 */
section3(newHELM2Notation.getListOfGroupings(), mapIds);
/* section 4 */
section4(newHELM2Notation.getListOfAnnotations(), mapIds);
} | java | public final static void combineHELM2notation(HELM2Notation helm2notation, HELM2Notation newHELM2Notation) throws NotationException {
HELM2NotationUtils.helm2notation = helm2notation;
Map<String, String> mapIds = generateMapChangeIds(newHELM2Notation.getPolymerAndGroupingIDs());
/* method to merge the new HELM2Notation into the existing one */
/* section 1 */
/* id's have to changed */
section1(newHELM2Notation.getListOfPolymers(), mapIds);
/* section 2 */
section2(newHELM2Notation.getListOfConnections(), mapIds);
/* section 3 */
section3(newHELM2Notation.getListOfGroupings(), mapIds);
/* section 4 */
section4(newHELM2Notation.getListOfAnnotations(), mapIds);
} | [
"public",
"final",
"static",
"void",
"combineHELM2notation",
"(",
"HELM2Notation",
"helm2notation",
",",
"HELM2Notation",
"newHELM2Notation",
")",
"throws",
"NotationException",
"{",
"HELM2NotationUtils",
".",
"helm2notation",
"=",
"helm2notation",
";",
"Map",
"<",
"Str... | method to add a new HELMNotation to another HELM2Notation, the new
HELM2Notation will be merged to the first HELM2Notation
@param helm2notation HELM2Notation
@param newHELM2Notation new HELMNotation
@throws NotationException if the HELMNotation is not valid | [
"method",
"to",
"add",
"a",
"new",
"HELMNotation",
"to",
"another",
"HELM2Notation",
"the",
"new",
"HELM2Notation",
"will",
"be",
"merged",
"to",
"the",
"first",
"HELM2Notation"
] | train | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/HELM2NotationUtils.java#L199-L212 |
quattor/pan | panc/src/main/java/org/quattor/pan/ttemplate/CompileTimeContext.java | CompileTimeContext.setLocalVariable | public void setLocalVariable(String name, Element value)
throws EvaluationException {
assert (name != null);
localVariables.put(name, value);
} | java | public void setLocalVariable(String name, Element value)
throws EvaluationException {
assert (name != null);
localVariables.put(name, value);
} | [
"public",
"void",
"setLocalVariable",
"(",
"String",
"name",
",",
"Element",
"value",
")",
"throws",
"EvaluationException",
"{",
"assert",
"(",
"name",
"!=",
"null",
")",
";",
"localVariables",
".",
"put",
"(",
"name",
",",
"value",
")",
";",
"}"
] | Set the local variable to the given value. If the value is null, then the
corresponding variable will be removed. If there is a global variable of
the same name, then an EvaluationException will be thrown. This method
does not allow children of the referenced value to be set.
@param name
name of the local variable
@param value
value to use or null to remove the variable
@throws EvaluationException
if there is a global variable with the same name as the local
variable | [
"Set",
"the",
"local",
"variable",
"to",
"the",
"given",
"value",
".",
"If",
"the",
"value",
"is",
"null",
"then",
"the",
"corresponding",
"variable",
"will",
"be",
"removed",
".",
"If",
"there",
"is",
"a",
"global",
"variable",
"of",
"the",
"same",
"nam... | train | https://github.com/quattor/pan/blob/009934a603dd0c08d3fa4bb7d9389c380a916f54/panc/src/main/java/org/quattor/pan/ttemplate/CompileTimeContext.java#L767-L773 |
Labs64/swid-generator | src/main/java/com/labs64/utils/swid/support/SwidUtils.java | SwidUtils.generateRegId | public static String generateRegId(final String domainCreationDate, final String reverseDomainName) {
return generateRegId(domainCreationDate, reverseDomainName, null);
} | java | public static String generateRegId(final String domainCreationDate, final String reverseDomainName) {
return generateRegId(domainCreationDate, reverseDomainName, null);
} | [
"public",
"static",
"String",
"generateRegId",
"(",
"final",
"String",
"domainCreationDate",
",",
"final",
"String",
"reverseDomainName",
")",
"{",
"return",
"generateRegId",
"(",
"domainCreationDate",
",",
"reverseDomainName",
",",
"null",
")",
";",
"}"
] | Generate RegId.
@param domainCreationDate
the date at which the entity creating the regid first owned the domain that is also used in the regid
in year-month format; e.g. 2010-04
@param reverseDomainName
the domain of the entity, in reverse order; e.g. com.labs64
@return generated RegId | [
"Generate",
"RegId",
"."
] | train | https://github.com/Labs64/swid-generator/blob/cf78d2469469a09701bce7c5f966ac6de2b7c613/src/main/java/com/labs64/utils/swid/support/SwidUtils.java#L59-L61 |
getsentry/sentry-java | sentry/src/main/java/io/sentry/event/EventBuilder.java | EventBuilder.withContexts | public EventBuilder withContexts(Map<String, Map<String, Object>> contexts) {
event.setContexts(contexts);
return this;
} | java | public EventBuilder withContexts(Map<String, Map<String, Object>> contexts) {
event.setContexts(contexts);
return this;
} | [
"public",
"EventBuilder",
"withContexts",
"(",
"Map",
"<",
"String",
",",
"Map",
"<",
"String",
",",
"Object",
">",
">",
"contexts",
")",
"{",
"event",
".",
"setContexts",
"(",
"contexts",
")",
";",
"return",
"this",
";",
"}"
] | Adds a map of map of context objects to the event.
@param contexts map of map of contexts
@return the current {@code EventBuilder} for chained calls. | [
"Adds",
"a",
"map",
"of",
"map",
"of",
"context",
"objects",
"to",
"the",
"event",
"."
] | train | https://github.com/getsentry/sentry-java/blob/2e01461775cbd5951ff82b566069c349146d8aca/sentry/src/main/java/io/sentry/event/EventBuilder.java#L325-L328 |
Drivemode/TypefaceHelper | TypefaceHelper/src/main/java/com/drivemode/android/typeface/TypefaceHelper.java | TypefaceHelper.setTypeface | @TargetApi(Build.VERSION_CODES.HONEYCOMB)
public <F extends android.app.Fragment> void setTypeface(F fragment, String typefaceName, int style) {
View root = fragment.getView();
if (root instanceof TextView) {
setTypeface((TextView) root, typefaceName, style);
} else if (root instanceof ViewGroup) {
setTypeface((ViewGroup) root, typefaceName, style);
}
} | java | @TargetApi(Build.VERSION_CODES.HONEYCOMB)
public <F extends android.app.Fragment> void setTypeface(F fragment, String typefaceName, int style) {
View root = fragment.getView();
if (root instanceof TextView) {
setTypeface((TextView) root, typefaceName, style);
} else if (root instanceof ViewGroup) {
setTypeface((ViewGroup) root, typefaceName, style);
}
} | [
"@",
"TargetApi",
"(",
"Build",
".",
"VERSION_CODES",
".",
"HONEYCOMB",
")",
"public",
"<",
"F",
"extends",
"android",
".",
"app",
".",
"Fragment",
">",
"void",
"setTypeface",
"(",
"F",
"fragment",
",",
"String",
"typefaceName",
",",
"int",
"style",
")",
... | Set the typeface to the all text views belong to the fragment.
Make sure to call this method after fragment view creation.
If you use fragments in the support package,
call {@link com.drivemode.android.typeface.TypefaceHelper#supportSetTypeface(android.support.v4.app.Fragment, String, int)} instead.
@param fragment the fragment.
@param typefaceName typeface name.
@param style the typeface style. | [
"Set",
"the",
"typeface",
"to",
"the",
"all",
"text",
"views",
"belong",
"to",
"the",
"fragment",
".",
"Make",
"sure",
"to",
"call",
"this",
"method",
"after",
"fragment",
"view",
"creation",
".",
"If",
"you",
"use",
"fragments",
"in",
"the",
"support",
... | train | https://github.com/Drivemode/TypefaceHelper/blob/86bef9ce16b9626b7076559e846db1b9f043c008/TypefaceHelper/src/main/java/com/drivemode/android/typeface/TypefaceHelper.java#L386-L394 |
Azure/azure-sdk-for-java | automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/AgentRegistrationInformationsInner.java | AgentRegistrationInformationsInner.getAsync | public Observable<AgentRegistrationInner> getAsync(String resourceGroupName, String automationAccountName) {
return getWithServiceResponseAsync(resourceGroupName, automationAccountName).map(new Func1<ServiceResponse<AgentRegistrationInner>, AgentRegistrationInner>() {
@Override
public AgentRegistrationInner call(ServiceResponse<AgentRegistrationInner> response) {
return response.body();
}
});
} | java | public Observable<AgentRegistrationInner> getAsync(String resourceGroupName, String automationAccountName) {
return getWithServiceResponseAsync(resourceGroupName, automationAccountName).map(new Func1<ServiceResponse<AgentRegistrationInner>, AgentRegistrationInner>() {
@Override
public AgentRegistrationInner call(ServiceResponse<AgentRegistrationInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"AgentRegistrationInner",
">",
"getAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"automationAccountName",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"automationAccountName",
")",
".",
"map",
... | Retrieve the automation agent registration information.
@param resourceGroupName Name of an Azure Resource group.
@param automationAccountName The name of the automation account.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the AgentRegistrationInner object | [
"Retrieve",
"the",
"automation",
"agent",
"registration",
"information",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/AgentRegistrationInformationsInner.java#L103-L110 |
threerings/nenya | core/src/main/java/com/threerings/resource/ResourceManager.java | ResourceManager.createNetworkResourceBundle | protected ResourceBundle createNetworkResourceBundle (
String root, String path, Set<String> rsrcList)
{
return new NetworkResourceBundle(root, path, rsrcList);
} | java | protected ResourceBundle createNetworkResourceBundle (
String root, String path, Set<String> rsrcList)
{
return new NetworkResourceBundle(root, path, rsrcList);
} | [
"protected",
"ResourceBundle",
"createNetworkResourceBundle",
"(",
"String",
"root",
",",
"String",
"path",
",",
"Set",
"<",
"String",
">",
"rsrcList",
")",
"{",
"return",
"new",
"NetworkResourceBundle",
"(",
"root",
",",
"path",
",",
"rsrcList",
")",
";",
"}"... | Creates an appropriate bundle for fetching resources from the network. | [
"Creates",
"an",
"appropriate",
"bundle",
"for",
"fetching",
"resources",
"from",
"the",
"network",
"."
] | train | https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/resource/ResourceManager.java#L850-L854 |
plume-lib/options | src/main/java/org/plumelib/options/Options.java | Options.formatOptions | private String formatOptions(List<OptionInfo> optList, int maxLength, boolean showUnpublicized) {
StringJoiner buf = new StringJoiner(lineSeparator);
for (OptionInfo oi : optList) {
if (oi.unpublicized && !showUnpublicized) {
continue;
}
String defaultStr = "";
if (oi.defaultStr != null) {
defaultStr = String.format(" [default %s]", oi.defaultStr);
}
@SuppressWarnings("formatter") // format string computed from maxLength argument
String use =
String.format(" %-" + maxLength + "s - %s%s", oi.synopsis(), oi.description, defaultStr);
buf.add(use);
if (oi.list != null) {
hasListOption = true;
}
}
return buf.toString();
} | java | private String formatOptions(List<OptionInfo> optList, int maxLength, boolean showUnpublicized) {
StringJoiner buf = new StringJoiner(lineSeparator);
for (OptionInfo oi : optList) {
if (oi.unpublicized && !showUnpublicized) {
continue;
}
String defaultStr = "";
if (oi.defaultStr != null) {
defaultStr = String.format(" [default %s]", oi.defaultStr);
}
@SuppressWarnings("formatter") // format string computed from maxLength argument
String use =
String.format(" %-" + maxLength + "s - %s%s", oi.synopsis(), oi.description, defaultStr);
buf.add(use);
if (oi.list != null) {
hasListOption = true;
}
}
return buf.toString();
} | [
"private",
"String",
"formatOptions",
"(",
"List",
"<",
"OptionInfo",
">",
"optList",
",",
"int",
"maxLength",
",",
"boolean",
"showUnpublicized",
")",
"{",
"StringJoiner",
"buf",
"=",
"new",
"StringJoiner",
"(",
"lineSeparator",
")",
";",
"for",
"(",
"OptionI... | Format a list of options for use in generating usage messages. Also sets {@link #hasListOption}
if any option has list type.
@param optList the options to format
@param maxLength the maximum number of characters in the output
@param showUnpublicized if true, include unpublicized options in the output
@return the formatted options | [
"Format",
"a",
"list",
"of",
"options",
"for",
"use",
"in",
"generating",
"usage",
"messages",
".",
"Also",
"sets",
"{",
"@link",
"#hasListOption",
"}",
"if",
"any",
"option",
"has",
"list",
"type",
"."
] | train | https://github.com/plume-lib/options/blob/1bdd0ac7a1794bdf9dd373e279f69d43395154f0/src/main/java/org/plumelib/options/Options.java#L1199-L1220 |
fabric8io/ipaas-quickstarts | archetype-builder/src/main/java/io/fabric8/tooling/archetype/ArchetypeUtils.java | ArchetypeUtils.relativePath | public String relativePath(File base, File nested) throws IOException {
String basePath = base.getCanonicalPath();
String nestedPath = nested.getCanonicalPath();
if (nestedPath.equals(basePath)) {
return "";
} else if (nestedPath.startsWith(basePath)) {
return nestedPath.substring(basePath.length() + 1);
} else {
return nestedPath;
}
} | java | public String relativePath(File base, File nested) throws IOException {
String basePath = base.getCanonicalPath();
String nestedPath = nested.getCanonicalPath();
if (nestedPath.equals(basePath)) {
return "";
} else if (nestedPath.startsWith(basePath)) {
return nestedPath.substring(basePath.length() + 1);
} else {
return nestedPath;
}
} | [
"public",
"String",
"relativePath",
"(",
"File",
"base",
",",
"File",
"nested",
")",
"throws",
"IOException",
"{",
"String",
"basePath",
"=",
"base",
".",
"getCanonicalPath",
"(",
")",
";",
"String",
"nestedPath",
"=",
"nested",
".",
"getCanonicalPath",
"(",
... | Returns relative path (without leading '/') if <code>nested</code> is inside <code>base</code>.
Returns <code>nested</code> (as absolute path) otherwise.
@param base
@param nested
@return
@throws IOException | [
"Returns",
"relative",
"path",
"(",
"without",
"leading",
"/",
")",
"if",
"<code",
">",
"nested<",
"/",
"code",
">",
"is",
"inside",
"<code",
">",
"base<",
"/",
"code",
">",
".",
"Returns",
"<code",
">",
"nested<",
"/",
"code",
">",
"(",
"as",
"absol... | train | https://github.com/fabric8io/ipaas-quickstarts/blob/cf9a9aa09204a82ac996304ab8c96791f7e5db22/archetype-builder/src/main/java/io/fabric8/tooling/archetype/ArchetypeUtils.java#L87-L97 |
facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/lib/KeyFieldHelper.java | KeyFieldHelper.setKeyFieldSpec | public void setKeyFieldSpec(int start, int end) {
if (end >= start) {
KeyDescription k = new KeyDescription();
k.beginFieldIdx = start;
k.endFieldIdx = end;
keySpecSeen = true;
allKeySpecs.add(k);
}
} | java | public void setKeyFieldSpec(int start, int end) {
if (end >= start) {
KeyDescription k = new KeyDescription();
k.beginFieldIdx = start;
k.endFieldIdx = end;
keySpecSeen = true;
allKeySpecs.add(k);
}
} | [
"public",
"void",
"setKeyFieldSpec",
"(",
"int",
"start",
",",
"int",
"end",
")",
"{",
"if",
"(",
"end",
">=",
"start",
")",
"{",
"KeyDescription",
"k",
"=",
"new",
"KeyDescription",
"(",
")",
";",
"k",
".",
"beginFieldIdx",
"=",
"start",
";",
"k",
"... | Required for backcompatibility with num.key.fields.for.partition in
{@link KeyFieldBasedPartitioner} | [
"Required",
"for",
"backcompatibility",
"with",
"num",
".",
"key",
".",
"fields",
".",
"for",
".",
"partition",
"in",
"{"
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/lib/KeyFieldHelper.java#L75-L83 |
structr/structr | structr-core/src/main/java/org/structr/schema/action/Function.java | Function.assertArrayHasMinLengthAndAllElementsNotNull | protected void assertArrayHasMinLengthAndAllElementsNotNull(final Object[] array, final Integer minLength) throws ArgumentCountException, ArgumentNullException {
if (array.length < minLength) {
throw ArgumentCountException.tooFew(array.length, minLength);
}
for (final Object element : array) {
if (element == null) {
throw new ArgumentNullException();
}
}
} | java | protected void assertArrayHasMinLengthAndAllElementsNotNull(final Object[] array, final Integer minLength) throws ArgumentCountException, ArgumentNullException {
if (array.length < minLength) {
throw ArgumentCountException.tooFew(array.length, minLength);
}
for (final Object element : array) {
if (element == null) {
throw new ArgumentNullException();
}
}
} | [
"protected",
"void",
"assertArrayHasMinLengthAndAllElementsNotNull",
"(",
"final",
"Object",
"[",
"]",
"array",
",",
"final",
"Integer",
"minLength",
")",
"throws",
"ArgumentCountException",
",",
"ArgumentNullException",
"{",
"if",
"(",
"array",
".",
"length",
"<",
... | Test if the given object array has a minimum length and all its elements are not null.
@param array
@param minLength
@throws IllegalArgumentException in case of wrong number of parameters | [
"Test",
"if",
"the",
"given",
"object",
"array",
"has",
"a",
"minimum",
"length",
"and",
"all",
"its",
"elements",
"are",
"not",
"null",
"."
] | train | https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-core/src/main/java/org/structr/schema/action/Function.java#L124-L136 |
foundation-runtime/service-directory | 1.1/sd-core/src/main/java/com/cisco/oss/foundation/directory/utils/HttpUtils.java | HttpUtils.putJson | public static HttpResponse putJson(String urlStr, String body) throws IOException {
Map<String, String> headers = new HashMap<String, String>();
headers.put("Content-Type", "application/json");
return put(urlStr, body, headers);
} | java | public static HttpResponse putJson(String urlStr, String body) throws IOException {
Map<String, String> headers = new HashMap<String, String>();
headers.put("Content-Type", "application/json");
return put(urlStr, body, headers);
} | [
"public",
"static",
"HttpResponse",
"putJson",
"(",
"String",
"urlStr",
",",
"String",
"body",
")",
"throws",
"IOException",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"headers",
"=",
"new",
"HashMap",
"<",
"String",
",",
"String",
">",
"(",
")",
";"... | Invoke REST Service using PUT method.
@param urlStr
the REST Service URL String.
@param body
the Http Body String.
@return the HttpResponse.
@throws IOException | [
"Invoke",
"REST",
"Service",
"using",
"PUT",
"method",
"."
] | train | https://github.com/foundation-runtime/service-directory/blob/a7bdefe173dc99e75eff4a24e07e6407e62f2ed4/1.1/sd-core/src/main/java/com/cisco/oss/foundation/directory/utils/HttpUtils.java#L93-L97 |
SvenEwald/xmlbeam | src/main/java/org/xmlbeam/util/IOHelper.java | IOHelper.httpPost | @SuppressWarnings("resource")
public static InputStream httpPost(final String httpurl, final String data, final Map<String, String>... requestProperties) throws IOException {
byte[] bytes = data.getBytes("utf-8");
java.net.URL url = new java.net.URL(httpurl);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setDoInput(true);
connection.setDoOutput(true);
connection.setRequestMethod("POST");
connection.setRequestProperty("charset", "utf-8");
connection.setRequestProperty("Content-Length", Integer.toString(bytes.length));
for (Map<String, String> props : requestProperties) {
addRequestProperties(props, connection);
}
OutputStream outputStream = connection.getOutputStream();
outputStream.write(bytes);
outputStream.flush();
return connection.getInputStream();
} | java | @SuppressWarnings("resource")
public static InputStream httpPost(final String httpurl, final String data, final Map<String, String>... requestProperties) throws IOException {
byte[] bytes = data.getBytes("utf-8");
java.net.URL url = new java.net.URL(httpurl);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setDoInput(true);
connection.setDoOutput(true);
connection.setRequestMethod("POST");
connection.setRequestProperty("charset", "utf-8");
connection.setRequestProperty("Content-Length", Integer.toString(bytes.length));
for (Map<String, String> props : requestProperties) {
addRequestProperties(props, connection);
}
OutputStream outputStream = connection.getOutputStream();
outputStream.write(bytes);
outputStream.flush();
return connection.getInputStream();
} | [
"@",
"SuppressWarnings",
"(",
"\"resource\"",
")",
"public",
"static",
"InputStream",
"httpPost",
"(",
"final",
"String",
"httpurl",
",",
"final",
"String",
"data",
",",
"final",
"Map",
"<",
"String",
",",
"String",
">",
"...",
"requestProperties",
")",
"throw... | Simple http post implementation. Supports HTTP Basic authentication via request properties.
You may want to use {@link #createBasicAuthenticationProperty} to add authentication.
@param httpurl
target url
@param data
String with content to post
@param requestProperties
optional http header fields (key->value)
@return input stream of response
@throws IOException | [
"Simple",
"http",
"post",
"implementation",
".",
"Supports",
"HTTP",
"Basic",
"authentication",
"via",
"request",
"properties",
".",
"You",
"may",
"want",
"to",
"use",
"{",
"@link",
"#createBasicAuthenticationProperty",
"}",
"to",
"add",
"authentication",
"."
] | train | https://github.com/SvenEwald/xmlbeam/blob/acaac1b8fa28d246f17187f5e3c6696458a0b447/src/main/java/org/xmlbeam/util/IOHelper.java#L118-L135 |
netty/netty | buffer/src/main/java/io/netty/buffer/ByteBufUtil.java | ByteBufUtil.encodeString | public static ByteBuf encodeString(ByteBufAllocator alloc, CharBuffer src, Charset charset, int extraCapacity) {
return encodeString0(alloc, false, src, charset, extraCapacity);
} | java | public static ByteBuf encodeString(ByteBufAllocator alloc, CharBuffer src, Charset charset, int extraCapacity) {
return encodeString0(alloc, false, src, charset, extraCapacity);
} | [
"public",
"static",
"ByteBuf",
"encodeString",
"(",
"ByteBufAllocator",
"alloc",
",",
"CharBuffer",
"src",
",",
"Charset",
"charset",
",",
"int",
"extraCapacity",
")",
"{",
"return",
"encodeString0",
"(",
"alloc",
",",
"false",
",",
"src",
",",
"charset",
",",... | Encode the given {@link CharBuffer} using the given {@link Charset} into a new {@link ByteBuf} which
is allocated via the {@link ByteBufAllocator}.
@param alloc The {@link ByteBufAllocator} to allocate {@link ByteBuf}.
@param src The {@link CharBuffer} to encode.
@param charset The specified {@link Charset}.
@param extraCapacity the extra capacity to alloc except the space for decoding. | [
"Encode",
"the",
"given",
"{",
"@link",
"CharBuffer",
"}",
"using",
"the",
"given",
"{",
"@link",
"Charset",
"}",
"into",
"a",
"new",
"{",
"@link",
"ByteBuf",
"}",
"which",
"is",
"allocated",
"via",
"the",
"{",
"@link",
"ByteBufAllocator",
"}",
"."
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/buffer/src/main/java/io/netty/buffer/ByteBufUtil.java#L739-L741 |
googleads/googleads-java-lib | examples/admanager_axis/src/main/java/admanager/axis/v201902/contentservice/GetAllContent.java | GetAllContent.runExample | public static void runExample(AdManagerServices adManagerServices, AdManagerSession session)
throws RemoteException {
// Get the ContentService.
ContentServiceInterface contentService =
adManagerServices.get(session, ContentServiceInterface.class);
// Create a statement to get all content.
StatementBuilder statementBuilder =
new StatementBuilder().orderBy("id ASC").limit(StatementBuilder.SUGGESTED_PAGE_LIMIT);
// Default for total result set size.
int totalResultSetSize = 0;
do {
// Get content by statement.
ContentPage page = contentService.getContentByStatement(statementBuilder.toStatement());
if (page.getResults() != null) {
totalResultSetSize = page.getTotalResultSetSize();
int i = page.getStartIndex();
for (Content content : page.getResults()) {
System.out.printf(
"%d) Content with ID %d and name '%s' was found.%n",
i++, content.getId(), content.getName());
}
}
statementBuilder.increaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT);
} while (statementBuilder.getOffset() < totalResultSetSize);
System.out.printf("Number of results found: %d%n", totalResultSetSize);
} | java | public static void runExample(AdManagerServices adManagerServices, AdManagerSession session)
throws RemoteException {
// Get the ContentService.
ContentServiceInterface contentService =
adManagerServices.get(session, ContentServiceInterface.class);
// Create a statement to get all content.
StatementBuilder statementBuilder =
new StatementBuilder().orderBy("id ASC").limit(StatementBuilder.SUGGESTED_PAGE_LIMIT);
// Default for total result set size.
int totalResultSetSize = 0;
do {
// Get content by statement.
ContentPage page = contentService.getContentByStatement(statementBuilder.toStatement());
if (page.getResults() != null) {
totalResultSetSize = page.getTotalResultSetSize();
int i = page.getStartIndex();
for (Content content : page.getResults()) {
System.out.printf(
"%d) Content with ID %d and name '%s' was found.%n",
i++, content.getId(), content.getName());
}
}
statementBuilder.increaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT);
} while (statementBuilder.getOffset() < totalResultSetSize);
System.out.printf("Number of results found: %d%n", totalResultSetSize);
} | [
"public",
"static",
"void",
"runExample",
"(",
"AdManagerServices",
"adManagerServices",
",",
"AdManagerSession",
"session",
")",
"throws",
"RemoteException",
"{",
"// Get the ContentService.",
"ContentServiceInterface",
"contentService",
"=",
"adManagerServices",
".",
"get",... | Runs the example.
@param adManagerServices the services factory.
@param session the session.
@throws ApiException if the API request failed with one or more service errors.
@throws RemoteException if the API request failed due to other errors. | [
"Runs",
"the",
"example",
"."
] | train | https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/examples/admanager_axis/src/main/java/admanager/axis/v201902/contentservice/GetAllContent.java#L51-L82 |
google/closure-templates | java/src/com/google/template/soy/error/SoyErrors.java | SoyErrors.getDidYouMeanMessageForProtoFields | public static String getDidYouMeanMessageForProtoFields(
ImmutableSet<String> fields, Descriptor descriptor, String fieldName) {
// TODO(b/27616446): when we have case enum support add a case here.
if (fields.contains(fieldName + "List")) {
return String.format(" Did you mean '%sList'?", fieldName);
} else if (fields.contains(fieldName + "Map")) {
return String.format(" Did you mean '%sMap'?", fieldName);
} else {
return getDidYouMeanMessage(fields, fieldName);
}
} | java | public static String getDidYouMeanMessageForProtoFields(
ImmutableSet<String> fields, Descriptor descriptor, String fieldName) {
// TODO(b/27616446): when we have case enum support add a case here.
if (fields.contains(fieldName + "List")) {
return String.format(" Did you mean '%sList'?", fieldName);
} else if (fields.contains(fieldName + "Map")) {
return String.format(" Did you mean '%sMap'?", fieldName);
} else {
return getDidYouMeanMessage(fields, fieldName);
}
} | [
"public",
"static",
"String",
"getDidYouMeanMessageForProtoFields",
"(",
"ImmutableSet",
"<",
"String",
">",
"fields",
",",
"Descriptor",
"descriptor",
",",
"String",
"fieldName",
")",
"{",
"// TODO(b/27616446): when we have case enum support add a case here.",
"if",
"(",
"... | Same as {@link #getDidYouMeanMessage(Iterable, String)} but with some additional heuristics for
proto fields. | [
"Same",
"as",
"{"
] | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/error/SoyErrors.java#L49-L59 |
amaembo/streamex | src/main/java/one/util/streamex/StreamEx.java | StreamEx.ofSubLists | public static <T> StreamEx<List<T>> ofSubLists(List<T> source, int length) {
return ofSubLists(source, length, length);
} | java | public static <T> StreamEx<List<T>> ofSubLists(List<T> source, int length) {
return ofSubLists(source, length, length);
} | [
"public",
"static",
"<",
"T",
">",
"StreamEx",
"<",
"List",
"<",
"T",
">",
">",
"ofSubLists",
"(",
"List",
"<",
"T",
">",
"source",
",",
"int",
"length",
")",
"{",
"return",
"ofSubLists",
"(",
"source",
",",
"length",
",",
"length",
")",
";",
"}"
] | Returns a new {@code StreamEx} which consists of non-overlapping sublists
of given source list having the specified length (the last sublist may be
shorter).
<p>
This method calls {@link List#subList(int, int)} internally, so source
list must have it properly implemented as well as provide fast random
access.
<p>
This method is equivalent to
{@code StreamEx.ofSubLists(source, length, length)}.
@param <T> the type of source list elements.
@param source the source list
@param length the length of each sublist except possibly the last one
(must be positive number).
@return the new stream of sublists.
@throws IllegalArgumentException if length is negative or zero.
@since 0.3.3
@see #ofSubLists(List, int, int)
@see List#subList(int, int) | [
"Returns",
"a",
"new",
"{",
"@code",
"StreamEx",
"}",
"which",
"consists",
"of",
"non",
"-",
"overlapping",
"sublists",
"of",
"given",
"source",
"list",
"having",
"the",
"specified",
"length",
"(",
"the",
"last",
"sublist",
"may",
"be",
"shorter",
")",
"."... | train | https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/StreamEx.java#L3022-L3024 |
visallo/vertexium | elasticsearch5/src/main/java/org/vertexium/elasticsearch5/utils/Murmur3.java | Murmur3.hash32 | public static int hash32(byte[] data, int length, int seed) {
int hash = seed;
final int nblocks = length >> 2;
// body
for (int i = 0; i < nblocks; i++) {
int i_4 = i << 2;
int k = (data[i_4] & 0xff)
| ((data[i_4 + 1] & 0xff) << 8)
| ((data[i_4 + 2] & 0xff) << 16)
| ((data[i_4 + 3] & 0xff) << 24);
// mix functions
k *= C1_32;
k = Integer.rotateLeft(k, R1_32);
k *= C2_32;
hash ^= k;
hash = Integer.rotateLeft(hash, R2_32) * M_32 + N_32;
}
// tail
int idx = nblocks << 2;
int k1 = 0;
switch (length - idx) {
case 3:
k1 ^= data[idx + 2] << 16;
case 2:
k1 ^= data[idx + 1] << 8;
case 1:
k1 ^= data[idx];
// mix functions
k1 *= C1_32;
k1 = Integer.rotateLeft(k1, R1_32);
k1 *= C2_32;
hash ^= k1;
}
// finalization
hash ^= length;
hash ^= (hash >>> 16);
hash *= 0x85ebca6b;
hash ^= (hash >>> 13);
hash *= 0xc2b2ae35;
hash ^= (hash >>> 16);
return hash;
} | java | public static int hash32(byte[] data, int length, int seed) {
int hash = seed;
final int nblocks = length >> 2;
// body
for (int i = 0; i < nblocks; i++) {
int i_4 = i << 2;
int k = (data[i_4] & 0xff)
| ((data[i_4 + 1] & 0xff) << 8)
| ((data[i_4 + 2] & 0xff) << 16)
| ((data[i_4 + 3] & 0xff) << 24);
// mix functions
k *= C1_32;
k = Integer.rotateLeft(k, R1_32);
k *= C2_32;
hash ^= k;
hash = Integer.rotateLeft(hash, R2_32) * M_32 + N_32;
}
// tail
int idx = nblocks << 2;
int k1 = 0;
switch (length - idx) {
case 3:
k1 ^= data[idx + 2] << 16;
case 2:
k1 ^= data[idx + 1] << 8;
case 1:
k1 ^= data[idx];
// mix functions
k1 *= C1_32;
k1 = Integer.rotateLeft(k1, R1_32);
k1 *= C2_32;
hash ^= k1;
}
// finalization
hash ^= length;
hash ^= (hash >>> 16);
hash *= 0x85ebca6b;
hash ^= (hash >>> 13);
hash *= 0xc2b2ae35;
hash ^= (hash >>> 16);
return hash;
} | [
"public",
"static",
"int",
"hash32",
"(",
"byte",
"[",
"]",
"data",
",",
"int",
"length",
",",
"int",
"seed",
")",
"{",
"int",
"hash",
"=",
"seed",
";",
"final",
"int",
"nblocks",
"=",
"length",
">>",
"2",
";",
"// body",
"for",
"(",
"int",
"i",
... | Murmur3 32-bit variant.
@param data - input byte array
@param length - length of array
@param seed - seed. (default 0)
@return - hashcode | [
"Murmur3",
"32",
"-",
"bit",
"variant",
"."
] | train | https://github.com/visallo/vertexium/blob/bb132b5425ac168957667164e1409b78adbea769/elasticsearch5/src/main/java/org/vertexium/elasticsearch5/utils/Murmur3.java#L59-L106 |
dihedron/dihedron-commons | src/main/java/org/dihedron/patterns/activities/TypedVector.java | TypedVector.indexOf | @Override
public int indexOf(Object o, int index) {
int idx = getRealIndex(index);
return super.indexOf(o, idx);
} | java | @Override
public int indexOf(Object o, int index) {
int idx = getRealIndex(index);
return super.indexOf(o, idx);
} | [
"@",
"Override",
"public",
"int",
"indexOf",
"(",
"Object",
"o",
",",
"int",
"index",
")",
"{",
"int",
"idx",
"=",
"getRealIndex",
"(",
"index",
")",
";",
"return",
"super",
".",
"indexOf",
"(",
"o",
",",
"idx",
")",
";",
"}"
] | Returns the index of the first occurrence of the specified element in
this vector, searching forwards from index, or returns -1 if the element
is not found.
@param o
the object to look for.
@param index
the index from which to start the lookup; it can be a positive number,
or a negative number that is smaller than the size of the vector; see
{@link #getRealIndex(int)}.
@see java.util.Vector#indexOf(java.lang.Object, int) | [
"Returns",
"the",
"index",
"of",
"the",
"first",
"occurrence",
"of",
"the",
"specified",
"element",
"in",
"this",
"vector",
"searching",
"forwards",
"from",
"index",
"or",
"returns",
"-",
"1",
"if",
"the",
"element",
"is",
"not",
"found",
"."
] | train | https://github.com/dihedron/dihedron-commons/blob/a5194cdaa0d6417ef4aade6ea407a1cad6e8458e/src/main/java/org/dihedron/patterns/activities/TypedVector.java#L150-L154 |
nguillaumin/slick2d-maven | slick2d-core/src/main/java/org/newdawn/slick/geom/RoundedRectangle.java | RoundedRectangle.createPoints | private List createPoints(int numberOfSegments, float radius, float cx, float cy, float start, float end) {
ArrayList tempPoints = new ArrayList();
int step = 360 / numberOfSegments;
for (float a=start;a<=end+step;a+=step) {
float ang = a;
if (ang > end) {
ang = end;
}
float x = (float) (cx + (FastTrig.cos(Math.toRadians(ang)) * radius));
float y = (float) (cy + (FastTrig.sin(Math.toRadians(ang)) * radius));
tempPoints.add(new Float(x));
tempPoints.add(new Float(y));
}
return tempPoints;
} | java | private List createPoints(int numberOfSegments, float radius, float cx, float cy, float start, float end) {
ArrayList tempPoints = new ArrayList();
int step = 360 / numberOfSegments;
for (float a=start;a<=end+step;a+=step) {
float ang = a;
if (ang > end) {
ang = end;
}
float x = (float) (cx + (FastTrig.cos(Math.toRadians(ang)) * radius));
float y = (float) (cy + (FastTrig.sin(Math.toRadians(ang)) * radius));
tempPoints.add(new Float(x));
tempPoints.add(new Float(y));
}
return tempPoints;
} | [
"private",
"List",
"createPoints",
"(",
"int",
"numberOfSegments",
",",
"float",
"radius",
",",
"float",
"cx",
",",
"float",
"cy",
",",
"float",
"start",
",",
"float",
"end",
")",
"{",
"ArrayList",
"tempPoints",
"=",
"new",
"ArrayList",
"(",
")",
";",
"i... | Generate the points to fill a corner arc.
@param numberOfSegments How fine to make the ellipse.
@param radius The radius of the arc.
@param cx The x center of the arc.
@param cy The y center of the arc.
@param start The start angle of the arc.
@param end The end angle of the arc.
@return The points created. | [
"Generate",
"the",
"points",
"to",
"fill",
"a",
"corner",
"arc",
"."
] | train | https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/geom/RoundedRectangle.java#L245-L263 |
netty/netty-tcnative | openssl-dynamic/src/main/java/io/netty/internal/tcnative/SSLContext.java | SSLContext.setCipherSuite | @Deprecated
public static boolean setCipherSuite(long ctx, String ciphers) throws Exception {
return setCipherSuite(ctx, ciphers, false);
} | java | @Deprecated
public static boolean setCipherSuite(long ctx, String ciphers) throws Exception {
return setCipherSuite(ctx, ciphers, false);
} | [
"@",
"Deprecated",
"public",
"static",
"boolean",
"setCipherSuite",
"(",
"long",
"ctx",
",",
"String",
"ciphers",
")",
"throws",
"Exception",
"{",
"return",
"setCipherSuite",
"(",
"ctx",
",",
"ciphers",
",",
"false",
")",
";",
"}"
] | Cipher Suite available for negotiation in SSL handshake.
<br>
This complex directive uses a colon-separated cipher-spec string consisting
of OpenSSL cipher specifications to configure the Cipher Suite the client
is permitted to negotiate in the SSL handshake phase. Notice that this
directive can be used both in per-server and per-directory context.
In per-server context it applies to the standard SSL handshake when a
connection is established. In per-directory context it forces a SSL
renegotiation with the reconfigured Cipher Suite after the HTTP request
was read but before the HTTP response is sent.
@param ctx Server or Client context to use.
@param ciphers An SSL cipher specification.
@return {@code true} if successful
@throws Exception if an error happened
@deprecated Use {@link #setCipherSuite(long, String, boolean)}. | [
"Cipher",
"Suite",
"available",
"for",
"negotiation",
"in",
"SSL",
"handshake",
".",
"<br",
">",
"This",
"complex",
"directive",
"uses",
"a",
"colon",
"-",
"separated",
"cipher",
"-",
"spec",
"string",
"consisting",
"of",
"OpenSSL",
"cipher",
"specifications",
... | train | https://github.com/netty/netty-tcnative/blob/4a5d7330c6c36cff2bebbb465571cab1cf7a4063/openssl-dynamic/src/main/java/io/netty/internal/tcnative/SSLContext.java#L115-L118 |
jenkinsci/jenkins | core/src/main/java/hudson/util/NoClientBindProtocolSocketFactory.java | NoClientBindProtocolSocketFactory.createSocket | public Socket createSocket(String host, int port, InetAddress localAddress,
int localPort, HttpConnectionParams params) throws IOException,
UnknownHostException, ConnectTimeoutException {
if (params == null) {
throw new IllegalArgumentException("Parameters may not be null");
}
int timeout = params.getConnectionTimeout();
if (timeout == 0) {
// ignore the local address/port for binding
return createSocket(host, port);
} else {
Socket s=new Socket();
s.connect(new InetSocketAddress(host,port),timeout);
return s;
}
} | java | public Socket createSocket(String host, int port, InetAddress localAddress,
int localPort, HttpConnectionParams params) throws IOException,
UnknownHostException, ConnectTimeoutException {
if (params == null) {
throw new IllegalArgumentException("Parameters may not be null");
}
int timeout = params.getConnectionTimeout();
if (timeout == 0) {
// ignore the local address/port for binding
return createSocket(host, port);
} else {
Socket s=new Socket();
s.connect(new InetSocketAddress(host,port),timeout);
return s;
}
} | [
"public",
"Socket",
"createSocket",
"(",
"String",
"host",
",",
"int",
"port",
",",
"InetAddress",
"localAddress",
",",
"int",
"localPort",
",",
"HttpConnectionParams",
"params",
")",
"throws",
"IOException",
",",
"UnknownHostException",
",",
"ConnectTimeoutException"... | Attempts to get a new socket connection to the given host within the given time limit.
<p>
This method employs several techniques to circumvent the limitations of older JREs that
do not support connect timeout. When running in JRE 1.4 or above reflection is used to
call Socket#connect(SocketAddress endpoint, int timeout) method. When executing in older
JREs a controller thread is executed. The controller thread attempts to create a new socket
within the given limit of time. If socket constructor does not return until the timeout
expires, the controller terminates and throws an {@link ConnectTimeoutException}
</p>
@param host the host name/IP
@param port the port on the host
@param localAddress the local host name/IP to bind the socket to, ignored
@param localPort the port on the local machine, ignored
@param params {@link HttpConnectionParams Http connection parameters}
@return Socket a new socket
@throws IOException if an I/O error occurs while creating the socket
@throws UnknownHostException if the IP address of the host cannot be
determined
@throws ConnectTimeoutException if socket cannot be connected within the
given time limit
@since 3.0 | [
"Attempts",
"to",
"get",
"a",
"new",
"socket",
"connection",
"to",
"the",
"given",
"host",
"within",
"the",
"given",
"time",
"limit",
".",
"<p",
">",
"This",
"method",
"employs",
"several",
"techniques",
"to",
"circumvent",
"the",
"limitations",
"of",
"older... | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/util/NoClientBindProtocolSocketFactory.java#L81-L96 |
Azure/azure-sdk-for-java | redis/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/redis/v2018_03_01/implementation/PatchSchedulesInner.java | PatchSchedulesInner.createOrUpdate | public RedisPatchScheduleInner createOrUpdate(String resourceGroupName, String name, List<ScheduleEntry> scheduleEntries) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, name, scheduleEntries).toBlocking().single().body();
} | java | public RedisPatchScheduleInner createOrUpdate(String resourceGroupName, String name, List<ScheduleEntry> scheduleEntries) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, name, scheduleEntries).toBlocking().single().body();
} | [
"public",
"RedisPatchScheduleInner",
"createOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"name",
",",
"List",
"<",
"ScheduleEntry",
">",
"scheduleEntries",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"name"... | Create or replace the patching schedule for Redis cache (requires Premium SKU).
@param resourceGroupName The name of the resource group.
@param name The name of the Redis cache.
@param scheduleEntries List of patch schedules for a Redis cache.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the RedisPatchScheduleInner object if successful. | [
"Create",
"or",
"replace",
"the",
"patching",
"schedule",
"for",
"Redis",
"cache",
"(",
"requires",
"Premium",
"SKU",
")",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/redis/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/redis/v2018_03_01/implementation/PatchSchedulesInner.java#L222-L224 |
calrissian/mango | mango-core/src/main/java/org/calrissian/mango/io/Serializables.java | Serializables.fromBase64 | public static <T extends Serializable>T fromBase64(byte[] bytes) throws IOException, ClassNotFoundException {
return fromBase64(bytes, false);
} | java | public static <T extends Serializable>T fromBase64(byte[] bytes) throws IOException, ClassNotFoundException {
return fromBase64(bytes, false);
} | [
"public",
"static",
"<",
"T",
"extends",
"Serializable",
">",
"T",
"fromBase64",
"(",
"byte",
"[",
"]",
"bytes",
")",
"throws",
"IOException",
",",
"ClassNotFoundException",
"{",
"return",
"fromBase64",
"(",
"bytes",
",",
"false",
")",
";",
"}"
] | Utility for returning a Serializable object from a byte array. Only use this method if the data was originally
serialized using the {@link Serializables#toBase64(Serializable)} method. | [
"Utility",
"for",
"returning",
"a",
"Serializable",
"object",
"from",
"a",
"byte",
"array",
".",
"Only",
"use",
"this",
"method",
"if",
"the",
"data",
"was",
"originally",
"serialized",
"using",
"the",
"{"
] | train | https://github.com/calrissian/mango/blob/a95aa5e77af9aa0e629787228d80806560023452/mango-core/src/main/java/org/calrissian/mango/io/Serializables.java#L94-L96 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/AddressInfo.java | AddressInfo.of | public static AddressInfo of(RegionId regionId, String name) {
return of(RegionAddressId.of(regionId, name));
} | java | public static AddressInfo of(RegionId regionId, String name) {
return of(RegionAddressId.of(regionId, name));
} | [
"public",
"static",
"AddressInfo",
"of",
"(",
"RegionId",
"regionId",
",",
"String",
"name",
")",
"{",
"return",
"of",
"(",
"RegionAddressId",
".",
"of",
"(",
"regionId",
",",
"name",
")",
")",
";",
"}"
] | Returns an {@code AddressInfo} object for the provided region identity and name. The object
corresponds to a region address. | [
"Returns",
"an",
"{"
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/AddressInfo.java#L533-L535 |
Mozu/mozu-java | mozu-java-core/src/main/java/com/mozu/api/urls/platform/entitylists/ListViewUrl.java | ListViewUrl.getEntityListViewsUrl | public static MozuUrl getEntityListViewsUrl(String entityListFullName, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/platform/entitylists/{entityListFullName}/views?responseFields={responseFields}");
formatter.formatUrl("entityListFullName", entityListFullName);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java | public static MozuUrl getEntityListViewsUrl(String entityListFullName, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/platform/entitylists/{entityListFullName}/views?responseFields={responseFields}");
formatter.formatUrl("entityListFullName", entityListFullName);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | [
"public",
"static",
"MozuUrl",
"getEntityListViewsUrl",
"(",
"String",
"entityListFullName",
",",
"String",
"responseFields",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
"(",
"\"/api/platform/entitylists/{entityListFullName}/views?responseFields={responseFi... | Get Resource Url for GetEntityListViews
@param entityListFullName The full name of the EntityList including namespace in name@nameSpace format
@param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss.
@return String Resource Url | [
"Get",
"Resource",
"Url",
"for",
"GetEntityListViews"
] | train | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/platform/entitylists/ListViewUrl.java#L118-L124 |
crnk-project/crnk-framework | crnk-data/crnk-data-jpa/src/main/java/io/crnk/data/jpa/internal/query/AnyUtils.java | AnyUtils.findAttribute | public static MetaAttribute findAttribute(MetaDataObject meta, Object value) {
if (value == null) {
throw new IllegalArgumentException("null as value not supported");
}
for (MetaAttribute attr : meta.getAttributes()) {
if (attr.getName().equals(TYPE_ATTRIBUTE)) {
continue;
}
if (attr.isDerived()) {
// we only consider persisted classes, not derived ones like
// "value" itself
continue;
}
if (attr.getType().getImplementationClass().isAssignableFrom(value.getClass())) {
return attr;
}
}
throw new IllegalArgumentException("cannot find anyType attribute for value '" + value + '\'');
} | java | public static MetaAttribute findAttribute(MetaDataObject meta, Object value) {
if (value == null) {
throw new IllegalArgumentException("null as value not supported");
}
for (MetaAttribute attr : meta.getAttributes()) {
if (attr.getName().equals(TYPE_ATTRIBUTE)) {
continue;
}
if (attr.isDerived()) {
// we only consider persisted classes, not derived ones like
// "value" itself
continue;
}
if (attr.getType().getImplementationClass().isAssignableFrom(value.getClass())) {
return attr;
}
}
throw new IllegalArgumentException("cannot find anyType attribute for value '" + value + '\'');
} | [
"public",
"static",
"MetaAttribute",
"findAttribute",
"(",
"MetaDataObject",
"meta",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"null as value not supported\"",
")",
";",
"}",
... | Finds a matching attribute for a given value.
@param meta the metadataobject
@param value the value
@return the attribute which will accept the given value | [
"Finds",
"a",
"matching",
"attribute",
"for",
"a",
"given",
"value",
"."
] | train | https://github.com/crnk-project/crnk-framework/blob/2fd3ef9a991788d46fd2e83b43c8ea37cbaf8681/crnk-data/crnk-data-jpa/src/main/java/io/crnk/data/jpa/internal/query/AnyUtils.java#L54-L73 |
versionone/VersionOne.SDK.Java.ObjectModel | src/main/java/com/versionone/om/Project.java | Project.createRetrospective | public Retrospective createRetrospective(String name, Map<String, Object> attributes) {
return getInstance().create().retrospective(name, this, attributes);
} | java | public Retrospective createRetrospective(String name, Map<String, Object> attributes) {
return getInstance().create().retrospective(name, this, attributes);
} | [
"public",
"Retrospective",
"createRetrospective",
"(",
"String",
"name",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"attributes",
")",
"{",
"return",
"getInstance",
"(",
")",
".",
"create",
"(",
")",
".",
"retrospective",
"(",
"name",
",",
"this",
",",... | Create a new Retrospective in this Project.
@param name The initial name of the Retrospective.
@param attributes additional attributes for Retrospective.
@return A new Retrospective. | [
"Create",
"a",
"new",
"Retrospective",
"in",
"this",
"Project",
"."
] | train | https://github.com/versionone/VersionOne.SDK.Java.ObjectModel/blob/59d35b67c849299631bca45ee94143237eb2ae1a/src/main/java/com/versionone/om/Project.java#L335-L337 |
ibm-bluemix-mobile-services/bms-clientsdk-android-push | lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/push/api/MFPPush.java | MFPPush.setNotificationOptions | private void setNotificationOptions(Context context,MFPPushNotificationOptions options) {
if (this.appContext == null) {
this.appContext = context.getApplicationContext();
}
this.options = options;
Gson gson = new Gson();
String json = gson.toJson(options);
SharedPreferences sharedPreferences = appContext.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE);
MFPPushUtils.storeContentInSharedPreferences(sharedPreferences, MFPPush.PREFS_MESSAGES_OPTIONS, json);
} | java | private void setNotificationOptions(Context context,MFPPushNotificationOptions options) {
if (this.appContext == null) {
this.appContext = context.getApplicationContext();
}
this.options = options;
Gson gson = new Gson();
String json = gson.toJson(options);
SharedPreferences sharedPreferences = appContext.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE);
MFPPushUtils.storeContentInSharedPreferences(sharedPreferences, MFPPush.PREFS_MESSAGES_OPTIONS, json);
} | [
"private",
"void",
"setNotificationOptions",
"(",
"Context",
"context",
",",
"MFPPushNotificationOptions",
"options",
")",
"{",
"if",
"(",
"this",
".",
"appContext",
"==",
"null",
")",
"{",
"this",
".",
"appContext",
"=",
"context",
".",
"getApplicationContext",
... | Set the default push notification options for notifications.
@param context - this is the Context of the application from getApplicationContext()
@param options - The MFPPushNotificationOptions with the default parameters | [
"Set",
"the",
"default",
"push",
"notification",
"options",
"for",
"notifications",
"."
] | train | https://github.com/ibm-bluemix-mobile-services/bms-clientsdk-android-push/blob/26c048637e81a6942004693919558f3d9aa8c674/lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/push/api/MFPPush.java#L656-L666 |
UrielCh/ovh-java-sdk | ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java | ApiOvhDedicatedserver.serviceName_networkInterfaceController_GET | public ArrayList<String> serviceName_networkInterfaceController_GET(String serviceName, OvhNetworkInterfaceControllerLinkTypeEnum linkType) throws IOException {
String qPath = "/dedicated/server/{serviceName}/networkInterfaceController";
StringBuilder sb = path(qPath, serviceName);
query(sb, "linkType", linkType);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t1);
} | java | public ArrayList<String> serviceName_networkInterfaceController_GET(String serviceName, OvhNetworkInterfaceControllerLinkTypeEnum linkType) throws IOException {
String qPath = "/dedicated/server/{serviceName}/networkInterfaceController";
StringBuilder sb = path(qPath, serviceName);
query(sb, "linkType", linkType);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t1);
} | [
"public",
"ArrayList",
"<",
"String",
">",
"serviceName_networkInterfaceController_GET",
"(",
"String",
"serviceName",
",",
"OvhNetworkInterfaceControllerLinkTypeEnum",
"linkType",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/dedicated/server/{serviceName}/net... | List server networkInterfaceController
REST: GET /dedicated/server/{serviceName}/networkInterfaceController
@param linkType [required] Filter the value of linkType property (=)
@param serviceName [required] The internal name of your dedicated server
API beta | [
"List",
"server",
"networkInterfaceController"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java#L449-L455 |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpClient.java | SftpClient.getFiles | public SftpFile[] getFiles(String remote, FileTransferProgress progress,
boolean resume) throws FileNotFoundException, SftpStatusException,
SshException, TransferCancelledException {
return getFiles(remote, lcwd, progress, resume);
} | java | public SftpFile[] getFiles(String remote, FileTransferProgress progress,
boolean resume) throws FileNotFoundException, SftpStatusException,
SshException, TransferCancelledException {
return getFiles(remote, lcwd, progress, resume);
} | [
"public",
"SftpFile",
"[",
"]",
"getFiles",
"(",
"String",
"remote",
",",
"FileTransferProgress",
"progress",
",",
"boolean",
"resume",
")",
"throws",
"FileNotFoundException",
",",
"SftpStatusException",
",",
"SshException",
",",
"TransferCancelledException",
"{",
"re... | <p>
Download the remote files to the local computer.
</p>
@param remote
the regular expression path to the remote file
@param progress
@param resume
attempt to resume a interrupted download
@return SftpFile[]
@throws FileNotFoundException
@throws SftpStatusException
@throws SshException
@throws TransferCancelledException | [
"<p",
">",
"Download",
"the",
"remote",
"files",
"to",
"the",
"local",
"computer",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpClient.java#L2888-L2892 |
opencb/datastore | datastore-hbase/src/main/java/org/opencb/datastore/hbase/HBaseNativeQuery.java | HBaseNativeQuery.find | public Result find(String rowKey, List<String> returnFields, QueryOptions options) throws IOException {
Get get = new Get(rowKey.getBytes());
if (returnFields != null) {
for (String field : returnFields) {
String[] parts = field.split(":");
get.addColumn(parts[0].getBytes(), parts[1].getBytes());
}
} else {
getReturnFields(get, options);
}
int maxVersions = (options != null) ? options.getInt("maxVersions", 0) : 0;
if (maxVersions > 0) {
get.setMaxVersions(maxVersions);
}
return table.get(get);
} | java | public Result find(String rowKey, List<String> returnFields, QueryOptions options) throws IOException {
Get get = new Get(rowKey.getBytes());
if (returnFields != null) {
for (String field : returnFields) {
String[] parts = field.split(":");
get.addColumn(parts[0].getBytes(), parts[1].getBytes());
}
} else {
getReturnFields(get, options);
}
int maxVersions = (options != null) ? options.getInt("maxVersions", 0) : 0;
if (maxVersions > 0) {
get.setMaxVersions(maxVersions);
}
return table.get(get);
} | [
"public",
"Result",
"find",
"(",
"String",
"rowKey",
",",
"List",
"<",
"String",
">",
"returnFields",
",",
"QueryOptions",
"options",
")",
"throws",
"IOException",
"{",
"Get",
"get",
"=",
"new",
"Get",
"(",
"rowKey",
".",
"getBytes",
"(",
")",
")",
";",
... | Returns the result from a query to a single row, performed using a Get
object from HBase API.
@param rowKey Row key to query
@param returnFields List of fields to return, in pairs of format cf:col
@param options
@return
@throws IOException | [
"Returns",
"the",
"result",
"from",
"a",
"query",
"to",
"a",
"single",
"row",
"performed",
"using",
"a",
"Get",
"object",
"from",
"HBase",
"API",
"."
] | train | https://github.com/opencb/datastore/blob/c6b92b30385d5fc5cc191e2db96c46b0389a88c7/datastore-hbase/src/main/java/org/opencb/datastore/hbase/HBaseNativeQuery.java#L69-L87 |
otto-de/edison-microservice | edison-jobs/src/main/java/de/otto/edison/jobs/definition/DefaultJobDefinition.java | DefaultJobDefinition.retryableFixedDelayJobDefinition | public static DefaultJobDefinition retryableFixedDelayJobDefinition(final String jobType,
final String jobName,
final String description,
final Duration fixedDelay,
final int restarts,
final int retries,
final Optional<Duration> retryDelay,
final Optional<Duration> maxAge) {
return new DefaultJobDefinition(jobType, jobName, description, maxAge, Optional.of(fixedDelay), Optional.empty(), restarts, retries, retryDelay);
} | java | public static DefaultJobDefinition retryableFixedDelayJobDefinition(final String jobType,
final String jobName,
final String description,
final Duration fixedDelay,
final int restarts,
final int retries,
final Optional<Duration> retryDelay,
final Optional<Duration> maxAge) {
return new DefaultJobDefinition(jobType, jobName, description, maxAge, Optional.of(fixedDelay), Optional.empty(), restarts, retries, retryDelay);
} | [
"public",
"static",
"DefaultJobDefinition",
"retryableFixedDelayJobDefinition",
"(",
"final",
"String",
"jobType",
",",
"final",
"String",
"jobName",
",",
"final",
"String",
"description",
",",
"final",
"Duration",
"fixedDelay",
",",
"final",
"int",
"restarts",
",",
... | Create a JobDefinition that is using fixed delays specify, when and how often the job should be triggered.
@param jobType The type of the Job
@param jobName A human readable name of the Job
@param description A human readable description of the Job.
@param fixedDelay The delay duration between to executions of the Job
@param restarts The number of restarts if the job failed because of errors or exceptions
@param maxAge Optional maximum age of a job. When the job is not run for longer than this duration,
a warning is displayed on the status page
@param retries Specifies how often a job trigger should retry to start the job if triggering fails for some reason.
@param retryDelay The optional delay between retries.
@return JobDefinition | [
"Create",
"a",
"JobDefinition",
"that",
"is",
"using",
"fixed",
"delays",
"specify",
"when",
"and",
"how",
"often",
"the",
"job",
"should",
"be",
"triggered",
"."
] | train | https://github.com/otto-de/edison-microservice/blob/89ecf0a0dee40977f004370b0b474a36c699e8a2/edison-jobs/src/main/java/de/otto/edison/jobs/definition/DefaultJobDefinition.java#L129-L138 |
threerings/narya | core/src/main/java/com/threerings/crowd/chat/client/ChatDirector.java | ChatDirector.displayAttention | public void displayAttention (String bundle, String message)
{
displaySystem(bundle, message, SystemMessage.ATTENTION, PLACE_CHAT_TYPE);
} | java | public void displayAttention (String bundle, String message)
{
displaySystem(bundle, message, SystemMessage.ATTENTION, PLACE_CHAT_TYPE);
} | [
"public",
"void",
"displayAttention",
"(",
"String",
"bundle",
",",
"String",
"message",
")",
"{",
"displaySystem",
"(",
"bundle",
",",
"message",
",",
"SystemMessage",
".",
"ATTENTION",
",",
"PLACE_CHAT_TYPE",
")",
";",
"}"
] | Display a system ATTENTION message as if it had come from the server. The localtype of the
message will be PLACE_CHAT_TYPE.
Attention messages are sent when something requires user action that did not result from
direct action by the user. | [
"Display",
"a",
"system",
"ATTENTION",
"message",
"as",
"if",
"it",
"had",
"come",
"from",
"the",
"server",
".",
"The",
"localtype",
"of",
"the",
"message",
"will",
"be",
"PLACE_CHAT_TYPE",
"."
] | train | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/crowd/chat/client/ChatDirector.java#L356-L359 |
landawn/AbacusUtil | src/com/landawn/abacus/util/N.java | N.callUninterruptibly | public static <T> T callUninterruptibly(Try.Callable<T, InterruptedException> cmd) {
N.checkArgNotNull(cmd);
boolean interrupted = false;
try {
while (true) {
try {
return cmd.call();
} catch (InterruptedException e) {
interrupted = true;
}
}
} finally {
if (interrupted) {
Thread.currentThread().interrupt();
}
}
} | java | public static <T> T callUninterruptibly(Try.Callable<T, InterruptedException> cmd) {
N.checkArgNotNull(cmd);
boolean interrupted = false;
try {
while (true) {
try {
return cmd.call();
} catch (InterruptedException e) {
interrupted = true;
}
}
} finally {
if (interrupted) {
Thread.currentThread().interrupt();
}
}
} | [
"public",
"static",
"<",
"T",
">",
"T",
"callUninterruptibly",
"(",
"Try",
".",
"Callable",
"<",
"T",
",",
"InterruptedException",
">",
"cmd",
")",
"{",
"N",
".",
"checkArgNotNull",
"(",
"cmd",
")",
";",
"boolean",
"interrupted",
"=",
"false",
";",
"try"... | Note: Copied from Google Guava under Apache License v2.0
<br />
<br />
If a thread is interrupted during such a call, the call continues to block until the result is available or the
timeout elapses, and only then re-interrupts the thread.
@param cmd
@return | [
"Note",
":",
"Copied",
"from",
"Google",
"Guava",
"under",
"Apache",
"License",
"v2",
".",
"0",
"<br",
"/",
">",
"<br",
"/",
">"
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/N.java#L28038-L28055 |
jeremylong/DependencyCheck | core/src/main/java/org/owasp/dependencycheck/data/nvdcve/CveDB.java | CveDB.determineEcosystem | private String determineEcosystem(String baseEcosystem, String vendor, String product, String targetSw) {
if ("ibm".equals(vendor) && "java".equals(product)) {
return "c/c++";
}
if ("oracle".equals(vendor) && "vm".equals(product)) {
return "c/c++";
}
if ("*".equals(targetSw) || baseEcosystem != null) {
return baseEcosystem;
}
return targetSw;
} | java | private String determineEcosystem(String baseEcosystem, String vendor, String product, String targetSw) {
if ("ibm".equals(vendor) && "java".equals(product)) {
return "c/c++";
}
if ("oracle".equals(vendor) && "vm".equals(product)) {
return "c/c++";
}
if ("*".equals(targetSw) || baseEcosystem != null) {
return baseEcosystem;
}
return targetSw;
} | [
"private",
"String",
"determineEcosystem",
"(",
"String",
"baseEcosystem",
",",
"String",
"vendor",
",",
"String",
"product",
",",
"String",
"targetSw",
")",
"{",
"if",
"(",
"\"ibm\"",
".",
"equals",
"(",
"vendor",
")",
"&&",
"\"java\"",
".",
"equals",
"(",
... | Attempts to determine the ecosystem based on the vendor, product and
targetSw.
@param baseEcosystem the base ecosystem
@param vendor the vendor
@param product the product
@param targetSw the target software
@return the ecosystem if one is identified | [
"Attempts",
"to",
"determine",
"the",
"ecosystem",
"based",
"on",
"the",
"vendor",
"product",
"and",
"targetSw",
"."
] | train | https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/data/nvdcve/CveDB.java#L222-L233 |
eBay/parallec | src/main/java/io/parallec/core/ParallecHeader.java | ParallecHeader.addPair | public ParallecHeader addPair(String key, String value) {
this.headerMap.put(key, value);
return this;
} | java | public ParallecHeader addPair(String key, String value) {
this.headerMap.put(key, value);
return this;
} | [
"public",
"ParallecHeader",
"addPair",
"(",
"String",
"key",
",",
"String",
"value",
")",
"{",
"this",
".",
"headerMap",
".",
"put",
"(",
"key",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | Adds the pair.
@param key
the key
@param value
the value
@return the parallec header | [
"Adds",
"the",
"pair",
"."
] | train | https://github.com/eBay/parallec/blob/1b4f1628f34fedfb06b24c33a5372d64d3df0952/src/main/java/io/parallec/core/ParallecHeader.java#L48-L51 |
synchronoss/cpo-api | cpo-jdbc/src/main/java/org/synchronoss/cpo/transform/jdbc/TransformGZipBytes.java | TransformGZipBytes.transformOut | @Override
public byte[] transformOut(JdbcPreparedStatementFactory jpsf, byte[] attributeObject) throws CpoException {
byte[] retBytes = null;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try {
if (attributeObject != null) {
if (attributeObject.length > 0) {
GZIPOutputStream os = new GZIPOutputStream(baos);
os.write(attributeObject);
os.flush();
os.close();
baos.flush();
baos.close();
retBytes = baos.toByteArray();
} else {
retBytes = new byte[0];
}
}
} catch (Exception e) {
String msg = "Error GZipping Byte Array";
logger.error(msg, e);
throw new CpoException(msg, e);
}
return retBytes;
} | java | @Override
public byte[] transformOut(JdbcPreparedStatementFactory jpsf, byte[] attributeObject) throws CpoException {
byte[] retBytes = null;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try {
if (attributeObject != null) {
if (attributeObject.length > 0) {
GZIPOutputStream os = new GZIPOutputStream(baos);
os.write(attributeObject);
os.flush();
os.close();
baos.flush();
baos.close();
retBytes = baos.toByteArray();
} else {
retBytes = new byte[0];
}
}
} catch (Exception e) {
String msg = "Error GZipping Byte Array";
logger.error(msg, e);
throw new CpoException(msg, e);
}
return retBytes;
} | [
"@",
"Override",
"public",
"byte",
"[",
"]",
"transformOut",
"(",
"JdbcPreparedStatementFactory",
"jpsf",
",",
"byte",
"[",
"]",
"attributeObject",
")",
"throws",
"CpoException",
"{",
"byte",
"[",
"]",
"retBytes",
"=",
"null",
";",
"ByteArrayOutputStream",
"baos... | Transforms the data from the class attribute to the object required by the datasource
@param cpoAdapter The CpoAdapter for the datasource where the attribute is being persisted
@param parentObject The object that contains the attribute being persisted.
@param attributeObject The object that represents the attribute being persisted.
@return The object to be stored in the datasource
@throws CpoException | [
"Transforms",
"the",
"data",
"from",
"the",
"class",
"attribute",
"to",
"the",
"object",
"required",
"by",
"the",
"datasource"
] | train | https://github.com/synchronoss/cpo-api/blob/dc745aca3b3206abf80b85d9689b0132f5baa694/cpo-jdbc/src/main/java/org/synchronoss/cpo/transform/jdbc/TransformGZipBytes.java#L95-L124 |
google/truth | extensions/proto/src/main/java/com/google/common/truth/extensions/proto/MapWithProtoValuesSubject.java | MapWithProtoValuesSubject.ignoringRepeatedFieldOrderOfFieldsForValues | public MapWithProtoValuesFluentAssertion<M> ignoringRepeatedFieldOrderOfFieldsForValues(
int firstFieldNumber, int... rest) {
return usingConfig(config.ignoringRepeatedFieldOrderOfFields(asList(firstFieldNumber, rest)));
} | java | public MapWithProtoValuesFluentAssertion<M> ignoringRepeatedFieldOrderOfFieldsForValues(
int firstFieldNumber, int... rest) {
return usingConfig(config.ignoringRepeatedFieldOrderOfFields(asList(firstFieldNumber, rest)));
} | [
"public",
"MapWithProtoValuesFluentAssertion",
"<",
"M",
">",
"ignoringRepeatedFieldOrderOfFieldsForValues",
"(",
"int",
"firstFieldNumber",
",",
"int",
"...",
"rest",
")",
"{",
"return",
"usingConfig",
"(",
"config",
".",
"ignoringRepeatedFieldOrderOfFields",
"(",
"asLis... | Specifies that the ordering of repeated fields for these explicitly specified top-level field
numbers should be ignored when comparing for equality. Sub-fields must be specified explicitly
(via {@link FieldDescriptor}) if their orders are to be ignored as well.
<p>Use {@link #ignoringRepeatedFieldOrderForValues()} instead to ignore order for all fields.
@see #ignoringRepeatedFieldOrderForValues() for details. | [
"Specifies",
"that",
"the",
"ordering",
"of",
"repeated",
"fields",
"for",
"these",
"explicitly",
"specified",
"top",
"-",
"level",
"field",
"numbers",
"should",
"be",
"ignored",
"when",
"comparing",
"for",
"equality",
".",
"Sub",
"-",
"fields",
"must",
"be",
... | train | https://github.com/google/truth/blob/60eceffd2e8c3297655d33ed87d965cf5af51108/extensions/proto/src/main/java/com/google/common/truth/extensions/proto/MapWithProtoValuesSubject.java#L369-L372 |
diffplug/JMatIO | src/main/java/ca/mjdsystems/jmatio/types/MLNumericArray.java | MLNumericArray.setReal | public void setReal(T value, int m, int n)
{
setReal( value, getIndex(m,n) );
} | java | public void setReal(T value, int m, int n)
{
setReal( value, getIndex(m,n) );
} | [
"public",
"void",
"setReal",
"(",
"T",
"value",
",",
"int",
"m",
",",
"int",
"n",
")",
"{",
"setReal",
"(",
"value",
",",
"getIndex",
"(",
"m",
",",
"n",
")",
")",
";",
"}"
] | Sets single real array element.
@param value - element value
@param m - row index
@param n - column index | [
"Sets",
"single",
"real",
"array",
"element",
"."
] | train | https://github.com/diffplug/JMatIO/blob/dab8a54fa21a8faeaa81537cdc45323c5c4e6ca6/src/main/java/ca/mjdsystems/jmatio/types/MLNumericArray.java#L99-L102 |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/geo/PerspectiveOps.java | PerspectiveOps.multTranA | public static void multTranA( DMatrixRMaj A , DMatrixRMaj B , DMatrixRMaj C , DMatrixRMaj output )
{
double t11 = A.data[0]*B.data[0] + A.data[3]*B.data[3] + A.data[6]*B.data[6];
double t12 = A.data[0]*B.data[1] + A.data[3]*B.data[4] + A.data[6]*B.data[7];
double t13 = A.data[0]*B.data[2] + A.data[3]*B.data[5] + A.data[6]*B.data[8];
double t21 = A.data[1]*B.data[0] + A.data[4]*B.data[3] + A.data[7]*B.data[6];
double t22 = A.data[1]*B.data[1] + A.data[4]*B.data[4] + A.data[7]*B.data[7];
double t23 = A.data[1]*B.data[2] + A.data[4]*B.data[5] + A.data[7]*B.data[8];
double t31 = A.data[2]*B.data[0] + A.data[5]*B.data[3] + A.data[8]*B.data[6];
double t32 = A.data[2]*B.data[1] + A.data[5]*B.data[4] + A.data[8]*B.data[7];
double t33 = A.data[2]*B.data[2] + A.data[5]*B.data[5] + A.data[8]*B.data[8];
output.data[0] = t11*C.data[0] + t12*C.data[3] + t13*C.data[6];
output.data[1] = t11*C.data[1] + t12*C.data[4] + t13*C.data[7];
output.data[2] = t11*C.data[2] + t12*C.data[5] + t13*C.data[8];
output.data[3] = t21*C.data[0] + t22*C.data[3] + t23*C.data[6];
output.data[4] = t21*C.data[1] + t22*C.data[4] + t23*C.data[7];
output.data[5] = t21*C.data[2] + t22*C.data[5] + t23*C.data[8];
output.data[6] = t31*C.data[0] + t32*C.data[3] + t33*C.data[6];
output.data[7] = t31*C.data[1] + t32*C.data[4] + t33*C.data[7];
output.data[8] = t31*C.data[2] + t32*C.data[5] + t33*C.data[8];
} | java | public static void multTranA( DMatrixRMaj A , DMatrixRMaj B , DMatrixRMaj C , DMatrixRMaj output )
{
double t11 = A.data[0]*B.data[0] + A.data[3]*B.data[3] + A.data[6]*B.data[6];
double t12 = A.data[0]*B.data[1] + A.data[3]*B.data[4] + A.data[6]*B.data[7];
double t13 = A.data[0]*B.data[2] + A.data[3]*B.data[5] + A.data[6]*B.data[8];
double t21 = A.data[1]*B.data[0] + A.data[4]*B.data[3] + A.data[7]*B.data[6];
double t22 = A.data[1]*B.data[1] + A.data[4]*B.data[4] + A.data[7]*B.data[7];
double t23 = A.data[1]*B.data[2] + A.data[4]*B.data[5] + A.data[7]*B.data[8];
double t31 = A.data[2]*B.data[0] + A.data[5]*B.data[3] + A.data[8]*B.data[6];
double t32 = A.data[2]*B.data[1] + A.data[5]*B.data[4] + A.data[8]*B.data[7];
double t33 = A.data[2]*B.data[2] + A.data[5]*B.data[5] + A.data[8]*B.data[8];
output.data[0] = t11*C.data[0] + t12*C.data[3] + t13*C.data[6];
output.data[1] = t11*C.data[1] + t12*C.data[4] + t13*C.data[7];
output.data[2] = t11*C.data[2] + t12*C.data[5] + t13*C.data[8];
output.data[3] = t21*C.data[0] + t22*C.data[3] + t23*C.data[6];
output.data[4] = t21*C.data[1] + t22*C.data[4] + t23*C.data[7];
output.data[5] = t21*C.data[2] + t22*C.data[5] + t23*C.data[8];
output.data[6] = t31*C.data[0] + t32*C.data[3] + t33*C.data[6];
output.data[7] = t31*C.data[1] + t32*C.data[4] + t33*C.data[7];
output.data[8] = t31*C.data[2] + t32*C.data[5] + t33*C.data[8];
} | [
"public",
"static",
"void",
"multTranA",
"(",
"DMatrixRMaj",
"A",
",",
"DMatrixRMaj",
"B",
",",
"DMatrixRMaj",
"C",
",",
"DMatrixRMaj",
"output",
")",
"{",
"double",
"t11",
"=",
"A",
".",
"data",
"[",
"0",
"]",
"*",
"B",
".",
"data",
"[",
"0",
"]",
... | Computes: D = A<sup>T</sup>*B*C
@param A (Input) 3x3 matrix
@param B (Input) 3x3 matrix
@param C (Input) 3x3 matrix
@param output (Output) 3x3 matrix. Can be same instance A or B. | [
"Computes",
":",
"D",
"=",
"A<sup",
">",
"T<",
"/",
"sup",
">",
"*",
"B",
"*",
"C"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/PerspectiveOps.java#L789-L814 |
NoraUi/NoraUi | src/main/java/com/github/noraui/utils/Utilities.java | Utilities.getLocator | public static By getLocator(Page page, String code, Object... args) {
return getLocator(page.getApplication(), page.getPageKey() + code, args);
} | java | public static By getLocator(Page page, String code, Object... args) {
return getLocator(page.getApplication(), page.getPageKey() + code, args);
} | [
"public",
"static",
"By",
"getLocator",
"(",
"Page",
"page",
",",
"String",
"code",
",",
"Object",
"...",
"args",
")",
"{",
"return",
"getLocator",
"(",
"page",
".",
"getApplication",
"(",
")",
",",
"page",
".",
"getPageKey",
"(",
")",
"+",
"code",
","... | This method read a application descriptor file and return a {@link org.openqa.selenium.By} object (xpath, id, link ...).
@param page
is target page
@param code
Name of element on the web Page.
@param args
list of description (xpath, id, link ...) for code.
@return a {@link org.openqa.selenium.By} object (xpath, id, link ...) | [
"This",
"method",
"read",
"a",
"application",
"descriptor",
"file",
"and",
"return",
"a",
"{",
"@link",
"org",
".",
"openqa",
".",
"selenium",
".",
"By",
"}",
"object",
"(",
"xpath",
"id",
"link",
"...",
")",
"."
] | train | https://github.com/NoraUi/NoraUi/blob/5f491a3339c7d3c20d7207760bdaf2acdb8f260c/src/main/java/com/github/noraui/utils/Utilities.java#L123-L125 |
ocelotds/ocelot | ocelot-web/src/main/java/org/ocelotds/topic/TopicsMessagesBroadcaster.java | TopicsMessagesBroadcaster.sendMessageToTopic | public int sendMessageToTopic(Collection<Session> sessionTargets, MessageToClient mtc, Object payload) {
int sended = 0;
logger.debug("Sending message to topic {}...", mtc);
Collection<Session> doublons = topicManager.getSessionsForTopic(mtc.getId());
if (doublons != null && !doublons.isEmpty()) {
Set<Session> sessions = new HashSet<>(doublons);
if (sessionTargets != null) {
sessions.retainAll(sessionTargets);
}
sended = sendMessageToTopicForSessions(sessions, mtc, payload);
} else {
logger.debug("No client for topic '{}'", mtc.getId());
}
return sended;
} | java | public int sendMessageToTopic(Collection<Session> sessionTargets, MessageToClient mtc, Object payload) {
int sended = 0;
logger.debug("Sending message to topic {}...", mtc);
Collection<Session> doublons = topicManager.getSessionsForTopic(mtc.getId());
if (doublons != null && !doublons.isEmpty()) {
Set<Session> sessions = new HashSet<>(doublons);
if (sessionTargets != null) {
sessions.retainAll(sessionTargets);
}
sended = sendMessageToTopicForSessions(sessions, mtc, payload);
} else {
logger.debug("No client for topic '{}'", mtc.getId());
}
return sended;
} | [
"public",
"int",
"sendMessageToTopic",
"(",
"Collection",
"<",
"Session",
">",
"sessionTargets",
",",
"MessageToClient",
"mtc",
",",
"Object",
"payload",
")",
"{",
"int",
"sended",
"=",
"0",
";",
"logger",
".",
"debug",
"(",
"\"Sending message to topic {}...\"",
... | Send message to all sessions for topic mtc.getId() and intersection of sessionTargets
return number sended
@param sessionTargets
@param mtc
@param payload
@return | [
"Send",
"message",
"to",
"all",
"sessions",
"for",
"topic",
"mtc",
".",
"getId",
"()",
"and",
"intersection",
"of",
"sessionTargets",
"return",
"number",
"sended"
] | train | https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-web/src/main/java/org/ocelotds/topic/TopicsMessagesBroadcaster.java#L62-L76 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/application/ApplicationImpl.java | ApplicationImpl.createConverter | @Override
public final Converter createConverter(final String converterId)
{
checkNull(converterId, "converterId");
checkEmpty(converterId, "converterId");
final Class<? extends Converter> converterClass =
getObjectFromClassMap(converterId, _converterIdToClassMap);
if (converterClass == null)
{
throw new FacesException("Could not find any registered converter-class by converterId : " + converterId);
}
try
{
final Converter converter = createConverterInstance(converterClass);
setConverterProperties(converterClass, converter);
_handleAttachedResourceDependencyAnnotations(FacesContext.getCurrentInstance(), converter);
return converter;
}
catch (Exception e)
{
log.log(Level.SEVERE, "Could not instantiate converter " + converterClass, e);
throw new FacesException("Could not instantiate converter: " + converterClass, e);
}
} | java | @Override
public final Converter createConverter(final String converterId)
{
checkNull(converterId, "converterId");
checkEmpty(converterId, "converterId");
final Class<? extends Converter> converterClass =
getObjectFromClassMap(converterId, _converterIdToClassMap);
if (converterClass == null)
{
throw new FacesException("Could not find any registered converter-class by converterId : " + converterId);
}
try
{
final Converter converter = createConverterInstance(converterClass);
setConverterProperties(converterClass, converter);
_handleAttachedResourceDependencyAnnotations(FacesContext.getCurrentInstance(), converter);
return converter;
}
catch (Exception e)
{
log.log(Level.SEVERE, "Could not instantiate converter " + converterClass, e);
throw new FacesException("Could not instantiate converter: " + converterClass, e);
}
} | [
"@",
"Override",
"public",
"final",
"Converter",
"createConverter",
"(",
"final",
"String",
"converterId",
")",
"{",
"checkNull",
"(",
"converterId",
",",
"\"converterId\"",
")",
";",
"checkEmpty",
"(",
"converterId",
",",
"\"converterId\"",
")",
";",
"final",
"... | Return an instance of the converter class that has been registered under the specified id.
<p>
Converters are registered via faces-config.xml files, and can also be registered via the addConverter(String id,
Class converterClass) method on this class. Here the the appropriate Class definition is found, then an instance
is created and returned.
<p>
A converter registered via a config file can have any number of nested attribute or property tags. The JSF
specification is very vague about what effect these nested tags have. This method ignores nested attribute
definitions, but for each nested property tag the corresponding setter is invoked on the new Converter instance
passing the property's defaultValuer. Basic typeconversion is done so the target properties on the Converter
instance can be String, int, boolean, etc. Note that:
<ol>
<li>the Sun Mojarra JSF implemenation ignores nested property tags completely, so this behaviour cannot be
relied on across implementations.
<li>there is no equivalent functionality for converter classes registered via the Application.addConverter api
method.
</ol>
<p>
Note that this method is most commonly called from the standard f:attribute tag. As an alternative, most
components provide a "converter" attribute which uses an EL expression to create a Converter instance, in which
case this method is not invoked at all. The converter attribute allows the returned Converter instance to be
configured via normal dependency-injection, and is generally a better choice than using this method. | [
"Return",
"an",
"instance",
"of",
"the",
"converter",
"class",
"that",
"has",
"been",
"registered",
"under",
"the",
"specified",
"id",
".",
"<p",
">",
"Converters",
"are",
"registered",
"via",
"faces",
"-",
"config",
".",
"xml",
"files",
"and",
"can",
"als... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/application/ApplicationImpl.java#L1550-L1578 |
camunda/camunda-commons | logging/src/main/java/org/camunda/commons/logging/BaseLogger.java | BaseLogger.logWarn | protected void logWarn(String id, String messageTemplate, Object... parameters) {
if(delegateLogger.isWarnEnabled()) {
String msg = formatMessageTemplate(id, messageTemplate);
delegateLogger.warn(msg, parameters);
}
} | java | protected void logWarn(String id, String messageTemplate, Object... parameters) {
if(delegateLogger.isWarnEnabled()) {
String msg = formatMessageTemplate(id, messageTemplate);
delegateLogger.warn(msg, parameters);
}
} | [
"protected",
"void",
"logWarn",
"(",
"String",
"id",
",",
"String",
"messageTemplate",
",",
"Object",
"...",
"parameters",
")",
"{",
"if",
"(",
"delegateLogger",
".",
"isWarnEnabled",
"(",
")",
")",
"{",
"String",
"msg",
"=",
"formatMessageTemplate",
"(",
"i... | Logs an 'WARN' message
@param id the unique id of this log message
@param messageTemplate the message template to use
@param parameters a list of optional parameters | [
"Logs",
"an",
"WARN",
"message"
] | train | https://github.com/camunda/camunda-commons/blob/bd3195db47c92c25717288fe9e6735f8e882f247/logging/src/main/java/org/camunda/commons/logging/BaseLogger.java#L143-L148 |
igniterealtime/Smack | smack-openpgp/src/main/java/org/jivesoftware/smackx/ox_im/OXInstantMessagingManager.java | OXInstantMessagingManager.addOxMessage | public OpenPgpMetadata addOxMessage(Message message, Set<OpenPgpContact> contacts, List<ExtensionElement> payload)
throws SmackException.NotLoggedInException, IOException, PGPException {
HashSet<OpenPgpContact> recipients = new HashSet<>(contacts);
OpenPgpContact self = openPgpManager.getOpenPgpSelf();
recipients.add(self);
OpenPgpElementAndMetadata openPgpElementAndMetadata = signAndEncrypt(recipients, payload);
message.addExtension(openPgpElementAndMetadata.getElement());
// Set hints on message
ExplicitMessageEncryptionElement.set(message,
ExplicitMessageEncryptionElement.ExplicitMessageEncryptionProtocol.openpgpV0);
StoreHint.set(message);
setOXBodyHint(message);
return openPgpElementAndMetadata.getMetadata();
} | java | public OpenPgpMetadata addOxMessage(Message message, Set<OpenPgpContact> contacts, List<ExtensionElement> payload)
throws SmackException.NotLoggedInException, IOException, PGPException {
HashSet<OpenPgpContact> recipients = new HashSet<>(contacts);
OpenPgpContact self = openPgpManager.getOpenPgpSelf();
recipients.add(self);
OpenPgpElementAndMetadata openPgpElementAndMetadata = signAndEncrypt(recipients, payload);
message.addExtension(openPgpElementAndMetadata.getElement());
// Set hints on message
ExplicitMessageEncryptionElement.set(message,
ExplicitMessageEncryptionElement.ExplicitMessageEncryptionProtocol.openpgpV0);
StoreHint.set(message);
setOXBodyHint(message);
return openPgpElementAndMetadata.getMetadata();
} | [
"public",
"OpenPgpMetadata",
"addOxMessage",
"(",
"Message",
"message",
",",
"Set",
"<",
"OpenPgpContact",
">",
"contacts",
",",
"List",
"<",
"ExtensionElement",
">",
"payload",
")",
"throws",
"SmackException",
".",
"NotLoggedInException",
",",
"IOException",
",",
... | Add an OX-IM message element to a message.
@param message message
@param contacts recipients of the message
@param payload payload which will be encrypted and signed
@return metadata about the messages encryption + signatures.
@throws SmackException.NotLoggedInException in case we are not logged in
@throws PGPException in case something goes wrong during encryption
@throws IOException IO is dangerous (we need to read keys) | [
"Add",
"an",
"OX",
"-",
"IM",
"message",
"element",
"to",
"a",
"message",
"."
] | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox_im/OXInstantMessagingManager.java#L271-L288 |
nohana/Amalgam | amalgam/src/main/java/com/amalgam/os/BundleUtils.java | BundleUtils.optBundle | @Nullable
public static Bundle optBundle(@Nullable Bundle bundle, @Nullable String key, @Nullable Bundle fallback) {
if (bundle == null) {
return fallback;
}
return bundle.getBundle(key);
} | java | @Nullable
public static Bundle optBundle(@Nullable Bundle bundle, @Nullable String key, @Nullable Bundle fallback) {
if (bundle == null) {
return fallback;
}
return bundle.getBundle(key);
} | [
"@",
"Nullable",
"public",
"static",
"Bundle",
"optBundle",
"(",
"@",
"Nullable",
"Bundle",
"bundle",
",",
"@",
"Nullable",
"String",
"key",
",",
"@",
"Nullable",
"Bundle",
"fallback",
")",
"{",
"if",
"(",
"bundle",
"==",
"null",
")",
"{",
"return",
"fal... | Returns a optional {@link android.os.Bundle} value. In other words, returns the value mapped by key if it exists and is a {@link android.os.Bundle}.
The bundle argument is allowed to be {@code null}. If the bundle is null, this method returns null.
@param bundle a bundle. If the bundle is null, this method will return a fallback value.
@param key a key for the value.
@param fallback fallback value.
@return a {@link android.os.Bundle} value if exists, null otherwise.
@see android.os.Bundle#getBundle(String) | [
"Returns",
"a",
"optional",
"{"
] | train | https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/os/BundleUtils.java#L197-L203 |
structurizr/java | structurizr-core/src/com/structurizr/model/Person.java | Person.interactsWith | public Relationship interactsWith(Person destination, String description) {
return interactsWith(destination, description, null);
} | java | public Relationship interactsWith(Person destination, String description) {
return interactsWith(destination, description, null);
} | [
"public",
"Relationship",
"interactsWith",
"(",
"Person",
"destination",
",",
"String",
"description",
")",
"{",
"return",
"interactsWith",
"(",
"destination",
",",
"description",
",",
"null",
")",
";",
"}"
] | Adds an interaction between this person and another.
@param destination the Person being interacted with
@param description a description of the interaction
@return the resulting Relatioship | [
"Adds",
"an",
"interaction",
"between",
"this",
"person",
"and",
"another",
"."
] | train | https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/model/Person.java#L75-L77 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.