repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
sequencelengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
sequencelengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
hawtio/hawtio
hawtio-util/src/main/java/io/hawt/util/Zips.java
Zips.createZipFile
public static void createZipFile(Logger log, File sourceDir, File outputZipFile) throws IOException { """ Creates a zip fie from the given source directory and output zip file name """ FileFilter filter = null; createZipFile(log, sourceDir, outputZipFile, filter); }
java
public static void createZipFile(Logger log, File sourceDir, File outputZipFile) throws IOException { FileFilter filter = null; createZipFile(log, sourceDir, outputZipFile, filter); }
[ "public", "static", "void", "createZipFile", "(", "Logger", "log", ",", "File", "sourceDir", ",", "File", "outputZipFile", ")", "throws", "IOException", "{", "FileFilter", "filter", "=", "null", ";", "createZipFile", "(", "log", ",", "sourceDir", ",", "outputZipFile", ",", "filter", ")", ";", "}" ]
Creates a zip fie from the given source directory and output zip file name
[ "Creates", "a", "zip", "fie", "from", "the", "given", "source", "directory", "and", "output", "zip", "file", "name" ]
train
https://github.com/hawtio/hawtio/blob/d8b1c8f246307c0313ba297a494106d0859f3ffd/hawtio-util/src/main/java/io/hawt/util/Zips.java#L43-L46
xwiki/xwiki-rendering
xwiki-rendering-syntaxes/xwiki-rendering-syntax-xhtml/src/main/java/org/xwiki/rendering/internal/parser/xhtml/wikimodel/XHTMLXWikiGeneratorListener.java
XHTMLXWikiGeneratorListener.computeResourceReference
private ResourceReference computeResourceReference(String rawReference) { """ Recognize the passed reference and figure out what type of link it should be: <ul> <li>UC1: the reference points to a valid URL, we return a reference of type "url", e.g. {@code http://server/path/reference#anchor}</li> <li>UC2: the reference is not a valid URL, we return a reference of type "path", e.g. {@code path/reference#anchor}</li> </ul> @param rawReference the full reference (e.g. "/some/path/something#other") @return the properly typed {@link ResourceReference} matching the use cases """ ResourceReference reference; // Do we have a valid URL? Matcher matcher = URL_SCHEME_PATTERN.matcher(rawReference); if (matcher.lookingAt()) { // We have UC1 reference = new ResourceReference(rawReference, ResourceType.URL); } else { // We have UC2 reference = new ResourceReference(rawReference, ResourceType.PATH); } return reference; }
java
private ResourceReference computeResourceReference(String rawReference) { ResourceReference reference; // Do we have a valid URL? Matcher matcher = URL_SCHEME_PATTERN.matcher(rawReference); if (matcher.lookingAt()) { // We have UC1 reference = new ResourceReference(rawReference, ResourceType.URL); } else { // We have UC2 reference = new ResourceReference(rawReference, ResourceType.PATH); } return reference; }
[ "private", "ResourceReference", "computeResourceReference", "(", "String", "rawReference", ")", "{", "ResourceReference", "reference", ";", "// Do we have a valid URL?", "Matcher", "matcher", "=", "URL_SCHEME_PATTERN", ".", "matcher", "(", "rawReference", ")", ";", "if", "(", "matcher", ".", "lookingAt", "(", ")", ")", "{", "// We have UC1", "reference", "=", "new", "ResourceReference", "(", "rawReference", ",", "ResourceType", ".", "URL", ")", ";", "}", "else", "{", "// We have UC2", "reference", "=", "new", "ResourceReference", "(", "rawReference", ",", "ResourceType", ".", "PATH", ")", ";", "}", "return", "reference", ";", "}" ]
Recognize the passed reference and figure out what type of link it should be: <ul> <li>UC1: the reference points to a valid URL, we return a reference of type "url", e.g. {@code http://server/path/reference#anchor}</li> <li>UC2: the reference is not a valid URL, we return a reference of type "path", e.g. {@code path/reference#anchor}</li> </ul> @param rawReference the full reference (e.g. "/some/path/something#other") @return the properly typed {@link ResourceReference} matching the use cases
[ "Recognize", "the", "passed", "reference", "and", "figure", "out", "what", "type", "of", "link", "it", "should", "be", ":", "<ul", ">", "<li", ">", "UC1", ":", "the", "reference", "points", "to", "a", "valid", "URL", "we", "return", "a", "reference", "of", "type", "url", "e", ".", "g", ".", "{", "@code", "http", ":", "//", "server", "/", "path", "/", "reference#anchor", "}", "<", "/", "li", ">", "<li", ">", "UC2", ":", "the", "reference", "is", "not", "a", "valid", "URL", "we", "return", "a", "reference", "of", "type", "path", "e", ".", "g", ".", "{", "@code", "path", "/", "reference#anchor", "}", "<", "/", "li", ">", "<", "/", "ul", ">" ]
train
https://github.com/xwiki/xwiki-rendering/blob/a21cdfcb64ef5b76872e3eedf78c530f26d7beb0/xwiki-rendering-syntaxes/xwiki-rendering-syntax-xhtml/src/main/java/org/xwiki/rendering/internal/parser/xhtml/wikimodel/XHTMLXWikiGeneratorListener.java#L152-L167
zaproxy/zaproxy
src/org/parosproxy/paros/model/SiteMap.java
SiteMap.addPath
public synchronized SiteNode addPath(HistoryReference ref) { """ Add the HistoryReference into the SiteMap. This method will rely on reading message from the History table. Note that this method must only be called on the EventDispatchThread @param ref """ if (Constant.isLowMemoryOptionSet()) { throw new InvalidParameterException("SiteMap should not be accessed when the low memory option is set"); } HttpMessage msg = null; try { msg = ref.getHttpMessage(); } catch (Exception e) { // ZAP: Added error log.error(e.getMessage(), e); return null; } return addPath(ref, msg); }
java
public synchronized SiteNode addPath(HistoryReference ref) { if (Constant.isLowMemoryOptionSet()) { throw new InvalidParameterException("SiteMap should not be accessed when the low memory option is set"); } HttpMessage msg = null; try { msg = ref.getHttpMessage(); } catch (Exception e) { // ZAP: Added error log.error(e.getMessage(), e); return null; } return addPath(ref, msg); }
[ "public", "synchronized", "SiteNode", "addPath", "(", "HistoryReference", "ref", ")", "{", "if", "(", "Constant", ".", "isLowMemoryOptionSet", "(", ")", ")", "{", "throw", "new", "InvalidParameterException", "(", "\"SiteMap should not be accessed when the low memory option is set\"", ")", ";", "}", "HttpMessage", "msg", "=", "null", ";", "try", "{", "msg", "=", "ref", ".", "getHttpMessage", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "// ZAP: Added error\r", "log", ".", "error", "(", "e", ".", "getMessage", "(", ")", ",", "e", ")", ";", "return", "null", ";", "}", "return", "addPath", "(", "ref", ",", "msg", ")", ";", "}" ]
Add the HistoryReference into the SiteMap. This method will rely on reading message from the History table. Note that this method must only be called on the EventDispatchThread @param ref
[ "Add", "the", "HistoryReference", "into", "the", "SiteMap", ".", "This", "method", "will", "rely", "on", "reading", "message", "from", "the", "History", "table", ".", "Note", "that", "this", "method", "must", "only", "be", "called", "on", "the", "EventDispatchThread" ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/parosproxy/paros/model/SiteMap.java#L347-L362
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/config/Config.java
Config.setScheduledExecutorConfigs
public Config setScheduledExecutorConfigs(Map<String, ScheduledExecutorConfig> scheduledExecutorConfigs) { """ Sets the map of scheduled executor configurations, mapped by config name. The config name may be a pattern with which the configuration will be obtained in the future. @param scheduledExecutorConfigs the scheduled executor configuration map to set @return this config instance """ this.scheduledExecutorConfigs.clear(); this.scheduledExecutorConfigs.putAll(scheduledExecutorConfigs); for (Entry<String, ScheduledExecutorConfig> entry : scheduledExecutorConfigs.entrySet()) { entry.getValue().setName(entry.getKey()); } return this; }
java
public Config setScheduledExecutorConfigs(Map<String, ScheduledExecutorConfig> scheduledExecutorConfigs) { this.scheduledExecutorConfigs.clear(); this.scheduledExecutorConfigs.putAll(scheduledExecutorConfigs); for (Entry<String, ScheduledExecutorConfig> entry : scheduledExecutorConfigs.entrySet()) { entry.getValue().setName(entry.getKey()); } return this; }
[ "public", "Config", "setScheduledExecutorConfigs", "(", "Map", "<", "String", ",", "ScheduledExecutorConfig", ">", "scheduledExecutorConfigs", ")", "{", "this", ".", "scheduledExecutorConfigs", ".", "clear", "(", ")", ";", "this", ".", "scheduledExecutorConfigs", ".", "putAll", "(", "scheduledExecutorConfigs", ")", ";", "for", "(", "Entry", "<", "String", ",", "ScheduledExecutorConfig", ">", "entry", ":", "scheduledExecutorConfigs", ".", "entrySet", "(", ")", ")", "{", "entry", ".", "getValue", "(", ")", ".", "setName", "(", "entry", ".", "getKey", "(", ")", ")", ";", "}", "return", "this", ";", "}" ]
Sets the map of scheduled executor configurations, mapped by config name. The config name may be a pattern with which the configuration will be obtained in the future. @param scheduledExecutorConfigs the scheduled executor configuration map to set @return this config instance
[ "Sets", "the", "map", "of", "scheduled", "executor", "configurations", "mapped", "by", "config", "name", ".", "The", "config", "name", "may", "be", "a", "pattern", "with", "which", "the", "configuration", "will", "be", "obtained", "in", "the", "future", "." ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/config/Config.java#L2210-L2217
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/CustomVisionTrainingManager.java
CustomVisionTrainingManager.authenticate
public static TrainingApi authenticate(String baseUrl, ServiceClientCredentials credentials, final String apiKey) { """ Initializes an instance of Custom Vision Training API client. @param baseUrl the base URL of the service @param credentials the management credentials for Azure @param apiKey the Custom Vision Training API key @return the Custom Vision Training API client """ return new TrainingApiImpl(baseUrl, credentials).withApiKey(apiKey); }
java
public static TrainingApi authenticate(String baseUrl, ServiceClientCredentials credentials, final String apiKey) { return new TrainingApiImpl(baseUrl, credentials).withApiKey(apiKey); }
[ "public", "static", "TrainingApi", "authenticate", "(", "String", "baseUrl", ",", "ServiceClientCredentials", "credentials", ",", "final", "String", "apiKey", ")", "{", "return", "new", "TrainingApiImpl", "(", "baseUrl", ",", "credentials", ")", ".", "withApiKey", "(", "apiKey", ")", ";", "}" ]
Initializes an instance of Custom Vision Training API client. @param baseUrl the base URL of the service @param credentials the management credentials for Azure @param apiKey the Custom Vision Training API key @return the Custom Vision Training API client
[ "Initializes", "an", "instance", "of", "Custom", "Vision", "Training", "API", "client", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/CustomVisionTrainingManager.java#L63-L65
qatools/properties
src/main/java/ru/qatools/properties/PropertyLoader.java
PropertyLoader.getCollectionElementType
protected Class<?> getCollectionElementType(Type genericType) throws ConversionException { """ Get collection element type for given type. Given type type should be assignable from {@link Collection}. For collections without generic returns {@link String}. """ if (genericType instanceof ParameterizedType) { ParameterizedType parameterizedType = (ParameterizedType) genericType; Type[] typeArguments = parameterizedType.getActualTypeArguments(); if (typeArguments.length != 1) { throw new ConversionException("Types with more then one generic are not supported"); } Type type = typeArguments[0]; if (type instanceof Class) { return (Class<?>) type; } throw new ConversionException(String.format("Could not resolve generic type <%s>", type)); } return String.class; }
java
protected Class<?> getCollectionElementType(Type genericType) throws ConversionException { if (genericType instanceof ParameterizedType) { ParameterizedType parameterizedType = (ParameterizedType) genericType; Type[] typeArguments = parameterizedType.getActualTypeArguments(); if (typeArguments.length != 1) { throw new ConversionException("Types with more then one generic are not supported"); } Type type = typeArguments[0]; if (type instanceof Class) { return (Class<?>) type; } throw new ConversionException(String.format("Could not resolve generic type <%s>", type)); } return String.class; }
[ "protected", "Class", "<", "?", ">", "getCollectionElementType", "(", "Type", "genericType", ")", "throws", "ConversionException", "{", "if", "(", "genericType", "instanceof", "ParameterizedType", ")", "{", "ParameterizedType", "parameterizedType", "=", "(", "ParameterizedType", ")", "genericType", ";", "Type", "[", "]", "typeArguments", "=", "parameterizedType", ".", "getActualTypeArguments", "(", ")", ";", "if", "(", "typeArguments", ".", "length", "!=", "1", ")", "{", "throw", "new", "ConversionException", "(", "\"Types with more then one generic are not supported\"", ")", ";", "}", "Type", "type", "=", "typeArguments", "[", "0", "]", ";", "if", "(", "type", "instanceof", "Class", ")", "{", "return", "(", "Class", "<", "?", ">", ")", "type", ";", "}", "throw", "new", "ConversionException", "(", "String", ".", "format", "(", "\"Could not resolve generic type <%s>\"", ",", "type", ")", ")", ";", "}", "return", "String", ".", "class", ";", "}" ]
Get collection element type for given type. Given type type should be assignable from {@link Collection}. For collections without generic returns {@link String}.
[ "Get", "collection", "element", "type", "for", "given", "type", ".", "Given", "type", "type", "should", "be", "assignable", "from", "{" ]
train
https://github.com/qatools/properties/blob/ae50b460a6bb4fcb21afe888b2e86a7613cd2115/src/main/java/ru/qatools/properties/PropertyLoader.java#L319-L335
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/source/util/SimpleDocTreeVisitor.java
SimpleDocTreeVisitor.visitReturn
@Override public R visitReturn(ReturnTree node, P p) { """ {@inheritDoc} This implementation calls {@code defaultAction}. @param node {@inheritDoc} @param p {@inheritDoc} @return the result of {@code defaultAction} """ return defaultAction(node, p); }
java
@Override public R visitReturn(ReturnTree node, P p) { return defaultAction(node, p); }
[ "@", "Override", "public", "R", "visitReturn", "(", "ReturnTree", "node", ",", "P", "p", ")", "{", "return", "defaultAction", "(", "node", ",", "p", ")", ";", "}" ]
{@inheritDoc} This implementation calls {@code defaultAction}. @param node {@inheritDoc} @param p {@inheritDoc} @return the result of {@code defaultAction}
[ "{", "@inheritDoc", "}", "This", "implementation", "calls", "{", "@code", "defaultAction", "}", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/source/util/SimpleDocTreeVisitor.java#L321-L324
alkacon/opencms-core
src/org/opencms/security/CmsRoleManager.java
CmsRoleManager.hasRole
public boolean hasRole(CmsObject cms, CmsRole role) { """ Checks if the given context user has the given role in the given organizational unit.<p> @param cms the opencms context @param role the role to check @return <code>true</code> if the given context user has the given role in the given organizational unit """ return m_securityManager.hasRole(cms.getRequestContext(), cms.getRequestContext().getCurrentUser(), role); }
java
public boolean hasRole(CmsObject cms, CmsRole role) { return m_securityManager.hasRole(cms.getRequestContext(), cms.getRequestContext().getCurrentUser(), role); }
[ "public", "boolean", "hasRole", "(", "CmsObject", "cms", ",", "CmsRole", "role", ")", "{", "return", "m_securityManager", ".", "hasRole", "(", "cms", ".", "getRequestContext", "(", ")", ",", "cms", ".", "getRequestContext", "(", ")", ".", "getCurrentUser", "(", ")", ",", "role", ")", ";", "}" ]
Checks if the given context user has the given role in the given organizational unit.<p> @param cms the opencms context @param role the role to check @return <code>true</code> if the given context user has the given role in the given organizational unit
[ "Checks", "if", "the", "given", "context", "user", "has", "the", "given", "role", "in", "the", "given", "organizational", "unit", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/security/CmsRoleManager.java#L426-L429
VoltDB/voltdb
src/frontend/org/voltdb/planner/FilterMatcher.java
FilterMatcher.revComparisonsMatch
private static boolean revComparisonsMatch(AbstractExpression e1, AbstractExpression e2) { """ Checks whether two expressions are comparisons, and are equivalent by reversing one, e.g. "a >= b" vs. "b <= a". @param e1 First expression @param e2 second expression @return Whether both are comparisons, and reversing first comparison equals the second. """ return e1 instanceof ComparisonExpression && e1.getExpressionType() == ComparisonExpression.reverses.get(e2.getExpressionType()) && new FilterMatcher(((ComparisonExpression) e1).reverseOperator(), e2).match(); }
java
private static boolean revComparisonsMatch(AbstractExpression e1, AbstractExpression e2) { return e1 instanceof ComparisonExpression && e1.getExpressionType() == ComparisonExpression.reverses.get(e2.getExpressionType()) && new FilterMatcher(((ComparisonExpression) e1).reverseOperator(), e2).match(); }
[ "private", "static", "boolean", "revComparisonsMatch", "(", "AbstractExpression", "e1", ",", "AbstractExpression", "e2", ")", "{", "return", "e1", "instanceof", "ComparisonExpression", "&&", "e1", ".", "getExpressionType", "(", ")", "==", "ComparisonExpression", ".", "reverses", ".", "get", "(", "e2", ".", "getExpressionType", "(", ")", ")", "&&", "new", "FilterMatcher", "(", "(", "(", "ComparisonExpression", ")", "e1", ")", ".", "reverseOperator", "(", ")", ",", "e2", ")", ".", "match", "(", ")", ";", "}" ]
Checks whether two expressions are comparisons, and are equivalent by reversing one, e.g. "a >= b" vs. "b <= a". @param e1 First expression @param e2 second expression @return Whether both are comparisons, and reversing first comparison equals the second.
[ "Checks", "whether", "two", "expressions", "are", "comparisons", "and", "are", "equivalent", "by", "reversing", "one", "e", ".", "g", ".", "a", ">", "=", "b", "vs", ".", "b", "<", "=", "a", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/planner/FilterMatcher.java#L136-L140
HadoopGenomics/Hadoop-BAM
src/main/java/org/seqdoop/hadoop_bam/util/IntervalUtil.java
IntervalUtil.getIntervals
public static List<Interval> getIntervals(final Configuration conf, final String intervalPropertyName) { """ Returns the list of intervals found in a string configuration property separated by colons. @param conf the source configuration. @param intervalPropertyName the property name holding the intervals. @return {@code null} if there is no such a property in the configuration. @throws NullPointerException if either input is null. """ final String intervalsProperty = conf.get(intervalPropertyName); if (intervalsProperty == null) { return null; } if (intervalsProperty.isEmpty()) { return ImmutableList.of(); } final List<Interval> intervals = new ArrayList<>(); for (final String s : intervalsProperty.split(",")) { final int lastColonIdx = s.lastIndexOf(':'); if (lastColonIdx < 0) { throw new FormatException("no colon found in interval string: " + s); } final int hyphenIdx = s.indexOf('-', lastColonIdx + 1); if (hyphenIdx < 0) { throw new FormatException("no hyphen found after colon interval string: " + s); } final String sequence = s.substring(0, lastColonIdx); final int start = parseIntOrThrowFormatException(s.substring(lastColonIdx + 1, hyphenIdx), "invalid start position", s); final int stop = parseIntOrThrowFormatException(s.substring(hyphenIdx + 1), "invalid stop position", s); intervals.add(new Interval(sequence, start, stop)); } return intervals; }
java
public static List<Interval> getIntervals(final Configuration conf, final String intervalPropertyName) { final String intervalsProperty = conf.get(intervalPropertyName); if (intervalsProperty == null) { return null; } if (intervalsProperty.isEmpty()) { return ImmutableList.of(); } final List<Interval> intervals = new ArrayList<>(); for (final String s : intervalsProperty.split(",")) { final int lastColonIdx = s.lastIndexOf(':'); if (lastColonIdx < 0) { throw new FormatException("no colon found in interval string: " + s); } final int hyphenIdx = s.indexOf('-', lastColonIdx + 1); if (hyphenIdx < 0) { throw new FormatException("no hyphen found after colon interval string: " + s); } final String sequence = s.substring(0, lastColonIdx); final int start = parseIntOrThrowFormatException(s.substring(lastColonIdx + 1, hyphenIdx), "invalid start position", s); final int stop = parseIntOrThrowFormatException(s.substring(hyphenIdx + 1), "invalid stop position", s); intervals.add(new Interval(sequence, start, stop)); } return intervals; }
[ "public", "static", "List", "<", "Interval", ">", "getIntervals", "(", "final", "Configuration", "conf", ",", "final", "String", "intervalPropertyName", ")", "{", "final", "String", "intervalsProperty", "=", "conf", ".", "get", "(", "intervalPropertyName", ")", ";", "if", "(", "intervalsProperty", "==", "null", ")", "{", "return", "null", ";", "}", "if", "(", "intervalsProperty", ".", "isEmpty", "(", ")", ")", "{", "return", "ImmutableList", ".", "of", "(", ")", ";", "}", "final", "List", "<", "Interval", ">", "intervals", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "final", "String", "s", ":", "intervalsProperty", ".", "split", "(", "\",\"", ")", ")", "{", "final", "int", "lastColonIdx", "=", "s", ".", "lastIndexOf", "(", "'", "'", ")", ";", "if", "(", "lastColonIdx", "<", "0", ")", "{", "throw", "new", "FormatException", "(", "\"no colon found in interval string: \"", "+", "s", ")", ";", "}", "final", "int", "hyphenIdx", "=", "s", ".", "indexOf", "(", "'", "'", ",", "lastColonIdx", "+", "1", ")", ";", "if", "(", "hyphenIdx", "<", "0", ")", "{", "throw", "new", "FormatException", "(", "\"no hyphen found after colon interval string: \"", "+", "s", ")", ";", "}", "final", "String", "sequence", "=", "s", ".", "substring", "(", "0", ",", "lastColonIdx", ")", ";", "final", "int", "start", "=", "parseIntOrThrowFormatException", "(", "s", ".", "substring", "(", "lastColonIdx", "+", "1", ",", "hyphenIdx", ")", ",", "\"invalid start position\"", ",", "s", ")", ";", "final", "int", "stop", "=", "parseIntOrThrowFormatException", "(", "s", ".", "substring", "(", "hyphenIdx", "+", "1", ")", ",", "\"invalid stop position\"", ",", "s", ")", ";", "intervals", ".", "add", "(", "new", "Interval", "(", "sequence", ",", "start", ",", "stop", ")", ")", ";", "}", "return", "intervals", ";", "}" ]
Returns the list of intervals found in a string configuration property separated by colons. @param conf the source configuration. @param intervalPropertyName the property name holding the intervals. @return {@code null} if there is no such a property in the configuration. @throws NullPointerException if either input is null.
[ "Returns", "the", "list", "of", "intervals", "found", "in", "a", "string", "configuration", "property", "separated", "by", "colons", "." ]
train
https://github.com/HadoopGenomics/Hadoop-BAM/blob/9f974cf635a8d72f69604021cc3d5f3469d38d2f/src/main/java/org/seqdoop/hadoop_bam/util/IntervalUtil.java#L27-L53
Azure/azure-sdk-for-java
appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java
AppServiceEnvironmentsInner.listMultiRolePoolSkusWithServiceResponseAsync
public Observable<ServiceResponse<Page<SkuInfoInner>>> listMultiRolePoolSkusWithServiceResponseAsync(final String resourceGroupName, final String name) { """ Get available SKUs for scaling a multi-role pool. Get available SKUs for scaling a multi-role pool. @param resourceGroupName Name of the resource group to which the resource belongs. @param name Name of the App Service Environment. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;SkuInfoInner&gt; object """ return listMultiRolePoolSkusSinglePageAsync(resourceGroupName, name) .concatMap(new Func1<ServiceResponse<Page<SkuInfoInner>>, Observable<ServiceResponse<Page<SkuInfoInner>>>>() { @Override public Observable<ServiceResponse<Page<SkuInfoInner>>> call(ServiceResponse<Page<SkuInfoInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listMultiRolePoolSkusNextWithServiceResponseAsync(nextPageLink)); } }); }
java
public Observable<ServiceResponse<Page<SkuInfoInner>>> listMultiRolePoolSkusWithServiceResponseAsync(final String resourceGroupName, final String name) { return listMultiRolePoolSkusSinglePageAsync(resourceGroupName, name) .concatMap(new Func1<ServiceResponse<Page<SkuInfoInner>>, Observable<ServiceResponse<Page<SkuInfoInner>>>>() { @Override public Observable<ServiceResponse<Page<SkuInfoInner>>> call(ServiceResponse<Page<SkuInfoInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listMultiRolePoolSkusNextWithServiceResponseAsync(nextPageLink)); } }); }
[ "public", "Observable", "<", "ServiceResponse", "<", "Page", "<", "SkuInfoInner", ">", ">", ">", "listMultiRolePoolSkusWithServiceResponseAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "name", ")", "{", "return", "listMultiRolePoolSkusSinglePageAsync", "(", "resourceGroupName", ",", "name", ")", ".", "concatMap", "(", "new", "Func1", "<", "ServiceResponse", "<", "Page", "<", "SkuInfoInner", ">", ">", ",", "Observable", "<", "ServiceResponse", "<", "Page", "<", "SkuInfoInner", ">", ">", ">", ">", "(", ")", "{", "@", "Override", "public", "Observable", "<", "ServiceResponse", "<", "Page", "<", "SkuInfoInner", ">", ">", ">", "call", "(", "ServiceResponse", "<", "Page", "<", "SkuInfoInner", ">", ">", "page", ")", "{", "String", "nextPageLink", "=", "page", ".", "body", "(", ")", ".", "nextPageLink", "(", ")", ";", "if", "(", "nextPageLink", "==", "null", ")", "{", "return", "Observable", ".", "just", "(", "page", ")", ";", "}", "return", "Observable", ".", "just", "(", "page", ")", ".", "concatWith", "(", "listMultiRolePoolSkusNextWithServiceResponseAsync", "(", "nextPageLink", ")", ")", ";", "}", "}", ")", ";", "}" ]
Get available SKUs for scaling a multi-role pool. Get available SKUs for scaling a multi-role pool. @param resourceGroupName Name of the resource group to which the resource belongs. @param name Name of the App Service Environment. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;SkuInfoInner&gt; object
[ "Get", "available", "SKUs", "for", "scaling", "a", "multi", "-", "role", "pool", ".", "Get", "available", "SKUs", "for", "scaling", "a", "multi", "-", "role", "pool", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java#L3431-L3443
liyiorg/weixin-popular
src/main/java/weixin/popular/util/SignatureUtil.java
SignatureUtil.validateSign
public static boolean validateSign(Map<String,String> map,String key) { """ mch 支付、代扣异步通知签名验证 @param map 参与签名的参数 @param key mch key @return boolean """ return validateSign(map, null, key); }
java
public static boolean validateSign(Map<String,String> map,String key){ return validateSign(map, null, key); }
[ "public", "static", "boolean", "validateSign", "(", "Map", "<", "String", ",", "String", ">", "map", ",", "String", "key", ")", "{", "return", "validateSign", "(", "map", ",", "null", ",", "key", ")", ";", "}" ]
mch 支付、代扣异步通知签名验证 @param map 参与签名的参数 @param key mch key @return boolean
[ "mch", "支付、代扣异步通知签名验证" ]
train
https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/util/SignatureUtil.java#L79-L81
BlueBrain/bluima
modules/bluima_scripting/src/main/java/ch/epfl/bbp/uima/laucher/Launcher.java
Launcher.runPipeline
public static void runPipeline(File scriptFile, List<String> cliArgs) throws IOException, UIMAException, ParseException { """ Parse this pipeline and run it @return true if no error during processing @throws ParseException """ if (!scriptFile.exists()) { throw new IOException("Script file does not exist (" + scriptFile.getAbsolutePath() + ")"); } LOG.info("Parsing pipeline script at '{}'", scriptFile.getAbsolutePath() + " \n with CLI parameters: " + join(cliArgs, ", ")); Pipeline pipeline = null; try { pipeline = PipelineScriptParser.parse(scriptFile, cliArgs); } catch (ParseException e) { throw new ParseException("\nERROR parsing '" + scriptFile.getName() + "'\n" + e.getMessage() + "\n(see the README.txt for the pipeline script format)", e.getErrorOffset()); } LOG.info("Successfully parsed pipeline script, now starting pipeline..."); LOG.info("*************************************************************"); pipeline.run(); // will be printed if no exception. // used in pipeline tests, do not change System.out.println(OK_MESSAGE); }
java
public static void runPipeline(File scriptFile, List<String> cliArgs) throws IOException, UIMAException, ParseException { if (!scriptFile.exists()) { throw new IOException("Script file does not exist (" + scriptFile.getAbsolutePath() + ")"); } LOG.info("Parsing pipeline script at '{}'", scriptFile.getAbsolutePath() + " \n with CLI parameters: " + join(cliArgs, ", ")); Pipeline pipeline = null; try { pipeline = PipelineScriptParser.parse(scriptFile, cliArgs); } catch (ParseException e) { throw new ParseException("\nERROR parsing '" + scriptFile.getName() + "'\n" + e.getMessage() + "\n(see the README.txt for the pipeline script format)", e.getErrorOffset()); } LOG.info("Successfully parsed pipeline script, now starting pipeline..."); LOG.info("*************************************************************"); pipeline.run(); // will be printed if no exception. // used in pipeline tests, do not change System.out.println(OK_MESSAGE); }
[ "public", "static", "void", "runPipeline", "(", "File", "scriptFile", ",", "List", "<", "String", ">", "cliArgs", ")", "throws", "IOException", ",", "UIMAException", ",", "ParseException", "{", "if", "(", "!", "scriptFile", ".", "exists", "(", ")", ")", "{", "throw", "new", "IOException", "(", "\"Script file does not exist (\"", "+", "scriptFile", ".", "getAbsolutePath", "(", ")", "+", "\")\"", ")", ";", "}", "LOG", ".", "info", "(", "\"Parsing pipeline script at '{}'\"", ",", "scriptFile", ".", "getAbsolutePath", "(", ")", "+", "\" \\n with CLI parameters: \"", "+", "join", "(", "cliArgs", ",", "\", \"", ")", ")", ";", "Pipeline", "pipeline", "=", "null", ";", "try", "{", "pipeline", "=", "PipelineScriptParser", ".", "parse", "(", "scriptFile", ",", "cliArgs", ")", ";", "}", "catch", "(", "ParseException", "e", ")", "{", "throw", "new", "ParseException", "(", "\"\\nERROR parsing '\"", "+", "scriptFile", ".", "getName", "(", ")", "+", "\"'\\n\"", "+", "e", ".", "getMessage", "(", ")", "+", "\"\\n(see the README.txt for the pipeline script format)\"", ",", "e", ".", "getErrorOffset", "(", ")", ")", ";", "}", "LOG", ".", "info", "(", "\"Successfully parsed pipeline script, now starting pipeline...\"", ")", ";", "LOG", ".", "info", "(", "\"*************************************************************\"", ")", ";", "pipeline", ".", "run", "(", ")", ";", "// will be printed if no exception.", "// used in pipeline tests, do not change", "System", ".", "out", ".", "println", "(", "OK_MESSAGE", ")", ";", "}" ]
Parse this pipeline and run it @return true if no error during processing @throws ParseException
[ "Parse", "this", "pipeline", "and", "run", "it" ]
train
https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_scripting/src/main/java/ch/epfl/bbp/uima/laucher/Launcher.java#L174-L200
structr/structr
structr-core/src/main/java/org/structr/schema/action/Function.java
Function.logParameterError
protected void logParameterError(final Object caller, final Object[] parameters, final String message, final boolean inJavaScriptContext) { """ Basic logging for functions called with wrong parameter count @param caller The element that caused the error @param parameters The function parameters @param inJavaScriptContext Has the function been called from a JavaScript context? """ logger.warn("{}: {} '{}'. Parameters: {}. {}", new Object[] { getReplacement(), message, caller, getParametersAsString(parameters), usage(inJavaScriptContext) }); }
java
protected void logParameterError(final Object caller, final Object[] parameters, final String message, final boolean inJavaScriptContext) { logger.warn("{}: {} '{}'. Parameters: {}. {}", new Object[] { getReplacement(), message, caller, getParametersAsString(parameters), usage(inJavaScriptContext) }); }
[ "protected", "void", "logParameterError", "(", "final", "Object", "caller", ",", "final", "Object", "[", "]", "parameters", ",", "final", "String", "message", ",", "final", "boolean", "inJavaScriptContext", ")", "{", "logger", ".", "warn", "(", "\"{}: {} '{}'. Parameters: {}. {}\"", ",", "new", "Object", "[", "]", "{", "getReplacement", "(", ")", ",", "message", ",", "caller", ",", "getParametersAsString", "(", "parameters", ")", ",", "usage", "(", "inJavaScriptContext", ")", "}", ")", ";", "}" ]
Basic logging for functions called with wrong parameter count @param caller The element that caused the error @param parameters The function parameters @param inJavaScriptContext Has the function been called from a JavaScript context?
[ "Basic", "logging", "for", "functions", "called", "with", "wrong", "parameter", "count" ]
train
https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-core/src/main/java/org/structr/schema/action/Function.java#L87-L89
NessComputing/components-ness-core
src/main/java/com/nesscomputing/callback/Callbacks.java
Callbacks.stream
public static <T> void stream(Callback<T> callback, Iterable<T> iterable) throws Exception { """ For every element in the iterable, invoke the given callback. Stops if {@link CallbackRefusedException} is thrown. """ for (T item : iterable) { try { callback.call(item); } catch (CallbackRefusedException e) { return; } } }
java
public static <T> void stream(Callback<T> callback, Iterable<T> iterable) throws Exception { for (T item : iterable) { try { callback.call(item); } catch (CallbackRefusedException e) { return; } } }
[ "public", "static", "<", "T", ">", "void", "stream", "(", "Callback", "<", "T", ">", "callback", ",", "Iterable", "<", "T", ">", "iterable", ")", "throws", "Exception", "{", "for", "(", "T", "item", ":", "iterable", ")", "{", "try", "{", "callback", ".", "call", "(", "item", ")", ";", "}", "catch", "(", "CallbackRefusedException", "e", ")", "{", "return", ";", "}", "}", "}" ]
For every element in the iterable, invoke the given callback. Stops if {@link CallbackRefusedException} is thrown.
[ "For", "every", "element", "in", "the", "iterable", "invoke", "the", "given", "callback", ".", "Stops", "if", "{" ]
train
https://github.com/NessComputing/components-ness-core/blob/980db2925e5f9085c75ad3682d5314a973209297/src/main/java/com/nesscomputing/callback/Callbacks.java#L40-L49
jayantk/jklol
src/com/jayantkrish/jklol/ccg/lexinduct/CfgAlignmentModel.java
CfgAlignmentModel.getBestAlignment
public AlignedExpressionTree getBestAlignment(AlignmentExample example) { """ Get the highest-scoring logical form derivation for {@code example} according to this model. @param example @return """ CfgParser parser = getCfgParser(example); ExpressionTree tree = example.getTree(); Factor rootFactor = getRootFactor(tree, parser.getParentVariable()); CfgParseChart chart = parser.parseMarginal(example.getWords(), rootFactor, false); CfgParseTree parseTree = chart.getBestParseTree(); return decodeCfgParse(parseTree, 0); }
java
public AlignedExpressionTree getBestAlignment(AlignmentExample example) { CfgParser parser = getCfgParser(example); ExpressionTree tree = example.getTree(); Factor rootFactor = getRootFactor(tree, parser.getParentVariable()); CfgParseChart chart = parser.parseMarginal(example.getWords(), rootFactor, false); CfgParseTree parseTree = chart.getBestParseTree(); return decodeCfgParse(parseTree, 0); }
[ "public", "AlignedExpressionTree", "getBestAlignment", "(", "AlignmentExample", "example", ")", "{", "CfgParser", "parser", "=", "getCfgParser", "(", "example", ")", ";", "ExpressionTree", "tree", "=", "example", ".", "getTree", "(", ")", ";", "Factor", "rootFactor", "=", "getRootFactor", "(", "tree", ",", "parser", ".", "getParentVariable", "(", ")", ")", ";", "CfgParseChart", "chart", "=", "parser", ".", "parseMarginal", "(", "example", ".", "getWords", "(", ")", ",", "rootFactor", ",", "false", ")", ";", "CfgParseTree", "parseTree", "=", "chart", ".", "getBestParseTree", "(", ")", ";", "return", "decodeCfgParse", "(", "parseTree", ",", "0", ")", ";", "}" ]
Get the highest-scoring logical form derivation for {@code example} according to this model. @param example @return
[ "Get", "the", "highest", "-", "scoring", "logical", "form", "derivation", "for", "{", "@code", "example", "}", "according", "to", "this", "model", "." ]
train
https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/ccg/lexinduct/CfgAlignmentModel.java#L110-L119
aws/aws-sdk-java
aws-java-sdk-ssm/src/main/java/com/amazonaws/services/simplesystemsmanagement/model/AutomationExecutionMetadata.java
AutomationExecutionMetadata.withTargetMaps
public AutomationExecutionMetadata withTargetMaps(java.util.Collection<java.util.Map<String, java.util.List<String>>> targetMaps) { """ <p> The specified key-value mapping of document parameters to target resources. </p> @param targetMaps The specified key-value mapping of document parameters to target resources. @return Returns a reference to this object so that method calls can be chained together. """ setTargetMaps(targetMaps); return this; }
java
public AutomationExecutionMetadata withTargetMaps(java.util.Collection<java.util.Map<String, java.util.List<String>>> targetMaps) { setTargetMaps(targetMaps); return this; }
[ "public", "AutomationExecutionMetadata", "withTargetMaps", "(", "java", ".", "util", ".", "Collection", "<", "java", ".", "util", ".", "Map", "<", "String", ",", "java", ".", "util", ".", "List", "<", "String", ">", ">", ">", "targetMaps", ")", "{", "setTargetMaps", "(", "targetMaps", ")", ";", "return", "this", ";", "}" ]
<p> The specified key-value mapping of document parameters to target resources. </p> @param targetMaps The specified key-value mapping of document parameters to target resources. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "The", "specified", "key", "-", "value", "mapping", "of", "document", "parameters", "to", "target", "resources", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-ssm/src/main/java/com/amazonaws/services/simplesystemsmanagement/model/AutomationExecutionMetadata.java#L995-L998
codeprimate-software/cp-elements
src/main/java/org/cp/elements/lang/StringUtils.java
StringUtils.getSpaces
public static String getSpaces(int number) { """ Constructs a String with only spaces up to the specified length. @param number an integer value indicating the number of spaces in the String. @return a String containing the specified number of spaces. """ Assert.argument(number >= 0, "The number [{0}] of desired spaces must be greater than equal to 0", number); StringBuilder spaces = new StringBuilder(Math.max(number, 0)); while (number > 0) { int count = Math.min(SPACES.length - 1, number); spaces.append(SPACES[count]); number -= count; } return spaces.toString(); }
java
public static String getSpaces(int number) { Assert.argument(number >= 0, "The number [{0}] of desired spaces must be greater than equal to 0", number); StringBuilder spaces = new StringBuilder(Math.max(number, 0)); while (number > 0) { int count = Math.min(SPACES.length - 1, number); spaces.append(SPACES[count]); number -= count; } return spaces.toString(); }
[ "public", "static", "String", "getSpaces", "(", "int", "number", ")", "{", "Assert", ".", "argument", "(", "number", ">=", "0", ",", "\"The number [{0}] of desired spaces must be greater than equal to 0\"", ",", "number", ")", ";", "StringBuilder", "spaces", "=", "new", "StringBuilder", "(", "Math", ".", "max", "(", "number", ",", "0", ")", ")", ";", "while", "(", "number", ">", "0", ")", "{", "int", "count", "=", "Math", ".", "min", "(", "SPACES", ".", "length", "-", "1", ",", "number", ")", ";", "spaces", ".", "append", "(", "SPACES", "[", "count", "]", ")", ";", "number", "-=", "count", ";", "}", "return", "spaces", ".", "toString", "(", ")", ";", "}" ]
Constructs a String with only spaces up to the specified length. @param number an integer value indicating the number of spaces in the String. @return a String containing the specified number of spaces.
[ "Constructs", "a", "String", "with", "only", "spaces", "up", "to", "the", "specified", "length", "." ]
train
https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/StringUtils.java#L279-L292
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/spatial/create/GridRowSet.java
GridRowSet.getCellPoint
private Point getCellPoint() { """ Compute the point of the cell @return Center point of the cell """ double x1 = (minX + cellI * deltaX) + (deltaX / 2d); double y1 = (minY + cellJ * deltaY) + (deltaY / 2d); cellI++; return GF.createPoint(new Coordinate(x1, y1)); }
java
private Point getCellPoint() { double x1 = (minX + cellI * deltaX) + (deltaX / 2d); double y1 = (minY + cellJ * deltaY) + (deltaY / 2d); cellI++; return GF.createPoint(new Coordinate(x1, y1)); }
[ "private", "Point", "getCellPoint", "(", ")", "{", "double", "x1", "=", "(", "minX", "+", "cellI", "*", "deltaX", ")", "+", "(", "deltaX", "/", "2d", ")", ";", "double", "y1", "=", "(", "minY", "+", "cellJ", "*", "deltaY", ")", "+", "(", "deltaY", "/", "2d", ")", ";", "cellI", "++", ";", "return", "GF", ".", "createPoint", "(", "new", "Coordinate", "(", "x1", ",", "y1", ")", ")", ";", "}" ]
Compute the point of the cell @return Center point of the cell
[ "Compute", "the", "point", "of", "the", "cell" ]
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/create/GridRowSet.java#L165-L170
alkacon/opencms-core
src/org/opencms/util/CmsXsltUtil.java
CmsXsltUtil.getColGroup
private static String getColGroup(String formatString, String delimiter) { """ Converts a delimiter separated format string int o colgroup html fragment.<p> @param formatString the formatstring to convert @param delimiter the delimiter the formats (l,r or c) are delimited with @return the resulting colgroup HTML """ StringBuffer colgroup = new StringBuffer(128); String[] formatStrings = formatString.split(delimiter); colgroup.append("<colgroup>"); for (int i = 0; i < formatStrings.length; i++) { colgroup.append("<col align=\""); char align = formatStrings[i].trim().charAt(0); switch (align) { case 'l': colgroup.append("left"); break; case 'c': colgroup.append("center"); break; case 'r': colgroup.append("right"); break; default: throw new RuntimeException("invalid format option"); } colgroup.append("\"/>"); } return colgroup.append("</colgroup>").toString(); }
java
private static String getColGroup(String formatString, String delimiter) { StringBuffer colgroup = new StringBuffer(128); String[] formatStrings = formatString.split(delimiter); colgroup.append("<colgroup>"); for (int i = 0; i < formatStrings.length; i++) { colgroup.append("<col align=\""); char align = formatStrings[i].trim().charAt(0); switch (align) { case 'l': colgroup.append("left"); break; case 'c': colgroup.append("center"); break; case 'r': colgroup.append("right"); break; default: throw new RuntimeException("invalid format option"); } colgroup.append("\"/>"); } return colgroup.append("</colgroup>").toString(); }
[ "private", "static", "String", "getColGroup", "(", "String", "formatString", ",", "String", "delimiter", ")", "{", "StringBuffer", "colgroup", "=", "new", "StringBuffer", "(", "128", ")", ";", "String", "[", "]", "formatStrings", "=", "formatString", ".", "split", "(", "delimiter", ")", ";", "colgroup", ".", "append", "(", "\"<colgroup>\"", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "formatStrings", ".", "length", ";", "i", "++", ")", "{", "colgroup", ".", "append", "(", "\"<col align=\\\"\"", ")", ";", "char", "align", "=", "formatStrings", "[", "i", "]", ".", "trim", "(", ")", ".", "charAt", "(", "0", ")", ";", "switch", "(", "align", ")", "{", "case", "'", "'", ":", "colgroup", ".", "append", "(", "\"left\"", ")", ";", "break", ";", "case", "'", "'", ":", "colgroup", ".", "append", "(", "\"center\"", ")", ";", "break", ";", "case", "'", "'", ":", "colgroup", ".", "append", "(", "\"right\"", ")", ";", "break", ";", "default", ":", "throw", "new", "RuntimeException", "(", "\"invalid format option\"", ")", ";", "}", "colgroup", ".", "append", "(", "\"\\\"/>\"", ")", ";", "}", "return", "colgroup", ".", "append", "(", "\"</colgroup>\"", ")", ".", "toString", "(", ")", ";", "}" ]
Converts a delimiter separated format string int o colgroup html fragment.<p> @param formatString the formatstring to convert @param delimiter the delimiter the formats (l,r or c) are delimited with @return the resulting colgroup HTML
[ "Converts", "a", "delimiter", "separated", "format", "string", "int", "o", "colgroup", "html", "fragment", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/util/CmsXsltUtil.java#L181-L205
Impetus/Kundera
src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/CassandraClientBase.java
CassandraClientBase.setBatchSize
private void setBatchSize(String persistenceUnit, Map<String, Object> puProperties) { """ Sets the batch size. @param persistenceUnit the persistence unit @param puProperties the pu properties """ String batch_Size = null; PersistenceUnitMetadata puMetadata = KunderaMetadataManager.getPersistenceUnitMetadata(kunderaMetadata, persistenceUnit); String externalBatchSize = puProperties != null ? (String) puProperties.get(PersistenceProperties.KUNDERA_BATCH_SIZE) : null; Integer intbatch = null; if (puMetadata.getBatchSize() > 0) { intbatch = new Integer(puMetadata.getBatchSize()); } batch_Size = (String) (externalBatchSize != null ? externalBatchSize : intbatch != null ? intbatch.toString() : null); setBatchSize(batch_Size); }
java
private void setBatchSize(String persistenceUnit, Map<String, Object> puProperties) { String batch_Size = null; PersistenceUnitMetadata puMetadata = KunderaMetadataManager.getPersistenceUnitMetadata(kunderaMetadata, persistenceUnit); String externalBatchSize = puProperties != null ? (String) puProperties.get(PersistenceProperties.KUNDERA_BATCH_SIZE) : null; Integer intbatch = null; if (puMetadata.getBatchSize() > 0) { intbatch = new Integer(puMetadata.getBatchSize()); } batch_Size = (String) (externalBatchSize != null ? externalBatchSize : intbatch != null ? intbatch.toString() : null); setBatchSize(batch_Size); }
[ "private", "void", "setBatchSize", "(", "String", "persistenceUnit", ",", "Map", "<", "String", ",", "Object", ">", "puProperties", ")", "{", "String", "batch_Size", "=", "null", ";", "PersistenceUnitMetadata", "puMetadata", "=", "KunderaMetadataManager", ".", "getPersistenceUnitMetadata", "(", "kunderaMetadata", ",", "persistenceUnit", ")", ";", "String", "externalBatchSize", "=", "puProperties", "!=", "null", "?", "(", "String", ")", "puProperties", ".", "get", "(", "PersistenceProperties", ".", "KUNDERA_BATCH_SIZE", ")", ":", "null", ";", "Integer", "intbatch", "=", "null", ";", "if", "(", "puMetadata", ".", "getBatchSize", "(", ")", ">", "0", ")", "{", "intbatch", "=", "new", "Integer", "(", "puMetadata", ".", "getBatchSize", "(", ")", ")", ";", "}", "batch_Size", "=", "(", "String", ")", "(", "externalBatchSize", "!=", "null", "?", "externalBatchSize", ":", "intbatch", "!=", "null", "?", "intbatch", ".", "toString", "(", ")", ":", "null", ")", ";", "setBatchSize", "(", "batch_Size", ")", ";", "}" ]
Sets the batch size. @param persistenceUnit the persistence unit @param puProperties the pu properties
[ "Sets", "the", "batch", "size", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/CassandraClientBase.java#L1880-L1897
JoeKerouac/utils
src/main/java/com/joe/utils/concurrent/ThreadUtil.java
ThreadUtil.createPool
public static ExecutorService createPool(PoolType type, String format) { """ 创建指定类型的线程池 @param type 线程池类型 @param format 线程名格式,格式为:format-%d,其中%d将被替换为从0开始的数字序列,不能为null @return 返回指定类型的线程池 """ //检查是否符合格式 String.format(format, 0); //线程工厂 ThreadFactory factory = new ThreadFactory() { AtomicInteger counter = new AtomicInteger(0); @Override public Thread newThread(Runnable r) { return new Thread(r, String.format(format, counter.getAndAdd(1))); } }; return build(type, factory); }
java
public static ExecutorService createPool(PoolType type, String format) { //检查是否符合格式 String.format(format, 0); //线程工厂 ThreadFactory factory = new ThreadFactory() { AtomicInteger counter = new AtomicInteger(0); @Override public Thread newThread(Runnable r) { return new Thread(r, String.format(format, counter.getAndAdd(1))); } }; return build(type, factory); }
[ "public", "static", "ExecutorService", "createPool", "(", "PoolType", "type", ",", "String", "format", ")", "{", "//检查是否符合格式", "String", ".", "format", "(", "format", ",", "0", ")", ";", "//线程工厂", "ThreadFactory", "factory", "=", "new", "ThreadFactory", "(", ")", "{", "AtomicInteger", "counter", "=", "new", "AtomicInteger", "(", "0", ")", ";", "@", "Override", "public", "Thread", "newThread", "(", "Runnable", "r", ")", "{", "return", "new", "Thread", "(", "r", ",", "String", ".", "format", "(", "format", ",", "counter", ".", "getAndAdd", "(", "1", ")", ")", ")", ";", "}", "}", ";", "return", "build", "(", "type", ",", "factory", ")", ";", "}" ]
创建指定类型的线程池 @param type 线程池类型 @param format 线程名格式,格式为:format-%d,其中%d将被替换为从0开始的数字序列,不能为null @return 返回指定类型的线程池
[ "创建指定类型的线程池" ]
train
https://github.com/JoeKerouac/utils/blob/45e1b2dc4d736956674fc4dcbe6cf84eaee69278/src/main/java/com/joe/utils/concurrent/ThreadUtil.java#L102-L116
actorapp/actor-platform
actor-sdk/sdk-core/core/core-shared/src/main/java/im/actor/core/modules/notifications/NotificationsActor.java
NotificationsActor.onMessagesRead
public void onMessagesRead(Peer peer, long fromDate) { """ Processing event about messages read @param peer peer @param fromDate read from date """ // Filtering obsolete read events if (fromDate < getLastReadDate(peer)) { return; } // Removing read messages from pending storage getNotifications().clear(); pendingStorage.setMessagesCount(0); pendingStorage.setDialogsCount(0); allPendingNotifications.clear(); saveStorage(); updateNotification(); // Setting last read date setLastReadDate(peer, fromDate); }
java
public void onMessagesRead(Peer peer, long fromDate) { // Filtering obsolete read events if (fromDate < getLastReadDate(peer)) { return; } // Removing read messages from pending storage getNotifications().clear(); pendingStorage.setMessagesCount(0); pendingStorage.setDialogsCount(0); allPendingNotifications.clear(); saveStorage(); updateNotification(); // Setting last read date setLastReadDate(peer, fromDate); }
[ "public", "void", "onMessagesRead", "(", "Peer", "peer", ",", "long", "fromDate", ")", "{", "// Filtering obsolete read events", "if", "(", "fromDate", "<", "getLastReadDate", "(", "peer", ")", ")", "{", "return", ";", "}", "// Removing read messages from pending storage", "getNotifications", "(", ")", ".", "clear", "(", ")", ";", "pendingStorage", ".", "setMessagesCount", "(", "0", ")", ";", "pendingStorage", ".", "setDialogsCount", "(", "0", ")", ";", "allPendingNotifications", ".", "clear", "(", ")", ";", "saveStorage", "(", ")", ";", "updateNotification", "(", ")", ";", "// Setting last read date", "setLastReadDate", "(", "peer", ",", "fromDate", ")", ";", "}" ]
Processing event about messages read @param peer peer @param fromDate read from date
[ "Processing", "event", "about", "messages", "read" ]
train
https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core/core/core-shared/src/main/java/im/actor/core/modules/notifications/NotificationsActor.java#L240-L257
mangstadt/biweekly
src/main/java/biweekly/io/ICalTimeZone.java
ICalTimeZone.getObservanceBoundary
public Boundary getObservanceBoundary(Date date) { """ Gets the timezone information of a date. @param date the date @return the timezone information """ utcCalendar.setTime(date); int year = utcCalendar.get(Calendar.YEAR); int month = utcCalendar.get(Calendar.MONTH) + 1; int day = utcCalendar.get(Calendar.DATE); int hour = utcCalendar.get(Calendar.HOUR); int minute = utcCalendar.get(Calendar.MINUTE); int second = utcCalendar.get(Calendar.SECOND); return getObservanceBoundary(year, month, day, hour, minute, second); }
java
public Boundary getObservanceBoundary(Date date) { utcCalendar.setTime(date); int year = utcCalendar.get(Calendar.YEAR); int month = utcCalendar.get(Calendar.MONTH) + 1; int day = utcCalendar.get(Calendar.DATE); int hour = utcCalendar.get(Calendar.HOUR); int minute = utcCalendar.get(Calendar.MINUTE); int second = utcCalendar.get(Calendar.SECOND); return getObservanceBoundary(year, month, day, hour, minute, second); }
[ "public", "Boundary", "getObservanceBoundary", "(", "Date", "date", ")", "{", "utcCalendar", ".", "setTime", "(", "date", ")", ";", "int", "year", "=", "utcCalendar", ".", "get", "(", "Calendar", ".", "YEAR", ")", ";", "int", "month", "=", "utcCalendar", ".", "get", "(", "Calendar", ".", "MONTH", ")", "+", "1", ";", "int", "day", "=", "utcCalendar", ".", "get", "(", "Calendar", ".", "DATE", ")", ";", "int", "hour", "=", "utcCalendar", ".", "get", "(", "Calendar", ".", "HOUR", ")", ";", "int", "minute", "=", "utcCalendar", ".", "get", "(", "Calendar", ".", "MINUTE", ")", ";", "int", "second", "=", "utcCalendar", ".", "get", "(", "Calendar", ".", "SECOND", ")", ";", "return", "getObservanceBoundary", "(", "year", ",", "month", ",", "day", ",", "hour", ",", "minute", ",", "second", ")", ";", "}" ]
Gets the timezone information of a date. @param date the date @return the timezone information
[ "Gets", "the", "timezone", "information", "of", "a", "date", "." ]
train
https://github.com/mangstadt/biweekly/blob/2e21350f85c13dfff52fdef98fdbebe2976fcf61/src/main/java/biweekly/io/ICalTimeZone.java#L263-L273
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/jca/ProviderList.java
ProviderList.removeInvalid
ProviderList removeInvalid() { """ Try to load all Providers and return the ProviderList. If one or more Providers could not be loaded, a new ProviderList with those entries removed is returned. Otherwise, the method returns this. """ int n = loadAll(); if (n == configs.length) { return this; } ProviderConfig[] newConfigs = new ProviderConfig[n]; for (int i = 0, j = 0; i < configs.length; i++) { ProviderConfig config = configs[i]; if (config.isLoaded()) { newConfigs[j++] = config; } } return new ProviderList(newConfigs, true); }
java
ProviderList removeInvalid() { int n = loadAll(); if (n == configs.length) { return this; } ProviderConfig[] newConfigs = new ProviderConfig[n]; for (int i = 0, j = 0; i < configs.length; i++) { ProviderConfig config = configs[i]; if (config.isLoaded()) { newConfigs[j++] = config; } } return new ProviderList(newConfigs, true); }
[ "ProviderList", "removeInvalid", "(", ")", "{", "int", "n", "=", "loadAll", "(", ")", ";", "if", "(", "n", "==", "configs", ".", "length", ")", "{", "return", "this", ";", "}", "ProviderConfig", "[", "]", "newConfigs", "=", "new", "ProviderConfig", "[", "n", "]", ";", "for", "(", "int", "i", "=", "0", ",", "j", "=", "0", ";", "i", "<", "configs", ".", "length", ";", "i", "++", ")", "{", "ProviderConfig", "config", "=", "configs", "[", "i", "]", ";", "if", "(", "config", ".", "isLoaded", "(", ")", ")", "{", "newConfigs", "[", "j", "++", "]", "=", "config", ";", "}", "}", "return", "new", "ProviderList", "(", "newConfigs", ",", "true", ")", ";", "}" ]
Try to load all Providers and return the ProviderList. If one or more Providers could not be loaded, a new ProviderList with those entries removed is returned. Otherwise, the method returns this.
[ "Try", "to", "load", "all", "Providers", "and", "return", "the", "ProviderList", ".", "If", "one", "or", "more", "Providers", "could", "not", "be", "loaded", "a", "new", "ProviderList", "with", "those", "entries", "removed", "is", "returned", ".", "Otherwise", "the", "method", "returns", "this", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/jca/ProviderList.java#L304-L317
NoraUi/NoraUi
src/main/java/com/github/noraui/application/steps/Step.java
Step.updateList
protected void updateList(PageElement pageElement, String textOrKey) throws TechnicalException, FailureException { """ Update a html select with a text value. @param pageElement Is target element @param textOrKey Is the new data (text or text in context (after a save)) @throws TechnicalException is thrown if you have a technical error (format, configuration, datas, ...) in NoraUi. Exception with {@value com.github.noraui.utils.Messages#FAIL_MESSAGE_ERROR_ON_INPUT} message (with screenshot, no exception) or Exception with {@value com.github.noraui.utils.Messages#FAIL_MESSAGE_VALUE_NOT_AVAILABLE_IN_THE_LIST} message (no screenshot, no exception) @throws FailureException if the scenario encounters a functional error """ String value = getTextOrKey(textOrKey); try { setDropDownValue(pageElement, value); } catch (final Exception e) { new Result.Failure<>(e.getMessage(), Messages.format(Messages.getMessage(Messages.FAIL_MESSAGE_ERROR_ON_INPUT), pageElement, pageElement.getPage().getApplication()), true, pageElement.getPage().getCallBack()); } }
java
protected void updateList(PageElement pageElement, String textOrKey) throws TechnicalException, FailureException { String value = getTextOrKey(textOrKey); try { setDropDownValue(pageElement, value); } catch (final Exception e) { new Result.Failure<>(e.getMessage(), Messages.format(Messages.getMessage(Messages.FAIL_MESSAGE_ERROR_ON_INPUT), pageElement, pageElement.getPage().getApplication()), true, pageElement.getPage().getCallBack()); } }
[ "protected", "void", "updateList", "(", "PageElement", "pageElement", ",", "String", "textOrKey", ")", "throws", "TechnicalException", ",", "FailureException", "{", "String", "value", "=", "getTextOrKey", "(", "textOrKey", ")", ";", "try", "{", "setDropDownValue", "(", "pageElement", ",", "value", ")", ";", "}", "catch", "(", "final", "Exception", "e", ")", "{", "new", "Result", ".", "Failure", "<>", "(", "e", ".", "getMessage", "(", ")", ",", "Messages", ".", "format", "(", "Messages", ".", "getMessage", "(", "Messages", ".", "FAIL_MESSAGE_ERROR_ON_INPUT", ")", ",", "pageElement", ",", "pageElement", ".", "getPage", "(", ")", ".", "getApplication", "(", ")", ")", ",", "true", ",", "pageElement", ".", "getPage", "(", ")", ".", "getCallBack", "(", ")", ")", ";", "}", "}" ]
Update a html select with a text value. @param pageElement Is target element @param textOrKey Is the new data (text or text in context (after a save)) @throws TechnicalException is thrown if you have a technical error (format, configuration, datas, ...) in NoraUi. Exception with {@value com.github.noraui.utils.Messages#FAIL_MESSAGE_ERROR_ON_INPUT} message (with screenshot, no exception) or Exception with {@value com.github.noraui.utils.Messages#FAIL_MESSAGE_VALUE_NOT_AVAILABLE_IN_THE_LIST} message (no screenshot, no exception) @throws FailureException if the scenario encounters a functional error
[ "Update", "a", "html", "select", "with", "a", "text", "value", "." ]
train
https://github.com/NoraUi/NoraUi/blob/5f491a3339c7d3c20d7207760bdaf2acdb8f260c/src/main/java/com/github/noraui/application/steps/Step.java#L457-L465
DDTH/ddth-commons
ddth-commons-core/src/main/java/com/github/ddth/commons/utils/DateTimeUtils.java
DateTimeUtils.addMinutes
public static Calendar addMinutes(Calendar origin, int value) { """ Add/Subtract the specified amount of minutes to the given {@link Calendar}. <p> The returned {@link Calendar} has its fields synced. </p> @param origin @param value @return @since 0.9.2 """ Calendar cal = sync((Calendar) origin.clone()); cal.add(Calendar.MINUTE, value); return sync(cal); }
java
public static Calendar addMinutes(Calendar origin, int value) { Calendar cal = sync((Calendar) origin.clone()); cal.add(Calendar.MINUTE, value); return sync(cal); }
[ "public", "static", "Calendar", "addMinutes", "(", "Calendar", "origin", ",", "int", "value", ")", "{", "Calendar", "cal", "=", "sync", "(", "(", "Calendar", ")", "origin", ".", "clone", "(", ")", ")", ";", "cal", ".", "add", "(", "Calendar", ".", "MINUTE", ",", "value", ")", ";", "return", "sync", "(", "cal", ")", ";", "}" ]
Add/Subtract the specified amount of minutes to the given {@link Calendar}. <p> The returned {@link Calendar} has its fields synced. </p> @param origin @param value @return @since 0.9.2
[ "Add", "/", "Subtract", "the", "specified", "amount", "of", "minutes", "to", "the", "given", "{", "@link", "Calendar", "}", "." ]
train
https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/utils/DateTimeUtils.java#L319-L323
UrielCh/ovh-java-sdk
ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java
ApiOvhMe.order_orderId_details_orderDetailId_extension_GET
public OvhItemDetail order_orderId_details_orderDetailId_extension_GET(Long orderId, Long orderDetailId) throws IOException { """ Get this object properties REST: GET /me/order/{orderId}/details/{orderDetailId}/extension @param orderId [required] @param orderDetailId [required] API beta """ String qPath = "/me/order/{orderId}/details/{orderDetailId}/extension"; StringBuilder sb = path(qPath, orderId, orderDetailId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhItemDetail.class); }
java
public OvhItemDetail order_orderId_details_orderDetailId_extension_GET(Long orderId, Long orderDetailId) throws IOException { String qPath = "/me/order/{orderId}/details/{orderDetailId}/extension"; StringBuilder sb = path(qPath, orderId, orderDetailId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhItemDetail.class); }
[ "public", "OvhItemDetail", "order_orderId_details_orderDetailId_extension_GET", "(", "Long", "orderId", ",", "Long", "orderDetailId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/me/order/{orderId}/details/{orderDetailId}/extension\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "orderId", ",", "orderDetailId", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhItemDetail", ".", "class", ")", ";", "}" ]
Get this object properties REST: GET /me/order/{orderId}/details/{orderDetailId}/extension @param orderId [required] @param orderDetailId [required] API beta
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L1943-L1948
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeAnnotationPosition.java
TypeAnnotationPosition.classExtends
public static TypeAnnotationPosition classExtends(final List<TypePathEntry> location, final JCLambda onLambda, final int pos) { """ Create a {@code TypeAnnotationPosition} for a class extension. @param location The type path. @param onLambda The lambda for this variable. @param pos The position from the associated tree node. """ return classExtends(location, onLambda, 65535, pos); }
java
public static TypeAnnotationPosition classExtends(final List<TypePathEntry> location, final JCLambda onLambda, final int pos) { return classExtends(location, onLambda, 65535, pos); }
[ "public", "static", "TypeAnnotationPosition", "classExtends", "(", "final", "List", "<", "TypePathEntry", ">", "location", ",", "final", "JCLambda", "onLambda", ",", "final", "int", "pos", ")", "{", "return", "classExtends", "(", "location", ",", "onLambda", ",", "65535", ",", "pos", ")", ";", "}" ]
Create a {@code TypeAnnotationPosition} for a class extension. @param location The type path. @param onLambda The lambda for this variable. @param pos The position from the associated tree node.
[ "Create", "a", "{", "@code", "TypeAnnotationPosition", "}", "for", "a", "class", "extension", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeAnnotationPosition.java#L788-L793
querydsl/querydsl
querydsl-sql/src/main/java/com/querydsl/sql/Configuration.java
Configuration.registerNumeric
public void registerNumeric(int total, int decimal, Class<?> javaType) { """ Override the binding for the given NUMERIC type @param total total amount of digits @param decimal amount of fractional digits @param javaType java type """ jdbcTypeMapping.registerNumeric(total, decimal, javaType); }
java
public void registerNumeric(int total, int decimal, Class<?> javaType) { jdbcTypeMapping.registerNumeric(total, decimal, javaType); }
[ "public", "void", "registerNumeric", "(", "int", "total", ",", "int", "decimal", ",", "Class", "<", "?", ">", "javaType", ")", "{", "jdbcTypeMapping", ".", "registerNumeric", "(", "total", ",", "decimal", ",", "javaType", ")", ";", "}" ]
Override the binding for the given NUMERIC type @param total total amount of digits @param decimal amount of fractional digits @param javaType java type
[ "Override", "the", "binding", "for", "the", "given", "NUMERIC", "type" ]
train
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/Configuration.java#L445-L447
jhunters/jprotobuf
v3/src/main/java/com/baidu/bjf/remoting/protobuf/code/CodedConstant.java
CodedConstant.computeElementSizeNoTag
public static int computeElementSizeNoTag(final WireFormat.FieldType type, final Object value) { """ Compute the number of bytes that would be needed to encode a particular value of arbitrary type, excluding tag. @param type The field's type. @param value Object representing the field's value. Must be of the exact type which would be returned by {@link Message#getField(Descriptors.FieldDescriptor)} for this field. @return the int """ switch (type) { // Note: Minor violation of 80-char limit rule here because this would // actually be harder to read if we wrapped the lines. case DOUBLE: return CodedOutputStream.computeDoubleSizeNoTag((Double) value); case FLOAT: return CodedOutputStream.computeFloatSizeNoTag((Float) value); case INT64: return CodedOutputStream.computeInt64SizeNoTag((Long) value); case UINT64: return CodedOutputStream.computeUInt64SizeNoTag((Long) value); case INT32: return CodedOutputStream.computeInt32SizeNoTag((Integer) value); case FIXED64: return CodedOutputStream.computeFixed64SizeNoTag((Long) value); case FIXED32: return CodedOutputStream.computeFixed32SizeNoTag((Integer) value); case BOOL: return CodedOutputStream.computeBoolSizeNoTag((Boolean) value); case STRING: return CodedOutputStream.computeStringSizeNoTag((String) value); case GROUP: return CodedOutputStream.computeGroupSizeNoTag((MessageLite) value); case BYTES: if (value instanceof ByteString) { return CodedOutputStream.computeBytesSizeNoTag((ByteString) value); } else { return CodedOutputStream.computeByteArraySizeNoTag((byte[]) value); } case UINT32: return CodedOutputStream.computeUInt32SizeNoTag((Integer) value); case SFIXED32: return CodedOutputStream.computeSFixed32SizeNoTag((Integer) value); case SFIXED64: return CodedOutputStream.computeSFixed64SizeNoTag((Long) value); case SINT32: return CodedOutputStream.computeSInt32SizeNoTag((Integer) value); case SINT64: return CodedOutputStream.computeSInt64SizeNoTag((Long) value); case MESSAGE: if (value instanceof LazyField) { return CodedOutputStream.computeLazyFieldSizeNoTag((LazyField) value); } else { return computeObjectSizeNoTag(value); } case ENUM: if (value instanceof Internal.EnumLite) { return CodedOutputStream.computeEnumSizeNoTag(((Internal.EnumLite) value).getNumber()); } else { if (value instanceof EnumReadable) { return CodedOutputStream.computeEnumSizeNoTag(((EnumReadable) value).value()); } else if (value instanceof Enum) { return CodedOutputStream.computeEnumSizeNoTag(((Enum) value).ordinal()); } return CodedOutputStream.computeEnumSizeNoTag((Integer) value); } } throw new RuntimeException("There is no way to get here, but the compiler thinks otherwise."); }
java
public static int computeElementSizeNoTag(final WireFormat.FieldType type, final Object value) { switch (type) { // Note: Minor violation of 80-char limit rule here because this would // actually be harder to read if we wrapped the lines. case DOUBLE: return CodedOutputStream.computeDoubleSizeNoTag((Double) value); case FLOAT: return CodedOutputStream.computeFloatSizeNoTag((Float) value); case INT64: return CodedOutputStream.computeInt64SizeNoTag((Long) value); case UINT64: return CodedOutputStream.computeUInt64SizeNoTag((Long) value); case INT32: return CodedOutputStream.computeInt32SizeNoTag((Integer) value); case FIXED64: return CodedOutputStream.computeFixed64SizeNoTag((Long) value); case FIXED32: return CodedOutputStream.computeFixed32SizeNoTag((Integer) value); case BOOL: return CodedOutputStream.computeBoolSizeNoTag((Boolean) value); case STRING: return CodedOutputStream.computeStringSizeNoTag((String) value); case GROUP: return CodedOutputStream.computeGroupSizeNoTag((MessageLite) value); case BYTES: if (value instanceof ByteString) { return CodedOutputStream.computeBytesSizeNoTag((ByteString) value); } else { return CodedOutputStream.computeByteArraySizeNoTag((byte[]) value); } case UINT32: return CodedOutputStream.computeUInt32SizeNoTag((Integer) value); case SFIXED32: return CodedOutputStream.computeSFixed32SizeNoTag((Integer) value); case SFIXED64: return CodedOutputStream.computeSFixed64SizeNoTag((Long) value); case SINT32: return CodedOutputStream.computeSInt32SizeNoTag((Integer) value); case SINT64: return CodedOutputStream.computeSInt64SizeNoTag((Long) value); case MESSAGE: if (value instanceof LazyField) { return CodedOutputStream.computeLazyFieldSizeNoTag((LazyField) value); } else { return computeObjectSizeNoTag(value); } case ENUM: if (value instanceof Internal.EnumLite) { return CodedOutputStream.computeEnumSizeNoTag(((Internal.EnumLite) value).getNumber()); } else { if (value instanceof EnumReadable) { return CodedOutputStream.computeEnumSizeNoTag(((EnumReadable) value).value()); } else if (value instanceof Enum) { return CodedOutputStream.computeEnumSizeNoTag(((Enum) value).ordinal()); } return CodedOutputStream.computeEnumSizeNoTag((Integer) value); } } throw new RuntimeException("There is no way to get here, but the compiler thinks otherwise."); }
[ "public", "static", "int", "computeElementSizeNoTag", "(", "final", "WireFormat", ".", "FieldType", "type", ",", "final", "Object", "value", ")", "{", "switch", "(", "type", ")", "{", "// Note: Minor violation of 80-char limit rule here because this would\r", "// actually be harder to read if we wrapped the lines.\r", "case", "DOUBLE", ":", "return", "CodedOutputStream", ".", "computeDoubleSizeNoTag", "(", "(", "Double", ")", "value", ")", ";", "case", "FLOAT", ":", "return", "CodedOutputStream", ".", "computeFloatSizeNoTag", "(", "(", "Float", ")", "value", ")", ";", "case", "INT64", ":", "return", "CodedOutputStream", ".", "computeInt64SizeNoTag", "(", "(", "Long", ")", "value", ")", ";", "case", "UINT64", ":", "return", "CodedOutputStream", ".", "computeUInt64SizeNoTag", "(", "(", "Long", ")", "value", ")", ";", "case", "INT32", ":", "return", "CodedOutputStream", ".", "computeInt32SizeNoTag", "(", "(", "Integer", ")", "value", ")", ";", "case", "FIXED64", ":", "return", "CodedOutputStream", ".", "computeFixed64SizeNoTag", "(", "(", "Long", ")", "value", ")", ";", "case", "FIXED32", ":", "return", "CodedOutputStream", ".", "computeFixed32SizeNoTag", "(", "(", "Integer", ")", "value", ")", ";", "case", "BOOL", ":", "return", "CodedOutputStream", ".", "computeBoolSizeNoTag", "(", "(", "Boolean", ")", "value", ")", ";", "case", "STRING", ":", "return", "CodedOutputStream", ".", "computeStringSizeNoTag", "(", "(", "String", ")", "value", ")", ";", "case", "GROUP", ":", "return", "CodedOutputStream", ".", "computeGroupSizeNoTag", "(", "(", "MessageLite", ")", "value", ")", ";", "case", "BYTES", ":", "if", "(", "value", "instanceof", "ByteString", ")", "{", "return", "CodedOutputStream", ".", "computeBytesSizeNoTag", "(", "(", "ByteString", ")", "value", ")", ";", "}", "else", "{", "return", "CodedOutputStream", ".", "computeByteArraySizeNoTag", "(", "(", "byte", "[", "]", ")", "value", ")", ";", "}", "case", "UINT32", ":", "return", "CodedOutputStream", ".", "computeUInt32SizeNoTag", "(", "(", "Integer", ")", "value", ")", ";", "case", "SFIXED32", ":", "return", "CodedOutputStream", ".", "computeSFixed32SizeNoTag", "(", "(", "Integer", ")", "value", ")", ";", "case", "SFIXED64", ":", "return", "CodedOutputStream", ".", "computeSFixed64SizeNoTag", "(", "(", "Long", ")", "value", ")", ";", "case", "SINT32", ":", "return", "CodedOutputStream", ".", "computeSInt32SizeNoTag", "(", "(", "Integer", ")", "value", ")", ";", "case", "SINT64", ":", "return", "CodedOutputStream", ".", "computeSInt64SizeNoTag", "(", "(", "Long", ")", "value", ")", ";", "case", "MESSAGE", ":", "if", "(", "value", "instanceof", "LazyField", ")", "{", "return", "CodedOutputStream", ".", "computeLazyFieldSizeNoTag", "(", "(", "LazyField", ")", "value", ")", ";", "}", "else", "{", "return", "computeObjectSizeNoTag", "(", "value", ")", ";", "}", "case", "ENUM", ":", "if", "(", "value", "instanceof", "Internal", ".", "EnumLite", ")", "{", "return", "CodedOutputStream", ".", "computeEnumSizeNoTag", "(", "(", "(", "Internal", ".", "EnumLite", ")", "value", ")", ".", "getNumber", "(", ")", ")", ";", "}", "else", "{", "if", "(", "value", "instanceof", "EnumReadable", ")", "{", "return", "CodedOutputStream", ".", "computeEnumSizeNoTag", "(", "(", "(", "EnumReadable", ")", "value", ")", ".", "value", "(", ")", ")", ";", "}", "else", "if", "(", "value", "instanceof", "Enum", ")", "{", "return", "CodedOutputStream", ".", "computeEnumSizeNoTag", "(", "(", "(", "Enum", ")", "value", ")", ".", "ordinal", "(", ")", ")", ";", "}", "return", "CodedOutputStream", ".", "computeEnumSizeNoTag", "(", "(", "Integer", ")", "value", ")", ";", "}", "}", "throw", "new", "RuntimeException", "(", "\"There is no way to get here, but the compiler thinks otherwise.\"", ")", ";", "}" ]
Compute the number of bytes that would be needed to encode a particular value of arbitrary type, excluding tag. @param type The field's type. @param value Object representing the field's value. Must be of the exact type which would be returned by {@link Message#getField(Descriptors.FieldDescriptor)} for this field. @return the int
[ "Compute", "the", "number", "of", "bytes", "that", "would", "be", "needed", "to", "encode", "a", "particular", "value", "of", "arbitrary", "type", "excluding", "tag", "." ]
train
https://github.com/jhunters/jprotobuf/blob/55832c9b4792afb128e5b35139d8a3891561d8a3/v3/src/main/java/com/baidu/bjf/remoting/protobuf/code/CodedConstant.java#L1296-L1359
ReactiveX/RxAndroid
rxandroid/src/main/java/io/reactivex/android/schedulers/AndroidSchedulers.java
AndroidSchedulers.from
@SuppressLint("NewApi") // Checking for an @hide API. public static Scheduler from(Looper looper, boolean async) { """ A {@link Scheduler} which executes actions on {@code looper}. @param async if true, the scheduler will use async messaging on API >= 16 to avoid VSYNC locking. On API < 16 this value is ignored. @see Message#setAsynchronous(boolean) """ if (looper == null) throw new NullPointerException("looper == null"); if (Build.VERSION.SDK_INT < 16) { async = false; } else if (async && Build.VERSION.SDK_INT < 22) { // Confirm that the method is available on this API level despite being @hide. Message message = Message.obtain(); try { message.setAsynchronous(true); } catch (NoSuchMethodError e) { async = false; } message.recycle(); } return new HandlerScheduler(new Handler(looper), async); }
java
@SuppressLint("NewApi") // Checking for an @hide API. public static Scheduler from(Looper looper, boolean async) { if (looper == null) throw new NullPointerException("looper == null"); if (Build.VERSION.SDK_INT < 16) { async = false; } else if (async && Build.VERSION.SDK_INT < 22) { // Confirm that the method is available on this API level despite being @hide. Message message = Message.obtain(); try { message.setAsynchronous(true); } catch (NoSuchMethodError e) { async = false; } message.recycle(); } return new HandlerScheduler(new Handler(looper), async); }
[ "@", "SuppressLint", "(", "\"NewApi\"", ")", "// Checking for an @hide API.", "public", "static", "Scheduler", "from", "(", "Looper", "looper", ",", "boolean", "async", ")", "{", "if", "(", "looper", "==", "null", ")", "throw", "new", "NullPointerException", "(", "\"looper == null\"", ")", ";", "if", "(", "Build", ".", "VERSION", ".", "SDK_INT", "<", "16", ")", "{", "async", "=", "false", ";", "}", "else", "if", "(", "async", "&&", "Build", ".", "VERSION", ".", "SDK_INT", "<", "22", ")", "{", "// Confirm that the method is available on this API level despite being @hide.", "Message", "message", "=", "Message", ".", "obtain", "(", ")", ";", "try", "{", "message", ".", "setAsynchronous", "(", "true", ")", ";", "}", "catch", "(", "NoSuchMethodError", "e", ")", "{", "async", "=", "false", ";", "}", "message", ".", "recycle", "(", ")", ";", "}", "return", "new", "HandlerScheduler", "(", "new", "Handler", "(", "looper", ")", ",", "async", ")", ";", "}" ]
A {@link Scheduler} which executes actions on {@code looper}. @param async if true, the scheduler will use async messaging on API >= 16 to avoid VSYNC locking. On API < 16 this value is ignored. @see Message#setAsynchronous(boolean)
[ "A", "{", "@link", "Scheduler", "}", "which", "executes", "actions", "on", "{", "@code", "looper", "}", "." ]
train
https://github.com/ReactiveX/RxAndroid/blob/e58f44d8842c082698c1b5e3d367f805b95d8509/rxandroid/src/main/java/io/reactivex/android/schedulers/AndroidSchedulers.java#L57-L73
jhunters/jprotobuf
android/src/main/java/com/baidu/bjf/remoting/protobuf/utils/StringUtils.java
StringUtils.splitByWholeSeparator
public static String[] splitByWholeSeparator(String str, String separator) { """ <p> Splits the provided text into an array, separator string specified. </p> <p> The separator(s) will not be included in the returned String array. Adjacent separators are treated as one separator. </p> <p> A <code>null</code> input String returns <code>null</code>. A <code>null</code> separator splits on whitespace. </p> <pre> StringUtils.splitByWholeSeparator(null, *) = null StringUtils.splitByWholeSeparator("", *) = [] StringUtils.splitByWholeSeparator("ab de fg", null) = ["ab", "de", "fg"] StringUtils.splitByWholeSeparator("ab de fg", null) = ["ab", "de", "fg"] StringUtils.splitByWholeSeparator("ab:cd:ef", ":") = ["ab", "cd", "ef"] StringUtils.splitByWholeSeparator("ab-!-cd-!-ef", "-!-") = ["ab", "cd", "ef"] </pre> @param str the String to parse, may be null @param separator String containing the String to be used as a delimiter, <code>null</code> splits on whitespace @return an array of parsed Strings, <code>null</code> if null String was input """ return splitByWholeSeparatorWorker(str, separator, -1, false); }
java
public static String[] splitByWholeSeparator(String str, String separator) { return splitByWholeSeparatorWorker(str, separator, -1, false); }
[ "public", "static", "String", "[", "]", "splitByWholeSeparator", "(", "String", "str", ",", "String", "separator", ")", "{", "return", "splitByWholeSeparatorWorker", "(", "str", ",", "separator", ",", "-", "1", ",", "false", ")", ";", "}" ]
<p> Splits the provided text into an array, separator string specified. </p> <p> The separator(s) will not be included in the returned String array. Adjacent separators are treated as one separator. </p> <p> A <code>null</code> input String returns <code>null</code>. A <code>null</code> separator splits on whitespace. </p> <pre> StringUtils.splitByWholeSeparator(null, *) = null StringUtils.splitByWholeSeparator("", *) = [] StringUtils.splitByWholeSeparator("ab de fg", null) = ["ab", "de", "fg"] StringUtils.splitByWholeSeparator("ab de fg", null) = ["ab", "de", "fg"] StringUtils.splitByWholeSeparator("ab:cd:ef", ":") = ["ab", "cd", "ef"] StringUtils.splitByWholeSeparator("ab-!-cd-!-ef", "-!-") = ["ab", "cd", "ef"] </pre> @param str the String to parse, may be null @param separator String containing the String to be used as a delimiter, <code>null</code> splits on whitespace @return an array of parsed Strings, <code>null</code> if null String was input
[ "<p", ">", "Splits", "the", "provided", "text", "into", "an", "array", "separator", "string", "specified", ".", "<", "/", "p", ">" ]
train
https://github.com/jhunters/jprotobuf/blob/55832c9b4792afb128e5b35139d8a3891561d8a3/android/src/main/java/com/baidu/bjf/remoting/protobuf/utils/StringUtils.java#L1016-L1018
OpenLiberty/open-liberty
dev/com.ibm.ws.kernel.instrument.serialfilter.premain/src/com/ibm/ws/kernel/instrument/serialfilter/agent/PreMain.java
PreMain.premain
public static void premain(String args, Instrumentation instrumentation) { """ Note: this property name corresponds with code in some IBM JDKs. It must NEVER be changed. """ if (!PreMainUtil.isBeta() && !PreMainUtil.isEnableAgentPropertySet()) { // if it's not beta, do nothing. // this implementation should be changed when this will be in the production code. return; } ObjectInputStreamTransformer transform = null; if (ObjectInputStreamClassInjector.injectionNeeded()) { // Install the transformer to modify ObjectInputStream. if (PreMainUtil.isDebugEnabled()) { System.out.println("Using class file transformer to modify ObjectInputStream."); } transform = new ObjectInputStreamTransformer(); instrumentation.addTransformer(transform); } try { initialiseObjectInputStream(); } finally { // Uninstall the class transformer. if (transform != null) { if (PreMainUtil.isDebugEnabled()) { System.out.println("Removing class file transformer."); } instrumentation.removeTransformer(transform); } } AccessController.doPrivileged(new PrivilegedAction<String>() { public String run() { return System.setProperty(PreMainUtil.KEY_SERIALFILTER_AGENT_ACTIVE, "true"); } }); }
java
public static void premain(String args, Instrumentation instrumentation) { if (!PreMainUtil.isBeta() && !PreMainUtil.isEnableAgentPropertySet()) { // if it's not beta, do nothing. // this implementation should be changed when this will be in the production code. return; } ObjectInputStreamTransformer transform = null; if (ObjectInputStreamClassInjector.injectionNeeded()) { // Install the transformer to modify ObjectInputStream. if (PreMainUtil.isDebugEnabled()) { System.out.println("Using class file transformer to modify ObjectInputStream."); } transform = new ObjectInputStreamTransformer(); instrumentation.addTransformer(transform); } try { initialiseObjectInputStream(); } finally { // Uninstall the class transformer. if (transform != null) { if (PreMainUtil.isDebugEnabled()) { System.out.println("Removing class file transformer."); } instrumentation.removeTransformer(transform); } } AccessController.doPrivileged(new PrivilegedAction<String>() { public String run() { return System.setProperty(PreMainUtil.KEY_SERIALFILTER_AGENT_ACTIVE, "true"); } }); }
[ "public", "static", "void", "premain", "(", "String", "args", ",", "Instrumentation", "instrumentation", ")", "{", "if", "(", "!", "PreMainUtil", ".", "isBeta", "(", ")", "&&", "!", "PreMainUtil", ".", "isEnableAgentPropertySet", "(", ")", ")", "{", "// if it's not beta, do nothing.", "// this implementation should be changed when this will be in the production code.", "return", ";", "}", "ObjectInputStreamTransformer", "transform", "=", "null", ";", "if", "(", "ObjectInputStreamClassInjector", ".", "injectionNeeded", "(", ")", ")", "{", "// Install the transformer to modify ObjectInputStream.", "if", "(", "PreMainUtil", ".", "isDebugEnabled", "(", ")", ")", "{", "System", ".", "out", ".", "println", "(", "\"Using class file transformer to modify ObjectInputStream.\"", ")", ";", "}", "transform", "=", "new", "ObjectInputStreamTransformer", "(", ")", ";", "instrumentation", ".", "addTransformer", "(", "transform", ")", ";", "}", "try", "{", "initialiseObjectInputStream", "(", ")", ";", "}", "finally", "{", "// Uninstall the class transformer.", "if", "(", "transform", "!=", "null", ")", "{", "if", "(", "PreMainUtil", ".", "isDebugEnabled", "(", ")", ")", "{", "System", ".", "out", ".", "println", "(", "\"Removing class file transformer.\"", ")", ";", "}", "instrumentation", ".", "removeTransformer", "(", "transform", ")", ";", "}", "}", "AccessController", ".", "doPrivileged", "(", "new", "PrivilegedAction", "<", "String", ">", "(", ")", "{", "public", "String", "run", "(", ")", "{", "return", "System", ".", "setProperty", "(", "PreMainUtil", ".", "KEY_SERIALFILTER_AGENT_ACTIVE", ",", "\"true\"", ")", ";", "}", "}", ")", ";", "}" ]
Note: this property name corresponds with code in some IBM JDKs. It must NEVER be changed.
[ "Note", ":", "this", "property", "name", "corresponds", "with", "code", "in", "some", "IBM", "JDKs", ".", "It", "must", "NEVER", "be", "changed", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.instrument.serialfilter.premain/src/com/ibm/ws/kernel/instrument/serialfilter/agent/PreMain.java#L42-L74
finmath/finmath-lib
src/main/java/net/finmath/marketdata/model/bond/Bond.java
Bond.getCouponPayment
public double getCouponPayment(int periodIndex, AnalyticModel model) { """ Returns the coupon payment of the period with the given index. The analytic model is needed in case of floating bonds. @param periodIndex The index of the period of interest. @param model The model under which the product is valued. @return The value of the coupon payment in the given period. """ ForwardCurve forwardCurve = model.getForwardCurve(forwardCurveName); if(forwardCurve == null && forwardCurveName != null && forwardCurveName.length() > 0) { throw new IllegalArgumentException("No forward curve with name '" + forwardCurveName + "' was found in the model:\n" + model.toString()); } double periodLength = schedule.getPeriodLength(periodIndex); double couponPayment=fixedCoupon ; if(forwardCurve != null ) { couponPayment = floatingSpread+forwardCurve.getForward(model, schedule.getFixing(periodIndex)); } return couponPayment*periodLength; }
java
public double getCouponPayment(int periodIndex, AnalyticModel model) { ForwardCurve forwardCurve = model.getForwardCurve(forwardCurveName); if(forwardCurve == null && forwardCurveName != null && forwardCurveName.length() > 0) { throw new IllegalArgumentException("No forward curve with name '" + forwardCurveName + "' was found in the model:\n" + model.toString()); } double periodLength = schedule.getPeriodLength(periodIndex); double couponPayment=fixedCoupon ; if(forwardCurve != null ) { couponPayment = floatingSpread+forwardCurve.getForward(model, schedule.getFixing(periodIndex)); } return couponPayment*periodLength; }
[ "public", "double", "getCouponPayment", "(", "int", "periodIndex", ",", "AnalyticModel", "model", ")", "{", "ForwardCurve", "forwardCurve", "=", "model", ".", "getForwardCurve", "(", "forwardCurveName", ")", ";", "if", "(", "forwardCurve", "==", "null", "&&", "forwardCurveName", "!=", "null", "&&", "forwardCurveName", ".", "length", "(", ")", ">", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"No forward curve with name '\"", "+", "forwardCurveName", "+", "\"' was found in the model:\\n\"", "+", "model", ".", "toString", "(", ")", ")", ";", "}", "double", "periodLength", "=", "schedule", ".", "getPeriodLength", "(", "periodIndex", ")", ";", "double", "couponPayment", "=", "fixedCoupon", ";", "if", "(", "forwardCurve", "!=", "null", ")", "{", "couponPayment", "=", "floatingSpread", "+", "forwardCurve", ".", "getForward", "(", "model", ",", "schedule", ".", "getFixing", "(", "periodIndex", ")", ")", ";", "}", "return", "couponPayment", "*", "periodLength", ";", "}" ]
Returns the coupon payment of the period with the given index. The analytic model is needed in case of floating bonds. @param periodIndex The index of the period of interest. @param model The model under which the product is valued. @return The value of the coupon payment in the given period.
[ "Returns", "the", "coupon", "payment", "of", "the", "period", "with", "the", "given", "index", ".", "The", "analytic", "model", "is", "needed", "in", "case", "of", "floating", "bonds", "." ]
train
https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/marketdata/model/bond/Bond.java#L209-L222
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/FilesImpl.java
FilesImpl.listFromComputeNodeAsync
public ServiceFuture<List<NodeFile>> listFromComputeNodeAsync(final String poolId, final String nodeId, final Boolean recursive, final FileListFromComputeNodeOptions fileListFromComputeNodeOptions, final ListOperationCallback<NodeFile> serviceCallback) { """ Lists all of the files in task directories on the specified compute node. @param poolId The ID of the pool that contains the compute node. @param nodeId The ID of the compute node whose files you want to list. @param recursive Whether to list children of a directory. @param fileListFromComputeNodeOptions 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( listFromComputeNodeSinglePageAsync(poolId, nodeId, recursive, fileListFromComputeNodeOptions), new Func1<String, Observable<ServiceResponseWithHeaders<Page<NodeFile>, FileListFromComputeNodeHeaders>>>() { @Override public Observable<ServiceResponseWithHeaders<Page<NodeFile>, FileListFromComputeNodeHeaders>> call(String nextPageLink) { FileListFromComputeNodeNextOptions fileListFromComputeNodeNextOptions = null; if (fileListFromComputeNodeOptions != null) { fileListFromComputeNodeNextOptions = new FileListFromComputeNodeNextOptions(); fileListFromComputeNodeNextOptions.withClientRequestId(fileListFromComputeNodeOptions.clientRequestId()); fileListFromComputeNodeNextOptions.withReturnClientRequestId(fileListFromComputeNodeOptions.returnClientRequestId()); fileListFromComputeNodeNextOptions.withOcpDate(fileListFromComputeNodeOptions.ocpDate()); } return listFromComputeNodeNextSinglePageAsync(nextPageLink, fileListFromComputeNodeNextOptions); } }, serviceCallback); }
java
public ServiceFuture<List<NodeFile>> listFromComputeNodeAsync(final String poolId, final String nodeId, final Boolean recursive, final FileListFromComputeNodeOptions fileListFromComputeNodeOptions, final ListOperationCallback<NodeFile> serviceCallback) { return AzureServiceFuture.fromHeaderPageResponse( listFromComputeNodeSinglePageAsync(poolId, nodeId, recursive, fileListFromComputeNodeOptions), new Func1<String, Observable<ServiceResponseWithHeaders<Page<NodeFile>, FileListFromComputeNodeHeaders>>>() { @Override public Observable<ServiceResponseWithHeaders<Page<NodeFile>, FileListFromComputeNodeHeaders>> call(String nextPageLink) { FileListFromComputeNodeNextOptions fileListFromComputeNodeNextOptions = null; if (fileListFromComputeNodeOptions != null) { fileListFromComputeNodeNextOptions = new FileListFromComputeNodeNextOptions(); fileListFromComputeNodeNextOptions.withClientRequestId(fileListFromComputeNodeOptions.clientRequestId()); fileListFromComputeNodeNextOptions.withReturnClientRequestId(fileListFromComputeNodeOptions.returnClientRequestId()); fileListFromComputeNodeNextOptions.withOcpDate(fileListFromComputeNodeOptions.ocpDate()); } return listFromComputeNodeNextSinglePageAsync(nextPageLink, fileListFromComputeNodeNextOptions); } }, serviceCallback); }
[ "public", "ServiceFuture", "<", "List", "<", "NodeFile", ">", ">", "listFromComputeNodeAsync", "(", "final", "String", "poolId", ",", "final", "String", "nodeId", ",", "final", "Boolean", "recursive", ",", "final", "FileListFromComputeNodeOptions", "fileListFromComputeNodeOptions", ",", "final", "ListOperationCallback", "<", "NodeFile", ">", "serviceCallback", ")", "{", "return", "AzureServiceFuture", ".", "fromHeaderPageResponse", "(", "listFromComputeNodeSinglePageAsync", "(", "poolId", ",", "nodeId", ",", "recursive", ",", "fileListFromComputeNodeOptions", ")", ",", "new", "Func1", "<", "String", ",", "Observable", "<", "ServiceResponseWithHeaders", "<", "Page", "<", "NodeFile", ">", ",", "FileListFromComputeNodeHeaders", ">", ">", ">", "(", ")", "{", "@", "Override", "public", "Observable", "<", "ServiceResponseWithHeaders", "<", "Page", "<", "NodeFile", ">", ",", "FileListFromComputeNodeHeaders", ">", ">", "call", "(", "String", "nextPageLink", ")", "{", "FileListFromComputeNodeNextOptions", "fileListFromComputeNodeNextOptions", "=", "null", ";", "if", "(", "fileListFromComputeNodeOptions", "!=", "null", ")", "{", "fileListFromComputeNodeNextOptions", "=", "new", "FileListFromComputeNodeNextOptions", "(", ")", ";", "fileListFromComputeNodeNextOptions", ".", "withClientRequestId", "(", "fileListFromComputeNodeOptions", ".", "clientRequestId", "(", ")", ")", ";", "fileListFromComputeNodeNextOptions", ".", "withReturnClientRequestId", "(", "fileListFromComputeNodeOptions", ".", "returnClientRequestId", "(", ")", ")", ";", "fileListFromComputeNodeNextOptions", ".", "withOcpDate", "(", "fileListFromComputeNodeOptions", ".", "ocpDate", "(", ")", ")", ";", "}", "return", "listFromComputeNodeNextSinglePageAsync", "(", "nextPageLink", ",", "fileListFromComputeNodeNextOptions", ")", ";", "}", "}", ",", "serviceCallback", ")", ";", "}" ]
Lists all of the files in task directories on the specified compute node. @param poolId The ID of the pool that contains the compute node. @param nodeId The ID of the compute node whose files you want to list. @param recursive Whether to list children of a directory. @param fileListFromComputeNodeOptions 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
[ "Lists", "all", "of", "the", "files", "in", "task", "directories", "on", "the", "specified", "compute", "node", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/FilesImpl.java#L2077-L2094
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/event/MoveOnEventHandler.java
MoveOnEventHandler.init
public void init(Record record, BaseField fldDest, BaseField fldSource, Converter convCheckMark, boolean bMoveOnNew, boolean bMoveOnValid, boolean bMoveOnSelect, boolean bMoveOnAdd, boolean bMoveOnUpdate, String strSource, boolean bDontMoveNullSource) { """ Constructor. @param pfldDest tour.field.BaseField The destination field. @param fldSource The source field. @param pCheckMark If is field if false, don't move the data. @param bMoveOnNew If true, move on new also. @param bMoveOnValid If true, move on valid also. """ m_fldDest = fldDest; m_fldSource = fldSource; m_convCheckMark = convCheckMark; m_strSource = strSource; m_bMoveOnNew = bMoveOnNew; m_bMoveOnValid = bMoveOnValid; m_bMoveOnSelect = bMoveOnSelect; m_bMoveOnAdd = bMoveOnAdd; m_bMoveOnUpdate = bMoveOnUpdate; m_bDontMoveNullSource = bDontMoveNullSource; super.init(record); }
java
public void init(Record record, BaseField fldDest, BaseField fldSource, Converter convCheckMark, boolean bMoveOnNew, boolean bMoveOnValid, boolean bMoveOnSelect, boolean bMoveOnAdd, boolean bMoveOnUpdate, String strSource, boolean bDontMoveNullSource) { m_fldDest = fldDest; m_fldSource = fldSource; m_convCheckMark = convCheckMark; m_strSource = strSource; m_bMoveOnNew = bMoveOnNew; m_bMoveOnValid = bMoveOnValid; m_bMoveOnSelect = bMoveOnSelect; m_bMoveOnAdd = bMoveOnAdd; m_bMoveOnUpdate = bMoveOnUpdate; m_bDontMoveNullSource = bDontMoveNullSource; super.init(record); }
[ "public", "void", "init", "(", "Record", "record", ",", "BaseField", "fldDest", ",", "BaseField", "fldSource", ",", "Converter", "convCheckMark", ",", "boolean", "bMoveOnNew", ",", "boolean", "bMoveOnValid", ",", "boolean", "bMoveOnSelect", ",", "boolean", "bMoveOnAdd", ",", "boolean", "bMoveOnUpdate", ",", "String", "strSource", ",", "boolean", "bDontMoveNullSource", ")", "{", "m_fldDest", "=", "fldDest", ";", "m_fldSource", "=", "fldSource", ";", "m_convCheckMark", "=", "convCheckMark", ";", "m_strSource", "=", "strSource", ";", "m_bMoveOnNew", "=", "bMoveOnNew", ";", "m_bMoveOnValid", "=", "bMoveOnValid", ";", "m_bMoveOnSelect", "=", "bMoveOnSelect", ";", "m_bMoveOnAdd", "=", "bMoveOnAdd", ";", "m_bMoveOnUpdate", "=", "bMoveOnUpdate", ";", "m_bDontMoveNullSource", "=", "bDontMoveNullSource", ";", "super", ".", "init", "(", "record", ")", ";", "}" ]
Constructor. @param pfldDest tour.field.BaseField The destination field. @param fldSource The source field. @param pCheckMark If is field if false, don't move the data. @param bMoveOnNew If true, move on new also. @param bMoveOnValid If true, move on valid also.
[ "Constructor", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/event/MoveOnEventHandler.java#L103-L116
micronaut-projects/micronaut-core
inject/src/main/java/io/micronaut/context/exceptions/MessageUtils.java
MessageUtils.buildMessage
static String buildMessage(BeanResolutionContext resolutionContext, MethodInjectionPoint methodInjectionPoint, Argument argument, String message, boolean circular) { """ Builds an appropriate error message. @param resolutionContext The resolution context @param methodInjectionPoint The injection point @param argument The argument @param message The message @param circular Is the path circular @return The message """ StringBuilder builder = new StringBuilder("Failed to inject value for parameter ["); String ls = System.getProperty("line.separator"); builder .append(argument.getName()).append("] of method [") .append(methodInjectionPoint.getName()) .append("] of class: ") .append(methodInjectionPoint.getDeclaringBean().getName()) .append(ls) .append(ls); if (message != null) { builder.append("Message: ").append(message).append(ls); } appendPath(resolutionContext, circular, builder, ls); return builder.toString(); }
java
static String buildMessage(BeanResolutionContext resolutionContext, MethodInjectionPoint methodInjectionPoint, Argument argument, String message, boolean circular) { StringBuilder builder = new StringBuilder("Failed to inject value for parameter ["); String ls = System.getProperty("line.separator"); builder .append(argument.getName()).append("] of method [") .append(methodInjectionPoint.getName()) .append("] of class: ") .append(methodInjectionPoint.getDeclaringBean().getName()) .append(ls) .append(ls); if (message != null) { builder.append("Message: ").append(message).append(ls); } appendPath(resolutionContext, circular, builder, ls); return builder.toString(); }
[ "static", "String", "buildMessage", "(", "BeanResolutionContext", "resolutionContext", ",", "MethodInjectionPoint", "methodInjectionPoint", ",", "Argument", "argument", ",", "String", "message", ",", "boolean", "circular", ")", "{", "StringBuilder", "builder", "=", "new", "StringBuilder", "(", "\"Failed to inject value for parameter [\"", ")", ";", "String", "ls", "=", "System", ".", "getProperty", "(", "\"line.separator\"", ")", ";", "builder", ".", "append", "(", "argument", ".", "getName", "(", ")", ")", ".", "append", "(", "\"] of method [\"", ")", ".", "append", "(", "methodInjectionPoint", ".", "getName", "(", ")", ")", ".", "append", "(", "\"] of class: \"", ")", ".", "append", "(", "methodInjectionPoint", ".", "getDeclaringBean", "(", ")", ".", "getName", "(", ")", ")", ".", "append", "(", "ls", ")", ".", "append", "(", "ls", ")", ";", "if", "(", "message", "!=", "null", ")", "{", "builder", ".", "append", "(", "\"Message: \"", ")", ".", "append", "(", "message", ")", ".", "append", "(", "ls", ")", ";", "}", "appendPath", "(", "resolutionContext", ",", "circular", ",", "builder", ",", "ls", ")", ";", "return", "builder", ".", "toString", "(", ")", ";", "}" ]
Builds an appropriate error message. @param resolutionContext The resolution context @param methodInjectionPoint The injection point @param argument The argument @param message The message @param circular Is the path circular @return The message
[ "Builds", "an", "appropriate", "error", "message", "." ]
train
https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/inject/src/main/java/io/micronaut/context/exceptions/MessageUtils.java#L77-L93
jenkinsci/jenkins
core/src/main/java/hudson/util/RunList.java
RunList.limit
public RunList<R> limit(final int n) { """ Return only the most recent builds. <em>Warning:</em> this method mutates the original list and then returns it. @param n a count @return the n most recent builds @since 1.507 """ return limit(new CountingPredicate<R>() { public boolean apply(int index, R input) { return index<n; } }); }
java
public RunList<R> limit(final int n) { return limit(new CountingPredicate<R>() { public boolean apply(int index, R input) { return index<n; } }); }
[ "public", "RunList", "<", "R", ">", "limit", "(", "final", "int", "n", ")", "{", "return", "limit", "(", "new", "CountingPredicate", "<", "R", ">", "(", ")", "{", "public", "boolean", "apply", "(", "int", "index", ",", "R", "input", ")", "{", "return", "index", "<", "n", ";", "}", "}", ")", ";", "}" ]
Return only the most recent builds. <em>Warning:</em> this method mutates the original list and then returns it. @param n a count @return the n most recent builds @since 1.507
[ "Return", "only", "the", "most", "recent", "builds", ".", "<em", ">", "Warning", ":", "<", "/", "em", ">", "this", "method", "mutates", "the", "original", "list", "and", "then", "returns", "it", "." ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/util/RunList.java#L246-L252
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsByteBuffer.java
CommsByteBuffer.getString
public synchronized String getString() { """ Reads a String from the current position in the byte buffer. @return Returns the String """ checkReleased(); String returningString = null; // Read the length in short stringLength = receivedBuffer.getShort(); // Allocate the right amount of space for it byte[] stringBytes = new byte[stringLength]; // And copy the data in receivedBuffer.get(stringBytes); // If the length is 1, and the byte is 0x00, then this is null - so do nothing if (stringLength == 1 && stringBytes[0] == 0) { // String is null... } else { try { returningString = new String(stringBytes, stringEncoding); } catch (UnsupportedEncodingException e) { FFDCFilter.processException(e, CLASS_NAME + ".getString", CommsConstants.COMMSBYTEBUFFER_GETSTRING_01, this); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { SibTr.debug(tc, "Unable to encode String: ", e); SibTr.exception(tc, e); } SibTr.error(tc, "UNSUPPORTED_STRING_ENCODING_SICO8005", new Object[] {stringEncoding, e}); throw new SIErrorException( TraceNLS.getFormattedMessage(CommsConstants.MSG_BUNDLE, "UNSUPPORTED_STRING_ENCODING_SICO8005", new Object[] {stringEncoding, e}, null) ); } } return returningString; }
java
public synchronized String getString() { checkReleased(); String returningString = null; // Read the length in short stringLength = receivedBuffer.getShort(); // Allocate the right amount of space for it byte[] stringBytes = new byte[stringLength]; // And copy the data in receivedBuffer.get(stringBytes); // If the length is 1, and the byte is 0x00, then this is null - so do nothing if (stringLength == 1 && stringBytes[0] == 0) { // String is null... } else { try { returningString = new String(stringBytes, stringEncoding); } catch (UnsupportedEncodingException e) { FFDCFilter.processException(e, CLASS_NAME + ".getString", CommsConstants.COMMSBYTEBUFFER_GETSTRING_01, this); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { SibTr.debug(tc, "Unable to encode String: ", e); SibTr.exception(tc, e); } SibTr.error(tc, "UNSUPPORTED_STRING_ENCODING_SICO8005", new Object[] {stringEncoding, e}); throw new SIErrorException( TraceNLS.getFormattedMessage(CommsConstants.MSG_BUNDLE, "UNSUPPORTED_STRING_ENCODING_SICO8005", new Object[] {stringEncoding, e}, null) ); } } return returningString; }
[ "public", "synchronized", "String", "getString", "(", ")", "{", "checkReleased", "(", ")", ";", "String", "returningString", "=", "null", ";", "// Read the length in", "short", "stringLength", "=", "receivedBuffer", ".", "getShort", "(", ")", ";", "// Allocate the right amount of space for it", "byte", "[", "]", "stringBytes", "=", "new", "byte", "[", "stringLength", "]", ";", "// And copy the data in", "receivedBuffer", ".", "get", "(", "stringBytes", ")", ";", "// If the length is 1, and the byte is 0x00, then this is null - so do nothing", "if", "(", "stringLength", "==", "1", "&&", "stringBytes", "[", "0", "]", "==", "0", ")", "{", "// String is null...", "}", "else", "{", "try", "{", "returningString", "=", "new", "String", "(", "stringBytes", ",", "stringEncoding", ")", ";", "}", "catch", "(", "UnsupportedEncodingException", "e", ")", "{", "FFDCFilter", ".", "processException", "(", "e", ",", "CLASS_NAME", "+", "\".getString\"", ",", "CommsConstants", ".", "COMMSBYTEBUFFER_GETSTRING_01", ",", "this", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "SibTr", ".", "debug", "(", "tc", ",", "\"Unable to encode String: \"", ",", "e", ")", ";", "SibTr", ".", "exception", "(", "tc", ",", "e", ")", ";", "}", "SibTr", ".", "error", "(", "tc", ",", "\"UNSUPPORTED_STRING_ENCODING_SICO8005\"", ",", "new", "Object", "[", "]", "{", "stringEncoding", ",", "e", "}", ")", ";", "throw", "new", "SIErrorException", "(", "TraceNLS", ".", "getFormattedMessage", "(", "CommsConstants", ".", "MSG_BUNDLE", ",", "\"UNSUPPORTED_STRING_ENCODING_SICO8005\"", ",", "new", "Object", "[", "]", "{", "stringEncoding", ",", "e", "}", ",", "null", ")", ")", ";", "}", "}", "return", "returningString", ";", "}" ]
Reads a String from the current position in the byte buffer. @return Returns the String
[ "Reads", "a", "String", "from", "the", "current", "position", "in", "the", "byte", "buffer", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsByteBuffer.java#L724-L769
Stratio/stratio-cassandra
src/java/org/apache/cassandra/db/CollationController.java
CollationController.reduceNameFilter
private void reduceNameFilter(QueryFilter filter, ColumnFamily container, long sstableTimestamp) { """ remove columns from @param filter where we already have data in @param container newer than @param sstableTimestamp """ if (container == null) return; for (Iterator<CellName> iterator = ((NamesQueryFilter) filter.filter).columns.iterator(); iterator.hasNext(); ) { CellName filterColumn = iterator.next(); Cell cell = container.getColumn(filterColumn); if (cell != null && cell.timestamp() > sstableTimestamp) iterator.remove(); } }
java
private void reduceNameFilter(QueryFilter filter, ColumnFamily container, long sstableTimestamp) { if (container == null) return; for (Iterator<CellName> iterator = ((NamesQueryFilter) filter.filter).columns.iterator(); iterator.hasNext(); ) { CellName filterColumn = iterator.next(); Cell cell = container.getColumn(filterColumn); if (cell != null && cell.timestamp() > sstableTimestamp) iterator.remove(); } }
[ "private", "void", "reduceNameFilter", "(", "QueryFilter", "filter", ",", "ColumnFamily", "container", ",", "long", "sstableTimestamp", ")", "{", "if", "(", "container", "==", "null", ")", "return", ";", "for", "(", "Iterator", "<", "CellName", ">", "iterator", "=", "(", "(", "NamesQueryFilter", ")", "filter", ".", "filter", ")", ".", "columns", ".", "iterator", "(", ")", ";", "iterator", ".", "hasNext", "(", ")", ";", ")", "{", "CellName", "filterColumn", "=", "iterator", ".", "next", "(", ")", ";", "Cell", "cell", "=", "container", ".", "getColumn", "(", "filterColumn", ")", ";", "if", "(", "cell", "!=", "null", "&&", "cell", ".", "timestamp", "(", ")", ">", "sstableTimestamp", ")", "iterator", ".", "remove", "(", ")", ";", "}", "}" ]
remove columns from @param filter where we already have data in @param container newer than @param sstableTimestamp
[ "remove", "columns", "from" ]
train
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/db/CollationController.java#L184-L196
michael-rapp/AndroidMaterialDialog
library/src/main/java/de/mrapp/android/dialog/view/DialogRootView.java
DialogRootView.addAreas
public final void addAreas(@NonNull final Map<ViewType, View> areas) { """ Adds the different areas of a dialog to the root view. @param areas A map, which contains the areas, which should be added, as keys and their corresponding views as values, as an instance of the type {@link Map}. The map may not be null """ this.areas = new TreeMap<>(new AreaComparator()); this.dividers = new HashMap<>(); for (Map.Entry<ViewType, View> entry : areas.entrySet()) { ViewType viewType = entry.getKey(); View view = entry.getValue(); if (viewType instanceof AreaViewType) { this.areas.put(((AreaViewType) viewType).getArea(), view); } else if (viewType instanceof DividerViewType && view instanceof Divider) { this.dividers.put(((DividerViewType) viewType).getLocation(), (Divider) view); } } addAreas(); addDividers(); registerScrollLayoutListener(); }
java
public final void addAreas(@NonNull final Map<ViewType, View> areas) { this.areas = new TreeMap<>(new AreaComparator()); this.dividers = new HashMap<>(); for (Map.Entry<ViewType, View> entry : areas.entrySet()) { ViewType viewType = entry.getKey(); View view = entry.getValue(); if (viewType instanceof AreaViewType) { this.areas.put(((AreaViewType) viewType).getArea(), view); } else if (viewType instanceof DividerViewType && view instanceof Divider) { this.dividers.put(((DividerViewType) viewType).getLocation(), (Divider) view); } } addAreas(); addDividers(); registerScrollLayoutListener(); }
[ "public", "final", "void", "addAreas", "(", "@", "NonNull", "final", "Map", "<", "ViewType", ",", "View", ">", "areas", ")", "{", "this", ".", "areas", "=", "new", "TreeMap", "<>", "(", "new", "AreaComparator", "(", ")", ")", ";", "this", ".", "dividers", "=", "new", "HashMap", "<>", "(", ")", ";", "for", "(", "Map", ".", "Entry", "<", "ViewType", ",", "View", ">", "entry", ":", "areas", ".", "entrySet", "(", ")", ")", "{", "ViewType", "viewType", "=", "entry", ".", "getKey", "(", ")", ";", "View", "view", "=", "entry", ".", "getValue", "(", ")", ";", "if", "(", "viewType", "instanceof", "AreaViewType", ")", "{", "this", ".", "areas", ".", "put", "(", "(", "(", "AreaViewType", ")", "viewType", ")", ".", "getArea", "(", ")", ",", "view", ")", ";", "}", "else", "if", "(", "viewType", "instanceof", "DividerViewType", "&&", "view", "instanceof", "Divider", ")", "{", "this", ".", "dividers", ".", "put", "(", "(", "(", "DividerViewType", ")", "viewType", ")", ".", "getLocation", "(", ")", ",", "(", "Divider", ")", "view", ")", ";", "}", "}", "addAreas", "(", ")", ";", "addDividers", "(", ")", ";", "registerScrollLayoutListener", "(", ")", ";", "}" ]
Adds the different areas of a dialog to the root view. @param areas A map, which contains the areas, which should be added, as keys and their corresponding views as values, as an instance of the type {@link Map}. The map may not be null
[ "Adds", "the", "different", "areas", "of", "a", "dialog", "to", "the", "root", "view", "." ]
train
https://github.com/michael-rapp/AndroidMaterialDialog/blob/8990eed72ee5f5a9720836ee708f71ac0d43053b/library/src/main/java/de/mrapp/android/dialog/view/DialogRootView.java#L1189-L1207
liferay/com-liferay-commerce
commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceShipmentItemPersistenceImpl.java
CommerceShipmentItemPersistenceImpl.findByGroupId
@Override public List<CommerceShipmentItem> findByGroupId(long groupId, int start, int end) { """ Returns a range of all the commerce shipment items where groupId = &#63;. <p> Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommerceShipmentItemModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. </p> @param groupId the group ID @param start the lower bound of the range of commerce shipment items @param end the upper bound of the range of commerce shipment items (not inclusive) @return the range of matching commerce shipment items """ return findByGroupId(groupId, start, end, null); }
java
@Override public List<CommerceShipmentItem> findByGroupId(long groupId, int start, int end) { return findByGroupId(groupId, start, end, null); }
[ "@", "Override", "public", "List", "<", "CommerceShipmentItem", ">", "findByGroupId", "(", "long", "groupId", ",", "int", "start", ",", "int", "end", ")", "{", "return", "findByGroupId", "(", "groupId", ",", "start", ",", "end", ",", "null", ")", ";", "}" ]
Returns a range of all the commerce shipment items where groupId = &#63;. <p> Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommerceShipmentItemModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. </p> @param groupId the group ID @param start the lower bound of the range of commerce shipment items @param end the upper bound of the range of commerce shipment items (not inclusive) @return the range of matching commerce shipment items
[ "Returns", "a", "range", "of", "all", "the", "commerce", "shipment", "items", "where", "groupId", "=", "&#63", ";", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceShipmentItemPersistenceImpl.java#L139-L143
FasterXML/woodstox
src/main/java/com/ctc/wstx/util/TextBuffer.java
TextBuffer.resetWithShared
public void resetWithShared(char[] buf, int start, int len) { """ Method called to initialize the buffer with a shared copy of data; this means that buffer will just have pointers to actual data. It also means that if anything is to be appended to the buffer, it will first have to unshare it (make a local copy). """ // Let's first mark things we need about input buffer mInputBuffer = buf; mInputStart = start; mInputLen = len; // Then clear intermediate values, if any: mResultString = null; mResultArray = null; // And then reset internal input buffers, if necessary: if (mHasSegments) { clearSegments(); } }
java
public void resetWithShared(char[] buf, int start, int len) { // Let's first mark things we need about input buffer mInputBuffer = buf; mInputStart = start; mInputLen = len; // Then clear intermediate values, if any: mResultString = null; mResultArray = null; // And then reset internal input buffers, if necessary: if (mHasSegments) { clearSegments(); } }
[ "public", "void", "resetWithShared", "(", "char", "[", "]", "buf", ",", "int", "start", ",", "int", "len", ")", "{", "// Let's first mark things we need about input buffer", "mInputBuffer", "=", "buf", ";", "mInputStart", "=", "start", ";", "mInputLen", "=", "len", ";", "// Then clear intermediate values, if any:", "mResultString", "=", "null", ";", "mResultArray", "=", "null", ";", "// And then reset internal input buffers, if necessary:", "if", "(", "mHasSegments", ")", "{", "clearSegments", "(", ")", ";", "}", "}" ]
Method called to initialize the buffer with a shared copy of data; this means that buffer will just have pointers to actual data. It also means that if anything is to be appended to the buffer, it will first have to unshare it (make a local copy).
[ "Method", "called", "to", "initialize", "the", "buffer", "with", "a", "shared", "copy", "of", "data", ";", "this", "means", "that", "buffer", "will", "just", "have", "pointers", "to", "actual", "data", ".", "It", "also", "means", "that", "if", "anything", "is", "to", "be", "appended", "to", "the", "buffer", "it", "will", "first", "have", "to", "unshare", "it", "(", "make", "a", "local", "copy", ")", "." ]
train
https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/util/TextBuffer.java#L256-L271
SeleniumHQ/selenium
java/server/src/org/openqa/grid/internal/utils/configuration/StandaloneConfiguration.java
StandaloneConfiguration.isMergeAble
protected boolean isMergeAble(Class<?> targetType, Object other, Object target) { """ Determines if one object can be merged onto another object. Checks for {@code null}, and empty (Collections & Maps) to make decision. @param targetType The type that both {@code other} and {@code target} must be assignable to. @param other the object to merge. must be the same type as the 'target'. @param target the object to merge on to. must be the same type as the 'other'. @return whether the 'other' can be merged onto the 'target'. """ // don't merge a null value if (other == null) { return false; } else { // allow any non-null value to merge over a null target. if (target == null) { return true; } } // we know we have two objects with value.. Make sure the types are the same and // perform additional checks. if (!targetType.isAssignableFrom(target.getClass()) || !targetType.isAssignableFrom(other.getClass())) { return false; } if (target instanceof Collection) { return !((Collection<?>) other).isEmpty(); } if (target instanceof Map) { return !((Map<?, ?>) other).isEmpty(); } return true; }
java
protected boolean isMergeAble(Class<?> targetType, Object other, Object target) { // don't merge a null value if (other == null) { return false; } else { // allow any non-null value to merge over a null target. if (target == null) { return true; } } // we know we have two objects with value.. Make sure the types are the same and // perform additional checks. if (!targetType.isAssignableFrom(target.getClass()) || !targetType.isAssignableFrom(other.getClass())) { return false; } if (target instanceof Collection) { return !((Collection<?>) other).isEmpty(); } if (target instanceof Map) { return !((Map<?, ?>) other).isEmpty(); } return true; }
[ "protected", "boolean", "isMergeAble", "(", "Class", "<", "?", ">", "targetType", ",", "Object", "other", ",", "Object", "target", ")", "{", "// don't merge a null value", "if", "(", "other", "==", "null", ")", "{", "return", "false", ";", "}", "else", "{", "// allow any non-null value to merge over a null target.", "if", "(", "target", "==", "null", ")", "{", "return", "true", ";", "}", "}", "// we know we have two objects with value.. Make sure the types are the same and", "// perform additional checks.", "if", "(", "!", "targetType", ".", "isAssignableFrom", "(", "target", ".", "getClass", "(", ")", ")", "||", "!", "targetType", ".", "isAssignableFrom", "(", "other", ".", "getClass", "(", ")", ")", ")", "{", "return", "false", ";", "}", "if", "(", "target", "instanceof", "Collection", ")", "{", "return", "!", "(", "(", "Collection", "<", "?", ">", ")", "other", ")", ".", "isEmpty", "(", ")", ";", "}", "if", "(", "target", "instanceof", "Map", ")", "{", "return", "!", "(", "(", "Map", "<", "?", ",", "?", ">", ")", "other", ")", ".", "isEmpty", "(", ")", ";", "}", "return", "true", ";", "}" ]
Determines if one object can be merged onto another object. Checks for {@code null}, and empty (Collections & Maps) to make decision. @param targetType The type that both {@code other} and {@code target} must be assignable to. @param other the object to merge. must be the same type as the 'target'. @param target the object to merge on to. must be the same type as the 'other'. @return whether the 'other' can be merged onto the 'target'.
[ "Determines", "if", "one", "object", "can", "be", "merged", "onto", "another", "object", ".", "Checks", "for", "{", "@code", "null", "}", "and", "empty", "(", "Collections", "&", "Maps", ")", "to", "make", "decision", "." ]
train
https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/server/src/org/openqa/grid/internal/utils/configuration/StandaloneConfiguration.java#L207-L234
pf4j/pf4j
pf4j/src/main/java/org/pf4j/DefaultPluginLoader.java
DefaultPluginLoader.loadJars
protected void loadJars(Path pluginPath, PluginClassLoader pluginClassLoader) { """ Add all {@code *.jar} files from {@code lib} directories to plugin class loader. """ for (String libDirectory : pluginClasspath.getLibDirectories()) { Path file = pluginPath.resolve(libDirectory); List<File> jars = FileUtils.getJars(file); for (File jar : jars) { pluginClassLoader.addFile(jar); } } }
java
protected void loadJars(Path pluginPath, PluginClassLoader pluginClassLoader) { for (String libDirectory : pluginClasspath.getLibDirectories()) { Path file = pluginPath.resolve(libDirectory); List<File> jars = FileUtils.getJars(file); for (File jar : jars) { pluginClassLoader.addFile(jar); } } }
[ "protected", "void", "loadJars", "(", "Path", "pluginPath", ",", "PluginClassLoader", "pluginClassLoader", ")", "{", "for", "(", "String", "libDirectory", ":", "pluginClasspath", ".", "getLibDirectories", "(", ")", ")", "{", "Path", "file", "=", "pluginPath", ".", "resolve", "(", "libDirectory", ")", ";", "List", "<", "File", ">", "jars", "=", "FileUtils", ".", "getJars", "(", "file", ")", ";", "for", "(", "File", "jar", ":", "jars", ")", "{", "pluginClassLoader", ".", "addFile", "(", "jar", ")", ";", "}", "}", "}" ]
Add all {@code *.jar} files from {@code lib} directories to plugin class loader.
[ "Add", "all", "{" ]
train
https://github.com/pf4j/pf4j/blob/6dd7a6069f0e2fbd842c81e2c8c388918b88ea81/pf4j/src/main/java/org/pf4j/DefaultPluginLoader.java#L76-L84
kevinherron/opc-ua-stack
stack-core/src/main/java/com/digitalpetri/opcua/stack/core/util/CertificateValidationUtil.java
CertificateValidationUtil.validateHostnameOrIpAddress
public static void validateHostnameOrIpAddress(X509Certificate certificate, String hostname) throws UaException { """ Validate that the hostname used in the endpoint URL matches either the SubjectAltName DNSName or IPAddress in the given certificate. @param certificate the certificate to validate against. @param hostname the hostname used in the endpoint URL. @throws UaException if there is no matching DNSName or IPAddress entry. """ boolean dnsNameMatches = validateSubjectAltNameField(certificate, SUBJECT_ALT_NAME_DNS_NAME, hostname::equals); boolean ipAddressMatches = validateSubjectAltNameField(certificate, SUBJECT_ALT_NAME_IP_ADDRESS, hostname::equals); if (!(dnsNameMatches || ipAddressMatches)) { throw new UaException(StatusCodes.Bad_CertificateHostNameInvalid); } }
java
public static void validateHostnameOrIpAddress(X509Certificate certificate, String hostname) throws UaException { boolean dnsNameMatches = validateSubjectAltNameField(certificate, SUBJECT_ALT_NAME_DNS_NAME, hostname::equals); boolean ipAddressMatches = validateSubjectAltNameField(certificate, SUBJECT_ALT_NAME_IP_ADDRESS, hostname::equals); if (!(dnsNameMatches || ipAddressMatches)) { throw new UaException(StatusCodes.Bad_CertificateHostNameInvalid); } }
[ "public", "static", "void", "validateHostnameOrIpAddress", "(", "X509Certificate", "certificate", ",", "String", "hostname", ")", "throws", "UaException", "{", "boolean", "dnsNameMatches", "=", "validateSubjectAltNameField", "(", "certificate", ",", "SUBJECT_ALT_NAME_DNS_NAME", ",", "hostname", "::", "equals", ")", ";", "boolean", "ipAddressMatches", "=", "validateSubjectAltNameField", "(", "certificate", ",", "SUBJECT_ALT_NAME_IP_ADDRESS", ",", "hostname", "::", "equals", ")", ";", "if", "(", "!", "(", "dnsNameMatches", "||", "ipAddressMatches", ")", ")", "{", "throw", "new", "UaException", "(", "StatusCodes", ".", "Bad_CertificateHostNameInvalid", ")", ";", "}", "}" ]
Validate that the hostname used in the endpoint URL matches either the SubjectAltName DNSName or IPAddress in the given certificate. @param certificate the certificate to validate against. @param hostname the hostname used in the endpoint URL. @throws UaException if there is no matching DNSName or IPAddress entry.
[ "Validate", "that", "the", "hostname", "used", "in", "the", "endpoint", "URL", "matches", "either", "the", "SubjectAltName", "DNSName", "or", "IPAddress", "in", "the", "given", "certificate", "." ]
train
https://github.com/kevinherron/opc-ua-stack/blob/007f4e5c4ff102814bec17bb7c41f27e2e52f2fd/stack-core/src/main/java/com/digitalpetri/opcua/stack/core/util/CertificateValidationUtil.java#L111-L121
GoogleCloudPlatform/bigdata-interop
util/src/main/java/com/google/cloud/hadoop/util/ApiErrorExtractor.java
ApiErrorExtractor.toUserPresentableException
public IOException toUserPresentableException(IOException ioe, String action) throws IOException { """ Converts the exception to a user-presentable error message. Specifically, extracts message field for HTTP 4xx codes, and creates a generic "Internal Server Error" for HTTP 5xx codes. @param ioe the exception @param action the description of the action being performed at the time of error. @see #toUserPresentableMessage(IOException, String) """ throw new IOException(toUserPresentableMessage(ioe, action), ioe); }
java
public IOException toUserPresentableException(IOException ioe, String action) throws IOException { throw new IOException(toUserPresentableMessage(ioe, action), ioe); }
[ "public", "IOException", "toUserPresentableException", "(", "IOException", "ioe", ",", "String", "action", ")", "throws", "IOException", "{", "throw", "new", "IOException", "(", "toUserPresentableMessage", "(", "ioe", ",", "action", ")", ",", "ioe", ")", ";", "}" ]
Converts the exception to a user-presentable error message. Specifically, extracts message field for HTTP 4xx codes, and creates a generic "Internal Server Error" for HTTP 5xx codes. @param ioe the exception @param action the description of the action being performed at the time of error. @see #toUserPresentableMessage(IOException, String)
[ "Converts", "the", "exception", "to", "a", "user", "-", "presentable", "error", "message", ".", "Specifically", "extracts", "message", "field", "for", "HTTP", "4xx", "codes", "and", "creates", "a", "generic", "Internal", "Server", "Error", "for", "HTTP", "5xx", "codes", "." ]
train
https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/util/src/main/java/com/google/cloud/hadoop/util/ApiErrorExtractor.java#L373-L375
tracee/tracee
core/src/main/java/io/tracee/Utilities.java
Utilities.createAlphanumericHash
public static String createAlphanumericHash(final String str, final int length) { """ Creates a alphanumeric projection with a given length of the given object using its {@link Object#hashCode()}. """ try { final MessageDigest md = MessageDigest.getInstance("SHA-256"); final byte[] digest = md.digest(str.getBytes(CHARSET_UTF8)); // To human final StringBuilder sb = new StringBuilder(); for (final byte b : digest) { if (b < 16) sb.append("0"); sb.append(Integer.toHexString(b & 0xff)); } // repeat if to small while (sb.length() < length) { sb.append(sb.toString()); } // truncation and return return sb.delete(length, sb.length()).toString(); } catch (NoSuchAlgorithmException | UnsupportedCharsetException e) { // Hashalgo. and charset is mandatory for all kinds of JDK, so this should happend. But even when, we generate a random string. return createRandomAlphanumeric(length); } }
java
public static String createAlphanumericHash(final String str, final int length) { try { final MessageDigest md = MessageDigest.getInstance("SHA-256"); final byte[] digest = md.digest(str.getBytes(CHARSET_UTF8)); // To human final StringBuilder sb = new StringBuilder(); for (final byte b : digest) { if (b < 16) sb.append("0"); sb.append(Integer.toHexString(b & 0xff)); } // repeat if to small while (sb.length() < length) { sb.append(sb.toString()); } // truncation and return return sb.delete(length, sb.length()).toString(); } catch (NoSuchAlgorithmException | UnsupportedCharsetException e) { // Hashalgo. and charset is mandatory for all kinds of JDK, so this should happend. But even when, we generate a random string. return createRandomAlphanumeric(length); } }
[ "public", "static", "String", "createAlphanumericHash", "(", "final", "String", "str", ",", "final", "int", "length", ")", "{", "try", "{", "final", "MessageDigest", "md", "=", "MessageDigest", ".", "getInstance", "(", "\"SHA-256\"", ")", ";", "final", "byte", "[", "]", "digest", "=", "md", ".", "digest", "(", "str", ".", "getBytes", "(", "CHARSET_UTF8", ")", ")", ";", "// To human", "final", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "final", "byte", "b", ":", "digest", ")", "{", "if", "(", "b", "<", "16", ")", "sb", ".", "append", "(", "\"0\"", ")", ";", "sb", ".", "append", "(", "Integer", ".", "toHexString", "(", "b", "&", "0xff", ")", ")", ";", "}", "// repeat if to small", "while", "(", "sb", ".", "length", "(", ")", "<", "length", ")", "{", "sb", ".", "append", "(", "sb", ".", "toString", "(", ")", ")", ";", "}", "// truncation and return", "return", "sb", ".", "delete", "(", "length", ",", "sb", ".", "length", "(", ")", ")", ".", "toString", "(", ")", ";", "}", "catch", "(", "NoSuchAlgorithmException", "|", "UnsupportedCharsetException", "e", ")", "{", "// Hashalgo. and charset is mandatory for all kinds of JDK, so this should happend. But even when, we generate a random string.", "return", "createRandomAlphanumeric", "(", "length", ")", ";", "}", "}" ]
Creates a alphanumeric projection with a given length of the given object using its {@link Object#hashCode()}.
[ "Creates", "a", "alphanumeric", "projection", "with", "a", "given", "length", "of", "the", "given", "object", "using", "its", "{" ]
train
https://github.com/tracee/tracee/blob/15a68e435248f57757beb8ceac6db5b7f6035bb3/core/src/main/java/io/tracee/Utilities.java#L39-L59
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer/src/com/ibm/wsspi/webcontainer/logging/WebContainerLogger.java
WebContainerLogger.getLogger
public static Logger getLogger(final String name, final String resourceBundleName) { """ getLogger method will create an instance of WebContainerLogger with the appropriate Logger object @param name - the name of the logger @param resourceBundleName - the message repository @return - an instance of WebContainerLogger """ WebContainerLogger tempLogger = map.get(name); if (tempLogger==null){ tempLogger = (WebContainerLogger) AccessController.doPrivileged( new PrivilegedAction<WebContainerLogger>() { public WebContainerLogger run() { return new WebContainerLogger( Logger.getLogger(name,resourceBundleName), name, resourceBundleName); } }); map.put(name, tempLogger); } return tempLogger; }
java
public static Logger getLogger(final String name, final String resourceBundleName){ WebContainerLogger tempLogger = map.get(name); if (tempLogger==null){ tempLogger = (WebContainerLogger) AccessController.doPrivileged( new PrivilegedAction<WebContainerLogger>() { public WebContainerLogger run() { return new WebContainerLogger( Logger.getLogger(name,resourceBundleName), name, resourceBundleName); } }); map.put(name, tempLogger); } return tempLogger; }
[ "public", "static", "Logger", "getLogger", "(", "final", "String", "name", ",", "final", "String", "resourceBundleName", ")", "{", "WebContainerLogger", "tempLogger", "=", "map", ".", "get", "(", "name", ")", ";", "if", "(", "tempLogger", "==", "null", ")", "{", "tempLogger", "=", "(", "WebContainerLogger", ")", "AccessController", ".", "doPrivileged", "(", "new", "PrivilegedAction", "<", "WebContainerLogger", ">", "(", ")", "{", "public", "WebContainerLogger", "run", "(", ")", "{", "return", "new", "WebContainerLogger", "(", "Logger", ".", "getLogger", "(", "name", ",", "resourceBundleName", ")", ",", "name", ",", "resourceBundleName", ")", ";", "}", "}", ")", ";", "map", ".", "put", "(", "name", ",", "tempLogger", ")", ";", "}", "return", "tempLogger", ";", "}" ]
getLogger method will create an instance of WebContainerLogger with the appropriate Logger object @param name - the name of the logger @param resourceBundleName - the message repository @return - an instance of WebContainerLogger
[ "getLogger", "method", "will", "create", "an", "instance", "of", "WebContainerLogger", "with", "the", "appropriate", "Logger", "object" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/wsspi/webcontainer/logging/WebContainerLogger.java#L41-L55
ThreeTen/threetenbp
src/main/java/org/threeten/bp/format/DateTimeFormatterBuilder.java
DateTimeFormatterBuilder.appendFraction
public DateTimeFormatterBuilder appendFraction( TemporalField field, int minWidth, int maxWidth, boolean decimalPoint) { """ Appends the fractional value of a date-time field to the formatter. <p> The fractional value of the field will be output including the preceding decimal point. The preceding value is not output. For example, the second-of-minute value of 15 would be output as {@code .25}. <p> The width of the printed fraction can be controlled. Setting the minimum width to zero will cause no output to be generated. The printed fraction will have the minimum width necessary between the minimum and maximum widths - trailing zeroes are omitted. No rounding occurs due to the maximum width - digits are simply dropped. <p> When parsing in strict mode, the number of parsed digits must be between the minimum and maximum width. When parsing in lenient mode, the minimum width is considered to be zero and the maximum is nine. <p> If the value cannot be obtained then an exception will be thrown. If the value is negative an exception will be thrown. If the field does not have a fixed set of valid values then an exception will be thrown. If the field value in the date-time to be printed is invalid it cannot be printed and an exception will be thrown. @param field the field to append, not null @param minWidth the minimum width of the field excluding the decimal point, from 0 to 9 @param maxWidth the maximum width of the field excluding the decimal point, from 1 to 9 @param decimalPoint whether to output the localized decimal point symbol @return this, for chaining, not null @throws IllegalArgumentException if the field has a variable set of valid values or either width is invalid """ appendInternal(new FractionPrinterParser(field, minWidth, maxWidth, decimalPoint)); return this; }
java
public DateTimeFormatterBuilder appendFraction( TemporalField field, int minWidth, int maxWidth, boolean decimalPoint) { appendInternal(new FractionPrinterParser(field, minWidth, maxWidth, decimalPoint)); return this; }
[ "public", "DateTimeFormatterBuilder", "appendFraction", "(", "TemporalField", "field", ",", "int", "minWidth", ",", "int", "maxWidth", ",", "boolean", "decimalPoint", ")", "{", "appendInternal", "(", "new", "FractionPrinterParser", "(", "field", ",", "minWidth", ",", "maxWidth", ",", "decimalPoint", ")", ")", ";", "return", "this", ";", "}" ]
Appends the fractional value of a date-time field to the formatter. <p> The fractional value of the field will be output including the preceding decimal point. The preceding value is not output. For example, the second-of-minute value of 15 would be output as {@code .25}. <p> The width of the printed fraction can be controlled. Setting the minimum width to zero will cause no output to be generated. The printed fraction will have the minimum width necessary between the minimum and maximum widths - trailing zeroes are omitted. No rounding occurs due to the maximum width - digits are simply dropped. <p> When parsing in strict mode, the number of parsed digits must be between the minimum and maximum width. When parsing in lenient mode, the minimum width is considered to be zero and the maximum is nine. <p> If the value cannot be obtained then an exception will be thrown. If the value is negative an exception will be thrown. If the field does not have a fixed set of valid values then an exception will be thrown. If the field value in the date-time to be printed is invalid it cannot be printed and an exception will be thrown. @param field the field to append, not null @param minWidth the minimum width of the field excluding the decimal point, from 0 to 9 @param maxWidth the maximum width of the field excluding the decimal point, from 1 to 9 @param decimalPoint whether to output the localized decimal point symbol @return this, for chaining, not null @throws IllegalArgumentException if the field has a variable set of valid values or either width is invalid
[ "Appends", "the", "fractional", "value", "of", "a", "date", "-", "time", "field", "to", "the", "formatter", ".", "<p", ">", "The", "fractional", "value", "of", "the", "field", "will", "be", "output", "including", "the", "preceding", "decimal", "point", ".", "The", "preceding", "value", "is", "not", "output", ".", "For", "example", "the", "second", "-", "of", "-", "minute", "value", "of", "15", "would", "be", "output", "as", "{", "@code", ".", "25", "}", ".", "<p", ">", "The", "width", "of", "the", "printed", "fraction", "can", "be", "controlled", ".", "Setting", "the", "minimum", "width", "to", "zero", "will", "cause", "no", "output", "to", "be", "generated", ".", "The", "printed", "fraction", "will", "have", "the", "minimum", "width", "necessary", "between", "the", "minimum", "and", "maximum", "widths", "-", "trailing", "zeroes", "are", "omitted", ".", "No", "rounding", "occurs", "due", "to", "the", "maximum", "width", "-", "digits", "are", "simply", "dropped", ".", "<p", ">", "When", "parsing", "in", "strict", "mode", "the", "number", "of", "parsed", "digits", "must", "be", "between", "the", "minimum", "and", "maximum", "width", ".", "When", "parsing", "in", "lenient", "mode", "the", "minimum", "width", "is", "considered", "to", "be", "zero", "and", "the", "maximum", "is", "nine", ".", "<p", ">", "If", "the", "value", "cannot", "be", "obtained", "then", "an", "exception", "will", "be", "thrown", ".", "If", "the", "value", "is", "negative", "an", "exception", "will", "be", "thrown", ".", "If", "the", "field", "does", "not", "have", "a", "fixed", "set", "of", "valid", "values", "then", "an", "exception", "will", "be", "thrown", ".", "If", "the", "field", "value", "in", "the", "date", "-", "time", "to", "be", "printed", "is", "invalid", "it", "cannot", "be", "printed", "and", "an", "exception", "will", "be", "thrown", "." ]
train
https://github.com/ThreeTen/threetenbp/blob/5f05b649f89f205aabd96b2f83c36796ec616fe6/src/main/java/org/threeten/bp/format/DateTimeFormatterBuilder.java#L639-L643
krummas/DrizzleJDBC
src/main/java/org/drizzle/jdbc/internal/common/packet/buffer/Reader.java
Reader.readString
public String readString(final String charset) throws IOException { """ Reads a string from the buffer, looks for a 0 to end the string @param charset the charset to use, for example ASCII @return the read string @throws java.io.IOException if it is not possible to create the string from the buffer """ byte ch; int cnt = 0; final byte [] byteArrBuff = new byte[byteBuffer.remaining()]; while (byteBuffer.remaining() > 0 && ((ch = byteBuffer.get()) != 0)) { byteArrBuff[cnt++] = ch; } return new String(byteArrBuff,0,cnt); }
java
public String readString(final String charset) throws IOException { byte ch; int cnt = 0; final byte [] byteArrBuff = new byte[byteBuffer.remaining()]; while (byteBuffer.remaining() > 0 && ((ch = byteBuffer.get()) != 0)) { byteArrBuff[cnt++] = ch; } return new String(byteArrBuff,0,cnt); }
[ "public", "String", "readString", "(", "final", "String", "charset", ")", "throws", "IOException", "{", "byte", "ch", ";", "int", "cnt", "=", "0", ";", "final", "byte", "[", "]", "byteArrBuff", "=", "new", "byte", "[", "byteBuffer", ".", "remaining", "(", ")", "]", ";", "while", "(", "byteBuffer", ".", "remaining", "(", ")", ">", "0", "&&", "(", "(", "ch", "=", "byteBuffer", ".", "get", "(", ")", ")", "!=", "0", ")", ")", "{", "byteArrBuff", "[", "cnt", "++", "]", "=", "ch", ";", "}", "return", "new", "String", "(", "byteArrBuff", ",", "0", ",", "cnt", ")", ";", "}" ]
Reads a string from the buffer, looks for a 0 to end the string @param charset the charset to use, for example ASCII @return the read string @throws java.io.IOException if it is not possible to create the string from the buffer
[ "Reads", "a", "string", "from", "the", "buffer", "looks", "for", "a", "0", "to", "end", "the", "string" ]
train
https://github.com/krummas/DrizzleJDBC/blob/716f31fd71f3cc289edf69844d8117deb86d98d6/src/main/java/org/drizzle/jdbc/internal/common/packet/buffer/Reader.java#L53-L61
JodaOrg/joda-time
src/main/java/org/joda/time/Period.java
Period.withHours
public Period withHours(int hours) { """ Returns a new period with the specified number of hours. <p> This period instance is immutable and unaffected by this method call. @param hours the amount of hours to add, may be negative @return the new period with the increased hours @throws UnsupportedOperationException if the field is not supported """ int[] values = getValues(); // cloned getPeriodType().setIndexedField(this, PeriodType.HOUR_INDEX, values, hours); return new Period(values, getPeriodType()); }
java
public Period withHours(int hours) { int[] values = getValues(); // cloned getPeriodType().setIndexedField(this, PeriodType.HOUR_INDEX, values, hours); return new Period(values, getPeriodType()); }
[ "public", "Period", "withHours", "(", "int", "hours", ")", "{", "int", "[", "]", "values", "=", "getValues", "(", ")", ";", "// cloned", "getPeriodType", "(", ")", ".", "setIndexedField", "(", "this", ",", "PeriodType", ".", "HOUR_INDEX", ",", "values", ",", "hours", ")", ";", "return", "new", "Period", "(", "values", ",", "getPeriodType", "(", ")", ")", ";", "}" ]
Returns a new period with the specified number of hours. <p> This period instance is immutable and unaffected by this method call. @param hours the amount of hours to add, may be negative @return the new period with the increased hours @throws UnsupportedOperationException if the field is not supported
[ "Returns", "a", "new", "period", "with", "the", "specified", "number", "of", "hours", ".", "<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#L974-L978
arquillian/arquillian-extension-warp
spi/src/main/java/org/jboss/arquillian/warp/spi/LifecycleManager.java
LifecycleManager.bindTo
public final <T> void bindTo(Class<T> clazz, T object) throws ObjectAlreadyAssociatedException { """ Binds the current {@link LifecycleManager} with given object of given class. @param clazz the class to be bound @param object the object to be bound @throws ObjectAlreadyAssociatedException when there is already object bound with {@link LifecycleManager} for given class. """ LifecycleManagerStore.getCurrentStore().bind(this, clazz, object); }
java
public final <T> void bindTo(Class<T> clazz, T object) throws ObjectAlreadyAssociatedException { LifecycleManagerStore.getCurrentStore().bind(this, clazz, object); }
[ "public", "final", "<", "T", ">", "void", "bindTo", "(", "Class", "<", "T", ">", "clazz", ",", "T", "object", ")", "throws", "ObjectAlreadyAssociatedException", "{", "LifecycleManagerStore", ".", "getCurrentStore", "(", ")", ".", "bind", "(", "this", ",", "clazz", ",", "object", ")", ";", "}" ]
Binds the current {@link LifecycleManager} with given object of given class. @param clazz the class to be bound @param object the object to be bound @throws ObjectAlreadyAssociatedException when there is already object bound with {@link LifecycleManager} for given class.
[ "Binds", "the", "current", "{", "@link", "LifecycleManager", "}", "with", "given", "object", "of", "given", "class", "." ]
train
https://github.com/arquillian/arquillian-extension-warp/blob/e958f4d782851baf7f40e39835d3d1ad185b74dd/spi/src/main/java/org/jboss/arquillian/warp/spi/LifecycleManager.java#L137-L139
icode/ameba
src/main/java/ameba/db/ebean/internal/ModelInterceptor.java
ModelInterceptor.applyPageList
public static FutureRowCount applyPageList(MultivaluedMap<String, String> queryParams, Query query) { """ <p>applyPageList.</p> @param queryParams a {@link javax.ws.rs.core.MultivaluedMap} object. @param query a {@link io.ebean.Query} object. @return a {@link io.ebean.FutureRowCount} object. """ FutureRowCount futureRowCount = fetchRowCount(queryParams, query); applyPageConfig(queryParams, query); return futureRowCount; }
java
public static FutureRowCount applyPageList(MultivaluedMap<String, String> queryParams, Query query) { FutureRowCount futureRowCount = fetchRowCount(queryParams, query); applyPageConfig(queryParams, query); return futureRowCount; }
[ "public", "static", "FutureRowCount", "applyPageList", "(", "MultivaluedMap", "<", "String", ",", "String", ">", "queryParams", ",", "Query", "query", ")", "{", "FutureRowCount", "futureRowCount", "=", "fetchRowCount", "(", "queryParams", ",", "query", ")", ";", "applyPageConfig", "(", "queryParams", ",", "query", ")", ";", "return", "futureRowCount", ";", "}" ]
<p>applyPageList.</p> @param queryParams a {@link javax.ws.rs.core.MultivaluedMap} object. @param query a {@link io.ebean.Query} object. @return a {@link io.ebean.FutureRowCount} object.
[ "<p", ">", "applyPageList", ".", "<", "/", "p", ">" ]
train
https://github.com/icode/ameba/blob/9d4956e935898e41331b2745e400ef869cd265e0/src/main/java/ameba/db/ebean/internal/ModelInterceptor.java#L268-L275
google/closure-compiler
src/com/google/javascript/refactoring/Matchers.java
Matchers.functionCallWithNumArgs
public static Matcher functionCallWithNumArgs(final int numArgs) { """ Returns a Matcher that matches any function call that has the given number of arguments. """ return new Matcher() { @Override public boolean matches(Node node, NodeMetadata metadata) { return node.isCall() && (node.getChildCount() - 1) == numArgs; } }; }
java
public static Matcher functionCallWithNumArgs(final int numArgs) { return new Matcher() { @Override public boolean matches(Node node, NodeMetadata metadata) { return node.isCall() && (node.getChildCount() - 1) == numArgs; } }; }
[ "public", "static", "Matcher", "functionCallWithNumArgs", "(", "final", "int", "numArgs", ")", "{", "return", "new", "Matcher", "(", ")", "{", "@", "Override", "public", "boolean", "matches", "(", "Node", "node", ",", "NodeMetadata", "metadata", ")", "{", "return", "node", ".", "isCall", "(", ")", "&&", "(", "node", ".", "getChildCount", "(", ")", "-", "1", ")", "==", "numArgs", ";", "}", "}", ";", "}" ]
Returns a Matcher that matches any function call that has the given number of arguments.
[ "Returns", "a", "Matcher", "that", "matches", "any", "function", "call", "that", "has", "the", "given", "number", "of", "arguments", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/refactoring/Matchers.java#L192-L198
kiegroup/droolsjbpm-integration
kie-server-parent/kie-server-remote/kie-server-client/src/main/java/org/kie/server/client/impl/AbstractKieServicesClientImpl.java
AbstractKieServicesClientImpl.makeBackwardCompatibleHttpPostRequestAndCreateServiceResponse
protected <T> ServiceResponse<T> makeBackwardCompatibleHttpPostRequestAndCreateServiceResponse(String uri, Object body, Class<T> resultType, Map<String, String> headers) { """ /* override of the regular method to allow backward compatibility for string based result of ServiceResponse """ logger.debug("About to send POST request to '{}' with payload '{}'", uri, body); KieServerHttpRequest request = newRequest( uri ).headers(headers).body(serialize( body )).post(); KieServerHttpResponse response = request.response(); owner.setConversationId(response.header(KieServerConstants.KIE_CONVERSATION_ID_TYPE_HEADER)); if ( response.code() == Response.Status.OK.getStatusCode() ) { ServiceResponse serviceResponse = deserialize( response.body(), ServiceResponse.class ); // serialize it back to string to make it backward compatible serviceResponse.setResult(serialize(serviceResponse.getResult())); checkResultType(serviceResponse, resultType); return serviceResponse; } else { throw createExceptionForUnexpectedResponseCode( request, response ); } }
java
protected <T> ServiceResponse<T> makeBackwardCompatibleHttpPostRequestAndCreateServiceResponse(String uri, Object body, Class<T> resultType, Map<String, String> headers) { logger.debug("About to send POST request to '{}' with payload '{}'", uri, body); KieServerHttpRequest request = newRequest( uri ).headers(headers).body(serialize( body )).post(); KieServerHttpResponse response = request.response(); owner.setConversationId(response.header(KieServerConstants.KIE_CONVERSATION_ID_TYPE_HEADER)); if ( response.code() == Response.Status.OK.getStatusCode() ) { ServiceResponse serviceResponse = deserialize( response.body(), ServiceResponse.class ); // serialize it back to string to make it backward compatible serviceResponse.setResult(serialize(serviceResponse.getResult())); checkResultType(serviceResponse, resultType); return serviceResponse; } else { throw createExceptionForUnexpectedResponseCode( request, response ); } }
[ "protected", "<", "T", ">", "ServiceResponse", "<", "T", ">", "makeBackwardCompatibleHttpPostRequestAndCreateServiceResponse", "(", "String", "uri", ",", "Object", "body", ",", "Class", "<", "T", ">", "resultType", ",", "Map", "<", "String", ",", "String", ">", "headers", ")", "{", "logger", ".", "debug", "(", "\"About to send POST request to '{}' with payload '{}'\"", ",", "uri", ",", "body", ")", ";", "KieServerHttpRequest", "request", "=", "newRequest", "(", "uri", ")", ".", "headers", "(", "headers", ")", ".", "body", "(", "serialize", "(", "body", ")", ")", ".", "post", "(", ")", ";", "KieServerHttpResponse", "response", "=", "request", ".", "response", "(", ")", ";", "owner", ".", "setConversationId", "(", "response", ".", "header", "(", "KieServerConstants", ".", "KIE_CONVERSATION_ID_TYPE_HEADER", ")", ")", ";", "if", "(", "response", ".", "code", "(", ")", "==", "Response", ".", "Status", ".", "OK", ".", "getStatusCode", "(", ")", ")", "{", "ServiceResponse", "serviceResponse", "=", "deserialize", "(", "response", ".", "body", "(", ")", ",", "ServiceResponse", ".", "class", ")", ";", "// serialize it back to string to make it backward compatible", "serviceResponse", ".", "setResult", "(", "serialize", "(", "serviceResponse", ".", "getResult", "(", ")", ")", ")", ";", "checkResultType", "(", "serviceResponse", ",", "resultType", ")", ";", "return", "serviceResponse", ";", "}", "else", "{", "throw", "createExceptionForUnexpectedResponseCode", "(", "request", ",", "response", ")", ";", "}", "}" ]
/* override of the regular method to allow backward compatibility for string based result of ServiceResponse
[ "/", "*", "override", "of", "the", "regular", "method", "to", "allow", "backward", "compatibility", "for", "string", "based", "result", "of", "ServiceResponse" ]
train
https://github.com/kiegroup/droolsjbpm-integration/blob/6c26200ab03855dbb92b56ca0c6363cdec0eaf2c/kie-server-parent/kie-server-remote/kie-server-client/src/main/java/org/kie/server/client/impl/AbstractKieServicesClientImpl.java#L758-L774
liyiorg/weixin-popular
src/main/java/weixin/popular/client/LocalHttpClient.java
LocalHttpClient.initMchKeyStore
public static void initMchKeyStore(String mch_id,String keyStoreFilePath) { """ 初始化 MCH HttpClient KeyStore @param mch_id mch_id @param keyStoreFilePath keyStoreFilePath """ try { initMchKeyStore(mch_id, new FileInputStream(new File(keyStoreFilePath))); } catch (FileNotFoundException e) { logger.error("init error", e); } }
java
public static void initMchKeyStore(String mch_id,String keyStoreFilePath){ try { initMchKeyStore(mch_id, new FileInputStream(new File(keyStoreFilePath))); } catch (FileNotFoundException e) { logger.error("init error", e); } }
[ "public", "static", "void", "initMchKeyStore", "(", "String", "mch_id", ",", "String", "keyStoreFilePath", ")", "{", "try", "{", "initMchKeyStore", "(", "mch_id", ",", "new", "FileInputStream", "(", "new", "File", "(", "keyStoreFilePath", ")", ")", ")", ";", "}", "catch", "(", "FileNotFoundException", "e", ")", "{", "logger", ".", "error", "(", "\"init error\"", ",", "e", ")", ";", "}", "}" ]
初始化 MCH HttpClient KeyStore @param mch_id mch_id @param keyStoreFilePath keyStoreFilePath
[ "初始化", "MCH", "HttpClient", "KeyStore" ]
train
https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/client/LocalHttpClient.java#L89-L95
sksamuel/scrimage
scrimage-filters/src/main/java/thirdparty/jhlabs/image/ArrayColormap.java
ArrayColormap.setColorRange
public void setColorRange(int firstIndex, int lastIndex, int color) { """ Set a range of the colormap to a single color. @param firstIndex the position of the first color @param lastIndex the position of the second color @param color the color """ for (int i = firstIndex; i <= lastIndex; i++) map[i] = color; }
java
public void setColorRange(int firstIndex, int lastIndex, int color) { for (int i = firstIndex; i <= lastIndex; i++) map[i] = color; }
[ "public", "void", "setColorRange", "(", "int", "firstIndex", ",", "int", "lastIndex", ",", "int", "color", ")", "{", "for", "(", "int", "i", "=", "firstIndex", ";", "i", "<=", "lastIndex", ";", "i", "++", ")", "map", "[", "i", "]", "=", "color", ";", "}" ]
Set a range of the colormap to a single color. @param firstIndex the position of the first color @param lastIndex the position of the second color @param color the color
[ "Set", "a", "range", "of", "the", "colormap", "to", "a", "single", "color", "." ]
train
https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/image/ArrayColormap.java#L134-L137
alkacon/opencms-core
src-gwt/org/opencms/gwt/client/util/CmsPositionBean.java
CmsPositionBean.getBoundingClientRect
public static CmsPositionBean getBoundingClientRect(Element panel, boolean addScroll) { """ Returns the bounding rectangle dimensions of the element including all floated elements.<p> @param panel the panel @param addScroll if true, the result will contain the coordinates in the document's coordinate system, not the viewport coordinate system @return the position info """ CmsPositionBean result = new CmsPositionBean(); getBoundingClientRect( panel, result, addScroll ? Window.getScrollLeft() : 0, addScroll ? Window.getScrollTop() : 0); return result; }
java
public static CmsPositionBean getBoundingClientRect(Element panel, boolean addScroll) { CmsPositionBean result = new CmsPositionBean(); getBoundingClientRect( panel, result, addScroll ? Window.getScrollLeft() : 0, addScroll ? Window.getScrollTop() : 0); return result; }
[ "public", "static", "CmsPositionBean", "getBoundingClientRect", "(", "Element", "panel", ",", "boolean", "addScroll", ")", "{", "CmsPositionBean", "result", "=", "new", "CmsPositionBean", "(", ")", ";", "getBoundingClientRect", "(", "panel", ",", "result", ",", "addScroll", "?", "Window", ".", "getScrollLeft", "(", ")", ":", "0", ",", "addScroll", "?", "Window", ".", "getScrollTop", "(", ")", ":", "0", ")", ";", "return", "result", ";", "}" ]
Returns the bounding rectangle dimensions of the element including all floated elements.<p> @param panel the panel @param addScroll if true, the result will contain the coordinates in the document's coordinate system, not the viewport coordinate system @return the position info
[ "Returns", "the", "bounding", "rectangle", "dimensions", "of", "the", "element", "including", "all", "floated", "elements", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/util/CmsPositionBean.java#L280-L289
bignerdranch/expandable-recycler-view
expandablerecyclerview/src/main/java/com/bignerdranch/expandablerecyclerview/ExpandableRecyclerAdapter.java
ExpandableRecyclerAdapter.notifyChildRemoved
@UiThread public void notifyChildRemoved(int parentPosition, int childPosition) { """ Notify any registered observers that the parent located at {@code parentPosition} has a child that has been removed from the data set, previously located at {@code childPosition}. The child list item previously located at and after {@code childPosition} may now be found at {@code childPosition - 1}. <p> This is a structural change event. Representations of other existing items in the data set are still considered up to date and will not be rebound, though their positions may be altered. @param parentPosition Position of the parent which has a child removed from, relative to the list of parents only. @param childPosition Position of the child that has been removed, relative to children of the parent specified by {@code parentPosition} only. """ int flatParentPosition = getFlatParentPosition(parentPosition); ExpandableWrapper<P, C> parentWrapper = mFlatItemList.get(flatParentPosition); parentWrapper.setParent(mParentList.get(parentPosition)); if (parentWrapper.isExpanded()) { mFlatItemList.remove(flatParentPosition + childPosition + 1); notifyItemRemoved(flatParentPosition + childPosition + 1); } }
java
@UiThread public void notifyChildRemoved(int parentPosition, int childPosition) { int flatParentPosition = getFlatParentPosition(parentPosition); ExpandableWrapper<P, C> parentWrapper = mFlatItemList.get(flatParentPosition); parentWrapper.setParent(mParentList.get(parentPosition)); if (parentWrapper.isExpanded()) { mFlatItemList.remove(flatParentPosition + childPosition + 1); notifyItemRemoved(flatParentPosition + childPosition + 1); } }
[ "@", "UiThread", "public", "void", "notifyChildRemoved", "(", "int", "parentPosition", ",", "int", "childPosition", ")", "{", "int", "flatParentPosition", "=", "getFlatParentPosition", "(", "parentPosition", ")", ";", "ExpandableWrapper", "<", "P", ",", "C", ">", "parentWrapper", "=", "mFlatItemList", ".", "get", "(", "flatParentPosition", ")", ";", "parentWrapper", ".", "setParent", "(", "mParentList", ".", "get", "(", "parentPosition", ")", ")", ";", "if", "(", "parentWrapper", ".", "isExpanded", "(", ")", ")", "{", "mFlatItemList", ".", "remove", "(", "flatParentPosition", "+", "childPosition", "+", "1", ")", ";", "notifyItemRemoved", "(", "flatParentPosition", "+", "childPosition", "+", "1", ")", ";", "}", "}" ]
Notify any registered observers that the parent located at {@code parentPosition} has a child that has been removed from the data set, previously located at {@code childPosition}. The child list item previously located at and after {@code childPosition} may now be found at {@code childPosition - 1}. <p> This is a structural change event. Representations of other existing items in the data set are still considered up to date and will not be rebound, though their positions may be altered. @param parentPosition Position of the parent which has a child removed from, relative to the list of parents only. @param childPosition Position of the child that has been removed, relative to children of the parent specified by {@code parentPosition} only.
[ "Notify", "any", "registered", "observers", "that", "the", "parent", "located", "at", "{", "@code", "parentPosition", "}", "has", "a", "child", "that", "has", "been", "removed", "from", "the", "data", "set", "previously", "located", "at", "{", "@code", "childPosition", "}", ".", "The", "child", "list", "item", "previously", "located", "at", "and", "after", "{", "@code", "childPosition", "}", "may", "now", "be", "found", "at", "{", "@code", "childPosition", "-", "1", "}", ".", "<p", ">", "This", "is", "a", "structural", "change", "event", ".", "Representations", "of", "other", "existing", "items", "in", "the", "data", "set", "are", "still", "considered", "up", "to", "date", "and", "will", "not", "be", "rebound", "though", "their", "positions", "may", "be", "altered", "." ]
train
https://github.com/bignerdranch/expandable-recycler-view/blob/930912510620894c531d236856fa79d646e2f1ed/expandablerecyclerview/src/main/java/com/bignerdranch/expandablerecyclerview/ExpandableRecyclerAdapter.java#L1188-L1198
UrielCh/ovh-java-sdk
ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java
ApiOvhDomain.zone_zoneName_redirection_POST
public OvhRedirection zone_zoneName_redirection_POST(String zoneName, String description, String keywords, String subDomain, String target, String title, OvhRedirectionTypeEnum type) throws IOException { """ Create a new redirection (Don't forget to refresh the zone) REST: POST /domain/zone/{zoneName}/redirection @param keywords [required] Keywords for invisible redirection @param title [required] Title for invisible redirection @param type [required] Redirection type @param target [required] Target of the redirection @param description [required] Desciption for invisible redirection @param subDomain [required] subdomain to redirect @param zoneName [required] The internal name of your zone """ String qPath = "/domain/zone/{zoneName}/redirection"; StringBuilder sb = path(qPath, zoneName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "description", description); addBody(o, "keywords", keywords); addBody(o, "subDomain", subDomain); addBody(o, "target", target); addBody(o, "title", title); addBody(o, "type", type); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhRedirection.class); }
java
public OvhRedirection zone_zoneName_redirection_POST(String zoneName, String description, String keywords, String subDomain, String target, String title, OvhRedirectionTypeEnum type) throws IOException { String qPath = "/domain/zone/{zoneName}/redirection"; StringBuilder sb = path(qPath, zoneName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "description", description); addBody(o, "keywords", keywords); addBody(o, "subDomain", subDomain); addBody(o, "target", target); addBody(o, "title", title); addBody(o, "type", type); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhRedirection.class); }
[ "public", "OvhRedirection", "zone_zoneName_redirection_POST", "(", "String", "zoneName", ",", "String", "description", ",", "String", "keywords", ",", "String", "subDomain", ",", "String", "target", ",", "String", "title", ",", "OvhRedirectionTypeEnum", "type", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/domain/zone/{zoneName}/redirection\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "zoneName", ")", ";", "HashMap", "<", "String", ",", "Object", ">", "o", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "addBody", "(", "o", ",", "\"description\"", ",", "description", ")", ";", "addBody", "(", "o", ",", "\"keywords\"", ",", "keywords", ")", ";", "addBody", "(", "o", ",", "\"subDomain\"", ",", "subDomain", ")", ";", "addBody", "(", "o", ",", "\"target\"", ",", "target", ")", ";", "addBody", "(", "o", ",", "\"title\"", ",", "title", ")", ";", "addBody", "(", "o", ",", "\"type\"", ",", "type", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"POST\"", ",", "sb", ".", "toString", "(", ")", ",", "o", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhRedirection", ".", "class", ")", ";", "}" ]
Create a new redirection (Don't forget to refresh the zone) REST: POST /domain/zone/{zoneName}/redirection @param keywords [required] Keywords for invisible redirection @param title [required] Title for invisible redirection @param type [required] Redirection type @param target [required] Target of the redirection @param description [required] Desciption for invisible redirection @param subDomain [required] subdomain to redirect @param zoneName [required] The internal name of your zone
[ "Create", "a", "new", "redirection", "(", "Don", "t", "forget", "to", "refresh", "the", "zone", ")" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java#L826-L838
zaproxy/zaproxy
src/org/zaproxy/zap/spider/SpiderController.java
SpiderController.createURI
private URI createURI(String uri) { """ Creates the {@link URI} starting from the uri string. First it tries to convert it into a String considering it's already encoded and, if it fails, tries to create it considering it's not encoded. @param uri the string of the uri @return the URI, or null if an error occurred and the URI could not be constructed. """ URI uriV = null; try { // Try to see if we can create the URI, considering it's encoded. uriV = new URI(uri, true); } catch (URIException e) { // An error occurred, so try to create the URI considering it's not encoded. try { log.debug("Second try..."); uriV = new URI(uri, false); } catch (Exception ex) { log.error("Error while converting to uri: " + uri, ex); return null; } // A non URIException occurred, so just ignore the URI } catch (Exception e) { log.error("Error while converting to uri: " + uri, e); return null; } return uriV; }
java
private URI createURI(String uri) { URI uriV = null; try { // Try to see if we can create the URI, considering it's encoded. uriV = new URI(uri, true); } catch (URIException e) { // An error occurred, so try to create the URI considering it's not encoded. try { log.debug("Second try..."); uriV = new URI(uri, false); } catch (Exception ex) { log.error("Error while converting to uri: " + uri, ex); return null; } // A non URIException occurred, so just ignore the URI } catch (Exception e) { log.error("Error while converting to uri: " + uri, e); return null; } return uriV; }
[ "private", "URI", "createURI", "(", "String", "uri", ")", "{", "URI", "uriV", "=", "null", ";", "try", "{", "// Try to see if we can create the URI, considering it's encoded.", "uriV", "=", "new", "URI", "(", "uri", ",", "true", ")", ";", "}", "catch", "(", "URIException", "e", ")", "{", "// An error occurred, so try to create the URI considering it's not encoded.", "try", "{", "log", ".", "debug", "(", "\"Second try...\"", ")", ";", "uriV", "=", "new", "URI", "(", "uri", ",", "false", ")", ";", "}", "catch", "(", "Exception", "ex", ")", "{", "log", ".", "error", "(", "\"Error while converting to uri: \"", "+", "uri", ",", "ex", ")", ";", "return", "null", ";", "}", "// A non URIException occurred, so just ignore the URI", "}", "catch", "(", "Exception", "e", ")", "{", "log", ".", "error", "(", "\"Error while converting to uri: \"", "+", "uri", ",", "e", ")", ";", "return", "null", ";", "}", "return", "uriV", ";", "}" ]
Creates the {@link URI} starting from the uri string. First it tries to convert it into a String considering it's already encoded and, if it fails, tries to create it considering it's not encoded. @param uri the string of the uri @return the URI, or null if an error occurred and the URI could not be constructed.
[ "Creates", "the", "{", "@link", "URI", "}", "starting", "from", "the", "uri", "string", ".", "First", "it", "tries", "to", "convert", "it", "into", "a", "String", "considering", "it", "s", "already", "encoded", "and", "if", "it", "fails", "tries", "to", "create", "it", "considering", "it", "s", "not", "encoded", "." ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/spider/SpiderController.java#L379-L399
lecousin/java-framework-core
net.lecousin.core/src/main/java/net/lecousin/framework/util/DebugUtil.java
DebugUtil.createStackTrace
public static StringBuilder createStackTrace(StringBuilder s, Throwable t, boolean includeCause) { """ Append a stack trace of the given Throwable to the StringBuilder. """ s.append(t.getClass().getName()); s.append(": "); s.append(t.getMessage()); createStackTrace(s, t.getStackTrace()); if (includeCause) { Throwable cause = t.getCause(); if (cause != null && cause != t) { s.append("\nCaused by: "); createStackTrace(s, cause, true); } } return s; }
java
public static StringBuilder createStackTrace(StringBuilder s, Throwable t, boolean includeCause) { s.append(t.getClass().getName()); s.append(": "); s.append(t.getMessage()); createStackTrace(s, t.getStackTrace()); if (includeCause) { Throwable cause = t.getCause(); if (cause != null && cause != t) { s.append("\nCaused by: "); createStackTrace(s, cause, true); } } return s; }
[ "public", "static", "StringBuilder", "createStackTrace", "(", "StringBuilder", "s", ",", "Throwable", "t", ",", "boolean", "includeCause", ")", "{", "s", ".", "append", "(", "t", ".", "getClass", "(", ")", ".", "getName", "(", ")", ")", ";", "s", ".", "append", "(", "\": \"", ")", ";", "s", ".", "append", "(", "t", ".", "getMessage", "(", ")", ")", ";", "createStackTrace", "(", "s", ",", "t", ".", "getStackTrace", "(", ")", ")", ";", "if", "(", "includeCause", ")", "{", "Throwable", "cause", "=", "t", ".", "getCause", "(", ")", ";", "if", "(", "cause", "!=", "null", "&&", "cause", "!=", "t", ")", "{", "s", ".", "append", "(", "\"\\nCaused by: \"", ")", ";", "createStackTrace", "(", "s", ",", "cause", ",", "true", ")", ";", "}", "}", "return", "s", ";", "}" ]
Append a stack trace of the given Throwable to the StringBuilder.
[ "Append", "a", "stack", "trace", "of", "the", "given", "Throwable", "to", "the", "StringBuilder", "." ]
train
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/util/DebugUtil.java#L20-L33
networknt/light-4j
utility/src/main/java/com/networknt/utility/StringUtils.java
StringUtils.substringBeforeLast
public static String substringBeforeLast(final String str, final String separator) { """ <p>Gets the substring before the last occurrence of a separator. The separator is not returned.</p> <p>A {@code null} string input will return {@code null}. An empty ("") string input will return the empty string. An empty or {@code null} separator will return the input string.</p> <p>If nothing is found, the string input is returned.</p> <pre> StringUtils.substringBeforeLast(null, *) = null StringUtils.substringBeforeLast("", *) = "" StringUtils.substringBeforeLast("abcba", "b") = "abc" StringUtils.substringBeforeLast("abc", "c") = "ab" StringUtils.substringBeforeLast("a", "a") = "" StringUtils.substringBeforeLast("a", "z") = "a" StringUtils.substringBeforeLast("a", null) = "a" StringUtils.substringBeforeLast("a", "") = "a" </pre> @param str the String to get a substring from, may be null @param separator the String to search for, may be null @return the substring before the last occurrence of the separator, {@code null} if null String input @since 2.0 """ if (isEmpty(str) || isEmpty(separator)) { return str; } final int pos = str.lastIndexOf(separator); if (pos == INDEX_NOT_FOUND) { return str; } return str.substring(0, pos); }
java
public static String substringBeforeLast(final String str, final String separator) { if (isEmpty(str) || isEmpty(separator)) { return str; } final int pos = str.lastIndexOf(separator); if (pos == INDEX_NOT_FOUND) { return str; } return str.substring(0, pos); }
[ "public", "static", "String", "substringBeforeLast", "(", "final", "String", "str", ",", "final", "String", "separator", ")", "{", "if", "(", "isEmpty", "(", "str", ")", "||", "isEmpty", "(", "separator", ")", ")", "{", "return", "str", ";", "}", "final", "int", "pos", "=", "str", ".", "lastIndexOf", "(", "separator", ")", ";", "if", "(", "pos", "==", "INDEX_NOT_FOUND", ")", "{", "return", "str", ";", "}", "return", "str", ".", "substring", "(", "0", ",", "pos", ")", ";", "}" ]
<p>Gets the substring before the last occurrence of a separator. The separator is not returned.</p> <p>A {@code null} string input will return {@code null}. An empty ("") string input will return the empty string. An empty or {@code null} separator will return the input string.</p> <p>If nothing is found, the string input is returned.</p> <pre> StringUtils.substringBeforeLast(null, *) = null StringUtils.substringBeforeLast("", *) = "" StringUtils.substringBeforeLast("abcba", "b") = "abc" StringUtils.substringBeforeLast("abc", "c") = "ab" StringUtils.substringBeforeLast("a", "a") = "" StringUtils.substringBeforeLast("a", "z") = "a" StringUtils.substringBeforeLast("a", null) = "a" StringUtils.substringBeforeLast("a", "") = "a" </pre> @param str the String to get a substring from, may be null @param separator the String to search for, may be null @return the substring before the last occurrence of the separator, {@code null} if null String input @since 2.0
[ "<p", ">", "Gets", "the", "substring", "before", "the", "last", "occurrence", "of", "a", "separator", ".", "The", "separator", "is", "not", "returned", ".", "<", "/", "p", ">" ]
train
https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/utility/src/main/java/com/networknt/utility/StringUtils.java#L572-L581
OpenTSDB/opentsdb
src/tsd/QueryRpc.java
QueryRpc.parseQuery
public static TSQuery parseQuery(final TSDB tsdb, final HttpQuery query) { """ Parses a query string legacy style query from the URI @param tsdb The TSDB we belong to @param query The HTTP Query for parsing @return A TSQuery if parsing was successful @throws BadRequestException if parsing was unsuccessful @since 2.3 """ return parseQuery(tsdb, query, null); }
java
public static TSQuery parseQuery(final TSDB tsdb, final HttpQuery query) { return parseQuery(tsdb, query, null); }
[ "public", "static", "TSQuery", "parseQuery", "(", "final", "TSDB", "tsdb", ",", "final", "HttpQuery", "query", ")", "{", "return", "parseQuery", "(", "tsdb", ",", "query", ",", "null", ")", ";", "}" ]
Parses a query string legacy style query from the URI @param tsdb The TSDB we belong to @param query The HTTP Query for parsing @return A TSQuery if parsing was successful @throws BadRequestException if parsing was unsuccessful @since 2.3
[ "Parses", "a", "query", "string", "legacy", "style", "query", "from", "the", "URI" ]
train
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tsd/QueryRpc.java#L521-L523
xiancloud/xian
xian-zookeeper/xian-curator/xian-curator-recipes/src/main/java/org/apache/curator/framework/recipes/queue/DistributedQueue.java
DistributedQueue.flushPuts
@Override public boolean flushPuts(long waitTime, TimeUnit timeUnit) throws InterruptedException { """ Wait until any pending puts are committed @param waitTime max wait time @param timeUnit time unit @return true if the flush was successful, false if it timed out first @throws InterruptedException if thread was interrupted """ long msWaitRemaining = TimeUnit.MILLISECONDS.convert(waitTime, timeUnit); synchronized(putCount) { while ( putCount.get() > 0 ) { if ( msWaitRemaining <= 0 ) { return false; } long startMs = System.currentTimeMillis(); putCount.wait(msWaitRemaining); long elapsedMs = System.currentTimeMillis() - startMs; msWaitRemaining -= elapsedMs; } } return true; }
java
@Override public boolean flushPuts(long waitTime, TimeUnit timeUnit) throws InterruptedException { long msWaitRemaining = TimeUnit.MILLISECONDS.convert(waitTime, timeUnit); synchronized(putCount) { while ( putCount.get() > 0 ) { if ( msWaitRemaining <= 0 ) { return false; } long startMs = System.currentTimeMillis(); putCount.wait(msWaitRemaining); long elapsedMs = System.currentTimeMillis() - startMs; msWaitRemaining -= elapsedMs; } } return true; }
[ "@", "Override", "public", "boolean", "flushPuts", "(", "long", "waitTime", ",", "TimeUnit", "timeUnit", ")", "throws", "InterruptedException", "{", "long", "msWaitRemaining", "=", "TimeUnit", ".", "MILLISECONDS", ".", "convert", "(", "waitTime", ",", "timeUnit", ")", ";", "synchronized", "(", "putCount", ")", "{", "while", "(", "putCount", ".", "get", "(", ")", ">", "0", ")", "{", "if", "(", "msWaitRemaining", "<=", "0", ")", "{", "return", "false", ";", "}", "long", "startMs", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "putCount", ".", "wait", "(", "msWaitRemaining", ")", ";", "long", "elapsedMs", "=", "System", ".", "currentTimeMillis", "(", ")", "-", "startMs", ";", "msWaitRemaining", "-=", "elapsedMs", ";", "}", "}", "return", "true", ";", "}" ]
Wait until any pending puts are committed @param waitTime max wait time @param timeUnit time unit @return true if the flush was successful, false if it timed out first @throws InterruptedException if thread was interrupted
[ "Wait", "until", "any", "pending", "puts", "are", "committed" ]
train
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-zookeeper/xian-curator/xian-curator-recipes/src/main/java/org/apache/curator/framework/recipes/queue/DistributedQueue.java#L268-L290
mojohaus/jaxb2-maven-plugin
src/main/java/org/codehaus/mojo/jaxb2/schemageneration/postprocessing/javadoc/DomHelper.java
DomHelper.getClassLocation
public static ClassLocation getClassLocation(final Node aNode, final Set<ClassLocation> classLocations) { """ Retrieves the ClassLocation for the supplied aNode. @param aNode A non-null DOM Node. @param classLocations The set of known ClassLocations, extracted from the JavaDocs. @return the ClassLocation matching the supplied Node """ if (aNode != null) { // The LocalName of the supplied DOM Node should be either "complexType" or "simpleType". final String nodeLocalName = aNode.getLocalName(); final boolean acceptableType = "complexType".equalsIgnoreCase(nodeLocalName) || "simpleType".equalsIgnoreCase(nodeLocalName); if (acceptableType) { final String nodeClassName = DomHelper.getNameAttribute(aNode); for (ClassLocation current : classLocations) { // TODO: Ensure that the namespace of the supplied aNode matches the expected namespace. // Issue #25: Handle XML Type renaming. final String effectiveClassName = current.getAnnotationRenamedTo() == null ? current.getClassName() : current.getAnnotationRenamedTo(); if (effectiveClassName.equalsIgnoreCase(nodeClassName)) { return current; } } } } // Nothing found return null; }
java
public static ClassLocation getClassLocation(final Node aNode, final Set<ClassLocation> classLocations) { if (aNode != null) { // The LocalName of the supplied DOM Node should be either "complexType" or "simpleType". final String nodeLocalName = aNode.getLocalName(); final boolean acceptableType = "complexType".equalsIgnoreCase(nodeLocalName) || "simpleType".equalsIgnoreCase(nodeLocalName); if (acceptableType) { final String nodeClassName = DomHelper.getNameAttribute(aNode); for (ClassLocation current : classLocations) { // TODO: Ensure that the namespace of the supplied aNode matches the expected namespace. // Issue #25: Handle XML Type renaming. final String effectiveClassName = current.getAnnotationRenamedTo() == null ? current.getClassName() : current.getAnnotationRenamedTo(); if (effectiveClassName.equalsIgnoreCase(nodeClassName)) { return current; } } } } // Nothing found return null; }
[ "public", "static", "ClassLocation", "getClassLocation", "(", "final", "Node", "aNode", ",", "final", "Set", "<", "ClassLocation", ">", "classLocations", ")", "{", "if", "(", "aNode", "!=", "null", ")", "{", "// The LocalName of the supplied DOM Node should be either \"complexType\" or \"simpleType\".", "final", "String", "nodeLocalName", "=", "aNode", ".", "getLocalName", "(", ")", ";", "final", "boolean", "acceptableType", "=", "\"complexType\"", ".", "equalsIgnoreCase", "(", "nodeLocalName", ")", "||", "\"simpleType\"", ".", "equalsIgnoreCase", "(", "nodeLocalName", ")", ";", "if", "(", "acceptableType", ")", "{", "final", "String", "nodeClassName", "=", "DomHelper", ".", "getNameAttribute", "(", "aNode", ")", ";", "for", "(", "ClassLocation", "current", ":", "classLocations", ")", "{", "// TODO: Ensure that the namespace of the supplied aNode matches the expected namespace.", "// Issue #25: Handle XML Type renaming.", "final", "String", "effectiveClassName", "=", "current", ".", "getAnnotationRenamedTo", "(", ")", "==", "null", "?", "current", ".", "getClassName", "(", ")", ":", "current", ".", "getAnnotationRenamedTo", "(", ")", ";", "if", "(", "effectiveClassName", ".", "equalsIgnoreCase", "(", "nodeClassName", ")", ")", "{", "return", "current", ";", "}", "}", "}", "}", "// Nothing found", "return", "null", ";", "}" ]
Retrieves the ClassLocation for the supplied aNode. @param aNode A non-null DOM Node. @param classLocations The set of known ClassLocations, extracted from the JavaDocs. @return the ClassLocation matching the supplied Node
[ "Retrieves", "the", "ClassLocation", "for", "the", "supplied", "aNode", "." ]
train
https://github.com/mojohaus/jaxb2-maven-plugin/blob/e3c4e47943b15282e5a6e850bbfb1588d8452a0a/src/main/java/org/codehaus/mojo/jaxb2/schemageneration/postprocessing/javadoc/DomHelper.java#L214-L244
RobotiumTech/robotium
robotium-solo/src/main/java/com/robotium/solo/Solo.java
Solo.waitForView
public <T extends View> boolean waitForView(View view, int timeout, boolean scroll) { """ Waits for the specified View. @param view the {@link View} object to wait for @param timeout the amount of time in milliseconds to wait @param scroll {@code true} if scrolling should be performed @return {@code true} if the {@link View} is displayed and {@code false} if it is not displayed before the timeout """ if(config.commandLogging){ Log.d(config.commandLoggingTag, "waitForView("+view+", "+timeout+", "+scroll+")"); } boolean checkIsShown = false; if(!scroll){ checkIsShown = true; } View viewToWaitFor = waiter.waitForView(view, timeout, scroll, checkIsShown); if(viewToWaitFor != null) return true; return false; }
java
public <T extends View> boolean waitForView(View view, int timeout, boolean scroll){ if(config.commandLogging){ Log.d(config.commandLoggingTag, "waitForView("+view+", "+timeout+", "+scroll+")"); } boolean checkIsShown = false; if(!scroll){ checkIsShown = true; } View viewToWaitFor = waiter.waitForView(view, timeout, scroll, checkIsShown); if(viewToWaitFor != null) return true; return false; }
[ "public", "<", "T", "extends", "View", ">", "boolean", "waitForView", "(", "View", "view", ",", "int", "timeout", ",", "boolean", "scroll", ")", "{", "if", "(", "config", ".", "commandLogging", ")", "{", "Log", ".", "d", "(", "config", ".", "commandLoggingTag", ",", "\"waitForView(\"", "+", "view", "+", "\", \"", "+", "timeout", "+", "\", \"", "+", "scroll", "+", "\")\"", ")", ";", "}", "boolean", "checkIsShown", "=", "false", ";", "if", "(", "!", "scroll", ")", "{", "checkIsShown", "=", "true", ";", "}", "View", "viewToWaitFor", "=", "waiter", ".", "waitForView", "(", "view", ",", "timeout", ",", "scroll", ",", "checkIsShown", ")", ";", "if", "(", "viewToWaitFor", "!=", "null", ")", "return", "true", ";", "return", "false", ";", "}" ]
Waits for the specified View. @param view the {@link View} object to wait for @param timeout the amount of time in milliseconds to wait @param scroll {@code true} if scrolling should be performed @return {@code true} if the {@link View} is displayed and {@code false} if it is not displayed before the timeout
[ "Waits", "for", "the", "specified", "View", "." ]
train
https://github.com/RobotiumTech/robotium/blob/75e567c38f26a6a87dc8bef90b3886a20e28d291/robotium-solo/src/main/java/com/robotium/solo/Solo.java#L594-L611
ironjacamar/ironjacamar
codegenerator/src/main/java/org/ironjacamar/codegenerator/BaseProfile.java
BaseProfile.generateClassCode
void generateClassCode(Definition def, String className, String subDir) { """ generate class code @param def Definition @param className class name @param subDir sub-directory name """ if (className == null || className.equals("")) return; try { String clazzName = this.getClass().getPackage().getName() + ".code." + className + "CodeGen"; String javaFile = Definition.class.getMethod("get" + className + "Class").invoke(def, (Object[]) null) + ".java"; FileWriter fw; if (subDir == null) fw = Utils.createSrcFile(javaFile, def.getRaPackage(), def.getOutputDir()); else fw = Utils.createSrcFile(javaFile, def.getRaPackage() + "." + subDir, def.getOutputDir()); Class<?> clazz = Class.forName(clazzName, true, Thread.currentThread().getContextClassLoader()); AbstractCodeGen codeGen = (AbstractCodeGen) clazz.newInstance(); codeGen.generate(def, fw); fw.flush(); fw.close(); } catch (Exception e) { e.printStackTrace(); } }
java
void generateClassCode(Definition def, String className, String subDir) { if (className == null || className.equals("")) return; try { String clazzName = this.getClass().getPackage().getName() + ".code." + className + "CodeGen"; String javaFile = Definition.class.getMethod("get" + className + "Class").invoke(def, (Object[]) null) + ".java"; FileWriter fw; if (subDir == null) fw = Utils.createSrcFile(javaFile, def.getRaPackage(), def.getOutputDir()); else fw = Utils.createSrcFile(javaFile, def.getRaPackage() + "." + subDir, def.getOutputDir()); Class<?> clazz = Class.forName(clazzName, true, Thread.currentThread().getContextClassLoader()); AbstractCodeGen codeGen = (AbstractCodeGen) clazz.newInstance(); codeGen.generate(def, fw); fw.flush(); fw.close(); } catch (Exception e) { e.printStackTrace(); } }
[ "void", "generateClassCode", "(", "Definition", "def", ",", "String", "className", ",", "String", "subDir", ")", "{", "if", "(", "className", "==", "null", "||", "className", ".", "equals", "(", "\"\"", ")", ")", "return", ";", "try", "{", "String", "clazzName", "=", "this", ".", "getClass", "(", ")", ".", "getPackage", "(", ")", ".", "getName", "(", ")", "+", "\".code.\"", "+", "className", "+", "\"CodeGen\"", ";", "String", "javaFile", "=", "Definition", ".", "class", ".", "getMethod", "(", "\"get\"", "+", "className", "+", "\"Class\"", ")", ".", "invoke", "(", "def", ",", "(", "Object", "[", "]", ")", "null", ")", "+", "\".java\"", ";", "FileWriter", "fw", ";", "if", "(", "subDir", "==", "null", ")", "fw", "=", "Utils", ".", "createSrcFile", "(", "javaFile", ",", "def", ".", "getRaPackage", "(", ")", ",", "def", ".", "getOutputDir", "(", ")", ")", ";", "else", "fw", "=", "Utils", ".", "createSrcFile", "(", "javaFile", ",", "def", ".", "getRaPackage", "(", ")", "+", "\".\"", "+", "subDir", ",", "def", ".", "getOutputDir", "(", ")", ")", ";", "Class", "<", "?", ">", "clazz", "=", "Class", ".", "forName", "(", "clazzName", ",", "true", ",", "Thread", ".", "currentThread", "(", ")", ".", "getContextClassLoader", "(", ")", ")", ";", "AbstractCodeGen", "codeGen", "=", "(", "AbstractCodeGen", ")", "clazz", ".", "newInstance", "(", ")", ";", "codeGen", ".", "generate", "(", "def", ",", "fw", ")", ";", "fw", ".", "flush", "(", ")", ";", "fw", ".", "close", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "}" ]
generate class code @param def Definition @param className class name @param subDir sub-directory name
[ "generate", "class", "code" ]
train
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/codegenerator/src/main/java/org/ironjacamar/codegenerator/BaseProfile.java#L219-L247
google/error-prone-javac
src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java
JShellTool.prefixError
String prefixError(String s) { """ Add error prefixing/postfixing to embedded newlines in a string, bracketing with error prefix/postfix @param s the string to prefix @return the pre/post-fixed and bracketed string """ return prefix(s, feedback.getErrorPre(), feedback.getErrorPost()); }
java
String prefixError(String s) { return prefix(s, feedback.getErrorPre(), feedback.getErrorPost()); }
[ "String", "prefixError", "(", "String", "s", ")", "{", "return", "prefix", "(", "s", ",", "feedback", ".", "getErrorPre", "(", ")", ",", "feedback", ".", "getErrorPost", "(", ")", ")", ";", "}" ]
Add error prefixing/postfixing to embedded newlines in a string, bracketing with error prefix/postfix @param s the string to prefix @return the pre/post-fixed and bracketed string
[ "Add", "error", "prefixing", "/", "postfixing", "to", "embedded", "newlines", "in", "a", "string", "bracketing", "with", "error", "prefix", "/", "postfix" ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java#L746-L748
Azure/azure-sdk-for-java
policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyStatesInner.java
PolicyStatesInner.summarizeForPolicyDefinition
public SummarizeResultsInner summarizeForPolicyDefinition(String subscriptionId, String policyDefinitionName, QueryOptions queryOptions) { """ Summarizes policy states for the subscription level policy definition. @param subscriptionId Microsoft Azure subscription ID. @param policyDefinitionName Policy definition name. @param queryOptions Additional parameters for the operation @throws IllegalArgumentException thrown if parameters fail the validation @throws QueryFailureException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the SummarizeResultsInner object if successful. """ return summarizeForPolicyDefinitionWithServiceResponseAsync(subscriptionId, policyDefinitionName, queryOptions).toBlocking().single().body(); }
java
public SummarizeResultsInner summarizeForPolicyDefinition(String subscriptionId, String policyDefinitionName, QueryOptions queryOptions) { return summarizeForPolicyDefinitionWithServiceResponseAsync(subscriptionId, policyDefinitionName, queryOptions).toBlocking().single().body(); }
[ "public", "SummarizeResultsInner", "summarizeForPolicyDefinition", "(", "String", "subscriptionId", ",", "String", "policyDefinitionName", ",", "QueryOptions", "queryOptions", ")", "{", "return", "summarizeForPolicyDefinitionWithServiceResponseAsync", "(", "subscriptionId", ",", "policyDefinitionName", ",", "queryOptions", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Summarizes policy states for the subscription level policy definition. @param subscriptionId Microsoft Azure subscription ID. @param policyDefinitionName Policy definition name. @param queryOptions Additional parameters for the operation @throws IllegalArgumentException thrown if parameters fail the validation @throws QueryFailureException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the SummarizeResultsInner object if successful.
[ "Summarizes", "policy", "states", "for", "the", "subscription", "level", "policy", "definition", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyStatesInner.java#L2368-L2370
aws/aws-sdk-java
aws-java-sdk-emr/src/main/java/com/amazonaws/services/elasticmapreduce/util/StepFactory.java
StepFactory.newInstallHiveStep
public HadoopJarStepConfig newInstallHiveStep(HiveVersion... hiveVersions) { """ Step that installs the specified versions of Hive on your job flow. @param hiveVersions the versions of Hive to install @return HadoopJarStepConfig that can be passed to your job flow. """ if (hiveVersions.length > 0) { String[] versionStrings = new String[hiveVersions.length]; for (int i = 0; i < hiveVersions.length; i++) { versionStrings[i] = hiveVersions[i].toString(); } return newInstallHiveStep(versionStrings); } return newHivePigStep("hive", "--install-hive", "--hive-versions", "latest"); }
java
public HadoopJarStepConfig newInstallHiveStep(HiveVersion... hiveVersions) { if (hiveVersions.length > 0) { String[] versionStrings = new String[hiveVersions.length]; for (int i = 0; i < hiveVersions.length; i++) { versionStrings[i] = hiveVersions[i].toString(); } return newInstallHiveStep(versionStrings); } return newHivePigStep("hive", "--install-hive", "--hive-versions", "latest"); }
[ "public", "HadoopJarStepConfig", "newInstallHiveStep", "(", "HiveVersion", "...", "hiveVersions", ")", "{", "if", "(", "hiveVersions", ".", "length", ">", "0", ")", "{", "String", "[", "]", "versionStrings", "=", "new", "String", "[", "hiveVersions", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "hiveVersions", ".", "length", ";", "i", "++", ")", "{", "versionStrings", "[", "i", "]", "=", "hiveVersions", "[", "i", "]", ".", "toString", "(", ")", ";", "}", "return", "newInstallHiveStep", "(", "versionStrings", ")", ";", "}", "return", "newHivePigStep", "(", "\"hive\"", ",", "\"--install-hive\"", ",", "\"--hive-versions\"", ",", "\"latest\"", ")", ";", "}" ]
Step that installs the specified versions of Hive on your job flow. @param hiveVersions the versions of Hive to install @return HadoopJarStepConfig that can be passed to your job flow.
[ "Step", "that", "installs", "the", "specified", "versions", "of", "Hive", "on", "your", "job", "flow", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-emr/src/main/java/com/amazonaws/services/elasticmapreduce/util/StepFactory.java#L159-L168
craftercms/core
src/main/java/org/craftercms/core/util/xml/marshalling/xstream/CrafterXStreamMarshaller.java
CrafterXStreamMarshaller.marshalWriter
@Override public void marshalWriter(Object graph, Writer writer, DataHolder dataHolder) throws XmlMappingException, IOException { """ Just as super(), but instead of a {@link com.thoughtworks.xstream.io.xml.CompactWriter} creates a {@link EscapingCompactWriter}. Also if the object graph is a Dom4j document, the document is written directly instead of using XStream. """ if (graph instanceof Document) { OutputFormat outputFormat = OutputFormat.createCompactFormat(); outputFormat.setSuppressDeclaration(suppressXmlDeclaration); XMLWriter xmlWriter = new XMLWriter(writer, outputFormat); try { xmlWriter.write((Document)graph); } finally { try { xmlWriter.flush(); } catch (Exception ex) { logger.debug("Could not flush XMLWriter", ex); } } } else { if (!suppressXmlDeclaration) { writer.write(XML_DECLARATION); } HierarchicalStreamWriter streamWriter = new EscapingCompactWriter(writer); try { getXStream().marshal(graph, streamWriter, dataHolder); } catch (Exception ex) { throw convertXStreamException(ex, true); } finally { try { streamWriter.flush(); } catch (Exception ex) { logger.debug("Could not flush HierarchicalStreamWriter", ex); } } } }
java
@Override public void marshalWriter(Object graph, Writer writer, DataHolder dataHolder) throws XmlMappingException, IOException { if (graph instanceof Document) { OutputFormat outputFormat = OutputFormat.createCompactFormat(); outputFormat.setSuppressDeclaration(suppressXmlDeclaration); XMLWriter xmlWriter = new XMLWriter(writer, outputFormat); try { xmlWriter.write((Document)graph); } finally { try { xmlWriter.flush(); } catch (Exception ex) { logger.debug("Could not flush XMLWriter", ex); } } } else { if (!suppressXmlDeclaration) { writer.write(XML_DECLARATION); } HierarchicalStreamWriter streamWriter = new EscapingCompactWriter(writer); try { getXStream().marshal(graph, streamWriter, dataHolder); } catch (Exception ex) { throw convertXStreamException(ex, true); } finally { try { streamWriter.flush(); } catch (Exception ex) { logger.debug("Could not flush HierarchicalStreamWriter", ex); } } } }
[ "@", "Override", "public", "void", "marshalWriter", "(", "Object", "graph", ",", "Writer", "writer", ",", "DataHolder", "dataHolder", ")", "throws", "XmlMappingException", ",", "IOException", "{", "if", "(", "graph", "instanceof", "Document", ")", "{", "OutputFormat", "outputFormat", "=", "OutputFormat", ".", "createCompactFormat", "(", ")", ";", "outputFormat", ".", "setSuppressDeclaration", "(", "suppressXmlDeclaration", ")", ";", "XMLWriter", "xmlWriter", "=", "new", "XMLWriter", "(", "writer", ",", "outputFormat", ")", ";", "try", "{", "xmlWriter", ".", "write", "(", "(", "Document", ")", "graph", ")", ";", "}", "finally", "{", "try", "{", "xmlWriter", ".", "flush", "(", ")", ";", "}", "catch", "(", "Exception", "ex", ")", "{", "logger", ".", "debug", "(", "\"Could not flush XMLWriter\"", ",", "ex", ")", ";", "}", "}", "}", "else", "{", "if", "(", "!", "suppressXmlDeclaration", ")", "{", "writer", ".", "write", "(", "XML_DECLARATION", ")", ";", "}", "HierarchicalStreamWriter", "streamWriter", "=", "new", "EscapingCompactWriter", "(", "writer", ")", ";", "try", "{", "getXStream", "(", ")", ".", "marshal", "(", "graph", ",", "streamWriter", ",", "dataHolder", ")", ";", "}", "catch", "(", "Exception", "ex", ")", "{", "throw", "convertXStreamException", "(", "ex", ",", "true", ")", ";", "}", "finally", "{", "try", "{", "streamWriter", ".", "flush", "(", ")", ";", "}", "catch", "(", "Exception", "ex", ")", "{", "logger", ".", "debug", "(", "\"Could not flush HierarchicalStreamWriter\"", ",", "ex", ")", ";", "}", "}", "}", "}" ]
Just as super(), but instead of a {@link com.thoughtworks.xstream.io.xml.CompactWriter} creates a {@link EscapingCompactWriter}. Also if the object graph is a Dom4j document, the document is written directly instead of using XStream.
[ "Just", "as", "super", "()", "but", "instead", "of", "a", "{" ]
train
https://github.com/craftercms/core/blob/d3ec74d669d3f8cfcf995177615d5f126edfa237/src/main/java/org/craftercms/core/util/xml/marshalling/xstream/CrafterXStreamMarshaller.java#L107-L142
phax/ph-commons
ph-jaxb/src/main/java/com/helger/jaxb/JAXBMarshallerHelper.java
JAXBMarshallerHelper.setSunXMLHeaders
public static void setSunXMLHeaders (@Nonnull final Marshaller aMarshaller, @Nonnull final String sXMLHeaders) { """ Set the Sun specific XML header string. @param aMarshaller The marshaller to set the property. May not be <code>null</code>. @param sXMLHeaders the value to be set """ final String sPropertyName = SUN_XML_HEADERS; _setProperty (aMarshaller, sPropertyName, sXMLHeaders); }
java
public static void setSunXMLHeaders (@Nonnull final Marshaller aMarshaller, @Nonnull final String sXMLHeaders) { final String sPropertyName = SUN_XML_HEADERS; _setProperty (aMarshaller, sPropertyName, sXMLHeaders); }
[ "public", "static", "void", "setSunXMLHeaders", "(", "@", "Nonnull", "final", "Marshaller", "aMarshaller", ",", "@", "Nonnull", "final", "String", "sXMLHeaders", ")", "{", "final", "String", "sPropertyName", "=", "SUN_XML_HEADERS", ";", "_setProperty", "(", "aMarshaller", ",", "sPropertyName", ",", "sXMLHeaders", ")", ";", "}" ]
Set the Sun specific XML header string. @param aMarshaller The marshaller to set the property. May not be <code>null</code>. @param sXMLHeaders the value to be set
[ "Set", "the", "Sun", "specific", "XML", "header", "string", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-jaxb/src/main/java/com/helger/jaxb/JAXBMarshallerHelper.java#L293-L297
raydac/java-binary-block-parser
jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java
JBBPDslBuilder.Long
public JBBPDslBuilder Long(final String name) { """ Add named long field. @param name name of the field, can be null for anonymous @return the builder instance, must not be null """ final Item item = new Item(BinType.LONG, name, this.byteOrder); this.addItem(item); return this; }
java
public JBBPDslBuilder Long(final String name) { final Item item = new Item(BinType.LONG, name, this.byteOrder); this.addItem(item); return this; }
[ "public", "JBBPDslBuilder", "Long", "(", "final", "String", "name", ")", "{", "final", "Item", "item", "=", "new", "Item", "(", "BinType", ".", "LONG", ",", "name", ",", "this", ".", "byteOrder", ")", ";", "this", ".", "addItem", "(", "item", ")", ";", "return", "this", ";", "}" ]
Add named long field. @param name name of the field, can be null for anonymous @return the builder instance, must not be null
[ "Add", "named", "long", "field", "." ]
train
https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java#L1157-L1161
wkgcass/Style
src/main/java/net/cassite/style/SwitchBlock.java
SwitchBlock.Case
public SwitchBlock<T, R> Case(T ca, RFunc0<R> func) { """ add a Case block to the expression @param ca the object for switch-expression to match @param func function to apply when matches and return a result for expression to return @return <code>this</code> """ return Case(ca, $(func)); }
java
public SwitchBlock<T, R> Case(T ca, RFunc0<R> func) { return Case(ca, $(func)); }
[ "public", "SwitchBlock", "<", "T", ",", "R", ">", "Case", "(", "T", "ca", ",", "RFunc0", "<", "R", ">", "func", ")", "{", "return", "Case", "(", "ca", ",", "$", "(", "func", ")", ")", ";", "}" ]
add a Case block to the expression @param ca the object for switch-expression to match @param func function to apply when matches and return a result for expression to return @return <code>this</code>
[ "add", "a", "Case", "block", "to", "the", "expression" ]
train
https://github.com/wkgcass/Style/blob/db3ea64337251f46f734279480e365293bececbd/src/main/java/net/cassite/style/SwitchBlock.java#L77-L79
Azure/azure-sdk-for-java
automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/ConnectionsInner.java
ConnectionsInner.listByAutomationAccountAsync
public Observable<Page<ConnectionInner>> listByAutomationAccountAsync(final String resourceGroupName, final String automationAccountName) { """ Retrieve a list of connections. @param resourceGroupName Name of an Azure Resource group. @param automationAccountName The name of the automation account. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;ConnectionInner&gt; object """ return listByAutomationAccountWithServiceResponseAsync(resourceGroupName, automationAccountName) .map(new Func1<ServiceResponse<Page<ConnectionInner>>, Page<ConnectionInner>>() { @Override public Page<ConnectionInner> call(ServiceResponse<Page<ConnectionInner>> response) { return response.body(); } }); }
java
public Observable<Page<ConnectionInner>> listByAutomationAccountAsync(final String resourceGroupName, final String automationAccountName) { return listByAutomationAccountWithServiceResponseAsync(resourceGroupName, automationAccountName) .map(new Func1<ServiceResponse<Page<ConnectionInner>>, Page<ConnectionInner>>() { @Override public Page<ConnectionInner> call(ServiceResponse<Page<ConnectionInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "ConnectionInner", ">", ">", "listByAutomationAccountAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "automationAccountName", ")", "{", "return", "listByAutomationAccountWithServiceResponseAsync", "(", "resourceGroupName", ",", "automationAccountName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "Page", "<", "ConnectionInner", ">", ">", ",", "Page", "<", "ConnectionInner", ">", ">", "(", ")", "{", "@", "Override", "public", "Page", "<", "ConnectionInner", ">", "call", "(", "ServiceResponse", "<", "Page", "<", "ConnectionInner", ">", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Retrieve a list of connections. @param resourceGroupName Name of an Azure Resource group. @param automationAccountName The name of the automation account. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;ConnectionInner&gt; object
[ "Retrieve", "a", "list", "of", "connections", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/ConnectionsInner.java#L524-L532
apache/groovy
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
DefaultGroovyMethods.getAt
@SuppressWarnings("unchecked") public static List<Float> getAt(float[] array, Range range) { """ Support the subscript operator with a range for a float array @param array a float array @param range a range indicating the indices for the items to retrieve @return list of the retrieved floats @since 1.0 """ return primitiveArrayGet(array, range); }
java
@SuppressWarnings("unchecked") public static List<Float> getAt(float[] array, Range range) { return primitiveArrayGet(array, range); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "List", "<", "Float", ">", "getAt", "(", "float", "[", "]", "array", ",", "Range", "range", ")", "{", "return", "primitiveArrayGet", "(", "array", ",", "range", ")", ";", "}" ]
Support the subscript operator with a range for a float array @param array a float array @param range a range indicating the indices for the items to retrieve @return list of the retrieved floats @since 1.0
[ "Support", "the", "subscript", "operator", "with", "a", "range", "for", "a", "float", "array" ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L13675-L13678
drinkjava2/jBeanBox
jbeanbox/src/main/java/com/github/drinkjava2/asm5_0_3/commons/JSRInlinerAdapter.java
JSRInlinerAdapter.markSubroutines
private void markSubroutines() { """ Walks the method and determines which internal subroutine(s), if any, each instruction is a method of. """ BitSet anyvisited = new BitSet(); // First walk the main subroutine and find all those instructions which // can be reached without invoking any JSR at all markSubroutineWalk(mainSubroutine, 0, anyvisited); // Go through the head of each subroutine and find any nodes reachable // to that subroutine without following any JSR links. for (Iterator<Map.Entry<LabelNode, BitSet>> it = subroutineHeads .entrySet().iterator(); it.hasNext();) { Map.Entry<LabelNode, BitSet> entry = it.next(); LabelNode lab = entry.getKey(); BitSet sub = entry.getValue(); int index = instructions.indexOf(lab); markSubroutineWalk(sub, index, anyvisited); } }
java
private void markSubroutines() { BitSet anyvisited = new BitSet(); // First walk the main subroutine and find all those instructions which // can be reached without invoking any JSR at all markSubroutineWalk(mainSubroutine, 0, anyvisited); // Go through the head of each subroutine and find any nodes reachable // to that subroutine without following any JSR links. for (Iterator<Map.Entry<LabelNode, BitSet>> it = subroutineHeads .entrySet().iterator(); it.hasNext();) { Map.Entry<LabelNode, BitSet> entry = it.next(); LabelNode lab = entry.getKey(); BitSet sub = entry.getValue(); int index = instructions.indexOf(lab); markSubroutineWalk(sub, index, anyvisited); } }
[ "private", "void", "markSubroutines", "(", ")", "{", "BitSet", "anyvisited", "=", "new", "BitSet", "(", ")", ";", "// First walk the main subroutine and find all those instructions which", "// can be reached without invoking any JSR at all", "markSubroutineWalk", "(", "mainSubroutine", ",", "0", ",", "anyvisited", ")", ";", "// Go through the head of each subroutine and find any nodes reachable", "// to that subroutine without following any JSR links.", "for", "(", "Iterator", "<", "Map", ".", "Entry", "<", "LabelNode", ",", "BitSet", ">", ">", "it", "=", "subroutineHeads", ".", "entrySet", "(", ")", ".", "iterator", "(", ")", ";", "it", ".", "hasNext", "(", ")", ";", ")", "{", "Map", ".", "Entry", "<", "LabelNode", ",", "BitSet", ">", "entry", "=", "it", ".", "next", "(", ")", ";", "LabelNode", "lab", "=", "entry", ".", "getKey", "(", ")", ";", "BitSet", "sub", "=", "entry", ".", "getValue", "(", ")", ";", "int", "index", "=", "instructions", ".", "indexOf", "(", "lab", ")", ";", "markSubroutineWalk", "(", "sub", ",", "index", ",", "anyvisited", ")", ";", "}", "}" ]
Walks the method and determines which internal subroutine(s), if any, each instruction is a method of.
[ "Walks", "the", "method", "and", "determines", "which", "internal", "subroutine", "(", "s", ")", "if", "any", "each", "instruction", "is", "a", "method", "of", "." ]
train
https://github.com/drinkjava2/jBeanBox/blob/01c216599ffa2e5f2d9c01df2adaad0f45567c04/jbeanbox/src/main/java/com/github/drinkjava2/asm5_0_3/commons/JSRInlinerAdapter.java#L195-L212
alipay/sofa-rpc
core/common/src/main/java/com/alipay/sofa/rpc/common/utils/ClassUtils.java
ClassUtils.forName
public static Class forName(String className, ClassLoader cl) { """ 根据类名加载Class @param className 类名 @param cl Classloader @return Class """ try { return Class.forName(className, true, cl); } catch (Exception e) { throw new SofaRpcRuntimeException(e); } }
java
public static Class forName(String className, ClassLoader cl) { try { return Class.forName(className, true, cl); } catch (Exception e) { throw new SofaRpcRuntimeException(e); } }
[ "public", "static", "Class", "forName", "(", "String", "className", ",", "ClassLoader", "cl", ")", "{", "try", "{", "return", "Class", ".", "forName", "(", "className", ",", "true", ",", "cl", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "SofaRpcRuntimeException", "(", "e", ")", ";", "}", "}" ]
根据类名加载Class @param className 类名 @param cl Classloader @return Class
[ "根据类名加载Class" ]
train
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/core/common/src/main/java/com/alipay/sofa/rpc/common/utils/ClassUtils.java#L70-L76
Wadpam/guja
guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java
GeneratedDContactDaoImpl.queryByTwitter
public Iterable<DContact> queryByTwitter(Object parent, java.lang.String twitter) { """ query-by method for field twitter @param twitter the specified attribute @return an Iterable of DContacts for the specified twitter """ return queryByField(parent, DContactMapper.Field.TWITTER.getFieldName(), twitter); }
java
public Iterable<DContact> queryByTwitter(Object parent, java.lang.String twitter) { return queryByField(parent, DContactMapper.Field.TWITTER.getFieldName(), twitter); }
[ "public", "Iterable", "<", "DContact", ">", "queryByTwitter", "(", "Object", "parent", ",", "java", ".", "lang", ".", "String", "twitter", ")", "{", "return", "queryByField", "(", "parent", ",", "DContactMapper", ".", "Field", ".", "TWITTER", ".", "getFieldName", "(", ")", ",", "twitter", ")", ";", "}" ]
query-by method for field twitter @param twitter the specified attribute @return an Iterable of DContacts for the specified twitter
[ "query", "-", "by", "method", "for", "field", "twitter" ]
train
https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java#L277-L279
citiususc/hipster
hipster-core/src/main/java/es/usc/citius/hipster/util/examples/maze/Maze2D.java
Maze2D.getStringMazeFilled
public String getStringMazeFilled(Collection<Point> points, char symbol) { """ Generates a string representation of this maze, with the indicated points replaced with the symbol provided. @param points points of the maze. @param symbol symbol to be inserted in each point. @return the string representation of the maze with the points changed. """ Map<Point, Character> replacements = new HashMap<Point, Character>(); for (Point p : points) { replacements.put(p, symbol); } return getReplacedMazeString(Collections.singletonList(replacements)); }
java
public String getStringMazeFilled(Collection<Point> points, char symbol) { Map<Point, Character> replacements = new HashMap<Point, Character>(); for (Point p : points) { replacements.put(p, symbol); } return getReplacedMazeString(Collections.singletonList(replacements)); }
[ "public", "String", "getStringMazeFilled", "(", "Collection", "<", "Point", ">", "points", ",", "char", "symbol", ")", "{", "Map", "<", "Point", ",", "Character", ">", "replacements", "=", "new", "HashMap", "<", "Point", ",", "Character", ">", "(", ")", ";", "for", "(", "Point", "p", ":", "points", ")", "{", "replacements", ".", "put", "(", "p", ",", "symbol", ")", ";", "}", "return", "getReplacedMazeString", "(", "Collections", ".", "singletonList", "(", "replacements", ")", ")", ";", "}" ]
Generates a string representation of this maze, with the indicated points replaced with the symbol provided. @param points points of the maze. @param symbol symbol to be inserted in each point. @return the string representation of the maze with the points changed.
[ "Generates", "a", "string", "representation", "of", "this", "maze", "with", "the", "indicated", "points", "replaced", "with", "the", "symbol", "provided", "." ]
train
https://github.com/citiususc/hipster/blob/9ab1236abb833a27641ae73ba9ca890d5c17598e/hipster-core/src/main/java/es/usc/citius/hipster/util/examples/maze/Maze2D.java#L341-L347
killbilling/recurly-java-library
src/main/java/com/ning/billing/recurly/RecurlyClient.java
RecurlyClient.markInvoiceSuccessful
public Invoice markInvoiceSuccessful(final String invoiceId) { """ Mark an invoice as paid successfully - Recurly Enterprise Feature @param invoiceId String Recurly Invoice ID """ return doPUT(Invoices.INVOICES_RESOURCE + "/" + invoiceId + "/mark_successful", null, Invoice.class); }
java
public Invoice markInvoiceSuccessful(final String invoiceId) { return doPUT(Invoices.INVOICES_RESOURCE + "/" + invoiceId + "/mark_successful", null, Invoice.class); }
[ "public", "Invoice", "markInvoiceSuccessful", "(", "final", "String", "invoiceId", ")", "{", "return", "doPUT", "(", "Invoices", ".", "INVOICES_RESOURCE", "+", "\"/\"", "+", "invoiceId", "+", "\"/mark_successful\"", ",", "null", ",", "Invoice", ".", "class", ")", ";", "}" ]
Mark an invoice as paid successfully - Recurly Enterprise Feature @param invoiceId String Recurly Invoice ID
[ "Mark", "an", "invoice", "as", "paid", "successfully", "-", "Recurly", "Enterprise", "Feature" ]
train
https://github.com/killbilling/recurly-java-library/blob/5e05eedd91885a51e1aa8293bd41139d082cf7f4/src/main/java/com/ning/billing/recurly/RecurlyClient.java#L1280-L1282
netceteragroup/trema-core
src/main/java/com/netcetera/trema/core/XMLDatabase.java
XMLDatabase.writeXML
public void writeXML(OutputStream outputStream, String encoding, String indent, String lineSeparator) throws IOException { """ Serializes the database to the output stream. @param outputStream the output @param encoding the encoding to use @param indent the indent @param lineSeparator the lineSeparator @throws IOException in case the xml could not be written """ XMLOutputter outputter = new XMLOutputter(); Format format = Format.getPrettyFormat(); format.setEncoding(encoding); format.setIndent(indent); format.setLineSeparator(lineSeparator); outputter.setFormat(format); outputter.output(getDocument(), outputStream); }
java
public void writeXML(OutputStream outputStream, String encoding, String indent, String lineSeparator) throws IOException { XMLOutputter outputter = new XMLOutputter(); Format format = Format.getPrettyFormat(); format.setEncoding(encoding); format.setIndent(indent); format.setLineSeparator(lineSeparator); outputter.setFormat(format); outputter.output(getDocument(), outputStream); }
[ "public", "void", "writeXML", "(", "OutputStream", "outputStream", ",", "String", "encoding", ",", "String", "indent", ",", "String", "lineSeparator", ")", "throws", "IOException", "{", "XMLOutputter", "outputter", "=", "new", "XMLOutputter", "(", ")", ";", "Format", "format", "=", "Format", ".", "getPrettyFormat", "(", ")", ";", "format", ".", "setEncoding", "(", "encoding", ")", ";", "format", ".", "setIndent", "(", "indent", ")", ";", "format", ".", "setLineSeparator", "(", "lineSeparator", ")", ";", "outputter", ".", "setFormat", "(", "format", ")", ";", "outputter", ".", "output", "(", "getDocument", "(", ")", ",", "outputStream", ")", ";", "}" ]
Serializes the database to the output stream. @param outputStream the output @param encoding the encoding to use @param indent the indent @param lineSeparator the lineSeparator @throws IOException in case the xml could not be written
[ "Serializes", "the", "database", "to", "the", "output", "stream", "." ]
train
https://github.com/netceteragroup/trema-core/blob/e5367f4b80b38038d462627aa146a62bc34fc489/src/main/java/com/netcetera/trema/core/XMLDatabase.java#L281-L290
nhurion/vaadin-for-heroku
src/main/java/eu/hurion/vaadin/heroku/FilterDefinitionBuilder.java
FilterDefinitionBuilder.withParameter
public FilterDefinitionBuilder withParameter(final String name, final String value) { """ Add a parameter with its associated value. One a parameter has been added, its value cannot be changed. @param name the name of the parameter @param value the value of the parameter @return this """ if (parameters.containsKey(name)) { // The spec does not define this but the TCK expects the first // definition to take precedence return this; } this.parameters.put(name, value); return this; }
java
public FilterDefinitionBuilder withParameter(final String name, final String value) { if (parameters.containsKey(name)) { // The spec does not define this but the TCK expects the first // definition to take precedence return this; } this.parameters.put(name, value); return this; }
[ "public", "FilterDefinitionBuilder", "withParameter", "(", "final", "String", "name", ",", "final", "String", "value", ")", "{", "if", "(", "parameters", ".", "containsKey", "(", "name", ")", ")", "{", "// The spec does not define this but the TCK expects the first", "// definition to take precedence", "return", "this", ";", "}", "this", ".", "parameters", ".", "put", "(", "name", ",", "value", ")", ";", "return", "this", ";", "}" ]
Add a parameter with its associated value. One a parameter has been added, its value cannot be changed. @param name the name of the parameter @param value the value of the parameter @return this
[ "Add", "a", "parameter", "with", "its", "associated", "value", ".", "One", "a", "parameter", "has", "been", "added", "its", "value", "cannot", "be", "changed", "." ]
train
https://github.com/nhurion/vaadin-for-heroku/blob/51b1c22827934eb6105b0cfb0254cc15df23e991/src/main/java/eu/hurion/vaadin/heroku/FilterDefinitionBuilder.java#L72-L80
mygreen/super-csv-annotation
src/main/java/com/github/mygreen/supercsv/util/ArgUtils.java
ArgUtils.notEmpty
public static void notEmpty(final String arg, final String name) { """ 文字列が空 or nullでないかどうか検証する。 @param arg 検証対象の値 @param name 検証対象の引数の名前 @throws NullPointerException {@literal arg == null} @throws IllegalArgumentException {@literal arg.isEmpty() == true} """ if(arg == null) { throw new NullPointerException(String.format("%s should not be null.", name)); } if(arg.isEmpty()) { throw new IllegalArgumentException(String.format("%s should not be empty.", name)); } }
java
public static void notEmpty(final String arg, final String name) { if(arg == null) { throw new NullPointerException(String.format("%s should not be null.", name)); } if(arg.isEmpty()) { throw new IllegalArgumentException(String.format("%s should not be empty.", name)); } }
[ "public", "static", "void", "notEmpty", "(", "final", "String", "arg", ",", "final", "String", "name", ")", "{", "if", "(", "arg", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "String", ".", "format", "(", "\"%s should not be null.\"", ",", "name", ")", ")", ";", "}", "if", "(", "arg", ".", "isEmpty", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "String", ".", "format", "(", "\"%s should not be empty.\"", ",", "name", ")", ")", ";", "}", "}" ]
文字列が空 or nullでないかどうか検証する。 @param arg 検証対象の値 @param name 検証対象の引数の名前 @throws NullPointerException {@literal arg == null} @throws IllegalArgumentException {@literal arg.isEmpty() == true}
[ "文字列が空", "or", "nullでないかどうか検証する。" ]
train
https://github.com/mygreen/super-csv-annotation/blob/9910320cb6dc143be972c7d10d9ab5ffb09c3b84/src/main/java/com/github/mygreen/supercsv/util/ArgUtils.java#L34-L42
facebookarchive/hadoop-20
src/contrib/raid/src/java/org/apache/hadoop/raid/StripeReader.java
StripeReader.getBlockLocation
public static LocationPair getBlockLocation(Codec codec, FileSystem srcFs, Path srcFile, int blockIdxInFile, Configuration conf, List<FileStatus> lfs) throws IOException { """ Given a block in the file and specific codec, return the LocationPair object which contains id of the stripe it belongs to and its location in the stripe """ int stripeIdx = 0; int blockIdxInStripe = 0; int blockIdx = blockIdxInFile; if (codec.isDirRaid) { Path parentPath = srcFile.getParent(); if (lfs == null) { lfs = RaidNode.listDirectoryRaidFileStatus(conf, srcFs, parentPath); } if (lfs == null) { throw new IOException("Couldn't list files under " + parentPath); } int blockNum = 0; Path qSrcFile = srcFs.makeQualified(srcFile); for (FileStatus fsStat: lfs) { if (!fsStat.getPath().equals(qSrcFile)) { blockNum += RaidNode.getNumBlocks(fsStat); } else { blockNum += blockIdxInFile; break; } } blockIdx = blockNum; } stripeIdx = blockIdx / codec.stripeLength; blockIdxInStripe = blockIdx % codec.stripeLength; return new LocationPair(stripeIdx, blockIdxInStripe, lfs); }
java
public static LocationPair getBlockLocation(Codec codec, FileSystem srcFs, Path srcFile, int blockIdxInFile, Configuration conf, List<FileStatus> lfs) throws IOException { int stripeIdx = 0; int blockIdxInStripe = 0; int blockIdx = blockIdxInFile; if (codec.isDirRaid) { Path parentPath = srcFile.getParent(); if (lfs == null) { lfs = RaidNode.listDirectoryRaidFileStatus(conf, srcFs, parentPath); } if (lfs == null) { throw new IOException("Couldn't list files under " + parentPath); } int blockNum = 0; Path qSrcFile = srcFs.makeQualified(srcFile); for (FileStatus fsStat: lfs) { if (!fsStat.getPath().equals(qSrcFile)) { blockNum += RaidNode.getNumBlocks(fsStat); } else { blockNum += blockIdxInFile; break; } } blockIdx = blockNum; } stripeIdx = blockIdx / codec.stripeLength; blockIdxInStripe = blockIdx % codec.stripeLength; return new LocationPair(stripeIdx, blockIdxInStripe, lfs); }
[ "public", "static", "LocationPair", "getBlockLocation", "(", "Codec", "codec", ",", "FileSystem", "srcFs", ",", "Path", "srcFile", ",", "int", "blockIdxInFile", ",", "Configuration", "conf", ",", "List", "<", "FileStatus", ">", "lfs", ")", "throws", "IOException", "{", "int", "stripeIdx", "=", "0", ";", "int", "blockIdxInStripe", "=", "0", ";", "int", "blockIdx", "=", "blockIdxInFile", ";", "if", "(", "codec", ".", "isDirRaid", ")", "{", "Path", "parentPath", "=", "srcFile", ".", "getParent", "(", ")", ";", "if", "(", "lfs", "==", "null", ")", "{", "lfs", "=", "RaidNode", ".", "listDirectoryRaidFileStatus", "(", "conf", ",", "srcFs", ",", "parentPath", ")", ";", "}", "if", "(", "lfs", "==", "null", ")", "{", "throw", "new", "IOException", "(", "\"Couldn't list files under \"", "+", "parentPath", ")", ";", "}", "int", "blockNum", "=", "0", ";", "Path", "qSrcFile", "=", "srcFs", ".", "makeQualified", "(", "srcFile", ")", ";", "for", "(", "FileStatus", "fsStat", ":", "lfs", ")", "{", "if", "(", "!", "fsStat", ".", "getPath", "(", ")", ".", "equals", "(", "qSrcFile", ")", ")", "{", "blockNum", "+=", "RaidNode", ".", "getNumBlocks", "(", "fsStat", ")", ";", "}", "else", "{", "blockNum", "+=", "blockIdxInFile", ";", "break", ";", "}", "}", "blockIdx", "=", "blockNum", ";", "}", "stripeIdx", "=", "blockIdx", "/", "codec", ".", "stripeLength", ";", "blockIdxInStripe", "=", "blockIdx", "%", "codec", ".", "stripeLength", ";", "return", "new", "LocationPair", "(", "stripeIdx", ",", "blockIdxInStripe", ",", "lfs", ")", ";", "}" ]
Given a block in the file and specific codec, return the LocationPair object which contains id of the stripe it belongs to and its location in the stripe
[ "Given", "a", "block", "in", "the", "file", "and", "specific", "codec", "return", "the", "LocationPair", "object", "which", "contains", "id", "of", "the", "stripe", "it", "belongs", "to", "and", "its", "location", "in", "the", "stripe" ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/raid/src/java/org/apache/hadoop/raid/StripeReader.java#L328-L357
kaazing/java.client
ws/ws/src/main/java/org/kaazing/gateway/client/util/WrappedByteBuffer.java
WrappedByteBuffer.putAt
public WrappedByteBuffer putAt(int index, byte v) { """ Puts a single byte number into the buffer at the specified index. @param index the index @param v the byte @return the buffer """ _checkForWriteAt(index, 1); _buf.put(index, v); return this; }
java
public WrappedByteBuffer putAt(int index, byte v) { _checkForWriteAt(index, 1); _buf.put(index, v); return this; }
[ "public", "WrappedByteBuffer", "putAt", "(", "int", "index", ",", "byte", "v", ")", "{", "_checkForWriteAt", "(", "index", ",", "1", ")", ";", "_buf", ".", "put", "(", "index", ",", "v", ")", ";", "return", "this", ";", "}" ]
Puts a single byte number into the buffer at the specified index. @param index the index @param v the byte @return the buffer
[ "Puts", "a", "single", "byte", "number", "into", "the", "buffer", "at", "the", "specified", "index", "." ]
train
https://github.com/kaazing/java.client/blob/25ad2ae5bb24aa9d6b79400fce649b518dcfbe26/ws/ws/src/main/java/org/kaazing/gateway/client/util/WrappedByteBuffer.java#L388-L392
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/codec/TIFFDirectory.java
TIFFDirectory.getFieldAsFloat
public float getFieldAsFloat(int tag, int index) { """ Returns the value of a particular index of a given tag as a float. The caller is responsible for ensuring that the tag is present and has numeric type (all but TIFF_UNDEFINED and TIFF_ASCII). """ Integer i = (Integer)fieldIndex.get(Integer.valueOf(tag)); return fields[i.intValue()].getAsFloat(index); }
java
public float getFieldAsFloat(int tag, int index) { Integer i = (Integer)fieldIndex.get(Integer.valueOf(tag)); return fields[i.intValue()].getAsFloat(index); }
[ "public", "float", "getFieldAsFloat", "(", "int", "tag", ",", "int", "index", ")", "{", "Integer", "i", "=", "(", "Integer", ")", "fieldIndex", ".", "get", "(", "Integer", ".", "valueOf", "(", "tag", ")", ")", ";", "return", "fields", "[", "i", ".", "intValue", "(", ")", "]", ".", "getAsFloat", "(", "index", ")", ";", "}" ]
Returns the value of a particular index of a given tag as a float. The caller is responsible for ensuring that the tag is present and has numeric type (all but TIFF_UNDEFINED and TIFF_ASCII).
[ "Returns", "the", "value", "of", "a", "particular", "index", "of", "a", "given", "tag", "as", "a", "float", ".", "The", "caller", "is", "responsible", "for", "ensuring", "that", "the", "tag", "is", "present", "and", "has", "numeric", "type", "(", "all", "but", "TIFF_UNDEFINED", "and", "TIFF_ASCII", ")", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/codec/TIFFDirectory.java#L489-L492
dbracewell/mango
src/main/java/com/davidbracewell/scripting/ScriptEnvironment.java
ScriptEnvironment.invokeMethod
public Object invokeMethod(Object o, String name, Object... args) throws ScriptException, NoSuchMethodException { """ <p> Calls a method on a script object compiled during a previous script execution, which is retained in the state of the ScriptEngine. </p> @param o If the procedure is a member of a class defined in the script and o is an instance of that class returned by a previous execution or invocation, the named method is called through that instance. @param name The name of the procedure to be called. @param args Arguments to pass to the procedure. The rules for converting the arguments to scripting variables are implementation-specific. @return The value returned by the procedure. The rules for converting the scripting variable returned by the script method to a Java Object are implementation-specific. @throws javax.script.ScriptException Something went wrong @throws NoSuchMethodException Method did not exist """ Invocable inv = (Invocable) engine; return inv.invokeMethod(o, name, args); }
java
public Object invokeMethod(Object o, String name, Object... args) throws ScriptException, NoSuchMethodException { Invocable inv = (Invocable) engine; return inv.invokeMethod(o, name, args); }
[ "public", "Object", "invokeMethod", "(", "Object", "o", ",", "String", "name", ",", "Object", "...", "args", ")", "throws", "ScriptException", ",", "NoSuchMethodException", "{", "Invocable", "inv", "=", "(", "Invocable", ")", "engine", ";", "return", "inv", ".", "invokeMethod", "(", "o", ",", "name", ",", "args", ")", ";", "}" ]
<p> Calls a method on a script object compiled during a previous script execution, which is retained in the state of the ScriptEngine. </p> @param o If the procedure is a member of a class defined in the script and o is an instance of that class returned by a previous execution or invocation, the named method is called through that instance. @param name The name of the procedure to be called. @param args Arguments to pass to the procedure. The rules for converting the arguments to scripting variables are implementation-specific. @return The value returned by the procedure. The rules for converting the scripting variable returned by the script method to a Java Object are implementation-specific. @throws javax.script.ScriptException Something went wrong @throws NoSuchMethodException Method did not exist
[ "<p", ">", "Calls", "a", "method", "on", "a", "script", "object", "compiled", "during", "a", "previous", "script", "execution", "which", "is", "retained", "in", "the", "state", "of", "the", "ScriptEngine", ".", "<", "/", "p", ">" ]
train
https://github.com/dbracewell/mango/blob/2cec08826f1fccd658694dd03abce10fc97618ec/src/main/java/com/davidbracewell/scripting/ScriptEnvironment.java#L145-L149
eclipse/xtext-extras
org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/parser/TokenSequencePreservingPartialParsingHelper.java
TokenSequencePreservingPartialParsingHelper.isBrokenPreviousState
protected boolean isBrokenPreviousState(IParseResult previousParseResult, int offset) { """ Returns true if the previous document state was completely broken, e.g. the parser did not recover at all. This may happen e.g. in Xtend for documents like <pre>import static class C {}</pre> where the class keyword is consumed as an invalid token in the import declaration and everything thereafter is unrecoverable. """ if (previousParseResult.hasSyntaxErrors()) { BidiTreeIterator<AbstractNode> iterator = ((AbstractNode) previousParseResult.getRootNode()).basicIterator(); while(iterator.hasPrevious()) { AbstractNode previous = iterator.previous(); if (previous.getGrammarElement() == null) { return true; } if (previous instanceof ILeafNode && previous.getOffset() <= offset) { break; } } } return false; }
java
protected boolean isBrokenPreviousState(IParseResult previousParseResult, int offset) { if (previousParseResult.hasSyntaxErrors()) { BidiTreeIterator<AbstractNode> iterator = ((AbstractNode) previousParseResult.getRootNode()).basicIterator(); while(iterator.hasPrevious()) { AbstractNode previous = iterator.previous(); if (previous.getGrammarElement() == null) { return true; } if (previous instanceof ILeafNode && previous.getOffset() <= offset) { break; } } } return false; }
[ "protected", "boolean", "isBrokenPreviousState", "(", "IParseResult", "previousParseResult", ",", "int", "offset", ")", "{", "if", "(", "previousParseResult", ".", "hasSyntaxErrors", "(", ")", ")", "{", "BidiTreeIterator", "<", "AbstractNode", ">", "iterator", "=", "(", "(", "AbstractNode", ")", "previousParseResult", ".", "getRootNode", "(", ")", ")", ".", "basicIterator", "(", ")", ";", "while", "(", "iterator", ".", "hasPrevious", "(", ")", ")", "{", "AbstractNode", "previous", "=", "iterator", ".", "previous", "(", ")", ";", "if", "(", "previous", ".", "getGrammarElement", "(", ")", "==", "null", ")", "{", "return", "true", ";", "}", "if", "(", "previous", "instanceof", "ILeafNode", "&&", "previous", ".", "getOffset", "(", ")", "<=", "offset", ")", "{", "break", ";", "}", "}", "}", "return", "false", ";", "}" ]
Returns true if the previous document state was completely broken, e.g. the parser did not recover at all. This may happen e.g. in Xtend for documents like <pre>import static class C {}</pre> where the class keyword is consumed as an invalid token in the import declaration and everything thereafter is unrecoverable.
[ "Returns", "true", "if", "the", "previous", "document", "state", "was", "completely", "broken", "e", ".", "g", ".", "the", "parser", "did", "not", "recover", "at", "all", ".", "This", "may", "happen", "e", ".", "g", ".", "in", "Xtend", "for", "documents", "like", "<pre", ">", "import", "static", "class", "C", "{}", "<", "/", "pre", ">", "where", "the", "class", "keyword", "is", "consumed", "as", "an", "invalid", "token", "in", "the", "import", "declaration", "and", "everything", "thereafter", "is", "unrecoverable", "." ]
train
https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/parser/TokenSequencePreservingPartialParsingHelper.java#L142-L156
OpenLiberty/open-liberty
dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/activator/Activator.java
Activator.preInvokeActivateBean
public BeanO preInvokeActivateBean(EJBThreadData threadData, ContainerTx tx, BeanId beanId) // d641259 throws RemoteException { """ Activate a bean in the context of a transaction. If an instance of the bean is already active in the transaction, that instance is returned. Otherwise, one of several strategies is used to activate an instance depending on what the bean supports. <p> If this method completes normally, it must be balanced with a call to one of the following methods: removeBean, commitBean, rollbackBean. If this method throws an exception, any partial work has already been undone, and there should be no balancing method call. <p> If this method returns successfully, {@link EJBThreadData#pushCallbackBeanO} will have been called, and the caller is responsible for calling {@link EJBThreadData#popCallbackBeanO}. <p> @param threadData the EJB thread data for the currently executing thread @param tx the transaction context in which the bean instance should be activated. @param beanId the <code>BeanId</code> identifying the bean to activate. @return a fully-activated bean instance. """ return beanId.getActivationStrategy().atActivate(threadData, tx, beanId); }
java
public BeanO preInvokeActivateBean(EJBThreadData threadData, ContainerTx tx, BeanId beanId) // d641259 throws RemoteException { return beanId.getActivationStrategy().atActivate(threadData, tx, beanId); }
[ "public", "BeanO", "preInvokeActivateBean", "(", "EJBThreadData", "threadData", ",", "ContainerTx", "tx", ",", "BeanId", "beanId", ")", "// d641259", "throws", "RemoteException", "{", "return", "beanId", ".", "getActivationStrategy", "(", ")", ".", "atActivate", "(", "threadData", ",", "tx", ",", "beanId", ")", ";", "}" ]
Activate a bean in the context of a transaction. If an instance of the bean is already active in the transaction, that instance is returned. Otherwise, one of several strategies is used to activate an instance depending on what the bean supports. <p> If this method completes normally, it must be balanced with a call to one of the following methods: removeBean, commitBean, rollbackBean. If this method throws an exception, any partial work has already been undone, and there should be no balancing method call. <p> If this method returns successfully, {@link EJBThreadData#pushCallbackBeanO} will have been called, and the caller is responsible for calling {@link EJBThreadData#popCallbackBeanO}. <p> @param threadData the EJB thread data for the currently executing thread @param tx the transaction context in which the bean instance should be activated. @param beanId the <code>BeanId</code> identifying the bean to activate. @return a fully-activated bean instance.
[ "Activate", "a", "bean", "in", "the", "context", "of", "a", "transaction", ".", "If", "an", "instance", "of", "the", "bean", "is", "already", "active", "in", "the", "transaction", "that", "instance", "is", "returned", ".", "Otherwise", "one", "of", "several", "strategies", "is", "used", "to", "activate", "an", "instance", "depending", "on", "what", "the", "bean", "supports", ".", "<p", ">" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/activator/Activator.java#L260-L264
ag-gipp/MathMLTools
mathml-core/src/main/java/com/formulasearchengine/mathmltools/helper/XMLHelper.java
XMLHelper.getElementsB
public static NodeList getElementsB(Node node, XPathExpression xPath) throws XPathExpressionException { """ Helper program: Extracts the specified XPATH expression from an XML-String. @param node the node @param xPath the x path @return NodeList @throws XPathExpressionException the x path expression exception """ return (NodeList) xPath.evaluate(node, XPathConstants.NODESET); }
java
public static NodeList getElementsB(Node node, XPathExpression xPath) throws XPathExpressionException { return (NodeList) xPath.evaluate(node, XPathConstants.NODESET); }
[ "public", "static", "NodeList", "getElementsB", "(", "Node", "node", ",", "XPathExpression", "xPath", ")", "throws", "XPathExpressionException", "{", "return", "(", "NodeList", ")", "xPath", ".", "evaluate", "(", "node", ",", "XPathConstants", ".", "NODESET", ")", ";", "}" ]
Helper program: Extracts the specified XPATH expression from an XML-String. @param node the node @param xPath the x path @return NodeList @throws XPathExpressionException the x path expression exception
[ "Helper", "program", ":", "Extracts", "the", "specified", "XPATH", "expression", "from", "an", "XML", "-", "String", "." ]
train
https://github.com/ag-gipp/MathMLTools/blob/77c69b6366a5b8720796d1cd9d155ba26c2f1b20/mathml-core/src/main/java/com/formulasearchengine/mathmltools/helper/XMLHelper.java#L167-L170
foundation-runtime/service-directory
2.0/sd-core/src/main/java/com/cisco/oss/foundation/directory/Configurations.java
Configurations.getInt
public static int getInt(String name, int defaultVal) { """ Get the property object as int, or return defaultVal if property is not defined. @param name property name. @param defaultVal default property value. @return property value as int, return defaultVal if property is undefined. """ if(getConfiguration().containsKey(name)){ return getConfiguration().getInt(name); } else { return defaultVal; } }
java
public static int getInt(String name, int defaultVal){ if(getConfiguration().containsKey(name)){ return getConfiguration().getInt(name); } else { return defaultVal; } }
[ "public", "static", "int", "getInt", "(", "String", "name", ",", "int", "defaultVal", ")", "{", "if", "(", "getConfiguration", "(", ")", ".", "containsKey", "(", "name", ")", ")", "{", "return", "getConfiguration", "(", ")", ".", "getInt", "(", "name", ")", ";", "}", "else", "{", "return", "defaultVal", ";", "}", "}" ]
Get the property object as int, or return defaultVal if property is not defined. @param name property name. @param defaultVal default property value. @return property value as int, return defaultVal if property is undefined.
[ "Get", "the", "property", "object", "as", "int", "or", "return", "defaultVal", "if", "property", "is", "not", "defined", "." ]
train
https://github.com/foundation-runtime/service-directory/blob/a7bdefe173dc99e75eff4a24e07e6407e62f2ed4/2.0/sd-core/src/main/java/com/cisco/oss/foundation/directory/Configurations.java#L230-L236
facebook/fresco
imagepipeline/src/main/java/com/facebook/imagepipeline/request/BasePostprocessor.java
BasePostprocessor.internalCopyBitmap
private static void internalCopyBitmap(Bitmap destBitmap, Bitmap sourceBitmap) { """ Copies the content of {@code sourceBitmap} to {@code destBitmap}. Both bitmaps must have the same width and height. If their {@link Bitmap.Config} are identical, the memory is directly copied. Otherwise, the {@code sourceBitmap} is drawn into {@code destBitmap}. """ if (destBitmap.getConfig() == sourceBitmap.getConfig()) { Bitmaps.copyBitmap(destBitmap, sourceBitmap); } else { // The bitmap configurations might be different when the source bitmap's configuration is // null, because it uses an internal configuration and the destination bitmap's configuration // is the FALLBACK_BITMAP_CONFIGURATION. This is the case for static images for animated GIFs. Canvas canvas = new Canvas(destBitmap); canvas.drawBitmap(sourceBitmap, 0, 0, null); } }
java
private static void internalCopyBitmap(Bitmap destBitmap, Bitmap sourceBitmap) { if (destBitmap.getConfig() == sourceBitmap.getConfig()) { Bitmaps.copyBitmap(destBitmap, sourceBitmap); } else { // The bitmap configurations might be different when the source bitmap's configuration is // null, because it uses an internal configuration and the destination bitmap's configuration // is the FALLBACK_BITMAP_CONFIGURATION. This is the case for static images for animated GIFs. Canvas canvas = new Canvas(destBitmap); canvas.drawBitmap(sourceBitmap, 0, 0, null); } }
[ "private", "static", "void", "internalCopyBitmap", "(", "Bitmap", "destBitmap", ",", "Bitmap", "sourceBitmap", ")", "{", "if", "(", "destBitmap", ".", "getConfig", "(", ")", "==", "sourceBitmap", ".", "getConfig", "(", ")", ")", "{", "Bitmaps", ".", "copyBitmap", "(", "destBitmap", ",", "sourceBitmap", ")", ";", "}", "else", "{", "// The bitmap configurations might be different when the source bitmap's configuration is", "// null, because it uses an internal configuration and the destination bitmap's configuration", "// is the FALLBACK_BITMAP_CONFIGURATION. This is the case for static images for animated GIFs.", "Canvas", "canvas", "=", "new", "Canvas", "(", "destBitmap", ")", ";", "canvas", ".", "drawBitmap", "(", "sourceBitmap", ",", "0", ",", "0", ",", "null", ")", ";", "}", "}" ]
Copies the content of {@code sourceBitmap} to {@code destBitmap}. Both bitmaps must have the same width and height. If their {@link Bitmap.Config} are identical, the memory is directly copied. Otherwise, the {@code sourceBitmap} is drawn into {@code destBitmap}.
[ "Copies", "the", "content", "of", "{" ]
train
https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/imagepipeline/src/main/java/com/facebook/imagepipeline/request/BasePostprocessor.java#L114-L124
DDTH/ddth-commons
ddth-commons-core/src/main/java/com/github/ddth/commons/utils/JacksonUtils.java
JacksonUtils.getDate
public static Date getDate(JsonNode node, String dPath, String dateTimeFormat) { """ Extract a date value from the target {@link JsonNode} using DPath expression. If the extracted value is a string, parse it as a {@link Date} using the specified date-time format. @param node @param dPath @param dateTimeFormat see {@link SimpleDateFormat} @return @see DPathUtils """ return DPathUtils.getDate(node, dPath, dateTimeFormat); }
java
public static Date getDate(JsonNode node, String dPath, String dateTimeFormat) { return DPathUtils.getDate(node, dPath, dateTimeFormat); }
[ "public", "static", "Date", "getDate", "(", "JsonNode", "node", ",", "String", "dPath", ",", "String", "dateTimeFormat", ")", "{", "return", "DPathUtils", ".", "getDate", "(", "node", ",", "dPath", ",", "dateTimeFormat", ")", ";", "}" ]
Extract a date value from the target {@link JsonNode} using DPath expression. If the extracted value is a string, parse it as a {@link Date} using the specified date-time format. @param node @param dPath @param dateTimeFormat see {@link SimpleDateFormat} @return @see DPathUtils
[ "Extract", "a", "date", "value", "from", "the", "target", "{", "@link", "JsonNode", "}", "using", "DPath", "expression", ".", "If", "the", "extracted", "value", "is", "a", "string", "parse", "it", "as", "a", "{", "@link", "Date", "}", "using", "the", "specified", "date", "-", "time", "format", "." ]
train
https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/utils/JacksonUtils.java#L220-L222
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java
GoogleMapShapeConverter.toMultiPolygon
public MultiPolygon toMultiPolygon( List<com.google.android.gms.maps.model.Polygon> polygonList, boolean hasZ, boolean hasM) { """ Convert a list of {@link com.google.android.gms.maps.model.Polygon} to a {@link MultiPolygon} @param polygonList polygon list @param hasZ has z flag @param hasM has m flag @return multi polygon """ MultiPolygon multiPolygon = new MultiPolygon(hasZ, hasM); for (com.google.android.gms.maps.model.Polygon mapPolygon : polygonList) { Polygon polygon = toPolygon(mapPolygon); multiPolygon.addPolygon(polygon); } return multiPolygon; }
java
public MultiPolygon toMultiPolygon( List<com.google.android.gms.maps.model.Polygon> polygonList, boolean hasZ, boolean hasM) { MultiPolygon multiPolygon = new MultiPolygon(hasZ, hasM); for (com.google.android.gms.maps.model.Polygon mapPolygon : polygonList) { Polygon polygon = toPolygon(mapPolygon); multiPolygon.addPolygon(polygon); } return multiPolygon; }
[ "public", "MultiPolygon", "toMultiPolygon", "(", "List", "<", "com", ".", "google", ".", "android", ".", "gms", ".", "maps", ".", "model", ".", "Polygon", ">", "polygonList", ",", "boolean", "hasZ", ",", "boolean", "hasM", ")", "{", "MultiPolygon", "multiPolygon", "=", "new", "MultiPolygon", "(", "hasZ", ",", "hasM", ")", ";", "for", "(", "com", ".", "google", ".", "android", ".", "gms", ".", "maps", ".", "model", ".", "Polygon", "mapPolygon", ":", "polygonList", ")", "{", "Polygon", "polygon", "=", "toPolygon", "(", "mapPolygon", ")", ";", "multiPolygon", ".", "addPolygon", "(", "polygon", ")", ";", "}", "return", "multiPolygon", ";", "}" ]
Convert a list of {@link com.google.android.gms.maps.model.Polygon} to a {@link MultiPolygon} @param polygonList polygon list @param hasZ has z flag @param hasM has m flag @return multi polygon
[ "Convert", "a", "list", "of", "{", "@link", "com", ".", "google", ".", "android", ".", "gms", ".", "maps", ".", "model", ".", "Polygon", "}", "to", "a", "{", "@link", "MultiPolygon", "}" ]
train
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java#L1023-L1035
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java
ModelsImpl.deletePatternAnyEntityModelAsync
public Observable<OperationStatus> deletePatternAnyEntityModelAsync(UUID appId, String versionId, UUID entityId) { """ Deletes a Pattern.Any entity extractor from the application. @param appId The application ID. @param versionId The version ID. @param entityId The Pattern.Any entity extractor ID. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the OperationStatus object """ return deletePatternAnyEntityModelWithServiceResponseAsync(appId, versionId, entityId).map(new Func1<ServiceResponse<OperationStatus>, OperationStatus>() { @Override public OperationStatus call(ServiceResponse<OperationStatus> response) { return response.body(); } }); }
java
public Observable<OperationStatus> deletePatternAnyEntityModelAsync(UUID appId, String versionId, UUID entityId) { return deletePatternAnyEntityModelWithServiceResponseAsync(appId, versionId, entityId).map(new Func1<ServiceResponse<OperationStatus>, OperationStatus>() { @Override public OperationStatus call(ServiceResponse<OperationStatus> response) { return response.body(); } }); }
[ "public", "Observable", "<", "OperationStatus", ">", "deletePatternAnyEntityModelAsync", "(", "UUID", "appId", ",", "String", "versionId", ",", "UUID", "entityId", ")", "{", "return", "deletePatternAnyEntityModelWithServiceResponseAsync", "(", "appId", ",", "versionId", ",", "entityId", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "OperationStatus", ">", ",", "OperationStatus", ">", "(", ")", "{", "@", "Override", "public", "OperationStatus", "call", "(", "ServiceResponse", "<", "OperationStatus", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Deletes a Pattern.Any entity extractor from the application. @param appId The application ID. @param versionId The version ID. @param entityId The Pattern.Any entity extractor ID. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the OperationStatus object
[ "Deletes", "a", "Pattern", ".", "Any", "entity", "extractor", "from", "the", "application", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L10677-L10684
andkulikov/Transitions-Everywhere
library(1.x)/src/main/java/com/transitionseverywhere/TransitionManager.java
TransitionManager.go
public static void go(@NonNull Scene scene, @Nullable Transition transition) { """ Convenience method to simply change to the given scene using the given transition. <p/> <p>Passing in <code>null</code> for the transition parameter will result in the scene changing without any transition running, and is equivalent to calling {@link Scene#exit()} on the scene root's current scene, followed by {@link Scene#enter()} on the scene specified by the <code>scene</code> parameter.</p> @param scene The Scene to change to @param transition The transition to use for this scene change. A value of null causes the scene change to happen with no transition. """ changeScene(scene, transition); }
java
public static void go(@NonNull Scene scene, @Nullable Transition transition) { changeScene(scene, transition); }
[ "public", "static", "void", "go", "(", "@", "NonNull", "Scene", "scene", ",", "@", "Nullable", "Transition", "transition", ")", "{", "changeScene", "(", "scene", ",", "transition", ")", ";", "}" ]
Convenience method to simply change to the given scene using the given transition. <p/> <p>Passing in <code>null</code> for the transition parameter will result in the scene changing without any transition running, and is equivalent to calling {@link Scene#exit()} on the scene root's current scene, followed by {@link Scene#enter()} on the scene specified by the <code>scene</code> parameter.</p> @param scene The Scene to change to @param transition The transition to use for this scene change. A value of null causes the scene change to happen with no transition.
[ "Convenience", "method", "to", "simply", "change", "to", "the", "given", "scene", "using", "the", "given", "transition", ".", "<p", "/", ">", "<p", ">", "Passing", "in", "<code", ">", "null<", "/", "code", ">", "for", "the", "transition", "parameter", "will", "result", "in", "the", "scene", "changing", "without", "any", "transition", "running", "and", "is", "equivalent", "to", "calling", "{", "@link", "Scene#exit", "()", "}", "on", "the", "scene", "root", "s", "current", "scene", "followed", "by", "{", "@link", "Scene#enter", "()", "}", "on", "the", "scene", "specified", "by", "the", "<code", ">", "scene<", "/", "code", ">", "parameter", ".", "<", "/", "p", ">" ]
train
https://github.com/andkulikov/Transitions-Everywhere/blob/828efe5f152a2f05e2bfeee6254b74ad2269d4f1/library(1.x)/src/main/java/com/transitionseverywhere/TransitionManager.java#L391-L393