repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
192
func_name
stringlengths
5
108
whole_func_string
stringlengths
75
3.91k
language
stringclasses
1 value
func_code_string
stringlengths
75
3.91k
func_code_tokens
listlengths
21
629
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
111
306
eclipse/xtext-lib
org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/ShortExtensions.java
ShortExtensions.operator_minus
@Pure @Inline(value="($1 - $2)", constantExpression=true) public static long operator_minus(short a, long b) { return a - b; }
java
@Pure @Inline(value="($1 - $2)", constantExpression=true) public static long operator_minus(short a, long b) { return a - b; }
[ "@", "Pure", "@", "Inline", "(", "value", "=", "\"($1 - $2)\"", ",", "constantExpression", "=", "true", ")", "public", "static", "long", "operator_minus", "(", "short", "a", ",", "long", "b", ")", "{", "return", "a", "-", "b", ";", "}" ]
The binary <code>minus</code> operator. This is the equivalent to the Java <code>-</code> operator. @param a a short. @param b a long. @return <code>a-b</code> @since 2.3
[ "The", "binary", "<code", ">", "minus<", "/", "code", ">", "operator", ".", "This", "is", "the", "equivalent", "to", "the", "Java", "<code", ">", "-", "<", "/", "code", ">", "operator", "." ]
train
https://github.com/eclipse/xtext-lib/blob/7063572e1f1bd713a3aa53bdf3a8dc60e25c169a/org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/ShortExtensions.java#L499-L503
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/databinding/datagrid/AbstractCell.java
AbstractCell.addStateAttribute
protected final void addStateAttribute(AbstractHtmlState state, String name, String value) throws JspException { // validate the name attribute, in the case of an error simply return. if(name == null || name.length() <= 0) { String s = Bundle.getString("Tags_AttributeNameNotSet"); throw new JspException(s); } // it's not legal to set the id or name attributes this way if(name.equals(HtmlConstants.ID) || name.equals(HtmlConstants.NAME)) { String s = Bundle.getString("Tags_AttributeMayNotBeSet", new Object[]{name}); throw new JspException(s); } // if there is a style or class we will let them override the base if(name.equals(HtmlConstants.CLASS)) { state.styleClass = value; return; } else if(name.equals(HtmlConstants.STYLE)) { state.style = value; return; } state.registerAttribute(AbstractHtmlState.ATTR_GENERAL, name, value); }
java
protected final void addStateAttribute(AbstractHtmlState state, String name, String value) throws JspException { // validate the name attribute, in the case of an error simply return. if(name == null || name.length() <= 0) { String s = Bundle.getString("Tags_AttributeNameNotSet"); throw new JspException(s); } // it's not legal to set the id or name attributes this way if(name.equals(HtmlConstants.ID) || name.equals(HtmlConstants.NAME)) { String s = Bundle.getString("Tags_AttributeMayNotBeSet", new Object[]{name}); throw new JspException(s); } // if there is a style or class we will let them override the base if(name.equals(HtmlConstants.CLASS)) { state.styleClass = value; return; } else if(name.equals(HtmlConstants.STYLE)) { state.style = value; return; } state.registerAttribute(AbstractHtmlState.ATTR_GENERAL, name, value); }
[ "protected", "final", "void", "addStateAttribute", "(", "AbstractHtmlState", "state", ",", "String", "name", ",", "String", "value", ")", "throws", "JspException", "{", "// validate the name attribute, in the case of an error simply return.", "if", "(", "name", "==", "nul...
<p> Add an HTML state attribute to a {@link AbstractHtmlState} object. This method performs checks on common attributes and sets their values on the state object or throws an exception. </p> <p> For the HTML tags it is not legal to set the <code>id</code> or <code>name</code> attributes. In addition, the base tag does not allow facets to be set. If the attribute is legal it will be added to the general expression map stored in the <code>AbstractHtmlState</code> of the tag. </p> @param state the state object to which attributes are appliedn @param name the name of an attribute @param value the value of the attribute @throws JspException when an error occurs setting the attribute on the state object
[ "<p", ">", "Add", "an", "HTML", "state", "attribute", "to", "a", "{", "@link", "AbstractHtmlState", "}", "object", ".", "This", "method", "performs", "checks", "on", "common", "attributes", "and", "sets", "their", "values", "on", "the", "state", "object", ...
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/databinding/datagrid/AbstractCell.java#L195-L221
carewebframework/carewebframework-core
org.carewebframework.security-parent/org.carewebframework.security.core/src/main/java/org/carewebframework/security/CWFAuthenticationDetails.java
CWFAuthenticationDetails.setDetail
public void setDetail(String name, Object value) { if (value == null) { details.remove(name); } else { details.put(name, value); } if (log.isDebugEnabled()) { if (value == null) { log.debug("Detail removed: " + name); } else { log.debug("Detail added: " + name + " = " + value); } } }
java
public void setDetail(String name, Object value) { if (value == null) { details.remove(name); } else { details.put(name, value); } if (log.isDebugEnabled()) { if (value == null) { log.debug("Detail removed: " + name); } else { log.debug("Detail added: " + name + " = " + value); } } }
[ "public", "void", "setDetail", "(", "String", "name", ",", "Object", "value", ")", "{", "if", "(", "value", "==", "null", ")", "{", "details", ".", "remove", "(", "name", ")", ";", "}", "else", "{", "details", ".", "put", "(", "name", ",", "value",...
Sets the specified detail element to the specified value. @param name Name of the detail element. @param value Value for the detail element. A null value removes any existing detail element.
[ "Sets", "the", "specified", "detail", "element", "to", "the", "specified", "value", "." ]
train
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.security-parent/org.carewebframework.security.core/src/main/java/org/carewebframework/security/CWFAuthenticationDetails.java#L62-L76
apereo/cas
core/cas-server-core-web-api/src/main/java/org/apereo/cas/web/support/WebUtils.java
WebUtils.putServiceTicketInRequestScope
public static void putServiceTicketInRequestScope(final RequestContext context, final ServiceTicket ticketValue) { context.getRequestScope().put(PARAMETER_SERVICE_TICKET_ID, ticketValue.getId()); }
java
public static void putServiceTicketInRequestScope(final RequestContext context, final ServiceTicket ticketValue) { context.getRequestScope().put(PARAMETER_SERVICE_TICKET_ID, ticketValue.getId()); }
[ "public", "static", "void", "putServiceTicketInRequestScope", "(", "final", "RequestContext", "context", ",", "final", "ServiceTicket", "ticketValue", ")", "{", "context", ".", "getRequestScope", "(", ")", ".", "put", "(", "PARAMETER_SERVICE_TICKET_ID", ",", "ticketVa...
Put service ticket in request scope. @param context the context @param ticketValue the ticket value
[ "Put", "service", "ticket", "in", "request", "scope", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-web-api/src/main/java/org/apereo/cas/web/support/WebUtils.java#L229-L231
pravega/pravega
common/src/main/java/io/pravega/common/tracing/RequestTracker.java
RequestTracker.getRequestTagFor
public RequestTag getRequestTagFor(String requestDescriptor) { Preconditions.checkNotNull(requestDescriptor, "Attempting to get a null request descriptor."); if (!tracingEnabled) { return new RequestTag(requestDescriptor, RequestTag.NON_EXISTENT_ID); } long requestId; List<Long> descriptorIds; synchronized (lock) { descriptorIds = ongoingRequests.getIfPresent(requestDescriptor); requestId = (descriptorIds == null || descriptorIds.size() == 0) ? RequestTag.NON_EXISTENT_ID : descriptorIds.get(0); if (descriptorIds == null) { log.debug("Attempting to get a non-existing tag: {}.", requestDescriptor); } else if (descriptorIds.size() > 1) { log.debug("{} request ids associated with same descriptor: {}. Propagating only first one: {}.", descriptorIds, requestDescriptor, requestId); } } return new RequestTag(requestDescriptor, requestId); }
java
public RequestTag getRequestTagFor(String requestDescriptor) { Preconditions.checkNotNull(requestDescriptor, "Attempting to get a null request descriptor."); if (!tracingEnabled) { return new RequestTag(requestDescriptor, RequestTag.NON_EXISTENT_ID); } long requestId; List<Long> descriptorIds; synchronized (lock) { descriptorIds = ongoingRequests.getIfPresent(requestDescriptor); requestId = (descriptorIds == null || descriptorIds.size() == 0) ? RequestTag.NON_EXISTENT_ID : descriptorIds.get(0); if (descriptorIds == null) { log.debug("Attempting to get a non-existing tag: {}.", requestDescriptor); } else if (descriptorIds.size() > 1) { log.debug("{} request ids associated with same descriptor: {}. Propagating only first one: {}.", descriptorIds, requestDescriptor, requestId); } } return new RequestTag(requestDescriptor, requestId); }
[ "public", "RequestTag", "getRequestTagFor", "(", "String", "requestDescriptor", ")", "{", "Preconditions", ".", "checkNotNull", "(", "requestDescriptor", ",", "\"Attempting to get a null request descriptor.\"", ")", ";", "if", "(", "!", "tracingEnabled", ")", "{", "retu...
Retrieves a {@link RequestTag} object formed by a request descriptor and request id. If the request descriptor does not exist or tracing is disabled, a new {@link RequestTag} object with a default request id is returned. In the case of concurrent requests with the same descriptor, multiple request ids will be associated to that request descriptor. The policy adopted is to retrieve the first one that was stored in the cache. Given that tracing is applied to idempotent operations, this allows us to consistently trace the operation that actually changes the state of the system. The rest of concurrent operations will be rejected and their response will be logged with a different requestId, as an indicator that another client request was ongoing. For more information, we refer to this PDP: https://github.com/pravega/pravega/wiki/PDP-31:-End-to-end-Request-Tags @param requestDescriptor Request descriptor as a single string. @return Request descriptor and request id pair embedded in a {@link RequestTag} object.
[ "Retrieves", "a", "{", "@link", "RequestTag", "}", "object", "formed", "by", "a", "request", "descriptor", "and", "request", "id", ".", "If", "the", "request", "descriptor", "does", "not", "exist", "or", "tracing", "is", "disabled", "a", "new", "{", "@link...
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/tracing/RequestTracker.java#L94-L114
alkacon/opencms-core
src-gwt/org/opencms/ade/galleries/client/ui/CmsResultsTab.java
CmsResultsTab.addSingleResult
protected void addSingleResult(CmsResultItemBean resultItem, boolean front, boolean showPath) { m_types.add(resultItem.getType()); boolean hasPreview = m_tabHandler.hasPreview(resultItem.getType()); CmsDNDHandler dndHandler = m_dndHandler; if (!m_galleryHandler.filterDnd(resultItem)) { dndHandler = null; } CmsResultListItem listItem = new CmsResultListItem(resultItem, hasPreview, showPath, dndHandler); if (resultItem.isPreset()) { m_preset = listItem; } if (hasPreview) { listItem.addPreviewClickHandler(new PreviewHandler(resultItem.getPath(), resultItem.getType())); } CmsUUID structureId = new CmsUUID(resultItem.getClientId()); listItem.getListItemWidget().addButton( new CmsContextMenuButton(structureId, m_contextMenuHandler, AdeContext.gallery)); listItem.getListItemWidget().addOpenHandler(new OpenHandler<CmsListItemWidget>() { public void onOpen(OpenEvent<CmsListItemWidget> event) { onContentChange(); } }); if (m_tabHandler.hasSelectResource()) { SelectHandler selectHandler = new SelectHandler( resultItem.getPath(), structureId, resultItem.getRawTitle(), resultItem.getType()); listItem.addSelectClickHandler(selectHandler); // this affects both tiled and non-tiled result lists. listItem.addDoubleClickHandler(selectHandler); } m_galleryHandler.processResultItem(listItem); if (front) { addWidgetToFrontOfList(listItem); } else { addWidgetToList(listItem); } }
java
protected void addSingleResult(CmsResultItemBean resultItem, boolean front, boolean showPath) { m_types.add(resultItem.getType()); boolean hasPreview = m_tabHandler.hasPreview(resultItem.getType()); CmsDNDHandler dndHandler = m_dndHandler; if (!m_galleryHandler.filterDnd(resultItem)) { dndHandler = null; } CmsResultListItem listItem = new CmsResultListItem(resultItem, hasPreview, showPath, dndHandler); if (resultItem.isPreset()) { m_preset = listItem; } if (hasPreview) { listItem.addPreviewClickHandler(new PreviewHandler(resultItem.getPath(), resultItem.getType())); } CmsUUID structureId = new CmsUUID(resultItem.getClientId()); listItem.getListItemWidget().addButton( new CmsContextMenuButton(structureId, m_contextMenuHandler, AdeContext.gallery)); listItem.getListItemWidget().addOpenHandler(new OpenHandler<CmsListItemWidget>() { public void onOpen(OpenEvent<CmsListItemWidget> event) { onContentChange(); } }); if (m_tabHandler.hasSelectResource()) { SelectHandler selectHandler = new SelectHandler( resultItem.getPath(), structureId, resultItem.getRawTitle(), resultItem.getType()); listItem.addSelectClickHandler(selectHandler); // this affects both tiled and non-tiled result lists. listItem.addDoubleClickHandler(selectHandler); } m_galleryHandler.processResultItem(listItem); if (front) { addWidgetToFrontOfList(listItem); } else { addWidgetToList(listItem); } }
[ "protected", "void", "addSingleResult", "(", "CmsResultItemBean", "resultItem", ",", "boolean", "front", ",", "boolean", "showPath", ")", "{", "m_types", ".", "add", "(", "resultItem", ".", "getType", "(", ")", ")", ";", "boolean", "hasPreview", "=", "m_tabHan...
Adds a list item for a single search result.<p> @param resultItem the search result @param front if true, adds the list item to the front of the list, else at the back @param showPath <code>true</code> to show the resource path in sub title
[ "Adds", "a", "list", "item", "for", "a", "single", "search", "result", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/galleries/client/ui/CmsResultsTab.java#L542-L584
iig-uni-freiburg/SEWOL
ext/org/deckfour/xes/extension/std/XCostExtension.java
XCostExtension.assignAmounts
public void assignAmounts(XTrace trace, Map<String, Double> amounts) { XCostAmount.instance().assignValues(trace, amounts); }
java
public void assignAmounts(XTrace trace, Map<String, Double> amounts) { XCostAmount.instance().assignValues(trace, amounts); }
[ "public", "void", "assignAmounts", "(", "XTrace", "trace", ",", "Map", "<", "String", ",", "Double", ">", "amounts", ")", "{", "XCostAmount", ".", "instance", "(", ")", ".", "assignValues", "(", "trace", ",", "amounts", ")", ";", "}" ]
Assigns (to the given trace) multiple amounts given their keys. Note that as a side effect this method creates attributes when it does not find an attribute with the proper key. For example, the call: <pre> assignAmounts(trace, [[a 10.00] [b 15.00] [c 25.00]]) </pre> should result into the following XES fragment: <pre> {@code <trace> <string key="a" value=""> <float key="cost:amount" value="10.00"/> </string> <string key="b" value=""> <float key="cost:amount" value="15.00"/> </string> <string key="c" value=""> <float key="cost:amount" value="25.00"/> </string> </trace> } </pre> @param trace Trace to assign the amounts to. @param amounts Mapping from keys to amounts which are to be assigned.
[ "Assigns", "(", "to", "the", "given", "trace", ")", "multiple", "amounts", "given", "their", "keys", ".", "Note", "that", "as", "a", "side", "effect", "this", "method", "creates", "attributes", "when", "it", "does", "not", "find", "an", "attribute", "with"...
train
https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/ext/org/deckfour/xes/extension/std/XCostExtension.java#L570-L572
mapbox/mapbox-navigation-android
libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/turnlane/TurnLaneView.java
TurnLaneView.updateLaneView
public void updateLaneView(@NonNull BannerComponents lane, @NonNull String maneuverModifier) { if (hasInvalidData(lane)) { return; } TurnLaneViewData drawData = buildTurnLaneViewData(lane, maneuverModifier); Integer resId = findDrawableResId(drawData); if (resId == null) { return; } drawFor(lane, drawData, resId); }
java
public void updateLaneView(@NonNull BannerComponents lane, @NonNull String maneuverModifier) { if (hasInvalidData(lane)) { return; } TurnLaneViewData drawData = buildTurnLaneViewData(lane, maneuverModifier); Integer resId = findDrawableResId(drawData); if (resId == null) { return; } drawFor(lane, drawData, resId); }
[ "public", "void", "updateLaneView", "(", "@", "NonNull", "BannerComponents", "lane", ",", "@", "NonNull", "String", "maneuverModifier", ")", "{", "if", "(", "hasInvalidData", "(", "lane", ")", ")", "{", "return", ";", "}", "TurnLaneViewData", "drawData", "=", ...
Updates this view based on the banner component lane data and the given maneuver modifier (to highlight which lane should be chosen). @param lane data {@link BannerComponents} @param maneuverModifier for the given maneuver
[ "Updates", "this", "view", "based", "on", "the", "banner", "component", "lane", "data", "and", "the", "given", "maneuver", "modifier", "(", "to", "highlight", "which", "lane", "should", "be", "chosen", ")", "." ]
train
https://github.com/mapbox/mapbox-navigation-android/blob/375a89c017d360b9defc2c90d0c03468165162ec/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/turnlane/TurnLaneView.java#L46-L57
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java
KeyVaultClientBaseImpl.getDeletedKeysAsync
public Observable<Page<DeletedKeyItem>> getDeletedKeysAsync(final String vaultBaseUrl, final Integer maxresults) { return getDeletedKeysWithServiceResponseAsync(vaultBaseUrl, maxresults) .map(new Func1<ServiceResponse<Page<DeletedKeyItem>>, Page<DeletedKeyItem>>() { @Override public Page<DeletedKeyItem> call(ServiceResponse<Page<DeletedKeyItem>> response) { return response.body(); } }); }
java
public Observable<Page<DeletedKeyItem>> getDeletedKeysAsync(final String vaultBaseUrl, final Integer maxresults) { return getDeletedKeysWithServiceResponseAsync(vaultBaseUrl, maxresults) .map(new Func1<ServiceResponse<Page<DeletedKeyItem>>, Page<DeletedKeyItem>>() { @Override public Page<DeletedKeyItem> call(ServiceResponse<Page<DeletedKeyItem>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "DeletedKeyItem", ">", ">", "getDeletedKeysAsync", "(", "final", "String", "vaultBaseUrl", ",", "final", "Integer", "maxresults", ")", "{", "return", "getDeletedKeysWithServiceResponseAsync", "(", "vaultBaseUrl", ",", "maxresu...
Lists the deleted keys in the specified vault. Retrieves a list of the keys in the Key Vault as JSON Web Key structures that contain the public part of a deleted key. This operation includes deletion-specific information. The Get Deleted Keys operation is applicable for vaults enabled for soft-delete. While the operation can be invoked on any vault, it will return an error if invoked on a non soft-delete enabled vault. This operation requires the keys/list permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param maxresults Maximum number of results to return in a page. If not specified the service will return up to 25 results. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;DeletedKeyItem&gt; object
[ "Lists", "the", "deleted", "keys", "in", "the", "specified", "vault", ".", "Retrieves", "a", "list", "of", "the", "keys", "in", "the", "Key", "Vault", "as", "JSON", "Web", "Key", "structures", "that", "contain", "the", "public", "part", "of", "a", "delet...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L2976-L2984
headius/invokebinder
src/main/java/com/headius/invokebinder/Signature.java
Signature.insertArg
public Signature insertArg(int index, String name, Class<?> type) { return insertArgs(index, new String[]{name}, new Class<?>[]{type}); }
java
public Signature insertArg(int index, String name, Class<?> type) { return insertArgs(index, new String[]{name}, new Class<?>[]{type}); }
[ "public", "Signature", "insertArg", "(", "int", "index", ",", "String", "name", ",", "Class", "<", "?", ">", "type", ")", "{", "return", "insertArgs", "(", "index", ",", "new", "String", "[", "]", "{", "name", "}", ",", "new", "Class", "<", "?", ">...
Insert an argument (name + type) into the signature. @param index the index at which to insert @param name the name of the new argument @param type the type of the new argument @return a new signature with the added arguments
[ "Insert", "an", "argument", "(", "name", "+", "type", ")", "into", "the", "signature", "." ]
train
https://github.com/headius/invokebinder/blob/ce6bfeb8e33265480daa7b797989dd915d51238d/src/main/java/com/headius/invokebinder/Signature.java#L250-L252
JoeKerouac/utils
src/main/java/com/joe/utils/common/StringUtils.java
StringUtils.lcs
private static long lcs(String arg0, String arg1, int i, int j) { if (arg0.length() == i || arg1.length() == j) { return 0; } if (arg0.charAt(i) == arg1.charAt(j)) { return 1 + lcs(arg0, arg1, ++i, ++j); } else { return Math.max(lcs(arg0, arg1, ++i, j), lcs(arg0, arg1, i, ++j)); } }
java
private static long lcs(String arg0, String arg1, int i, int j) { if (arg0.length() == i || arg1.length() == j) { return 0; } if (arg0.charAt(i) == arg1.charAt(j)) { return 1 + lcs(arg0, arg1, ++i, ++j); } else { return Math.max(lcs(arg0, arg1, ++i, j), lcs(arg0, arg1, i, ++j)); } }
[ "private", "static", "long", "lcs", "(", "String", "arg0", ",", "String", "arg1", ",", "int", "i", ",", "int", "j", ")", "{", "if", "(", "arg0", ".", "length", "(", ")", "==", "i", "||", "arg1", ".", "length", "(", ")", "==", "j", ")", "{", "...
求两个字符串的最大公共子序列的长度 @param arg0 字符串1 @param arg1 字符串2 @param i 字符串1的当前位置指针 @param j 字符串2的当前位置指针 @return 两个字符串的最大公共子序列的长度
[ "求两个字符串的最大公共子序列的长度" ]
train
https://github.com/JoeKerouac/utils/blob/45e1b2dc4d736956674fc4dcbe6cf84eaee69278/src/main/java/com/joe/utils/common/StringUtils.java#L261-L271
structr/structr
structr-ui/src/main/java/org/structr/web/common/FileHelper.java
FileHelper.getContentMimeType
public static String getContentMimeType(final java.io.File file, final String name) throws IOException { String mimeType; // try name first, if not null if (name != null) { mimeType = mimeTypeMap.getContentType(name); if (mimeType != null && !UNKNOWN_MIME_TYPE.equals(mimeType)) { return mimeType; } } try (final InputStream is = new BufferedInputStream(new FileInputStream(file))) { final MediaType mediaType = new DefaultDetector().detect(is, new Metadata()); if (mediaType != null) { mimeType = mediaType.toString(); if (mimeType != null) { return mimeType; } } } catch (NoClassDefFoundError t) { logger.warn("Unable to instantiate MIME type detector: {}", t.getMessage()); } // no success :( return UNKNOWN_MIME_TYPE; }
java
public static String getContentMimeType(final java.io.File file, final String name) throws IOException { String mimeType; // try name first, if not null if (name != null) { mimeType = mimeTypeMap.getContentType(name); if (mimeType != null && !UNKNOWN_MIME_TYPE.equals(mimeType)) { return mimeType; } } try (final InputStream is = new BufferedInputStream(new FileInputStream(file))) { final MediaType mediaType = new DefaultDetector().detect(is, new Metadata()); if (mediaType != null) { mimeType = mediaType.toString(); if (mimeType != null) { return mimeType; } } } catch (NoClassDefFoundError t) { logger.warn("Unable to instantiate MIME type detector: {}", t.getMessage()); } // no success :( return UNKNOWN_MIME_TYPE; }
[ "public", "static", "String", "getContentMimeType", "(", "final", "java", ".", "io", ".", "File", "file", ",", "final", "String", "name", ")", "throws", "IOException", "{", "String", "mimeType", ";", "// try name first, if not null", "if", "(", "name", "!=", "...
Return mime type of given file @param file @param name @return content type @throws java.io.IOException
[ "Return", "mime", "type", "of", "given", "file" ]
train
https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-ui/src/main/java/org/structr/web/common/FileHelper.java#L594-L624
craftercms/deployer
src/main/java/org/craftercms/deployer/utils/ConfigUtils.java
ConfigUtils.getStringProperty
public static String getStringProperty(Configuration config, String key, String defaultValue) throws DeployerConfigurationException { try { return config.getString(key, defaultValue); } catch (Exception e) { throw new DeployerConfigurationException("Failed to retrieve property '" + key + "'", e); } }
java
public static String getStringProperty(Configuration config, String key, String defaultValue) throws DeployerConfigurationException { try { return config.getString(key, defaultValue); } catch (Exception e) { throw new DeployerConfigurationException("Failed to retrieve property '" + key + "'", e); } }
[ "public", "static", "String", "getStringProperty", "(", "Configuration", "config", ",", "String", "key", ",", "String", "defaultValue", ")", "throws", "DeployerConfigurationException", "{", "try", "{", "return", "config", ".", "getString", "(", "key", ",", "defaul...
Returns the specified String property from the configuration @param config the configuration @param key the key of the property @param defaultValue the default value if the property is not found @return the String value of the property, or the default value if not found @throws DeployerConfigurationException if an error occurred
[ "Returns", "the", "specified", "String", "property", "from", "the", "configuration" ]
train
https://github.com/craftercms/deployer/blob/3ed446e3cc8af1055de2de6f871907f90ef27f63/src/main/java/org/craftercms/deployer/utils/ConfigUtils.java#L103-L110
unbescape/unbescape
src/main/java/org/unbescape/uri/UriEscape.java
UriEscape.escapeUriFragmentId
public static void escapeUriFragmentId(final Reader reader, final Writer writer, final String encoding) throws IOException { if (writer == null) { throw new IllegalArgumentException("Argument 'writer' cannot be null"); } if (encoding == null) { throw new IllegalArgumentException("Argument 'encoding' cannot be null"); } UriEscapeUtil.escape(reader, writer, UriEscapeUtil.UriEscapeType.FRAGMENT_ID, encoding); }
java
public static void escapeUriFragmentId(final Reader reader, final Writer writer, final String encoding) throws IOException { if (writer == null) { throw new IllegalArgumentException("Argument 'writer' cannot be null"); } if (encoding == null) { throw new IllegalArgumentException("Argument 'encoding' cannot be null"); } UriEscapeUtil.escape(reader, writer, UriEscapeUtil.UriEscapeType.FRAGMENT_ID, encoding); }
[ "public", "static", "void", "escapeUriFragmentId", "(", "final", "Reader", "reader", ",", "final", "Writer", "writer", ",", "final", "String", "encoding", ")", "throws", "IOException", "{", "if", "(", "writer", "==", "null", ")", "{", "throw", "new", "Illega...
<p> Perform am URI fragment identifier <strong>escape</strong> operation on a <tt>Reader</tt> input, writing results to a <tt>Writer</tt>. </p> <p> The following are the only allowed chars in an URI fragment identifier (will not be escaped): </p> <ul> <li><tt>A-Z a-z 0-9</tt></li> <li><tt>- . _ ~</tt></li> <li><tt>! $ &amp; ' ( ) * + , ; =</tt></li> <li><tt>: @</tt></li> <li><tt>/ ?</tt></li> </ul> <p> All other chars will be escaped by converting them to the sequence of bytes that represents them in the specified <em>encoding</em> and then representing each byte in <tt>%HH</tt> syntax, being <tt>HH</tt> the hexadecimal representation of the byte. </p> <p> This method is <strong>thread-safe</strong>. </p> @param reader the <tt>Reader</tt> reading the text to be escaped. @param writer the <tt>java.io.Writer</tt> to which the escaped result will be written. Nothing will be written at all to this writer if input is <tt>null</tt>. @param encoding the encoding to be used for escaping. @throws IOException if an input/output exception occurs @since 1.1.2
[ "<p", ">", "Perform", "am", "URI", "fragment", "identifier", "<strong", ">", "escape<", "/", "strong", ">", "operation", "on", "a", "<tt", ">", "Reader<", "/", "tt", ">", "input", "writing", "results", "to", "a", "<tt", ">", "Writer<", "/", "tt", ">", ...
train
https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/uri/UriEscape.java#L1094-L1107
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/utils/Unicode.java
Unicode.char2DOS437
public static synchronized String char2DOS437( StringBuffer stringbuffer, int i, char c ) { if (unicode2DOS437 == null) { unicode2DOS437 = new char[0x10000]; for( int j = 0; j < 256; j++ ) { char c1; if ((c1 = unicode[2][j]) != '\uFFFF') unicode2DOS437[c1] = (char) j; } } if (i != 2) { StringBuffer stringbuffer1 = new StringBuffer(stringbuffer.length()); for( int k = 0; k < stringbuffer.length(); k++ ) { char c2 = unicode2DOS437[stringbuffer.charAt(k)]; stringbuffer1.append(c2 == 0 ? c : c2); } return new String(stringbuffer1); } else { return new String(stringbuffer); } }
java
public static synchronized String char2DOS437( StringBuffer stringbuffer, int i, char c ) { if (unicode2DOS437 == null) { unicode2DOS437 = new char[0x10000]; for( int j = 0; j < 256; j++ ) { char c1; if ((c1 = unicode[2][j]) != '\uFFFF') unicode2DOS437[c1] = (char) j; } } if (i != 2) { StringBuffer stringbuffer1 = new StringBuffer(stringbuffer.length()); for( int k = 0; k < stringbuffer.length(); k++ ) { char c2 = unicode2DOS437[stringbuffer.charAt(k)]; stringbuffer1.append(c2 == 0 ? c : c2); } return new String(stringbuffer1); } else { return new String(stringbuffer); } }
[ "public", "static", "synchronized", "String", "char2DOS437", "(", "StringBuffer", "stringbuffer", ",", "int", "i", ",", "char", "c", ")", "{", "if", "(", "unicode2DOS437", "==", "null", ")", "{", "unicode2DOS437", "=", "new", "char", "[", "0x10000", "]", "...
Char to DOS437 converter @param stringbuffer @param i @param c @return String
[ "Char", "to", "DOS437", "converter" ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/utils/Unicode.java#L293-L313
Azure/azure-sdk-for-java
locks/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/locks/v2016_09_01/implementation/ManagementLocksInner.java
ManagementLocksInner.listAtResourceLevelWithServiceResponseAsync
public Observable<ServiceResponse<Page<ManagementLockObjectInner>>> listAtResourceLevelWithServiceResponseAsync(final String resourceGroupName, final String resourceProviderNamespace, final String parentResourcePath, final String resourceType, final String resourceName, final String filter) { return listAtResourceLevelSinglePageAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, filter) .concatMap(new Func1<ServiceResponse<Page<ManagementLockObjectInner>>, Observable<ServiceResponse<Page<ManagementLockObjectInner>>>>() { @Override public Observable<ServiceResponse<Page<ManagementLockObjectInner>>> call(ServiceResponse<Page<ManagementLockObjectInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listAtResourceLevelNextWithServiceResponseAsync(nextPageLink)); } }); }
java
public Observable<ServiceResponse<Page<ManagementLockObjectInner>>> listAtResourceLevelWithServiceResponseAsync(final String resourceGroupName, final String resourceProviderNamespace, final String parentResourcePath, final String resourceType, final String resourceName, final String filter) { return listAtResourceLevelSinglePageAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, filter) .concatMap(new Func1<ServiceResponse<Page<ManagementLockObjectInner>>, Observable<ServiceResponse<Page<ManagementLockObjectInner>>>>() { @Override public Observable<ServiceResponse<Page<ManagementLockObjectInner>>> call(ServiceResponse<Page<ManagementLockObjectInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listAtResourceLevelNextWithServiceResponseAsync(nextPageLink)); } }); }
[ "public", "Observable", "<", "ServiceResponse", "<", "Page", "<", "ManagementLockObjectInner", ">", ">", ">", "listAtResourceLevelWithServiceResponseAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "resourceProviderNamespace", ",", "final", "St...
Gets all the management locks for a resource or any level below resource. @param resourceGroupName The name of the resource group containing the locked resource. The name is case insensitive. @param resourceProviderNamespace The namespace of the resource provider. @param parentResourcePath The parent resource identity. @param resourceType The resource type of the locked resource. @param resourceName The name of the locked resource. @param filter The filter to apply on the operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;ManagementLockObjectInner&gt; object
[ "Gets", "all", "the", "management", "locks", "for", "a", "resource", "or", "any", "level", "below", "resource", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/locks/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/locks/v2016_09_01/implementation/ManagementLocksInner.java#L1739-L1751
box/box-android-sdk
box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiMetadata.java
BoxApiMetadata.getDeleteFolderMetadataTemplateRequest
public BoxRequestsMetadata.DeleteItemMetadata getDeleteFolderMetadataTemplateRequest(String id, String template) { BoxRequestsMetadata.DeleteItemMetadata request = new BoxRequestsMetadata.DeleteItemMetadata(getFolderMetadataUrl(id, template), mSession); return request; }
java
public BoxRequestsMetadata.DeleteItemMetadata getDeleteFolderMetadataTemplateRequest(String id, String template) { BoxRequestsMetadata.DeleteItemMetadata request = new BoxRequestsMetadata.DeleteItemMetadata(getFolderMetadataUrl(id, template), mSession); return request; }
[ "public", "BoxRequestsMetadata", ".", "DeleteItemMetadata", "getDeleteFolderMetadataTemplateRequest", "(", "String", "id", ",", "String", "template", ")", "{", "BoxRequestsMetadata", ".", "DeleteItemMetadata", "request", "=", "new", "BoxRequestsMetadata", ".", "DeleteItemMe...
Gets a request that deletes the metadata for a specific template on a folder @param id id of the folder to retrieve metadata for @param template metadata template to use @return request to delete metadata on a folder
[ "Gets", "a", "request", "that", "deletes", "the", "metadata", "for", "a", "specific", "template", "on", "a", "folder" ]
train
https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiMetadata.java#L277-L280
eiichiro/acidhouse
acidhouse-appengine/src/main/java/org/eiichiro/acidhouse/appengine/Translation.java
Translation.toEntities
public static List<Entity> toEntities(AppEngineTransaction transaction, com.google.appengine.api.datastore.Key parent) { List<Entity> entities = new ArrayList<Entity>(); com.google.appengine.api.datastore.Key key = Keys.create(parent, TRANSACTION_KIND, transaction.id()); entities.add(new Entity(key)); for (Log log : transaction.logs()) { Entity entity = new Entity(Keys.create(key, LOG_KIND, log.sequence())); entity.setUnindexedProperty(OPERATION_PROPERTY, log.operation().name()); entity.setUnindexedProperty(CLASS_PROPERTY, log.entity().getClass().getName()); List<Blob> blobs = new ArrayList<Blob>(); entity.setUnindexedProperty(PROTO_PROPERTY, blobs); entities.add(entity); for (Entity e : toEntities(log.entity())) { EntityProto proto = EntityTranslator.convertToPb(e); byte[] bytes = proto.toByteArray(); blobs.add(new Blob(bytes)); } } return entities; }
java
public static List<Entity> toEntities(AppEngineTransaction transaction, com.google.appengine.api.datastore.Key parent) { List<Entity> entities = new ArrayList<Entity>(); com.google.appengine.api.datastore.Key key = Keys.create(parent, TRANSACTION_KIND, transaction.id()); entities.add(new Entity(key)); for (Log log : transaction.logs()) { Entity entity = new Entity(Keys.create(key, LOG_KIND, log.sequence())); entity.setUnindexedProperty(OPERATION_PROPERTY, log.operation().name()); entity.setUnindexedProperty(CLASS_PROPERTY, log.entity().getClass().getName()); List<Blob> blobs = new ArrayList<Blob>(); entity.setUnindexedProperty(PROTO_PROPERTY, blobs); entities.add(entity); for (Entity e : toEntities(log.entity())) { EntityProto proto = EntityTranslator.convertToPb(e); byte[] bytes = proto.toByteArray(); blobs.add(new Blob(bytes)); } } return entities; }
[ "public", "static", "List", "<", "Entity", ">", "toEntities", "(", "AppEngineTransaction", "transaction", ",", "com", ".", "google", ".", "appengine", ".", "api", ".", "datastore", ".", "Key", "parent", ")", "{", "List", "<", "Entity", ">", "entities", "="...
Translates Acid House {@code AppEngineTransaction} entity to Google App Engine Datastore entities with the specified {@code Key} of parent. @param transaction Acid House {@code Lock} entity. @param parent The {@code Key} of parent. @return Google App Engine Datastore entities translated from Acid House {@code AppEngineTransaction} entity.
[ "Translates", "Acid", "House", "{", "@code", "AppEngineTransaction", "}", "entity", "to", "Google", "App", "Engine", "Datastore", "entities", "with", "the", "specified", "{", "@code", "Key", "}", "of", "parent", "." ]
train
https://github.com/eiichiro/acidhouse/blob/c50eaa0bb0f24abb46def4afa611f170637cdd62/acidhouse-appengine/src/main/java/org/eiichiro/acidhouse/appengine/Translation.java#L586-L609
facebookarchive/hadoop-20
src/tools/org/apache/hadoop/tools/rumen/ZombieJob.java
ZombieJob.getTaskAttemptInfo
public TaskAttemptInfo getTaskAttemptInfo(TaskType taskType, int taskNumber, int taskAttemptNumber) { // does not care about locality. assume default locality is NODE_LOCAL. // But if both task and task attempt exist in trace, use logged locality. int locality = 0; LoggedTask loggedTask = getLoggedTask(taskType, taskNumber); if (loggedTask == null) { // TODO insert parameters TaskInfo taskInfo = new TaskInfo(0, 0, 0, 0, 0); return makeUpTaskAttemptInfo(taskType, taskInfo, taskAttemptNumber, taskNumber, locality); } LoggedTaskAttempt loggedAttempt = getLoggedTaskAttempt(taskType, taskNumber, taskAttemptNumber); if (loggedAttempt == null) { // Task exists, but attempt is missing. TaskInfo taskInfo = getTaskInfo(loggedTask); return makeUpTaskAttemptInfo(taskType, taskInfo, taskAttemptNumber, taskNumber, locality); } else { // TODO should we handle killed attempts later? if (loggedAttempt.getResult()== Values.KILLED) { TaskInfo taskInfo = getTaskInfo(loggedTask); return makeUpTaskAttemptInfo(taskType, taskInfo, taskAttemptNumber, taskNumber, locality); } else { return getTaskAttemptInfo(loggedTask, loggedAttempt); } } }
java
public TaskAttemptInfo getTaskAttemptInfo(TaskType taskType, int taskNumber, int taskAttemptNumber) { // does not care about locality. assume default locality is NODE_LOCAL. // But if both task and task attempt exist in trace, use logged locality. int locality = 0; LoggedTask loggedTask = getLoggedTask(taskType, taskNumber); if (loggedTask == null) { // TODO insert parameters TaskInfo taskInfo = new TaskInfo(0, 0, 0, 0, 0); return makeUpTaskAttemptInfo(taskType, taskInfo, taskAttemptNumber, taskNumber, locality); } LoggedTaskAttempt loggedAttempt = getLoggedTaskAttempt(taskType, taskNumber, taskAttemptNumber); if (loggedAttempt == null) { // Task exists, but attempt is missing. TaskInfo taskInfo = getTaskInfo(loggedTask); return makeUpTaskAttemptInfo(taskType, taskInfo, taskAttemptNumber, taskNumber, locality); } else { // TODO should we handle killed attempts later? if (loggedAttempt.getResult()== Values.KILLED) { TaskInfo taskInfo = getTaskInfo(loggedTask); return makeUpTaskAttemptInfo(taskType, taskInfo, taskAttemptNumber, taskNumber, locality); } else { return getTaskAttemptInfo(loggedTask, loggedAttempt); } } }
[ "public", "TaskAttemptInfo", "getTaskAttemptInfo", "(", "TaskType", "taskType", ",", "int", "taskNumber", ",", "int", "taskAttemptNumber", ")", "{", "// does not care about locality. assume default locality is NODE_LOCAL.", "// But if both task and task attempt exist in trace, use logg...
Get a {@link TaskAttemptInfo} with a {@link TaskAttemptID} associated with taskType, taskNumber, and taskAttemptNumber. This function does not care about locality, and follows the following decision logic: 1. Make up a {@link TaskAttemptInfo} if the task attempt is missing in trace, 2. Make up a {@link TaskAttemptInfo} if the task attempt has a KILLED final status in trace, 3. Otherwise (final state is SUCCEEDED or FAILED), construct the {@link TaskAttemptInfo} from the trace.
[ "Get", "a", "{" ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/tools/org/apache/hadoop/tools/rumen/ZombieJob.java#L394-L424
overturetool/overture
ide/plugins/poviewer/src/main/java/org/overture/ide/plugins/poviewer/view/PoOverviewTableView.java
PoOverviewTableView.createPartControl
@Override public void createPartControl(Composite parent) { viewer = new TableViewer(parent, SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL); // test setup columns... TableLayout layout = new TableLayout(); layout.addColumnData(new ColumnWeightData(20, true)); layout.addColumnData(new ColumnWeightData(30, true)); layout.addColumnData(new ColumnWeightData(50, false)); viewer.getTable().setLayout(layout); viewer.getTable().setLinesVisible(true); viewer.getTable().setHeaderVisible(true); viewer.getTable().setSortDirection(SWT.NONE); viewer.setSorter(null); TableColumn column01 = new TableColumn(viewer.getTable(), SWT.LEFT); column01.setText("No."); column01.setToolTipText("No."); TableColumn column = new TableColumn(viewer.getTable(), SWT.LEFT); column.setText("PO Name"); column.setToolTipText("PO Name"); TableColumn column2 = new TableColumn(viewer.getTable(), SWT.LEFT); column2.setText("Type"); column2.setToolTipText("Show Type"); viewer.setContentProvider(new ViewContentProvider()); viewer.setLabelProvider(new ViewLabelProvider()); makeActions(); hookDoubleClickAction(); viewer.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { Object first = ((IStructuredSelection) event.getSelection()) .getFirstElement(); if (first instanceof ProofObligation) { try { IViewPart v = getSite().getPage().showView( IPoviewerConstants.PoTableViewId); if (v instanceof PoTableView) ((PoTableView) v).setDataList(project, (ProofObligation) first); } catch (PartInitException e) { e.printStackTrace(); } } } }); }
java
@Override public void createPartControl(Composite parent) { viewer = new TableViewer(parent, SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL); // test setup columns... TableLayout layout = new TableLayout(); layout.addColumnData(new ColumnWeightData(20, true)); layout.addColumnData(new ColumnWeightData(30, true)); layout.addColumnData(new ColumnWeightData(50, false)); viewer.getTable().setLayout(layout); viewer.getTable().setLinesVisible(true); viewer.getTable().setHeaderVisible(true); viewer.getTable().setSortDirection(SWT.NONE); viewer.setSorter(null); TableColumn column01 = new TableColumn(viewer.getTable(), SWT.LEFT); column01.setText("No."); column01.setToolTipText("No."); TableColumn column = new TableColumn(viewer.getTable(), SWT.LEFT); column.setText("PO Name"); column.setToolTipText("PO Name"); TableColumn column2 = new TableColumn(viewer.getTable(), SWT.LEFT); column2.setText("Type"); column2.setToolTipText("Show Type"); viewer.setContentProvider(new ViewContentProvider()); viewer.setLabelProvider(new ViewLabelProvider()); makeActions(); hookDoubleClickAction(); viewer.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { Object first = ((IStructuredSelection) event.getSelection()) .getFirstElement(); if (first instanceof ProofObligation) { try { IViewPart v = getSite().getPage().showView( IPoviewerConstants.PoTableViewId); if (v instanceof PoTableView) ((PoTableView) v).setDataList(project, (ProofObligation) first); } catch (PartInitException e) { e.printStackTrace(); } } } }); }
[ "@", "Override", "public", "void", "createPartControl", "(", "Composite", "parent", ")", "{", "viewer", "=", "new", "TableViewer", "(", "parent", ",", "SWT", ".", "FULL_SELECTION", "|", "SWT", ".", "H_SCROLL", "|", "SWT", ".", "V_SCROLL", ")", ";", "// tes...
This is a callback that will allow us to create the viewer and initialize it.
[ "This", "is", "a", "callback", "that", "will", "allow", "us", "to", "create", "the", "viewer", "and", "initialize", "it", "." ]
train
https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/ide/plugins/poviewer/src/main/java/org/overture/ide/plugins/poviewer/view/PoOverviewTableView.java#L225-L280
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/gfx/context/DomHelper.java
DomHelper.drawGroup
public void drawGroup(Object parent, Object object, Style style) { createOrUpdateGroup(parent, object, null, style); }
java
public void drawGroup(Object parent, Object object, Style style) { createOrUpdateGroup(parent, object, null, style); }
[ "public", "void", "drawGroup", "(", "Object", "parent", ",", "Object", "object", ",", "Style", "style", ")", "{", "createOrUpdateGroup", "(", "parent", ",", "object", ",", "null", ",", "style", ")", ";", "}" ]
Creates a group element in the technology (SVG/VML/...) of this context. A group is meant to group other elements together, and in this case applying a style on them. @param parent parent group object @param object group object @param style Add a style to a group.
[ "Creates", "a", "group", "element", "in", "the", "technology", "(", "SVG", "/", "VML", "/", "...", ")", "of", "this", "context", ".", "A", "group", "is", "meant", "to", "group", "other", "elements", "together", "and", "in", "this", "case", "applying", ...
train
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/gfx/context/DomHelper.java#L251-L253
fabric8io/fabric8-forge
addons/camel/src/main/java/io/fabric8/forge/camel/commands/project/helper/CamelXmlHelper.java
CamelXmlHelper.xmlAsModel
public static Object xmlAsModel(Node node, ClassLoader classLoader) throws JAXBException { JAXBContext jaxbContext = JAXBContext.newInstance(JAXB_CONTEXT_PACKAGES, classLoader); Unmarshaller marshaller = jaxbContext.createUnmarshaller(); Object answer = marshaller.unmarshal(node); return answer; }
java
public static Object xmlAsModel(Node node, ClassLoader classLoader) throws JAXBException { JAXBContext jaxbContext = JAXBContext.newInstance(JAXB_CONTEXT_PACKAGES, classLoader); Unmarshaller marshaller = jaxbContext.createUnmarshaller(); Object answer = marshaller.unmarshal(node); return answer; }
[ "public", "static", "Object", "xmlAsModel", "(", "Node", "node", ",", "ClassLoader", "classLoader", ")", "throws", "JAXBException", "{", "JAXBContext", "jaxbContext", "=", "JAXBContext", ".", "newInstance", "(", "JAXB_CONTEXT_PACKAGES", ",", "classLoader", ")", ";",...
Turns the xml into EIP model classes @param node the node representing the XML @param classLoader the class loader @return the EIP model class @throws JAXBException is throw if error unmarshalling XML to Object
[ "Turns", "the", "xml", "into", "EIP", "model", "classes" ]
train
https://github.com/fabric8io/fabric8-forge/blob/a59871bae4d5c5d3ece10f1e8758e73663087f19/addons/camel/src/main/java/io/fabric8/forge/camel/commands/project/helper/CamelXmlHelper.java#L503-L510
joniles/mpxj
src/main/java/net/sf/mpxj/explorer/ProjectTreeController.java
ProjectTreeController.addResources
private void addResources(MpxjTreeNode parentNode, ProjectFile file) { for (Resource resource : file.getResources()) { final Resource r = resource; MpxjTreeNode childNode = new MpxjTreeNode(resource) { @Override public String toString() { return r.getName(); } }; parentNode.add(childNode); } }
java
private void addResources(MpxjTreeNode parentNode, ProjectFile file) { for (Resource resource : file.getResources()) { final Resource r = resource; MpxjTreeNode childNode = new MpxjTreeNode(resource) { @Override public String toString() { return r.getName(); } }; parentNode.add(childNode); } }
[ "private", "void", "addResources", "(", "MpxjTreeNode", "parentNode", ",", "ProjectFile", "file", ")", "{", "for", "(", "Resource", "resource", ":", "file", ".", "getResources", "(", ")", ")", "{", "final", "Resource", "r", "=", "resource", ";", "MpxjTreeNod...
Add resources to the tree. @param parentNode parent tree node @param file resource container
[ "Add", "resources", "to", "the", "tree", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/explorer/ProjectTreeController.java#L221-L235
nikolavp/approval
approval-core/src/main/java/com/github/approval/reporters/Reporters.java
Reporters.imageMagick
public static Reporter imageMagick() { return SwingInteractiveReporter.wrap(new Reporter() { private final Reporter other = fileLauncher(); @Override public void notTheSame(byte[] oldValue, File fileForVerification, byte[] newValue, File fileForApproval) { try { final File compareResult = File.createTempFile("compareResult", fileForVerification.getName()); final Process compare = ExecutableDifferenceReporter.runProcess("compare", fileForApproval.getCanonicalPath(), fileForVerification.getAbsolutePath(), compareResult.getAbsolutePath()); final int result = compare.waitFor(); if (result != 0) { throw new IllegalStateException("Couldn't execute compare!"); } other.approveNew(/* unused */newValue, /* only used value*/compareResult, /* unused */fileForVerification); } catch (IOException | InterruptedException e) { throw new AssertionError("Couldn't create file!", e); } } @Override public void approveNew(byte[] value, File fileForApproval, File fileForVerification) { other.approveNew(value, fileForApproval, fileForVerification); } @Override public boolean canApprove(File fileForApproval) { return other.canApprove(fileForApproval); } }); }
java
public static Reporter imageMagick() { return SwingInteractiveReporter.wrap(new Reporter() { private final Reporter other = fileLauncher(); @Override public void notTheSame(byte[] oldValue, File fileForVerification, byte[] newValue, File fileForApproval) { try { final File compareResult = File.createTempFile("compareResult", fileForVerification.getName()); final Process compare = ExecutableDifferenceReporter.runProcess("compare", fileForApproval.getCanonicalPath(), fileForVerification.getAbsolutePath(), compareResult.getAbsolutePath()); final int result = compare.waitFor(); if (result != 0) { throw new IllegalStateException("Couldn't execute compare!"); } other.approveNew(/* unused */newValue, /* only used value*/compareResult, /* unused */fileForVerification); } catch (IOException | InterruptedException e) { throw new AssertionError("Couldn't create file!", e); } } @Override public void approveNew(byte[] value, File fileForApproval, File fileForVerification) { other.approveNew(value, fileForApproval, fileForVerification); } @Override public boolean canApprove(File fileForApproval) { return other.canApprove(fileForApproval); } }); }
[ "public", "static", "Reporter", "imageMagick", "(", ")", "{", "return", "SwingInteractiveReporter", ".", "wrap", "(", "new", "Reporter", "(", ")", "{", "private", "final", "Reporter", "other", "=", "fileLauncher", "(", ")", ";", "@", "Override", "public", "v...
A reporter that compares images. Currently this uses <a href="http://www.imagemagick.org/script/binary-releases.php">imagemagick</a> for comparison. If you only want to view the new image on first approval and when there is a difference, then you better use the {@link #fileLauncher()} reporter which will do this for you. @return the reporter that uses ImagemMagick for comparison
[ "A", "reporter", "that", "compares", "images", ".", "Currently", "this", "uses", "<a", "href", "=", "http", ":", "//", "www", ".", "imagemagick", ".", "org", "/", "script", "/", "binary", "-", "releases", ".", "php", ">", "imagemagick<", "/", "a", ">",...
train
https://github.com/nikolavp/approval/blob/5e32ecc3bc7f631e94a7049894fdd99a3aa5b1b8/approval-core/src/main/java/com/github/approval/reporters/Reporters.java#L153-L184
mpetazzoni/ttorrent
ttorrent-tracker/src/main/java/com/turn/ttorrent/tracker/TrackerRequestProcessor.java
TrackerRequestProcessor.serveError
private void serveError(Status status, HTTPTrackerErrorMessage error, RequestHandler requestHandler) throws IOException { requestHandler.serveResponse(status.getCode(), status.getDescription(), error.getData()); }
java
private void serveError(Status status, HTTPTrackerErrorMessage error, RequestHandler requestHandler) throws IOException { requestHandler.serveResponse(status.getCode(), status.getDescription(), error.getData()); }
[ "private", "void", "serveError", "(", "Status", "status", ",", "HTTPTrackerErrorMessage", "error", ",", "RequestHandler", "requestHandler", ")", "throws", "IOException", "{", "requestHandler", ".", "serveResponse", "(", "status", ".", "getCode", "(", ")", ",", "st...
Write a {@link HTTPTrackerErrorMessage} to the response with the given HTTP status code. @param status The HTTP status code to return. @param error The error reported by the tracker.
[ "Write", "a", "{", "@link", "HTTPTrackerErrorMessage", "}", "to", "the", "response", "with", "the", "given", "HTTP", "status", "code", "." ]
train
https://github.com/mpetazzoni/ttorrent/blob/ecd0e6caf853b63393c4ab63cfd8f20114f73f70/ttorrent-tracker/src/main/java/com/turn/ttorrent/tracker/TrackerRequestProcessor.java#L290-L292
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/feature/disparity/impl/StereoDisparityWtoNaiveFive.java
StereoDisparityWtoNaiveFive.processPixel
private void processPixel( int c_x , int c_y , int maxDisparity ) { for( int i = minDisparity; i < maxDisparity; i++ ) { score[i] = computeScore( c_x , c_x-i,c_y); } }
java
private void processPixel( int c_x , int c_y , int maxDisparity ) { for( int i = minDisparity; i < maxDisparity; i++ ) { score[i] = computeScore( c_x , c_x-i,c_y); } }
[ "private", "void", "processPixel", "(", "int", "c_x", ",", "int", "c_y", ",", "int", "maxDisparity", ")", "{", "for", "(", "int", "i", "=", "minDisparity", ";", "i", "<", "maxDisparity", ";", "i", "++", ")", "{", "score", "[", "i", "]", "=", "compu...
Computes fit score for each possible disparity @param c_x Center of region on left image. x-axis @param c_y Center of region on left image. y-axis @param maxDisparity Max allowed disparity
[ "Computes", "fit", "score", "for", "each", "possible", "disparity" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/disparity/impl/StereoDisparityWtoNaiveFive.java#L105-L110
eFaps/eFaps-Kernel
src/main/java/org/efaps/update/schema/program/AbstractSourceImporter.java
AbstractSourceImporter.readCode
protected void readCode() throws InstallationException { try { final char[] buf = new char[1024]; final InputStream input = getUrl().openStream(); final Reader reader = new InputStreamReader(input, AbstractSourceImporter.ENCODING); int length; while ((length = reader.read(buf)) > 0) { this.code.append(buf, 0, length); } reader.close(); } catch (final IOException e) { throw new InstallationException("Could not read source code from url '" + this.url + "'.", e); } }
java
protected void readCode() throws InstallationException { try { final char[] buf = new char[1024]; final InputStream input = getUrl().openStream(); final Reader reader = new InputStreamReader(input, AbstractSourceImporter.ENCODING); int length; while ((length = reader.read(buf)) > 0) { this.code.append(buf, 0, length); } reader.close(); } catch (final IOException e) { throw new InstallationException("Could not read source code from url '" + this.url + "'.", e); } }
[ "protected", "void", "readCode", "(", ")", "throws", "InstallationException", "{", "try", "{", "final", "char", "[", "]", "buf", "=", "new", "char", "[", "1024", "]", ";", "final", "InputStream", "input", "=", "getUrl", "(", ")", ".", "openStream", "(", ...
Read the code from the file defined through {@link #url} with character set {@link #ENCODING}. @throws InstallationException if the source code could not read from URL @see #url @see #ENCODING
[ "Read", "the", "code", "from", "the", "file", "defined", "through", "{", "@link", "#url", "}", "with", "character", "set", "{", "@link", "#ENCODING", "}", "." ]
train
https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/update/schema/program/AbstractSourceImporter.java#L119-L136
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/FacesBackingBean.java
FacesBackingBean.ensureFailover
public void ensureFailover( HttpServletRequest request ) { StorageHandler sh = Handlers.get( getServletContext() ).getStorageHandler(); HttpServletRequest unwrappedRequest = PageFlowUtils.unwrapMultipart( request ); RequestContext rc = new RequestContext( unwrappedRequest, null ); String attr = ScopedServletUtils.getScopedSessionAttrName( InternalConstants.FACES_BACKING_ATTR, unwrappedRequest ); sh.ensureFailover( rc, attr, this ); }
java
public void ensureFailover( HttpServletRequest request ) { StorageHandler sh = Handlers.get( getServletContext() ).getStorageHandler(); HttpServletRequest unwrappedRequest = PageFlowUtils.unwrapMultipart( request ); RequestContext rc = new RequestContext( unwrappedRequest, null ); String attr = ScopedServletUtils.getScopedSessionAttrName( InternalConstants.FACES_BACKING_ATTR, unwrappedRequest ); sh.ensureFailover( rc, attr, this ); }
[ "public", "void", "ensureFailover", "(", "HttpServletRequest", "request", ")", "{", "StorageHandler", "sh", "=", "Handlers", ".", "get", "(", "getServletContext", "(", ")", ")", ".", "getStorageHandler", "(", ")", ";", "HttpServletRequest", "unwrappedRequest", "="...
Ensures that any changes to this object will be replicated in a cluster (for failover), even if the replication scheme uses a change-detection algorithm that relies on HttpSession.setAttribute to be aware of changes. Note that this method is used by the framework and does not need to be called explicitly in most cases. @param request the current HttpServletRequest
[ "Ensures", "that", "any", "changes", "to", "this", "object", "will", "be", "replicated", "in", "a", "cluster", "(", "for", "failover", ")", "even", "if", "the", "replication", "scheme", "uses", "a", "change", "-", "detection", "algorithm", "that", "relies", ...
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/FacesBackingBean.java#L103-L111
UrielCh/ovh-java-sdk
ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java
ApiOvhEmaildomain.delegatedAccount_email_filter_name_rule_GET
public ArrayList<Long> delegatedAccount_email_filter_name_rule_GET(String email, String name) throws IOException { String qPath = "/email/domain/delegatedAccount/{email}/filter/{name}/rule"; StringBuilder sb = path(qPath, email, name); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t3); }
java
public ArrayList<Long> delegatedAccount_email_filter_name_rule_GET(String email, String name) throws IOException { String qPath = "/email/domain/delegatedAccount/{email}/filter/{name}/rule"; StringBuilder sb = path(qPath, email, name); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t3); }
[ "public", "ArrayList", "<", "Long", ">", "delegatedAccount_email_filter_name_rule_GET", "(", "String", "email", ",", "String", "name", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/email/domain/delegatedAccount/{email}/filter/{name}/rule\"", ";", "StringBui...
Get rules REST: GET /email/domain/delegatedAccount/{email}/filter/{name}/rule @param email [required] Email @param name [required] Filter name
[ "Get", "rules" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java#L208-L213
sundrio/sundrio
annotations/builder/src/main/java/io/sundr/builder/internal/functions/ToPojo.java
ToPojo.readPrimitiveArrayProperty
private static String readPrimitiveArrayProperty(String ref, TypeDef source, Property property) { StringBuilder sb = new StringBuilder(); Method getter = getterOf(source, property); sb.append("Arrays.asList(") .append(ref).append(".").append(getter.getName()).append("())") .append(".stream()").append(".collect(Collectors.toList())).toArray(new "+getter.getReturnType().toString()+"[])"); return sb.toString(); }
java
private static String readPrimitiveArrayProperty(String ref, TypeDef source, Property property) { StringBuilder sb = new StringBuilder(); Method getter = getterOf(source, property); sb.append("Arrays.asList(") .append(ref).append(".").append(getter.getName()).append("())") .append(".stream()").append(".collect(Collectors.toList())).toArray(new "+getter.getReturnType().toString()+"[])"); return sb.toString(); }
[ "private", "static", "String", "readPrimitiveArrayProperty", "(", "String", "ref", ",", "TypeDef", "source", ",", "Property", "property", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "Method", "getter", "=", "getterOf", "(", "so...
Returns the string representation of the code that reads a primitive array property. @param ref The reference. @param source The type of the reference. @param property The property to read. @return The code.
[ "Returns", "the", "string", "representation", "of", "the", "code", "that", "reads", "a", "primitive", "array", "property", "." ]
train
https://github.com/sundrio/sundrio/blob/4e38368f4db0d950f7c41a8c75e15b0baff1f69a/annotations/builder/src/main/java/io/sundr/builder/internal/functions/ToPojo.java#L659-L666
samskivert/pythagoras
src/main/java/pythagoras/f/Matrix4.java
Matrix4.setToRotation
public Matrix4 setToRotation (IVector3 from, IVector3 to) { float angle = from.angle(to); if (angle < MathUtil.EPSILON) { return setToIdentity(); } if (angle <= FloatMath.PI - MathUtil.EPSILON) { return setToRotation(angle, from.cross(to).normalizeLocal()); } // it's a 180 degree rotation; any axis orthogonal to the from vector will do Vector3 axis = new Vector3(0f, from.z(), -from.y()); float length = axis.length(); return setToRotation(FloatMath.PI, length < MathUtil.EPSILON ? axis.set(-from.z(), 0f, from.x()).normalizeLocal() : axis.multLocal(1f / length)); }
java
public Matrix4 setToRotation (IVector3 from, IVector3 to) { float angle = from.angle(to); if (angle < MathUtil.EPSILON) { return setToIdentity(); } if (angle <= FloatMath.PI - MathUtil.EPSILON) { return setToRotation(angle, from.cross(to).normalizeLocal()); } // it's a 180 degree rotation; any axis orthogonal to the from vector will do Vector3 axis = new Vector3(0f, from.z(), -from.y()); float length = axis.length(); return setToRotation(FloatMath.PI, length < MathUtil.EPSILON ? axis.set(-from.z(), 0f, from.x()).normalizeLocal() : axis.multLocal(1f / length)); }
[ "public", "Matrix4", "setToRotation", "(", "IVector3", "from", ",", "IVector3", "to", ")", "{", "float", "angle", "=", "from", ".", "angle", "(", "to", ")", ";", "if", "(", "angle", "<", "MathUtil", ".", "EPSILON", ")", "{", "return", "setToIdentity", ...
Sets this to a rotation matrix that rotates one vector onto another. @return a reference to this matrix, for chaining.
[ "Sets", "this", "to", "a", "rotation", "matrix", "that", "rotates", "one", "vector", "onto", "another", "." ]
train
https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/f/Matrix4.java#L181-L195
ben-manes/caffeine
simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/segment/RandomWindowTinyLfuPolicy.java
RandomWindowTinyLfuPolicy.removeFromTable
private void removeFromTable(Node[] table, Node node) { int last = table.length - 1; table[node.index] = table[last]; table[node.index].index = node.index; table[last] = null; }
java
private void removeFromTable(Node[] table, Node node) { int last = table.length - 1; table[node.index] = table[last]; table[node.index].index = node.index; table[last] = null; }
[ "private", "void", "removeFromTable", "(", "Node", "[", "]", "table", ",", "Node", "node", ")", "{", "int", "last", "=", "table", ".", "length", "-", "1", ";", "table", "[", "node", ".", "index", "]", "=", "table", "[", "last", "]", ";", "table", ...
Removes the node from the table and adds the index to the free list.
[ "Removes", "the", "node", "from", "the", "table", "and", "adds", "the", "index", "to", "the", "free", "list", "." ]
train
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/segment/RandomWindowTinyLfuPolicy.java#L123-L128
querydsl/querydsl
querydsl-core/src/main/java/com/querydsl/core/types/dsl/Expressions.java
Expressions.asEnum
public static <T extends Enum<T>> EnumExpression<T> asEnum(Expression<T> expr) { Expression<T> underlyingMixin = ExpressionUtils.extract(expr); if (underlyingMixin instanceof PathImpl) { return new EnumPath<T>((PathImpl<T>) underlyingMixin); } else if (underlyingMixin instanceof OperationImpl) { return new EnumOperation<T>((OperationImpl<T>) underlyingMixin); } else if (underlyingMixin instanceof TemplateExpressionImpl) { return new EnumTemplate<T>((TemplateExpressionImpl<T>) underlyingMixin); } else { return new EnumExpression<T>(underlyingMixin) { private static final long serialVersionUID = 949681836002045152L; @Override public <R, C> R accept(Visitor<R, C> v, C context) { return this.mixin.accept(v, context); } }; } }
java
public static <T extends Enum<T>> EnumExpression<T> asEnum(Expression<T> expr) { Expression<T> underlyingMixin = ExpressionUtils.extract(expr); if (underlyingMixin instanceof PathImpl) { return new EnumPath<T>((PathImpl<T>) underlyingMixin); } else if (underlyingMixin instanceof OperationImpl) { return new EnumOperation<T>((OperationImpl<T>) underlyingMixin); } else if (underlyingMixin instanceof TemplateExpressionImpl) { return new EnumTemplate<T>((TemplateExpressionImpl<T>) underlyingMixin); } else { return new EnumExpression<T>(underlyingMixin) { private static final long serialVersionUID = 949681836002045152L; @Override public <R, C> R accept(Visitor<R, C> v, C context) { return this.mixin.accept(v, context); } }; } }
[ "public", "static", "<", "T", "extends", "Enum", "<", "T", ">", ">", "EnumExpression", "<", "T", ">", "asEnum", "(", "Expression", "<", "T", ">", "expr", ")", "{", "Expression", "<", "T", ">", "underlyingMixin", "=", "ExpressionUtils", ".", "extract", ...
Create a new EnumExpression @param expr Expression of type Enum @return new EnumExpression
[ "Create", "a", "new", "EnumExpression" ]
train
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-core/src/main/java/com/querydsl/core/types/dsl/Expressions.java#L2054-L2075
Azure/azure-sdk-for-java
mysql/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/mysql/v2017_12_01/implementation/ConfigurationsInner.java
ConfigurationsInner.createOrUpdate
public ConfigurationInner createOrUpdate(String resourceGroupName, String serverName, String configurationName, ConfigurationInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, configurationName, parameters).toBlocking().last().body(); }
java
public ConfigurationInner createOrUpdate(String resourceGroupName, String serverName, String configurationName, ConfigurationInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, configurationName, parameters).toBlocking().last().body(); }
[ "public", "ConfigurationInner", "createOrUpdate", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "configurationName", ",", "ConfigurationInner", "parameters", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "resourceGroupNam...
Updates a configuration of a server. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param configurationName The name of the server configuration. @param parameters The required parameters for updating a server configuration. @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 ConfigurationInner object if successful.
[ "Updates", "a", "configuration", "of", "a", "server", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mysql/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/mysql/v2017_12_01/implementation/ConfigurationsInner.java#L88-L90
linkedin/PalDB
paldb/src/main/java/com/linkedin/paldb/impl/StorageWriter.java
StorageWriter.getDataStream
private DataOutputStream getDataStream(int keyLength) throws IOException { // Resize array if necessary if (dataStreams.length <= keyLength) { dataStreams = Arrays.copyOf(dataStreams, keyLength + 1); dataFiles = Arrays.copyOf(dataFiles, keyLength + 1); } DataOutputStream dos = dataStreams[keyLength]; if (dos == null) { File file = new File(tempFolder, "data" + keyLength + ".dat"); file.deleteOnExit(); dataFiles[keyLength] = file; dos = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(file))); dataStreams[keyLength] = dos; // Write one byte so the zero offset is reserved dos.writeByte(0); } return dos; }
java
private DataOutputStream getDataStream(int keyLength) throws IOException { // Resize array if necessary if (dataStreams.length <= keyLength) { dataStreams = Arrays.copyOf(dataStreams, keyLength + 1); dataFiles = Arrays.copyOf(dataFiles, keyLength + 1); } DataOutputStream dos = dataStreams[keyLength]; if (dos == null) { File file = new File(tempFolder, "data" + keyLength + ".dat"); file.deleteOnExit(); dataFiles[keyLength] = file; dos = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(file))); dataStreams[keyLength] = dos; // Write one byte so the zero offset is reserved dos.writeByte(0); } return dos; }
[ "private", "DataOutputStream", "getDataStream", "(", "int", "keyLength", ")", "throws", "IOException", "{", "// Resize array if necessary", "if", "(", "dataStreams", ".", "length", "<=", "keyLength", ")", "{", "dataStreams", "=", "Arrays", ".", "copyOf", "(", "dat...
Get the data stream for the specified keyLength, create it if needed
[ "Get", "the", "data", "stream", "for", "the", "specified", "keyLength", "create", "it", "if", "needed" ]
train
https://github.com/linkedin/PalDB/blob/d05ccdd3f67855eb2675dbd82599f19aa7a9f650/paldb/src/main/java/com/linkedin/paldb/impl/StorageWriter.java#L429-L450
jenkinsci/email-ext-plugin
src/main/java/hudson/plugins/emailext/plugins/content/ScriptContent.java
ScriptContent.executeScript
private String executeScript(Run<?, ?> build, FilePath workspace, TaskListener listener, InputStream scriptStream) throws IOException { String result = ""; Map binding = new HashMap<>(); ExtendedEmailPublisherDescriptor descriptor = Jenkins.getActiveInstance().getDescriptorByType(ExtendedEmailPublisherDescriptor.class); Item parent = build.getParent(); binding.put("build", build); binding.put("it", new ScriptContentBuildWrapper(build)); binding.put("project", parent); binding.put("rooturl", descriptor.getHudsonUrl()); binding.put("workspace", workspace); PrintStream logger = listener.getLogger(); binding.put("logger", logger); String scriptContent = IOUtils.toString(scriptStream, descriptor.getCharset()); if (scriptStream instanceof UserProvidedContentInputStream) { ScriptApproval.get().configuring(scriptContent, GroovyLanguage.get(), ApprovalContext.create().withItem(parent)); } if (scriptStream instanceof UserProvidedContentInputStream && !AbstractEvalContent.isApprovedScript(scriptContent, GroovyLanguage.get())) { //Unapproved script, run it in the sandbox GroovyShell shell = createEngine(descriptor, binding, true); Object res = GroovySandbox.run(shell, scriptContent, new ProxyWhitelist( Whitelist.all(), new PrintStreamInstanceWhitelist(logger), new EmailExtScriptTokenMacroWhitelist() )); if (res != null) { result = res.toString(); } } else { if (scriptStream instanceof UserProvidedContentInputStream) { ScriptApproval.get().using(scriptContent, GroovyLanguage.get()); } //Pre approved script, so run as is GroovyShell shell = createEngine(descriptor, binding, false); Script script = shell.parse(scriptContent); Object res = script.run(); if (res != null) { result = res.toString(); } } return result; }
java
private String executeScript(Run<?, ?> build, FilePath workspace, TaskListener listener, InputStream scriptStream) throws IOException { String result = ""; Map binding = new HashMap<>(); ExtendedEmailPublisherDescriptor descriptor = Jenkins.getActiveInstance().getDescriptorByType(ExtendedEmailPublisherDescriptor.class); Item parent = build.getParent(); binding.put("build", build); binding.put("it", new ScriptContentBuildWrapper(build)); binding.put("project", parent); binding.put("rooturl", descriptor.getHudsonUrl()); binding.put("workspace", workspace); PrintStream logger = listener.getLogger(); binding.put("logger", logger); String scriptContent = IOUtils.toString(scriptStream, descriptor.getCharset()); if (scriptStream instanceof UserProvidedContentInputStream) { ScriptApproval.get().configuring(scriptContent, GroovyLanguage.get(), ApprovalContext.create().withItem(parent)); } if (scriptStream instanceof UserProvidedContentInputStream && !AbstractEvalContent.isApprovedScript(scriptContent, GroovyLanguage.get())) { //Unapproved script, run it in the sandbox GroovyShell shell = createEngine(descriptor, binding, true); Object res = GroovySandbox.run(shell, scriptContent, new ProxyWhitelist( Whitelist.all(), new PrintStreamInstanceWhitelist(logger), new EmailExtScriptTokenMacroWhitelist() )); if (res != null) { result = res.toString(); } } else { if (scriptStream instanceof UserProvidedContentInputStream) { ScriptApproval.get().using(scriptContent, GroovyLanguage.get()); } //Pre approved script, so run as is GroovyShell shell = createEngine(descriptor, binding, false); Script script = shell.parse(scriptContent); Object res = script.run(); if (res != null) { result = res.toString(); } } return result; }
[ "private", "String", "executeScript", "(", "Run", "<", "?", ",", "?", ">", "build", ",", "FilePath", "workspace", ",", "TaskListener", "listener", ",", "InputStream", "scriptStream", ")", "throws", "IOException", "{", "String", "result", "=", "\"\"", ";", "M...
Executes a script and returns the last value as a String @param build the build to act on @param scriptStream the script input stream @return a String containing the toString of the last item in the script @throws IOException
[ "Executes", "a", "script", "and", "returns", "the", "last", "value", "as", "a", "String" ]
train
https://github.com/jenkinsci/email-ext-plugin/blob/21fbd402665848a18205b26751424149e51e86e4/src/main/java/hudson/plugins/emailext/plugins/content/ScriptContent.java#L186-L233
mapsforge/mapsforge
mapsforge-map/src/main/java/org/mapsforge/map/layer/Layers.java
Layers.addAll
public synchronized void addAll(Collection<Layer> layers, boolean redraw) { checkIsNull(layers); for (Layer layer : layers) { layer.setDisplayModel(this.displayModel); } this.layersList.addAll(layers); for (Layer layer : layers) { layer.assign(this.redrawer); } if (redraw) { this.redrawer.redrawLayers(); } }
java
public synchronized void addAll(Collection<Layer> layers, boolean redraw) { checkIsNull(layers); for (Layer layer : layers) { layer.setDisplayModel(this.displayModel); } this.layersList.addAll(layers); for (Layer layer : layers) { layer.assign(this.redrawer); } if (redraw) { this.redrawer.redrawLayers(); } }
[ "public", "synchronized", "void", "addAll", "(", "Collection", "<", "Layer", ">", "layers", ",", "boolean", "redraw", ")", "{", "checkIsNull", "(", "layers", ")", ";", "for", "(", "Layer", "layer", ":", "layers", ")", "{", "layer", ".", "setDisplayModel", ...
Adds multiple new layers on top. @param layers The new layers to add @param redraw Whether the map should be redrawn after adding the layers @see List#addAll(Collection)
[ "Adds", "multiple", "new", "layers", "on", "top", "." ]
train
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-map/src/main/java/org/mapsforge/map/layer/Layers.java#L142-L154
GoogleCloudPlatform/bigdata-interop
bigquery/src/main/java/com/google/cloud/hadoop/io/bigquery/output/ForwardingBigQueryFileOutputFormat.java
ForwardingBigQueryFileOutputFormat.checkOutputSpecs
@Override public void checkOutputSpecs(JobContext job) throws FileAlreadyExistsException, IOException { Configuration conf = job.getConfiguration(); // Validate the output configuration. BigQueryOutputConfiguration.validateConfiguration(conf); // Get the output path. Path outputPath = BigQueryOutputConfiguration.getGcsOutputPath(conf); logger.atInfo().log("Using output path '%s'.", outputPath); // Error if the output path already exists. FileSystem outputFileSystem = outputPath.getFileSystem(conf); if (outputFileSystem.exists(outputPath)) { throw new IOException("The output path '" + outputPath + "' already exists."); } // Error if compression is set as there's mixed support in BigQuery. if (FileOutputFormat.getCompressOutput(job)) { throw new IOException("Compression isn't supported for this OutputFormat."); } // Error if unable to create a BigQuery helper. try { new BigQueryFactory().getBigQueryHelper(conf); } catch (GeneralSecurityException gse) { throw new IOException("Failed to create BigQuery client", gse); } // Let delegate process its checks. getDelegate(conf).checkOutputSpecs(job); }
java
@Override public void checkOutputSpecs(JobContext job) throws FileAlreadyExistsException, IOException { Configuration conf = job.getConfiguration(); // Validate the output configuration. BigQueryOutputConfiguration.validateConfiguration(conf); // Get the output path. Path outputPath = BigQueryOutputConfiguration.getGcsOutputPath(conf); logger.atInfo().log("Using output path '%s'.", outputPath); // Error if the output path already exists. FileSystem outputFileSystem = outputPath.getFileSystem(conf); if (outputFileSystem.exists(outputPath)) { throw new IOException("The output path '" + outputPath + "' already exists."); } // Error if compression is set as there's mixed support in BigQuery. if (FileOutputFormat.getCompressOutput(job)) { throw new IOException("Compression isn't supported for this OutputFormat."); } // Error if unable to create a BigQuery helper. try { new BigQueryFactory().getBigQueryHelper(conf); } catch (GeneralSecurityException gse) { throw new IOException("Failed to create BigQuery client", gse); } // Let delegate process its checks. getDelegate(conf).checkOutputSpecs(job); }
[ "@", "Override", "public", "void", "checkOutputSpecs", "(", "JobContext", "job", ")", "throws", "FileAlreadyExistsException", ",", "IOException", "{", "Configuration", "conf", "=", "job", ".", "getConfiguration", "(", ")", ";", "// Validate the output configuration.", ...
Checks to make sure the configuration is valid, the output path doesn't already exist, and that a connection to BigQuery can be established.
[ "Checks", "to", "make", "sure", "the", "configuration", "is", "valid", "the", "output", "path", "doesn", "t", "already", "exist", "and", "that", "a", "connection", "to", "BigQuery", "can", "be", "established", "." ]
train
https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/bigquery/src/main/java/com/google/cloud/hadoop/io/bigquery/output/ForwardingBigQueryFileOutputFormat.java#L58-L89
apache/groovy
src/main/java/org/codehaus/groovy/classgen/asm/BytecodeHelper.java
BytecodeHelper.convertPrimitiveToBoolean
public static void convertPrimitiveToBoolean(MethodVisitor mv, ClassNode type) { if (type == boolean_TYPE) { return; } // Special handling is done for floating point types in order to // handle checking for 0 or NaN values. if (type == double_TYPE) { convertDoubleToBoolean(mv); return; } else if (type == float_TYPE) { convertFloatToBoolean(mv); return; } Label trueLabel = new Label(); Label falseLabel = new Label(); // Convert long to int for IFEQ comparison using LCMP if (type== long_TYPE) { mv.visitInsn(LCONST_0); mv.visitInsn(LCMP); } // This handles byte, short, char and int mv.visitJumpInsn(IFEQ, falseLabel); mv.visitInsn(ICONST_1); mv.visitJumpInsn(GOTO, trueLabel); mv.visitLabel(falseLabel); mv.visitInsn(ICONST_0); mv.visitLabel(trueLabel); }
java
public static void convertPrimitiveToBoolean(MethodVisitor mv, ClassNode type) { if (type == boolean_TYPE) { return; } // Special handling is done for floating point types in order to // handle checking for 0 or NaN values. if (type == double_TYPE) { convertDoubleToBoolean(mv); return; } else if (type == float_TYPE) { convertFloatToBoolean(mv); return; } Label trueLabel = new Label(); Label falseLabel = new Label(); // Convert long to int for IFEQ comparison using LCMP if (type== long_TYPE) { mv.visitInsn(LCONST_0); mv.visitInsn(LCMP); } // This handles byte, short, char and int mv.visitJumpInsn(IFEQ, falseLabel); mv.visitInsn(ICONST_1); mv.visitJumpInsn(GOTO, trueLabel); mv.visitLabel(falseLabel); mv.visitInsn(ICONST_0); mv.visitLabel(trueLabel); }
[ "public", "static", "void", "convertPrimitiveToBoolean", "(", "MethodVisitor", "mv", ",", "ClassNode", "type", ")", "{", "if", "(", "type", "==", "boolean_TYPE", ")", "{", "return", ";", "}", "// Special handling is done for floating point types in order to", "// handle...
Converts a primitive type to boolean. @param mv method visitor @param type primitive type to convert
[ "Converts", "a", "primitive", "type", "to", "boolean", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/classgen/asm/BytecodeHelper.java#L592-L619
ggrandes/packer
src/main/java/org/javastack/packer/Packer.java
Packer.getStringF
public String getStringF() { int len = getInt(); byte[] utf = new byte[len]; System.arraycopy(buf, bufPosition, utf, 0, utf.length); bufPosition += utf.length; return new String(utf, 0, len, charsetUTF8); }
java
public String getStringF() { int len = getInt(); byte[] utf = new byte[len]; System.arraycopy(buf, bufPosition, utf, 0, utf.length); bufPosition += utf.length; return new String(utf, 0, len, charsetUTF8); }
[ "public", "String", "getStringF", "(", ")", "{", "int", "len", "=", "getInt", "(", ")", ";", "byte", "[", "]", "utf", "=", "new", "byte", "[", "len", "]", ";", "System", ".", "arraycopy", "(", "buf", ",", "bufPosition", ",", "utf", ",", "0", ",",...
Get String stored in UTF-8 format (encoded as: Int32-Length + bytes) @return @see #putString(String)
[ "Get", "String", "stored", "in", "UTF", "-", "8", "format", "(", "encoded", "as", ":", "Int32", "-", "Length", "+", "bytes", ")" ]
train
https://github.com/ggrandes/packer/blob/0b37b286a3d0555050eb2e65419dd74f8d8d3e78/src/main/java/org/javastack/packer/Packer.java#L1107-L1113
xiancloud/xian
xian-core/src/main/java/info/xiancloud/core/util/Reflection.java
Reflection.toType
public static <T> T toType(Object data, Class<T> type) { try { if (Reflection.instanceOf(data, type)) { return Reflection.cast(data, type); } if (Collection.class.isAssignableFrom(type)) { return toCollectionType(data, type); } if (type.isArray()) { return toArray(data, type); } return toNonCollectionType(data, type); } catch (Throwable e) { throw castFailedException(data, type, e); } }
java
public static <T> T toType(Object data, Class<T> type) { try { if (Reflection.instanceOf(data, type)) { return Reflection.cast(data, type); } if (Collection.class.isAssignableFrom(type)) { return toCollectionType(data, type); } if (type.isArray()) { return toArray(data, type); } return toNonCollectionType(data, type); } catch (Throwable e) { throw castFailedException(data, type, e); } }
[ "public", "static", "<", "T", ">", "T", "toType", "(", "Object", "data", ",", "Class", "<", "T", ">", "type", ")", "{", "try", "{", "if", "(", "Reflection", ".", "instanceOf", "(", "data", ",", "type", ")", ")", "{", "return", "Reflection", ".", ...
<p> This is a flexible tolerable type casting method with the help of serializing tools (fastjson currently). </p> Supports:<br> map to jsonObject to bean <br> collection ---- fetch the first element and cast it to map/json/bean<br> collection --set-- HashSet<br> collection --list-- ArrayList<br> collection --queue-- LinkedList<br>
[ "<p", ">", "This", "is", "a", "flexible", "tolerable", "type", "casting", "method", "with", "the", "help", "of", "serializing", "tools", "(", "fastjson", "currently", ")", ".", "<", "/", "p", ">", "Supports", ":", "<br", ">", "map", "to", "jsonObject", ...
train
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-core/src/main/java/info/xiancloud/core/util/Reflection.java#L300-L315
glyptodon/guacamole-client
guacamole/src/main/java/org/apache/guacamole/tunnel/TunnelRequest.java
TunnelRequest.getIntegerParameter
public Integer getIntegerParameter(String name) throws GuacamoleException { // Pull requested parameter String value = getParameter(name); if (value == null) return null; // Attempt to parse as an integer try { return Integer.parseInt(value); } // Rethrow any parsing error as a GuacamoleClientException catch (NumberFormatException e) { throw new GuacamoleClientException("Parameter \"" + name + "\" must be a valid integer.", e); } }
java
public Integer getIntegerParameter(String name) throws GuacamoleException { // Pull requested parameter String value = getParameter(name); if (value == null) return null; // Attempt to parse as an integer try { return Integer.parseInt(value); } // Rethrow any parsing error as a GuacamoleClientException catch (NumberFormatException e) { throw new GuacamoleClientException("Parameter \"" + name + "\" must be a valid integer.", e); } }
[ "public", "Integer", "getIntegerParameter", "(", "String", "name", ")", "throws", "GuacamoleException", "{", "// Pull requested parameter", "String", "value", "=", "getParameter", "(", "name", ")", ";", "if", "(", "value", "==", "null", ")", "return", "null", ";...
Returns the integer value of the parameter having the given name, throwing an exception if the parameter cannot be parsed. @param name The name of the parameter to return. @return The integer value of the parameter having the given name, or null if the parameter is missing. @throws GuacamoleException If the parameter is not a valid integer.
[ "Returns", "the", "integer", "value", "of", "the", "parameter", "having", "the", "given", "name", "throwing", "an", "exception", "if", "the", "parameter", "cannot", "be", "parsed", "." ]
train
https://github.com/glyptodon/guacamole-client/blob/ea1b10e9d1e3f1fa640dff2ca64d61b44bf1ace9/guacamole/src/main/java/org/apache/guacamole/tunnel/TunnelRequest.java#L195-L212
aws/aws-sdk-java
aws-java-sdk-elasticsearch/src/main/java/com/amazonaws/services/elasticsearch/model/UpdateElasticsearchDomainConfigRequest.java
UpdateElasticsearchDomainConfigRequest.withLogPublishingOptions
public UpdateElasticsearchDomainConfigRequest withLogPublishingOptions(java.util.Map<String, LogPublishingOption> logPublishingOptions) { setLogPublishingOptions(logPublishingOptions); return this; }
java
public UpdateElasticsearchDomainConfigRequest withLogPublishingOptions(java.util.Map<String, LogPublishingOption> logPublishingOptions) { setLogPublishingOptions(logPublishingOptions); return this; }
[ "public", "UpdateElasticsearchDomainConfigRequest", "withLogPublishingOptions", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "LogPublishingOption", ">", "logPublishingOptions", ")", "{", "setLogPublishingOptions", "(", "logPublishingOptions", ")", ";", "retur...
<p> Map of <code>LogType</code> and <code>LogPublishingOption</code>, each containing options to publish a given type of Elasticsearch log. </p> @param logPublishingOptions Map of <code>LogType</code> and <code>LogPublishingOption</code>, each containing options to publish a given type of Elasticsearch log. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "Map", "of", "<code", ">", "LogType<", "/", "code", ">", "and", "<code", ">", "LogPublishingOption<", "/", "code", ">", "each", "containing", "options", "to", "publish", "a", "given", "type", "of", "Elasticsearch", "log", ".", "<", "/", "p", ...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-elasticsearch/src/main/java/com/amazonaws/services/elasticsearch/model/UpdateElasticsearchDomainConfigRequest.java#L522-L525
timols/java-gitlab-api
src/main/java/org/gitlab/api/GitlabAPI.java
GitlabAPI.addGroupBadge
public GitlabBadge addGroupBadge(Integer groupId, String linkUrl, String imageUrl) throws IOException { String tailUrl = GitlabGroup.URL + "/" + groupId + GitlabBadge.URL; return dispatch().with("link_url", linkUrl) .with("image_url", imageUrl) .to(tailUrl, GitlabBadge.class); }
java
public GitlabBadge addGroupBadge(Integer groupId, String linkUrl, String imageUrl) throws IOException { String tailUrl = GitlabGroup.URL + "/" + groupId + GitlabBadge.URL; return dispatch().with("link_url", linkUrl) .with("image_url", imageUrl) .to(tailUrl, GitlabBadge.class); }
[ "public", "GitlabBadge", "addGroupBadge", "(", "Integer", "groupId", ",", "String", "linkUrl", ",", "String", "imageUrl", ")", "throws", "IOException", "{", "String", "tailUrl", "=", "GitlabGroup", ".", "URL", "+", "\"/\"", "+", "groupId", "+", "GitlabBadge", ...
Add group badge @param groupId The id of the group for which the badge should be added @param linkUrl The URL that the badge should link to @param imageUrl The URL to the badge image @return The created badge @throws IOException on GitLab API call error
[ "Add", "group", "badge" ]
train
https://github.com/timols/java-gitlab-api/blob/f03eedf952cfbb40306be3bf9234dcf78fab029e/src/main/java/org/gitlab/api/GitlabAPI.java#L2711-L2716
bitcoinj/bitcoinj
core/src/main/java/org/bitcoinj/core/Transaction.java
Transaction.hashForSignature
public Sha256Hash hashForSignature(int inputIndex, Script redeemScript, SigHash type, boolean anyoneCanPay) { int sigHash = TransactionSignature.calcSigHashValue(type, anyoneCanPay); return hashForSignature(inputIndex, redeemScript.getProgram(), (byte) sigHash); }
java
public Sha256Hash hashForSignature(int inputIndex, Script redeemScript, SigHash type, boolean anyoneCanPay) { int sigHash = TransactionSignature.calcSigHashValue(type, anyoneCanPay); return hashForSignature(inputIndex, redeemScript.getProgram(), (byte) sigHash); }
[ "public", "Sha256Hash", "hashForSignature", "(", "int", "inputIndex", ",", "Script", "redeemScript", ",", "SigHash", "type", ",", "boolean", "anyoneCanPay", ")", "{", "int", "sigHash", "=", "TransactionSignature", ".", "calcSigHashValue", "(", "type", ",", "anyone...
<p>Calculates a signature hash, that is, a hash of a simplified form of the transaction. How exactly the transaction is simplified is specified by the type and anyoneCanPay parameters.</p> <p>This is a low level API and when using the regular {@link Wallet} class you don't have to call this yourself. When working with more complex transaction types and contracts, it can be necessary. When signing a P2SH output the redeemScript should be the script encoded into the scriptSig field, for normal transactions, it's the scriptPubKey of the output you're signing for.</p> @param inputIndex input the signature is being calculated for. Tx signatures are always relative to an input. @param redeemScript the script that should be in the given input during signing. @param type Should be SigHash.ALL @param anyoneCanPay should be false.
[ "<p", ">", "Calculates", "a", "signature", "hash", "that", "is", "a", "hash", "of", "a", "simplified", "form", "of", "the", "transaction", ".", "How", "exactly", "the", "transaction", "is", "simplified", "is", "specified", "by", "the", "type", "and", "anyo...
train
https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/Transaction.java#L1178-L1182
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/UCharacterName.java
UCharacterName.getAlgorithmName
public String getAlgorithmName(int index, int codepoint) { String result = null; synchronized (m_utilStringBuffer_) { m_utilStringBuffer_.setLength(0); m_algorithm_[index].appendName(codepoint, m_utilStringBuffer_); result = m_utilStringBuffer_.toString(); } return result; }
java
public String getAlgorithmName(int index, int codepoint) { String result = null; synchronized (m_utilStringBuffer_) { m_utilStringBuffer_.setLength(0); m_algorithm_[index].appendName(codepoint, m_utilStringBuffer_); result = m_utilStringBuffer_.toString(); } return result; }
[ "public", "String", "getAlgorithmName", "(", "int", "index", ",", "int", "codepoint", ")", "{", "String", "result", "=", "null", ";", "synchronized", "(", "m_utilStringBuffer_", ")", "{", "m_utilStringBuffer_", ".", "setLength", "(", "0", ")", ";", "m_algorith...
Gets the Algorithmic name of the codepoint @param index algorithmic range index @param codepoint The codepoint value. @return algorithmic name of codepoint
[ "Gets", "the", "Algorithmic", "name", "of", "the", "codepoint" ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/UCharacterName.java#L491-L500
Azure/azure-sdk-for-java
eventgrid/resource-manager/v2018_05_01_preview/src/main/java/com/microsoft/azure/management/eventgrid/v2018_05_01_preview/implementation/EventSubscriptionsInner.java
EventSubscriptionsInner.beginUpdate
public EventSubscriptionInner beginUpdate(String scope, String eventSubscriptionName, EventSubscriptionUpdateParameters eventSubscriptionUpdateParameters) { return beginUpdateWithServiceResponseAsync(scope, eventSubscriptionName, eventSubscriptionUpdateParameters).toBlocking().single().body(); }
java
public EventSubscriptionInner beginUpdate(String scope, String eventSubscriptionName, EventSubscriptionUpdateParameters eventSubscriptionUpdateParameters) { return beginUpdateWithServiceResponseAsync(scope, eventSubscriptionName, eventSubscriptionUpdateParameters).toBlocking().single().body(); }
[ "public", "EventSubscriptionInner", "beginUpdate", "(", "String", "scope", ",", "String", "eventSubscriptionName", ",", "EventSubscriptionUpdateParameters", "eventSubscriptionUpdateParameters", ")", "{", "return", "beginUpdateWithServiceResponseAsync", "(", "scope", ",", "event...
Update an event subscription. Asynchronously updates an existing event subscription. @param scope The scope of existing event subscription. The scope can be a subscription, or a resource group, or a top level resource belonging to a resource provider namespace, or an EventGrid topic. For example, use '/subscriptions/{subscriptionId}/' for a subscription, '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' for a resource group, and '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}' for a resource, and '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/topics/{topicName}' for an EventGrid topic. @param eventSubscriptionName Name of the event subscription to be updated @param eventSubscriptionUpdateParameters Updated event subscription information @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 EventSubscriptionInner object if successful.
[ "Update", "an", "event", "subscription", ".", "Asynchronously", "updates", "an", "existing", "event", "subscription", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/eventgrid/resource-manager/v2018_05_01_preview/src/main/java/com/microsoft/azure/management/eventgrid/v2018_05_01_preview/implementation/EventSubscriptionsInner.java#L643-L645
alkacon/opencms-core
src/org/opencms/ade/galleries/CmsSiteSelectorOptionBuilder.java
CmsSiteSelectorOptionBuilder.addOption
private void addOption(Type type, String siteRoot, String message) { if (m_usedSiteRoots.contains(CmsStringUtil.joinPaths(siteRoot, "/"))) { return; } CmsSiteSelectorOption option = new CmsSiteSelectorOption(type, siteRoot, m_siteRoot.equals(siteRoot), message); // make sure to insert the root site is first and the shared site as second entry if (Type.root.equals(type)) { m_options.add(0, option); } else if (Type.shared.equals(type)) { if (!m_options.isEmpty() && Type.root.equals(m_options.get(0).getType())) { m_options.add(1, option); } else { m_options.add(0, option); } } else { m_options.add(option); } m_usedSiteRoots.add(CmsStringUtil.joinPaths(siteRoot, "/")); }
java
private void addOption(Type type, String siteRoot, String message) { if (m_usedSiteRoots.contains(CmsStringUtil.joinPaths(siteRoot, "/"))) { return; } CmsSiteSelectorOption option = new CmsSiteSelectorOption(type, siteRoot, m_siteRoot.equals(siteRoot), message); // make sure to insert the root site is first and the shared site as second entry if (Type.root.equals(type)) { m_options.add(0, option); } else if (Type.shared.equals(type)) { if (!m_options.isEmpty() && Type.root.equals(m_options.get(0).getType())) { m_options.add(1, option); } else { m_options.add(0, option); } } else { m_options.add(option); } m_usedSiteRoots.add(CmsStringUtil.joinPaths(siteRoot, "/")); }
[ "private", "void", "addOption", "(", "Type", "type", ",", "String", "siteRoot", ",", "String", "message", ")", "{", "if", "(", "m_usedSiteRoots", ".", "contains", "(", "CmsStringUtil", ".", "joinPaths", "(", "siteRoot", ",", "\"/\"", ")", ")", ")", "{", ...
Internal helper method for adding an option.<p> @param type the option type @param siteRoot the site root @param message the message for the option
[ "Internal", "helper", "method", "for", "adding", "an", "option", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/galleries/CmsSiteSelectorOptionBuilder.java#L212-L232
datasalt/pangool
core/src/main/java/com/datasalt/pangool/tuplemr/TupleMRBuilder.java
TupleMRBuilder.addInput
public void addInput(Path path, InputFormat inputFormat, TupleMapper inputProcessor) { multipleInputs.addInput(new Input(path, inputFormat, inputProcessor, new HashMap<String, String>())); }
java
public void addInput(Path path, InputFormat inputFormat, TupleMapper inputProcessor) { multipleInputs.addInput(new Input(path, inputFormat, inputProcessor, new HashMap<String, String>())); }
[ "public", "void", "addInput", "(", "Path", "path", ",", "InputFormat", "inputFormat", ",", "TupleMapper", "inputProcessor", ")", "{", "multipleInputs", ".", "addInput", "(", "new", "Input", "(", "path", ",", "inputFormat", ",", "inputProcessor", ",", "new", "H...
Defines an input as in {@link PangoolMultipleInputs} @see PangoolMultipleInputs
[ "Defines", "an", "input", "as", "in", "{", "@link", "PangoolMultipleInputs", "}" ]
train
https://github.com/datasalt/pangool/blob/bfd312dd78cba03febaf7988ae96a3d4bc585408/core/src/main/java/com/datasalt/pangool/tuplemr/TupleMRBuilder.java#L213-L215
lessthanoptimal/BoofCV
main/boofcv-calibration/src/main/java/boofcv/alg/geo/selfcalib/EstimatePlaneAtInfinityGivenK.java
EstimatePlaneAtInfinityGivenK.computeRotation
static void computeRotation(DMatrix3 t , DMatrix3x3 R ) { for (int i = 1; i >= 0; i--) { double a = t.get(i,0); double b = t.get(i+1,0); // compute the rotator such that [a,b] = [||X||,0] double r = Math.sqrt(a*a + b*b); double q11 = a/r; double q21 = b/r; // apply rotator to t and R t.set(i,0,r); t.set(i+1,0,0); if( i == 1 ) { R.a11 = 1; R.a12 = 0; R.a13 = 0; R.a21 = 0; R.a22 = q11; R.a23 = q21; R.a31 = 0; R.a32 = -q21; R.a33 = q11; } else { R.a11 = q11; R.a12 = R.a22*q21; R.a13 = R.a23*q21; R.a21 = -q21; R.a22 = R.a22*q11; R.a23 = R.a23*q11; } } }
java
static void computeRotation(DMatrix3 t , DMatrix3x3 R ) { for (int i = 1; i >= 0; i--) { double a = t.get(i,0); double b = t.get(i+1,0); // compute the rotator such that [a,b] = [||X||,0] double r = Math.sqrt(a*a + b*b); double q11 = a/r; double q21 = b/r; // apply rotator to t and R t.set(i,0,r); t.set(i+1,0,0); if( i == 1 ) { R.a11 = 1; R.a12 = 0; R.a13 = 0; R.a21 = 0; R.a22 = q11; R.a23 = q21; R.a31 = 0; R.a32 = -q21; R.a33 = q11; } else { R.a11 = q11; R.a12 = R.a22*q21; R.a13 = R.a23*q21; R.a21 = -q21; R.a22 = R.a22*q11; R.a23 = R.a23*q11; } } }
[ "static", "void", "computeRotation", "(", "DMatrix3", "t", ",", "DMatrix3x3", "R", ")", "{", "for", "(", "int", "i", "=", "1", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "double", "a", "=", "t", ".", "get", "(", "i", ",", "0", ")", ";", ...
Computes rotators which rotate t into [|t|,0,0] @param t Input the vector, Output vector after rotator has been applied
[ "Computes", "rotators", "which", "rotate", "t", "into", "[", "|t|", "0", "0", "]" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-calibration/src/main/java/boofcv/alg/geo/selfcalib/EstimatePlaneAtInfinityGivenK.java#L123-L146
fuinorg/srcgen4javassist
src/main/java/org/fuin/srcgen4javassist/SgUtils.java
SgUtils.createTypeSignature
public static String createTypeSignature(final String methodName, final Class<?>[] paramTypes) { final StringBuffer sb = new StringBuffer(); sb.append(methodName); sb.append("("); for (int i = 0; i < paramTypes.length; i++) { if (i > 0) { sb.append(", "); } sb.append(paramTypes[i].getSimpleName()); } sb.append(")"); return sb.toString(); }
java
public static String createTypeSignature(final String methodName, final Class<?>[] paramTypes) { final StringBuffer sb = new StringBuffer(); sb.append(methodName); sb.append("("); for (int i = 0; i < paramTypes.length; i++) { if (i > 0) { sb.append(", "); } sb.append(paramTypes[i].getSimpleName()); } sb.append(")"); return sb.toString(); }
[ "public", "static", "String", "createTypeSignature", "(", "final", "String", "methodName", ",", "final", "Class", "<", "?", ">", "[", "]", "paramTypes", ")", "{", "final", "StringBuffer", "sb", "=", "new", "StringBuffer", "(", ")", ";", "sb", ".", "append"...
Returns the "type" signature of the method. @param methodName Name of the method. @param paramTypes Argument types. @return Method name and argument types (like "methodXY(String, int, boolean)").
[ "Returns", "the", "type", "signature", "of", "the", "method", "." ]
train
https://github.com/fuinorg/srcgen4javassist/blob/355828113cfce3cdd3d69ba242c5bdfc7d899f2f/src/main/java/org/fuin/srcgen4javassist/SgUtils.java#L547-L559
ziccardi/jnrpe
jnrpe-lib/src/main/java/it/jnrpe/utils/thresholds/ReturnValueBuilder.java
ReturnValueBuilder.forPlugin
public static ReturnValueBuilder forPlugin(final String name, final ThresholdsEvaluator thr) { if (thr != null) { return new ReturnValueBuilder(name, thr); } return new ReturnValueBuilder(name, new ThresholdsEvaluatorBuilder().create()); }
java
public static ReturnValueBuilder forPlugin(final String name, final ThresholdsEvaluator thr) { if (thr != null) { return new ReturnValueBuilder(name, thr); } return new ReturnValueBuilder(name, new ThresholdsEvaluatorBuilder().create()); }
[ "public", "static", "ReturnValueBuilder", "forPlugin", "(", "final", "String", "name", ",", "final", "ThresholdsEvaluator", "thr", ")", "{", "if", "(", "thr", "!=", "null", ")", "{", "return", "new", "ReturnValueBuilder", "(", "name", ",", "thr", ")", ";", ...
Constructs the object with the given threshold evaluator. @param name The name of the plugin that is creating this result @param thr The threshold evaluator. @return the newly created instance.
[ "Constructs", "the", "object", "with", "the", "given", "threshold", "evaluator", "." ]
train
https://github.com/ziccardi/jnrpe/blob/ac9046355851136994388442b01ba4063305f9c4/jnrpe-lib/src/main/java/it/jnrpe/utils/thresholds/ReturnValueBuilder.java#L97-L102
ModeShape/modeshape
modeshape-common/src/main/java/org/modeshape/common/util/CheckArg.java
CheckArg.containsKey
public static void containsKey( Map<?, ?> argument, Object key, String name ) { isNotNull(argument, name); if (!argument.containsKey(key)) { throw new IllegalArgumentException(CommonI18n.argumentDidNotContainKey.text(name, getObjectName(key))); } }
java
public static void containsKey( Map<?, ?> argument, Object key, String name ) { isNotNull(argument, name); if (!argument.containsKey(key)) { throw new IllegalArgumentException(CommonI18n.argumentDidNotContainKey.text(name, getObjectName(key))); } }
[ "public", "static", "void", "containsKey", "(", "Map", "<", "?", ",", "?", ">", "argument", ",", "Object", "key", ",", "String", "name", ")", "{", "isNotNull", "(", "argument", ",", "name", ")", ";", "if", "(", "!", "argument", ".", "containsKey", "(...
Check that the map contains the key @param argument Map to check @param key Key to check for, may be null @param name The name of the argument @throws IllegalArgumentException If map is null or doesn't contain key
[ "Check", "that", "the", "map", "contains", "the", "key" ]
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-common/src/main/java/org/modeshape/common/util/CheckArg.java#L668-L675
Samsung/GearVRf
GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/thread/ExecutionChain.java
ExecutionChain.runOnGLThread
public <T, U> ExecutionChain runOnGLThread(Task<T, U> task) { runOnThread(ExecutionChain.Context.Type.GL, task); return this; }
java
public <T, U> ExecutionChain runOnGLThread(Task<T, U> task) { runOnThread(ExecutionChain.Context.Type.GL, task); return this; }
[ "public", "<", "T", ",", "U", ">", "ExecutionChain", "runOnGLThread", "(", "Task", "<", "T", ",", "U", ">", "task", ")", "{", "runOnThread", "(", "ExecutionChain", ".", "Context", ".", "Type", ".", "GL", ",", "task", ")", ";", "return", "this", ";", ...
Add a {@link Task} to be run on the {@link GVRContext#runOnGlThread(Runnable) OpenGL thread}. It will be run after all Tasks added prior to this call. @param task {@code Task} to run @return Reference to the {@code ExecutionChain}. @throws IllegalStateException if the chain of execution has already been {@link #execute() started}.
[ "Add", "a", "{", "@link", "Task", "}", "to", "be", "run", "on", "the", "{", "@link", "GVRContext#runOnGlThread", "(", "Runnable", ")", "OpenGL", "thread", "}", ".", "It", "will", "be", "run", "after", "all", "Tasks", "added", "prior", "to", "this", "ca...
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/thread/ExecutionChain.java#L285-L288
aws/aws-sdk-java
aws-java-sdk-kinesisvideo/src/main/java/com/amazonaws/services/kinesisvideo/model/TagStreamRequest.java
TagStreamRequest.withTags
public TagStreamRequest withTags(java.util.Map<String, String> tags) { setTags(tags); return this; }
java
public TagStreamRequest withTags(java.util.Map<String, String> tags) { setTags(tags); return this; }
[ "public", "TagStreamRequest", "withTags", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "tags", ")", "{", "setTags", "(", "tags", ")", ";", "return", "this", ";", "}" ]
<p> A list of tags to associate with the specified stream. Each tag is a key-value pair (the value is optional). </p> @param tags A list of tags to associate with the specified stream. Each tag is a key-value pair (the value is optional). @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "A", "list", "of", "tags", "to", "associate", "with", "the", "specified", "stream", ".", "Each", "tag", "is", "a", "key", "-", "value", "pair", "(", "the", "value", "is", "optional", ")", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-kinesisvideo/src/main/java/com/amazonaws/services/kinesisvideo/model/TagStreamRequest.java#L165-L168
hypfvieh/java-utils
src/main/java/com/github/hypfvieh/util/CompareUtil.java
CompareUtil.mapContainsKeys
public static boolean mapContainsKeys(Map<?, ?> _map, Object... _keys) { if (_map == null) { return false; } else if (_keys == null) { return true; } for (Object key : _keys) { if (key != null && !_map.containsKey(key)) { return false; } } return true; }
java
public static boolean mapContainsKeys(Map<?, ?> _map, Object... _keys) { if (_map == null) { return false; } else if (_keys == null) { return true; } for (Object key : _keys) { if (key != null && !_map.containsKey(key)) { return false; } } return true; }
[ "public", "static", "boolean", "mapContainsKeys", "(", "Map", "<", "?", ",", "?", ">", "_map", ",", "Object", "...", "_keys", ")", "{", "if", "(", "_map", "==", "null", ")", "{", "return", "false", ";", "}", "else", "if", "(", "_keys", "==", "null"...
Checks whether a map contains all of the specified keys. @param _map map @param _keys one or more keys @return true if all keys found in map, false otherwise
[ "Checks", "whether", "a", "map", "contains", "all", "of", "the", "specified", "keys", "." ]
train
https://github.com/hypfvieh/java-utils/blob/407c32d6b485596d4d2b644f5f7fc7a02d0169c6/src/main/java/com/github/hypfvieh/util/CompareUtil.java#L114-L126
galan/verjson
src/main/java/de/galan/verjson/util/Transformations.java
Transformations.createArray
public static ArrayNode createArray(boolean fallbackToEmptyArray, JsonNode... nodes) { ArrayNode array = null; for (JsonNode element: nodes) { if (element != null) { if (array == null) { array = new ArrayNode(JsonNodeFactory.instance); } array.add(element); } } if ((array == null) && fallbackToEmptyArray) { array = new ArrayNode(JsonNodeFactory.instance); } return array; }
java
public static ArrayNode createArray(boolean fallbackToEmptyArray, JsonNode... nodes) { ArrayNode array = null; for (JsonNode element: nodes) { if (element != null) { if (array == null) { array = new ArrayNode(JsonNodeFactory.instance); } array.add(element); } } if ((array == null) && fallbackToEmptyArray) { array = new ArrayNode(JsonNodeFactory.instance); } return array; }
[ "public", "static", "ArrayNode", "createArray", "(", "boolean", "fallbackToEmptyArray", ",", "JsonNode", "...", "nodes", ")", "{", "ArrayNode", "array", "=", "null", ";", "for", "(", "JsonNode", "element", ":", "nodes", ")", "{", "if", "(", "element", "!=", ...
Creates an ArrayNode from the given nodes. Returns an empty ArrayNode if no elements are provided and fallbackToEmptyArray is true, null if false.
[ "Creates", "an", "ArrayNode", "from", "the", "given", "nodes", ".", "Returns", "an", "empty", "ArrayNode", "if", "no", "elements", "are", "provided", "and", "fallbackToEmptyArray", "is", "true", "null", "if", "false", "." ]
train
https://github.com/galan/verjson/blob/4db610fb5198fde913114ed628234f957e1c19d5/src/main/java/de/galan/verjson/util/Transformations.java#L50-L64
matthewhorridge/owlapi-gwt
owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWL2DatatypeImpl_CustomFieldSerializer.java
OWL2DatatypeImpl_CustomFieldSerializer.serializeInstance
@Override public void serializeInstance(SerializationStreamWriter streamWriter, OWL2DatatypeImpl instance) throws SerializationException { serialize(streamWriter, instance); }
java
@Override public void serializeInstance(SerializationStreamWriter streamWriter, OWL2DatatypeImpl instance) throws SerializationException { serialize(streamWriter, instance); }
[ "@", "Override", "public", "void", "serializeInstance", "(", "SerializationStreamWriter", "streamWriter", ",", "OWL2DatatypeImpl", "instance", ")", "throws", "SerializationException", "{", "serialize", "(", "streamWriter", ",", "instance", ")", ";", "}" ]
Serializes the content of the object into the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter}. @param streamWriter the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter} to write the object's content to @param instance the object instance to serialize @throws com.google.gwt.user.client.rpc.SerializationException if the serialization operation is not successful
[ "Serializes", "the", "content", "of", "the", "object", "into", "the", "{" ]
train
https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWL2DatatypeImpl_CustomFieldSerializer.java#L67-L70
QSFT/Doradus
doradus-server/src/main/java/com/dell/doradus/service/db/cql/CQLMetadataCache.java
CQLMetadataCache.columnValueIsBinary
public boolean columnValueIsBinary(String namespace, String storeName) { Boolean cachedValue = getCachedValueIsBinary(namespace, storeName); if(cachedValue != null) return cachedValue.booleanValue(); String cqlKeyspace = CQLService.storeToCQLName(namespace); String tableName = CQLService.storeToCQLName(storeName); KeyspaceMetadata ksMetadata = m_cluster.getMetadata().getKeyspace(cqlKeyspace); TableMetadata tableMetadata = ksMetadata.getTable(tableName); ColumnMetadata colMetadata = tableMetadata.getColumn("value"); boolean isBinary = colMetadata.getType().equals(DataType.blob()); putCachedValueIsBinary(namespace, storeName, isBinary); return isBinary; }
java
public boolean columnValueIsBinary(String namespace, String storeName) { Boolean cachedValue = getCachedValueIsBinary(namespace, storeName); if(cachedValue != null) return cachedValue.booleanValue(); String cqlKeyspace = CQLService.storeToCQLName(namespace); String tableName = CQLService.storeToCQLName(storeName); KeyspaceMetadata ksMetadata = m_cluster.getMetadata().getKeyspace(cqlKeyspace); TableMetadata tableMetadata = ksMetadata.getTable(tableName); ColumnMetadata colMetadata = tableMetadata.getColumn("value"); boolean isBinary = colMetadata.getType().equals(DataType.blob()); putCachedValueIsBinary(namespace, storeName, isBinary); return isBinary; }
[ "public", "boolean", "columnValueIsBinary", "(", "String", "namespace", ",", "String", "storeName", ")", "{", "Boolean", "cachedValue", "=", "getCachedValueIsBinary", "(", "namespace", ",", "storeName", ")", ";", "if", "(", "cachedValue", "!=", "null", ")", "ret...
Return true if column values for the given namespace/store name are binary. @param namespace Namespace (Keyspace) name. @param storeName Store (ColumnFamily) name. @return True if the given table's column values are binary.
[ "Return", "true", "if", "column", "values", "for", "the", "given", "namespace", "/", "store", "name", "are", "binary", "." ]
train
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/service/db/cql/CQLMetadataCache.java#L45-L58
thelinmichael/spotify-web-api-java
src/main/java/com/wrapper/spotify/SpotifyApi.java
SpotifyApi.removeTracksFromPlaylist
@Deprecated public RemoveTracksFromPlaylistRequest.Builder removeTracksFromPlaylist( String user_id, String playlist_id, JsonArray tracks) { return new RemoveTracksFromPlaylistRequest.Builder(accessToken) .setDefaults(httpManager, scheme, host, port) .user_id(user_id) .playlist_id(playlist_id) .tracks(tracks); }
java
@Deprecated public RemoveTracksFromPlaylistRequest.Builder removeTracksFromPlaylist( String user_id, String playlist_id, JsonArray tracks) { return new RemoveTracksFromPlaylistRequest.Builder(accessToken) .setDefaults(httpManager, scheme, host, port) .user_id(user_id) .playlist_id(playlist_id) .tracks(tracks); }
[ "@", "Deprecated", "public", "RemoveTracksFromPlaylistRequest", ".", "Builder", "removeTracksFromPlaylist", "(", "String", "user_id", ",", "String", "playlist_id", ",", "JsonArray", "tracks", ")", "{", "return", "new", "RemoveTracksFromPlaylistRequest", ".", "Builder", ...
Delete tracks from a playlist @deprecated Playlist IDs are unique for themselves. This parameter is thus no longer used. (https://developer.spotify.com/community/news/2018/06/12/changes-to-playlist-uris/) @param user_id The owners username. @param playlist_id The playlists ID. @param tracks URIs of the tracks to remove. Maximum: 100 track URIs. @return A {@link RemoveTracksFromPlaylistRequest.Builder}. @see <a href="https://developer.spotify.com/web-api/user-guide/#spotify-uris-and-ids">Spotify: URLs &amp; IDs</a>
[ "Delete", "tracks", "from", "a", "playlist" ]
train
https://github.com/thelinmichael/spotify-web-api-java/blob/c06b8512344c0310d0c1df362fa267879021da2e/src/main/java/com/wrapper/spotify/SpotifyApi.java#L1292-L1300
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/jdbc/JDBCCallableStatement.java
JDBCCallableStatement.getBlob
public synchronized Blob getBlob(int parameterIndex) throws SQLException { Object o = getObject(parameterIndex); if (o == null) { return null; } if (o instanceof BlobDataID) { return new JDBCBlobClient(session, (BlobDataID) o); } throw Util.sqlException(ErrorCode.X_42561); }
java
public synchronized Blob getBlob(int parameterIndex) throws SQLException { Object o = getObject(parameterIndex); if (o == null) { return null; } if (o instanceof BlobDataID) { return new JDBCBlobClient(session, (BlobDataID) o); } throw Util.sqlException(ErrorCode.X_42561); }
[ "public", "synchronized", "Blob", "getBlob", "(", "int", "parameterIndex", ")", "throws", "SQLException", "{", "Object", "o", "=", "getObject", "(", "parameterIndex", ")", ";", "if", "(", "o", "==", "null", ")", "{", "return", "null", ";", "}", "if", "("...
<!-- start generic documentation --> Retrieves the value of the designated JDBC <code>BLOB</code> parameter as a {@link java.sql.Blob} object in the Java programming language. <!-- end generic documentation --> <!-- start release-specific documentation --> <div class="ReleaseSpecificDocumentation"> <h3>HSQLDB-Specific Information:</h3> <p> HSQLDB supports this feature. <p> </div> <!-- end release-specific documentation --> @param parameterIndex the first parameter is 1, the second is 2, and so on @return the parameter value as a <code>Blob</code> object in the Java programming language. If the value was SQL <code>NULL</code>, the value <code>null</code> is returned. @exception SQLException if a database access error occurs or this method is called on a closed <code>CallableStatement</code> @exception SQLFeatureNotSupportedException if the JDBC driver does not support this method @since JDK 1.2 (JDK 1.1.x developers: read the overview for JDBCParameterMetaData)
[ "<!", "--", "start", "generic", "documentation", "--", ">" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/jdbc/JDBCCallableStatement.java#L1125-L1138
op4j/op4j
src/main/java/org/op4j/functions/FnString.java
FnString.startsWith
public static final Function<String, Boolean> startsWith(final String prefix, final int offset) { return new StartsWith(prefix, offset); }
java
public static final Function<String, Boolean> startsWith(final String prefix, final int offset) { return new StartsWith(prefix, offset); }
[ "public", "static", "final", "Function", "<", "String", ",", "Boolean", ">", "startsWith", "(", "final", "String", "prefix", ",", "final", "int", "offset", ")", "{", "return", "new", "StartsWith", "(", "prefix", ",", "offset", ")", ";", "}" ]
<p> It checks whether the input substring after the given offset starts with the given prefix or not. </p> @param prefix the prefix to be search after the specified offset @param offset where to begin looking for the prefix @return
[ "<p", ">", "It", "checks", "whether", "the", "input", "substring", "after", "the", "given", "offset", "starts", "with", "the", "given", "prefix", "or", "not", ".", "<", "/", "p", ">" ]
train
https://github.com/op4j/op4j/blob/b577596dfe462089d3dd169666defc6de7ad289a/src/main/java/org/op4j/functions/FnString.java#L4297-L4299
samskivert/samskivert
src/main/java/com/samskivert/swing/EnablingAdapter.java
EnablingAdapter.getPropChangeEnabler
public static PropertyChangeListener getPropChangeEnabler ( String property, JComponent target, boolean invert) { return new PropertyChangeEnabler(property, target, invert); }
java
public static PropertyChangeListener getPropChangeEnabler ( String property, JComponent target, boolean invert) { return new PropertyChangeEnabler(property, target, invert); }
[ "public", "static", "PropertyChangeListener", "getPropChangeEnabler", "(", "String", "property", ",", "JComponent", "target", ",", "boolean", "invert", ")", "{", "return", "new", "PropertyChangeEnabler", "(", "property", ",", "target", ",", "invert", ")", ";", "}"...
Creates and returns an enabler that listens for changes in the specified property (which must be a {@link Boolean} valued property) and updates the target's enabled state accordingly.
[ "Creates", "and", "returns", "an", "enabler", "that", "listens", "for", "changes", "in", "the", "specified", "property", "(", "which", "must", "be", "a", "{" ]
train
https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/swing/EnablingAdapter.java#L26-L30
datacleaner/DataCleaner
engine/utils/src/main/java/org/datacleaner/util/StringUtils.java
StringUtils.replaceAll
public static String replaceAll(String str, final String searchToken, final String replacement) { if (str == null) { return str; } str = str.replace(searchToken, replacement); return str; }
java
public static String replaceAll(String str, final String searchToken, final String replacement) { if (str == null) { return str; } str = str.replace(searchToken, replacement); return str; }
[ "public", "static", "String", "replaceAll", "(", "String", "str", ",", "final", "String", "searchToken", ",", "final", "String", "replacement", ")", "{", "if", "(", "str", "==", "null", ")", "{", "return", "str", ";", "}", "str", "=", "str", ".", "repl...
Utility method that will do replacement multiple times until no more occurrences are left. Note that this is NOT the same as {@link String#replaceAll(String, String)} which will only do one run-through of the string, and it will use regexes instead of exact searching. @param str @param searchToken @param replacement @return
[ "Utility", "method", "that", "will", "do", "replacement", "multiple", "times", "until", "no", "more", "occurrences", "are", "left", "." ]
train
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/engine/utils/src/main/java/org/datacleaner/util/StringUtils.java#L158-L164
lessthanoptimal/ddogleg
src/org/ddogleg/optimization/FactoryOptimization.java
FactoryOptimization.doglegSchur
public static UnconstrainedLeastSquaresSchur<DMatrixRMaj> doglegSchur(boolean robust, @Nullable ConfigTrustRegion config ) { if( config == null ) config = new ConfigTrustRegion(); HessianSchurComplement_DDRM hessian; if( robust ) { LinearSolverDense<DMatrixRMaj> solverA = LinearSolverFactory_DDRM.pseudoInverse(true); LinearSolverDense<DMatrixRMaj> solverD = LinearSolverFactory_DDRM.pseudoInverse(true); hessian = new HessianSchurComplement_DDRM(solverA,solverD); } else { // defaults to cholesky hessian = new HessianSchurComplement_DDRM(); } TrustRegionUpdateDogleg_F64<DMatrixRMaj> update = new TrustRegionUpdateDogleg_F64<>(); UnconLeastSqTrustRegionSchur_F64<DMatrixRMaj> alg = new UnconLeastSqTrustRegionSchur_F64<>(update,hessian); alg.configure(config); return alg; }
java
public static UnconstrainedLeastSquaresSchur<DMatrixRMaj> doglegSchur(boolean robust, @Nullable ConfigTrustRegion config ) { if( config == null ) config = new ConfigTrustRegion(); HessianSchurComplement_DDRM hessian; if( robust ) { LinearSolverDense<DMatrixRMaj> solverA = LinearSolverFactory_DDRM.pseudoInverse(true); LinearSolverDense<DMatrixRMaj> solverD = LinearSolverFactory_DDRM.pseudoInverse(true); hessian = new HessianSchurComplement_DDRM(solverA,solverD); } else { // defaults to cholesky hessian = new HessianSchurComplement_DDRM(); } TrustRegionUpdateDogleg_F64<DMatrixRMaj> update = new TrustRegionUpdateDogleg_F64<>(); UnconLeastSqTrustRegionSchur_F64<DMatrixRMaj> alg = new UnconLeastSqTrustRegionSchur_F64<>(update,hessian); alg.configure(config); return alg; }
[ "public", "static", "UnconstrainedLeastSquaresSchur", "<", "DMatrixRMaj", ">", "doglegSchur", "(", "boolean", "robust", ",", "@", "Nullable", "ConfigTrustRegion", "config", ")", "{", "if", "(", "config", "==", "null", ")", "config", "=", "new", "ConfigTrustRegion"...
Creates a sparse Schur Complement trust region optimization using dogleg steps. @see UnconLeastSqTrustRegionSchur_F64 @param config Trust region configuration @return The new optimization routine
[ "Creates", "a", "sparse", "Schur", "Complement", "trust", "region", "optimization", "using", "dogleg", "steps", "." ]
train
https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/optimization/FactoryOptimization.java#L54-L72
Azure/azure-sdk-for-java
sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerAzureADAdministratorsInner.java
ServerAzureADAdministratorsInner.beginCreateOrUpdate
public ServerAzureADAdministratorInner beginCreateOrUpdate(String resourceGroupName, String serverName, ServerAzureADAdministratorInner properties) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, properties).toBlocking().single().body(); }
java
public ServerAzureADAdministratorInner beginCreateOrUpdate(String resourceGroupName, String serverName, ServerAzureADAdministratorInner properties) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, properties).toBlocking().single().body(); }
[ "public", "ServerAzureADAdministratorInner", "beginCreateOrUpdate", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "ServerAzureADAdministratorInner", "properties", ")", "{", "return", "beginCreateOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ...
Creates a new Server Active Directory Administrator or updates an existing server Active Directory Administrator. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param properties The required parameters for creating or updating an Active Directory Administrator. @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 ServerAzureADAdministratorInner object if successful.
[ "Creates", "a", "new", "Server", "Active", "Directory", "Administrator", "or", "updates", "an", "existing", "server", "Active", "Directory", "Administrator", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerAzureADAdministratorsInner.java#L175-L177
RestComm/media-core
rtp/src/main/java/org/restcomm/media/core/rtp/sdp/MediaDescriptorField.java
MediaDescriptorField.createAudioFormat
private RTPFormat createAudioFormat(int payload, Text description) { Iterator<Text> it = description.split('/').iterator(); //encoding name Text token = it.next(); token.trim(); EncodingName name = new EncodingName(token); //clock rate //TODO : convert to sample rate token = it.next(); token.trim(); int clockRate = token.toInteger(); //channels int channels = 1; if (it.hasNext()) { token = it.next(); token.trim(); channels = token.toInteger(); } RTPFormat rtpFormat = getFormat(payload); if (rtpFormat == null) { formats.add(new RTPFormat(payload, FormatFactory.createAudioFormat(name, clockRate, -1, channels))); } else { //TODO: recreate format anyway. it is illegal to use clock rate as sample rate ((AudioFormat)rtpFormat.getFormat()).setName(name); ((AudioFormat)rtpFormat.getFormat()).setSampleRate(clockRate); ((AudioFormat)rtpFormat.getFormat()).setChannels(channels); } return rtpFormat; }
java
private RTPFormat createAudioFormat(int payload, Text description) { Iterator<Text> it = description.split('/').iterator(); //encoding name Text token = it.next(); token.trim(); EncodingName name = new EncodingName(token); //clock rate //TODO : convert to sample rate token = it.next(); token.trim(); int clockRate = token.toInteger(); //channels int channels = 1; if (it.hasNext()) { token = it.next(); token.trim(); channels = token.toInteger(); } RTPFormat rtpFormat = getFormat(payload); if (rtpFormat == null) { formats.add(new RTPFormat(payload, FormatFactory.createAudioFormat(name, clockRate, -1, channels))); } else { //TODO: recreate format anyway. it is illegal to use clock rate as sample rate ((AudioFormat)rtpFormat.getFormat()).setName(name); ((AudioFormat)rtpFormat.getFormat()).setSampleRate(clockRate); ((AudioFormat)rtpFormat.getFormat()).setChannels(channels); } return rtpFormat; }
[ "private", "RTPFormat", "createAudioFormat", "(", "int", "payload", ",", "Text", "description", ")", "{", "Iterator", "<", "Text", ">", "it", "=", "description", ".", "split", "(", "'", "'", ")", ".", "iterator", "(", ")", ";", "//encoding name", "Text", ...
Creates or updates audio format using payload number and text format description. @param payload the payload number of the format. @param description text description of the format @return format object
[ "Creates", "or", "updates", "audio", "format", "using", "payload", "number", "and", "text", "format", "description", "." ]
train
https://github.com/RestComm/media-core/blob/07b8703343708599f60af66bae62aded77ee81b5/rtp/src/main/java/org/restcomm/media/core/rtp/sdp/MediaDescriptorField.java#L421-L454
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ProfileSummaryBuilder.java
ProfileSummaryBuilder.buildClassSummary
public void buildClassSummary(XMLNode node, Content packageSummaryContentTree) { String classTableSummary = configuration.getText("doclet.Member_Table_Summary", configuration.getText("doclet.Class_Summary"), configuration.getText("doclet.classes")); String[] classTableHeader = new String[] { configuration.getText("doclet.Class"), configuration.getText("doclet.Description") }; ClassDoc[] classes = pkg.ordinaryClasses(); if (classes.length > 0) { profileWriter.addClassesSummary( classes, configuration.getText("doclet.Class_Summary"), classTableSummary, classTableHeader, packageSummaryContentTree); } }
java
public void buildClassSummary(XMLNode node, Content packageSummaryContentTree) { String classTableSummary = configuration.getText("doclet.Member_Table_Summary", configuration.getText("doclet.Class_Summary"), configuration.getText("doclet.classes")); String[] classTableHeader = new String[] { configuration.getText("doclet.Class"), configuration.getText("doclet.Description") }; ClassDoc[] classes = pkg.ordinaryClasses(); if (classes.length > 0) { profileWriter.addClassesSummary( classes, configuration.getText("doclet.Class_Summary"), classTableSummary, classTableHeader, packageSummaryContentTree); } }
[ "public", "void", "buildClassSummary", "(", "XMLNode", "node", ",", "Content", "packageSummaryContentTree", ")", "{", "String", "classTableSummary", "=", "configuration", ".", "getText", "(", "\"doclet.Member_Table_Summary\"", ",", "configuration", ".", "getText", "(", ...
Build the summary for the classes in the package. @param node the XML element that specifies which components to document @param packageSummaryContentTree the tree to which the class summary will be added
[ "Build", "the", "summary", "for", "the", "classes", "in", "the", "package", "." ]
train
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ProfileSummaryBuilder.java#L210-L226
VoltDB/voltdb
src/frontend/org/voltdb/sysprocs/saverestore/HashinatorSnapshotData.java
HashinatorSnapshotData.restoreFromBuffer
public InstanceId restoreFromBuffer(ByteBuffer buf) throws IOException { buf.rewind(); // Assumes config data is the last field. int dataSize = buf.remaining() - OFFSET_DATA; if (dataSize <= 0) { throw new IOException("Hashinator snapshot data is too small."); } // Get the CRC, zero out its buffer field, and compare to calculated CRC. long crcHeader = buf.getLong(OFFSET_CRC); buf.putLong(OFFSET_CRC, 0); final PureJavaCrc32 crcBuffer = new PureJavaCrc32(); assert(buf.hasArray()); crcBuffer.update(buf.array()); if (crcHeader != crcBuffer.getValue()) { throw new IOException("Hashinator snapshot data CRC mismatch."); } // Slurp the data. int coord = buf.getInt(OFFSET_INSTID_COORD); long timestamp = buf.getLong(OFFSET_INSTID_TIMESTAMP); InstanceId instId = new InstanceId(coord, timestamp); m_version = buf.getLong(OFFSET_VERSION); m_serData = new byte[dataSize]; buf.position(OFFSET_DATA); buf.get(m_serData); return instId; }
java
public InstanceId restoreFromBuffer(ByteBuffer buf) throws IOException { buf.rewind(); // Assumes config data is the last field. int dataSize = buf.remaining() - OFFSET_DATA; if (dataSize <= 0) { throw new IOException("Hashinator snapshot data is too small."); } // Get the CRC, zero out its buffer field, and compare to calculated CRC. long crcHeader = buf.getLong(OFFSET_CRC); buf.putLong(OFFSET_CRC, 0); final PureJavaCrc32 crcBuffer = new PureJavaCrc32(); assert(buf.hasArray()); crcBuffer.update(buf.array()); if (crcHeader != crcBuffer.getValue()) { throw new IOException("Hashinator snapshot data CRC mismatch."); } // Slurp the data. int coord = buf.getInt(OFFSET_INSTID_COORD); long timestamp = buf.getLong(OFFSET_INSTID_TIMESTAMP); InstanceId instId = new InstanceId(coord, timestamp); m_version = buf.getLong(OFFSET_VERSION); m_serData = new byte[dataSize]; buf.position(OFFSET_DATA); buf.get(m_serData); return instId; }
[ "public", "InstanceId", "restoreFromBuffer", "(", "ByteBuffer", "buf", ")", "throws", "IOException", "{", "buf", ".", "rewind", "(", ")", ";", "// Assumes config data is the last field.", "int", "dataSize", "=", "buf", ".", "remaining", "(", ")", "-", "OFFSET_DATA...
Restore and check hashinator config data. @param buf input buffer @return instance ID read from buffer @throws I/O exception on failure
[ "Restore", "and", "check", "hashinator", "config", "data", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/sysprocs/saverestore/HashinatorSnapshotData.java#L110-L141
adorsys/hbci4java-adorsys
src/main/java/org/kapott/hbci/GV/AbstractHBCIJob.java
AbstractHBCIJob.fillJobResult
public void fillJobResult(HBCIMsgStatus status, int offset) { try { executed = true; // nachsehen, welche antwortsegmente ueberhaupt // zu diesem task gehoeren // res-num --> segmentheader (wird für sortierung der // antwort-segmente benötigt) HashMap<Integer, String> keyHeaders = new HashMap<>(); status.getData().keySet().forEach(key -> { if (key.startsWith("GVRes") && key.endsWith(".SegHead.ref")) { String segref = status.getData().get(key); if ((Integer.parseInt(segref)) - offset == idx) { // nummer des antwortsegments ermitteln int resnum = 0; if (key.startsWith("GVRes_")) { resnum = Integer.parseInt(key.substring(key.indexOf('_') + 1, key.indexOf('.'))); } keyHeaders.put( resnum, key.substring(0, key.length() - (".SegHead.ref").length())); } } }); saveBasicValues(status.getData(), idx + offset); saveReturnValues(status, idx + offset); // segment-header-namen der antwortsegmente in der reihenfolge des // eintreffens sortieren Object[] resnums = keyHeaders.keySet().toArray(new Object[0]); Arrays.sort(resnums); // alle antwortsegmente durchlaufen for (Object resnum : resnums) { // dabei reihenfolge des eintreffens beachten String header = keyHeaders.get(resnum); extractPlaintextResults(status, header, contentCounter); extractResults(status, header, contentCounter++); // der contentCounter wird fuer jedes antwortsegment um 1 erhoeht } } catch (Exception e) { String msg = HBCIUtils.getLocMsg("EXCMSG_CANTSTORERES", getName()); throw new HBCI_Exception(msg, e); } }
java
public void fillJobResult(HBCIMsgStatus status, int offset) { try { executed = true; // nachsehen, welche antwortsegmente ueberhaupt // zu diesem task gehoeren // res-num --> segmentheader (wird für sortierung der // antwort-segmente benötigt) HashMap<Integer, String> keyHeaders = new HashMap<>(); status.getData().keySet().forEach(key -> { if (key.startsWith("GVRes") && key.endsWith(".SegHead.ref")) { String segref = status.getData().get(key); if ((Integer.parseInt(segref)) - offset == idx) { // nummer des antwortsegments ermitteln int resnum = 0; if (key.startsWith("GVRes_")) { resnum = Integer.parseInt(key.substring(key.indexOf('_') + 1, key.indexOf('.'))); } keyHeaders.put( resnum, key.substring(0, key.length() - (".SegHead.ref").length())); } } }); saveBasicValues(status.getData(), idx + offset); saveReturnValues(status, idx + offset); // segment-header-namen der antwortsegmente in der reihenfolge des // eintreffens sortieren Object[] resnums = keyHeaders.keySet().toArray(new Object[0]); Arrays.sort(resnums); // alle antwortsegmente durchlaufen for (Object resnum : resnums) { // dabei reihenfolge des eintreffens beachten String header = keyHeaders.get(resnum); extractPlaintextResults(status, header, contentCounter); extractResults(status, header, contentCounter++); // der contentCounter wird fuer jedes antwortsegment um 1 erhoeht } } catch (Exception e) { String msg = HBCIUtils.getLocMsg("EXCMSG_CANTSTORERES", getName()); throw new HBCI_Exception(msg, e); } }
[ "public", "void", "fillJobResult", "(", "HBCIMsgStatus", "status", ",", "int", "offset", ")", "{", "try", "{", "executed", "=", "true", ";", "// nachsehen, welche antwortsegmente ueberhaupt", "// zu diesem task gehoeren", "// res-num --> segmentheader (wird für sortierung der",...
/* füllt das Objekt mit den Rückgabedaten. Dazu wird zuerst eine Liste aller Segmente erstellt, die Rückgabedaten für diesen Task enthalten. Anschließend werden die HBCI-Rückgabewerte (RetSegs) im outStore gespeichert. Danach werden die GV-spezifischen Daten im outStore abgelegt
[ "/", "*", "füllt", "das", "Objekt", "mit", "den", "Rückgabedaten", ".", "Dazu", "wird", "zuerst", "eine", "Liste", "aller", "Segmente", "erstellt", "die", "Rückgabedaten", "für", "diesen", "Task", "enthalten", ".", "Anschließend", "werden", "die", "HBCI", "-",...
train
https://github.com/adorsys/hbci4java-adorsys/blob/5e24f7e429d6b555e1d993196b4cf1adda6433cf/src/main/java/org/kapott/hbci/GV/AbstractHBCIJob.java#L698-L745
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/utils/StringUtilities.java
StringUtilities.streamToScanner
@SuppressWarnings("resource") public static Scanner streamToScanner( InputStream stream, String delimiter ) { java.util.Scanner s = new java.util.Scanner(stream).useDelimiter(delimiter); return s; }
java
@SuppressWarnings("resource") public static Scanner streamToScanner( InputStream stream, String delimiter ) { java.util.Scanner s = new java.util.Scanner(stream).useDelimiter(delimiter); return s; }
[ "@", "SuppressWarnings", "(", "\"resource\"", ")", "public", "static", "Scanner", "streamToScanner", "(", "InputStream", "stream", ",", "String", "delimiter", ")", "{", "java", ".", "util", ".", "Scanner", "s", "=", "new", "java", ".", "util", ".", "Scanner"...
Get scanner from input stream. <b>Note: the scanner needs to be closed after use.</b> @param stream the stream to read. @param delimiter the delimiter to use. @return the scanner.
[ "Get", "scanner", "from", "input", "stream", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/StringUtilities.java#L141-L145
doanduyhai/Achilles
achilles-core/src/main/java/info/archinnov/achilles/internals/dsl/options/AbstractOptionsForSelect.java
AbstractOptionsForSelect.withRowAsyncListener
public T withRowAsyncListener(Function<Row, Row> rowAsyncListener) { getOptions().setRowAsyncListeners(Optional.of(asList(rowAsyncListener))); return getThis(); }
java
public T withRowAsyncListener(Function<Row, Row> rowAsyncListener) { getOptions().setRowAsyncListeners(Optional.of(asList(rowAsyncListener))); return getThis(); }
[ "public", "T", "withRowAsyncListener", "(", "Function", "<", "Row", ",", "Row", ">", "rowAsyncListener", ")", "{", "getOptions", "(", ")", ".", "setRowAsyncListeners", "(", "Optional", ".", "of", "(", "asList", "(", "rowAsyncListener", ")", ")", ")", ";", ...
Add the given async listener on the {@link com.datastax.driver.core.Row} object. Example of usage: <pre class="code"><code class="java"> .withRowAsyncListener(row -> { //Do something with the row object here }) </code></pre> Remark: <strong>You can inspect and read values from the row object</strong>
[ "Add", "the", "given", "async", "listener", "on", "the", "{", "@link", "com", ".", "datastax", ".", "driver", ".", "core", ".", "Row", "}", "object", ".", "Example", "of", "usage", ":", "<pre", "class", "=", "code", ">", "<code", "class", "=", "java"...
train
https://github.com/doanduyhai/Achilles/blob/8281c33100e72c993e570592ae1a5306afac6813/achilles-core/src/main/java/info/archinnov/achilles/internals/dsl/options/AbstractOptionsForSelect.java#L236-L239
DDTH/ddth-queue
ddth-queue-core/src/main/java/com/github/ddth/pubsub/impl/universal/UniversalIdIntMessage.java
UniversalIdIntMessage.newInstance
public static UniversalIdIntMessage newInstance(Long id, byte[] content) { UniversalIdIntMessage msg = newInstance(content); msg.setId(id); return msg; }
java
public static UniversalIdIntMessage newInstance(Long id, byte[] content) { UniversalIdIntMessage msg = newInstance(content); msg.setId(id); return msg; }
[ "public", "static", "UniversalIdIntMessage", "newInstance", "(", "Long", "id", ",", "byte", "[", "]", "content", ")", "{", "UniversalIdIntMessage", "msg", "=", "newInstance", "(", "content", ")", ";", "msg", ".", "setId", "(", "id", ")", ";", "return", "ms...
Create a new {@link UniversalIdIntMessage} object with specified id and content. @param id @param content @return
[ "Create", "a", "new", "{", "@link", "UniversalIdIntMessage", "}", "object", "with", "specified", "id", "and", "content", "." ]
train
https://github.com/DDTH/ddth-queue/blob/b20776850d23111d3d71fc8ed6023c590bc3621f/ddth-queue-core/src/main/java/com/github/ddth/pubsub/impl/universal/UniversalIdIntMessage.java#L76-L80
netty/netty
codec-http2/src/main/java/io/netty/handler/codec/http2/DefaultHttp2LocalFlowController.java
DefaultHttp2LocalFlowController.windowUpdateRatio
public void windowUpdateRatio(Http2Stream stream, float ratio) throws Http2Exception { assert ctx != null && ctx.executor().inEventLoop(); checkValidRatio(ratio); FlowState state = state(stream); state.windowUpdateRatio(ratio); state.writeWindowUpdateIfNeeded(); }
java
public void windowUpdateRatio(Http2Stream stream, float ratio) throws Http2Exception { assert ctx != null && ctx.executor().inEventLoop(); checkValidRatio(ratio); FlowState state = state(stream); state.windowUpdateRatio(ratio); state.writeWindowUpdateIfNeeded(); }
[ "public", "void", "windowUpdateRatio", "(", "Http2Stream", "stream", ",", "float", "ratio", ")", "throws", "Http2Exception", "{", "assert", "ctx", "!=", "null", "&&", "ctx", ".", "executor", "(", ")", ".", "inEventLoop", "(", ")", ";", "checkValidRatio", "("...
The window update ratio is used to determine when a window update must be sent. If the ratio of bytes processed since the last update has meet or exceeded this ratio then a window update will be sent. This window update ratio will only be applied to {@code streamId}. <p> Note it is the responsibly of the caller to ensure that the the initial {@code SETTINGS} frame is sent before this is called. It would be considered a {@link Http2Error#PROTOCOL_ERROR} if a {@code WINDOW_UPDATE} was generated by this method before the initial {@code SETTINGS} frame is sent. @param stream the stream for which {@code ratio} applies to. @param ratio the ratio to use when checking if a {@code WINDOW_UPDATE} is determined necessary. @throws Http2Exception If a protocol-error occurs while generating {@code WINDOW_UPDATE} frames
[ "The", "window", "update", "ratio", "is", "used", "to", "determine", "when", "a", "window", "update", "must", "be", "sent", ".", "If", "the", "ratio", "of", "bytes", "processed", "since", "the", "last", "update", "has", "meet", "or", "exceeded", "this", ...
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/DefaultHttp2LocalFlowController.java#L242-L248
lucee/Lucee
core/src/main/java/lucee/transformer/util/SourceCode.java
SourceCode.subCFMLString
public SourceCode subCFMLString(int start, int count) { return new SourceCode(String.valueOf(text, start, count), writeLog, dialect); }
java
public SourceCode subCFMLString(int start, int count) { return new SourceCode(String.valueOf(text, start, count), writeLog, dialect); }
[ "public", "SourceCode", "subCFMLString", "(", "int", "start", ",", "int", "count", ")", "{", "return", "new", "SourceCode", "(", "String", ".", "valueOf", "(", "text", ",", "start", ",", "count", ")", ",", "writeLog", ",", "dialect", ")", ";", "}" ]
return a subset of the current SourceCode @param start start position of the new subset. @param count length of the new subset. @return subset of the SourceCode as new SourcCode
[ "return", "a", "subset", "of", "the", "current", "SourceCode" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/transformer/util/SourceCode.java#L687-L690
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/rng/distribution/impl/SaddlePointExpansion.java
SaddlePointExpansion.logBinomialProbability
public static double logBinomialProbability(int x, int n, double p, double q) { double ret; if (x == 0) { if (p < 0.1) { ret = -getDeviancePart(n, n * q) - n * p; } else { ret = n * FastMath.log(q); } } else if (x == n) { if (q < 0.1) { ret = -getDeviancePart(n, n * p) - n * q; } else { ret = n * FastMath.log(p); } } else { ret = getStirlingError(n) - getStirlingError(x) - getStirlingError(n - x) - getDeviancePart(x, n * p) - getDeviancePart(n - x, n * q); double f = (MathUtils.TWO_PI * x * (n - x)) / n; ret = -0.5 * FastMath.log(f) + ret; } return ret; }
java
public static double logBinomialProbability(int x, int n, double p, double q) { double ret; if (x == 0) { if (p < 0.1) { ret = -getDeviancePart(n, n * q) - n * p; } else { ret = n * FastMath.log(q); } } else if (x == n) { if (q < 0.1) { ret = -getDeviancePart(n, n * p) - n * q; } else { ret = n * FastMath.log(p); } } else { ret = getStirlingError(n) - getStirlingError(x) - getStirlingError(n - x) - getDeviancePart(x, n * p) - getDeviancePart(n - x, n * q); double f = (MathUtils.TWO_PI * x * (n - x)) / n; ret = -0.5 * FastMath.log(f) + ret; } return ret; }
[ "public", "static", "double", "logBinomialProbability", "(", "int", "x", ",", "int", "n", ",", "double", "p", ",", "double", "q", ")", "{", "double", "ret", ";", "if", "(", "x", "==", "0", ")", "{", "if", "(", "p", "<", "0.1", ")", "{", "ret", ...
Compute the logarithm of the PMF for a binomial distribution using the saddle point expansion. @param x the value at which the probability is evaluated. @param n the number of trials. @param p the probability of success. @param q the probability of failure (1 - p). @return log(p(x)).
[ "Compute", "the", "logarithm", "of", "the", "PMF", "for", "a", "binomial", "distribution", "using", "the", "saddle", "point", "expansion", "." ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/rng/distribution/impl/SaddlePointExpansion.java#L178-L199
OpenLiberty/open-liberty
dev/com.ibm.ws.security.common/src/com/ibm/ws/security/common/web/JavaScriptUtils.java
JavaScriptUtils.getJavaScriptForRedirect
public String getJavaScriptForRedirect(String reqUrlCookieName, String redirectUrl) throws Exception { return getJavaScriptForRedirect(reqUrlCookieName, redirectUrl, null); }
java
public String getJavaScriptForRedirect(String reqUrlCookieName, String redirectUrl) throws Exception { return getJavaScriptForRedirect(reqUrlCookieName, redirectUrl, null); }
[ "public", "String", "getJavaScriptForRedirect", "(", "String", "reqUrlCookieName", ",", "String", "redirectUrl", ")", "throws", "Exception", "{", "return", "getJavaScriptForRedirect", "(", "reqUrlCookieName", ",", "redirectUrl", ",", "null", ")", ";", "}" ]
Creates a JavaScript HTML block that: <ol> <li>Creates a cookie with the specified name whose value is the browser's current location <li>Redirects the browser to the specified URL </ol>
[ "Creates", "a", "JavaScript", "HTML", "block", "that", ":", "<ol", ">", "<li", ">", "Creates", "a", "cookie", "with", "the", "specified", "name", "whose", "value", "is", "the", "browser", "s", "current", "location", "<li", ">", "Redirects", "the", "browser...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.common/src/com/ibm/ws/security/common/web/JavaScriptUtils.java#L110-L112
adamfisk/littleshoot-util
src/main/java/org/littleshoot/util/NumberUtils.java
NumberUtils.isBigger
public static boolean isBigger(final BigInteger big1, final BigInteger big2) { final int compared = big1.compareTo(big2); if (compared > 0) { return true; } return false; }
java
public static boolean isBigger(final BigInteger big1, final BigInteger big2) { final int compared = big1.compareTo(big2); if (compared > 0) { return true; } return false; }
[ "public", "static", "boolean", "isBigger", "(", "final", "BigInteger", "big1", ",", "final", "BigInteger", "big2", ")", "{", "final", "int", "compared", "=", "big1", ".", "compareTo", "(", "big2", ")", ";", "if", "(", "compared", ">", "0", ")", "{", "r...
Returns whether the first {@link BigInteger} is bigger than the second. @param big1 The first {@link BigInteger} to compare. @param big2 The second {@link BigInteger} to compare. @return <code>true</code> if the first {@link BigInteger} is bigger than the second, otherwise <code>false</code>.
[ "Returns", "whether", "the", "first", "{", "@link", "BigInteger", "}", "is", "bigger", "than", "the", "second", "." ]
train
https://github.com/adamfisk/littleshoot-util/blob/3c0dc4955116b3382d6b0575d2f164b7508a4f73/src/main/java/org/littleshoot/util/NumberUtils.java#L24-L32
apereo/cas
core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/http/SimpleHttpClientFactoryBean.java
SimpleHttpClientFactoryBean.buildRequestExecutorService
private FutureRequestExecutionService buildRequestExecutorService(final CloseableHttpClient httpClient) { if (this.executorService == null) { this.executorService = new ThreadPoolExecutor(this.threadsNumber, this.threadsNumber, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(this.queueSize)); } return new FutureRequestExecutionService(httpClient, this.executorService); }
java
private FutureRequestExecutionService buildRequestExecutorService(final CloseableHttpClient httpClient) { if (this.executorService == null) { this.executorService = new ThreadPoolExecutor(this.threadsNumber, this.threadsNumber, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(this.queueSize)); } return new FutureRequestExecutionService(httpClient, this.executorService); }
[ "private", "FutureRequestExecutionService", "buildRequestExecutorService", "(", "final", "CloseableHttpClient", "httpClient", ")", "{", "if", "(", "this", ".", "executorService", "==", "null", ")", "{", "this", ".", "executorService", "=", "new", "ThreadPoolExecutor", ...
Build a {@link FutureRequestExecutionService} from the current properties and a HTTP client. @param httpClient the provided HTTP client @return the built request executor service
[ "Build", "a", "{", "@link", "FutureRequestExecutionService", "}", "from", "the", "current", "properties", "and", "a", "HTTP", "client", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/http/SimpleHttpClientFactoryBean.java#L255-L260
cdk/cdk
tool/hash/src/main/java/org/openscience/cdk/hash/HashGeneratorMaker.java
HashGeneratorMaker.atomic
public AtomHashGenerator atomic() { if (depth < 0) throw new IllegalArgumentException("no depth specified, use .depth(int)"); List<AtomEncoder> encoders = new ArrayList<AtomEncoder>(); // set is ordered for (AtomEncoder encoder : encoderSet) { encoders.add(encoder); } encoders.addAll(this.customEncoders); // check if suppression of atoms is wanted - if not use a default value // we also use the 'Basic' generator (see below) boolean suppress = suppression != AtomSuppression.unsuppressed(); AtomEncoder encoder = new ConjugatedAtomEncoder(encoders); SeedGenerator seeds = new SeedGenerator(encoder, suppression); AbstractAtomHashGenerator simple = suppress ? new SuppressedAtomHashGenerator(seeds, new Xorshift(), makeStereoEncoderFactory(), suppression, depth) : new BasicAtomHashGenerator(seeds, new Xorshift(), makeStereoEncoderFactory(), depth); // if there is a finder for checking equivalent vertices then the user // wants to 'perturb' the hashed if (equivSetFinder != null) { return new PerturbedAtomHashGenerator(seeds, simple, new Xorshift(), makeStereoEncoderFactory(), equivSetFinder, suppression); } else { // no equivalence set finder - just use the simple hash return simple; } }
java
public AtomHashGenerator atomic() { if (depth < 0) throw new IllegalArgumentException("no depth specified, use .depth(int)"); List<AtomEncoder> encoders = new ArrayList<AtomEncoder>(); // set is ordered for (AtomEncoder encoder : encoderSet) { encoders.add(encoder); } encoders.addAll(this.customEncoders); // check if suppression of atoms is wanted - if not use a default value // we also use the 'Basic' generator (see below) boolean suppress = suppression != AtomSuppression.unsuppressed(); AtomEncoder encoder = new ConjugatedAtomEncoder(encoders); SeedGenerator seeds = new SeedGenerator(encoder, suppression); AbstractAtomHashGenerator simple = suppress ? new SuppressedAtomHashGenerator(seeds, new Xorshift(), makeStereoEncoderFactory(), suppression, depth) : new BasicAtomHashGenerator(seeds, new Xorshift(), makeStereoEncoderFactory(), depth); // if there is a finder for checking equivalent vertices then the user // wants to 'perturb' the hashed if (equivSetFinder != null) { return new PerturbedAtomHashGenerator(seeds, simple, new Xorshift(), makeStereoEncoderFactory(), equivSetFinder, suppression); } else { // no equivalence set finder - just use the simple hash return simple; } }
[ "public", "AtomHashGenerator", "atomic", "(", ")", "{", "if", "(", "depth", "<", "0", ")", "throw", "new", "IllegalArgumentException", "(", "\"no depth specified, use .depth(int)\"", ")", ";", "List", "<", "AtomEncoder", ">", "encoders", "=", "new", "ArrayList", ...
Given the current configuration create an {@link AtomHashGenerator}. @return instance of the generator @throws IllegalArgumentException no depth or encoders were configured
[ "Given", "the", "current", "configuration", "create", "an", "{", "@link", "AtomHashGenerator", "}", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/hash/src/main/java/org/openscience/cdk/hash/HashGeneratorMaker.java#L317-L349
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/TaskOperations.java
TaskOperations.createTasks
public void createTasks(String jobId, List<TaskAddParameter> taskList) throws RuntimeException, InterruptedException { createTasks(jobId, taskList, null); }
java
public void createTasks(String jobId, List<TaskAddParameter> taskList) throws RuntimeException, InterruptedException { createTasks(jobId, taskList, null); }
[ "public", "void", "createTasks", "(", "String", "jobId", ",", "List", "<", "TaskAddParameter", ">", "taskList", ")", "throws", "RuntimeException", ",", "InterruptedException", "{", "createTasks", "(", "jobId", ",", "taskList", ",", "null", ")", ";", "}" ]
Adds multiple tasks to a job. @param jobId The ID of the job to which to add the task. @param taskList A list of {@link TaskAddParameter tasks} to add. @throws RuntimeException Exception thrown when an error response is received from the Batch service or any network exception. @throws InterruptedException Exception thrown if any thread has interrupted the current thread.
[ "Adds", "multiple", "tasks", "to", "a", "job", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/TaskOperations.java#L139-L142
ThreeTen/threetenbp
src/main/java/org/threeten/bp/Period.java
Period.plusDays
public Period plusDays(long daysToAdd) { if (daysToAdd == 0) { return this; } return create(years, months, Jdk8Methods.safeToInt(Jdk8Methods.safeAdd(days, daysToAdd))); }
java
public Period plusDays(long daysToAdd) { if (daysToAdd == 0) { return this; } return create(years, months, Jdk8Methods.safeToInt(Jdk8Methods.safeAdd(days, daysToAdd))); }
[ "public", "Period", "plusDays", "(", "long", "daysToAdd", ")", "{", "if", "(", "daysToAdd", "==", "0", ")", "{", "return", "this", ";", "}", "return", "create", "(", "years", ",", "months", ",", "Jdk8Methods", ".", "safeToInt", "(", "Jdk8Methods", ".", ...
Returns a copy of this period with the specified days added. <p> This adds the amount to the days unit in a copy of this period. The years and months units are unaffected. For example, "1 year, 6 months and 3 days" plus 2 days returns "1 year, 6 months and 5 days". <p> This instance is immutable and unaffected by this method call. @param daysToAdd the days to add, positive or negative @return a {@code Period} based on this period with the specified days added, not null @throws ArithmeticException if numeric overflow occurs
[ "Returns", "a", "copy", "of", "this", "period", "with", "the", "specified", "days", "added", ".", "<p", ">", "This", "adds", "the", "amount", "to", "the", "days", "unit", "in", "a", "copy", "of", "this", "period", ".", "The", "years", "and", "months", ...
train
https://github.com/ThreeTen/threetenbp/blob/5f05b649f89f205aabd96b2f83c36796ec616fe6/src/main/java/org/threeten/bp/Period.java#L609-L614
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/cs/cspolicy_binding.java
cspolicy_binding.get
public static cspolicy_binding get(nitro_service service, String policyname) throws Exception{ cspolicy_binding obj = new cspolicy_binding(); obj.set_policyname(policyname); cspolicy_binding response = (cspolicy_binding) obj.get_resource(service); return response; }
java
public static cspolicy_binding get(nitro_service service, String policyname) throws Exception{ cspolicy_binding obj = new cspolicy_binding(); obj.set_policyname(policyname); cspolicy_binding response = (cspolicy_binding) obj.get_resource(service); return response; }
[ "public", "static", "cspolicy_binding", "get", "(", "nitro_service", "service", ",", "String", "policyname", ")", "throws", "Exception", "{", "cspolicy_binding", "obj", "=", "new", "cspolicy_binding", "(", ")", ";", "obj", ".", "set_policyname", "(", "policyname",...
Use this API to fetch cspolicy_binding resource of given name .
[ "Use", "this", "API", "to", "fetch", "cspolicy_binding", "resource", "of", "given", "name", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/cs/cspolicy_binding.java#L125-L130
gallandarakhneorg/afc
maven/maventools/src/main/java/org/arakhne/maven/AbstractArakhneMojo.java
AbstractArakhneMojo.searchArtifact
public final synchronized ExtendedArtifact searchArtifact(File file) { final String filename = removePathPrefix(getBaseDirectory(), file); getLog().debug("Retreiving module for " + filename); //$NON-NLS-1$ File theFile = file; File pomDirectory = null; while (theFile != null && pomDirectory == null) { if (theFile.isDirectory()) { final File pomFile = new File(theFile, "pom.xml"); //$NON-NLS-1$ if (pomFile.exists()) { pomDirectory = theFile; } } theFile = theFile.getParentFile(); } if (pomDirectory != null) { ExtendedArtifact a = this.localArtifactDescriptions.get(pomDirectory); if (a == null) { a = readPom(pomDirectory); this.localArtifactDescriptions.put(pomDirectory, a); getLog().debug("Found local module description for " //$NON-NLS-1$ + a.toString()); } return a; } final BuildContext buildContext = getBuildContext(); buildContext.addMessage(file, 1, 1, "The maven module for this file cannot be retreived.", //$NON-NLS-1$ BuildContext.SEVERITY_WARNING, null); return null; }
java
public final synchronized ExtendedArtifact searchArtifact(File file) { final String filename = removePathPrefix(getBaseDirectory(), file); getLog().debug("Retreiving module for " + filename); //$NON-NLS-1$ File theFile = file; File pomDirectory = null; while (theFile != null && pomDirectory == null) { if (theFile.isDirectory()) { final File pomFile = new File(theFile, "pom.xml"); //$NON-NLS-1$ if (pomFile.exists()) { pomDirectory = theFile; } } theFile = theFile.getParentFile(); } if (pomDirectory != null) { ExtendedArtifact a = this.localArtifactDescriptions.get(pomDirectory); if (a == null) { a = readPom(pomDirectory); this.localArtifactDescriptions.put(pomDirectory, a); getLog().debug("Found local module description for " //$NON-NLS-1$ + a.toString()); } return a; } final BuildContext buildContext = getBuildContext(); buildContext.addMessage(file, 1, 1, "The maven module for this file cannot be retreived.", //$NON-NLS-1$ BuildContext.SEVERITY_WARNING, null); return null; }
[ "public", "final", "synchronized", "ExtendedArtifact", "searchArtifact", "(", "File", "file", ")", "{", "final", "String", "filename", "=", "removePathPrefix", "(", "getBaseDirectory", "(", ")", ",", "file", ")", ";", "getLog", "(", ")", ".", "debug", "(", "...
Search and reply the maven artifact which is corresponding to the given file. @param file is the file for which the maven artifact should be retreived. @return the maven artifact or <code>null</code> if none.
[ "Search", "and", "reply", "the", "maven", "artifact", "which", "is", "corresponding", "to", "the", "given", "file", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/maven/maventools/src/main/java/org/arakhne/maven/AbstractArakhneMojo.java#L535-L569
Azure/azure-sdk-for-java
network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/VirtualNetworkGatewaysInner.java
VirtualNetworkGatewaysInner.beginSetVpnclientIpsecParameters
public VpnClientIPsecParametersInner beginSetVpnclientIpsecParameters(String resourceGroupName, String virtualNetworkGatewayName, VpnClientIPsecParametersInner vpnclientIpsecParams) { return beginSetVpnclientIpsecParametersWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayName, vpnclientIpsecParams).toBlocking().single().body(); }
java
public VpnClientIPsecParametersInner beginSetVpnclientIpsecParameters(String resourceGroupName, String virtualNetworkGatewayName, VpnClientIPsecParametersInner vpnclientIpsecParams) { return beginSetVpnclientIpsecParametersWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayName, vpnclientIpsecParams).toBlocking().single().body(); }
[ "public", "VpnClientIPsecParametersInner", "beginSetVpnclientIpsecParameters", "(", "String", "resourceGroupName", ",", "String", "virtualNetworkGatewayName", ",", "VpnClientIPsecParametersInner", "vpnclientIpsecParams", ")", "{", "return", "beginSetVpnclientIpsecParametersWithServiceR...
The Set VpnclientIpsecParameters operation sets the vpnclient ipsec policy for P2S client of virtual network gateway in the specified resource group through Network resource provider. @param resourceGroupName The name of the resource group. @param virtualNetworkGatewayName The name of the virtual network gateway. @param vpnclientIpsecParams Parameters supplied to the Begin Set vpnclient ipsec parameters of Virtual Network Gateway P2S client operation through Network resource provider. @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 VpnClientIPsecParametersInner object if successful.
[ "The", "Set", "VpnclientIpsecParameters", "operation", "sets", "the", "vpnclient", "ipsec", "policy", "for", "P2S", "client", "of", "virtual", "network", "gateway", "in", "the", "specified", "resource", "group", "through", "Network", "resource", "provider", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/VirtualNetworkGatewaysInner.java#L2734-L2736
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/protocol/LayoutVersion.java
LayoutVersion.initMap
private static void initMap() { // Go through all the enum constants and build a map of // LayoutVersion <-> EnumSet of all supported features in that LayoutVersion for (Feature f : Feature.values()) { EnumSet<Feature> ancestorSet = map.get(f.ancestorLV); if (ancestorSet == null) { ancestorSet = EnumSet.noneOf(Feature.class); // Empty enum set map.put(f.ancestorLV, ancestorSet); } EnumSet<Feature> featureSet = EnumSet.copyOf(ancestorSet); featureSet.add(f); map.put(f.lv, featureSet); } // Special initialization for 0.20.203 and 0.20.204 // to add Feature#DELEGATION_TOKEN specialInit(Feature.RESERVED_REL20_203.lv, Feature.DELEGATION_TOKEN); specialInit(Feature.RESERVED_REL20_204.lv, Feature.DELEGATION_TOKEN); }
java
private static void initMap() { // Go through all the enum constants and build a map of // LayoutVersion <-> EnumSet of all supported features in that LayoutVersion for (Feature f : Feature.values()) { EnumSet<Feature> ancestorSet = map.get(f.ancestorLV); if (ancestorSet == null) { ancestorSet = EnumSet.noneOf(Feature.class); // Empty enum set map.put(f.ancestorLV, ancestorSet); } EnumSet<Feature> featureSet = EnumSet.copyOf(ancestorSet); featureSet.add(f); map.put(f.lv, featureSet); } // Special initialization for 0.20.203 and 0.20.204 // to add Feature#DELEGATION_TOKEN specialInit(Feature.RESERVED_REL20_203.lv, Feature.DELEGATION_TOKEN); specialInit(Feature.RESERVED_REL20_204.lv, Feature.DELEGATION_TOKEN); }
[ "private", "static", "void", "initMap", "(", ")", "{", "// Go through all the enum constants and build a map of", "// LayoutVersion <-> EnumSet of all supported features in that LayoutVersion", "for", "(", "Feature", "f", ":", "Feature", ".", "values", "(", ")", ")", "{", "...
Initialize the map of a layout version and EnumSet of {@link Feature}s supported.
[ "Initialize", "the", "map", "of", "a", "layout", "version", "and", "EnumSet", "of", "{" ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/protocol/LayoutVersion.java#L130-L148
ThreeTen/threetenbp
src/main/java/org/threeten/bp/zone/TzdbZoneRulesCompiler.java
TzdbZoneRulesCompiler.parseMonthDayTime
private void parseMonthDayTime(StringTokenizer st, TZDBMonthDayTime mdt) { mdt.month = parseMonth(st.nextToken()); if (st.hasMoreTokens()) { String dayRule = st.nextToken(); if (dayRule.startsWith("last")) { mdt.dayOfMonth = -1; mdt.dayOfWeek = parseDayOfWeek(dayRule.substring(4)); mdt.adjustForwards = false; } else { int index = dayRule.indexOf(">="); if (index > 0) { mdt.dayOfWeek = parseDayOfWeek(dayRule.substring(0, index)); dayRule = dayRule.substring(index + 2); } else { index = dayRule.indexOf("<="); if (index > 0) { mdt.dayOfWeek = parseDayOfWeek(dayRule.substring(0, index)); mdt.adjustForwards = false; dayRule = dayRule.substring(index + 2); } } mdt.dayOfMonth = Integer.parseInt(dayRule); } if (st.hasMoreTokens()) { String timeStr = st.nextToken(); int timeOfDaySecs = parseSecs(timeStr); LocalTime time = deduplicate(LocalTime.ofSecondOfDay(Jdk8Methods.floorMod(timeOfDaySecs, 86400))); mdt.time = time; mdt.adjustDays = Jdk8Methods.floorDiv(timeOfDaySecs, 86400); mdt.timeDefinition = parseTimeDefinition(timeStr.charAt(timeStr.length() - 1)); } } }
java
private void parseMonthDayTime(StringTokenizer st, TZDBMonthDayTime mdt) { mdt.month = parseMonth(st.nextToken()); if (st.hasMoreTokens()) { String dayRule = st.nextToken(); if (dayRule.startsWith("last")) { mdt.dayOfMonth = -1; mdt.dayOfWeek = parseDayOfWeek(dayRule.substring(4)); mdt.adjustForwards = false; } else { int index = dayRule.indexOf(">="); if (index > 0) { mdt.dayOfWeek = parseDayOfWeek(dayRule.substring(0, index)); dayRule = dayRule.substring(index + 2); } else { index = dayRule.indexOf("<="); if (index > 0) { mdt.dayOfWeek = parseDayOfWeek(dayRule.substring(0, index)); mdt.adjustForwards = false; dayRule = dayRule.substring(index + 2); } } mdt.dayOfMonth = Integer.parseInt(dayRule); } if (st.hasMoreTokens()) { String timeStr = st.nextToken(); int timeOfDaySecs = parseSecs(timeStr); LocalTime time = deduplicate(LocalTime.ofSecondOfDay(Jdk8Methods.floorMod(timeOfDaySecs, 86400))); mdt.time = time; mdt.adjustDays = Jdk8Methods.floorDiv(timeOfDaySecs, 86400); mdt.timeDefinition = parseTimeDefinition(timeStr.charAt(timeStr.length() - 1)); } } }
[ "private", "void", "parseMonthDayTime", "(", "StringTokenizer", "st", ",", "TZDBMonthDayTime", "mdt", ")", "{", "mdt", ".", "month", "=", "parseMonth", "(", "st", ".", "nextToken", "(", ")", ")", ";", "if", "(", "st", ".", "hasMoreTokens", "(", ")", ")",...
Parses a Rule line. @param st the tokenizer, not null @param mdt the object to parse into, not null
[ "Parses", "a", "Rule", "line", "." ]
train
https://github.com/ThreeTen/threetenbp/blob/5f05b649f89f205aabd96b2f83c36796ec616fe6/src/main/java/org/threeten/bp/zone/TzdbZoneRulesCompiler.java#L766-L798
citrusframework/citrus
modules/citrus-kafka/src/main/java/com/consol/citrus/kafka/embedded/EmbeddedKafkaServer.java
EmbeddedKafkaServer.createServerFactory
protected ServerCnxnFactory createServerFactory() { try { ServerCnxnFactory serverFactory = new NIOServerCnxnFactory(); serverFactory.configure(new InetSocketAddress(zookeeperPort), 5000); return serverFactory; } catch (IOException e) { throw new CitrusRuntimeException("Failed to create default zookeeper server factory", e); } }
java
protected ServerCnxnFactory createServerFactory() { try { ServerCnxnFactory serverFactory = new NIOServerCnxnFactory(); serverFactory.configure(new InetSocketAddress(zookeeperPort), 5000); return serverFactory; } catch (IOException e) { throw new CitrusRuntimeException("Failed to create default zookeeper server factory", e); } }
[ "protected", "ServerCnxnFactory", "createServerFactory", "(", ")", "{", "try", "{", "ServerCnxnFactory", "serverFactory", "=", "new", "NIOServerCnxnFactory", "(", ")", ";", "serverFactory", ".", "configure", "(", "new", "InetSocketAddress", "(", "zookeeperPort", ")", ...
Create server factory for embedded Zookeeper server instance. @return
[ "Create", "server", "factory", "for", "embedded", "Zookeeper", "server", "instance", "." ]
train
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-kafka/src/main/java/com/consol/citrus/kafka/embedded/EmbeddedKafkaServer.java#L205-L213
Coveros/selenified
src/main/java/com/coveros/selenified/application/WaitFor.java
WaitFor.cookieExists
public void cookieExists(double seconds, String expectedCookieName) { double end = System.currentTimeMillis() + (seconds * 1000); while (!app.is().cookiePresent(expectedCookieName) && System.currentTimeMillis() < end) ; double timeTook = Math.min((seconds * 1000) - (end - System.currentTimeMillis()), seconds * 1000) / 1000; checkCookieExists(expectedCookieName, seconds, timeTook); }
java
public void cookieExists(double seconds, String expectedCookieName) { double end = System.currentTimeMillis() + (seconds * 1000); while (!app.is().cookiePresent(expectedCookieName) && System.currentTimeMillis() < end) ; double timeTook = Math.min((seconds * 1000) - (end - System.currentTimeMillis()), seconds * 1000) / 1000; checkCookieExists(expectedCookieName, seconds, timeTook); }
[ "public", "void", "cookieExists", "(", "double", "seconds", ",", "String", "expectedCookieName", ")", "{", "double", "end", "=", "System", ".", "currentTimeMillis", "(", ")", "+", "(", "seconds", "*", "1000", ")", ";", "while", "(", "!", "app", ".", "is"...
Waits up to the provided wait time for a cookie exists in the application with the provided cookieName. This information will be logged and recorded, with a screenshot for traceability and added debugging support. @param expectedCookieName the name of the cookie @param seconds the number of seconds to wait
[ "Waits", "up", "to", "the", "provided", "wait", "time", "for", "a", "cookie", "exists", "in", "the", "application", "with", "the", "provided", "cookieName", ".", "This", "information", "will", "be", "logged", "and", "recorded", "with", "a", "screenshot", "fo...
train
https://github.com/Coveros/selenified/blob/396cc1f010dd69eed33cc5061c41253de246a4cd/src/main/java/com/coveros/selenified/application/WaitFor.java#L694-L699
alkacon/opencms-core
src-modules/org/opencms/workplace/tools/sites/CmsSiteDetailDialog.java
CmsSiteDetailDialog.createSitemapContentFolder
private CmsResource createSitemapContentFolder(CmsObject cms, CmsResource subSitemapFolder) throws CmsException, CmsLoaderException { CmsResource configFile = null; String sitePath = cms.getSitePath(subSitemapFolder); String folderName = CmsStringUtil.joinPaths(sitePath, CmsADEManager.CONTENT_FOLDER_NAME + "/"); String sitemapConfigName = CmsStringUtil.joinPaths(folderName, CmsADEManager.CONFIG_FILE_NAME); if (!cms.existsResource(folderName)) { cms.createResource( folderName, OpenCms.getResourceManager().getResourceType(CmsADEManager.CONFIG_FOLDER_TYPE)); } I_CmsResourceType configType = OpenCms.getResourceManager().getResourceType(CmsADEManager.CONFIG_TYPE); if (cms.existsResource(sitemapConfigName)) { configFile = cms.readResource(sitemapConfigName); if (!OpenCms.getResourceManager().getResourceType(configFile).getTypeName().equals( configType.getTypeName())) { throw new CmsException( Messages.get().container( Messages.ERR_CREATING_SUB_SITEMAP_WRONG_CONFIG_FILE_TYPE_2, sitemapConfigName, CmsADEManager.CONFIG_TYPE)); } } else { configFile = cms.createResource( sitemapConfigName, OpenCms.getResourceManager().getResourceType(CmsADEManager.CONFIG_TYPE)); } return configFile; }
java
private CmsResource createSitemapContentFolder(CmsObject cms, CmsResource subSitemapFolder) throws CmsException, CmsLoaderException { CmsResource configFile = null; String sitePath = cms.getSitePath(subSitemapFolder); String folderName = CmsStringUtil.joinPaths(sitePath, CmsADEManager.CONTENT_FOLDER_NAME + "/"); String sitemapConfigName = CmsStringUtil.joinPaths(folderName, CmsADEManager.CONFIG_FILE_NAME); if (!cms.existsResource(folderName)) { cms.createResource( folderName, OpenCms.getResourceManager().getResourceType(CmsADEManager.CONFIG_FOLDER_TYPE)); } I_CmsResourceType configType = OpenCms.getResourceManager().getResourceType(CmsADEManager.CONFIG_TYPE); if (cms.existsResource(sitemapConfigName)) { configFile = cms.readResource(sitemapConfigName); if (!OpenCms.getResourceManager().getResourceType(configFile).getTypeName().equals( configType.getTypeName())) { throw new CmsException( Messages.get().container( Messages.ERR_CREATING_SUB_SITEMAP_WRONG_CONFIG_FILE_TYPE_2, sitemapConfigName, CmsADEManager.CONFIG_TYPE)); } } else { configFile = cms.createResource( sitemapConfigName, OpenCms.getResourceManager().getResourceType(CmsADEManager.CONFIG_TYPE)); } return configFile; }
[ "private", "CmsResource", "createSitemapContentFolder", "(", "CmsObject", "cms", ",", "CmsResource", "subSitemapFolder", ")", "throws", "CmsException", ",", "CmsLoaderException", "{", "CmsResource", "configFile", "=", "null", ";", "String", "sitePath", "=", "cms", "."...
Helper method for creating the .content folder of a sub-sitemap.<p> @param cms the current CMS context @param subSitemapFolder the sub-sitemap folder in which the .content folder should be created @return the created folder @throws CmsException if something goes wrong @throws CmsLoaderException if something goes wrong
[ "Helper", "method", "for", "creating", "the", ".", "content", "folder", "of", "a", "sub", "-", "sitemap", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/tools/sites/CmsSiteDetailDialog.java#L729-L758
Samsung/GearVRf
GVRf/Extensions/gvrf-particlesystem/src/main/java/org/gearvrf/particlesystem/GVREmitter.java
GVREmitter.setParticleVolume
public void setParticleVolume(final float width, final float height, final float depth) { final GVRTransform thisTransform = this.getTransform(); if (null != mGVRContext) { mGVRContext.runOnGlThread(new Runnable() { @Override public void run() {Vector3f center = new Vector3f(thisTransform.getPositionX(), thisTransform.getPositionY(), thisTransform.getPositionZ()); particleBoundingVolume = new float[]{center.x - width/2, center.y - height/2, center.z - depth/2, center.x - width/2, center.y - height/2, center.z + depth/2, center.x + width/2, center.y - height/2, center.z + depth/2, center.x + width/2, center.y - height/2, center.z - depth/2, center.x - width/2, center.y + height/2, center.z - depth/2, center.x - width/2, center.y + height/2, center.z + depth/2, center.x + width/2, center.y + height/2, center.z + depth/2, center.x - width/2, center.y + height/2, center.z - depth/2}; BVSpawnTimes = new float[]{Float.MAX_VALUE, 0, Float.MAX_VALUE, 0, Float.MAX_VALUE, 0, Float.MAX_VALUE, 0, Float.MAX_VALUE, 0, Float.MAX_VALUE, 0, Float.MAX_VALUE, 0, Float.MAX_VALUE, 0}; BVVelocities = new float[24]; for ( int i = 0; i < 24; i ++ ) BVVelocities[i] = 0; } }); } }
java
public void setParticleVolume(final float width, final float height, final float depth) { final GVRTransform thisTransform = this.getTransform(); if (null != mGVRContext) { mGVRContext.runOnGlThread(new Runnable() { @Override public void run() {Vector3f center = new Vector3f(thisTransform.getPositionX(), thisTransform.getPositionY(), thisTransform.getPositionZ()); particleBoundingVolume = new float[]{center.x - width/2, center.y - height/2, center.z - depth/2, center.x - width/2, center.y - height/2, center.z + depth/2, center.x + width/2, center.y - height/2, center.z + depth/2, center.x + width/2, center.y - height/2, center.z - depth/2, center.x - width/2, center.y + height/2, center.z - depth/2, center.x - width/2, center.y + height/2, center.z + depth/2, center.x + width/2, center.y + height/2, center.z + depth/2, center.x - width/2, center.y + height/2, center.z - depth/2}; BVSpawnTimes = new float[]{Float.MAX_VALUE, 0, Float.MAX_VALUE, 0, Float.MAX_VALUE, 0, Float.MAX_VALUE, 0, Float.MAX_VALUE, 0, Float.MAX_VALUE, 0, Float.MAX_VALUE, 0, Float.MAX_VALUE, 0}; BVVelocities = new float[24]; for ( int i = 0; i < 24; i ++ ) BVVelocities[i] = 0; } }); } }
[ "public", "void", "setParticleVolume", "(", "final", "float", "width", ",", "final", "float", "height", ",", "final", "float", "depth", ")", "{", "final", "GVRTransform", "thisTransform", "=", "this", ".", "getTransform", "(", ")", ";", "if", "(", "null", ...
Create a bouding volume for the particle system centered at its position with the specified width, height and depth. This is important to do because the parent scene object might fall outside the viewing frustum and cause the entire system to be culled. This function creates 8 particles (mesh vertices) with very large spawning time attributes (i.e. they are always discarded) which define the volume of the system. The system is assumed to stay inside this volume. @param width volume length (along x-axis) @param height volume height (along y-axis) @param depth volume depth (along z-axis)
[ "Create", "a", "bouding", "volume", "for", "the", "particle", "system", "centered", "at", "its", "position", "with", "the", "specified", "width", "height", "and", "depth", ".", "This", "is", "important", "to", "do", "because", "the", "parent", "scene", "obje...
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/gvrf-particlesystem/src/main/java/org/gearvrf/particlesystem/GVREmitter.java#L205-L237
ThreeTen/threetenbp
src/main/java/org/threeten/bp/format/DateTimeFormatterBuilder.java
DateTimeFormatterBuilder.appendText
public DateTimeFormatterBuilder appendText(TemporalField field, Map<Long, String> textLookup) { Jdk8Methods.requireNonNull(field, "field"); Jdk8Methods.requireNonNull(textLookup, "textLookup"); Map<Long, String> copy = new LinkedHashMap<Long, String>(textLookup); Map<TextStyle, Map<Long, String>> map = Collections.singletonMap(TextStyle.FULL, copy); final LocaleStore store = new LocaleStore(map); DateTimeTextProvider provider = new DateTimeTextProvider() { @Override public String getText(TemporalField field, long value, TextStyle style, Locale locale) { return store.getText(value, style); } @Override public Iterator<Entry<String, Long>> getTextIterator(TemporalField field, TextStyle style, Locale locale) { return store.getTextIterator(style); } }; appendInternal(new TextPrinterParser(field, TextStyle.FULL, provider)); return this; }
java
public DateTimeFormatterBuilder appendText(TemporalField field, Map<Long, String> textLookup) { Jdk8Methods.requireNonNull(field, "field"); Jdk8Methods.requireNonNull(textLookup, "textLookup"); Map<Long, String> copy = new LinkedHashMap<Long, String>(textLookup); Map<TextStyle, Map<Long, String>> map = Collections.singletonMap(TextStyle.FULL, copy); final LocaleStore store = new LocaleStore(map); DateTimeTextProvider provider = new DateTimeTextProvider() { @Override public String getText(TemporalField field, long value, TextStyle style, Locale locale) { return store.getText(value, style); } @Override public Iterator<Entry<String, Long>> getTextIterator(TemporalField field, TextStyle style, Locale locale) { return store.getTextIterator(style); } }; appendInternal(new TextPrinterParser(field, TextStyle.FULL, provider)); return this; }
[ "public", "DateTimeFormatterBuilder", "appendText", "(", "TemporalField", "field", ",", "Map", "<", "Long", ",", "String", ">", "textLookup", ")", "{", "Jdk8Methods", ".", "requireNonNull", "(", "field", ",", "\"field\"", ")", ";", "Jdk8Methods", ".", "requireNo...
Appends the text of a date-time field to the formatter using the specified map to supply the text. <p> The standard text outputting methods use the localized text in the JDK. This method allows that text to be specified directly. The supplied map is not validated by the builder to ensure that printing or parsing is possible, thus an invalid map may throw an error during later use. <p> Supplying the map of text provides considerable flexibility in printing and parsing. For example, a legacy application might require or supply the months of the year as "JNY", "FBY", "MCH" etc. These do not match the standard set of text for localized month names. Using this method, a map can be created which defines the connection between each value and the text: <pre> Map&lt;Long, String&gt; map = new HashMap&lt;&gt;(); map.put(1, "JNY"); map.put(2, "FBY"); map.put(3, "MCH"); ... builder.appendText(MONTH_OF_YEAR, map); </pre> <p> Other uses might be to output the value with a suffix, such as "1st", "2nd", "3rd", or as Roman numerals "I", "II", "III", "IV". <p> During printing, the value is obtained and checked that it is in the valid range. If text is not available for the value then it is output as a number. During parsing, the parser will match against the map of text and numeric values. @param field the field to append, not null @param textLookup the map from the value to the text @return this, for chaining, not null
[ "Appends", "the", "text", "of", "a", "date", "-", "time", "field", "to", "the", "formatter", "using", "the", "specified", "map", "to", "supply", "the", "text", ".", "<p", ">", "The", "standard", "text", "outputting", "methods", "use", "the", "localized", ...
train
https://github.com/ThreeTen/threetenbp/blob/5f05b649f89f205aabd96b2f83c36796ec616fe6/src/main/java/org/threeten/bp/format/DateTimeFormatterBuilder.java#L721-L739
blinkfox/zealot
src/main/java/com/blinkfox/zealot/core/ZealotKhala.java
ZealotKhala.orNotLikePattern
public ZealotKhala orNotLikePattern(String field, String pattern) { return this.doLikePattern(ZealotConst.OR_PREFIX, field, pattern, true, false); }
java
public ZealotKhala orNotLikePattern(String field, String pattern) { return this.doLikePattern(ZealotConst.OR_PREFIX, field, pattern, true, false); }
[ "public", "ZealotKhala", "orNotLikePattern", "(", "String", "field", ",", "String", "pattern", ")", "{", "return", "this", ".", "doLikePattern", "(", "ZealotConst", ".", "OR_PREFIX", ",", "field", ",", "pattern", ",", "true", ",", "false", ")", ";", "}" ]
根据指定的模式字符串生成带" OR "前缀的" NOT LIKE "模糊查询的SQL片段. <p>示例:传入 {"b.title", "Java%"} 两个参数,生成的SQL片段为:" OR b.title NOT LIKE 'Java%' "</p> @param field 数据库字段 @param pattern 模式字符串 @return ZealotKhala实例
[ "根据指定的模式字符串生成带", "OR", "前缀的", "NOT", "LIKE", "模糊查询的SQL片段", ".", "<p", ">", "示例:传入", "{", "b", ".", "title", "Java%", "}", "两个参数,生成的SQL片段为:", "OR", "b", ".", "title", "NOT", "LIKE", "Java%", "<", "/", "p", ">" ]
train
https://github.com/blinkfox/zealot/blob/21b00fa3e4ed42188eef3116d494e112e7a4194c/src/main/java/com/blinkfox/zealot/core/ZealotKhala.java#L1170-L1172
atteo/classindex
classindex/src/main/java/org/atteo/classindex/ClassIndex.java
ClassIndex.getAnnotatedNames
public static Iterable<String> getAnnotatedNames(Class<? extends Annotation> annotation) { return getAnnotatedNames(annotation, Thread.currentThread().getContextClassLoader()); }
java
public static Iterable<String> getAnnotatedNames(Class<? extends Annotation> annotation) { return getAnnotatedNames(annotation, Thread.currentThread().getContextClassLoader()); }
[ "public", "static", "Iterable", "<", "String", ">", "getAnnotatedNames", "(", "Class", "<", "?", "extends", "Annotation", ">", "annotation", ")", "{", "return", "getAnnotatedNames", "(", "annotation", ",", "Thread", ".", "currentThread", "(", ")", ".", "getCon...
Retrieves names of classes annotated by given annotation. <p/> <p> The annotation must be annotated with {@link IndexAnnotated} for annotated classes to be indexed at compile-time by {@link org.atteo.classindex.processor.ClassIndexProcessor}. </p> <p> Please note there is no verification if the class really exists. It can be missing when incremental compilation is used. Use {@link #getAnnotated(Class) } if you need the verification. </p> @param annotation annotation to search class for @return names of annotated classes
[ "Retrieves", "names", "of", "classes", "annotated", "by", "given", "annotation", ".", "<p", "/", ">", "<p", ">", "The", "annotation", "must", "be", "annotated", "with", "{" ]
train
https://github.com/atteo/classindex/blob/ad76c6bd8b4e84c594d94e48f466a095ffe2306a/classindex/src/main/java/org/atteo/classindex/ClassIndex.java#L285-L287
xvik/generics-resolver
src/main/java/ru/vyarus/java/generics/resolver/util/GenericInfoUtils.java
GenericInfoUtils.create
public static GenericsInfo create(final GenericsContext context, final Type type, final Class<?> asType, final Class<?>... ignoreClasses) { // root generics are required only to properly solve type final Map<String, Type> rootGenerics = context.visibleGenericsMap(); // first step: solve type to replace transitive generics with direct values final Type actual = GenericsUtils.resolveTypeVariables(type, rootGenerics); final Class<?> middleType = context.resolveClass(actual); if (!middleType.isAssignableFrom(asType)) { throw new IllegalArgumentException(String.format("Requested type %s is not a subtype of %s", asType.getSimpleName(), middleType.getSimpleName())); } // known middle type LinkedHashMap<String, Type> typeGenerics = GenericsResolutionUtils.resolveGenerics(actual, rootGenerics); final Map<Class<?>, LinkedHashMap<String, Type>> knownGenerics = new HashMap<Class<?>, LinkedHashMap<String, Type>>(); // field could be declared as (Outer<String>.Inner field) and already contain actual outer generics knownGenerics.put(middleType, GenericsResolutionUtils .fillOuterGenerics(actual, typeGenerics, context.getGenericsInfo().getTypesMap())); if (TypeUtils.isInner(middleType)) { // remember possibly specified outer generics (they were already resolved above) knownGenerics.put((Class) TypeUtils.getOuter(middleType), new LinkedHashMap<String, Type>( GenericsUtils.extractOwnerGenerics(middleType, knownGenerics.get(middleType)))); } else { // store other types for possible outer classes generics resolution knownGenerics.putAll(usePossiblyOwnerGenerics(asType, context.getGenericsInfo())); } // root type typeGenerics = asType.getTypeParameters().length > 0 ? GenericsTrackingUtils.track(asType, middleType, typeGenerics) : EmptyGenericsMap.getInstance(); typeGenerics = GenericsResolutionUtils .fillOuterGenerics(asType, typeGenerics, knownGenerics.size() > 1 // if known middle type is inner class then owner already filled ? knownGenerics : context.getGenericsInfo().getTypesMap()); return create(asType, typeGenerics, knownGenerics, ignoreClasses); }
java
public static GenericsInfo create(final GenericsContext context, final Type type, final Class<?> asType, final Class<?>... ignoreClasses) { // root generics are required only to properly solve type final Map<String, Type> rootGenerics = context.visibleGenericsMap(); // first step: solve type to replace transitive generics with direct values final Type actual = GenericsUtils.resolveTypeVariables(type, rootGenerics); final Class<?> middleType = context.resolveClass(actual); if (!middleType.isAssignableFrom(asType)) { throw new IllegalArgumentException(String.format("Requested type %s is not a subtype of %s", asType.getSimpleName(), middleType.getSimpleName())); } // known middle type LinkedHashMap<String, Type> typeGenerics = GenericsResolutionUtils.resolveGenerics(actual, rootGenerics); final Map<Class<?>, LinkedHashMap<String, Type>> knownGenerics = new HashMap<Class<?>, LinkedHashMap<String, Type>>(); // field could be declared as (Outer<String>.Inner field) and already contain actual outer generics knownGenerics.put(middleType, GenericsResolutionUtils .fillOuterGenerics(actual, typeGenerics, context.getGenericsInfo().getTypesMap())); if (TypeUtils.isInner(middleType)) { // remember possibly specified outer generics (they were already resolved above) knownGenerics.put((Class) TypeUtils.getOuter(middleType), new LinkedHashMap<String, Type>( GenericsUtils.extractOwnerGenerics(middleType, knownGenerics.get(middleType)))); } else { // store other types for possible outer classes generics resolution knownGenerics.putAll(usePossiblyOwnerGenerics(asType, context.getGenericsInfo())); } // root type typeGenerics = asType.getTypeParameters().length > 0 ? GenericsTrackingUtils.track(asType, middleType, typeGenerics) : EmptyGenericsMap.getInstance(); typeGenerics = GenericsResolutionUtils .fillOuterGenerics(asType, typeGenerics, knownGenerics.size() > 1 // if known middle type is inner class then owner already filled ? knownGenerics : context.getGenericsInfo().getTypesMap()); return create(asType, typeGenerics, knownGenerics, ignoreClasses); }
[ "public", "static", "GenericsInfo", "create", "(", "final", "GenericsContext", "context", ",", "final", "Type", "type", ",", "final", "Class", "<", "?", ">", "asType", ",", "final", "Class", "<", "?", ">", "...", "ignoreClasses", ")", "{", "// root generics ...
Type analysis in context of analyzed type with child class as target type. Case: we have interface (or base type) with generic in class (as field or return type), but we need to analyze actual instance type (from value). This method will analyze type from new root (where generics are unknown), but will add known middle generics. <p> NOTE: some of the root generics could possibly be resolved if there are any traceable connectivity between the root class and known middle generics. All possible (known) cases should be solved. For example, {@code Root<K> extends Target<List<K>>} when we know {@code Target<Collection<String>>} then K will be tracked as String. <p> In essence: root generics are partially resolved by tracking definition from known middle class. Other root generics resolved as upper bound (the same as in usual type resolution case). If middle type generic is not specified (and so resolved as Object) then known specific type used (assuming root type would be used in place with known parametrization and so more specifi generic may be counted). <p> The result is not intended to be cached as it's context-sensitive. @param context generics context of containing class @param type type to analyze (important: this must be generified type and not raw class in order to properly resolve generics) @param asType target child type (this class contain original type in hierarchy) @param ignoreClasses classes to exclude from hierarchy analysis @return analyzed type generics info
[ "Type", "analysis", "in", "context", "of", "analyzed", "type", "with", "child", "class", "as", "target", "type", ".", "Case", ":", "we", "have", "interface", "(", "or", "base", "type", ")", "with", "generic", "in", "class", "(", "as", "field", "or", "r...
train
https://github.com/xvik/generics-resolver/blob/d7d9d2783265df1178230e8f0b7cb6d853b67a7b/src/main/java/ru/vyarus/java/generics/resolver/util/GenericInfoUtils.java#L101-L142
datastax/java-driver
core/src/main/java/com/datastax/oss/driver/internal/core/util/concurrent/CompletableFutures.java
CompletableFutures.getFailed
public static Throwable getFailed(CompletionStage<?> stage) { CompletableFuture<?> future = stage.toCompletableFuture(); Preconditions.checkArgument(future.isCompletedExceptionally()); try { future.get(); throw new AssertionError("future should be failed"); } catch (InterruptedException e) { throw new AssertionError("Unexpected error", e); } catch (ExecutionException e) { return e.getCause(); } }
java
public static Throwable getFailed(CompletionStage<?> stage) { CompletableFuture<?> future = stage.toCompletableFuture(); Preconditions.checkArgument(future.isCompletedExceptionally()); try { future.get(); throw new AssertionError("future should be failed"); } catch (InterruptedException e) { throw new AssertionError("Unexpected error", e); } catch (ExecutionException e) { return e.getCause(); } }
[ "public", "static", "Throwable", "getFailed", "(", "CompletionStage", "<", "?", ">", "stage", ")", "{", "CompletableFuture", "<", "?", ">", "future", "=", "stage", ".", "toCompletableFuture", "(", ")", ";", "Preconditions", ".", "checkArgument", "(", "future",...
Get the error now, when we know for sure that the future is failed.
[ "Get", "the", "error", "now", "when", "we", "know", "for", "sure", "that", "the", "future", "is", "failed", "." ]
train
https://github.com/datastax/java-driver/blob/612a63f2525618e2020e86c9ad75ab37adba6132/core/src/main/java/com/datastax/oss/driver/internal/core/util/concurrent/CompletableFutures.java#L89-L100
xcesco/kripton
kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/grammars/jql/JQLChecker.java
JQLChecker.extractColumnsToInsertOrUpdate
public Set<String> extractColumnsToInsertOrUpdate(final JQLContext jqlContext, String jqlValue, final Finder<SQLProperty> entity) { final Set<String> result = new LinkedHashSet<String>(); final One<Boolean> selectionOn = new One<Boolean>(null); final One<Boolean> insertOn = new One<Boolean>(null); // Column_name_set is needed for insert // Columns_to_update is needed for update analyzeInternal(jqlContext, jqlValue, new JqlBaseListener() { @Override public void enterColumn_name_set(Column_name_setContext ctx) { if (insertOn.value0 == null) { insertOn.value0 = true; } } @Override public void exitColumn_name_set(Column_name_setContext ctx) { insertOn.value0 = false; } @Override public void enterColumns_to_update(Columns_to_updateContext ctx) { if (selectionOn.value0 == null) { selectionOn.value0 = true; } } @Override public void exitColumns_to_update(Columns_to_updateContext ctx) { selectionOn.value0 = false; } @Override public void enterColumn_name(Column_nameContext ctx) { // works for INSERTS if (insertOn.value0 != null && insertOn.value0 == true) { result.add(ctx.getText()); } } @Override public void enterColumn_name_to_update(Column_name_to_updateContext ctx) { result.add(ctx.getText()); } }); return result; }
java
public Set<String> extractColumnsToInsertOrUpdate(final JQLContext jqlContext, String jqlValue, final Finder<SQLProperty> entity) { final Set<String> result = new LinkedHashSet<String>(); final One<Boolean> selectionOn = new One<Boolean>(null); final One<Boolean> insertOn = new One<Boolean>(null); // Column_name_set is needed for insert // Columns_to_update is needed for update analyzeInternal(jqlContext, jqlValue, new JqlBaseListener() { @Override public void enterColumn_name_set(Column_name_setContext ctx) { if (insertOn.value0 == null) { insertOn.value0 = true; } } @Override public void exitColumn_name_set(Column_name_setContext ctx) { insertOn.value0 = false; } @Override public void enterColumns_to_update(Columns_to_updateContext ctx) { if (selectionOn.value0 == null) { selectionOn.value0 = true; } } @Override public void exitColumns_to_update(Columns_to_updateContext ctx) { selectionOn.value0 = false; } @Override public void enterColumn_name(Column_nameContext ctx) { // works for INSERTS if (insertOn.value0 != null && insertOn.value0 == true) { result.add(ctx.getText()); } } @Override public void enterColumn_name_to_update(Column_name_to_updateContext ctx) { result.add(ctx.getText()); } }); return result; }
[ "public", "Set", "<", "String", ">", "extractColumnsToInsertOrUpdate", "(", "final", "JQLContext", "jqlContext", ",", "String", "jqlValue", ",", "final", "Finder", "<", "SQLProperty", ">", "entity", ")", "{", "final", "Set", "<", "String", ">", "result", "=", ...
Extract columns to insert or update. @param jqlContext the jql context @param jqlValue the jql value @param entity the entity @return the sets the
[ "Extract", "columns", "to", "insert", "or", "update", "." ]
train
https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/grammars/jql/JQLChecker.java#L330-L380
aws/aws-sdk-java
aws-java-sdk-sns/src/main/java/com/amazonaws/services/sns/model/GetSMSAttributesResult.java
GetSMSAttributesResult.withAttributes
public GetSMSAttributesResult withAttributes(java.util.Map<String, String> attributes) { setAttributes(attributes); return this; }
java
public GetSMSAttributesResult withAttributes(java.util.Map<String, String> attributes) { setAttributes(attributes); return this; }
[ "public", "GetSMSAttributesResult", "withAttributes", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "attributes", ")", "{", "setAttributes", "(", "attributes", ")", ";", "return", "this", ";", "}" ]
<p> The SMS attribute names and their values. </p> @param attributes The SMS attribute names and their values. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "The", "SMS", "attribute", "names", "and", "their", "values", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-sns/src/main/java/com/amazonaws/services/sns/model/GetSMSAttributesResult.java#L74-L77
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/MeasureFormat.java
MeasureFormat.formatMeasurePerUnit
public StringBuilder formatMeasurePerUnit( Measure measure, MeasureUnit perUnit, StringBuilder appendTo, FieldPosition pos) { MeasureUnit resolvedUnit = MeasureUnit.resolveUnitPerUnit( measure.getUnit(), perUnit); if (resolvedUnit != null) { Measure newMeasure = new Measure(measure.getNumber(), resolvedUnit); return formatMeasure(newMeasure, numberFormat, appendTo, pos); } FieldPosition fpos = new FieldPosition( pos.getFieldAttribute(), pos.getField()); int offset = withPerUnitAndAppend( formatMeasure(measure, numberFormat, new StringBuilder(), fpos), perUnit, appendTo); if (fpos.getBeginIndex() != 0 || fpos.getEndIndex() != 0) { pos.setBeginIndex(fpos.getBeginIndex() + offset); pos.setEndIndex(fpos.getEndIndex() + offset); } return appendTo; }
java
public StringBuilder formatMeasurePerUnit( Measure measure, MeasureUnit perUnit, StringBuilder appendTo, FieldPosition pos) { MeasureUnit resolvedUnit = MeasureUnit.resolveUnitPerUnit( measure.getUnit(), perUnit); if (resolvedUnit != null) { Measure newMeasure = new Measure(measure.getNumber(), resolvedUnit); return formatMeasure(newMeasure, numberFormat, appendTo, pos); } FieldPosition fpos = new FieldPosition( pos.getFieldAttribute(), pos.getField()); int offset = withPerUnitAndAppend( formatMeasure(measure, numberFormat, new StringBuilder(), fpos), perUnit, appendTo); if (fpos.getBeginIndex() != 0 || fpos.getEndIndex() != 0) { pos.setBeginIndex(fpos.getBeginIndex() + offset); pos.setEndIndex(fpos.getEndIndex() + offset); } return appendTo; }
[ "public", "StringBuilder", "formatMeasurePerUnit", "(", "Measure", "measure", ",", "MeasureUnit", "perUnit", ",", "StringBuilder", "appendTo", ",", "FieldPosition", "pos", ")", "{", "MeasureUnit", "resolvedUnit", "=", "MeasureUnit", ".", "resolveUnitPerUnit", "(", "me...
Formats a single measure per unit. An example of such a formatted string is "3.5 meters per second." @param measure the measure object. In above example, 3.5 meters. @param perUnit the per unit. In above example, it is MeasureUnit.SECOND @param appendTo formatted string appended here. @param pos The field position. @return appendTo.
[ "Formats", "a", "single", "measure", "per", "unit", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/MeasureFormat.java#L480-L502
keenlabs/KeenClient-Java
query/src/main/java/io/keen/client/java/KeenQueryClient.java
KeenQueryClient.countUnique
public long countUnique(String eventCollection, String targetProperty, Timeframe timeframe) throws IOException { Query queryParams = new Query.Builder(QueryType.COUNT_UNIQUE) .withEventCollection(eventCollection) .withTargetProperty(targetProperty) .withTimeframe(timeframe) .build(); QueryResult result = execute(queryParams); return queryResultToLong(result); }
java
public long countUnique(String eventCollection, String targetProperty, Timeframe timeframe) throws IOException { Query queryParams = new Query.Builder(QueryType.COUNT_UNIQUE) .withEventCollection(eventCollection) .withTargetProperty(targetProperty) .withTimeframe(timeframe) .build(); QueryResult result = execute(queryParams); return queryResultToLong(result); }
[ "public", "long", "countUnique", "(", "String", "eventCollection", ",", "String", "targetProperty", ",", "Timeframe", "timeframe", ")", "throws", "IOException", "{", "Query", "queryParams", "=", "new", "Query", ".", "Builder", "(", "QueryType", ".", "COUNT_UNIQUE"...
Count Unique query with only the required arguments. Query API info here: https://keen.io/docs/api/#count-unique @param eventCollection The name of the event collection you are analyzing. @param targetProperty The name of the property you are analyzing. @param timeframe The {@link RelativeTimeframe} or {@link AbsoluteTimeframe}. @return The count unique query response. @throws IOException If there was an error communicating with the server or an error message received from the server.
[ "Count", "Unique", "query", "with", "only", "the", "required", "arguments", ".", "Query", "API", "info", "here", ":", "https", ":", "//", "keen", ".", "io", "/", "docs", "/", "api", "/", "#count", "-", "unique" ]
train
https://github.com/keenlabs/KeenClient-Java/blob/2ea021547b5338257c951a2596bd49749038d018/query/src/main/java/io/keen/client/java/KeenQueryClient.java#L95-L103