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
|
---|---|---|---|---|---|---|---|---|---|---|
alkacon/opencms-core | src-gwt/org/opencms/ade/containerpage/client/ui/CmsContainerPageElementPanel.java | CmsContainerPageElementPanel.isOptionbarIFrameCollision | private boolean isOptionbarIFrameCollision(int optionTop, int optionWidth) {
"""
Returns if the option bar position collides with any iframe child elements.<p>
@param optionTop the option bar absolute top
@param optionWidth the option bar width
@return <code>true</code> if there are iframe child elements located no less than 25px below the upper edge of the element
"""
if (RootPanel.getBodyElement().isOrHasChild(getElement())) {
NodeList<Element> frames = getElement().getElementsByTagName(CmsDomUtil.Tag.iframe.name());
for (int i = 0; i < frames.getLength(); i++) {
int frameTop = frames.getItem(i).getAbsoluteTop();
int frameHeight = frames.getItem(i).getOffsetHeight();
int frameRight = frames.getItem(i).getAbsoluteRight();
if (((frameTop - optionTop) < 25)
&& (((frameTop + frameHeight) - optionTop) > 0)
&& ((frameRight - getElement().getAbsoluteRight()) < optionWidth)) {
return true;
}
}
}
return false;
} | java | private boolean isOptionbarIFrameCollision(int optionTop, int optionWidth) {
if (RootPanel.getBodyElement().isOrHasChild(getElement())) {
NodeList<Element> frames = getElement().getElementsByTagName(CmsDomUtil.Tag.iframe.name());
for (int i = 0; i < frames.getLength(); i++) {
int frameTop = frames.getItem(i).getAbsoluteTop();
int frameHeight = frames.getItem(i).getOffsetHeight();
int frameRight = frames.getItem(i).getAbsoluteRight();
if (((frameTop - optionTop) < 25)
&& (((frameTop + frameHeight) - optionTop) > 0)
&& ((frameRight - getElement().getAbsoluteRight()) < optionWidth)) {
return true;
}
}
}
return false;
} | [
"private",
"boolean",
"isOptionbarIFrameCollision",
"(",
"int",
"optionTop",
",",
"int",
"optionWidth",
")",
"{",
"if",
"(",
"RootPanel",
".",
"getBodyElement",
"(",
")",
".",
"isOrHasChild",
"(",
"getElement",
"(",
")",
")",
")",
"{",
"NodeList",
"<",
"Element",
">",
"frames",
"=",
"getElement",
"(",
")",
".",
"getElementsByTagName",
"(",
"CmsDomUtil",
".",
"Tag",
".",
"iframe",
".",
"name",
"(",
")",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"frames",
".",
"getLength",
"(",
")",
";",
"i",
"++",
")",
"{",
"int",
"frameTop",
"=",
"frames",
".",
"getItem",
"(",
"i",
")",
".",
"getAbsoluteTop",
"(",
")",
";",
"int",
"frameHeight",
"=",
"frames",
".",
"getItem",
"(",
"i",
")",
".",
"getOffsetHeight",
"(",
")",
";",
"int",
"frameRight",
"=",
"frames",
".",
"getItem",
"(",
"i",
")",
".",
"getAbsoluteRight",
"(",
")",
";",
"if",
"(",
"(",
"(",
"frameTop",
"-",
"optionTop",
")",
"<",
"25",
")",
"&&",
"(",
"(",
"(",
"frameTop",
"+",
"frameHeight",
")",
"-",
"optionTop",
")",
">",
"0",
")",
"&&",
"(",
"(",
"frameRight",
"-",
"getElement",
"(",
")",
".",
"getAbsoluteRight",
"(",
")",
")",
"<",
"optionWidth",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"}",
"return",
"false",
";",
"}"
] | Returns if the option bar position collides with any iframe child elements.<p>
@param optionTop the option bar absolute top
@param optionWidth the option bar width
@return <code>true</code> if there are iframe child elements located no less than 25px below the upper edge of the element | [
"Returns",
"if",
"the",
"option",
"bar",
"position",
"collides",
"with",
"any",
"iframe",
"child",
"elements",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/containerpage/client/ui/CmsContainerPageElementPanel.java#L1252-L1269 |
ckpoint/CheckPoint | src/main/java/hsim/checkpoint/setting/controller/MsgSettingController.java | MsgSettingController.deleteValidationDataLists | @DeleteMapping("/setting/delete/param/from/url")
public void deleteValidationDataLists(HttpServletRequest req, @RequestBody List<ValidationData> datas) {
"""
Delete validation data lists.
@param req the req
@param datas the datas
"""
this.validationSessionComponent.sessionCheck(req);
this.msgSettingService.deleteValidationData(datas);
} | java | @DeleteMapping("/setting/delete/param/from/url")
public void deleteValidationDataLists(HttpServletRequest req, @RequestBody List<ValidationData> datas) {
this.validationSessionComponent.sessionCheck(req);
this.msgSettingService.deleteValidationData(datas);
} | [
"@",
"DeleteMapping",
"(",
"\"/setting/delete/param/from/url\"",
")",
"public",
"void",
"deleteValidationDataLists",
"(",
"HttpServletRequest",
"req",
",",
"@",
"RequestBody",
"List",
"<",
"ValidationData",
">",
"datas",
")",
"{",
"this",
".",
"validationSessionComponent",
".",
"sessionCheck",
"(",
"req",
")",
";",
"this",
".",
"msgSettingService",
".",
"deleteValidationData",
"(",
"datas",
")",
";",
"}"
] | Delete validation data lists.
@param req the req
@param datas the datas | [
"Delete",
"validation",
"data",
"lists",
"."
] | train | https://github.com/ckpoint/CheckPoint/blob/2c2b1a87a88485d49ea6afa34acdf16ef4134f19/src/main/java/hsim/checkpoint/setting/controller/MsgSettingController.java#L181-L185 |
Azure/azure-sdk-for-java | devspaces/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/devspaces/v2018_06_01_preview/implementation/ControllersInner.java | ControllersInner.listConnectionDetailsAsync | public Observable<ControllerConnectionDetailsListInner> listConnectionDetailsAsync(String resourceGroupName, String name) {
"""
Lists connection details for an Azure Dev Spaces Controller.
Lists connection details for the underlying container resources of an Azure Dev Spaces Controller.
@param resourceGroupName Resource group to which the resource belongs.
@param name Name of the resource.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ControllerConnectionDetailsListInner object
"""
return listConnectionDetailsWithServiceResponseAsync(resourceGroupName, name).map(new Func1<ServiceResponse<ControllerConnectionDetailsListInner>, ControllerConnectionDetailsListInner>() {
@Override
public ControllerConnectionDetailsListInner call(ServiceResponse<ControllerConnectionDetailsListInner> response) {
return response.body();
}
});
} | java | public Observable<ControllerConnectionDetailsListInner> listConnectionDetailsAsync(String resourceGroupName, String name) {
return listConnectionDetailsWithServiceResponseAsync(resourceGroupName, name).map(new Func1<ServiceResponse<ControllerConnectionDetailsListInner>, ControllerConnectionDetailsListInner>() {
@Override
public ControllerConnectionDetailsListInner call(ServiceResponse<ControllerConnectionDetailsListInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ControllerConnectionDetailsListInner",
">",
"listConnectionDetailsAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"name",
")",
"{",
"return",
"listConnectionDetailsWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"name",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"ControllerConnectionDetailsListInner",
">",
",",
"ControllerConnectionDetailsListInner",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"ControllerConnectionDetailsListInner",
"call",
"(",
"ServiceResponse",
"<",
"ControllerConnectionDetailsListInner",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Lists connection details for an Azure Dev Spaces Controller.
Lists connection details for the underlying container resources of an Azure Dev Spaces Controller.
@param resourceGroupName Resource group to which the resource belongs.
@param name Name of the resource.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ControllerConnectionDetailsListInner object | [
"Lists",
"connection",
"details",
"for",
"an",
"Azure",
"Dev",
"Spaces",
"Controller",
".",
"Lists",
"connection",
"details",
"for",
"the",
"underlying",
"container",
"resources",
"of",
"an",
"Azure",
"Dev",
"Spaces",
"Controller",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/devspaces/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/devspaces/v2018_06_01_preview/implementation/ControllersInner.java#L1003-L1010 |
alkacon/opencms-core | src-setup/org/opencms/setup/xml/CmsSetupXmlHelper.java | CmsSetupXmlHelper.setValue | public int setValue(String xmlFilename, String xPath, String value, String nodeToInsert) throws CmsXmlException {
"""
Sets the given value in all nodes identified by the given xpath of the given xml file.<p>
If value is <code>null</code>, all nodes identified by the given xpath will be deleted.<p>
If the node identified by the given xpath does not exists, the missing nodes will be created
(if <code>value</code> not <code>null</code>).<p>
@param xmlFilename the xml config file (could be relative to the base path)
@param xPath the xpath to set
@param value the value to set (can be <code>null</code> for deletion)
@param nodeToInsert optional, if given it will be inserted after xPath with the given value
@return the number of successful changed or deleted nodes
@throws CmsXmlException if something goes wrong
"""
return setValue(getDocument(xmlFilename), xPath, value, nodeToInsert);
} | java | public int setValue(String xmlFilename, String xPath, String value, String nodeToInsert) throws CmsXmlException {
return setValue(getDocument(xmlFilename), xPath, value, nodeToInsert);
} | [
"public",
"int",
"setValue",
"(",
"String",
"xmlFilename",
",",
"String",
"xPath",
",",
"String",
"value",
",",
"String",
"nodeToInsert",
")",
"throws",
"CmsXmlException",
"{",
"return",
"setValue",
"(",
"getDocument",
"(",
"xmlFilename",
")",
",",
"xPath",
",",
"value",
",",
"nodeToInsert",
")",
";",
"}"
] | Sets the given value in all nodes identified by the given xpath of the given xml file.<p>
If value is <code>null</code>, all nodes identified by the given xpath will be deleted.<p>
If the node identified by the given xpath does not exists, the missing nodes will be created
(if <code>value</code> not <code>null</code>).<p>
@param xmlFilename the xml config file (could be relative to the base path)
@param xPath the xpath to set
@param value the value to set (can be <code>null</code> for deletion)
@param nodeToInsert optional, if given it will be inserted after xPath with the given value
@return the number of successful changed or deleted nodes
@throws CmsXmlException if something goes wrong | [
"Sets",
"the",
"given",
"value",
"in",
"all",
"nodes",
"identified",
"by",
"the",
"given",
"xpath",
"of",
"the",
"given",
"xml",
"file",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-setup/org/opencms/setup/xml/CmsSetupXmlHelper.java#L486-L489 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/io/IOUtils.java | IOUtils.writeStringToFileNoExceptions | public static void writeStringToFileNoExceptions(String contents, String path, String encoding) {
"""
Writes a string to a file, squashing exceptions
@param contents The string to write
@param path The file path
@param encoding The encoding to encode in
"""
OutputStream writer = null;
try{
if (path.endsWith(".gz")) {
writer = new GZIPOutputStream(new FileOutputStream(path));
} else {
writer = new BufferedOutputStream(new FileOutputStream(path));
}
writer.write(contents.getBytes(encoding));
} catch (Exception e) {
e.printStackTrace();
} finally {
if(writer != null){ closeIgnoringExceptions(writer); }
}
} | java | public static void writeStringToFileNoExceptions(String contents, String path, String encoding) {
OutputStream writer = null;
try{
if (path.endsWith(".gz")) {
writer = new GZIPOutputStream(new FileOutputStream(path));
} else {
writer = new BufferedOutputStream(new FileOutputStream(path));
}
writer.write(contents.getBytes(encoding));
} catch (Exception e) {
e.printStackTrace();
} finally {
if(writer != null){ closeIgnoringExceptions(writer); }
}
} | [
"public",
"static",
"void",
"writeStringToFileNoExceptions",
"(",
"String",
"contents",
",",
"String",
"path",
",",
"String",
"encoding",
")",
"{",
"OutputStream",
"writer",
"=",
"null",
";",
"try",
"{",
"if",
"(",
"path",
".",
"endsWith",
"(",
"\".gz\"",
")",
")",
"{",
"writer",
"=",
"new",
"GZIPOutputStream",
"(",
"new",
"FileOutputStream",
"(",
"path",
")",
")",
";",
"}",
"else",
"{",
"writer",
"=",
"new",
"BufferedOutputStream",
"(",
"new",
"FileOutputStream",
"(",
"path",
")",
")",
";",
"}",
"writer",
".",
"write",
"(",
"contents",
".",
"getBytes",
"(",
"encoding",
")",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"finally",
"{",
"if",
"(",
"writer",
"!=",
"null",
")",
"{",
"closeIgnoringExceptions",
"(",
"writer",
")",
";",
"}",
"}",
"}"
] | Writes a string to a file, squashing exceptions
@param contents The string to write
@param path The file path
@param encoding The encoding to encode in | [
"Writes",
"a",
"string",
"to",
"a",
"file",
"squashing",
"exceptions"
] | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/io/IOUtils.java#L190-L204 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/XPathParser.java | XPathParser.Literal | protected void Literal() throws javax.xml.transform.TransformerException {
"""
The value of the Literal is the sequence of characters inside
the " or ' characters>.
Literal ::= '"' [^"]* '"'
| "'" [^']* "'"
@throws javax.xml.transform.TransformerException
"""
int last = m_token.length() - 1;
char c0 = m_tokenChar;
char cX = m_token.charAt(last);
if (((c0 == '\"') && (cX == '\"')) || ((c0 == '\'') && (cX == '\'')))
{
// Mutate the token to remove the quotes and have the XString object
// already made.
int tokenQueuePos = m_queueMark - 1;
m_ops.m_tokenQueue.setElementAt(null,tokenQueuePos);
Object obj = new XString(m_token.substring(1, last));
m_ops.m_tokenQueue.setElementAt(obj,tokenQueuePos);
// lit = m_token.substring(1, last);
m_ops.setOp(m_ops.getOp(OpMap.MAPINDEX_LENGTH), tokenQueuePos);
m_ops.setOp(OpMap.MAPINDEX_LENGTH, m_ops.getOp(OpMap.MAPINDEX_LENGTH) + 1);
nextToken();
}
else
{
error(XPATHErrorResources.ER_PATTERN_LITERAL_NEEDS_BE_QUOTED,
new Object[]{ m_token }); //"Pattern literal ("+m_token+") needs to be quoted!");
}
} | java | protected void Literal() throws javax.xml.transform.TransformerException
{
int last = m_token.length() - 1;
char c0 = m_tokenChar;
char cX = m_token.charAt(last);
if (((c0 == '\"') && (cX == '\"')) || ((c0 == '\'') && (cX == '\'')))
{
// Mutate the token to remove the quotes and have the XString object
// already made.
int tokenQueuePos = m_queueMark - 1;
m_ops.m_tokenQueue.setElementAt(null,tokenQueuePos);
Object obj = new XString(m_token.substring(1, last));
m_ops.m_tokenQueue.setElementAt(obj,tokenQueuePos);
// lit = m_token.substring(1, last);
m_ops.setOp(m_ops.getOp(OpMap.MAPINDEX_LENGTH), tokenQueuePos);
m_ops.setOp(OpMap.MAPINDEX_LENGTH, m_ops.getOp(OpMap.MAPINDEX_LENGTH) + 1);
nextToken();
}
else
{
error(XPATHErrorResources.ER_PATTERN_LITERAL_NEEDS_BE_QUOTED,
new Object[]{ m_token }); //"Pattern literal ("+m_token+") needs to be quoted!");
}
} | [
"protected",
"void",
"Literal",
"(",
")",
"throws",
"javax",
".",
"xml",
".",
"transform",
".",
"TransformerException",
"{",
"int",
"last",
"=",
"m_token",
".",
"length",
"(",
")",
"-",
"1",
";",
"char",
"c0",
"=",
"m_tokenChar",
";",
"char",
"cX",
"=",
"m_token",
".",
"charAt",
"(",
"last",
")",
";",
"if",
"(",
"(",
"(",
"c0",
"==",
"'",
"'",
")",
"&&",
"(",
"cX",
"==",
"'",
"'",
")",
")",
"||",
"(",
"(",
"c0",
"==",
"'",
"'",
")",
"&&",
"(",
"cX",
"==",
"'",
"'",
")",
")",
")",
"{",
"// Mutate the token to remove the quotes and have the XString object",
"// already made.",
"int",
"tokenQueuePos",
"=",
"m_queueMark",
"-",
"1",
";",
"m_ops",
".",
"m_tokenQueue",
".",
"setElementAt",
"(",
"null",
",",
"tokenQueuePos",
")",
";",
"Object",
"obj",
"=",
"new",
"XString",
"(",
"m_token",
".",
"substring",
"(",
"1",
",",
"last",
")",
")",
";",
"m_ops",
".",
"m_tokenQueue",
".",
"setElementAt",
"(",
"obj",
",",
"tokenQueuePos",
")",
";",
"// lit = m_token.substring(1, last);",
"m_ops",
".",
"setOp",
"(",
"m_ops",
".",
"getOp",
"(",
"OpMap",
".",
"MAPINDEX_LENGTH",
")",
",",
"tokenQueuePos",
")",
";",
"m_ops",
".",
"setOp",
"(",
"OpMap",
".",
"MAPINDEX_LENGTH",
",",
"m_ops",
".",
"getOp",
"(",
"OpMap",
".",
"MAPINDEX_LENGTH",
")",
"+",
"1",
")",
";",
"nextToken",
"(",
")",
";",
"}",
"else",
"{",
"error",
"(",
"XPATHErrorResources",
".",
"ER_PATTERN_LITERAL_NEEDS_BE_QUOTED",
",",
"new",
"Object",
"[",
"]",
"{",
"m_token",
"}",
")",
";",
"//\"Pattern literal (\"+m_token+\") needs to be quoted!\");",
"}",
"}"
] | The value of the Literal is the sequence of characters inside
the " or ' characters>.
Literal ::= '"' [^"]* '"'
| "'" [^']* "'"
@throws javax.xml.transform.TransformerException | [
"The",
"value",
"of",
"the",
"Literal",
"is",
"the",
"sequence",
"of",
"characters",
"inside",
"the",
"or",
"characters",
">",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/XPathParser.java#L2017-L2048 |
graphhopper/map-matching | hmm-lib/src/main/java/com/bmw/hmm/ViterbiAlgorithm.java | ViterbiAlgorithm.hmmBreak | private boolean hmmBreak(Map<S, Double> message) {
"""
Returns whether the specified message is either empty or only contains state candidates
with zero probability and thus causes the HMM to break.
"""
for (double logProbability : message.values()) {
if (logProbability != Double.NEGATIVE_INFINITY) {
return false;
}
}
return true;
} | java | private boolean hmmBreak(Map<S, Double> message) {
for (double logProbability : message.values()) {
if (logProbability != Double.NEGATIVE_INFINITY) {
return false;
}
}
return true;
} | [
"private",
"boolean",
"hmmBreak",
"(",
"Map",
"<",
"S",
",",
"Double",
">",
"message",
")",
"{",
"for",
"(",
"double",
"logProbability",
":",
"message",
".",
"values",
"(",
")",
")",
"{",
"if",
"(",
"logProbability",
"!=",
"Double",
".",
"NEGATIVE_INFINITY",
")",
"{",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}"
] | Returns whether the specified message is either empty or only contains state candidates
with zero probability and thus causes the HMM to break. | [
"Returns",
"whether",
"the",
"specified",
"message",
"is",
"either",
"empty",
"or",
"only",
"contains",
"state",
"candidates",
"with",
"zero",
"probability",
"and",
"thus",
"causes",
"the",
"HMM",
"to",
"break",
"."
] | train | https://github.com/graphhopper/map-matching/blob/32cd83f14cb990c2be83c8781f22dfb59e0dbeb4/hmm-lib/src/main/java/com/bmw/hmm/ViterbiAlgorithm.java#L298-L305 |
albfernandez/itext2 | src/main/java/com/lowagie/text/xml/xmp/XmpSchema.java | XmpSchema.setProperty | public Object setProperty(String key, XmpArray value) {
"""
@see java.util.Properties#setProperty(java.lang.String, java.lang.String)
@param key
@param value
@return the previous property (null if there wasn't one)
"""
return super.setProperty(key, value.toString());
} | java | public Object setProperty(String key, XmpArray value) {
return super.setProperty(key, value.toString());
} | [
"public",
"Object",
"setProperty",
"(",
"String",
"key",
",",
"XmpArray",
"value",
")",
"{",
"return",
"super",
".",
"setProperty",
"(",
"key",
",",
"value",
".",
"toString",
"(",
")",
")",
";",
"}"
] | @see java.util.Properties#setProperty(java.lang.String, java.lang.String)
@param key
@param value
@return the previous property (null if there wasn't one) | [
"@see",
"java",
".",
"util",
".",
"Properties#setProperty",
"(",
"java",
".",
"lang",
".",
"String",
"java",
".",
"lang",
".",
"String",
")"
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/xml/xmp/XmpSchema.java#L127-L129 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/accesslayer/StatementsForClassFactory.java | StatementsForClassFactory.getStatementsForClass | public StatementsForClassIF getStatementsForClass(JdbcConnectionDescriptor cds, ClassDescriptor cld) {
"""
Get an instance of {@link org.apache.ojb.broker.accesslayer.StatementsForClassIF}
@param cds our connection descriptor
@param cld the class descriptor of the persistant object
@return an instance of {@link org.apache.ojb.broker.accesslayer.StatementsForClassIF}
"""
return (StatementsForClassIF) this.createNewInstance(new Class[]{JdbcConnectionDescriptor.class, ClassDescriptor.class},
new Object[]{cds, cld});
} | java | public StatementsForClassIF getStatementsForClass(JdbcConnectionDescriptor cds, ClassDescriptor cld)
{
return (StatementsForClassIF) this.createNewInstance(new Class[]{JdbcConnectionDescriptor.class, ClassDescriptor.class},
new Object[]{cds, cld});
} | [
"public",
"StatementsForClassIF",
"getStatementsForClass",
"(",
"JdbcConnectionDescriptor",
"cds",
",",
"ClassDescriptor",
"cld",
")",
"{",
"return",
"(",
"StatementsForClassIF",
")",
"this",
".",
"createNewInstance",
"(",
"new",
"Class",
"[",
"]",
"{",
"JdbcConnectionDescriptor",
".",
"class",
",",
"ClassDescriptor",
".",
"class",
"}",
",",
"new",
"Object",
"[",
"]",
"{",
"cds",
",",
"cld",
"}",
")",
";",
"}"
] | Get an instance of {@link org.apache.ojb.broker.accesslayer.StatementsForClassIF}
@param cds our connection descriptor
@param cld the class descriptor of the persistant object
@return an instance of {@link org.apache.ojb.broker.accesslayer.StatementsForClassIF} | [
"Get",
"an",
"instance",
"of",
"{"
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/accesslayer/StatementsForClassFactory.java#L69-L73 |
cycorp/model-generator-suite | model-generator/src/main/java/com/cyc/model/objects/ClassObj.java | ClassObj.getMethodPredicates | public List<KbPredicate> getMethodPredicates() {
"""
This returns an ordered list of the Predicates which underly the class's
MethodObjs, with no duplicate elements. This is valuable because a single
predicate may be the basis for multiple MethodObjs (getters, setters, etc.)
@return
"""
Set<KbPredicate> set = new HashSet<KbPredicate>();
for (MethodObj method : getMethods()) {
set.add(method.getPredicate());
}
List<KbPredicate> list = new ArrayList(set);
Collections.sort(list, new Comparator<KbPredicate>() {
@Override
public int compare(KbPredicate o1, KbPredicate o2) {
if ((o2 == null) || !(o2 instanceof KbPredicate)) {
return 1;
}
return o1.toString().compareTo(o2.toString());
}
});
return list;
} | java | public List<KbPredicate> getMethodPredicates() {
Set<KbPredicate> set = new HashSet<KbPredicate>();
for (MethodObj method : getMethods()) {
set.add(method.getPredicate());
}
List<KbPredicate> list = new ArrayList(set);
Collections.sort(list, new Comparator<KbPredicate>() {
@Override
public int compare(KbPredicate o1, KbPredicate o2) {
if ((o2 == null) || !(o2 instanceof KbPredicate)) {
return 1;
}
return o1.toString().compareTo(o2.toString());
}
});
return list;
} | [
"public",
"List",
"<",
"KbPredicate",
">",
"getMethodPredicates",
"(",
")",
"{",
"Set",
"<",
"KbPredicate",
">",
"set",
"=",
"new",
"HashSet",
"<",
"KbPredicate",
">",
"(",
")",
";",
"for",
"(",
"MethodObj",
"method",
":",
"getMethods",
"(",
")",
")",
"{",
"set",
".",
"add",
"(",
"method",
".",
"getPredicate",
"(",
")",
")",
";",
"}",
"List",
"<",
"KbPredicate",
">",
"list",
"=",
"new",
"ArrayList",
"(",
"set",
")",
";",
"Collections",
".",
"sort",
"(",
"list",
",",
"new",
"Comparator",
"<",
"KbPredicate",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"int",
"compare",
"(",
"KbPredicate",
"o1",
",",
"KbPredicate",
"o2",
")",
"{",
"if",
"(",
"(",
"o2",
"==",
"null",
")",
"||",
"!",
"(",
"o2",
"instanceof",
"KbPredicate",
")",
")",
"{",
"return",
"1",
";",
"}",
"return",
"o1",
".",
"toString",
"(",
")",
".",
"compareTo",
"(",
"o2",
".",
"toString",
"(",
")",
")",
";",
"}",
"}",
")",
";",
"return",
"list",
";",
"}"
] | This returns an ordered list of the Predicates which underly the class's
MethodObjs, with no duplicate elements. This is valuable because a single
predicate may be the basis for multiple MethodObjs (getters, setters, etc.)
@return | [
"This",
"returns",
"an",
"ordered",
"list",
"of",
"the",
"Predicates",
"which",
"underly",
"the",
"class",
"s",
"MethodObjs",
"with",
"no",
"duplicate",
"elements",
".",
"This",
"is",
"valuable",
"because",
"a",
"single",
"predicate",
"may",
"be",
"the",
"basis",
"for",
"multiple",
"MethodObjs",
"(",
"getters",
"setters",
"etc",
".",
")"
] | train | https://github.com/cycorp/model-generator-suite/blob/8995984c5dcf668acad813d24e4fe9c544b7aa91/model-generator/src/main/java/com/cyc/model/objects/ClassObj.java#L283-L299 |
UrielCh/ovh-java-sdk | ovh-java-sdk-xdsl/src/main/java/net/minidev/ovh/api/ApiOvhXdsl.java | ApiOvhXdsl.email_pro_email_changePassword_POST | public net.minidev.ovh.api.xdsl.email.pro.OvhTask email_pro_email_changePassword_POST(String email, String password) throws IOException {
"""
Change the email password
REST: POST /xdsl/email/pro/{email}/changePassword
@param password [required] New email password
@param email [required] The email address if the XDSL Email Pro
"""
String qPath = "/xdsl/email/pro/{email}/changePassword";
StringBuilder sb = path(qPath, email);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "password", password);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, net.minidev.ovh.api.xdsl.email.pro.OvhTask.class);
} | java | public net.minidev.ovh.api.xdsl.email.pro.OvhTask email_pro_email_changePassword_POST(String email, String password) throws IOException {
String qPath = "/xdsl/email/pro/{email}/changePassword";
StringBuilder sb = path(qPath, email);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "password", password);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, net.minidev.ovh.api.xdsl.email.pro.OvhTask.class);
} | [
"public",
"net",
".",
"minidev",
".",
"ovh",
".",
"api",
".",
"xdsl",
".",
"email",
".",
"pro",
".",
"OvhTask",
"email_pro_email_changePassword_POST",
"(",
"String",
"email",
",",
"String",
"password",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/xdsl/email/pro/{email}/changePassword\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"email",
")",
";",
"HashMap",
"<",
"String",
",",
"Object",
">",
"o",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"addBody",
"(",
"o",
",",
"\"password\"",
",",
"password",
")",
";",
"String",
"resp",
"=",
"exec",
"(",
"qPath",
",",
"\"POST\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"o",
")",
";",
"return",
"convertTo",
"(",
"resp",
",",
"net",
".",
"minidev",
".",
"ovh",
".",
"api",
".",
"xdsl",
".",
"email",
".",
"pro",
".",
"OvhTask",
".",
"class",
")",
";",
"}"
] | Change the email password
REST: POST /xdsl/email/pro/{email}/changePassword
@param password [required] New email password
@param email [required] The email address if the XDSL Email Pro | [
"Change",
"the",
"email",
"password"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-xdsl/src/main/java/net/minidev/ovh/api/ApiOvhXdsl.java#L1949-L1956 |
pryzach/midao | midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/type/TypeHandlerUtils.java | TypeHandlerUtils.convertClob | public static Object convertClob(Object clob, byte[] value) throws SQLException {
"""
Transfers data from byte[] into sql.Clob
@param clob sql.Clob which would be filled
@param value array of bytes
@return sql.Clob from array of bytes
@throws SQLException
"""
ByteArrayInputStream input = new ByteArrayInputStream(value);
//OutputStream output = clob.setAsciiStream(1);
OutputStream output = null;
try {
output = (OutputStream) MappingUtils.invokeFunction(clob, "setAsciiStream", new Class[]{long.class}, new Object[]{1});
} catch (MjdbcException ex) {
throw new MjdbcSQLException(ex);
}
try {
copy(input, output);
output.flush();
output.close();
} catch (IOException ex) {
throw new MjdbcSQLException(ex);
}
return clob;
} | java | public static Object convertClob(Object clob, byte[] value) throws SQLException {
ByteArrayInputStream input = new ByteArrayInputStream(value);
//OutputStream output = clob.setAsciiStream(1);
OutputStream output = null;
try {
output = (OutputStream) MappingUtils.invokeFunction(clob, "setAsciiStream", new Class[]{long.class}, new Object[]{1});
} catch (MjdbcException ex) {
throw new MjdbcSQLException(ex);
}
try {
copy(input, output);
output.flush();
output.close();
} catch (IOException ex) {
throw new MjdbcSQLException(ex);
}
return clob;
} | [
"public",
"static",
"Object",
"convertClob",
"(",
"Object",
"clob",
",",
"byte",
"[",
"]",
"value",
")",
"throws",
"SQLException",
"{",
"ByteArrayInputStream",
"input",
"=",
"new",
"ByteArrayInputStream",
"(",
"value",
")",
";",
"//OutputStream output = clob.setAsciiStream(1);",
"OutputStream",
"output",
"=",
"null",
";",
"try",
"{",
"output",
"=",
"(",
"OutputStream",
")",
"MappingUtils",
".",
"invokeFunction",
"(",
"clob",
",",
"\"setAsciiStream\"",
",",
"new",
"Class",
"[",
"]",
"{",
"long",
".",
"class",
"}",
",",
"new",
"Object",
"[",
"]",
"{",
"1",
"}",
")",
";",
"}",
"catch",
"(",
"MjdbcException",
"ex",
")",
"{",
"throw",
"new",
"MjdbcSQLException",
"(",
"ex",
")",
";",
"}",
"try",
"{",
"copy",
"(",
"input",
",",
"output",
")",
";",
"output",
".",
"flush",
"(",
")",
";",
"output",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"ex",
")",
"{",
"throw",
"new",
"MjdbcSQLException",
"(",
"ex",
")",
";",
"}",
"return",
"clob",
";",
"}"
] | Transfers data from byte[] into sql.Clob
@param clob sql.Clob which would be filled
@param value array of bytes
@return sql.Clob from array of bytes
@throws SQLException | [
"Transfers",
"data",
"from",
"byte",
"[]",
"into",
"sql",
".",
"Clob"
] | train | https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/type/TypeHandlerUtils.java#L216-L236 |
exoplatform/jcr | exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/resource/GenericResource.java | GenericResource.lockDiscovery | public static HierarchicalProperty lockDiscovery(String token, String lockOwner, String timeOut) {
"""
Returns the information about lock.
@param token lock token
@param lockOwner lockowner
@param timeOut lock timeout
@return lock information
"""
HierarchicalProperty lockDiscovery = new HierarchicalProperty(new QName("DAV:", "lockdiscovery"));
HierarchicalProperty activeLock =
lockDiscovery.addChild(new HierarchicalProperty(new QName("DAV:", "activelock")));
HierarchicalProperty lockType = activeLock.addChild(new HierarchicalProperty(new QName("DAV:", "locktype")));
lockType.addChild(new HierarchicalProperty(new QName("DAV:", "write")));
HierarchicalProperty lockScope = activeLock.addChild(new HierarchicalProperty(new QName("DAV:", "lockscope")));
lockScope.addChild(new HierarchicalProperty(new QName("DAV:", "exclusive")));
HierarchicalProperty depth = activeLock.addChild(new HierarchicalProperty(new QName("DAV:", "depth")));
depth.setValue("Infinity");
if (lockOwner != null)
{
HierarchicalProperty owner = activeLock.addChild(new HierarchicalProperty(new QName("DAV:", "owner")));
owner.setValue(lockOwner);
}
HierarchicalProperty timeout = activeLock.addChild(new HierarchicalProperty(new QName("DAV:", "timeout")));
timeout.setValue("Second-" + timeOut);
if (token != null)
{
HierarchicalProperty lockToken = activeLock.addChild(new HierarchicalProperty(new QName("DAV:", "locktoken")));
HierarchicalProperty lockHref = lockToken.addChild(new HierarchicalProperty(new QName("DAV:", "href")));
lockHref.setValue(token);
}
return lockDiscovery;
} | java | public static HierarchicalProperty lockDiscovery(String token, String lockOwner, String timeOut)
{
HierarchicalProperty lockDiscovery = new HierarchicalProperty(new QName("DAV:", "lockdiscovery"));
HierarchicalProperty activeLock =
lockDiscovery.addChild(new HierarchicalProperty(new QName("DAV:", "activelock")));
HierarchicalProperty lockType = activeLock.addChild(new HierarchicalProperty(new QName("DAV:", "locktype")));
lockType.addChild(new HierarchicalProperty(new QName("DAV:", "write")));
HierarchicalProperty lockScope = activeLock.addChild(new HierarchicalProperty(new QName("DAV:", "lockscope")));
lockScope.addChild(new HierarchicalProperty(new QName("DAV:", "exclusive")));
HierarchicalProperty depth = activeLock.addChild(new HierarchicalProperty(new QName("DAV:", "depth")));
depth.setValue("Infinity");
if (lockOwner != null)
{
HierarchicalProperty owner = activeLock.addChild(new HierarchicalProperty(new QName("DAV:", "owner")));
owner.setValue(lockOwner);
}
HierarchicalProperty timeout = activeLock.addChild(new HierarchicalProperty(new QName("DAV:", "timeout")));
timeout.setValue("Second-" + timeOut);
if (token != null)
{
HierarchicalProperty lockToken = activeLock.addChild(new HierarchicalProperty(new QName("DAV:", "locktoken")));
HierarchicalProperty lockHref = lockToken.addChild(new HierarchicalProperty(new QName("DAV:", "href")));
lockHref.setValue(token);
}
return lockDiscovery;
} | [
"public",
"static",
"HierarchicalProperty",
"lockDiscovery",
"(",
"String",
"token",
",",
"String",
"lockOwner",
",",
"String",
"timeOut",
")",
"{",
"HierarchicalProperty",
"lockDiscovery",
"=",
"new",
"HierarchicalProperty",
"(",
"new",
"QName",
"(",
"\"DAV:\"",
",",
"\"lockdiscovery\"",
")",
")",
";",
"HierarchicalProperty",
"activeLock",
"=",
"lockDiscovery",
".",
"addChild",
"(",
"new",
"HierarchicalProperty",
"(",
"new",
"QName",
"(",
"\"DAV:\"",
",",
"\"activelock\"",
")",
")",
")",
";",
"HierarchicalProperty",
"lockType",
"=",
"activeLock",
".",
"addChild",
"(",
"new",
"HierarchicalProperty",
"(",
"new",
"QName",
"(",
"\"DAV:\"",
",",
"\"locktype\"",
")",
")",
")",
";",
"lockType",
".",
"addChild",
"(",
"new",
"HierarchicalProperty",
"(",
"new",
"QName",
"(",
"\"DAV:\"",
",",
"\"write\"",
")",
")",
")",
";",
"HierarchicalProperty",
"lockScope",
"=",
"activeLock",
".",
"addChild",
"(",
"new",
"HierarchicalProperty",
"(",
"new",
"QName",
"(",
"\"DAV:\"",
",",
"\"lockscope\"",
")",
")",
")",
";",
"lockScope",
".",
"addChild",
"(",
"new",
"HierarchicalProperty",
"(",
"new",
"QName",
"(",
"\"DAV:\"",
",",
"\"exclusive\"",
")",
")",
")",
";",
"HierarchicalProperty",
"depth",
"=",
"activeLock",
".",
"addChild",
"(",
"new",
"HierarchicalProperty",
"(",
"new",
"QName",
"(",
"\"DAV:\"",
",",
"\"depth\"",
")",
")",
")",
";",
"depth",
".",
"setValue",
"(",
"\"Infinity\"",
")",
";",
"if",
"(",
"lockOwner",
"!=",
"null",
")",
"{",
"HierarchicalProperty",
"owner",
"=",
"activeLock",
".",
"addChild",
"(",
"new",
"HierarchicalProperty",
"(",
"new",
"QName",
"(",
"\"DAV:\"",
",",
"\"owner\"",
")",
")",
")",
";",
"owner",
".",
"setValue",
"(",
"lockOwner",
")",
";",
"}",
"HierarchicalProperty",
"timeout",
"=",
"activeLock",
".",
"addChild",
"(",
"new",
"HierarchicalProperty",
"(",
"new",
"QName",
"(",
"\"DAV:\"",
",",
"\"timeout\"",
")",
")",
")",
";",
"timeout",
".",
"setValue",
"(",
"\"Second-\"",
"+",
"timeOut",
")",
";",
"if",
"(",
"token",
"!=",
"null",
")",
"{",
"HierarchicalProperty",
"lockToken",
"=",
"activeLock",
".",
"addChild",
"(",
"new",
"HierarchicalProperty",
"(",
"new",
"QName",
"(",
"\"DAV:\"",
",",
"\"locktoken\"",
")",
")",
")",
";",
"HierarchicalProperty",
"lockHref",
"=",
"lockToken",
".",
"addChild",
"(",
"new",
"HierarchicalProperty",
"(",
"new",
"QName",
"(",
"\"DAV:\"",
",",
"\"href\"",
")",
")",
")",
";",
"lockHref",
".",
"setValue",
"(",
"token",
")",
";",
"}",
"return",
"lockDiscovery",
";",
"}"
] | Returns the information about lock.
@param token lock token
@param lockOwner lockowner
@param timeOut lock timeout
@return lock information | [
"Returns",
"the",
"information",
"about",
"lock",
"."
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/resource/GenericResource.java#L146-L179 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/Identity.java | Identity.checkForPrimaryKeys | protected void checkForPrimaryKeys(final Object realObject) throws ClassNotPersistenceCapableException {
"""
OJB can handle only classes that declare at least one primary key attribute,
this method checks this condition.
@param realObject The real object to check
@throws ClassNotPersistenceCapableException thrown if no primary key is specified for the objects class
"""
// if no PKs are specified OJB can't handle this class !
if (m_pkValues == null || m_pkValues.length == 0)
{
throw createException("OJB needs at least one primary key attribute for class: ", realObject, null);
}
// arminw: should never happen
// if(m_pkValues[0] instanceof ValueContainer)
// throw new OJBRuntimeException("Can't handle pk values of type "+ValueContainer.class.getName());
} | java | protected void checkForPrimaryKeys(final Object realObject) throws ClassNotPersistenceCapableException
{
// if no PKs are specified OJB can't handle this class !
if (m_pkValues == null || m_pkValues.length == 0)
{
throw createException("OJB needs at least one primary key attribute for class: ", realObject, null);
}
// arminw: should never happen
// if(m_pkValues[0] instanceof ValueContainer)
// throw new OJBRuntimeException("Can't handle pk values of type "+ValueContainer.class.getName());
} | [
"protected",
"void",
"checkForPrimaryKeys",
"(",
"final",
"Object",
"realObject",
")",
"throws",
"ClassNotPersistenceCapableException",
"{",
"// if no PKs are specified OJB can't handle this class !\r",
"if",
"(",
"m_pkValues",
"==",
"null",
"||",
"m_pkValues",
".",
"length",
"==",
"0",
")",
"{",
"throw",
"createException",
"(",
"\"OJB needs at least one primary key attribute for class: \"",
",",
"realObject",
",",
"null",
")",
";",
"}",
"// arminw: should never happen\r",
"// if(m_pkValues[0] instanceof ValueContainer)\r",
"// throw new OJBRuntimeException(\"Can't handle pk values of type \"+ValueContainer.class.getName());\r",
"}"
] | OJB can handle only classes that declare at least one primary key attribute,
this method checks this condition.
@param realObject The real object to check
@throws ClassNotPersistenceCapableException thrown if no primary key is specified for the objects class | [
"OJB",
"can",
"handle",
"only",
"classes",
"that",
"declare",
"at",
"least",
"one",
"primary",
"key",
"attribute",
"this",
"method",
"checks",
"this",
"condition",
"."
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/Identity.java#L369-L379 |
Wikidata/Wikidata-Toolkit | wdtk-examples/src/main/java/org/wikidata/wdtk/examples/ClassPropertyUsageAnalyzer.java | ClassPropertyUsageAnalyzer.getPropertyLabel | private String getPropertyLabel(PropertyIdValue propertyIdValue) {
"""
Returns a string that should be used as a label for the given property.
@param propertyIdValue
the property to label
@return the label
"""
PropertyRecord propertyRecord = this.propertyRecords
.get(propertyIdValue);
if (propertyRecord == null || propertyRecord.propertyDocument == null) {
return propertyIdValue.getId();
} else {
return getLabel(propertyIdValue, propertyRecord.propertyDocument);
}
} | java | private String getPropertyLabel(PropertyIdValue propertyIdValue) {
PropertyRecord propertyRecord = this.propertyRecords
.get(propertyIdValue);
if (propertyRecord == null || propertyRecord.propertyDocument == null) {
return propertyIdValue.getId();
} else {
return getLabel(propertyIdValue, propertyRecord.propertyDocument);
}
} | [
"private",
"String",
"getPropertyLabel",
"(",
"PropertyIdValue",
"propertyIdValue",
")",
"{",
"PropertyRecord",
"propertyRecord",
"=",
"this",
".",
"propertyRecords",
".",
"get",
"(",
"propertyIdValue",
")",
";",
"if",
"(",
"propertyRecord",
"==",
"null",
"||",
"propertyRecord",
".",
"propertyDocument",
"==",
"null",
")",
"{",
"return",
"propertyIdValue",
".",
"getId",
"(",
")",
";",
"}",
"else",
"{",
"return",
"getLabel",
"(",
"propertyIdValue",
",",
"propertyRecord",
".",
"propertyDocument",
")",
";",
"}",
"}"
] | Returns a string that should be used as a label for the given property.
@param propertyIdValue
the property to label
@return the label | [
"Returns",
"a",
"string",
"that",
"should",
"be",
"used",
"as",
"a",
"label",
"for",
"the",
"given",
"property",
"."
] | train | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-examples/src/main/java/org/wikidata/wdtk/examples/ClassPropertyUsageAnalyzer.java#L853-L861 |
jcuda/jcufft | JCufftJava/src/main/java/jcuda/jcufft/JCufft.java | JCufft.cufftExecR2C | public static int cufftExecR2C(cufftHandle plan, Pointer rIdata, Pointer cOdata) {
"""
<pre>
Executes a CUFFT real-to-complex (implicitly forward) transform plan.
cufftResult cufftExecR2C( cufftHandle plan, cufftReal *idata, cufftComplex *odata );
CUFFT uses as input data the GPU memory pointed to by the idata
parameter. This function stores the non-redundant Fourier coefficients
in the odata array. If idata and odata are the same, this method does
an in-place transform (See CUFFT documentation for details on real
data FFTs.)
Input
----
plan The cufftHandle object for the plan to update
idata Pointer to the input data (in GPU memory) to transform
odata Pointer to the output data (in GPU memory)
direction The transform direction: CUFFT_FORWARD or CUFFT_INVERSE
Output
----
odata Contains the complex Fourier coefficients
Return Values
----
CUFFT_SETUP_FAILED CUFFT library failed to initialize.
CUFFT_INVALID_PLAN The plan parameter is not a valid handle.
CUFFT_INVALID_VALUE The idata, odata, and/or direction parameter is not valid.
CUFFT_EXEC_FAILED CUFFT failed to execute the transform on GPU.
CUFFT_SUCCESS CUFFT successfully executed the FFT plan.
JCUFFT_INTERNAL_ERROR If an internal JCufft error occurred
<pre>
"""
return checkResult(cufftExecR2CNative(plan, rIdata, cOdata));
} | java | public static int cufftExecR2C(cufftHandle plan, Pointer rIdata, Pointer cOdata)
{
return checkResult(cufftExecR2CNative(plan, rIdata, cOdata));
} | [
"public",
"static",
"int",
"cufftExecR2C",
"(",
"cufftHandle",
"plan",
",",
"Pointer",
"rIdata",
",",
"Pointer",
"cOdata",
")",
"{",
"return",
"checkResult",
"(",
"cufftExecR2CNative",
"(",
"plan",
",",
"rIdata",
",",
"cOdata",
")",
")",
";",
"}"
] | <pre>
Executes a CUFFT real-to-complex (implicitly forward) transform plan.
cufftResult cufftExecR2C( cufftHandle plan, cufftReal *idata, cufftComplex *odata );
CUFFT uses as input data the GPU memory pointed to by the idata
parameter. This function stores the non-redundant Fourier coefficients
in the odata array. If idata and odata are the same, this method does
an in-place transform (See CUFFT documentation for details on real
data FFTs.)
Input
----
plan The cufftHandle object for the plan to update
idata Pointer to the input data (in GPU memory) to transform
odata Pointer to the output data (in GPU memory)
direction The transform direction: CUFFT_FORWARD or CUFFT_INVERSE
Output
----
odata Contains the complex Fourier coefficients
Return Values
----
CUFFT_SETUP_FAILED CUFFT library failed to initialize.
CUFFT_INVALID_PLAN The plan parameter is not a valid handle.
CUFFT_INVALID_VALUE The idata, odata, and/or direction parameter is not valid.
CUFFT_EXEC_FAILED CUFFT failed to execute the transform on GPU.
CUFFT_SUCCESS CUFFT successfully executed the FFT plan.
JCUFFT_INTERNAL_ERROR If an internal JCufft error occurred
<pre> | [
"<pre",
">",
"Executes",
"a",
"CUFFT",
"real",
"-",
"to",
"-",
"complex",
"(",
"implicitly",
"forward",
")",
"transform",
"plan",
"."
] | train | https://github.com/jcuda/jcufft/blob/833c87ffb0864f7ee7270fddef8af57f48939b3a/JCufftJava/src/main/java/jcuda/jcufft/JCufft.java#L952-L955 |
gmessner/gitlab4j-api | src/main/java/org/gitlab4j/api/EpicsApi.java | EpicsApi.updateIssue | public EpicIssue updateIssue(Object groupIdOrPath, Integer epicIid, Integer issueIid, Integer moveBeforeId, Integer moveAfterId) throws GitLabApiException {
"""
Updates an epic - issue association.
<pre><code>GitLab Endpoint: PUT /groups/:id/epics/:epic_iid/issues/:issue_id</code></pre>
@param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path
@param epicIid the Epic IID that the issue is assigned to
@param issueIid the issue IID to update
@param moveBeforeId the ID of the issue - epic association that should be placed before the link in the question (optional)
@param moveAfterId the ID of the issue - epic association that should be placed after the link in the question (optional)
@return an EpicIssue instance containing info on the newly assigned epic issue
@throws GitLabApiException if any exception occurs
"""
GitLabApiForm form = new GitLabApiForm()
.withParam("move_before_id", moveBeforeId)
.withParam("move_after_id", moveAfterId);
Response response = post(Response.Status.OK, form,
"groups", getGroupIdOrPath(groupIdOrPath), "epics", epicIid, "issues", issueIid);
return (response.readEntity(EpicIssue.class));
} | java | public EpicIssue updateIssue(Object groupIdOrPath, Integer epicIid, Integer issueIid, Integer moveBeforeId, Integer moveAfterId) throws GitLabApiException {
GitLabApiForm form = new GitLabApiForm()
.withParam("move_before_id", moveBeforeId)
.withParam("move_after_id", moveAfterId);
Response response = post(Response.Status.OK, form,
"groups", getGroupIdOrPath(groupIdOrPath), "epics", epicIid, "issues", issueIid);
return (response.readEntity(EpicIssue.class));
} | [
"public",
"EpicIssue",
"updateIssue",
"(",
"Object",
"groupIdOrPath",
",",
"Integer",
"epicIid",
",",
"Integer",
"issueIid",
",",
"Integer",
"moveBeforeId",
",",
"Integer",
"moveAfterId",
")",
"throws",
"GitLabApiException",
"{",
"GitLabApiForm",
"form",
"=",
"new",
"GitLabApiForm",
"(",
")",
".",
"withParam",
"(",
"\"move_before_id\"",
",",
"moveBeforeId",
")",
".",
"withParam",
"(",
"\"move_after_id\"",
",",
"moveAfterId",
")",
";",
"Response",
"response",
"=",
"post",
"(",
"Response",
".",
"Status",
".",
"OK",
",",
"form",
",",
"\"groups\"",
",",
"getGroupIdOrPath",
"(",
"groupIdOrPath",
")",
",",
"\"epics\"",
",",
"epicIid",
",",
"\"issues\"",
",",
"issueIid",
")",
";",
"return",
"(",
"response",
".",
"readEntity",
"(",
"EpicIssue",
".",
"class",
")",
")",
";",
"}"
] | Updates an epic - issue association.
<pre><code>GitLab Endpoint: PUT /groups/:id/epics/:epic_iid/issues/:issue_id</code></pre>
@param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path
@param epicIid the Epic IID that the issue is assigned to
@param issueIid the issue IID to update
@param moveBeforeId the ID of the issue - epic association that should be placed before the link in the question (optional)
@param moveAfterId the ID of the issue - epic association that should be placed after the link in the question (optional)
@return an EpicIssue instance containing info on the newly assigned epic issue
@throws GitLabApiException if any exception occurs | [
"Updates",
"an",
"epic",
"-",
"issue",
"association",
"."
] | train | https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/EpicsApi.java#L452-L459 |
qiniu/android-sdk | library/src/main/java/com/qiniu/android/http/Headers.java | Headers.of | public static Headers of(Map<String, String> headers) {
"""
Returns headers for the header names and values in the {@link Map}.
"""
if (headers == null) throw new NullPointerException("headers == null");
// Make a defensive copy and clean it up.
String[] namesAndValues = new String[headers.size() * 2];
int i = 0;
for (Map.Entry<String, String> header : headers.entrySet()) {
if (header.getKey() == null || header.getValue() == null) {
throw new IllegalArgumentException("Headers cannot be null");
}
String name = header.getKey().trim();
String value = header.getValue().trim();
if (name.length() == 0 || name.indexOf('\0') != -1 || value.indexOf('\0') != -1) {
throw new IllegalArgumentException("Unexpected header: " + name + ": " + value);
}
namesAndValues[i] = name;
namesAndValues[i + 1] = value;
i += 2;
}
return new Headers(namesAndValues);
} | java | public static Headers of(Map<String, String> headers) {
if (headers == null) throw new NullPointerException("headers == null");
// Make a defensive copy and clean it up.
String[] namesAndValues = new String[headers.size() * 2];
int i = 0;
for (Map.Entry<String, String> header : headers.entrySet()) {
if (header.getKey() == null || header.getValue() == null) {
throw new IllegalArgumentException("Headers cannot be null");
}
String name = header.getKey().trim();
String value = header.getValue().trim();
if (name.length() == 0 || name.indexOf('\0') != -1 || value.indexOf('\0') != -1) {
throw new IllegalArgumentException("Unexpected header: " + name + ": " + value);
}
namesAndValues[i] = name;
namesAndValues[i + 1] = value;
i += 2;
}
return new Headers(namesAndValues);
} | [
"public",
"static",
"Headers",
"of",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"headers",
")",
"{",
"if",
"(",
"headers",
"==",
"null",
")",
"throw",
"new",
"NullPointerException",
"(",
"\"headers == null\"",
")",
";",
"// Make a defensive copy and clean it up.",
"String",
"[",
"]",
"namesAndValues",
"=",
"new",
"String",
"[",
"headers",
".",
"size",
"(",
")",
"*",
"2",
"]",
";",
"int",
"i",
"=",
"0",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"String",
">",
"header",
":",
"headers",
".",
"entrySet",
"(",
")",
")",
"{",
"if",
"(",
"header",
".",
"getKey",
"(",
")",
"==",
"null",
"||",
"header",
".",
"getValue",
"(",
")",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Headers cannot be null\"",
")",
";",
"}",
"String",
"name",
"=",
"header",
".",
"getKey",
"(",
")",
".",
"trim",
"(",
")",
";",
"String",
"value",
"=",
"header",
".",
"getValue",
"(",
")",
".",
"trim",
"(",
")",
";",
"if",
"(",
"name",
".",
"length",
"(",
")",
"==",
"0",
"||",
"name",
".",
"indexOf",
"(",
"'",
"'",
")",
"!=",
"-",
"1",
"||",
"value",
".",
"indexOf",
"(",
"'",
"'",
")",
"!=",
"-",
"1",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Unexpected header: \"",
"+",
"name",
"+",
"\": \"",
"+",
"value",
")",
";",
"}",
"namesAndValues",
"[",
"i",
"]",
"=",
"name",
";",
"namesAndValues",
"[",
"i",
"+",
"1",
"]",
"=",
"value",
";",
"i",
"+=",
"2",
";",
"}",
"return",
"new",
"Headers",
"(",
"namesAndValues",
")",
";",
"}"
] | Returns headers for the header names and values in the {@link Map}. | [
"Returns",
"headers",
"for",
"the",
"header",
"names",
"and",
"values",
"in",
"the",
"{"
] | train | https://github.com/qiniu/android-sdk/blob/dbd2a01fb3bff7a5e75e8934bbf81713124d8466/library/src/main/java/com/qiniu/android/http/Headers.java#L107-L128 |
Azure/azure-sdk-for-java | compute/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/compute/v2018_04_01/implementation/DisksInner.java | DisksInner.grantAccessAsync | public Observable<AccessUriInner> grantAccessAsync(String resourceGroupName, String diskName, GrantAccessData grantAccessData) {
"""
Grants access to a disk.
@param resourceGroupName The name of the resource group.
@param diskName The name of the managed disk that is being created. The name can't be changed after the disk is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 characters.
@param grantAccessData Access data object supplied in the body of the get disk access operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request
"""
return grantAccessWithServiceResponseAsync(resourceGroupName, diskName, grantAccessData).map(new Func1<ServiceResponse<AccessUriInner>, AccessUriInner>() {
@Override
public AccessUriInner call(ServiceResponse<AccessUriInner> response) {
return response.body();
}
});
} | java | public Observable<AccessUriInner> grantAccessAsync(String resourceGroupName, String diskName, GrantAccessData grantAccessData) {
return grantAccessWithServiceResponseAsync(resourceGroupName, diskName, grantAccessData).map(new Func1<ServiceResponse<AccessUriInner>, AccessUriInner>() {
@Override
public AccessUriInner call(ServiceResponse<AccessUriInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"AccessUriInner",
">",
"grantAccessAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"diskName",
",",
"GrantAccessData",
"grantAccessData",
")",
"{",
"return",
"grantAccessWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"diskName",
",",
"grantAccessData",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"AccessUriInner",
">",
",",
"AccessUriInner",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"AccessUriInner",
"call",
"(",
"ServiceResponse",
"<",
"AccessUriInner",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Grants access to a disk.
@param resourceGroupName The name of the resource group.
@param diskName The name of the managed disk that is being created. The name can't be changed after the disk is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 characters.
@param grantAccessData Access data object supplied in the body of the get disk access operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Grants",
"access",
"to",
"a",
"disk",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/compute/v2018_04_01/implementation/DisksInner.java#L978-L985 |
alkacon/opencms-core | src/org/opencms/util/CmsRequestUtil.java | CmsRequestUtil.appendParameter | public static String appendParameter(String url, String paramName, String paramValue) {
"""
Appends a request parameter to the given URL.<p>
This method takes care about the adding the parameter as an additional
parameter (appending <code>¶m=value</code>) or as the first parameter
(appending <code>?param=value</code>).<p>
@param url the URL where to append the parameter to
@param paramName the paramter name to append
@param paramValue the parameter value to append
@return the URL with the given parameter appended
"""
if (CmsStringUtil.isEmpty(url)) {
return null;
}
int pos = url.indexOf(URL_DELIMITER);
StringBuffer result = new StringBuffer(256);
result.append(url);
if (pos >= 0) {
// url already has parameters
result.append(PARAMETER_DELIMITER);
} else {
// url does not have parameters
result.append(URL_DELIMITER);
}
result.append(paramName);
result.append(PARAMETER_ASSIGNMENT);
result.append(paramValue);
return result.toString();
} | java | public static String appendParameter(String url, String paramName, String paramValue) {
if (CmsStringUtil.isEmpty(url)) {
return null;
}
int pos = url.indexOf(URL_DELIMITER);
StringBuffer result = new StringBuffer(256);
result.append(url);
if (pos >= 0) {
// url already has parameters
result.append(PARAMETER_DELIMITER);
} else {
// url does not have parameters
result.append(URL_DELIMITER);
}
result.append(paramName);
result.append(PARAMETER_ASSIGNMENT);
result.append(paramValue);
return result.toString();
} | [
"public",
"static",
"String",
"appendParameter",
"(",
"String",
"url",
",",
"String",
"paramName",
",",
"String",
"paramValue",
")",
"{",
"if",
"(",
"CmsStringUtil",
".",
"isEmpty",
"(",
"url",
")",
")",
"{",
"return",
"null",
";",
"}",
"int",
"pos",
"=",
"url",
".",
"indexOf",
"(",
"URL_DELIMITER",
")",
";",
"StringBuffer",
"result",
"=",
"new",
"StringBuffer",
"(",
"256",
")",
";",
"result",
".",
"append",
"(",
"url",
")",
";",
"if",
"(",
"pos",
">=",
"0",
")",
"{",
"// url already has parameters",
"result",
".",
"append",
"(",
"PARAMETER_DELIMITER",
")",
";",
"}",
"else",
"{",
"// url does not have parameters",
"result",
".",
"append",
"(",
"URL_DELIMITER",
")",
";",
"}",
"result",
".",
"append",
"(",
"paramName",
")",
";",
"result",
".",
"append",
"(",
"PARAMETER_ASSIGNMENT",
")",
";",
"result",
".",
"append",
"(",
"paramValue",
")",
";",
"return",
"result",
".",
"toString",
"(",
")",
";",
"}"
] | Appends a request parameter to the given URL.<p>
This method takes care about the adding the parameter as an additional
parameter (appending <code>¶m=value</code>) or as the first parameter
(appending <code>?param=value</code>).<p>
@param url the URL where to append the parameter to
@param paramName the paramter name to append
@param paramValue the parameter value to append
@return the URL with the given parameter appended | [
"Appends",
"a",
"request",
"parameter",
"to",
"the",
"given",
"URL",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/util/CmsRequestUtil.java#L182-L201 |
nguillaumin/slick2d-maven | slick2d-core/src/main/java/org/newdawn/slick/font/effects/EffectUtil.java | EffectUtil.colorValue | static public Value colorValue(String name, Color currentValue) {
"""
Prompts the user for a colour value
@param name Thename of the value being configured
@param currentValue The default value that should be selected
@return The value selected
"""
return new DefaultValue(name, EffectUtil.toString(currentValue)) {
public void showDialog () {
Color newColor = JColorChooser.showDialog(null, "Choose a color", EffectUtil.fromString(value));
if (newColor != null) value = EffectUtil.toString(newColor);
}
public Object getObject () {
return EffectUtil.fromString(value);
}
};
} | java | static public Value colorValue(String name, Color currentValue) {
return new DefaultValue(name, EffectUtil.toString(currentValue)) {
public void showDialog () {
Color newColor = JColorChooser.showDialog(null, "Choose a color", EffectUtil.fromString(value));
if (newColor != null) value = EffectUtil.toString(newColor);
}
public Object getObject () {
return EffectUtil.fromString(value);
}
};
} | [
"static",
"public",
"Value",
"colorValue",
"(",
"String",
"name",
",",
"Color",
"currentValue",
")",
"{",
"return",
"new",
"DefaultValue",
"(",
"name",
",",
"EffectUtil",
".",
"toString",
"(",
"currentValue",
")",
")",
"{",
"public",
"void",
"showDialog",
"(",
")",
"{",
"Color",
"newColor",
"=",
"JColorChooser",
".",
"showDialog",
"(",
"null",
",",
"\"Choose a color\"",
",",
"EffectUtil",
".",
"fromString",
"(",
"value",
")",
")",
";",
"if",
"(",
"newColor",
"!=",
"null",
")",
"value",
"=",
"EffectUtil",
".",
"toString",
"(",
"newColor",
")",
";",
"}",
"public",
"Object",
"getObject",
"(",
")",
"{",
"return",
"EffectUtil",
".",
"fromString",
"(",
"value",
")",
";",
"}",
"}",
";",
"}"
] | Prompts the user for a colour value
@param name Thename of the value being configured
@param currentValue The default value that should be selected
@return The value selected | [
"Prompts",
"the",
"user",
"for",
"a",
"colour",
"value"
] | train | https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/font/effects/EffectUtil.java#L64-L75 |
transloadit/java-sdk | src/main/java/com/transloadit/sdk/Request.java | Request.jsonifyData | private String jsonifyData(Map<String, ? extends Object> data) {
"""
converts Map of data to json string
@param data map data to converted to json
@return {@link String}
"""
JSONObject jsonData = new JSONObject(data);
return jsonData.toString();
} | java | private String jsonifyData(Map<String, ? extends Object> data) {
JSONObject jsonData = new JSONObject(data);
return jsonData.toString();
} | [
"private",
"String",
"jsonifyData",
"(",
"Map",
"<",
"String",
",",
"?",
"extends",
"Object",
">",
"data",
")",
"{",
"JSONObject",
"jsonData",
"=",
"new",
"JSONObject",
"(",
"data",
")",
";",
"return",
"jsonData",
".",
"toString",
"(",
")",
";",
"}"
] | converts Map of data to json string
@param data map data to converted to json
@return {@link String} | [
"converts",
"Map",
"of",
"data",
"to",
"json",
"string"
] | train | https://github.com/transloadit/java-sdk/blob/9326c540a66f77b3d907d0b2c05bff1145ca14f7/src/main/java/com/transloadit/sdk/Request.java#L273-L277 |
haraldk/TwelveMonkeys | servlet/src/main/java/com/twelvemonkeys/servlet/ServletResponseStreamDelegate.java | ServletResponseStreamDelegate.getWriter | public final PrintWriter getWriter() throws IOException {
"""
NOTE: Intentionally NOT thread safe, as one request/response should be handled by one thread ONLY.
"""
if (out == null) {
// NOTE: getCharacterEncoding may/should not return null
OutputStream out = createOutputStream();
String charEncoding = response.getCharacterEncoding();
this.out = new PrintWriter(charEncoding != null ? new OutputStreamWriter(out, charEncoding) : new OutputStreamWriter(out));
}
else if (out instanceof ServletOutputStream) {
throw new IllegalStateException("getOutputStream() already called.");
}
return (PrintWriter) out;
} | java | public final PrintWriter getWriter() throws IOException {
if (out == null) {
// NOTE: getCharacterEncoding may/should not return null
OutputStream out = createOutputStream();
String charEncoding = response.getCharacterEncoding();
this.out = new PrintWriter(charEncoding != null ? new OutputStreamWriter(out, charEncoding) : new OutputStreamWriter(out));
}
else if (out instanceof ServletOutputStream) {
throw new IllegalStateException("getOutputStream() already called.");
}
return (PrintWriter) out;
} | [
"public",
"final",
"PrintWriter",
"getWriter",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"out",
"==",
"null",
")",
"{",
"// NOTE: getCharacterEncoding may/should not return null\r",
"OutputStream",
"out",
"=",
"createOutputStream",
"(",
")",
";",
"String",
"charEncoding",
"=",
"response",
".",
"getCharacterEncoding",
"(",
")",
";",
"this",
".",
"out",
"=",
"new",
"PrintWriter",
"(",
"charEncoding",
"!=",
"null",
"?",
"new",
"OutputStreamWriter",
"(",
"out",
",",
"charEncoding",
")",
":",
"new",
"OutputStreamWriter",
"(",
"out",
")",
")",
";",
"}",
"else",
"if",
"(",
"out",
"instanceof",
"ServletOutputStream",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"getOutputStream() already called.\"",
")",
";",
"}",
"return",
"(",
"PrintWriter",
")",
"out",
";",
"}"
] | NOTE: Intentionally NOT thread safe, as one request/response should be handled by one thread ONLY. | [
"NOTE",
":",
"Intentionally",
"NOT",
"thread",
"safe",
"as",
"one",
"request",
"/",
"response",
"should",
"be",
"handled",
"by",
"one",
"thread",
"ONLY",
"."
] | train | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/servlet/src/main/java/com/twelvemonkeys/servlet/ServletResponseStreamDelegate.java#L74-L86 |
sksamuel/scrimage | scrimage-filters/src/main/java/thirdparty/jhlabs/image/ImageMath.java | ImageMath.smoothStep | public static float smoothStep(float a, float b, float x) {
"""
A smoothed step function. A cubic function is used to smooth the step between two thresholds.
@param a the lower threshold position
@param b the upper threshold position
@param x the input parameter
@return the output value
"""
if (x < a)
return 0;
if (x >= b)
return 1;
x = (x - a) / (b - a);
return x*x * (3 - 2*x);
} | java | public static float smoothStep(float a, float b, float x) {
if (x < a)
return 0;
if (x >= b)
return 1;
x = (x - a) / (b - a);
return x*x * (3 - 2*x);
} | [
"public",
"static",
"float",
"smoothStep",
"(",
"float",
"a",
",",
"float",
"b",
",",
"float",
"x",
")",
"{",
"if",
"(",
"x",
"<",
"a",
")",
"return",
"0",
";",
"if",
"(",
"x",
">=",
"b",
")",
"return",
"1",
";",
"x",
"=",
"(",
"x",
"-",
"a",
")",
"/",
"(",
"b",
"-",
"a",
")",
";",
"return",
"x",
"*",
"x",
"*",
"(",
"3",
"-",
"2",
"*",
"x",
")",
";",
"}"
] | A smoothed step function. A cubic function is used to smooth the step between two thresholds.
@param a the lower threshold position
@param b the upper threshold position
@param x the input parameter
@return the output value | [
"A",
"smoothed",
"step",
"function",
".",
"A",
"cubic",
"function",
"is",
"used",
"to",
"smooth",
"the",
"step",
"between",
"two",
"thresholds",
"."
] | train | https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/image/ImageMath.java#L132-L139 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SslPolicyClient.java | SslPolicyClient.insertSslPolicy | @BetaApi
public final Operation insertSslPolicy(ProjectName project, SslPolicy sslPolicyResource) {
"""
Returns the specified SSL policy resource. Gets a list of available SSL policies by making a
list() request.
<p>Sample code:
<pre><code>
try (SslPolicyClient sslPolicyClient = SslPolicyClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
SslPolicy sslPolicyResource = SslPolicy.newBuilder().build();
Operation response = sslPolicyClient.insertSslPolicy(project, sslPolicyResource);
}
</code></pre>
@param project Project ID for this request.
@param sslPolicyResource A SSL policy specifies the server-side support for SSL features. This
can be attached to a TargetHttpsProxy or a TargetSslProxy. This affects connections between
clients and the HTTPS or SSL proxy load balancer. They do not affect the connection between
the load balancers and the backends.
@throws com.google.api.gax.rpc.ApiException if the remote call fails
"""
InsertSslPolicyHttpRequest request =
InsertSslPolicyHttpRequest.newBuilder()
.setProject(project == null ? null : project.toString())
.setSslPolicyResource(sslPolicyResource)
.build();
return insertSslPolicy(request);
} | java | @BetaApi
public final Operation insertSslPolicy(ProjectName project, SslPolicy sslPolicyResource) {
InsertSslPolicyHttpRequest request =
InsertSslPolicyHttpRequest.newBuilder()
.setProject(project == null ? null : project.toString())
.setSslPolicyResource(sslPolicyResource)
.build();
return insertSslPolicy(request);
} | [
"@",
"BetaApi",
"public",
"final",
"Operation",
"insertSslPolicy",
"(",
"ProjectName",
"project",
",",
"SslPolicy",
"sslPolicyResource",
")",
"{",
"InsertSslPolicyHttpRequest",
"request",
"=",
"InsertSslPolicyHttpRequest",
".",
"newBuilder",
"(",
")",
".",
"setProject",
"(",
"project",
"==",
"null",
"?",
"null",
":",
"project",
".",
"toString",
"(",
")",
")",
".",
"setSslPolicyResource",
"(",
"sslPolicyResource",
")",
".",
"build",
"(",
")",
";",
"return",
"insertSslPolicy",
"(",
"request",
")",
";",
"}"
] | Returns the specified SSL policy resource. Gets a list of available SSL policies by making a
list() request.
<p>Sample code:
<pre><code>
try (SslPolicyClient sslPolicyClient = SslPolicyClient.create()) {
ProjectName project = ProjectName.of("[PROJECT]");
SslPolicy sslPolicyResource = SslPolicy.newBuilder().build();
Operation response = sslPolicyClient.insertSslPolicy(project, sslPolicyResource);
}
</code></pre>
@param project Project ID for this request.
@param sslPolicyResource A SSL policy specifies the server-side support for SSL features. This
can be attached to a TargetHttpsProxy or a TargetSslProxy. This affects connections between
clients and the HTTPS or SSL proxy load balancer. They do not affect the connection between
the load balancers and the backends.
@throws com.google.api.gax.rpc.ApiException if the remote call fails | [
"Returns",
"the",
"specified",
"SSL",
"policy",
"resource",
".",
"Gets",
"a",
"list",
"of",
"available",
"SSL",
"policies",
"by",
"making",
"a",
"list",
"()",
"request",
"."
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SslPolicyClient.java#L378-L387 |
javagl/CommonUI | src/main/java/de/javagl/common/ui/tree/checkbox/CheckBoxTree.java | CheckBoxTree.fireStateChanged | private void fireStateChanged(Object node, State oldState, State newState) {
"""
Notify all {@link StateListener}s about a {@link State} change
@param node The node whose state changed
@param oldState The old state
@param newState The new state
"""
for (StateListener stateListener : stateListeners)
{
stateListener.stateChanged(node, oldState, newState);
}
} | java | private void fireStateChanged(Object node, State oldState, State newState)
{
for (StateListener stateListener : stateListeners)
{
stateListener.stateChanged(node, oldState, newState);
}
} | [
"private",
"void",
"fireStateChanged",
"(",
"Object",
"node",
",",
"State",
"oldState",
",",
"State",
"newState",
")",
"{",
"for",
"(",
"StateListener",
"stateListener",
":",
"stateListeners",
")",
"{",
"stateListener",
".",
"stateChanged",
"(",
"node",
",",
"oldState",
",",
"newState",
")",
";",
"}",
"}"
] | Notify all {@link StateListener}s about a {@link State} change
@param node The node whose state changed
@param oldState The old state
@param newState The new state | [
"Notify",
"all",
"{",
"@link",
"StateListener",
"}",
"s",
"about",
"a",
"{",
"@link",
"State",
"}",
"change"
] | train | https://github.com/javagl/CommonUI/blob/b2c7a7637d4e288271392ba148dc17e4c9780255/src/main/java/de/javagl/common/ui/tree/checkbox/CheckBoxTree.java#L185-L191 |
lievendoclo/Valkyrie-RCP | valkyrie-rcp-core/src/main/java/org/valkyriercp/util/ReflectiveVisitorHelper.java | ReflectiveVisitorHelper.getMethod | private Method getMethod(Class visitorClass, Object argument) {
"""
Determines the most appropriate visit method for the given visitor class
and argument.
"""
ClassVisitMethods visitMethods = (ClassVisitMethods) this.visitorClassVisitMethods
.get(visitorClass);
return visitMethods.getVisitMethod(argument != null ? argument
.getClass() : null);
} | java | private Method getMethod(Class visitorClass, Object argument) {
ClassVisitMethods visitMethods = (ClassVisitMethods) this.visitorClassVisitMethods
.get(visitorClass);
return visitMethods.getVisitMethod(argument != null ? argument
.getClass() : null);
} | [
"private",
"Method",
"getMethod",
"(",
"Class",
"visitorClass",
",",
"Object",
"argument",
")",
"{",
"ClassVisitMethods",
"visitMethods",
"=",
"(",
"ClassVisitMethods",
")",
"this",
".",
"visitorClassVisitMethods",
".",
"get",
"(",
"visitorClass",
")",
";",
"return",
"visitMethods",
".",
"getVisitMethod",
"(",
"argument",
"!=",
"null",
"?",
"argument",
".",
"getClass",
"(",
")",
":",
"null",
")",
";",
"}"
] | Determines the most appropriate visit method for the given visitor class
and argument. | [
"Determines",
"the",
"most",
"appropriate",
"visit",
"method",
"for",
"the",
"given",
"visitor",
"class",
"and",
"argument",
"."
] | train | https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/util/ReflectiveVisitorHelper.java#L114-L119 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/string/StringHelper.java | StringHelper.getWithoutTrailingChars | @Nonnull
public static String getWithoutTrailingChars (@Nullable final String sStr, @Nonnegative final int nCount) {
"""
Get the passed string without the specified number of trailing chars.
@param sStr
The source string. May be <code>null</code>.
@param nCount
The number of chars to remove.
@return An empty, non-<code>null</code> string if the passed string has a
length ≤ <code>nCount</code>.
"""
ValueEnforcer.isGE0 (nCount, "Count");
if (nCount == 0)
return sStr;
final int nLength = getLength (sStr);
return nLength <= nCount ? "" : sStr.substring (0, nLength - nCount);
} | java | @Nonnull
public static String getWithoutTrailingChars (@Nullable final String sStr, @Nonnegative final int nCount)
{
ValueEnforcer.isGE0 (nCount, "Count");
if (nCount == 0)
return sStr;
final int nLength = getLength (sStr);
return nLength <= nCount ? "" : sStr.substring (0, nLength - nCount);
} | [
"@",
"Nonnull",
"public",
"static",
"String",
"getWithoutTrailingChars",
"(",
"@",
"Nullable",
"final",
"String",
"sStr",
",",
"@",
"Nonnegative",
"final",
"int",
"nCount",
")",
"{",
"ValueEnforcer",
".",
"isGE0",
"(",
"nCount",
",",
"\"Count\"",
")",
";",
"if",
"(",
"nCount",
"==",
"0",
")",
"return",
"sStr",
";",
"final",
"int",
"nLength",
"=",
"getLength",
"(",
"sStr",
")",
";",
"return",
"nLength",
"<=",
"nCount",
"?",
"\"\"",
":",
"sStr",
".",
"substring",
"(",
"0",
",",
"nLength",
"-",
"nCount",
")",
";",
"}"
] | Get the passed string without the specified number of trailing chars.
@param sStr
The source string. May be <code>null</code>.
@param nCount
The number of chars to remove.
@return An empty, non-<code>null</code> string if the passed string has a
length ≤ <code>nCount</code>. | [
"Get",
"the",
"passed",
"string",
"without",
"the",
"specified",
"number",
"of",
"trailing",
"chars",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L4700-L4709 |
SeunMatt/mysql-backup4j | src/main/java/com/smattme/MysqlBaseService.java | MysqlBaseService.getEmptyTableSQL | static String getEmptyTableSQL(String database, String table) {
"""
This function is an helper function
that'll generate a DELETE FROM database.table
SQL to clear existing table
@param database database
@param table table
@return String sql to delete the all records from the table
"""
String safeDeleteSQL = "SELECT IF( \n" +
"(SELECT COUNT(1) as table_exists FROM information_schema.tables \n" +
"WHERE table_schema='" + database + "' AND table_name='" + table + "') > 1, \n" +
"'DELETE FROM " + table + "', \n" +
"'SELECT 1') INTO @DeleteSQL; \n" +
"PREPARE stmt FROM @DeleteSQL; \n" +
"EXECUTE stmt; DEALLOCATE PREPARE stmt; \n";
return "\n" + MysqlBaseService.SQL_START_PATTERN + "\n" +
safeDeleteSQL + "\n" +
"\n" + MysqlBaseService.SQL_END_PATTERN + "\n";
} | java | static String getEmptyTableSQL(String database, String table) {
String safeDeleteSQL = "SELECT IF( \n" +
"(SELECT COUNT(1) as table_exists FROM information_schema.tables \n" +
"WHERE table_schema='" + database + "' AND table_name='" + table + "') > 1, \n" +
"'DELETE FROM " + table + "', \n" +
"'SELECT 1') INTO @DeleteSQL; \n" +
"PREPARE stmt FROM @DeleteSQL; \n" +
"EXECUTE stmt; DEALLOCATE PREPARE stmt; \n";
return "\n" + MysqlBaseService.SQL_START_PATTERN + "\n" +
safeDeleteSQL + "\n" +
"\n" + MysqlBaseService.SQL_END_PATTERN + "\n";
} | [
"static",
"String",
"getEmptyTableSQL",
"(",
"String",
"database",
",",
"String",
"table",
")",
"{",
"String",
"safeDeleteSQL",
"=",
"\"SELECT IF( \\n\"",
"+",
"\"(SELECT COUNT(1) as table_exists FROM information_schema.tables \\n\"",
"+",
"\"WHERE table_schema='\"",
"+",
"database",
"+",
"\"' AND table_name='\"",
"+",
"table",
"+",
"\"') > 1, \\n\"",
"+",
"\"'DELETE FROM \"",
"+",
"table",
"+",
"\"', \\n\"",
"+",
"\"'SELECT 1') INTO @DeleteSQL; \\n\"",
"+",
"\"PREPARE stmt FROM @DeleteSQL; \\n\"",
"+",
"\"EXECUTE stmt; DEALLOCATE PREPARE stmt; \\n\"",
";",
"return",
"\"\\n\"",
"+",
"MysqlBaseService",
".",
"SQL_START_PATTERN",
"+",
"\"\\n\"",
"+",
"safeDeleteSQL",
"+",
"\"\\n\"",
"+",
"\"\\n\"",
"+",
"MysqlBaseService",
".",
"SQL_END_PATTERN",
"+",
"\"\\n\"",
";",
"}"
] | This function is an helper function
that'll generate a DELETE FROM database.table
SQL to clear existing table
@param database database
@param table table
@return String sql to delete the all records from the table | [
"This",
"function",
"is",
"an",
"helper",
"function",
"that",
"ll",
"generate",
"a",
"DELETE",
"FROM",
"database",
".",
"table",
"SQL",
"to",
"clear",
"existing",
"table"
] | train | https://github.com/SeunMatt/mysql-backup4j/blob/7e31aac33fe63948d4ad64a053394759457da636/src/main/java/com/smattme/MysqlBaseService.java#L104-L116 |
craftercms/profile | security-provider/src/main/java/org/craftercms/security/processors/impl/AddSecurityCookiesProcessor.java | AddSecurityCookiesProcessor.processRequest | @Override
public void processRequest(RequestContext context, RequestSecurityProcessorChain processorChain) throws Exception {
"""
Wraps the response in a wrapper that adds (or deletes) the security cookies before the response is sent.
@param context the context which holds the current request and response
@param processorChain the {@link RequestSecurityProcessorChain}, used to call the next processor
"""
AddSecurityCookiesResponseWrapper response = wrapResponse(context);
context.setResponse(response);
logger.debug("Wrapped response in a {}", response.getClass().getName());
try {
processorChain.processRequest(context);
} finally {
response.addCookies();
}
} | java | @Override
public void processRequest(RequestContext context, RequestSecurityProcessorChain processorChain) throws Exception {
AddSecurityCookiesResponseWrapper response = wrapResponse(context);
context.setResponse(response);
logger.debug("Wrapped response in a {}", response.getClass().getName());
try {
processorChain.processRequest(context);
} finally {
response.addCookies();
}
} | [
"@",
"Override",
"public",
"void",
"processRequest",
"(",
"RequestContext",
"context",
",",
"RequestSecurityProcessorChain",
"processorChain",
")",
"throws",
"Exception",
"{",
"AddSecurityCookiesResponseWrapper",
"response",
"=",
"wrapResponse",
"(",
"context",
")",
";",
"context",
".",
"setResponse",
"(",
"response",
")",
";",
"logger",
".",
"debug",
"(",
"\"Wrapped response in a {}\"",
",",
"response",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
")",
";",
"try",
"{",
"processorChain",
".",
"processRequest",
"(",
"context",
")",
";",
"}",
"finally",
"{",
"response",
".",
"addCookies",
"(",
")",
";",
"}",
"}"
] | Wraps the response in a wrapper that adds (or deletes) the security cookies before the response is sent.
@param context the context which holds the current request and response
@param processorChain the {@link RequestSecurityProcessorChain}, used to call the next processor | [
"Wraps",
"the",
"response",
"in",
"a",
"wrapper",
"that",
"adds",
"(",
"or",
"deletes",
")",
"the",
"security",
"cookies",
"before",
"the",
"response",
"is",
"sent",
"."
] | train | https://github.com/craftercms/profile/blob/d829c1136b0fd21d87dc925cb7046cbd38a300a4/security-provider/src/main/java/org/craftercms/security/processors/impl/AddSecurityCookiesProcessor.java#L66-L78 |
OwlPlatform/java-owl-worldmodel | src/main/java/com/owlplatform/worldmodel/client/ClientWorldConnection.java | ClientWorldConnection.getRangeRequest | public synchronized StepResponse getRangeRequest(final String idRegex,
final long start, final long end, String... attributes) {
"""
Sends a range request to the world model for the specified Identifier
regular expression, Attribute regular expressions, between the start and
end times.
@param idRegex
regular expression for matching the identifier.
@param start
the beginning of the range..
@param end
the end of the range.
@param attributes
the attribute regular expressions to request
@return a {@code StepResponse} for the request.
"""
RangeRequestMessage req = new RangeRequestMessage();
req.setIdRegex(idRegex);
req.setBeginTimestamp(start);
req.setEndTimestamp(end);
if (attributes != null) {
req.setAttributeRegexes(attributes);
}
StepResponse resp = new StepResponse(this, 0);
try {
while (!this.isReady) {
log.debug("Trying to wait until connection is ready.");
synchronized (this) {
try {
this.wait();
} catch (InterruptedException ie) {
// Ignored
}
}
}
long reqId = this.wmi.sendMessage(req);
resp.setTicketNumber(reqId);
this.outstandingSteps.put(Long.valueOf(reqId), resp);
log.info("Binding Tix #{} to {}", Long.valueOf(reqId), resp);
return resp;
} catch (Exception e) {
resp.setError(e);
return resp;
}
} | java | public synchronized StepResponse getRangeRequest(final String idRegex,
final long start, final long end, String... attributes) {
RangeRequestMessage req = new RangeRequestMessage();
req.setIdRegex(idRegex);
req.setBeginTimestamp(start);
req.setEndTimestamp(end);
if (attributes != null) {
req.setAttributeRegexes(attributes);
}
StepResponse resp = new StepResponse(this, 0);
try {
while (!this.isReady) {
log.debug("Trying to wait until connection is ready.");
synchronized (this) {
try {
this.wait();
} catch (InterruptedException ie) {
// Ignored
}
}
}
long reqId = this.wmi.sendMessage(req);
resp.setTicketNumber(reqId);
this.outstandingSteps.put(Long.valueOf(reqId), resp);
log.info("Binding Tix #{} to {}", Long.valueOf(reqId), resp);
return resp;
} catch (Exception e) {
resp.setError(e);
return resp;
}
} | [
"public",
"synchronized",
"StepResponse",
"getRangeRequest",
"(",
"final",
"String",
"idRegex",
",",
"final",
"long",
"start",
",",
"final",
"long",
"end",
",",
"String",
"...",
"attributes",
")",
"{",
"RangeRequestMessage",
"req",
"=",
"new",
"RangeRequestMessage",
"(",
")",
";",
"req",
".",
"setIdRegex",
"(",
"idRegex",
")",
";",
"req",
".",
"setBeginTimestamp",
"(",
"start",
")",
";",
"req",
".",
"setEndTimestamp",
"(",
"end",
")",
";",
"if",
"(",
"attributes",
"!=",
"null",
")",
"{",
"req",
".",
"setAttributeRegexes",
"(",
"attributes",
")",
";",
"}",
"StepResponse",
"resp",
"=",
"new",
"StepResponse",
"(",
"this",
",",
"0",
")",
";",
"try",
"{",
"while",
"(",
"!",
"this",
".",
"isReady",
")",
"{",
"log",
".",
"debug",
"(",
"\"Trying to wait until connection is ready.\"",
")",
";",
"synchronized",
"(",
"this",
")",
"{",
"try",
"{",
"this",
".",
"wait",
"(",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"ie",
")",
"{",
"// Ignored",
"}",
"}",
"}",
"long",
"reqId",
"=",
"this",
".",
"wmi",
".",
"sendMessage",
"(",
"req",
")",
";",
"resp",
".",
"setTicketNumber",
"(",
"reqId",
")",
";",
"this",
".",
"outstandingSteps",
".",
"put",
"(",
"Long",
".",
"valueOf",
"(",
"reqId",
")",
",",
"resp",
")",
";",
"log",
".",
"info",
"(",
"\"Binding Tix #{} to {}\"",
",",
"Long",
".",
"valueOf",
"(",
"reqId",
")",
",",
"resp",
")",
";",
"return",
"resp",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"resp",
".",
"setError",
"(",
"e",
")",
";",
"return",
"resp",
";",
"}",
"}"
] | Sends a range request to the world model for the specified Identifier
regular expression, Attribute regular expressions, between the start and
end times.
@param idRegex
regular expression for matching the identifier.
@param start
the beginning of the range..
@param end
the end of the range.
@param attributes
the attribute regular expressions to request
@return a {@code StepResponse} for the request. | [
"Sends",
"a",
"range",
"request",
"to",
"the",
"world",
"model",
"for",
"the",
"specified",
"Identifier",
"regular",
"expression",
"Attribute",
"regular",
"expressions",
"between",
"the",
"start",
"and",
"end",
"times",
"."
] | train | https://github.com/OwlPlatform/java-owl-worldmodel/blob/a850e8b930c6e9787c7cad30c0de887858ca563d/src/main/java/com/owlplatform/worldmodel/client/ClientWorldConnection.java#L348-L379 |
aws/aws-sdk-java | aws-java-sdk-core/src/main/java/com/amazonaws/util/XpathUtils.java | XpathUtils.asFloat | public static Float asFloat(String expression, Node node, XPath xpath)
throws XPathExpressionException {
"""
Same as {@link #asFloat(String, Node)} but allows an xpath to be passed
in explicitly for reuse.
"""
String floatString = evaluateAsString(expression, node, xpath);
return (isEmptyString(floatString)) ? null : Float.valueOf(floatString);
} | java | public static Float asFloat(String expression, Node node, XPath xpath)
throws XPathExpressionException {
String floatString = evaluateAsString(expression, node, xpath);
return (isEmptyString(floatString)) ? null : Float.valueOf(floatString);
} | [
"public",
"static",
"Float",
"asFloat",
"(",
"String",
"expression",
",",
"Node",
"node",
",",
"XPath",
"xpath",
")",
"throws",
"XPathExpressionException",
"{",
"String",
"floatString",
"=",
"evaluateAsString",
"(",
"expression",
",",
"node",
",",
"xpath",
")",
";",
"return",
"(",
"isEmptyString",
"(",
"floatString",
")",
")",
"?",
"null",
":",
"Float",
".",
"valueOf",
"(",
"floatString",
")",
";",
"}"
] | Same as {@link #asFloat(String, Node)} but allows an xpath to be passed
in explicitly for reuse. | [
"Same",
"as",
"{"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-core/src/main/java/com/amazonaws/util/XpathUtils.java#L356-L360 |
joniles/mpxj | src/main/java/net/sf/mpxj/ProjectCalendar.java | ProjectCalendar.getTime | private long getTime(Date start, Date end) {
"""
Retrieves the amount of time between two date time values. Note that
these values are converted into canonical values to remove the
date component.
@param start start time
@param end end time
@return length of time
"""
long total = 0;
if (start != null && end != null)
{
Date startTime = DateHelper.getCanonicalTime(start);
Date endTime = DateHelper.getCanonicalTime(end);
Date startDay = DateHelper.getDayStartDate(start);
Date finishDay = DateHelper.getDayStartDate(end);
//
// Handle the case where the end of the range is at midnight -
// this will show up as the start and end days not matching
//
if (startDay.getTime() != finishDay.getTime())
{
endTime = DateHelper.addDays(endTime, 1);
}
total = (endTime.getTime() - startTime.getTime());
}
return (total);
} | java | private long getTime(Date start, Date end)
{
long total = 0;
if (start != null && end != null)
{
Date startTime = DateHelper.getCanonicalTime(start);
Date endTime = DateHelper.getCanonicalTime(end);
Date startDay = DateHelper.getDayStartDate(start);
Date finishDay = DateHelper.getDayStartDate(end);
//
// Handle the case where the end of the range is at midnight -
// this will show up as the start and end days not matching
//
if (startDay.getTime() != finishDay.getTime())
{
endTime = DateHelper.addDays(endTime, 1);
}
total = (endTime.getTime() - startTime.getTime());
}
return (total);
} | [
"private",
"long",
"getTime",
"(",
"Date",
"start",
",",
"Date",
"end",
")",
"{",
"long",
"total",
"=",
"0",
";",
"if",
"(",
"start",
"!=",
"null",
"&&",
"end",
"!=",
"null",
")",
"{",
"Date",
"startTime",
"=",
"DateHelper",
".",
"getCanonicalTime",
"(",
"start",
")",
";",
"Date",
"endTime",
"=",
"DateHelper",
".",
"getCanonicalTime",
"(",
"end",
")",
";",
"Date",
"startDay",
"=",
"DateHelper",
".",
"getDayStartDate",
"(",
"start",
")",
";",
"Date",
"finishDay",
"=",
"DateHelper",
".",
"getDayStartDate",
"(",
"end",
")",
";",
"//",
"// Handle the case where the end of the range is at midnight -",
"// this will show up as the start and end days not matching",
"//",
"if",
"(",
"startDay",
".",
"getTime",
"(",
")",
"!=",
"finishDay",
".",
"getTime",
"(",
")",
")",
"{",
"endTime",
"=",
"DateHelper",
".",
"addDays",
"(",
"endTime",
",",
"1",
")",
";",
"}",
"total",
"=",
"(",
"endTime",
".",
"getTime",
"(",
")",
"-",
"startTime",
".",
"getTime",
"(",
")",
")",
";",
"}",
"return",
"(",
"total",
")",
";",
"}"
] | Retrieves the amount of time between two date time values. Note that
these values are converted into canonical values to remove the
date component.
@param start start time
@param end end time
@return length of time | [
"Retrieves",
"the",
"amount",
"of",
"time",
"between",
"two",
"date",
"time",
"values",
".",
"Note",
"that",
"these",
"values",
"are",
"converted",
"into",
"canonical",
"values",
"to",
"remove",
"the",
"date",
"component",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ProjectCalendar.java#L1566-L1589 |
yanzhenjie/Album | album/src/main/java/com/yanzhenjie/album/util/AlbumUtils.java | AlbumUtils.applyLanguageForContext | @NonNull
public static Context applyLanguageForContext(@NonNull Context context, @NonNull Locale locale) {
"""
Setting {@link Locale} for {@link Context}.
@param context to set the specified locale context.
@param locale locale.
"""
Resources resources = context.getResources();
Configuration config = resources.getConfiguration();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
config.setLocale(locale);
return context.createConfigurationContext(config);
} else {
config.locale = locale;
resources.updateConfiguration(config, resources.getDisplayMetrics());
return context;
}
} | java | @NonNull
public static Context applyLanguageForContext(@NonNull Context context, @NonNull Locale locale) {
Resources resources = context.getResources();
Configuration config = resources.getConfiguration();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
config.setLocale(locale);
return context.createConfigurationContext(config);
} else {
config.locale = locale;
resources.updateConfiguration(config, resources.getDisplayMetrics());
return context;
}
} | [
"@",
"NonNull",
"public",
"static",
"Context",
"applyLanguageForContext",
"(",
"@",
"NonNull",
"Context",
"context",
",",
"@",
"NonNull",
"Locale",
"locale",
")",
"{",
"Resources",
"resources",
"=",
"context",
".",
"getResources",
"(",
")",
";",
"Configuration",
"config",
"=",
"resources",
".",
"getConfiguration",
"(",
")",
";",
"if",
"(",
"Build",
".",
"VERSION",
".",
"SDK_INT",
">=",
"Build",
".",
"VERSION_CODES",
".",
"N",
")",
"{",
"config",
".",
"setLocale",
"(",
"locale",
")",
";",
"return",
"context",
".",
"createConfigurationContext",
"(",
"config",
")",
";",
"}",
"else",
"{",
"config",
".",
"locale",
"=",
"locale",
";",
"resources",
".",
"updateConfiguration",
"(",
"config",
",",
"resources",
".",
"getDisplayMetrics",
"(",
")",
")",
";",
"return",
"context",
";",
"}",
"}"
] | Setting {@link Locale} for {@link Context}.
@param context to set the specified locale context.
@param locale locale. | [
"Setting",
"{",
"@link",
"Locale",
"}",
"for",
"{",
"@link",
"Context",
"}",
"."
] | train | https://github.com/yanzhenjie/Album/blob/b17506440d32909d42aba41f6a388041a25c8363/album/src/main/java/com/yanzhenjie/album/util/AlbumUtils.java#L93-L105 |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/EJSContainer.java | EJSContainer.getUserTransactionThreadData | public static EJBThreadData getUserTransactionThreadData() {
"""
Returns the EJB thread data if an EJB context is active on the current
thread and that EJB may use UserTransaction.
@return verified EJB thread data
@throws EJBException if the pre-conditions aren't met
"""
EJBThreadData threadData = getThreadData();
BeanO beanO = threadData.getCallbackBeanO();
if (beanO == null) {
EJBException ex = new EJBException("EJB UserTransaction can only be used from an EJB");
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "getUserTransactionThreadData: " + ex);
throw ex;
}
try {
beanO.getUserTransaction();
} catch (IllegalStateException ex) {
EJBException ex2 = new EJBException("EJB UserTransaction cannot be used: " + ex, ex);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "getUserTransactionThreadData: " + beanO + ": " + ex2);
throw ex2;
}
return threadData;
} | java | public static EJBThreadData getUserTransactionThreadData() {
EJBThreadData threadData = getThreadData();
BeanO beanO = threadData.getCallbackBeanO();
if (beanO == null) {
EJBException ex = new EJBException("EJB UserTransaction can only be used from an EJB");
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "getUserTransactionThreadData: " + ex);
throw ex;
}
try {
beanO.getUserTransaction();
} catch (IllegalStateException ex) {
EJBException ex2 = new EJBException("EJB UserTransaction cannot be used: " + ex, ex);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "getUserTransactionThreadData: " + beanO + ": " + ex2);
throw ex2;
}
return threadData;
} | [
"public",
"static",
"EJBThreadData",
"getUserTransactionThreadData",
"(",
")",
"{",
"EJBThreadData",
"threadData",
"=",
"getThreadData",
"(",
")",
";",
"BeanO",
"beanO",
"=",
"threadData",
".",
"getCallbackBeanO",
"(",
")",
";",
"if",
"(",
"beanO",
"==",
"null",
")",
"{",
"EJBException",
"ex",
"=",
"new",
"EJBException",
"(",
"\"EJB UserTransaction can only be used from an EJB\"",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"getUserTransactionThreadData: \"",
"+",
"ex",
")",
";",
"throw",
"ex",
";",
"}",
"try",
"{",
"beanO",
".",
"getUserTransaction",
"(",
")",
";",
"}",
"catch",
"(",
"IllegalStateException",
"ex",
")",
"{",
"EJBException",
"ex2",
"=",
"new",
"EJBException",
"(",
"\"EJB UserTransaction cannot be used: \"",
"+",
"ex",
",",
"ex",
")",
";",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"getUserTransactionThreadData: \"",
"+",
"beanO",
"+",
"\": \"",
"+",
"ex2",
")",
";",
"throw",
"ex2",
";",
"}",
"return",
"threadData",
";",
"}"
] | Returns the EJB thread data if an EJB context is active on the current
thread and that EJB may use UserTransaction.
@return verified EJB thread data
@throws EJBException if the pre-conditions aren't met | [
"Returns",
"the",
"EJB",
"thread",
"data",
"if",
"an",
"EJB",
"context",
"is",
"active",
"on",
"the",
"current",
"thread",
"and",
"that",
"EJB",
"may",
"use",
"UserTransaction",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/EJSContainer.java#L1373-L1394 |
andkulikov/Transitions-Everywhere | library(1.x)/src/main/java/com/transitionseverywhere/TransitionManager.java | TransitionManager.setTransitionName | public static void setTransitionName(@NonNull View v, @Nullable String transitionName) {
"""
Sets the name of the View to be used to identify Views in Transitions.
Names should be unique in the View hierarchy.
@param transitionName The name of the View to uniquely identify it for Transitions.
"""
ViewUtils.setTransitionName(v, transitionName);
} | java | public static void setTransitionName(@NonNull View v, @Nullable String transitionName) {
ViewUtils.setTransitionName(v, transitionName);
} | [
"public",
"static",
"void",
"setTransitionName",
"(",
"@",
"NonNull",
"View",
"v",
",",
"@",
"Nullable",
"String",
"transitionName",
")",
"{",
"ViewUtils",
".",
"setTransitionName",
"(",
"v",
",",
"transitionName",
")",
";",
"}"
] | Sets the name of the View to be used to identify Views in Transitions.
Names should be unique in the View hierarchy.
@param transitionName The name of the View to uniquely identify it for Transitions. | [
"Sets",
"the",
"name",
"of",
"the",
"View",
"to",
"be",
"used",
"to",
"identify",
"Views",
"in",
"Transitions",
".",
"Names",
"should",
"be",
"unique",
"in",
"the",
"View",
"hierarchy",
"."
] | train | https://github.com/andkulikov/Transitions-Everywhere/blob/828efe5f152a2f05e2bfeee6254b74ad2269d4f1/library(1.x)/src/main/java/com/transitionseverywhere/TransitionManager.java#L481-L483 |
xwiki/xwiki-commons | xwiki-commons-core/xwiki-commons-crypto/xwiki-commons-crypto-store/xwiki-commons-crypto-store-filesystem/src/main/java/org/xwiki/crypto/store/filesystem/internal/AbstractX509FileSystemStore.java | AbstractX509FileSystemStore.writeHeader | private static void writeHeader(BufferedWriter out, String type) throws IOException {
"""
Write a PEM like header.
@param out the output buffered writer to write to.
@param type the type to be written in the header.
@throws IOException on error.
"""
out.write(PEM_BEGIN + type + DASHES);
out.newLine();
} | java | private static void writeHeader(BufferedWriter out, String type) throws IOException
{
out.write(PEM_BEGIN + type + DASHES);
out.newLine();
} | [
"private",
"static",
"void",
"writeHeader",
"(",
"BufferedWriter",
"out",
",",
"String",
"type",
")",
"throws",
"IOException",
"{",
"out",
".",
"write",
"(",
"PEM_BEGIN",
"+",
"type",
"+",
"DASHES",
")",
";",
"out",
".",
"newLine",
"(",
")",
";",
"}"
] | Write a PEM like header.
@param out the output buffered writer to write to.
@param type the type to be written in the header.
@throws IOException on error. | [
"Write",
"a",
"PEM",
"like",
"header",
"."
] | train | https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-crypto/xwiki-commons-crypto-store/xwiki-commons-crypto-store-filesystem/src/main/java/org/xwiki/crypto/store/filesystem/internal/AbstractX509FileSystemStore.java#L117-L121 |
mgm-tp/jfunk | jfunk-core/src/main/java/com/mgmtp/jfunk/core/reporting/SimpleReporter.java | SimpleReporter.appendEscapedAndQuoted | protected void appendEscapedAndQuoted(final StringBuilder sb, final String value) {
"""
<p>
Encloses the given value into double-quotes. Quote characters are escaped with an additional quote character. Line breaks
are replaced with a space character. Multiple line breaks are collapsed to a single space.
</p>
<p>
If the specified StringBuilder is non-empty, a semi-colon is appended first.
</p>
@param sb
the string buffer the escaped and quoted result is appended to
@param value
the input string to transform
"""
boolean foundLineBreak = false;
if (sb.length() > 0) {
sb.append(DELIMITER);
}
sb.append(CSV_QUOTE);
if (value != null) {
for (int i = 0, len = value.length(); i < len; ++i) {
char c = value.charAt(i);
switch (c) {
case CSV_QUOTE:
if (foundLineBreak) {
foundLineBreak = false;
sb.append(' ');
}
sb.append(c); // escape double quote, i. e. add quote character again
break;
case '\r':
case '\n':
foundLineBreak = true;
continue;
default:
if (foundLineBreak) {
sb.append(' ');
foundLineBreak = false;
}
break;
}
sb.append(c);
}
}
sb.append(CSV_QUOTE);
} | java | protected void appendEscapedAndQuoted(final StringBuilder sb, final String value) {
boolean foundLineBreak = false;
if (sb.length() > 0) {
sb.append(DELIMITER);
}
sb.append(CSV_QUOTE);
if (value != null) {
for (int i = 0, len = value.length(); i < len; ++i) {
char c = value.charAt(i);
switch (c) {
case CSV_QUOTE:
if (foundLineBreak) {
foundLineBreak = false;
sb.append(' ');
}
sb.append(c); // escape double quote, i. e. add quote character again
break;
case '\r':
case '\n':
foundLineBreak = true;
continue;
default:
if (foundLineBreak) {
sb.append(' ');
foundLineBreak = false;
}
break;
}
sb.append(c);
}
}
sb.append(CSV_QUOTE);
} | [
"protected",
"void",
"appendEscapedAndQuoted",
"(",
"final",
"StringBuilder",
"sb",
",",
"final",
"String",
"value",
")",
"{",
"boolean",
"foundLineBreak",
"=",
"false",
";",
"if",
"(",
"sb",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"sb",
".",
"append",
"(",
"DELIMITER",
")",
";",
"}",
"sb",
".",
"append",
"(",
"CSV_QUOTE",
")",
";",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"len",
"=",
"value",
".",
"length",
"(",
")",
";",
"i",
"<",
"len",
";",
"++",
"i",
")",
"{",
"char",
"c",
"=",
"value",
".",
"charAt",
"(",
"i",
")",
";",
"switch",
"(",
"c",
")",
"{",
"case",
"CSV_QUOTE",
":",
"if",
"(",
"foundLineBreak",
")",
"{",
"foundLineBreak",
"=",
"false",
";",
"sb",
".",
"append",
"(",
"'",
"'",
")",
";",
"}",
"sb",
".",
"append",
"(",
"c",
")",
";",
"// escape double quote, i. e. add quote character again\r",
"break",
";",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"foundLineBreak",
"=",
"true",
";",
"continue",
";",
"default",
":",
"if",
"(",
"foundLineBreak",
")",
"{",
"sb",
".",
"append",
"(",
"'",
"'",
")",
";",
"foundLineBreak",
"=",
"false",
";",
"}",
"break",
";",
"}",
"sb",
".",
"append",
"(",
"c",
")",
";",
"}",
"}",
"sb",
".",
"append",
"(",
"CSV_QUOTE",
")",
";",
"}"
] | <p>
Encloses the given value into double-quotes. Quote characters are escaped with an additional quote character. Line breaks
are replaced with a space character. Multiple line breaks are collapsed to a single space.
</p>
<p>
If the specified StringBuilder is non-empty, a semi-colon is appended first.
</p>
@param sb
the string buffer the escaped and quoted result is appended to
@param value
the input string to transform | [
"<p",
">",
"Encloses",
"the",
"given",
"value",
"into",
"double",
"-",
"quotes",
".",
"Quote",
"characters",
"are",
"escaped",
"with",
"an",
"additional",
"quote",
"character",
".",
"Line",
"breaks",
"are",
"replaced",
"with",
"a",
"space",
"character",
".",
"Multiple",
"line",
"breaks",
"are",
"collapsed",
"to",
"a",
"single",
"space",
".",
"<",
"/",
"p",
">",
"<p",
">",
"If",
"the",
"specified",
"StringBuilder",
"is",
"non",
"-",
"empty",
"a",
"semi",
"-",
"colon",
"is",
"appended",
"first",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/mgm-tp/jfunk/blob/5b9fecac5778b988bb458085ded39ea9a4c7c2ae/jfunk-core/src/main/java/com/mgmtp/jfunk/core/reporting/SimpleReporter.java#L181-L215 |
xvik/generics-resolver | src/main/java/ru/vyarus/java/generics/resolver/util/GenericsUtils.java | GenericsUtils.resolveTypeVariables | public static Type[] resolveTypeVariables(final Type[] types, final Map<String, Type> generics) {
"""
Shortcut for {@link #resolveTypeVariables(Type, Map)} to process multiple types at once.
@param types types to replace named generics in
@param generics known generics
@return types without named generics
@see TypeVariableUtils#resolveAllTypeVariables(Type[], Map)
"""
return resolveTypeVariables(types, generics, false);
} | java | public static Type[] resolveTypeVariables(final Type[] types, final Map<String, Type> generics) {
return resolveTypeVariables(types, generics, false);
} | [
"public",
"static",
"Type",
"[",
"]",
"resolveTypeVariables",
"(",
"final",
"Type",
"[",
"]",
"types",
",",
"final",
"Map",
"<",
"String",
",",
"Type",
">",
"generics",
")",
"{",
"return",
"resolveTypeVariables",
"(",
"types",
",",
"generics",
",",
"false",
")",
";",
"}"
] | Shortcut for {@link #resolveTypeVariables(Type, Map)} to process multiple types at once.
@param types types to replace named generics in
@param generics known generics
@return types without named generics
@see TypeVariableUtils#resolveAllTypeVariables(Type[], Map) | [
"Shortcut",
"for",
"{",
"@link",
"#resolveTypeVariables",
"(",
"Type",
"Map",
")",
"}",
"to",
"process",
"multiple",
"types",
"at",
"once",
"."
] | train | https://github.com/xvik/generics-resolver/blob/d7d9d2783265df1178230e8f0b7cb6d853b67a7b/src/main/java/ru/vyarus/java/generics/resolver/util/GenericsUtils.java#L298-L300 |
apache/fluo | modules/api/src/main/java/org/apache/fluo/api/data/Bytes.java | Bytes.compareToUnchecked | private int compareToUnchecked(byte[] bytes, int offset, int len) {
"""
Compares this to the passed bytes, byte by byte, returning a negative, zero, or positive result
if the first sequence is less than, equal to, or greater than the second. The comparison is
performed starting with the first byte of each sequence, and proceeds until a pair of bytes
differs, or one sequence runs out of byte (is shorter). A shorter sequence is considered less
than a longer one.
This method does not check the arguments passed to it.
@since 1.2.0
@return comparison result
"""
if (this.length == this.data.length && len == bytes.length) {
return UnsignedBytes.lexicographicalComparator().compare(this.data, bytes);
} else {
int minLen = Math.min(this.length, len);
for (int i = this.offset, j = offset; i < minLen; i++, j++) {
int a = (this.data[i] & 0xff);
int b = (bytes[j] & 0xff);
if (a != b) {
return a - b;
}
}
return this.length - len;
}
} | java | private int compareToUnchecked(byte[] bytes, int offset, int len) {
if (this.length == this.data.length && len == bytes.length) {
return UnsignedBytes.lexicographicalComparator().compare(this.data, bytes);
} else {
int minLen = Math.min(this.length, len);
for (int i = this.offset, j = offset; i < minLen; i++, j++) {
int a = (this.data[i] & 0xff);
int b = (bytes[j] & 0xff);
if (a != b) {
return a - b;
}
}
return this.length - len;
}
} | [
"private",
"int",
"compareToUnchecked",
"(",
"byte",
"[",
"]",
"bytes",
",",
"int",
"offset",
",",
"int",
"len",
")",
"{",
"if",
"(",
"this",
".",
"length",
"==",
"this",
".",
"data",
".",
"length",
"&&",
"len",
"==",
"bytes",
".",
"length",
")",
"{",
"return",
"UnsignedBytes",
".",
"lexicographicalComparator",
"(",
")",
".",
"compare",
"(",
"this",
".",
"data",
",",
"bytes",
")",
";",
"}",
"else",
"{",
"int",
"minLen",
"=",
"Math",
".",
"min",
"(",
"this",
".",
"length",
",",
"len",
")",
";",
"for",
"(",
"int",
"i",
"=",
"this",
".",
"offset",
",",
"j",
"=",
"offset",
";",
"i",
"<",
"minLen",
";",
"i",
"++",
",",
"j",
"++",
")",
"{",
"int",
"a",
"=",
"(",
"this",
".",
"data",
"[",
"i",
"]",
"&",
"0xff",
")",
";",
"int",
"b",
"=",
"(",
"bytes",
"[",
"j",
"]",
"&",
"0xff",
")",
";",
"if",
"(",
"a",
"!=",
"b",
")",
"{",
"return",
"a",
"-",
"b",
";",
"}",
"}",
"return",
"this",
".",
"length",
"-",
"len",
";",
"}",
"}"
] | Compares this to the passed bytes, byte by byte, returning a negative, zero, or positive result
if the first sequence is less than, equal to, or greater than the second. The comparison is
performed starting with the first byte of each sequence, and proceeds until a pair of bytes
differs, or one sequence runs out of byte (is shorter). A shorter sequence is considered less
than a longer one.
This method does not check the arguments passed to it.
@since 1.2.0
@return comparison result | [
"Compares",
"this",
"to",
"the",
"passed",
"bytes",
"byte",
"by",
"byte",
"returning",
"a",
"negative",
"zero",
"or",
"positive",
"result",
"if",
"the",
"first",
"sequence",
"is",
"less",
"than",
"equal",
"to",
"or",
"greater",
"than",
"the",
"second",
".",
"The",
"comparison",
"is",
"performed",
"starting",
"with",
"the",
"first",
"byte",
"of",
"each",
"sequence",
"and",
"proceeds",
"until",
"a",
"pair",
"of",
"bytes",
"differs",
"or",
"one",
"sequence",
"runs",
"out",
"of",
"byte",
"(",
"is",
"shorter",
")",
".",
"A",
"shorter",
"sequence",
"is",
"considered",
"less",
"than",
"a",
"longer",
"one",
"."
] | train | https://github.com/apache/fluo/blob/8e06204d4167651e2d3b5219b8c1397644e6ba6e/modules/api/src/main/java/org/apache/fluo/api/data/Bytes.java#L250-L264 |
ngageoint/geopackage-android-map | geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java | GoogleMapShapeConverter.toPoint | public Point toPoint(LatLng latLng, boolean hasZ, boolean hasM) {
"""
Convert a {@link LatLng} to a {@link Point}
@param latLng lat lng
@param hasZ has z flag
@param hasM has m flag
@return point
"""
double y = latLng.latitude;
double x = latLng.longitude;
Point point = new Point(hasZ, hasM, x, y);
point = toProjection(point);
return point;
} | java | public Point toPoint(LatLng latLng, boolean hasZ, boolean hasM) {
double y = latLng.latitude;
double x = latLng.longitude;
Point point = new Point(hasZ, hasM, x, y);
point = toProjection(point);
return point;
} | [
"public",
"Point",
"toPoint",
"(",
"LatLng",
"latLng",
",",
"boolean",
"hasZ",
",",
"boolean",
"hasM",
")",
"{",
"double",
"y",
"=",
"latLng",
".",
"latitude",
";",
"double",
"x",
"=",
"latLng",
".",
"longitude",
";",
"Point",
"point",
"=",
"new",
"Point",
"(",
"hasZ",
",",
"hasM",
",",
"x",
",",
"y",
")",
";",
"point",
"=",
"toProjection",
"(",
"point",
")",
";",
"return",
"point",
";",
"}"
] | Convert a {@link LatLng} to a {@link Point}
@param latLng lat lng
@param hasZ has z flag
@param hasM has m flag
@return point | [
"Convert",
"a",
"{",
"@link",
"LatLng",
"}",
"to",
"a",
"{",
"@link",
"Point",
"}"
] | train | https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java#L247-L253 |
mygreen/excel-cellformatter | src/main/java/com/github/mygreen/cellformatter/JXLCellFormatter.java | JXLCellFormatter.getCellValue | private CellFormatResult getCellValue(final Cell cell, final Locale locale, final boolean isStartDate1904) {
"""
セルの値をフォーマットする。
@param cell フォーマット対象のセル
@param locale ロケール
@param isStartDate1904 1904年始まりかどうか。
@return
"""
final JXLCell jxlCell = new JXLCell(cell, isStartDate1904);
final short formatIndex = jxlCell.getFormatIndex();
final String formatPattern = jxlCell.getFormatPattern();
if(formatterResolver.canResolve(formatIndex)) {
final CellFormatter cellFormatter = formatterResolver.getFormatter(formatIndex);
return cellFormatter.format(jxlCell, locale);
} else if(formatterResolver.canResolve(formatPattern)) {
final CellFormatter cellFormatter = formatterResolver.getFormatter(formatPattern);
return cellFormatter.format(jxlCell, locale);
} else {
// キャッシュに登録する。
final CellFormatter cellFormatter = formatterResolver.createFormatter(formatPattern) ;
if(isCache()) {
formatterResolver.registerFormatter(formatPattern, cellFormatter);
}
return cellFormatter.format(jxlCell, locale);
}
} | java | private CellFormatResult getCellValue(final Cell cell, final Locale locale, final boolean isStartDate1904) {
final JXLCell jxlCell = new JXLCell(cell, isStartDate1904);
final short formatIndex = jxlCell.getFormatIndex();
final String formatPattern = jxlCell.getFormatPattern();
if(formatterResolver.canResolve(formatIndex)) {
final CellFormatter cellFormatter = formatterResolver.getFormatter(formatIndex);
return cellFormatter.format(jxlCell, locale);
} else if(formatterResolver.canResolve(formatPattern)) {
final CellFormatter cellFormatter = formatterResolver.getFormatter(formatPattern);
return cellFormatter.format(jxlCell, locale);
} else {
// キャッシュに登録する。
final CellFormatter cellFormatter = formatterResolver.createFormatter(formatPattern) ;
if(isCache()) {
formatterResolver.registerFormatter(formatPattern, cellFormatter);
}
return cellFormatter.format(jxlCell, locale);
}
} | [
"private",
"CellFormatResult",
"getCellValue",
"(",
"final",
"Cell",
"cell",
",",
"final",
"Locale",
"locale",
",",
"final",
"boolean",
"isStartDate1904",
")",
"{",
"final",
"JXLCell",
"jxlCell",
"=",
"new",
"JXLCell",
"(",
"cell",
",",
"isStartDate1904",
")",
";",
"final",
"short",
"formatIndex",
"=",
"jxlCell",
".",
"getFormatIndex",
"(",
")",
";",
"final",
"String",
"formatPattern",
"=",
"jxlCell",
".",
"getFormatPattern",
"(",
")",
";",
"if",
"(",
"formatterResolver",
".",
"canResolve",
"(",
"formatIndex",
")",
")",
"{",
"final",
"CellFormatter",
"cellFormatter",
"=",
"formatterResolver",
".",
"getFormatter",
"(",
"formatIndex",
")",
";",
"return",
"cellFormatter",
".",
"format",
"(",
"jxlCell",
",",
"locale",
")",
";",
"}",
"else",
"if",
"(",
"formatterResolver",
".",
"canResolve",
"(",
"formatPattern",
")",
")",
"{",
"final",
"CellFormatter",
"cellFormatter",
"=",
"formatterResolver",
".",
"getFormatter",
"(",
"formatPattern",
")",
";",
"return",
"cellFormatter",
".",
"format",
"(",
"jxlCell",
",",
"locale",
")",
";",
"}",
"else",
"{",
"// キャッシュに登録する。\r",
"final",
"CellFormatter",
"cellFormatter",
"=",
"formatterResolver",
".",
"createFormatter",
"(",
"formatPattern",
")",
";",
"if",
"(",
"isCache",
"(",
")",
")",
"{",
"formatterResolver",
".",
"registerFormatter",
"(",
"formatPattern",
",",
"cellFormatter",
")",
";",
"}",
"return",
"cellFormatter",
".",
"format",
"(",
"jxlCell",
",",
"locale",
")",
";",
"}",
"}"
] | セルの値をフォーマットする。
@param cell フォーマット対象のセル
@param locale ロケール
@param isStartDate1904 1904年始まりかどうか。
@return | [
"セルの値をフォーマットする。"
] | train | https://github.com/mygreen/excel-cellformatter/blob/e802af273d49889500591e03799c9262cbf29185/src/main/java/com/github/mygreen/cellformatter/JXLCellFormatter.java#L257-L281 |
TheHortonMachine/hortonmachine | apps/src/main/java/org/hortonmachine/database/SqlDocument.java | SqlDocument.insertString | public void insertString( int offset, String str, AttributeSet a ) throws BadLocationException {
"""
/*
Override to apply syntax highlighting after the document has been updated
"""
if (str.equals("{"))
str = addMatchingBrace(offset);
super.insertString(offset, str, a);
processChangedLines(offset, str.length());
} | java | public void insertString( int offset, String str, AttributeSet a ) throws BadLocationException {
if (str.equals("{"))
str = addMatchingBrace(offset);
super.insertString(offset, str, a);
processChangedLines(offset, str.length());
} | [
"public",
"void",
"insertString",
"(",
"int",
"offset",
",",
"String",
"str",
",",
"AttributeSet",
"a",
")",
"throws",
"BadLocationException",
"{",
"if",
"(",
"str",
".",
"equals",
"(",
"\"{\"",
")",
")",
"str",
"=",
"addMatchingBrace",
"(",
"offset",
")",
";",
"super",
".",
"insertString",
"(",
"offset",
",",
"str",
",",
"a",
")",
";",
"processChangedLines",
"(",
"offset",
",",
"str",
".",
"length",
"(",
")",
")",
";",
"}"
] | /*
Override to apply syntax highlighting after the document has been updated | [
"/",
"*",
"Override",
"to",
"apply",
"syntax",
"highlighting",
"after",
"the",
"document",
"has",
"been",
"updated"
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/apps/src/main/java/org/hortonmachine/database/SqlDocument.java#L87-L92 |
Azure/azure-sdk-for-java | common/azure-common/src/main/java/com/azure/common/http/ContextData.java | ContextData.addData | public ContextData addData(Object key, Object value) {
"""
Adds a new immutable {@link ContextData} object with the specified key-value pair to
the existing {@link ContextData} chain.
@param key the key
@param value the value
@return the new {@link ContextData} object containing the specified pair added to the set of pairs
"""
if (key == null) {
throw new IllegalArgumentException("key cannot be null");
}
return new ContextData(this, key, value);
} | java | public ContextData addData(Object key, Object value) {
if (key == null) {
throw new IllegalArgumentException("key cannot be null");
}
return new ContextData(this, key, value);
} | [
"public",
"ContextData",
"addData",
"(",
"Object",
"key",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"key",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"key cannot be null\"",
")",
";",
"}",
"return",
"new",
"ContextData",
"(",
"this",
",",
"key",
",",
"value",
")",
";",
"}"
] | Adds a new immutable {@link ContextData} object with the specified key-value pair to
the existing {@link ContextData} chain.
@param key the key
@param value the value
@return the new {@link ContextData} object containing the specified pair added to the set of pairs | [
"Adds",
"a",
"new",
"immutable",
"{",
"@link",
"ContextData",
"}",
"object",
"with",
"the",
"specified",
"key",
"-",
"value",
"pair",
"to",
"the",
"existing",
"{",
"@link",
"ContextData",
"}",
"chain",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/common/azure-common/src/main/java/com/azure/common/http/ContextData.java#L56-L61 |
beihaifeiwu/dolphin | dolphin-common/src/main/java/com/freetmp/common/core/OrderComparator.java | OrderComparator.getOrder | private int getOrder(Object obj, OrderSourceProvider sourceProvider) {
"""
Determine the order value for the given object.
<p>The default implementation checks against the given {@link OrderSourceProvider}
using {@link #findOrder} and falls back to a regular {@link #getOrder(Object)} call.
@param obj the object to check
@return the order value, or {@code Ordered.LOWEST_PRECEDENCE} as fallback
"""
Integer order = null;
if (sourceProvider != null) {
order = findOrder(sourceProvider.getOrderSource(obj));
}
return (order != null ? order : getOrder(obj));
} | java | private int getOrder(Object obj, OrderSourceProvider sourceProvider) {
Integer order = null;
if (sourceProvider != null) {
order = findOrder(sourceProvider.getOrderSource(obj));
}
return (order != null ? order : getOrder(obj));
} | [
"private",
"int",
"getOrder",
"(",
"Object",
"obj",
",",
"OrderSourceProvider",
"sourceProvider",
")",
"{",
"Integer",
"order",
"=",
"null",
";",
"if",
"(",
"sourceProvider",
"!=",
"null",
")",
"{",
"order",
"=",
"findOrder",
"(",
"sourceProvider",
".",
"getOrderSource",
"(",
"obj",
")",
")",
";",
"}",
"return",
"(",
"order",
"!=",
"null",
"?",
"order",
":",
"getOrder",
"(",
"obj",
")",
")",
";",
"}"
] | Determine the order value for the given object.
<p>The default implementation checks against the given {@link OrderSourceProvider}
using {@link #findOrder} and falls back to a regular {@link #getOrder(Object)} call.
@param obj the object to check
@return the order value, or {@code Ordered.LOWEST_PRECEDENCE} as fallback | [
"Determine",
"the",
"order",
"value",
"for",
"the",
"given",
"object",
".",
"<p",
">",
"The",
"default",
"implementation",
"checks",
"against",
"the",
"given",
"{"
] | train | https://github.com/beihaifeiwu/dolphin/blob/b100579cc6986dce5eba5593ebb5fbae7bad9d1a/dolphin-common/src/main/java/com/freetmp/common/core/OrderComparator.java#L89-L95 |
apereo/cas | support/cas-server-support-ws-idp/src/main/java/org/apereo/cas/ws/idp/web/WSFederationValidateRequestController.java | WSFederationValidateRequestController.handleFederationRequest | @GetMapping(path = WSFederationConstants.ENDPOINT_FEDERATION_REQUEST)
protected void handleFederationRequest(final HttpServletResponse response, final HttpServletRequest request) throws Exception {
"""
Handle federation request.
@param response the response
@param request the request
@throws Exception the exception
"""
val fedRequest = WSFederationRequest.of(request);
val wa = fedRequest.getWa();
if (StringUtils.isBlank(wa)) {
throw new UnauthorizedAuthenticationException("Unable to determine the [WA] parameter", new HashMap<>(0));
}
switch (wa.toLowerCase()) {
case WSFederationConstants.WSIGNOUT10:
case WSFederationConstants.WSIGNOUT_CLEANUP10:
handleLogoutRequest(fedRequest, request, response);
break;
case WSFederationConstants.WSIGNIN10:
val targetService = getWsFederationRequestConfigurationContext().getWebApplicationServiceFactory().createService(fedRequest.getWreply());
handleInitialAuthenticationRequest(fedRequest, targetService, response, request);
break;
default:
throw new UnauthorizedAuthenticationException("The authentication request is not recognized", new HashMap<>(0));
}
} | java | @GetMapping(path = WSFederationConstants.ENDPOINT_FEDERATION_REQUEST)
protected void handleFederationRequest(final HttpServletResponse response, final HttpServletRequest request) throws Exception {
val fedRequest = WSFederationRequest.of(request);
val wa = fedRequest.getWa();
if (StringUtils.isBlank(wa)) {
throw new UnauthorizedAuthenticationException("Unable to determine the [WA] parameter", new HashMap<>(0));
}
switch (wa.toLowerCase()) {
case WSFederationConstants.WSIGNOUT10:
case WSFederationConstants.WSIGNOUT_CLEANUP10:
handleLogoutRequest(fedRequest, request, response);
break;
case WSFederationConstants.WSIGNIN10:
val targetService = getWsFederationRequestConfigurationContext().getWebApplicationServiceFactory().createService(fedRequest.getWreply());
handleInitialAuthenticationRequest(fedRequest, targetService, response, request);
break;
default:
throw new UnauthorizedAuthenticationException("The authentication request is not recognized", new HashMap<>(0));
}
} | [
"@",
"GetMapping",
"(",
"path",
"=",
"WSFederationConstants",
".",
"ENDPOINT_FEDERATION_REQUEST",
")",
"protected",
"void",
"handleFederationRequest",
"(",
"final",
"HttpServletResponse",
"response",
",",
"final",
"HttpServletRequest",
"request",
")",
"throws",
"Exception",
"{",
"val",
"fedRequest",
"=",
"WSFederationRequest",
".",
"of",
"(",
"request",
")",
";",
"val",
"wa",
"=",
"fedRequest",
".",
"getWa",
"(",
")",
";",
"if",
"(",
"StringUtils",
".",
"isBlank",
"(",
"wa",
")",
")",
"{",
"throw",
"new",
"UnauthorizedAuthenticationException",
"(",
"\"Unable to determine the [WA] parameter\"",
",",
"new",
"HashMap",
"<>",
"(",
"0",
")",
")",
";",
"}",
"switch",
"(",
"wa",
".",
"toLowerCase",
"(",
")",
")",
"{",
"case",
"WSFederationConstants",
".",
"WSIGNOUT10",
":",
"case",
"WSFederationConstants",
".",
"WSIGNOUT_CLEANUP10",
":",
"handleLogoutRequest",
"(",
"fedRequest",
",",
"request",
",",
"response",
")",
";",
"break",
";",
"case",
"WSFederationConstants",
".",
"WSIGNIN10",
":",
"val",
"targetService",
"=",
"getWsFederationRequestConfigurationContext",
"(",
")",
".",
"getWebApplicationServiceFactory",
"(",
")",
".",
"createService",
"(",
"fedRequest",
".",
"getWreply",
"(",
")",
")",
";",
"handleInitialAuthenticationRequest",
"(",
"fedRequest",
",",
"targetService",
",",
"response",
",",
"request",
")",
";",
"break",
";",
"default",
":",
"throw",
"new",
"UnauthorizedAuthenticationException",
"(",
"\"The authentication request is not recognized\"",
",",
"new",
"HashMap",
"<>",
"(",
"0",
")",
")",
";",
"}",
"}"
] | Handle federation request.
@param response the response
@param request the request
@throws Exception the exception | [
"Handle",
"federation",
"request",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-ws-idp/src/main/java/org/apereo/cas/ws/idp/web/WSFederationValidateRequestController.java#L41-L61 |
jboss-integration/fuse-bxms-integ | switchyard/switchyard-component-common-knowledge/src/main/java/org/switchyard/component/common/knowledge/config/model/KnowledgeSwitchYardScanner.java | KnowledgeSwitchYardScanner.toManifestModel | protected ManifestModel toManifestModel(Manifest[] manifestAnnotations, KnowledgeNamespace knowledgeNamespace) {
"""
Converts manifest annotations to manifest model.
@param manifestAnnotations annotations
@param knowledgeNamespace knowledgeNamespace
@return model
"""
if (manifestAnnotations == null || manifestAnnotations.length == 0) {
return null;
}
Manifest manifestAnnotation = manifestAnnotations[0];
ManifestModel manifestModel = new V1ManifestModel(knowledgeNamespace.uri());
Container[] container = manifestAnnotation.container();
if (container != null && container.length > 0) {
manifestModel.setContainer(toContainerModel(container[0], knowledgeNamespace));
}
manifestModel.setResources(toResourcesModel(manifestAnnotation.resources(), knowledgeNamespace));
return manifestModel;
} | java | protected ManifestModel toManifestModel(Manifest[] manifestAnnotations, KnowledgeNamespace knowledgeNamespace) {
if (manifestAnnotations == null || manifestAnnotations.length == 0) {
return null;
}
Manifest manifestAnnotation = manifestAnnotations[0];
ManifestModel manifestModel = new V1ManifestModel(knowledgeNamespace.uri());
Container[] container = manifestAnnotation.container();
if (container != null && container.length > 0) {
manifestModel.setContainer(toContainerModel(container[0], knowledgeNamespace));
}
manifestModel.setResources(toResourcesModel(manifestAnnotation.resources(), knowledgeNamespace));
return manifestModel;
} | [
"protected",
"ManifestModel",
"toManifestModel",
"(",
"Manifest",
"[",
"]",
"manifestAnnotations",
",",
"KnowledgeNamespace",
"knowledgeNamespace",
")",
"{",
"if",
"(",
"manifestAnnotations",
"==",
"null",
"||",
"manifestAnnotations",
".",
"length",
"==",
"0",
")",
"{",
"return",
"null",
";",
"}",
"Manifest",
"manifestAnnotation",
"=",
"manifestAnnotations",
"[",
"0",
"]",
";",
"ManifestModel",
"manifestModel",
"=",
"new",
"V1ManifestModel",
"(",
"knowledgeNamespace",
".",
"uri",
"(",
")",
")",
";",
"Container",
"[",
"]",
"container",
"=",
"manifestAnnotation",
".",
"container",
"(",
")",
";",
"if",
"(",
"container",
"!=",
"null",
"&&",
"container",
".",
"length",
">",
"0",
")",
"{",
"manifestModel",
".",
"setContainer",
"(",
"toContainerModel",
"(",
"container",
"[",
"0",
"]",
",",
"knowledgeNamespace",
")",
")",
";",
"}",
"manifestModel",
".",
"setResources",
"(",
"toResourcesModel",
"(",
"manifestAnnotation",
".",
"resources",
"(",
")",
",",
"knowledgeNamespace",
")",
")",
";",
"return",
"manifestModel",
";",
"}"
] | Converts manifest annotations to manifest model.
@param manifestAnnotations annotations
@param knowledgeNamespace knowledgeNamespace
@return model | [
"Converts",
"manifest",
"annotations",
"to",
"manifest",
"model",
"."
] | train | https://github.com/jboss-integration/fuse-bxms-integ/blob/ca5c012bf867ea15d1250f0991af3cd7e708aaaf/switchyard/switchyard-component-common-knowledge/src/main/java/org/switchyard/component/common/knowledge/config/model/KnowledgeSwitchYardScanner.java#L210-L222 |
hyperledger/fabric-sdk-java | src/main/java/org/hyperledger/fabric/sdk/Channel.java | Channel.removePeer | public void removePeer(Peer peer) throws InvalidArgumentException {
"""
Removes the peer connection from the channel.
This does NOT unjoin the peer from from the channel.
Fabric does not support that at this time -- maybe some day, but not today
@param peer
"""
if (shutdown) {
throw new InvalidArgumentException(format("Can not remove peer from channel %s already shutdown.", name));
}
logger.debug(format("removePeer %s from channel %s", peer, toString()));
checkPeer(peer);
removePeerInternal(peer);
peer.shutdown(true);
} | java | public void removePeer(Peer peer) throws InvalidArgumentException {
if (shutdown) {
throw new InvalidArgumentException(format("Can not remove peer from channel %s already shutdown.", name));
}
logger.debug(format("removePeer %s from channel %s", peer, toString()));
checkPeer(peer);
removePeerInternal(peer);
peer.shutdown(true);
} | [
"public",
"void",
"removePeer",
"(",
"Peer",
"peer",
")",
"throws",
"InvalidArgumentException",
"{",
"if",
"(",
"shutdown",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"format",
"(",
"\"Can not remove peer from channel %s already shutdown.\"",
",",
"name",
")",
")",
";",
"}",
"logger",
".",
"debug",
"(",
"format",
"(",
"\"removePeer %s from channel %s\"",
",",
"peer",
",",
"toString",
"(",
")",
")",
")",
";",
"checkPeer",
"(",
"peer",
")",
";",
"removePeerInternal",
"(",
"peer",
")",
";",
"peer",
".",
"shutdown",
"(",
"true",
")",
";",
"}"
] | Removes the peer connection from the channel.
This does NOT unjoin the peer from from the channel.
Fabric does not support that at this time -- maybe some day, but not today
@param peer | [
"Removes",
"the",
"peer",
"connection",
"from",
"the",
"channel",
".",
"This",
"does",
"NOT",
"unjoin",
"the",
"peer",
"from",
"from",
"the",
"channel",
".",
"Fabric",
"does",
"not",
"support",
"that",
"at",
"this",
"time",
"--",
"maybe",
"some",
"day",
"but",
"not",
"today"
] | train | https://github.com/hyperledger/fabric-sdk-java/blob/4a2d7b3408b8b0a1ed812aa36942c438159c37a0/src/main/java/org/hyperledger/fabric/sdk/Channel.java#L890-L900 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/PluralRulesLoader.java | PluralRulesLoader.forLocale | public PluralRules forLocale(ULocale locale, PluralRules.PluralType type) {
"""
Returns the plural rules for the the locale. If we don't have data,
android.icu.text.PluralRules.DEFAULT is returned.
"""
String rulesId = getRulesIdForLocale(locale, type);
if (rulesId == null || rulesId.trim().length() == 0) {
return PluralRules.DEFAULT;
}
PluralRules rules = getRulesForRulesId(rulesId);
if (rules == null) {
rules = PluralRules.DEFAULT;
}
return rules;
} | java | public PluralRules forLocale(ULocale locale, PluralRules.PluralType type) {
String rulesId = getRulesIdForLocale(locale, type);
if (rulesId == null || rulesId.trim().length() == 0) {
return PluralRules.DEFAULT;
}
PluralRules rules = getRulesForRulesId(rulesId);
if (rules == null) {
rules = PluralRules.DEFAULT;
}
return rules;
} | [
"public",
"PluralRules",
"forLocale",
"(",
"ULocale",
"locale",
",",
"PluralRules",
".",
"PluralType",
"type",
")",
"{",
"String",
"rulesId",
"=",
"getRulesIdForLocale",
"(",
"locale",
",",
"type",
")",
";",
"if",
"(",
"rulesId",
"==",
"null",
"||",
"rulesId",
".",
"trim",
"(",
")",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"return",
"PluralRules",
".",
"DEFAULT",
";",
"}",
"PluralRules",
"rules",
"=",
"getRulesForRulesId",
"(",
"rulesId",
")",
";",
"if",
"(",
"rules",
"==",
"null",
")",
"{",
"rules",
"=",
"PluralRules",
".",
"DEFAULT",
";",
"}",
"return",
"rules",
";",
"}"
] | Returns the plural rules for the the locale. If we don't have data,
android.icu.text.PluralRules.DEFAULT is returned. | [
"Returns",
"the",
"plural",
"rules",
"for",
"the",
"the",
"locale",
".",
"If",
"we",
"don",
"t",
"have",
"data",
"android",
".",
"icu",
".",
"text",
".",
"PluralRules",
".",
"DEFAULT",
"is",
"returned",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/PluralRulesLoader.java#L239-L249 |
Azure/azure-sdk-for-java | appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/AppServiceCertificateOrdersInner.java | AppServiceCertificateOrdersInner.beginCreateOrUpdateCertificate | public AppServiceCertificateResourceInner beginCreateOrUpdateCertificate(String resourceGroupName, String certificateOrderName, String name, AppServiceCertificateResourceInner keyVaultCertificate) {
"""
Creates or updates a certificate and associates with key vault secret.
Creates or updates a certificate and associates with key vault secret.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param certificateOrderName Name of the certificate order.
@param name Name of the certificate.
@param keyVaultCertificate Key vault certificate resource Id.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws DefaultErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the AppServiceCertificateResourceInner object if successful.
"""
return beginCreateOrUpdateCertificateWithServiceResponseAsync(resourceGroupName, certificateOrderName, name, keyVaultCertificate).toBlocking().single().body();
} | java | public AppServiceCertificateResourceInner beginCreateOrUpdateCertificate(String resourceGroupName, String certificateOrderName, String name, AppServiceCertificateResourceInner keyVaultCertificate) {
return beginCreateOrUpdateCertificateWithServiceResponseAsync(resourceGroupName, certificateOrderName, name, keyVaultCertificate).toBlocking().single().body();
} | [
"public",
"AppServiceCertificateResourceInner",
"beginCreateOrUpdateCertificate",
"(",
"String",
"resourceGroupName",
",",
"String",
"certificateOrderName",
",",
"String",
"name",
",",
"AppServiceCertificateResourceInner",
"keyVaultCertificate",
")",
"{",
"return",
"beginCreateOrUpdateCertificateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"certificateOrderName",
",",
"name",
",",
"keyVaultCertificate",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
] | Creates or updates a certificate and associates with key vault secret.
Creates or updates a certificate and associates with key vault secret.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param certificateOrderName Name of the certificate order.
@param name Name of the certificate.
@param keyVaultCertificate Key vault certificate resource Id.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws DefaultErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the AppServiceCertificateResourceInner object if successful. | [
"Creates",
"or",
"updates",
"a",
"certificate",
"and",
"associates",
"with",
"key",
"vault",
"secret",
".",
"Creates",
"or",
"updates",
"a",
"certificate",
"and",
"associates",
"with",
"key",
"vault",
"secret",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/AppServiceCertificateOrdersInner.java#L1277-L1279 |
google/closure-templates | java/src/com/google/template/soy/i18ndirectives/I18nUtils.java | I18nUtils.parseLocale | public static Locale parseLocale(String localeString) {
"""
Given a string representing a Locale, returns the Locale object for that string.
@return A Locale object built from the string provided
"""
if (localeString == null) {
return Locale.US;
}
String[] groups = localeString.split("[-_]");
switch (groups.length) {
case 1:
return new Locale(groups[0]);
case 2:
return new Locale(groups[0], Ascii.toUpperCase(groups[1]));
case 3:
return new Locale(groups[0], Ascii.toUpperCase(groups[1]), groups[2]);
default:
throw new IllegalArgumentException("Malformed localeString: " + localeString);
}
} | java | public static Locale parseLocale(String localeString) {
if (localeString == null) {
return Locale.US;
}
String[] groups = localeString.split("[-_]");
switch (groups.length) {
case 1:
return new Locale(groups[0]);
case 2:
return new Locale(groups[0], Ascii.toUpperCase(groups[1]));
case 3:
return new Locale(groups[0], Ascii.toUpperCase(groups[1]), groups[2]);
default:
throw new IllegalArgumentException("Malformed localeString: " + localeString);
}
} | [
"public",
"static",
"Locale",
"parseLocale",
"(",
"String",
"localeString",
")",
"{",
"if",
"(",
"localeString",
"==",
"null",
")",
"{",
"return",
"Locale",
".",
"US",
";",
"}",
"String",
"[",
"]",
"groups",
"=",
"localeString",
".",
"split",
"(",
"\"[-_]\"",
")",
";",
"switch",
"(",
"groups",
".",
"length",
")",
"{",
"case",
"1",
":",
"return",
"new",
"Locale",
"(",
"groups",
"[",
"0",
"]",
")",
";",
"case",
"2",
":",
"return",
"new",
"Locale",
"(",
"groups",
"[",
"0",
"]",
",",
"Ascii",
".",
"toUpperCase",
"(",
"groups",
"[",
"1",
"]",
")",
")",
";",
"case",
"3",
":",
"return",
"new",
"Locale",
"(",
"groups",
"[",
"0",
"]",
",",
"Ascii",
".",
"toUpperCase",
"(",
"groups",
"[",
"1",
"]",
")",
",",
"groups",
"[",
"2",
"]",
")",
";",
"default",
":",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Malformed localeString: \"",
"+",
"localeString",
")",
";",
"}",
"}"
] | Given a string representing a Locale, returns the Locale object for that string.
@return A Locale object built from the string provided | [
"Given",
"a",
"string",
"representing",
"a",
"Locale",
"returns",
"the",
"Locale",
"object",
"for",
"that",
"string",
"."
] | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/i18ndirectives/I18nUtils.java#L37-L52 |
OpenLiberty/open-liberty | dev/com.ibm.ws.monitor/src/com/ibm/ws/pmi/server/NLS.java | NLS.getInteger | public int getInteger(String key) throws MissingResourceException {
"""
Not sure why this is here. Looks like it is a replacement for
Integer.getInteger.
"""
String result = getString(key);
try {
return Integer.parseInt(result);
} catch (NumberFormatException nfe) {
if (tc.isEventEnabled()) {
Tr.event(tc, "Unable to parse " + result + " as Integer.");
}
// DGH20040823: Begin fix for defect 218797 - Source provided by Tom Musta
// String msg = messages.getString("NLS.integerParseError",
// "Unable to parse as integer.");
String msg = getMessages().getString("NLS.integerParseError",
"Unable to parse as integer.");
// DGH20040823: End fix for defect 218797 - Source provided by Tom Musta
throw new MissingResourceException(msg, bundleName, key);
}
} | java | public int getInteger(String key) throws MissingResourceException {
String result = getString(key);
try {
return Integer.parseInt(result);
} catch (NumberFormatException nfe) {
if (tc.isEventEnabled()) {
Tr.event(tc, "Unable to parse " + result + " as Integer.");
}
// DGH20040823: Begin fix for defect 218797 - Source provided by Tom Musta
// String msg = messages.getString("NLS.integerParseError",
// "Unable to parse as integer.");
String msg = getMessages().getString("NLS.integerParseError",
"Unable to parse as integer.");
// DGH20040823: End fix for defect 218797 - Source provided by Tom Musta
throw new MissingResourceException(msg, bundleName, key);
}
} | [
"public",
"int",
"getInteger",
"(",
"String",
"key",
")",
"throws",
"MissingResourceException",
"{",
"String",
"result",
"=",
"getString",
"(",
"key",
")",
";",
"try",
"{",
"return",
"Integer",
".",
"parseInt",
"(",
"result",
")",
";",
"}",
"catch",
"(",
"NumberFormatException",
"nfe",
")",
"{",
"if",
"(",
"tc",
".",
"isEventEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"event",
"(",
"tc",
",",
"\"Unable to parse \"",
"+",
"result",
"+",
"\" as Integer.\"",
")",
";",
"}",
"// DGH20040823: Begin fix for defect 218797 - Source provided by Tom Musta",
"// String msg = messages.getString(\"NLS.integerParseError\",",
"// \"Unable to parse as integer.\");",
"String",
"msg",
"=",
"getMessages",
"(",
")",
".",
"getString",
"(",
"\"NLS.integerParseError\"",
",",
"\"Unable to parse as integer.\"",
")",
";",
"// DGH20040823: End fix for defect 218797 - Source provided by Tom Musta",
"throw",
"new",
"MissingResourceException",
"(",
"msg",
",",
"bundleName",
",",
"key",
")",
";",
"}",
"}"
] | Not sure why this is here. Looks like it is a replacement for
Integer.getInteger. | [
"Not",
"sure",
"why",
"this",
"is",
"here",
".",
"Looks",
"like",
"it",
"is",
"a",
"replacement",
"for",
"Integer",
".",
"getInteger",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.monitor/src/com/ibm/ws/pmi/server/NLS.java#L408-L424 |
ykrasik/jaci | jaci-cli-core/src/main/java/com/github/ykrasik/jaci/cli/command/CliCommand.java | CliCommand.fromDef | public static CliCommand fromDef(CommandDef def) {
"""
Construct a CLI command from a {@link CommandDef}.
@param def CommandDef to construct a CLI command from.
@return A CLI command constructed from the CommandDef.
"""
final Identifier identifier = def.getIdentifier();
final List<CliParam> params = createParams(def.getParamDefs());
final CommandExecutor executor = def.getExecutor();
return from(identifier, params, executor);
} | java | public static CliCommand fromDef(CommandDef def) {
final Identifier identifier = def.getIdentifier();
final List<CliParam> params = createParams(def.getParamDefs());
final CommandExecutor executor = def.getExecutor();
return from(identifier, params, executor);
} | [
"public",
"static",
"CliCommand",
"fromDef",
"(",
"CommandDef",
"def",
")",
"{",
"final",
"Identifier",
"identifier",
"=",
"def",
".",
"getIdentifier",
"(",
")",
";",
"final",
"List",
"<",
"CliParam",
">",
"params",
"=",
"createParams",
"(",
"def",
".",
"getParamDefs",
"(",
")",
")",
";",
"final",
"CommandExecutor",
"executor",
"=",
"def",
".",
"getExecutor",
"(",
")",
";",
"return",
"from",
"(",
"identifier",
",",
"params",
",",
"executor",
")",
";",
"}"
] | Construct a CLI command from a {@link CommandDef}.
@param def CommandDef to construct a CLI command from.
@return A CLI command constructed from the CommandDef. | [
"Construct",
"a",
"CLI",
"command",
"from",
"a",
"{",
"@link",
"CommandDef",
"}",
"."
] | train | https://github.com/ykrasik/jaci/blob/4615edef7c76288ad5ea8d678132b161645ca1e3/jaci-cli-core/src/main/java/com/github/ykrasik/jaci/cli/command/CliCommand.java#L103-L108 |
Azure/azure-sdk-for-java | sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerBlobAuditingPoliciesInner.java | ServerBlobAuditingPoliciesInner.getAsync | public Observable<ServerBlobAuditingPolicyInner> getAsync(String resourceGroupName, String serverName) {
"""
Gets a server's blob auditing policy.
@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.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ServerBlobAuditingPolicyInner object
"""
return getWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1<ServiceResponse<ServerBlobAuditingPolicyInner>, ServerBlobAuditingPolicyInner>() {
@Override
public ServerBlobAuditingPolicyInner call(ServiceResponse<ServerBlobAuditingPolicyInner> response) {
return response.body();
}
});
} | java | public Observable<ServerBlobAuditingPolicyInner> getAsync(String resourceGroupName, String serverName) {
return getWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1<ServiceResponse<ServerBlobAuditingPolicyInner>, ServerBlobAuditingPolicyInner>() {
@Override
public ServerBlobAuditingPolicyInner call(ServiceResponse<ServerBlobAuditingPolicyInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ServerBlobAuditingPolicyInner",
">",
"getAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"serverName",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"ServerBlobAuditingPolicyInner",
">",
",",
"ServerBlobAuditingPolicyInner",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"ServerBlobAuditingPolicyInner",
"call",
"(",
"ServiceResponse",
"<",
"ServerBlobAuditingPolicyInner",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Gets a server's blob auditing policy.
@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.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ServerBlobAuditingPolicyInner object | [
"Gets",
"a",
"server",
"s",
"blob",
"auditing",
"policy",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerBlobAuditingPoliciesInner.java#L106-L113 |
codelibs/fess | src/main/java/org/codelibs/fess/mylasta/action/FessMessages.java | FessMessages.addErrorsInvalidQuerySortValue | public FessMessages addErrorsInvalidQuerySortValue(String property, String arg0) {
"""
Add the created action message for the key 'errors.invalid_query_sort_value' with parameters.
<pre>
message: The given sort ({0}) is invalid.
</pre>
@param property The property name for the message. (NotNull)
@param arg0 The parameter arg0 for message. (NotNull)
@return this. (NotNull)
"""
assertPropertyNotNull(property);
add(property, new UserMessage(ERRORS_invalid_query_sort_value, arg0));
return this;
} | java | public FessMessages addErrorsInvalidQuerySortValue(String property, String arg0) {
assertPropertyNotNull(property);
add(property, new UserMessage(ERRORS_invalid_query_sort_value, arg0));
return this;
} | [
"public",
"FessMessages",
"addErrorsInvalidQuerySortValue",
"(",
"String",
"property",
",",
"String",
"arg0",
")",
"{",
"assertPropertyNotNull",
"(",
"property",
")",
";",
"add",
"(",
"property",
",",
"new",
"UserMessage",
"(",
"ERRORS_invalid_query_sort_value",
",",
"arg0",
")",
")",
";",
"return",
"this",
";",
"}"
] | Add the created action message for the key 'errors.invalid_query_sort_value' with parameters.
<pre>
message: The given sort ({0}) is invalid.
</pre>
@param property The property name for the message. (NotNull)
@param arg0 The parameter arg0 for message. (NotNull)
@return this. (NotNull) | [
"Add",
"the",
"created",
"action",
"message",
"for",
"the",
"key",
"errors",
".",
"invalid_query_sort_value",
"with",
"parameters",
".",
"<pre",
">",
"message",
":",
"The",
"given",
"sort",
"(",
"{",
"0",
"}",
")",
"is",
"invalid",
".",
"<",
"/",
"pre",
">"
] | train | https://github.com/codelibs/fess/blob/e5e4b722549d32a4958dfd94965b21937bfe64cf/src/main/java/org/codelibs/fess/mylasta/action/FessMessages.java#L2050-L2054 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/UniversalTimeScale.java | UniversalTimeScale.toLong | public static long toLong(long universalTime, int timeScale) {
"""
Convert a datetime from the universal time scale stored as a <code>BigDecimal</code> to a
<code>long</code> in the given time scale.
Since this calculation requires a divide, we must round. The straight forward
way to round by adding half of the divisor will push the sum out of range for values
within have the divisor of the limits of the precision of a <code>long</code>. To get around this, we do
the rounding like this:
<p><code>
(universalTime - units + units/2) / units + 1
</code>
<p>
(i.e. we subtract units first to guarantee that we'll still be in range when we
add <code>units/2</code>. We then need to add one to the quotent to make up for the extra subtraction.
This simplifies to:
<p><code>
(universalTime - units/2) / units - 1
</code>
<p>
For negative values to round away from zero, we need to flip the signs:
<p><code>
(universalTime + units/2) / units + 1
</code>
<p>
Since we also need to subtract the epochOffset, we fold the <code>+/- 1</code>
into the offset value. (i.e. <code>epochOffsetP1</code>, <code>epochOffsetM1</code>.)
@param universalTime The datetime in the universal time scale
@param timeScale The time scale to convert to
@return The datetime converted to the given time scale
"""
TimeScaleData data = toRangeCheck(universalTime, timeScale);
if (universalTime < 0) {
if (universalTime < data.minRound) {
return (universalTime + data.unitsRound) / data.units - data.epochOffsetP1;
}
return (universalTime - data.unitsRound) / data.units - data.epochOffset;
}
if (universalTime > data.maxRound) {
return (universalTime - data.unitsRound) / data.units - data.epochOffsetM1;
}
return (universalTime + data.unitsRound) / data.units - data.epochOffset;
} | java | public static long toLong(long universalTime, int timeScale)
{
TimeScaleData data = toRangeCheck(universalTime, timeScale);
if (universalTime < 0) {
if (universalTime < data.minRound) {
return (universalTime + data.unitsRound) / data.units - data.epochOffsetP1;
}
return (universalTime - data.unitsRound) / data.units - data.epochOffset;
}
if (universalTime > data.maxRound) {
return (universalTime - data.unitsRound) / data.units - data.epochOffsetM1;
}
return (universalTime + data.unitsRound) / data.units - data.epochOffset;
} | [
"public",
"static",
"long",
"toLong",
"(",
"long",
"universalTime",
",",
"int",
"timeScale",
")",
"{",
"TimeScaleData",
"data",
"=",
"toRangeCheck",
"(",
"universalTime",
",",
"timeScale",
")",
";",
"if",
"(",
"universalTime",
"<",
"0",
")",
"{",
"if",
"(",
"universalTime",
"<",
"data",
".",
"minRound",
")",
"{",
"return",
"(",
"universalTime",
"+",
"data",
".",
"unitsRound",
")",
"/",
"data",
".",
"units",
"-",
"data",
".",
"epochOffsetP1",
";",
"}",
"return",
"(",
"universalTime",
"-",
"data",
".",
"unitsRound",
")",
"/",
"data",
".",
"units",
"-",
"data",
".",
"epochOffset",
";",
"}",
"if",
"(",
"universalTime",
">",
"data",
".",
"maxRound",
")",
"{",
"return",
"(",
"universalTime",
"-",
"data",
".",
"unitsRound",
")",
"/",
"data",
".",
"units",
"-",
"data",
".",
"epochOffsetM1",
";",
"}",
"return",
"(",
"universalTime",
"+",
"data",
".",
"unitsRound",
")",
"/",
"data",
".",
"units",
"-",
"data",
".",
"epochOffset",
";",
"}"
] | Convert a datetime from the universal time scale stored as a <code>BigDecimal</code> to a
<code>long</code> in the given time scale.
Since this calculation requires a divide, we must round. The straight forward
way to round by adding half of the divisor will push the sum out of range for values
within have the divisor of the limits of the precision of a <code>long</code>. To get around this, we do
the rounding like this:
<p><code>
(universalTime - units + units/2) / units + 1
</code>
<p>
(i.e. we subtract units first to guarantee that we'll still be in range when we
add <code>units/2</code>. We then need to add one to the quotent to make up for the extra subtraction.
This simplifies to:
<p><code>
(universalTime - units/2) / units - 1
</code>
<p>
For negative values to round away from zero, we need to flip the signs:
<p><code>
(universalTime + units/2) / units + 1
</code>
<p>
Since we also need to subtract the epochOffset, we fold the <code>+/- 1</code>
into the offset value. (i.e. <code>epochOffsetP1</code>, <code>epochOffsetM1</code>.)
@param universalTime The datetime in the universal time scale
@param timeScale The time scale to convert to
@return The datetime converted to the given time scale | [
"Convert",
"a",
"datetime",
"from",
"the",
"universal",
"time",
"scale",
"stored",
"as",
"a",
"<code",
">",
"BigDecimal<",
"/",
"code",
">",
"to",
"a",
"<code",
">",
"long<",
"/",
"code",
">",
"in",
"the",
"given",
"time",
"scale",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/UniversalTimeScale.java#L440-L457 |
strator-dev/greenpepper | greenpepper-open/extensions-external/php/src/main/java/com/greenpepper/phpsud/phpDriver/PHPDriverHelper.java | PHPDriverHelper.createTmpPhpFileFromResource | public static File createTmpPhpFileFromResource(String resourceName, boolean deleteOnExit) throws IOException {
"""
<p>createTmpPhpFileFromResource.</p>
@param resourceName a {@link java.lang.String} object.
@param deleteOnExit a boolean.
@return a {@link java.io.File} object.
@throws java.io.IOException if any.
"""
InputStream is = getInstance().getClass().getResourceAsStream(resourceName);
if (is == null) {
throw new IOException("Unable to find php file " + resourceName);
}
return copyFile(is, deleteOnExit);
} | java | public static File createTmpPhpFileFromResource(String resourceName, boolean deleteOnExit) throws IOException {
InputStream is = getInstance().getClass().getResourceAsStream(resourceName);
if (is == null) {
throw new IOException("Unable to find php file " + resourceName);
}
return copyFile(is, deleteOnExit);
} | [
"public",
"static",
"File",
"createTmpPhpFileFromResource",
"(",
"String",
"resourceName",
",",
"boolean",
"deleteOnExit",
")",
"throws",
"IOException",
"{",
"InputStream",
"is",
"=",
"getInstance",
"(",
")",
".",
"getClass",
"(",
")",
".",
"getResourceAsStream",
"(",
"resourceName",
")",
";",
"if",
"(",
"is",
"==",
"null",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"Unable to find php file \"",
"+",
"resourceName",
")",
";",
"}",
"return",
"copyFile",
"(",
"is",
",",
"deleteOnExit",
")",
";",
"}"
] | <p>createTmpPhpFileFromResource.</p>
@param resourceName a {@link java.lang.String} object.
@param deleteOnExit a boolean.
@return a {@link java.io.File} object.
@throws java.io.IOException if any. | [
"<p",
">",
"createTmpPhpFileFromResource",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper-open/extensions-external/php/src/main/java/com/greenpepper/phpsud/phpDriver/PHPDriverHelper.java#L127-L133 |
alkacon/opencms-core | src/org/opencms/db/CmsSecurityManager.java | CmsSecurityManager.mergePublishLists | public CmsPublishList mergePublishLists(CmsRequestContext context, CmsPublishList pubList1, CmsPublishList pubList2)
throws CmsException {
"""
Returns a new publish list that contains all resources of both given publish lists.<p>
@param context the current request context
@param pubList1 the first publish list
@param pubList2 the second publish list
@return a new publish list that contains all resources of both given publish lists
@throws CmsException if something goes wrong
@see org.opencms.publish.CmsPublishManager#mergePublishLists(CmsObject, CmsPublishList, CmsPublishList)
"""
CmsPublishList ret = null;
CmsDbContext dbc = m_dbContextFactory.getDbContext(context);
try {
// get all resources from the first list
Set<CmsResource> publishResources = new HashSet<CmsResource>(pubList1.getAllResources());
// get all resources from the second list
publishResources.addAll(pubList2.getAllResources());
// create merged publish list
ret = new CmsPublishList(
pubList1.getDirectPublishResources(),
pubList1.isPublishSiblings(),
pubList1.isPublishSubResources());
ret.addAll(publishResources, false); // ignore files that should not be published
if (pubList1.isUserPublishList()) {
ret.setUserPublishList(true);
}
ret.initialize(); // ensure sort order
checkPublishPermissions(dbc, ret);
} catch (Exception e) {
dbc.report(null, Messages.get().container(Messages.ERR_MERGING_PUBLISH_LISTS_0), e);
} finally {
dbc.clear();
}
return ret;
} | java | public CmsPublishList mergePublishLists(CmsRequestContext context, CmsPublishList pubList1, CmsPublishList pubList2)
throws CmsException {
CmsPublishList ret = null;
CmsDbContext dbc = m_dbContextFactory.getDbContext(context);
try {
// get all resources from the first list
Set<CmsResource> publishResources = new HashSet<CmsResource>(pubList1.getAllResources());
// get all resources from the second list
publishResources.addAll(pubList2.getAllResources());
// create merged publish list
ret = new CmsPublishList(
pubList1.getDirectPublishResources(),
pubList1.isPublishSiblings(),
pubList1.isPublishSubResources());
ret.addAll(publishResources, false); // ignore files that should not be published
if (pubList1.isUserPublishList()) {
ret.setUserPublishList(true);
}
ret.initialize(); // ensure sort order
checkPublishPermissions(dbc, ret);
} catch (Exception e) {
dbc.report(null, Messages.get().container(Messages.ERR_MERGING_PUBLISH_LISTS_0), e);
} finally {
dbc.clear();
}
return ret;
} | [
"public",
"CmsPublishList",
"mergePublishLists",
"(",
"CmsRequestContext",
"context",
",",
"CmsPublishList",
"pubList1",
",",
"CmsPublishList",
"pubList2",
")",
"throws",
"CmsException",
"{",
"CmsPublishList",
"ret",
"=",
"null",
";",
"CmsDbContext",
"dbc",
"=",
"m_dbContextFactory",
".",
"getDbContext",
"(",
"context",
")",
";",
"try",
"{",
"// get all resources from the first list",
"Set",
"<",
"CmsResource",
">",
"publishResources",
"=",
"new",
"HashSet",
"<",
"CmsResource",
">",
"(",
"pubList1",
".",
"getAllResources",
"(",
")",
")",
";",
"// get all resources from the second list",
"publishResources",
".",
"addAll",
"(",
"pubList2",
".",
"getAllResources",
"(",
")",
")",
";",
"// create merged publish list",
"ret",
"=",
"new",
"CmsPublishList",
"(",
"pubList1",
".",
"getDirectPublishResources",
"(",
")",
",",
"pubList1",
".",
"isPublishSiblings",
"(",
")",
",",
"pubList1",
".",
"isPublishSubResources",
"(",
")",
")",
";",
"ret",
".",
"addAll",
"(",
"publishResources",
",",
"false",
")",
";",
"// ignore files that should not be published",
"if",
"(",
"pubList1",
".",
"isUserPublishList",
"(",
")",
")",
"{",
"ret",
".",
"setUserPublishList",
"(",
"true",
")",
";",
"}",
"ret",
".",
"initialize",
"(",
")",
";",
"// ensure sort order",
"checkPublishPermissions",
"(",
"dbc",
",",
"ret",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"dbc",
".",
"report",
"(",
"null",
",",
"Messages",
".",
"get",
"(",
")",
".",
"container",
"(",
"Messages",
".",
"ERR_MERGING_PUBLISH_LISTS_0",
")",
",",
"e",
")",
";",
"}",
"finally",
"{",
"dbc",
".",
"clear",
"(",
")",
";",
"}",
"return",
"ret",
";",
"}"
] | Returns a new publish list that contains all resources of both given publish lists.<p>
@param context the current request context
@param pubList1 the first publish list
@param pubList2 the second publish list
@return a new publish list that contains all resources of both given publish lists
@throws CmsException if something goes wrong
@see org.opencms.publish.CmsPublishManager#mergePublishLists(CmsObject, CmsPublishList, CmsPublishList) | [
"Returns",
"a",
"new",
"publish",
"list",
"that",
"contains",
"all",
"resources",
"of",
"both",
"given",
"publish",
"lists",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSecurityManager.java#L3696-L3725 |
alkacon/opencms-core | src-gwt/org/opencms/ade/sitemap/client/control/CmsSitemapDNDController.java | CmsSitemapDNDController.handleDropNewEntry | private void handleDropNewEntry(CmsCreatableListItem createItem, final CmsClientSitemapEntry parent) {
"""
Handles a dropped detail page.<p>
@param createItem the detail page which was dropped into the sitemap
@param parent the parent sitemap entry
"""
final CmsNewResourceInfo typeInfo = createItem.getResourceTypeInfo();
final CmsClientSitemapEntry entry = new CmsClientSitemapEntry();
entry.setNew(true);
entry.setVfsPath(null);
entry.setPosition(m_insertIndex);
entry.setInNavigation(true);
Map<String, CmsClientProperty> defaultFileProps = Maps.newHashMap();
entry.setDefaultFileProperties(defaultFileProps);
String name;
final boolean appendSlash;
switch (createItem.getNewEntryType()) {
case detailpage:
name = CmsDetailPageInfo.removeFunctionPrefix(typeInfo.getResourceType());
appendSlash = true;
entry.setDetailpageTypeName(typeInfo.getResourceType());
entry.setVfsModeIcon(typeInfo.getBigIconClasses());
if (typeInfo.isFunction()) {
CmsClientProperty titleProp = new CmsClientProperty(
CmsClientProperty.PROPERTY_TITLE,
typeInfo.getTitle(),
null);
CmsClientProperty navtextProp = new CmsClientProperty(
CmsClientProperty.PROPERTY_NAVTEXT,
typeInfo.getTitle(),
null);
entry.getOwnProperties().put(titleProp.getName(), titleProp);
entry.getDefaultFileProperties().put(titleProp.getName(), titleProp);
entry.getOwnProperties().put(navtextProp.getName(), navtextProp);
}
entry.setResourceTypeName("folder");
break;
case redirect:
name = typeInfo.getResourceType();
entry.setEntryType(EntryType.redirect);
entry.setVfsModeIcon(typeInfo.getBigIconClasses());
entry.setResourceTypeName(typeInfo.getResourceType());
appendSlash = false;
break;
default:
name = CmsSitemapController.NEW_ENTRY_NAME;
appendSlash = true;
entry.setResourceTypeName("folder");
entry.setVfsModeIcon(typeInfo.getBigIconClasses());
}
m_controller.ensureUniqueName(parent, name, new I_CmsSimpleCallback<String>() {
public void execute(String uniqueName) {
entry.setName(uniqueName);
String sitepath = m_insertPath + uniqueName;
if (appendSlash) {
sitepath += "/";
}
entry.setSitePath(sitepath);
m_controller.create(
entry,
parent.getId(),
typeInfo.getId(),
typeInfo.getCopyResourceId(),
typeInfo.getCreateParameter(),
false);
}
});
} | java | private void handleDropNewEntry(CmsCreatableListItem createItem, final CmsClientSitemapEntry parent) {
final CmsNewResourceInfo typeInfo = createItem.getResourceTypeInfo();
final CmsClientSitemapEntry entry = new CmsClientSitemapEntry();
entry.setNew(true);
entry.setVfsPath(null);
entry.setPosition(m_insertIndex);
entry.setInNavigation(true);
Map<String, CmsClientProperty> defaultFileProps = Maps.newHashMap();
entry.setDefaultFileProperties(defaultFileProps);
String name;
final boolean appendSlash;
switch (createItem.getNewEntryType()) {
case detailpage:
name = CmsDetailPageInfo.removeFunctionPrefix(typeInfo.getResourceType());
appendSlash = true;
entry.setDetailpageTypeName(typeInfo.getResourceType());
entry.setVfsModeIcon(typeInfo.getBigIconClasses());
if (typeInfo.isFunction()) {
CmsClientProperty titleProp = new CmsClientProperty(
CmsClientProperty.PROPERTY_TITLE,
typeInfo.getTitle(),
null);
CmsClientProperty navtextProp = new CmsClientProperty(
CmsClientProperty.PROPERTY_NAVTEXT,
typeInfo.getTitle(),
null);
entry.getOwnProperties().put(titleProp.getName(), titleProp);
entry.getDefaultFileProperties().put(titleProp.getName(), titleProp);
entry.getOwnProperties().put(navtextProp.getName(), navtextProp);
}
entry.setResourceTypeName("folder");
break;
case redirect:
name = typeInfo.getResourceType();
entry.setEntryType(EntryType.redirect);
entry.setVfsModeIcon(typeInfo.getBigIconClasses());
entry.setResourceTypeName(typeInfo.getResourceType());
appendSlash = false;
break;
default:
name = CmsSitemapController.NEW_ENTRY_NAME;
appendSlash = true;
entry.setResourceTypeName("folder");
entry.setVfsModeIcon(typeInfo.getBigIconClasses());
}
m_controller.ensureUniqueName(parent, name, new I_CmsSimpleCallback<String>() {
public void execute(String uniqueName) {
entry.setName(uniqueName);
String sitepath = m_insertPath + uniqueName;
if (appendSlash) {
sitepath += "/";
}
entry.setSitePath(sitepath);
m_controller.create(
entry,
parent.getId(),
typeInfo.getId(),
typeInfo.getCopyResourceId(),
typeInfo.getCreateParameter(),
false);
}
});
} | [
"private",
"void",
"handleDropNewEntry",
"(",
"CmsCreatableListItem",
"createItem",
",",
"final",
"CmsClientSitemapEntry",
"parent",
")",
"{",
"final",
"CmsNewResourceInfo",
"typeInfo",
"=",
"createItem",
".",
"getResourceTypeInfo",
"(",
")",
";",
"final",
"CmsClientSitemapEntry",
"entry",
"=",
"new",
"CmsClientSitemapEntry",
"(",
")",
";",
"entry",
".",
"setNew",
"(",
"true",
")",
";",
"entry",
".",
"setVfsPath",
"(",
"null",
")",
";",
"entry",
".",
"setPosition",
"(",
"m_insertIndex",
")",
";",
"entry",
".",
"setInNavigation",
"(",
"true",
")",
";",
"Map",
"<",
"String",
",",
"CmsClientProperty",
">",
"defaultFileProps",
"=",
"Maps",
".",
"newHashMap",
"(",
")",
";",
"entry",
".",
"setDefaultFileProperties",
"(",
"defaultFileProps",
")",
";",
"String",
"name",
";",
"final",
"boolean",
"appendSlash",
";",
"switch",
"(",
"createItem",
".",
"getNewEntryType",
"(",
")",
")",
"{",
"case",
"detailpage",
":",
"name",
"=",
"CmsDetailPageInfo",
".",
"removeFunctionPrefix",
"(",
"typeInfo",
".",
"getResourceType",
"(",
")",
")",
";",
"appendSlash",
"=",
"true",
";",
"entry",
".",
"setDetailpageTypeName",
"(",
"typeInfo",
".",
"getResourceType",
"(",
")",
")",
";",
"entry",
".",
"setVfsModeIcon",
"(",
"typeInfo",
".",
"getBigIconClasses",
"(",
")",
")",
";",
"if",
"(",
"typeInfo",
".",
"isFunction",
"(",
")",
")",
"{",
"CmsClientProperty",
"titleProp",
"=",
"new",
"CmsClientProperty",
"(",
"CmsClientProperty",
".",
"PROPERTY_TITLE",
",",
"typeInfo",
".",
"getTitle",
"(",
")",
",",
"null",
")",
";",
"CmsClientProperty",
"navtextProp",
"=",
"new",
"CmsClientProperty",
"(",
"CmsClientProperty",
".",
"PROPERTY_NAVTEXT",
",",
"typeInfo",
".",
"getTitle",
"(",
")",
",",
"null",
")",
";",
"entry",
".",
"getOwnProperties",
"(",
")",
".",
"put",
"(",
"titleProp",
".",
"getName",
"(",
")",
",",
"titleProp",
")",
";",
"entry",
".",
"getDefaultFileProperties",
"(",
")",
".",
"put",
"(",
"titleProp",
".",
"getName",
"(",
")",
",",
"titleProp",
")",
";",
"entry",
".",
"getOwnProperties",
"(",
")",
".",
"put",
"(",
"navtextProp",
".",
"getName",
"(",
")",
",",
"navtextProp",
")",
";",
"}",
"entry",
".",
"setResourceTypeName",
"(",
"\"folder\"",
")",
";",
"break",
";",
"case",
"redirect",
":",
"name",
"=",
"typeInfo",
".",
"getResourceType",
"(",
")",
";",
"entry",
".",
"setEntryType",
"(",
"EntryType",
".",
"redirect",
")",
";",
"entry",
".",
"setVfsModeIcon",
"(",
"typeInfo",
".",
"getBigIconClasses",
"(",
")",
")",
";",
"entry",
".",
"setResourceTypeName",
"(",
"typeInfo",
".",
"getResourceType",
"(",
")",
")",
";",
"appendSlash",
"=",
"false",
";",
"break",
";",
"default",
":",
"name",
"=",
"CmsSitemapController",
".",
"NEW_ENTRY_NAME",
";",
"appendSlash",
"=",
"true",
";",
"entry",
".",
"setResourceTypeName",
"(",
"\"folder\"",
")",
";",
"entry",
".",
"setVfsModeIcon",
"(",
"typeInfo",
".",
"getBigIconClasses",
"(",
")",
")",
";",
"}",
"m_controller",
".",
"ensureUniqueName",
"(",
"parent",
",",
"name",
",",
"new",
"I_CmsSimpleCallback",
"<",
"String",
">",
"(",
")",
"{",
"public",
"void",
"execute",
"(",
"String",
"uniqueName",
")",
"{",
"entry",
".",
"setName",
"(",
"uniqueName",
")",
";",
"String",
"sitepath",
"=",
"m_insertPath",
"+",
"uniqueName",
";",
"if",
"(",
"appendSlash",
")",
"{",
"sitepath",
"+=",
"\"/\"",
";",
"}",
"entry",
".",
"setSitePath",
"(",
"sitepath",
")",
";",
"m_controller",
".",
"create",
"(",
"entry",
",",
"parent",
".",
"getId",
"(",
")",
",",
"typeInfo",
".",
"getId",
"(",
")",
",",
"typeInfo",
".",
"getCopyResourceId",
"(",
")",
",",
"typeInfo",
".",
"getCreateParameter",
"(",
")",
",",
"false",
")",
";",
"}",
"}",
")",
";",
"}"
] | Handles a dropped detail page.<p>
@param createItem the detail page which was dropped into the sitemap
@param parent the parent sitemap entry | [
"Handles",
"a",
"dropped",
"detail",
"page",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/sitemap/client/control/CmsSitemapDNDController.java#L309-L377 |
Erudika/para | para-core/src/main/java/com/erudika/para/core/App.java | App.isDeniedExplicitly | final boolean isDeniedExplicitly(String subjectid, String resourcePath, String httpMethod) {
"""
Check if a subject is explicitly denied access to a resource.
@param subjectid subject id
@param resourcePath resource path or object type
@param httpMethod HTTP method name
@return true if access is explicitly denied
"""
if (StringUtils.isBlank(subjectid) || StringUtils.isBlank(resourcePath) ||
StringUtils.isBlank(httpMethod) || getResourcePermissions().isEmpty()) {
return false;
}
// urlDecode resource path
resourcePath = Utils.urlDecode(resourcePath);
if (getResourcePermissions().containsKey(subjectid)) {
if (getResourcePermissions().get(subjectid).containsKey(resourcePath)) {
return !isAllowed(subjectid, resourcePath, httpMethod);
} else if (getResourcePermissions().get(subjectid).containsKey(ALLOW_ALL)) {
return !isAllowed(subjectid, ALLOW_ALL, httpMethod);
}
}
return false;
} | java | final boolean isDeniedExplicitly(String subjectid, String resourcePath, String httpMethod) {
if (StringUtils.isBlank(subjectid) || StringUtils.isBlank(resourcePath) ||
StringUtils.isBlank(httpMethod) || getResourcePermissions().isEmpty()) {
return false;
}
// urlDecode resource path
resourcePath = Utils.urlDecode(resourcePath);
if (getResourcePermissions().containsKey(subjectid)) {
if (getResourcePermissions().get(subjectid).containsKey(resourcePath)) {
return !isAllowed(subjectid, resourcePath, httpMethod);
} else if (getResourcePermissions().get(subjectid).containsKey(ALLOW_ALL)) {
return !isAllowed(subjectid, ALLOW_ALL, httpMethod);
}
}
return false;
} | [
"final",
"boolean",
"isDeniedExplicitly",
"(",
"String",
"subjectid",
",",
"String",
"resourcePath",
",",
"String",
"httpMethod",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isBlank",
"(",
"subjectid",
")",
"||",
"StringUtils",
".",
"isBlank",
"(",
"resourcePath",
")",
"||",
"StringUtils",
".",
"isBlank",
"(",
"httpMethod",
")",
"||",
"getResourcePermissions",
"(",
")",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"// urlDecode resource path",
"resourcePath",
"=",
"Utils",
".",
"urlDecode",
"(",
"resourcePath",
")",
";",
"if",
"(",
"getResourcePermissions",
"(",
")",
".",
"containsKey",
"(",
"subjectid",
")",
")",
"{",
"if",
"(",
"getResourcePermissions",
"(",
")",
".",
"get",
"(",
"subjectid",
")",
".",
"containsKey",
"(",
"resourcePath",
")",
")",
"{",
"return",
"!",
"isAllowed",
"(",
"subjectid",
",",
"resourcePath",
",",
"httpMethod",
")",
";",
"}",
"else",
"if",
"(",
"getResourcePermissions",
"(",
")",
".",
"get",
"(",
"subjectid",
")",
".",
"containsKey",
"(",
"ALLOW_ALL",
")",
")",
"{",
"return",
"!",
"isAllowed",
"(",
"subjectid",
",",
"ALLOW_ALL",
",",
"httpMethod",
")",
";",
"}",
"}",
"return",
"false",
";",
"}"
] | Check if a subject is explicitly denied access to a resource.
@param subjectid subject id
@param resourcePath resource path or object type
@param httpMethod HTTP method name
@return true if access is explicitly denied | [
"Check",
"if",
"a",
"subject",
"is",
"explicitly",
"denied",
"access",
"to",
"a",
"resource",
"."
] | train | https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-core/src/main/java/com/erudika/para/core/App.java#L799-L814 |
Azure/azure-sdk-for-java | datamigration/resource-manager/v2017_11_15_preview/src/main/java/com/microsoft/azure/management/datamigration/v2017_11_15_preview/implementation/ServicesInner.java | ServicesInner.beginStopAsync | public Observable<Void> beginStopAsync(String groupName, String serviceName) {
"""
Stop service.
The services resource is the top-level resource that represents the Data Migration Service. This action stops the service and the service cannot be used for data migration. The service owner won't be billed when the service is stopped.
@param groupName Name of the resource group
@param serviceName Name of the service
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponse} object if successful.
"""
return beginStopWithServiceResponseAsync(groupName, serviceName).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | java | public Observable<Void> beginStopAsync(String groupName, String serviceName) {
return beginStopWithServiceResponseAsync(groupName, serviceName).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"beginStopAsync",
"(",
"String",
"groupName",
",",
"String",
"serviceName",
")",
"{",
"return",
"beginStopWithServiceResponseAsync",
"(",
"groupName",
",",
"serviceName",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"Void",
">",
",",
"Void",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Void",
"call",
"(",
"ServiceResponse",
"<",
"Void",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Stop service.
The services resource is the top-level resource that represents the Data Migration Service. This action stops the service and the service cannot be used for data migration. The service owner won't be billed when the service is stopped.
@param groupName Name of the resource group
@param serviceName Name of the service
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponse} object if successful. | [
"Stop",
"service",
".",
"The",
"services",
"resource",
"is",
"the",
"top",
"-",
"level",
"resource",
"that",
"represents",
"the",
"Data",
"Migration",
"Service",
".",
"This",
"action",
"stops",
"the",
"service",
"and",
"the",
"service",
"cannot",
"be",
"used",
"for",
"data",
"migration",
".",
"The",
"service",
"owner",
"won",
"t",
"be",
"billed",
"when",
"the",
"service",
"is",
"stopped",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datamigration/resource-manager/v2017_11_15_preview/src/main/java/com/microsoft/azure/management/datamigration/v2017_11_15_preview/implementation/ServicesInner.java#L1290-L1297 |
mygreen/xlsmapper | src/main/java/com/gh/mygreen/xlsmapper/xml/AnnotationReader.java | AnnotationReader.getAnnotation | @SuppressWarnings("unchecked")
public <A extends Annotation> A getAnnotation(final Class<?> clazz, final Class<A> annClass) throws AnnotationReadException {
"""
Returns a class annotation for the specified type if such an annotation is present, else null.
@param <A> the type of the annotation
@param clazz the target class
@param annClass the Class object corresponding to the annotation type
@return the target class's annotation for the specified annotation type if present on this element, else null
@throws AnnotationReadException
"""
if(xmlInfo != null && xmlInfo.containsClassInfo(clazz.getName())) {
final ClassInfo classInfo = xmlInfo.getClassInfo(clazz.getName());
if(classInfo.containsAnnotationInfo(annClass.getName())) {
AnnotationInfo annInfo = classInfo.getAnnotationInfo(annClass.getName());
try {
return (A)annotationBuilder.buildAnnotation(Class.forName(annInfo.getClassName()), annInfo);
} catch (ClassNotFoundException e) {
throw new AnnotationReadException(String.format("not found class '%s'", annInfo.getClassName()), e);
}
}
}
return clazz.getAnnotation(annClass);
} | java | @SuppressWarnings("unchecked")
public <A extends Annotation> A getAnnotation(final Class<?> clazz, final Class<A> annClass) throws AnnotationReadException {
if(xmlInfo != null && xmlInfo.containsClassInfo(clazz.getName())) {
final ClassInfo classInfo = xmlInfo.getClassInfo(clazz.getName());
if(classInfo.containsAnnotationInfo(annClass.getName())) {
AnnotationInfo annInfo = classInfo.getAnnotationInfo(annClass.getName());
try {
return (A)annotationBuilder.buildAnnotation(Class.forName(annInfo.getClassName()), annInfo);
} catch (ClassNotFoundException e) {
throw new AnnotationReadException(String.format("not found class '%s'", annInfo.getClassName()), e);
}
}
}
return clazz.getAnnotation(annClass);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"A",
"extends",
"Annotation",
">",
"A",
"getAnnotation",
"(",
"final",
"Class",
"<",
"?",
">",
"clazz",
",",
"final",
"Class",
"<",
"A",
">",
"annClass",
")",
"throws",
"AnnotationReadException",
"{",
"if",
"(",
"xmlInfo",
"!=",
"null",
"&&",
"xmlInfo",
".",
"containsClassInfo",
"(",
"clazz",
".",
"getName",
"(",
")",
")",
")",
"{",
"final",
"ClassInfo",
"classInfo",
"=",
"xmlInfo",
".",
"getClassInfo",
"(",
"clazz",
".",
"getName",
"(",
")",
")",
";",
"if",
"(",
"classInfo",
".",
"containsAnnotationInfo",
"(",
"annClass",
".",
"getName",
"(",
")",
")",
")",
"{",
"AnnotationInfo",
"annInfo",
"=",
"classInfo",
".",
"getAnnotationInfo",
"(",
"annClass",
".",
"getName",
"(",
")",
")",
";",
"try",
"{",
"return",
"(",
"A",
")",
"annotationBuilder",
".",
"buildAnnotation",
"(",
"Class",
".",
"forName",
"(",
"annInfo",
".",
"getClassName",
"(",
")",
")",
",",
"annInfo",
")",
";",
"}",
"catch",
"(",
"ClassNotFoundException",
"e",
")",
"{",
"throw",
"new",
"AnnotationReadException",
"(",
"String",
".",
"format",
"(",
"\"not found class '%s'\"",
",",
"annInfo",
".",
"getClassName",
"(",
")",
")",
",",
"e",
")",
";",
"}",
"}",
"}",
"return",
"clazz",
".",
"getAnnotation",
"(",
"annClass",
")",
";",
"}"
] | Returns a class annotation for the specified type if such an annotation is present, else null.
@param <A> the type of the annotation
@param clazz the target class
@param annClass the Class object corresponding to the annotation type
@return the target class's annotation for the specified annotation type if present on this element, else null
@throws AnnotationReadException | [
"Returns",
"a",
"class",
"annotation",
"for",
"the",
"specified",
"type",
"if",
"such",
"an",
"annotation",
"is",
"present",
"else",
"null",
"."
] | train | https://github.com/mygreen/xlsmapper/blob/a0c6b25c622e5f3a50b199ef685d2ee46ad5483c/src/main/java/com/gh/mygreen/xlsmapper/xml/AnnotationReader.java#L89-L105 |
bingoohuang/excel2javabeans | src/main/java/com/github/bingoohuang/excel2maps/impl/ColumnRef.java | ColumnRef.wildMatch | public static boolean wildMatch(String text, String pattern) {
"""
The following Java method tests if a string matches a wildcard expression
(supporting ? for exactly one character or * for an arbitrary number of characters):
@param text Text to test
@param pattern (Wildcard) pattern to test
@return True if the text matches the wildcard pattern
"""
if (pattern == null) return false;
return text.matches(pattern.replace("?", ".?")
.replace("*", ".*?"));
} | java | public static boolean wildMatch(String text, String pattern) {
if (pattern == null) return false;
return text.matches(pattern.replace("?", ".?")
.replace("*", ".*?"));
} | [
"public",
"static",
"boolean",
"wildMatch",
"(",
"String",
"text",
",",
"String",
"pattern",
")",
"{",
"if",
"(",
"pattern",
"==",
"null",
")",
"return",
"false",
";",
"return",
"text",
".",
"matches",
"(",
"pattern",
".",
"replace",
"(",
"\"?\"",
",",
"\".?\"",
")",
".",
"replace",
"(",
"\"*\"",
",",
"\".*?\"",
")",
")",
";",
"}"
] | The following Java method tests if a string matches a wildcard expression
(supporting ? for exactly one character or * for an arbitrary number of characters):
@param text Text to test
@param pattern (Wildcard) pattern to test
@return True if the text matches the wildcard pattern | [
"The",
"following",
"Java",
"method",
"tests",
"if",
"a",
"string",
"matches",
"a",
"wildcard",
"expression",
"(",
"supporting",
"?",
"for",
"exactly",
"one",
"character",
"or",
"*",
"for",
"an",
"arbitrary",
"number",
"of",
"characters",
")",
":"
] | train | https://github.com/bingoohuang/excel2javabeans/blob/db136d460b93b649814366c0d84a982698b96dc3/src/main/java/com/github/bingoohuang/excel2maps/impl/ColumnRef.java#L31-L36 |
structr/structr | structr-ui/src/main/java/org/structr/websocket/command/AbstractCommand.java | AbstractCommand.getRelationship | public AbstractRelationship getRelationship(final String id, final String nodeId) {
"""
Returns the relationship with the given id by looking up a node
with the given nodeId and filtering the relationships.
This avoids the performance issues of getRelationshipById due to missing index support.
If nodeId is null, the method falls back to {@link getRelationship(id)}.
@param id
@param nodeId
@return the node
"""
if (id == null) {
return null;
}
if (nodeId == null) {
return getRelationship(id);
}
final SecurityContext securityContext = getWebSocket().getSecurityContext();
final App app = StructrApp.getInstance(securityContext);
try (final Tx tx = app.tx()) {
final AbstractNode node = (AbstractNode) app.getNodeById(nodeId);
for (final AbstractRelationship rel : node.getRelationships()) {
if (rel.getUuid().equals(id)) {
return rel;
}
}
tx.success();
} catch (FrameworkException fex) {
logger.warn("Unable to get relationship", fex);
}
return null;
} | java | public AbstractRelationship getRelationship(final String id, final String nodeId) {
if (id == null) {
return null;
}
if (nodeId == null) {
return getRelationship(id);
}
final SecurityContext securityContext = getWebSocket().getSecurityContext();
final App app = StructrApp.getInstance(securityContext);
try (final Tx tx = app.tx()) {
final AbstractNode node = (AbstractNode) app.getNodeById(nodeId);
for (final AbstractRelationship rel : node.getRelationships()) {
if (rel.getUuid().equals(id)) {
return rel;
}
}
tx.success();
} catch (FrameworkException fex) {
logger.warn("Unable to get relationship", fex);
}
return null;
} | [
"public",
"AbstractRelationship",
"getRelationship",
"(",
"final",
"String",
"id",
",",
"final",
"String",
"nodeId",
")",
"{",
"if",
"(",
"id",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"nodeId",
"==",
"null",
")",
"{",
"return",
"getRelationship",
"(",
"id",
")",
";",
"}",
"final",
"SecurityContext",
"securityContext",
"=",
"getWebSocket",
"(",
")",
".",
"getSecurityContext",
"(",
")",
";",
"final",
"App",
"app",
"=",
"StructrApp",
".",
"getInstance",
"(",
"securityContext",
")",
";",
"try",
"(",
"final",
"Tx",
"tx",
"=",
"app",
".",
"tx",
"(",
")",
")",
"{",
"final",
"AbstractNode",
"node",
"=",
"(",
"AbstractNode",
")",
"app",
".",
"getNodeById",
"(",
"nodeId",
")",
";",
"for",
"(",
"final",
"AbstractRelationship",
"rel",
":",
"node",
".",
"getRelationships",
"(",
")",
")",
"{",
"if",
"(",
"rel",
".",
"getUuid",
"(",
")",
".",
"equals",
"(",
"id",
")",
")",
"{",
"return",
"rel",
";",
"}",
"}",
"tx",
".",
"success",
"(",
")",
";",
"}",
"catch",
"(",
"FrameworkException",
"fex",
")",
"{",
"logger",
".",
"warn",
"(",
"\"Unable to get relationship\"",
",",
"fex",
")",
";",
"}",
"return",
"null",
";",
"}"
] | Returns the relationship with the given id by looking up a node
with the given nodeId and filtering the relationships.
This avoids the performance issues of getRelationshipById due to missing index support.
If nodeId is null, the method falls back to {@link getRelationship(id)}.
@param id
@param nodeId
@return the node | [
"Returns",
"the",
"relationship",
"with",
"the",
"given",
"id",
"by",
"looking",
"up",
"a",
"node",
"with",
"the",
"given",
"nodeId",
"and",
"filtering",
"the",
"relationships",
"."
] | train | https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-ui/src/main/java/org/structr/websocket/command/AbstractCommand.java#L194-L226 |
kiegroup/drools | kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_1/xstream/XStreamMarshaller.java | XStreamMarshaller.marshalMarshall | @Deprecated
public void marshalMarshall(Object o, OutputStream out) {
"""
Unnecessary as was a tentative UTF-8 preamble output but still not working.
"""
try {
XStream xStream = newXStream();
out.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n".getBytes());
OutputStreamWriter ows = new OutputStreamWriter(out, "UTF-8");
xStream.toXML(o, ows);
} catch ( Exception e ) {
e.printStackTrace();
}
} | java | @Deprecated
public void marshalMarshall(Object o, OutputStream out) {
try {
XStream xStream = newXStream();
out.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n".getBytes());
OutputStreamWriter ows = new OutputStreamWriter(out, "UTF-8");
xStream.toXML(o, ows);
} catch ( Exception e ) {
e.printStackTrace();
}
} | [
"@",
"Deprecated",
"public",
"void",
"marshalMarshall",
"(",
"Object",
"o",
",",
"OutputStream",
"out",
")",
"{",
"try",
"{",
"XStream",
"xStream",
"=",
"newXStream",
"(",
")",
";",
"out",
".",
"write",
"(",
"\"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\n\"",
".",
"getBytes",
"(",
")",
")",
";",
"OutputStreamWriter",
"ows",
"=",
"new",
"OutputStreamWriter",
"(",
"out",
",",
"\"UTF-8\"",
")",
";",
"xStream",
".",
"toXML",
"(",
"o",
",",
"ows",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"}"
] | Unnecessary as was a tentative UTF-8 preamble output but still not working. | [
"Unnecessary",
"as",
"was",
"a",
"tentative",
"UTF",
"-",
"8",
"preamble",
"output",
"but",
"still",
"not",
"working",
"."
] | train | https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/kie-dmn/kie-dmn-backend/src/main/java/org/kie/dmn/backend/marshalling/v1_1/xstream/XStreamMarshaller.java#L197-L207 |
Squarespace/cldr | compiler/src/main/java/com/squarespace/cldr/codegen/CalendarCodeGenerator.java | CalendarCodeGenerator.addPattern | private void addPattern(MethodSpec.Builder method, String pattern) {
"""
Add a named date-time pattern, adding statements to the formatting and indexing methods.
Returns true if the pattern corresponds to a date; false if a time.
"""
// Parse the pattern and populate the method body with instructions to format the date.
for (Node node : DATETIME_PARSER.parse(pattern)) {
if (node instanceof Text) {
method.addStatement("b.append($S)", ((Text)node).text());
} else if (node instanceof Field) {
Field field = (Field)node;
method.addStatement("formatField(d, '$L', $L, b)", field.ch(), field.width());
}
}
} | java | private void addPattern(MethodSpec.Builder method, String pattern) {
// Parse the pattern and populate the method body with instructions to format the date.
for (Node node : DATETIME_PARSER.parse(pattern)) {
if (node instanceof Text) {
method.addStatement("b.append($S)", ((Text)node).text());
} else if (node instanceof Field) {
Field field = (Field)node;
method.addStatement("formatField(d, '$L', $L, b)", field.ch(), field.width());
}
}
} | [
"private",
"void",
"addPattern",
"(",
"MethodSpec",
".",
"Builder",
"method",
",",
"String",
"pattern",
")",
"{",
"// Parse the pattern and populate the method body with instructions to format the date.",
"for",
"(",
"Node",
"node",
":",
"DATETIME_PARSER",
".",
"parse",
"(",
"pattern",
")",
")",
"{",
"if",
"(",
"node",
"instanceof",
"Text",
")",
"{",
"method",
".",
"addStatement",
"(",
"\"b.append($S)\"",
",",
"(",
"(",
"Text",
")",
"node",
")",
".",
"text",
"(",
")",
")",
";",
"}",
"else",
"if",
"(",
"node",
"instanceof",
"Field",
")",
"{",
"Field",
"field",
"=",
"(",
"Field",
")",
"node",
";",
"method",
".",
"addStatement",
"(",
"\"formatField(d, '$L', $L, b)\"",
",",
"field",
".",
"ch",
"(",
")",
",",
"field",
".",
"width",
"(",
")",
")",
";",
"}",
"}",
"}"
] | Add a named date-time pattern, adding statements to the formatting and indexing methods.
Returns true if the pattern corresponds to a date; false if a time. | [
"Add",
"a",
"named",
"date",
"-",
"time",
"pattern",
"adding",
"statements",
"to",
"the",
"formatting",
"and",
"indexing",
"methods",
".",
"Returns",
"true",
"if",
"the",
"pattern",
"corresponds",
"to",
"a",
"date",
";",
"false",
"if",
"a",
"time",
"."
] | train | https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/CalendarCodeGenerator.java#L297-L307 |
google/error-prone-javac | src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ConstantsSummaryBuilder.java | ConstantsSummaryBuilder.buildConstantSummary | public void buildConstantSummary(XMLNode node, Content contentTree) throws DocletException {
"""
Build the constant summary.
@param node the XML element that specifies which components to document
@param contentTree the content tree to which the documentation will be added
@throws DocletException if there is a problem while building the documentation
"""
contentTree = writer.getHeader();
buildChildren(node, contentTree);
writer.addFooter(contentTree);
writer.printDocument(contentTree);
} | java | public void buildConstantSummary(XMLNode node, Content contentTree) throws DocletException {
contentTree = writer.getHeader();
buildChildren(node, contentTree);
writer.addFooter(contentTree);
writer.printDocument(contentTree);
} | [
"public",
"void",
"buildConstantSummary",
"(",
"XMLNode",
"node",
",",
"Content",
"contentTree",
")",
"throws",
"DocletException",
"{",
"contentTree",
"=",
"writer",
".",
"getHeader",
"(",
")",
";",
"buildChildren",
"(",
"node",
",",
"contentTree",
")",
";",
"writer",
".",
"addFooter",
"(",
"contentTree",
")",
";",
"writer",
".",
"printDocument",
"(",
"contentTree",
")",
";",
"}"
] | Build the constant summary.
@param node the XML element that specifies which components to document
@param contentTree the content tree to which the documentation will be added
@throws DocletException if there is a problem while building the documentation | [
"Build",
"the",
"constant",
"summary",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ConstantsSummaryBuilder.java#L154-L159 |
apache/reef | lang/java/reef-applications/reef-vortex/src/main/java/org/apache/reef/vortex/api/VortexAggregateFuture.java | VortexAggregateFuture.completedTasklets | private void completedTasklets(final TOutput output, final List<Integer> taskletIds)
throws InterruptedException {
"""
Create and queue result for Tasklets that are expected and invoke callback.
"""
final List<TInput> inputs = getInputs(taskletIds);
final AggregateResult result = new AggregateResult(output, inputs);
if (callbackHandler != null) {
executor.execute(new Runnable() {
@Override
public void run() {
callbackHandler.onSuccess(result);
}
});
}
resultQueue.put(new ImmutablePair<>(taskletIds, result));
} | java | private void completedTasklets(final TOutput output, final List<Integer> taskletIds)
throws InterruptedException {
final List<TInput> inputs = getInputs(taskletIds);
final AggregateResult result = new AggregateResult(output, inputs);
if (callbackHandler != null) {
executor.execute(new Runnable() {
@Override
public void run() {
callbackHandler.onSuccess(result);
}
});
}
resultQueue.put(new ImmutablePair<>(taskletIds, result));
} | [
"private",
"void",
"completedTasklets",
"(",
"final",
"TOutput",
"output",
",",
"final",
"List",
"<",
"Integer",
">",
"taskletIds",
")",
"throws",
"InterruptedException",
"{",
"final",
"List",
"<",
"TInput",
">",
"inputs",
"=",
"getInputs",
"(",
"taskletIds",
")",
";",
"final",
"AggregateResult",
"result",
"=",
"new",
"AggregateResult",
"(",
"output",
",",
"inputs",
")",
";",
"if",
"(",
"callbackHandler",
"!=",
"null",
")",
"{",
"executor",
".",
"execute",
"(",
"new",
"Runnable",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"run",
"(",
")",
"{",
"callbackHandler",
".",
"onSuccess",
"(",
"result",
")",
";",
"}",
"}",
")",
";",
"}",
"resultQueue",
".",
"put",
"(",
"new",
"ImmutablePair",
"<>",
"(",
"taskletIds",
",",
"result",
")",
")",
";",
"}"
] | Create and queue result for Tasklets that are expected and invoke callback. | [
"Create",
"and",
"queue",
"result",
"for",
"Tasklets",
"that",
"are",
"expected",
"and",
"invoke",
"callback",
"."
] | train | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-applications/reef-vortex/src/main/java/org/apache/reef/vortex/api/VortexAggregateFuture.java#L173-L188 |
alkacon/opencms-core | src/org/opencms/jsp/CmsJspTagHeadIncludes.java | CmsJspTagHeadIncludes.getSchemaHeadIncludes | private Set<String> getSchemaHeadIncludes(CmsObject cms, CmsResource res, String type) throws CmsLoaderException {
"""
Gets the head includes of a resource from the content definition.<p>
@param cms the current CMS context
@param res the resource for which the head includes should be fetched
@param type the head include type (CSS or Javascript)
@return the set of schema head includes
@throws CmsLoaderException if something goes wrong
"""
if (type.equals(TYPE_CSS)) {
return getCSSHeadIncludes(cms, res);
} else if (type.equals(TYPE_JAVASCRIPT)) {
return getJSHeadIncludes(cms, res);
}
return null;
} | java | private Set<String> getSchemaHeadIncludes(CmsObject cms, CmsResource res, String type) throws CmsLoaderException {
if (type.equals(TYPE_CSS)) {
return getCSSHeadIncludes(cms, res);
} else if (type.equals(TYPE_JAVASCRIPT)) {
return getJSHeadIncludes(cms, res);
}
return null;
} | [
"private",
"Set",
"<",
"String",
">",
"getSchemaHeadIncludes",
"(",
"CmsObject",
"cms",
",",
"CmsResource",
"res",
",",
"String",
"type",
")",
"throws",
"CmsLoaderException",
"{",
"if",
"(",
"type",
".",
"equals",
"(",
"TYPE_CSS",
")",
")",
"{",
"return",
"getCSSHeadIncludes",
"(",
"cms",
",",
"res",
")",
";",
"}",
"else",
"if",
"(",
"type",
".",
"equals",
"(",
"TYPE_JAVASCRIPT",
")",
")",
"{",
"return",
"getJSHeadIncludes",
"(",
"cms",
",",
"res",
")",
";",
"}",
"return",
"null",
";",
"}"
] | Gets the head includes of a resource from the content definition.<p>
@param cms the current CMS context
@param res the resource for which the head includes should be fetched
@param type the head include type (CSS or Javascript)
@return the set of schema head includes
@throws CmsLoaderException if something goes wrong | [
"Gets",
"the",
"head",
"includes",
"of",
"a",
"resource",
"from",
"the",
"content",
"definition",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/CmsJspTagHeadIncludes.java#L778-L786 |
elki-project/elki | elki-core-api/src/main/java/de/lmu/ifi/dbs/elki/result/ResultHierarchy.java | ResultHierarchy.fireResultRemoved | private void fireResultRemoved(Result child, Result parent) {
"""
Informs all registered {@link ResultListener} that a new result has been
removed.
@param child result that has been removed
@param parent Parent result that has been removed
"""
if(LOG.isDebugging()) {
LOG.debug("Result removed: " + child + " <- " + parent);
}
for(int i = listenerList.size(); --i >= 0;) {
listenerList.get(i).resultRemoved(child, parent);
}
} | java | private void fireResultRemoved(Result child, Result parent) {
if(LOG.isDebugging()) {
LOG.debug("Result removed: " + child + " <- " + parent);
}
for(int i = listenerList.size(); --i >= 0;) {
listenerList.get(i).resultRemoved(child, parent);
}
} | [
"private",
"void",
"fireResultRemoved",
"(",
"Result",
"child",
",",
"Result",
"parent",
")",
"{",
"if",
"(",
"LOG",
".",
"isDebugging",
"(",
")",
")",
"{",
"LOG",
".",
"debug",
"(",
"\"Result removed: \"",
"+",
"child",
"+",
"\" <- \"",
"+",
"parent",
")",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"listenerList",
".",
"size",
"(",
")",
";",
"--",
"i",
">=",
"0",
";",
")",
"{",
"listenerList",
".",
"get",
"(",
"i",
")",
".",
"resultRemoved",
"(",
"child",
",",
"parent",
")",
";",
"}",
"}"
] | Informs all registered {@link ResultListener} that a new result has been
removed.
@param child result that has been removed
@param parent Parent result that has been removed | [
"Informs",
"all",
"registered",
"{",
"@link",
"ResultListener",
"}",
"that",
"a",
"new",
"result",
"has",
"been",
"removed",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-api/src/main/java/de/lmu/ifi/dbs/elki/result/ResultHierarchy.java#L146-L153 |
aws/aws-sdk-java | aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/model/UpdateItemRequest.java | UpdateItemRequest.withAttributeUpdates | public UpdateItemRequest withAttributeUpdates(java.util.Map<String, AttributeValueUpdate> attributeUpdates) {
"""
<p>
This is a legacy parameter. Use <code>UpdateExpression</code> instead. For more information, see <a href=
"https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/LegacyConditionalParameters.AttributeUpdates.html"
>AttributeUpdates</a> in the <i>Amazon DynamoDB Developer Guide</i>.
</p>
@param attributeUpdates
This is a legacy parameter. Use <code>UpdateExpression</code> instead. For more information, see <a href=
"https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/LegacyConditionalParameters.AttributeUpdates.html"
>AttributeUpdates</a> in the <i>Amazon DynamoDB Developer Guide</i>.
@return Returns a reference to this object so that method calls can be chained together.
"""
setAttributeUpdates(attributeUpdates);
return this;
} | java | public UpdateItemRequest withAttributeUpdates(java.util.Map<String, AttributeValueUpdate> attributeUpdates) {
setAttributeUpdates(attributeUpdates);
return this;
} | [
"public",
"UpdateItemRequest",
"withAttributeUpdates",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"AttributeValueUpdate",
">",
"attributeUpdates",
")",
"{",
"setAttributeUpdates",
"(",
"attributeUpdates",
")",
";",
"return",
"this",
";",
"}"
] | <p>
This is a legacy parameter. Use <code>UpdateExpression</code> instead. For more information, see <a href=
"https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/LegacyConditionalParameters.AttributeUpdates.html"
>AttributeUpdates</a> in the <i>Amazon DynamoDB Developer Guide</i>.
</p>
@param attributeUpdates
This is a legacy parameter. Use <code>UpdateExpression</code> instead. For more information, see <a href=
"https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/LegacyConditionalParameters.AttributeUpdates.html"
>AttributeUpdates</a> in the <i>Amazon DynamoDB Developer Guide</i>.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"This",
"is",
"a",
"legacy",
"parameter",
".",
"Use",
"<code",
">",
"UpdateExpression<",
"/",
"code",
">",
"instead",
".",
"For",
"more",
"information",
"see",
"<a",
"href",
"=",
"https",
":",
"//",
"docs",
".",
"aws",
".",
"amazon",
".",
"com",
"/",
"amazondynamodb",
"/",
"latest",
"/",
"developerguide",
"/",
"LegacyConditionalParameters",
".",
"AttributeUpdates",
".",
"html",
">",
"AttributeUpdates<",
"/",
"a",
">",
"in",
"the",
"<i",
">",
"Amazon",
"DynamoDB",
"Developer",
"Guide<",
"/",
"i",
">",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/model/UpdateItemRequest.java#L724-L727 |
adorsys/hbci4java-adorsys | src/main/java/org/kapott/hbci/GV/parsers/SEPAParserFactory.java | SEPAParserFactory.get | public static ISEPAParser get(SepaVersion version) {
"""
Gibt den passenden SEPA Parser für die angegebene PAIN-Version.
@param version die PAIN-Version.
@return ISEPAParser
"""
ISEPAParser parser = null;
String className = version.getParserClass();
try {
log.debug("trying to init SEPA parser: " + className);
Class cl = Class.forName(className);
parser = (ISEPAParser) cl.newInstance();
} catch (Exception e) {
String msg = "Error creating SEPA parser";
throw new HBCI_Exception(msg, e);
}
return parser;
} | java | public static ISEPAParser get(SepaVersion version) {
ISEPAParser parser = null;
String className = version.getParserClass();
try {
log.debug("trying to init SEPA parser: " + className);
Class cl = Class.forName(className);
parser = (ISEPAParser) cl.newInstance();
} catch (Exception e) {
String msg = "Error creating SEPA parser";
throw new HBCI_Exception(msg, e);
}
return parser;
} | [
"public",
"static",
"ISEPAParser",
"get",
"(",
"SepaVersion",
"version",
")",
"{",
"ISEPAParser",
"parser",
"=",
"null",
";",
"String",
"className",
"=",
"version",
".",
"getParserClass",
"(",
")",
";",
"try",
"{",
"log",
".",
"debug",
"(",
"\"trying to init SEPA parser: \"",
"+",
"className",
")",
";",
"Class",
"cl",
"=",
"Class",
".",
"forName",
"(",
"className",
")",
";",
"parser",
"=",
"(",
"ISEPAParser",
")",
"cl",
".",
"newInstance",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"String",
"msg",
"=",
"\"Error creating SEPA parser\"",
";",
"throw",
"new",
"HBCI_Exception",
"(",
"msg",
",",
"e",
")",
";",
"}",
"return",
"parser",
";",
"}"
] | Gibt den passenden SEPA Parser für die angegebene PAIN-Version.
@param version die PAIN-Version.
@return ISEPAParser | [
"Gibt",
"den",
"passenden",
"SEPA",
"Parser",
"für",
"die",
"angegebene",
"PAIN",
"-",
"Version",
"."
] | train | https://github.com/adorsys/hbci4java-adorsys/blob/5e24f7e429d6b555e1d993196b4cf1adda6433cf/src/main/java/org/kapott/hbci/GV/parsers/SEPAParserFactory.java#L18-L31 |
pressgang-ccms/PressGangCCMSContentSpecProcessor | src/main/java/org/jboss/pressgang/ccms/contentspec/processor/ContentSpecProcessor.java | ContentSpecProcessor.doesRelationshipMatch | protected boolean doesRelationshipMatch(final TargetRelationship relationship, final CSRelatedNodeWrapper relatedNode) {
"""
Checks to see if a ContentSpec topic relationship matches a Content Spec Entity topic.
@param relationship The ContentSpec topic relationship object.
@param relatedNode The related Content Spec Entity topic.
@return True if the topic is determined to match otherwise false.
"""
// If the relationship node is a node that can't be related to (ie a comment or meta data), than the relationship cannot match
if (relatedNode.getNodeType().equals(CommonConstants.CS_NODE_COMMENT) || relatedNode.getNodeType().equals(
CommonConstants.CS_NODE_META_DATA)) {
return false;
}
// Check if the type matches first
if (!RelationshipType.getRelationshipTypeId(relationship.getType()).equals(relatedNode.getRelationshipType())) return false;
// If the unique id is not from the parser, in which case it will start with a number than use the unique id to compare
if (relationship.getSecondaryRelationship().getUniqueId() != null && relationship.getSecondaryRelationship().getUniqueId().matches(
"^\\d.*")) {
return relationship.getSecondaryRelationship().getUniqueId().equals(Integer.toString(relatedNode.getId()));
} else if (relationship.getSecondaryRelationship() instanceof Level) {
return ((Level) relationship.getSecondaryRelationship()).getTargetId().equals(relatedNode.getTargetId());
} else if (relationship.getSecondaryRelationship() instanceof SpecTopic) {
return ((SpecTopic) relationship.getSecondaryRelationship()).getTargetId().equals(relatedNode.getTargetId());
} else {
return false;
}
} | java | protected boolean doesRelationshipMatch(final TargetRelationship relationship, final CSRelatedNodeWrapper relatedNode) {
// If the relationship node is a node that can't be related to (ie a comment or meta data), than the relationship cannot match
if (relatedNode.getNodeType().equals(CommonConstants.CS_NODE_COMMENT) || relatedNode.getNodeType().equals(
CommonConstants.CS_NODE_META_DATA)) {
return false;
}
// Check if the type matches first
if (!RelationshipType.getRelationshipTypeId(relationship.getType()).equals(relatedNode.getRelationshipType())) return false;
// If the unique id is not from the parser, in which case it will start with a number than use the unique id to compare
if (relationship.getSecondaryRelationship().getUniqueId() != null && relationship.getSecondaryRelationship().getUniqueId().matches(
"^\\d.*")) {
return relationship.getSecondaryRelationship().getUniqueId().equals(Integer.toString(relatedNode.getId()));
} else if (relationship.getSecondaryRelationship() instanceof Level) {
return ((Level) relationship.getSecondaryRelationship()).getTargetId().equals(relatedNode.getTargetId());
} else if (relationship.getSecondaryRelationship() instanceof SpecTopic) {
return ((SpecTopic) relationship.getSecondaryRelationship()).getTargetId().equals(relatedNode.getTargetId());
} else {
return false;
}
} | [
"protected",
"boolean",
"doesRelationshipMatch",
"(",
"final",
"TargetRelationship",
"relationship",
",",
"final",
"CSRelatedNodeWrapper",
"relatedNode",
")",
"{",
"// If the relationship node is a node that can't be related to (ie a comment or meta data), than the relationship cannot match",
"if",
"(",
"relatedNode",
".",
"getNodeType",
"(",
")",
".",
"equals",
"(",
"CommonConstants",
".",
"CS_NODE_COMMENT",
")",
"||",
"relatedNode",
".",
"getNodeType",
"(",
")",
".",
"equals",
"(",
"CommonConstants",
".",
"CS_NODE_META_DATA",
")",
")",
"{",
"return",
"false",
";",
"}",
"// Check if the type matches first",
"if",
"(",
"!",
"RelationshipType",
".",
"getRelationshipTypeId",
"(",
"relationship",
".",
"getType",
"(",
")",
")",
".",
"equals",
"(",
"relatedNode",
".",
"getRelationshipType",
"(",
")",
")",
")",
"return",
"false",
";",
"// If the unique id is not from the parser, in which case it will start with a number than use the unique id to compare",
"if",
"(",
"relationship",
".",
"getSecondaryRelationship",
"(",
")",
".",
"getUniqueId",
"(",
")",
"!=",
"null",
"&&",
"relationship",
".",
"getSecondaryRelationship",
"(",
")",
".",
"getUniqueId",
"(",
")",
".",
"matches",
"(",
"\"^\\\\d.*\"",
")",
")",
"{",
"return",
"relationship",
".",
"getSecondaryRelationship",
"(",
")",
".",
"getUniqueId",
"(",
")",
".",
"equals",
"(",
"Integer",
".",
"toString",
"(",
"relatedNode",
".",
"getId",
"(",
")",
")",
")",
";",
"}",
"else",
"if",
"(",
"relationship",
".",
"getSecondaryRelationship",
"(",
")",
"instanceof",
"Level",
")",
"{",
"return",
"(",
"(",
"Level",
")",
"relationship",
".",
"getSecondaryRelationship",
"(",
")",
")",
".",
"getTargetId",
"(",
")",
".",
"equals",
"(",
"relatedNode",
".",
"getTargetId",
"(",
")",
")",
";",
"}",
"else",
"if",
"(",
"relationship",
".",
"getSecondaryRelationship",
"(",
")",
"instanceof",
"SpecTopic",
")",
"{",
"return",
"(",
"(",
"SpecTopic",
")",
"relationship",
".",
"getSecondaryRelationship",
"(",
")",
")",
".",
"getTargetId",
"(",
")",
".",
"equals",
"(",
"relatedNode",
".",
"getTargetId",
"(",
")",
")",
";",
"}",
"else",
"{",
"return",
"false",
";",
"}",
"}"
] | Checks to see if a ContentSpec topic relationship matches a Content Spec Entity topic.
@param relationship The ContentSpec topic relationship object.
@param relatedNode The related Content Spec Entity topic.
@return True if the topic is determined to match otherwise false. | [
"Checks",
"to",
"see",
"if",
"a",
"ContentSpec",
"topic",
"relationship",
"matches",
"a",
"Content",
"Spec",
"Entity",
"topic",
"."
] | train | https://github.com/pressgang-ccms/PressGangCCMSContentSpecProcessor/blob/85ffac047c4ede0f972364ab1f03f7d61a4de5f1/src/main/java/org/jboss/pressgang/ccms/contentspec/processor/ContentSpecProcessor.java#L2216-L2237 |
thombergs/docx-stamper | src/main/java/org/wickedsource/docxstamper/util/IndexedRun.java | IndexedRun.isTouchedByRange | public boolean isTouchedByRange(int globalStartIndex, int globalEndIndex) {
"""
Determines whether the specified range of start and end index touches this run.
"""
return ((startIndex >= globalStartIndex) && (startIndex <= globalEndIndex))
|| ((endIndex >= globalStartIndex) && (endIndex <= globalEndIndex))
|| ((startIndex <= globalStartIndex) && (endIndex >= globalEndIndex));
} | java | public boolean isTouchedByRange(int globalStartIndex, int globalEndIndex) {
return ((startIndex >= globalStartIndex) && (startIndex <= globalEndIndex))
|| ((endIndex >= globalStartIndex) && (endIndex <= globalEndIndex))
|| ((startIndex <= globalStartIndex) && (endIndex >= globalEndIndex));
} | [
"public",
"boolean",
"isTouchedByRange",
"(",
"int",
"globalStartIndex",
",",
"int",
"globalEndIndex",
")",
"{",
"return",
"(",
"(",
"startIndex",
">=",
"globalStartIndex",
")",
"&&",
"(",
"startIndex",
"<=",
"globalEndIndex",
")",
")",
"||",
"(",
"(",
"endIndex",
">=",
"globalStartIndex",
")",
"&&",
"(",
"endIndex",
"<=",
"globalEndIndex",
")",
")",
"||",
"(",
"(",
"startIndex",
"<=",
"globalStartIndex",
")",
"&&",
"(",
"endIndex",
">=",
"globalEndIndex",
")",
")",
";",
"}"
] | Determines whether the specified range of start and end index touches this run. | [
"Determines",
"whether",
"the",
"specified",
"range",
"of",
"start",
"and",
"end",
"index",
"touches",
"this",
"run",
"."
] | train | https://github.com/thombergs/docx-stamper/blob/f1a7e3e92a59abaffac299532fe49450c3b041eb/src/main/java/org/wickedsource/docxstamper/util/IndexedRun.java#L46-L51 |
opendatatrentino/s-match | src/main/java/it/unitn/disi/smatch/matchers/element/gloss/BasicGlossMatcher.java | BasicGlossMatcher.isWordMoreGeneral | public boolean isWordMoreGeneral(String source, String target) throws MatcherLibraryException {
"""
Checks the source is more general than the target or not.
@param source sense of source
@param target sense of target
@return true if the source is more general than target
@throws MatcherLibraryException MatcherLibraryException
"""
try {
List<ISense> sSenses = linguisticOracle.getSenses(source);
List<ISense> tSenses = linguisticOracle.getSenses(target);
for (ISense sSense : sSenses) {
for (ISense tSense : tSenses) {
if (senseMatcher.isSourceMoreGeneralThanTarget(sSense, tSense))
return true;
}
}
return false;
} catch (LinguisticOracleException e) {
final String errMessage = e.getClass().getSimpleName() + ": " + e.getMessage();
log.error(errMessage, e);
throw new MatcherLibraryException(errMessage, e);
} catch (SenseMatcherException e) {
final String errMessage = e.getClass().getSimpleName() + ": " + e.getMessage();
log.error(errMessage, e);
throw new MatcherLibraryException(errMessage, e);
}
} | java | public boolean isWordMoreGeneral(String source, String target) throws MatcherLibraryException {
try {
List<ISense> sSenses = linguisticOracle.getSenses(source);
List<ISense> tSenses = linguisticOracle.getSenses(target);
for (ISense sSense : sSenses) {
for (ISense tSense : tSenses) {
if (senseMatcher.isSourceMoreGeneralThanTarget(sSense, tSense))
return true;
}
}
return false;
} catch (LinguisticOracleException e) {
final String errMessage = e.getClass().getSimpleName() + ": " + e.getMessage();
log.error(errMessage, e);
throw new MatcherLibraryException(errMessage, e);
} catch (SenseMatcherException e) {
final String errMessage = e.getClass().getSimpleName() + ": " + e.getMessage();
log.error(errMessage, e);
throw new MatcherLibraryException(errMessage, e);
}
} | [
"public",
"boolean",
"isWordMoreGeneral",
"(",
"String",
"source",
",",
"String",
"target",
")",
"throws",
"MatcherLibraryException",
"{",
"try",
"{",
"List",
"<",
"ISense",
">",
"sSenses",
"=",
"linguisticOracle",
".",
"getSenses",
"(",
"source",
")",
";",
"List",
"<",
"ISense",
">",
"tSenses",
"=",
"linguisticOracle",
".",
"getSenses",
"(",
"target",
")",
";",
"for",
"(",
"ISense",
"sSense",
":",
"sSenses",
")",
"{",
"for",
"(",
"ISense",
"tSense",
":",
"tSenses",
")",
"{",
"if",
"(",
"senseMatcher",
".",
"isSourceMoreGeneralThanTarget",
"(",
"sSense",
",",
"tSense",
")",
")",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}",
"catch",
"(",
"LinguisticOracleException",
"e",
")",
"{",
"final",
"String",
"errMessage",
"=",
"e",
".",
"getClass",
"(",
")",
".",
"getSimpleName",
"(",
")",
"+",
"\": \"",
"+",
"e",
".",
"getMessage",
"(",
")",
";",
"log",
".",
"error",
"(",
"errMessage",
",",
"e",
")",
";",
"throw",
"new",
"MatcherLibraryException",
"(",
"errMessage",
",",
"e",
")",
";",
"}",
"catch",
"(",
"SenseMatcherException",
"e",
")",
"{",
"final",
"String",
"errMessage",
"=",
"e",
".",
"getClass",
"(",
")",
".",
"getSimpleName",
"(",
")",
"+",
"\": \"",
"+",
"e",
".",
"getMessage",
"(",
")",
";",
"log",
".",
"error",
"(",
"errMessage",
",",
"e",
")",
";",
"throw",
"new",
"MatcherLibraryException",
"(",
"errMessage",
",",
"e",
")",
";",
"}",
"}"
] | Checks the source is more general than the target or not.
@param source sense of source
@param target sense of target
@return true if the source is more general than target
@throws MatcherLibraryException MatcherLibraryException | [
"Checks",
"the",
"source",
"is",
"more",
"general",
"than",
"the",
"target",
"or",
"not",
"."
] | train | https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/matchers/element/gloss/BasicGlossMatcher.java#L72-L92 |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging/src/com/ibm/ws/logging/internal/impl/BaseTraceService.java | BaseTraceService.updateConduitSyncHandlerConnection | private void updateConduitSyncHandlerConnection(List<String> sourceList, SynchronousHandler handler) {
"""
/*
Based on config (sourceList), need to connect the synchronized handler to configured source/conduit..
Or disconnect it.
"""
if (sourceList.contains("message")) {
logConduit.addSyncHandler(handler);
} else {
logConduit.removeSyncHandler(handler);
}
if (sourceList.contains("trace")) {
traceConduit.addSyncHandler(handler);
} else {
traceConduit.removeSyncHandler(handler);
}
} | java | private void updateConduitSyncHandlerConnection(List<String> sourceList, SynchronousHandler handler) {
if (sourceList.contains("message")) {
logConduit.addSyncHandler(handler);
} else {
logConduit.removeSyncHandler(handler);
}
if (sourceList.contains("trace")) {
traceConduit.addSyncHandler(handler);
} else {
traceConduit.removeSyncHandler(handler);
}
} | [
"private",
"void",
"updateConduitSyncHandlerConnection",
"(",
"List",
"<",
"String",
">",
"sourceList",
",",
"SynchronousHandler",
"handler",
")",
"{",
"if",
"(",
"sourceList",
".",
"contains",
"(",
"\"message\"",
")",
")",
"{",
"logConduit",
".",
"addSyncHandler",
"(",
"handler",
")",
";",
"}",
"else",
"{",
"logConduit",
".",
"removeSyncHandler",
"(",
"handler",
")",
";",
"}",
"if",
"(",
"sourceList",
".",
"contains",
"(",
"\"trace\"",
")",
")",
"{",
"traceConduit",
".",
"addSyncHandler",
"(",
"handler",
")",
";",
"}",
"else",
"{",
"traceConduit",
".",
"removeSyncHandler",
"(",
"handler",
")",
";",
"}",
"}"
] | /*
Based on config (sourceList), need to connect the synchronized handler to configured source/conduit..
Or disconnect it. | [
"/",
"*",
"Based",
"on",
"config",
"(",
"sourceList",
")",
"need",
"to",
"connect",
"the",
"synchronized",
"handler",
"to",
"configured",
"source",
"/",
"conduit",
"..",
"Or",
"disconnect",
"it",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging/src/com/ibm/ws/logging/internal/impl/BaseTraceService.java#L1375-L1387 |
google/closure-templates | java/src/com/google/template/soy/soytree/TagName.java | TagName.checkCloseTagClosesOptional | public static boolean checkCloseTagClosesOptional(TagName closeTag, TagName optionalOpenTag) {
"""
Checks if the an open tag can be auto-closed by a following close tag which does not have the
same tag name as the open tag.
<p>We throws an {@code IllegalArgumentException} if two inputs have the same tag names, since
this should never happen (should be handled by previous logic in {@code
StrictHtmlValidationPass}).
<p>This implements half of the content model described in <a
href="https://www.w3.org/TR/html5/syntax.html#optional-tags">https://www.w3.org/TR/html5/syntax.html#optional-tags</a>.
Notably we do nothing when we see cases like "li element is immediately followed by another li
element". The validation logic relies on auto-closing open tags when we see close tags. Since
only {@code </ul>} and {@code </ol>} are allowed to close {@code <li>}, we believe this should
still give us a confident error message. We might consider adding support for popping open tags
when we visit open tags in the future.
"""
// TODO(b/120994894): Replace this with checkArgument() when HtmlTagEntry can be replaced.
if (!optionalOpenTag.isStatic() || !optionalOpenTag.isDefinitelyOptional()) {
return false;
}
if (!closeTag.isStatic()) {
return true;
}
String openTagName = optionalOpenTag.getStaticTagNameAsLowerCase();
String closeTagName = closeTag.getStaticTagNameAsLowerCase();
checkArgument(!openTagName.equals(closeTagName));
if ("p".equals(openTagName)) {
return !PTAG_CLOSE_EXCEPTIONS.contains(closeTagName);
}
return OPTIONAL_TAG_CLOSE_TAG_RULES.containsEntry(openTagName, closeTagName);
} | java | public static boolean checkCloseTagClosesOptional(TagName closeTag, TagName optionalOpenTag) {
// TODO(b/120994894): Replace this with checkArgument() when HtmlTagEntry can be replaced.
if (!optionalOpenTag.isStatic() || !optionalOpenTag.isDefinitelyOptional()) {
return false;
}
if (!closeTag.isStatic()) {
return true;
}
String openTagName = optionalOpenTag.getStaticTagNameAsLowerCase();
String closeTagName = closeTag.getStaticTagNameAsLowerCase();
checkArgument(!openTagName.equals(closeTagName));
if ("p".equals(openTagName)) {
return !PTAG_CLOSE_EXCEPTIONS.contains(closeTagName);
}
return OPTIONAL_TAG_CLOSE_TAG_RULES.containsEntry(openTagName, closeTagName);
} | [
"public",
"static",
"boolean",
"checkCloseTagClosesOptional",
"(",
"TagName",
"closeTag",
",",
"TagName",
"optionalOpenTag",
")",
"{",
"// TODO(b/120994894): Replace this with checkArgument() when HtmlTagEntry can be replaced.",
"if",
"(",
"!",
"optionalOpenTag",
".",
"isStatic",
"(",
")",
"||",
"!",
"optionalOpenTag",
".",
"isDefinitelyOptional",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"!",
"closeTag",
".",
"isStatic",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"String",
"openTagName",
"=",
"optionalOpenTag",
".",
"getStaticTagNameAsLowerCase",
"(",
")",
";",
"String",
"closeTagName",
"=",
"closeTag",
".",
"getStaticTagNameAsLowerCase",
"(",
")",
";",
"checkArgument",
"(",
"!",
"openTagName",
".",
"equals",
"(",
"closeTagName",
")",
")",
";",
"if",
"(",
"\"p\"",
".",
"equals",
"(",
"openTagName",
")",
")",
"{",
"return",
"!",
"PTAG_CLOSE_EXCEPTIONS",
".",
"contains",
"(",
"closeTagName",
")",
";",
"}",
"return",
"OPTIONAL_TAG_CLOSE_TAG_RULES",
".",
"containsEntry",
"(",
"openTagName",
",",
"closeTagName",
")",
";",
"}"
] | Checks if the an open tag can be auto-closed by a following close tag which does not have the
same tag name as the open tag.
<p>We throws an {@code IllegalArgumentException} if two inputs have the same tag names, since
this should never happen (should be handled by previous logic in {@code
StrictHtmlValidationPass}).
<p>This implements half of the content model described in <a
href="https://www.w3.org/TR/html5/syntax.html#optional-tags">https://www.w3.org/TR/html5/syntax.html#optional-tags</a>.
Notably we do nothing when we see cases like "li element is immediately followed by another li
element". The validation logic relies on auto-closing open tags when we see close tags. Since
only {@code </ul>} and {@code </ol>} are allowed to close {@code <li>}, we believe this should
still give us a confident error message. We might consider adding support for popping open tags
when we visit open tags in the future. | [
"Checks",
"if",
"the",
"an",
"open",
"tag",
"can",
"be",
"auto",
"-",
"closed",
"by",
"a",
"following",
"close",
"tag",
"which",
"does",
"not",
"have",
"the",
"same",
"tag",
"name",
"as",
"the",
"open",
"tag",
"."
] | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/soytree/TagName.java#L276-L291 |
bazaarvoice/emodb | sor/src/main/java/com/bazaarvoice/emodb/sor/db/astyanax/CqlDataReaderDAO.java | CqlDataReaderDAO.readBatch | private Iterator<Record> readBatch(final DeltaPlacement placement, final Collection<Key> keys, final ReadConsistency consistency) {
"""
Read a batch of keys that all belong to the same placement (ColumnFamily).
"""
checkNotNull(keys, "keys");
// Convert the keys to ByteBuffer Cassandra row keys
List<Map.Entry<ByteBuffer, Key>> rowKeys = Lists.newArrayListWithCapacity(keys.size());
for (Key key : keys) {
AstyanaxTable table = (AstyanaxTable) key.getTable();
AstyanaxStorage storage = table.getReadStorage();
rowKeys.add(Maps.immutableEntry(storage.getRowKey(key.getKey()), key));
}
// Sort the keys by their byte array encoding to get some locality w/queries.
Collections.sort(rowKeys, Ordering.natural().onResultOf(entry -> entry.getKey()));
// Group them into batches. Cassandra may have to seek each row so prefer smaller batches.
List<List<Map.Entry<ByteBuffer, Key>>> batches = Lists.partition(rowKeys, _driverConfig.getMaxRandomRowsBatchSize());
// This algorithm is arranged such that rows are return in pages with size _fetchSize. The rows are grouped
// into row groups by common row key. The first RECORD_CACHE_SIZE rows are cached for the row group
// and any remaining rows are cached using soft references. This places an upper bound on the memory
// requirements needed while iterating. If at any time a soft reference is lost C* is re-queried to
// fetch the missing columns.
return Iterators.concat(Iterators.transform(batches.iterator(),
rowKeySubset -> {
Timer.Context timerCtx = _readBatchTimer.time();
try {
return rowQuery(rowKeySubset, consistency, placement);
} finally {
timerCtx.stop();
}
}));
} | java | private Iterator<Record> readBatch(final DeltaPlacement placement, final Collection<Key> keys, final ReadConsistency consistency) {
checkNotNull(keys, "keys");
// Convert the keys to ByteBuffer Cassandra row keys
List<Map.Entry<ByteBuffer, Key>> rowKeys = Lists.newArrayListWithCapacity(keys.size());
for (Key key : keys) {
AstyanaxTable table = (AstyanaxTable) key.getTable();
AstyanaxStorage storage = table.getReadStorage();
rowKeys.add(Maps.immutableEntry(storage.getRowKey(key.getKey()), key));
}
// Sort the keys by their byte array encoding to get some locality w/queries.
Collections.sort(rowKeys, Ordering.natural().onResultOf(entry -> entry.getKey()));
// Group them into batches. Cassandra may have to seek each row so prefer smaller batches.
List<List<Map.Entry<ByteBuffer, Key>>> batches = Lists.partition(rowKeys, _driverConfig.getMaxRandomRowsBatchSize());
// This algorithm is arranged such that rows are return in pages with size _fetchSize. The rows are grouped
// into row groups by common row key. The first RECORD_CACHE_SIZE rows are cached for the row group
// and any remaining rows are cached using soft references. This places an upper bound on the memory
// requirements needed while iterating. If at any time a soft reference is lost C* is re-queried to
// fetch the missing columns.
return Iterators.concat(Iterators.transform(batches.iterator(),
rowKeySubset -> {
Timer.Context timerCtx = _readBatchTimer.time();
try {
return rowQuery(rowKeySubset, consistency, placement);
} finally {
timerCtx.stop();
}
}));
} | [
"private",
"Iterator",
"<",
"Record",
">",
"readBatch",
"(",
"final",
"DeltaPlacement",
"placement",
",",
"final",
"Collection",
"<",
"Key",
">",
"keys",
",",
"final",
"ReadConsistency",
"consistency",
")",
"{",
"checkNotNull",
"(",
"keys",
",",
"\"keys\"",
")",
";",
"// Convert the keys to ByteBuffer Cassandra row keys",
"List",
"<",
"Map",
".",
"Entry",
"<",
"ByteBuffer",
",",
"Key",
">",
">",
"rowKeys",
"=",
"Lists",
".",
"newArrayListWithCapacity",
"(",
"keys",
".",
"size",
"(",
")",
")",
";",
"for",
"(",
"Key",
"key",
":",
"keys",
")",
"{",
"AstyanaxTable",
"table",
"=",
"(",
"AstyanaxTable",
")",
"key",
".",
"getTable",
"(",
")",
";",
"AstyanaxStorage",
"storage",
"=",
"table",
".",
"getReadStorage",
"(",
")",
";",
"rowKeys",
".",
"add",
"(",
"Maps",
".",
"immutableEntry",
"(",
"storage",
".",
"getRowKey",
"(",
"key",
".",
"getKey",
"(",
")",
")",
",",
"key",
")",
")",
";",
"}",
"// Sort the keys by their byte array encoding to get some locality w/queries.",
"Collections",
".",
"sort",
"(",
"rowKeys",
",",
"Ordering",
".",
"natural",
"(",
")",
".",
"onResultOf",
"(",
"entry",
"->",
"entry",
".",
"getKey",
"(",
")",
")",
")",
";",
"// Group them into batches. Cassandra may have to seek each row so prefer smaller batches.",
"List",
"<",
"List",
"<",
"Map",
".",
"Entry",
"<",
"ByteBuffer",
",",
"Key",
">",
">",
">",
"batches",
"=",
"Lists",
".",
"partition",
"(",
"rowKeys",
",",
"_driverConfig",
".",
"getMaxRandomRowsBatchSize",
"(",
")",
")",
";",
"// This algorithm is arranged such that rows are return in pages with size _fetchSize. The rows are grouped",
"// into row groups by common row key. The first RECORD_CACHE_SIZE rows are cached for the row group",
"// and any remaining rows are cached using soft references. This places an upper bound on the memory",
"// requirements needed while iterating. If at any time a soft reference is lost C* is re-queried to",
"// fetch the missing columns.",
"return",
"Iterators",
".",
"concat",
"(",
"Iterators",
".",
"transform",
"(",
"batches",
".",
"iterator",
"(",
")",
",",
"rowKeySubset",
"->",
"{",
"Timer",
".",
"Context",
"timerCtx",
"=",
"_readBatchTimer",
".",
"time",
"(",
")",
";",
"try",
"{",
"return",
"rowQuery",
"(",
"rowKeySubset",
",",
"consistency",
",",
"placement",
")",
";",
"}",
"finally",
"{",
"timerCtx",
".",
"stop",
"(",
")",
";",
"}",
"}",
")",
")",
";",
"}"
] | Read a batch of keys that all belong to the same placement (ColumnFamily). | [
"Read",
"a",
"batch",
"of",
"keys",
"that",
"all",
"belong",
"to",
"the",
"same",
"placement",
"(",
"ColumnFamily",
")",
"."
] | train | https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/sor/src/main/java/com/bazaarvoice/emodb/sor/db/astyanax/CqlDataReaderDAO.java#L335-L367 |
Netflix/conductor | client/src/main/java/com/netflix/conductor/client/http/TaskClient.java | TaskClient.pollTask | public Task pollTask(String taskType, String workerId, String domain) {
"""
Perform a poll for a task of a specific task type.
@param taskType The taskType to poll for
@param domain The domain of the task type
@param workerId Name of the client worker. Used for logging.
@return Task waiting to be executed.
"""
Preconditions.checkArgument(StringUtils.isNotBlank(taskType), "Task type cannot be blank");
Preconditions.checkArgument(StringUtils.isNotBlank(domain), "Domain cannot be blank");
Preconditions.checkArgument(StringUtils.isNotBlank(workerId), "Worker id cannot be blank");
Object[] params = new Object[]{"workerid", workerId, "domain", domain};
Task task = getForEntity("tasks/poll/{taskType}", params, Task.class, taskType);
populateTaskInput(task);
return task;
} | java | public Task pollTask(String taskType, String workerId, String domain) {
Preconditions.checkArgument(StringUtils.isNotBlank(taskType), "Task type cannot be blank");
Preconditions.checkArgument(StringUtils.isNotBlank(domain), "Domain cannot be blank");
Preconditions.checkArgument(StringUtils.isNotBlank(workerId), "Worker id cannot be blank");
Object[] params = new Object[]{"workerid", workerId, "domain", domain};
Task task = getForEntity("tasks/poll/{taskType}", params, Task.class, taskType);
populateTaskInput(task);
return task;
} | [
"public",
"Task",
"pollTask",
"(",
"String",
"taskType",
",",
"String",
"workerId",
",",
"String",
"domain",
")",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"StringUtils",
".",
"isNotBlank",
"(",
"taskType",
")",
",",
"\"Task type cannot be blank\"",
")",
";",
"Preconditions",
".",
"checkArgument",
"(",
"StringUtils",
".",
"isNotBlank",
"(",
"domain",
")",
",",
"\"Domain cannot be blank\"",
")",
";",
"Preconditions",
".",
"checkArgument",
"(",
"StringUtils",
".",
"isNotBlank",
"(",
"workerId",
")",
",",
"\"Worker id cannot be blank\"",
")",
";",
"Object",
"[",
"]",
"params",
"=",
"new",
"Object",
"[",
"]",
"{",
"\"workerid\"",
",",
"workerId",
",",
"\"domain\"",
",",
"domain",
"}",
";",
"Task",
"task",
"=",
"getForEntity",
"(",
"\"tasks/poll/{taskType}\"",
",",
"params",
",",
"Task",
".",
"class",
",",
"taskType",
")",
";",
"populateTaskInput",
"(",
"task",
")",
";",
"return",
"task",
";",
"}"
] | Perform a poll for a task of a specific task type.
@param taskType The taskType to poll for
@param domain The domain of the task type
@param workerId Name of the client worker. Used for logging.
@return Task waiting to be executed. | [
"Perform",
"a",
"poll",
"for",
"a",
"task",
"of",
"a",
"specific",
"task",
"type",
"."
] | train | https://github.com/Netflix/conductor/blob/78fae0ed9ddea22891f9eebb96a2ec0b2783dca0/client/src/main/java/com/netflix/conductor/client/http/TaskClient.java#L121-L130 |
primefaces/primefaces | src/main/java/org/primefaces/renderkit/InputRenderer.java | InputRenderer.renderAccessibilityAttributes | protected void renderAccessibilityAttributes(FacesContext context, UIInput component) throws IOException {
"""
Adds the following accessibility attributes to an HTML DOM element.
<pre>
"aria-required" if the component is required
"aria-invalid" if the component is invalid
"aria-labelledby" if the component has a labelledby attribute
"disabled" and "aria-disabled" if the component is disabled
"readonly" and "aria-readonly" if the component is readonly
</pre>
@param context the {@link FacesContext}
@param component the {@link UIInput} component to add attributes for
@throws IOException if any error occurs writing the response
"""
renderAccessibilityAttributes(context, component, isDisabled(component), isReadOnly(component));
} | java | protected void renderAccessibilityAttributes(FacesContext context, UIInput component) throws IOException {
renderAccessibilityAttributes(context, component, isDisabled(component), isReadOnly(component));
} | [
"protected",
"void",
"renderAccessibilityAttributes",
"(",
"FacesContext",
"context",
",",
"UIInput",
"component",
")",
"throws",
"IOException",
"{",
"renderAccessibilityAttributes",
"(",
"context",
",",
"component",
",",
"isDisabled",
"(",
"component",
")",
",",
"isReadOnly",
"(",
"component",
")",
")",
";",
"}"
] | Adds the following accessibility attributes to an HTML DOM element.
<pre>
"aria-required" if the component is required
"aria-invalid" if the component is invalid
"aria-labelledby" if the component has a labelledby attribute
"disabled" and "aria-disabled" if the component is disabled
"readonly" and "aria-readonly" if the component is readonly
</pre>
@param context the {@link FacesContext}
@param component the {@link UIInput} component to add attributes for
@throws IOException if any error occurs writing the response | [
"Adds",
"the",
"following",
"accessibility",
"attributes",
"to",
"an",
"HTML",
"DOM",
"element",
".",
"<pre",
">",
"aria",
"-",
"required",
"if",
"the",
"component",
"is",
"required",
"aria",
"-",
"invalid",
"if",
"the",
"component",
"is",
"invalid",
"aria",
"-",
"labelledby",
"if",
"the",
"component",
"has",
"a",
"labelledby",
"attribute",
"disabled",
"and",
"aria",
"-",
"disabled",
"if",
"the",
"component",
"is",
"disabled",
"readonly",
"and",
"aria",
"-",
"readonly",
"if",
"the",
"component",
"is",
"readonly",
"<",
"/",
"pre",
">"
] | train | https://github.com/primefaces/primefaces/blob/b8cdd5ed395d09826e40e3302d6b14901d3ef4e7/src/main/java/org/primefaces/renderkit/InputRenderer.java#L115-L117 |
antopen/alipay-sdk-java | src/main/java/com/alipay/api/internal/util/XmlUtils.java | XmlUtils.nodeToString | public static String nodeToString(Node node) throws AlipayApiException {
"""
Converts the Node/Document/Element instance to XML payload.
@param node the node/document/element instance to convert
@return the XML payload representing the node/document/element
@throws ApiException problem converting XML to string
"""
String payload = null;
try {
Transformer tf = TransformerFactory.newInstance().newTransformer();
Properties props = tf.getOutputProperties();
props.setProperty(OutputKeys.INDENT, LOGIC_YES);
props.setProperty(OutputKeys.ENCODING, DEFAULT_ENCODE);
tf.setOutputProperties(props);
StringWriter writer = new StringWriter();
tf.transform(new DOMSource(node), new StreamResult(writer));
payload = writer.toString();
payload = payload.replaceAll(REG_INVALID_CHARS, " ");
} catch (TransformerException e) {
throw new AlipayApiException("XML_TRANSFORM_ERROR", e);
}
return payload;
} | java | public static String nodeToString(Node node) throws AlipayApiException {
String payload = null;
try {
Transformer tf = TransformerFactory.newInstance().newTransformer();
Properties props = tf.getOutputProperties();
props.setProperty(OutputKeys.INDENT, LOGIC_YES);
props.setProperty(OutputKeys.ENCODING, DEFAULT_ENCODE);
tf.setOutputProperties(props);
StringWriter writer = new StringWriter();
tf.transform(new DOMSource(node), new StreamResult(writer));
payload = writer.toString();
payload = payload.replaceAll(REG_INVALID_CHARS, " ");
} catch (TransformerException e) {
throw new AlipayApiException("XML_TRANSFORM_ERROR", e);
}
return payload;
} | [
"public",
"static",
"String",
"nodeToString",
"(",
"Node",
"node",
")",
"throws",
"AlipayApiException",
"{",
"String",
"payload",
"=",
"null",
";",
"try",
"{",
"Transformer",
"tf",
"=",
"TransformerFactory",
".",
"newInstance",
"(",
")",
".",
"newTransformer",
"(",
")",
";",
"Properties",
"props",
"=",
"tf",
".",
"getOutputProperties",
"(",
")",
";",
"props",
".",
"setProperty",
"(",
"OutputKeys",
".",
"INDENT",
",",
"LOGIC_YES",
")",
";",
"props",
".",
"setProperty",
"(",
"OutputKeys",
".",
"ENCODING",
",",
"DEFAULT_ENCODE",
")",
";",
"tf",
".",
"setOutputProperties",
"(",
"props",
")",
";",
"StringWriter",
"writer",
"=",
"new",
"StringWriter",
"(",
")",
";",
"tf",
".",
"transform",
"(",
"new",
"DOMSource",
"(",
"node",
")",
",",
"new",
"StreamResult",
"(",
"writer",
")",
")",
";",
"payload",
"=",
"writer",
".",
"toString",
"(",
")",
";",
"payload",
"=",
"payload",
".",
"replaceAll",
"(",
"REG_INVALID_CHARS",
",",
"\" \"",
")",
";",
"}",
"catch",
"(",
"TransformerException",
"e",
")",
"{",
"throw",
"new",
"AlipayApiException",
"(",
"\"XML_TRANSFORM_ERROR\"",
",",
"e",
")",
";",
"}",
"return",
"payload",
";",
"}"
] | Converts the Node/Document/Element instance to XML payload.
@param node the node/document/element instance to convert
@return the XML payload representing the node/document/element
@throws ApiException problem converting XML to string | [
"Converts",
"the",
"Node",
"/",
"Document",
"/",
"Element",
"instance",
"to",
"XML",
"payload",
"."
] | train | https://github.com/antopen/alipay-sdk-java/blob/e82aeac7d0239330ee173c7e393596e51e41c1cd/src/main/java/com/alipay/api/internal/util/XmlUtils.java#L436-L456 |
skjolber/3d-bin-container-packing | src/main/java/com/github/skjolberg/packing/LargestAreaFitFirstPackager.java | LargestAreaFitFirstPackager.isBetter2D | protected int isBetter2D(Box a, Box b) {
"""
Is box b better than a?
@param a box
@param b box
@return -1 if b is better, 0 if equal, 1 if b is better
"""
int compare = Long.compare(a.getVolume(), b.getVolume());
if(compare != 0) {
return compare;
}
return Long.compare(b.getFootprint(), a.getFootprint()); // i.e. smaller i better
} | java | protected int isBetter2D(Box a, Box b) {
int compare = Long.compare(a.getVolume(), b.getVolume());
if(compare != 0) {
return compare;
}
return Long.compare(b.getFootprint(), a.getFootprint()); // i.e. smaller i better
} | [
"protected",
"int",
"isBetter2D",
"(",
"Box",
"a",
",",
"Box",
"b",
")",
"{",
"int",
"compare",
"=",
"Long",
".",
"compare",
"(",
"a",
".",
"getVolume",
"(",
")",
",",
"b",
".",
"getVolume",
"(",
")",
")",
";",
"if",
"(",
"compare",
"!=",
"0",
")",
"{",
"return",
"compare",
";",
"}",
"return",
"Long",
".",
"compare",
"(",
"b",
".",
"getFootprint",
"(",
")",
",",
"a",
".",
"getFootprint",
"(",
")",
")",
";",
"// i.e. smaller i better",
"}"
] | Is box b better than a?
@param a box
@param b box
@return -1 if b is better, 0 if equal, 1 if b is better | [
"Is",
"box",
"b",
"better",
"than",
"a?"
] | train | https://github.com/skjolber/3d-bin-container-packing/blob/9609bc7515322b2de2cad0dfb3d2f72607e71aae/src/main/java/com/github/skjolberg/packing/LargestAreaFitFirstPackager.java#L432-L439 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/ContentModeratorManager.java | ContentModeratorManager.authenticate | public static ContentModeratorClient authenticate(AzureRegionBaseUrl baseUrl, String subscriptionKey) {
"""
Initializes an instance of Content Moderator API client.
@param baseUrl sets Supported Azure regions for Content Moderator endpoints.
@param subscriptionKey the Content Moderator API key
@return the Content Moderator API client
"""
return authenticate("https://{baseUrl}/", subscriptionKey)
.withBaseUrl(baseUrl);
} | java | public static ContentModeratorClient authenticate(AzureRegionBaseUrl baseUrl, String subscriptionKey) {
return authenticate("https://{baseUrl}/", subscriptionKey)
.withBaseUrl(baseUrl);
} | [
"public",
"static",
"ContentModeratorClient",
"authenticate",
"(",
"AzureRegionBaseUrl",
"baseUrl",
",",
"String",
"subscriptionKey",
")",
"{",
"return",
"authenticate",
"(",
"\"https://{baseUrl}/\"",
",",
"subscriptionKey",
")",
".",
"withBaseUrl",
"(",
"baseUrl",
")",
";",
"}"
] | Initializes an instance of Content Moderator API client.
@param baseUrl sets Supported Azure regions for Content Moderator endpoints.
@param subscriptionKey the Content Moderator API key
@return the Content Moderator API client | [
"Initializes",
"an",
"instance",
"of",
"Content",
"Moderator",
"API",
"client",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/ContentModeratorManager.java#L31-L34 |
dynjs/dynjs | src/main/java/org/dynjs/runtime/modules/ModuleProvider.java | ModuleProvider.getLocalVar | public static Object getLocalVar(ExecutionContext context, String name) {
"""
A convenience for module providers. Gets a scoped variable from
the provided ExecutionContext
@param context The context to search for name
@param name The name of the variable
@return The value of the variable
"""
LexicalEnvironment localEnv = context.getLexicalEnvironment();
if (localEnv.getRecord().hasBinding(context, name)) {
return localEnv.getRecord().getBindingValue(context, name, false);
}
return null;
} | java | public static Object getLocalVar(ExecutionContext context, String name) {
LexicalEnvironment localEnv = context.getLexicalEnvironment();
if (localEnv.getRecord().hasBinding(context, name)) {
return localEnv.getRecord().getBindingValue(context, name, false);
}
return null;
} | [
"public",
"static",
"Object",
"getLocalVar",
"(",
"ExecutionContext",
"context",
",",
"String",
"name",
")",
"{",
"LexicalEnvironment",
"localEnv",
"=",
"context",
".",
"getLexicalEnvironment",
"(",
")",
";",
"if",
"(",
"localEnv",
".",
"getRecord",
"(",
")",
".",
"hasBinding",
"(",
"context",
",",
"name",
")",
")",
"{",
"return",
"localEnv",
".",
"getRecord",
"(",
")",
".",
"getBindingValue",
"(",
"context",
",",
"name",
",",
"false",
")",
";",
"}",
"return",
"null",
";",
"}"
] | A convenience for module providers. Gets a scoped variable from
the provided ExecutionContext
@param context The context to search for name
@param name The name of the variable
@return The value of the variable | [
"A",
"convenience",
"for",
"module",
"providers",
".",
"Gets",
"a",
"scoped",
"variable",
"from",
"the",
"provided",
"ExecutionContext"
] | train | https://github.com/dynjs/dynjs/blob/4bc6715eff8768f8cd92c6a167d621bbfc1e1a91/src/main/java/org/dynjs/runtime/modules/ModuleProvider.java#L58-L64 |
qzagarese/hyaline-dto | hyaline-dto/src/main/java/org/hyalinedto/api/Hyaline.java | Hyaline.dtoFromScratch | public static <T> T dtoFromScratch(T entity, DTO dtoTemplate, String proxyClassName) throws HyalineException {
"""
It lets you create a new DTO from scratch. This means that any annotation
for JAXB, Jackson or whatever serialization framework you are using on
your entity T will be ignored. The only annotation-based configuration
that will be used is the one you are defining in this invocation.
@param <T>
the generic type
@param entity
the entity you are going proxy.
@param dtoTemplate
the DTO template passed as an anonymous class.
@param proxyClassName
the name you want to assign to newly generated class
@return a proxy that extends the type of entity, holding the same
instance variables values as entity and configured according to
dtoTemplate
@throws HyalineException
if the dynamic type could be created.
"""
try {
return createDTO(entity, dtoTemplate, true, proxyClassName);
} catch (CannotInstantiateProxyException | DTODefinitionException e) {
e.printStackTrace();
throw new HyalineException();
}
} | java | public static <T> T dtoFromScratch(T entity, DTO dtoTemplate, String proxyClassName) throws HyalineException {
try {
return createDTO(entity, dtoTemplate, true, proxyClassName);
} catch (CannotInstantiateProxyException | DTODefinitionException e) {
e.printStackTrace();
throw new HyalineException();
}
} | [
"public",
"static",
"<",
"T",
">",
"T",
"dtoFromScratch",
"(",
"T",
"entity",
",",
"DTO",
"dtoTemplate",
",",
"String",
"proxyClassName",
")",
"throws",
"HyalineException",
"{",
"try",
"{",
"return",
"createDTO",
"(",
"entity",
",",
"dtoTemplate",
",",
"true",
",",
"proxyClassName",
")",
";",
"}",
"catch",
"(",
"CannotInstantiateProxyException",
"|",
"DTODefinitionException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"throw",
"new",
"HyalineException",
"(",
")",
";",
"}",
"}"
] | It lets you create a new DTO from scratch. This means that any annotation
for JAXB, Jackson or whatever serialization framework you are using on
your entity T will be ignored. The only annotation-based configuration
that will be used is the one you are defining in this invocation.
@param <T>
the generic type
@param entity
the entity you are going proxy.
@param dtoTemplate
the DTO template passed as an anonymous class.
@param proxyClassName
the name you want to assign to newly generated class
@return a proxy that extends the type of entity, holding the same
instance variables values as entity and configured according to
dtoTemplate
@throws HyalineException
if the dynamic type could be created. | [
"It",
"lets",
"you",
"create",
"a",
"new",
"DTO",
"from",
"scratch",
".",
"This",
"means",
"that",
"any",
"annotation",
"for",
"JAXB",
"Jackson",
"or",
"whatever",
"serialization",
"framework",
"you",
"are",
"using",
"on",
"your",
"entity",
"T",
"will",
"be",
"ignored",
".",
"The",
"only",
"annotation",
"-",
"based",
"configuration",
"that",
"will",
"be",
"used",
"is",
"the",
"one",
"you",
"are",
"defining",
"in",
"this",
"invocation",
"."
] | train | https://github.com/qzagarese/hyaline-dto/blob/3392de5b7f93cdb3a1c53aa977ee682c141df5f4/hyaline-dto/src/main/java/org/hyalinedto/api/Hyaline.java#L105-L112 |
JM-Lab/utils-java8 | src/main/java/kr/jm/utils/helper/JMResources.java | JMResources.setSystemPropertyIfIsNull | public static void setSystemPropertyIfIsNull(String key, Object value) {
"""
Sets system property if is null.
@param key the key
@param value the value
"""
if (!System.getProperties().containsKey(key))
System.setProperty(key, value.toString());
} | java | public static void setSystemPropertyIfIsNull(String key, Object value) {
if (!System.getProperties().containsKey(key))
System.setProperty(key, value.toString());
} | [
"public",
"static",
"void",
"setSystemPropertyIfIsNull",
"(",
"String",
"key",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"!",
"System",
".",
"getProperties",
"(",
")",
".",
"containsKey",
"(",
"key",
")",
")",
"System",
".",
"setProperty",
"(",
"key",
",",
"value",
".",
"toString",
"(",
")",
")",
";",
"}"
] | Sets system property if is null.
@param key the key
@param value the value | [
"Sets",
"system",
"property",
"if",
"is",
"null",
"."
] | train | https://github.com/JM-Lab/utils-java8/blob/9e407b3f28a7990418a1e877229fa8344f4d78a5/src/main/java/kr/jm/utils/helper/JMResources.java#L31-L34 |
netty/netty | codec-http2/src/main/java/io/netty/handler/codec/http2/Http2ConnectionHandler.java | Http2ConnectionHandler.onError | @Override
public void onError(ChannelHandlerContext ctx, boolean outbound, Throwable cause) {
"""
Central handler for all exceptions caught during HTTP/2 processing.
"""
Http2Exception embedded = getEmbeddedHttp2Exception(cause);
if (isStreamError(embedded)) {
onStreamError(ctx, outbound, cause, (StreamException) embedded);
} else if (embedded instanceof CompositeStreamException) {
CompositeStreamException compositException = (CompositeStreamException) embedded;
for (StreamException streamException : compositException) {
onStreamError(ctx, outbound, cause, streamException);
}
} else {
onConnectionError(ctx, outbound, cause, embedded);
}
ctx.flush();
} | java | @Override
public void onError(ChannelHandlerContext ctx, boolean outbound, Throwable cause) {
Http2Exception embedded = getEmbeddedHttp2Exception(cause);
if (isStreamError(embedded)) {
onStreamError(ctx, outbound, cause, (StreamException) embedded);
} else if (embedded instanceof CompositeStreamException) {
CompositeStreamException compositException = (CompositeStreamException) embedded;
for (StreamException streamException : compositException) {
onStreamError(ctx, outbound, cause, streamException);
}
} else {
onConnectionError(ctx, outbound, cause, embedded);
}
ctx.flush();
} | [
"@",
"Override",
"public",
"void",
"onError",
"(",
"ChannelHandlerContext",
"ctx",
",",
"boolean",
"outbound",
",",
"Throwable",
"cause",
")",
"{",
"Http2Exception",
"embedded",
"=",
"getEmbeddedHttp2Exception",
"(",
"cause",
")",
";",
"if",
"(",
"isStreamError",
"(",
"embedded",
")",
")",
"{",
"onStreamError",
"(",
"ctx",
",",
"outbound",
",",
"cause",
",",
"(",
"StreamException",
")",
"embedded",
")",
";",
"}",
"else",
"if",
"(",
"embedded",
"instanceof",
"CompositeStreamException",
")",
"{",
"CompositeStreamException",
"compositException",
"=",
"(",
"CompositeStreamException",
")",
"embedded",
";",
"for",
"(",
"StreamException",
"streamException",
":",
"compositException",
")",
"{",
"onStreamError",
"(",
"ctx",
",",
"outbound",
",",
"cause",
",",
"streamException",
")",
";",
"}",
"}",
"else",
"{",
"onConnectionError",
"(",
"ctx",
",",
"outbound",
",",
"cause",
",",
"embedded",
")",
";",
"}",
"ctx",
".",
"flush",
"(",
")",
";",
"}"
] | Central handler for all exceptions caught during HTTP/2 processing. | [
"Central",
"handler",
"for",
"all",
"exceptions",
"caught",
"during",
"HTTP",
"/",
"2",
"processing",
"."
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/Http2ConnectionHandler.java#L622-L636 |
netty/netty | codec-mqtt/src/main/java/io/netty/handler/codec/mqtt/MqttDecoder.java | MqttDecoder.decodeVariableHeader | private static Result<?> decodeVariableHeader(ByteBuf buffer, MqttFixedHeader mqttFixedHeader) {
"""
Decodes the variable header (if any)
@param buffer the buffer to decode from
@param mqttFixedHeader MqttFixedHeader of the same message
@return the variable header
"""
switch (mqttFixedHeader.messageType()) {
case CONNECT:
return decodeConnectionVariableHeader(buffer);
case CONNACK:
return decodeConnAckVariableHeader(buffer);
case SUBSCRIBE:
case UNSUBSCRIBE:
case SUBACK:
case UNSUBACK:
case PUBACK:
case PUBREC:
case PUBCOMP:
case PUBREL:
return decodeMessageIdVariableHeader(buffer);
case PUBLISH:
return decodePublishVariableHeader(buffer, mqttFixedHeader);
case PINGREQ:
case PINGRESP:
case DISCONNECT:
// Empty variable header
return new Result<Object>(null, 0);
}
return new Result<Object>(null, 0); //should never reach here
} | java | private static Result<?> decodeVariableHeader(ByteBuf buffer, MqttFixedHeader mqttFixedHeader) {
switch (mqttFixedHeader.messageType()) {
case CONNECT:
return decodeConnectionVariableHeader(buffer);
case CONNACK:
return decodeConnAckVariableHeader(buffer);
case SUBSCRIBE:
case UNSUBSCRIBE:
case SUBACK:
case UNSUBACK:
case PUBACK:
case PUBREC:
case PUBCOMP:
case PUBREL:
return decodeMessageIdVariableHeader(buffer);
case PUBLISH:
return decodePublishVariableHeader(buffer, mqttFixedHeader);
case PINGREQ:
case PINGRESP:
case DISCONNECT:
// Empty variable header
return new Result<Object>(null, 0);
}
return new Result<Object>(null, 0); //should never reach here
} | [
"private",
"static",
"Result",
"<",
"?",
">",
"decodeVariableHeader",
"(",
"ByteBuf",
"buffer",
",",
"MqttFixedHeader",
"mqttFixedHeader",
")",
"{",
"switch",
"(",
"mqttFixedHeader",
".",
"messageType",
"(",
")",
")",
"{",
"case",
"CONNECT",
":",
"return",
"decodeConnectionVariableHeader",
"(",
"buffer",
")",
";",
"case",
"CONNACK",
":",
"return",
"decodeConnAckVariableHeader",
"(",
"buffer",
")",
";",
"case",
"SUBSCRIBE",
":",
"case",
"UNSUBSCRIBE",
":",
"case",
"SUBACK",
":",
"case",
"UNSUBACK",
":",
"case",
"PUBACK",
":",
"case",
"PUBREC",
":",
"case",
"PUBCOMP",
":",
"case",
"PUBREL",
":",
"return",
"decodeMessageIdVariableHeader",
"(",
"buffer",
")",
";",
"case",
"PUBLISH",
":",
"return",
"decodePublishVariableHeader",
"(",
"buffer",
",",
"mqttFixedHeader",
")",
";",
"case",
"PINGREQ",
":",
"case",
"PINGRESP",
":",
"case",
"DISCONNECT",
":",
"// Empty variable header",
"return",
"new",
"Result",
"<",
"Object",
">",
"(",
"null",
",",
"0",
")",
";",
"}",
"return",
"new",
"Result",
"<",
"Object",
">",
"(",
"null",
",",
"0",
")",
";",
"//should never reach here",
"}"
] | Decodes the variable header (if any)
@param buffer the buffer to decode from
@param mqttFixedHeader MqttFixedHeader of the same message
@return the variable header | [
"Decodes",
"the",
"variable",
"header",
"(",
"if",
"any",
")"
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-mqtt/src/main/java/io/netty/handler/codec/mqtt/MqttDecoder.java#L179-L207 |
ixa-ehu/ixa-pipe-tok | src/main/java/eus/ixa/ixa/pipe/tok/Annotate.java | Annotate.tokensToKAF | public static void tokensToKAF(final Reader breader, final KAFDocument kaf)
throws IOException {
"""
Read already tokenized text (one sentence per line) and builds a NAF
document.
@param breader
the reader
@param kaf
the naf document
@throws IOException
if io problems
"""
int noSents = 0;
int noParas = 1;
final List<String> sentences = CharStreams.readLines(breader);
for (final String sentence : sentences) {
noSents = noSents + 1;
final String[] tokens = sentence.split(DELIMITER);
for (final String token : tokens) {
if (token.equals(RuleBasedSegmenter.PARAGRAPH)) {
++noParas;
// TODO sentences without end markers;
// crap rule
while (noParas > noSents) {
++noSents;
}
} else {
// TODO add offset
final WF wf = kaf.newWF(0, token, noSents);
wf.setPara(noParas);
// wf.setSent(noSents);
}
}
}
} | java | public static void tokensToKAF(final Reader breader, final KAFDocument kaf)
throws IOException {
int noSents = 0;
int noParas = 1;
final List<String> sentences = CharStreams.readLines(breader);
for (final String sentence : sentences) {
noSents = noSents + 1;
final String[] tokens = sentence.split(DELIMITER);
for (final String token : tokens) {
if (token.equals(RuleBasedSegmenter.PARAGRAPH)) {
++noParas;
// TODO sentences without end markers;
// crap rule
while (noParas > noSents) {
++noSents;
}
} else {
// TODO add offset
final WF wf = kaf.newWF(0, token, noSents);
wf.setPara(noParas);
// wf.setSent(noSents);
}
}
}
} | [
"public",
"static",
"void",
"tokensToKAF",
"(",
"final",
"Reader",
"breader",
",",
"final",
"KAFDocument",
"kaf",
")",
"throws",
"IOException",
"{",
"int",
"noSents",
"=",
"0",
";",
"int",
"noParas",
"=",
"1",
";",
"final",
"List",
"<",
"String",
">",
"sentences",
"=",
"CharStreams",
".",
"readLines",
"(",
"breader",
")",
";",
"for",
"(",
"final",
"String",
"sentence",
":",
"sentences",
")",
"{",
"noSents",
"=",
"noSents",
"+",
"1",
";",
"final",
"String",
"[",
"]",
"tokens",
"=",
"sentence",
".",
"split",
"(",
"DELIMITER",
")",
";",
"for",
"(",
"final",
"String",
"token",
":",
"tokens",
")",
"{",
"if",
"(",
"token",
".",
"equals",
"(",
"RuleBasedSegmenter",
".",
"PARAGRAPH",
")",
")",
"{",
"++",
"noParas",
";",
"// TODO sentences without end markers;",
"// crap rule",
"while",
"(",
"noParas",
">",
"noSents",
")",
"{",
"++",
"noSents",
";",
"}",
"}",
"else",
"{",
"// TODO add offset",
"final",
"WF",
"wf",
"=",
"kaf",
".",
"newWF",
"(",
"0",
",",
"token",
",",
"noSents",
")",
";",
"wf",
".",
"setPara",
"(",
"noParas",
")",
";",
"// wf.setSent(noSents);",
"}",
"}",
"}",
"}"
] | Read already tokenized text (one sentence per line) and builds a NAF
document.
@param breader
the reader
@param kaf
the naf document
@throws IOException
if io problems | [
"Read",
"already",
"tokenized",
"text",
"(",
"one",
"sentence",
"per",
"line",
")",
"and",
"builds",
"a",
"NAF",
"document",
"."
] | train | https://github.com/ixa-ehu/ixa-pipe-tok/blob/be38651a1267be37764b08acce9ee12a87fb61e7/src/main/java/eus/ixa/ixa/pipe/tok/Annotate.java#L249-L273 |
pippo-java/pippo | pippo-core/src/main/java/ro/pippo/core/route/Route.java | Route.CONNECT | public static Route CONNECT(String uriPattern, RouteHandler routeHandler) {
"""
Create an {@code CONNECT} route.
@param uriPattern
@param routeHandler
@return
"""
return new Route(HttpConstants.Method.CONNECT, uriPattern, routeHandler);
} | java | public static Route CONNECT(String uriPattern, RouteHandler routeHandler) {
return new Route(HttpConstants.Method.CONNECT, uriPattern, routeHandler);
} | [
"public",
"static",
"Route",
"CONNECT",
"(",
"String",
"uriPattern",
",",
"RouteHandler",
"routeHandler",
")",
"{",
"return",
"new",
"Route",
"(",
"HttpConstants",
".",
"Method",
".",
"CONNECT",
",",
"uriPattern",
",",
"routeHandler",
")",
";",
"}"
] | Create an {@code CONNECT} route.
@param uriPattern
@param routeHandler
@return | [
"Create",
"an",
"{",
"@code",
"CONNECT",
"}",
"route",
"."
] | train | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/route/Route.java#L147-L149 |
Azure/azure-sdk-for-java | applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/implementation/APIKeysInner.java | APIKeysInner.getAsync | public Observable<ApplicationInsightsComponentAPIKeyInner> getAsync(String resourceGroupName, String resourceName, String keyId) {
"""
Get the API Key for this key id.
@param resourceGroupName The name of the resource group.
@param resourceName The name of the Application Insights component resource.
@param keyId The API Key ID. This is unique within a Application Insights component.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ApplicationInsightsComponentAPIKeyInner object
"""
return getWithServiceResponseAsync(resourceGroupName, resourceName, keyId).map(new Func1<ServiceResponse<ApplicationInsightsComponentAPIKeyInner>, ApplicationInsightsComponentAPIKeyInner>() {
@Override
public ApplicationInsightsComponentAPIKeyInner call(ServiceResponse<ApplicationInsightsComponentAPIKeyInner> response) {
return response.body();
}
});
} | java | public Observable<ApplicationInsightsComponentAPIKeyInner> getAsync(String resourceGroupName, String resourceName, String keyId) {
return getWithServiceResponseAsync(resourceGroupName, resourceName, keyId).map(new Func1<ServiceResponse<ApplicationInsightsComponentAPIKeyInner>, ApplicationInsightsComponentAPIKeyInner>() {
@Override
public ApplicationInsightsComponentAPIKeyInner call(ServiceResponse<ApplicationInsightsComponentAPIKeyInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ApplicationInsightsComponentAPIKeyInner",
">",
"getAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"resourceName",
",",
"String",
"keyId",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"resourceName",
",",
"keyId",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"ApplicationInsightsComponentAPIKeyInner",
">",
",",
"ApplicationInsightsComponentAPIKeyInner",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"ApplicationInsightsComponentAPIKeyInner",
"call",
"(",
"ServiceResponse",
"<",
"ApplicationInsightsComponentAPIKeyInner",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Get the API Key for this key id.
@param resourceGroupName The name of the resource group.
@param resourceName The name of the Application Insights component resource.
@param keyId The API Key ID. This is unique within a Application Insights component.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ApplicationInsightsComponentAPIKeyInner object | [
"Get",
"the",
"API",
"Key",
"for",
"this",
"key",
"id",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/implementation/APIKeysInner.java#L394-L401 |
apache/incubator-gobblin | gobblin-modules/gobblin-sql/src/main/java/org/apache/gobblin/writer/commands/BaseJdbcBufferedInserter.java | BaseJdbcBufferedInserter.createInsertStatementStr | protected String createInsertStatementStr(String databaseName, String table) {
"""
Populates the placeholders and constructs the prefix of batch insert statement
@param databaseName name of the database
@param table name of the table
@return {@link #INSERT_STATEMENT_PREFIX_FORMAT} with all its resolved placeholders
"""
return String.format(INSERT_STATEMENT_PREFIX_FORMAT, databaseName, table, JOINER_ON_COMMA.join(this.columnNames));
} | java | protected String createInsertStatementStr(String databaseName, String table) {
return String.format(INSERT_STATEMENT_PREFIX_FORMAT, databaseName, table, JOINER_ON_COMMA.join(this.columnNames));
} | [
"protected",
"String",
"createInsertStatementStr",
"(",
"String",
"databaseName",
",",
"String",
"table",
")",
"{",
"return",
"String",
".",
"format",
"(",
"INSERT_STATEMENT_PREFIX_FORMAT",
",",
"databaseName",
",",
"table",
",",
"JOINER_ON_COMMA",
".",
"join",
"(",
"this",
".",
"columnNames",
")",
")",
";",
"}"
] | Populates the placeholders and constructs the prefix of batch insert statement
@param databaseName name of the database
@param table name of the table
@return {@link #INSERT_STATEMENT_PREFIX_FORMAT} with all its resolved placeholders | [
"Populates",
"the",
"placeholders",
"and",
"constructs",
"the",
"prefix",
"of",
"batch",
"insert",
"statement"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-modules/gobblin-sql/src/main/java/org/apache/gobblin/writer/commands/BaseJdbcBufferedInserter.java#L175-L177 |
Labs64/swid-generator | src/main/java/com/labs64/utils/swid/processor/ExtendedSwidProcessor.java | ExtendedSwidProcessor.setReleaseId | public ExtendedSwidProcessor setReleaseId(final String releaseId) {
"""
Defines product release identifier (tag: release_id).
@param releaseId
product release identifier
@return a reference to this object.
"""
swidTag.setReleaseId(new Token(releaseId, idGenerator.nextId()));
return this;
} | java | public ExtendedSwidProcessor setReleaseId(final String releaseId) {
swidTag.setReleaseId(new Token(releaseId, idGenerator.nextId()));
return this;
} | [
"public",
"ExtendedSwidProcessor",
"setReleaseId",
"(",
"final",
"String",
"releaseId",
")",
"{",
"swidTag",
".",
"setReleaseId",
"(",
"new",
"Token",
"(",
"releaseId",
",",
"idGenerator",
".",
"nextId",
"(",
")",
")",
")",
";",
"return",
"this",
";",
"}"
] | Defines product release identifier (tag: release_id).
@param releaseId
product release identifier
@return a reference to this object. | [
"Defines",
"product",
"release",
"identifier",
"(",
"tag",
":",
"release_id",
")",
"."
] | train | https://github.com/Labs64/swid-generator/blob/cf78d2469469a09701bce7c5f966ac6de2b7c613/src/main/java/com/labs64/utils/swid/processor/ExtendedSwidProcessor.java#L176-L179 |
ow2-chameleon/fuchsia | bases/knx/calimero/src/main/java/tuwien/auto/calimero/cemi/CEMILDataEx.java | CEMILDataEx.addAdditionalInfo | public synchronized void addAdditionalInfo(int infoType, byte[] info) {
"""
Adds additional information to the message.
<p>
It replaces additional information of the same type, if any was previously added.
@param infoType type ID of additional information
@param info additional information data
"""
if (infoType < 0 || infoType >= ADDINFO_ESC)
throw new KNXIllegalArgumentException("info type out of range [0..254]");
if (!checkAddInfoLength(infoType, info.length))
throw new KNXIllegalArgumentException("wrong info data length, expected "
+ ADDINFO_LENGTHS[infoType] + " bytes");
putAddInfo(infoType, info);
} | java | public synchronized void addAdditionalInfo(int infoType, byte[] info)
{
if (infoType < 0 || infoType >= ADDINFO_ESC)
throw new KNXIllegalArgumentException("info type out of range [0..254]");
if (!checkAddInfoLength(infoType, info.length))
throw new KNXIllegalArgumentException("wrong info data length, expected "
+ ADDINFO_LENGTHS[infoType] + " bytes");
putAddInfo(infoType, info);
} | [
"public",
"synchronized",
"void",
"addAdditionalInfo",
"(",
"int",
"infoType",
",",
"byte",
"[",
"]",
"info",
")",
"{",
"if",
"(",
"infoType",
"<",
"0",
"||",
"infoType",
">=",
"ADDINFO_ESC",
")",
"throw",
"new",
"KNXIllegalArgumentException",
"(",
"\"info type out of range [0..254]\"",
")",
";",
"if",
"(",
"!",
"checkAddInfoLength",
"(",
"infoType",
",",
"info",
".",
"length",
")",
")",
"throw",
"new",
"KNXIllegalArgumentException",
"(",
"\"wrong info data length, expected \"",
"+",
"ADDINFO_LENGTHS",
"[",
"infoType",
"]",
"+",
"\" bytes\"",
")",
";",
"putAddInfo",
"(",
"infoType",
",",
"info",
")",
";",
"}"
] | Adds additional information to the message.
<p>
It replaces additional information of the same type, if any was previously added.
@param infoType type ID of additional information
@param info additional information data | [
"Adds",
"additional",
"information",
"to",
"the",
"message",
".",
"<p",
">",
"It",
"replaces",
"additional",
"information",
"of",
"the",
"same",
"type",
"if",
"any",
"was",
"previously",
"added",
"."
] | train | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/bases/knx/calimero/src/main/java/tuwien/auto/calimero/cemi/CEMILDataEx.java#L326-L334 |
Azure/azure-sdk-for-java | eventgrid/resource-manager/v2018_05_01_preview/src/main/java/com/microsoft/azure/management/eventgrid/v2018_05_01_preview/implementation/EventSubscriptionsInner.java | EventSubscriptionsInner.listRegionalByResourceGroupForTopicTypeAsync | public Observable<List<EventSubscriptionInner>> listRegionalByResourceGroupForTopicTypeAsync(String resourceGroupName, String location, String topicTypeName) {
"""
List all regional event subscriptions under an Azure subscription and resource group for a topic type.
List all event subscriptions from the given location under a specific Azure subscription and resource group and topic type.
@param resourceGroupName The name of the resource group within the user's subscription.
@param location Name of the location
@param topicTypeName Name of the topic type
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the List<EventSubscriptionInner> object
"""
return listRegionalByResourceGroupForTopicTypeWithServiceResponseAsync(resourceGroupName, location, topicTypeName).map(new Func1<ServiceResponse<List<EventSubscriptionInner>>, List<EventSubscriptionInner>>() {
@Override
public List<EventSubscriptionInner> call(ServiceResponse<List<EventSubscriptionInner>> response) {
return response.body();
}
});
} | java | public Observable<List<EventSubscriptionInner>> listRegionalByResourceGroupForTopicTypeAsync(String resourceGroupName, String location, String topicTypeName) {
return listRegionalByResourceGroupForTopicTypeWithServiceResponseAsync(resourceGroupName, location, topicTypeName).map(new Func1<ServiceResponse<List<EventSubscriptionInner>>, List<EventSubscriptionInner>>() {
@Override
public List<EventSubscriptionInner> call(ServiceResponse<List<EventSubscriptionInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"List",
"<",
"EventSubscriptionInner",
">",
">",
"listRegionalByResourceGroupForTopicTypeAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"location",
",",
"String",
"topicTypeName",
")",
"{",
"return",
"listRegionalByResourceGroupForTopicTypeWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"location",
",",
"topicTypeName",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"List",
"<",
"EventSubscriptionInner",
">",
">",
",",
"List",
"<",
"EventSubscriptionInner",
">",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"List",
"<",
"EventSubscriptionInner",
">",
"call",
"(",
"ServiceResponse",
"<",
"List",
"<",
"EventSubscriptionInner",
">",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | List all regional event subscriptions under an Azure subscription and resource group for a topic type.
List all event subscriptions from the given location under a specific Azure subscription and resource group and topic type.
@param resourceGroupName The name of the resource group within the user's subscription.
@param location Name of the location
@param topicTypeName Name of the topic type
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the List<EventSubscriptionInner> object | [
"List",
"all",
"regional",
"event",
"subscriptions",
"under",
"an",
"Azure",
"subscription",
"and",
"resource",
"group",
"for",
"a",
"topic",
"type",
".",
"List",
"all",
"event",
"subscriptions",
"from",
"the",
"given",
"location",
"under",
"a",
"specific",
"Azure",
"subscription",
"and",
"resource",
"group",
"and",
"topic",
"type",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/eventgrid/resource-manager/v2018_05_01_preview/src/main/java/com/microsoft/azure/management/eventgrid/v2018_05_01_preview/implementation/EventSubscriptionsInner.java#L1492-L1499 |
inkstand-io/scribble | scribble-ldap/src/main/java/io/inkstand/scribble/rules/ldap/Directory.java | Directory.importLdif | public void importLdif(InputStream ldifData) throws IOException {
"""
Imports directory content that is defined in LDIF format and provided as input stream. The method writes the
stream content into a temporary file.
@param ldifData
the ldif data to import as a stream
@throws IOException
if the temporary file can not be created
"""
final File ldifFile = getOuterRule().newFile("scribble_import.ldif");
try (final Writer writer = new OutputStreamWriter(new FileOutputStream(ldifFile), Charsets.UTF_8)) {
IOUtils.copy(ldifData, writer);
}
final String pathToLdifFile = ldifFile.getAbsolutePath();
final CoreSession session = this.getDirectoryService().getAdminSession();
final LdifFileLoader loader = new LdifFileLoader(session, pathToLdifFile);
loader.execute();
} | java | public void importLdif(InputStream ldifData) throws IOException {
final File ldifFile = getOuterRule().newFile("scribble_import.ldif");
try (final Writer writer = new OutputStreamWriter(new FileOutputStream(ldifFile), Charsets.UTF_8)) {
IOUtils.copy(ldifData, writer);
}
final String pathToLdifFile = ldifFile.getAbsolutePath();
final CoreSession session = this.getDirectoryService().getAdminSession();
final LdifFileLoader loader = new LdifFileLoader(session, pathToLdifFile);
loader.execute();
} | [
"public",
"void",
"importLdif",
"(",
"InputStream",
"ldifData",
")",
"throws",
"IOException",
"{",
"final",
"File",
"ldifFile",
"=",
"getOuterRule",
"(",
")",
".",
"newFile",
"(",
"\"scribble_import.ldif\"",
")",
";",
"try",
"(",
"final",
"Writer",
"writer",
"=",
"new",
"OutputStreamWriter",
"(",
"new",
"FileOutputStream",
"(",
"ldifFile",
")",
",",
"Charsets",
".",
"UTF_8",
")",
")",
"{",
"IOUtils",
".",
"copy",
"(",
"ldifData",
",",
"writer",
")",
";",
"}",
"final",
"String",
"pathToLdifFile",
"=",
"ldifFile",
".",
"getAbsolutePath",
"(",
")",
";",
"final",
"CoreSession",
"session",
"=",
"this",
".",
"getDirectoryService",
"(",
")",
".",
"getAdminSession",
"(",
")",
";",
"final",
"LdifFileLoader",
"loader",
"=",
"new",
"LdifFileLoader",
"(",
"session",
",",
"pathToLdifFile",
")",
";",
"loader",
".",
"execute",
"(",
")",
";",
"}"
] | Imports directory content that is defined in LDIF format and provided as input stream. The method writes the
stream content into a temporary file.
@param ldifData
the ldif data to import as a stream
@throws IOException
if the temporary file can not be created | [
"Imports",
"directory",
"content",
"that",
"is",
"defined",
"in",
"LDIF",
"format",
"and",
"provided",
"as",
"input",
"stream",
".",
"The",
"method",
"writes",
"the",
"stream",
"content",
"into",
"a",
"temporary",
"file",
"."
] | train | https://github.com/inkstand-io/scribble/blob/66e67553bad4b1ff817e1715fd1d3dd833406744/scribble-ldap/src/main/java/io/inkstand/scribble/rules/ldap/Directory.java#L324-L336 |
vanilladb/vanillacore | src/main/java/org/vanilladb/core/query/algebra/multibuffer/MultiBufferProductPlan.java | MultiBufferProductPlan.blocksAccessed | @Override
public long blocksAccessed() {
"""
Returns an estimate of the number of block accesses required to execute
the query. The formula is:
<pre>
B(product(p1, p2)) = B(p2) + B(p1) * C(p2)
</pre>
where C(p2) is the number of chunks of p2. The method uses the current
number of available buffers to calculate C(p2), and so this value may
differ when the query scan is opened.
@see Plan#blocksAccessed()
"""
// this guesses at the # of chunks
int avail = tx.bufferMgr().available();
long size = new MaterializePlan(rhs, tx).blocksAccessed();
long numchunks = size / avail;
return rhs.blocksAccessed() + (lhs.blocksAccessed() * numchunks);
} | java | @Override
public long blocksAccessed() {
// this guesses at the # of chunks
int avail = tx.bufferMgr().available();
long size = new MaterializePlan(rhs, tx).blocksAccessed();
long numchunks = size / avail;
return rhs.blocksAccessed() + (lhs.blocksAccessed() * numchunks);
} | [
"@",
"Override",
"public",
"long",
"blocksAccessed",
"(",
")",
"{",
"// this guesses at the # of chunks\r",
"int",
"avail",
"=",
"tx",
".",
"bufferMgr",
"(",
")",
".",
"available",
"(",
")",
";",
"long",
"size",
"=",
"new",
"MaterializePlan",
"(",
"rhs",
",",
"tx",
")",
".",
"blocksAccessed",
"(",
")",
";",
"long",
"numchunks",
"=",
"size",
"/",
"avail",
";",
"return",
"rhs",
".",
"blocksAccessed",
"(",
")",
"+",
"(",
"lhs",
".",
"blocksAccessed",
"(",
")",
"*",
"numchunks",
")",
";",
"}"
] | Returns an estimate of the number of block accesses required to execute
the query. The formula is:
<pre>
B(product(p1, p2)) = B(p2) + B(p1) * C(p2)
</pre>
where C(p2) is the number of chunks of p2. The method uses the current
number of available buffers to calculate C(p2), and so this value may
differ when the query scan is opened.
@see Plan#blocksAccessed() | [
"Returns",
"an",
"estimate",
"of",
"the",
"number",
"of",
"block",
"accesses",
"required",
"to",
"execute",
"the",
"query",
".",
"The",
"formula",
"is",
":"
] | train | https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/query/algebra/multibuffer/MultiBufferProductPlan.java#L91-L98 |
Red5/red5-server-common | src/main/java/org/red5/server/net/rtmp/RTMPConnection.java | RTMPConnection.sendSharedObjectMessage | public void sendSharedObjectMessage(String name, int currentVersion, boolean persistent, Set<ISharedObjectEvent> events) {
"""
Send a shared object message.
@param name
shared object name
@param currentVersion
the current version
@param persistent
toggle
@param events
shared object events
"""
// create a new sync message for every client to avoid concurrent access through multiple threads
SharedObjectMessage syncMessage = state.getEncoding() == Encoding.AMF3 ? new FlexSharedObjectMessage(null, name, currentVersion, persistent) : new SharedObjectMessage(null, name, currentVersion, persistent);
syncMessage.addEvents(events);
try {
// get the channel for so updates
Channel channel = getChannel(3);
if (log.isTraceEnabled()) {
log.trace("Send to channel: {}", channel);
}
channel.write(syncMessage);
} catch (Exception e) {
log.warn("Exception sending shared object", e);
}
} | java | public void sendSharedObjectMessage(String name, int currentVersion, boolean persistent, Set<ISharedObjectEvent> events) {
// create a new sync message for every client to avoid concurrent access through multiple threads
SharedObjectMessage syncMessage = state.getEncoding() == Encoding.AMF3 ? new FlexSharedObjectMessage(null, name, currentVersion, persistent) : new SharedObjectMessage(null, name, currentVersion, persistent);
syncMessage.addEvents(events);
try {
// get the channel for so updates
Channel channel = getChannel(3);
if (log.isTraceEnabled()) {
log.trace("Send to channel: {}", channel);
}
channel.write(syncMessage);
} catch (Exception e) {
log.warn("Exception sending shared object", e);
}
} | [
"public",
"void",
"sendSharedObjectMessage",
"(",
"String",
"name",
",",
"int",
"currentVersion",
",",
"boolean",
"persistent",
",",
"Set",
"<",
"ISharedObjectEvent",
">",
"events",
")",
"{",
"// create a new sync message for every client to avoid concurrent access through multiple threads\r",
"SharedObjectMessage",
"syncMessage",
"=",
"state",
".",
"getEncoding",
"(",
")",
"==",
"Encoding",
".",
"AMF3",
"?",
"new",
"FlexSharedObjectMessage",
"(",
"null",
",",
"name",
",",
"currentVersion",
",",
"persistent",
")",
":",
"new",
"SharedObjectMessage",
"(",
"null",
",",
"name",
",",
"currentVersion",
",",
"persistent",
")",
";",
"syncMessage",
".",
"addEvents",
"(",
"events",
")",
";",
"try",
"{",
"// get the channel for so updates\r",
"Channel",
"channel",
"=",
"getChannel",
"(",
"3",
")",
";",
"if",
"(",
"log",
".",
"isTraceEnabled",
"(",
")",
")",
"{",
"log",
".",
"trace",
"(",
"\"Send to channel: {}\"",
",",
"channel",
")",
";",
"}",
"channel",
".",
"write",
"(",
"syncMessage",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"log",
".",
"warn",
"(",
"\"Exception sending shared object\"",
",",
"e",
")",
";",
"}",
"}"
] | Send a shared object message.
@param name
shared object name
@param currentVersion
the current version
@param persistent
toggle
@param events
shared object events | [
"Send",
"a",
"shared",
"object",
"message",
"."
] | train | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/net/rtmp/RTMPConnection.java#L1573-L1587 |
jeremylong/DependencyCheck | utils/src/main/java/org/owasp/dependencycheck/utils/Settings.java | Settings.getTempDirectory | public synchronized File getTempDirectory() throws IOException {
"""
Returns the temporary directory.
@return the temporary directory
@throws java.io.IOException if any.
"""
if (tempDirectory == null) {
final File baseTemp = new File(getString(Settings.KEYS.TEMP_DIRECTORY, System.getProperty("java.io.tmpdir")));
tempDirectory = FileUtils.createTempDirectory(baseTemp);
}
return tempDirectory;
} | java | public synchronized File getTempDirectory() throws IOException {
if (tempDirectory == null) {
final File baseTemp = new File(getString(Settings.KEYS.TEMP_DIRECTORY, System.getProperty("java.io.tmpdir")));
tempDirectory = FileUtils.createTempDirectory(baseTemp);
}
return tempDirectory;
} | [
"public",
"synchronized",
"File",
"getTempDirectory",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"tempDirectory",
"==",
"null",
")",
"{",
"final",
"File",
"baseTemp",
"=",
"new",
"File",
"(",
"getString",
"(",
"Settings",
".",
"KEYS",
".",
"TEMP_DIRECTORY",
",",
"System",
".",
"getProperty",
"(",
"\"java.io.tmpdir\"",
")",
")",
")",
";",
"tempDirectory",
"=",
"FileUtils",
".",
"createTempDirectory",
"(",
"baseTemp",
")",
";",
"}",
"return",
"tempDirectory",
";",
"}"
] | Returns the temporary directory.
@return the temporary directory
@throws java.io.IOException if any. | [
"Returns",
"the",
"temporary",
"directory",
"."
] | train | https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/utils/src/main/java/org/owasp/dependencycheck/utils/Settings.java#L912-L918 |
Azure/azure-sdk-for-java | eventgrid/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/eventgrid/v2019_01_01/implementation/TopicsInner.java | TopicsInner.listEventTypes | public List<EventTypeInner> listEventTypes(String resourceGroupName, String providerNamespace, String resourceTypeName, String resourceName) {
"""
List topic event types.
List event types for a topic.
@param resourceGroupName The name of the resource group within the user's subscription.
@param providerNamespace Namespace of the provider of the topic
@param resourceTypeName Name of the topic type
@param resourceName Name of the topic
@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 List<EventTypeInner> object if successful.
"""
return listEventTypesWithServiceResponseAsync(resourceGroupName, providerNamespace, resourceTypeName, resourceName).toBlocking().single().body();
} | java | public List<EventTypeInner> listEventTypes(String resourceGroupName, String providerNamespace, String resourceTypeName, String resourceName) {
return listEventTypesWithServiceResponseAsync(resourceGroupName, providerNamespace, resourceTypeName, resourceName).toBlocking().single().body();
} | [
"public",
"List",
"<",
"EventTypeInner",
">",
"listEventTypes",
"(",
"String",
"resourceGroupName",
",",
"String",
"providerNamespace",
",",
"String",
"resourceTypeName",
",",
"String",
"resourceName",
")",
"{",
"return",
"listEventTypesWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"providerNamespace",
",",
"resourceTypeName",
",",
"resourceName",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
] | List topic event types.
List event types for a topic.
@param resourceGroupName The name of the resource group within the user's subscription.
@param providerNamespace Namespace of the provider of the topic
@param resourceTypeName Name of the topic type
@param resourceName Name of the topic
@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 List<EventTypeInner> object if successful. | [
"List",
"topic",
"event",
"types",
".",
"List",
"event",
"types",
"for",
"a",
"topic",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/eventgrid/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/eventgrid/v2019_01_01/implementation/TopicsInner.java#L1267-L1269 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.