repository_name stringlengths 7 54 | func_path_in_repository stringlengths 18 218 | func_name stringlengths 5 140 | whole_func_string stringlengths 79 3.99k | language stringclasses 1
value | func_code_string stringlengths 79 3.99k | func_code_tokens listlengths 20 624 | func_documentation_string stringlengths 61 1.96k | func_documentation_tokens listlengths 1 478 | split_name stringclasses 1
value | func_code_url stringlengths 107 339 |
|---|---|---|---|---|---|---|---|---|---|---|
authlete/authlete-java-common | src/main/java/com/authlete/common/util/TypedProperties.java | TypedProperties.setFloat | public void setFloat(Enum<?> key, float value)
{
if (key == null)
{
return;
}
setFloat(key.name(), value);
} | java | public void setFloat(Enum<?> key, float value)
{
if (key == null)
{
return;
}
setFloat(key.name(), value);
} | [
"public",
"void",
"setFloat",
"(",
"Enum",
"<",
"?",
">",
"key",
",",
"float",
"value",
")",
"{",
"if",
"(",
"key",
"==",
"null",
")",
"{",
"return",
";",
"}",
"setFloat",
"(",
"key",
".",
"name",
"(",
")",
",",
"value",
")",
";",
"}"
] | Equivalent to {@link #setFloat(String, float)
setFloat}{@code (key.name(), value)}.
If {@code key} is null, nothing is done. | [
"Equivalent",
"to",
"{"
] | train | https://github.com/authlete/authlete-java-common/blob/49c94c483713cbf5a04d805ff7dbd83766c9c964/src/main/java/com/authlete/common/util/TypedProperties.java#L640-L648 |
lessthanoptimal/BoofCV | main/boofcv-recognition/src/main/java/boofcv/alg/tracker/circulant/CirculantTracker.java | CirculantTracker.dense_gauss_kernel | public void dense_gauss_kernel(double sigma , GrayF64 x , GrayF64 y , GrayF64 k ) {
InterleavedF64 xf=tmpFourier0,yf,xyf=tmpFourier2;
GrayF64 xy = tmpReal0;
double yy;
// find x in Fourier domain
fft.forward(x, xf);
double xx = imageDotProduct(x);
if( x != y ) {
// general case, x and y are different
yf = tmpFourier1;
fft.forward(y,yf);
yy = imageDotProduct(y);
} else {
// auto-correlation of x, avoid repeating a few operations
yf = xf;
yy = xx;
}
//---- xy = invF[ F(x)*F(y) ]
// cross-correlation term in Fourier domain
elementMultConjB(xf,yf,xyf);
// convert to spatial domain
fft.inverse(xyf,xy);
circshift(xy,tmpReal1);
// calculate gaussian response for all positions
gaussianKernel(xx, yy, tmpReal1, sigma, k);
} | java | public void dense_gauss_kernel(double sigma , GrayF64 x , GrayF64 y , GrayF64 k ) {
InterleavedF64 xf=tmpFourier0,yf,xyf=tmpFourier2;
GrayF64 xy = tmpReal0;
double yy;
// find x in Fourier domain
fft.forward(x, xf);
double xx = imageDotProduct(x);
if( x != y ) {
// general case, x and y are different
yf = tmpFourier1;
fft.forward(y,yf);
yy = imageDotProduct(y);
} else {
// auto-correlation of x, avoid repeating a few operations
yf = xf;
yy = xx;
}
//---- xy = invF[ F(x)*F(y) ]
// cross-correlation term in Fourier domain
elementMultConjB(xf,yf,xyf);
// convert to spatial domain
fft.inverse(xyf,xy);
circshift(xy,tmpReal1);
// calculate gaussian response for all positions
gaussianKernel(xx, yy, tmpReal1, sigma, k);
} | [
"public",
"void",
"dense_gauss_kernel",
"(",
"double",
"sigma",
",",
"GrayF64",
"x",
",",
"GrayF64",
"y",
",",
"GrayF64",
"k",
")",
"{",
"InterleavedF64",
"xf",
"=",
"tmpFourier0",
",",
"yf",
",",
"xyf",
"=",
"tmpFourier2",
";",
"GrayF64",
"xy",
"=",
"tm... | Gaussian Kernel with dense sampling.
Evaluates a gaussian kernel with bandwidth SIGMA for all displacements
between input images X and Y, which must both be MxN. They must also
be periodic (ie., pre-processed with a cosine window). The result is
an MxN map of responses.
@param sigma Gaussian kernel bandwidth
@param x Input image
@param y Input image
@param k Output containing Gaussian kernel for each element in target region | [
"Gaussian",
"Kernel",
"with",
"dense",
"sampling",
".",
"Evaluates",
"a",
"gaussian",
"kernel",
"with",
"bandwidth",
"SIGMA",
"for",
"all",
"displacements",
"between",
"input",
"images",
"X",
"and",
"Y",
"which",
"must",
"both",
"be",
"MxN",
".",
"They",
"mu... | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/tracker/circulant/CirculantTracker.java#L437-L467 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/Signature.java | Signature.getInstance | public static Signature getInstance(String algorithm, Provider provider)
throws NoSuchAlgorithmException {
if (algorithm.equalsIgnoreCase(RSA_SIGNATURE)) {
// exception compatibility with existing code
if (provider == null) {
throw new IllegalArgumentException("missing provider");
}
return getInstanceRSA(provider);
}
Instance instance = GetInstance.getInstance
("Signature", SignatureSpi.class, algorithm, provider);
return getInstance(instance, algorithm);
} | java | public static Signature getInstance(String algorithm, Provider provider)
throws NoSuchAlgorithmException {
if (algorithm.equalsIgnoreCase(RSA_SIGNATURE)) {
// exception compatibility with existing code
if (provider == null) {
throw new IllegalArgumentException("missing provider");
}
return getInstanceRSA(provider);
}
Instance instance = GetInstance.getInstance
("Signature", SignatureSpi.class, algorithm, provider);
return getInstance(instance, algorithm);
} | [
"public",
"static",
"Signature",
"getInstance",
"(",
"String",
"algorithm",
",",
"Provider",
"provider",
")",
"throws",
"NoSuchAlgorithmException",
"{",
"if",
"(",
"algorithm",
".",
"equalsIgnoreCase",
"(",
"RSA_SIGNATURE",
")",
")",
"{",
"// exception compatibility w... | Returns a Signature object that implements the specified
signature algorithm.
<p> A new Signature object encapsulating the
SignatureSpi implementation from the specified Provider
object is returned. Note that the specified Provider object
does not have to be registered in the provider list.
@param algorithm the name of the algorithm requested.
See the Signature section in the <a href=
"{@docRoot}openjdk-redirect.html?v=8&path=/technotes/guides/security/StandardNames.html#Signature">
Java Cryptography Architecture Standard Algorithm Name Documentation</a>
for information about standard algorithm names.
@param provider the provider.
@return the new Signature object.
@exception NoSuchAlgorithmException if a SignatureSpi
implementation for the specified algorithm is not available
from the specified Provider object.
@exception IllegalArgumentException if the provider is null.
@see Provider
@since 1.4 | [
"Returns",
"a",
"Signature",
"object",
"that",
"implements",
"the",
"specified",
"signature",
"algorithm",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/Signature.java#L534-L546 |
camunda/camunda-bpm-platform | engine/src/main/java/org/camunda/bpm/engine/impl/pvm/runtime/LegacyBehavior.java | LegacyBehavior.cancelConcurrentScope | public static void cancelConcurrentScope(PvmExecutionImpl execution, PvmActivity cancelledScopeActivity) {
ensureConcurrentScope(execution);
LOG.debugCancelConcurrentScopeExecution(execution);
execution.interrupt("Scope "+cancelledScopeActivity+" cancelled.");
// <!> HACK set to event scope activity and leave activity instance
execution.setActivity(cancelledScopeActivity);
execution.leaveActivityInstance();
execution.interrupt("Scope "+cancelledScopeActivity+" cancelled.");
execution.destroy();
} | java | public static void cancelConcurrentScope(PvmExecutionImpl execution, PvmActivity cancelledScopeActivity) {
ensureConcurrentScope(execution);
LOG.debugCancelConcurrentScopeExecution(execution);
execution.interrupt("Scope "+cancelledScopeActivity+" cancelled.");
// <!> HACK set to event scope activity and leave activity instance
execution.setActivity(cancelledScopeActivity);
execution.leaveActivityInstance();
execution.interrupt("Scope "+cancelledScopeActivity+" cancelled.");
execution.destroy();
} | [
"public",
"static",
"void",
"cancelConcurrentScope",
"(",
"PvmExecutionImpl",
"execution",
",",
"PvmActivity",
"cancelledScopeActivity",
")",
"{",
"ensureConcurrentScope",
"(",
"execution",
")",
";",
"LOG",
".",
"debugCancelConcurrentScopeExecution",
"(",
"execution",
")"... | Cancels an execution which is both concurrent and scope. This can only happen if
(a) the process instance has been migrated from a previous version to a new version of the process engine
See: javadoc of this class for note about concurrent scopes.
@param execution the concurrent scope execution to destroy
@param cancelledScopeActivity the activity that cancels the execution; it must hold that
cancellingActivity's event scope is the scope the execution is responsible for | [
"Cancels",
"an",
"execution",
"which",
"is",
"both",
"concurrent",
"and",
"scope",
".",
"This",
"can",
"only",
"happen",
"if",
"(",
"a",
")",
"the",
"process",
"instance",
"has",
"been",
"migrated",
"from",
"a",
"previous",
"version",
"to",
"a",
"new",
"... | train | https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/pvm/runtime/LegacyBehavior.java#L115-L125 |
liferay/com-liferay-commerce | commerce-product-type-virtual-order-service/src/main/java/com/liferay/commerce/product/type/virtual/order/service/persistence/impl/CommerceVirtualOrderItemPersistenceImpl.java | CommerceVirtualOrderItemPersistenceImpl.removeByUUID_G | @Override
public CommerceVirtualOrderItem removeByUUID_G(String uuid, long groupId)
throws NoSuchVirtualOrderItemException {
CommerceVirtualOrderItem commerceVirtualOrderItem = findByUUID_G(uuid,
groupId);
return remove(commerceVirtualOrderItem);
} | java | @Override
public CommerceVirtualOrderItem removeByUUID_G(String uuid, long groupId)
throws NoSuchVirtualOrderItemException {
CommerceVirtualOrderItem commerceVirtualOrderItem = findByUUID_G(uuid,
groupId);
return remove(commerceVirtualOrderItem);
} | [
"@",
"Override",
"public",
"CommerceVirtualOrderItem",
"removeByUUID_G",
"(",
"String",
"uuid",
",",
"long",
"groupId",
")",
"throws",
"NoSuchVirtualOrderItemException",
"{",
"CommerceVirtualOrderItem",
"commerceVirtualOrderItem",
"=",
"findByUUID_G",
"(",
"uuid",
",",
"g... | Removes the commerce virtual order item where uuid = ? and groupId = ? from the database.
@param uuid the uuid
@param groupId the group ID
@return the commerce virtual order item that was removed | [
"Removes",
"the",
"commerce",
"virtual",
"order",
"item",
"where",
"uuid",
"=",
"?",
";",
"and",
"groupId",
"=",
"?",
";",
"from",
"the",
"database",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-type-virtual-order-service/src/main/java/com/liferay/commerce/product/type/virtual/order/service/persistence/impl/CommerceVirtualOrderItemPersistenceImpl.java#L817-L824 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/JobScheduleOperations.java | JobScheduleOperations.existsJobSchedule | public boolean existsJobSchedule(String jobScheduleId, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException {
JobScheduleExistsOptions options = new JobScheduleExistsOptions();
BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors);
bhMgr.applyRequestBehaviors(options);
return this.parentBatchClient.protocolLayer().jobSchedules().exists(jobScheduleId, options);
} | java | public boolean existsJobSchedule(String jobScheduleId, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException {
JobScheduleExistsOptions options = new JobScheduleExistsOptions();
BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors);
bhMgr.applyRequestBehaviors(options);
return this.parentBatchClient.protocolLayer().jobSchedules().exists(jobScheduleId, options);
} | [
"public",
"boolean",
"existsJobSchedule",
"(",
"String",
"jobScheduleId",
",",
"Iterable",
"<",
"BatchClientBehavior",
">",
"additionalBehaviors",
")",
"throws",
"BatchErrorException",
",",
"IOException",
"{",
"JobScheduleExistsOptions",
"options",
"=",
"new",
"JobSchedul... | Checks whether the specified job schedule exists.
@param jobScheduleId The ID of the job schedule which you want to check.
@param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request.
@return True if the specified job schedule exists; otherwise, false.
@throws BatchErrorException Exception thrown when an error response is received from the Batch service.
@throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. | [
"Checks",
"whether",
"the",
"specified",
"job",
"schedule",
"exists",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/JobScheduleOperations.java#L89-L95 |
smartsheet-platform/smartsheet-java-sdk | src/main/java/com/smartsheet/api/internal/SheetRowResourcesImpl.java | SheetRowResourcesImpl.moveRows | public CopyOrMoveRowResult moveRows(Long sheetId, EnumSet<RowMoveInclusion> includes, Boolean ignoreRowsNotFound, CopyOrMoveRowDirective moveParameters) throws SmartsheetException {
String path = "sheets/" + sheetId +"/rows/move";
HashMap<String, Object> parameters = new HashMap<String, Object>();
parameters.put("include", QueryUtil.generateCommaSeparatedList(includes));
if (ignoreRowsNotFound != null){
parameters.put("ignoreRowsNotFound", ignoreRowsNotFound.toString());
}
path += QueryUtil.generateUrl(null, parameters);
return this.postAndReceiveRowObject(path, moveParameters);
} | java | public CopyOrMoveRowResult moveRows(Long sheetId, EnumSet<RowMoveInclusion> includes, Boolean ignoreRowsNotFound, CopyOrMoveRowDirective moveParameters) throws SmartsheetException {
String path = "sheets/" + sheetId +"/rows/move";
HashMap<String, Object> parameters = new HashMap<String, Object>();
parameters.put("include", QueryUtil.generateCommaSeparatedList(includes));
if (ignoreRowsNotFound != null){
parameters.put("ignoreRowsNotFound", ignoreRowsNotFound.toString());
}
path += QueryUtil.generateUrl(null, parameters);
return this.postAndReceiveRowObject(path, moveParameters);
} | [
"public",
"CopyOrMoveRowResult",
"moveRows",
"(",
"Long",
"sheetId",
",",
"EnumSet",
"<",
"RowMoveInclusion",
">",
"includes",
",",
"Boolean",
"ignoreRowsNotFound",
",",
"CopyOrMoveRowDirective",
"moveParameters",
")",
"throws",
"SmartsheetException",
"{",
"String",
"pa... | Moves Row(s) from the Sheet specified in the URL to (the bottom of) another sheet.
It mirrors to the following Smartsheet REST API method: POST /sheets/{sheetId}/rows/move
Exceptions:
IllegalArgumentException : if any argument is null, or path is empty string
InvalidRequestException : if there is any problem with the REST API request
AuthorizationException : if there is any problem with the REST API authorization(access token)
ServiceUnavailableException : if the REST API service is not available (possibly due to rate limiting)
SmartsheetRestException : if there is any other REST API related error occurred during the operation
SmartsheetException : if there is any other error occurred during the operation
@param sheetId the sheet ID to move
@param includes the parameters to include
@param ignoreRowsNotFound optional,specifying row Ids that do not exist within the source sheet
@param moveParameters CopyOrMoveRowDirective object
@return the result object
@throws SmartsheetException the smartsheet exception | [
"Moves",
"Row",
"(",
"s",
")",
"from",
"the",
"Sheet",
"specified",
"in",
"the",
"URL",
"to",
"(",
"the",
"bottom",
"of",
")",
"another",
"sheet",
"."
] | train | https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/SheetRowResourcesImpl.java#L323-L334 |
Alluxio/alluxio | core/server/worker/src/main/java/alluxio/worker/block/meta/StorageDir.java | StorageDir.removeBlockMeta | public void removeBlockMeta(BlockMeta blockMeta) throws BlockDoesNotExistException {
Preconditions.checkNotNull(blockMeta, "blockMeta");
long blockId = blockMeta.getBlockId();
BlockMeta deletedBlockMeta = mBlockIdToBlockMap.remove(blockId);
if (deletedBlockMeta == null) {
throw new BlockDoesNotExistException(ExceptionMessage.BLOCK_META_NOT_FOUND, blockId);
}
reclaimSpace(blockMeta.getBlockSize(), true);
} | java | public void removeBlockMeta(BlockMeta blockMeta) throws BlockDoesNotExistException {
Preconditions.checkNotNull(blockMeta, "blockMeta");
long blockId = blockMeta.getBlockId();
BlockMeta deletedBlockMeta = mBlockIdToBlockMap.remove(blockId);
if (deletedBlockMeta == null) {
throw new BlockDoesNotExistException(ExceptionMessage.BLOCK_META_NOT_FOUND, blockId);
}
reclaimSpace(blockMeta.getBlockSize(), true);
} | [
"public",
"void",
"removeBlockMeta",
"(",
"BlockMeta",
"blockMeta",
")",
"throws",
"BlockDoesNotExistException",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"blockMeta",
",",
"\"blockMeta\"",
")",
";",
"long",
"blockId",
"=",
"blockMeta",
".",
"getBlockId",
"(",... | Removes a block from this storage dir.
@param blockMeta the metadata of the block
@throws BlockDoesNotExistException if no block is found | [
"Removes",
"a",
"block",
"from",
"this",
"storage",
"dir",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/worker/src/main/java/alluxio/worker/block/meta/StorageDir.java#L329-L337 |
craftercms/commons | utilities/src/main/java/org/craftercms/commons/i10n/I10nUtils.java | I10nUtils.getLocalizedMessage | public static String getLocalizedMessage(String bundleName, String key, Object... args) {
return getLocalizedMessage(ResourceBundle.getBundle(bundleName), key, args);
} | java | public static String getLocalizedMessage(String bundleName, String key, Object... args) {
return getLocalizedMessage(ResourceBundle.getBundle(bundleName), key, args);
} | [
"public",
"static",
"String",
"getLocalizedMessage",
"(",
"String",
"bundleName",
",",
"String",
"key",
",",
"Object",
"...",
"args",
")",
"{",
"return",
"getLocalizedMessage",
"(",
"ResourceBundle",
".",
"getBundle",
"(",
"bundleName",
")",
",",
"key",
",",
"... | Returns a formatted, localized message according to the specified resource bundle and key.
@param bundleName the name of the resource bundle where the message format should be
@param key the key of the message format
@param args the args of the message format
@return the formatted, localized message | [
"Returns",
"a",
"formatted",
"localized",
"message",
"according",
"to",
"the",
"specified",
"resource",
"bundle",
"and",
"key",
"."
] | train | https://github.com/craftercms/commons/blob/3074fe49e56c2a4aae0832f40b17ae563335dc83/utilities/src/main/java/org/craftercms/commons/i10n/I10nUtils.java#L46-L48 |
liferay/com-liferay-commerce | commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceCountryPersistenceImpl.java | CommerceCountryPersistenceImpl.removeByG_N | @Override
public CommerceCountry removeByG_N(long groupId, int numericISOCode)
throws NoSuchCountryException {
CommerceCountry commerceCountry = findByG_N(groupId, numericISOCode);
return remove(commerceCountry);
} | java | @Override
public CommerceCountry removeByG_N(long groupId, int numericISOCode)
throws NoSuchCountryException {
CommerceCountry commerceCountry = findByG_N(groupId, numericISOCode);
return remove(commerceCountry);
} | [
"@",
"Override",
"public",
"CommerceCountry",
"removeByG_N",
"(",
"long",
"groupId",
",",
"int",
"numericISOCode",
")",
"throws",
"NoSuchCountryException",
"{",
"CommerceCountry",
"commerceCountry",
"=",
"findByG_N",
"(",
"groupId",
",",
"numericISOCode",
")",
";",
... | Removes the commerce country where groupId = ? and numericISOCode = ? from the database.
@param groupId the group ID
@param numericISOCode the numeric iso code
@return the commerce country that was removed | [
"Removes",
"the",
"commerce",
"country",
"where",
"groupId",
"=",
"?",
";",
"and",
"numericISOCode",
"=",
"?",
";",
"from",
"the",
"database",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceCountryPersistenceImpl.java#L2389-L2395 |
glyptodon/guacamole-client | guacamole/src/main/java/org/apache/guacamole/extension/Extension.java | Extension.getClassPathResources | private Map<String, Resource> getClassPathResources(String mimetype, Collection<String> paths) {
// If no paths are provided, just return an empty map
if (paths == null)
return Collections.<String, Resource>emptyMap();
// Add classpath resource for each path provided
Map<String, Resource> resources = new HashMap<String, Resource>(paths.size());
for (String path : paths)
resources.put(path, new ClassPathResource(classLoader, mimetype, path));
// Callers should not rely on modifying the result
return Collections.unmodifiableMap(resources);
} | java | private Map<String, Resource> getClassPathResources(String mimetype, Collection<String> paths) {
// If no paths are provided, just return an empty map
if (paths == null)
return Collections.<String, Resource>emptyMap();
// Add classpath resource for each path provided
Map<String, Resource> resources = new HashMap<String, Resource>(paths.size());
for (String path : paths)
resources.put(path, new ClassPathResource(classLoader, mimetype, path));
// Callers should not rely on modifying the result
return Collections.unmodifiableMap(resources);
} | [
"private",
"Map",
"<",
"String",
",",
"Resource",
">",
"getClassPathResources",
"(",
"String",
"mimetype",
",",
"Collection",
"<",
"String",
">",
"paths",
")",
"{",
"// If no paths are provided, just return an empty map ",
"if",
"(",
"paths",
"==",
"null",
")",
"r... | Returns a new map of all resources corresponding to the collection of
paths provided. Each resource will be associated with the given
mimetype, and stored in the map using its path as the key.
@param mimetype
The mimetype to associate with each resource.
@param paths
The paths corresponding to the resources desired.
@return
A new, unmodifiable map of resources corresponding to the
collection of paths provided, where the key of each entry in the
map is the path for the resource stored in that entry. | [
"Returns",
"a",
"new",
"map",
"of",
"all",
"resources",
"corresponding",
"to",
"the",
"collection",
"of",
"paths",
"provided",
".",
"Each",
"resource",
"will",
"be",
"associated",
"with",
"the",
"given",
"mimetype",
"and",
"stored",
"in",
"the",
"map",
"usin... | train | https://github.com/glyptodon/guacamole-client/blob/ea1b10e9d1e3f1fa640dff2ca64d61b44bf1ace9/guacamole/src/main/java/org/apache/guacamole/extension/Extension.java#L140-L154 |
gallandarakhneorg/afc | core/maths/mathgeom/tobeincluded/src/d3/continuous/Path3f.java | Path3f.getClosestPointTo | public static Point3D getClosestPointTo(PathIterator3f pathIterator, double x, double y, double z) {
Point3D closest = null;
double bestDist = Double.POSITIVE_INFINITY;
Point3D candidate;
AbstractPathElement3F pe = pathIterator.next();
Path3f subPath;
if (pe.type != PathElementType.MOVE_TO) {
throw new IllegalArgumentException("missing initial moveto in path definition");
}
candidate = new Point3f(pe.getToX(), pe.getToY(), pe.getToZ());
while (pathIterator.hasNext()) {
pe = pathIterator.next();
candidate = null;
switch(pe.type) {
case MOVE_TO:
candidate = new Point3f(pe.getToX(), pe.getToY(), pe.getToZ());
break;
case LINE_TO:
candidate = (new Segment3f(pe.getFromX(), pe.getFromY(), pe.getFromZ(), pe.getToX(), pe.getToY(), pe.getToZ())).getClosestPointTo(new Point3f(x,y,z));
break;
case CLOSE:
if (!pe.isEmpty()) {
candidate = (new Segment3f(pe.getFromX(), pe.getFromY(), pe.getFromZ(), pe.getToX(), pe.getToY(), pe.getToZ())).getClosestPointTo(new Point3f(x,y,z));
}
break;
case QUAD_TO:
subPath = new Path3f();
subPath.moveTo(pe.getFromX(), pe.getFromY(), pe.getFromZ());
subPath.quadTo(
pe.getCtrlX1(), pe.getCtrlY1(), pe.getCtrlZ1(),
pe.getToX(), pe.getToY(), pe.getToZ());
candidate = subPath.getClosestPointTo(new Point3f(x,y,z));
break;
case CURVE_TO:
subPath = new Path3f();
subPath.moveTo(pe.getFromX(), pe.getFromY(), pe.getFromZ());
subPath.curveTo(
pe.getCtrlX1(), pe.getCtrlY1(), pe.getCtrlZ1(),
pe.getCtrlX2(), pe.getCtrlY2(), pe.getCtrlZ2(),
pe.getToX(), pe.getToY(), pe.getToZ());
candidate = subPath.getClosestPointTo(new Point3f(x,y,z));
break;
default:
throw new IllegalStateException(
pe.type==null ? null : pe.type.toString());
}
if (candidate!=null) {
double d = candidate.getDistanceSquared(new Point3f(x,y,z));
if (d<bestDist) {
bestDist = d;
closest = candidate;
}
}
}
return closest;
} | java | public static Point3D getClosestPointTo(PathIterator3f pathIterator, double x, double y, double z) {
Point3D closest = null;
double bestDist = Double.POSITIVE_INFINITY;
Point3D candidate;
AbstractPathElement3F pe = pathIterator.next();
Path3f subPath;
if (pe.type != PathElementType.MOVE_TO) {
throw new IllegalArgumentException("missing initial moveto in path definition");
}
candidate = new Point3f(pe.getToX(), pe.getToY(), pe.getToZ());
while (pathIterator.hasNext()) {
pe = pathIterator.next();
candidate = null;
switch(pe.type) {
case MOVE_TO:
candidate = new Point3f(pe.getToX(), pe.getToY(), pe.getToZ());
break;
case LINE_TO:
candidate = (new Segment3f(pe.getFromX(), pe.getFromY(), pe.getFromZ(), pe.getToX(), pe.getToY(), pe.getToZ())).getClosestPointTo(new Point3f(x,y,z));
break;
case CLOSE:
if (!pe.isEmpty()) {
candidate = (new Segment3f(pe.getFromX(), pe.getFromY(), pe.getFromZ(), pe.getToX(), pe.getToY(), pe.getToZ())).getClosestPointTo(new Point3f(x,y,z));
}
break;
case QUAD_TO:
subPath = new Path3f();
subPath.moveTo(pe.getFromX(), pe.getFromY(), pe.getFromZ());
subPath.quadTo(
pe.getCtrlX1(), pe.getCtrlY1(), pe.getCtrlZ1(),
pe.getToX(), pe.getToY(), pe.getToZ());
candidate = subPath.getClosestPointTo(new Point3f(x,y,z));
break;
case CURVE_TO:
subPath = new Path3f();
subPath.moveTo(pe.getFromX(), pe.getFromY(), pe.getFromZ());
subPath.curveTo(
pe.getCtrlX1(), pe.getCtrlY1(), pe.getCtrlZ1(),
pe.getCtrlX2(), pe.getCtrlY2(), pe.getCtrlZ2(),
pe.getToX(), pe.getToY(), pe.getToZ());
candidate = subPath.getClosestPointTo(new Point3f(x,y,z));
break;
default:
throw new IllegalStateException(
pe.type==null ? null : pe.type.toString());
}
if (candidate!=null) {
double d = candidate.getDistanceSquared(new Point3f(x,y,z));
if (d<bestDist) {
bestDist = d;
closest = candidate;
}
}
}
return closest;
} | [
"public",
"static",
"Point3D",
"getClosestPointTo",
"(",
"PathIterator3f",
"pathIterator",
",",
"double",
"x",
",",
"double",
"y",
",",
"double",
"z",
")",
"{",
"Point3D",
"closest",
"=",
"null",
";",
"double",
"bestDist",
"=",
"Double",
".",
"POSITIVE_INFINIT... | Replies the point on the path that is closest to the given point.
<p>
<strong>CAUTION:</strong> This function works only on path iterators
that are replying polyline primitives, ie. if the
{@link PathIterator3f#isPolyline()} of <var>pi</var> is replying
<code>true</code>.
{@link #getClosestPointTo(Point3D)} avoids this restriction.
@param pi is the iterator on the elements of the path.
@param x
@param y
@param z
@return the closest point on the shape; or the point itself
if it is inside the shape. | [
"Replies",
"the",
"point",
"on",
"the",
"path",
"that",
"is",
"closest",
"to",
"the",
"given",
"point",
".",
"<p",
">",
"<strong",
">",
"CAUTION",
":",
"<",
"/",
"strong",
">",
"This",
"function",
"works",
"only",
"on",
"path",
"iterators",
"that",
"ar... | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/Path3f.java#L76-L142 |
johnkil/Print | print/src/main/java/com/github/johnkil/print/PrintViewUtils.java | PrintViewUtils.initIcon | static PrintDrawable initIcon(Context context, AttributeSet attrs, boolean inEditMode) {
PrintDrawable.Builder iconBuilder = new PrintDrawable.Builder(context);
if (attrs != null) {
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.PrintView);
if (a.hasValue(R.styleable.PrintView_print_iconText)) {
String iconText = a.getString(R.styleable.PrintView_print_iconText);
iconBuilder.iconText(iconText);
}
if (a.hasValue(R.styleable.PrintView_print_iconCode)) {
int iconCode = a.getInteger(R.styleable.PrintView_print_iconCode, 0);
iconBuilder.iconCode(iconCode);
}
if (!inEditMode && a.hasValue(R.styleable.PrintView_print_iconFont)) {
String iconFontPath = a.getString(R.styleable.PrintView_print_iconFont);
iconBuilder.iconFont(TypefaceManager.load(context.getAssets(), iconFontPath));
}
if (a.hasValue(R.styleable.PrintView_print_iconColor)) {
ColorStateList iconColor = a.getColorStateList(R.styleable.PrintView_print_iconColor);
iconBuilder.iconColor(iconColor);
}
int iconSize = a.getDimensionPixelSize(R.styleable.PrintView_print_iconSize, 0);
iconBuilder.iconSize(TypedValue.COMPLEX_UNIT_PX, iconSize);
iconBuilder.inEditMode(inEditMode);
a.recycle();
}
return iconBuilder.build();
} | java | static PrintDrawable initIcon(Context context, AttributeSet attrs, boolean inEditMode) {
PrintDrawable.Builder iconBuilder = new PrintDrawable.Builder(context);
if (attrs != null) {
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.PrintView);
if (a.hasValue(R.styleable.PrintView_print_iconText)) {
String iconText = a.getString(R.styleable.PrintView_print_iconText);
iconBuilder.iconText(iconText);
}
if (a.hasValue(R.styleable.PrintView_print_iconCode)) {
int iconCode = a.getInteger(R.styleable.PrintView_print_iconCode, 0);
iconBuilder.iconCode(iconCode);
}
if (!inEditMode && a.hasValue(R.styleable.PrintView_print_iconFont)) {
String iconFontPath = a.getString(R.styleable.PrintView_print_iconFont);
iconBuilder.iconFont(TypefaceManager.load(context.getAssets(), iconFontPath));
}
if (a.hasValue(R.styleable.PrintView_print_iconColor)) {
ColorStateList iconColor = a.getColorStateList(R.styleable.PrintView_print_iconColor);
iconBuilder.iconColor(iconColor);
}
int iconSize = a.getDimensionPixelSize(R.styleable.PrintView_print_iconSize, 0);
iconBuilder.iconSize(TypedValue.COMPLEX_UNIT_PX, iconSize);
iconBuilder.inEditMode(inEditMode);
a.recycle();
}
return iconBuilder.build();
} | [
"static",
"PrintDrawable",
"initIcon",
"(",
"Context",
"context",
",",
"AttributeSet",
"attrs",
",",
"boolean",
"inEditMode",
")",
"{",
"PrintDrawable",
".",
"Builder",
"iconBuilder",
"=",
"new",
"PrintDrawable",
".",
"Builder",
"(",
"context",
")",
";",
"if",
... | Initialization of icon for print views.
@param context The Context the view is running in, through which it can access the current
theme, resources, etc.
@param attrs The attributes of the XML tag that is inflating the view.
@param inEditMode Indicates whether this View is currently in edit mode.
@return The icon to display. | [
"Initialization",
"of",
"icon",
"for",
"print",
"views",
"."
] | train | https://github.com/johnkil/Print/blob/535f3ca466289c491b8c29f41c32e72f0bb95127/print/src/main/java/com/github/johnkil/print/PrintViewUtils.java#L36-L71 |
Stratio/stratio-cassandra | src/java/org/apache/cassandra/repair/StreamingRepairTask.java | StreamingRepairTask.onFailure | public void onFailure(Throwable t)
{
MessagingService.instance().sendOneWay(new SyncComplete(desc, request.src, request.dst, false).createMessage(), request.initiator);
} | java | public void onFailure(Throwable t)
{
MessagingService.instance().sendOneWay(new SyncComplete(desc, request.src, request.dst, false).createMessage(), request.initiator);
} | [
"public",
"void",
"onFailure",
"(",
"Throwable",
"t",
")",
"{",
"MessagingService",
".",
"instance",
"(",
")",
".",
"sendOneWay",
"(",
"new",
"SyncComplete",
"(",
"desc",
",",
"request",
".",
"src",
",",
"request",
".",
"dst",
",",
"false",
")",
".",
"... | If we failed on either stream in or out, reply fail to the initiator. | [
"If",
"we",
"failed",
"on",
"either",
"stream",
"in",
"or",
"out",
"reply",
"fail",
"to",
"the",
"initiator",
"."
] | train | https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/repair/StreamingRepairTask.java#L103-L106 |
io7m/jaffirm | com.io7m.jaffirm.core/src/main/java/com/io7m/jaffirm/core/Postconditions.java | Postconditions.checkPostcondition | public static <T> T checkPostcondition(
final T value,
final Predicate<T> predicate,
final Function<T, String> describer)
{
final boolean ok;
try {
ok = predicate.test(value);
} catch (final Throwable e) {
throw failed(e, value, singleViolation(failedPredicate(e)));
}
return innerCheck(value, ok, describer);
} | java | public static <T> T checkPostcondition(
final T value,
final Predicate<T> predicate,
final Function<T, String> describer)
{
final boolean ok;
try {
ok = predicate.test(value);
} catch (final Throwable e) {
throw failed(e, value, singleViolation(failedPredicate(e)));
}
return innerCheck(value, ok, describer);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"checkPostcondition",
"(",
"final",
"T",
"value",
",",
"final",
"Predicate",
"<",
"T",
">",
"predicate",
",",
"final",
"Function",
"<",
"T",
",",
"String",
">",
"describer",
")",
"{",
"final",
"boolean",
"ok",
";... | <p>Evaluate the given {@code predicate} using {@code value} as input.</p>
<p>The function throws {@link PostconditionViolationException} if the
predicate is false.</p>
@param value The value
@param predicate The predicate
@param describer A describer for the predicate
@param <T> The type of values
@return value
@throws PostconditionViolationException If the predicate is false | [
"<p",
">",
"Evaluate",
"the",
"given",
"{",
"@code",
"predicate",
"}",
"using",
"{",
"@code",
"value",
"}",
"as",
"input",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/io7m/jaffirm/blob/c97d246242d381e48832838737418cfe4cb57b4d/com.io7m.jaffirm.core/src/main/java/com/io7m/jaffirm/core/Postconditions.java#L198-L211 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java | FileUtil.subPath | public static String subPath(String dirPath, String filePath) {
if (StrUtil.isNotEmpty(dirPath) && StrUtil.isNotEmpty(filePath)) {
dirPath = StrUtil.removeSuffix(normalize(dirPath), "/");
filePath = normalize(filePath);
final String result = StrUtil.removePrefixIgnoreCase(filePath, dirPath);
return StrUtil.removePrefix(result, "/");
}
return filePath;
} | java | public static String subPath(String dirPath, String filePath) {
if (StrUtil.isNotEmpty(dirPath) && StrUtil.isNotEmpty(filePath)) {
dirPath = StrUtil.removeSuffix(normalize(dirPath), "/");
filePath = normalize(filePath);
final String result = StrUtil.removePrefixIgnoreCase(filePath, dirPath);
return StrUtil.removePrefix(result, "/");
}
return filePath;
} | [
"public",
"static",
"String",
"subPath",
"(",
"String",
"dirPath",
",",
"String",
"filePath",
")",
"{",
"if",
"(",
"StrUtil",
".",
"isNotEmpty",
"(",
"dirPath",
")",
"&&",
"StrUtil",
".",
"isNotEmpty",
"(",
"filePath",
")",
")",
"{",
"dirPath",
"=",
"Str... | 获得相对子路径,忽略大小写
栗子:
<pre>
dirPath: d:/aaa/bbb filePath: d:/aaa/bbb/ccc =》 ccc
dirPath: d:/Aaa/bbb filePath: d:/aaa/bbb/ccc.txt =》 ccc.txt
dirPath: d:/Aaa/bbb filePath: d:/aaa/bbb/ =》 ""
</pre>
@param dirPath 父路径
@param filePath 文件路径
@return 相对子路径 | [
"获得相对子路径,忽略大小写"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L1622-L1632 |
dbracewell/mango | src/main/java/com/davidbracewell/json/JsonReader.java | JsonReader.nextKeyValue | public Tuple2<String, Val> nextKeyValue() throws IOException {
if (currentValue.getKey() != NAME) {
throw new IOException("Expecting NAME, but found " + jsonTokenToStructuredElement(null));
}
String name = currentValue.getValue().asString();
consume();
return Tuple2.of(name, nextValue());
} | java | public Tuple2<String, Val> nextKeyValue() throws IOException {
if (currentValue.getKey() != NAME) {
throw new IOException("Expecting NAME, but found " + jsonTokenToStructuredElement(null));
}
String name = currentValue.getValue().asString();
consume();
return Tuple2.of(name, nextValue());
} | [
"public",
"Tuple2",
"<",
"String",
",",
"Val",
">",
"nextKeyValue",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"currentValue",
".",
"getKey",
"(",
")",
"!=",
"NAME",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"Expecting NAME, but found \"",
"+",... | Reads the next key-value pair
@return The next key value pair
@throws IOException Something went wrong reading | [
"Reads",
"the",
"next",
"key",
"-",
"value",
"pair"
] | train | https://github.com/dbracewell/mango/blob/2cec08826f1fccd658694dd03abce10fc97618ec/src/main/java/com/davidbracewell/json/JsonReader.java#L458-L465 |
intive-FDV/DynamicJasper | src/main/java/ar/com/fdvs/dj/core/layout/CrossTabColorShema.java | CrossTabColorShema.setTotalColorForColumn | public void setTotalColorForColumn(int column, Color color){
int map = (colors.length-1) - column;
colors[map][colors[0].length-1]=color;
} | java | public void setTotalColorForColumn(int column, Color color){
int map = (colors.length-1) - column;
colors[map][colors[0].length-1]=color;
} | [
"public",
"void",
"setTotalColorForColumn",
"(",
"int",
"column",
",",
"Color",
"color",
")",
"{",
"int",
"map",
"=",
"(",
"colors",
".",
"length",
"-",
"1",
")",
"-",
"column",
";",
"colors",
"[",
"map",
"]",
"[",
"colors",
"[",
"0",
"]",
".",
"le... | Set the color for each total for the column
@param column the number of the column (starting from 1)
@param color | [
"Set",
"the",
"color",
"for",
"each",
"total",
"for",
"the",
"column"
] | train | https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/core/layout/CrossTabColorShema.java#L82-L85 |
google/error-prone | check_api/src/main/java/com/google/errorprone/matchers/Matchers.java | Matchers.variableType | public static Matcher<VariableTree> variableType(final Matcher<Tree> treeMatcher) {
return new Matcher<VariableTree>() {
@Override
public boolean matches(VariableTree variableTree, VisitorState state) {
return treeMatcher.matches(variableTree.getType(), state);
}
};
} | java | public static Matcher<VariableTree> variableType(final Matcher<Tree> treeMatcher) {
return new Matcher<VariableTree>() {
@Override
public boolean matches(VariableTree variableTree, VisitorState state) {
return treeMatcher.matches(variableTree.getType(), state);
}
};
} | [
"public",
"static",
"Matcher",
"<",
"VariableTree",
">",
"variableType",
"(",
"final",
"Matcher",
"<",
"Tree",
">",
"treeMatcher",
")",
"{",
"return",
"new",
"Matcher",
"<",
"VariableTree",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"boolean",
"matches",... | Matches on the type of a VariableTree AST node.
@param treeMatcher A matcher on the type of the variable. | [
"Matches",
"on",
"the",
"type",
"of",
"a",
"VariableTree",
"AST",
"node",
"."
] | train | https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/check_api/src/main/java/com/google/errorprone/matchers/Matchers.java#L1070-L1077 |
sdaschner/jaxrs-analyzer | src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/bytecode/simulation/InjectableArgumentMethodSimulator.java | InjectableArgumentMethodSimulator.injectArguments | private void injectArguments(final List<Element> arguments, final MethodIdentifier identifier) {
final boolean staticMethod = identifier.isStaticMethod();
final int startIndex = staticMethod ? 0 : 1;
final int endIndex = staticMethod ? arguments.size() - 1 : arguments.size();
IntStream.rangeClosed(startIndex, endIndex).forEach(i -> localVariables.put(i, arguments.get(staticMethod ? i : i - 1)));
} | java | private void injectArguments(final List<Element> arguments, final MethodIdentifier identifier) {
final boolean staticMethod = identifier.isStaticMethod();
final int startIndex = staticMethod ? 0 : 1;
final int endIndex = staticMethod ? arguments.size() - 1 : arguments.size();
IntStream.rangeClosed(startIndex, endIndex).forEach(i -> localVariables.put(i, arguments.get(staticMethod ? i : i - 1)));
} | [
"private",
"void",
"injectArguments",
"(",
"final",
"List",
"<",
"Element",
">",
"arguments",
",",
"final",
"MethodIdentifier",
"identifier",
")",
"{",
"final",
"boolean",
"staticMethod",
"=",
"identifier",
".",
"isStaticMethod",
"(",
")",
";",
"final",
"int",
... | Injects the arguments of the method invocation to the local variables.
@param arguments The argument values | [
"Injects",
"the",
"arguments",
"of",
"the",
"method",
"invocation",
"to",
"the",
"local",
"variables",
"."
] | train | https://github.com/sdaschner/jaxrs-analyzer/blob/4ac62942202d05632977d6c14d3cd7e2d27e2b9b/src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/bytecode/simulation/InjectableArgumentMethodSimulator.java#L75-L81 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/PoolOperations.java | PoolOperations.removeNodesFromPool | public void removeNodesFromPool(String poolId, Collection<ComputeNode> computeNodes)
throws BatchErrorException, IOException {
removeNodesFromPool(poolId, computeNodes, null, null, null);
} | java | public void removeNodesFromPool(String poolId, Collection<ComputeNode> computeNodes)
throws BatchErrorException, IOException {
removeNodesFromPool(poolId, computeNodes, null, null, null);
} | [
"public",
"void",
"removeNodesFromPool",
"(",
"String",
"poolId",
",",
"Collection",
"<",
"ComputeNode",
">",
"computeNodes",
")",
"throws",
"BatchErrorException",
",",
"IOException",
"{",
"removeNodesFromPool",
"(",
"poolId",
",",
"computeNodes",
",",
"null",
",",
... | Removes the specified compute nodes from the specified pool.
@param poolId
The ID of the pool.
@param computeNodes
The compute nodes to remove from the pool.
@throws BatchErrorException
Exception thrown when an error response is received from the
Batch service.
@throws IOException
Exception thrown when there is an error in
serialization/deserialization of data sent to/received from the
Batch service. | [
"Removes",
"the",
"specified",
"compute",
"nodes",
"from",
"the",
"specified",
"pool",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/PoolOperations.java#L930-L933 |
jmeetsma/Iglu-Util | src/main/java/org/ijsberg/iglu/util/misc/StringSupport.java | StringSupport.writeToOutputStream | public static void writeToOutputStream(String s, OutputStream output) throws IOException {
writeToOutputStream(s, output, null);
} | java | public static void writeToOutputStream(String s, OutputStream output) throws IOException {
writeToOutputStream(s, output, null);
} | [
"public",
"static",
"void",
"writeToOutputStream",
"(",
"String",
"s",
",",
"OutputStream",
"output",
")",
"throws",
"IOException",
"{",
"writeToOutputStream",
"(",
"s",
",",
"output",
",",
"null",
")",
";",
"}"
] | Writes the contents of a string to an output stream.
@param s
@param output
@throws IOException | [
"Writes",
"the",
"contents",
"of",
"a",
"string",
"to",
"an",
"output",
"stream",
"."
] | train | https://github.com/jmeetsma/Iglu-Util/blob/971eb022115247b1e34dc26dd02e7e621e29e910/src/main/java/org/ijsberg/iglu/util/misc/StringSupport.java#L471-L473 |
alibaba/vlayout | vlayout/src/main/java/com/alibaba/android/vlayout/SortedList.java | SortedList.updateItemAt | public void updateItemAt(int index, T item) {
final T existing = get(index);
// assume changed if the same object is given back
boolean contentsChanged = existing == item || !mCallback.areContentsTheSame(existing, item);
if (existing != item) {
// different items, we can use comparison and may avoid lookup
final int cmp = mCallback.compare(existing, item);
if (cmp == 0) {
mData[index] = item;
if (contentsChanged) {
mCallback.onChanged(index, 1);
}
return;
}
}
if (contentsChanged) {
mCallback.onChanged(index, 1);
}
// TODO this done in 1 pass to avoid shifting twice.
removeItemAtIndex(index, false);
int newIndex = add(item, false);
if (index != newIndex) {
mCallback.onMoved(index, newIndex);
}
} | java | public void updateItemAt(int index, T item) {
final T existing = get(index);
// assume changed if the same object is given back
boolean contentsChanged = existing == item || !mCallback.areContentsTheSame(existing, item);
if (existing != item) {
// different items, we can use comparison and may avoid lookup
final int cmp = mCallback.compare(existing, item);
if (cmp == 0) {
mData[index] = item;
if (contentsChanged) {
mCallback.onChanged(index, 1);
}
return;
}
}
if (contentsChanged) {
mCallback.onChanged(index, 1);
}
// TODO this done in 1 pass to avoid shifting twice.
removeItemAtIndex(index, false);
int newIndex = add(item, false);
if (index != newIndex) {
mCallback.onMoved(index, newIndex);
}
} | [
"public",
"void",
"updateItemAt",
"(",
"int",
"index",
",",
"T",
"item",
")",
"{",
"final",
"T",
"existing",
"=",
"get",
"(",
"index",
")",
";",
"// assume changed if the same object is given back",
"boolean",
"contentsChanged",
"=",
"existing",
"==",
"item",
"|... | Updates the item at the given index and calls {@link Callback#onChanged(int, int)} and/or
{@link Callback#onMoved(int, int)} if necessary.
<p>
You can use this method if you need to change an existing Item such that its position in the
list may change.
<p>
If the new object is a different object (<code>get(index) != item</code>) and
{@link Callback#areContentsTheSame(Object, Object)} returns <code>true</code>, SortedList
avoids calling {@link Callback#onChanged(int, int)} otherwise it calls
{@link Callback#onChanged(int, int)}.
<p>
If the new position of the item is different than the provided <code>index</code>,
SortedList
calls {@link Callback#onMoved(int, int)}.
@param index The index of the item to replace
@param item The item to replace the item at the given Index.
@see #add(Object) | [
"Updates",
"the",
"item",
"at",
"the",
"given",
"index",
"and",
"calls",
"{",
"@link",
"Callback#onChanged",
"(",
"int",
"int",
")",
"}",
"and",
"/",
"or",
"{",
"@link",
"Callback#onMoved",
"(",
"int",
"int",
")",
"}",
"if",
"necessary",
".",
"<p",
">"... | train | https://github.com/alibaba/vlayout/blob/8a5a51d9d2eeb91fed2ee331a4cf3496282452ce/vlayout/src/main/java/com/alibaba/android/vlayout/SortedList.java#L268-L292 |
alkacon/opencms-core | src-gwt/org/opencms/ade/sitemap/client/control/CmsSitemapController.java | CmsSitemapController.makeNewEntry | protected void makeNewEntry(
final CmsClientSitemapEntry parent,
final I_CmsSimpleCallback<CmsClientSitemapEntry> callback) {
ensureUniqueName(parent, NEW_ENTRY_NAME, new I_CmsSimpleCallback<String>() {
public void execute(String urlName) {
CmsClientSitemapEntry newEntry = new CmsClientSitemapEntry();
//newEntry.setTitle(urlName);
newEntry.setName(urlName);
String sitePath = parent.getSitePath() + urlName + "/";
newEntry.setSitePath(sitePath);
newEntry.setVfsPath(null);
newEntry.setPosition(0);
newEntry.setNew(true);
newEntry.setInNavigation(true);
newEntry.setResourceTypeName("folder");
newEntry.getOwnProperties().put(
CmsClientProperty.PROPERTY_TITLE,
new CmsClientProperty(CmsClientProperty.PROPERTY_TITLE, NEW_ENTRY_NAME, NEW_ENTRY_NAME));
callback.execute(newEntry);
}
});
} | java | protected void makeNewEntry(
final CmsClientSitemapEntry parent,
final I_CmsSimpleCallback<CmsClientSitemapEntry> callback) {
ensureUniqueName(parent, NEW_ENTRY_NAME, new I_CmsSimpleCallback<String>() {
public void execute(String urlName) {
CmsClientSitemapEntry newEntry = new CmsClientSitemapEntry();
//newEntry.setTitle(urlName);
newEntry.setName(urlName);
String sitePath = parent.getSitePath() + urlName + "/";
newEntry.setSitePath(sitePath);
newEntry.setVfsPath(null);
newEntry.setPosition(0);
newEntry.setNew(true);
newEntry.setInNavigation(true);
newEntry.setResourceTypeName("folder");
newEntry.getOwnProperties().put(
CmsClientProperty.PROPERTY_TITLE,
new CmsClientProperty(CmsClientProperty.PROPERTY_TITLE, NEW_ENTRY_NAME, NEW_ENTRY_NAME));
callback.execute(newEntry);
}
});
} | [
"protected",
"void",
"makeNewEntry",
"(",
"final",
"CmsClientSitemapEntry",
"parent",
",",
"final",
"I_CmsSimpleCallback",
"<",
"CmsClientSitemapEntry",
">",
"callback",
")",
"{",
"ensureUniqueName",
"(",
"parent",
",",
"NEW_ENTRY_NAME",
",",
"new",
"I_CmsSimpleCallback... | Creates a new client sitemap entry bean to use for the RPC call which actually creates the entry on the server side.<p>
@param parent the parent entry
@param callback the callback to execute | [
"Creates",
"a",
"new",
"client",
"sitemap",
"entry",
"bean",
"to",
"use",
"for",
"the",
"RPC",
"call",
"which",
"actually",
"creates",
"the",
"entry",
"on",
"the",
"server",
"side",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/sitemap/client/control/CmsSitemapController.java#L2266-L2291 |
liferay/com-liferay-commerce | commerce-product-type-grouped-service/src/main/java/com/liferay/commerce/product/type/grouped/service/persistence/impl/CPDefinitionGroupedEntryPersistenceImpl.java | CPDefinitionGroupedEntryPersistenceImpl.findByUUID_G | @Override
public CPDefinitionGroupedEntry findByUUID_G(String uuid, long groupId)
throws NoSuchCPDefinitionGroupedEntryException {
CPDefinitionGroupedEntry cpDefinitionGroupedEntry = fetchByUUID_G(uuid,
groupId);
if (cpDefinitionGroupedEntry == 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 NoSuchCPDefinitionGroupedEntryException(msg.toString());
}
return cpDefinitionGroupedEntry;
} | java | @Override
public CPDefinitionGroupedEntry findByUUID_G(String uuid, long groupId)
throws NoSuchCPDefinitionGroupedEntryException {
CPDefinitionGroupedEntry cpDefinitionGroupedEntry = fetchByUUID_G(uuid,
groupId);
if (cpDefinitionGroupedEntry == 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 NoSuchCPDefinitionGroupedEntryException(msg.toString());
}
return cpDefinitionGroupedEntry;
} | [
"@",
"Override",
"public",
"CPDefinitionGroupedEntry",
"findByUUID_G",
"(",
"String",
"uuid",
",",
"long",
"groupId",
")",
"throws",
"NoSuchCPDefinitionGroupedEntryException",
"{",
"CPDefinitionGroupedEntry",
"cpDefinitionGroupedEntry",
"=",
"fetchByUUID_G",
"(",
"uuid",
",... | Returns the cp definition grouped entry where uuid = ? and groupId = ? or throws a {@link NoSuchCPDefinitionGroupedEntryException} if it could not be found.
@param uuid the uuid
@param groupId the group ID
@return the matching cp definition grouped entry
@throws NoSuchCPDefinitionGroupedEntryException if a matching cp definition grouped entry could not be found | [
"Returns",
"the",
"cp",
"definition",
"grouped",
"entry",
"where",
"uuid",
"=",
"?",
";",
"and",
"groupId",
"=",
"?",
";",
"or",
"throws",
"a",
"{",
"@link",
"NoSuchCPDefinitionGroupedEntryException",
"}",
"if",
"it",
"could",
"not",
"be",
"found",
"."... | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-type-grouped-service/src/main/java/com/liferay/commerce/product/type/grouped/service/persistence/impl/CPDefinitionGroupedEntryPersistenceImpl.java#L670-L697 |
Wadpam/guja | guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java | GeneratedDContactDaoImpl.queryByHomePhone | public Iterable<DContact> queryByHomePhone(Object parent, java.lang.String homePhone) {
return queryByField(parent, DContactMapper.Field.HOMEPHONE.getFieldName(), homePhone);
} | java | public Iterable<DContact> queryByHomePhone(Object parent, java.lang.String homePhone) {
return queryByField(parent, DContactMapper.Field.HOMEPHONE.getFieldName(), homePhone);
} | [
"public",
"Iterable",
"<",
"DContact",
">",
"queryByHomePhone",
"(",
"Object",
"parent",
",",
"java",
".",
"lang",
".",
"String",
"homePhone",
")",
"{",
"return",
"queryByField",
"(",
"parent",
",",
"DContactMapper",
".",
"Field",
".",
"HOMEPHONE",
".",
"get... | query-by method for field homePhone
@param homePhone the specified attribute
@return an Iterable of DContacts for the specified homePhone | [
"query",
"-",
"by",
"method",
"for",
"field",
"homePhone"
] | train | https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java#L178-L180 |
buschmais/jqa-maven3-plugin | src/main/java/com/buschmais/jqassistant/plugin/maven3/impl/scanner/MavenProjectScannerPlugin.java | MavenProjectScannerPlugin.addProjectDetails | private void addProjectDetails(MavenProject project, MavenProjectDirectoryDescriptor projectDescriptor, Scanner scanner) {
ScannerContext scannerContext = scanner.getContext();
addParent(project, projectDescriptor, scannerContext);
addModules(project, projectDescriptor, scannerContext);
addModel(project, projectDescriptor, scanner);
} | java | private void addProjectDetails(MavenProject project, MavenProjectDirectoryDescriptor projectDescriptor, Scanner scanner) {
ScannerContext scannerContext = scanner.getContext();
addParent(project, projectDescriptor, scannerContext);
addModules(project, projectDescriptor, scannerContext);
addModel(project, projectDescriptor, scanner);
} | [
"private",
"void",
"addProjectDetails",
"(",
"MavenProject",
"project",
",",
"MavenProjectDirectoryDescriptor",
"projectDescriptor",
",",
"Scanner",
"scanner",
")",
"{",
"ScannerContext",
"scannerContext",
"=",
"scanner",
".",
"getContext",
"(",
")",
";",
"addParent",
... | Add project specific information.
@param project
The project.
@param projectDescriptor
The project descriptor. | [
"Add",
"project",
"specific",
"information",
"."
] | train | https://github.com/buschmais/jqa-maven3-plugin/blob/6c6e2dca56de6d5b8ceeb2f28982fb6d7c98778f/src/main/java/com/buschmais/jqassistant/plugin/maven3/impl/scanner/MavenProjectScannerPlugin.java#L199-L204 |
amzn/ion-java | src/com/amazon/ion/util/IonTextUtils.java | IonTextUtils.printSymbol | public static void printSymbol(Appendable out, CharSequence text)
throws IOException
{
if (text == null)
{
out.append("null.symbol");
}
else if (symbolNeedsQuoting(text, true))
{
printQuotedSymbol(out, text);
}
else
{
out.append(text);
}
} | java | public static void printSymbol(Appendable out, CharSequence text)
throws IOException
{
if (text == null)
{
out.append("null.symbol");
}
else if (symbolNeedsQuoting(text, true))
{
printQuotedSymbol(out, text);
}
else
{
out.append(text);
}
} | [
"public",
"static",
"void",
"printSymbol",
"(",
"Appendable",
"out",
",",
"CharSequence",
"text",
")",
"throws",
"IOException",
"{",
"if",
"(",
"text",
"==",
"null",
")",
"{",
"out",
".",
"append",
"(",
"\"null.symbol\"",
")",
";",
"}",
"else",
"if",
"("... | Prints the text as an Ion symbol, including surrounding single-quotes if
they are necessary. Operator symbols such as {@code '+'} are quoted.
If the {@code text} is null, this prints {@code null.symbol}.
@param out the stream to receive the Ion data.
@param text the symbol text; may be {@code null}.
@throws IOException if the {@link Appendable} throws an exception.
@see #printSymbol(CharSequence) | [
"Prints",
"the",
"text",
"as",
"an",
"Ion",
"symbol",
"including",
"surrounding",
"single",
"-",
"quotes",
"if",
"they",
"are",
"necessary",
".",
"Operator",
"symbols",
"such",
"as",
"{",
"@code",
"+",
"}",
"are",
"quoted",
".",
"If",
"the",
"{",
"@code"... | train | https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/util/IonTextUtils.java#L577-L592 |
netheosgithub/pcs_api | java/src/main/java/net/netheos/pcsapi/utils/URIUtil.java | URIUtil.getQueryParameter | public static String getQueryParameter( URI uri, String name )
{
Map<String, String> params = parseQueryParameters( uri.getRawQuery() );
return params.get( name );
} | java | public static String getQueryParameter( URI uri, String name )
{
Map<String, String> params = parseQueryParameters( uri.getRawQuery() );
return params.get( name );
} | [
"public",
"static",
"String",
"getQueryParameter",
"(",
"URI",
"uri",
",",
"String",
"name",
")",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"params",
"=",
"parseQueryParameters",
"(",
"uri",
".",
"getRawQuery",
"(",
")",
")",
";",
"return",
"params",
... | Retrieves a query param in a URL according to a key.
If several parameters are to be retrieved from the same URI, better use
<code>parseQueryString( uri.getRawQuery() )</code>.
@param uri
@param name
@return parameter value (if found) ; null if not found or no = after name. | [
"Retrieves",
"a",
"query",
"param",
"in",
"a",
"URL",
"according",
"to",
"a",
"key",
"."
] | train | https://github.com/netheosgithub/pcs_api/blob/20691e52e144014f99ca75cb7dedc7ba0c18586c/java/src/main/java/net/netheos/pcsapi/utils/URIUtil.java#L121-L125 |
google/closure-templates | java/src/com/google/template/soy/jbcsrc/JbcSrcValueFactory.java | JbcSrcValueFactory.isOrContains | private boolean isOrContains(SoyType type, SoyType.Kind kind) {
if (type.getKind() == kind) {
return true;
}
if (type.getKind() == SoyType.Kind.UNION) {
for (SoyType member : ((UnionType) type).getMembers()) {
if (member.getKind() == kind) {
return true;
}
}
}
return false;
} | java | private boolean isOrContains(SoyType type, SoyType.Kind kind) {
if (type.getKind() == kind) {
return true;
}
if (type.getKind() == SoyType.Kind.UNION) {
for (SoyType member : ((UnionType) type).getMembers()) {
if (member.getKind() == kind) {
return true;
}
}
}
return false;
} | [
"private",
"boolean",
"isOrContains",
"(",
"SoyType",
"type",
",",
"SoyType",
".",
"Kind",
"kind",
")",
"{",
"if",
"(",
"type",
".",
"getKind",
"(",
")",
"==",
"kind",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"type",
".",
"getKind",
"(",
")... | Returns true if the type is the given kind or contains the given kind. | [
"Returns",
"true",
"if",
"the",
"type",
"is",
"the",
"given",
"kind",
"or",
"contains",
"the",
"given",
"kind",
"."
] | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/JbcSrcValueFactory.java#L740-L752 |
ksclarke/freelib-utils | src/main/java/info/freelibrary/util/FileUtils.java | FileUtils.dirIsUseable | public static boolean dirIsUseable(final String aDirName, final String aPermString) {
final File dir = new File(aDirName);
if (!dir.exists() && !dir.mkdirs()) {
return false;
} else if ("r".contains(aPermString)) {
return dir.canRead();
} else if ("w".contains(aPermString)) {
return dir.canWrite();
} else if ("x".contains(aPermString)) {
return dir.canExecute();
} else {
return true;
}
} | java | public static boolean dirIsUseable(final String aDirName, final String aPermString) {
final File dir = new File(aDirName);
if (!dir.exists() && !dir.mkdirs()) {
return false;
} else if ("r".contains(aPermString)) {
return dir.canRead();
} else if ("w".contains(aPermString)) {
return dir.canWrite();
} else if ("x".contains(aPermString)) {
return dir.canExecute();
} else {
return true;
}
} | [
"public",
"static",
"boolean",
"dirIsUseable",
"(",
"final",
"String",
"aDirName",
",",
"final",
"String",
"aPermString",
")",
"{",
"final",
"File",
"dir",
"=",
"new",
"File",
"(",
"aDirName",
")",
";",
"if",
"(",
"!",
"dir",
".",
"exists",
"(",
")",
"... | Tests that the supplied directory exists and can be used according to the supplied permissions string (e.g.,
'rwx').
@param aDirName A name of a directory on the file system
@param aPermString A string representing the desired permissions of the directory
@return True if the directory is okay to be used; else, false | [
"Tests",
"that",
"the",
"supplied",
"directory",
"exists",
"and",
"can",
"be",
"used",
"according",
"to",
"the",
"supplied",
"permissions",
"string",
"(",
"e",
".",
"g",
".",
"rwx",
")",
"."
] | train | https://github.com/ksclarke/freelib-utils/blob/54e822ae4c11b3d74793fd82a1a535ffafffaf45/src/main/java/info/freelibrary/util/FileUtils.java#L621-L635 |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/MariaDbStatement.java | MariaDbStatement.executeLargeUpdate | @Override
public long executeLargeUpdate(String sql, String[] columnNames) throws SQLException {
return executeLargeUpdate(sql, Statement.RETURN_GENERATED_KEYS);
} | java | @Override
public long executeLargeUpdate(String sql, String[] columnNames) throws SQLException {
return executeLargeUpdate(sql, Statement.RETURN_GENERATED_KEYS);
} | [
"@",
"Override",
"public",
"long",
"executeLargeUpdate",
"(",
"String",
"sql",
",",
"String",
"[",
"]",
"columnNames",
")",
"throws",
"SQLException",
"{",
"return",
"executeLargeUpdate",
"(",
"sql",
",",
"Statement",
".",
"RETURN_GENERATED_KEYS",
")",
";",
"}"
] | Identical to executeLargeUpdate(String sql, int autoGeneratedKeys) with autoGeneratedKeys =
Statement.RETURN_GENERATED_KEYS set.
@param sql sql command
@param columnNames columns names
@return update counts
@throws SQLException if any error occur during execution | [
"Identical",
"to",
"executeLargeUpdate",
"(",
"String",
"sql",
"int",
"autoGeneratedKeys",
")",
"with",
"autoGeneratedKeys",
"=",
"Statement",
".",
"RETURN_GENERATED_KEYS",
"set",
"."
] | train | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/MariaDbStatement.java#L670-L673 |
andriusvelykis/reflow-maven-skin | reflow-velocity-tools/src/main/java/lt/velykis/maven/skins/reflow/HtmlTool.java | HtmlTool.anchorToId | private static void anchorToId(Element heading, Element anchor) {
if ("a".equals(anchor.tagName()) && heading.id().isEmpty()) {
String aName = anchor.attr("name");
if (!aName.isEmpty()) {
// set the anchor name as heading ID
heading.attr("id", aName);
// remove the anchor
anchor.remove();
}
}
} | java | private static void anchorToId(Element heading, Element anchor) {
if ("a".equals(anchor.tagName()) && heading.id().isEmpty()) {
String aName = anchor.attr("name");
if (!aName.isEmpty()) {
// set the anchor name as heading ID
heading.attr("id", aName);
// remove the anchor
anchor.remove();
}
}
} | [
"private",
"static",
"void",
"anchorToId",
"(",
"Element",
"heading",
",",
"Element",
"anchor",
")",
"{",
"if",
"(",
"\"a\"",
".",
"equals",
"(",
"anchor",
".",
"tagName",
"(",
")",
")",
"&&",
"heading",
".",
"id",
"(",
")",
".",
"isEmpty",
"(",
")",... | Moves anchor name to heading id, if one does not exist. Removes the anchor.
@param heading
@param anchor | [
"Moves",
"anchor",
"name",
"to",
"heading",
"id",
"if",
"one",
"does",
"not",
"exist",
".",
"Removes",
"the",
"anchor",
"."
] | train | https://github.com/andriusvelykis/reflow-maven-skin/blob/01170ae1426a1adfe7cc9c199e77aaa2ecb37ef2/reflow-velocity-tools/src/main/java/lt/velykis/maven/skins/reflow/HtmlTool.java#L954-L966 |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/editor/DocumentAutoFormatter.java | DocumentAutoFormatter.formatRegion | protected void formatRegion(IXtextDocument document, int offset, int length) {
try {
final int startLineIndex = document.getLineOfOffset(previousSiblingChar(document, offset));
final int endLineIndex = document.getLineOfOffset(offset + length);
int regionLength = 0;
for (int i = startLineIndex; i <= endLineIndex; ++i) {
regionLength += document.getLineLength(i);
}
if (regionLength > 0) {
final int startOffset = document.getLineOffset(startLineIndex);
for (final IRegion region : document.computePartitioning(startOffset, regionLength)) {
this.contentFormatter.format(document, region);
}
}
} catch (BadLocationException exception) {
Exceptions.sneakyThrow(exception);
}
} | java | protected void formatRegion(IXtextDocument document, int offset, int length) {
try {
final int startLineIndex = document.getLineOfOffset(previousSiblingChar(document, offset));
final int endLineIndex = document.getLineOfOffset(offset + length);
int regionLength = 0;
for (int i = startLineIndex; i <= endLineIndex; ++i) {
regionLength += document.getLineLength(i);
}
if (regionLength > 0) {
final int startOffset = document.getLineOffset(startLineIndex);
for (final IRegion region : document.computePartitioning(startOffset, regionLength)) {
this.contentFormatter.format(document, region);
}
}
} catch (BadLocationException exception) {
Exceptions.sneakyThrow(exception);
}
} | [
"protected",
"void",
"formatRegion",
"(",
"IXtextDocument",
"document",
",",
"int",
"offset",
",",
"int",
"length",
")",
"{",
"try",
"{",
"final",
"int",
"startLineIndex",
"=",
"document",
".",
"getLineOfOffset",
"(",
"previousSiblingChar",
"(",
"document",
",",... | Called for formatting a region.
@param document the document to format.
@param offset the offset of the text to format.
@param length the length of the text. | [
"Called",
"for",
"formatting",
"a",
"region",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/editor/DocumentAutoFormatter.java#L113-L130 |
andi12/msbuild-maven-plugin | msbuild-maven-plugin/src/main/java/uk/org/raje/maven/plugin/msbuild/parser/VCProjectHolder.java | VCProjectHolder.getVCProjectHolder | public static VCProjectHolder getVCProjectHolder( File inputFile, boolean isSolution,
Map<String, String> envVariables )
{
VCProjectHolder vcProjectHolder = VCPROJECT_HOLDERS.get( inputFile );
if ( vcProjectHolder == null )
{
vcProjectHolder = new VCProjectHolder( inputFile, isSolution, envVariables );
VCPROJECT_HOLDERS.put( inputFile, vcProjectHolder );
}
return vcProjectHolder;
} | java | public static VCProjectHolder getVCProjectHolder( File inputFile, boolean isSolution,
Map<String, String> envVariables )
{
VCProjectHolder vcProjectHolder = VCPROJECT_HOLDERS.get( inputFile );
if ( vcProjectHolder == null )
{
vcProjectHolder = new VCProjectHolder( inputFile, isSolution, envVariables );
VCPROJECT_HOLDERS.put( inputFile, vcProjectHolder );
}
return vcProjectHolder;
} | [
"public",
"static",
"VCProjectHolder",
"getVCProjectHolder",
"(",
"File",
"inputFile",
",",
"boolean",
"isSolution",
",",
"Map",
"<",
"String",
",",
"String",
">",
"envVariables",
")",
"{",
"VCProjectHolder",
"vcProjectHolder",
"=",
"VCPROJECT_HOLDERS",
".",
"get",
... | Find or create a container for parsed Visual C++ projects. If a container has already been created for the given
{@code inputFile} that container is returned; otherwise a new container is created.
@param inputFile the file to parse, it can be a Visual Studio solution (containing Visual C++ projects) or a
standalone Visual C++ project
@param isSolution {@code true} if {@code inputFile} is a solution, {@code false} if it is a standalone project
@param envVariables a map containing environment variable values to substitute while parsing the properties of
Visual C++ projects (such as values for {@code SolutionDir}, {@code Platform}, {@code Configuration}, or for any
environment variable expressed as {@code $(variable)} in the project properties); note that these values will
<em>override</em> the defaults provided by the OS or set by {@link VCProjectHolder#getParsedProjects}
@return the container for parsed Visual C++ projects | [
"Find",
"or",
"create",
"a",
"container",
"for",
"parsed",
"Visual",
"C",
"++",
"projects",
".",
"If",
"a",
"container",
"has",
"already",
"been",
"created",
"for",
"the",
"given",
"{"
] | train | https://github.com/andi12/msbuild-maven-plugin/blob/224159c15efba20d482f8c630f7947339b1a1b86/msbuild-maven-plugin/src/main/java/uk/org/raje/maven/plugin/msbuild/parser/VCProjectHolder.java#L71-L83 |
Erudika/para | para-core/src/main/java/com/erudika/para/rest/GenericExceptionMapper.java | GenericExceptionMapper.getExceptionResponse | public static Response getExceptionResponse(final int status, final String msg) {
return Response.status(status).entity(new LinkedHashMap<String, Object>() {
private static final long serialVersionUID = 1L;
{
put("code", status);
put("message", msg);
}
}).type(MediaType.APPLICATION_JSON).build();
} | java | public static Response getExceptionResponse(final int status, final String msg) {
return Response.status(status).entity(new LinkedHashMap<String, Object>() {
private static final long serialVersionUID = 1L;
{
put("code", status);
put("message", msg);
}
}).type(MediaType.APPLICATION_JSON).build();
} | [
"public",
"static",
"Response",
"getExceptionResponse",
"(",
"final",
"int",
"status",
",",
"final",
"String",
"msg",
")",
"{",
"return",
"Response",
".",
"status",
"(",
"status",
")",
".",
"entity",
"(",
"new",
"LinkedHashMap",
"<",
"String",
",",
"Object",... | Returns an exception/error response as a JSON object.
@param status HTTP status code
@param msg message
@return a JSON object | [
"Returns",
"an",
"exception",
"/",
"error",
"response",
"as",
"a",
"JSON",
"object",
"."
] | train | https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-core/src/main/java/com/erudika/para/rest/GenericExceptionMapper.java#L68-L76 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/JobScheduleOperations.java | JobScheduleOperations.listJobSchedules | public PagedList<CloudJobSchedule> listJobSchedules(DetailLevel detailLevel) throws BatchErrorException, IOException {
return listJobSchedules(detailLevel, null);
} | java | public PagedList<CloudJobSchedule> listJobSchedules(DetailLevel detailLevel) throws BatchErrorException, IOException {
return listJobSchedules(detailLevel, null);
} | [
"public",
"PagedList",
"<",
"CloudJobSchedule",
">",
"listJobSchedules",
"(",
"DetailLevel",
"detailLevel",
")",
"throws",
"BatchErrorException",
",",
"IOException",
"{",
"return",
"listJobSchedules",
"(",
"detailLevel",
",",
"null",
")",
";",
"}"
] | Lists the {@link CloudJobSchedule job schedules} in the Batch account.
@param detailLevel A {@link DetailLevel} used for filtering the list and for controlling which properties are retrieved from the service.
@return A list of {@link CloudJobSchedule} objects.
@throws BatchErrorException Exception thrown when an error response is received from the Batch service.
@throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. | [
"Lists",
"the",
"{",
"@link",
"CloudJobSchedule",
"job",
"schedules",
"}",
"in",
"the",
"Batch",
"account",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/JobScheduleOperations.java#L432-L434 |
apereo/cas | core/cas-server-core-webflow-api/src/main/java/org/apereo/cas/web/flow/configurer/AbstractCasWebflowConfigurer.java | AbstractCasWebflowConfigurer.getState | public TransitionableState getState(final Flow flow, final String stateId) {
return getState(flow, stateId, TransitionableState.class);
} | java | public TransitionableState getState(final Flow flow, final String stateId) {
return getState(flow, stateId, TransitionableState.class);
} | [
"public",
"TransitionableState",
"getState",
"(",
"final",
"Flow",
"flow",
",",
"final",
"String",
"stateId",
")",
"{",
"return",
"getState",
"(",
"flow",
",",
"stateId",
",",
"TransitionableState",
".",
"class",
")",
";",
"}"
] | Gets state.
@param flow the flow
@param stateId the state id
@return the state | [
"Gets",
"state",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-webflow-api/src/main/java/org/apereo/cas/web/flow/configurer/AbstractCasWebflowConfigurer.java#L741-L743 |
chennaione/sugar | library/src/main/java/com/orm/helper/MultiDexHelper.java | MultiDexHelper.getSourcePaths | public static List<String> getSourcePaths() throws PackageManager.NameNotFoundException, IOException {
ApplicationInfo applicationInfo = getPackageManager().getApplicationInfo(getPackageName(), 0);
File sourceApk = new File(applicationInfo.sourceDir);
File dexDir = new File(applicationInfo.dataDir, SECONDARY_FOLDER_NAME);
File instantRunDir = new File(applicationInfo.dataDir, INSTANT_RUN_DEX_DIR_PATH); //default instant-run dir
List<String> sourcePaths = new ArrayList<>();
sourcePaths.add(applicationInfo.sourceDir); //add the default apk path
if (instantRunDir.exists()) { //check if app using instant run
for(final File dexFile : instantRunDir.listFiles()) { //add all sources from instan-run
sourcePaths.add(dexFile.getAbsolutePath());
}
}
//the prefix of extracted file, ie: test.classes
String extractedFilePrefix = sourceApk.getName() + EXTRACTED_NAME_EXT;
//the total dex numbers
int totalDexNumber = getMultiDexPreferences().getInt(KEY_DEX_NUMBER, 1);
for (int secondaryNumber = 2; secondaryNumber <= totalDexNumber; secondaryNumber++) {
//for each dex file, ie: test.classes2.zip, test.classes3.zip...
String fileName = extractedFilePrefix + secondaryNumber + EXTRACTED_SUFFIX;
File extractedFile = new File(dexDir, fileName);
if (extractedFile.isFile()) {
sourcePaths.add(extractedFile.getAbsolutePath());
//we ignore the verify zip part
}
}
return sourcePaths;
} | java | public static List<String> getSourcePaths() throws PackageManager.NameNotFoundException, IOException {
ApplicationInfo applicationInfo = getPackageManager().getApplicationInfo(getPackageName(), 0);
File sourceApk = new File(applicationInfo.sourceDir);
File dexDir = new File(applicationInfo.dataDir, SECONDARY_FOLDER_NAME);
File instantRunDir = new File(applicationInfo.dataDir, INSTANT_RUN_DEX_DIR_PATH); //default instant-run dir
List<String> sourcePaths = new ArrayList<>();
sourcePaths.add(applicationInfo.sourceDir); //add the default apk path
if (instantRunDir.exists()) { //check if app using instant run
for(final File dexFile : instantRunDir.listFiles()) { //add all sources from instan-run
sourcePaths.add(dexFile.getAbsolutePath());
}
}
//the prefix of extracted file, ie: test.classes
String extractedFilePrefix = sourceApk.getName() + EXTRACTED_NAME_EXT;
//the total dex numbers
int totalDexNumber = getMultiDexPreferences().getInt(KEY_DEX_NUMBER, 1);
for (int secondaryNumber = 2; secondaryNumber <= totalDexNumber; secondaryNumber++) {
//for each dex file, ie: test.classes2.zip, test.classes3.zip...
String fileName = extractedFilePrefix + secondaryNumber + EXTRACTED_SUFFIX;
File extractedFile = new File(dexDir, fileName);
if (extractedFile.isFile()) {
sourcePaths.add(extractedFile.getAbsolutePath());
//we ignore the verify zip part
}
}
return sourcePaths;
} | [
"public",
"static",
"List",
"<",
"String",
">",
"getSourcePaths",
"(",
")",
"throws",
"PackageManager",
".",
"NameNotFoundException",
",",
"IOException",
"{",
"ApplicationInfo",
"applicationInfo",
"=",
"getPackageManager",
"(",
")",
".",
"getApplicationInfo",
"(",
"... | get all the dex path
@return all the dex path, including the ones in the newly added instant-run folder
@throws PackageManager.NameNotFoundException
@throws IOException | [
"get",
"all",
"the",
"dex",
"path"
] | train | https://github.com/chennaione/sugar/blob/2ff1b9d5b11563346b69b4e97324107ff680a61a/library/src/main/java/com/orm/helper/MultiDexHelper.java#L52-L83 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/PdfAction.java | PdfAction.gotoEmbedded | public static PdfAction gotoEmbedded(String filename, PdfTargetDictionary target, PdfObject dest, boolean newWindow) {
PdfAction action = new PdfAction();
action.put(PdfName.S, PdfName.GOTOE);
action.put(PdfName.T, target);
action.put(PdfName.D, dest);
action.put(PdfName.NEWWINDOW, new PdfBoolean(newWindow));
if (filename != null) {
action.put(PdfName.F, new PdfString(filename));
}
return action;
} | java | public static PdfAction gotoEmbedded(String filename, PdfTargetDictionary target, PdfObject dest, boolean newWindow) {
PdfAction action = new PdfAction();
action.put(PdfName.S, PdfName.GOTOE);
action.put(PdfName.T, target);
action.put(PdfName.D, dest);
action.put(PdfName.NEWWINDOW, new PdfBoolean(newWindow));
if (filename != null) {
action.put(PdfName.F, new PdfString(filename));
}
return action;
} | [
"public",
"static",
"PdfAction",
"gotoEmbedded",
"(",
"String",
"filename",
",",
"PdfTargetDictionary",
"target",
",",
"PdfObject",
"dest",
",",
"boolean",
"newWindow",
")",
"{",
"PdfAction",
"action",
"=",
"new",
"PdfAction",
"(",
")",
";",
"action",
".",
"pu... | Creates a GoToE action to an embedded file.
@param filename the root document of the target (null if the target is in the same document)
@param target a path to the target document of this action
@param dest the destination inside the target document, can be of type PdfDestination, PdfName, or PdfString
@param newWindow if true, the destination document should be opened in a new window
@return a GoToE action | [
"Creates",
"a",
"GoToE",
"action",
"to",
"an",
"embedded",
"file",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfAction.java#L523-L533 |
liferay/com-liferay-commerce | commerce-product-api/src/main/java/com/liferay/commerce/product/model/CPOptionCategoryWrapper.java | CPOptionCategoryWrapper.getDescription | @Override
public String getDescription(String languageId, boolean useDefault) {
return _cpOptionCategory.getDescription(languageId, useDefault);
} | java | @Override
public String getDescription(String languageId, boolean useDefault) {
return _cpOptionCategory.getDescription(languageId, useDefault);
} | [
"@",
"Override",
"public",
"String",
"getDescription",
"(",
"String",
"languageId",
",",
"boolean",
"useDefault",
")",
"{",
"return",
"_cpOptionCategory",
".",
"getDescription",
"(",
"languageId",
",",
"useDefault",
")",
";",
"}"
] | Returns the localized description of this cp option category in the language, optionally using the default language if no localization exists for the requested language.
@param languageId the ID of the language
@param useDefault whether to use the default language if no localization exists for the requested language
@return the localized description of this cp option category | [
"Returns",
"the",
"localized",
"description",
"of",
"this",
"cp",
"option",
"category",
"in",
"the",
"language",
"optionally",
"using",
"the",
"default",
"language",
"if",
"no",
"localization",
"exists",
"for",
"the",
"requested",
"language",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-api/src/main/java/com/liferay/commerce/product/model/CPOptionCategoryWrapper.java#L262-L265 |
deeplearning4j/deeplearning4j | datavec/datavec-api/src/main/java/org/datavec/api/io/WritableUtils.java | WritableUtils.writeString | public static void writeString(DataOutput out, String s) throws IOException {
if (s != null) {
byte[] buffer = s.getBytes("UTF-8");
int len = buffer.length;
out.writeInt(len);
out.write(buffer, 0, len);
} else {
out.writeInt(-1);
}
} | java | public static void writeString(DataOutput out, String s) throws IOException {
if (s != null) {
byte[] buffer = s.getBytes("UTF-8");
int len = buffer.length;
out.writeInt(len);
out.write(buffer, 0, len);
} else {
out.writeInt(-1);
}
} | [
"public",
"static",
"void",
"writeString",
"(",
"DataOutput",
"out",
",",
"String",
"s",
")",
"throws",
"IOException",
"{",
"if",
"(",
"s",
"!=",
"null",
")",
"{",
"byte",
"[",
"]",
"buffer",
"=",
"s",
".",
"getBytes",
"(",
"\"UTF-8\"",
")",
";",
"in... | /*
Write a String as a Network Int n, followed by n Bytes
Alternative to 16 bit read/writeUTF.
Encoding standard is... ? | [
"/",
"*"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-api/src/main/java/org/datavec/api/io/WritableUtils.java#L97-L106 |
alibaba/jstorm | jstorm-core/src/main/java/backtype/storm/utils/disruptor/RingBuffer.java | RingBuffer.tryPublishEvents | public <A, B> boolean tryPublishEvents(EventTranslatorTwoArg<E, A, B> translator, A[] arg0, B[] arg1) {
return tryPublishEvents(translator, 0, arg0.length, arg0, arg1);
} | java | public <A, B> boolean tryPublishEvents(EventTranslatorTwoArg<E, A, B> translator, A[] arg0, B[] arg1) {
return tryPublishEvents(translator, 0, arg0.length, arg0, arg1);
} | [
"public",
"<",
"A",
",",
"B",
">",
"boolean",
"tryPublishEvents",
"(",
"EventTranslatorTwoArg",
"<",
"E",
",",
"A",
",",
"B",
">",
"translator",
",",
"A",
"[",
"]",
"arg0",
",",
"B",
"[",
"]",
"arg1",
")",
"{",
"return",
"tryPublishEvents",
"(",
"tra... | Allows two user supplied arguments per event.
@param translator The user specified translation for the event
@param arg0 An array of user supplied arguments, one element per event.
@param arg1 An array of user supplied arguments, one element per event.
@return true if the value was published, false if there was insufficient capacity.
@see #tryPublishEvents(com.lmax.disruptor.EventTranslator[]) | [
"Allows",
"two",
"user",
"supplied",
"arguments",
"per",
"event",
"."
] | train | https://github.com/alibaba/jstorm/blob/5d6cde22dbca7df3d6e6830bf94f98a6639ab559/jstorm-core/src/main/java/backtype/storm/utils/disruptor/RingBuffer.java#L660-L662 |
landawn/AbacusUtil | src/com/landawn/abacus/dataSource/PoolablePreparedStatement.java | PoolablePreparedStatement.setURL | @Override
public void setURL(int parameterIndex, URL x) throws SQLException {
internalStmt.setURL(parameterIndex, x);
} | java | @Override
public void setURL(int parameterIndex, URL x) throws SQLException {
internalStmt.setURL(parameterIndex, x);
} | [
"@",
"Override",
"public",
"void",
"setURL",
"(",
"int",
"parameterIndex",
",",
"URL",
"x",
")",
"throws",
"SQLException",
"{",
"internalStmt",
".",
"setURL",
"(",
"parameterIndex",
",",
"x",
")",
";",
"}"
] | Method setURL.
@param parameterIndex
@param x
@throws SQLException
@see java.sql.PreparedStatement#setURL(int, URL) | [
"Method",
"setURL",
"."
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/dataSource/PoolablePreparedStatement.java#L1058-L1061 |
jronrun/benayn | benayn-ustyle/src/main/java/com/benayn/ustyle/string/Strs.java | Strs.indexAny | public static int indexAny(String target, Integer fromIndex, List<String> indexWith) {
if (isNull(target)) {
return INDEX_NONE_EXISTS;
}
return matcher(target).indexs(fromIndex, checkNotNull(indexWith).toArray(new String[indexWith.size()]));
} | java | public static int indexAny(String target, Integer fromIndex, List<String> indexWith) {
if (isNull(target)) {
return INDEX_NONE_EXISTS;
}
return matcher(target).indexs(fromIndex, checkNotNull(indexWith).toArray(new String[indexWith.size()]));
} | [
"public",
"static",
"int",
"indexAny",
"(",
"String",
"target",
",",
"Integer",
"fromIndex",
",",
"List",
"<",
"String",
">",
"indexWith",
")",
"{",
"if",
"(",
"isNull",
"(",
"target",
")",
")",
"{",
"return",
"INDEX_NONE_EXISTS",
";",
"}",
"return",
"ma... | Search target string to find the first index of any string in the given string list, starting at the specified index
@param target
@param fromIndex
@param indexWith
@return | [
"Search",
"target",
"string",
"to",
"find",
"the",
"first",
"index",
"of",
"any",
"string",
"in",
"the",
"given",
"string",
"list",
"starting",
"at",
"the",
"specified",
"index"
] | train | https://github.com/jronrun/benayn/blob/7585152e10e4cac07b4274c65f1c72ad7061ae69/benayn-ustyle/src/main/java/com/benayn/ustyle/string/Strs.java#L288-L294 |
lettuce-io/lettuce-core | src/main/java/io/lettuce/core/dynamic/support/ReflectionUtils.java | ReflectionUtils.getField | public static Object getField(Field field, Object target) {
try {
return field.get(target);
} catch (IllegalAccessException ex) {
handleReflectionException(ex);
throw new IllegalStateException(
"Unexpected reflection exception - " + ex.getClass().getName() + ": " + ex.getMessage());
}
} | java | public static Object getField(Field field, Object target) {
try {
return field.get(target);
} catch (IllegalAccessException ex) {
handleReflectionException(ex);
throw new IllegalStateException(
"Unexpected reflection exception - " + ex.getClass().getName() + ": " + ex.getMessage());
}
} | [
"public",
"static",
"Object",
"getField",
"(",
"Field",
"field",
",",
"Object",
"target",
")",
"{",
"try",
"{",
"return",
"field",
".",
"get",
"(",
"target",
")",
";",
"}",
"catch",
"(",
"IllegalAccessException",
"ex",
")",
"{",
"handleReflectionException",
... | Get the field represented by the supplied {@link Field field object} on the specified {@link Object target object}. In
accordance with {@link Field#get(Object)} semantics, the returned value is automatically wrapped if the underlying field
has a primitive type.
<p>
Thrown exceptions are handled via a call to {@link #handleReflectionException(Exception)}.
@param field the field to get
@param target the target object from which to get the field
@return the field's current value | [
"Get",
"the",
"field",
"represented",
"by",
"the",
"supplied",
"{",
"@link",
"Field",
"field",
"object",
"}",
"on",
"the",
"specified",
"{",
"@link",
"Object",
"target",
"object",
"}",
".",
"In",
"accordance",
"with",
"{",
"@link",
"Field#get",
"(",
"Objec... | train | https://github.com/lettuce-io/lettuce-core/blob/b6de74e384dea112e3656684ca3f50cdfd6c8e0d/src/main/java/io/lettuce/core/dynamic/support/ReflectionUtils.java#L44-L52 |
alkacon/opencms-core | src/org/opencms/publish/CmsPublishManager.java | CmsPublishManager.getPublishListAll | public CmsPublishList getPublishListAll(
CmsObject cms,
List<CmsResource> directPublishResources,
boolean directPublishSiblings,
boolean isUserPublishList) throws CmsException {
CmsPublishList pubList = new CmsPublishList(true, directPublishResources, directPublishSiblings);
pubList.setUserPublishList(isUserPublishList);
return m_securityManager.fillPublishList(cms.getRequestContext(), pubList);
} | java | public CmsPublishList getPublishListAll(
CmsObject cms,
List<CmsResource> directPublishResources,
boolean directPublishSiblings,
boolean isUserPublishList) throws CmsException {
CmsPublishList pubList = new CmsPublishList(true, directPublishResources, directPublishSiblings);
pubList.setUserPublishList(isUserPublishList);
return m_securityManager.fillPublishList(cms.getRequestContext(), pubList);
} | [
"public",
"CmsPublishList",
"getPublishListAll",
"(",
"CmsObject",
"cms",
",",
"List",
"<",
"CmsResource",
">",
"directPublishResources",
",",
"boolean",
"directPublishSiblings",
",",
"boolean",
"isUserPublishList",
")",
"throws",
"CmsException",
"{",
"CmsPublishList",
... | Returns a publish list with all the given resources, filtered only by state.<p>
@param cms the cms request context
@param directPublishResources the {@link CmsResource} objects which will be directly published
@param directPublishSiblings <code>true</code>, if all eventual siblings of the direct
published resources should also get published
@param isUserPublishList if true, the publish list consists of resources directly selected by the user to publish
@return a publish list
@throws CmsException if something goes wrong | [
"Returns",
"a",
"publish",
"list",
"with",
"all",
"the",
"given",
"resources",
"filtered",
"only",
"by",
"state",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/publish/CmsPublishManager.java#L374-L384 |
datacleaner/AnalyzerBeans | core/src/main/java/org/eobjects/analyzer/beans/transform/AbstractWrappedAnalysisJobTransformer.java | AbstractWrappedAnalysisJobTransformer.reInitialize | protected boolean reInitialize(AnalysisJob wrappedAnalysisJob, List<InputColumn<?>> outputColumns) {
if (wrappedAnalysisJob != null && outputColumns != null && !outputColumns.isEmpty()) {
return false;
}
return true;
} | java | protected boolean reInitialize(AnalysisJob wrappedAnalysisJob, List<InputColumn<?>> outputColumns) {
if (wrappedAnalysisJob != null && outputColumns != null && !outputColumns.isEmpty()) {
return false;
}
return true;
} | [
"protected",
"boolean",
"reInitialize",
"(",
"AnalysisJob",
"wrappedAnalysisJob",
",",
"List",
"<",
"InputColumn",
"<",
"?",
">",
">",
"outputColumns",
")",
"{",
"if",
"(",
"wrappedAnalysisJob",
"!=",
"null",
"&&",
"outputColumns",
"!=",
"null",
"&&",
"!",
"ou... | Determines if the transformer should reinitialize it's
{@link ConsumeRowHandler}, output columns etc. based on a set of existing
values.
The default implementation returns false when non-null values are
available
@param wrappedAnalysisJob
@param outputColumns
@return | [
"Determines",
"if",
"the",
"transformer",
"should",
"reinitialize",
"it",
"s",
"{",
"@link",
"ConsumeRowHandler",
"}",
"output",
"columns",
"etc",
".",
"based",
"on",
"a",
"set",
"of",
"existing",
"values",
"."
] | train | https://github.com/datacleaner/AnalyzerBeans/blob/f82dae080d80d2a647b706a5fb22b3ea250613b3/core/src/main/java/org/eobjects/analyzer/beans/transform/AbstractWrappedAnalysisJobTransformer.java#L114-L119 |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/query/dsl/functions/ArrayFunctions.java | ArrayFunctions.arrayConcat | public static Expression arrayConcat(JsonArray array1, JsonArray array2) {
return arrayConcat(x(array1), x(array2));
} | java | public static Expression arrayConcat(JsonArray array1, JsonArray array2) {
return arrayConcat(x(array1), x(array2));
} | [
"public",
"static",
"Expression",
"arrayConcat",
"(",
"JsonArray",
"array1",
",",
"JsonArray",
"array2",
")",
"{",
"return",
"arrayConcat",
"(",
"x",
"(",
"array1",
")",
",",
"x",
"(",
"array2",
")",
")",
";",
"}"
] | Returned expression results in new array with the concatenation of the input arrays. | [
"Returned",
"expression",
"results",
"in",
"new",
"array",
"with",
"the",
"concatenation",
"of",
"the",
"input",
"arrays",
"."
] | train | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/functions/ArrayFunctions.java#L104-L106 |
zackpollard/JavaTelegramBot-API | core/src/main/java/pro/zackpollard/telegrambot/api/utils/Utils.java | Utils.processReplyContent | public static void processReplyContent(MultipartBody multipartBody, ReplyingOptions replyingOptions) {
if (replyingOptions.getReplyTo() != 0)
multipartBody.field("reply_to_message_id", String.valueOf(replyingOptions.getReplyTo()), "application/json; charset=utf8;");
if (replyingOptions.getReplyMarkup() != null) {
switch (replyingOptions.getReplyMarkup().getType()) {
case FORCE_REPLY:
multipartBody.field("reply_markup", TelegramBot.GSON.toJson(replyingOptions.getReplyMarkup(), ForceReply.class), "application/json; charset=utf8;");
break;
case KEYBOARD_HIDE:
multipartBody.field("reply_markup", TelegramBot.GSON.toJson(replyingOptions.getReplyMarkup(), ReplyKeyboardHide.class), "application/json; charset=utf8;");
break;
case KEYBOARD_REMOVE:
multipartBody.field("reply_markup", TelegramBot.GSON.toJson(replyingOptions.getReplyMarkup(), ReplyKeyboardRemove.class), "application/json; charset=utf8;");
break;
case KEYBOARD_MARKUP:
multipartBody.field("reply_markup", TelegramBot.GSON.toJson(replyingOptions.getReplyMarkup(), ReplyKeyboardMarkup.class), "application/json; charset=utf8;");
break;
case INLINE_KEYBOARD_MARKUP:
multipartBody.field("reply_markup", TelegramBot.GSON.toJson(replyingOptions.getReplyMarkup(), InlineKeyboardMarkup.class), "application/json; charset=utf8;");
break;
}
}
} | java | public static void processReplyContent(MultipartBody multipartBody, ReplyingOptions replyingOptions) {
if (replyingOptions.getReplyTo() != 0)
multipartBody.field("reply_to_message_id", String.valueOf(replyingOptions.getReplyTo()), "application/json; charset=utf8;");
if (replyingOptions.getReplyMarkup() != null) {
switch (replyingOptions.getReplyMarkup().getType()) {
case FORCE_REPLY:
multipartBody.field("reply_markup", TelegramBot.GSON.toJson(replyingOptions.getReplyMarkup(), ForceReply.class), "application/json; charset=utf8;");
break;
case KEYBOARD_HIDE:
multipartBody.field("reply_markup", TelegramBot.GSON.toJson(replyingOptions.getReplyMarkup(), ReplyKeyboardHide.class), "application/json; charset=utf8;");
break;
case KEYBOARD_REMOVE:
multipartBody.field("reply_markup", TelegramBot.GSON.toJson(replyingOptions.getReplyMarkup(), ReplyKeyboardRemove.class), "application/json; charset=utf8;");
break;
case KEYBOARD_MARKUP:
multipartBody.field("reply_markup", TelegramBot.GSON.toJson(replyingOptions.getReplyMarkup(), ReplyKeyboardMarkup.class), "application/json; charset=utf8;");
break;
case INLINE_KEYBOARD_MARKUP:
multipartBody.field("reply_markup", TelegramBot.GSON.toJson(replyingOptions.getReplyMarkup(), InlineKeyboardMarkup.class), "application/json; charset=utf8;");
break;
}
}
} | [
"public",
"static",
"void",
"processReplyContent",
"(",
"MultipartBody",
"multipartBody",
",",
"ReplyingOptions",
"replyingOptions",
")",
"{",
"if",
"(",
"replyingOptions",
".",
"getReplyTo",
"(",
")",
"!=",
"0",
")",
"multipartBody",
".",
"field",
"(",
"\"reply_t... | This does generic processing of ReplyingOptions objects when sending a request to the API
@param multipartBody The MultipartBody that the ReplyingOptions content should be appended to
@param replyingOptions The ReplyingOptions that were used in this request | [
"This",
"does",
"generic",
"processing",
"of",
"ReplyingOptions",
"objects",
"when",
"sending",
"a",
"request",
"to",
"the",
"API"
] | train | https://github.com/zackpollard/JavaTelegramBot-API/blob/9d100f351824042ca5fc0ea735d1fa376a13e81d/core/src/main/java/pro/zackpollard/telegrambot/api/utils/Utils.java#L95-L120 |
mnlipp/jgrapes | org.jgrapes.io/src/org/jgrapes/io/FileStorage.java | FileStorage.onSaveInput | @Handler
@SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops")
public void onSaveInput(SaveInput event) throws InterruptedException {
if (!Arrays.asList(event.options())
.contains(StandardOpenOption.WRITE)) {
throw new IllegalArgumentException(
"File must be opened for writing.");
}
for (IOSubchannel channel : event.channels(IOSubchannel.class)) {
if (inputWriters.containsKey(channel)) {
channel.respond(new IOError(event,
new IllegalStateException("File is already open.")));
} else {
new Writer(event, channel);
}
}
} | java | @Handler
@SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops")
public void onSaveInput(SaveInput event) throws InterruptedException {
if (!Arrays.asList(event.options())
.contains(StandardOpenOption.WRITE)) {
throw new IllegalArgumentException(
"File must be opened for writing.");
}
for (IOSubchannel channel : event.channels(IOSubchannel.class)) {
if (inputWriters.containsKey(channel)) {
channel.respond(new IOError(event,
new IllegalStateException("File is already open.")));
} else {
new Writer(event, channel);
}
}
} | [
"@",
"Handler",
"@",
"SuppressWarnings",
"(",
"\"PMD.AvoidInstantiatingObjectsInLoops\"",
")",
"public",
"void",
"onSaveInput",
"(",
"SaveInput",
"event",
")",
"throws",
"InterruptedException",
"{",
"if",
"(",
"!",
"Arrays",
".",
"asList",
"(",
"event",
".",
"opti... | Opens a file for writing using the properties of the event. All data from
subsequent {@link Input} events is written to the file.
The end of record flag is ignored.
@param event the event
@throws InterruptedException if the execution was interrupted | [
"Opens",
"a",
"file",
"for",
"writing",
"using",
"the",
"properties",
"of",
"the",
"event",
".",
"All",
"data",
"from",
"subsequent",
"{",
"@link",
"Input",
"}",
"events",
"is",
"written",
"to",
"the",
"file",
".",
"The",
"end",
"of",
"record",
"flag",
... | train | https://github.com/mnlipp/jgrapes/blob/8b5d874935d84c34a52d3e3d3745e869b5203fa0/org.jgrapes.io/src/org/jgrapes/io/FileStorage.java#L303-L319 |
ebean-orm/ebean-querybean | src/main/java/io/ebean/typequery/TQRootBean.java | TQRootBean.multiMatch | public R multiMatch(String query, String... properties) {
peekExprList().multiMatch(query, properties);
return root;
} | java | public R multiMatch(String query, String... properties) {
peekExprList().multiMatch(query, properties);
return root;
} | [
"public",
"R",
"multiMatch",
"(",
"String",
"query",
",",
"String",
"...",
"properties",
")",
"{",
"peekExprList",
"(",
")",
".",
"multiMatch",
"(",
"query",
",",
"properties",
")",
";",
"return",
"root",
";",
"}"
] | Add a Text Multi-match expression (document store only).
<p>
This automatically makes the query a document store query.
</p> | [
"Add",
"a",
"Text",
"Multi",
"-",
"match",
"expression",
"(",
"document",
"store",
"only",
")",
".",
"<p",
">",
"This",
"automatically",
"makes",
"the",
"query",
"a",
"document",
"store",
"query",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/ebean-orm/ebean-querybean/blob/821650cb817c9c0fdcc97f93408dc79170b12423/src/main/java/io/ebean/typequery/TQRootBean.java#L1388-L1391 |
Azure/azure-sdk-for-java | postgresql/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/postgresql/v2017_12_01/implementation/FirewallRulesInner.java | FirewallRulesInner.beginCreateOrUpdateAsync | public Observable<FirewallRuleInner> beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String firewallRuleName, FirewallRuleInner parameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, firewallRuleName, parameters).map(new Func1<ServiceResponse<FirewallRuleInner>, FirewallRuleInner>() {
@Override
public FirewallRuleInner call(ServiceResponse<FirewallRuleInner> response) {
return response.body();
}
});
} | java | public Observable<FirewallRuleInner> beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String firewallRuleName, FirewallRuleInner parameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, firewallRuleName, parameters).map(new Func1<ServiceResponse<FirewallRuleInner>, FirewallRuleInner>() {
@Override
public FirewallRuleInner call(ServiceResponse<FirewallRuleInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"FirewallRuleInner",
">",
"beginCreateOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"firewallRuleName",
",",
"FirewallRuleInner",
"parameters",
")",
"{",
"return",
"beginCreateOrUpdateWithService... | Creates a new firewall rule or updates an existing firewall rule.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param firewallRuleName The name of the server firewall rule.
@param parameters The required parameters for creating or updating a firewall rule.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the FirewallRuleInner object | [
"Creates",
"a",
"new",
"firewall",
"rule",
"or",
"updates",
"an",
"existing",
"firewall",
"rule",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/postgresql/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/postgresql/v2017_12_01/implementation/FirewallRulesInner.java#L210-L217 |
samskivert/samskivert | src/main/java/com/samskivert/servlet/util/ParameterUtil.java | ParameterUtil.getDateParameter | public static Date getDateParameter (
HttpServletRequest req, String name, String invalidDataMessage)
throws DataValidationException
{
String value = getParameter(req, name, false);
if (StringUtil.isBlank(value) ||
DATE_TEMPLATE.equalsIgnoreCase(value)) {
return null;
}
return parseDateParameter(value, invalidDataMessage);
} | java | public static Date getDateParameter (
HttpServletRequest req, String name, String invalidDataMessage)
throws DataValidationException
{
String value = getParameter(req, name, false);
if (StringUtil.isBlank(value) ||
DATE_TEMPLATE.equalsIgnoreCase(value)) {
return null;
}
return parseDateParameter(value, invalidDataMessage);
} | [
"public",
"static",
"Date",
"getDateParameter",
"(",
"HttpServletRequest",
"req",
",",
"String",
"name",
",",
"String",
"invalidDataMessage",
")",
"throws",
"DataValidationException",
"{",
"String",
"value",
"=",
"getParameter",
"(",
"req",
",",
"name",
",",
"fals... | Fetches the supplied parameter from the request and converts it to a date. The value of the
parameter should be a date formatted like so: 2001-12-25. If the parameter does not exist,
null is returned. If the parameter is not a well-formed date, a data validation exception is
thrown with the supplied message. | [
"Fetches",
"the",
"supplied",
"parameter",
"from",
"the",
"request",
"and",
"converts",
"it",
"to",
"a",
"date",
".",
"The",
"value",
"of",
"the",
"parameter",
"should",
"be",
"a",
"date",
"formatted",
"like",
"so",
":",
"2001",
"-",
"12",
"-",
"25",
"... | train | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/servlet/util/ParameterUtil.java#L260-L270 |
samskivert/samskivert | src/main/java/com/samskivert/servlet/util/ExceptionMap.java | ExceptionMap.init | public static synchronized void init ()
{
// only initialize ourselves once
if (_keys != null) {
return;
} else {
_keys = new ArrayList<Class<?>>();
_values = new ArrayList<String>();
}
// first try loading the properties file without a leading slash
ClassLoader cld = ExceptionMap.class.getClassLoader();
InputStream config = ConfigUtil.getStream(PROPS_NAME, cld);
if (config == null) {
log.warning("Unable to load " + PROPS_NAME + " from CLASSPATH.");
} else {
// otherwise process ye old config file.
try {
// we'll do some serious jiggery pokery to leverage the parsing
// implementation provided by java.util.Properties. god bless
// method overloading
final ArrayList<String> classes = new ArrayList<String>();
Properties loader = new Properties() {
@Override public Object put (Object key, Object value) {
classes.add((String)key);
_values.add((String)value);
return key;
}
};
loader.load(config);
// now cruise through and resolve the exceptions named as
// keys and throw out any that don't appear to exist
for (int i = 0; i < classes.size(); i++) {
String exclass = classes.get(i);
try {
Class<?> cl = Class.forName(exclass);
// replace the string with the class object
_keys.add(cl);
} catch (Throwable t) {
log.warning("Unable to resolve exception class.", "class", exclass,
"error", t);
_values.remove(i);
i--; // back on up a notch
}
}
} catch (IOException ioe) {
log.warning("Error reading exception mapping file: " + ioe);
}
}
} | java | public static synchronized void init ()
{
// only initialize ourselves once
if (_keys != null) {
return;
} else {
_keys = new ArrayList<Class<?>>();
_values = new ArrayList<String>();
}
// first try loading the properties file without a leading slash
ClassLoader cld = ExceptionMap.class.getClassLoader();
InputStream config = ConfigUtil.getStream(PROPS_NAME, cld);
if (config == null) {
log.warning("Unable to load " + PROPS_NAME + " from CLASSPATH.");
} else {
// otherwise process ye old config file.
try {
// we'll do some serious jiggery pokery to leverage the parsing
// implementation provided by java.util.Properties. god bless
// method overloading
final ArrayList<String> classes = new ArrayList<String>();
Properties loader = new Properties() {
@Override public Object put (Object key, Object value) {
classes.add((String)key);
_values.add((String)value);
return key;
}
};
loader.load(config);
// now cruise through and resolve the exceptions named as
// keys and throw out any that don't appear to exist
for (int i = 0; i < classes.size(); i++) {
String exclass = classes.get(i);
try {
Class<?> cl = Class.forName(exclass);
// replace the string with the class object
_keys.add(cl);
} catch (Throwable t) {
log.warning("Unable to resolve exception class.", "class", exclass,
"error", t);
_values.remove(i);
i--; // back on up a notch
}
}
} catch (IOException ioe) {
log.warning("Error reading exception mapping file: " + ioe);
}
}
} | [
"public",
"static",
"synchronized",
"void",
"init",
"(",
")",
"{",
"// only initialize ourselves once",
"if",
"(",
"_keys",
"!=",
"null",
")",
"{",
"return",
";",
"}",
"else",
"{",
"_keys",
"=",
"new",
"ArrayList",
"<",
"Class",
"<",
"?",
">",
">",
"(",
... | Searches for the <code>exceptionmap.properties</code> file in the
classpath and loads it. If the file could not be found, an error is
reported and a default set of mappings is used. | [
"Searches",
"for",
"the",
"<code",
">",
"exceptionmap",
".",
"properties<",
"/",
"code",
">",
"file",
"in",
"the",
"classpath",
"and",
"loads",
"it",
".",
"If",
"the",
"file",
"could",
"not",
"be",
"found",
"an",
"error",
"is",
"reported",
"and",
"a",
... | train | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/servlet/util/ExceptionMap.java#L62-L115 |
Jasig/uPortal | uPortal-layout/uPortal-layout-impl/src/main/java/org/apereo/portal/layout/dlm/LPAChangeParameter.java | LPAChangeParameter.perform | @Override
public void perform() throws PortalException {
// push the change into the PLF
if (nodeId.startsWith(Constants.FRAGMENT_ID_USER_PREFIX)) {
// we are dealing with an incorporated node, adding will replace
// an existing one for the same target node id and name
ParameterEditManager.addParmEditDirective(nodeId, name, value, person);
} else {
// node owned by user so change existing parameter child directly
Document plf = RDBMDistributedLayoutStore.getPLF(person);
Element plfNode = plf.getElementById(nodeId);
changeParameterChild(plfNode, name, value);
}
// push the change into the ILF
changeParameterChild(ilfNode, name, value);
} | java | @Override
public void perform() throws PortalException {
// push the change into the PLF
if (nodeId.startsWith(Constants.FRAGMENT_ID_USER_PREFIX)) {
// we are dealing with an incorporated node, adding will replace
// an existing one for the same target node id and name
ParameterEditManager.addParmEditDirective(nodeId, name, value, person);
} else {
// node owned by user so change existing parameter child directly
Document plf = RDBMDistributedLayoutStore.getPLF(person);
Element plfNode = plf.getElementById(nodeId);
changeParameterChild(plfNode, name, value);
}
// push the change into the ILF
changeParameterChild(ilfNode, name, value);
} | [
"@",
"Override",
"public",
"void",
"perform",
"(",
")",
"throws",
"PortalException",
"{",
"// push the change into the PLF",
"if",
"(",
"nodeId",
".",
"startsWith",
"(",
"Constants",
".",
"FRAGMENT_ID_USER_PREFIX",
")",
")",
"{",
"// we are dealing with an incorporated ... | Change the parameter for a channel in both the ILF and PLF using the appropriate mechanisms
for incorporated nodes versus owned nodes. | [
"Change",
"the",
"parameter",
"for",
"a",
"channel",
"in",
"both",
"the",
"ILF",
"and",
"PLF",
"using",
"the",
"appropriate",
"mechanisms",
"for",
"incorporated",
"nodes",
"versus",
"owned",
"nodes",
"."
] | train | https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-layout/uPortal-layout-impl/src/main/java/org/apereo/portal/layout/dlm/LPAChangeParameter.java#L43-L58 |
geomajas/geomajas-project-client-gwt | client/src/main/java/org/geomajas/gwt/client/spatial/Bbox.java | Bbox.createFittingBox | public Bbox createFittingBox(double ratioWidth, double ratioHeight) {
if (ratioWidth > 0 && ratioHeight > 0) {
double newRatio = ratioWidth / ratioHeight;
double oldRatio = width / height;
double newWidth = width;
double newHeight = height;
if (newRatio > oldRatio) {
newHeight = width / newRatio;
} else {
newWidth = height * newRatio;
}
Bbox result = new Bbox(0, 0, newWidth, newHeight);
result.setCenterPoint(getCenterPoint());
return result;
} else {
return new Bbox(this);
}
} | java | public Bbox createFittingBox(double ratioWidth, double ratioHeight) {
if (ratioWidth > 0 && ratioHeight > 0) {
double newRatio = ratioWidth / ratioHeight;
double oldRatio = width / height;
double newWidth = width;
double newHeight = height;
if (newRatio > oldRatio) {
newHeight = width / newRatio;
} else {
newWidth = height * newRatio;
}
Bbox result = new Bbox(0, 0, newWidth, newHeight);
result.setCenterPoint(getCenterPoint());
return result;
} else {
return new Bbox(this);
}
} | [
"public",
"Bbox",
"createFittingBox",
"(",
"double",
"ratioWidth",
",",
"double",
"ratioHeight",
")",
"{",
"if",
"(",
"ratioWidth",
">",
"0",
"&&",
"ratioHeight",
">",
"0",
")",
"{",
"double",
"newRatio",
"=",
"ratioWidth",
"/",
"ratioHeight",
";",
"double",... | Creates a bbox that fits exactly in this box but has a different width/height ratio.
@param ratioWidth width dor ratio
@param ratioHeight height for ratio
@return bbox | [
"Creates",
"a",
"bbox",
"that",
"fits",
"exactly",
"in",
"this",
"box",
"but",
"has",
"a",
"different",
"width",
"/",
"height",
"ratio",
"."
] | train | https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/spatial/Bbox.java#L326-L343 |
beangle/beangle3 | orm/hibernate/src/main/java/org/beangle/orm/hibernate/RailsNamingStrategy.java | RailsNamingStrategy.logicalCollectionColumnName | public String logicalCollectionColumnName(String columnName, String propertyName, String referencedColumn) {
return Strings.isNotEmpty(columnName) ? columnName : unqualify(propertyName) + "_" + referencedColumn;
} | java | public String logicalCollectionColumnName(String columnName, String propertyName, String referencedColumn) {
return Strings.isNotEmpty(columnName) ? columnName : unqualify(propertyName) + "_" + referencedColumn;
} | [
"public",
"String",
"logicalCollectionColumnName",
"(",
"String",
"columnName",
",",
"String",
"propertyName",
",",
"String",
"referencedColumn",
")",
"{",
"return",
"Strings",
".",
"isNotEmpty",
"(",
"columnName",
")",
"?",
"columnName",
":",
"unqualify",
"(",
"p... | Return the column name if explicit or the concatenation of the property
name and the referenced column | [
"Return",
"the",
"column",
"name",
"if",
"explicit",
"or",
"the",
"concatenation",
"of",
"the",
"property",
"name",
"and",
"the",
"referenced",
"column"
] | train | https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/orm/hibernate/src/main/java/org/beangle/orm/hibernate/RailsNamingStrategy.java#L166-L168 |
aerogear/aerogear-android-core | library/src/main/java/org/jboss/aerogear/android/core/reflection/Property.java | Property.getValue | public Object getValue(Object instance) {
try {
return getMethod.invoke(instance);
} catch (Exception e) {
throw new PropertyNotFoundException(klass, getType(), fieldName);
}
} | java | public Object getValue(Object instance) {
try {
return getMethod.invoke(instance);
} catch (Exception e) {
throw new PropertyNotFoundException(klass, getType(), fieldName);
}
} | [
"public",
"Object",
"getValue",
"(",
"Object",
"instance",
")",
"{",
"try",
"{",
"return",
"getMethod",
".",
"invoke",
"(",
"instance",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"PropertyNotFoundException",
"(",
"klass",
",",... | Get value
@param instance Instance to get value
@return Value | [
"Get",
"value"
] | train | https://github.com/aerogear/aerogear-android-core/blob/3be24a79dd3d2792804935572bb672ff8714e6aa/library/src/main/java/org/jboss/aerogear/android/core/reflection/Property.java#L124-L131 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jaxws.clientcontainer/src/com/ibm/ws/jaxws/metadata/builder/WebServiceRefInfoBuilder.java | WebServiceRefInfoBuilder.buildPartialInfoFromWebServiceClient | private static WebServiceRefPartialInfo buildPartialInfoFromWebServiceClient(Class<?> serviceInterfaceClass) {
WebServiceClient webServiceClient = serviceInterfaceClass.getAnnotation(WebServiceClient.class);
if (webServiceClient == null) {
return null;
}
String className = serviceInterfaceClass.getName();
String wsdlLocation = webServiceClient.wsdlLocation();
QName serviceQName = null;
String localPart = webServiceClient.name();
if (localPart != null) {
serviceQName = new QName(webServiceClient.targetNamespace(), localPart);
}
String handlerChainDeclaringClassName = null;
javax.jws.HandlerChain handlerChainAnnotation = serviceInterfaceClass.getAnnotation(javax.jws.HandlerChain.class);
if (handlerChainAnnotation != null)
handlerChainDeclaringClassName = serviceInterfaceClass.getName();
WebServiceRefPartialInfo partialInfo = new WebServiceRefPartialInfo(className, wsdlLocation, serviceQName, null, handlerChainDeclaringClassName, handlerChainAnnotation);
return partialInfo;
} | java | private static WebServiceRefPartialInfo buildPartialInfoFromWebServiceClient(Class<?> serviceInterfaceClass) {
WebServiceClient webServiceClient = serviceInterfaceClass.getAnnotation(WebServiceClient.class);
if (webServiceClient == null) {
return null;
}
String className = serviceInterfaceClass.getName();
String wsdlLocation = webServiceClient.wsdlLocation();
QName serviceQName = null;
String localPart = webServiceClient.name();
if (localPart != null) {
serviceQName = new QName(webServiceClient.targetNamespace(), localPart);
}
String handlerChainDeclaringClassName = null;
javax.jws.HandlerChain handlerChainAnnotation = serviceInterfaceClass.getAnnotation(javax.jws.HandlerChain.class);
if (handlerChainAnnotation != null)
handlerChainDeclaringClassName = serviceInterfaceClass.getName();
WebServiceRefPartialInfo partialInfo = new WebServiceRefPartialInfo(className, wsdlLocation, serviceQName, null, handlerChainDeclaringClassName, handlerChainAnnotation);
return partialInfo;
} | [
"private",
"static",
"WebServiceRefPartialInfo",
"buildPartialInfoFromWebServiceClient",
"(",
"Class",
"<",
"?",
">",
"serviceInterfaceClass",
")",
"{",
"WebServiceClient",
"webServiceClient",
"=",
"serviceInterfaceClass",
".",
"getAnnotation",
"(",
"WebServiceClient",
".",
... | This method will build a ServiceRefPartialInfo object from a class with an
@WebServiceClient annotation. | [
"This",
"method",
"will",
"build",
"a",
"ServiceRefPartialInfo",
"object",
"from",
"a",
"class",
"with",
"an"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jaxws.clientcontainer/src/com/ibm/ws/jaxws/metadata/builder/WebServiceRefInfoBuilder.java#L238-L258 |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/com/read/resultset/rowprotocol/TextRowProtocol.java | TextRowProtocol.getInternalBoolean | public boolean getInternalBoolean(ColumnInformation columnInfo) {
if (lastValueWasNull()) {
return false;
}
if (columnInfo.getColumnType() == ColumnType.BIT) {
return parseBit() != 0;
}
final String rawVal = new String(buf, pos, length, StandardCharsets.UTF_8);
return !("false".equals(rawVal) || "0".equals(rawVal));
} | java | public boolean getInternalBoolean(ColumnInformation columnInfo) {
if (lastValueWasNull()) {
return false;
}
if (columnInfo.getColumnType() == ColumnType.BIT) {
return parseBit() != 0;
}
final String rawVal = new String(buf, pos, length, StandardCharsets.UTF_8);
return !("false".equals(rawVal) || "0".equals(rawVal));
} | [
"public",
"boolean",
"getInternalBoolean",
"(",
"ColumnInformation",
"columnInfo",
")",
"{",
"if",
"(",
"lastValueWasNull",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"columnInfo",
".",
"getColumnType",
"(",
")",
"==",
"ColumnType",
".",
"BI... | Get boolean from raw text format.
@param columnInfo column information
@return boolean value | [
"Get",
"boolean",
"from",
"raw",
"text",
"format",
"."
] | train | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/com/read/resultset/rowprotocol/TextRowProtocol.java#L797-L807 |
fhoeben/hsac-fitnesse-fixtures | src/main/java/nl/hsac/fitnesse/fixture/util/FtpFileUtil.java | FtpFileUtil.disconnectAndLogoutFromFTPServer | public static void disconnectAndLogoutFromFTPServer(FTPClient ftpClient, String hostName) {
try {
// logout and disconnect
if (ftpClient != null && ftpClient.isConnected()) {
ftpClient.logout();
ftpClient.disconnect();
}
} catch (IOException e) {
// what the hell?!
throw new RuntimeException("Unable to logout and disconnect from : " + hostName, e);
}
} | java | public static void disconnectAndLogoutFromFTPServer(FTPClient ftpClient, String hostName) {
try {
// logout and disconnect
if (ftpClient != null && ftpClient.isConnected()) {
ftpClient.logout();
ftpClient.disconnect();
}
} catch (IOException e) {
// what the hell?!
throw new RuntimeException("Unable to logout and disconnect from : " + hostName, e);
}
} | [
"public",
"static",
"void",
"disconnectAndLogoutFromFTPServer",
"(",
"FTPClient",
"ftpClient",
",",
"String",
"hostName",
")",
"{",
"try",
"{",
"// logout and disconnect",
"if",
"(",
"ftpClient",
"!=",
"null",
"&&",
"ftpClient",
".",
"isConnected",
"(",
")",
")",
... | Disconnect and logout given FTP client.
@param hostName the FTP server host name | [
"Disconnect",
"and",
"logout",
"given",
"FTP",
"client",
"."
] | train | https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/FtpFileUtil.java#L231-L242 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/shape/Shape.java | Shape.getOffset | public static long getOffset(IntBuffer shapeInformation, int row, int col) {
int rank = rank(shapeInformation);
if (rank != 2)
throw new IllegalArgumentException(
"Cannot use this getOffset method on arrays of rank != 2 (rank is: " + rank + ")");
long offset = 0;
int size_0 = size(shapeInformation, 0);
int size_1 = size(shapeInformation, 1);
if (row >= size_0 || col >= size_1)
throw new IllegalArgumentException("Invalid indices: cannot get [" + row + "," + col + "] from a "
+ Arrays.toString(shape(shapeInformation)) + " NDArray");
if (size_0 != 1)
offset += row * stride(shapeInformation, 0);
if (size_1 != 1)
offset += col * stride(shapeInformation, 1);
return offset;
} | java | public static long getOffset(IntBuffer shapeInformation, int row, int col) {
int rank = rank(shapeInformation);
if (rank != 2)
throw new IllegalArgumentException(
"Cannot use this getOffset method on arrays of rank != 2 (rank is: " + rank + ")");
long offset = 0;
int size_0 = size(shapeInformation, 0);
int size_1 = size(shapeInformation, 1);
if (row >= size_0 || col >= size_1)
throw new IllegalArgumentException("Invalid indices: cannot get [" + row + "," + col + "] from a "
+ Arrays.toString(shape(shapeInformation)) + " NDArray");
if (size_0 != 1)
offset += row * stride(shapeInformation, 0);
if (size_1 != 1)
offset += col * stride(shapeInformation, 1);
return offset;
} | [
"public",
"static",
"long",
"getOffset",
"(",
"IntBuffer",
"shapeInformation",
",",
"int",
"row",
",",
"int",
"col",
")",
"{",
"int",
"rank",
"=",
"rank",
"(",
"shapeInformation",
")",
";",
"if",
"(",
"rank",
"!=",
"2",
")",
"throw",
"new",
"IllegalArgum... | Get the offset of the specified [row,col] for the 2d array
@param shapeInformation Shape information
@param row Row index to get the offset for
@param col Column index to get the offset for
@return Buffer offset | [
"Get",
"the",
"offset",
"of",
"the",
"specified",
"[",
"row",
"col",
"]",
"for",
"the",
"2d",
"array"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/shape/Shape.java#L1058-L1076 |
knightliao/disconf | disconf-core/src/main/java/com/baidu/disconf/core/common/zookeeper/inner/ResilientActiveKeyValueStore.java | ResilientActiveKeyValueStore.read | public String read(String path, Watcher watcher, Stat stat) throws InterruptedException, KeeperException {
byte[] data = zk.getData(path, watcher, stat);
return new String(data, CHARSET);
} | java | public String read(String path, Watcher watcher, Stat stat) throws InterruptedException, KeeperException {
byte[] data = zk.getData(path, watcher, stat);
return new String(data, CHARSET);
} | [
"public",
"String",
"read",
"(",
"String",
"path",
",",
"Watcher",
"watcher",
",",
"Stat",
"stat",
")",
"throws",
"InterruptedException",
",",
"KeeperException",
"{",
"byte",
"[",
"]",
"data",
"=",
"zk",
".",
"getData",
"(",
"path",
",",
"watcher",
",",
... | @param path
@param watcher
@return String
@throws InterruptedException
@throws KeeperException
@Description: 读数据
@author liaoqiqi
@date 2013-6-14 | [
"@param",
"path",
"@param",
"watcher"
] | train | https://github.com/knightliao/disconf/blob/d413cbce9334fe38a5a24982ce4db3a6ed8e98ea/disconf-core/src/main/java/com/baidu/disconf/core/common/zookeeper/inner/ResilientActiveKeyValueStore.java#L207-L211 |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/flow/HornSchunckPyramid.java | HornSchunckPyramid.process | @Override
public void process( ImagePyramid<GrayF32> image1 ,
ImagePyramid<GrayF32> image2 ) {
// Process the pyramid from low resolution to high resolution
boolean first = true;
for( int i = image1.getNumLayers()-1; i >= 0; i-- ) {
GrayF32 layer1 = image1.getLayer(i);
GrayF32 layer2 = image2.getLayer(i);
// declare memory for this layer
deriv2X.reshape(layer1.width,layer1.height);
deriv2Y.reshape(layer1.width,layer1.height);
warpDeriv2X.reshape(layer1.width,layer1.height);
warpDeriv2Y.reshape(layer1.width,layer1.height);
warpImage2.reshape(layer1.width,layer1.height);
// compute the gradient for the second image
gradient.process(layer2,deriv2X,deriv2Y);
if( !first ) {
// interpolate initial flow from previous layer
interpolateFlowScale(layer1.width, layer1.height);
} else {
// for the very first layer there is no information on flow so set everything to 0
first = false;
initFlowX.reshape(layer1.width,layer1.height);
initFlowY.reshape(layer1.width,layer1.height);
flowX.reshape(layer1.width,layer1.height);
flowY.reshape(layer1.width,layer1.height);
ImageMiscOps.fill(flowX,0);
ImageMiscOps.fill(flowY,0);
ImageMiscOps.fill(initFlowX,0);
ImageMiscOps.fill(initFlowY,0);
}
// compute flow for this layer
processLayer(layer1,layer2,deriv2X,deriv2Y);
}
} | java | @Override
public void process( ImagePyramid<GrayF32> image1 ,
ImagePyramid<GrayF32> image2 ) {
// Process the pyramid from low resolution to high resolution
boolean first = true;
for( int i = image1.getNumLayers()-1; i >= 0; i-- ) {
GrayF32 layer1 = image1.getLayer(i);
GrayF32 layer2 = image2.getLayer(i);
// declare memory for this layer
deriv2X.reshape(layer1.width,layer1.height);
deriv2Y.reshape(layer1.width,layer1.height);
warpDeriv2X.reshape(layer1.width,layer1.height);
warpDeriv2Y.reshape(layer1.width,layer1.height);
warpImage2.reshape(layer1.width,layer1.height);
// compute the gradient for the second image
gradient.process(layer2,deriv2X,deriv2Y);
if( !first ) {
// interpolate initial flow from previous layer
interpolateFlowScale(layer1.width, layer1.height);
} else {
// for the very first layer there is no information on flow so set everything to 0
first = false;
initFlowX.reshape(layer1.width,layer1.height);
initFlowY.reshape(layer1.width,layer1.height);
flowX.reshape(layer1.width,layer1.height);
flowY.reshape(layer1.width,layer1.height);
ImageMiscOps.fill(flowX,0);
ImageMiscOps.fill(flowY,0);
ImageMiscOps.fill(initFlowX,0);
ImageMiscOps.fill(initFlowY,0);
}
// compute flow for this layer
processLayer(layer1,layer2,deriv2X,deriv2Y);
}
} | [
"@",
"Override",
"public",
"void",
"process",
"(",
"ImagePyramid",
"<",
"GrayF32",
">",
"image1",
",",
"ImagePyramid",
"<",
"GrayF32",
">",
"image2",
")",
"{",
"// Process the pyramid from low resolution to high resolution",
"boolean",
"first",
"=",
"true",
";",
"fo... | Computes dense optical flow from the provided image pyramid. Image gradient for each layer should be
computed directly from the layer images.
@param image1 Pyramid of first image
@param image2 Pyramid of second image | [
"Computes",
"dense",
"optical",
"flow",
"from",
"the",
"provided",
"image",
"pyramid",
".",
"Image",
"gradient",
"for",
"each",
"layer",
"should",
"be",
"computed",
"directly",
"from",
"the",
"layer",
"images",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/flow/HornSchunckPyramid.java#L108-L150 |
GCRC/nunaliit | nunaliit2-search/src/main/java/ca/carleton/gcrc/search/Searches.java | Searches.getAudioMediaFromPlaceId | public JSONObject getAudioMediaFromPlaceId(String place_id) throws Exception {
List<SelectedColumn> selectFields = new Vector<SelectedColumn>();
selectFields.add( new SelectedColumn(SelectedColumn.Type.INTEGER, "id") );
selectFields.add( new SelectedColumn(SelectedColumn.Type.INTEGER, "place_id") );
selectFields.add( new SelectedColumn(SelectedColumn.Type.STRING, "filename") );
selectFields.add( new SelectedColumn(SelectedColumn.Type.STRING, "mimetype") );
selectFields.add( new SelectedColumn(SelectedColumn.Type.STRING, "title") );
PreparedStatement stmt = connection.prepareStatement(
"SELECT id,place_id,filename,mimetype,title " +
"FROM contributions " +
"WHERE mimetype LIKE 'audio/%' AND place_id = ?;"
);
stmt.setInt(1, Integer.parseInt(place_id));
JSONArray array = executeStatementToJson(stmt, selectFields);
JSONObject result = new JSONObject();
result.put("media", array);
return result;
} | java | public JSONObject getAudioMediaFromPlaceId(String place_id) throws Exception {
List<SelectedColumn> selectFields = new Vector<SelectedColumn>();
selectFields.add( new SelectedColumn(SelectedColumn.Type.INTEGER, "id") );
selectFields.add( new SelectedColumn(SelectedColumn.Type.INTEGER, "place_id") );
selectFields.add( new SelectedColumn(SelectedColumn.Type.STRING, "filename") );
selectFields.add( new SelectedColumn(SelectedColumn.Type.STRING, "mimetype") );
selectFields.add( new SelectedColumn(SelectedColumn.Type.STRING, "title") );
PreparedStatement stmt = connection.prepareStatement(
"SELECT id,place_id,filename,mimetype,title " +
"FROM contributions " +
"WHERE mimetype LIKE 'audio/%' AND place_id = ?;"
);
stmt.setInt(1, Integer.parseInt(place_id));
JSONArray array = executeStatementToJson(stmt, selectFields);
JSONObject result = new JSONObject();
result.put("media", array);
return result;
} | [
"public",
"JSONObject",
"getAudioMediaFromPlaceId",
"(",
"String",
"place_id",
")",
"throws",
"Exception",
"{",
"List",
"<",
"SelectedColumn",
">",
"selectFields",
"=",
"new",
"Vector",
"<",
"SelectedColumn",
">",
"(",
")",
";",
"selectFields",
".",
"add",
"(",
... | Finds and returns all audio media associated with a place id.
@param place_id Id of associated place
@return A JSON object containing all audio media
@throws Exception | [
"Finds",
"and",
"returns",
"all",
"audio",
"media",
"associated",
"with",
"a",
"place",
"id",
"."
] | train | https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-search/src/main/java/ca/carleton/gcrc/search/Searches.java#L663-L685 |
phax/ph-web | ph-http/src/main/java/com/helger/http/csp/CSP2SourceList.java | CSP2SourceList.addHash | @Nonnull
public CSP2SourceList addHash (@Nonnull final EMessageDigestAlgorithm eMDAlgo,
@Nonnull @Nonempty final byte [] aHashValue)
{
ValueEnforcer.notEmpty (aHashValue, "HashValue");
return addHash (eMDAlgo, Base64.safeEncodeBytes (aHashValue));
} | java | @Nonnull
public CSP2SourceList addHash (@Nonnull final EMessageDigestAlgorithm eMDAlgo,
@Nonnull @Nonempty final byte [] aHashValue)
{
ValueEnforcer.notEmpty (aHashValue, "HashValue");
return addHash (eMDAlgo, Base64.safeEncodeBytes (aHashValue));
} | [
"@",
"Nonnull",
"public",
"CSP2SourceList",
"addHash",
"(",
"@",
"Nonnull",
"final",
"EMessageDigestAlgorithm",
"eMDAlgo",
",",
"@",
"Nonnull",
"@",
"Nonempty",
"final",
"byte",
"[",
"]",
"aHashValue",
")",
"{",
"ValueEnforcer",
".",
"notEmpty",
"(",
"aHashValue... | Add the provided nonce value. The {@value #HASH_PREFIX} and
{@link #HASH_SUFFIX} are added automatically. The byte array is automatically
Bas64 encoded!
@param eMDAlgo
The message digest algorithm used. May only
{@link EMessageDigestAlgorithm#SHA_256},
{@link EMessageDigestAlgorithm#SHA_384} or
{@link EMessageDigestAlgorithm#SHA_512}. May not be <code>null</code>.
@param aHashValue
The plain hash digest value. May not be <code>null</code>.
@return this for chaining | [
"Add",
"the",
"provided",
"nonce",
"value",
".",
"The",
"{",
"@value",
"#HASH_PREFIX",
"}",
"and",
"{",
"@link",
"#HASH_SUFFIX",
"}",
"are",
"added",
"automatically",
".",
"The",
"byte",
"array",
"is",
"automatically",
"Bas64",
"encoded!"
] | train | https://github.com/phax/ph-web/blob/d445fd25184605b62682c93c9782409acf0ae813/ph-http/src/main/java/com/helger/http/csp/CSP2SourceList.java#L219-L225 |
unbescape/unbescape | src/main/java/org/unbescape/properties/PropertiesEscape.java | PropertiesEscape.escapePropertiesValue | public static void escapePropertiesValue(final Reader reader, final Writer writer)
throws IOException {
escapePropertiesValue(reader, writer, PropertiesValueEscapeLevel.LEVEL_2_ALL_NON_ASCII_PLUS_BASIC_ESCAPE_SET);
} | java | public static void escapePropertiesValue(final Reader reader, final Writer writer)
throws IOException {
escapePropertiesValue(reader, writer, PropertiesValueEscapeLevel.LEVEL_2_ALL_NON_ASCII_PLUS_BASIC_ESCAPE_SET);
} | [
"public",
"static",
"void",
"escapePropertiesValue",
"(",
"final",
"Reader",
"reader",
",",
"final",
"Writer",
"writer",
")",
"throws",
"IOException",
"{",
"escapePropertiesValue",
"(",
"reader",
",",
"writer",
",",
"PropertiesValueEscapeLevel",
".",
"LEVEL_2_ALL_NON_... | <p>
Perform a Java Properties Value level 2 (basic set and all non-ASCII chars) <strong>escape</strong> operation
on a <tt>Reader</tt> input, writing results to a <tt>Writer</tt>.
</p>
<p>
<em>Level 2</em> means this method will escape:
</p>
<ul>
<li>The Java Properties basic escape set:
<ul>
<li>The <em>Single Escape Characters</em>:
<tt>\t</tt> (<tt>U+0009</tt>),
<tt>\n</tt> (<tt>U+000A</tt>),
<tt>\f</tt> (<tt>U+000C</tt>),
<tt>\r</tt> (<tt>U+000D</tt>) and
<tt>\\</tt> (<tt>U+005C</tt>).
</li>
<li>
Two ranges of non-displayable, control characters (some of which are already part of the
<em>single escape characters</em> list): <tt>U+0000</tt> to <tt>U+001F</tt>
and <tt>U+007F</tt> to <tt>U+009F</tt>.
</li>
</ul>
</li>
<li>All non ASCII characters.</li>
</ul>
<p>
This escape will be performed by using the Single Escape Chars whenever possible. For escaped
characters that do not have an associated SEC, default to <tt>\uFFFF</tt>
Hexadecimal Escapes.
</p>
<p>
This method calls {@link #escapePropertiesValue(Reader, Writer, PropertiesValueEscapeLevel)}
with the following preconfigured values:
</p>
<ul>
<li><tt>level</tt>:
{@link PropertiesValueEscapeLevel#LEVEL_2_ALL_NON_ASCII_PLUS_BASIC_ESCAPE_SET}</li>
</ul>
<p>
This method is <strong>thread-safe</strong>.
</p>
@param reader the <tt>Reader</tt> reading the text to be escaped.
@param writer the <tt>java.io.Writer</tt> to which the escaped result will be written. Nothing will
be written at all to this writer if input is <tt>null</tt>.
@throws IOException if an input/output exception occurs
@since 1.1.2 | [
"<p",
">",
"Perform",
"a",
"Java",
"Properties",
"Value",
"level",
"2",
"(",
"basic",
"set",
"and",
"all",
"non",
"-",
"ASCII",
"chars",
")",
"<strong",
">",
"escape<",
"/",
"strong",
">",
"operation",
"on",
"a",
"<tt",
">",
"Reader<",
"/",
"tt",
">"... | train | https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/properties/PropertiesEscape.java#L540-L543 |
tumblr/jumblr | src/main/java/com/tumblr/jumblr/JumblrClient.java | JumblrClient.postEdit | public void postEdit(String blogName, Long id, Map<String, ?> detail) throws IOException {
Map<String, Object> sdetail = JumblrClient.safeOptionMap(detail);
sdetail.put("id", id);
requestBuilder.postMultipart(JumblrClient.blogPath(blogName, "/post/edit"), sdetail);
} | java | public void postEdit(String blogName, Long id, Map<String, ?> detail) throws IOException {
Map<String, Object> sdetail = JumblrClient.safeOptionMap(detail);
sdetail.put("id", id);
requestBuilder.postMultipart(JumblrClient.blogPath(blogName, "/post/edit"), sdetail);
} | [
"public",
"void",
"postEdit",
"(",
"String",
"blogName",
",",
"Long",
"id",
",",
"Map",
"<",
"String",
",",
"?",
">",
"detail",
")",
"throws",
"IOException",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"sdetail",
"=",
"JumblrClient",
".",
"safeOptionM... | Save edits for a given post
@param blogName The blog name of the post
@param id the Post id
@param detail The detail to save
@throws IOException if any file specified in detail cannot be read | [
"Save",
"edits",
"for",
"a",
"given",
"post"
] | train | https://github.com/tumblr/jumblr/blob/373629fd545defb016e227ea758f092507fbd624/src/main/java/com/tumblr/jumblr/JumblrClient.java#L371-L375 |
alkacon/opencms-core | src/org/opencms/mail/CmsMailUtil.java | CmsMailUtil.configureMail | public static void configureMail(CmsMailHost host, Email mail) {
// set the host to the default mail host
mail.setHostName(host.getHostname());
mail.setSmtpPort(host.getPort());
// check if username and password are provided
String userName = host.getUsername();
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(userName)) {
// authentication needed, set user name and password
mail.setAuthentication(userName, host.getPassword());
}
String security = host.getSecurity() != null ? host.getSecurity().trim() : null;
if (SECURITY_SSL.equalsIgnoreCase(security)) {
mail.setSslSmtpPort("" + host.getPort());
mail.setSSLOnConnect(true);
} else if (SECURITY_STARTTLS.equalsIgnoreCase(security)) {
mail.setStartTLSEnabled(true);
}
try {
// set default mail from address
mail.setFrom(OpenCms.getSystemInfo().getMailSettings().getMailFromDefault());
} catch (EmailException e) {
// default email address is not valid, log error
LOG.error(Messages.get().getBundle().key(Messages.LOG_INVALID_SENDER_ADDRESS_0), e);
}
} | java | public static void configureMail(CmsMailHost host, Email mail) {
// set the host to the default mail host
mail.setHostName(host.getHostname());
mail.setSmtpPort(host.getPort());
// check if username and password are provided
String userName = host.getUsername();
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(userName)) {
// authentication needed, set user name and password
mail.setAuthentication(userName, host.getPassword());
}
String security = host.getSecurity() != null ? host.getSecurity().trim() : null;
if (SECURITY_SSL.equalsIgnoreCase(security)) {
mail.setSslSmtpPort("" + host.getPort());
mail.setSSLOnConnect(true);
} else if (SECURITY_STARTTLS.equalsIgnoreCase(security)) {
mail.setStartTLSEnabled(true);
}
try {
// set default mail from address
mail.setFrom(OpenCms.getSystemInfo().getMailSettings().getMailFromDefault());
} catch (EmailException e) {
// default email address is not valid, log error
LOG.error(Messages.get().getBundle().key(Messages.LOG_INVALID_SENDER_ADDRESS_0), e);
}
} | [
"public",
"static",
"void",
"configureMail",
"(",
"CmsMailHost",
"host",
",",
"Email",
"mail",
")",
"{",
"// set the host to the default mail host",
"mail",
".",
"setHostName",
"(",
"host",
".",
"getHostname",
"(",
")",
")",
";",
"mail",
".",
"setSmtpPort",
"(",... | Configures the mail from the given mail host configuration data.<p>
@param host the mail host configuration
@param mail the email instance | [
"Configures",
"the",
"mail",
"from",
"the",
"given",
"mail",
"host",
"configuration",
"data",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/mail/CmsMailUtil.java#L65-L92 |
ahome-it/lienzo-core | src/main/java/com/ait/lienzo/client/core/shape/GroupOf.java | GroupOf.setScale | @Override
public C setScale(final double x, final double y)
{
getAttributes().setScale(x, y);
return cast();
} | java | @Override
public C setScale(final double x, final double y)
{
getAttributes().setScale(x, y);
return cast();
} | [
"@",
"Override",
"public",
"C",
"setScale",
"(",
"final",
"double",
"x",
",",
"final",
"double",
"y",
")",
"{",
"getAttributes",
"(",
")",
".",
"setScale",
"(",
"x",
",",
"y",
")",
";",
"return",
"cast",
"(",
")",
";",
"}"
] | Sets this gruop's scale, starting at the given x and y
@param x
@param y
@return Group this Group | [
"Sets",
"this",
"gruop",
"s",
"scale",
"starting",
"at",
"the",
"given",
"x",
"and",
"y"
] | train | https://github.com/ahome-it/lienzo-core/blob/8e03723700dec366f77064d12fb8676d8cd6be99/src/main/java/com/ait/lienzo/client/core/shape/GroupOf.java#L401-L407 |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/metadata/ejb/AutomaticTimerBean.java | AutomaticTimerBean.getBeanId | public BeanId getBeanId() {
if (ivBeanId == null) {
ivBeanId = new BeanId(ivBMD.j2eeName, null, false);
}
return ivBeanId;
} | java | public BeanId getBeanId() {
if (ivBeanId == null) {
ivBeanId = new BeanId(ivBMD.j2eeName, null, false);
}
return ivBeanId;
} | [
"public",
"BeanId",
"getBeanId",
"(",
")",
"{",
"if",
"(",
"ivBeanId",
"==",
"null",
")",
"{",
"ivBeanId",
"=",
"new",
"BeanId",
"(",
"ivBMD",
".",
"j2eeName",
",",
"null",
",",
"false",
")",
";",
"}",
"return",
"ivBeanId",
";",
"}"
] | Gets the partially formed BeanId for this bean. The resulting
BeanId will not have a home reference.
@return the partially formed BeanId | [
"Gets",
"the",
"partially",
"formed",
"BeanId",
"for",
"this",
"bean",
".",
"The",
"resulting",
"BeanId",
"will",
"not",
"have",
"a",
"home",
"reference",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/metadata/ejb/AutomaticTimerBean.java#L127-L132 |
jbundle/jbundle | app/program/screen/src/main/java/org/jbundle/app/program/screen/ClassInfoGridScreen.java | ClassInfoGridScreen.doCommand | public boolean doCommand(String strCommand, ScreenField sourceSField, int iCommandOptions)
{
if ((MenuConstants.FORM.equalsIgnoreCase(strCommand)) || (MenuConstants.FORMLINK.equalsIgnoreCase(strCommand)))
if (this.getMainRecord().getEditMode() == DBConstants.EDIT_ADD)
if (!this.getMainRecord().getField(ClassInfo.CLASS_PROJECT_ID).isNull())
{
strCommand = Utility.addURLParam(null, DBParams.COMMAND, strCommand);
strCommand = Utility.addURLParam(strCommand, DBParams.RECORD, ClassInfo.class.getName());
strCommand = Utility.addURLParam(strCommand, DBParams.HEADER_OBJECT_ID, this.getMainRecord().getField(ClassInfo.CLASS_PROJECT_ID).toString());
}
return super.doCommand(strCommand, sourceSField, iCommandOptions);
} | java | public boolean doCommand(String strCommand, ScreenField sourceSField, int iCommandOptions)
{
if ((MenuConstants.FORM.equalsIgnoreCase(strCommand)) || (MenuConstants.FORMLINK.equalsIgnoreCase(strCommand)))
if (this.getMainRecord().getEditMode() == DBConstants.EDIT_ADD)
if (!this.getMainRecord().getField(ClassInfo.CLASS_PROJECT_ID).isNull())
{
strCommand = Utility.addURLParam(null, DBParams.COMMAND, strCommand);
strCommand = Utility.addURLParam(strCommand, DBParams.RECORD, ClassInfo.class.getName());
strCommand = Utility.addURLParam(strCommand, DBParams.HEADER_OBJECT_ID, this.getMainRecord().getField(ClassInfo.CLASS_PROJECT_ID).toString());
}
return super.doCommand(strCommand, sourceSField, iCommandOptions);
} | [
"public",
"boolean",
"doCommand",
"(",
"String",
"strCommand",
",",
"ScreenField",
"sourceSField",
",",
"int",
"iCommandOptions",
")",
"{",
"if",
"(",
"(",
"MenuConstants",
".",
"FORM",
".",
"equalsIgnoreCase",
"(",
"strCommand",
")",
")",
"||",
"(",
"MenuCons... | Process the command.
<br />Step 1 - Process the command if possible and return true if processed.
<br />Step 2 - If I can't process, pass to all children (with me as the source).
<br />Step 3 - If children didn't process, pass to parent (with me as the source).
<br />Note: Never pass to a parent or child that matches the source (to avoid an endless loop).
@param strCommand The command to process.
@param sourceSField The source screen field (to avoid echos).
@param iCommandOptions If this command creates a new screen, create in a new window?
@return true if success. | [
"Process",
"the",
"command",
".",
"<br",
"/",
">",
"Step",
"1",
"-",
"Process",
"the",
"command",
"if",
"possible",
"and",
"return",
"true",
"if",
"processed",
".",
"<br",
"/",
">",
"Step",
"2",
"-",
"If",
"I",
"can",
"t",
"process",
"pass",
"to",
... | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/screen/src/main/java/org/jbundle/app/program/screen/ClassInfoGridScreen.java#L169-L180 |
aNNiMON/Lightweight-Stream-API | stream/src/main/java/com/annimon/stream/IntStream.java | IntStream.takeWhile | @NotNull
public IntStream takeWhile(@NotNull final IntPredicate predicate) {
return new IntStream(params, new IntTakeWhile(iterator, predicate));
} | java | @NotNull
public IntStream takeWhile(@NotNull final IntPredicate predicate) {
return new IntStream(params, new IntTakeWhile(iterator, predicate));
} | [
"@",
"NotNull",
"public",
"IntStream",
"takeWhile",
"(",
"@",
"NotNull",
"final",
"IntPredicate",
"predicate",
")",
"{",
"return",
"new",
"IntStream",
"(",
"params",
",",
"new",
"IntTakeWhile",
"(",
"iterator",
",",
"predicate",
")",
")",
";",
"}"
] | Takes elements while the predicate returns {@code true}.
<p>This is an intermediate operation.
<p>Example:
<pre>
predicate: (a) -> a < 3
stream: [1, 2, 3, 4, 1, 2, 3, 4]
result: [1, 2]
</pre>
@param predicate the predicate used to take elements
@return the new {@code IntStream} | [
"Takes",
"elements",
"while",
"the",
"predicate",
"returns",
"{",
"@code",
"true",
"}",
"."
] | train | https://github.com/aNNiMON/Lightweight-Stream-API/blob/f29fd57208c20252a4549b084d55ed082c3e58f0/stream/src/main/java/com/annimon/stream/IntStream.java#L755-L758 |
UrielCh/ovh-java-sdk | ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java | ApiOvhTelephony.billingAccount_trunk_serviceName_externalDisplayedNumber_POST | public OvhTrunkExternalDisplayedNumber billingAccount_trunk_serviceName_externalDisplayedNumber_POST(String billingAccount, String serviceName, Boolean autoValidation, String number) throws IOException {
String qPath = "/telephony/{billingAccount}/trunk/{serviceName}/externalDisplayedNumber";
StringBuilder sb = path(qPath, billingAccount, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "autoValidation", autoValidation);
addBody(o, "number", number);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhTrunkExternalDisplayedNumber.class);
} | java | public OvhTrunkExternalDisplayedNumber billingAccount_trunk_serviceName_externalDisplayedNumber_POST(String billingAccount, String serviceName, Boolean autoValidation, String number) throws IOException {
String qPath = "/telephony/{billingAccount}/trunk/{serviceName}/externalDisplayedNumber";
StringBuilder sb = path(qPath, billingAccount, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "autoValidation", autoValidation);
addBody(o, "number", number);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhTrunkExternalDisplayedNumber.class);
} | [
"public",
"OvhTrunkExternalDisplayedNumber",
"billingAccount_trunk_serviceName_externalDisplayedNumber_POST",
"(",
"String",
"billingAccount",
",",
"String",
"serviceName",
",",
"Boolean",
"autoValidation",
",",
"String",
"number",
")",
"throws",
"IOException",
"{",
"String",
... | External displayed number creation for a given trunk
REST: POST /telephony/{billingAccount}/trunk/{serviceName}/externalDisplayedNumber
@param number [required] External displayed number to create, in international format
@param autoValidation [required] External displayed number auto-validation. Only available for partner. Must be owner of the number.
@param billingAccount [required] The name of your billingAccount
@param serviceName [required] Name of the service | [
"External",
"displayed",
"number",
"creation",
"for",
"a",
"given",
"trunk"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L8117-L8125 |
netplex/json-smart-v2 | json-smart/src/main/java/net/minidev/json/JSONObject.java | JSONObject.writeJSON | public static void writeJSON(Map<String, ? extends Object> map, Appendable out, JSONStyle compression)
throws IOException {
if (map == null) {
out.append("null");
return;
}
JsonWriter.JSONMapWriter.writeJSONString(map, out, compression);
} | java | public static void writeJSON(Map<String, ? extends Object> map, Appendable out, JSONStyle compression)
throws IOException {
if (map == null) {
out.append("null");
return;
}
JsonWriter.JSONMapWriter.writeJSONString(map, out, compression);
} | [
"public",
"static",
"void",
"writeJSON",
"(",
"Map",
"<",
"String",
",",
"?",
"extends",
"Object",
">",
"map",
",",
"Appendable",
"out",
",",
"JSONStyle",
"compression",
")",
"throws",
"IOException",
"{",
"if",
"(",
"map",
"==",
"null",
")",
"{",
"out",
... | Encode a map into JSON text and write it to out. If this map is also a
JSONAware or JSONStreamAware, JSONAware or JSONStreamAware specific
behaviours will be ignored at this top level.
@see JSONValue#writeJSONString(Object, Appendable) | [
"Encode",
"a",
"map",
"into",
"JSON",
"text",
"and",
"write",
"it",
"to",
"out",
".",
"If",
"this",
"map",
"is",
"also",
"a",
"JSONAware",
"or",
"JSONStreamAware",
"JSONAware",
"or",
"JSONStreamAware",
"specific",
"behaviours",
"will",
"be",
"ignored",
"at",... | train | https://github.com/netplex/json-smart-v2/blob/bfb3daef039e22a7bbff5f76bf14ea23330cd70e/json-smart/src/main/java/net/minidev/json/JSONObject.java#L180-L187 |
GenesysPureEngage/workspace-client-java | src/main/java/com/genesys/workspace/VoiceApi.java | VoiceApi.initiateTransfer | public void initiateTransfer(
String connId,
String destination,
String location,
String outboundCallerId,
KeyValueCollection userData,
KeyValueCollection reasons,
KeyValueCollection extensions
) throws WorkspaceApiException {
try {
VoicecallsidinitiatetransferData data = new VoicecallsidinitiatetransferData();
data.setDestination(destination);
data.setLocation(location);
data.setOutboundCallerId(outboundCallerId);
data.setUserData(Util.toKVList(userData));
data.setReasons(Util.toKVList(reasons));
data.setExtensions(Util.toKVList(extensions));
InitiateTransferData initData = new InitiateTransferData();
initData.data(data);
ApiSuccessResponse response = this.voiceApi.initiateTransfer(connId, initData);
throwIfNotOk("initiateTransfer", response);
} catch (ApiException e) {
throw new WorkspaceApiException("initiateTransfer failed.", e);
}
} | java | public void initiateTransfer(
String connId,
String destination,
String location,
String outboundCallerId,
KeyValueCollection userData,
KeyValueCollection reasons,
KeyValueCollection extensions
) throws WorkspaceApiException {
try {
VoicecallsidinitiatetransferData data = new VoicecallsidinitiatetransferData();
data.setDestination(destination);
data.setLocation(location);
data.setOutboundCallerId(outboundCallerId);
data.setUserData(Util.toKVList(userData));
data.setReasons(Util.toKVList(reasons));
data.setExtensions(Util.toKVList(extensions));
InitiateTransferData initData = new InitiateTransferData();
initData.data(data);
ApiSuccessResponse response = this.voiceApi.initiateTransfer(connId, initData);
throwIfNotOk("initiateTransfer", response);
} catch (ApiException e) {
throw new WorkspaceApiException("initiateTransfer failed.", e);
}
} | [
"public",
"void",
"initiateTransfer",
"(",
"String",
"connId",
",",
"String",
"destination",
",",
"String",
"location",
",",
"String",
"outboundCallerId",
",",
"KeyValueCollection",
"userData",
",",
"KeyValueCollection",
"reasons",
",",
"KeyValueCollection",
"extensions... | Initiate a two-step transfer by placing the first call on hold and dialing the destination number (step 1).
After initiating the transfer, you can use `completeTransfer()` to complete the transfer (step 2).
@param connId The connection ID of the call to be transferred. This call will be placed on hold.
@param destination The number where the call will be transferred.
@param location Name of the remote location in the form of <SwitchName> or <T-ServerApplicationName>@<SwitchName>. This value is used by Workspace to set the location attribute for the corresponding T-Server requests. (optional)
@param outboundCallerId The caller ID information to display on the destination party's phone. The value should be set as CPNDigits. For more information about caller ID, see the SIP Server Deployment Guide. (optional)
@param userData Key/value data to include with the call. (optional)
@param reasons Information on causes for, and results of, actions taken by the user of the current DN. For details about reasons, refer to the [*Genesys Events and Models Reference Manual*](https://docs.genesys.com/Documentation/System/Current/GenEM/Reasons). (optional)
@param extensions Media device/hardware reason codes and similar information. For details about extensions, refer to the [*Genesys Events and Models Reference Manual*](https://docs.genesys.com/Documentation/System/Current/GenEM/Extensions). (optional) | [
"Initiate",
"a",
"two",
"-",
"step",
"transfer",
"by",
"placing",
"the",
"first",
"call",
"on",
"hold",
"and",
"dialing",
"the",
"destination",
"number",
"(",
"step",
"1",
")",
".",
"After",
"initiating",
"the",
"transfer",
"you",
"can",
"use",
"completeTr... | train | https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/workspace/VoiceApi.java#L798-L823 |
m-m-m/util | version/src/main/java/net/sf/mmm/util/version/base/AbstractVersionIdentifier.java | AbstractVersionIdentifier.compareToTimestamp | private int compareToTimestamp(int currentResult, VersionIdentifier otherVersion) {
return compareToLinear(currentResult, getTimestamp(), otherVersion.getTimestamp(), otherVersion);
} | java | private int compareToTimestamp(int currentResult, VersionIdentifier otherVersion) {
return compareToLinear(currentResult, getTimestamp(), otherVersion.getTimestamp(), otherVersion);
} | [
"private",
"int",
"compareToTimestamp",
"(",
"int",
"currentResult",
",",
"VersionIdentifier",
"otherVersion",
")",
"{",
"return",
"compareToLinear",
"(",
"currentResult",
",",
"getTimestamp",
"(",
")",
",",
"otherVersion",
".",
"getTimestamp",
"(",
")",
",",
"oth... | This method performs the part of {@link #compareTo(VersionIdentifier)} for the {@link #getTimestamp()
timestamp}.
@param currentResult is the current result so far.
@param otherVersion is the {@link VersionIdentifier} to compare to.
@return the result of comparison. | [
"This",
"method",
"performs",
"the",
"part",
"of",
"{",
"@link",
"#compareTo",
"(",
"VersionIdentifier",
")",
"}",
"for",
"the",
"{",
"@link",
"#getTimestamp",
"()",
"timestamp",
"}",
"."
] | train | https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/version/src/main/java/net/sf/mmm/util/version/base/AbstractVersionIdentifier.java#L207-L210 |
google/error-prone-javac | src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassUseWriter.java | ClassUseWriter.generate | public static void generate(ConfigurationImpl configuration, ClassTree classtree) throws DocFileIOException {
ClassUseMapper mapper = new ClassUseMapper(configuration, classtree);
for (TypeElement aClass : configuration.getIncludedTypeElements()) {
// If -nodeprecated option is set and the containing package is marked
// as deprecated, do not generate the class-use page. We will still generate
// the class-use page if the class is marked as deprecated but the containing
// package is not since it could still be linked from that package-use page.
if (!(configuration.nodeprecated &&
configuration.utils.isDeprecated(configuration.utils.containingPackage(aClass))))
ClassUseWriter.generate(configuration, mapper, aClass);
}
for (PackageElement pkg : configuration.packages) {
// If -nodeprecated option is set and the package is marked
// as deprecated, do not generate the package-use page.
if (!(configuration.nodeprecated && configuration.utils.isDeprecated(pkg)))
PackageUseWriter.generate(configuration, mapper, pkg);
}
} | java | public static void generate(ConfigurationImpl configuration, ClassTree classtree) throws DocFileIOException {
ClassUseMapper mapper = new ClassUseMapper(configuration, classtree);
for (TypeElement aClass : configuration.getIncludedTypeElements()) {
// If -nodeprecated option is set and the containing package is marked
// as deprecated, do not generate the class-use page. We will still generate
// the class-use page if the class is marked as deprecated but the containing
// package is not since it could still be linked from that package-use page.
if (!(configuration.nodeprecated &&
configuration.utils.isDeprecated(configuration.utils.containingPackage(aClass))))
ClassUseWriter.generate(configuration, mapper, aClass);
}
for (PackageElement pkg : configuration.packages) {
// If -nodeprecated option is set and the package is marked
// as deprecated, do not generate the package-use page.
if (!(configuration.nodeprecated && configuration.utils.isDeprecated(pkg)))
PackageUseWriter.generate(configuration, mapper, pkg);
}
} | [
"public",
"static",
"void",
"generate",
"(",
"ConfigurationImpl",
"configuration",
",",
"ClassTree",
"classtree",
")",
"throws",
"DocFileIOException",
"{",
"ClassUseMapper",
"mapper",
"=",
"new",
"ClassUseMapper",
"(",
"configuration",
",",
"classtree",
")",
";",
"f... | Write out class use pages.
@param configuration the configuration for this doclet
@param classtree the class tree hierarchy
@throws DocFileIOException if there is an error while generating the documentation | [
"Write",
"out",
"class",
"use",
"pages",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassUseWriter.java#L180-L197 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/Instance.java | Instance.setMachineType | public Operation setMachineType(MachineTypeId machineType, OperationOption... options) {
return compute.setMachineType(getInstanceId(), machineType, options);
} | java | public Operation setMachineType(MachineTypeId machineType, OperationOption... options) {
return compute.setMachineType(getInstanceId(), machineType, options);
} | [
"public",
"Operation",
"setMachineType",
"(",
"MachineTypeId",
"machineType",
",",
"OperationOption",
"...",
"options",
")",
"{",
"return",
"compute",
".",
"setMachineType",
"(",
"getInstanceId",
"(",
")",
",",
"machineType",
",",
"options",
")",
";",
"}"
] | Sets the machine type for this instance. The instance must be in {@link
InstanceInfo.Status#TERMINATED} state to be able to set its machine type.
@return a zone operation if the set request was issued correctly, {@code null} if the instance
was not found
@throws ComputeException upon failure | [
"Sets",
"the",
"machine",
"type",
"for",
"this",
"instance",
".",
"The",
"instance",
"must",
"be",
"in",
"{",
"@link",
"InstanceInfo",
".",
"Status#TERMINATED",
"}",
"state",
"to",
"be",
"able",
"to",
"set",
"its",
"machine",
"type",
"."
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/Instance.java#L348-L350 |
looly/hutool | hutool-system/src/main/java/cn/hutool/system/SystemUtil.java | SystemUtil.get | public static String get(String name, String defaultValue) {
return StrUtil.nullToDefault(get(name, false), defaultValue);
} | java | public static String get(String name, String defaultValue) {
return StrUtil.nullToDefault(get(name, false), defaultValue);
} | [
"public",
"static",
"String",
"get",
"(",
"String",
"name",
",",
"String",
"defaultValue",
")",
"{",
"return",
"StrUtil",
".",
"nullToDefault",
"(",
"get",
"(",
"name",
",",
"false",
")",
",",
"defaultValue",
")",
";",
"}"
] | 取得系统属性,如果因为Java安全的限制而失败,则将错误打在Log中,然后返回 <code>null</code>。
@param name 属性名
@param defaultValue 默认值
@return 属性值或<code>null</code> | [
"取得系统属性,如果因为Java安全的限制而失败,则将错误打在Log中,然后返回",
"<code",
">",
"null<",
"/",
"code",
">",
"。"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-system/src/main/java/cn/hutool/system/SystemUtil.java#L106-L108 |
rythmengine/rythmengine | src/main/java/org/rythmengine/internal/parser/build_in/ExpressionParser.java | ExpressionParser.assertBasic | public static String assertBasic(String symbol, IContext context) {
if (symbol.contains("_utils.sep(\"")) return symbol;// Rythm builtin expression TODO: generalize
//String s = Token.stripJavaExtension(symbol, context);
//s = S.stripBrace(s);
String s = symbol;
boolean isSimple = Patterns.VarName.matches(s);
IContext ctx = context;
if (!isSimple) {
throw new TemplateParser.ComplexExpressionException(ctx);
}
return s;
} | java | public static String assertBasic(String symbol, IContext context) {
if (symbol.contains("_utils.sep(\"")) return symbol;// Rythm builtin expression TODO: generalize
//String s = Token.stripJavaExtension(symbol, context);
//s = S.stripBrace(s);
String s = symbol;
boolean isSimple = Patterns.VarName.matches(s);
IContext ctx = context;
if (!isSimple) {
throw new TemplateParser.ComplexExpressionException(ctx);
}
return s;
} | [
"public",
"static",
"String",
"assertBasic",
"(",
"String",
"symbol",
",",
"IContext",
"context",
")",
"{",
"if",
"(",
"symbol",
".",
"contains",
"(",
"\"_utils.sep(\\\"\"",
")",
")",
"return",
"symbol",
";",
"// Rythm builtin expression TODO: generalize",
"//String... | Return symbol with transformer extension stripped off
@param symbol
@param context
@return the symbol | [
"Return",
"symbol",
"with",
"transformer",
"extension",
"stripped",
"off"
] | train | https://github.com/rythmengine/rythmengine/blob/064b565f08d9da07378bf77a9dd856ea5831cc92/src/main/java/org/rythmengine/internal/parser/build_in/ExpressionParser.java#L33-L44 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/string/StringHelper.java | StringHelper.trimStartAndEnd | @Nullable
@CheckReturnValue
public static String trimStartAndEnd (@Nullable final String sSrc,
@Nullable final String sLead,
@Nullable final String sTail)
{
final String sInbetween = trimStart (sSrc, sLead);
return trimEnd (sInbetween, sTail);
} | java | @Nullable
@CheckReturnValue
public static String trimStartAndEnd (@Nullable final String sSrc,
@Nullable final String sLead,
@Nullable final String sTail)
{
final String sInbetween = trimStart (sSrc, sLead);
return trimEnd (sInbetween, sTail);
} | [
"@",
"Nullable",
"@",
"CheckReturnValue",
"public",
"static",
"String",
"trimStartAndEnd",
"(",
"@",
"Nullable",
"final",
"String",
"sSrc",
",",
"@",
"Nullable",
"final",
"String",
"sLead",
",",
"@",
"Nullable",
"final",
"String",
"sTail",
")",
"{",
"final",
... | Trim the passed lead and tail from the source value. If the source value does
not start with the passed lead and does not end with the passed tail, nothing
happens.
@param sSrc
The input source string
@param sLead
The string to be trimmed of the beginning
@param sTail
The string to be trimmed of the end
@return The trimmed string, or the original input string, if the lead and the
tail were not found
@see #trimStart(String, String)
@see #trimEnd(String, String)
@see #trimStartAndEnd(String, String) | [
"Trim",
"the",
"passed",
"lead",
"and",
"tail",
"from",
"the",
"source",
"value",
".",
"If",
"the",
"source",
"value",
"does",
"not",
"start",
"with",
"the",
"passed",
"lead",
"and",
"does",
"not",
"end",
"with",
"the",
"passed",
"tail",
"nothing",
"happ... | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L3492-L3500 |
QSFT/Doradus | doradus-common/src/main/java/com/dell/doradus/common/Utils.java | Utils.getMD5 | public static byte[] getMD5(byte[] src) {
assert src != null;
try {
return MessageDigest.getInstance("MD5").digest(src);
} catch (NoSuchAlgorithmException ex) {
throw new IllegalArgumentException("Missing 'MD5' algorithm", ex);
}
} | java | public static byte[] getMD5(byte[] src) {
assert src != null;
try {
return MessageDigest.getInstance("MD5").digest(src);
} catch (NoSuchAlgorithmException ex) {
throw new IllegalArgumentException("Missing 'MD5' algorithm", ex);
}
} | [
"public",
"static",
"byte",
"[",
"]",
"getMD5",
"(",
"byte",
"[",
"]",
"src",
")",
"{",
"assert",
"src",
"!=",
"null",
";",
"try",
"{",
"return",
"MessageDigest",
".",
"getInstance",
"(",
"\"MD5\"",
")",
".",
"digest",
"(",
"src",
")",
";",
"}",
"c... | Compute the MD5 of the given byte[] array. If the MD5 algorithm is not available
from the MessageDigest registry, an IllegalArgumentException will be thrown.
@param src Binary value to compute the MD5 digest for. Can be empty but not null.
@return 16-byte MD5 digest value. | [
"Compute",
"the",
"MD5",
"of",
"the",
"given",
"byte",
"[]",
"array",
".",
"If",
"the",
"MD5",
"algorithm",
"is",
"not",
"available",
"from",
"the",
"MessageDigest",
"registry",
"an",
"IllegalArgumentException",
"will",
"be",
"thrown",
"."
] | train | https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-common/src/main/java/com/dell/doradus/common/Utils.java#L968-L975 |
Alluxio/alluxio | core/common/src/main/java/alluxio/util/UnderFileSystemUtils.java | UnderFileSystemUtils.approximateContentHash | public static String approximateContentHash(long length, long modTime) {
// approximating the content hash with the file length and modtime.
StringBuilder sb = new StringBuilder();
sb.append('(');
sb.append("len:");
sb.append(length);
sb.append(", ");
sb.append("modtime:");
sb.append(modTime);
sb.append(')');
return sb.toString();
} | java | public static String approximateContentHash(long length, long modTime) {
// approximating the content hash with the file length and modtime.
StringBuilder sb = new StringBuilder();
sb.append('(');
sb.append("len:");
sb.append(length);
sb.append(", ");
sb.append("modtime:");
sb.append(modTime);
sb.append(')');
return sb.toString();
} | [
"public",
"static",
"String",
"approximateContentHash",
"(",
"long",
"length",
",",
"long",
"modTime",
")",
"{",
"// approximating the content hash with the file length and modtime.",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"sb",
".",
"append"... | Returns an approximate content hash, using the length and modification time.
@param length the content length
@param modTime the content last modification time
@return the content hash | [
"Returns",
"an",
"approximate",
"content",
"hash",
"using",
"the",
"length",
"and",
"modification",
"time",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/util/UnderFileSystemUtils.java#L147-L158 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/io/stream/StreamHelper.java | StreamHelper.skipFully | public static void skipFully (@Nonnull final InputStream aIS, @Nonnegative final long nBytesToSkip) throws IOException
{
ValueEnforcer.notNull (aIS, "InputStream");
ValueEnforcer.isGE0 (nBytesToSkip, "BytesToSkip");
long nRemaining = nBytesToSkip;
while (nRemaining > 0)
{
// May only return a partial skip
final long nSkipped = aIS.skip (nRemaining);
if (nSkipped == 0)
{
// Check if we're at the end of the file or not
// -> blocking read!
if (aIS.read () == -1)
{
throw new EOFException ("Failed to skip a total of " +
nBytesToSkip +
" bytes on input stream. Only skipped " +
(nBytesToSkip - nRemaining) +
" bytes so far!");
}
nRemaining--;
}
else
{
// Skipped at least one char
nRemaining -= nSkipped;
}
}
} | java | public static void skipFully (@Nonnull final InputStream aIS, @Nonnegative final long nBytesToSkip) throws IOException
{
ValueEnforcer.notNull (aIS, "InputStream");
ValueEnforcer.isGE0 (nBytesToSkip, "BytesToSkip");
long nRemaining = nBytesToSkip;
while (nRemaining > 0)
{
// May only return a partial skip
final long nSkipped = aIS.skip (nRemaining);
if (nSkipped == 0)
{
// Check if we're at the end of the file or not
// -> blocking read!
if (aIS.read () == -1)
{
throw new EOFException ("Failed to skip a total of " +
nBytesToSkip +
" bytes on input stream. Only skipped " +
(nBytesToSkip - nRemaining) +
" bytes so far!");
}
nRemaining--;
}
else
{
// Skipped at least one char
nRemaining -= nSkipped;
}
}
} | [
"public",
"static",
"void",
"skipFully",
"(",
"@",
"Nonnull",
"final",
"InputStream",
"aIS",
",",
"@",
"Nonnegative",
"final",
"long",
"nBytesToSkip",
")",
"throws",
"IOException",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"aIS",
",",
"\"InputStream\"",
")",
... | Fully skip the passed amounts in the input stream. Only forward skipping is
possible!
@param aIS
The input stream to skip in.
@param nBytesToSkip
The number of bytes to skip. Must be ≥ 0.
@throws IOException
In case something goes wrong internally | [
"Fully",
"skip",
"the",
"passed",
"amounts",
"in",
"the",
"input",
"stream",
".",
"Only",
"forward",
"skipping",
"is",
"possible!"
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/io/stream/StreamHelper.java#L1369-L1399 |
ThreeTen/threetenbp | src/main/java/org/threeten/bp/ZonedDateTime.java | ZonedDateTime.ofInstant | public static ZonedDateTime ofInstant(Instant instant, ZoneId zone) {
Jdk8Methods.requireNonNull(instant, "instant");
Jdk8Methods.requireNonNull(zone, "zone");
return create(instant.getEpochSecond(), instant.getNano(), zone);
} | java | public static ZonedDateTime ofInstant(Instant instant, ZoneId zone) {
Jdk8Methods.requireNonNull(instant, "instant");
Jdk8Methods.requireNonNull(zone, "zone");
return create(instant.getEpochSecond(), instant.getNano(), zone);
} | [
"public",
"static",
"ZonedDateTime",
"ofInstant",
"(",
"Instant",
"instant",
",",
"ZoneId",
"zone",
")",
"{",
"Jdk8Methods",
".",
"requireNonNull",
"(",
"instant",
",",
"\"instant\"",
")",
";",
"Jdk8Methods",
".",
"requireNonNull",
"(",
"zone",
",",
"\"zone\"",
... | Obtains an instance of {@code ZonedDateTime} from an {@code Instant}.
<p>
This creates a zoned date-time with the same instant as that specified.
Calling {@link #toInstant()} will return an instant equal to the one used here.
<p>
Converting an instant to a zoned date-time is simple as there is only one valid
offset for each instant.
@param instant the instant to create the date-time from, not null
@param zone the time-zone, not null
@return the zoned date-time, not null
@throws DateTimeException if the result exceeds the supported range | [
"Obtains",
"an",
"instance",
"of",
"{",
"@code",
"ZonedDateTime",
"}",
"from",
"an",
"{",
"@code",
"Instant",
"}",
".",
"<p",
">",
"This",
"creates",
"a",
"zoned",
"date",
"-",
"time",
"with",
"the",
"same",
"instant",
"as",
"that",
"specified",
".",
"... | train | https://github.com/ThreeTen/threetenbp/blob/5f05b649f89f205aabd96b2f83c36796ec616fe6/src/main/java/org/threeten/bp/ZonedDateTime.java#L375-L379 |
killbilling/recurly-java-library | src/main/java/com/ning/billing/recurly/RecurlyClient.java | RecurlyClient.deleteShippingAddress | public void deleteShippingAddress(final String accountCode, final long shippingAddressId) {
doDELETE(Accounts.ACCOUNTS_RESOURCE + "/" + accountCode + ShippingAddresses.SHIPPING_ADDRESSES_RESOURCE + "/" + shippingAddressId);
} | java | public void deleteShippingAddress(final String accountCode, final long shippingAddressId) {
doDELETE(Accounts.ACCOUNTS_RESOURCE + "/" + accountCode + ShippingAddresses.SHIPPING_ADDRESSES_RESOURCE + "/" + shippingAddressId);
} | [
"public",
"void",
"deleteShippingAddress",
"(",
"final",
"String",
"accountCode",
",",
"final",
"long",
"shippingAddressId",
")",
"{",
"doDELETE",
"(",
"Accounts",
".",
"ACCOUNTS_RESOURCE",
"+",
"\"/\"",
"+",
"accountCode",
"+",
"ShippingAddresses",
".",
"SHIPPING_A... | Delete an existing shipping address
<p>
@param accountCode recurly account id
@param shippingAddressId the shipping address id to delete | [
"Delete",
"an",
"existing",
"shipping",
"address",
"<p",
">"
] | train | https://github.com/killbilling/recurly-java-library/blob/5e05eedd91885a51e1aa8293bd41139d082cf7f4/src/main/java/com/ning/billing/recurly/RecurlyClient.java#L1231-L1233 |
UrielCh/ovh-java-sdk | ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java | ApiOvhTelephony.billingAccount_trunk_serviceName_externalDisplayedNumber_number_DELETE | public void billingAccount_trunk_serviceName_externalDisplayedNumber_number_DELETE(String billingAccount, String serviceName, String number) throws IOException {
String qPath = "/telephony/{billingAccount}/trunk/{serviceName}/externalDisplayedNumber/{number}";
StringBuilder sb = path(qPath, billingAccount, serviceName, number);
exec(qPath, "DELETE", sb.toString(), null);
} | java | public void billingAccount_trunk_serviceName_externalDisplayedNumber_number_DELETE(String billingAccount, String serviceName, String number) throws IOException {
String qPath = "/telephony/{billingAccount}/trunk/{serviceName}/externalDisplayedNumber/{number}";
StringBuilder sb = path(qPath, billingAccount, serviceName, number);
exec(qPath, "DELETE", sb.toString(), null);
} | [
"public",
"void",
"billingAccount_trunk_serviceName_externalDisplayedNumber_number_DELETE",
"(",
"String",
"billingAccount",
",",
"String",
"serviceName",
",",
"String",
"number",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/telephony/{billingAccount}/trunk/{s... | Delete an external displayed number for a given trunk
REST: DELETE /telephony/{billingAccount}/trunk/{serviceName}/externalDisplayedNumber/{number}
@param billingAccount [required] The name of your billingAccount
@param serviceName [required] Name of the service
@param number [required] External displayed number linked to a trunk | [
"Delete",
"an",
"external",
"displayed",
"number",
"for",
"a",
"given",
"trunk"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L8150-L8154 |
iron-io/iron_mq_java | src/main/java/io/iron/ironmq/Queue.java | Queue.releaseMessage | public void releaseMessage(Message message, int delay) throws IOException {
releaseMessage(message.getId(), message.getReservationId(), new Long(delay));
} | java | public void releaseMessage(Message message, int delay) throws IOException {
releaseMessage(message.getId(), message.getReservationId(), new Long(delay));
} | [
"public",
"void",
"releaseMessage",
"(",
"Message",
"message",
",",
"int",
"delay",
")",
"throws",
"IOException",
"{",
"releaseMessage",
"(",
"message",
".",
"getId",
"(",
")",
",",
"message",
".",
"getReservationId",
"(",
")",
",",
"new",
"Long",
"(",
"de... | Release reserved message after specified time. If there is no message with such id on the queue, an
EmptyQueueException is thrown.
@param message The message to release.
@param delay The time after which the message will be released.
@throws io.iron.ironmq.HTTPException If the IronMQ service returns a status other than 200 OK.
@throws java.io.IOException If there is an error accessing the IronMQ server. | [
"Release",
"reserved",
"message",
"after",
"specified",
"time",
".",
"If",
"there",
"is",
"no",
"message",
"with",
"such",
"id",
"on",
"the",
"queue",
"an",
"EmptyQueueException",
"is",
"thrown",
"."
] | train | https://github.com/iron-io/iron_mq_java/blob/62d6a86545ca7ef31b7b4797aae0c5b31394a507/src/main/java/io/iron/ironmq/Queue.java#L503-L505 |
line/armeria | core/src/main/java/com/linecorp/armeria/common/MediaType.java | MediaType.withParameters | public MediaType withParameters(Map<String, ? extends Iterable<String>> parameters) {
final ImmutableListMultimap.Builder<String, String> builder = ImmutableListMultimap.builder();
for (Map.Entry<String, ? extends Iterable<String>> e : parameters.entrySet()) {
final String k = e.getKey();
for (String v : e.getValue()) {
builder.put(k, v);
}
}
return create(type, subtype, builder.build());
} | java | public MediaType withParameters(Map<String, ? extends Iterable<String>> parameters) {
final ImmutableListMultimap.Builder<String, String> builder = ImmutableListMultimap.builder();
for (Map.Entry<String, ? extends Iterable<String>> e : parameters.entrySet()) {
final String k = e.getKey();
for (String v : e.getValue()) {
builder.put(k, v);
}
}
return create(type, subtype, builder.build());
} | [
"public",
"MediaType",
"withParameters",
"(",
"Map",
"<",
"String",
",",
"?",
"extends",
"Iterable",
"<",
"String",
">",
">",
"parameters",
")",
"{",
"final",
"ImmutableListMultimap",
".",
"Builder",
"<",
"String",
",",
"String",
">",
"builder",
"=",
"Immuta... | <em>Replaces</em> all parameters with the given parameters.
@throws IllegalArgumentException if any parameter or value is invalid | [
"<em",
">",
"Replaces<",
"/",
"em",
">",
"all",
"parameters",
"with",
"the",
"given",
"parameters",
"."
] | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/common/MediaType.java#L685-L694 |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/beans/AbstractBean.java | AbstractBean.compareTo | @SuppressWarnings("all")
public int compareTo(Bean<ID, USER, PROCESS> obj) {
Assert.isInstanceOf(obj, getClass(), new ClassCastException(String.format(
"The Bean being compared with this Bean must be an instance of %1$s!", getClass().getName())));
return ComparatorUtils.compareIgnoreNull(getId(), obj.getId());
} | java | @SuppressWarnings("all")
public int compareTo(Bean<ID, USER, PROCESS> obj) {
Assert.isInstanceOf(obj, getClass(), new ClassCastException(String.format(
"The Bean being compared with this Bean must be an instance of %1$s!", getClass().getName())));
return ComparatorUtils.compareIgnoreNull(getId(), obj.getId());
} | [
"@",
"SuppressWarnings",
"(",
"\"all\"",
")",
"public",
"int",
"compareTo",
"(",
"Bean",
"<",
"ID",
",",
"USER",
",",
"PROCESS",
">",
"obj",
")",
"{",
"Assert",
".",
"isInstanceOf",
"(",
"obj",
",",
"getClass",
"(",
")",
",",
"new",
"ClassCastException",... | Compares the specified Bean with this Bean to determine order. The default implementation is to
order by identifier, where null identifiers are ordered before non-null identifiers.
@param obj the Bean being compared with this Bean.
@return an integer value indicating the relative ordering of the specified Bean with this Bean.
A negative value implies this Bean logically occurs before the specified Bean. A zero value indicates
the specified Bean and this Bean are comparatively equal, and a positive value indicates this Bean logically
occurs after the specified Bean.
@throws IllegalArgumentException if the specified Bean is not an instance of this Bean class.
@see java.lang.Comparable#compareTo(Object) | [
"Compares",
"the",
"specified",
"Bean",
"with",
"this",
"Bean",
"to",
"determine",
"order",
".",
"The",
"default",
"implementation",
"is",
"to",
"order",
"by",
"identifier",
"where",
"null",
"identifiers",
"are",
"ordered",
"before",
"non",
"-",
"null",
"ident... | train | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/beans/AbstractBean.java#L467-L472 |
ben-manes/caffeine | simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/linked/SegmentedLruPolicy.java | SegmentedLruPolicy.policies | public static Set<Policy> policies(Config config) {
BasicSettings settings = new BasicSettings(config);
return settings.admission().stream().map(admission ->
new SegmentedLruPolicy(admission, config)
).collect(toSet());
} | java | public static Set<Policy> policies(Config config) {
BasicSettings settings = new BasicSettings(config);
return settings.admission().stream().map(admission ->
new SegmentedLruPolicy(admission, config)
).collect(toSet());
} | [
"public",
"static",
"Set",
"<",
"Policy",
">",
"policies",
"(",
"Config",
"config",
")",
"{",
"BasicSettings",
"settings",
"=",
"new",
"BasicSettings",
"(",
"config",
")",
";",
"return",
"settings",
".",
"admission",
"(",
")",
".",
"stream",
"(",
")",
".... | Returns all variations of this policy based on the configuration parameters. | [
"Returns",
"all",
"variations",
"of",
"this",
"policy",
"based",
"on",
"the",
"configuration",
"parameters",
"."
] | train | https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/linked/SegmentedLruPolicy.java#L78-L83 |
webjars/webjars-locator | src/main/java/org/webjars/RequireJS.java | RequireJS.getNpmWebJarRequireJsConfig | public static ObjectNode getNpmWebJarRequireJsConfig(Map.Entry<String, String> webJar, List<Map.Entry<String, Boolean>> prefixes) {
String packageJsonPath = WebJarAssetLocator.WEBJARS_PATH_PREFIX + "/" + webJar.getKey() + "/" + webJar.getValue() + "/" + "package.json";
return getWebJarRequireJsConfigFromMainConfig(webJar, prefixes, packageJsonPath);
} | java | public static ObjectNode getNpmWebJarRequireJsConfig(Map.Entry<String, String> webJar, List<Map.Entry<String, Boolean>> prefixes) {
String packageJsonPath = WebJarAssetLocator.WEBJARS_PATH_PREFIX + "/" + webJar.getKey() + "/" + webJar.getValue() + "/" + "package.json";
return getWebJarRequireJsConfigFromMainConfig(webJar, prefixes, packageJsonPath);
} | [
"public",
"static",
"ObjectNode",
"getNpmWebJarRequireJsConfig",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"String",
">",
"webJar",
",",
"List",
"<",
"Map",
".",
"Entry",
"<",
"String",
",",
"Boolean",
">",
">",
"prefixes",
")",
"{",
"String",
"package... | Returns the JSON RequireJS config for a given Bower WebJar
@param webJar A tuple (artifactId -> version) representing the WebJar.
@param prefixes A list of the prefixes to use in the `paths` part of the RequireJS config.
@return The JSON RequireJS config for the WebJar based on the meta-data in the WebJar's pom.xml file. | [
"Returns",
"the",
"JSON",
"RequireJS",
"config",
"for",
"a",
"given",
"Bower",
"WebJar"
] | train | https://github.com/webjars/webjars-locator/blob/8796fb3ff1b9ad5c0d433ecf63a60520c715e3a0/src/main/java/org/webjars/RequireJS.java#L389-L394 |
line/armeria | grpc/src/main/java/com/linecorp/armeria/internal/grpc/GrpcJsonUtil.java | GrpcJsonUtil.jsonMarshaller | public static MessageMarshaller jsonMarshaller(List<MethodDescriptor<?, ?>> methods) {
final MessageMarshaller.Builder builder = MessageMarshaller.builder()
.omittingInsignificantWhitespace(true)
.ignoringUnknownFields(true);
for (MethodDescriptor<?, ?> method : methods) {
marshallerPrototype(method.getRequestMarshaller()).ifPresent(builder::register);
marshallerPrototype(method.getResponseMarshaller()).ifPresent(builder::register);
}
return builder.build();
} | java | public static MessageMarshaller jsonMarshaller(List<MethodDescriptor<?, ?>> methods) {
final MessageMarshaller.Builder builder = MessageMarshaller.builder()
.omittingInsignificantWhitespace(true)
.ignoringUnknownFields(true);
for (MethodDescriptor<?, ?> method : methods) {
marshallerPrototype(method.getRequestMarshaller()).ifPresent(builder::register);
marshallerPrototype(method.getResponseMarshaller()).ifPresent(builder::register);
}
return builder.build();
} | [
"public",
"static",
"MessageMarshaller",
"jsonMarshaller",
"(",
"List",
"<",
"MethodDescriptor",
"<",
"?",
",",
"?",
">",
">",
"methods",
")",
"{",
"final",
"MessageMarshaller",
".",
"Builder",
"builder",
"=",
"MessageMarshaller",
".",
"builder",
"(",
")",
"."... | Returns a {@link MessageMarshaller} with the request/response {@link Message}s of all the {@code methods}
registered. | [
"Returns",
"a",
"{"
] | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/grpc/src/main/java/com/linecorp/armeria/internal/grpc/GrpcJsonUtil.java#L39-L48 |
ibm-bluemix-mobile-services/bms-clientsdk-android-core | lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/security/mca/internal/AuthorizationProcessManager.java | AuthorizationProcessManager.createTokenRequestHeaders | private HashMap<String, String> createTokenRequestHeaders(String grantCode) {
JSONObject payload = new JSONObject();
HashMap<String, String> headers;
try {
payload.put("code", grantCode);
KeyPair keyPair = certificateStore.getStoredKeyPair();
String jws = jsonSigner.sign(keyPair, payload);
headers = new HashMap<>(1);
headers.put("X-WL-Authenticate", jws);
} catch (Exception e) {
throw new RuntimeException("Failed to create token request headers", e);
}
return headers;
} | java | private HashMap<String, String> createTokenRequestHeaders(String grantCode) {
JSONObject payload = new JSONObject();
HashMap<String, String> headers;
try {
payload.put("code", grantCode);
KeyPair keyPair = certificateStore.getStoredKeyPair();
String jws = jsonSigner.sign(keyPair, payload);
headers = new HashMap<>(1);
headers.put("X-WL-Authenticate", jws);
} catch (Exception e) {
throw new RuntimeException("Failed to create token request headers", e);
}
return headers;
} | [
"private",
"HashMap",
"<",
"String",
",",
"String",
">",
"createTokenRequestHeaders",
"(",
"String",
"grantCode",
")",
"{",
"JSONObject",
"payload",
"=",
"new",
"JSONObject",
"(",
")",
";",
"HashMap",
"<",
"String",
",",
"String",
">",
"headers",
";",
"try",... | Generate the headers that will be used during the token request phase
@param grantCode from the authorization phase
@return Map with all the headers | [
"Generate",
"the",
"headers",
"that",
"will",
"be",
"used",
"during",
"the",
"token",
"request",
"phase"
] | train | https://github.com/ibm-bluemix-mobile-services/bms-clientsdk-android-core/blob/8db4f00d0d564792397bfc0e5bd57d52a238b858/lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/security/mca/internal/AuthorizationProcessManager.java#L361-L378 |
VoltDB/voltdb | src/hsqldb19b3/org/hsqldb_voltpatches/StatementQuery.java | StatementQuery.voltGetStatementXML | @Override
VoltXMLElement voltGetStatementXML(Session session)
throws org.hsqldb_voltpatches.HSQLInterface.HSQLParseException
{
return voltGetXMLExpression(queryExpression, parameters, session);
} | java | @Override
VoltXMLElement voltGetStatementXML(Session session)
throws org.hsqldb_voltpatches.HSQLInterface.HSQLParseException
{
return voltGetXMLExpression(queryExpression, parameters, session);
} | [
"@",
"Override",
"VoltXMLElement",
"voltGetStatementXML",
"(",
"Session",
"session",
")",
"throws",
"org",
".",
"hsqldb_voltpatches",
".",
"HSQLInterface",
".",
"HSQLParseException",
"{",
"return",
"voltGetXMLExpression",
"(",
"queryExpression",
",",
"parameters",
",",
... | VoltDB added method to get a non-catalog-dependent
representation of this HSQLDB object.
@param session The current Session object may be needed to resolve
some names.
@return XML, correctly indented, representing this object.
@throws org.hsqldb_voltpatches.HSQLInterface.HSQLParseException | [
"VoltDB",
"added",
"method",
"to",
"get",
"a",
"non",
"-",
"catalog",
"-",
"dependent",
"representation",
"of",
"this",
"HSQLDB",
"object",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/StatementQuery.java#L127-L132 |
sshtools/j2ssh-maverick | j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpClient.java | SftpClient.get | public SftpFileAttributes get(String remote, OutputStream local,
FileTransferProgress progress) throws SftpStatusException,
SshException, TransferCancelledException {
return get(remote, local, progress, 0);
} | java | public SftpFileAttributes get(String remote, OutputStream local,
FileTransferProgress progress) throws SftpStatusException,
SshException, TransferCancelledException {
return get(remote, local, progress, 0);
} | [
"public",
"SftpFileAttributes",
"get",
"(",
"String",
"remote",
",",
"OutputStream",
"local",
",",
"FileTransferProgress",
"progress",
")",
"throws",
"SftpStatusException",
",",
"SshException",
",",
"TransferCancelledException",
"{",
"return",
"get",
"(",
"remote",
",... | <p>
Download the remote file writing it to the specified
<code>OutputStream</code>. The OutputStream is closed by this method even
if the operation fails.
</p>
@param remote
the path/name of the remote file
@param local
the OutputStream to write
@param progress
@return the downloaded file's attributes
@throws SftpStatusException
@throws SshException
@throws TransferCancelledException | [
"<p",
">",
"Download",
"the",
"remote",
"file",
"writing",
"it",
"to",
"the",
"specified",
"<code",
">",
"OutputStream<",
"/",
"code",
">",
".",
"The",
"OutputStream",
"is",
"closed",
"by",
"this",
"method",
"even",
"if",
"the",
"operation",
"fails",
".",
... | train | https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpClient.java#L1151-L1155 |
paypal/SeLion | dataproviders/src/main/java/com/paypal/selion/platform/dataprovider/impl/YamlDataProviderImpl.java | YamlDataProviderImpl.getDataByFilter | @Override
public Iterator<Object[]> getDataByFilter(DataProviderFilter dataFilter)
throws IOException {
logger.entering(dataFilter);
InputStream inputStream = resource.getInputStream();
Yaml yaml = constructYaml(resource.getCls());
Object yamlObject;
// Mark the input stream in case multiple documents has been detected
// so we can reset it.
inputStream.mark(100);
try {
yamlObject = yaml.load(inputStream);
} catch (ComposerException composerException) {
String msg = composerException.getMessage();
msg = (msg == null) ? "" : msg;
if (msg.toLowerCase().contains("expected a single document")) {
inputStream.reset();
yamlObject = loadDataFromDocuments(yaml, inputStream);
} else {
throw new DataProviderException("Error reading YAML data", composerException);
}
}
return DataProviderHelper.filterToListOfObjects(yamlObject, dataFilter).iterator();
} | java | @Override
public Iterator<Object[]> getDataByFilter(DataProviderFilter dataFilter)
throws IOException {
logger.entering(dataFilter);
InputStream inputStream = resource.getInputStream();
Yaml yaml = constructYaml(resource.getCls());
Object yamlObject;
// Mark the input stream in case multiple documents has been detected
// so we can reset it.
inputStream.mark(100);
try {
yamlObject = yaml.load(inputStream);
} catch (ComposerException composerException) {
String msg = composerException.getMessage();
msg = (msg == null) ? "" : msg;
if (msg.toLowerCase().contains("expected a single document")) {
inputStream.reset();
yamlObject = loadDataFromDocuments(yaml, inputStream);
} else {
throw new DataProviderException("Error reading YAML data", composerException);
}
}
return DataProviderHelper.filterToListOfObjects(yamlObject, dataFilter).iterator();
} | [
"@",
"Override",
"public",
"Iterator",
"<",
"Object",
"[",
"]",
">",
"getDataByFilter",
"(",
"DataProviderFilter",
"dataFilter",
")",
"throws",
"IOException",
"{",
"logger",
".",
"entering",
"(",
"dataFilter",
")",
";",
"InputStream",
"inputStream",
"=",
"resour... | Gets yaml data by applying the given filter. Throws {@link DataProviderException} when unexpected error occurs
during processing of YAML file data by filter
@param dataFilter
an implementation class of {@link DataProviderFilter}
@return An iterator over a collection of Object Array to be used with TestNG DataProvider
@throws IOException | [
"Gets",
"yaml",
"data",
"by",
"applying",
"the",
"given",
"filter",
".",
"Throws",
"{",
"@link",
"DataProviderException",
"}",
"when",
"unexpected",
"error",
"occurs",
"during",
"processing",
"of",
"YAML",
"file",
"data",
"by",
"filter"
] | train | https://github.com/paypal/SeLion/blob/694d12d0df76db48d0360b16192770c6a4fbdfd2/dataproviders/src/main/java/com/paypal/selion/platform/dataprovider/impl/YamlDataProviderImpl.java#L287-L313 |
mapfish/mapfish-print | core/src/main/java/org/mapfish/print/processor/ProcessorExecutionContext.java | ProcessorExecutionContext.allAreFinished | public boolean allAreFinished(final Set<ProcessorGraphNode<?, ?>> processorNodes) {
this.processorLock.lock();
try {
for (ProcessorGraphNode<?, ?> node: processorNodes) {
if (!isFinished(node)) {
return false;
}
}
return true;
} finally {
this.processorLock.unlock();
}
} | java | public boolean allAreFinished(final Set<ProcessorGraphNode<?, ?>> processorNodes) {
this.processorLock.lock();
try {
for (ProcessorGraphNode<?, ?> node: processorNodes) {
if (!isFinished(node)) {
return false;
}
}
return true;
} finally {
this.processorLock.unlock();
}
} | [
"public",
"boolean",
"allAreFinished",
"(",
"final",
"Set",
"<",
"ProcessorGraphNode",
"<",
"?",
",",
"?",
">",
">",
"processorNodes",
")",
"{",
"this",
".",
"processorLock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"for",
"(",
"ProcessorGraphNode",
"<",
... | Verify that all processors have finished executing atomically (within the same lock as {@link
#finished(ProcessorGraphNode)} and {@link #isFinished(ProcessorGraphNode)} is within.
@param processorNodes the node to check for completion. | [
"Verify",
"that",
"all",
"processors",
"have",
"finished",
"executing",
"atomically",
"(",
"within",
"the",
"same",
"lock",
"as",
"{",
"@link",
"#finished",
"(",
"ProcessorGraphNode",
")",
"}",
"and",
"{",
"@link",
"#isFinished",
"(",
"ProcessorGraphNode",
")",
... | train | https://github.com/mapfish/mapfish-print/blob/25a452cb39f592bd8a53b20db1037703898e1e22/core/src/main/java/org/mapfish/print/processor/ProcessorExecutionContext.java#L129-L142 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.