repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
listlengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
listlengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
UrielCh/ovh-java-sdk
ovh-java-sdk-sms/src/main/java/net/minidev/ovh/api/ApiOvhSms.java
ApiOvhSms.virtualNumbers_number_serviceInfos_GET
public OvhService virtualNumbers_number_serviceInfos_GET(String number) throws IOException { """ Get this object properties REST: GET /sms/virtualNumbers/{number}/serviceInfos @param number [required] Your virtual number """ String qPath = "/sms/virtualNumbers/{number}/serviceInfos"; StringBuilder sb = path(qPath, number); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhService.class); }
java
public OvhService virtualNumbers_number_serviceInfos_GET(String number) throws IOException { String qPath = "/sms/virtualNumbers/{number}/serviceInfos"; StringBuilder sb = path(qPath, number); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhService.class); }
[ "public", "OvhService", "virtualNumbers_number_serviceInfos_GET", "(", "String", "number", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/sms/virtualNumbers/{number}/serviceInfos\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "number", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhService", ".", "class", ")", ";", "}" ]
Get this object properties REST: GET /sms/virtualNumbers/{number}/serviceInfos @param number [required] Your virtual number
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-sms/src/main/java/net/minidev/ovh/api/ApiOvhSms.java#L1747-L1752
jenkinsci/jenkins
core/src/main/java/jenkins/install/SetupWizard.java
SetupWizard.getPlatformPluginUpdates
@CheckForNull public JSONArray getPlatformPluginUpdates() { """ Provides the list of platform plugin updates from the last time the upgrade was run. @return {@code null} if the version range cannot be retrieved. """ final VersionNumber version = getCurrentLevel(); if (version == null) { return null; } return getPlatformPluginsForUpdate(version, Jenkins.getVersion()); }
java
@CheckForNull public JSONArray getPlatformPluginUpdates() { final VersionNumber version = getCurrentLevel(); if (version == null) { return null; } return getPlatformPluginsForUpdate(version, Jenkins.getVersion()); }
[ "@", "CheckForNull", "public", "JSONArray", "getPlatformPluginUpdates", "(", ")", "{", "final", "VersionNumber", "version", "=", "getCurrentLevel", "(", ")", ";", "if", "(", "version", "==", "null", ")", "{", "return", "null", ";", "}", "return", "getPlatformPluginsForUpdate", "(", "version", ",", "Jenkins", ".", "getVersion", "(", ")", ")", ";", "}" ]
Provides the list of platform plugin updates from the last time the upgrade was run. @return {@code null} if the version range cannot be retrieved.
[ "Provides", "the", "list", "of", "platform", "plugin", "updates", "from", "the", "last", "time", "the", "upgrade", "was", "run", "." ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/jenkins/install/SetupWizard.java#L424-L431
ngageoint/geopackage-java
src/main/java/mil/nga/geopackage/io/TileProperties.java
TileProperties.getIntegerProperty
public Integer getIntegerProperty(String property, boolean required) { """ Get the Integer property @param property property @param required required flag @return integer property """ Integer integerValue = null; String value = getProperty(property, required); if (value != null) { try { integerValue = Integer.valueOf(value); } catch (NumberFormatException e) { throw new GeoPackageException(GEOPACKAGE_PROPERTIES_FILE + " property file property '" + property + "' must be an integer"); } } return integerValue; }
java
public Integer getIntegerProperty(String property, boolean required) { Integer integerValue = null; String value = getProperty(property, required); if (value != null) { try { integerValue = Integer.valueOf(value); } catch (NumberFormatException e) { throw new GeoPackageException(GEOPACKAGE_PROPERTIES_FILE + " property file property '" + property + "' must be an integer"); } } return integerValue; }
[ "public", "Integer", "getIntegerProperty", "(", "String", "property", ",", "boolean", "required", ")", "{", "Integer", "integerValue", "=", "null", ";", "String", "value", "=", "getProperty", "(", "property", ",", "required", ")", ";", "if", "(", "value", "!=", "null", ")", "{", "try", "{", "integerValue", "=", "Integer", ".", "valueOf", "(", "value", ")", ";", "}", "catch", "(", "NumberFormatException", "e", ")", "{", "throw", "new", "GeoPackageException", "(", "GEOPACKAGE_PROPERTIES_FILE", "+", "\" property file property '\"", "+", "property", "+", "\"' must be an integer\"", ")", ";", "}", "}", "return", "integerValue", ";", "}" ]
Get the Integer property @param property property @param required required flag @return integer property
[ "Get", "the", "Integer", "property" ]
train
https://github.com/ngageoint/geopackage-java/blob/889bffb5d18330a3f4bd89443acf7959ebe3a376/src/main/java/mil/nga/geopackage/io/TileProperties.java#L136-L149
Azure/azure-sdk-for-java
datalakeanalytics/resource-manager/v2015_10_01_preview/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2015_10_01_preview/implementation/AccountsInner.java
AccountsInner.beginUpdateAsync
public Observable<DataLakeAnalyticsAccountInner> beginUpdateAsync(String resourceGroupName, String name, DataLakeAnalyticsAccountInner parameters) { """ Updates the Data Lake Analytics account object specified by the accountName with the contents of the account object. @param resourceGroupName The name of the Azure resource group that contains the Data Lake Analytics account. @param name The name of the Data Lake Analytics account to update. @param parameters Parameters supplied to the update Data Lake Analytics account operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the DataLakeAnalyticsAccountInner object """ return beginUpdateWithServiceResponseAsync(resourceGroupName, name, parameters).map(new Func1<ServiceResponse<DataLakeAnalyticsAccountInner>, DataLakeAnalyticsAccountInner>() { @Override public DataLakeAnalyticsAccountInner call(ServiceResponse<DataLakeAnalyticsAccountInner> response) { return response.body(); } }); }
java
public Observable<DataLakeAnalyticsAccountInner> beginUpdateAsync(String resourceGroupName, String name, DataLakeAnalyticsAccountInner parameters) { return beginUpdateWithServiceResponseAsync(resourceGroupName, name, parameters).map(new Func1<ServiceResponse<DataLakeAnalyticsAccountInner>, DataLakeAnalyticsAccountInner>() { @Override public DataLakeAnalyticsAccountInner call(ServiceResponse<DataLakeAnalyticsAccountInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "DataLakeAnalyticsAccountInner", ">", "beginUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "name", ",", "DataLakeAnalyticsAccountInner", "parameters", ")", "{", "return", "beginUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "name", ",", "parameters", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "DataLakeAnalyticsAccountInner", ">", ",", "DataLakeAnalyticsAccountInner", ">", "(", ")", "{", "@", "Override", "public", "DataLakeAnalyticsAccountInner", "call", "(", "ServiceResponse", "<", "DataLakeAnalyticsAccountInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Updates the Data Lake Analytics account object specified by the accountName with the contents of the account object. @param resourceGroupName The name of the Azure resource group that contains the Data Lake Analytics account. @param name The name of the Data Lake Analytics account to update. @param parameters Parameters supplied to the update Data Lake Analytics account operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the DataLakeAnalyticsAccountInner object
[ "Updates", "the", "Data", "Lake", "Analytics", "account", "object", "specified", "by", "the", "accountName", "with", "the", "contents", "of", "the", "account", "object", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datalakeanalytics/resource-manager/v2015_10_01_preview/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2015_10_01_preview/implementation/AccountsInner.java#L2874-L2881
raydac/java-binary-block-parser
jbbp/src/main/java/com/igormaznitsa/jbbp/model/JBBPFieldBit.java
JBBPFieldBit.reverseBits
public static long reverseBits(final byte value, final JBBPBitNumber bits) { """ Get the reversed bit representation of the value. @param value the value to be reversed @param bits number of bits to be reversed, must not be null @return the reversed value """ return JBBPUtils.reverseBitsInByte(value) >>> (8 - bits.getBitNumber()) & bits.getMask(); }
java
public static long reverseBits(final byte value, final JBBPBitNumber bits) { return JBBPUtils.reverseBitsInByte(value) >>> (8 - bits.getBitNumber()) & bits.getMask(); }
[ "public", "static", "long", "reverseBits", "(", "final", "byte", "value", ",", "final", "JBBPBitNumber", "bits", ")", "{", "return", "JBBPUtils", ".", "reverseBitsInByte", "(", "value", ")", ">>>", "(", "8", "-", "bits", ".", "getBitNumber", "(", ")", ")", "&", "bits", ".", "getMask", "(", ")", ";", "}" ]
Get the reversed bit representation of the value. @param value the value to be reversed @param bits number of bits to be reversed, must not be null @return the reversed value
[ "Get", "the", "reversed", "bit", "representation", "of", "the", "value", "." ]
train
https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/model/JBBPFieldBit.java#L61-L63
facebookarchive/hadoop-20
src/contrib/seekablecompression/src/java/org/apache/hadoop/io/simpleseekableformat/InterleavedInputStream.java
InterleavedInputStream.rawSkip
protected boolean rawSkip(long bytes, boolean toNewSource) throws IOException { """ Skip some bytes from the raw InputStream. @param toNewSource - only useful when seekableIn is not null. @return when toNewSource is true, return whether we seeked to a new source. otherwise return true. """ boolean result = seekOrSkip(bytes, toNewSource); setRawOffset(getRawOffset() + bytes); // Check validity if (rawBlockOffset > 0 && rawBlockOffset < metaDataBlockSize) { throw new IOException("Cannot jump into the middle of a MetaDataBlock. MetaDataBlockSize = " + metaDataBlockSize + " and we are at " + rawBlockOffset); } return result; }
java
protected boolean rawSkip(long bytes, boolean toNewSource) throws IOException { boolean result = seekOrSkip(bytes, toNewSource); setRawOffset(getRawOffset() + bytes); // Check validity if (rawBlockOffset > 0 && rawBlockOffset < metaDataBlockSize) { throw new IOException("Cannot jump into the middle of a MetaDataBlock. MetaDataBlockSize = " + metaDataBlockSize + " and we are at " + rawBlockOffset); } return result; }
[ "protected", "boolean", "rawSkip", "(", "long", "bytes", ",", "boolean", "toNewSource", ")", "throws", "IOException", "{", "boolean", "result", "=", "seekOrSkip", "(", "bytes", ",", "toNewSource", ")", ";", "setRawOffset", "(", "getRawOffset", "(", ")", "+", "bytes", ")", ";", "// Check validity", "if", "(", "rawBlockOffset", ">", "0", "&&", "rawBlockOffset", "<", "metaDataBlockSize", ")", "{", "throw", "new", "IOException", "(", "\"Cannot jump into the middle of a MetaDataBlock. MetaDataBlockSize = \"", "+", "metaDataBlockSize", "+", "\" and we are at \"", "+", "rawBlockOffset", ")", ";", "}", "return", "result", ";", "}" ]
Skip some bytes from the raw InputStream. @param toNewSource - only useful when seekableIn is not null. @return when toNewSource is true, return whether we seeked to a new source. otherwise return true.
[ "Skip", "some", "bytes", "from", "the", "raw", "InputStream", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/seekablecompression/src/java/org/apache/hadoop/io/simpleseekableformat/InterleavedInputStream.java#L286-L297
alkacon/opencms-core
src/org/opencms/report/A_CmsReportThread.java
A_CmsReportThread.initHtmlReport
protected void initHtmlReport(Locale locale) { """ Initialize a HTML report for this Thread.<p> @param locale the locale for the report output messages """ m_report = new CmsWorkplaceReport(locale, m_cms.getRequestContext().getSiteRoot(), getLogChannel()); }
java
protected void initHtmlReport(Locale locale) { m_report = new CmsWorkplaceReport(locale, m_cms.getRequestContext().getSiteRoot(), getLogChannel()); }
[ "protected", "void", "initHtmlReport", "(", "Locale", "locale", ")", "{", "m_report", "=", "new", "CmsWorkplaceReport", "(", "locale", ",", "m_cms", ".", "getRequestContext", "(", ")", ".", "getSiteRoot", "(", ")", ",", "getLogChannel", "(", ")", ")", ";", "}" ]
Initialize a HTML report for this Thread.<p> @param locale the locale for the report output messages
[ "Initialize", "a", "HTML", "report", "for", "this", "Thread", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/report/A_CmsReportThread.java#L255-L258
passwordmaker/java-passwordmaker-lib
src/main/java/org/daveware/passwordmaker/PasswordMaker.java
PasswordMaker.makePassword
public SecureUTF8String makePassword(final SecureUTF8String masterPassword, final Account account) throws Exception { """ Generates a hash of the master password with settings from the account. @param masterPassword The password to use as a key for the various algorithms. @param account The account with the specific settings for the hash. Uses account.getUrl() as the inputText @return A SecureCharArray with the hashed data. @throws Exception if something bad happened. """ return makePassword(masterPassword, account, account.getUrl()); }
java
public SecureUTF8String makePassword(final SecureUTF8String masterPassword, final Account account) throws Exception { return makePassword(masterPassword, account, account.getUrl()); }
[ "public", "SecureUTF8String", "makePassword", "(", "final", "SecureUTF8String", "masterPassword", ",", "final", "Account", "account", ")", "throws", "Exception", "{", "return", "makePassword", "(", "masterPassword", ",", "account", ",", "account", ".", "getUrl", "(", ")", ")", ";", "}" ]
Generates a hash of the master password with settings from the account. @param masterPassword The password to use as a key for the various algorithms. @param account The account with the specific settings for the hash. Uses account.getUrl() as the inputText @return A SecureCharArray with the hashed data. @throws Exception if something bad happened.
[ "Generates", "a", "hash", "of", "the", "master", "password", "with", "settings", "from", "the", "account", "." ]
train
https://github.com/passwordmaker/java-passwordmaker-lib/blob/18c22fca7dd9a47f08161425b85a5bd257afbb2b/src/main/java/org/daveware/passwordmaker/PasswordMaker.java#L391-L394
esigate/esigate
esigate-core/src/main/java/org/esigate/impl/UrlRewriter.java
UrlRewriter.rewriteRefresh
public String rewriteRefresh(String input, String requestUrl, String baseUrl, String visibleBaseUrl) { """ Rewrites a "Refresh" HTTP header or a &lt;meta http-equiv="refresh"... tag. The value should have the following format: Refresh: 5; url=http://www.example.com @param input The refresh value to be rewritten. @param requestUrl The request URL. @param baseUrl The base URL selected for this request. @param visibleBaseUrl The base URL viewed by the browser. @return the rewritten refresh value """ // Header has the following format // Refresh: 5; url=http://www.w3.org/pub/WWW/People.html int urlPosition = input.indexOf("url="); if (urlPosition >= 0) { String urlValue = input.substring(urlPosition + "url=".length()); String targetUrlValue = rewriteUrl(urlValue, requestUrl, baseUrl, visibleBaseUrl, true); return input.substring(0, urlPosition) + "url=" + targetUrlValue; } else { return input; } }
java
public String rewriteRefresh(String input, String requestUrl, String baseUrl, String visibleBaseUrl) { // Header has the following format // Refresh: 5; url=http://www.w3.org/pub/WWW/People.html int urlPosition = input.indexOf("url="); if (urlPosition >= 0) { String urlValue = input.substring(urlPosition + "url=".length()); String targetUrlValue = rewriteUrl(urlValue, requestUrl, baseUrl, visibleBaseUrl, true); return input.substring(0, urlPosition) + "url=" + targetUrlValue; } else { return input; } }
[ "public", "String", "rewriteRefresh", "(", "String", "input", ",", "String", "requestUrl", ",", "String", "baseUrl", ",", "String", "visibleBaseUrl", ")", "{", "// Header has the following format", "// Refresh: 5; url=http://www.w3.org/pub/WWW/People.html", "int", "urlPosition", "=", "input", ".", "indexOf", "(", "\"url=\"", ")", ";", "if", "(", "urlPosition", ">=", "0", ")", "{", "String", "urlValue", "=", "input", ".", "substring", "(", "urlPosition", "+", "\"url=\"", ".", "length", "(", ")", ")", ";", "String", "targetUrlValue", "=", "rewriteUrl", "(", "urlValue", ",", "requestUrl", ",", "baseUrl", ",", "visibleBaseUrl", ",", "true", ")", ";", "return", "input", ".", "substring", "(", "0", ",", "urlPosition", ")", "+", "\"url=\"", "+", "targetUrlValue", ";", "}", "else", "{", "return", "input", ";", "}", "}" ]
Rewrites a "Refresh" HTTP header or a &lt;meta http-equiv="refresh"... tag. The value should have the following format: Refresh: 5; url=http://www.example.com @param input The refresh value to be rewritten. @param requestUrl The request URL. @param baseUrl The base URL selected for this request. @param visibleBaseUrl The base URL viewed by the browser. @return the rewritten refresh value
[ "Rewrites", "a", "Refresh", "HTTP", "header", "or", "a", "&lt", ";", "meta", "http", "-", "equiv", "=", "refresh", "...", "tag", ".", "The", "value", "should", "have", "the", "following", "format", ":" ]
train
https://github.com/esigate/esigate/blob/50421fb224f16e1ec42715425109a72b3b55527b/esigate-core/src/main/java/org/esigate/impl/UrlRewriter.java#L288-L299
VoltDB/voltdb
src/frontend/org/voltcore/utils/CoreUtils.java
CoreUtils.getBoundedThreadPoolExecutor
public static ThreadPoolExecutor getBoundedThreadPoolExecutor(int maxPoolSize, long keepAliveTime, TimeUnit unit, ThreadFactory tFactory) { """ Create a bounded thread pool executor. The work queue is synchronous and can cause RejectedExecutionException if there is no available thread to take a new task. @param maxPoolSize: the maximum number of threads to allow in the pool. @param keepAliveTime: when the number of threads is greater than the core, this is the maximum time that excess idle threads will wait for new tasks before terminating. @param unit: the time unit for the keepAliveTime argument. @param threadFactory: the factory to use when the executor creates a new thread. """ return new ThreadPoolExecutor(0, maxPoolSize, keepAliveTime, unit, new SynchronousQueue<Runnable>(), tFactory); }
java
public static ThreadPoolExecutor getBoundedThreadPoolExecutor(int maxPoolSize, long keepAliveTime, TimeUnit unit, ThreadFactory tFactory) { return new ThreadPoolExecutor(0, maxPoolSize, keepAliveTime, unit, new SynchronousQueue<Runnable>(), tFactory); }
[ "public", "static", "ThreadPoolExecutor", "getBoundedThreadPoolExecutor", "(", "int", "maxPoolSize", ",", "long", "keepAliveTime", ",", "TimeUnit", "unit", ",", "ThreadFactory", "tFactory", ")", "{", "return", "new", "ThreadPoolExecutor", "(", "0", ",", "maxPoolSize", ",", "keepAliveTime", ",", "unit", ",", "new", "SynchronousQueue", "<", "Runnable", ">", "(", ")", ",", "tFactory", ")", ";", "}" ]
Create a bounded thread pool executor. The work queue is synchronous and can cause RejectedExecutionException if there is no available thread to take a new task. @param maxPoolSize: the maximum number of threads to allow in the pool. @param keepAliveTime: when the number of threads is greater than the core, this is the maximum time that excess idle threads will wait for new tasks before terminating. @param unit: the time unit for the keepAliveTime argument. @param threadFactory: the factory to use when the executor creates a new thread.
[ "Create", "a", "bounded", "thread", "pool", "executor", ".", "The", "work", "queue", "is", "synchronous", "and", "can", "cause", "RejectedExecutionException", "if", "there", "is", "no", "available", "thread", "to", "take", "a", "new", "task", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltcore/utils/CoreUtils.java#L588-L591
rhuss/jolokia
agent/jvm/src/main/java/org/jolokia/jvmagent/security/KeyStoreUtil.java
KeyStoreUtil.updateWithCaPem
public static void updateWithCaPem(KeyStore pTrustStore, File pCaCert) throws IOException, CertificateException, KeyStoreException, NoSuchAlgorithmException { """ Update a keystore with a CA certificate @param pTrustStore the keystore to update @param pCaCert CA cert as PEM used for the trust store """ InputStream is = new FileInputStream(pCaCert); try { CertificateFactory certFactory = CertificateFactory.getInstance("X509"); X509Certificate cert = (X509Certificate) certFactory.generateCertificate(is); String alias = cert.getSubjectX500Principal().getName(); pTrustStore.setCertificateEntry(alias, cert); } finally { is.close(); } }
java
public static void updateWithCaPem(KeyStore pTrustStore, File pCaCert) throws IOException, CertificateException, KeyStoreException, NoSuchAlgorithmException { InputStream is = new FileInputStream(pCaCert); try { CertificateFactory certFactory = CertificateFactory.getInstance("X509"); X509Certificate cert = (X509Certificate) certFactory.generateCertificate(is); String alias = cert.getSubjectX500Principal().getName(); pTrustStore.setCertificateEntry(alias, cert); } finally { is.close(); } }
[ "public", "static", "void", "updateWithCaPem", "(", "KeyStore", "pTrustStore", ",", "File", "pCaCert", ")", "throws", "IOException", ",", "CertificateException", ",", "KeyStoreException", ",", "NoSuchAlgorithmException", "{", "InputStream", "is", "=", "new", "FileInputStream", "(", "pCaCert", ")", ";", "try", "{", "CertificateFactory", "certFactory", "=", "CertificateFactory", ".", "getInstance", "(", "\"X509\"", ")", ";", "X509Certificate", "cert", "=", "(", "X509Certificate", ")", "certFactory", ".", "generateCertificate", "(", "is", ")", ";", "String", "alias", "=", "cert", ".", "getSubjectX500Principal", "(", ")", ".", "getName", "(", ")", ";", "pTrustStore", ".", "setCertificateEntry", "(", "alias", ",", "cert", ")", ";", "}", "finally", "{", "is", ".", "close", "(", ")", ";", "}", "}" ]
Update a keystore with a CA certificate @param pTrustStore the keystore to update @param pCaCert CA cert as PEM used for the trust store
[ "Update", "a", "keystore", "with", "a", "CA", "certificate" ]
train
https://github.com/rhuss/jolokia/blob/dc95e7bef859b1829776c5a84c8f7738f5d7d9c3/agent/jvm/src/main/java/org/jolokia/jvmagent/security/KeyStoreUtil.java#L55-L67
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Objects.java
Objects.requireNonNull
public static <T> T requireNonNull(T obj, Supplier<String> messageSupplier) { """ Checks that the specified object reference is not {@code null} and throws a customized {@link NullPointerException} if it is. <p>Unlike the method {@link #requireNonNull(Object, String)}, this method allows creation of the message to be deferred until after the null check is made. While this may confer a performance advantage in the non-null case, when deciding to call this method care should be taken that the costs of creating the message supplier are less than the cost of just creating the string message directly. @param obj the object reference to check for nullity @param messageSupplier supplier of the detail message to be used in the event that a {@code NullPointerException} is thrown @param <T> the type of the reference @return {@code obj} if not {@code null} @throws NullPointerException if {@code obj} is {@code null} @since 1.8 """ if (obj == null) throw new NullPointerException(messageSupplier.get()); return obj; }
java
public static <T> T requireNonNull(T obj, Supplier<String> messageSupplier) { if (obj == null) throw new NullPointerException(messageSupplier.get()); return obj; }
[ "public", "static", "<", "T", ">", "T", "requireNonNull", "(", "T", "obj", ",", "Supplier", "<", "String", ">", "messageSupplier", ")", "{", "if", "(", "obj", "==", "null", ")", "throw", "new", "NullPointerException", "(", "messageSupplier", ".", "get", "(", ")", ")", ";", "return", "obj", ";", "}" ]
Checks that the specified object reference is not {@code null} and throws a customized {@link NullPointerException} if it is. <p>Unlike the method {@link #requireNonNull(Object, String)}, this method allows creation of the message to be deferred until after the null check is made. While this may confer a performance advantage in the non-null case, when deciding to call this method care should be taken that the costs of creating the message supplier are less than the cost of just creating the string message directly. @param obj the object reference to check for nullity @param messageSupplier supplier of the detail message to be used in the event that a {@code NullPointerException} is thrown @param <T> the type of the reference @return {@code obj} if not {@code null} @throws NullPointerException if {@code obj} is {@code null} @since 1.8
[ "Checks", "that", "the", "specified", "object", "reference", "is", "not", "{", "@code", "null", "}", "and", "throws", "a", "customized", "{", "@link", "NullPointerException", "}", "if", "it", "is", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Objects.java#L288-L292
JodaOrg/joda-time
src/main/java/org/joda/time/format/PeriodFormatterBuilder.java
PeriodFormatterBuilder.appendSuffix
public PeriodFormatterBuilder appendSuffix(String singularText, String pluralText) { """ Append a field suffix which applies only to the last appended field. If the field is not printed, neither is the suffix. <p> During parsing, the singular and plural versions are accepted whether or not the actual value matches plurality. @param singularText text to print if field value is one @param pluralText text to print if field value is not one @return this PeriodFormatterBuilder @throws IllegalStateException if no field exists to append to @see #appendPrefix """ if (singularText == null || pluralText == null) { throw new IllegalArgumentException(); } return appendSuffix(new PluralAffix(singularText, pluralText)); }
java
public PeriodFormatterBuilder appendSuffix(String singularText, String pluralText) { if (singularText == null || pluralText == null) { throw new IllegalArgumentException(); } return appendSuffix(new PluralAffix(singularText, pluralText)); }
[ "public", "PeriodFormatterBuilder", "appendSuffix", "(", "String", "singularText", ",", "String", "pluralText", ")", "{", "if", "(", "singularText", "==", "null", "||", "pluralText", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "return", "appendSuffix", "(", "new", "PluralAffix", "(", "singularText", ",", "pluralText", ")", ")", ";", "}" ]
Append a field suffix which applies only to the last appended field. If the field is not printed, neither is the suffix. <p> During parsing, the singular and plural versions are accepted whether or not the actual value matches plurality. @param singularText text to print if field value is one @param pluralText text to print if field value is not one @return this PeriodFormatterBuilder @throws IllegalStateException if no field exists to append to @see #appendPrefix
[ "Append", "a", "field", "suffix", "which", "applies", "only", "to", "the", "last", "appended", "field", ".", "If", "the", "field", "is", "not", "printed", "neither", "is", "the", "suffix", ".", "<p", ">", "During", "parsing", "the", "singular", "and", "plural", "versions", "are", "accepted", "whether", "or", "not", "the", "actual", "value", "matches", "plurality", "." ]
train
https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/format/PeriodFormatterBuilder.java#L626-L632
drinkjava2/jBeanBox
jbeanbox/src/main/java/com/github/drinkjava2/asm5_0_3/util/CheckMethodAdapter.java
CheckMethodAdapter.checkSignedShort
static void checkSignedShort(final int value, final String msg) { """ Checks that the given value is a signed short. @param value the value to be checked. @param msg an message to be used in case of error. """ if (value < Short.MIN_VALUE || value > Short.MAX_VALUE) { throw new IllegalArgumentException(msg + " (must be a signed short): " + value); } }
java
static void checkSignedShort(final int value, final String msg) { if (value < Short.MIN_VALUE || value > Short.MAX_VALUE) { throw new IllegalArgumentException(msg + " (must be a signed short): " + value); } }
[ "static", "void", "checkSignedShort", "(", "final", "int", "value", ",", "final", "String", "msg", ")", "{", "if", "(", "value", "<", "Short", ".", "MIN_VALUE", "||", "value", ">", "Short", ".", "MAX_VALUE", ")", "{", "throw", "new", "IllegalArgumentException", "(", "msg", "+", "\" (must be a signed short): \"", "+", "value", ")", ";", "}", "}" ]
Checks that the given value is a signed short. @param value the value to be checked. @param msg an message to be used in case of error.
[ "Checks", "that", "the", "given", "value", "is", "a", "signed", "short", "." ]
train
https://github.com/drinkjava2/jBeanBox/blob/01c216599ffa2e5f2d9c01df2adaad0f45567c04/jbeanbox/src/main/java/com/github/drinkjava2/asm5_0_3/util/CheckMethodAdapter.java#L1125-L1130
aalmiray/Json-lib
src/main/java/net/sf/json/JSONObject.java
JSONObject.optBoolean
public boolean optBoolean( String key, boolean defaultValue ) { """ Get an optional boolean associated with a key. It returns the defaultValue if there is no such key, or if it is not a Boolean or the String "true" or "false" (case insensitive). @param key A key string. @param defaultValue The default. @return The truth. """ verifyIsNull(); try{ return getBoolean( key ); }catch( Exception e ){ return defaultValue; } }
java
public boolean optBoolean( String key, boolean defaultValue ) { verifyIsNull(); try{ return getBoolean( key ); }catch( Exception e ){ return defaultValue; } }
[ "public", "boolean", "optBoolean", "(", "String", "key", ",", "boolean", "defaultValue", ")", "{", "verifyIsNull", "(", ")", ";", "try", "{", "return", "getBoolean", "(", "key", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "return", "defaultValue", ";", "}", "}" ]
Get an optional boolean associated with a key. It returns the defaultValue if there is no such key, or if it is not a Boolean or the String "true" or "false" (case insensitive). @param key A key string. @param defaultValue The default. @return The truth.
[ "Get", "an", "optional", "boolean", "associated", "with", "a", "key", ".", "It", "returns", "the", "defaultValue", "if", "there", "is", "no", "such", "key", "or", "if", "it", "is", "not", "a", "Boolean", "or", "the", "String", "true", "or", "false", "(", "case", "insensitive", ")", "." ]
train
https://github.com/aalmiray/Json-lib/blob/9e2b3376ee8f511a48aa7ac05f75a7414e02280f/src/main/java/net/sf/json/JSONObject.java#L2138-L2145
geomajas/geomajas-project-server
impl/src/main/java/org/geomajas/internal/security/DefaultSecurityContext.java
DefaultSecurityContext.setAuthentications
@Api public void setAuthentications(String token, List<Authentication> authentications) { """ Set the token and authentications for this security context. <p/> This method can be overwritten to handle custom policies. @param token current token @param authentications authentications for token """ this.token = token; this.authentications.clear(); if (null != authentications) { for (Authentication auth : authentications) { for (BaseAuthorization ba : auth.getAuthorizations()) { if (ba instanceof AuthorizationNeedsWiring) { ((AuthorizationNeedsWiring) ba).wire(applicationContext); } } this.authentications.add(auth); } } userInfoInit(); }
java
@Api public void setAuthentications(String token, List<Authentication> authentications) { this.token = token; this.authentications.clear(); if (null != authentications) { for (Authentication auth : authentications) { for (BaseAuthorization ba : auth.getAuthorizations()) { if (ba instanceof AuthorizationNeedsWiring) { ((AuthorizationNeedsWiring) ba).wire(applicationContext); } } this.authentications.add(auth); } } userInfoInit(); }
[ "@", "Api", "public", "void", "setAuthentications", "(", "String", "token", ",", "List", "<", "Authentication", ">", "authentications", ")", "{", "this", ".", "token", "=", "token", ";", "this", ".", "authentications", ".", "clear", "(", ")", ";", "if", "(", "null", "!=", "authentications", ")", "{", "for", "(", "Authentication", "auth", ":", "authentications", ")", "{", "for", "(", "BaseAuthorization", "ba", ":", "auth", ".", "getAuthorizations", "(", ")", ")", "{", "if", "(", "ba", "instanceof", "AuthorizationNeedsWiring", ")", "{", "(", "(", "AuthorizationNeedsWiring", ")", "ba", ")", ".", "wire", "(", "applicationContext", ")", ";", "}", "}", "this", ".", "authentications", ".", "add", "(", "auth", ")", ";", "}", "}", "userInfoInit", "(", ")", ";", "}" ]
Set the token and authentications for this security context. <p/> This method can be overwritten to handle custom policies. @param token current token @param authentications authentications for token
[ "Set", "the", "token", "and", "authentications", "for", "this", "security", "context", ".", "<p", "/", ">", "This", "method", "can", "be", "overwritten", "to", "handle", "custom", "policies", "." ]
train
https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/impl/src/main/java/org/geomajas/internal/security/DefaultSecurityContext.java#L120-L135
Whiley/WhileyCompiler
src/main/java/wyil/check/FlowTypeCheck.java
FlowTypeCheck.checkContinue
private Environment checkContinue(Stmt.Continue stmt, Environment environment, EnclosingScope scope) { """ Type check a continue statement. This requires propagating the current environment to the block destination, to ensure that the actual types of all variables at that point are precise. @param stmt Statement to type check @param environment Determines the type of all variables immediately going into this block @return """ // FIXME: need to check environment to the continue destination return FlowTypeUtils.BOTTOM; }
java
private Environment checkContinue(Stmt.Continue stmt, Environment environment, EnclosingScope scope) { // FIXME: need to check environment to the continue destination return FlowTypeUtils.BOTTOM; }
[ "private", "Environment", "checkContinue", "(", "Stmt", ".", "Continue", "stmt", ",", "Environment", "environment", ",", "EnclosingScope", "scope", ")", "{", "// FIXME: need to check environment to the continue destination", "return", "FlowTypeUtils", ".", "BOTTOM", ";", "}" ]
Type check a continue statement. This requires propagating the current environment to the block destination, to ensure that the actual types of all variables at that point are precise. @param stmt Statement to type check @param environment Determines the type of all variables immediately going into this block @return
[ "Type", "check", "a", "continue", "statement", ".", "This", "requires", "propagating", "the", "current", "environment", "to", "the", "block", "destination", "to", "ensure", "that", "the", "actual", "types", "of", "all", "variables", "at", "that", "point", "are", "precise", "." ]
train
https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/check/FlowTypeCheck.java#L481-L484
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.billingAccount_service_serviceName_offerChanges_GET
public ArrayList<OvhLineOffer> billingAccount_service_serviceName_offerChanges_GET(String billingAccount, String serviceName) throws IOException { """ List all available offer changes compatibilities REST: GET /telephony/{billingAccount}/service/{serviceName}/offerChanges @param billingAccount [required] The name of your billingAccount @param serviceName [required] """ String qPath = "/telephony/{billingAccount}/service/{serviceName}/offerChanges"; StringBuilder sb = path(qPath, billingAccount, serviceName); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t15); }
java
public ArrayList<OvhLineOffer> billingAccount_service_serviceName_offerChanges_GET(String billingAccount, String serviceName) throws IOException { String qPath = "/telephony/{billingAccount}/service/{serviceName}/offerChanges"; StringBuilder sb = path(qPath, billingAccount, serviceName); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t15); }
[ "public", "ArrayList", "<", "OvhLineOffer", ">", "billingAccount_service_serviceName_offerChanges_GET", "(", "String", "billingAccount", ",", "String", "serviceName", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/telephony/{billingAccount}/service/{serviceName}/offerChanges\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "billingAccount", ",", "serviceName", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "t15", ")", ";", "}" ]
List all available offer changes compatibilities REST: GET /telephony/{billingAccount}/service/{serviceName}/offerChanges @param billingAccount [required] The name of your billingAccount @param serviceName [required]
[ "List", "all", "available", "offer", "changes", "compatibilities" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L4037-L4042
radkovo/CSSBox
src/main/java/org/fit/cssbox/layout/TextBox.java
TextBox.getCharOffsetXElem
public int getCharOffsetXElem(int pos) { """ Computes the X pixel offset of the given character of the box text. The character position is specified within the whole source text node. @param pos the character position in the string absolutely within the source text node (0 is the first character in the node) @return the X offset in pixels or 0 when the position does not fit to this box """ if (text != null) { FontMetrics fm = g.getFontMetrics(); if (pos <= textStart) return 0; else if (pos > textStart && pos < textEnd) return stringWidth(fm, text.substring(textStart, pos)); else return stringWidth(fm, text.substring(textStart, textEnd)); } else return 0; }
java
public int getCharOffsetXElem(int pos) { if (text != null) { FontMetrics fm = g.getFontMetrics(); if (pos <= textStart) return 0; else if (pos > textStart && pos < textEnd) return stringWidth(fm, text.substring(textStart, pos)); else return stringWidth(fm, text.substring(textStart, textEnd)); } else return 0; }
[ "public", "int", "getCharOffsetXElem", "(", "int", "pos", ")", "{", "if", "(", "text", "!=", "null", ")", "{", "FontMetrics", "fm", "=", "g", ".", "getFontMetrics", "(", ")", ";", "if", "(", "pos", "<=", "textStart", ")", "return", "0", ";", "else", "if", "(", "pos", ">", "textStart", "&&", "pos", "<", "textEnd", ")", "return", "stringWidth", "(", "fm", ",", "text", ".", "substring", "(", "textStart", ",", "pos", ")", ")", ";", "else", "return", "stringWidth", "(", "fm", ",", "text", ".", "substring", "(", "textStart", ",", "textEnd", ")", ")", ";", "}", "else", "return", "0", ";", "}" ]
Computes the X pixel offset of the given character of the box text. The character position is specified within the whole source text node. @param pos the character position in the string absolutely within the source text node (0 is the first character in the node) @return the X offset in pixels or 0 when the position does not fit to this box
[ "Computes", "the", "X", "pixel", "offset", "of", "the", "given", "character", "of", "the", "box", "text", ".", "The", "character", "position", "is", "specified", "within", "the", "whole", "source", "text", "node", "." ]
train
https://github.com/radkovo/CSSBox/blob/38aaf8f22d233d7b4dbc12a56cdbc72b447bc559/src/main/java/org/fit/cssbox/layout/TextBox.java#L968-L982
UrielCh/ovh-java-sdk
ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java
ApiOvhMe.installationTemplate_templateName_partitionScheme_schemeName_partition_mountpoint_PUT
public void installationTemplate_templateName_partitionScheme_schemeName_partition_mountpoint_PUT(String templateName, String schemeName, String mountpoint, OvhTemplatePartitions body) throws IOException { """ Alter this object properties REST: PUT /me/installationTemplate/{templateName}/partitionScheme/{schemeName}/partition/{mountpoint} @param body [required] New object properties @param templateName [required] This template name @param schemeName [required] name of this partitioning scheme @param mountpoint [required] partition mount point """ String qPath = "/me/installationTemplate/{templateName}/partitionScheme/{schemeName}/partition/{mountpoint}"; StringBuilder sb = path(qPath, templateName, schemeName, mountpoint); exec(qPath, "PUT", sb.toString(), body); }
java
public void installationTemplate_templateName_partitionScheme_schemeName_partition_mountpoint_PUT(String templateName, String schemeName, String mountpoint, OvhTemplatePartitions body) throws IOException { String qPath = "/me/installationTemplate/{templateName}/partitionScheme/{schemeName}/partition/{mountpoint}"; StringBuilder sb = path(qPath, templateName, schemeName, mountpoint); exec(qPath, "PUT", sb.toString(), body); }
[ "public", "void", "installationTemplate_templateName_partitionScheme_schemeName_partition_mountpoint_PUT", "(", "String", "templateName", ",", "String", "schemeName", ",", "String", "mountpoint", ",", "OvhTemplatePartitions", "body", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/me/installationTemplate/{templateName}/partitionScheme/{schemeName}/partition/{mountpoint}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "templateName", ",", "schemeName", ",", "mountpoint", ")", ";", "exec", "(", "qPath", ",", "\"PUT\"", ",", "sb", ".", "toString", "(", ")", ",", "body", ")", ";", "}" ]
Alter this object properties REST: PUT /me/installationTemplate/{templateName}/partitionScheme/{schemeName}/partition/{mountpoint} @param body [required] New object properties @param templateName [required] This template name @param schemeName [required] name of this partitioning scheme @param mountpoint [required] partition mount point
[ "Alter", "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#L3687-L3691
NoraUi/NoraUi
src/main/java/com/github/noraui/application/steps/Step.java
Step.uploadFile
protected void uploadFile(PageElement pageElement, String fileOrKey, Object... args) throws TechnicalException, FailureException { """ Updates a html file input with the path of the file to upload. @param pageElement Is target element @param fileOrKey Is the file path (text or text in context (after a save)) @param args list of arguments to format the found selector with @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_UPLOADING_FILE} message (with screenshot, no exception) @throws FailureException if the scenario encounters a functional error """ final String path = Context.getValue(fileOrKey) != null ? Context.getValue(fileOrKey) : System.getProperty(USER_DIR) + File.separator + DOWNLOADED_FILES_FOLDER + File.separator + fileOrKey; if (!"".equals(path)) { try { final WebElement element = Context.waitUntil(ExpectedConditions.presenceOfElementLocated(Utilities.getLocator(pageElement, args))); element.clear(); if (DriverFactory.IE.equals(Context.getBrowser())) { final String javascript = "arguments[0].value='" + path + "';"; ((JavascriptExecutor) getDriver()).executeScript(javascript, element); } else { element.sendKeys(path); } } catch (final Exception e) { new Result.Failure<>(e.getMessage(), Messages.format(Messages.getMessage(Messages.FAIL_MESSAGE_UPLOADING_FILE), path), true, pageElement.getPage().getCallBack()); } } else { logger.debug("Empty data provided. No need to update file upload path. If you want clear data, you need use: \"I clear text in ...\""); } }
java
protected void uploadFile(PageElement pageElement, String fileOrKey, Object... args) throws TechnicalException, FailureException { final String path = Context.getValue(fileOrKey) != null ? Context.getValue(fileOrKey) : System.getProperty(USER_DIR) + File.separator + DOWNLOADED_FILES_FOLDER + File.separator + fileOrKey; if (!"".equals(path)) { try { final WebElement element = Context.waitUntil(ExpectedConditions.presenceOfElementLocated(Utilities.getLocator(pageElement, args))); element.clear(); if (DriverFactory.IE.equals(Context.getBrowser())) { final String javascript = "arguments[0].value='" + path + "';"; ((JavascriptExecutor) getDriver()).executeScript(javascript, element); } else { element.sendKeys(path); } } catch (final Exception e) { new Result.Failure<>(e.getMessage(), Messages.format(Messages.getMessage(Messages.FAIL_MESSAGE_UPLOADING_FILE), path), true, pageElement.getPage().getCallBack()); } } else { logger.debug("Empty data provided. No need to update file upload path. If you want clear data, you need use: \"I clear text in ...\""); } }
[ "protected", "void", "uploadFile", "(", "PageElement", "pageElement", ",", "String", "fileOrKey", ",", "Object", "...", "args", ")", "throws", "TechnicalException", ",", "FailureException", "{", "final", "String", "path", "=", "Context", ".", "getValue", "(", "fileOrKey", ")", "!=", "null", "?", "Context", ".", "getValue", "(", "fileOrKey", ")", ":", "System", ".", "getProperty", "(", "USER_DIR", ")", "+", "File", ".", "separator", "+", "DOWNLOADED_FILES_FOLDER", "+", "File", ".", "separator", "+", "fileOrKey", ";", "if", "(", "!", "\"\"", ".", "equals", "(", "path", ")", ")", "{", "try", "{", "final", "WebElement", "element", "=", "Context", ".", "waitUntil", "(", "ExpectedConditions", ".", "presenceOfElementLocated", "(", "Utilities", ".", "getLocator", "(", "pageElement", ",", "args", ")", ")", ")", ";", "element", ".", "clear", "(", ")", ";", "if", "(", "DriverFactory", ".", "IE", ".", "equals", "(", "Context", ".", "getBrowser", "(", ")", ")", ")", "{", "final", "String", "javascript", "=", "\"arguments[0].value='\"", "+", "path", "+", "\"';\"", ";", "(", "(", "JavascriptExecutor", ")", "getDriver", "(", ")", ")", ".", "executeScript", "(", "javascript", ",", "element", ")", ";", "}", "else", "{", "element", ".", "sendKeys", "(", "path", ")", ";", "}", "}", "catch", "(", "final", "Exception", "e", ")", "{", "new", "Result", ".", "Failure", "<>", "(", "e", ".", "getMessage", "(", ")", ",", "Messages", ".", "format", "(", "Messages", ".", "getMessage", "(", "Messages", ".", "FAIL_MESSAGE_UPLOADING_FILE", ")", ",", "path", ")", ",", "true", ",", "pageElement", ".", "getPage", "(", ")", ".", "getCallBack", "(", ")", ")", ";", "}", "}", "else", "{", "logger", ".", "debug", "(", "\"Empty data provided. No need to update file upload path. If you want clear data, you need use: \\\"I clear text in ...\\\"\"", ")", ";", "}", "}" ]
Updates a html file input with the path of the file to upload. @param pageElement Is target element @param fileOrKey Is the file path (text or text in context (after a save)) @param args list of arguments to format the found selector with @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_UPLOADING_FILE} message (with screenshot, no exception) @throws FailureException if the scenario encounters a functional error
[ "Updates", "a", "html", "file", "input", "with", "the", "path", "of", "the", "file", "to", "upload", "." ]
train
https://github.com/NoraUi/NoraUi/blob/5f491a3339c7d3c20d7207760bdaf2acdb8f260c/src/main/java/com/github/noraui/application/steps/Step.java#L793-L811
jhunters/jprotobuf
src/main/java/com/baidu/bjf/remoting/protobuf/ProtobufIDLProxy.java
ProtobufIDLProxy.getProxyClassName
private static String getProxyClassName(String name, Map<String, String> mappedUniName, boolean isUniName) { """ Gets the proxy class name. @param name the name @param mappedUniName the mapped uni name @param isUniName the is uni name @return the proxy class name """ Set<String> emptyPkgs = Collections.emptySet(); return getProxyClassName(name, emptyPkgs, mappedUniName, isUniName); }
java
private static String getProxyClassName(String name, Map<String, String> mappedUniName, boolean isUniName) { Set<String> emptyPkgs = Collections.emptySet(); return getProxyClassName(name, emptyPkgs, mappedUniName, isUniName); }
[ "private", "static", "String", "getProxyClassName", "(", "String", "name", ",", "Map", "<", "String", ",", "String", ">", "mappedUniName", ",", "boolean", "isUniName", ")", "{", "Set", "<", "String", ">", "emptyPkgs", "=", "Collections", ".", "emptySet", "(", ")", ";", "return", "getProxyClassName", "(", "name", ",", "emptyPkgs", ",", "mappedUniName", ",", "isUniName", ")", ";", "}" ]
Gets the proxy class name. @param name the name @param mappedUniName the mapped uni name @param isUniName the is uni name @return the proxy class name
[ "Gets", "the", "proxy", "class", "name", "." ]
train
https://github.com/jhunters/jprotobuf/blob/55832c9b4792afb128e5b35139d8a3891561d8a3/src/main/java/com/baidu/bjf/remoting/protobuf/ProtobufIDLProxy.java#L1490-L1493
ngageoint/geopackage-core-java
src/main/java/mil/nga/geopackage/extension/related/RelatedTablesCoreExtension.java
RelatedTablesCoreExtension.addTilesRelationship
public ExtendedRelation addTilesRelationship(String baseTableName, TileTable tileTable, UserMappingTable userMappingTable) { """ Adds a tiles relationship between the base table and user tiles related table. Creates the user mapping table and a tile table if needed. @param baseTableName base table name @param tileTable user tile table @param userMappingTable user mapping table @return The relationship that was added @since 3.2.0 """ return addRelationship(baseTableName, tileTable, userMappingTable); }
java
public ExtendedRelation addTilesRelationship(String baseTableName, TileTable tileTable, UserMappingTable userMappingTable) { return addRelationship(baseTableName, tileTable, userMappingTable); }
[ "public", "ExtendedRelation", "addTilesRelationship", "(", "String", "baseTableName", ",", "TileTable", "tileTable", ",", "UserMappingTable", "userMappingTable", ")", "{", "return", "addRelationship", "(", "baseTableName", ",", "tileTable", ",", "userMappingTable", ")", ";", "}" ]
Adds a tiles relationship between the base table and user tiles related table. Creates the user mapping table and a tile table if needed. @param baseTableName base table name @param tileTable user tile table @param userMappingTable user mapping table @return The relationship that was added @since 3.2.0
[ "Adds", "a", "tiles", "relationship", "between", "the", "base", "table", "and", "user", "tiles", "related", "table", ".", "Creates", "the", "user", "mapping", "table", "and", "a", "tile", "table", "if", "needed", "." ]
train
https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/extension/related/RelatedTablesCoreExtension.java#L734-L737
Esri/geometry-api-java
src/main/java/com/esri/core/geometry/QuadTree.java
QuadTree.getIntersectionCount
public int getIntersectionCount(Envelope2D query, double tolerance, int maxCount) { """ Returns the number of elements in the quad tree that intersect the qiven query. Some elements may be duplicated if the quad tree stores duplicates. \param query The Envelope2D used for the query. \param tolerance The tolerance used for the intersection tests. \param max_count If the intersection count becomes greater than or equal to the max_count, then max_count is returned. """ return m_impl.getIntersectionCount(query, tolerance, maxCount); }
java
public int getIntersectionCount(Envelope2D query, double tolerance, int maxCount) { return m_impl.getIntersectionCount(query, tolerance, maxCount); }
[ "public", "int", "getIntersectionCount", "(", "Envelope2D", "query", ",", "double", "tolerance", ",", "int", "maxCount", ")", "{", "return", "m_impl", ".", "getIntersectionCount", "(", "query", ",", "tolerance", ",", "maxCount", ")", ";", "}" ]
Returns the number of elements in the quad tree that intersect the qiven query. Some elements may be duplicated if the quad tree stores duplicates. \param query The Envelope2D used for the query. \param tolerance The tolerance used for the intersection tests. \param max_count If the intersection count becomes greater than or equal to the max_count, then max_count is returned.
[ "Returns", "the", "number", "of", "elements", "in", "the", "quad", "tree", "that", "intersect", "the", "qiven", "query", ".", "Some", "elements", "may", "be", "duplicated", "if", "the", "quad", "tree", "stores", "duplicates", ".", "\\", "param", "query", "The", "Envelope2D", "used", "for", "the", "query", ".", "\\", "param", "tolerance", "The", "tolerance", "used", "for", "the", "intersection", "tests", ".", "\\", "param", "max_count", "If", "the", "intersection", "count", "becomes", "greater", "than", "or", "equal", "to", "the", "max_count", "then", "max_count", "is", "returned", "." ]
train
https://github.com/Esri/geometry-api-java/blob/494da8ec953d76e7c6072afbc081abfe48ff07cf/src/main/java/com/esri/core/geometry/QuadTree.java#L202-L204
line/line-bot-sdk-java
line-bot-servlet/src/main/java/com/linecorp/bot/servlet/LineBotCallbackRequestParser.java
LineBotCallbackRequestParser.handle
public CallbackRequest handle(String signature, String payload) throws LineBotCallbackException, IOException { """ Parse request. @param signature X-Line-Signature header. @param payload Request body. @return Parsed result. If there's an error, this method sends response. @throws LineBotCallbackException There's an error around signature. """ // validate signature if (signature == null || signature.length() == 0) { throw new LineBotCallbackException("Missing 'X-Line-Signature' header"); } log.debug("got: {}", payload); final byte[] json = payload.getBytes(StandardCharsets.UTF_8); if (!lineSignatureValidator.validateSignature(json, signature)) { throw new LineBotCallbackException("Invalid API signature"); } final CallbackRequest callbackRequest = objectMapper.readValue(json, CallbackRequest.class); if (callbackRequest == null || callbackRequest.getEvents() == null) { throw new LineBotCallbackException("Invalid content"); } return callbackRequest; }
java
public CallbackRequest handle(String signature, String payload) throws LineBotCallbackException, IOException { // validate signature if (signature == null || signature.length() == 0) { throw new LineBotCallbackException("Missing 'X-Line-Signature' header"); } log.debug("got: {}", payload); final byte[] json = payload.getBytes(StandardCharsets.UTF_8); if (!lineSignatureValidator.validateSignature(json, signature)) { throw new LineBotCallbackException("Invalid API signature"); } final CallbackRequest callbackRequest = objectMapper.readValue(json, CallbackRequest.class); if (callbackRequest == null || callbackRequest.getEvents() == null) { throw new LineBotCallbackException("Invalid content"); } return callbackRequest; }
[ "public", "CallbackRequest", "handle", "(", "String", "signature", ",", "String", "payload", ")", "throws", "LineBotCallbackException", ",", "IOException", "{", "// validate signature", "if", "(", "signature", "==", "null", "||", "signature", ".", "length", "(", ")", "==", "0", ")", "{", "throw", "new", "LineBotCallbackException", "(", "\"Missing 'X-Line-Signature' header\"", ")", ";", "}", "log", ".", "debug", "(", "\"got: {}\"", ",", "payload", ")", ";", "final", "byte", "[", "]", "json", "=", "payload", ".", "getBytes", "(", "StandardCharsets", ".", "UTF_8", ")", ";", "if", "(", "!", "lineSignatureValidator", ".", "validateSignature", "(", "json", ",", "signature", ")", ")", "{", "throw", "new", "LineBotCallbackException", "(", "\"Invalid API signature\"", ")", ";", "}", "final", "CallbackRequest", "callbackRequest", "=", "objectMapper", ".", "readValue", "(", "json", ",", "CallbackRequest", ".", "class", ")", ";", "if", "(", "callbackRequest", "==", "null", "||", "callbackRequest", ".", "getEvents", "(", ")", "==", "null", ")", "{", "throw", "new", "LineBotCallbackException", "(", "\"Invalid content\"", ")", ";", "}", "return", "callbackRequest", ";", "}" ]
Parse request. @param signature X-Line-Signature header. @param payload Request body. @return Parsed result. If there's an error, this method sends response. @throws LineBotCallbackException There's an error around signature.
[ "Parse", "request", "." ]
train
https://github.com/line/line-bot-sdk-java/blob/d6d30b19d5b90c2d3269eb9d6f88fe76fb6fcb55/line-bot-servlet/src/main/java/com/linecorp/bot/servlet/LineBotCallbackRequestParser.java#L75-L95
OpenLiberty/open-liberty
dev/com.ibm.ws.config/src/com/ibm/ws/config/xml/internal/VariableEvaluator.java
VariableEvaluator.tryEvaluateExpression
@FFDCIgnore( { """ Attempt to evaluate a variable expression. @param expr the expression string (for example, "x+0") @param context the context for evaluation @return the result, or null if evaluation fails """ NumberFormatException.class, ArithmeticException.class, ConfigEvaluatorException.class }) private String tryEvaluateExpression(String expr, final EvaluationContext context, final boolean ignoreWarnings) { try { return new ConfigExpressionEvaluator() { @Override String getProperty(String argName) throws ConfigEvaluatorException { return VariableEvaluator.this.getProperty(argName, context, ignoreWarnings, false); } @Override Object getPropertyObject(String argName) throws ConfigEvaluatorException { return VariableEvaluator.this.getPropertyObject(argName, context, ignoreWarnings, false); } }.evaluateExpression(expr); } catch (NumberFormatException e) { // ${0+string}, or a number that exceeds MAX_LONG. } catch (ArithmeticException e) { // ${x/0} } catch (ConfigEvaluatorException e) { // If getPropertyObject fails } return null; }
java
@FFDCIgnore({ NumberFormatException.class, ArithmeticException.class, ConfigEvaluatorException.class }) private String tryEvaluateExpression(String expr, final EvaluationContext context, final boolean ignoreWarnings) { try { return new ConfigExpressionEvaluator() { @Override String getProperty(String argName) throws ConfigEvaluatorException { return VariableEvaluator.this.getProperty(argName, context, ignoreWarnings, false); } @Override Object getPropertyObject(String argName) throws ConfigEvaluatorException { return VariableEvaluator.this.getPropertyObject(argName, context, ignoreWarnings, false); } }.evaluateExpression(expr); } catch (NumberFormatException e) { // ${0+string}, or a number that exceeds MAX_LONG. } catch (ArithmeticException e) { // ${x/0} } catch (ConfigEvaluatorException e) { // If getPropertyObject fails } return null; }
[ "@", "FFDCIgnore", "(", "{", "NumberFormatException", ".", "class", ",", "ArithmeticException", ".", "class", ",", "ConfigEvaluatorException", ".", "class", "}", ")", "private", "String", "tryEvaluateExpression", "(", "String", "expr", ",", "final", "EvaluationContext", "context", ",", "final", "boolean", "ignoreWarnings", ")", "{", "try", "{", "return", "new", "ConfigExpressionEvaluator", "(", ")", "{", "@", "Override", "String", "getProperty", "(", "String", "argName", ")", "throws", "ConfigEvaluatorException", "{", "return", "VariableEvaluator", ".", "this", ".", "getProperty", "(", "argName", ",", "context", ",", "ignoreWarnings", ",", "false", ")", ";", "}", "@", "Override", "Object", "getPropertyObject", "(", "String", "argName", ")", "throws", "ConfigEvaluatorException", "{", "return", "VariableEvaluator", ".", "this", ".", "getPropertyObject", "(", "argName", ",", "context", ",", "ignoreWarnings", ",", "false", ")", ";", "}", "}", ".", "evaluateExpression", "(", "expr", ")", ";", "}", "catch", "(", "NumberFormatException", "e", ")", "{", "// ${0+string}, or a number that exceeds MAX_LONG.", "}", "catch", "(", "ArithmeticException", "e", ")", "{", "// ${x/0}", "}", "catch", "(", "ConfigEvaluatorException", "e", ")", "{", "// If getPropertyObject fails", "}", "return", "null", ";", "}" ]
Attempt to evaluate a variable expression. @param expr the expression string (for example, "x+0") @param context the context for evaluation @return the result, or null if evaluation fails
[ "Attempt", "to", "evaluate", "a", "variable", "expression", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.config/src/com/ibm/ws/config/xml/internal/VariableEvaluator.java#L208-L232
magik6k/JWWF
src/main/java/net/magik6k/jwwf/widgets/basic/panel/TablePanel.java
TablePanel.put
public TablePanel put(Widget widget, int x, int y) { """ Set widget to certain cell in table @param widget Widget to set @param x Column @param y Row @return This instance for chaining """ if (x < 0 || y < 0 || x >= content.length || y >= content[x].length) throw new IndexOutOfBoundsException(); attach(widget); content[x][y] = widget; this.sendElement(); return this; }
java
public TablePanel put(Widget widget, int x, int y) { if (x < 0 || y < 0 || x >= content.length || y >= content[x].length) throw new IndexOutOfBoundsException(); attach(widget); content[x][y] = widget; this.sendElement(); return this; }
[ "public", "TablePanel", "put", "(", "Widget", "widget", ",", "int", "x", ",", "int", "y", ")", "{", "if", "(", "x", "<", "0", "||", "y", "<", "0", "||", "x", ">=", "content", ".", "length", "||", "y", ">=", "content", "[", "x", "]", ".", "length", ")", "throw", "new", "IndexOutOfBoundsException", "(", ")", ";", "attach", "(", "widget", ")", ";", "content", "[", "x", "]", "[", "y", "]", "=", "widget", ";", "this", ".", "sendElement", "(", ")", ";", "return", "this", ";", "}" ]
Set widget to certain cell in table @param widget Widget to set @param x Column @param y Row @return This instance for chaining
[ "Set", "widget", "to", "certain", "cell", "in", "table" ]
train
https://github.com/magik6k/JWWF/blob/8ba334501396c3301495da8708733f6014f20665/src/main/java/net/magik6k/jwwf/widgets/basic/panel/TablePanel.java#L195-L202
netty/netty
codec/src/main/java/io/netty/handler/codec/MessageAggregator.java
MessageAggregator.handleOversizedMessage
protected void handleOversizedMessage(ChannelHandlerContext ctx, S oversized) throws Exception { """ Invoked when an incoming request exceeds the maximum content length. The default behvaior is to trigger an {@code exceptionCaught()} event with a {@link TooLongFrameException}. @param ctx the {@link ChannelHandlerContext} @param oversized the accumulated message up to this point, whose type is {@code S} or {@code O} """ ctx.fireExceptionCaught( new TooLongFrameException("content length exceeded " + maxContentLength() + " bytes.")); }
java
protected void handleOversizedMessage(ChannelHandlerContext ctx, S oversized) throws Exception { ctx.fireExceptionCaught( new TooLongFrameException("content length exceeded " + maxContentLength() + " bytes.")); }
[ "protected", "void", "handleOversizedMessage", "(", "ChannelHandlerContext", "ctx", ",", "S", "oversized", ")", "throws", "Exception", "{", "ctx", ".", "fireExceptionCaught", "(", "new", "TooLongFrameException", "(", "\"content length exceeded \"", "+", "maxContentLength", "(", ")", "+", "\" bytes.\"", ")", ")", ";", "}" ]
Invoked when an incoming request exceeds the maximum content length. The default behvaior is to trigger an {@code exceptionCaught()} event with a {@link TooLongFrameException}. @param ctx the {@link ChannelHandlerContext} @param oversized the accumulated message up to this point, whose type is {@code S} or {@code O}
[ "Invoked", "when", "an", "incoming", "request", "exceeds", "the", "maximum", "content", "length", ".", "The", "default", "behvaior", "is", "to", "trigger", "an", "{", "@code", "exceptionCaught", "()", "}", "event", "with", "a", "{", "@link", "TooLongFrameException", "}", "." ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec/src/main/java/io/netty/handler/codec/MessageAggregator.java#L418-L421
oehf/ipf-oht-atna
auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/AuditorFactory.java
AuditorFactory.getAuditor
public static IHEAuditor getAuditor(Class<? extends IHEAuditor> clazz, AuditorModuleConfig config, boolean useGlobalContext) { """ Get an auditor instance for the specified auditor class, module configuration. Auditor will use a standalone context if a non-global context is requested. @param clazz Class to instantiate @param config Auditor configuration to use @param useGlobalContext Whether to use the global (true) or standalone (false) context @return Instance of an IHE Auditor """ AuditorModuleContext context; if (!useGlobalContext) { context = (AuditorModuleContext)ContextInitializer.initialize(config); } else { context = AuditorModuleContext.getContext(); } return getAuditor(clazz, config, context); }
java
public static IHEAuditor getAuditor(Class<? extends IHEAuditor> clazz, AuditorModuleConfig config, boolean useGlobalContext) { AuditorModuleContext context; if (!useGlobalContext) { context = (AuditorModuleContext)ContextInitializer.initialize(config); } else { context = AuditorModuleContext.getContext(); } return getAuditor(clazz, config, context); }
[ "public", "static", "IHEAuditor", "getAuditor", "(", "Class", "<", "?", "extends", "IHEAuditor", ">", "clazz", ",", "AuditorModuleConfig", "config", ",", "boolean", "useGlobalContext", ")", "{", "AuditorModuleContext", "context", ";", "if", "(", "!", "useGlobalContext", ")", "{", "context", "=", "(", "AuditorModuleContext", ")", "ContextInitializer", ".", "initialize", "(", "config", ")", ";", "}", "else", "{", "context", "=", "AuditorModuleContext", ".", "getContext", "(", ")", ";", "}", "return", "getAuditor", "(", "clazz", ",", "config", ",", "context", ")", ";", "}" ]
Get an auditor instance for the specified auditor class, module configuration. Auditor will use a standalone context if a non-global context is requested. @param clazz Class to instantiate @param config Auditor configuration to use @param useGlobalContext Whether to use the global (true) or standalone (false) context @return Instance of an IHE Auditor
[ "Get", "an", "auditor", "instance", "for", "the", "specified", "auditor", "class", "module", "configuration", ".", "Auditor", "will", "use", "a", "standalone", "context", "if", "a", "non", "-", "global", "context", "is", "requested", "." ]
train
https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/AuditorFactory.java#L63-L73
transloadit/java-sdk
src/main/java/com/transloadit/sdk/Assembly.java
Assembly.processTusFile
protected void processTusFile(InputStream inptStream, String fieldName, String assemblyUrl) throws IOException { """ Prepares a file for tus upload. @param inptStream {@link InputStream} @param fieldName the form field name assigned to the file. @param assemblyUrl the assembly url affiliated with the tus upload. @throws IOException when there's a failure with reading the input stream. """ TusUpload upload = getTusUploadInstance(inptStream, fieldName, assemblyUrl); Map<String, String> metadata = new HashMap<String, String>(); metadata.put("filename", fieldName); metadata.put("assembly_url", assemblyUrl); metadata.put("fieldname", fieldName); upload.setMetadata(metadata); uploads.add(upload); }
java
protected void processTusFile(InputStream inptStream, String fieldName, String assemblyUrl) throws IOException { TusUpload upload = getTusUploadInstance(inptStream, fieldName, assemblyUrl); Map<String, String> metadata = new HashMap<String, String>(); metadata.put("filename", fieldName); metadata.put("assembly_url", assemblyUrl); metadata.put("fieldname", fieldName); upload.setMetadata(metadata); uploads.add(upload); }
[ "protected", "void", "processTusFile", "(", "InputStream", "inptStream", ",", "String", "fieldName", ",", "String", "assemblyUrl", ")", "throws", "IOException", "{", "TusUpload", "upload", "=", "getTusUploadInstance", "(", "inptStream", ",", "fieldName", ",", "assemblyUrl", ")", ";", "Map", "<", "String", ",", "String", ">", "metadata", "=", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ";", "metadata", ".", "put", "(", "\"filename\"", ",", "fieldName", ")", ";", "metadata", ".", "put", "(", "\"assembly_url\"", ",", "assemblyUrl", ")", ";", "metadata", ".", "put", "(", "\"fieldname\"", ",", "fieldName", ")", ";", "upload", ".", "setMetadata", "(", "metadata", ")", ";", "uploads", ".", "add", "(", "upload", ")", ";", "}" ]
Prepares a file for tus upload. @param inptStream {@link InputStream} @param fieldName the form field name assigned to the file. @param assemblyUrl the assembly url affiliated with the tus upload. @throws IOException when there's a failure with reading the input stream.
[ "Prepares", "a", "file", "for", "tus", "upload", "." ]
train
https://github.com/transloadit/java-sdk/blob/9326c540a66f77b3d907d0b2c05bff1145ca14f7/src/main/java/com/transloadit/sdk/Assembly.java#L230-L241
springfox/springfox
springfox-spring-web/src/main/java/springfox/documentation/spring/web/plugins/Docket.java
Docket.additionalModels
public Docket additionalModels(ResolvedType first, ResolvedType... remaining) { """ Method to add additional models that are not part of any annotation or are perhaps implicit @param first - at least one is required @param remaining - possible collection of more @return on-going docket @since 2.4.0 """ additionalModels.add(first); additionalModels.addAll(Arrays.stream(remaining).collect(toSet())); return this; }
java
public Docket additionalModels(ResolvedType first, ResolvedType... remaining) { additionalModels.add(first); additionalModels.addAll(Arrays.stream(remaining).collect(toSet())); return this; }
[ "public", "Docket", "additionalModels", "(", "ResolvedType", "first", ",", "ResolvedType", "...", "remaining", ")", "{", "additionalModels", ".", "add", "(", "first", ")", ";", "additionalModels", ".", "addAll", "(", "Arrays", ".", "stream", "(", "remaining", ")", ".", "collect", "(", "toSet", "(", ")", ")", ")", ";", "return", "this", ";", "}" ]
Method to add additional models that are not part of any annotation or are perhaps implicit @param first - at least one is required @param remaining - possible collection of more @return on-going docket @since 2.4.0
[ "Method", "to", "add", "additional", "models", "that", "are", "not", "part", "of", "any", "annotation", "or", "are", "perhaps", "implicit" ]
train
https://github.com/springfox/springfox/blob/e40e2d6f4b345ffa35cd5c0ca7a12589036acaf7/springfox-spring-web/src/main/java/springfox/documentation/spring/web/plugins/Docket.java#L409-L413
scalecube/socketio
src/main/java/io/scalecube/socketio/pipeline/ResourceHandler.java
ResourceHandler.isNotModified
private boolean isNotModified(HttpRequest request, long lastModified) throws ParseException { """ /* Checks if the content has been modified sicne the date provided by the IF_MODIFIED_SINCE http header """ String ifModifiedSince = request.headers().get(HttpHeaderNames.IF_MODIFIED_SINCE); if (ifModifiedSince != null && !ifModifiedSince.equals("")) { SimpleDateFormat dateFormatter = new SimpleDateFormat(HTTP_DATE_FORMAT, Locale.US); Date ifModifiedSinceDate = dateFormatter.parse(ifModifiedSince); // Only compare up to the second because the datetime format we send to the client does // not have milliseconds long ifModifiedSinceDateSeconds = ifModifiedSinceDate.getTime() / 1000; long fileLastModifiedSeconds = lastModified / 1000; return ifModifiedSinceDateSeconds == fileLastModifiedSeconds; } return false; }
java
private boolean isNotModified(HttpRequest request, long lastModified) throws ParseException { String ifModifiedSince = request.headers().get(HttpHeaderNames.IF_MODIFIED_SINCE); if (ifModifiedSince != null && !ifModifiedSince.equals("")) { SimpleDateFormat dateFormatter = new SimpleDateFormat(HTTP_DATE_FORMAT, Locale.US); Date ifModifiedSinceDate = dateFormatter.parse(ifModifiedSince); // Only compare up to the second because the datetime format we send to the client does // not have milliseconds long ifModifiedSinceDateSeconds = ifModifiedSinceDate.getTime() / 1000; long fileLastModifiedSeconds = lastModified / 1000; return ifModifiedSinceDateSeconds == fileLastModifiedSeconds; } return false; }
[ "private", "boolean", "isNotModified", "(", "HttpRequest", "request", ",", "long", "lastModified", ")", "throws", "ParseException", "{", "String", "ifModifiedSince", "=", "request", ".", "headers", "(", ")", ".", "get", "(", "HttpHeaderNames", ".", "IF_MODIFIED_SINCE", ")", ";", "if", "(", "ifModifiedSince", "!=", "null", "&&", "!", "ifModifiedSince", ".", "equals", "(", "\"\"", ")", ")", "{", "SimpleDateFormat", "dateFormatter", "=", "new", "SimpleDateFormat", "(", "HTTP_DATE_FORMAT", ",", "Locale", ".", "US", ")", ";", "Date", "ifModifiedSinceDate", "=", "dateFormatter", ".", "parse", "(", "ifModifiedSince", ")", ";", "// Only compare up to the second because the datetime format we send to the client does", "// not have milliseconds", "long", "ifModifiedSinceDateSeconds", "=", "ifModifiedSinceDate", ".", "getTime", "(", ")", "/", "1000", ";", "long", "fileLastModifiedSeconds", "=", "lastModified", "/", "1000", ";", "return", "ifModifiedSinceDateSeconds", "==", "fileLastModifiedSeconds", ";", "}", "return", "false", ";", "}" ]
/* Checks if the content has been modified sicne the date provided by the IF_MODIFIED_SINCE http header
[ "/", "*", "Checks", "if", "the", "content", "has", "been", "modified", "sicne", "the", "date", "provided", "by", "the", "IF_MODIFIED_SINCE", "http", "header" ]
train
https://github.com/scalecube/socketio/blob/bad28fe7a132320750173e7cb71ad6d3688fb626/src/main/java/io/scalecube/socketio/pipeline/ResourceHandler.java#L121-L134
Netflix/eureka
eureka-core/src/main/java/com/netflix/eureka/aws/EIPManager.java
EIPManager.getEC2Service
private AmazonEC2 getEC2Service() { """ Gets the EC2 service object to call AWS APIs. @return the EC2 service object to call AWS APIs. """ String aWSAccessId = serverConfig.getAWSAccessId(); String aWSSecretKey = serverConfig.getAWSSecretKey(); AmazonEC2 ec2Service; if (null != aWSAccessId && !"".equals(aWSAccessId) && null != aWSSecretKey && !"".equals(aWSSecretKey)) { ec2Service = new AmazonEC2Client(new BasicAWSCredentials(aWSAccessId, aWSSecretKey)); } else { ec2Service = new AmazonEC2Client(new InstanceProfileCredentialsProvider()); } String region = clientConfig.getRegion(); region = region.trim().toLowerCase(); ec2Service.setEndpoint("ec2." + region + ".amazonaws.com"); return ec2Service; }
java
private AmazonEC2 getEC2Service() { String aWSAccessId = serverConfig.getAWSAccessId(); String aWSSecretKey = serverConfig.getAWSSecretKey(); AmazonEC2 ec2Service; if (null != aWSAccessId && !"".equals(aWSAccessId) && null != aWSSecretKey && !"".equals(aWSSecretKey)) { ec2Service = new AmazonEC2Client(new BasicAWSCredentials(aWSAccessId, aWSSecretKey)); } else { ec2Service = new AmazonEC2Client(new InstanceProfileCredentialsProvider()); } String region = clientConfig.getRegion(); region = region.trim().toLowerCase(); ec2Service.setEndpoint("ec2." + region + ".amazonaws.com"); return ec2Service; }
[ "private", "AmazonEC2", "getEC2Service", "(", ")", "{", "String", "aWSAccessId", "=", "serverConfig", ".", "getAWSAccessId", "(", ")", ";", "String", "aWSSecretKey", "=", "serverConfig", ".", "getAWSSecretKey", "(", ")", ";", "AmazonEC2", "ec2Service", ";", "if", "(", "null", "!=", "aWSAccessId", "&&", "!", "\"\"", ".", "equals", "(", "aWSAccessId", ")", "&&", "null", "!=", "aWSSecretKey", "&&", "!", "\"\"", ".", "equals", "(", "aWSSecretKey", ")", ")", "{", "ec2Service", "=", "new", "AmazonEC2Client", "(", "new", "BasicAWSCredentials", "(", "aWSAccessId", ",", "aWSSecretKey", ")", ")", ";", "}", "else", "{", "ec2Service", "=", "new", "AmazonEC2Client", "(", "new", "InstanceProfileCredentialsProvider", "(", ")", ")", ";", "}", "String", "region", "=", "clientConfig", ".", "getRegion", "(", ")", ";", "region", "=", "region", ".", "trim", "(", ")", ".", "toLowerCase", "(", ")", ";", "ec2Service", ".", "setEndpoint", "(", "\"ec2.\"", "+", "region", "+", "\".amazonaws.com\"", ")", ";", "return", "ec2Service", ";", "}" ]
Gets the EC2 service object to call AWS APIs. @return the EC2 service object to call AWS APIs.
[ "Gets", "the", "EC2", "service", "object", "to", "call", "AWS", "APIs", "." ]
train
https://github.com/Netflix/eureka/blob/48446d956be09df6650a3c00b7ebd7e2d1e1544f/eureka-core/src/main/java/com/netflix/eureka/aws/EIPManager.java#L405-L421
graphhopper/graphhopper
api/src/main/java/com/graphhopper/util/shapes/BBox.java
BBox.calculateIntersection
public BBox calculateIntersection(BBox bBox) { """ Calculates the intersecting BBox between this and the specified BBox @return the intersecting BBox or null if not intersecting """ if (!this.intersects(bBox)) return null; double minLon = Math.max(this.minLon, bBox.minLon); double maxLon = Math.min(this.maxLon, bBox.maxLon); double minLat = Math.max(this.minLat, bBox.minLat); double maxLat = Math.min(this.maxLat, bBox.maxLat); return new BBox(minLon, maxLon, minLat, maxLat); }
java
public BBox calculateIntersection(BBox bBox) { if (!this.intersects(bBox)) return null; double minLon = Math.max(this.minLon, bBox.minLon); double maxLon = Math.min(this.maxLon, bBox.maxLon); double minLat = Math.max(this.minLat, bBox.minLat); double maxLat = Math.min(this.maxLat, bBox.maxLat); return new BBox(minLon, maxLon, minLat, maxLat); }
[ "public", "BBox", "calculateIntersection", "(", "BBox", "bBox", ")", "{", "if", "(", "!", "this", ".", "intersects", "(", "bBox", ")", ")", "return", "null", ";", "double", "minLon", "=", "Math", ".", "max", "(", "this", ".", "minLon", ",", "bBox", ".", "minLon", ")", ";", "double", "maxLon", "=", "Math", ".", "min", "(", "this", ".", "maxLon", ",", "bBox", ".", "maxLon", ")", ";", "double", "minLat", "=", "Math", ".", "max", "(", "this", ".", "minLat", ",", "bBox", ".", "minLat", ")", ";", "double", "maxLat", "=", "Math", ".", "min", "(", "this", ".", "maxLat", ",", "bBox", ".", "maxLat", ")", ";", "return", "new", "BBox", "(", "minLon", ",", "maxLon", ",", "minLat", ",", "maxLat", ")", ";", "}" ]
Calculates the intersecting BBox between this and the specified BBox @return the intersecting BBox or null if not intersecting
[ "Calculates", "the", "intersecting", "BBox", "between", "this", "and", "the", "specified", "BBox" ]
train
https://github.com/graphhopper/graphhopper/blob/c235e306e6e823043cadcc41ead0e685bdebf737/api/src/main/java/com/graphhopper/util/shapes/BBox.java#L125-L135
alkacon/opencms-core
src/org/opencms/ade/galleries/A_CmsTreeTabDataPreloader.java
A_CmsTreeTabDataPreloader.createBeans
private T createBeans() throws CmsException { """ Creates the beans for the loaded resources, and returns the root bean.<p> @return the root bean @throws CmsException if something goes wrong """ // create the beans for the resources Map<CmsResource, T> beans = new HashMap<CmsResource, T>(); for (CmsResource resource : m_knownResources) { T bean = createEntry(m_cms, resource); if (bean != null) { beans.put(resource, bean); } } // attach beans for child resources to the beans for their parents for (Map.Entry<CmsResource, T> entry : beans.entrySet()) { CmsResource key = entry.getKey(); T bean = entry.getValue(); for (CmsResource child : m_childMap.get(key)) { T childEntry = beans.get(child); if (childEntry != null) { bean.addChild(childEntry); } } } return beans.get(m_rootResource); }
java
private T createBeans() throws CmsException { // create the beans for the resources Map<CmsResource, T> beans = new HashMap<CmsResource, T>(); for (CmsResource resource : m_knownResources) { T bean = createEntry(m_cms, resource); if (bean != null) { beans.put(resource, bean); } } // attach beans for child resources to the beans for their parents for (Map.Entry<CmsResource, T> entry : beans.entrySet()) { CmsResource key = entry.getKey(); T bean = entry.getValue(); for (CmsResource child : m_childMap.get(key)) { T childEntry = beans.get(child); if (childEntry != null) { bean.addChild(childEntry); } } } return beans.get(m_rootResource); }
[ "private", "T", "createBeans", "(", ")", "throws", "CmsException", "{", "// create the beans for the resources\r", "Map", "<", "CmsResource", ",", "T", ">", "beans", "=", "new", "HashMap", "<", "CmsResource", ",", "T", ">", "(", ")", ";", "for", "(", "CmsResource", "resource", ":", "m_knownResources", ")", "{", "T", "bean", "=", "createEntry", "(", "m_cms", ",", "resource", ")", ";", "if", "(", "bean", "!=", "null", ")", "{", "beans", ".", "put", "(", "resource", ",", "bean", ")", ";", "}", "}", "// attach beans for child resources to the beans for their parents\r", "for", "(", "Map", ".", "Entry", "<", "CmsResource", ",", "T", ">", "entry", ":", "beans", ".", "entrySet", "(", ")", ")", "{", "CmsResource", "key", "=", "entry", ".", "getKey", "(", ")", ";", "T", "bean", "=", "entry", ".", "getValue", "(", ")", ";", "for", "(", "CmsResource", "child", ":", "m_childMap", ".", "get", "(", "key", ")", ")", "{", "T", "childEntry", "=", "beans", ".", "get", "(", "child", ")", ";", "if", "(", "childEntry", "!=", "null", ")", "{", "bean", ".", "addChild", "(", "childEntry", ")", ";", "}", "}", "}", "return", "beans", ".", "get", "(", "m_rootResource", ")", ";", "}" ]
Creates the beans for the loaded resources, and returns the root bean.<p> @return the root bean @throws CmsException if something goes wrong
[ "Creates", "the", "beans", "for", "the", "loaded", "resources", "and", "returns", "the", "root", "bean", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/galleries/A_CmsTreeTabDataPreloader.java#L218-L241
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/SourceFinder.java
SourceFinder.openSource
public InputStream openSource(String packageName, String fileName) throws IOException { """ Open an input stream on a source file in given package. @param packageName the name of the package containing the class whose source file is given @param fileName the unqualified name of the source file @return an InputStream on the source file @throws IOException if a matching source file cannot be found """ SourceFile sourceFile = findSourceFile(packageName, fileName); return sourceFile.getInputStream(); }
java
public InputStream openSource(String packageName, String fileName) throws IOException { SourceFile sourceFile = findSourceFile(packageName, fileName); return sourceFile.getInputStream(); }
[ "public", "InputStream", "openSource", "(", "String", "packageName", ",", "String", "fileName", ")", "throws", "IOException", "{", "SourceFile", "sourceFile", "=", "findSourceFile", "(", "packageName", ",", "fileName", ")", ";", "return", "sourceFile", ".", "getInputStream", "(", ")", ";", "}" ]
Open an input stream on a source file in given package. @param packageName the name of the package containing the class whose source file is given @param fileName the unqualified name of the source file @return an InputStream on the source file @throws IOException if a matching source file cannot be found
[ "Open", "an", "input", "stream", "on", "a", "source", "file", "in", "given", "package", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/SourceFinder.java#L442-L445
alkacon/opencms-core
src/org/opencms/gwt/CmsVfsService.java
CmsVfsService.makeEntryBean
protected CmsVfsEntryBean makeEntryBean(CmsResource resource, boolean root) throws CmsException { """ Helper method for creating a VFS entry bean from a resource.<p> @param resource the resource whose data should be stored in the bean @param root true if the resource is a root resource @return the data bean representing the resource @throws CmsException if something goes wrong """ CmsObject cms = getCmsObject(); boolean isFolder = resource.isFolder(); String name = root ? "/" : resource.getName(); String path = cms.getSitePath(resource); boolean hasChildren = false; if (isFolder) { List<CmsResource> children = cms.getResourcesInFolder( cms.getRequestContext().getSitePath(resource), CmsResourceFilter.DEFAULT); if (!children.isEmpty()) { hasChildren = true; } } String resourceType = OpenCms.getResourceManager().getResourceType(resource.getTypeId()).getTypeName(); return new CmsVfsEntryBean(path, name, resourceType, isFolder, hasChildren); }
java
protected CmsVfsEntryBean makeEntryBean(CmsResource resource, boolean root) throws CmsException { CmsObject cms = getCmsObject(); boolean isFolder = resource.isFolder(); String name = root ? "/" : resource.getName(); String path = cms.getSitePath(resource); boolean hasChildren = false; if (isFolder) { List<CmsResource> children = cms.getResourcesInFolder( cms.getRequestContext().getSitePath(resource), CmsResourceFilter.DEFAULT); if (!children.isEmpty()) { hasChildren = true; } } String resourceType = OpenCms.getResourceManager().getResourceType(resource.getTypeId()).getTypeName(); return new CmsVfsEntryBean(path, name, resourceType, isFolder, hasChildren); }
[ "protected", "CmsVfsEntryBean", "makeEntryBean", "(", "CmsResource", "resource", ",", "boolean", "root", ")", "throws", "CmsException", "{", "CmsObject", "cms", "=", "getCmsObject", "(", ")", ";", "boolean", "isFolder", "=", "resource", ".", "isFolder", "(", ")", ";", "String", "name", "=", "root", "?", "\"/\"", ":", "resource", ".", "getName", "(", ")", ";", "String", "path", "=", "cms", ".", "getSitePath", "(", "resource", ")", ";", "boolean", "hasChildren", "=", "false", ";", "if", "(", "isFolder", ")", "{", "List", "<", "CmsResource", ">", "children", "=", "cms", ".", "getResourcesInFolder", "(", "cms", ".", "getRequestContext", "(", ")", ".", "getSitePath", "(", "resource", ")", ",", "CmsResourceFilter", ".", "DEFAULT", ")", ";", "if", "(", "!", "children", ".", "isEmpty", "(", ")", ")", "{", "hasChildren", "=", "true", ";", "}", "}", "String", "resourceType", "=", "OpenCms", ".", "getResourceManager", "(", ")", ".", "getResourceType", "(", "resource", ".", "getTypeId", "(", ")", ")", ".", "getTypeName", "(", ")", ";", "return", "new", "CmsVfsEntryBean", "(", "path", ",", "name", ",", "resourceType", ",", "isFolder", ",", "hasChildren", ")", ";", "}" ]
Helper method for creating a VFS entry bean from a resource.<p> @param resource the resource whose data should be stored in the bean @param root true if the resource is a root resource @return the data bean representing the resource @throws CmsException if something goes wrong
[ "Helper", "method", "for", "creating", "a", "VFS", "entry", "bean", "from", "a", "resource", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/gwt/CmsVfsService.java#L1235-L1253
btrplace/scheduler
api/src/main/java/org/btrplace/model/constraint/Overbook.java
Overbook.newOverbooks
public static List<Overbook> newOverbooks(Collection<Node> nodes, String rc, double r) { """ Instantiate constraints for a collection of nodes. @param nodes the nodes to integrate @param rc the resource identifier @param r the overbooking ratio, &gt;= 1 @return the associated list of continuous constraints """ return nodes.stream().map(n -> new Overbook(n, rc, r)).collect(Collectors.toList()); }
java
public static List<Overbook> newOverbooks(Collection<Node> nodes, String rc, double r) { return nodes.stream().map(n -> new Overbook(n, rc, r)).collect(Collectors.toList()); }
[ "public", "static", "List", "<", "Overbook", ">", "newOverbooks", "(", "Collection", "<", "Node", ">", "nodes", ",", "String", "rc", ",", "double", "r", ")", "{", "return", "nodes", ".", "stream", "(", ")", ".", "map", "(", "n", "->", "new", "Overbook", "(", "n", ",", "rc", ",", "r", ")", ")", ".", "collect", "(", "Collectors", ".", "toList", "(", ")", ")", ";", "}" ]
Instantiate constraints for a collection of nodes. @param nodes the nodes to integrate @param rc the resource identifier @param r the overbooking ratio, &gt;= 1 @return the associated list of continuous constraints
[ "Instantiate", "constraints", "for", "a", "collection", "of", "nodes", "." ]
train
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/api/src/main/java/org/btrplace/model/constraint/Overbook.java#L91-L93
zackpollard/JavaTelegramBot-API
conversations/src/main/java/pro/zackpollard/telegrambot/api/conversations/ConversationHistory.java
ConversationHistory.messageAt
public Message messageAt(ConversationPrompt prompt, Conversation conversation) { """ Gets message sent at specified prompt @param prompt Prompt identifier @param conversation Conversation prompt is used in @return message sent at specified prompt @throws IndexOutOfBoundsException if there are no messages from that prompt """ return messageAt(conversation.getPrompts().indexOf(prompt)); }
java
public Message messageAt(ConversationPrompt prompt, Conversation conversation) { return messageAt(conversation.getPrompts().indexOf(prompt)); }
[ "public", "Message", "messageAt", "(", "ConversationPrompt", "prompt", ",", "Conversation", "conversation", ")", "{", "return", "messageAt", "(", "conversation", ".", "getPrompts", "(", ")", ".", "indexOf", "(", "prompt", ")", ")", ";", "}" ]
Gets message sent at specified prompt @param prompt Prompt identifier @param conversation Conversation prompt is used in @return message sent at specified prompt @throws IndexOutOfBoundsException if there are no messages from that prompt
[ "Gets", "message", "sent", "at", "specified", "prompt" ]
train
https://github.com/zackpollard/JavaTelegramBot-API/blob/9d100f351824042ca5fc0ea735d1fa376a13e81d/conversations/src/main/java/pro/zackpollard/telegrambot/api/conversations/ConversationHistory.java#L49-L51
jcuda/jcufft
JCufftJava/src/main/java/jcuda/jcufft/JCufft.java
JCufft.cufftExecC2R
public static int cufftExecC2R(cufftHandle plan, Pointer cIdata, Pointer rOdata) { """ <pre> Executes a CUFFT complex-to-real (implicitly inverse) transform plan. cufftResult cufftExecC2R( cufftHandle plan, cufftComplex *idata, cufftReal *odata ); CUFFT uses as input data the GPU memory pointed to by the idata parameter. The input array holds only the non-redundant complex Fourier coefficients. This function stores the real output values in the odata array. If idata and odata are the same, this method does an inplace transform. (See CUFFT documentation for details on real data FFTs.) Input ---- plan The cufftHandle object for the plan to update idata Pointer to the complex input data (in GPU memory) to transform odata Pointer to the real output data (in GPU memory) Output ---- odata Contains the real-valued output data Return Values ---- CUFFT_SETUP_FAILED CUFFT library failed to initialize. CUFFT_INVALID_PLAN The plan parameter is not a valid handle. CUFFT_INVALID_VALUE The idata and/or odata parameter is not valid. CUFFT_EXEC_FAILED CUFFT failed to execute the transform on GPU. CUFFT_SUCCESS CUFFT successfully executed the FFT plan. JCUFFT_INTERNAL_ERROR If an internal JCufft error occurred <pre> """ return checkResult(cufftExecC2RNative(plan, cIdata, rOdata)); }
java
public static int cufftExecC2R(cufftHandle plan, Pointer cIdata, Pointer rOdata) { return checkResult(cufftExecC2RNative(plan, cIdata, rOdata)); }
[ "public", "static", "int", "cufftExecC2R", "(", "cufftHandle", "plan", ",", "Pointer", "cIdata", ",", "Pointer", "rOdata", ")", "{", "return", "checkResult", "(", "cufftExecC2RNative", "(", "plan", ",", "cIdata", ",", "rOdata", ")", ")", ";", "}" ]
<pre> Executes a CUFFT complex-to-real (implicitly inverse) transform plan. cufftResult cufftExecC2R( cufftHandle plan, cufftComplex *idata, cufftReal *odata ); CUFFT uses as input data the GPU memory pointed to by the idata parameter. The input array holds only the non-redundant complex Fourier coefficients. This function stores the real output values in the odata array. If idata and odata are the same, this method does an inplace transform. (See CUFFT documentation for details on real data FFTs.) Input ---- plan The cufftHandle object for the plan to update idata Pointer to the complex input data (in GPU memory) to transform odata Pointer to the real output data (in GPU memory) Output ---- odata Contains the real-valued output data Return Values ---- CUFFT_SETUP_FAILED CUFFT library failed to initialize. CUFFT_INVALID_PLAN The plan parameter is not a valid handle. CUFFT_INVALID_VALUE The idata and/or odata parameter is not valid. CUFFT_EXEC_FAILED CUFFT failed to execute the transform on GPU. CUFFT_SUCCESS CUFFT successfully executed the FFT plan. JCUFFT_INTERNAL_ERROR If an internal JCufft error occurred <pre>
[ "<pre", ">", "Executes", "a", "CUFFT", "complex", "-", "to", "-", "real", "(", "implicitly", "inverse", ")", "transform", "plan", "." ]
train
https://github.com/jcuda/jcufft/blob/833c87ffb0864f7ee7270fddef8af57f48939b3a/JCufftJava/src/main/java/jcuda/jcufft/JCufft.java#L1131-L1134
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/template/TemplateUtil.java
TemplateUtil.mapTaggedComponents
public static Map<String, WComponent> mapTaggedComponents(final Map<String, Object> context, final Map<String, WComponent> taggedComponents) { """ Replace each component tag with the key so it can be used in the replace writer. @param context the context to modify. @param taggedComponents the tagged components @return the keyed components """ Map<String, WComponent> componentsByKey = new HashMap<>(); // Replace each component tag with the key so it can be used in the replace writer for (Map.Entry<String, WComponent> tagged : taggedComponents.entrySet()) { String tag = tagged.getKey(); WComponent comp = tagged.getValue(); // The key needs to be something which would never be output by a Template. String key = "[WC-TemplateLayout-" + tag + "]"; componentsByKey.put(key, comp); // Map the tag to the key in the context context.put(tag, key); } return componentsByKey; }
java
public static Map<String, WComponent> mapTaggedComponents(final Map<String, Object> context, final Map<String, WComponent> taggedComponents) { Map<String, WComponent> componentsByKey = new HashMap<>(); // Replace each component tag with the key so it can be used in the replace writer for (Map.Entry<String, WComponent> tagged : taggedComponents.entrySet()) { String tag = tagged.getKey(); WComponent comp = tagged.getValue(); // The key needs to be something which would never be output by a Template. String key = "[WC-TemplateLayout-" + tag + "]"; componentsByKey.put(key, comp); // Map the tag to the key in the context context.put(tag, key); } return componentsByKey; }
[ "public", "static", "Map", "<", "String", ",", "WComponent", ">", "mapTaggedComponents", "(", "final", "Map", "<", "String", ",", "Object", ">", "context", ",", "final", "Map", "<", "String", ",", "WComponent", ">", "taggedComponents", ")", "{", "Map", "<", "String", ",", "WComponent", ">", "componentsByKey", "=", "new", "HashMap", "<>", "(", ")", ";", "// Replace each component tag with the key so it can be used in the replace writer", "for", "(", "Map", ".", "Entry", "<", "String", ",", "WComponent", ">", "tagged", ":", "taggedComponents", ".", "entrySet", "(", ")", ")", "{", "String", "tag", "=", "tagged", ".", "getKey", "(", ")", ";", "WComponent", "comp", "=", "tagged", ".", "getValue", "(", ")", ";", "// The key needs to be something which would never be output by a Template.", "String", "key", "=", "\"[WC-TemplateLayout-\"", "+", "tag", "+", "\"]\"", ";", "componentsByKey", ".", "put", "(", "key", ",", "comp", ")", ";", "// Map the tag to the key in the context", "context", ".", "put", "(", "tag", ",", "key", ")", ";", "}", "return", "componentsByKey", ";", "}" ]
Replace each component tag with the key so it can be used in the replace writer. @param context the context to modify. @param taggedComponents the tagged components @return the keyed components
[ "Replace", "each", "component", "tag", "with", "the", "key", "so", "it", "can", "be", "used", "in", "the", "replace", "writer", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/template/TemplateUtil.java#L29-L47
grpc/grpc-java
alts/src/main/java/io/grpc/alts/internal/AltsChannelCrypter.java
AltsChannelCrypter.incrementCounter
static void incrementCounter(byte[] counter, byte[] oldCounter) throws GeneralSecurityException { """ Increments {@code counter}, store the unincremented value in {@code oldCounter}. """ System.arraycopy(counter, 0, oldCounter, 0, counter.length); int i = 0; for (; i < COUNTER_OVERFLOW_LENGTH; i++) { counter[i]++; if (counter[i] != (byte) 0x00) { break; } } if (i == COUNTER_OVERFLOW_LENGTH) { // Restore old counter value to ensure that encrypt and decrypt keep failing. System.arraycopy(oldCounter, 0, counter, 0, counter.length); throw new GeneralSecurityException("Counter has overflowed."); } }
java
static void incrementCounter(byte[] counter, byte[] oldCounter) throws GeneralSecurityException { System.arraycopy(counter, 0, oldCounter, 0, counter.length); int i = 0; for (; i < COUNTER_OVERFLOW_LENGTH; i++) { counter[i]++; if (counter[i] != (byte) 0x00) { break; } } if (i == COUNTER_OVERFLOW_LENGTH) { // Restore old counter value to ensure that encrypt and decrypt keep failing. System.arraycopy(oldCounter, 0, counter, 0, counter.length); throw new GeneralSecurityException("Counter has overflowed."); } }
[ "static", "void", "incrementCounter", "(", "byte", "[", "]", "counter", ",", "byte", "[", "]", "oldCounter", ")", "throws", "GeneralSecurityException", "{", "System", ".", "arraycopy", "(", "counter", ",", "0", ",", "oldCounter", ",", "0", ",", "counter", ".", "length", ")", ";", "int", "i", "=", "0", ";", "for", "(", ";", "i", "<", "COUNTER_OVERFLOW_LENGTH", ";", "i", "++", ")", "{", "counter", "[", "i", "]", "++", ";", "if", "(", "counter", "[", "i", "]", "!=", "(", "byte", ")", "0x00", ")", "{", "break", ";", "}", "}", "if", "(", "i", "==", "COUNTER_OVERFLOW_LENGTH", ")", "{", "// Restore old counter value to ensure that encrypt and decrypt keep failing.", "System", ".", "arraycopy", "(", "oldCounter", ",", "0", ",", "counter", ",", "0", ",", "counter", ".", "length", ")", ";", "throw", "new", "GeneralSecurityException", "(", "\"Counter has overflowed.\"", ")", ";", "}", "}" ]
Increments {@code counter}, store the unincremented value in {@code oldCounter}.
[ "Increments", "{" ]
train
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/alts/src/main/java/io/grpc/alts/internal/AltsChannelCrypter.java#L127-L142
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/coll/CollationBuilder.java
CollationBuilder.findOrInsertNodeForCEs
private int findOrInsertNodeForCEs(int strength) { """ Picks one of the current CEs and finds or inserts a node in the graph for the CE + strength. """ assert(Collator.PRIMARY <= strength && strength <= Collator.QUATERNARY); // Find the last CE that is at least as "strong" as the requested difference. // Note: Stronger is smaller (Collator.PRIMARY=0). long ce; for(;; --cesLength) { if(cesLength == 0) { ce = ces[0] = 0; cesLength = 1; break; } else { ce = ces[cesLength - 1]; } if(ceStrength(ce) <= strength) { break; } } if(isTempCE(ce)) { // No need to findCommonNode() here for lower levels // because insertTailoredNodeAfter() will do that anyway. return indexFromTempCE(ce); } // root CE if((int)(ce >>> 56) == Collation.UNASSIGNED_IMPLICIT_BYTE) { throw new UnsupportedOperationException( "tailoring relative to an unassigned code point not supported"); } return findOrInsertNodeForRootCE(ce, strength); }
java
private int findOrInsertNodeForCEs(int strength) { assert(Collator.PRIMARY <= strength && strength <= Collator.QUATERNARY); // Find the last CE that is at least as "strong" as the requested difference. // Note: Stronger is smaller (Collator.PRIMARY=0). long ce; for(;; --cesLength) { if(cesLength == 0) { ce = ces[0] = 0; cesLength = 1; break; } else { ce = ces[cesLength - 1]; } if(ceStrength(ce) <= strength) { break; } } if(isTempCE(ce)) { // No need to findCommonNode() here for lower levels // because insertTailoredNodeAfter() will do that anyway. return indexFromTempCE(ce); } // root CE if((int)(ce >>> 56) == Collation.UNASSIGNED_IMPLICIT_BYTE) { throw new UnsupportedOperationException( "tailoring relative to an unassigned code point not supported"); } return findOrInsertNodeForRootCE(ce, strength); }
[ "private", "int", "findOrInsertNodeForCEs", "(", "int", "strength", ")", "{", "assert", "(", "Collator", ".", "PRIMARY", "<=", "strength", "&&", "strength", "<=", "Collator", ".", "QUATERNARY", ")", ";", "// Find the last CE that is at least as \"strong\" as the requested difference.", "// Note: Stronger is smaller (Collator.PRIMARY=0).", "long", "ce", ";", "for", "(", ";", ";", "--", "cesLength", ")", "{", "if", "(", "cesLength", "==", "0", ")", "{", "ce", "=", "ces", "[", "0", "]", "=", "0", ";", "cesLength", "=", "1", ";", "break", ";", "}", "else", "{", "ce", "=", "ces", "[", "cesLength", "-", "1", "]", ";", "}", "if", "(", "ceStrength", "(", "ce", ")", "<=", "strength", ")", "{", "break", ";", "}", "}", "if", "(", "isTempCE", "(", "ce", ")", ")", "{", "// No need to findCommonNode() here for lower levels", "// because insertTailoredNodeAfter() will do that anyway.", "return", "indexFromTempCE", "(", "ce", ")", ";", "}", "// root CE", "if", "(", "(", "int", ")", "(", "ce", ">>>", "56", ")", "==", "Collation", ".", "UNASSIGNED_IMPLICIT_BYTE", ")", "{", "throw", "new", "UnsupportedOperationException", "(", "\"tailoring relative to an unassigned code point not supported\"", ")", ";", "}", "return", "findOrInsertNodeForRootCE", "(", "ce", ",", "strength", ")", ";", "}" ]
Picks one of the current CEs and finds or inserts a node in the graph for the CE + strength.
[ "Picks", "one", "of", "the", "current", "CEs", "and", "finds", "or", "inserts", "a", "node", "in", "the", "graph", "for", "the", "CE", "+", "strength", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/coll/CollationBuilder.java#L532-L561
IBM/ibm-cos-sdk-java
ibm-cos-java-sdk-s3/src/main/java/com/ibm/cloud/objectstorage/services/aspera/transfer/AsperaTransferManager.java
AsperaTransferManager.uploadDirectory
public Future<AsperaTransaction> uploadDirectory(String bucketName, String virtualDirectoryKeyPrefix, File directory, boolean includeSubdirectories, AsperaConfig sessionDetails, ProgressListener progressListener) { """ Subdirectories are included in the upload by default, to exclude ensure you pass through 'false' for includeSubdirectories param @param bucketName @param virtualDirectoryKeyPrefix @param directory @param includeSubdirectories @param sessionDetails @return """ log.trace("AsperaTransferManager.uploadDirectory >> Starting Upload " + System.nanoTime()); checkAscpThreshold(); // Destination bucket and source path must be specified if (bucketName == null || bucketName.isEmpty()) throw new SdkClientException("Bucket name has not been specified for upload"); if (directory == null || !directory.exists()) throw new SdkClientException("localFileName has not been specified for upload"); if (virtualDirectoryKeyPrefix == null || virtualDirectoryKeyPrefix.isEmpty()) throw new SdkClientException("remoteFileName has not been specified for upload"); // Submit upload to thread pool AsperaUploadDirectoryCallable uploadDirectoryCallable = new AsperaUploadDirectoryCallable(this, bucketName, directory, virtualDirectoryKeyPrefix, sessionDetails, includeSubdirectories, progressListener); Future<AsperaTransaction> asperaTransaction = executorService.submit(uploadDirectoryCallable); log.trace("AsperaTransferManager.uploadDirectory << Ending Upload " + System.nanoTime()); // Return AsperaTransaction return asperaTransaction; }
java
public Future<AsperaTransaction> uploadDirectory(String bucketName, String virtualDirectoryKeyPrefix, File directory, boolean includeSubdirectories, AsperaConfig sessionDetails, ProgressListener progressListener) { log.trace("AsperaTransferManager.uploadDirectory >> Starting Upload " + System.nanoTime()); checkAscpThreshold(); // Destination bucket and source path must be specified if (bucketName == null || bucketName.isEmpty()) throw new SdkClientException("Bucket name has not been specified for upload"); if (directory == null || !directory.exists()) throw new SdkClientException("localFileName has not been specified for upload"); if (virtualDirectoryKeyPrefix == null || virtualDirectoryKeyPrefix.isEmpty()) throw new SdkClientException("remoteFileName has not been specified for upload"); // Submit upload to thread pool AsperaUploadDirectoryCallable uploadDirectoryCallable = new AsperaUploadDirectoryCallable(this, bucketName, directory, virtualDirectoryKeyPrefix, sessionDetails, includeSubdirectories, progressListener); Future<AsperaTransaction> asperaTransaction = executorService.submit(uploadDirectoryCallable); log.trace("AsperaTransferManager.uploadDirectory << Ending Upload " + System.nanoTime()); // Return AsperaTransaction return asperaTransaction; }
[ "public", "Future", "<", "AsperaTransaction", ">", "uploadDirectory", "(", "String", "bucketName", ",", "String", "virtualDirectoryKeyPrefix", ",", "File", "directory", ",", "boolean", "includeSubdirectories", ",", "AsperaConfig", "sessionDetails", ",", "ProgressListener", "progressListener", ")", "{", "log", ".", "trace", "(", "\"AsperaTransferManager.uploadDirectory >> Starting Upload \"", "+", "System", ".", "nanoTime", "(", ")", ")", ";", "checkAscpThreshold", "(", ")", ";", "// Destination bucket and source path must be specified", "if", "(", "bucketName", "==", "null", "||", "bucketName", ".", "isEmpty", "(", ")", ")", "throw", "new", "SdkClientException", "(", "\"Bucket name has not been specified for upload\"", ")", ";", "if", "(", "directory", "==", "null", "||", "!", "directory", ".", "exists", "(", ")", ")", "throw", "new", "SdkClientException", "(", "\"localFileName has not been specified for upload\"", ")", ";", "if", "(", "virtualDirectoryKeyPrefix", "==", "null", "||", "virtualDirectoryKeyPrefix", ".", "isEmpty", "(", ")", ")", "throw", "new", "SdkClientException", "(", "\"remoteFileName has not been specified for upload\"", ")", ";", "// Submit upload to thread pool", "AsperaUploadDirectoryCallable", "uploadDirectoryCallable", "=", "new", "AsperaUploadDirectoryCallable", "(", "this", ",", "bucketName", ",", "directory", ",", "virtualDirectoryKeyPrefix", ",", "sessionDetails", ",", "includeSubdirectories", ",", "progressListener", ")", ";", "Future", "<", "AsperaTransaction", ">", "asperaTransaction", "=", "executorService", ".", "submit", "(", "uploadDirectoryCallable", ")", ";", "log", ".", "trace", "(", "\"AsperaTransferManager.uploadDirectory << Ending Upload \"", "+", "System", ".", "nanoTime", "(", ")", ")", ";", "// Return AsperaTransaction", "return", "asperaTransaction", ";", "}" ]
Subdirectories are included in the upload by default, to exclude ensure you pass through 'false' for includeSubdirectories param @param bucketName @param virtualDirectoryKeyPrefix @param directory @param includeSubdirectories @param sessionDetails @return
[ "Subdirectories", "are", "included", "in", "the", "upload", "by", "default", "to", "exclude", "ensure", "you", "pass", "through", "false", "for", "includeSubdirectories", "param" ]
train
https://github.com/IBM/ibm-cos-sdk-java/blob/d0bb2dd754c328a05e7dba8dc42e28b271b6daf2/ibm-cos-java-sdk-s3/src/main/java/com/ibm/cloud/objectstorage/services/aspera/transfer/AsperaTransferManager.java#L253-L275
kuali/ojb-1.0.4
src/xdoclet/java/src/xdoclet/modules/ojb/constraints/InheritanceHelper.java
InheritanceHelper.isSameOrSubTypeOf
public boolean isSameOrSubTypeOf(String type, String baseType) throws ClassNotFoundException { """ Determines whether the given type is the same or a sub type of the other type. @param type The type @param baseType The possible base type @return <code>true</code> If <code>type</code> specifies the same or a sub type of <code>baseType</code> @throws ClassNotFoundException If the two classes are not on the classpath """ return type.replace('$', '.').equals(baseType.replace('$', '.')) ? true : isSameOrSubTypeOf(getClass(type), baseType); }
java
public boolean isSameOrSubTypeOf(String type, String baseType) throws ClassNotFoundException { return type.replace('$', '.').equals(baseType.replace('$', '.')) ? true : isSameOrSubTypeOf(getClass(type), baseType); }
[ "public", "boolean", "isSameOrSubTypeOf", "(", "String", "type", ",", "String", "baseType", ")", "throws", "ClassNotFoundException", "{", "return", "type", ".", "replace", "(", "'", "'", ",", "'", "'", ")", ".", "equals", "(", "baseType", ".", "replace", "(", "'", "'", ",", "'", "'", ")", ")", "?", "true", ":", "isSameOrSubTypeOf", "(", "getClass", "(", "type", ")", ",", "baseType", ")", ";", "}" ]
Determines whether the given type is the same or a sub type of the other type. @param type The type @param baseType The possible base type @return <code>true</code> If <code>type</code> specifies the same or a sub type of <code>baseType</code> @throws ClassNotFoundException If the two classes are not on the classpath
[ "Determines", "whether", "the", "given", "type", "is", "the", "same", "or", "a", "sub", "type", "of", "the", "other", "type", "." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/xdoclet/java/src/xdoclet/modules/ojb/constraints/InheritanceHelper.java#L134-L137
sjamesr/jfreesane
src/main/java/au/com/southsky/jfreesane/SaneWord.java
SaneWord.forSaneVersion
public static SaneWord forSaneVersion(int major, int minor, int build) { """ Returns a new {@code SaneWord} representing the given SANE version. @param major the SANE major version @param minor the SANE minor version @param build the SANE build identifier """ int result = (major & 0xff) << 24; result |= (minor & 0xff) << 16; result |= (build & 0xffff) << 0; return forInt(result); }
java
public static SaneWord forSaneVersion(int major, int minor, int build) { int result = (major & 0xff) << 24; result |= (minor & 0xff) << 16; result |= (build & 0xffff) << 0; return forInt(result); }
[ "public", "static", "SaneWord", "forSaneVersion", "(", "int", "major", ",", "int", "minor", ",", "int", "build", ")", "{", "int", "result", "=", "(", "major", "&", "0xff", ")", "<<", "24", ";", "result", "|=", "(", "minor", "&", "0xff", ")", "<<", "16", ";", "result", "|=", "(", "build", "&", "0xffff", ")", "<<", "0", ";", "return", "forInt", "(", "result", ")", ";", "}" ]
Returns a new {@code SaneWord} representing the given SANE version. @param major the SANE major version @param minor the SANE minor version @param build the SANE build identifier
[ "Returns", "a", "new", "{", "@code", "SaneWord", "}", "representing", "the", "given", "SANE", "version", "." ]
train
https://github.com/sjamesr/jfreesane/blob/15ad0f73df0a8d0efec5167a2141cbd53afd862d/src/main/java/au/com/southsky/jfreesane/SaneWord.java#L102-L107
couchbase/couchbase-java-client
src/main/java/com/couchbase/client/java/query/dsl/functions/ArrayFunctions.java
ArrayFunctions.arrayReplace
public static Expression arrayReplace(String expression, Expression value1, Expression value2, long n) { """ Returned expression results in new array with at most n occurrences of value1 replaced with value2. """ return arrayReplace(x(expression), value1, value2, n); }
java
public static Expression arrayReplace(String expression, Expression value1, Expression value2, long n) { return arrayReplace(x(expression), value1, value2, n); }
[ "public", "static", "Expression", "arrayReplace", "(", "String", "expression", ",", "Expression", "value1", ",", "Expression", "value2", ",", "long", "n", ")", "{", "return", "arrayReplace", "(", "x", "(", "expression", ")", ",", "value1", ",", "value2", ",", "n", ")", ";", "}" ]
Returned expression results in new array with at most n occurrences of value1 replaced with value2.
[ "Returned", "expression", "results", "in", "new", "array", "with", "at", "most", "n", "occurrences", "of", "value1", "replaced", "with", "value2", "." ]
train
https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/functions/ArrayFunctions.java#L424-L426
aws/aws-sdk-java
aws-java-sdk-resourcegroups/src/main/java/com/amazonaws/services/resourcegroups/model/CreateGroupRequest.java
CreateGroupRequest.withTags
public CreateGroupRequest withTags(java.util.Map<String, String> tags) { """ <p> The tags to add to the group. A tag is a string-to-string map of key-value pairs. Tag keys can have a maximum character length of 128 characters, and tag values can have a maximum length of 256 characters. </p> @param tags The tags to add to the group. A tag is a string-to-string map of key-value pairs. Tag keys can have a maximum character length of 128 characters, and tag values can have a maximum length of 256 characters. @return Returns a reference to this object so that method calls can be chained together. """ setTags(tags); return this; }
java
public CreateGroupRequest withTags(java.util.Map<String, String> tags) { setTags(tags); return this; }
[ "public", "CreateGroupRequest", "withTags", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "tags", ")", "{", "setTags", "(", "tags", ")", ";", "return", "this", ";", "}" ]
<p> The tags to add to the group. A tag is a string-to-string map of key-value pairs. Tag keys can have a maximum character length of 128 characters, and tag values can have a maximum length of 256 characters. </p> @param tags The tags to add to the group. A tag is a string-to-string map of key-value pairs. Tag keys can have a maximum character length of 128 characters, and tag values can have a maximum length of 256 characters. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "The", "tags", "to", "add", "to", "the", "group", ".", "A", "tag", "is", "a", "string", "-", "to", "-", "string", "map", "of", "key", "-", "value", "pairs", ".", "Tag", "keys", "can", "have", "a", "maximum", "character", "length", "of", "128", "characters", "and", "tag", "values", "can", "have", "a", "maximum", "length", "of", "256", "characters", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-resourcegroups/src/main/java/com/amazonaws/services/resourcegroups/model/CreateGroupRequest.java#L243-L246
udoprog/ffwd-client-java
src/main/java/com/google/protobuf250/CodedInputStream.java
CodedInputStream.newInstance
public static CodedInputStream newInstance(final byte[] buf, final int off, final int len) { """ Create a new CodedInputStream wrapping the given byte array slice. """ CodedInputStream result = new CodedInputStream(buf, off, len); try { // Some uses of CodedInputStream can be more efficient if they know // exactly how many bytes are available. By pushing the end point of the // buffer as a limit, we allow them to get this information via // getBytesUntilLimit(). Pushing a limit that we know is at the end of // the stream can never hurt, since we can never past that point anyway. result.pushLimit(len); } catch (InvalidProtocolBufferException ex) { // The only reason pushLimit() might throw an exception here is if len // is negative. Normally pushLimit()'s parameter comes directly off the // wire, so it's important to catch exceptions in case of corrupt or // malicious data. However, in this case, we expect that len is not a // user-supplied value, so we can assume that it being negative indicates // a programming error. Therefore, throwing an unchecked exception is // appropriate. throw new IllegalArgumentException(ex); } return result; }
java
public static CodedInputStream newInstance(final byte[] buf, final int off, final int len) { CodedInputStream result = new CodedInputStream(buf, off, len); try { // Some uses of CodedInputStream can be more efficient if they know // exactly how many bytes are available. By pushing the end point of the // buffer as a limit, we allow them to get this information via // getBytesUntilLimit(). Pushing a limit that we know is at the end of // the stream can never hurt, since we can never past that point anyway. result.pushLimit(len); } catch (InvalidProtocolBufferException ex) { // The only reason pushLimit() might throw an exception here is if len // is negative. Normally pushLimit()'s parameter comes directly off the // wire, so it's important to catch exceptions in case of corrupt or // malicious data. However, in this case, we expect that len is not a // user-supplied value, so we can assume that it being negative indicates // a programming error. Therefore, throwing an unchecked exception is // appropriate. throw new IllegalArgumentException(ex); } return result; }
[ "public", "static", "CodedInputStream", "newInstance", "(", "final", "byte", "[", "]", "buf", ",", "final", "int", "off", ",", "final", "int", "len", ")", "{", "CodedInputStream", "result", "=", "new", "CodedInputStream", "(", "buf", ",", "off", ",", "len", ")", ";", "try", "{", "// Some uses of CodedInputStream can be more efficient if they know", "// exactly how many bytes are available. By pushing the end point of the", "// buffer as a limit, we allow them to get this information via", "// getBytesUntilLimit(). Pushing a limit that we know is at the end of", "// the stream can never hurt, since we can never past that point anyway.", "result", ".", "pushLimit", "(", "len", ")", ";", "}", "catch", "(", "InvalidProtocolBufferException", "ex", ")", "{", "// The only reason pushLimit() might throw an exception here is if len", "// is negative. Normally pushLimit()'s parameter comes directly off the", "// wire, so it's important to catch exceptions in case of corrupt or", "// malicious data. However, in this case, we expect that len is not a", "// user-supplied value, so we can assume that it being negative indicates", "// a programming error. Therefore, throwing an unchecked exception is", "// appropriate.", "throw", "new", "IllegalArgumentException", "(", "ex", ")", ";", "}", "return", "result", ";", "}" ]
Create a new CodedInputStream wrapping the given byte array slice.
[ "Create", "a", "new", "CodedInputStream", "wrapping", "the", "given", "byte", "array", "slice", "." ]
train
https://github.com/udoprog/ffwd-client-java/blob/b4161d2b138e3edb8fa9420cc3cc653d5764cf5b/src/main/java/com/google/protobuf250/CodedInputStream.java#L68-L89
wildfly/wildfly-core
patching/src/main/java/org/jboss/as/patching/runner/IdentityPatchRunner.java
IdentityPatchRunner.checkUpgradeConditions
static void checkUpgradeConditions(final UpgradeCondition condition, final InstallationManager.MutablePatchingTarget target) throws PatchingException { """ Check whether the patch can be applied to a given target. @param condition the conditions @param target the target @throws PatchingException """ // See if the prerequisites are met for (final String required : condition.getRequires()) { if (!target.isApplied(required)) { throw PatchLogger.ROOT_LOGGER.requiresPatch(required); } } // Check for incompatibilities for (final String incompatible : condition.getIncompatibleWith()) { if (target.isApplied(incompatible)) { throw PatchLogger.ROOT_LOGGER.incompatiblePatch(incompatible); } } }
java
static void checkUpgradeConditions(final UpgradeCondition condition, final InstallationManager.MutablePatchingTarget target) throws PatchingException { // See if the prerequisites are met for (final String required : condition.getRequires()) { if (!target.isApplied(required)) { throw PatchLogger.ROOT_LOGGER.requiresPatch(required); } } // Check for incompatibilities for (final String incompatible : condition.getIncompatibleWith()) { if (target.isApplied(incompatible)) { throw PatchLogger.ROOT_LOGGER.incompatiblePatch(incompatible); } } }
[ "static", "void", "checkUpgradeConditions", "(", "final", "UpgradeCondition", "condition", ",", "final", "InstallationManager", ".", "MutablePatchingTarget", "target", ")", "throws", "PatchingException", "{", "// See if the prerequisites are met", "for", "(", "final", "String", "required", ":", "condition", ".", "getRequires", "(", ")", ")", "{", "if", "(", "!", "target", ".", "isApplied", "(", "required", ")", ")", "{", "throw", "PatchLogger", ".", "ROOT_LOGGER", ".", "requiresPatch", "(", "required", ")", ";", "}", "}", "// Check for incompatibilities", "for", "(", "final", "String", "incompatible", ":", "condition", ".", "getIncompatibleWith", "(", ")", ")", "{", "if", "(", "target", ".", "isApplied", "(", "incompatible", ")", ")", "{", "throw", "PatchLogger", ".", "ROOT_LOGGER", ".", "incompatiblePatch", "(", "incompatible", ")", ";", "}", "}", "}" ]
Check whether the patch can be applied to a given target. @param condition the conditions @param target the target @throws PatchingException
[ "Check", "whether", "the", "patch", "can", "be", "applied", "to", "a", "given", "target", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/runner/IdentityPatchRunner.java#L769-L782
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/shapes/polyline/FitLinesToContour.java
FitLinesToContour.sanityCheckCornerOrder
boolean sanityCheckCornerOrder( int numLines, GrowQueue_I32 corners ) { """ All the corners should be in increasing order from the first anchor. """ int contourAnchor0 = corners.get(anchor0); int previous = 0; for (int i = 1; i < numLines; i++) { int contourIndex = corners.get(CircularIndex.addOffset(anchor0, i, corners.size())); int pixelsFromAnchor0 = CircularIndex.distanceP(contourAnchor0, contourIndex, contour.size()); if (pixelsFromAnchor0 < previous) { return false; } else { previous = pixelsFromAnchor0; } } return true; }
java
boolean sanityCheckCornerOrder( int numLines, GrowQueue_I32 corners ) { int contourAnchor0 = corners.get(anchor0); int previous = 0; for (int i = 1; i < numLines; i++) { int contourIndex = corners.get(CircularIndex.addOffset(anchor0, i, corners.size())); int pixelsFromAnchor0 = CircularIndex.distanceP(contourAnchor0, contourIndex, contour.size()); if (pixelsFromAnchor0 < previous) { return false; } else { previous = pixelsFromAnchor0; } } return true; }
[ "boolean", "sanityCheckCornerOrder", "(", "int", "numLines", ",", "GrowQueue_I32", "corners", ")", "{", "int", "contourAnchor0", "=", "corners", ".", "get", "(", "anchor0", ")", ";", "int", "previous", "=", "0", ";", "for", "(", "int", "i", "=", "1", ";", "i", "<", "numLines", ";", "i", "++", ")", "{", "int", "contourIndex", "=", "corners", ".", "get", "(", "CircularIndex", ".", "addOffset", "(", "anchor0", ",", "i", ",", "corners", ".", "size", "(", ")", ")", ")", ";", "int", "pixelsFromAnchor0", "=", "CircularIndex", ".", "distanceP", "(", "contourAnchor0", ",", "contourIndex", ",", "contour", ".", "size", "(", ")", ")", ";", "if", "(", "pixelsFromAnchor0", "<", "previous", ")", "{", "return", "false", ";", "}", "else", "{", "previous", "=", "pixelsFromAnchor0", ";", "}", "}", "return", "true", ";", "}" ]
All the corners should be in increasing order from the first anchor.
[ "All", "the", "corners", "should", "be", "in", "increasing", "order", "from", "the", "first", "anchor", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/shapes/polyline/FitLinesToContour.java#L157-L171
threerings/gwt-utils
src/main/java/com/threerings/gwt/util/ListenerList.java
ListenerList.removeListener
public static <L, K> void removeListener (Map<K, ListenerList<L>> map, K key, L listener) { """ Removes a listener from the supplied list in the supplied map. """ ListenerList<L> list = map.get(key); if (list != null) { list.remove(listener); } }
java
public static <L, K> void removeListener (Map<K, ListenerList<L>> map, K key, L listener) { ListenerList<L> list = map.get(key); if (list != null) { list.remove(listener); } }
[ "public", "static", "<", "L", ",", "K", ">", "void", "removeListener", "(", "Map", "<", "K", ",", "ListenerList", "<", "L", ">", ">", "map", ",", "K", "key", ",", "L", "listener", ")", "{", "ListenerList", "<", "L", ">", "list", "=", "map", ".", "get", "(", "key", ")", ";", "if", "(", "list", "!=", "null", ")", "{", "list", ".", "remove", "(", "listener", ")", ";", "}", "}" ]
Removes a listener from the supplied list in the supplied map.
[ "Removes", "a", "listener", "from", "the", "supplied", "list", "in", "the", "supplied", "map", "." ]
train
https://github.com/threerings/gwt-utils/blob/31b31a23b667f2a9c683160d77646db259f2aae5/src/main/java/com/threerings/gwt/util/ListenerList.java#L68-L74
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/io/DirectoryHelper.java
DirectoryHelper.uncompressEveryFileFromDirectory
public static void uncompressEveryFileFromDirectory(File srcPath, File dstPath) throws IOException { """ Uncompress data to the destination directory. @param srcPath path to the compressed file, could be the file or the directory @param dstPath destination path @throws IOException if any exception occurred """ if (srcPath.isDirectory()) { if (!dstPath.exists()) { dstPath.mkdirs(); } String files[] = srcPath.list(); for (int i = 0; i < files.length; i++) { uncompressEveryFileFromDirectory(new File(srcPath, files[i]), new File(dstPath, files[i])); } } else { ZipInputStream in = null; OutputStream out = null; try { in = new ZipInputStream(new FileInputStream(srcPath)); in.getNextEntry(); out = new FileOutputStream(dstPath); transfer(in, out); } finally { if (in != null) { in.close(); } if (out != null) { out.close(); } } } }
java
public static void uncompressEveryFileFromDirectory(File srcPath, File dstPath) throws IOException { if (srcPath.isDirectory()) { if (!dstPath.exists()) { dstPath.mkdirs(); } String files[] = srcPath.list(); for (int i = 0; i < files.length; i++) { uncompressEveryFileFromDirectory(new File(srcPath, files[i]), new File(dstPath, files[i])); } } else { ZipInputStream in = null; OutputStream out = null; try { in = new ZipInputStream(new FileInputStream(srcPath)); in.getNextEntry(); out = new FileOutputStream(dstPath); transfer(in, out); } finally { if (in != null) { in.close(); } if (out != null) { out.close(); } } } }
[ "public", "static", "void", "uncompressEveryFileFromDirectory", "(", "File", "srcPath", ",", "File", "dstPath", ")", "throws", "IOException", "{", "if", "(", "srcPath", ".", "isDirectory", "(", ")", ")", "{", "if", "(", "!", "dstPath", ".", "exists", "(", ")", ")", "{", "dstPath", ".", "mkdirs", "(", ")", ";", "}", "String", "files", "[", "]", "=", "srcPath", ".", "list", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "files", ".", "length", ";", "i", "++", ")", "{", "uncompressEveryFileFromDirectory", "(", "new", "File", "(", "srcPath", ",", "files", "[", "i", "]", ")", ",", "new", "File", "(", "dstPath", ",", "files", "[", "i", "]", ")", ")", ";", "}", "}", "else", "{", "ZipInputStream", "in", "=", "null", ";", "OutputStream", "out", "=", "null", ";", "try", "{", "in", "=", "new", "ZipInputStream", "(", "new", "FileInputStream", "(", "srcPath", ")", ")", ";", "in", ".", "getNextEntry", "(", ")", ";", "out", "=", "new", "FileOutputStream", "(", "dstPath", ")", ";", "transfer", "(", "in", ",", "out", ")", ";", "}", "finally", "{", "if", "(", "in", "!=", "null", ")", "{", "in", ".", "close", "(", ")", ";", "}", "if", "(", "out", "!=", "null", ")", "{", "out", ".", "close", "(", ")", ";", "}", "}", "}", "}" ]
Uncompress data to the destination directory. @param srcPath path to the compressed file, could be the file or the directory @param dstPath destination path @throws IOException if any exception occurred
[ "Uncompress", "data", "to", "the", "destination", "directory", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/io/DirectoryHelper.java#L313-L355
ops4j/org.ops4j.pax.exam2
core/pax-exam-bnd/src/main/java/org/ops4j/pax/exam/bnd/BndtoolsOption.java
BndtoolsOption.fromBndrun
public Option fromBndrun(String runFileSpec) { """ Add all bundles resolved by bndrun file to system-under-test. @param runFileSpec bndrun file to be used. @return this. """ try { File runFile = workspace.getFile(runFileSpec); Run bndRunInstruction = new Run(workspace, runFile.getParentFile(), runFile); return bndToExam(bndRunInstruction); } catch (Exception e) { throw new RuntimeException("Underlying Bnd Exception: ",e); } }
java
public Option fromBndrun(String runFileSpec) { try { File runFile = workspace.getFile(runFileSpec); Run bndRunInstruction = new Run(workspace, runFile.getParentFile(), runFile); return bndToExam(bndRunInstruction); } catch (Exception e) { throw new RuntimeException("Underlying Bnd Exception: ",e); } }
[ "public", "Option", "fromBndrun", "(", "String", "runFileSpec", ")", "{", "try", "{", "File", "runFile", "=", "workspace", ".", "getFile", "(", "runFileSpec", ")", ";", "Run", "bndRunInstruction", "=", "new", "Run", "(", "workspace", ",", "runFile", ".", "getParentFile", "(", ")", ",", "runFile", ")", ";", "return", "bndToExam", "(", "bndRunInstruction", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "RuntimeException", "(", "\"Underlying Bnd Exception: \"", ",", "e", ")", ";", "}", "}" ]
Add all bundles resolved by bndrun file to system-under-test. @param runFileSpec bndrun file to be used. @return this.
[ "Add", "all", "bundles", "resolved", "by", "bndrun", "file", "to", "system", "-", "under", "-", "test", "." ]
train
https://github.com/ops4j/org.ops4j.pax.exam2/blob/7f83796cbbb857123d8fc7fe817a7637218d5d77/core/pax-exam-bnd/src/main/java/org/ops4j/pax/exam/bnd/BndtoolsOption.java#L53-L61
NoraUi/NoraUi
src/main/java/com/github/noraui/application/steps/CommonSteps.java
CommonSteps.checkAlert
@Conditioned @Lorsque("Je vérifie l'absence d'alerte dans '(.*)'[\\.|\\?]") @Then("I check absence of alert in '(.*)'[\\.|\\?]") public void checkAlert(String page, List<GherkinStepCondition> conditions) throws FailureException, TechnicalException { """ Checks that a given page displays a html alert. This check do not work with IE: https://github.com/SeleniumHQ/selenium/issues/468 @param page The concerned page @param conditions list of 'expected' values condition and 'actual' values ({@link com.github.noraui.gherkin.GherkinStepCondition}). @throws FailureException if the scenario encounters a functional error @throws TechnicalException is throws if you have a technical error (format, configuration, datas, ...) in NoraUi. Exception with message and with screenshot and with exception if functional error but no screenshot and no exception if technical error. """ checkAlert(Page.getInstance(page)); }
java
@Conditioned @Lorsque("Je vérifie l'absence d'alerte dans '(.*)'[\\.|\\?]") @Then("I check absence of alert in '(.*)'[\\.|\\?]") public void checkAlert(String page, List<GherkinStepCondition> conditions) throws FailureException, TechnicalException { checkAlert(Page.getInstance(page)); }
[ "@", "Conditioned", "@", "Lorsque", "(", "\"Je vérifie l'absence d'alerte dans '(.*)'[\\\\.|\\\\?]\")", "\r", "@", "Then", "(", "\"I check absence of alert in '(.*)'[\\\\.|\\\\?]\"", ")", "public", "void", "checkAlert", "(", "String", "page", ",", "List", "<", "GherkinStepCondition", ">", "conditions", ")", "throws", "FailureException", ",", "TechnicalException", "{", "checkAlert", "(", "Page", ".", "getInstance", "(", "page", ")", ")", ";", "}" ]
Checks that a given page displays a html alert. This check do not work with IE: https://github.com/SeleniumHQ/selenium/issues/468 @param page The concerned page @param conditions list of 'expected' values condition and 'actual' values ({@link com.github.noraui.gherkin.GherkinStepCondition}). @throws FailureException if the scenario encounters a functional error @throws TechnicalException is throws if you have a technical error (format, configuration, datas, ...) in NoraUi. Exception with message and with screenshot and with exception if functional error but no screenshot and no exception if technical error.
[ "Checks", "that", "a", "given", "page", "displays", "a", "html", "alert", ".", "This", "check", "do", "not", "work", "with", "IE", ":", "https", ":", "//", "github", ".", "com", "/", "SeleniumHQ", "/", "selenium", "/", "issues", "/", "468" ]
train
https://github.com/NoraUi/NoraUi/blob/5f491a3339c7d3c20d7207760bdaf2acdb8f260c/src/main/java/com/github/noraui/application/steps/CommonSteps.java#L798-L803
asciidoctor/asciidoctorj
asciidoctorj-arquillian-extension/src/main/java/org/asciidoctor/arquillian/SecurityActions.java
SecurityActions.newInstance
static <T> T newInstance(final Class<T> implClass, final Class<?>[] argumentTypes, final Object[] arguments) { """ Create a new instance by finding a constructor that matches the argumentTypes signature using the arguments for instantiation. @param implClass Full classname of class to create @param argumentTypes The constructor argument types @param arguments The constructor arguments @return a new instance @throws IllegalArgumentException if className, argumentTypes, or arguments are null @throws RuntimeException if any exceptions during creation @author <a href="mailto:[email protected]">Aslak Knutsen</a> @author <a href="mailto:[email protected]">ALR</a> """ if (implClass == null) { throw new IllegalArgumentException("ImplClass must be specified"); } if (argumentTypes == null) { throw new IllegalArgumentException("ArgumentTypes must be specified. Use empty array if no arguments"); } if (arguments == null) { throw new IllegalArgumentException("Arguments must be specified. Use empty array if no arguments"); } final T obj; try { Constructor<T> constructor = getConstructor(implClass, argumentTypes); if(!constructor.isAccessible()) { constructor.setAccessible(true); } obj = constructor.newInstance(arguments); } catch (Exception e) { throw new RuntimeException("Could not create new instance of " + implClass, e); } return obj; }
java
static <T> T newInstance(final Class<T> implClass, final Class<?>[] argumentTypes, final Object[] arguments) { if (implClass == null) { throw new IllegalArgumentException("ImplClass must be specified"); } if (argumentTypes == null) { throw new IllegalArgumentException("ArgumentTypes must be specified. Use empty array if no arguments"); } if (arguments == null) { throw new IllegalArgumentException("Arguments must be specified. Use empty array if no arguments"); } final T obj; try { Constructor<T> constructor = getConstructor(implClass, argumentTypes); if(!constructor.isAccessible()) { constructor.setAccessible(true); } obj = constructor.newInstance(arguments); } catch (Exception e) { throw new RuntimeException("Could not create new instance of " + implClass, e); } return obj; }
[ "static", "<", "T", ">", "T", "newInstance", "(", "final", "Class", "<", "T", ">", "implClass", ",", "final", "Class", "<", "?", ">", "[", "]", "argumentTypes", ",", "final", "Object", "[", "]", "arguments", ")", "{", "if", "(", "implClass", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"ImplClass must be specified\"", ")", ";", "}", "if", "(", "argumentTypes", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"ArgumentTypes must be specified. Use empty array if no arguments\"", ")", ";", "}", "if", "(", "arguments", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Arguments must be specified. Use empty array if no arguments\"", ")", ";", "}", "final", "T", "obj", ";", "try", "{", "Constructor", "<", "T", ">", "constructor", "=", "getConstructor", "(", "implClass", ",", "argumentTypes", ")", ";", "if", "(", "!", "constructor", ".", "isAccessible", "(", ")", ")", "{", "constructor", ".", "setAccessible", "(", "true", ")", ";", "}", "obj", "=", "constructor", ".", "newInstance", "(", "arguments", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "RuntimeException", "(", "\"Could not create new instance of \"", "+", "implClass", ",", "e", ")", ";", "}", "return", "obj", ";", "}" ]
Create a new instance by finding a constructor that matches the argumentTypes signature using the arguments for instantiation. @param implClass Full classname of class to create @param argumentTypes The constructor argument types @param arguments The constructor arguments @return a new instance @throws IllegalArgumentException if className, argumentTypes, or arguments are null @throws RuntimeException if any exceptions during creation @author <a href="mailto:[email protected]">Aslak Knutsen</a> @author <a href="mailto:[email protected]">ALR</a>
[ "Create", "a", "new", "instance", "by", "finding", "a", "constructor", "that", "matches", "the", "argumentTypes", "signature", "using", "the", "arguments", "for", "instantiation", "." ]
train
https://github.com/asciidoctor/asciidoctorj/blob/e348c9a12b54c33fea7b05d70224c007e2ee75a9/asciidoctorj-arquillian-extension/src/main/java/org/asciidoctor/arquillian/SecurityActions.java#L116-L145
real-logic/agrona
agrona/src/main/java/org/agrona/IoUtil.java
IoUtil.mapExistingFile
public static MappedByteBuffer mapExistingFile( final File location, final FileChannel.MapMode mapMode, final String descriptionLabel) { """ Check that file exists, open file, and return MappedByteBuffer for entire file for a given {@link java.nio.channels.FileChannel.MapMode}. <p> The file itself will be closed, but the mapping will persist. @param location of the file to map @param mapMode for the mapping @param descriptionLabel to be associated for any exceptions @return {@link java.nio.MappedByteBuffer} for the file """ checkFileExists(location, descriptionLabel); MappedByteBuffer mappedByteBuffer = null; try (RandomAccessFile file = new RandomAccessFile(location, "rw"); FileChannel channel = file.getChannel()) { mappedByteBuffer = channel.map(mapMode, 0, channel.size()); } catch (final IOException ex) { LangUtil.rethrowUnchecked(ex); } return mappedByteBuffer; }
java
public static MappedByteBuffer mapExistingFile( final File location, final FileChannel.MapMode mapMode, final String descriptionLabel) { checkFileExists(location, descriptionLabel); MappedByteBuffer mappedByteBuffer = null; try (RandomAccessFile file = new RandomAccessFile(location, "rw"); FileChannel channel = file.getChannel()) { mappedByteBuffer = channel.map(mapMode, 0, channel.size()); } catch (final IOException ex) { LangUtil.rethrowUnchecked(ex); } return mappedByteBuffer; }
[ "public", "static", "MappedByteBuffer", "mapExistingFile", "(", "final", "File", "location", ",", "final", "FileChannel", ".", "MapMode", "mapMode", ",", "final", "String", "descriptionLabel", ")", "{", "checkFileExists", "(", "location", ",", "descriptionLabel", ")", ";", "MappedByteBuffer", "mappedByteBuffer", "=", "null", ";", "try", "(", "RandomAccessFile", "file", "=", "new", "RandomAccessFile", "(", "location", ",", "\"rw\"", ")", ";", "FileChannel", "channel", "=", "file", ".", "getChannel", "(", ")", ")", "{", "mappedByteBuffer", "=", "channel", ".", "map", "(", "mapMode", ",", "0", ",", "channel", ".", "size", "(", ")", ")", ";", "}", "catch", "(", "final", "IOException", "ex", ")", "{", "LangUtil", ".", "rethrowUnchecked", "(", "ex", ")", ";", "}", "return", "mappedByteBuffer", ";", "}" ]
Check that file exists, open file, and return MappedByteBuffer for entire file for a given {@link java.nio.channels.FileChannel.MapMode}. <p> The file itself will be closed, but the mapping will persist. @param location of the file to map @param mapMode for the mapping @param descriptionLabel to be associated for any exceptions @return {@link java.nio.MappedByteBuffer} for the file
[ "Check", "that", "file", "exists", "open", "file", "and", "return", "MappedByteBuffer", "for", "entire", "file", "for", "a", "given", "{", "@link", "java", ".", "nio", ".", "channels", ".", "FileChannel", ".", "MapMode", "}", ".", "<p", ">", "The", "file", "itself", "will", "be", "closed", "but", "the", "mapping", "will", "persist", "." ]
train
https://github.com/real-logic/agrona/blob/d1ea76e6e3598cd6a0d34879687652ef123f639b/agrona/src/main/java/org/agrona/IoUtil.java#L314-L333
vRallev/ECC-25519
ECC-25519-Java/src/main/java/djb/Curve25519.java
Curve25519.mont_add
private static final void mont_add(long10 t1, long10 t2, long10 t3, long10 t4,long10 ax, long10 az, long10 dx) { """ /* A = P + Q where X(A) = ax/az X(P) = (t1+t2)/(t1-t2) X(Q) = (t3+t4)/(t3-t4) X(P-Q) = dx clobbers t1 and t2, preserves t3 and t4 """ mul(ax, t2, t3); mul(az, t1, t4); add(t1, ax, az); sub(t2, ax, az); sqr(ax, t1); sqr(t1, t2); mul(az, t1, dx); }
java
private static final void mont_add(long10 t1, long10 t2, long10 t3, long10 t4,long10 ax, long10 az, long10 dx) { mul(ax, t2, t3); mul(az, t1, t4); add(t1, ax, az); sub(t2, ax, az); sqr(ax, t1); sqr(t1, t2); mul(az, t1, dx); }
[ "private", "static", "final", "void", "mont_add", "(", "long10", "t1", ",", "long10", "t2", ",", "long10", "t3", ",", "long10", "t4", ",", "long10", "ax", ",", "long10", "az", ",", "long10", "dx", ")", "{", "mul", "(", "ax", ",", "t2", ",", "t3", ")", ";", "mul", "(", "az", ",", "t1", ",", "t4", ")", ";", "add", "(", "t1", ",", "ax", ",", "az", ")", ";", "sub", "(", "t2", ",", "ax", ",", "az", ")", ";", "sqr", "(", "ax", ",", "t1", ")", ";", "sqr", "(", "t1", ",", "t2", ")", ";", "mul", "(", "az", ",", "t1", ",", "dx", ")", ";", "}" ]
/* A = P + Q where X(A) = ax/az X(P) = (t1+t2)/(t1-t2) X(Q) = (t3+t4)/(t3-t4) X(P-Q) = dx clobbers t1 and t2, preserves t3 and t4
[ "/", "*", "A", "=", "P", "+", "Q", "where", "X", "(", "A", ")", "=", "ax", "/", "az", "X", "(", "P", ")", "=", "(", "t1", "+", "t2", ")", "/", "(", "t1", "-", "t2", ")", "X", "(", "Q", ")", "=", "(", "t3", "+", "t4", ")", "/", "(", "t3", "-", "t4", ")", "X", "(", "P", "-", "Q", ")", "=", "dx", "clobbers", "t1", "and", "t2", "preserves", "t3", "and", "t4" ]
train
https://github.com/vRallev/ECC-25519/blob/5c4297933aabfa4fbe7675e36d6d923ffd22e2cb/ECC-25519-Java/src/main/java/djb/Curve25519.java#L777-L785
duracloud/duracloud
irodsstorageprovider/src/main/java/org/duracloud/irodsstorage/IrodsStorageProvider.java
IrodsStorageProvider.createSpace
@Override public void createSpace(String spaceId) { """ Create a new directory under the baseDirectory @param spaceId """ ConnectOperation co = new ConnectOperation(host, port, username, password, zone); try { IrodsOperations io = new IrodsOperations(co); io.mkdir(baseDirectory + "/" + spaceId); log.trace("Created space/directory: " + baseDirectory + "/" + spaceId); } catch (IOException e) { log.error("Could not connect to iRODS", e); throw new StorageException(e); } }
java
@Override public void createSpace(String spaceId) { ConnectOperation co = new ConnectOperation(host, port, username, password, zone); try { IrodsOperations io = new IrodsOperations(co); io.mkdir(baseDirectory + "/" + spaceId); log.trace("Created space/directory: " + baseDirectory + "/" + spaceId); } catch (IOException e) { log.error("Could not connect to iRODS", e); throw new StorageException(e); } }
[ "@", "Override", "public", "void", "createSpace", "(", "String", "spaceId", ")", "{", "ConnectOperation", "co", "=", "new", "ConnectOperation", "(", "host", ",", "port", ",", "username", ",", "password", ",", "zone", ")", ";", "try", "{", "IrodsOperations", "io", "=", "new", "IrodsOperations", "(", "co", ")", ";", "io", ".", "mkdir", "(", "baseDirectory", "+", "\"/\"", "+", "spaceId", ")", ";", "log", ".", "trace", "(", "\"Created space/directory: \"", "+", "baseDirectory", "+", "\"/\"", "+", "spaceId", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "log", ".", "error", "(", "\"Could not connect to iRODS\"", ",", "e", ")", ";", "throw", "new", "StorageException", "(", "e", ")", ";", "}", "}" ]
Create a new directory under the baseDirectory @param spaceId
[ "Create", "a", "new", "directory", "under", "the", "baseDirectory" ]
train
https://github.com/duracloud/duracloud/blob/dc4f3a1716d43543cc3b2e1880605f9389849b66/irodsstorageprovider/src/main/java/org/duracloud/irodsstorage/IrodsStorageProvider.java#L234-L247
jpush/jmessage-api-java-client
src/main/java/cn/jmessage/api/JMessageClient.java
JMessageClient.addBlackList
public ResponseWrapper addBlackList(String username, String...users) throws APIConnectionException, APIRequestException { """ Add Users to black list @param username The owner of the black list @param users The users that will add to black list @return add users to black list @throws APIConnectionException connect exception @throws APIRequestException request exception """ return _userClient.addBlackList(username, users); }
java
public ResponseWrapper addBlackList(String username, String...users) throws APIConnectionException, APIRequestException { return _userClient.addBlackList(username, users); }
[ "public", "ResponseWrapper", "addBlackList", "(", "String", "username", ",", "String", "...", "users", ")", "throws", "APIConnectionException", ",", "APIRequestException", "{", "return", "_userClient", ".", "addBlackList", "(", "username", ",", "users", ")", ";", "}" ]
Add Users to black list @param username The owner of the black list @param users The users that will add to black list @return add users to black list @throws APIConnectionException connect exception @throws APIRequestException request exception
[ "Add", "Users", "to", "black", "list" ]
train
https://github.com/jpush/jmessage-api-java-client/blob/767f5fb15e9fe5a546c00f6e68b64f6dd53c617c/src/main/java/cn/jmessage/api/JMessageClient.java#L241-L244
krummas/DrizzleJDBC
src/main/java/org/drizzle/jdbc/DrizzlePreparedStatement.java
DrizzlePreparedStatement.setBytes
public void setBytes(final int parameterIndex, final byte[] x) throws SQLException { """ Sets the designated parameter to the given Java array of bytes. The driver converts this to an SQL <code>VARBINARY</code> or <code>LONGVARBINARY</code> (depending on the argument's size relative to the driver's limits on <code>VARBINARY</code> values) when it sends it to the database. @param parameterIndex the first parameter is 1, the second is 2, ... @param x the parameter value @throws java.sql.SQLException if parameterIndex does not correspond to a parameter marker in the SQL statement; if a database access error occurs or this method is called on a closed <code>PreparedStatement</code> """ if(x == null) { setNull(parameterIndex, Types.BLOB); return; } setParameter(parameterIndex, new ByteParameter(x)); }
java
public void setBytes(final int parameterIndex, final byte[] x) throws SQLException { if(x == null) { setNull(parameterIndex, Types.BLOB); return; } setParameter(parameterIndex, new ByteParameter(x)); }
[ "public", "void", "setBytes", "(", "final", "int", "parameterIndex", ",", "final", "byte", "[", "]", "x", ")", "throws", "SQLException", "{", "if", "(", "x", "==", "null", ")", "{", "setNull", "(", "parameterIndex", ",", "Types", ".", "BLOB", ")", ";", "return", ";", "}", "setParameter", "(", "parameterIndex", ",", "new", "ByteParameter", "(", "x", ")", ")", ";", "}" ]
Sets the designated parameter to the given Java array of bytes. The driver converts this to an SQL <code>VARBINARY</code> or <code>LONGVARBINARY</code> (depending on the argument's size relative to the driver's limits on <code>VARBINARY</code> values) when it sends it to the database. @param parameterIndex the first parameter is 1, the second is 2, ... @param x the parameter value @throws java.sql.SQLException if parameterIndex does not correspond to a parameter marker in the SQL statement; if a database access error occurs or this method is called on a closed <code>PreparedStatement</code>
[ "Sets", "the", "designated", "parameter", "to", "the", "given", "Java", "array", "of", "bytes", ".", "The", "driver", "converts", "this", "to", "an", "SQL", "<code", ">", "VARBINARY<", "/", "code", ">", "or", "<code", ">", "LONGVARBINARY<", "/", "code", ">", "(", "depending", "on", "the", "argument", "s", "size", "relative", "to", "the", "driver", "s", "limits", "on", "<code", ">", "VARBINARY<", "/", "code", ">", "values", ")", "when", "it", "sends", "it", "to", "the", "database", "." ]
train
https://github.com/krummas/DrizzleJDBC/blob/716f31fd71f3cc289edf69844d8117deb86d98d6/src/main/java/org/drizzle/jdbc/DrizzlePreparedStatement.java#L1110-L1117
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/alg/geo/MultiViewOps.java
MultiViewOps.projectiveToIdentityH
public static void projectiveToIdentityH(DMatrixRMaj P , DMatrixRMaj H ) { """ Finds the transform such that P*H = [I|0] where P is a 3x4 projective camera matrix and H is a 4x4 matrix @param P (Input) camera matrix 3x4 @param H (Output) 4x4 matrix """ ProjectiveToIdentity alg = new ProjectiveToIdentity(); if( !alg.process(P)) throw new RuntimeException("WTF this failed?? Probably NaN in P"); alg.computeH(H); }
java
public static void projectiveToIdentityH(DMatrixRMaj P , DMatrixRMaj H ) { ProjectiveToIdentity alg = new ProjectiveToIdentity(); if( !alg.process(P)) throw new RuntimeException("WTF this failed?? Probably NaN in P"); alg.computeH(H); }
[ "public", "static", "void", "projectiveToIdentityH", "(", "DMatrixRMaj", "P", ",", "DMatrixRMaj", "H", ")", "{", "ProjectiveToIdentity", "alg", "=", "new", "ProjectiveToIdentity", "(", ")", ";", "if", "(", "!", "alg", ".", "process", "(", "P", ")", ")", "throw", "new", "RuntimeException", "(", "\"WTF this failed?? Probably NaN in P\"", ")", ";", "alg", ".", "computeH", "(", "H", ")", ";", "}" ]
Finds the transform such that P*H = [I|0] where P is a 3x4 projective camera matrix and H is a 4x4 matrix @param P (Input) camera matrix 3x4 @param H (Output) 4x4 matrix
[ "Finds", "the", "transform", "such", "that", "P", "*", "H", "=", "[", "I|0", "]", "where", "P", "is", "a", "3x4", "projective", "camera", "matrix", "and", "H", "is", "a", "4x4", "matrix" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/MultiViewOps.java#L1005-L1010
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/StylesheetHandler.java
StylesheetHandler.getNamespaceForPrefix
public String getNamespaceForPrefix(String prefix, org.w3c.dom.Node context) { """ Given a namespace, get the corrisponding prefix. This is here only to support the {@link org.apache.xml.utils.PrefixResolver} interface, and will throw an error if invoked on this object. @param prefix The prefix to look up, which may be an empty string ("") for the default Namespace. @param context The node context from which to look up the URI. @return The associated Namespace URI, or null if the prefix is undeclared in this context. """ // Don't need to support this here. Return the current URI for the prefix, // ignoring the context. assertion(true, "can't process a context node in StylesheetHandler!"); return null; }
java
public String getNamespaceForPrefix(String prefix, org.w3c.dom.Node context) { // Don't need to support this here. Return the current URI for the prefix, // ignoring the context. assertion(true, "can't process a context node in StylesheetHandler!"); return null; }
[ "public", "String", "getNamespaceForPrefix", "(", "String", "prefix", ",", "org", ".", "w3c", ".", "dom", ".", "Node", "context", ")", "{", "// Don't need to support this here. Return the current URI for the prefix,", "// ignoring the context.", "assertion", "(", "true", ",", "\"can't process a context node in StylesheetHandler!\"", ")", ";", "return", "null", ";", "}" ]
Given a namespace, get the corrisponding prefix. This is here only to support the {@link org.apache.xml.utils.PrefixResolver} interface, and will throw an error if invoked on this object. @param prefix The prefix to look up, which may be an empty string ("") for the default Namespace. @param context The node context from which to look up the URI. @return The associated Namespace URI, or null if the prefix is undeclared in this context.
[ "Given", "a", "namespace", "get", "the", "corrisponding", "prefix", ".", "This", "is", "here", "only", "to", "support", "the", "{", "@link", "org", ".", "apache", ".", "xml", ".", "utils", ".", "PrefixResolver", "}", "interface", "and", "will", "throw", "an", "error", "if", "invoked", "on", "this", "object", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/StylesheetHandler.java#L208-L216
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/filter/Filter.java
Filter.disjunctiveNormalFormSplit
public List<Filter<S>> disjunctiveNormalFormSplit() { """ Splits the filter from its disjunctive normal form. Or'ng the filters together produces the full disjunctive normal form. @return unmodifiable list of sub filters which don't perform any 'or' operations @since 1.1.1 """ final List<Filter<S>> list = new ArrayList<Filter<S>>(); disjunctiveNormalForm().accept(new Visitor<S, Object, Object>() { @Override public Object visit(AndFilter<S> filter, Object param) { list.add(filter); return null; } @Override public Object visit(PropertyFilter<S> filter, Object param) { list.add(filter); return null; } @Override public Object visit(ExistsFilter<S> filter, Object param) { list.add(filter); return null; } }, null); return Collections.unmodifiableList(list); }
java
public List<Filter<S>> disjunctiveNormalFormSplit() { final List<Filter<S>> list = new ArrayList<Filter<S>>(); disjunctiveNormalForm().accept(new Visitor<S, Object, Object>() { @Override public Object visit(AndFilter<S> filter, Object param) { list.add(filter); return null; } @Override public Object visit(PropertyFilter<S> filter, Object param) { list.add(filter); return null; } @Override public Object visit(ExistsFilter<S> filter, Object param) { list.add(filter); return null; } }, null); return Collections.unmodifiableList(list); }
[ "public", "List", "<", "Filter", "<", "S", ">", ">", "disjunctiveNormalFormSplit", "(", ")", "{", "final", "List", "<", "Filter", "<", "S", ">", ">", "list", "=", "new", "ArrayList", "<", "Filter", "<", "S", ">", ">", "(", ")", ";", "disjunctiveNormalForm", "(", ")", ".", "accept", "(", "new", "Visitor", "<", "S", ",", "Object", ",", "Object", ">", "(", ")", "{", "@", "Override", "public", "Object", "visit", "(", "AndFilter", "<", "S", ">", "filter", ",", "Object", "param", ")", "{", "list", ".", "add", "(", "filter", ")", ";", "return", "null", ";", "}", "@", "Override", "public", "Object", "visit", "(", "PropertyFilter", "<", "S", ">", "filter", ",", "Object", "param", ")", "{", "list", ".", "add", "(", "filter", ")", ";", "return", "null", ";", "}", "@", "Override", "public", "Object", "visit", "(", "ExistsFilter", "<", "S", ">", "filter", ",", "Object", "param", ")", "{", "list", ".", "add", "(", "filter", ")", ";", "return", "null", ";", "}", "}", ",", "null", ")", ";", "return", "Collections", ".", "unmodifiableList", "(", "list", ")", ";", "}" ]
Splits the filter from its disjunctive normal form. Or'ng the filters together produces the full disjunctive normal form. @return unmodifiable list of sub filters which don't perform any 'or' operations @since 1.1.1
[ "Splits", "the", "filter", "from", "its", "disjunctive", "normal", "form", ".", "Or", "ng", "the", "filters", "together", "produces", "the", "full", "disjunctive", "normal", "form", "." ]
train
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/filter/Filter.java#L453-L477
Samsung/GearVRf
GVRf/Extensions/3DCursor/3DCursorLibrary/src/main/java/org/gearvrf/io/cursor3d/Cursor.java
Cursor.lookAt
protected void lookAt() { """ This method makes sure that the {@link Cursor} is always facing the camera. Lookat implemented using: <p/> http://mmmovania.blogspot.com/2014/03/making-opengl-object-look-at-another.html """mTempPosition.set(getPositionX(), getPositionY(), getPositionZ()); mTempPosition.negate(mDirection); Vector3f up; mDirection.normalize(); if (Math.abs(mDirection.x) < 0.00001 && Math.abs(mDirection.z) < 0.00001) { if (mDirection.y > 0) { up = new Vector3f(0.0f, 0.0f, -1.0f); // if direction points in +y } else { up = new Vector3f(0.0f, 0.0f, 1.0f); // if direction points in -y } } else { up = new Vector3f(0.0f, 1.0f, 0.0f); // y-axis is the general up } up.normalize(); Vector3f right = new Vector3f(); up.cross(mDirection, right); right.normalize(); mDirection.cross(right, up); up.normalize(); float[] matrix = new float[]{right.x, right.y, right.z, 0.0f, up.x, up.y, up.z, 0.0f, mDirection.x, mDirection.y, mDirection.z, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f}; getOwnerObject().getTransform().setModelMatrix(matrix); }
java
protected void lookAt() {mTempPosition.set(getPositionX(), getPositionY(), getPositionZ()); mTempPosition.negate(mDirection); Vector3f up; mDirection.normalize(); if (Math.abs(mDirection.x) < 0.00001 && Math.abs(mDirection.z) < 0.00001) { if (mDirection.y > 0) { up = new Vector3f(0.0f, 0.0f, -1.0f); // if direction points in +y } else { up = new Vector3f(0.0f, 0.0f, 1.0f); // if direction points in -y } } else { up = new Vector3f(0.0f, 1.0f, 0.0f); // y-axis is the general up } up.normalize(); Vector3f right = new Vector3f(); up.cross(mDirection, right); right.normalize(); mDirection.cross(right, up); up.normalize(); float[] matrix = new float[]{right.x, right.y, right.z, 0.0f, up.x, up.y, up.z, 0.0f, mDirection.x, mDirection.y, mDirection.z, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f}; getOwnerObject().getTransform().setModelMatrix(matrix); }
[ "protected", "void", "lookAt", "(", ")", "{", "mTempPosition", ".", "set", "(", "getPositionX", "(", ")", ",", "getPositionY", "(", ")", ",", "getPositionZ", "(", ")", ")", ";", "mTempPosition", ".", "negate", "(", "mDirection", ")", ";", "Vector3f", "up", ";", "mDirection", ".", "normalize", "(", ")", ";", "if", "(", "Math", ".", "abs", "(", "mDirection", ".", "x", ")", "<", "0.00001", "&&", "Math", ".", "abs", "(", "mDirection", ".", "z", ")", "<", "0.00001", ")", "{", "if", "(", "mDirection", ".", "y", ">", "0", ")", "{", "up", "=", "new", "Vector3f", "(", "0.0f", ",", "0.0f", ",", "-", "1.0f", ")", ";", "// if direction points in +y", "}", "else", "{", "up", "=", "new", "Vector3f", "(", "0.0f", ",", "0.0f", ",", "1.0f", ")", ";", "// if direction points in -y", "}", "}", "else", "{", "up", "=", "new", "Vector3f", "(", "0.0f", ",", "1.0f", ",", "0.0f", ")", ";", "// y-axis is the general up", "}", "up", ".", "normalize", "(", ")", ";", "Vector3f", "right", "=", "new", "Vector3f", "(", ")", ";", "up", ".", "cross", "(", "mDirection", ",", "right", ")", ";", "right", ".", "normalize", "(", ")", ";", "mDirection", ".", "cross", "(", "right", ",", "up", ")", ";", "up", ".", "normalize", "(", ")", ";", "float", "[", "]", "matrix", "=", "new", "float", "[", "]", "{", "right", ".", "x", ",", "right", ".", "y", ",", "right", ".", "z", ",", "0.0f", ",", "up", ".", "x", ",", "up", ".", "y", ",", "up", ".", "z", ",", "0.0f", ",", "mDirection", ".", "x", ",", "mDirection", ".", "y", ",", "mDirection", ".", "z", ",", "0.0f", ",", "0.0f", ",", "0.0f", ",", "0.0f", ",", "0.0f", "}", ";", "getOwnerObject", "(", ")", ".", "getTransform", "(", ")", ".", "setModelMatrix", "(", "matrix", ")", ";", "}" ]
This method makes sure that the {@link Cursor} is always facing the camera. Lookat implemented using: <p/> http://mmmovania.blogspot.com/2014/03/making-opengl-object-look-at-another.html
[ "This", "method", "makes", "sure", "that", "the", "{", "@link", "Cursor", "}", "is", "always", "facing", "the", "camera", "." ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/3DCursor/3DCursorLibrary/src/main/java/org/gearvrf/io/cursor3d/Cursor.java#L719-L747
jtrfp/javamod
src/main/java/de/quippy/jflac/FixedPredictor.java
FixedPredictor.computeResidual
public static void computeResidual(int[] data, int dataLen, int order, int[] residual) { """ Compute the residual from the compressed signal. @param data @param dataLen @param order @param residual """ int idataLen = (int) dataLen; switch (order) { case 0 : for (int i = 0; i < idataLen; i++) { residual[i] = data[i]; } break; case 1 : for (int i = 0; i < idataLen; i++) { residual[i] = data[i] - data[i - 1]; } break; case 2 : for (int i = 0; i < idataLen; i++) { /* == data[i] - 2*data[i-1] + data[i-2] */ residual[i] = data[i] - (data[i - 1] << 1) + data[i - 2]; } break; case 3 : for (int i = 0; i < idataLen; i++) { /* == data[i] - 3*data[i-1] + 3*data[i-2] - data[i-3] */ residual[i] = data[i] - (((data[i - 1] - data[i - 2]) << 1) + (data[i - 1] - data[i - 2])) - data[i - 3]; } break; case 4 : for (int i = 0; i < idataLen; i++) { /* == data[i] - 4*data[i-1] + 6*data[i-2] - 4*data[i-3] + data[i-4] */ residual[i] = data[i] - ((data[i - 1] + data[i - 3]) << 2) + ((data[i - 2] << 2) + (data[i - 2] << 1)) + data[i - 4]; } break; default : } }
java
public static void computeResidual(int[] data, int dataLen, int order, int[] residual) { int idataLen = (int) dataLen; switch (order) { case 0 : for (int i = 0; i < idataLen; i++) { residual[i] = data[i]; } break; case 1 : for (int i = 0; i < idataLen; i++) { residual[i] = data[i] - data[i - 1]; } break; case 2 : for (int i = 0; i < idataLen; i++) { /* == data[i] - 2*data[i-1] + data[i-2] */ residual[i] = data[i] - (data[i - 1] << 1) + data[i - 2]; } break; case 3 : for (int i = 0; i < idataLen; i++) { /* == data[i] - 3*data[i-1] + 3*data[i-2] - data[i-3] */ residual[i] = data[i] - (((data[i - 1] - data[i - 2]) << 1) + (data[i - 1] - data[i - 2])) - data[i - 3]; } break; case 4 : for (int i = 0; i < idataLen; i++) { /* == data[i] - 4*data[i-1] + 6*data[i-2] - 4*data[i-3] + data[i-4] */ residual[i] = data[i] - ((data[i - 1] + data[i - 3]) << 2) + ((data[i - 2] << 2) + (data[i - 2] << 1)) + data[i - 4]; } break; default : } }
[ "public", "static", "void", "computeResidual", "(", "int", "[", "]", "data", ",", "int", "dataLen", ",", "int", "order", ",", "int", "[", "]", "residual", ")", "{", "int", "idataLen", "=", "(", "int", ")", "dataLen", ";", "switch", "(", "order", ")", "{", "case", "0", ":", "for", "(", "int", "i", "=", "0", ";", "i", "<", "idataLen", ";", "i", "++", ")", "{", "residual", "[", "i", "]", "=", "data", "[", "i", "]", ";", "}", "break", ";", "case", "1", ":", "for", "(", "int", "i", "=", "0", ";", "i", "<", "idataLen", ";", "i", "++", ")", "{", "residual", "[", "i", "]", "=", "data", "[", "i", "]", "-", "data", "[", "i", "-", "1", "]", ";", "}", "break", ";", "case", "2", ":", "for", "(", "int", "i", "=", "0", ";", "i", "<", "idataLen", ";", "i", "++", ")", "{", "/* == data[i] - 2*data[i-1] + data[i-2] */", "residual", "[", "i", "]", "=", "data", "[", "i", "]", "-", "(", "data", "[", "i", "-", "1", "]", "<<", "1", ")", "+", "data", "[", "i", "-", "2", "]", ";", "}", "break", ";", "case", "3", ":", "for", "(", "int", "i", "=", "0", ";", "i", "<", "idataLen", ";", "i", "++", ")", "{", "/* == data[i] - 3*data[i-1] + 3*data[i-2] - data[i-3] */", "residual", "[", "i", "]", "=", "data", "[", "i", "]", "-", "(", "(", "(", "data", "[", "i", "-", "1", "]", "-", "data", "[", "i", "-", "2", "]", ")", "<<", "1", ")", "+", "(", "data", "[", "i", "-", "1", "]", "-", "data", "[", "i", "-", "2", "]", ")", ")", "-", "data", "[", "i", "-", "3", "]", ";", "}", "break", ";", "case", "4", ":", "for", "(", "int", "i", "=", "0", ";", "i", "<", "idataLen", ";", "i", "++", ")", "{", "/* == data[i] - 4*data[i-1] + 6*data[i-2] - 4*data[i-3] + data[i-4] */", "residual", "[", "i", "]", "=", "data", "[", "i", "]", "-", "(", "(", "data", "[", "i", "-", "1", "]", "+", "data", "[", "i", "-", "3", "]", ")", "<<", "2", ")", "+", "(", "(", "data", "[", "i", "-", "2", "]", "<<", "2", ")", "+", "(", "data", "[", "i", "-", "2", "]", "<<", "1", ")", ")", "+", "data", "[", "i", "-", "4", "]", ";", "}", "break", ";", "default", ":", "}", "}" ]
Compute the residual from the compressed signal. @param data @param dataLen @param order @param residual
[ "Compute", "the", "residual", "from", "the", "compressed", "signal", "." ]
train
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/jflac/FixedPredictor.java#L163-L197
wildfly/wildfly-core
controller/src/main/java/org/jboss/as/controller/ModelControllerImpl.java
ModelControllerImpl.awaitContainerStability
void awaitContainerStability(long timeout, TimeUnit timeUnit, final boolean interruptibly) throws InterruptedException, TimeoutException { """ Await service container stability. @param timeout maximum period to wait for service container stability @param timeUnit unit in which {@code timeout} is expressed @param interruptibly {@code true} if thread interruption should be ignored @throws java.lang.InterruptedException if {@code interruptibly} is {@code false} and the thread is interrupted while awaiting service container stability @throws java.util.concurrent.TimeoutException if service container stability is not reached before the specified timeout """ if (interruptibly) { stateMonitor.awaitStability(timeout, timeUnit); } else { stateMonitor.awaitStabilityUninterruptibly(timeout, timeUnit); } }
java
void awaitContainerStability(long timeout, TimeUnit timeUnit, final boolean interruptibly) throws InterruptedException, TimeoutException { if (interruptibly) { stateMonitor.awaitStability(timeout, timeUnit); } else { stateMonitor.awaitStabilityUninterruptibly(timeout, timeUnit); } }
[ "void", "awaitContainerStability", "(", "long", "timeout", ",", "TimeUnit", "timeUnit", ",", "final", "boolean", "interruptibly", ")", "throws", "InterruptedException", ",", "TimeoutException", "{", "if", "(", "interruptibly", ")", "{", "stateMonitor", ".", "awaitStability", "(", "timeout", ",", "timeUnit", ")", ";", "}", "else", "{", "stateMonitor", ".", "awaitStabilityUninterruptibly", "(", "timeout", ",", "timeUnit", ")", ";", "}", "}" ]
Await service container stability. @param timeout maximum period to wait for service container stability @param timeUnit unit in which {@code timeout} is expressed @param interruptibly {@code true} if thread interruption should be ignored @throws java.lang.InterruptedException if {@code interruptibly} is {@code false} and the thread is interrupted while awaiting service container stability @throws java.util.concurrent.TimeoutException if service container stability is not reached before the specified timeout
[ "Await", "service", "container", "stability", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/ModelControllerImpl.java#L816-L823
nohana/Amalgam
amalgam/src/main/java/com/amalgam/view/ViewUtils.java
ViewUtils.pixelToSip
public static float pixelToSip(Context context, float pixels) { """ Convert the pixels to sips, based on density scale. @param context the context. @param pixels to be converted value. @return converted value(sip) """ DisplayMetrics metrics = new DisplayMetrics(); float scaledDensity = metrics.scaledDensity; if (pixels == 0 || scaledDensity == 0) { return 1; } return pixels/scaledDensity; }
java
public static float pixelToSip(Context context, float pixels) { DisplayMetrics metrics = new DisplayMetrics(); float scaledDensity = metrics.scaledDensity; if (pixels == 0 || scaledDensity == 0) { return 1; } return pixels/scaledDensity; }
[ "public", "static", "float", "pixelToSip", "(", "Context", "context", ",", "float", "pixels", ")", "{", "DisplayMetrics", "metrics", "=", "new", "DisplayMetrics", "(", ")", ";", "float", "scaledDensity", "=", "metrics", ".", "scaledDensity", ";", "if", "(", "pixels", "==", "0", "||", "scaledDensity", "==", "0", ")", "{", "return", "1", ";", "}", "return", "pixels", "/", "scaledDensity", ";", "}" ]
Convert the pixels to sips, based on density scale. @param context the context. @param pixels to be converted value. @return converted value(sip)
[ "Convert", "the", "pixels", "to", "sips", "based", "on", "density", "scale", "." ]
train
https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/view/ViewUtils.java#L108-L115
trustathsh/ifmapj
src/main/java/de/hshannover/f4/trust/ifmapj/messages/Requests.java
Requests.createPublishNotify
public static PublishNotify createPublishNotify(Identifier i1, Identifier i2, Document md) { """ Create a new {@link PublishNotify} instance that is used to publish metadata on a link between two {@link Identifier} instances. @param i1 the first {@link Identifier} of the link @param i2 the second {@link Identifier} of the link @param md the metadata that shall be published @return the new {@link PublishNotify} instance """ if (md == null) { throw new NullPointerException("md is null"); } List<Document> mdlist = new ArrayList<Document>(1); mdlist.add(md); return createPublishNotify(i1, i2, mdlist); }
java
public static PublishNotify createPublishNotify(Identifier i1, Identifier i2, Document md) { if (md == null) { throw new NullPointerException("md is null"); } List<Document> mdlist = new ArrayList<Document>(1); mdlist.add(md); return createPublishNotify(i1, i2, mdlist); }
[ "public", "static", "PublishNotify", "createPublishNotify", "(", "Identifier", "i1", ",", "Identifier", "i2", ",", "Document", "md", ")", "{", "if", "(", "md", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "\"md is null\"", ")", ";", "}", "List", "<", "Document", ">", "mdlist", "=", "new", "ArrayList", "<", "Document", ">", "(", "1", ")", ";", "mdlist", ".", "add", "(", "md", ")", ";", "return", "createPublishNotify", "(", "i1", ",", "i2", ",", "mdlist", ")", ";", "}" ]
Create a new {@link PublishNotify} instance that is used to publish metadata on a link between two {@link Identifier} instances. @param i1 the first {@link Identifier} of the link @param i2 the second {@link Identifier} of the link @param md the metadata that shall be published @return the new {@link PublishNotify} instance
[ "Create", "a", "new", "{", "@link", "PublishNotify", "}", "instance", "that", "is", "used", "to", "publish", "metadata", "on", "a", "link", "between", "two", "{", "@link", "Identifier", "}", "instances", "." ]
train
https://github.com/trustathsh/ifmapj/blob/44ece9e95a3d2a1b7019573ba6178598a6cbdaa3/src/main/java/de/hshannover/f4/trust/ifmapj/messages/Requests.java#L496-L507
Stratio/bdt
src/main/java/com/stratio/qa/specs/FileSpec.java
FileSpec.readFromCSV
@When("^I read info from csv file '(.+?)' with separator '(.+?)'$") public void readFromCSV(String csvFile, String separator) throws Exception { """ Read csv file and store result in list of maps @param csvFile """ //By default separator is a coma char sep = ','; if (separator.length() > 1) { switch (separator) { case "\\t": sep = '\t'; break; default: sep = ','; break; } } else { sep = separator.charAt(0); } CsvReader rows = new CsvReader(csvFile, sep); String[] columns = null; if (rows.readRecord()) { columns = rows.getValues(); rows.setHeaders(columns); } List<Map<String, String>> results = new ArrayList<Map<String, String>>(); while (rows.readRecord()) { Map<String, String> row = new HashMap<String, String>(); for (String column : columns) { row.put(column, rows.get(rows.getIndex(column))); } results.add(row); } rows.close(); commonspec.setResultsType("csv"); commonspec.setCSVResults(results); }
java
@When("^I read info from csv file '(.+?)' with separator '(.+?)'$") public void readFromCSV(String csvFile, String separator) throws Exception { //By default separator is a coma char sep = ','; if (separator.length() > 1) { switch (separator) { case "\\t": sep = '\t'; break; default: sep = ','; break; } } else { sep = separator.charAt(0); } CsvReader rows = new CsvReader(csvFile, sep); String[] columns = null; if (rows.readRecord()) { columns = rows.getValues(); rows.setHeaders(columns); } List<Map<String, String>> results = new ArrayList<Map<String, String>>(); while (rows.readRecord()) { Map<String, String> row = new HashMap<String, String>(); for (String column : columns) { row.put(column, rows.get(rows.getIndex(column))); } results.add(row); } rows.close(); commonspec.setResultsType("csv"); commonspec.setCSVResults(results); }
[ "@", "When", "(", "\"^I read info from csv file '(.+?)' with separator '(.+?)'$\"", ")", "public", "void", "readFromCSV", "(", "String", "csvFile", ",", "String", "separator", ")", "throws", "Exception", "{", "//By default separator is a coma", "char", "sep", "=", "'", "'", ";", "if", "(", "separator", ".", "length", "(", ")", ">", "1", ")", "{", "switch", "(", "separator", ")", "{", "case", "\"\\\\t\"", ":", "sep", "=", "'", "'", ";", "break", ";", "default", ":", "sep", "=", "'", "'", ";", "break", ";", "}", "}", "else", "{", "sep", "=", "separator", ".", "charAt", "(", "0", ")", ";", "}", "CsvReader", "rows", "=", "new", "CsvReader", "(", "csvFile", ",", "sep", ")", ";", "String", "[", "]", "columns", "=", "null", ";", "if", "(", "rows", ".", "readRecord", "(", ")", ")", "{", "columns", "=", "rows", ".", "getValues", "(", ")", ";", "rows", ".", "setHeaders", "(", "columns", ")", ";", "}", "List", "<", "Map", "<", "String", ",", "String", ">", ">", "results", "=", "new", "ArrayList", "<", "Map", "<", "String", ",", "String", ">", ">", "(", ")", ";", "while", "(", "rows", ".", "readRecord", "(", ")", ")", "{", "Map", "<", "String", ",", "String", ">", "row", "=", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ";", "for", "(", "String", "column", ":", "columns", ")", "{", "row", ".", "put", "(", "column", ",", "rows", ".", "get", "(", "rows", ".", "getIndex", "(", "column", ")", ")", ")", ";", "}", "results", ".", "add", "(", "row", ")", ";", "}", "rows", ".", "close", "(", ")", ";", "commonspec", ".", "setResultsType", "(", "\"csv\"", ")", ";", "commonspec", ".", "setCSVResults", "(", "results", ")", ";", "}" ]
Read csv file and store result in list of maps @param csvFile
[ "Read", "csv", "file", "and", "store", "result", "in", "list", "of", "maps" ]
train
https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/specs/FileSpec.java#L48-L86
OpenLiberty/open-liberty
dev/com.ibm.ws.injection/src/com/ibm/ws/injectionengine/osgi/util/Link.java
Link.parseMessageDestinationLink
public static Link parseMessageDestinationLink(String origin, String link) { """ Parse a message-destination-link @param origin original module name. @param link link provided on the link element @return """ return parse(origin, link, false); }
java
public static Link parseMessageDestinationLink(String origin, String link) { return parse(origin, link, false); }
[ "public", "static", "Link", "parseMessageDestinationLink", "(", "String", "origin", ",", "String", "link", ")", "{", "return", "parse", "(", "origin", ",", "link", ",", "false", ")", ";", "}" ]
Parse a message-destination-link @param origin original module name. @param link link provided on the link element @return
[ "Parse", "a", "message", "-", "destination", "-", "link" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.injection/src/com/ibm/ws/injectionengine/osgi/util/Link.java#L29-L31
OpenLiberty/open-liberty
dev/com.ibm.rls.jdbc/src/com/ibm/ws/recoverylog/custom/jdbc/impl/SQLSharedServerLeaseLog.java
SQLSharedServerLeaseLog.insertNewLease
private void insertNewLease(String recoveryIdentity, String recoveryGroup, Connection conn) throws SQLException { """ Insert a new lease in the table @param recoveryIdentity @param recoveryGroup @param conn @throws SQLException """ if (tc.isEntryEnabled()) Tr.entry(tc, "insertNewLease", this); short serviceId = (short) 1; String insertString = "INSERT INTO " + _leaseTableName + " (SERVER_IDENTITY, RECOVERY_GROUP, LEASE_OWNER, LEASE_TIME)" + " VALUES (?,?,?,?)"; PreparedStatement specStatement = null; long fir1 = System.currentTimeMillis(); Tr.audit(tc, "WTRN0108I: Insert New Lease for server with recovery identity " + recoveryIdentity); try { if (tc.isDebugEnabled()) Tr.debug(tc, "Need to setup new row using - " + insertString + ", and time: " + fir1); specStatement = conn.prepareStatement(insertString); specStatement.setString(1, recoveryIdentity); specStatement.setString(2, recoveryGroup); specStatement.setString(3, recoveryIdentity); specStatement.setLong(4, fir1); int ret = specStatement.executeUpdate(); if (tc.isDebugEnabled()) Tr.debug(tc, "Have inserted Server row with return: " + ret); } finally { if (specStatement != null && !specStatement.isClosed()) specStatement.close(); } if (tc.isEntryEnabled()) Tr.exit(tc, "insertNewLease"); }
java
private void insertNewLease(String recoveryIdentity, String recoveryGroup, Connection conn) throws SQLException { if (tc.isEntryEnabled()) Tr.entry(tc, "insertNewLease", this); short serviceId = (short) 1; String insertString = "INSERT INTO " + _leaseTableName + " (SERVER_IDENTITY, RECOVERY_GROUP, LEASE_OWNER, LEASE_TIME)" + " VALUES (?,?,?,?)"; PreparedStatement specStatement = null; long fir1 = System.currentTimeMillis(); Tr.audit(tc, "WTRN0108I: Insert New Lease for server with recovery identity " + recoveryIdentity); try { if (tc.isDebugEnabled()) Tr.debug(tc, "Need to setup new row using - " + insertString + ", and time: " + fir1); specStatement = conn.prepareStatement(insertString); specStatement.setString(1, recoveryIdentity); specStatement.setString(2, recoveryGroup); specStatement.setString(3, recoveryIdentity); specStatement.setLong(4, fir1); int ret = specStatement.executeUpdate(); if (tc.isDebugEnabled()) Tr.debug(tc, "Have inserted Server row with return: " + ret); } finally { if (specStatement != null && !specStatement.isClosed()) specStatement.close(); } if (tc.isEntryEnabled()) Tr.exit(tc, "insertNewLease"); }
[ "private", "void", "insertNewLease", "(", "String", "recoveryIdentity", ",", "String", "recoveryGroup", ",", "Connection", "conn", ")", "throws", "SQLException", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "entry", "(", "tc", ",", "\"insertNewLease\"", ",", "this", ")", ";", "short", "serviceId", "=", "(", "short", ")", "1", ";", "String", "insertString", "=", "\"INSERT INTO \"", "+", "_leaseTableName", "+", "\" (SERVER_IDENTITY, RECOVERY_GROUP, LEASE_OWNER, LEASE_TIME)\"", "+", "\" VALUES (?,?,?,?)\"", ";", "PreparedStatement", "specStatement", "=", "null", ";", "long", "fir1", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "Tr", ".", "audit", "(", "tc", ",", "\"WTRN0108I: Insert New Lease for server with recovery identity \"", "+", "recoveryIdentity", ")", ";", "try", "{", "if", "(", "tc", ".", "isDebugEnabled", "(", ")", ")", "Tr", ".", "debug", "(", "tc", ",", "\"Need to setup new row using - \"", "+", "insertString", "+", "\", and time: \"", "+", "fir1", ")", ";", "specStatement", "=", "conn", ".", "prepareStatement", "(", "insertString", ")", ";", "specStatement", ".", "setString", "(", "1", ",", "recoveryIdentity", ")", ";", "specStatement", ".", "setString", "(", "2", ",", "recoveryGroup", ")", ";", "specStatement", ".", "setString", "(", "3", ",", "recoveryIdentity", ")", ";", "specStatement", ".", "setLong", "(", "4", ",", "fir1", ")", ";", "int", "ret", "=", "specStatement", ".", "executeUpdate", "(", ")", ";", "if", "(", "tc", ".", "isDebugEnabled", "(", ")", ")", "Tr", ".", "debug", "(", "tc", ",", "\"Have inserted Server row with return: \"", "+", "ret", ")", ";", "}", "finally", "{", "if", "(", "specStatement", "!=", "null", "&&", "!", "specStatement", ".", "isClosed", "(", ")", ")", "specStatement", ".", "close", "(", ")", ";", "}", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "tc", ",", "\"insertNewLease\"", ")", ";", "}" ]
Insert a new lease in the table @param recoveryIdentity @param recoveryGroup @param conn @throws SQLException
[ "Insert", "a", "new", "lease", "in", "the", "table" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.rls.jdbc/src/com/ibm/ws/recoverylog/custom/jdbc/impl/SQLSharedServerLeaseLog.java#L457-L493
Azure/azure-sdk-for-java
sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/CapabilitiesInner.java
CapabilitiesInner.listByLocation
public LocationCapabilitiesInner listByLocation(String locationName, CapabilityGroup include) { """ Gets the subscription capabilities available for the specified location. @param locationName The location name whose capabilities are retrieved. @param include If specified, restricts the response to only include the selected item. Possible values include: 'supportedEditions', 'supportedElasticPoolEditions', 'supportedManagedInstanceVersions' @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the LocationCapabilitiesInner object if successful. """ return listByLocationWithServiceResponseAsync(locationName, include).toBlocking().single().body(); }
java
public LocationCapabilitiesInner listByLocation(String locationName, CapabilityGroup include) { return listByLocationWithServiceResponseAsync(locationName, include).toBlocking().single().body(); }
[ "public", "LocationCapabilitiesInner", "listByLocation", "(", "String", "locationName", ",", "CapabilityGroup", "include", ")", "{", "return", "listByLocationWithServiceResponseAsync", "(", "locationName", ",", "include", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Gets the subscription capabilities available for the specified location. @param locationName The location name whose capabilities are retrieved. @param include If specified, restricts the response to only include the selected item. Possible values include: 'supportedEditions', 'supportedElasticPoolEditions', 'supportedManagedInstanceVersions' @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the LocationCapabilitiesInner object if successful.
[ "Gets", "the", "subscription", "capabilities", "available", "for", "the", "specified", "location", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/CapabilitiesInner.java#L144-L146
Azure/azure-sdk-for-java
network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ServiceEndpointPolicyDefinitionsInner.java
ServiceEndpointPolicyDefinitionsInner.listByResourceGroupAsync
public Observable<Page<ServiceEndpointPolicyDefinitionInner>> listByResourceGroupAsync(final String resourceGroupName, final String serviceEndpointPolicyName) { """ Gets all service endpoint policy definitions in a service end point policy. @param resourceGroupName The name of the resource group. @param serviceEndpointPolicyName The name of the service endpoint policy name. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;ServiceEndpointPolicyDefinitionInner&gt; object """ return listByResourceGroupWithServiceResponseAsync(resourceGroupName, serviceEndpointPolicyName) .map(new Func1<ServiceResponse<Page<ServiceEndpointPolicyDefinitionInner>>, Page<ServiceEndpointPolicyDefinitionInner>>() { @Override public Page<ServiceEndpointPolicyDefinitionInner> call(ServiceResponse<Page<ServiceEndpointPolicyDefinitionInner>> response) { return response.body(); } }); }
java
public Observable<Page<ServiceEndpointPolicyDefinitionInner>> listByResourceGroupAsync(final String resourceGroupName, final String serviceEndpointPolicyName) { return listByResourceGroupWithServiceResponseAsync(resourceGroupName, serviceEndpointPolicyName) .map(new Func1<ServiceResponse<Page<ServiceEndpointPolicyDefinitionInner>>, Page<ServiceEndpointPolicyDefinitionInner>>() { @Override public Page<ServiceEndpointPolicyDefinitionInner> call(ServiceResponse<Page<ServiceEndpointPolicyDefinitionInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "ServiceEndpointPolicyDefinitionInner", ">", ">", "listByResourceGroupAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "serviceEndpointPolicyName", ")", "{", "return", "listByResourceGroupWithServiceResponseAsync", "(", "resourceGroupName", ",", "serviceEndpointPolicyName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "Page", "<", "ServiceEndpointPolicyDefinitionInner", ">", ">", ",", "Page", "<", "ServiceEndpointPolicyDefinitionInner", ">", ">", "(", ")", "{", "@", "Override", "public", "Page", "<", "ServiceEndpointPolicyDefinitionInner", ">", "call", "(", "ServiceResponse", "<", "Page", "<", "ServiceEndpointPolicyDefinitionInner", ">", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Gets all service endpoint policy definitions in a service end point policy. @param resourceGroupName The name of the resource group. @param serviceEndpointPolicyName The name of the service endpoint policy name. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;ServiceEndpointPolicyDefinitionInner&gt; object
[ "Gets", "all", "service", "endpoint", "policy", "definitions", "in", "a", "service", "end", "point", "policy", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ServiceEndpointPolicyDefinitionsInner.java#L581-L589
QSFT/Doradus
doradus-client/src/main/java/com/dell/doradus/dory/DoradusClient.java
DoradusClient.describeCommand
public JsonObject describeCommand(String service, String command) { """ Describe command that helps give the idea what client needs to build the command @param service service name such as 'SpiderService' for application commands or '_systems' for system commands @param command command name @return JsonObject result in JSON that contains the description of the command """ return Command.matchCommand(restMetadataJson, command, service); }
java
public JsonObject describeCommand(String service, String command) { return Command.matchCommand(restMetadataJson, command, service); }
[ "public", "JsonObject", "describeCommand", "(", "String", "service", ",", "String", "command", ")", "{", "return", "Command", ".", "matchCommand", "(", "restMetadataJson", ",", "command", ",", "service", ")", ";", "}" ]
Describe command that helps give the idea what client needs to build the command @param service service name such as 'SpiderService' for application commands or '_systems' for system commands @param command command name @return JsonObject result in JSON that contains the description of the command
[ "Describe", "command", "that", "helps", "give", "the", "idea", "what", "client", "needs", "to", "build", "the", "command" ]
train
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-client/src/main/java/com/dell/doradus/dory/DoradusClient.java#L151-L154
js-lib-com/commons
src/main/java/js/util/Files.java
Files.replaceExtension
public static File replaceExtension(File file, String newExtension) throws IllegalArgumentException { """ Replace extension on given file and return resulting file. @param file file to replace extension, @param newExtension newly extension. @return newly created file. @throws IllegalArgumentException if file parameter is null. """ Params.notNull(file, "File"); return new File(replaceExtension(file.getPath(), newExtension)); }
java
public static File replaceExtension(File file, String newExtension) throws IllegalArgumentException { Params.notNull(file, "File"); return new File(replaceExtension(file.getPath(), newExtension)); }
[ "public", "static", "File", "replaceExtension", "(", "File", "file", ",", "String", "newExtension", ")", "throws", "IllegalArgumentException", "{", "Params", ".", "notNull", "(", "file", ",", "\"File\"", ")", ";", "return", "new", "File", "(", "replaceExtension", "(", "file", ".", "getPath", "(", ")", ",", "newExtension", ")", ")", ";", "}" ]
Replace extension on given file and return resulting file. @param file file to replace extension, @param newExtension newly extension. @return newly created file. @throws IllegalArgumentException if file parameter is null.
[ "Replace", "extension", "on", "given", "file", "and", "return", "resulting", "file", "." ]
train
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Files.java#L676-L680
Azure/azure-sdk-for-java
notificationhubs/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/notificationhubs/v2016_03_01/implementation/NamespacesInner.java
NamespacesInner.deleteAuthorizationRule
public void deleteAuthorizationRule(String resourceGroupName, String namespaceName, String authorizationRuleName) { """ Deletes a namespace authorization rule. @param resourceGroupName The name of the resource group. @param namespaceName The namespace name. @param authorizationRuleName Authorization Rule Name. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent """ deleteAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, authorizationRuleName).toBlocking().single().body(); }
java
public void deleteAuthorizationRule(String resourceGroupName, String namespaceName, String authorizationRuleName) { deleteAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, authorizationRuleName).toBlocking().single().body(); }
[ "public", "void", "deleteAuthorizationRule", "(", "String", "resourceGroupName", ",", "String", "namespaceName", ",", "String", "authorizationRuleName", ")", "{", "deleteAuthorizationRuleWithServiceResponseAsync", "(", "resourceGroupName", ",", "namespaceName", ",", "authorizationRuleName", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Deletes a namespace authorization rule. @param resourceGroupName The name of the resource group. @param namespaceName The namespace name. @param authorizationRuleName Authorization Rule Name. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
[ "Deletes", "a", "namespace", "authorization", "rule", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/notificationhubs/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/notificationhubs/v2016_03_01/implementation/NamespacesInner.java#L765-L767
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertImpl.java
X509CertImpl.byte2hex
private static void byte2hex(byte b, StringBuffer buf) { """ Converts a byte to hex digit and writes to the supplied buffer """ char[] hexChars = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; int high = ((b & 0xf0) >> 4); int low = (b & 0x0f); buf.append(hexChars[high]); buf.append(hexChars[low]); }
java
private static void byte2hex(byte b, StringBuffer buf) { char[] hexChars = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; int high = ((b & 0xf0) >> 4); int low = (b & 0x0f); buf.append(hexChars[high]); buf.append(hexChars[low]); }
[ "private", "static", "void", "byte2hex", "(", "byte", "b", ",", "StringBuffer", "buf", ")", "{", "char", "[", "]", "hexChars", "=", "{", "'", "'", ",", "'", "'", ",", "'", "'", ",", "'", "'", ",", "'", "'", ",", "'", "'", ",", "'", "'", ",", "'", "'", ",", "'", "'", ",", "'", "'", ",", "'", "'", ",", "'", "'", ",", "'", "'", ",", "'", "'", ",", "'", "'", ",", "'", "'", "}", ";", "int", "high", "=", "(", "(", "b", "&", "0xf0", ")", ">>", "4", ")", ";", "int", "low", "=", "(", "b", "&", "0x0f", ")", ";", "buf", ".", "append", "(", "hexChars", "[", "high", "]", ")", ";", "buf", ".", "append", "(", "hexChars", "[", "low", "]", ")", ";", "}" ]
Converts a byte to hex digit and writes to the supplied buffer
[ "Converts", "a", "byte", "to", "hex", "digit", "and", "writes", "to", "the", "supplied", "buffer" ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertImpl.java#L2005-L2012
looly/hutool
hutool-poi/src/main/java/cn/hutool/poi/excel/WorkbookUtil.java
WorkbookUtil.createSXSSFBook
public static SXSSFWorkbook createSXSSFBook(InputStream in, String password, boolean closeAfterRead) { """ 创建或加载SXSSFWorkbook工作簿 @param in Excel输入流 @param password 密码 @param closeAfterRead 读取结束是否关闭流 @return {@link SXSSFWorkbook} @since 4.1.13 """ return toSXSSFBook(createBook(in, password, closeAfterRead)); }
java
public static SXSSFWorkbook createSXSSFBook(InputStream in, String password, boolean closeAfterRead) { return toSXSSFBook(createBook(in, password, closeAfterRead)); }
[ "public", "static", "SXSSFWorkbook", "createSXSSFBook", "(", "InputStream", "in", ",", "String", "password", ",", "boolean", "closeAfterRead", ")", "{", "return", "toSXSSFBook", "(", "createBook", "(", "in", ",", "password", ",", "closeAfterRead", ")", ")", ";", "}" ]
创建或加载SXSSFWorkbook工作簿 @param in Excel输入流 @param password 密码 @param closeAfterRead 读取结束是否关闭流 @return {@link SXSSFWorkbook} @since 4.1.13
[ "创建或加载SXSSFWorkbook工作簿" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/WorkbookUtil.java#L170-L172
sagiegurari/fax4j
src/main/java/org/fax4j/spi/hylafax/HylaFaxJob.java
HylaFaxJob.getTargetAddress
public String getTargetAddress() { """ This function returns the fax job target address. @return The fax job target address """ String value=null; try { value=this.JOB.getDialstring(); } catch(Exception exception) { throw new FaxException("Error while extracting job target address.",exception); } return value; }
java
public String getTargetAddress() { String value=null; try { value=this.JOB.getDialstring(); } catch(Exception exception) { throw new FaxException("Error while extracting job target address.",exception); } return value; }
[ "public", "String", "getTargetAddress", "(", ")", "{", "String", "value", "=", "null", ";", "try", "{", "value", "=", "this", ".", "JOB", ".", "getDialstring", "(", ")", ";", "}", "catch", "(", "Exception", "exception", ")", "{", "throw", "new", "FaxException", "(", "\"Error while extracting job target address.\"", ",", "exception", ")", ";", "}", "return", "value", ";", "}" ]
This function returns the fax job target address. @return The fax job target address
[ "This", "function", "returns", "the", "fax", "job", "target", "address", "." ]
train
https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/spi/hylafax/HylaFaxJob.java#L166-L179
brunocvcunha/inutils4j
src/main/java/org/brunocvcunha/inutils4j/MyHTTPUtils.java
MyHTTPUtils.getContent
public static String getContent(String stringUrl, Map<String, String> parameters) throws IOException { """ Get content for url/parameters @param stringUrl URL to get content @param parameters HTTP parameters to pass @return content the response content @throws IOException I/O error happened """ return getContent(stringUrl, parameters, null); }
java
public static String getContent(String stringUrl, Map<String, String> parameters) throws IOException { return getContent(stringUrl, parameters, null); }
[ "public", "static", "String", "getContent", "(", "String", "stringUrl", ",", "Map", "<", "String", ",", "String", ">", "parameters", ")", "throws", "IOException", "{", "return", "getContent", "(", "stringUrl", ",", "parameters", ",", "null", ")", ";", "}" ]
Get content for url/parameters @param stringUrl URL to get content @param parameters HTTP parameters to pass @return content the response content @throws IOException I/O error happened
[ "Get", "content", "for", "url", "/", "parameters" ]
train
https://github.com/brunocvcunha/inutils4j/blob/223c4443c2cee662576ce644e552588fa114aa94/src/main/java/org/brunocvcunha/inutils4j/MyHTTPUtils.java#L82-L85
alkacon/opencms-core
src/org/opencms/jsp/util/CmsJspStandardContextBean.java
CmsJspStandardContextBean.getTemplate
public TemplateBean getTemplate() { """ Gets a bean containing information about the current template.<p> @return the template information bean """ TemplateBean templateBean = getRequestAttribute(CmsTemplateContextManager.ATTR_TEMPLATE_BEAN); if (templateBean == null) { templateBean = new TemplateBean("", ""); } return templateBean; }
java
public TemplateBean getTemplate() { TemplateBean templateBean = getRequestAttribute(CmsTemplateContextManager.ATTR_TEMPLATE_BEAN); if (templateBean == null) { templateBean = new TemplateBean("", ""); } return templateBean; }
[ "public", "TemplateBean", "getTemplate", "(", ")", "{", "TemplateBean", "templateBean", "=", "getRequestAttribute", "(", "CmsTemplateContextManager", ".", "ATTR_TEMPLATE_BEAN", ")", ";", "if", "(", "templateBean", "==", "null", ")", "{", "templateBean", "=", "new", "TemplateBean", "(", "\"\"", ",", "\"\"", ")", ";", "}", "return", "templateBean", ";", "}" ]
Gets a bean containing information about the current template.<p> @return the template information bean
[ "Gets", "a", "bean", "containing", "information", "about", "the", "current", "template", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/util/CmsJspStandardContextBean.java#L1634-L1641
remkop/picocli
src/main/java/picocli/CommandLine.java
CommandLine.populateSpec
public static <T> T populateSpec(Class<T> spec, String... args) { """ <p> Convenience method that derives the command specification from the specified interface class, and returns an instance of the specified interface. The interface is expected to have annotated getter methods. Picocli will instantiate the interface and the getter methods will return the option and positional parameter values matched on the command line. </p><p> This is equivalent to </p><pre> CommandLine cli = new CommandLine(spec); cli.parse(args); return cli.getCommand(); </pre> @param spec the interface that defines the command specification. This object contains getter methods annotated with {@code @Option} or {@code @Parameters}. @param args the command line arguments to parse @param <T> the type of the annotated object @return an instance of the specified annotated interface @throws InitializationException if the specified command object does not have a {@link Command}, {@link Option} or {@link Parameters} annotation @throws ParameterException if the specified command line arguments are invalid @since 3.1 """ CommandLine cli = toCommandLine(spec, new DefaultFactory()); cli.parse(args); return cli.getCommand(); }
java
public static <T> T populateSpec(Class<T> spec, String... args) { CommandLine cli = toCommandLine(spec, new DefaultFactory()); cli.parse(args); return cli.getCommand(); }
[ "public", "static", "<", "T", ">", "T", "populateSpec", "(", "Class", "<", "T", ">", "spec", ",", "String", "...", "args", ")", "{", "CommandLine", "cli", "=", "toCommandLine", "(", "spec", ",", "new", "DefaultFactory", "(", ")", ")", ";", "cli", ".", "parse", "(", "args", ")", ";", "return", "cli", ".", "getCommand", "(", ")", ";", "}" ]
<p> Convenience method that derives the command specification from the specified interface class, and returns an instance of the specified interface. The interface is expected to have annotated getter methods. Picocli will instantiate the interface and the getter methods will return the option and positional parameter values matched on the command line. </p><p> This is equivalent to </p><pre> CommandLine cli = new CommandLine(spec); cli.parse(args); return cli.getCommand(); </pre> @param spec the interface that defines the command specification. This object contains getter methods annotated with {@code @Option} or {@code @Parameters}. @param args the command line arguments to parse @param <T> the type of the annotated object @return an instance of the specified annotated interface @throws InitializationException if the specified command object does not have a {@link Command}, {@link Option} or {@link Parameters} annotation @throws ParameterException if the specified command line arguments are invalid @since 3.1
[ "<p", ">", "Convenience", "method", "that", "derives", "the", "command", "specification", "from", "the", "specified", "interface", "class", "and", "returns", "an", "instance", "of", "the", "specified", "interface", ".", "The", "interface", "is", "expected", "to", "have", "annotated", "getter", "methods", ".", "Picocli", "will", "instantiate", "the", "interface", "and", "the", "getter", "methods", "will", "return", "the", "option", "and", "positional", "parameter", "values", "matched", "on", "the", "command", "line", ".", "<", "/", "p", ">", "<p", ">", "This", "is", "equivalent", "to", "<", "/", "p", ">", "<pre", ">", "CommandLine", "cli", "=", "new", "CommandLine", "(", "spec", ")", ";", "cli", ".", "parse", "(", "args", ")", ";", "return", "cli", ".", "getCommand", "()", ";", "<", "/", "pre", ">" ]
train
https://github.com/remkop/picocli/blob/3c5384f0d12817401d1921c3013c1282e2edcab2/src/main/java/picocli/CommandLine.java#L1059-L1063
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/event/FileListener.java
FileListener.readField
public BaseField readField(ObjectInputStream daIn, BaseField fldCurrent) throws IOException, ClassNotFoundException { """ Decode and read this field from the stream. Will create a new field, init it and set the data if the field is not passed in. @param daIn The input stream to unmarshal the data from. @param fldCurrent The field to unmarshall the data into (optional). """ String strFieldName = daIn.readUTF(); Object objData = daIn.readObject(); if (fldCurrent == null) if (strFieldName.length() > 0) { fldCurrent = (BaseField)ClassServiceUtility.getClassService().makeObjectFromClassName(strFieldName); if (fldCurrent != null) { fldCurrent.init(null, null, DBConstants.DEFAULT_FIELD_LENGTH, null, null); if (this.getOwner() != null) // Make sure it is cleaned up this.getOwner().addListener(new RemoveConverterOnCloseHandler(fldCurrent)); } } if (fldCurrent != null) fldCurrent.setData(objData); return fldCurrent; }
java
public BaseField readField(ObjectInputStream daIn, BaseField fldCurrent) throws IOException, ClassNotFoundException { String strFieldName = daIn.readUTF(); Object objData = daIn.readObject(); if (fldCurrent == null) if (strFieldName.length() > 0) { fldCurrent = (BaseField)ClassServiceUtility.getClassService().makeObjectFromClassName(strFieldName); if (fldCurrent != null) { fldCurrent.init(null, null, DBConstants.DEFAULT_FIELD_LENGTH, null, null); if (this.getOwner() != null) // Make sure it is cleaned up this.getOwner().addListener(new RemoveConverterOnCloseHandler(fldCurrent)); } } if (fldCurrent != null) fldCurrent.setData(objData); return fldCurrent; }
[ "public", "BaseField", "readField", "(", "ObjectInputStream", "daIn", ",", "BaseField", "fldCurrent", ")", "throws", "IOException", ",", "ClassNotFoundException", "{", "String", "strFieldName", "=", "daIn", ".", "readUTF", "(", ")", ";", "Object", "objData", "=", "daIn", ".", "readObject", "(", ")", ";", "if", "(", "fldCurrent", "==", "null", ")", "if", "(", "strFieldName", ".", "length", "(", ")", ">", "0", ")", "{", "fldCurrent", "=", "(", "BaseField", ")", "ClassServiceUtility", ".", "getClassService", "(", ")", ".", "makeObjectFromClassName", "(", "strFieldName", ")", ";", "if", "(", "fldCurrent", "!=", "null", ")", "{", "fldCurrent", ".", "init", "(", "null", ",", "null", ",", "DBConstants", ".", "DEFAULT_FIELD_LENGTH", ",", "null", ",", "null", ")", ";", "if", "(", "this", ".", "getOwner", "(", ")", "!=", "null", ")", "// Make sure it is cleaned up", "this", ".", "getOwner", "(", ")", ".", "addListener", "(", "new", "RemoveConverterOnCloseHandler", "(", "fldCurrent", ")", ")", ";", "}", "}", "if", "(", "fldCurrent", "!=", "null", ")", "fldCurrent", ".", "setData", "(", "objData", ")", ";", "return", "fldCurrent", ";", "}" ]
Decode and read this field from the stream. Will create a new field, init it and set the data if the field is not passed in. @param daIn The input stream to unmarshal the data from. @param fldCurrent The field to unmarshall the data into (optional).
[ "Decode", "and", "read", "this", "field", "from", "the", "stream", ".", "Will", "create", "a", "new", "field", "init", "it", "and", "set", "the", "data", "if", "the", "field", "is", "not", "passed", "in", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/event/FileListener.java#L422-L439
j-a-w-r/jawr-main-repo
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/util/PathNormalizer.java
PathNormalizer.createGenerationPath
public static String createGenerationPath(String path, GeneratorRegistry registry, String randomParam) { """ converts a generation path (such as jar:/some/path/file) into a request path that the request handler can understand and process. @param path the path @param registry the generator registry @param randomParam the random parameter @return the generation path """ String requestPath = null; try { requestPath = registry.getDebugModeGenerationPath(path); if (randomParam != null) { requestPath += "?" + randomParam + "&"; } else { requestPath += "?"; } requestPath += JawrRequestHandler.GENERATION_PARAM + "=" + URLEncoder.encode(path, "UTF-8"); } catch (UnsupportedEncodingException neverHappens) { /* URLEncoder:how not to use checked exceptions... */ throw new JawrLinkRenderingException( "Something went unexpectedly wrong while encoding a URL for a generator. ", neverHappens); } return requestPath; }
java
public static String createGenerationPath(String path, GeneratorRegistry registry, String randomParam) { String requestPath = null; try { requestPath = registry.getDebugModeGenerationPath(path); if (randomParam != null) { requestPath += "?" + randomParam + "&"; } else { requestPath += "?"; } requestPath += JawrRequestHandler.GENERATION_PARAM + "=" + URLEncoder.encode(path, "UTF-8"); } catch (UnsupportedEncodingException neverHappens) { /* URLEncoder:how not to use checked exceptions... */ throw new JawrLinkRenderingException( "Something went unexpectedly wrong while encoding a URL for a generator. ", neverHappens); } return requestPath; }
[ "public", "static", "String", "createGenerationPath", "(", "String", "path", ",", "GeneratorRegistry", "registry", ",", "String", "randomParam", ")", "{", "String", "requestPath", "=", "null", ";", "try", "{", "requestPath", "=", "registry", ".", "getDebugModeGenerationPath", "(", "path", ")", ";", "if", "(", "randomParam", "!=", "null", ")", "{", "requestPath", "+=", "\"?\"", "+", "randomParam", "+", "\"&\"", ";", "}", "else", "{", "requestPath", "+=", "\"?\"", ";", "}", "requestPath", "+=", "JawrRequestHandler", ".", "GENERATION_PARAM", "+", "\"=\"", "+", "URLEncoder", ".", "encode", "(", "path", ",", "\"UTF-8\"", ")", ";", "}", "catch", "(", "UnsupportedEncodingException", "neverHappens", ")", "{", "/* URLEncoder:how not to use checked exceptions... */", "throw", "new", "JawrLinkRenderingException", "(", "\"Something went unexpectedly wrong while encoding a URL for a generator. \"", ",", "neverHappens", ")", ";", "}", "return", "requestPath", ";", "}" ]
converts a generation path (such as jar:/some/path/file) into a request path that the request handler can understand and process. @param path the path @param registry the generator registry @param randomParam the random parameter @return the generation path
[ "converts", "a", "generation", "path", "(", "such", "as", "jar", ":", "/", "some", "/", "path", "/", "file", ")", "into", "a", "request", "path", "that", "the", "request", "handler", "can", "understand", "and", "process", "." ]
train
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/util/PathNormalizer.java#L403-L421
hawkular/hawkular-apm
client/instrumenter/src/main/java/org/hawkular/apm/instrumenter/RuleHelper.java
RuleHelper.appendInBuffer
public void appendInBuffer(Object obj, byte[] data, int offset, int len, boolean close) { """ This method appends data to the buffer associated with the supplied object. @param obj The object associated with the buffer @param data The data to be appended @param offset The offset of the data @param len The length of data @param close Whether to close the buffer after appending the data """ if (len > 0) { collector().appendInBuffer(getRuleName(), obj, data, offset, len); } if (close) { collector().recordInBuffer(getRuleName(), obj); } }
java
public void appendInBuffer(Object obj, byte[] data, int offset, int len, boolean close) { if (len > 0) { collector().appendInBuffer(getRuleName(), obj, data, offset, len); } if (close) { collector().recordInBuffer(getRuleName(), obj); } }
[ "public", "void", "appendInBuffer", "(", "Object", "obj", ",", "byte", "[", "]", "data", ",", "int", "offset", ",", "int", "len", ",", "boolean", "close", ")", "{", "if", "(", "len", ">", "0", ")", "{", "collector", "(", ")", ".", "appendInBuffer", "(", "getRuleName", "(", ")", ",", "obj", ",", "data", ",", "offset", ",", "len", ")", ";", "}", "if", "(", "close", ")", "{", "collector", "(", ")", ".", "recordInBuffer", "(", "getRuleName", "(", ")", ",", "obj", ")", ";", "}", "}" ]
This method appends data to the buffer associated with the supplied object. @param obj The object associated with the buffer @param data The data to be appended @param offset The offset of the data @param len The length of data @param close Whether to close the buffer after appending the data
[ "This", "method", "appends", "data", "to", "the", "buffer", "associated", "with", "the", "supplied", "object", "." ]
train
https://github.com/hawkular/hawkular-apm/blob/57a4df0611b359597626563ea5f9ac64d4bb2533/client/instrumenter/src/main/java/org/hawkular/apm/instrumenter/RuleHelper.java#L482-L489
lightblueseas/file-worker
src/main/java/de/alpharogroup/file/csv/CsvFileExtensions.java
CsvFileExtensions.formatToCSV
public static void formatToCSV(final File input, final File output, final String encoding) throws IOException { """ Formats a file that has in every line one input-data into a csv-file. @param input The input-file to format. The current format from the file is every data in a line. @param output The file where the formatted data should be inserted. @param encoding the encoding @throws IOException When an io error occurs. """ final List<String> list = readLinesInList(input, "UTF-8"); final String sb = formatListToString(list); WriteFileExtensions.writeStringToFile(output, sb, encoding); }
java
public static void formatToCSV(final File input, final File output, final String encoding) throws IOException { final List<String> list = readLinesInList(input, "UTF-8"); final String sb = formatListToString(list); WriteFileExtensions.writeStringToFile(output, sb, encoding); }
[ "public", "static", "void", "formatToCSV", "(", "final", "File", "input", ",", "final", "File", "output", ",", "final", "String", "encoding", ")", "throws", "IOException", "{", "final", "List", "<", "String", ">", "list", "=", "readLinesInList", "(", "input", ",", "\"UTF-8\"", ")", ";", "final", "String", "sb", "=", "formatListToString", "(", "list", ")", ";", "WriteFileExtensions", ".", "writeStringToFile", "(", "output", ",", "sb", ",", "encoding", ")", ";", "}" ]
Formats a file that has in every line one input-data into a csv-file. @param input The input-file to format. The current format from the file is every data in a line. @param output The file where the formatted data should be inserted. @param encoding the encoding @throws IOException When an io error occurs.
[ "Formats", "a", "file", "that", "has", "in", "every", "line", "one", "input", "-", "data", "into", "a", "csv", "-", "file", "." ]
train
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/csv/CsvFileExtensions.java#L143-L149
matthewhorridge/owlapi-gwt
owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLNamedIndividualImpl_CustomFieldSerializer.java
OWLNamedIndividualImpl_CustomFieldSerializer.deserializeInstance
@Override public void deserializeInstance(SerializationStreamReader streamReader, OWLNamedIndividualImpl instance) throws SerializationException { """ Deserializes the content of the object from the {@link com.google.gwt.user.client.rpc.SerializationStreamReader}. @param streamReader the {@link com.google.gwt.user.client.rpc.SerializationStreamReader} to read the object's content from @param instance the object instance to deserialize @throws com.google.gwt.user.client.rpc.SerializationException if the deserialization operation is not successful """ deserialize(streamReader, instance); }
java
@Override public void deserializeInstance(SerializationStreamReader streamReader, OWLNamedIndividualImpl instance) throws SerializationException { deserialize(streamReader, instance); }
[ "@", "Override", "public", "void", "deserializeInstance", "(", "SerializationStreamReader", "streamReader", ",", "OWLNamedIndividualImpl", "instance", ")", "throws", "SerializationException", "{", "deserialize", "(", "streamReader", ",", "instance", ")", ";", "}" ]
Deserializes the content of the object from the {@link com.google.gwt.user.client.rpc.SerializationStreamReader}. @param streamReader the {@link com.google.gwt.user.client.rpc.SerializationStreamReader} to read the object's content from @param instance the object instance to deserialize @throws com.google.gwt.user.client.rpc.SerializationException if the deserialization operation is not successful
[ "Deserializes", "the", "content", "of", "the", "object", "from", "the", "{" ]
train
https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLNamedIndividualImpl_CustomFieldSerializer.java#L83-L86
b3dgs/lionengine
lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/collision/CollisionGroupConfig.java
CollisionGroupConfig.imports
public static CollisionGroupConfig imports(Media config) { """ Create the collision group data from node (should only be used to display names, as real content is <code>null</code>, mainly UI specific to not have dependency on {@link MapTileCollision}). @param config The tile collision groups descriptor (must not be <code>null</code>). @return The collisions group data. @throws LionEngineException If unable to read node. """ final Xml root = new Xml(config); final Collection<Xml> childrenCollision = root.getChildren(NODE_COLLISION); final Map<String, CollisionGroup> groups = new HashMap<>(childrenCollision.size()); for (final Xml node : childrenCollision) { final Collection<Xml> childrenFormula = node.getChildren(CollisionFormulaConfig.NODE_FORMULA); final Collection<CollisionFormula> formulas = new ArrayList<>(childrenFormula.size()); for (final Xml formula : childrenFormula) { final String formulaName = formula.getText(); formulas.add(new CollisionFormula(formulaName, null, null, null)); } final String groupName = node.readString(ATT_GROUP); final CollisionGroup collision = new CollisionGroup(groupName, formulas); groups.put(groupName, collision); } return new CollisionGroupConfig(groups); }
java
public static CollisionGroupConfig imports(Media config) { final Xml root = new Xml(config); final Collection<Xml> childrenCollision = root.getChildren(NODE_COLLISION); final Map<String, CollisionGroup> groups = new HashMap<>(childrenCollision.size()); for (final Xml node : childrenCollision) { final Collection<Xml> childrenFormula = node.getChildren(CollisionFormulaConfig.NODE_FORMULA); final Collection<CollisionFormula> formulas = new ArrayList<>(childrenFormula.size()); for (final Xml formula : childrenFormula) { final String formulaName = formula.getText(); formulas.add(new CollisionFormula(formulaName, null, null, null)); } final String groupName = node.readString(ATT_GROUP); final CollisionGroup collision = new CollisionGroup(groupName, formulas); groups.put(groupName, collision); } return new CollisionGroupConfig(groups); }
[ "public", "static", "CollisionGroupConfig", "imports", "(", "Media", "config", ")", "{", "final", "Xml", "root", "=", "new", "Xml", "(", "config", ")", ";", "final", "Collection", "<", "Xml", ">", "childrenCollision", "=", "root", ".", "getChildren", "(", "NODE_COLLISION", ")", ";", "final", "Map", "<", "String", ",", "CollisionGroup", ">", "groups", "=", "new", "HashMap", "<>", "(", "childrenCollision", ".", "size", "(", ")", ")", ";", "for", "(", "final", "Xml", "node", ":", "childrenCollision", ")", "{", "final", "Collection", "<", "Xml", ">", "childrenFormula", "=", "node", ".", "getChildren", "(", "CollisionFormulaConfig", ".", "NODE_FORMULA", ")", ";", "final", "Collection", "<", "CollisionFormula", ">", "formulas", "=", "new", "ArrayList", "<>", "(", "childrenFormula", ".", "size", "(", ")", ")", ";", "for", "(", "final", "Xml", "formula", ":", "childrenFormula", ")", "{", "final", "String", "formulaName", "=", "formula", ".", "getText", "(", ")", ";", "formulas", ".", "add", "(", "new", "CollisionFormula", "(", "formulaName", ",", "null", ",", "null", ",", "null", ")", ")", ";", "}", "final", "String", "groupName", "=", "node", ".", "readString", "(", "ATT_GROUP", ")", ";", "final", "CollisionGroup", "collision", "=", "new", "CollisionGroup", "(", "groupName", ",", "formulas", ")", ";", "groups", ".", "put", "(", "groupName", ",", "collision", ")", ";", "}", "return", "new", "CollisionGroupConfig", "(", "groups", ")", ";", "}" ]
Create the collision group data from node (should only be used to display names, as real content is <code>null</code>, mainly UI specific to not have dependency on {@link MapTileCollision}). @param config The tile collision groups descriptor (must not be <code>null</code>). @return The collisions group data. @throws LionEngineException If unable to read node.
[ "Create", "the", "collision", "group", "data", "from", "node", "(", "should", "only", "be", "used", "to", "display", "names", "as", "real", "content", "is", "<code", ">", "null<", "/", "code", ">", "mainly", "UI", "specific", "to", "not", "have", "dependency", "on", "{", "@link", "MapTileCollision", "}", ")", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/collision/CollisionGroupConfig.java#L59-L82
GeoLatte/geolatte-common
src/main/java/org/geolatte/common/dataformats/json/to/GeoJsonToAssembler.java
GeoJsonToAssembler.fromTransferObject
public MultiLineString fromTransferObject(MultiLineStringTo input, CrsId crsId) { """ Creates a multilinestring object starting from a transfer object. @param input the multilinestring transfer object @param crsId the crs id to use (ignores the crs of the input). If null, uses the crs of the input. @return the corresponding geometry @throws IllegalArgumentException If the geometry could not be constructed due to an invalid transfer object """ if (input == null) { return null; } crsId = getCrsId(input, crsId); isValid(input); LineString[] lineStrings = new LineString[input.getCoordinates().length]; for (int i = 0; i < lineStrings.length; i++) { lineStrings[i] = new LineString(createPointSequence(input.getCoordinates()[i], crsId)); } return new MultiLineString(lineStrings); }
java
public MultiLineString fromTransferObject(MultiLineStringTo input, CrsId crsId) { if (input == null) { return null; } crsId = getCrsId(input, crsId); isValid(input); LineString[] lineStrings = new LineString[input.getCoordinates().length]; for (int i = 0; i < lineStrings.length; i++) { lineStrings[i] = new LineString(createPointSequence(input.getCoordinates()[i], crsId)); } return new MultiLineString(lineStrings); }
[ "public", "MultiLineString", "fromTransferObject", "(", "MultiLineStringTo", "input", ",", "CrsId", "crsId", ")", "{", "if", "(", "input", "==", "null", ")", "{", "return", "null", ";", "}", "crsId", "=", "getCrsId", "(", "input", ",", "crsId", ")", ";", "isValid", "(", "input", ")", ";", "LineString", "[", "]", "lineStrings", "=", "new", "LineString", "[", "input", ".", "getCoordinates", "(", ")", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "lineStrings", ".", "length", ";", "i", "++", ")", "{", "lineStrings", "[", "i", "]", "=", "new", "LineString", "(", "createPointSequence", "(", "input", ".", "getCoordinates", "(", ")", "[", "i", "]", ",", "crsId", ")", ")", ";", "}", "return", "new", "MultiLineString", "(", "lineStrings", ")", ";", "}" ]
Creates a multilinestring object starting from a transfer object. @param input the multilinestring transfer object @param crsId the crs id to use (ignores the crs of the input). If null, uses the crs of the input. @return the corresponding geometry @throws IllegalArgumentException If the geometry could not be constructed due to an invalid transfer object
[ "Creates", "a", "multilinestring", "object", "starting", "from", "a", "transfer", "object", "." ]
train
https://github.com/GeoLatte/geolatte-common/blob/dc7f92b04d8c6cb706e78cb95e746d8f12089d95/src/main/java/org/geolatte/common/dataformats/json/to/GeoJsonToAssembler.java#L336-L347
liferay/com-liferay-commerce
commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceSubscriptionEntryPersistenceImpl.java
CommerceSubscriptionEntryPersistenceImpl.removeByUUID_G
@Override public CommerceSubscriptionEntry removeByUUID_G(String uuid, long groupId) throws NoSuchSubscriptionEntryException { """ Removes the commerce subscription entry where uuid = &#63; and groupId = &#63; from the database. @param uuid the uuid @param groupId the group ID @return the commerce subscription entry that was removed """ CommerceSubscriptionEntry commerceSubscriptionEntry = findByUUID_G(uuid, groupId); return remove(commerceSubscriptionEntry); }
java
@Override public CommerceSubscriptionEntry removeByUUID_G(String uuid, long groupId) throws NoSuchSubscriptionEntryException { CommerceSubscriptionEntry commerceSubscriptionEntry = findByUUID_G(uuid, groupId); return remove(commerceSubscriptionEntry); }
[ "@", "Override", "public", "CommerceSubscriptionEntry", "removeByUUID_G", "(", "String", "uuid", ",", "long", "groupId", ")", "throws", "NoSuchSubscriptionEntryException", "{", "CommerceSubscriptionEntry", "commerceSubscriptionEntry", "=", "findByUUID_G", "(", "uuid", ",", "groupId", ")", ";", "return", "remove", "(", "commerceSubscriptionEntry", ")", ";", "}" ]
Removes the commerce subscription entry where uuid = &#63; and groupId = &#63; from the database. @param uuid the uuid @param groupId the group ID @return the commerce subscription entry that was removed
[ "Removes", "the", "commerce", "subscription", "entry", "where", "uuid", "=", "&#63", ";", "and", "groupId", "=", "&#63", ";", "from", "the", "database", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceSubscriptionEntryPersistenceImpl.java#L822-L829
openbase/jul
extension/type/processing/src/main/java/org/openbase/jul/extension/type/processing/MultiLanguageTextProcessor.java
MultiLanguageTextProcessor.addMultiLanguageText
public static MultiLanguageText.Builder addMultiLanguageText(final MultiLanguageText.Builder multiLanguageTextBuilder, final Locale locale, final String multiLanguageText) { """ Add a multiLanguageText to a multiLanguageTextBuilder by locale. This is equivalent to calling {@link #addMultiLanguageText(Builder, String, String)} but the language code is extracted from the locale by calling {@link Locale#getLanguage()}. @param multiLanguageTextBuilder the multiLanguageText builder to be updated @param locale the locale from which the language code is extracted for which the multiLanguageText is added @param multiLanguageText the multiLanguageText to be added @return the updated multiLanguageText builder """ return addMultiLanguageText(multiLanguageTextBuilder, locale.getLanguage(), multiLanguageText); }
java
public static MultiLanguageText.Builder addMultiLanguageText(final MultiLanguageText.Builder multiLanguageTextBuilder, final Locale locale, final String multiLanguageText) { return addMultiLanguageText(multiLanguageTextBuilder, locale.getLanguage(), multiLanguageText); }
[ "public", "static", "MultiLanguageText", ".", "Builder", "addMultiLanguageText", "(", "final", "MultiLanguageText", ".", "Builder", "multiLanguageTextBuilder", ",", "final", "Locale", "locale", ",", "final", "String", "multiLanguageText", ")", "{", "return", "addMultiLanguageText", "(", "multiLanguageTextBuilder", ",", "locale", ".", "getLanguage", "(", ")", ",", "multiLanguageText", ")", ";", "}" ]
Add a multiLanguageText to a multiLanguageTextBuilder by locale. This is equivalent to calling {@link #addMultiLanguageText(Builder, String, String)} but the language code is extracted from the locale by calling {@link Locale#getLanguage()}. @param multiLanguageTextBuilder the multiLanguageText builder to be updated @param locale the locale from which the language code is extracted for which the multiLanguageText is added @param multiLanguageText the multiLanguageText to be added @return the updated multiLanguageText builder
[ "Add", "a", "multiLanguageText", "to", "a", "multiLanguageTextBuilder", "by", "locale", ".", "This", "is", "equivalent", "to", "calling", "{", "@link", "#addMultiLanguageText", "(", "Builder", "String", "String", ")", "}", "but", "the", "language", "code", "is", "extracted", "from", "the", "locale", "by", "calling", "{", "@link", "Locale#getLanguage", "()", "}", "." ]
train
https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/extension/type/processing/src/main/java/org/openbase/jul/extension/type/processing/MultiLanguageTextProcessor.java#L120-L122
mapbox/mapbox-events-android
libcore/src/main/java/com/mapbox/android/core/FileUtils.java
FileUtils.deleteFirst
public static void deleteFirst(@NonNull File[] files, @NonNull Comparator<File> sortedBy, int numFiles) { """ Delete first n files sorted by property. @param files list of files to delete. @param sortedBy sorting comparator. @param numFiles number of files from list to delete. """ Arrays.sort(files, sortedBy); int size = Math.min(files.length, numFiles); for (int i = 0; i < size; i++) { if (!files[i].delete()) { Log.w(LOG_TAG, "Failed to delete file: " + files[i]); } } }
java
public static void deleteFirst(@NonNull File[] files, @NonNull Comparator<File> sortedBy, int numFiles) { Arrays.sort(files, sortedBy); int size = Math.min(files.length, numFiles); for (int i = 0; i < size; i++) { if (!files[i].delete()) { Log.w(LOG_TAG, "Failed to delete file: " + files[i]); } } }
[ "public", "static", "void", "deleteFirst", "(", "@", "NonNull", "File", "[", "]", "files", ",", "@", "NonNull", "Comparator", "<", "File", ">", "sortedBy", ",", "int", "numFiles", ")", "{", "Arrays", ".", "sort", "(", "files", ",", "sortedBy", ")", ";", "int", "size", "=", "Math", ".", "min", "(", "files", ".", "length", ",", "numFiles", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "size", ";", "i", "++", ")", "{", "if", "(", "!", "files", "[", "i", "]", ".", "delete", "(", ")", ")", "{", "Log", ".", "w", "(", "LOG_TAG", ",", "\"Failed to delete file: \"", "+", "files", "[", "i", "]", ")", ";", "}", "}", "}" ]
Delete first n files sorted by property. @param files list of files to delete. @param sortedBy sorting comparator. @param numFiles number of files from list to delete.
[ "Delete", "first", "n", "files", "sorted", "by", "property", "." ]
train
https://github.com/mapbox/mapbox-events-android/blob/5b5ca7e04cb8fab31a8dc040b6e7521f930a58a4/libcore/src/main/java/com/mapbox/android/core/FileUtils.java#L127-L135
Azure/azure-sdk-for-java
sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerTableAuditingPoliciesInner.java
ServerTableAuditingPoliciesInner.createOrUpdateAsync
public Observable<ServerTableAuditingPolicyInner> createOrUpdateAsync(String resourceGroupName, String serverName, ServerTableAuditingPolicyInner parameters) { """ Creates or updates a servers's table auditing policy. Table auditing is deprecated, use blob auditing instead. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param parameters The server table auditing policy. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ServerTableAuditingPolicyInner object """ return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters).map(new Func1<ServiceResponse<ServerTableAuditingPolicyInner>, ServerTableAuditingPolicyInner>() { @Override public ServerTableAuditingPolicyInner call(ServiceResponse<ServerTableAuditingPolicyInner> response) { return response.body(); } }); }
java
public Observable<ServerTableAuditingPolicyInner> createOrUpdateAsync(String resourceGroupName, String serverName, ServerTableAuditingPolicyInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters).map(new Func1<ServiceResponse<ServerTableAuditingPolicyInner>, ServerTableAuditingPolicyInner>() { @Override public ServerTableAuditingPolicyInner call(ServiceResponse<ServerTableAuditingPolicyInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ServerTableAuditingPolicyInner", ">", "createOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "ServerTableAuditingPolicyInner", "parameters", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "serverName", ",", "parameters", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "ServerTableAuditingPolicyInner", ">", ",", "ServerTableAuditingPolicyInner", ">", "(", ")", "{", "@", "Override", "public", "ServerTableAuditingPolicyInner", "call", "(", "ServiceResponse", "<", "ServerTableAuditingPolicyInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Creates or updates a servers's table auditing policy. Table auditing is deprecated, use blob auditing instead. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param parameters The server table auditing policy. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ServerTableAuditingPolicyInner object
[ "Creates", "or", "updates", "a", "servers", "s", "table", "auditing", "policy", ".", "Table", "auditing", "is", "deprecated", "use", "blob", "auditing", "instead", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerTableAuditingPoliciesInner.java#L196-L203
Azure/azure-sdk-for-java
compute/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/compute/v2018_04_01/implementation/SnapshotsInner.java
SnapshotsInner.getByResourceGroup
public SnapshotInner getByResourceGroup(String resourceGroupName, String snapshotName) { """ Gets information about a snapshot. @param resourceGroupName The name of the resource group. @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the SnapshotInner object if successful. """ return getByResourceGroupWithServiceResponseAsync(resourceGroupName, snapshotName).toBlocking().single().body(); }
java
public SnapshotInner getByResourceGroup(String resourceGroupName, String snapshotName) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, snapshotName).toBlocking().single().body(); }
[ "public", "SnapshotInner", "getByResourceGroup", "(", "String", "resourceGroupName", ",", "String", "snapshotName", ")", "{", "return", "getByResourceGroupWithServiceResponseAsync", "(", "resourceGroupName", ",", "snapshotName", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Gets information about a snapshot. @param resourceGroupName The name of the resource group. @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the SnapshotInner object if successful.
[ "Gets", "information", "about", "a", "snapshot", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/compute/v2018_04_01/implementation/SnapshotsInner.java#L487-L489
eFaps/eFaps-Kernel
src/main/java/org/efaps/admin/user/Person.java
Person.setPassword
public Status setPassword(final String _newPasswd) throws EFapsException { """ The instance method sets the new password for the current context user. Before the new password is set, some checks are made. @param _newPasswd new Password to set @throws EFapsException on error @return true if password set, else false """ final Type type = CIAdminUser.Person.getType(); if (_newPasswd.length() == 0) { throw new EFapsException(getClass(), "PassWordLength", 1, _newPasswd.length()); } final Update update = new Update(type, "" + getId()); final Status status = update.add(CIAdminUser.Person.Password, _newPasswd); if (status.isOk()) { update.execute(); update.close(); } else { Person.LOG.error("Password could not be set by the Update, due to restrictions " + "e.g. length???"); throw new EFapsException(getClass(), "TODO"); } return status; }
java
public Status setPassword(final String _newPasswd) throws EFapsException { final Type type = CIAdminUser.Person.getType(); if (_newPasswd.length() == 0) { throw new EFapsException(getClass(), "PassWordLength", 1, _newPasswd.length()); } final Update update = new Update(type, "" + getId()); final Status status = update.add(CIAdminUser.Person.Password, _newPasswd); if (status.isOk()) { update.execute(); update.close(); } else { Person.LOG.error("Password could not be set by the Update, due to restrictions " + "e.g. length???"); throw new EFapsException(getClass(), "TODO"); } return status; }
[ "public", "Status", "setPassword", "(", "final", "String", "_newPasswd", ")", "throws", "EFapsException", "{", "final", "Type", "type", "=", "CIAdminUser", ".", "Person", ".", "getType", "(", ")", ";", "if", "(", "_newPasswd", ".", "length", "(", ")", "==", "0", ")", "{", "throw", "new", "EFapsException", "(", "getClass", "(", ")", ",", "\"PassWordLength\"", ",", "1", ",", "_newPasswd", ".", "length", "(", ")", ")", ";", "}", "final", "Update", "update", "=", "new", "Update", "(", "type", ",", "\"\"", "+", "getId", "(", ")", ")", ";", "final", "Status", "status", "=", "update", ".", "add", "(", "CIAdminUser", ".", "Person", ".", "Password", ",", "_newPasswd", ")", ";", "if", "(", "status", ".", "isOk", "(", ")", ")", "{", "update", ".", "execute", "(", ")", ";", "update", ".", "close", "(", ")", ";", "}", "else", "{", "Person", ".", "LOG", ".", "error", "(", "\"Password could not be set by the Update, due to restrictions \"", "+", "\"e.g. length???\"", ")", ";", "throw", "new", "EFapsException", "(", "getClass", "(", ")", ",", "\"TODO\"", ")", ";", "}", "return", "status", ";", "}" ]
The instance method sets the new password for the current context user. Before the new password is set, some checks are made. @param _newPasswd new Password to set @throws EFapsException on error @return true if password set, else false
[ "The", "instance", "method", "sets", "the", "new", "password", "for", "the", "current", "context", "user", ".", "Before", "the", "new", "password", "is", "set", "some", "checks", "are", "made", "." ]
train
https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/admin/user/Person.java#L814-L831
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/objects/XNodeSet.java
XNodeSet.greaterThan
public boolean greaterThan(XObject obj2) throws javax.xml.transform.TransformerException { """ Tell if one object is less than the other. @param obj2 object to compare this nodeset to @return see this.compare(...) @throws javax.xml.transform.TransformerException """ return compare(obj2, S_GT); }
java
public boolean greaterThan(XObject obj2) throws javax.xml.transform.TransformerException { return compare(obj2, S_GT); }
[ "public", "boolean", "greaterThan", "(", "XObject", "obj2", ")", "throws", "javax", ".", "xml", ".", "transform", ".", "TransformerException", "{", "return", "compare", "(", "obj2", ",", "S_GT", ")", ";", "}" ]
Tell if one object is less than the other. @param obj2 object to compare this nodeset to @return see this.compare(...) @throws javax.xml.transform.TransformerException
[ "Tell", "if", "one", "object", "is", "less", "than", "the", "other", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/objects/XNodeSet.java#L672-L675
apache/flink
flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/nfa/sharedbuffer/SharedBufferAccessor.java
SharedBufferAccessor.registerEvent
public EventId registerEvent(V value, long timestamp) throws Exception { """ Adds another unique event to the shared buffer and assigns a unique id for it. It automatically creates a lock on this event, so it won't be removed during processing of that event. Therefore the lock should be removed after processing all {@link org.apache.flink.cep.nfa.ComputationState}s <p><b>NOTE:</b>Should be called only once for each unique event! @param value event to be registered @return unique id of that event that should be used when putting entries to the buffer. @throws Exception Thrown if the system cannot access the state. """ return sharedBuffer.registerEvent(value, timestamp); }
java
public EventId registerEvent(V value, long timestamp) throws Exception { return sharedBuffer.registerEvent(value, timestamp); }
[ "public", "EventId", "registerEvent", "(", "V", "value", ",", "long", "timestamp", ")", "throws", "Exception", "{", "return", "sharedBuffer", ".", "registerEvent", "(", "value", ",", "timestamp", ")", ";", "}" ]
Adds another unique event to the shared buffer and assigns a unique id for it. It automatically creates a lock on this event, so it won't be removed during processing of that event. Therefore the lock should be removed after processing all {@link org.apache.flink.cep.nfa.ComputationState}s <p><b>NOTE:</b>Should be called only once for each unique event! @param value event to be registered @return unique id of that event that should be used when putting entries to the buffer. @throws Exception Thrown if the system cannot access the state.
[ "Adds", "another", "unique", "event", "to", "the", "shared", "buffer", "and", "assigns", "a", "unique", "id", "for", "it", ".", "It", "automatically", "creates", "a", "lock", "on", "this", "event", "so", "it", "won", "t", "be", "removed", "during", "processing", "of", "that", "event", ".", "Therefore", "the", "lock", "should", "be", "removed", "after", "processing", "all", "{", "@link", "org", ".", "apache", ".", "flink", ".", "cep", ".", "nfa", ".", "ComputationState", "}", "s" ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/nfa/sharedbuffer/SharedBufferAccessor.java#L73-L75
alkacon/opencms-core
src/org/opencms/module/CmsModuleUpdater.java
CmsModuleUpdater.runImportScript
protected void runImportScript(CmsObject cms, CmsModule module) { """ Runs the module import script. @param cms the CMS context to use @param module the module for which to run the script """ LOG.info("Executing import script for module " + module.getName()); m_report.println( org.opencms.module.Messages.get().container(org.opencms.module.Messages.RPT_IMPORT_SCRIPT_HEADER_0), I_CmsReport.FORMAT_HEADLINE); String importScript = "echo on\n" + module.getImportScript(); ByteArrayOutputStream buffer = new ByteArrayOutputStream(); PrintStream out = new PrintStream(buffer); CmsShell shell = new CmsShell(cms, "${user}@${project}:${siteroot}|${uri}>", null, out, out); shell.execute(importScript); String outputString = buffer.toString(); LOG.info("Shell output for import script was: \n" + outputString); m_report.println( org.opencms.module.Messages.get().container( org.opencms.module.Messages.RPT_IMPORT_SCRIPT_OUTPUT_1, outputString)); }
java
protected void runImportScript(CmsObject cms, CmsModule module) { LOG.info("Executing import script for module " + module.getName()); m_report.println( org.opencms.module.Messages.get().container(org.opencms.module.Messages.RPT_IMPORT_SCRIPT_HEADER_0), I_CmsReport.FORMAT_HEADLINE); String importScript = "echo on\n" + module.getImportScript(); ByteArrayOutputStream buffer = new ByteArrayOutputStream(); PrintStream out = new PrintStream(buffer); CmsShell shell = new CmsShell(cms, "${user}@${project}:${siteroot}|${uri}>", null, out, out); shell.execute(importScript); String outputString = buffer.toString(); LOG.info("Shell output for import script was: \n" + outputString); m_report.println( org.opencms.module.Messages.get().container( org.opencms.module.Messages.RPT_IMPORT_SCRIPT_OUTPUT_1, outputString)); }
[ "protected", "void", "runImportScript", "(", "CmsObject", "cms", ",", "CmsModule", "module", ")", "{", "LOG", ".", "info", "(", "\"Executing import script for module \"", "+", "module", ".", "getName", "(", ")", ")", ";", "m_report", ".", "println", "(", "org", ".", "opencms", ".", "module", ".", "Messages", ".", "get", "(", ")", ".", "container", "(", "org", ".", "opencms", ".", "module", ".", "Messages", ".", "RPT_IMPORT_SCRIPT_HEADER_0", ")", ",", "I_CmsReport", ".", "FORMAT_HEADLINE", ")", ";", "String", "importScript", "=", "\"echo on\\n\"", "+", "module", ".", "getImportScript", "(", ")", ";", "ByteArrayOutputStream", "buffer", "=", "new", "ByteArrayOutputStream", "(", ")", ";", "PrintStream", "out", "=", "new", "PrintStream", "(", "buffer", ")", ";", "CmsShell", "shell", "=", "new", "CmsShell", "(", "cms", ",", "\"${user}@${project}:${siteroot}|${uri}>\"", ",", "null", ",", "out", ",", "out", ")", ";", "shell", ".", "execute", "(", "importScript", ")", ";", "String", "outputString", "=", "buffer", ".", "toString", "(", ")", ";", "LOG", ".", "info", "(", "\"Shell output for import script was: \\n\"", "+", "outputString", ")", ";", "m_report", ".", "println", "(", "org", ".", "opencms", ".", "module", ".", "Messages", ".", "get", "(", ")", ".", "container", "(", "org", ".", "opencms", ".", "module", ".", "Messages", ".", "RPT_IMPORT_SCRIPT_OUTPUT_1", ",", "outputString", ")", ")", ";", "}" ]
Runs the module import script. @param cms the CMS context to use @param module the module for which to run the script
[ "Runs", "the", "module", "import", "script", "." ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/module/CmsModuleUpdater.java#L607-L624
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/WikisApi.java
WikisApi.createPage
public WikiPage createPage(Object projectIdOrPath, String title, String content) throws GitLabApiException { """ Creates a new project wiki page. The user must have permission to create new wiki page. <pre><code>GitLab Endpoint: POST /projects/:id/wikis</code></pre> @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance @param title the title of a snippet, required @param content the content of a wiki page, required @return a WikiPage instance with info on the created page @throws GitLabApiException if any exception occurs """ // one of title or content is required GitLabApiForm formData = new GitLabApiForm() .withParam("title", title) .withParam("content", content); Response response = post(Response.Status.CREATED, formData, "projects", getProjectIdOrPath(projectIdOrPath), "wikis"); return (response.readEntity(WikiPage.class)); }
java
public WikiPage createPage(Object projectIdOrPath, String title, String content) throws GitLabApiException { // one of title or content is required GitLabApiForm formData = new GitLabApiForm() .withParam("title", title) .withParam("content", content); Response response = post(Response.Status.CREATED, formData, "projects", getProjectIdOrPath(projectIdOrPath), "wikis"); return (response.readEntity(WikiPage.class)); }
[ "public", "WikiPage", "createPage", "(", "Object", "projectIdOrPath", ",", "String", "title", ",", "String", "content", ")", "throws", "GitLabApiException", "{", "// one of title or content is required", "GitLabApiForm", "formData", "=", "new", "GitLabApiForm", "(", ")", ".", "withParam", "(", "\"title\"", ",", "title", ")", ".", "withParam", "(", "\"content\"", ",", "content", ")", ";", "Response", "response", "=", "post", "(", "Response", ".", "Status", ".", "CREATED", ",", "formData", ",", "\"projects\"", ",", "getProjectIdOrPath", "(", "projectIdOrPath", ")", ",", "\"wikis\"", ")", ";", "return", "(", "response", ".", "readEntity", "(", "WikiPage", ".", "class", ")", ")", ";", "}" ]
Creates a new project wiki page. The user must have permission to create new wiki page. <pre><code>GitLab Endpoint: POST /projects/:id/wikis</code></pre> @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance @param title the title of a snippet, required @param content the content of a wiki page, required @return a WikiPage instance with info on the created page @throws GitLabApiException if any exception occurs
[ "Creates", "a", "new", "project", "wiki", "page", ".", "The", "user", "must", "have", "permission", "to", "create", "new", "wiki", "page", "." ]
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/WikisApi.java#L123-L132