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 |
|---|---|---|---|---|---|---|---|---|---|---|
auth0/java-jwt | lib/src/main/java/com/auth0/jwt/algorithms/CryptoHelper.java | CryptoHelper.verifySignatureFor | boolean verifySignatureFor(String algorithm, PublicKey publicKey, String header, String payload, byte[] signatureBytes) throws NoSuchAlgorithmException, InvalidKeyException, SignatureException {
return verifySignatureFor(algorithm, publicKey, header.getBytes(StandardCharsets.UTF_8), payload.getBytes(StandardCharsets.UTF_8), signatureBytes);
} | java | boolean verifySignatureFor(String algorithm, PublicKey publicKey, String header, String payload, byte[] signatureBytes) throws NoSuchAlgorithmException, InvalidKeyException, SignatureException {
return verifySignatureFor(algorithm, publicKey, header.getBytes(StandardCharsets.UTF_8), payload.getBytes(StandardCharsets.UTF_8), signatureBytes);
} | [
"boolean",
"verifySignatureFor",
"(",
"String",
"algorithm",
",",
"PublicKey",
"publicKey",
",",
"String",
"header",
",",
"String",
"payload",
",",
"byte",
"[",
"]",
"signatureBytes",
")",
"throws",
"NoSuchAlgorithmException",
",",
"InvalidKeyException",
",",
"Signa... | Verify signature for JWT header and payload.
@param algorithm algorithm name.
@param publicKey algorithm public key.
@param header JWT header.
@param payload JWT payload.
@param signatureBytes JWT signature.
@return true if signature is valid.
@throws NoSuchAlgorithmException if the algorithm is not supported.
@throws InvalidKeyException if the given key is inappropriate for initializing the specified algorithm. | [
"Verify",
"signature",
"for",
"JWT",
"header",
"and",
"payload",
"."
] | train | https://github.com/auth0/java-jwt/blob/890538970a9699b7251a4bfe4f26e8d7605ad530/lib/src/main/java/com/auth0/jwt/algorithms/CryptoHelper.java#L80-L82 |
alibaba/vlayout | vlayout/src/main/java/com/alibaba/android/vlayout/layout/StaggeredGridLayoutHelper.java | StaggeredGridLayoutHelper.hasGapsToFix | private View hasGapsToFix(VirtualLayoutManager layoutManager, final int position, final int alignLine) {
View view = layoutManager.findViewByPosition(position);
if (view == null) {
return null;
}
BitSet mSpansToCheck = new BitSet(mNumLanes);
mSpansToCheck.set(0, mNumLanes, true);
for (int i = 0, size = mSpans.length; i < size; i++) {
Span span = mSpans[i];
if (span.mViews.size() != 0 && checkSpanForGap(span, layoutManager, alignLine)) {
return layoutManager.getReverseLayout() ? span.mViews.get(span.mViews.size() - 1) : span.mViews.get(0);
}
}
// everything looks good
return null;
} | java | private View hasGapsToFix(VirtualLayoutManager layoutManager, final int position, final int alignLine) {
View view = layoutManager.findViewByPosition(position);
if (view == null) {
return null;
}
BitSet mSpansToCheck = new BitSet(mNumLanes);
mSpansToCheck.set(0, mNumLanes, true);
for (int i = 0, size = mSpans.length; i < size; i++) {
Span span = mSpans[i];
if (span.mViews.size() != 0 && checkSpanForGap(span, layoutManager, alignLine)) {
return layoutManager.getReverseLayout() ? span.mViews.get(span.mViews.size() - 1) : span.mViews.get(0);
}
}
// everything looks good
return null;
} | [
"private",
"View",
"hasGapsToFix",
"(",
"VirtualLayoutManager",
"layoutManager",
",",
"final",
"int",
"position",
",",
"final",
"int",
"alignLine",
")",
"{",
"View",
"view",
"=",
"layoutManager",
".",
"findViewByPosition",
"(",
"position",
")",
";",
"if",
"(",
... | Checks for gaps if we've reached to the top of the list.
<p/>
Intermediate gaps created by full span items are tracked via mLaidOutInvalidFullSpan field. | [
"Checks",
"for",
"gaps",
"if",
"we",
"ve",
"reached",
"to",
"the",
"top",
"of",
"the",
"list",
".",
"<p",
"/",
">",
"Intermediate",
"gaps",
"created",
"by",
"full",
"span",
"items",
"are",
"tracked",
"via",
"mLaidOutInvalidFullSpan",
"field",
"."
] | train | https://github.com/alibaba/vlayout/blob/8a5a51d9d2eeb91fed2ee331a4cf3496282452ce/vlayout/src/main/java/com/alibaba/android/vlayout/layout/StaggeredGridLayoutHelper.java#L614-L634 |
facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/corona/Session.java | Session.updateInfoUrlAndName | public void updateInfoUrlAndName(String url, String name) {
this.info.url = url;
this.info.name = name;
} | java | public void updateInfoUrlAndName(String url, String name) {
this.info.url = url;
this.info.name = name;
} | [
"public",
"void",
"updateInfoUrlAndName",
"(",
"String",
"url",
",",
"String",
"name",
")",
"{",
"this",
".",
"info",
".",
"url",
"=",
"url",
";",
"this",
".",
"info",
".",
"name",
"=",
"name",
";",
"}"
] | Only update the session info url and name.
@param url New session info url
@param name New session name | [
"Only",
"update",
"the",
"session",
"info",
"url",
"and",
"name",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/corona/Session.java#L465-L468 |
WiQuery/wiquery | wiquery-jquery-ui/src/main/java/org/odlabs/wiquery/ui/datepicker/DatePickerNumberOfMonths.java | DatePickerNumberOfMonths.setParam | private void setParam(Short shortParam, ArrayItemOptions<IntegerItemOptions> arrayParam)
{
this.shortParam = shortParam;
this.arrayParam = arrayParam;
} | java | private void setParam(Short shortParam, ArrayItemOptions<IntegerItemOptions> arrayParam)
{
this.shortParam = shortParam;
this.arrayParam = arrayParam;
} | [
"private",
"void",
"setParam",
"(",
"Short",
"shortParam",
",",
"ArrayItemOptions",
"<",
"IntegerItemOptions",
">",
"arrayParam",
")",
"{",
"this",
".",
"shortParam",
"=",
"shortParam",
";",
"this",
".",
"arrayParam",
"=",
"arrayParam",
";",
"}"
] | Method setting the right parameter
@param shortParam
Short parameter
@param arrayParam
Array parameter | [
"Method",
"setting",
"the",
"right",
"parameter"
] | train | https://github.com/WiQuery/wiquery/blob/1b8d60c7a3c37b90fd68c9cd0ff97178fcbcbb08/wiquery-jquery-ui/src/main/java/org/odlabs/wiquery/ui/datepicker/DatePickerNumberOfMonths.java#L165-L169 |
JOML-CI/JOML | src/org/joml/Matrix4d.java | Matrix4d.frustumAabb | public Matrix4d frustumAabb(Vector3d min, Vector3d max) {
double minX = Double.POSITIVE_INFINITY;
double minY = Double.POSITIVE_INFINITY;
double minZ = Double.POSITIVE_INFINITY;
double maxX = Double.NEGATIVE_INFINITY;
double maxY = Double.NEGATIVE_INFINITY;
double maxZ = Double.NEGATIVE_INFINITY;
for (int t = 0; t < 8; t++) {
double x = ((t & 1) << 1) - 1.0;
double y = (((t >>> 1) & 1) << 1) - 1.0;
double z = (((t >>> 2) & 1) << 1) - 1.0;
double invW = 1.0 / (m03 * x + m13 * y + m23 * z + m33);
double nx = (m00 * x + m10 * y + m20 * z + m30) * invW;
double ny = (m01 * x + m11 * y + m21 * z + m31) * invW;
double nz = (m02 * x + m12 * y + m22 * z + m32) * invW;
minX = minX < nx ? minX : nx;
minY = minY < ny ? minY : ny;
minZ = minZ < nz ? minZ : nz;
maxX = maxX > nx ? maxX : nx;
maxY = maxY > ny ? maxY : ny;
maxZ = maxZ > nz ? maxZ : nz;
}
min.x = minX;
min.y = minY;
min.z = minZ;
max.x = maxX;
max.y = maxY;
max.z = maxZ;
return this;
} | java | public Matrix4d frustumAabb(Vector3d min, Vector3d max) {
double minX = Double.POSITIVE_INFINITY;
double minY = Double.POSITIVE_INFINITY;
double minZ = Double.POSITIVE_INFINITY;
double maxX = Double.NEGATIVE_INFINITY;
double maxY = Double.NEGATIVE_INFINITY;
double maxZ = Double.NEGATIVE_INFINITY;
for (int t = 0; t < 8; t++) {
double x = ((t & 1) << 1) - 1.0;
double y = (((t >>> 1) & 1) << 1) - 1.0;
double z = (((t >>> 2) & 1) << 1) - 1.0;
double invW = 1.0 / (m03 * x + m13 * y + m23 * z + m33);
double nx = (m00 * x + m10 * y + m20 * z + m30) * invW;
double ny = (m01 * x + m11 * y + m21 * z + m31) * invW;
double nz = (m02 * x + m12 * y + m22 * z + m32) * invW;
minX = minX < nx ? minX : nx;
minY = minY < ny ? minY : ny;
minZ = minZ < nz ? minZ : nz;
maxX = maxX > nx ? maxX : nx;
maxY = maxY > ny ? maxY : ny;
maxZ = maxZ > nz ? maxZ : nz;
}
min.x = minX;
min.y = minY;
min.z = minZ;
max.x = maxX;
max.y = maxY;
max.z = maxZ;
return this;
} | [
"public",
"Matrix4d",
"frustumAabb",
"(",
"Vector3d",
"min",
",",
"Vector3d",
"max",
")",
"{",
"double",
"minX",
"=",
"Double",
".",
"POSITIVE_INFINITY",
";",
"double",
"minY",
"=",
"Double",
".",
"POSITIVE_INFINITY",
";",
"double",
"minZ",
"=",
"Double",
".... | Compute the axis-aligned bounding box of the frustum described by <code>this</code> matrix and store the minimum corner
coordinates in the given <code>min</code> and the maximum corner coordinates in the given <code>max</code> vector.
<p>
The matrix <code>this</code> is assumed to be the {@link #invert() inverse} of the origial view-projection matrix
for which to compute the axis-aligned bounding box in world-space.
<p>
The axis-aligned bounding box of the unit frustum is <code>(-1, -1, -1)</code>, <code>(1, 1, 1)</code>.
@param min
will hold the minimum corner coordinates of the axis-aligned bounding box
@param max
will hold the maximum corner coordinates of the axis-aligned bounding box
@return this | [
"Compute",
"the",
"axis",
"-",
"aligned",
"bounding",
"box",
"of",
"the",
"frustum",
"described",
"by",
"<code",
">",
"this<",
"/",
"code",
">",
"matrix",
"and",
"store",
"the",
"minimum",
"corner",
"coordinates",
"in",
"the",
"given",
"<code",
">",
"min<"... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4d.java#L14743-L14772 |
querydsl/querydsl | querydsl-core/src/main/java/com/querydsl/core/types/dsl/Expressions.java | Expressions.timeTemplate | public static <T extends Comparable<?>> TimeTemplate<T> timeTemplate(Class<? extends T> cl, String template, List<?> args) {
return timeTemplate(cl, createTemplate(template), args);
} | java | public static <T extends Comparable<?>> TimeTemplate<T> timeTemplate(Class<? extends T> cl, String template, List<?> args) {
return timeTemplate(cl, createTemplate(template), args);
} | [
"public",
"static",
"<",
"T",
"extends",
"Comparable",
"<",
"?",
">",
">",
"TimeTemplate",
"<",
"T",
">",
"timeTemplate",
"(",
"Class",
"<",
"?",
"extends",
"T",
">",
"cl",
",",
"String",
"template",
",",
"List",
"<",
"?",
">",
"args",
")",
"{",
"r... | Create a new Template expression
@param cl type of expression
@param template template
@param args template parameters
@return template expression | [
"Create",
"a",
"new",
"Template",
"expression"
] | train | https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-core/src/main/java/com/querydsl/core/types/dsl/Expressions.java#L672-L674 |
liferay/com-liferay-commerce | commerce-notification-service/src/main/java/com/liferay/commerce/notification/service/persistence/impl/CommerceNotificationTemplatePersistenceImpl.java | CommerceNotificationTemplatePersistenceImpl.findByGroupId | @Override
public List<CommerceNotificationTemplate> findByGroupId(long groupId,
int start, int end) {
return findByGroupId(groupId, start, end, null);
} | java | @Override
public List<CommerceNotificationTemplate> findByGroupId(long groupId,
int start, int end) {
return findByGroupId(groupId, start, end, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CommerceNotificationTemplate",
">",
"findByGroupId",
"(",
"long",
"groupId",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"return",
"findByGroupId",
"(",
"groupId",
",",
"start",
",",
"end",
",",
"null",
")",
"... | Returns a range of all the commerce notification templates where groupId = ?.
<p>
Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommerceNotificationTemplateModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
</p>
@param groupId the group ID
@param start the lower bound of the range of commerce notification templates
@param end the upper bound of the range of commerce notification templates (not inclusive)
@return the range of matching commerce notification templates | [
"Returns",
"a",
"range",
"of",
"all",
"the",
"commerce",
"notification",
"templates",
"where",
"groupId",
"=",
"?",
";",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-notification-service/src/main/java/com/liferay/commerce/notification/service/persistence/impl/CommerceNotificationTemplatePersistenceImpl.java#L1561-L1565 |
facebookarchive/swift | swift-codec/src/main/java/com/facebook/swift/codec/internal/compiler/ThriftCodecByteCodeGenerator.java | ThriftCodecByteCodeGenerator.declareCodecFields | private Map<Short, FieldDefinition> declareCodecFields()
{
Map<Short, FieldDefinition> codecFields = new TreeMap<>();
for (ThriftFieldMetadata fieldMetadata : metadata.getFields()) {
if (needsCodec(fieldMetadata)) {
ThriftCodec<?> codec = codecManager.getCodec(fieldMetadata.getThriftType());
String fieldName = fieldMetadata.getName() + "Codec";
FieldDefinition codecField = new FieldDefinition(a(PRIVATE, FINAL), fieldName, type(codec.getClass()));
classDefinition.addField(codecField);
codecFields.put(fieldMetadata.getId(), codecField);
parameters.add(codecField, codec);
}
}
return codecFields;
} | java | private Map<Short, FieldDefinition> declareCodecFields()
{
Map<Short, FieldDefinition> codecFields = new TreeMap<>();
for (ThriftFieldMetadata fieldMetadata : metadata.getFields()) {
if (needsCodec(fieldMetadata)) {
ThriftCodec<?> codec = codecManager.getCodec(fieldMetadata.getThriftType());
String fieldName = fieldMetadata.getName() + "Codec";
FieldDefinition codecField = new FieldDefinition(a(PRIVATE, FINAL), fieldName, type(codec.getClass()));
classDefinition.addField(codecField);
codecFields.put(fieldMetadata.getId(), codecField);
parameters.add(codecField, codec);
}
}
return codecFields;
} | [
"private",
"Map",
"<",
"Short",
",",
"FieldDefinition",
">",
"declareCodecFields",
"(",
")",
"{",
"Map",
"<",
"Short",
",",
"FieldDefinition",
">",
"codecFields",
"=",
"new",
"TreeMap",
"<>",
"(",
")",
";",
"for",
"(",
"ThriftFieldMetadata",
"fieldMetadata",
... | Declares a field for each delegate codec
@return a map from field id to the codec for the field | [
"Declares",
"a",
"field",
"for",
"each",
"delegate",
"codec"
] | train | https://github.com/facebookarchive/swift/blob/3f1f098a50d6106f50cd6fe1c361dd373ede0197/swift-codec/src/main/java/com/facebook/swift/codec/internal/compiler/ThriftCodecByteCodeGenerator.java#L216-L233 |
UrielCh/ovh-java-sdk | ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java | ApiOvhMe.task_domain_GET | public ArrayList<Long> task_domain_GET(String domain, OvhNicOperationFunctionEnum function, OvhOperationStatusEnum status) throws IOException {
String qPath = "/me/task/domain";
StringBuilder sb = path(qPath);
query(sb, "domain", domain);
query(sb, "function", function);
query(sb, "status", status);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t2);
} | java | public ArrayList<Long> task_domain_GET(String domain, OvhNicOperationFunctionEnum function, OvhOperationStatusEnum status) throws IOException {
String qPath = "/me/task/domain";
StringBuilder sb = path(qPath);
query(sb, "domain", domain);
query(sb, "function", function);
query(sb, "status", status);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t2);
} | [
"public",
"ArrayList",
"<",
"Long",
">",
"task_domain_GET",
"(",
"String",
"domain",
",",
"OvhNicOperationFunctionEnum",
"function",
",",
"OvhOperationStatusEnum",
"status",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/me/task/domain\"",
";",
"String... | List of domain task
REST: GET /me/task/domain
@param status [required] Filter the value of status property (=)
@param function [required] Filter the value of function property (like)
@param domain [required] Filter the value of domain property (like) | [
"List",
"of",
"domain",
"task"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L2280-L2288 |
UrielCh/ovh-java-sdk | ovh-java-sdk-dbaaslogs/src/main/java/net/minidev/ovh/api/ApiOvhDbaaslogs.java | ApiOvhDbaaslogs.serviceName_cluster_clusterId_allowedNetwork_allowedNetworkId_GET | public OvhClusterAllowedNetwork serviceName_cluster_clusterId_allowedNetwork_allowedNetworkId_GET(String serviceName, String clusterId, String allowedNetworkId) throws IOException {
String qPath = "/dbaas/logs/{serviceName}/cluster/{clusterId}/allowedNetwork/{allowedNetworkId}";
StringBuilder sb = path(qPath, serviceName, clusterId, allowedNetworkId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhClusterAllowedNetwork.class);
} | java | public OvhClusterAllowedNetwork serviceName_cluster_clusterId_allowedNetwork_allowedNetworkId_GET(String serviceName, String clusterId, String allowedNetworkId) throws IOException {
String qPath = "/dbaas/logs/{serviceName}/cluster/{clusterId}/allowedNetwork/{allowedNetworkId}";
StringBuilder sb = path(qPath, serviceName, clusterId, allowedNetworkId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhClusterAllowedNetwork.class);
} | [
"public",
"OvhClusterAllowedNetwork",
"serviceName_cluster_clusterId_allowedNetwork_allowedNetworkId_GET",
"(",
"String",
"serviceName",
",",
"String",
"clusterId",
",",
"String",
"allowedNetworkId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/dbaas/logs/{ser... | Returns details of an allowed network
REST: GET /dbaas/logs/{serviceName}/cluster/{clusterId}/allowedNetwork/{allowedNetworkId}
@param serviceName [required] Service name
@param clusterId [required] Cluster ID
@param allowedNetworkId [required] Allowed network UUID | [
"Returns",
"details",
"of",
"an",
"allowed",
"network"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dbaaslogs/src/main/java/net/minidev/ovh/api/ApiOvhDbaaslogs.java#L191-L196 |
mcxiaoke/Android-Next | recycler/src/main/java/com/mcxiaoke/next/recycler/HeaderFooterRecyclerAdapter.java | HeaderFooterRecyclerAdapter.notifyContentItemRangeInserted | public final void notifyContentItemRangeInserted(int positionStart, int itemCount) {
int newHeaderItemCount = getHeaderItemCount();
int newContentItemCount = getContentItemCount();
if (positionStart < 0 || itemCount < 0 || positionStart + itemCount > newContentItemCount) {
throw new IndexOutOfBoundsException("The given range [" + positionStart + " - "
+ (positionStart + itemCount - 1) + "] is not within the position bounds for content items [0 - "
+ (newContentItemCount - 1) + "].");
}
notifyItemRangeInserted(positionStart + newHeaderItemCount, itemCount);
} | java | public final void notifyContentItemRangeInserted(int positionStart, int itemCount) {
int newHeaderItemCount = getHeaderItemCount();
int newContentItemCount = getContentItemCount();
if (positionStart < 0 || itemCount < 0 || positionStart + itemCount > newContentItemCount) {
throw new IndexOutOfBoundsException("The given range [" + positionStart + " - "
+ (positionStart + itemCount - 1) + "] is not within the position bounds for content items [0 - "
+ (newContentItemCount - 1) + "].");
}
notifyItemRangeInserted(positionStart + newHeaderItemCount, itemCount);
} | [
"public",
"final",
"void",
"notifyContentItemRangeInserted",
"(",
"int",
"positionStart",
",",
"int",
"itemCount",
")",
"{",
"int",
"newHeaderItemCount",
"=",
"getHeaderItemCount",
"(",
")",
";",
"int",
"newContentItemCount",
"=",
"getContentItemCount",
"(",
")",
";... | Notifies that multiple content items are inserted.
@param positionStart the position.
@param itemCount the item count. | [
"Notifies",
"that",
"multiple",
"content",
"items",
"are",
"inserted",
"."
] | train | https://github.com/mcxiaoke/Android-Next/blob/1bfdf99d0b81a849aa0fa6697c53ed673151ca39/recycler/src/main/java/com/mcxiaoke/next/recycler/HeaderFooterRecyclerAdapter.java#L224-L233 |
eclipse/hawkbit | hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/components/SPUIComponentProvider.java | SPUIComponentProvider.createCreatedByLabel | public static Label createCreatedByLabel(final VaadinMessageSource i18n, final BaseEntity baseEntity) {
return createUsernameLabel(i18n.getMessage("label.created.by"),
baseEntity == null ? "" : baseEntity.getCreatedBy());
} | java | public static Label createCreatedByLabel(final VaadinMessageSource i18n, final BaseEntity baseEntity) {
return createUsernameLabel(i18n.getMessage("label.created.by"),
baseEntity == null ? "" : baseEntity.getCreatedBy());
} | [
"public",
"static",
"Label",
"createCreatedByLabel",
"(",
"final",
"VaadinMessageSource",
"i18n",
",",
"final",
"BaseEntity",
"baseEntity",
")",
"{",
"return",
"createUsernameLabel",
"(",
"i18n",
".",
"getMessage",
"(",
"\"label.created.by\"",
")",
",",
"baseEntity",
... | Create label which represents the {@link BaseEntity#getCreatedBy()} by
user name
@param i18n
the i18n
@param baseEntity
the entity
@return the label | [
"Create",
"label",
"which",
"represents",
"the",
"{",
"@link",
"BaseEntity#getCreatedBy",
"()",
"}",
"by",
"user",
"name"
] | train | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/components/SPUIComponentProvider.java#L233-L236 |
voldemort/voldemort | src/java/voldemort/utils/RebalanceUtils.java | RebalanceUtils.executorShutDown | public static void executorShutDown(ExecutorService executorService, long timeOutSec) {
try {
executorService.shutdown();
executorService.awaitTermination(timeOutSec, TimeUnit.SECONDS);
} catch(Exception e) {
logger.warn("Error while stoping executor service.", e);
}
} | java | public static void executorShutDown(ExecutorService executorService, long timeOutSec) {
try {
executorService.shutdown();
executorService.awaitTermination(timeOutSec, TimeUnit.SECONDS);
} catch(Exception e) {
logger.warn("Error while stoping executor service.", e);
}
} | [
"public",
"static",
"void",
"executorShutDown",
"(",
"ExecutorService",
"executorService",
",",
"long",
"timeOutSec",
")",
"{",
"try",
"{",
"executorService",
".",
"shutdown",
"(",
")",
";",
"executorService",
".",
"awaitTermination",
"(",
"timeOutSec",
",",
"Time... | Wait to shutdown service
@param executorService Executor service to shutdown
@param timeOutSec Time we wait for | [
"Wait",
"to",
"shutdown",
"service"
] | train | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/utils/RebalanceUtils.java#L704-L711 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/db/PassThruTable.java | PassThruTable.syncRecordToBase | public void syncRecordToBase(Record recBase, Record recAlt, boolean syncSelection)
{
if ((recAlt != null) && (recBase != null))
{
recBase.moveFields(recAlt, null, true, DBConstants.READ_MOVE, false, false, true, syncSelection);
recBase.setEditMode(recAlt.getEditMode());
}
if ((recBase.getEditMode() == DBConstants.EDIT_CURRENT) || (recBase.getEditMode() == DBConstants.EDIT_IN_PROGRESS))
recBase.handleValidRecord(); // Do listeners, Display Fields
else if (recBase.getEditMode() == DBConstants.EDIT_ADD)
recBase.handleNewRecord(); // Do listeners, Display Fields
//?recBase.setKeyArea(recAlt.getDefaultOrder());
} | java | public void syncRecordToBase(Record recBase, Record recAlt, boolean syncSelection)
{
if ((recAlt != null) && (recBase != null))
{
recBase.moveFields(recAlt, null, true, DBConstants.READ_MOVE, false, false, true, syncSelection);
recBase.setEditMode(recAlt.getEditMode());
}
if ((recBase.getEditMode() == DBConstants.EDIT_CURRENT) || (recBase.getEditMode() == DBConstants.EDIT_IN_PROGRESS))
recBase.handleValidRecord(); // Do listeners, Display Fields
else if (recBase.getEditMode() == DBConstants.EDIT_ADD)
recBase.handleNewRecord(); // Do listeners, Display Fields
//?recBase.setKeyArea(recAlt.getDefaultOrder());
} | [
"public",
"void",
"syncRecordToBase",
"(",
"Record",
"recBase",
",",
"Record",
"recAlt",
",",
"boolean",
"syncSelection",
")",
"{",
"if",
"(",
"(",
"recAlt",
"!=",
"null",
")",
"&&",
"(",
"recBase",
"!=",
"null",
")",
")",
"{",
"recBase",
".",
"moveField... | Sync the current record's contents and status to the base record
@param syncSelection Sync selected fields? | [
"Sync",
"the",
"current",
"record",
"s",
"contents",
"and",
"status",
"to",
"the",
"base",
"record"
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/PassThruTable.java#L571-L583 |
Jasig/uPortal | uPortal-api/uPortal-api-internal/src/main/java/org/apereo/portal/portlets/account/UserAccountHelper.java | UserAccountHelper.createPassword | public void createPassword(PersonForm form, String token) {
final String username = form.getUsername();
// Re-validate the token to prevent URL hacking
if (!validateLoginToken(username, token)) {
throw new RuntimeException(
"Attempt to set a password for user '"
+ username
+ "' without a valid security token");
}
final String password = form.getPassword();
if (StringUtils.isNotBlank(password)) {
if (!password.equals(form.getConfirmPassword())) {
throw new RuntimeException("Passwords don't match");
}
ILocalAccountPerson account = accountDao.getPerson(username);
account.setPassword(passwordService.encryptPassword(password));
account.setLastPasswordChange(new Date());
account.removeAttribute("loginToken");
accountDao.updateAccount(account);
if (log.isInfoEnabled()) {
log.info("Password created for account: " + account);
}
} else {
throw new RuntimeException(
"Attempt to set a password for user '"
+ form.getUsername()
+ "' but the password was blank");
}
} | java | public void createPassword(PersonForm form, String token) {
final String username = form.getUsername();
// Re-validate the token to prevent URL hacking
if (!validateLoginToken(username, token)) {
throw new RuntimeException(
"Attempt to set a password for user '"
+ username
+ "' without a valid security token");
}
final String password = form.getPassword();
if (StringUtils.isNotBlank(password)) {
if (!password.equals(form.getConfirmPassword())) {
throw new RuntimeException("Passwords don't match");
}
ILocalAccountPerson account = accountDao.getPerson(username);
account.setPassword(passwordService.encryptPassword(password));
account.setLastPasswordChange(new Date());
account.removeAttribute("loginToken");
accountDao.updateAccount(account);
if (log.isInfoEnabled()) {
log.info("Password created for account: " + account);
}
} else {
throw new RuntimeException(
"Attempt to set a password for user '"
+ form.getUsername()
+ "' but the password was blank");
}
} | [
"public",
"void",
"createPassword",
"(",
"PersonForm",
"form",
",",
"String",
"token",
")",
"{",
"final",
"String",
"username",
"=",
"form",
".",
"getUsername",
"(",
")",
";",
"// Re-validate the token to prevent URL hacking",
"if",
"(",
"!",
"validateLoginToken",
... | Similar to updateAccount, but narrowed to the password and re-tooled to work as the guest
user (which is what you are, when you have a valid security token). | [
"Similar",
"to",
"updateAccount",
"but",
"narrowed",
"to",
"the",
"password",
"and",
"re",
"-",
"tooled",
"to",
"work",
"as",
"the",
"guest",
"user",
"(",
"which",
"is",
"what",
"you",
"are",
"when",
"you",
"have",
"a",
"valid",
"security",
"token",
")",... | train | https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-api/uPortal-api-internal/src/main/java/org/apereo/portal/portlets/account/UserAccountHelper.java#L461-L493 |
Azure/azure-sdk-for-java | privatedns/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/privatedns/v2018_09_01/implementation/PrivateZonesInner.java | PrivateZonesInner.updateAsync | public Observable<PrivateZoneInner> updateAsync(String resourceGroupName, String privateZoneName, PrivateZoneInner parameters, String ifMatch) {
return updateWithServiceResponseAsync(resourceGroupName, privateZoneName, parameters, ifMatch).map(new Func1<ServiceResponse<PrivateZoneInner>, PrivateZoneInner>() {
@Override
public PrivateZoneInner call(ServiceResponse<PrivateZoneInner> response) {
return response.body();
}
});
} | java | public Observable<PrivateZoneInner> updateAsync(String resourceGroupName, String privateZoneName, PrivateZoneInner parameters, String ifMatch) {
return updateWithServiceResponseAsync(resourceGroupName, privateZoneName, parameters, ifMatch).map(new Func1<ServiceResponse<PrivateZoneInner>, PrivateZoneInner>() {
@Override
public PrivateZoneInner call(ServiceResponse<PrivateZoneInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"PrivateZoneInner",
">",
"updateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"privateZoneName",
",",
"PrivateZoneInner",
"parameters",
",",
"String",
"ifMatch",
")",
"{",
"return",
"updateWithServiceResponseAsync",
"(",
"resour... | Updates a Private DNS zone. Does not modify virtual network links or DNS records within the zone.
@param resourceGroupName The name of the resource group.
@param privateZoneName The name of the Private DNS zone (without a terminating dot).
@param parameters Parameters supplied to the Update operation.
@param ifMatch The ETag of the Private DNS zone. Omit this value to always overwrite the current zone. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent changes.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Updates",
"a",
"Private",
"DNS",
"zone",
".",
"Does",
"not",
"modify",
"virtual",
"network",
"links",
"or",
"DNS",
"records",
"within",
"the",
"zone",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/privatedns/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/privatedns/v2018_09_01/implementation/PrivateZonesInner.java#L588-L595 |
nyla-solutions/nyla | nyla.solutions.core/src/main/java/nyla/solutions/core/util/Scheduler.java | Scheduler.durationSeconds | public static double durationSeconds(LocalDateTime start, LocalDateTime end)
{
return Duration.between(start, end).getSeconds();
} | java | public static double durationSeconds(LocalDateTime start, LocalDateTime end)
{
return Duration.between(start, end).getSeconds();
} | [
"public",
"static",
"double",
"durationSeconds",
"(",
"LocalDateTime",
"start",
",",
"LocalDateTime",
"end",
")",
"{",
"return",
"Duration",
".",
"between",
"(",
"start",
",",
"end",
")",
".",
"getSeconds",
"(",
")",
";",
"}"
] | 1 millisecond = 0.001 seconds
@param start between time
@param end finish time
@return duration in seconds | [
"1",
"millisecond",
"=",
"0",
".",
"001",
"seconds"
] | train | https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/util/Scheduler.java#L100-L103 |
google/error-prone-javac | src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ConstantsSummaryBuilder.java | ConstantsSummaryBuilder.buildConstantSummaries | public void buildConstantSummaries(XMLNode node, Content contentTree) throws DocletException {
printedPackageHeaders.clear();
Content summariesTree = writer.getConstantSummaries();
for (PackageElement aPackage : configuration.packages) {
if (hasConstantField(aPackage)) {
currentPackage = aPackage;
//Build the documentation for the current package.
buildChildren(node, summariesTree);
first = false;
}
}
writer.addConstantSummaries(contentTree, summariesTree);
} | java | public void buildConstantSummaries(XMLNode node, Content contentTree) throws DocletException {
printedPackageHeaders.clear();
Content summariesTree = writer.getConstantSummaries();
for (PackageElement aPackage : configuration.packages) {
if (hasConstantField(aPackage)) {
currentPackage = aPackage;
//Build the documentation for the current package.
buildChildren(node, summariesTree);
first = false;
}
}
writer.addConstantSummaries(contentTree, summariesTree);
} | [
"public",
"void",
"buildConstantSummaries",
"(",
"XMLNode",
"node",
",",
"Content",
"contentTree",
")",
"throws",
"DocletException",
"{",
"printedPackageHeaders",
".",
"clear",
"(",
")",
";",
"Content",
"summariesTree",
"=",
"writer",
".",
"getConstantSummaries",
"(... | Build the summary for each documented package.
@param node the XML element that specifies which components to document
@param contentTree the tree to which the summaries will be added
@throws DocletException if there is a problem while building the documentation | [
"Build",
"the",
"summary",
"for",
"each",
"documented",
"package",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ConstantsSummaryBuilder.java#L185-L197 |
restfb/restfb | src/main/java/com/restfb/util/ReflectionUtils.java | ReflectionUtils.createInstance | public static <T> T createInstance(Class<T> type) {
String errorMessage = "Unable to create an instance of " + type
+ ". Please make sure that if it's a nested class, is marked 'static'. "
+ "It should have a no-argument constructor.";
try {
Constructor<T> defaultConstructor = type.getDeclaredConstructor();
if (defaultConstructor == null) {
throw new FacebookJsonMappingException("Unable to find a default constructor for " + type);
}
// Allows protected, private, and package-private constructors to be
// invoked
defaultConstructor.setAccessible(true);
return defaultConstructor.newInstance();
} catch (Exception e) {
throw new FacebookJsonMappingException(errorMessage, e);
}
} | java | public static <T> T createInstance(Class<T> type) {
String errorMessage = "Unable to create an instance of " + type
+ ". Please make sure that if it's a nested class, is marked 'static'. "
+ "It should have a no-argument constructor.";
try {
Constructor<T> defaultConstructor = type.getDeclaredConstructor();
if (defaultConstructor == null) {
throw new FacebookJsonMappingException("Unable to find a default constructor for " + type);
}
// Allows protected, private, and package-private constructors to be
// invoked
defaultConstructor.setAccessible(true);
return defaultConstructor.newInstance();
} catch (Exception e) {
throw new FacebookJsonMappingException(errorMessage, e);
}
} | [
"public",
"static",
"<",
"T",
">",
"T",
"createInstance",
"(",
"Class",
"<",
"T",
">",
"type",
")",
"{",
"String",
"errorMessage",
"=",
"\"Unable to create an instance of \"",
"+",
"type",
"+",
"\". Please make sure that if it's a nested class, is marked 'static'. \"",
... | Creates a new instance of the given {@code type}.
<p>
@param <T>
Java type to map to.
@param type
Type token.
@return A new instance of {@code type}.
@throws FacebookJsonMappingException
If an error occurs when creating a new instance ({@code type} is inaccessible, doesn't have a no-arg
constructor, etc.) | [
"Creates",
"a",
"new",
"instance",
"of",
"the",
"given",
"{",
"@code",
"type",
"}",
".",
"<p",
">"
] | train | https://github.com/restfb/restfb/blob/fb77ba5486d1339e7deb81b9830670fa209b1047/src/main/java/com/restfb/util/ReflectionUtils.java#L394-L413 |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/registry/NotificationHandlerNodeRegistry.java | NotificationHandlerNodeRegistry.findEntries | void findEntries(ListIterator<PathElement> iterator, Collection<NotificationHandler> handlers, Notification notification) {
if (!iterator.hasNext()) {
for (ConcreteNotificationHandlerRegistration.NotificationHandlerEntry entry : entries) {
if (entry.getFilter().isNotificationEnabled(notification)) {
handlers.add(entry.getHandler());
}
}
return;
}
PathElement next = iterator.next();
try {
final NotificationHandlerNodeSubregistry subregistry = children.get(next.getKey());
if (subregistry == null) {
return;
}
subregistry.findHandlers(iterator, next.getValue(), notification, handlers);
} finally {
iterator.previous();
}
} | java | void findEntries(ListIterator<PathElement> iterator, Collection<NotificationHandler> handlers, Notification notification) {
if (!iterator.hasNext()) {
for (ConcreteNotificationHandlerRegistration.NotificationHandlerEntry entry : entries) {
if (entry.getFilter().isNotificationEnabled(notification)) {
handlers.add(entry.getHandler());
}
}
return;
}
PathElement next = iterator.next();
try {
final NotificationHandlerNodeSubregistry subregistry = children.get(next.getKey());
if (subregistry == null) {
return;
}
subregistry.findHandlers(iterator, next.getValue(), notification, handlers);
} finally {
iterator.previous();
}
} | [
"void",
"findEntries",
"(",
"ListIterator",
"<",
"PathElement",
">",
"iterator",
",",
"Collection",
"<",
"NotificationHandler",
">",
"handlers",
",",
"Notification",
"notification",
")",
"{",
"if",
"(",
"!",
"iterator",
".",
"hasNext",
"(",
")",
")",
"{",
"f... | Collect all the entries in the {@code handler} notifications (if the registry is the leaf node) or continue to traverse the tree
Only entries that are not filtered out after calling {@link org.jboss.as.controller.notification.NotificationFilter#isNotificationEnabled(org.jboss.as.controller.notification.Notification)} for the given {@code notification} are collected | [
"Collect",
"all",
"the",
"entries",
"in",
"the",
"{"
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/registry/NotificationHandlerNodeRegistry.java#L105-L125 |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ProfilePackageSummaryBuilder.java | ProfilePackageSummaryBuilder.buildClassSummary | public void buildClassSummary(XMLNode node, Content summaryContentTree) {
String classTableSummary =
configuration.getText("doclet.Member_Table_Summary",
configuration.getText("doclet.Class_Summary"),
configuration.getText("doclet.classes"));
String[] classTableHeader = new String[] {
configuration.getText("doclet.Class"),
configuration.getText("doclet.Description")
};
ClassDoc[] classes =
packageDoc.isIncluded()
? packageDoc.ordinaryClasses()
: configuration.classDocCatalog.ordinaryClasses(
Util.getPackageName(packageDoc));
if (classes.length > 0) {
profilePackageWriter.addClassesSummary(
classes,
configuration.getText("doclet.Class_Summary"),
classTableSummary, classTableHeader, summaryContentTree);
}
} | java | public void buildClassSummary(XMLNode node, Content summaryContentTree) {
String classTableSummary =
configuration.getText("doclet.Member_Table_Summary",
configuration.getText("doclet.Class_Summary"),
configuration.getText("doclet.classes"));
String[] classTableHeader = new String[] {
configuration.getText("doclet.Class"),
configuration.getText("doclet.Description")
};
ClassDoc[] classes =
packageDoc.isIncluded()
? packageDoc.ordinaryClasses()
: configuration.classDocCatalog.ordinaryClasses(
Util.getPackageName(packageDoc));
if (classes.length > 0) {
profilePackageWriter.addClassesSummary(
classes,
configuration.getText("doclet.Class_Summary"),
classTableSummary, classTableHeader, summaryContentTree);
}
} | [
"public",
"void",
"buildClassSummary",
"(",
"XMLNode",
"node",
",",
"Content",
"summaryContentTree",
")",
"{",
"String",
"classTableSummary",
"=",
"configuration",
".",
"getText",
"(",
"\"doclet.Member_Table_Summary\"",
",",
"configuration",
".",
"getText",
"(",
"\"do... | Build the summary for the classes in this package.
@param node the XML element that specifies which components to document
@param summaryContentTree the summary tree to which the class summary will
be added | [
"Build",
"the",
"summary",
"for",
"the",
"classes",
"in",
"this",
"package",
"."
] | train | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ProfilePackageSummaryBuilder.java#L209-L229 |
moparisthebest/beehive | beehive-netui-compiler/src/main/java/org/apache/beehive/netui/compiler/model/validation/ValidatableField.java | ValidatableField.setRuleMessage | void setRuleMessage(XmlModelWriter xw, ValidatorRule rule, Element element)
{
String messageKey = rule.getMessageKey();
String message = rule.getMessage();
if ( messageKey != null || message != null )
{
Element msgElementToUse = findChildElement(xw, element, "msg", "name", rule.getRuleName(), true, null);
setElementAttribute(msgElementToUse, "resource", true);
if ( messageKey != null )
{
setElementAttribute(msgElementToUse, "key", messageKey);
if (_isValidatorOneOne) {
setElementAttribute(msgElementToUse, "bundle", rule.getBundle());
}
}
else // message != null (it's a hardcoded message)
{
// Add our special constant as the message key, append the hardcoded message to it.
setElementAttribute(msgElementToUse, "key", ValidatorConstants.EXPRESSION_KEY_PREFIX + message);
}
}
} | java | void setRuleMessage(XmlModelWriter xw, ValidatorRule rule, Element element)
{
String messageKey = rule.getMessageKey();
String message = rule.getMessage();
if ( messageKey != null || message != null )
{
Element msgElementToUse = findChildElement(xw, element, "msg", "name", rule.getRuleName(), true, null);
setElementAttribute(msgElementToUse, "resource", true);
if ( messageKey != null )
{
setElementAttribute(msgElementToUse, "key", messageKey);
if (_isValidatorOneOne) {
setElementAttribute(msgElementToUse, "bundle", rule.getBundle());
}
}
else // message != null (it's a hardcoded message)
{
// Add our special constant as the message key, append the hardcoded message to it.
setElementAttribute(msgElementToUse, "key", ValidatorConstants.EXPRESSION_KEY_PREFIX + message);
}
}
} | [
"void",
"setRuleMessage",
"(",
"XmlModelWriter",
"xw",
",",
"ValidatorRule",
"rule",
",",
"Element",
"element",
")",
"{",
"String",
"messageKey",
"=",
"rule",
".",
"getMessageKey",
"(",
")",
";",
"String",
"message",
"=",
"rule",
".",
"getMessage",
"(",
")",... | Set up the desired <msg> element and attributes for the given rule.
@param rule the rule with the message to use | [
"Set",
"up",
"the",
"desired",
"<",
";",
"msg>",
";",
"element",
"and",
"attributes",
"for",
"the",
"given",
"rule",
"."
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-compiler/src/main/java/org/apache/beehive/netui/compiler/model/validation/ValidatableField.java#L235-L258 |
lightblueseas/swing-components | src/main/java/de/alpharogroup/swing/components/factories/JComponentFactory.java | JComponentFactory.newJSplitPane | public static JSplitPane newJSplitPane(int newOrientation, Component newLeftComponent,
Component newRightComponent)
{
return newJSplitPane(newOrientation, true, newLeftComponent, newRightComponent);
} | java | public static JSplitPane newJSplitPane(int newOrientation, Component newLeftComponent,
Component newRightComponent)
{
return newJSplitPane(newOrientation, true, newLeftComponent, newRightComponent);
} | [
"public",
"static",
"JSplitPane",
"newJSplitPane",
"(",
"int",
"newOrientation",
",",
"Component",
"newLeftComponent",
",",
"Component",
"newRightComponent",
")",
"{",
"return",
"newJSplitPane",
"(",
"newOrientation",
",",
"true",
",",
"newLeftComponent",
",",
"newRig... | Factory method for create new {@link JSplitPane} object
@param newOrientation
<code>JSplitPane.HORIZONTAL_SPLIT</code> or <code>JSplitPane.VERTICAL_SPLIT</code>
@param newLeftComponent
the <code>Component</code> that will appear on the left of a horizontally-split
pane, or at the top of a vertically-split pane
@param newRightComponent
the <code>Component</code> that will appear on the right of a horizontally-split
pane, or at the bottom of a vertically-split pane
@return the new {@link JSplitPane} object | [
"Factory",
"method",
"for",
"create",
"new",
"{",
"@link",
"JSplitPane",
"}",
"object"
] | train | https://github.com/lightblueseas/swing-components/blob/4045e85cabd8f0ce985cbfff134c3c9873930c79/src/main/java/de/alpharogroup/swing/components/factories/JComponentFactory.java#L101-L105 |
UrielCh/ovh-java-sdk | ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java | ApiOvhDedicatedserver.serviceName_features_firewall_PUT | public void serviceName_features_firewall_PUT(String serviceName, OvhFirewall body) throws IOException {
String qPath = "/dedicated/server/{serviceName}/features/firewall";
StringBuilder sb = path(qPath, serviceName);
exec(qPath, "PUT", sb.toString(), body);
} | java | public void serviceName_features_firewall_PUT(String serviceName, OvhFirewall body) throws IOException {
String qPath = "/dedicated/server/{serviceName}/features/firewall";
StringBuilder sb = path(qPath, serviceName);
exec(qPath, "PUT", sb.toString(), body);
} | [
"public",
"void",
"serviceName_features_firewall_PUT",
"(",
"String",
"serviceName",
",",
"OvhFirewall",
"body",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/dedicated/server/{serviceName}/features/firewall\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(... | Alter this object properties
REST: PUT /dedicated/server/{serviceName}/features/firewall
@param body [required] New object properties
@param serviceName [required] The internal name of your dedicated server | [
"Alter",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java#L979-L983 |
aws/aws-sdk-java | aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/model/StreamRecord.java | StreamRecord.withKeys | public StreamRecord withKeys(java.util.Map<String, AttributeValue> keys) {
setKeys(keys);
return this;
} | java | public StreamRecord withKeys(java.util.Map<String, AttributeValue> keys) {
setKeys(keys);
return this;
} | [
"public",
"StreamRecord",
"withKeys",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"AttributeValue",
">",
"keys",
")",
"{",
"setKeys",
"(",
"keys",
")",
";",
"return",
"this",
";",
"}"
] | <p>
The primary key attribute(s) for the DynamoDB item that was modified.
</p>
@param keys
The primary key attribute(s) for the DynamoDB item that was modified.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"The",
"primary",
"key",
"attribute",
"(",
"s",
")",
"for",
"the",
"DynamoDB",
"item",
"that",
"was",
"modified",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/model/StreamRecord.java#L178-L181 |
rapidpro/expressions | java/src/main/java/io/rapidpro/expressions/evaluator/Evaluator.java | Evaluator.evaluateTemplate | public EvaluatedTemplate evaluateTemplate(String template, EvaluationContext context, boolean urlEncode) {
return evaluateTemplate(template, context, urlEncode, EvaluationStrategy.COMPLETE);
} | java | public EvaluatedTemplate evaluateTemplate(String template, EvaluationContext context, boolean urlEncode) {
return evaluateTemplate(template, context, urlEncode, EvaluationStrategy.COMPLETE);
} | [
"public",
"EvaluatedTemplate",
"evaluateTemplate",
"(",
"String",
"template",
",",
"EvaluationContext",
"context",
",",
"boolean",
"urlEncode",
")",
"{",
"return",
"evaluateTemplate",
"(",
"template",
",",
"context",
",",
"urlEncode",
",",
"EvaluationStrategy",
".",
... | Evaluates a template string, e.g. "Hello @contact.name you have @(contact.reports * 2) reports"
@param template the template string
@param context the evaluation context
@param urlEncode whether or not values should be URL encoded
@return a tuple of the evaluated template and a list of evaluation errors | [
"Evaluates",
"a",
"template",
"string",
"e",
".",
"g",
".",
"Hello"
] | train | https://github.com/rapidpro/expressions/blob/b03d91ec58fc328960bce90ecb5fa49dcf467627/java/src/main/java/io/rapidpro/expressions/evaluator/Evaluator.java#L88-L90 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/TextModerationsImpl.java | TextModerationsImpl.detectLanguage | public DetectedLanguage detectLanguage(String textContentType, byte[] textContent) {
return detectLanguageWithServiceResponseAsync(textContentType, textContent).toBlocking().single().body();
} | java | public DetectedLanguage detectLanguage(String textContentType, byte[] textContent) {
return detectLanguageWithServiceResponseAsync(textContentType, textContent).toBlocking().single().body();
} | [
"public",
"DetectedLanguage",
"detectLanguage",
"(",
"String",
"textContentType",
",",
"byte",
"[",
"]",
"textContent",
")",
"{",
"return",
"detectLanguageWithServiceResponseAsync",
"(",
"textContentType",
",",
"textContent",
")",
".",
"toBlocking",
"(",
")",
".",
"... | This operation will detect the language of given input content. Returns the <a href="http://www-01.sil.org/iso639-3/codes.asp">ISO 639-3 code</a> for the predominant language comprising the submitted text. Over 110 languages supported.
@param textContentType The content type. Possible values include: 'text/plain', 'text/html', 'text/xml', 'text/markdown'
@param textContent Content to screen.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws APIErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the DetectedLanguage object if successful. | [
"This",
"operation",
"will",
"detect",
"the",
"language",
"of",
"given",
"input",
"content",
".",
"Returns",
"the",
"<",
";",
"a",
"href",
"=",
"http",
":",
"//",
"www",
"-",
"01",
".",
"sil",
".",
"org",
"/",
"iso639",
"-",
"3",
"/",
"codes",
".... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/TextModerationsImpl.java#L292-L294 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/customvision/prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/implementation/PredictionsImpl.java | PredictionsImpl.predictImageUrlWithNoStore | public ImagePrediction predictImageUrlWithNoStore(UUID projectId, PredictImageUrlWithNoStoreOptionalParameter predictImageUrlWithNoStoreOptionalParameter) {
return predictImageUrlWithNoStoreWithServiceResponseAsync(projectId, predictImageUrlWithNoStoreOptionalParameter).toBlocking().single().body();
} | java | public ImagePrediction predictImageUrlWithNoStore(UUID projectId, PredictImageUrlWithNoStoreOptionalParameter predictImageUrlWithNoStoreOptionalParameter) {
return predictImageUrlWithNoStoreWithServiceResponseAsync(projectId, predictImageUrlWithNoStoreOptionalParameter).toBlocking().single().body();
} | [
"public",
"ImagePrediction",
"predictImageUrlWithNoStore",
"(",
"UUID",
"projectId",
",",
"PredictImageUrlWithNoStoreOptionalParameter",
"predictImageUrlWithNoStoreOptionalParameter",
")",
"{",
"return",
"predictImageUrlWithNoStoreWithServiceResponseAsync",
"(",
"projectId",
",",
"pr... | Predict an image url without saving the result.
@param projectId The project id
@param predictImageUrlWithNoStoreOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the ImagePrediction object if successful. | [
"Predict",
"an",
"image",
"url",
"without",
"saving",
"the",
"result",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/customvision/prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/implementation/PredictionsImpl.java#L275-L277 |
bazaarvoice/ostrich | core/src/main/java/com/bazaarvoice/ostrich/pool/ServiceCachingPolicyBuilder.java | ServiceCachingPolicyBuilder.withMaxServiceInstanceIdleTime | public ServiceCachingPolicyBuilder withMaxServiceInstanceIdleTime(int maxServiceInstanceIdleTime, TimeUnit unit) {
checkState(maxServiceInstanceIdleTime > 0);
checkNotNull(unit);
_maxServiceInstanceIdleTimeNanos = unit.toNanos(maxServiceInstanceIdleTime);
return this;
} | java | public ServiceCachingPolicyBuilder withMaxServiceInstanceIdleTime(int maxServiceInstanceIdleTime, TimeUnit unit) {
checkState(maxServiceInstanceIdleTime > 0);
checkNotNull(unit);
_maxServiceInstanceIdleTimeNanos = unit.toNanos(maxServiceInstanceIdleTime);
return this;
} | [
"public",
"ServiceCachingPolicyBuilder",
"withMaxServiceInstanceIdleTime",
"(",
"int",
"maxServiceInstanceIdleTime",
",",
"TimeUnit",
"unit",
")",
"{",
"checkState",
"(",
"maxServiceInstanceIdleTime",
">",
"0",
")",
";",
"checkNotNull",
"(",
"unit",
")",
";",
"_maxServi... | Set the amount of time a cached instance is allowed to sit idle in the cache before being eligible for
expiration. If never called, cached instances will not expire solely due to idle time.
@param maxServiceInstanceIdleTime The time an instance may be idle before allowed to expire.
@param unit The unit of time the {@code maxServiceInstanceIdleTime} is in.
@return this | [
"Set",
"the",
"amount",
"of",
"time",
"a",
"cached",
"instance",
"is",
"allowed",
"to",
"sit",
"idle",
"in",
"the",
"cache",
"before",
"being",
"eligible",
"for",
"expiration",
".",
"If",
"never",
"called",
"cached",
"instances",
"will",
"not",
"expire",
"... | train | https://github.com/bazaarvoice/ostrich/blob/13591867870ab23445253f11fc872662a8028191/core/src/main/java/com/bazaarvoice/ostrich/pool/ServiceCachingPolicyBuilder.java#L102-L108 |
aspectran/aspectran | core/src/main/java/com/aspectran/core/context/rule/ItemRule.java | ItemRule.putValue | public void putValue(String name, String text) {
Token[] tokens = TokenParser.makeTokens(text, isTokenize());
putValue(name, tokens);
} | java | public void putValue(String name, String text) {
Token[] tokens = TokenParser.makeTokens(text, isTokenize());
putValue(name, tokens);
} | [
"public",
"void",
"putValue",
"(",
"String",
"name",
",",
"String",
"text",
")",
"{",
"Token",
"[",
"]",
"tokens",
"=",
"TokenParser",
".",
"makeTokens",
"(",
"text",
",",
"isTokenize",
"(",
")",
")",
";",
"putValue",
"(",
"name",
",",
"tokens",
")",
... | Puts the specified value with the specified key to this Map type item.
@param name the value name; may be null
@param text the value to be analyzed for use as the value of this item
@see #putValue(String, Token[]) | [
"Puts",
"the",
"specified",
"value",
"with",
"the",
"specified",
"key",
"to",
"this",
"Map",
"type",
"item",
"."
] | train | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/rule/ItemRule.java#L239-L242 |
OpenLiberty/open-liberty | dev/com.ibm.ws.context/src/com/ibm/ws/context/service/serializable/ThreadContextDescriptorImpl.java | ThreadContextDescriptorImpl.containsAll | @Trivial
private static final boolean containsAll(LinkedHashMap<ThreadContextProvider, ThreadContext> contextProviders, List<ThreadContextProvider> prereqs) {
for (ThreadContextProvider prereq : prereqs)
if (!contextProviders.containsKey(prereq))
return false;
return true;
} | java | @Trivial
private static final boolean containsAll(LinkedHashMap<ThreadContextProvider, ThreadContext> contextProviders, List<ThreadContextProvider> prereqs) {
for (ThreadContextProvider prereq : prereqs)
if (!contextProviders.containsKey(prereq))
return false;
return true;
} | [
"@",
"Trivial",
"private",
"static",
"final",
"boolean",
"containsAll",
"(",
"LinkedHashMap",
"<",
"ThreadContextProvider",
",",
"ThreadContext",
">",
"contextProviders",
",",
"List",
"<",
"ThreadContextProvider",
">",
"prereqs",
")",
"{",
"for",
"(",
"ThreadContext... | Utility method that indicates whether or not a list of thread context providers contains all of the specified prerequisites.
@param contextProviders list of thread context providers (actually a map, but the keys are used as a list)
@param prereqs prerequisite thread context providers
@return true if all prerequisites are met. Otherwise false. | [
"Utility",
"method",
"that",
"indicates",
"whether",
"or",
"not",
"a",
"list",
"of",
"thread",
"context",
"providers",
"contains",
"all",
"of",
"the",
"specified",
"prerequisites",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.context/src/com/ibm/ws/context/service/serializable/ThreadContextDescriptorImpl.java#L229-L235 |
keenlabs/KeenClient-Java | core/src/main/java/io/keen/client/java/FileEventStore.java | FileEventStore.getKeenCacheDirectory | private File getKeenCacheDirectory() throws IOException {
File file = new File(root, "keen");
if (!file.exists()) {
boolean dirMade = file.mkdir();
if (!dirMade) {
throw new IOException("Could not make keen cache directory at: " + file.getAbsolutePath());
}
}
return file;
} | java | private File getKeenCacheDirectory() throws IOException {
File file = new File(root, "keen");
if (!file.exists()) {
boolean dirMade = file.mkdir();
if (!dirMade) {
throw new IOException("Could not make keen cache directory at: " + file.getAbsolutePath());
}
}
return file;
} | [
"private",
"File",
"getKeenCacheDirectory",
"(",
")",
"throws",
"IOException",
"{",
"File",
"file",
"=",
"new",
"File",
"(",
"root",
",",
"\"keen\"",
")",
";",
"if",
"(",
"!",
"file",
".",
"exists",
"(",
")",
")",
"{",
"boolean",
"dirMade",
"=",
"file"... | Gets the root directory of the Keen cache, based on the root directory passed to the
constructor of this file store. If necessary, this method will attempt to create the
directory.
@return The root directory of the cache. | [
"Gets",
"the",
"root",
"directory",
"of",
"the",
"Keen",
"cache",
"based",
"on",
"the",
"root",
"directory",
"passed",
"to",
"the",
"constructor",
"of",
"this",
"file",
"store",
".",
"If",
"necessary",
"this",
"method",
"will",
"attempt",
"to",
"create",
"... | train | https://github.com/keenlabs/KeenClient-Java/blob/2ea021547b5338257c951a2596bd49749038d018/core/src/main/java/io/keen/client/java/FileEventStore.java#L227-L236 |
craigwblake/redline | src/main/java/org/redline_rpm/Builder.java | Builder.addTrigger | public void addTrigger( final File script, final String prog, final Map< String, IntString> depends, final int flag) throws IOException {
triggerscripts.add(readScript(script));
if ( null == prog) {
triggerscriptprogs.add(DEFAULTSCRIPTPROG);
} else if ( 0 == prog.length()){
triggerscriptprogs.add(DEFAULTSCRIPTPROG);
} else {
triggerscriptprogs.add(prog);
}
for ( Map.Entry< String, IntString> depend : depends.entrySet()) {
triggernames.add( depend.getKey());
triggerflags.add( depend.getValue().getInt() | flag);
triggerversions.add( depend.getValue().getString());
triggerindexes.add ( triggerCounter);
}
triggerCounter++;
} | java | public void addTrigger( final File script, final String prog, final Map< String, IntString> depends, final int flag) throws IOException {
triggerscripts.add(readScript(script));
if ( null == prog) {
triggerscriptprogs.add(DEFAULTSCRIPTPROG);
} else if ( 0 == prog.length()){
triggerscriptprogs.add(DEFAULTSCRIPTPROG);
} else {
triggerscriptprogs.add(prog);
}
for ( Map.Entry< String, IntString> depend : depends.entrySet()) {
triggernames.add( depend.getKey());
triggerflags.add( depend.getValue().getInt() | flag);
triggerversions.add( depend.getValue().getString());
triggerindexes.add ( triggerCounter);
}
triggerCounter++;
} | [
"public",
"void",
"addTrigger",
"(",
"final",
"File",
"script",
",",
"final",
"String",
"prog",
",",
"final",
"Map",
"<",
"String",
",",
"IntString",
">",
"depends",
",",
"final",
"int",
"flag",
")",
"throws",
"IOException",
"{",
"triggerscripts",
".",
"ad... | Adds a trigger to the RPM package.
@param script the script to add.
@param prog the interpreter with which to run the script.
@param depends the map of rpms and versions that will trigger the script
@param flag the trigger type (SCRIPT_TRIGGERPREIN, SCRIPT_TRIGGERIN, SCRIPT_TRIGGERUN, or SCRIPT_TRIGGERPOSTUN)
@throws IOException there was an IO error | [
"Adds",
"a",
"trigger",
"to",
"the",
"RPM",
"package",
"."
] | train | https://github.com/craigwblake/redline/blob/b2fee5eb6c8150e801a132a4478a643f9ec0df04/src/main/java/org/redline_rpm/Builder.java#L835-L851 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-contrib/google-cloud-nio/src/main/java/com/google/cloud/storage/contrib/nio/CloudStorageFileSystemProvider.java | CloudStorageFileSystemProvider.getFileSystem | @Override
public CloudStorageFileSystem getFileSystem(URI uri) {
initStorage();
return newFileSystem(uri, Collections.<String, Object>emptyMap());
} | java | @Override
public CloudStorageFileSystem getFileSystem(URI uri) {
initStorage();
return newFileSystem(uri, Collections.<String, Object>emptyMap());
} | [
"@",
"Override",
"public",
"CloudStorageFileSystem",
"getFileSystem",
"(",
"URI",
"uri",
")",
"{",
"initStorage",
"(",
")",
";",
"return",
"newFileSystem",
"(",
"uri",
",",
"Collections",
".",
"<",
"String",
",",
"Object",
">",
"emptyMap",
"(",
")",
")",
"... | Returns Cloud Storage file system, provided a URI with no path, e.g. {@code gs://bucket}. | [
"Returns",
"Cloud",
"Storage",
"file",
"system",
"provided",
"a",
"URI",
"with",
"no",
"path",
"e",
".",
"g",
".",
"{"
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-contrib/google-cloud-nio/src/main/java/com/google/cloud/storage/contrib/nio/CloudStorageFileSystemProvider.java#L226-L230 |
jglobus/JGlobus | io/src/main/java/org/globus/io/urlcopy/UrlCopy.java | UrlCopy.negotiateDCAU | protected void negotiateDCAU(FTPClient src, FTPClient dst)
throws IOException, FTPException {
if (src instanceof GridFTPClient) {
// src: dcau can be on or off
if (dst instanceof GridFTPClient) {
// dst: dca can be on or off
GridFTPClient s = (GridFTPClient)src;
GridFTPClient d = (GridFTPClient)dst;
if (src.isFeatureSupported("DCAU") &&
dst.isFeatureSupported("DCAU")) {
setDCAU(s, getDCAU());
setDCAU(d, getDCAU());
} else {
setDCAU(s, false);
setDCAU(d, false);
setDCAU(false);
}
} else {
// dst: no dcau supported - disable src
setDCAU((GridFTPClient)src, false);
setDCAU(false);
}
} else {
// src: no dcau
if (dst instanceof GridFTPClient) {
// dst: just disable dcau
setDCAU((GridFTPClient)dst, false);
} else {
// dst: no dcau
// we are all set then
}
setDCAU(false);
}
} | java | protected void negotiateDCAU(FTPClient src, FTPClient dst)
throws IOException, FTPException {
if (src instanceof GridFTPClient) {
// src: dcau can be on or off
if (dst instanceof GridFTPClient) {
// dst: dca can be on or off
GridFTPClient s = (GridFTPClient)src;
GridFTPClient d = (GridFTPClient)dst;
if (src.isFeatureSupported("DCAU") &&
dst.isFeatureSupported("DCAU")) {
setDCAU(s, getDCAU());
setDCAU(d, getDCAU());
} else {
setDCAU(s, false);
setDCAU(d, false);
setDCAU(false);
}
} else {
// dst: no dcau supported - disable src
setDCAU((GridFTPClient)src, false);
setDCAU(false);
}
} else {
// src: no dcau
if (dst instanceof GridFTPClient) {
// dst: just disable dcau
setDCAU((GridFTPClient)dst, false);
} else {
// dst: no dcau
// we are all set then
}
setDCAU(false);
}
} | [
"protected",
"void",
"negotiateDCAU",
"(",
"FTPClient",
"src",
",",
"FTPClient",
"dst",
")",
"throws",
"IOException",
",",
"FTPException",
"{",
"if",
"(",
"src",
"instanceof",
"GridFTPClient",
")",
"{",
"// src: dcau can be on or off",
"if",
"(",
"dst",
"instanceo... | /*
This could replaced later with something more inteligent
where the user would set if dcau is required or not, etc. | [
"/",
"*",
"This",
"could",
"replaced",
"later",
"with",
"something",
"more",
"inteligent",
"where",
"the",
"user",
"would",
"set",
"if",
"dcau",
"is",
"required",
"or",
"not",
"etc",
"."
] | train | https://github.com/jglobus/JGlobus/blob/e14f6f6636544fd84298f9cec749d626ea971930/io/src/main/java/org/globus/io/urlcopy/UrlCopy.java#L781-L818 |
threerings/nenya | core/src/main/java/com/threerings/media/animation/AnimationArranger.java | AnimationArranger.positionAvoidAnimation | public void positionAvoidAnimation (Animation anim, Rectangle viewBounds)
{
Rectangle abounds = new Rectangle(anim.getBounds());
@SuppressWarnings("unchecked") ArrayList<Animation> avoidables =
(ArrayList<Animation>) _avoidAnims.clone();
// if we are able to place it somewhere, do so
if (SwingUtil.positionRect(abounds, viewBounds, avoidables)) {
anim.setLocation(abounds.x, abounds.y);
}
// add the animation to the list of avoidables
_avoidAnims.add(anim);
// keep an eye on it so that we can remove it when it's finished
anim.addAnimationObserver(_avoidAnimObs);
} | java | public void positionAvoidAnimation (Animation anim, Rectangle viewBounds)
{
Rectangle abounds = new Rectangle(anim.getBounds());
@SuppressWarnings("unchecked") ArrayList<Animation> avoidables =
(ArrayList<Animation>) _avoidAnims.clone();
// if we are able to place it somewhere, do so
if (SwingUtil.positionRect(abounds, viewBounds, avoidables)) {
anim.setLocation(abounds.x, abounds.y);
}
// add the animation to the list of avoidables
_avoidAnims.add(anim);
// keep an eye on it so that we can remove it when it's finished
anim.addAnimationObserver(_avoidAnimObs);
} | [
"public",
"void",
"positionAvoidAnimation",
"(",
"Animation",
"anim",
",",
"Rectangle",
"viewBounds",
")",
"{",
"Rectangle",
"abounds",
"=",
"new",
"Rectangle",
"(",
"anim",
".",
"getBounds",
"(",
")",
")",
";",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
"... | Position the specified animation so that it is not overlapping
any still-running animations previously passed to this method. | [
"Position",
"the",
"specified",
"animation",
"so",
"that",
"it",
"is",
"not",
"overlapping",
"any",
"still",
"-",
"running",
"animations",
"previously",
"passed",
"to",
"this",
"method",
"."
] | train | https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/animation/AnimationArranger.java#L41-L55 |
lessthanoptimal/BoofCV | main/boofcv-sfm/src/main/java/boofcv/alg/sfm/structure2/ProjectiveInitializeAllCommon.java | ProjectiveInitializeAllCommon.computeCameraMatrix | private boolean computeCameraMatrix(View seed, Motion edge, FastQueue<Point2D_F64> featsB, DMatrixRMaj cameraMatrix ) {
boolean seedSrc = edge.src == seed;
int matched = 0;
for (int i = 0; i < edge.inliers.size; i++) {
// need to go from i to index of detected features in view 'seed' to index index of feature in
// the reconstruction
AssociatedIndex a = edge.inliers.get(i);
int featId = seedToStructure.data[seedSrc ? a.src : a.dst];
if( featId == -1 )
continue;
assocPixel.get(featId).p2.set( featsB.get(seedSrc?a.dst:a.src) );
matched++;
}
// All views should have matches for all features, simple sanity check
if( matched != assocPixel.size)
throw new RuntimeException("BUG! Didn't find all features in the view");
// Estimate the camera matrix given homogenous pixel observations
if( poseEstimator.processHomogenous(assocPixel.toList(),points3D.toList()) ) {
cameraMatrix.set(poseEstimator.getProjective());
return true;
} else {
return false;
}
} | java | private boolean computeCameraMatrix(View seed, Motion edge, FastQueue<Point2D_F64> featsB, DMatrixRMaj cameraMatrix ) {
boolean seedSrc = edge.src == seed;
int matched = 0;
for (int i = 0; i < edge.inliers.size; i++) {
// need to go from i to index of detected features in view 'seed' to index index of feature in
// the reconstruction
AssociatedIndex a = edge.inliers.get(i);
int featId = seedToStructure.data[seedSrc ? a.src : a.dst];
if( featId == -1 )
continue;
assocPixel.get(featId).p2.set( featsB.get(seedSrc?a.dst:a.src) );
matched++;
}
// All views should have matches for all features, simple sanity check
if( matched != assocPixel.size)
throw new RuntimeException("BUG! Didn't find all features in the view");
// Estimate the camera matrix given homogenous pixel observations
if( poseEstimator.processHomogenous(assocPixel.toList(),points3D.toList()) ) {
cameraMatrix.set(poseEstimator.getProjective());
return true;
} else {
return false;
}
} | [
"private",
"boolean",
"computeCameraMatrix",
"(",
"View",
"seed",
",",
"Motion",
"edge",
",",
"FastQueue",
"<",
"Point2D_F64",
">",
"featsB",
",",
"DMatrixRMaj",
"cameraMatrix",
")",
"{",
"boolean",
"seedSrc",
"=",
"edge",
".",
"src",
"==",
"seed",
";",
"int... | Computes camera matrix between the seed view and a connected view
@param seed This will be the source view. It's observations have already been added to assocPixel
@param edge The edge which connects them
@param featsB The dst view
@param cameraMatrix (Output) resulting camera matrix
@return true if successful | [
"Computes",
"camera",
"matrix",
"between",
"the",
"seed",
"view",
"and",
"a",
"connected",
"view"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-sfm/src/main/java/boofcv/alg/sfm/structure2/ProjectiveInitializeAllCommon.java#L431-L456 |
korpling/ANNIS | annis-visualizers/src/main/java/annis/visualizers/component/grid/EventExtractor.java | EventExtractor.sortEventsByTokenIndex | private static void sortEventsByTokenIndex(Row row) {
Collections.sort(row.getEvents(), new Comparator<GridEvent>() {
@Override
public int compare(GridEvent o1, GridEvent o2) {
if (o1 == o2) {
return 0;
}
if (o1 == null) {
return -1;
}
if (o2 == null) {
return +1;
}
return Integer.compare(o1.getLeft(), o2.getLeft());
}
});
} | java | private static void sortEventsByTokenIndex(Row row) {
Collections.sort(row.getEvents(), new Comparator<GridEvent>() {
@Override
public int compare(GridEvent o1, GridEvent o2) {
if (o1 == o2) {
return 0;
}
if (o1 == null) {
return -1;
}
if (o2 == null) {
return +1;
}
return Integer.compare(o1.getLeft(), o2.getLeft());
}
});
} | [
"private",
"static",
"void",
"sortEventsByTokenIndex",
"(",
"Row",
"row",
")",
"{",
"Collections",
".",
"sort",
"(",
"row",
".",
"getEvents",
"(",
")",
",",
"new",
"Comparator",
"<",
"GridEvent",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"int",
"com... | Sort events of a row. The sorting is depending on the left value of the
event
@param row | [
"Sort",
"events",
"of",
"a",
"row",
".",
"The",
"sorting",
"is",
"depending",
"on",
"the",
"left",
"value",
"of",
"the",
"event"
] | train | https://github.com/korpling/ANNIS/blob/152a2e34832e015f73ac8ce8a7d4c32641641324/annis-visualizers/src/main/java/annis/visualizers/component/grid/EventExtractor.java#L690-L707 |
CenturyLinkCloud/mdw | mdw-workflow/src/com/centurylink/mdw/workflow/activity/task/ManualTaskActivity.java | ManualTaskActivity.resumeWaiting | public final boolean resumeWaiting(InternalEvent event) throws ActivityException {
boolean done;
EventWaitInstance received;
try {
received = getEngine().createEventWaitInstance(getActivityInstanceId(), getWaitEvent(), null, true, false);
if (received == null)
received = registerWaitEvents(true, true);
}
catch (Exception e) {
throw new ActivityException(-1, e.getMessage(), e);
}
if (received != null) {
done = resume(getExternalEventInstanceDetails(received.getMessageDocumentId()),
received.getCompletionCode());
}
else {
done = false;
}
return done;
} | java | public final boolean resumeWaiting(InternalEvent event) throws ActivityException {
boolean done;
EventWaitInstance received;
try {
received = getEngine().createEventWaitInstance(getActivityInstanceId(), getWaitEvent(), null, true, false);
if (received == null)
received = registerWaitEvents(true, true);
}
catch (Exception e) {
throw new ActivityException(-1, e.getMessage(), e);
}
if (received != null) {
done = resume(getExternalEventInstanceDetails(received.getMessageDocumentId()),
received.getCompletionCode());
}
else {
done = false;
}
return done;
} | [
"public",
"final",
"boolean",
"resumeWaiting",
"(",
"InternalEvent",
"event",
")",
"throws",
"ActivityException",
"{",
"boolean",
"done",
";",
"EventWaitInstance",
"received",
";",
"try",
"{",
"received",
"=",
"getEngine",
"(",
")",
".",
"createEventWaitInstance",
... | This method is made final for the class, as it contains internal logic handling resumption
of waiting. It re-register the event waits including waiting for task to complete.
If any event has already arrived, it processes it immediately.
Customization should be done with the methods {@link #processOtherMessage(String, String)}
and {@link #registerWaitEvents()}. | [
"This",
"method",
"is",
"made",
"final",
"for",
"the",
"class",
"as",
"it",
"contains",
"internal",
"logic",
"handling",
"resumption",
"of",
"waiting",
".",
"It",
"re",
"-",
"register",
"the",
"event",
"waits",
"including",
"waiting",
"for",
"task",
"to",
... | train | https://github.com/CenturyLinkCloud/mdw/blob/91167fe65a25a5d7022cdcf8b0fae8506f5b87ce/mdw-workflow/src/com/centurylink/mdw/workflow/activity/task/ManualTaskActivity.java#L162-L181 |
sebastiangraf/treetank | interfacemodules/xml/src/main/java/org/treetank/service/xml/xpath/parser/XPathParser.java | XPathParser.parseItemType | private AbsFilter parseItemType() {
AbsFilter filter;
if (isKindTest()) {
filter = parseKindTest();
} else if (is("item", true)) {
consume(TokenType.OPEN_BR, true);
consume(TokenType.CLOSE_BR, true);
filter = new ItemFilter(getTransaction());
} else {
final String atomic = parseAtomicType();
filter = new TypeFilter(getTransaction(), atomic);
}
return filter;
} | java | private AbsFilter parseItemType() {
AbsFilter filter;
if (isKindTest()) {
filter = parseKindTest();
} else if (is("item", true)) {
consume(TokenType.OPEN_BR, true);
consume(TokenType.CLOSE_BR, true);
filter = new ItemFilter(getTransaction());
} else {
final String atomic = parseAtomicType();
filter = new TypeFilter(getTransaction(), atomic);
}
return filter;
} | [
"private",
"AbsFilter",
"parseItemType",
"(",
")",
"{",
"AbsFilter",
"filter",
";",
"if",
"(",
"isKindTest",
"(",
")",
")",
"{",
"filter",
"=",
"parseKindTest",
"(",
")",
";",
"}",
"else",
"if",
"(",
"is",
"(",
"\"item\"",
",",
"true",
")",
")",
"{",... | Parses the the rule ItemType according to the following production rule:
<p>
[51] ItemType ::= AtomicType | KindTest | <"item" "(" ")"> .
</p>
@return filter | [
"Parses",
"the",
"the",
"rule",
"ItemType",
"according",
"to",
"the",
"following",
"production",
"rule",
":",
"<p",
">",
"[",
"51",
"]",
"ItemType",
"::",
"=",
"AtomicType",
"|",
"KindTest",
"|",
"<",
"item",
"(",
")",
">",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/xml/src/main/java/org/treetank/service/xml/xpath/parser/XPathParser.java#L1398-L1413 |
groupe-sii/ogham | ogham-core/src/main/java/fr/sii/ogham/core/util/HashCodeBuilder.java | HashCodeBuilder.reflectionsHashCode | public static int reflectionsHashCode(Object object, String... excludeFields) {
return org.apache.commons.lang3.builder.HashCodeBuilder.reflectionHashCode(object, excludeFields);
} | java | public static int reflectionsHashCode(Object object, String... excludeFields) {
return org.apache.commons.lang3.builder.HashCodeBuilder.reflectionHashCode(object, excludeFields);
} | [
"public",
"static",
"int",
"reflectionsHashCode",
"(",
"Object",
"object",
",",
"String",
"...",
"excludeFields",
")",
"{",
"return",
"org",
".",
"apache",
".",
"commons",
".",
"lang3",
".",
"builder",
".",
"HashCodeBuilder",
".",
"reflectionHashCode",
"(",
"o... | <p>
Uses reflection to build a valid hash code from the fields of object.
</p>
<p>
This constructor uses two hard coded choices for the constants needed to
build a hash code.
</p>
<p>
It uses AccessibleObject.setAccessible to gain access to private fields.
This means that it will throw a security exception if run under a
security manager, if the permissions are not set up correctly. It is also
not as efficient as testing explicitly.
</p>
<p>
Transient members will be not be used, as they are likely derived fields,
and not part of the value of the Object.
</p>
<p>
Static fields will not be tested. Superclass fields will be included. If
no fields are found to include in the hash code, the result of this
method will be constant.
</p>
@param object
the Object to create a hashCode for
@param excludeFields
array of field names to exclude from use in calculation of
hash code
@return hash code
@throws IllegalArgumentException
if the object is null | [
"<p",
">",
"Uses",
"reflection",
"to",
"build",
"a",
"valid",
"hash",
"code",
"from",
"the",
"fields",
"of",
"object",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/groupe-sii/ogham/blob/e273b845604add74b5a25dfd931cb3c166b1008f/ogham-core/src/main/java/fr/sii/ogham/core/util/HashCodeBuilder.java#L199-L201 |
BlueBrain/bluima | modules/bluima_abbreviations/src/main/java/com/wcohen/ss/abbvGapsHmm/AbbvGapsHmmBackwardsEvaluator.java | AbbvGapsHmmBackwardsEvaluator.getPartialStartedWord | protected static String getPartialStartedWord(String str, int pos){
assert(pos < str.length() && pos >= 0);
if( posIsAtWord(str, pos) ){
int nextSpace = findNextNonLetterOrDigit(str, pos);
if(nextSpace == -1){
nextSpace = str.length();
}
return str.substring(pos, nextSpace);
}
return null;
} | java | protected static String getPartialStartedWord(String str, int pos){
assert(pos < str.length() && pos >= 0);
if( posIsAtWord(str, pos) ){
int nextSpace = findNextNonLetterOrDigit(str, pos);
if(nextSpace == -1){
nextSpace = str.length();
}
return str.substring(pos, nextSpace);
}
return null;
} | [
"protected",
"static",
"String",
"getPartialStartedWord",
"(",
"String",
"str",
",",
"int",
"pos",
")",
"{",
"assert",
"(",
"pos",
"<",
"str",
".",
"length",
"(",
")",
"&&",
"pos",
">=",
"0",
")",
";",
"if",
"(",
"posIsAtWord",
"(",
"str",
",",
"pos"... | If pos is starting a new word in str, returns this word.
Else, returns null. | [
"If",
"pos",
"is",
"starting",
"a",
"new",
"word",
"in",
"str",
"returns",
"this",
"word",
".",
"Else",
"returns",
"null",
"."
] | train | https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_abbreviations/src/main/java/com/wcohen/ss/abbvGapsHmm/AbbvGapsHmmBackwardsEvaluator.java#L153-L165 |
h2oai/h2o-2 | src/main/java/water/NanoHTTPD.java | NanoHTTPD.encodeUri | private String encodeUri( String uri ) {
String newUri = "";
StringTokenizer st = new StringTokenizer( uri, "/ ", true );
while ( st.hasMoreTokens()) {
String tok = st.nextToken();
if ( tok.equals( "/" ))
newUri += "/";
else if ( tok.equals( " " ))
newUri += "%20";
else {
try {
newUri += URLEncoder.encode( tok, "UTF-8" );
} catch( UnsupportedEncodingException e ) {
throw Log.errRTExcept(e);
}
}
}
return newUri;
} | java | private String encodeUri( String uri ) {
String newUri = "";
StringTokenizer st = new StringTokenizer( uri, "/ ", true );
while ( st.hasMoreTokens()) {
String tok = st.nextToken();
if ( tok.equals( "/" ))
newUri += "/";
else if ( tok.equals( " " ))
newUri += "%20";
else {
try {
newUri += URLEncoder.encode( tok, "UTF-8" );
} catch( UnsupportedEncodingException e ) {
throw Log.errRTExcept(e);
}
}
}
return newUri;
} | [
"private",
"String",
"encodeUri",
"(",
"String",
"uri",
")",
"{",
"String",
"newUri",
"=",
"\"\"",
";",
"StringTokenizer",
"st",
"=",
"new",
"StringTokenizer",
"(",
"uri",
",",
"\"/ \"",
",",
"true",
")",
";",
"while",
"(",
"st",
".",
"hasMoreTokens",
"(... | URL-encodes everything between "/"-characters.
Encodes spaces as '%20' instead of '+'.
@throws UnsupportedEncodingException | [
"URL",
"-",
"encodes",
"everything",
"between",
"/",
"-",
"characters",
".",
"Encodes",
"spaces",
"as",
"%20",
"instead",
"of",
"+",
"."
] | train | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/NanoHTTPD.java#L826-L844 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/Range.java | Range.of | public R of(@Nonnull T startClosed, @Nonnull T endOpen) {
return startClosed(startClosed).endOpen(endOpen);
} | java | public R of(@Nonnull T startClosed, @Nonnull T endOpen) {
return startClosed(startClosed).endOpen(endOpen);
} | [
"public",
"R",
"of",
"(",
"@",
"Nonnull",
"T",
"startClosed",
",",
"@",
"Nonnull",
"T",
"endOpen",
")",
"{",
"return",
"startClosed",
"(",
"startClosed",
")",
".",
"endOpen",
"(",
"endOpen",
")",
";",
"}"
] | Creates a new {@link Range} with the specified inclusive start and the specified exclusive end. | [
"Creates",
"a",
"new",
"{"
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/Range.java#L77-L79 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUService.java | ICUService.getDisplayName | public String getDisplayName(String id) {
return getDisplayName(id, ULocale.getDefault(Category.DISPLAY));
} | java | public String getDisplayName(String id) {
return getDisplayName(id, ULocale.getDefault(Category.DISPLAY));
} | [
"public",
"String",
"getDisplayName",
"(",
"String",
"id",
")",
"{",
"return",
"getDisplayName",
"(",
"id",
",",
"ULocale",
".",
"getDefault",
"(",
"Category",
".",
"DISPLAY",
")",
")",
";",
"}"
] | Convenience override for getDisplayName(String, ULocale) that
uses the current default locale. | [
"Convenience",
"override",
"for",
"getDisplayName",
"(",
"String",
"ULocale",
")",
"that",
"uses",
"the",
"current",
"default",
"locale",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUService.java#L611-L613 |
aNNiMON/Lightweight-Stream-API | stream/src/main/java/com/annimon/stream/IntStream.java | IntStream.filter | @NotNull
public IntStream filter(@NotNull final IntPredicate predicate) {
return new IntStream(params, new IntFilter(iterator, predicate));
} | java | @NotNull
public IntStream filter(@NotNull final IntPredicate predicate) {
return new IntStream(params, new IntFilter(iterator, predicate));
} | [
"@",
"NotNull",
"public",
"IntStream",
"filter",
"(",
"@",
"NotNull",
"final",
"IntPredicate",
"predicate",
")",
"{",
"return",
"new",
"IntStream",
"(",
"params",
",",
"new",
"IntFilter",
"(",
"iterator",
",",
"predicate",
")",
")",
";",
"}"
] | Returns a stream consisting of the elements of this stream that match
the given predicate.
<p> This is an intermediate operation.
<p>Example:
<pre>
predicate: (a) -> a > 2
stream: [1, 2, 3, 4, -8, 0, 11]
result: [3, 4, 11]
</pre>
@param predicate non-interfering, stateless predicate to apply to each
element to determine if it should be included
@return the new stream | [
"Returns",
"a",
"stream",
"consisting",
"of",
"the",
"elements",
"of",
"this",
"stream",
"that",
"match",
"the",
"given",
"predicate",
"."
] | train | https://github.com/aNNiMON/Lightweight-Stream-API/blob/f29fd57208c20252a4549b084d55ed082c3e58f0/stream/src/main/java/com/annimon/stream/IntStream.java#L368-L371 |
VoltDB/voltdb | src/frontend/org/voltdb/NonVoltDBBackend.java | NonVoltDBBackend.isIntegerColumn | private boolean isIntegerColumn(String columnName, List<String> tableNames, boolean debugPrint) {
List<String> intColumnTypes = Arrays.asList("TINYINT", "SMALLINT", "INTEGER", "BIGINT");
return isColumnType(intColumnTypes, columnName, tableNames, debugPrint);
} | java | private boolean isIntegerColumn(String columnName, List<String> tableNames, boolean debugPrint) {
List<String> intColumnTypes = Arrays.asList("TINYINT", "SMALLINT", "INTEGER", "BIGINT");
return isColumnType(intColumnTypes, columnName, tableNames, debugPrint);
} | [
"private",
"boolean",
"isIntegerColumn",
"(",
"String",
"columnName",
",",
"List",
"<",
"String",
">",
"tableNames",
",",
"boolean",
"debugPrint",
")",
"{",
"List",
"<",
"String",
">",
"intColumnTypes",
"=",
"Arrays",
".",
"asList",
"(",
"\"TINYINT\"",
",",
... | Returns true if the <i>columnName</i> is an integer column (including
types TINYINT, SMALLINT, INTEGER, BIGINT, or equivalents in a
comparison, non-VoltDB database); false otherwise. | [
"Returns",
"true",
"if",
"the",
"<i",
">",
"columnName<",
"/",
"i",
">",
"is",
"an",
"integer",
"column",
"(",
"including",
"types",
"TINYINT",
"SMALLINT",
"INTEGER",
"BIGINT",
"or",
"equivalents",
"in",
"a",
"comparison",
"non",
"-",
"VoltDB",
"database",
... | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/NonVoltDBBackend.java#L578-L581 |
js-lib-com/dom | src/main/java/js/dom/w3c/DocumentImpl.java | DocumentImpl.evaluateXPathNode | Element evaluateXPathNode(Node contextNode, String expression, Object... args) {
return evaluateXPathNodeNS(contextNode, null, expression, args);
} | java | Element evaluateXPathNode(Node contextNode, String expression, Object... args) {
return evaluateXPathNodeNS(contextNode, null, expression, args);
} | [
"Element",
"evaluateXPathNode",
"(",
"Node",
"contextNode",
",",
"String",
"expression",
",",
"Object",
"...",
"args",
")",
"{",
"return",
"evaluateXPathNodeNS",
"(",
"contextNode",
",",
"null",
",",
"expression",
",",
"args",
")",
";",
"}"
] | Evaluate XPath expression expecting a single result node.
@param contextNode evaluation context node,
@param expression XPath expression, formatting tags supported,
@param args optional formatting arguments.
@return evaluation result as element, possible null. | [
"Evaluate",
"XPath",
"expression",
"expecting",
"a",
"single",
"result",
"node",
"."
] | train | https://github.com/js-lib-com/dom/blob/8c7cd7c802977f210674dec7c2a8f61e8de05b63/src/main/java/js/dom/w3c/DocumentImpl.java#L287-L289 |
facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/mapred/CoronaJobTracker.java | CoronaJobTracker.saveNewRequestForTip | private void saveNewRequestForTip(TaskInProgress tip, ResourceRequest req) {
requestToTipMap.put(req.getId(), tip);
TaskContext context = taskToContextMap.get(tip);
if (context == null) {
context = new TaskContext(req);
} else {
context.resourceRequests.add(req);
}
taskToContextMap.put(tip, context);
} | java | private void saveNewRequestForTip(TaskInProgress tip, ResourceRequest req) {
requestToTipMap.put(req.getId(), tip);
TaskContext context = taskToContextMap.get(tip);
if (context == null) {
context = new TaskContext(req);
} else {
context.resourceRequests.add(req);
}
taskToContextMap.put(tip, context);
} | [
"private",
"void",
"saveNewRequestForTip",
"(",
"TaskInProgress",
"tip",
",",
"ResourceRequest",
"req",
")",
"{",
"requestToTipMap",
".",
"put",
"(",
"req",
".",
"getId",
"(",
")",
",",
"tip",
")",
";",
"TaskContext",
"context",
"=",
"taskToContextMap",
".",
... | Saves new request for given tip, no recording in resource tracker happens
@param tip task in progress
@param req request | [
"Saves",
"new",
"request",
"for",
"given",
"tip",
"no",
"recording",
"in",
"resource",
"tracker",
"happens"
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/mapred/CoronaJobTracker.java#L2141-L2150 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/VpnSitesInner.java | VpnSitesInner.beginDelete | public void beginDelete(String resourceGroupName, String vpnSiteName) {
beginDeleteWithServiceResponseAsync(resourceGroupName, vpnSiteName).toBlocking().single().body();
} | java | public void beginDelete(String resourceGroupName, String vpnSiteName) {
beginDeleteWithServiceResponseAsync(resourceGroupName, vpnSiteName).toBlocking().single().body();
} | [
"public",
"void",
"beginDelete",
"(",
"String",
"resourceGroupName",
",",
"String",
"vpnSiteName",
")",
"{",
"beginDeleteWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"vpnSiteName",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body"... | Deletes a VpnSite.
@param resourceGroupName The resource group name of the VpnSite.
@param vpnSiteName The name of the VpnSite being deleted.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent | [
"Deletes",
"a",
"VpnSite",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/VpnSitesInner.java#L758-L760 |
VoltDB/voltdb | src/frontend/org/voltdb/CatalogContext.java | CatalogContext.classForProcedureOrUDF | public Class<?> classForProcedureOrUDF(String procedureClassName)
throws LinkageError, ExceptionInInitializerError, ClassNotFoundException {
return classForProcedureOrUDF(procedureClassName, m_catalogInfo.m_jarfile.getLoader());
} | java | public Class<?> classForProcedureOrUDF(String procedureClassName)
throws LinkageError, ExceptionInInitializerError, ClassNotFoundException {
return classForProcedureOrUDF(procedureClassName, m_catalogInfo.m_jarfile.getLoader());
} | [
"public",
"Class",
"<",
"?",
">",
"classForProcedureOrUDF",
"(",
"String",
"procedureClassName",
")",
"throws",
"LinkageError",
",",
"ExceptionInInitializerError",
",",
"ClassNotFoundException",
"{",
"return",
"classForProcedureOrUDF",
"(",
"procedureClassName",
",",
"m_c... | Given a class name in the catalog jar, loads it from the jar, even if the
jar is served from an URL and isn't in the classpath.
@param procedureClassName The name of the class to load.
@return A java Class variable associated with the class.
@throws ClassNotFoundException if the class is not in the jar file. | [
"Given",
"a",
"class",
"name",
"in",
"the",
"catalog",
"jar",
"loads",
"it",
"from",
"the",
"jar",
"even",
"if",
"the",
"jar",
"is",
"served",
"from",
"an",
"URL",
"and",
"isn",
"t",
"in",
"the",
"classpath",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/CatalogContext.java#L384-L387 |
kiegroup/drools | kie-dmn/kie-dmn-feel/src/main/java/org/kie/dmn/feel/codegen/feel11/CompiledFEELSemanticMappings.java | CompiledFEELSemanticMappings.lte | public static Boolean lte(Object left, Object right) {
return or(lt(left, right),
eq(left, right)); // do not use Java || to avoid potential NPE due to FEEL 3vl.
} | java | public static Boolean lte(Object left, Object right) {
return or(lt(left, right),
eq(left, right)); // do not use Java || to avoid potential NPE due to FEEL 3vl.
} | [
"public",
"static",
"Boolean",
"lte",
"(",
"Object",
"left",
",",
"Object",
"right",
")",
"{",
"return",
"or",
"(",
"lt",
"(",
"left",
",",
"right",
")",
",",
"eq",
"(",
"left",
",",
"right",
")",
")",
";",
"// do not use Java || to avoid potential NPE due... | FEEL spec Table 42 and derivations
Delegates to {@link EvalHelper} except evaluationcontext | [
"FEEL",
"spec",
"Table",
"42",
"and",
"derivations",
"Delegates",
"to",
"{"
] | train | https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/kie-dmn/kie-dmn-feel/src/main/java/org/kie/dmn/feel/codegen/feel11/CompiledFEELSemanticMappings.java#L339-L342 |
haifengl/smile | core/src/main/java/smile/validation/Validation.java | Validation.loocv | public static <T> double loocv(RegressionTrainer<T> trainer, T[] x, double[] y, RegressionMeasure measure) {
int n = x.length;
double[] predictions = new double[n];
LOOCV loocv = new LOOCV(n);
for (int i = 0; i < n; i++) {
T[] trainx = Math.slice(x, loocv.train[i]);
double[] trainy = Math.slice(y, loocv.train[i]);
Regression<T> model = trainer.train(trainx, trainy);
predictions[loocv.test[i]] = model.predict(x[loocv.test[i]]);
}
return measure.measure(y, predictions);
} | java | public static <T> double loocv(RegressionTrainer<T> trainer, T[] x, double[] y, RegressionMeasure measure) {
int n = x.length;
double[] predictions = new double[n];
LOOCV loocv = new LOOCV(n);
for (int i = 0; i < n; i++) {
T[] trainx = Math.slice(x, loocv.train[i]);
double[] trainy = Math.slice(y, loocv.train[i]);
Regression<T> model = trainer.train(trainx, trainy);
predictions[loocv.test[i]] = model.predict(x[loocv.test[i]]);
}
return measure.measure(y, predictions);
} | [
"public",
"static",
"<",
"T",
">",
"double",
"loocv",
"(",
"RegressionTrainer",
"<",
"T",
">",
"trainer",
",",
"T",
"[",
"]",
"x",
",",
"double",
"[",
"]",
"y",
",",
"RegressionMeasure",
"measure",
")",
"{",
"int",
"n",
"=",
"x",
".",
"length",
";"... | Leave-one-out cross validation of a regression model.
@param <T> the data type of input objects.
@param trainer a regression model trainer that is properly parameterized.
@param x the test data set.
@param y the test data response values.
@param measure the performance measure of regression.
@return the test results with the same size of order of measures | [
"Leave",
"-",
"one",
"-",
"out",
"cross",
"validation",
"of",
"a",
"regression",
"model",
"."
] | train | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/validation/Validation.java#L283-L298 |
gallandarakhneorg/afc | core/maths/mathgeom/tobeincluded/src/d3/continuous/AbstractSegment3F.java | AbstractSegment3F.computeLineLineIntersectionFactors | @Pure
public static Pair<Double,Double> computeLineLineIntersectionFactors(
double x1, double y1, double z1, double x2, double y2, double z2,
double x3, double y3, double z3, double x4, double y4, double z4) {
//We compute the 4 vectors P1P2, P3P4, P1P3 and P2P4
Vector3f a = new Vector3f(x2 - x1, y2 - y1, z2 - z1);
Vector3f b = new Vector3f(x4 - x3, y4 - y3, z4 - z3);
Vector3f c = new Vector3f(x3 - x1, y3 - y1, z3 - z1);
Vector3D v = a.cross(b);
/*System.out.println("a :"+a.toString());
System.out.println("b :"+b.toString());
System.out.println("c :"+c.toString());
System.out.println("v :"+v.toString());*/
//If the cross product is zero then the two segments are parallels
if (MathUtil.isEpsilonZero(v.lengthSquared())) {
return null;
}
//If the determinant det(c,a,b)=c.(a x b)!=0 then the two segment are not colinears
if (!MathUtil.isEpsilonZero(c.dot(v))) {
return null;
}
double factor1 = FunctionalVector3D.determinant(
c.getX(), c.getY(), c.getZ(),
b.getX(), b.getY(), b.getZ(),
v.getX(), v.getY(), v.getZ()) / v.lengthSquared();
double factor2 = FunctionalVector3D.determinant(
c.getX(), c.getY(), c.getZ(),
a.getX(), a.getY(), a.getZ(),
v.getX(), v.getY(), v.getZ()) / v.lengthSquared();
return new Pair<>(new Double(factor1), new Double(factor2));
} | java | @Pure
public static Pair<Double,Double> computeLineLineIntersectionFactors(
double x1, double y1, double z1, double x2, double y2, double z2,
double x3, double y3, double z3, double x4, double y4, double z4) {
//We compute the 4 vectors P1P2, P3P4, P1P3 and P2P4
Vector3f a = new Vector3f(x2 - x1, y2 - y1, z2 - z1);
Vector3f b = new Vector3f(x4 - x3, y4 - y3, z4 - z3);
Vector3f c = new Vector3f(x3 - x1, y3 - y1, z3 - z1);
Vector3D v = a.cross(b);
/*System.out.println("a :"+a.toString());
System.out.println("b :"+b.toString());
System.out.println("c :"+c.toString());
System.out.println("v :"+v.toString());*/
//If the cross product is zero then the two segments are parallels
if (MathUtil.isEpsilonZero(v.lengthSquared())) {
return null;
}
//If the determinant det(c,a,b)=c.(a x b)!=0 then the two segment are not colinears
if (!MathUtil.isEpsilonZero(c.dot(v))) {
return null;
}
double factor1 = FunctionalVector3D.determinant(
c.getX(), c.getY(), c.getZ(),
b.getX(), b.getY(), b.getZ(),
v.getX(), v.getY(), v.getZ()) / v.lengthSquared();
double factor2 = FunctionalVector3D.determinant(
c.getX(), c.getY(), c.getZ(),
a.getX(), a.getY(), a.getZ(),
v.getX(), v.getY(), v.getZ()) / v.lengthSquared();
return new Pair<>(new Double(factor1), new Double(factor2));
} | [
"@",
"Pure",
"public",
"static",
"Pair",
"<",
"Double",
",",
"Double",
">",
"computeLineLineIntersectionFactors",
"(",
"double",
"x1",
",",
"double",
"y1",
",",
"double",
"z1",
",",
"double",
"x2",
",",
"double",
"y2",
",",
"double",
"z2",
",",
"double",
... | Replies two position factors for the intersection point between two lines.
<p>
Let line equations for L1 and L2:<br>
<code>L1: P1 + factor1 * (P2-P1)</code><br>
<code>L2: P3 + factor2 * (P4-P3)</code><br>
If lines are intersecting, then<br>
<code>P1 + factor1 * (P2-P1) = P3 + factor2 * (P4-P3)</code>
<p>
This function computes and replies <code>factor1</code> and <code>factor2</code>.
@param x1 is the first point of the first line.
@param y1 is the first point of the first line.
@param z1 is the first point of the first line.
@param x2 is the second point of the first line.
@param y2 is the second point of the first line.
@param z2 is the second point of the first line.
@param x3 is the first point of the second line.
@param y3 is the first point of the second line.
@param z3 is the first point of the second line.
@param x4 is the second point of the second line.
@param y4 is the second point of the second line.
@param z4 is the second point of the second line.
@return the tuple (<code>factor1</code>, <code>factor2</code>) or <code>null</code> if no intersection. | [
"Replies",
"two",
"position",
"factors",
"for",
"the",
"intersection",
"point",
"between",
"two",
"lines",
".",
"<p",
">",
"Let",
"line",
"equations",
"for",
"L1",
"and",
"L2",
":",
"<br",
">",
"<code",
">",
"L1",
":",
"P1",
"+",
"factor1",
"*",
"(",
... | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/AbstractSegment3F.java#L380-L418 |
lievendoclo/Valkyrie-RCP | valkyrie-rcp-core/src/main/java/org/valkyriercp/command/config/CommandFaceDescriptor.java | CommandFaceDescriptor.configureIconInfo | public void configureIconInfo(AbstractButton button, boolean useLargeIcons) {
Assert.notNull(button, "button");
if (useLargeIcons) {
largeIconInfo.configure(button);
}
else {
iconInfo.configure(button);
}
} | java | public void configureIconInfo(AbstractButton button, boolean useLargeIcons) {
Assert.notNull(button, "button");
if (useLargeIcons) {
largeIconInfo.configure(button);
}
else {
iconInfo.configure(button);
}
} | [
"public",
"void",
"configureIconInfo",
"(",
"AbstractButton",
"button",
",",
"boolean",
"useLargeIcons",
")",
"{",
"Assert",
".",
"notNull",
"(",
"button",
",",
"\"button\"",
")",
";",
"if",
"(",
"useLargeIcons",
")",
"{",
"largeIconInfo",
".",
"configure",
"(... | Configures the given button with the icon information contained in this descriptor.
@param button The button to be configured. Must not be null.
@param useLargeIcons Set to true to configure the button with large icons. False will use
default size icons.
@throws IllegalArgumentException if {@code button} is null. | [
"Configures",
"the",
"given",
"button",
"with",
"the",
"icon",
"information",
"contained",
"in",
"this",
"descriptor",
"."
] | train | https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/command/config/CommandFaceDescriptor.java#L418-L428 |
aws/aws-sdk-java | aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/datamodeling/DynamoDBScanExpression.java | DynamoDBScanExpression.withFilterConditionEntry | public DynamoDBScanExpression withFilterConditionEntry(String attributeName, Condition condition) {
if ( scanFilter == null )
scanFilter = new HashMap<String, Condition>();
scanFilter.put(attributeName, condition);
return this;
} | java | public DynamoDBScanExpression withFilterConditionEntry(String attributeName, Condition condition) {
if ( scanFilter == null )
scanFilter = new HashMap<String, Condition>();
scanFilter.put(attributeName, condition);
return this;
} | [
"public",
"DynamoDBScanExpression",
"withFilterConditionEntry",
"(",
"String",
"attributeName",
",",
"Condition",
"condition",
")",
"{",
"if",
"(",
"scanFilter",
"==",
"null",
")",
"scanFilter",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Condition",
">",
"(",
"... | Adds a new filter condition to the current scan filter and returns a
pointer to this object for method-chaining.
@param attributeName
The name of the attribute on which the specified condition
operates.
@param condition
The condition which describes how the specified attribute is
compared and if a row of data is included in the results
returned by the scan operation. | [
"Adds",
"a",
"new",
"filter",
"condition",
"to",
"the",
"current",
"scan",
"filter",
"and",
"returns",
"a",
"pointer",
"to",
"this",
"object",
"for",
"method",
"-",
"chaining",
"."
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/datamodeling/DynamoDBScanExpression.java#L272-L278 |
infinispan/infinispan | core/src/main/java/org/infinispan/interceptors/BaseAsyncInterceptor.java | BaseAsyncInterceptor.invokeNext | public final Object invokeNext(InvocationContext ctx, VisitableCommand command) {
try {
if (nextDDInterceptor != null) {
return command.acceptVisitor(ctx, nextDDInterceptor);
} else {
return nextInterceptor.visitCommand(ctx, command);
}
} catch (Throwable throwable) {
return new SimpleAsyncInvocationStage(throwable);
}
} | java | public final Object invokeNext(InvocationContext ctx, VisitableCommand command) {
try {
if (nextDDInterceptor != null) {
return command.acceptVisitor(ctx, nextDDInterceptor);
} else {
return nextInterceptor.visitCommand(ctx, command);
}
} catch (Throwable throwable) {
return new SimpleAsyncInvocationStage(throwable);
}
} | [
"public",
"final",
"Object",
"invokeNext",
"(",
"InvocationContext",
"ctx",
",",
"VisitableCommand",
"command",
")",
"{",
"try",
"{",
"if",
"(",
"nextDDInterceptor",
"!=",
"null",
")",
"{",
"return",
"command",
".",
"acceptVisitor",
"(",
"ctx",
",",
"nextDDInt... | Invoke the next interceptor, possibly with a new command.
<p>Use {@link #invokeNextThenApply(InvocationContext, VisitableCommand, InvocationSuccessFunction)}
or {@link #invokeNextThenAccept(InvocationContext, VisitableCommand, InvocationSuccessAction)} instead
if you need to process the return value of the next interceptor.</p>
<p>Note: {@code invokeNext(ctx, command)} does not throw exceptions. In order to handle exceptions from the
next interceptors, you <em>must</em> use
{@link #invokeNextAndHandle(InvocationContext, VisitableCommand, InvocationFinallyFunction)},
{@link #invokeNextAndFinally(InvocationContext, VisitableCommand, InvocationFinallyAction)},
or {@link #invokeNextAndExceptionally(InvocationContext, VisitableCommand, InvocationExceptionFunction)}.</p> | [
"Invoke",
"the",
"next",
"interceptor",
"possibly",
"with",
"a",
"new",
"command",
"."
] | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/interceptors/BaseAsyncInterceptor.java#L53-L63 |
aspectran/aspectran | core/src/main/java/com/aspectran/core/util/StringUtils.java | StringUtils.toDelimitedString | public static String toDelimitedString(Object[] arr, String delim) {
if (arr == null || arr.length == 0) {
return EMPTY;
}
if (arr.length == 1) {
return (arr[0] == null) ? EMPTY : arr[0].toString();
}
StringBuilder sb = new StringBuilder();
for (int i = 0; i < arr.length; i++) {
if (i > 0) {
sb.append(delim);
}
sb.append(arr[i]);
}
return sb.toString();
} | java | public static String toDelimitedString(Object[] arr, String delim) {
if (arr == null || arr.length == 0) {
return EMPTY;
}
if (arr.length == 1) {
return (arr[0] == null) ? EMPTY : arr[0].toString();
}
StringBuilder sb = new StringBuilder();
for (int i = 0; i < arr.length; i++) {
if (i > 0) {
sb.append(delim);
}
sb.append(arr[i]);
}
return sb.toString();
} | [
"public",
"static",
"String",
"toDelimitedString",
"(",
"Object",
"[",
"]",
"arr",
",",
"String",
"delim",
")",
"{",
"if",
"(",
"arr",
"==",
"null",
"||",
"arr",
".",
"length",
"==",
"0",
")",
"{",
"return",
"EMPTY",
";",
"}",
"if",
"(",
"arr",
"."... | Convert a {@code String} array into a delimited {@code String} (e.g. CSV).
<p>Useful for {@code toString()} implementations.
@param arr the array to display
@param delim the delimiter to use (typically a ",")
@return the delimited {@code String} | [
"Convert",
"a",
"{",
"@code",
"String",
"}",
"array",
"into",
"a",
"delimited",
"{",
"@code",
"String",
"}",
"(",
"e",
".",
"g",
".",
"CSV",
")",
".",
"<p",
">",
"Useful",
"for",
"{",
"@code",
"toString",
"()",
"}",
"implementations",
"."
] | train | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/util/StringUtils.java#L641-L656 |
UrielCh/ovh-java-sdk | ovh-java-sdk-connectivity/src/main/java/net/minidev/ovh/api/ApiOvhConnectivity.java | ApiOvhConnectivity.eligibility_search_buildings_POST | public OvhAsyncTaskArray<OvhBuilding> eligibility_search_buildings_POST(String streetCode, String streetNumber) throws IOException {
String qPath = "/connectivity/eligibility/search/buildings";
StringBuilder sb = path(qPath);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "streetCode", streetCode);
addBody(o, "streetNumber", streetNumber);
String resp = execN(qPath, "POST", sb.toString(), o);
return convertTo(resp, t1);
} | java | public OvhAsyncTaskArray<OvhBuilding> eligibility_search_buildings_POST(String streetCode, String streetNumber) throws IOException {
String qPath = "/connectivity/eligibility/search/buildings";
StringBuilder sb = path(qPath);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "streetCode", streetCode);
addBody(o, "streetNumber", streetNumber);
String resp = execN(qPath, "POST", sb.toString(), o);
return convertTo(resp, t1);
} | [
"public",
"OvhAsyncTaskArray",
"<",
"OvhBuilding",
">",
"eligibility_search_buildings_POST",
"(",
"String",
"streetCode",
",",
"String",
"streetNumber",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/connectivity/eligibility/search/buildings\"",
";",
"String... | Get all buildings for a specific address
REST: POST /connectivity/eligibility/search/buildings
@param streetNumber [required] Street number
@param streetCode [required] Unique identifier of the street (you can get it with POST /connectivity/eligibility/search/streets) | [
"Get",
"all",
"buildings",
"for",
"a",
"specific",
"address"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-connectivity/src/main/java/net/minidev/ovh/api/ApiOvhConnectivity.java#L35-L43 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ExpressRouteLinksInner.java | ExpressRouteLinksInner.listAsync | public Observable<Page<ExpressRouteLinkInner>> listAsync(final String resourceGroupName, final String expressRoutePortName) {
return listWithServiceResponseAsync(resourceGroupName, expressRoutePortName)
.map(new Func1<ServiceResponse<Page<ExpressRouteLinkInner>>, Page<ExpressRouteLinkInner>>() {
@Override
public Page<ExpressRouteLinkInner> call(ServiceResponse<Page<ExpressRouteLinkInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<ExpressRouteLinkInner>> listAsync(final String resourceGroupName, final String expressRoutePortName) {
return listWithServiceResponseAsync(resourceGroupName, expressRoutePortName)
.map(new Func1<ServiceResponse<Page<ExpressRouteLinkInner>>, Page<ExpressRouteLinkInner>>() {
@Override
public Page<ExpressRouteLinkInner> call(ServiceResponse<Page<ExpressRouteLinkInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"ExpressRouteLinkInner",
">",
">",
"listAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"expressRoutePortName",
")",
"{",
"return",
"listWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"e... | Retrieve the ExpressRouteLink sub-resources of the specified ExpressRoutePort resource.
@param resourceGroupName The name of the resource group.
@param expressRoutePortName The name of the ExpressRoutePort resource.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<ExpressRouteLinkInner> object | [
"Retrieve",
"the",
"ExpressRouteLink",
"sub",
"-",
"resources",
"of",
"the",
"specified",
"ExpressRoutePort",
"resource",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ExpressRouteLinksInner.java#L214-L222 |
IBM/ibm-cos-sdk-java | ibm-cos-java-sdk-kms/src/main/java/com/ibm/cloud/objectstorage/services/kms/model/EncryptRequest.java | EncryptRequest.getGrantTokens | public java.util.List<String> getGrantTokens() {
if (grantTokens == null) {
grantTokens = new com.ibm.cloud.objectstorage.internal.SdkInternalList<String>();
}
return grantTokens;
} | java | public java.util.List<String> getGrantTokens() {
if (grantTokens == null) {
grantTokens = new com.ibm.cloud.objectstorage.internal.SdkInternalList<String>();
}
return grantTokens;
} | [
"public",
"java",
".",
"util",
".",
"List",
"<",
"String",
">",
"getGrantTokens",
"(",
")",
"{",
"if",
"(",
"grantTokens",
"==",
"null",
")",
"{",
"grantTokens",
"=",
"new",
"com",
".",
"ibm",
".",
"cloud",
".",
"objectstorage",
".",
"internal",
".",
... | <p>
A list of grant tokens.
</p>
<p>
For more information, see <a
href="http://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#grant_token">Grant Tokens</a> in the
<i>AWS Key Management Service Developer Guide</i>.
</p>
@return A list of grant tokens.</p>
<p>
For more information, see <a
href="http://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#grant_token">Grant Tokens</a> in
the <i>AWS Key Management Service Developer Guide</i>. | [
"<p",
">",
"A",
"list",
"of",
"grant",
"tokens",
".",
"<",
"/",
"p",
">",
"<p",
">",
"For",
"more",
"information",
"see",
"<a",
"href",
"=",
"http",
":",
"//",
"docs",
".",
"aws",
".",
"amazon",
".",
"com",
"/",
"kms",
"/",
"latest",
"/",
"deve... | train | https://github.com/IBM/ibm-cos-sdk-java/blob/d0bb2dd754c328a05e7dba8dc42e28b271b6daf2/ibm-cos-java-sdk-kms/src/main/java/com/ibm/cloud/objectstorage/services/kms/model/EncryptRequest.java#L423-L428 |
ajoberstar/gradle-git | src/main/groovy/org/ajoberstar/gradle/git/auth/BasicPasswordCredentials.java | BasicPasswordCredentials.toGrgit | public Credentials toGrgit() {
if (username != null && password != null) {
return new Credentials(username, password);
} else {
return null;
}
} | java | public Credentials toGrgit() {
if (username != null && password != null) {
return new Credentials(username, password);
} else {
return null;
}
} | [
"public",
"Credentials",
"toGrgit",
"(",
")",
"{",
"if",
"(",
"username",
"!=",
"null",
"&&",
"password",
"!=",
"null",
")",
"{",
"return",
"new",
"Credentials",
"(",
"username",
",",
"password",
")",
";",
"}",
"else",
"{",
"return",
"null",
";",
"}",
... | Converts to credentials for use in Grgit.
@return {@code null} if both username and password are {@code null},
otherwise returns credentials in Grgit format. | [
"Converts",
"to",
"credentials",
"for",
"use",
"in",
"Grgit",
"."
] | train | https://github.com/ajoberstar/gradle-git/blob/03b08b9f8dd2b2ff0ee9228906a6e9781b85ec79/src/main/groovy/org/ajoberstar/gradle/git/auth/BasicPasswordCredentials.java#L87-L93 |
PinaeOS/nala | src/main/java/org/pinae/nala/xb/marshal/parser/ListParser.java | ListParser.parse | @SuppressWarnings("rawtypes")
public NodeConfig parse(String nodeName, List list) throws MarshalException {
NodeConfig nodeConfig = new NodeConfig();
List<NodeConfig> nodeConfigList = new ArrayList<NodeConfig>();
if (list != null) {
for (Object item : list) {
nodeConfigList.add(super.parse(nodeName, item));
}
}
nodeConfig.setName(nodeName);
nodeConfig.setChildrenNodes(nodeConfigList);
return nodeConfig;
} | java | @SuppressWarnings("rawtypes")
public NodeConfig parse(String nodeName, List list) throws MarshalException {
NodeConfig nodeConfig = new NodeConfig();
List<NodeConfig> nodeConfigList = new ArrayList<NodeConfig>();
if (list != null) {
for (Object item : list) {
nodeConfigList.add(super.parse(nodeName, item));
}
}
nodeConfig.setName(nodeName);
nodeConfig.setChildrenNodes(nodeConfigList);
return nodeConfig;
} | [
"@",
"SuppressWarnings",
"(",
"\"rawtypes\"",
")",
"public",
"NodeConfig",
"parse",
"(",
"String",
"nodeName",
",",
"List",
"list",
")",
"throws",
"MarshalException",
"{",
"NodeConfig",
"nodeConfig",
"=",
"new",
"NodeConfig",
"(",
")",
";",
"List",
"<",
"NodeC... | 采用循环的方式, 通过List解析生成NodeConfig格式
@param nodeName 根节点名称
@param list 需要解析的List对象
@return 解析后的NodeConfig格式
@throws MarshalException 编组异常 | [
"采用循环的方式",
"通过List解析生成NodeConfig格式"
] | train | https://github.com/PinaeOS/nala/blob/2047ade4af197cec938278d300d111ea94af6fbf/src/main/java/org/pinae/nala/xb/marshal/parser/ListParser.java#L28-L41 |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/interest/SiftDetector.java | SiftDetector.isScaleSpaceExtremum | boolean isScaleSpaceExtremum(int c_x, int c_y, float value, float signAdj) {
if( c_x <= 1 || c_y <= 1 || c_x >= dogLower.width-1 || c_y >= dogLower.height-1)
return false;
float v;
value *= signAdj;
for( int y = -1; y <= 1; y++ ) {
for( int x = -1; x <= 1; x++ ) {
v = dogLower.unsafe_get(c_x+x,c_y+y);
if( v*signAdj >= value )
return false;
v = dogUpper.unsafe_get(c_x+x,c_y+y);
if( v*signAdj >= value )
return false;
}
}
return true;
} | java | boolean isScaleSpaceExtremum(int c_x, int c_y, float value, float signAdj) {
if( c_x <= 1 || c_y <= 1 || c_x >= dogLower.width-1 || c_y >= dogLower.height-1)
return false;
float v;
value *= signAdj;
for( int y = -1; y <= 1; y++ ) {
for( int x = -1; x <= 1; x++ ) {
v = dogLower.unsafe_get(c_x+x,c_y+y);
if( v*signAdj >= value )
return false;
v = dogUpper.unsafe_get(c_x+x,c_y+y);
if( v*signAdj >= value )
return false;
}
}
return true;
} | [
"boolean",
"isScaleSpaceExtremum",
"(",
"int",
"c_x",
",",
"int",
"c_y",
",",
"float",
"value",
",",
"float",
"signAdj",
")",
"{",
"if",
"(",
"c_x",
"<=",
"1",
"||",
"c_y",
"<=",
"1",
"||",
"c_x",
">=",
"dogLower",
".",
"width",
"-",
"1",
"||",
"c_... | See if the point is a local extremum in scale-space above and below.
@param c_x x-coordinate of extremum
@param c_y y-coordinate of extremum
@param value The maximum value it is checking
@param signAdj Adjust the sign so that it can check for maximums
@return true if its a local extremum | [
"See",
"if",
"the",
"point",
"is",
"a",
"local",
"extremum",
"in",
"scale",
"-",
"space",
"above",
"and",
"below",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/interest/SiftDetector.java#L229-L249 |
FXMisc/RichTextFX | richtextfx/src/main/java/org/fxmisc/richtext/util/UndoUtils.java | UndoUtils.plainTextUndoManager | public static <PS, SEG, S> UndoManager<List<PlainTextChange>> plainTextUndoManager(
GenericStyledArea<PS, SEG, S> area, Duration preventMergeDelay) {
return plainTextUndoManager(area, UndoManagerFactory.unlimitedHistoryFactory(), preventMergeDelay);
} | java | public static <PS, SEG, S> UndoManager<List<PlainTextChange>> plainTextUndoManager(
GenericStyledArea<PS, SEG, S> area, Duration preventMergeDelay) {
return plainTextUndoManager(area, UndoManagerFactory.unlimitedHistoryFactory(), preventMergeDelay);
} | [
"public",
"static",
"<",
"PS",
",",
"SEG",
",",
"S",
">",
"UndoManager",
"<",
"List",
"<",
"PlainTextChange",
">",
">",
"plainTextUndoManager",
"(",
"GenericStyledArea",
"<",
"PS",
",",
"SEG",
",",
"S",
">",
"area",
",",
"Duration",
"preventMergeDelay",
")... | Returns an UndoManager that can undo/redo {@link PlainTextChange}s. New changes
emitted from the stream will not be merged with the previous change
after {@code preventMergeDelay} | [
"Returns",
"an",
"UndoManager",
"that",
"can",
"undo",
"/",
"redo",
"{"
] | train | https://github.com/FXMisc/RichTextFX/blob/bc7cab6a637855e0f37d9b9c12a9172c31545f0b/richtextfx/src/main/java/org/fxmisc/richtext/util/UndoUtils.java#L106-L109 |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Spies.java | Spies.spy1st | public static <T1, T2, T3, R> TriFunction<T1, T2, T3, R> spy1st(TriFunction<T1, T2, T3, R> function, Box<T1> param1) {
return spy(function, Box.<R>empty(), param1, Box.<T2>empty(), Box.<T3>empty());
} | java | public static <T1, T2, T3, R> TriFunction<T1, T2, T3, R> spy1st(TriFunction<T1, T2, T3, R> function, Box<T1> param1) {
return spy(function, Box.<R>empty(), param1, Box.<T2>empty(), Box.<T3>empty());
} | [
"public",
"static",
"<",
"T1",
",",
"T2",
",",
"T3",
",",
"R",
">",
"TriFunction",
"<",
"T1",
",",
"T2",
",",
"T3",
",",
"R",
">",
"spy1st",
"(",
"TriFunction",
"<",
"T1",
",",
"T2",
",",
"T3",
",",
"R",
">",
"function",
",",
"Box",
"<",
"T1"... | Proxies a ternary function spying for first parameter.
@param <R> the function result type
@param <T1> the function first parameter type
@param <T2> the function second parameter type
@param <T3> the function third parameter type
@param function the function that will be spied
@param param1 a box that will be containing the first spied parameter
@return the proxied function | [
"Proxies",
"a",
"ternary",
"function",
"spying",
"for",
"first",
"parameter",
"."
] | train | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Spies.java#L209-L211 |
inferred/FreeBuilder | src/main/java/org/inferred/freebuilder/processor/model/ModelUtils.java | ModelUtils.getReturnType | public static TypeMirror getReturnType(TypeElement type, ExecutableElement method, Types types) {
try {
ExecutableType executableType = (ExecutableType)
types.asMemberOf((DeclaredType) type.asType(), method);
return executableType.getReturnType();
} catch (IllegalArgumentException e) {
// Eclipse incorrectly throws an IllegalArgumentException here:
// "element is not valid for the containing declared type"
// As a workaround for the common case, fall back to the declared return type.
return method.getReturnType();
}
} | java | public static TypeMirror getReturnType(TypeElement type, ExecutableElement method, Types types) {
try {
ExecutableType executableType = (ExecutableType)
types.asMemberOf((DeclaredType) type.asType(), method);
return executableType.getReturnType();
} catch (IllegalArgumentException e) {
// Eclipse incorrectly throws an IllegalArgumentException here:
// "element is not valid for the containing declared type"
// As a workaround for the common case, fall back to the declared return type.
return method.getReturnType();
}
} | [
"public",
"static",
"TypeMirror",
"getReturnType",
"(",
"TypeElement",
"type",
",",
"ExecutableElement",
"method",
",",
"Types",
"types",
")",
"{",
"try",
"{",
"ExecutableType",
"executableType",
"=",
"(",
"ExecutableType",
")",
"types",
".",
"asMemberOf",
"(",
... | Determines the return type of {@code method}, if called on an instance of type {@code type}.
<p>For instance, in this example, myY.getProperty() returns List<T>, not T:<pre><code>
interface X<T> {
T getProperty();
}
@FreeBuilder interface Y<T> extends X<List<T>> { }</code></pre>
<p>(Unfortunately, a bug in Eclipse prevents us handling these cases correctly at the moment.
javac works fine.) | [
"Determines",
"the",
"return",
"type",
"of",
"{",
"@code",
"method",
"}",
"if",
"called",
"on",
"an",
"instance",
"of",
"type",
"{",
"@code",
"type",
"}",
"."
] | train | https://github.com/inferred/FreeBuilder/blob/d5a222f90648aece135da4b971c55a60afe8649c/src/main/java/org/inferred/freebuilder/processor/model/ModelUtils.java#L300-L311 |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/io/grasslegacy/OmsGrassLegacyReader.java | OmsGrassLegacyReader.getValueAt | public static double getValueAt( Window window, Coordinate coordinate, String filePath, IHMProgressMonitor pm )
throws Exception {
JGrassMapEnvironment mapEnvironment = new JGrassMapEnvironment(new File(filePath));
if (window == null) {
JGrassRegion jgr = mapEnvironment.getActiveRegion();
window = new Window(jgr.getWest(), jgr.getEast(), jgr.getSouth(), jgr.getNorth(), jgr.getWEResolution(),
jgr.getNSResolution());
}
Window rectangleAroundPoint = GrassLegacyUtilities.getRectangleAroundPoint(window, coordinate.x, coordinate.y);
OmsGrassLegacyReader reader = new OmsGrassLegacyReader();
reader.file = filePath;
reader.inWindow = rectangleAroundPoint;
if (pm != null)
reader.pm = pm;
reader.readCoverage();
double[][] data = reader.geodata;
if (data.length != 1 || data[0].length != 1) {
throw new IllegalAccessException("Wrong region extracted for picking a single point.");
}
return data[0][0];
} | java | public static double getValueAt( Window window, Coordinate coordinate, String filePath, IHMProgressMonitor pm )
throws Exception {
JGrassMapEnvironment mapEnvironment = new JGrassMapEnvironment(new File(filePath));
if (window == null) {
JGrassRegion jgr = mapEnvironment.getActiveRegion();
window = new Window(jgr.getWest(), jgr.getEast(), jgr.getSouth(), jgr.getNorth(), jgr.getWEResolution(),
jgr.getNSResolution());
}
Window rectangleAroundPoint = GrassLegacyUtilities.getRectangleAroundPoint(window, coordinate.x, coordinate.y);
OmsGrassLegacyReader reader = new OmsGrassLegacyReader();
reader.file = filePath;
reader.inWindow = rectangleAroundPoint;
if (pm != null)
reader.pm = pm;
reader.readCoverage();
double[][] data = reader.geodata;
if (data.length != 1 || data[0].length != 1) {
throw new IllegalAccessException("Wrong region extracted for picking a single point.");
}
return data[0][0];
} | [
"public",
"static",
"double",
"getValueAt",
"(",
"Window",
"window",
",",
"Coordinate",
"coordinate",
",",
"String",
"filePath",
",",
"IHMProgressMonitor",
"pm",
")",
"throws",
"Exception",
"{",
"JGrassMapEnvironment",
"mapEnvironment",
"=",
"new",
"JGrassMapEnvironme... | Get a single value in a position of the raster.
<p>This opens and closes the raster every time it is called. Bad performance on many calls.
@param window the grid on which to base on (if <code>null</code>, the active region is picked).
@param coordinate the coordinate in which the value is read.
@param filePath the path to the map.
@param pm the progress monitor or null.
@return the value read in the given coordinate.
@throws Exception | [
"Get",
"a",
"single",
"value",
"in",
"a",
"position",
"of",
"the",
"raster",
"."
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/grasslegacy/OmsGrassLegacyReader.java#L164-L187 |
gmessner/gitlab4j-api | src/main/java/org/gitlab4j/api/UserApi.java | UserApi.createImpersonationToken | public ImpersonationToken createImpersonationToken(Object userIdOrUsername, String name, Date expiresAt, Scope[] scopes) throws GitLabApiException {
if (scopes == null || scopes.length == 0) {
throw new RuntimeException("scopes cannot be null or empty");
}
GitLabApiForm formData = new GitLabApiForm()
.withParam("name", name, true)
.withParam("expires_at", expiresAt);
for (Scope scope : scopes) {
formData.withParam("scopes[]", scope.toString());
}
Response response = post(Response.Status.CREATED, formData, "users", getUserIdOrUsername(userIdOrUsername), "impersonation_tokens");
return (response.readEntity(ImpersonationToken.class));
} | java | public ImpersonationToken createImpersonationToken(Object userIdOrUsername, String name, Date expiresAt, Scope[] scopes) throws GitLabApiException {
if (scopes == null || scopes.length == 0) {
throw new RuntimeException("scopes cannot be null or empty");
}
GitLabApiForm formData = new GitLabApiForm()
.withParam("name", name, true)
.withParam("expires_at", expiresAt);
for (Scope scope : scopes) {
formData.withParam("scopes[]", scope.toString());
}
Response response = post(Response.Status.CREATED, formData, "users", getUserIdOrUsername(userIdOrUsername), "impersonation_tokens");
return (response.readEntity(ImpersonationToken.class));
} | [
"public",
"ImpersonationToken",
"createImpersonationToken",
"(",
"Object",
"userIdOrUsername",
",",
"String",
"name",
",",
"Date",
"expiresAt",
",",
"Scope",
"[",
"]",
"scopes",
")",
"throws",
"GitLabApiException",
"{",
"if",
"(",
"scopes",
"==",
"null",
"||",
"... | Create an impersonation token. Available only for admin users.
<pre><code>GitLab Endpoint: POST /users/:user_id/impersonation_tokens</code></pre>
@param userIdOrUsername the user in the form of an Integer(ID), String(username), or User instance
@param name the name of the impersonation token, required
@param expiresAt the expiration date of the impersonation token, optional
@param scopes an array of scopes of the impersonation token
@return the created ImpersonationToken instance
@throws GitLabApiException if any exception occurs | [
"Create",
"an",
"impersonation",
"token",
".",
"Available",
"only",
"for",
"admin",
"users",
"."
] | train | https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/UserApi.java#L807-L823 |
sannies/mp4parser | isoparser/src/main/java/org/mp4parser/boxes/microsoft/XtraBox.java | XtraBox.setTagValues | public void setTagValues(String name, String values[]) {
removeTag(name);
XtraTag tag = new XtraTag(name);
for (int i = 0; i < values.length; i++) {
tag.values.addElement(new XtraValue(values[i]));
}
tags.addElement(tag);
} | java | public void setTagValues(String name, String values[]) {
removeTag(name);
XtraTag tag = new XtraTag(name);
for (int i = 0; i < values.length; i++) {
tag.values.addElement(new XtraValue(values[i]));
}
tags.addElement(tag);
} | [
"public",
"void",
"setTagValues",
"(",
"String",
"name",
",",
"String",
"values",
"[",
"]",
")",
"{",
"removeTag",
"(",
"name",
")",
";",
"XtraTag",
"tag",
"=",
"new",
"XtraTag",
"(",
"name",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
... | Removes and recreates tag using specified String values
@param name Tag name to replace
@param values New String values | [
"Removes",
"and",
"recreates",
"tag",
"using",
"specified",
"String",
"values"
] | train | https://github.com/sannies/mp4parser/blob/3382ff5d489363900f352a8da0f794a20ad3b063/isoparser/src/main/java/org/mp4parser/boxes/microsoft/XtraBox.java#L291-L298 |
RestComm/sipunit | src/main/java/org/cafesip/sipunit/PresenceNotifySender.java | PresenceNotifySender.sendNotify | public boolean sendNotify(Request req, boolean viaProxy) {
setErrorMessage("");
synchronized (dialogLock) {
if (dialog == null) {
setErrorMessage("Can't send notify, haven't received a request");
return false;
}
try {
phone.addAuthorizations(((CallIdHeader) req.getHeader(CallIdHeader.NAME)).getCallId(), req);
SipTransaction transaction = phone.sendRequestWithTransaction(req, viaProxy, dialog, this);
if (transaction == null) {
setErrorMessage(phone.getErrorMessage());
return false;
}
setLastSentNotify(req);
LOG.trace("Sent NOTIFY to {}:\n{}", dialog.getRemoteParty().getURI(), req);
return true;
} catch (Exception e) {
setErrorMessage(e.getClass().getName() + ": " + e.getMessage());
}
}
return false;
} | java | public boolean sendNotify(Request req, boolean viaProxy) {
setErrorMessage("");
synchronized (dialogLock) {
if (dialog == null) {
setErrorMessage("Can't send notify, haven't received a request");
return false;
}
try {
phone.addAuthorizations(((CallIdHeader) req.getHeader(CallIdHeader.NAME)).getCallId(), req);
SipTransaction transaction = phone.sendRequestWithTransaction(req, viaProxy, dialog, this);
if (transaction == null) {
setErrorMessage(phone.getErrorMessage());
return false;
}
setLastSentNotify(req);
LOG.trace("Sent NOTIFY to {}:\n{}", dialog.getRemoteParty().getURI(), req);
return true;
} catch (Exception e) {
setErrorMessage(e.getClass().getName() + ": " + e.getMessage());
}
}
return false;
} | [
"public",
"boolean",
"sendNotify",
"(",
"Request",
"req",
",",
"boolean",
"viaProxy",
")",
"{",
"setErrorMessage",
"(",
"\"\"",
")",
";",
"synchronized",
"(",
"dialogLock",
")",
"{",
"if",
"(",
"dialog",
"==",
"null",
")",
"{",
"setErrorMessage",
"(",
"\"C... | This method sends the given request to the subscriber. Knowledge of JAIN-SIP API headers is
required. The request will be resent if challenged. Use this method only if you have previously
called processSubscribe(). Use this method if you don't care about checking the response to the
sent NOTIFY, otherwise use sendStatefulNotify().
@param req javax.sip.message.Request to send.
@param viaProxy If true, send the message to the proxy. In this case a Route header will be
added. Else send the message as is.
@return true if successful, false otherwise (call getErrorMessage() for details). | [
"This",
"method",
"sends",
"the",
"given",
"request",
"to",
"the",
"subscriber",
".",
"Knowledge",
"of",
"JAIN",
"-",
"SIP",
"API",
"headers",
"is",
"required",
".",
"The",
"request",
"will",
"be",
"resent",
"if",
"challenged",
".",
"Use",
"this",
"method"... | train | https://github.com/RestComm/sipunit/blob/18a6be2e29be3fbdc14226e8c41b25e2d57378b1/src/main/java/org/cafesip/sipunit/PresenceNotifySender.java#L556-L586 |
openbase/jul | visual/javafx/src/main/java/org/openbase/jul/visual/javafx/fxml/FXMLProcessor.java | FXMLProcessor.loadFxmlPane | public static Pane loadFxmlPane(final String fxmlFileUri, final Class clazz) throws CouldNotPerformException {
return loadFxmlPaneAndControllerPair(fxmlFileUri, clazz, DEFAULT_CONTROLLER_FACTORY).getKey();
} | java | public static Pane loadFxmlPane(final String fxmlFileUri, final Class clazz) throws CouldNotPerformException {
return loadFxmlPaneAndControllerPair(fxmlFileUri, clazz, DEFAULT_CONTROLLER_FACTORY).getKey();
} | [
"public",
"static",
"Pane",
"loadFxmlPane",
"(",
"final",
"String",
"fxmlFileUri",
",",
"final",
"Class",
"clazz",
")",
"throws",
"CouldNotPerformException",
"{",
"return",
"loadFxmlPaneAndControllerPair",
"(",
"fxmlFileUri",
",",
"clazz",
",",
"DEFAULT_CONTROLLER_FACTO... | Method load the pane of the given fxml file.
@param fxmlFileUri the uri pointing to the fxml file within the classpath.
@param clazz the responsible class which is used for class path resolution.
@return the new pane.
@throws CouldNotPerformException is thrown if something went wrong like for example the fxml file does not exist. | [
"Method",
"load",
"the",
"pane",
"of",
"the",
"given",
"fxml",
"file",
"."
] | train | https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/visual/javafx/src/main/java/org/openbase/jul/visual/javafx/fxml/FXMLProcessor.java#L107-L109 |
KostyaSha/yet-another-docker-plugin | yet-another-docker-plugin/src/main/java/com/github/kostyasha/yad/utils/HostAndPortChecker.java | HostAndPortChecker.withEveryRetryWaitFor | public boolean withEveryRetryWaitFor(int time, TimeUnit units) {
for (int i = 1; i <= retries; i++) {
if (openSocket()) {
return true;
}
sleepFor(time, units);
}
return false;
} | java | public boolean withEveryRetryWaitFor(int time, TimeUnit units) {
for (int i = 1; i <= retries; i++) {
if (openSocket()) {
return true;
}
sleepFor(time, units);
}
return false;
} | [
"public",
"boolean",
"withEveryRetryWaitFor",
"(",
"int",
"time",
",",
"TimeUnit",
"units",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"1",
";",
"i",
"<=",
"retries",
";",
"i",
"++",
")",
"{",
"if",
"(",
"openSocket",
"(",
")",
")",
"{",
"return",
"tru... | Use {@link #openSocket()} to check.
Retries while attempts reached with delay
@return true if socket opened successfully, false otherwise | [
"Use",
"{",
"@link",
"#openSocket",
"()",
"}",
"to",
"check",
".",
"Retries",
"while",
"attempts",
"reached",
"with",
"delay"
] | train | https://github.com/KostyaSha/yet-another-docker-plugin/blob/40b12e39ff94c3834cff7e028c3dd01c88e87d77/yet-another-docker-plugin/src/main/java/com/github/kostyasha/yad/utils/HostAndPortChecker.java#L66-L74 |
michael-rapp/AndroidUtil | library/src/main/java/de/mrapp/android/util/AppUtil.java | AppUtil.startDialer | public static void startDialer(@NonNull final Context context, final int phoneNumber) {
startDialer(context, Integer.toString(phoneNumber));
} | java | public static void startDialer(@NonNull final Context context, final int phoneNumber) {
startDialer(context, Integer.toString(phoneNumber));
} | [
"public",
"static",
"void",
"startDialer",
"(",
"@",
"NonNull",
"final",
"Context",
"context",
",",
"final",
"int",
"phoneNumber",
")",
"{",
"startDialer",
"(",
"context",
",",
"Integer",
".",
"toString",
"(",
"phoneNumber",
")",
")",
";",
"}"
] | Starts the dialer in order to call a specific phone number. The call has to be manually
started by the user. If an error occurs while starting the dialer, an {@link
ActivityNotFoundException} will be thrown.
@param context
The context, the dialer should be started from, as an instance of the class {@link
Context}. The context may not be null
@param phoneNumber
The phone number, which should be dialed, as an {@link Integer} value | [
"Starts",
"the",
"dialer",
"in",
"order",
"to",
"call",
"a",
"specific",
"phone",
"number",
".",
"The",
"call",
"has",
"to",
"be",
"manually",
"started",
"by",
"the",
"user",
".",
"If",
"an",
"error",
"occurs",
"while",
"starting",
"the",
"dialer",
"an",... | train | https://github.com/michael-rapp/AndroidUtil/blob/67ec0e5732344eeb4d946dd1f96d782939e449f4/library/src/main/java/de/mrapp/android/util/AppUtil.java#L321-L323 |
joniles/mpxj | src/main/java/net/sf/mpxj/ResourceAssignment.java | ResourceAssignment.fireFieldChangeEvent | private void fireFieldChangeEvent(AssignmentField field, Object oldValue, Object newValue)
{
//
// Internal event handling
//
switch (field)
{
case START:
case BASELINE_START:
{
m_array[AssignmentField.START_VARIANCE.getValue()] = null;
break;
}
case FINISH:
case BASELINE_FINISH:
{
m_array[AssignmentField.FINISH_VARIANCE.getValue()] = null;
break;
}
case BCWP:
case ACWP:
{
m_array[AssignmentField.CV.getValue()] = null;
m_array[AssignmentField.SV.getValue()] = null;
break;
}
case COST:
case BASELINE_COST:
{
m_array[AssignmentField.COST_VARIANCE.getValue()] = null;
break;
}
case WORK:
case BASELINE_WORK:
{
m_array[AssignmentField.WORK_VARIANCE.getValue()] = null;
break;
}
case ACTUAL_OVERTIME_COST:
case REMAINING_OVERTIME_COST:
{
m_array[AssignmentField.OVERTIME_COST.getValue()] = null;
break;
}
default:
{
break;
}
}
//
// External event handling
//
if (m_listeners != null)
{
for (FieldListener listener : m_listeners)
{
listener.fieldChange(this, field, oldValue, newValue);
}
}
} | java | private void fireFieldChangeEvent(AssignmentField field, Object oldValue, Object newValue)
{
//
// Internal event handling
//
switch (field)
{
case START:
case BASELINE_START:
{
m_array[AssignmentField.START_VARIANCE.getValue()] = null;
break;
}
case FINISH:
case BASELINE_FINISH:
{
m_array[AssignmentField.FINISH_VARIANCE.getValue()] = null;
break;
}
case BCWP:
case ACWP:
{
m_array[AssignmentField.CV.getValue()] = null;
m_array[AssignmentField.SV.getValue()] = null;
break;
}
case COST:
case BASELINE_COST:
{
m_array[AssignmentField.COST_VARIANCE.getValue()] = null;
break;
}
case WORK:
case BASELINE_WORK:
{
m_array[AssignmentField.WORK_VARIANCE.getValue()] = null;
break;
}
case ACTUAL_OVERTIME_COST:
case REMAINING_OVERTIME_COST:
{
m_array[AssignmentField.OVERTIME_COST.getValue()] = null;
break;
}
default:
{
break;
}
}
//
// External event handling
//
if (m_listeners != null)
{
for (FieldListener listener : m_listeners)
{
listener.fieldChange(this, field, oldValue, newValue);
}
}
} | [
"private",
"void",
"fireFieldChangeEvent",
"(",
"AssignmentField",
"field",
",",
"Object",
"oldValue",
",",
"Object",
"newValue",
")",
"{",
"//",
"// Internal event handling",
"//",
"switch",
"(",
"field",
")",
"{",
"case",
"START",
":",
"case",
"BASELINE_START",
... | Handle the change in a field value. Reset any cached calculated
values affected by this change, pass on the event to any external
listeners.
@param field field changed
@param oldValue old field value
@param newValue new field value | [
"Handle",
"the",
"change",
"in",
"a",
"field",
"value",
".",
"Reset",
"any",
"cached",
"calculated",
"values",
"affected",
"by",
"this",
"change",
"pass",
"on",
"the",
"event",
"to",
"any",
"external",
"listeners",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ResourceAssignment.java#L2736-L2802 |
jeremylong/DependencyCheck | core/src/main/java/org/owasp/dependencycheck/utils/ExtractionUtil.java | ExtractionUtil.extractFilesUsingFilter | public static void extractFilesUsingFilter(File archive, File destination, FilenameFilter filter) throws ExtractionException {
if (archive == null || destination == null) {
return;
}
try (FileInputStream fis = new FileInputStream(archive)) {
extractArchive(new ZipArchiveInputStream(new BufferedInputStream(fis)), destination, filter);
} catch (FileNotFoundException ex) {
final String msg = String.format("Error extracting file `%s` with filter: %s", archive.getAbsolutePath(), ex.getMessage());
LOGGER.debug(msg, ex);
throw new ExtractionException(msg);
} catch (IOException | ArchiveExtractionException ex) {
LOGGER.warn("Exception extracting archive '{}'.", archive.getAbsolutePath());
LOGGER.debug("", ex);
throw new ExtractionException("Unable to extract from archive", ex);
}
} | java | public static void extractFilesUsingFilter(File archive, File destination, FilenameFilter filter) throws ExtractionException {
if (archive == null || destination == null) {
return;
}
try (FileInputStream fis = new FileInputStream(archive)) {
extractArchive(new ZipArchiveInputStream(new BufferedInputStream(fis)), destination, filter);
} catch (FileNotFoundException ex) {
final String msg = String.format("Error extracting file `%s` with filter: %s", archive.getAbsolutePath(), ex.getMessage());
LOGGER.debug(msg, ex);
throw new ExtractionException(msg);
} catch (IOException | ArchiveExtractionException ex) {
LOGGER.warn("Exception extracting archive '{}'.", archive.getAbsolutePath());
LOGGER.debug("", ex);
throw new ExtractionException("Unable to extract from archive", ex);
}
} | [
"public",
"static",
"void",
"extractFilesUsingFilter",
"(",
"File",
"archive",
",",
"File",
"destination",
",",
"FilenameFilter",
"filter",
")",
"throws",
"ExtractionException",
"{",
"if",
"(",
"archive",
"==",
"null",
"||",
"destination",
"==",
"null",
")",
"{"... | Extracts the contents of an archive into the specified directory.
@param archive an archive file such as a WAR or EAR
@param destination a directory to extract the contents to
@param filter determines which files get extracted
@throws ExtractionException thrown if the archive is not found | [
"Extracts",
"the",
"contents",
"of",
"an",
"archive",
"into",
"the",
"specified",
"directory",
"."
] | train | https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/utils/ExtractionUtil.java#L208-L224 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/PdfSignatureAppearance.java | PdfSignatureAppearance.setVisibleSignature | public void setVisibleSignature(String fieldName) {
AcroFields af = writer.getAcroFields();
AcroFields.Item item = af.getFieldItem(fieldName);
if (item == null)
throw new IllegalArgumentException("The field " + fieldName + " does not exist.");
PdfDictionary merged = item.getMerged(0);
if (!PdfName.SIG.equals(PdfReader.getPdfObject(merged.get(PdfName.FT))))
throw new IllegalArgumentException("The field " + fieldName + " is not a signature field.");
this.fieldName = fieldName;
PdfArray r = merged.getAsArray(PdfName.RECT);
float llx = r.getAsNumber(0).floatValue();
float lly = r.getAsNumber(1).floatValue();
float urx = r.getAsNumber(2).floatValue();
float ury = r.getAsNumber(3).floatValue();
pageRect = new Rectangle(llx, lly, urx, ury);
pageRect.normalize();
page = item.getPage(0).intValue();
int rotation = writer.reader.getPageRotation(page);
Rectangle pageSize = writer.reader.getPageSizeWithRotation(page);
switch (rotation) {
case 90:
pageRect = new Rectangle(
pageRect.getBottom(),
pageSize.getTop() - pageRect.getLeft(),
pageRect.getTop(),
pageSize.getTop() - pageRect.getRight());
break;
case 180:
pageRect = new Rectangle(
pageSize.getRight() - pageRect.getLeft(),
pageSize.getTop() - pageRect.getBottom(),
pageSize.getRight() - pageRect.getRight(),
pageSize.getTop() - pageRect.getTop());
break;
case 270:
pageRect = new Rectangle(
pageSize.getRight() - pageRect.getBottom(),
pageRect.getLeft(),
pageSize.getRight() - pageRect.getTop(),
pageRect.getRight());
break;
}
if (rotation != 0)
pageRect.normalize();
rect = new Rectangle(this.pageRect.getWidth(), this.pageRect.getHeight());
} | java | public void setVisibleSignature(String fieldName) {
AcroFields af = writer.getAcroFields();
AcroFields.Item item = af.getFieldItem(fieldName);
if (item == null)
throw new IllegalArgumentException("The field " + fieldName + " does not exist.");
PdfDictionary merged = item.getMerged(0);
if (!PdfName.SIG.equals(PdfReader.getPdfObject(merged.get(PdfName.FT))))
throw new IllegalArgumentException("The field " + fieldName + " is not a signature field.");
this.fieldName = fieldName;
PdfArray r = merged.getAsArray(PdfName.RECT);
float llx = r.getAsNumber(0).floatValue();
float lly = r.getAsNumber(1).floatValue();
float urx = r.getAsNumber(2).floatValue();
float ury = r.getAsNumber(3).floatValue();
pageRect = new Rectangle(llx, lly, urx, ury);
pageRect.normalize();
page = item.getPage(0).intValue();
int rotation = writer.reader.getPageRotation(page);
Rectangle pageSize = writer.reader.getPageSizeWithRotation(page);
switch (rotation) {
case 90:
pageRect = new Rectangle(
pageRect.getBottom(),
pageSize.getTop() - pageRect.getLeft(),
pageRect.getTop(),
pageSize.getTop() - pageRect.getRight());
break;
case 180:
pageRect = new Rectangle(
pageSize.getRight() - pageRect.getLeft(),
pageSize.getTop() - pageRect.getBottom(),
pageSize.getRight() - pageRect.getRight(),
pageSize.getTop() - pageRect.getTop());
break;
case 270:
pageRect = new Rectangle(
pageSize.getRight() - pageRect.getBottom(),
pageRect.getLeft(),
pageSize.getRight() - pageRect.getTop(),
pageRect.getRight());
break;
}
if (rotation != 0)
pageRect.normalize();
rect = new Rectangle(this.pageRect.getWidth(), this.pageRect.getHeight());
} | [
"public",
"void",
"setVisibleSignature",
"(",
"String",
"fieldName",
")",
"{",
"AcroFields",
"af",
"=",
"writer",
".",
"getAcroFields",
"(",
")",
";",
"AcroFields",
".",
"Item",
"item",
"=",
"af",
".",
"getFieldItem",
"(",
"fieldName",
")",
";",
"if",
"(",... | Sets the signature to be visible. An empty signature field with the same name must already exist.
@param fieldName the existing empty signature field name | [
"Sets",
"the",
"signature",
"to",
"be",
"visible",
".",
"An",
"empty",
"signature",
"field",
"with",
"the",
"same",
"name",
"must",
"already",
"exist",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfSignatureAppearance.java#L290-L335 |
UrielCh/ovh-java-sdk | ovh-java-sdk-dedicatedCloud/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedCloud.java | ApiOvhDedicatedCloud.serviceName_datacenter_datacenterId_vm_vmId_backupJob_restorePoints_restorePointId_restore_POST | public OvhTask serviceName_datacenter_datacenterId_vm_vmId_backupJob_restorePoints_restorePointId_restore_POST(String serviceName, Long datacenterId, Long vmId, Long restorePointId, Long filerId) throws IOException {
String qPath = "/dedicatedCloud/{serviceName}/datacenter/{datacenterId}/vm/{vmId}/backupJob/restorePoints/{restorePointId}/restore";
StringBuilder sb = path(qPath, serviceName, datacenterId, vmId, restorePointId);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "filerId", filerId);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhTask.class);
} | java | public OvhTask serviceName_datacenter_datacenterId_vm_vmId_backupJob_restorePoints_restorePointId_restore_POST(String serviceName, Long datacenterId, Long vmId, Long restorePointId, Long filerId) throws IOException {
String qPath = "/dedicatedCloud/{serviceName}/datacenter/{datacenterId}/vm/{vmId}/backupJob/restorePoints/{restorePointId}/restore";
StringBuilder sb = path(qPath, serviceName, datacenterId, vmId, restorePointId);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "filerId", filerId);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhTask.class);
} | [
"public",
"OvhTask",
"serviceName_datacenter_datacenterId_vm_vmId_backupJob_restorePoints_restorePointId_restore_POST",
"(",
"String",
"serviceName",
",",
"Long",
"datacenterId",
",",
"Long",
"vmId",
",",
"Long",
"restorePointId",
",",
"Long",
"filerId",
")",
"throws",
"IOExc... | Restore this restore point
REST: POST /dedicatedCloud/{serviceName}/datacenter/{datacenterId}/vm/{vmId}/backupJob/restorePoints/{restorePointId}/restore
@param filerId [required] Id of the filer where we should restore this Backup.
@param serviceName [required] Domain of the service
@param datacenterId [required]
@param vmId [required] Id of the virtual machine.
@param restorePointId [required] Id of the restore point.
@deprecated | [
"Restore",
"this",
"restore",
"point"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedCloud/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedCloud.java#L2092-L2099 |
alkacon/opencms-core | src-gwt/org/opencms/gwt/client/util/CmsFadeAnimation.java | CmsFadeAnimation.fadeIn | public static CmsFadeAnimation fadeIn(Element element, Command callback, int duration) {
CmsFadeAnimation animation = new CmsFadeAnimation(element, true, callback);
animation.run(duration);
return animation;
} | java | public static CmsFadeAnimation fadeIn(Element element, Command callback, int duration) {
CmsFadeAnimation animation = new CmsFadeAnimation(element, true, callback);
animation.run(duration);
return animation;
} | [
"public",
"static",
"CmsFadeAnimation",
"fadeIn",
"(",
"Element",
"element",
",",
"Command",
"callback",
",",
"int",
"duration",
")",
"{",
"CmsFadeAnimation",
"animation",
"=",
"new",
"CmsFadeAnimation",
"(",
"element",
",",
"true",
",",
"callback",
")",
";",
... | Fades the given element into view executing the callback afterwards.<p>
@param element the element to fade in
@param callback the callback
@param duration the animation duration
@return the running animation object | [
"Fades",
"the",
"given",
"element",
"into",
"view",
"executing",
"the",
"callback",
"afterwards",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/util/CmsFadeAnimation.java#L69-L74 |
nextreports/nextreports-engine | src/ro/nextreports/engine/util/ParameterUtil.java | ParameterUtil.allParametersHaveDefaults | public static boolean allParametersHaveDefaults(Map<String, QueryParameter> map) {
for (QueryParameter qp : map.values()) {
if ((qp.getDefaultValues() == null) || (qp.getDefaultValues().size() == 0)) {
if ((qp.getDefaultSource() == null) || "".equals(qp.getDefaultSource().trim())) {
return false;
}
}
}
return true;
} | java | public static boolean allParametersHaveDefaults(Map<String, QueryParameter> map) {
for (QueryParameter qp : map.values()) {
if ((qp.getDefaultValues() == null) || (qp.getDefaultValues().size() == 0)) {
if ((qp.getDefaultSource() == null) || "".equals(qp.getDefaultSource().trim())) {
return false;
}
}
}
return true;
} | [
"public",
"static",
"boolean",
"allParametersHaveDefaults",
"(",
"Map",
"<",
"String",
",",
"QueryParameter",
">",
"map",
")",
"{",
"for",
"(",
"QueryParameter",
"qp",
":",
"map",
".",
"values",
"(",
")",
")",
"{",
"if",
"(",
"(",
"qp",
".",
"getDefaultV... | See if all parameters have default values
@param map map of parameters
@return true if all parameters have default values | [
"See",
"if",
"all",
"parameters",
"have",
"default",
"values"
] | train | https://github.com/nextreports/nextreports-engine/blob/a847575a9298b5fce63b88961190c5b83ddccc44/src/ro/nextreports/engine/util/ParameterUtil.java#L816-L825 |
aws/aws-sdk-java | aws-java-sdk-connect/src/main/java/com/amazonaws/services/connect/model/GetContactAttributesResult.java | GetContactAttributesResult.withAttributes | public GetContactAttributesResult withAttributes(java.util.Map<String, String> attributes) {
setAttributes(attributes);
return this;
} | java | public GetContactAttributesResult withAttributes(java.util.Map<String, String> attributes) {
setAttributes(attributes);
return this;
} | [
"public",
"GetContactAttributesResult",
"withAttributes",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"attributes",
")",
"{",
"setAttributes",
"(",
"attributes",
")",
";",
"return",
"this",
";",
"}"
] | <p>
The attributes to update.
</p>
@param attributes
The attributes to update.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"The",
"attributes",
"to",
"update",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-connect/src/main/java/com/amazonaws/services/connect/model/GetContactAttributesResult.java#L68-L71 |
lessthanoptimal/BoofCV | main/boofcv-sfm/src/main/java/boofcv/alg/sfm/structure/ThreeViewEstimateMetricScene.java | ThreeViewEstimateMetricScene.robustFitTrifocal | private boolean robustFitTrifocal(List<AssociatedTriple> associated) {
// Fit a trifocal tensor to the observations robustly
ransac.process(associated);
inliers = ransac.getMatchSet();
TrifocalTensor model = ransac.getModelParameters();
if( verbose != null )
verbose.println("Remaining after RANSAC "+inliers.size()+" / "+associated.size());
// estimate using all the inliers
// No need to re-scale the input because the estimator automatically adjusts the input on its own
if( !trifocalEstimator.process(inliers,model) ) {
if( verbose != null ) {
verbose.println("Trifocal estimator failed");
}
return false;
}
return true;
} | java | private boolean robustFitTrifocal(List<AssociatedTriple> associated) {
// Fit a trifocal tensor to the observations robustly
ransac.process(associated);
inliers = ransac.getMatchSet();
TrifocalTensor model = ransac.getModelParameters();
if( verbose != null )
verbose.println("Remaining after RANSAC "+inliers.size()+" / "+associated.size());
// estimate using all the inliers
// No need to re-scale the input because the estimator automatically adjusts the input on its own
if( !trifocalEstimator.process(inliers,model) ) {
if( verbose != null ) {
verbose.println("Trifocal estimator failed");
}
return false;
}
return true;
} | [
"private",
"boolean",
"robustFitTrifocal",
"(",
"List",
"<",
"AssociatedTriple",
">",
"associated",
")",
"{",
"// Fit a trifocal tensor to the observations robustly",
"ransac",
".",
"process",
"(",
"associated",
")",
";",
"inliers",
"=",
"ransac",
".",
"getMatchSet",
... | Fits a trifocal tensor to the list of matches features using a robust method | [
"Fits",
"a",
"trifocal",
"tensor",
"to",
"the",
"list",
"of",
"matches",
"features",
"using",
"a",
"robust",
"method"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-sfm/src/main/java/boofcv/alg/sfm/structure/ThreeViewEstimateMetricScene.java#L195-L213 |
kuali/ojb-1.0.4 | src/xdoclet/java/src/xdoclet/modules/ojb/constraints/ClassDescriptorConstraints.java | ClassDescriptorConstraints.checkObjectCache | private void checkObjectCache(ClassDescriptorDef classDef, String checkLevel) throws ConstraintException
{
if (!CHECKLEVEL_STRICT.equals(checkLevel))
{
return;
}
ObjectCacheDef objCacheDef = classDef.getObjectCache();
if (objCacheDef == null)
{
return;
}
String objectCacheName = objCacheDef.getName();
if ((objectCacheName == null) || (objectCacheName.length() == 0))
{
throw new ConstraintException("No class specified for the object-cache of class "+classDef.getName());
}
try
{
InheritanceHelper helper = new InheritanceHelper();
if (!helper.isSameOrSubTypeOf(objectCacheName, OBJECT_CACHE_INTERFACE))
{
throw new ConstraintException("The class "+objectCacheName+" specified as object-cache of class "+classDef.getName()+" does not implement the interface "+OBJECT_CACHE_INTERFACE);
}
}
catch (ClassNotFoundException ex)
{
throw new ConstraintException("Could not find the class "+ex.getMessage()+" on the classpath while checking the object-cache class "+objectCacheName+" of class "+classDef.getName());
}
} | java | private void checkObjectCache(ClassDescriptorDef classDef, String checkLevel) throws ConstraintException
{
if (!CHECKLEVEL_STRICT.equals(checkLevel))
{
return;
}
ObjectCacheDef objCacheDef = classDef.getObjectCache();
if (objCacheDef == null)
{
return;
}
String objectCacheName = objCacheDef.getName();
if ((objectCacheName == null) || (objectCacheName.length() == 0))
{
throw new ConstraintException("No class specified for the object-cache of class "+classDef.getName());
}
try
{
InheritanceHelper helper = new InheritanceHelper();
if (!helper.isSameOrSubTypeOf(objectCacheName, OBJECT_CACHE_INTERFACE))
{
throw new ConstraintException("The class "+objectCacheName+" specified as object-cache of class "+classDef.getName()+" does not implement the interface "+OBJECT_CACHE_INTERFACE);
}
}
catch (ClassNotFoundException ex)
{
throw new ConstraintException("Could not find the class "+ex.getMessage()+" on the classpath while checking the object-cache class "+objectCacheName+" of class "+classDef.getName());
}
} | [
"private",
"void",
"checkObjectCache",
"(",
"ClassDescriptorDef",
"classDef",
",",
"String",
"checkLevel",
")",
"throws",
"ConstraintException",
"{",
"if",
"(",
"!",
"CHECKLEVEL_STRICT",
".",
"equals",
"(",
"checkLevel",
")",
")",
"{",
"return",
";",
"}",
"Objec... | Checks the given class descriptor for correct object cache setting.
@param classDef The class descriptor
@param checkLevel The current check level (this constraint is only checked in strict)
@exception ConstraintException If the constraint has been violated | [
"Checks",
"the",
"given",
"class",
"descriptor",
"for",
"correct",
"object",
"cache",
"setting",
"."
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/xdoclet/java/src/xdoclet/modules/ojb/constraints/ClassDescriptorConstraints.java#L450-L484 |
ThreeTen/threetenbp | src/main/java/org/threeten/bp/ZoneId.java | ZoneId.ofOffset | public static ZoneId ofOffset(String prefix, ZoneOffset offset) {
Jdk8Methods.requireNonNull(prefix, "prefix");
Jdk8Methods.requireNonNull(offset, "offset");
if (prefix.length() == 0) {
return offset;
}
if (prefix.equals("GMT") || prefix.equals("UTC") || prefix.equals("UT")) {
if (offset.getTotalSeconds() == 0) {
return new ZoneRegion(prefix, offset.getRules());
}
return new ZoneRegion(prefix + offset.getId(), offset.getRules());
}
throw new IllegalArgumentException("Invalid prefix, must be GMT, UTC or UT: " + prefix);
} | java | public static ZoneId ofOffset(String prefix, ZoneOffset offset) {
Jdk8Methods.requireNonNull(prefix, "prefix");
Jdk8Methods.requireNonNull(offset, "offset");
if (prefix.length() == 0) {
return offset;
}
if (prefix.equals("GMT") || prefix.equals("UTC") || prefix.equals("UT")) {
if (offset.getTotalSeconds() == 0) {
return new ZoneRegion(prefix, offset.getRules());
}
return new ZoneRegion(prefix + offset.getId(), offset.getRules());
}
throw new IllegalArgumentException("Invalid prefix, must be GMT, UTC or UT: " + prefix);
} | [
"public",
"static",
"ZoneId",
"ofOffset",
"(",
"String",
"prefix",
",",
"ZoneOffset",
"offset",
")",
"{",
"Jdk8Methods",
".",
"requireNonNull",
"(",
"prefix",
",",
"\"prefix\"",
")",
";",
"Jdk8Methods",
".",
"requireNonNull",
"(",
"offset",
",",
"\"offset\"",
... | Obtains an instance of {@code ZoneId} wrapping an offset.
<p>
If the prefix is "GMT", "UTC", or "UT" a {@code ZoneId}
with the prefix and the non-zero offset is returned.
If the prefix is empty {@code ""} the {@code ZoneOffset} is returned.
@param prefix the time-zone ID, not null
@param offset the offset, not null
@return the zone ID, not null
@throws IllegalArgumentException if the prefix is not one of
"GMT", "UTC", or "UT", or "" | [
"Obtains",
"an",
"instance",
"of",
"{",
"@code",
"ZoneId",
"}",
"wrapping",
"an",
"offset",
".",
"<p",
">",
"If",
"the",
"prefix",
"is",
"GMT",
"UTC",
"or",
"UT",
"a",
"{",
"@code",
"ZoneId",
"}",
"with",
"the",
"prefix",
"and",
"the",
"non",
"-",
... | train | https://github.com/ThreeTen/threetenbp/blob/5f05b649f89f205aabd96b2f83c36796ec616fe6/src/main/java/org/threeten/bp/ZoneId.java#L374-L387 |
Azure/azure-sdk-for-java | authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/RoleAssignmentsInner.java | RoleAssignmentsInner.createByIdAsync | public Observable<RoleAssignmentInner> createByIdAsync(String roleId, RoleAssignmentCreateParameters parameters) {
return createByIdWithServiceResponseAsync(roleId, parameters).map(new Func1<ServiceResponse<RoleAssignmentInner>, RoleAssignmentInner>() {
@Override
public RoleAssignmentInner call(ServiceResponse<RoleAssignmentInner> response) {
return response.body();
}
});
} | java | public Observable<RoleAssignmentInner> createByIdAsync(String roleId, RoleAssignmentCreateParameters parameters) {
return createByIdWithServiceResponseAsync(roleId, parameters).map(new Func1<ServiceResponse<RoleAssignmentInner>, RoleAssignmentInner>() {
@Override
public RoleAssignmentInner call(ServiceResponse<RoleAssignmentInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"RoleAssignmentInner",
">",
"createByIdAsync",
"(",
"String",
"roleId",
",",
"RoleAssignmentCreateParameters",
"parameters",
")",
"{",
"return",
"createByIdWithServiceResponseAsync",
"(",
"roleId",
",",
"parameters",
")",
".",
"map",
"(",
... | Creates a role assignment by ID.
@param roleId The ID of the role assignment to create.
@param parameters Parameters for the role assignment.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the RoleAssignmentInner object | [
"Creates",
"a",
"role",
"assignment",
"by",
"ID",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/RoleAssignmentsInner.java#L999-L1006 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/PdfDocument.java | PdfDocument.fitsPage | boolean fitsPage(PdfPTable table, float margin) {
if (!table.isLockedWidth()) {
float totalWidth = (indentRight() - indentLeft()) * table.getWidthPercentage() / 100;
table.setTotalWidth(totalWidth);
}
// ensuring that a new line has been started.
ensureNewLine();
return table.getTotalHeight() + ((currentHeight > 0) ? table.spacingBefore() : 0f)
<= indentTop() - currentHeight - indentBottom() - margin;
} | java | boolean fitsPage(PdfPTable table, float margin) {
if (!table.isLockedWidth()) {
float totalWidth = (indentRight() - indentLeft()) * table.getWidthPercentage() / 100;
table.setTotalWidth(totalWidth);
}
// ensuring that a new line has been started.
ensureNewLine();
return table.getTotalHeight() + ((currentHeight > 0) ? table.spacingBefore() : 0f)
<= indentTop() - currentHeight - indentBottom() - margin;
} | [
"boolean",
"fitsPage",
"(",
"PdfPTable",
"table",
",",
"float",
"margin",
")",
"{",
"if",
"(",
"!",
"table",
".",
"isLockedWidth",
"(",
")",
")",
"{",
"float",
"totalWidth",
"=",
"(",
"indentRight",
"(",
")",
"-",
"indentLeft",
"(",
")",
")",
"*",
"t... | Checks if a <CODE>PdfPTable</CODE> fits the current page of the <CODE>PdfDocument</CODE>.
@param table the table that has to be checked
@param margin a certain margin
@return <CODE>true</CODE> if the <CODE>PdfPTable</CODE> fits the page, <CODE>false</CODE> otherwise. | [
"Checks",
"if",
"a",
"<CODE",
">",
"PdfPTable<",
"/",
"CODE",
">",
"fits",
"the",
"current",
"page",
"of",
"the",
"<CODE",
">",
"PdfDocument<",
"/",
"CODE",
">",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfDocument.java#L2518-L2527 |
nulab/backlog4j | src/main/java/com/nulabinc/backlog4j/api/option/AddPullRequestCommentParams.java | AddPullRequestCommentParams.notifiedUserIds | public AddPullRequestCommentParams notifiedUserIds(List<Long> notifiedUserIds) {
for (Long notifiedUserId : notifiedUserIds) {
parameters.add(new NameValuePair("notifiedUserId[]", String.valueOf(notifiedUserId)));
}
return this;
} | java | public AddPullRequestCommentParams notifiedUserIds(List<Long> notifiedUserIds) {
for (Long notifiedUserId : notifiedUserIds) {
parameters.add(new NameValuePair("notifiedUserId[]", String.valueOf(notifiedUserId)));
}
return this;
} | [
"public",
"AddPullRequestCommentParams",
"notifiedUserIds",
"(",
"List",
"<",
"Long",
">",
"notifiedUserIds",
")",
"{",
"for",
"(",
"Long",
"notifiedUserId",
":",
"notifiedUserIds",
")",
"{",
"parameters",
".",
"add",
"(",
"new",
"NameValuePair",
"(",
"\"notifiedU... | Sets the notified users.
@param notifiedUserIds the notified user identifiers
@return AddPullRequestCommentParams instance | [
"Sets",
"the",
"notified",
"users",
"."
] | train | https://github.com/nulab/backlog4j/blob/862ae0586ad808b2ec413f665b8dfc0c9a107b4e/src/main/java/com/nulabinc/backlog4j/api/option/AddPullRequestCommentParams.java#L52-L57 |
apache/flink | flink-optimizer/src/main/java/org/apache/flink/optimizer/dag/OptimizerNode.java | OptimizerNode.areBranchCompatible | protected boolean areBranchCompatible(PlanNode plan1, PlanNode plan2) {
if (plan1 == null || plan2 == null) {
throw new NullPointerException();
}
// if there is no open branch, the children are always compatible.
// in most plans, that will be the dominant case
if (this.hereJoinedBranches == null || this.hereJoinedBranches.isEmpty()) {
return true;
}
for (OptimizerNode joinedBrancher : hereJoinedBranches) {
final PlanNode branch1Cand = plan1.getCandidateAtBranchPoint(joinedBrancher);
final PlanNode branch2Cand = plan2.getCandidateAtBranchPoint(joinedBrancher);
if (branch1Cand != null && branch2Cand != null && branch1Cand != branch2Cand) {
return false;
}
}
return true;
} | java | protected boolean areBranchCompatible(PlanNode plan1, PlanNode plan2) {
if (plan1 == null || plan2 == null) {
throw new NullPointerException();
}
// if there is no open branch, the children are always compatible.
// in most plans, that will be the dominant case
if (this.hereJoinedBranches == null || this.hereJoinedBranches.isEmpty()) {
return true;
}
for (OptimizerNode joinedBrancher : hereJoinedBranches) {
final PlanNode branch1Cand = plan1.getCandidateAtBranchPoint(joinedBrancher);
final PlanNode branch2Cand = plan2.getCandidateAtBranchPoint(joinedBrancher);
if (branch1Cand != null && branch2Cand != null && branch1Cand != branch2Cand) {
return false;
}
}
return true;
} | [
"protected",
"boolean",
"areBranchCompatible",
"(",
"PlanNode",
"plan1",
",",
"PlanNode",
"plan2",
")",
"{",
"if",
"(",
"plan1",
"==",
"null",
"||",
"plan2",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
")",
";",
"}",
"// if there is ... | Checks whether to candidate plans for the sub-plan of this node are comparable. The two
alternative plans are comparable, if
a) There is no branch in the sub-plan of this node
b) Both candidates have the same candidate as the child at the last open branch.
@param plan1 The root node of the first candidate plan.
@param plan2 The root node of the second candidate plan.
@return True if the nodes are branch compatible in the inputs. | [
"Checks",
"whether",
"to",
"candidate",
"plans",
"for",
"the",
"sub",
"-",
"plan",
"of",
"this",
"node",
"are",
"comparable",
".",
"The",
"two",
"alternative",
"plans",
"are",
"comparable",
"if"
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-optimizer/src/main/java/org/apache/flink/optimizer/dag/OptimizerNode.java#L970-L990 |
eurekaclinical/eurekaclinical-common | src/main/java/org/eurekaclinical/common/comm/clients/EurekaClinicalClient.java | EurekaClinicalClient.doPostCreateMultipart | protected URI doPostCreateMultipart(String path, FormDataMultiPart formDataMultiPart) throws ClientException {
this.readLock.lock();
try {
ClientResponse response = getResourceWrapper()
.rewritten(path, HttpMethod.POST)
.type(Boundary.addBoundary(MediaType.MULTIPART_FORM_DATA_TYPE))
.accept(MediaType.TEXT_PLAIN)
.post(ClientResponse.class, formDataMultiPart);
errorIfStatusNotEqualTo(response, ClientResponse.Status.OK, ClientResponse.Status.CREATED);
try {
return response.getLocation();
} finally {
response.close();
}
} catch (ClientHandlerException ex) {
throw new ClientException(ClientResponse.Status.INTERNAL_SERVER_ERROR, ex.getMessage());
} finally {
this.readLock.unlock();
}
} | java | protected URI doPostCreateMultipart(String path, FormDataMultiPart formDataMultiPart) throws ClientException {
this.readLock.lock();
try {
ClientResponse response = getResourceWrapper()
.rewritten(path, HttpMethod.POST)
.type(Boundary.addBoundary(MediaType.MULTIPART_FORM_DATA_TYPE))
.accept(MediaType.TEXT_PLAIN)
.post(ClientResponse.class, formDataMultiPart);
errorIfStatusNotEqualTo(response, ClientResponse.Status.OK, ClientResponse.Status.CREATED);
try {
return response.getLocation();
} finally {
response.close();
}
} catch (ClientHandlerException ex) {
throw new ClientException(ClientResponse.Status.INTERNAL_SERVER_ERROR, ex.getMessage());
} finally {
this.readLock.unlock();
}
} | [
"protected",
"URI",
"doPostCreateMultipart",
"(",
"String",
"path",
",",
"FormDataMultiPart",
"formDataMultiPart",
")",
"throws",
"ClientException",
"{",
"this",
".",
"readLock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"ClientResponse",
"response",
"=",
"getResour... | Creates a resource specified as a multi-part form. Adds appropriate
Accepts and Content Type headers.
@param path the the API to call.
@param formDataMultiPart the form content.
@return the URI representing the created resource, for use in subsequent
operations on the resource.
@throws ClientException if a status code other than 200 (OK) and 201
(Created) is returned. | [
"Creates",
"a",
"resource",
"specified",
"as",
"a",
"multi",
"-",
"part",
"form",
".",
"Adds",
"appropriate",
"Accepts",
"and",
"Content",
"Type",
"headers",
"."
] | train | https://github.com/eurekaclinical/eurekaclinical-common/blob/1867102ff43fe94e519f76a074d5f5923e9be61c/src/main/java/org/eurekaclinical/common/comm/clients/EurekaClinicalClient.java#L832-L851 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsMsgProducerImpl.java | JmsMsgProducerImpl.sendUsingProducerSession | private void sendUsingProducerSession(Message message, int deliveryMode, int priority, long timeToLive) throws JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "sendUsingProducerSession", new Object[] { message, deliveryMode, priority, timeToLive });
// if the producer is closed throw a JMSException.
checkClosed();
// check for sync/async conflicts
session.checkSynchronousUsage("send");
// if the supplied message is null, throw a jms MessageFormatException.
if (message == null) {
throw (MessageFormatException) JmsErrorUtils.newThrowable(
MessageFormatException.class,
"INVALID_VALUE_CWSIA0068",
new Object[] { "message", null },
tc);
}
// Mark that we have overriden the previous properties in the PP
// object in case the next send call is using the 1-arg send.
propsOverriden = true;
// Set the parameter values into the producer properties object. The
// producerProperties object contains sufficient intelligence that
// if any of these particular values has already been set then it
// does not recalculate anything.
producerProperties.setInDeliveryMode(deliveryMode);
producerProperties.setInPriority(priority);
producerProperties.setInTTL(timeToLive);
// Delegate to the internal send method.
sendMessage(producerProperties, message, dest);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "sendUsingProducerSession");
} | java | private void sendUsingProducerSession(Message message, int deliveryMode, int priority, long timeToLive) throws JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "sendUsingProducerSession", new Object[] { message, deliveryMode, priority, timeToLive });
// if the producer is closed throw a JMSException.
checkClosed();
// check for sync/async conflicts
session.checkSynchronousUsage("send");
// if the supplied message is null, throw a jms MessageFormatException.
if (message == null) {
throw (MessageFormatException) JmsErrorUtils.newThrowable(
MessageFormatException.class,
"INVALID_VALUE_CWSIA0068",
new Object[] { "message", null },
tc);
}
// Mark that we have overriden the previous properties in the PP
// object in case the next send call is using the 1-arg send.
propsOverriden = true;
// Set the parameter values into the producer properties object. The
// producerProperties object contains sufficient intelligence that
// if any of these particular values has already been set then it
// does not recalculate anything.
producerProperties.setInDeliveryMode(deliveryMode);
producerProperties.setInPriority(priority);
producerProperties.setInTTL(timeToLive);
// Delegate to the internal send method.
sendMessage(producerProperties, message, dest);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "sendUsingProducerSession");
} | [
"private",
"void",
"sendUsingProducerSession",
"(",
"Message",
"message",
",",
"int",
"deliveryMode",
",",
"int",
"priority",
",",
"long",
"timeToLive",
")",
"throws",
"JMSException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
... | This method is internal method which would send message to ME on top
of producer session. This is called from Sync send and Async Send. In case of Sync send
it would have guarded with monitor sessionSyncLock.
@param message
@param deliveryMode
@param priority
@param timeToLive
@throws JMSException | [
"This",
"method",
"is",
"internal",
"method",
"which",
"would",
"send",
"message",
"to",
"ME",
"on",
"top",
"of",
"producer",
"session",
".",
"This",
"is",
"called",
"from",
"Sync",
"send",
"and",
"Async",
"Send",
".",
"In",
"case",
"of",
"Sync",
"send",... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsMsgProducerImpl.java#L823-L858 |
phax/ph-commons | ph-security/src/main/java/com/helger/security/password/hash/PasswordHashCreatorBCrypt.java | PasswordHashCreatorBCrypt.createPasswordHash | @Nonnull
public String createPasswordHash (@Nonnull final IPasswordSalt aSalt, @Nonnull final String sPlainTextPassword)
{
ValueEnforcer.notNull (aSalt, "Salt");
ValueEnforcer.isInstanceOf (aSalt, PasswordSaltBCrypt.class, "Salt");
ValueEnforcer.notNull (sPlainTextPassword, "PlainTextPassword");
return BCrypt.hashpw (sPlainTextPassword, aSalt.getSaltString ());
} | java | @Nonnull
public String createPasswordHash (@Nonnull final IPasswordSalt aSalt, @Nonnull final String sPlainTextPassword)
{
ValueEnforcer.notNull (aSalt, "Salt");
ValueEnforcer.isInstanceOf (aSalt, PasswordSaltBCrypt.class, "Salt");
ValueEnforcer.notNull (sPlainTextPassword, "PlainTextPassword");
return BCrypt.hashpw (sPlainTextPassword, aSalt.getSaltString ());
} | [
"@",
"Nonnull",
"public",
"String",
"createPasswordHash",
"(",
"@",
"Nonnull",
"final",
"IPasswordSalt",
"aSalt",
",",
"@",
"Nonnull",
"final",
"String",
"sPlainTextPassword",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"aSalt",
",",
"\"Salt\"",
")",
";",
... | {@inheritDoc} The password salt must be of type {@link PasswordSaltBCrypt}. | [
"{"
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-security/src/main/java/com/helger/security/password/hash/PasswordHashCreatorBCrypt.java#L49-L57 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/DB2iNativeHelper.java | DB2iNativeHelper.generateVersionNumber | protected static final int generateVersionNumber(String s) {
int i = -1;
StringTokenizer stringtokenizer = new StringTokenizer(s, "VRM", false);
if (stringtokenizer.countTokens() == 3) {
String s1 = stringtokenizer.nextToken();
s1 = s1 + stringtokenizer.nextToken();
s1 = s1 + stringtokenizer.nextToken();
i = Integer.parseInt(s1);
}
return i;
} | java | protected static final int generateVersionNumber(String s) {
int i = -1;
StringTokenizer stringtokenizer = new StringTokenizer(s, "VRM", false);
if (stringtokenizer.countTokens() == 3) {
String s1 = stringtokenizer.nextToken();
s1 = s1 + stringtokenizer.nextToken();
s1 = s1 + stringtokenizer.nextToken();
i = Integer.parseInt(s1);
}
return i;
} | [
"protected",
"static",
"final",
"int",
"generateVersionNumber",
"(",
"String",
"s",
")",
"{",
"int",
"i",
"=",
"-",
"1",
";",
"StringTokenizer",
"stringtokenizer",
"=",
"new",
"StringTokenizer",
"(",
"s",
",",
"\"VRM\"",
",",
"false",
")",
";",
"if",
"(",
... | 274538 -- internal utility method added.
This internal utility method is used to convert the os.version string to a integer value
so that DB2 support can be determined based on version and release level.
@return int : The numeric value of the os400 VRM such as 530 for the string "V5R3M0" | [
"274538",
"--",
"internal",
"utility",
"method",
"added",
".",
"This",
"internal",
"utility",
"method",
"is",
"used",
"to",
"convert",
"the",
"os",
".",
"version",
"string",
"to",
"a",
"integer",
"value",
"so",
"that",
"DB2",
"support",
"can",
"be",
"deter... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/DB2iNativeHelper.java#L208-L218 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java | ImgUtil.toBase64 | public static String toBase64(Image image, String imageType) {
final ByteArrayOutputStream out = new ByteArrayOutputStream();
write(image, imageType, out);
return Base64.encode(out.toByteArray());
} | java | public static String toBase64(Image image, String imageType) {
final ByteArrayOutputStream out = new ByteArrayOutputStream();
write(image, imageType, out);
return Base64.encode(out.toByteArray());
} | [
"public",
"static",
"String",
"toBase64",
"(",
"Image",
"image",
",",
"String",
"imageType",
")",
"{",
"final",
"ByteArrayOutputStream",
"out",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"write",
"(",
"image",
",",
"imageType",
",",
"out",
")",
";",... | 将图片对象转换为Base64形式
@param image 图片对象
@param imageType 图片类型
@return Base64的字符串表现形式
@since 4.1.8 | [
"将图片对象转换为Base64形式"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L1253-L1257 |
ttddyy/datasource-proxy | src/main/java/net/ttddyy/dsproxy/support/ProxyDataSourceBuilder.java | ProxyDataSourceBuilder.logQueryByJUL | public ProxyDataSourceBuilder logQueryByJUL(Level logLevel, String julLoggerName) {
this.createJulQueryListener = true;
this.julLogLevel = logLevel;
this.julLoggerName = julLoggerName;
return this;
} | java | public ProxyDataSourceBuilder logQueryByJUL(Level logLevel, String julLoggerName) {
this.createJulQueryListener = true;
this.julLogLevel = logLevel;
this.julLoggerName = julLoggerName;
return this;
} | [
"public",
"ProxyDataSourceBuilder",
"logQueryByJUL",
"(",
"Level",
"logLevel",
",",
"String",
"julLoggerName",
")",
"{",
"this",
".",
"createJulQueryListener",
"=",
"true",
";",
"this",
".",
"julLogLevel",
"=",
"logLevel",
";",
"this",
".",
"julLoggerName",
"=",
... | Register {@link JULQueryLoggingListener}.
@param logLevel log level for JUL
@param julLoggerName JUL logger name
@return builder
@since 1.4 | [
"Register",
"{",
"@link",
"JULQueryLoggingListener",
"}",
"."
] | train | https://github.com/ttddyy/datasource-proxy/blob/62163ccf9a569a99aa3ad9f9151a32567447a62e/src/main/java/net/ttddyy/dsproxy/support/ProxyDataSourceBuilder.java#L424-L429 |
TinkoffCreditSystems/decoro | library/src/main/java/ru/tinkoff/decoro/MaskImpl.java | MaskImpl.insertAt | @Override
public int insertAt(final int position, @Nullable final CharSequence input) {
return insertAt(position, input, true);
} | java | @Override
public int insertAt(final int position, @Nullable final CharSequence input) {
return insertAt(position, input, true);
} | [
"@",
"Override",
"public",
"int",
"insertAt",
"(",
"final",
"int",
"position",
",",
"@",
"Nullable",
"final",
"CharSequence",
"input",
")",
"{",
"return",
"insertAt",
"(",
"position",
",",
"input",
",",
"true",
")",
";",
"}"
] | Convenience method for {@link MaskImpl#insertAt(int, CharSequence, boolean)} that always
places
cursor after trailing hardcoded sequence.
@param position from which position to begin input
@param input string to insert
@return cursor position after insert | [
"Convenience",
"method",
"for",
"{",
"@link",
"MaskImpl#insertAt",
"(",
"int",
"CharSequence",
"boolean",
")",
"}",
"that",
"always",
"places",
"cursor",
"after",
"trailing",
"hardcoded",
"sequence",
"."
] | train | https://github.com/TinkoffCreditSystems/decoro/blob/f2693d0b3def13aabf59cf642fc0b6f5c8c94f63/library/src/main/java/ru/tinkoff/decoro/MaskImpl.java#L309-L312 |
alkacon/opencms-core | src/org/opencms/ui/components/CmsResourceIcon.java | CmsResourceIcon.getOverlaySpan | private static String getOverlaySpan(String cssClass, String title) {
StringBuffer result = new StringBuffer();
result.append("<span class=\"").append(cssClass).append("\"");
if (title != null) {
result.append(" title=\"").append(title).append("\"");
}
result.append("></span>");
return result.toString();
} | java | private static String getOverlaySpan(String cssClass, String title) {
StringBuffer result = new StringBuffer();
result.append("<span class=\"").append(cssClass).append("\"");
if (title != null) {
result.append(" title=\"").append(title).append("\"");
}
result.append("></span>");
return result.toString();
} | [
"private",
"static",
"String",
"getOverlaySpan",
"(",
"String",
"cssClass",
",",
"String",
"title",
")",
"{",
"StringBuffer",
"result",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"result",
".",
"append",
"(",
"\"<span class=\\\"\"",
")",
".",
"append",
"(",
... | Generates an overlay icon span.<p>
@param title the span title
@param cssClass the CSS class
@return the span element string | [
"Generates",
"an",
"overlay",
"icon",
"span",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/components/CmsResourceIcon.java#L424-L433 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/ClassUtils.java | ClassUtils.isAssignable | @GwtIncompatible("incompatible method")
public static boolean isAssignable(Class<?>[] classArray, Class<?>[] toClassArray, final boolean autoboxing) {
if (!ArrayUtils.isSameLength(classArray, toClassArray)) {
return false;
}
if (classArray == null) {
classArray = ArrayUtils.EMPTY_CLASS_ARRAY;
}
if (toClassArray == null) {
toClassArray = ArrayUtils.EMPTY_CLASS_ARRAY;
}
for (int i = 0; i < classArray.length; i++) {
if (!isAssignable(classArray[i], toClassArray[i], autoboxing)) {
return false;
}
}
return true;
} | java | @GwtIncompatible("incompatible method")
public static boolean isAssignable(Class<?>[] classArray, Class<?>[] toClassArray, final boolean autoboxing) {
if (!ArrayUtils.isSameLength(classArray, toClassArray)) {
return false;
}
if (classArray == null) {
classArray = ArrayUtils.EMPTY_CLASS_ARRAY;
}
if (toClassArray == null) {
toClassArray = ArrayUtils.EMPTY_CLASS_ARRAY;
}
for (int i = 0; i < classArray.length; i++) {
if (!isAssignable(classArray[i], toClassArray[i], autoboxing)) {
return false;
}
}
return true;
} | [
"@",
"GwtIncompatible",
"(",
"\"incompatible method\"",
")",
"public",
"static",
"boolean",
"isAssignable",
"(",
"Class",
"<",
"?",
">",
"[",
"]",
"classArray",
",",
"Class",
"<",
"?",
">",
"[",
"]",
"toClassArray",
",",
"final",
"boolean",
"autoboxing",
")"... | <p>Checks if an array of Classes can be assigned to another array of Classes.</p>
<p>This method calls {@link #isAssignable(Class, Class) isAssignable} for each
Class pair in the input arrays. It can be used to check if a set of arguments
(the first parameter) are suitably compatible with a set of method parameter types
(the second parameter).</p>
<p>Unlike the {@link Class#isAssignableFrom(java.lang.Class)} method, this
method takes into account widenings of primitive classes and
{@code null}s.</p>
<p>Primitive widenings allow an int to be assigned to a {@code long},
{@code float} or {@code double}. This method returns the correct
result for these cases.</p>
<p>{@code Null} may be assigned to any reference type. This method will
return {@code true} if {@code null} is passed in and the toClass is
non-primitive.</p>
<p>Specifically, this method tests whether the type represented by the
specified {@code Class} parameter can be converted to the type
represented by this {@code Class} object via an identity conversion
widening primitive or widening reference conversion. See
<em><a href="http://docs.oracle.com/javase/specs/">The Java Language Specification</a></em>,
sections 5.1.1, 5.1.2 and 5.1.4 for details.</p>
@param classArray the array of Classes to check, may be {@code null}
@param toClassArray the array of Classes to try to assign into, may be {@code null}
@param autoboxing whether to use implicit autoboxing/unboxing between primitives and wrappers
@return {@code true} if assignment possible | [
"<p",
">",
"Checks",
"if",
"an",
"array",
"of",
"Classes",
"can",
"be",
"assigned",
"to",
"another",
"array",
"of",
"Classes",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/ClassUtils.java#L685-L702 |
google/error-prone-javac | src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java | HtmlDocletWriter.addAnnotationInfo | public boolean addAnnotationInfo(int indent, Element element, VariableElement param,
Content tree) {
return addAnnotationInfo(indent, element, param.getAnnotationMirrors(), false, tree);
} | java | public boolean addAnnotationInfo(int indent, Element element, VariableElement param,
Content tree) {
return addAnnotationInfo(indent, element, param.getAnnotationMirrors(), false, tree);
} | [
"public",
"boolean",
"addAnnotationInfo",
"(",
"int",
"indent",
",",
"Element",
"element",
",",
"VariableElement",
"param",
",",
"Content",
"tree",
")",
"{",
"return",
"addAnnotationInfo",
"(",
"indent",
",",
"element",
",",
"param",
".",
"getAnnotationMirrors",
... | Add the annotatation types for the given element and parameter.
@param indent the number of spaces to indent the parameters.
@param element the element to write annotations for.
@param param the parameter to write annotations for.
@param tree the content tree to which the annotation types will be added | [
"Add",
"the",
"annotatation",
"types",
"for",
"the",
"given",
"element",
"and",
"parameter",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java#L2255-L2258 |
facebook/fresco | drawee/src/main/java/com/facebook/drawee/view/SimpleDraweeView.java | SimpleDraweeView.setImageURI | public void setImageURI(@Nullable String uriString, @Nullable Object callerContext) {
Uri uri = (uriString != null) ? Uri.parse(uriString) : null;
setImageURI(uri, callerContext);
} | java | public void setImageURI(@Nullable String uriString, @Nullable Object callerContext) {
Uri uri = (uriString != null) ? Uri.parse(uriString) : null;
setImageURI(uri, callerContext);
} | [
"public",
"void",
"setImageURI",
"(",
"@",
"Nullable",
"String",
"uriString",
",",
"@",
"Nullable",
"Object",
"callerContext",
")",
"{",
"Uri",
"uri",
"=",
"(",
"uriString",
"!=",
"null",
")",
"?",
"Uri",
".",
"parse",
"(",
"uriString",
")",
":",
"null",... | Displays an image given by the uri string.
@param uriString uri string of the image
@param callerContext caller context | [
"Displays",
"an",
"image",
"given",
"by",
"the",
"uri",
"string",
"."
] | train | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/drawee/src/main/java/com/facebook/drawee/view/SimpleDraweeView.java#L178-L181 |
SonarSource/sonarqube | server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/QProfileWsSupport.java | QProfileWsSupport.getProfile | public QProfileDto getProfile(DbSession dbSession, QProfileReference ref) {
QProfileDto profile;
if (ref.hasKey()) {
profile = dbClient.qualityProfileDao().selectByUuid(dbSession, ref.getKey());
checkFound(profile, "Quality Profile with key '%s' does not exist", ref.getKey());
// Load organization to execute various checks (existence, membership if paid organization, etc.)
getOrganization(dbSession, profile);
} else {
OrganizationDto org = getOrganizationByKey(dbSession, ref.getOrganizationKey().orElse(null));
profile = dbClient.qualityProfileDao().selectByNameAndLanguage(dbSession, org, ref.getName(), ref.getLanguage());
checkFound(profile, "Quality Profile for language '%s' and name '%s' does not exist%s", ref.getLanguage(), ref.getName(),
ref.getOrganizationKey().map(o -> " in organization '" + o + "'").orElse(""));
}
return profile;
} | java | public QProfileDto getProfile(DbSession dbSession, QProfileReference ref) {
QProfileDto profile;
if (ref.hasKey()) {
profile = dbClient.qualityProfileDao().selectByUuid(dbSession, ref.getKey());
checkFound(profile, "Quality Profile with key '%s' does not exist", ref.getKey());
// Load organization to execute various checks (existence, membership if paid organization, etc.)
getOrganization(dbSession, profile);
} else {
OrganizationDto org = getOrganizationByKey(dbSession, ref.getOrganizationKey().orElse(null));
profile = dbClient.qualityProfileDao().selectByNameAndLanguage(dbSession, org, ref.getName(), ref.getLanguage());
checkFound(profile, "Quality Profile for language '%s' and name '%s' does not exist%s", ref.getLanguage(), ref.getName(),
ref.getOrganizationKey().map(o -> " in organization '" + o + "'").orElse(""));
}
return profile;
} | [
"public",
"QProfileDto",
"getProfile",
"(",
"DbSession",
"dbSession",
",",
"QProfileReference",
"ref",
")",
"{",
"QProfileDto",
"profile",
";",
"if",
"(",
"ref",
".",
"hasKey",
"(",
")",
")",
"{",
"profile",
"=",
"dbClient",
".",
"qualityProfileDao",
"(",
")... | Get the Quality profile specified by the reference {@code ref}.
@throws org.sonar.server.exceptions.NotFoundException if the specified organization or profile do not exist | [
"Get",
"the",
"Quality",
"profile",
"specified",
"by",
"the",
"reference",
"{",
"@code",
"ref",
"}",
"."
] | train | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/ws/QProfileWsSupport.java#L102-L116 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.