repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
listlengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
listlengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
alkacon/opencms-core
src/org/opencms/file/CmsObject.java
CmsObject.createSibling
public CmsResource createSibling(String source, String destination, List<CmsProperty> properties) throws CmsException { """ Creates a new sibling of the source resource.<p> @param source the name of the resource to create a sibling for with complete path @param destination the name of the sibling to create with complete path @param properties the individual properties for the new sibling @return the new created sibling @throws CmsException if something goes wrong """ CmsResource resource = readResource(source, CmsResourceFilter.IGNORE_EXPIRATION); return getResourceType(resource).createSibling(this, m_securityManager, resource, destination, properties); }
java
public CmsResource createSibling(String source, String destination, List<CmsProperty> properties) throws CmsException { CmsResource resource = readResource(source, CmsResourceFilter.IGNORE_EXPIRATION); return getResourceType(resource).createSibling(this, m_securityManager, resource, destination, properties); }
[ "public", "CmsResource", "createSibling", "(", "String", "source", ",", "String", "destination", ",", "List", "<", "CmsProperty", ">", "properties", ")", "throws", "CmsException", "{", "CmsResource", "resource", "=", "readResource", "(", "source", ",", "CmsResourc...
Creates a new sibling of the source resource.<p> @param source the name of the resource to create a sibling for with complete path @param destination the name of the sibling to create with complete path @param properties the individual properties for the new sibling @return the new created sibling @throws CmsException if something goes wrong
[ "Creates", "a", "new", "sibling", "of", "the", "source", "resource", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/CmsObject.java#L865-L870
revelc/formatter-maven-plugin
src/main/java/net/revelc/code/formatter/FormatterMojo.java
FormatterMojo.writeStringToFile
private void writeStringToFile(String str, File file) throws IOException { """ Write the given string to a file. @param str the str @param file the file @throws IOException Signals that an I/O exception has occurred. """ if (!file.exists() && file.isDirectory()) { return; } try (BufferedWriter bw = new BufferedWriter(WriterFactory.newWriter(file, this.encoding))) { bw.write(str); } }
java
private void writeStringToFile(String str, File file) throws IOException { if (!file.exists() && file.isDirectory()) { return; } try (BufferedWriter bw = new BufferedWriter(WriterFactory.newWriter(file, this.encoding))) { bw.write(str); } }
[ "private", "void", "writeStringToFile", "(", "String", "str", ",", "File", "file", ")", "throws", "IOException", "{", "if", "(", "!", "file", ".", "exists", "(", ")", "&&", "file", ".", "isDirectory", "(", ")", ")", "{", "return", ";", "}", "try", "(...
Write the given string to a file. @param str the str @param file the file @throws IOException Signals that an I/O exception has occurred.
[ "Write", "the", "given", "string", "to", "a", "file", "." ]
train
https://github.com/revelc/formatter-maven-plugin/blob/a237073ce6220e73ad6b1faef412fe0660485cf4/src/main/java/net/revelc/code/formatter/FormatterMojo.java#L621-L629
roboconf/roboconf-platform
core/roboconf-core/src/main/java/net/roboconf/core/model/helpers/InstanceHelpers.java
InstanceHelpers.hasChildWithThisName
public static boolean hasChildWithThisName( AbstractApplication application, Instance parentInstance, String nameToSearch ) { """ Determines whether an instance name is not already used by a sibling instance. @param application the application (not null) @param parentInstance the parent instance (can be null to indicate a root instance) @param nameToSearch the name to search @return true if a child instance of <code>parentInstance</code> has the same name, false otherwise """ boolean hasAlreadyAChildWithThisName = false; Collection<Instance> list = parentInstance == null ? application.getRootInstances() : parentInstance.getChildren(); for( Iterator<Instance> it = list.iterator(); it.hasNext() && ! hasAlreadyAChildWithThisName; ) { hasAlreadyAChildWithThisName = Objects.equals( nameToSearch, it.next().getName()); } return hasAlreadyAChildWithThisName; }
java
public static boolean hasChildWithThisName( AbstractApplication application, Instance parentInstance, String nameToSearch ) { boolean hasAlreadyAChildWithThisName = false; Collection<Instance> list = parentInstance == null ? application.getRootInstances() : parentInstance.getChildren(); for( Iterator<Instance> it = list.iterator(); it.hasNext() && ! hasAlreadyAChildWithThisName; ) { hasAlreadyAChildWithThisName = Objects.equals( nameToSearch, it.next().getName()); } return hasAlreadyAChildWithThisName; }
[ "public", "static", "boolean", "hasChildWithThisName", "(", "AbstractApplication", "application", ",", "Instance", "parentInstance", ",", "String", "nameToSearch", ")", "{", "boolean", "hasAlreadyAChildWithThisName", "=", "false", ";", "Collection", "<", "Instance", ">"...
Determines whether an instance name is not already used by a sibling instance. @param application the application (not null) @param parentInstance the parent instance (can be null to indicate a root instance) @param nameToSearch the name to search @return true if a child instance of <code>parentInstance</code> has the same name, false otherwise
[ "Determines", "whether", "an", "instance", "name", "is", "not", "already", "used", "by", "a", "sibling", "instance", "." ]
train
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-core/src/main/java/net/roboconf/core/model/helpers/InstanceHelpers.java#L467-L476
mcxiaoke/Android-Next
ui/src/main/java/com/mcxiaoke/next/ui/widget/AdvancedShareActionProvider.java
AdvancedShareActionProvider.setIntentExtras
public void setIntentExtras(String subject, String text, Uri imageUri) { """ 添加额外的参数到Intent 注意:必须在setShareIntent之后调用 @param subject Intent.EXTRA_SUBJECT @param text Intent.EXTRA_TEXT @param imageUri Intent.EXTRA_STREAM """ if (DEBUG) { Log.v(TAG, "setIntentExtras() subject=" + subject); Log.v(TAG, "setIntentExtras() text=" + text); Log.v(TAG, "setIntentExtras() imageUri=" + imageUri); } mIntent.putExtra(Intent.EXTRA_SUBJECT, subject); mIntent.putExtra(Intent.EXTRA_TEXT, text); if (imageUri != null) { mIntent.putExtra(Intent.EXTRA_STREAM, imageUri); } }
java
public void setIntentExtras(String subject, String text, Uri imageUri) { if (DEBUG) { Log.v(TAG, "setIntentExtras() subject=" + subject); Log.v(TAG, "setIntentExtras() text=" + text); Log.v(TAG, "setIntentExtras() imageUri=" + imageUri); } mIntent.putExtra(Intent.EXTRA_SUBJECT, subject); mIntent.putExtra(Intent.EXTRA_TEXT, text); if (imageUri != null) { mIntent.putExtra(Intent.EXTRA_STREAM, imageUri); } }
[ "public", "void", "setIntentExtras", "(", "String", "subject", ",", "String", "text", ",", "Uri", "imageUri", ")", "{", "if", "(", "DEBUG", ")", "{", "Log", ".", "v", "(", "TAG", ",", "\"setIntentExtras() subject=\"", "+", "subject", ")", ";", "Log", "."...
添加额外的参数到Intent 注意:必须在setShareIntent之后调用 @param subject Intent.EXTRA_SUBJECT @param text Intent.EXTRA_TEXT @param imageUri Intent.EXTRA_STREAM
[ "添加额外的参数到Intent", "注意:必须在setShareIntent之后调用" ]
train
https://github.com/mcxiaoke/Android-Next/blob/1bfdf99d0b81a849aa0fa6697c53ed673151ca39/ui/src/main/java/com/mcxiaoke/next/ui/widget/AdvancedShareActionProvider.java#L220-L231
VoltDB/voltdb
src/frontend/org/voltdb/planner/parseinfo/JoinNode.java
JoinNode.reconstructJoinTreeFromTableNodes
public static JoinNode reconstructJoinTreeFromTableNodes(List<JoinNode> tableNodes, JoinType joinType) { """ Reconstruct a join tree from the list of tables always appending the next node to the right. @param tableNodes the list of tables to build the tree from. @param JoinType the join type for all the joins @return The reconstructed tree """ JoinNode root = null; for (JoinNode leafNode : tableNodes) { JoinNode node = leafNode.cloneWithoutFilters(); if (root == null) { root = node; } else { // We only care about the root node id to be able to reconnect the sub-trees // The intermediate node id can be anything. For the final root node its id // will be set later to the original tree's root id root = new BranchNode(-node.m_id, joinType, root, node); } } return root; }
java
public static JoinNode reconstructJoinTreeFromTableNodes(List<JoinNode> tableNodes, JoinType joinType) { JoinNode root = null; for (JoinNode leafNode : tableNodes) { JoinNode node = leafNode.cloneWithoutFilters(); if (root == null) { root = node; } else { // We only care about the root node id to be able to reconnect the sub-trees // The intermediate node id can be anything. For the final root node its id // will be set later to the original tree's root id root = new BranchNode(-node.m_id, joinType, root, node); } } return root; }
[ "public", "static", "JoinNode", "reconstructJoinTreeFromTableNodes", "(", "List", "<", "JoinNode", ">", "tableNodes", ",", "JoinType", "joinType", ")", "{", "JoinNode", "root", "=", "null", ";", "for", "(", "JoinNode", "leafNode", ":", "tableNodes", ")", "{", ...
Reconstruct a join tree from the list of tables always appending the next node to the right. @param tableNodes the list of tables to build the tree from. @param JoinType the join type for all the joins @return The reconstructed tree
[ "Reconstruct", "a", "join", "tree", "from", "the", "list", "of", "tables", "always", "appending", "the", "next", "node", "to", "the", "right", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/planner/parseinfo/JoinNode.java#L335-L349
heroku/heroku.jar
heroku-api/src/main/java/com/heroku/api/request/RequestConfig.java
RequestConfig.withOptions
public RequestConfig withOptions(Heroku.RequestKey key, Map<String, String> data) { """ Sets a {@link com.heroku.api.Heroku.RequestKey} parameter. @param key Heroku request key @param data arbitrary key/value map @return A new {@link RequestConfig} """ RequestConfig newConfig = copy(); newConfig.config.put(key, new Either(new Data(data))); return newConfig; }
java
public RequestConfig withOptions(Heroku.RequestKey key, Map<String, String> data) { RequestConfig newConfig = copy(); newConfig.config.put(key, new Either(new Data(data))); return newConfig; }
[ "public", "RequestConfig", "withOptions", "(", "Heroku", ".", "RequestKey", "key", ",", "Map", "<", "String", ",", "String", ">", "data", ")", "{", "RequestConfig", "newConfig", "=", "copy", "(", ")", ";", "newConfig", ".", "config", ".", "put", "(", "ke...
Sets a {@link com.heroku.api.Heroku.RequestKey} parameter. @param key Heroku request key @param data arbitrary key/value map @return A new {@link RequestConfig}
[ "Sets", "a", "{" ]
train
https://github.com/heroku/heroku.jar/blob/d9e52991293159498c10c498c6f91fcdd637378e/heroku-api/src/main/java/com/heroku/api/request/RequestConfig.java#L66-L70
redkale/redkale
src/org/redkale/source/ColumnValue.java
ColumnValue.orr
public static ColumnValue orr(String column, Serializable value) { """ 返回 {column} = {column} | {value} 操作 @param column 字段名 @param value 字段值 @return ColumnValue """ return new ColumnValue(column, ORR, value); }
java
public static ColumnValue orr(String column, Serializable value) { return new ColumnValue(column, ORR, value); }
[ "public", "static", "ColumnValue", "orr", "(", "String", "column", ",", "Serializable", "value", ")", "{", "return", "new", "ColumnValue", "(", "column", ",", "ORR", ",", "value", ")", ";", "}" ]
返回 {column} = {column} | {value} 操作 @param column 字段名 @param value 字段值 @return ColumnValue
[ "返回", "{", "column", "}", "=", "{", "column", "}", "|", "{", "value", "}", "操作" ]
train
https://github.com/redkale/redkale/blob/ea5169b5c5ea7412fd762331c0c497165832e901/src/org/redkale/source/ColumnValue.java#L109-L111
VueGWT/vue-gwt
core/src/main/java/com/axellience/vuegwt/core/client/component/options/VueComponentOptions.java
VueComponentOptions.addJavaPropValidator
@JsOverlay public final void addJavaPropValidator(Function javaMethod, String propertyName) { """ Add a custom prop validator to validate a property @param javaMethod Function pointer to the method in the {@link IsVueComponent} @param propertyName The name of the property to validate """ PropOptions propDefinition = getProps().get(propertyName); propDefinition.validator = javaMethod; }
java
@JsOverlay public final void addJavaPropValidator(Function javaMethod, String propertyName) { PropOptions propDefinition = getProps().get(propertyName); propDefinition.validator = javaMethod; }
[ "@", "JsOverlay", "public", "final", "void", "addJavaPropValidator", "(", "Function", "javaMethod", ",", "String", "propertyName", ")", "{", "PropOptions", "propDefinition", "=", "getProps", "(", ")", ".", "get", "(", "propertyName", ")", ";", "propDefinition", ...
Add a custom prop validator to validate a property @param javaMethod Function pointer to the method in the {@link IsVueComponent} @param propertyName The name of the property to validate
[ "Add", "a", "custom", "prop", "validator", "to", "validate", "a", "property" ]
train
https://github.com/VueGWT/vue-gwt/blob/961cd83aed6fe8e2dd80c279847f1b3f62918a1f/core/src/main/java/com/axellience/vuegwt/core/client/component/options/VueComponentOptions.java#L195-L199
GenesysPureEngage/authentication-client-java
src/main/java/com/genesys/internal/authentication/api/AuthenticationApi.java
AuthenticationApi.authorize
public void authorize(String clientId, String redirectUri, String responseType, String authorization, Boolean hideTenant, String scope) throws ApiException { """ Perform authorization Perform authorization based on the code grant type &amp;mdash; either Authorization Code Grant or Implicit Grant. For more information, see [Authorization Endpoint](https://tools.ietf.org/html/rfc6749#section-3.1). **Note:** For the optional **scope** parameter, the Authentication API supports only the &#x60;*&#x60; value. @param clientId The ID of the application or service that is registered as the client. You&#39;ll need to get this value from your PureEngage Cloud representative. (required) @param redirectUri The URI that you want users to be redirected to after entering valid credentials during an Implicit or Authorization Code grant. The Authentication API includes this as part of the URI it returns in the &#39;Location&#39; header. (required) @param responseType The response type to let the Authentication API know which grant flow you&#39;re using. Possible values are &#x60;code&#x60; for Authorization Code Grant or &#x60;token&#x60; for Implicit Grant. For more information about this parameter, see [Response Type](https://tools.ietf.org/html/rfc6749#section-3.1.1). (required) @param authorization Basic authorization. For example: &#39;Authorization: Basic Y3...MQ&#x3D;&#x3D;&#39; (optional) @param hideTenant Hide the **tenant** field in the UI for Authorization Code Grant. (optional, default to false) @param scope The scope of the access request. The Authentication API supports only the &#x60;*&#x60; value. (optional) @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body """ authorizeWithHttpInfo(clientId, redirectUri, responseType, authorization, hideTenant, scope); }
java
public void authorize(String clientId, String redirectUri, String responseType, String authorization, Boolean hideTenant, String scope) throws ApiException { authorizeWithHttpInfo(clientId, redirectUri, responseType, authorization, hideTenant, scope); }
[ "public", "void", "authorize", "(", "String", "clientId", ",", "String", "redirectUri", ",", "String", "responseType", ",", "String", "authorization", ",", "Boolean", "hideTenant", ",", "String", "scope", ")", "throws", "ApiException", "{", "authorizeWithHttpInfo", ...
Perform authorization Perform authorization based on the code grant type &amp;mdash; either Authorization Code Grant or Implicit Grant. For more information, see [Authorization Endpoint](https://tools.ietf.org/html/rfc6749#section-3.1). **Note:** For the optional **scope** parameter, the Authentication API supports only the &#x60;*&#x60; value. @param clientId The ID of the application or service that is registered as the client. You&#39;ll need to get this value from your PureEngage Cloud representative. (required) @param redirectUri The URI that you want users to be redirected to after entering valid credentials during an Implicit or Authorization Code grant. The Authentication API includes this as part of the URI it returns in the &#39;Location&#39; header. (required) @param responseType The response type to let the Authentication API know which grant flow you&#39;re using. Possible values are &#x60;code&#x60; for Authorization Code Grant or &#x60;token&#x60; for Implicit Grant. For more information about this parameter, see [Response Type](https://tools.ietf.org/html/rfc6749#section-3.1.1). (required) @param authorization Basic authorization. For example: &#39;Authorization: Basic Y3...MQ&#x3D;&#x3D;&#39; (optional) @param hideTenant Hide the **tenant** field in the UI for Authorization Code Grant. (optional, default to false) @param scope The scope of the access request. The Authentication API supports only the &#x60;*&#x60; value. (optional) @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Perform", "authorization", "Perform", "authorization", "based", "on", "the", "code", "grant", "type", "&amp", ";", "mdash", ";", "either", "Authorization", "Code", "Grant", "or", "Implicit", "Grant", ".", "For", "more", "information", "see", "[", "Authorization...
train
https://github.com/GenesysPureEngage/authentication-client-java/blob/eb0d58343ee42ebd3c037163c1137f611dfcbb3a/src/main/java/com/genesys/internal/authentication/api/AuthenticationApi.java#L164-L166
groovy/groovy-core
src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java
StringGroovyMethods.isCase
public static boolean isCase(CharSequence caseValue, Object switchValue) { """ 'Case' implementation for a CharSequence, which uses equals between the toString() of the caseValue and the switchValue. This allows CharSequence values to be used in switch statements. For example: <pre> switch( str ) { case 'one' : // etc... } </pre> Note that this returns <code>true</code> for the case where both the 'switch' and 'case' operand is <code>null</code>. @param caseValue the case value @param switchValue the switch value @return true if the switchValue's toString() equals the caseValue @since 1.8.2 """ String s = caseValue.toString(); if (switchValue == null) { return s == null; } return s.equals(switchValue.toString()); }
java
public static boolean isCase(CharSequence caseValue, Object switchValue) { String s = caseValue.toString(); if (switchValue == null) { return s == null; } return s.equals(switchValue.toString()); }
[ "public", "static", "boolean", "isCase", "(", "CharSequence", "caseValue", ",", "Object", "switchValue", ")", "{", "String", "s", "=", "caseValue", ".", "toString", "(", ")", ";", "if", "(", "switchValue", "==", "null", ")", "{", "return", "s", "==", "nu...
'Case' implementation for a CharSequence, which uses equals between the toString() of the caseValue and the switchValue. This allows CharSequence values to be used in switch statements. For example: <pre> switch( str ) { case 'one' : // etc... } </pre> Note that this returns <code>true</code> for the case where both the 'switch' and 'case' operand is <code>null</code>. @param caseValue the case value @param switchValue the switch value @return true if the switchValue's toString() equals the caseValue @since 1.8.2
[ "Case", "implementation", "for", "a", "CharSequence", "which", "uses", "equals", "between", "the", "toString", "()", "of", "the", "caseValue", "and", "the", "switchValue", ".", "This", "allows", "CharSequence", "values", "to", "be", "used", "in", "switch", "st...
train
https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java#L1666-L1672
apereo/cas
core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/ResourceUtils.java
ResourceUtils.getRawResourceFrom
public static AbstractResource getRawResourceFrom(final String location) throws IOException { """ Gets resource from a String location. @param location the metadata location @return the resource from @throws IOException the exception """ if (StringUtils.isBlank(location)) { throw new IllegalArgumentException("Provided location does not exist and is empty"); } if (location.toLowerCase().startsWith(HTTP_URL_PREFIX)) { return new UrlResource(location); } if (location.toLowerCase().startsWith(CLASSPATH_URL_PREFIX)) { return new ClassPathResource(location.substring(CLASSPATH_URL_PREFIX.length())); } return new FileSystemResource(StringUtils.remove(location, FILE_URL_PREFIX)); }
java
public static AbstractResource getRawResourceFrom(final String location) throws IOException { if (StringUtils.isBlank(location)) { throw new IllegalArgumentException("Provided location does not exist and is empty"); } if (location.toLowerCase().startsWith(HTTP_URL_PREFIX)) { return new UrlResource(location); } if (location.toLowerCase().startsWith(CLASSPATH_URL_PREFIX)) { return new ClassPathResource(location.substring(CLASSPATH_URL_PREFIX.length())); } return new FileSystemResource(StringUtils.remove(location, FILE_URL_PREFIX)); }
[ "public", "static", "AbstractResource", "getRawResourceFrom", "(", "final", "String", "location", ")", "throws", "IOException", "{", "if", "(", "StringUtils", ".", "isBlank", "(", "location", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Provi...
Gets resource from a String location. @param location the metadata location @return the resource from @throws IOException the exception
[ "Gets", "resource", "from", "a", "String", "location", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/ResourceUtils.java#L48-L59
haraldk/TwelveMonkeys
imageio/imageio-metadata/src/main/java/com/twelvemonkeys/imageio/metadata/jpeg/JPEGSegmentUtil.java
JPEGSegmentUtil.readSegments
public static List<JPEGSegment> readSegments(final ImageInputStream stream, final int marker, final String identifier) throws IOException { """ Reads the requested JPEG segments from the stream. The stream position must be directly before the SOI marker, and only segments for the current image is read. @param stream the stream to read from. @param marker the segment marker to read @param identifier the identifier to read, or {@code null} to match any segment @return a list of segments with the given app marker and optional identifier. If no segments are found, an empty list is returned. @throws IIOException if a JPEG format exception occurs during reading @throws IOException if an I/O exception occurs during reading """ return readSegments(stream, Collections.singletonMap(marker, identifier != null ? Collections.singletonList(identifier) : ALL_IDS)); }
java
public static List<JPEGSegment> readSegments(final ImageInputStream stream, final int marker, final String identifier) throws IOException { return readSegments(stream, Collections.singletonMap(marker, identifier != null ? Collections.singletonList(identifier) : ALL_IDS)); }
[ "public", "static", "List", "<", "JPEGSegment", ">", "readSegments", "(", "final", "ImageInputStream", "stream", ",", "final", "int", "marker", ",", "final", "String", "identifier", ")", "throws", "IOException", "{", "return", "readSegments", "(", "stream", ",",...
Reads the requested JPEG segments from the stream. The stream position must be directly before the SOI marker, and only segments for the current image is read. @param stream the stream to read from. @param marker the segment marker to read @param identifier the identifier to read, or {@code null} to match any segment @return a list of segments with the given app marker and optional identifier. If no segments are found, an empty list is returned. @throws IIOException if a JPEG format exception occurs during reading @throws IOException if an I/O exception occurs during reading
[ "Reads", "the", "requested", "JPEG", "segments", "from", "the", "stream", ".", "The", "stream", "position", "must", "be", "directly", "before", "the", "SOI", "marker", "and", "only", "segments", "for", "the", "current", "image", "is", "read", "." ]
train
https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/imageio/imageio-metadata/src/main/java/com/twelvemonkeys/imageio/metadata/jpeg/JPEGSegmentUtil.java#L82-L84
GeoLatte/geolatte-common
src/main/java/org/geolatte/common/transformer/AbstractObservableTransformerSink.java
AbstractObservableTransformerSink.onTransformationSinkErrorOccurred
protected void onTransformationSinkErrorOccurred(Exception exception) { """ Called when an exception occurred. Fires the ErrorOccured event. @param exception The exception that was thrown by the TransformationSink. """ for (TransformerSinkEventListener listener : transformerSinkEventListeners) fireErrorEvent(listener, new TransformerSinkErrorEvent(this, exception)); } /** * (Re)-fires a preconstructed event. * @param event The event to fire */ protected void onTransformationSinkErrorOccurred(TransformerSinkErrorEvent event) { for (TransformerSinkEventListener listener : transformerSinkEventListeners) fireErrorEvent(listener, event); } /** * Fires the given event on the given listener. * @param listener The listener to fire the event to. * @param event The event to fire. */ private void fireErrorEvent(TransformerSinkEventListener listener, TransformerSinkErrorEvent event) { try { listener.ErrorOccurred(event); } catch (RuntimeException e) { // Log this somehow System.err.println("Exception thrown while trying to invoke event listener, removing bed behaved listener."); e.printStackTrace(); removeTransformerSinkEventListener(listener); } } }
java
protected void onTransformationSinkErrorOccurred(Exception exception) { for (TransformerSinkEventListener listener : transformerSinkEventListeners) fireErrorEvent(listener, new TransformerSinkErrorEvent(this, exception)); } /** * (Re)-fires a preconstructed event. * @param event The event to fire */ protected void onTransformationSinkErrorOccurred(TransformerSinkErrorEvent event) { for (TransformerSinkEventListener listener : transformerSinkEventListeners) fireErrorEvent(listener, event); } /** * Fires the given event on the given listener. * @param listener The listener to fire the event to. * @param event The event to fire. */ private void fireErrorEvent(TransformerSinkEventListener listener, TransformerSinkErrorEvent event) { try { listener.ErrorOccurred(event); } catch (RuntimeException e) { // Log this somehow System.err.println("Exception thrown while trying to invoke event listener, removing bed behaved listener."); e.printStackTrace(); removeTransformerSinkEventListener(listener); } } }
[ "protected", "void", "onTransformationSinkErrorOccurred", "(", "Exception", "exception", ")", "{", "for", "(", "TransformerSinkEventListener", "listener", ":", "transformerSinkEventListeners", ")", "fireErrorEvent", "(", "listener", ",", "new", "TransformerSinkErrorEvent", ...
Called when an exception occurred. Fires the ErrorOccured event. @param exception The exception that was thrown by the TransformationSink.
[ "Called", "when", "an", "exception", "occurred", ".", "Fires", "the", "ErrorOccured", "event", "." ]
train
https://github.com/GeoLatte/geolatte-common/blob/dc7f92b04d8c6cb706e78cb95e746d8f12089d95/src/main/java/org/geolatte/common/transformer/AbstractObservableTransformerSink.java#L68-L102
jingwei/krati
krati-main/src/examples/java/krati/examples/KratiDataStore.java
KratiDataStore.createDataStore
protected DataStore<byte[], byte[]> createDataStore(File homeDir, int initialCapacity) throws Exception { """ Creates a DataStore instance. <p> Subclasses can override this method to provide a specific DataStore implementation such as DynamicDataStore and IndexedDataStore or provide a specific SegmentFactory such as ChannelSegmentFactory, MappedSegmentFactory and WriteBufferSegment. """ StoreConfig config = new StoreConfig(homeDir, initialCapacity); config.setSegmentFactory(new MemorySegmentFactory()); config.setSegmentFileSizeMB(64); return StoreFactory.createStaticDataStore(config); }
java
protected DataStore<byte[], byte[]> createDataStore(File homeDir, int initialCapacity) throws Exception { StoreConfig config = new StoreConfig(homeDir, initialCapacity); config.setSegmentFactory(new MemorySegmentFactory()); config.setSegmentFileSizeMB(64); return StoreFactory.createStaticDataStore(config); }
[ "protected", "DataStore", "<", "byte", "[", "]", ",", "byte", "[", "]", ">", "createDataStore", "(", "File", "homeDir", ",", "int", "initialCapacity", ")", "throws", "Exception", "{", "StoreConfig", "config", "=", "new", "StoreConfig", "(", "homeDir", ",", ...
Creates a DataStore instance. <p> Subclasses can override this method to provide a specific DataStore implementation such as DynamicDataStore and IndexedDataStore or provide a specific SegmentFactory such as ChannelSegmentFactory, MappedSegmentFactory and WriteBufferSegment.
[ "Creates", "a", "DataStore", "instance", ".", "<p", ">", "Subclasses", "can", "override", "this", "method", "to", "provide", "a", "specific", "DataStore", "implementation", "such", "as", "DynamicDataStore", "and", "IndexedDataStore", "or", "provide", "a", "specifi...
train
https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/examples/java/krati/examples/KratiDataStore.java#L65-L71
alkacon/opencms-core
src/org/opencms/gwt/CmsBrokenLinkRenderer.java
CmsBrokenLinkRenderer.addPageInfo
protected void addPageInfo(CmsBrokenLinkBean bean, String extraTitle, String extraPath) { """ Adds optional page information to the broken link bean.<p> @param bean the broken link bean @param extraTitle the optional page title @param extraPath the optional page path """ if (extraTitle != null) { bean.addInfo(messagePageTitle(), "" + extraTitle); } if (extraPath != null) { bean.addInfo(messagePagePath(), "" + extraPath); } }
java
protected void addPageInfo(CmsBrokenLinkBean bean, String extraTitle, String extraPath) { if (extraTitle != null) { bean.addInfo(messagePageTitle(), "" + extraTitle); } if (extraPath != null) { bean.addInfo(messagePagePath(), "" + extraPath); } }
[ "protected", "void", "addPageInfo", "(", "CmsBrokenLinkBean", "bean", ",", "String", "extraTitle", ",", "String", "extraPath", ")", "{", "if", "(", "extraTitle", "!=", "null", ")", "{", "bean", ".", "addInfo", "(", "messagePageTitle", "(", ")", ",", "\"\"", ...
Adds optional page information to the broken link bean.<p> @param bean the broken link bean @param extraTitle the optional page title @param extraPath the optional page path
[ "Adds", "optional", "page", "information", "to", "the", "broken", "link", "bean", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/gwt/CmsBrokenLinkRenderer.java#L227-L235
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/FaceListsImpl.java
FaceListsImpl.deleteFace
public void deleteFace(String faceListId, UUID persistedFaceId) { """ Delete an existing face from a face list (given by a persisitedFaceId and a faceListId). Persisted image related to the face will also be deleted. @param faceListId Id referencing a particular face list. @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. @throws IllegalArgumentException thrown if parameters fail the validation @throws APIErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent """ deleteFaceWithServiceResponseAsync(faceListId, persistedFaceId).toBlocking().single().body(); }
java
public void deleteFace(String faceListId, UUID persistedFaceId) { deleteFaceWithServiceResponseAsync(faceListId, persistedFaceId).toBlocking().single().body(); }
[ "public", "void", "deleteFace", "(", "String", "faceListId", ",", "UUID", "persistedFaceId", ")", "{", "deleteFaceWithServiceResponseAsync", "(", "faceListId", ",", "persistedFaceId", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ...
Delete an existing face from a face list (given by a persisitedFaceId and a faceListId). Persisted image related to the face will also be deleted. @param faceListId Id referencing a particular face list. @param persistedFaceId Id referencing a particular persistedFaceId of an existing face. @throws IllegalArgumentException thrown if parameters fail the validation @throws APIErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
[ "Delete", "an", "existing", "face", "from", "a", "face", "list", "(", "given", "by", "a", "persisitedFaceId", "and", "a", "faceListId", ")", ".", "Persisted", "image", "related", "to", "the", "face", "will", "also", "be", "deleted", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/FaceListsImpl.java#L665-L667
rhuss/jolokia
agent/core/src/main/java/org/jolokia/util/NetworkUtil.java
NetworkUtil.useInetAddress
private static boolean useInetAddress(NetworkInterface networkInterface, InetAddress interfaceAddress) { """ Only use the given interface on the given network interface if it is up and supports multicast """ return checkMethod(networkInterface, isUp) && checkMethod(networkInterface, supportsMulticast) && // TODO: IpV6 support !(interfaceAddress instanceof Inet6Address) && !interfaceAddress.isLoopbackAddress(); }
java
private static boolean useInetAddress(NetworkInterface networkInterface, InetAddress interfaceAddress) { return checkMethod(networkInterface, isUp) && checkMethod(networkInterface, supportsMulticast) && // TODO: IpV6 support !(interfaceAddress instanceof Inet6Address) && !interfaceAddress.isLoopbackAddress(); }
[ "private", "static", "boolean", "useInetAddress", "(", "NetworkInterface", "networkInterface", ",", "InetAddress", "interfaceAddress", ")", "{", "return", "checkMethod", "(", "networkInterface", ",", "isUp", ")", "&&", "checkMethod", "(", "networkInterface", ",", "sup...
Only use the given interface on the given network interface if it is up and supports multicast
[ "Only", "use", "the", "given", "interface", "on", "the", "given", "network", "interface", "if", "it", "is", "up", "and", "supports", "multicast" ]
train
https://github.com/rhuss/jolokia/blob/dc95e7bef859b1829776c5a84c8f7738f5d7d9c3/agent/core/src/main/java/org/jolokia/util/NetworkUtil.java#L212-L218
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/QueryRecord.java
QueryRecord.setGridFile
public int setGridFile(Record record, int iKeyNo) { """ Mark the main grid file and key order.<p> Included as a utility for backward compatibility (Use SetupKeys now). Basically, this method clones the key area for this record. @param record The record in my list to get the key area from. @param iKeyNo The key area in the record to retrieve. @param The index of this key area. """ String keyAreaName = null; if (iKeyNo != -1) keyAreaName = record.getKeyArea(iKeyNo).getKeyName(); return this.setGridFile(record, keyAreaName); }
java
public int setGridFile(Record record, int iKeyNo) { String keyAreaName = null; if (iKeyNo != -1) keyAreaName = record.getKeyArea(iKeyNo).getKeyName(); return this.setGridFile(record, keyAreaName); }
[ "public", "int", "setGridFile", "(", "Record", "record", ",", "int", "iKeyNo", ")", "{", "String", "keyAreaName", "=", "null", ";", "if", "(", "iKeyNo", "!=", "-", "1", ")", "keyAreaName", "=", "record", ".", "getKeyArea", "(", "iKeyNo", ")", ".", "get...
Mark the main grid file and key order.<p> Included as a utility for backward compatibility (Use SetupKeys now). Basically, this method clones the key area for this record. @param record The record in my list to get the key area from. @param iKeyNo The key area in the record to retrieve. @param The index of this key area.
[ "Mark", "the", "main", "grid", "file", "and", "key", "order", ".", "<p", ">", "Included", "as", "a", "utility", "for", "backward", "compatibility", "(", "Use", "SetupKeys", "now", ")", ".", "Basically", "this", "method", "clones", "the", "key", "area", "...
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/QueryRecord.java#L519-L525
podio/podio-java
src/main/java/com/podio/stream/StreamAPI.java
StreamAPI.getGlobalStream
public List<StreamObject> getGlobalStream(Integer limit, Integer offset, DateTime dateFrom, DateTime dateTo) { """ Returns the global stream. This includes items and statuses with comments, ratings, files and edits. @param limit How many objects should be returned, defaults to 10 @param offset How far should the objects be offset, defaults to 0 @param dateFrom The date and time that all events should be after, defaults to no limit @param dateTo The date and time that all events should be before, defaults to no limit @return The list of stream objects """ return getStream("/stream/", limit, offset, dateFrom, dateTo); }
java
public List<StreamObject> getGlobalStream(Integer limit, Integer offset, DateTime dateFrom, DateTime dateTo) { return getStream("/stream/", limit, offset, dateFrom, dateTo); }
[ "public", "List", "<", "StreamObject", ">", "getGlobalStream", "(", "Integer", "limit", ",", "Integer", "offset", ",", "DateTime", "dateFrom", ",", "DateTime", "dateTo", ")", "{", "return", "getStream", "(", "\"/stream/\"", ",", "limit", ",", "offset", ",", ...
Returns the global stream. This includes items and statuses with comments, ratings, files and edits. @param limit How many objects should be returned, defaults to 10 @param offset How far should the objects be offset, defaults to 0 @param dateFrom The date and time that all events should be after, defaults to no limit @param dateTo The date and time that all events should be before, defaults to no limit @return The list of stream objects
[ "Returns", "the", "global", "stream", ".", "This", "includes", "items", "and", "statuses", "with", "comments", "ratings", "files", "and", "edits", "." ]
train
https://github.com/podio/podio-java/blob/a520b23bac118c957ce02cdd8ff42a6c7d17b49a/src/main/java/com/podio/stream/StreamAPI.java#L70-L73
tvesalainen/bcc
src/main/java/org/vesalainen/bcc/ClassFile.java
ClassFile.getFieldIndex
int getFieldIndex(TypeElement declaringClass, String name, String descriptor) { """ Returns the constant map index to field @param declaringClass @param name @param descriptor @return """ String fullyQualifiedForm = declaringClass.getQualifiedName().toString(); return getRefIndex(Fieldref.class, fullyQualifiedForm, name, descriptor); }
java
int getFieldIndex(TypeElement declaringClass, String name, String descriptor) { String fullyQualifiedForm = declaringClass.getQualifiedName().toString(); return getRefIndex(Fieldref.class, fullyQualifiedForm, name, descriptor); }
[ "int", "getFieldIndex", "(", "TypeElement", "declaringClass", ",", "String", "name", ",", "String", "descriptor", ")", "{", "String", "fullyQualifiedForm", "=", "declaringClass", ".", "getQualifiedName", "(", ")", ".", "toString", "(", ")", ";", "return", "getRe...
Returns the constant map index to field @param declaringClass @param name @param descriptor @return
[ "Returns", "the", "constant", "map", "index", "to", "field" ]
train
https://github.com/tvesalainen/bcc/blob/4e84e313018d487f1a8cca3952d71bc21e77d16b/src/main/java/org/vesalainen/bcc/ClassFile.java#L224-L228
astrapi69/jaulp-wicket
jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/url/WicketUrlExtensions.java
WicketUrlExtensions.getPageUrl
public static Url getPageUrl(final Page page, final PageParameters parameters) { """ Gets the page url. @param page the page @param parameters the parameters @return the page url """ return getPageUrl(page.getPageClass(), parameters); }
java
public static Url getPageUrl(final Page page, final PageParameters parameters) { return getPageUrl(page.getPageClass(), parameters); }
[ "public", "static", "Url", "getPageUrl", "(", "final", "Page", "page", ",", "final", "PageParameters", "parameters", ")", "{", "return", "getPageUrl", "(", "page", ".", "getPageClass", "(", ")", ",", "parameters", ")", ";", "}" ]
Gets the page url. @param page the page @param parameters the parameters @return the page url
[ "Gets", "the", "page", "url", "." ]
train
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/url/WicketUrlExtensions.java#L308-L311
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/SheetResourcesImpl.java
SheetResourcesImpl.getSheet
public Sheet getSheet(long id, EnumSet<SheetInclusion> includes, EnumSet<ObjectExclusion> excludes, Set<Long> rowIds, Set<Integer> rowNumbers, Set<Long> columnIds, Integer pageSize, Integer page) throws SmartsheetException { """ Get a sheet. It mirrors to the following Smartsheet REST API method: GET /sheet/{id} Exceptions: - InvalidRequestException : if there is any problem with the REST API request - AuthorizationException : if there is any problem with the REST API authorization(access token) - ResourceNotFoundException : if the resource can not be found - ServiceUnavailableException : if the REST API service is not available (possibly due to rate limiting) - SmartsheetRestException : if there is any other REST API related error occurred during the operation - SmartsheetException : if there is any other error occurred during the operation @param id the id @param includes used to specify the optional objects to include, currently DISCUSSIONS and ATTACHMENTS are supported. @param columnIds the column ids @param excludes the exclude parameters @param page the page number @param pageSize the page size @param rowIds the row ids @param rowNumbers the row numbers @return the resource (note that if there is no such resource, this method will throw ResourceNotFoundException rather than returning null). @throws SmartsheetException the smartsheet exception """ return this.getSheet(id, includes, excludes, rowIds, rowNumbers, columnIds, pageSize, page, null, null); }
java
public Sheet getSheet(long id, EnumSet<SheetInclusion> includes, EnumSet<ObjectExclusion> excludes, Set<Long> rowIds, Set<Integer> rowNumbers, Set<Long> columnIds, Integer pageSize, Integer page) throws SmartsheetException { return this.getSheet(id, includes, excludes, rowIds, rowNumbers, columnIds, pageSize, page, null, null); }
[ "public", "Sheet", "getSheet", "(", "long", "id", ",", "EnumSet", "<", "SheetInclusion", ">", "includes", ",", "EnumSet", "<", "ObjectExclusion", ">", "excludes", ",", "Set", "<", "Long", ">", "rowIds", ",", "Set", "<", "Integer", ">", "rowNumbers", ",", ...
Get a sheet. It mirrors to the following Smartsheet REST API method: GET /sheet/{id} Exceptions: - InvalidRequestException : if there is any problem with the REST API request - AuthorizationException : if there is any problem with the REST API authorization(access token) - ResourceNotFoundException : if the resource can not be found - ServiceUnavailableException : if the REST API service is not available (possibly due to rate limiting) - SmartsheetRestException : if there is any other REST API related error occurred during the operation - SmartsheetException : if there is any other error occurred during the operation @param id the id @param includes used to specify the optional objects to include, currently DISCUSSIONS and ATTACHMENTS are supported. @param columnIds the column ids @param excludes the exclude parameters @param page the page number @param pageSize the page size @param rowIds the row ids @param rowNumbers the row numbers @return the resource (note that if there is no such resource, this method will throw ResourceNotFoundException rather than returning null). @throws SmartsheetException the smartsheet exception
[ "Get", "a", "sheet", "." ]
train
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/SheetResourcesImpl.java#L226-L228
lucee/Lucee
core/src/main/java/lucee/commons/lang/StringUtil.java
StringUtil.escapeJS
public static String escapeJS(String str, char quotesUsed) { """ escapes JS sensitive characters @param str String to escape @return escapes String """ return escapeJS(str, quotesUsed, (CharsetEncoder) null); }
java
public static String escapeJS(String str, char quotesUsed) { return escapeJS(str, quotesUsed, (CharsetEncoder) null); }
[ "public", "static", "String", "escapeJS", "(", "String", "str", ",", "char", "quotesUsed", ")", "{", "return", "escapeJS", "(", "str", ",", "quotesUsed", ",", "(", "CharsetEncoder", ")", "null", ")", ";", "}" ]
escapes JS sensitive characters @param str String to escape @return escapes String
[ "escapes", "JS", "sensitive", "characters" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/lang/StringUtil.java#L153-L155
b3dgs/lionengine
lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/collision/MapTileCollisionLoader.java
MapTileCollisionLoader.checkConstraint
private boolean checkConstraint(Collection<String> constraints, Tile tile) { """ Check the constraint with the specified tile. @param constraints The constraint groups to check. @param tile The tile to check with. @return <code>true</code> if can be ignored, <code>false</code> else. """ return tile != null && constraints.contains(mapGroup.getGroup(tile)) && !tile.getFeature(TileCollision.class).getCollisionFormulas().isEmpty(); }
java
private boolean checkConstraint(Collection<String> constraints, Tile tile) { return tile != null && constraints.contains(mapGroup.getGroup(tile)) && !tile.getFeature(TileCollision.class).getCollisionFormulas().isEmpty(); }
[ "private", "boolean", "checkConstraint", "(", "Collection", "<", "String", ">", "constraints", ",", "Tile", "tile", ")", "{", "return", "tile", "!=", "null", "&&", "constraints", ".", "contains", "(", "mapGroup", ".", "getGroup", "(", "tile", ")", ")", "&&...
Check the constraint with the specified tile. @param constraints The constraint groups to check. @param tile The tile to check with. @return <code>true</code> if can be ignored, <code>false</code> else.
[ "Check", "the", "constraint", "with", "the", "specified", "tile", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/collision/MapTileCollisionLoader.java#L369-L374
prolificinteractive/material-calendarview
library/src/main/java/com/prolificinteractive/materialcalendarview/CalendarPagerAdapter.java
CalendarPagerAdapter.setDateSelected
public void setDateSelected(CalendarDay day, boolean selected) { """ Select or un-select a day. @param day Day to select or un-select @param selected Whether to select or un-select the day from the list. @see CalendarPagerAdapter#selectRange(CalendarDay, CalendarDay) """ if (selected) { if (!selectedDates.contains(day)) { selectedDates.add(day); invalidateSelectedDates(); } } else { if (selectedDates.contains(day)) { selectedDates.remove(day); invalidateSelectedDates(); } } }
java
public void setDateSelected(CalendarDay day, boolean selected) { if (selected) { if (!selectedDates.contains(day)) { selectedDates.add(day); invalidateSelectedDates(); } } else { if (selectedDates.contains(day)) { selectedDates.remove(day); invalidateSelectedDates(); } } }
[ "public", "void", "setDateSelected", "(", "CalendarDay", "day", ",", "boolean", "selected", ")", "{", "if", "(", "selected", ")", "{", "if", "(", "!", "selectedDates", ".", "contains", "(", "day", ")", ")", "{", "selectedDates", ".", "add", "(", "day", ...
Select or un-select a day. @param day Day to select or un-select @param selected Whether to select or un-select the day from the list. @see CalendarPagerAdapter#selectRange(CalendarDay, CalendarDay)
[ "Select", "or", "un", "-", "select", "a", "day", "." ]
train
https://github.com/prolificinteractive/material-calendarview/blob/04fae8175fd034d0a7131f8cb253cae883a88aa2/library/src/main/java/com/prolificinteractive/materialcalendarview/CalendarPagerAdapter.java#L303-L315
bbottema/simple-java-mail
modules/core-module/src/main/java/org/simplejavamail/config/ConfigLoader.java
ConfigLoader.valueOrProperty
@Nullable private static <T> T valueOrProperty(@Nullable final T value, @Nonnull final Property property, @Nullable final T defaultValue) { """ Returns the given value if not null and not empty, otherwise tries to resolve the given property and if still not found resort to the default value if provided. <p> Null or blank values are never allowed, so they are always ignored. @return The value if not null or else the value from config file if provided or else <code>defaultValue</code>. """ if (!valueNullOrEmpty(value)) { LOGGER.trace("using provided argument value {} for property {}", value, property); return value; } else if (hasProperty(property)) { final T propertyValue = getProperty(property); LOGGER.trace("using value {} from config file for property {}", propertyValue, property); return propertyValue; } else { LOGGER.trace("no value provided as argument or in config file for property {}, using default value {}", property, defaultValue); return defaultValue; } }
java
@Nullable private static <T> T valueOrProperty(@Nullable final T value, @Nonnull final Property property, @Nullable final T defaultValue) { if (!valueNullOrEmpty(value)) { LOGGER.trace("using provided argument value {} for property {}", value, property); return value; } else if (hasProperty(property)) { final T propertyValue = getProperty(property); LOGGER.trace("using value {} from config file for property {}", propertyValue, property); return propertyValue; } else { LOGGER.trace("no value provided as argument or in config file for property {}, using default value {}", property, defaultValue); return defaultValue; } }
[ "@", "Nullable", "private", "static", "<", "T", ">", "T", "valueOrProperty", "(", "@", "Nullable", "final", "T", "value", ",", "@", "Nonnull", "final", "Property", "property", ",", "@", "Nullable", "final", "T", "defaultValue", ")", "{", "if", "(", "!", ...
Returns the given value if not null and not empty, otherwise tries to resolve the given property and if still not found resort to the default value if provided. <p> Null or blank values are never allowed, so they are always ignored. @return The value if not null or else the value from config file if provided or else <code>defaultValue</code>.
[ "Returns", "the", "given", "value", "if", "not", "null", "and", "not", "empty", "otherwise", "tries", "to", "resolve", "the", "given", "property", "and", "if", "still", "not", "found", "resort", "to", "the", "default", "value", "if", "provided", ".", "<p",...
train
https://github.com/bbottema/simple-java-mail/blob/b03635328aeecd525e35eddfef8f5b9a184559d8/modules/core-module/src/main/java/org/simplejavamail/config/ConfigLoader.java#L171-L184
code4everything/util
src/main/java/com/zhazhapan/util/dialog/Alerts.java
Alerts.showError
public static Optional<ButtonType> showError(String title, String header, String content) { """ 弹出错误框 @param title 标题 @param header 信息头 @param content 内容 @return {@link ButtonType} """ return alert(title, header, content, AlertType.ERROR); }
java
public static Optional<ButtonType> showError(String title, String header, String content) { return alert(title, header, content, AlertType.ERROR); }
[ "public", "static", "Optional", "<", "ButtonType", ">", "showError", "(", "String", "title", ",", "String", "header", ",", "String", "content", ")", "{", "return", "alert", "(", "title", ",", "header", ",", "content", ",", "AlertType", ".", "ERROR", ")", ...
弹出错误框 @param title 标题 @param header 信息头 @param content 内容 @return {@link ButtonType}
[ "弹出错误框" ]
train
https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/dialog/Alerts.java#L95-L97
threerings/nenya
core/src/main/java/com/threerings/media/tile/TileManager.java
TileManager.getTile
public Tile getTile (int tileSetId, int tileIndex, TileSet.Colorizer rizer) throws NoSuchTileSetException { """ Returns the {@link Tile} object from the specified tileset at the specified index. @param tileSetId the tileset id. @param tileIndex the index of the tile to be retrieved. @return the tile object. """ TileSet set = getTileSet(tileSetId); return set.getTile(tileIndex, rizer); }
java
public Tile getTile (int tileSetId, int tileIndex, TileSet.Colorizer rizer) throws NoSuchTileSetException { TileSet set = getTileSet(tileSetId); return set.getTile(tileIndex, rizer); }
[ "public", "Tile", "getTile", "(", "int", "tileSetId", ",", "int", "tileIndex", ",", "TileSet", ".", "Colorizer", "rizer", ")", "throws", "NoSuchTileSetException", "{", "TileSet", "set", "=", "getTileSet", "(", "tileSetId", ")", ";", "return", "set", ".", "ge...
Returns the {@link Tile} object from the specified tileset at the specified index. @param tileSetId the tileset id. @param tileIndex the index of the tile to be retrieved. @return the tile object.
[ "Returns", "the", "{", "@link", "Tile", "}", "object", "from", "the", "specified", "tileset", "at", "the", "specified", "index", "." ]
train
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/tile/TileManager.java#L219-L224
BlueBrain/bluima
modules/bluima_opennlp/src/main/java/ch/epfl/bbp/shaded/opennlp/maxent/io/SuffixSensitiveGISModelReader.java
SuffixSensitiveGISModelReader.main
public static void main(String[] args) throws IOException { """ To convert between different formats of the new style. <p>java opennlp.maxent.io.SuffixSensitiveGISModelReader old_model_name new_model_name <p>For example, to convert a model called "model.bin.gz" (which is thus saved in gzipped binary format) to one in (unzipped) text format: <p>java opennlp.maxent.io.SuffixSensitiveGISModelReader model.bin.gz model.txt <p>This particular example would of course be useful when you generally want to create models which take up less space (.bin.gz), but want to be able to inspect a few of them as plain text files. """ ch.epfl.bbp.shaded.opennlp.maxent.GISModel m = new SuffixSensitiveGISModelReader(new File(args[0])).getModel(); new SuffixSensitiveGISModelWriter(m, new File(args[1])).persist(); }
java
public static void main(String[] args) throws IOException { ch.epfl.bbp.shaded.opennlp.maxent.GISModel m = new SuffixSensitiveGISModelReader(new File(args[0])).getModel(); new SuffixSensitiveGISModelWriter(m, new File(args[1])).persist(); }
[ "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "throws", "IOException", "{", "ch", ".", "epfl", ".", "bbp", ".", "shaded", ".", "opennlp", ".", "maxent", ".", "GISModel", "m", "=", "new", "SuffixSensitiveGISModelReader", "(", "...
To convert between different formats of the new style. <p>java opennlp.maxent.io.SuffixSensitiveGISModelReader old_model_name new_model_name <p>For example, to convert a model called "model.bin.gz" (which is thus saved in gzipped binary format) to one in (unzipped) text format: <p>java opennlp.maxent.io.SuffixSensitiveGISModelReader model.bin.gz model.txt <p>This particular example would of course be useful when you generally want to create models which take up less space (.bin.gz), but want to be able to inspect a few of them as plain text files.
[ "To", "convert", "between", "different", "formats", "of", "the", "new", "style", "." ]
train
https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_opennlp/src/main/java/ch/epfl/bbp/shaded/opennlp/maxent/io/SuffixSensitiveGISModelReader.java#L111-L115
lucee/Lucee
core/src/main/java/lucee/runtime/PageSourceImpl.java
PageSourceImpl.isTemplate
public static boolean isTemplate(PageContext pc, PageSource ps, boolean defaultValue) { """ return if the PageSource represent a template (no component,no interface) @param pc @param ps @return @throws PageException """ try { return !(ps.loadPage(pc, false) instanceof CIPage); } catch (PageException e) { SystemOut.printDate(e); return defaultValue; } }
java
public static boolean isTemplate(PageContext pc, PageSource ps, boolean defaultValue) { try { return !(ps.loadPage(pc, false) instanceof CIPage); } catch (PageException e) { SystemOut.printDate(e); return defaultValue; } }
[ "public", "static", "boolean", "isTemplate", "(", "PageContext", "pc", ",", "PageSource", "ps", ",", "boolean", "defaultValue", ")", "{", "try", "{", "return", "!", "(", "ps", ".", "loadPage", "(", "pc", ",", "false", ")", "instanceof", "CIPage", ")", ";...
return if the PageSource represent a template (no component,no interface) @param pc @param ps @return @throws PageException
[ "return", "if", "the", "PageSource", "represent", "a", "template", "(", "no", "component", "no", "interface", ")" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/PageSourceImpl.java#L994-L1002
ralscha/extclassgenerator
src/main/java/ch/rasc/extclassgenerator/ModelGenerator.java
ModelGenerator.generateJavascript
public static String generateJavascript(Class<?> clazz, OutputFormat format, boolean debug) { """ Instrospects the provided class, creates a model object (JS code) and returns it. This method does not add any validation configuration. @param clazz class that the generator should introspect @param format specifies which code (ExtJS or Touch) the generator should create @param debug if true the generator creates the output in pretty format, false the output is compressed @return the generated model object (JS code) """ OutputConfig outputConfig = new OutputConfig(); outputConfig.setIncludeValidation(IncludeValidation.NONE); outputConfig.setOutputFormat(format); outputConfig.setDebug(debug); ModelBean model = createModel(clazz, outputConfig); return generateJavascript(model, outputConfig); }
java
public static String generateJavascript(Class<?> clazz, OutputFormat format, boolean debug) { OutputConfig outputConfig = new OutputConfig(); outputConfig.setIncludeValidation(IncludeValidation.NONE); outputConfig.setOutputFormat(format); outputConfig.setDebug(debug); ModelBean model = createModel(clazz, outputConfig); return generateJavascript(model, outputConfig); }
[ "public", "static", "String", "generateJavascript", "(", "Class", "<", "?", ">", "clazz", ",", "OutputFormat", "format", ",", "boolean", "debug", ")", "{", "OutputConfig", "outputConfig", "=", "new", "OutputConfig", "(", ")", ";", "outputConfig", ".", "setIncl...
Instrospects the provided class, creates a model object (JS code) and returns it. This method does not add any validation configuration. @param clazz class that the generator should introspect @param format specifies which code (ExtJS or Touch) the generator should create @param debug if true the generator creates the output in pretty format, false the output is compressed @return the generated model object (JS code)
[ "Instrospects", "the", "provided", "class", "creates", "a", "model", "object", "(", "JS", "code", ")", "and", "returns", "it", ".", "This", "method", "does", "not", "add", "any", "validation", "configuration", "." ]
train
https://github.com/ralscha/extclassgenerator/blob/6f106cf5ca83ef004225a3512e2291dfd028cf07/src/main/java/ch/rasc/extclassgenerator/ModelGenerator.java#L229-L238
datumbox/datumbox-framework
datumbox-framework-core/src/main/java/com/datumbox/framework/core/machinelearning/common/abstracts/algorithms/AbstractDPMM.java
AbstractDPMM.getFromClusterMap
private CL getFromClusterMap(int clusterId, Map<Integer, CL> clusterMap) { """ Always use this method to get the cluster from the clusterMap because it ensures that the featureIds are set. The featureIds can be unset if we use a data structure which stores stuff in file. Since the featureIds field of cluster is transient, the information gets lost. This function ensures that it sets it back. @param clusterId @param clusterMap @return """ CL c = clusterMap.get(clusterId); if(c.getFeatureIds() == null) { c.setFeatureIds(knowledgeBase.getModelParameters().getFeatureIds()); //fetch the featureIds from model parameters object } return c; }
java
private CL getFromClusterMap(int clusterId, Map<Integer, CL> clusterMap) { CL c = clusterMap.get(clusterId); if(c.getFeatureIds() == null) { c.setFeatureIds(knowledgeBase.getModelParameters().getFeatureIds()); //fetch the featureIds from model parameters object } return c; }
[ "private", "CL", "getFromClusterMap", "(", "int", "clusterId", ",", "Map", "<", "Integer", ",", "CL", ">", "clusterMap", ")", "{", "CL", "c", "=", "clusterMap", ".", "get", "(", "clusterId", ")", ";", "if", "(", "c", ".", "getFeatureIds", "(", ")", "...
Always use this method to get the cluster from the clusterMap because it ensures that the featureIds are set. The featureIds can be unset if we use a data structure which stores stuff in file. Since the featureIds field of cluster is transient, the information gets lost. This function ensures that it sets it back. @param clusterId @param clusterMap @return
[ "Always", "use", "this", "method", "to", "get", "the", "cluster", "from", "the", "clusterMap", "because", "it", "ensures", "that", "the", "featureIds", "are", "set", ".", "The", "featureIds", "can", "be", "unset", "if", "we", "use", "a", "data", "structure...
train
https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/machinelearning/common/abstracts/algorithms/AbstractDPMM.java#L373-L379
jmeter-maven-plugin/jmeter-maven-plugin
src/main/java/com/lazerycode/jmeter/properties/PropertiesFile.java
PropertiesFile.warnUserOfPossibleErrors
private void warnUserOfPossibleErrors(String newKey, Properties baseProperties) { """ Print a warning out to the user to highlight potential typos in the properties they have set. @param newKey Property Value @param baseProperties Properties """ for (String key : baseProperties.stringPropertyNames()) { if (!key.equals(newKey) && key.equalsIgnoreCase(newKey)) { LOGGER.warn("You have set a property called '{}' which is very similar to '{}'!", newKey, key); } } }
java
private void warnUserOfPossibleErrors(String newKey, Properties baseProperties) { for (String key : baseProperties.stringPropertyNames()) { if (!key.equals(newKey) && key.equalsIgnoreCase(newKey)) { LOGGER.warn("You have set a property called '{}' which is very similar to '{}'!", newKey, key); } } }
[ "private", "void", "warnUserOfPossibleErrors", "(", "String", "newKey", ",", "Properties", "baseProperties", ")", "{", "for", "(", "String", "key", ":", "baseProperties", ".", "stringPropertyNames", "(", ")", ")", "{", "if", "(", "!", "key", ".", "equals", "...
Print a warning out to the user to highlight potential typos in the properties they have set. @param newKey Property Value @param baseProperties Properties
[ "Print", "a", "warning", "out", "to", "the", "user", "to", "highlight", "potential", "typos", "in", "the", "properties", "they", "have", "set", "." ]
train
https://github.com/jmeter-maven-plugin/jmeter-maven-plugin/blob/63dc8b49cc6b9542deb681e25a2ada6025ddbf6b/src/main/java/com/lazerycode/jmeter/properties/PropertiesFile.java#L136-L143
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateFormat.java
DateFormat.getDateTimeInstance
static final public DateFormat getDateTimeInstance(Calendar cal, int dateStyle, int timeStyle, ULocale locale) { """ Creates a {@link DateFormat} object that can be used to format dates and times in the calendar system specified by <code>cal</code>. @param cal The calendar system for which a date/time format is desired. @param dateStyle The type of date format desired. This can be {@link DateFormat#SHORT}, {@link DateFormat#MEDIUM}, etc. @param timeStyle The type of time format desired. This can be {@link DateFormat#SHORT}, {@link DateFormat#MEDIUM}, etc. @param locale The locale for which the date/time format is desired. @see DateFormat#getDateTimeInstance """ if (cal == null) { throw new IllegalArgumentException("Calendar must be supplied"); } return get(dateStyle, timeStyle, locale, cal); }
java
static final public DateFormat getDateTimeInstance(Calendar cal, int dateStyle, int timeStyle, ULocale locale) { if (cal == null) { throw new IllegalArgumentException("Calendar must be supplied"); } return get(dateStyle, timeStyle, locale, cal); }
[ "static", "final", "public", "DateFormat", "getDateTimeInstance", "(", "Calendar", "cal", ",", "int", "dateStyle", ",", "int", "timeStyle", ",", "ULocale", "locale", ")", "{", "if", "(", "cal", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException"...
Creates a {@link DateFormat} object that can be used to format dates and times in the calendar system specified by <code>cal</code>. @param cal The calendar system for which a date/time format is desired. @param dateStyle The type of date format desired. This can be {@link DateFormat#SHORT}, {@link DateFormat#MEDIUM}, etc. @param timeStyle The type of time format desired. This can be {@link DateFormat#SHORT}, {@link DateFormat#MEDIUM}, etc. @param locale The locale for which the date/time format is desired. @see DateFormat#getDateTimeInstance
[ "Creates", "a", "{", "@link", "DateFormat", "}", "object", "that", "can", "be", "used", "to", "format", "dates", "and", "times", "in", "the", "calendar", "system", "specified", "by", "<code", ">", "cal<", "/", "code", ">", ".", "@param", "cal", "The", ...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateFormat.java#L1851-L1858
lucee/Lucee
core/src/main/java/lucee/runtime/op/Caster.java
Caster.toNodeList
public static NodeList toNodeList(Object o, NodeList defaultValue) { """ casts a Object to a Node List @param o Object to Cast @param defaultValue @return NodeList from Object """ // print.ln("nodeList:"+o); if (o instanceof NodeList) { return (NodeList) o; } else if (o instanceof ObjectWrap) { return toNodeList(((ObjectWrap) o).getEmbededObject(defaultValue), defaultValue); } return defaultValue; }
java
public static NodeList toNodeList(Object o, NodeList defaultValue) { // print.ln("nodeList:"+o); if (o instanceof NodeList) { return (NodeList) o; } else if (o instanceof ObjectWrap) { return toNodeList(((ObjectWrap) o).getEmbededObject(defaultValue), defaultValue); } return defaultValue; }
[ "public", "static", "NodeList", "toNodeList", "(", "Object", "o", ",", "NodeList", "defaultValue", ")", "{", "// print.ln(\"nodeList:\"+o);", "if", "(", "o", "instanceof", "NodeList", ")", "{", "return", "(", "NodeList", ")", "o", ";", "}", "else", "if", "("...
casts a Object to a Node List @param o Object to Cast @param defaultValue @return NodeList from Object
[ "casts", "a", "Object", "to", "a", "Node", "List" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/op/Caster.java#L4289-L4298
iig-uni-freiburg/SEWOL
src/de/uni/freiburg/iig/telematik/sewol/context/constraint/ConstraintContext.java
ConstraintContext.removeRoutingConstraintsOnAttribute
private void removeRoutingConstraintsOnAttribute(String attribute, boolean notifyListeners) { """ Removes all routing constraints that relate to the given attribute @param attribute @param notifyListeners """ for (String activity : activities) { removeRoutingConstraintsOnAttribute(activity, attribute, notifyListeners); } }
java
private void removeRoutingConstraintsOnAttribute(String attribute, boolean notifyListeners) { for (String activity : activities) { removeRoutingConstraintsOnAttribute(activity, attribute, notifyListeners); } }
[ "private", "void", "removeRoutingConstraintsOnAttribute", "(", "String", "attribute", ",", "boolean", "notifyListeners", ")", "{", "for", "(", "String", "activity", ":", "activities", ")", "{", "removeRoutingConstraintsOnAttribute", "(", "activity", ",", "attribute", ...
Removes all routing constraints that relate to the given attribute @param attribute @param notifyListeners
[ "Removes", "all", "routing", "constraints", "that", "relate", "to", "the", "given", "attribute" ]
train
https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/src/de/uni/freiburg/iig/telematik/sewol/context/constraint/ConstraintContext.java#L152-L156
jcuda/jcudnn
JCudnnJava/src/main/java/jcuda/jcudnn/JCudnn.java
JCudnn.cudnnSetRNNDescriptor_v6
public static int cudnnSetRNNDescriptor_v6( cudnnHandle handle, cudnnRNNDescriptor rnnDesc, int hiddenSize, int numLayers, cudnnDropoutDescriptor dropoutDesc, int inputMode, int direction, int mode, int algo, int dataType) { """ <pre> DEPRECATED routines to be removed next release : User should use the non-suffixed version (which has the API and functionality of _v6 version) Routines with _v5 suffix has the functionality of the non-suffixed routines in the CUDNN V6 </pre> """ return checkResult(cudnnSetRNNDescriptor_v6Native(handle, rnnDesc, hiddenSize, numLayers, dropoutDesc, inputMode, direction, mode, algo, dataType)); }
java
public static int cudnnSetRNNDescriptor_v6( cudnnHandle handle, cudnnRNNDescriptor rnnDesc, int hiddenSize, int numLayers, cudnnDropoutDescriptor dropoutDesc, int inputMode, int direction, int mode, int algo, int dataType) { return checkResult(cudnnSetRNNDescriptor_v6Native(handle, rnnDesc, hiddenSize, numLayers, dropoutDesc, inputMode, direction, mode, algo, dataType)); }
[ "public", "static", "int", "cudnnSetRNNDescriptor_v6", "(", "cudnnHandle", "handle", ",", "cudnnRNNDescriptor", "rnnDesc", ",", "int", "hiddenSize", ",", "int", "numLayers", ",", "cudnnDropoutDescriptor", "dropoutDesc", ",", "int", "inputMode", ",", "int", "direction"...
<pre> DEPRECATED routines to be removed next release : User should use the non-suffixed version (which has the API and functionality of _v6 version) Routines with _v5 suffix has the functionality of the non-suffixed routines in the CUDNN V6 </pre>
[ "<pre", ">", "DEPRECATED", "routines", "to", "be", "removed", "next", "release", ":", "User", "should", "use", "the", "non", "-", "suffixed", "version", "(", "which", "has", "the", "API", "and", "functionality", "of", "_v6", "version", ")", "Routines", "wi...
train
https://github.com/jcuda/jcudnn/blob/ce71f2fc02817cecace51a80e6db5f0c7f10cffc/JCudnnJava/src/main/java/jcuda/jcudnn/JCudnn.java#L4273-L4286
aws/aws-sdk-java
aws-java-sdk-iot/src/main/java/com/amazonaws/services/iot/model/CreateOTAUpdateRequest.java
CreateOTAUpdateRequest.withAdditionalParameters
public CreateOTAUpdateRequest withAdditionalParameters(java.util.Map<String, String> additionalParameters) { """ <p> A list of additional OTA update parameters which are name-value pairs. </p> @param additionalParameters A list of additional OTA update parameters which are name-value pairs. @return Returns a reference to this object so that method calls can be chained together. """ setAdditionalParameters(additionalParameters); return this; }
java
public CreateOTAUpdateRequest withAdditionalParameters(java.util.Map<String, String> additionalParameters) { setAdditionalParameters(additionalParameters); return this; }
[ "public", "CreateOTAUpdateRequest", "withAdditionalParameters", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "additionalParameters", ")", "{", "setAdditionalParameters", "(", "additionalParameters", ")", ";", "return", "this", ";", "}" ]
<p> A list of additional OTA update parameters which are name-value pairs. </p> @param additionalParameters A list of additional OTA update parameters which are name-value pairs. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "A", "list", "of", "additional", "OTA", "update", "parameters", "which", "are", "name", "-", "value", "pairs", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-iot/src/main/java/com/amazonaws/services/iot/model/CreateOTAUpdateRequest.java#L508-L511
SeunMatt/mysql-backup4j
src/main/java/com/smattme/MysqlBaseService.java
MysqlBaseService.doConnect
private static Connection doConnect(String driver, String url, String username, String password) throws SQLException, ClassNotFoundException { """ This will attempt to connect to a database using the provided parameters. On success it'll return the java.sql.Connection object @param driver the class name for the mysql driver to use @param url the url of the database @param username database username @param password database password @return Connection @throws SQLException exception @throws ClassNotFoundException exception """ Class.forName(driver); Connection connection = DriverManager.getConnection(url, username, password); logger.debug("DB Connected Successfully"); return connection; }
java
private static Connection doConnect(String driver, String url, String username, String password) throws SQLException, ClassNotFoundException { Class.forName(driver); Connection connection = DriverManager.getConnection(url, username, password); logger.debug("DB Connected Successfully"); return connection; }
[ "private", "static", "Connection", "doConnect", "(", "String", "driver", ",", "String", "url", ",", "String", "username", ",", "String", "password", ")", "throws", "SQLException", ",", "ClassNotFoundException", "{", "Class", ".", "forName", "(", "driver", ")", ...
This will attempt to connect to a database using the provided parameters. On success it'll return the java.sql.Connection object @param driver the class name for the mysql driver to use @param url the url of the database @param username database username @param password database password @return Connection @throws SQLException exception @throws ClassNotFoundException exception
[ "This", "will", "attempt", "to", "connect", "to", "a", "database", "using", "the", "provided", "parameters", ".", "On", "success", "it", "ll", "return", "the", "java", ".", "sql", ".", "Connection", "object" ]
train
https://github.com/SeunMatt/mysql-backup4j/blob/7e31aac33fe63948d4ad64a053394759457da636/src/main/java/com/smattme/MysqlBaseService.java#L70-L75
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/spatial/LineSegment.java
LineSegment.getIntersectionSegments
public Coordinate getIntersectionSegments(LineSegment lineSegment) { """ Return the intersection point of 2 line segments if they intersect in 1 point. @param lineSegment The other LineSegment. @return A {@link Coordinate} representing the intersection point (so on both line segments), null if segments are not intersecting or corresponding lines are coinciding. """ // http://local.wasp.uwa.edu.au/~pbourke/geometry/lineline2d/ double x1 = this.x1(); double y1 = this.y1(); double x2 = this.x2(); double y2 = this.y2(); double x3 = lineSegment.x1(); double y3 = lineSegment.y1(); double x4 = lineSegment.x2(); double y4 = lineSegment.y2(); double denom = (y4 - y3) * (x2 - x1) - (x4 - x3) * (y2 - y1); if (denom == 0) { return null; } double u1 = ((x4 - x3) * (y1 - y3) - (y4 - y3) * (x1 - x3)) / denom; if (u1 <= 0 || u1 >= 1) { return null; } double u2 = ((x2 - x1) * (y1 - y3) - (y2 - y1) * (x1 - x3)) / denom; if (u2 <= 0 || u2 >= 1) { return null; } double x = x1 + u1 * (x2 - x1); double y = y1 + u1 * (y2 - y1); return new Coordinate(x, y); }
java
public Coordinate getIntersectionSegments(LineSegment lineSegment) { // http://local.wasp.uwa.edu.au/~pbourke/geometry/lineline2d/ double x1 = this.x1(); double y1 = this.y1(); double x2 = this.x2(); double y2 = this.y2(); double x3 = lineSegment.x1(); double y3 = lineSegment.y1(); double x4 = lineSegment.x2(); double y4 = lineSegment.y2(); double denom = (y4 - y3) * (x2 - x1) - (x4 - x3) * (y2 - y1); if (denom == 0) { return null; } double u1 = ((x4 - x3) * (y1 - y3) - (y4 - y3) * (x1 - x3)) / denom; if (u1 <= 0 || u1 >= 1) { return null; } double u2 = ((x2 - x1) * (y1 - y3) - (y2 - y1) * (x1 - x3)) / denom; if (u2 <= 0 || u2 >= 1) { return null; } double x = x1 + u1 * (x2 - x1); double y = y1 + u1 * (y2 - y1); return new Coordinate(x, y); }
[ "public", "Coordinate", "getIntersectionSegments", "(", "LineSegment", "lineSegment", ")", "{", "// http://local.wasp.uwa.edu.au/~pbourke/geometry/lineline2d/", "double", "x1", "=", "this", ".", "x1", "(", ")", ";", "double", "y1", "=", "this", ".", "y1", "(", ")", ...
Return the intersection point of 2 line segments if they intersect in 1 point. @param lineSegment The other LineSegment. @return A {@link Coordinate} representing the intersection point (so on both line segments), null if segments are not intersecting or corresponding lines are coinciding.
[ "Return", "the", "intersection", "point", "of", "2", "line", "segments", "if", "they", "intersect", "in", "1", "point", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/spatial/LineSegment.java#L145-L172
OpenLiberty/open-liberty
dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheOnDisk.java
CacheOnDisk.readTemplatesByRange
public ValueSet readTemplatesByRange(int index, int length) { """ Call this method to get the template ids based on the index and the length from the disk. @param index If index = 0, it starts the beginning. If index = 1, it means "next". If Index = -1, it means "previous". @param length The max number of templates to be read. If length = -1, it reads all templates until the end. @return valueSet - the collection of templates. """ Result result = htod.readTemplatesByRange(index, length); if (result.returnCode == HTODDynacache.DISK_EXCEPTION) { stopOnError(result.diskException); this.htod.returnToResultPool(result); return HTODDynacache.EMPTY_VS; } ValueSet valueSet = (ValueSet) result.data; if (valueSet == null) { valueSet = HTODDynacache.EMPTY_VS; } this.htod.returnToResultPool(result); return valueSet; }
java
public ValueSet readTemplatesByRange(int index, int length) { Result result = htod.readTemplatesByRange(index, length); if (result.returnCode == HTODDynacache.DISK_EXCEPTION) { stopOnError(result.diskException); this.htod.returnToResultPool(result); return HTODDynacache.EMPTY_VS; } ValueSet valueSet = (ValueSet) result.data; if (valueSet == null) { valueSet = HTODDynacache.EMPTY_VS; } this.htod.returnToResultPool(result); return valueSet; }
[ "public", "ValueSet", "readTemplatesByRange", "(", "int", "index", ",", "int", "length", ")", "{", "Result", "result", "=", "htod", ".", "readTemplatesByRange", "(", "index", ",", "length", ")", ";", "if", "(", "result", ".", "returnCode", "==", "HTODDynacac...
Call this method to get the template ids based on the index and the length from the disk. @param index If index = 0, it starts the beginning. If index = 1, it means "next". If Index = -1, it means "previous". @param length The max number of templates to be read. If length = -1, it reads all templates until the end. @return valueSet - the collection of templates.
[ "Call", "this", "method", "to", "get", "the", "template", "ids", "based", "on", "the", "index", "and", "the", "length", "from", "the", "disk", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheOnDisk.java#L1409-L1422
DDTH/ddth-commons
ddth-commons-core/src/main/java/com/github/ddth/commons/utils/IdGenerator.java
IdGenerator.waitTillNextTick
public static long waitTillNextTick(long currentTick, long tickSize) { """ Waits till clock moves to the next tick. @param currentTick @param tickSize tick size in milliseconds @return the "next" tick """ long nextBlock = System.currentTimeMillis() / tickSize; for (; nextBlock <= currentTick; nextBlock = System.currentTimeMillis() / tickSize) { Thread.yield(); } return nextBlock; }
java
public static long waitTillNextTick(long currentTick, long tickSize) { long nextBlock = System.currentTimeMillis() / tickSize; for (; nextBlock <= currentTick; nextBlock = System.currentTimeMillis() / tickSize) { Thread.yield(); } return nextBlock; }
[ "public", "static", "long", "waitTillNextTick", "(", "long", "currentTick", ",", "long", "tickSize", ")", "{", "long", "nextBlock", "=", "System", ".", "currentTimeMillis", "(", ")", "/", "tickSize", ";", "for", "(", ";", "nextBlock", "<=", "currentTick", ";...
Waits till clock moves to the next tick. @param currentTick @param tickSize tick size in milliseconds @return the "next" tick
[ "Waits", "till", "clock", "moves", "to", "the", "next", "tick", "." ]
train
https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/utils/IdGenerator.java#L190-L196
apache/flink
flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java
Configuration.getDouble
public double getDouble(String name, double defaultValue) { """ Get the value of the <code>name</code> property as a <code>double</code>. If no such property exists, the provided default value is returned, or if the specified value is not a valid <code>double</code>, then an error is thrown. @param name property name. @param defaultValue default value. @throws NumberFormatException when the value is invalid @return property value as a <code>double</code>, or <code>defaultValue</code>. """ String valueString = getTrimmed(name); if (valueString == null) return defaultValue; return Double.parseDouble(valueString); }
java
public double getDouble(String name, double defaultValue) { String valueString = getTrimmed(name); if (valueString == null) return defaultValue; return Double.parseDouble(valueString); }
[ "public", "double", "getDouble", "(", "String", "name", ",", "double", "defaultValue", ")", "{", "String", "valueString", "=", "getTrimmed", "(", "name", ")", ";", "if", "(", "valueString", "==", "null", ")", "return", "defaultValue", ";", "return", "Double"...
Get the value of the <code>name</code> property as a <code>double</code>. If no such property exists, the provided default value is returned, or if the specified value is not a valid <code>double</code>, then an error is thrown. @param name property name. @param defaultValue default value. @throws NumberFormatException when the value is invalid @return property value as a <code>double</code>, or <code>defaultValue</code>.
[ "Get", "the", "value", "of", "the", "<code", ">", "name<", "/", "code", ">", "property", "as", "a", "<code", ">", "double<", "/", "code", ">", ".", "If", "no", "such", "property", "exists", "the", "provided", "default", "value", "is", "returned", "or",...
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java#L1507-L1512
wdullaer/MaterialDateTimePicker
library/src/main/java/com/wdullaer/materialdatetimepicker/time/TimePickerDialog.java
TimePickerDialog.setStartTime
@Deprecated public void setStartTime(int hourOfDay, int minute, int second) { """ Set the time that will be shown when the picker opens for the first time Overrides the value given in newInstance() @deprecated in favor of {@link #setInitialSelection(int, int, int)} @param hourOfDay the hour of the day @param minute the minute of the hour @param second the second of the minute """ mInitialTime = roundToNearest(new Timepoint(hourOfDay, minute, second)); mInKbMode = false; }
java
@Deprecated public void setStartTime(int hourOfDay, int minute, int second) { mInitialTime = roundToNearest(new Timepoint(hourOfDay, minute, second)); mInKbMode = false; }
[ "@", "Deprecated", "public", "void", "setStartTime", "(", "int", "hourOfDay", ",", "int", "minute", ",", "int", "second", ")", "{", "mInitialTime", "=", "roundToNearest", "(", "new", "Timepoint", "(", "hourOfDay", ",", "minute", ",", "second", ")", ")", ";...
Set the time that will be shown when the picker opens for the first time Overrides the value given in newInstance() @deprecated in favor of {@link #setInitialSelection(int, int, int)} @param hourOfDay the hour of the day @param minute the minute of the hour @param second the second of the minute
[ "Set", "the", "time", "that", "will", "be", "shown", "when", "the", "picker", "opens", "for", "the", "first", "time", "Overrides", "the", "value", "given", "in", "newInstance", "()" ]
train
https://github.com/wdullaer/MaterialDateTimePicker/blob/0a8fe28f19db4f5a5a6cfc525a852416232873a8/library/src/main/java/com/wdullaer/materialdatetimepicker/time/TimePickerDialog.java#L499-L503
apache/flink
flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java
Configuration.setSocketAddr
public void setSocketAddr(String name, InetSocketAddress addr) { """ Set the socket address for the <code>name</code> property as a <code>host:port</code>. """ set(name, NetUtils.getHostPortString(addr)); }
java
public void setSocketAddr(String name, InetSocketAddress addr) { set(name, NetUtils.getHostPortString(addr)); }
[ "public", "void", "setSocketAddr", "(", "String", "name", ",", "InetSocketAddress", "addr", ")", "{", "set", "(", "name", ",", "NetUtils", ".", "getHostPortString", "(", "addr", ")", ")", ";", "}" ]
Set the socket address for the <code>name</code> property as a <code>host:port</code>.
[ "Set", "the", "socket", "address", "for", "the", "<code", ">", "name<", "/", "code", ">", "property", "as", "a", "<code", ">", "host", ":", "port<", "/", "code", ">", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java#L2312-L2314
doanduyhai/Achilles
achilles-core/src/main/java/info/archinnov/achilles/bootstrap/AbstractManagerFactoryBuilder.java
AbstractManagerFactoryBuilder.withParameter
public T withParameter(ConfigurationParameters parameter, Object value) { """ Pass an arbitrary parameter to configure Achilles @param parameter an instance of the ConfigurationParameters enum @param value the value of the parameter @return ManagerFactoryBuilder """ configMap.put(parameter, value); return getThis(); }
java
public T withParameter(ConfigurationParameters parameter, Object value) { configMap.put(parameter, value); return getThis(); }
[ "public", "T", "withParameter", "(", "ConfigurationParameters", "parameter", ",", "Object", "value", ")", "{", "configMap", ".", "put", "(", "parameter", ",", "value", ")", ";", "return", "getThis", "(", ")", ";", "}" ]
Pass an arbitrary parameter to configure Achilles @param parameter an instance of the ConfigurationParameters enum @param value the value of the parameter @return ManagerFactoryBuilder
[ "Pass", "an", "arbitrary", "parameter", "to", "configure", "Achilles" ]
train
https://github.com/doanduyhai/Achilles/blob/8281c33100e72c993e570592ae1a5306afac6813/achilles-core/src/main/java/info/archinnov/achilles/bootstrap/AbstractManagerFactoryBuilder.java#L471-L474
google/closure-compiler
src/com/google/javascript/jscomp/TypeValidator.java
TypeValidator.expectString
void expectString(Node n, JSType type, String msg) { """ Expect the type to be a string, or a type convertible to string. If the expectation is not met, issue a warning at the provided node's source code position. """ if (!type.matchesStringContext()) { mismatch(n, msg, type, STRING_TYPE); } }
java
void expectString(Node n, JSType type, String msg) { if (!type.matchesStringContext()) { mismatch(n, msg, type, STRING_TYPE); } }
[ "void", "expectString", "(", "Node", "n", ",", "JSType", "type", ",", "String", "msg", ")", "{", "if", "(", "!", "type", ".", "matchesStringContext", "(", ")", ")", "{", "mismatch", "(", "n", ",", "msg", ",", "type", ",", "STRING_TYPE", ")", ";", "...
Expect the type to be a string, or a type convertible to string. If the expectation is not met, issue a warning at the provided node's source code position.
[ "Expect", "the", "type", "to", "be", "a", "string", "or", "a", "type", "convertible", "to", "string", ".", "If", "the", "expectation", "is", "not", "met", "issue", "a", "warning", "at", "the", "provided", "node", "s", "source", "code", "position", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypeValidator.java#L363-L367
jeremylong/DependencyCheck
utils/src/main/java/org/owasp/dependencycheck/utils/FileUtils.java
FileUtils.createTempDirectory
@NotNull public static File createTempDirectory(@Nullable final File base) throws IOException { """ Creates a unique temporary directory in the given directory. @param base the base directory to create a temporary directory within @return the temporary directory @throws java.io.IOException thrown when a directory cannot be created within the base directory """ final File tempDir = new File(base, "dctemp" + UUID.randomUUID().toString()); if (tempDir.exists()) { return createTempDirectory(base); } if (!tempDir.mkdirs()) { throw new IOException("Could not create temp directory `" + tempDir.getAbsolutePath() + "`"); } LOGGER.debug("Temporary directory is `{}`", tempDir.getAbsolutePath()); return tempDir; }
java
@NotNull public static File createTempDirectory(@Nullable final File base) throws IOException { final File tempDir = new File(base, "dctemp" + UUID.randomUUID().toString()); if (tempDir.exists()) { return createTempDirectory(base); } if (!tempDir.mkdirs()) { throw new IOException("Could not create temp directory `" + tempDir.getAbsolutePath() + "`"); } LOGGER.debug("Temporary directory is `{}`", tempDir.getAbsolutePath()); return tempDir; }
[ "@", "NotNull", "public", "static", "File", "createTempDirectory", "(", "@", "Nullable", "final", "File", "base", ")", "throws", "IOException", "{", "final", "File", "tempDir", "=", "new", "File", "(", "base", ",", "\"dctemp\"", "+", "UUID", ".", "randomUUID...
Creates a unique temporary directory in the given directory. @param base the base directory to create a temporary directory within @return the temporary directory @throws java.io.IOException thrown when a directory cannot be created within the base directory
[ "Creates", "a", "unique", "temporary", "directory", "in", "the", "given", "directory", "." ]
train
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/utils/src/main/java/org/owasp/dependencycheck/utils/FileUtils.java#L108-L119
structurizr/java
structurizr-core/src/com/structurizr/documentation/Arc42DocumentationTemplate.java
Arc42DocumentationTemplate.addBuildingBlockViewSection
public Section addBuildingBlockViewSection(SoftwareSystem softwareSystem, File... files) throws IOException { """ Adds a "Building Block View" section relating to a {@link SoftwareSystem} from one or more files. @param softwareSystem the {@link SoftwareSystem} the documentation content relates to @param files one or more File objects that point to the documentation content @return a documentation {@link Section} @throws IOException if there is an error reading the files """ return addSection(softwareSystem, "Building Block View", files); }
java
public Section addBuildingBlockViewSection(SoftwareSystem softwareSystem, File... files) throws IOException { return addSection(softwareSystem, "Building Block View", files); }
[ "public", "Section", "addBuildingBlockViewSection", "(", "SoftwareSystem", "softwareSystem", ",", "File", "...", "files", ")", "throws", "IOException", "{", "return", "addSection", "(", "softwareSystem", ",", "\"Building Block View\"", ",", "files", ")", ";", "}" ]
Adds a "Building Block View" section relating to a {@link SoftwareSystem} from one or more files. @param softwareSystem the {@link SoftwareSystem} the documentation content relates to @param files one or more File objects that point to the documentation content @return a documentation {@link Section} @throws IOException if there is an error reading the files
[ "Adds", "a", "Building", "Block", "View", "section", "relating", "to", "a", "{", "@link", "SoftwareSystem", "}", "from", "one", "or", "more", "files", "." ]
train
https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/documentation/Arc42DocumentationTemplate.java#L145-L147
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/MPPUtility.java
MPPUtility.getTimestamp
public static final Date getTimestamp(byte[] data, int offset) { """ Reads a combined date and time value. @param data byte array of data @param offset location of data as offset into the array @return time value """ Date result; long days = getShort(data, offset + 2); if (days < 100) { // We are seeing some files which have very small values for the number of days. // When the relevant field is shown in MS Project it appears as NA. // We try to mimic this behaviour here. days = 0; } if (days == 0 || days == 65535) { result = null; } else { long time = getShort(data, offset); if (time == 65535) { time = 0; } result = DateHelper.getTimestampFromLong((EPOCH + (days * DateHelper.MS_PER_DAY) + ((time * DateHelper.MS_PER_MINUTE) / 10))); } return (result); }
java
public static final Date getTimestamp(byte[] data, int offset) { Date result; long days = getShort(data, offset + 2); if (days < 100) { // We are seeing some files which have very small values for the number of days. // When the relevant field is shown in MS Project it appears as NA. // We try to mimic this behaviour here. days = 0; } if (days == 0 || days == 65535) { result = null; } else { long time = getShort(data, offset); if (time == 65535) { time = 0; } result = DateHelper.getTimestampFromLong((EPOCH + (days * DateHelper.MS_PER_DAY) + ((time * DateHelper.MS_PER_MINUTE) / 10))); } return (result); }
[ "public", "static", "final", "Date", "getTimestamp", "(", "byte", "[", "]", "data", ",", "int", "offset", ")", "{", "Date", "result", ";", "long", "days", "=", "getShort", "(", "data", ",", "offset", "+", "2", ")", ";", "if", "(", "days", "<", "100...
Reads a combined date and time value. @param data byte array of data @param offset location of data as offset into the array @return time value
[ "Reads", "a", "combined", "date", "and", "time", "value", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPPUtility.java#L369-L397
code4everything/util
src/main/java/com/zhazhapan/util/BeanUtils.java
BeanUtils.bean2Another
public static <T> T bean2Another(Object object, Class<T> clazz) throws IllegalAccessException, InstantiationException, InvocationTargetException { """ 将一个Bean的数据装换到另外一个(需实现setter和getter,以及一个默认无参构造函数) @param object 一个Bean @param clazz 另外一个Bean @param <T> 另外Bean类型 @return {@link T} @throws InstantiationException 异常 @throws IllegalAccessException 异常 @throws InvocationTargetException 异常 @since 1.1.1 """ return bean2Another(object, clazz, clazz.newInstance()); }
java
public static <T> T bean2Another(Object object, Class<T> clazz) throws IllegalAccessException, InstantiationException, InvocationTargetException { return bean2Another(object, clazz, clazz.newInstance()); }
[ "public", "static", "<", "T", ">", "T", "bean2Another", "(", "Object", "object", ",", "Class", "<", "T", ">", "clazz", ")", "throws", "IllegalAccessException", ",", "InstantiationException", ",", "InvocationTargetException", "{", "return", "bean2Another", "(", "...
将一个Bean的数据装换到另外一个(需实现setter和getter,以及一个默认无参构造函数) @param object 一个Bean @param clazz 另外一个Bean @param <T> 另外Bean类型 @return {@link T} @throws InstantiationException 异常 @throws IllegalAccessException 异常 @throws InvocationTargetException 异常 @since 1.1.1
[ "将一个Bean的数据装换到另外一个(需实现setter和getter,以及一个默认无参构造函数)" ]
train
https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/BeanUtils.java#L63-L66
google/closure-templates
java/src/com/google/template/soy/msgs/internal/MsgUtils.java
MsgUtils.buildMsgPartsAndComputeMsgIdForDualFormat
public static MsgPartsAndIds buildMsgPartsAndComputeMsgIdForDualFormat(MsgNode msgNode) { """ Builds the list of SoyMsgParts and computes the unique message id for the given MsgNode, assuming a specific dual format. <p>Note: The field {@code idUsingBracedPhs} in the return value is simply set to -1L. @param msgNode The message parsed from the Soy source. @return A {@code MsgPartsAndIds} object, assuming a specific dual format, with field {@code idUsingBracedPhs} set to -1L. """ if (msgNode.isPlrselMsg()) { MsgPartsAndIds mpai = buildMsgPartsAndComputeMsgIds(msgNode, true); return new MsgPartsAndIds(mpai.parts, mpai.idUsingBracedPhs, -1L); } else { return buildMsgPartsAndComputeMsgIds(msgNode, false); } }
java
public static MsgPartsAndIds buildMsgPartsAndComputeMsgIdForDualFormat(MsgNode msgNode) { if (msgNode.isPlrselMsg()) { MsgPartsAndIds mpai = buildMsgPartsAndComputeMsgIds(msgNode, true); return new MsgPartsAndIds(mpai.parts, mpai.idUsingBracedPhs, -1L); } else { return buildMsgPartsAndComputeMsgIds(msgNode, false); } }
[ "public", "static", "MsgPartsAndIds", "buildMsgPartsAndComputeMsgIdForDualFormat", "(", "MsgNode", "msgNode", ")", "{", "if", "(", "msgNode", ".", "isPlrselMsg", "(", ")", ")", "{", "MsgPartsAndIds", "mpai", "=", "buildMsgPartsAndComputeMsgIds", "(", "msgNode", ",", ...
Builds the list of SoyMsgParts and computes the unique message id for the given MsgNode, assuming a specific dual format. <p>Note: The field {@code idUsingBracedPhs} in the return value is simply set to -1L. @param msgNode The message parsed from the Soy source. @return A {@code MsgPartsAndIds} object, assuming a specific dual format, with field {@code idUsingBracedPhs} set to -1L.
[ "Builds", "the", "list", "of", "SoyMsgParts", "and", "computes", "the", "unique", "message", "id", "for", "the", "given", "MsgNode", "assuming", "a", "specific", "dual", "format", "." ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/msgs/internal/MsgUtils.java#L77-L85
aspectran/aspectran
core/src/main/java/com/aspectran/core/context/rule/ForwardRule.java
ForwardRule.newInstance
public static ForwardRule newInstance(String contentType, String transletName, String method, Boolean defaultResponse) throws IllegalRuleException { """ Returns a new instance of ForwardRule. @param contentType the content type @param transletName the translet name @param method the request method @param defaultResponse whether the default response @return an instance of ForwardRule @throws IllegalRuleException if an illegal rule is found """ if (transletName == null) { throw new IllegalRuleException("The 'forward' element requires a 'translet' attribute"); } MethodType requestMethod = null; if (method != null) { requestMethod = MethodType.resolve(method); if (requestMethod == null) { throw new IllegalRuleException("No request method type for '" + method + "'"); } } ForwardRule fr = new ForwardRule(); fr.setContentType(contentType); fr.setTransletName(transletName); fr.setRequestMethod(requestMethod); fr.setDefaultResponse(defaultResponse); return fr; }
java
public static ForwardRule newInstance(String contentType, String transletName, String method, Boolean defaultResponse) throws IllegalRuleException { if (transletName == null) { throw new IllegalRuleException("The 'forward' element requires a 'translet' attribute"); } MethodType requestMethod = null; if (method != null) { requestMethod = MethodType.resolve(method); if (requestMethod == null) { throw new IllegalRuleException("No request method type for '" + method + "'"); } } ForwardRule fr = new ForwardRule(); fr.setContentType(contentType); fr.setTransletName(transletName); fr.setRequestMethod(requestMethod); fr.setDefaultResponse(defaultResponse); return fr; }
[ "public", "static", "ForwardRule", "newInstance", "(", "String", "contentType", ",", "String", "transletName", ",", "String", "method", ",", "Boolean", "defaultResponse", ")", "throws", "IllegalRuleException", "{", "if", "(", "transletName", "==", "null", ")", "{"...
Returns a new instance of ForwardRule. @param contentType the content type @param transletName the translet name @param method the request method @param defaultResponse whether the default response @return an instance of ForwardRule @throws IllegalRuleException if an illegal rule is found
[ "Returns", "a", "new", "instance", "of", "ForwardRule", "." ]
train
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/rule/ForwardRule.java#L153-L173
salesforce/Argus
ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/resources/HistoryResources.java
HistoryResources.findByEntityId
@GET @Path("/job/ { """ Returns the list of job history record for the given job id. @param req The HTTP request. @param jobId The job id. Cannot be null. @param limit max no of records for a given job @param status The job status filter. @return The list of job history records. @throws WebApplicationException Throws the exception for invalid input data. """jobId}") @Description("Returns the job history for the given job Id") @Produces(MediaType.APPLICATION_JSON) public List<HistoryDTO> findByEntityId(@Context HttpServletRequest req, @PathParam("jobId") BigInteger jobId, @QueryParam("limit") int limit, @QueryParam("status") JobStatus status) { if (jobId == null || jobId.compareTo(BigInteger.ZERO) < 1) { throw new WebApplicationException("Job ID cannot be null and must be a positive non-zero number.", Status.BAD_REQUEST); } Alert alert= _alertService.findAlertByPrimaryKey(jobId); if (alert == null) { throw new WebApplicationException(MessageFormat.format("The job with id {0} does not exist.", jobId), Response.Status.NOT_FOUND); } if(!alert.isShared()){ validateResourceAuthorization(req, alert.getOwner(), getRemoteUser(req)); } List<History> historyList = status != null ? _historyService.findByJobAndStatus(jobId, limit, status) : _historyService.findByJob(jobId, limit); return HistoryDTO.transformToDto(historyList); }
java
@GET @Path("/job/{jobId}") @Description("Returns the job history for the given job Id") @Produces(MediaType.APPLICATION_JSON) public List<HistoryDTO> findByEntityId(@Context HttpServletRequest req, @PathParam("jobId") BigInteger jobId, @QueryParam("limit") int limit, @QueryParam("status") JobStatus status) { if (jobId == null || jobId.compareTo(BigInteger.ZERO) < 1) { throw new WebApplicationException("Job ID cannot be null and must be a positive non-zero number.", Status.BAD_REQUEST); } Alert alert= _alertService.findAlertByPrimaryKey(jobId); if (alert == null) { throw new WebApplicationException(MessageFormat.format("The job with id {0} does not exist.", jobId), Response.Status.NOT_FOUND); } if(!alert.isShared()){ validateResourceAuthorization(req, alert.getOwner(), getRemoteUser(req)); } List<History> historyList = status != null ? _historyService.findByJobAndStatus(jobId, limit, status) : _historyService.findByJob(jobId, limit); return HistoryDTO.transformToDto(historyList); }
[ "@", "GET", "@", "Path", "(", "\"/job/{jobId}\"", ")", "@", "Description", "(", "\"Returns the job history for the given job Id\"", ")", "@", "Produces", "(", "MediaType", ".", "APPLICATION_JSON", ")", "public", "List", "<", "HistoryDTO", ">", "findByEntityId", "(",...
Returns the list of job history record for the given job id. @param req The HTTP request. @param jobId The job id. Cannot be null. @param limit max no of records for a given job @param status The job status filter. @return The list of job history records. @throws WebApplicationException Throws the exception for invalid input data.
[ "Returns", "the", "list", "of", "job", "history", "record", "for", "the", "given", "job", "id", "." ]
train
https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/resources/HistoryResources.java#L85-L109
ltearno/hexa.tools
hexa.binding/src/main/java/fr/lteconsulting/hexa/databinding/properties/Properties.java
Properties.getObjectDynamicProperty
public static <T> T getObjectDynamicProperty( Object object, String propertyName ) { """ Gets a dynamic property value on an object @param object the object from which one wants to get the property value @param propertyName the property name """ return propertyValues.getObjectDynamicProperty(object, propertyName); }
java
public static <T> T getObjectDynamicProperty( Object object, String propertyName ) { return propertyValues.getObjectDynamicProperty(object, propertyName); }
[ "public", "static", "<", "T", ">", "T", "getObjectDynamicProperty", "(", "Object", "object", ",", "String", "propertyName", ")", "{", "return", "propertyValues", ".", "getObjectDynamicProperty", "(", "object", ",", "propertyName", ")", ";", "}" ]
Gets a dynamic property value on an object @param object the object from which one wants to get the property value @param propertyName the property name
[ "Gets", "a", "dynamic", "property", "value", "on", "an", "object" ]
train
https://github.com/ltearno/hexa.tools/blob/604c804901b1bb13fe10b3823cc4a639f8993363/hexa.binding/src/main/java/fr/lteconsulting/hexa/databinding/properties/Properties.java#L152-L155
UrielCh/ovh-java-sdk
ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java
ApiOvhMe.document_POST
public OvhDocument document_POST(String name, OvhSafeKeyValue<String>[] tags) throws IOException { """ Create new document REST: POST /me/document @param name [required] File name @param tags [required] File tags """ String qPath = "/me/document"; StringBuilder sb = path(qPath); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "name", name); addBody(o, "tags", tags); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhDocument.class); }
java
public OvhDocument document_POST(String name, OvhSafeKeyValue<String>[] tags) throws IOException { String qPath = "/me/document"; StringBuilder sb = path(qPath); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "name", name); addBody(o, "tags", tags); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhDocument.class); }
[ "public", "OvhDocument", "document_POST", "(", "String", "name", ",", "OvhSafeKeyValue", "<", "String", ">", "[", "]", "tags", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/me/document\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath",...
Create new document REST: POST /me/document @param name [required] File name @param tags [required] File tags
[ "Create", "new", "document" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L2596-L2604
RestComm/jss7
mtp/mtp-impl/src/main/java/org/restcomm/protocols/ss7/mtp/Mtp3UserPartBaseImpl.java
Mtp3UserPartBaseImpl.sendTransferMessageToLocalUser
protected void sendTransferMessageToLocalUser(Mtp3TransferPrimitive msg, int seqControl) { """ Deliver an incoming message to the local user @param msg @param effectiveSls For the thread selection (for message delivering) """ if (this.isStarted) { MsgTransferDeliveryHandler hdl = new MsgTransferDeliveryHandler(msg); seqControl = seqControl & slsFilter; this.msgDeliveryExecutors[this.slsTable[seqControl]].execute(hdl); } else { logger.error(String.format( "Received Mtp3TransferPrimitive=%s but Mtp3UserPart is not started. Message will be dropped", msg)); } }
java
protected void sendTransferMessageToLocalUser(Mtp3TransferPrimitive msg, int seqControl) { if (this.isStarted) { MsgTransferDeliveryHandler hdl = new MsgTransferDeliveryHandler(msg); seqControl = seqControl & slsFilter; this.msgDeliveryExecutors[this.slsTable[seqControl]].execute(hdl); } else { logger.error(String.format( "Received Mtp3TransferPrimitive=%s but Mtp3UserPart is not started. Message will be dropped", msg)); } }
[ "protected", "void", "sendTransferMessageToLocalUser", "(", "Mtp3TransferPrimitive", "msg", ",", "int", "seqControl", ")", "{", "if", "(", "this", ".", "isStarted", ")", "{", "MsgTransferDeliveryHandler", "hdl", "=", "new", "MsgTransferDeliveryHandler", "(", "msg", ...
Deliver an incoming message to the local user @param msg @param effectiveSls For the thread selection (for message delivering)
[ "Deliver", "an", "incoming", "message", "to", "the", "local", "user" ]
train
https://github.com/RestComm/jss7/blob/402b4b3984e581c581e309cb5f6a858fde6dbc33/mtp/mtp-impl/src/main/java/org/restcomm/protocols/ss7/mtp/Mtp3UserPartBaseImpl.java#L251-L261
Squarespace/cldr
compiler/src/main/java/com/squarespace/cldr/codegen/reader/DataReader.java
DataReader.parsePlurals
private void parsePlurals(JsonObject root, String type, Map<String, PluralData> map) { """ Parse pluralization rules. These rules indicate which pluralization category is in effect, based on the value of the plural operands which are computed from an integer or decimal value. """ JsonObject node = resolve(root, "supplemental", type); for (Map.Entry<String, JsonElement> entry : node.entrySet()) { String language = entry.getKey(); PluralData data = new PluralData(); for (Map.Entry<String, JsonElement> ruleNode : entry.getValue().getAsJsonObject().entrySet()) { String category = ruleNode.getKey().replaceFirst("^pluralRule-count-", ""); String value = ruleNode.getValue().getAsString(); Maybe<Pair<Node<PluralType>, CharSequence>> result = PluralRuleGrammar.parse(value); if (result.isNothing()) { throw new IllegalArgumentException(format("failed to parse rule: \"%s\"", StringEscapeUtils.escapeJava(value))); } Struct<PluralType> rule = result.get()._1.asStruct(); Node<PluralType> conditionNode = findChild(rule, PluralType.OR_CONDITION); Node<PluralType> sampleNode = findChild(rule, PluralType.SAMPLE); String sample = sampleNode == null ? "" : (String) sampleNode.asAtom().value(); data.add(category, new PluralData.Rule(value, conditionNode, sample)); } map.put(language, data); } }
java
private void parsePlurals(JsonObject root, String type, Map<String, PluralData> map) { JsonObject node = resolve(root, "supplemental", type); for (Map.Entry<String, JsonElement> entry : node.entrySet()) { String language = entry.getKey(); PluralData data = new PluralData(); for (Map.Entry<String, JsonElement> ruleNode : entry.getValue().getAsJsonObject().entrySet()) { String category = ruleNode.getKey().replaceFirst("^pluralRule-count-", ""); String value = ruleNode.getValue().getAsString(); Maybe<Pair<Node<PluralType>, CharSequence>> result = PluralRuleGrammar.parse(value); if (result.isNothing()) { throw new IllegalArgumentException(format("failed to parse rule: \"%s\"", StringEscapeUtils.escapeJava(value))); } Struct<PluralType> rule = result.get()._1.asStruct(); Node<PluralType> conditionNode = findChild(rule, PluralType.OR_CONDITION); Node<PluralType> sampleNode = findChild(rule, PluralType.SAMPLE); String sample = sampleNode == null ? "" : (String) sampleNode.asAtom().value(); data.add(category, new PluralData.Rule(value, conditionNode, sample)); } map.put(language, data); } }
[ "private", "void", "parsePlurals", "(", "JsonObject", "root", ",", "String", "type", ",", "Map", "<", "String", ",", "PluralData", ">", "map", ")", "{", "JsonObject", "node", "=", "resolve", "(", "root", ",", "\"supplemental\"", ",", "type", ")", ";", "f...
Parse pluralization rules. These rules indicate which pluralization category is in effect, based on the value of the plural operands which are computed from an integer or decimal value.
[ "Parse", "pluralization", "rules", ".", "These", "rules", "indicate", "which", "pluralization", "category", "is", "in", "effect", "based", "on", "the", "value", "of", "the", "plural", "operands", "which", "are", "computed", "from", "an", "integer", "or", "deci...
train
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/compiler/src/main/java/com/squarespace/cldr/codegen/reader/DataReader.java#L826-L848
diirt/util
src/main/java/org/epics/util/array/ListNumbers.java
ListNumbers.sortedView
public static SortedListView sortedView(ListNumber values, ListInt indexes) { """ Creates a sorted view of the given ListNumber based on the indexes provided. This method can be used to sort the given values based on the ordering by another (sorted) list of values. <p> The ListNumber is not sorted in place, and the data is not copied out. Therefore it's intended that the ListNumber is not changed while the view is used. @param values the values to be sorted @param indexes the ordering to be used for the view @return the sorted view """ SortedListView view = new SortedListView(values, indexes); return view; }
java
public static SortedListView sortedView(ListNumber values, ListInt indexes) { SortedListView view = new SortedListView(values, indexes); return view; }
[ "public", "static", "SortedListView", "sortedView", "(", "ListNumber", "values", ",", "ListInt", "indexes", ")", "{", "SortedListView", "view", "=", "new", "SortedListView", "(", "values", ",", "indexes", ")", ";", "return", "view", ";", "}" ]
Creates a sorted view of the given ListNumber based on the indexes provided. This method can be used to sort the given values based on the ordering by another (sorted) list of values. <p> The ListNumber is not sorted in place, and the data is not copied out. Therefore it's intended that the ListNumber is not changed while the view is used. @param values the values to be sorted @param indexes the ordering to be used for the view @return the sorted view
[ "Creates", "a", "sorted", "view", "of", "the", "given", "ListNumber", "based", "on", "the", "indexes", "provided", ".", "This", "method", "can", "be", "used", "to", "sort", "the", "given", "values", "based", "on", "the", "ordering", "by", "another", "(", ...
train
https://github.com/diirt/util/blob/24aca0a173a635aaf0b78d213a3fee8d4f91c077/src/main/java/org/epics/util/array/ListNumbers.java#L57-L60
pmlopes/yoke
framework/src/main/java/com/jetdrone/vertx/yoke/util/Utils.java
Utils.readResourceToBuffer
public static Buffer readResourceToBuffer(@NotNull Class<?> clazz, @NotNull String resource) { """ Avoid using this method for constant reads, use it only for one time only reads from resources in the classpath """ try { Buffer buffer = Buffer.buffer(0); try (InputStream in = clazz.getResourceAsStream(resource)) { int read; byte[] data = new byte[4096]; while ((read = in.read(data, 0, data.length)) != -1) { if (read == data.length) { buffer.appendBytes(data); } else { byte[] slice = new byte[read]; System.arraycopy(data, 0, slice, 0, slice.length); buffer.appendBytes(slice); } } } return buffer; } catch (IOException ioe) { throw new RuntimeException(ioe); } }
java
public static Buffer readResourceToBuffer(@NotNull Class<?> clazz, @NotNull String resource) { try { Buffer buffer = Buffer.buffer(0); try (InputStream in = clazz.getResourceAsStream(resource)) { int read; byte[] data = new byte[4096]; while ((read = in.read(data, 0, data.length)) != -1) { if (read == data.length) { buffer.appendBytes(data); } else { byte[] slice = new byte[read]; System.arraycopy(data, 0, slice, 0, slice.length); buffer.appendBytes(slice); } } } return buffer; } catch (IOException ioe) { throw new RuntimeException(ioe); } }
[ "public", "static", "Buffer", "readResourceToBuffer", "(", "@", "NotNull", "Class", "<", "?", ">", "clazz", ",", "@", "NotNull", "String", "resource", ")", "{", "try", "{", "Buffer", "buffer", "=", "Buffer", ".", "buffer", "(", "0", ")", ";", "try", "(...
Avoid using this method for constant reads, use it only for one time only reads from resources in the classpath
[ "Avoid", "using", "this", "method", "for", "constant", "reads", "use", "it", "only", "for", "one", "time", "only", "reads", "from", "resources", "in", "the", "classpath" ]
train
https://github.com/pmlopes/yoke/blob/fe8a64036f09fb745f0644faddd46162d64faf3c/framework/src/main/java/com/jetdrone/vertx/yoke/util/Utils.java#L33-L55
code4everything/util
src/main/java/com/zhazhapan/util/FileExecutor.java
FileExecutor.copyDirectories
public static void copyDirectories(File[] directories, String storageFolder) throws IOException { """ 批量复制文件夹 @param directories 文件夹数组 @param storageFolder 存储目录 @throws IOException 异常 """ storageFolder = checkFolder(storageFolder) + ValueConsts.SEPARATOR; for (File directory : directories) { copyDirectory(directory, new File(storageFolder + directory.getName())); } }
java
public static void copyDirectories(File[] directories, String storageFolder) throws IOException { storageFolder = checkFolder(storageFolder) + ValueConsts.SEPARATOR; for (File directory : directories) { copyDirectory(directory, new File(storageFolder + directory.getName())); } }
[ "public", "static", "void", "copyDirectories", "(", "File", "[", "]", "directories", ",", "String", "storageFolder", ")", "throws", "IOException", "{", "storageFolder", "=", "checkFolder", "(", "storageFolder", ")", "+", "ValueConsts", ".", "SEPARATOR", ";", "fo...
批量复制文件夹 @param directories 文件夹数组 @param storageFolder 存储目录 @throws IOException 异常
[ "批量复制文件夹" ]
train
https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/FileExecutor.java#L394-L399
google/j2objc
translator/src/main/java/com/google/devtools/j2objc/util/ElementUtil.java
ElementUtil.suppressesWarning
@SuppressWarnings("unchecked") public static boolean suppressesWarning(String warning, Element element) { """ Returns true if there's a SuppressedWarning annotation with the specified warning. The SuppressWarnings annotation can be inherited from the owning method or class, but does not have package scope. """ if (element == null || isPackage(element)) { return false; } AnnotationMirror annotation = getAnnotation(element, SuppressWarnings.class); if (annotation != null) { for (AnnotationValue elem : (List<? extends AnnotationValue>) getAnnotationValue(annotation, "value")) { if (warning.equals(elem.getValue())) { return true; } } } return suppressesWarning(warning, element.getEnclosingElement()); }
java
@SuppressWarnings("unchecked") public static boolean suppressesWarning(String warning, Element element) { if (element == null || isPackage(element)) { return false; } AnnotationMirror annotation = getAnnotation(element, SuppressWarnings.class); if (annotation != null) { for (AnnotationValue elem : (List<? extends AnnotationValue>) getAnnotationValue(annotation, "value")) { if (warning.equals(elem.getValue())) { return true; } } } return suppressesWarning(warning, element.getEnclosingElement()); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "boolean", "suppressesWarning", "(", "String", "warning", ",", "Element", "element", ")", "{", "if", "(", "element", "==", "null", "||", "isPackage", "(", "element", ")", ")", "{", "retu...
Returns true if there's a SuppressedWarning annotation with the specified warning. The SuppressWarnings annotation can be inherited from the owning method or class, but does not have package scope.
[ "Returns", "true", "if", "there", "s", "a", "SuppressedWarning", "annotation", "with", "the", "specified", "warning", ".", "The", "SuppressWarnings", "annotation", "can", "be", "inherited", "from", "the", "owning", "method", "or", "class", "but", "does", "not", ...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/util/ElementUtil.java#L769-L784
dbracewell/mango
src/main/java/com/davidbracewell/conversion/CollectionConverter.java
CollectionConverter.COLLECTION
public static Function<Object, Collection<?>> COLLECTION(final Class<? extends Collection> collectionType) { """ Converts an object to a collection @param collectionType the collection type @return the conversion function """ return as(new CollectionConverterImpl<>(collectionType, null)); }
java
public static Function<Object, Collection<?>> COLLECTION(final Class<? extends Collection> collectionType) { return as(new CollectionConverterImpl<>(collectionType, null)); }
[ "public", "static", "Function", "<", "Object", ",", "Collection", "<", "?", ">", ">", "COLLECTION", "(", "final", "Class", "<", "?", "extends", "Collection", ">", "collectionType", ")", "{", "return", "as", "(", "new", "CollectionConverterImpl", "<>", "(", ...
Converts an object to a collection @param collectionType the collection type @return the conversion function
[ "Converts", "an", "object", "to", "a", "collection" ]
train
https://github.com/dbracewell/mango/blob/2cec08826f1fccd658694dd03abce10fc97618ec/src/main/java/com/davidbracewell/conversion/CollectionConverter.java#L87-L89
kaazing/gateway
mina.core/core/src/main/java/org/apache/mina/proxy/handlers/http/HttpSmartProxyHandler.java
HttpSmartProxyHandler.doHandshake
public void doHandshake(final NextFilter nextFilter) throws ProxyAuthException { """ Performs the handshake processing. @param nextFilter the next filter """ logger.debug(" doHandshake()"); if (authHandler != null) { authHandler.doHandshake(nextFilter); } else { if (requestSent) { // Safety check throw new ProxyAuthException( "Authentication request already sent"); } logger.debug(" sending HTTP request"); // Compute request headers HttpProxyRequest req = (HttpProxyRequest) getProxyIoSession() .getRequest(); Map<String, List<String>> headers = req.getHeaders() != null ? req .getHeaders() : new HashMap<>(); AbstractAuthLogicHandler.addKeepAliveHeaders(headers); req.setHeaders(headers); // Write request to the proxy writeRequest(nextFilter, req); requestSent = true; } }
java
public void doHandshake(final NextFilter nextFilter) throws ProxyAuthException { logger.debug(" doHandshake()"); if (authHandler != null) { authHandler.doHandshake(nextFilter); } else { if (requestSent) { // Safety check throw new ProxyAuthException( "Authentication request already sent"); } logger.debug(" sending HTTP request"); // Compute request headers HttpProxyRequest req = (HttpProxyRequest) getProxyIoSession() .getRequest(); Map<String, List<String>> headers = req.getHeaders() != null ? req .getHeaders() : new HashMap<>(); AbstractAuthLogicHandler.addKeepAliveHeaders(headers); req.setHeaders(headers); // Write request to the proxy writeRequest(nextFilter, req); requestSent = true; } }
[ "public", "void", "doHandshake", "(", "final", "NextFilter", "nextFilter", ")", "throws", "ProxyAuthException", "{", "logger", ".", "debug", "(", "\" doHandshake()\"", ")", ";", "if", "(", "authHandler", "!=", "null", ")", "{", "authHandler", ".", "doHandshake",...
Performs the handshake processing. @param nextFilter the next filter
[ "Performs", "the", "handshake", "processing", "." ]
train
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/proxy/handlers/http/HttpSmartProxyHandler.java#L59-L87
HubSpot/Singularity
SingularityClient/src/main/java/com/hubspot/singularity/client/SingularityClient.java
SingularityClient.isUserAuthorized
public boolean isUserAuthorized(String requestId, String userId, SingularityAuthorizationScope scope) { """ Check if a user is authorized for the specified scope on the specified request @param requestId The request to check authorization on @param userId The user whose authorization will be checked @param scope The scope to check that `user` has @return true if the user is authorized for scope, false otherwise """ final Function<String, String> requestUri = (host) -> String.format(AUTH_CHECK_USER_FORMAT, getApiBase(host), requestId, userId); Map<String, Object> params = Collections.singletonMap("scope", scope.name()); HttpResponse response = executeGetSingleWithParams(requestUri, "auth check", "", Optional.of(params)); return response.isSuccess(); }
java
public boolean isUserAuthorized(String requestId, String userId, SingularityAuthorizationScope scope) { final Function<String, String> requestUri = (host) -> String.format(AUTH_CHECK_USER_FORMAT, getApiBase(host), requestId, userId); Map<String, Object> params = Collections.singletonMap("scope", scope.name()); HttpResponse response = executeGetSingleWithParams(requestUri, "auth check", "", Optional.of(params)); return response.isSuccess(); }
[ "public", "boolean", "isUserAuthorized", "(", "String", "requestId", ",", "String", "userId", ",", "SingularityAuthorizationScope", "scope", ")", "{", "final", "Function", "<", "String", ",", "String", ">", "requestUri", "=", "(", "host", ")", "-", ">", "Strin...
Check if a user is authorized for the specified scope on the specified request @param requestId The request to check authorization on @param userId The user whose authorization will be checked @param scope The scope to check that `user` has @return true if the user is authorized for scope, false otherwise
[ "Check", "if", "a", "user", "is", "authorized", "for", "the", "specified", "scope", "on", "the", "specified", "request" ]
train
https://github.com/HubSpot/Singularity/blob/384a8c16a10aa076af5ca45c8dfcedab9e5122c8/SingularityClient/src/main/java/com/hubspot/singularity/client/SingularityClient.java#L1521-L1526
deeplearning4j/deeplearning4j
datavec/datavec-data/datavec-data-image/src/main/java/org/datavec/image/loader/ImageLoader.java
ImageLoader.toRaveledTensor
public INDArray toRaveledTensor(BufferedImage image) { """ Convert an image in to a raveled tensor of the bgr values of the image @param image the image to parse @return the raveled tensor of bgr values """ try { image = scalingIfNeed(image, false); return toINDArrayBGR(image).ravel(); } catch (Exception e) { throw new RuntimeException("Unable to load image", e); } }
java
public INDArray toRaveledTensor(BufferedImage image) { try { image = scalingIfNeed(image, false); return toINDArrayBGR(image).ravel(); } catch (Exception e) { throw new RuntimeException("Unable to load image", e); } }
[ "public", "INDArray", "toRaveledTensor", "(", "BufferedImage", "image", ")", "{", "try", "{", "image", "=", "scalingIfNeed", "(", "image", ",", "false", ")", ";", "return", "toINDArrayBGR", "(", "image", ")", ".", "ravel", "(", ")", ";", "}", "catch", "(...
Convert an image in to a raveled tensor of the bgr values of the image @param image the image to parse @return the raveled tensor of bgr values
[ "Convert", "an", "image", "in", "to", "a", "raveled", "tensor", "of", "the", "bgr", "values", "of", "the", "image" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-data/datavec-data-image/src/main/java/org/datavec/image/loader/ImageLoader.java#L179-L186
apache/incubator-druid
extensions-core/druid-bloom-filter/src/main/java/org/apache/druid/query/filter/BloomKFilter.java
BloomKFilter.addBytes
public static void addBytes(ByteBuffer buffer, byte[] val, int offset, int length) { """ ByteBuffer based copy of {@link BloomKFilter#addBytes(byte[], int, int)} that adds a value to the ByteBuffer in place. """ long hash64 = val == null ? Murmur3.NULL_HASHCODE : Murmur3.hash64(val, offset, length); addHash(buffer, hash64); }
java
public static void addBytes(ByteBuffer buffer, byte[] val, int offset, int length) { long hash64 = val == null ? Murmur3.NULL_HASHCODE : Murmur3.hash64(val, offset, length); addHash(buffer, hash64); }
[ "public", "static", "void", "addBytes", "(", "ByteBuffer", "buffer", ",", "byte", "[", "]", "val", ",", "int", "offset", ",", "int", "length", ")", "{", "long", "hash64", "=", "val", "==", "null", "?", "Murmur3", ".", "NULL_HASHCODE", ":", "Murmur3", "...
ByteBuffer based copy of {@link BloomKFilter#addBytes(byte[], int, int)} that adds a value to the ByteBuffer in place.
[ "ByteBuffer", "based", "copy", "of", "{" ]
train
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/extensions-core/druid-bloom-filter/src/main/java/org/apache/druid/query/filter/BloomKFilter.java#L374-L379
alkacon/opencms-core
src/org/opencms/ade/galleries/CmsGalleryService.java
CmsGalleryService.updateNoUploadReason
private void updateNoUploadReason(CmsObject searchCms, CmsGallerySearchBean searchObj) { """ Checks the current users permissions on the upload target folder to update the no upload reason.<p> @param searchCms the cms context @param searchObj the search data """ if ((searchObj.getGalleries().size() + searchObj.getFolders().size()) == 1) { String target = !searchObj.getGalleries().isEmpty() ? searchObj.getGalleries().get(0) : searchObj.getFolders().iterator().next(); try { CmsResource targetRes; if (searchCms.existsResource(target, CmsResourceFilter.ONLY_VISIBLE_NO_DELETED)) { targetRes = searchCms.readResource(target, CmsResourceFilter.ONLY_VISIBLE_NO_DELETED); } else { CmsObject rootCms = OpenCms.initCmsObject(searchCms); rootCms.getRequestContext().setSiteRoot(""); targetRes = rootCms.readResource(target, CmsResourceFilter.ONLY_VISIBLE_NO_DELETED); } searchObj.setNoUploadReason( new CmsResourceUtil(searchCms, targetRes).getNoEditReason(getWorkplaceLocale(), true)); } catch (CmsException e) { searchObj.setNoUploadReason(e.getLocalizedMessage(getWorkplaceLocale())); } } else { searchObj.setNoUploadReason(null); } }
java
private void updateNoUploadReason(CmsObject searchCms, CmsGallerySearchBean searchObj) { if ((searchObj.getGalleries().size() + searchObj.getFolders().size()) == 1) { String target = !searchObj.getGalleries().isEmpty() ? searchObj.getGalleries().get(0) : searchObj.getFolders().iterator().next(); try { CmsResource targetRes; if (searchCms.existsResource(target, CmsResourceFilter.ONLY_VISIBLE_NO_DELETED)) { targetRes = searchCms.readResource(target, CmsResourceFilter.ONLY_VISIBLE_NO_DELETED); } else { CmsObject rootCms = OpenCms.initCmsObject(searchCms); rootCms.getRequestContext().setSiteRoot(""); targetRes = rootCms.readResource(target, CmsResourceFilter.ONLY_VISIBLE_NO_DELETED); } searchObj.setNoUploadReason( new CmsResourceUtil(searchCms, targetRes).getNoEditReason(getWorkplaceLocale(), true)); } catch (CmsException e) { searchObj.setNoUploadReason(e.getLocalizedMessage(getWorkplaceLocale())); } } else { searchObj.setNoUploadReason(null); } }
[ "private", "void", "updateNoUploadReason", "(", "CmsObject", "searchCms", ",", "CmsGallerySearchBean", "searchObj", ")", "{", "if", "(", "(", "searchObj", ".", "getGalleries", "(", ")", ".", "size", "(", ")", "+", "searchObj", ".", "getFolders", "(", ")", "....
Checks the current users permissions on the upload target folder to update the no upload reason.<p> @param searchCms the cms context @param searchObj the search data
[ "Checks", "the", "current", "users", "permissions", "on", "the", "upload", "target", "folder", "to", "update", "the", "no", "upload", "reason", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/galleries/CmsGalleryService.java#L3068-L3091
aws/aws-sdk-java
aws-java-sdk-core/src/main/java/com/amazonaws/http/JsonErrorResponseHandler.java
JsonErrorResponseHandler.createException
private AmazonServiceException createException(String errorCode, JsonContent jsonContent) { """ Create an AmazonServiceException using the chain of unmarshallers. This method will never return null, it will always return a valid AmazonServiceException @param errorCode Error code to find an appropriate unmarshaller @param jsonContent JsonContent of HTTP response @return AmazonServiceException """ AmazonServiceException ase = unmarshallException(errorCode, jsonContent); if (ase == null) { ase = new AmazonServiceException( "Unable to unmarshall exception response with the unmarshallers provided"); } return ase; }
java
private AmazonServiceException createException(String errorCode, JsonContent jsonContent) { AmazonServiceException ase = unmarshallException(errorCode, jsonContent); if (ase == null) { ase = new AmazonServiceException( "Unable to unmarshall exception response with the unmarshallers provided"); } return ase; }
[ "private", "AmazonServiceException", "createException", "(", "String", "errorCode", ",", "JsonContent", "jsonContent", ")", "{", "AmazonServiceException", "ase", "=", "unmarshallException", "(", "errorCode", ",", "jsonContent", ")", ";", "if", "(", "ase", "==", "nul...
Create an AmazonServiceException using the chain of unmarshallers. This method will never return null, it will always return a valid AmazonServiceException @param errorCode Error code to find an appropriate unmarshaller @param jsonContent JsonContent of HTTP response @return AmazonServiceException
[ "Create", "an", "AmazonServiceException", "using", "the", "chain", "of", "unmarshallers", ".", "This", "method", "will", "never", "return", "null", "it", "will", "always", "return", "a", "valid", "AmazonServiceException" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-core/src/main/java/com/amazonaws/http/JsonErrorResponseHandler.java#L95-L102
looly/hutool
hutool-core/src/main/java/cn/hutool/core/map/MapUtil.java
MapUtil.getChar
public static Character getChar(Map<?, ?> map, Object key) { """ 获取Map指定key的值,并转换为Character @param map Map @param key 键 @return 值 @since 4.0.6 """ return get(map, key, Character.class); }
java
public static Character getChar(Map<?, ?> map, Object key) { return get(map, key, Character.class); }
[ "public", "static", "Character", "getChar", "(", "Map", "<", "?", ",", "?", ">", "map", ",", "Object", "key", ")", "{", "return", "get", "(", "map", ",", "key", ",", "Character", ".", "class", ")", ";", "}" ]
获取Map指定key的值,并转换为Character @param map Map @param key 键 @return 值 @since 4.0.6
[ "获取Map指定key的值,并转换为Character" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/map/MapUtil.java#L828-L830
telly/groundy
library/src/main/java/com/telly/groundy/GroundyTaskFactory.java
GroundyTaskFactory.get
static GroundyTask get(Class<? extends GroundyTask> taskClass, Context context) { """ Builds a GroundyTask based on call. @param taskClass groundy value implementation class @param context used to instantiate the value @return An instance of a GroundyTask if a given call is valid null otherwise """ if (CACHE.containsKey(taskClass)) { return CACHE.get(taskClass); } GroundyTask groundyTask = null; try { L.d(TAG, "Instantiating " + taskClass); Constructor ctc = taskClass.getConstructor(); groundyTask = (GroundyTask) ctc.newInstance(); if (groundyTask.canBeCached()) { CACHE.put(taskClass, groundyTask); } else if (CACHE.containsKey(taskClass)) { CACHE.remove(taskClass); } groundyTask.setContext(context); groundyTask.onCreate(); return groundyTask; } catch (Exception e) { L.e(TAG, "Unable to create value for call " + taskClass, e); } return groundyTask; }
java
static GroundyTask get(Class<? extends GroundyTask> taskClass, Context context) { if (CACHE.containsKey(taskClass)) { return CACHE.get(taskClass); } GroundyTask groundyTask = null; try { L.d(TAG, "Instantiating " + taskClass); Constructor ctc = taskClass.getConstructor(); groundyTask = (GroundyTask) ctc.newInstance(); if (groundyTask.canBeCached()) { CACHE.put(taskClass, groundyTask); } else if (CACHE.containsKey(taskClass)) { CACHE.remove(taskClass); } groundyTask.setContext(context); groundyTask.onCreate(); return groundyTask; } catch (Exception e) { L.e(TAG, "Unable to create value for call " + taskClass, e); } return groundyTask; }
[ "static", "GroundyTask", "get", "(", "Class", "<", "?", "extends", "GroundyTask", ">", "taskClass", ",", "Context", "context", ")", "{", "if", "(", "CACHE", ".", "containsKey", "(", "taskClass", ")", ")", "{", "return", "CACHE", ".", "get", "(", "taskCla...
Builds a GroundyTask based on call. @param taskClass groundy value implementation class @param context used to instantiate the value @return An instance of a GroundyTask if a given call is valid null otherwise
[ "Builds", "a", "GroundyTask", "based", "on", "call", "." ]
train
https://github.com/telly/groundy/blob/e90baf9901a8be20b348bd1575d5ad782560cec8/library/src/main/java/com/telly/groundy/GroundyTaskFactory.java#L47-L68
wcm-io/wcm-io-handler
media/src/main/java/io/wcm/handler/media/impl/MediaFormatResolver.java
MediaFormatResolver.addResponsiveImageMediaFormats
private boolean addResponsiveImageMediaFormats(MediaArgs mediaArgs) { """ Add on-the-fly generated media formats if required for responsive image handling via image sizes or picture sources. @param mediaArgs Media args @return true if resolution was successful """ Map<String, MediaFormat> additionalMediaFormats = new LinkedHashMap<>(); // check if additional on-the-fly generated media formats needs to be added for responsive image handling if (!resolveForImageSizes(mediaArgs, additionalMediaFormats)) { return false; } if (!resolveForResponsivePictureSources(mediaArgs, additionalMediaFormats)) { return false; } // if additional media formats where found add them to the media format list in media args if (!additionalMediaFormats.isEmpty()) { List<MediaFormat> allMediaFormats = new ArrayList<>(); if (mediaArgs.getMediaFormats() != null) { allMediaFormats.addAll(Arrays.asList(mediaArgs.getMediaFormats())); } allMediaFormats.addAll(additionalMediaFormats.values()); mediaArgs.mediaFormats(allMediaFormats.toArray(new MediaFormat[allMediaFormats.size()])); } return true; }
java
private boolean addResponsiveImageMediaFormats(MediaArgs mediaArgs) { Map<String, MediaFormat> additionalMediaFormats = new LinkedHashMap<>(); // check if additional on-the-fly generated media formats needs to be added for responsive image handling if (!resolveForImageSizes(mediaArgs, additionalMediaFormats)) { return false; } if (!resolveForResponsivePictureSources(mediaArgs, additionalMediaFormats)) { return false; } // if additional media formats where found add them to the media format list in media args if (!additionalMediaFormats.isEmpty()) { List<MediaFormat> allMediaFormats = new ArrayList<>(); if (mediaArgs.getMediaFormats() != null) { allMediaFormats.addAll(Arrays.asList(mediaArgs.getMediaFormats())); } allMediaFormats.addAll(additionalMediaFormats.values()); mediaArgs.mediaFormats(allMediaFormats.toArray(new MediaFormat[allMediaFormats.size()])); } return true; }
[ "private", "boolean", "addResponsiveImageMediaFormats", "(", "MediaArgs", "mediaArgs", ")", "{", "Map", "<", "String", ",", "MediaFormat", ">", "additionalMediaFormats", "=", "new", "LinkedHashMap", "<>", "(", ")", ";", "// check if additional on-the-fly generated media f...
Add on-the-fly generated media formats if required for responsive image handling via image sizes or picture sources. @param mediaArgs Media args @return true if resolution was successful
[ "Add", "on", "-", "the", "-", "fly", "generated", "media", "formats", "if", "required", "for", "responsive", "image", "handling", "via", "image", "sizes", "or", "picture", "sources", "." ]
train
https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/media/src/main/java/io/wcm/handler/media/impl/MediaFormatResolver.java#L99-L121
alkacon/opencms-core
src/org/opencms/db/CmsLoginManager.java
CmsLoginManager.addInvalidLogin
protected void addInvalidLogin(String userName, String remoteAddress) { """ Adds an invalid attempt to login for the given user / IP to the storage.<p> In case the configured threshold is reached, the user is disabled for the configured time.<p> @param userName the name of the user @param remoteAddress the remore address (IP) from which the login attempt was made """ if (m_maxBadAttempts < 0) { // invalid login storage is disabled return; } String key = createStorageKey(userName, remoteAddress); // look up the user in the storage CmsUserData userData = m_storage.get(key); if (userData != null) { // user data already contained in storage userData.increaseInvalidLoginCount(); } else { // create an new data object for this user userData = new CmsUserData(); m_storage.put(key, userData); } }
java
protected void addInvalidLogin(String userName, String remoteAddress) { if (m_maxBadAttempts < 0) { // invalid login storage is disabled return; } String key = createStorageKey(userName, remoteAddress); // look up the user in the storage CmsUserData userData = m_storage.get(key); if (userData != null) { // user data already contained in storage userData.increaseInvalidLoginCount(); } else { // create an new data object for this user userData = new CmsUserData(); m_storage.put(key, userData); } }
[ "protected", "void", "addInvalidLogin", "(", "String", "userName", ",", "String", "remoteAddress", ")", "{", "if", "(", "m_maxBadAttempts", "<", "0", ")", "{", "// invalid login storage is disabled", "return", ";", "}", "String", "key", "=", "createStorageKey", "(...
Adds an invalid attempt to login for the given user / IP to the storage.<p> In case the configured threshold is reached, the user is disabled for the configured time.<p> @param userName the name of the user @param remoteAddress the remore address (IP) from which the login attempt was made
[ "Adds", "an", "invalid", "attempt", "to", "login", "for", "the", "given", "user", "/", "IP", "to", "the", "storage", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsLoginManager.java#L717-L735
sebastiangraf/treetank
interfacemodules/jax-rx/src/main/java/org/treetank/service/jaxrx/implementation/DatabaseRepresentation.java
DatabaseRepresentation.revertToRevision
public void revertToRevision(final String resourceName, final long backToRevision) throws JaxRxException, TTException { """ This method reverts the latest revision data to the requested. @param resourceName The name of the XML resource. @param backToRevision The revision value, which has to be set as the latest. @throws WebApplicationException @throws TTException """ ISession session = null; INodeWriteTrx wtx = null; boolean abort = false; try { session = mDatabase.getSession(new SessionConfiguration(resourceName, StandardSettings.KEY)); wtx = new NodeWriteTrx(session, session.beginBucketWtx(), HashKind.Rolling); wtx.revertTo(backToRevision); wtx.commit(); } catch (final TTException exce) { abort = true; throw new JaxRxException(exce); } finally { WorkerHelper.closeWTX(abort, wtx, session); } }
java
public void revertToRevision(final String resourceName, final long backToRevision) throws JaxRxException, TTException { ISession session = null; INodeWriteTrx wtx = null; boolean abort = false; try { session = mDatabase.getSession(new SessionConfiguration(resourceName, StandardSettings.KEY)); wtx = new NodeWriteTrx(session, session.beginBucketWtx(), HashKind.Rolling); wtx.revertTo(backToRevision); wtx.commit(); } catch (final TTException exce) { abort = true; throw new JaxRxException(exce); } finally { WorkerHelper.closeWTX(abort, wtx, session); } }
[ "public", "void", "revertToRevision", "(", "final", "String", "resourceName", ",", "final", "long", "backToRevision", ")", "throws", "JaxRxException", ",", "TTException", "{", "ISession", "session", "=", "null", ";", "INodeWriteTrx", "wtx", "=", "null", ";", "bo...
This method reverts the latest revision data to the requested. @param resourceName The name of the XML resource. @param backToRevision The revision value, which has to be set as the latest. @throws WebApplicationException @throws TTException
[ "This", "method", "reverts", "the", "latest", "revision", "data", "to", "the", "requested", "." ]
train
https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/jax-rx/src/main/java/org/treetank/service/jaxrx/implementation/DatabaseRepresentation.java#L609-L625
vkostyukov/la4j
src/main/java/org/la4j/Matrix.java
Matrix.setRow
public void setRow(int i, Vector row) { """ Copies given {@code row} into the specified row of this matrix. @param i the row index @param row the row represented as vector """ if (columns != row.length()) { fail("Wrong vector length: " + row.length() + ". Should be: " + columns + "."); } for (int j = 0; j < row.length(); j++) { set(i, j, row.get(j)); } }
java
public void setRow(int i, Vector row) { if (columns != row.length()) { fail("Wrong vector length: " + row.length() + ". Should be: " + columns + "."); } for (int j = 0; j < row.length(); j++) { set(i, j, row.get(j)); } }
[ "public", "void", "setRow", "(", "int", "i", ",", "Vector", "row", ")", "{", "if", "(", "columns", "!=", "row", ".", "length", "(", ")", ")", "{", "fail", "(", "\"Wrong vector length: \"", "+", "row", ".", "length", "(", ")", "+", "\". Should be: \"", ...
Copies given {@code row} into the specified row of this matrix. @param i the row index @param row the row represented as vector
[ "Copies", "given", "{", "@code", "row", "}", "into", "the", "specified", "row", "of", "this", "matrix", "." ]
train
https://github.com/vkostyukov/la4j/blob/dd1b917caf9606399a49afa6b0d738934cd3a7b3/src/main/java/org/la4j/Matrix.java#L1014-L1022
cloudfoundry-community/cf-java-component
cf-spring/src/main/java/cf/spring/servicebroker/AccessorUtils.java
AccessorUtils.invokeMethod
public static Object invokeMethod(Object object, Method method, Object... args) throws Throwable { """ Invokes the method of the specified object with some method arguments. """ try { return method.invoke(object, args); } catch (InvocationTargetException e) { throw e.getTargetException(); } }
java
public static Object invokeMethod(Object object, Method method, Object... args) throws Throwable { try { return method.invoke(object, args); } catch (InvocationTargetException e) { throw e.getTargetException(); } }
[ "public", "static", "Object", "invokeMethod", "(", "Object", "object", ",", "Method", "method", ",", "Object", "...", "args", ")", "throws", "Throwable", "{", "try", "{", "return", "method", ".", "invoke", "(", "object", ",", "args", ")", ";", "}", "catc...
Invokes the method of the specified object with some method arguments.
[ "Invokes", "the", "method", "of", "the", "specified", "object", "with", "some", "method", "arguments", "." ]
train
https://github.com/cloudfoundry-community/cf-java-component/blob/9d7d54f2b599f3e4f4706bc0c471e144065671fa/cf-spring/src/main/java/cf/spring/servicebroker/AccessorUtils.java#L66-L72
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/AccountsImpl.java
AccountsImpl.listPoolNodeCountsAsync
public ServiceFuture<List<PoolNodeCounts>> listPoolNodeCountsAsync(final AccountListPoolNodeCountsOptions accountListPoolNodeCountsOptions, final ListOperationCallback<PoolNodeCounts> serviceCallback) { """ Gets the number of nodes in each state, grouped by pool. @param accountListPoolNodeCountsOptions Additional parameters for the operation @param serviceCallback the async ServiceCallback to handle successful and failed responses. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceFuture} object """ return AzureServiceFuture.fromHeaderPageResponse( listPoolNodeCountsSinglePageAsync(accountListPoolNodeCountsOptions), new Func1<String, Observable<ServiceResponseWithHeaders<Page<PoolNodeCounts>, AccountListPoolNodeCountsHeaders>>>() { @Override public Observable<ServiceResponseWithHeaders<Page<PoolNodeCounts>, AccountListPoolNodeCountsHeaders>> call(String nextPageLink) { AccountListPoolNodeCountsNextOptions accountListPoolNodeCountsNextOptions = null; if (accountListPoolNodeCountsOptions != null) { accountListPoolNodeCountsNextOptions = new AccountListPoolNodeCountsNextOptions(); accountListPoolNodeCountsNextOptions.withClientRequestId(accountListPoolNodeCountsOptions.clientRequestId()); accountListPoolNodeCountsNextOptions.withReturnClientRequestId(accountListPoolNodeCountsOptions.returnClientRequestId()); accountListPoolNodeCountsNextOptions.withOcpDate(accountListPoolNodeCountsOptions.ocpDate()); } return listPoolNodeCountsNextSinglePageAsync(nextPageLink, accountListPoolNodeCountsNextOptions); } }, serviceCallback); }
java
public ServiceFuture<List<PoolNodeCounts>> listPoolNodeCountsAsync(final AccountListPoolNodeCountsOptions accountListPoolNodeCountsOptions, final ListOperationCallback<PoolNodeCounts> serviceCallback) { return AzureServiceFuture.fromHeaderPageResponse( listPoolNodeCountsSinglePageAsync(accountListPoolNodeCountsOptions), new Func1<String, Observable<ServiceResponseWithHeaders<Page<PoolNodeCounts>, AccountListPoolNodeCountsHeaders>>>() { @Override public Observable<ServiceResponseWithHeaders<Page<PoolNodeCounts>, AccountListPoolNodeCountsHeaders>> call(String nextPageLink) { AccountListPoolNodeCountsNextOptions accountListPoolNodeCountsNextOptions = null; if (accountListPoolNodeCountsOptions != null) { accountListPoolNodeCountsNextOptions = new AccountListPoolNodeCountsNextOptions(); accountListPoolNodeCountsNextOptions.withClientRequestId(accountListPoolNodeCountsOptions.clientRequestId()); accountListPoolNodeCountsNextOptions.withReturnClientRequestId(accountListPoolNodeCountsOptions.returnClientRequestId()); accountListPoolNodeCountsNextOptions.withOcpDate(accountListPoolNodeCountsOptions.ocpDate()); } return listPoolNodeCountsNextSinglePageAsync(nextPageLink, accountListPoolNodeCountsNextOptions); } }, serviceCallback); }
[ "public", "ServiceFuture", "<", "List", "<", "PoolNodeCounts", ">", ">", "listPoolNodeCountsAsync", "(", "final", "AccountListPoolNodeCountsOptions", "accountListPoolNodeCountsOptions", ",", "final", "ListOperationCallback", "<", "PoolNodeCounts", ">", "serviceCallback", ")",...
Gets the number of nodes in each state, grouped by pool. @param accountListPoolNodeCountsOptions Additional parameters for the operation @param serviceCallback the async ServiceCallback to handle successful and failed responses. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceFuture} object
[ "Gets", "the", "number", "of", "nodes", "in", "each", "state", "grouped", "by", "pool", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/AccountsImpl.java#L508-L525
apache/reef
lang/java/reef-io/src/main/java/org/apache/reef/io/network/naming/NameServerImpl.java
NameServerImpl.lookup
@Override public List<NameAssignment> lookup(final Iterable<Identifier> identifiers) { """ Finds addresses for identifiers locally. @param identifiers an iterable of identifiers @return a list of name assignments """ LOG.log(Level.FINE, "identifiers"); final List<NameAssignment> nas = new ArrayList<>(); for (final Identifier id : identifiers) { final InetSocketAddress addr = idToAddrMap.get(id); LOG.log(Level.FINEST, "id : {0} addr: {1}", new Object[]{id, addr}); if (addr != null) { nas.add(new NameAssignmentTuple(id, addr)); } } return nas; }
java
@Override public List<NameAssignment> lookup(final Iterable<Identifier> identifiers) { LOG.log(Level.FINE, "identifiers"); final List<NameAssignment> nas = new ArrayList<>(); for (final Identifier id : identifiers) { final InetSocketAddress addr = idToAddrMap.get(id); LOG.log(Level.FINEST, "id : {0} addr: {1}", new Object[]{id, addr}); if (addr != null) { nas.add(new NameAssignmentTuple(id, addr)); } } return nas; }
[ "@", "Override", "public", "List", "<", "NameAssignment", ">", "lookup", "(", "final", "Iterable", "<", "Identifier", ">", "identifiers", ")", "{", "LOG", ".", "log", "(", "Level", ".", "FINE", ",", "\"identifiers\"", ")", ";", "final", "List", "<", "Nam...
Finds addresses for identifiers locally. @param identifiers an iterable of identifiers @return a list of name assignments
[ "Finds", "addresses", "for", "identifiers", "locally", "." ]
train
https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-io/src/main/java/org/apache/reef/io/network/naming/NameServerImpl.java#L170-L182
UrielCh/ovh-java-sdk
ovh-java-sdk-vps/src/main/java/net/minidev/ovh/api/ApiOvhVps.java
ApiOvhVps.serviceName_ipCountryAvailable_GET
public ArrayList<OvhGeolocationEnum> serviceName_ipCountryAvailable_GET(String serviceName) throws IOException { """ Get the countries you can select for your IPs geolocation REST: GET /vps/{serviceName}/ipCountryAvailable @param serviceName [required] The internal name of your VPS offer """ String qPath = "/vps/{serviceName}/ipCountryAvailable"; StringBuilder sb = path(qPath, serviceName); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t9); }
java
public ArrayList<OvhGeolocationEnum> serviceName_ipCountryAvailable_GET(String serviceName) throws IOException { String qPath = "/vps/{serviceName}/ipCountryAvailable"; StringBuilder sb = path(qPath, serviceName); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t9); }
[ "public", "ArrayList", "<", "OvhGeolocationEnum", ">", "serviceName_ipCountryAvailable_GET", "(", "String", "serviceName", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/vps/{serviceName}/ipCountryAvailable\"", ";", "StringBuilder", "sb", "=", "path", "(",...
Get the countries you can select for your IPs geolocation REST: GET /vps/{serviceName}/ipCountryAvailable @param serviceName [required] The internal name of your VPS offer
[ "Get", "the", "countries", "you", "can", "select", "for", "your", "IPs", "geolocation" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-vps/src/main/java/net/minidev/ovh/api/ApiOvhVps.java#L940-L945
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java
Utils.copyDirectory
public void copyDirectory(PackageElement pe, DocPath dir) throws DocFileIOException { """ Copy the given directory contents from the source package directory to the generated documentation directory. For example, given a package java.lang, this method will copy the entire directory, to the generated documentation hierarchy. @param pe the package containing the directory to be copied @param dir the directory to be copied @throws DocFileIOException if there is a problem while copying the documentation files """ copyDirectory(getLocationForPackage(pe), dir); }
java
public void copyDirectory(PackageElement pe, DocPath dir) throws DocFileIOException { copyDirectory(getLocationForPackage(pe), dir); }
[ "public", "void", "copyDirectory", "(", "PackageElement", "pe", ",", "DocPath", "dir", ")", "throws", "DocFileIOException", "{", "copyDirectory", "(", "getLocationForPackage", "(", "pe", ")", ",", "dir", ")", ";", "}" ]
Copy the given directory contents from the source package directory to the generated documentation directory. For example, given a package java.lang, this method will copy the entire directory, to the generated documentation hierarchy. @param pe the package containing the directory to be copied @param dir the directory to be copied @throws DocFileIOException if there is a problem while copying the documentation files
[ "Copy", "the", "given", "directory", "contents", "from", "the", "source", "package", "directory", "to", "the", "generated", "documentation", "directory", ".", "For", "example", "given", "a", "package", "java", ".", "lang", "this", "method", "will", "copy", "th...
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java#L292-L294
actorapp/actor-platform
actor-sdk/sdk-core/core/core-shared/src/main/java/im/actor/core/Messenger.java
Messenger.registerApplePushKit
@ObjectiveCName("registerApplePushKitWithApnsId:withToken:") public void registerApplePushKit(int apnsId, String token) { """ Register apple push kit tokens @param apnsId internal APNS cert key @param token APNS token """ modules.getPushesModule().registerApplePushKit(apnsId, token); }
java
@ObjectiveCName("registerApplePushKitWithApnsId:withToken:") public void registerApplePushKit(int apnsId, String token) { modules.getPushesModule().registerApplePushKit(apnsId, token); }
[ "@", "ObjectiveCName", "(", "\"registerApplePushKitWithApnsId:withToken:\"", ")", "public", "void", "registerApplePushKit", "(", "int", "apnsId", ",", "String", "token", ")", "{", "modules", ".", "getPushesModule", "(", ")", ".", "registerApplePushKit", "(", "apnsId",...
Register apple push kit tokens @param apnsId internal APNS cert key @param token APNS token
[ "Register", "apple", "push", "kit", "tokens" ]
train
https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core/core/core-shared/src/main/java/im/actor/core/Messenger.java#L2699-L2702
Azure/azure-sdk-for-java
containerregistry/resource-manager/v2017_03_01/src/main/java/com/microsoft/azure/management/containerregistry/v2017_03_01/implementation/RegistriesInner.java
RegistriesInner.getByResourceGroup
public RegistryInner getByResourceGroup(String resourceGroupName, String registryName) { """ Gets the properties of the specified container registry. @param resourceGroupName The name of the resource group to which the container registry belongs. @param registryName The name of the container registry. @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 RegistryInner object if successful. """ return getByResourceGroupWithServiceResponseAsync(resourceGroupName, registryName).toBlocking().single().body(); }
java
public RegistryInner getByResourceGroup(String resourceGroupName, String registryName) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, registryName).toBlocking().single().body(); }
[ "public", "RegistryInner", "getByResourceGroup", "(", "String", "resourceGroupName", ",", "String", "registryName", ")", "{", "return", "getByResourceGroupWithServiceResponseAsync", "(", "resourceGroupName", ",", "registryName", ")", ".", "toBlocking", "(", ")", ".", "s...
Gets the properties of the specified container registry. @param resourceGroupName The name of the resource group to which the container registry belongs. @param registryName The name of the container registry. @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 RegistryInner object if successful.
[ "Gets", "the", "properties", "of", "the", "specified", "container", "registry", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerregistry/resource-manager/v2017_03_01/src/main/java/com/microsoft/azure/management/containerregistry/v2017_03_01/implementation/RegistriesInner.java#L215-L217
Falydoor/limesurvey-rc
src/main/java/com/github/falydoor/limesurveyrc/LimesurveyRC.java
LimesurveyRC.updateResponse
public JsonElement updateResponse(int surveyId, int responseId, Map<String, String> responseData) throws LimesurveyRCException { """ Update a response. @param surveyId the survey id of the survey you want to update the response @param responseId the response id of the response you want to update @param responseData the response data that contains the fields you want to update @return the json element @throws LimesurveyRCException the limesurvey rc exception """ LsApiBody.LsApiParams params = getParamsWithKey(surveyId); responseData.put("id", String.valueOf(responseId)); params.setResponseData(responseData); return callRC(new LsApiBody("update_response", params)); }
java
public JsonElement updateResponse(int surveyId, int responseId, Map<String, String> responseData) throws LimesurveyRCException { LsApiBody.LsApiParams params = getParamsWithKey(surveyId); responseData.put("id", String.valueOf(responseId)); params.setResponseData(responseData); return callRC(new LsApiBody("update_response", params)); }
[ "public", "JsonElement", "updateResponse", "(", "int", "surveyId", ",", "int", "responseId", ",", "Map", "<", "String", ",", "String", ">", "responseData", ")", "throws", "LimesurveyRCException", "{", "LsApiBody", ".", "LsApiParams", "params", "=", "getParamsWithK...
Update a response. @param surveyId the survey id of the survey you want to update the response @param responseId the response id of the response you want to update @param responseData the response data that contains the fields you want to update @return the json element @throws LimesurveyRCException the limesurvey rc exception
[ "Update", "a", "response", "." ]
train
https://github.com/Falydoor/limesurvey-rc/blob/b8d573389086395e46a0bdeeddeef4d1c2c0a488/src/main/java/com/github/falydoor/limesurveyrc/LimesurveyRC.java#L188-L194
JodaOrg/joda-time
src/main/java/org/joda/time/Period.java
Period.withMillis
public Period withMillis(int millis) { """ Returns a new period with the specified number of millis. <p> This period instance is immutable and unaffected by this method call. @param millis the amount of millis to add, may be negative @return the new period with the increased millis @throws UnsupportedOperationException if the field is not supported """ int[] values = getValues(); // cloned getPeriodType().setIndexedField(this, PeriodType.MILLI_INDEX, values, millis); return new Period(values, getPeriodType()); }
java
public Period withMillis(int millis) { int[] values = getValues(); // cloned getPeriodType().setIndexedField(this, PeriodType.MILLI_INDEX, values, millis); return new Period(values, getPeriodType()); }
[ "public", "Period", "withMillis", "(", "int", "millis", ")", "{", "int", "[", "]", "values", "=", "getValues", "(", ")", ";", "// cloned", "getPeriodType", "(", ")", ".", "setIndexedField", "(", "this", ",", "PeriodType", ".", "MILLI_INDEX", ",", "values",...
Returns a new period with the specified number of millis. <p> This period instance is immutable and unaffected by this method call. @param millis the amount of millis to add, may be negative @return the new period with the increased millis @throws UnsupportedOperationException if the field is not supported
[ "Returns", "a", "new", "period", "with", "the", "specified", "number", "of", "millis", ".", "<p", ">", "This", "period", "instance", "is", "immutable", "and", "unaffected", "by", "this", "method", "call", "." ]
train
https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/Period.java#L1019-L1023
aws/aws-sdk-java
aws-java-sdk-elasticsearch/src/main/java/com/amazonaws/services/elasticsearch/model/ElasticsearchDomainStatus.java
ElasticsearchDomainStatus.withEndpoints
public ElasticsearchDomainStatus withEndpoints(java.util.Map<String, String> endpoints) { """ <p> Map containing the Elasticsearch domain endpoints used to submit index and search requests. Example <code>key, value</code>: <code>'vpc','vpc-endpoint-h2dsd34efgyghrtguk5gt6j2foh4.us-east-1.es.amazonaws.com'</code>. </p> @param endpoints Map containing the Elasticsearch domain endpoints used to submit index and search requests. Example <code>key, value</code>: <code>'vpc','vpc-endpoint-h2dsd34efgyghrtguk5gt6j2foh4.us-east-1.es.amazonaws.com'</code>. @return Returns a reference to this object so that method calls can be chained together. """ setEndpoints(endpoints); return this; }
java
public ElasticsearchDomainStatus withEndpoints(java.util.Map<String, String> endpoints) { setEndpoints(endpoints); return this; }
[ "public", "ElasticsearchDomainStatus", "withEndpoints", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "endpoints", ")", "{", "setEndpoints", "(", "endpoints", ")", ";", "return", "this", ";", "}" ]
<p> Map containing the Elasticsearch domain endpoints used to submit index and search requests. Example <code>key, value</code>: <code>'vpc','vpc-endpoint-h2dsd34efgyghrtguk5gt6j2foh4.us-east-1.es.amazonaws.com'</code>. </p> @param endpoints Map containing the Elasticsearch domain endpoints used to submit index and search requests. Example <code>key, value</code>: <code>'vpc','vpc-endpoint-h2dsd34efgyghrtguk5gt6j2foh4.us-east-1.es.amazonaws.com'</code>. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "Map", "containing", "the", "Elasticsearch", "domain", "endpoints", "used", "to", "submit", "index", "and", "search", "requests", ".", "Example", "<code", ">", "key", "value<", "/", "code", ">", ":", "<code", ">", "vpc", "vpc", "-", "endpoint", ...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-elasticsearch/src/main/java/com/amazonaws/services/elasticsearch/model/ElasticsearchDomainStatus.java#L534-L537
lessthanoptimal/BoofCV
main/boofcv-io/src/main/java/boofcv/io/image/ConvertBufferedImage.java
ConvertBufferedImage.convertTo
public static BufferedImage convertTo(GrayU8 src, BufferedImage dst) { """ Converts a {@link GrayU8} into a BufferedImage. If the buffered image has multiple channels then the input image is copied into each channel. @param src Input image. @param dst Where the converted image is written to. If null a new image is created. @return Converted image. """ dst = checkInputs(src, dst); DataBuffer buffer = dst.getRaster().getDataBuffer(); try { if (buffer.getDataType() == DataBuffer.TYPE_BYTE && isKnownByteFormat(dst) ) { ConvertRaster.grayToBuffered(src, (DataBufferByte)buffer, dst.getRaster()); } else if (buffer.getDataType() == DataBuffer.TYPE_INT) { ConvertRaster.grayToBuffered(src, (DataBufferInt)buffer, dst.getRaster()); } else { ConvertRaster.grayToBuffered(src, dst); } // hack so that it knows the buffer has been modified dst.setRGB(0,0,dst.getRGB(0,0)); } catch( java.security.AccessControlException e) { ConvertRaster.grayToBuffered(src, dst); } return dst; }
java
public static BufferedImage convertTo(GrayU8 src, BufferedImage dst) { dst = checkInputs(src, dst); DataBuffer buffer = dst.getRaster().getDataBuffer(); try { if (buffer.getDataType() == DataBuffer.TYPE_BYTE && isKnownByteFormat(dst) ) { ConvertRaster.grayToBuffered(src, (DataBufferByte)buffer, dst.getRaster()); } else if (buffer.getDataType() == DataBuffer.TYPE_INT) { ConvertRaster.grayToBuffered(src, (DataBufferInt)buffer, dst.getRaster()); } else { ConvertRaster.grayToBuffered(src, dst); } // hack so that it knows the buffer has been modified dst.setRGB(0,0,dst.getRGB(0,0)); } catch( java.security.AccessControlException e) { ConvertRaster.grayToBuffered(src, dst); } return dst; }
[ "public", "static", "BufferedImage", "convertTo", "(", "GrayU8", "src", ",", "BufferedImage", "dst", ")", "{", "dst", "=", "checkInputs", "(", "src", ",", "dst", ")", ";", "DataBuffer", "buffer", "=", "dst", ".", "getRaster", "(", ")", ".", "getDataBuffer"...
Converts a {@link GrayU8} into a BufferedImage. If the buffered image has multiple channels then the input image is copied into each channel. @param src Input image. @param dst Where the converted image is written to. If null a new image is created. @return Converted image.
[ "Converts", "a", "{", "@link", "GrayU8", "}", "into", "a", "BufferedImage", ".", "If", "the", "buffered", "image", "has", "multiple", "channels", "then", "the", "input", "image", "is", "copied", "into", "each", "channel", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-io/src/main/java/boofcv/io/image/ConvertBufferedImage.java#L693-L712
OpenCompare/OpenCompare
org.opencompare/pcmdata-importers/src/main/java/misc/PCMUtil.java
PCMUtil.getFeature
public static Feature getFeature(PCM pcm, String ftName) { """ of course this is weird to put such methods as an helper/utility alternatives are to consider putting such facility as part of PCM class @param pcm @param ftName @return """ List<Feature> fts = pcm.getConcreteFeatures(); for (Feature ft : fts) { if (ft.getName().equals(ftName)) { return ft; } } return null; }
java
public static Feature getFeature(PCM pcm, String ftName) { List<Feature> fts = pcm.getConcreteFeatures(); for (Feature ft : fts) { if (ft.getName().equals(ftName)) { return ft; } } return null; }
[ "public", "static", "Feature", "getFeature", "(", "PCM", "pcm", ",", "String", "ftName", ")", "{", "List", "<", "Feature", ">", "fts", "=", "pcm", ".", "getConcreteFeatures", "(", ")", ";", "for", "(", "Feature", "ft", ":", "fts", ")", "{", "if", "("...
of course this is weird to put such methods as an helper/utility alternatives are to consider putting such facility as part of PCM class @param pcm @param ftName @return
[ "of", "course", "this", "is", "weird", "to", "put", "such", "methods", "as", "an", "helper", "/", "utility", "alternatives", "are", "to", "consider", "putting", "such", "facility", "as", "part", "of", "PCM", "class" ]
train
https://github.com/OpenCompare/OpenCompare/blob/6cd776466b375cb8ecca08fcd94e573d65e20b14/org.opencompare/pcmdata-importers/src/main/java/misc/PCMUtil.java#L28-L39
vkostyukov/la4j
src/main/java/org/la4j/Matrix.java
Matrix.slice
public Matrix slice(int fromRow, int fromColumn, int untilRow, int untilColumn) { """ Retrieves the specified sub-matrix of this matrix. The sub-matrix is specified by intervals for row indices and column indices. @param fromRow the beginning of the row indices interval @param fromColumn the beginning of the column indices interval @param untilRow the ending of the row indices interval @param untilColumn the ending of the column indices interval @return the sub-matrix of this matrix """ ensureIndexArgumentsAreInBounds(fromRow, fromColumn); ensureIndexArgumentsAreInBounds(untilRow - 1, untilColumn - 1); if (untilRow - fromRow < 0 || untilColumn - fromColumn < 0) { fail("Wrong slice range: [" + fromRow + ".." + untilRow + "][" + fromColumn + ".." + untilColumn + "]."); } Matrix result = blankOfShape(untilRow - fromRow, untilColumn - fromColumn); for (int i = fromRow; i < untilRow; i++) { for (int j = fromColumn; j < untilColumn; j++) { result.set(i - fromRow, j - fromColumn, get(i, j)); } } return result; }
java
public Matrix slice(int fromRow, int fromColumn, int untilRow, int untilColumn) { ensureIndexArgumentsAreInBounds(fromRow, fromColumn); ensureIndexArgumentsAreInBounds(untilRow - 1, untilColumn - 1); if (untilRow - fromRow < 0 || untilColumn - fromColumn < 0) { fail("Wrong slice range: [" + fromRow + ".." + untilRow + "][" + fromColumn + ".." + untilColumn + "]."); } Matrix result = blankOfShape(untilRow - fromRow, untilColumn - fromColumn); for (int i = fromRow; i < untilRow; i++) { for (int j = fromColumn; j < untilColumn; j++) { result.set(i - fromRow, j - fromColumn, get(i, j)); } } return result; }
[ "public", "Matrix", "slice", "(", "int", "fromRow", ",", "int", "fromColumn", ",", "int", "untilRow", ",", "int", "untilColumn", ")", "{", "ensureIndexArgumentsAreInBounds", "(", "fromRow", ",", "fromColumn", ")", ";", "ensureIndexArgumentsAreInBounds", "(", "unti...
Retrieves the specified sub-matrix of this matrix. The sub-matrix is specified by intervals for row indices and column indices. @param fromRow the beginning of the row indices interval @param fromColumn the beginning of the column indices interval @param untilRow the ending of the row indices interval @param untilColumn the ending of the column indices interval @return the sub-matrix of this matrix
[ "Retrieves", "the", "specified", "sub", "-", "matrix", "of", "this", "matrix", ".", "The", "sub", "-", "matrix", "is", "specified", "by", "intervals", "for", "row", "indices", "and", "column", "indices", "." ]
train
https://github.com/vkostyukov/la4j/blob/dd1b917caf9606399a49afa6b0d738934cd3a7b3/src/main/java/org/la4j/Matrix.java#L1281-L1298
lessthanoptimal/BoofCV
integration/boofcv-swing/src/main/java/boofcv/gui/feature/VisualizeRegions.java
VisualizeRegions.regionsColor
public static BufferedImage regionsColor( GrayS32 pixelToRegion , FastQueue<float[]> segmentColor , BufferedImage output ) { """ Draws each region using the provided color @param pixelToRegion Conversion from pixel to region @param segmentColor Color of each region @param output Storage for output image. Can be null. @return Output image. """ if( output == null ) output = new BufferedImage(pixelToRegion.width,pixelToRegion.height,BufferedImage.TYPE_INT_RGB); for( int y = 0; y < pixelToRegion.height; y++ ) { for( int x = 0; x < pixelToRegion.width; x++ ) { int index = pixelToRegion.unsafe_get(x,y); float []cv = segmentColor.get(index); int r,g,b; if( cv.length == 3 ) { r = (int)cv[0]; g = (int)cv[1]; b = (int)cv[2]; } else { r = g = b = (int)cv[0]; } int rgb = r << 16 | g << 8 | b; output.setRGB(x, y, rgb); } } return output; }
java
public static BufferedImage regionsColor( GrayS32 pixelToRegion , FastQueue<float[]> segmentColor , BufferedImage output ) { if( output == null ) output = new BufferedImage(pixelToRegion.width,pixelToRegion.height,BufferedImage.TYPE_INT_RGB); for( int y = 0; y < pixelToRegion.height; y++ ) { for( int x = 0; x < pixelToRegion.width; x++ ) { int index = pixelToRegion.unsafe_get(x,y); float []cv = segmentColor.get(index); int r,g,b; if( cv.length == 3 ) { r = (int)cv[0]; g = (int)cv[1]; b = (int)cv[2]; } else { r = g = b = (int)cv[0]; } int rgb = r << 16 | g << 8 | b; output.setRGB(x, y, rgb); } } return output; }
[ "public", "static", "BufferedImage", "regionsColor", "(", "GrayS32", "pixelToRegion", ",", "FastQueue", "<", "float", "[", "]", ">", "segmentColor", ",", "BufferedImage", "output", ")", "{", "if", "(", "output", "==", "null", ")", "output", "=", "new", "Buff...
Draws each region using the provided color @param pixelToRegion Conversion from pixel to region @param segmentColor Color of each region @param output Storage for output image. Can be null. @return Output image.
[ "Draws", "each", "region", "using", "the", "provided", "color" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/integration/boofcv-swing/src/main/java/boofcv/gui/feature/VisualizeRegions.java#L96-L124
UrielCh/ovh-java-sdk
ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java
ApiOvhMe.voucher_checkValidity_POST
public OvhVoucherStatus voucher_checkValidity_POST(String voucher) throws IOException { """ Verify existing voucher REST: POST /me/voucher/checkValidity @param voucher [required] Voucher value """ String qPath = "/me/voucher/checkValidity"; StringBuilder sb = path(qPath); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "voucher", voucher); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhVoucherStatus.class); }
java
public OvhVoucherStatus voucher_checkValidity_POST(String voucher) throws IOException { String qPath = "/me/voucher/checkValidity"; StringBuilder sb = path(qPath); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "voucher", voucher); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhVoucherStatus.class); }
[ "public", "OvhVoucherStatus", "voucher_checkValidity_POST", "(", "String", "voucher", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/me/voucher/checkValidity\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ")", ";", "HashMap", "<", "String...
Verify existing voucher REST: POST /me/voucher/checkValidity @param voucher [required] Voucher value
[ "Verify", "existing", "voucher" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L1522-L1529
biojava/biojava
biojava-alignment/src/main/java/org/biojava/nbio/alignment/template/AbstractProfileProfileAligner.java
AbstractProfileProfileAligner.setQuery
public void setQuery(Profile<S, C> query) { """ Sets the query {@link Profile}. @param query the first {@link Profile} of the pair to align """ this.query = query; queryFuture = null; reset(); }
java
public void setQuery(Profile<S, C> query) { this.query = query; queryFuture = null; reset(); }
[ "public", "void", "setQuery", "(", "Profile", "<", "S", ",", "C", ">", "query", ")", "{", "this", ".", "query", "=", "query", ";", "queryFuture", "=", "null", ";", "reset", "(", ")", ";", "}" ]
Sets the query {@link Profile}. @param query the first {@link Profile} of the pair to align
[ "Sets", "the", "query", "{", "@link", "Profile", "}", "." ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-alignment/src/main/java/org/biojava/nbio/alignment/template/AbstractProfileProfileAligner.java#L143-L147
alkacon/opencms-core
src/org/opencms/site/CmsSiteManagerImpl.java
CmsSiteManagerImpl.updateSite
public void updateSite(CmsObject cms, CmsSite oldSite, CmsSite newSite) throws CmsException { """ Updates or creates a site.<p> @param cms the CMS object @param oldSite the site to remove if not <code>null</code> @param newSite the site to add if not <code>null</code> @throws CmsException if something goes wrong """ if (oldSite != null) { // remove the old site removeSite(cms, oldSite); } if (newSite != null) { // add the new site addSite(cms, newSite); } }
java
public void updateSite(CmsObject cms, CmsSite oldSite, CmsSite newSite) throws CmsException { if (oldSite != null) { // remove the old site removeSite(cms, oldSite); } if (newSite != null) { // add the new site addSite(cms, newSite); } }
[ "public", "void", "updateSite", "(", "CmsObject", "cms", ",", "CmsSite", "oldSite", ",", "CmsSite", "newSite", ")", "throws", "CmsException", "{", "if", "(", "oldSite", "!=", "null", ")", "{", "// remove the old site", "removeSite", "(", "cms", ",", "oldSite",...
Updates or creates a site.<p> @param cms the CMS object @param oldSite the site to remove if not <code>null</code> @param newSite the site to add if not <code>null</code> @throws CmsException if something goes wrong
[ "Updates", "or", "creates", "a", "site", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/site/CmsSiteManagerImpl.java#L1592-L1603
line/armeria
core/src/main/java/com/linecorp/armeria/server/streaming/ServerSentEvents.java
ServerSentEvents.fromPublisher
public static HttpResponse fromPublisher(Publisher<? extends ServerSentEvent> contentPublisher) { """ Creates a new Server-Sent Events stream from the specified {@link Publisher}. @param contentPublisher the {@link Publisher} which publishes the objects supposed to send as contents """ return fromPublisher(defaultHttpHeaders, contentPublisher, HttpHeaders.EMPTY_HEADERS); }
java
public static HttpResponse fromPublisher(Publisher<? extends ServerSentEvent> contentPublisher) { return fromPublisher(defaultHttpHeaders, contentPublisher, HttpHeaders.EMPTY_HEADERS); }
[ "public", "static", "HttpResponse", "fromPublisher", "(", "Publisher", "<", "?", "extends", "ServerSentEvent", ">", "contentPublisher", ")", "{", "return", "fromPublisher", "(", "defaultHttpHeaders", ",", "contentPublisher", ",", "HttpHeaders", ".", "EMPTY_HEADERS", "...
Creates a new Server-Sent Events stream from the specified {@link Publisher}. @param contentPublisher the {@link Publisher} which publishes the objects supposed to send as contents
[ "Creates", "a", "new", "Server", "-", "Sent", "Events", "stream", "from", "the", "specified", "{", "@link", "Publisher", "}", "." ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/server/streaming/ServerSentEvents.java#L87-L89
PureSolTechnologies/commons
misc/src/main/java/com/puresoltechnologies/commons/misc/progress/AbstractProgressObservable.java
AbstractProgressObservable.fireUpdateWork
protected final void fireUpdateWork(String message, long finished) { """ This method is used to fire the {@link ProgressObserver#updateWork(Object, String, long)} for all observers. @param message is the message to be broadcasted. @param finished is the finished amount since the last call of this method. """ Iterator<WeakReference<ProgressObserver<Observable>>> iterator = observers .iterator(); while (iterator.hasNext()) { WeakReference<ProgressObserver<Observable>> weakReference = iterator .next(); ProgressObserver<Observable> observer = weakReference.get(); if (observer == null) { observers.remove(weakReference); } else { observer.updateWork(observable, message, finished); } } }
java
protected final void fireUpdateWork(String message, long finished) { Iterator<WeakReference<ProgressObserver<Observable>>> iterator = observers .iterator(); while (iterator.hasNext()) { WeakReference<ProgressObserver<Observable>> weakReference = iterator .next(); ProgressObserver<Observable> observer = weakReference.get(); if (observer == null) { observers.remove(weakReference); } else { observer.updateWork(observable, message, finished); } } }
[ "protected", "final", "void", "fireUpdateWork", "(", "String", "message", ",", "long", "finished", ")", "{", "Iterator", "<", "WeakReference", "<", "ProgressObserver", "<", "Observable", ">>>", "iterator", "=", "observers", ".", "iterator", "(", ")", ";", "whi...
This method is used to fire the {@link ProgressObserver#updateWork(Object, String, long)} for all observers. @param message is the message to be broadcasted. @param finished is the finished amount since the last call of this method.
[ "This", "method", "is", "used", "to", "fire", "the", "{", "@link", "ProgressObserver#updateWork", "(", "Object", "String", "long", ")", "}", "for", "all", "observers", "." ]
train
https://github.com/PureSolTechnologies/commons/blob/f98c23d8841a1ff61632ff17fe7d24f99dbc1d44/misc/src/main/java/com/puresoltechnologies/commons/misc/progress/AbstractProgressObservable.java#L95-L108
apache/groovy
src/main/java/org/codehaus/groovy/vmplugin/v7/TypeHelper.java
TypeHelper.argumentClassIsParameterClass
protected static boolean argumentClassIsParameterClass(Class argumentClass, Class parameterClass) { """ Realizes an unsharp equal for the class. In general we return true if the provided arguments are the same. But we will also return true if our argument class is a wrapper for the parameter class. For example the parameter is an int and the argument class is a wrapper. """ if (argumentClass == parameterClass) return true; if (getWrapperClass(parameterClass) == argumentClass) return true; return false; }
java
protected static boolean argumentClassIsParameterClass(Class argumentClass, Class parameterClass) { if (argumentClass == parameterClass) return true; if (getWrapperClass(parameterClass) == argumentClass) return true; return false; }
[ "protected", "static", "boolean", "argumentClassIsParameterClass", "(", "Class", "argumentClass", ",", "Class", "parameterClass", ")", "{", "if", "(", "argumentClass", "==", "parameterClass", ")", "return", "true", ";", "if", "(", "getWrapperClass", "(", "parameterC...
Realizes an unsharp equal for the class. In general we return true if the provided arguments are the same. But we will also return true if our argument class is a wrapper for the parameter class. For example the parameter is an int and the argument class is a wrapper.
[ "Realizes", "an", "unsharp", "equal", "for", "the", "class", ".", "In", "general", "we", "return", "true", "if", "the", "provided", "arguments", "are", "the", "same", ".", "But", "we", "will", "also", "return", "true", "if", "our", "argument", "class", "...
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/vmplugin/v7/TypeHelper.java#L66-L70
gallandarakhneorg/afc
core/util/src/main/java/org/arakhne/afc/util/ListUtil.java
ListUtil.addIfAbsent
@Inline(value = "add($1, $2, $3, false, false)") public static <E> int addIfAbsent(List<E> list, Comparator<? super E> comparator, E data) { """ Add the given element in the main list using a dichotomic algorithm if the element is not already present. <p>This function ensure that the comparator is invoked as: <code>comparator(data, dataAlreadyInList)</code>. @param <E> is the type of the elements in the list. @param list is the list to change. @param comparator is the comparator of elements. @param data is the data to insert. @return the index where the element was inserted, or <code>-1</code> if the element was not inserted. @since 14.0 """ return add(list, comparator, data, false, false); }
java
@Inline(value = "add($1, $2, $3, false, false)") public static <E> int addIfAbsent(List<E> list, Comparator<? super E> comparator, E data) { return add(list, comparator, data, false, false); }
[ "@", "Inline", "(", "value", "=", "\"add($1, $2, $3, false, false)\"", ")", "public", "static", "<", "E", ">", "int", "addIfAbsent", "(", "List", "<", "E", ">", "list", ",", "Comparator", "<", "?", "super", "E", ">", "comparator", ",", "E", "data", ")", ...
Add the given element in the main list using a dichotomic algorithm if the element is not already present. <p>This function ensure that the comparator is invoked as: <code>comparator(data, dataAlreadyInList)</code>. @param <E> is the type of the elements in the list. @param list is the list to change. @param comparator is the comparator of elements. @param data is the data to insert. @return the index where the element was inserted, or <code>-1</code> if the element was not inserted. @since 14.0
[ "Add", "the", "given", "element", "in", "the", "main", "list", "using", "a", "dichotomic", "algorithm", "if", "the", "element", "is", "not", "already", "present", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/util/src/main/java/org/arakhne/afc/util/ListUtil.java#L92-L95
geomajas/geomajas-project-client-gwt2
plugin/corewidget/corewidget/src/main/java/org/geomajas/gwt2/plugin/corewidget/client/feature/featureinfo/builder/AttributeWidgetFactory.java
AttributeWidgetFactory.createAttributeWidget
public Widget createAttributeWidget(Feature feature, AttributeDescriptor descriptor) { """ Create a widget for an attribute of a {@link Feature}. @param feature the feature of the attribute. @param descriptor the descriptor of the attribute of the feature. @return the (possible custom) widget for a feature attribute. """ Attribute<?> attribute = feature.getAttributes().get(descriptor.getName()); // Get a builder for the attribute // attribute.getValue is e.g. StringAttribute, ImageURLAttribute, ... AttributeWidgetBuilder builder = builders.get(attribute.getValue().getClass()); if (builder == null) { builder = new DefaultAttributeWidgetBuilder(); } // Build the widget and return it: return builder.buildAttributeWidget(attribute.getValue()); }
java
public Widget createAttributeWidget(Feature feature, AttributeDescriptor descriptor) { Attribute<?> attribute = feature.getAttributes().get(descriptor.getName()); // Get a builder for the attribute // attribute.getValue is e.g. StringAttribute, ImageURLAttribute, ... AttributeWidgetBuilder builder = builders.get(attribute.getValue().getClass()); if (builder == null) { builder = new DefaultAttributeWidgetBuilder(); } // Build the widget and return it: return builder.buildAttributeWidget(attribute.getValue()); }
[ "public", "Widget", "createAttributeWidget", "(", "Feature", "feature", ",", "AttributeDescriptor", "descriptor", ")", "{", "Attribute", "<", "?", ">", "attribute", "=", "feature", ".", "getAttributes", "(", ")", ".", "get", "(", "descriptor", ".", "getName", ...
Create a widget for an attribute of a {@link Feature}. @param feature the feature of the attribute. @param descriptor the descriptor of the attribute of the feature. @return the (possible custom) widget for a feature attribute.
[ "Create", "a", "widget", "for", "an", "attribute", "of", "a", "{", "@link", "Feature", "}", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/plugin/corewidget/corewidget/src/main/java/org/geomajas/gwt2/plugin/corewidget/client/feature/featureinfo/builder/AttributeWidgetFactory.java#L56-L68
alkacon/opencms-core
src/org/opencms/main/CmsShellCommands.java
CmsShellCommands.createUser
public CmsUser createUser(String name, String password, String description) throws Exception { """ Creates a new user.<p> @param name the name for the new user @param password the password for the new user @param description the description for the new user @throws Exception if something goes wrong @see CmsObject#createUser(String, String, String, java.util.Map) @return the created user """ if (existsUser(name)) { m_shell.getOut().println(getMessages().key(Messages.GUI_SHELL_USER_ALREADY_EXISTS_1, name)); return null; } return m_cms.createUser(name, password, description, new Hashtable<String, Object>()); }
java
public CmsUser createUser(String name, String password, String description) throws Exception { if (existsUser(name)) { m_shell.getOut().println(getMessages().key(Messages.GUI_SHELL_USER_ALREADY_EXISTS_1, name)); return null; } return m_cms.createUser(name, password, description, new Hashtable<String, Object>()); }
[ "public", "CmsUser", "createUser", "(", "String", "name", ",", "String", "password", ",", "String", "description", ")", "throws", "Exception", "{", "if", "(", "existsUser", "(", "name", ")", ")", "{", "m_shell", ".", "getOut", "(", ")", ".", "println", "...
Creates a new user.<p> @param name the name for the new user @param password the password for the new user @param description the description for the new user @throws Exception if something goes wrong @see CmsObject#createUser(String, String, String, java.util.Map) @return the created user
[ "Creates", "a", "new", "user", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/main/CmsShellCommands.java#L381-L388
jenkinsci/pipeline-maven-plugin
jenkins-plugin/src/main/java/org/jenkinsci/plugins/pipeline/maven/WithMavenStepExecution2.java
WithMavenStepExecution2.generateMavenWrapperScriptContent
private String generateMavenWrapperScriptContent(@Nonnull FilePath mvnExec, @Nonnull String mavenConfig) throws AbortException { """ Generates the content of the maven wrapper script @param mvnExec maven executable location @param mavenConfig config arguments added to the "mvn" command line @return wrapper script content @throws AbortException when problems creating content """ boolean isUnix = Boolean.TRUE.equals(getComputer().isUnix()); StringBuilder script = new StringBuilder(); if (isUnix) { // Linux, Unix, MacOSX String lineSep = "\n"; script.append("#!/bin/sh -e").append(lineSep); script.append("echo ----- withMaven Wrapper script -----").append(lineSep); script.append("\"" + mvnExec.getRemote() + "\" " + mavenConfig + " \"$@\"").append(lineSep); } else { // Windows String lineSep = "\r\n"; script.append("@echo off").append(lineSep); script.append("echo ----- withMaven Wrapper script -----").append(lineSep); script.append("\"" + mvnExec.getRemote() + "\" " + mavenConfig + " %*").append(lineSep); } LOGGER.log(Level.FINER, "Generated Maven wrapper script: \n{0}", script); return script.toString(); }
java
private String generateMavenWrapperScriptContent(@Nonnull FilePath mvnExec, @Nonnull String mavenConfig) throws AbortException { boolean isUnix = Boolean.TRUE.equals(getComputer().isUnix()); StringBuilder script = new StringBuilder(); if (isUnix) { // Linux, Unix, MacOSX String lineSep = "\n"; script.append("#!/bin/sh -e").append(lineSep); script.append("echo ----- withMaven Wrapper script -----").append(lineSep); script.append("\"" + mvnExec.getRemote() + "\" " + mavenConfig + " \"$@\"").append(lineSep); } else { // Windows String lineSep = "\r\n"; script.append("@echo off").append(lineSep); script.append("echo ----- withMaven Wrapper script -----").append(lineSep); script.append("\"" + mvnExec.getRemote() + "\" " + mavenConfig + " %*").append(lineSep); } LOGGER.log(Level.FINER, "Generated Maven wrapper script: \n{0}", script); return script.toString(); }
[ "private", "String", "generateMavenWrapperScriptContent", "(", "@", "Nonnull", "FilePath", "mvnExec", ",", "@", "Nonnull", "String", "mavenConfig", ")", "throws", "AbortException", "{", "boolean", "isUnix", "=", "Boolean", ".", "TRUE", ".", "equals", "(", "getComp...
Generates the content of the maven wrapper script @param mvnExec maven executable location @param mavenConfig config arguments added to the "mvn" command line @return wrapper script content @throws AbortException when problems creating content
[ "Generates", "the", "content", "of", "the", "maven", "wrapper", "script" ]
train
https://github.com/jenkinsci/pipeline-maven-plugin/blob/685d7dbb894fb4c976dbfa922e3caba8e8d5bed8/jenkins-plugin/src/main/java/org/jenkinsci/plugins/pipeline/maven/WithMavenStepExecution2.java#L603-L624
b3dgs/lionengine
lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/pathfinding/PathfindableModel.java
PathfindableModel.takeNextStep
private void takeNextStep(int lastStep, int nextStep) { """ Update the next step has it is free. @param lastStep The last step. @param nextStep The next step. """ if (!pathStoppedRequested) { removeObjectId(path.getX(lastStep), path.getY(lastStep)); assignObjectId(path.getX(nextStep), path.getY(nextStep)); } }
java
private void takeNextStep(int lastStep, int nextStep) { if (!pathStoppedRequested) { removeObjectId(path.getX(lastStep), path.getY(lastStep)); assignObjectId(path.getX(nextStep), path.getY(nextStep)); } }
[ "private", "void", "takeNextStep", "(", "int", "lastStep", ",", "int", "nextStep", ")", "{", "if", "(", "!", "pathStoppedRequested", ")", "{", "removeObjectId", "(", "path", ".", "getX", "(", "lastStep", ")", ",", "path", ".", "getY", "(", "lastStep", ")...
Update the next step has it is free. @param lastStep The last step. @param nextStep The next step.
[ "Update", "the", "next", "step", "has", "it", "is", "free", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/pathfinding/PathfindableModel.java#L232-L239