repository_name
stringlengths 7
58
| func_path_in_repository
stringlengths 11
218
| func_name
stringlengths 4
140
| whole_func_string
stringlengths 153
5.32k
| language
stringclasses 1
value | func_code_string
stringlengths 72
4k
| func_code_tokens
sequencelengths 20
832
| func_documentation_string
stringlengths 61
2k
| func_documentation_tokens
sequencelengths 1
647
| split_name
stringclasses 1
value | func_code_url
stringlengths 102
339
|
---|---|---|---|---|---|---|---|---|---|---|
google/closure-templates | java/src/com/google/template/soy/exprtree/AbstractOperatorNode.java | AbstractOperatorNode.getOperandProtectedForPrecHelper | private String getOperandProtectedForPrecHelper(int index, boolean shouldProtectEqualPrec) {
"""
Helper for getOperandProtectedForLowerPrec() and getOperandProtectedForLowerOrEqualPrec().
@param index The index of the operand to get.
@param shouldProtectEqualPrec Whether to proect the operand if it is an operator with equal
precedence to this operator.
@return The source string for the operand at the given index, possibly protected by surrounding
parentheses.
"""
int thisOpPrec = operator.getPrecedence();
ExprNode child = getChild(index);
boolean shouldProtect;
if (child instanceof OperatorNode) {
int childOpPrec = ((OperatorNode) child).getOperator().getPrecedence();
shouldProtect = shouldProtectEqualPrec ? childOpPrec <= thisOpPrec : childOpPrec < thisOpPrec;
} else {
shouldProtect = false;
}
if (shouldProtect) {
return "(" + child.toSourceString() + ")";
} else {
return child.toSourceString();
}
} | java | private String getOperandProtectedForPrecHelper(int index, boolean shouldProtectEqualPrec) {
int thisOpPrec = operator.getPrecedence();
ExprNode child = getChild(index);
boolean shouldProtect;
if (child instanceof OperatorNode) {
int childOpPrec = ((OperatorNode) child).getOperator().getPrecedence();
shouldProtect = shouldProtectEqualPrec ? childOpPrec <= thisOpPrec : childOpPrec < thisOpPrec;
} else {
shouldProtect = false;
}
if (shouldProtect) {
return "(" + child.toSourceString() + ")";
} else {
return child.toSourceString();
}
} | [
"private",
"String",
"getOperandProtectedForPrecHelper",
"(",
"int",
"index",
",",
"boolean",
"shouldProtectEqualPrec",
")",
"{",
"int",
"thisOpPrec",
"=",
"operator",
".",
"getPrecedence",
"(",
")",
";",
"ExprNode",
"child",
"=",
"getChild",
"(",
"index",
")",
";",
"boolean",
"shouldProtect",
";",
"if",
"(",
"child",
"instanceof",
"OperatorNode",
")",
"{",
"int",
"childOpPrec",
"=",
"(",
"(",
"OperatorNode",
")",
"child",
")",
".",
"getOperator",
"(",
")",
".",
"getPrecedence",
"(",
")",
";",
"shouldProtect",
"=",
"shouldProtectEqualPrec",
"?",
"childOpPrec",
"<=",
"thisOpPrec",
":",
"childOpPrec",
"<",
"thisOpPrec",
";",
"}",
"else",
"{",
"shouldProtect",
"=",
"false",
";",
"}",
"if",
"(",
"shouldProtect",
")",
"{",
"return",
"\"(\"",
"+",
"child",
".",
"toSourceString",
"(",
")",
"+",
"\")\"",
";",
"}",
"else",
"{",
"return",
"child",
".",
"toSourceString",
"(",
")",
";",
"}",
"}"
] | Helper for getOperandProtectedForLowerPrec() and getOperandProtectedForLowerOrEqualPrec().
@param index The index of the operand to get.
@param shouldProtectEqualPrec Whether to proect the operand if it is an operator with equal
precedence to this operator.
@return The source string for the operand at the given index, possibly protected by surrounding
parentheses. | [
"Helper",
"for",
"getOperandProtectedForLowerPrec",
"()",
"and",
"getOperandProtectedForLowerOrEqualPrec",
"()",
"."
] | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/exprtree/AbstractOperatorNode.java#L128-L147 |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/GVRCameraRig.java | GVRCameraRig.setFloat | public void setFloat(String key, float value) {
"""
Map {@code value} to {@code key}.
@param key
Key to map {@code value} to.
@param value
The {@code float} value to map.
"""
checkStringNotNullOrEmpty("key", key);
checkFloatNotNaNOrInfinity("value", value);
NativeCameraRig.setFloat(getNative(), key, value);
} | java | public void setFloat(String key, float value) {
checkStringNotNullOrEmpty("key", key);
checkFloatNotNaNOrInfinity("value", value);
NativeCameraRig.setFloat(getNative(), key, value);
} | [
"public",
"void",
"setFloat",
"(",
"String",
"key",
",",
"float",
"value",
")",
"{",
"checkStringNotNullOrEmpty",
"(",
"\"key\"",
",",
"key",
")",
";",
"checkFloatNotNaNOrInfinity",
"(",
"\"value\"",
",",
"value",
")",
";",
"NativeCameraRig",
".",
"setFloat",
"(",
"getNative",
"(",
")",
",",
"key",
",",
"value",
")",
";",
"}"
] | Map {@code value} to {@code key}.
@param key
Key to map {@code value} to.
@param value
The {@code float} value to map. | [
"Map",
"{",
"@code",
"value",
"}",
"to",
"{",
"@code",
"key",
"}",
"."
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRCameraRig.java#L223-L227 |
huahin/huahin-core | src/main/java/org/huahinframework/core/io/Record.java | Record.addSort | public void addSort(WritableComparable<?> writable, int sort, int priority) {
"""
Add sort key
@param writable Hadoop sort key
@param sort sort type SORT_NON or SORT_LOWER or SORT_UPPER
@param priority sort order
"""
key.addHadoopValue(String.format(SORT_LABEL, priority), writable, sort, priority);
} | java | public void addSort(WritableComparable<?> writable, int sort, int priority) {
key.addHadoopValue(String.format(SORT_LABEL, priority), writable, sort, priority);
} | [
"public",
"void",
"addSort",
"(",
"WritableComparable",
"<",
"?",
">",
"writable",
",",
"int",
"sort",
",",
"int",
"priority",
")",
"{",
"key",
".",
"addHadoopValue",
"(",
"String",
".",
"format",
"(",
"SORT_LABEL",
",",
"priority",
")",
",",
"writable",
",",
"sort",
",",
"priority",
")",
";",
"}"
] | Add sort key
@param writable Hadoop sort key
@param sort sort type SORT_NON or SORT_LOWER or SORT_UPPER
@param priority sort order | [
"Add",
"sort",
"key"
] | train | https://github.com/huahin/huahin-core/blob/a87921b5a12be92a822f753c075ab2431036e6f5/src/main/java/org/huahinframework/core/io/Record.java#L232-L234 |
couchbase/couchbase-lite-java | src/main/java/com/couchbase/lite/Expression.java | Expression.notEqualTo | @NonNull
public Expression notEqualTo(@NonNull Expression expression) {
"""
Create a NOT equal to expression that evaluates whether or not the current expression
is not equal to the given expression.
@param expression the expression to compare with the current expression.
@return a NOT equal to exprssion.
"""
if (expression == null) {
throw new IllegalArgumentException("expression cannot be null.");
}
return new BinaryExpression(this, expression, BinaryExpression.OpType.NotEqualTo);
} | java | @NonNull
public Expression notEqualTo(@NonNull Expression expression) {
if (expression == null) {
throw new IllegalArgumentException("expression cannot be null.");
}
return new BinaryExpression(this, expression, BinaryExpression.OpType.NotEqualTo);
} | [
"@",
"NonNull",
"public",
"Expression",
"notEqualTo",
"(",
"@",
"NonNull",
"Expression",
"expression",
")",
"{",
"if",
"(",
"expression",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"expression cannot be null.\"",
")",
";",
"}",
"return",
"new",
"BinaryExpression",
"(",
"this",
",",
"expression",
",",
"BinaryExpression",
".",
"OpType",
".",
"NotEqualTo",
")",
";",
"}"
] | Create a NOT equal to expression that evaluates whether or not the current expression
is not equal to the given expression.
@param expression the expression to compare with the current expression.
@return a NOT equal to exprssion. | [
"Create",
"a",
"NOT",
"equal",
"to",
"expression",
"that",
"evaluates",
"whether",
"or",
"not",
"the",
"current",
"expression",
"is",
"not",
"equal",
"to",
"the",
"given",
"expression",
"."
] | train | https://github.com/couchbase/couchbase-lite-java/blob/cb72c44186456e6191a9ad0a7feb310011d0b081/src/main/java/com/couchbase/lite/Expression.java#L692-L698 |
infinispan/infinispan | server/integration/infinispan/src/main/java/org/jboss/as/clustering/infinispan/subsystem/ClusteredCacheConfigurationAdd.java | ClusteredCacheConfigurationAdd.processModelNode | @Override
void processModelNode(OperationContext context, String containerName, ModelNode cache, ConfigurationBuilder builder, List<Dependency<?>> dependencies)
throws OperationFailedException {
"""
Create a Configuration object initialized from the data in the operation.
@param cache data representing cache configuration
@param builder
@param dependencies
@return initialised Configuration object
"""
// process cache attributes and elements
super.processModelNode(context, containerName, cache, builder, dependencies);
// adjust the cache mode used based on the value of clustered attribute MODE
ModelNode modeModel = ClusteredCacheConfigurationResource.MODE.resolveModelAttribute(context, cache);
CacheMode cacheMode = modeModel.isDefined() ? Mode.valueOf(modeModel.asString()).apply(this.mode) : this.mode;
builder.clustering().cacheMode(cacheMode);
final long remoteTimeout = ClusteredCacheConfigurationResource.REMOTE_TIMEOUT.resolveModelAttribute(context, cache).asLong();
// process clustered cache attributes and elements
if (cacheMode.isSynchronous()) {
builder.clustering().remoteTimeout(remoteTimeout);
}
} | java | @Override
void processModelNode(OperationContext context, String containerName, ModelNode cache, ConfigurationBuilder builder, List<Dependency<?>> dependencies)
throws OperationFailedException {
// process cache attributes and elements
super.processModelNode(context, containerName, cache, builder, dependencies);
// adjust the cache mode used based on the value of clustered attribute MODE
ModelNode modeModel = ClusteredCacheConfigurationResource.MODE.resolveModelAttribute(context, cache);
CacheMode cacheMode = modeModel.isDefined() ? Mode.valueOf(modeModel.asString()).apply(this.mode) : this.mode;
builder.clustering().cacheMode(cacheMode);
final long remoteTimeout = ClusteredCacheConfigurationResource.REMOTE_TIMEOUT.resolveModelAttribute(context, cache).asLong();
// process clustered cache attributes and elements
if (cacheMode.isSynchronous()) {
builder.clustering().remoteTimeout(remoteTimeout);
}
} | [
"@",
"Override",
"void",
"processModelNode",
"(",
"OperationContext",
"context",
",",
"String",
"containerName",
",",
"ModelNode",
"cache",
",",
"ConfigurationBuilder",
"builder",
",",
"List",
"<",
"Dependency",
"<",
"?",
">",
">",
"dependencies",
")",
"throws",
"OperationFailedException",
"{",
"// process cache attributes and elements",
"super",
".",
"processModelNode",
"(",
"context",
",",
"containerName",
",",
"cache",
",",
"builder",
",",
"dependencies",
")",
";",
"// adjust the cache mode used based on the value of clustered attribute MODE",
"ModelNode",
"modeModel",
"=",
"ClusteredCacheConfigurationResource",
".",
"MODE",
".",
"resolveModelAttribute",
"(",
"context",
",",
"cache",
")",
";",
"CacheMode",
"cacheMode",
"=",
"modeModel",
".",
"isDefined",
"(",
")",
"?",
"Mode",
".",
"valueOf",
"(",
"modeModel",
".",
"asString",
"(",
")",
")",
".",
"apply",
"(",
"this",
".",
"mode",
")",
":",
"this",
".",
"mode",
";",
"builder",
".",
"clustering",
"(",
")",
".",
"cacheMode",
"(",
"cacheMode",
")",
";",
"final",
"long",
"remoteTimeout",
"=",
"ClusteredCacheConfigurationResource",
".",
"REMOTE_TIMEOUT",
".",
"resolveModelAttribute",
"(",
"context",
",",
"cache",
")",
".",
"asLong",
"(",
")",
";",
"// process clustered cache attributes and elements",
"if",
"(",
"cacheMode",
".",
"isSynchronous",
"(",
")",
")",
"{",
"builder",
".",
"clustering",
"(",
")",
".",
"remoteTimeout",
"(",
"remoteTimeout",
")",
";",
"}",
"}"
] | Create a Configuration object initialized from the data in the operation.
@param cache data representing cache configuration
@param builder
@param dependencies
@return initialised Configuration object | [
"Create",
"a",
"Configuration",
"object",
"initialized",
"from",
"the",
"data",
"in",
"the",
"operation",
"."
] | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/server/integration/infinispan/src/main/java/org/jboss/as/clustering/infinispan/subsystem/ClusteredCacheConfigurationAdd.java#L63-L80 |
xmlunit/xmlunit | xmlunit-legacy/src/main/java/org/custommonkey/xmlunit/NodeDescriptor.java | NodeDescriptor.appendNodeDetail | public static void appendNodeDetail(StringBuffer buf, NodeDetail nodeDetail) {
"""
Convert a Node into a simple String representation
and append to StringBuffer
@param buf
@param nodeDetail
"""
appendNodeDetail(buf, nodeDetail.getNode(), true);
buf.append(" at ").append(nodeDetail.getXpathLocation());
} | java | public static void appendNodeDetail(StringBuffer buf, NodeDetail nodeDetail) {
appendNodeDetail(buf, nodeDetail.getNode(), true);
buf.append(" at ").append(nodeDetail.getXpathLocation());
} | [
"public",
"static",
"void",
"appendNodeDetail",
"(",
"StringBuffer",
"buf",
",",
"NodeDetail",
"nodeDetail",
")",
"{",
"appendNodeDetail",
"(",
"buf",
",",
"nodeDetail",
".",
"getNode",
"(",
")",
",",
"true",
")",
";",
"buf",
".",
"append",
"(",
"\" at \"",
")",
".",
"append",
"(",
"nodeDetail",
".",
"getXpathLocation",
"(",
")",
")",
";",
"}"
] | Convert a Node into a simple String representation
and append to StringBuffer
@param buf
@param nodeDetail | [
"Convert",
"a",
"Node",
"into",
"a",
"simple",
"String",
"representation",
"and",
"append",
"to",
"StringBuffer"
] | train | https://github.com/xmlunit/xmlunit/blob/fe3d701d43f57ee83dcba336e4c1555619d3084b/xmlunit-legacy/src/main/java/org/custommonkey/xmlunit/NodeDescriptor.java#L56-L59 |
alkacon/opencms-core | src-setup/org/opencms/setup/xml/CmsSetupXmlHelper.java | CmsSetupXmlHelper.setValue | public int setValue(String xmlFilename, String xPath, String value) throws CmsXmlException {
"""
Sets the given value in all nodes identified by the given xpath of the given xml file.<p>
If value is <code>null</code>, all nodes identified by the given xpath will be deleted.<p>
If the node identified by the given xpath does not exists, the missing nodes will be created
(if <code>value</code> not <code>null</code>).<p>
@param xmlFilename the xml config file (could be relative to the base path)
@param xPath the xpath to set
@param value the value to set (can be <code>null</code> for deletion)
@return the number of successful changed or deleted nodes
@throws CmsXmlException if something goes wrong
"""
return setValue(getDocument(xmlFilename), xPath, value, null);
} | java | public int setValue(String xmlFilename, String xPath, String value) throws CmsXmlException {
return setValue(getDocument(xmlFilename), xPath, value, null);
} | [
"public",
"int",
"setValue",
"(",
"String",
"xmlFilename",
",",
"String",
"xPath",
",",
"String",
"value",
")",
"throws",
"CmsXmlException",
"{",
"return",
"setValue",
"(",
"getDocument",
"(",
"xmlFilename",
")",
",",
"xPath",
",",
"value",
",",
"null",
")",
";",
"}"
] | Sets the given value in all nodes identified by the given xpath of the given xml file.<p>
If value is <code>null</code>, all nodes identified by the given xpath will be deleted.<p>
If the node identified by the given xpath does not exists, the missing nodes will be created
(if <code>value</code> not <code>null</code>).<p>
@param xmlFilename the xml config file (could be relative to the base path)
@param xPath the xpath to set
@param value the value to set (can be <code>null</code> for deletion)
@return the number of successful changed or deleted nodes
@throws CmsXmlException if something goes wrong | [
"Sets",
"the",
"given",
"value",
"in",
"all",
"nodes",
"identified",
"by",
"the",
"given",
"xpath",
"of",
"the",
"given",
"xml",
"file",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-setup/org/opencms/setup/xml/CmsSetupXmlHelper.java#L464-L467 |
box/box-android-sdk | box-content-sdk/src/main/java/com/box/androidsdk/content/utils/SdkUtils.java | SdkUtils.toastSafely | public static void toastSafely(final Context context, final int resId, final int duration) {
"""
Helper method for showing a toast message checking to see if user is on ui thread, and not showing the
same toast if it has already been shown within TOAST_MIN_REPEAT_DELAY time.
@param context current context.
@param resId string resource id to display.
@param duration Toast.LENGTH_LONG or Toast.LENGTH_SHORT.
"""
Long lastToastTime = LAST_TOAST_TIME.get(resId);
if (lastToastTime != null && (lastToastTime + TOAST_MIN_REPEAT_DELAY) < System.currentTimeMillis()) {
return;
}
Looper mainLooper = Looper.getMainLooper();
if (Thread.currentThread().equals(mainLooper.getThread())) {
LAST_TOAST_TIME.put(resId, System.currentTimeMillis());
Toast.makeText(context, resId, duration).show();
} else {
Handler handler = new Handler(mainLooper);
handler.post(new Runnable() {
@Override
public void run() {
LAST_TOAST_TIME.put(resId, System.currentTimeMillis());
Toast.makeText(context, resId, duration).show();
}
});
}
} | java | public static void toastSafely(final Context context, final int resId, final int duration) {
Long lastToastTime = LAST_TOAST_TIME.get(resId);
if (lastToastTime != null && (lastToastTime + TOAST_MIN_REPEAT_DELAY) < System.currentTimeMillis()) {
return;
}
Looper mainLooper = Looper.getMainLooper();
if (Thread.currentThread().equals(mainLooper.getThread())) {
LAST_TOAST_TIME.put(resId, System.currentTimeMillis());
Toast.makeText(context, resId, duration).show();
} else {
Handler handler = new Handler(mainLooper);
handler.post(new Runnable() {
@Override
public void run() {
LAST_TOAST_TIME.put(resId, System.currentTimeMillis());
Toast.makeText(context, resId, duration).show();
}
});
}
} | [
"public",
"static",
"void",
"toastSafely",
"(",
"final",
"Context",
"context",
",",
"final",
"int",
"resId",
",",
"final",
"int",
"duration",
")",
"{",
"Long",
"lastToastTime",
"=",
"LAST_TOAST_TIME",
".",
"get",
"(",
"resId",
")",
";",
"if",
"(",
"lastToastTime",
"!=",
"null",
"&&",
"(",
"lastToastTime",
"+",
"TOAST_MIN_REPEAT_DELAY",
")",
"<",
"System",
".",
"currentTimeMillis",
"(",
")",
")",
"{",
"return",
";",
"}",
"Looper",
"mainLooper",
"=",
"Looper",
".",
"getMainLooper",
"(",
")",
";",
"if",
"(",
"Thread",
".",
"currentThread",
"(",
")",
".",
"equals",
"(",
"mainLooper",
".",
"getThread",
"(",
")",
")",
")",
"{",
"LAST_TOAST_TIME",
".",
"put",
"(",
"resId",
",",
"System",
".",
"currentTimeMillis",
"(",
")",
")",
";",
"Toast",
".",
"makeText",
"(",
"context",
",",
"resId",
",",
"duration",
")",
".",
"show",
"(",
")",
";",
"}",
"else",
"{",
"Handler",
"handler",
"=",
"new",
"Handler",
"(",
"mainLooper",
")",
";",
"handler",
".",
"post",
"(",
"new",
"Runnable",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"run",
"(",
")",
"{",
"LAST_TOAST_TIME",
".",
"put",
"(",
"resId",
",",
"System",
".",
"currentTimeMillis",
"(",
")",
")",
";",
"Toast",
".",
"makeText",
"(",
"context",
",",
"resId",
",",
"duration",
")",
".",
"show",
"(",
")",
";",
"}",
"}",
")",
";",
"}",
"}"
] | Helper method for showing a toast message checking to see if user is on ui thread, and not showing the
same toast if it has already been shown within TOAST_MIN_REPEAT_DELAY time.
@param context current context.
@param resId string resource id to display.
@param duration Toast.LENGTH_LONG or Toast.LENGTH_SHORT. | [
"Helper",
"method",
"for",
"showing",
"a",
"toast",
"message",
"checking",
"to",
"see",
"if",
"user",
"is",
"on",
"ui",
"thread",
"and",
"not",
"showing",
"the",
"same",
"toast",
"if",
"it",
"has",
"already",
"been",
"shown",
"within",
"TOAST_MIN_REPEAT_DELAY",
"time",
"."
] | train | https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/utils/SdkUtils.java#L523-L542 |
opendatatrentino/s-match | src/main/java/it/unitn/disi/smatch/filters/SPSMMappingFilter.java | SPSMMappingFilter.setStrongestMapping | private void setStrongestMapping(INode source, INode target) {
"""
Sets the relation between source and target as the strongest in the temp, setting all the other relations
for the same source as IDK if the relations are weaker.
@param source source node
@param target target node
"""
//if it's structure preserving
if (isSameStructure(source, target)) {
spsmMapping.setRelation(source, target, defautlMappings.getRelation(source, target));
//deletes all the less precedent relations for the same source node
for (INode node : defautlMappings.getTargetContext().getNodesList()) {
//if its not the target of the mapping elements and the relation is weaker
if (source != node && defautlMappings.getRelation(source, node) != IMappingElement.IDK
&& isPrecedent(defautlMappings.getRelation(source, target), defautlMappings.getRelation(source, node))) {
defautlMappings.setRelation(source, node, IMappingElement.IDK);
}
}
//deletes all the less precedent relations for the same target node
for (INode node : defautlMappings.getSourceContext().getNodesList()) {
if (target != node) {
defautlMappings.setRelation(node, target, IMappingElement.IDK);
}
}
} else {
//the elements are not in the same structure, look for the correct relation
computeStrongestMappingForSource(source);
}
} | java | private void setStrongestMapping(INode source, INode target) {
//if it's structure preserving
if (isSameStructure(source, target)) {
spsmMapping.setRelation(source, target, defautlMappings.getRelation(source, target));
//deletes all the less precedent relations for the same source node
for (INode node : defautlMappings.getTargetContext().getNodesList()) {
//if its not the target of the mapping elements and the relation is weaker
if (source != node && defautlMappings.getRelation(source, node) != IMappingElement.IDK
&& isPrecedent(defautlMappings.getRelation(source, target), defautlMappings.getRelation(source, node))) {
defautlMappings.setRelation(source, node, IMappingElement.IDK);
}
}
//deletes all the less precedent relations for the same target node
for (INode node : defautlMappings.getSourceContext().getNodesList()) {
if (target != node) {
defautlMappings.setRelation(node, target, IMappingElement.IDK);
}
}
} else {
//the elements are not in the same structure, look for the correct relation
computeStrongestMappingForSource(source);
}
} | [
"private",
"void",
"setStrongestMapping",
"(",
"INode",
"source",
",",
"INode",
"target",
")",
"{",
"//if it's structure preserving\r",
"if",
"(",
"isSameStructure",
"(",
"source",
",",
"target",
")",
")",
"{",
"spsmMapping",
".",
"setRelation",
"(",
"source",
",",
"target",
",",
"defautlMappings",
".",
"getRelation",
"(",
"source",
",",
"target",
")",
")",
";",
"//deletes all the less precedent relations for the same source node\r",
"for",
"(",
"INode",
"node",
":",
"defautlMappings",
".",
"getTargetContext",
"(",
")",
".",
"getNodesList",
"(",
")",
")",
"{",
"//if its not the target of the mapping elements and the relation is weaker\r",
"if",
"(",
"source",
"!=",
"node",
"&&",
"defautlMappings",
".",
"getRelation",
"(",
"source",
",",
"node",
")",
"!=",
"IMappingElement",
".",
"IDK",
"&&",
"isPrecedent",
"(",
"defautlMappings",
".",
"getRelation",
"(",
"source",
",",
"target",
")",
",",
"defautlMappings",
".",
"getRelation",
"(",
"source",
",",
"node",
")",
")",
")",
"{",
"defautlMappings",
".",
"setRelation",
"(",
"source",
",",
"node",
",",
"IMappingElement",
".",
"IDK",
")",
";",
"}",
"}",
"//deletes all the less precedent relations for the same target node\r",
"for",
"(",
"INode",
"node",
":",
"defautlMappings",
".",
"getSourceContext",
"(",
")",
".",
"getNodesList",
"(",
")",
")",
"{",
"if",
"(",
"target",
"!=",
"node",
")",
"{",
"defautlMappings",
".",
"setRelation",
"(",
"node",
",",
"target",
",",
"IMappingElement",
".",
"IDK",
")",
";",
"}",
"}",
"}",
"else",
"{",
"//the elements are not in the same structure, look for the correct relation\r",
"computeStrongestMappingForSource",
"(",
"source",
")",
";",
"}",
"}"
] | Sets the relation between source and target as the strongest in the temp, setting all the other relations
for the same source as IDK if the relations are weaker.
@param source source node
@param target target node | [
"Sets",
"the",
"relation",
"between",
"source",
"and",
"target",
"as",
"the",
"strongest",
"in",
"the",
"temp",
"setting",
"all",
"the",
"other",
"relations",
"for",
"the",
"same",
"source",
"as",
"IDK",
"if",
"the",
"relations",
"are",
"weaker",
"."
] | train | https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/filters/SPSMMappingFilter.java#L271-L295 |
phax/ph-oton | ph-oton-uictrls/src/main/java/com/helger/photon/uictrls/fineupload5/FineUploader5Session.java | FineUploader5Session.addCustomHeader | @Nonnull
public FineUploader5Session addCustomHeader (@Nonnull @Nonempty final String sKey, @Nonnull final String sValue) {
"""
Any additional headers you would like included with the GET request sent to
your server. Ignored in IE9 and IE8 if the endpoint is cross-origin.
@param sKey
Custom header name
@param sValue
Custom header value
@return this
"""
ValueEnforcer.notEmpty (sKey, "Key");
ValueEnforcer.notNull (sValue, "Value");
m_aSessionCustomHeaders.put (sKey, sValue);
return this;
} | java | @Nonnull
public FineUploader5Session addCustomHeader (@Nonnull @Nonempty final String sKey, @Nonnull final String sValue)
{
ValueEnforcer.notEmpty (sKey, "Key");
ValueEnforcer.notNull (sValue, "Value");
m_aSessionCustomHeaders.put (sKey, sValue);
return this;
} | [
"@",
"Nonnull",
"public",
"FineUploader5Session",
"addCustomHeader",
"(",
"@",
"Nonnull",
"@",
"Nonempty",
"final",
"String",
"sKey",
",",
"@",
"Nonnull",
"final",
"String",
"sValue",
")",
"{",
"ValueEnforcer",
".",
"notEmpty",
"(",
"sKey",
",",
"\"Key\"",
")",
";",
"ValueEnforcer",
".",
"notNull",
"(",
"sValue",
",",
"\"Value\"",
")",
";",
"m_aSessionCustomHeaders",
".",
"put",
"(",
"sKey",
",",
"sValue",
")",
";",
"return",
"this",
";",
"}"
] | Any additional headers you would like included with the GET request sent to
your server. Ignored in IE9 and IE8 if the endpoint is cross-origin.
@param sKey
Custom header name
@param sValue
Custom header value
@return this | [
"Any",
"additional",
"headers",
"you",
"would",
"like",
"included",
"with",
"the",
"GET",
"request",
"sent",
"to",
"your",
"server",
".",
"Ignored",
"in",
"IE9",
"and",
"IE8",
"if",
"the",
"endpoint",
"is",
"cross",
"-",
"origin",
"."
] | train | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-uictrls/src/main/java/com/helger/photon/uictrls/fineupload5/FineUploader5Session.java#L96-L104 |
ow2-chameleon/fuchsia | bases/knx/calimero/src/main/java/tuwien/auto/calimero/dptxlator/DPTXlator.java | DPTXlator.setTypeID | protected void setTypeID(Map availableTypes, String dptID) throws KNXFormatException {
"""
Sets the DPT for the translator to use for translation, doing a lookup before in
the translator's map containing the available, implemented datapoint types.
<p>
@param availableTypes map of the translator with available, implemented DPTs; the
map key is a dptID string, map value is of type {@link DPT}
@param dptID the ID as string of the datapoint type to set
@throws KNXFormatException on DPT not available
"""
final DPT t = (DPT) availableTypes.get(dptID);
if (t == null) {
// don't call logThrow since dpt is not set yet
final String s = "DPT " + dptID + " is not available";
logger.warn(s);
throw new KNXFormatException(s, dptID);
}
dpt = t;
} | java | protected void setTypeID(Map availableTypes, String dptID) throws KNXFormatException
{
final DPT t = (DPT) availableTypes.get(dptID);
if (t == null) {
// don't call logThrow since dpt is not set yet
final String s = "DPT " + dptID + " is not available";
logger.warn(s);
throw new KNXFormatException(s, dptID);
}
dpt = t;
} | [
"protected",
"void",
"setTypeID",
"(",
"Map",
"availableTypes",
",",
"String",
"dptID",
")",
"throws",
"KNXFormatException",
"{",
"final",
"DPT",
"t",
"=",
"(",
"DPT",
")",
"availableTypes",
".",
"get",
"(",
"dptID",
")",
";",
"if",
"(",
"t",
"==",
"null",
")",
"{",
"// don't call logThrow since dpt is not set yet\r",
"final",
"String",
"s",
"=",
"\"DPT \"",
"+",
"dptID",
"+",
"\" is not available\"",
";",
"logger",
".",
"warn",
"(",
"s",
")",
";",
"throw",
"new",
"KNXFormatException",
"(",
"s",
",",
"dptID",
")",
";",
"}",
"dpt",
"=",
"t",
";",
"}"
] | Sets the DPT for the translator to use for translation, doing a lookup before in
the translator's map containing the available, implemented datapoint types.
<p>
@param availableTypes map of the translator with available, implemented DPTs; the
map key is a dptID string, map value is of type {@link DPT}
@param dptID the ID as string of the datapoint type to set
@throws KNXFormatException on DPT not available | [
"Sets",
"the",
"DPT",
"for",
"the",
"translator",
"to",
"use",
"for",
"translation",
"doing",
"a",
"lookup",
"before",
"in",
"the",
"translator",
"s",
"map",
"containing",
"the",
"available",
"implemented",
"datapoint",
"types",
".",
"<p",
">"
] | train | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/bases/knx/calimero/src/main/java/tuwien/auto/calimero/dptxlator/DPTXlator.java#L405-L415 |
apache/flink | flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/operator/CepOperator.java | CepOperator.processEvent | private void processEvent(NFAState nfaState, IN event, long timestamp) throws Exception {
"""
Process the given event by giving it to the NFA and outputting the produced set of matched
event sequences.
@param nfaState Our NFAState object
@param event The current event to be processed
@param timestamp The timestamp of the event
"""
try (SharedBufferAccessor<IN> sharedBufferAccessor = partialMatches.getAccessor()) {
Collection<Map<String, List<IN>>> patterns =
nfa.process(sharedBufferAccessor, nfaState, event, timestamp, afterMatchSkipStrategy, cepTimerService);
processMatchedSequences(patterns, timestamp);
}
} | java | private void processEvent(NFAState nfaState, IN event, long timestamp) throws Exception {
try (SharedBufferAccessor<IN> sharedBufferAccessor = partialMatches.getAccessor()) {
Collection<Map<String, List<IN>>> patterns =
nfa.process(sharedBufferAccessor, nfaState, event, timestamp, afterMatchSkipStrategy, cepTimerService);
processMatchedSequences(patterns, timestamp);
}
} | [
"private",
"void",
"processEvent",
"(",
"NFAState",
"nfaState",
",",
"IN",
"event",
",",
"long",
"timestamp",
")",
"throws",
"Exception",
"{",
"try",
"(",
"SharedBufferAccessor",
"<",
"IN",
">",
"sharedBufferAccessor",
"=",
"partialMatches",
".",
"getAccessor",
"(",
")",
")",
"{",
"Collection",
"<",
"Map",
"<",
"String",
",",
"List",
"<",
"IN",
">",
">",
">",
"patterns",
"=",
"nfa",
".",
"process",
"(",
"sharedBufferAccessor",
",",
"nfaState",
",",
"event",
",",
"timestamp",
",",
"afterMatchSkipStrategy",
",",
"cepTimerService",
")",
";",
"processMatchedSequences",
"(",
"patterns",
",",
"timestamp",
")",
";",
"}",
"}"
] | Process the given event by giving it to the NFA and outputting the produced set of matched
event sequences.
@param nfaState Our NFAState object
@param event The current event to be processed
@param timestamp The timestamp of the event | [
"Process",
"the",
"given",
"event",
"by",
"giving",
"it",
"to",
"the",
"NFA",
"and",
"outputting",
"the",
"produced",
"set",
"of",
"matched",
"event",
"sequences",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/operator/CepOperator.java#L422-L428 |
datasalt/pangool | core/src/main/java/com/datasalt/pangool/tuplemr/mapred/lib/input/PangoolMultipleInputs.java | PangoolMultipleInputs.addInputContext | public static void addInputContext(Job job, String inputName, String key, String value, int inputId) {
"""
Specific (key, value) configurations for each Input. Some Input Formats
read specific configuration values and act based on them.
"""
// Check that this named output has been configured before
Configuration conf = job.getConfiguration();
// Add specific configuration
conf.set(MI_PREFIX + inputName + "." + inputId + CONF + "." + key, value);
} | java | public static void addInputContext(Job job, String inputName, String key, String value, int inputId) {
// Check that this named output has been configured before
Configuration conf = job.getConfiguration();
// Add specific configuration
conf.set(MI_PREFIX + inputName + "." + inputId + CONF + "." + key, value);
} | [
"public",
"static",
"void",
"addInputContext",
"(",
"Job",
"job",
",",
"String",
"inputName",
",",
"String",
"key",
",",
"String",
"value",
",",
"int",
"inputId",
")",
"{",
"// Check that this named output has been configured before",
"Configuration",
"conf",
"=",
"job",
".",
"getConfiguration",
"(",
")",
";",
"// Add specific configuration",
"conf",
".",
"set",
"(",
"MI_PREFIX",
"+",
"inputName",
"+",
"\".\"",
"+",
"inputId",
"+",
"CONF",
"+",
"\".\"",
"+",
"key",
",",
"value",
")",
";",
"}"
] | Specific (key, value) configurations for each Input. Some Input Formats
read specific configuration values and act based on them. | [
"Specific",
"(",
"key",
"value",
")",
"configurations",
"for",
"each",
"Input",
".",
"Some",
"Input",
"Formats",
"read",
"specific",
"configuration",
"values",
"and",
"act",
"based",
"on",
"them",
"."
] | train | https://github.com/datasalt/pangool/blob/bfd312dd78cba03febaf7988ae96a3d4bc585408/core/src/main/java/com/datasalt/pangool/tuplemr/mapred/lib/input/PangoolMultipleInputs.java#L170-L175 |
netty/netty | codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostRequestEncoder.java | HttpPostRequestEncoder.encodeAttribute | @SuppressWarnings("unchecked")
private String encodeAttribute(String s, Charset charset) throws ErrorDataEncoderException {
"""
Encode one attribute
@return the encoded attribute
@throws ErrorDataEncoderException
if the encoding is in error
"""
if (s == null) {
return "";
}
try {
String encoded = URLEncoder.encode(s, charset.name());
if (encoderMode == EncoderMode.RFC3986) {
for (Map.Entry<Pattern, String> entry : percentEncodings) {
String replacement = entry.getValue();
encoded = entry.getKey().matcher(encoded).replaceAll(replacement);
}
}
return encoded;
} catch (UnsupportedEncodingException e) {
throw new ErrorDataEncoderException(charset.name(), e);
}
} | java | @SuppressWarnings("unchecked")
private String encodeAttribute(String s, Charset charset) throws ErrorDataEncoderException {
if (s == null) {
return "";
}
try {
String encoded = URLEncoder.encode(s, charset.name());
if (encoderMode == EncoderMode.RFC3986) {
for (Map.Entry<Pattern, String> entry : percentEncodings) {
String replacement = entry.getValue();
encoded = entry.getKey().matcher(encoded).replaceAll(replacement);
}
}
return encoded;
} catch (UnsupportedEncodingException e) {
throw new ErrorDataEncoderException(charset.name(), e);
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"String",
"encodeAttribute",
"(",
"String",
"s",
",",
"Charset",
"charset",
")",
"throws",
"ErrorDataEncoderException",
"{",
"if",
"(",
"s",
"==",
"null",
")",
"{",
"return",
"\"\"",
";",
"}",
"try",
"{",
"String",
"encoded",
"=",
"URLEncoder",
".",
"encode",
"(",
"s",
",",
"charset",
".",
"name",
"(",
")",
")",
";",
"if",
"(",
"encoderMode",
"==",
"EncoderMode",
".",
"RFC3986",
")",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"Pattern",
",",
"String",
">",
"entry",
":",
"percentEncodings",
")",
"{",
"String",
"replacement",
"=",
"entry",
".",
"getValue",
"(",
")",
";",
"encoded",
"=",
"entry",
".",
"getKey",
"(",
")",
".",
"matcher",
"(",
"encoded",
")",
".",
"replaceAll",
"(",
"replacement",
")",
";",
"}",
"}",
"return",
"encoded",
";",
"}",
"catch",
"(",
"UnsupportedEncodingException",
"e",
")",
"{",
"throw",
"new",
"ErrorDataEncoderException",
"(",
"charset",
".",
"name",
"(",
")",
",",
"e",
")",
";",
"}",
"}"
] | Encode one attribute
@return the encoded attribute
@throws ErrorDataEncoderException
if the encoding is in error | [
"Encode",
"one",
"attribute"
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostRequestEncoder.java#L836-L853 |
UrielCh/ovh-java-sdk | ovh-java-sdk-packxdsl/src/main/java/net/minidev/ovh/api/ApiOvhPackxdsl.java | ApiOvhPackxdsl.packName_addressMove_move_POST | public OvhAsyncTask<Long> packName_addressMove_move_POST(String packName, OvhCreation creation, Boolean keepCurrentNumber, OvhLandline landline, Date moveOutDate, String offerCode, OvhProviderEnum provider) throws IOException {
"""
Move the access to another address
REST: POST /pack/xdsl/{packName}/addressMove/move
@param moveOutDate [required] The date when the customer is no longer at the current address. Must be between now and +30 days
@param offerCode [required] The offerCode from addressMove/eligibility
@param keepCurrentNumber [required] Whether or not the current number should be kept
@param creation [required] The data to create a new line if lineNumber is not available
@param landline [required] Data identifying the landline at the new address, if available
@param provider [required] Provider of the new line
@param packName [required] The internal name of your pack
"""
String qPath = "/pack/xdsl/{packName}/addressMove/move";
StringBuilder sb = path(qPath, packName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "creation", creation);
addBody(o, "keepCurrentNumber", keepCurrentNumber);
addBody(o, "landline", landline);
addBody(o, "moveOutDate", moveOutDate);
addBody(o, "offerCode", offerCode);
addBody(o, "provider", provider);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, t7);
} | java | public OvhAsyncTask<Long> packName_addressMove_move_POST(String packName, OvhCreation creation, Boolean keepCurrentNumber, OvhLandline landline, Date moveOutDate, String offerCode, OvhProviderEnum provider) throws IOException {
String qPath = "/pack/xdsl/{packName}/addressMove/move";
StringBuilder sb = path(qPath, packName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "creation", creation);
addBody(o, "keepCurrentNumber", keepCurrentNumber);
addBody(o, "landline", landline);
addBody(o, "moveOutDate", moveOutDate);
addBody(o, "offerCode", offerCode);
addBody(o, "provider", provider);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, t7);
} | [
"public",
"OvhAsyncTask",
"<",
"Long",
">",
"packName_addressMove_move_POST",
"(",
"String",
"packName",
",",
"OvhCreation",
"creation",
",",
"Boolean",
"keepCurrentNumber",
",",
"OvhLandline",
"landline",
",",
"Date",
"moveOutDate",
",",
"String",
"offerCode",
",",
"OvhProviderEnum",
"provider",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/pack/xdsl/{packName}/addressMove/move\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"packName",
")",
";",
"HashMap",
"<",
"String",
",",
"Object",
">",
"o",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"addBody",
"(",
"o",
",",
"\"creation\"",
",",
"creation",
")",
";",
"addBody",
"(",
"o",
",",
"\"keepCurrentNumber\"",
",",
"keepCurrentNumber",
")",
";",
"addBody",
"(",
"o",
",",
"\"landline\"",
",",
"landline",
")",
";",
"addBody",
"(",
"o",
",",
"\"moveOutDate\"",
",",
"moveOutDate",
")",
";",
"addBody",
"(",
"o",
",",
"\"offerCode\"",
",",
"offerCode",
")",
";",
"addBody",
"(",
"o",
",",
"\"provider\"",
",",
"provider",
")",
";",
"String",
"resp",
"=",
"exec",
"(",
"qPath",
",",
"\"POST\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"o",
")",
";",
"return",
"convertTo",
"(",
"resp",
",",
"t7",
")",
";",
"}"
] | Move the access to another address
REST: POST /pack/xdsl/{packName}/addressMove/move
@param moveOutDate [required] The date when the customer is no longer at the current address. Must be between now and +30 days
@param offerCode [required] The offerCode from addressMove/eligibility
@param keepCurrentNumber [required] Whether or not the current number should be kept
@param creation [required] The data to create a new line if lineNumber is not available
@param landline [required] Data identifying the landline at the new address, if available
@param provider [required] Provider of the new line
@param packName [required] The internal name of your pack | [
"Move",
"the",
"access",
"to",
"another",
"address"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-packxdsl/src/main/java/net/minidev/ovh/api/ApiOvhPackxdsl.java#L364-L376 |
aws/aws-sdk-java | aws-java-sdk-glue/src/main/java/com/amazonaws/services/glue/model/UpdateDevEndpointRequest.java | UpdateDevEndpointRequest.withAddArguments | public UpdateDevEndpointRequest withAddArguments(java.util.Map<String, String> addArguments) {
"""
<p>
The map of arguments to add the map of arguments used to configure the DevEndpoint.
</p>
@param addArguments
The map of arguments to add the map of arguments used to configure the DevEndpoint.
@return Returns a reference to this object so that method calls can be chained together.
"""
setAddArguments(addArguments);
return this;
} | java | public UpdateDevEndpointRequest withAddArguments(java.util.Map<String, String> addArguments) {
setAddArguments(addArguments);
return this;
} | [
"public",
"UpdateDevEndpointRequest",
"withAddArguments",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"addArguments",
")",
"{",
"setAddArguments",
"(",
"addArguments",
")",
";",
"return",
"this",
";",
"}"
] | <p>
The map of arguments to add the map of arguments used to configure the DevEndpoint.
</p>
@param addArguments
The map of arguments to add the map of arguments used to configure the DevEndpoint.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"The",
"map",
"of",
"arguments",
"to",
"add",
"the",
"map",
"of",
"arguments",
"used",
"to",
"configure",
"the",
"DevEndpoint",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-glue/src/main/java/com/amazonaws/services/glue/model/UpdateDevEndpointRequest.java#L503-L506 |
j-easy/easy-random | easy-random-core/src/main/java/org/jeasy/random/randomizers/range/FloatRangeRandomizer.java | FloatRangeRandomizer.aNewFloatRangeRandomizer | public static FloatRangeRandomizer aNewFloatRangeRandomizer(final Float min, final Float max, final long seed) {
"""
Create a new {@link FloatRangeRandomizer}.
@param min min value
@param max max value
@param seed initial seed
@return a new {@link FloatRangeRandomizer}.
"""
return new FloatRangeRandomizer(min, max, seed);
} | java | public static FloatRangeRandomizer aNewFloatRangeRandomizer(final Float min, final Float max, final long seed) {
return new FloatRangeRandomizer(min, max, seed);
} | [
"public",
"static",
"FloatRangeRandomizer",
"aNewFloatRangeRandomizer",
"(",
"final",
"Float",
"min",
",",
"final",
"Float",
"max",
",",
"final",
"long",
"seed",
")",
"{",
"return",
"new",
"FloatRangeRandomizer",
"(",
"min",
",",
"max",
",",
"seed",
")",
";",
"}"
] | Create a new {@link FloatRangeRandomizer}.
@param min min value
@param max max value
@param seed initial seed
@return a new {@link FloatRangeRandomizer}. | [
"Create",
"a",
"new",
"{",
"@link",
"FloatRangeRandomizer",
"}",
"."
] | train | https://github.com/j-easy/easy-random/blob/816b0d6a74c7288af111e70ae1b0b57d7fe3b59d/easy-random-core/src/main/java/org/jeasy/random/randomizers/range/FloatRangeRandomizer.java#L90-L92 |
querydsl/querydsl | querydsl-core/src/main/java/com/querydsl/core/types/ExpressionUtils.java | ExpressionUtils.toLower | public static Expression<String> toLower(Expression<String> stringExpression) {
"""
Converts the given expression to lower(expression)
<p>Constants are lower()ed at creation time</p>
@param stringExpression the string to lower()
@return lower(stringExpression)
"""
if (stringExpression instanceof Constant) {
Constant<String> constantExpression = (Constant<String>) stringExpression;
return ConstantImpl.create(constantExpression.getConstant().toLowerCase());
} else {
return operation(String.class, Ops.LOWER, stringExpression);
}
} | java | public static Expression<String> toLower(Expression<String> stringExpression) {
if (stringExpression instanceof Constant) {
Constant<String> constantExpression = (Constant<String>) stringExpression;
return ConstantImpl.create(constantExpression.getConstant().toLowerCase());
} else {
return operation(String.class, Ops.LOWER, stringExpression);
}
} | [
"public",
"static",
"Expression",
"<",
"String",
">",
"toLower",
"(",
"Expression",
"<",
"String",
">",
"stringExpression",
")",
"{",
"if",
"(",
"stringExpression",
"instanceof",
"Constant",
")",
"{",
"Constant",
"<",
"String",
">",
"constantExpression",
"=",
"(",
"Constant",
"<",
"String",
">",
")",
"stringExpression",
";",
"return",
"ConstantImpl",
".",
"create",
"(",
"constantExpression",
".",
"getConstant",
"(",
")",
".",
"toLowerCase",
"(",
")",
")",
";",
"}",
"else",
"{",
"return",
"operation",
"(",
"String",
".",
"class",
",",
"Ops",
".",
"LOWER",
",",
"stringExpression",
")",
";",
"}",
"}"
] | Converts the given expression to lower(expression)
<p>Constants are lower()ed at creation time</p>
@param stringExpression the string to lower()
@return lower(stringExpression) | [
"Converts",
"the",
"given",
"expression",
"to",
"lower",
"(",
"expression",
")"
] | train | https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-core/src/main/java/com/querydsl/core/types/ExpressionUtils.java#L900-L907 |
alkacon/opencms-core | src-gwt/org/opencms/gwt/client/util/impl/DocumentStyleImpl.java | DocumentStyleImpl.getCurrentStyle | public String getCurrentStyle(Element elem, String name) {
"""
Returns the computed style of the given element.<p>
@param elem the element
@param name the name of the CSS property
@return the currently computed style
"""
name = hyphenize(name);
String propVal = getComputedStyle(elem, name);
if (CmsDomUtil.Style.opacity.name().equals(name) && ((propVal == null) || (propVal.trim().length() == 0))) {
propVal = "1";
}
return propVal;
} | java | public String getCurrentStyle(Element elem, String name) {
name = hyphenize(name);
String propVal = getComputedStyle(elem, name);
if (CmsDomUtil.Style.opacity.name().equals(name) && ((propVal == null) || (propVal.trim().length() == 0))) {
propVal = "1";
}
return propVal;
} | [
"public",
"String",
"getCurrentStyle",
"(",
"Element",
"elem",
",",
"String",
"name",
")",
"{",
"name",
"=",
"hyphenize",
"(",
"name",
")",
";",
"String",
"propVal",
"=",
"getComputedStyle",
"(",
"elem",
",",
"name",
")",
";",
"if",
"(",
"CmsDomUtil",
".",
"Style",
".",
"opacity",
".",
"name",
"(",
")",
".",
"equals",
"(",
"name",
")",
"&&",
"(",
"(",
"propVal",
"==",
"null",
")",
"||",
"(",
"propVal",
".",
"trim",
"(",
")",
".",
"length",
"(",
")",
"==",
"0",
")",
")",
")",
"{",
"propVal",
"=",
"\"1\"",
";",
"}",
"return",
"propVal",
";",
"}"
] | Returns the computed style of the given element.<p>
@param elem the element
@param name the name of the CSS property
@return the currently computed style | [
"Returns",
"the",
"computed",
"style",
"of",
"the",
"given",
"element",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/util/impl/DocumentStyleImpl.java#L73-L81 |
pressgang-ccms/PressGangCCMSBuilder | src/main/java/org/jboss/pressgang/ccms/contentspec/builder/DocBookXMLPreProcessor.java | DocBookXMLPreProcessor.processPrerequisiteInjections | public void processPrerequisiteInjections(final SpecNodeWithRelationships specNode, final Document doc, final boolean useFixedUrls) {
"""
Insert a itemized list into the start of the topic, below the title with any PREREQUISITE relationships that exists for
the Spec Topic. The title for the list is set to the "PREREQUISITE" property or "Prerequisites:" by default.
@param specNode The content spec node to process the injection for.
@param doc The DOM Document object that represents the topics XML.
@param useFixedUrls Whether fixed URL's should be used in the injected links.
"""
processPrerequisiteInjections(specNode, doc, doc.getDocumentElement(), useFixedUrls);
} | java | public void processPrerequisiteInjections(final SpecNodeWithRelationships specNode, final Document doc, final boolean useFixedUrls) {
processPrerequisiteInjections(specNode, doc, doc.getDocumentElement(), useFixedUrls);
} | [
"public",
"void",
"processPrerequisiteInjections",
"(",
"final",
"SpecNodeWithRelationships",
"specNode",
",",
"final",
"Document",
"doc",
",",
"final",
"boolean",
"useFixedUrls",
")",
"{",
"processPrerequisiteInjections",
"(",
"specNode",
",",
"doc",
",",
"doc",
".",
"getDocumentElement",
"(",
")",
",",
"useFixedUrls",
")",
";",
"}"
] | Insert a itemized list into the start of the topic, below the title with any PREREQUISITE relationships that exists for
the Spec Topic. The title for the list is set to the "PREREQUISITE" property or "Prerequisites:" by default.
@param specNode The content spec node to process the injection for.
@param doc The DOM Document object that represents the topics XML.
@param useFixedUrls Whether fixed URL's should be used in the injected links. | [
"Insert",
"a",
"itemized",
"list",
"into",
"the",
"start",
"of",
"the",
"topic",
"below",
"the",
"title",
"with",
"any",
"PREREQUISITE",
"relationships",
"that",
"exists",
"for",
"the",
"Spec",
"Topic",
".",
"The",
"title",
"for",
"the",
"list",
"is",
"set",
"to",
"the",
"PREREQUISITE",
"property",
"or",
"Prerequisites",
":",
"by",
"default",
"."
] | train | https://github.com/pressgang-ccms/PressGangCCMSBuilder/blob/5436d36ba1b3c5baa246b270e5fc350e6778bce8/src/main/java/org/jboss/pressgang/ccms/contentspec/builder/DocBookXMLPreProcessor.java#L875-L877 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ListManagementImagesImpl.java | ListManagementImagesImpl.addImageUrlInput | public Image addImageUrlInput(String listId, String contentType, BodyModelModel imageUrl, AddImageUrlInputOptionalParameter addImageUrlInputOptionalParameter) {
"""
Add an image to the list with list Id equal to list Id passed.
@param listId List Id of the image list.
@param contentType The content type.
@param imageUrl The image url.
@param addImageUrlInputOptionalParameter the object representing the optional parameters to be set before calling this API
@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 Image object if successful.
"""
return addImageUrlInputWithServiceResponseAsync(listId, contentType, imageUrl, addImageUrlInputOptionalParameter).toBlocking().single().body();
} | java | public Image addImageUrlInput(String listId, String contentType, BodyModelModel imageUrl, AddImageUrlInputOptionalParameter addImageUrlInputOptionalParameter) {
return addImageUrlInputWithServiceResponseAsync(listId, contentType, imageUrl, addImageUrlInputOptionalParameter).toBlocking().single().body();
} | [
"public",
"Image",
"addImageUrlInput",
"(",
"String",
"listId",
",",
"String",
"contentType",
",",
"BodyModelModel",
"imageUrl",
",",
"AddImageUrlInputOptionalParameter",
"addImageUrlInputOptionalParameter",
")",
"{",
"return",
"addImageUrlInputWithServiceResponseAsync",
"(",
"listId",
",",
"contentType",
",",
"imageUrl",
",",
"addImageUrlInputOptionalParameter",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
] | Add an image to the list with list Id equal to list Id passed.
@param listId List Id of the image list.
@param contentType The content type.
@param imageUrl The image url.
@param addImageUrlInputOptionalParameter the object representing the optional parameters to be set before calling this API
@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 Image object if successful. | [
"Add",
"an",
"image",
"to",
"the",
"list",
"with",
"list",
"Id",
"equal",
"to",
"list",
"Id",
"passed",
"."
] | 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/ListManagementImagesImpl.java#L505-L507 |
beihaifeiwu/dolphin | dolphin-common/src/main/java/com/freetmp/common/annotation/AnnotationUtils.java | AnnotationUtils.getAnnotation | public static <A extends Annotation> A getAnnotation(Method method, Class<A> annotationType) {
"""
Get a single {@link Annotation} of {@code annotationType} from the supplied {@link Method}.
<p>Correctly handles bridge {@link Method Methods} generated by the compiler.
@param method the method to look for annotations on
@param annotationType the annotation type to look for
@return the annotations found
"""
Method resolvedMethod = BridgeMethodResolver.findBridgedMethod(method);
return getAnnotation((AnnotatedElement) resolvedMethod, annotationType);
} | java | public static <A extends Annotation> A getAnnotation(Method method, Class<A> annotationType) {
Method resolvedMethod = BridgeMethodResolver.findBridgedMethod(method);
return getAnnotation((AnnotatedElement) resolvedMethod, annotationType);
} | [
"public",
"static",
"<",
"A",
"extends",
"Annotation",
">",
"A",
"getAnnotation",
"(",
"Method",
"method",
",",
"Class",
"<",
"A",
">",
"annotationType",
")",
"{",
"Method",
"resolvedMethod",
"=",
"BridgeMethodResolver",
".",
"findBridgedMethod",
"(",
"method",
")",
";",
"return",
"getAnnotation",
"(",
"(",
"AnnotatedElement",
")",
"resolvedMethod",
",",
"annotationType",
")",
";",
"}"
] | Get a single {@link Annotation} of {@code annotationType} from the supplied {@link Method}.
<p>Correctly handles bridge {@link Method Methods} generated by the compiler.
@param method the method to look for annotations on
@param annotationType the annotation type to look for
@return the annotations found | [
"Get",
"a",
"single",
"{"
] | train | https://github.com/beihaifeiwu/dolphin/blob/b100579cc6986dce5eba5593ebb5fbae7bad9d1a/dolphin-common/src/main/java/com/freetmp/common/annotation/AnnotationUtils.java#L169-L172 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/SimpleTableModel.java | SimpleTableModel.setComparator | public void setComparator(final int col, final Comparator comparator) {
"""
Sets the comparator for the given column, to enable sorting.
@param col the column to set the comparator on.
@param comparator the comparator to set.
"""
synchronized (this) {
if (comparators == null) {
comparators = new HashMap<>();
}
}
if (comparator == null) {
comparators.remove(col);
} else {
comparators.put(col, comparator);
}
} | java | public void setComparator(final int col, final Comparator comparator) {
synchronized (this) {
if (comparators == null) {
comparators = new HashMap<>();
}
}
if (comparator == null) {
comparators.remove(col);
} else {
comparators.put(col, comparator);
}
} | [
"public",
"void",
"setComparator",
"(",
"final",
"int",
"col",
",",
"final",
"Comparator",
"comparator",
")",
"{",
"synchronized",
"(",
"this",
")",
"{",
"if",
"(",
"comparators",
"==",
"null",
")",
"{",
"comparators",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"}",
"}",
"if",
"(",
"comparator",
"==",
"null",
")",
"{",
"comparators",
".",
"remove",
"(",
"col",
")",
";",
"}",
"else",
"{",
"comparators",
".",
"put",
"(",
"col",
",",
"comparator",
")",
";",
"}",
"}"
] | Sets the comparator for the given column, to enable sorting.
@param col the column to set the comparator on.
@param comparator the comparator to set. | [
"Sets",
"the",
"comparator",
"for",
"the",
"given",
"column",
"to",
"enable",
"sorting",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/SimpleTableModel.java#L86-L98 |
TNG/JGiven | jgiven-core/src/main/java/com/tngtech/jgiven/attachment/MediaType.java | MediaType.nonBinary | public static MediaType nonBinary( MediaType.Type type, String subType, Charset charSet ) {
"""
Creates a non-binary media type with the given type, subtype, and charSet
@throws com.tngtech.jgiven.exception.JGivenWrongUsageException if any of the given arguments is {@code null}
"""
ApiUtil.notNull( charSet, "charset must not be null" );
return new MediaType( type, subType, charSet );
} | java | public static MediaType nonBinary( MediaType.Type type, String subType, Charset charSet ) {
ApiUtil.notNull( charSet, "charset must not be null" );
return new MediaType( type, subType, charSet );
} | [
"public",
"static",
"MediaType",
"nonBinary",
"(",
"MediaType",
".",
"Type",
"type",
",",
"String",
"subType",
",",
"Charset",
"charSet",
")",
"{",
"ApiUtil",
".",
"notNull",
"(",
"charSet",
",",
"\"charset must not be null\"",
")",
";",
"return",
"new",
"MediaType",
"(",
"type",
",",
"subType",
",",
"charSet",
")",
";",
"}"
] | Creates a non-binary media type with the given type, subtype, and charSet
@throws com.tngtech.jgiven.exception.JGivenWrongUsageException if any of the given arguments is {@code null} | [
"Creates",
"a",
"non",
"-",
"binary",
"media",
"type",
"with",
"the",
"given",
"type",
"subtype",
"and",
"charSet"
] | train | https://github.com/TNG/JGiven/blob/1a69248fc6d7eb380cdc4542e3be273842889748/jgiven-core/src/main/java/com/tngtech/jgiven/attachment/MediaType.java#L185-L188 |
aws/aws-sdk-java | aws-java-sdk-pinpoint/src/main/java/com/amazonaws/services/pinpoint/model/BaiduMessage.java | BaiduMessage.withSubstitutions | public BaiduMessage withSubstitutions(java.util.Map<String, java.util.List<String>> substitutions) {
"""
Default message substitutions. Can be overridden by individual address substitutions.
@param substitutions
Default message substitutions. Can be overridden by individual address substitutions.
@return Returns a reference to this object so that method calls can be chained together.
"""
setSubstitutions(substitutions);
return this;
} | java | public BaiduMessage withSubstitutions(java.util.Map<String, java.util.List<String>> substitutions) {
setSubstitutions(substitutions);
return this;
} | [
"public",
"BaiduMessage",
"withSubstitutions",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"java",
".",
"util",
".",
"List",
"<",
"String",
">",
">",
"substitutions",
")",
"{",
"setSubstitutions",
"(",
"substitutions",
")",
";",
"return",
"this",
";",
"}"
] | Default message substitutions. Can be overridden by individual address substitutions.
@param substitutions
Default message substitutions. Can be overridden by individual address substitutions.
@return Returns a reference to this object so that method calls can be chained together. | [
"Default",
"message",
"substitutions",
".",
"Can",
"be",
"overridden",
"by",
"individual",
"address",
"substitutions",
"."
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-pinpoint/src/main/java/com/amazonaws/services/pinpoint/model/BaiduMessage.java#L554-L557 |
apache/incubator-gobblin | gobblin-modules/gobblin-kafka-08/src/main/java/org/apache/gobblin/metrics/kafka/KafkaKeyValueProducerPusher.java | KafkaKeyValueProducerPusher.pushMessages | public void pushMessages(List<Pair<K, V>> messages) {
"""
Push all keyed messages to the Kafka topic.
@param messages List of keyed messages to push to Kakfa.
"""
for (Pair<K, V> message: messages) {
this.futures.offer(this.producer.send(new ProducerRecord<>(topic, message.getKey(), message.getValue()), (recordMetadata, e) -> {
if (e != null) {
log.error("Failed to send message to topic {} due to exception: ", topic, e);
}
}));
}
//Once the low watermark of numFuturesToBuffer is hit, start flushing messages from the futures
// buffer. In order to avoid blocking on newest messages added to futures queue, we only invoke future.get() on
// the oldest messages in the futures buffer. The number of messages to flush is same as the number of messages added
// in the current call. Note this does not completely avoid calling future.get() on the newer messages e.g. when
// multiple threads enter the if{} block concurrently, and invoke flush().
if (this.futures.size() >= this.numFuturesToBuffer) {
flush(messages.size());
}
} | java | public void pushMessages(List<Pair<K, V>> messages) {
for (Pair<K, V> message: messages) {
this.futures.offer(this.producer.send(new ProducerRecord<>(topic, message.getKey(), message.getValue()), (recordMetadata, e) -> {
if (e != null) {
log.error("Failed to send message to topic {} due to exception: ", topic, e);
}
}));
}
//Once the low watermark of numFuturesToBuffer is hit, start flushing messages from the futures
// buffer. In order to avoid blocking on newest messages added to futures queue, we only invoke future.get() on
// the oldest messages in the futures buffer. The number of messages to flush is same as the number of messages added
// in the current call. Note this does not completely avoid calling future.get() on the newer messages e.g. when
// multiple threads enter the if{} block concurrently, and invoke flush().
if (this.futures.size() >= this.numFuturesToBuffer) {
flush(messages.size());
}
} | [
"public",
"void",
"pushMessages",
"(",
"List",
"<",
"Pair",
"<",
"K",
",",
"V",
">",
">",
"messages",
")",
"{",
"for",
"(",
"Pair",
"<",
"K",
",",
"V",
">",
"message",
":",
"messages",
")",
"{",
"this",
".",
"futures",
".",
"offer",
"(",
"this",
".",
"producer",
".",
"send",
"(",
"new",
"ProducerRecord",
"<>",
"(",
"topic",
",",
"message",
".",
"getKey",
"(",
")",
",",
"message",
".",
"getValue",
"(",
")",
")",
",",
"(",
"recordMetadata",
",",
"e",
")",
"->",
"{",
"if",
"(",
"e",
"!=",
"null",
")",
"{",
"log",
".",
"error",
"(",
"\"Failed to send message to topic {} due to exception: \"",
",",
"topic",
",",
"e",
")",
";",
"}",
"}",
")",
")",
";",
"}",
"//Once the low watermark of numFuturesToBuffer is hit, start flushing messages from the futures",
"// buffer. In order to avoid blocking on newest messages added to futures queue, we only invoke future.get() on",
"// the oldest messages in the futures buffer. The number of messages to flush is same as the number of messages added",
"// in the current call. Note this does not completely avoid calling future.get() on the newer messages e.g. when",
"// multiple threads enter the if{} block concurrently, and invoke flush().",
"if",
"(",
"this",
".",
"futures",
".",
"size",
"(",
")",
">=",
"this",
".",
"numFuturesToBuffer",
")",
"{",
"flush",
"(",
"messages",
".",
"size",
"(",
")",
")",
";",
"}",
"}"
] | Push all keyed messages to the Kafka topic.
@param messages List of keyed messages to push to Kakfa. | [
"Push",
"all",
"keyed",
"messages",
"to",
"the",
"Kafka",
"topic",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-modules/gobblin-kafka-08/src/main/java/org/apache/gobblin/metrics/kafka/KafkaKeyValueProducerPusher.java#L99-L116 |
gallandarakhneorg/afc | advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GISCoordinates.java | GISCoordinates.L1_EL2 | @Pure
public static Point2d L1_EL2(double x, double y) {
"""
This function convert France Lambert I coordinate to
extended France Lambert II coordinate.
@param x is the coordinate in France Lambert I
@param y is the coordinate in France Lambert I
@return the extended France Lambert II coordinate.
"""
final Point2d ntfLambdaPhi = NTFLambert_NTFLambdaPhi(x, y,
LAMBERT_1_N,
LAMBERT_1_C,
LAMBERT_1_XS,
LAMBERT_1_YS);
return NTFLambdaPhi_NTFLambert(
ntfLambdaPhi.getX(), ntfLambdaPhi.getY(),
LAMBERT_2E_N,
LAMBERT_2E_C,
LAMBERT_2E_XS,
LAMBERT_2E_YS);
} | java | @Pure
public static Point2d L1_EL2(double x, double y) {
final Point2d ntfLambdaPhi = NTFLambert_NTFLambdaPhi(x, y,
LAMBERT_1_N,
LAMBERT_1_C,
LAMBERT_1_XS,
LAMBERT_1_YS);
return NTFLambdaPhi_NTFLambert(
ntfLambdaPhi.getX(), ntfLambdaPhi.getY(),
LAMBERT_2E_N,
LAMBERT_2E_C,
LAMBERT_2E_XS,
LAMBERT_2E_YS);
} | [
"@",
"Pure",
"public",
"static",
"Point2d",
"L1_EL2",
"(",
"double",
"x",
",",
"double",
"y",
")",
"{",
"final",
"Point2d",
"ntfLambdaPhi",
"=",
"NTFLambert_NTFLambdaPhi",
"(",
"x",
",",
"y",
",",
"LAMBERT_1_N",
",",
"LAMBERT_1_C",
",",
"LAMBERT_1_XS",
",",
"LAMBERT_1_YS",
")",
";",
"return",
"NTFLambdaPhi_NTFLambert",
"(",
"ntfLambdaPhi",
".",
"getX",
"(",
")",
",",
"ntfLambdaPhi",
".",
"getY",
"(",
")",
",",
"LAMBERT_2E_N",
",",
"LAMBERT_2E_C",
",",
"LAMBERT_2E_XS",
",",
"LAMBERT_2E_YS",
")",
";",
"}"
] | This function convert France Lambert I coordinate to
extended France Lambert II coordinate.
@param x is the coordinate in France Lambert I
@param y is the coordinate in France Lambert I
@return the extended France Lambert II coordinate. | [
"This",
"function",
"convert",
"France",
"Lambert",
"I",
"coordinate",
"to",
"extended",
"France",
"Lambert",
"II",
"coordinate",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GISCoordinates.java#L305-L318 |
RKumsher/utils | src/main/java/com/github/rkumsher/collection/RandomCollectionUtils.java | RandomCollectionUtils.randomListFrom | public static <T> List<T> randomListFrom(Supplier<T> elementSupplier, Range<Integer> size) {
"""
Returns a list filled from the given element supplier.
@param elementSupplier element supplier to fill list from
@param size range that the size of the list will be randomly chosen from
@param <T> the type of element the given supplier returns
@return list filled from the given element supplier
@throws IllegalArgumentException if the size range contains negative integers
"""
checkArgument(
size.hasLowerBound() && size.lowerEndpoint() >= 0,
"Size range must consist of only positive integers");
Set<Integer> rangeSet = ContiguousSet.create(size, DiscreteDomain.integers());
int limit = IterableUtils.randomFrom(rangeSet);
return randomListFrom(elementSupplier, limit);
} | java | public static <T> List<T> randomListFrom(Supplier<T> elementSupplier, Range<Integer> size) {
checkArgument(
size.hasLowerBound() && size.lowerEndpoint() >= 0,
"Size range must consist of only positive integers");
Set<Integer> rangeSet = ContiguousSet.create(size, DiscreteDomain.integers());
int limit = IterableUtils.randomFrom(rangeSet);
return randomListFrom(elementSupplier, limit);
} | [
"public",
"static",
"<",
"T",
">",
"List",
"<",
"T",
">",
"randomListFrom",
"(",
"Supplier",
"<",
"T",
">",
"elementSupplier",
",",
"Range",
"<",
"Integer",
">",
"size",
")",
"{",
"checkArgument",
"(",
"size",
".",
"hasLowerBound",
"(",
")",
"&&",
"size",
".",
"lowerEndpoint",
"(",
")",
">=",
"0",
",",
"\"Size range must consist of only positive integers\"",
")",
";",
"Set",
"<",
"Integer",
">",
"rangeSet",
"=",
"ContiguousSet",
".",
"create",
"(",
"size",
",",
"DiscreteDomain",
".",
"integers",
"(",
")",
")",
";",
"int",
"limit",
"=",
"IterableUtils",
".",
"randomFrom",
"(",
"rangeSet",
")",
";",
"return",
"randomListFrom",
"(",
"elementSupplier",
",",
"limit",
")",
";",
"}"
] | Returns a list filled from the given element supplier.
@param elementSupplier element supplier to fill list from
@param size range that the size of the list will be randomly chosen from
@param <T> the type of element the given supplier returns
@return list filled from the given element supplier
@throws IllegalArgumentException if the size range contains negative integers | [
"Returns",
"a",
"list",
"filled",
"from",
"the",
"given",
"element",
"supplier",
"."
] | train | https://github.com/RKumsher/utils/blob/fcdb190569cd0288249bf4b46fd418f8c01d1caf/src/main/java/com/github/rkumsher/collection/RandomCollectionUtils.java#L126-L133 |
apache/flink | flink-libraries/flink-streaming-python/src/main/java/org/apache/flink/streaming/python/api/datastream/PythonDataStream.java | PythonDataStream.key_by | public PythonKeyedStream key_by(KeySelector<PyObject, PyKey> selector) throws IOException {
"""
A thin wrapper layer over {@link DataStream#keyBy(KeySelector)}.
@param selector The KeySelector to be used for extracting the key for partitioning
@return The {@link PythonDataStream} with partitioned state (i.e. {@link PythonKeyedStream})
"""
return new PythonKeyedStream(stream.keyBy(new PythonKeySelector(selector)));
} | java | public PythonKeyedStream key_by(KeySelector<PyObject, PyKey> selector) throws IOException {
return new PythonKeyedStream(stream.keyBy(new PythonKeySelector(selector)));
} | [
"public",
"PythonKeyedStream",
"key_by",
"(",
"KeySelector",
"<",
"PyObject",
",",
"PyKey",
">",
"selector",
")",
"throws",
"IOException",
"{",
"return",
"new",
"PythonKeyedStream",
"(",
"stream",
".",
"keyBy",
"(",
"new",
"PythonKeySelector",
"(",
"selector",
")",
")",
")",
";",
"}"
] | A thin wrapper layer over {@link DataStream#keyBy(KeySelector)}.
@param selector The KeySelector to be used for extracting the key for partitioning
@return The {@link PythonDataStream} with partitioned state (i.e. {@link PythonKeyedStream}) | [
"A",
"thin",
"wrapper",
"layer",
"over",
"{",
"@link",
"DataStream#keyBy",
"(",
"KeySelector",
")",
"}",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-streaming-python/src/main/java/org/apache/flink/streaming/python/api/datastream/PythonDataStream.java#L135-L137 |
mirage-sql/mirage | src/main/java/com/miragesql/miragesql/util/Validate.java | Validate.isTrue | public static void isTrue(boolean expression, String message, Object value) {
"""
<p>Validate that the argument condition is <code>true</code>; otherwise
throwing an exception with the specified message. This method is useful when
validating according to an arbitrary boolean expression, such as validating an
object or using your own custom validation expression.</p>
<pre>Validate.isTrue( myObject.isOk(), "The object is not OK: ", myObject);</pre>
<p>For performance reasons, the object value is passed as a separate parameter and
appended to the exception message only in the case of an error.</p>
@param expression the boolean expression to check
@param message the exception message if invalid
@param value the value to append to the message when invalid
@throws IllegalArgumentException if expression is <code>false</code>
"""
if (expression == false) {
throw new IllegalArgumentException(message + value);
}
} | java | public static void isTrue(boolean expression, String message, Object value) {
if (expression == false) {
throw new IllegalArgumentException(message + value);
}
} | [
"public",
"static",
"void",
"isTrue",
"(",
"boolean",
"expression",
",",
"String",
"message",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"expression",
"==",
"false",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"message",
"+",
"value",
")",
";",
"}",
"}"
] | <p>Validate that the argument condition is <code>true</code>; otherwise
throwing an exception with the specified message. This method is useful when
validating according to an arbitrary boolean expression, such as validating an
object or using your own custom validation expression.</p>
<pre>Validate.isTrue( myObject.isOk(), "The object is not OK: ", myObject);</pre>
<p>For performance reasons, the object value is passed as a separate parameter and
appended to the exception message only in the case of an error.</p>
@param expression the boolean expression to check
@param message the exception message if invalid
@param value the value to append to the message when invalid
@throws IllegalArgumentException if expression is <code>false</code> | [
"<p",
">",
"Validate",
"that",
"the",
"argument",
"condition",
"is",
"<code",
">",
"true<",
"/",
"code",
">",
";",
"otherwise",
"throwing",
"an",
"exception",
"with",
"the",
"specified",
"message",
".",
"This",
"method",
"is",
"useful",
"when",
"validating",
"according",
"to",
"an",
"arbitrary",
"boolean",
"expression",
"such",
"as",
"validating",
"an",
"object",
"or",
"using",
"your",
"own",
"custom",
"validation",
"expression",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/mirage-sql/mirage/blob/29a44b7ad267b5a48bc250cd0ef7d74813d46889/src/main/java/com/miragesql/miragesql/util/Validate.java#L69-L73 |
Samsung/GearVRf | GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/layout/basic/LinearLayout.java | LinearLayout.isValidLayout | protected boolean isValidLayout(Gravity gravity, Orientation orientation) {
"""
Check if the gravity and orientation are not in conflict one with other.
@param gravity
@param orientation
@return true if orientation and gravity can be applied together, false - otherwise
"""
boolean isValid = true;
switch (gravity) {
case TOP:
case BOTTOM:
isValid = (!isUnlimitedSize() && orientation == Orientation.VERTICAL);
break;
case LEFT:
case RIGHT:
isValid = (!isUnlimitedSize() && orientation == Orientation.HORIZONTAL);
break;
case FRONT:
case BACK:
isValid = (!isUnlimitedSize() && orientation == Orientation.STACK);
break;
case FILL:
isValid = !isUnlimitedSize();
break;
case CENTER:
break;
default:
isValid = false;
break;
}
if (!isValid) {
Log.w(TAG, "Cannot set the gravity %s and orientation %s - " +
"due to unlimited bounds or incompatibility", gravity, orientation);
}
return isValid;
} | java | protected boolean isValidLayout(Gravity gravity, Orientation orientation) {
boolean isValid = true;
switch (gravity) {
case TOP:
case BOTTOM:
isValid = (!isUnlimitedSize() && orientation == Orientation.VERTICAL);
break;
case LEFT:
case RIGHT:
isValid = (!isUnlimitedSize() && orientation == Orientation.HORIZONTAL);
break;
case FRONT:
case BACK:
isValid = (!isUnlimitedSize() && orientation == Orientation.STACK);
break;
case FILL:
isValid = !isUnlimitedSize();
break;
case CENTER:
break;
default:
isValid = false;
break;
}
if (!isValid) {
Log.w(TAG, "Cannot set the gravity %s and orientation %s - " +
"due to unlimited bounds or incompatibility", gravity, orientation);
}
return isValid;
} | [
"protected",
"boolean",
"isValidLayout",
"(",
"Gravity",
"gravity",
",",
"Orientation",
"orientation",
")",
"{",
"boolean",
"isValid",
"=",
"true",
";",
"switch",
"(",
"gravity",
")",
"{",
"case",
"TOP",
":",
"case",
"BOTTOM",
":",
"isValid",
"=",
"(",
"!",
"isUnlimitedSize",
"(",
")",
"&&",
"orientation",
"==",
"Orientation",
".",
"VERTICAL",
")",
";",
"break",
";",
"case",
"LEFT",
":",
"case",
"RIGHT",
":",
"isValid",
"=",
"(",
"!",
"isUnlimitedSize",
"(",
")",
"&&",
"orientation",
"==",
"Orientation",
".",
"HORIZONTAL",
")",
";",
"break",
";",
"case",
"FRONT",
":",
"case",
"BACK",
":",
"isValid",
"=",
"(",
"!",
"isUnlimitedSize",
"(",
")",
"&&",
"orientation",
"==",
"Orientation",
".",
"STACK",
")",
";",
"break",
";",
"case",
"FILL",
":",
"isValid",
"=",
"!",
"isUnlimitedSize",
"(",
")",
";",
"break",
";",
"case",
"CENTER",
":",
"break",
";",
"default",
":",
"isValid",
"=",
"false",
";",
"break",
";",
"}",
"if",
"(",
"!",
"isValid",
")",
"{",
"Log",
".",
"w",
"(",
"TAG",
",",
"\"Cannot set the gravity %s and orientation %s - \"",
"+",
"\"due to unlimited bounds or incompatibility\"",
",",
"gravity",
",",
"orientation",
")",
";",
"}",
"return",
"isValid",
";",
"}"
] | Check if the gravity and orientation are not in conflict one with other.
@param gravity
@param orientation
@return true if orientation and gravity can be applied together, false - otherwise | [
"Check",
"if",
"the",
"gravity",
"and",
"orientation",
"are",
"not",
"in",
"conflict",
"one",
"with",
"other",
"."
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/layout/basic/LinearLayout.java#L278-L308 |
google/closure-compiler | src/com/google/javascript/jscomp/AstFactory.java | AstFactory.createObjectDotAssignCall | Node createObjectDotAssignCall(Scope scope, JSType returnType, Node... args) {
"""
Creates a call to Object.assign that returns the specified type.
<p>Object.assign returns !Object in the externs, which can lose type information if the actual
type is known.
"""
Node objAssign = createQName(scope, "Object.assign");
Node result = createCall(objAssign, args);
if (isAddingTypes()) {
// Make a unique function type that returns the exact type we've inferred it to be.
// Object.assign in the externs just returns !Object, which loses type information.
JSType objAssignType =
registry.createFunctionTypeWithVarArgs(
returnType,
registry.getNativeType(JSTypeNative.OBJECT_TYPE),
registry.createUnionType(JSTypeNative.OBJECT_TYPE, JSTypeNative.NULL_TYPE));
objAssign.setJSType(objAssignType);
result.setJSType(returnType);
}
return result;
} | java | Node createObjectDotAssignCall(Scope scope, JSType returnType, Node... args) {
Node objAssign = createQName(scope, "Object.assign");
Node result = createCall(objAssign, args);
if (isAddingTypes()) {
// Make a unique function type that returns the exact type we've inferred it to be.
// Object.assign in the externs just returns !Object, which loses type information.
JSType objAssignType =
registry.createFunctionTypeWithVarArgs(
returnType,
registry.getNativeType(JSTypeNative.OBJECT_TYPE),
registry.createUnionType(JSTypeNative.OBJECT_TYPE, JSTypeNative.NULL_TYPE));
objAssign.setJSType(objAssignType);
result.setJSType(returnType);
}
return result;
} | [
"Node",
"createObjectDotAssignCall",
"(",
"Scope",
"scope",
",",
"JSType",
"returnType",
",",
"Node",
"...",
"args",
")",
"{",
"Node",
"objAssign",
"=",
"createQName",
"(",
"scope",
",",
"\"Object.assign\"",
")",
";",
"Node",
"result",
"=",
"createCall",
"(",
"objAssign",
",",
"args",
")",
";",
"if",
"(",
"isAddingTypes",
"(",
")",
")",
"{",
"// Make a unique function type that returns the exact type we've inferred it to be.",
"// Object.assign in the externs just returns !Object, which loses type information.",
"JSType",
"objAssignType",
"=",
"registry",
".",
"createFunctionTypeWithVarArgs",
"(",
"returnType",
",",
"registry",
".",
"getNativeType",
"(",
"JSTypeNative",
".",
"OBJECT_TYPE",
")",
",",
"registry",
".",
"createUnionType",
"(",
"JSTypeNative",
".",
"OBJECT_TYPE",
",",
"JSTypeNative",
".",
"NULL_TYPE",
")",
")",
";",
"objAssign",
".",
"setJSType",
"(",
"objAssignType",
")",
";",
"result",
".",
"setJSType",
"(",
"returnType",
")",
";",
"}",
"return",
"result",
";",
"}"
] | Creates a call to Object.assign that returns the specified type.
<p>Object.assign returns !Object in the externs, which can lose type information if the actual
type is known. | [
"Creates",
"a",
"call",
"to",
"Object",
".",
"assign",
"that",
"returns",
"the",
"specified",
"type",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/AstFactory.java#L572-L589 |
buschmais/jqa-core-framework | plugin/src/main/java/com/buschmais/jqassistant/core/plugin/impl/AbstractPluginRepository.java | AbstractPluginRepository.createInstance | protected <T> T createInstance(String typeName) throws PluginRepositoryException {
"""
Create an instance of the given scanner plugin class.
@param typeName
The type name.
@param <T>
The type.
@return The plugin instance.
@throws PluginRepositoryException
If the requested instance could not be created.
"""
Class<T> type = getType(typeName.trim());
try {
return type.newInstance();
} catch (InstantiationException e) {
throw new PluginRepositoryException("Cannot create instance of class " + type.getName(), e);
} catch (IllegalAccessException e) {
throw new PluginRepositoryException("Cannot access class " + typeName, e);
} catch (LinkageError e) {
throw new PluginRepositoryException("Cannot load plugin class " + typeName, e);
}
} | java | protected <T> T createInstance(String typeName) throws PluginRepositoryException {
Class<T> type = getType(typeName.trim());
try {
return type.newInstance();
} catch (InstantiationException e) {
throw new PluginRepositoryException("Cannot create instance of class " + type.getName(), e);
} catch (IllegalAccessException e) {
throw new PluginRepositoryException("Cannot access class " + typeName, e);
} catch (LinkageError e) {
throw new PluginRepositoryException("Cannot load plugin class " + typeName, e);
}
} | [
"protected",
"<",
"T",
">",
"T",
"createInstance",
"(",
"String",
"typeName",
")",
"throws",
"PluginRepositoryException",
"{",
"Class",
"<",
"T",
">",
"type",
"=",
"getType",
"(",
"typeName",
".",
"trim",
"(",
")",
")",
";",
"try",
"{",
"return",
"type",
".",
"newInstance",
"(",
")",
";",
"}",
"catch",
"(",
"InstantiationException",
"e",
")",
"{",
"throw",
"new",
"PluginRepositoryException",
"(",
"\"Cannot create instance of class \"",
"+",
"type",
".",
"getName",
"(",
")",
",",
"e",
")",
";",
"}",
"catch",
"(",
"IllegalAccessException",
"e",
")",
"{",
"throw",
"new",
"PluginRepositoryException",
"(",
"\"Cannot access class \"",
"+",
"typeName",
",",
"e",
")",
";",
"}",
"catch",
"(",
"LinkageError",
"e",
")",
"{",
"throw",
"new",
"PluginRepositoryException",
"(",
"\"Cannot load plugin class \"",
"+",
"typeName",
",",
"e",
")",
";",
"}",
"}"
] | Create an instance of the given scanner plugin class.
@param typeName
The type name.
@param <T>
The type.
@return The plugin instance.
@throws PluginRepositoryException
If the requested instance could not be created. | [
"Create",
"an",
"instance",
"of",
"the",
"given",
"scanner",
"plugin",
"class",
"."
] | train | https://github.com/buschmais/jqa-core-framework/blob/0e63ff509cfe52f9063539a23d5f9f183b2ea4a5/plugin/src/main/java/com/buschmais/jqassistant/core/plugin/impl/AbstractPluginRepository.java#L72-L83 |
landawn/AbacusUtil | src/com/landawn/abacus/dataSource/PoolablePreparedStatement.java | PoolablePreparedStatement.setNClob | @Override
public void setNClob(int parameterIndex, Reader reader) throws SQLException {
"""
Method setNClob.
@param parameterIndex
@param reader
@throws SQLException
@see java.sql.PreparedStatement#setNClob(int, Reader)
"""
internalStmt.setNClob(parameterIndex, reader);
} | java | @Override
public void setNClob(int parameterIndex, Reader reader) throws SQLException {
internalStmt.setNClob(parameterIndex, reader);
} | [
"@",
"Override",
"public",
"void",
"setNClob",
"(",
"int",
"parameterIndex",
",",
"Reader",
"reader",
")",
"throws",
"SQLException",
"{",
"internalStmt",
".",
"setNClob",
"(",
"parameterIndex",
",",
"reader",
")",
";",
"}"
] | Method setNClob.
@param parameterIndex
@param reader
@throws SQLException
@see java.sql.PreparedStatement#setNClob(int, Reader) | [
"Method",
"setNClob",
"."
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/dataSource/PoolablePreparedStatement.java#L830-L833 |
zaproxy/zaproxy | src/org/parosproxy/paros/view/WorkbenchPanel.java | WorkbenchPanel.getTabbedStatus | public TabbedPanel2 getTabbedStatus() {
"""
Gets the tabbed panel that has the {@link PanelType#STATUS STATUS} panels.
<p>
Direct access/manipulation of the tabbed panel is discouraged, the changes done to it might be lost while changing
layouts.
@return the tabbed panel of the {@code status} panels, never {@code null}
@see #addPanel(AbstractPanel, PanelType)
"""
if (tabbedStatus == null) {
tabbedStatus = new TabbedPanel2();
tabbedStatus.setPreferredSize(new Dimension(800, 200));
// ZAP: Move tabs to the top of the panel
tabbedStatus.setTabPlacement(JTabbedPane.TOP);
tabbedStatus.setName("tabbedStatus");
tabbedStatus.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
}
return tabbedStatus;
} | java | public TabbedPanel2 getTabbedStatus() {
if (tabbedStatus == null) {
tabbedStatus = new TabbedPanel2();
tabbedStatus.setPreferredSize(new Dimension(800, 200));
// ZAP: Move tabs to the top of the panel
tabbedStatus.setTabPlacement(JTabbedPane.TOP);
tabbedStatus.setName("tabbedStatus");
tabbedStatus.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
}
return tabbedStatus;
} | [
"public",
"TabbedPanel2",
"getTabbedStatus",
"(",
")",
"{",
"if",
"(",
"tabbedStatus",
"==",
"null",
")",
"{",
"tabbedStatus",
"=",
"new",
"TabbedPanel2",
"(",
")",
";",
"tabbedStatus",
".",
"setPreferredSize",
"(",
"new",
"Dimension",
"(",
"800",
",",
"200",
")",
")",
";",
"// ZAP: Move tabs to the top of the panel\r",
"tabbedStatus",
".",
"setTabPlacement",
"(",
"JTabbedPane",
".",
"TOP",
")",
";",
"tabbedStatus",
".",
"setName",
"(",
"\"tabbedStatus\"",
")",
";",
"tabbedStatus",
".",
"setBorder",
"(",
"BorderFactory",
".",
"createEmptyBorder",
"(",
"0",
",",
"0",
",",
"0",
",",
"0",
")",
")",
";",
"}",
"return",
"tabbedStatus",
";",
"}"
] | Gets the tabbed panel that has the {@link PanelType#STATUS STATUS} panels.
<p>
Direct access/manipulation of the tabbed panel is discouraged, the changes done to it might be lost while changing
layouts.
@return the tabbed panel of the {@code status} panels, never {@code null}
@see #addPanel(AbstractPanel, PanelType) | [
"Gets",
"the",
"tabbed",
"panel",
"that",
"has",
"the",
"{",
"@link",
"PanelType#STATUS",
"STATUS",
"}",
"panels",
".",
"<p",
">",
"Direct",
"access",
"/",
"manipulation",
"of",
"the",
"tabbed",
"panel",
"is",
"discouraged",
"the",
"changes",
"done",
"to",
"it",
"might",
"be",
"lost",
"while",
"changing",
"layouts",
"."
] | train | https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/parosproxy/paros/view/WorkbenchPanel.java#L708-L718 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/AVA.java | AVA.getValueString | public String getValueString() {
"""
Get the value of this AVA as a String.
@exception RuntimeException if we could not obtain the string form
(should not occur)
"""
try {
String s = value.getAsString();
if (s == null) {
throw new RuntimeException("AVA string is null");
}
return s;
} catch (IOException e) {
// should not occur
throw new RuntimeException("AVA error: " + e, e);
}
} | java | public String getValueString() {
try {
String s = value.getAsString();
if (s == null) {
throw new RuntimeException("AVA string is null");
}
return s;
} catch (IOException e) {
// should not occur
throw new RuntimeException("AVA error: " + e, e);
}
} | [
"public",
"String",
"getValueString",
"(",
")",
"{",
"try",
"{",
"String",
"s",
"=",
"value",
".",
"getAsString",
"(",
")",
";",
"if",
"(",
"s",
"==",
"null",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"AVA string is null\"",
")",
";",
"}",
"return",
"s",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"// should not occur",
"throw",
"new",
"RuntimeException",
"(",
"\"AVA error: \"",
"+",
"e",
",",
"e",
")",
";",
"}",
"}"
] | Get the value of this AVA as a String.
@exception RuntimeException if we could not obtain the string form
(should not occur) | [
"Get",
"the",
"value",
"of",
"this",
"AVA",
"as",
"a",
"String",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/AVA.java#L249-L260 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/serialize/convert/SerializationConverterRegistry.java | SerializationConverterRegistry.iterateAllRegisteredSerializationConverters | public void iterateAllRegisteredSerializationConverters (@Nonnull final ISerializationConverterCallback aCallback) {
"""
Iterate all registered serialization converters. For informational purposes
only.
@param aCallback
The callback invoked for all iterations.
"""
// Create a static (non weak) copy of the map
final Map <Class <?>, ISerializationConverter <?>> aCopy = m_aRWLock.readLocked ( () -> new CommonsHashMap <> (m_aMap));
// And iterate the copy
for (final Map.Entry <Class <?>, ISerializationConverter <?>> aEntry : aCopy.entrySet ())
if (aCallback.call (aEntry.getKey (), aEntry.getValue ()).isBreak ())
break;
} | java | public void iterateAllRegisteredSerializationConverters (@Nonnull final ISerializationConverterCallback aCallback)
{
// Create a static (non weak) copy of the map
final Map <Class <?>, ISerializationConverter <?>> aCopy = m_aRWLock.readLocked ( () -> new CommonsHashMap <> (m_aMap));
// And iterate the copy
for (final Map.Entry <Class <?>, ISerializationConverter <?>> aEntry : aCopy.entrySet ())
if (aCallback.call (aEntry.getKey (), aEntry.getValue ()).isBreak ())
break;
} | [
"public",
"void",
"iterateAllRegisteredSerializationConverters",
"(",
"@",
"Nonnull",
"final",
"ISerializationConverterCallback",
"aCallback",
")",
"{",
"// Create a static (non weak) copy of the map",
"final",
"Map",
"<",
"Class",
"<",
"?",
">",
",",
"ISerializationConverter",
"<",
"?",
">",
">",
"aCopy",
"=",
"m_aRWLock",
".",
"readLocked",
"(",
"(",
")",
"->",
"new",
"CommonsHashMap",
"<>",
"(",
"m_aMap",
")",
")",
";",
"// And iterate the copy",
"for",
"(",
"final",
"Map",
".",
"Entry",
"<",
"Class",
"<",
"?",
">",
",",
"ISerializationConverter",
"<",
"?",
">",
">",
"aEntry",
":",
"aCopy",
".",
"entrySet",
"(",
")",
")",
"if",
"(",
"aCallback",
".",
"call",
"(",
"aEntry",
".",
"getKey",
"(",
")",
",",
"aEntry",
".",
"getValue",
"(",
")",
")",
".",
"isBreak",
"(",
")",
")",
"break",
";",
"}"
] | Iterate all registered serialization converters. For informational purposes
only.
@param aCallback
The callback invoked for all iterations. | [
"Iterate",
"all",
"registered",
"serialization",
"converters",
".",
"For",
"informational",
"purposes",
"only",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/serialize/convert/SerializationConverterRegistry.java#L155-L164 |
xhsun/gw2wrapper | src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java | AsynchronousRequest.getAPIInfo | public void getAPIInfo(String API, Callback<TokenInfo> callback) throws GuildWars2Exception, NullPointerException {
"""
For more info on TokenInfo API go <a href="https://wiki.guildwars2.com/wiki/API:2/tokeninfo">here</a><br/>
Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions
@param API API key
@param callback callback that is going to be used for {@link Call#enqueue(Callback)}
@throws GuildWars2Exception invalid API key
@throws NullPointerException if given {@link Callback} is null
@see TokenInfo API info
"""
isParamValid(new ParamChecker(ParamType.API, API));
gw2API.getAPIInfo(API).enqueue(callback);
} | java | public void getAPIInfo(String API, Callback<TokenInfo> callback) throws GuildWars2Exception, NullPointerException {
isParamValid(new ParamChecker(ParamType.API, API));
gw2API.getAPIInfo(API).enqueue(callback);
} | [
"public",
"void",
"getAPIInfo",
"(",
"String",
"API",
",",
"Callback",
"<",
"TokenInfo",
">",
"callback",
")",
"throws",
"GuildWars2Exception",
",",
"NullPointerException",
"{",
"isParamValid",
"(",
"new",
"ParamChecker",
"(",
"ParamType",
".",
"API",
",",
"API",
")",
")",
";",
"gw2API",
".",
"getAPIInfo",
"(",
"API",
")",
".",
"enqueue",
"(",
"callback",
")",
";",
"}"
] | For more info on TokenInfo API go <a href="https://wiki.guildwars2.com/wiki/API:2/tokeninfo">here</a><br/>
Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions
@param API API key
@param callback callback that is going to be used for {@link Call#enqueue(Callback)}
@throws GuildWars2Exception invalid API key
@throws NullPointerException if given {@link Callback} is null
@see TokenInfo API info | [
"For",
"more",
"info",
"on",
"TokenInfo",
"API",
"go",
"<a",
"href",
"=",
"https",
":",
"//",
"wiki",
".",
"guildwars2",
".",
"com",
"/",
"wiki",
"/",
"API",
":",
"2",
"/",
"tokeninfo",
">",
"here<",
"/",
"a",
">",
"<br",
"/",
">",
"Give",
"user",
"the",
"access",
"to",
"{",
"@link",
"Callback#onResponse",
"(",
"Call",
"Response",
")",
"}",
"and",
"{",
"@link",
"Callback#onFailure",
"(",
"Call",
"Throwable",
")",
"}",
"methods",
"for",
"custom",
"interactions"
] | train | https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java#L148-L151 |
Samsung/GearVRf | GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/layout/basic/RingLayout.java | RingLayout.setDividerPadding | public void setDividerPadding(final float padding, final Units units, final Axis axis) {
"""
Set the amount of padding between child objects. The actual padding can
be different from that if the {@link Gravity#FILL } is set. The divider
padding can be specified by either angle or length of the arch.
@param padding
@param units
{@link Units} units the padding is defined in
"""
super.setDividerPadding(units == Units.ARC_LENGTH ?
getSizeAngle(padding) : padding, axis);
} | java | public void setDividerPadding(final float padding, final Units units, final Axis axis) {
super.setDividerPadding(units == Units.ARC_LENGTH ?
getSizeAngle(padding) : padding, axis);
} | [
"public",
"void",
"setDividerPadding",
"(",
"final",
"float",
"padding",
",",
"final",
"Units",
"units",
",",
"final",
"Axis",
"axis",
")",
"{",
"super",
".",
"setDividerPadding",
"(",
"units",
"==",
"Units",
".",
"ARC_LENGTH",
"?",
"getSizeAngle",
"(",
"padding",
")",
":",
"padding",
",",
"axis",
")",
";",
"}"
] | Set the amount of padding between child objects. The actual padding can
be different from that if the {@link Gravity#FILL } is set. The divider
padding can be specified by either angle or length of the arch.
@param padding
@param units
{@link Units} units the padding is defined in | [
"Set",
"the",
"amount",
"of",
"padding",
"between",
"child",
"objects",
".",
"The",
"actual",
"padding",
"can",
"be",
"different",
"from",
"that",
"if",
"the",
"{",
"@link",
"Gravity#FILL",
"}",
"is",
"set",
".",
"The",
"divider",
"padding",
"can",
"be",
"specified",
"by",
"either",
"angle",
"or",
"length",
"of",
"the",
"arch",
"."
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/layout/basic/RingLayout.java#L60-L63 |
Whiley/WhileyCompiler | src/main/java/wyil/transform/VerificationConditionGenerator.java | VerificationConditionGenerator.translateFunctionOrMethodDeclaration | private void translateFunctionOrMethodDeclaration(WyilFile.Decl.FunctionOrMethod declaration) {
"""
Transform a function or method declaration into verification conditions as
necessary. This is done by traversing the control-flow graph of the function
or method in question. Verifications are emitted when conditions are
encountered which must be checked. For example, that the preconditions are
met at a function invocation.
@param declaration
The function or method declaration being translated.
@param wyalFile
The WyAL file being constructed
"""
// Create the prototype for this function or method. This is the
// function or method declaration which can be used within verification
// conditions to refer to this function or method. This does not include
// a body, since function or methods are treated as being
// "uninterpreted" for the purposes of verification.
createFunctionOrMethodPrototype(declaration);
// Create macros representing the individual clauses of the function or
// method's precondition and postcondition. These macros can then be
// called either to assume the precondition/postcondition or to check
// them. Using individual clauses helps to provide better error
// messages.
translatePreconditionMacros(declaration);
translatePostconditionMacros(declaration);
// The environments are needed to prevent clashes between variable
// versions across verification conditions, and also to type variables
// used in verification conditions.
GlobalEnvironment globalEnvironment = new GlobalEnvironment(declaration);
LocalEnvironment localEnvironment = new LocalEnvironment(globalEnvironment);
// Generate the initial assumption set for a given function or method,
// which roughly corresponds to its precondition.
AssumptionSet assumptions = generateFunctionOrMethodAssumptionSet(declaration, localEnvironment);
// Generate verification conditions by propagating forwards through the
// control-flow graph of the function or method in question. For each
// statement encountered, generate the preconditions which must hold
// true at that point. Furthermore, generate the effect of this
// statement on the current state.
List<VerificationCondition> vcs = new ArrayList<>();
Context context = new Context(wyalFile, assumptions, localEnvironment, localEnvironment, null, vcs);
translateStatementBlock(declaration.getBody(), context);
//
// Translate each generated verification condition into an assertion in
// the underlying WyalFile.
createAssertions(declaration, vcs, globalEnvironment);
} | java | private void translateFunctionOrMethodDeclaration(WyilFile.Decl.FunctionOrMethod declaration) {
// Create the prototype for this function or method. This is the
// function or method declaration which can be used within verification
// conditions to refer to this function or method. This does not include
// a body, since function or methods are treated as being
// "uninterpreted" for the purposes of verification.
createFunctionOrMethodPrototype(declaration);
// Create macros representing the individual clauses of the function or
// method's precondition and postcondition. These macros can then be
// called either to assume the precondition/postcondition or to check
// them. Using individual clauses helps to provide better error
// messages.
translatePreconditionMacros(declaration);
translatePostconditionMacros(declaration);
// The environments are needed to prevent clashes between variable
// versions across verification conditions, and also to type variables
// used in verification conditions.
GlobalEnvironment globalEnvironment = new GlobalEnvironment(declaration);
LocalEnvironment localEnvironment = new LocalEnvironment(globalEnvironment);
// Generate the initial assumption set for a given function or method,
// which roughly corresponds to its precondition.
AssumptionSet assumptions = generateFunctionOrMethodAssumptionSet(declaration, localEnvironment);
// Generate verification conditions by propagating forwards through the
// control-flow graph of the function or method in question. For each
// statement encountered, generate the preconditions which must hold
// true at that point. Furthermore, generate the effect of this
// statement on the current state.
List<VerificationCondition> vcs = new ArrayList<>();
Context context = new Context(wyalFile, assumptions, localEnvironment, localEnvironment, null, vcs);
translateStatementBlock(declaration.getBody(), context);
//
// Translate each generated verification condition into an assertion in
// the underlying WyalFile.
createAssertions(declaration, vcs, globalEnvironment);
} | [
"private",
"void",
"translateFunctionOrMethodDeclaration",
"(",
"WyilFile",
".",
"Decl",
".",
"FunctionOrMethod",
"declaration",
")",
"{",
"// Create the prototype for this function or method. This is the",
"// function or method declaration which can be used within verification",
"// conditions to refer to this function or method. This does not include",
"// a body, since function or methods are treated as being",
"// \"uninterpreted\" for the purposes of verification.",
"createFunctionOrMethodPrototype",
"(",
"declaration",
")",
";",
"// Create macros representing the individual clauses of the function or",
"// method's precondition and postcondition. These macros can then be",
"// called either to assume the precondition/postcondition or to check",
"// them. Using individual clauses helps to provide better error",
"// messages.",
"translatePreconditionMacros",
"(",
"declaration",
")",
";",
"translatePostconditionMacros",
"(",
"declaration",
")",
";",
"// The environments are needed to prevent clashes between variable",
"// versions across verification conditions, and also to type variables",
"// used in verification conditions.",
"GlobalEnvironment",
"globalEnvironment",
"=",
"new",
"GlobalEnvironment",
"(",
"declaration",
")",
";",
"LocalEnvironment",
"localEnvironment",
"=",
"new",
"LocalEnvironment",
"(",
"globalEnvironment",
")",
";",
"// Generate the initial assumption set for a given function or method,",
"// which roughly corresponds to its precondition.",
"AssumptionSet",
"assumptions",
"=",
"generateFunctionOrMethodAssumptionSet",
"(",
"declaration",
",",
"localEnvironment",
")",
";",
"// Generate verification conditions by propagating forwards through the",
"// control-flow graph of the function or method in question. For each",
"// statement encountered, generate the preconditions which must hold",
"// true at that point. Furthermore, generate the effect of this",
"// statement on the current state.",
"List",
"<",
"VerificationCondition",
">",
"vcs",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"Context",
"context",
"=",
"new",
"Context",
"(",
"wyalFile",
",",
"assumptions",
",",
"localEnvironment",
",",
"localEnvironment",
",",
"null",
",",
"vcs",
")",
";",
"translateStatementBlock",
"(",
"declaration",
".",
"getBody",
"(",
")",
",",
"context",
")",
";",
"//",
"// Translate each generated verification condition into an assertion in",
"// the underlying WyalFile.",
"createAssertions",
"(",
"declaration",
",",
"vcs",
",",
"globalEnvironment",
")",
";",
"}"
] | Transform a function or method declaration into verification conditions as
necessary. This is done by traversing the control-flow graph of the function
or method in question. Verifications are emitted when conditions are
encountered which must be checked. For example, that the preconditions are
met at a function invocation.
@param declaration
The function or method declaration being translated.
@param wyalFile
The WyAL file being constructed | [
"Transform",
"a",
"function",
"or",
"method",
"declaration",
"into",
"verification",
"conditions",
"as",
"necessary",
".",
"This",
"is",
"done",
"by",
"traversing",
"the",
"control",
"-",
"flow",
"graph",
"of",
"the",
"function",
"or",
"method",
"in",
"question",
".",
"Verifications",
"are",
"emitted",
"when",
"conditions",
"are",
"encountered",
"which",
"must",
"be",
"checked",
".",
"For",
"example",
"that",
"the",
"preconditions",
"are",
"met",
"at",
"a",
"function",
"invocation",
"."
] | train | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/transform/VerificationConditionGenerator.java#L248-L285 |
inkstand-io/scribble | scribble-net/src/main/java/io/inkstand/scribble/net/NetworkMatchers.java | NetworkMatchers.remoteDatagramPort | public static NetworkPort remoteDatagramPort(String hostname, int port) {
"""
Creates a type-safe udp port pointing ot a remote host and port.
@param hostname
the hostname of the remote host
@param port
the port of the remote host
@return a {@link NetworkPort} instance describing the udp port
"""
return new RemoteNetworkPort(hostname, port, NetworkPort.Type.UDP);
} | java | public static NetworkPort remoteDatagramPort(String hostname, int port){
return new RemoteNetworkPort(hostname, port, NetworkPort.Type.UDP);
} | [
"public",
"static",
"NetworkPort",
"remoteDatagramPort",
"(",
"String",
"hostname",
",",
"int",
"port",
")",
"{",
"return",
"new",
"RemoteNetworkPort",
"(",
"hostname",
",",
"port",
",",
"NetworkPort",
".",
"Type",
".",
"UDP",
")",
";",
"}"
] | Creates a type-safe udp port pointing ot a remote host and port.
@param hostname
the hostname of the remote host
@param port
the port of the remote host
@return a {@link NetworkPort} instance describing the udp port | [
"Creates",
"a",
"type",
"-",
"safe",
"udp",
"port",
"pointing",
"ot",
"a",
"remote",
"host",
"and",
"port",
"."
] | train | https://github.com/inkstand-io/scribble/blob/66e67553bad4b1ff817e1715fd1d3dd833406744/scribble-net/src/main/java/io/inkstand/scribble/net/NetworkMatchers.java#L102-L104 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java | TrainingsImpl.createImageTagsWithServiceResponseAsync | public Observable<ServiceResponse<ImageTagCreateSummary>> createImageTagsWithServiceResponseAsync(UUID projectId, CreateImageTagsOptionalParameter createImageTagsOptionalParameter) {
"""
Associate a set of images with a set of tags.
@param projectId The project id
@param createImageTagsOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ImageTagCreateSummary object
"""
if (projectId == null) {
throw new IllegalArgumentException("Parameter projectId is required and cannot be null.");
}
if (this.client.apiKey() == null) {
throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null.");
}
final List<ImageTagCreateEntry> tags = createImageTagsOptionalParameter != null ? createImageTagsOptionalParameter.tags() : null;
return createImageTagsWithServiceResponseAsync(projectId, tags);
} | java | public Observable<ServiceResponse<ImageTagCreateSummary>> createImageTagsWithServiceResponseAsync(UUID projectId, CreateImageTagsOptionalParameter createImageTagsOptionalParameter) {
if (projectId == null) {
throw new IllegalArgumentException("Parameter projectId is required and cannot be null.");
}
if (this.client.apiKey() == null) {
throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null.");
}
final List<ImageTagCreateEntry> tags = createImageTagsOptionalParameter != null ? createImageTagsOptionalParameter.tags() : null;
return createImageTagsWithServiceResponseAsync(projectId, tags);
} | [
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"ImageTagCreateSummary",
">",
">",
"createImageTagsWithServiceResponseAsync",
"(",
"UUID",
"projectId",
",",
"CreateImageTagsOptionalParameter",
"createImageTagsOptionalParameter",
")",
"{",
"if",
"(",
"projectId",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Parameter projectId is required and cannot be null.\"",
")",
";",
"}",
"if",
"(",
"this",
".",
"client",
".",
"apiKey",
"(",
")",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Parameter this.client.apiKey() is required and cannot be null.\"",
")",
";",
"}",
"final",
"List",
"<",
"ImageTagCreateEntry",
">",
"tags",
"=",
"createImageTagsOptionalParameter",
"!=",
"null",
"?",
"createImageTagsOptionalParameter",
".",
"tags",
"(",
")",
":",
"null",
";",
"return",
"createImageTagsWithServiceResponseAsync",
"(",
"projectId",
",",
"tags",
")",
";",
"}"
] | Associate a set of images with a set of tags.
@param projectId The project id
@param createImageTagsOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ImageTagCreateSummary object | [
"Associate",
"a",
"set",
"of",
"images",
"with",
"a",
"set",
"of",
"tags",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java#L3641-L3651 |
hector-client/hector | core/src/main/java/me/prettyprint/hector/api/factory/HFactory.java | HFactory.createCounterColumn | public static HCounterColumn<String> createCounterColumn(String name, long value) {
"""
Convenient method for creating a counter column with a String name and long value
"""
StringSerializer se = StringSerializer.get();
return createCounterColumn(name, value, se);
} | java | public static HCounterColumn<String> createCounterColumn(String name, long value) {
StringSerializer se = StringSerializer.get();
return createCounterColumn(name, value, se);
} | [
"public",
"static",
"HCounterColumn",
"<",
"String",
">",
"createCounterColumn",
"(",
"String",
"name",
",",
"long",
"value",
")",
"{",
"StringSerializer",
"se",
"=",
"StringSerializer",
".",
"get",
"(",
")",
";",
"return",
"createCounterColumn",
"(",
"name",
",",
"value",
",",
"se",
")",
";",
"}"
] | Convenient method for creating a counter column with a String name and long value | [
"Convenient",
"method",
"for",
"creating",
"a",
"counter",
"column",
"with",
"a",
"String",
"name",
"and",
"long",
"value"
] | train | https://github.com/hector-client/hector/blob/a302e68ca8d91b45d332e8c9afd7d98030b54de1/core/src/main/java/me/prettyprint/hector/api/factory/HFactory.java#L650-L653 |
contentful/contentful-management.java | src/main/java/com/contentful/java/cma/ModuleEditorInterfaces.java | ModuleEditorInterfaces.fetchOne | public CMAEditorInterface fetchOne(String spaceId, String environmentId, String contentTypeId) {
"""
Get the editor interface by id, using the given space and environment.
<p>
This method will override the configuration specified through
{@link CMAClient.Builder#setSpaceId(String)} and
{@link CMAClient.Builder#setEnvironmentId(String)}.
@param spaceId the id of the space this environment is part of.
@param environmentId the id of the environment this editor interface is valid on.
@param contentTypeId the contentTypeId this editor interface is valid on.
@return the editor interface for a specific content type on a specific space.
@throws IllegalArgumentException if space id is null.
@throws IllegalArgumentException if environment id is null.
@throws IllegalArgumentException if content type id is null.
"""
assertNotNull(spaceId, "spaceId");
assertNotNull(environmentId, "environmentId");
assertNotNull(contentTypeId, "contentTypeId");
return service.fetchOne(spaceId, environmentId, contentTypeId).blockingFirst();
} | java | public CMAEditorInterface fetchOne(String spaceId, String environmentId, String contentTypeId) {
assertNotNull(spaceId, "spaceId");
assertNotNull(environmentId, "environmentId");
assertNotNull(contentTypeId, "contentTypeId");
return service.fetchOne(spaceId, environmentId, contentTypeId).blockingFirst();
} | [
"public",
"CMAEditorInterface",
"fetchOne",
"(",
"String",
"spaceId",
",",
"String",
"environmentId",
",",
"String",
"contentTypeId",
")",
"{",
"assertNotNull",
"(",
"spaceId",
",",
"\"spaceId\"",
")",
";",
"assertNotNull",
"(",
"environmentId",
",",
"\"environmentId\"",
")",
";",
"assertNotNull",
"(",
"contentTypeId",
",",
"\"contentTypeId\"",
")",
";",
"return",
"service",
".",
"fetchOne",
"(",
"spaceId",
",",
"environmentId",
",",
"contentTypeId",
")",
".",
"blockingFirst",
"(",
")",
";",
"}"
] | Get the editor interface by id, using the given space and environment.
<p>
This method will override the configuration specified through
{@link CMAClient.Builder#setSpaceId(String)} and
{@link CMAClient.Builder#setEnvironmentId(String)}.
@param spaceId the id of the space this environment is part of.
@param environmentId the id of the environment this editor interface is valid on.
@param contentTypeId the contentTypeId this editor interface is valid on.
@return the editor interface for a specific content type on a specific space.
@throws IllegalArgumentException if space id is null.
@throws IllegalArgumentException if environment id is null.
@throws IllegalArgumentException if content type id is null. | [
"Get",
"the",
"editor",
"interface",
"by",
"id",
"using",
"the",
"given",
"space",
"and",
"environment",
".",
"<p",
">",
"This",
"method",
"will",
"override",
"the",
"configuration",
"specified",
"through",
"{",
"@link",
"CMAClient",
".",
"Builder#setSpaceId",
"(",
"String",
")",
"}",
"and",
"{",
"@link",
"CMAClient",
".",
"Builder#setEnvironmentId",
"(",
"String",
")",
"}",
"."
] | train | https://github.com/contentful/contentful-management.java/blob/ca310fb9ea9577fcff0ca57949ab7c2315fa2534/src/main/java/com/contentful/java/cma/ModuleEditorInterfaces.java#L86-L92 |
JodaOrg/joda-money | src/main/java/org/joda/money/format/MoneyFormatterBuilder.java | MoneyFormatterBuilder.appendInternal | private MoneyFormatterBuilder appendInternal(MoneyPrinter printer, MoneyParser parser) {
"""
Appends the specified printer and parser to this builder.
<p>
Either the printer or parser must be non-null.
@param printer the printer to append, null makes the formatter unable to print
@param parser the parser to append, null makes the formatter unable to parse
@return this for chaining, never null
"""
printers.add(printer);
parsers.add(parser);
return this;
} | java | private MoneyFormatterBuilder appendInternal(MoneyPrinter printer, MoneyParser parser) {
printers.add(printer);
parsers.add(parser);
return this;
} | [
"private",
"MoneyFormatterBuilder",
"appendInternal",
"(",
"MoneyPrinter",
"printer",
",",
"MoneyParser",
"parser",
")",
"{",
"printers",
".",
"add",
"(",
"printer",
")",
";",
"parsers",
".",
"add",
"(",
"parser",
")",
";",
"return",
"this",
";",
"}"
] | Appends the specified printer and parser to this builder.
<p>
Either the printer or parser must be non-null.
@param printer the printer to append, null makes the formatter unable to print
@param parser the parser to append, null makes the formatter unable to parse
@return this for chaining, never null | [
"Appends",
"the",
"specified",
"printer",
"and",
"parser",
"to",
"this",
"builder",
".",
"<p",
">",
"Either",
"the",
"printer",
"or",
"parser",
"must",
"be",
"non",
"-",
"null",
"."
] | train | https://github.com/JodaOrg/joda-money/blob/e1f2de75aa36610a695358696c8a88a18ca66cde/src/main/java/org/joda/money/format/MoneyFormatterBuilder.java#L263-L267 |
grpc/grpc-java | core/src/main/java/io/grpc/internal/Http2Ping.java | Http2Ping.notifyFailed | public static void notifyFailed(PingCallback callback, Executor executor, Throwable cause) {
"""
Notifies the given callback that the ping operation failed.
@param callback the callback
@param executor the executor used to invoke the callback
@param cause the cause of failure
"""
doExecute(executor, asRunnable(callback, cause));
} | java | public static void notifyFailed(PingCallback callback, Executor executor, Throwable cause) {
doExecute(executor, asRunnable(callback, cause));
} | [
"public",
"static",
"void",
"notifyFailed",
"(",
"PingCallback",
"callback",
",",
"Executor",
"executor",
",",
"Throwable",
"cause",
")",
"{",
"doExecute",
"(",
"executor",
",",
"asRunnable",
"(",
"callback",
",",
"cause",
")",
")",
";",
"}"
] | Notifies the given callback that the ping operation failed.
@param callback the callback
@param executor the executor used to invoke the callback
@param cause the cause of failure | [
"Notifies",
"the",
"given",
"callback",
"that",
"the",
"ping",
"operation",
"failed",
"."
] | train | https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/core/src/main/java/io/grpc/internal/Http2Ping.java#L170-L172 |
liferay/com-liferay-commerce | commerce-discount-service/src/main/java/com/liferay/commerce/discount/service/persistence/impl/CommerceDiscountUserSegmentRelPersistenceImpl.java | CommerceDiscountUserSegmentRelPersistenceImpl.findByCommerceDiscountId | @Override
public List<CommerceDiscountUserSegmentRel> findByCommerceDiscountId(
long commerceDiscountId, int start, int end) {
"""
Returns a range of all the commerce discount user segment rels where commerceDiscountId = ?.
<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 CommerceDiscountUserSegmentRelModelImpl}. 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 commerceDiscountId the commerce discount ID
@param start the lower bound of the range of commerce discount user segment rels
@param end the upper bound of the range of commerce discount user segment rels (not inclusive)
@return the range of matching commerce discount user segment rels
"""
return findByCommerceDiscountId(commerceDiscountId, start, end, null);
} | java | @Override
public List<CommerceDiscountUserSegmentRel> findByCommerceDiscountId(
long commerceDiscountId, int start, int end) {
return findByCommerceDiscountId(commerceDiscountId, start, end, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CommerceDiscountUserSegmentRel",
">",
"findByCommerceDiscountId",
"(",
"long",
"commerceDiscountId",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"return",
"findByCommerceDiscountId",
"(",
"commerceDiscountId",
",",
"start",
",",
"end",
",",
"null",
")",
";",
"}"
] | Returns a range of all the commerce discount user segment rels where commerceDiscountId = ?.
<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 CommerceDiscountUserSegmentRelModelImpl}. 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 commerceDiscountId the commerce discount ID
@param start the lower bound of the range of commerce discount user segment rels
@param end the upper bound of the range of commerce discount user segment rels (not inclusive)
@return the range of matching commerce discount user segment rels | [
"Returns",
"a",
"range",
"of",
"all",
"the",
"commerce",
"discount",
"user",
"segment",
"rels",
"where",
"commerceDiscountId",
"=",
"?",
";",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-discount-service/src/main/java/com/liferay/commerce/discount/service/persistence/impl/CommerceDiscountUserSegmentRelPersistenceImpl.java#L146-L150 |
ronmamo/reflections | src/main/java/org/reflections/Reflections.java | Reflections.collect | public Reflections collect(final InputStream inputStream) {
"""
merges saved Reflections resources from the given input stream, using the serializer configured in this instance's Configuration
<br> useful if you know the serialized resource location and prefer not to look it up the classpath
"""
try {
merge(configuration.getSerializer().read(inputStream));
if (log != null) log.info("Reflections collected metadata from input stream using serializer " + configuration.getSerializer().getClass().getName());
} catch (Exception ex) {
throw new ReflectionsException("could not merge input stream", ex);
}
return this;
} | java | public Reflections collect(final InputStream inputStream) {
try {
merge(configuration.getSerializer().read(inputStream));
if (log != null) log.info("Reflections collected metadata from input stream using serializer " + configuration.getSerializer().getClass().getName());
} catch (Exception ex) {
throw new ReflectionsException("could not merge input stream", ex);
}
return this;
} | [
"public",
"Reflections",
"collect",
"(",
"final",
"InputStream",
"inputStream",
")",
"{",
"try",
"{",
"merge",
"(",
"configuration",
".",
"getSerializer",
"(",
")",
".",
"read",
"(",
"inputStream",
")",
")",
";",
"if",
"(",
"log",
"!=",
"null",
")",
"log",
".",
"info",
"(",
"\"Reflections collected metadata from input stream using serializer \"",
"+",
"configuration",
".",
"getSerializer",
"(",
")",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
")",
";",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"throw",
"new",
"ReflectionsException",
"(",
"\"could not merge input stream\"",
",",
"ex",
")",
";",
"}",
"return",
"this",
";",
"}"
] | merges saved Reflections resources from the given input stream, using the serializer configured in this instance's Configuration
<br> useful if you know the serialized resource location and prefer not to look it up the classpath | [
"merges",
"saved",
"Reflections",
"resources",
"from",
"the",
"given",
"input",
"stream",
"using",
"the",
"serializer",
"configured",
"in",
"this",
"instance",
"s",
"Configuration",
"<br",
">",
"useful",
"if",
"you",
"know",
"the",
"serialized",
"resource",
"location",
"and",
"prefer",
"not",
"to",
"look",
"it",
"up",
"the",
"classpath"
] | train | https://github.com/ronmamo/reflections/blob/084cf4a759a06d88e88753ac00397478c2e0ed52/src/main/java/org/reflections/Reflections.java#L327-L336 |
DiUS/pact-jvm | pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslRequestWithPath.java | PactDslRequestWithPath.pathFromProviderState | public PactDslRequestWithPath pathFromProviderState(String expression, String example) {
"""
Sets the path to have it's value injected from the provider state
@param expression Expression to be evaluated from the provider state
@param example Example value to use in the consumer test
"""
requestGenerators.addGenerator(Category.PATH, new ProviderStateGenerator(expression));
this.path = example;
return this;
} | java | public PactDslRequestWithPath pathFromProviderState(String expression, String example) {
requestGenerators.addGenerator(Category.PATH, new ProviderStateGenerator(expression));
this.path = example;
return this;
} | [
"public",
"PactDslRequestWithPath",
"pathFromProviderState",
"(",
"String",
"expression",
",",
"String",
"example",
")",
"{",
"requestGenerators",
".",
"addGenerator",
"(",
"Category",
".",
"PATH",
",",
"new",
"ProviderStateGenerator",
"(",
"expression",
")",
")",
";",
"this",
".",
"path",
"=",
"example",
";",
"return",
"this",
";",
"}"
] | Sets the path to have it's value injected from the provider state
@param expression Expression to be evaluated from the provider state
@param example Example value to use in the consumer test | [
"Sets",
"the",
"path",
"to",
"have",
"it",
"s",
"value",
"injected",
"from",
"the",
"provider",
"state"
] | train | https://github.com/DiUS/pact-jvm/blob/2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef/pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslRequestWithPath.java#L437-L441 |
QSFT/Doradus | doradus-server/src/main/java/com/dell/doradus/service/spider/SpiderService.java | SpiderService.getObject | public DBObject getObject(TableDefinition tableDef, String objID) {
"""
Get all scalar and link fields for the object in the given table with the given ID.
@param tableDef {@link TableDefinition} in which object resides.
@param objID Object ID.
@return {@link DBObject} containing all object scalar and link fields, or
null if there is no such object.
"""
checkServiceState();
String storeName = objectsStoreName(tableDef);
Tenant tenant = Tenant.getTenant(tableDef);
Iterator<DColumn> colIter = DBService.instance(tenant).getAllColumns(storeName, objID).iterator();
if (!colIter.hasNext()) {
return null;
}
DBObject dbObj = createObject(tableDef, objID, colIter);
addShardedLinkValues(tableDef, dbObj);
return dbObj;
} | java | public DBObject getObject(TableDefinition tableDef, String objID) {
checkServiceState();
String storeName = objectsStoreName(tableDef);
Tenant tenant = Tenant.getTenant(tableDef);
Iterator<DColumn> colIter = DBService.instance(tenant).getAllColumns(storeName, objID).iterator();
if (!colIter.hasNext()) {
return null;
}
DBObject dbObj = createObject(tableDef, objID, colIter);
addShardedLinkValues(tableDef, dbObj);
return dbObj;
} | [
"public",
"DBObject",
"getObject",
"(",
"TableDefinition",
"tableDef",
",",
"String",
"objID",
")",
"{",
"checkServiceState",
"(",
")",
";",
"String",
"storeName",
"=",
"objectsStoreName",
"(",
"tableDef",
")",
";",
"Tenant",
"tenant",
"=",
"Tenant",
".",
"getTenant",
"(",
"tableDef",
")",
";",
"Iterator",
"<",
"DColumn",
">",
"colIter",
"=",
"DBService",
".",
"instance",
"(",
"tenant",
")",
".",
"getAllColumns",
"(",
"storeName",
",",
"objID",
")",
".",
"iterator",
"(",
")",
";",
"if",
"(",
"!",
"colIter",
".",
"hasNext",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"DBObject",
"dbObj",
"=",
"createObject",
"(",
"tableDef",
",",
"objID",
",",
"colIter",
")",
";",
"addShardedLinkValues",
"(",
"tableDef",
",",
"dbObj",
")",
";",
"return",
"dbObj",
";",
"}"
] | Get all scalar and link fields for the object in the given table with the given ID.
@param tableDef {@link TableDefinition} in which object resides.
@param objID Object ID.
@return {@link DBObject} containing all object scalar and link fields, or
null if there is no such object. | [
"Get",
"all",
"scalar",
"and",
"link",
"fields",
"for",
"the",
"object",
"in",
"the",
"given",
"table",
"with",
"the",
"given",
"ID",
"."
] | train | https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/service/spider/SpiderService.java#L176-L188 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/AlgorithmId.java | AlgorithmId.makeSigAlg | public static String makeSigAlg(String digAlg, String encAlg) {
"""
Creates a signature algorithm name from a digest algorithm
name and a encryption algorithm name.
"""
digAlg = digAlg.replace("-", "").toUpperCase(Locale.ENGLISH);
if (digAlg.equalsIgnoreCase("SHA")) digAlg = "SHA1";
encAlg = encAlg.toUpperCase(Locale.ENGLISH);
if (encAlg.equals("EC")) encAlg = "ECDSA";
return digAlg + "with" + encAlg;
} | java | public static String makeSigAlg(String digAlg, String encAlg) {
digAlg = digAlg.replace("-", "").toUpperCase(Locale.ENGLISH);
if (digAlg.equalsIgnoreCase("SHA")) digAlg = "SHA1";
encAlg = encAlg.toUpperCase(Locale.ENGLISH);
if (encAlg.equals("EC")) encAlg = "ECDSA";
return digAlg + "with" + encAlg;
} | [
"public",
"static",
"String",
"makeSigAlg",
"(",
"String",
"digAlg",
",",
"String",
"encAlg",
")",
"{",
"digAlg",
"=",
"digAlg",
".",
"replace",
"(",
"\"-\"",
",",
"\"\"",
")",
".",
"toUpperCase",
"(",
"Locale",
".",
"ENGLISH",
")",
";",
"if",
"(",
"digAlg",
".",
"equalsIgnoreCase",
"(",
"\"SHA\"",
")",
")",
"digAlg",
"=",
"\"SHA1\"",
";",
"encAlg",
"=",
"encAlg",
".",
"toUpperCase",
"(",
"Locale",
".",
"ENGLISH",
")",
";",
"if",
"(",
"encAlg",
".",
"equals",
"(",
"\"EC\"",
")",
")",
"encAlg",
"=",
"\"ECDSA\"",
";",
"return",
"digAlg",
"+",
"\"with\"",
"+",
"encAlg",
";",
"}"
] | Creates a signature algorithm name from a digest algorithm
name and a encryption algorithm name. | [
"Creates",
"a",
"signature",
"algorithm",
"name",
"from",
"a",
"digest",
"algorithm",
"name",
"and",
"a",
"encryption",
"algorithm",
"name",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/AlgorithmId.java#L947-L955 |
TNG/JGiven | jgiven-core/src/main/java/com/tngtech/jgiven/impl/util/ReflectionUtil.java | ReflectionUtil.forEachField | public static void forEachField( final Object object, Class<?> clazz, final FieldPredicate predicate, final FieldAction action ) {
"""
Iterates over all fields of the given class and all its super classes
and calls action.act() for the fields that are annotated with the given annotation.
"""
forEachSuperClass( clazz, new ClassAction() {
@Override
public void act( Class<?> clazz ) throws Exception {
for( Field field : clazz.getDeclaredFields() ) {
if( predicate.isTrue( field ) ) {
action.act( object, field );
}
}
}
} );
} | java | public static void forEachField( final Object object, Class<?> clazz, final FieldPredicate predicate, final FieldAction action ) {
forEachSuperClass( clazz, new ClassAction() {
@Override
public void act( Class<?> clazz ) throws Exception {
for( Field field : clazz.getDeclaredFields() ) {
if( predicate.isTrue( field ) ) {
action.act( object, field );
}
}
}
} );
} | [
"public",
"static",
"void",
"forEachField",
"(",
"final",
"Object",
"object",
",",
"Class",
"<",
"?",
">",
"clazz",
",",
"final",
"FieldPredicate",
"predicate",
",",
"final",
"FieldAction",
"action",
")",
"{",
"forEachSuperClass",
"(",
"clazz",
",",
"new",
"ClassAction",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"act",
"(",
"Class",
"<",
"?",
">",
"clazz",
")",
"throws",
"Exception",
"{",
"for",
"(",
"Field",
"field",
":",
"clazz",
".",
"getDeclaredFields",
"(",
")",
")",
"{",
"if",
"(",
"predicate",
".",
"isTrue",
"(",
"field",
")",
")",
"{",
"action",
".",
"act",
"(",
"object",
",",
"field",
")",
";",
"}",
"}",
"}",
"}",
")",
";",
"}"
] | Iterates over all fields of the given class and all its super classes
and calls action.act() for the fields that are annotated with the given annotation. | [
"Iterates",
"over",
"all",
"fields",
"of",
"the",
"given",
"class",
"and",
"all",
"its",
"super",
"classes",
"and",
"calls",
"action",
".",
"act",
"()",
"for",
"the",
"fields",
"that",
"are",
"annotated",
"with",
"the",
"given",
"annotation",
"."
] | train | https://github.com/TNG/JGiven/blob/1a69248fc6d7eb380cdc4542e3be273842889748/jgiven-core/src/main/java/com/tngtech/jgiven/impl/util/ReflectionUtil.java#L30-L41 |
deeplearning4j/deeplearning4j | datavec/datavec-arrow/src/main/java/org/datavec/arrow/ArrowConverter.java | ArrowConverter.writeRecordBatchTo | public static void writeRecordBatchTo(BufferAllocator bufferAllocator ,List<List<Writable>> recordBatch, Schema inputSchema,OutputStream outputStream) {
"""
Write the records to the given output stream
@param recordBatch the record batch to write
@param inputSchema the input schema
@param outputStream the output stream to write to
"""
if(!(recordBatch instanceof ArrowWritableRecordBatch)) {
val convertedSchema = toArrowSchema(inputSchema);
List<FieldVector> columns = toArrowColumns(bufferAllocator,inputSchema,recordBatch);
try {
VectorSchemaRoot root = new VectorSchemaRoot(convertedSchema,columns,recordBatch.size());
ArrowFileWriter writer = new ArrowFileWriter(root, providerForVectors(columns,convertedSchema.getFields()),
newChannel(outputStream));
writer.start();
writer.writeBatch();
writer.end();
} catch (IOException e) {
throw new IllegalStateException(e);
}
}
else {
val convertedSchema = toArrowSchema(inputSchema);
val pair = toArrowColumns(bufferAllocator,inputSchema,recordBatch);
try {
VectorSchemaRoot root = new VectorSchemaRoot(convertedSchema,pair,recordBatch.size());
ArrowFileWriter writer = new ArrowFileWriter(root, providerForVectors(pair,convertedSchema.getFields()),
newChannel(outputStream));
writer.start();
writer.writeBatch();
writer.end();
} catch (IOException e) {
throw new IllegalStateException(e);
}
}
} | java | public static void writeRecordBatchTo(BufferAllocator bufferAllocator ,List<List<Writable>> recordBatch, Schema inputSchema,OutputStream outputStream) {
if(!(recordBatch instanceof ArrowWritableRecordBatch)) {
val convertedSchema = toArrowSchema(inputSchema);
List<FieldVector> columns = toArrowColumns(bufferAllocator,inputSchema,recordBatch);
try {
VectorSchemaRoot root = new VectorSchemaRoot(convertedSchema,columns,recordBatch.size());
ArrowFileWriter writer = new ArrowFileWriter(root, providerForVectors(columns,convertedSchema.getFields()),
newChannel(outputStream));
writer.start();
writer.writeBatch();
writer.end();
} catch (IOException e) {
throw new IllegalStateException(e);
}
}
else {
val convertedSchema = toArrowSchema(inputSchema);
val pair = toArrowColumns(bufferAllocator,inputSchema,recordBatch);
try {
VectorSchemaRoot root = new VectorSchemaRoot(convertedSchema,pair,recordBatch.size());
ArrowFileWriter writer = new ArrowFileWriter(root, providerForVectors(pair,convertedSchema.getFields()),
newChannel(outputStream));
writer.start();
writer.writeBatch();
writer.end();
} catch (IOException e) {
throw new IllegalStateException(e);
}
}
} | [
"public",
"static",
"void",
"writeRecordBatchTo",
"(",
"BufferAllocator",
"bufferAllocator",
",",
"List",
"<",
"List",
"<",
"Writable",
">",
">",
"recordBatch",
",",
"Schema",
"inputSchema",
",",
"OutputStream",
"outputStream",
")",
"{",
"if",
"(",
"!",
"(",
"recordBatch",
"instanceof",
"ArrowWritableRecordBatch",
")",
")",
"{",
"val",
"convertedSchema",
"=",
"toArrowSchema",
"(",
"inputSchema",
")",
";",
"List",
"<",
"FieldVector",
">",
"columns",
"=",
"toArrowColumns",
"(",
"bufferAllocator",
",",
"inputSchema",
",",
"recordBatch",
")",
";",
"try",
"{",
"VectorSchemaRoot",
"root",
"=",
"new",
"VectorSchemaRoot",
"(",
"convertedSchema",
",",
"columns",
",",
"recordBatch",
".",
"size",
"(",
")",
")",
";",
"ArrowFileWriter",
"writer",
"=",
"new",
"ArrowFileWriter",
"(",
"root",
",",
"providerForVectors",
"(",
"columns",
",",
"convertedSchema",
".",
"getFields",
"(",
")",
")",
",",
"newChannel",
"(",
"outputStream",
")",
")",
";",
"writer",
".",
"start",
"(",
")",
";",
"writer",
".",
"writeBatch",
"(",
")",
";",
"writer",
".",
"end",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"e",
")",
";",
"}",
"}",
"else",
"{",
"val",
"convertedSchema",
"=",
"toArrowSchema",
"(",
"inputSchema",
")",
";",
"val",
"pair",
"=",
"toArrowColumns",
"(",
"bufferAllocator",
",",
"inputSchema",
",",
"recordBatch",
")",
";",
"try",
"{",
"VectorSchemaRoot",
"root",
"=",
"new",
"VectorSchemaRoot",
"(",
"convertedSchema",
",",
"pair",
",",
"recordBatch",
".",
"size",
"(",
")",
")",
";",
"ArrowFileWriter",
"writer",
"=",
"new",
"ArrowFileWriter",
"(",
"root",
",",
"providerForVectors",
"(",
"pair",
",",
"convertedSchema",
".",
"getFields",
"(",
")",
")",
",",
"newChannel",
"(",
"outputStream",
")",
")",
";",
"writer",
".",
"start",
"(",
")",
";",
"writer",
".",
"writeBatch",
"(",
")",
";",
"writer",
".",
"end",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"e",
")",
";",
"}",
"}",
"}"
] | Write the records to the given output stream
@param recordBatch the record batch to write
@param inputSchema the input schema
@param outputStream the output stream to write to | [
"Write",
"the",
"records",
"to",
"the",
"given",
"output",
"stream"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-arrow/src/main/java/org/datavec/arrow/ArrowConverter.java#L276-L313 |
jenkinsci/jenkins | core/src/main/java/jenkins/model/Nodes.java | Nodes.replaceNode | public boolean replaceNode(final Node oldOne, final @Nonnull Node newOne) throws IOException {
"""
Replace node of given name.
@return {@code true} if node was replaced.
@since 2.8
"""
if (oldOne == nodes.get(oldOne.getNodeName())) {
// use the queue lock until Nodes has a way of directly modifying a single node.
Queue.withLock(new Runnable() {
public void run() {
Nodes.this.nodes.remove(oldOne.getNodeName());
Nodes.this.nodes.put(newOne.getNodeName(), newOne);
jenkins.updateComputerList();
jenkins.trimLabels();
}
});
updateNode(newOne);
if (!newOne.getNodeName().equals(oldOne.getNodeName())) {
Util.deleteRecursive(new File(getNodesDir(), oldOne.getNodeName()));
}
NodeListener.fireOnUpdated(oldOne, newOne);
return true;
} else {
return false;
}
} | java | public boolean replaceNode(final Node oldOne, final @Nonnull Node newOne) throws IOException {
if (oldOne == nodes.get(oldOne.getNodeName())) {
// use the queue lock until Nodes has a way of directly modifying a single node.
Queue.withLock(new Runnable() {
public void run() {
Nodes.this.nodes.remove(oldOne.getNodeName());
Nodes.this.nodes.put(newOne.getNodeName(), newOne);
jenkins.updateComputerList();
jenkins.trimLabels();
}
});
updateNode(newOne);
if (!newOne.getNodeName().equals(oldOne.getNodeName())) {
Util.deleteRecursive(new File(getNodesDir(), oldOne.getNodeName()));
}
NodeListener.fireOnUpdated(oldOne, newOne);
return true;
} else {
return false;
}
} | [
"public",
"boolean",
"replaceNode",
"(",
"final",
"Node",
"oldOne",
",",
"final",
"@",
"Nonnull",
"Node",
"newOne",
")",
"throws",
"IOException",
"{",
"if",
"(",
"oldOne",
"==",
"nodes",
".",
"get",
"(",
"oldOne",
".",
"getNodeName",
"(",
")",
")",
")",
"{",
"// use the queue lock until Nodes has a way of directly modifying a single node.",
"Queue",
".",
"withLock",
"(",
"new",
"Runnable",
"(",
")",
"{",
"public",
"void",
"run",
"(",
")",
"{",
"Nodes",
".",
"this",
".",
"nodes",
".",
"remove",
"(",
"oldOne",
".",
"getNodeName",
"(",
")",
")",
";",
"Nodes",
".",
"this",
".",
"nodes",
".",
"put",
"(",
"newOne",
".",
"getNodeName",
"(",
")",
",",
"newOne",
")",
";",
"jenkins",
".",
"updateComputerList",
"(",
")",
";",
"jenkins",
".",
"trimLabels",
"(",
")",
";",
"}",
"}",
")",
";",
"updateNode",
"(",
"newOne",
")",
";",
"if",
"(",
"!",
"newOne",
".",
"getNodeName",
"(",
")",
".",
"equals",
"(",
"oldOne",
".",
"getNodeName",
"(",
")",
")",
")",
"{",
"Util",
".",
"deleteRecursive",
"(",
"new",
"File",
"(",
"getNodesDir",
"(",
")",
",",
"oldOne",
".",
"getNodeName",
"(",
")",
")",
")",
";",
"}",
"NodeListener",
".",
"fireOnUpdated",
"(",
"oldOne",
",",
"newOne",
")",
";",
"return",
"true",
";",
"}",
"else",
"{",
"return",
"false",
";",
"}",
"}"
] | Replace node of given name.
@return {@code true} if node was replaced.
@since 2.8 | [
"Replace",
"node",
"of",
"given",
"name",
"."
] | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/jenkins/model/Nodes.java#L224-L245 |
code4everything/util | src/main/java/com/zhazhapan/util/MailSender.java | MailSender.config | public static void config(MailHost mailHost, String personal, String from, String key, int port) {
"""
配置邮箱
@param mailHost 邮件服务器
@param personal 个人名称
@param from 发件箱
@param key 密码
@param port 端口
"""
config(mailHost, personal, from, key);
setPort(port);
} | java | public static void config(MailHost mailHost, String personal, String from, String key, int port) {
config(mailHost, personal, from, key);
setPort(port);
} | [
"public",
"static",
"void",
"config",
"(",
"MailHost",
"mailHost",
",",
"String",
"personal",
",",
"String",
"from",
",",
"String",
"key",
",",
"int",
"port",
")",
"{",
"config",
"(",
"mailHost",
",",
"personal",
",",
"from",
",",
"key",
")",
";",
"setPort",
"(",
"port",
")",
";",
"}"
] | 配置邮箱
@param mailHost 邮件服务器
@param personal 个人名称
@param from 发件箱
@param key 密码
@param port 端口 | [
"配置邮箱"
] | train | https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/MailSender.java#L93-L96 |
spring-projects/spring-boot | spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/Bindable.java | Bindable.listOf | public static <E> Bindable<List<E>> listOf(Class<E> elementType) {
"""
Create a new {@link Bindable} {@link List} of the specified element type.
@param <E> the element type
@param elementType the list element type
@return a {@link Bindable} instance
"""
return of(ResolvableType.forClassWithGenerics(List.class, elementType));
} | java | public static <E> Bindable<List<E>> listOf(Class<E> elementType) {
return of(ResolvableType.forClassWithGenerics(List.class, elementType));
} | [
"public",
"static",
"<",
"E",
">",
"Bindable",
"<",
"List",
"<",
"E",
">",
">",
"listOf",
"(",
"Class",
"<",
"E",
">",
"elementType",
")",
"{",
"return",
"of",
"(",
"ResolvableType",
".",
"forClassWithGenerics",
"(",
"List",
".",
"class",
",",
"elementType",
")",
")",
";",
"}"
] | Create a new {@link Bindable} {@link List} of the specified element type.
@param <E> the element type
@param elementType the list element type
@return a {@link Bindable} instance | [
"Create",
"a",
"new",
"{"
] | train | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/Bindable.java#L213-L215 |
googleads/googleads-java-lib | examples/admanager_axis/src/main/java/admanager/axis/v201808/orderservice/GetOrdersStartingSoon.java | GetOrdersStartingSoon.runExample | public static void runExample(AdManagerServices adManagerServices, AdManagerSession session)
throws RemoteException {
"""
Runs the example.
@param adManagerServices the services factory.
@param session the session.
@throws ApiException if the API request failed with one or more service errors.
@throws RemoteException if the API request failed due to other errors.
"""
OrderServiceInterface orderService =
adManagerServices.get(session, OrderServiceInterface.class);
// Create a statement to select orders.
StatementBuilder statementBuilder = new StatementBuilder()
.where("status = :status and startDateTime >= :now and startDateTime <= :soon")
.orderBy("id ASC")
.limit(StatementBuilder.SUGGESTED_PAGE_LIMIT)
.withBindVariableValue("status", OrderStatus.APPROVED.toString())
.withBindVariableValue("now", DateTimes.toDateTime(Instant.now(), "America/New_York"))
.withBindVariableValue("soon", DateTimes.toDateTime(Instant.now().plus(
Duration.standardDays(5L)), "America/New_York"));
// Retrieve a small amount of orders at a time, paging through
// until all orders have been retrieved.
int totalResultSetSize = 0;
do {
OrderPage page =
orderService.getOrdersByStatement(statementBuilder.toStatement());
if (page.getResults() != null) {
// Print out some information for each order.
totalResultSetSize = page.getTotalResultSetSize();
int i = page.getStartIndex();
for (Order order : page.getResults()) {
System.out.printf(
"%d) Order with ID %d and name '%s' was found.%n",
i++,
order.getId(),
order.getName()
);
}
}
statementBuilder.increaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT);
} while (statementBuilder.getOffset() < totalResultSetSize);
System.out.printf("Number of results found: %d%n", totalResultSetSize);
} | java | public static void runExample(AdManagerServices adManagerServices, AdManagerSession session)
throws RemoteException {
OrderServiceInterface orderService =
adManagerServices.get(session, OrderServiceInterface.class);
// Create a statement to select orders.
StatementBuilder statementBuilder = new StatementBuilder()
.where("status = :status and startDateTime >= :now and startDateTime <= :soon")
.orderBy("id ASC")
.limit(StatementBuilder.SUGGESTED_PAGE_LIMIT)
.withBindVariableValue("status", OrderStatus.APPROVED.toString())
.withBindVariableValue("now", DateTimes.toDateTime(Instant.now(), "America/New_York"))
.withBindVariableValue("soon", DateTimes.toDateTime(Instant.now().plus(
Duration.standardDays(5L)), "America/New_York"));
// Retrieve a small amount of orders at a time, paging through
// until all orders have been retrieved.
int totalResultSetSize = 0;
do {
OrderPage page =
orderService.getOrdersByStatement(statementBuilder.toStatement());
if (page.getResults() != null) {
// Print out some information for each order.
totalResultSetSize = page.getTotalResultSetSize();
int i = page.getStartIndex();
for (Order order : page.getResults()) {
System.out.printf(
"%d) Order with ID %d and name '%s' was found.%n",
i++,
order.getId(),
order.getName()
);
}
}
statementBuilder.increaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT);
} while (statementBuilder.getOffset() < totalResultSetSize);
System.out.printf("Number of results found: %d%n", totalResultSetSize);
} | [
"public",
"static",
"void",
"runExample",
"(",
"AdManagerServices",
"adManagerServices",
",",
"AdManagerSession",
"session",
")",
"throws",
"RemoteException",
"{",
"OrderServiceInterface",
"orderService",
"=",
"adManagerServices",
".",
"get",
"(",
"session",
",",
"OrderServiceInterface",
".",
"class",
")",
";",
"// Create a statement to select orders.",
"StatementBuilder",
"statementBuilder",
"=",
"new",
"StatementBuilder",
"(",
")",
".",
"where",
"(",
"\"status = :status and startDateTime >= :now and startDateTime <= :soon\"",
")",
".",
"orderBy",
"(",
"\"id ASC\"",
")",
".",
"limit",
"(",
"StatementBuilder",
".",
"SUGGESTED_PAGE_LIMIT",
")",
".",
"withBindVariableValue",
"(",
"\"status\"",
",",
"OrderStatus",
".",
"APPROVED",
".",
"toString",
"(",
")",
")",
".",
"withBindVariableValue",
"(",
"\"now\"",
",",
"DateTimes",
".",
"toDateTime",
"(",
"Instant",
".",
"now",
"(",
")",
",",
"\"America/New_York\"",
")",
")",
".",
"withBindVariableValue",
"(",
"\"soon\"",
",",
"DateTimes",
".",
"toDateTime",
"(",
"Instant",
".",
"now",
"(",
")",
".",
"plus",
"(",
"Duration",
".",
"standardDays",
"(",
"5L",
")",
")",
",",
"\"America/New_York\"",
")",
")",
";",
"// Retrieve a small amount of orders at a time, paging through",
"// until all orders have been retrieved.",
"int",
"totalResultSetSize",
"=",
"0",
";",
"do",
"{",
"OrderPage",
"page",
"=",
"orderService",
".",
"getOrdersByStatement",
"(",
"statementBuilder",
".",
"toStatement",
"(",
")",
")",
";",
"if",
"(",
"page",
".",
"getResults",
"(",
")",
"!=",
"null",
")",
"{",
"// Print out some information for each order.",
"totalResultSetSize",
"=",
"page",
".",
"getTotalResultSetSize",
"(",
")",
";",
"int",
"i",
"=",
"page",
".",
"getStartIndex",
"(",
")",
";",
"for",
"(",
"Order",
"order",
":",
"page",
".",
"getResults",
"(",
")",
")",
"{",
"System",
".",
"out",
".",
"printf",
"(",
"\"%d) Order with ID %d and name '%s' was found.%n\"",
",",
"i",
"++",
",",
"order",
".",
"getId",
"(",
")",
",",
"order",
".",
"getName",
"(",
")",
")",
";",
"}",
"}",
"statementBuilder",
".",
"increaseOffsetBy",
"(",
"StatementBuilder",
".",
"SUGGESTED_PAGE_LIMIT",
")",
";",
"}",
"while",
"(",
"statementBuilder",
".",
"getOffset",
"(",
")",
"<",
"totalResultSetSize",
")",
";",
"System",
".",
"out",
".",
"printf",
"(",
"\"Number of results found: %d%n\"",
",",
"totalResultSetSize",
")",
";",
"}"
] | Runs the example.
@param adManagerServices the services factory.
@param session the session.
@throws ApiException if the API request failed with one or more service errors.
@throws RemoteException if the API request failed due to other errors. | [
"Runs",
"the",
"example",
"."
] | train | https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/examples/admanager_axis/src/main/java/admanager/axis/v201808/orderservice/GetOrdersStartingSoon.java#L55-L95 |
alkacon/opencms-core | src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorOptions.java | CmsMessageBundleEditorOptions.initLanguageSwitch | private void initLanguageSwitch(Collection<Locale> locales, Locale current) {
"""
Initializes the language switcher UI Component {@link #m_languageSwitch}, including {@link #m_languageSelect}.
@param locales the locales that can be selected.
@param current the currently selected locale.
"""
FormLayout languages = new FormLayout();
languages.setHeight("100%");
languages.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
ComboBox languageSelect = new ComboBox();
languageSelect.setCaption(m_messages.key(Messages.GUI_LANGUAGE_SWITCHER_LABEL_0));
languageSelect.setNullSelectionAllowed(false);
// set Locales
for (Locale locale : locales) {
languageSelect.addItem(locale);
String caption = locale.getDisplayName(UI.getCurrent().getLocale());
if (CmsLocaleManager.getDefaultLocale().equals(locale)) {
caption += " ("
+ Messages.get().getBundle(UI.getCurrent().getLocale()).key(Messages.GUI_DEFAULT_LOCALE_0)
+ ")";
}
languageSelect.setItemCaption(locale, caption);
}
languageSelect.setValue(current);
languageSelect.setNewItemsAllowed(false);
languageSelect.setTextInputAllowed(false);
languageSelect.addValueChangeListener(new ValueChangeListener() {
private static final long serialVersionUID = 1L;
public void valueChange(ValueChangeEvent event) {
m_listener.handleLanguageChange((Locale)event.getProperty().getValue());
}
});
if (locales.size() == 1) {
languageSelect.setEnabled(false);
}
languages.addComponent(languageSelect);
m_languageSwitch = languages;
} | java | private void initLanguageSwitch(Collection<Locale> locales, Locale current) {
FormLayout languages = new FormLayout();
languages.setHeight("100%");
languages.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
ComboBox languageSelect = new ComboBox();
languageSelect.setCaption(m_messages.key(Messages.GUI_LANGUAGE_SWITCHER_LABEL_0));
languageSelect.setNullSelectionAllowed(false);
// set Locales
for (Locale locale : locales) {
languageSelect.addItem(locale);
String caption = locale.getDisplayName(UI.getCurrent().getLocale());
if (CmsLocaleManager.getDefaultLocale().equals(locale)) {
caption += " ("
+ Messages.get().getBundle(UI.getCurrent().getLocale()).key(Messages.GUI_DEFAULT_LOCALE_0)
+ ")";
}
languageSelect.setItemCaption(locale, caption);
}
languageSelect.setValue(current);
languageSelect.setNewItemsAllowed(false);
languageSelect.setTextInputAllowed(false);
languageSelect.addValueChangeListener(new ValueChangeListener() {
private static final long serialVersionUID = 1L;
public void valueChange(ValueChangeEvent event) {
m_listener.handleLanguageChange((Locale)event.getProperty().getValue());
}
});
if (locales.size() == 1) {
languageSelect.setEnabled(false);
}
languages.addComponent(languageSelect);
m_languageSwitch = languages;
} | [
"private",
"void",
"initLanguageSwitch",
"(",
"Collection",
"<",
"Locale",
">",
"locales",
",",
"Locale",
"current",
")",
"{",
"FormLayout",
"languages",
"=",
"new",
"FormLayout",
"(",
")",
";",
"languages",
".",
"setHeight",
"(",
"\"100%\"",
")",
";",
"languages",
".",
"setDefaultComponentAlignment",
"(",
"Alignment",
".",
"MIDDLE_LEFT",
")",
";",
"ComboBox",
"languageSelect",
"=",
"new",
"ComboBox",
"(",
")",
";",
"languageSelect",
".",
"setCaption",
"(",
"m_messages",
".",
"key",
"(",
"Messages",
".",
"GUI_LANGUAGE_SWITCHER_LABEL_0",
")",
")",
";",
"languageSelect",
".",
"setNullSelectionAllowed",
"(",
"false",
")",
";",
"// set Locales",
"for",
"(",
"Locale",
"locale",
":",
"locales",
")",
"{",
"languageSelect",
".",
"addItem",
"(",
"locale",
")",
";",
"String",
"caption",
"=",
"locale",
".",
"getDisplayName",
"(",
"UI",
".",
"getCurrent",
"(",
")",
".",
"getLocale",
"(",
")",
")",
";",
"if",
"(",
"CmsLocaleManager",
".",
"getDefaultLocale",
"(",
")",
".",
"equals",
"(",
"locale",
")",
")",
"{",
"caption",
"+=",
"\" (\"",
"+",
"Messages",
".",
"get",
"(",
")",
".",
"getBundle",
"(",
"UI",
".",
"getCurrent",
"(",
")",
".",
"getLocale",
"(",
")",
")",
".",
"key",
"(",
"Messages",
".",
"GUI_DEFAULT_LOCALE_0",
")",
"+",
"\")\"",
";",
"}",
"languageSelect",
".",
"setItemCaption",
"(",
"locale",
",",
"caption",
")",
";",
"}",
"languageSelect",
".",
"setValue",
"(",
"current",
")",
";",
"languageSelect",
".",
"setNewItemsAllowed",
"(",
"false",
")",
";",
"languageSelect",
".",
"setTextInputAllowed",
"(",
"false",
")",
";",
"languageSelect",
".",
"addValueChangeListener",
"(",
"new",
"ValueChangeListener",
"(",
")",
"{",
"private",
"static",
"final",
"long",
"serialVersionUID",
"=",
"1L",
";",
"public",
"void",
"valueChange",
"(",
"ValueChangeEvent",
"event",
")",
"{",
"m_listener",
".",
"handleLanguageChange",
"(",
"(",
"Locale",
")",
"event",
".",
"getProperty",
"(",
")",
".",
"getValue",
"(",
")",
")",
";",
"}",
"}",
")",
";",
"if",
"(",
"locales",
".",
"size",
"(",
")",
"==",
"1",
")",
"{",
"languageSelect",
".",
"setEnabled",
"(",
"false",
")",
";",
"}",
"languages",
".",
"addComponent",
"(",
"languageSelect",
")",
";",
"m_languageSwitch",
"=",
"languages",
";",
"}"
] | Initializes the language switcher UI Component {@link #m_languageSwitch}, including {@link #m_languageSelect}.
@param locales the locales that can be selected.
@param current the currently selected locale. | [
"Initializes",
"the",
"language",
"switcher",
"UI",
"Component",
"{"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorOptions.java#L351-L390 |
xcesco/kripton | kripton-processor/src/main/java/com/abubusoft/kripton/processor/bind/transform/AbstractNumberBindTransform.java | AbstractNumberBindTransform.generateSerializeOnXml | @Override
public void generateSerializeOnXml(BindTypeContext context, MethodSpec.Builder methodBuilder, String serializerName, TypeName beanClass, String beanName, BindProperty property) {
"""
/* (non-Javadoc)
@see com.abubusoft.kripton.processor.bind.transform.BindTransform#generateSerializeOnXml(com.abubusoft.kripton.processor.bind.BindTypeContext, com.squareup.javapoet.MethodSpec.Builder, java.lang.String, com.squareup.javapoet.TypeName, java.lang.String, com.abubusoft.kripton.processor.bind.model.BindProperty)
"""
XmlType xmlType = property.xmlInfo.xmlType;
if (property.isNullable() && !property.isInCollection()) {
methodBuilder.beginControlFlow("if ($L!=null) ", getter(beanName, beanClass, property));
}
if (property.hasTypeAdapter()) {
switch (xmlType) {
case ATTRIBUTE:
methodBuilder.addStatement("$L.write$LAttribute(null, null,$S, " + PRE_TYPE_ADAPTER_TO_DATA + "$L" + POST_TYPE_ADAPTER + ")", serializerName, ATTRIBUTE_METHOD, BindProperty.xmlName(property),
TypeAdapterUtils.class, TypeUtility.typeName(property.typeAdapter.adapterClazz), getter(beanName, beanClass, property));
break;
case TAG:
methodBuilder.addStatement("$L.writeStartElement($S)", serializerName, BindProperty.xmlName(property));
methodBuilder.addStatement("$L.writeCharacters($T.escapeXml10($T.write(" + PRE_TYPE_ADAPTER_TO_DATA + "$L" + POST_TYPE_ADAPTER + ")))", serializerName, StringEscapeUtils.class,
NUMBER_UTIL_CLAZZ, TypeAdapterUtils.class, TypeUtility.typeName(property.typeAdapter.adapterClazz), getter(beanName, beanClass, property));
methodBuilder.addStatement("$L.writeEndElement()", serializerName);
break;
case VALUE:
methodBuilder.addStatement("$L.writeCharacters($T.escapeXml10($T.write(" + PRE_TYPE_ADAPTER_TO_DATA + "$L" + POST_TYPE_ADAPTER + ")))", serializerName, StringEscapeUtils.class,
NUMBER_UTIL_CLAZZ, TypeAdapterUtils.class, TypeUtility.typeName(property.typeAdapter.adapterClazz), getter(beanName, beanClass, property));
break;
case VALUE_CDATA:
methodBuilder.addStatement("$L.writeCData($T.escapeXml10($T.write(" + PRE_TYPE_ADAPTER_TO_DATA + "$L" + POST_TYPE_ADAPTER + ")))", serializerName, StringEscapeUtils.class,
NUMBER_UTIL_CLAZZ, TypeAdapterUtils.class, TypeUtility.typeName(property.typeAdapter.adapterClazz), getter(beanName, beanClass, property));
break;
}
} else {
switch (xmlType) {
case ATTRIBUTE:
methodBuilder.addStatement("$L.write$LAttribute(null, null,$S, $L)", serializerName, ATTRIBUTE_METHOD, BindProperty.xmlName(property), getter(beanName, beanClass, property));
break;
case TAG:
methodBuilder.addStatement("$L.writeStartElement($S)", serializerName, BindProperty.xmlName(property));
methodBuilder.addStatement("$L.writeCharacters($T.escapeXml10($T.write($L)))", serializerName, StringEscapeUtils.class, NUMBER_UTIL_CLAZZ, getter(beanName, beanClass, property));
methodBuilder.addStatement("$L.writeEndElement()", serializerName);
break;
case VALUE:
methodBuilder.addStatement("$L.writeCharacters($T.escapeXml10($T.write($L)))", serializerName, StringEscapeUtils.class, NUMBER_UTIL_CLAZZ, getter(beanName, beanClass, property));
break;
case VALUE_CDATA:
methodBuilder.addStatement("$L.writeCData($T.escapeXml10($T.write($L)))", serializerName, StringEscapeUtils.class, NUMBER_UTIL_CLAZZ, getter(beanName, beanClass, property));
break;
}
}
if (property.isNullable() && !property.isInCollection()) {
methodBuilder.endControlFlow();
}
} | java | @Override
public void generateSerializeOnXml(BindTypeContext context, MethodSpec.Builder methodBuilder, String serializerName, TypeName beanClass, String beanName, BindProperty property) {
XmlType xmlType = property.xmlInfo.xmlType;
if (property.isNullable() && !property.isInCollection()) {
methodBuilder.beginControlFlow("if ($L!=null) ", getter(beanName, beanClass, property));
}
if (property.hasTypeAdapter()) {
switch (xmlType) {
case ATTRIBUTE:
methodBuilder.addStatement("$L.write$LAttribute(null, null,$S, " + PRE_TYPE_ADAPTER_TO_DATA + "$L" + POST_TYPE_ADAPTER + ")", serializerName, ATTRIBUTE_METHOD, BindProperty.xmlName(property),
TypeAdapterUtils.class, TypeUtility.typeName(property.typeAdapter.adapterClazz), getter(beanName, beanClass, property));
break;
case TAG:
methodBuilder.addStatement("$L.writeStartElement($S)", serializerName, BindProperty.xmlName(property));
methodBuilder.addStatement("$L.writeCharacters($T.escapeXml10($T.write(" + PRE_TYPE_ADAPTER_TO_DATA + "$L" + POST_TYPE_ADAPTER + ")))", serializerName, StringEscapeUtils.class,
NUMBER_UTIL_CLAZZ, TypeAdapterUtils.class, TypeUtility.typeName(property.typeAdapter.adapterClazz), getter(beanName, beanClass, property));
methodBuilder.addStatement("$L.writeEndElement()", serializerName);
break;
case VALUE:
methodBuilder.addStatement("$L.writeCharacters($T.escapeXml10($T.write(" + PRE_TYPE_ADAPTER_TO_DATA + "$L" + POST_TYPE_ADAPTER + ")))", serializerName, StringEscapeUtils.class,
NUMBER_UTIL_CLAZZ, TypeAdapterUtils.class, TypeUtility.typeName(property.typeAdapter.adapterClazz), getter(beanName, beanClass, property));
break;
case VALUE_CDATA:
methodBuilder.addStatement("$L.writeCData($T.escapeXml10($T.write(" + PRE_TYPE_ADAPTER_TO_DATA + "$L" + POST_TYPE_ADAPTER + ")))", serializerName, StringEscapeUtils.class,
NUMBER_UTIL_CLAZZ, TypeAdapterUtils.class, TypeUtility.typeName(property.typeAdapter.adapterClazz), getter(beanName, beanClass, property));
break;
}
} else {
switch (xmlType) {
case ATTRIBUTE:
methodBuilder.addStatement("$L.write$LAttribute(null, null,$S, $L)", serializerName, ATTRIBUTE_METHOD, BindProperty.xmlName(property), getter(beanName, beanClass, property));
break;
case TAG:
methodBuilder.addStatement("$L.writeStartElement($S)", serializerName, BindProperty.xmlName(property));
methodBuilder.addStatement("$L.writeCharacters($T.escapeXml10($T.write($L)))", serializerName, StringEscapeUtils.class, NUMBER_UTIL_CLAZZ, getter(beanName, beanClass, property));
methodBuilder.addStatement("$L.writeEndElement()", serializerName);
break;
case VALUE:
methodBuilder.addStatement("$L.writeCharacters($T.escapeXml10($T.write($L)))", serializerName, StringEscapeUtils.class, NUMBER_UTIL_CLAZZ, getter(beanName, beanClass, property));
break;
case VALUE_CDATA:
methodBuilder.addStatement("$L.writeCData($T.escapeXml10($T.write($L)))", serializerName, StringEscapeUtils.class, NUMBER_UTIL_CLAZZ, getter(beanName, beanClass, property));
break;
}
}
if (property.isNullable() && !property.isInCollection()) {
methodBuilder.endControlFlow();
}
} | [
"@",
"Override",
"public",
"void",
"generateSerializeOnXml",
"(",
"BindTypeContext",
"context",
",",
"MethodSpec",
".",
"Builder",
"methodBuilder",
",",
"String",
"serializerName",
",",
"TypeName",
"beanClass",
",",
"String",
"beanName",
",",
"BindProperty",
"property",
")",
"{",
"XmlType",
"xmlType",
"=",
"property",
".",
"xmlInfo",
".",
"xmlType",
";",
"if",
"(",
"property",
".",
"isNullable",
"(",
")",
"&&",
"!",
"property",
".",
"isInCollection",
"(",
")",
")",
"{",
"methodBuilder",
".",
"beginControlFlow",
"(",
"\"if ($L!=null) \"",
",",
"getter",
"(",
"beanName",
",",
"beanClass",
",",
"property",
")",
")",
";",
"}",
"if",
"(",
"property",
".",
"hasTypeAdapter",
"(",
")",
")",
"{",
"switch",
"(",
"xmlType",
")",
"{",
"case",
"ATTRIBUTE",
":",
"methodBuilder",
".",
"addStatement",
"(",
"\"$L.write$LAttribute(null, null,$S, \"",
"+",
"PRE_TYPE_ADAPTER_TO_DATA",
"+",
"\"$L\"",
"+",
"POST_TYPE_ADAPTER",
"+",
"\")\"",
",",
"serializerName",
",",
"ATTRIBUTE_METHOD",
",",
"BindProperty",
".",
"xmlName",
"(",
"property",
")",
",",
"TypeAdapterUtils",
".",
"class",
",",
"TypeUtility",
".",
"typeName",
"(",
"property",
".",
"typeAdapter",
".",
"adapterClazz",
")",
",",
"getter",
"(",
"beanName",
",",
"beanClass",
",",
"property",
")",
")",
";",
"break",
";",
"case",
"TAG",
":",
"methodBuilder",
".",
"addStatement",
"(",
"\"$L.writeStartElement($S)\"",
",",
"serializerName",
",",
"BindProperty",
".",
"xmlName",
"(",
"property",
")",
")",
";",
"methodBuilder",
".",
"addStatement",
"(",
"\"$L.writeCharacters($T.escapeXml10($T.write(\"",
"+",
"PRE_TYPE_ADAPTER_TO_DATA",
"+",
"\"$L\"",
"+",
"POST_TYPE_ADAPTER",
"+",
"\")))\"",
",",
"serializerName",
",",
"StringEscapeUtils",
".",
"class",
",",
"NUMBER_UTIL_CLAZZ",
",",
"TypeAdapterUtils",
".",
"class",
",",
"TypeUtility",
".",
"typeName",
"(",
"property",
".",
"typeAdapter",
".",
"adapterClazz",
")",
",",
"getter",
"(",
"beanName",
",",
"beanClass",
",",
"property",
")",
")",
";",
"methodBuilder",
".",
"addStatement",
"(",
"\"$L.writeEndElement()\"",
",",
"serializerName",
")",
";",
"break",
";",
"case",
"VALUE",
":",
"methodBuilder",
".",
"addStatement",
"(",
"\"$L.writeCharacters($T.escapeXml10($T.write(\"",
"+",
"PRE_TYPE_ADAPTER_TO_DATA",
"+",
"\"$L\"",
"+",
"POST_TYPE_ADAPTER",
"+",
"\")))\"",
",",
"serializerName",
",",
"StringEscapeUtils",
".",
"class",
",",
"NUMBER_UTIL_CLAZZ",
",",
"TypeAdapterUtils",
".",
"class",
",",
"TypeUtility",
".",
"typeName",
"(",
"property",
".",
"typeAdapter",
".",
"adapterClazz",
")",
",",
"getter",
"(",
"beanName",
",",
"beanClass",
",",
"property",
")",
")",
";",
"break",
";",
"case",
"VALUE_CDATA",
":",
"methodBuilder",
".",
"addStatement",
"(",
"\"$L.writeCData($T.escapeXml10($T.write(\"",
"+",
"PRE_TYPE_ADAPTER_TO_DATA",
"+",
"\"$L\"",
"+",
"POST_TYPE_ADAPTER",
"+",
"\")))\"",
",",
"serializerName",
",",
"StringEscapeUtils",
".",
"class",
",",
"NUMBER_UTIL_CLAZZ",
",",
"TypeAdapterUtils",
".",
"class",
",",
"TypeUtility",
".",
"typeName",
"(",
"property",
".",
"typeAdapter",
".",
"adapterClazz",
")",
",",
"getter",
"(",
"beanName",
",",
"beanClass",
",",
"property",
")",
")",
";",
"break",
";",
"}",
"}",
"else",
"{",
"switch",
"(",
"xmlType",
")",
"{",
"case",
"ATTRIBUTE",
":",
"methodBuilder",
".",
"addStatement",
"(",
"\"$L.write$LAttribute(null, null,$S, $L)\"",
",",
"serializerName",
",",
"ATTRIBUTE_METHOD",
",",
"BindProperty",
".",
"xmlName",
"(",
"property",
")",
",",
"getter",
"(",
"beanName",
",",
"beanClass",
",",
"property",
")",
")",
";",
"break",
";",
"case",
"TAG",
":",
"methodBuilder",
".",
"addStatement",
"(",
"\"$L.writeStartElement($S)\"",
",",
"serializerName",
",",
"BindProperty",
".",
"xmlName",
"(",
"property",
")",
")",
";",
"methodBuilder",
".",
"addStatement",
"(",
"\"$L.writeCharacters($T.escapeXml10($T.write($L)))\"",
",",
"serializerName",
",",
"StringEscapeUtils",
".",
"class",
",",
"NUMBER_UTIL_CLAZZ",
",",
"getter",
"(",
"beanName",
",",
"beanClass",
",",
"property",
")",
")",
";",
"methodBuilder",
".",
"addStatement",
"(",
"\"$L.writeEndElement()\"",
",",
"serializerName",
")",
";",
"break",
";",
"case",
"VALUE",
":",
"methodBuilder",
".",
"addStatement",
"(",
"\"$L.writeCharacters($T.escapeXml10($T.write($L)))\"",
",",
"serializerName",
",",
"StringEscapeUtils",
".",
"class",
",",
"NUMBER_UTIL_CLAZZ",
",",
"getter",
"(",
"beanName",
",",
"beanClass",
",",
"property",
")",
")",
";",
"break",
";",
"case",
"VALUE_CDATA",
":",
"methodBuilder",
".",
"addStatement",
"(",
"\"$L.writeCData($T.escapeXml10($T.write($L)))\"",
",",
"serializerName",
",",
"StringEscapeUtils",
".",
"class",
",",
"NUMBER_UTIL_CLAZZ",
",",
"getter",
"(",
"beanName",
",",
"beanClass",
",",
"property",
")",
")",
";",
"break",
";",
"}",
"}",
"if",
"(",
"property",
".",
"isNullable",
"(",
")",
"&&",
"!",
"property",
".",
"isInCollection",
"(",
")",
")",
"{",
"methodBuilder",
".",
"endControlFlow",
"(",
")",
";",
"}",
"}"
] | /* (non-Javadoc)
@see com.abubusoft.kripton.processor.bind.transform.BindTransform#generateSerializeOnXml(com.abubusoft.kripton.processor.bind.BindTypeContext, com.squareup.javapoet.MethodSpec.Builder, java.lang.String, com.squareup.javapoet.TypeName, java.lang.String, com.abubusoft.kripton.processor.bind.model.BindProperty) | [
"/",
"*",
"(",
"non",
"-",
"Javadoc",
")"
] | train | https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/bind/transform/AbstractNumberBindTransform.java#L190-L242 |
intendia-oss/rxjava-gwt | src/main/modified/io/reactivex/super/io/reactivex/Completable.java | Completable.blockingGet | @CheckReturnValue
@SchedulerSupport(SchedulerSupport.NONE)
public final Throwable blockingGet(long timeout, TimeUnit unit) {
"""
Subscribes to this Completable instance and blocks until it terminates or the specified timeout
elapses, then returns null for normal termination or the emitted exception if any.
<p>
<img width="640" height="348" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/Completable.blockingGet.t.png" alt="">
<dl>
<dt><b>Scheduler:</b></dt>
<dd>{@code blockingGet} does not operate by default on a particular {@link Scheduler}.</dd>
</dl>
@param timeout the timeout value
@param unit the time unit
@return the throwable if this terminated with an error, null otherwise
@throws RuntimeException that wraps an InterruptedException if the wait is interrupted or
TimeoutException if the specified timeout elapsed before it
"""
ObjectHelper.requireNonNull(unit, "unit is null");
BlockingMultiObserver<Void> observer = new BlockingMultiObserver<Void>();
subscribe(observer);
return observer.blockingGetError(timeout, unit);
} | java | @CheckReturnValue
@SchedulerSupport(SchedulerSupport.NONE)
public final Throwable blockingGet(long timeout, TimeUnit unit) {
ObjectHelper.requireNonNull(unit, "unit is null");
BlockingMultiObserver<Void> observer = new BlockingMultiObserver<Void>();
subscribe(observer);
return observer.blockingGetError(timeout, unit);
} | [
"@",
"CheckReturnValue",
"@",
"SchedulerSupport",
"(",
"SchedulerSupport",
".",
"NONE",
")",
"public",
"final",
"Throwable",
"blockingGet",
"(",
"long",
"timeout",
",",
"TimeUnit",
"unit",
")",
"{",
"ObjectHelper",
".",
"requireNonNull",
"(",
"unit",
",",
"\"unit is null\"",
")",
";",
"BlockingMultiObserver",
"<",
"Void",
">",
"observer",
"=",
"new",
"BlockingMultiObserver",
"<",
"Void",
">",
"(",
")",
";",
"subscribe",
"(",
"observer",
")",
";",
"return",
"observer",
".",
"blockingGetError",
"(",
"timeout",
",",
"unit",
")",
";",
"}"
] | Subscribes to this Completable instance and blocks until it terminates or the specified timeout
elapses, then returns null for normal termination or the emitted exception if any.
<p>
<img width="640" height="348" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/Completable.blockingGet.t.png" alt="">
<dl>
<dt><b>Scheduler:</b></dt>
<dd>{@code blockingGet} does not operate by default on a particular {@link Scheduler}.</dd>
</dl>
@param timeout the timeout value
@param unit the time unit
@return the throwable if this terminated with an error, null otherwise
@throws RuntimeException that wraps an InterruptedException if the wait is interrupted or
TimeoutException if the specified timeout elapsed before it | [
"Subscribes",
"to",
"this",
"Completable",
"instance",
"and",
"blocks",
"until",
"it",
"terminates",
"or",
"the",
"specified",
"timeout",
"elapses",
"then",
"returns",
"null",
"for",
"normal",
"termination",
"or",
"the",
"emitted",
"exception",
"if",
"any",
".",
"<p",
">",
"<img",
"width",
"=",
"640",
"height",
"=",
"348",
"src",
"=",
"https",
":",
"//",
"raw",
".",
"github",
".",
"com",
"/",
"wiki",
"/",
"ReactiveX",
"/",
"RxJava",
"/",
"images",
"/",
"rx",
"-",
"operators",
"/",
"Completable",
".",
"blockingGet",
".",
"t",
".",
"png",
"alt",
"=",
">",
"<dl",
">",
"<dt",
">",
"<b",
">",
"Scheduler",
":",
"<",
"/",
"b",
">",
"<",
"/",
"dt",
">",
"<dd",
">",
"{"
] | train | https://github.com/intendia-oss/rxjava-gwt/blob/8d5635b12ce40da99e76b59dc6bfe6fc2fffc1fa/src/main/modified/io/reactivex/super/io/reactivex/Completable.java#L1253-L1260 |
Crab2died/Excel4J | src/main/java/com/github/crab2died/utils/DateUtils.java | DateUtils.date2Str | public static String date2Str(Date date, String format) {
"""
<p>将{@link Date}类型转换为指定格式的字符串</p>
author : Crab2Died
date : 2017年06月02日 15:32:04
@param date {@link Date}类型的时间
@param format 指定格式化类型
@return 返回格式化后的时间字符串
"""
SimpleDateFormat sdf = new SimpleDateFormat(format);
return sdf.format(date);
} | java | public static String date2Str(Date date, String format) {
SimpleDateFormat sdf = new SimpleDateFormat(format);
return sdf.format(date);
} | [
"public",
"static",
"String",
"date2Str",
"(",
"Date",
"date",
",",
"String",
"format",
")",
"{",
"SimpleDateFormat",
"sdf",
"=",
"new",
"SimpleDateFormat",
"(",
"format",
")",
";",
"return",
"sdf",
".",
"format",
"(",
"date",
")",
";",
"}"
] | <p>将{@link Date}类型转换为指定格式的字符串</p>
author : Crab2Died
date : 2017年06月02日 15:32:04
@param date {@link Date}类型的时间
@param format 指定格式化类型
@return 返回格式化后的时间字符串 | [
"<p",
">",
"将",
"{",
"@link",
"Date",
"}",
"类型转换为指定格式的字符串<",
"/",
"p",
">",
"author",
":",
"Crab2Died",
"date",
":",
"2017年06月02日",
"15",
":",
"32",
":",
"04"
] | train | https://github.com/Crab2died/Excel4J/blob/2ab0a3b8226a69ff868c3ead6e724f3a774f5f77/src/main/java/com/github/crab2died/utils/DateUtils.java#L96-L99 |
spring-projects/spring-boot | spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/livereload/LiveReloadServer.java | LiveReloadServer.createConnection | protected Connection createConnection(Socket socket, InputStream inputStream,
OutputStream outputStream) throws IOException {
"""
Factory method used to create the {@link Connection}.
@param socket the source socket
@param inputStream the socket input stream
@param outputStream the socket output stream
@return a connection
@throws IOException in case of I/O errors
"""
return new Connection(socket, inputStream, outputStream);
} | java | protected Connection createConnection(Socket socket, InputStream inputStream,
OutputStream outputStream) throws IOException {
return new Connection(socket, inputStream, outputStream);
} | [
"protected",
"Connection",
"createConnection",
"(",
"Socket",
"socket",
",",
"InputStream",
"inputStream",
",",
"OutputStream",
"outputStream",
")",
"throws",
"IOException",
"{",
"return",
"new",
"Connection",
"(",
"socket",
",",
"inputStream",
",",
"outputStream",
")",
";",
"}"
] | Factory method used to create the {@link Connection}.
@param socket the source socket
@param inputStream the socket input stream
@param outputStream the socket output stream
@return a connection
@throws IOException in case of I/O errors | [
"Factory",
"method",
"used",
"to",
"create",
"the",
"{"
] | train | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/livereload/LiveReloadServer.java#L236-L239 |
dwdyer/reportng | reportng/src/java/main/org/uncommons/reportng/HTMLReporter.java | HTMLReporter.createSuiteList | private void createSuiteList(List<ISuite> suites,
File outputDirectory,
boolean onlyFailures) throws Exception {
"""
Create the navigation frame.
@param outputDirectory The target directory for the generated file(s).
"""
VelocityContext context = createContext();
context.put(SUITES_KEY, suites);
context.put(ONLY_FAILURES_KEY, onlyFailures);
generateFile(new File(outputDirectory, SUITES_FILE),
SUITES_FILE + TEMPLATE_EXTENSION,
context);
} | java | private void createSuiteList(List<ISuite> suites,
File outputDirectory,
boolean onlyFailures) throws Exception
{
VelocityContext context = createContext();
context.put(SUITES_KEY, suites);
context.put(ONLY_FAILURES_KEY, onlyFailures);
generateFile(new File(outputDirectory, SUITES_FILE),
SUITES_FILE + TEMPLATE_EXTENSION,
context);
} | [
"private",
"void",
"createSuiteList",
"(",
"List",
"<",
"ISuite",
">",
"suites",
",",
"File",
"outputDirectory",
",",
"boolean",
"onlyFailures",
")",
"throws",
"Exception",
"{",
"VelocityContext",
"context",
"=",
"createContext",
"(",
")",
";",
"context",
".",
"put",
"(",
"SUITES_KEY",
",",
"suites",
")",
";",
"context",
".",
"put",
"(",
"ONLY_FAILURES_KEY",
",",
"onlyFailures",
")",
";",
"generateFile",
"(",
"new",
"File",
"(",
"outputDirectory",
",",
"SUITES_FILE",
")",
",",
"SUITES_FILE",
"+",
"TEMPLATE_EXTENSION",
",",
"context",
")",
";",
"}"
] | Create the navigation frame.
@param outputDirectory The target directory for the generated file(s). | [
"Create",
"the",
"navigation",
"frame",
"."
] | train | https://github.com/dwdyer/reportng/blob/df11f9cd9ab3fb5847fbba94ed3098ae0448f770/reportng/src/java/main/org/uncommons/reportng/HTMLReporter.java#L153-L163 |
pedrovgs/DraggablePanel | draggablepanel/src/main/java/com/github/pedrovgs/DraggableViewCallback.java | DraggableViewCallback.clampViewPositionHorizontal | @Override public int clampViewPositionHorizontal(View child, int left, int dx) {
"""
Override method used to configure the horizontal drag. Restrict the motion of the dragged
child view along the horizontal axis.
@param child child view being dragged.
@param left attempted motion along the X axis.
@param dx proposed change in position for left.
@return the new clamped position for left.
"""
int newLeft = draggedView.getLeft();
if ((draggableView.isMinimized() && Math.abs(dx) > MINIMUM_DX_FOR_HORIZONTAL_DRAG) || (
draggableView.isDragViewAtBottom()
&& !draggableView.isDragViewAtRight())) {
newLeft = left;
}
return newLeft;
} | java | @Override public int clampViewPositionHorizontal(View child, int left, int dx) {
int newLeft = draggedView.getLeft();
if ((draggableView.isMinimized() && Math.abs(dx) > MINIMUM_DX_FOR_HORIZONTAL_DRAG) || (
draggableView.isDragViewAtBottom()
&& !draggableView.isDragViewAtRight())) {
newLeft = left;
}
return newLeft;
} | [
"@",
"Override",
"public",
"int",
"clampViewPositionHorizontal",
"(",
"View",
"child",
",",
"int",
"left",
",",
"int",
"dx",
")",
"{",
"int",
"newLeft",
"=",
"draggedView",
".",
"getLeft",
"(",
")",
";",
"if",
"(",
"(",
"draggableView",
".",
"isMinimized",
"(",
")",
"&&",
"Math",
".",
"abs",
"(",
"dx",
")",
">",
"MINIMUM_DX_FOR_HORIZONTAL_DRAG",
")",
"||",
"(",
"draggableView",
".",
"isDragViewAtBottom",
"(",
")",
"&&",
"!",
"draggableView",
".",
"isDragViewAtRight",
"(",
")",
")",
")",
"{",
"newLeft",
"=",
"left",
";",
"}",
"return",
"newLeft",
";",
"}"
] | Override method used to configure the horizontal drag. Restrict the motion of the dragged
child view along the horizontal axis.
@param child child view being dragged.
@param left attempted motion along the X axis.
@param dx proposed change in position for left.
@return the new clamped position for left. | [
"Override",
"method",
"used",
"to",
"configure",
"the",
"horizontal",
"drag",
".",
"Restrict",
"the",
"motion",
"of",
"the",
"dragged",
"child",
"view",
"along",
"the",
"horizontal",
"axis",
"."
] | train | https://github.com/pedrovgs/DraggablePanel/blob/6b6d1806fa4140113f31307a2571bf02435aa53a/draggablepanel/src/main/java/com/github/pedrovgs/DraggableViewCallback.java#L108-L116 |
nemerosa/ontrack | ontrack-model/src/main/java/net/nemerosa/ontrack/model/structure/NameDescription.java | NameDescription.escapeName | public static String escapeName(String name) {
"""
Makes sure the given <code>name</code> is escaped properly before being used as a valid name.
@param name Name to convert
@return Name which is safe to use
@see #NAME
"""
if (StringUtils.isBlank(name)) {
throw new IllegalArgumentException("Blank or null is not a valid name.");
} else if (java.util.regex.Pattern.matches(NAME, name)) {
return name;
} else {
return name.replaceAll("[^A-Za-z0-9\\.\\-_]", "-");
}
} | java | public static String escapeName(String name) {
if (StringUtils.isBlank(name)) {
throw new IllegalArgumentException("Blank or null is not a valid name.");
} else if (java.util.regex.Pattern.matches(NAME, name)) {
return name;
} else {
return name.replaceAll("[^A-Za-z0-9\\.\\-_]", "-");
}
} | [
"public",
"static",
"String",
"escapeName",
"(",
"String",
"name",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isBlank",
"(",
"name",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Blank or null is not a valid name.\"",
")",
";",
"}",
"else",
"if",
"(",
"java",
".",
"util",
".",
"regex",
".",
"Pattern",
".",
"matches",
"(",
"NAME",
",",
"name",
")",
")",
"{",
"return",
"name",
";",
"}",
"else",
"{",
"return",
"name",
".",
"replaceAll",
"(",
"\"[^A-Za-z0-9\\\\.\\\\-_]\"",
",",
"\"-\"",
")",
";",
"}",
"}"
] | Makes sure the given <code>name</code> is escaped properly before being used as a valid name.
@param name Name to convert
@return Name which is safe to use
@see #NAME | [
"Makes",
"sure",
"the",
"given",
"<code",
">",
"name<",
"/",
"code",
">",
"is",
"escaped",
"properly",
"before",
"being",
"used",
"as",
"a",
"valid",
"name",
"."
] | train | https://github.com/nemerosa/ontrack/blob/37b0874cbf387b58aba95cd3c1bc3b15e11bc913/ontrack-model/src/main/java/net/nemerosa/ontrack/model/structure/NameDescription.java#L49-L57 |
jayantk/jklol | src/com/jayantkrish/jklol/lisp/LispUtil.java | LispUtil.checkState | public static void checkState(boolean condition, String message, Object ... values) {
"""
Identical to Preconditions.checkState but throws an
{@code EvalError} instead of an IllegalArgumentException.
Use this check to verify properties of a Lisp program
execution, i.e., whenever the raised exception should be
catchable by the evaluator of the program.
@param condition
@param message
@param values
"""
if (!condition) {
throw new EvalError(String.format(message, values));
}
} | java | public static void checkState(boolean condition, String message, Object ... values) {
if (!condition) {
throw new EvalError(String.format(message, values));
}
} | [
"public",
"static",
"void",
"checkState",
"(",
"boolean",
"condition",
",",
"String",
"message",
",",
"Object",
"...",
"values",
")",
"{",
"if",
"(",
"!",
"condition",
")",
"{",
"throw",
"new",
"EvalError",
"(",
"String",
".",
"format",
"(",
"message",
",",
"values",
")",
")",
";",
"}",
"}"
] | Identical to Preconditions.checkState but throws an
{@code EvalError} instead of an IllegalArgumentException.
Use this check to verify properties of a Lisp program
execution, i.e., whenever the raised exception should be
catchable by the evaluator of the program.
@param condition
@param message
@param values | [
"Identical",
"to",
"Preconditions",
".",
"checkState",
"but",
"throws",
"an",
"{",
"@code",
"EvalError",
"}",
"instead",
"of",
"an",
"IllegalArgumentException",
".",
"Use",
"this",
"check",
"to",
"verify",
"properties",
"of",
"a",
"Lisp",
"program",
"execution",
"i",
".",
"e",
".",
"whenever",
"the",
"raised",
"exception",
"should",
"be",
"catchable",
"by",
"the",
"evaluator",
"of",
"the",
"program",
"."
] | train | https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/lisp/LispUtil.java#L98-L102 |
JM-Lab/utils-java8 | src/main/java/kr/jm/utils/JMProgressiveManager.java | JMProgressiveManager.registerTargetChangeListener | public JMProgressiveManager<T, R>
registerTargetChangeListener(Consumer<T> targetChangeListener) {
"""
Register target change listener jm progressive manager.
@param targetChangeListener the target change listener
@return the jm progressive manager
"""
return registerListener(currentTarget, targetChangeListener);
} | java | public JMProgressiveManager<T, R>
registerTargetChangeListener(Consumer<T> targetChangeListener) {
return registerListener(currentTarget, targetChangeListener);
} | [
"public",
"JMProgressiveManager",
"<",
"T",
",",
"R",
">",
"registerTargetChangeListener",
"(",
"Consumer",
"<",
"T",
">",
"targetChangeListener",
")",
"{",
"return",
"registerListener",
"(",
"currentTarget",
",",
"targetChangeListener",
")",
";",
"}"
] | Register target change listener jm progressive manager.
@param targetChangeListener the target change listener
@return the jm progressive manager | [
"Register",
"target",
"change",
"listener",
"jm",
"progressive",
"manager",
"."
] | train | https://github.com/JM-Lab/utils-java8/blob/9e407b3f28a7990418a1e877229fa8344f4d78a5/src/main/java/kr/jm/utils/JMProgressiveManager.java#L296-L299 |
qiniu/java-sdk | src/main/java/com/qiniu/util/Auth.java | Auth.uploadToken | public String uploadToken(String bucket, String key, long expires, StringMap policy) {
"""
生成上传token
@param bucket 空间名
@param key key,可为 null
@param expires 有效时长,单位秒
@param policy 上传策略的其它参数,如 new StringMap().put("endUser", "uid").putNotEmpty("returnBody", "")。
scope通过 bucket、key间接设置,deadline 通过 expires 间接设置
@return 生成的上传token
"""
return uploadToken(bucket, key, expires, policy, true);
} | java | public String uploadToken(String bucket, String key, long expires, StringMap policy) {
return uploadToken(bucket, key, expires, policy, true);
} | [
"public",
"String",
"uploadToken",
"(",
"String",
"bucket",
",",
"String",
"key",
",",
"long",
"expires",
",",
"StringMap",
"policy",
")",
"{",
"return",
"uploadToken",
"(",
"bucket",
",",
"key",
",",
"expires",
",",
"policy",
",",
"true",
")",
";",
"}"
] | 生成上传token
@param bucket 空间名
@param key key,可为 null
@param expires 有效时长,单位秒
@param policy 上传策略的其它参数,如 new StringMap().put("endUser", "uid").putNotEmpty("returnBody", "")。
scope通过 bucket、key间接设置,deadline 通过 expires 间接设置
@return 生成的上传token | [
"生成上传token"
] | train | https://github.com/qiniu/java-sdk/blob/6c05f3fb718403a496c725b048e9241f80171499/src/main/java/com/qiniu/util/Auth.java#L232-L234 |
NoraUi/NoraUi | src/main/java/com/github/noraui/application/steps/MailSteps.java | MailSteps.validActivationEmail | @Experimental(name = "validActivationEmail")
@RetryOnFailure(attempts = 3, delay = 60)
@Conditioned
@Et("Je valide le mail d'activation '(.*)'[\\.|\\?]")
@And("I valid activation email '(.*)'[\\.|\\?]")
public void validActivationEmail(String mailHost, String mailUser, String mailPassword, String senderMail, String subjectMail, String firstCssQuery, List<GherkinStepCondition> conditions)
throws FailureException, TechnicalException {
"""
Valid activation email.
@param mailHost
example: imap.gmail.com
@param mailUser
login of mail box
@param mailPassword
password of mail box
@param firstCssQuery
the first matching element
@param conditions
list of 'expected' values condition and 'actual' values ({@link com.github.noraui.gherkin.GherkinStepCondition}).
@throws TechnicalException
is throws if you have a technical error (format, configuration, datas, ...) in NoraUi.
Exception with message and with screenshot and with exception if functional error but no screenshot and no exception if technical error.
@throws FailureException
if the scenario encounters a functional error
"""
try {
final Properties props = System.getProperties();
props.setProperty("mail.store.protocol", "imap");
final Session session = Session.getDefaultInstance(props, null);
final Store store = session.getStore("imaps");
store.connect(mailHost, mailUser, mailPassword);
final Folder inbox = store.getFolder("Inbox");
inbox.open(Folder.READ_ONLY);
final SearchTerm filterA = new FlagTerm(new Flags(Flags.Flag.SEEN), false);
final SearchTerm filterB = new FromTerm(new InternetAddress(senderMail));
final SearchTerm filterC = new SubjectTerm(subjectMail);
final SearchTerm[] filters = { filterA, filterB, filterC };
final SearchTerm searchTerm = new AndTerm(filters);
final Message[] messages = inbox.search(searchTerm);
for (final Message message : messages) {
validateActivationLink(subjectMail, firstCssQuery, message);
}
} catch (final Exception e) {
new Result.Failure<>("", Messages.format(Messages.getMessage(Messages.FAIL_MESSAGE_MAIL_ACTIVATION), subjectMail), false, Context.getCallBack(Callbacks.RESTART_WEB_DRIVER));
}
} | java | @Experimental(name = "validActivationEmail")
@RetryOnFailure(attempts = 3, delay = 60)
@Conditioned
@Et("Je valide le mail d'activation '(.*)'[\\.|\\?]")
@And("I valid activation email '(.*)'[\\.|\\?]")
public void validActivationEmail(String mailHost, String mailUser, String mailPassword, String senderMail, String subjectMail, String firstCssQuery, List<GherkinStepCondition> conditions)
throws FailureException, TechnicalException {
try {
final Properties props = System.getProperties();
props.setProperty("mail.store.protocol", "imap");
final Session session = Session.getDefaultInstance(props, null);
final Store store = session.getStore("imaps");
store.connect(mailHost, mailUser, mailPassword);
final Folder inbox = store.getFolder("Inbox");
inbox.open(Folder.READ_ONLY);
final SearchTerm filterA = new FlagTerm(new Flags(Flags.Flag.SEEN), false);
final SearchTerm filterB = new FromTerm(new InternetAddress(senderMail));
final SearchTerm filterC = new SubjectTerm(subjectMail);
final SearchTerm[] filters = { filterA, filterB, filterC };
final SearchTerm searchTerm = new AndTerm(filters);
final Message[] messages = inbox.search(searchTerm);
for (final Message message : messages) {
validateActivationLink(subjectMail, firstCssQuery, message);
}
} catch (final Exception e) {
new Result.Failure<>("", Messages.format(Messages.getMessage(Messages.FAIL_MESSAGE_MAIL_ACTIVATION), subjectMail), false, Context.getCallBack(Callbacks.RESTART_WEB_DRIVER));
}
} | [
"@",
"Experimental",
"(",
"name",
"=",
"\"validActivationEmail\"",
")",
"@",
"RetryOnFailure",
"(",
"attempts",
"=",
"3",
",",
"delay",
"=",
"60",
")",
"@",
"Conditioned",
"@",
"Et",
"(",
"\"Je valide le mail d'activation '(.*)'[\\\\.|\\\\?]\"",
")",
"@",
"And",
"(",
"\"I valid activation email '(.*)'[\\\\.|\\\\?]\"",
")",
"public",
"void",
"validActivationEmail",
"(",
"String",
"mailHost",
",",
"String",
"mailUser",
",",
"String",
"mailPassword",
",",
"String",
"senderMail",
",",
"String",
"subjectMail",
",",
"String",
"firstCssQuery",
",",
"List",
"<",
"GherkinStepCondition",
">",
"conditions",
")",
"throws",
"FailureException",
",",
"TechnicalException",
"{",
"try",
"{",
"final",
"Properties",
"props",
"=",
"System",
".",
"getProperties",
"(",
")",
";",
"props",
".",
"setProperty",
"(",
"\"mail.store.protocol\"",
",",
"\"imap\"",
")",
";",
"final",
"Session",
"session",
"=",
"Session",
".",
"getDefaultInstance",
"(",
"props",
",",
"null",
")",
";",
"final",
"Store",
"store",
"=",
"session",
".",
"getStore",
"(",
"\"imaps\"",
")",
";",
"store",
".",
"connect",
"(",
"mailHost",
",",
"mailUser",
",",
"mailPassword",
")",
";",
"final",
"Folder",
"inbox",
"=",
"store",
".",
"getFolder",
"(",
"\"Inbox\"",
")",
";",
"inbox",
".",
"open",
"(",
"Folder",
".",
"READ_ONLY",
")",
";",
"final",
"SearchTerm",
"filterA",
"=",
"new",
"FlagTerm",
"(",
"new",
"Flags",
"(",
"Flags",
".",
"Flag",
".",
"SEEN",
")",
",",
"false",
")",
";",
"final",
"SearchTerm",
"filterB",
"=",
"new",
"FromTerm",
"(",
"new",
"InternetAddress",
"(",
"senderMail",
")",
")",
";",
"final",
"SearchTerm",
"filterC",
"=",
"new",
"SubjectTerm",
"(",
"subjectMail",
")",
";",
"final",
"SearchTerm",
"[",
"]",
"filters",
"=",
"{",
"filterA",
",",
"filterB",
",",
"filterC",
"}",
";",
"final",
"SearchTerm",
"searchTerm",
"=",
"new",
"AndTerm",
"(",
"filters",
")",
";",
"final",
"Message",
"[",
"]",
"messages",
"=",
"inbox",
".",
"search",
"(",
"searchTerm",
")",
";",
"for",
"(",
"final",
"Message",
"message",
":",
"messages",
")",
"{",
"validateActivationLink",
"(",
"subjectMail",
",",
"firstCssQuery",
",",
"message",
")",
";",
"}",
"}",
"catch",
"(",
"final",
"Exception",
"e",
")",
"{",
"new",
"Result",
".",
"Failure",
"<>",
"(",
"\"\"",
",",
"Messages",
".",
"format",
"(",
"Messages",
".",
"getMessage",
"(",
"Messages",
".",
"FAIL_MESSAGE_MAIL_ACTIVATION",
")",
",",
"subjectMail",
")",
",",
"false",
",",
"Context",
".",
"getCallBack",
"(",
"Callbacks",
".",
"RESTART_WEB_DRIVER",
")",
")",
";",
"}",
"}"
] | Valid activation email.
@param mailHost
example: imap.gmail.com
@param mailUser
login of mail box
@param mailPassword
password of mail box
@param firstCssQuery
the first matching element
@param conditions
list of 'expected' values condition and 'actual' values ({@link com.github.noraui.gherkin.GherkinStepCondition}).
@throws TechnicalException
is throws if you have a technical error (format, configuration, datas, ...) in NoraUi.
Exception with message and with screenshot and with exception if functional error but no screenshot and no exception if technical error.
@throws FailureException
if the scenario encounters a functional error | [
"Valid",
"activation",
"email",
"."
] | train | https://github.com/NoraUi/NoraUi/blob/5f491a3339c7d3c20d7207760bdaf2acdb8f260c/src/main/java/com/github/noraui/application/steps/MailSteps.java#L83-L110 |
imsweb/naaccr-xml | src/main/java/com/imsweb/naaccrxml/NaaccrXmlDictionaryUtils.java | NaaccrXmlDictionaryUtils.mergeDictionaries | public static NaaccrDictionary mergeDictionaries(NaaccrDictionary baseDictionary, NaaccrDictionary... userDictionaries) {
"""
Merges the given base dictionary and user dictionaries into one dictionary.
<br/><br/>
Sort order of the items is based on start column, items without a start column go to the end.
@param baseDictionary base dictionary, required
@param userDictionaries user dictionaries, optional
@return a new merged dictionary containing the items of all the provided dictionaries.
"""
if (baseDictionary == null)
throw new RuntimeException("Base dictionary is required");
NaaccrDictionary result = new NaaccrDictionary();
result.setNaaccrVersion(baseDictionary.getNaaccrVersion());
result.setDictionaryUri(baseDictionary.getDictionaryUri() + "[merged]");
result.setSpecificationVersion(baseDictionary.getSpecificationVersion());
result.setDescription(baseDictionary.getDescription());
List<NaaccrDictionaryItem> items = new ArrayList<>(baseDictionary.getItems());
for (NaaccrDictionary userDictionary : userDictionaries)
items.addAll(userDictionary.getItems());
items.sort(Comparator.comparing(NaaccrDictionaryItem::getNaaccrId));
result.setItems(items);
List<NaaccrDictionaryGroupedItem> groupedItems = new ArrayList<>(baseDictionary.getGroupedItems());
for (NaaccrDictionary userDictionary : userDictionaries)
groupedItems.addAll(userDictionary.getGroupedItems());
groupedItems.sort(Comparator.comparing(NaaccrDictionaryItem::getNaaccrId));
result.setGroupedItems(groupedItems);
return result;
} | java | public static NaaccrDictionary mergeDictionaries(NaaccrDictionary baseDictionary, NaaccrDictionary... userDictionaries) {
if (baseDictionary == null)
throw new RuntimeException("Base dictionary is required");
NaaccrDictionary result = new NaaccrDictionary();
result.setNaaccrVersion(baseDictionary.getNaaccrVersion());
result.setDictionaryUri(baseDictionary.getDictionaryUri() + "[merged]");
result.setSpecificationVersion(baseDictionary.getSpecificationVersion());
result.setDescription(baseDictionary.getDescription());
List<NaaccrDictionaryItem> items = new ArrayList<>(baseDictionary.getItems());
for (NaaccrDictionary userDictionary : userDictionaries)
items.addAll(userDictionary.getItems());
items.sort(Comparator.comparing(NaaccrDictionaryItem::getNaaccrId));
result.setItems(items);
List<NaaccrDictionaryGroupedItem> groupedItems = new ArrayList<>(baseDictionary.getGroupedItems());
for (NaaccrDictionary userDictionary : userDictionaries)
groupedItems.addAll(userDictionary.getGroupedItems());
groupedItems.sort(Comparator.comparing(NaaccrDictionaryItem::getNaaccrId));
result.setGroupedItems(groupedItems);
return result;
} | [
"public",
"static",
"NaaccrDictionary",
"mergeDictionaries",
"(",
"NaaccrDictionary",
"baseDictionary",
",",
"NaaccrDictionary",
"...",
"userDictionaries",
")",
"{",
"if",
"(",
"baseDictionary",
"==",
"null",
")",
"throw",
"new",
"RuntimeException",
"(",
"\"Base dictionary is required\"",
")",
";",
"NaaccrDictionary",
"result",
"=",
"new",
"NaaccrDictionary",
"(",
")",
";",
"result",
".",
"setNaaccrVersion",
"(",
"baseDictionary",
".",
"getNaaccrVersion",
"(",
")",
")",
";",
"result",
".",
"setDictionaryUri",
"(",
"baseDictionary",
".",
"getDictionaryUri",
"(",
")",
"+",
"\"[merged]\"",
")",
";",
"result",
".",
"setSpecificationVersion",
"(",
"baseDictionary",
".",
"getSpecificationVersion",
"(",
")",
")",
";",
"result",
".",
"setDescription",
"(",
"baseDictionary",
".",
"getDescription",
"(",
")",
")",
";",
"List",
"<",
"NaaccrDictionaryItem",
">",
"items",
"=",
"new",
"ArrayList",
"<>",
"(",
"baseDictionary",
".",
"getItems",
"(",
")",
")",
";",
"for",
"(",
"NaaccrDictionary",
"userDictionary",
":",
"userDictionaries",
")",
"items",
".",
"addAll",
"(",
"userDictionary",
".",
"getItems",
"(",
")",
")",
";",
"items",
".",
"sort",
"(",
"Comparator",
".",
"comparing",
"(",
"NaaccrDictionaryItem",
"::",
"getNaaccrId",
")",
")",
";",
"result",
".",
"setItems",
"(",
"items",
")",
";",
"List",
"<",
"NaaccrDictionaryGroupedItem",
">",
"groupedItems",
"=",
"new",
"ArrayList",
"<>",
"(",
"baseDictionary",
".",
"getGroupedItems",
"(",
")",
")",
";",
"for",
"(",
"NaaccrDictionary",
"userDictionary",
":",
"userDictionaries",
")",
"groupedItems",
".",
"addAll",
"(",
"userDictionary",
".",
"getGroupedItems",
"(",
")",
")",
";",
"groupedItems",
".",
"sort",
"(",
"Comparator",
".",
"comparing",
"(",
"NaaccrDictionaryItem",
"::",
"getNaaccrId",
")",
")",
";",
"result",
".",
"setGroupedItems",
"(",
"groupedItems",
")",
";",
"return",
"result",
";",
"}"
] | Merges the given base dictionary and user dictionaries into one dictionary.
<br/><br/>
Sort order of the items is based on start column, items without a start column go to the end.
@param baseDictionary base dictionary, required
@param userDictionaries user dictionaries, optional
@return a new merged dictionary containing the items of all the provided dictionaries. | [
"Merges",
"the",
"given",
"base",
"dictionary",
"and",
"user",
"dictionaries",
"into",
"one",
"dictionary",
".",
"<br",
"/",
">",
"<br",
"/",
">",
"Sort",
"order",
"of",
"the",
"items",
"is",
"based",
"on",
"start",
"column",
"items",
"without",
"a",
"start",
"column",
"go",
"to",
"the",
"end",
"."
] | train | https://github.com/imsweb/naaccr-xml/blob/a3a501faa2a0c3411dd5248b2c1379f279131696/src/main/java/com/imsweb/naaccrxml/NaaccrXmlDictionaryUtils.java#L690-L713 |
gosu-lang/gosu-lang | gosu-core/src/main/java/gw/internal/gosu/parser/BeanAccess.java | BeanAccess.areBeansEqual | public static boolean areBeansEqual( Object bean1, Object bean2 ) {
"""
Test for equality between two BeanType values. Note this method is not entirely appropriate for
non-BeanType value i.e., it's not as intelligent as EqualityExpression comparing primitive types,
TypeKeys, etc.
<p/>
Msotly this method is for handling conversion of KeyableBean and Key for comparison.
@param bean1 A value having an IType of BeanType
@param bean2 A value having an IType of BeanType
@return True if the beans are equal
"""
if( bean1 == bean2 )
{
return true;
}
if( bean1 == null || bean2 == null )
{
return false;
}
IType class1 = TypeLoaderAccess.instance().getIntrinsicTypeFromObject( bean1 );
IType class2 = TypeLoaderAccess.instance().getIntrinsicTypeFromObject( bean2 );
if( class1.isAssignableFrom( class2 ) || class2.isAssignableFrom( class1 ) )
{
return bean1.equals( bean2 );
}
if( CommonServices.getEntityAccess().isDomainInstance( bean1 ) ||
CommonServices.getEntityAccess().isDomainInstance( bean2 ) )
{
return CommonServices.getEntityAccess().areBeansEqual( bean1, bean2 );
}
return bean1.equals( bean2 );
} | java | public static boolean areBeansEqual( Object bean1, Object bean2 )
{
if( bean1 == bean2 )
{
return true;
}
if( bean1 == null || bean2 == null )
{
return false;
}
IType class1 = TypeLoaderAccess.instance().getIntrinsicTypeFromObject( bean1 );
IType class2 = TypeLoaderAccess.instance().getIntrinsicTypeFromObject( bean2 );
if( class1.isAssignableFrom( class2 ) || class2.isAssignableFrom( class1 ) )
{
return bean1.equals( bean2 );
}
if( CommonServices.getEntityAccess().isDomainInstance( bean1 ) ||
CommonServices.getEntityAccess().isDomainInstance( bean2 ) )
{
return CommonServices.getEntityAccess().areBeansEqual( bean1, bean2 );
}
return bean1.equals( bean2 );
} | [
"public",
"static",
"boolean",
"areBeansEqual",
"(",
"Object",
"bean1",
",",
"Object",
"bean2",
")",
"{",
"if",
"(",
"bean1",
"==",
"bean2",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"bean1",
"==",
"null",
"||",
"bean2",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"IType",
"class1",
"=",
"TypeLoaderAccess",
".",
"instance",
"(",
")",
".",
"getIntrinsicTypeFromObject",
"(",
"bean1",
")",
";",
"IType",
"class2",
"=",
"TypeLoaderAccess",
".",
"instance",
"(",
")",
".",
"getIntrinsicTypeFromObject",
"(",
"bean2",
")",
";",
"if",
"(",
"class1",
".",
"isAssignableFrom",
"(",
"class2",
")",
"||",
"class2",
".",
"isAssignableFrom",
"(",
"class1",
")",
")",
"{",
"return",
"bean1",
".",
"equals",
"(",
"bean2",
")",
";",
"}",
"if",
"(",
"CommonServices",
".",
"getEntityAccess",
"(",
")",
".",
"isDomainInstance",
"(",
"bean1",
")",
"||",
"CommonServices",
".",
"getEntityAccess",
"(",
")",
".",
"isDomainInstance",
"(",
"bean2",
")",
")",
"{",
"return",
"CommonServices",
".",
"getEntityAccess",
"(",
")",
".",
"areBeansEqual",
"(",
"bean1",
",",
"bean2",
")",
";",
"}",
"return",
"bean1",
".",
"equals",
"(",
"bean2",
")",
";",
"}"
] | Test for equality between two BeanType values. Note this method is not entirely appropriate for
non-BeanType value i.e., it's not as intelligent as EqualityExpression comparing primitive types,
TypeKeys, etc.
<p/>
Msotly this method is for handling conversion of KeyableBean and Key for comparison.
@param bean1 A value having an IType of BeanType
@param bean2 A value having an IType of BeanType
@return True if the beans are equal | [
"Test",
"for",
"equality",
"between",
"two",
"BeanType",
"values",
".",
"Note",
"this",
"method",
"is",
"not",
"entirely",
"appropriate",
"for",
"non",
"-",
"BeanType",
"value",
"i",
".",
"e",
".",
"it",
"s",
"not",
"as",
"intelligent",
"as",
"EqualityExpression",
"comparing",
"primitive",
"types",
"TypeKeys",
"etc",
".",
"<p",
"/",
">",
"Msotly",
"this",
"method",
"is",
"for",
"handling",
"conversion",
"of",
"KeyableBean",
"and",
"Key",
"for",
"comparison",
"."
] | train | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core/src/main/java/gw/internal/gosu/parser/BeanAccess.java#L299-L325 |
aspnet/SignalR | clients/java/signalr/src/main/java/com/microsoft/signalr/HttpHubConnectionBuilder.java | HttpHubConnectionBuilder.withHeader | public HttpHubConnectionBuilder withHeader(String name, String value) {
"""
Sets a single header for the {@link HubConnection} to send.
@param name The name of the header to set.
@param value The value of the header to be set.
@return This instance of the HttpHubConnectionBuilder.
"""
if (headers == null) {
this.headers = new HashMap<>();
}
this.headers.put(name, value);
return this;
} | java | public HttpHubConnectionBuilder withHeader(String name, String value) {
if (headers == null) {
this.headers = new HashMap<>();
}
this.headers.put(name, value);
return this;
} | [
"public",
"HttpHubConnectionBuilder",
"withHeader",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"if",
"(",
"headers",
"==",
"null",
")",
"{",
"this",
".",
"headers",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"}",
"this",
".",
"headers",
".",
"put",
"(",
"name",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | Sets a single header for the {@link HubConnection} to send.
@param name The name of the header to set.
@param value The value of the header to be set.
@return This instance of the HttpHubConnectionBuilder. | [
"Sets",
"a",
"single",
"header",
"for",
"the",
"{",
"@link",
"HubConnection",
"}",
"to",
"send",
"."
] | train | https://github.com/aspnet/SignalR/blob/8c6ed160d84f58ce8edf06a1c74221ddc8983ee9/clients/java/signalr/src/main/java/com/microsoft/signalr/HttpHubConnectionBuilder.java#L101-L107 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/MessageDigest.java | MessageDigest.isEqual | public static boolean isEqual(byte[] digesta, byte[] digestb) {
"""
Compares two digests for equality. Does a simple byte compare.
@param digesta one of the digests to compare.
@param digestb the other digest to compare.
@return true if the digests are equal, false otherwise.
"""
if (digesta == digestb) return true;
if (digesta == null || digestb == null) {
return false;
}
if (digesta.length != digestb.length) {
return false;
}
int result = 0;
// time-constant comparison
for (int i = 0; i < digesta.length; i++) {
result |= digesta[i] ^ digestb[i];
}
return result == 0;
} | java | public static boolean isEqual(byte[] digesta, byte[] digestb) {
if (digesta == digestb) return true;
if (digesta == null || digestb == null) {
return false;
}
if (digesta.length != digestb.length) {
return false;
}
int result = 0;
// time-constant comparison
for (int i = 0; i < digesta.length; i++) {
result |= digesta[i] ^ digestb[i];
}
return result == 0;
} | [
"public",
"static",
"boolean",
"isEqual",
"(",
"byte",
"[",
"]",
"digesta",
",",
"byte",
"[",
"]",
"digestb",
")",
"{",
"if",
"(",
"digesta",
"==",
"digestb",
")",
"return",
"true",
";",
"if",
"(",
"digesta",
"==",
"null",
"||",
"digestb",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"digesta",
".",
"length",
"!=",
"digestb",
".",
"length",
")",
"{",
"return",
"false",
";",
"}",
"int",
"result",
"=",
"0",
";",
"// time-constant comparison",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"digesta",
".",
"length",
";",
"i",
"++",
")",
"{",
"result",
"|=",
"digesta",
"[",
"i",
"]",
"^",
"digestb",
"[",
"i",
"]",
";",
"}",
"return",
"result",
"==",
"0",
";",
"}"
] | Compares two digests for equality. Does a simple byte compare.
@param digesta one of the digests to compare.
@param digestb the other digest to compare.
@return true if the digests are equal, false otherwise. | [
"Compares",
"two",
"digests",
"for",
"equality",
".",
"Does",
"a",
"simple",
"byte",
"compare",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/MessageDigest.java#L480-L495 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/Stylesheet.java | Stylesheet.containsExcludeResultPrefix | public boolean containsExcludeResultPrefix(String prefix, String uri) {
"""
Get whether or not the passed prefix is contained flagged by
the "exclude-result-prefixes" property.
@see <a href="http://www.w3.org/TR/xslt#literal-result-element">literal-result-element in XSLT Specification</a>
@param prefix non-null reference to prefix that might be excluded.
@param uri reference to namespace that prefix maps to
@return true if the prefix should normally be excluded.>
"""
if (null == m_ExcludeResultPrefixs || uri == null )
return false;
// This loop is ok here because this code only runs during
// stylesheet compile time.
for (int i =0; i< m_ExcludeResultPrefixs.size(); i++)
{
if (uri.equals(getNamespaceForPrefix(m_ExcludeResultPrefixs.elementAt(i))))
return true;
}
return false;
/* if (prefix.length() == 0)
prefix = Constants.ATTRVAL_DEFAULT_PREFIX;
return m_ExcludeResultPrefixs.contains(prefix); */
} | java | public boolean containsExcludeResultPrefix(String prefix, String uri)
{
if (null == m_ExcludeResultPrefixs || uri == null )
return false;
// This loop is ok here because this code only runs during
// stylesheet compile time.
for (int i =0; i< m_ExcludeResultPrefixs.size(); i++)
{
if (uri.equals(getNamespaceForPrefix(m_ExcludeResultPrefixs.elementAt(i))))
return true;
}
return false;
/* if (prefix.length() == 0)
prefix = Constants.ATTRVAL_DEFAULT_PREFIX;
return m_ExcludeResultPrefixs.contains(prefix); */
} | [
"public",
"boolean",
"containsExcludeResultPrefix",
"(",
"String",
"prefix",
",",
"String",
"uri",
")",
"{",
"if",
"(",
"null",
"==",
"m_ExcludeResultPrefixs",
"||",
"uri",
"==",
"null",
")",
"return",
"false",
";",
"// This loop is ok here because this code only runs during",
"// stylesheet compile time.",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"m_ExcludeResultPrefixs",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"if",
"(",
"uri",
".",
"equals",
"(",
"getNamespaceForPrefix",
"(",
"m_ExcludeResultPrefixs",
".",
"elementAt",
"(",
"i",
")",
")",
")",
")",
"return",
"true",
";",
"}",
"return",
"false",
";",
"/* if (prefix.length() == 0)\n prefix = Constants.ATTRVAL_DEFAULT_PREFIX;\n\n return m_ExcludeResultPrefixs.contains(prefix); */",
"}"
] | Get whether or not the passed prefix is contained flagged by
the "exclude-result-prefixes" property.
@see <a href="http://www.w3.org/TR/xslt#literal-result-element">literal-result-element in XSLT Specification</a>
@param prefix non-null reference to prefix that might be excluded.
@param uri reference to namespace that prefix maps to
@return true if the prefix should normally be excluded.> | [
"Get",
"whether",
"or",
"not",
"the",
"passed",
"prefix",
"is",
"contained",
"flagged",
"by",
"the",
"exclude",
"-",
"result",
"-",
"prefixes",
"property",
".",
"@see",
"<a",
"href",
"=",
"http",
":",
"//",
"www",
".",
"w3",
".",
"org",
"/",
"TR",
"/",
"xslt#literal",
"-",
"result",
"-",
"element",
">",
"literal",
"-",
"result",
"-",
"element",
"in",
"XSLT",
"Specification<",
"/",
"a",
">"
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/Stylesheet.java#L348-L368 |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Util.java | Util.findMethod | public static MethodDoc findMethod(ClassDoc cd, MethodDoc method) {
"""
Search for the given method in the given class.
@param cd Class to search into.
@param method Method to be searched.
@return MethodDoc Method found, null otherwise.
"""
MethodDoc[] methods = cd.methods();
for (int i = 0; i < methods.length; i++) {
if (executableMembersEqual(method, methods[i])) {
return methods[i];
}
}
return null;
} | java | public static MethodDoc findMethod(ClassDoc cd, MethodDoc method) {
MethodDoc[] methods = cd.methods();
for (int i = 0; i < methods.length; i++) {
if (executableMembersEqual(method, methods[i])) {
return methods[i];
}
}
return null;
} | [
"public",
"static",
"MethodDoc",
"findMethod",
"(",
"ClassDoc",
"cd",
",",
"MethodDoc",
"method",
")",
"{",
"MethodDoc",
"[",
"]",
"methods",
"=",
"cd",
".",
"methods",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"methods",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"executableMembersEqual",
"(",
"method",
",",
"methods",
"[",
"i",
"]",
")",
")",
"{",
"return",
"methods",
"[",
"i",
"]",
";",
"}",
"}",
"return",
"null",
";",
"}"
] | Search for the given method in the given class.
@param cd Class to search into.
@param method Method to be searched.
@return MethodDoc Method found, null otherwise. | [
"Search",
"for",
"the",
"given",
"method",
"in",
"the",
"given",
"class",
"."
] | train | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Util.java#L120-L129 |
spring-projects/spring-android | spring-android-rest-template/src/main/java/org/springframework/http/client/HttpComponentsClientHttpRequestFactory.java | HttpComponentsClientHttpRequestFactory.setLegacyConnectionTimeout | @SuppressWarnings("deprecation")
private void setLegacyConnectionTimeout(HttpClient client, int timeout) {
"""
Apply the specified connection timeout to deprecated {@link HttpClient}
implementations.
<p>
As of HttpClient 4.3, default parameters have to be exposed through a
{@link RequestConfig} instance instead of setting the parameters on the client.
Unfortunately, this behavior is not backward-compatible and older
{@link HttpClient} implementations will ignore the {@link RequestConfig} object set
in the context.
<p>
If the specified client is an older implementation, we set the custom connection
timeout through the deprecated API. Otherwise, we just return as it is set through
{@link RequestConfig} with newer clients.
@param client the client to configure
@param timeout the custom connection timeout
"""
if (org.apache.http.impl.client.AbstractHttpClient.class.isInstance(client)) {
client.getParams().setIntParameter(
org.apache.http.params.CoreConnectionPNames.CONNECTION_TIMEOUT, timeout);
}
} | java | @SuppressWarnings("deprecation")
private void setLegacyConnectionTimeout(HttpClient client, int timeout) {
if (org.apache.http.impl.client.AbstractHttpClient.class.isInstance(client)) {
client.getParams().setIntParameter(
org.apache.http.params.CoreConnectionPNames.CONNECTION_TIMEOUT, timeout);
}
} | [
"@",
"SuppressWarnings",
"(",
"\"deprecation\"",
")",
"private",
"void",
"setLegacyConnectionTimeout",
"(",
"HttpClient",
"client",
",",
"int",
"timeout",
")",
"{",
"if",
"(",
"org",
".",
"apache",
".",
"http",
".",
"impl",
".",
"client",
".",
"AbstractHttpClient",
".",
"class",
".",
"isInstance",
"(",
"client",
")",
")",
"{",
"client",
".",
"getParams",
"(",
")",
".",
"setIntParameter",
"(",
"org",
".",
"apache",
".",
"http",
".",
"params",
".",
"CoreConnectionPNames",
".",
"CONNECTION_TIMEOUT",
",",
"timeout",
")",
";",
"}",
"}"
] | Apply the specified connection timeout to deprecated {@link HttpClient}
implementations.
<p>
As of HttpClient 4.3, default parameters have to be exposed through a
{@link RequestConfig} instance instead of setting the parameters on the client.
Unfortunately, this behavior is not backward-compatible and older
{@link HttpClient} implementations will ignore the {@link RequestConfig} object set
in the context.
<p>
If the specified client is an older implementation, we set the custom connection
timeout through the deprecated API. Otherwise, we just return as it is set through
{@link RequestConfig} with newer clients.
@param client the client to configure
@param timeout the custom connection timeout | [
"Apply",
"the",
"specified",
"connection",
"timeout",
"to",
"deprecated",
"{"
] | train | https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-rest-template/src/main/java/org/springframework/http/client/HttpComponentsClientHttpRequestFactory.java#L137-L143 |
goodow/realtime-json | src/main/java/com/goodow/realtime/json/impl/Base64.java | Base64.encodeBytes | public static String encodeBytes(final byte[] source, final int options) {
"""
Encodes a byte array into Base64 notation.
<p/>
Valid options:
<pre>
GZIP: gzip-compresses object before encoding it.
DONT_BREAK_LINES: don't break lines at 76 characters
<i>Note: Technically, this makes your encoding non-compliant.</i>
</pre>
<p/>
Example: <code>encodeBytes( myData, Base64.GZIP )</code> or
<p/>
Example: <code>encodeBytes( myData, Base64.GZIP | Base64.DONT_BREAK_LINES )</code>
@param source The data to convert
@param options Specified options
@see Base64#GZIP
@see Base64#DONT_BREAK_LINES
@since 2.0
"""
return Base64.encodeBytes(source, 0, source.length, options);
} | java | public static String encodeBytes(final byte[] source, final int options) {
return Base64.encodeBytes(source, 0, source.length, options);
} | [
"public",
"static",
"String",
"encodeBytes",
"(",
"final",
"byte",
"[",
"]",
"source",
",",
"final",
"int",
"options",
")",
"{",
"return",
"Base64",
".",
"encodeBytes",
"(",
"source",
",",
"0",
",",
"source",
".",
"length",
",",
"options",
")",
";",
"}"
] | Encodes a byte array into Base64 notation.
<p/>
Valid options:
<pre>
GZIP: gzip-compresses object before encoding it.
DONT_BREAK_LINES: don't break lines at 76 characters
<i>Note: Technically, this makes your encoding non-compliant.</i>
</pre>
<p/>
Example: <code>encodeBytes( myData, Base64.GZIP )</code> or
<p/>
Example: <code>encodeBytes( myData, Base64.GZIP | Base64.DONT_BREAK_LINES )</code>
@param source The data to convert
@param options Specified options
@see Base64#GZIP
@see Base64#DONT_BREAK_LINES
@since 2.0 | [
"Encodes",
"a",
"byte",
"array",
"into",
"Base64",
"notation",
".",
"<p",
"/",
">",
"Valid",
"options",
":"
] | train | https://github.com/goodow/realtime-json/blob/be2f5a8cab27afa052583ae2e09f6f7975d8cb0c/src/main/java/com/goodow/realtime/json/impl/Base64.java#L1116-L1118 |
landawn/AbacusUtil | src/com/landawn/abacus/util/stream/Stream.java | Stream.parallelZip | public static <A, B, R> Stream<R> parallelZip(final Stream<A> a, final Stream<B> b, final BiFunction<? super A, ? super B, R> zipFunction) {
"""
Put the stream in try-catch to stop the back-end reading thread if error happens
<br />
<code>
try (Stream<Integer> stream = Stream.parallelZip(a, b, zipFunction)) {
stream.forEach(N::println);
}
</code>
@param a
@param b
@param zipFunction
@return
"""
return parallelZip(a, b, zipFunction, DEFAULT_QUEUE_SIZE_PER_ITERATOR);
} | java | public static <A, B, R> Stream<R> parallelZip(final Stream<A> a, final Stream<B> b, final BiFunction<? super A, ? super B, R> zipFunction) {
return parallelZip(a, b, zipFunction, DEFAULT_QUEUE_SIZE_PER_ITERATOR);
} | [
"public",
"static",
"<",
"A",
",",
"B",
",",
"R",
">",
"Stream",
"<",
"R",
">",
"parallelZip",
"(",
"final",
"Stream",
"<",
"A",
">",
"a",
",",
"final",
"Stream",
"<",
"B",
">",
"b",
",",
"final",
"BiFunction",
"<",
"?",
"super",
"A",
",",
"?",
"super",
"B",
",",
"R",
">",
"zipFunction",
")",
"{",
"return",
"parallelZip",
"(",
"a",
",",
"b",
",",
"zipFunction",
",",
"DEFAULT_QUEUE_SIZE_PER_ITERATOR",
")",
";",
"}"
] | Put the stream in try-catch to stop the back-end reading thread if error happens
<br />
<code>
try (Stream<Integer> stream = Stream.parallelZip(a, b, zipFunction)) {
stream.forEach(N::println);
}
</code>
@param a
@param b
@param zipFunction
@return | [
"Put",
"the",
"stream",
"in",
"try",
"-",
"catch",
"to",
"stop",
"the",
"back",
"-",
"end",
"reading",
"thread",
"if",
"error",
"happens",
"<br",
"/",
">",
"<code",
">",
"try",
"(",
"Stream<Integer",
">",
"stream",
"=",
"Stream",
".",
"parallelZip",
"(",
"a",
"b",
"zipFunction",
"))",
"{",
"stream",
".",
"forEach",
"(",
"N",
"::",
"println",
")",
";",
"}",
"<",
"/",
"code",
">"
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/stream/Stream.java#L7770-L7772 |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/core/encoding/ConvertNV21.java | ConvertNV21.nv21ToGray | public static GrayU8 nv21ToGray(byte[] data , int width , int height , GrayU8 output ) {
"""
Converts an NV21 image into a gray scale U8 image.
@param data Input: NV21 image data
@param width Input: NV21 image width
@param height Input: NV21 image height
@param output Output: Optional storage for output image. Can be null.
@return Gray scale image
"""
if( output != null ) {
output.reshape(width,height);
} else {
output = new GrayU8(width,height);
}
if(BoofConcurrency.USE_CONCURRENT ) {
ImplConvertNV21_MT.nv21ToGray(data, output);
} else {
ImplConvertNV21.nv21ToGray(data, output);
}
return output;
} | java | public static GrayU8 nv21ToGray(byte[] data , int width , int height , GrayU8 output ) {
if( output != null ) {
output.reshape(width,height);
} else {
output = new GrayU8(width,height);
}
if(BoofConcurrency.USE_CONCURRENT ) {
ImplConvertNV21_MT.nv21ToGray(data, output);
} else {
ImplConvertNV21.nv21ToGray(data, output);
}
return output;
} | [
"public",
"static",
"GrayU8",
"nv21ToGray",
"(",
"byte",
"[",
"]",
"data",
",",
"int",
"width",
",",
"int",
"height",
",",
"GrayU8",
"output",
")",
"{",
"if",
"(",
"output",
"!=",
"null",
")",
"{",
"output",
".",
"reshape",
"(",
"width",
",",
"height",
")",
";",
"}",
"else",
"{",
"output",
"=",
"new",
"GrayU8",
"(",
"width",
",",
"height",
")",
";",
"}",
"if",
"(",
"BoofConcurrency",
".",
"USE_CONCURRENT",
")",
"{",
"ImplConvertNV21_MT",
".",
"nv21ToGray",
"(",
"data",
",",
"output",
")",
";",
"}",
"else",
"{",
"ImplConvertNV21",
".",
"nv21ToGray",
"(",
"data",
",",
"output",
")",
";",
"}",
"return",
"output",
";",
"}"
] | Converts an NV21 image into a gray scale U8 image.
@param data Input: NV21 image data
@param width Input: NV21 image width
@param height Input: NV21 image height
@param output Output: Optional storage for output image. Can be null.
@return Gray scale image | [
"Converts",
"an",
"NV21",
"image",
"into",
"a",
"gray",
"scale",
"U8",
"image",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/core/encoding/ConvertNV21.java#L110-L124 |
JamesIry/jADT | jADT-core/src/main/java/com/pogofish/jadt/printer/ASTPrinter.java | ASTPrinter.printComments | public static String printComments(String indent, List<JavaComment> comments) {
"""
Prints a list of comments pretty much unmolested except to add \n s
"""
final StringBuilder builder = new StringBuilder();
for (JavaComment comment : comments) {
builder.append(print(indent, comment));
builder.append("\n");
}
return builder.toString();
} | java | public static String printComments(String indent, List<JavaComment> comments) {
final StringBuilder builder = new StringBuilder();
for (JavaComment comment : comments) {
builder.append(print(indent, comment));
builder.append("\n");
}
return builder.toString();
} | [
"public",
"static",
"String",
"printComments",
"(",
"String",
"indent",
",",
"List",
"<",
"JavaComment",
">",
"comments",
")",
"{",
"final",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"JavaComment",
"comment",
":",
"comments",
")",
"{",
"builder",
".",
"append",
"(",
"print",
"(",
"indent",
",",
"comment",
")",
")",
";",
"builder",
".",
"append",
"(",
"\"\\n\"",
")",
";",
"}",
"return",
"builder",
".",
"toString",
"(",
")",
";",
"}"
] | Prints a list of comments pretty much unmolested except to add \n s | [
"Prints",
"a",
"list",
"of",
"comments",
"pretty",
"much",
"unmolested",
"except",
"to",
"add",
"\\",
"n",
"s"
] | train | https://github.com/JamesIry/jADT/blob/92ee94b6624cd673851497d78c218837dcf02b8a/jADT-core/src/main/java/com/pogofish/jadt/printer/ASTPrinter.java#L142-L149 |
Esri/geometry-api-java | src/main/java/com/esri/core/geometry/IndexMultiDCList.java | IndexMultiDCList.deleteElement | int deleteElement(int list, int node) {
"""
Deletes a node from a list. Returns the next node after the deleted one.
"""
int prev = getPrev(node);
int next = getNext(node);
if (prev != nullNode())
setNext_(prev, next);
else
m_lists.setField(list, 0, next);// change head
if (next != nullNode())
setPrev_(next, prev);
else
m_lists.setField(list, 1, prev);// change tail
freeNode_(node);
setListSize_(list, getListSize(list) - 1);
return next;
} | java | int deleteElement(int list, int node) {
int prev = getPrev(node);
int next = getNext(node);
if (prev != nullNode())
setNext_(prev, next);
else
m_lists.setField(list, 0, next);// change head
if (next != nullNode())
setPrev_(next, prev);
else
m_lists.setField(list, 1, prev);// change tail
freeNode_(node);
setListSize_(list, getListSize(list) - 1);
return next;
} | [
"int",
"deleteElement",
"(",
"int",
"list",
",",
"int",
"node",
")",
"{",
"int",
"prev",
"=",
"getPrev",
"(",
"node",
")",
";",
"int",
"next",
"=",
"getNext",
"(",
"node",
")",
";",
"if",
"(",
"prev",
"!=",
"nullNode",
"(",
")",
")",
"setNext_",
"(",
"prev",
",",
"next",
")",
";",
"else",
"m_lists",
".",
"setField",
"(",
"list",
",",
"0",
",",
"next",
")",
";",
"// change head",
"if",
"(",
"next",
"!=",
"nullNode",
"(",
")",
")",
"setPrev_",
"(",
"next",
",",
"prev",
")",
";",
"else",
"m_lists",
".",
"setField",
"(",
"list",
",",
"1",
",",
"prev",
")",
";",
"// change tail",
"freeNode_",
"(",
"node",
")",
";",
"setListSize_",
"(",
"list",
",",
"getListSize",
"(",
"list",
")",
"-",
"1",
")",
";",
"return",
"next",
";",
"}"
] | Deletes a node from a list. Returns the next node after the deleted one. | [
"Deletes",
"a",
"node",
"from",
"a",
"list",
".",
"Returns",
"the",
"next",
"node",
"after",
"the",
"deleted",
"one",
"."
] | train | https://github.com/Esri/geometry-api-java/blob/494da8ec953d76e7c6072afbc081abfe48ff07cf/src/main/java/com/esri/core/geometry/IndexMultiDCList.java#L199-L214 |
pip-services3-java/pip-services3-commons-java | src/org/pipservices3/commons/refer/DependencyResolver.java | DependencyResolver.getOneRequired | public Object getOneRequired(String name) throws ReferenceException {
"""
Gets one required dependency by its name. At least one dependency must
present. If the dependency was found it throws a ReferenceException
@param name the dependency name to locate.
@return a dependency reference
@throws ReferenceException if dependency was not found.
"""
Object locator = find(name);
if (locator == null)
throw new ReferenceException(null, name);
return _references.getOneRequired(locator);
} | java | public Object getOneRequired(String name) throws ReferenceException {
Object locator = find(name);
if (locator == null)
throw new ReferenceException(null, name);
return _references.getOneRequired(locator);
} | [
"public",
"Object",
"getOneRequired",
"(",
"String",
"name",
")",
"throws",
"ReferenceException",
"{",
"Object",
"locator",
"=",
"find",
"(",
"name",
")",
";",
"if",
"(",
"locator",
"==",
"null",
")",
"throw",
"new",
"ReferenceException",
"(",
"null",
",",
"name",
")",
";",
"return",
"_references",
".",
"getOneRequired",
"(",
"locator",
")",
";",
"}"
] | Gets one required dependency by its name. At least one dependency must
present. If the dependency was found it throws a ReferenceException
@param name the dependency name to locate.
@return a dependency reference
@throws ReferenceException if dependency was not found. | [
"Gets",
"one",
"required",
"dependency",
"by",
"its",
"name",
".",
"At",
"least",
"one",
"dependency",
"must",
"present",
".",
"If",
"the",
"dependency",
"was",
"found",
"it",
"throws",
"a",
"ReferenceException"
] | train | https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/refer/DependencyResolver.java#L253-L259 |
mikepenz/Materialize | library/src/main/java/com/mikepenz/materialize/util/UIUtils.java | UIUtils.setBackground | public static void setBackground(View v, @DrawableRes int drawableRes) {
"""
helper method to set the background depending on the android version
@param v
@param drawableRes
"""
ViewCompat.setBackground(v, ContextCompat.getDrawable(v.getContext(), drawableRes));
} | java | public static void setBackground(View v, @DrawableRes int drawableRes) {
ViewCompat.setBackground(v, ContextCompat.getDrawable(v.getContext(), drawableRes));
} | [
"public",
"static",
"void",
"setBackground",
"(",
"View",
"v",
",",
"@",
"DrawableRes",
"int",
"drawableRes",
")",
"{",
"ViewCompat",
".",
"setBackground",
"(",
"v",
",",
"ContextCompat",
".",
"getDrawable",
"(",
"v",
".",
"getContext",
"(",
")",
",",
"drawableRes",
")",
")",
";",
"}"
] | helper method to set the background depending on the android version
@param v
@param drawableRes | [
"helper",
"method",
"to",
"set",
"the",
"background",
"depending",
"on",
"the",
"android",
"version"
] | train | https://github.com/mikepenz/Materialize/blob/2612c10c7570191a78d57f23620e945d61370e3d/library/src/main/java/com/mikepenz/materialize/util/UIUtils.java#L81-L83 |
burberius/eve-esi | src/main/java/net/troja/eve/esi/api/UserInterfaceApi.java | UserInterfaceApi.postUiOpenwindowNewmail | public void postUiOpenwindowNewmail(String datasource, String token, UiNewMail uiNewMail) throws ApiException {
"""
Open New Mail Window Open the New Mail window, according to settings from
the request if applicable --- SSO Scope: esi-ui.open_window.v1
@param datasource
The server name you would like data from (optional, default to
tranquility)
@param token
Access token to use if unable to set a header (optional)
@param uiNewMail
(optional)
@throws ApiException
If fail to call the API, e.g. server error or cannot
deserialize the response body
"""
postUiOpenwindowNewmailWithHttpInfo(datasource, token, uiNewMail);
} | java | public void postUiOpenwindowNewmail(String datasource, String token, UiNewMail uiNewMail) throws ApiException {
postUiOpenwindowNewmailWithHttpInfo(datasource, token, uiNewMail);
} | [
"public",
"void",
"postUiOpenwindowNewmail",
"(",
"String",
"datasource",
",",
"String",
"token",
",",
"UiNewMail",
"uiNewMail",
")",
"throws",
"ApiException",
"{",
"postUiOpenwindowNewmailWithHttpInfo",
"(",
"datasource",
",",
"token",
",",
"uiNewMail",
")",
";",
"}"
] | Open New Mail Window Open the New Mail window, according to settings from
the request if applicable --- SSO Scope: esi-ui.open_window.v1
@param datasource
The server name you would like data from (optional, default to
tranquility)
@param token
Access token to use if unable to set a header (optional)
@param uiNewMail
(optional)
@throws ApiException
If fail to call the API, e.g. server error or cannot
deserialize the response body | [
"Open",
"New",
"Mail",
"Window",
"Open",
"the",
"New",
"Mail",
"window",
"according",
"to",
"settings",
"from",
"the",
"request",
"if",
"applicable",
"---",
"SSO",
"Scope",
":",
"esi",
"-",
"ui",
".",
"open_window",
".",
"v1"
] | train | https://github.com/burberius/eve-esi/blob/24a941c592cfc15f23471ef849b282fbc582ca13/src/main/java/net/troja/eve/esi/api/UserInterfaceApi.java#L749-L751 |
craftercms/deployer | src/main/java/org/craftercms/deployer/utils/ConfigUtils.java | ConfigUtils.getIntegerProperty | public static Integer getIntegerProperty(Configuration config, String key,
Integer defaultValue) throws DeployerConfigurationException {
"""
Returns the specified Integer property from the configuration
@param config the configuration
@param key the key of the property
@param defaultValue the default value if the property is not found
@return the Integer value of the property, or the default value if not found
@throws DeployerConfigurationException if an error occurred
"""
try {
return config.getInteger(key, defaultValue);
} catch (Exception e) {
throw new DeployerConfigurationException("Failed to retrieve property '" + key + "'", e);
}
} | java | public static Integer getIntegerProperty(Configuration config, String key,
Integer defaultValue) throws DeployerConfigurationException {
try {
return config.getInteger(key, defaultValue);
} catch (Exception e) {
throw new DeployerConfigurationException("Failed to retrieve property '" + key + "'", e);
}
} | [
"public",
"static",
"Integer",
"getIntegerProperty",
"(",
"Configuration",
"config",
",",
"String",
"key",
",",
"Integer",
"defaultValue",
")",
"throws",
"DeployerConfigurationException",
"{",
"try",
"{",
"return",
"config",
".",
"getInteger",
"(",
"key",
",",
"defaultValue",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"DeployerConfigurationException",
"(",
"\"Failed to retrieve property '\"",
"+",
"key",
"+",
"\"'\"",
",",
"e",
")",
";",
"}",
"}"
] | Returns the specified Integer property from the configuration
@param config the configuration
@param key the key of the property
@param defaultValue the default value if the property is not found
@return the Integer value of the property, or the default value if not found
@throws DeployerConfigurationException if an error occurred | [
"Returns",
"the",
"specified",
"Integer",
"property",
"from",
"the",
"configuration"
] | train | https://github.com/craftercms/deployer/blob/3ed446e3cc8af1055de2de6f871907f90ef27f63/src/main/java/org/craftercms/deployer/utils/ConfigUtils.java#L183-L190 |
apache/incubator-gobblin | gobblin-utility/src/main/java/org/apache/gobblin/util/PathUtils.java | PathUtils.deleteEmptyParentDirectories | public static void deleteEmptyParentDirectories(FileSystem fs, Path limitPath, Path startPath)
throws IOException {
"""
Deletes empty directories starting with startPath and all ancestors up to but not including limitPath.
@param fs {@link FileSystem} where paths are located.
@param limitPath only {@link Path}s that are strict descendants of this path will be deleted.
@param startPath first {@link Path} to delete. Afterwards empty ancestors will be deleted.
@throws IOException
"""
if (PathUtils.isAncestor(limitPath, startPath) && !PathUtils.getPathWithoutSchemeAndAuthority(limitPath)
.equals(PathUtils.getPathWithoutSchemeAndAuthority(startPath)) && fs.listStatus(startPath).length == 0) {
if (!fs.delete(startPath, false)) {
log.warn("Failed to delete empty directory " + startPath);
} else {
log.info("Deleted empty directory " + startPath);
}
deleteEmptyParentDirectories(fs, limitPath, startPath.getParent());
}
} | java | public static void deleteEmptyParentDirectories(FileSystem fs, Path limitPath, Path startPath)
throws IOException {
if (PathUtils.isAncestor(limitPath, startPath) && !PathUtils.getPathWithoutSchemeAndAuthority(limitPath)
.equals(PathUtils.getPathWithoutSchemeAndAuthority(startPath)) && fs.listStatus(startPath).length == 0) {
if (!fs.delete(startPath, false)) {
log.warn("Failed to delete empty directory " + startPath);
} else {
log.info("Deleted empty directory " + startPath);
}
deleteEmptyParentDirectories(fs, limitPath, startPath.getParent());
}
} | [
"public",
"static",
"void",
"deleteEmptyParentDirectories",
"(",
"FileSystem",
"fs",
",",
"Path",
"limitPath",
",",
"Path",
"startPath",
")",
"throws",
"IOException",
"{",
"if",
"(",
"PathUtils",
".",
"isAncestor",
"(",
"limitPath",
",",
"startPath",
")",
"&&",
"!",
"PathUtils",
".",
"getPathWithoutSchemeAndAuthority",
"(",
"limitPath",
")",
".",
"equals",
"(",
"PathUtils",
".",
"getPathWithoutSchemeAndAuthority",
"(",
"startPath",
")",
")",
"&&",
"fs",
".",
"listStatus",
"(",
"startPath",
")",
".",
"length",
"==",
"0",
")",
"{",
"if",
"(",
"!",
"fs",
".",
"delete",
"(",
"startPath",
",",
"false",
")",
")",
"{",
"log",
".",
"warn",
"(",
"\"Failed to delete empty directory \"",
"+",
"startPath",
")",
";",
"}",
"else",
"{",
"log",
".",
"info",
"(",
"\"Deleted empty directory \"",
"+",
"startPath",
")",
";",
"}",
"deleteEmptyParentDirectories",
"(",
"fs",
",",
"limitPath",
",",
"startPath",
".",
"getParent",
"(",
")",
")",
";",
"}",
"}"
] | Deletes empty directories starting with startPath and all ancestors up to but not including limitPath.
@param fs {@link FileSystem} where paths are located.
@param limitPath only {@link Path}s that are strict descendants of this path will be deleted.
@param startPath first {@link Path} to delete. Afterwards empty ancestors will be deleted.
@throws IOException | [
"Deletes",
"empty",
"directories",
"starting",
"with",
"startPath",
"and",
"all",
"ancestors",
"up",
"to",
"but",
"not",
"including",
"limitPath",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/PathUtils.java#L189-L200 |
joniles/mpxj | src/main/java/net/sf/mpxj/mpx/Record.java | Record.getFloat | public Number getFloat(int field) throws MPXJException {
"""
Accessor method used to retrieve a Float object representing the
contents of an individual field. If the field does not exist in the
record, null is returned.
@param field the index number of the field to be retrieved
@return the value of the required field
"""
try
{
Number result;
if ((field < m_fields.length) && (m_fields[field].length() != 0))
{
result = m_formats.getDecimalFormat().parse(m_fields[field]);
}
else
{
result = null;
}
return (result);
}
catch (ParseException ex)
{
throw new MPXJException("Failed to parse float", ex);
}
} | java | public Number getFloat(int field) throws MPXJException
{
try
{
Number result;
if ((field < m_fields.length) && (m_fields[field].length() != 0))
{
result = m_formats.getDecimalFormat().parse(m_fields[field]);
}
else
{
result = null;
}
return (result);
}
catch (ParseException ex)
{
throw new MPXJException("Failed to parse float", ex);
}
} | [
"public",
"Number",
"getFloat",
"(",
"int",
"field",
")",
"throws",
"MPXJException",
"{",
"try",
"{",
"Number",
"result",
";",
"if",
"(",
"(",
"field",
"<",
"m_fields",
".",
"length",
")",
"&&",
"(",
"m_fields",
"[",
"field",
"]",
".",
"length",
"(",
")",
"!=",
"0",
")",
")",
"{",
"result",
"=",
"m_formats",
".",
"getDecimalFormat",
"(",
")",
".",
"parse",
"(",
"m_fields",
"[",
"field",
"]",
")",
";",
"}",
"else",
"{",
"result",
"=",
"null",
";",
"}",
"return",
"(",
"result",
")",
";",
"}",
"catch",
"(",
"ParseException",
"ex",
")",
"{",
"throw",
"new",
"MPXJException",
"(",
"\"Failed to parse float\"",
",",
"ex",
")",
";",
"}",
"}"
] | Accessor method used to retrieve a Float object representing the
contents of an individual field. If the field does not exist in the
record, null is returned.
@param field the index number of the field to be retrieved
@return the value of the required field | [
"Accessor",
"method",
"used",
"to",
"retrieve",
"a",
"Float",
"object",
"representing",
"the",
"contents",
"of",
"an",
"individual",
"field",
".",
"If",
"the",
"field",
"does",
"not",
"exist",
"in",
"the",
"record",
"null",
"is",
"returned",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/Record.java#L181-L203 |
openengsb/openengsb | components/ekb/persistence-persist-edb/src/main/java/org/openengsb/core/ekb/persistence/persist/edb/internal/EngineeringObjectEnhancer.java | EngineeringObjectEnhancer.performMerge | private AdvancedModelWrapper performMerge(AdvancedModelWrapper source, AdvancedModelWrapper target) {
"""
Performs the merge from the source model to the target model and returns the result. Returns null if either the
source or the target is null.
"""
if (source == null || target == null) {
return null;
}
ModelDescription sourceDesc = source.getModelDescription();
ModelDescription targetDesc = target.getModelDescription();
Object transformResult = transformationEngine.performTransformation(sourceDesc, targetDesc,
source.getUnderlyingModel(), target.getUnderlyingModel());
AdvancedModelWrapper wrapper = AdvancedModelWrapper.wrap(transformResult);
wrapper.removeOpenEngSBModelEntry(EDBConstants.MODEL_VERSION);
return wrapper;
} | java | private AdvancedModelWrapper performMerge(AdvancedModelWrapper source, AdvancedModelWrapper target) {
if (source == null || target == null) {
return null;
}
ModelDescription sourceDesc = source.getModelDescription();
ModelDescription targetDesc = target.getModelDescription();
Object transformResult = transformationEngine.performTransformation(sourceDesc, targetDesc,
source.getUnderlyingModel(), target.getUnderlyingModel());
AdvancedModelWrapper wrapper = AdvancedModelWrapper.wrap(transformResult);
wrapper.removeOpenEngSBModelEntry(EDBConstants.MODEL_VERSION);
return wrapper;
} | [
"private",
"AdvancedModelWrapper",
"performMerge",
"(",
"AdvancedModelWrapper",
"source",
",",
"AdvancedModelWrapper",
"target",
")",
"{",
"if",
"(",
"source",
"==",
"null",
"||",
"target",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"ModelDescription",
"sourceDesc",
"=",
"source",
".",
"getModelDescription",
"(",
")",
";",
"ModelDescription",
"targetDesc",
"=",
"target",
".",
"getModelDescription",
"(",
")",
";",
"Object",
"transformResult",
"=",
"transformationEngine",
".",
"performTransformation",
"(",
"sourceDesc",
",",
"targetDesc",
",",
"source",
".",
"getUnderlyingModel",
"(",
")",
",",
"target",
".",
"getUnderlyingModel",
"(",
")",
")",
";",
"AdvancedModelWrapper",
"wrapper",
"=",
"AdvancedModelWrapper",
".",
"wrap",
"(",
"transformResult",
")",
";",
"wrapper",
".",
"removeOpenEngSBModelEntry",
"(",
"EDBConstants",
".",
"MODEL_VERSION",
")",
";",
"return",
"wrapper",
";",
"}"
] | Performs the merge from the source model to the target model and returns the result. Returns null if either the
source or the target is null. | [
"Performs",
"the",
"merge",
"from",
"the",
"source",
"model",
"to",
"the",
"target",
"model",
"and",
"returns",
"the",
"result",
".",
"Returns",
"null",
"if",
"either",
"the",
"source",
"or",
"the",
"target",
"is",
"null",
"."
] | train | https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/components/ekb/persistence-persist-edb/src/main/java/org/openengsb/core/ekb/persistence/persist/edb/internal/EngineeringObjectEnhancer.java#L272-L283 |
apereo/cas | core/cas-server-core-web-api/src/main/java/org/apereo/cas/web/support/WebUtils.java | WebUtils.putAuthentication | public static void putAuthentication(final Authentication authentication, final RequestContext ctx) {
"""
Put authentication into conversation scope.
@param authentication the authentication
@param ctx the ctx
"""
ctx.getConversationScope().put(PARAMETER_AUTHENTICATION, authentication);
} | java | public static void putAuthentication(final Authentication authentication, final RequestContext ctx) {
ctx.getConversationScope().put(PARAMETER_AUTHENTICATION, authentication);
} | [
"public",
"static",
"void",
"putAuthentication",
"(",
"final",
"Authentication",
"authentication",
",",
"final",
"RequestContext",
"ctx",
")",
"{",
"ctx",
".",
"getConversationScope",
"(",
")",
".",
"put",
"(",
"PARAMETER_AUTHENTICATION",
",",
"authentication",
")",
";",
"}"
] | Put authentication into conversation scope.
@param authentication the authentication
@param ctx the ctx | [
"Put",
"authentication",
"into",
"conversation",
"scope",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-web-api/src/main/java/org/apereo/cas/web/support/WebUtils.java#L466-L468 |
google/closure-templates | java/src/com/google/template/soy/jbcsrc/restricted/AnnotationRef.java | AnnotationRef.simpleArrayFieldWriter | private static FieldWriter simpleArrayFieldWriter(final String name) {
"""
Writes an simple array valued field to the annotation visitor.
"""
return new FieldWriter() {
@Override
public void write(AnnotationVisitor visitor, Object value) {
int len = Array.getLength(value);
AnnotationVisitor arrayVisitor = visitor.visitArray(name);
for (int i = 0; i < len; i++) {
arrayVisitor.visit(null, Array.get(value, i));
}
arrayVisitor.visitEnd();
}
};
} | java | private static FieldWriter simpleArrayFieldWriter(final String name) {
return new FieldWriter() {
@Override
public void write(AnnotationVisitor visitor, Object value) {
int len = Array.getLength(value);
AnnotationVisitor arrayVisitor = visitor.visitArray(name);
for (int i = 0; i < len; i++) {
arrayVisitor.visit(null, Array.get(value, i));
}
arrayVisitor.visitEnd();
}
};
} | [
"private",
"static",
"FieldWriter",
"simpleArrayFieldWriter",
"(",
"final",
"String",
"name",
")",
"{",
"return",
"new",
"FieldWriter",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"write",
"(",
"AnnotationVisitor",
"visitor",
",",
"Object",
"value",
")",
"{",
"int",
"len",
"=",
"Array",
".",
"getLength",
"(",
"value",
")",
";",
"AnnotationVisitor",
"arrayVisitor",
"=",
"visitor",
".",
"visitArray",
"(",
"name",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"len",
";",
"i",
"++",
")",
"{",
"arrayVisitor",
".",
"visit",
"(",
"null",
",",
"Array",
".",
"get",
"(",
"value",
",",
"i",
")",
")",
";",
"}",
"arrayVisitor",
".",
"visitEnd",
"(",
")",
";",
"}",
"}",
";",
"}"
] | Writes an simple array valued field to the annotation visitor. | [
"Writes",
"an",
"simple",
"array",
"valued",
"field",
"to",
"the",
"annotation",
"visitor",
"."
] | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/restricted/AnnotationRef.java#L155-L167 |
ineunetOS/knife-commons | knife-commons-utils/src/main/java/com/ineunet/knife/util/DateUtils.java | DateUtils.getPeriodDays | public static int getPeriodDays(Date start, Date end) {
"""
计算两个日期之间相差的天数
@param start 较小的时间
@param end 较大的时间
@return 相差天数
@since 2.0.2
"""
try {
start = FORMAT_DATE_.parse(FORMAT_DATE_.format(start));
end = FORMAT_DATE_.parse(FORMAT_DATE_.format(end));
Calendar cal = Calendar.getInstance();
cal.setTime(start);
long time1 = cal.getTimeInMillis();
cal.setTime(end);
long time2 = cal.getTimeInMillis();
long between_days = (time2 - time1) / (1000 * 3600 * 24);
return Integer.parseInt(String.valueOf(between_days));
} catch (Exception e) {
throw new KnifeUtilsException(e);
}
} | java | public static int getPeriodDays(Date start, Date end) {
try {
start = FORMAT_DATE_.parse(FORMAT_DATE_.format(start));
end = FORMAT_DATE_.parse(FORMAT_DATE_.format(end));
Calendar cal = Calendar.getInstance();
cal.setTime(start);
long time1 = cal.getTimeInMillis();
cal.setTime(end);
long time2 = cal.getTimeInMillis();
long between_days = (time2 - time1) / (1000 * 3600 * 24);
return Integer.parseInt(String.valueOf(between_days));
} catch (Exception e) {
throw new KnifeUtilsException(e);
}
} | [
"public",
"static",
"int",
"getPeriodDays",
"(",
"Date",
"start",
",",
"Date",
"end",
")",
"{",
"try",
"{",
"start",
"=",
"FORMAT_DATE_",
".",
"parse",
"(",
"FORMAT_DATE_",
".",
"format",
"(",
"start",
")",
")",
";",
"end",
"=",
"FORMAT_DATE_",
".",
"parse",
"(",
"FORMAT_DATE_",
".",
"format",
"(",
"end",
")",
")",
";",
"Calendar",
"cal",
"=",
"Calendar",
".",
"getInstance",
"(",
")",
";",
"cal",
".",
"setTime",
"(",
"start",
")",
";",
"long",
"time1",
"=",
"cal",
".",
"getTimeInMillis",
"(",
")",
";",
"cal",
".",
"setTime",
"(",
"end",
")",
";",
"long",
"time2",
"=",
"cal",
".",
"getTimeInMillis",
"(",
")",
";",
"long",
"between_days",
"=",
"(",
"time2",
"-",
"time1",
")",
"/",
"(",
"1000",
"*",
"3600",
"*",
"24",
")",
";",
"return",
"Integer",
".",
"parseInt",
"(",
"String",
".",
"valueOf",
"(",
"between_days",
")",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"KnifeUtilsException",
"(",
"e",
")",
";",
"}",
"}"
] | 计算两个日期之间相差的天数
@param start 较小的时间
@param end 较大的时间
@return 相差天数
@since 2.0.2 | [
"计算两个日期之间相差的天数"
] | train | https://github.com/ineunetOS/knife-commons/blob/eae9e59afa020a00ae8977c10d43ac8ae46ae236/knife-commons-utils/src/main/java/com/ineunet/knife/util/DateUtils.java#L244-L258 |
asciidoctor/asciidoctorj | asciidoctorj-core/src/main/java/org/asciidoctor/jruby/extension/internal/JRubyProcessor.java | JRubyProcessor.parseContent | @Override
public void parseContent(StructuralNode parent, List<String> lines) {
"""
Parses the given raw asciidoctor content, parses it and appends it as children to the given parent block.
<p>The following example will add two paragraphs with the role {@code newcontent} to all top
level sections of a document:
<pre>
<verbatim>
Asciidoctor asciidoctor = ...
asciidoctor.javaExtensionRegistry().treeprocessor(new Treeprocessor() {
DocumentRuby process(DocumentRuby document) {
for (AbstractBlock block: document.getBlocks()) {
if (block instanceof Section) {
parseContent(block, Arrays.asList(new String[]{
"[newcontent]",
"This is new content"
"",
"[newcontent]",
"This is also new content"}));
}
}
}
});
</verbatim>
</pre>
@param parent The block to which the parsed content should be added as children.
@param lines Raw asciidoctor content
"""
Ruby runtime = JRubyRuntimeContext.get(parent);
Parser parser = new Parser(runtime, parent, ReaderImpl.createReader(runtime, lines));
StructuralNode nextBlock = parser.nextBlock();
while (nextBlock != null) {
parent.append(nextBlock);
nextBlock = parser.nextBlock();
}
} | java | @Override
public void parseContent(StructuralNode parent, List<String> lines) {
Ruby runtime = JRubyRuntimeContext.get(parent);
Parser parser = new Parser(runtime, parent, ReaderImpl.createReader(runtime, lines));
StructuralNode nextBlock = parser.nextBlock();
while (nextBlock != null) {
parent.append(nextBlock);
nextBlock = parser.nextBlock();
}
} | [
"@",
"Override",
"public",
"void",
"parseContent",
"(",
"StructuralNode",
"parent",
",",
"List",
"<",
"String",
">",
"lines",
")",
"{",
"Ruby",
"runtime",
"=",
"JRubyRuntimeContext",
".",
"get",
"(",
"parent",
")",
";",
"Parser",
"parser",
"=",
"new",
"Parser",
"(",
"runtime",
",",
"parent",
",",
"ReaderImpl",
".",
"createReader",
"(",
"runtime",
",",
"lines",
")",
")",
";",
"StructuralNode",
"nextBlock",
"=",
"parser",
".",
"nextBlock",
"(",
")",
";",
"while",
"(",
"nextBlock",
"!=",
"null",
")",
"{",
"parent",
".",
"append",
"(",
"nextBlock",
")",
";",
"nextBlock",
"=",
"parser",
".",
"nextBlock",
"(",
")",
";",
"}",
"}"
] | Parses the given raw asciidoctor content, parses it and appends it as children to the given parent block.
<p>The following example will add two paragraphs with the role {@code newcontent} to all top
level sections of a document:
<pre>
<verbatim>
Asciidoctor asciidoctor = ...
asciidoctor.javaExtensionRegistry().treeprocessor(new Treeprocessor() {
DocumentRuby process(DocumentRuby document) {
for (AbstractBlock block: document.getBlocks()) {
if (block instanceof Section) {
parseContent(block, Arrays.asList(new String[]{
"[newcontent]",
"This is new content"
"",
"[newcontent]",
"This is also new content"}));
}
}
}
});
</verbatim>
</pre>
@param parent The block to which the parsed content should be added as children.
@param lines Raw asciidoctor content | [
"Parses",
"the",
"given",
"raw",
"asciidoctor",
"content",
"parses",
"it",
"and",
"appends",
"it",
"as",
"children",
"to",
"the",
"given",
"parent",
"block",
".",
"<p",
">",
"The",
"following",
"example",
"will",
"add",
"two",
"paragraphs",
"with",
"the",
"role",
"{",
"@code",
"newcontent",
"}",
"to",
"all",
"top",
"level",
"sections",
"of",
"a",
"document",
":",
"<pre",
">",
"<verbatim",
">",
"Asciidoctor",
"asciidoctor",
"=",
"...",
"asciidoctor",
".",
"javaExtensionRegistry",
"()",
".",
"treeprocessor",
"(",
"new",
"Treeprocessor",
"()",
"{",
"DocumentRuby",
"process",
"(",
"DocumentRuby",
"document",
")",
"{",
"for",
"(",
"AbstractBlock",
"block",
":",
"document",
".",
"getBlocks",
"()",
")",
"{",
"if",
"(",
"block",
"instanceof",
"Section",
")",
"{",
"parseContent",
"(",
"block",
"Arrays",
".",
"asList",
"(",
"new",
"String",
"[]",
"{",
"[",
"newcontent",
"]",
"This",
"is",
"new",
"content",
"[",
"newcontent",
"]",
"This",
"is",
"also",
"new",
"content",
"}",
"))",
";",
"}",
"}",
"}",
"}",
")",
";",
"<",
"/",
"verbatim",
">",
"<",
"/",
"pre",
">"
] | train | https://github.com/asciidoctor/asciidoctorj/blob/e348c9a12b54c33fea7b05d70224c007e2ee75a9/asciidoctorj-core/src/main/java/org/asciidoctor/jruby/extension/internal/JRubyProcessor.java#L335-L345 |
codelibs/fess | src/main/java/org/codelibs/fess/mylasta/action/FessMessages.java | FessMessages.addErrorsInvalidStrIsIncluded | public FessMessages addErrorsInvalidStrIsIncluded(String property, String arg0, String arg1) {
"""
Add the created action message for the key 'errors.invalid_str_is_included' with parameters.
<pre>
message: "{1}" in "{0}" is invalid.
</pre>
@param property The property name for the message. (NotNull)
@param arg0 The parameter arg0 for message. (NotNull)
@param arg1 The parameter arg1 for message. (NotNull)
@return this. (NotNull)
"""
assertPropertyNotNull(property);
add(property, new UserMessage(ERRORS_invalid_str_is_included, arg0, arg1));
return this;
} | java | public FessMessages addErrorsInvalidStrIsIncluded(String property, String arg0, String arg1) {
assertPropertyNotNull(property);
add(property, new UserMessage(ERRORS_invalid_str_is_included, arg0, arg1));
return this;
} | [
"public",
"FessMessages",
"addErrorsInvalidStrIsIncluded",
"(",
"String",
"property",
",",
"String",
"arg0",
",",
"String",
"arg1",
")",
"{",
"assertPropertyNotNull",
"(",
"property",
")",
";",
"add",
"(",
"property",
",",
"new",
"UserMessage",
"(",
"ERRORS_invalid_str_is_included",
",",
"arg0",
",",
"arg1",
")",
")",
";",
"return",
"this",
";",
"}"
] | Add the created action message for the key 'errors.invalid_str_is_included' with parameters.
<pre>
message: "{1}" in "{0}" is invalid.
</pre>
@param property The property name for the message. (NotNull)
@param arg0 The parameter arg0 for message. (NotNull)
@param arg1 The parameter arg1 for message. (NotNull)
@return this. (NotNull) | [
"Add",
"the",
"created",
"action",
"message",
"for",
"the",
"key",
"errors",
".",
"invalid_str_is_included",
"with",
"parameters",
".",
"<pre",
">",
"message",
":",
"{",
"1",
"}",
"in",
"{",
"0",
"}",
"is",
"invalid",
".",
"<",
"/",
"pre",
">"
] | train | https://github.com/codelibs/fess/blob/e5e4b722549d32a4958dfd94965b21937bfe64cf/src/main/java/org/codelibs/fess/mylasta/action/FessMessages.java#L1777-L1781 |
soi-toolkit/soi-toolkit-mule | commons/components/commons-mule/src/main/java/org/soitoolkit/commons/mule/util/MuleUtil.java | MuleUtil.getImmutableEndpoint | public static ImmutableEndpoint getImmutableEndpoint(MuleContext muleContext, String endpointName) throws IOException {
"""
Lookup an ImmutableEndpoint based on its name
@param muleContext
@param endpointName
@return
@throws IOException
"""
ImmutableEndpoint endpoint = null;
Object o = muleContext.getRegistry().lookupObject(endpointName);
if (o instanceof ImmutableEndpoint) {
// For Inbound and Outbound Endpoints
endpoint = (ImmutableEndpoint) o;
} else if (o instanceof EndpointBuilder) {
// For Endpoint-references
EndpointBuilder eb = (EndpointBuilder) o;
try {
endpoint = eb.buildInboundEndpoint();
} catch (Exception e) {
throw new IOException(e.getMessage());
}
}
return endpoint;
} | java | public static ImmutableEndpoint getImmutableEndpoint(MuleContext muleContext, String endpointName) throws IOException {
ImmutableEndpoint endpoint = null;
Object o = muleContext.getRegistry().lookupObject(endpointName);
if (o instanceof ImmutableEndpoint) {
// For Inbound and Outbound Endpoints
endpoint = (ImmutableEndpoint) o;
} else if (o instanceof EndpointBuilder) {
// For Endpoint-references
EndpointBuilder eb = (EndpointBuilder) o;
try {
endpoint = eb.buildInboundEndpoint();
} catch (Exception e) {
throw new IOException(e.getMessage());
}
}
return endpoint;
} | [
"public",
"static",
"ImmutableEndpoint",
"getImmutableEndpoint",
"(",
"MuleContext",
"muleContext",
",",
"String",
"endpointName",
")",
"throws",
"IOException",
"{",
"ImmutableEndpoint",
"endpoint",
"=",
"null",
";",
"Object",
"o",
"=",
"muleContext",
".",
"getRegistry",
"(",
")",
".",
"lookupObject",
"(",
"endpointName",
")",
";",
"if",
"(",
"o",
"instanceof",
"ImmutableEndpoint",
")",
"{",
"// For Inbound and Outbound Endpoints",
"endpoint",
"=",
"(",
"ImmutableEndpoint",
")",
"o",
";",
"}",
"else",
"if",
"(",
"o",
"instanceof",
"EndpointBuilder",
")",
"{",
"// For Endpoint-references",
"EndpointBuilder",
"eb",
"=",
"(",
"EndpointBuilder",
")",
"o",
";",
"try",
"{",
"endpoint",
"=",
"eb",
".",
"buildInboundEndpoint",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"IOException",
"(",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"}",
"return",
"endpoint",
";",
"}"
] | Lookup an ImmutableEndpoint based on its name
@param muleContext
@param endpointName
@return
@throws IOException | [
"Lookup",
"an",
"ImmutableEndpoint",
"based",
"on",
"its",
"name"
] | train | https://github.com/soi-toolkit/soi-toolkit-mule/blob/e891350dbf55e6307be94d193d056bdb785b37d3/commons/components/commons-mule/src/main/java/org/soitoolkit/commons/mule/util/MuleUtil.java#L100-L118 |
Azure/azure-sdk-for-java | mediaservices/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/implementation/AccountFiltersInner.java | AccountFiltersInner.createOrUpdate | public AccountFilterInner createOrUpdate(String resourceGroupName, String accountName, String filterName, AccountFilterInner parameters) {
"""
Create or update an Account Filter.
Creates or updates an Account Filter in the Media Services account.
@param resourceGroupName The name of the resource group within the Azure subscription.
@param accountName The Media Services account name.
@param filterName The Account Filter name
@param parameters The request parameters
@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 AccountFilterInner object if successful.
"""
return createOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, filterName, parameters).toBlocking().single().body();
} | java | public AccountFilterInner createOrUpdate(String resourceGroupName, String accountName, String filterName, AccountFilterInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, filterName, parameters).toBlocking().single().body();
} | [
"public",
"AccountFilterInner",
"createOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
",",
"String",
"filterName",
",",
"AccountFilterInner",
"parameters",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"accountName",
",",
"filterName",
",",
"parameters",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
] | Create or update an Account Filter.
Creates or updates an Account Filter in the Media Services account.
@param resourceGroupName The name of the resource group within the Azure subscription.
@param accountName The Media Services account name.
@param filterName The Account Filter name
@param parameters The request parameters
@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 AccountFilterInner object if successful. | [
"Create",
"or",
"update",
"an",
"Account",
"Filter",
".",
"Creates",
"or",
"updates",
"an",
"Account",
"Filter",
"in",
"the",
"Media",
"Services",
"account",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mediaservices/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/implementation/AccountFiltersInner.java#L330-L332 |
ModeShape/modeshape | modeshape-jcr/src/main/java/org/modeshape/jcr/JcrSystemViewExporter.java | JcrSystemViewExporter.emitProperty | private void emitProperty( Property property,
ContentHandler contentHandler,
boolean skipBinary ) throws RepositoryException, SAXException {
"""
Fires the appropriate SAX events on the content handler to build the XML elements for the property.
@param property the property to be exported
@param contentHandler the SAX content handler for which SAX events will be invoked as the XML document is created.
@param skipBinary if <code>true</code>, indicates that binary properties should not be exported
@throws SAXException if an exception occurs during generation of the XML document
@throws RepositoryException if an exception occurs accessing the content repository
"""
assert property instanceof AbstractJcrProperty : "Illegal attempt to use " + getClass().getName()
+ " on non-ModeShape property";
AbstractJcrProperty prop = (AbstractJcrProperty)property;
// first set the property sv:name attribute
AttributesImpl propAtts = new AttributesImpl();
propAtts.addAttribute(JcrSvLexicon.NAME.getNamespaceUri(),
JcrSvLexicon.NAME.getLocalName(),
getPrefixedName(JcrSvLexicon.NAME),
PropertyType.nameFromValue(PropertyType.STRING),
prop.getName());
// and it's sv:type attribute
propAtts.addAttribute(JcrSvLexicon.TYPE.getNamespaceUri(),
JcrSvLexicon.TYPE.getLocalName(),
getPrefixedName(JcrSvLexicon.TYPE),
PropertyType.nameFromValue(PropertyType.STRING),
org.modeshape.jcr.api.PropertyType.nameFromValue(prop.getType()));
// and it's sv:multiple attribute
if (prop.isMultiple()) {
propAtts.addAttribute(JcrSvLexicon.TYPE.getNamespaceUri(),
JcrSvLexicon.TYPE.getLocalName(),
getPrefixedName(JcrSvLexicon.MULTIPLE),
PropertyType.nameFromValue(PropertyType.BOOLEAN),
Boolean.TRUE.toString());
}
// output the sv:property element
startElement(contentHandler, JcrSvLexicon.PROPERTY, propAtts);
// then output a sv:value element for each of its values
if (prop instanceof JcrMultiValueProperty) {
Value[] values = prop.getValues();
for (Value value : values) {
emitValue(value, contentHandler, property.getType(), skipBinary);
}
} else {
emitValue(property.getValue(), contentHandler, property.getType(), skipBinary);
}
// end the sv:property element
endElement(contentHandler, JcrSvLexicon.PROPERTY);
} | java | private void emitProperty( Property property,
ContentHandler contentHandler,
boolean skipBinary ) throws RepositoryException, SAXException {
assert property instanceof AbstractJcrProperty : "Illegal attempt to use " + getClass().getName()
+ " on non-ModeShape property";
AbstractJcrProperty prop = (AbstractJcrProperty)property;
// first set the property sv:name attribute
AttributesImpl propAtts = new AttributesImpl();
propAtts.addAttribute(JcrSvLexicon.NAME.getNamespaceUri(),
JcrSvLexicon.NAME.getLocalName(),
getPrefixedName(JcrSvLexicon.NAME),
PropertyType.nameFromValue(PropertyType.STRING),
prop.getName());
// and it's sv:type attribute
propAtts.addAttribute(JcrSvLexicon.TYPE.getNamespaceUri(),
JcrSvLexicon.TYPE.getLocalName(),
getPrefixedName(JcrSvLexicon.TYPE),
PropertyType.nameFromValue(PropertyType.STRING),
org.modeshape.jcr.api.PropertyType.nameFromValue(prop.getType()));
// and it's sv:multiple attribute
if (prop.isMultiple()) {
propAtts.addAttribute(JcrSvLexicon.TYPE.getNamespaceUri(),
JcrSvLexicon.TYPE.getLocalName(),
getPrefixedName(JcrSvLexicon.MULTIPLE),
PropertyType.nameFromValue(PropertyType.BOOLEAN),
Boolean.TRUE.toString());
}
// output the sv:property element
startElement(contentHandler, JcrSvLexicon.PROPERTY, propAtts);
// then output a sv:value element for each of its values
if (prop instanceof JcrMultiValueProperty) {
Value[] values = prop.getValues();
for (Value value : values) {
emitValue(value, contentHandler, property.getType(), skipBinary);
}
} else {
emitValue(property.getValue(), contentHandler, property.getType(), skipBinary);
}
// end the sv:property element
endElement(contentHandler, JcrSvLexicon.PROPERTY);
} | [
"private",
"void",
"emitProperty",
"(",
"Property",
"property",
",",
"ContentHandler",
"contentHandler",
",",
"boolean",
"skipBinary",
")",
"throws",
"RepositoryException",
",",
"SAXException",
"{",
"assert",
"property",
"instanceof",
"AbstractJcrProperty",
":",
"\"Illegal attempt to use \"",
"+",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
"+",
"\" on non-ModeShape property\"",
";",
"AbstractJcrProperty",
"prop",
"=",
"(",
"AbstractJcrProperty",
")",
"property",
";",
"// first set the property sv:name attribute",
"AttributesImpl",
"propAtts",
"=",
"new",
"AttributesImpl",
"(",
")",
";",
"propAtts",
".",
"addAttribute",
"(",
"JcrSvLexicon",
".",
"NAME",
".",
"getNamespaceUri",
"(",
")",
",",
"JcrSvLexicon",
".",
"NAME",
".",
"getLocalName",
"(",
")",
",",
"getPrefixedName",
"(",
"JcrSvLexicon",
".",
"NAME",
")",
",",
"PropertyType",
".",
"nameFromValue",
"(",
"PropertyType",
".",
"STRING",
")",
",",
"prop",
".",
"getName",
"(",
")",
")",
";",
"// and it's sv:type attribute",
"propAtts",
".",
"addAttribute",
"(",
"JcrSvLexicon",
".",
"TYPE",
".",
"getNamespaceUri",
"(",
")",
",",
"JcrSvLexicon",
".",
"TYPE",
".",
"getLocalName",
"(",
")",
",",
"getPrefixedName",
"(",
"JcrSvLexicon",
".",
"TYPE",
")",
",",
"PropertyType",
".",
"nameFromValue",
"(",
"PropertyType",
".",
"STRING",
")",
",",
"org",
".",
"modeshape",
".",
"jcr",
".",
"api",
".",
"PropertyType",
".",
"nameFromValue",
"(",
"prop",
".",
"getType",
"(",
")",
")",
")",
";",
"// and it's sv:multiple attribute",
"if",
"(",
"prop",
".",
"isMultiple",
"(",
")",
")",
"{",
"propAtts",
".",
"addAttribute",
"(",
"JcrSvLexicon",
".",
"TYPE",
".",
"getNamespaceUri",
"(",
")",
",",
"JcrSvLexicon",
".",
"TYPE",
".",
"getLocalName",
"(",
")",
",",
"getPrefixedName",
"(",
"JcrSvLexicon",
".",
"MULTIPLE",
")",
",",
"PropertyType",
".",
"nameFromValue",
"(",
"PropertyType",
".",
"BOOLEAN",
")",
",",
"Boolean",
".",
"TRUE",
".",
"toString",
"(",
")",
")",
";",
"}",
"// output the sv:property element",
"startElement",
"(",
"contentHandler",
",",
"JcrSvLexicon",
".",
"PROPERTY",
",",
"propAtts",
")",
";",
"// then output a sv:value element for each of its values",
"if",
"(",
"prop",
"instanceof",
"JcrMultiValueProperty",
")",
"{",
"Value",
"[",
"]",
"values",
"=",
"prop",
".",
"getValues",
"(",
")",
";",
"for",
"(",
"Value",
"value",
":",
"values",
")",
"{",
"emitValue",
"(",
"value",
",",
"contentHandler",
",",
"property",
".",
"getType",
"(",
")",
",",
"skipBinary",
")",
";",
"}",
"}",
"else",
"{",
"emitValue",
"(",
"property",
".",
"getValue",
"(",
")",
",",
"contentHandler",
",",
"property",
".",
"getType",
"(",
")",
",",
"skipBinary",
")",
";",
"}",
"// end the sv:property element",
"endElement",
"(",
"contentHandler",
",",
"JcrSvLexicon",
".",
"PROPERTY",
")",
";",
"}"
] | Fires the appropriate SAX events on the content handler to build the XML elements for the property.
@param property the property to be exported
@param contentHandler the SAX content handler for which SAX events will be invoked as the XML document is created.
@param skipBinary if <code>true</code>, indicates that binary properties should not be exported
@throws SAXException if an exception occurs during generation of the XML document
@throws RepositoryException if an exception occurs accessing the content repository | [
"Fires",
"the",
"appropriate",
"SAX",
"events",
"on",
"the",
"content",
"handler",
"to",
"build",
"the",
"XML",
"elements",
"for",
"the",
"property",
"."
] | train | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/JcrSystemViewExporter.java#L197-L244 |
Azure/azure-sdk-for-java | resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/DeploymentsInner.java | DeploymentsInner.checkExistence | public boolean checkExistence(String resourceGroupName, String deploymentName) {
"""
Checks whether the deployment exists.
@param resourceGroupName The name of the resource group with the deployment to check. The name is case insensitive.
@param deploymentName The name of the deployment to check.
@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 boolean object if successful.
"""
return checkExistenceWithServiceResponseAsync(resourceGroupName, deploymentName).toBlocking().single().body();
} | java | public boolean checkExistence(String resourceGroupName, String deploymentName) {
return checkExistenceWithServiceResponseAsync(resourceGroupName, deploymentName).toBlocking().single().body();
} | [
"public",
"boolean",
"checkExistence",
"(",
"String",
"resourceGroupName",
",",
"String",
"deploymentName",
")",
"{",
"return",
"checkExistenceWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"deploymentName",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
] | Checks whether the deployment exists.
@param resourceGroupName The name of the resource group with the deployment to check. The name is case insensitive.
@param deploymentName The name of the deployment to check.
@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 boolean object if successful. | [
"Checks",
"whether",
"the",
"deployment",
"exists",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/DeploymentsInner.java#L287-L289 |
twitter/twitter-korean-text | src/main/java/com/twitter/penguin/korean/util/CharacterUtils.java | CharacterUtils.toLowerCase | public final void toLowerCase(final char[] buffer, final int offset, final int limit) {
"""
Converts each unicode codepoint to lowerCase via {@link Character#toLowerCase(int)} starting
at the given offset.
@param buffer the char buffer to lowercase
@param offset the offset to start at
@param limit the max char in the buffer to lower case
"""
assert buffer.length >= limit;
assert offset <= 0 && offset <= buffer.length;
for (int i = offset; i < limit; ) {
i += Character.toChars(
Character.toLowerCase(
codePointAt(buffer, i, limit)), buffer, i);
}
} | java | public final void toLowerCase(final char[] buffer, final int offset, final int limit) {
assert buffer.length >= limit;
assert offset <= 0 && offset <= buffer.length;
for (int i = offset; i < limit; ) {
i += Character.toChars(
Character.toLowerCase(
codePointAt(buffer, i, limit)), buffer, i);
}
} | [
"public",
"final",
"void",
"toLowerCase",
"(",
"final",
"char",
"[",
"]",
"buffer",
",",
"final",
"int",
"offset",
",",
"final",
"int",
"limit",
")",
"{",
"assert",
"buffer",
".",
"length",
">=",
"limit",
";",
"assert",
"offset",
"<=",
"0",
"&&",
"offset",
"<=",
"buffer",
".",
"length",
";",
"for",
"(",
"int",
"i",
"=",
"offset",
";",
"i",
"<",
"limit",
";",
")",
"{",
"i",
"+=",
"Character",
".",
"toChars",
"(",
"Character",
".",
"toLowerCase",
"(",
"codePointAt",
"(",
"buffer",
",",
"i",
",",
"limit",
")",
")",
",",
"buffer",
",",
"i",
")",
";",
"}",
"}"
] | Converts each unicode codepoint to lowerCase via {@link Character#toLowerCase(int)} starting
at the given offset.
@param buffer the char buffer to lowercase
@param offset the offset to start at
@param limit the max char in the buffer to lower case | [
"Converts",
"each",
"unicode",
"codepoint",
"to",
"lowerCase",
"via",
"{",
"@link",
"Character#toLowerCase",
"(",
"int",
")",
"}",
"starting",
"at",
"the",
"given",
"offset",
"."
] | train | https://github.com/twitter/twitter-korean-text/blob/95bbe21fcc62fa7bf50b769ae80a5734fef6b903/src/main/java/com/twitter/penguin/korean/util/CharacterUtils.java#L101-L109 |
xvik/guice-persist-orient | src/main/java/ru/vyarus/guice/persist/orient/repository/core/util/RepositoryUtils.java | RepositoryUtils.methodToString | public static String methodToString(final Class<?> type, final Method method) {
"""
Converts method signature to human readable string.
@param type root type (method may be called not from declaring class)
@param method method to print
@return string representation for method
"""
final StringBuilder res = new StringBuilder();
res.append(type.getSimpleName()).append('#').append(method.getName()).append('(');
int i = 0;
for (Class<?> param : method.getParameterTypes()) {
if (i > 0) {
res.append(", ");
}
final Type generic = method.getGenericParameterTypes()[i];
if (generic instanceof TypeVariable) {
// using generic name, because its simpler to search visually in code
res.append('<').append(((TypeVariable) generic).getName()).append('>');
} else {
res.append(param.getSimpleName());
}
i++;
}
res.append(')');
return res.toString();
} | java | public static String methodToString(final Class<?> type, final Method method) {
final StringBuilder res = new StringBuilder();
res.append(type.getSimpleName()).append('#').append(method.getName()).append('(');
int i = 0;
for (Class<?> param : method.getParameterTypes()) {
if (i > 0) {
res.append(", ");
}
final Type generic = method.getGenericParameterTypes()[i];
if (generic instanceof TypeVariable) {
// using generic name, because its simpler to search visually in code
res.append('<').append(((TypeVariable) generic).getName()).append('>');
} else {
res.append(param.getSimpleName());
}
i++;
}
res.append(')');
return res.toString();
} | [
"public",
"static",
"String",
"methodToString",
"(",
"final",
"Class",
"<",
"?",
">",
"type",
",",
"final",
"Method",
"method",
")",
"{",
"final",
"StringBuilder",
"res",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"res",
".",
"append",
"(",
"type",
".",
"getSimpleName",
"(",
")",
")",
".",
"append",
"(",
"'",
"'",
")",
".",
"append",
"(",
"method",
".",
"getName",
"(",
")",
")",
".",
"append",
"(",
"'",
"'",
")",
";",
"int",
"i",
"=",
"0",
";",
"for",
"(",
"Class",
"<",
"?",
">",
"param",
":",
"method",
".",
"getParameterTypes",
"(",
")",
")",
"{",
"if",
"(",
"i",
">",
"0",
")",
"{",
"res",
".",
"append",
"(",
"\", \"",
")",
";",
"}",
"final",
"Type",
"generic",
"=",
"method",
".",
"getGenericParameterTypes",
"(",
")",
"[",
"i",
"]",
";",
"if",
"(",
"generic",
"instanceof",
"TypeVariable",
")",
"{",
"// using generic name, because its simpler to search visually in code",
"res",
".",
"append",
"(",
"'",
"'",
")",
".",
"append",
"(",
"(",
"(",
"TypeVariable",
")",
"generic",
")",
".",
"getName",
"(",
")",
")",
".",
"append",
"(",
"'",
"'",
")",
";",
"}",
"else",
"{",
"res",
".",
"append",
"(",
"param",
".",
"getSimpleName",
"(",
")",
")",
";",
"}",
"i",
"++",
";",
"}",
"res",
".",
"append",
"(",
"'",
"'",
")",
";",
"return",
"res",
".",
"toString",
"(",
")",
";",
"}"
] | Converts method signature to human readable string.
@param type root type (method may be called not from declaring class)
@param method method to print
@return string representation for method | [
"Converts",
"method",
"signature",
"to",
"human",
"readable",
"string",
"."
] | train | https://github.com/xvik/guice-persist-orient/blob/5ef06fb4f734360512e9824a3b875c4906c56b5b/src/main/java/ru/vyarus/guice/persist/orient/repository/core/util/RepositoryUtils.java#L57-L76 |
foundation-runtime/service-directory | 2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/impl/DirectoryRegistrationService.java | DirectoryRegistrationService.unregisterService | public void unregisterService(String serviceName, String providerId) {
"""
Unregister a ProvidedServiceInstance by serviceName and providerId.
@param serviceName
the serviceName of ProvidedServiceInstance.
@param providerId
the provierId of ProvidedServiceInstance.
"""
getServiceDirectoryClient().unregisterServiceInstance(serviceName, providerId);
getCacheServiceInstances().remove(new ServiceInstanceToken(serviceName, providerId));
} | java | public void unregisterService(String serviceName, String providerId) {
getServiceDirectoryClient().unregisterServiceInstance(serviceName, providerId);
getCacheServiceInstances().remove(new ServiceInstanceToken(serviceName, providerId));
} | [
"public",
"void",
"unregisterService",
"(",
"String",
"serviceName",
",",
"String",
"providerId",
")",
"{",
"getServiceDirectoryClient",
"(",
")",
".",
"unregisterServiceInstance",
"(",
"serviceName",
",",
"providerId",
")",
";",
"getCacheServiceInstances",
"(",
")",
".",
"remove",
"(",
"new",
"ServiceInstanceToken",
"(",
"serviceName",
",",
"providerId",
")",
")",
";",
"}"
] | Unregister a ProvidedServiceInstance by serviceName and providerId.
@param serviceName
the serviceName of ProvidedServiceInstance.
@param providerId
the provierId of ProvidedServiceInstance. | [
"Unregister",
"a",
"ProvidedServiceInstance",
"by",
"serviceName",
"and",
"providerId",
"."
] | train | https://github.com/foundation-runtime/service-directory/blob/a7bdefe173dc99e75eff4a24e07e6407e62f2ed4/2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/impl/DirectoryRegistrationService.java#L184-L187 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.