repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
204
func_name
stringlengths
5
103
whole_func_string
stringlengths
87
3.44k
language
stringclasses
1 value
func_code_string
stringlengths
87
3.44k
func_code_tokens
listlengths
21
714
func_documentation_string
stringlengths
61
1.95k
func_documentation_tokens
listlengths
1
482
split_name
stringclasses
1 value
func_code_url
stringlengths
102
309
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/DateField.java
DateField.setDateTime
public int setDateTime(java.util.Date date, boolean bDisplayOption, int iMoveMode) { if (date == null) return this.setData(date, bDisplayOption, iMoveMode); m_calendar.setTime(date); m_calendar.set(Calendar.HOUR_OF_DAY, DBConstants.HOUR_DATE_ONLY); m_calendar.set(Calendar.MINUTE, 0); m_calendar.set(Calendar.SECOND, 0); m_calendar.set(Calendar.MILLISECOND, 0); date = m_calendar.getTime(); return this.setValue(date.getTime(), bDisplayOption, iMoveMode); }
java
public int setDateTime(java.util.Date date, boolean bDisplayOption, int iMoveMode) { if (date == null) return this.setData(date, bDisplayOption, iMoveMode); m_calendar.setTime(date); m_calendar.set(Calendar.HOUR_OF_DAY, DBConstants.HOUR_DATE_ONLY); m_calendar.set(Calendar.MINUTE, 0); m_calendar.set(Calendar.SECOND, 0); m_calendar.set(Calendar.MILLISECOND, 0); date = m_calendar.getTime(); return this.setValue(date.getTime(), bDisplayOption, iMoveMode); }
[ "public", "int", "setDateTime", "(", "java", ".", "util", ".", "Date", "date", ",", "boolean", "bDisplayOption", ",", "int", "iMoveMode", ")", "{", "if", "(", "date", "==", "null", ")", "return", "this", ".", "setData", "(", "date", ",", "bDisplayOption"...
Change the date and time of day. @param date The date to set (only date portion is used). @param bDisplayOption Display changed fields if true. @param iMoveMode The move mode. @return The error code (or NORMAL_RETURN).
[ "Change", "the", "date", "and", "time", "of", "day", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/DateField.java#L137-L148
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/metadata/SecurityServletConfiguratorHelper.java
SecurityServletConfiguratorHelper.createWebResourceCollections
private List<WebResourceCollection> createWebResourceCollections(com.ibm.ws.javaee.dd.web.common.SecurityConstraint archiveConstraint, boolean denyUncoveredHttpMethods) { List<WebResourceCollection> webResourceCollections = new ArrayList<WebResourceCollection>(); List<com.ibm.ws.javaee.dd.web.common.WebResourceCollection> archiveWebResourceCollections = archiveConstraint.getWebResourceCollections(); for (com.ibm.ws.javaee.dd.web.common.WebResourceCollection archiveWebResourceCollection : archiveWebResourceCollections) { List<String> urlPatterns = archiveWebResourceCollection.getURLPatterns(); List<String> methods = archiveWebResourceCollection.getHTTPMethods(); List<String> omissionMethods = archiveWebResourceCollection.getHTTPMethodOmissions(); webResourceCollections.add(new WebResourceCollection(urlPatterns, methods, omissionMethods, denyUncoveredHttpMethods)); } return webResourceCollections; }
java
private List<WebResourceCollection> createWebResourceCollections(com.ibm.ws.javaee.dd.web.common.SecurityConstraint archiveConstraint, boolean denyUncoveredHttpMethods) { List<WebResourceCollection> webResourceCollections = new ArrayList<WebResourceCollection>(); List<com.ibm.ws.javaee.dd.web.common.WebResourceCollection> archiveWebResourceCollections = archiveConstraint.getWebResourceCollections(); for (com.ibm.ws.javaee.dd.web.common.WebResourceCollection archiveWebResourceCollection : archiveWebResourceCollections) { List<String> urlPatterns = archiveWebResourceCollection.getURLPatterns(); List<String> methods = archiveWebResourceCollection.getHTTPMethods(); List<String> omissionMethods = archiveWebResourceCollection.getHTTPMethodOmissions(); webResourceCollections.add(new WebResourceCollection(urlPatterns, methods, omissionMethods, denyUncoveredHttpMethods)); } return webResourceCollections; }
[ "private", "List", "<", "WebResourceCollection", ">", "createWebResourceCollections", "(", "com", ".", "ibm", ".", "ws", ".", "javaee", ".", "dd", ".", "web", ".", "common", ".", "SecurityConstraint", "archiveConstraint", ",", "boolean", "denyUncoveredHttpMethods", ...
Gets a list of zero or more web resource collection objects that represent the web-resource-collection elements in web.xml and/or web-fragment.xml files. @param archiveConstraint the security-constraint @return a list of web resource collections
[ "Gets", "a", "list", "of", "zero", "or", "more", "web", "resource", "collection", "objects", "that", "represent", "the", "web", "-", "resource", "-", "collection", "elements", "in", "web", ".", "xml", "and", "/", "or", "web", "-", "fragment", ".", "xml",...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/metadata/SecurityServletConfiguratorHelper.java#L540-L550
mfornos/humanize
humanize-icu/src/main/java/humanize/ICUHumanize.java
ICUHumanize.compactDecimal
public static String compactDecimal(final Number value, final CompactStyle style, final Locale locale) { return withinLocale(new Callable<String>() { public String call() throws Exception { return compactDecimal(value, style); } }, locale); }
java
public static String compactDecimal(final Number value, final CompactStyle style, final Locale locale) { return withinLocale(new Callable<String>() { public String call() throws Exception { return compactDecimal(value, style); } }, locale); }
[ "public", "static", "String", "compactDecimal", "(", "final", "Number", "value", ",", "final", "CompactStyle", "style", ",", "final", "Locale", "locale", ")", "{", "return", "withinLocale", "(", "new", "Callable", "<", "String", ">", "(", ")", "{", "public",...
<p> Same as {@link #compactDecimal(Number, CompactStyle) compactDecimal} for the specified locale. </p> @param value The number to be abbreviated @param style The compaction style @param locale The locale @return a compact textual representation of the given value
[ "<p", ">", "Same", "as", "{", "@link", "#compactDecimal", "(", "Number", "CompactStyle", ")", "compactDecimal", "}", "for", "the", "specified", "locale", ".", "<", "/", "p", ">" ]
train
https://github.com/mfornos/humanize/blob/59fc103045de9d217c9e77dbcb7621f992f46c63/humanize-icu/src/main/java/humanize/ICUHumanize.java#L120-L129
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/FunctionTable.java
FunctionTable.installFunction
public int installFunction(String name, Class func) { int funcIndex; Object funcIndexObj = getFunctionID(name); if (null != funcIndexObj) { funcIndex = ((Integer) funcIndexObj).intValue(); if (funcIndex < NUM_BUILT_IN_FUNCS){ funcIndex = m_funcNextFreeIndex++; m_functionID_customer.put(name, new Integer(funcIndex)); } m_functions_customer[funcIndex - NUM_BUILT_IN_FUNCS] = func; } else { funcIndex = m_funcNextFreeIndex++; m_functions_customer[funcIndex-NUM_BUILT_IN_FUNCS] = func; m_functionID_customer.put(name, new Integer(funcIndex)); } return funcIndex; }
java
public int installFunction(String name, Class func) { int funcIndex; Object funcIndexObj = getFunctionID(name); if (null != funcIndexObj) { funcIndex = ((Integer) funcIndexObj).intValue(); if (funcIndex < NUM_BUILT_IN_FUNCS){ funcIndex = m_funcNextFreeIndex++; m_functionID_customer.put(name, new Integer(funcIndex)); } m_functions_customer[funcIndex - NUM_BUILT_IN_FUNCS] = func; } else { funcIndex = m_funcNextFreeIndex++; m_functions_customer[funcIndex-NUM_BUILT_IN_FUNCS] = func; m_functionID_customer.put(name, new Integer(funcIndex)); } return funcIndex; }
[ "public", "int", "installFunction", "(", "String", "name", ",", "Class", "func", ")", "{", "int", "funcIndex", ";", "Object", "funcIndexObj", "=", "getFunctionID", "(", "name", ")", ";", "if", "(", "null", "!=", "funcIndexObj", ")", "{", "funcIndex", "=", ...
Install a built-in function. @param name The unqualified name of the function, must not be null @param func A Implementation of an XPath Function object. @return the position of the function in the internal index.
[ "Install", "a", "built", "-", "in", "function", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/FunctionTable.java#L363-L389
jbundle/jbundle
base/screen/view/html/src/main/java/org/jbundle/base/screen/view/html/HBasePanel.java
HBasePanel.printHtmlLogo
public void printHtmlLogo(PrintWriter out, ResourceBundle reg) throws DBException { char chMenubar = HBasePanel.getFirstToUpper(this.getProperty(DBParams.LOGOS), 'H'); if (chMenubar == 'H') if (((BasePanel)this.getScreenField()).isMainMenu()) chMenubar = 'Y'; if (chMenubar == 'Y') { String strNav = reg.getString("htmlLogo"); strNav = Utility.replaceResources(strNav, reg, null, null); String strScreen = ((BasePanel)this.getScreenField()).getScreenURL(); strScreen = Utility.encodeXML(strScreen); String strUserName = ((MainApplication)this.getTask().getApplication()).getUserName(); if (Utility.isNumeric(strUserName)) strUserName = DBConstants.BLANK; String strLanguage = this.getTask().getApplication().getLanguage(false); strNav = Utility.replace(strNav, HtmlConstants.URL_TAG, strScreen); strNav = Utility.replace(strNav, HtmlConstants.USER_NAME_TAG, strUserName); strNav = Utility.replace(strNav, "<language/>", strLanguage); this.writeHtmlString(strNav, out); } }
java
public void printHtmlLogo(PrintWriter out, ResourceBundle reg) throws DBException { char chMenubar = HBasePanel.getFirstToUpper(this.getProperty(DBParams.LOGOS), 'H'); if (chMenubar == 'H') if (((BasePanel)this.getScreenField()).isMainMenu()) chMenubar = 'Y'; if (chMenubar == 'Y') { String strNav = reg.getString("htmlLogo"); strNav = Utility.replaceResources(strNav, reg, null, null); String strScreen = ((BasePanel)this.getScreenField()).getScreenURL(); strScreen = Utility.encodeXML(strScreen); String strUserName = ((MainApplication)this.getTask().getApplication()).getUserName(); if (Utility.isNumeric(strUserName)) strUserName = DBConstants.BLANK; String strLanguage = this.getTask().getApplication().getLanguage(false); strNav = Utility.replace(strNav, HtmlConstants.URL_TAG, strScreen); strNav = Utility.replace(strNav, HtmlConstants.USER_NAME_TAG, strUserName); strNav = Utility.replace(strNav, "<language/>", strLanguage); this.writeHtmlString(strNav, out); } }
[ "public", "void", "printHtmlLogo", "(", "PrintWriter", "out", ",", "ResourceBundle", "reg", ")", "throws", "DBException", "{", "char", "chMenubar", "=", "HBasePanel", ".", "getFirstToUpper", "(", "this", ".", "getProperty", "(", "DBParams", ".", "LOGOS", ")", ...
Print the top nav menu. @param out The html out stream. @param reg The resources object. @exception DBException File exception.
[ "Print", "the", "top", "nav", "menu", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/view/html/src/main/java/org/jbundle/base/screen/view/html/HBasePanel.java#L267-L288
couchbase/couchbase-java-client
src/main/java/com/couchbase/client/java/document/json/JsonObject.java
JsonObject.put
public JsonObject put(String name, JsonObject value) { if (this == value) { throw new IllegalArgumentException("Cannot put self"); } content.put(name, value); if (value != null) { Map<String, String> paths = value.encryptionPathInfo(); if (paths != null && !paths.isEmpty()) { for (Map.Entry<String, String> entry : paths.entrySet()) { addValueEncryptionInfo(name.replace("~", "~0").replace("/", "~1") + "/" + entry.getKey(), entry.getValue(), false); } value.clearEncryptionPaths(); } } return this; }
java
public JsonObject put(String name, JsonObject value) { if (this == value) { throw new IllegalArgumentException("Cannot put self"); } content.put(name, value); if (value != null) { Map<String, String> paths = value.encryptionPathInfo(); if (paths != null && !paths.isEmpty()) { for (Map.Entry<String, String> entry : paths.entrySet()) { addValueEncryptionInfo(name.replace("~", "~0").replace("/", "~1") + "/" + entry.getKey(), entry.getValue(), false); } value.clearEncryptionPaths(); } } return this; }
[ "public", "JsonObject", "put", "(", "String", "name", ",", "JsonObject", "value", ")", "{", "if", "(", "this", "==", "value", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Cannot put self\"", ")", ";", "}", "content", ".", "put", "(", "name...
Stores a {@link JsonObject} value identified by the field name. @param name the name of the JSON field. @param value the value of the JSON field. @return the {@link JsonObject}.
[ "Stores", "a", "{", "@link", "JsonObject", "}", "value", "identified", "by", "the", "field", "name", "." ]
train
https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/document/json/JsonObject.java#L675-L690
liferay/com-liferay-commerce
commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceOrderItemPersistenceImpl.java
CommerceOrderItemPersistenceImpl.findByC_S
@Override public List<CommerceOrderItem> findByC_S(long commerceOrderId, boolean subscription, int start, int end) { return findByC_S(commerceOrderId, subscription, start, end, null); }
java
@Override public List<CommerceOrderItem> findByC_S(long commerceOrderId, boolean subscription, int start, int end) { return findByC_S(commerceOrderId, subscription, start, end, null); }
[ "@", "Override", "public", "List", "<", "CommerceOrderItem", ">", "findByC_S", "(", "long", "commerceOrderId", ",", "boolean", "subscription", ",", "int", "start", ",", "int", "end", ")", "{", "return", "findByC_S", "(", "commerceOrderId", ",", "subscription", ...
Returns a range of all the commerce order items where commerceOrderId = &#63; and subscription = &#63;. <p> Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommerceOrderItemModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. </p> @param commerceOrderId the commerce order ID @param subscription the subscription @param start the lower bound of the range of commerce order items @param end the upper bound of the range of commerce order items (not inclusive) @return the range of matching commerce order items
[ "Returns", "a", "range", "of", "all", "the", "commerce", "order", "items", "where", "commerceOrderId", "=", "&#63", ";", "and", "subscription", "=", "&#63", ";", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceOrderItemPersistenceImpl.java#L2245-L2249
joniles/mpxj
src/main/java/net/sf/mpxj/fasttrack/FastTrackData.java
FastTrackData.logColumnData
private void logColumnData(int startIndex, int length) { if (m_log != null) { m_log.println(); m_log.println(FastTrackUtility.hexdump(m_buffer, startIndex, length, true, 16, "")); m_log.println(); m_log.flush(); } }
java
private void logColumnData(int startIndex, int length) { if (m_log != null) { m_log.println(); m_log.println(FastTrackUtility.hexdump(m_buffer, startIndex, length, true, 16, "")); m_log.println(); m_log.flush(); } }
[ "private", "void", "logColumnData", "(", "int", "startIndex", ",", "int", "length", ")", "{", "if", "(", "m_log", "!=", "null", ")", "{", "m_log", ".", "println", "(", ")", ";", "m_log", ".", "println", "(", "FastTrackUtility", ".", "hexdump", "(", "m_...
Log the data for a single column. @param startIndex offset into buffer @param length length
[ "Log", "the", "data", "for", "a", "single", "column", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/fasttrack/FastTrackData.java#L454-L463
mapfish/mapfish-print
core/src/main/java/org/mapfish/print/URIUtils.java
URIUtils.setQueryParams
public static URI setQueryParams(final URI initialUri, final Multimap<String, String> queryParams) { StringBuilder queryString = new StringBuilder(); for (Map.Entry<String, String> entry: queryParams.entries()) { if (queryString.length() > 0) { queryString.append("&"); } queryString.append(entry.getKey()).append("=").append(entry.getValue()); } try { if (initialUri.getHost() == null && initialUri.getAuthority() != null) { return new URI(initialUri.getScheme(), initialUri.getAuthority(), initialUri.getPath(), queryString.toString(), initialUri.getFragment()); } else { return new URI(initialUri.getScheme(), initialUri.getUserInfo(), initialUri.getHost(), initialUri.getPort(), initialUri.getPath(), queryString.toString(), initialUri.getFragment()); } } catch (URISyntaxException e) { throw ExceptionUtils.getRuntimeException(e); } }
java
public static URI setQueryParams(final URI initialUri, final Multimap<String, String> queryParams) { StringBuilder queryString = new StringBuilder(); for (Map.Entry<String, String> entry: queryParams.entries()) { if (queryString.length() > 0) { queryString.append("&"); } queryString.append(entry.getKey()).append("=").append(entry.getValue()); } try { if (initialUri.getHost() == null && initialUri.getAuthority() != null) { return new URI(initialUri.getScheme(), initialUri.getAuthority(), initialUri.getPath(), queryString.toString(), initialUri.getFragment()); } else { return new URI(initialUri.getScheme(), initialUri.getUserInfo(), initialUri.getHost(), initialUri.getPort(), initialUri.getPath(), queryString.toString(), initialUri.getFragment()); } } catch (URISyntaxException e) { throw ExceptionUtils.getRuntimeException(e); } }
[ "public", "static", "URI", "setQueryParams", "(", "final", "URI", "initialUri", ",", "final", "Multimap", "<", "String", ",", "String", ">", "queryParams", ")", "{", "StringBuilder", "queryString", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "Map...
Construct a new uri by replacing query parameters in initialUri with the query parameters provided. @param initialUri the initial/template URI @param queryParams the new query parameters.
[ "Construct", "a", "new", "uri", "by", "replacing", "query", "parameters", "in", "initialUri", "with", "the", "query", "parameters", "provided", "." ]
train
https://github.com/mapfish/mapfish-print/blob/25a452cb39f592bd8a53b20db1037703898e1e22/core/src/main/java/org/mapfish/print/URIUtils.java#L200-L222
OpenLiberty/open-liberty
dev/com.ibm.ws.security.wim.core/src/com/ibm/ws/security/wim/adapter/urbridge/utils/URBridgeEntity.java
URBridgeEntity.getGroupsForUser
public void getGroupsForUser(List<String> grpMbrshipAttrs, int countLimit) throws Exception { throw new WIMApplicationException(WIMMessageKey.METHOD_NOT_IMPLEMENTED, Tr.formatMessage(tc, WIMMessageKey.METHOD_NOT_IMPLEMENTED)); }
java
public void getGroupsForUser(List<String> grpMbrshipAttrs, int countLimit) throws Exception { throw new WIMApplicationException(WIMMessageKey.METHOD_NOT_IMPLEMENTED, Tr.formatMessage(tc, WIMMessageKey.METHOD_NOT_IMPLEMENTED)); }
[ "public", "void", "getGroupsForUser", "(", "List", "<", "String", ">", "grpMbrshipAttrs", ",", "int", "countLimit", ")", "throws", "Exception", "{", "throw", "new", "WIMApplicationException", "(", "WIMMessageKey", ".", "METHOD_NOT_IMPLEMENTED", ",", "Tr", ".", "fo...
Ensure that an exception will be thrown if this function is called but not implemented by the child class. @param grpMbrshipAttrs @throws Exception on all calls.
[ "Ensure", "that", "an", "exception", "will", "be", "thrown", "if", "this", "function", "is", "called", "but", "not", "implemented", "by", "the", "child", "class", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.wim.core/src/com/ibm/ws/security/wim/adapter/urbridge/utils/URBridgeEntity.java#L264-L266
arakelian/more-commons
src/main/java/com/arakelian/core/utils/XmlStreamReaderUtils.java
XmlStreamReaderUtils.requiredBooleanAttribute
public static boolean requiredBooleanAttribute(final XMLStreamReader reader, final String localName) throws XMLStreamException { return requiredBooleanAttribute(reader, null, localName); }
java
public static boolean requiredBooleanAttribute(final XMLStreamReader reader, final String localName) throws XMLStreamException { return requiredBooleanAttribute(reader, null, localName); }
[ "public", "static", "boolean", "requiredBooleanAttribute", "(", "final", "XMLStreamReader", "reader", ",", "final", "String", "localName", ")", "throws", "XMLStreamException", "{", "return", "requiredBooleanAttribute", "(", "reader", ",", "null", ",", "localName", ")"...
Returns the value of an attribute as a boolean. If the attribute is empty, this method throws an exception. @param reader <code>XMLStreamReader</code> that contains attribute values. @param localName local name of attribute (the namespace is ignored). @return value of attribute as boolean @throws XMLStreamException if attribute is empty.
[ "Returns", "the", "value", "of", "an", "attribute", "as", "a", "boolean", ".", "If", "the", "attribute", "is", "empty", "this", "method", "throws", "an", "exception", "." ]
train
https://github.com/arakelian/more-commons/blob/83c607044f64a7f6c005a67866c0ef7cb68d6e29/src/main/java/com/arakelian/core/utils/XmlStreamReaderUtils.java#L995-L998
citrusframework/citrus
modules/citrus-mail/src/main/java/com/consol/citrus/mail/message/MailMessageConverter.java
MailMessageConverter.getMailRequest
private MailRequest getMailRequest(Message message, MailEndpointConfiguration endpointConfiguration) { Object payload = message.getPayload(); MailRequest mailRequest = null; if (payload != null) { if (payload instanceof MailRequest) { mailRequest = (MailRequest) payload; } else { mailRequest = (MailRequest) endpointConfiguration.getMarshaller() .unmarshal(message.getPayload(Source.class)); } } if (mailRequest == null) { throw new CitrusRuntimeException("Unable to create proper mail message from payload: " + payload); } return mailRequest; }
java
private MailRequest getMailRequest(Message message, MailEndpointConfiguration endpointConfiguration) { Object payload = message.getPayload(); MailRequest mailRequest = null; if (payload != null) { if (payload instanceof MailRequest) { mailRequest = (MailRequest) payload; } else { mailRequest = (MailRequest) endpointConfiguration.getMarshaller() .unmarshal(message.getPayload(Source.class)); } } if (mailRequest == null) { throw new CitrusRuntimeException("Unable to create proper mail message from payload: " + payload); } return mailRequest; }
[ "private", "MailRequest", "getMailRequest", "(", "Message", "message", ",", "MailEndpointConfiguration", "endpointConfiguration", ")", "{", "Object", "payload", "=", "message", ".", "getPayload", "(", ")", ";", "MailRequest", "mailRequest", "=", "null", ";", "if", ...
Reads Citrus internal mail message model object from message payload. Either payload is actually a mail message object or XML payload String is unmarshalled to mail message object. @param message @param endpointConfiguration @return
[ "Reads", "Citrus", "internal", "mail", "message", "model", "object", "from", "message", "payload", ".", "Either", "payload", "is", "actually", "a", "mail", "message", "object", "or", "XML", "payload", "String", "is", "unmarshalled", "to", "mail", "message", "o...
train
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-mail/src/main/java/com/consol/citrus/mail/message/MailMessageConverter.java#L316-L334
google/error-prone
check_api/src/main/java/com/google/errorprone/matchers/Matchers.java
Matchers.constructorOfClass
public static Matcher<MethodTree> constructorOfClass(final String className) { return new Matcher<MethodTree>() { @Override public boolean matches(MethodTree methodTree, VisitorState state) { Symbol symbol = ASTHelpers.getSymbol(methodTree); return symbol.getEnclosingElement().getQualifiedName().contentEquals(className) && symbol.isConstructor(); } }; }
java
public static Matcher<MethodTree> constructorOfClass(final String className) { return new Matcher<MethodTree>() { @Override public boolean matches(MethodTree methodTree, VisitorState state) { Symbol symbol = ASTHelpers.getSymbol(methodTree); return symbol.getEnclosingElement().getQualifiedName().contentEquals(className) && symbol.isConstructor(); } }; }
[ "public", "static", "Matcher", "<", "MethodTree", ">", "constructorOfClass", "(", "final", "String", "className", ")", "{", "return", "new", "Matcher", "<", "MethodTree", ">", "(", ")", "{", "@", "Override", "public", "boolean", "matches", "(", "MethodTree", ...
Matches a constructor declaration in a specific enclosing class. @param className The fully-qualified name of the enclosing class, e.g. "com.google.common.base.Preconditions"
[ "Matches", "a", "constructor", "declaration", "in", "a", "specific", "enclosing", "class", "." ]
train
https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/check_api/src/main/java/com/google/errorprone/matchers/Matchers.java#L1032-L1041
navnorth/LRJavaLib
src/com/navnorth/learningregistry/LRImporter.java
LRImporter.getExtractResourceJSONData
public LRResult getExtractResourceJSONData(String dataServiceName, String viewName, String resource, Boolean partial, Date from, Date until, Boolean idsOnly) throws LRException { String path = getExtractRequestPath(dataServiceName, viewName, from, until, idsOnly, resource, partial, resourceParam); JSONObject json = getJSONFromPath(path); return new LRResult(json); }
java
public LRResult getExtractResourceJSONData(String dataServiceName, String viewName, String resource, Boolean partial, Date from, Date until, Boolean idsOnly) throws LRException { String path = getExtractRequestPath(dataServiceName, viewName, from, until, idsOnly, resource, partial, resourceParam); JSONObject json = getJSONFromPath(path); return new LRResult(json); }
[ "public", "LRResult", "getExtractResourceJSONData", "(", "String", "dataServiceName", ",", "String", "viewName", ",", "String", "resource", ",", "Boolean", "partial", ",", "Date", "from", ",", "Date", "until", ",", "Boolean", "idsOnly", ")", "throws", "LRException...
Get a result from an extract discriminator request @param dataServiceName the name of the data service to request through (e.g. resource-by-discriminator) @param viewName the name of the view to request through (e.g. standards-alignment-related) @param resource the resource for the request @param partial true/false if this is a partial start of a resource, rather than a full resource @param from the starting date from which to extract items @param until the ending date from which to extract items @param idsOnly true/false to only extract ids with this request @return result of the request
[ "Get", "a", "result", "from", "an", "extract", "discriminator", "request" ]
train
https://github.com/navnorth/LRJavaLib/blob/27af28b9f80d772273592414e7d0dccffaac09e1/src/com/navnorth/learningregistry/LRImporter.java#L375-L382
couchbase/couchbase-jvm-core
src/main/java/com/couchbase/client/core/message/query/RawQueryRequest.java
RawQueryRequest.jsonQuery
public static RawQueryRequest jsonQuery(String jsonQuery, String bucket, String password, String contextId) { return new RawQueryRequest(jsonQuery, bucket, bucket, password, null, contextId); }
java
public static RawQueryRequest jsonQuery(String jsonQuery, String bucket, String password, String contextId) { return new RawQueryRequest(jsonQuery, bucket, bucket, password, null, contextId); }
[ "public", "static", "RawQueryRequest", "jsonQuery", "(", "String", "jsonQuery", ",", "String", "bucket", ",", "String", "password", ",", "String", "contextId", ")", "{", "return", "new", "RawQueryRequest", "(", "jsonQuery", ",", "bucket", ",", "bucket", ",", "...
Create a {@link RawQueryRequest} containing a full N1QL query in Json form (including additional query parameters like named arguments, etc...). The simplest form of such a query is a single statement encapsulated in a json query object: <pre>{"statement":"SELECT * FROM default"}</pre>. @param jsonQuery the N1QL query in json form. @param bucket the bucket on which to perform the query. @param password the password for the target bucket. @param contextId the context id to store and use for tracing purposes. @return a {@link RawQueryRequest} for this full query.
[ "Create", "a", "{", "@link", "RawQueryRequest", "}", "containing", "a", "full", "N1QL", "query", "in", "Json", "form", "(", "including", "additional", "query", "parameters", "like", "named", "arguments", "etc", "...", ")", "." ]
train
https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/message/query/RawQueryRequest.java#L55-L57
strator-dev/greenpepper
greenpepper/greenpepper-client/src/main/java/com/greenpepper/server/domain/RepositoryTypeClass.java
RepositoryTypeClass.newInstance
public static RepositoryTypeClass newInstance(RepositoryType repositoryType, EnvironmentType envType, String className) { RepositoryTypeClass repoTypeClass = new RepositoryTypeClass(); repoTypeClass.setRepositoryType(repositoryType); repoTypeClass.setEnvType(envType); repoTypeClass.setClassName(className); return repoTypeClass; }
java
public static RepositoryTypeClass newInstance(RepositoryType repositoryType, EnvironmentType envType, String className) { RepositoryTypeClass repoTypeClass = new RepositoryTypeClass(); repoTypeClass.setRepositoryType(repositoryType); repoTypeClass.setEnvType(envType); repoTypeClass.setClassName(className); return repoTypeClass; }
[ "public", "static", "RepositoryTypeClass", "newInstance", "(", "RepositoryType", "repositoryType", ",", "EnvironmentType", "envType", ",", "String", "className", ")", "{", "RepositoryTypeClass", "repoTypeClass", "=", "new", "RepositoryTypeClass", "(", ")", ";", "repoTyp...
<p>newInstance.</p> @param repositoryType a {@link com.greenpepper.server.domain.RepositoryType} object. @param envType a {@link com.greenpepper.server.domain.EnvironmentType} object. @param className a {@link java.lang.String} object. @return a {@link com.greenpepper.server.domain.RepositoryTypeClass} object.
[ "<p", ">", "newInstance", ".", "<", "/", "p", ">" ]
train
https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper/greenpepper-client/src/main/java/com/greenpepper/server/domain/RepositoryTypeClass.java#L37-L45
motown-io/motown
vas/view-model/src/main/java/io/motown/vas/viewmodel/VasEventHandler.java
VasEventHandler.updateReservableForChargingStation
private void updateReservableForChargingStation(ChargingStationId chargingStationId, boolean reservable) { ChargingStation chargingStation = getChargingStation(chargingStationId); if (chargingStation != null) { chargingStation.setReservable(reservable); chargingStationRepository.createOrUpdate(chargingStation); } }
java
private void updateReservableForChargingStation(ChargingStationId chargingStationId, boolean reservable) { ChargingStation chargingStation = getChargingStation(chargingStationId); if (chargingStation != null) { chargingStation.setReservable(reservable); chargingStationRepository.createOrUpdate(chargingStation); } }
[ "private", "void", "updateReservableForChargingStation", "(", "ChargingStationId", "chargingStationId", ",", "boolean", "reservable", ")", "{", "ChargingStation", "chargingStation", "=", "getChargingStation", "(", "chargingStationId", ")", ";", "if", "(", "chargingStation",...
Updates the 'reservable' property of the charging station. If the charging station cannot be found in the repository an error is logged. @param chargingStationId charging station identifier. @param reservable true if the charging station is reservable, false otherwise.
[ "Updates", "the", "reservable", "property", "of", "the", "charging", "station", ".", "If", "the", "charging", "station", "cannot", "be", "found", "in", "the", "repository", "an", "error", "is", "logged", "." ]
train
https://github.com/motown-io/motown/blob/783ccda7c28b273a529ddd47defe8673b1ea365b/vas/view-model/src/main/java/io/motown/vas/viewmodel/VasEventHandler.java#L251-L258
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/MessageRetriever.java
MessageRetriever.printError
private void printError(SourcePosition pos, String msg) { configuration.root.printError(pos, msg); }
java
private void printError(SourcePosition pos, String msg) { configuration.root.printError(pos, msg); }
[ "private", "void", "printError", "(", "SourcePosition", "pos", ",", "String", "msg", ")", "{", "configuration", ".", "root", ".", "printError", "(", "pos", ",", "msg", ")", ";", "}" ]
Print error message, increment error count. @param pos the position of the source @param msg message to print
[ "Print", "error", "message", "increment", "error", "count", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/util/MessageRetriever.java#L135-L137
bitcoinj/bitcoinj
core/src/main/java/org/bitcoinj/core/Transaction.java
Transaction.addOutput
public TransactionOutput addOutput(Coin value, Address address) { return addOutput(new TransactionOutput(params, this, value, address)); }
java
public TransactionOutput addOutput(Coin value, Address address) { return addOutput(new TransactionOutput(params, this, value, address)); }
[ "public", "TransactionOutput", "addOutput", "(", "Coin", "value", ",", "Address", "address", ")", "{", "return", "addOutput", "(", "new", "TransactionOutput", "(", "params", ",", "this", ",", "value", ",", "address", ")", ")", ";", "}" ]
Creates an output based on the given address and value, adds it to this transaction, and returns the new output.
[ "Creates", "an", "output", "based", "on", "the", "given", "address", "and", "value", "adds", "it", "to", "this", "transaction", "and", "returns", "the", "new", "output", "." ]
train
https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/Transaction.java#L1041-L1043
eclipse/xtext-lib
org.eclipse.xtext.xbase.lib/src/org/eclipse/xtend2/lib/StringConcatenation.java
StringConcatenation.appendSegments
protected void appendSegments(String indentation, int index, List<String> otherSegments, String otherDelimiter) { if (otherSegments.isEmpty()) { return; } // This may not be accurate, but it's better than nothing growSegments(otherSegments.size()); for (String otherSegment : otherSegments) { if (otherDelimiter.equals(otherSegment)) { segments.add(index++, lineDelimiter); segments.add(index++, indentation); } else { segments.add(index++, otherSegment); } } cachedToString = null; }
java
protected void appendSegments(String indentation, int index, List<String> otherSegments, String otherDelimiter) { if (otherSegments.isEmpty()) { return; } // This may not be accurate, but it's better than nothing growSegments(otherSegments.size()); for (String otherSegment : otherSegments) { if (otherDelimiter.equals(otherSegment)) { segments.add(index++, lineDelimiter); segments.add(index++, indentation); } else { segments.add(index++, otherSegment); } } cachedToString = null; }
[ "protected", "void", "appendSegments", "(", "String", "indentation", ",", "int", "index", ",", "List", "<", "String", ">", "otherSegments", ",", "String", "otherDelimiter", ")", "{", "if", "(", "otherSegments", ".", "isEmpty", "(", ")", ")", "{", "return", ...
Add the list of segments to this sequence at the given index. The given indentation will be prepended to each line except the first one if the object has a multi-line string representation. @param indentation the indentation string that should be prepended. May not be <code>null</code>. @param index the index in this instance's list of segments. @param otherSegments the to-be-appended segments. May not be <code>null</code>. @param otherDelimiter the line delimiter that was used in the otherSegments list.
[ "Add", "the", "list", "of", "segments", "to", "this", "sequence", "at", "the", "given", "index", ".", "The", "given", "indentation", "will", "be", "prepended", "to", "each", "line", "except", "the", "first", "one", "if", "the", "object", "has", "a", "mul...
train
https://github.com/eclipse/xtext-lib/blob/7063572e1f1bd713a3aa53bdf3a8dc60e25c169a/org.eclipse.xtext.xbase.lib/src/org/eclipse/xtend2/lib/StringConcatenation.java#L376-L392
apache/incubator-atlas
client/src/main/java/org/apache/atlas/AtlasClient.java
AtlasClient.deleteEntity
public EntityResult deleteEntity(String entityType, String uniqueAttributeName, String uniqueAttributeValue) throws AtlasServiceException { LOG.debug("Deleting entity type: {}, attributeName: {}, attributeValue: {}", entityType, uniqueAttributeName, uniqueAttributeValue); API api = API.DELETE_ENTITY; WebResource resource = getResource(api); resource = resource.queryParam(TYPE, entityType); resource = resource.queryParam(ATTRIBUTE_NAME, uniqueAttributeName); resource = resource.queryParam(ATTRIBUTE_VALUE, uniqueAttributeValue); JSONObject jsonResponse = callAPIWithResource(API.DELETE_ENTITIES, resource); EntityResult results = extractEntityResult(jsonResponse); LOG.debug("Delete entities returned results: {}", results); return results; }
java
public EntityResult deleteEntity(String entityType, String uniqueAttributeName, String uniqueAttributeValue) throws AtlasServiceException { LOG.debug("Deleting entity type: {}, attributeName: {}, attributeValue: {}", entityType, uniqueAttributeName, uniqueAttributeValue); API api = API.DELETE_ENTITY; WebResource resource = getResource(api); resource = resource.queryParam(TYPE, entityType); resource = resource.queryParam(ATTRIBUTE_NAME, uniqueAttributeName); resource = resource.queryParam(ATTRIBUTE_VALUE, uniqueAttributeValue); JSONObject jsonResponse = callAPIWithResource(API.DELETE_ENTITIES, resource); EntityResult results = extractEntityResult(jsonResponse); LOG.debug("Delete entities returned results: {}", results); return results; }
[ "public", "EntityResult", "deleteEntity", "(", "String", "entityType", ",", "String", "uniqueAttributeName", ",", "String", "uniqueAttributeValue", ")", "throws", "AtlasServiceException", "{", "LOG", ".", "debug", "(", "\"Deleting entity type: {}, attributeName: {}, attribute...
Supports Deletion of an entity identified by its unique attribute value @param entityType Type of the entity being deleted @param uniqueAttributeName Attribute Name that uniquely identifies the entity @param uniqueAttributeValue Attribute Value that uniquely identifies the entity @return List of entity ids updated/deleted(including composite references from that entity)
[ "Supports", "Deletion", "of", "an", "entity", "identified", "by", "its", "unique", "attribute", "value" ]
train
https://github.com/apache/incubator-atlas/blob/e0d2cdc27c32742ebecd24db4cca62dc04dcdf4b/client/src/main/java/org/apache/atlas/AtlasClient.java#L616-L629
Bearded-Hen/Android-Bootstrap
AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/BootstrapDrawableFactory.java
BootstrapDrawableFactory.bootstrapButtonText
static ColorStateList bootstrapButtonText(Context context, boolean outline, BootstrapBrand brand) { int defaultColor = outline ? brand.defaultFill(context) : brand.defaultTextColor(context); int activeColor = outline ? ColorUtils.resolveColor(android.R.color.white, context) : brand.activeTextColor(context); int disabledColor = outline ? brand.disabledFill(context) : brand.disabledTextColor(context); if (outline && brand instanceof DefaultBootstrapBrand) { // special case DefaultBootstrapBrand db = (DefaultBootstrapBrand) brand; if (db == DefaultBootstrapBrand.SECONDARY) { defaultColor = ColorUtils.resolveColor(R.color.bootstrap_brand_secondary_border, context); disabledColor = defaultColor; } } return new ColorStateList(getStateList(), getColorList(defaultColor, activeColor, disabledColor)); }
java
static ColorStateList bootstrapButtonText(Context context, boolean outline, BootstrapBrand brand) { int defaultColor = outline ? brand.defaultFill(context) : brand.defaultTextColor(context); int activeColor = outline ? ColorUtils.resolveColor(android.R.color.white, context) : brand.activeTextColor(context); int disabledColor = outline ? brand.disabledFill(context) : brand.disabledTextColor(context); if (outline && brand instanceof DefaultBootstrapBrand) { // special case DefaultBootstrapBrand db = (DefaultBootstrapBrand) brand; if (db == DefaultBootstrapBrand.SECONDARY) { defaultColor = ColorUtils.resolveColor(R.color.bootstrap_brand_secondary_border, context); disabledColor = defaultColor; } } return new ColorStateList(getStateList(), getColorList(defaultColor, activeColor, disabledColor)); }
[ "static", "ColorStateList", "bootstrapButtonText", "(", "Context", "context", ",", "boolean", "outline", ",", "BootstrapBrand", "brand", ")", "{", "int", "defaultColor", "=", "outline", "?", "brand", ".", "defaultFill", "(", "context", ")", ":", "brand", ".", ...
Generates a colorstatelist for a bootstrap button @param context the current context @param outline whether the button is outlined @param brand the button brand @return the color state list
[ "Generates", "a", "colorstatelist", "for", "a", "bootstrap", "button" ]
train
https://github.com/Bearded-Hen/Android-Bootstrap/blob/b3d62cc1847e26d420c53c92665a4fe1e6ee7ecf/AndroidBootstrap/src/main/java/com/beardedhen/androidbootstrap/BootstrapDrawableFactory.java#L204-L219
bozaro/git-lfs-java
gitlfs-client/src/main/java/ru/bozaro/gitlfs/client/Client.java
Client.postBatch
@NotNull public BatchRes postBatch(@NotNull final BatchReq batchReq) throws IOException { return doWork(auth -> doRequest(auth, new JsonPost<>(batchReq, BatchRes.class), AuthHelper.join(auth.getHref(), PATH_BATCH)), batchReq.getOperation()); }
java
@NotNull public BatchRes postBatch(@NotNull final BatchReq batchReq) throws IOException { return doWork(auth -> doRequest(auth, new JsonPost<>(batchReq, BatchRes.class), AuthHelper.join(auth.getHref(), PATH_BATCH)), batchReq.getOperation()); }
[ "@", "NotNull", "public", "BatchRes", "postBatch", "(", "@", "NotNull", "final", "BatchReq", "batchReq", ")", "throws", "IOException", "{", "return", "doWork", "(", "auth", "->", "doRequest", "(", "auth", ",", "new", "JsonPost", "<>", "(", "batchReq", ",", ...
Send batch request to the LFS-server. @param batchReq Batch request. @return Object metadata. @throws IOException
[ "Send", "batch", "request", "to", "the", "LFS", "-", "server", "." ]
train
https://github.com/bozaro/git-lfs-java/blob/ee05bf0472ee61bf362cf93d283e5ee5d44ef685/gitlfs-client/src/main/java/ru/bozaro/gitlfs/client/Client.java#L116-L119
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/ancillary/RelatedClassMap.java
RelatedClassMap.isRelated
public boolean isRelated(Class<? extends ElementBase> sourceClass, Class<? extends ElementBase> targetClass) { return getCardinality(sourceClass, targetClass).maxOccurrences > 0; }
java
public boolean isRelated(Class<? extends ElementBase> sourceClass, Class<? extends ElementBase> targetClass) { return getCardinality(sourceClass, targetClass).maxOccurrences > 0; }
[ "public", "boolean", "isRelated", "(", "Class", "<", "?", "extends", "ElementBase", ">", "sourceClass", ",", "Class", "<", "?", "extends", "ElementBase", ">", "targetClass", ")", "{", "return", "getCardinality", "(", "sourceClass", ",", "targetClass", ")", "."...
Returns true if targetClass or a superclass of targetClass is related to sourceClass. @param sourceClass The primary class. @param targetClass The class to test. @return True if targetClass or a superclass of targetClass is related to sourceClass.
[ "Returns", "true", "if", "targetClass", "or", "a", "superclass", "of", "targetClass", "is", "related", "to", "sourceClass", "." ]
train
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/ancillary/RelatedClassMap.java#L186-L188
Wadpam/guja
guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDUserDaoImpl.java
GeneratedDUserDaoImpl.queryByLastName
public Iterable<DUser> queryByLastName(java.lang.String lastName) { return queryByField(null, DUserMapper.Field.LASTNAME.getFieldName(), lastName); }
java
public Iterable<DUser> queryByLastName(java.lang.String lastName) { return queryByField(null, DUserMapper.Field.LASTNAME.getFieldName(), lastName); }
[ "public", "Iterable", "<", "DUser", ">", "queryByLastName", "(", "java", ".", "lang", ".", "String", "lastName", ")", "{", "return", "queryByField", "(", "null", ",", "DUserMapper", ".", "Field", ".", "LASTNAME", ".", "getFieldName", "(", ")", ",", "lastNa...
query-by method for field lastName @param lastName the specified attribute @return an Iterable of DUsers for the specified lastName
[ "query", "-", "by", "method", "for", "field", "lastName" ]
train
https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDUserDaoImpl.java#L169-L171
ThreeTen/threeten-extra
src/main/java/org/threeten/extra/chrono/DiscordianDate.java
DiscordianDate.ofYearDay
static DiscordianDate ofYearDay(int prolepticYear, int dayOfYear) { DiscordianChronology.YEAR_RANGE.checkValidValue(prolepticYear, YEAR); DAY_OF_YEAR.checkValidValue(dayOfYear); boolean leap = DiscordianChronology.INSTANCE.isLeapYear(prolepticYear); if (dayOfYear == 366 && !leap) { throw new DateTimeException("Invalid date 'DayOfYear 366' as '" + prolepticYear + "' is not a leap year"); } if (leap) { if (dayOfYear == ST_TIBS_OFFSET) { // Take care of special case of St Tib's Day. return new DiscordianDate(prolepticYear, 0, 0); } else if (dayOfYear > ST_TIBS_OFFSET) { // Offset dayOfYear to account for added day. dayOfYear--; } } int month = (dayOfYear - 1) / DAYS_IN_MONTH + 1; int dayOfMonth = (dayOfYear - 1) % DAYS_IN_MONTH + 1; return new DiscordianDate(prolepticYear, month, dayOfMonth); }
java
static DiscordianDate ofYearDay(int prolepticYear, int dayOfYear) { DiscordianChronology.YEAR_RANGE.checkValidValue(prolepticYear, YEAR); DAY_OF_YEAR.checkValidValue(dayOfYear); boolean leap = DiscordianChronology.INSTANCE.isLeapYear(prolepticYear); if (dayOfYear == 366 && !leap) { throw new DateTimeException("Invalid date 'DayOfYear 366' as '" + prolepticYear + "' is not a leap year"); } if (leap) { if (dayOfYear == ST_TIBS_OFFSET) { // Take care of special case of St Tib's Day. return new DiscordianDate(prolepticYear, 0, 0); } else if (dayOfYear > ST_TIBS_OFFSET) { // Offset dayOfYear to account for added day. dayOfYear--; } } int month = (dayOfYear - 1) / DAYS_IN_MONTH + 1; int dayOfMonth = (dayOfYear - 1) % DAYS_IN_MONTH + 1; return new DiscordianDate(prolepticYear, month, dayOfMonth); }
[ "static", "DiscordianDate", "ofYearDay", "(", "int", "prolepticYear", ",", "int", "dayOfYear", ")", "{", "DiscordianChronology", ".", "YEAR_RANGE", ".", "checkValidValue", "(", "prolepticYear", ",", "YEAR", ")", ";", "DAY_OF_YEAR", ".", "checkValidValue", "(", "da...
Obtains a {@code DiscordianDate} representing a date in the Discordian calendar system from the proleptic-year and day-of-year fields. <p> This returns a {@code DiscordianDate} with the specified fields. The day must be valid for the year, otherwise an exception will be thrown. @param prolepticYear the Discordian proleptic-year @param dayOfYear the Discordian day-of-year, from 1 to 366 @return the date in Discordian calendar system, not null @throws DateTimeException if the value of any field is out of range, or if the day-of-year is invalid for the year
[ "Obtains", "a", "{", "@code", "DiscordianDate", "}", "representing", "a", "date", "in", "the", "Discordian", "calendar", "system", "from", "the", "proleptic", "-", "year", "and", "day", "-", "of", "-", "year", "fields", ".", "<p", ">", "This", "returns", ...
train
https://github.com/ThreeTen/threeten-extra/blob/e94ecd3592ef70e54d6eea21095239ea9ffbab78/src/main/java/org/threeten/extra/chrono/DiscordianDate.java#L229-L251
apache/flink
flink-java/src/main/java/org/apache/flink/api/java/ExecutionEnvironment.java
ExecutionEnvironment.registerCachedFile
public void registerCachedFile(String filePath, String name, boolean executable){ this.cacheFile.add(new Tuple2<>(name, new DistributedCacheEntry(filePath, executable))); }
java
public void registerCachedFile(String filePath, String name, boolean executable){ this.cacheFile.add(new Tuple2<>(name, new DistributedCacheEntry(filePath, executable))); }
[ "public", "void", "registerCachedFile", "(", "String", "filePath", ",", "String", "name", ",", "boolean", "executable", ")", "{", "this", ".", "cacheFile", ".", "add", "(", "new", "Tuple2", "<>", "(", "name", ",", "new", "DistributedCacheEntry", "(", "filePa...
Registers a file at the distributed cache under the given name. The file will be accessible from any user-defined function in the (distributed) runtime under a local path. Files may be local files (which will be distributed via BlobServer), or files in a distributed file system. The runtime will copy the files temporarily to a local cache, if needed. <p>The {@link org.apache.flink.api.common.functions.RuntimeContext} can be obtained inside UDFs via {@link org.apache.flink.api.common.functions.RichFunction#getRuntimeContext()} and provides access {@link org.apache.flink.api.common.cache.DistributedCache} via {@link org.apache.flink.api.common.functions.RuntimeContext#getDistributedCache()}. @param filePath The path of the file, as a URI (e.g. "file:///some/path" or "hdfs://host:port/and/path") @param name The name under which the file is registered. @param executable flag indicating whether the file should be executable
[ "Registers", "a", "file", "at", "the", "distributed", "cache", "under", "the", "given", "name", ".", "The", "file", "will", "be", "accessible", "from", "any", "user", "-", "defined", "function", "in", "the", "(", "distributed", ")", "runtime", "under", "a"...
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-java/src/main/java/org/apache/flink/api/java/ExecutionEnvironment.java#L878-L880
Azure/azure-sdk-for-java
sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerDnsAliasesInner.java
ServerDnsAliasesInner.getAsync
public Observable<ServerDnsAliasInner> getAsync(String resourceGroupName, String serverName, String dnsAliasName) { return getWithServiceResponseAsync(resourceGroupName, serverName, dnsAliasName).map(new Func1<ServiceResponse<ServerDnsAliasInner>, ServerDnsAliasInner>() { @Override public ServerDnsAliasInner call(ServiceResponse<ServerDnsAliasInner> response) { return response.body(); } }); }
java
public Observable<ServerDnsAliasInner> getAsync(String resourceGroupName, String serverName, String dnsAliasName) { return getWithServiceResponseAsync(resourceGroupName, serverName, dnsAliasName).map(new Func1<ServiceResponse<ServerDnsAliasInner>, ServerDnsAliasInner>() { @Override public ServerDnsAliasInner call(ServiceResponse<ServerDnsAliasInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ServerDnsAliasInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "dnsAliasName", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",", "serverName", ",", "d...
Gets a server DNS alias. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server that the alias is pointing to. @param dnsAliasName The name of the server DNS alias. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ServerDnsAliasInner object
[ "Gets", "a", "server", "DNS", "alias", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerDnsAliasesInner.java#L141-L148
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/DBInitializerHelper.java
DBInitializerHelper.prepareScripts
public static String prepareScripts(JDBCDataContainerConfig containerConfig) throws IOException { String itemTableSuffix = getItemTableSuffix(containerConfig); String valueTableSuffix = getValueTableSuffix(containerConfig); String refTableSuffix = getRefTableSuffix(containerConfig); boolean isolatedDB = containerConfig.dbStructureType == DatabaseStructureType.ISOLATED; return prepareScripts(containerConfig.initScriptPath, itemTableSuffix, valueTableSuffix, refTableSuffix, isolatedDB); }
java
public static String prepareScripts(JDBCDataContainerConfig containerConfig) throws IOException { String itemTableSuffix = getItemTableSuffix(containerConfig); String valueTableSuffix = getValueTableSuffix(containerConfig); String refTableSuffix = getRefTableSuffix(containerConfig); boolean isolatedDB = containerConfig.dbStructureType == DatabaseStructureType.ISOLATED; return prepareScripts(containerConfig.initScriptPath, itemTableSuffix, valueTableSuffix, refTableSuffix, isolatedDB); }
[ "public", "static", "String", "prepareScripts", "(", "JDBCDataContainerConfig", "containerConfig", ")", "throws", "IOException", "{", "String", "itemTableSuffix", "=", "getItemTableSuffix", "(", "containerConfig", ")", ";", "String", "valueTableSuffix", "=", "getValueTabl...
Returns SQL scripts for initialization database for defined {@link JDBCDataContainerConfig}.
[ "Returns", "SQL", "scripts", "for", "initialization", "database", "for", "defined", "{" ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/DBInitializerHelper.java#L58-L67
OpenLiberty/open-liberty
dev/com.ibm.ws.ras.instrument/src/com/ibm/ws/ras/instrument/internal/bci/AbstractRasMethodAdapter.java
AbstractRasMethodAdapter.visitAnnotation
@Override public AnnotationVisitor visitAnnotation(String desc, boolean visible) { AnnotationVisitor av = super.visitAnnotation(desc, visible); observedAnnotations.add(Type.getType(desc)); if (desc.equals(INJECTED_TRACE_TYPE.getDescriptor())) { injectedTraceAnnotationVisitor = new InjectedTraceAnnotationVisitor(av, getClass()); av = injectedTraceAnnotationVisitor; } return av; }
java
@Override public AnnotationVisitor visitAnnotation(String desc, boolean visible) { AnnotationVisitor av = super.visitAnnotation(desc, visible); observedAnnotations.add(Type.getType(desc)); if (desc.equals(INJECTED_TRACE_TYPE.getDescriptor())) { injectedTraceAnnotationVisitor = new InjectedTraceAnnotationVisitor(av, getClass()); av = injectedTraceAnnotationVisitor; } return av; }
[ "@", "Override", "public", "AnnotationVisitor", "visitAnnotation", "(", "String", "desc", ",", "boolean", "visible", ")", "{", "AnnotationVisitor", "av", "=", "super", ".", "visitAnnotation", "(", "desc", ",", "visible", ")", ";", "observedAnnotations", ".", "ad...
Visit the method annotations looking at the supported RAS annotations. The visitors are only used when a {@code MethodInfo} model object was not provided during construction. @param desc the annotation descriptor @param visible true if the annotation is a runtime visible annotation
[ "Visit", "the", "method", "annotations", "looking", "at", "the", "supported", "RAS", "annotations", ".", "The", "visitors", "are", "only", "used", "when", "a", "{", "@code", "MethodInfo", "}", "model", "object", "was", "not", "provided", "during", "constructio...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ras.instrument/src/com/ibm/ws/ras/instrument/internal/bci/AbstractRasMethodAdapter.java#L332-L341
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/builder/ToStringStyle.java
ToStringStyle.appendCyclicObject
protected void appendCyclicObject(final StringBuffer buffer, final String fieldName, final Object value) { ObjectUtils.identityToString(buffer, value); }
java
protected void appendCyclicObject(final StringBuffer buffer, final String fieldName, final Object value) { ObjectUtils.identityToString(buffer, value); }
[ "protected", "void", "appendCyclicObject", "(", "final", "StringBuffer", "buffer", ",", "final", "String", "fieldName", ",", "final", "Object", "value", ")", "{", "ObjectUtils", ".", "identityToString", "(", "buffer", ",", "value", ")", ";", "}" ]
<p>Append to the <code>toString</code> an <code>Object</code> value that has been detected to participate in a cycle. This implementation will print the standard string value of the value.</p> @param buffer the <code>StringBuffer</code> to populate @param fieldName the field name, typically not used as already appended @param value the value to add to the <code>toString</code>, not <code>null</code> @since 2.2
[ "<p", ">", "Append", "to", "the", "<code", ">", "toString<", "/", "code", ">", "an", "<code", ">", "Object<", "/", "code", ">", "value", "that", "has", "been", "detected", "to", "participate", "in", "a", "cycle", ".", "This", "implementation", "will", ...
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/builder/ToStringStyle.java#L612-L614
wiselenium/wiselenium
wiselenium-factory/src/main/java/com/github/wiselenium/Wiselenium.java
Wiselenium.decorateElement
public static <E> E decorateElement(Class<E> clazz, WebElement webElement) { WiseDecorator decorator = new WiseDecorator(new DefaultElementLocatorFactory(webElement)); return decorator.decorate(clazz, webElement); }
java
public static <E> E decorateElement(Class<E> clazz, WebElement webElement) { WiseDecorator decorator = new WiseDecorator(new DefaultElementLocatorFactory(webElement)); return decorator.decorate(clazz, webElement); }
[ "public", "static", "<", "E", ">", "E", "decorateElement", "(", "Class", "<", "E", ">", "clazz", ",", "WebElement", "webElement", ")", "{", "WiseDecorator", "decorator", "=", "new", "WiseDecorator", "(", "new", "DefaultElementLocatorFactory", "(", "webElement", ...
Decorates a webElement. @param clazz The class of the decorated element. Must be either WebElement or a type annotated with Component or Frame. @param webElement The webElement that will be decorated. @return The decorated element or null if the type isn't supported. @since 0.3.0
[ "Decorates", "a", "webElement", "." ]
train
https://github.com/wiselenium/wiselenium/blob/15de6484d8f516b3d02391d3bd6a56a03e632706/wiselenium-factory/src/main/java/com/github/wiselenium/Wiselenium.java#L86-L89
dashorst/wicket-stuff-markup-validator
jing/src/main/java/com/thaiopensource/xml/util/Name.java
Name.compare
static public int compare(Name n1, Name n2) { int ret = n1.namespaceUri.compareTo(n2.namespaceUri); if (ret != 0) return ret; return n1.localName.compareTo(n2.localName); }
java
static public int compare(Name n1, Name n2) { int ret = n1.namespaceUri.compareTo(n2.namespaceUri); if (ret != 0) return ret; return n1.localName.compareTo(n2.localName); }
[ "static", "public", "int", "compare", "(", "Name", "n1", ",", "Name", "n2", ")", "{", "int", "ret", "=", "n1", ".", "namespaceUri", ".", "compareTo", "(", "n2", ".", "namespaceUri", ")", ";", "if", "(", "ret", "!=", "0", ")", "return", "ret", ";", ...
We include this, but don't derive from Comparator<Name> to avoid a dependency on Java 5.
[ "We", "include", "this", "but", "don", "t", "derive", "from", "Comparator<Name", ">", "to", "avoid", "a", "dependency", "on", "Java", "5", "." ]
train
https://github.com/dashorst/wicket-stuff-markup-validator/blob/9e529a4dc8bfdbbe4c794f3132ef400a006560a1/jing/src/main/java/com/thaiopensource/xml/util/Name.java#L36-L41
UrielCh/ovh-java-sdk
ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java
ApiOvhOrder.dedicatedCloud_serviceName_filer_GET
public ArrayList<String> dedicatedCloud_serviceName_filer_GET(String serviceName, Long datacenterId, String name, Long quantity) throws IOException { String qPath = "/order/dedicatedCloud/{serviceName}/filer"; StringBuilder sb = path(qPath, serviceName); query(sb, "datacenterId", datacenterId); query(sb, "name", name); query(sb, "quantity", quantity); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t1); }
java
public ArrayList<String> dedicatedCloud_serviceName_filer_GET(String serviceName, Long datacenterId, String name, Long quantity) throws IOException { String qPath = "/order/dedicatedCloud/{serviceName}/filer"; StringBuilder sb = path(qPath, serviceName); query(sb, "datacenterId", datacenterId); query(sb, "name", name); query(sb, "quantity", quantity); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t1); }
[ "public", "ArrayList", "<", "String", ">", "dedicatedCloud_serviceName_filer_GET", "(", "String", "serviceName", ",", "Long", "datacenterId", ",", "String", "name", ",", "Long", "quantity", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/order/dedicat...
Get allowed durations for 'filer' option REST: GET /order/dedicatedCloud/{serviceName}/filer @param name [required] Filer profile you want to order ("name" field in a profile returned by /dedicatedCloud/{serviceName}/datacenter/{datacenterId}/orderableFilerProfiles) @param quantity [required] Quantity of filer you want to order (default 1) @param datacenterId [required] Datacenter where the filer will be mounted (if not precised, will be mounted in each Datacenter of this Private Cloud) @param serviceName [required]
[ "Get", "allowed", "durations", "for", "filer", "option" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L5541-L5549
TheCoder4eu/BootsFaces-OSP
src/main/java/net/bootsfaces/component/dropMenu/DropMenuRenderer.java
DropMenuRenderer.encodeEnd
@Override public void encodeEnd(FacesContext context, UIComponent component) throws IOException { if (!component.isRendered()) { return; } DropMenu dropMenu = (DropMenu) component; ResponseWriter rw = context.getResponseWriter(); rw.endElement("ul"); boolean isFlyOutMenu = isFlyOutMenu(component); String htmlTag = determineHtmlTag(component, isFlyOutMenu); rw.endElement(htmlTag); Tooltip.activateTooltips(context, dropMenu); }
java
@Override public void encodeEnd(FacesContext context, UIComponent component) throws IOException { if (!component.isRendered()) { return; } DropMenu dropMenu = (DropMenu) component; ResponseWriter rw = context.getResponseWriter(); rw.endElement("ul"); boolean isFlyOutMenu = isFlyOutMenu(component); String htmlTag = determineHtmlTag(component, isFlyOutMenu); rw.endElement(htmlTag); Tooltip.activateTooltips(context, dropMenu); }
[ "@", "Override", "public", "void", "encodeEnd", "(", "FacesContext", "context", ",", "UIComponent", "component", ")", "throws", "IOException", "{", "if", "(", "!", "component", ".", "isRendered", "(", ")", ")", "{", "return", ";", "}", "DropMenu", "dropMenu"...
This methods generates the HTML code of the current b:dropMenu. <code>encodeBegin</code> generates the start of the component. After the, the JSF framework calls <code>encodeChildren()</code> to generate the HTML code between the beginning and the end of the component. For instance, in the case of a panel component the content of the panel is generated by <code>encodeChildren()</code>. After that, <code>encodeEnd()</code> is called to generate the rest of the HTML code. @param context the FacesContext. @param component the current b:dropMenu. @throws IOException thrown if something goes wrong when writing the HTML code.
[ "This", "methods", "generates", "the", "HTML", "code", "of", "the", "current", "b", ":", "dropMenu", ".", "<code", ">", "encodeBegin<", "/", "code", ">", "generates", "the", "start", "of", "the", "component", ".", "After", "the", "the", "JSF", "framework",...
train
https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/component/dropMenu/DropMenuRenderer.java#L236-L250
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java
HtmlDocletWriter.getQualifiedClassLink
public Content getQualifiedClassLink(LinkInfoImpl.Kind context, ClassDoc cd) { return getLink(new LinkInfoImpl(configuration, context, cd) .label(configuration.getClassName(cd))); }
java
public Content getQualifiedClassLink(LinkInfoImpl.Kind context, ClassDoc cd) { return getLink(new LinkInfoImpl(configuration, context, cd) .label(configuration.getClassName(cd))); }
[ "public", "Content", "getQualifiedClassLink", "(", "LinkInfoImpl", ".", "Kind", "context", ",", "ClassDoc", "cd", ")", "{", "return", "getLink", "(", "new", "LinkInfoImpl", "(", "configuration", ",", "context", ",", "cd", ")", ".", "label", "(", "configuration...
Get the class link. @param context the id of the context where the link will be added @param cd the class doc to link to @return a content tree for the link
[ "Get", "the", "class", "link", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java#L1097-L1100
code4everything/util
src/main/java/com/zhazhapan/util/office/MsUtils.java
MsUtils.writeTo
public static void writeTo(Object object, String path) throws IOException, NoSuchMethodException, IllegalAccessException, InvocationTargetException { OutputStream os = new FileOutputStream(path); ReflectUtils.invokeMethod(object, "write", new Class<?>[]{OutputStream.class}, new Object[]{os}); os.close(); logger.info("文件已输出:" + path); }
java
public static void writeTo(Object object, String path) throws IOException, NoSuchMethodException, IllegalAccessException, InvocationTargetException { OutputStream os = new FileOutputStream(path); ReflectUtils.invokeMethod(object, "write", new Class<?>[]{OutputStream.class}, new Object[]{os}); os.close(); logger.info("文件已输出:" + path); }
[ "public", "static", "void", "writeTo", "(", "Object", "object", ",", "String", "path", ")", "throws", "IOException", ",", "NoSuchMethodException", ",", "IllegalAccessException", ",", "InvocationTargetException", "{", "OutputStream", "os", "=", "new", "FileOutputStream...
保存Office文档 @param object {@link POIXMLDocument} 对象 @param path 输出路径 @throws IOException 异常 @throws NoSuchMethodException 异常 @throws IllegalAccessException 异常 @throws InvocationTargetException 异常
[ "保存Office文档" ]
train
https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/office/MsUtils.java#L34-L40
akquinet/maven-latex-plugin
maven-latex-plugin/src/main/java/org/m2latex/mojo/TexFileUtilsImpl.java
TexFileUtilsImpl.getTargetDirectory
File getTargetDirectory( File sourceFile, File sourceBaseDir, File targetBaseDir ) throws MojoExecutionException, MojoFailureException { String filePath; String tempPath; try { filePath = sourceFile.getParentFile().getCanonicalPath(); tempPath = sourceBaseDir.getCanonicalPath(); } catch ( IOException e ) { throw new MojoExecutionException( "Error getting canonical path", e ); } if ( !filePath.startsWith( tempPath ) ) { throw new MojoFailureException( "File " + sourceFile + " is expected to be somewhere under the following directory: " + tempPath ); } File targetDir = new File( targetBaseDir, filePath.substring( tempPath.length() ) ); return targetDir; }
java
File getTargetDirectory( File sourceFile, File sourceBaseDir, File targetBaseDir ) throws MojoExecutionException, MojoFailureException { String filePath; String tempPath; try { filePath = sourceFile.getParentFile().getCanonicalPath(); tempPath = sourceBaseDir.getCanonicalPath(); } catch ( IOException e ) { throw new MojoExecutionException( "Error getting canonical path", e ); } if ( !filePath.startsWith( tempPath ) ) { throw new MojoFailureException( "File " + sourceFile + " is expected to be somewhere under the following directory: " + tempPath ); } File targetDir = new File( targetBaseDir, filePath.substring( tempPath.length() ) ); return targetDir; }
[ "File", "getTargetDirectory", "(", "File", "sourceFile", ",", "File", "sourceBaseDir", ",", "File", "targetBaseDir", ")", "throws", "MojoExecutionException", ",", "MojoFailureException", "{", "String", "filePath", ";", "String", "tempPath", ";", "try", "{", "filePat...
E.g. sourceFile /tmp/adir/afile, sourceBaseDir /tmp, targetBaseDir /home returns /home/adir/
[ "E", ".", "g", ".", "sourceFile", "/", "tmp", "/", "adir", "/", "afile", "sourceBaseDir", "/", "tmp", "targetBaseDir", "/", "home", "returns", "/", "home", "/", "adir", "/" ]
train
https://github.com/akquinet/maven-latex-plugin/blob/bba6241eab5b3f2aceb9c7b79a082302709383ac/maven-latex-plugin/src/main/java/org/m2latex/mojo/TexFileUtilsImpl.java#L130-L153
Kurento/kurento-module-creator
src/main/java/org/kurento/modulecreator/VersionManager.java
VersionManager.versionCompare
public static Integer versionCompare(String str1, String str2) { String[] vals1 = str1.split("\\."); String[] vals2 = str2.split("\\."); int idx = 0; // set index to first non-equal ordinal or length of shortest version // string while (idx < vals1.length && idx < vals2.length && vals1[idx].equals(vals2[idx])) { idx++; } // compare first non-equal ordinal number if (idx < vals1.length && idx < vals2.length) { int diff = Integer.valueOf(vals1[idx]).compareTo(Integer.valueOf(vals2[idx])); return Integer.signum(diff); } else { // the strings are equal or one string is a substring of the other // e.g. "1.2.3" = "1.2.3" or "1.2.3" < "1.2.3.4" return Integer.signum(vals1.length - vals2.length); } }
java
public static Integer versionCompare(String str1, String str2) { String[] vals1 = str1.split("\\."); String[] vals2 = str2.split("\\."); int idx = 0; // set index to first non-equal ordinal or length of shortest version // string while (idx < vals1.length && idx < vals2.length && vals1[idx].equals(vals2[idx])) { idx++; } // compare first non-equal ordinal number if (idx < vals1.length && idx < vals2.length) { int diff = Integer.valueOf(vals1[idx]).compareTo(Integer.valueOf(vals2[idx])); return Integer.signum(diff); } else { // the strings are equal or one string is a substring of the other // e.g. "1.2.3" = "1.2.3" or "1.2.3" < "1.2.3.4" return Integer.signum(vals1.length - vals2.length); } }
[ "public", "static", "Integer", "versionCompare", "(", "String", "str1", ",", "String", "str2", ")", "{", "String", "[", "]", "vals1", "=", "str1", ".", "split", "(", "\"\\\\.\"", ")", ";", "String", "[", "]", "vals2", "=", "str2", ".", "split", "(", ...
Compares two version strings. <p> Use this instead of String.compareTo() for a non-lexicographical comparison that works for version strings. e.g. "1.10".compareTo("1.6"). </p> @note It does not work if "1.10" is supposed to be equal to "1.10.0". @param str1 a string of ordinal numbers separated by decimal points. @param str2 a string of ordinal numbers separated by decimal points. @return The result is a negative integer if str1 is _numerically_ less than str2. The result is a positive integer if str1 is _numerically_ greater than str2. The result is zero if the strings are _numerically_ equal.
[ "Compares", "two", "version", "strings", "." ]
train
https://github.com/Kurento/kurento-module-creator/blob/c371516c665b902b5476433496a5aefcbca86d64/src/main/java/org/kurento/modulecreator/VersionManager.java#L268-L288
vladmihalcea/flexy-pool
flexy-pool-core/src/main/java/com/vladmihalcea/flexypool/connection/ConnectionProxyFactory.java
ConnectionProxyFactory.newInstance
public Connection newInstance(Connection target, ConnectionPoolCallback connectionPoolCallback) { return proxyConnection(target, new ConnectionCallback(connectionPoolCallback)); }
java
public Connection newInstance(Connection target, ConnectionPoolCallback connectionPoolCallback) { return proxyConnection(target, new ConnectionCallback(connectionPoolCallback)); }
[ "public", "Connection", "newInstance", "(", "Connection", "target", ",", "ConnectionPoolCallback", "connectionPoolCallback", ")", "{", "return", "proxyConnection", "(", "target", ",", "new", "ConnectionCallback", "(", "connectionPoolCallback", ")", ")", ";", "}" ]
Creates a ConnectionProxy for the specified target and attaching the following callback. @param target connection to proxy @param connectionPoolCallback attaching connection lifecycle listener @return ConnectionProxy
[ "Creates", "a", "ConnectionProxy", "for", "the", "specified", "target", "and", "attaching", "the", "following", "callback", "." ]
train
https://github.com/vladmihalcea/flexy-pool/blob/d763d359e68299c2b4e28e4b67770581ae083431/flexy-pool-core/src/main/java/com/vladmihalcea/flexypool/connection/ConnectionProxyFactory.java#L23-L25
MTDdk/jawn
jawn-core-new/src/main/java/net/javapla/jawn/core/internal/reflection/DynamicClassFactory.java
DynamicClassFactory.getCompiledClass
public final static Class<?> getCompiledClass(String fullClassName, boolean useCache) throws Err.Compilation, Err.UnloadableClass { try { if (! useCache) { DynamicClassLoader dynamicClassLoader = new DynamicClassLoader(fullClassName.substring(0, fullClassName.lastIndexOf('.'))); Class<?> cl = dynamicClassLoader.loadClass(fullClassName); dynamicClassLoader = null; return cl; } else { return CACHED_CONTROLLERS.computeIfAbsent(fullClassName, WRAP_FORNAME); } } catch (Exception e) { throw new Err.UnloadableClass(e); } }
java
public final static Class<?> getCompiledClass(String fullClassName, boolean useCache) throws Err.Compilation, Err.UnloadableClass { try { if (! useCache) { DynamicClassLoader dynamicClassLoader = new DynamicClassLoader(fullClassName.substring(0, fullClassName.lastIndexOf('.'))); Class<?> cl = dynamicClassLoader.loadClass(fullClassName); dynamicClassLoader = null; return cl; } else { return CACHED_CONTROLLERS.computeIfAbsent(fullClassName, WRAP_FORNAME); } } catch (Exception e) { throw new Err.UnloadableClass(e); } }
[ "public", "final", "static", "Class", "<", "?", ">", "getCompiledClass", "(", "String", "fullClassName", ",", "boolean", "useCache", ")", "throws", "Err", ".", "Compilation", ",", "Err", ".", "UnloadableClass", "{", "try", "{", "if", "(", "!", "useCache", ...
Handles caching of classes if not useCache @param fullClassName including package name @param useCache flag to specify whether to cache the controller or not @return @throws CompilationException @throws ClassLoadException
[ "Handles", "caching", "of", "classes", "if", "not", "useCache" ]
train
https://github.com/MTDdk/jawn/blob/4ec2d09b97d413efdead7487e6075e5bfd13b925/jawn-core-new/src/main/java/net/javapla/jawn/core/internal/reflection/DynamicClassFactory.java#L68-L81
Alluxio/alluxio
core/server/worker/src/main/java/alluxio/worker/file/FileDataManager.java
FileDataManager.prepareUfsFilePath
private String prepareUfsFilePath(FileInfo fileInfo, UnderFileSystem ufs) throws AlluxioException, IOException { AlluxioURI alluxioPath = new AlluxioURI(fileInfo.getPath()); FileSystem fs = mFileSystemFactory.get(); URIStatus status = fs.getStatus(alluxioPath); String ufsPath = status.getUfsPath(); UnderFileSystemUtils.prepareFilePath(alluxioPath, ufsPath, fs, ufs); return ufsPath; }
java
private String prepareUfsFilePath(FileInfo fileInfo, UnderFileSystem ufs) throws AlluxioException, IOException { AlluxioURI alluxioPath = new AlluxioURI(fileInfo.getPath()); FileSystem fs = mFileSystemFactory.get(); URIStatus status = fs.getStatus(alluxioPath); String ufsPath = status.getUfsPath(); UnderFileSystemUtils.prepareFilePath(alluxioPath, ufsPath, fs, ufs); return ufsPath; }
[ "private", "String", "prepareUfsFilePath", "(", "FileInfo", "fileInfo", ",", "UnderFileSystem", "ufs", ")", "throws", "AlluxioException", ",", "IOException", "{", "AlluxioURI", "alluxioPath", "=", "new", "AlluxioURI", "(", "fileInfo", ".", "getPath", "(", ")", ")"...
Prepares the destination file path of the given file id. Also creates the parent folder if it does not exist. @param fileInfo the file info @param ufs the {@link UnderFileSystem} instance @return the path for persistence
[ "Prepares", "the", "destination", "file", "path", "of", "the", "given", "file", "id", ".", "Also", "creates", "the", "parent", "folder", "if", "it", "does", "not", "exist", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/worker/src/main/java/alluxio/worker/file/FileDataManager.java#L336-L344
Whiley/WhileyCompiler
src/main/java/wyc/io/WhileyFileParser.java
WhileyFileParser.parseRecordType
private Type parseRecordType(EnclosingScope scope) { int start = index; match(LeftCurly); ArrayList<Type.Field> types = new ArrayList<>(); Pair<Type, Identifier> p = parseMixedType(scope); types.add(new Type.Field(p.getSecond(), p.getFirst())); HashSet<Identifier> names = new HashSet<>(); names.add(p.getSecond()); // Now, we continue to parse any remaining fields. boolean isOpen = false; while (eventuallyMatch(RightCurly) == null) { match(Comma); if (tryAndMatch(true, DotDotDot) != null) { // this signals an "open" record type match(RightCurly); isOpen = true; break; } else { p = parseMixedType(scope); Identifier id = p.getSecond(); if (names.contains(id)) { syntaxError("duplicate record key", id); } names.add(id); types.add(new Type.Field(id, p.getFirst())); } } // Done Tuple<Type.Field> fields = new Tuple<>(types); return annotateSourceLocation(new Type.Record(isOpen, fields), start); }
java
private Type parseRecordType(EnclosingScope scope) { int start = index; match(LeftCurly); ArrayList<Type.Field> types = new ArrayList<>(); Pair<Type, Identifier> p = parseMixedType(scope); types.add(new Type.Field(p.getSecond(), p.getFirst())); HashSet<Identifier> names = new HashSet<>(); names.add(p.getSecond()); // Now, we continue to parse any remaining fields. boolean isOpen = false; while (eventuallyMatch(RightCurly) == null) { match(Comma); if (tryAndMatch(true, DotDotDot) != null) { // this signals an "open" record type match(RightCurly); isOpen = true; break; } else { p = parseMixedType(scope); Identifier id = p.getSecond(); if (names.contains(id)) { syntaxError("duplicate record key", id); } names.add(id); types.add(new Type.Field(id, p.getFirst())); } } // Done Tuple<Type.Field> fields = new Tuple<>(types); return annotateSourceLocation(new Type.Record(isOpen, fields), start); }
[ "private", "Type", "parseRecordType", "(", "EnclosingScope", "scope", ")", "{", "int", "start", "=", "index", ";", "match", "(", "LeftCurly", ")", ";", "ArrayList", "<", "Type", ".", "Field", ">", "types", "=", "new", "ArrayList", "<>", "(", ")", ";", ...
Parse a set, map or record type, which are of the form: <pre> SetType ::= '{' Type '}' MapType ::= '{' Type "=>" Type '}' RecordType ::= '{' Type Identifier (',' Type Identifier)* [ ',' "..." ] '}' </pre> Disambiguating these three forms is relatively straightforward as all three must be terminated by a right curly brace. Therefore, after parsing the first Type, we simply check what follows. One complication is the potential for "mixed types" where the field name and type and intertwined (e.g. function read()->[byte]). @return
[ "Parse", "a", "set", "map", "or", "record", "type", "which", "are", "of", "the", "form", ":" ]
train
https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyc/io/WhileyFileParser.java#L3754-L3784
chanjarster/weixin-java-tools
weixin-java-common/src/main/java/me/chanjar/weixin/common/util/crypto/WxCryptUtil.java
WxCryptUtil.createSign
public static String createSign(Map<String, String> packageParams, String signKey) { SortedMap<String, String> sortedMap = new TreeMap<String, String>(); sortedMap.putAll(packageParams); List<String> keys = new ArrayList<String>(packageParams.keySet()); Collections.sort(keys); StringBuffer toSign = new StringBuffer(); for (String key : keys) { String value = packageParams.get(key); if (null != value && !"".equals(value) && !"sign".equals(key) && !"key".equals(key)) { toSign.append(key + "=" + value + "&"); } } toSign.append("key=" + signKey); String sign = DigestUtils.md5Hex(toSign.toString()) .toUpperCase(); return sign; }
java
public static String createSign(Map<String, String> packageParams, String signKey) { SortedMap<String, String> sortedMap = new TreeMap<String, String>(); sortedMap.putAll(packageParams); List<String> keys = new ArrayList<String>(packageParams.keySet()); Collections.sort(keys); StringBuffer toSign = new StringBuffer(); for (String key : keys) { String value = packageParams.get(key); if (null != value && !"".equals(value) && !"sign".equals(key) && !"key".equals(key)) { toSign.append(key + "=" + value + "&"); } } toSign.append("key=" + signKey); String sign = DigestUtils.md5Hex(toSign.toString()) .toUpperCase(); return sign; }
[ "public", "static", "String", "createSign", "(", "Map", "<", "String", ",", "String", ">", "packageParams", ",", "String", "signKey", ")", "{", "SortedMap", "<", "String", ",", "String", ">", "sortedMap", "=", "new", "TreeMap", "<", "String", ",", "String"...
微信公众号支付签名算法(详见:http://pay.weixin.qq.com/wiki/doc/api/index.php?chapter=4_3) @param packageParams 原始参数 @param signKey 加密Key(即 商户Key) @param charset 编码 @return 签名字符串
[ "微信公众号支付签名算法", "(", "详见", ":", "http", ":", "//", "pay", ".", "weixin", ".", "qq", ".", "com", "/", "wiki", "/", "doc", "/", "api", "/", "index", ".", "php?chapter", "=", "4_3", ")" ]
train
https://github.com/chanjarster/weixin-java-tools/blob/2a0b1c30c0f60c2de466cb8933c945bc0d391edf/weixin-java-common/src/main/java/me/chanjar/weixin/common/util/crypto/WxCryptUtil.java#L234-L254
alkacon/opencms-core
src/org/opencms/jsp/CmsJspTagLabel.java
CmsJspTagLabel.wpLabelTagAction
public static String wpLabelTagAction(String label, ServletRequest req) { CmsObject cms = CmsFlexController.getCmsObject(req); CmsMessages messages = OpenCms.getWorkplaceManager().getMessages(cms.getRequestContext().getLocale()); return messages.key(label); }
java
public static String wpLabelTagAction(String label, ServletRequest req) { CmsObject cms = CmsFlexController.getCmsObject(req); CmsMessages messages = OpenCms.getWorkplaceManager().getMessages(cms.getRequestContext().getLocale()); return messages.key(label); }
[ "public", "static", "String", "wpLabelTagAction", "(", "String", "label", ",", "ServletRequest", "req", ")", "{", "CmsObject", "cms", "=", "CmsFlexController", ".", "getCmsObject", "(", "req", ")", ";", "CmsMessages", "messages", "=", "OpenCms", ".", "getWorkpla...
Internal action method.<p> @param label the label to look up @param req the current request @return String the value of the selected label
[ "Internal", "action", "method", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/CmsJspTagLabel.java#L68-L73
raydac/java-binary-block-parser
jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPOut.java
JBBPOut.Var
public JBBPOut Var(final JBBPOutVarProcessor processor, final Object... args) throws IOException { assertNotEnded(); JBBPUtils.assertNotNull(processor, "Var processor must not be null"); if (this.processCommands) { this.processCommands = processor.processVarOut(this, this.outStream, args); } return this; }
java
public JBBPOut Var(final JBBPOutVarProcessor processor, final Object... args) throws IOException { assertNotEnded(); JBBPUtils.assertNotNull(processor, "Var processor must not be null"); if (this.processCommands) { this.processCommands = processor.processVarOut(this, this.outStream, args); } return this; }
[ "public", "JBBPOut", "Var", "(", "final", "JBBPOutVarProcessor", "processor", ",", "final", "Object", "...", "args", ")", "throws", "IOException", "{", "assertNotEnded", "(", ")", ";", "JBBPUtils", ".", "assertNotNull", "(", "processor", ",", "\"Var processor must...
Output data externally. @param processor a processor which will get the stream to write data, must not be null @param args optional arguments to be provided to the processor @return the DSL context @throws IOException it will be thrown for transport errors @throws NullPointerException it will be thrown for null as a processor
[ "Output", "data", "externally", "." ]
train
https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPOut.java#L938-L945
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/functions/Function3Args.java
Function3Args.fixupVariables
public void fixupVariables(java.util.Vector vars, int globalsSize) { super.fixupVariables(vars, globalsSize); if(null != m_arg2) m_arg2.fixupVariables(vars, globalsSize); }
java
public void fixupVariables(java.util.Vector vars, int globalsSize) { super.fixupVariables(vars, globalsSize); if(null != m_arg2) m_arg2.fixupVariables(vars, globalsSize); }
[ "public", "void", "fixupVariables", "(", "java", ".", "util", ".", "Vector", "vars", ",", "int", "globalsSize", ")", "{", "super", ".", "fixupVariables", "(", "vars", ",", "globalsSize", ")", ";", "if", "(", "null", "!=", "m_arg2", ")", "m_arg2", ".", ...
This function is used to fixup variables from QNames to stack frame indexes at stylesheet build time. @param vars List of QNames that correspond to variables. This list should be searched backwards for the first qualified name that corresponds to the variable reference qname. The position of the QName in the vector from the start of the vector will be its position in the stack frame (but variables above the globalsTop value will need to be offset to the current stack frame).
[ "This", "function", "is", "used", "to", "fixup", "variables", "from", "QNames", "to", "stack", "frame", "indexes", "at", "stylesheet", "build", "time", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/functions/Function3Args.java#L61-L66
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/javac/jvm/Gen.java
Gen.implementInterfaceMethods
void implementInterfaceMethods(ClassSymbol c, ClassSymbol site) { for (List<Type> l = types.interfaces(c.type); l.nonEmpty(); l = l.tail) { ClassSymbol i = (ClassSymbol)l.head.tsym; for (Scope.Entry e = i.members().elems; e != null; e = e.sibling) { if (e.sym.kind == MTH && (e.sym.flags() & STATIC) == 0) { MethodSymbol absMeth = (MethodSymbol)e.sym; MethodSymbol implMeth = absMeth.binaryImplementation(site, types); if (implMeth == null) addAbstractMethod(site, absMeth); else if ((implMeth.flags() & IPROXY) != 0) adjustAbstractMethod(site, implMeth, absMeth); } } implementInterfaceMethods(i, site); } }
java
void implementInterfaceMethods(ClassSymbol c, ClassSymbol site) { for (List<Type> l = types.interfaces(c.type); l.nonEmpty(); l = l.tail) { ClassSymbol i = (ClassSymbol)l.head.tsym; for (Scope.Entry e = i.members().elems; e != null; e = e.sibling) { if (e.sym.kind == MTH && (e.sym.flags() & STATIC) == 0) { MethodSymbol absMeth = (MethodSymbol)e.sym; MethodSymbol implMeth = absMeth.binaryImplementation(site, types); if (implMeth == null) addAbstractMethod(site, absMeth); else if ((implMeth.flags() & IPROXY) != 0) adjustAbstractMethod(site, implMeth, absMeth); } } implementInterfaceMethods(i, site); } }
[ "void", "implementInterfaceMethods", "(", "ClassSymbol", "c", ",", "ClassSymbol", "site", ")", "{", "for", "(", "List", "<", "Type", ">", "l", "=", "types", ".", "interfaces", "(", "c", ".", "type", ")", ";", "l", ".", "nonEmpty", "(", ")", ";", "l",...
Add abstract methods for all methods defined in one of the interfaces of a given class, provided they are not already implemented in the class. @param c The class whose interfaces are searched for methods for which Miranda methods should be added. @param site The class in which a definition may be needed.
[ "Add", "abstract", "methods", "for", "all", "methods", "defined", "in", "one", "of", "the", "interfaces", "of", "a", "given", "class", "provided", "they", "are", "not", "already", "implemented", "in", "the", "class", "." ]
train
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/jvm/Gen.java#L663-L682
reactor/reactor-netty
src/main/java/reactor/netty/ByteBufFlux.java
ByteBufFlux.fromPath
public static ByteBufFlux fromPath(Path path, int maxChunkSize, ByteBufAllocator allocator) { Objects.requireNonNull(path, "path"); Objects.requireNonNull(allocator, "allocator"); if (maxChunkSize < 1) { throw new IllegalArgumentException("chunk size must be strictly positive, " + "was: " + maxChunkSize); } return new ByteBufFlux(Flux.generate(() -> FileChannel.open(path), (fc, sink) -> { ByteBuf buf = allocator.buffer(); try { if (buf.writeBytes(fc, maxChunkSize) < 0) { buf.release(); sink.complete(); } else { sink.next(buf); } } catch (IOException e) { buf.release(); sink.error(e); } return fc; }), allocator); }
java
public static ByteBufFlux fromPath(Path path, int maxChunkSize, ByteBufAllocator allocator) { Objects.requireNonNull(path, "path"); Objects.requireNonNull(allocator, "allocator"); if (maxChunkSize < 1) { throw new IllegalArgumentException("chunk size must be strictly positive, " + "was: " + maxChunkSize); } return new ByteBufFlux(Flux.generate(() -> FileChannel.open(path), (fc, sink) -> { ByteBuf buf = allocator.buffer(); try { if (buf.writeBytes(fc, maxChunkSize) < 0) { buf.release(); sink.complete(); } else { sink.next(buf); } } catch (IOException e) { buf.release(); sink.error(e); } return fc; }), allocator); }
[ "public", "static", "ByteBufFlux", "fromPath", "(", "Path", "path", ",", "int", "maxChunkSize", ",", "ByteBufAllocator", "allocator", ")", "{", "Objects", ".", "requireNonNull", "(", "path", ",", "\"path\"", ")", ";", "Objects", ".", "requireNonNull", "(", "al...
Open a {@link java.nio.channels.FileChannel} from a path and stream {@link ByteBuf} chunks with a given maximum size into the returned {@link ByteBufFlux}, using the provided {@link ByteBufAllocator}. @param path the path to the resource to stream @param maxChunkSize the maximum per-item ByteBuf size @param allocator the channel {@link ByteBufAllocator} @return a {@link ByteBufFlux}
[ "Open", "a", "{", "@link", "java", ".", "nio", ".", "channels", ".", "FileChannel", "}", "from", "a", "path", "and", "stream", "{", "@link", "ByteBuf", "}", "chunks", "with", "a", "given", "maximum", "size", "into", "the", "returned", "{", "@link", "By...
train
https://github.com/reactor/reactor-netty/blob/4ed14316e1d7fca3cecd18d6caa5f2251e159e49/src/main/java/reactor/netty/ByteBufFlux.java#L148-L173
elibom/jogger
src/main/java/com/elibom/jogger/middleware/router/loader/AbstractFileRoutesLoader.java
AbstractFileRoutesLoader.isValidCharForPath
private boolean isValidCharForPath(char c, boolean openedKey) { char[] invalidChars = { '?', '#', ' ' }; for (char invalidChar : invalidChars) { if (c == invalidChar) { return false; } } if (openedKey) { char[] moreInvalidChars = { '/', '{' }; for (char invalidChar : moreInvalidChars) { if (c == invalidChar) { return false; } } } return true; }
java
private boolean isValidCharForPath(char c, boolean openedKey) { char[] invalidChars = { '?', '#', ' ' }; for (char invalidChar : invalidChars) { if (c == invalidChar) { return false; } } if (openedKey) { char[] moreInvalidChars = { '/', '{' }; for (char invalidChar : moreInvalidChars) { if (c == invalidChar) { return false; } } } return true; }
[ "private", "boolean", "isValidCharForPath", "(", "char", "c", ",", "boolean", "openedKey", ")", "{", "char", "[", "]", "invalidChars", "=", "{", "'", "'", ",", "'", "'", ",", "'", "'", "}", ";", "for", "(", "char", "invalidChar", ":", "invalidChars", ...
Helper method. Tells if a char is valid in a the path of a route line. @param c the char that we are validating. @param openedKey if there is already an opened key ({) char before. @return true if the char is valid, false otherwise.
[ "Helper", "method", ".", "Tells", "if", "a", "char", "is", "valid", "in", "a", "the", "path", "of", "a", "route", "line", "." ]
train
https://github.com/elibom/jogger/blob/d5892ff45e76328d444a68b5a38c26e7bdd0692b/src/main/java/com/elibom/jogger/middleware/router/loader/AbstractFileRoutesLoader.java#L201-L219
hector-client/hector
core/src/main/java/me/prettyprint/hector/api/factory/HFactory.java
HFactory.getOrCreateCluster
public static Cluster getOrCreateCluster(String clusterName, String hostIp) { return getOrCreateCluster(clusterName, new CassandraHostConfigurator(hostIp)); }
java
public static Cluster getOrCreateCluster(String clusterName, String hostIp) { return getOrCreateCluster(clusterName, new CassandraHostConfigurator(hostIp)); }
[ "public", "static", "Cluster", "getOrCreateCluster", "(", "String", "clusterName", ",", "String", "hostIp", ")", "{", "return", "getOrCreateCluster", "(", "clusterName", ",", "new", "CassandraHostConfigurator", "(", "hostIp", ")", ")", ";", "}" ]
Method tries to create a Cluster instance for an existing Cassandra cluster. If another class already called getOrCreateCluster, the factory returns the cached instance. If the instance doesn't exist in memory, a new ThriftCluster is created and cached. Example usage for a default installation of Cassandra. String clusterName = "Test Cluster"; String host = "localhost:9160"; Cluster cluster = HFactory.getOrCreateCluster(clusterName, host); Note the host should be the hostname and port number. It is preferable to use the hostname instead of the IP address. @param clusterName The cluster name. This is an identifying string for the cluster, e.g. "production" or "test" etc. Clusters will be created on demand per each unique clusterName key. @param hostIp host:ip format string @return
[ "Method", "tries", "to", "create", "a", "Cluster", "instance", "for", "an", "existing", "Cassandra", "cluster", ".", "If", "another", "class", "already", "called", "getOrCreateCluster", "the", "factory", "returns", "the", "cached", "instance", ".", "If", "the", ...
train
https://github.com/hector-client/hector/blob/a302e68ca8d91b45d332e8c9afd7d98030b54de1/core/src/main/java/me/prettyprint/hector/api/factory/HFactory.java#L132-L135
rey5137/material
material/src/main/java/com/rey/material/app/Dialog.java
Dialog.contentMargin
public Dialog contentMargin(int left, int top, int right, int bottom){ mCardView.setContentMargin(left, top, right, bottom); return this; }
java
public Dialog contentMargin(int left, int top, int right, int bottom){ mCardView.setContentMargin(left, top, right, bottom); return this; }
[ "public", "Dialog", "contentMargin", "(", "int", "left", ",", "int", "top", ",", "int", "right", ",", "int", "bottom", ")", "{", "mCardView", ".", "setContentMargin", "(", "left", ",", "top", ",", "right", ",", "bottom", ")", ";", "return", "this", ";"...
Set the margin between content view and Dialog border. @param left The left margin size in pixels. @param top The top margin size in pixels. @param right The right margin size in pixels. @param bottom The bottom margin size in pixels. @return The Dialog for chaining methods.
[ "Set", "the", "margin", "between", "content", "view", "and", "Dialog", "border", "." ]
train
https://github.com/rey5137/material/blob/1bbcac2686a0023ef7720d3fe455bb116d115af8/material/src/main/java/com/rey/material/app/Dialog.java#L986-L989
deeplearning4j/deeplearning4j
datavec/datavec-spark/src/main/java/org/datavec/spark/storage/SparkStorageUtils.java
SparkStorageUtils.saveSequenceFileSequences
public static void saveSequenceFileSequences(String path, JavaRDD<List<List<Writable>>> rdd) { saveSequenceFileSequences(path, rdd, null); }
java
public static void saveSequenceFileSequences(String path, JavaRDD<List<List<Writable>>> rdd) { saveSequenceFileSequences(path, rdd, null); }
[ "public", "static", "void", "saveSequenceFileSequences", "(", "String", "path", ",", "JavaRDD", "<", "List", "<", "List", "<", "Writable", ">", ">", ">", "rdd", ")", "{", "saveSequenceFileSequences", "(", "path", ",", "rdd", ",", "null", ")", ";", "}" ]
Save a {@code JavaRDD<List<List<Writable>>>} to a Hadoop {@link org.apache.hadoop.io.SequenceFile}. Each record is given a unique (but noncontiguous) {@link LongWritable} key, and values are stored as {@link SequenceRecordWritable} instances. <p> Use {@link #restoreSequenceFileSequences(String, JavaSparkContext)} to restore values saved with this method. @param path Path to save the sequence file @param rdd RDD to save @see #saveSequenceFile(String, JavaRDD) @see #saveMapFileSequences(String, JavaRDD)
[ "Save", "a", "{", "@code", "JavaRDD<List<List<Writable", ">>>", "}", "to", "a", "Hadoop", "{", "@link", "org", ".", "apache", ".", "hadoop", ".", "io", ".", "SequenceFile", "}", ".", "Each", "record", "is", "given", "a", "unique", "(", "but", "noncontigu...
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-spark/src/main/java/org/datavec/spark/storage/SparkStorageUtils.java#L127-L129
k3po/k3po
driver/src/main/java/org/kaazing/k3po/driver/internal/netty/channel/Channels.java
Channels.shutdownInput
public static void shutdownInput(ChannelHandlerContext ctx, ChannelFuture future) { ctx.sendDownstream( new DownstreamShutdownInputEvent(ctx.getChannel(), future)); }
java
public static void shutdownInput(ChannelHandlerContext ctx, ChannelFuture future) { ctx.sendDownstream( new DownstreamShutdownInputEvent(ctx.getChannel(), future)); }
[ "public", "static", "void", "shutdownInput", "(", "ChannelHandlerContext", "ctx", ",", "ChannelFuture", "future", ")", "{", "ctx", ".", "sendDownstream", "(", "new", "DownstreamShutdownInputEvent", "(", "ctx", ".", "getChannel", "(", ")", ",", "future", ")", ")"...
Sends a {@code "shutdownInput"} request to the {@link ChannelDownstreamHandler} which is placed in the closest downstream from the handler associated with the specified {@link ChannelHandlerContext}. @param ctx the context @param future the future which will be notified when the shutdownInput operation is done
[ "Sends", "a", "{", "@code", "shutdownInput", "}", "request", "to", "the", "{", "@link", "ChannelDownstreamHandler", "}", "which", "is", "placed", "in", "the", "closest", "downstream", "from", "the", "handler", "associated", "with", "the", "specified", "{", "@l...
train
https://github.com/k3po/k3po/blob/3ca4fd31ab4a397893aa640c62ada0e485c8bbd4/driver/src/main/java/org/kaazing/k3po/driver/internal/netty/channel/Channels.java#L89-L92
osglworks/java-tool
src/main/java/org/osgl/util/E.java
E.invalidRangeIf
public static void invalidRangeIf(boolean tester, String msg, Object... args) { if (tester) { throw invalidRange(msg, args); } }
java
public static void invalidRangeIf(boolean tester, String msg, Object... args) { if (tester) { throw invalidRange(msg, args); } }
[ "public", "static", "void", "invalidRangeIf", "(", "boolean", "tester", ",", "String", "msg", ",", "Object", "...", "args", ")", "{", "if", "(", "tester", ")", "{", "throw", "invalidRange", "(", "msg", ",", "args", ")", ";", "}", "}" ]
Throws out an {@link InvalidRangeException} with error message specified when `tester` is `true`. @param tester when `true` then throw out the exception @param msg the error message format pattern. @param args the error message format arguments.
[ "Throws", "out", "an", "{", "@link", "InvalidRangeException", "}", "with", "error", "message", "specified", "when", "tester", "is", "true", "." ]
train
https://github.com/osglworks/java-tool/blob/8b6eee2bccb067eb32e6a7bc4a4dfef7a7d9008b/src/main/java/org/osgl/util/E.java#L481-L485
rythmengine/rythmengine
src/main/java/org/rythmengine/RythmEngine.java
RythmEngine.getTemplate
@SuppressWarnings("unchecked") public ITemplate getTemplate(File file, Object... args) { boolean typeInferenceEnabled = conf().typeInferenceEnabled(); if (typeInferenceEnabled) { ParamTypeInferencer.registerParams(this, args); } String key = S.str(resourceManager().get(file).getKey()); if (typeInferenceEnabled) { key += ParamTypeInferencer.uuid(); } TemplateClass tc = classes().getByTemplate(key); ITemplate t; if (null == tc) { tc = new TemplateClass(file, this); t = tc.asTemplate(this); if (null == t) return null; _templates.put(tc.getKey(), t); //classes().add(key, tc); } else { t = tc.asTemplate(this); } setRenderArgs(t, args); return t; }
java
@SuppressWarnings("unchecked") public ITemplate getTemplate(File file, Object... args) { boolean typeInferenceEnabled = conf().typeInferenceEnabled(); if (typeInferenceEnabled) { ParamTypeInferencer.registerParams(this, args); } String key = S.str(resourceManager().get(file).getKey()); if (typeInferenceEnabled) { key += ParamTypeInferencer.uuid(); } TemplateClass tc = classes().getByTemplate(key); ITemplate t; if (null == tc) { tc = new TemplateClass(file, this); t = tc.asTemplate(this); if (null == t) return null; _templates.put(tc.getKey(), t); //classes().add(key, tc); } else { t = tc.asTemplate(this); } setRenderArgs(t, args); return t; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "ITemplate", "getTemplate", "(", "File", "file", ",", "Object", "...", "args", ")", "{", "boolean", "typeInferenceEnabled", "=", "conf", "(", ")", ".", "typeInferenceEnabled", "(", ")", ";", "if", ...
Get an new template instance by template source {@link java.io.File file} and an array of arguments. <p/> <p>When the args array contains only one element and is of {@link java.util.Map} type the the render args are passed to template {@link ITemplate#__setRenderArgs(java.util.Map) by name}, otherwise they passes to template instance by position</p> @param file the template source file @param args the render args. See {@link #getTemplate(String, Object...)} @return template instance
[ "Get", "an", "new", "template", "instance", "by", "template", "source", "{", "@link", "java", ".", "io", ".", "File", "file", "}", "and", "an", "array", "of", "arguments", ".", "<p", "/", ">", "<p", ">", "When", "the", "args", "array", "contains", "o...
train
https://github.com/rythmengine/rythmengine/blob/064b565f08d9da07378bf77a9dd856ea5831cc92/src/main/java/org/rythmengine/RythmEngine.java#L952-L976
aws/aws-sdk-java
aws-java-sdk-servicecatalog/src/main/java/com/amazonaws/services/servicecatalog/model/UpdateServiceActionRequest.java
UpdateServiceActionRequest.withDefinition
public UpdateServiceActionRequest withDefinition(java.util.Map<String, String> definition) { setDefinition(definition); return this; }
java
public UpdateServiceActionRequest withDefinition(java.util.Map<String, String> definition) { setDefinition(definition); return this; }
[ "public", "UpdateServiceActionRequest", "withDefinition", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "definition", ")", "{", "setDefinition", "(", "definition", ")", ";", "return", "this", ";", "}" ]
<p> A map that defines the self-service action. </p> @param definition A map that defines the self-service action. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "A", "map", "that", "defines", "the", "self", "-", "service", "action", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-servicecatalog/src/main/java/com/amazonaws/services/servicecatalog/model/UpdateServiceActionRequest.java#L191-L194
forge/core
ui/api/src/main/java/org/jboss/forge/addon/ui/util/InputComponents.java
InputComponents.hasValue
public static boolean hasValue(InputComponent<?, ?> input) { boolean ret; Object value = InputComponents.getValueFor(input); if (value == null) { ret = false; } else if (value instanceof String && value.toString().isEmpty()) { ret = false; } else if (!input.getValueType().isInstance(value) && value instanceof Iterable && !((Iterable) value).iterator().hasNext()) { ret = false; } else { ret = true; } return ret; }
java
public static boolean hasValue(InputComponent<?, ?> input) { boolean ret; Object value = InputComponents.getValueFor(input); if (value == null) { ret = false; } else if (value instanceof String && value.toString().isEmpty()) { ret = false; } else if (!input.getValueType().isInstance(value) && value instanceof Iterable && !((Iterable) value).iterator().hasNext()) { ret = false; } else { ret = true; } return ret; }
[ "public", "static", "boolean", "hasValue", "(", "InputComponent", "<", "?", ",", "?", ">", "input", ")", "{", "boolean", "ret", ";", "Object", "value", "=", "InputComponents", ".", "getValueFor", "(", "input", ")", ";", "if", "(", "value", "==", "null", ...
Returns if there is a value set for this {@link InputComponent}
[ "Returns", "if", "there", "is", "a", "value", "set", "for", "this", "{" ]
train
https://github.com/forge/core/blob/e140eb03bbe2b3409478ad70c86c3edbef6d9a0c/ui/api/src/main/java/org/jboss/forge/addon/ui/util/InputComponents.java#L295-L317
yanzhenjie/AndServer
api/src/main/java/com/yanzhenjie/andserver/framework/website/FileBrowser.java
FileBrowser.findPathResource
private File findPathResource(@NonNull String httpPath) { if ("/".equals(httpPath)) { File root = new File(mRootPath); return root.exists() ? root : null; } else { File sourceFile = new File(mRootPath, httpPath); if (sourceFile.exists()) { return sourceFile; } } return null; }
java
private File findPathResource(@NonNull String httpPath) { if ("/".equals(httpPath)) { File root = new File(mRootPath); return root.exists() ? root : null; } else { File sourceFile = new File(mRootPath, httpPath); if (sourceFile.exists()) { return sourceFile; } } return null; }
[ "private", "File", "findPathResource", "(", "@", "NonNull", "String", "httpPath", ")", "{", "if", "(", "\"/\"", ".", "equals", "(", "httpPath", ")", ")", "{", "File", "root", "=", "new", "File", "(", "mRootPath", ")", ";", "return", "root", ".", "exist...
Find the path specified resource. @param httpPath path. @return return if the file is found.
[ "Find", "the", "path", "specified", "resource", "." ]
train
https://github.com/yanzhenjie/AndServer/blob/f95f316cdfa5755d6a3fec3c6a1b5df783b81517/api/src/main/java/com/yanzhenjie/andserver/framework/website/FileBrowser.java#L66-L77
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.billingAccount_easyPabx_serviceName_hunting_tones_toneUpload_POST
public OvhTask billingAccount_easyPabx_serviceName_hunting_tones_toneUpload_POST(String billingAccount, String serviceName, String documentId, OvhTonesTypeEnum type, String url) throws IOException { String qPath = "/telephony/{billingAccount}/easyPabx/{serviceName}/hunting/tones/toneUpload"; StringBuilder sb = path(qPath, billingAccount, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "documentId", documentId); addBody(o, "type", type); addBody(o, "url", url); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTask.class); }
java
public OvhTask billingAccount_easyPabx_serviceName_hunting_tones_toneUpload_POST(String billingAccount, String serviceName, String documentId, OvhTonesTypeEnum type, String url) throws IOException { String qPath = "/telephony/{billingAccount}/easyPabx/{serviceName}/hunting/tones/toneUpload"; StringBuilder sb = path(qPath, billingAccount, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "documentId", documentId); addBody(o, "type", type); addBody(o, "url", url); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTask.class); }
[ "public", "OvhTask", "billingAccount_easyPabx_serviceName_hunting_tones_toneUpload_POST", "(", "String", "billingAccount", ",", "String", "serviceName", ",", "String", "documentId", ",", "OvhTonesTypeEnum", "type", ",", "String", "url", ")", "throws", "IOException", "{", ...
Upload new tone file REST: POST /telephony/{billingAccount}/easyPabx/{serviceName}/hunting/tones/toneUpload @param url [required] URL of the file you want to import (instead of /me/document ID) @param documentId [required] ID of the /me/document file you want to import @param type [required] @param billingAccount [required] The name of your billingAccount @param serviceName [required]
[ "Upload", "new", "tone", "file" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L3616-L3625
rundeck/rundeck
core/src/main/java/com/dtolabs/rundeck/core/dispatcher/DataContextUtils.java
DataContextUtils.replaceDataReferencesInString
public static String replaceDataReferencesInString(final String input, final Map<String, Map<String, String>> data) { return replaceDataReferencesInString(input, data, null, false); }
java
public static String replaceDataReferencesInString(final String input, final Map<String, Map<String, String>> data) { return replaceDataReferencesInString(input, data, null, false); }
[ "public", "static", "String", "replaceDataReferencesInString", "(", "final", "String", "input", ",", "final", "Map", "<", "String", ",", "Map", "<", "String", ",", "String", ">", ">", "data", ")", "{", "return", "replaceDataReferencesInString", "(", "input", "...
Replace the embedded properties of the form '${key.name}' in the input Strings with the value from the data context @param input input string @param data data context map @return string with values substituted, or original string
[ "Replace", "the", "embedded", "properties", "of", "the", "form", "$", "{", "key", ".", "name", "}", "in", "the", "input", "Strings", "with", "the", "value", "from", "the", "data", "context" ]
train
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/dispatcher/DataContextUtils.java#L254-L256
javagl/ND
nd-iteration/src/main/java/de/javagl/nd/iteration/tuples/j/LongTupleNeighborhoodIterables.java
LongTupleNeighborhoodIterables.vonNeumannNeighborhoodIterable
public static Iterable<MutableLongTuple> vonNeumannNeighborhoodIterable( LongTuple center, final int radius) { final LongTuple localCenter = LongTuples.copy(center); return new Iterable<MutableLongTuple>() { @Override public Iterator<MutableLongTuple> iterator() { return new VonNeumannLongTupleIterator(localCenter, radius); } }; }
java
public static Iterable<MutableLongTuple> vonNeumannNeighborhoodIterable( LongTuple center, final int radius) { final LongTuple localCenter = LongTuples.copy(center); return new Iterable<MutableLongTuple>() { @Override public Iterator<MutableLongTuple> iterator() { return new VonNeumannLongTupleIterator(localCenter, radius); } }; }
[ "public", "static", "Iterable", "<", "MutableLongTuple", ">", "vonNeumannNeighborhoodIterable", "(", "LongTuple", "center", ",", "final", "int", "radius", ")", "{", "final", "LongTuple", "localCenter", "=", "LongTuples", ".", "copy", "(", "center", ")", ";", "re...
Creates an iterable that provides iterators for iterating over the Von Neumann neighborhood of the given center and the given radius.<br> <br> Also see <a href="../../package-summary.html#Neighborhoods"> Neighborhoods</a> @param center The center of the Von Neumann neighborhood. A copy of this tuple will be stored internally. @param radius The radius of the Von Neumann neighborhood @return The iterable
[ "Creates", "an", "iterable", "that", "provides", "iterators", "for", "iterating", "over", "the", "Von", "Neumann", "neighborhood", "of", "the", "given", "center", "and", "the", "given", "radius", ".", "<br", ">", "<br", ">", "Also", "see", "<a", "href", "=...
train
https://github.com/javagl/ND/blob/bcb655aaf5fc88af6194f73a27cca079186ff559/nd-iteration/src/main/java/de/javagl/nd/iteration/tuples/j/LongTupleNeighborhoodIterables.java#L133-L145
strator-dev/greenpepper
greenpepper/core/src/main/java/com/greenpepper/util/CollectionUtil.java
CollectionUtil.removeLast
public static <T> T removeLast( List<T> list ) { return remove( list, list.size() - 1 ); }
java
public static <T> T removeLast( List<T> list ) { return remove( list, list.size() - 1 ); }
[ "public", "static", "<", "T", ">", "T", "removeLast", "(", "List", "<", "T", ">", "list", ")", "{", "return", "remove", "(", "list", ",", "list", ".", "size", "(", ")", "-", "1", ")", ";", "}" ]
<p>removeLast.</p> @param list a {@link java.util.List} object. @param <T> a T object. @return a T object.
[ "<p", ">", "removeLast", ".", "<", "/", "p", ">" ]
train
https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper/core/src/main/java/com/greenpepper/util/CollectionUtil.java#L226-L229
Jasig/uPortal
uPortal-layout/uPortal-layout-impl/src/main/java/org/apereo/portal/layout/dlm/RDBMDistributedLayoutStore.java
RDBMDistributedLayoutStore.getUserLayout
@Override public DistributedUserLayout getUserLayout(IPerson person, IUserProfile profile) { final DistributedUserLayout layout = this._getUserLayout(person, profile); return layout; }
java
@Override public DistributedUserLayout getUserLayout(IPerson person, IUserProfile profile) { final DistributedUserLayout layout = this._getUserLayout(person, profile); return layout; }
[ "@", "Override", "public", "DistributedUserLayout", "getUserLayout", "(", "IPerson", "person", ",", "IUserProfile", "profile", ")", "{", "final", "DistributedUserLayout", "layout", "=", "this", ".", "_getUserLayout", "(", "person", ",", "profile", ")", ";", "retur...
Returns the layout for a user decorated with any specified decorator. The layout returned is a composite layout for non fragment owners and a regular layout for layout owners. A composite layout is made up of layout pieces from potentially multiple incorporated layouts. If no layouts are defined then the composite layout will be the same as the user's personal layout fragment or PLF, the one holding only those UI elements that they own or incorporated elements that they have been allowed to changed.
[ "Returns", "the", "layout", "for", "a", "user", "decorated", "with", "any", "specified", "decorator", ".", "The", "layout", "returned", "is", "a", "composite", "layout", "for", "non", "fragment", "owners", "and", "a", "regular", "layout", "for", "layout", "o...
train
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-layout/uPortal-layout-impl/src/main/java/org/apereo/portal/layout/dlm/RDBMDistributedLayoutStore.java#L337-L343
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/internal/FormLoginExtensionProcessor.java
FormLoginExtensionProcessor.setUpAFullUrl
private String setUpAFullUrl(HttpServletRequest req, String loginErrorPage, boolean bCtx) { String errorPage = null; if (loginErrorPage != null) { if (loginErrorPage.startsWith("http://") || loginErrorPage.startsWith("https://")) { return loginErrorPage; } if (!loginErrorPage.startsWith("/")) loginErrorPage = "/" + loginErrorPage; StringBuffer URL = req.getRequestURL(); String URLString = URL.toString(); int index = URLString.indexOf("//"); index = URLString.indexOf("/", index + 2); int endindex = URLString.length(); if (bCtx) { String ctx = req.getContextPath(); if (ctx.equals("/")) ctx = ""; errorPage = ctx + loginErrorPage; } else { errorPage = loginErrorPage; } URL.replace(index, endindex, errorPage); errorPage = URL.toString(); } return errorPage; }
java
private String setUpAFullUrl(HttpServletRequest req, String loginErrorPage, boolean bCtx) { String errorPage = null; if (loginErrorPage != null) { if (loginErrorPage.startsWith("http://") || loginErrorPage.startsWith("https://")) { return loginErrorPage; } if (!loginErrorPage.startsWith("/")) loginErrorPage = "/" + loginErrorPage; StringBuffer URL = req.getRequestURL(); String URLString = URL.toString(); int index = URLString.indexOf("//"); index = URLString.indexOf("/", index + 2); int endindex = URLString.length(); if (bCtx) { String ctx = req.getContextPath(); if (ctx.equals("/")) ctx = ""; errorPage = ctx + loginErrorPage; } else { errorPage = loginErrorPage; } URL.replace(index, endindex, errorPage); errorPage = URL.toString(); } return errorPage; }
[ "private", "String", "setUpAFullUrl", "(", "HttpServletRequest", "req", ",", "String", "loginErrorPage", ",", "boolean", "bCtx", ")", "{", "String", "errorPage", "=", "null", ";", "if", "(", "loginErrorPage", "!=", "null", ")", "{", "if", "(", "loginErrorPage"...
Set up an error page as a full URL (http;//host:port/ctx/path) @param req @param loginErrorPage @return errorPage
[ "Set", "up", "an", "error", "page", "as", "a", "full", "URL", "(", "http", ";", "//", "host", ":", "port", "/", "ctx", "/", "path", ")" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/internal/FormLoginExtensionProcessor.java#L262-L290
GenesysPureEngage/provisioning-client-java
src/main/java/com/genesys/internal/provisioning/api/MusicOnHoldApi.java
MusicOnHoldApi.sendMOHSettings
public SendMOHSettingsResponse sendMOHSettings(String musicFile, Boolean musicEnabled) throws ApiException { ApiResponse<SendMOHSettingsResponse> resp = sendMOHSettingsWithHttpInfo(musicFile, musicEnabled); return resp.getData(); }
java
public SendMOHSettingsResponse sendMOHSettings(String musicFile, Boolean musicEnabled) throws ApiException { ApiResponse<SendMOHSettingsResponse> resp = sendMOHSettingsWithHttpInfo(musicFile, musicEnabled); return resp.getData(); }
[ "public", "SendMOHSettingsResponse", "sendMOHSettings", "(", "String", "musicFile", ",", "Boolean", "musicEnabled", ")", "throws", "ApiException", "{", "ApiResponse", "<", "SendMOHSettingsResponse", ">", "resp", "=", "sendMOHSettingsWithHttpInfo", "(", "musicFile", ",", ...
Update MOH settings. Adds or updates MOH setting. @param musicFile The Name of WAV file. (required) @param musicEnabled Define is music enabled/disabled. (required) @return SendMOHSettingsResponse @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Update", "MOH", "settings", ".", "Adds", "or", "updates", "MOH", "setting", "." ]
train
https://github.com/GenesysPureEngage/provisioning-client-java/blob/1ad594c3767cec83052168e350994f922a26f75e/src/main/java/com/genesys/internal/provisioning/api/MusicOnHoldApi.java#L617-L620
aws/aws-sdk-java
aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/model/QueryRequest.java
QueryRequest.withExclusiveStartKey
public QueryRequest withExclusiveStartKey(java.util.Map<String, AttributeValue> exclusiveStartKey) { setExclusiveStartKey(exclusiveStartKey); return this; }
java
public QueryRequest withExclusiveStartKey(java.util.Map<String, AttributeValue> exclusiveStartKey) { setExclusiveStartKey(exclusiveStartKey); return this; }
[ "public", "QueryRequest", "withExclusiveStartKey", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "AttributeValue", ">", "exclusiveStartKey", ")", "{", "setExclusiveStartKey", "(", "exclusiveStartKey", ")", ";", "return", "this", ";", "}" ]
<p> The primary key of the first item that this operation will evaluate. Use the value that was returned for <code>LastEvaluatedKey</code> in the previous operation. </p> <p> The data type for <code>ExclusiveStartKey</code> must be String, Number or Binary. No set data types are allowed. </p> @param exclusiveStartKey The primary key of the first item that this operation will evaluate. Use the value that was returned for <code>LastEvaluatedKey</code> in the previous operation.</p> <p> The data type for <code>ExclusiveStartKey</code> must be String, Number or Binary. No set data types are allowed. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "The", "primary", "key", "of", "the", "first", "item", "that", "this", "operation", "will", "evaluate", ".", "Use", "the", "value", "that", "was", "returned", "for", "<code", ">", "LastEvaluatedKey<", "/", "code", ">", "in", "the", "previous", ...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/model/QueryRequest.java#L1866-L1869
alkacon/opencms-core
src/org/opencms/search/galleries/CmsGallerySearch.java
CmsGallerySearch.searchById
public CmsGallerySearchResult searchById(CmsUUID id, Locale locale) throws CmsException { I_CmsSearchDocument sDoc = m_index.getDocument( CmsSearchField.FIELD_ID, id.toString(), CmsGallerySearchResult.getRequiredSolrFields()); CmsGallerySearchResult result = null; if ((sDoc != null) && (sDoc.getDocument() != null)) { result = new CmsGallerySearchResult(sDoc, m_cms, 100, locale); } else { CmsResource res = m_cms.readResource(id, CmsResourceFilter.ALL); result = new CmsGallerySearchResult(m_cms, res); } return result; }
java
public CmsGallerySearchResult searchById(CmsUUID id, Locale locale) throws CmsException { I_CmsSearchDocument sDoc = m_index.getDocument( CmsSearchField.FIELD_ID, id.toString(), CmsGallerySearchResult.getRequiredSolrFields()); CmsGallerySearchResult result = null; if ((sDoc != null) && (sDoc.getDocument() != null)) { result = new CmsGallerySearchResult(sDoc, m_cms, 100, locale); } else { CmsResource res = m_cms.readResource(id, CmsResourceFilter.ALL); result = new CmsGallerySearchResult(m_cms, res); } return result; }
[ "public", "CmsGallerySearchResult", "searchById", "(", "CmsUUID", "id", ",", "Locale", "locale", ")", "throws", "CmsException", "{", "I_CmsSearchDocument", "sDoc", "=", "m_index", ".", "getDocument", "(", "CmsSearchField", ".", "FIELD_ID", ",", "id", ".", "toStrin...
Searches by structure id.<p> @param id the structure id of the document to search for @param locale the locale for which the search result should be returned @return the search result @throws CmsException if something goes wrong
[ "Searches", "by", "structure", "id", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/galleries/CmsGallerySearch.java#L169-L184
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/io/grasslegacy/io/GrassRasterReader.java
GrassRasterReader.readUncompressedIntegerRowByNumber
private void readUncompressedIntegerRowByNumber( ByteBuffer rowdata, int rn, RandomAccessFile thefile ) throws IOException, DataFormatException { int cellValue = 0; ByteBuffer cell = ByteBuffer.allocate(rasterMapType); /* The number of bytes that are inside a row in the file. */ int filerowsize = fileWindow.getCols() * rasterMapType; /* Position the file pointer to read the row */ thefile.seek((rn * filerowsize)); /* Read the row of data from the file */ ByteBuffer tmpBuffer = ByteBuffer.allocate(filerowsize); thefile.read(tmpBuffer.array()); /* * Transform the rasterMapType-size-values to a standard 4 bytes integer value */ while( tmpBuffer.hasRemaining() ) { // read the value tmpBuffer.get(cell.array()); /* * Integers can be of 1, 2, or 4 bytes. As rasterBuffer expects 4 byte integers we need * to pad them with 0's. The order of the padding is determined by the ByteOrder of the * buffer. */ if (rasterMapType == 1) { cellValue = (cell.get(0) & 0xff); } else if (rasterMapType == 2) { cellValue = cell.getShort(0); } else if (rasterMapType == 4) { cellValue = cell.getInt(0); } // if (logger.isDebugEnabled()) logger.debug("tmpint=" + cellValue // ); rowdata.putInt(cellValue); } }
java
private void readUncompressedIntegerRowByNumber( ByteBuffer rowdata, int rn, RandomAccessFile thefile ) throws IOException, DataFormatException { int cellValue = 0; ByteBuffer cell = ByteBuffer.allocate(rasterMapType); /* The number of bytes that are inside a row in the file. */ int filerowsize = fileWindow.getCols() * rasterMapType; /* Position the file pointer to read the row */ thefile.seek((rn * filerowsize)); /* Read the row of data from the file */ ByteBuffer tmpBuffer = ByteBuffer.allocate(filerowsize); thefile.read(tmpBuffer.array()); /* * Transform the rasterMapType-size-values to a standard 4 bytes integer value */ while( tmpBuffer.hasRemaining() ) { // read the value tmpBuffer.get(cell.array()); /* * Integers can be of 1, 2, or 4 bytes. As rasterBuffer expects 4 byte integers we need * to pad them with 0's. The order of the padding is determined by the ByteOrder of the * buffer. */ if (rasterMapType == 1) { cellValue = (cell.get(0) & 0xff); } else if (rasterMapType == 2) { cellValue = cell.getShort(0); } else if (rasterMapType == 4) { cellValue = cell.getInt(0); } // if (logger.isDebugEnabled()) logger.debug("tmpint=" + cellValue // ); rowdata.putInt(cellValue); } }
[ "private", "void", "readUncompressedIntegerRowByNumber", "(", "ByteBuffer", "rowdata", ",", "int", "rn", ",", "RandomAccessFile", "thefile", ")", "throws", "IOException", ",", "DataFormatException", "{", "int", "cellValue", "=", "0", ";", "ByteBuffer", "cell", "=", ...
read a row of data from an uncompressed integer map @param rn @param thefile @return @throws IOException @throws DataFormatException
[ "read", "a", "row", "of", "data", "from", "an", "uncompressed", "integer", "map" ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/grasslegacy/io/GrassRasterReader.java#L1217-L1255
ironjacamar/ironjacamar
tracer/src/main/java/org/ironjacamar/tracer/TraceEventHelper.java
TraceEventHelper.getType
public static TraceEvent getType(List<TraceEvent> events, String identifier, int... types) { for (TraceEvent te : events) { for (int type : types) { if (te.getType() == type && (identifier == null || te.getConnectionListener().equals(identifier))) return te; } } return null; }
java
public static TraceEvent getType(List<TraceEvent> events, String identifier, int... types) { for (TraceEvent te : events) { for (int type : types) { if (te.getType() == type && (identifier == null || te.getConnectionListener().equals(identifier))) return te; } } return null; }
[ "public", "static", "TraceEvent", "getType", "(", "List", "<", "TraceEvent", ">", "events", ",", "String", "identifier", ",", "int", "...", "types", ")", "{", "for", "(", "TraceEvent", "te", ":", "events", ")", "{", "for", "(", "int", "type", ":", "typ...
Get a specific event type @param events The events @param identifier The connection listener @param types The types @return The first event type found; otherwise <code>null</code> if none
[ "Get", "a", "specific", "event", "type" ]
train
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/tracer/src/main/java/org/ironjacamar/tracer/TraceEventHelper.java#L1036-L1048
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/basic/service.java
service.count_filtered
public static long count_filtered(nitro_service service, String filter) throws Exception{ service obj = new service(); options option = new options(); option.set_count(true); option.set_filter(filter); service[] response = (service[]) obj.getfiltered(service, option); if (response != null) { return response[0].__count; } return 0; }
java
public static long count_filtered(nitro_service service, String filter) throws Exception{ service obj = new service(); options option = new options(); option.set_count(true); option.set_filter(filter); service[] response = (service[]) obj.getfiltered(service, option); if (response != null) { return response[0].__count; } return 0; }
[ "public", "static", "long", "count_filtered", "(", "nitro_service", "service", ",", "String", "filter", ")", "throws", "Exception", "{", "service", "obj", "=", "new", "service", "(", ")", ";", "options", "option", "=", "new", "options", "(", ")", ";", "opt...
Use this API to count filtered the set of service resources. filter string should be in JSON format.eg: "port:80,servicetype:HTTP".
[ "Use", "this", "API", "to", "count", "filtered", "the", "set", "of", "service", "resources", ".", "filter", "string", "should", "be", "in", "JSON", "format", ".", "eg", ":", "port", ":", "80", "servicetype", ":", "HTTP", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/basic/service.java#L1857-L1867
geomajas/geomajas-project-server
plugin/print/print/src/main/java/org/geomajas/plugin/printing/component/PdfContext.java
PdfContext.strokeRoundRectangle
public void strokeRoundRectangle(Rectangle rect, Color color, float linewidth, float r) { template.saveState(); setStroke(color, linewidth, null); template.roundRectangle(origX + rect.getLeft(), origY + rect.getBottom(), rect.getWidth(), rect.getHeight(), r); template.stroke(); template.restoreState(); }
java
public void strokeRoundRectangle(Rectangle rect, Color color, float linewidth, float r) { template.saveState(); setStroke(color, linewidth, null); template.roundRectangle(origX + rect.getLeft(), origY + rect.getBottom(), rect.getWidth(), rect.getHeight(), r); template.stroke(); template.restoreState(); }
[ "public", "void", "strokeRoundRectangle", "(", "Rectangle", "rect", ",", "Color", "color", ",", "float", "linewidth", ",", "float", "r", ")", "{", "template", ".", "saveState", "(", ")", ";", "setStroke", "(", "color", ",", "linewidth", ",", "null", ")", ...
Draw a rounded rectangular boundary. @param rect rectangle @param color colour @param linewidth line width @param r radius for rounded corners
[ "Draw", "a", "rounded", "rectangular", "boundary", "." ]
train
https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/plugin/print/print/src/main/java/org/geomajas/plugin/printing/component/PdfContext.java#L225-L231
albfernandez/itext2
src/main/java/com/lowagie/text/rtf/RtfWriter2.java
RtfWriter2.setMargins
public boolean setMargins(float left, float right, float top, float bottom) { rtfDoc.getDocumentHeader().getPageSetting().setMarginLeft((int) (left * RtfElement.TWIPS_FACTOR)); rtfDoc.getDocumentHeader().getPageSetting().setMarginRight((int) (right * RtfElement.TWIPS_FACTOR)); rtfDoc.getDocumentHeader().getPageSetting().setMarginTop((int) (top * RtfElement.TWIPS_FACTOR)); rtfDoc.getDocumentHeader().getPageSetting().setMarginBottom((int) (bottom * RtfElement.TWIPS_FACTOR)); return true; }
java
public boolean setMargins(float left, float right, float top, float bottom) { rtfDoc.getDocumentHeader().getPageSetting().setMarginLeft((int) (left * RtfElement.TWIPS_FACTOR)); rtfDoc.getDocumentHeader().getPageSetting().setMarginRight((int) (right * RtfElement.TWIPS_FACTOR)); rtfDoc.getDocumentHeader().getPageSetting().setMarginTop((int) (top * RtfElement.TWIPS_FACTOR)); rtfDoc.getDocumentHeader().getPageSetting().setMarginBottom((int) (bottom * RtfElement.TWIPS_FACTOR)); return true; }
[ "public", "boolean", "setMargins", "(", "float", "left", ",", "float", "right", ",", "float", "top", ",", "float", "bottom", ")", "{", "rtfDoc", ".", "getDocumentHeader", "(", ")", ".", "getPageSetting", "(", ")", ".", "setMarginLeft", "(", "(", "int", "...
Sets the page margins @param left The left margin @param right The right margin @param top The top margin @param bottom The bottom margin @return <code>false</code>
[ "Sets", "the", "page", "margins" ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/rtf/RtfWriter2.java#L217-L223
codeprimate-software/cp-elements
src/main/java/org/cp/elements/util/MapUtils.java
MapUtils.count
@NullSafe public static <K, V> int count(Map<K, V> map) { return (map != null ? map.size() : 0); }
java
@NullSafe public static <K, V> int count(Map<K, V> map) { return (map != null ? map.size() : 0); }
[ "@", "NullSafe", "public", "static", "<", "K", ",", "V", ">", "int", "count", "(", "Map", "<", "K", ",", "V", ">", "map", ")", "{", "return", "(", "map", "!=", "null", "?", "map", ".", "size", "(", ")", ":", "0", ")", ";", "}" ]
Determines the number of entries (key-value pairs) in the {@link Map}. This method is null-safe and will return 0 if the {@link Map} is null or empty. @param <K> Class type of the key. @param <V> Class type of the value. @param map {@link Map} to evaluate. @return the size, or number of elements in the {@link Map}, returning 0 if the {@link Map} is null or empty.
[ "Determines", "the", "number", "of", "entries", "(", "key", "-", "value", "pairs", ")", "in", "the", "{", "@link", "Map", "}", ".", "This", "method", "is", "null", "-", "safe", "and", "will", "return", "0", "if", "the", "{", "@link", "Map", "}", "i...
train
https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/util/MapUtils.java#L60-L63
lessthanoptimal/ejml
main/ejml-core/src/org/ejml/data/DMatrixSparseTriplet.java
DMatrixSparseTriplet.unsafe_set
@Override public void unsafe_set(int row, int col, double value) { int index = nz_index(row,col); if( index < 0 ) addItem( row,col,value); else { nz_value.data[index] = value; } }
java
@Override public void unsafe_set(int row, int col, double value) { int index = nz_index(row,col); if( index < 0 ) addItem( row,col,value); else { nz_value.data[index] = value; } }
[ "@", "Override", "public", "void", "unsafe_set", "(", "int", "row", ",", "int", "col", ",", "double", "value", ")", "{", "int", "index", "=", "nz_index", "(", "row", ",", "col", ")", ";", "if", "(", "index", "<", "0", ")", "addItem", "(", "row", ...
Same as {@link #set(int, int, double)} but does not check to see if row and column are within bounds. @param row Matrix element's row index. @param col Matrix element's column index. @param value value of element.
[ "Same", "as", "{", "@link", "#set", "(", "int", "int", "double", ")", "}", "but", "does", "not", "check", "to", "see", "if", "row", "and", "column", "are", "within", "bounds", "." ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-core/src/org/ejml/data/DMatrixSparseTriplet.java#L169-L177
TouK/sputnik
src/main/java/pl/touk/sputnik/processor/sonar/SonarProcessor.java
SonarProcessor.filterResults
@VisibleForTesting ReviewResult filterResults(ReviewResult results, Review review) { ReviewResult filteredResults = new ReviewResult(); Set<String> reviewFiles = new HashSet<>(); for (ReviewFile file : review.getFiles()) { reviewFiles.add(file.getReviewFilename()); } for (Violation violation : results.getViolations()) { if (reviewFiles.contains(violation.getFilenameOrJavaClassName())) { filteredResults.add(violation); } } return filteredResults; }
java
@VisibleForTesting ReviewResult filterResults(ReviewResult results, Review review) { ReviewResult filteredResults = new ReviewResult(); Set<String> reviewFiles = new HashSet<>(); for (ReviewFile file : review.getFiles()) { reviewFiles.add(file.getReviewFilename()); } for (Violation violation : results.getViolations()) { if (reviewFiles.contains(violation.getFilenameOrJavaClassName())) { filteredResults.add(violation); } } return filteredResults; }
[ "@", "VisibleForTesting", "ReviewResult", "filterResults", "(", "ReviewResult", "results", ",", "Review", "review", ")", "{", "ReviewResult", "filteredResults", "=", "new", "ReviewResult", "(", ")", ";", "Set", "<", "String", ">", "reviewFiles", "=", "new", "Has...
Filters a ReviewResult to keep only the violations that are about a file which is modified by a given review.
[ "Filters", "a", "ReviewResult", "to", "keep", "only", "the", "violations", "that", "are", "about", "a", "file", "which", "is", "modified", "by", "a", "given", "review", "." ]
train
https://github.com/TouK/sputnik/blob/64569e603d8837e800e3b3797b604a6942a7b5c5/src/main/java/pl/touk/sputnik/processor/sonar/SonarProcessor.java#L62-L75
alkacon/opencms-core
src/org/opencms/ui/components/CmsBasicDialog.java
CmsBasicDialog.createResourceListPanelDirectly
protected Panel createResourceListPanelDirectly(String caption, List<CmsResourceInfo> resourceInfo) { Panel result = new Panel(caption); result.addStyleName("v-scrollable"); result.setSizeFull(); VerticalLayout resourcePanel = new VerticalLayout(); result.setContent(resourcePanel); resourcePanel.addStyleName(OpenCmsTheme.REDUCED_MARGIN); resourcePanel.addStyleName(OpenCmsTheme.REDUCED_SPACING); resourcePanel.setSpacing(true); resourcePanel.setMargin(true); for (CmsResourceInfo resource : resourceInfo) { resourcePanel.addComponent(resource); } return result; }
java
protected Panel createResourceListPanelDirectly(String caption, List<CmsResourceInfo> resourceInfo) { Panel result = new Panel(caption); result.addStyleName("v-scrollable"); result.setSizeFull(); VerticalLayout resourcePanel = new VerticalLayout(); result.setContent(resourcePanel); resourcePanel.addStyleName(OpenCmsTheme.REDUCED_MARGIN); resourcePanel.addStyleName(OpenCmsTheme.REDUCED_SPACING); resourcePanel.setSpacing(true); resourcePanel.setMargin(true); for (CmsResourceInfo resource : resourceInfo) { resourcePanel.addComponent(resource); } return result; }
[ "protected", "Panel", "createResourceListPanelDirectly", "(", "String", "caption", ",", "List", "<", "CmsResourceInfo", ">", "resourceInfo", ")", "{", "Panel", "result", "=", "new", "Panel", "(", "caption", ")", ";", "result", ".", "addStyleName", "(", "\"v-scro...
Creates a resource list panel.<p> @param caption the caption to use @param resourceInfo the resource-infos @return the panel
[ "Creates", "a", "resource", "list", "panel", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/components/CmsBasicDialog.java#L543-L558
Stratio/bdt
src/main/java/com/stratio/qa/specs/DatabaseSpec.java
DatabaseSpec.elasticSearchIndexContainsDocument
@Then("^The Elasticsearch index named '(.+?)' and mapping '(.+?)' contains a column named '(.+?)' with the value '(.+?)'$") public void elasticSearchIndexContainsDocument(String indexName, String mappingName, String columnName, String columnValue) throws Exception { Assertions.assertThat((commonspec.getElasticSearchClient().searchSimpleFilterElasticsearchQuery( indexName, mappingName, columnName, columnValue, "equals" ).size()) > 0).isTrue().withFailMessage("The index does not contain that document"); }
java
@Then("^The Elasticsearch index named '(.+?)' and mapping '(.+?)' contains a column named '(.+?)' with the value '(.+?)'$") public void elasticSearchIndexContainsDocument(String indexName, String mappingName, String columnName, String columnValue) throws Exception { Assertions.assertThat((commonspec.getElasticSearchClient().searchSimpleFilterElasticsearchQuery( indexName, mappingName, columnName, columnValue, "equals" ).size()) > 0).isTrue().withFailMessage("The index does not contain that document"); }
[ "@", "Then", "(", "\"^The Elasticsearch index named '(.+?)' and mapping '(.+?)' contains a column named '(.+?)' with the value '(.+?)'$\"", ")", "public", "void", "elasticSearchIndexContainsDocument", "(", "String", "indexName", ",", "String", "mappingName", ",", "String", "columnNam...
Check that an elasticsearch index contains a specific document @param indexName @param columnName @param columnValue
[ "Check", "that", "an", "elasticsearch", "index", "contains", "a", "specific", "document" ]
train
https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/specs/DatabaseSpec.java#L873-L882
UrielCh/ovh-java-sdk
ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java
ApiOvhDedicatedserver.serviceName_license_compliantWindows_GET
public ArrayList<OvhWindowsOsVersionEnum> serviceName_license_compliantWindows_GET(String serviceName) throws IOException { String qPath = "/dedicated/server/{serviceName}/license/compliantWindows"; StringBuilder sb = path(qPath, serviceName); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t7); }
java
public ArrayList<OvhWindowsOsVersionEnum> serviceName_license_compliantWindows_GET(String serviceName) throws IOException { String qPath = "/dedicated/server/{serviceName}/license/compliantWindows"; StringBuilder sb = path(qPath, serviceName); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t7); }
[ "public", "ArrayList", "<", "OvhWindowsOsVersionEnum", ">", "serviceName_license_compliantWindows_GET", "(", "String", "serviceName", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/dedicated/server/{serviceName}/license/compliantWindows\"", ";", "StringBuilder", ...
Get the windows license compliant with your server. REST: GET /dedicated/server/{serviceName}/license/compliantWindows @param serviceName [required] The internal name of your dedicated server
[ "Get", "the", "windows", "license", "compliant", "with", "your", "server", "." ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java#L1207-L1212
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/ValueEnforcer.java
ValueEnforcer.isBetweenInclusive
public static double isBetweenInclusive (final double dValue, final String sName, final double dLowerBoundInclusive, final double dUpperBoundInclusive) { if (isEnabled ()) return isBetweenInclusive (dValue, () -> sName, dLowerBoundInclusive, dUpperBoundInclusive); return dValue; }
java
public static double isBetweenInclusive (final double dValue, final String sName, final double dLowerBoundInclusive, final double dUpperBoundInclusive) { if (isEnabled ()) return isBetweenInclusive (dValue, () -> sName, dLowerBoundInclusive, dUpperBoundInclusive); return dValue; }
[ "public", "static", "double", "isBetweenInclusive", "(", "final", "double", "dValue", ",", "final", "String", "sName", ",", "final", "double", "dLowerBoundInclusive", ",", "final", "double", "dUpperBoundInclusive", ")", "{", "if", "(", "isEnabled", "(", ")", ")"...
Check if <code>nValue &ge; nLowerBoundInclusive &amp;&amp; nValue &le; nUpperBoundInclusive</code> @param dValue Value @param sName Name @param dLowerBoundInclusive Lower bound @param dUpperBoundInclusive Upper bound @return The value
[ "Check", "if", "<code", ">", "nValue", "&ge", ";", "nLowerBoundInclusive", "&amp", ";", "&amp", ";", "nValue", "&le", ";", "nUpperBoundInclusive<", "/", "code", ">" ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/ValueEnforcer.java#L2445-L2453
Azure/azure-sdk-for-java
cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/DatabaseAccountsInner.java
DatabaseAccountsInner.beginPatch
public DatabaseAccountInner beginPatch(String resourceGroupName, String accountName, DatabaseAccountPatchParameters updateParameters) { return beginPatchWithServiceResponseAsync(resourceGroupName, accountName, updateParameters).toBlocking().single().body(); }
java
public DatabaseAccountInner beginPatch(String resourceGroupName, String accountName, DatabaseAccountPatchParameters updateParameters) { return beginPatchWithServiceResponseAsync(resourceGroupName, accountName, updateParameters).toBlocking().single().body(); }
[ "public", "DatabaseAccountInner", "beginPatch", "(", "String", "resourceGroupName", ",", "String", "accountName", ",", "DatabaseAccountPatchParameters", "updateParameters", ")", "{", "return", "beginPatchWithServiceResponseAsync", "(", "resourceGroupName", ",", "accountName", ...
Patches the properties of an existing Azure Cosmos DB database account. @param resourceGroupName Name of an Azure resource group. @param accountName Cosmos DB database account name. @param updateParameters The tags parameter to patch for the current database account. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the DatabaseAccountInner object if successful.
[ "Patches", "the", "properties", "of", "an", "existing", "Azure", "Cosmos", "DB", "database", "account", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/DatabaseAccountsInner.java#L351-L353
Azure/azure-sdk-for-java
network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ConnectionMonitorsInner.java
ConnectionMonitorsInner.queryAsync
public Observable<ConnectionMonitorQueryResultInner> queryAsync(String resourceGroupName, String networkWatcherName, String connectionMonitorName) { return queryWithServiceResponseAsync(resourceGroupName, networkWatcherName, connectionMonitorName).map(new Func1<ServiceResponse<ConnectionMonitorQueryResultInner>, ConnectionMonitorQueryResultInner>() { @Override public ConnectionMonitorQueryResultInner call(ServiceResponse<ConnectionMonitorQueryResultInner> response) { return response.body(); } }); }
java
public Observable<ConnectionMonitorQueryResultInner> queryAsync(String resourceGroupName, String networkWatcherName, String connectionMonitorName) { return queryWithServiceResponseAsync(resourceGroupName, networkWatcherName, connectionMonitorName).map(new Func1<ServiceResponse<ConnectionMonitorQueryResultInner>, ConnectionMonitorQueryResultInner>() { @Override public ConnectionMonitorQueryResultInner call(ServiceResponse<ConnectionMonitorQueryResultInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ConnectionMonitorQueryResultInner", ">", "queryAsync", "(", "String", "resourceGroupName", ",", "String", "networkWatcherName", ",", "String", "connectionMonitorName", ")", "{", "return", "queryWithServiceResponseAsync", "(", "resourceGroupName",...
Query a snapshot of the most recent connection states. @param resourceGroupName The name of the resource group containing Network Watcher. @param networkWatcherName The name of the Network Watcher resource. @param connectionMonitorName The name given to the connection monitor. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Query", "a", "snapshot", "of", "the", "most", "recent", "connection", "states", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ConnectionMonitorsInner.java#L913-L920
eFaps/eFaps-Kernel
src/main/java/org/efaps/db/AbstractPrintQuery.java
AbstractPrintQuery.addMsgPhrase
public AbstractPrintQuery addMsgPhrase(final SelectBuilder _selectBldr, final CIMsgPhrase... _ciMsgPhrases) throws EFapsException { final Set<MsgPhrase> msgPhrases = new HashSet<>(); for (final CIMsgPhrase ciMsgPhrase : _ciMsgPhrases) { msgPhrases.add(ciMsgPhrase.getMsgPhrase()); } return addMsgPhrase(_selectBldr, msgPhrases.toArray(new MsgPhrase[msgPhrases.size()])); }
java
public AbstractPrintQuery addMsgPhrase(final SelectBuilder _selectBldr, final CIMsgPhrase... _ciMsgPhrases) throws EFapsException { final Set<MsgPhrase> msgPhrases = new HashSet<>(); for (final CIMsgPhrase ciMsgPhrase : _ciMsgPhrases) { msgPhrases.add(ciMsgPhrase.getMsgPhrase()); } return addMsgPhrase(_selectBldr, msgPhrases.toArray(new MsgPhrase[msgPhrases.size()])); }
[ "public", "AbstractPrintQuery", "addMsgPhrase", "(", "final", "SelectBuilder", "_selectBldr", ",", "final", "CIMsgPhrase", "...", "_ciMsgPhrases", ")", "throws", "EFapsException", "{", "final", "Set", "<", "MsgPhrase", ">", "msgPhrases", "=", "new", "HashSet", "<>",...
Adds the msg phrase. @param _selectBldr the select bldr @param _ciMsgPhrases the _ci msg phrases @return the abstract print query @throws EFapsException on error
[ "Adds", "the", "msg", "phrase", "." ]
train
https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/db/AbstractPrintQuery.java#L459-L468
greatman/GreatmancodeTools
src/main/java/com/greatmancode/tools/utils/Vector.java
Vector.isInSphere
public boolean isInSphere(Vector origin, double radius) { return (NumberConversions.square(origin.x - x) + NumberConversions.square(origin.y - y) + NumberConversions.square(origin.z - z)) <= NumberConversions.square(radius); }
java
public boolean isInSphere(Vector origin, double radius) { return (NumberConversions.square(origin.x - x) + NumberConversions.square(origin.y - y) + NumberConversions.square(origin.z - z)) <= NumberConversions.square(radius); }
[ "public", "boolean", "isInSphere", "(", "Vector", "origin", ",", "double", "radius", ")", "{", "return", "(", "NumberConversions", ".", "square", "(", "origin", ".", "x", "-", "x", ")", "+", "NumberConversions", ".", "square", "(", "origin", ".", "y", "-...
Returns whether this vector is within a sphere. @param origin Sphere origin. @param radius Sphere radius @return whether this vector is in the sphere
[ "Returns", "whether", "this", "vector", "is", "within", "a", "sphere", "." ]
train
https://github.com/greatman/GreatmancodeTools/blob/4c9d2656c5c8298ff9e1f235c9be8b148e43c9f1/src/main/java/com/greatmancode/tools/utils/Vector.java#L368-L370
openbase/jul
visual/javafx/src/main/java/org/openbase/jul/visual/javafx/geometry/Line3D.java
Line3D.setStartEndPoints
public final void setStartEndPoints(final Point3D start, final Point3D end) { final Point3D direction = start.subtract(end); final Point3D position = start.midpoint(end); setLength(direction.magnitude()); final Point3D axis = UP.crossProduct(direction.normalize()); super.setVisible(true); super.setTranslateX(position.getX()); super.setTranslateY(position.getY()); super.setTranslateZ(position.getZ()); super.setRotationAxis(axis); super.setRotate(UP.angle(direction.normalize())); }
java
public final void setStartEndPoints(final Point3D start, final Point3D end) { final Point3D direction = start.subtract(end); final Point3D position = start.midpoint(end); setLength(direction.magnitude()); final Point3D axis = UP.crossProduct(direction.normalize()); super.setVisible(true); super.setTranslateX(position.getX()); super.setTranslateY(position.getY()); super.setTranslateZ(position.getZ()); super.setRotationAxis(axis); super.setRotate(UP.angle(direction.normalize())); }
[ "public", "final", "void", "setStartEndPoints", "(", "final", "Point3D", "start", ",", "final", "Point3D", "end", ")", "{", "final", "Point3D", "direction", "=", "start", ".", "subtract", "(", "end", ")", ";", "final", "Point3D", "position", "=", "start", ...
Sets the start and end point of the line. @param start Start point of the line. @param end End point of the line.
[ "Sets", "the", "start", "and", "end", "point", "of", "the", "line", "." ]
train
https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/visual/javafx/src/main/java/org/openbase/jul/visual/javafx/geometry/Line3D.java#L118-L129
code4everything/util
src/main/java/com/zhazhapan/util/decryption/SimpleDecrypt.java
SimpleDecrypt.mix
public static String mix(String code, int key) throws IOException { return xor(JavaDecrypt.base64(ascii(code, key)), key); }
java
public static String mix(String code, int key) throws IOException { return xor(JavaDecrypt.base64(ascii(code, key)), key); }
[ "public", "static", "String", "mix", "(", "String", "code", ",", "int", "key", ")", "throws", "IOException", "{", "return", "xor", "(", "JavaDecrypt", ".", "base64", "(", "ascii", "(", "code", ",", "key", ")", ")", ",", "key", ")", ";", "}" ]
混合解密 @param code {@link String} @param key {@link Integer} @return {@link String} @throws IOException 异常
[ "混合解密" ]
train
https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/decryption/SimpleDecrypt.java#L66-L68
flow/nbt
src/main/java/com/flowpowered/nbt/stream/NBTInputStream.java
NBTInputStream.readTag
private Tag readTag(int depth) throws IOException { int typeId = is.readByte() & 0xFF; TagType type = TagType.getById(typeId); String name; if (type != TagType.TAG_END) { int nameLength = is.readShort() & 0xFFFF; byte[] nameBytes = new byte[nameLength]; is.readFully(nameBytes); name = new String(nameBytes, NBTConstants.CHARSET.name()); } else { name = ""; } return readTagPayload(type, name, depth); }
java
private Tag readTag(int depth) throws IOException { int typeId = is.readByte() & 0xFF; TagType type = TagType.getById(typeId); String name; if (type != TagType.TAG_END) { int nameLength = is.readShort() & 0xFFFF; byte[] nameBytes = new byte[nameLength]; is.readFully(nameBytes); name = new String(nameBytes, NBTConstants.CHARSET.name()); } else { name = ""; } return readTagPayload(type, name, depth); }
[ "private", "Tag", "readTag", "(", "int", "depth", ")", "throws", "IOException", "{", "int", "typeId", "=", "is", ".", "readByte", "(", ")", "&", "0xFF", ";", "TagType", "type", "=", "TagType", ".", "getById", "(", "typeId", ")", ";", "String", "name", ...
Reads an NBT {@link Tag} from the stream. @param depth The depth of this tag. @return The tag that was read. @throws java.io.IOException if an I/O error occurs.
[ "Reads", "an", "NBT", "{", "@link", "Tag", "}", "from", "the", "stream", "." ]
train
https://github.com/flow/nbt/blob/7a1b6d986e6fbd01862356d47827b8b357349a22/src/main/java/com/flowpowered/nbt/stream/NBTInputStream.java#L113-L128
stephanenicolas/robospice
robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/request/notifier/SpiceServiceListenerNotifier.java
SpiceServiceListenerNotifier.notifyObserversOfRequestFailure
public void notifyObserversOfRequestFailure(CachedSpiceRequest<?> request) { RequestProcessingContext requestProcessingContext = new RequestProcessingContext(); requestProcessingContext.setExecutionThread(Thread.currentThread()); post(new RequestFailedNotifier(request, spiceServiceListenerList, requestProcessingContext)); }
java
public void notifyObserversOfRequestFailure(CachedSpiceRequest<?> request) { RequestProcessingContext requestProcessingContext = new RequestProcessingContext(); requestProcessingContext.setExecutionThread(Thread.currentThread()); post(new RequestFailedNotifier(request, spiceServiceListenerList, requestProcessingContext)); }
[ "public", "void", "notifyObserversOfRequestFailure", "(", "CachedSpiceRequest", "<", "?", ">", "request", ")", "{", "RequestProcessingContext", "requestProcessingContext", "=", "new", "RequestProcessingContext", "(", ")", ";", "requestProcessingContext", ".", "setExecutionT...
Notify interested observers that the request failed. @param request the request that failed.
[ "Notify", "interested", "observers", "that", "the", "request", "failed", "." ]
train
https://github.com/stephanenicolas/robospice/blob/8bffde88b3534a961a13cab72a8f07a755f0a0fe/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/request/notifier/SpiceServiceListenerNotifier.java#L91-L95
Jasig/uPortal
uPortal-portlets/src/main/java/org/apereo/portal/portlets/statistics/PortletExecutionStatisticsController.java
PortletExecutionStatisticsController.getReportTitleAugmentation
@Override protected String getReportTitleAugmentation(PortletExecutionReportForm form) { int groupSize = form.getGroups().size(); int portletSize = form.getPortlets().size(); int executionTypeSize = form.getExecutionTypeNames().size(); // Look up names in case we need them. They should be in cache so no real performance hit. String firstPortletName = this.aggregatedPortletLookupDao .getMappedPortletForFname(form.getPortlets().iterator().next()) .getFname(); Long firstGroupId = form.getGroups().iterator().next().longValue(); String firstGroupName = this.aggregatedGroupLookupDao.getGroupMapping(firstGroupId).getGroupName(); String firstExecutionType = form.getExecutionTypeNames().iterator().next(); TitleAndCount[] items = new TitleAndCount[] { new TitleAndCount(firstPortletName, portletSize), new TitleAndCount(firstExecutionType, executionTypeSize), new TitleAndCount(firstGroupName, groupSize) }; return titleAndColumnDescriptionStrategy.getReportTitleAugmentation(items); }
java
@Override protected String getReportTitleAugmentation(PortletExecutionReportForm form) { int groupSize = form.getGroups().size(); int portletSize = form.getPortlets().size(); int executionTypeSize = form.getExecutionTypeNames().size(); // Look up names in case we need them. They should be in cache so no real performance hit. String firstPortletName = this.aggregatedPortletLookupDao .getMappedPortletForFname(form.getPortlets().iterator().next()) .getFname(); Long firstGroupId = form.getGroups().iterator().next().longValue(); String firstGroupName = this.aggregatedGroupLookupDao.getGroupMapping(firstGroupId).getGroupName(); String firstExecutionType = form.getExecutionTypeNames().iterator().next(); TitleAndCount[] items = new TitleAndCount[] { new TitleAndCount(firstPortletName, portletSize), new TitleAndCount(firstExecutionType, executionTypeSize), new TitleAndCount(firstGroupName, groupSize) }; return titleAndColumnDescriptionStrategy.getReportTitleAugmentation(items); }
[ "@", "Override", "protected", "String", "getReportTitleAugmentation", "(", "PortletExecutionReportForm", "form", ")", "{", "int", "groupSize", "=", "form", ".", "getGroups", "(", ")", ".", "size", "(", ")", ";", "int", "portletSize", "=", "form", ".", "getPort...
Create report title. Criteria that have a single value selected are put into the title. Format and possible options are: <ul> <li>null (no change needed) <li>portlet <li>portlet (execution) <li>group <li>group (execution) <li>execution <li>portlet - group (also displayed if one of each criteria selected) </ul> @param form the form @return report title
[ "Create", "report", "title", ".", "Criteria", "that", "have", "a", "single", "value", "selected", "are", "put", "into", "the", "title", ".", "Format", "and", "possible", "options", "are", ":" ]
train
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-portlets/src/main/java/org/apereo/portal/portlets/statistics/PortletExecutionStatisticsController.java#L240-L264
ModeShape/modeshape
modeshape-jcr/src/main/java/org/modeshape/jcr/JcrQueryManager.java
JcrQueryManager.createQuery
public org.modeshape.jcr.api.query.Query createQuery( String expression, String language, Path storedAtPath, Locale locale ) throws InvalidQueryException, RepositoryException { session.checkLive(); // Look for a parser for the specified language ... QueryParsers queryParsers = session.repository().runningState().queryParsers(); QueryParser parser = queryParsers.getParserFor(language); if (parser == null) { Set<String> languages = queryParsers.getLanguages(); throw new InvalidQueryException(JcrI18n.invalidQueryLanguage.text(language, languages)); } try { // Parsing must be done now ... QueryCommand command = parser.parseQuery(expression, typeSystem); if (command == null) { // The query is not well-formed and cannot be parsed ... throw new InvalidQueryException(JcrI18n.queryCannotBeParsedUsingLanguage.text(language, expression)); } // Set up the hints ... PlanHints hints = new PlanHints(); hints.showPlan = true; hints.hasFullTextSearch = true; // always include the score hints.validateColumnExistance = false; // see MODE-1055 if (parser.getLanguage().equals(QueryLanguage.JCR_SQL2)) { hints.qualifyExpandedColumnNames = true; } return resultWith(expression, parser.getLanguage(), command, hints, storedAtPath, locale); } catch (ParsingException e) { // The query is not well-formed and cannot be parsed ... String reason = e.getMessage(); throw new InvalidQueryException(JcrI18n.queryCannotBeParsedUsingLanguage.text(language, expression, reason)); } catch (org.modeshape.jcr.query.parse.InvalidQueryException e) { // The query was parsed, but there is an error in the query String reason = e.getMessage(); throw new InvalidQueryException(JcrI18n.queryInLanguageIsNotValid.text(language, expression, reason)); } }
java
public org.modeshape.jcr.api.query.Query createQuery( String expression, String language, Path storedAtPath, Locale locale ) throws InvalidQueryException, RepositoryException { session.checkLive(); // Look for a parser for the specified language ... QueryParsers queryParsers = session.repository().runningState().queryParsers(); QueryParser parser = queryParsers.getParserFor(language); if (parser == null) { Set<String> languages = queryParsers.getLanguages(); throw new InvalidQueryException(JcrI18n.invalidQueryLanguage.text(language, languages)); } try { // Parsing must be done now ... QueryCommand command = parser.parseQuery(expression, typeSystem); if (command == null) { // The query is not well-formed and cannot be parsed ... throw new InvalidQueryException(JcrI18n.queryCannotBeParsedUsingLanguage.text(language, expression)); } // Set up the hints ... PlanHints hints = new PlanHints(); hints.showPlan = true; hints.hasFullTextSearch = true; // always include the score hints.validateColumnExistance = false; // see MODE-1055 if (parser.getLanguage().equals(QueryLanguage.JCR_SQL2)) { hints.qualifyExpandedColumnNames = true; } return resultWith(expression, parser.getLanguage(), command, hints, storedAtPath, locale); } catch (ParsingException e) { // The query is not well-formed and cannot be parsed ... String reason = e.getMessage(); throw new InvalidQueryException(JcrI18n.queryCannotBeParsedUsingLanguage.text(language, expression, reason)); } catch (org.modeshape.jcr.query.parse.InvalidQueryException e) { // The query was parsed, but there is an error in the query String reason = e.getMessage(); throw new InvalidQueryException(JcrI18n.queryInLanguageIsNotValid.text(language, expression, reason)); } }
[ "public", "org", ".", "modeshape", ".", "jcr", ".", "api", ".", "query", ".", "Query", "createQuery", "(", "String", "expression", ",", "String", "language", ",", "Path", "storedAtPath", ",", "Locale", "locale", ")", "throws", "InvalidQueryException", ",", "...
Creates a new JCR {@link Query} by specifying the query expression itself, the language in which the query is stated, the {@link QueryCommand} representation and, optionally, the node from which the query was loaded. The language must be a string from among those returned by {@code QueryManager#getSupportedQueryLanguages()}. @param expression the original query expression as supplied by the client; may not be null @param language the language in which the expression is represented; may not be null @param storedAtPath the path at which this query was stored, or null if this is not a stored query @param locale an optional {@link Locale} instance or null if no specific locale is to be used. @return query the JCR query object; never null @throws InvalidQueryException if expression is invalid or language is unsupported @throws RepositoryException if the session is no longer live
[ "Creates", "a", "new", "JCR", "{", "@link", "Query", "}", "by", "specifying", "the", "query", "expression", "itself", "the", "language", "in", "which", "the", "query", "is", "stated", "the", "{", "@link", "QueryCommand", "}", "representation", "and", "option...
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/JcrQueryManager.java#L126-L163
alkacon/opencms-core
src/org/opencms/staticexport/CmsStaticExportManager.java
CmsStaticExportManager.writeResource
protected void writeResource( HttpServletRequest req, String exportPath, String rfsName, CmsResource resource, byte[] content) throws CmsException { String exportFileName = CmsFileUtil.normalizePath(exportPath + rfsName); // make sure all required parent folder exist createExportFolder(exportPath, rfsName); // generate export file instance and output stream File exportFile = new File(exportFileName); // write new exported file content try { FileOutputStream exportStream = new FileOutputStream(exportFile); exportStream.write(content); exportStream.close(); // log export success if (LOG.isInfoEnabled()) { LOG.info( Messages.get().getBundle().key( Messages.LOG_STATIC_EXPORTED_2, resource.getRootPath(), exportFileName)); } } catch (Throwable t) { throw new CmsStaticExportException( Messages.get().container(Messages.ERR_OUTPUT_STREAM_1, exportFileName), t); } // update the file with the modification date from the server if (req != null) { Long dateLastModified = (Long)req.getAttribute(CmsRequestUtil.HEADER_OPENCMS_EXPORT); if ((dateLastModified != null) && (dateLastModified.longValue() != -1)) { exportFile.setLastModified((dateLastModified.longValue() / 1000) * 1000); if (LOG.isDebugEnabled()) { LOG.debug( Messages.get().getBundle().key( Messages.LOG_SET_LAST_MODIFIED_2, exportFile.getName(), new Long((dateLastModified.longValue() / 1000) * 1000))); } } } else { // otherwise take the last modification date form the OpenCms resource exportFile.setLastModified((resource.getDateLastModified() / 1000) * 1000); } }
java
protected void writeResource( HttpServletRequest req, String exportPath, String rfsName, CmsResource resource, byte[] content) throws CmsException { String exportFileName = CmsFileUtil.normalizePath(exportPath + rfsName); // make sure all required parent folder exist createExportFolder(exportPath, rfsName); // generate export file instance and output stream File exportFile = new File(exportFileName); // write new exported file content try { FileOutputStream exportStream = new FileOutputStream(exportFile); exportStream.write(content); exportStream.close(); // log export success if (LOG.isInfoEnabled()) { LOG.info( Messages.get().getBundle().key( Messages.LOG_STATIC_EXPORTED_2, resource.getRootPath(), exportFileName)); } } catch (Throwable t) { throw new CmsStaticExportException( Messages.get().container(Messages.ERR_OUTPUT_STREAM_1, exportFileName), t); } // update the file with the modification date from the server if (req != null) { Long dateLastModified = (Long)req.getAttribute(CmsRequestUtil.HEADER_OPENCMS_EXPORT); if ((dateLastModified != null) && (dateLastModified.longValue() != -1)) { exportFile.setLastModified((dateLastModified.longValue() / 1000) * 1000); if (LOG.isDebugEnabled()) { LOG.debug( Messages.get().getBundle().key( Messages.LOG_SET_LAST_MODIFIED_2, exportFile.getName(), new Long((dateLastModified.longValue() / 1000) * 1000))); } } } else { // otherwise take the last modification date form the OpenCms resource exportFile.setLastModified((resource.getDateLastModified() / 1000) * 1000); } }
[ "protected", "void", "writeResource", "(", "HttpServletRequest", "req", ",", "String", "exportPath", ",", "String", "rfsName", ",", "CmsResource", "resource", ",", "byte", "[", "]", "content", ")", "throws", "CmsException", "{", "String", "exportFileName", "=", ...
Writes a resource to the given export path with the given rfs name and the given content.<p> @param req the current request @param exportPath the path to export the resource @param rfsName the rfs name @param resource the resource @param content the content @throws CmsException if something goes wrong
[ "Writes", "a", "resource", "to", "the", "given", "export", "path", "with", "the", "given", "rfs", "name", "and", "the", "given", "content", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/staticexport/CmsStaticExportManager.java#L2911-L2962
codegist/crest
core/src/main/java/org/codegist/crest/CRestBuilder.java
CRestBuilder.booleanFormat
public CRestBuilder booleanFormat(String trueFormat, String falseFormat) { return property(CREST_BOOLEAN_TRUE, trueFormat).property(CREST_BOOLEAN_FALSE, falseFormat); }
java
public CRestBuilder booleanFormat(String trueFormat, String falseFormat) { return property(CREST_BOOLEAN_TRUE, trueFormat).property(CREST_BOOLEAN_FALSE, falseFormat); }
[ "public", "CRestBuilder", "booleanFormat", "(", "String", "trueFormat", ",", "String", "falseFormat", ")", "{", "return", "property", "(", "CREST_BOOLEAN_TRUE", ",", "trueFormat", ")", ".", "property", "(", "CREST_BOOLEAN_FALSE", ",", "falseFormat", ")", ";", "}" ...
Overrides the default boolean format for serialization (default are "true" and "false"). @param trueFormat format for TRUE @param falseFormat format for FALSE @return current builder @see CRestConfig#CREST_BOOLEAN_TRUE @see CRestConfig#CREST_BOOLEAN_FALSE @see CRestConfig#getBooleanTrue() @see CRestConfig#getBooleanFalse()
[ "Overrides", "the", "default", "boolean", "format", "for", "serialization", "(", "default", "are", "true", "and", "false", ")", "." ]
train
https://github.com/codegist/crest/blob/e99ba7728b27d2ddb2c247261350f1b6fa7a6698/core/src/main/java/org/codegist/crest/CRestBuilder.java#L338-L340
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Calendar.java
Calendar.getDisplayName
public String getDisplayName(int field, int style, Locale locale) { if (!checkDisplayNameParams(field, style, ALL_STYLES, LONG, locale, ERA_MASK|MONTH_MASK|DAY_OF_WEEK_MASK|AM_PM_MASK)) { return null; } DateFormatSymbols symbols = DateFormatSymbols.getInstance(locale); String[] strings = getFieldStrings(field, style, symbols); if (strings != null) { int fieldValue = get(field); if (fieldValue < strings.length) { return strings[fieldValue]; } } return null; }
java
public String getDisplayName(int field, int style, Locale locale) { if (!checkDisplayNameParams(field, style, ALL_STYLES, LONG, locale, ERA_MASK|MONTH_MASK|DAY_OF_WEEK_MASK|AM_PM_MASK)) { return null; } DateFormatSymbols symbols = DateFormatSymbols.getInstance(locale); String[] strings = getFieldStrings(field, style, symbols); if (strings != null) { int fieldValue = get(field); if (fieldValue < strings.length) { return strings[fieldValue]; } } return null; }
[ "public", "String", "getDisplayName", "(", "int", "field", ",", "int", "style", ",", "Locale", "locale", ")", "{", "if", "(", "!", "checkDisplayNameParams", "(", "field", ",", "style", ",", "ALL_STYLES", ",", "LONG", ",", "locale", ",", "ERA_MASK", "|", ...
Returns the string representation of the calendar <code>field</code> value in the given <code>style</code> and <code>locale</code>. If no string representation is applicable, <code>null</code> is returned. This method calls {@link Calendar#get(int) get(field)} to get the calendar <code>field</code> value if the string representation is applicable to the given calendar <code>field</code>. <p>For example, if this <code>Calendar</code> is a <code>GregorianCalendar</code> and its date is 2005-01-01, then the string representation of the {@link #MONTH} field would be "January" in the long style in an English locale or "Jan" in the short style. However, no string representation would be available for the {@link #DAY_OF_MONTH} field, and this method would return <code>null</code>. <p>The default implementation supports the calendar fields for which a {@link DateFormatSymbols} has names in the given <code>locale</code>. @param field the calendar field for which the string representation is returned @param style the style applied to the string representation; one of {@link #SHORT_FORMAT} ({@link #SHORT}), {@link #SHORT_STANDALONE}, {@link #LONG_FORMAT} ({@link #LONG}), {@link #LONG_STANDALONE}, {@link #NARROW_FORMAT}, or {@link #NARROW_STANDALONE}. @param locale the locale for the string representation (any calendar types specified by {@code locale} are ignored) @return the string representation of the given {@code field} in the given {@code style}, or {@code null} if no string representation is applicable. @exception IllegalArgumentException if {@code field} or {@code style} is invalid, or if this {@code Calendar} is non-lenient and any of the calendar fields have invalid values @exception NullPointerException if {@code locale} is null @since 1.6
[ "Returns", "the", "string", "representation", "of", "the", "calendar", "<code", ">", "field<", "/", "code", ">", "value", "in", "the", "given", "<code", ">", "style<", "/", "code", ">", "and", "<code", ">", "locale<", "/", "code", ">", ".", "If", "no",...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Calendar.java#L2055-L2070
Impetus/Kundera
src/kundera-hbase/kundera-hbase-v2/src/main/java/com/impetus/client/hbase/schemamanager/HBaseSchemaManager.java
HBaseSchemaManager.vaildateHostPort
private void vaildateHostPort(String host, String port) { if (host == null || !StringUtils.isNumeric(port) || port.isEmpty()) { logger.error("Host or port should not be null / port should be numeric"); throw new IllegalArgumentException("Host or port should not be null / port should be numeric"); } }
java
private void vaildateHostPort(String host, String port) { if (host == null || !StringUtils.isNumeric(port) || port.isEmpty()) { logger.error("Host or port should not be null / port should be numeric"); throw new IllegalArgumentException("Host or port should not be null / port should be numeric"); } }
[ "private", "void", "vaildateHostPort", "(", "String", "host", ",", "String", "port", ")", "{", "if", "(", "host", "==", "null", "||", "!", "StringUtils", ".", "isNumeric", "(", "port", ")", "||", "port", ".", "isEmpty", "(", ")", ")", "{", "logger", ...
Vaildate host port. @param host the host @param port the port
[ "Vaildate", "host", "port", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-hbase/kundera-hbase-v2/src/main/java/com/impetus/client/hbase/schemamanager/HBaseSchemaManager.java#L558-L565
aws/aws-sdk-java
aws-java-sdk-kinesisvideo/src/main/java/com/amazonaws/services/kinesisvideo/internal/netty/handler/ErrorUnmarshallingHandler.java
ErrorUnmarshallingHandler.exceptionCaught
@Override public void exceptionCaught(final ChannelHandlerContext ctx, final Throwable cause) throws Exception { if (!notifiedOnFailure) { notifiedOnFailure = true; try { responseHandler.onFailure(new SdkClientException("Unable to execute HTTP request.", cause)); } finally { ctx.channel().close(); } } }
java
@Override public void exceptionCaught(final ChannelHandlerContext ctx, final Throwable cause) throws Exception { if (!notifiedOnFailure) { notifiedOnFailure = true; try { responseHandler.onFailure(new SdkClientException("Unable to execute HTTP request.", cause)); } finally { ctx.channel().close(); } } }
[ "@", "Override", "public", "void", "exceptionCaught", "(", "final", "ChannelHandlerContext", "ctx", ",", "final", "Throwable", "cause", ")", "throws", "Exception", "{", "if", "(", "!", "notifiedOnFailure", ")", "{", "notifiedOnFailure", "=", "true", ";", "try", ...
An exception was propagated from further up the pipeline (probably an IO exception of some sort). Notify the handler and kill the connection.
[ "An", "exception", "was", "propagated", "from", "further", "up", "the", "pipeline", "(", "probably", "an", "IO", "exception", "of", "some", "sort", ")", ".", "Notify", "the", "handler", "and", "kill", "the", "connection", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-kinesisvideo/src/main/java/com/amazonaws/services/kinesisvideo/internal/netty/handler/ErrorUnmarshallingHandler.java#L142-L152
mapfish/mapfish-print
core/src/main/java/org/mapfish/print/wrapper/json/PJsonArray.java
PJsonArray.getInt
@Override public final int getInt(final int i) { int val = this.array.optInt(i, Integer.MIN_VALUE); if (val == Integer.MIN_VALUE) { throw new ObjectMissingException(this, "[" + i + "]"); } return val; }
java
@Override public final int getInt(final int i) { int val = this.array.optInt(i, Integer.MIN_VALUE); if (val == Integer.MIN_VALUE) { throw new ObjectMissingException(this, "[" + i + "]"); } return val; }
[ "@", "Override", "public", "final", "int", "getInt", "(", "final", "int", "i", ")", "{", "int", "val", "=", "this", ".", "array", ".", "optInt", "(", "i", ",", "Integer", ".", "MIN_VALUE", ")", ";", "if", "(", "val", "==", "Integer", ".", "MIN_VALU...
Get the element at the index as an integer. @param i the index of the element to access
[ "Get", "the", "element", "at", "the", "index", "as", "an", "integer", "." ]
train
https://github.com/mapfish/mapfish-print/blob/25a452cb39f592bd8a53b20db1037703898e1e22/core/src/main/java/org/mapfish/print/wrapper/json/PJsonArray.java#L90-L97
arquillian/arquillian-extension-warp
impl/src/main/java/org/jboss/arquillian/warp/impl/server/delegation/RequestDelegator.java
RequestDelegator.tryDelegateRequest
public boolean tryDelegateRequest(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) { for (RequestDelegationService service : delegationServices) { if (canDelegate(service, request)) { delegate(service, request, response, filterChain); return true; } } return false; }
java
public boolean tryDelegateRequest(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) { for (RequestDelegationService service : delegationServices) { if (canDelegate(service, request)) { delegate(service, request, response, filterChain); return true; } } return false; }
[ "public", "boolean", "tryDelegateRequest", "(", "HttpServletRequest", "request", ",", "HttpServletResponse", "response", ",", "FilterChain", "filterChain", ")", "{", "for", "(", "RequestDelegationService", "service", ":", "delegationServices", ")", "{", "if", "(", "ca...
Checks whether the request should be delegated to some of the registered {@link RequestDelegationService}s.
[ "Checks", "whether", "the", "request", "should", "be", "delegated", "to", "some", "of", "the", "registered", "{" ]
train
https://github.com/arquillian/arquillian-extension-warp/blob/e958f4d782851baf7f40e39835d3d1ad185b74dd/impl/src/main/java/org/jboss/arquillian/warp/impl/server/delegation/RequestDelegator.java#L52-L62
osglworks/java-tool-ext
src/main/java/org/osgl/util/Token.java
Token.isTokenValid
@Deprecated @SuppressWarnings("unused") public static boolean isTokenValid(String secret, String oid, String token) { return isTokenValid(secret.getBytes(Charsets.UTF_8), oid, token); }
java
@Deprecated @SuppressWarnings("unused") public static boolean isTokenValid(String secret, String oid, String token) { return isTokenValid(secret.getBytes(Charsets.UTF_8), oid, token); }
[ "@", "Deprecated", "@", "SuppressWarnings", "(", "\"unused\"", ")", "public", "static", "boolean", "isTokenValid", "(", "String", "secret", ",", "String", "oid", ",", "String", "token", ")", "{", "return", "isTokenValid", "(", "secret", ".", "getBytes", "(", ...
This method is deprecated. Please use {@link #isTokenValid(byte[], String, String)} instead Check if a string is a valid token @param secret the secret to decrypt the string @param oid the ID supposed to be encapsulated in the token @param token the token string @return {@code true} if the token is valid
[ "This", "method", "is", "deprecated", ".", "Please", "use", "{", "@link", "#isTokenValid", "(", "byte", "[]", "String", "String", ")", "}", "instead" ]
train
https://github.com/osglworks/java-tool-ext/blob/43f034bd0a42e571e437f44aa20487d45248a30b/src/main/java/org/osgl/util/Token.java#L402-L406
UrielCh/ovh-java-sdk
ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java
ApiOvhEmaildomain.domain_acl_accountId_GET
public OvhAcl domain_acl_accountId_GET(String domain, String accountId) throws IOException { String qPath = "/email/domain/{domain}/acl/{accountId}"; StringBuilder sb = path(qPath, domain, accountId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhAcl.class); }
java
public OvhAcl domain_acl_accountId_GET(String domain, String accountId) throws IOException { String qPath = "/email/domain/{domain}/acl/{accountId}"; StringBuilder sb = path(qPath, domain, accountId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhAcl.class); }
[ "public", "OvhAcl", "domain_acl_accountId_GET", "(", "String", "domain", ",", "String", "accountId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/email/domain/{domain}/acl/{accountId}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", ...
Get this object properties REST: GET /email/domain/{domain}/acl/{accountId} @param domain [required] Name of your domain name @param accountId [required] OVH customer unique identifier
[ "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#L1308-L1313
Ordinastie/MalisisCore
src/main/java/net/malisis/core/asm/AsmUtils.java
AsmUtils.methodInsnEqual
public static boolean methodInsnEqual(MethodInsnNode insn1, MethodInsnNode insn2) { return insn1.owner.equals(insn2.owner) && insn1.name.equals(insn2.name) && insn1.desc.equals(insn2.desc); }
java
public static boolean methodInsnEqual(MethodInsnNode insn1, MethodInsnNode insn2) { return insn1.owner.equals(insn2.owner) && insn1.name.equals(insn2.name) && insn1.desc.equals(insn2.desc); }
[ "public", "static", "boolean", "methodInsnEqual", "(", "MethodInsnNode", "insn1", ",", "MethodInsnNode", "insn2", ")", "{", "return", "insn1", ".", "owner", ".", "equals", "(", "insn2", ".", "owner", ")", "&&", "insn1", ".", "name", ".", "equals", "(", "in...
Checks if two {@link MethodInsnNode} are equals. @param insn1 the insn1 @param insn2 the insn2 @return true, if successful
[ "Checks", "if", "two", "{", "@link", "MethodInsnNode", "}", "are", "equals", "." ]
train
https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/asm/AsmUtils.java#L195-L198