repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 188 | func_name stringlengths 7 127 | whole_func_string stringlengths 77 3.91k | language stringclasses 1
value | func_code_string stringlengths 77 3.91k | func_code_tokens listlengths 20 745 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 477 | split_name stringclasses 1
value | func_code_url stringlengths 111 288 |
|---|---|---|---|---|---|---|---|---|---|---|
jhy/jsoup | src/main/java/org/jsoup/nodes/Element.java | Element.prependElement | public Element prependElement(String tagName) {
Element child = new Element(Tag.valueOf(tagName, NodeUtils.parser(this).settings()), baseUri());
prependChild(child);
return child;
} | java | public Element prependElement(String tagName) {
Element child = new Element(Tag.valueOf(tagName, NodeUtils.parser(this).settings()), baseUri());
prependChild(child);
return child;
} | [
"public",
"Element",
"prependElement",
"(",
"String",
"tagName",
")",
"{",
"Element",
"child",
"=",
"new",
"Element",
"(",
"Tag",
".",
"valueOf",
"(",
"tagName",
",",
"NodeUtils",
".",
"parser",
"(",
"this",
")",
".",
"settings",
"(",
")",
")",
",",
"b... | Create a new element by tag name, and add it as the first child.
@param tagName the name of the tag (e.g. {@code div}).
@return the new element, to allow you to add content to it, e.g.:
{@code parent.prependElement("h1").attr("id", "header").text("Welcome");} | [
"Create",
"a",
"new",
"element",
"by",
"tag",
"name",
"and",
"add",
"it",
"as",
"the",
"first",
"child",
"."
] | train | https://github.com/jhy/jsoup/blob/68ff8cbe7ad847059737a09c567a501a7f1d251f/src/main/java/org/jsoup/nodes/Element.java#L507-L511 |
unbescape/unbescape | src/main/java/org/unbescape/xml/XmlEscape.java | XmlEscape.escapeXml10Attribute | public static void escapeXml10Attribute(final String text, final Writer writer, final XmlEscapeType type, final XmlEscapeLevel level)
throws IOException {
escapeXml(text, writer, XmlEscapeSymbols.XML10_ATTRIBUTE_SYMBOLS, type, level);
} | java | public static void escapeXml10Attribute(final String text, final Writer writer, final XmlEscapeType type, final XmlEscapeLevel level)
throws IOException {
escapeXml(text, writer, XmlEscapeSymbols.XML10_ATTRIBUTE_SYMBOLS, type, level);
} | [
"public",
"static",
"void",
"escapeXml10Attribute",
"(",
"final",
"String",
"text",
",",
"final",
"Writer",
"writer",
",",
"final",
"XmlEscapeType",
"type",
",",
"final",
"XmlEscapeLevel",
"level",
")",
"throws",
"IOException",
"{",
"escapeXml",
"(",
"text",
","... | <p>
Perform a (configurable) XML 1.0 <strong>escape</strong> operation on a <tt>String</tt> input
meant to be an XML attribute value, writing results to a <tt>Writer</tt>.
</p>
<p>
This method will perform an escape operation according to the specified
{@link org.unbescape.xml.XmlEscapeType} and {@link org.unbescape.xml.XmlEscapeLevel}
argument values.
</p>
<p>
Besides, being an attribute value also <tt>\t</tt>, <tt>\n</tt> and <tt>\r</tt> will
be escaped to avoid white-space normalization from removing line feeds (turning them into white
spaces) during future parsing operations.
</p>
<p>
All other <tt>String</tt>/<tt>Writer</tt>-based <tt>escapeXml10*(...)</tt> methods call this one with preconfigured
<tt>type</tt> and <tt>level</tt> values.
</p>
<p>
This method is <strong>thread-safe</strong>.
</p>
@param text the <tt>String</tt> to be escaped.
@param writer the <tt>java.io.Writer</tt> to which the escaped result will be written. Nothing will
be written at all to this writer if input is <tt>null</tt>.
@param type the type of escape operation to be performed, see {@link org.unbescape.xml.XmlEscapeType}.
@param level the escape level to be applied, see {@link org.unbescape.xml.XmlEscapeLevel}.
@throws IOException if an input/output exception occurs
@since 1.1.5 | [
"<p",
">",
"Perform",
"a",
"(",
"configurable",
")",
"XML",
"1",
".",
"0",
"<strong",
">",
"escape<",
"/",
"strong",
">",
"operation",
"on",
"a",
"<tt",
">",
"String<",
"/",
"tt",
">",
"input",
"meant",
"to",
"be",
"an",
"XML",
"attribute",
"value",
... | train | https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/xml/XmlEscape.java#L1126-L1129 |
DJCordhose/jmte | src/com/floreysoft/jmte/util/Util.java | Util.streamToString | public static String streamToString(InputStream is, String charsetName) {
try {
Reader r = null;
try {
r = new BufferedReader(new InputStreamReader(is, charsetName));
return readerToString(r);
} finally {
if (r != null) {
try {
r.close();
} catch (IOException e) {
}
}
}
} catch (Exception e) {
throw new RuntimeException(e);
}
} | java | public static String streamToString(InputStream is, String charsetName) {
try {
Reader r = null;
try {
r = new BufferedReader(new InputStreamReader(is, charsetName));
return readerToString(r);
} finally {
if (r != null) {
try {
r.close();
} catch (IOException e) {
}
}
}
} catch (Exception e) {
throw new RuntimeException(e);
}
} | [
"public",
"static",
"String",
"streamToString",
"(",
"InputStream",
"is",
",",
"String",
"charsetName",
")",
"{",
"try",
"{",
"Reader",
"r",
"=",
"null",
";",
"try",
"{",
"r",
"=",
"new",
"BufferedReader",
"(",
"new",
"InputStreamReader",
"(",
"is",
",",
... | Transforms a stream into a string.
@param is
the stream to be transformed
@param charsetName
encoding of the file
@return the string containing the content of the stream | [
"Transforms",
"a",
"stream",
"into",
"a",
"string",
"."
] | train | https://github.com/DJCordhose/jmte/blob/7334e6d111cc2198c5cf69ee336584ab9e192fe5/src/com/floreysoft/jmte/util/Util.java#L124-L142 |
fcrepo3/fcrepo | fcrepo-security/fcrepo-security-pdp/src/main/java/org/fcrepo/server/security/xacml/pdp/data/PolicyIndexBase.java | PolicyIndexBase.handleDocument | protected AbstractPolicy handleDocument(Document doc, PolicyFinder policyFinder) throws ParsingException {
// handle the policy, if it's a known type
Element root = doc.getDocumentElement();
String name = root.getTagName();
// see what type of policy this is
if (name.equals("Policy")) {
return Policy.getInstance(root);
} else if (name.equals("PolicySet")) {
return PolicySet.getInstance(root, policyFinder);
} else {
// this isn't a root type that we know how to handle
throw new ParsingException("Unknown root document type: " + name);
}
} | java | protected AbstractPolicy handleDocument(Document doc, PolicyFinder policyFinder) throws ParsingException {
// handle the policy, if it's a known type
Element root = doc.getDocumentElement();
String name = root.getTagName();
// see what type of policy this is
if (name.equals("Policy")) {
return Policy.getInstance(root);
} else if (name.equals("PolicySet")) {
return PolicySet.getInstance(root, policyFinder);
} else {
// this isn't a root type that we know how to handle
throw new ParsingException("Unknown root document type: " + name);
}
} | [
"protected",
"AbstractPolicy",
"handleDocument",
"(",
"Document",
"doc",
",",
"PolicyFinder",
"policyFinder",
")",
"throws",
"ParsingException",
"{",
"// handle the policy, if it's a known type",
"Element",
"root",
"=",
"doc",
".",
"getDocumentElement",
"(",
")",
";",
"... | A private method that handles reading the policy and creates the correct
kind of AbstractPolicy.
Because this makes use of the policyFinder, it cannot be reused between finders.
Consider moving to policyManager, which is not intended to be reused outside
of a policyFinderModule, which is not intended to be reused amongst PolicyFinder instances. | [
"A",
"private",
"method",
"that",
"handles",
"reading",
"the",
"policy",
"and",
"creates",
"the",
"correct",
"kind",
"of",
"AbstractPolicy",
".",
"Because",
"this",
"makes",
"use",
"of",
"the",
"policyFinder",
"it",
"cannot",
"be",
"reused",
"between",
"finder... | train | https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-security/fcrepo-security-pdp/src/main/java/org/fcrepo/server/security/xacml/pdp/data/PolicyIndexBase.java#L271-L285 |
youngmonkeys/ezyfox-sfs2x | src/main/java/com/tvd12/ezyfox/sfs2x/clienthandler/ClientEventHandler.java | ClientEventHandler.invokeExecuteMethod | protected void invokeExecuteMethod(Method method, Object listener, Object userAgent) {
ReflectMethodUtil.invokeExecuteMethod(
method, listener, context, userAgent);
} | java | protected void invokeExecuteMethod(Method method, Object listener, Object userAgent) {
ReflectMethodUtil.invokeExecuteMethod(
method, listener, context, userAgent);
} | [
"protected",
"void",
"invokeExecuteMethod",
"(",
"Method",
"method",
",",
"Object",
"listener",
",",
"Object",
"userAgent",
")",
"{",
"ReflectMethodUtil",
".",
"invokeExecuteMethod",
"(",
"method",
",",
"listener",
",",
"context",
",",
"userAgent",
")",
";",
"}"... | Invoke the execute method
@param method the execute method
@param listener the listener
@param userAgent the user agent object | [
"Invoke",
"the",
"execute",
"method"
] | train | https://github.com/youngmonkeys/ezyfox-sfs2x/blob/7e004033a3b551c3ae970a0c8f45db7b1ec144de/src/main/java/com/tvd12/ezyfox/sfs2x/clienthandler/ClientEventHandler.java#L121-L124 |
OpenLiberty/open-liberty | dev/com.ibm.ws.rest.handler/src/com/ibm/ws/rest/handler/internal/servlet/RESTProxyServlet.java | RESTProxyServlet.getAndSetRESTHandlerContainer | private synchronized void getAndSetRESTHandlerContainer(HttpServletRequest request) throws ServletException {
if (REST_HANDLER_CONTAINER == null) {
//Get the bundle context
HttpSession session = request.getSession();
ServletContext sc = session.getServletContext();
BundleContext ctxt = (BundleContext) sc.getAttribute("osgi-bundlecontext");
ServiceReference<RESTHandlerContainer> ref = ctxt.getServiceReference(RESTHandlerContainer.class);
if (ref == null) {
// Couldn't find service, so throw the error.
throw new ServletException(Tr.formatMessage(tc, "OSGI_SERVICE_ERROR", "RESTHandlerContainer"));
} else {
REST_HANDLER_CONTAINER = ctxt.getService(ref);
}
}
} | java | private synchronized void getAndSetRESTHandlerContainer(HttpServletRequest request) throws ServletException {
if (REST_HANDLER_CONTAINER == null) {
//Get the bundle context
HttpSession session = request.getSession();
ServletContext sc = session.getServletContext();
BundleContext ctxt = (BundleContext) sc.getAttribute("osgi-bundlecontext");
ServiceReference<RESTHandlerContainer> ref = ctxt.getServiceReference(RESTHandlerContainer.class);
if (ref == null) {
// Couldn't find service, so throw the error.
throw new ServletException(Tr.formatMessage(tc, "OSGI_SERVICE_ERROR", "RESTHandlerContainer"));
} else {
REST_HANDLER_CONTAINER = ctxt.getService(ref);
}
}
} | [
"private",
"synchronized",
"void",
"getAndSetRESTHandlerContainer",
"(",
"HttpServletRequest",
"request",
")",
"throws",
"ServletException",
"{",
"if",
"(",
"REST_HANDLER_CONTAINER",
"==",
"null",
")",
"{",
"//Get the bundle context",
"HttpSession",
"session",
"=",
"reque... | Grabs the RESTHandlerContainer from the OSGi service registry and stores
it to {@link #REST_HANDLER_CONTAINER}.
@param request The HttpServletRequest from which we'll get the OSGi BundleContext
@throws ServletException When the RESTHandlerContainer service is unavailable | [
"Grabs",
"the",
"RESTHandlerContainer",
"from",
"the",
"OSGi",
"service",
"registry",
"and",
"stores",
"it",
"to",
"{",
"@link",
"#REST_HANDLER_CONTAINER",
"}",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.rest.handler/src/com/ibm/ws/rest/handler/internal/servlet/RESTProxyServlet.java#L135-L150 |
jbossws/jbossws-cxf | modules/server/src/main/java/org/jboss/wsf/stack/cxf/metadata/MetadataBuilder.java | MetadataBuilder.getTypeNamespace | private static String getTypeNamespace(String packageName)
{
StringBuilder sb = new StringBuilder("http://");
//Generate tokens with '.' as delimiter
StringTokenizer st = new StringTokenizer(packageName, ".");
//Have a LIFO queue for the tokens
Stack<String> stk = new Stack<String>();
while (st != null && st.hasMoreTokens())
{
stk.push(st.nextToken());
}
String next;
while (!stk.isEmpty() && (next = stk.pop()) != null)
{
if (sb.toString().equals("http://") == false)
sb.append('.');
sb.append(next);
}
// trailing slash
sb.append('/');
return sb.toString();
} | java | private static String getTypeNamespace(String packageName)
{
StringBuilder sb = new StringBuilder("http://");
//Generate tokens with '.' as delimiter
StringTokenizer st = new StringTokenizer(packageName, ".");
//Have a LIFO queue for the tokens
Stack<String> stk = new Stack<String>();
while (st != null && st.hasMoreTokens())
{
stk.push(st.nextToken());
}
String next;
while (!stk.isEmpty() && (next = stk.pop()) != null)
{
if (sb.toString().equals("http://") == false)
sb.append('.');
sb.append(next);
}
// trailing slash
sb.append('/');
return sb.toString();
} | [
"private",
"static",
"String",
"getTypeNamespace",
"(",
"String",
"packageName",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
"\"http://\"",
")",
";",
"//Generate tokens with '.' as delimiter",
"StringTokenizer",
"st",
"=",
"new",
"StringTokenizer"... | Extracts the typeNS given the package name
Algorithm is based on the one specified in JAXWS v2.0 spec | [
"Extracts",
"the",
"typeNS",
"given",
"the",
"package",
"name",
"Algorithm",
"is",
"based",
"on",
"the",
"one",
"specified",
"in",
"JAXWS",
"v2",
".",
"0",
"spec"
] | train | https://github.com/jbossws/jbossws-cxf/blob/e1d5df3664cbc2482ebc83cafd355a4d60d12150/modules/server/src/main/java/org/jboss/wsf/stack/cxf/metadata/MetadataBuilder.java#L330-L356 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.common/src/com/ibm/ws/sib/ra/impl/SibRaConnection.java | SibRaConnection.invokeCommand | @Override
public Serializable invokeCommand(String key, String commandName, Serializable commandData)
throws SIConnectionDroppedException, SIConnectionUnavailableException,
SINotAuthorizedException, SIResourceException, SIIncorrectCallException,
SICommandInvocationFailedException {
return _delegateConnection.invokeCommand(key, commandName, commandData);
} | java | @Override
public Serializable invokeCommand(String key, String commandName, Serializable commandData)
throws SIConnectionDroppedException, SIConnectionUnavailableException,
SINotAuthorizedException, SIResourceException, SIIncorrectCallException,
SICommandInvocationFailedException {
return _delegateConnection.invokeCommand(key, commandName, commandData);
} | [
"@",
"Override",
"public",
"Serializable",
"invokeCommand",
"(",
"String",
"key",
",",
"String",
"commandName",
",",
"Serializable",
"commandData",
")",
"throws",
"SIConnectionDroppedException",
",",
"SIConnectionUnavailableException",
",",
"SINotAuthorizedException",
",",
... | Calls invokeCommand on the delegate connection.
@throws SINotAuthorizedException
@throws SICommandInvocationFailedException
@throws SIIncorrectCallException
@throws SIResourceException
@throws SIConnectionUnavailableException
@throws SIConnectionDroppedException
@see com.ibm.wsspi.sib.core.SICoreConnection#invokeCommand(java.lang.String, java.lang.String, java.io.Serializable) | [
"Calls",
"invokeCommand",
"on",
"the",
"delegate",
"connection",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.common/src/com/ibm/ws/sib/ra/impl/SibRaConnection.java#L245-L253 |
GenesysPureEngage/workspace-client-java | src/main/java/com/genesys/internal/workspace/api/EmailApi.java | EmailApi.replyEmail | public ApiSuccessResponse replyEmail(String id, ReplyData replyData) throws ApiException {
ApiResponse<ApiSuccessResponse> resp = replyEmailWithHttpInfo(id, replyData);
return resp.getData();
} | java | public ApiSuccessResponse replyEmail(String id, ReplyData replyData) throws ApiException {
ApiResponse<ApiSuccessResponse> resp = replyEmailWithHttpInfo(id, replyData);
return resp.getData();
} | [
"public",
"ApiSuccessResponse",
"replyEmail",
"(",
"String",
"id",
",",
"ReplyData",
"replyData",
")",
"throws",
"ApiException",
"{",
"ApiResponse",
"<",
"ApiSuccessResponse",
">",
"resp",
"=",
"replyEmailWithHttpInfo",
"(",
"id",
",",
"replyData",
")",
";",
"retu... | reply email
Reply to inbound email interaction specified in the id path parameter
@param id id of interaction to reply (required)
@param replyData Request parameters. (optional)
@return ApiSuccessResponse
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body | [
"reply",
"email",
"Reply",
"to",
"inbound",
"email",
"interaction",
"specified",
"in",
"the",
"id",
"path",
"parameter"
] | train | https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/EmailApi.java#L636-L639 |
moparisthebest/beehive | beehive-netui-tags/src/main/java/org/apache/beehive/netui/databinding/datagrid/api/rendering/DataGridTagModel.java | DataGridTagModel.addResourceOverride | public void addResourceOverride(String key, String value) {
OverridableDataGridResourceProvider overrideResourceProvider = null;
if(!(_resourceProvider instanceof OverridableDataGridResourceProvider)) {
overrideResourceProvider = new OverridableDataGridResourceProvider(_resourceProvider);
_resourceProvider = overrideResourceProvider;
}
else {
assert _resourceProvider instanceof OverridableDataGridResourceProvider;
overrideResourceProvider = (OverridableDataGridResourceProvider)_resourceProvider;
}
overrideResourceProvider.addResourceOverride(key, value);
} | java | public void addResourceOverride(String key, String value) {
OverridableDataGridResourceProvider overrideResourceProvider = null;
if(!(_resourceProvider instanceof OverridableDataGridResourceProvider)) {
overrideResourceProvider = new OverridableDataGridResourceProvider(_resourceProvider);
_resourceProvider = overrideResourceProvider;
}
else {
assert _resourceProvider instanceof OverridableDataGridResourceProvider;
overrideResourceProvider = (OverridableDataGridResourceProvider)_resourceProvider;
}
overrideResourceProvider.addResourceOverride(key, value);
} | [
"public",
"void",
"addResourceOverride",
"(",
"String",
"key",
",",
"String",
"value",
")",
"{",
"OverridableDataGridResourceProvider",
"overrideResourceProvider",
"=",
"null",
";",
"if",
"(",
"!",
"(",
"_resourceProvider",
"instanceof",
"OverridableDataGridResourceProvid... | <p>
This method provides support for overriding the messages available in the {@link DataGridResourceProvider} on a
per-message basis. The key and value parameters here will override (or add) a message available via
the {@link DataGridResourceProvider} without requiring an entire Java properties file or custom
{@link DataGridResourceProvider} implementation.
</p>
@param key the key of the message to override
@param value the new value for the message key | [
"<p",
">",
"This",
"method",
"provides",
"support",
"for",
"overriding",
"the",
"messages",
"available",
"in",
"the",
"{"
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/databinding/datagrid/api/rendering/DataGridTagModel.java#L368-L380 |
burberius/eve-esi | src/main/java/net/troja/eve/esi/api/FleetsApi.java | FleetsApi.putFleetsFleetId | public void putFleetsFleetId(Long fleetId, String datasource, String token, FleetNewSettings fleetNewSettings)
throws ApiException {
putFleetsFleetIdWithHttpInfo(fleetId, datasource, token, fleetNewSettings);
} | java | public void putFleetsFleetId(Long fleetId, String datasource, String token, FleetNewSettings fleetNewSettings)
throws ApiException {
putFleetsFleetIdWithHttpInfo(fleetId, datasource, token, fleetNewSettings);
} | [
"public",
"void",
"putFleetsFleetId",
"(",
"Long",
"fleetId",
",",
"String",
"datasource",
",",
"String",
"token",
",",
"FleetNewSettings",
"fleetNewSettings",
")",
"throws",
"ApiException",
"{",
"putFleetsFleetIdWithHttpInfo",
"(",
"fleetId",
",",
"datasource",
",",
... | Update fleet Update settings about a fleet --- SSO Scope:
esi-fleets.write_fleet.v1
@param fleetId
ID for a fleet (required)
@param datasource
The server name you would like data from (optional, default to
tranquility)
@param token
Access token to use if unable to set a header (optional)
@param fleetNewSettings
(optional)
@throws ApiException
If fail to call the API, e.g. server error or cannot
deserialize the response body | [
"Update",
"fleet",
"Update",
"settings",
"about",
"a",
"fleet",
"---",
"SSO",
"Scope",
":",
"esi",
"-",
"fleets",
".",
"write_fleet",
".",
"v1"
] | train | https://github.com/burberius/eve-esi/blob/24a941c592cfc15f23471ef849b282fbc582ca13/src/main/java/net/troja/eve/esi/api/FleetsApi.java#L1784-L1787 |
fcrepo3/fcrepo | fcrepo-server/src/main/java/org/fcrepo/server/journal/JournalReader.java | JournalReader.readArguments | private void readArguments(XMLEventReader reader, ConsumerJournalEntry cje)
throws XMLStreamException, JournalException {
while (true) {
XMLEvent nextTag = reader.nextTag();
if (isStartTagEvent(nextTag, QNAME_TAG_ARGUMENT)) {
readArgument(nextTag, reader, cje);
} else if (isEndTagEvent(nextTag, QNAME_TAG_JOURNAL_ENTRY)) {
return;
} else {
throw getNotNextMemberOrEndOfGroupException(QNAME_TAG_JOURNAL_ENTRY,
QNAME_TAG_ARGUMENT,
nextTag);
}
}
} | java | private void readArguments(XMLEventReader reader, ConsumerJournalEntry cje)
throws XMLStreamException, JournalException {
while (true) {
XMLEvent nextTag = reader.nextTag();
if (isStartTagEvent(nextTag, QNAME_TAG_ARGUMENT)) {
readArgument(nextTag, reader, cje);
} else if (isEndTagEvent(nextTag, QNAME_TAG_JOURNAL_ENTRY)) {
return;
} else {
throw getNotNextMemberOrEndOfGroupException(QNAME_TAG_JOURNAL_ENTRY,
QNAME_TAG_ARGUMENT,
nextTag);
}
}
} | [
"private",
"void",
"readArguments",
"(",
"XMLEventReader",
"reader",
",",
"ConsumerJournalEntry",
"cje",
")",
"throws",
"XMLStreamException",
",",
"JournalException",
"{",
"while",
"(",
"true",
")",
"{",
"XMLEvent",
"nextTag",
"=",
"reader",
".",
"nextTag",
"(",
... | Read arguments and add them to the event, until we hit the end tag for
the event. | [
"Read",
"arguments",
"and",
"add",
"them",
"to",
"the",
"event",
"until",
"we",
"hit",
"the",
"end",
"tag",
"for",
"the",
"event",
"."
] | train | https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/journal/JournalReader.java#L231-L245 |
pressgang-ccms/PressGangCCMSContentSpec | src/main/java/org/jboss/pressgang/ccms/contentspec/utils/EntityUtilities.java | EntityUtilities.getTranslatedTopicByTopicId | public static TranslatedTopicWrapper getTranslatedTopicByTopicId(final DataProviderFactory providerFactory, final Integer id,
final Integer rev, final String locale) {
return getTranslatedTopicByTopicAndNodeId(providerFactory, id, rev, null, locale);
} | java | public static TranslatedTopicWrapper getTranslatedTopicByTopicId(final DataProviderFactory providerFactory, final Integer id,
final Integer rev, final String locale) {
return getTranslatedTopicByTopicAndNodeId(providerFactory, id, rev, null, locale);
} | [
"public",
"static",
"TranslatedTopicWrapper",
"getTranslatedTopicByTopicId",
"(",
"final",
"DataProviderFactory",
"providerFactory",
",",
"final",
"Integer",
"id",
",",
"final",
"Integer",
"rev",
",",
"final",
"String",
"locale",
")",
"{",
"return",
"getTranslatedTopicB... | Gets a translated topic based on a topic id, revision and locale. | [
"Gets",
"a",
"translated",
"topic",
"based",
"on",
"a",
"topic",
"id",
"revision",
"and",
"locale",
"."
] | train | https://github.com/pressgang-ccms/PressGangCCMSContentSpec/blob/2bc02e2971e4522b47a130fb7ae5a0f5ad377df1/src/main/java/org/jboss/pressgang/ccms/contentspec/utils/EntityUtilities.java#L62-L65 |
Stratio/stratio-cassandra | src/java/org/apache/cassandra/hadoop/ConfigHelper.java | ConfigHelper.setOutputKeyspace | public static void setOutputKeyspace(Configuration conf, String keyspace)
{
if (keyspace == null)
throw new UnsupportedOperationException("keyspace may not be null");
conf.set(OUTPUT_KEYSPACE_CONFIG, keyspace);
} | java | public static void setOutputKeyspace(Configuration conf, String keyspace)
{
if (keyspace == null)
throw new UnsupportedOperationException("keyspace may not be null");
conf.set(OUTPUT_KEYSPACE_CONFIG, keyspace);
} | [
"public",
"static",
"void",
"setOutputKeyspace",
"(",
"Configuration",
"conf",
",",
"String",
"keyspace",
")",
"{",
"if",
"(",
"keyspace",
"==",
"null",
")",
"throw",
"new",
"UnsupportedOperationException",
"(",
"\"keyspace may not be null\"",
")",
";",
"conf",
".... | Set the keyspace for the output of this job.
@param conf Job configuration you are about to run
@param keyspace | [
"Set",
"the",
"keyspace",
"for",
"the",
"output",
"of",
"this",
"job",
"."
] | train | https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/hadoop/ConfigHelper.java#L114-L120 |
JodaOrg/joda-time | src/main/java/org/joda/time/Hours.java | Hours.hoursBetween | public static Hours hoursBetween(ReadablePartial start, ReadablePartial end) {
if (start instanceof LocalTime && end instanceof LocalTime) {
Chronology chrono = DateTimeUtils.getChronology(start.getChronology());
int hours = chrono.hours().getDifference(
((LocalTime) end).getLocalMillis(), ((LocalTime) start).getLocalMillis());
return Hours.hours(hours);
}
int amount = BaseSingleFieldPeriod.between(start, end, ZERO);
return Hours.hours(amount);
} | java | public static Hours hoursBetween(ReadablePartial start, ReadablePartial end) {
if (start instanceof LocalTime && end instanceof LocalTime) {
Chronology chrono = DateTimeUtils.getChronology(start.getChronology());
int hours = chrono.hours().getDifference(
((LocalTime) end).getLocalMillis(), ((LocalTime) start).getLocalMillis());
return Hours.hours(hours);
}
int amount = BaseSingleFieldPeriod.between(start, end, ZERO);
return Hours.hours(amount);
} | [
"public",
"static",
"Hours",
"hoursBetween",
"(",
"ReadablePartial",
"start",
",",
"ReadablePartial",
"end",
")",
"{",
"if",
"(",
"start",
"instanceof",
"LocalTime",
"&&",
"end",
"instanceof",
"LocalTime",
")",
"{",
"Chronology",
"chrono",
"=",
"DateTimeUtils",
... | Creates a <code>Hours</code> representing the number of whole hours
between the two specified partial datetimes.
<p>
The two partials must contain the same fields, for example you can specify
two <code>LocalTime</code> objects.
@param start the start partial date, must not be null
@param end the end partial date, must not be null
@return the period in hours
@throws IllegalArgumentException if the partials are null or invalid | [
"Creates",
"a",
"<code",
">",
"Hours<",
"/",
"code",
">",
"representing",
"the",
"number",
"of",
"whole",
"hours",
"between",
"the",
"two",
"specified",
"partial",
"datetimes",
".",
"<p",
">",
"The",
"two",
"partials",
"must",
"contain",
"the",
"same",
"fi... | train | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/Hours.java#L137-L146 |
camunda/camunda-xml-model | src/main/java/org/camunda/bpm/model/xml/impl/util/DomUtil.java | DomUtil.filterNodeListByType | public static List<DomElement> filterNodeListByType(NodeList nodeList, ModelInstanceImpl modelInstance, Class<?> type) {
return filterNodeList(nodeList, new ElementByTypeListFilter(type, modelInstance));
} | java | public static List<DomElement> filterNodeListByType(NodeList nodeList, ModelInstanceImpl modelInstance, Class<?> type) {
return filterNodeList(nodeList, new ElementByTypeListFilter(type, modelInstance));
} | [
"public",
"static",
"List",
"<",
"DomElement",
">",
"filterNodeListByType",
"(",
"NodeList",
"nodeList",
",",
"ModelInstanceImpl",
"modelInstance",
",",
"Class",
"<",
"?",
">",
"type",
")",
"{",
"return",
"filterNodeList",
"(",
"nodeList",
",",
"new",
"ElementBy... | Filter a {@link NodeList} retaining all elements with a specific type
@param nodeList the {@link NodeList} to filter
@param modelInstance the model instance
@param type the type class to filter for
@return the list of all Elements which match the filter | [
"Filter",
"a",
"{",
"@link",
"NodeList",
"}",
"retaining",
"all",
"elements",
"with",
"a",
"specific",
"type"
] | train | https://github.com/camunda/camunda-xml-model/blob/85b3f879e26d063f71c94cfd21ac17d9ff6baf4d/src/main/java/org/camunda/bpm/model/xml/impl/util/DomUtil.java#L183-L185 |
sonyxperiadev/gerrit-events | src/main/java/com/sonymobile/tools/gerrit/gerritevents/ssh/SshConnectionFactory.java | SshConnectionFactory.getConnection | public static SshConnection getConnection(String host, int port,
Authentication authentication) throws IOException {
return getConnection(host, port, GerritDefaultValues.DEFAULT_GERRIT_PROXY, authentication);
} | java | public static SshConnection getConnection(String host, int port,
Authentication authentication) throws IOException {
return getConnection(host, port, GerritDefaultValues.DEFAULT_GERRIT_PROXY, authentication);
} | [
"public",
"static",
"SshConnection",
"getConnection",
"(",
"String",
"host",
",",
"int",
"port",
",",
"Authentication",
"authentication",
")",
"throws",
"IOException",
"{",
"return",
"getConnection",
"(",
"host",
",",
"port",
",",
"GerritDefaultValues",
".",
"DEFA... | Creates a {@link SshConnection}.
@param host the host name
@param port the port
@param authentication the credentials
@return a new connection.
@throws IOException if so.
@see SshConnection
@see SshConnectionImpl | [
"Creates",
"a",
"{",
"@link",
"SshConnection",
"}",
"."
] | train | https://github.com/sonyxperiadev/gerrit-events/blob/9a443d13dded85cc4709136ac33989f2bbb34fe2/src/main/java/com/sonymobile/tools/gerrit/gerritevents/ssh/SshConnectionFactory.java#L57-L60 |
mbenson/therian | core/src/main/java/therian/operator/copy/Copier.java | Copier.supports | @Override
public boolean supports(TherianContext context, Copy<? extends SOURCE, ? extends TARGET> copy) {
if (context.eval(ImmutableCheck.of(copy.getTargetPosition())).booleanValue() && isRejectImmutable()) {
return false;
}
return TypeUtils.isAssignable(copy.getSourceType().getType(), getSourceBound())
&& TypeUtils.isAssignable(copy.getTargetType().getType(), getTargetBound());
} | java | @Override
public boolean supports(TherianContext context, Copy<? extends SOURCE, ? extends TARGET> copy) {
if (context.eval(ImmutableCheck.of(copy.getTargetPosition())).booleanValue() && isRejectImmutable()) {
return false;
}
return TypeUtils.isAssignable(copy.getSourceType().getType(), getSourceBound())
&& TypeUtils.isAssignable(copy.getTargetType().getType(), getTargetBound());
} | [
"@",
"Override",
"public",
"boolean",
"supports",
"(",
"TherianContext",
"context",
",",
"Copy",
"<",
"?",
"extends",
"SOURCE",
",",
"?",
"extends",
"TARGET",
">",
"copy",
")",
"{",
"if",
"(",
"context",
".",
"eval",
"(",
"ImmutableCheck",
".",
"of",
"("... | By default, rejects immutable target positions, and ensures that type parameters are compatible.
@param copy operation
@see ImmutableCheck | [
"By",
"default",
"rejects",
"immutable",
"target",
"positions",
"and",
"ensures",
"that",
"type",
"parameters",
"are",
"compatible",
"."
] | train | https://github.com/mbenson/therian/blob/0653505f73e2a6f5b0abc394ea6d83af03408254/core/src/main/java/therian/operator/copy/Copier.java#L69-L76 |
VoltDB/voltdb | src/hsqldb19b3/org/hsqldb_voltpatches/TriggerDef.java | TriggerDef.pushPair | synchronized void pushPair(Session session, Object[] row1, Object[] row2) {
if (maxRowsQueued == 0) {
trigger.fire(triggerType, name.name, table.getName().name, row1,
row2);
return;
}
if (rowsQueued >= maxRowsQueued) {
if (nowait) {
pendingQueue.removeLast(); // overwrite last
} else {
try {
wait();
} catch (InterruptedException e) {
/* ignore and resume */
}
rowsQueued++;
}
} else {
rowsQueued++;
}
pendingQueue.add(new TriggerData(session, row1, row2));
notify(); // notify pop's wait
} | java | synchronized void pushPair(Session session, Object[] row1, Object[] row2) {
if (maxRowsQueued == 0) {
trigger.fire(triggerType, name.name, table.getName().name, row1,
row2);
return;
}
if (rowsQueued >= maxRowsQueued) {
if (nowait) {
pendingQueue.removeLast(); // overwrite last
} else {
try {
wait();
} catch (InterruptedException e) {
/* ignore and resume */
}
rowsQueued++;
}
} else {
rowsQueued++;
}
pendingQueue.add(new TriggerData(session, row1, row2));
notify(); // notify pop's wait
} | [
"synchronized",
"void",
"pushPair",
"(",
"Session",
"session",
",",
"Object",
"[",
"]",
"row1",
",",
"Object",
"[",
"]",
"row2",
")",
"{",
"if",
"(",
"maxRowsQueued",
"==",
"0",
")",
"{",
"trigger",
".",
"fire",
"(",
"triggerType",
",",
"name",
".",
... | The main thread tells the trigger thread to fire by this call.
If this Trigger is not threaded then the fire method is caled
immediately and executed by the main thread. Otherwise, the row
data objects are added to the queue to be used by the Trigger thread.
@param row1
@param row2 | [
"The",
"main",
"thread",
"tells",
"the",
"trigger",
"thread",
"to",
"fire",
"by",
"this",
"call",
".",
"If",
"this",
"Trigger",
"is",
"not",
"threaded",
"then",
"the",
"fire",
"method",
"is",
"caled",
"immediately",
"and",
"executed",
"by",
"the",
"main",
... | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/TriggerDef.java#L445-L473 |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/remote/ResponseAttachmentInputStreamSupport.java | ResponseAttachmentInputStreamSupport.registerStreams | synchronized void registerStreams(int operationId, List<OperationResponse.StreamEntry> streams) {
// ^^^ synchronize on 'this' to avoid races with shutdown
if (!stopped) {
// Streams share a timestamp so activity on any is sufficient to keep the rest alive
AtomicLong timestamp = new AtomicLong(System.currentTimeMillis());
for (int i = 0; i < streams.size(); i++) {
OperationResponse.StreamEntry stream = streams.get(i);
InputStreamKey key = new InputStreamKey(operationId, i);
streamMap.put(key, new TimedStreamEntry(stream, timestamp));
}
} else {
// Just close the streams, as no caller ever will
for (int i = 0; i < streams.size(); i++) {
closeStreamEntry(streams.get(i), operationId, i);
}
}
} | java | synchronized void registerStreams(int operationId, List<OperationResponse.StreamEntry> streams) {
// ^^^ synchronize on 'this' to avoid races with shutdown
if (!stopped) {
// Streams share a timestamp so activity on any is sufficient to keep the rest alive
AtomicLong timestamp = new AtomicLong(System.currentTimeMillis());
for (int i = 0; i < streams.size(); i++) {
OperationResponse.StreamEntry stream = streams.get(i);
InputStreamKey key = new InputStreamKey(operationId, i);
streamMap.put(key, new TimedStreamEntry(stream, timestamp));
}
} else {
// Just close the streams, as no caller ever will
for (int i = 0; i < streams.size(); i++) {
closeStreamEntry(streams.get(i), operationId, i);
}
}
} | [
"synchronized",
"void",
"registerStreams",
"(",
"int",
"operationId",
",",
"List",
"<",
"OperationResponse",
".",
"StreamEntry",
">",
"streams",
")",
"{",
"// ^^^ synchronize on 'this' to avoid races with shutdown",
"if",
"(",
"!",
"stopped",
")",
"{",
"// Streams share... | Registers a set of streams that were associated with a particular request. Does nothing if {@link #shutdown()}
has been invoked, in which case any use of the {@link #getReadHandler() read handler} will result in behavior
equivalent to what would be seen if the the registered stream had 0 bytes of content.
@param operationId id of the request
@param streams the streams. Cannot be {@code null} but may be empty | [
"Registers",
"a",
"set",
"of",
"streams",
"that",
"were",
"associated",
"with",
"a",
"particular",
"request",
".",
"Does",
"nothing",
"if",
"{",
"@link",
"#shutdown",
"()",
"}",
"has",
"been",
"invoked",
"in",
"which",
"case",
"any",
"use",
"of",
"the",
... | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/remote/ResponseAttachmentInputStreamSupport.java#L134-L151 |
google/closure-compiler | src/com/google/javascript/jscomp/AbstractCommandLineRunner.java | AbstractCommandLineRunner.expandCommandLinePath | @GwtIncompatible("Unnecessary")
private String expandCommandLinePath(String path, JSModule forModule) {
String sub;
if (forModule != null) {
sub = config.moduleOutputPathPrefix + forModule.getName() + ".js";
} else if (!config.module.isEmpty()) {
sub = config.moduleOutputPathPrefix;
} else {
sub = config.jsOutputFile;
}
return path.replace("%outname%", sub);
} | java | @GwtIncompatible("Unnecessary")
private String expandCommandLinePath(String path, JSModule forModule) {
String sub;
if (forModule != null) {
sub = config.moduleOutputPathPrefix + forModule.getName() + ".js";
} else if (!config.module.isEmpty()) {
sub = config.moduleOutputPathPrefix;
} else {
sub = config.jsOutputFile;
}
return path.replace("%outname%", sub);
} | [
"@",
"GwtIncompatible",
"(",
"\"Unnecessary\"",
")",
"private",
"String",
"expandCommandLinePath",
"(",
"String",
"path",
",",
"JSModule",
"forModule",
")",
"{",
"String",
"sub",
";",
"if",
"(",
"forModule",
"!=",
"null",
")",
"{",
"sub",
"=",
"config",
".",... | Expand a file path specified on the command-line.
<p>Most file paths on the command-line allow an %outname% placeholder. The placeholder will
expand to a different value depending on the current output mode. There are three scenarios:
<p>1) Single JS output, single extra output: sub in jsOutputPath. 2) Multiple JS output, single
extra output: sub in the base module name. 3) Multiple JS output, multiple extra output: sub in
the module output file.
<p>Passing a JSModule to this function automatically triggers case #3. Otherwise, we'll use
strategy #1 or #2 based on the current output mode. | [
"Expand",
"a",
"file",
"path",
"specified",
"on",
"the",
"command",
"-",
"line",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/AbstractCommandLineRunner.java#L1685-L1696 |
google/j2objc | jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/ext/Attributes2Impl.java | Attributes2Impl.setSpecified | public void setSpecified (int index, boolean value)
{
if (index < 0 || index >= getLength ())
throw new ArrayIndexOutOfBoundsException (
"No attribute at index: " + index);
specified [index] = value;
} | java | public void setSpecified (int index, boolean value)
{
if (index < 0 || index >= getLength ())
throw new ArrayIndexOutOfBoundsException (
"No attribute at index: " + index);
specified [index] = value;
} | [
"public",
"void",
"setSpecified",
"(",
"int",
"index",
",",
"boolean",
"value",
")",
"{",
"if",
"(",
"index",
"<",
"0",
"||",
"index",
">=",
"getLength",
"(",
")",
")",
"throw",
"new",
"ArrayIndexOutOfBoundsException",
"(",
"\"No attribute at index: \"",
"+",
... | Assign a value to the "specified" flag of a specific attribute.
This is the only way this flag can be cleared, except clearing
by initialization with the copy constructor.
@param index The index of the attribute (zero-based).
@param value The desired flag value.
@exception java.lang.ArrayIndexOutOfBoundsException When the
supplied index does not identify an attribute. | [
"Assign",
"a",
"value",
"to",
"the",
"specified",
"flag",
"of",
"a",
"specific",
"attribute",
".",
"This",
"is",
"the",
"only",
"way",
"this",
"flag",
"can",
"be",
"cleared",
"except",
"clearing",
"by",
"initialization",
"with",
"the",
"copy",
"constructor",... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/ext/Attributes2Impl.java#L307-L313 |
JodaOrg/joda-time | src/main/java/org/joda/time/format/DateTimeFormatter.java | DateTimeFormatter.printTo | public void printTo(StringBuilder buf, long instant) {
try {
printTo((Appendable) buf, instant);
} catch (IOException ex) {
// StringBuilder does not throw IOException
}
} | java | public void printTo(StringBuilder buf, long instant) {
try {
printTo((Appendable) buf, instant);
} catch (IOException ex) {
// StringBuilder does not throw IOException
}
} | [
"public",
"void",
"printTo",
"(",
"StringBuilder",
"buf",
",",
"long",
"instant",
")",
"{",
"try",
"{",
"printTo",
"(",
"(",
"Appendable",
")",
"buf",
",",
"instant",
")",
";",
"}",
"catch",
"(",
"IOException",
"ex",
")",
"{",
"// StringBuilder does not th... | Prints an instant from milliseconds since 1970-01-01T00:00:00Z,
using ISO chronology in the default DateTimeZone.
@param buf the destination to format to, not null
@param instant millis since 1970-01-01T00:00:00Z | [
"Prints",
"an",
"instant",
"from",
"milliseconds",
"since",
"1970",
"-",
"01",
"-",
"01T00",
":",
"00",
":",
"00Z",
"using",
"ISO",
"chronology",
"in",
"the",
"default",
"DateTimeZone",
"."
] | train | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/format/DateTimeFormatter.java#L561-L567 |
pryzach/midao | midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/utils/CallableUtils.java | CallableUtils.updateTypes | public static QueryParameters updateTypes(QueryParameters original, QueryParameters source) {
QueryParameters updatedParams = new QueryParameters(original);
Integer position = null;
String originalKey = null;
if (source != null) {
for (String sourceKey : source.keySet()) {
position = source.getFirstPosition(sourceKey);
if (position != null) {
originalKey = original.getNameByPosition(position);
if (updatedParams.containsKey(originalKey) == true) {
updatedParams.updateType(originalKey, source.getType(sourceKey));
}
}
}
}
return updatedParams;
} | java | public static QueryParameters updateTypes(QueryParameters original, QueryParameters source) {
QueryParameters updatedParams = new QueryParameters(original);
Integer position = null;
String originalKey = null;
if (source != null) {
for (String sourceKey : source.keySet()) {
position = source.getFirstPosition(sourceKey);
if (position != null) {
originalKey = original.getNameByPosition(position);
if (updatedParams.containsKey(originalKey) == true) {
updatedParams.updateType(originalKey, source.getType(sourceKey));
}
}
}
}
return updatedParams;
} | [
"public",
"static",
"QueryParameters",
"updateTypes",
"(",
"QueryParameters",
"original",
",",
"QueryParameters",
"source",
")",
"{",
"QueryParameters",
"updatedParams",
"=",
"new",
"QueryParameters",
"(",
"original",
")",
";",
"Integer",
"position",
"=",
"null",
";... | Clones @original and updates it's types - taken from @source.
@param original QueryParameters which would be updated
@param source QueryParameters types of which would be read
@return updated clone on @original with updated types | [
"Clones",
"@original",
"and",
"updates",
"it",
"s",
"types",
"-",
"taken",
"from",
"@source",
"."
] | train | https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/utils/CallableUtils.java#L140-L159 |
i-net-software/jlessc | src/com/inet/lib/less/Rule.java | Rule.ruleset | private void ruleset( String[] sel, CssFormatter formatter ) {
formatter = formatter.startBlock( sel );
appendPropertiesTo( formatter );
for( Formattable prop : properties ) {
if( prop instanceof Mixin ) {
((Mixin)prop).appendSubRules( null, formatter );
}
}
for( Rule rule : subrules ) {
rule.appendTo( formatter );
}
formatter.endBlock();
} | java | private void ruleset( String[] sel, CssFormatter formatter ) {
formatter = formatter.startBlock( sel );
appendPropertiesTo( formatter );
for( Formattable prop : properties ) {
if( prop instanceof Mixin ) {
((Mixin)prop).appendSubRules( null, formatter );
}
}
for( Rule rule : subrules ) {
rule.appendTo( formatter );
}
formatter.endBlock();
} | [
"private",
"void",
"ruleset",
"(",
"String",
"[",
"]",
"sel",
",",
"CssFormatter",
"formatter",
")",
"{",
"formatter",
"=",
"formatter",
".",
"startBlock",
"(",
"sel",
")",
";",
"appendPropertiesTo",
"(",
"formatter",
")",
";",
"for",
"(",
"Formattable",
"... | Directives like @media in the root.
@param sel the selectors
@param formatter current formatter | [
"Directives",
"like",
"@media",
"in",
"the",
"root",
"."
] | train | https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/Rule.java#L276-L290 |
xmlunit/xmlunit | xmlunit-legacy/src/main/java/org/custommonkey/xmlunit/XMLAssert.java | XMLAssert.assertXMLValid | public static void assertXMLValid(String xmlString, String systemId)
throws SAXException, ConfigurationException {
assertXMLValid(new Validator(xmlString, systemId));
} | java | public static void assertXMLValid(String xmlString, String systemId)
throws SAXException, ConfigurationException {
assertXMLValid(new Validator(xmlString, systemId));
} | [
"public",
"static",
"void",
"assertXMLValid",
"(",
"String",
"xmlString",
",",
"String",
"systemId",
")",
"throws",
"SAXException",
",",
"ConfigurationException",
"{",
"assertXMLValid",
"(",
"new",
"Validator",
"(",
"xmlString",
",",
"systemId",
")",
")",
";",
"... | Assert that a String containing XML contains valid XML: the String must
contain a DOCTYPE to be validated, but the validation will use the
systemId to obtain the DTD
@param xmlString
@param systemId
@throws SAXException
@throws ConfigurationException if validation could not be turned on
@see Validator | [
"Assert",
"that",
"a",
"String",
"containing",
"XML",
"contains",
"valid",
"XML",
":",
"the",
"String",
"must",
"contain",
"a",
"DOCTYPE",
"to",
"be",
"validated",
"but",
"the",
"validation",
"will",
"use",
"the",
"systemId",
"to",
"obtain",
"the",
"DTD"
] | train | https://github.com/xmlunit/xmlunit/blob/fe3d701d43f57ee83dcba336e4c1555619d3084b/xmlunit-legacy/src/main/java/org/custommonkey/xmlunit/XMLAssert.java#L1067-L1070 |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/PendingCheckpointStats.java | PendingCheckpointStats.reportSubtaskStats | boolean reportSubtaskStats(JobVertexID jobVertexId, SubtaskStateStats subtask) {
TaskStateStats taskStateStats = taskStats.get(jobVertexId);
if (taskStateStats != null && taskStateStats.reportSubtaskStats(subtask)) {
currentNumAcknowledgedSubtasks++;
latestAcknowledgedSubtask = subtask;
currentStateSize += subtask.getStateSize();
long alignmentBuffered = subtask.getAlignmentBuffered();
if (alignmentBuffered > 0) {
currentAlignmentBuffered += alignmentBuffered;
}
return true;
} else {
return false;
}
} | java | boolean reportSubtaskStats(JobVertexID jobVertexId, SubtaskStateStats subtask) {
TaskStateStats taskStateStats = taskStats.get(jobVertexId);
if (taskStateStats != null && taskStateStats.reportSubtaskStats(subtask)) {
currentNumAcknowledgedSubtasks++;
latestAcknowledgedSubtask = subtask;
currentStateSize += subtask.getStateSize();
long alignmentBuffered = subtask.getAlignmentBuffered();
if (alignmentBuffered > 0) {
currentAlignmentBuffered += alignmentBuffered;
}
return true;
} else {
return false;
}
} | [
"boolean",
"reportSubtaskStats",
"(",
"JobVertexID",
"jobVertexId",
",",
"SubtaskStateStats",
"subtask",
")",
"{",
"TaskStateStats",
"taskStateStats",
"=",
"taskStats",
".",
"get",
"(",
"jobVertexId",
")",
";",
"if",
"(",
"taskStateStats",
"!=",
"null",
"&&",
"tas... | Reports statistics for a single subtask.
@param jobVertexId ID of the task/operator the subtask belongs to.
@param subtask The statistics for the subtask.
@return <code>true</code> if successfully reported or <code>false</code> otherwise. | [
"Reports",
"statistics",
"for",
"a",
"single",
"subtask",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/PendingCheckpointStats.java#L120-L138 |
LearnLib/automatalib | commons/util/src/main/java/net/automatalib/commons/util/lib/LibLoader.java | LibLoader.loadLibrary | public void loadLibrary(Class<?> clazz, String name) {
loadLibrary(clazz, name, LoadPolicy.PREFER_SHIPPED);
} | java | public void loadLibrary(Class<?> clazz, String name) {
loadLibrary(clazz, name, LoadPolicy.PREFER_SHIPPED);
} | [
"public",
"void",
"loadLibrary",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"String",
"name",
")",
"{",
"loadLibrary",
"(",
"clazz",
",",
"name",
",",
"LoadPolicy",
".",
"PREFER_SHIPPED",
")",
";",
"}"
] | Loads a native library. Uses {@link LoadPolicy#PREFER_SHIPPED} as the default loading policy.
@param clazz
The class whose classloader should be used to resolve shipped libraries
@param name
The name of the class. | [
"Loads",
"a",
"native",
"library",
".",
"Uses",
"{",
"@link",
"LoadPolicy#PREFER_SHIPPED",
"}",
"as",
"the",
"default",
"loading",
"policy",
"."
] | train | https://github.com/LearnLib/automatalib/blob/8a462ec52f6eaab9f8996e344f2163a72cb8aa6e/commons/util/src/main/java/net/automatalib/commons/util/lib/LibLoader.java#L91-L93 |
sagiegurari/fax4j | src/main/java/org/fax4j/spi/comm/RXTXCommPortAdapter.java | RXTXCommPortAdapter.getInputStream | public InputStream getInputStream()
{
InputStream stream=null;
try
{
stream=this.commPort.getInputStream();
}
catch(IOException exception)
{
throw new FaxException("Unable to extract input stream.",exception);
}
return stream;
} | java | public InputStream getInputStream()
{
InputStream stream=null;
try
{
stream=this.commPort.getInputStream();
}
catch(IOException exception)
{
throw new FaxException("Unable to extract input stream.",exception);
}
return stream;
} | [
"public",
"InputStream",
"getInputStream",
"(",
")",
"{",
"InputStream",
"stream",
"=",
"null",
";",
"try",
"{",
"stream",
"=",
"this",
".",
"commPort",
".",
"getInputStream",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"exception",
")",
"{",
"throw",... | This function returns the input stream to the COMM port.
@return The input stream | [
"This",
"function",
"returns",
"the",
"input",
"stream",
"to",
"the",
"COMM",
"port",
"."
] | train | https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/spi/comm/RXTXCommPortAdapter.java#L61-L74 |
qzagarese/hyaline-dto | hyaline-dto/src/main/java/org/hyalinedto/api/Hyaline.java | Hyaline.dtoFromClass | public static <T> T dtoFromClass(T entity, DTO dtoTemplate) throws HyalineException {
return dtoFromClass(entity, dtoTemplate, "Hyaline$Proxy$" + System.currentTimeMillis());
} | java | public static <T> T dtoFromClass(T entity, DTO dtoTemplate) throws HyalineException {
return dtoFromClass(entity, dtoTemplate, "Hyaline$Proxy$" + System.currentTimeMillis());
} | [
"public",
"static",
"<",
"T",
">",
"T",
"dtoFromClass",
"(",
"T",
"entity",
",",
"DTO",
"dtoTemplate",
")",
"throws",
"HyalineException",
"{",
"return",
"dtoFromClass",
"(",
"entity",
",",
"dtoTemplate",
",",
"\"Hyaline$Proxy$\"",
"+",
"System",
".",
"currentT... | It lets you create a new DTO starting from the annotation-based
configuration of your entity. This means that any annotation-based
configuration for JAXB, Jackson or whatever serialization framework you
are using on your entity T will be kept. However, if you insert an
annotation on a field that exists also in your class, this annotation
will override the one in your class.
@param <T>
the generic type
@param entity
the entity you are going proxy.
@param dtoTemplate
the DTO template passed as an anonymous 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",
"starting",
"from",
"the",
"annotation",
"-",
"based",
"configuration",
"of",
"your",
"entity",
".",
"This",
"means",
"that",
"any",
"annotation",
"-",
"based",
"configuration",
"for",
"JAXB",
"Jackson",
"or"... | train | https://github.com/qzagarese/hyaline-dto/blob/3392de5b7f93cdb3a1c53aa977ee682c141df5f4/hyaline-dto/src/main/java/org/hyalinedto/api/Hyaline.java#L138-L140 |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/lss/LssClient.java | LssClient.updateStreamWatermark | public void updateStreamWatermark(String domain, String app, String stream, Watermarks watermarks) {
UpdateStreamWatermarkRequest request = new UpdateStreamWatermarkRequest()
.withDomain(domain)
.withApp(app)
.withStream(stream)
.withWatermarks(watermarks);
updateStreamWatermark(request);
} | java | public void updateStreamWatermark(String domain, String app, String stream, Watermarks watermarks) {
UpdateStreamWatermarkRequest request = new UpdateStreamWatermarkRequest()
.withDomain(domain)
.withApp(app)
.withStream(stream)
.withWatermarks(watermarks);
updateStreamWatermark(request);
} | [
"public",
"void",
"updateStreamWatermark",
"(",
"String",
"domain",
",",
"String",
"app",
",",
"String",
"stream",
",",
"Watermarks",
"watermarks",
")",
"{",
"UpdateStreamWatermarkRequest",
"request",
"=",
"new",
"UpdateStreamWatermarkRequest",
"(",
")",
".",
"withD... | Update stream watermark in live stream service
@param domain The requested domain which the specific stream belongs to
@param app The requested app which the specific stream belongs to
@param stream The requested stream which need to update the watermark
@param watermarks object of the new watermark, contains image watermark and timestamp watermark | [
"Update",
"stream",
"watermark",
"in",
"live",
"stream",
"service",
"@param",
"domain",
"The",
"requested",
"domain",
"which",
"the",
"specific",
"stream",
"belongs",
"to",
"@param",
"app",
"The",
"requested",
"app",
"which",
"the",
"specific",
"stream",
"belong... | train | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/lss/LssClient.java#L1699-L1706 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java | KeyVaultClientBaseImpl.importKeyAsync | public Observable<KeyBundle> importKeyAsync(String vaultBaseUrl, String keyName, JsonWebKey key) {
return importKeyWithServiceResponseAsync(vaultBaseUrl, keyName, key).map(new Func1<ServiceResponse<KeyBundle>, KeyBundle>() {
@Override
public KeyBundle call(ServiceResponse<KeyBundle> response) {
return response.body();
}
});
} | java | public Observable<KeyBundle> importKeyAsync(String vaultBaseUrl, String keyName, JsonWebKey key) {
return importKeyWithServiceResponseAsync(vaultBaseUrl, keyName, key).map(new Func1<ServiceResponse<KeyBundle>, KeyBundle>() {
@Override
public KeyBundle call(ServiceResponse<KeyBundle> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"KeyBundle",
">",
"importKeyAsync",
"(",
"String",
"vaultBaseUrl",
",",
"String",
"keyName",
",",
"JsonWebKey",
"key",
")",
"{",
"return",
"importKeyWithServiceResponseAsync",
"(",
"vaultBaseUrl",
",",
"keyName",
",",
"key",
")",
".",
... | Imports an externally created key, stores it, and returns key parameters and attributes to the client.
The import key operation may be used to import any key type into an Azure Key Vault. If the named key already exists, Azure Key Vault creates a new version of the key. This operation requires the keys/import permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param keyName Name for the imported key.
@param key The Json web key
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the KeyBundle object | [
"Imports",
"an",
"externally",
"created",
"key",
"stores",
"it",
"and",
"returns",
"key",
"parameters",
"and",
"attributes",
"to",
"the",
"client",
".",
"The",
"import",
"key",
"operation",
"may",
"be",
"used",
"to",
"import",
"any",
"key",
"type",
"into",
... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L905-L912 |
hibernate/hibernate-ogm | core/src/main/java/org/hibernate/ogm/util/impl/ReflectionHelper.java | ReflectionHelper.setField | public static void setField(Object object, String field, Object value) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
Class<?> clazz = object.getClass();
Method m = clazz.getMethod( PROPERTY_ACCESSOR_PREFIX_SET + capitalize( field ), value.getClass() );
m.invoke( object, value );
} | java | public static void setField(Object object, String field, Object value) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
Class<?> clazz = object.getClass();
Method m = clazz.getMethod( PROPERTY_ACCESSOR_PREFIX_SET + capitalize( field ), value.getClass() );
m.invoke( object, value );
} | [
"public",
"static",
"void",
"setField",
"(",
"Object",
"object",
",",
"String",
"field",
",",
"Object",
"value",
")",
"throws",
"NoSuchMethodException",
",",
"InvocationTargetException",
",",
"IllegalAccessException",
"{",
"Class",
"<",
"?",
">",
"clazz",
"=",
"... | Set value for given object field.
@param object object to be updated
@param field field name
@param value field value
@throws NoSuchMethodException if property writer is not available
@throws InvocationTargetException if property writer throws an exception
@throws IllegalAccessException if property writer is inaccessible | [
"Set",
"value",
"for",
"given",
"object",
"field",
"."
] | train | https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/core/src/main/java/org/hibernate/ogm/util/impl/ReflectionHelper.java#L127-L131 |
johnkil/Android-AppMsg | library/src/com/devspark/appmsg/AppMsg.java | AppMsg.makeText | public static AppMsg makeText(Activity context, CharSequence text, Style style, View customView) {
return makeText(context, text, style, customView, false);
} | java | public static AppMsg makeText(Activity context, CharSequence text, Style style, View customView) {
return makeText(context, text, style, customView, false);
} | [
"public",
"static",
"AppMsg",
"makeText",
"(",
"Activity",
"context",
",",
"CharSequence",
"text",
",",
"Style",
"style",
",",
"View",
"customView",
")",
"{",
"return",
"makeText",
"(",
"context",
",",
"text",
",",
"style",
",",
"customView",
",",
"false",
... | Make a non-floating {@link AppMsg} with a custom view presented inside the layout.
It can be used to create non-floating notifications if floating is false.
@param context The context to use. Usually your
{@link android.app.Activity} object.
@param customView
View to be used.
@param text The text to show. Can be formatted text.
@param style The style with a background and a duration. | [
"Make",
"a",
"non",
"-",
"floating",
"{",
"@link",
"AppMsg",
"}",
"with",
"a",
"custom",
"view",
"presented",
"inside",
"the",
"layout",
".",
"It",
"can",
"be",
"used",
"to",
"create",
"non",
"-",
"floating",
"notifications",
"if",
"floating",
"is",
"fal... | train | https://github.com/johnkil/Android-AppMsg/blob/e7fdd7870530a24e6d825278ee0863be0521e8b8/library/src/com/devspark/appmsg/AppMsg.java#L259-L261 |
khennig/lazy-datacontroller | lazy-datacontroller-impl/src/main/java/com/tri/ui/model/utility/BeanProperty.java | BeanProperty.clearBeanProperty | public static void clearBeanProperty(final Object bean, final String name) {
Validate.notNull(bean, "Bean required");
Validate.notEmpty(name, "Not empty property name required");
final String methodName = new StringBuilder("set")
.append(name.substring(0, 1).toUpperCase())
.append(name.substring(1)).toString();
for (Method method : bean.getClass().getMethods()) {
if (method.getName().equals(methodName)) {
try {
method.invoke(bean, (Object) null);
return;
} catch (Exception exc) {
throw new RuntimeException("Failed to clear property: "
+ name);
}
}
}
throw new RuntimeException("Setter of property not found: " + name);
} | java | public static void clearBeanProperty(final Object bean, final String name) {
Validate.notNull(bean, "Bean required");
Validate.notEmpty(name, "Not empty property name required");
final String methodName = new StringBuilder("set")
.append(name.substring(0, 1).toUpperCase())
.append(name.substring(1)).toString();
for (Method method : bean.getClass().getMethods()) {
if (method.getName().equals(methodName)) {
try {
method.invoke(bean, (Object) null);
return;
} catch (Exception exc) {
throw new RuntimeException("Failed to clear property: "
+ name);
}
}
}
throw new RuntimeException("Setter of property not found: " + name);
} | [
"public",
"static",
"void",
"clearBeanProperty",
"(",
"final",
"Object",
"bean",
",",
"final",
"String",
"name",
")",
"{",
"Validate",
".",
"notNull",
"(",
"bean",
",",
"\"Bean required\"",
")",
";",
"Validate",
".",
"notEmpty",
"(",
"name",
",",
"\"Not empt... | Clears a property on a given bean, i.e. sets it {@code null}.
@param bean
@param name
@throws NullPointerException
if bean and/or name are null | [
"Clears",
"a",
"property",
"on",
"a",
"given",
"bean",
"i",
".",
"e",
".",
"sets",
"it",
"{",
"@code",
"null",
"}",
"."
] | train | https://github.com/khennig/lazy-datacontroller/blob/a72a5fc6ced43d0e06fc839d68bd58cede10ab56/lazy-datacontroller-impl/src/main/java/com/tri/ui/model/utility/BeanProperty.java#L43-L62 |
phoenixnap/springmvc-raml-plugin | src/main/java/com/phoenixnap/oss/ramlplugin/raml2code/helpers/CodeModelHelper.java | CodeModelHelper.findFirstClassBySimpleName | public static JClass findFirstClassBySimpleName(JCodeModel codeModel, String simpleClassName) {
return findFirstClassBySimpleName(codeModel == null ? new JCodeModel[] { new JCodeModel() } : new JCodeModel[] { codeModel },
simpleClassName);
} | java | public static JClass findFirstClassBySimpleName(JCodeModel codeModel, String simpleClassName) {
return findFirstClassBySimpleName(codeModel == null ? new JCodeModel[] { new JCodeModel() } : new JCodeModel[] { codeModel },
simpleClassName);
} | [
"public",
"static",
"JClass",
"findFirstClassBySimpleName",
"(",
"JCodeModel",
"codeModel",
",",
"String",
"simpleClassName",
")",
"{",
"return",
"findFirstClassBySimpleName",
"(",
"codeModel",
"==",
"null",
"?",
"new",
"JCodeModel",
"[",
"]",
"{",
"new",
"JCodeMode... | Searches inside a JCodeModel for a class with a specified name ignoring
package
@param codeModel[]
The codemodels which we will look inside
@param simpleClassName
The class name to search for
@return the first class in any package that matches the simple class
name. | [
"Searches",
"inside",
"a",
"JCodeModel",
"for",
"a",
"class",
"with",
"a",
"specified",
"name",
"ignoring",
"package"
] | train | https://github.com/phoenixnap/springmvc-raml-plugin/blob/6387072317cd771eb7d6f30943f556ac20dd3c84/src/main/java/com/phoenixnap/oss/ramlplugin/raml2code/helpers/CodeModelHelper.java#L66-L69 |
microfocus-idol/java-configuration-impl | src/main/java/com/hp/autonomy/frontend/configuration/ConfigurationUtils.java | ConfigurationUtils.defaultMerge | public static <F extends ConfigurationComponent<F>> F defaultMerge(final F local, final F defaults) {
return mergeConfiguration(local, defaults, () -> defaultMergeInternal(local, defaults));
} | java | public static <F extends ConfigurationComponent<F>> F defaultMerge(final F local, final F defaults) {
return mergeConfiguration(local, defaults, () -> defaultMergeInternal(local, defaults));
} | [
"public",
"static",
"<",
"F",
"extends",
"ConfigurationComponent",
"<",
"F",
">",
">",
"F",
"defaultMerge",
"(",
"final",
"F",
"local",
",",
"final",
"F",
"defaults",
")",
"{",
"return",
"mergeConfiguration",
"(",
"local",
",",
"defaults",
",",
"(",
")",
... | Performs skeleton validation, searching for any non-null {@link ConfigurationComponent} fields and calling {@link ConfigurationComponent#basicValidate(String)}
@param local local configuration object
@param defaults default configuration object
@param <F> the configuration object type
@return the merged configuration
@see SimpleComponent for basic usage | [
"Performs",
"skeleton",
"validation",
"searching",
"for",
"any",
"non",
"-",
"null",
"{",
"@link",
"ConfigurationComponent",
"}",
"fields",
"and",
"calling",
"{",
"@link",
"ConfigurationComponent#basicValidate",
"(",
"String",
")",
"}"
] | train | https://github.com/microfocus-idol/java-configuration-impl/blob/cd9d744cacfaaae3c76cacc211e65742bbc7b00a/src/main/java/com/hp/autonomy/frontend/configuration/ConfigurationUtils.java#L100-L102 |
optimaize/language-detector | src/main/java/com/optimaize/langdetect/cybozu/CommandLineInterface.java | CommandLineInterface.getParamDouble | private double getParamDouble(String key, double defaultValue) {
String value = values.get(key);
if (value==null || value.isEmpty()) {
return defaultValue;
}
try {
return Double.valueOf(value);
} catch (NumberFormatException e) {
throw new RuntimeException("Invalid double value: >>>"+value+"<<<", e);
}
} | java | private double getParamDouble(String key, double defaultValue) {
String value = values.get(key);
if (value==null || value.isEmpty()) {
return defaultValue;
}
try {
return Double.valueOf(value);
} catch (NumberFormatException e) {
throw new RuntimeException("Invalid double value: >>>"+value+"<<<", e);
}
} | [
"private",
"double",
"getParamDouble",
"(",
"String",
"key",
",",
"double",
"defaultValue",
")",
"{",
"String",
"value",
"=",
"values",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"value",
"==",
"null",
"||",
"value",
".",
"isEmpty",
"(",
")",
")",
... | Returns the double, or the default is absent. Throws if the double is specified but invalid. | [
"Returns",
"the",
"double",
"or",
"the",
"default",
"is",
"absent",
".",
"Throws",
"if",
"the",
"double",
"is",
"specified",
"but",
"invalid",
"."
] | train | https://github.com/optimaize/language-detector/blob/1a322c462f977b29eca8d3142b816b7111d3fa19/src/main/java/com/optimaize/langdetect/cybozu/CommandLineInterface.java#L117-L127 |
threerings/gwt-utils | src/main/java/com/threerings/gwt/ui/Bindings.java | Bindings.bindDown | public static void bindDown (final Value<Boolean> value, final ToggleButton toggle)
{
toggle.addClickHandler(new ClickHandler() {
public void onClick (ClickEvent event) {
value.updateIf(toggle.isDown());
}
});
value.addListenerAndTrigger(new Value.Listener<Boolean>() {
public void valueChanged (Boolean value) {
toggle.setDown(value);
}
});
} | java | public static void bindDown (final Value<Boolean> value, final ToggleButton toggle)
{
toggle.addClickHandler(new ClickHandler() {
public void onClick (ClickEvent event) {
value.updateIf(toggle.isDown());
}
});
value.addListenerAndTrigger(new Value.Listener<Boolean>() {
public void valueChanged (Boolean value) {
toggle.setDown(value);
}
});
} | [
"public",
"static",
"void",
"bindDown",
"(",
"final",
"Value",
"<",
"Boolean",
">",
"value",
",",
"final",
"ToggleButton",
"toggle",
")",
"{",
"toggle",
".",
"addClickHandler",
"(",
"new",
"ClickHandler",
"(",
")",
"{",
"public",
"void",
"onClick",
"(",
"C... | Binds the specified toggle button to the supplied boolean value. The binding will work both
ways: interactive changes to the toggle button will update the value and changes to the
value will update the state of the toggle button. | [
"Binds",
"the",
"specified",
"toggle",
"button",
"to",
"the",
"supplied",
"boolean",
"value",
".",
"The",
"binding",
"will",
"work",
"both",
"ways",
":",
"interactive",
"changes",
"to",
"the",
"toggle",
"button",
"will",
"update",
"the",
"value",
"and",
"cha... | train | https://github.com/threerings/gwt-utils/blob/31b31a23b667f2a9c683160d77646db259f2aae5/src/main/java/com/threerings/gwt/ui/Bindings.java#L123-L135 |
neo4j/neo4j-java-driver | driver/src/main/java/org/neo4j/driver/internal/util/CertificateTool.java | CertificateTool.loadX509Cert | public static void loadX509Cert( Certificate cert, String certAlias, KeyStore keyStore ) throws KeyStoreException
{
keyStore.setCertificateEntry( certAlias, cert );
} | java | public static void loadX509Cert( Certificate cert, String certAlias, KeyStore keyStore ) throws KeyStoreException
{
keyStore.setCertificateEntry( certAlias, cert );
} | [
"public",
"static",
"void",
"loadX509Cert",
"(",
"Certificate",
"cert",
",",
"String",
"certAlias",
",",
"KeyStore",
"keyStore",
")",
"throws",
"KeyStoreException",
"{",
"keyStore",
".",
"setCertificateEntry",
"(",
"certAlias",
",",
"cert",
")",
";",
"}"
] | Load a certificate to a key store with a name
@param certAlias a name to identify different certificates
@param cert
@param keyStore | [
"Load",
"a",
"certificate",
"to",
"a",
"key",
"store",
"with",
"a",
"name"
] | train | https://github.com/neo4j/neo4j-java-driver/blob/8dad6c48251fa1ab7017e72d9998a24fa2337a22/driver/src/main/java/org/neo4j/driver/internal/util/CertificateTool.java#L149-L152 |
Harium/keel | src/main/java/com/harium/keel/catalano/math/distance/Distance.java | Distance.KullbackLeiblerDivergence | public static double KullbackLeiblerDivergence(double[] p, double[] q) {
boolean intersection = false;
double k = 0;
for (int i = 0; i < p.length; i++) {
if (p[i] != 0 && q[i] != 0) {
intersection = true;
k += p[i] * Math.log(p[i] / q[i]);
}
}
if (intersection)
return k;
else
return Double.POSITIVE_INFINITY;
} | java | public static double KullbackLeiblerDivergence(double[] p, double[] q) {
boolean intersection = false;
double k = 0;
for (int i = 0; i < p.length; i++) {
if (p[i] != 0 && q[i] != 0) {
intersection = true;
k += p[i] * Math.log(p[i] / q[i]);
}
}
if (intersection)
return k;
else
return Double.POSITIVE_INFINITY;
} | [
"public",
"static",
"double",
"KullbackLeiblerDivergence",
"(",
"double",
"[",
"]",
"p",
",",
"double",
"[",
"]",
"q",
")",
"{",
"boolean",
"intersection",
"=",
"false",
";",
"double",
"k",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
... | Gets the Kullback Leibler divergence.
@param p P vector.
@param q Q vector.
@return The Kullback Leibler divergence between u and v. | [
"Gets",
"the",
"Kullback",
"Leibler",
"divergence",
"."
] | train | https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/math/distance/Distance.java#L560-L575 |
thorstenwagner/TraJ | src/main/java/de/biomedical_imaging/traJ/simulation/ConfinedDiffusionSimulator.java | ConfinedDiffusionSimulator.nextConfinedPosition | private Point3d nextConfinedPosition(Point3d lastPosition){
double timelagSub = timelag / numberOfSubsteps;
Point3d center = new Point3d(0, 0, 0);
Point3d lastValidPosition = lastPosition;
int validSteps = 0;
while(validSteps<numberOfSubsteps){
double u = r.nextDouble();
double steplength = Math.sqrt(-2*dimension*diffusioncoefficient*timelagSub*Math.log(1-u));
Point3d candiate = SimulationUtil.randomPosition(dimension, steplength);
candiate.add(lastValidPosition);
if(center.distance(candiate)<radius){
lastValidPosition = candiate;
validSteps++;
}else{
proportionReflectedSteps++;
}
}
return lastValidPosition;
} | java | private Point3d nextConfinedPosition(Point3d lastPosition){
double timelagSub = timelag / numberOfSubsteps;
Point3d center = new Point3d(0, 0, 0);
Point3d lastValidPosition = lastPosition;
int validSteps = 0;
while(validSteps<numberOfSubsteps){
double u = r.nextDouble();
double steplength = Math.sqrt(-2*dimension*diffusioncoefficient*timelagSub*Math.log(1-u));
Point3d candiate = SimulationUtil.randomPosition(dimension, steplength);
candiate.add(lastValidPosition);
if(center.distance(candiate)<radius){
lastValidPosition = candiate;
validSteps++;
}else{
proportionReflectedSteps++;
}
}
return lastValidPosition;
} | [
"private",
"Point3d",
"nextConfinedPosition",
"(",
"Point3d",
"lastPosition",
")",
"{",
"double",
"timelagSub",
"=",
"timelag",
"/",
"numberOfSubsteps",
";",
"Point3d",
"center",
"=",
"new",
"Point3d",
"(",
"0",
",",
"0",
",",
"0",
")",
";",
"Point3d",
"last... | Simulates a single step (for dt) of a confined diffusion inside of a circle.
Therefore each step is split up in N substeps. A substep which collidates
with an object is set to the previous position.
@param Nsub number of substeps
@return | [
"Simulates",
"a",
"single",
"step",
"(",
"for",
"dt",
")",
"of",
"a",
"confined",
"diffusion",
"inside",
"of",
"a",
"circle",
".",
"Therefore",
"each",
"step",
"is",
"split",
"up",
"in",
"N",
"substeps",
".",
"A",
"substep",
"which",
"collidates",
"with"... | train | https://github.com/thorstenwagner/TraJ/blob/505fafb1f2f77a2d67bb2a089a2fdebe2c9bc7cb/src/main/java/de/biomedical_imaging/traJ/simulation/ConfinedDiffusionSimulator.java#L73-L95 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/accesslayer/ConnectionFactoryPooledImpl.java | ConnectionFactoryPooledImpl.createConnectionPool | public ObjectPool createConnectionPool(JdbcConnectionDescriptor jcd)
{
if (log.isDebugEnabled()) log.debug("createPool was called");
PoolableObjectFactory pof = new ConPoolFactory(this, jcd);
GenericObjectPool.Config conf = jcd.getConnectionPoolDescriptor().getObjectPoolConfig();
return (ObjectPool)new GenericObjectPool(pof, conf);
} | java | public ObjectPool createConnectionPool(JdbcConnectionDescriptor jcd)
{
if (log.isDebugEnabled()) log.debug("createPool was called");
PoolableObjectFactory pof = new ConPoolFactory(this, jcd);
GenericObjectPool.Config conf = jcd.getConnectionPoolDescriptor().getObjectPoolConfig();
return (ObjectPool)new GenericObjectPool(pof, conf);
} | [
"public",
"ObjectPool",
"createConnectionPool",
"(",
"JdbcConnectionDescriptor",
"jcd",
")",
"{",
"if",
"(",
"log",
".",
"isDebugEnabled",
"(",
")",
")",
"log",
".",
"debug",
"(",
"\"createPool was called\"",
")",
";",
"PoolableObjectFactory",
"pof",
"=",
"new",
... | Create the pool for pooling the connections of the given connection descriptor.
Override this method to implement your on {@link org.apache.commons.pool.ObjectPool}. | [
"Create",
"the",
"pool",
"for",
"pooling",
"the",
"connections",
"of",
"the",
"given",
"connection",
"descriptor",
".",
"Override",
"this",
"method",
"to",
"implement",
"your",
"on",
"{"
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/accesslayer/ConnectionFactoryPooledImpl.java#L130-L136 |
fabric8io/fabric8-forge | addons/utils/src/main/java/io/fabric8/forge/addon/utils/MavenHelpers.java | MavenHelpers.getConfigurationElement | public static ConfigurationElement getConfigurationElement(ConfigurationElement element, String... names) {
ConfigurationElement e = element;
for (String name : names) {
if (e == null) {
break;
}
e = findChildByName(e, name);
}
return e;
} | java | public static ConfigurationElement getConfigurationElement(ConfigurationElement element, String... names) {
ConfigurationElement e = element;
for (String name : names) {
if (e == null) {
break;
}
e = findChildByName(e, name);
}
return e;
} | [
"public",
"static",
"ConfigurationElement",
"getConfigurationElement",
"(",
"ConfigurationElement",
"element",
",",
"String",
"...",
"names",
")",
"{",
"ConfigurationElement",
"e",
"=",
"element",
";",
"for",
"(",
"String",
"name",
":",
"names",
")",
"{",
"if",
... | Returns the plugin configuration element for the given set of element names | [
"Returns",
"the",
"plugin",
"configuration",
"element",
"for",
"the",
"given",
"set",
"of",
"element",
"names"
] | train | https://github.com/fabric8io/fabric8-forge/blob/a59871bae4d5c5d3ece10f1e8758e73663087f19/addons/utils/src/main/java/io/fabric8/forge/addon/utils/MavenHelpers.java#L298-L307 |
att/AAF | cadi/core/src/main/java/com/att/cadi/Hash.java | Hash.isEqual | public static boolean isEqual(byte ba1[], byte ba2[]) {
if(ba1.length!=ba2.length)return false;
for(int i = 0;i<ba1.length; ++i) {
if(ba1[i]!=ba2[i])return false;
}
return true;
} | java | public static boolean isEqual(byte ba1[], byte ba2[]) {
if(ba1.length!=ba2.length)return false;
for(int i = 0;i<ba1.length; ++i) {
if(ba1[i]!=ba2[i])return false;
}
return true;
} | [
"public",
"static",
"boolean",
"isEqual",
"(",
"byte",
"ba1",
"[",
"]",
",",
"byte",
"ba2",
"[",
"]",
")",
"{",
"if",
"(",
"ba1",
".",
"length",
"!=",
"ba2",
".",
"length",
")",
"return",
"false",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i"... | Compare two byte arrays for equivalency
@param ba1
@param ba2
@return | [
"Compare",
"two",
"byte",
"arrays",
"for",
"equivalency"
] | train | https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/cadi/core/src/main/java/com/att/cadi/Hash.java#L124-L130 |
mgm-tp/jfunk | jfunk-data-generator/src/main/java/com/mgmtp/jfunk/data/generator/field/FieldFactory.java | FieldFactory.getClassObject | private Class<? extends Field> getClassObject(final Element element) {
String className = element.getAttributeValue(XMLTags.CLASS);
Class<? extends Field> classObject = null;
try {
className = className.indexOf('.') > 0 ? className : getClass().getPackage().getName() + '.' + className;
classObject = Class.forName(className).asSubclass(Field.class);
} catch (ClassNotFoundException e) {
throw new IllegalStateException("could not get class " + className, e);
}
return classObject;
} | java | private Class<? extends Field> getClassObject(final Element element) {
String className = element.getAttributeValue(XMLTags.CLASS);
Class<? extends Field> classObject = null;
try {
className = className.indexOf('.') > 0 ? className : getClass().getPackage().getName() + '.' + className;
classObject = Class.forName(className).asSubclass(Field.class);
} catch (ClassNotFoundException e) {
throw new IllegalStateException("could not get class " + className, e);
}
return classObject;
} | [
"private",
"Class",
"<",
"?",
"extends",
"Field",
">",
"getClassObject",
"(",
"final",
"Element",
"element",
")",
"{",
"String",
"className",
"=",
"element",
".",
"getAttributeValue",
"(",
"XMLTags",
".",
"CLASS",
")",
";",
"Class",
"<",
"?",
"extends",
"F... | This method returns the class object from which a new instance shall be generated. To achieve
this the class attribute of the passed element is taken to determine the class name. | [
"This",
"method",
"returns",
"the",
"class",
"object",
"from",
"which",
"a",
"new",
"instance",
"shall",
"be",
"generated",
".",
"To",
"achieve",
"this",
"the",
"class",
"attribute",
"of",
"the",
"passed",
"element",
"is",
"taken",
"to",
"determine",
"the",
... | train | https://github.com/mgm-tp/jfunk/blob/5b9fecac5778b988bb458085ded39ea9a4c7c2ae/jfunk-data-generator/src/main/java/com/mgmtp/jfunk/data/generator/field/FieldFactory.java#L80-L90 |
nohana/Amalgam | amalgam/src/main/java/com/amalgam/os/BundleUtils.java | BundleUtils.optSizeF | @Nullable
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public static SizeF optSizeF(@Nullable Bundle bundle, @Nullable String key) {
return optSizeF(bundle, key, null);
} | java | @Nullable
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public static SizeF optSizeF(@Nullable Bundle bundle, @Nullable String key) {
return optSizeF(bundle, key, null);
} | [
"@",
"Nullable",
"@",
"TargetApi",
"(",
"Build",
".",
"VERSION_CODES",
".",
"LOLLIPOP",
")",
"public",
"static",
"SizeF",
"optSizeF",
"(",
"@",
"Nullable",
"Bundle",
"bundle",
",",
"@",
"Nullable",
"String",
"key",
")",
"{",
"return",
"optSizeF",
"(",
"bun... | Returns a optional {@link android.util.SizeF} value. In other words, returns the value mapped by key if it exists and is a {@link android.util.SizeF}.
The bundle argument is allowed to be {@code null}. If the bundle is null, this method returns null.
@param bundle a bundle. If the bundle is null, this method will return null.
@param key a key for the value.
@return a {@link android.util.SizeF} value if exists, null otherwise.
@see android.os.Bundle#getSizeF(String) | [
"Returns",
"a",
"optional",
"{"
] | train | https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/os/BundleUtils.java#L903-L907 |
hal/core | gui/src/main/java/org/jboss/as/console/client/shared/subsys/ws/WebServiceView.java | WebServiceView.updateConfig | public void updateConfig(AddressTemplate addressTemplate, ModelNode currentConfig) {
String configName = null;
// update the editor endpoint/client configuration properties
switch (addressTemplate.getResourceType()) {
case WebServicesStore.ENDPOINT_CONFIG:
endpointConfigEditor.updateDetail(currentConfig);
configName = addressTemplate.getTemplate().substring(addressTemplate.getTemplate().lastIndexOf("=") + 1);
break;
case WebServicesStore.CLIENT_CONFIG:
clientConfigEditor.updateDetail(currentConfig);
configName = addressTemplate.getTemplate().substring(addressTemplate.getTemplate().lastIndexOf("=") + 1);
break;
default:
// when some handlers actions kicks in, need to strip the pre/post-handlers at the end
addressTemplate = addressTemplate.subTemplate(2, 3);
configName = addressTemplate.getTemplate().substring(addressTemplate.getTemplate().lastIndexOf("=") + 1);
break;
}
// update the editor endpoint/client pre/post handlers
switch (addressTemplate.getResourceType()) {
case WebServicesStore.ENDPOINT_CONFIG:
preHandlerEndpointEditor.updateMaster(configName, currentConfig, "pre-handler-chain");
postHandlerEndpointEditor.updateMaster(configName, currentConfig, "post-handler-chain");
break;
case WebServicesStore.CLIENT_CONFIG:
preHandlerClientEditor.updateMaster(configName, currentConfig, "pre-handler-chain");
postHandlerClientEditor.updateMaster(configName, currentConfig, "post-handler-chain");
break;
}
} | java | public void updateConfig(AddressTemplate addressTemplate, ModelNode currentConfig) {
String configName = null;
// update the editor endpoint/client configuration properties
switch (addressTemplate.getResourceType()) {
case WebServicesStore.ENDPOINT_CONFIG:
endpointConfigEditor.updateDetail(currentConfig);
configName = addressTemplate.getTemplate().substring(addressTemplate.getTemplate().lastIndexOf("=") + 1);
break;
case WebServicesStore.CLIENT_CONFIG:
clientConfigEditor.updateDetail(currentConfig);
configName = addressTemplate.getTemplate().substring(addressTemplate.getTemplate().lastIndexOf("=") + 1);
break;
default:
// when some handlers actions kicks in, need to strip the pre/post-handlers at the end
addressTemplate = addressTemplate.subTemplate(2, 3);
configName = addressTemplate.getTemplate().substring(addressTemplate.getTemplate().lastIndexOf("=") + 1);
break;
}
// update the editor endpoint/client pre/post handlers
switch (addressTemplate.getResourceType()) {
case WebServicesStore.ENDPOINT_CONFIG:
preHandlerEndpointEditor.updateMaster(configName, currentConfig, "pre-handler-chain");
postHandlerEndpointEditor.updateMaster(configName, currentConfig, "post-handler-chain");
break;
case WebServicesStore.CLIENT_CONFIG:
preHandlerClientEditor.updateMaster(configName, currentConfig, "pre-handler-chain");
postHandlerClientEditor.updateMaster(configName, currentConfig, "post-handler-chain");
break;
}
} | [
"public",
"void",
"updateConfig",
"(",
"AddressTemplate",
"addressTemplate",
",",
"ModelNode",
"currentConfig",
")",
"{",
"String",
"configName",
"=",
"null",
";",
"// update the editor endpoint/client configuration properties",
"switch",
"(",
"addressTemplate",
".",
"getRe... | Updates the child resources for a specific endpoint/client selected, when some opearation is
performed in the properties, pre/post handlers. | [
"Updates",
"the",
"child",
"resources",
"for",
"a",
"specific",
"endpoint",
"/",
"client",
"selected",
"when",
"some",
"opearation",
"is",
"performed",
"in",
"the",
"properties",
"pre",
"/",
"post",
"handlers",
"."
] | train | https://github.com/hal/core/blob/d6d03f0bb128dc0470f5dc75fdb1ea1014400602/gui/src/main/java/org/jboss/as/console/client/shared/subsys/ws/WebServiceView.java#L225-L258 |
jayantk/jklol | src/com/jayantkrish/jklol/tensor/SparseTensorBuilder.java | SparseTensorBuilder.getFactory | public static TensorFactory getFactory() {
return new TensorFactory() {
@Override
public TensorBuilder getBuilder(int[] dimNums, int[] dimSizes) {
return new SparseTensorBuilder(dimNums, dimSizes);
}
};
} | java | public static TensorFactory getFactory() {
return new TensorFactory() {
@Override
public TensorBuilder getBuilder(int[] dimNums, int[] dimSizes) {
return new SparseTensorBuilder(dimNums, dimSizes);
}
};
} | [
"public",
"static",
"TensorFactory",
"getFactory",
"(",
")",
"{",
"return",
"new",
"TensorFactory",
"(",
")",
"{",
"@",
"Override",
"public",
"TensorBuilder",
"getBuilder",
"(",
"int",
"[",
"]",
"dimNums",
",",
"int",
"[",
"]",
"dimSizes",
")",
"{",
"retur... | Gets a {@code TensorFactory} which creates {@code SparseTensorBuilder}s.
@return | [
"Gets",
"a",
"{",
"@code",
"TensorFactory",
"}",
"which",
"creates",
"{",
"@code",
"SparseTensorBuilder",
"}",
"s",
"."
] | train | https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/tensor/SparseTensorBuilder.java#L83-L90 |
kohsuke/args4j | args4j/src/org/kohsuke/args4j/XmlParser.java | XmlParser.findMethodOrField | private AccessibleObject findMethodOrField(Object bean, String field, String method) throws SecurityException, NoSuchFieldException, NoSuchMethodException, ClassNotFoundException {
AccessibleObject rv;
if (field != null) {
rv = bean.getClass().getDeclaredField(field);
} else {
String methodName = method.substring(0, method.indexOf("("));
String[] params = method.substring(method.indexOf("(")+1, method.indexOf(")")).split(",");
Class[] paramTypes = new Class[params.length];
for(int i=0; i<params.length; i++) {
String className = params[i];
if (className.indexOf('.') < 0) {
className = "java.lang." + className;
}
paramTypes[i] = Class.forName(className);
}
rv = bean.getClass().getMethod(methodName, paramTypes);
}
return rv;
} | java | private AccessibleObject findMethodOrField(Object bean, String field, String method) throws SecurityException, NoSuchFieldException, NoSuchMethodException, ClassNotFoundException {
AccessibleObject rv;
if (field != null) {
rv = bean.getClass().getDeclaredField(field);
} else {
String methodName = method.substring(0, method.indexOf("("));
String[] params = method.substring(method.indexOf("(")+1, method.indexOf(")")).split(",");
Class[] paramTypes = new Class[params.length];
for(int i=0; i<params.length; i++) {
String className = params[i];
if (className.indexOf('.') < 0) {
className = "java.lang." + className;
}
paramTypes[i] = Class.forName(className);
}
rv = bean.getClass().getMethod(methodName, paramTypes);
}
return rv;
} | [
"private",
"AccessibleObject",
"findMethodOrField",
"(",
"Object",
"bean",
",",
"String",
"field",
",",
"String",
"method",
")",
"throws",
"SecurityException",
",",
"NoSuchFieldException",
",",
"NoSuchMethodException",
",",
"ClassNotFoundException",
"{",
"AccessibleObject... | Finds a {@link java.lang.reflect.Method} or {@link java.lang.reflect.Method} in the bean
instance with the requested name.
@param bean bean instance
@param field name of the field (field XOR method must be specified)
@param method name of the method (field XOR method must be specified)
@return the reflection reference
@throws SecurityException
@throws NoSuchFieldException
@throws NoSuchMethodException
@throws ClassNotFoundException | [
"Finds",
"a",
"{"
] | train | https://github.com/kohsuke/args4j/blob/dc2e7e265caf15a1a146e3389c1f16a8781f06cf/args4j/src/org/kohsuke/args4j/XmlParser.java#L71-L89 |
couchbase/couchbase-lite-java | src/main/java/com/couchbase/lite/MutableDictionary.java | MutableDictionary.setValue | @NonNull
@Override
public MutableDictionary setValue(@NonNull String key, Object value) {
if (key == null) { throw new IllegalArgumentException("key cannot be null."); }
synchronized (lock) {
final MValue oldValue = internalDict.get(key);
value = Fleece.toCBLObject(value);
if (Fleece.valueWouldChange(value, oldValue, internalDict)) { internalDict.set(key, new MValue(value)); }
return this;
}
} | java | @NonNull
@Override
public MutableDictionary setValue(@NonNull String key, Object value) {
if (key == null) { throw new IllegalArgumentException("key cannot be null."); }
synchronized (lock) {
final MValue oldValue = internalDict.get(key);
value = Fleece.toCBLObject(value);
if (Fleece.valueWouldChange(value, oldValue, internalDict)) { internalDict.set(key, new MValue(value)); }
return this;
}
} | [
"@",
"NonNull",
"@",
"Override",
"public",
"MutableDictionary",
"setValue",
"(",
"@",
"NonNull",
"String",
"key",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"key",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"key cannot be null... | Set an object value by key. Allowed value types are List, Date, Map, Number, null, String,
Array, Blob, and Dictionary. The List and Map must contain only the above types.
An Date object will be converted to an ISO-8601 format string.
@param key the key.
@param value the object value.
@return The self object. | [
"Set",
"an",
"object",
"value",
"by",
"key",
".",
"Allowed",
"value",
"types",
"are",
"List",
"Date",
"Map",
"Number",
"null",
"String",
"Array",
"Blob",
"and",
"Dictionary",
".",
"The",
"List",
"and",
"Map",
"must",
"contain",
"only",
"the",
"above",
"t... | train | https://github.com/couchbase/couchbase-lite-java/blob/cb72c44186456e6191a9ad0a7feb310011d0b081/src/main/java/com/couchbase/lite/MutableDictionary.java#L97-L108 |
Jasig/uPortal | uPortal-portlets/src/main/java/org/apereo/portal/portlets/portletadmin/PortletAdministrationHelper.java | PortletAdministrationHelper.createPortletDefinitionForm | public PortletDefinitionForm createPortletDefinitionForm(IPerson person, String portletId) {
IPortletDefinition def = portletDefinitionRegistry.getPortletDefinition(portletId);
// create the new form
final PortletDefinitionForm form;
if (def != null) {
// if this is a pre-existing portlet, set the category and permissions
form = new PortletDefinitionForm(def);
form.setId(def.getPortletDefinitionId().getStringId());
// create a JsonEntityBean for each current category and add it
// to our form bean's category list
Set<PortletCategory> categories = portletCategoryRegistry.getParentCategories(def);
for (PortletCategory cat : categories) {
form.addCategory(new JsonEntityBean(cat));
}
addPrincipalPermissionsToForm(def, form);
} else {
form = createNewPortletDefinitionForm();
}
/* TODO: Service-Layer Security Reboot (great need of refactoring with a community-approved plan in place) */
// User must have SOME FORM of lifecycle permission over AT LEAST ONE
// category in which this portlet resides; lifecycle permissions are
// hierarchical, so we'll test with the weakest.
if (!hasLifecyclePermission(person, PortletLifecycleState.CREATED, form.getCategories())) {
logger.warn(
"User '"
+ person.getUserName()
+ "' attempted to edit the following portlet without MANAGE permission: "
+ def);
throw new SecurityException("Not Authorized");
}
return form;
} | java | public PortletDefinitionForm createPortletDefinitionForm(IPerson person, String portletId) {
IPortletDefinition def = portletDefinitionRegistry.getPortletDefinition(portletId);
// create the new form
final PortletDefinitionForm form;
if (def != null) {
// if this is a pre-existing portlet, set the category and permissions
form = new PortletDefinitionForm(def);
form.setId(def.getPortletDefinitionId().getStringId());
// create a JsonEntityBean for each current category and add it
// to our form bean's category list
Set<PortletCategory> categories = portletCategoryRegistry.getParentCategories(def);
for (PortletCategory cat : categories) {
form.addCategory(new JsonEntityBean(cat));
}
addPrincipalPermissionsToForm(def, form);
} else {
form = createNewPortletDefinitionForm();
}
/* TODO: Service-Layer Security Reboot (great need of refactoring with a community-approved plan in place) */
// User must have SOME FORM of lifecycle permission over AT LEAST ONE
// category in which this portlet resides; lifecycle permissions are
// hierarchical, so we'll test with the weakest.
if (!hasLifecyclePermission(person, PortletLifecycleState.CREATED, form.getCategories())) {
logger.warn(
"User '"
+ person.getUserName()
+ "' attempted to edit the following portlet without MANAGE permission: "
+ def);
throw new SecurityException("Not Authorized");
}
return form;
} | [
"public",
"PortletDefinitionForm",
"createPortletDefinitionForm",
"(",
"IPerson",
"person",
",",
"String",
"portletId",
")",
"{",
"IPortletDefinition",
"def",
"=",
"portletDefinitionRegistry",
".",
"getPortletDefinition",
"(",
"portletId",
")",
";",
"// create the new form"... | Construct a new PortletDefinitionForm for the given IPortletDefinition id. If a
PortletDefinition matching this ID already exists, the form will be pre-populated with the
PortletDefinition's current configuration. If the PortletDefinition does not yet exist, a new
default form will be created.
@param person user that is required to have related lifecycle permission
@param portletId identifier for the portlet definition
@return {@PortletDefinitionForm} with set values based on portlet definition or default
category and principal if no definition is found | [
"Construct",
"a",
"new",
"PortletDefinitionForm",
"for",
"the",
"given",
"IPortletDefinition",
"id",
".",
"If",
"a",
"PortletDefinition",
"matching",
"this",
"ID",
"already",
"exists",
"the",
"form",
"will",
"be",
"pre",
"-",
"populated",
"with",
"the",
"Portlet... | train | https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-portlets/src/main/java/org/apereo/portal/portlets/portletadmin/PortletAdministrationHelper.java#L179-L216 |
OpenLiberty/open-liberty | dev/com.ibm.ws.opentracing.1.2/src/com/ibm/ws/opentracing/OpentracingService.java | OpentracingService.processFilters | private static void processFilters(List<SpanFilter> filters, String pattern, String childNames, Class<? extends SpanFilter> impl) {
final String methodName = "processFilters";
try {
SpanFilterType type = SpanFilterType.INCOMING;
boolean ignoreCase = false;
boolean regex = true;
SpanFilter filter = (SpanFilter) Class.forName(impl.getName()).getConstructor(String.class, SpanFilterType.class, boolean.class,
boolean.class).newInstance(pattern, type,
ignoreCase, regex);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, methodName, "filter " + filter);
}
filters.add(filter);
} catch (ClassNotFoundException | IllegalAccessException | InstantiationException | NoSuchMethodException | SecurityException | IllegalArgumentException
| InvocationTargetException e) {
throw new IllegalStateException(e);
}
} | java | private static void processFilters(List<SpanFilter> filters, String pattern, String childNames, Class<? extends SpanFilter> impl) {
final String methodName = "processFilters";
try {
SpanFilterType type = SpanFilterType.INCOMING;
boolean ignoreCase = false;
boolean regex = true;
SpanFilter filter = (SpanFilter) Class.forName(impl.getName()).getConstructor(String.class, SpanFilterType.class, boolean.class,
boolean.class).newInstance(pattern, type,
ignoreCase, regex);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, methodName, "filter " + filter);
}
filters.add(filter);
} catch (ClassNotFoundException | IllegalAccessException | InstantiationException | NoSuchMethodException | SecurityException | IllegalArgumentException
| InvocationTargetException e) {
throw new IllegalStateException(e);
}
} | [
"private",
"static",
"void",
"processFilters",
"(",
"List",
"<",
"SpanFilter",
">",
"filters",
",",
"String",
"pattern",
",",
"String",
"childNames",
",",
"Class",
"<",
"?",
"extends",
"SpanFilter",
">",
"impl",
")",
"{",
"final",
"String",
"methodName",
"="... | Check the configuration for filters of a particular type.
@param filters The resulting list of filters.
@param map Configuration properties.
@param configAdmin Service to get child configurations.
@param childNames The name of the configuration element to check for.
@param impl The filter class to instantiate if an element is found. | [
"Check",
"the",
"configuration",
"for",
"filters",
"of",
"a",
"particular",
"type",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.opentracing.1.2/src/com/ibm/ws/opentracing/OpentracingService.java#L127-L149 |
JOML-CI/JOML | src/org/joml/Intersectiond.java | Intersectiond.intersectRaySphere | public static boolean intersectRaySphere(Rayd ray, Spheref sphere, Vector2d result) {
return intersectRaySphere(ray.oX, ray.oY, ray.oZ, ray.dX, ray.dY, ray.dZ, sphere.x, sphere.y, sphere.z, sphere.r*sphere.r, result);
} | java | public static boolean intersectRaySphere(Rayd ray, Spheref sphere, Vector2d result) {
return intersectRaySphere(ray.oX, ray.oY, ray.oZ, ray.dX, ray.dY, ray.dZ, sphere.x, sphere.y, sphere.z, sphere.r*sphere.r, result);
} | [
"public",
"static",
"boolean",
"intersectRaySphere",
"(",
"Rayd",
"ray",
",",
"Spheref",
"sphere",
",",
"Vector2d",
"result",
")",
"{",
"return",
"intersectRaySphere",
"(",
"ray",
".",
"oX",
",",
"ray",
".",
"oY",
",",
"ray",
".",
"oZ",
",",
"ray",
".",
... | Test whether the given ray intersects the given sphere,
and store the values of the parameter <i>t</i> in the ray equation <i>p(t) = origin + t * dir</i> for both points (near
and far) of intersections into the given <code>result</code> vector.
<p>
This method returns <code>true</code> for a ray whose origin lies inside the sphere.
<p>
Reference: <a href="http://www.scratchapixel.com/lessons/3d-basic-rendering/minimal-ray-tracer-rendering-simple-shapes/ray-sphere-intersection">http://www.scratchapixel.com/</a>
@param ray
the ray
@param sphere
the sphere
@param result
a vector that will contain the values of the parameter <i>t</i> in the ray equation
<i>p(t) = origin + t * dir</i> for both points (near, far) of intersections with the sphere
@return <code>true</code> if the ray intersects the sphere; <code>false</code> otherwise | [
"Test",
"whether",
"the",
"given",
"ray",
"intersects",
"the",
"given",
"sphere",
"and",
"store",
"the",
"values",
"of",
"the",
"parameter",
"<i",
">",
"t<",
"/",
"i",
">",
"in",
"the",
"ray",
"equation",
"<i",
">",
"p",
"(",
"t",
")",
"=",
"origin",... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Intersectiond.java#L2134-L2136 |
dmfs/http-client-interfaces | src/org/dmfs/httpclientinterfaces/HttpStatus.java | HttpStatus.statusLine | public String statusLine(int httpVersionMajor, int httpVersionMinor)
{
return String.format("HTTP/%s.%s %d %s", httpVersionMajor, httpVersionMinor, statusCode, reasonPhrase);
} | java | public String statusLine(int httpVersionMajor, int httpVersionMinor)
{
return String.format("HTTP/%s.%s %d %s", httpVersionMajor, httpVersionMinor, statusCode, reasonPhrase);
} | [
"public",
"String",
"statusLine",
"(",
"int",
"httpVersionMajor",
",",
"int",
"httpVersionMinor",
")",
"{",
"return",
"String",
".",
"format",
"(",
"\"HTTP/%s.%s %d %s\"",
",",
"httpVersionMajor",
",",
"httpVersionMinor",
",",
"statusCode",
",",
"reasonPhrase",
")",... | Returns a status line in the form:
<pre>
HTTP/VersionMajor.VersionMinor SP Status-Code SP Reason-Phrase
</pre>
@param httpVersionMajor
The major version number, usually <code>1</code>
@param httpVersionMinor
The minor version number, usually <code>1</code>
@return | [
"Returns",
"a",
"status",
"line",
"in",
"the",
"form",
":"
] | train | https://github.com/dmfs/http-client-interfaces/blob/10896c71270ccaf32ac4ed5d706dfa0001fd3862/src/org/dmfs/httpclientinterfaces/HttpStatus.java#L459-L462 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/network/v2018_06_01/implementation/LoadBalancerFrontendIPConfigurationsInner.java | LoadBalancerFrontendIPConfigurationsInner.getAsync | public Observable<FrontendIPConfigurationInner> getAsync(String resourceGroupName, String loadBalancerName, String frontendIPConfigurationName) {
return getWithServiceResponseAsync(resourceGroupName, loadBalancerName, frontendIPConfigurationName).map(new Func1<ServiceResponse<FrontendIPConfigurationInner>, FrontendIPConfigurationInner>() {
@Override
public FrontendIPConfigurationInner call(ServiceResponse<FrontendIPConfigurationInner> response) {
return response.body();
}
});
} | java | public Observable<FrontendIPConfigurationInner> getAsync(String resourceGroupName, String loadBalancerName, String frontendIPConfigurationName) {
return getWithServiceResponseAsync(resourceGroupName, loadBalancerName, frontendIPConfigurationName).map(new Func1<ServiceResponse<FrontendIPConfigurationInner>, FrontendIPConfigurationInner>() {
@Override
public FrontendIPConfigurationInner call(ServiceResponse<FrontendIPConfigurationInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"FrontendIPConfigurationInner",
">",
"getAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"loadBalancerName",
",",
"String",
"frontendIPConfigurationName",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
"resourceGroupName",
",... | Gets load balancer frontend IP configuration.
@param resourceGroupName The name of the resource group.
@param loadBalancerName The name of the load balancer.
@param frontendIPConfigurationName The name of the frontend IP configuration.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the FrontendIPConfigurationInner object | [
"Gets",
"load",
"balancer",
"frontend",
"IP",
"configuration",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/network/v2018_06_01/implementation/LoadBalancerFrontendIPConfigurationsInner.java#L233-L240 |
google/closure-templates | java/src/com/google/template/soy/data/SanitizedContents.java | SanitizedContents.unsanitizedText | @Deprecated
public static UnsanitizedString unsanitizedText(String text, @Nullable Dir dir) {
return UnsanitizedString.create(text);
} | java | @Deprecated
public static UnsanitizedString unsanitizedText(String text, @Nullable Dir dir) {
return UnsanitizedString.create(text);
} | [
"@",
"Deprecated",
"public",
"static",
"UnsanitizedString",
"unsanitizedText",
"(",
"String",
"text",
",",
"@",
"Nullable",
"Dir",
"dir",
")",
"{",
"return",
"UnsanitizedString",
".",
"create",
"(",
"text",
")",
";",
"}"
] | Creates a SanitizedContent object of kind TEXT of a given direction (null if unknown).
<p>This is useful when stubbing out a function that needs to create a SanitizedContent object.
@deprecated Call {@link #unsanitizedText(String)} instead | [
"Creates",
"a",
"SanitizedContent",
"object",
"of",
"kind",
"TEXT",
"of",
"a",
"given",
"direction",
"(",
"null",
"if",
"unknown",
")",
"."
] | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/data/SanitizedContents.java#L84-L87 |
iig-uni-freiburg/SEWOL | src/de/uni/freiburg/iig/telematik/sewol/log/DULogEntry.java | DULogEntry.addDataUsage | public boolean addDataUsage(DataAttribute attribute, DataUsage usage) throws ParameterException, LockingException {
Validate.notNull(attribute);
if (isFieldLocked(EntryField.DATA)) {
if (!dataUsage.containsKey(attribute)) {
throw new LockingException(EntryField.DATA);
}
return false;
} else {
if (dataUsage.get(attribute) == null) {
dataUsage.put(attribute, new HashSet<>());
}
if (usage != null) {
dataUsage.get(attribute).add(usage);
}
return true;
}
} | java | public boolean addDataUsage(DataAttribute attribute, DataUsage usage) throws ParameterException, LockingException {
Validate.notNull(attribute);
if (isFieldLocked(EntryField.DATA)) {
if (!dataUsage.containsKey(attribute)) {
throw new LockingException(EntryField.DATA);
}
return false;
} else {
if (dataUsage.get(attribute) == null) {
dataUsage.put(attribute, new HashSet<>());
}
if (usage != null) {
dataUsage.get(attribute).add(usage);
}
return true;
}
} | [
"public",
"boolean",
"addDataUsage",
"(",
"DataAttribute",
"attribute",
",",
"DataUsage",
"usage",
")",
"throws",
"ParameterException",
",",
"LockingException",
"{",
"Validate",
".",
"notNull",
"(",
"attribute",
")",
";",
"if",
"(",
"isFieldLocked",
"(",
"EntryFie... | Adds the given attribute to the list of attributes
@param attribute The attribute to add.
@param usage The data usage
@throws ParameterException if the given attribute or usage is
<code>null</code>.
@throws LockingException if the field INPUT_DATA is locked <br>
and the attribute is not already contained in {@link #dataUsage}.
@return <code>true</code> if {@link #dataUsage} was modified;<br>
<code>false</code> otherwise. | [
"Adds",
"the",
"given",
"attribute",
"to",
"the",
"list",
"of",
"attributes"
] | train | https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/src/de/uni/freiburg/iig/telematik/sewol/log/DULogEntry.java#L154-L171 |
aws/aws-sdk-java | aws-java-sdk-amplify/src/main/java/com/amazonaws/services/amplify/model/CreateBranchRequest.java | CreateBranchRequest.withEnvironmentVariables | public CreateBranchRequest withEnvironmentVariables(java.util.Map<String, String> environmentVariables) {
setEnvironmentVariables(environmentVariables);
return this;
} | java | public CreateBranchRequest withEnvironmentVariables(java.util.Map<String, String> environmentVariables) {
setEnvironmentVariables(environmentVariables);
return this;
} | [
"public",
"CreateBranchRequest",
"withEnvironmentVariables",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"environmentVariables",
")",
"{",
"setEnvironmentVariables",
"(",
"environmentVariables",
")",
";",
"return",
"this",
";",
"}"
] | <p>
Environment Variables for the branch.
</p>
@param environmentVariables
Environment Variables for the branch.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"Environment",
"Variables",
"for",
"the",
"branch",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-amplify/src/main/java/com/amazonaws/services/amplify/model/CreateBranchRequest.java#L468-L471 |
alkacon/opencms-core | src-gwt/org/opencms/ade/sitemap/client/toolbar/CmsToolbarClipboardView.java | CmsToolbarClipboardView.createDeletedItem | public CmsListItem createDeletedItem(final CmsClientSitemapEntry entry) {
CmsListInfoBean infoBean = new CmsListInfoBean();
infoBean.setTitle(entry.getTitle());
infoBean.setSubTitle(entry.getSitePath());
infoBean.setResourceType(
CmsStringUtil.isNotEmptyOrWhitespaceOnly(entry.getDefaultFileType())
? entry.getDefaultFileType()
: entry.getResourceTypeName());
infoBean.addAdditionalInfo(Messages.get().key(Messages.GUI_NAME_0), entry.getName());
infoBean.addAdditionalInfo(Messages.get().key(Messages.GUI_VFS_PATH_0), entry.getVfsPath());
infoBean.setBigIconClasses(entry.getNavModeIcon());
final CmsListItemWidget itemWidget = new CmsListItemWidget(infoBean);
CmsListItem listItem = new CmsClipboardDeletedItem(itemWidget, entry);
CmsPushButton button = new CmsPushButton();
button.setImageClass(I_CmsButton.RESET);
button.setTitle(Messages.get().key(Messages.GUI_HOVERBAR_UNDELETE_0));
button.setButtonStyle(ButtonStyle.FONT_ICON, null);
button.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
CmsDomUtil.ensureMouseOut(itemWidget.getElement());
m_clipboardButton.closeMenu();
CmsSitemapView.getInstance().getController().undelete(entry.getId(), entry.getSitePath());
}
});
itemWidget.addButton(button);
itemWidget.setStateIcon(StateIcon.standard);
listItem.setId(entry.getId().toString());
return listItem;
} | java | public CmsListItem createDeletedItem(final CmsClientSitemapEntry entry) {
CmsListInfoBean infoBean = new CmsListInfoBean();
infoBean.setTitle(entry.getTitle());
infoBean.setSubTitle(entry.getSitePath());
infoBean.setResourceType(
CmsStringUtil.isNotEmptyOrWhitespaceOnly(entry.getDefaultFileType())
? entry.getDefaultFileType()
: entry.getResourceTypeName());
infoBean.addAdditionalInfo(Messages.get().key(Messages.GUI_NAME_0), entry.getName());
infoBean.addAdditionalInfo(Messages.get().key(Messages.GUI_VFS_PATH_0), entry.getVfsPath());
infoBean.setBigIconClasses(entry.getNavModeIcon());
final CmsListItemWidget itemWidget = new CmsListItemWidget(infoBean);
CmsListItem listItem = new CmsClipboardDeletedItem(itemWidget, entry);
CmsPushButton button = new CmsPushButton();
button.setImageClass(I_CmsButton.RESET);
button.setTitle(Messages.get().key(Messages.GUI_HOVERBAR_UNDELETE_0));
button.setButtonStyle(ButtonStyle.FONT_ICON, null);
button.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
CmsDomUtil.ensureMouseOut(itemWidget.getElement());
m_clipboardButton.closeMenu();
CmsSitemapView.getInstance().getController().undelete(entry.getId(), entry.getSitePath());
}
});
itemWidget.addButton(button);
itemWidget.setStateIcon(StateIcon.standard);
listItem.setId(entry.getId().toString());
return listItem;
} | [
"public",
"CmsListItem",
"createDeletedItem",
"(",
"final",
"CmsClientSitemapEntry",
"entry",
")",
"{",
"CmsListInfoBean",
"infoBean",
"=",
"new",
"CmsListInfoBean",
"(",
")",
";",
"infoBean",
".",
"setTitle",
"(",
"entry",
".",
"getTitle",
"(",
")",
")",
";",
... | Creates a new deleted list item.<p>
@param entry the sitemap entry
@return the new created (still orphan) list item | [
"Creates",
"a",
"new",
"deleted",
"list",
"item",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/sitemap/client/toolbar/CmsToolbarClipboardView.java#L177-L209 |
UrielCh/ovh-java-sdk | ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java | ApiOvhEmaildomain.domain_account_accountName_migrate_destinationServiceName_destinationEmailAddress_destinationEmailAddress_GET | public OvhMigrationAccount domain_account_accountName_migrate_destinationServiceName_destinationEmailAddress_destinationEmailAddress_GET(String domain, String accountName, String destinationServiceName, String destinationEmailAddress) throws IOException {
String qPath = "/email/domain/{domain}/account/{accountName}/migrate/{destinationServiceName}/destinationEmailAddress/{destinationEmailAddress}";
StringBuilder sb = path(qPath, domain, accountName, destinationServiceName, destinationEmailAddress);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhMigrationAccount.class);
} | java | public OvhMigrationAccount domain_account_accountName_migrate_destinationServiceName_destinationEmailAddress_destinationEmailAddress_GET(String domain, String accountName, String destinationServiceName, String destinationEmailAddress) throws IOException {
String qPath = "/email/domain/{domain}/account/{accountName}/migrate/{destinationServiceName}/destinationEmailAddress/{destinationEmailAddress}";
StringBuilder sb = path(qPath, domain, accountName, destinationServiceName, destinationEmailAddress);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhMigrationAccount.class);
} | [
"public",
"OvhMigrationAccount",
"domain_account_accountName_migrate_destinationServiceName_destinationEmailAddress_destinationEmailAddress_GET",
"(",
"String",
"domain",
",",
"String",
"accountName",
",",
"String",
"destinationServiceName",
",",
"String",
"destinationEmailAddress",
")... | Get this object properties
REST: GET /email/domain/{domain}/account/{accountName}/migrate/{destinationServiceName}/destinationEmailAddress/{destinationEmailAddress}
@param domain [required] Name of your domain name
@param accountName [required] Name of account
@param destinationServiceName [required] Service name allowed as migration destination
@param destinationEmailAddress [required] Destination account name
API beta | [
"Get",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java#L525-L530 |
micrometer-metrics/micrometer | micrometer-core/src/main/java/io/micrometer/core/instrument/util/JsonUtils.java | JsonUtils.appendIndentedNewLine | private static void appendIndentedNewLine(int indentLevel, StringBuilder stringBuilder) {
stringBuilder.append("\n");
for (int i = 0; i < indentLevel; i++) {
// Assuming indention using 2 spaces
stringBuilder.append(" ");
}
} | java | private static void appendIndentedNewLine(int indentLevel, StringBuilder stringBuilder) {
stringBuilder.append("\n");
for (int i = 0; i < indentLevel; i++) {
// Assuming indention using 2 spaces
stringBuilder.append(" ");
}
} | [
"private",
"static",
"void",
"appendIndentedNewLine",
"(",
"int",
"indentLevel",
",",
"StringBuilder",
"stringBuilder",
")",
"{",
"stringBuilder",
".",
"append",
"(",
"\"\\n\"",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"indentLevel",
";",
... | Print a new line with indention at the beginning of the new line.
@param indentLevel
@param stringBuilder | [
"Print",
"a",
"new",
"line",
"with",
"indention",
"at",
"the",
"beginning",
"of",
"the",
"new",
"line",
"."
] | train | https://github.com/micrometer-metrics/micrometer/blob/127fa3265325cc894f368312ed8890b76a055d88/micrometer-core/src/main/java/io/micrometer/core/instrument/util/JsonUtils.java#L80-L86 |
eFaps/eFaps-Kernel | src/main/java/org/efaps/db/Context.java | Context.getThreadContext | public static Context getThreadContext()
throws EFapsException
{
Context context = Context.THREADCONTEXT.get();
if (context == null) {
context = Context.INHERITTHREADCONTEXT.get();
}
if (context == null) {
throw new EFapsException(Context.class, "getThreadContext.NoContext4ThreadDefined");
}
return context;
} | java | public static Context getThreadContext()
throws EFapsException
{
Context context = Context.THREADCONTEXT.get();
if (context == null) {
context = Context.INHERITTHREADCONTEXT.get();
}
if (context == null) {
throw new EFapsException(Context.class, "getThreadContext.NoContext4ThreadDefined");
}
return context;
} | [
"public",
"static",
"Context",
"getThreadContext",
"(",
")",
"throws",
"EFapsException",
"{",
"Context",
"context",
"=",
"Context",
".",
"THREADCONTEXT",
".",
"get",
"(",
")",
";",
"if",
"(",
"context",
"==",
"null",
")",
"{",
"context",
"=",
"Context",
".... | The method checks if for the current thread a context object is defined.
This found context object is returned.
@return defined context object of current thread
@throws EFapsException if no context object for current thread is defined
@see #INHERITTHREADCONTEXT | [
"The",
"method",
"checks",
"if",
"for",
"the",
"current",
"thread",
"a",
"context",
"object",
"is",
"defined",
".",
"This",
"found",
"context",
"object",
"is",
"returned",
"."
] | train | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/db/Context.java#L885-L896 |
Syncleus/aparapi | src/main/java/com/aparapi/internal/model/ClassModel.java | ClassModel.getMethod | public ClassModelMethod getMethod(MethodEntry _methodEntry, boolean _isSpecial) {
final String entryClassNameInDotForm = _methodEntry.getClassEntry().getNameUTF8Entry().getUTF8().replace('/', '.');
// Shortcut direct calls to supers to allow "foo() { super.foo() }" type stuff to work
if (_isSpecial && (superClazz != null) && superClazz.isSuperClass(entryClassNameInDotForm)) {
if (logger.isLoggable(Level.FINE)) {
logger.fine("going to look in super:" + superClazz.getClassWeAreModelling().getName() + " on behalf of "
+ entryClassNameInDotForm);
}
return superClazz.getMethod(_methodEntry, false);
}
NameAndTypeEntry nameAndTypeEntry = _methodEntry.getNameAndTypeEntry();
ClassModelMethod methodOrNull = getMethodOrNull(nameAndTypeEntry.getNameUTF8Entry().getUTF8(), nameAndTypeEntry
.getDescriptorUTF8Entry().getUTF8());
if (methodOrNull == null)
return superClazz != null ? superClazz.getMethod(_methodEntry, false) : (null);
return methodOrNull;
} | java | public ClassModelMethod getMethod(MethodEntry _methodEntry, boolean _isSpecial) {
final String entryClassNameInDotForm = _methodEntry.getClassEntry().getNameUTF8Entry().getUTF8().replace('/', '.');
// Shortcut direct calls to supers to allow "foo() { super.foo() }" type stuff to work
if (_isSpecial && (superClazz != null) && superClazz.isSuperClass(entryClassNameInDotForm)) {
if (logger.isLoggable(Level.FINE)) {
logger.fine("going to look in super:" + superClazz.getClassWeAreModelling().getName() + " on behalf of "
+ entryClassNameInDotForm);
}
return superClazz.getMethod(_methodEntry, false);
}
NameAndTypeEntry nameAndTypeEntry = _methodEntry.getNameAndTypeEntry();
ClassModelMethod methodOrNull = getMethodOrNull(nameAndTypeEntry.getNameUTF8Entry().getUTF8(), nameAndTypeEntry
.getDescriptorUTF8Entry().getUTF8());
if (methodOrNull == null)
return superClazz != null ? superClazz.getMethod(_methodEntry, false) : (null);
return methodOrNull;
} | [
"public",
"ClassModelMethod",
"getMethod",
"(",
"MethodEntry",
"_methodEntry",
",",
"boolean",
"_isSpecial",
")",
"{",
"final",
"String",
"entryClassNameInDotForm",
"=",
"_methodEntry",
".",
"getClassEntry",
"(",
")",
".",
"getNameUTF8Entry",
"(",
")",
".",
"getUTF8... | Look up a ConstantPool MethodEntry and return the corresponding Method.
@param _methodEntry The ConstantPool MethodEntry we want.
@param _isSpecial True if we wish to delegate to super (to support <code>super.foo()</code>)
@return The Method or null if we fail to locate a given method. | [
"Look",
"up",
"a",
"ConstantPool",
"MethodEntry",
"and",
"return",
"the",
"corresponding",
"Method",
"."
] | train | https://github.com/Syncleus/aparapi/blob/6d5892c8e69854b3968c541023de37cf4762bd24/src/main/java/com/aparapi/internal/model/ClassModel.java#L2957-L2975 |
gosu-lang/gosu-lang | gosu-core-api/src/main/java/gw/util/DynamicArray.java | DynamicArray.addAll | public boolean addAll(int index, Collection<? extends E> c) {
if (index > size || index < 0)
throw new IndexOutOfBoundsException(
"Index: " + index + ", Size: " + size);
Object[] a = c.toArray();
int numNew = a.length;
ensureCapacity(size + numNew); // Increments modCount
int numMoved = size - index;
if (numMoved > 0)
System.arraycopy(data, index, data, index + numNew,
numMoved);
System.arraycopy(a, 0, data, index, numNew);
size += numNew;
return numNew != 0;
} | java | public boolean addAll(int index, Collection<? extends E> c) {
if (index > size || index < 0)
throw new IndexOutOfBoundsException(
"Index: " + index + ", Size: " + size);
Object[] a = c.toArray();
int numNew = a.length;
ensureCapacity(size + numNew); // Increments modCount
int numMoved = size - index;
if (numMoved > 0)
System.arraycopy(data, index, data, index + numNew,
numMoved);
System.arraycopy(a, 0, data, index, numNew);
size += numNew;
return numNew != 0;
} | [
"public",
"boolean",
"addAll",
"(",
"int",
"index",
",",
"Collection",
"<",
"?",
"extends",
"E",
">",
"c",
")",
"{",
"if",
"(",
"index",
">",
"size",
"||",
"index",
"<",
"0",
")",
"throw",
"new",
"IndexOutOfBoundsException",
"(",
"\"Index: \"",
"+",
"i... | Inserts all of the elements in the specified collection into this
list, starting at the specified position. Shifts the element
currently at that position (if any) and any subsequent elements to
the right (increases their indices). The new elements will appear
in the list in the order that they are returned by the
specified collection's iterator.
@param index index at which to insert the first element from the
specified collection
@param c collection containing elements to be added to this list
@return <tt>true</tt> if this list changed as a result of the call
@throws IndexOutOfBoundsException {@inheritDoc}
@throws NullPointerException if the specified collection is null | [
"Inserts",
"all",
"of",
"the",
"elements",
"in",
"the",
"specified",
"collection",
"into",
"this",
"list",
"starting",
"at",
"the",
"specified",
"position",
".",
"Shifts",
"the",
"element",
"currently",
"at",
"that",
"position",
"(",
"if",
"any",
")",
"and",... | train | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/util/DynamicArray.java#L426-L443 |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/descriptor/DescriptorDistance.java | DescriptorDistance.euclideanSq | public static double euclideanSq(TupleDesc_F64 a, TupleDesc_F64 b) {
final int N = a.value.length;
double total = 0;
for( int i = 0; i < N; i++ ) {
double d = a.value[i]-b.value[i];
total += d*d;
}
return total;
} | java | public static double euclideanSq(TupleDesc_F64 a, TupleDesc_F64 b) {
final int N = a.value.length;
double total = 0;
for( int i = 0; i < N; i++ ) {
double d = a.value[i]-b.value[i];
total += d*d;
}
return total;
} | [
"public",
"static",
"double",
"euclideanSq",
"(",
"TupleDesc_F64",
"a",
",",
"TupleDesc_F64",
"b",
")",
"{",
"final",
"int",
"N",
"=",
"a",
".",
"value",
".",
"length",
";",
"double",
"total",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"... | Returns the Euclidean distance squared between the two descriptors.
@param a First descriptor
@param b Second descriptor
@return Euclidean distance squared | [
"Returns",
"the",
"Euclidean",
"distance",
"squared",
"between",
"the",
"two",
"descriptors",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/descriptor/DescriptorDistance.java#L55-L64 |
unic/neba | core/src/main/java/io/neba/core/resourcemodels/mapping/FieldValueMappingCallback.java | FieldValueMappingCallback.applyCustomMappings | @SuppressWarnings("unchecked")
private Object applyCustomMappings(FieldData fieldData, final Object value) {
Object result = value;
for (final AnnotationMapping mapping : this.annotatedFieldMappers.get(fieldData.metaData)) {
result = mapping.getMapper().map(new OngoingFieldMapping(this.model, result, mapping, fieldData, this.resource, this.properties));
}
return result;
} | java | @SuppressWarnings("unchecked")
private Object applyCustomMappings(FieldData fieldData, final Object value) {
Object result = value;
for (final AnnotationMapping mapping : this.annotatedFieldMappers.get(fieldData.metaData)) {
result = mapping.getMapper().map(new OngoingFieldMapping(this.model, result, mapping, fieldData, this.resource, this.properties));
}
return result;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"Object",
"applyCustomMappings",
"(",
"FieldData",
"fieldData",
",",
"final",
"Object",
"value",
")",
"{",
"Object",
"result",
"=",
"value",
";",
"for",
"(",
"final",
"AnnotationMapping",
"mapping",
... | Applies all {@link AnnotatedFieldMapper registered field mappers}
to the provided value and returns the result. | [
"Applies",
"all",
"{"
] | train | https://github.com/unic/neba/blob/4d762e60112a1fcb850926a56a9843d5aa424c4b/core/src/main/java/io/neba/core/resourcemodels/mapping/FieldValueMappingCallback.java#L176-L183 |
kuujo/vertigo | core/src/main/java/net/kuujo/vertigo/Vertigo.java | Vertigo.deployCluster | public Vertigo deployCluster(String cluster, String group, int nodes) {
return deployCluster(cluster, group, nodes, null);
} | java | public Vertigo deployCluster(String cluster, String group, int nodes) {
return deployCluster(cluster, group, nodes, null);
} | [
"public",
"Vertigo",
"deployCluster",
"(",
"String",
"cluster",
",",
"String",
"group",
",",
"int",
"nodes",
")",
"{",
"return",
"deployCluster",
"(",
"cluster",
",",
"group",
",",
"nodes",
",",
"null",
")",
";",
"}"
] | Deploys multiple cluster nodes to a specific cluster group.
@param cluster The cluster event bus address.
@param group The cluster group to which to deploy the nodes.
@param nodes The number of nodes to deploy.
@return The Vertigo instance. | [
"Deploys",
"multiple",
"cluster",
"nodes",
"to",
"a",
"specific",
"cluster",
"group",
"."
] | train | https://github.com/kuujo/vertigo/blob/c5869dbc5fff89eb5262e83f7a81719b01a5ba6f/core/src/main/java/net/kuujo/vertigo/Vertigo.java#L260-L262 |
bazaarvoice/emodb | common/stash/src/main/java/com/bazaarvoice/emodb/common/stash/StandardStashReader.java | StandardStashReader.lockToStashCreatedAt | public void lockToStashCreatedAt(Date creationTime)
throws StashNotAvailableException {
String stashDirectory = StashUtil.getStashDirectoryForCreationTime(creationTime);
// The following call will raise an AmazonS3Exception if the file cannot be read
try (S3Object s3Object = _s3.getObject(_bucket, String.format("%s/%s/%s", _rootPath, stashDirectory, StashUtil.SUCCESS_FILE))) {
_lockedLatest = String.format("%s/%s", _rootPath, stashDirectory);
} catch (AmazonS3Exception e) {
if (e.getStatusCode() == 404 ||
// The following conditions indicate the file has already been moved to Glacier
(e.getStatusCode() == 403 && "InvalidObjectState".equals(e.getErrorCode()))) {
throw new StashNotAvailableException();
}
throw e;
} catch (IOException e) {
// Shouldn't happen since the file is never actually read
}
} | java | public void lockToStashCreatedAt(Date creationTime)
throws StashNotAvailableException {
String stashDirectory = StashUtil.getStashDirectoryForCreationTime(creationTime);
// The following call will raise an AmazonS3Exception if the file cannot be read
try (S3Object s3Object = _s3.getObject(_bucket, String.format("%s/%s/%s", _rootPath, stashDirectory, StashUtil.SUCCESS_FILE))) {
_lockedLatest = String.format("%s/%s", _rootPath, stashDirectory);
} catch (AmazonS3Exception e) {
if (e.getStatusCode() == 404 ||
// The following conditions indicate the file has already been moved to Glacier
(e.getStatusCode() == 403 && "InvalidObjectState".equals(e.getErrorCode()))) {
throw new StashNotAvailableException();
}
throw e;
} catch (IOException e) {
// Shouldn't happen since the file is never actually read
}
} | [
"public",
"void",
"lockToStashCreatedAt",
"(",
"Date",
"creationTime",
")",
"throws",
"StashNotAvailableException",
"{",
"String",
"stashDirectory",
"=",
"StashUtil",
".",
"getStashDirectoryForCreationTime",
"(",
"creationTime",
")",
";",
"// The following call will raise an ... | This method is like {@link #lockToLatest()} except that the caller requests a specific Stash time.
@throws StashNotAvailableException Thrown if no Stash is available for the given time | [
"This",
"method",
"is",
"like",
"{"
] | train | https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/common/stash/src/main/java/com/bazaarvoice/emodb/common/stash/StandardStashReader.java#L172-L188 |
GerdHolz/TOVAL | src/de/invation/code/toval/graphic/ui/VerticalLabelUI.java | VerticalLabelUI.paint | @Override
public void paint(Graphics g, JComponent c) {
Graphics2D g2 = (Graphics2D) g.create();
if (clockwiseRotation) {
g2.rotate(Math.PI / 2, c.getSize().width / 2, c.getSize().width / 2);
} else {
g2.rotate(-Math.PI / 2, c.getSize().height / 2, c.getSize().height / 2);
}
super.paint(g2, c);
} | java | @Override
public void paint(Graphics g, JComponent c) {
Graphics2D g2 = (Graphics2D) g.create();
if (clockwiseRotation) {
g2.rotate(Math.PI / 2, c.getSize().width / 2, c.getSize().width / 2);
} else {
g2.rotate(-Math.PI / 2, c.getSize().height / 2, c.getSize().height / 2);
}
super.paint(g2, c);
} | [
"@",
"Override",
"public",
"void",
"paint",
"(",
"Graphics",
"g",
",",
"JComponent",
"c",
")",
"{",
"Graphics2D",
"g2",
"=",
"(",
"Graphics2D",
")",
"g",
".",
"create",
"(",
")",
";",
"if",
"(",
"clockwiseRotation",
")",
"{",
"g2",
".",
"rotate",
"("... | Transforms the Graphics for vertical rendering and invokes the
super method. | [
"Transforms",
"the",
"Graphics",
"for",
"vertical",
"rendering",
"and",
"invokes",
"the",
"super",
"method",
"."
] | train | https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/graphic/ui/VerticalLabelUI.java#L113-L122 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/spi/impl/eventservice/impl/EventServiceImpl.java | EventServiceImpl.sendEvent | private void sendEvent(Address subscriber, EventEnvelope eventEnvelope, int orderKey) {
String serviceName = eventEnvelope.getServiceName();
EventServiceSegment segment = getSegment(serviceName, true);
boolean sync = segment.incrementPublish() % eventSyncFrequency == 0;
if (sync) {
SendEventOperation op = new SendEventOperation(eventEnvelope, orderKey);
Future f = nodeEngine.getOperationService()
.createInvocationBuilder(serviceName, op, subscriber)
.setTryCount(SEND_RETRY_COUNT).invoke();
try {
f.get(sendEventSyncTimeoutMillis, MILLISECONDS);
} catch (Exception e) {
syncDeliveryFailureCount.inc();
if (logger.isFinestEnabled()) {
logger.finest("Sync event delivery failed. Event: " + eventEnvelope, e);
}
}
} else {
Packet packet = new Packet(serializationService.toBytes(eventEnvelope), orderKey)
.setPacketType(Packet.Type.EVENT);
EndpointManager em = nodeEngine.getNode().getNetworkingService().getEndpointManager(MEMBER);
if (!em.transmit(packet, subscriber)) {
if (nodeEngine.isRunning()) {
logFailure("Failed to send event packet to: %s, connection might not be alive.", subscriber);
}
}
}
} | java | private void sendEvent(Address subscriber, EventEnvelope eventEnvelope, int orderKey) {
String serviceName = eventEnvelope.getServiceName();
EventServiceSegment segment = getSegment(serviceName, true);
boolean sync = segment.incrementPublish() % eventSyncFrequency == 0;
if (sync) {
SendEventOperation op = new SendEventOperation(eventEnvelope, orderKey);
Future f = nodeEngine.getOperationService()
.createInvocationBuilder(serviceName, op, subscriber)
.setTryCount(SEND_RETRY_COUNT).invoke();
try {
f.get(sendEventSyncTimeoutMillis, MILLISECONDS);
} catch (Exception e) {
syncDeliveryFailureCount.inc();
if (logger.isFinestEnabled()) {
logger.finest("Sync event delivery failed. Event: " + eventEnvelope, e);
}
}
} else {
Packet packet = new Packet(serializationService.toBytes(eventEnvelope), orderKey)
.setPacketType(Packet.Type.EVENT);
EndpointManager em = nodeEngine.getNode().getNetworkingService().getEndpointManager(MEMBER);
if (!em.transmit(packet, subscriber)) {
if (nodeEngine.isRunning()) {
logFailure("Failed to send event packet to: %s, connection might not be alive.", subscriber);
}
}
}
} | [
"private",
"void",
"sendEvent",
"(",
"Address",
"subscriber",
",",
"EventEnvelope",
"eventEnvelope",
",",
"int",
"orderKey",
")",
"{",
"String",
"serviceName",
"=",
"eventEnvelope",
".",
"getServiceName",
"(",
")",
";",
"EventServiceSegment",
"segment",
"=",
"getS... | Sends a remote event to the {@code subscriber}.
Each event segment keeps track of the published event count. On every {@link #eventSyncFrequency} the event will
be sent synchronously.
A synchronous event means that we send the event as an {@link SendEventOperation} and in case of failure
we increase the failure count and log the failure (see {@link EventProcessor})
Otherwise, we send an asynchronous event. This means that we don't wait to see if the processing failed with an
exception (see {@link RemoteEventProcessor}) | [
"Sends",
"a",
"remote",
"event",
"to",
"the",
"{"
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/spi/impl/eventservice/impl/EventServiceImpl.java#L500-L529 |
buschmais/jqa-maven3-plugin | src/main/java/com/buschmais/jqassistant/plugin/maven3/impl/scanner/MavenModelScannerPlugin.java | MavenModelScannerPlugin.addExecutionGoals | private void addExecutionGoals(MavenPluginExecutionDescriptor executionDescriptor, PluginExecution pluginExecution, Store store) {
List<String> goals = pluginExecution.getGoals();
for (String goal : goals) {
MavenExecutionGoalDescriptor goalDescriptor = store.create(MavenExecutionGoalDescriptor.class);
goalDescriptor.setName(goal);
executionDescriptor.getGoals().add(goalDescriptor);
}
} | java | private void addExecutionGoals(MavenPluginExecutionDescriptor executionDescriptor, PluginExecution pluginExecution, Store store) {
List<String> goals = pluginExecution.getGoals();
for (String goal : goals) {
MavenExecutionGoalDescriptor goalDescriptor = store.create(MavenExecutionGoalDescriptor.class);
goalDescriptor.setName(goal);
executionDescriptor.getGoals().add(goalDescriptor);
}
} | [
"private",
"void",
"addExecutionGoals",
"(",
"MavenPluginExecutionDescriptor",
"executionDescriptor",
",",
"PluginExecution",
"pluginExecution",
",",
"Store",
"store",
")",
"{",
"List",
"<",
"String",
">",
"goals",
"=",
"pluginExecution",
".",
"getGoals",
"(",
")",
... | Adds information about execution goals.
@param executionDescriptor
The descriptor for the execution.
@param pluginExecution
The PluginExecution.
@param store
The database. | [
"Adds",
"information",
"about",
"execution",
"goals",
"."
] | train | https://github.com/buschmais/jqa-maven3-plugin/blob/6c6e2dca56de6d5b8ceeb2f28982fb6d7c98778f/src/main/java/com/buschmais/jqassistant/plugin/maven3/impl/scanner/MavenModelScannerPlugin.java#L318-L326 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/javax/crypto/Cipher.java | Cipher.getInstance | public static final Cipher getInstance(String transformation,
Provider provider)
throws NoSuchAlgorithmException, NoSuchPaddingException
{
if (provider == null) {
throw new IllegalArgumentException("Missing provider");
}
return createCipher(transformation, provider);
} | java | public static final Cipher getInstance(String transformation,
Provider provider)
throws NoSuchAlgorithmException, NoSuchPaddingException
{
if (provider == null) {
throw new IllegalArgumentException("Missing provider");
}
return createCipher(transformation, provider);
} | [
"public",
"static",
"final",
"Cipher",
"getInstance",
"(",
"String",
"transformation",
",",
"Provider",
"provider",
")",
"throws",
"NoSuchAlgorithmException",
",",
"NoSuchPaddingException",
"{",
"if",
"(",
"provider",
"==",
"null",
")",
"{",
"throw",
"new",
"Illeg... | Returns a <code>Cipher</code> object that implements the specified
transformation.
<p> A new Cipher object encapsulating the
CipherSpi implementation from the specified Provider
object is returned. Note that the specified Provider object
does not have to be registered in the provider list.
@param transformation the name of the transformation,
e.g., <i>DES/CBC/PKCS5Padding</i>.
See the Cipher section in the <a href=
"{@docRoot}openjdk-redirect.html?v=8&path=/technotes/guides/security/StandardNames.html#Cipher">
Java Cryptography Architecture Standard Algorithm Name Documentation</a>
for information about standard transformation names.
@param provider the provider.
@return a cipher that implements the requested transformation.
@exception NoSuchAlgorithmException if <code>transformation</code>
is null, empty, in an invalid format,
or if a CipherSpi implementation for the specified algorithm
is not available from the specified Provider object.
@exception NoSuchPaddingException if <code>transformation</code>
contains a padding scheme that is not available.
@exception IllegalArgumentException if the <code>provider</code>
is null.
@see java.security.Provider | [
"Returns",
"a",
"<code",
">",
"Cipher<",
"/",
"code",
">",
"object",
"that",
"implements",
"the",
"specified",
"transformation",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/javax/crypto/Cipher.java#L901-L909 |
ralscha/extdirectspring | src/main/java/ch/ralscha/extdirectspring/util/JsonHandler.java | JsonHandler.convertValue | public <T> T convertValue(Object object, Class<T> clazz) {
return this.mapper.convertValue(object, clazz);
} | java | public <T> T convertValue(Object object, Class<T> clazz) {
return this.mapper.convertValue(object, clazz);
} | [
"public",
"<",
"T",
">",
"T",
"convertValue",
"(",
"Object",
"object",
",",
"Class",
"<",
"T",
">",
"clazz",
")",
"{",
"return",
"this",
".",
"mapper",
".",
"convertValue",
"(",
"object",
",",
"clazz",
")",
";",
"}"
] | Converts one object into another.
@param object the source
@param clazz the type of the target
@return the converted object | [
"Converts",
"one",
"object",
"into",
"another",
"."
] | train | https://github.com/ralscha/extdirectspring/blob/4b018497c4e7503033f91d0491b4e74bf8291d2c/src/main/java/ch/ralscha/extdirectspring/util/JsonHandler.java#L159-L161 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/v1beta1/GrafeasV1Beta1Client.java | GrafeasV1Beta1Client.listOccurrences | public final ListOccurrencesPagedResponse listOccurrences(ProjectName parent, String filter) {
ListOccurrencesRequest request =
ListOccurrencesRequest.newBuilder()
.setParent(parent == null ? null : parent.toString())
.setFilter(filter)
.build();
return listOccurrences(request);
} | java | public final ListOccurrencesPagedResponse listOccurrences(ProjectName parent, String filter) {
ListOccurrencesRequest request =
ListOccurrencesRequest.newBuilder()
.setParent(parent == null ? null : parent.toString())
.setFilter(filter)
.build();
return listOccurrences(request);
} | [
"public",
"final",
"ListOccurrencesPagedResponse",
"listOccurrences",
"(",
"ProjectName",
"parent",
",",
"String",
"filter",
")",
"{",
"ListOccurrencesRequest",
"request",
"=",
"ListOccurrencesRequest",
".",
"newBuilder",
"(",
")",
".",
"setParent",
"(",
"parent",
"==... | Lists occurrences for the specified project.
<p>Sample code:
<pre><code>
try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) {
ProjectName parent = ProjectName.of("[PROJECT]");
String filter = "";
for (Occurrence element : grafeasV1Beta1Client.listOccurrences(parent, filter).iterateAll()) {
// doThingsWith(element);
}
}
</code></pre>
@param parent The name of the project to list occurrences for in the form of
`projects/[PROJECT_ID]`.
@param filter The filter expression.
@throws com.google.api.gax.rpc.ApiException if the remote call fails | [
"Lists",
"occurrences",
"for",
"the",
"specified",
"project",
"."
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/v1beta1/GrafeasV1Beta1Client.java#L309-L316 |
davidmoten/geo | geo/src/main/java/com/github/davidmoten/geo/GeoHash.java | GeoHash.gridAsString | public static String gridAsString(String hash, int size, Set<String> highlightThese) {
return gridAsString(hash, -size, -size, size, size, highlightThese);
} | java | public static String gridAsString(String hash, int size, Set<String> highlightThese) {
return gridAsString(hash, -size, -size, size, size, highlightThese);
} | [
"public",
"static",
"String",
"gridAsString",
"(",
"String",
"hash",
",",
"int",
"size",
",",
"Set",
"<",
"String",
">",
"highlightThese",
")",
"{",
"return",
"gridAsString",
"(",
"hash",
",",
"-",
"size",
",",
"-",
"size",
",",
"size",
",",
"size",
",... | <p>
Returns a String of lines of hashes to represent the relative positions
of hashes on a map. The grid is of height and width 2*size centred around
the given hash. Highlighted hashes are displayed in upper case. For
example, gridToString("dr",1,Collections.<String>emptySet()) returns:
</p>
<pre>
f0 f2 f8
dp dr dx
dn dq dw
</pre>
@param hash central hash
@param size size of square grid in hashes
@param highlightThese hashes to highlight
@return String representation of grid | [
"<p",
">",
"Returns",
"a",
"String",
"of",
"lines",
"of",
"hashes",
"to",
"represent",
"the",
"relative",
"positions",
"of",
"hashes",
"on",
"a",
"map",
".",
"The",
"grid",
"is",
"of",
"height",
"and",
"width",
"2",
"*",
"size",
"centred",
"around",
"t... | train | https://github.com/davidmoten/geo/blob/e90d2f406133cd9b60d54a3e6bdb7423d7fcce37/geo/src/main/java/com/github/davidmoten/geo/GeoHash.java#L784-L786 |
nats-io/java-nats | src/main/java/io/nats/client/Nats.java | Nats.connectAsynchronously | public static void connectAsynchronously(Options options, boolean reconnectOnConnect)
throws InterruptedException {
if (options.getConnectionListener() == null) {
throw new IllegalArgumentException("Connection Listener required in connectAsynchronously");
}
Thread t = new Thread(() -> {
try {
NatsImpl.createConnection(options, reconnectOnConnect);
} catch (Exception ex) {
if (options.getErrorListener() != null) {
options.getErrorListener().exceptionOccurred(null, ex);
}
}
});
t.setName("NATS - async connection");
t.start();
} | java | public static void connectAsynchronously(Options options, boolean reconnectOnConnect)
throws InterruptedException {
if (options.getConnectionListener() == null) {
throw new IllegalArgumentException("Connection Listener required in connectAsynchronously");
}
Thread t = new Thread(() -> {
try {
NatsImpl.createConnection(options, reconnectOnConnect);
} catch (Exception ex) {
if (options.getErrorListener() != null) {
options.getErrorListener().exceptionOccurred(null, ex);
}
}
});
t.setName("NATS - async connection");
t.start();
} | [
"public",
"static",
"void",
"connectAsynchronously",
"(",
"Options",
"options",
",",
"boolean",
"reconnectOnConnect",
")",
"throws",
"InterruptedException",
"{",
"if",
"(",
"options",
".",
"getConnectionListener",
"(",
")",
"==",
"null",
")",
"{",
"throw",
"new",
... | Try to connect in another thread, a connection listener is required to get
the connection.
<p>Normally connect will loop through the available servers one time. If
reconnectOnConnect is true, the connection attempt will repeat based on the
settings in options, including indefinitely.
<p>If there is an exception before a connection is created, and the error
listener is set, it will be notified with a null connection.
<p><strong>This method is experimental, please provide feedback on its value.</strong>
@param options the connection options
@param reconnectOnConnect if true, the connection will treat the initial
connection as any other and attempt reconnects on
failure
@throws IllegalArgumentException if no connection listener is set in the options
@throws InterruptedException if the current thread is interrupted | [
"Try",
"to",
"connect",
"in",
"another",
"thread",
"a",
"connection",
"listener",
"is",
"required",
"to",
"get",
"the",
"connection",
"."
] | train | https://github.com/nats-io/java-nats/blob/5f291048fd30192ba39b3fe2925ecd60aaad6b48/src/main/java/io/nats/client/Nats.java#L171-L189 |
hpsa/hpe-application-automation-tools-plugin | src/main/java/com/hp/application/automation/tools/model/RunFromFileSystemModel.java | RunFromFileSystemModel.getJobDetails | public JSONObject getJobDetails(String mcUrl, String proxyAddress, String proxyUserName, String proxyPassword){
if(StringUtils.isBlank(fsUserName) || StringUtils.isBlank(fsPassword.getPlainText())){
return null;
}
return JobConfigurationProxy.getInstance().getJobById(mcUrl, fsUserName, fsPassword.getPlainText(), proxyAddress, proxyUserName, proxyPassword, fsJobId);
} | java | public JSONObject getJobDetails(String mcUrl, String proxyAddress, String proxyUserName, String proxyPassword){
if(StringUtils.isBlank(fsUserName) || StringUtils.isBlank(fsPassword.getPlainText())){
return null;
}
return JobConfigurationProxy.getInstance().getJobById(mcUrl, fsUserName, fsPassword.getPlainText(), proxyAddress, proxyUserName, proxyPassword, fsJobId);
} | [
"public",
"JSONObject",
"getJobDetails",
"(",
"String",
"mcUrl",
",",
"String",
"proxyAddress",
",",
"String",
"proxyUserName",
",",
"String",
"proxyPassword",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isBlank",
"(",
"fsUserName",
")",
"||",
"StringUtils",
".",
... | Get proxy details json object.
@param mcUrl the mc url
@param proxyAddress the proxy address
@param proxyUserName the proxy user name
@param proxyPassword the proxy password
@return the json object | [
"Get",
"proxy",
"details",
"json",
"object",
"."
] | train | https://github.com/hpsa/hpe-application-automation-tools-plugin/blob/987536f5551bc76fd028d746a951d1fd72c7567a/src/main/java/com/hp/application/automation/tools/model/RunFromFileSystemModel.java#L646-L651 |
bazaarvoice/emodb | mapreduce/sor-hadoop/src/main/java/com/bazaarvoice/emodb/hadoop/io/HadoopDataStoreManager.java | HadoopDataStoreManager.getDataStore | public CloseableDataStore getDataStore(URI location, String apiKey, MetricRegistry metricRegistry)
throws IOException {
String id = LocationUtil.getDataStoreIdentifier(location, apiKey);
CloseableDataStore dataStore = null;
while (dataStore == null) {
// Get the cached DataStore if it exists
DataStoreMonitor dataStoreMonitor = _dataStoreByLocation.get(id);
if (dataStoreMonitor == null || (dataStore = dataStoreMonitor.getDataStore()) == null) {
// Either the value wasn't cached or the cached value was closed before the reference count could
// be incremented. Create a new DataStore and cache it.
CloseableDataStore unmonitoredDataStore;
switch (LocationUtil.getLocationType(location)) {
case EMO_HOST_DISCOVERY:
unmonitoredDataStore = createDataStoreWithHostDiscovery(location, apiKey, metricRegistry);
break;
case EMO_URL:
unmonitoredDataStore = createDataStoreWithUrl(location, apiKey, metricRegistry);
break;
default:
throw new IllegalArgumentException("Location does not use a data store: " + location);
}
dataStoreMonitor = new DataStoreMonitor(id, unmonitoredDataStore);
if (_dataStoreByLocation.putIfAbsent(id, dataStoreMonitor) != null) {
// Race condition; close the created DataStore and try again
dataStoreMonitor.closeNow();
} else {
// New data store was cached; return the value
dataStore = dataStoreMonitor.getDataStore();
}
}
}
return dataStore;
} | java | public CloseableDataStore getDataStore(URI location, String apiKey, MetricRegistry metricRegistry)
throws IOException {
String id = LocationUtil.getDataStoreIdentifier(location, apiKey);
CloseableDataStore dataStore = null;
while (dataStore == null) {
// Get the cached DataStore if it exists
DataStoreMonitor dataStoreMonitor = _dataStoreByLocation.get(id);
if (dataStoreMonitor == null || (dataStore = dataStoreMonitor.getDataStore()) == null) {
// Either the value wasn't cached or the cached value was closed before the reference count could
// be incremented. Create a new DataStore and cache it.
CloseableDataStore unmonitoredDataStore;
switch (LocationUtil.getLocationType(location)) {
case EMO_HOST_DISCOVERY:
unmonitoredDataStore = createDataStoreWithHostDiscovery(location, apiKey, metricRegistry);
break;
case EMO_URL:
unmonitoredDataStore = createDataStoreWithUrl(location, apiKey, metricRegistry);
break;
default:
throw new IllegalArgumentException("Location does not use a data store: " + location);
}
dataStoreMonitor = new DataStoreMonitor(id, unmonitoredDataStore);
if (_dataStoreByLocation.putIfAbsent(id, dataStoreMonitor) != null) {
// Race condition; close the created DataStore and try again
dataStoreMonitor.closeNow();
} else {
// New data store was cached; return the value
dataStore = dataStoreMonitor.getDataStore();
}
}
}
return dataStore;
} | [
"public",
"CloseableDataStore",
"getDataStore",
"(",
"URI",
"location",
",",
"String",
"apiKey",
",",
"MetricRegistry",
"metricRegistry",
")",
"throws",
"IOException",
"{",
"String",
"id",
"=",
"LocationUtil",
".",
"getDataStoreIdentifier",
"(",
"location",
",",
"ap... | Returns a DataStore for a given location. If a cached instance already exists its reference count is incremented
and returned, otherwise a new instance is created and cached. | [
"Returns",
"a",
"DataStore",
"for",
"a",
"given",
"location",
".",
"If",
"a",
"cached",
"instance",
"already",
"exists",
"its",
"reference",
"count",
"is",
"incremented",
"and",
"returned",
"otherwise",
"a",
"new",
"instance",
"is",
"created",
"and",
"cached",... | train | https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/mapreduce/sor-hadoop/src/main/java/com/bazaarvoice/emodb/hadoop/io/HadoopDataStoreManager.java#L61-L96 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/query/Criteria.java | Criteria.addColumnIn | public void addColumnIn(String column, Collection values)
{
List list = splitInCriteria(column, values, false, IN_LIMIT);
int index = 0;
InCriteria inCrit;
Criteria allInCritaria;
inCrit = (InCriteria) list.get(index);
inCrit.setTranslateAttribute(false);
allInCritaria = new Criteria(inCrit);
for (index = 1; index < list.size(); index++)
{
inCrit = (InCriteria) list.get(index);
inCrit.setTranslateAttribute(false);
allInCritaria.addOrCriteria(new Criteria(inCrit));
}
addAndCriteria(allInCritaria);
} | java | public void addColumnIn(String column, Collection values)
{
List list = splitInCriteria(column, values, false, IN_LIMIT);
int index = 0;
InCriteria inCrit;
Criteria allInCritaria;
inCrit = (InCriteria) list.get(index);
inCrit.setTranslateAttribute(false);
allInCritaria = new Criteria(inCrit);
for (index = 1; index < list.size(); index++)
{
inCrit = (InCriteria) list.get(index);
inCrit.setTranslateAttribute(false);
allInCritaria.addOrCriteria(new Criteria(inCrit));
}
addAndCriteria(allInCritaria);
} | [
"public",
"void",
"addColumnIn",
"(",
"String",
"column",
",",
"Collection",
"values",
")",
"{",
"List",
"list",
"=",
"splitInCriteria",
"(",
"column",
",",
"values",
",",
"false",
",",
"IN_LIMIT",
")",
";",
"int",
"index",
"=",
"0",
";",
"InCriteria",
"... | Adds IN criteria,
customer_id in(1,10,33,44)
large values are split into multiple InCriteria
IN (1,10) OR IN(33, 44) </br>
The attribute will NOT be translated into column name
@param column The column name to be used without translation
@param values The value Collection | [
"Adds",
"IN",
"criteria",
"customer_id",
"in",
"(",
"1",
"10",
"33",
"44",
")",
"large",
"values",
"are",
"split",
"into",
"multiple",
"InCriteria",
"IN",
"(",
"1",
"10",
")",
"OR",
"IN",
"(",
"33",
"44",
")",
"<",
"/",
"br",
">",
"The",
"attribute... | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/query/Criteria.java#L795-L814 |
liferay/com-liferay-commerce | commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPInstancePersistenceImpl.java | CPInstancePersistenceImpl.findByC_ERC | @Override
public CPInstance findByC_ERC(long companyId, String externalReferenceCode)
throws NoSuchCPInstanceException {
CPInstance cpInstance = fetchByC_ERC(companyId, externalReferenceCode);
if (cpInstance == null) {
StringBundler msg = new StringBundler(6);
msg.append(_NO_SUCH_ENTITY_WITH_KEY);
msg.append("companyId=");
msg.append(companyId);
msg.append(", externalReferenceCode=");
msg.append(externalReferenceCode);
msg.append("}");
if (_log.isDebugEnabled()) {
_log.debug(msg.toString());
}
throw new NoSuchCPInstanceException(msg.toString());
}
return cpInstance;
} | java | @Override
public CPInstance findByC_ERC(long companyId, String externalReferenceCode)
throws NoSuchCPInstanceException {
CPInstance cpInstance = fetchByC_ERC(companyId, externalReferenceCode);
if (cpInstance == null) {
StringBundler msg = new StringBundler(6);
msg.append(_NO_SUCH_ENTITY_WITH_KEY);
msg.append("companyId=");
msg.append(companyId);
msg.append(", externalReferenceCode=");
msg.append(externalReferenceCode);
msg.append("}");
if (_log.isDebugEnabled()) {
_log.debug(msg.toString());
}
throw new NoSuchCPInstanceException(msg.toString());
}
return cpInstance;
} | [
"@",
"Override",
"public",
"CPInstance",
"findByC_ERC",
"(",
"long",
"companyId",
",",
"String",
"externalReferenceCode",
")",
"throws",
"NoSuchCPInstanceException",
"{",
"CPInstance",
"cpInstance",
"=",
"fetchByC_ERC",
"(",
"companyId",
",",
"externalReferenceCode",
")... | Returns the cp instance where companyId = ? and externalReferenceCode = ? or throws a {@link NoSuchCPInstanceException} if it could not be found.
@param companyId the company ID
@param externalReferenceCode the external reference code
@return the matching cp instance
@throws NoSuchCPInstanceException if a matching cp instance could not be found | [
"Returns",
"the",
"cp",
"instance",
"where",
"companyId",
"=",
"?",
";",
"and",
"externalReferenceCode",
"=",
"?",
";",
"or",
"throws",
"a",
"{",
"@link",
"NoSuchCPInstanceException",
"}",
"if",
"it",
"could",
"not",
"be",
"found",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPInstancePersistenceImpl.java#L6826-L6852 |
hector-client/hector | core/src/main/java/me/prettyprint/hector/api/factory/HFactory.java | HFactory.createKeyspace | public static Keyspace createKeyspace(String keyspace, Cluster cluster) {
return createKeyspace(keyspace, cluster,
createDefaultConsistencyLevelPolicy(),
FailoverPolicy.ON_FAIL_TRY_ALL_AVAILABLE);
} | java | public static Keyspace createKeyspace(String keyspace, Cluster cluster) {
return createKeyspace(keyspace, cluster,
createDefaultConsistencyLevelPolicy(),
FailoverPolicy.ON_FAIL_TRY_ALL_AVAILABLE);
} | [
"public",
"static",
"Keyspace",
"createKeyspace",
"(",
"String",
"keyspace",
",",
"Cluster",
"cluster",
")",
"{",
"return",
"createKeyspace",
"(",
"keyspace",
",",
"cluster",
",",
"createDefaultConsistencyLevelPolicy",
"(",
")",
",",
"FailoverPolicy",
".",
"ON_FAIL_... | Creates a Keyspace with the default consistency level policy.
Example usage.
String clusterName = "Test Cluster";
String host = "localhost:9160";
Cluster cluster = HFactory.getOrCreateCluster(clusterName, host);
String keyspaceName = "testKeyspace";
Keyspace myKeyspace = HFactory.createKeyspace(keyspaceName, cluster);
@param keyspace
@param cluster
@return | [
"Creates",
"a",
"Keyspace",
"with",
"the",
"default",
"consistency",
"level",
"policy",
"."
] | train | https://github.com/hector-client/hector/blob/a302e68ca8d91b45d332e8c9afd7d98030b54de1/core/src/main/java/me/prettyprint/hector/api/factory/HFactory.java#L240-L244 |
structurizr/java | structurizr-core/src/com/structurizr/model/Model.java | Model.getDeploymentNodeWithName | public DeploymentNode getDeploymentNodeWithName(String name, String environment) {
for (DeploymentNode deploymentNode : getDeploymentNodes()) {
if (deploymentNode.getEnvironment().equals(environment) && deploymentNode.getName().equals(name)) {
return deploymentNode;
}
}
return null;
} | java | public DeploymentNode getDeploymentNodeWithName(String name, String environment) {
for (DeploymentNode deploymentNode : getDeploymentNodes()) {
if (deploymentNode.getEnvironment().equals(environment) && deploymentNode.getName().equals(name)) {
return deploymentNode;
}
}
return null;
} | [
"public",
"DeploymentNode",
"getDeploymentNodeWithName",
"(",
"String",
"name",
",",
"String",
"environment",
")",
"{",
"for",
"(",
"DeploymentNode",
"deploymentNode",
":",
"getDeploymentNodes",
"(",
")",
")",
"{",
"if",
"(",
"deploymentNode",
".",
"getEnvironment",... | Gets the deployment node with the specified name and environment.
@param name the name of the deployment node
@param environment the name of the deployment environment
@return the DeploymentNode instance with the specified name (or null if it doesn't exist). | [
"Gets",
"the",
"deployment",
"node",
"with",
"the",
"specified",
"name",
"and",
"environment",
"."
] | train | https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/model/Model.java#L690-L698 |
aws/aws-sdk-java | aws-java-sdk-greengrass/src/main/java/com/amazonaws/services/greengrass/model/GetDeviceDefinitionResult.java | GetDeviceDefinitionResult.withTags | public GetDeviceDefinitionResult withTags(java.util.Map<String, String> tags) {
setTags(tags);
return this;
} | java | public GetDeviceDefinitionResult withTags(java.util.Map<String, String> tags) {
setTags(tags);
return this;
} | [
"public",
"GetDeviceDefinitionResult",
"withTags",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"tags",
")",
"{",
"setTags",
"(",
"tags",
")",
";",
"return",
"this",
";",
"}"
] | The tags for the definition.
@param tags
The tags for the definition.
@return Returns a reference to this object so that method calls can be chained together. | [
"The",
"tags",
"for",
"the",
"definition",
"."
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-greengrass/src/main/java/com/amazonaws/services/greengrass/model/GetDeviceDefinitionResult.java#L310-L313 |
gmessner/gitlab4j-api | src/main/java/org/gitlab4j/api/JobApi.java | JobApi.downloadArtifactsFile | public InputStream downloadArtifactsFile(Object projectIdOrPath, String ref, String jobName) throws GitLabApiException {
Form formData = new GitLabApiForm().withParam("job", jobName, true);
Response response = getWithAccepts(Response.Status.OK, formData.asMap(), MediaType.MEDIA_TYPE_WILDCARD,
"projects", getProjectIdOrPath(projectIdOrPath), "jobs", "artifacts", ref, "download");
return (response.readEntity(InputStream.class));
} | java | public InputStream downloadArtifactsFile(Object projectIdOrPath, String ref, String jobName) throws GitLabApiException {
Form formData = new GitLabApiForm().withParam("job", jobName, true);
Response response = getWithAccepts(Response.Status.OK, formData.asMap(), MediaType.MEDIA_TYPE_WILDCARD,
"projects", getProjectIdOrPath(projectIdOrPath), "jobs", "artifacts", ref, "download");
return (response.readEntity(InputStream.class));
} | [
"public",
"InputStream",
"downloadArtifactsFile",
"(",
"Object",
"projectIdOrPath",
",",
"String",
"ref",
",",
"String",
"jobName",
")",
"throws",
"GitLabApiException",
"{",
"Form",
"formData",
"=",
"new",
"GitLabApiForm",
"(",
")",
".",
"withParam",
"(",
"\"job\"... | Get an InputStream pointing to the artifacts file from the given reference name and job
provided the job finished successfully. The file will be saved to the specified directory.
If the file already exists in the directory it will be overwritten.
<pre><code>GitLab Endpoint: GET /projects/:id/jobs/artifacts/:ref_name/download?job=name</code></pre>
@param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path
@param ref the ref from a repository
@param jobName the name of the job to download the artifacts for
@return an InputStream to read the specified artifacts file from
@throws GitLabApiException if any exception occurs | [
"Get",
"an",
"InputStream",
"pointing",
"to",
"the",
"artifacts",
"file",
"from",
"the",
"given",
"reference",
"name",
"and",
"job",
"provided",
"the",
"job",
"finished",
"successfully",
".",
"The",
"file",
"will",
"be",
"saved",
"to",
"the",
"specified",
"d... | train | https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/JobApi.java#L247-L252 |
kaazing/gateway | util/src/main/java/org/kaazing/gateway/util/asn1/Asn1Utils.java | Asn1Utils.decodeSequence | public static int decodeSequence(ByteBuffer buf) {
DerId id = DerId.decode(buf);
if (!id.matches(DerId.TagClass.UNIVERSAL, DerId.EncodingType.CONSTRUCTED, ASN1_SEQUENCE_TAG_NUM)) {
throw new IllegalArgumentException("Expected SEQUENCE identifier, received " + id);
}
int len = DerUtils.decodeLength(buf);
if (buf.remaining() < len) {
throw new IllegalArgumentException("Insufficient content for SEQUENCE");
}
return len;
} | java | public static int decodeSequence(ByteBuffer buf) {
DerId id = DerId.decode(buf);
if (!id.matches(DerId.TagClass.UNIVERSAL, DerId.EncodingType.CONSTRUCTED, ASN1_SEQUENCE_TAG_NUM)) {
throw new IllegalArgumentException("Expected SEQUENCE identifier, received " + id);
}
int len = DerUtils.decodeLength(buf);
if (buf.remaining() < len) {
throw new IllegalArgumentException("Insufficient content for SEQUENCE");
}
return len;
} | [
"public",
"static",
"int",
"decodeSequence",
"(",
"ByteBuffer",
"buf",
")",
"{",
"DerId",
"id",
"=",
"DerId",
".",
"decode",
"(",
"buf",
")",
";",
"if",
"(",
"!",
"id",
".",
"matches",
"(",
"DerId",
".",
"TagClass",
".",
"UNIVERSAL",
",",
"DerId",
".... | Decode an ASN.1 SEQUENCE by reading the identifier and length octets. The remaining data in the buffer is the SEQUENCE.
@param buf
the DER-encoded SEQUENCE
@return the length of the SEQUENCE | [
"Decode",
"an",
"ASN",
".",
"1",
"SEQUENCE",
"by",
"reading",
"the",
"identifier",
"and",
"length",
"octets",
".",
"The",
"remaining",
"data",
"in",
"the",
"buffer",
"is",
"the",
"SEQUENCE",
"."
] | train | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/util/src/main/java/org/kaazing/gateway/util/asn1/Asn1Utils.java#L218-L228 |
Omertron/api-themoviedb | src/main/java/com/omertron/themoviedbapi/tools/HttpTools.java | HttpTools.postRequest | public String postRequest(final URL url, final String jsonBody) throws MovieDbException {
try {
HttpPost httpPost = new HttpPost(url.toURI());
httpPost.addHeader(HTTP.CONTENT_TYPE, APPLICATION_JSON);
httpPost.addHeader(HttpHeaders.ACCEPT, APPLICATION_JSON);
StringEntity params = new StringEntity(jsonBody, ContentType.APPLICATION_JSON);
httpPost.setEntity(params);
return validateResponse(DigestedResponseReader.postContent(httpClient, httpPost, CHARSET), url);
} catch (URISyntaxException | IOException ex) {
throw new MovieDbException(ApiExceptionType.CONNECTION_ERROR, null, url, ex);
}
} | java | public String postRequest(final URL url, final String jsonBody) throws MovieDbException {
try {
HttpPost httpPost = new HttpPost(url.toURI());
httpPost.addHeader(HTTP.CONTENT_TYPE, APPLICATION_JSON);
httpPost.addHeader(HttpHeaders.ACCEPT, APPLICATION_JSON);
StringEntity params = new StringEntity(jsonBody, ContentType.APPLICATION_JSON);
httpPost.setEntity(params);
return validateResponse(DigestedResponseReader.postContent(httpClient, httpPost, CHARSET), url);
} catch (URISyntaxException | IOException ex) {
throw new MovieDbException(ApiExceptionType.CONNECTION_ERROR, null, url, ex);
}
} | [
"public",
"String",
"postRequest",
"(",
"final",
"URL",
"url",
",",
"final",
"String",
"jsonBody",
")",
"throws",
"MovieDbException",
"{",
"try",
"{",
"HttpPost",
"httpPost",
"=",
"new",
"HttpPost",
"(",
"url",
".",
"toURI",
"(",
")",
")",
";",
"httpPost",... | POST content to the URL with the specified body
@param url URL to use in the request
@param jsonBody Body to use in the request
@return String content
@throws MovieDbException exception | [
"POST",
"content",
"to",
"the",
"URL",
"with",
"the",
"specified",
"body"
] | train | https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/tools/HttpTools.java#L127-L139 |
gsi-upm/BeastTool | beast-tool/src/main/java/es/upm/dit/gsi/beast/reader/mas/CreateMASCaseManager.java | CreateMASCaseManager.addStory | public static void addStory(File caseManager, String storyName,
String testPath, String user, String feature, String benefit) throws BeastException {
FileWriter caseManagerWriter;
String storyClass = SystemReader.createClassName(storyName);
try {
BufferedReader reader = new BufferedReader(new FileReader(
caseManager));
String targetLine1 = " public void "
+ MASReader.createFirstLowCaseName(storyName) + "() {";
String targetLine2 = " Result result = JUnitCore.runClasses(" + testPath + "."
+ storyClass + ".class);";
String in;
while ((in = reader.readLine()) != null) {
if (in.equals(targetLine1)) {
while ((in = reader.readLine()) != null) {
if (in.equals(targetLine2)) {
reader.close();
// This test is already written in the case manager.
return;
}
}
reader.close();
throw new BeastException("Two different stories with the same name (same method name) are being created in the same CaseManager file. That is not possible. Please, change the name of the story: " + testPath + "."
+ storyClass + ".java");
}
}
reader.close();
caseManagerWriter = new FileWriter(caseManager, true);
caseManagerWriter.write(" /**\n");
caseManagerWriter.write(" * This is the story: " + storyName
+ "\n");
caseManagerWriter.write(" * requested by: " + user + "\n");
caseManagerWriter.write(" * providing the feature: " + feature
+ "\n");
caseManagerWriter.write(" * so the user gets the benefit: "
+ benefit + "\n");
caseManagerWriter.write(" */\n");
caseManagerWriter.write(" @Test\n");
caseManagerWriter.write(" public void "
+ MASReader.createFirstLowCaseName(storyName) + "() {\n");
caseManagerWriter.write(" Result result = JUnitCore.runClasses(" + testPath
+ "." + storyClass + ".class);\n");
caseManagerWriter.write(" Assert.assertTrue(result.wasSuccessful());\n");
caseManagerWriter.write(" }\n");
caseManagerWriter.write("\n");
caseManagerWriter.flush();
caseManagerWriter.close();
} catch (IOException e) {
Logger logger = Logger.getLogger("CreateMASCaseManager.createTest");
logger.info("ERROR writing the file");
}
} | java | public static void addStory(File caseManager, String storyName,
String testPath, String user, String feature, String benefit) throws BeastException {
FileWriter caseManagerWriter;
String storyClass = SystemReader.createClassName(storyName);
try {
BufferedReader reader = new BufferedReader(new FileReader(
caseManager));
String targetLine1 = " public void "
+ MASReader.createFirstLowCaseName(storyName) + "() {";
String targetLine2 = " Result result = JUnitCore.runClasses(" + testPath + "."
+ storyClass + ".class);";
String in;
while ((in = reader.readLine()) != null) {
if (in.equals(targetLine1)) {
while ((in = reader.readLine()) != null) {
if (in.equals(targetLine2)) {
reader.close();
// This test is already written in the case manager.
return;
}
}
reader.close();
throw new BeastException("Two different stories with the same name (same method name) are being created in the same CaseManager file. That is not possible. Please, change the name of the story: " + testPath + "."
+ storyClass + ".java");
}
}
reader.close();
caseManagerWriter = new FileWriter(caseManager, true);
caseManagerWriter.write(" /**\n");
caseManagerWriter.write(" * This is the story: " + storyName
+ "\n");
caseManagerWriter.write(" * requested by: " + user + "\n");
caseManagerWriter.write(" * providing the feature: " + feature
+ "\n");
caseManagerWriter.write(" * so the user gets the benefit: "
+ benefit + "\n");
caseManagerWriter.write(" */\n");
caseManagerWriter.write(" @Test\n");
caseManagerWriter.write(" public void "
+ MASReader.createFirstLowCaseName(storyName) + "() {\n");
caseManagerWriter.write(" Result result = JUnitCore.runClasses(" + testPath
+ "." + storyClass + ".class);\n");
caseManagerWriter.write(" Assert.assertTrue(result.wasSuccessful());\n");
caseManagerWriter.write(" }\n");
caseManagerWriter.write("\n");
caseManagerWriter.flush();
caseManagerWriter.close();
} catch (IOException e) {
Logger logger = Logger.getLogger("CreateMASCaseManager.createTest");
logger.info("ERROR writing the file");
}
} | [
"public",
"static",
"void",
"addStory",
"(",
"File",
"caseManager",
",",
"String",
"storyName",
",",
"String",
"testPath",
",",
"String",
"user",
",",
"String",
"feature",
",",
"String",
"benefit",
")",
"throws",
"BeastException",
"{",
"FileWriter",
"caseManager... | The third method to write caseManager. Its task is to write the call to
the story to be run.
@param caseManager
the file where the test must be written
@param storyName
the name of the story
@param test_path
the path where the story can be found
@param user
the user requesting the story
@param feature
the feature requested by the user
@param benefit
the benefit provided by the feature
@throws BeastException | [
"The",
"third",
"method",
"to",
"write",
"caseManager",
".",
"Its",
"task",
"is",
"to",
"write",
"the",
"call",
"to",
"the",
"story",
"to",
"be",
"run",
"."
] | train | https://github.com/gsi-upm/BeastTool/blob/cc7fdc75cb818c5d60802aaf32c27829e0ca144c/beast-tool/src/main/java/es/upm/dit/gsi/beast/reader/mas/CreateMASCaseManager.java#L183-L236 |
find-sec-bugs/find-sec-bugs | findsecbugs-plugin/src/main/java/com/h3xstream/findsecbugs/injection/BasicInjectionDetector.java | BasicInjectionDetector.loadConfiguredSinks | protected void loadConfiguredSinks(String filename, String bugType) {
SINKS_LOADER.loadConfiguredSinks(filename, bugType, new SinksLoader.InjectionPointReceiver() {
@Override
public void receiveInjectionPoint(String fullMethodName, InjectionPoint injectionPoint) {
addParsedInjectionPoint(fullMethodName, injectionPoint);
}
});
} | java | protected void loadConfiguredSinks(String filename, String bugType) {
SINKS_LOADER.loadConfiguredSinks(filename, bugType, new SinksLoader.InjectionPointReceiver() {
@Override
public void receiveInjectionPoint(String fullMethodName, InjectionPoint injectionPoint) {
addParsedInjectionPoint(fullMethodName, injectionPoint);
}
});
} | [
"protected",
"void",
"loadConfiguredSinks",
"(",
"String",
"filename",
",",
"String",
"bugType",
")",
"{",
"SINKS_LOADER",
".",
"loadConfiguredSinks",
"(",
"filename",
",",
"bugType",
",",
"new",
"SinksLoader",
".",
"InjectionPointReceiver",
"(",
")",
"{",
"@",
... | Loads taint sinks from configuration
@param filename name of the configuration file
@param bugType type of an injection bug | [
"Loads",
"taint",
"sinks",
"from",
"configuration"
] | train | https://github.com/find-sec-bugs/find-sec-bugs/blob/362da013cef4925e6a1506dd3511fe5bdcc5fba3/findsecbugs-plugin/src/main/java/com/h3xstream/findsecbugs/injection/BasicInjectionDetector.java#L108-L115 |
biojava/biojava | biojava-survival/src/main/java/org/biojava/nbio/survival/kaplanmeier/figure/KaplanMeierFigure.java | KaplanMeierFigure.setSurvivalData | public void setSurvivalData(ArrayList<String> title, LinkedHashMap<String, ArrayList<CensorStatus>> survivalData, Boolean useWeighted) throws Exception {
this.setSurvivalData(title, survivalData, null, useWeighted);
} | java | public void setSurvivalData(ArrayList<String> title, LinkedHashMap<String, ArrayList<CensorStatus>> survivalData, Boolean useWeighted) throws Exception {
this.setSurvivalData(title, survivalData, null, useWeighted);
} | [
"public",
"void",
"setSurvivalData",
"(",
"ArrayList",
"<",
"String",
">",
"title",
",",
"LinkedHashMap",
"<",
"String",
",",
"ArrayList",
"<",
"CensorStatus",
">",
">",
"survivalData",
",",
"Boolean",
"useWeighted",
")",
"throws",
"Exception",
"{",
"this",
".... | The data will set the max time which will result in off time points for
tick marks
@param title
@param survivalData
@param useWeighted
@throws Exception | [
"The",
"data",
"will",
"set",
"the",
"max",
"time",
"which",
"will",
"result",
"in",
"off",
"time",
"points",
"for",
"tick",
"marks"
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-survival/src/main/java/org/biojava/nbio/survival/kaplanmeier/figure/KaplanMeierFigure.java#L290-L292 |
hibernate/hibernate-ogm | core/src/main/java/org/hibernate/ogm/id/impl/OgmSequenceGenerator.java | OgmSequenceGenerator.determineSequenceName | protected QualifiedName determineSequenceName(Properties params, JdbcEnvironment jdbcEnv) {
final String sequencePerEntitySuffix = ConfigurationHelper.getString( SequenceStyleGenerator.CONFIG_SEQUENCE_PER_ENTITY_SUFFIX, params, SequenceStyleGenerator.DEF_SEQUENCE_SUFFIX );
// JPA_ENTITY_NAME value honors <class ... entity-name="..."> (HBM) and @Entity#name (JPA) overrides.
final String defaultSequenceName = ConfigurationHelper.getBoolean( SequenceStyleGenerator.CONFIG_PREFER_SEQUENCE_PER_ENTITY, params, false )
? params.getProperty( JPA_ENTITY_NAME ) + sequencePerEntitySuffix
: SequenceStyleGenerator.DEF_SEQUENCE_NAME;
final String sequenceName = ConfigurationHelper.getString( SequenceStyleGenerator.SEQUENCE_PARAM, params, defaultSequenceName );
if ( sequenceName.contains( "." ) ) {
return QualifiedNameParser.INSTANCE.parse( sequenceName );
}
else {
final String schemaName = params.getProperty( PersistentIdentifierGenerator.SCHEMA );
if ( schemaName != null ) {
log.schemaOptionNotSupportedForSequenceGenerator( schemaName );
}
final String catalogName = params.getProperty( PersistentIdentifierGenerator.CATALOG );
if ( catalogName != null ) {
log.catalogOptionNotSupportedForSequenceGenerator( catalogName );
}
return new QualifiedNameParser.NameParts(
null,
null,
jdbcEnv.getIdentifierHelper().toIdentifier( sequenceName )
);
}
} | java | protected QualifiedName determineSequenceName(Properties params, JdbcEnvironment jdbcEnv) {
final String sequencePerEntitySuffix = ConfigurationHelper.getString( SequenceStyleGenerator.CONFIG_SEQUENCE_PER_ENTITY_SUFFIX, params, SequenceStyleGenerator.DEF_SEQUENCE_SUFFIX );
// JPA_ENTITY_NAME value honors <class ... entity-name="..."> (HBM) and @Entity#name (JPA) overrides.
final String defaultSequenceName = ConfigurationHelper.getBoolean( SequenceStyleGenerator.CONFIG_PREFER_SEQUENCE_PER_ENTITY, params, false )
? params.getProperty( JPA_ENTITY_NAME ) + sequencePerEntitySuffix
: SequenceStyleGenerator.DEF_SEQUENCE_NAME;
final String sequenceName = ConfigurationHelper.getString( SequenceStyleGenerator.SEQUENCE_PARAM, params, defaultSequenceName );
if ( sequenceName.contains( "." ) ) {
return QualifiedNameParser.INSTANCE.parse( sequenceName );
}
else {
final String schemaName = params.getProperty( PersistentIdentifierGenerator.SCHEMA );
if ( schemaName != null ) {
log.schemaOptionNotSupportedForSequenceGenerator( schemaName );
}
final String catalogName = params.getProperty( PersistentIdentifierGenerator.CATALOG );
if ( catalogName != null ) {
log.catalogOptionNotSupportedForSequenceGenerator( catalogName );
}
return new QualifiedNameParser.NameParts(
null,
null,
jdbcEnv.getIdentifierHelper().toIdentifier( sequenceName )
);
}
} | [
"protected",
"QualifiedName",
"determineSequenceName",
"(",
"Properties",
"params",
",",
"JdbcEnvironment",
"jdbcEnv",
")",
"{",
"final",
"String",
"sequencePerEntitySuffix",
"=",
"ConfigurationHelper",
".",
"getString",
"(",
"SequenceStyleGenerator",
".",
"CONFIG_SEQUENCE_... | NOTE: Copied from SequenceStyleGenerator
Determine the name of the sequence (or table if this resolves to a physical table)
to use.
<p>
Called during {@link #configure configuration}.
@param params The params supplied in the generator config (plus some standard useful extras).
@param jdbcEnv
@return The sequence name | [
"NOTE",
":",
"Copied",
"from",
"SequenceStyleGenerator"
] | train | https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/core/src/main/java/org/hibernate/ogm/id/impl/OgmSequenceGenerator.java#L119-L147 |
jmapper-framework/jmapper-core | JMapper Framework/src/main/java/com/googlecode/jmapper/RelationalJMapper.java | RelationalJMapper.destinationClassControl | private <I> I destinationClassControl(Exception exception, Class<I> clazz){
try{
if(clazz == null)throw new IllegalArgumentException("it's mandatory define the destination class");
}catch (Exception e) {JmapperLog.error(e);return null;}
return logAndReturnNull(exception);
} | java | private <I> I destinationClassControl(Exception exception, Class<I> clazz){
try{
if(clazz == null)throw new IllegalArgumentException("it's mandatory define the destination class");
}catch (Exception e) {JmapperLog.error(e);return null;}
return logAndReturnNull(exception);
} | [
"private",
"<",
"I",
">",
"I",
"destinationClassControl",
"(",
"Exception",
"exception",
",",
"Class",
"<",
"I",
">",
"clazz",
")",
"{",
"try",
"{",
"if",
"(",
"clazz",
"==",
"null",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"it's mandatory def... | This method verifies that the destinationClass exists.
@param exception exception to handle
@param clazz class to check
@return a new instance of Class given as input | [
"This",
"method",
"verifies",
"that",
"the",
"destinationClass",
"exists",
"."
] | train | https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/RelationalJMapper.java#L315-L320 |
netplex/json-smart-v2 | json-smart/src/main/java/net/minidev/json/parser/JSONParserReader.java | JSONParserReader.parse | public <T> T parse(Reader in, JsonReaderI<T> mapper) throws ParseException {
this.base = mapper.base;
//
this.in = in;
return super.parse(mapper);
} | java | public <T> T parse(Reader in, JsonReaderI<T> mapper) throws ParseException {
this.base = mapper.base;
//
this.in = in;
return super.parse(mapper);
} | [
"public",
"<",
"T",
">",
"T",
"parse",
"(",
"Reader",
"in",
",",
"JsonReaderI",
"<",
"T",
">",
"mapper",
")",
"throws",
"ParseException",
"{",
"this",
".",
"base",
"=",
"mapper",
".",
"base",
";",
"//",
"this",
".",
"in",
"=",
"in",
";",
"return",
... | use to return Primitive Type, or String, Or JsonObject or JsonArray
generated by a ContainerFactory | [
"use",
"to",
"return",
"Primitive",
"Type",
"or",
"String",
"Or",
"JsonObject",
"or",
"JsonArray",
"generated",
"by",
"a",
"ContainerFactory"
] | train | https://github.com/netplex/json-smart-v2/blob/bfb3daef039e22a7bbff5f76bf14ea23330cd70e/json-smart/src/main/java/net/minidev/json/parser/JSONParserReader.java#L51-L56 |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/MatrixFeatures_DDRM.java | MatrixFeatures_DDRM.isUpperTriangle | public static boolean isUpperTriangle(DMatrixRMaj A , int hessenberg , double tol ) {
for( int i = hessenberg+1; i < A.numRows; i++ ) {
int maxCol = Math.min(i-hessenberg, A.numCols);
for( int j = 0; j < maxCol; j++ ) {
if( !(Math.abs(A.unsafe_get(i,j)) <= tol) ) {
return false;
}
}
}
return true;
} | java | public static boolean isUpperTriangle(DMatrixRMaj A , int hessenberg , double tol ) {
for( int i = hessenberg+1; i < A.numRows; i++ ) {
int maxCol = Math.min(i-hessenberg, A.numCols);
for( int j = 0; j < maxCol; j++ ) {
if( !(Math.abs(A.unsafe_get(i,j)) <= tol) ) {
return false;
}
}
}
return true;
} | [
"public",
"static",
"boolean",
"isUpperTriangle",
"(",
"DMatrixRMaj",
"A",
",",
"int",
"hessenberg",
",",
"double",
"tol",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"hessenberg",
"+",
"1",
";",
"i",
"<",
"A",
".",
"numRows",
";",
"i",
"++",
")",
"{",
... | <p>
Checks to see if a matrix is upper triangular or Hessenberg. A Hessenberg matrix of degree N
has the following property:<br>
<br>
a<sub>ij</sub> ≤ 0 for all i < j+N<br>
<br>
A triangular matrix is a Hessenberg matrix of degree 0.
</p>
@param A Matrix being tested. Not modified.
@param hessenberg The degree of being hessenberg.
@param tol How close to zero the lower left elements need to be.
@return If it is an upper triangular/hessenberg matrix or not. | [
"<p",
">",
"Checks",
"to",
"see",
"if",
"a",
"matrix",
"is",
"upper",
"triangular",
"or",
"Hessenberg",
".",
"A",
"Hessenberg",
"matrix",
"of",
"degree",
"N",
"has",
"the",
"following",
"property",
":",
"<br",
">",
"<br",
">",
"a<sub",
">",
"ij<",
"/",... | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/MatrixFeatures_DDRM.java#L626-L636 |
avianey/facebook-api-android-maven | facebook/src/main/java/com/facebook/android/Facebook.java | Facebook.validateAppSignatureForPackage | private boolean validateAppSignatureForPackage(Context context, String packageName) {
PackageInfo packageInfo;
try {
packageInfo = context.getPackageManager().getPackageInfo(packageName, PackageManager.GET_SIGNATURES);
} catch (NameNotFoundException e) {
return false;
}
for (Signature signature : packageInfo.signatures) {
if (signature.toCharsString().equals(FB_APP_SIGNATURE)) {
return true;
}
}
return false;
} | java | private boolean validateAppSignatureForPackage(Context context, String packageName) {
PackageInfo packageInfo;
try {
packageInfo = context.getPackageManager().getPackageInfo(packageName, PackageManager.GET_SIGNATURES);
} catch (NameNotFoundException e) {
return false;
}
for (Signature signature : packageInfo.signatures) {
if (signature.toCharsString().equals(FB_APP_SIGNATURE)) {
return true;
}
}
return false;
} | [
"private",
"boolean",
"validateAppSignatureForPackage",
"(",
"Context",
"context",
",",
"String",
"packageName",
")",
"{",
"PackageInfo",
"packageInfo",
";",
"try",
"{",
"packageInfo",
"=",
"context",
".",
"getPackageManager",
"(",
")",
".",
"getPackageInfo",
"(",
... | Query the signature for the application that would be invoked by the
given intent and verify that it matches the FB application's signature.
@param context
@param packageName
@return true if the app's signature matches the expected signature. | [
"Query",
"the",
"signature",
"for",
"the",
"application",
"that",
"would",
"be",
"invoked",
"by",
"the",
"given",
"intent",
"and",
"verify",
"that",
"it",
"matches",
"the",
"FB",
"application",
"s",
"signature",
"."
] | train | https://github.com/avianey/facebook-api-android-maven/blob/ae6c7aa7ae45739ee19f18c1983e05f7e35b9ede/facebook/src/main/java/com/facebook/android/Facebook.java#L389-L404 |
VoltDB/voltdb | src/hsqldb19b3/org/hsqldb_voltpatches/persist/HsqlProperties.java | HsqlProperties.getIntegerProperty | public int getIntegerProperty(String key, int defaultValue, int[] values) {
String prop = getProperty(key);
int value = defaultValue;
try {
if (prop != null) {
value = Integer.parseInt(prop);
}
} catch (NumberFormatException e) {}
if (ArrayUtil.find(values, value) == -1) {
return defaultValue;
}
return value;
} | java | public int getIntegerProperty(String key, int defaultValue, int[] values) {
String prop = getProperty(key);
int value = defaultValue;
try {
if (prop != null) {
value = Integer.parseInt(prop);
}
} catch (NumberFormatException e) {}
if (ArrayUtil.find(values, value) == -1) {
return defaultValue;
}
return value;
} | [
"public",
"int",
"getIntegerProperty",
"(",
"String",
"key",
",",
"int",
"defaultValue",
",",
"int",
"[",
"]",
"values",
")",
"{",
"String",
"prop",
"=",
"getProperty",
"(",
"key",
")",
";",
"int",
"value",
"=",
"defaultValue",
";",
"try",
"{",
"if",
"... | Choice limited to values list, defaultValue must be in the values list. | [
"Choice",
"limited",
"to",
"values",
"list",
"defaultValue",
"must",
"be",
"in",
"the",
"values",
"list",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/persist/HsqlProperties.java#L175-L191 |
joniles/mpxj | src/main/java/net/sf/mpxj/Task.java | Task.addChildTask | public void addChildTask(Task child, int childOutlineLevel)
{
int outlineLevel = NumberHelper.getInt(getOutlineLevel());
if ((outlineLevel + 1) == childOutlineLevel)
{
m_children.add(child);
setSummary(true);
}
else
{
if (m_children.isEmpty() == false)
{
(m_children.get(m_children.size() - 1)).addChildTask(child, childOutlineLevel);
}
}
} | java | public void addChildTask(Task child, int childOutlineLevel)
{
int outlineLevel = NumberHelper.getInt(getOutlineLevel());
if ((outlineLevel + 1) == childOutlineLevel)
{
m_children.add(child);
setSummary(true);
}
else
{
if (m_children.isEmpty() == false)
{
(m_children.get(m_children.size() - 1)).addChildTask(child, childOutlineLevel);
}
}
} | [
"public",
"void",
"addChildTask",
"(",
"Task",
"child",
",",
"int",
"childOutlineLevel",
")",
"{",
"int",
"outlineLevel",
"=",
"NumberHelper",
".",
"getInt",
"(",
"getOutlineLevel",
"(",
")",
")",
";",
"if",
"(",
"(",
"outlineLevel",
"+",
"1",
")",
"==",
... | This method is used to associate a child task with the current
task instance. It has package access, and has been designed to
allow the hierarchical outline structure of tasks in an MPX
file to be constructed as the file is read in.
@param child Child task.
@param childOutlineLevel Outline level of the child task. | [
"This",
"method",
"is",
"used",
"to",
"associate",
"a",
"child",
"task",
"with",
"the",
"current",
"task",
"instance",
".",
"It",
"has",
"package",
"access",
"and",
"has",
"been",
"designed",
"to",
"allow",
"the",
"hierarchical",
"outline",
"structure",
"of"... | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/Task.java#L236-L252 |
Mozu/mozu-java | mozu-java-core/src/main/java/com/mozu/api/urls/commerce/customer/accounts/CustomerContactUrl.java | CustomerContactUrl.deleteAccountContactUrl | public static MozuUrl deleteAccountContactUrl(Integer accountId, Integer contactId)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/customer/accounts/{accountId}/contacts/{contactId}");
formatter.formatUrl("accountId", accountId);
formatter.formatUrl("contactId", contactId);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java | public static MozuUrl deleteAccountContactUrl(Integer accountId, Integer contactId)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/customer/accounts/{accountId}/contacts/{contactId}");
formatter.formatUrl("accountId", accountId);
formatter.formatUrl("contactId", contactId);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | [
"public",
"static",
"MozuUrl",
"deleteAccountContactUrl",
"(",
"Integer",
"accountId",
",",
"Integer",
"contactId",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
"(",
"\"/api/commerce/customer/accounts/{accountId}/contacts/{contactId}\"",
")",
";",
"for... | Get Resource Url for DeleteAccountContact
@param accountId Unique identifier of the customer account.
@param contactId Unique identifer of the customer account contact being updated.
@return String Resource Url | [
"Get",
"Resource",
"Url",
"for",
"DeleteAccountContact"
] | train | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/customer/accounts/CustomerContactUrl.java#L110-L116 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/internal/partition/impl/PartitionReplicaFragmentVersions.java | PartitionReplicaFragmentVersions.isStale | boolean isStale(long[] newVersions, int replicaIndex) {
int index = replicaIndex - 1;
long currentVersion = versions[index];
long newVersion = newVersions[index];
return currentVersion > newVersion;
} | java | boolean isStale(long[] newVersions, int replicaIndex) {
int index = replicaIndex - 1;
long currentVersion = versions[index];
long newVersion = newVersions[index];
return currentVersion > newVersion;
} | [
"boolean",
"isStale",
"(",
"long",
"[",
"]",
"newVersions",
",",
"int",
"replicaIndex",
")",
"{",
"int",
"index",
"=",
"replicaIndex",
"-",
"1",
";",
"long",
"currentVersion",
"=",
"versions",
"[",
"index",
"]",
";",
"long",
"newVersion",
"=",
"newVersions... | Returns whether given replica version is behind the current version or not.
@param newVersions new replica versions
@param replicaIndex replica index
@return true if given version is stale, false otherwise | [
"Returns",
"whether",
"given",
"replica",
"version",
"is",
"behind",
"the",
"current",
"version",
"or",
"not",
"."
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/partition/impl/PartitionReplicaFragmentVersions.java#L59-L64 |
apache/groovy | src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java | DefaultGroovyMethods.getAt | @SuppressWarnings("unchecked")
public static List<Boolean> getAt(boolean[] array, Collection indices) {
return primitiveArrayGet(array, indices);
} | java | @SuppressWarnings("unchecked")
public static List<Boolean> getAt(boolean[] array, Collection indices) {
return primitiveArrayGet(array, indices);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"List",
"<",
"Boolean",
">",
"getAt",
"(",
"boolean",
"[",
"]",
"array",
",",
"Collection",
"indices",
")",
"{",
"return",
"primitiveArrayGet",
"(",
"array",
",",
"indices",
")",
";",
... | Support the subscript operator with a collection for a boolean array
@param array a boolean array
@param indices a collection of indices for the items to retrieve
@return list of the booleans at the given indices
@since 1.0 | [
"Support",
"the",
"subscript",
"operator",
"with",
"a",
"collection",
"for",
"a",
"boolean",
"array"
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L14029-L14032 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.