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
|
---|---|---|---|---|---|---|---|---|---|---|
lessthanoptimal/BoofCV | main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/circle/EllipseClustersIntoGrid.java | EllipseClustersIntoGrid.computeNodeInfo | void computeNodeInfo(List<EllipseRotated_F64> ellipses , List<Node> cluster ) {
"""
For each cluster create a {@link NodeInfo} and compute different properties
"""
// create an info object for each member inside of the cluster
listInfo.reset();
for (int i = 0; i < cluster.size(); i++) {
Node n = cluster.get(i);
EllipseRotated_F64 t = ellipses.get( n.which );
NodeInfo info = listInfo.grow();
info.reset();
info.ellipse = t;
}
addEdgesToInfo(cluster);
pruneNearlyIdenticalAngles();
findLargestAnglesForAllNodes();
} | java | void computeNodeInfo(List<EllipseRotated_F64> ellipses , List<Node> cluster ) {
// create an info object for each member inside of the cluster
listInfo.reset();
for (int i = 0; i < cluster.size(); i++) {
Node n = cluster.get(i);
EllipseRotated_F64 t = ellipses.get( n.which );
NodeInfo info = listInfo.grow();
info.reset();
info.ellipse = t;
}
addEdgesToInfo(cluster);
pruneNearlyIdenticalAngles();
findLargestAnglesForAllNodes();
} | [
"void",
"computeNodeInfo",
"(",
"List",
"<",
"EllipseRotated_F64",
">",
"ellipses",
",",
"List",
"<",
"Node",
">",
"cluster",
")",
"{",
"// create an info object for each member inside of the cluster",
"listInfo",
".",
"reset",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"cluster",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"Node",
"n",
"=",
"cluster",
".",
"get",
"(",
"i",
")",
";",
"EllipseRotated_F64",
"t",
"=",
"ellipses",
".",
"get",
"(",
"n",
".",
"which",
")",
";",
"NodeInfo",
"info",
"=",
"listInfo",
".",
"grow",
"(",
")",
";",
"info",
".",
"reset",
"(",
")",
";",
"info",
".",
"ellipse",
"=",
"t",
";",
"}",
"addEdgesToInfo",
"(",
"cluster",
")",
";",
"pruneNearlyIdenticalAngles",
"(",
")",
";",
"findLargestAnglesForAllNodes",
"(",
")",
";",
"}"
] | For each cluster create a {@link NodeInfo} and compute different properties | [
"For",
"each",
"cluster",
"create",
"a",
"{"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/circle/EllipseClustersIntoGrid.java#L267-L283 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/internal/util/InvocationUtil.java | InvocationUtil.invokeOnStableClusterSerial | public static ICompletableFuture<Object> invokeOnStableClusterSerial(NodeEngine nodeEngine,
Supplier<? extends Operation> operationSupplier,
int maxRetries) {
"""
Invoke operation on all cluster members.
The invocation is serial: It iterates over all members starting from the oldest member to the youngest one.
If there is a cluster membership change while invoking then it will restart invocations on all members. This
implies the operation should be idempotent.
If there is an exception - other than {@link com.hazelcast.core.MemberLeftException} or
{@link com.hazelcast.spi.exception.TargetNotMemberException} while invoking then the iteration
is interrupted and the exception is propagated to the caller.
"""
ClusterService clusterService = nodeEngine.getClusterService();
if (!clusterService.isJoined()) {
return new CompletedFuture<Object>(null, null, new CallerRunsExecutor());
}
RestartingMemberIterator memberIterator = new RestartingMemberIterator(clusterService, maxRetries);
// we are going to iterate over all members and invoke an operation on each of them
InvokeOnMemberFunction invokeOnMemberFunction = new InvokeOnMemberFunction(operationSupplier, nodeEngine,
memberIterator);
Iterator<ICompletableFuture<Object>> invocationIterator = map(memberIterator, invokeOnMemberFunction);
ILogger logger = nodeEngine.getLogger(ChainingFuture.class);
ExecutionService executionService = nodeEngine.getExecutionService();
ManagedExecutorService executor = executionService.getExecutor(ExecutionService.ASYNC_EXECUTOR);
// ChainingFuture uses the iterator to start invocations
// it invokes on another member only when the previous invocation is completed (so invocations are serial)
// the future itself completes only when the last invocation completes (or if there is an error)
return new ChainingFuture<Object>(invocationIterator, executor, memberIterator, logger);
} | java | public static ICompletableFuture<Object> invokeOnStableClusterSerial(NodeEngine nodeEngine,
Supplier<? extends Operation> operationSupplier,
int maxRetries) {
ClusterService clusterService = nodeEngine.getClusterService();
if (!clusterService.isJoined()) {
return new CompletedFuture<Object>(null, null, new CallerRunsExecutor());
}
RestartingMemberIterator memberIterator = new RestartingMemberIterator(clusterService, maxRetries);
// we are going to iterate over all members and invoke an operation on each of them
InvokeOnMemberFunction invokeOnMemberFunction = new InvokeOnMemberFunction(operationSupplier, nodeEngine,
memberIterator);
Iterator<ICompletableFuture<Object>> invocationIterator = map(memberIterator, invokeOnMemberFunction);
ILogger logger = nodeEngine.getLogger(ChainingFuture.class);
ExecutionService executionService = nodeEngine.getExecutionService();
ManagedExecutorService executor = executionService.getExecutor(ExecutionService.ASYNC_EXECUTOR);
// ChainingFuture uses the iterator to start invocations
// it invokes on another member only when the previous invocation is completed (so invocations are serial)
// the future itself completes only when the last invocation completes (or if there is an error)
return new ChainingFuture<Object>(invocationIterator, executor, memberIterator, logger);
} | [
"public",
"static",
"ICompletableFuture",
"<",
"Object",
">",
"invokeOnStableClusterSerial",
"(",
"NodeEngine",
"nodeEngine",
",",
"Supplier",
"<",
"?",
"extends",
"Operation",
">",
"operationSupplier",
",",
"int",
"maxRetries",
")",
"{",
"ClusterService",
"clusterService",
"=",
"nodeEngine",
".",
"getClusterService",
"(",
")",
";",
"if",
"(",
"!",
"clusterService",
".",
"isJoined",
"(",
")",
")",
"{",
"return",
"new",
"CompletedFuture",
"<",
"Object",
">",
"(",
"null",
",",
"null",
",",
"new",
"CallerRunsExecutor",
"(",
")",
")",
";",
"}",
"RestartingMemberIterator",
"memberIterator",
"=",
"new",
"RestartingMemberIterator",
"(",
"clusterService",
",",
"maxRetries",
")",
";",
"// we are going to iterate over all members and invoke an operation on each of them",
"InvokeOnMemberFunction",
"invokeOnMemberFunction",
"=",
"new",
"InvokeOnMemberFunction",
"(",
"operationSupplier",
",",
"nodeEngine",
",",
"memberIterator",
")",
";",
"Iterator",
"<",
"ICompletableFuture",
"<",
"Object",
">",
">",
"invocationIterator",
"=",
"map",
"(",
"memberIterator",
",",
"invokeOnMemberFunction",
")",
";",
"ILogger",
"logger",
"=",
"nodeEngine",
".",
"getLogger",
"(",
"ChainingFuture",
".",
"class",
")",
";",
"ExecutionService",
"executionService",
"=",
"nodeEngine",
".",
"getExecutionService",
"(",
")",
";",
"ManagedExecutorService",
"executor",
"=",
"executionService",
".",
"getExecutor",
"(",
"ExecutionService",
".",
"ASYNC_EXECUTOR",
")",
";",
"// ChainingFuture uses the iterator to start invocations",
"// it invokes on another member only when the previous invocation is completed (so invocations are serial)",
"// the future itself completes only when the last invocation completes (or if there is an error)",
"return",
"new",
"ChainingFuture",
"<",
"Object",
">",
"(",
"invocationIterator",
",",
"executor",
",",
"memberIterator",
",",
"logger",
")",
";",
"}"
] | Invoke operation on all cluster members.
The invocation is serial: It iterates over all members starting from the oldest member to the youngest one.
If there is a cluster membership change while invoking then it will restart invocations on all members. This
implies the operation should be idempotent.
If there is an exception - other than {@link com.hazelcast.core.MemberLeftException} or
{@link com.hazelcast.spi.exception.TargetNotMemberException} while invoking then the iteration
is interrupted and the exception is propagated to the caller. | [
"Invoke",
"operation",
"on",
"all",
"cluster",
"members",
"."
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/util/InvocationUtil.java#L63-L87 |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateView.java | CmsSerialDateView.showCurrentDates | public void showCurrentDates(Collection<CmsPair<Date, Boolean>> dates) {
"""
Shows the provided list of dates as current dates.
@param dates the current dates to show, accompanied with the information if they are exceptions or not.
"""
m_overviewList.setDatesWithCheckState(dates);
m_overviewPopup.center();
} | java | public void showCurrentDates(Collection<CmsPair<Date, Boolean>> dates) {
m_overviewList.setDatesWithCheckState(dates);
m_overviewPopup.center();
} | [
"public",
"void",
"showCurrentDates",
"(",
"Collection",
"<",
"CmsPair",
"<",
"Date",
",",
"Boolean",
">",
">",
"dates",
")",
"{",
"m_overviewList",
".",
"setDatesWithCheckState",
"(",
"dates",
")",
";",
"m_overviewPopup",
".",
"center",
"(",
")",
";",
"}"
] | Shows the provided list of dates as current dates.
@param dates the current dates to show, accompanied with the information if they are exceptions or not. | [
"Shows",
"the",
"provided",
"list",
"of",
"dates",
"as",
"current",
"dates",
"."
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateView.java#L339-L344 |
gwtbootstrap3/gwtbootstrap3 | gwtbootstrap3/src/main/java/org/gwtbootstrap3/client/ui/base/mixin/AttributeMixin.java | AttributeMixin.setAttribute | public void setAttribute(final String attributeName, final String attributeValue) {
"""
Sets the attribute on the UiObject
@param attributeName attribute name
@param attributeValue attribute value
"""
uiObject.getElement().setAttribute(attributeName, attributeValue);
} | java | public void setAttribute(final String attributeName, final String attributeValue) {
uiObject.getElement().setAttribute(attributeName, attributeValue);
} | [
"public",
"void",
"setAttribute",
"(",
"final",
"String",
"attributeName",
",",
"final",
"String",
"attributeValue",
")",
"{",
"uiObject",
".",
"getElement",
"(",
")",
".",
"setAttribute",
"(",
"attributeName",
",",
"attributeValue",
")",
";",
"}"
] | Sets the attribute on the UiObject
@param attributeName attribute name
@param attributeValue attribute value | [
"Sets",
"the",
"attribute",
"on",
"the",
"UiObject"
] | train | https://github.com/gwtbootstrap3/gwtbootstrap3/blob/54bdbd0b12ba7a436b278c007df960d1adf2e641/gwtbootstrap3/src/main/java/org/gwtbootstrap3/client/ui/base/mixin/AttributeMixin.java#L40-L42 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDNN.java | SDNN.batchNorm | public SDVariable batchNorm(String name, SDVariable input, SDVariable mean,
SDVariable variance, SDVariable gamma,
SDVariable beta, double epsilon, int... axis) {
"""
Neural network batch normalization operation.<br>
For details, see <a href="http://arxiv.org/abs/1502.03167">http://arxiv.org/abs/1502.03167</a>
@param name Name of the output variable
@param input Input variable.
@param mean Mean value. For 1d axis, this should match input.size(axis)
@param variance Variance value. For 1d axis, this should match input.size(axis)
@param gamma Gamma value. For 1d axis, this should match input.size(axis)
@param beta Beta value. For 1d axis, this should match input.size(axis)
@param epsilon Epsilon constant for numerical stability (to avoid division by 0)
@param axis For 2d CNN activations: 1 for NCHW format activations, or 3 for NHWC format activations.<br>
For 3d CNN activations: 1 for NCDHW format, 4 for NDHWC<br>
For 1d/RNN activations: 1 for NCW format, 2 for NWC
@return Output variable for batch normalization
"""
return batchNorm(name, input, mean, variance, gamma, beta, true, true, epsilon, axis);
} | java | public SDVariable batchNorm(String name, SDVariable input, SDVariable mean,
SDVariable variance, SDVariable gamma,
SDVariable beta, double epsilon, int... axis) {
return batchNorm(name, input, mean, variance, gamma, beta, true, true, epsilon, axis);
} | [
"public",
"SDVariable",
"batchNorm",
"(",
"String",
"name",
",",
"SDVariable",
"input",
",",
"SDVariable",
"mean",
",",
"SDVariable",
"variance",
",",
"SDVariable",
"gamma",
",",
"SDVariable",
"beta",
",",
"double",
"epsilon",
",",
"int",
"...",
"axis",
")",
"{",
"return",
"batchNorm",
"(",
"name",
",",
"input",
",",
"mean",
",",
"variance",
",",
"gamma",
",",
"beta",
",",
"true",
",",
"true",
",",
"epsilon",
",",
"axis",
")",
";",
"}"
] | Neural network batch normalization operation.<br>
For details, see <a href="http://arxiv.org/abs/1502.03167">http://arxiv.org/abs/1502.03167</a>
@param name Name of the output variable
@param input Input variable.
@param mean Mean value. For 1d axis, this should match input.size(axis)
@param variance Variance value. For 1d axis, this should match input.size(axis)
@param gamma Gamma value. For 1d axis, this should match input.size(axis)
@param beta Beta value. For 1d axis, this should match input.size(axis)
@param epsilon Epsilon constant for numerical stability (to avoid division by 0)
@param axis For 2d CNN activations: 1 for NCHW format activations, or 3 for NHWC format activations.<br>
For 3d CNN activations: 1 for NCDHW format, 4 for NDHWC<br>
For 1d/RNN activations: 1 for NCW format, 2 for NWC
@return Output variable for batch normalization | [
"Neural",
"network",
"batch",
"normalization",
"operation",
".",
"<br",
">",
"For",
"details",
"see",
"<a",
"href",
"=",
"http",
":",
"//",
"arxiv",
".",
"org",
"/",
"abs",
"/",
"1502",
".",
"03167",
">",
"http",
":",
"//",
"arxiv",
".",
"org",
"/",
"abs",
"/",
"1502",
".",
"03167<",
"/",
"a",
">"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDNN.java#L69-L73 |
mgormley/pacaya | src/main/java/edu/jhu/pacaya/parse/dep/EdgeScores.java | EdgeScores.childContains | public static boolean childContains(double[][] child, double value, double delta) {
"""
Safely checks whether the child array contains a value -- ignoring diagonal entries.
"""
for (int i=0; i<child.length; i++) {
for (int j=0; j<child.length; j++) {
if (i == j) { continue; }
if (Primitives.equals(child[i][j], value, delta)) {
return true;
}
}
}
return false;
} | java | public static boolean childContains(double[][] child, double value, double delta) {
for (int i=0; i<child.length; i++) {
for (int j=0; j<child.length; j++) {
if (i == j) { continue; }
if (Primitives.equals(child[i][j], value, delta)) {
return true;
}
}
}
return false;
} | [
"public",
"static",
"boolean",
"childContains",
"(",
"double",
"[",
"]",
"[",
"]",
"child",
",",
"double",
"value",
",",
"double",
"delta",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"child",
".",
"length",
";",
"i",
"++",
")",
"{",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"child",
".",
"length",
";",
"j",
"++",
")",
"{",
"if",
"(",
"i",
"==",
"j",
")",
"{",
"continue",
";",
"}",
"if",
"(",
"Primitives",
".",
"equals",
"(",
"child",
"[",
"i",
"]",
"[",
"j",
"]",
",",
"value",
",",
"delta",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"}",
"return",
"false",
";",
"}"
] | Safely checks whether the child array contains a value -- ignoring diagonal entries. | [
"Safely",
"checks",
"whether",
"the",
"child",
"array",
"contains",
"a",
"value",
"--",
"ignoring",
"diagonal",
"entries",
"."
] | train | https://github.com/mgormley/pacaya/blob/786294cbac7cc65dbc32210c10acc32ed0c69233/src/main/java/edu/jhu/pacaya/parse/dep/EdgeScores.java#L54-L64 |
TheCoder4eu/BootsFaces-OSP | src/main/java/net/bootsfaces/component/selectBooleanCheckbox/SelectBooleanCheckboxRenderer.java | SelectBooleanCheckboxRenderer.renderInputTagEnd | protected void renderInputTagEnd(ResponseWriter rw, SelectBooleanCheckbox selectBooleanCheckbox)
throws IOException {
"""
Closes the input tag. This method is protected in order to allow
third-party frameworks to derive from it.
@param rw
the response writer
@param selectBooleanCheckbox
the component to render
@throws IOException
may be thrown by the response writer
"""
rw.endElement("input");
String caption = selectBooleanCheckbox.getCaption();
if (null != caption) {
if (selectBooleanCheckbox.isEscape()) {
rw.writeText(" " + caption, null);
} else {
rw.append(" " + caption);
}
}
rw.endElement("label");
rw.endElement("div");
} | java | protected void renderInputTagEnd(ResponseWriter rw, SelectBooleanCheckbox selectBooleanCheckbox)
throws IOException {
rw.endElement("input");
String caption = selectBooleanCheckbox.getCaption();
if (null != caption) {
if (selectBooleanCheckbox.isEscape()) {
rw.writeText(" " + caption, null);
} else {
rw.append(" " + caption);
}
}
rw.endElement("label");
rw.endElement("div");
} | [
"protected",
"void",
"renderInputTagEnd",
"(",
"ResponseWriter",
"rw",
",",
"SelectBooleanCheckbox",
"selectBooleanCheckbox",
")",
"throws",
"IOException",
"{",
"rw",
".",
"endElement",
"(",
"\"input\"",
")",
";",
"String",
"caption",
"=",
"selectBooleanCheckbox",
".",
"getCaption",
"(",
")",
";",
"if",
"(",
"null",
"!=",
"caption",
")",
"{",
"if",
"(",
"selectBooleanCheckbox",
".",
"isEscape",
"(",
")",
")",
"{",
"rw",
".",
"writeText",
"(",
"\" \"",
"+",
"caption",
",",
"null",
")",
";",
"}",
"else",
"{",
"rw",
".",
"append",
"(",
"\" \"",
"+",
"caption",
")",
";",
"}",
"}",
"rw",
".",
"endElement",
"(",
"\"label\"",
")",
";",
"rw",
".",
"endElement",
"(",
"\"div\"",
")",
";",
"}"
] | Closes the input tag. This method is protected in order to allow
third-party frameworks to derive from it.
@param rw
the response writer
@param selectBooleanCheckbox
the component to render
@throws IOException
may be thrown by the response writer | [
"Closes",
"the",
"input",
"tag",
".",
"This",
"method",
"is",
"protected",
"in",
"order",
"to",
"allow",
"third",
"-",
"party",
"frameworks",
"to",
"derive",
"from",
"it",
"."
] | train | https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/component/selectBooleanCheckbox/SelectBooleanCheckboxRenderer.java#L340-L353 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java | ArrayUtil.swap | public static Object swap(Object array, int index1, int index2) {
"""
交换数组中两个位置的值
@param array 数组对象
@param index1 位置1
@param index2 位置2
@return 交换后的数组,与传入数组为同一对象
@since 4.0.7
"""
if (isEmpty(array)) {
throw new IllegalArgumentException("Array must not empty !");
}
Object tmp = get(array, index1);
Array.set(array, index1, Array.get(array, index2));
Array.set(array, index2, tmp);
return array;
} | java | public static Object swap(Object array, int index1, int index2) {
if (isEmpty(array)) {
throw new IllegalArgumentException("Array must not empty !");
}
Object tmp = get(array, index1);
Array.set(array, index1, Array.get(array, index2));
Array.set(array, index2, tmp);
return array;
} | [
"public",
"static",
"Object",
"swap",
"(",
"Object",
"array",
",",
"int",
"index1",
",",
"int",
"index2",
")",
"{",
"if",
"(",
"isEmpty",
"(",
"array",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Array must not empty !\"",
")",
";",
"}",
"Object",
"tmp",
"=",
"get",
"(",
"array",
",",
"index1",
")",
";",
"Array",
".",
"set",
"(",
"array",
",",
"index1",
",",
"Array",
".",
"get",
"(",
"array",
",",
"index2",
")",
")",
";",
"Array",
".",
"set",
"(",
"array",
",",
"index2",
",",
"tmp",
")",
";",
"return",
"array",
";",
"}"
] | 交换数组中两个位置的值
@param array 数组对象
@param index1 位置1
@param index2 位置2
@return 交换后的数组,与传入数组为同一对象
@since 4.0.7 | [
"交换数组中两个位置的值"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java#L3762-L3770 |
jillesvangurp/jsonj | src/main/java/com/github/jsonj/tools/JsonXmlConverter.java | JsonXmlConverter.getW3cDocument | public static org.w3c.dom.Document getW3cDocument(JsonElement value, String rootName) {
"""
Convert any JsonElement into an w3c DOM tree.
@param value
a json element
@param rootName
the root name of the xml
@return a Document
"""
Element root = getElement(value, rootName);
try {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
DocumentBuilder builder = factory.newDocumentBuilder();
DOMImplementation impl = builder.getDOMImplementation();
return DOMConverter.convert(new Document(root), impl);
} catch (ParserConfigurationException e) {
throw new IllegalStateException(e);
}
} | java | public static org.w3c.dom.Document getW3cDocument(JsonElement value, String rootName) {
Element root = getElement(value, rootName);
try {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
DocumentBuilder builder = factory.newDocumentBuilder();
DOMImplementation impl = builder.getDOMImplementation();
return DOMConverter.convert(new Document(root), impl);
} catch (ParserConfigurationException e) {
throw new IllegalStateException(e);
}
} | [
"public",
"static",
"org",
".",
"w3c",
".",
"dom",
".",
"Document",
"getW3cDocument",
"(",
"JsonElement",
"value",
",",
"String",
"rootName",
")",
"{",
"Element",
"root",
"=",
"getElement",
"(",
"value",
",",
"rootName",
")",
";",
"try",
"{",
"DocumentBuilderFactory",
"factory",
"=",
"DocumentBuilderFactory",
".",
"newInstance",
"(",
")",
";",
"factory",
".",
"setNamespaceAware",
"(",
"true",
")",
";",
"DocumentBuilder",
"builder",
"=",
"factory",
".",
"newDocumentBuilder",
"(",
")",
";",
"DOMImplementation",
"impl",
"=",
"builder",
".",
"getDOMImplementation",
"(",
")",
";",
"return",
"DOMConverter",
".",
"convert",
"(",
"new",
"Document",
"(",
"root",
")",
",",
"impl",
")",
";",
"}",
"catch",
"(",
"ParserConfigurationException",
"e",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"e",
")",
";",
"}",
"}"
] | Convert any JsonElement into an w3c DOM tree.
@param value
a json element
@param rootName
the root name of the xml
@return a Document | [
"Convert",
"any",
"JsonElement",
"into",
"an",
"w3c",
"DOM",
"tree",
"."
] | train | https://github.com/jillesvangurp/jsonj/blob/1da0c44c5bdb60c0cd806c48d2da5a8a75bf84af/src/main/java/com/github/jsonj/tools/JsonXmlConverter.java#L120-L132 |
pmayweg/sonar-groovy | sonar-groovy-plugin/src/main/java/org/sonar/plugins/groovy/jacoco/JaCoCoReportReader.java | JaCoCoReportReader.analyzeFiles | public CoverageBuilder analyzeFiles(ExecutionDataStore executionDataStore, Collection<File> classFiles) {
"""
Caller must guarantee that {@code classFiles} are actually class file.
"""
CoverageBuilder coverageBuilder = new CoverageBuilder();
if (useCurrentBinaryFormat) {
Analyzer analyzer = new Analyzer(executionDataStore, coverageBuilder);
for (File classFile : classFiles) {
analyzeClassFile(analyzer, classFile);
}
} else {
org.jacoco.previous.core.analysis.Analyzer analyzer = new org.jacoco.previous.core.analysis.Analyzer(executionDataStore, coverageBuilder);
for (File classFile : classFiles) {
analyzeClassFile(analyzer, classFile);
}
}
return coverageBuilder;
} | java | public CoverageBuilder analyzeFiles(ExecutionDataStore executionDataStore, Collection<File> classFiles) {
CoverageBuilder coverageBuilder = new CoverageBuilder();
if (useCurrentBinaryFormat) {
Analyzer analyzer = new Analyzer(executionDataStore, coverageBuilder);
for (File classFile : classFiles) {
analyzeClassFile(analyzer, classFile);
}
} else {
org.jacoco.previous.core.analysis.Analyzer analyzer = new org.jacoco.previous.core.analysis.Analyzer(executionDataStore, coverageBuilder);
for (File classFile : classFiles) {
analyzeClassFile(analyzer, classFile);
}
}
return coverageBuilder;
} | [
"public",
"CoverageBuilder",
"analyzeFiles",
"(",
"ExecutionDataStore",
"executionDataStore",
",",
"Collection",
"<",
"File",
">",
"classFiles",
")",
"{",
"CoverageBuilder",
"coverageBuilder",
"=",
"new",
"CoverageBuilder",
"(",
")",
";",
"if",
"(",
"useCurrentBinaryFormat",
")",
"{",
"Analyzer",
"analyzer",
"=",
"new",
"Analyzer",
"(",
"executionDataStore",
",",
"coverageBuilder",
")",
";",
"for",
"(",
"File",
"classFile",
":",
"classFiles",
")",
"{",
"analyzeClassFile",
"(",
"analyzer",
",",
"classFile",
")",
";",
"}",
"}",
"else",
"{",
"org",
".",
"jacoco",
".",
"previous",
".",
"core",
".",
"analysis",
".",
"Analyzer",
"analyzer",
"=",
"new",
"org",
".",
"jacoco",
".",
"previous",
".",
"core",
".",
"analysis",
".",
"Analyzer",
"(",
"executionDataStore",
",",
"coverageBuilder",
")",
";",
"for",
"(",
"File",
"classFile",
":",
"classFiles",
")",
"{",
"analyzeClassFile",
"(",
"analyzer",
",",
"classFile",
")",
";",
"}",
"}",
"return",
"coverageBuilder",
";",
"}"
] | Caller must guarantee that {@code classFiles} are actually class file. | [
"Caller",
"must",
"guarantee",
"that",
"{"
] | train | https://github.com/pmayweg/sonar-groovy/blob/2d78d6578304601613db928795d81de340e6fa34/sonar-groovy-plugin/src/main/java/org/sonar/plugins/groovy/jacoco/JaCoCoReportReader.java#L107-L121 |
roskart/dropwizard-jaxws | dropwizard-jaxws/src/main/java/com/roskart/dropwizard/jaxws/JAXWSBundle.java | JAXWSBundle.publishEndpoint | public Endpoint publishEndpoint(String path, Object service, SessionFactory sessionFactory) {
"""
Publish JAX-WS endpoint with Dropwizard Hibernate Bundle integration. Service is scanned for @UnitOfWork
annotations. EndpointBuilder is published relative to the CXF servlet path.
@param path Relative endpoint path.
@param service Service implementation.
@param sessionFactory Hibernate session factory.
@return javax.xml.ws.Endpoint
@deprecated Use the {@link #publishEndpoint(EndpointBuilder)} publishEndpoint} method instead.
"""
return this.publishEndpoint(path, service, null, sessionFactory);
} | java | public Endpoint publishEndpoint(String path, Object service, SessionFactory sessionFactory) {
return this.publishEndpoint(path, service, null, sessionFactory);
} | [
"public",
"Endpoint",
"publishEndpoint",
"(",
"String",
"path",
",",
"Object",
"service",
",",
"SessionFactory",
"sessionFactory",
")",
"{",
"return",
"this",
".",
"publishEndpoint",
"(",
"path",
",",
"service",
",",
"null",
",",
"sessionFactory",
")",
";",
"}"
] | Publish JAX-WS endpoint with Dropwizard Hibernate Bundle integration. Service is scanned for @UnitOfWork
annotations. EndpointBuilder is published relative to the CXF servlet path.
@param path Relative endpoint path.
@param service Service implementation.
@param sessionFactory Hibernate session factory.
@return javax.xml.ws.Endpoint
@deprecated Use the {@link #publishEndpoint(EndpointBuilder)} publishEndpoint} method instead. | [
"Publish",
"JAX",
"-",
"WS",
"endpoint",
"with",
"Dropwizard",
"Hibernate",
"Bundle",
"integration",
".",
"Service",
"is",
"scanned",
"for",
"@UnitOfWork",
"annotations",
".",
"EndpointBuilder",
"is",
"published",
"relative",
"to",
"the",
"CXF",
"servlet",
"path",
".",
"@param",
"path",
"Relative",
"endpoint",
"path",
".",
"@param",
"service",
"Service",
"implementation",
".",
"@param",
"sessionFactory",
"Hibernate",
"session",
"factory",
".",
"@return",
"javax",
".",
"xml",
".",
"ws",
".",
"Endpoint"
] | train | https://github.com/roskart/dropwizard-jaxws/blob/972eb63ba9626f3282d4a1d6127dc2b60b28f2bc/dropwizard-jaxws/src/main/java/com/roskart/dropwizard/jaxws/JAXWSBundle.java#L110-L112 |
apache/incubator-gobblin | gobblin-salesforce/src/main/java/org/apache/gobblin/salesforce/SalesforceSource.java | SalesforceSource.getRefinedHistogram | private Histogram getRefinedHistogram(SalesforceConnector connector, String entity, String watermarkColumn,
SourceState state, Partition partition, Histogram histogram) {
"""
Refine the histogram by probing to split large buckets
@return the refined histogram
"""
final int maxPartitions = state.getPropAsInt(ConfigurationKeys.SOURCE_MAX_NUMBER_OF_PARTITIONS,
ConfigurationKeys.DEFAULT_MAX_NUMBER_OF_PARTITIONS);
final int probeLimit = state.getPropAsInt(DYNAMIC_PROBING_LIMIT, DEFAULT_DYNAMIC_PROBING_LIMIT);
final int minTargetPartitionSize = state.getPropAsInt(MIN_TARGET_PARTITION_SIZE, DEFAULT_MIN_TARGET_PARTITION_SIZE);
final Histogram outputHistogram = new Histogram();
final double probeTargetRatio = state.getPropAsDouble(PROBE_TARGET_RATIO, DEFAULT_PROBE_TARGET_RATIO);
final int bucketSizeLimit =
(int) (probeTargetRatio * computeTargetPartitionSize(histogram, minTargetPartitionSize, maxPartitions));
log.info("Refining histogram with bucket size limit {}.", bucketSizeLimit);
HistogramGroup currentGroup;
HistogramGroup nextGroup;
final TableCountProbingContext probingContext =
new TableCountProbingContext(connector, entity, watermarkColumn, bucketSizeLimit, probeLimit);
if (histogram.getGroups().isEmpty()) {
return outputHistogram;
}
// make a copy of the histogram list and add a dummy entry at the end to avoid special processing of the last group
List<HistogramGroup> list = new ArrayList(histogram.getGroups());
Date hwmDate = Utils.toDate(partition.getHighWatermark(), Partitioner.WATERMARKTIMEFORMAT);
list.add(new HistogramGroup(Utils.epochToDate(hwmDate.getTime(), SECONDS_FORMAT), 0));
for (int i = 0; i < list.size() - 1; i++) {
currentGroup = list.get(i);
nextGroup = list.get(i + 1);
// split the group if it is larger than the bucket size limit
if (currentGroup.count > bucketSizeLimit) {
long startEpoch = Utils.toDate(currentGroup.getKey(), SECONDS_FORMAT).getTime();
long endEpoch = Utils.toDate(nextGroup.getKey(), SECONDS_FORMAT).getTime();
outputHistogram.add(getHistogramByProbing(probingContext, currentGroup.count, startEpoch, endEpoch));
} else {
outputHistogram.add(currentGroup);
}
}
log.info("Executed {} probes for refining the histogram.", probingContext.probeCount);
// if the probe limit has been reached then print a warning
if (probingContext.probeCount >= probingContext.probeLimit) {
log.warn("Reached the probe limit");
}
return outputHistogram;
} | java | private Histogram getRefinedHistogram(SalesforceConnector connector, String entity, String watermarkColumn,
SourceState state, Partition partition, Histogram histogram) {
final int maxPartitions = state.getPropAsInt(ConfigurationKeys.SOURCE_MAX_NUMBER_OF_PARTITIONS,
ConfigurationKeys.DEFAULT_MAX_NUMBER_OF_PARTITIONS);
final int probeLimit = state.getPropAsInt(DYNAMIC_PROBING_LIMIT, DEFAULT_DYNAMIC_PROBING_LIMIT);
final int minTargetPartitionSize = state.getPropAsInt(MIN_TARGET_PARTITION_SIZE, DEFAULT_MIN_TARGET_PARTITION_SIZE);
final Histogram outputHistogram = new Histogram();
final double probeTargetRatio = state.getPropAsDouble(PROBE_TARGET_RATIO, DEFAULT_PROBE_TARGET_RATIO);
final int bucketSizeLimit =
(int) (probeTargetRatio * computeTargetPartitionSize(histogram, minTargetPartitionSize, maxPartitions));
log.info("Refining histogram with bucket size limit {}.", bucketSizeLimit);
HistogramGroup currentGroup;
HistogramGroup nextGroup;
final TableCountProbingContext probingContext =
new TableCountProbingContext(connector, entity, watermarkColumn, bucketSizeLimit, probeLimit);
if (histogram.getGroups().isEmpty()) {
return outputHistogram;
}
// make a copy of the histogram list and add a dummy entry at the end to avoid special processing of the last group
List<HistogramGroup> list = new ArrayList(histogram.getGroups());
Date hwmDate = Utils.toDate(partition.getHighWatermark(), Partitioner.WATERMARKTIMEFORMAT);
list.add(new HistogramGroup(Utils.epochToDate(hwmDate.getTime(), SECONDS_FORMAT), 0));
for (int i = 0; i < list.size() - 1; i++) {
currentGroup = list.get(i);
nextGroup = list.get(i + 1);
// split the group if it is larger than the bucket size limit
if (currentGroup.count > bucketSizeLimit) {
long startEpoch = Utils.toDate(currentGroup.getKey(), SECONDS_FORMAT).getTime();
long endEpoch = Utils.toDate(nextGroup.getKey(), SECONDS_FORMAT).getTime();
outputHistogram.add(getHistogramByProbing(probingContext, currentGroup.count, startEpoch, endEpoch));
} else {
outputHistogram.add(currentGroup);
}
}
log.info("Executed {} probes for refining the histogram.", probingContext.probeCount);
// if the probe limit has been reached then print a warning
if (probingContext.probeCount >= probingContext.probeLimit) {
log.warn("Reached the probe limit");
}
return outputHistogram;
} | [
"private",
"Histogram",
"getRefinedHistogram",
"(",
"SalesforceConnector",
"connector",
",",
"String",
"entity",
",",
"String",
"watermarkColumn",
",",
"SourceState",
"state",
",",
"Partition",
"partition",
",",
"Histogram",
"histogram",
")",
"{",
"final",
"int",
"maxPartitions",
"=",
"state",
".",
"getPropAsInt",
"(",
"ConfigurationKeys",
".",
"SOURCE_MAX_NUMBER_OF_PARTITIONS",
",",
"ConfigurationKeys",
".",
"DEFAULT_MAX_NUMBER_OF_PARTITIONS",
")",
";",
"final",
"int",
"probeLimit",
"=",
"state",
".",
"getPropAsInt",
"(",
"DYNAMIC_PROBING_LIMIT",
",",
"DEFAULT_DYNAMIC_PROBING_LIMIT",
")",
";",
"final",
"int",
"minTargetPartitionSize",
"=",
"state",
".",
"getPropAsInt",
"(",
"MIN_TARGET_PARTITION_SIZE",
",",
"DEFAULT_MIN_TARGET_PARTITION_SIZE",
")",
";",
"final",
"Histogram",
"outputHistogram",
"=",
"new",
"Histogram",
"(",
")",
";",
"final",
"double",
"probeTargetRatio",
"=",
"state",
".",
"getPropAsDouble",
"(",
"PROBE_TARGET_RATIO",
",",
"DEFAULT_PROBE_TARGET_RATIO",
")",
";",
"final",
"int",
"bucketSizeLimit",
"=",
"(",
"int",
")",
"(",
"probeTargetRatio",
"*",
"computeTargetPartitionSize",
"(",
"histogram",
",",
"minTargetPartitionSize",
",",
"maxPartitions",
")",
")",
";",
"log",
".",
"info",
"(",
"\"Refining histogram with bucket size limit {}.\"",
",",
"bucketSizeLimit",
")",
";",
"HistogramGroup",
"currentGroup",
";",
"HistogramGroup",
"nextGroup",
";",
"final",
"TableCountProbingContext",
"probingContext",
"=",
"new",
"TableCountProbingContext",
"(",
"connector",
",",
"entity",
",",
"watermarkColumn",
",",
"bucketSizeLimit",
",",
"probeLimit",
")",
";",
"if",
"(",
"histogram",
".",
"getGroups",
"(",
")",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"outputHistogram",
";",
"}",
"// make a copy of the histogram list and add a dummy entry at the end to avoid special processing of the last group",
"List",
"<",
"HistogramGroup",
">",
"list",
"=",
"new",
"ArrayList",
"(",
"histogram",
".",
"getGroups",
"(",
")",
")",
";",
"Date",
"hwmDate",
"=",
"Utils",
".",
"toDate",
"(",
"partition",
".",
"getHighWatermark",
"(",
")",
",",
"Partitioner",
".",
"WATERMARKTIMEFORMAT",
")",
";",
"list",
".",
"add",
"(",
"new",
"HistogramGroup",
"(",
"Utils",
".",
"epochToDate",
"(",
"hwmDate",
".",
"getTime",
"(",
")",
",",
"SECONDS_FORMAT",
")",
",",
"0",
")",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"list",
".",
"size",
"(",
")",
"-",
"1",
";",
"i",
"++",
")",
"{",
"currentGroup",
"=",
"list",
".",
"get",
"(",
"i",
")",
";",
"nextGroup",
"=",
"list",
".",
"get",
"(",
"i",
"+",
"1",
")",
";",
"// split the group if it is larger than the bucket size limit",
"if",
"(",
"currentGroup",
".",
"count",
">",
"bucketSizeLimit",
")",
"{",
"long",
"startEpoch",
"=",
"Utils",
".",
"toDate",
"(",
"currentGroup",
".",
"getKey",
"(",
")",
",",
"SECONDS_FORMAT",
")",
".",
"getTime",
"(",
")",
";",
"long",
"endEpoch",
"=",
"Utils",
".",
"toDate",
"(",
"nextGroup",
".",
"getKey",
"(",
")",
",",
"SECONDS_FORMAT",
")",
".",
"getTime",
"(",
")",
";",
"outputHistogram",
".",
"add",
"(",
"getHistogramByProbing",
"(",
"probingContext",
",",
"currentGroup",
".",
"count",
",",
"startEpoch",
",",
"endEpoch",
")",
")",
";",
"}",
"else",
"{",
"outputHistogram",
".",
"add",
"(",
"currentGroup",
")",
";",
"}",
"}",
"log",
".",
"info",
"(",
"\"Executed {} probes for refining the histogram.\"",
",",
"probingContext",
".",
"probeCount",
")",
";",
"// if the probe limit has been reached then print a warning",
"if",
"(",
"probingContext",
".",
"probeCount",
">=",
"probingContext",
".",
"probeLimit",
")",
"{",
"log",
".",
"warn",
"(",
"\"Reached the probe limit\"",
")",
";",
"}",
"return",
"outputHistogram",
";",
"}"
] | Refine the histogram by probing to split large buckets
@return the refined histogram | [
"Refine",
"the",
"histogram",
"by",
"probing",
"to",
"split",
"large",
"buckets"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-salesforce/src/main/java/org/apache/gobblin/salesforce/SalesforceSource.java#L388-L438 |
Netflix/conductor | core/src/main/java/com/netflix/conductor/service/WorkflowServiceImpl.java | WorkflowServiceImpl.rerunWorkflow | @Service
public String rerunWorkflow(String workflowId, RerunWorkflowRequest request) {
"""
Reruns the workflow from a specific task.
@param workflowId WorkflowId of the workflow you want to rerun.
@param request (@link RerunWorkflowRequest) for the workflow.
@return WorkflowId of the rerun workflow.
"""
request.setReRunFromWorkflowId(workflowId);
return workflowExecutor.rerun(request);
} | java | @Service
public String rerunWorkflow(String workflowId, RerunWorkflowRequest request) {
request.setReRunFromWorkflowId(workflowId);
return workflowExecutor.rerun(request);
} | [
"@",
"Service",
"public",
"String",
"rerunWorkflow",
"(",
"String",
"workflowId",
",",
"RerunWorkflowRequest",
"request",
")",
"{",
"request",
".",
"setReRunFromWorkflowId",
"(",
"workflowId",
")",
";",
"return",
"workflowExecutor",
".",
"rerun",
"(",
"request",
")",
";",
"}"
] | Reruns the workflow from a specific task.
@param workflowId WorkflowId of the workflow you want to rerun.
@param request (@link RerunWorkflowRequest) for the workflow.
@return WorkflowId of the rerun workflow. | [
"Reruns",
"the",
"workflow",
"from",
"a",
"specific",
"task",
"."
] | train | https://github.com/Netflix/conductor/blob/78fae0ed9ddea22891f9eebb96a2ec0b2783dca0/core/src/main/java/com/netflix/conductor/service/WorkflowServiceImpl.java#L279-L283 |
jeremylong/DependencyCheck | utils/src/main/java/org/owasp/dependencycheck/utils/Settings.java | Settings.getLong | public long getLong(@NotNull final String key) throws InvalidSettingException {
"""
Returns a long value from the properties file. If the value was specified
as a system property or passed in via the -Dprop=value argument - this
method will return the value from the system properties before the values
in the contained configuration file.
@param key the key to lookup within the properties file
@return the property from the properties file
@throws org.owasp.dependencycheck.utils.InvalidSettingException is thrown
if there is an error retrieving the setting
"""
try {
return Long.parseLong(getString(key));
} catch (NumberFormatException ex) {
throw new InvalidSettingException("Could not convert property '" + key + "' to a long.", ex);
}
} | java | public long getLong(@NotNull final String key) throws InvalidSettingException {
try {
return Long.parseLong(getString(key));
} catch (NumberFormatException ex) {
throw new InvalidSettingException("Could not convert property '" + key + "' to a long.", ex);
}
} | [
"public",
"long",
"getLong",
"(",
"@",
"NotNull",
"final",
"String",
"key",
")",
"throws",
"InvalidSettingException",
"{",
"try",
"{",
"return",
"Long",
".",
"parseLong",
"(",
"getString",
"(",
"key",
")",
")",
";",
"}",
"catch",
"(",
"NumberFormatException",
"ex",
")",
"{",
"throw",
"new",
"InvalidSettingException",
"(",
"\"Could not convert property '\"",
"+",
"key",
"+",
"\"' to a long.\"",
",",
"ex",
")",
";",
"}",
"}"
] | Returns a long value from the properties file. If the value was specified
as a system property or passed in via the -Dprop=value argument - this
method will return the value from the system properties before the values
in the contained configuration file.
@param key the key to lookup within the properties file
@return the property from the properties file
@throws org.owasp.dependencycheck.utils.InvalidSettingException is thrown
if there is an error retrieving the setting | [
"Returns",
"a",
"long",
"value",
"from",
"the",
"properties",
"file",
".",
"If",
"the",
"value",
"was",
"specified",
"as",
"a",
"system",
"property",
"or",
"passed",
"in",
"via",
"the",
"-",
"Dprop",
"=",
"value",
"argument",
"-",
"this",
"method",
"will",
"return",
"the",
"value",
"from",
"the",
"system",
"properties",
"before",
"the",
"values",
"in",
"the",
"contained",
"configuration",
"file",
"."
] | train | https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/utils/src/main/java/org/owasp/dependencycheck/utils/Settings.java#L1018-L1024 |
stripe/stripe-java | src/main/java/com/stripe/model/Invoice.java | Invoice.sendInvoice | public Invoice sendInvoice() throws StripeException {
"""
Stripe will automatically send invoices to customers according to your <a
href="https://dashboard.stripe.com/account/billing/automatic">subscriptions settings</a>.
However, if you’d like to manually send an invoice to your customer out of the normal schedule,
you can do so. When sending invoices that have already been paid, there will be no reference to
the payment in the email.
<p>Requests made in test-mode result in no emails being sent, despite sending an <code>
invoice.sent</code> event.
"""
return sendInvoice((Map<String, Object>) null, (RequestOptions) null);
} | java | public Invoice sendInvoice() throws StripeException {
return sendInvoice((Map<String, Object>) null, (RequestOptions) null);
} | [
"public",
"Invoice",
"sendInvoice",
"(",
")",
"throws",
"StripeException",
"{",
"return",
"sendInvoice",
"(",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
")",
"null",
",",
"(",
"RequestOptions",
")",
"null",
")",
";",
"}"
] | Stripe will automatically send invoices to customers according to your <a
href="https://dashboard.stripe.com/account/billing/automatic">subscriptions settings</a>.
However, if you’d like to manually send an invoice to your customer out of the normal schedule,
you can do so. When sending invoices that have already been paid, there will be no reference to
the payment in the email.
<p>Requests made in test-mode result in no emails being sent, despite sending an <code>
invoice.sent</code> event. | [
"Stripe",
"will",
"automatically",
"send",
"invoices",
"to",
"customers",
"according",
"to",
"your",
"<a",
"href",
"=",
"https",
":",
"//",
"dashboard",
".",
"stripe",
".",
"com",
"/",
"account",
"/",
"billing",
"/",
"automatic",
">",
"subscriptions",
"settings<",
"/",
"a",
">",
".",
"However",
"if",
"you’d",
"like",
"to",
"manually",
"send",
"an",
"invoice",
"to",
"your",
"customer",
"out",
"of",
"the",
"normal",
"schedule",
"you",
"can",
"do",
"so",
".",
"When",
"sending",
"invoices",
"that",
"have",
"already",
"been",
"paid",
"there",
"will",
"be",
"no",
"reference",
"to",
"the",
"payment",
"in",
"the",
"email",
"."
] | train | https://github.com/stripe/stripe-java/blob/acfa8becef3e73bfe3e9d8880bea3f3f30dadeac/src/main/java/com/stripe/model/Invoice.java#L1017-L1019 |
UrielCh/ovh-java-sdk | ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java | ApiOvhCloud.serviceName_pca_pcaServiceName_sessions_sessionId_PUT | public void serviceName_pca_pcaServiceName_sessions_sessionId_PUT(String serviceName, String pcaServiceName, String sessionId, net.minidev.ovh.api.pca.OvhSession body) throws IOException {
"""
Alter this object properties
REST: PUT /cloud/{serviceName}/pca/{pcaServiceName}/sessions/{sessionId}
@param body [required] New object properties
@param serviceName [required] The internal name of your public cloud passport
@param pcaServiceName [required] The internal name of your PCA offer
@param sessionId [required] Session ID
@deprecated
"""
String qPath = "/cloud/{serviceName}/pca/{pcaServiceName}/sessions/{sessionId}";
StringBuilder sb = path(qPath, serviceName, pcaServiceName, sessionId);
exec(qPath, "PUT", sb.toString(), body);
} | java | public void serviceName_pca_pcaServiceName_sessions_sessionId_PUT(String serviceName, String pcaServiceName, String sessionId, net.minidev.ovh.api.pca.OvhSession body) throws IOException {
String qPath = "/cloud/{serviceName}/pca/{pcaServiceName}/sessions/{sessionId}";
StringBuilder sb = path(qPath, serviceName, pcaServiceName, sessionId);
exec(qPath, "PUT", sb.toString(), body);
} | [
"public",
"void",
"serviceName_pca_pcaServiceName_sessions_sessionId_PUT",
"(",
"String",
"serviceName",
",",
"String",
"pcaServiceName",
",",
"String",
"sessionId",
",",
"net",
".",
"minidev",
".",
"ovh",
".",
"api",
".",
"pca",
".",
"OvhSession",
"body",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/cloud/{serviceName}/pca/{pcaServiceName}/sessions/{sessionId}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"serviceName",
",",
"pcaServiceName",
",",
"sessionId",
")",
";",
"exec",
"(",
"qPath",
",",
"\"PUT\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"body",
")",
";",
"}"
] | Alter this object properties
REST: PUT /cloud/{serviceName}/pca/{pcaServiceName}/sessions/{sessionId}
@param body [required] New object properties
@param serviceName [required] The internal name of your public cloud passport
@param pcaServiceName [required] The internal name of your PCA offer
@param sessionId [required] Session ID
@deprecated | [
"Alter",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java#L2483-L2487 |
icode/ameba | src/main/java/ameba/container/Container.java | Container.registerBinder | protected void registerBinder(ResourceConfig configuration) {
"""
<p>registerBinder.</p>
@param configuration a {@link org.glassfish.jersey.server.ResourceConfig} object.
@since 0.1.6e
"""
configuration.register(new AbstractBinder() {
@Override
protected void configure() {
bind(Container.this).to(Container.class).proxy(false);
}
});
configuration.registerInstances(new ContainerLifecycleListener() {
@Override
public void onStartup(org.glassfish.jersey.server.spi.Container container) {
SystemEventBus.publish(new StartupEvent(Container.this, application));
logger.trace(Messages.get("info.container.startup"));
}
@Override
public void onReload(org.glassfish.jersey.server.spi.Container container) {
SystemEventBus.publish(new ReloadedEvent(Container.this, application));
logger.trace(Messages.get("info.container.reload"));
}
@Override
public void onShutdown(org.glassfish.jersey.server.spi.Container container) {
logger.info("Container onShutdown");
SystemEventBus.publish(new ShutdownEvent(Container.this, application));
logger.trace(Messages.get("info.container.shutdown"));
}
});
} | java | protected void registerBinder(ResourceConfig configuration) {
configuration.register(new AbstractBinder() {
@Override
protected void configure() {
bind(Container.this).to(Container.class).proxy(false);
}
});
configuration.registerInstances(new ContainerLifecycleListener() {
@Override
public void onStartup(org.glassfish.jersey.server.spi.Container container) {
SystemEventBus.publish(new StartupEvent(Container.this, application));
logger.trace(Messages.get("info.container.startup"));
}
@Override
public void onReload(org.glassfish.jersey.server.spi.Container container) {
SystemEventBus.publish(new ReloadedEvent(Container.this, application));
logger.trace(Messages.get("info.container.reload"));
}
@Override
public void onShutdown(org.glassfish.jersey.server.spi.Container container) {
logger.info("Container onShutdown");
SystemEventBus.publish(new ShutdownEvent(Container.this, application));
logger.trace(Messages.get("info.container.shutdown"));
}
});
} | [
"protected",
"void",
"registerBinder",
"(",
"ResourceConfig",
"configuration",
")",
"{",
"configuration",
".",
"register",
"(",
"new",
"AbstractBinder",
"(",
")",
"{",
"@",
"Override",
"protected",
"void",
"configure",
"(",
")",
"{",
"bind",
"(",
"Container",
".",
"this",
")",
".",
"to",
"(",
"Container",
".",
"class",
")",
".",
"proxy",
"(",
"false",
")",
";",
"}",
"}",
")",
";",
"configuration",
".",
"registerInstances",
"(",
"new",
"ContainerLifecycleListener",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"onStartup",
"(",
"org",
".",
"glassfish",
".",
"jersey",
".",
"server",
".",
"spi",
".",
"Container",
"container",
")",
"{",
"SystemEventBus",
".",
"publish",
"(",
"new",
"StartupEvent",
"(",
"Container",
".",
"this",
",",
"application",
")",
")",
";",
"logger",
".",
"trace",
"(",
"Messages",
".",
"get",
"(",
"\"info.container.startup\"",
")",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"onReload",
"(",
"org",
".",
"glassfish",
".",
"jersey",
".",
"server",
".",
"spi",
".",
"Container",
"container",
")",
"{",
"SystemEventBus",
".",
"publish",
"(",
"new",
"ReloadedEvent",
"(",
"Container",
".",
"this",
",",
"application",
")",
")",
";",
"logger",
".",
"trace",
"(",
"Messages",
".",
"get",
"(",
"\"info.container.reload\"",
")",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"onShutdown",
"(",
"org",
".",
"glassfish",
".",
"jersey",
".",
"server",
".",
"spi",
".",
"Container",
"container",
")",
"{",
"logger",
".",
"info",
"(",
"\"Container onShutdown\"",
")",
";",
"SystemEventBus",
".",
"publish",
"(",
"new",
"ShutdownEvent",
"(",
"Container",
".",
"this",
",",
"application",
")",
")",
";",
"logger",
".",
"trace",
"(",
"Messages",
".",
"get",
"(",
"\"info.container.shutdown\"",
")",
")",
";",
"}",
"}",
")",
";",
"}"
] | <p>registerBinder.</p>
@param configuration a {@link org.glassfish.jersey.server.ResourceConfig} object.
@since 0.1.6e | [
"<p",
">",
"registerBinder",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/icode/ameba/blob/9d4956e935898e41331b2745e400ef869cd265e0/src/main/java/ameba/container/Container.java#L75-L102 |
dropbox/dropbox-sdk-java | src/main/java/com/dropbox/core/v1/DbxClientV1.java | DbxClientV1.chunkedUploadAppend | public long chunkedUploadAppend(String uploadId, long uploadOffset, byte[] data, int dataOffset, int dataLength)
throws DbxException {
"""
Append data to a chunked upload session.
@param uploadId
The identifier returned by {@link #chunkedUploadFirst} to identify the chunked upload
session.
@param uploadOffset
The current number of bytes uploaded to the chunked upload session. The server checks
this value to make sure it is correct. If it is correct, the contents of {@code data}
is appended and -1 is returned. If it is incorrect, the correct offset is returned.
@param data
The data to append.
@param dataOffset
The start offset in {@code data} to read from.
@param dataLength
The number of bytes to read from {@code data}, starting from {@code dataOffset}.
@return
If everything goes correctly, returns {@code -1}. If the given {@code offset} didn't
match the actual number of bytes in the chunked upload session, returns the correct
number of bytes.
"""
return chunkedUploadAppend(uploadId, uploadOffset, dataLength, new DbxStreamWriter.ByteArrayCopier(data, dataOffset, dataLength));
} | java | public long chunkedUploadAppend(String uploadId, long uploadOffset, byte[] data, int dataOffset, int dataLength)
throws DbxException
{
return chunkedUploadAppend(uploadId, uploadOffset, dataLength, new DbxStreamWriter.ByteArrayCopier(data, dataOffset, dataLength));
} | [
"public",
"long",
"chunkedUploadAppend",
"(",
"String",
"uploadId",
",",
"long",
"uploadOffset",
",",
"byte",
"[",
"]",
"data",
",",
"int",
"dataOffset",
",",
"int",
"dataLength",
")",
"throws",
"DbxException",
"{",
"return",
"chunkedUploadAppend",
"(",
"uploadId",
",",
"uploadOffset",
",",
"dataLength",
",",
"new",
"DbxStreamWriter",
".",
"ByteArrayCopier",
"(",
"data",
",",
"dataOffset",
",",
"dataLength",
")",
")",
";",
"}"
] | Append data to a chunked upload session.
@param uploadId
The identifier returned by {@link #chunkedUploadFirst} to identify the chunked upload
session.
@param uploadOffset
The current number of bytes uploaded to the chunked upload session. The server checks
this value to make sure it is correct. If it is correct, the contents of {@code data}
is appended and -1 is returned. If it is incorrect, the correct offset is returned.
@param data
The data to append.
@param dataOffset
The start offset in {@code data} to read from.
@param dataLength
The number of bytes to read from {@code data}, starting from {@code dataOffset}.
@return
If everything goes correctly, returns {@code -1}. If the given {@code offset} didn't
match the actual number of bytes in the chunked upload session, returns the correct
number of bytes. | [
"Append",
"data",
"to",
"a",
"chunked",
"upload",
"session",
"."
] | train | https://github.com/dropbox/dropbox-sdk-java/blob/d86157005fad6233c18b4b0f10f00b8d9d56ae92/src/main/java/com/dropbox/core/v1/DbxClientV1.java#L1103-L1107 |
mongodb/stitch-android-sdk | server/core/src/main/java/com/mongodb/stitch/server/core/auth/providers/userpassword/internal/UserPasswordAuthProviderClientImpl.java | UserPasswordAuthProviderClientImpl.resetPassword | public void resetPassword(final String token, final String tokenId, final String password) {
"""
Resets the password of a user with the given token, token id, and new password.
@param token the reset password token.
@param tokenId the id of the reset password token.
@param password the new password for the user. The password must be between
6 and 128 characters long.
"""
resetPasswordInternal(token, tokenId, password);
} | java | public void resetPassword(final String token, final String tokenId, final String password) {
resetPasswordInternal(token, tokenId, password);
} | [
"public",
"void",
"resetPassword",
"(",
"final",
"String",
"token",
",",
"final",
"String",
"tokenId",
",",
"final",
"String",
"password",
")",
"{",
"resetPasswordInternal",
"(",
"token",
",",
"tokenId",
",",
"password",
")",
";",
"}"
] | Resets the password of a user with the given token, token id, and new password.
@param token the reset password token.
@param tokenId the id of the reset password token.
@param password the new password for the user. The password must be between
6 and 128 characters long. | [
"Resets",
"the",
"password",
"of",
"a",
"user",
"with",
"the",
"given",
"token",
"token",
"id",
"and",
"new",
"password",
"."
] | train | https://github.com/mongodb/stitch-android-sdk/blob/159b9334b1f1a827285544be5ee20cdf7b04e4cc/server/core/src/main/java/com/mongodb/stitch/server/core/auth/providers/userpassword/internal/UserPasswordAuthProviderClientImpl.java#L82-L84 |
pf4j/pf4j-update | src/main/java/org/pf4j/update/UpdateManager.java | UpdateManager.installPlugin | public synchronized boolean installPlugin(String id, String version) throws PluginException {
"""
Installs a plugin by id and version.
@param id the id of plugin to install
@param version the version of plugin to install, on SemVer format, or null for latest
@return true if installation successful and plugin started
@exception PluginException if plugin does not exist in repos or problems during
"""
// Download to temporary location
Path downloaded = downloadPlugin(id, version);
Path pluginsRoot = pluginManager.getPluginsRoot();
Path file = pluginsRoot.resolve(downloaded.getFileName());
try {
Files.move(downloaded, file);
} catch (IOException e) {
throw new PluginException(e, "Failed to write file '{}' to plugins folder", file);
}
String pluginId = pluginManager.loadPlugin(file);
PluginState state = pluginManager.startPlugin(pluginId);
return PluginState.STARTED.equals(state);
} | java | public synchronized boolean installPlugin(String id, String version) throws PluginException {
// Download to temporary location
Path downloaded = downloadPlugin(id, version);
Path pluginsRoot = pluginManager.getPluginsRoot();
Path file = pluginsRoot.resolve(downloaded.getFileName());
try {
Files.move(downloaded, file);
} catch (IOException e) {
throw new PluginException(e, "Failed to write file '{}' to plugins folder", file);
}
String pluginId = pluginManager.loadPlugin(file);
PluginState state = pluginManager.startPlugin(pluginId);
return PluginState.STARTED.equals(state);
} | [
"public",
"synchronized",
"boolean",
"installPlugin",
"(",
"String",
"id",
",",
"String",
"version",
")",
"throws",
"PluginException",
"{",
"// Download to temporary location",
"Path",
"downloaded",
"=",
"downloadPlugin",
"(",
"id",
",",
"version",
")",
";",
"Path",
"pluginsRoot",
"=",
"pluginManager",
".",
"getPluginsRoot",
"(",
")",
";",
"Path",
"file",
"=",
"pluginsRoot",
".",
"resolve",
"(",
"downloaded",
".",
"getFileName",
"(",
")",
")",
";",
"try",
"{",
"Files",
".",
"move",
"(",
"downloaded",
",",
"file",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"PluginException",
"(",
"e",
",",
"\"Failed to write file '{}' to plugins folder\"",
",",
"file",
")",
";",
"}",
"String",
"pluginId",
"=",
"pluginManager",
".",
"loadPlugin",
"(",
"file",
")",
";",
"PluginState",
"state",
"=",
"pluginManager",
".",
"startPlugin",
"(",
"pluginId",
")",
";",
"return",
"PluginState",
".",
"STARTED",
".",
"equals",
"(",
"state",
")",
";",
"}"
] | Installs a plugin by id and version.
@param id the id of plugin to install
@param version the version of plugin to install, on SemVer format, or null for latest
@return true if installation successful and plugin started
@exception PluginException if plugin does not exist in repos or problems during | [
"Installs",
"a",
"plugin",
"by",
"id",
"and",
"version",
"."
] | train | https://github.com/pf4j/pf4j-update/blob/80cf04b8f2790808d0cf9dff3602dc5d730ac979/src/main/java/org/pf4j/update/UpdateManager.java#L232-L248 |
opencb/biodata | biodata-tools/src/main/java/org/opencb/biodata/tools/variant/metadata/VariantMetadataManager.java | VariantMetadataManager.removeCohort | public void removeCohort(Cohort cohort, String studyId) {
"""
Remove a cohort of a given variant study metadata (from study ID).
@param cohort Cohort
@param studyId Study ID
"""
// Sanity check
if (cohort == null) {
logger.error("Cohort is null.");
return;
}
removeCohort(cohort.getId(), studyId);
} | java | public void removeCohort(Cohort cohort, String studyId) {
// Sanity check
if (cohort == null) {
logger.error("Cohort is null.");
return;
}
removeCohort(cohort.getId(), studyId);
} | [
"public",
"void",
"removeCohort",
"(",
"Cohort",
"cohort",
",",
"String",
"studyId",
")",
"{",
"// Sanity check",
"if",
"(",
"cohort",
"==",
"null",
")",
"{",
"logger",
".",
"error",
"(",
"\"Cohort is null.\"",
")",
";",
"return",
";",
"}",
"removeCohort",
"(",
"cohort",
".",
"getId",
"(",
")",
",",
"studyId",
")",
";",
"}"
] | Remove a cohort of a given variant study metadata (from study ID).
@param cohort Cohort
@param studyId Study ID | [
"Remove",
"a",
"cohort",
"of",
"a",
"given",
"variant",
"study",
"metadata",
"(",
"from",
"study",
"ID",
")",
"."
] | train | https://github.com/opencb/biodata/blob/21b3d51d71f578efab908422aca4bab7a73097b1/biodata-tools/src/main/java/org/opencb/biodata/tools/variant/metadata/VariantMetadataManager.java#L431-L438 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/LocalNetworkGatewaysInner.java | LocalNetworkGatewaysInner.beginCreateOrUpdate | public LocalNetworkGatewayInner beginCreateOrUpdate(String resourceGroupName, String localNetworkGatewayName, LocalNetworkGatewayInner parameters) {
"""
Creates or updates a local network gateway in the specified resource group.
@param resourceGroupName The name of the resource group.
@param localNetworkGatewayName The name of the local network gateway.
@param parameters Parameters supplied to the create or update local network gateway operation.
@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 LocalNetworkGatewayInner object if successful.
"""
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, localNetworkGatewayName, parameters).toBlocking().single().body();
} | java | public LocalNetworkGatewayInner beginCreateOrUpdate(String resourceGroupName, String localNetworkGatewayName, LocalNetworkGatewayInner parameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, localNetworkGatewayName, parameters).toBlocking().single().body();
} | [
"public",
"LocalNetworkGatewayInner",
"beginCreateOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"localNetworkGatewayName",
",",
"LocalNetworkGatewayInner",
"parameters",
")",
"{",
"return",
"beginCreateOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"localNetworkGatewayName",
",",
"parameters",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
] | Creates or updates a local network gateway in the specified resource group.
@param resourceGroupName The name of the resource group.
@param localNetworkGatewayName The name of the local network gateway.
@param parameters Parameters supplied to the create or update local network gateway operation.
@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 LocalNetworkGatewayInner object if successful. | [
"Creates",
"or",
"updates",
"a",
"local",
"network",
"gateway",
"in",
"the",
"specified",
"resource",
"group",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/LocalNetworkGatewaysInner.java#L193-L195 |
Metatavu/edelphi | edelphi/src/main/java/fi/metatavu/edelphi/pages/panel/admin/report/thesis/ThesisTimelineQueryReportPage.java | ThesisTimelineQueryReportPage.createStatistics | private QueryFieldDataStatistics createStatistics(List<Double> data, double min, double max, double step) {
"""
Creates statistics object
@param data data
@param min min
@param max max
@param step step
@return statistics object
"""
Map<Double, String> dataNames = new HashMap<>();
for (double d = min; d <= max; d += step) {
String caption = step % 1 == 0 ? Long.toString(Math.round(d)) : Double.toString(d);
dataNames.put(d, caption);
}
return ReportUtils.getStatistics(data, dataNames);
} | java | private QueryFieldDataStatistics createStatistics(List<Double> data, double min, double max, double step) {
Map<Double, String> dataNames = new HashMap<>();
for (double d = min; d <= max; d += step) {
String caption = step % 1 == 0 ? Long.toString(Math.round(d)) : Double.toString(d);
dataNames.put(d, caption);
}
return ReportUtils.getStatistics(data, dataNames);
} | [
"private",
"QueryFieldDataStatistics",
"createStatistics",
"(",
"List",
"<",
"Double",
">",
"data",
",",
"double",
"min",
",",
"double",
"max",
",",
"double",
"step",
")",
"{",
"Map",
"<",
"Double",
",",
"String",
">",
"dataNames",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"for",
"(",
"double",
"d",
"=",
"min",
";",
"d",
"<=",
"max",
";",
"d",
"+=",
"step",
")",
"{",
"String",
"caption",
"=",
"step",
"%",
"1",
"==",
"0",
"?",
"Long",
".",
"toString",
"(",
"Math",
".",
"round",
"(",
"d",
")",
")",
":",
"Double",
".",
"toString",
"(",
"d",
")",
";",
"dataNames",
".",
"put",
"(",
"d",
",",
"caption",
")",
";",
"}",
"return",
"ReportUtils",
".",
"getStatistics",
"(",
"data",
",",
"dataNames",
")",
";",
"}"
] | Creates statistics object
@param data data
@param min min
@param max max
@param step step
@return statistics object | [
"Creates",
"statistics",
"object"
] | train | https://github.com/Metatavu/edelphi/blob/d91a0b54f954b33b4ee674a1bdf03612d76c3305/edelphi/src/main/java/fi/metatavu/edelphi/pages/panel/admin/report/thesis/ThesisTimelineQueryReportPage.java#L142-L151 |
openengsb/openengsb | components/edbi/jdbc/src/main/java/org/openengsb/core/edbi/jdbc/AbstractTableFactory.java | AbstractTableFactory.onMissingTypeVisit | protected void onMissingTypeVisit(Table table, IndexField<?> field) {
"""
Called when type map returns null.
@param table the table to be created
@param field the field being visited and has no type information
"""
if (!Introspector.isModelClass(field.getType())) {
return;
}
Field idField = Introspector.getOpenEngSBModelIdField(field.getType());
if (idField == null) {
LOG.warn("@Model class {} does not have an @OpenEngSBModelId", field.getType());
return;
}
DataType type = getTypeMap().getType(idField.getType());
if (type == null) {
LOG.warn("@OpenEngSBModelId field {} has an unmapped type {}", field.getName(), field.getType());
return;
}
((JdbcIndexField) field).setMappedType(type);
Column column = new Column(getColumnNameTranslator().translate(field), type);
table.addElement(column); // will hold the models OID
onAfterFieldVisit(table, column, field);
} | java | protected void onMissingTypeVisit(Table table, IndexField<?> field) {
if (!Introspector.isModelClass(field.getType())) {
return;
}
Field idField = Introspector.getOpenEngSBModelIdField(field.getType());
if (idField == null) {
LOG.warn("@Model class {} does not have an @OpenEngSBModelId", field.getType());
return;
}
DataType type = getTypeMap().getType(idField.getType());
if (type == null) {
LOG.warn("@OpenEngSBModelId field {} has an unmapped type {}", field.getName(), field.getType());
return;
}
((JdbcIndexField) field).setMappedType(type);
Column column = new Column(getColumnNameTranslator().translate(field), type);
table.addElement(column); // will hold the models OID
onAfterFieldVisit(table, column, field);
} | [
"protected",
"void",
"onMissingTypeVisit",
"(",
"Table",
"table",
",",
"IndexField",
"<",
"?",
">",
"field",
")",
"{",
"if",
"(",
"!",
"Introspector",
".",
"isModelClass",
"(",
"field",
".",
"getType",
"(",
")",
")",
")",
"{",
"return",
";",
"}",
"Field",
"idField",
"=",
"Introspector",
".",
"getOpenEngSBModelIdField",
"(",
"field",
".",
"getType",
"(",
")",
")",
";",
"if",
"(",
"idField",
"==",
"null",
")",
"{",
"LOG",
".",
"warn",
"(",
"\"@Model class {} does not have an @OpenEngSBModelId\"",
",",
"field",
".",
"getType",
"(",
")",
")",
";",
"return",
";",
"}",
"DataType",
"type",
"=",
"getTypeMap",
"(",
")",
".",
"getType",
"(",
"idField",
".",
"getType",
"(",
")",
")",
";",
"if",
"(",
"type",
"==",
"null",
")",
"{",
"LOG",
".",
"warn",
"(",
"\"@OpenEngSBModelId field {} has an unmapped type {}\"",
",",
"field",
".",
"getName",
"(",
")",
",",
"field",
".",
"getType",
"(",
")",
")",
";",
"return",
";",
"}",
"(",
"(",
"JdbcIndexField",
")",
"field",
")",
".",
"setMappedType",
"(",
"type",
")",
";",
"Column",
"column",
"=",
"new",
"Column",
"(",
"getColumnNameTranslator",
"(",
")",
".",
"translate",
"(",
"field",
")",
",",
"type",
")",
";",
"table",
".",
"addElement",
"(",
"column",
")",
";",
"// will hold the models OID",
"onAfterFieldVisit",
"(",
"table",
",",
"column",
",",
"field",
")",
";",
"}"
] | Called when type map returns null.
@param table the table to be created
@param field the field being visited and has no type information | [
"Called",
"when",
"type",
"map",
"returns",
"null",
"."
] | train | https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/components/edbi/jdbc/src/main/java/org/openengsb/core/edbi/jdbc/AbstractTableFactory.java#L98-L123 |
lastaflute/lastaflute | src/main/java/org/lastaflute/core/magic/ThreadCacheContext.java | ThreadCacheContext.setObject | public static void setObject(String key, Object value) {
"""
Set the value of the object.
@param key The key of the object. (NotNull)
@param value The value of the object. (NullAllowed)
"""
if (!exists()) {
throwThreadCacheNotInitializedException(key);
}
threadLocal.get().put(key, value);
} | java | public static void setObject(String key, Object value) {
if (!exists()) {
throwThreadCacheNotInitializedException(key);
}
threadLocal.get().put(key, value);
} | [
"public",
"static",
"void",
"setObject",
"(",
"String",
"key",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"!",
"exists",
"(",
")",
")",
"{",
"throwThreadCacheNotInitializedException",
"(",
"key",
")",
";",
"}",
"threadLocal",
".",
"get",
"(",
")",
".",
"put",
"(",
"key",
",",
"value",
")",
";",
"}"
] | Set the value of the object.
@param key The key of the object. (NotNull)
@param value The value of the object. (NullAllowed) | [
"Set",
"the",
"value",
"of",
"the",
"object",
"."
] | train | https://github.com/lastaflute/lastaflute/blob/17b56dda8322e4c6d79043532c1dda917d6b60a8/src/main/java/org/lastaflute/core/magic/ThreadCacheContext.java#L146-L151 |
Erudika/para | para-server/src/main/java/com/erudika/para/security/filters/GenericOAuth2Filter.java | GenericOAuth2Filter.attemptAuthentication | @Override
public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response)
throws IOException {
"""
Handles an authentication request.
@param request HTTP request
@param response HTTP response
@return an authentication object that contains the principal object if successful.
@throws IOException ex
"""
final String requestURI = request.getRequestURI();
UserAuthentication userAuth = null;
if (requestURI.endsWith(OAUTH2_ACTION)) {
String authCode = request.getParameter("code");
if (!StringUtils.isBlank(authCode)) {
String appid = SecurityUtils.getAppidFromAuthRequest(request);
String redirectURI = SecurityUtils.getRedirectUrl(request);
App app = Para.getDAO().read(App.id(appid == null ? Config.getRootAppIdentifier() : appid));
String[] keys = SecurityUtils.getOAuthKeysForApp(app, Config.OAUTH2_PREFIX);
String entity = Utils.formatMessage(PAYLOAD,
authCode, Utils.urlEncode(redirectURI),
URLEncoder.encode(SecurityUtils.getSettingForApp(app, "security.oauth.scope", ""), "UTF-8"),
keys[0], keys[1]);
String acceptHeader = SecurityUtils.getSettingForApp(app, "security.oauth.accept_header", "");
HttpPost tokenPost = new HttpPost(SecurityUtils.getSettingForApp(app, "security.oauth.token_url", ""));
tokenPost.setHeader(HttpHeaders.CONTENT_TYPE, "application/x-www-form-urlencoded");
tokenPost.setEntity(new StringEntity(entity, "UTF-8"));
if (!StringUtils.isBlank(acceptHeader)) {
tokenPost.setHeader(HttpHeaders.ACCEPT, acceptHeader);
}
try (CloseableHttpResponse resp1 = httpclient.execute(tokenPost)) {
if (resp1 != null && resp1.getEntity() != null) {
Map<String, Object> token = jreader.readValue(resp1.getEntity().getContent());
if (token != null && token.containsKey("access_token")) {
userAuth = getOrCreateUser(app, (String) token.get("access_token"));
}
EntityUtils.consumeQuietly(resp1.getEntity());
}
}
}
}
return SecurityUtils.checkIfActive(userAuth, SecurityUtils.getAuthenticatedUser(userAuth), true);
} | java | @Override
public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response)
throws IOException {
final String requestURI = request.getRequestURI();
UserAuthentication userAuth = null;
if (requestURI.endsWith(OAUTH2_ACTION)) {
String authCode = request.getParameter("code");
if (!StringUtils.isBlank(authCode)) {
String appid = SecurityUtils.getAppidFromAuthRequest(request);
String redirectURI = SecurityUtils.getRedirectUrl(request);
App app = Para.getDAO().read(App.id(appid == null ? Config.getRootAppIdentifier() : appid));
String[] keys = SecurityUtils.getOAuthKeysForApp(app, Config.OAUTH2_PREFIX);
String entity = Utils.formatMessage(PAYLOAD,
authCode, Utils.urlEncode(redirectURI),
URLEncoder.encode(SecurityUtils.getSettingForApp(app, "security.oauth.scope", ""), "UTF-8"),
keys[0], keys[1]);
String acceptHeader = SecurityUtils.getSettingForApp(app, "security.oauth.accept_header", "");
HttpPost tokenPost = new HttpPost(SecurityUtils.getSettingForApp(app, "security.oauth.token_url", ""));
tokenPost.setHeader(HttpHeaders.CONTENT_TYPE, "application/x-www-form-urlencoded");
tokenPost.setEntity(new StringEntity(entity, "UTF-8"));
if (!StringUtils.isBlank(acceptHeader)) {
tokenPost.setHeader(HttpHeaders.ACCEPT, acceptHeader);
}
try (CloseableHttpResponse resp1 = httpclient.execute(tokenPost)) {
if (resp1 != null && resp1.getEntity() != null) {
Map<String, Object> token = jreader.readValue(resp1.getEntity().getContent());
if (token != null && token.containsKey("access_token")) {
userAuth = getOrCreateUser(app, (String) token.get("access_token"));
}
EntityUtils.consumeQuietly(resp1.getEntity());
}
}
}
}
return SecurityUtils.checkIfActive(userAuth, SecurityUtils.getAuthenticatedUser(userAuth), true);
} | [
"@",
"Override",
"public",
"Authentication",
"attemptAuthentication",
"(",
"HttpServletRequest",
"request",
",",
"HttpServletResponse",
"response",
")",
"throws",
"IOException",
"{",
"final",
"String",
"requestURI",
"=",
"request",
".",
"getRequestURI",
"(",
")",
";",
"UserAuthentication",
"userAuth",
"=",
"null",
";",
"if",
"(",
"requestURI",
".",
"endsWith",
"(",
"OAUTH2_ACTION",
")",
")",
"{",
"String",
"authCode",
"=",
"request",
".",
"getParameter",
"(",
"\"code\"",
")",
";",
"if",
"(",
"!",
"StringUtils",
".",
"isBlank",
"(",
"authCode",
")",
")",
"{",
"String",
"appid",
"=",
"SecurityUtils",
".",
"getAppidFromAuthRequest",
"(",
"request",
")",
";",
"String",
"redirectURI",
"=",
"SecurityUtils",
".",
"getRedirectUrl",
"(",
"request",
")",
";",
"App",
"app",
"=",
"Para",
".",
"getDAO",
"(",
")",
".",
"read",
"(",
"App",
".",
"id",
"(",
"appid",
"==",
"null",
"?",
"Config",
".",
"getRootAppIdentifier",
"(",
")",
":",
"appid",
")",
")",
";",
"String",
"[",
"]",
"keys",
"=",
"SecurityUtils",
".",
"getOAuthKeysForApp",
"(",
"app",
",",
"Config",
".",
"OAUTH2_PREFIX",
")",
";",
"String",
"entity",
"=",
"Utils",
".",
"formatMessage",
"(",
"PAYLOAD",
",",
"authCode",
",",
"Utils",
".",
"urlEncode",
"(",
"redirectURI",
")",
",",
"URLEncoder",
".",
"encode",
"(",
"SecurityUtils",
".",
"getSettingForApp",
"(",
"app",
",",
"\"security.oauth.scope\"",
",",
"\"\"",
")",
",",
"\"UTF-8\"",
")",
",",
"keys",
"[",
"0",
"]",
",",
"keys",
"[",
"1",
"]",
")",
";",
"String",
"acceptHeader",
"=",
"SecurityUtils",
".",
"getSettingForApp",
"(",
"app",
",",
"\"security.oauth.accept_header\"",
",",
"\"\"",
")",
";",
"HttpPost",
"tokenPost",
"=",
"new",
"HttpPost",
"(",
"SecurityUtils",
".",
"getSettingForApp",
"(",
"app",
",",
"\"security.oauth.token_url\"",
",",
"\"\"",
")",
")",
";",
"tokenPost",
".",
"setHeader",
"(",
"HttpHeaders",
".",
"CONTENT_TYPE",
",",
"\"application/x-www-form-urlencoded\"",
")",
";",
"tokenPost",
".",
"setEntity",
"(",
"new",
"StringEntity",
"(",
"entity",
",",
"\"UTF-8\"",
")",
")",
";",
"if",
"(",
"!",
"StringUtils",
".",
"isBlank",
"(",
"acceptHeader",
")",
")",
"{",
"tokenPost",
".",
"setHeader",
"(",
"HttpHeaders",
".",
"ACCEPT",
",",
"acceptHeader",
")",
";",
"}",
"try",
"(",
"CloseableHttpResponse",
"resp1",
"=",
"httpclient",
".",
"execute",
"(",
"tokenPost",
")",
")",
"{",
"if",
"(",
"resp1",
"!=",
"null",
"&&",
"resp1",
".",
"getEntity",
"(",
")",
"!=",
"null",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"token",
"=",
"jreader",
".",
"readValue",
"(",
"resp1",
".",
"getEntity",
"(",
")",
".",
"getContent",
"(",
")",
")",
";",
"if",
"(",
"token",
"!=",
"null",
"&&",
"token",
".",
"containsKey",
"(",
"\"access_token\"",
")",
")",
"{",
"userAuth",
"=",
"getOrCreateUser",
"(",
"app",
",",
"(",
"String",
")",
"token",
".",
"get",
"(",
"\"access_token\"",
")",
")",
";",
"}",
"EntityUtils",
".",
"consumeQuietly",
"(",
"resp1",
".",
"getEntity",
"(",
")",
")",
";",
"}",
"}",
"}",
"}",
"return",
"SecurityUtils",
".",
"checkIfActive",
"(",
"userAuth",
",",
"SecurityUtils",
".",
"getAuthenticatedUser",
"(",
"userAuth",
")",
",",
"true",
")",
";",
"}"
] | Handles an authentication request.
@param request HTTP request
@param response HTTP response
@return an authentication object that contains the principal object if successful.
@throws IOException ex | [
"Handles",
"an",
"authentication",
"request",
"."
] | train | https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-server/src/main/java/com/erudika/para/security/filters/GenericOAuth2Filter.java#L94-L133 |
liferay/com-liferay-commerce | commerce-product-type-grouped-service/src/main/java/com/liferay/commerce/product/type/grouped/service/persistence/impl/CPDefinitionGroupedEntryPersistenceImpl.java | CPDefinitionGroupedEntryPersistenceImpl.removeByUuid_C | @Override
public void removeByUuid_C(String uuid, long companyId) {
"""
Removes all the cp definition grouped entries where uuid = ? and companyId = ? from the database.
@param uuid the uuid
@param companyId the company ID
"""
for (CPDefinitionGroupedEntry cpDefinitionGroupedEntry : findByUuid_C(
uuid, companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
remove(cpDefinitionGroupedEntry);
}
} | java | @Override
public void removeByUuid_C(String uuid, long companyId) {
for (CPDefinitionGroupedEntry cpDefinitionGroupedEntry : findByUuid_C(
uuid, companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
remove(cpDefinitionGroupedEntry);
}
} | [
"@",
"Override",
"public",
"void",
"removeByUuid_C",
"(",
"String",
"uuid",
",",
"long",
"companyId",
")",
"{",
"for",
"(",
"CPDefinitionGroupedEntry",
"cpDefinitionGroupedEntry",
":",
"findByUuid_C",
"(",
"uuid",
",",
"companyId",
",",
"QueryUtil",
".",
"ALL_POS",
",",
"QueryUtil",
".",
"ALL_POS",
",",
"null",
")",
")",
"{",
"remove",
"(",
"cpDefinitionGroupedEntry",
")",
";",
"}",
"}"
] | Removes all the cp definition grouped entries where uuid = ? and companyId = ? from the database.
@param uuid the uuid
@param companyId the company ID | [
"Removes",
"all",
"the",
"cp",
"definition",
"grouped",
"entries",
"where",
"uuid",
"=",
"?",
";",
"and",
"companyId",
"=",
"?",
";",
"from",
"the",
"database",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-type-grouped-service/src/main/java/com/liferay/commerce/product/type/grouped/service/persistence/impl/CPDefinitionGroupedEntryPersistenceImpl.java#L1418-L1424 |
canoo/dolphin-platform | platform/dolphin-platform-remoting-server/src/main/java/com/canoo/dp/impl/server/legacy/ServerModelStore.java | ServerModelStore.presentationModel | public ServerPresentationModel presentationModel(final String id, final String presentationModelType, final DTO dto) {
"""
Create a presentation model on the server side, add it to the model store, and withContent a command to
the client, advising him to do the same.
@throws IllegalArgumentException if a presentation model for this id already exists. No commands are sent in this case.
"""
List<ServerAttribute> attributes = new ArrayList<ServerAttribute>();
for (final Slot slot : dto.getSlots()) {
final ServerAttribute result = new ServerAttribute(slot.getPropertyName(), slot.getValue(), slot.getQualifier());
result.silently(new Runnable() {
@Override
public void run() {
result.setValue(slot.getValue());
}
});
attributes.add(result);
}
ServerPresentationModel model = new ServerPresentationModel(id, attributes, this);
model.setPresentationModelType(presentationModelType);
add(model);
return model;
} | java | public ServerPresentationModel presentationModel(final String id, final String presentationModelType, final DTO dto) {
List<ServerAttribute> attributes = new ArrayList<ServerAttribute>();
for (final Slot slot : dto.getSlots()) {
final ServerAttribute result = new ServerAttribute(slot.getPropertyName(), slot.getValue(), slot.getQualifier());
result.silently(new Runnable() {
@Override
public void run() {
result.setValue(slot.getValue());
}
});
attributes.add(result);
}
ServerPresentationModel model = new ServerPresentationModel(id, attributes, this);
model.setPresentationModelType(presentationModelType);
add(model);
return model;
} | [
"public",
"ServerPresentationModel",
"presentationModel",
"(",
"final",
"String",
"id",
",",
"final",
"String",
"presentationModelType",
",",
"final",
"DTO",
"dto",
")",
"{",
"List",
"<",
"ServerAttribute",
">",
"attributes",
"=",
"new",
"ArrayList",
"<",
"ServerAttribute",
">",
"(",
")",
";",
"for",
"(",
"final",
"Slot",
"slot",
":",
"dto",
".",
"getSlots",
"(",
")",
")",
"{",
"final",
"ServerAttribute",
"result",
"=",
"new",
"ServerAttribute",
"(",
"slot",
".",
"getPropertyName",
"(",
")",
",",
"slot",
".",
"getValue",
"(",
")",
",",
"slot",
".",
"getQualifier",
"(",
")",
")",
";",
"result",
".",
"silently",
"(",
"new",
"Runnable",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"run",
"(",
")",
"{",
"result",
".",
"setValue",
"(",
"slot",
".",
"getValue",
"(",
")",
")",
";",
"}",
"}",
")",
";",
"attributes",
".",
"add",
"(",
"result",
")",
";",
"}",
"ServerPresentationModel",
"model",
"=",
"new",
"ServerPresentationModel",
"(",
"id",
",",
"attributes",
",",
"this",
")",
";",
"model",
".",
"setPresentationModelType",
"(",
"presentationModelType",
")",
";",
"add",
"(",
"model",
")",
";",
"return",
"model",
";",
"}"
] | Create a presentation model on the server side, add it to the model store, and withContent a command to
the client, advising him to do the same.
@throws IllegalArgumentException if a presentation model for this id already exists. No commands are sent in this case. | [
"Create",
"a",
"presentation",
"model",
"on",
"the",
"server",
"side",
"add",
"it",
"to",
"the",
"model",
"store",
"and",
"withContent",
"a",
"command",
"to",
"the",
"client",
"advising",
"him",
"to",
"do",
"the",
"same",
"."
] | train | https://github.com/canoo/dolphin-platform/blob/fb99c1fab24df80d2fa094d8688b546140146874/platform/dolphin-platform-remoting-server/src/main/java/com/canoo/dp/impl/server/legacy/ServerModelStore.java#L205-L222 |
bazaarvoice/emodb | databus-client-common/src/main/java/com/bazaarvoice/emodb/databus/client/DatabusClient.java | DatabusClient.getMoveStatus | @Override
public MoveSubscriptionStatus getMoveStatus(String apiKey, String reference) {
"""
Any server can get the move status, no need for @PartitionKey
"""
checkNotNull(reference, "reference");
try {
URI uri = _databus.clone()
.segment("_move")
.segment(reference)
.build();
return _client.resource(uri)
.header(ApiKeyRequest.AUTHENTICATION_HEADER, apiKey)
.get(MoveSubscriptionStatus.class);
} catch (EmoClientException e) {
throw convertException(e);
}
} | java | @Override
public MoveSubscriptionStatus getMoveStatus(String apiKey, String reference) {
checkNotNull(reference, "reference");
try {
URI uri = _databus.clone()
.segment("_move")
.segment(reference)
.build();
return _client.resource(uri)
.header(ApiKeyRequest.AUTHENTICATION_HEADER, apiKey)
.get(MoveSubscriptionStatus.class);
} catch (EmoClientException e) {
throw convertException(e);
}
} | [
"@",
"Override",
"public",
"MoveSubscriptionStatus",
"getMoveStatus",
"(",
"String",
"apiKey",
",",
"String",
"reference",
")",
"{",
"checkNotNull",
"(",
"reference",
",",
"\"reference\"",
")",
";",
"try",
"{",
"URI",
"uri",
"=",
"_databus",
".",
"clone",
"(",
")",
".",
"segment",
"(",
"\"_move\"",
")",
".",
"segment",
"(",
"reference",
")",
".",
"build",
"(",
")",
";",
"return",
"_client",
".",
"resource",
"(",
"uri",
")",
".",
"header",
"(",
"ApiKeyRequest",
".",
"AUTHENTICATION_HEADER",
",",
"apiKey",
")",
".",
"get",
"(",
"MoveSubscriptionStatus",
".",
"class",
")",
";",
"}",
"catch",
"(",
"EmoClientException",
"e",
")",
"{",
"throw",
"convertException",
"(",
"e",
")",
";",
"}",
"}"
] | Any server can get the move status, no need for @PartitionKey | [
"Any",
"server",
"can",
"get",
"the",
"move",
"status",
"no",
"need",
"for"
] | train | https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/databus-client-common/src/main/java/com/bazaarvoice/emodb/databus/client/DatabusClient.java#L352-L366 |
algolia/algoliasearch-client-java | src/main/java/com/algolia/search/saas/Index.java | Index.deleteBy | public JSONObject deleteBy(Query query, RequestOptions requestOptions) throws AlgoliaException {
"""
Delete all objects matching a query
@param query the query string
@param requestOptions Options to pass to this request
"""
String paramsString = query.getQueryString();
JSONObject body = new JSONObject();
try {
body.put("params", paramsString);
} catch (JSONException e) {
throw new RuntimeException(e);
}
return client.postRequest("/1/indexes/" + encodedIndexName + "/deleteByQuery", body.toString(), false, false, requestOptions);
} | java | public JSONObject deleteBy(Query query, RequestOptions requestOptions) throws AlgoliaException {
String paramsString = query.getQueryString();
JSONObject body = new JSONObject();
try {
body.put("params", paramsString);
} catch (JSONException e) {
throw new RuntimeException(e);
}
return client.postRequest("/1/indexes/" + encodedIndexName + "/deleteByQuery", body.toString(), false, false, requestOptions);
} | [
"public",
"JSONObject",
"deleteBy",
"(",
"Query",
"query",
",",
"RequestOptions",
"requestOptions",
")",
"throws",
"AlgoliaException",
"{",
"String",
"paramsString",
"=",
"query",
".",
"getQueryString",
"(",
")",
";",
"JSONObject",
"body",
"=",
"new",
"JSONObject",
"(",
")",
";",
"try",
"{",
"body",
".",
"put",
"(",
"\"params\"",
",",
"paramsString",
")",
";",
"}",
"catch",
"(",
"JSONException",
"e",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"e",
")",
";",
"}",
"return",
"client",
".",
"postRequest",
"(",
"\"/1/indexes/\"",
"+",
"encodedIndexName",
"+",
"\"/deleteByQuery\"",
",",
"body",
".",
"toString",
"(",
")",
",",
"false",
",",
"false",
",",
"requestOptions",
")",
";",
"}"
] | Delete all objects matching a query
@param query the query string
@param requestOptions Options to pass to this request | [
"Delete",
"all",
"objects",
"matching",
"a",
"query"
] | train | https://github.com/algolia/algoliasearch-client-java/blob/a05da2f66c099fe6f77295c7b6a8a12c24e95f9b/src/main/java/com/algolia/search/saas/Index.java#L599-L608 |
aws/aws-sdk-java | aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/model/Get.java | Get.withKey | public Get withKey(java.util.Map<String, AttributeValue> key) {
"""
<p>
A map of attribute names to <code>AttributeValue</code> objects that specifies the primary key of the item to
retrieve.
</p>
@param key
A map of attribute names to <code>AttributeValue</code> objects that specifies the primary key of the item
to retrieve.
@return Returns a reference to this object so that method calls can be chained together.
"""
setKey(key);
return this;
} | java | public Get withKey(java.util.Map<String, AttributeValue> key) {
setKey(key);
return this;
} | [
"public",
"Get",
"withKey",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"AttributeValue",
">",
"key",
")",
"{",
"setKey",
"(",
"key",
")",
";",
"return",
"this",
";",
"}"
] | <p>
A map of attribute names to <code>AttributeValue</code> objects that specifies the primary key of the item to
retrieve.
</p>
@param key
A map of attribute names to <code>AttributeValue</code> objects that specifies the primary key of the item
to retrieve.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"A",
"map",
"of",
"attribute",
"names",
"to",
"<code",
">",
"AttributeValue<",
"/",
"code",
">",
"objects",
"that",
"specifies",
"the",
"primary",
"key",
"of",
"the",
"item",
"to",
"retrieve",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/model/Get.java#L99-L102 |
ironjacamar/ironjacamar | codegenerator/src/main/java/org/ironjacamar/codegenerator/code/McCodeGen.java | McCodeGen.writeImport | @Override
public void writeImport(Definition def, Writer out) throws IOException {
"""
Output class import
@param def definition
@param out Writer
@throws IOException ioException
"""
out.write("package " + def.getRaPackage() + ";\n\n");
if (def.isSupportEis())
{
out.write("import java.io.IOException;\n");
}
out.write("import java.io.PrintWriter;\n");
if (def.isSupportEis())
{
out.write("import java.net.Socket;\n");
}
out.write("import java.util.ArrayList;\n");
out.write("import java.util.Collections;\n");
out.write("import java.util.HashSet;\n");
out.write("import java.util.List;\n");
out.write("import java.util.Set;\n");
importLogging(def, out);
out.write("import javax.resource.NotSupportedException;\n");
out.write("import javax.resource.ResourceException;\n");
out.write("import javax.resource.spi.ConnectionEvent;\n");
out.write("import javax.resource.spi.ConnectionEventListener;\n");
out.write("import javax.resource.spi.ConnectionRequestInfo;\n");
out.write("import javax.resource.spi.LocalTransaction;\n");
out.write("import javax.resource.spi.ManagedConnection;\n");
out.write("import javax.resource.spi.ManagedConnectionMetaData;\n\n");
out.write("import javax.security.auth.Subject;\n");
out.write("import javax.transaction.xa.XAResource;\n\n");
} | java | @Override
public void writeImport(Definition def, Writer out) throws IOException
{
out.write("package " + def.getRaPackage() + ";\n\n");
if (def.isSupportEis())
{
out.write("import java.io.IOException;\n");
}
out.write("import java.io.PrintWriter;\n");
if (def.isSupportEis())
{
out.write("import java.net.Socket;\n");
}
out.write("import java.util.ArrayList;\n");
out.write("import java.util.Collections;\n");
out.write("import java.util.HashSet;\n");
out.write("import java.util.List;\n");
out.write("import java.util.Set;\n");
importLogging(def, out);
out.write("import javax.resource.NotSupportedException;\n");
out.write("import javax.resource.ResourceException;\n");
out.write("import javax.resource.spi.ConnectionEvent;\n");
out.write("import javax.resource.spi.ConnectionEventListener;\n");
out.write("import javax.resource.spi.ConnectionRequestInfo;\n");
out.write("import javax.resource.spi.LocalTransaction;\n");
out.write("import javax.resource.spi.ManagedConnection;\n");
out.write("import javax.resource.spi.ManagedConnectionMetaData;\n\n");
out.write("import javax.security.auth.Subject;\n");
out.write("import javax.transaction.xa.XAResource;\n\n");
} | [
"@",
"Override",
"public",
"void",
"writeImport",
"(",
"Definition",
"def",
",",
"Writer",
"out",
")",
"throws",
"IOException",
"{",
"out",
".",
"write",
"(",
"\"package \"",
"+",
"def",
".",
"getRaPackage",
"(",
")",
"+",
"\";\\n\\n\"",
")",
";",
"if",
"(",
"def",
".",
"isSupportEis",
"(",
")",
")",
"{",
"out",
".",
"write",
"(",
"\"import java.io.IOException;\\n\"",
")",
";",
"}",
"out",
".",
"write",
"(",
"\"import java.io.PrintWriter;\\n\"",
")",
";",
"if",
"(",
"def",
".",
"isSupportEis",
"(",
")",
")",
"{",
"out",
".",
"write",
"(",
"\"import java.net.Socket;\\n\"",
")",
";",
"}",
"out",
".",
"write",
"(",
"\"import java.util.ArrayList;\\n\"",
")",
";",
"out",
".",
"write",
"(",
"\"import java.util.Collections;\\n\"",
")",
";",
"out",
".",
"write",
"(",
"\"import java.util.HashSet;\\n\"",
")",
";",
"out",
".",
"write",
"(",
"\"import java.util.List;\\n\"",
")",
";",
"out",
".",
"write",
"(",
"\"import java.util.Set;\\n\"",
")",
";",
"importLogging",
"(",
"def",
",",
"out",
")",
";",
"out",
".",
"write",
"(",
"\"import javax.resource.NotSupportedException;\\n\"",
")",
";",
"out",
".",
"write",
"(",
"\"import javax.resource.ResourceException;\\n\"",
")",
";",
"out",
".",
"write",
"(",
"\"import javax.resource.spi.ConnectionEvent;\\n\"",
")",
";",
"out",
".",
"write",
"(",
"\"import javax.resource.spi.ConnectionEventListener;\\n\"",
")",
";",
"out",
".",
"write",
"(",
"\"import javax.resource.spi.ConnectionRequestInfo;\\n\"",
")",
";",
"out",
".",
"write",
"(",
"\"import javax.resource.spi.LocalTransaction;\\n\"",
")",
";",
"out",
".",
"write",
"(",
"\"import javax.resource.spi.ManagedConnection;\\n\"",
")",
";",
"out",
".",
"write",
"(",
"\"import javax.resource.spi.ManagedConnectionMetaData;\\n\\n\"",
")",
";",
"out",
".",
"write",
"(",
"\"import javax.security.auth.Subject;\\n\"",
")",
";",
"out",
".",
"write",
"(",
"\"import javax.transaction.xa.XAResource;\\n\\n\"",
")",
";",
"}"
] | Output class import
@param def definition
@param out Writer
@throws IOException ioException | [
"Output",
"class",
"import"
] | train | https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/codegenerator/src/main/java/org/ironjacamar/codegenerator/code/McCodeGen.java#L131-L163 |
vvakame/JsonPullParser | jsonpullparser-core/src/main/java/net/vvakame/util/jsonpullparser/builder/JsonModelCoder.java | JsonModelCoder.encodeNullToBlank | public void encodeNullToBlank(Writer writer, T obj) throws IOException {
"""
Encodes the given value into the JSON format, and writes it using the given writer.<br>
Writes "{}" if null is given.
@param writer {@link Writer} to be used for writing value
@param obj Value to encoded
@throws IOException
"""
if (obj == null) {
writer.write("{}");
writer.flush();
return;
}
encodeNullToNull(writer, obj);
} | java | public void encodeNullToBlank(Writer writer, T obj) throws IOException {
if (obj == null) {
writer.write("{}");
writer.flush();
return;
}
encodeNullToNull(writer, obj);
} | [
"public",
"void",
"encodeNullToBlank",
"(",
"Writer",
"writer",
",",
"T",
"obj",
")",
"throws",
"IOException",
"{",
"if",
"(",
"obj",
"==",
"null",
")",
"{",
"writer",
".",
"write",
"(",
"\"{}\"",
")",
";",
"writer",
".",
"flush",
"(",
")",
";",
"return",
";",
"}",
"encodeNullToNull",
"(",
"writer",
",",
"obj",
")",
";",
"}"
] | Encodes the given value into the JSON format, and writes it using the given writer.<br>
Writes "{}" if null is given.
@param writer {@link Writer} to be used for writing value
@param obj Value to encoded
@throws IOException | [
"Encodes",
"the",
"given",
"value",
"into",
"the",
"JSON",
"format",
"and",
"writes",
"it",
"using",
"the",
"given",
"writer",
".",
"<br",
">",
"Writes",
"{}",
"if",
"null",
"is",
"given",
"."
] | train | https://github.com/vvakame/JsonPullParser/blob/fce183ca66354723323a77f2ae8cb5222b5836bc/jsonpullparser-core/src/main/java/net/vvakame/util/jsonpullparser/builder/JsonModelCoder.java#L411-L419 |
tvesalainen/util | util/src/main/java/org/vesalainen/ui/Scaler.java | Scaler.getLevelFor | public ScaleLevel getLevelFor(Font font, FontRenderContext frc, DoubleTransform transformer, boolean horizontal, double xy) {
"""
Returns highest level where drawn labels don't overlap
@param font
@param frc
@param transformer
@param horizontal
@param xy Lines constant value
@return
"""
return getLevelFor(font, frc, transformer, horizontal, xy, null);
} | java | public ScaleLevel getLevelFor(Font font, FontRenderContext frc, DoubleTransform transformer, boolean horizontal, double xy)
{
return getLevelFor(font, frc, transformer, horizontal, xy, null);
} | [
"public",
"ScaleLevel",
"getLevelFor",
"(",
"Font",
"font",
",",
"FontRenderContext",
"frc",
",",
"DoubleTransform",
"transformer",
",",
"boolean",
"horizontal",
",",
"double",
"xy",
")",
"{",
"return",
"getLevelFor",
"(",
"font",
",",
"frc",
",",
"transformer",
",",
"horizontal",
",",
"xy",
",",
"null",
")",
";",
"}"
] | Returns highest level where drawn labels don't overlap
@param font
@param frc
@param transformer
@param horizontal
@param xy Lines constant value
@return | [
"Returns",
"highest",
"level",
"where",
"drawn",
"labels",
"don",
"t",
"overlap"
] | train | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/ui/Scaler.java#L160-L163 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/string/StringHelper.java | StringHelper.containsNone | public static boolean containsNone (@Nullable final String sStr, @Nullable final ICharPredicate aFilter) {
"""
Check if the passed {@link String} contains no character matching the
provided filter.
@param sStr
String to check. May be <code>null</code>.
@param aFilter
The filter to use. May be <code>null</code>.
@return <code>true</code> if the filter is <code>null</code> and the string
is empty. <code>true</code> if the filter is not <code>null</code>
and no character of the string matches the filter. <code>false</code>
otherwise.
@since 9.1.7
"""
final int nLen = getLength (sStr);
if (aFilter == null)
return nLen == 0;
if (nLen > 0)
for (final char c : sStr.toCharArray ())
if (aFilter.test (c))
return false;
return true;
} | java | public static boolean containsNone (@Nullable final String sStr, @Nullable final ICharPredicate aFilter)
{
final int nLen = getLength (sStr);
if (aFilter == null)
return nLen == 0;
if (nLen > 0)
for (final char c : sStr.toCharArray ())
if (aFilter.test (c))
return false;
return true;
} | [
"public",
"static",
"boolean",
"containsNone",
"(",
"@",
"Nullable",
"final",
"String",
"sStr",
",",
"@",
"Nullable",
"final",
"ICharPredicate",
"aFilter",
")",
"{",
"final",
"int",
"nLen",
"=",
"getLength",
"(",
"sStr",
")",
";",
"if",
"(",
"aFilter",
"==",
"null",
")",
"return",
"nLen",
"==",
"0",
";",
"if",
"(",
"nLen",
">",
"0",
")",
"for",
"(",
"final",
"char",
"c",
":",
"sStr",
".",
"toCharArray",
"(",
")",
")",
"if",
"(",
"aFilter",
".",
"test",
"(",
"c",
")",
")",
"return",
"false",
";",
"return",
"true",
";",
"}"
] | Check if the passed {@link String} contains no character matching the
provided filter.
@param sStr
String to check. May be <code>null</code>.
@param aFilter
The filter to use. May be <code>null</code>.
@return <code>true</code> if the filter is <code>null</code> and the string
is empty. <code>true</code> if the filter is not <code>null</code>
and no character of the string matches the filter. <code>false</code>
otherwise.
@since 9.1.7 | [
"Check",
"if",
"the",
"passed",
"{",
"@link",
"String",
"}",
"contains",
"no",
"character",
"matching",
"the",
"provided",
"filter",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L284-L295 |
mapfish/mapfish-print | core/src/main/java/org/mapfish/print/processor/http/AddHeadersProcessor.java | AddHeadersProcessor.setHeaders | @SuppressWarnings("unchecked")
public void setHeaders(final Map<String, Object> headers) {
"""
A map of the header key value pairs. Keys are strings and values are either list of strings or a
string.
@param headers the header map
"""
this.headers.clear();
for (Map.Entry<String, Object> entry: headers.entrySet()) {
if (entry.getValue() instanceof List) {
List value = (List) entry.getValue();
// verify they are all strings
for (Object o: value) {
Assert.isTrue(o instanceof String, o + " is not a string it is a: '" +
o.getClass() + "'");
}
this.headers.put(entry.getKey(), (List<String>) entry.getValue());
} else if (entry.getValue() instanceof String) {
final List<String> value = Collections.singletonList((String) entry.getValue());
this.headers.put(entry.getKey(), value);
} else {
throw new IllegalArgumentException("Only strings and list of strings may be headers");
}
}
} | java | @SuppressWarnings("unchecked")
public void setHeaders(final Map<String, Object> headers) {
this.headers.clear();
for (Map.Entry<String, Object> entry: headers.entrySet()) {
if (entry.getValue() instanceof List) {
List value = (List) entry.getValue();
// verify they are all strings
for (Object o: value) {
Assert.isTrue(o instanceof String, o + " is not a string it is a: '" +
o.getClass() + "'");
}
this.headers.put(entry.getKey(), (List<String>) entry.getValue());
} else if (entry.getValue() instanceof String) {
final List<String> value = Collections.singletonList((String) entry.getValue());
this.headers.put(entry.getKey(), value);
} else {
throw new IllegalArgumentException("Only strings and list of strings may be headers");
}
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"void",
"setHeaders",
"(",
"final",
"Map",
"<",
"String",
",",
"Object",
">",
"headers",
")",
"{",
"this",
".",
"headers",
".",
"clear",
"(",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"Object",
">",
"entry",
":",
"headers",
".",
"entrySet",
"(",
")",
")",
"{",
"if",
"(",
"entry",
".",
"getValue",
"(",
")",
"instanceof",
"List",
")",
"{",
"List",
"value",
"=",
"(",
"List",
")",
"entry",
".",
"getValue",
"(",
")",
";",
"// verify they are all strings",
"for",
"(",
"Object",
"o",
":",
"value",
")",
"{",
"Assert",
".",
"isTrue",
"(",
"o",
"instanceof",
"String",
",",
"o",
"+",
"\" is not a string it is a: '\"",
"+",
"o",
".",
"getClass",
"(",
")",
"+",
"\"'\"",
")",
";",
"}",
"this",
".",
"headers",
".",
"put",
"(",
"entry",
".",
"getKey",
"(",
")",
",",
"(",
"List",
"<",
"String",
">",
")",
"entry",
".",
"getValue",
"(",
")",
")",
";",
"}",
"else",
"if",
"(",
"entry",
".",
"getValue",
"(",
")",
"instanceof",
"String",
")",
"{",
"final",
"List",
"<",
"String",
">",
"value",
"=",
"Collections",
".",
"singletonList",
"(",
"(",
"String",
")",
"entry",
".",
"getValue",
"(",
")",
")",
";",
"this",
".",
"headers",
".",
"put",
"(",
"entry",
".",
"getKey",
"(",
")",
",",
"value",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Only strings and list of strings may be headers\"",
")",
";",
"}",
"}",
"}"
] | A map of the header key value pairs. Keys are strings and values are either list of strings or a
string.
@param headers the header map | [
"A",
"map",
"of",
"the",
"header",
"key",
"value",
"pairs",
".",
"Keys",
"are",
"strings",
"and",
"values",
"are",
"either",
"list",
"of",
"strings",
"or",
"a",
"string",
"."
] | train | https://github.com/mapfish/mapfish-print/blob/25a452cb39f592bd8a53b20db1037703898e1e22/core/src/main/java/org/mapfish/print/processor/http/AddHeadersProcessor.java#L66-L85 |
geomajas/geomajas-project-server | impl/src/main/java/org/geomajas/internal/rendering/writer/vml/geometry/PointWriter.java | PointWriter.writeObject | public void writeObject(Object o, GraphicsDocument document, boolean asChild) throws RenderException {
"""
Writes the object to the specified document, optionally creating a child
element. The object in this case should be a point.
@param o the object (of type Point).
@param document the document to write to.
@param asChild create child element if true.
@throws RenderException
"""
document.writeElement("vml:shape", asChild);
Point p = (Point) o;
String adj = document.getFormatter().format(p.getX()) + ","
+ document.getFormatter().format(p.getY());
document.writeAttribute("adj", adj);
} | java | public void writeObject(Object o, GraphicsDocument document, boolean asChild) throws RenderException {
document.writeElement("vml:shape", asChild);
Point p = (Point) o;
String adj = document.getFormatter().format(p.getX()) + ","
+ document.getFormatter().format(p.getY());
document.writeAttribute("adj", adj);
} | [
"public",
"void",
"writeObject",
"(",
"Object",
"o",
",",
"GraphicsDocument",
"document",
",",
"boolean",
"asChild",
")",
"throws",
"RenderException",
"{",
"document",
".",
"writeElement",
"(",
"\"vml:shape\"",
",",
"asChild",
")",
";",
"Point",
"p",
"=",
"(",
"Point",
")",
"o",
";",
"String",
"adj",
"=",
"document",
".",
"getFormatter",
"(",
")",
".",
"format",
"(",
"p",
".",
"getX",
"(",
")",
")",
"+",
"\",\"",
"+",
"document",
".",
"getFormatter",
"(",
")",
".",
"format",
"(",
"p",
".",
"getY",
"(",
")",
")",
";",
"document",
".",
"writeAttribute",
"(",
"\"adj\"",
",",
"adj",
")",
";",
"}"
] | Writes the object to the specified document, optionally creating a child
element. The object in this case should be a point.
@param o the object (of type Point).
@param document the document to write to.
@param asChild create child element if true.
@throws RenderException | [
"Writes",
"the",
"object",
"to",
"the",
"specified",
"document",
"optionally",
"creating",
"a",
"child",
"element",
".",
"The",
"object",
"in",
"this",
"case",
"should",
"be",
"a",
"point",
"."
] | train | https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/impl/src/main/java/org/geomajas/internal/rendering/writer/vml/geometry/PointWriter.java#L38-L44 |
alkacon/opencms-core | src/org/opencms/configuration/CmsSystemConfiguration.java | CmsSystemConfiguration.setHistorySettings | public void setHistorySettings(String historyEnabled, String historyVersions, String historyVersionsAfterDeletion) {
"""
VFS version history settings are set here.<p>
@param historyEnabled if true the history is enabled
@param historyVersions the maximum number of versions that are kept per VFS resource
@param historyVersionsAfterDeletion the maximum number of versions for deleted resources
"""
m_historyEnabled = Boolean.valueOf(historyEnabled).booleanValue();
m_historyVersions = Integer.valueOf(historyVersions).intValue();
m_historyVersionsAfterDeletion = Integer.valueOf(historyVersionsAfterDeletion).intValue();
if (CmsLog.INIT.isInfoEnabled()) {
CmsLog.INIT.info(
Messages.get().getBundle().key(
Messages.INIT_HISTORY_SETTINGS_3,
Boolean.valueOf(m_historyEnabled),
new Integer(m_historyVersions),
new Integer(m_historyVersionsAfterDeletion)));
}
} | java | public void setHistorySettings(String historyEnabled, String historyVersions, String historyVersionsAfterDeletion) {
m_historyEnabled = Boolean.valueOf(historyEnabled).booleanValue();
m_historyVersions = Integer.valueOf(historyVersions).intValue();
m_historyVersionsAfterDeletion = Integer.valueOf(historyVersionsAfterDeletion).intValue();
if (CmsLog.INIT.isInfoEnabled()) {
CmsLog.INIT.info(
Messages.get().getBundle().key(
Messages.INIT_HISTORY_SETTINGS_3,
Boolean.valueOf(m_historyEnabled),
new Integer(m_historyVersions),
new Integer(m_historyVersionsAfterDeletion)));
}
} | [
"public",
"void",
"setHistorySettings",
"(",
"String",
"historyEnabled",
",",
"String",
"historyVersions",
",",
"String",
"historyVersionsAfterDeletion",
")",
"{",
"m_historyEnabled",
"=",
"Boolean",
".",
"valueOf",
"(",
"historyEnabled",
")",
".",
"booleanValue",
"(",
")",
";",
"m_historyVersions",
"=",
"Integer",
".",
"valueOf",
"(",
"historyVersions",
")",
".",
"intValue",
"(",
")",
";",
"m_historyVersionsAfterDeletion",
"=",
"Integer",
".",
"valueOf",
"(",
"historyVersionsAfterDeletion",
")",
".",
"intValue",
"(",
")",
";",
"if",
"(",
"CmsLog",
".",
"INIT",
".",
"isInfoEnabled",
"(",
")",
")",
"{",
"CmsLog",
".",
"INIT",
".",
"info",
"(",
"Messages",
".",
"get",
"(",
")",
".",
"getBundle",
"(",
")",
".",
"key",
"(",
"Messages",
".",
"INIT_HISTORY_SETTINGS_3",
",",
"Boolean",
".",
"valueOf",
"(",
"m_historyEnabled",
")",
",",
"new",
"Integer",
"(",
"m_historyVersions",
")",
",",
"new",
"Integer",
"(",
"m_historyVersionsAfterDeletion",
")",
")",
")",
";",
"}",
"}"
] | VFS version history settings are set here.<p>
@param historyEnabled if true the history is enabled
@param historyVersions the maximum number of versions that are kept per VFS resource
@param historyVersionsAfterDeletion the maximum number of versions for deleted resources | [
"VFS",
"version",
"history",
"settings",
"are",
"set",
"here",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/configuration/CmsSystemConfiguration.java#L2108-L2121 |
cycorp/api-suite | core-api/src/main/java/com/cyc/kb/exception/KbRuntimeException.java | KbRuntimeException.fromThrowable | public static KbRuntimeException fromThrowable(String message, Throwable cause) {
"""
Converts a Throwable to a KbRuntimeException with the specified detail message. If the
Throwable is a KbRuntimeException and if the Throwable's message is identical to the
one supplied, the Throwable will be passed through unmodified; otherwise, it will be wrapped in
a new KbRuntimeException with the detail message.
@param cause the Throwable to convert
@param message the specified detail message
@return a KbRuntimeException
"""
return (cause instanceof KbRuntimeException && Objects.equals(message, cause.getMessage()))
? (KbRuntimeException) cause
: new KbRuntimeException(message, cause);
} | java | public static KbRuntimeException fromThrowable(String message, Throwable cause) {
return (cause instanceof KbRuntimeException && Objects.equals(message, cause.getMessage()))
? (KbRuntimeException) cause
: new KbRuntimeException(message, cause);
} | [
"public",
"static",
"KbRuntimeException",
"fromThrowable",
"(",
"String",
"message",
",",
"Throwable",
"cause",
")",
"{",
"return",
"(",
"cause",
"instanceof",
"KbRuntimeException",
"&&",
"Objects",
".",
"equals",
"(",
"message",
",",
"cause",
".",
"getMessage",
"(",
")",
")",
")",
"?",
"(",
"KbRuntimeException",
")",
"cause",
":",
"new",
"KbRuntimeException",
"(",
"message",
",",
"cause",
")",
";",
"}"
] | Converts a Throwable to a KbRuntimeException with the specified detail message. If the
Throwable is a KbRuntimeException and if the Throwable's message is identical to the
one supplied, the Throwable will be passed through unmodified; otherwise, it will be wrapped in
a new KbRuntimeException with the detail message.
@param cause the Throwable to convert
@param message the specified detail message
@return a KbRuntimeException | [
"Converts",
"a",
"Throwable",
"to",
"a",
"KbRuntimeException",
"with",
"the",
"specified",
"detail",
"message",
".",
"If",
"the",
"Throwable",
"is",
"a",
"KbRuntimeException",
"and",
"if",
"the",
"Throwable",
"s",
"message",
"is",
"identical",
"to",
"the",
"one",
"supplied",
"the",
"Throwable",
"will",
"be",
"passed",
"through",
"unmodified",
";",
"otherwise",
"it",
"will",
"be",
"wrapped",
"in",
"a",
"new",
"KbRuntimeException",
"with",
"the",
"detail",
"message",
"."
] | train | https://github.com/cycorp/api-suite/blob/1d52affabc4635e3715a059e38741712cbdbf2d5/core-api/src/main/java/com/cyc/kb/exception/KbRuntimeException.java#L68-L72 |
intive-FDV/DynamicJasper | src/main/java/ar/com/fdvs/dj/domain/builders/CrosstabBuilder.java | CrosstabBuilder.addInvisibleMeasure | public CrosstabBuilder addInvisibleMeasure(String property, String className, String title) {
"""
Adds a measure to the crosstab. A crosstab can have many measures. DJ will lay out one measure above
the other.
A measure is what is shown on each intersection of a column and a row. A calculation is performed to
all occurrences in the datasource where the column and row values matches (between elements)
The only difference between the prior methods is that this method sets "visible" to false
@param property
@param className
@param title
@return
"""
DJCrosstabMeasure measure = new DJCrosstabMeasure(property, className, DJCalculation.NOTHING, title);
measure.setVisible(false);
crosstab.getMeasures().add(measure);
return this;
} | java | public CrosstabBuilder addInvisibleMeasure(String property, String className, String title) {
DJCrosstabMeasure measure = new DJCrosstabMeasure(property, className, DJCalculation.NOTHING, title);
measure.setVisible(false);
crosstab.getMeasures().add(measure);
return this;
} | [
"public",
"CrosstabBuilder",
"addInvisibleMeasure",
"(",
"String",
"property",
",",
"String",
"className",
",",
"String",
"title",
")",
"{",
"DJCrosstabMeasure",
"measure",
"=",
"new",
"DJCrosstabMeasure",
"(",
"property",
",",
"className",
",",
"DJCalculation",
".",
"NOTHING",
",",
"title",
")",
";",
"measure",
".",
"setVisible",
"(",
"false",
")",
";",
"crosstab",
".",
"getMeasures",
"(",
")",
".",
"add",
"(",
"measure",
")",
";",
"return",
"this",
";",
"}"
] | Adds a measure to the crosstab. A crosstab can have many measures. DJ will lay out one measure above
the other.
A measure is what is shown on each intersection of a column and a row. A calculation is performed to
all occurrences in the datasource where the column and row values matches (between elements)
The only difference between the prior methods is that this method sets "visible" to false
@param property
@param className
@param title
@return | [
"Adds",
"a",
"measure",
"to",
"the",
"crosstab",
".",
"A",
"crosstab",
"can",
"have",
"many",
"measures",
".",
"DJ",
"will",
"lay",
"out",
"one",
"measure",
"above",
"the",
"other",
"."
] | train | https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/domain/builders/CrosstabBuilder.java#L216-L221 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ForkJoinPool.java | ForkJoinPool.tryCreateExternalQueue | private void tryCreateExternalQueue(int index) {
"""
Constructs and tries to install a new external queue,
failing if the workQueues array already has a queue at
the given index.
@param index the index of the new queue
"""
AuxState aux;
if ((aux = auxState) != null && index >= 0) {
WorkQueue q = new WorkQueue(this, null);
q.config = index;
q.scanState = ~UNSIGNALLED;
q.qlock = 1; // lock queue
boolean installed = false;
aux.lock();
try { // lock pool to install
WorkQueue[] ws;
if ((ws = workQueues) != null && index < ws.length &&
ws[index] == null) {
ws[index] = q; // else throw away
installed = true;
}
} finally {
aux.unlock();
}
if (installed) {
try {
q.growArray();
} finally {
q.qlock = 0;
}
}
}
} | java | private void tryCreateExternalQueue(int index) {
AuxState aux;
if ((aux = auxState) != null && index >= 0) {
WorkQueue q = new WorkQueue(this, null);
q.config = index;
q.scanState = ~UNSIGNALLED;
q.qlock = 1; // lock queue
boolean installed = false;
aux.lock();
try { // lock pool to install
WorkQueue[] ws;
if ((ws = workQueues) != null && index < ws.length &&
ws[index] == null) {
ws[index] = q; // else throw away
installed = true;
}
} finally {
aux.unlock();
}
if (installed) {
try {
q.growArray();
} finally {
q.qlock = 0;
}
}
}
} | [
"private",
"void",
"tryCreateExternalQueue",
"(",
"int",
"index",
")",
"{",
"AuxState",
"aux",
";",
"if",
"(",
"(",
"aux",
"=",
"auxState",
")",
"!=",
"null",
"&&",
"index",
">=",
"0",
")",
"{",
"WorkQueue",
"q",
"=",
"new",
"WorkQueue",
"(",
"this",
",",
"null",
")",
";",
"q",
".",
"config",
"=",
"index",
";",
"q",
".",
"scanState",
"=",
"~",
"UNSIGNALLED",
";",
"q",
".",
"qlock",
"=",
"1",
";",
"// lock queue",
"boolean",
"installed",
"=",
"false",
";",
"aux",
".",
"lock",
"(",
")",
";",
"try",
"{",
"// lock pool to install",
"WorkQueue",
"[",
"]",
"ws",
";",
"if",
"(",
"(",
"ws",
"=",
"workQueues",
")",
"!=",
"null",
"&&",
"index",
"<",
"ws",
".",
"length",
"&&",
"ws",
"[",
"index",
"]",
"==",
"null",
")",
"{",
"ws",
"[",
"index",
"]",
"=",
"q",
";",
"// else throw away",
"installed",
"=",
"true",
";",
"}",
"}",
"finally",
"{",
"aux",
".",
"unlock",
"(",
")",
";",
"}",
"if",
"(",
"installed",
")",
"{",
"try",
"{",
"q",
".",
"growArray",
"(",
")",
";",
"}",
"finally",
"{",
"q",
".",
"qlock",
"=",
"0",
";",
"}",
"}",
"}",
"}"
] | Constructs and tries to install a new external queue,
failing if the workQueues array already has a queue at
the given index.
@param index the index of the new queue | [
"Constructs",
"and",
"tries",
"to",
"install",
"a",
"new",
"external",
"queue",
"failing",
"if",
"the",
"workQueues",
"array",
"already",
"has",
"a",
"queue",
"at",
"the",
"given",
"index",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ForkJoinPool.java#L2487-L2514 |
sirthias/pegdown | src/main/java/org/pegdown/Parser.java | Parser.SetextHeading1 | public Rule SetextHeading1() {
"""
vsch: #186 add isSetext flag to header node to distinguish header types
"""
return Sequence(
SetextInline(), push(new HeaderNode(1, popAsNode(), true)),
ZeroOrMore(SetextInline(), addAsChild()),
wrapInAnchor(),
Sp(), Newline(), NOrMore('=', 3), Sp(), Newline()
);
} | java | public Rule SetextHeading1() {
return Sequence(
SetextInline(), push(new HeaderNode(1, popAsNode(), true)),
ZeroOrMore(SetextInline(), addAsChild()),
wrapInAnchor(),
Sp(), Newline(), NOrMore('=', 3), Sp(), Newline()
);
} | [
"public",
"Rule",
"SetextHeading1",
"(",
")",
"{",
"return",
"Sequence",
"(",
"SetextInline",
"(",
")",
",",
"push",
"(",
"new",
"HeaderNode",
"(",
"1",
",",
"popAsNode",
"(",
")",
",",
"true",
")",
")",
",",
"ZeroOrMore",
"(",
"SetextInline",
"(",
")",
",",
"addAsChild",
"(",
")",
")",
",",
"wrapInAnchor",
"(",
")",
",",
"Sp",
"(",
")",
",",
"Newline",
"(",
")",
",",
"NOrMore",
"(",
"'",
"'",
",",
"3",
")",
",",
"Sp",
"(",
")",
",",
"Newline",
"(",
")",
")",
";",
"}"
] | vsch: #186 add isSetext flag to header node to distinguish header types | [
"vsch",
":",
"#186",
"add",
"isSetext",
"flag",
"to",
"header",
"node",
"to",
"distinguish",
"header",
"types"
] | train | https://github.com/sirthias/pegdown/blob/19ca3d3d2bea5df19eb885260ab24f1200a16452/src/main/java/org/pegdown/Parser.java#L284-L291 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/PdfStamperImp.java | PdfStamperImp.setTransition | void setTransition(PdfTransition transition, int page) {
"""
Sets the transition for the page
@param transition the transition object. A <code>null</code> removes the transition
@param page the page where the transition will be applied. The first page is 1
"""
PdfDictionary pg = reader.getPageN(page);
if (transition == null)
pg.remove(PdfName.TRANS);
else
pg.put(PdfName.TRANS, transition.getTransitionDictionary());
markUsed(pg);
} | java | void setTransition(PdfTransition transition, int page) {
PdfDictionary pg = reader.getPageN(page);
if (transition == null)
pg.remove(PdfName.TRANS);
else
pg.put(PdfName.TRANS, transition.getTransitionDictionary());
markUsed(pg);
} | [
"void",
"setTransition",
"(",
"PdfTransition",
"transition",
",",
"int",
"page",
")",
"{",
"PdfDictionary",
"pg",
"=",
"reader",
".",
"getPageN",
"(",
"page",
")",
";",
"if",
"(",
"transition",
"==",
"null",
")",
"pg",
".",
"remove",
"(",
"PdfName",
".",
"TRANS",
")",
";",
"else",
"pg",
".",
"put",
"(",
"PdfName",
".",
"TRANS",
",",
"transition",
".",
"getTransitionDictionary",
"(",
")",
")",
";",
"markUsed",
"(",
"pg",
")",
";",
"}"
] | Sets the transition for the page
@param transition the transition object. A <code>null</code> removes the transition
@param page the page where the transition will be applied. The first page is 1 | [
"Sets",
"the",
"transition",
"for",
"the",
"page"
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfStamperImp.java#L1432-L1439 |
upwork/java-upwork | src/com/Upwork/api/Routers/Reports/Finance/Billings.java | Billings.getByFreelancersCompany | public JSONObject getByFreelancersCompany(String freelancerCompanyReference, HashMap<String, String> params) throws JSONException {
"""
Generate Billing Reports for a Specific Freelancer's Company
@param freelancerCompanyReference Freelancer's company reference
@param params Parameters
@throws JSONException If error occurred
@return {@link JSONObject}
"""
return oClient.get("/finreports/v2/provider_companies/" + freelancerCompanyReference + "/billings", params);
} | java | public JSONObject getByFreelancersCompany(String freelancerCompanyReference, HashMap<String, String> params) throws JSONException {
return oClient.get("/finreports/v2/provider_companies/" + freelancerCompanyReference + "/billings", params);
} | [
"public",
"JSONObject",
"getByFreelancersCompany",
"(",
"String",
"freelancerCompanyReference",
",",
"HashMap",
"<",
"String",
",",
"String",
">",
"params",
")",
"throws",
"JSONException",
"{",
"return",
"oClient",
".",
"get",
"(",
"\"/finreports/v2/provider_companies/\"",
"+",
"freelancerCompanyReference",
"+",
"\"/billings\"",
",",
"params",
")",
";",
"}"
] | Generate Billing Reports for a Specific Freelancer's Company
@param freelancerCompanyReference Freelancer's company reference
@param params Parameters
@throws JSONException If error occurred
@return {@link JSONObject} | [
"Generate",
"Billing",
"Reports",
"for",
"a",
"Specific",
"Freelancer",
"s",
"Company"
] | train | https://github.com/upwork/java-upwork/blob/342297161503a74e9e0bddbd381ab5eebf4dc454/src/com/Upwork/api/Routers/Reports/Finance/Billings.java#L78-L80 |
j256/ormlite-core | src/main/java/com/j256/ormlite/field/DatabaseFieldConfig.java | DatabaseFieldConfig.fromField | public static DatabaseFieldConfig fromField(DatabaseType databaseType, String tableName, Field field)
throws SQLException {
"""
Create and return a config converted from a {@link Field} that may have one of the following annotations:
{@link DatabaseField}, {@link ForeignCollectionField}, or javax.persistence...
"""
// first we lookup the @DatabaseField annotation
DatabaseField databaseField = field.getAnnotation(DatabaseField.class);
if (databaseField != null) {
if (databaseField.persisted()) {
return fromDatabaseField(databaseType, tableName, field, databaseField);
} else {
return null;
}
}
// lastly we check for @ForeignCollectionField
ForeignCollectionField foreignCollection = field.getAnnotation(ForeignCollectionField.class);
if (foreignCollection != null) {
return fromForeignCollection(databaseType, field, foreignCollection);
}
/*
* NOTE: to remove javax.persistence usage, comment the following lines out
*/
if (javaxPersistenceConfigurer == null) {
return null;
} else {
// this can be null
return javaxPersistenceConfigurer.createFieldConfig(databaseType, field);
}
} | java | public static DatabaseFieldConfig fromField(DatabaseType databaseType, String tableName, Field field)
throws SQLException {
// first we lookup the @DatabaseField annotation
DatabaseField databaseField = field.getAnnotation(DatabaseField.class);
if (databaseField != null) {
if (databaseField.persisted()) {
return fromDatabaseField(databaseType, tableName, field, databaseField);
} else {
return null;
}
}
// lastly we check for @ForeignCollectionField
ForeignCollectionField foreignCollection = field.getAnnotation(ForeignCollectionField.class);
if (foreignCollection != null) {
return fromForeignCollection(databaseType, field, foreignCollection);
}
/*
* NOTE: to remove javax.persistence usage, comment the following lines out
*/
if (javaxPersistenceConfigurer == null) {
return null;
} else {
// this can be null
return javaxPersistenceConfigurer.createFieldConfig(databaseType, field);
}
} | [
"public",
"static",
"DatabaseFieldConfig",
"fromField",
"(",
"DatabaseType",
"databaseType",
",",
"String",
"tableName",
",",
"Field",
"field",
")",
"throws",
"SQLException",
"{",
"// first we lookup the @DatabaseField annotation",
"DatabaseField",
"databaseField",
"=",
"field",
".",
"getAnnotation",
"(",
"DatabaseField",
".",
"class",
")",
";",
"if",
"(",
"databaseField",
"!=",
"null",
")",
"{",
"if",
"(",
"databaseField",
".",
"persisted",
"(",
")",
")",
"{",
"return",
"fromDatabaseField",
"(",
"databaseType",
",",
"tableName",
",",
"field",
",",
"databaseField",
")",
";",
"}",
"else",
"{",
"return",
"null",
";",
"}",
"}",
"// lastly we check for @ForeignCollectionField",
"ForeignCollectionField",
"foreignCollection",
"=",
"field",
".",
"getAnnotation",
"(",
"ForeignCollectionField",
".",
"class",
")",
";",
"if",
"(",
"foreignCollection",
"!=",
"null",
")",
"{",
"return",
"fromForeignCollection",
"(",
"databaseType",
",",
"field",
",",
"foreignCollection",
")",
";",
"}",
"/*\n\t\t * NOTE: to remove javax.persistence usage, comment the following lines out\n\t\t */",
"if",
"(",
"javaxPersistenceConfigurer",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"else",
"{",
"// this can be null",
"return",
"javaxPersistenceConfigurer",
".",
"createFieldConfig",
"(",
"databaseType",
",",
"field",
")",
";",
"}",
"}"
] | Create and return a config converted from a {@link Field} that may have one of the following annotations:
{@link DatabaseField}, {@link ForeignCollectionField}, or javax.persistence... | [
"Create",
"and",
"return",
"a",
"config",
"converted",
"from",
"a",
"{"
] | train | https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/field/DatabaseFieldConfig.java#L511-L539 |
tango-controls/JTango | server/src/main/java/org/tango/server/admin/AdminDevice.java | AdminDevice.getLoggingLevel | @Command(name = "GetLoggingLevel", inTypeDesc = "Device list", outTypeDesc = "Lg[i]=Logging Level. Str[i]=Device name.")
public DevVarLongStringArray getLoggingLevel(final String[] deviceNames) {
"""
Get the logging level
@param deviceNames
@return the current logging levels
"""
final int[] levels = new int[deviceNames.length];
for (int i = 0; i < levels.length; i++) {
levels[i] = LoggingManager.getInstance().getLoggingLevel(deviceNames[i]);
}
return new DevVarLongStringArray(levels, deviceNames);
} | java | @Command(name = "GetLoggingLevel", inTypeDesc = "Device list", outTypeDesc = "Lg[i]=Logging Level. Str[i]=Device name.")
public DevVarLongStringArray getLoggingLevel(final String[] deviceNames) {
final int[] levels = new int[deviceNames.length];
for (int i = 0; i < levels.length; i++) {
levels[i] = LoggingManager.getInstance().getLoggingLevel(deviceNames[i]);
}
return new DevVarLongStringArray(levels, deviceNames);
} | [
"@",
"Command",
"(",
"name",
"=",
"\"GetLoggingLevel\"",
",",
"inTypeDesc",
"=",
"\"Device list\"",
",",
"outTypeDesc",
"=",
"\"Lg[i]=Logging Level. Str[i]=Device name.\"",
")",
"public",
"DevVarLongStringArray",
"getLoggingLevel",
"(",
"final",
"String",
"[",
"]",
"deviceNames",
")",
"{",
"final",
"int",
"[",
"]",
"levels",
"=",
"new",
"int",
"[",
"deviceNames",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"levels",
".",
"length",
";",
"i",
"++",
")",
"{",
"levels",
"[",
"i",
"]",
"=",
"LoggingManager",
".",
"getInstance",
"(",
")",
".",
"getLoggingLevel",
"(",
"deviceNames",
"[",
"i",
"]",
")",
";",
"}",
"return",
"new",
"DevVarLongStringArray",
"(",
"levels",
",",
"deviceNames",
")",
";",
"}"
] | Get the logging level
@param deviceNames
@return the current logging levels | [
"Get",
"the",
"logging",
"level"
] | train | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/server/admin/AdminDevice.java#L358-L365 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/stat/autoscale/autoscalepolicy_stats.java | autoscalepolicy_stats.get | public static autoscalepolicy_stats get(nitro_service service, String name) throws Exception {
"""
Use this API to fetch statistics of autoscalepolicy_stats resource of given name .
"""
autoscalepolicy_stats obj = new autoscalepolicy_stats();
obj.set_name(name);
autoscalepolicy_stats response = (autoscalepolicy_stats) obj.stat_resource(service);
return response;
} | java | public static autoscalepolicy_stats get(nitro_service service, String name) throws Exception{
autoscalepolicy_stats obj = new autoscalepolicy_stats();
obj.set_name(name);
autoscalepolicy_stats response = (autoscalepolicy_stats) obj.stat_resource(service);
return response;
} | [
"public",
"static",
"autoscalepolicy_stats",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"name",
")",
"throws",
"Exception",
"{",
"autoscalepolicy_stats",
"obj",
"=",
"new",
"autoscalepolicy_stats",
"(",
")",
";",
"obj",
".",
"set_name",
"(",
"name",
")",
";",
"autoscalepolicy_stats",
"response",
"=",
"(",
"autoscalepolicy_stats",
")",
"obj",
".",
"stat_resource",
"(",
"service",
")",
";",
"return",
"response",
";",
"}"
] | Use this API to fetch statistics of autoscalepolicy_stats resource of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"statistics",
"of",
"autoscalepolicy_stats",
"resource",
"of",
"given",
"name",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/stat/autoscale/autoscalepolicy_stats.java#L169-L174 |
UrielCh/ovh-java-sdk | ovh-java-sdk-dedicatednas/src/main/java/net/minidev/ovh/api/ApiOvhDedicatednas.java | ApiOvhDedicatednas.serviceName_partition_partitionName_access_ip_GET | public OvhAccess serviceName_partition_partitionName_access_ip_GET(String serviceName, String partitionName, String ip) throws IOException {
"""
Get this object properties
REST: GET /dedicated/nas/{serviceName}/partition/{partitionName}/access/{ip}
@param serviceName [required] The internal name of your storage
@param partitionName [required] the given name of partition
@param ip [required] the ip in root on storage
"""
String qPath = "/dedicated/nas/{serviceName}/partition/{partitionName}/access/{ip}";
StringBuilder sb = path(qPath, serviceName, partitionName, ip);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhAccess.class);
} | java | public OvhAccess serviceName_partition_partitionName_access_ip_GET(String serviceName, String partitionName, String ip) throws IOException {
String qPath = "/dedicated/nas/{serviceName}/partition/{partitionName}/access/{ip}";
StringBuilder sb = path(qPath, serviceName, partitionName, ip);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhAccess.class);
} | [
"public",
"OvhAccess",
"serviceName_partition_partitionName_access_ip_GET",
"(",
"String",
"serviceName",
",",
"String",
"partitionName",
",",
"String",
"ip",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/dedicated/nas/{serviceName}/partition/{partitionName}/access/{ip}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"serviceName",
",",
"partitionName",
",",
"ip",
")",
";",
"String",
"resp",
"=",
"exec",
"(",
"qPath",
",",
"\"GET\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"null",
")",
";",
"return",
"convertTo",
"(",
"resp",
",",
"OvhAccess",
".",
"class",
")",
";",
"}"
] | Get this object properties
REST: GET /dedicated/nas/{serviceName}/partition/{partitionName}/access/{ip}
@param serviceName [required] The internal name of your storage
@param partitionName [required] the given name of partition
@param ip [required] the ip in root on storage | [
"Get",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatednas/src/main/java/net/minidev/ovh/api/ApiOvhDedicatednas.java#L165-L170 |
leancloud/java-sdk-all | android-sdk/realtime-android/src/main/java/cn/leancloud/push/AndroidNotificationManager.java | AndroidNotificationManager.processMixNotification | public void processMixNotification(String message, String defaultAction) {
"""
处理混合推送通知栏消息点击后的事件(现在支持小米、魅族,华为不支持)
处理逻辑:如果是自定义 action 的消息点击事件,则发送 broadcast,否则按照 sdk 自有逻辑打开相应的 activity
@param message
"""
if (StringUtil.isEmpty(message)) {
LOGGER.e("message is empty, ignore.");
} else {
String channel = getChannel(message);
if (channel == null || !containsDefaultPushCallback(channel)) {
channel = AVOSCloud.getApplicationId();
}
String action = getAction(message);
if (null != action) {
sendNotificationBroadcast(channel, message, defaultAction);
} else {
String clsName = getDefaultPushCallback(channel);
if (StringUtil.isEmpty(clsName)) {
LOGGER.e("className is empty, ignore.");
} else {
Intent intent = buildUpdateIntent(channel, message, null);
ComponentName cn = new ComponentName(AVOSCloud.getContext(), clsName);
intent.setComponent(cn);
intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
PendingIntent pendingIntent = PendingIntent.getActivity(AVOSCloud.getContext(), 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
try {
pendingIntent.send();
} catch (PendingIntent.CanceledException e) {
LOGGER.e("Ocurred PendingIntent.CanceledException", e);
}
}
}
}
} | java | public void processMixNotification(String message, String defaultAction) {
if (StringUtil.isEmpty(message)) {
LOGGER.e("message is empty, ignore.");
} else {
String channel = getChannel(message);
if (channel == null || !containsDefaultPushCallback(channel)) {
channel = AVOSCloud.getApplicationId();
}
String action = getAction(message);
if (null != action) {
sendNotificationBroadcast(channel, message, defaultAction);
} else {
String clsName = getDefaultPushCallback(channel);
if (StringUtil.isEmpty(clsName)) {
LOGGER.e("className is empty, ignore.");
} else {
Intent intent = buildUpdateIntent(channel, message, null);
ComponentName cn = new ComponentName(AVOSCloud.getContext(), clsName);
intent.setComponent(cn);
intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
PendingIntent pendingIntent = PendingIntent.getActivity(AVOSCloud.getContext(), 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
try {
pendingIntent.send();
} catch (PendingIntent.CanceledException e) {
LOGGER.e("Ocurred PendingIntent.CanceledException", e);
}
}
}
}
} | [
"public",
"void",
"processMixNotification",
"(",
"String",
"message",
",",
"String",
"defaultAction",
")",
"{",
"if",
"(",
"StringUtil",
".",
"isEmpty",
"(",
"message",
")",
")",
"{",
"LOGGER",
".",
"e",
"(",
"\"message is empty, ignore.\"",
")",
";",
"}",
"else",
"{",
"String",
"channel",
"=",
"getChannel",
"(",
"message",
")",
";",
"if",
"(",
"channel",
"==",
"null",
"||",
"!",
"containsDefaultPushCallback",
"(",
"channel",
")",
")",
"{",
"channel",
"=",
"AVOSCloud",
".",
"getApplicationId",
"(",
")",
";",
"}",
"String",
"action",
"=",
"getAction",
"(",
"message",
")",
";",
"if",
"(",
"null",
"!=",
"action",
")",
"{",
"sendNotificationBroadcast",
"(",
"channel",
",",
"message",
",",
"defaultAction",
")",
";",
"}",
"else",
"{",
"String",
"clsName",
"=",
"getDefaultPushCallback",
"(",
"channel",
")",
";",
"if",
"(",
"StringUtil",
".",
"isEmpty",
"(",
"clsName",
")",
")",
"{",
"LOGGER",
".",
"e",
"(",
"\"className is empty, ignore.\"",
")",
";",
"}",
"else",
"{",
"Intent",
"intent",
"=",
"buildUpdateIntent",
"(",
"channel",
",",
"message",
",",
"null",
")",
";",
"ComponentName",
"cn",
"=",
"new",
"ComponentName",
"(",
"AVOSCloud",
".",
"getContext",
"(",
")",
",",
"clsName",
")",
";",
"intent",
".",
"setComponent",
"(",
"cn",
")",
";",
"intent",
".",
"setFlags",
"(",
"Intent",
".",
"FLAG_ACTIVITY_SINGLE_TOP",
")",
";",
"PendingIntent",
"pendingIntent",
"=",
"PendingIntent",
".",
"getActivity",
"(",
"AVOSCloud",
".",
"getContext",
"(",
")",
",",
"0",
",",
"intent",
",",
"PendingIntent",
".",
"FLAG_UPDATE_CURRENT",
")",
";",
"try",
"{",
"pendingIntent",
".",
"send",
"(",
")",
";",
"}",
"catch",
"(",
"PendingIntent",
".",
"CanceledException",
"e",
")",
"{",
"LOGGER",
".",
"e",
"(",
"\"Ocurred PendingIntent.CanceledException\"",
",",
"e",
")",
";",
"}",
"}",
"}",
"}",
"}"
] | 处理混合推送通知栏消息点击后的事件(现在支持小米、魅族,华为不支持)
处理逻辑:如果是自定义 action 的消息点击事件,则发送 broadcast,否则按照 sdk 自有逻辑打开相应的 activity
@param message | [
"处理混合推送通知栏消息点击后的事件(现在支持小米、魅族,华为不支持)",
"处理逻辑:如果是自定义",
"action",
"的消息点击事件,则发送",
"broadcast,否则按照",
"sdk",
"自有逻辑打开相应的",
"activity"
] | train | https://github.com/leancloud/java-sdk-all/blob/323f8e7ee38051b1350790e5192304768c5c9f5f/android-sdk/realtime-android/src/main/java/cn/leancloud/push/AndroidNotificationManager.java#L183-L213 |
spring-projects/spring-security-oauth | spring-security-jwt/src/main/java/org/springframework/security/jwt/JwtHelper.java | JwtHelper.decode | public static Jwt decode(String token) {
"""
Creates a token from an encoded token string.
@param token the (non-null) encoded token (three Base-64 encoded strings separated
by "." characters)
"""
int firstPeriod = token.indexOf('.');
int lastPeriod = token.lastIndexOf('.');
if (firstPeriod <= 0 || lastPeriod <= firstPeriod) {
throw new IllegalArgumentException("JWT must have 3 tokens");
}
CharBuffer buffer = CharBuffer.wrap(token, 0, firstPeriod);
// TODO: Use a Reader which supports CharBuffer
JwtHeader header = JwtHeaderHelper.create(buffer.toString());
buffer.limit(lastPeriod).position(firstPeriod + 1);
byte[] claims = b64UrlDecode(buffer);
boolean emptyCrypto = lastPeriod == token.length() - 1;
byte[] crypto;
if (emptyCrypto) {
if (!"none".equals(header.parameters.alg)) {
throw new IllegalArgumentException(
"Signed or encrypted token must have non-empty crypto segment");
}
crypto = new byte[0];
}
else {
buffer.limit(token.length()).position(lastPeriod + 1);
crypto = b64UrlDecode(buffer);
}
return new JwtImpl(header, claims, crypto);
} | java | public static Jwt decode(String token) {
int firstPeriod = token.indexOf('.');
int lastPeriod = token.lastIndexOf('.');
if (firstPeriod <= 0 || lastPeriod <= firstPeriod) {
throw new IllegalArgumentException("JWT must have 3 tokens");
}
CharBuffer buffer = CharBuffer.wrap(token, 0, firstPeriod);
// TODO: Use a Reader which supports CharBuffer
JwtHeader header = JwtHeaderHelper.create(buffer.toString());
buffer.limit(lastPeriod).position(firstPeriod + 1);
byte[] claims = b64UrlDecode(buffer);
boolean emptyCrypto = lastPeriod == token.length() - 1;
byte[] crypto;
if (emptyCrypto) {
if (!"none".equals(header.parameters.alg)) {
throw new IllegalArgumentException(
"Signed or encrypted token must have non-empty crypto segment");
}
crypto = new byte[0];
}
else {
buffer.limit(token.length()).position(lastPeriod + 1);
crypto = b64UrlDecode(buffer);
}
return new JwtImpl(header, claims, crypto);
} | [
"public",
"static",
"Jwt",
"decode",
"(",
"String",
"token",
")",
"{",
"int",
"firstPeriod",
"=",
"token",
".",
"indexOf",
"(",
"'",
"'",
")",
";",
"int",
"lastPeriod",
"=",
"token",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
";",
"if",
"(",
"firstPeriod",
"<=",
"0",
"||",
"lastPeriod",
"<=",
"firstPeriod",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"JWT must have 3 tokens\"",
")",
";",
"}",
"CharBuffer",
"buffer",
"=",
"CharBuffer",
".",
"wrap",
"(",
"token",
",",
"0",
",",
"firstPeriod",
")",
";",
"// TODO: Use a Reader which supports CharBuffer",
"JwtHeader",
"header",
"=",
"JwtHeaderHelper",
".",
"create",
"(",
"buffer",
".",
"toString",
"(",
")",
")",
";",
"buffer",
".",
"limit",
"(",
"lastPeriod",
")",
".",
"position",
"(",
"firstPeriod",
"+",
"1",
")",
";",
"byte",
"[",
"]",
"claims",
"=",
"b64UrlDecode",
"(",
"buffer",
")",
";",
"boolean",
"emptyCrypto",
"=",
"lastPeriod",
"==",
"token",
".",
"length",
"(",
")",
"-",
"1",
";",
"byte",
"[",
"]",
"crypto",
";",
"if",
"(",
"emptyCrypto",
")",
"{",
"if",
"(",
"!",
"\"none\"",
".",
"equals",
"(",
"header",
".",
"parameters",
".",
"alg",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Signed or encrypted token must have non-empty crypto segment\"",
")",
";",
"}",
"crypto",
"=",
"new",
"byte",
"[",
"0",
"]",
";",
"}",
"else",
"{",
"buffer",
".",
"limit",
"(",
"token",
".",
"length",
"(",
")",
")",
".",
"position",
"(",
"lastPeriod",
"+",
"1",
")",
";",
"crypto",
"=",
"b64UrlDecode",
"(",
"buffer",
")",
";",
"}",
"return",
"new",
"JwtImpl",
"(",
"header",
",",
"claims",
",",
"crypto",
")",
";",
"}"
] | Creates a token from an encoded token string.
@param token the (non-null) encoded token (three Base-64 encoded strings separated
by "." characters) | [
"Creates",
"a",
"token",
"from",
"an",
"encoded",
"token",
"string",
"."
] | train | https://github.com/spring-projects/spring-security-oauth/blob/bbae0027eceb2c74a21ac26bbc86142dc732ffbe/spring-security-jwt/src/main/java/org/springframework/security/jwt/JwtHelper.java#L44-L73 |
UrielCh/ovh-java-sdk | ovh-java-sdk-xdsl/src/main/java/net/minidev/ovh/api/ApiOvhXdsl.java | ApiOvhXdsl.templateModem_name_GET | public OvhTemplateModem templateModem_name_GET(String name) throws IOException {
"""
Get this object properties
REST: GET /xdsl/templateModem/{name}
@param name [required] Name of the Modem Template
API beta
"""
String qPath = "/xdsl/templateModem/{name}";
StringBuilder sb = path(qPath, name);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhTemplateModem.class);
} | java | public OvhTemplateModem templateModem_name_GET(String name) throws IOException {
String qPath = "/xdsl/templateModem/{name}";
StringBuilder sb = path(qPath, name);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhTemplateModem.class);
} | [
"public",
"OvhTemplateModem",
"templateModem_name_GET",
"(",
"String",
"name",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/xdsl/templateModem/{name}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"name",
")",
";",
"String",
"resp",
"=",
"exec",
"(",
"qPath",
",",
"\"GET\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"null",
")",
";",
"return",
"convertTo",
"(",
"resp",
",",
"OvhTemplateModem",
".",
"class",
")",
";",
"}"
] | Get this object properties
REST: GET /xdsl/templateModem/{name}
@param name [required] Name of the Modem Template
API beta | [
"Get",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-xdsl/src/main/java/net/minidev/ovh/api/ApiOvhXdsl.java#L122-L127 |
joniles/mpxj | src/main/java/net/sf/mpxj/mpx/Record.java | Record.getTime | public Date getTime(int field) throws MPXJException {
"""
Accessor method used to retrieve an Date instance 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
@throws MPXJException normally thrown when parsing fails
"""
try
{
Date result;
if ((field < m_fields.length) && (m_fields[field].length() != 0))
{
result = m_formats.getTimeFormat().parse(m_fields[field]);
}
else
{
result = null;
}
return (result);
}
catch (ParseException ex)
{
throw new MPXJException("Failed to parse time", ex);
}
} | java | public Date getTime(int field) throws MPXJException
{
try
{
Date result;
if ((field < m_fields.length) && (m_fields[field].length() != 0))
{
result = m_formats.getTimeFormat().parse(m_fields[field]);
}
else
{
result = null;
}
return (result);
}
catch (ParseException ex)
{
throw new MPXJException("Failed to parse time", ex);
}
} | [
"public",
"Date",
"getTime",
"(",
"int",
"field",
")",
"throws",
"MPXJException",
"{",
"try",
"{",
"Date",
"result",
";",
"if",
"(",
"(",
"field",
"<",
"m_fields",
".",
"length",
")",
"&&",
"(",
"m_fields",
"[",
"field",
"]",
".",
"length",
"(",
")",
"!=",
"0",
")",
")",
"{",
"result",
"=",
"m_formats",
".",
"getTimeFormat",
"(",
")",
".",
"parse",
"(",
"m_fields",
"[",
"field",
"]",
")",
";",
"}",
"else",
"{",
"result",
"=",
"null",
";",
"}",
"return",
"(",
"result",
")",
";",
"}",
"catch",
"(",
"ParseException",
"ex",
")",
"{",
"throw",
"new",
"MPXJException",
"(",
"\"Failed to parse time\"",
",",
"ex",
")",
";",
"}",
"}"
] | Accessor method used to retrieve an Date instance 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
@throws MPXJException normally thrown when parsing fails | [
"Accessor",
"method",
"used",
"to",
"retrieve",
"an",
"Date",
"instance",
"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#L316-L338 |
netty/netty | handler/src/main/java/io/netty/handler/ssl/SslContext.java | SslContext.newHandler | public SslHandler newHandler(ByteBufAllocator alloc, Executor delegatedTaskExecutor) {
"""
Creates a new {@link SslHandler}.
<p>If {@link SslProvider#OPENSSL_REFCNT} is used then the returned {@link SslHandler} will release the engine
that is wrapped. If the returned {@link SslHandler} is not inserted into a pipeline then you may leak native
memory!
<p><b>Beware</b>: the underlying generated {@link SSLEngine} won't have
<a href="https://wiki.openssl.org/index.php/Hostname_validation">hostname verification</a> enabled by default.
If you create {@link SslHandler} for the client side and want proper security, we advice that you configure
the {@link SSLEngine} (see {@link javax.net.ssl.SSLParameters#setEndpointIdentificationAlgorithm(String)}):
<pre>
SSLEngine sslEngine = sslHandler.engine();
SSLParameters sslParameters = sslEngine.getSSLParameters();
// only available since Java 7
sslParameters.setEndpointIdentificationAlgorithm("HTTPS");
sslEngine.setSSLParameters(sslParameters);
</pre>
<p>
The underlying {@link SSLEngine} may not follow the restrictions imposed by the
<a href="https://docs.oracle.com/javase/7/docs/api/javax/net/ssl/SSLEngine.html">SSLEngine javadocs</a> which
limits wrap/unwrap to operate on a single SSL/TLS packet.
@param alloc If supported by the SSLEngine then the SSLEngine will use this to allocate ByteBuf objects.
@param delegatedTaskExecutor the {@link Executor} that will be used to execute tasks that are returned by
{@link SSLEngine#getDelegatedTask()}.
@return a new {@link SslHandler}
"""
return newHandler(alloc, startTls, delegatedTaskExecutor);
} | java | public SslHandler newHandler(ByteBufAllocator alloc, Executor delegatedTaskExecutor) {
return newHandler(alloc, startTls, delegatedTaskExecutor);
} | [
"public",
"SslHandler",
"newHandler",
"(",
"ByteBufAllocator",
"alloc",
",",
"Executor",
"delegatedTaskExecutor",
")",
"{",
"return",
"newHandler",
"(",
"alloc",
",",
"startTls",
",",
"delegatedTaskExecutor",
")",
";",
"}"
] | Creates a new {@link SslHandler}.
<p>If {@link SslProvider#OPENSSL_REFCNT} is used then the returned {@link SslHandler} will release the engine
that is wrapped. If the returned {@link SslHandler} is not inserted into a pipeline then you may leak native
memory!
<p><b>Beware</b>: the underlying generated {@link SSLEngine} won't have
<a href="https://wiki.openssl.org/index.php/Hostname_validation">hostname verification</a> enabled by default.
If you create {@link SslHandler} for the client side and want proper security, we advice that you configure
the {@link SSLEngine} (see {@link javax.net.ssl.SSLParameters#setEndpointIdentificationAlgorithm(String)}):
<pre>
SSLEngine sslEngine = sslHandler.engine();
SSLParameters sslParameters = sslEngine.getSSLParameters();
// only available since Java 7
sslParameters.setEndpointIdentificationAlgorithm("HTTPS");
sslEngine.setSSLParameters(sslParameters);
</pre>
<p>
The underlying {@link SSLEngine} may not follow the restrictions imposed by the
<a href="https://docs.oracle.com/javase/7/docs/api/javax/net/ssl/SSLEngine.html">SSLEngine javadocs</a> which
limits wrap/unwrap to operate on a single SSL/TLS packet.
@param alloc If supported by the SSLEngine then the SSLEngine will use this to allocate ByteBuf objects.
@param delegatedTaskExecutor the {@link Executor} that will be used to execute tasks that are returned by
{@link SSLEngine#getDelegatedTask()}.
@return a new {@link SslHandler} | [
"Creates",
"a",
"new",
"{"
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/SslContext.java#L924-L926 |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/ws/udpchannel/internal/WorkQueueManager.java | WorkQueueManager.getMultiThreadedWorker | protected MultiThreadedWorker getMultiThreadedWorker(SelectionKey key, long threadIdfWQM) {
"""
Retrieve a MultiThreadedWorker object from the object pool.
@param key
@param threadIdfWQM
@return MultiThreadedWorker
"""
MultiThreadedWorker worker = null;
synchronized (multiThreadedObjectPool) {
worker = (MultiThreadedWorker) multiThreadedObjectPool.get();
}
if (worker == null) {
worker = new MultiThreadedWorker(this);
}
worker.set(key);
return worker;
} | java | protected MultiThreadedWorker getMultiThreadedWorker(SelectionKey key, long threadIdfWQM) {
MultiThreadedWorker worker = null;
synchronized (multiThreadedObjectPool) {
worker = (MultiThreadedWorker) multiThreadedObjectPool.get();
}
if (worker == null) {
worker = new MultiThreadedWorker(this);
}
worker.set(key);
return worker;
} | [
"protected",
"MultiThreadedWorker",
"getMultiThreadedWorker",
"(",
"SelectionKey",
"key",
",",
"long",
"threadIdfWQM",
")",
"{",
"MultiThreadedWorker",
"worker",
"=",
"null",
";",
"synchronized",
"(",
"multiThreadedObjectPool",
")",
"{",
"worker",
"=",
"(",
"MultiThreadedWorker",
")",
"multiThreadedObjectPool",
".",
"get",
"(",
")",
";",
"}",
"if",
"(",
"worker",
"==",
"null",
")",
"{",
"worker",
"=",
"new",
"MultiThreadedWorker",
"(",
"this",
")",
";",
"}",
"worker",
".",
"set",
"(",
"key",
")",
";",
"return",
"worker",
";",
"}"
] | Retrieve a MultiThreadedWorker object from the object pool.
@param key
@param threadIdfWQM
@return MultiThreadedWorker | [
"Retrieve",
"a",
"MultiThreadedWorker",
"object",
"from",
"the",
"object",
"pool",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/udpchannel/internal/WorkQueueManager.java#L1062-L1075 |
lucee/Lucee | core/src/main/java/lucee/runtime/reflection/Reflector.java | Reflector.getGetter | public static MethodInstance getGetter(Class clazz, String prop) throws PageException, NoSuchMethodException {
"""
to get a Getter Method of a Object
@param clazz Class to invoke method from
@param prop Name of the Method without get
@return return Value of the getter Method
@throws NoSuchMethodException
@throws PageException
"""
String getterName = "get" + StringUtil.ucFirst(prop);
MethodInstance mi = getMethodInstanceEL(null, clazz, KeyImpl.getInstance(getterName), ArrayUtil.OBJECT_EMPTY);
if (mi == null) {
String isName = "is" + StringUtil.ucFirst(prop);
mi = getMethodInstanceEL(null, clazz, KeyImpl.getInstance(isName), ArrayUtil.OBJECT_EMPTY);
if (mi != null) {
Method m = mi.getMethod();
Class rtn = m.getReturnType();
if (rtn != Boolean.class && rtn != boolean.class) mi = null;
}
}
if (mi == null) throw new ExpressionException("No matching property [" + prop + "] found in [" + Caster.toTypeName(clazz) + "]");
Method m = mi.getMethod();
if (m.getReturnType() == void.class)
throw new NoSuchMethodException("invalid return Type, method [" + m.getName() + "] for Property [" + getterName + "] must have return type not void");
return mi;
} | java | public static MethodInstance getGetter(Class clazz, String prop) throws PageException, NoSuchMethodException {
String getterName = "get" + StringUtil.ucFirst(prop);
MethodInstance mi = getMethodInstanceEL(null, clazz, KeyImpl.getInstance(getterName), ArrayUtil.OBJECT_EMPTY);
if (mi == null) {
String isName = "is" + StringUtil.ucFirst(prop);
mi = getMethodInstanceEL(null, clazz, KeyImpl.getInstance(isName), ArrayUtil.OBJECT_EMPTY);
if (mi != null) {
Method m = mi.getMethod();
Class rtn = m.getReturnType();
if (rtn != Boolean.class && rtn != boolean.class) mi = null;
}
}
if (mi == null) throw new ExpressionException("No matching property [" + prop + "] found in [" + Caster.toTypeName(clazz) + "]");
Method m = mi.getMethod();
if (m.getReturnType() == void.class)
throw new NoSuchMethodException("invalid return Type, method [" + m.getName() + "] for Property [" + getterName + "] must have return type not void");
return mi;
} | [
"public",
"static",
"MethodInstance",
"getGetter",
"(",
"Class",
"clazz",
",",
"String",
"prop",
")",
"throws",
"PageException",
",",
"NoSuchMethodException",
"{",
"String",
"getterName",
"=",
"\"get\"",
"+",
"StringUtil",
".",
"ucFirst",
"(",
"prop",
")",
";",
"MethodInstance",
"mi",
"=",
"getMethodInstanceEL",
"(",
"null",
",",
"clazz",
",",
"KeyImpl",
".",
"getInstance",
"(",
"getterName",
")",
",",
"ArrayUtil",
".",
"OBJECT_EMPTY",
")",
";",
"if",
"(",
"mi",
"==",
"null",
")",
"{",
"String",
"isName",
"=",
"\"is\"",
"+",
"StringUtil",
".",
"ucFirst",
"(",
"prop",
")",
";",
"mi",
"=",
"getMethodInstanceEL",
"(",
"null",
",",
"clazz",
",",
"KeyImpl",
".",
"getInstance",
"(",
"isName",
")",
",",
"ArrayUtil",
".",
"OBJECT_EMPTY",
")",
";",
"if",
"(",
"mi",
"!=",
"null",
")",
"{",
"Method",
"m",
"=",
"mi",
".",
"getMethod",
"(",
")",
";",
"Class",
"rtn",
"=",
"m",
".",
"getReturnType",
"(",
")",
";",
"if",
"(",
"rtn",
"!=",
"Boolean",
".",
"class",
"&&",
"rtn",
"!=",
"boolean",
".",
"class",
")",
"mi",
"=",
"null",
";",
"}",
"}",
"if",
"(",
"mi",
"==",
"null",
")",
"throw",
"new",
"ExpressionException",
"(",
"\"No matching property [\"",
"+",
"prop",
"+",
"\"] found in [\"",
"+",
"Caster",
".",
"toTypeName",
"(",
"clazz",
")",
"+",
"\"]\"",
")",
";",
"Method",
"m",
"=",
"mi",
".",
"getMethod",
"(",
")",
";",
"if",
"(",
"m",
".",
"getReturnType",
"(",
")",
"==",
"void",
".",
"class",
")",
"throw",
"new",
"NoSuchMethodException",
"(",
"\"invalid return Type, method [\"",
"+",
"m",
".",
"getName",
"(",
")",
"+",
"\"] for Property [\"",
"+",
"getterName",
"+",
"\"] must have return type not void\"",
")",
";",
"return",
"mi",
";",
"}"
] | to get a Getter Method of a Object
@param clazz Class to invoke method from
@param prop Name of the Method without get
@return return Value of the getter Method
@throws NoSuchMethodException
@throws PageException | [
"to",
"get",
"a",
"Getter",
"Method",
"of",
"a",
"Object"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/reflection/Reflector.java#L946-L967 |
apache/predictionio-sdk-java | client/src/main/java/org/apache/predictionio/sdk/java/EventClient.java | EventClient.setUser | public String setUser(String uid, Map<String, Object> properties)
throws ExecutionException, InterruptedException, IOException {
"""
Sets properties of a user. Same as {@link #setUser(String, Map, DateTime)} except event time is
not specified and recorded as the time when the function is called.
"""
return setUser(uid, properties, new DateTime());
} | java | public String setUser(String uid, Map<String, Object> properties)
throws ExecutionException, InterruptedException, IOException {
return setUser(uid, properties, new DateTime());
} | [
"public",
"String",
"setUser",
"(",
"String",
"uid",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
")",
"throws",
"ExecutionException",
",",
"InterruptedException",
",",
"IOException",
"{",
"return",
"setUser",
"(",
"uid",
",",
"properties",
",",
"new",
"DateTime",
"(",
")",
")",
";",
"}"
] | Sets properties of a user. Same as {@link #setUser(String, Map, DateTime)} except event time is
not specified and recorded as the time when the function is called. | [
"Sets",
"properties",
"of",
"a",
"user",
".",
"Same",
"as",
"{"
] | train | https://github.com/apache/predictionio-sdk-java/blob/16052c96b136340c175c3f9c2692e720850df219/client/src/main/java/org/apache/predictionio/sdk/java/EventClient.java#L333-L336 |
google/closure-templates | java/src/com/google/template/soy/error/SoyErrors.java | SoyErrors.getClosest | @Nullable
@VisibleForTesting
static String getClosest(Iterable<String> allNames, String wrongName) {
"""
Returns the member of {@code allNames} that is closest to {@code wrongName}, or {@code null} if
{@code allNames} is empty.
<p>The distance metric is a case insensitive Levenshtein distance.
@throws IllegalArgumentException if {@code wrongName} is a member of {@code allNames}
"""
// only suggest matches that are closer than this. This magic heuristic is based on what llvm
// and javac do
int shortest = (wrongName.length() + 2) / 3 + 1;
String closestName = null;
for (String otherName : allNames) {
if (otherName.equals(wrongName)) {
throw new IllegalArgumentException("'" + wrongName + "' is contained in " + allNames);
}
int distance = distance(otherName, wrongName, shortest);
if (distance < shortest) {
shortest = distance;
closestName = otherName;
if (distance == 0) {
return closestName;
}
}
}
return closestName;
} | java | @Nullable
@VisibleForTesting
static String getClosest(Iterable<String> allNames, String wrongName) {
// only suggest matches that are closer than this. This magic heuristic is based on what llvm
// and javac do
int shortest = (wrongName.length() + 2) / 3 + 1;
String closestName = null;
for (String otherName : allNames) {
if (otherName.equals(wrongName)) {
throw new IllegalArgumentException("'" + wrongName + "' is contained in " + allNames);
}
int distance = distance(otherName, wrongName, shortest);
if (distance < shortest) {
shortest = distance;
closestName = otherName;
if (distance == 0) {
return closestName;
}
}
}
return closestName;
} | [
"@",
"Nullable",
"@",
"VisibleForTesting",
"static",
"String",
"getClosest",
"(",
"Iterable",
"<",
"String",
">",
"allNames",
",",
"String",
"wrongName",
")",
"{",
"// only suggest matches that are closer than this. This magic heuristic is based on what llvm",
"// and javac do",
"int",
"shortest",
"=",
"(",
"wrongName",
".",
"length",
"(",
")",
"+",
"2",
")",
"/",
"3",
"+",
"1",
";",
"String",
"closestName",
"=",
"null",
";",
"for",
"(",
"String",
"otherName",
":",
"allNames",
")",
"{",
"if",
"(",
"otherName",
".",
"equals",
"(",
"wrongName",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"'\"",
"+",
"wrongName",
"+",
"\"' is contained in \"",
"+",
"allNames",
")",
";",
"}",
"int",
"distance",
"=",
"distance",
"(",
"otherName",
",",
"wrongName",
",",
"shortest",
")",
";",
"if",
"(",
"distance",
"<",
"shortest",
")",
"{",
"shortest",
"=",
"distance",
";",
"closestName",
"=",
"otherName",
";",
"if",
"(",
"distance",
"==",
"0",
")",
"{",
"return",
"closestName",
";",
"}",
"}",
"}",
"return",
"closestName",
";",
"}"
] | Returns the member of {@code allNames} that is closest to {@code wrongName}, or {@code null} if
{@code allNames} is empty.
<p>The distance metric is a case insensitive Levenshtein distance.
@throws IllegalArgumentException if {@code wrongName} is a member of {@code allNames} | [
"Returns",
"the",
"member",
"of",
"{",
"@code",
"allNames",
"}",
"that",
"is",
"closest",
"to",
"{",
"@code",
"wrongName",
"}",
"or",
"{",
"@code",
"null",
"}",
"if",
"{",
"@code",
"allNames",
"}",
"is",
"empty",
"."
] | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/error/SoyErrors.java#L69-L90 |
Netflix/conductor | client/src/main/java/com/netflix/conductor/client/http/MetadataClient.java | MetadataClient.getWorkflowDef | public WorkflowDef getWorkflowDef(String name, Integer version) {
"""
Retrieve the workflow definition
@param name the name of the workflow
@param version the version of the workflow def
@return Workflow definition for the given workflow and version
"""
Preconditions.checkArgument(StringUtils.isNotBlank(name), "name cannot be blank");
return getForEntity("metadata/workflow/{name}", new Object[]{"version", version}, WorkflowDef.class, name);
} | java | public WorkflowDef getWorkflowDef(String name, Integer version) {
Preconditions.checkArgument(StringUtils.isNotBlank(name), "name cannot be blank");
return getForEntity("metadata/workflow/{name}", new Object[]{"version", version}, WorkflowDef.class, name);
} | [
"public",
"WorkflowDef",
"getWorkflowDef",
"(",
"String",
"name",
",",
"Integer",
"version",
")",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"StringUtils",
".",
"isNotBlank",
"(",
"name",
")",
",",
"\"name cannot be blank\"",
")",
";",
"return",
"getForEntity",
"(",
"\"metadata/workflow/{name}\"",
",",
"new",
"Object",
"[",
"]",
"{",
"\"version\"",
",",
"version",
"}",
",",
"WorkflowDef",
".",
"class",
",",
"name",
")",
";",
"}"
] | Retrieve the workflow definition
@param name the name of the workflow
@param version the version of the workflow def
@return Workflow definition for the given workflow and version | [
"Retrieve",
"the",
"workflow",
"definition"
] | train | https://github.com/Netflix/conductor/blob/78fae0ed9ddea22891f9eebb96a2ec0b2783dca0/client/src/main/java/com/netflix/conductor/client/http/MetadataClient.java#L115-L118 |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/utils/files/FileUtilities.java | FileUtilities.deleteFileOrDir | public static boolean deleteFileOrDir( File filehandle ) throws IOException {
"""
Returns true if all deletions were successful. If a deletion fails, the method stops attempting to delete and
returns false.
@param filehandle the file or folder to remove.
@return true if all deletions were successful
@throws IOException
"""
if (filehandle.isDirectory()) {
Files.walkFileTree(Paths.get(filehandle.getAbsolutePath()), new SimpleFileVisitor<Path>(){
@Override
public FileVisitResult visitFile( Path file, BasicFileAttributes attrs ) throws IOException {
Files.delete(file);
return FileVisitResult.CONTINUE;
}
@Override
public FileVisitResult postVisitDirectory( Path dir, IOException exc ) throws IOException {
if (exc != null) {
throw exc;
}
Files.delete(dir);
return FileVisitResult.CONTINUE;
}
});
}
boolean isdel = filehandle.delete();
if (!isdel) {
// if it didn't work, which somtimes happens on windows systems,
// remove on exit
filehandle.deleteOnExit();
}
return isdel;
} | java | public static boolean deleteFileOrDir( File filehandle ) throws IOException {
if (filehandle.isDirectory()) {
Files.walkFileTree(Paths.get(filehandle.getAbsolutePath()), new SimpleFileVisitor<Path>(){
@Override
public FileVisitResult visitFile( Path file, BasicFileAttributes attrs ) throws IOException {
Files.delete(file);
return FileVisitResult.CONTINUE;
}
@Override
public FileVisitResult postVisitDirectory( Path dir, IOException exc ) throws IOException {
if (exc != null) {
throw exc;
}
Files.delete(dir);
return FileVisitResult.CONTINUE;
}
});
}
boolean isdel = filehandle.delete();
if (!isdel) {
// if it didn't work, which somtimes happens on windows systems,
// remove on exit
filehandle.deleteOnExit();
}
return isdel;
} | [
"public",
"static",
"boolean",
"deleteFileOrDir",
"(",
"File",
"filehandle",
")",
"throws",
"IOException",
"{",
"if",
"(",
"filehandle",
".",
"isDirectory",
"(",
")",
")",
"{",
"Files",
".",
"walkFileTree",
"(",
"Paths",
".",
"get",
"(",
"filehandle",
".",
"getAbsolutePath",
"(",
")",
")",
",",
"new",
"SimpleFileVisitor",
"<",
"Path",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"FileVisitResult",
"visitFile",
"(",
"Path",
"file",
",",
"BasicFileAttributes",
"attrs",
")",
"throws",
"IOException",
"{",
"Files",
".",
"delete",
"(",
"file",
")",
";",
"return",
"FileVisitResult",
".",
"CONTINUE",
";",
"}",
"@",
"Override",
"public",
"FileVisitResult",
"postVisitDirectory",
"(",
"Path",
"dir",
",",
"IOException",
"exc",
")",
"throws",
"IOException",
"{",
"if",
"(",
"exc",
"!=",
"null",
")",
"{",
"throw",
"exc",
";",
"}",
"Files",
".",
"delete",
"(",
"dir",
")",
";",
"return",
"FileVisitResult",
".",
"CONTINUE",
";",
"}",
"}",
")",
";",
"}",
"boolean",
"isdel",
"=",
"filehandle",
".",
"delete",
"(",
")",
";",
"if",
"(",
"!",
"isdel",
")",
"{",
"// if it didn't work, which somtimes happens on windows systems,",
"// remove on exit",
"filehandle",
".",
"deleteOnExit",
"(",
")",
";",
"}",
"return",
"isdel",
";",
"}"
] | Returns true if all deletions were successful. If a deletion fails, the method stops attempting to delete and
returns false.
@param filehandle the file or folder to remove.
@return true if all deletions were successful
@throws IOException | [
"Returns",
"true",
"if",
"all",
"deletions",
"were",
"successful",
".",
"If",
"a",
"deletion",
"fails",
"the",
"method",
"stops",
"attempting",
"to",
"delete",
"and",
"returns",
"false",
"."
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/files/FileUtilities.java#L64-L93 |
mcxiaoke/Android-Next | ui/src/main/java/com/mcxiaoke/next/ui/list/AdapterExtend.java | AdapterExtend.getView | @Override
public View getView(int position, View convertView, ViewGroup parent) {
"""
Get a View that displays the data at the specified
position in the data set. In this case, if we are at
the end of the list and we are still in append mode, we
ask for a pending view and return it, plus kick off the
background task to append more data to the wrapped
adapter.
@param position Position of the item whose data we want
@param convertView View to recycle, if not null
@param parent ViewGroup containing the returned View
"""
if (position == super.getCount() && isEnableRefreshing()) {
return (mFooter);
}
return (super.getView(position, convertView, parent));
} | java | @Override
public View getView(int position, View convertView, ViewGroup parent) {
if (position == super.getCount() && isEnableRefreshing()) {
return (mFooter);
}
return (super.getView(position, convertView, parent));
} | [
"@",
"Override",
"public",
"View",
"getView",
"(",
"int",
"position",
",",
"View",
"convertView",
",",
"ViewGroup",
"parent",
")",
"{",
"if",
"(",
"position",
"==",
"super",
".",
"getCount",
"(",
")",
"&&",
"isEnableRefreshing",
"(",
")",
")",
"{",
"return",
"(",
"mFooter",
")",
";",
"}",
"return",
"(",
"super",
".",
"getView",
"(",
"position",
",",
"convertView",
",",
"parent",
")",
")",
";",
"}"
] | Get a View that displays the data at the specified
position in the data set. In this case, if we are at
the end of the list and we are still in append mode, we
ask for a pending view and return it, plus kick off the
background task to append more data to the wrapped
adapter.
@param position Position of the item whose data we want
@param convertView View to recycle, if not null
@param parent ViewGroup containing the returned View | [
"Get",
"a",
"View",
"that",
"displays",
"the",
"data",
"at",
"the",
"specified",
"position",
"in",
"the",
"data",
"set",
".",
"In",
"this",
"case",
"if",
"we",
"are",
"at",
"the",
"end",
"of",
"the",
"list",
"and",
"we",
"are",
"still",
"in",
"append",
"mode",
"we",
"ask",
"for",
"a",
"pending",
"view",
"and",
"return",
"it",
"plus",
"kick",
"off",
"the",
"background",
"task",
"to",
"append",
"more",
"data",
"to",
"the",
"wrapped",
"adapter",
"."
] | train | https://github.com/mcxiaoke/Android-Next/blob/1bfdf99d0b81a849aa0fa6697c53ed673151ca39/ui/src/main/java/com/mcxiaoke/next/ui/list/AdapterExtend.java#L146-L152 |
apache/flink | flink-table/flink-table-common/src/main/java/org/apache/flink/table/api/TableSchema.java | TableSchema.fromTypeInfo | public static TableSchema fromTypeInfo(TypeInformation<?> typeInfo) {
"""
Creates a table schema from a {@link TypeInformation} instance. If the type information is
a {@link CompositeType}, the field names and types for the composite type are used to
construct the {@link TableSchema} instance. Otherwise, a table schema with a single field
is created. The field name is "f0" and the field type the provided type.
@param typeInfo The {@link TypeInformation} from which the table schema is generated.
@return The table schema that was generated from the given {@link TypeInformation}.
"""
if (typeInfo instanceof CompositeType<?>) {
final CompositeType<?> compositeType = (CompositeType<?>) typeInfo;
// get field names and types from composite type
final String[] fieldNames = compositeType.getFieldNames();
final TypeInformation<?>[] fieldTypes = new TypeInformation[fieldNames.length];
for (int i = 0; i < fieldTypes.length; i++) {
fieldTypes[i] = compositeType.getTypeAt(i);
}
return new TableSchema(fieldNames, fieldTypes);
} else {
// create table schema with a single field named "f0" of the given type.
return new TableSchema(
new String[]{ATOMIC_TYPE_FIELD_NAME},
new TypeInformation<?>[]{typeInfo});
}
} | java | public static TableSchema fromTypeInfo(TypeInformation<?> typeInfo) {
if (typeInfo instanceof CompositeType<?>) {
final CompositeType<?> compositeType = (CompositeType<?>) typeInfo;
// get field names and types from composite type
final String[] fieldNames = compositeType.getFieldNames();
final TypeInformation<?>[] fieldTypes = new TypeInformation[fieldNames.length];
for (int i = 0; i < fieldTypes.length; i++) {
fieldTypes[i] = compositeType.getTypeAt(i);
}
return new TableSchema(fieldNames, fieldTypes);
} else {
// create table schema with a single field named "f0" of the given type.
return new TableSchema(
new String[]{ATOMIC_TYPE_FIELD_NAME},
new TypeInformation<?>[]{typeInfo});
}
} | [
"public",
"static",
"TableSchema",
"fromTypeInfo",
"(",
"TypeInformation",
"<",
"?",
">",
"typeInfo",
")",
"{",
"if",
"(",
"typeInfo",
"instanceof",
"CompositeType",
"<",
"?",
">",
")",
"{",
"final",
"CompositeType",
"<",
"?",
">",
"compositeType",
"=",
"(",
"CompositeType",
"<",
"?",
">",
")",
"typeInfo",
";",
"// get field names and types from composite type",
"final",
"String",
"[",
"]",
"fieldNames",
"=",
"compositeType",
".",
"getFieldNames",
"(",
")",
";",
"final",
"TypeInformation",
"<",
"?",
">",
"[",
"]",
"fieldTypes",
"=",
"new",
"TypeInformation",
"[",
"fieldNames",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"fieldTypes",
".",
"length",
";",
"i",
"++",
")",
"{",
"fieldTypes",
"[",
"i",
"]",
"=",
"compositeType",
".",
"getTypeAt",
"(",
"i",
")",
";",
"}",
"return",
"new",
"TableSchema",
"(",
"fieldNames",
",",
"fieldTypes",
")",
";",
"}",
"else",
"{",
"// create table schema with a single field named \"f0\" of the given type.",
"return",
"new",
"TableSchema",
"(",
"new",
"String",
"[",
"]",
"{",
"ATOMIC_TYPE_FIELD_NAME",
"}",
",",
"new",
"TypeInformation",
"<",
"?",
">",
"[",
"]",
"{",
"typeInfo",
"}",
")",
";",
"}",
"}"
] | Creates a table schema from a {@link TypeInformation} instance. If the type information is
a {@link CompositeType}, the field names and types for the composite type are used to
construct the {@link TableSchema} instance. Otherwise, a table schema with a single field
is created. The field name is "f0" and the field type the provided type.
@param typeInfo The {@link TypeInformation} from which the table schema is generated.
@return The table schema that was generated from the given {@link TypeInformation}. | [
"Creates",
"a",
"table",
"schema",
"from",
"a",
"{",
"@link",
"TypeInformation",
"}",
"instance",
".",
"If",
"the",
"type",
"information",
"is",
"a",
"{",
"@link",
"CompositeType",
"}",
"the",
"field",
"names",
"and",
"types",
"for",
"the",
"composite",
"type",
"are",
"used",
"to",
"construct",
"the",
"{",
"@link",
"TableSchema",
"}",
"instance",
".",
"Otherwise",
"a",
"table",
"schema",
"with",
"a",
"single",
"field",
"is",
"created",
".",
"The",
"field",
"name",
"is",
"f0",
"and",
"the",
"field",
"type",
"the",
"provided",
"type",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-common/src/main/java/org/apache/flink/table/api/TableSchema.java#L216-L232 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/config/Config.java | Config.setRingbufferConfigs | public Config setRingbufferConfigs(Map<String, RingbufferConfig> ringbufferConfigs) {
"""
Sets the map of {@link com.hazelcast.ringbuffer.Ringbuffer} configurations,
mapped by config name. The config name may be a pattern with which the
configuration will be obtained in the future.
@param ringbufferConfigs the ringbuffer configuration map to set
@return this config instance
"""
this.ringbufferConfigs.clear();
this.ringbufferConfigs.putAll(ringbufferConfigs);
for (Entry<String, RingbufferConfig> entry : ringbufferConfigs.entrySet()) {
entry.getValue().setName(entry.getKey());
}
return this;
} | java | public Config setRingbufferConfigs(Map<String, RingbufferConfig> ringbufferConfigs) {
this.ringbufferConfigs.clear();
this.ringbufferConfigs.putAll(ringbufferConfigs);
for (Entry<String, RingbufferConfig> entry : ringbufferConfigs.entrySet()) {
entry.getValue().setName(entry.getKey());
}
return this;
} | [
"public",
"Config",
"setRingbufferConfigs",
"(",
"Map",
"<",
"String",
",",
"RingbufferConfig",
">",
"ringbufferConfigs",
")",
"{",
"this",
".",
"ringbufferConfigs",
".",
"clear",
"(",
")",
";",
"this",
".",
"ringbufferConfigs",
".",
"putAll",
"(",
"ringbufferConfigs",
")",
";",
"for",
"(",
"Entry",
"<",
"String",
",",
"RingbufferConfig",
">",
"entry",
":",
"ringbufferConfigs",
".",
"entrySet",
"(",
")",
")",
"{",
"entry",
".",
"getValue",
"(",
")",
".",
"setName",
"(",
"entry",
".",
"getKey",
"(",
")",
")",
";",
"}",
"return",
"this",
";",
"}"
] | Sets the map of {@link com.hazelcast.ringbuffer.Ringbuffer} configurations,
mapped by config name. The config name may be a pattern with which the
configuration will be obtained in the future.
@param ringbufferConfigs the ringbuffer configuration map to set
@return this config instance | [
"Sets",
"the",
"map",
"of",
"{",
"@link",
"com",
".",
"hazelcast",
".",
"ringbuffer",
".",
"Ringbuffer",
"}",
"configurations",
"mapped",
"by",
"config",
"name",
".",
"The",
"config",
"name",
"may",
"be",
"a",
"pattern",
"with",
"which",
"the",
"configuration",
"will",
"be",
"obtained",
"in",
"the",
"future",
"."
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/config/Config.java#L1296-L1303 |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java | JBBPDslBuilder.UShortArray | public JBBPDslBuilder UShortArray(final String name, final String sizeExpression) {
"""
Add named fixed unsigned short array which size calculated through expression.
@param name name of the field, if null then anonymous
@param sizeExpression expression to be used to calculate size, must not be null
@return the builder instance, must not be null
"""
final Item item = new Item(BinType.USHORT_ARRAY, name, this.byteOrder);
item.sizeExpression = assertExpressionChars(sizeExpression);
this.addItem(item);
return this;
} | java | public JBBPDslBuilder UShortArray(final String name, final String sizeExpression) {
final Item item = new Item(BinType.USHORT_ARRAY, name, this.byteOrder);
item.sizeExpression = assertExpressionChars(sizeExpression);
this.addItem(item);
return this;
} | [
"public",
"JBBPDslBuilder",
"UShortArray",
"(",
"final",
"String",
"name",
",",
"final",
"String",
"sizeExpression",
")",
"{",
"final",
"Item",
"item",
"=",
"new",
"Item",
"(",
"BinType",
".",
"USHORT_ARRAY",
",",
"name",
",",
"this",
".",
"byteOrder",
")",
";",
"item",
".",
"sizeExpression",
"=",
"assertExpressionChars",
"(",
"sizeExpression",
")",
";",
"this",
".",
"addItem",
"(",
"item",
")",
";",
"return",
"this",
";",
"}"
] | Add named fixed unsigned short array which size calculated through expression.
@param name name of the field, if null then anonymous
@param sizeExpression expression to be used to calculate size, must not be null
@return the builder instance, must not be null | [
"Add",
"named",
"fixed",
"unsigned",
"short",
"array",
"which",
"size",
"calculated",
"through",
"expression",
"."
] | train | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java#L1058-L1063 |
Carbonado/Carbonado | src/main/java/com/amazon/carbonado/gen/StorableGenerator.java | StorableGenerator.loadThisProperty | private void loadThisProperty(CodeBuilder b, StorableProperty property) {
"""
Loads the property value of the current storable onto the stack. If the
property is derived the read method is used, otherwise it just loads the
value from the appropriate field.
entry stack: [
exit stack: [value
@param b - {@link CodeBuilder} to which to add the load code
@param property - property to load
"""
loadThisProperty(b, property, TypeDesc.forClass(property.getType()));
} | java | private void loadThisProperty(CodeBuilder b, StorableProperty property) {
loadThisProperty(b, property, TypeDesc.forClass(property.getType()));
} | [
"private",
"void",
"loadThisProperty",
"(",
"CodeBuilder",
"b",
",",
"StorableProperty",
"property",
")",
"{",
"loadThisProperty",
"(",
"b",
",",
"property",
",",
"TypeDesc",
".",
"forClass",
"(",
"property",
".",
"getType",
"(",
")",
")",
")",
";",
"}"
] | Loads the property value of the current storable onto the stack. If the
property is derived the read method is used, otherwise it just loads the
value from the appropriate field.
entry stack: [
exit stack: [value
@param b - {@link CodeBuilder} to which to add the load code
@param property - property to load | [
"Loads",
"the",
"property",
"value",
"of",
"the",
"current",
"storable",
"onto",
"the",
"stack",
".",
"If",
"the",
"property",
"is",
"derived",
"the",
"read",
"method",
"is",
"used",
"otherwise",
"it",
"just",
"loads",
"the",
"value",
"from",
"the",
"appropriate",
"field",
"."
] | train | https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/gen/StorableGenerator.java#L2061-L2063 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/SourceLineAnnotation.java | SourceLineAnnotation.createUnknown | public static SourceLineAnnotation createUnknown(@DottedClassName String className, String sourceFile) {
"""
Factory method to create an unknown source line annotation.
@param className
the class name
@param sourceFile
the source file name
@return the SourceLineAnnotation
"""
return createUnknown(className, sourceFile, -1, -1);
} | java | public static SourceLineAnnotation createUnknown(@DottedClassName String className, String sourceFile) {
return createUnknown(className, sourceFile, -1, -1);
} | [
"public",
"static",
"SourceLineAnnotation",
"createUnknown",
"(",
"@",
"DottedClassName",
"String",
"className",
",",
"String",
"sourceFile",
")",
"{",
"return",
"createUnknown",
"(",
"className",
",",
"sourceFile",
",",
"-",
"1",
",",
"-",
"1",
")",
";",
"}"
] | Factory method to create an unknown source line annotation.
@param className
the class name
@param sourceFile
the source file name
@return the SourceLineAnnotation | [
"Factory",
"method",
"to",
"create",
"an",
"unknown",
"source",
"line",
"annotation",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/SourceLineAnnotation.java#L167-L169 |
fhoeben/hsac-fitnesse-fixtures | src/main/java/nl/hsac/fitnesse/fixture/util/FileUtil.java | FileUtil.loadFile | public static String loadFile(String filename) {
"""
Reads content of UTF-8 file on classpath to String.
@param filename file to read.
@return file's content.
@throws IllegalArgumentException if file could not be found.
@throws IllegalStateException if file could not be read.
"""
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
InputStream is = classLoader.getResourceAsStream(filename);
if (is == null) {
throw new IllegalArgumentException("Unable to locate: " + filename);
}
return streamToString(is, filename);
} | java | public static String loadFile(String filename) {
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
InputStream is = classLoader.getResourceAsStream(filename);
if (is == null) {
throw new IllegalArgumentException("Unable to locate: " + filename);
}
return streamToString(is, filename);
} | [
"public",
"static",
"String",
"loadFile",
"(",
"String",
"filename",
")",
"{",
"ClassLoader",
"classLoader",
"=",
"Thread",
".",
"currentThread",
"(",
")",
".",
"getContextClassLoader",
"(",
")",
";",
"InputStream",
"is",
"=",
"classLoader",
".",
"getResourceAsStream",
"(",
"filename",
")",
";",
"if",
"(",
"is",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Unable to locate: \"",
"+",
"filename",
")",
";",
"}",
"return",
"streamToString",
"(",
"is",
",",
"filename",
")",
";",
"}"
] | Reads content of UTF-8 file on classpath to String.
@param filename file to read.
@return file's content.
@throws IllegalArgumentException if file could not be found.
@throws IllegalStateException if file could not be read. | [
"Reads",
"content",
"of",
"UTF",
"-",
"8",
"file",
"on",
"classpath",
"to",
"String",
"."
] | train | https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/FileUtil.java#L38-L45 |
ehcache/ehcache3 | impl/src/main/java/org/ehcache/config/builders/CacheConfigurationBuilder.java | CacheConfigurationBuilder.withValueCopier | public CacheConfigurationBuilder<K, V> withValueCopier(Copier<V> valueCopier) {
"""
Adds by-value semantic using the provided {@link Copier} for the value on heap.
<p>
{@link Copier}s are what enable control of by-reference / by-value semantics for on-heap tier.
@param valueCopier the value copier to use
@return a new builder with the added value copier
"""
return withCopier(new DefaultCopierConfiguration<>(requireNonNull(valueCopier, "Null value copier"), DefaultCopierConfiguration.Type.VALUE));
} | java | public CacheConfigurationBuilder<K, V> withValueCopier(Copier<V> valueCopier) {
return withCopier(new DefaultCopierConfiguration<>(requireNonNull(valueCopier, "Null value copier"), DefaultCopierConfiguration.Type.VALUE));
} | [
"public",
"CacheConfigurationBuilder",
"<",
"K",
",",
"V",
">",
"withValueCopier",
"(",
"Copier",
"<",
"V",
">",
"valueCopier",
")",
"{",
"return",
"withCopier",
"(",
"new",
"DefaultCopierConfiguration",
"<>",
"(",
"requireNonNull",
"(",
"valueCopier",
",",
"\"Null value copier\"",
")",
",",
"DefaultCopierConfiguration",
".",
"Type",
".",
"VALUE",
")",
")",
";",
"}"
] | Adds by-value semantic using the provided {@link Copier} for the value on heap.
<p>
{@link Copier}s are what enable control of by-reference / by-value semantics for on-heap tier.
@param valueCopier the value copier to use
@return a new builder with the added value copier | [
"Adds",
"by",
"-",
"value",
"semantic",
"using",
"the",
"provided",
"{",
"@link",
"Copier",
"}",
"for",
"the",
"value",
"on",
"heap",
".",
"<p",
">",
"{",
"@link",
"Copier",
"}",
"s",
"are",
"what",
"enable",
"control",
"of",
"by",
"-",
"reference",
"/",
"by",
"-",
"value",
"semantics",
"for",
"on",
"-",
"heap",
"tier",
"."
] | train | https://github.com/ehcache/ehcache3/blob/3cceda57185e522f8d241ddb75146d67ee2af898/impl/src/main/java/org/ehcache/config/builders/CacheConfigurationBuilder.java#L432-L434 |
Azure/azure-sdk-for-java | containerregistry/resource-manager/v2017_06_01_preview/src/main/java/com/microsoft/azure/management/containerregistry/v2017_06_01_preview/implementation/ReplicationsInner.java | ReplicationsInner.beginCreateAsync | public Observable<ReplicationInner> beginCreateAsync(String resourceGroupName, String registryName, String replicationName, ReplicationInner replication) {
"""
Creates a replication for a container registry with the specified parameters.
@param resourceGroupName The name of the resource group to which the container registry belongs.
@param registryName The name of the container registry.
@param replicationName The name of the replication.
@param replication The parameters for creating a replication.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ReplicationInner object
"""
return beginCreateWithServiceResponseAsync(resourceGroupName, registryName, replicationName, replication).map(new Func1<ServiceResponse<ReplicationInner>, ReplicationInner>() {
@Override
public ReplicationInner call(ServiceResponse<ReplicationInner> response) {
return response.body();
}
});
} | java | public Observable<ReplicationInner> beginCreateAsync(String resourceGroupName, String registryName, String replicationName, ReplicationInner replication) {
return beginCreateWithServiceResponseAsync(resourceGroupName, registryName, replicationName, replication).map(new Func1<ServiceResponse<ReplicationInner>, ReplicationInner>() {
@Override
public ReplicationInner call(ServiceResponse<ReplicationInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ReplicationInner",
">",
"beginCreateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"registryName",
",",
"String",
"replicationName",
",",
"ReplicationInner",
"replication",
")",
"{",
"return",
"beginCreateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"registryName",
",",
"replicationName",
",",
"replication",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"ReplicationInner",
">",
",",
"ReplicationInner",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"ReplicationInner",
"call",
"(",
"ServiceResponse",
"<",
"ReplicationInner",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Creates a replication for a container registry with the specified parameters.
@param resourceGroupName The name of the resource group to which the container registry belongs.
@param registryName The name of the container registry.
@param replicationName The name of the replication.
@param replication The parameters for creating a replication.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ReplicationInner object | [
"Creates",
"a",
"replication",
"for",
"a",
"container",
"registry",
"with",
"the",
"specified",
"parameters",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerregistry/resource-manager/v2017_06_01_preview/src/main/java/com/microsoft/azure/management/containerregistry/v2017_06_01_preview/implementation/ReplicationsInner.java#L323-L330 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/util/sequence/SequenceManagerHelper.java | SequenceManagerHelper.firstFoundTableName | private static String firstFoundTableName(PersistenceBroker brokerForClass, ClassDescriptor cld) {
"""
try to find the first none null table name for the given class-descriptor.
If cld has extent classes, all of these cld's searched for the first none null
table name.
"""
String name = null;
if (!cld.isInterface() && cld.getFullTableName() != null)
{
return cld.getFullTableName();
}
if (cld.isExtent())
{
Collection extentClasses = cld.getExtentClasses();
for (Iterator iterator = extentClasses.iterator(); iterator.hasNext();)
{
name = firstFoundTableName(brokerForClass, brokerForClass.getClassDescriptor((Class) iterator.next()));
// System.out.println("## " + cld.getClassNameOfObject()+" - name: "+name);
if (name != null) break;
}
}
return name;
} | java | private static String firstFoundTableName(PersistenceBroker brokerForClass, ClassDescriptor cld)
{
String name = null;
if (!cld.isInterface() && cld.getFullTableName() != null)
{
return cld.getFullTableName();
}
if (cld.isExtent())
{
Collection extentClasses = cld.getExtentClasses();
for (Iterator iterator = extentClasses.iterator(); iterator.hasNext();)
{
name = firstFoundTableName(brokerForClass, brokerForClass.getClassDescriptor((Class) iterator.next()));
// System.out.println("## " + cld.getClassNameOfObject()+" - name: "+name);
if (name != null) break;
}
}
return name;
} | [
"private",
"static",
"String",
"firstFoundTableName",
"(",
"PersistenceBroker",
"brokerForClass",
",",
"ClassDescriptor",
"cld",
")",
"{",
"String",
"name",
"=",
"null",
";",
"if",
"(",
"!",
"cld",
".",
"isInterface",
"(",
")",
"&&",
"cld",
".",
"getFullTableName",
"(",
")",
"!=",
"null",
")",
"{",
"return",
"cld",
".",
"getFullTableName",
"(",
")",
";",
"}",
"if",
"(",
"cld",
".",
"isExtent",
"(",
")",
")",
"{",
"Collection",
"extentClasses",
"=",
"cld",
".",
"getExtentClasses",
"(",
")",
";",
"for",
"(",
"Iterator",
"iterator",
"=",
"extentClasses",
".",
"iterator",
"(",
")",
";",
"iterator",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"name",
"=",
"firstFoundTableName",
"(",
"brokerForClass",
",",
"brokerForClass",
".",
"getClassDescriptor",
"(",
"(",
"Class",
")",
"iterator",
".",
"next",
"(",
")",
")",
")",
";",
"// System.out.println(\"## \" + cld.getClassNameOfObject()+\" - name: \"+name);\r",
"if",
"(",
"name",
"!=",
"null",
")",
"break",
";",
"}",
"}",
"return",
"name",
";",
"}"
] | try to find the first none null table name for the given class-descriptor.
If cld has extent classes, all of these cld's searched for the first none null
table name. | [
"try",
"to",
"find",
"the",
"first",
"none",
"null",
"table",
"name",
"for",
"the",
"given",
"class",
"-",
"descriptor",
".",
"If",
"cld",
"has",
"extent",
"classes",
"all",
"of",
"these",
"cld",
"s",
"searched",
"for",
"the",
"first",
"none",
"null",
"table",
"name",
"."
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/util/sequence/SequenceManagerHelper.java#L220-L238 |
alkacon/opencms-core | src-setup/org/opencms/setup/xml/CmsXmlConfigUpdater.java | CmsXmlConfigUpdater.getConfigFiles | private List<File> getConfigFiles() {
"""
Gets existing config files.
@return the existing config files
"""
String[] filenames = {
"opencms-modules.xml",
"opencms-system.xml",
"opencms-vfs.xml",
"opencms-importexport.xml",
"opencms-sites.xml",
"opencms-variables.xml",
"opencms-scheduler.xml",
"opencms-workplace.xml",
"opencms-search.xml"};
List<File> result = new ArrayList<>();
for (String fn : filenames) {
File file = new File(m_configDir, fn);
if (file.exists()) {
result.add(file);
}
}
return result;
} | java | private List<File> getConfigFiles() {
String[] filenames = {
"opencms-modules.xml",
"opencms-system.xml",
"opencms-vfs.xml",
"opencms-importexport.xml",
"opencms-sites.xml",
"opencms-variables.xml",
"opencms-scheduler.xml",
"opencms-workplace.xml",
"opencms-search.xml"};
List<File> result = new ArrayList<>();
for (String fn : filenames) {
File file = new File(m_configDir, fn);
if (file.exists()) {
result.add(file);
}
}
return result;
} | [
"private",
"List",
"<",
"File",
">",
"getConfigFiles",
"(",
")",
"{",
"String",
"[",
"]",
"filenames",
"=",
"{",
"\"opencms-modules.xml\"",
",",
"\"opencms-system.xml\"",
",",
"\"opencms-vfs.xml\"",
",",
"\"opencms-importexport.xml\"",
",",
"\"opencms-sites.xml\"",
",",
"\"opencms-variables.xml\"",
",",
"\"opencms-scheduler.xml\"",
",",
"\"opencms-workplace.xml\"",
",",
"\"opencms-search.xml\"",
"}",
";",
"List",
"<",
"File",
">",
"result",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"String",
"fn",
":",
"filenames",
")",
"{",
"File",
"file",
"=",
"new",
"File",
"(",
"m_configDir",
",",
"fn",
")",
";",
"if",
"(",
"file",
".",
"exists",
"(",
")",
")",
"{",
"result",
".",
"add",
"(",
"file",
")",
";",
"}",
"}",
"return",
"result",
";",
"}"
] | Gets existing config files.
@return the existing config files | [
"Gets",
"existing",
"config",
"files",
"."
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-setup/org/opencms/setup/xml/CmsXmlConfigUpdater.java#L274-L294 |
javactic/javactic | src/main/java/com/github/javactic/Accumulation.java | Accumulation.when | @SuppressWarnings("unchecked")
@SafeVarargs
public static <G, ERR> Or<G, Every<ERR>>
when(Or<? extends G, ? extends Every<? extends ERR>> or, Function<? super G, ? extends Validation<ERR>>... validations) {
"""
Enables further validation on an existing accumulating Or by passing validation functions.
@param <G> the Good type of the argument Or
@param <ERR> the type of the error message contained in the accumulating failure
@param or the accumulating or
@param validations the validation functions
@return the original or if it passed all validations or a Bad with all failures
"""
return when(or, Stream.of(validations));
} | java | @SuppressWarnings("unchecked")
@SafeVarargs
public static <G, ERR> Or<G, Every<ERR>>
when(Or<? extends G, ? extends Every<? extends ERR>> or, Function<? super G, ? extends Validation<ERR>>... validations) {
return when(or, Stream.of(validations));
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"@",
"SafeVarargs",
"public",
"static",
"<",
"G",
",",
"ERR",
">",
"Or",
"<",
"G",
",",
"Every",
"<",
"ERR",
">",
">",
"when",
"(",
"Or",
"<",
"?",
"extends",
"G",
",",
"?",
"extends",
"Every",
"<",
"?",
"extends",
"ERR",
">",
">",
"or",
",",
"Function",
"<",
"?",
"super",
"G",
",",
"?",
"extends",
"Validation",
"<",
"ERR",
">",
">",
"...",
"validations",
")",
"{",
"return",
"when",
"(",
"or",
",",
"Stream",
".",
"of",
"(",
"validations",
")",
")",
";",
"}"
] | Enables further validation on an existing accumulating Or by passing validation functions.
@param <G> the Good type of the argument Or
@param <ERR> the type of the error message contained in the accumulating failure
@param or the accumulating or
@param validations the validation functions
@return the original or if it passed all validations or a Bad with all failures | [
"Enables",
"further",
"validation",
"on",
"an",
"existing",
"accumulating",
"Or",
"by",
"passing",
"validation",
"functions",
"."
] | train | https://github.com/javactic/javactic/blob/dfa040062178c259c3067fd9b59cb4498022d8bc/src/main/java/com/github/javactic/Accumulation.java#L161-L166 |
bingoohuang/excel2javabeans | src/main/java/com/github/bingoohuang/excel2beans/BeansToExcelOnTemplate.java | BeansToExcelOnTemplate.fixCellValue | private void fixCellValue(MergeRow mergeRowAnn, int fromRow, int col) {
"""
修复合并单元格的数据。
1. 去除指导合并的取值前缀,例如1^a中的1^;
@param mergeRowAnn 纵向合并单元格注解。
@param fromRow 开始合并行索引。
@param col 纵向列索引。
"""
val sep = mergeRowAnn.prefixSeperate();
if (StringUtils.isEmpty(sep)) return;
val cell = sheet.getRow(fromRow).getCell(col);
val old = PoiUtil.getCellStringValue(cell);
val fixed = substringAfterSep(old, sep);
PoiUtil.writeCellValue(cell, fixed);
} | java | private void fixCellValue(MergeRow mergeRowAnn, int fromRow, int col) {
val sep = mergeRowAnn.prefixSeperate();
if (StringUtils.isEmpty(sep)) return;
val cell = sheet.getRow(fromRow).getCell(col);
val old = PoiUtil.getCellStringValue(cell);
val fixed = substringAfterSep(old, sep);
PoiUtil.writeCellValue(cell, fixed);
} | [
"private",
"void",
"fixCellValue",
"(",
"MergeRow",
"mergeRowAnn",
",",
"int",
"fromRow",
",",
"int",
"col",
")",
"{",
"val",
"sep",
"=",
"mergeRowAnn",
".",
"prefixSeperate",
"(",
")",
";",
"if",
"(",
"StringUtils",
".",
"isEmpty",
"(",
"sep",
")",
")",
"return",
";",
"val",
"cell",
"=",
"sheet",
".",
"getRow",
"(",
"fromRow",
")",
".",
"getCell",
"(",
"col",
")",
";",
"val",
"old",
"=",
"PoiUtil",
".",
"getCellStringValue",
"(",
"cell",
")",
";",
"val",
"fixed",
"=",
"substringAfterSep",
"(",
"old",
",",
"sep",
")",
";",
"PoiUtil",
".",
"writeCellValue",
"(",
"cell",
",",
"fixed",
")",
";",
"}"
] | 修复合并单元格的数据。
1. 去除指导合并的取值前缀,例如1^a中的1^;
@param mergeRowAnn 纵向合并单元格注解。
@param fromRow 开始合并行索引。
@param col 纵向列索引。 | [
"修复合并单元格的数据。",
"1",
".",
"去除指导合并的取值前缀,例如1^a中的1^",
";"
] | train | https://github.com/bingoohuang/excel2javabeans/blob/db136d460b93b649814366c0d84a982698b96dc3/src/main/java/com/github/bingoohuang/excel2beans/BeansToExcelOnTemplate.java#L197-L206 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/evaluation/classification/EvaluationCalibration.java | EvaluationCalibration.getResidualPlot | public Histogram getResidualPlot(int labelClassIdx) {
"""
Get the residual plot, only for examples of the specified class.. The residual plot is defined as a histogram of<br>
|label_i - prob(class_i | input)| for all and examples; for this particular method, only predictions where
i == labelClassIdx are included.<br>
In general, small residuals indicate a superior classifier to large residuals.
@param labelClassIdx Index of the class to get the residual plot for
@return Residual plot (histogram) - all predictions/classes
"""
String title = "Residual Plot - Predictions for Label Class " + labelClassIdx;
int[] counts = residualPlotByLabelClass.getColumn(labelClassIdx).dup().data().asInt();
return new Histogram(title, 0.0, 1.0, counts);
} | java | public Histogram getResidualPlot(int labelClassIdx) {
String title = "Residual Plot - Predictions for Label Class " + labelClassIdx;
int[] counts = residualPlotByLabelClass.getColumn(labelClassIdx).dup().data().asInt();
return new Histogram(title, 0.0, 1.0, counts);
} | [
"public",
"Histogram",
"getResidualPlot",
"(",
"int",
"labelClassIdx",
")",
"{",
"String",
"title",
"=",
"\"Residual Plot - Predictions for Label Class \"",
"+",
"labelClassIdx",
";",
"int",
"[",
"]",
"counts",
"=",
"residualPlotByLabelClass",
".",
"getColumn",
"(",
"labelClassIdx",
")",
".",
"dup",
"(",
")",
".",
"data",
"(",
")",
".",
"asInt",
"(",
")",
";",
"return",
"new",
"Histogram",
"(",
"title",
",",
"0.0",
",",
"1.0",
",",
"counts",
")",
";",
"}"
] | Get the residual plot, only for examples of the specified class.. The residual plot is defined as a histogram of<br>
|label_i - prob(class_i | input)| for all and examples; for this particular method, only predictions where
i == labelClassIdx are included.<br>
In general, small residuals indicate a superior classifier to large residuals.
@param labelClassIdx Index of the class to get the residual plot for
@return Residual plot (histogram) - all predictions/classes | [
"Get",
"the",
"residual",
"plot",
"only",
"for",
"examples",
"of",
"the",
"specified",
"class",
"..",
"The",
"residual",
"plot",
"is",
"defined",
"as",
"a",
"histogram",
"of<br",
">",
"|label_i",
"-",
"prob",
"(",
"class_i",
"|",
"input",
")",
"|",
"for",
"all",
"and",
"examples",
";",
"for",
"this",
"particular",
"method",
"only",
"predictions",
"where",
"i",
"==",
"labelClassIdx",
"are",
"included",
".",
"<br",
">",
"In",
"general",
"small",
"residuals",
"indicate",
"a",
"superior",
"classifier",
"to",
"large",
"residuals",
"."
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/evaluation/classification/EvaluationCalibration.java#L443-L447 |
netty/netty | handler/src/main/java/io/netty/handler/ssl/SslContext.java | SslContext.newServerContext | @Deprecated
public static SslContext newServerContext(File certChainFile, File keyFile) throws SSLException {
"""
Creates a new server-side {@link SslContext}.
@param certChainFile an X.509 certificate chain file in PEM format
@param keyFile a PKCS#8 private key file in PEM format
@return a new server-side {@link SslContext}
@deprecated Replaced by {@link SslContextBuilder}
"""
return newServerContext(certChainFile, keyFile, null);
} | java | @Deprecated
public static SslContext newServerContext(File certChainFile, File keyFile) throws SSLException {
return newServerContext(certChainFile, keyFile, null);
} | [
"@",
"Deprecated",
"public",
"static",
"SslContext",
"newServerContext",
"(",
"File",
"certChainFile",
",",
"File",
"keyFile",
")",
"throws",
"SSLException",
"{",
"return",
"newServerContext",
"(",
"certChainFile",
",",
"keyFile",
",",
"null",
")",
";",
"}"
] | Creates a new server-side {@link SslContext}.
@param certChainFile an X.509 certificate chain file in PEM format
@param keyFile a PKCS#8 private key file in PEM format
@return a new server-side {@link SslContext}
@deprecated Replaced by {@link SslContextBuilder} | [
"Creates",
"a",
"new",
"server",
"-",
"side",
"{",
"@link",
"SslContext",
"}",
"."
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/SslContext.java#L135-L138 |
icode/ameba-utils | src/main/java/ameba/util/bean/BeanMap.java | BeanMap.put | @Override
public Object put(String name, Object value) throws IllegalArgumentException, ClassCastException {
"""
{@inheritDoc}
Sets the bean property with the given name to the given value.
"""
if (bean != null) {
Object oldValue = get(name);
BeanInvoker invoker = getWriteInvoker(name);
if (invoker == null) {
return null;
}
try {
if (value instanceof BeanMap) {
value = ((BeanMap) value).bean;
}
invoker.invoke(value);
Object newValue = get(name);
firePropertyChange(name, oldValue, newValue);
} catch (Throwable e) {
throw new IllegalArgumentException(e.getMessage());
}
return oldValue;
}
return null;
} | java | @Override
public Object put(String name, Object value) throws IllegalArgumentException, ClassCastException {
if (bean != null) {
Object oldValue = get(name);
BeanInvoker invoker = getWriteInvoker(name);
if (invoker == null) {
return null;
}
try {
if (value instanceof BeanMap) {
value = ((BeanMap) value).bean;
}
invoker.invoke(value);
Object newValue = get(name);
firePropertyChange(name, oldValue, newValue);
} catch (Throwable e) {
throw new IllegalArgumentException(e.getMessage());
}
return oldValue;
}
return null;
} | [
"@",
"Override",
"public",
"Object",
"put",
"(",
"String",
"name",
",",
"Object",
"value",
")",
"throws",
"IllegalArgumentException",
",",
"ClassCastException",
"{",
"if",
"(",
"bean",
"!=",
"null",
")",
"{",
"Object",
"oldValue",
"=",
"get",
"(",
"name",
")",
";",
"BeanInvoker",
"invoker",
"=",
"getWriteInvoker",
"(",
"name",
")",
";",
"if",
"(",
"invoker",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"try",
"{",
"if",
"(",
"value",
"instanceof",
"BeanMap",
")",
"{",
"value",
"=",
"(",
"(",
"BeanMap",
")",
"value",
")",
".",
"bean",
";",
"}",
"invoker",
".",
"invoke",
"(",
"value",
")",
";",
"Object",
"newValue",
"=",
"get",
"(",
"name",
")",
";",
"firePropertyChange",
"(",
"name",
",",
"oldValue",
",",
"newValue",
")",
";",
"}",
"catch",
"(",
"Throwable",
"e",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"return",
"oldValue",
";",
"}",
"return",
"null",
";",
"}"
] | {@inheritDoc}
Sets the bean property with the given name to the given value. | [
"{",
"@inheritDoc",
"}"
] | train | https://github.com/icode/ameba-utils/blob/1aad5317a22e546c83dfe2dc0c80a1dc1fa0ea35/src/main/java/ameba/util/bean/BeanMap.java#L255-L278 |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/alg/misc/ImageBandMath.java | ImageBandMath.stdDev | public static void stdDev(Planar<GrayU8> input, GrayU8 output, @Nullable GrayU8 avg) {
"""
Computes the standard deviation for each pixel across all bands in the {@link Planar}
image.
@param input Planar image - not modified
@param output Gray scale image containing average pixel values - modified
@param avg Input Gray scale image containing average image. Can be null
"""
stdDev(input,output,avg,0,input.getNumBands() - 1);
} | java | public static void stdDev(Planar<GrayU8> input, GrayU8 output, @Nullable GrayU8 avg) {
stdDev(input,output,avg,0,input.getNumBands() - 1);
} | [
"public",
"static",
"void",
"stdDev",
"(",
"Planar",
"<",
"GrayU8",
">",
"input",
",",
"GrayU8",
"output",
",",
"@",
"Nullable",
"GrayU8",
"avg",
")",
"{",
"stdDev",
"(",
"input",
",",
"output",
",",
"avg",
",",
"0",
",",
"input",
".",
"getNumBands",
"(",
")",
"-",
"1",
")",
";",
"}"
] | Computes the standard deviation for each pixel across all bands in the {@link Planar}
image.
@param input Planar image - not modified
@param output Gray scale image containing average pixel values - modified
@param avg Input Gray scale image containing average image. Can be null | [
"Computes",
"the",
"standard",
"deviation",
"for",
"each",
"pixel",
"across",
"all",
"bands",
"in",
"the",
"{"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/misc/ImageBandMath.java#L195-L197 |
lessthanoptimal/BoofCV | main/boofcv-types/src/main/java/boofcv/concurrency/BoofConcurrency.java | BoofConcurrency.loopFor | public static void loopFor(int start , int endExclusive , int step , IntConsumer consumer ) {
"""
Concurrent for loop. Each loop with spawn as a thread up to the maximum number of threads.
@param start starting value, inclusive
@param endExclusive ending value, exclusive
@param consumer The consumer
"""
try {
int range = endExclusive-start;
pool.submit(() ->IntStream.range(0, range/step).parallel().forEach(i-> consumer.accept(start+i*step))).get();
} catch (InterruptedException | ExecutionException e) {
e.printStackTrace();
}
} | java | public static void loopFor(int start , int endExclusive , int step , IntConsumer consumer ) {
try {
int range = endExclusive-start;
pool.submit(() ->IntStream.range(0, range/step).parallel().forEach(i-> consumer.accept(start+i*step))).get();
} catch (InterruptedException | ExecutionException e) {
e.printStackTrace();
}
} | [
"public",
"static",
"void",
"loopFor",
"(",
"int",
"start",
",",
"int",
"endExclusive",
",",
"int",
"step",
",",
"IntConsumer",
"consumer",
")",
"{",
"try",
"{",
"int",
"range",
"=",
"endExclusive",
"-",
"start",
";",
"pool",
".",
"submit",
"(",
"(",
")",
"->",
"IntStream",
".",
"range",
"(",
"0",
",",
"range",
"/",
"step",
")",
".",
"parallel",
"(",
")",
".",
"forEach",
"(",
"i",
"->",
"consumer",
".",
"accept",
"(",
"start",
"+",
"i",
"*",
"step",
")",
")",
")",
".",
"get",
"(",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"|",
"ExecutionException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"}"
] | Concurrent for loop. Each loop with spawn as a thread up to the maximum number of threads.
@param start starting value, inclusive
@param endExclusive ending value, exclusive
@param consumer The consumer | [
"Concurrent",
"for",
"loop",
".",
"Each",
"loop",
"with",
"spawn",
"as",
"a",
"thread",
"up",
"to",
"the",
"maximum",
"number",
"of",
"threads",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-types/src/main/java/boofcv/concurrency/BoofConcurrency.java#L75-L82 |
samskivert/samskivert | src/main/java/com/samskivert/net/PathUtil.java | PathUtil.computeRelativePath | public static String computeRelativePath (File file, File relativeTo)
throws IOException {
"""
Computes a relative path between to Files
@param file the file we're referencing
@param relativeTo the path from which we want to refer to the file
"""
String[] realDirs = getCanonicalPathElements(file);
String[] relativeToDirs = getCanonicalPathElements(relativeTo);
// Eliminate the common root
int common = 0;
for (; common < realDirs.length && common < relativeToDirs.length; common++) {
if (!realDirs[common].equals(relativeToDirs[common])) {
break;
}
}
String relativePath = "";
// For each remaining level in the file path, add a ..
for (int ii = 0; ii < (realDirs.length - common); ii++) {
relativePath += ".." + File.separator;
}
// For each level in the resource path, add the path
for (; common < relativeToDirs.length; common++) {
relativePath += relativeToDirs[common] + File.separator;
}
return relativePath;
} | java | public static String computeRelativePath (File file, File relativeTo)
throws IOException
{
String[] realDirs = getCanonicalPathElements(file);
String[] relativeToDirs = getCanonicalPathElements(relativeTo);
// Eliminate the common root
int common = 0;
for (; common < realDirs.length && common < relativeToDirs.length; common++) {
if (!realDirs[common].equals(relativeToDirs[common])) {
break;
}
}
String relativePath = "";
// For each remaining level in the file path, add a ..
for (int ii = 0; ii < (realDirs.length - common); ii++) {
relativePath += ".." + File.separator;
}
// For each level in the resource path, add the path
for (; common < relativeToDirs.length; common++) {
relativePath += relativeToDirs[common] + File.separator;
}
return relativePath;
} | [
"public",
"static",
"String",
"computeRelativePath",
"(",
"File",
"file",
",",
"File",
"relativeTo",
")",
"throws",
"IOException",
"{",
"String",
"[",
"]",
"realDirs",
"=",
"getCanonicalPathElements",
"(",
"file",
")",
";",
"String",
"[",
"]",
"relativeToDirs",
"=",
"getCanonicalPathElements",
"(",
"relativeTo",
")",
";",
"// Eliminate the common root",
"int",
"common",
"=",
"0",
";",
"for",
"(",
";",
"common",
"<",
"realDirs",
".",
"length",
"&&",
"common",
"<",
"relativeToDirs",
".",
"length",
";",
"common",
"++",
")",
"{",
"if",
"(",
"!",
"realDirs",
"[",
"common",
"]",
".",
"equals",
"(",
"relativeToDirs",
"[",
"common",
"]",
")",
")",
"{",
"break",
";",
"}",
"}",
"String",
"relativePath",
"=",
"\"\"",
";",
"// For each remaining level in the file path, add a ..",
"for",
"(",
"int",
"ii",
"=",
"0",
";",
"ii",
"<",
"(",
"realDirs",
".",
"length",
"-",
"common",
")",
";",
"ii",
"++",
")",
"{",
"relativePath",
"+=",
"\"..\"",
"+",
"File",
".",
"separator",
";",
"}",
"// For each level in the resource path, add the path",
"for",
"(",
";",
"common",
"<",
"relativeToDirs",
".",
"length",
";",
"common",
"++",
")",
"{",
"relativePath",
"+=",
"relativeToDirs",
"[",
"common",
"]",
"+",
"File",
".",
"separator",
";",
"}",
"return",
"relativePath",
";",
"}"
] | Computes a relative path between to Files
@param file the file we're referencing
@param relativeTo the path from which we want to refer to the file | [
"Computes",
"a",
"relative",
"path",
"between",
"to",
"Files"
] | train | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/net/PathUtil.java#L82-L109 |
devnied/EMV-NFC-Paycard-Enrollment | library/src/main/java/com/github/devnied/emvnfccard/utils/TrackUtils.java | TrackUtils.extractTrack2EquivalentData | public static EmvTrack2 extractTrack2EquivalentData(final byte[] pRawTrack2) {
"""
Extract track 2 Equivalent data
@param pRawTrack2 Raw track 2 data
@return EmvTrack2 object data or null
"""
EmvTrack2 ret = null;
if (pRawTrack2 != null) {
EmvTrack2 track2 = new EmvTrack2();
track2.setRaw(pRawTrack2);
String data = BytesUtils.bytesToStringNoSpace(pRawTrack2);
Matcher m = TRACK2_EQUIVALENT_PATTERN.matcher(data);
// Check pattern
if (m.find()) {
// read card number
track2.setCardNumber(m.group(1));
// Read expire date
SimpleDateFormat sdf = new SimpleDateFormat("yyMM", Locale.getDefault());
try {
track2.setExpireDate(DateUtils.truncate(sdf.parse(m.group(2)), Calendar.MONTH));
} catch (ParseException e) {
LOGGER.error("Unparsable expire card date : {}", e.getMessage());
return ret;
}
// Read service
track2.setService(new Service(m.group(3)));
ret = track2;
}
}
return ret;
} | java | public static EmvTrack2 extractTrack2EquivalentData(final byte[] pRawTrack2) {
EmvTrack2 ret = null;
if (pRawTrack2 != null) {
EmvTrack2 track2 = new EmvTrack2();
track2.setRaw(pRawTrack2);
String data = BytesUtils.bytesToStringNoSpace(pRawTrack2);
Matcher m = TRACK2_EQUIVALENT_PATTERN.matcher(data);
// Check pattern
if (m.find()) {
// read card number
track2.setCardNumber(m.group(1));
// Read expire date
SimpleDateFormat sdf = new SimpleDateFormat("yyMM", Locale.getDefault());
try {
track2.setExpireDate(DateUtils.truncate(sdf.parse(m.group(2)), Calendar.MONTH));
} catch (ParseException e) {
LOGGER.error("Unparsable expire card date : {}", e.getMessage());
return ret;
}
// Read service
track2.setService(new Service(m.group(3)));
ret = track2;
}
}
return ret;
} | [
"public",
"static",
"EmvTrack2",
"extractTrack2EquivalentData",
"(",
"final",
"byte",
"[",
"]",
"pRawTrack2",
")",
"{",
"EmvTrack2",
"ret",
"=",
"null",
";",
"if",
"(",
"pRawTrack2",
"!=",
"null",
")",
"{",
"EmvTrack2",
"track2",
"=",
"new",
"EmvTrack2",
"(",
")",
";",
"track2",
".",
"setRaw",
"(",
"pRawTrack2",
")",
";",
"String",
"data",
"=",
"BytesUtils",
".",
"bytesToStringNoSpace",
"(",
"pRawTrack2",
")",
";",
"Matcher",
"m",
"=",
"TRACK2_EQUIVALENT_PATTERN",
".",
"matcher",
"(",
"data",
")",
";",
"// Check pattern",
"if",
"(",
"m",
".",
"find",
"(",
")",
")",
"{",
"// read card number",
"track2",
".",
"setCardNumber",
"(",
"m",
".",
"group",
"(",
"1",
")",
")",
";",
"// Read expire date",
"SimpleDateFormat",
"sdf",
"=",
"new",
"SimpleDateFormat",
"(",
"\"yyMM\"",
",",
"Locale",
".",
"getDefault",
"(",
")",
")",
";",
"try",
"{",
"track2",
".",
"setExpireDate",
"(",
"DateUtils",
".",
"truncate",
"(",
"sdf",
".",
"parse",
"(",
"m",
".",
"group",
"(",
"2",
")",
")",
",",
"Calendar",
".",
"MONTH",
")",
")",
";",
"}",
"catch",
"(",
"ParseException",
"e",
")",
"{",
"LOGGER",
".",
"error",
"(",
"\"Unparsable expire card date : {}\"",
",",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"return",
"ret",
";",
"}",
"// Read service",
"track2",
".",
"setService",
"(",
"new",
"Service",
"(",
"m",
".",
"group",
"(",
"3",
")",
")",
")",
";",
"ret",
"=",
"track2",
";",
"}",
"}",
"return",
"ret",
";",
"}"
] | Extract track 2 Equivalent data
@param pRawTrack2 Raw track 2 data
@return EmvTrack2 object data or null | [
"Extract",
"track",
"2",
"Equivalent",
"data"
] | train | https://github.com/devnied/EMV-NFC-Paycard-Enrollment/blob/bfbd3960708689154a7a75c8a9a934197d738a5b/library/src/main/java/com/github/devnied/emvnfccard/utils/TrackUtils.java#L70-L96 |
Azure/azure-sdk-for-java | sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabasesInner.java | DatabasesInner.beginResumeAsync | public Observable<Void> beginResumeAsync(String resourceGroupName, String serverName, String databaseName) {
"""
Resumes a data warehouse.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param databaseName The name of the data warehouse to resume.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponse} object if successful.
"""
return beginResumeWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | java | public Observable<Void> beginResumeAsync(String resourceGroupName, String serverName, String databaseName) {
return beginResumeWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"beginResumeAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"databaseName",
")",
"{",
"return",
"beginResumeWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"serverName",
",",
"databaseName",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"Void",
">",
",",
"Void",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Void",
"call",
"(",
"ServiceResponse",
"<",
"Void",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Resumes a data warehouse.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param databaseName The name of the data warehouse to resume.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponse} object if successful. | [
"Resumes",
"a",
"data",
"warehouse",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabasesInner.java#L439-L446 |
JetBrains/xodus | environment/src/main/java/jetbrains/exodus/tree/patricia/MutableNode.java | MutableNode.addRightChild | void addRightChild(final byte b, @NotNull final MutableNode child) {
"""
Adds child which is greater (i.e. its next byte greater) than any other.
@param b next byte of child suffix.
@param child child node.
"""
final ChildReference right = children.getRight();
if (right != null && (right.firstByte & 0xff) >= (b & 0xff)) {
throw new IllegalArgumentException();
}
children.putRight(new ChildReferenceMutable(b, child));
} | java | void addRightChild(final byte b, @NotNull final MutableNode child) {
final ChildReference right = children.getRight();
if (right != null && (right.firstByte & 0xff) >= (b & 0xff)) {
throw new IllegalArgumentException();
}
children.putRight(new ChildReferenceMutable(b, child));
} | [
"void",
"addRightChild",
"(",
"final",
"byte",
"b",
",",
"@",
"NotNull",
"final",
"MutableNode",
"child",
")",
"{",
"final",
"ChildReference",
"right",
"=",
"children",
".",
"getRight",
"(",
")",
";",
"if",
"(",
"right",
"!=",
"null",
"&&",
"(",
"right",
".",
"firstByte",
"&",
"0xff",
")",
">=",
"(",
"b",
"&",
"0xff",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
")",
";",
"}",
"children",
".",
"putRight",
"(",
"new",
"ChildReferenceMutable",
"(",
"b",
",",
"child",
")",
")",
";",
"}"
] | Adds child which is greater (i.e. its next byte greater) than any other.
@param b next byte of child suffix.
@param child child node. | [
"Adds",
"child",
"which",
"is",
"greater",
"(",
"i",
".",
"e",
".",
"its",
"next",
"byte",
"greater",
")",
"than",
"any",
"other",
"."
] | train | https://github.com/JetBrains/xodus/blob/7b3476c4e81db66f9c7529148c761605cc8eea6d/environment/src/main/java/jetbrains/exodus/tree/patricia/MutableNode.java#L176-L182 |
gallandarakhneorg/afc | core/maths/mathgeom/tobeincluded/src/d3/continuous/Quaternion.java | Quaternion.getAxis | @Pure
public final Vector3f getAxis() {
"""
Replies the rotation axis-angle represented by this quaternion.
@return the rotation axis-angle.
"""
double mag = this.x*this.x + this.y*this.y + this.z*this.z;
if ( mag > EPS ) {
mag = Math.sqrt(mag);
double invMag = 1f/mag;
return new Vector3f(
this.x*invMag,
this.y*invMag,
this.z*invMag);
}
return new Vector3f(0f, 0f, 1f);
} | java | @Pure
public final Vector3f getAxis() {
double mag = this.x*this.x + this.y*this.y + this.z*this.z;
if ( mag > EPS ) {
mag = Math.sqrt(mag);
double invMag = 1f/mag;
return new Vector3f(
this.x*invMag,
this.y*invMag,
this.z*invMag);
}
return new Vector3f(0f, 0f, 1f);
} | [
"@",
"Pure",
"public",
"final",
"Vector3f",
"getAxis",
"(",
")",
"{",
"double",
"mag",
"=",
"this",
".",
"x",
"*",
"this",
".",
"x",
"+",
"this",
".",
"y",
"*",
"this",
".",
"y",
"+",
"this",
".",
"z",
"*",
"this",
".",
"z",
";",
"if",
"(",
"mag",
">",
"EPS",
")",
"{",
"mag",
"=",
"Math",
".",
"sqrt",
"(",
"mag",
")",
";",
"double",
"invMag",
"=",
"1f",
"/",
"mag",
";",
"return",
"new",
"Vector3f",
"(",
"this",
".",
"x",
"*",
"invMag",
",",
"this",
".",
"y",
"*",
"invMag",
",",
"this",
".",
"z",
"*",
"invMag",
")",
";",
"}",
"return",
"new",
"Vector3f",
"(",
"0f",
",",
"0f",
",",
"1f",
")",
";",
"}"
] | Replies the rotation axis-angle represented by this quaternion.
@return the rotation axis-angle. | [
"Replies",
"the",
"rotation",
"axis",
"-",
"angle",
"represented",
"by",
"this",
"quaternion",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/Quaternion.java#L672-L686 |
citrusframework/citrus | modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/ReceiveMessageBuilder.java | ReceiveMessageBuilder.headerFragment | public T headerFragment(Object model) {
"""
Expect this message header data as model object which is marshalled to a character sequence using the default object to xml mapper that
is available in Spring bean application context.
@param model
@return
"""
Assert.notNull(applicationContext, "Citrus application context is not initialized!");
if (!CollectionUtils.isEmpty(applicationContext.getBeansOfType(Marshaller.class))) {
return headerFragment(model, applicationContext.getBean(Marshaller.class));
} else if (!CollectionUtils.isEmpty(applicationContext.getBeansOfType(ObjectMapper.class))) {
return headerFragment(model, applicationContext.getBean(ObjectMapper.class));
}
throw new CitrusRuntimeException("Unable to find default object mapper or marshaller in application context");
} | java | public T headerFragment(Object model) {
Assert.notNull(applicationContext, "Citrus application context is not initialized!");
if (!CollectionUtils.isEmpty(applicationContext.getBeansOfType(Marshaller.class))) {
return headerFragment(model, applicationContext.getBean(Marshaller.class));
} else if (!CollectionUtils.isEmpty(applicationContext.getBeansOfType(ObjectMapper.class))) {
return headerFragment(model, applicationContext.getBean(ObjectMapper.class));
}
throw new CitrusRuntimeException("Unable to find default object mapper or marshaller in application context");
} | [
"public",
"T",
"headerFragment",
"(",
"Object",
"model",
")",
"{",
"Assert",
".",
"notNull",
"(",
"applicationContext",
",",
"\"Citrus application context is not initialized!\"",
")",
";",
"if",
"(",
"!",
"CollectionUtils",
".",
"isEmpty",
"(",
"applicationContext",
".",
"getBeansOfType",
"(",
"Marshaller",
".",
"class",
")",
")",
")",
"{",
"return",
"headerFragment",
"(",
"model",
",",
"applicationContext",
".",
"getBean",
"(",
"Marshaller",
".",
"class",
")",
")",
";",
"}",
"else",
"if",
"(",
"!",
"CollectionUtils",
".",
"isEmpty",
"(",
"applicationContext",
".",
"getBeansOfType",
"(",
"ObjectMapper",
".",
"class",
")",
")",
")",
"{",
"return",
"headerFragment",
"(",
"model",
",",
"applicationContext",
".",
"getBean",
"(",
"ObjectMapper",
".",
"class",
")",
")",
";",
"}",
"throw",
"new",
"CitrusRuntimeException",
"(",
"\"Unable to find default object mapper or marshaller in application context\"",
")",
";",
"}"
] | Expect this message header data as model object which is marshalled to a character sequence using the default object to xml mapper that
is available in Spring bean application context.
@param model
@return | [
"Expect",
"this",
"message",
"header",
"data",
"as",
"model",
"object",
"which",
"is",
"marshalled",
"to",
"a",
"character",
"sequence",
"using",
"the",
"default",
"object",
"to",
"xml",
"mapper",
"that",
"is",
"available",
"in",
"Spring",
"bean",
"application",
"context",
"."
] | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/ReceiveMessageBuilder.java#L340-L350 |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.jwt/src/com/ibm/ws/security/jwt/utils/TokenBuilder.java | TokenBuilder.createTokenString | public String createTokenString(String builderConfigId) {
"""
create an MP-JWT token using the builder API. Assumes the user is already
authenticated.
@param builderConfigId
- the id of the builder element in server.xml
@return the token string, or null if a mandatory param was null or empty.
"""
try {
return createTokenString(builderConfigId, WSSubject.getRunAsSubject(), null, null);
// JwtBuilder builder = JwtBuilder.create(builderConfigId);
//
// // all the "normal" stuff like issuer, aud, etc. is handled
// // by the builder, we only need to add the mp-jwt things
// // that the builder is not already aware of.
// String user = getUserName();
// builder.subject(user);
// builder.claim(USER_CLAIM, user);
//
// ArrayList<String> groups = getGroups();
// if (isValidList(groups)) {
// builder.claim(GROUP_CLAIM, groups);
// }
//
// return builder.buildJwt().compact();
} catch (Exception e) {
// ffdc
return null;
}
} | java | public String createTokenString(String builderConfigId) {
try {
return createTokenString(builderConfigId, WSSubject.getRunAsSubject(), null, null);
// JwtBuilder builder = JwtBuilder.create(builderConfigId);
//
// // all the "normal" stuff like issuer, aud, etc. is handled
// // by the builder, we only need to add the mp-jwt things
// // that the builder is not already aware of.
// String user = getUserName();
// builder.subject(user);
// builder.claim(USER_CLAIM, user);
//
// ArrayList<String> groups = getGroups();
// if (isValidList(groups)) {
// builder.claim(GROUP_CLAIM, groups);
// }
//
// return builder.buildJwt().compact();
} catch (Exception e) {
// ffdc
return null;
}
} | [
"public",
"String",
"createTokenString",
"(",
"String",
"builderConfigId",
")",
"{",
"try",
"{",
"return",
"createTokenString",
"(",
"builderConfigId",
",",
"WSSubject",
".",
"getRunAsSubject",
"(",
")",
",",
"null",
",",
"null",
")",
";",
"// JwtBuilder builder = JwtBuilder.create(builderConfigId);",
"//",
"// // all the \"normal\" stuff like issuer, aud, etc. is handled",
"// // by the builder, we only need to add the mp-jwt things",
"// // that the builder is not already aware of.",
"// String user = getUserName();",
"// builder.subject(user);",
"// builder.claim(USER_CLAIM, user);",
"//",
"// ArrayList<String> groups = getGroups();",
"// if (isValidList(groups)) {",
"// builder.claim(GROUP_CLAIM, groups);",
"// }",
"//",
"// return builder.buildJwt().compact();",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"// ffdc",
"return",
"null",
";",
"}",
"}"
] | create an MP-JWT token using the builder API. Assumes the user is already
authenticated.
@param builderConfigId
- the id of the builder element in server.xml
@return the token string, or null if a mandatory param was null or empty. | [
"create",
"an",
"MP",
"-",
"JWT",
"token",
"using",
"the",
"builder",
"API",
".",
"Assumes",
"the",
"user",
"is",
"already",
"authenticated",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.jwt/src/com/ibm/ws/security/jwt/utils/TokenBuilder.java#L62-L87 |
baratine/baratine | framework/src/main/java/com/caucho/v5/vfs/Jar.java | Jar.createDepend | public static PersistentDependency createDepend(PathImpl backing, long digest) {
"""
Return a Jar for the path. If the backing already exists, return
the old jar.
"""
Jar jar = create(backing);
return new JarDigestDepend(jar.getJarDepend(), digest);
} | java | public static PersistentDependency createDepend(PathImpl backing, long digest)
{
Jar jar = create(backing);
return new JarDigestDepend(jar.getJarDepend(), digest);
} | [
"public",
"static",
"PersistentDependency",
"createDepend",
"(",
"PathImpl",
"backing",
",",
"long",
"digest",
")",
"{",
"Jar",
"jar",
"=",
"create",
"(",
"backing",
")",
";",
"return",
"new",
"JarDigestDepend",
"(",
"jar",
".",
"getJarDepend",
"(",
")",
",",
"digest",
")",
";",
"}"
] | Return a Jar for the path. If the backing already exists, return
the old jar. | [
"Return",
"a",
"Jar",
"for",
"the",
"path",
".",
"If",
"the",
"backing",
"already",
"exists",
"return",
"the",
"old",
"jar",
"."
] | train | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/vfs/Jar.java#L168-L173 |
hawkular/hawkular-agent | hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/LoggingJBossASClient.java | LoggingJBossASClient.getLoggerLevel | public String getLoggerLevel(String loggerName) throws Exception {
"""
Returns the level of the given logger.
@param loggerName the name of the logger (this is also known as the category name)
@return level of the logger
@throws Exception if the log level could not be obtained (typically because the logger doesn't exist)
"""
Address addr = Address.root().add(SUBSYSTEM, LOGGING, LOGGER, loggerName);
return getStringAttribute("level", addr);
} | java | public String getLoggerLevel(String loggerName) throws Exception {
Address addr = Address.root().add(SUBSYSTEM, LOGGING, LOGGER, loggerName);
return getStringAttribute("level", addr);
} | [
"public",
"String",
"getLoggerLevel",
"(",
"String",
"loggerName",
")",
"throws",
"Exception",
"{",
"Address",
"addr",
"=",
"Address",
".",
"root",
"(",
")",
".",
"add",
"(",
"SUBSYSTEM",
",",
"LOGGING",
",",
"LOGGER",
",",
"loggerName",
")",
";",
"return",
"getStringAttribute",
"(",
"\"level\"",
",",
"addr",
")",
";",
"}"
] | Returns the level of the given logger.
@param loggerName the name of the logger (this is also known as the category name)
@return level of the logger
@throws Exception if the log level could not be obtained (typically because the logger doesn't exist) | [
"Returns",
"the",
"level",
"of",
"the",
"given",
"logger",
"."
] | train | https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/LoggingJBossASClient.java#L56-L59 |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/vpc/VpcClient.java | VpcClient.createVpc | public CreateVpcResponse createVpc(String name, String cidr) {
"""
Create a vpc with the specified options.
@param name The name of vpc
@param cidr The CIDR of vpc
@return List of vpcId newly created
"""
CreateVpcRequest request = new CreateVpcRequest();
request.withName(name).withCidr(cidr);
return createVpc(request);
} | java | public CreateVpcResponse createVpc(String name, String cidr) {
CreateVpcRequest request = new CreateVpcRequest();
request.withName(name).withCidr(cidr);
return createVpc(request);
} | [
"public",
"CreateVpcResponse",
"createVpc",
"(",
"String",
"name",
",",
"String",
"cidr",
")",
"{",
"CreateVpcRequest",
"request",
"=",
"new",
"CreateVpcRequest",
"(",
")",
";",
"request",
".",
"withName",
"(",
"name",
")",
".",
"withCidr",
"(",
"cidr",
")",
";",
"return",
"createVpc",
"(",
"request",
")",
";",
"}"
] | Create a vpc with the specified options.
@param name The name of vpc
@param cidr The CIDR of vpc
@return List of vpcId newly created | [
"Create",
"a",
"vpc",
"with",
"the",
"specified",
"options",
"."
] | train | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/vpc/VpcClient.java#L156-L160 |
graphhopper/graphhopper | api/src/main/java/com/graphhopper/util/PointList.java | PointList.shallowCopy | public PointList shallowCopy(final int from, final int end, boolean makeImmutable) {
"""
Create a shallow copy of this Pointlist from from to end, excluding end.
@param makeImmutable makes this PointList immutable. If you don't ensure the consistency it might happen that due to changes of this
object, the shallow copy might contain incorrect or corrupt data.
"""
if (makeImmutable)
this.makeImmutable();
return new ShallowImmutablePointList(from, end, this);
} | java | public PointList shallowCopy(final int from, final int end, boolean makeImmutable) {
if (makeImmutable)
this.makeImmutable();
return new ShallowImmutablePointList(from, end, this);
} | [
"public",
"PointList",
"shallowCopy",
"(",
"final",
"int",
"from",
",",
"final",
"int",
"end",
",",
"boolean",
"makeImmutable",
")",
"{",
"if",
"(",
"makeImmutable",
")",
"this",
".",
"makeImmutable",
"(",
")",
";",
"return",
"new",
"ShallowImmutablePointList",
"(",
"from",
",",
"end",
",",
"this",
")",
";",
"}"
] | Create a shallow copy of this Pointlist from from to end, excluding end.
@param makeImmutable makes this PointList immutable. If you don't ensure the consistency it might happen that due to changes of this
object, the shallow copy might contain incorrect or corrupt data. | [
"Create",
"a",
"shallow",
"copy",
"of",
"this",
"Pointlist",
"from",
"from",
"to",
"end",
"excluding",
"end",
"."
] | train | https://github.com/graphhopper/graphhopper/blob/c235e306e6e823043cadcc41ead0e685bdebf737/api/src/main/java/com/graphhopper/util/PointList.java#L521-L525 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/PubSubInputHandler.java | PubSubInputHandler.sendNotFlushedMessage | @Override
public void sendNotFlushedMessage(SIBUuid8 target, SIBUuid12 streamID, long requestID) {
"""
/*
(non-Javadoc)
@see com.ibm.ws.sib.processor.impl.interfaces.DownstreamControl#sendNotFlushedMessage(com.ibm.ws.sib.utils.SIBUuid12, long)
Not called as flushQuery is processed by PubSubOuptutHandler
"""
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "sendNotFlushedMessage",
new Object[] { target, streamID, new Long(requestID) });
InvalidOperationException e =
new InvalidOperationException(nls.getFormattedMessage(
"INTERNAL_MESSAGING_ERROR_CWSIP0001",
new Object[] {
"com.ibm.ws.sib.processor.impl.PubSubInputHandler",
"1:3366:1.329.1.1" },
null));
SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0001",
new Object[] {
"com.ibm.ws.sib.processor.impl.PubSubInputHandler",
"1:3372:1.329.1.1" });
// FFDC
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.impl.PubSubInputHandler.sendNotFlushedMessage",
"1:3378:1.329.1.1",
this);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "sendNotFlushedMessage");
} | java | @Override
public void sendNotFlushedMessage(SIBUuid8 target, SIBUuid12 streamID, long requestID)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "sendNotFlushedMessage",
new Object[] { target, streamID, new Long(requestID) });
InvalidOperationException e =
new InvalidOperationException(nls.getFormattedMessage(
"INTERNAL_MESSAGING_ERROR_CWSIP0001",
new Object[] {
"com.ibm.ws.sib.processor.impl.PubSubInputHandler",
"1:3366:1.329.1.1" },
null));
SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0001",
new Object[] {
"com.ibm.ws.sib.processor.impl.PubSubInputHandler",
"1:3372:1.329.1.1" });
// FFDC
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.impl.PubSubInputHandler.sendNotFlushedMessage",
"1:3378:1.329.1.1",
this);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "sendNotFlushedMessage");
} | [
"@",
"Override",
"public",
"void",
"sendNotFlushedMessage",
"(",
"SIBUuid8",
"target",
",",
"SIBUuid12",
"streamID",
",",
"long",
"requestID",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"tc",
",",
"\"sendNotFlushedMessage\"",
",",
"new",
"Object",
"[",
"]",
"{",
"target",
",",
"streamID",
",",
"new",
"Long",
"(",
"requestID",
")",
"}",
")",
";",
"InvalidOperationException",
"e",
"=",
"new",
"InvalidOperationException",
"(",
"nls",
".",
"getFormattedMessage",
"(",
"\"INTERNAL_MESSAGING_ERROR_CWSIP0001\"",
",",
"new",
"Object",
"[",
"]",
"{",
"\"com.ibm.ws.sib.processor.impl.PubSubInputHandler\"",
",",
"\"1:3366:1.329.1.1\"",
"}",
",",
"null",
")",
")",
";",
"SibTr",
".",
"error",
"(",
"tc",
",",
"\"INTERNAL_MESSAGING_ERROR_CWSIP0001\"",
",",
"new",
"Object",
"[",
"]",
"{",
"\"com.ibm.ws.sib.processor.impl.PubSubInputHandler\"",
",",
"\"1:3372:1.329.1.1\"",
"}",
")",
";",
"// FFDC",
"FFDCFilter",
".",
"processException",
"(",
"e",
",",
"\"com.ibm.ws.sib.processor.impl.PubSubInputHandler.sendNotFlushedMessage\"",
",",
"\"1:3378:1.329.1.1\"",
",",
"this",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"exit",
"(",
"tc",
",",
"\"sendNotFlushedMessage\"",
")",
";",
"}"
] | /*
(non-Javadoc)
@see com.ibm.ws.sib.processor.impl.interfaces.DownstreamControl#sendNotFlushedMessage(com.ibm.ws.sib.utils.SIBUuid12, long)
Not called as flushQuery is processed by PubSubOuptutHandler | [
"/",
"*",
"(",
"non",
"-",
"Javadoc",
")"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/PubSubInputHandler.java#L3245-L3274 |
facebookarchive/hadoop-20 | src/core/org/apache/hadoop/io/compress/Lz4Codec.java | Lz4Codec.createCompressor | @Override
public Compressor createCompressor() {
"""
Create a new {@link Compressor} for use by this {@link CompressionCodec}.
@return a new compressor for use by this codec
"""
if (!isNativeCodeLoaded()) {
throw new RuntimeException("native lz4 library not available");
}
int bufferSize = conf.getInt(
IO_COMPRESSION_CODEC_LZ4_BUFFERSIZE_KEY,
IO_COMPRESSION_CODEC_LZ4_BUFFERSIZE_DEFAULT);
boolean useLz4HC = conf.getBoolean(
IO_COMPRESSION_CODEC_LZ4_USELZ4HC_KEY,
IO_COMPRESSION_CODEC_LZ4_USELZ4HC_DEFAULT);
return new Lz4Compressor(bufferSize, useLz4HC);
} | java | @Override
public Compressor createCompressor() {
if (!isNativeCodeLoaded()) {
throw new RuntimeException("native lz4 library not available");
}
int bufferSize = conf.getInt(
IO_COMPRESSION_CODEC_LZ4_BUFFERSIZE_KEY,
IO_COMPRESSION_CODEC_LZ4_BUFFERSIZE_DEFAULT);
boolean useLz4HC = conf.getBoolean(
IO_COMPRESSION_CODEC_LZ4_USELZ4HC_KEY,
IO_COMPRESSION_CODEC_LZ4_USELZ4HC_DEFAULT);
return new Lz4Compressor(bufferSize, useLz4HC);
} | [
"@",
"Override",
"public",
"Compressor",
"createCompressor",
"(",
")",
"{",
"if",
"(",
"!",
"isNativeCodeLoaded",
"(",
")",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"native lz4 library not available\"",
")",
";",
"}",
"int",
"bufferSize",
"=",
"conf",
".",
"getInt",
"(",
"IO_COMPRESSION_CODEC_LZ4_BUFFERSIZE_KEY",
",",
"IO_COMPRESSION_CODEC_LZ4_BUFFERSIZE_DEFAULT",
")",
";",
"boolean",
"useLz4HC",
"=",
"conf",
".",
"getBoolean",
"(",
"IO_COMPRESSION_CODEC_LZ4_USELZ4HC_KEY",
",",
"IO_COMPRESSION_CODEC_LZ4_USELZ4HC_DEFAULT",
")",
";",
"return",
"new",
"Lz4Compressor",
"(",
"bufferSize",
",",
"useLz4HC",
")",
";",
"}"
] | Create a new {@link Compressor} for use by this {@link CompressionCodec}.
@return a new compressor for use by this codec | [
"Create",
"a",
"new",
"{",
"@link",
"Compressor",
"}",
"for",
"use",
"by",
"this",
"{",
"@link",
"CompressionCodec",
"}",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/io/compress/Lz4Codec.java#L146-L158 |
dustin/java-memcached-client | src/main/java/net/spy/memcached/internal/OperationFuture.java | OperationFuture.getCas | public Long getCas() {
"""
Get the CAS for this operation.
The interrupted status of the current thread is cleared by this method.
Inspect the returned OperationStatus to check whether an interruption has taken place.
@throws UnsupportedOperationException If this is for an ASCII protocol
configured client.
@return the CAS for this operation or null if unsuccessful.
"""
if (cas == null) {
try {
get();
} catch (InterruptedException e) {
status = new OperationStatus(false, "Interrupted", StatusCode.INTERRUPTED);
} catch (ExecutionException e) {
getLogger().warn("Error getting cas of operation", e);
}
}
if (cas == null && status.isSuccess()) {
throw new UnsupportedOperationException("This operation doesn't return"
+ "a cas value.");
}
return cas;
} | java | public Long getCas() {
if (cas == null) {
try {
get();
} catch (InterruptedException e) {
status = new OperationStatus(false, "Interrupted", StatusCode.INTERRUPTED);
} catch (ExecutionException e) {
getLogger().warn("Error getting cas of operation", e);
}
}
if (cas == null && status.isSuccess()) {
throw new UnsupportedOperationException("This operation doesn't return"
+ "a cas value.");
}
return cas;
} | [
"public",
"Long",
"getCas",
"(",
")",
"{",
"if",
"(",
"cas",
"==",
"null",
")",
"{",
"try",
"{",
"get",
"(",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"e",
")",
"{",
"status",
"=",
"new",
"OperationStatus",
"(",
"false",
",",
"\"Interrupted\"",
",",
"StatusCode",
".",
"INTERRUPTED",
")",
";",
"}",
"catch",
"(",
"ExecutionException",
"e",
")",
"{",
"getLogger",
"(",
")",
".",
"warn",
"(",
"\"Error getting cas of operation\"",
",",
"e",
")",
";",
"}",
"}",
"if",
"(",
"cas",
"==",
"null",
"&&",
"status",
".",
"isSuccess",
"(",
")",
")",
"{",
"throw",
"new",
"UnsupportedOperationException",
"(",
"\"This operation doesn't return\"",
"+",
"\"a cas value.\"",
")",
";",
"}",
"return",
"cas",
";",
"}"
] | Get the CAS for this operation.
The interrupted status of the current thread is cleared by this method.
Inspect the returned OperationStatus to check whether an interruption has taken place.
@throws UnsupportedOperationException If this is for an ASCII protocol
configured client.
@return the CAS for this operation or null if unsuccessful. | [
"Get",
"the",
"CAS",
"for",
"this",
"operation",
"."
] | train | https://github.com/dustin/java-memcached-client/blob/c232307ad8e0c7ccc926e495dd7d5aad2d713318/src/main/java/net/spy/memcached/internal/OperationFuture.java#L218-L233 |
Azure/azure-sdk-for-java | mediaservices/data-plane/src/main/java/com/microsoft/windowsazure/services/media/models/ContentKeyAuthorizationPolicy.java | ContentKeyAuthorizationPolicy.unlinkOptions | public static EntityUnlinkOperation unlinkOptions(String contentKeyAuthorizationPolicyId,
String contentKeyAuthorizationPolicyOptionId) {
"""
Unlink content key authorization policy options.
@param assetId
the asset id
@param adpId
the Asset Delivery Policy id
@return the entity action operation
"""
return new EntityUnlinkOperation(ENTITY_SET, contentKeyAuthorizationPolicyId, "Options", contentKeyAuthorizationPolicyOptionId);
} | java | public static EntityUnlinkOperation unlinkOptions(String contentKeyAuthorizationPolicyId,
String contentKeyAuthorizationPolicyOptionId) {
return new EntityUnlinkOperation(ENTITY_SET, contentKeyAuthorizationPolicyId, "Options", contentKeyAuthorizationPolicyOptionId);
} | [
"public",
"static",
"EntityUnlinkOperation",
"unlinkOptions",
"(",
"String",
"contentKeyAuthorizationPolicyId",
",",
"String",
"contentKeyAuthorizationPolicyOptionId",
")",
"{",
"return",
"new",
"EntityUnlinkOperation",
"(",
"ENTITY_SET",
",",
"contentKeyAuthorizationPolicyId",
",",
"\"Options\"",
",",
"contentKeyAuthorizationPolicyOptionId",
")",
";",
"}"
] | Unlink content key authorization policy options.
@param assetId
the asset id
@param adpId
the Asset Delivery Policy id
@return the entity action operation | [
"Unlink",
"content",
"key",
"authorization",
"policy",
"options",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mediaservices/data-plane/src/main/java/com/microsoft/windowsazure/services/media/models/ContentKeyAuthorizationPolicy.java#L160-L163 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java | ModelsImpl.getHierarchicalEntityRole | public EntityRole getHierarchicalEntityRole(UUID appId, String versionId, UUID hEntityId, UUID roleId) {
"""
Get one entity role for a given entity.
@param appId The application ID.
@param versionId The version ID.
@param hEntityId The hierarchical entity extractor ID.
@param roleId entity role ID.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the EntityRole object if successful.
"""
return getHierarchicalEntityRoleWithServiceResponseAsync(appId, versionId, hEntityId, roleId).toBlocking().single().body();
} | java | public EntityRole getHierarchicalEntityRole(UUID appId, String versionId, UUID hEntityId, UUID roleId) {
return getHierarchicalEntityRoleWithServiceResponseAsync(appId, versionId, hEntityId, roleId).toBlocking().single().body();
} | [
"public",
"EntityRole",
"getHierarchicalEntityRole",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"UUID",
"hEntityId",
",",
"UUID",
"roleId",
")",
"{",
"return",
"getHierarchicalEntityRoleWithServiceResponseAsync",
"(",
"appId",
",",
"versionId",
",",
"hEntityId",
",",
"roleId",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
] | Get one entity role for a given entity.
@param appId The application ID.
@param versionId The version ID.
@param hEntityId The hierarchical entity extractor ID.
@param roleId entity role ID.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the EntityRole object if successful. | [
"Get",
"one",
"entity",
"role",
"for",
"a",
"given",
"entity",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L13160-L13162 |
intive-FDV/DynamicJasper | src/main/java/ar/com/fdvs/dj/core/layout/ClassicLayoutManager.java | ClassicLayoutManager.setTextAndClassToExpression | protected void setTextAndClassToExpression(JRDesignExpression expression, DJGroupVariable var, AbstractColumn col, String variableName) {
"""
If a variable has a DJValueFormatter, we must use it in the expression, otherwise, use plain $V{...}
@param expression
@param var
@param col
@param variableName
"""
if (var.getValueFormatter() != null){
expression.setText(var.getTextForValueFormatterExpression(variableName));
expression.setValueClassName(var.getValueFormatter().getClassName());
}
else if (col.getTextFormatter() != null) {
expression.setText("$V{" + variableName + "}");
expression.setValueClassName(col.getVariableClassName(var.getOperation()));
}
else {
expression.setText("$V{" + variableName + "}");
expression.setValueClassName(col.getVariableClassName(var.getOperation()));
}
} | java | protected void setTextAndClassToExpression(JRDesignExpression expression, DJGroupVariable var, AbstractColumn col, String variableName) {
if (var.getValueFormatter() != null){
expression.setText(var.getTextForValueFormatterExpression(variableName));
expression.setValueClassName(var.getValueFormatter().getClassName());
}
else if (col.getTextFormatter() != null) {
expression.setText("$V{" + variableName + "}");
expression.setValueClassName(col.getVariableClassName(var.getOperation()));
}
else {
expression.setText("$V{" + variableName + "}");
expression.setValueClassName(col.getVariableClassName(var.getOperation()));
}
} | [
"protected",
"void",
"setTextAndClassToExpression",
"(",
"JRDesignExpression",
"expression",
",",
"DJGroupVariable",
"var",
",",
"AbstractColumn",
"col",
",",
"String",
"variableName",
")",
"{",
"if",
"(",
"var",
".",
"getValueFormatter",
"(",
")",
"!=",
"null",
")",
"{",
"expression",
".",
"setText",
"(",
"var",
".",
"getTextForValueFormatterExpression",
"(",
"variableName",
")",
")",
";",
"expression",
".",
"setValueClassName",
"(",
"var",
".",
"getValueFormatter",
"(",
")",
".",
"getClassName",
"(",
")",
")",
";",
"}",
"else",
"if",
"(",
"col",
".",
"getTextFormatter",
"(",
")",
"!=",
"null",
")",
"{",
"expression",
".",
"setText",
"(",
"\"$V{\"",
"+",
"variableName",
"+",
"\"}\"",
")",
";",
"expression",
".",
"setValueClassName",
"(",
"col",
".",
"getVariableClassName",
"(",
"var",
".",
"getOperation",
"(",
")",
")",
")",
";",
"}",
"else",
"{",
"expression",
".",
"setText",
"(",
"\"$V{\"",
"+",
"variableName",
"+",
"\"}\"",
")",
";",
"expression",
".",
"setValueClassName",
"(",
"col",
".",
"getVariableClassName",
"(",
"var",
".",
"getOperation",
"(",
")",
")",
")",
";",
"}",
"}"
] | If a variable has a DJValueFormatter, we must use it in the expression, otherwise, use plain $V{...}
@param expression
@param var
@param col
@param variableName | [
"If",
"a",
"variable",
"has",
"a",
"DJValueFormatter",
"we",
"must",
"use",
"it",
"in",
"the",
"expression",
"otherwise",
"use",
"plain",
"$V",
"{",
"...",
"}"
] | train | https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/core/layout/ClassicLayoutManager.java#L1194-L1209 |
Azure/azure-sdk-for-java | edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/StorageAccountCredentialsInner.java | StorageAccountCredentialsInner.beginCreateOrUpdate | public StorageAccountCredentialInner beginCreateOrUpdate(String deviceName, String name, String resourceGroupName, StorageAccountCredentialInner storageAccountCredential) {
"""
Creates or updates the storage account credential.
@param deviceName The device name.
@param name The storage account credential name.
@param resourceGroupName The resource group name.
@param storageAccountCredential The storage account credential.
@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 StorageAccountCredentialInner object if successful.
"""
return beginCreateOrUpdateWithServiceResponseAsync(deviceName, name, resourceGroupName, storageAccountCredential).toBlocking().single().body();
} | java | public StorageAccountCredentialInner beginCreateOrUpdate(String deviceName, String name, String resourceGroupName, StorageAccountCredentialInner storageAccountCredential) {
return beginCreateOrUpdateWithServiceResponseAsync(deviceName, name, resourceGroupName, storageAccountCredential).toBlocking().single().body();
} | [
"public",
"StorageAccountCredentialInner",
"beginCreateOrUpdate",
"(",
"String",
"deviceName",
",",
"String",
"name",
",",
"String",
"resourceGroupName",
",",
"StorageAccountCredentialInner",
"storageAccountCredential",
")",
"{",
"return",
"beginCreateOrUpdateWithServiceResponseAsync",
"(",
"deviceName",
",",
"name",
",",
"resourceGroupName",
",",
"storageAccountCredential",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
] | Creates or updates the storage account credential.
@param deviceName The device name.
@param name The storage account credential name.
@param resourceGroupName The resource group name.
@param storageAccountCredential The storage account credential.
@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 StorageAccountCredentialInner object if successful. | [
"Creates",
"or",
"updates",
"the",
"storage",
"account",
"credential",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/StorageAccountCredentialsInner.java#L406-L408 |
Azure/azure-sdk-for-java | labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/LabsInner.java | LabsInner.addUsersAsync | public Observable<Void> addUsersAsync(String resourceGroupName, String labAccountName, String labName, List<String> emailAddresses) {
"""
Add users to a lab.
@param resourceGroupName The name of the resource group.
@param labAccountName The name of the lab Account.
@param labName The name of the lab.
@param emailAddresses List of user emails addresses to add to the lab.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponse} object if successful.
"""
return addUsersWithServiceResponseAsync(resourceGroupName, labAccountName, labName, emailAddresses).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | java | public Observable<Void> addUsersAsync(String resourceGroupName, String labAccountName, String labName, List<String> emailAddresses) {
return addUsersWithServiceResponseAsync(resourceGroupName, labAccountName, labName, emailAddresses).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"addUsersAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"labAccountName",
",",
"String",
"labName",
",",
"List",
"<",
"String",
">",
"emailAddresses",
")",
"{",
"return",
"addUsersWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"labAccountName",
",",
"labName",
",",
"emailAddresses",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"Void",
">",
",",
"Void",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Void",
"call",
"(",
"ServiceResponse",
"<",
"Void",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Add users to a lab.
@param resourceGroupName The name of the resource group.
@param labAccountName The name of the lab Account.
@param labName The name of the lab.
@param emailAddresses List of user emails addresses to add to the lab.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponse} object if successful. | [
"Add",
"users",
"to",
"a",
"lab",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/LabsInner.java#L964-L971 |
rundeck/rundeck | core/src/main/java/com/dtolabs/rundeck/core/plugins/JarPluginProviderLoader.java | JarPluginProviderLoader.createCachedJar | protected File createCachedJar(final File dir, final String jarName) throws PluginException {
"""
Creates a single cached version of the pluginJar located within pluginJarCacheDirectory
deleting all existing versions of pluginJar
@param jarName
"""
File cachedJar;
try {
cachedJar = new File(dir, jarName);
cachedJar.deleteOnExit();
FileUtils.fileCopy(pluginJar, cachedJar, true);
} catch (IOException e) {
throw new PluginException(e);
}
return cachedJar;
} | java | protected File createCachedJar(final File dir, final String jarName) throws PluginException {
File cachedJar;
try {
cachedJar = new File(dir, jarName);
cachedJar.deleteOnExit();
FileUtils.fileCopy(pluginJar, cachedJar, true);
} catch (IOException e) {
throw new PluginException(e);
}
return cachedJar;
} | [
"protected",
"File",
"createCachedJar",
"(",
"final",
"File",
"dir",
",",
"final",
"String",
"jarName",
")",
"throws",
"PluginException",
"{",
"File",
"cachedJar",
";",
"try",
"{",
"cachedJar",
"=",
"new",
"File",
"(",
"dir",
",",
"jarName",
")",
";",
"cachedJar",
".",
"deleteOnExit",
"(",
")",
";",
"FileUtils",
".",
"fileCopy",
"(",
"pluginJar",
",",
"cachedJar",
",",
"true",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"PluginException",
"(",
"e",
")",
";",
"}",
"return",
"cachedJar",
";",
"}"
] | Creates a single cached version of the pluginJar located within pluginJarCacheDirectory
deleting all existing versions of pluginJar
@param jarName | [
"Creates",
"a",
"single",
"cached",
"version",
"of",
"the",
"pluginJar",
"located",
"within",
"pluginJarCacheDirectory",
"deleting",
"all",
"existing",
"versions",
"of",
"pluginJar"
] | train | https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/plugins/JarPluginProviderLoader.java#L405-L415 |
Alluxio/alluxio | core/common/src/main/java/alluxio/concurrent/jsr/CompletableFuture.java | CompletableFuture.orpush | final void orpush(CompletableFuture<?> b, BiCompletion<?, ?, ?> c) {
"""
Pushes completion to this and b unless either done. Caller should first check that result and
b.result are both null.
"""
if (c != null) {
while (!tryPushStack(c)) {
if (result != null) {
lazySetNext(c, null);
break;
}
}
if (result != null)
c.tryFire(SYNC);
else
b.unipush(new CoCompletion(c));
}
} | java | final void orpush(CompletableFuture<?> b, BiCompletion<?, ?, ?> c) {
if (c != null) {
while (!tryPushStack(c)) {
if (result != null) {
lazySetNext(c, null);
break;
}
}
if (result != null)
c.tryFire(SYNC);
else
b.unipush(new CoCompletion(c));
}
} | [
"final",
"void",
"orpush",
"(",
"CompletableFuture",
"<",
"?",
">",
"b",
",",
"BiCompletion",
"<",
"?",
",",
"?",
",",
"?",
">",
"c",
")",
"{",
"if",
"(",
"c",
"!=",
"null",
")",
"{",
"while",
"(",
"!",
"tryPushStack",
"(",
"c",
")",
")",
"{",
"if",
"(",
"result",
"!=",
"null",
")",
"{",
"lazySetNext",
"(",
"c",
",",
"null",
")",
";",
"break",
";",
"}",
"}",
"if",
"(",
"result",
"!=",
"null",
")",
"c",
".",
"tryFire",
"(",
"SYNC",
")",
";",
"else",
"b",
".",
"unipush",
"(",
"new",
"CoCompletion",
"(",
"c",
")",
")",
";",
"}",
"}"
] | Pushes completion to this and b unless either done. Caller should first check that result and
b.result are both null. | [
"Pushes",
"completion",
"to",
"this",
"and",
"b",
"unless",
"either",
"done",
".",
"Caller",
"should",
"first",
"check",
"that",
"result",
"and",
"b",
".",
"result",
"are",
"both",
"null",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/concurrent/jsr/CompletableFuture.java#L1185-L1198 |
kiegroup/jbpm | jbpm-human-task/jbpm-human-task-audit/src/main/java/org/jbpm/services/task/lifecycle/listeners/BAMTaskEventListener.java | BAMTaskEventListener.createTask | protected BAMTaskSummaryImpl createTask(TaskEvent event, Status newStatus, BAMTaskWorker worker) {
"""
Creates or updates a bam task summary instance.
@param ti The source task
@param newStatus The new state for the task.
@param worker Perform additional operations to the bam task summary instance.
@return The created or updated bam task summary instance.
"""
BAMTaskSummaryImpl result = null;
Task ti = event.getTask();
TaskPersistenceContext persistenceContext = getPersistenceContext(((TaskContext)event.getTaskContext()).getPersistenceContext());
try {
if (ti == null) {
logger.error("The task instance does not exist.");
return result;
}
Status status = newStatus != null ? newStatus : ti.getTaskData().getStatus();
String actualOwner = "";
if (ti.getTaskData().getActualOwner() != null) {
actualOwner = ti.getTaskData().getActualOwner().getId();
}
result = new BAMTaskSummaryImpl(ti.getId(), ti.getName(), status.toString(), event.getEventDate(), actualOwner, ti.getTaskData().getProcessInstanceId());
if (worker != null) worker.createTask(result, ti);
persistenceContext.persist(result);
return result;
} finally {
cleanup(persistenceContext);
}
} | java | protected BAMTaskSummaryImpl createTask(TaskEvent event, Status newStatus, BAMTaskWorker worker) {
BAMTaskSummaryImpl result = null;
Task ti = event.getTask();
TaskPersistenceContext persistenceContext = getPersistenceContext(((TaskContext)event.getTaskContext()).getPersistenceContext());
try {
if (ti == null) {
logger.error("The task instance does not exist.");
return result;
}
Status status = newStatus != null ? newStatus : ti.getTaskData().getStatus();
String actualOwner = "";
if (ti.getTaskData().getActualOwner() != null) {
actualOwner = ti.getTaskData().getActualOwner().getId();
}
result = new BAMTaskSummaryImpl(ti.getId(), ti.getName(), status.toString(), event.getEventDate(), actualOwner, ti.getTaskData().getProcessInstanceId());
if (worker != null) worker.createTask(result, ti);
persistenceContext.persist(result);
return result;
} finally {
cleanup(persistenceContext);
}
} | [
"protected",
"BAMTaskSummaryImpl",
"createTask",
"(",
"TaskEvent",
"event",
",",
"Status",
"newStatus",
",",
"BAMTaskWorker",
"worker",
")",
"{",
"BAMTaskSummaryImpl",
"result",
"=",
"null",
";",
"Task",
"ti",
"=",
"event",
".",
"getTask",
"(",
")",
";",
"TaskPersistenceContext",
"persistenceContext",
"=",
"getPersistenceContext",
"(",
"(",
"(",
"TaskContext",
")",
"event",
".",
"getTaskContext",
"(",
")",
")",
".",
"getPersistenceContext",
"(",
")",
")",
";",
"try",
"{",
"if",
"(",
"ti",
"==",
"null",
")",
"{",
"logger",
".",
"error",
"(",
"\"The task instance does not exist.\"",
")",
";",
"return",
"result",
";",
"}",
"Status",
"status",
"=",
"newStatus",
"!=",
"null",
"?",
"newStatus",
":",
"ti",
".",
"getTaskData",
"(",
")",
".",
"getStatus",
"(",
")",
";",
"String",
"actualOwner",
"=",
"\"\"",
";",
"if",
"(",
"ti",
".",
"getTaskData",
"(",
")",
".",
"getActualOwner",
"(",
")",
"!=",
"null",
")",
"{",
"actualOwner",
"=",
"ti",
".",
"getTaskData",
"(",
")",
".",
"getActualOwner",
"(",
")",
".",
"getId",
"(",
")",
";",
"}",
"result",
"=",
"new",
"BAMTaskSummaryImpl",
"(",
"ti",
".",
"getId",
"(",
")",
",",
"ti",
".",
"getName",
"(",
")",
",",
"status",
".",
"toString",
"(",
")",
",",
"event",
".",
"getEventDate",
"(",
")",
",",
"actualOwner",
",",
"ti",
".",
"getTaskData",
"(",
")",
".",
"getProcessInstanceId",
"(",
")",
")",
";",
"if",
"(",
"worker",
"!=",
"null",
")",
"worker",
".",
"createTask",
"(",
"result",
",",
"ti",
")",
";",
"persistenceContext",
".",
"persist",
"(",
"result",
")",
";",
"return",
"result",
";",
"}",
"finally",
"{",
"cleanup",
"(",
"persistenceContext",
")",
";",
"}",
"}"
] | Creates or updates a bam task summary instance.
@param ti The source task
@param newStatus The new state for the task.
@param worker Perform additional operations to the bam task summary instance.
@return The created or updated bam task summary instance. | [
"Creates",
"or",
"updates",
"a",
"bam",
"task",
"summary",
"instance",
"."
] | train | https://github.com/kiegroup/jbpm/blob/c3473c728aa382ebbea01e380c5e754a96647b82/jbpm-human-task/jbpm-human-task-audit/src/main/java/org/jbpm/services/task/lifecycle/listeners/BAMTaskEventListener.java#L218-L244 |
weld/core | impl/src/main/java/org/jboss/weld/resolution/TypeSafeResolver.java | TypeSafeResolver.resolve | public F resolve(R resolvable, boolean cache) {
"""
Get the possible beans for the given element
@param resolvable The resolving criteria
@return An unmodifiable set of matching beans
"""
R wrappedResolvable = wrap(resolvable);
if (cache) {
return resolved.getValue(wrappedResolvable);
} else {
return resolverFunction.apply(wrappedResolvable);
}
} | java | public F resolve(R resolvable, boolean cache) {
R wrappedResolvable = wrap(resolvable);
if (cache) {
return resolved.getValue(wrappedResolvable);
} else {
return resolverFunction.apply(wrappedResolvable);
}
} | [
"public",
"F",
"resolve",
"(",
"R",
"resolvable",
",",
"boolean",
"cache",
")",
"{",
"R",
"wrappedResolvable",
"=",
"wrap",
"(",
"resolvable",
")",
";",
"if",
"(",
"cache",
")",
"{",
"return",
"resolved",
".",
"getValue",
"(",
"wrappedResolvable",
")",
";",
"}",
"else",
"{",
"return",
"resolverFunction",
".",
"apply",
"(",
"wrappedResolvable",
")",
";",
"}",
"}"
] | Get the possible beans for the given element
@param resolvable The resolving criteria
@return An unmodifiable set of matching beans | [
"Get",
"the",
"possible",
"beans",
"for",
"the",
"given",
"element"
] | train | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/resolution/TypeSafeResolver.java#L85-L92 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.