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
looly/hutool
hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java
FileUtil.getPrintWriter
public static PrintWriter getPrintWriter(String path, String charset, boolean isAppend) throws IORuntimeException { """ 获得一个打印写入对象,可以有print @param path 输出路径,绝对路径 @param charset 字符集 @param isAppend 是否追加 @return 打印对象 @throws IORuntimeException IO异常 """ return new PrintWriter(getWriter(path, charset, isAppend)); }
java
public static PrintWriter getPrintWriter(String path, String charset, boolean isAppend) throws IORuntimeException { return new PrintWriter(getWriter(path, charset, isAppend)); }
[ "public", "static", "PrintWriter", "getPrintWriter", "(", "String", "path", ",", "String", "charset", ",", "boolean", "isAppend", ")", "throws", "IORuntimeException", "{", "return", "new", "PrintWriter", "(", "getWriter", "(", "path", ",", "charset", ",", "isApp...
获得一个打印写入对象,可以有print @param path 输出路径,绝对路径 @param charset 字符集 @param isAppend 是否追加 @return 打印对象 @throws IORuntimeException IO异常
[ "获得一个打印写入对象,可以有print" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L2637-L2639
aNNiMON/Lightweight-Stream-API
stream/src/main/java/com/annimon/stream/ComparatorCompat.java
ComparatorCompat.comparingDouble
@NotNull public static <T> ComparatorCompat<T> comparingDouble( @NotNull final ToDoubleFunction<? super T> keyExtractor) { """ Returns a comparator that uses a function that extracts a {@code double} sort key to be compared. @param <T> the type of the objects compared by the comparator @param keyExtractor the function that extracts the sort key @return a comparator @throws NullPointerException if {@code keyExtractor} is null """ Objects.requireNonNull(keyExtractor); return new ComparatorCompat<T>(new Comparator<T>() { @Override public int compare(T t1, T t2) { final double d1 = keyExtractor.applyAsDouble(t1); final double d2 = keyExtractor.applyAsDouble(t2); return Double.compare(d1, d2); } }); }
java
@NotNull public static <T> ComparatorCompat<T> comparingDouble( @NotNull final ToDoubleFunction<? super T> keyExtractor) { Objects.requireNonNull(keyExtractor); return new ComparatorCompat<T>(new Comparator<T>() { @Override public int compare(T t1, T t2) { final double d1 = keyExtractor.applyAsDouble(t1); final double d2 = keyExtractor.applyAsDouble(t2); return Double.compare(d1, d2); } }); }
[ "@", "NotNull", "public", "static", "<", "T", ">", "ComparatorCompat", "<", "T", ">", "comparingDouble", "(", "@", "NotNull", "final", "ToDoubleFunction", "<", "?", "super", "T", ">", "keyExtractor", ")", "{", "Objects", ".", "requireNonNull", "(", "keyExtra...
Returns a comparator that uses a function that extracts a {@code double} sort key to be compared. @param <T> the type of the objects compared by the comparator @param keyExtractor the function that extracts the sort key @return a comparator @throws NullPointerException if {@code keyExtractor} is null
[ "Returns", "a", "comparator", "that", "uses", "a", "function", "that", "extracts", "a", "{", "@code", "double", "}", "sort", "key", "to", "be", "compared", "." ]
train
https://github.com/aNNiMON/Lightweight-Stream-API/blob/f29fd57208c20252a4549b084d55ed082c3e58f0/stream/src/main/java/com/annimon/stream/ComparatorCompat.java#L210-L223
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/TransformerIdentityImpl.java
TransformerIdentityImpl.startDTD
public void startDTD(String name, String publicId, String systemId) throws SAXException { """ Report the start of DTD declarations, if any. <p>Any declarations are assumed to be in the internal subset unless otherwise indicated by a {@link #startEntity startEntity} event.</p> <p>Note that the start/endDTD events will appear within the start/endDocument events from ContentHandler and before the first startElement event.</p> @param name The document type name. @param publicId The declared public identifier for the external DTD subset, or null if none was declared. @param systemId The declared system identifier for the external DTD subset, or null if none was declared. @throws SAXException The application may raise an exception. @see #endDTD @see #startEntity """ flushStartDoc(); if (null != m_resultLexicalHandler) m_resultLexicalHandler.startDTD(name, publicId, systemId); }
java
public void startDTD(String name, String publicId, String systemId) throws SAXException { flushStartDoc(); if (null != m_resultLexicalHandler) m_resultLexicalHandler.startDTD(name, publicId, systemId); }
[ "public", "void", "startDTD", "(", "String", "name", ",", "String", "publicId", ",", "String", "systemId", ")", "throws", "SAXException", "{", "flushStartDoc", "(", ")", ";", "if", "(", "null", "!=", "m_resultLexicalHandler", ")", "m_resultLexicalHandler", ".", ...
Report the start of DTD declarations, if any. <p>Any declarations are assumed to be in the internal subset unless otherwise indicated by a {@link #startEntity startEntity} event.</p> <p>Note that the start/endDTD events will appear within the start/endDocument events from ContentHandler and before the first startElement event.</p> @param name The document type name. @param publicId The declared public identifier for the external DTD subset, or null if none was declared. @param systemId The declared system identifier for the external DTD subset, or null if none was declared. @throws SAXException The application may raise an exception. @see #endDTD @see #startEntity
[ "Report", "the", "start", "of", "DTD", "declarations", "if", "any", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/TransformerIdentityImpl.java#L1219-L1225
gallandarakhneorg/afc
advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/mapelement/MapElement.java
MapElement.boundsIntersects
@Pure protected final boolean boundsIntersects(Shape2D<?, ?, ?, ?, ?, ? extends Rectangle2afp<?, ?, ?, ?, ?, ?>> rectangle) { """ Replies if the bounds of this element has an intersection with the specified rectangle. @param rectangle the rectangle. @return <code>true</code> if this bounds is intersecting the specified area, otherwise <code>false</code> """ final Rectangle2d bounds = getBoundingBox(); assert bounds != null; return bounds.intersects(rectangle); }
java
@Pure protected final boolean boundsIntersects(Shape2D<?, ?, ?, ?, ?, ? extends Rectangle2afp<?, ?, ?, ?, ?, ?>> rectangle) { final Rectangle2d bounds = getBoundingBox(); assert bounds != null; return bounds.intersects(rectangle); }
[ "@", "Pure", "protected", "final", "boolean", "boundsIntersects", "(", "Shape2D", "<", "?", ",", "?", ",", "?", ",", "?", ",", "?", ",", "?", "extends", "Rectangle2afp", "<", "?", ",", "?", ",", "?", ",", "?", ",", "?", ",", "?", ">", ">", "rec...
Replies if the bounds of this element has an intersection with the specified rectangle. @param rectangle the rectangle. @return <code>true</code> if this bounds is intersecting the specified area, otherwise <code>false</code>
[ "Replies", "if", "the", "bounds", "of", "this", "element", "has", "an", "intersection", "with", "the", "specified", "rectangle", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/mapelement/MapElement.java#L455-L460
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/time/DateUtils.java
DateUtils.getFragmentInSeconds
@GwtIncompatible("incompatible method") public static long getFragmentInSeconds(final Date date, final int fragment) { """ <p>Returns the number of seconds within the fragment. All datefields greater than the fragment will be ignored.</p> <p>Asking the seconds of any date will only return the number of seconds of the current minute (resulting in a number between 0 and 59). This method will retrieve the number of seconds for any fragment. For example, if you want to calculate the number of seconds past today, your fragment is Calendar.DATE or Calendar.DAY_OF_YEAR. The result will be all seconds of the past hour(s) and minutes(s).</p> <p>Valid fragments are: Calendar.YEAR, Calendar.MONTH, both Calendar.DAY_OF_YEAR and Calendar.DATE, Calendar.HOUR_OF_DAY, Calendar.MINUTE, Calendar.SECOND and Calendar.MILLISECOND A fragment less than or equal to a SECOND field will return 0.</p> <ul> <li>January 1, 2008 7:15:10.538 with Calendar.MINUTE as fragment will return 10 (equivalent to deprecated date.getSeconds())</li> <li>January 6, 2008 7:15:10.538 with Calendar.MINUTE as fragment will return 10 (equivalent to deprecated date.getSeconds())</li> <li>January 6, 2008 7:15:10.538 with Calendar.DAY_OF_YEAR as fragment will return 26110 (7*3600 + 15*60 + 10)</li> <li>January 16, 2008 7:15:10.538 with Calendar.MILLISECOND as fragment will return 0 (a millisecond cannot be split in seconds)</li> </ul> @param date the date to work with, not null @param fragment the {@code Calendar} field part of date to calculate @return number of seconds within the fragment of date @throws IllegalArgumentException if the date is <code>null</code> or fragment is not supported @since 2.4 """ return getFragment(date, fragment, TimeUnit.SECONDS); }
java
@GwtIncompatible("incompatible method") public static long getFragmentInSeconds(final Date date, final int fragment) { return getFragment(date, fragment, TimeUnit.SECONDS); }
[ "@", "GwtIncompatible", "(", "\"incompatible method\"", ")", "public", "static", "long", "getFragmentInSeconds", "(", "final", "Date", "date", ",", "final", "int", "fragment", ")", "{", "return", "getFragment", "(", "date", ",", "fragment", ",", "TimeUnit", ".",...
<p>Returns the number of seconds within the fragment. All datefields greater than the fragment will be ignored.</p> <p>Asking the seconds of any date will only return the number of seconds of the current minute (resulting in a number between 0 and 59). This method will retrieve the number of seconds for any fragment. For example, if you want to calculate the number of seconds past today, your fragment is Calendar.DATE or Calendar.DAY_OF_YEAR. The result will be all seconds of the past hour(s) and minutes(s).</p> <p>Valid fragments are: Calendar.YEAR, Calendar.MONTH, both Calendar.DAY_OF_YEAR and Calendar.DATE, Calendar.HOUR_OF_DAY, Calendar.MINUTE, Calendar.SECOND and Calendar.MILLISECOND A fragment less than or equal to a SECOND field will return 0.</p> <ul> <li>January 1, 2008 7:15:10.538 with Calendar.MINUTE as fragment will return 10 (equivalent to deprecated date.getSeconds())</li> <li>January 6, 2008 7:15:10.538 with Calendar.MINUTE as fragment will return 10 (equivalent to deprecated date.getSeconds())</li> <li>January 6, 2008 7:15:10.538 with Calendar.DAY_OF_YEAR as fragment will return 26110 (7*3600 + 15*60 + 10)</li> <li>January 16, 2008 7:15:10.538 with Calendar.MILLISECOND as fragment will return 0 (a millisecond cannot be split in seconds)</li> </ul> @param date the date to work with, not null @param fragment the {@code Calendar} field part of date to calculate @return number of seconds within the fragment of date @throws IllegalArgumentException if the date is <code>null</code> or fragment is not supported @since 2.4
[ "<p", ">", "Returns", "the", "number", "of", "seconds", "within", "the", "fragment", ".", "All", "datefields", "greater", "than", "the", "fragment", "will", "be", "ignored", ".", "<", "/", "p", ">" ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/time/DateUtils.java#L1335-L1338
jtablesaw/tablesaw
core/src/main/java/tech/tablesaw/api/Table.java
Table.xTabCounts
public Table xTabCounts(String column1Name, String column2Name) { """ Returns a table with n by m + 1 cells. The first column contains labels, the other cells contains the counts for every unique combination of values from the two specified columns in this table """ return CrossTab.counts(this, categoricalColumn(column1Name), categoricalColumn(column2Name)); }
java
public Table xTabCounts(String column1Name, String column2Name) { return CrossTab.counts(this, categoricalColumn(column1Name), categoricalColumn(column2Name)); }
[ "public", "Table", "xTabCounts", "(", "String", "column1Name", ",", "String", "column2Name", ")", "{", "return", "CrossTab", ".", "counts", "(", "this", ",", "categoricalColumn", "(", "column1Name", ")", ",", "categoricalColumn", "(", "column2Name", ")", ")", ...
Returns a table with n by m + 1 cells. The first column contains labels, the other cells contains the counts for every unique combination of values from the two specified columns in this table
[ "Returns", "a", "table", "with", "n", "by", "m", "+", "1", "cells", ".", "The", "first", "column", "contains", "labels", "the", "other", "cells", "contains", "the", "counts", "for", "every", "unique", "combination", "of", "values", "from", "the", "two", ...
train
https://github.com/jtablesaw/tablesaw/blob/68a75b4098ac677e9486df5572cf13ec39f9f701/core/src/main/java/tech/tablesaw/api/Table.java#L923-L925
Deep-Symmetry/beat-link
src/main/java/org/deepsymmetry/beatlink/Util.java
Util.numberToBytes
public static void numberToBytes(int number, byte[] buffer, int start, int length) { """ Writes a number to the specified byte array field, breaking it into its component bytes in big-endian order. If the number is too large to fit in the specified number of bytes, only the low-order bytes are written. @param number the number to be written to the array @param buffer the buffer to which the number should be written @param start where the high-order byte should be written @param length how many bytes of the number should be written """ for (int index = start + length - 1; index >= start; index--) { buffer[index] = (byte)(number & 0xff); number = number >> 8; } }
java
public static void numberToBytes(int number, byte[] buffer, int start, int length) { for (int index = start + length - 1; index >= start; index--) { buffer[index] = (byte)(number & 0xff); number = number >> 8; } }
[ "public", "static", "void", "numberToBytes", "(", "int", "number", ",", "byte", "[", "]", "buffer", ",", "int", "start", ",", "int", "length", ")", "{", "for", "(", "int", "index", "=", "start", "+", "length", "-", "1", ";", "index", ">=", "start", ...
Writes a number to the specified byte array field, breaking it into its component bytes in big-endian order. If the number is too large to fit in the specified number of bytes, only the low-order bytes are written. @param number the number to be written to the array @param buffer the buffer to which the number should be written @param start where the high-order byte should be written @param length how many bytes of the number should be written
[ "Writes", "a", "number", "to", "the", "specified", "byte", "array", "field", "breaking", "it", "into", "its", "component", "bytes", "in", "big", "-", "endian", "order", ".", "If", "the", "number", "is", "too", "large", "to", "fit", "in", "the", "specifie...
train
https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/Util.java#L277-L282
Azure/azure-sdk-for-java
recoveryservices.backup/resource-manager/v2016_12_01/src/main/java/com/microsoft/azure/management/recoveryservices/backup/v2016_12_01/implementation/BackupsInner.java
BackupsInner.triggerAsync
public Observable<Void> triggerAsync(String vaultName, String resourceGroupName, String fabricName, String containerName, String protectedItemName, BackupRequestResource parameters) { """ Triggers backup for specified backed up item. This is an asynchronous operation. To know the status of the operation, call GetProtectedItemOperationResult API. @param vaultName The name of the recovery services vault. @param resourceGroupName The name of the resource group where the recovery services vault is present. @param fabricName Fabric name associated with the backup item. @param containerName Container name associated with the backup item. @param protectedItemName Backup item for which backup needs to be triggered. @param parameters resource backup request @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful. """ return triggerWithServiceResponseAsync(vaultName, resourceGroupName, fabricName, containerName, protectedItemName, parameters).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
java
public Observable<Void> triggerAsync(String vaultName, String resourceGroupName, String fabricName, String containerName, String protectedItemName, BackupRequestResource parameters) { return triggerWithServiceResponseAsync(vaultName, resourceGroupName, fabricName, containerName, protectedItemName, parameters).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "triggerAsync", "(", "String", "vaultName", ",", "String", "resourceGroupName", ",", "String", "fabricName", ",", "String", "containerName", ",", "String", "protectedItemName", ",", "BackupRequestResource", "parameters", ")", ...
Triggers backup for specified backed up item. This is an asynchronous operation. To know the status of the operation, call GetProtectedItemOperationResult API. @param vaultName The name of the recovery services vault. @param resourceGroupName The name of the resource group where the recovery services vault is present. @param fabricName Fabric name associated with the backup item. @param containerName Container name associated with the backup item. @param protectedItemName Backup item for which backup needs to be triggered. @param parameters resource backup request @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful.
[ "Triggers", "backup", "for", "specified", "backed", "up", "item", ".", "This", "is", "an", "asynchronous", "operation", ".", "To", "know", "the", "status", "of", "the", "operation", "call", "GetProtectedItemOperationResult", "API", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/recoveryservices.backup/resource-manager/v2016_12_01/src/main/java/com/microsoft/azure/management/recoveryservices/backup/v2016_12_01/implementation/BackupsInner.java#L109-L116
google/j2objc
jre_emul/android/platform/libcore/luni/src/main/java/libcore/net/UriCodec.java
UriCodec.validateSimple
public static void validateSimple(String s, String legal) throws URISyntaxException { """ Throws if {@code s} contains characters that are not letters, digits or in {@code legal}. """ for (int i = 0; i < s.length(); i++) { char ch = s.charAt(i); if (!((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || (ch >= '0' && ch <= '9') || legal.indexOf(ch) > -1)) { throw new URISyntaxException(s, "Illegal character", i); } } }
java
public static void validateSimple(String s, String legal) throws URISyntaxException { for (int i = 0; i < s.length(); i++) { char ch = s.charAt(i); if (!((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || (ch >= '0' && ch <= '9') || legal.indexOf(ch) > -1)) { throw new URISyntaxException(s, "Illegal character", i); } } }
[ "public", "static", "void", "validateSimple", "(", "String", "s", ",", "String", "legal", ")", "throws", "URISyntaxException", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "s", ".", "length", "(", ")", ";", "i", "++", ")", "{", "char", "ch...
Throws if {@code s} contains characters that are not letters, digits or in {@code legal}.
[ "Throws", "if", "{" ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/libcore/net/UriCodec.java#L73-L84
Azure/azure-sdk-for-java
sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedBackupShortTermRetentionPoliciesInner.java
ManagedBackupShortTermRetentionPoliciesInner.beginCreateOrUpdateAsync
public Observable<ManagedBackupShortTermRetentionPolicyInner> beginCreateOrUpdateAsync(String resourceGroupName, String managedInstanceName, String databaseName, Integer retentionDays) { """ Updates a managed database's short term retention policy. @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 managedInstanceName The name of the managed instance. @param databaseName The name of the database. @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ManagedBackupShortTermRetentionPolicyInner object """ return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, retentionDays).map(new Func1<ServiceResponse<ManagedBackupShortTermRetentionPolicyInner>, ManagedBackupShortTermRetentionPolicyInner>() { @Override public ManagedBackupShortTermRetentionPolicyInner call(ServiceResponse<ManagedBackupShortTermRetentionPolicyInner> response) { return response.body(); } }); }
java
public Observable<ManagedBackupShortTermRetentionPolicyInner> beginCreateOrUpdateAsync(String resourceGroupName, String managedInstanceName, String databaseName, Integer retentionDays) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, retentionDays).map(new Func1<ServiceResponse<ManagedBackupShortTermRetentionPolicyInner>, ManagedBackupShortTermRetentionPolicyInner>() { @Override public ManagedBackupShortTermRetentionPolicyInner call(ServiceResponse<ManagedBackupShortTermRetentionPolicyInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ManagedBackupShortTermRetentionPolicyInner", ">", "beginCreateOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "managedInstanceName", ",", "String", "databaseName", ",", "Integer", "retentionDays", ")", "{", "return", "beginCr...
Updates a managed database's short term retention policy. @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 managedInstanceName The name of the managed instance. @param databaseName The name of the database. @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ManagedBackupShortTermRetentionPolicyInner object
[ "Updates", "a", "managed", "database", "s", "short", "term", "retention", "policy", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedBackupShortTermRetentionPoliciesInner.java#L480-L487
gsi-upm/Shanks
shanks-core/src/main/java/es/upm/dit/gsi/shanks/agent/capability/reasoning/bayes/smile/ShanksAgentBayesianReasoningCapability.java
ShanksAgentBayesianReasoningCapability.addEvidences
public static void addEvidences(Network bn, Map<String, String> evidences) throws ShanksException { """ Add a set of evidences to the Bayesian network to reason with it. @param bn @param evidences map in format [nodeName, status] to set evidences in the bayesian network @throws ShanksException """ if (bn == null || evidences.isEmpty()) { throw new ShanksException("Null parameter in addEvidences method."); } for (Entry<String, String> evidence : evidences.entrySet()) { ShanksAgentBayesianReasoningCapability.addEvidence(bn, evidence.getKey(), evidence.getValue()); } }
java
public static void addEvidences(Network bn, Map<String, String> evidences) throws ShanksException { if (bn == null || evidences.isEmpty()) { throw new ShanksException("Null parameter in addEvidences method."); } for (Entry<String, String> evidence : evidences.entrySet()) { ShanksAgentBayesianReasoningCapability.addEvidence(bn, evidence.getKey(), evidence.getValue()); } }
[ "public", "static", "void", "addEvidences", "(", "Network", "bn", ",", "Map", "<", "String", ",", "String", ">", "evidences", ")", "throws", "ShanksException", "{", "if", "(", "bn", "==", "null", "||", "evidences", ".", "isEmpty", "(", ")", ")", "{", "...
Add a set of evidences to the Bayesian network to reason with it. @param bn @param evidences map in format [nodeName, status] to set evidences in the bayesian network @throws ShanksException
[ "Add", "a", "set", "of", "evidences", "to", "the", "Bayesian", "network", "to", "reason", "with", "it", "." ]
train
https://github.com/gsi-upm/Shanks/blob/35d87a81c22731f4f83bbd0571c9c6d466bd16be/shanks-core/src/main/java/es/upm/dit/gsi/shanks/agent/capability/reasoning/bayes/smile/ShanksAgentBayesianReasoningCapability.java#L399-L408
aws/aws-sdk-java
aws-java-sdk-core/src/main/java/com/amazonaws/util/XpathUtils.java
XpathUtils.asDate
public static Date asDate(String expression, Node node, XPath xpath) throws XPathExpressionException { """ Same as {@link #asDate(String, Node)} but allows an xpath to be passed in explicitly for reuse. """ String dateString = evaluateAsString(expression, node, xpath); if (isEmptyString(dateString)) return null; try { return DateUtils.parseISO8601Date(dateString); } catch (Exception e) { log.warn("Unable to parse date '" + dateString + "': " + e.getMessage(), e); return null; } }
java
public static Date asDate(String expression, Node node, XPath xpath) throws XPathExpressionException { String dateString = evaluateAsString(expression, node, xpath); if (isEmptyString(dateString)) return null; try { return DateUtils.parseISO8601Date(dateString); } catch (Exception e) { log.warn("Unable to parse date '" + dateString + "': " + e.getMessage(), e); return null; } }
[ "public", "static", "Date", "asDate", "(", "String", "expression", ",", "Node", "node", ",", "XPath", "xpath", ")", "throws", "XPathExpressionException", "{", "String", "dateString", "=", "evaluateAsString", "(", "expression", ",", "node", ",", "xpath", ")", "...
Same as {@link #asDate(String, Node)} but allows an xpath to be passed in explicitly for reuse.
[ "Same", "as", "{" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-core/src/main/java/com/amazonaws/util/XpathUtils.java#L462-L473
zxing/zxing
core/src/main/java/com/google/zxing/qrcode/detector/Detector.java
Detector.calculateModuleSizeOneWay
private float calculateModuleSizeOneWay(ResultPoint pattern, ResultPoint otherPattern) { """ <p>Estimates module size based on two finder patterns -- it uses {@link #sizeOfBlackWhiteBlackRunBothWays(int, int, int, int)} to figure the width of each, measuring along the axis between their centers.</p> """ float moduleSizeEst1 = sizeOfBlackWhiteBlackRunBothWays((int) pattern.getX(), (int) pattern.getY(), (int) otherPattern.getX(), (int) otherPattern.getY()); float moduleSizeEst2 = sizeOfBlackWhiteBlackRunBothWays((int) otherPattern.getX(), (int) otherPattern.getY(), (int) pattern.getX(), (int) pattern.getY()); if (Float.isNaN(moduleSizeEst1)) { return moduleSizeEst2 / 7.0f; } if (Float.isNaN(moduleSizeEst2)) { return moduleSizeEst1 / 7.0f; } // Average them, and divide by 7 since we've counted the width of 3 black modules, // and 1 white and 1 black module on either side. Ergo, divide sum by 14. return (moduleSizeEst1 + moduleSizeEst2) / 14.0f; }
java
private float calculateModuleSizeOneWay(ResultPoint pattern, ResultPoint otherPattern) { float moduleSizeEst1 = sizeOfBlackWhiteBlackRunBothWays((int) pattern.getX(), (int) pattern.getY(), (int) otherPattern.getX(), (int) otherPattern.getY()); float moduleSizeEst2 = sizeOfBlackWhiteBlackRunBothWays((int) otherPattern.getX(), (int) otherPattern.getY(), (int) pattern.getX(), (int) pattern.getY()); if (Float.isNaN(moduleSizeEst1)) { return moduleSizeEst2 / 7.0f; } if (Float.isNaN(moduleSizeEst2)) { return moduleSizeEst1 / 7.0f; } // Average them, and divide by 7 since we've counted the width of 3 black modules, // and 1 white and 1 black module on either side. Ergo, divide sum by 14. return (moduleSizeEst1 + moduleSizeEst2) / 14.0f; }
[ "private", "float", "calculateModuleSizeOneWay", "(", "ResultPoint", "pattern", ",", "ResultPoint", "otherPattern", ")", "{", "float", "moduleSizeEst1", "=", "sizeOfBlackWhiteBlackRunBothWays", "(", "(", "int", ")", "pattern", ".", "getX", "(", ")", ",", "(", "int...
<p>Estimates module size based on two finder patterns -- it uses {@link #sizeOfBlackWhiteBlackRunBothWays(int, int, int, int)} to figure the width of each, measuring along the axis between their centers.</p>
[ "<p", ">", "Estimates", "module", "size", "based", "on", "two", "finder", "patterns", "--", "it", "uses", "{" ]
train
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/qrcode/detector/Detector.java#L241-L259
janus-project/guava.janusproject.io
guava/src/com/google/common/collect/SortedIterables.java
SortedIterables.hasSameComparator
public static boolean hasSameComparator(Comparator<?> comparator, Iterable<?> elements) { """ Returns {@code true} if {@code elements} is a sorted collection using an ordering equivalent to {@code comparator}. """ checkNotNull(comparator); checkNotNull(elements); Comparator<?> comparator2; if (elements instanceof SortedSet) { comparator2 = comparator((SortedSet<?>) elements); } else if (elements instanceof SortedIterable) { comparator2 = ((SortedIterable<?>) elements).comparator(); } else { return false; } return comparator.equals(comparator2); }
java
public static boolean hasSameComparator(Comparator<?> comparator, Iterable<?> elements) { checkNotNull(comparator); checkNotNull(elements); Comparator<?> comparator2; if (elements instanceof SortedSet) { comparator2 = comparator((SortedSet<?>) elements); } else if (elements instanceof SortedIterable) { comparator2 = ((SortedIterable<?>) elements).comparator(); } else { return false; } return comparator.equals(comparator2); }
[ "public", "static", "boolean", "hasSameComparator", "(", "Comparator", "<", "?", ">", "comparator", ",", "Iterable", "<", "?", ">", "elements", ")", "{", "checkNotNull", "(", "comparator", ")", ";", "checkNotNull", "(", "elements", ")", ";", "Comparator", "<...
Returns {@code true} if {@code elements} is a sorted collection using an ordering equivalent to {@code comparator}.
[ "Returns", "{" ]
train
https://github.com/janus-project/guava.janusproject.io/blob/1c48fb672c9fdfddf276970570f703fa1115f588/guava/src/com/google/common/collect/SortedIterables.java#L37-L49
magro/memcached-session-manager
core/src/main/java/de/javakaffee/web/msm/LRUCache.java
LRUCache.getKeysSortedByValue
public List<K> getKeysSortedByValue( final Comparator<V> comparator ) { """ The keys sorted by the given value comparator. @return the underlying set, see {@link LinkedHashMap#keySet()}. """ synchronized ( _map ) { @SuppressWarnings( "unchecked" ) final Entry<K, ManagedItem<V>>[] a = _map.entrySet().toArray( new Map.Entry[_map.size()] ); final Comparator<Entry<K, ManagedItem<V>>> c = new Comparator<Entry<K, ManagedItem<V>>>() { @Override public int compare( final Entry<K, ManagedItem<V>> o1, final Entry<K, ManagedItem<V>> o2 ) { return comparator.compare( o1.getValue()._value, o2.getValue()._value ); } }; Arrays.sort(a, c); return new LRUCache.ArrayList<K, V>( a ); } }
java
public List<K> getKeysSortedByValue( final Comparator<V> comparator ) { synchronized ( _map ) { @SuppressWarnings( "unchecked" ) final Entry<K, ManagedItem<V>>[] a = _map.entrySet().toArray( new Map.Entry[_map.size()] ); final Comparator<Entry<K, ManagedItem<V>>> c = new Comparator<Entry<K, ManagedItem<V>>>() { @Override public int compare( final Entry<K, ManagedItem<V>> o1, final Entry<K, ManagedItem<V>> o2 ) { return comparator.compare( o1.getValue()._value, o2.getValue()._value ); } }; Arrays.sort(a, c); return new LRUCache.ArrayList<K, V>( a ); } }
[ "public", "List", "<", "K", ">", "getKeysSortedByValue", "(", "final", "Comparator", "<", "V", ">", "comparator", ")", "{", "synchronized", "(", "_map", ")", "{", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "final", "Entry", "<", "K", ",", "Managed...
The keys sorted by the given value comparator. @return the underlying set, see {@link LinkedHashMap#keySet()}.
[ "The", "keys", "sorted", "by", "the", "given", "value", "comparator", "." ]
train
https://github.com/magro/memcached-session-manager/blob/716e147c9840ab10298c4d2b9edd0662058331e6/core/src/main/java/de/javakaffee/web/msm/LRUCache.java#L202-L218
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPOptionValuePersistenceImpl.java
CPOptionValuePersistenceImpl.findByCPOptionId
@Override public List<CPOptionValue> findByCPOptionId(long CPOptionId, int start, int end, OrderByComparator<CPOptionValue> orderByComparator) { """ Returns an ordered range of all the cp option values where CPOptionId = &#63;. <p> Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CPOptionValueModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. </p> @param CPOptionId the cp option ID @param start the lower bound of the range of cp option values @param end the upper bound of the range of cp option values (not inclusive) @param orderByComparator the comparator to order the results by (optionally <code>null</code>) @return the ordered range of matching cp option values """ return findByCPOptionId(CPOptionId, start, end, orderByComparator, true); }
java
@Override public List<CPOptionValue> findByCPOptionId(long CPOptionId, int start, int end, OrderByComparator<CPOptionValue> orderByComparator) { return findByCPOptionId(CPOptionId, start, end, orderByComparator, true); }
[ "@", "Override", "public", "List", "<", "CPOptionValue", ">", "findByCPOptionId", "(", "long", "CPOptionId", ",", "int", "start", ",", "int", "end", ",", "OrderByComparator", "<", "CPOptionValue", ">", "orderByComparator", ")", "{", "return", "findByCPOptionId", ...
Returns an ordered range of all the cp option values where CPOptionId = &#63;. <p> Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CPOptionValueModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. </p> @param CPOptionId the cp option ID @param start the lower bound of the range of cp option values @param end the upper bound of the range of cp option values (not inclusive) @param orderByComparator the comparator to order the results by (optionally <code>null</code>) @return the ordered range of matching cp option values
[ "Returns", "an", "ordered", "range", "of", "all", "the", "cp", "option", "values", "where", "CPOptionId", "=", "&#63", ";", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPOptionValuePersistenceImpl.java#L2564-L2568
google/closure-compiler
src/com/google/javascript/jscomp/SourceMapResolver.java
SourceMapResolver.getRelativePath
@Nullable static SourceFile getRelativePath(String baseFilePath, String relativePath) { """ Returns the relative path, resolved relative to the base path, where the base path is interpreted as a filename rather than a directory. E.g.: getRelativeTo("../foo/bar.js", "baz/bam/qux.js") --> "baz/foo/bar.js" """ return SourceFile.fromPath( FileSystems.getDefault().getPath(baseFilePath).resolveSibling(relativePath).normalize(), UTF_8); }
java
@Nullable static SourceFile getRelativePath(String baseFilePath, String relativePath) { return SourceFile.fromPath( FileSystems.getDefault().getPath(baseFilePath).resolveSibling(relativePath).normalize(), UTF_8); }
[ "@", "Nullable", "static", "SourceFile", "getRelativePath", "(", "String", "baseFilePath", ",", "String", "relativePath", ")", "{", "return", "SourceFile", ".", "fromPath", "(", "FileSystems", ".", "getDefault", "(", ")", ".", "getPath", "(", "baseFilePath", ")"...
Returns the relative path, resolved relative to the base path, where the base path is interpreted as a filename rather than a directory. E.g.: getRelativeTo("../foo/bar.js", "baz/bam/qux.js") --> "baz/foo/bar.js"
[ "Returns", "the", "relative", "path", "resolved", "relative", "to", "the", "base", "path", "where", "the", "base", "path", "is", "interpreted", "as", "a", "filename", "rather", "than", "a", "directory", ".", "E", ".", "g", ".", ":", "getRelativeTo", "(", ...
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/SourceMapResolver.java#L99-L104
grycap/coreutils
coreutils-common/src/main/java/es/upv/grycap/coreutils/common/config/Configurer.java
Configurer.loadConfig
public Config loadConfig(final @Nullable String confname, final String rootPath) { """ Loads and merges application configuration with default properties. @param confname - optional configuration filename @param rootPath - only load configuration properties underneath this path that this code module owns and understands @return Configuration loaded from the provided filename or from default properties. """ // load configuration properties Config config; final String confname2 = trimToNull(confname); if (confname2 != null) { final ConfigParseOptions options = ConfigParseOptions.defaults().setAllowMissing(false); final Config customConfig = ConfigFactory.parseFileAnySyntax(new File(confname2), options); final Config regularConfig = ConfigFactory.load(); final Config combined = customConfig.withFallback(regularConfig); config = ConfigFactory.load(combined); } else { config = ConfigFactory.load(); } // validate config.checkValid(ConfigFactory.defaultReference(), rootPath); return config; }
java
public Config loadConfig(final @Nullable String confname, final String rootPath) { // load configuration properties Config config; final String confname2 = trimToNull(confname); if (confname2 != null) { final ConfigParseOptions options = ConfigParseOptions.defaults().setAllowMissing(false); final Config customConfig = ConfigFactory.parseFileAnySyntax(new File(confname2), options); final Config regularConfig = ConfigFactory.load(); final Config combined = customConfig.withFallback(regularConfig); config = ConfigFactory.load(combined); } else { config = ConfigFactory.load(); } // validate config.checkValid(ConfigFactory.defaultReference(), rootPath); return config; }
[ "public", "Config", "loadConfig", "(", "final", "@", "Nullable", "String", "confname", ",", "final", "String", "rootPath", ")", "{", "// load configuration properties", "Config", "config", ";", "final", "String", "confname2", "=", "trimToNull", "(", "confname", ")...
Loads and merges application configuration with default properties. @param confname - optional configuration filename @param rootPath - only load configuration properties underneath this path that this code module owns and understands @return Configuration loaded from the provided filename or from default properties.
[ "Loads", "and", "merges", "application", "configuration", "with", "default", "properties", "." ]
train
https://github.com/grycap/coreutils/blob/e6db61dc50b49ea7276c0c29c7401204681a10c2/coreutils-common/src/main/java/es/upv/grycap/coreutils/common/config/Configurer.java#L51-L67
kaazing/gateway
mina.core/core/src/main/java/org/apache/mina/filter/statistic/ProfilerTimerFilter.java
ProfilerTimerFilter.sessionOpened
@Override public void sessionOpened(NextFilter nextFilter, IoSession session) throws Exception { """ Profile a SessionOpened event. This method will gather the following informations : - the method duration - the shortest execution time - the slowest execution time - the average execution time - the global number of calls @param nextFilter The filter to call next @param session The associated session """ if (profileSessionOpened) { long start = timeNow(); nextFilter.sessionOpened(session); long end = timeNow(); sessionOpenedTimerWorker.addNewDuration(end - start); } else { nextFilter.sessionOpened(session); } }
java
@Override public void sessionOpened(NextFilter nextFilter, IoSession session) throws Exception { if (profileSessionOpened) { long start = timeNow(); nextFilter.sessionOpened(session); long end = timeNow(); sessionOpenedTimerWorker.addNewDuration(end - start); } else { nextFilter.sessionOpened(session); } }
[ "@", "Override", "public", "void", "sessionOpened", "(", "NextFilter", "nextFilter", ",", "IoSession", "session", ")", "throws", "Exception", "{", "if", "(", "profileSessionOpened", ")", "{", "long", "start", "=", "timeNow", "(", ")", ";", "nextFilter", ".", ...
Profile a SessionOpened event. This method will gather the following informations : - the method duration - the shortest execution time - the slowest execution time - the average execution time - the global number of calls @param nextFilter The filter to call next @param session The associated session
[ "Profile", "a", "SessionOpened", "event", ".", "This", "method", "will", "gather", "the", "following", "informations", ":", "-", "the", "method", "duration", "-", "the", "shortest", "execution", "time", "-", "the", "slowest", "execution", "time", "-", "the", ...
train
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.core/core/src/main/java/org/apache/mina/filter/statistic/ProfilerTimerFilter.java#L414-L425
aspectran/aspectran
core/src/main/java/com/aspectran/core/util/ReflectionUtils.java
ReflectionUtils.getField
public static Object getField(Field field, Object target) { """ Get the field represented by the supplied {@link Field field object} on the specified {@link Object target object}. In accordance with {@link Field#get(Object)} semantics, the returned value is automatically wrapped if the underlying field has a primitive type. @param field the field to get @param target the target object from which to get the field @return the field's current value """ try { return field.get(target); } catch (IllegalAccessException e) { throw new IllegalStateException("Could not access field: " + field, e); } }
java
public static Object getField(Field field, Object target) { try { return field.get(target); } catch (IllegalAccessException e) { throw new IllegalStateException("Could not access field: " + field, e); } }
[ "public", "static", "Object", "getField", "(", "Field", "field", ",", "Object", "target", ")", "{", "try", "{", "return", "field", ".", "get", "(", "target", ")", ";", "}", "catch", "(", "IllegalAccessException", "e", ")", "{", "throw", "new", "IllegalSt...
Get the field represented by the supplied {@link Field field object} on the specified {@link Object target object}. In accordance with {@link Field#get(Object)} semantics, the returned value is automatically wrapped if the underlying field has a primitive type. @param field the field to get @param target the target object from which to get the field @return the field's current value
[ "Get", "the", "field", "represented", "by", "the", "supplied", "{", "@link", "Field", "field", "object", "}", "on", "the", "specified", "{", "@link", "Object", "target", "object", "}", ".", "In", "accordance", "with", "{", "@link", "Field#get", "(", "Objec...
train
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/util/ReflectionUtils.java#L40-L46
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WSubordinateControlRenderer.java
WSubordinateControlRenderer.doRender
@Override public void doRender(final WComponent component, final WebXmlRenderContext renderContext) { """ Paints the given SubordinateControl. @param component the SubordinateControl to paint. @param renderContext the RenderContext to paint to. """ WSubordinateControl subordinate = (WSubordinateControl) component; XmlStringBuilder xml = renderContext.getWriter(); if (!subordinate.getRules().isEmpty()) { int seq = 0; for (Rule rule : subordinate.getRules()) { xml.appendTagOpen("ui:subordinate"); xml.appendAttribute("id", subordinate.getId() + "-c" + seq++); xml.appendClose(); paintRule(rule, xml); xml.appendEndTag("ui:subordinate"); } } }
java
@Override public void doRender(final WComponent component, final WebXmlRenderContext renderContext) { WSubordinateControl subordinate = (WSubordinateControl) component; XmlStringBuilder xml = renderContext.getWriter(); if (!subordinate.getRules().isEmpty()) { int seq = 0; for (Rule rule : subordinate.getRules()) { xml.appendTagOpen("ui:subordinate"); xml.appendAttribute("id", subordinate.getId() + "-c" + seq++); xml.appendClose(); paintRule(rule, xml); xml.appendEndTag("ui:subordinate"); } } }
[ "@", "Override", "public", "void", "doRender", "(", "final", "WComponent", "component", ",", "final", "WebXmlRenderContext", "renderContext", ")", "{", "WSubordinateControl", "subordinate", "=", "(", "WSubordinateControl", ")", "component", ";", "XmlStringBuilder", "x...
Paints the given SubordinateControl. @param component the SubordinateControl to paint. @param renderContext the RenderContext to paint to.
[ "Paints", "the", "given", "SubordinateControl", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WSubordinateControlRenderer.java#L35-L51
stratosphere/stratosphere
stratosphere-runtime/src/main/java/eu/stratosphere/nephele/services/iomanager/BlockChannelWriter.java
BlockChannelWriter.writeBlock
public void writeBlock(MemorySegment segment) throws IOException { """ Issues a asynchronous write request to the writer. @param segment The segment to be written. @throws IOException Thrown, when the writer encounters an I/O error. Due to the asynchronous nature of the writer, the exception thrown here may have been caused by an earlier write request. """ // check the error state of this channel checkErroneous(); // write the current buffer and get the next one this.requestsNotReturned.incrementAndGet(); if (this.closed || this.requestQueue.isClosed()) { // if we found ourselves closed after the counter increment, // decrement the counter again and do not forward the request this.requestsNotReturned.decrementAndGet(); throw new IOException("The writer has been closed."); } this.requestQueue.add(new SegmentWriteRequest(this, segment)); }
java
public void writeBlock(MemorySegment segment) throws IOException { // check the error state of this channel checkErroneous(); // write the current buffer and get the next one this.requestsNotReturned.incrementAndGet(); if (this.closed || this.requestQueue.isClosed()) { // if we found ourselves closed after the counter increment, // decrement the counter again and do not forward the request this.requestsNotReturned.decrementAndGet(); throw new IOException("The writer has been closed."); } this.requestQueue.add(new SegmentWriteRequest(this, segment)); }
[ "public", "void", "writeBlock", "(", "MemorySegment", "segment", ")", "throws", "IOException", "{", "// check the error state of this channel", "checkErroneous", "(", ")", ";", "// write the current buffer and get the next one", "this", ".", "requestsNotReturned", ".", "incre...
Issues a asynchronous write request to the writer. @param segment The segment to be written. @throws IOException Thrown, when the writer encounters an I/O error. Due to the asynchronous nature of the writer, the exception thrown here may have been caused by an earlier write request.
[ "Issues", "a", "asynchronous", "write", "request", "to", "the", "writer", "." ]
train
https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/services/iomanager/BlockChannelWriter.java#L64-L78
haifengl/smile
math/src/main/java/smile/math/Math.java
Math.JensenShannonDivergence
public static double JensenShannonDivergence(SparseArray x, double[] y) { """ Jensen-Shannon divergence JS(P||Q) = (KL(P||M) + KL(Q||M)) / 2, where M = (P+Q)/2. The Jensen-Shannon divergence is a popular method of measuring the similarity between two probability distributions. It is also known as information radius or total divergence to the average. It is based on the Kullback-Leibler divergence, with the difference that it is always a finite value. The square root of the Jensen-Shannon divergence is a metric. """ if (x.isEmpty()) { throw new IllegalArgumentException("List x is empty."); } Iterator<SparseArray.Entry> iter = x.iterator(); double js = 0.0; while (iter.hasNext()) { SparseArray.Entry b = iter.next(); int i = b.i; double mi = (b.x + y[i]) / 2; js += b.x * Math.log(b.x / mi); if (y[i] > 0) { js += y[i] * Math.log(y[i] / mi); } } return js / 2; }
java
public static double JensenShannonDivergence(SparseArray x, double[] y) { if (x.isEmpty()) { throw new IllegalArgumentException("List x is empty."); } Iterator<SparseArray.Entry> iter = x.iterator(); double js = 0.0; while (iter.hasNext()) { SparseArray.Entry b = iter.next(); int i = b.i; double mi = (b.x + y[i]) / 2; js += b.x * Math.log(b.x / mi); if (y[i] > 0) { js += y[i] * Math.log(y[i] / mi); } } return js / 2; }
[ "public", "static", "double", "JensenShannonDivergence", "(", "SparseArray", "x", ",", "double", "[", "]", "y", ")", "{", "if", "(", "x", ".", "isEmpty", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"List x is empty.\"", ")", ";", ...
Jensen-Shannon divergence JS(P||Q) = (KL(P||M) + KL(Q||M)) / 2, where M = (P+Q)/2. The Jensen-Shannon divergence is a popular method of measuring the similarity between two probability distributions. It is also known as information radius or total divergence to the average. It is based on the Kullback-Leibler divergence, with the difference that it is always a finite value. The square root of the Jensen-Shannon divergence is a metric.
[ "Jensen", "-", "Shannon", "divergence", "JS", "(", "P||Q", ")", "=", "(", "KL", "(", "P||M", ")", "+", "KL", "(", "Q||M", "))", "/", "2", "where", "M", "=", "(", "P", "+", "Q", ")", "/", "2", ".", "The", "Jensen", "-", "Shannon", "divergence", ...
train
https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/math/src/main/java/smile/math/Math.java#L2473-L2492
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/PendingCheckpointStats.java
PendingCheckpointStats.reportFailedCheckpoint
void reportFailedCheckpoint(long failureTimestamp, @Nullable Throwable cause) { """ Reports a failed pending checkpoint. @param failureTimestamp Timestamp of the failure. @param cause Optional cause of the failure. """ FailedCheckpointStats failed = new FailedCheckpointStats( checkpointId, triggerTimestamp, props, numberOfSubtasks, new HashMap<>(taskStats), currentNumAcknowledgedSubtasks, currentStateSize, currentAlignmentBuffered, failureTimestamp, latestAcknowledgedSubtask, cause); trackerCallback.reportFailedCheckpoint(failed); }
java
void reportFailedCheckpoint(long failureTimestamp, @Nullable Throwable cause) { FailedCheckpointStats failed = new FailedCheckpointStats( checkpointId, triggerTimestamp, props, numberOfSubtasks, new HashMap<>(taskStats), currentNumAcknowledgedSubtasks, currentStateSize, currentAlignmentBuffered, failureTimestamp, latestAcknowledgedSubtask, cause); trackerCallback.reportFailedCheckpoint(failed); }
[ "void", "reportFailedCheckpoint", "(", "long", "failureTimestamp", ",", "@", "Nullable", "Throwable", "cause", ")", "{", "FailedCheckpointStats", "failed", "=", "new", "FailedCheckpointStats", "(", "checkpointId", ",", "triggerTimestamp", ",", "props", ",", "numberOfS...
Reports a failed pending checkpoint. @param failureTimestamp Timestamp of the failure. @param cause Optional cause of the failure.
[ "Reports", "a", "failed", "pending", "checkpoint", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/PendingCheckpointStats.java#L170-L185
OpenLiberty/open-liberty
dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/ChecksumsManager.java
ChecksumsManager.initChecksumProps
private Properties initChecksumProps(Map<String, Set<String>> useOldChecksums) { """ Populates a new property file with the inputed checksum map and empty strings. @param useOldChecksums a map of the old checksums @return a new Properties object containing the old checksums as keys and "" as value """ Properties checksumProps = new Properties(); for (Set<String> set : useOldChecksums.values()) { for (String s : set) { checksumProps.put(s, ""); } } return checksumProps; }
java
private Properties initChecksumProps(Map<String, Set<String>> useOldChecksums) { Properties checksumProps = new Properties(); for (Set<String> set : useOldChecksums.values()) { for (String s : set) { checksumProps.put(s, ""); } } return checksumProps; }
[ "private", "Properties", "initChecksumProps", "(", "Map", "<", "String", ",", "Set", "<", "String", ">", ">", "useOldChecksums", ")", "{", "Properties", "checksumProps", "=", "new", "Properties", "(", ")", ";", "for", "(", "Set", "<", "String", ">", "set",...
Populates a new property file with the inputed checksum map and empty strings. @param useOldChecksums a map of the old checksums @return a new Properties object containing the old checksums as keys and "" as value
[ "Populates", "a", "new", "property", "file", "with", "the", "inputed", "checksum", "map", "and", "empty", "strings", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/ChecksumsManager.java#L181-L189
looly/hutool
hutool-core/src/main/java/cn/hutool/core/bean/BeanUtil.java
BeanUtil.copyProperties
public static void copyProperties(Object source, Object target, String... ignoreProperties) { """ 复制Bean对象属性<br> 限制类用于限制拷贝的属性,例如一个类我只想复制其父类的一些属性,就可以将editable设置为父类 @param source 源Bean对象 @param target 目标Bean对象 @param ignoreProperties 不拷贝的的属性列表 """ copyProperties(source, target, CopyOptions.create().setIgnoreProperties(ignoreProperties)); }
java
public static void copyProperties(Object source, Object target, String... ignoreProperties) { copyProperties(source, target, CopyOptions.create().setIgnoreProperties(ignoreProperties)); }
[ "public", "static", "void", "copyProperties", "(", "Object", "source", ",", "Object", "target", ",", "String", "...", "ignoreProperties", ")", "{", "copyProperties", "(", "source", ",", "target", ",", "CopyOptions", ".", "create", "(", ")", ".", "setIgnoreProp...
复制Bean对象属性<br> 限制类用于限制拷贝的属性,例如一个类我只想复制其父类的一些属性,就可以将editable设置为父类 @param source 源Bean对象 @param target 目标Bean对象 @param ignoreProperties 不拷贝的的属性列表
[ "复制Bean对象属性<br", ">", "限制类用于限制拷贝的属性,例如一个类我只想复制其父类的一些属性,就可以将editable设置为父类" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/bean/BeanUtil.java#L594-L596
wildfly/wildfly-core
logging/src/main/java/org/jboss/as/logging/deployments/resources/LoggingConfigurationReadStepHandler.java
LoggingConfigurationReadStepHandler.addProperties
static void addProperties(final PropertyConfigurable configuration, final ModelNode model) { """ Adds properties to the model in key/value pairs. @param configuration the configuration to get the properties from @param model the model to update """ for (String name : configuration.getPropertyNames()) { setModelValue(model.get(name), configuration.getPropertyValueString(name)); } }
java
static void addProperties(final PropertyConfigurable configuration, final ModelNode model) { for (String name : configuration.getPropertyNames()) { setModelValue(model.get(name), configuration.getPropertyValueString(name)); } }
[ "static", "void", "addProperties", "(", "final", "PropertyConfigurable", "configuration", ",", "final", "ModelNode", "model", ")", "{", "for", "(", "String", "name", ":", "configuration", ".", "getPropertyNames", "(", ")", ")", "{", "setModelValue", "(", "model"...
Adds properties to the model in key/value pairs. @param configuration the configuration to get the properties from @param model the model to update
[ "Adds", "properties", "to", "the", "model", "in", "key", "/", "value", "pairs", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/logging/src/main/java/org/jboss/as/logging/deployments/resources/LoggingConfigurationReadStepHandler.java#L77-L81
alipay/sofa-rpc
core/api/src/main/java/com/alipay/sofa/rpc/context/RpcInternalContext.java
RpcInternalContext.setRemoteAddress
public RpcInternalContext setRemoteAddress(String host, int port) { """ set remote address. @param host the host @param port the port @return context remote address """ if (host == null) { return this; } if (port < 0 || port > 0xFFFF) { port = 0; } // 提前检查是否为空,防止createUnresolved抛出异常,损耗性能 this.remoteAddress = InetSocketAddress.createUnresolved(host, port); return this; }
java
public RpcInternalContext setRemoteAddress(String host, int port) { if (host == null) { return this; } if (port < 0 || port > 0xFFFF) { port = 0; } // 提前检查是否为空,防止createUnresolved抛出异常,损耗性能 this.remoteAddress = InetSocketAddress.createUnresolved(host, port); return this; }
[ "public", "RpcInternalContext", "setRemoteAddress", "(", "String", "host", ",", "int", "port", ")", "{", "if", "(", "host", "==", "null", ")", "{", "return", "this", ";", "}", "if", "(", "port", "<", "0", "||", "port", ">", "0xFFFF", ")", "{", "port"...
set remote address. @param host the host @param port the port @return context remote address
[ "set", "remote", "address", "." ]
train
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/core/api/src/main/java/com/alipay/sofa/rpc/context/RpcInternalContext.java#L295-L305
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/javac/comp/Infer.java
Infer.checkCompatibleUpperBounds
void checkCompatibleUpperBounds(UndetVar uv, InferenceContext inferenceContext) { """ Make sure that the upper bounds we got so far lead to a solvable inference variable by making sure that a glb exists. """ List<Type> hibounds = Type.filter(uv.getBounds(InferenceBound.UPPER), new BoundFilter(inferenceContext)); Type hb = null; if (hibounds.isEmpty()) hb = syms.objectType; else if (hibounds.tail.isEmpty()) hb = hibounds.head; else hb = types.glb(hibounds); if (hb == null || hb.isErroneous()) reportBoundError(uv, BoundErrorKind.BAD_UPPER); }
java
void checkCompatibleUpperBounds(UndetVar uv, InferenceContext inferenceContext) { List<Type> hibounds = Type.filter(uv.getBounds(InferenceBound.UPPER), new BoundFilter(inferenceContext)); Type hb = null; if (hibounds.isEmpty()) hb = syms.objectType; else if (hibounds.tail.isEmpty()) hb = hibounds.head; else hb = types.glb(hibounds); if (hb == null || hb.isErroneous()) reportBoundError(uv, BoundErrorKind.BAD_UPPER); }
[ "void", "checkCompatibleUpperBounds", "(", "UndetVar", "uv", ",", "InferenceContext", "inferenceContext", ")", "{", "List", "<", "Type", ">", "hibounds", "=", "Type", ".", "filter", "(", "uv", ".", "getBounds", "(", "InferenceBound", ".", "UPPER", ")", ",", ...
Make sure that the upper bounds we got so far lead to a solvable inference variable by making sure that a glb exists.
[ "Make", "sure", "that", "the", "upper", "bounds", "we", "got", "so", "far", "lead", "to", "a", "solvable", "inference", "variable", "by", "making", "sure", "that", "a", "glb", "exists", "." ]
train
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/comp/Infer.java#L1071-L1083
OpenLiberty/open-liberty
dev/com.ibm.ws.session/src/com/ibm/ws/session/SessionManager.java
SessionManager.createSession
public Object createSession(String id, int sessionVersion, Object correlator) { """ Method createSession <p> Called by the HTTPSessionManager in order to create a session. The id provided is in advisory capability only i.e.If there is another webapp that is using this id, then we can reuse it. If not we need to create a new one. If the session id is in use by another webapp, then we need to reuse the requested sessionVersion. @param id @param sessionVersion @return Object """ if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) { // LoggingUtil.SESSION_LOGGER_CORE.logp(Level.FINE, methodClassName, // "createSession", new Object[] {id, new Integer(sessionVersion), // correlator}); } ISession iSession = null; if ((null == id) || !_store.idExists(id, correlator)) { id = _idGenerator.getID(); iSession = _store.createSession(id, correlator); } else { iSession = _store.createSession(id, correlator); if (sessionVersion != -1) { iSession.setVersion(sessionVersion); } } iSession.incrementRefCount(); iSession.setMaxInactiveInterval(_sessionTimeout); _sessionEventDispatcher.sessionCreated(iSession); if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) { LoggingUtil.SESSION_LOGGER_CORE.exiting(methodClassName, "createSession", "iSession = " + iSession); } return iSession; }
java
public Object createSession(String id, int sessionVersion, Object correlator) { if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) { // LoggingUtil.SESSION_LOGGER_CORE.logp(Level.FINE, methodClassName, // "createSession", new Object[] {id, new Integer(sessionVersion), // correlator}); } ISession iSession = null; if ((null == id) || !_store.idExists(id, correlator)) { id = _idGenerator.getID(); iSession = _store.createSession(id, correlator); } else { iSession = _store.createSession(id, correlator); if (sessionVersion != -1) { iSession.setVersion(sessionVersion); } } iSession.incrementRefCount(); iSession.setMaxInactiveInterval(_sessionTimeout); _sessionEventDispatcher.sessionCreated(iSession); if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) { LoggingUtil.SESSION_LOGGER_CORE.exiting(methodClassName, "createSession", "iSession = " + iSession); } return iSession; }
[ "public", "Object", "createSession", "(", "String", "id", ",", "int", "sessionVersion", ",", "Object", "correlator", ")", "{", "if", "(", "com", ".", "ibm", ".", "ejs", ".", "ras", ".", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "Logging...
Method createSession <p> Called by the HTTPSessionManager in order to create a session. The id provided is in advisory capability only i.e.If there is another webapp that is using this id, then we can reuse it. If not we need to create a new one. If the session id is in use by another webapp, then we need to reuse the requested sessionVersion. @param id @param sessionVersion @return Object
[ "Method", "createSession", "<p", ">", "Called", "by", "the", "HTTPSessionManager", "in", "order", "to", "create", "a", "session", ".", "The", "id", "provided", "is", "in", "advisory", "capability", "only", "i", ".", "e", ".", "If", "there", "is", "another"...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.session/src/com/ibm/ws/session/SessionManager.java#L323-L349
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/widget/attribute/FormItemList.java
FormItemList.insertBefore
public void insertBefore(String name, FormItem... newItem) { """ Insert a form item before the item with the specified name. @param name name of the item before which to insert @param newItem the item to insert """ int index = indexOf(name); if (index >= 0) { addAll(index, Arrays.asList(newItem)); } }
java
public void insertBefore(String name, FormItem... newItem) { int index = indexOf(name); if (index >= 0) { addAll(index, Arrays.asList(newItem)); } }
[ "public", "void", "insertBefore", "(", "String", "name", ",", "FormItem", "...", "newItem", ")", "{", "int", "index", "=", "indexOf", "(", "name", ")", ";", "if", "(", "index", ">=", "0", ")", "{", "addAll", "(", "index", ",", "Arrays", ".", "asList"...
Insert a form item before the item with the specified name. @param name name of the item before which to insert @param newItem the item to insert
[ "Insert", "a", "form", "item", "before", "the", "item", "with", "the", "specified", "name", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/widget/attribute/FormItemList.java#L58-L63
TGIO/RNCryptorNative
jncryptor/src/main/java/org/cryptonode/jncryptor/AES256JNCryptor.java
AES256JNCryptor.decryptV2Data
private byte[] decryptV2Data(AES256v2Ciphertext aesCiphertext, SecretKey decryptionKey, SecretKey hmacKey) throws CryptorException { """ Decrypts data. @param aesCiphertext the ciphertext from the message @param decryptionKey the key to decrypt @param hmacKey the key to recalculate the HMAC @return the decrypted data @throws CryptorException if a JCE error occurs """ try { Mac mac = Mac.getInstance(HMAC_ALGORITHM); mac.init(hmacKey); byte[] hmacValue = mac.doFinal(aesCiphertext.getDataToHMAC()); if (!arraysEqual(hmacValue, aesCiphertext.getHmac())) { throw new InvalidHMACException("Incorrect HMAC value."); } Cipher cipher = Cipher.getInstance(AES_CIPHER_ALGORITHM); cipher.init(Cipher.DECRYPT_MODE, decryptionKey, new IvParameterSpec( aesCiphertext.getIv())); return cipher.doFinal(aesCiphertext.getCiphertext()); } catch (InvalidKeyException e) { throw new CryptorException( "Caught InvalidKeyException. Do you have unlimited strength jurisdiction files installed?", e); } catch (GeneralSecurityException e) { throw new CryptorException("Failed to decrypt message.", e); } }
java
private byte[] decryptV2Data(AES256v2Ciphertext aesCiphertext, SecretKey decryptionKey, SecretKey hmacKey) throws CryptorException { try { Mac mac = Mac.getInstance(HMAC_ALGORITHM); mac.init(hmacKey); byte[] hmacValue = mac.doFinal(aesCiphertext.getDataToHMAC()); if (!arraysEqual(hmacValue, aesCiphertext.getHmac())) { throw new InvalidHMACException("Incorrect HMAC value."); } Cipher cipher = Cipher.getInstance(AES_CIPHER_ALGORITHM); cipher.init(Cipher.DECRYPT_MODE, decryptionKey, new IvParameterSpec( aesCiphertext.getIv())); return cipher.doFinal(aesCiphertext.getCiphertext()); } catch (InvalidKeyException e) { throw new CryptorException( "Caught InvalidKeyException. Do you have unlimited strength jurisdiction files installed?", e); } catch (GeneralSecurityException e) { throw new CryptorException("Failed to decrypt message.", e); } }
[ "private", "byte", "[", "]", "decryptV2Data", "(", "AES256v2Ciphertext", "aesCiphertext", ",", "SecretKey", "decryptionKey", ",", "SecretKey", "hmacKey", ")", "throws", "CryptorException", "{", "try", "{", "Mac", "mac", "=", "Mac", ".", "getInstance", "(", "HMAC...
Decrypts data. @param aesCiphertext the ciphertext from the message @param decryptionKey the key to decrypt @param hmacKey the key to recalculate the HMAC @return the decrypted data @throws CryptorException if a JCE error occurs
[ "Decrypts", "data", "." ]
train
https://github.com/TGIO/RNCryptorNative/blob/5209f10b988e4033c0b769a40b0d6cc99ea16af7/jncryptor/src/main/java/org/cryptonode/jncryptor/AES256JNCryptor.java#L200-L224
JodaOrg/joda-time
src/main/java/org/joda/time/Weeks.java
Weeks.weeksBetween
public static Weeks weeksBetween(ReadablePartial start, ReadablePartial end) { """ Creates a <code>Weeks</code> representing the number of whole weeks between the two specified partial datetimes. <p> The two partials must contain the same fields, for example you can specify two <code>LocalDate</code> objects. @param start the start partial date, must not be null @param end the end partial date, must not be null @return the period in weeks @throws IllegalArgumentException if the partials are null or invalid """ if (start instanceof LocalDate && end instanceof LocalDate) { Chronology chrono = DateTimeUtils.getChronology(start.getChronology()); int weeks = chrono.weeks().getDifference( ((LocalDate) end).getLocalMillis(), ((LocalDate) start).getLocalMillis()); return Weeks.weeks(weeks); } int amount = BaseSingleFieldPeriod.between(start, end, ZERO); return Weeks.weeks(amount); }
java
public static Weeks weeksBetween(ReadablePartial start, ReadablePartial end) { if (start instanceof LocalDate && end instanceof LocalDate) { Chronology chrono = DateTimeUtils.getChronology(start.getChronology()); int weeks = chrono.weeks().getDifference( ((LocalDate) end).getLocalMillis(), ((LocalDate) start).getLocalMillis()); return Weeks.weeks(weeks); } int amount = BaseSingleFieldPeriod.between(start, end, ZERO); return Weeks.weeks(amount); }
[ "public", "static", "Weeks", "weeksBetween", "(", "ReadablePartial", "start", ",", "ReadablePartial", "end", ")", "{", "if", "(", "start", "instanceof", "LocalDate", "&&", "end", "instanceof", "LocalDate", ")", "{", "Chronology", "chrono", "=", "DateTimeUtils", ...
Creates a <code>Weeks</code> representing the number of whole weeks between the two specified partial datetimes. <p> The two partials must contain the same fields, for example you can specify two <code>LocalDate</code> objects. @param start the start partial date, must not be null @param end the end partial date, must not be null @return the period in weeks @throws IllegalArgumentException if the partials are null or invalid
[ "Creates", "a", "<code", ">", "Weeks<", "/", "code", ">", "representing", "the", "number", "of", "whole", "weeks", "between", "the", "two", "specified", "partial", "datetimes", ".", "<p", ">", "The", "two", "partials", "must", "contain", "the", "same", "fi...
train
https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/Weeks.java#L117-L126
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/ValueEnforcer.java
ValueEnforcer.isBetweenInclusive
public static int isBetweenInclusive (final int nValue, final String sName, final int nLowerBoundInclusive, final int nUpperBoundInclusive) { """ Check if <code>nValue &ge; nLowerBoundInclusive &amp;&amp; nValue &le; nUpperBoundInclusive</code> @param nValue Value @param sName Name @param nLowerBoundInclusive Lower bound @param nUpperBoundInclusive Upper bound @return The value """ if (isEnabled ()) return isBetweenInclusive (nValue, () -> sName, nLowerBoundInclusive, nUpperBoundInclusive); return nValue; }
java
public static int isBetweenInclusive (final int nValue, final String sName, final int nLowerBoundInclusive, final int nUpperBoundInclusive) { if (isEnabled ()) return isBetweenInclusive (nValue, () -> sName, nLowerBoundInclusive, nUpperBoundInclusive); return nValue; }
[ "public", "static", "int", "isBetweenInclusive", "(", "final", "int", "nValue", ",", "final", "String", "sName", ",", "final", "int", "nLowerBoundInclusive", ",", "final", "int", "nUpperBoundInclusive", ")", "{", "if", "(", "isEnabled", "(", ")", ")", "return"...
Check if <code>nValue &ge; nLowerBoundInclusive &amp;&amp; nValue &le; nUpperBoundInclusive</code> @param nValue Value @param sName Name @param nLowerBoundInclusive Lower bound @param nUpperBoundInclusive Upper bound @return The value
[ "Check", "if", "<code", ">", "nValue", "&ge", ";", "nLowerBoundInclusive", "&amp", ";", "&amp", ";", "nValue", "&le", ";", "nUpperBoundInclusive<", "/", "code", ">" ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/ValueEnforcer.java#L2277-L2285
javagl/CommonUI
src/main/java/de/javagl/common/ui/JTrees.java
JTrees.collapseAll
public static void collapseAll(JTree tree, boolean omitRoot) { """ Collapse all rows of the given tree @param tree The tree @param omitRoot Whether the root node should not be collapsed """ int rows = tree.getRowCount(); int limit = (omitRoot ? 1 : 0); for (int i = rows - 1; i >= limit; i--) { tree.collapseRow(i); } }
java
public static void collapseAll(JTree tree, boolean omitRoot) { int rows = tree.getRowCount(); int limit = (omitRoot ? 1 : 0); for (int i = rows - 1; i >= limit; i--) { tree.collapseRow(i); } }
[ "public", "static", "void", "collapseAll", "(", "JTree", "tree", ",", "boolean", "omitRoot", ")", "{", "int", "rows", "=", "tree", ".", "getRowCount", "(", ")", ";", "int", "limit", "=", "(", "omitRoot", "?", "1", ":", "0", ")", ";", "for", "(", "i...
Collapse all rows of the given tree @param tree The tree @param omitRoot Whether the root node should not be collapsed
[ "Collapse", "all", "rows", "of", "the", "given", "tree" ]
train
https://github.com/javagl/CommonUI/blob/b2c7a7637d4e288271392ba148dc17e4c9780255/src/main/java/de/javagl/common/ui/JTrees.java#L163-L171
softindex/datakernel
core-http/src/main/java/io/datakernel/http/HttpServerConnection.java
HttpServerConnection.onHeader
@Override protected void onHeader(HttpHeader header, byte[] array, int off, int len) throws ParseException { """ This method is called after receiving header. It sets its value to request. @param header received header """ if (header == HttpHeaders.EXPECT) { if (equalsLowerCaseAscii(EXPECT_100_CONTINUE, array, off, len)) { socket.write(ByteBuf.wrapForReading(EXPECT_RESPONSE_CONTINUE)); } } if (request.headers.size() >= MAX_HEADERS) { throw TOO_MANY_HEADERS; } request.addParsedHeader(header, array, off, len); }
java
@Override protected void onHeader(HttpHeader header, byte[] array, int off, int len) throws ParseException { if (header == HttpHeaders.EXPECT) { if (equalsLowerCaseAscii(EXPECT_100_CONTINUE, array, off, len)) { socket.write(ByteBuf.wrapForReading(EXPECT_RESPONSE_CONTINUE)); } } if (request.headers.size() >= MAX_HEADERS) { throw TOO_MANY_HEADERS; } request.addParsedHeader(header, array, off, len); }
[ "@", "Override", "protected", "void", "onHeader", "(", "HttpHeader", "header", ",", "byte", "[", "]", "array", ",", "int", "off", ",", "int", "len", ")", "throws", "ParseException", "{", "if", "(", "header", "==", "HttpHeaders", ".", "EXPECT", ")", "{", ...
This method is called after receiving header. It sets its value to request. @param header received header
[ "This", "method", "is", "called", "after", "receiving", "header", ".", "It", "sets", "its", "value", "to", "request", "." ]
train
https://github.com/softindex/datakernel/blob/090ca1116416c14d463d49d275cb1daaafa69c56/core-http/src/main/java/io/datakernel/http/HttpServerConnection.java#L201-L212
aws/aws-sdk-java
aws-java-sdk-mediatailor/src/main/java/com/amazonaws/services/mediatailor/model/PlaybackConfiguration.java
PlaybackConfiguration.withTags
public PlaybackConfiguration withTags(java.util.Map<String, String> tags) { """ <p> The tags assigned to the playback configuration. </p> @param tags The tags assigned to the playback configuration. @return Returns a reference to this object so that method calls can be chained together. """ setTags(tags); return this; }
java
public PlaybackConfiguration withTags(java.util.Map<String, String> tags) { setTags(tags); return this; }
[ "public", "PlaybackConfiguration", "withTags", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "tags", ")", "{", "setTags", "(", "tags", ")", ";", "return", "this", ";", "}" ]
<p> The tags assigned to the playback configuration. </p> @param tags The tags assigned to the playback configuration. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "The", "tags", "assigned", "to", "the", "playback", "configuration", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-mediatailor/src/main/java/com/amazonaws/services/mediatailor/model/PlaybackConfiguration.java#L560-L563
DDTH/ddth-commons
ddth-commons-core/src/main/java/com/github/ddth/commons/jsonrpc/HttpJsonRpcClient.java
HttpJsonRpcClient.doDelete
public RequestResponse doDelete(String url, Map<String, Object> headers, Map<String, Object> urlParams) { """ Perform a DELETE request. @param url @param headers @param urlParams @return """ return doDelete(url, headers, urlParams, null); }
java
public RequestResponse doDelete(String url, Map<String, Object> headers, Map<String, Object> urlParams) { return doDelete(url, headers, urlParams, null); }
[ "public", "RequestResponse", "doDelete", "(", "String", "url", ",", "Map", "<", "String", ",", "Object", ">", "headers", ",", "Map", "<", "String", ",", "Object", ">", "urlParams", ")", "{", "return", "doDelete", "(", "url", ",", "headers", ",", "urlPara...
Perform a DELETE request. @param url @param headers @param urlParams @return
[ "Perform", "a", "DELETE", "request", "." ]
train
https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/jsonrpc/HttpJsonRpcClient.java#L264-L267
apereo/cas
core/cas-server-core-services-api/src/main/java/org/apereo/cas/services/DefaultRegisteredServiceAccessStrategy.java
DefaultRegisteredServiceAccessStrategy.enoughRequiredAttributesAvailableToProcess
protected boolean enoughRequiredAttributesAvailableToProcess(final Map<String, Object> principalAttributes, final Map<String, Set<String>> requiredAttributes) { """ Enough required attributes available to process? Check collection sizes and determine if we have enough data to move on. @param principalAttributes the principal attributes @param requiredAttributes the required attributes @return true /false """ if (principalAttributes.isEmpty() && !requiredAttributes.isEmpty()) { LOGGER.debug("No principal attributes are found to satisfy defined attribute requirements"); return false; } if (principalAttributes.size() < requiredAttributes.size()) { LOGGER.debug("The size of the principal attributes that are [{}] does not match defined required attributes, " + "which indicates the principal is not carrying enough data to grant authorization", principalAttributes); return false; } return true; }
java
protected boolean enoughRequiredAttributesAvailableToProcess(final Map<String, Object> principalAttributes, final Map<String, Set<String>> requiredAttributes) { if (principalAttributes.isEmpty() && !requiredAttributes.isEmpty()) { LOGGER.debug("No principal attributes are found to satisfy defined attribute requirements"); return false; } if (principalAttributes.size() < requiredAttributes.size()) { LOGGER.debug("The size of the principal attributes that are [{}] does not match defined required attributes, " + "which indicates the principal is not carrying enough data to grant authorization", principalAttributes); return false; } return true; }
[ "protected", "boolean", "enoughRequiredAttributesAvailableToProcess", "(", "final", "Map", "<", "String", ",", "Object", ">", "principalAttributes", ",", "final", "Map", "<", "String", ",", "Set", "<", "String", ">", ">", "requiredAttributes", ")", "{", "if", "(...
Enough required attributes available to process? Check collection sizes and determine if we have enough data to move on. @param principalAttributes the principal attributes @param requiredAttributes the required attributes @return true /false
[ "Enough", "required", "attributes", "available", "to", "process?", "Check", "collection", "sizes", "and", "determine", "if", "we", "have", "enough", "data", "to", "move", "on", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-services-api/src/main/java/org/apereo/cas/services/DefaultRegisteredServiceAccessStrategy.java#L242-L253
aerogear/aerogear-unifiedpush-server
push-sender/src/main/java/org/jboss/aerogear/unifiedpush/message/configuration/SenderConfigurationProvider.java
SenderConfigurationProvider.validateAndSanitizeConfiguration
private SenderConfiguration validateAndSanitizeConfiguration(VariantType type, SenderConfiguration configuration) { """ Validates that configuration is correct with regards to push networks limitations or implementation, etc. """ switch (type) { case ANDROID: if (configuration.batchSize() > 1000) { logger.warn(String .format("Sender configuration -D%s=%s is invalid: at most 1000 tokens can be submitted to GCM in one batch", getSystemPropertyName(type, ConfigurationProperty.batchSize), configuration.batchSize())); configuration.setBatchSize(1000); } break; default: break; } return configuration; }
java
private SenderConfiguration validateAndSanitizeConfiguration(VariantType type, SenderConfiguration configuration) { switch (type) { case ANDROID: if (configuration.batchSize() > 1000) { logger.warn(String .format("Sender configuration -D%s=%s is invalid: at most 1000 tokens can be submitted to GCM in one batch", getSystemPropertyName(type, ConfigurationProperty.batchSize), configuration.batchSize())); configuration.setBatchSize(1000); } break; default: break; } return configuration; }
[ "private", "SenderConfiguration", "validateAndSanitizeConfiguration", "(", "VariantType", "type", ",", "SenderConfiguration", "configuration", ")", "{", "switch", "(", "type", ")", "{", "case", "ANDROID", ":", "if", "(", "configuration", ".", "batchSize", "(", ")", ...
Validates that configuration is correct with regards to push networks limitations or implementation, etc.
[ "Validates", "that", "configuration", "is", "correct", "with", "regards", "to", "push", "networks", "limitations", "or", "implementation", "etc", "." ]
train
https://github.com/aerogear/aerogear-unifiedpush-server/blob/c7b798f085449117d84345d8c378b27165cad32b/push-sender/src/main/java/org/jboss/aerogear/unifiedpush/message/configuration/SenderConfigurationProvider.java#L73-L87
gallandarakhneorg/afc
advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusItinerary.java
BusItinerary.addBusHalt
boolean addBusHalt(BusItineraryHalt halt, int insertToIndex) { """ Add the given bus halt in this itinerary. @param halt the halt. @param insertToIndex the insertion index. @return <code>true</code> if the addition was successful, <code>false</code> otherwise. """ //set index for right ordering when add to invalid list ! if (insertToIndex < 0) { halt.setInvalidListIndex(this.insertionIndex); } else { halt.setInvalidListIndex(insertToIndex); } if (halt.isValidPrimitive()) { ListUtil.addIfAbsent(this.validHalts, VALID_HALT_COMPARATOR, halt); } else { ListUtil.addIfAbsent(this.invalidHalts, INVALID_HALT_COMPARATOR, halt); } halt.setEventFirable(isEventFirable()); ++this.insertionIndex; if (isEventFirable()) { fireShapeChanged(new BusChangeEvent(this, BusChangeEventType.ITINERARY_HALT_ADDED, halt, halt.indexInParent(), "shape", null, null)); //$NON-NLS-1$ checkPrimitiveValidity(); } return true; }
java
boolean addBusHalt(BusItineraryHalt halt, int insertToIndex) { //set index for right ordering when add to invalid list ! if (insertToIndex < 0) { halt.setInvalidListIndex(this.insertionIndex); } else { halt.setInvalidListIndex(insertToIndex); } if (halt.isValidPrimitive()) { ListUtil.addIfAbsent(this.validHalts, VALID_HALT_COMPARATOR, halt); } else { ListUtil.addIfAbsent(this.invalidHalts, INVALID_HALT_COMPARATOR, halt); } halt.setEventFirable(isEventFirable()); ++this.insertionIndex; if (isEventFirable()) { fireShapeChanged(new BusChangeEvent(this, BusChangeEventType.ITINERARY_HALT_ADDED, halt, halt.indexInParent(), "shape", null, null)); //$NON-NLS-1$ checkPrimitiveValidity(); } return true; }
[ "boolean", "addBusHalt", "(", "BusItineraryHalt", "halt", ",", "int", "insertToIndex", ")", "{", "//set index for right ordering when add to invalid list !", "if", "(", "insertToIndex", "<", "0", ")", "{", "halt", ".", "setInvalidListIndex", "(", "this", ".", "inserti...
Add the given bus halt in this itinerary. @param halt the halt. @param insertToIndex the insertion index. @return <code>true</code> if the addition was successful, <code>false</code> otherwise.
[ "Add", "the", "given", "bus", "halt", "in", "this", "itinerary", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusItinerary.java#L1127-L1151
facebookarchive/hadoop-20
src/core/org/apache/hadoop/metrics/spi/AbstractMetricsContext.java
AbstractMetricsContext.sum
private Number sum(Number a, Number b) { """ Adds two numbers, coercing the second to the type of the first. """ if (a instanceof Integer) { return Integer.valueOf(a.intValue() + b.intValue()); } else if (a instanceof Float) { return new Float(a.floatValue() + b.floatValue()); } else if (a instanceof Short) { return Short.valueOf((short)(a.shortValue() + b.shortValue())); } else if (a instanceof Byte) { return Byte.valueOf((byte)(a.byteValue() + b.byteValue())); } else if (a instanceof Long) { return Long.valueOf((a.longValue() + b.longValue())); } else { // should never happen throw new MetricsException("Invalid number type"); } }
java
private Number sum(Number a, Number b) { if (a instanceof Integer) { return Integer.valueOf(a.intValue() + b.intValue()); } else if (a instanceof Float) { return new Float(a.floatValue() + b.floatValue()); } else if (a instanceof Short) { return Short.valueOf((short)(a.shortValue() + b.shortValue())); } else if (a instanceof Byte) { return Byte.valueOf((byte)(a.byteValue() + b.byteValue())); } else if (a instanceof Long) { return Long.valueOf((a.longValue() + b.longValue())); } else { // should never happen throw new MetricsException("Invalid number type"); } }
[ "private", "Number", "sum", "(", "Number", "a", ",", "Number", "b", ")", "{", "if", "(", "a", "instanceof", "Integer", ")", "{", "return", "Integer", ".", "valueOf", "(", "a", ".", "intValue", "(", ")", "+", "b", ".", "intValue", "(", ")", ")", "...
Adds two numbers, coercing the second to the type of the first.
[ "Adds", "two", "numbers", "coercing", "the", "second", "to", "the", "type", "of", "the", "first", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/metrics/spi/AbstractMetricsContext.java#L378-L399
aws/aws-sdk-java
aws-java-sdk-pinpoint/src/main/java/com/amazonaws/services/pinpoint/model/EndpointSendConfiguration.java
EndpointSendConfiguration.withContext
public EndpointSendConfiguration withContext(java.util.Map<String, String> context) { """ A map of custom attributes to attributes to be attached to the message for this address. This payload is added to the push notification's 'data.pinpoint' object or added to the email/sms delivery receipt event attributes. @param context A map of custom attributes to attributes to be attached to the message for this address. This payload is added to the push notification's 'data.pinpoint' object or added to the email/sms delivery receipt event attributes. @return Returns a reference to this object so that method calls can be chained together. """ setContext(context); return this; }
java
public EndpointSendConfiguration withContext(java.util.Map<String, String> context) { setContext(context); return this; }
[ "public", "EndpointSendConfiguration", "withContext", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "context", ")", "{", "setContext", "(", "context", ")", ";", "return", "this", ";", "}" ]
A map of custom attributes to attributes to be attached to the message for this address. This payload is added to the push notification's 'data.pinpoint' object or added to the email/sms delivery receipt event attributes. @param context A map of custom attributes to attributes to be attached to the message for this address. This payload is added to the push notification's 'data.pinpoint' object or added to the email/sms delivery receipt event attributes. @return Returns a reference to this object so that method calls can be chained together.
[ "A", "map", "of", "custom", "attributes", "to", "attributes", "to", "be", "attached", "to", "the", "message", "for", "this", "address", ".", "This", "payload", "is", "added", "to", "the", "push", "notification", "s", "data", ".", "pinpoint", "object", "or"...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-pinpoint/src/main/java/com/amazonaws/services/pinpoint/model/EndpointSendConfiguration.java#L118-L121
groupon/odo
proxylib/src/main/java/com/groupon/odo/proxylib/OverrideService.java
OverrideService.updateRepeatNumber
public void updateRepeatNumber(int id, Integer repeatNumber) { """ Update the repeat number for a given enabled override @param id enabled override ID to update @param repeatNumber updated value of repeat """ PreparedStatement statement = null; try (Connection sqlConnection = sqlService.getConnection()) { String queryString = "UPDATE " + Constants.DB_TABLE_ENABLED_OVERRIDE + " SET " + Constants.ENABLED_OVERRIDES_REPEAT_NUMBER + "= ? " + " WHERE " + Constants.GENERIC_ID + " = ?"; statement = sqlConnection.prepareStatement(queryString); statement.setInt(1, repeatNumber); statement.setInt(2, id); statement.executeUpdate(); } catch (Exception e) { e.printStackTrace(); } finally { try { if (statement != null) { statement.close(); } } catch (Exception e) { } } }
java
public void updateRepeatNumber(int id, Integer repeatNumber) { PreparedStatement statement = null; try (Connection sqlConnection = sqlService.getConnection()) { String queryString = "UPDATE " + Constants.DB_TABLE_ENABLED_OVERRIDE + " SET " + Constants.ENABLED_OVERRIDES_REPEAT_NUMBER + "= ? " + " WHERE " + Constants.GENERIC_ID + " = ?"; statement = sqlConnection.prepareStatement(queryString); statement.setInt(1, repeatNumber); statement.setInt(2, id); statement.executeUpdate(); } catch (Exception e) { e.printStackTrace(); } finally { try { if (statement != null) { statement.close(); } } catch (Exception e) { } } }
[ "public", "void", "updateRepeatNumber", "(", "int", "id", ",", "Integer", "repeatNumber", ")", "{", "PreparedStatement", "statement", "=", "null", ";", "try", "(", "Connection", "sqlConnection", "=", "sqlService", ".", "getConnection", "(", ")", ")", "{", "Str...
Update the repeat number for a given enabled override @param id enabled override ID to update @param repeatNumber updated value of repeat
[ "Update", "the", "repeat", "number", "for", "a", "given", "enabled", "override" ]
train
https://github.com/groupon/odo/blob/3bae43d5eca8ace036775e5b2d3ed9af1a9ff9b1/proxylib/src/main/java/com/groupon/odo/proxylib/OverrideService.java#L208-L229
alkacon/opencms-core
src-gwt/org/opencms/ade/galleries/client/preview/ui/CmsImageEditorForm.java
CmsImageEditorForm.fillContent
public void fillContent(CmsImageInfoBean imageInfo, CmsJSONMap imageAttributes, boolean initialFill) { """ Displays the provided image information.<p> @param imageInfo the image information @param imageAttributes the image attributes @param initialFill flag to indicate that a new image has been selected """ m_initialImageAttributes = imageAttributes; for (Entry<Attribute, I_CmsFormWidget> entry : m_fields.entrySet()) { String val = imageAttributes.getString(entry.getKey().name()); if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(val)) { entry.getValue().setFormValueAsString(val); } else { if (entry.getKey() == Attribute.alt) { entry.getValue().setFormValueAsString( imageInfo.getProperties().get(CmsClientProperty.PROPERTY_TITLE)); } if (entry.getKey() == Attribute.copyright) { entry.getValue().setFormValueAsString(imageInfo.getCopyright()); } if (initialFill && (entry.getKey() == Attribute.align)) { entry.getValue().setFormValueAsString("left"); } } } }
java
public void fillContent(CmsImageInfoBean imageInfo, CmsJSONMap imageAttributes, boolean initialFill) { m_initialImageAttributes = imageAttributes; for (Entry<Attribute, I_CmsFormWidget> entry : m_fields.entrySet()) { String val = imageAttributes.getString(entry.getKey().name()); if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(val)) { entry.getValue().setFormValueAsString(val); } else { if (entry.getKey() == Attribute.alt) { entry.getValue().setFormValueAsString( imageInfo.getProperties().get(CmsClientProperty.PROPERTY_TITLE)); } if (entry.getKey() == Attribute.copyright) { entry.getValue().setFormValueAsString(imageInfo.getCopyright()); } if (initialFill && (entry.getKey() == Attribute.align)) { entry.getValue().setFormValueAsString("left"); } } } }
[ "public", "void", "fillContent", "(", "CmsImageInfoBean", "imageInfo", ",", "CmsJSONMap", "imageAttributes", ",", "boolean", "initialFill", ")", "{", "m_initialImageAttributes", "=", "imageAttributes", ";", "for", "(", "Entry", "<", "Attribute", ",", "I_CmsFormWidget"...
Displays the provided image information.<p> @param imageInfo the image information @param imageAttributes the image attributes @param initialFill flag to indicate that a new image has been selected
[ "Displays", "the", "provided", "image", "information", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/galleries/client/preview/ui/CmsImageEditorForm.java#L225-L245
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/FileOperations.java
FileOperations.getFilePropertiesFromComputeNode
public FileProperties getFilePropertiesFromComputeNode(String poolId, String nodeId, String fileName) throws BatchErrorException, IOException { """ Gets information about a file on a compute node. @param poolId The ID of the pool that contains the compute node. @param nodeId the ID of the compute node. @param fileName The name of the file to retrieve. @return A {@link FileProperties} instance containing information about the file. @throws BatchErrorException Exception thrown when an error response is received from the Batch service. @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. """ return getFilePropertiesFromComputeNode(poolId, nodeId, fileName, null); }
java
public FileProperties getFilePropertiesFromComputeNode(String poolId, String nodeId, String fileName) throws BatchErrorException, IOException { return getFilePropertiesFromComputeNode(poolId, nodeId, fileName, null); }
[ "public", "FileProperties", "getFilePropertiesFromComputeNode", "(", "String", "poolId", ",", "String", "nodeId", ",", "String", "fileName", ")", "throws", "BatchErrorException", ",", "IOException", "{", "return", "getFilePropertiesFromComputeNode", "(", "poolId", ",", ...
Gets information about a file on a compute node. @param poolId The ID of the pool that contains the compute node. @param nodeId the ID of the compute node. @param fileName The name of the file to retrieve. @return A {@link FileProperties} instance containing information about the file. @throws BatchErrorException Exception thrown when an error response is received from the Batch service. @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
[ "Gets", "information", "about", "a", "file", "on", "a", "compute", "node", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/FileOperations.java#L371-L373
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/util/ShapeGenerator.java
ShapeGenerator.createSliderThumbContinuous
public Shape createSliderThumbContinuous(final int x, final int y, final int diameter) { """ Return a path for a continuous slider thumb's concentric sections. @param x the X coordinate of the upper-left corner of the section @param y the Y coordinate of the upper-left corner of the section @param diameter the diameter of the section @return a path representing the shape. """ return createEllipseInternal(x, y, diameter, diameter); }
java
public Shape createSliderThumbContinuous(final int x, final int y, final int diameter) { return createEllipseInternal(x, y, diameter, diameter); }
[ "public", "Shape", "createSliderThumbContinuous", "(", "final", "int", "x", ",", "final", "int", "y", ",", "final", "int", "diameter", ")", "{", "return", "createEllipseInternal", "(", "x", ",", "y", ",", "diameter", ",", "diameter", ")", ";", "}" ]
Return a path for a continuous slider thumb's concentric sections. @param x the X coordinate of the upper-left corner of the section @param y the Y coordinate of the upper-left corner of the section @param diameter the diameter of the section @return a path representing the shape.
[ "Return", "a", "path", "for", "a", "continuous", "slider", "thumb", "s", "concentric", "sections", "." ]
train
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/util/ShapeGenerator.java#L512-L514
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.billingAccount_portability_id_relaunch_GET
public OvhPortabilityFixErrorPossibleParameters billingAccount_portability_id_relaunch_GET(String billingAccount, Long id) throws IOException { """ Indicates whether or not error can be fixed and portability can be relaunched REST: GET /telephony/{billingAccount}/portability/{id}/relaunch @param billingAccount [required] The name of your billingAccount @param id [required] The ID of the portability """ String qPath = "/telephony/{billingAccount}/portability/{id}/relaunch"; StringBuilder sb = path(qPath, billingAccount, id); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhPortabilityFixErrorPossibleParameters.class); }
java
public OvhPortabilityFixErrorPossibleParameters billingAccount_portability_id_relaunch_GET(String billingAccount, Long id) throws IOException { String qPath = "/telephony/{billingAccount}/portability/{id}/relaunch"; StringBuilder sb = path(qPath, billingAccount, id); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhPortabilityFixErrorPossibleParameters.class); }
[ "public", "OvhPortabilityFixErrorPossibleParameters", "billingAccount_portability_id_relaunch_GET", "(", "String", "billingAccount", ",", "Long", "id", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/telephony/{billingAccount}/portability/{id}/relaunch\"", ";", "St...
Indicates whether or not error can be fixed and portability can be relaunched REST: GET /telephony/{billingAccount}/portability/{id}/relaunch @param billingAccount [required] The name of your billingAccount @param id [required] The ID of the portability
[ "Indicates", "whether", "or", "not", "error", "can", "be", "fixed", "and", "portability", "can", "be", "relaunched" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L330-L335
lessthanoptimal/BoofCV
main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/QrCodePolynomialMath.java
QrCodePolynomialMath.encodeFormatBits
public static int encodeFormatBits(QrCode.ErrorLevel level , int mask ) { """ Encodes the format bits. BCH(15,5) @param level Error correction level @param mask The type of mask that is applied to the qr code @return encoded bit field """ int message = (level.value << 3) | (mask & 0xFFFFFFF7); message = message << 10; return message ^ bitPolyModulus(message, FORMAT_GENERATOR,15,5); }
java
public static int encodeFormatBits(QrCode.ErrorLevel level , int mask ) { int message = (level.value << 3) | (mask & 0xFFFFFFF7); message = message << 10; return message ^ bitPolyModulus(message, FORMAT_GENERATOR,15,5); }
[ "public", "static", "int", "encodeFormatBits", "(", "QrCode", ".", "ErrorLevel", "level", ",", "int", "mask", ")", "{", "int", "message", "=", "(", "level", ".", "value", "<<", "3", ")", "|", "(", "mask", "&", "0xFFFFFFF7", ")", ";", "message", "=", ...
Encodes the format bits. BCH(15,5) @param level Error correction level @param mask The type of mask that is applied to the qr code @return encoded bit field
[ "Encodes", "the", "format", "bits", ".", "BCH", "(", "15", "5", ")" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/QrCodePolynomialMath.java#L75-L79
wstrange/GoogleAuth
src/main/java/com/warrenstrange/googleauth/GoogleAuthenticatorQRGenerator.java
GoogleAuthenticatorQRGenerator.getOtpAuthURL
public static String getOtpAuthURL(String issuer, String accountName, GoogleAuthenticatorKey credentials) { """ Returns the URL of a Google Chart API call to generate a QR barcode to be loaded into the Google Authenticator application. The user scans this bar code with the application on their smart phones or enters the secret manually. <p/> The current implementation supports the following features: <ul> <li>Label, made up of an optional issuer and an account name.</li> <li>Secret parameter.</li> <li>Issuer parameter.</li> </ul> @param issuer The issuer name. This parameter cannot contain the colon (:) character. This parameter can be null. @param accountName The account name. This parameter shall not be null. @param credentials The generated credentials. This parameter shall not be null. @return the Google Chart API call URL to generate a QR code containing the provided information. @see <a href="https://code.google.com/p/google-authenticator/wiki/KeyUriFormat">Google Authenticator - KeyUriFormat</a> """ return String.format( TOTP_URI_FORMAT, internalURLEncode(getOtpAuthTotpURL(issuer, accountName, credentials))); }
java
public static String getOtpAuthURL(String issuer, String accountName, GoogleAuthenticatorKey credentials) { return String.format( TOTP_URI_FORMAT, internalURLEncode(getOtpAuthTotpURL(issuer, accountName, credentials))); }
[ "public", "static", "String", "getOtpAuthURL", "(", "String", "issuer", ",", "String", "accountName", ",", "GoogleAuthenticatorKey", "credentials", ")", "{", "return", "String", ".", "format", "(", "TOTP_URI_FORMAT", ",", "internalURLEncode", "(", "getOtpAuthTotpURL",...
Returns the URL of a Google Chart API call to generate a QR barcode to be loaded into the Google Authenticator application. The user scans this bar code with the application on their smart phones or enters the secret manually. <p/> The current implementation supports the following features: <ul> <li>Label, made up of an optional issuer and an account name.</li> <li>Secret parameter.</li> <li>Issuer parameter.</li> </ul> @param issuer The issuer name. This parameter cannot contain the colon (:) character. This parameter can be null. @param accountName The account name. This parameter shall not be null. @param credentials The generated credentials. This parameter shall not be null. @return the Google Chart API call URL to generate a QR code containing the provided information. @see <a href="https://code.google.com/p/google-authenticator/wiki/KeyUriFormat">Google Authenticator - KeyUriFormat</a>
[ "Returns", "the", "URL", "of", "a", "Google", "Chart", "API", "call", "to", "generate", "a", "QR", "barcode", "to", "be", "loaded", "into", "the", "Google", "Authenticator", "application", ".", "The", "user", "scans", "this", "bar", "code", "with", "the", ...
train
https://github.com/wstrange/GoogleAuth/blob/03f37333f8b3e411e10e63a7c85c4d2155929321/src/main/java/com/warrenstrange/googleauth/GoogleAuthenticatorQRGenerator.java#L136-L144
Waikato/moa
moa/src/main/java/moa/gui/visualization/GraphCanvas.java
GraphCanvas.addEvents
private void addEvents() { """ check if there are any new events in the event list and add them to the plot """ if (clusterEvents != null && clusterEvents.size() > eventCounter) { ClusterEvent ev = clusterEvents.get(eventCounter); eventCounter++; JLabel eventMarker = new JLabel(ev.getType().substring(0, 1)); eventMarker.setPreferredSize(new Dimension(20, y_offset_top)); eventMarker.setSize(new Dimension(20, y_offset_top)); eventMarker.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); int x = (int) (ev.getTimestamp() / processFrequency / x_resolution); eventMarker.setLocation(x - 10, 0); eventMarker.setToolTipText(ev.getType() + " at " + ev.getTimestamp() + ": " + ev.getMessage()); eventPanel.add(eventMarker); eventLabelList.add(eventMarker); eventPanel.repaint(); } }
java
private void addEvents() { if (clusterEvents != null && clusterEvents.size() > eventCounter) { ClusterEvent ev = clusterEvents.get(eventCounter); eventCounter++; JLabel eventMarker = new JLabel(ev.getType().substring(0, 1)); eventMarker.setPreferredSize(new Dimension(20, y_offset_top)); eventMarker.setSize(new Dimension(20, y_offset_top)); eventMarker.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); int x = (int) (ev.getTimestamp() / processFrequency / x_resolution); eventMarker.setLocation(x - 10, 0); eventMarker.setToolTipText(ev.getType() + " at " + ev.getTimestamp() + ": " + ev.getMessage()); eventPanel.add(eventMarker); eventLabelList.add(eventMarker); eventPanel.repaint(); } }
[ "private", "void", "addEvents", "(", ")", "{", "if", "(", "clusterEvents", "!=", "null", "&&", "clusterEvents", ".", "size", "(", ")", ">", "eventCounter", ")", "{", "ClusterEvent", "ev", "=", "clusterEvents", ".", "get", "(", "eventCounter", ")", ";", "...
check if there are any new events in the event list and add them to the plot
[ "check", "if", "there", "are", "any", "new", "events", "in", "the", "event", "list", "and", "add", "them", "to", "the", "plot" ]
train
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/gui/visualization/GraphCanvas.java#L203-L220
Stratio/stratio-cassandra
src/java/org/apache/cassandra/auth/DataResource.java
DataResource.fromName
public static DataResource fromName(String name) { """ Parses a data resource name into a DataResource instance. @param name Name of the data resource. @return DataResource instance matching the name. """ String[] parts = StringUtils.split(name, '/'); if (!parts[0].equals(ROOT_NAME) || parts.length > 3) throw new IllegalArgumentException(String.format("%s is not a valid data resource name", name)); if (parts.length == 1) return root(); if (parts.length == 2) return keyspace(parts[1]); return columnFamily(parts[1], parts[2]); }
java
public static DataResource fromName(String name) { String[] parts = StringUtils.split(name, '/'); if (!parts[0].equals(ROOT_NAME) || parts.length > 3) throw new IllegalArgumentException(String.format("%s is not a valid data resource name", name)); if (parts.length == 1) return root(); if (parts.length == 2) return keyspace(parts[1]); return columnFamily(parts[1], parts[2]); }
[ "public", "static", "DataResource", "fromName", "(", "String", "name", ")", "{", "String", "[", "]", "parts", "=", "StringUtils", ".", "split", "(", "name", ",", "'", "'", ")", ";", "if", "(", "!", "parts", "[", "0", "]", ".", "equals", "(", "ROOT_...
Parses a data resource name into a DataResource instance. @param name Name of the data resource. @return DataResource instance matching the name.
[ "Parses", "a", "data", "resource", "name", "into", "a", "DataResource", "instance", "." ]
train
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/auth/DataResource.java#L105-L119
google/closure-compiler
src/com/google/javascript/jscomp/StrictModeCheck.java
StrictModeCheck.checkDelete
private static void checkDelete(NodeTraversal t, Node n) { """ Checks that variables, functions, and arguments are not deleted. """ if (n.getFirstChild().isName()) { Var v = t.getScope().getVar(n.getFirstChild().getString()); if (v != null) { t.report(n, DELETE_VARIABLE); } } }
java
private static void checkDelete(NodeTraversal t, Node n) { if (n.getFirstChild().isName()) { Var v = t.getScope().getVar(n.getFirstChild().getString()); if (v != null) { t.report(n, DELETE_VARIABLE); } } }
[ "private", "static", "void", "checkDelete", "(", "NodeTraversal", "t", ",", "Node", "n", ")", "{", "if", "(", "n", ".", "getFirstChild", "(", ")", ".", "isName", "(", ")", ")", "{", "Var", "v", "=", "t", ".", "getScope", "(", ")", ".", "getVar", ...
Checks that variables, functions, and arguments are not deleted.
[ "Checks", "that", "variables", "functions", "and", "arguments", "are", "not", "deleted", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/StrictModeCheck.java#L165-L172
datumbox/datumbox-framework
datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/distributions/ContinuousDistributions.java
ContinuousDistributions.betaCdf
public static double betaCdf(double x, double a, double b) { """ Calculates the probability from 0 to X under Beta Distribution @param x @param a @param b @return """ if(x<0 || a<=0 || b<=0) { throw new IllegalArgumentException("All the parameters must be positive."); } double Bcdf = 0.0; if(x==0) { return Bcdf; } else if (x>=1) { Bcdf=1.0; return Bcdf; } double S= a + b; double BT = Math.exp(logGamma(S)-logGamma(b)-logGamma(a)+a*Math.log(x)+b*Math.log(1-x)); if (x<(a+1.0)/(S+2.0)) { Bcdf=BT*betinc(x,a,b); } else { Bcdf=1.0-BT*betinc(1.0-x,b,a); } return Bcdf; }
java
public static double betaCdf(double x, double a, double b) { if(x<0 || a<=0 || b<=0) { throw new IllegalArgumentException("All the parameters must be positive."); } double Bcdf = 0.0; if(x==0) { return Bcdf; } else if (x>=1) { Bcdf=1.0; return Bcdf; } double S= a + b; double BT = Math.exp(logGamma(S)-logGamma(b)-logGamma(a)+a*Math.log(x)+b*Math.log(1-x)); if (x<(a+1.0)/(S+2.0)) { Bcdf=BT*betinc(x,a,b); } else { Bcdf=1.0-BT*betinc(1.0-x,b,a); } return Bcdf; }
[ "public", "static", "double", "betaCdf", "(", "double", "x", ",", "double", "a", ",", "double", "b", ")", "{", "if", "(", "x", "<", "0", "||", "a", "<=", "0", "||", "b", "<=", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"All t...
Calculates the probability from 0 to X under Beta Distribution @param x @param a @param b @return
[ "Calculates", "the", "probability", "from", "0", "to", "X", "under", "Beta", "Distribution" ]
train
https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/distributions/ContinuousDistributions.java#L213-L239
Harium/keel
src/main/java/com/harium/keel/catalano/math/Approximation.java
Approximation.atan2
public static double atan2(double y, double x) { """ Returns the angle theta from the conversion of rectangular coordinates (x, y) to polar coordinates (r, theta). This method computes the phase theta by computing an arc tangent of y/x in the range of -pi to pi. @param y Y axis coordinate. @param x X axis coordinate. @return The theta component of the point (r, theta) in polar coordinates that corresponds to the point (x, y) in Cartesian coordinates. """ double coeff_1 = 0.78539816339744830961566084581988;//Math.PI / 4d; double coeff_2 = 3d * coeff_1; double abs_y = Math.abs(y); double angle; if (x >= 0d) { double r = (x - abs_y) / (x + abs_y); angle = coeff_1 - coeff_1 * r; } else { double r = (x + abs_y) / (abs_y - x); angle = coeff_2 - coeff_1 * r; } return y < 0d ? -angle : angle - 0.06; }
java
public static double atan2(double y, double x) { double coeff_1 = 0.78539816339744830961566084581988;//Math.PI / 4d; double coeff_2 = 3d * coeff_1; double abs_y = Math.abs(y); double angle; if (x >= 0d) { double r = (x - abs_y) / (x + abs_y); angle = coeff_1 - coeff_1 * r; } else { double r = (x + abs_y) / (abs_y - x); angle = coeff_2 - coeff_1 * r; } return y < 0d ? -angle : angle - 0.06; }
[ "public", "static", "double", "atan2", "(", "double", "y", ",", "double", "x", ")", "{", "double", "coeff_1", "=", "0.78539816339744830961566084581988", ";", "//Math.PI / 4d;\r", "double", "coeff_2", "=", "3d", "*", "coeff_1", ";", "double", "abs_y", "=", "Mat...
Returns the angle theta from the conversion of rectangular coordinates (x, y) to polar coordinates (r, theta). This method computes the phase theta by computing an arc tangent of y/x in the range of -pi to pi. @param y Y axis coordinate. @param x X axis coordinate. @return The theta component of the point (r, theta) in polar coordinates that corresponds to the point (x, y) in Cartesian coordinates.
[ "Returns", "the", "angle", "theta", "from", "the", "conversion", "of", "rectangular", "coordinates", "(", "x", "y", ")", "to", "polar", "coordinates", "(", "r", "theta", ")", ".", "This", "method", "computes", "the", "phase", "theta", "by", "computing", "a...
train
https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/math/Approximation.java#L171-L184
relayrides/pushy
pushy/src/main/java/com/turo/pushy/apns/ApnsClientBuilder.java
ApnsClientBuilder.setApnsServer
public ApnsClientBuilder setApnsServer(final String hostname, final int port) { """ Sets the hostname and port of the server to which the client under construction will connect. Apple provides a production and development environment, both of which listen for traffic on the default HTTPS port ({@value DEFAULT_APNS_PORT}) and an alternate port ({@value ALTERNATE_APNS_PORT}), which callers may use to work around firewall or proxy restrictions. @param hostname the hostname of the server to which the client under construction should connect @param port the port to which the client under contruction should connect @return a reference to this builder @see ApnsClientBuilder#DEVELOPMENT_APNS_HOST @see ApnsClientBuilder#PRODUCTION_APNS_HOST @see ApnsClientBuilder#DEFAULT_APNS_PORT @see ApnsClientBuilder#ALTERNATE_APNS_PORT @see <a href="https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/sending_notification_requests_to_apns">Sending Notification Requests to APNs</a> @since 0.11 """ this.apnsServerAddress = InetSocketAddress.createUnresolved(hostname, port); return this; }
java
public ApnsClientBuilder setApnsServer(final String hostname, final int port) { this.apnsServerAddress = InetSocketAddress.createUnresolved(hostname, port); return this; }
[ "public", "ApnsClientBuilder", "setApnsServer", "(", "final", "String", "hostname", ",", "final", "int", "port", ")", "{", "this", ".", "apnsServerAddress", "=", "InetSocketAddress", ".", "createUnresolved", "(", "hostname", ",", "port", ")", ";", "return", "thi...
Sets the hostname and port of the server to which the client under construction will connect. Apple provides a production and development environment, both of which listen for traffic on the default HTTPS port ({@value DEFAULT_APNS_PORT}) and an alternate port ({@value ALTERNATE_APNS_PORT}), which callers may use to work around firewall or proxy restrictions. @param hostname the hostname of the server to which the client under construction should connect @param port the port to which the client under contruction should connect @return a reference to this builder @see ApnsClientBuilder#DEVELOPMENT_APNS_HOST @see ApnsClientBuilder#PRODUCTION_APNS_HOST @see ApnsClientBuilder#DEFAULT_APNS_PORT @see ApnsClientBuilder#ALTERNATE_APNS_PORT @see <a href="https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/sending_notification_requests_to_apns">Sending Notification Requests to APNs</a> @since 0.11
[ "Sets", "the", "hostname", "and", "port", "of", "the", "server", "to", "which", "the", "client", "under", "construction", "will", "connect", ".", "Apple", "provides", "a", "production", "and", "development", "environment", "both", "of", "which", "listen", "for...
train
https://github.com/relayrides/pushy/blob/1f6f9a0e07d785c815d74c2320a8d87c80231d36/pushy/src/main/java/com/turo/pushy/apns/ApnsClientBuilder.java#L164-L167
Netflix/servo
servo-core/src/main/java/com/netflix/servo/util/ThreadCpuStats.java
ThreadCpuStats.printThreadCpuUsages
public void printThreadCpuUsages(OutputStream out, CpuUsageComparator cmp) { """ Utility function that dumps the cpu usages for the threads to stdout. Output will be sorted based on the 1-minute usage from highest to lowest. @param out stream where output will be written @param cmp order to use for the results """ final PrintWriter writer = getPrintWriter(out); final Map<String, Object> threadCpuUsages = getThreadCpuUsages(cmp); writer.printf("Time: %s%n%n", new Date((Long) threadCpuUsages.get(CURRENT_TIME))); final long uptimeMillis = (Long) threadCpuUsages.get(UPTIME_MS); final long uptimeNanos = TimeUnit.NANOSECONDS.convert(uptimeMillis, TimeUnit.MILLISECONDS); writer.printf("Uptime: %s%n%n", toDuration(uptimeNanos)); @SuppressWarnings("unchecked") final Map<String, Long> jvmUsageTime = (Map<String, Long>) threadCpuUsages.get(JVM_USAGE_TIME); writer.println("JVM Usage Time: "); writer.printf("%11s %11s %11s %11s %7s %s%n", "1-min", "5-min", "15-min", "overall", "id", "name"); writer.printf("%11s %11s %11s %11s %7s %s%n", toDuration(jvmUsageTime.get(ONE_MIN)), toDuration(jvmUsageTime.get(FIVE_MIN)), toDuration(jvmUsageTime.get(FIFTEEN_MIN)), toDuration(jvmUsageTime.get(OVERALL)), "-", "jvm"); writer.println(); @SuppressWarnings("unchecked") final Map<String, Double> jvmUsagePerc = (Map<String, Double>) threadCpuUsages.get(JVM_USAGE_PERCENT); writer.println("JVM Usage Percent: "); writer.printf("%11s %11s %11s %11s %7s %s%n", "1-min", "5-min", "15-min", "overall", "id", "name"); writer.printf("%10.2f%% %10.2f%% %10.2f%% %10.2f%% %7s %s%n", jvmUsagePerc.get(ONE_MIN), jvmUsagePerc.get(FIVE_MIN), jvmUsagePerc.get(FIFTEEN_MIN), jvmUsagePerc.get(OVERALL), "-", "jvm"); writer.println(); writer.println("Breakdown by thread (100% = total cpu usage for jvm):"); writer.printf("%11s %11s %11s %11s %7s %s%n", "1-min", "5-min", "15-min", "overall", "id", "name"); @SuppressWarnings("unchecked") List<Map<String, Object>> threads = (List<Map<String, Object>>) threadCpuUsages.get(THREADS); for (Map<String, Object> thread : threads) { writer.printf("%10.2f%% %10.2f%% %10.2f%% %10.2f%% %7d %s%n", thread.get(ONE_MIN), thread.get(FIVE_MIN), thread.get(FIFTEEN_MIN), thread.get(OVERALL), thread.get(ID), thread.get(NAME)); } writer.println(); writer.flush(); }
java
public void printThreadCpuUsages(OutputStream out, CpuUsageComparator cmp) { final PrintWriter writer = getPrintWriter(out); final Map<String, Object> threadCpuUsages = getThreadCpuUsages(cmp); writer.printf("Time: %s%n%n", new Date((Long) threadCpuUsages.get(CURRENT_TIME))); final long uptimeMillis = (Long) threadCpuUsages.get(UPTIME_MS); final long uptimeNanos = TimeUnit.NANOSECONDS.convert(uptimeMillis, TimeUnit.MILLISECONDS); writer.printf("Uptime: %s%n%n", toDuration(uptimeNanos)); @SuppressWarnings("unchecked") final Map<String, Long> jvmUsageTime = (Map<String, Long>) threadCpuUsages.get(JVM_USAGE_TIME); writer.println("JVM Usage Time: "); writer.printf("%11s %11s %11s %11s %7s %s%n", "1-min", "5-min", "15-min", "overall", "id", "name"); writer.printf("%11s %11s %11s %11s %7s %s%n", toDuration(jvmUsageTime.get(ONE_MIN)), toDuration(jvmUsageTime.get(FIVE_MIN)), toDuration(jvmUsageTime.get(FIFTEEN_MIN)), toDuration(jvmUsageTime.get(OVERALL)), "-", "jvm"); writer.println(); @SuppressWarnings("unchecked") final Map<String, Double> jvmUsagePerc = (Map<String, Double>) threadCpuUsages.get(JVM_USAGE_PERCENT); writer.println("JVM Usage Percent: "); writer.printf("%11s %11s %11s %11s %7s %s%n", "1-min", "5-min", "15-min", "overall", "id", "name"); writer.printf("%10.2f%% %10.2f%% %10.2f%% %10.2f%% %7s %s%n", jvmUsagePerc.get(ONE_MIN), jvmUsagePerc.get(FIVE_MIN), jvmUsagePerc.get(FIFTEEN_MIN), jvmUsagePerc.get(OVERALL), "-", "jvm"); writer.println(); writer.println("Breakdown by thread (100% = total cpu usage for jvm):"); writer.printf("%11s %11s %11s %11s %7s %s%n", "1-min", "5-min", "15-min", "overall", "id", "name"); @SuppressWarnings("unchecked") List<Map<String, Object>> threads = (List<Map<String, Object>>) threadCpuUsages.get(THREADS); for (Map<String, Object> thread : threads) { writer.printf("%10.2f%% %10.2f%% %10.2f%% %10.2f%% %7d %s%n", thread.get(ONE_MIN), thread.get(FIVE_MIN), thread.get(FIFTEEN_MIN), thread.get(OVERALL), thread.get(ID), thread.get(NAME)); } writer.println(); writer.flush(); }
[ "public", "void", "printThreadCpuUsages", "(", "OutputStream", "out", ",", "CpuUsageComparator", "cmp", ")", "{", "final", "PrintWriter", "writer", "=", "getPrintWriter", "(", "out", ")", ";", "final", "Map", "<", "String", ",", "Object", ">", "threadCpuUsages",...
Utility function that dumps the cpu usages for the threads to stdout. Output will be sorted based on the 1-minute usage from highest to lowest. @param out stream where output will be written @param cmp order to use for the results
[ "Utility", "function", "that", "dumps", "the", "cpu", "usages", "for", "the", "threads", "to", "stdout", ".", "Output", "will", "be", "sorted", "based", "on", "the", "1", "-", "minute", "usage", "from", "highest", "to", "lowest", "." ]
train
https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-core/src/main/java/com/netflix/servo/util/ThreadCpuStats.java#L282-L338
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/utils/coverage/CoverageUtilities.java
CoverageUtilities.createGridGeometryGeneralParameter
public static GeneralParameterValue[] createGridGeometryGeneralParameter( int width, int height, double north, double south, double east, double west, CoordinateReferenceSystem crs ) { """ Utility method to create read parameters for {@link GridCoverageReader} @param width the needed number of columns. @param height the needed number of columns. @param north the northern boundary. @param south the southern boundary. @param east the eastern boundary. @param west the western boundary. @param crs the {@link CoordinateReferenceSystem}. Can be null, even if it should not. @return the {@link GeneralParameterValue array of parameters}. """ GeneralParameterValue[] readParams = new GeneralParameterValue[1]; Parameter<GridGeometry2D> readGG = new Parameter<GridGeometry2D>(AbstractGridFormat.READ_GRIDGEOMETRY2D); GridEnvelope2D gridEnvelope = new GridEnvelope2D(0, 0, width, height); Envelope env; if (crs != null) { env = new ReferencedEnvelope(west, east, south, north, crs); } else { DirectPosition2D minDp = new DirectPosition2D(west, south); DirectPosition2D maxDp = new DirectPosition2D(east, north); env = new Envelope2D(minDp, maxDp); } GridGeometry2D gridGeometry = new GridGeometry2D(gridEnvelope, env); readGG.setValue(gridGeometry); readParams[0] = readGG; return readParams; }
java
public static GeneralParameterValue[] createGridGeometryGeneralParameter( int width, int height, double north, double south, double east, double west, CoordinateReferenceSystem crs ) { GeneralParameterValue[] readParams = new GeneralParameterValue[1]; Parameter<GridGeometry2D> readGG = new Parameter<GridGeometry2D>(AbstractGridFormat.READ_GRIDGEOMETRY2D); GridEnvelope2D gridEnvelope = new GridEnvelope2D(0, 0, width, height); Envelope env; if (crs != null) { env = new ReferencedEnvelope(west, east, south, north, crs); } else { DirectPosition2D minDp = new DirectPosition2D(west, south); DirectPosition2D maxDp = new DirectPosition2D(east, north); env = new Envelope2D(minDp, maxDp); } GridGeometry2D gridGeometry = new GridGeometry2D(gridEnvelope, env); readGG.setValue(gridGeometry); readParams[0] = readGG; return readParams; }
[ "public", "static", "GeneralParameterValue", "[", "]", "createGridGeometryGeneralParameter", "(", "int", "width", ",", "int", "height", ",", "double", "north", ",", "double", "south", ",", "double", "east", ",", "double", "west", ",", "CoordinateReferenceSystem", ...
Utility method to create read parameters for {@link GridCoverageReader} @param width the needed number of columns. @param height the needed number of columns. @param north the northern boundary. @param south the southern boundary. @param east the eastern boundary. @param west the western boundary. @param crs the {@link CoordinateReferenceSystem}. Can be null, even if it should not. @return the {@link GeneralParameterValue array of parameters}.
[ "Utility", "method", "to", "create", "read", "parameters", "for", "{", "@link", "GridCoverageReader", "}" ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/coverage/CoverageUtilities.java#L623-L641
jurmous/etcd4j
src/main/java/mousio/etcd4j/security/SecurityContextBuilder.java
SecurityContextBuilder.forKeystore
public static SslContext forKeystore(String keystorePath, String keystorePassword, String keyManagerAlgorithm) throws SecurityContextException { """ Builds SslContext using protected keystore file overriding default key manger algorithm. Adequate for non-mutual TLS connections. @param keystorePath Path for keystore file @param keystorePassword Password for protected keystore file @param keyManagerAlgorithm Algorithm for keyManager used to process keystorefile @return SslContext ready to use @throws SecurityContextException for any troubles building the SslContext """ try { return forKeystore(new FileInputStream(keystorePath), keystorePassword, keyManagerAlgorithm); } catch (Exception e) { throw new SecurityContextException(e); } }
java
public static SslContext forKeystore(String keystorePath, String keystorePassword, String keyManagerAlgorithm) throws SecurityContextException { try { return forKeystore(new FileInputStream(keystorePath), keystorePassword, keyManagerAlgorithm); } catch (Exception e) { throw new SecurityContextException(e); } }
[ "public", "static", "SslContext", "forKeystore", "(", "String", "keystorePath", ",", "String", "keystorePassword", ",", "String", "keyManagerAlgorithm", ")", "throws", "SecurityContextException", "{", "try", "{", "return", "forKeystore", "(", "new", "FileInputStream", ...
Builds SslContext using protected keystore file overriding default key manger algorithm. Adequate for non-mutual TLS connections. @param keystorePath Path for keystore file @param keystorePassword Password for protected keystore file @param keyManagerAlgorithm Algorithm for keyManager used to process keystorefile @return SslContext ready to use @throws SecurityContextException for any troubles building the SslContext
[ "Builds", "SslContext", "using", "protected", "keystore", "file", "overriding", "default", "key", "manger", "algorithm", ".", "Adequate", "for", "non", "-", "mutual", "TLS", "connections", "." ]
train
https://github.com/jurmous/etcd4j/blob/ffb1d574cf85bbab025dd566ce250f1860bbcbc7/src/main/java/mousio/etcd4j/security/SecurityContextBuilder.java#L41-L49
artikcloud/artikcloud-java
src/main/java/cloud/artik/api/UsersApi.java
UsersApi.listAllSharesForUser
public DeviceSharingEnvelope listAllSharesForUser(String userId, String filter, Integer count, Integer offset) throws ApiException { """ Get User shares Get User shares @param userId User ID. (required) @param filter filter (required) @param count Desired count of items in the result set. (optional) @param offset Offset for pagination. (optional) @return DeviceSharingEnvelope @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body """ ApiResponse<DeviceSharingEnvelope> resp = listAllSharesForUserWithHttpInfo(userId, filter, count, offset); return resp.getData(); }
java
public DeviceSharingEnvelope listAllSharesForUser(String userId, String filter, Integer count, Integer offset) throws ApiException { ApiResponse<DeviceSharingEnvelope> resp = listAllSharesForUserWithHttpInfo(userId, filter, count, offset); return resp.getData(); }
[ "public", "DeviceSharingEnvelope", "listAllSharesForUser", "(", "String", "userId", ",", "String", "filter", ",", "Integer", "count", ",", "Integer", "offset", ")", "throws", "ApiException", "{", "ApiResponse", "<", "DeviceSharingEnvelope", ">", "resp", "=", "listAl...
Get User shares Get User shares @param userId User ID. (required) @param filter filter (required) @param count Desired count of items in the result set. (optional) @param offset Offset for pagination. (optional) @return DeviceSharingEnvelope @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Get", "User", "shares", "Get", "User", "shares" ]
train
https://github.com/artikcloud/artikcloud-java/blob/412f447573e7796ab4f685c0bdd5eb76185a365c/src/main/java/cloud/artik/api/UsersApi.java#L1056-L1059
paypal/SeLion
client/src/main/java/com/paypal/selion/platform/asserts/SeLionSoftAssert.java
SeLionSoftAssert.showAssertInfo
private void showAssertInfo(IAssert<?> assertCommand, AssertionError ex, boolean failedTest) { """ Shows a message in Reporter based on the assert result and also includes the stacktrace for failed assert. @param assertCommand The assert conditions for current test. @param ex An {@link AssertionError} in case of failed assert, else null. @param failedTest A boolean {@code true} when the assert has failed. """ ITestResult testResult = Reporter.getCurrentTestResult(); // Checks whether the soft assert was called in a TestNG test run or else within a Java application. String methodName = "main"; if (testResult != null) { methodName = testResult.getMethod().getMethodName(); } StringBuilder sb = new StringBuilder(); sb.append("Soft Assert "); if (assertCommand.getMessage() != null && !assertCommand.getMessage().trim().isEmpty()) { sb.append("[").append(assertCommand.getMessage()).append("] "); } if (failedTest) { sb.append("failed in "); } else { sb.append("passed in "); } sb.append(methodName).append("()\n"); if (failedTest) { sb.append(ExceptionUtils.getStackTrace(ex)); } Reporter.log(sb.toString(), true); }
java
private void showAssertInfo(IAssert<?> assertCommand, AssertionError ex, boolean failedTest) { ITestResult testResult = Reporter.getCurrentTestResult(); // Checks whether the soft assert was called in a TestNG test run or else within a Java application. String methodName = "main"; if (testResult != null) { methodName = testResult.getMethod().getMethodName(); } StringBuilder sb = new StringBuilder(); sb.append("Soft Assert "); if (assertCommand.getMessage() != null && !assertCommand.getMessage().trim().isEmpty()) { sb.append("[").append(assertCommand.getMessage()).append("] "); } if (failedTest) { sb.append("failed in "); } else { sb.append("passed in "); } sb.append(methodName).append("()\n"); if (failedTest) { sb.append(ExceptionUtils.getStackTrace(ex)); } Reporter.log(sb.toString(), true); }
[ "private", "void", "showAssertInfo", "(", "IAssert", "<", "?", ">", "assertCommand", ",", "AssertionError", "ex", ",", "boolean", "failedTest", ")", "{", "ITestResult", "testResult", "=", "Reporter", ".", "getCurrentTestResult", "(", ")", ";", "// Checks whether t...
Shows a message in Reporter based on the assert result and also includes the stacktrace for failed assert. @param assertCommand The assert conditions for current test. @param ex An {@link AssertionError} in case of failed assert, else null. @param failedTest A boolean {@code true} when the assert has failed.
[ "Shows", "a", "message", "in", "Reporter", "based", "on", "the", "assert", "result", "and", "also", "includes", "the", "stacktrace", "for", "failed", "assert", "." ]
train
https://github.com/paypal/SeLion/blob/694d12d0df76db48d0360b16192770c6a4fbdfd2/client/src/main/java/com/paypal/selion/platform/asserts/SeLionSoftAssert.java#L71-L95
OpenLiberty/open-liberty
dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/jdbc/WSJdbcPreparedStatement.java
WSJdbcPreparedStatement.executeBatch
private Object executeBatch(Object implObject, Method method, Object[] args) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, SQLException { """ Invokes executeBatch and after closing any previous result sets and ensuring statement properties are up-to-date. @param implObject the instance on which the operation is invoked. @param method the method that is invoked. @param args the parameters to the method. @throws IllegalAccessException if the method is inaccessible. @throws IllegalArgumentException if the instance does not have the method or if the method arguments are not appropriate. @throws InvocationTargetException if the method raises a checked exception. @throws SQLException if unable to invoke the method for other reasons. @return the result of invoking the method. """ final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); if (isTraceOn && tc.isEntryEnabled()) Tr.entry(tc, "executeBatch", new Object[] { this, args[0] }); if (childWrapper != null) { closeAndRemoveResultSet(); } if (childWrappers != null && !childWrappers.isEmpty()) { closeAndRemoveResultSets(); } enforceStatementProperties(); Object results = method.invoke(implObject, args); if (isTraceOn && tc.isEntryEnabled()) Tr.exit(tc, "executeBatch", results instanceof int[] ? Arrays.toString((int[]) results) : results); return results; }
java
private Object executeBatch(Object implObject, Method method, Object[] args) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, SQLException { final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); if (isTraceOn && tc.isEntryEnabled()) Tr.entry(tc, "executeBatch", new Object[] { this, args[0] }); if (childWrapper != null) { closeAndRemoveResultSet(); } if (childWrappers != null && !childWrappers.isEmpty()) { closeAndRemoveResultSets(); } enforceStatementProperties(); Object results = method.invoke(implObject, args); if (isTraceOn && tc.isEntryEnabled()) Tr.exit(tc, "executeBatch", results instanceof int[] ? Arrays.toString((int[]) results) : results); return results; }
[ "private", "Object", "executeBatch", "(", "Object", "implObject", ",", "Method", "method", ",", "Object", "[", "]", "args", ")", "throws", "IllegalAccessException", ",", "IllegalArgumentException", ",", "InvocationTargetException", ",", "SQLException", "{", "final", ...
Invokes executeBatch and after closing any previous result sets and ensuring statement properties are up-to-date. @param implObject the instance on which the operation is invoked. @param method the method that is invoked. @param args the parameters to the method. @throws IllegalAccessException if the method is inaccessible. @throws IllegalArgumentException if the instance does not have the method or if the method arguments are not appropriate. @throws InvocationTargetException if the method raises a checked exception. @throws SQLException if unable to invoke the method for other reasons. @return the result of invoking the method.
[ "Invokes", "executeBatch", "and", "after", "closing", "any", "previous", "result", "sets", "and", "ensuring", "statement", "properties", "are", "up", "-", "to", "-", "date", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/jdbc/WSJdbcPreparedStatement.java#L430-L453
algolia/algoliasearch-client-java
src/main/java/com/algolia/search/saas/Index.java
Index.getObject
public JSONObject getObject(String objectID, List<String> attributesToRetrieve, RequestOptions requestOptions) throws AlgoliaException { """ Get an object from this index @param objectID the unique identifier of the object to retrieve @param attributesToRetrieve contains the list of attributes to retrieve. @param requestOptions Options to pass to this request """ try { String params = encodeAttributes(attributesToRetrieve, true); return client.getRequest("/1/indexes/" + encodedIndexName + "/" + URLEncoder.encode(objectID, "UTF-8") + params.toString(), false, requestOptions); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } }
java
public JSONObject getObject(String objectID, List<String> attributesToRetrieve, RequestOptions requestOptions) throws AlgoliaException { try { String params = encodeAttributes(attributesToRetrieve, true); return client.getRequest("/1/indexes/" + encodedIndexName + "/" + URLEncoder.encode(objectID, "UTF-8") + params.toString(), false, requestOptions); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } }
[ "public", "JSONObject", "getObject", "(", "String", "objectID", ",", "List", "<", "String", ">", "attributesToRetrieve", ",", "RequestOptions", "requestOptions", ")", "throws", "AlgoliaException", "{", "try", "{", "String", "params", "=", "encodeAttributes", "(", ...
Get an object from this index @param objectID the unique identifier of the object to retrieve @param attributesToRetrieve contains the list of attributes to retrieve. @param requestOptions Options to pass to this request
[ "Get", "an", "object", "from", "this", "index" ]
train
https://github.com/algolia/algoliasearch-client-java/blob/a05da2f66c099fe6f77295c7b6a8a12c24e95f9b/src/main/java/com/algolia/search/saas/Index.java#L267-L274
gallandarakhneorg/afc
core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java
XMLUtil.getElementMatching
@Pure public static Element getElementMatching(Node document, XMLConstraint constraint, String... path) { """ Replies the node that corresponds to the specified path. <p>The path is an ordered list of tag's names and ended by the name of the desired node. @param document is the XML document to explore. @param constraint is the constraint that the replied element must respect. @param path is the list of names. @return the node or <code>null</code> if it was not found in the document. """ assert document != null : AssertMessages.notNullParameter(0); assert constraint != null : AssertMessages.notNullParameter(1); return getElementMatching(document, constraint, true, path); }
java
@Pure public static Element getElementMatching(Node document, XMLConstraint constraint, String... path) { assert document != null : AssertMessages.notNullParameter(0); assert constraint != null : AssertMessages.notNullParameter(1); return getElementMatching(document, constraint, true, path); }
[ "@", "Pure", "public", "static", "Element", "getElementMatching", "(", "Node", "document", ",", "XMLConstraint", "constraint", ",", "String", "...", "path", ")", "{", "assert", "document", "!=", "null", ":", "AssertMessages", ".", "notNullParameter", "(", "0", ...
Replies the node that corresponds to the specified path. <p>The path is an ordered list of tag's names and ended by the name of the desired node. @param document is the XML document to explore. @param constraint is the constraint that the replied element must respect. @param path is the list of names. @return the node or <code>null</code> if it was not found in the document.
[ "Replies", "the", "node", "that", "corresponds", "to", "the", "specified", "path", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java#L1441-L1446
wcm-io/wcm-io-sling
commons/src/main/java/io/wcm/sling/commons/request/RequestParam.java
RequestParam.getInt
public static int getInt(@NotNull ServletRequest request, @NotNull String param) { """ Returns a request parameter as integer. @param request Request. @param param Parameter name. @return Parameter value or 0 if it does not exist or is not a number. """ return getInt(request, param, 0); }
java
public static int getInt(@NotNull ServletRequest request, @NotNull String param) { return getInt(request, param, 0); }
[ "public", "static", "int", "getInt", "(", "@", "NotNull", "ServletRequest", "request", ",", "@", "NotNull", "String", "param", ")", "{", "return", "getInt", "(", "request", ",", "param", ",", "0", ")", ";", "}" ]
Returns a request parameter as integer. @param request Request. @param param Parameter name. @return Parameter value or 0 if it does not exist or is not a number.
[ "Returns", "a", "request", "parameter", "as", "integer", "." ]
train
https://github.com/wcm-io/wcm-io-sling/blob/90adbe432469378794b5695c72e9cdfa2b7d36f1/commons/src/main/java/io/wcm/sling/commons/request/RequestParam.java#L145-L147
indeedeng/util
io/src/main/java/com/indeed/util/io/Files.java
Files.isChanged
private static boolean isChanged(byte[] bytes, String filepath) throws IOException { """ Returns true iff the bytes in an array are different from the bytes contained in the given file, or if the file does not exist. """ return isChanged(bytes, bytes.length, filepath); }
java
private static boolean isChanged(byte[] bytes, String filepath) throws IOException { return isChanged(bytes, bytes.length, filepath); }
[ "private", "static", "boolean", "isChanged", "(", "byte", "[", "]", "bytes", ",", "String", "filepath", ")", "throws", "IOException", "{", "return", "isChanged", "(", "bytes", ",", "bytes", ".", "length", ",", "filepath", ")", ";", "}" ]
Returns true iff the bytes in an array are different from the bytes contained in the given file, or if the file does not exist.
[ "Returns", "true", "iff", "the", "bytes", "in", "an", "array", "are", "different", "from", "the", "bytes", "contained", "in", "the", "given", "file", "or", "if", "the", "file", "does", "not", "exist", "." ]
train
https://github.com/indeedeng/util/blob/332008426cf14b57e7fc3e817d9423e3f84fb922/io/src/main/java/com/indeed/util/io/Files.java#L368-L370
Alluxio/alluxio
shell/src/main/java/alluxio/cli/fs/command/HelpCommand.java
HelpCommand.printCommandInfo
public static void printCommandInfo(Command command, PrintWriter pw) { """ Prints the info about a command to the given print writer. @param command command to print info @param pw where to print the info """ String description = String.format("%s: %s", command.getCommandName(), command.getDescription()); int width = 80; try { width = TerminalFactory.get().getWidth(); } catch (Exception e) { // In case the terminal factory failed to decide terminal type, use default width } HELP_FORMATTER.printWrapped(pw, width, description); HELP_FORMATTER.printUsage(pw, width, command.getUsage()); if (command.getOptions().getOptions().size() > 0) { HELP_FORMATTER.printOptions(pw, width, command.getOptions(), HELP_FORMATTER.getLeftPadding(), HELP_FORMATTER.getDescPadding()); } }
java
public static void printCommandInfo(Command command, PrintWriter pw) { String description = String.format("%s: %s", command.getCommandName(), command.getDescription()); int width = 80; try { width = TerminalFactory.get().getWidth(); } catch (Exception e) { // In case the terminal factory failed to decide terminal type, use default width } HELP_FORMATTER.printWrapped(pw, width, description); HELP_FORMATTER.printUsage(pw, width, command.getUsage()); if (command.getOptions().getOptions().size() > 0) { HELP_FORMATTER.printOptions(pw, width, command.getOptions(), HELP_FORMATTER.getLeftPadding(), HELP_FORMATTER.getDescPadding()); } }
[ "public", "static", "void", "printCommandInfo", "(", "Command", "command", ",", "PrintWriter", "pw", ")", "{", "String", "description", "=", "String", ".", "format", "(", "\"%s: %s\"", ",", "command", ".", "getCommandName", "(", ")", ",", "command", ".", "ge...
Prints the info about a command to the given print writer. @param command command to print info @param pw where to print the info
[ "Prints", "the", "info", "about", "a", "command", "to", "the", "given", "print", "writer", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/shell/src/main/java/alluxio/cli/fs/command/HelpCommand.java#L46-L62
strator-dev/greenpepper
greenpepper/greenpepper-client/src/main/java/com/greenpepper/server/rpc/runner/XmlRpcRemoteRunner.java
XmlRpcRemoteRunner.runReference
@SuppressWarnings("unchecked") public Reference runReference(Reference reference, String locale) throws GreenPepperServerException { """ <p>runReference.</p> @param reference a {@link com.greenpepper.server.domain.Reference} object. @param locale a {@link java.lang.String} object. @return a {@link com.greenpepper.server.domain.Reference} object. @throws com.greenpepper.server.GreenPepperServerException if any. """ return xmlRpc.runReference(reference, locale, getIdentifier()); }
java
@SuppressWarnings("unchecked") public Reference runReference(Reference reference, String locale) throws GreenPepperServerException { return xmlRpc.runReference(reference, locale, getIdentifier()); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "Reference", "runReference", "(", "Reference", "reference", ",", "String", "locale", ")", "throws", "GreenPepperServerException", "{", "return", "xmlRpc", ".", "runReference", "(", "reference", ",", "loca...
<p>runReference.</p> @param reference a {@link com.greenpepper.server.domain.Reference} object. @param locale a {@link java.lang.String} object. @return a {@link com.greenpepper.server.domain.Reference} object. @throws com.greenpepper.server.GreenPepperServerException if any.
[ "<p", ">", "runReference", ".", "<", "/", "p", ">" ]
train
https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper/greenpepper-client/src/main/java/com/greenpepper/server/rpc/runner/XmlRpcRemoteRunner.java#L229-L234
drinkjava2/jBeanBox
jbeanbox/src/main/java/com/github/drinkjava2/jbeanbox/BeanBoxUtils.java
BeanBoxUtils.nameMatch
public static boolean nameMatch(String regex, String name) { """ A simple matcher for class and method name, only 1 * allowed <br/> "*abc.ef" matches "any.abc.ef", "anymoreabc.ef" ... <br/> "abc.ef*" matches "abc.efg", "abc.efg.hj" ... <br/> "abc*def" matches "abcd.efg.ddef", "abcany*anydef" """ if (regex == null || regex.length() == 0 || name == null || name.length() == 0) return false; if ('*' == (regex.charAt(0))) { return name.endsWith(regex.substring(1)); } else if (regex.endsWith("*")) { return name.startsWith(regex.substring(0, regex.length() - 1)); } else { int starPos = regex.indexOf('*'); if (-1 == starPos) return regex.equals(name); return name.startsWith(regex.substring(0, starPos)) && name.endsWith(regex.substring(starPos + 1)); } }
java
public static boolean nameMatch(String regex, String name) { if (regex == null || regex.length() == 0 || name == null || name.length() == 0) return false; if ('*' == (regex.charAt(0))) { return name.endsWith(regex.substring(1)); } else if (regex.endsWith("*")) { return name.startsWith(regex.substring(0, regex.length() - 1)); } else { int starPos = regex.indexOf('*'); if (-1 == starPos) return regex.equals(name); return name.startsWith(regex.substring(0, starPos)) && name.endsWith(regex.substring(starPos + 1)); } }
[ "public", "static", "boolean", "nameMatch", "(", "String", "regex", ",", "String", "name", ")", "{", "if", "(", "regex", "==", "null", "||", "regex", ".", "length", "(", ")", "==", "0", "||", "name", "==", "null", "||", "name", ".", "length", "(", ...
A simple matcher for class and method name, only 1 * allowed <br/> "*abc.ef" matches "any.abc.ef", "anymoreabc.ef" ... <br/> "abc.ef*" matches "abc.efg", "abc.efg.hj" ... <br/> "abc*def" matches "abcd.efg.ddef", "abcany*anydef"
[ "A", "simple", "matcher", "for", "class", "and", "method", "name", "only", "1", "*", "allowed", "<br", "/", ">", "*", "abc", ".", "ef", "matches", "any", ".", "abc", ".", "ef", "anymoreabc", ".", "ef", "...", "<br", "/", ">", "abc", ".", "ef", "*...
train
https://github.com/drinkjava2/jBeanBox/blob/01c216599ffa2e5f2d9c01df2adaad0f45567c04/jbeanbox/src/main/java/com/github/drinkjava2/jbeanbox/BeanBoxUtils.java#L326-L339
stripe/stripe-java
src/main/java/com/stripe/model/UsageRecord.java
UsageRecord.createOnSubscriptionItem
public static UsageRecord createOnSubscriptionItem( String subscriptionItem, Map<String, Object> params, RequestOptions options) throws StripeException { """ Creates a usage record for a specified subscription item and date, and fills it with a quantity. <p>Usage records provide <code>quantity</code> information that Stripe uses to track how much a customer is using your service. With usage information and the pricing model set up by the <a href="https://stripe.com/docs/billing/subscriptions/metered-billing">metered billing</a> plan, Stripe helps you send accurate invoices to your customers. <p>The default calculation for usage is to add up all the <code>quantity</code> values of the usage records within a billing period. You can change this default behavior with the billing plan’s <code>aggregate_usage</code> <a href="https://stripe.com/docs/api/plans/create#create_plan-aggregate_usage">parameter</a>. When there is more than one usage record with the same timestamp, Stripe adds the <code>quantity </code> values together. In most cases, this is the desired resolution, however, you can change this behavior with the <code>action</code> parameter. <p>The default pricing model for metered billing is <a href="https://stripe.com/docs/api/plans/object#plan_object-billing_scheme">per-unit pricing</a>. For finer granularity, you can configure metered billing to have a <a href="https://stripe.com/docs/billing/subscriptions/tiers">tiered pricing</a> model. """ String url = String.format( "%s%s", Stripe.getApiBase(), String.format( "/v1/subscription_items/%s/usage_records", ApiResource.urlEncodeId(subscriptionItem))); return request(ApiResource.RequestMethod.POST, url, params, UsageRecord.class, options); }
java
public static UsageRecord createOnSubscriptionItem( String subscriptionItem, Map<String, Object> params, RequestOptions options) throws StripeException { String url = String.format( "%s%s", Stripe.getApiBase(), String.format( "/v1/subscription_items/%s/usage_records", ApiResource.urlEncodeId(subscriptionItem))); return request(ApiResource.RequestMethod.POST, url, params, UsageRecord.class, options); }
[ "public", "static", "UsageRecord", "createOnSubscriptionItem", "(", "String", "subscriptionItem", ",", "Map", "<", "String", ",", "Object", ">", "params", ",", "RequestOptions", "options", ")", "throws", "StripeException", "{", "String", "url", "=", "String", ".",...
Creates a usage record for a specified subscription item and date, and fills it with a quantity. <p>Usage records provide <code>quantity</code> information that Stripe uses to track how much a customer is using your service. With usage information and the pricing model set up by the <a href="https://stripe.com/docs/billing/subscriptions/metered-billing">metered billing</a> plan, Stripe helps you send accurate invoices to your customers. <p>The default calculation for usage is to add up all the <code>quantity</code> values of the usage records within a billing period. You can change this default behavior with the billing plan’s <code>aggregate_usage</code> <a href="https://stripe.com/docs/api/plans/create#create_plan-aggregate_usage">parameter</a>. When there is more than one usage record with the same timestamp, Stripe adds the <code>quantity </code> values together. In most cases, this is the desired resolution, however, you can change this behavior with the <code>action</code> parameter. <p>The default pricing model for metered billing is <a href="https://stripe.com/docs/api/plans/object#plan_object-billing_scheme">per-unit pricing</a>. For finer granularity, you can configure metered billing to have a <a href="https://stripe.com/docs/billing/subscriptions/tiers">tiered pricing</a> model.
[ "Creates", "a", "usage", "record", "for", "a", "specified", "subscription", "item", "and", "date", "and", "fills", "it", "with", "a", "quantity", "." ]
train
https://github.com/stripe/stripe-java/blob/acfa8becef3e73bfe3e9d8880bea3f3f30dadeac/src/main/java/com/stripe/model/UsageRecord.java#L70-L81
brunocvcunha/inutils4j
src/main/java/org/brunocvcunha/inutils4j/thirdparty/DateUtils.java
DateUtils.rollDays
public static java.sql.Date rollDays(java.util.Date startDate, int days) { """ Roll the days forward or backward. @param startDate - The start date @param days - Negative to rollbackwards. """ return rollDate(startDate, Calendar.DATE, days); }
java
public static java.sql.Date rollDays(java.util.Date startDate, int days) { return rollDate(startDate, Calendar.DATE, days); }
[ "public", "static", "java", ".", "sql", ".", "Date", "rollDays", "(", "java", ".", "util", ".", "Date", "startDate", ",", "int", "days", ")", "{", "return", "rollDate", "(", "startDate", ",", "Calendar", ".", "DATE", ",", "days", ")", ";", "}" ]
Roll the days forward or backward. @param startDate - The start date @param days - Negative to rollbackwards.
[ "Roll", "the", "days", "forward", "or", "backward", "." ]
train
https://github.com/brunocvcunha/inutils4j/blob/223c4443c2cee662576ce644e552588fa114aa94/src/main/java/org/brunocvcunha/inutils4j/thirdparty/DateUtils.java#L202-L204
Azure/azure-sdk-for-java
sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ReplicationLinksInner.java
ReplicationLinksInner.failoverAllowDataLoss
public void failoverAllowDataLoss(String resourceGroupName, String serverName, String databaseName, String linkId) { """ Sets which replica database is primary by failing over from the current primary replica database. This operation might result in data loss. @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 databaseName The name of the database that has the replication link to be failed over. @param linkId The ID of the replication link to be failed over. @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 """ failoverAllowDataLossWithServiceResponseAsync(resourceGroupName, serverName, databaseName, linkId).toBlocking().last().body(); }
java
public void failoverAllowDataLoss(String resourceGroupName, String serverName, String databaseName, String linkId) { failoverAllowDataLossWithServiceResponseAsync(resourceGroupName, serverName, databaseName, linkId).toBlocking().last().body(); }
[ "public", "void", "failoverAllowDataLoss", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "databaseName", ",", "String", "linkId", ")", "{", "failoverAllowDataLossWithServiceResponseAsync", "(", "resourceGroupName", ",", "serverName", ",",...
Sets which replica database is primary by failing over from the current primary replica database. This operation might result in data loss. @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 databaseName The name of the database that has the replication link to be failed over. @param linkId The ID of the replication link to be failed over. @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
[ "Sets", "which", "replica", "database", "is", "primary", "by", "failing", "over", "from", "the", "current", "primary", "replica", "database", ".", "This", "operation", "might", "result", "in", "data", "loss", "." ]
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/ReplicationLinksInner.java#L480-L482
dkmfbk/knowledgestore
ks-core/src/main/java/eu/fbk/knowledgestore/data/XPath.java
XPath.asFunction
public final <T> Function<Object, List<T>> asFunction(final Class<T> resultClass) { """ Returns a function view of this {@code XPath} expression that produces a {@code List<T>} result given an input object. If this {@code XPath} is lenient, evaluation of the function will return an empty list on failure, rather than throwing an {@link IllegalArgumentException}. @param resultClass the {@code Class} object for the list elements of the expected function result @param <T> the type of result list element @return the requested function view """ Preconditions.checkNotNull(resultClass); return new Function<Object, List<T>>() { @Override public List<T> apply(@Nullable final Object object) { Preconditions.checkNotNull(object); return eval(object, resultClass); } }; }
java
public final <T> Function<Object, List<T>> asFunction(final Class<T> resultClass) { Preconditions.checkNotNull(resultClass); return new Function<Object, List<T>>() { @Override public List<T> apply(@Nullable final Object object) { Preconditions.checkNotNull(object); return eval(object, resultClass); } }; }
[ "public", "final", "<", "T", ">", "Function", "<", "Object", ",", "List", "<", "T", ">", ">", "asFunction", "(", "final", "Class", "<", "T", ">", "resultClass", ")", "{", "Preconditions", ".", "checkNotNull", "(", "resultClass", ")", ";", "return", "ne...
Returns a function view of this {@code XPath} expression that produces a {@code List<T>} result given an input object. If this {@code XPath} is lenient, evaluation of the function will return an empty list on failure, rather than throwing an {@link IllegalArgumentException}. @param resultClass the {@code Class} object for the list elements of the expected function result @param <T> the type of result list element @return the requested function view
[ "Returns", "a", "function", "view", "of", "this", "{", "@code", "XPath", "}", "expression", "that", "produces", "a", "{", "@code", "List<T", ">", "}", "result", "given", "an", "input", "object", ".", "If", "this", "{", "@code", "XPath", "}", "is", "len...
train
https://github.com/dkmfbk/knowledgestore/blob/a548101b1dd67fcf72a1ec6f838ea7539bdbbe7a/ks-core/src/main/java/eu/fbk/knowledgestore/data/XPath.java#L826-L839
xebia/Xebium
src/main/java/com/xebia/incubator/xebium/SeleniumDriverFixture.java
SeleniumDriverFixture.startDriverOnUrl
public void startDriverOnUrl(final WebDriver webDriver, final String browserUrl) { """ <p><code> | start driver | <i>$Driver</i> | on url | <i>http://localhost</i> | </code></p> @param webDriver a WebDriver instance @param browserUrl """ setCommandProcessor(startWebDriverCommandProcessor(browserUrl, webDriver)); setTimeoutOnSelenium(); LOG.debug("Started command processor"); }
java
public void startDriverOnUrl(final WebDriver webDriver, final String browserUrl) { setCommandProcessor(startWebDriverCommandProcessor(browserUrl, webDriver)); setTimeoutOnSelenium(); LOG.debug("Started command processor"); }
[ "public", "void", "startDriverOnUrl", "(", "final", "WebDriver", "webDriver", ",", "final", "String", "browserUrl", ")", "{", "setCommandProcessor", "(", "startWebDriverCommandProcessor", "(", "browserUrl", ",", "webDriver", ")", ")", ";", "setTimeoutOnSelenium", "(",...
<p><code> | start driver | <i>$Driver</i> | on url | <i>http://localhost</i> | </code></p> @param webDriver a WebDriver instance @param browserUrl
[ "<p", ">", "<code", ">", "|", "start", "driver", "|", "<i", ">", "$Driver<", "/", "i", ">", "|", "on", "url", "|", "<i", ">", "http", ":", "//", "localhost<", "/", "i", ">", "|", "<", "/", "code", ">", "<", "/", "p", ">" ]
train
https://github.com/xebia/Xebium/blob/594f6d9e65622acdbd03dba0700b17645981da1f/src/main/java/com/xebia/incubator/xebium/SeleniumDriverFixture.java#L168-L172
OpenLiberty/open-liberty
dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/config/ThreadContext.java
ThreadContext.setOutboundConnectionInfo
public void setOutboundConnectionInfo(Map<String, Object> connectionInfo) { """ Set the outbound connection info of this context to the input value. @param connectionInfo """ if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "setOutboundConnectionInfo"); this.outboundConnectionInfo = connectionInfo; }
java
public void setOutboundConnectionInfo(Map<String, Object> connectionInfo) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "setOutboundConnectionInfo"); this.outboundConnectionInfo = connectionInfo; }
[ "public", "void", "setOutboundConnectionInfo", "(", "Map", "<", "String", ",", "Object", ">", "connectionInfo", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "Tr", ".", "debug",...
Set the outbound connection info of this context to the input value. @param connectionInfo
[ "Set", "the", "outbound", "connection", "info", "of", "this", "context", "to", "the", "input", "value", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/config/ThreadContext.java#L202-L206
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPAttachmentFileEntryPersistenceImpl.java
CPAttachmentFileEntryPersistenceImpl.removeByLtD_S
@Override public void removeByLtD_S(Date displayDate, int status) { """ Removes all the cp attachment file entries where displayDate &lt; &#63; and status = &#63; from the database. @param displayDate the display date @param status the status """ for (CPAttachmentFileEntry cpAttachmentFileEntry : findByLtD_S( displayDate, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(cpAttachmentFileEntry); } }
java
@Override public void removeByLtD_S(Date displayDate, int status) { for (CPAttachmentFileEntry cpAttachmentFileEntry : findByLtD_S( displayDate, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(cpAttachmentFileEntry); } }
[ "@", "Override", "public", "void", "removeByLtD_S", "(", "Date", "displayDate", ",", "int", "status", ")", "{", "for", "(", "CPAttachmentFileEntry", "cpAttachmentFileEntry", ":", "findByLtD_S", "(", "displayDate", ",", "status", ",", "QueryUtil", ".", "ALL_POS", ...
Removes all the cp attachment file entries where displayDate &lt; &#63; and status = &#63; from the database. @param displayDate the display date @param status the status
[ "Removes", "all", "the", "cp", "attachment", "file", "entries", "where", "displayDate", "&lt", ";", "&#63", ";", "and", "status", "=", "&#63", ";", "from", "the", "database", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPAttachmentFileEntryPersistenceImpl.java#L2536-L2542
spring-projects/spring-boot
spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/json-shade/java/org/springframework/boot/configurationprocessor/json/JSONObject.java
JSONObject.optDouble
public double optDouble(String name, double fallback) { """ Returns the value mapped by {@code name} if it exists and is a double or can be coerced to a double. Returns {@code fallback} otherwise. @param name the name of the property @param fallback a fallback value @return the value or {@code fallback} """ Object object = opt(name); Double result = JSON.toDouble(object); return result != null ? result : fallback; }
java
public double optDouble(String name, double fallback) { Object object = opt(name); Double result = JSON.toDouble(object); return result != null ? result : fallback; }
[ "public", "double", "optDouble", "(", "String", "name", ",", "double", "fallback", ")", "{", "Object", "object", "=", "opt", "(", "name", ")", ";", "Double", "result", "=", "JSON", ".", "toDouble", "(", "object", ")", ";", "return", "result", "!=", "nu...
Returns the value mapped by {@code name} if it exists and is a double or can be coerced to a double. Returns {@code fallback} otherwise. @param name the name of the property @param fallback a fallback value @return the value or {@code fallback}
[ "Returns", "the", "value", "mapped", "by", "{" ]
train
https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/json-shade/java/org/springframework/boot/configurationprocessor/json/JSONObject.java#L465-L469
dustin/java-memcached-client
src/main/java/net/spy/memcached/MemcachedConnection.java
MemcachedConnection.enqueueOperation
public void enqueueOperation(final String key, final Operation o) { """ Enqueue the given {@link Operation} with the used key. @param key the key to use. @param o the {@link Operation} to enqueue. """ checkState(); StringUtils.validateKey(key, opFact instanceof BinaryOperationFactory); addOperation(key, o); }
java
public void enqueueOperation(final String key, final Operation o) { checkState(); StringUtils.validateKey(key, opFact instanceof BinaryOperationFactory); addOperation(key, o); }
[ "public", "void", "enqueueOperation", "(", "final", "String", "key", ",", "final", "Operation", "o", ")", "{", "checkState", "(", ")", ";", "StringUtils", ".", "validateKey", "(", "key", ",", "opFact", "instanceof", "BinaryOperationFactory", ")", ";", "addOper...
Enqueue the given {@link Operation} with the used key. @param key the key to use. @param o the {@link Operation} to enqueue.
[ "Enqueue", "the", "given", "{", "@link", "Operation", "}", "with", "the", "used", "key", "." ]
train
https://github.com/dustin/java-memcached-client/blob/c232307ad8e0c7ccc926e495dd7d5aad2d713318/src/main/java/net/spy/memcached/MemcachedConnection.java#L1196-L1200
google/j2objc
translator/src/main/java/com/google/devtools/j2objc/translate/Autoboxer.java
Autoboxer.unbox
private void unbox(Expression expr, PrimitiveType primitiveType) { """ Convert a wrapper class instance to a specified primitive equivalent. """ TypeElement boxedClass = findBoxedSuperclass(expr.getTypeMirror()); if (primitiveType == null && boxedClass != null) { primitiveType = typeUtil.unboxedType(boxedClass.asType()); } if (primitiveType == null) { return; } ExecutableElement valueMethod = ElementUtil.findMethod( boxedClass, TypeUtil.getName(primitiveType) + VALUE_METHOD); assert valueMethod != null : "could not find value method for " + boxedClass; MethodInvocation invocation = new MethodInvocation(new ExecutablePair(valueMethod), null); expr.replaceWith(invocation); invocation.setExpression(expr); }
java
private void unbox(Expression expr, PrimitiveType primitiveType) { TypeElement boxedClass = findBoxedSuperclass(expr.getTypeMirror()); if (primitiveType == null && boxedClass != null) { primitiveType = typeUtil.unboxedType(boxedClass.asType()); } if (primitiveType == null) { return; } ExecutableElement valueMethod = ElementUtil.findMethod( boxedClass, TypeUtil.getName(primitiveType) + VALUE_METHOD); assert valueMethod != null : "could not find value method for " + boxedClass; MethodInvocation invocation = new MethodInvocation(new ExecutablePair(valueMethod), null); expr.replaceWith(invocation); invocation.setExpression(expr); }
[ "private", "void", "unbox", "(", "Expression", "expr", ",", "PrimitiveType", "primitiveType", ")", "{", "TypeElement", "boxedClass", "=", "findBoxedSuperclass", "(", "expr", ".", "getTypeMirror", "(", ")", ")", ";", "if", "(", "primitiveType", "==", "null", "&...
Convert a wrapper class instance to a specified primitive equivalent.
[ "Convert", "a", "wrapper", "class", "instance", "to", "a", "specified", "primitive", "equivalent", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/translate/Autoboxer.java#L121-L135
lessthanoptimal/BoofCV
main/boofcv-ip/src/main/java/boofcv/alg/color/ColorYuv.java
ColorYuv.rgbToYuv
public static void rgbToYuv( double r , double g , double b , double yuv[] ) { """ Conversion from RGB to YUV using same equations as Intel IPP. """ double y = yuv[0] = 0.299*r + 0.587*g + 0.114*b; yuv[1] = 0.492*(b-y); yuv[2] = 0.877*(r-y); }
java
public static void rgbToYuv( double r , double g , double b , double yuv[] ) { double y = yuv[0] = 0.299*r + 0.587*g + 0.114*b; yuv[1] = 0.492*(b-y); yuv[2] = 0.877*(r-y); }
[ "public", "static", "void", "rgbToYuv", "(", "double", "r", ",", "double", "g", ",", "double", "b", ",", "double", "yuv", "[", "]", ")", "{", "double", "y", "=", "yuv", "[", "0", "]", "=", "0.299", "*", "r", "+", "0.587", "*", "g", "+", "0.114"...
Conversion from RGB to YUV using same equations as Intel IPP.
[ "Conversion", "from", "RGB", "to", "YUV", "using", "same", "equations", "as", "Intel", "IPP", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/color/ColorYuv.java#L64-L68
op4j/op4j
src/main/java/org/op4j/functions/FnFunc.java
FnFunc.ifNullThenElse
public static final <T,R> Function<T,R> ifNullThenElse( final Type<T> targetType, final IFunction<? super T,R> thenFunction, final IFunction<? super T,R> elseFunction) { """ <p> Builds a function that will execute the specified function <tt>thenFunction</tt> only if the target object is null, and will execute the specified function <tt>elseFunction</tt> otherwise. </p> <p> The built function can effectively change the target type (receive <tt>T</tt> and return <tt>R</tt>) if both <tt>thenFunction</tt> and <tt>elseFunction</tt> return the same type, and this is different than the target type <tt>T</tt>. </p> @param targetType the target type @param thenFunction the function to be executed on the target object is null @param elseFunction the function to be executed on the target object otherwise @return a function that executes the "thenFunction" if the target object is null and "elseFunction" otherwise. """ return ifTrueThenElse(targetType, FnObject.isNull(), thenFunction, elseFunction); }
java
public static final <T,R> Function<T,R> ifNullThenElse( final Type<T> targetType, final IFunction<? super T,R> thenFunction, final IFunction<? super T,R> elseFunction) { return ifTrueThenElse(targetType, FnObject.isNull(), thenFunction, elseFunction); }
[ "public", "static", "final", "<", "T", ",", "R", ">", "Function", "<", "T", ",", "R", ">", "ifNullThenElse", "(", "final", "Type", "<", "T", ">", "targetType", ",", "final", "IFunction", "<", "?", "super", "T", ",", "R", ">", "thenFunction", ",", "...
<p> Builds a function that will execute the specified function <tt>thenFunction</tt> only if the target object is null, and will execute the specified function <tt>elseFunction</tt> otherwise. </p> <p> The built function can effectively change the target type (receive <tt>T</tt> and return <tt>R</tt>) if both <tt>thenFunction</tt> and <tt>elseFunction</tt> return the same type, and this is different than the target type <tt>T</tt>. </p> @param targetType the target type @param thenFunction the function to be executed on the target object is null @param elseFunction the function to be executed on the target object otherwise @return a function that executes the "thenFunction" if the target object is null and "elseFunction" otherwise.
[ "<p", ">", "Builds", "a", "function", "that", "will", "execute", "the", "specified", "function", "<tt", ">", "thenFunction<", "/", "tt", ">", "only", "if", "the", "target", "object", "is", "null", "and", "will", "execute", "the", "specified", "function", "...
train
https://github.com/op4j/op4j/blob/b577596dfe462089d3dd169666defc6de7ad289a/src/main/java/org/op4j/functions/FnFunc.java#L198-L202
trustathsh/ifmapj
src/main/java/de/hshannover/f4/trust/ifmapj/messages/Requests.java
Requests.createPublishUpdate
public static PublishUpdate createPublishUpdate(Identifier i1, Identifier i2, Document md, MetadataLifetime lifetime) { """ Create a new {@link PublishUpdate} instance that is used to publish metadata on a link between two {@link Identifier} instances with a specific {@link MetadataLifetime}. @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 @param lifetime the lifetime of the new metadata @return the new {@link PublishUpdate} instance """ if (md == null) { throw new NullPointerException("md not allowed to be null"); } List<Document> list = new ArrayList<Document>(1); list.add(md); return createPublishUpdate(i1, i2, list, lifetime); }
java
public static PublishUpdate createPublishUpdate(Identifier i1, Identifier i2, Document md, MetadataLifetime lifetime) { if (md == null) { throw new NullPointerException("md not allowed to be null"); } List<Document> list = new ArrayList<Document>(1); list.add(md); return createPublishUpdate(i1, i2, list, lifetime); }
[ "public", "static", "PublishUpdate", "createPublishUpdate", "(", "Identifier", "i1", ",", "Identifier", "i2", ",", "Document", "md", ",", "MetadataLifetime", "lifetime", ")", "{", "if", "(", "md", "==", "null", ")", "{", "throw", "new", "NullPointerException", ...
Create a new {@link PublishUpdate} instance that is used to publish metadata on a link between two {@link Identifier} instances with a specific {@link MetadataLifetime}. @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 @param lifetime the lifetime of the new metadata @return the new {@link PublishUpdate} instance
[ "Create", "a", "new", "{", "@link", "PublishUpdate", "}", "instance", "that", "is", "used", "to", "publish", "metadata", "on", "a", "link", "between", "two", "{", "@link", "Identifier", "}", "instances", "with", "a", "specific", "{", "@link", "MetadataLifeti...
train
https://github.com/trustathsh/ifmapj/blob/44ece9e95a3d2a1b7019573ba6178598a6cbdaa3/src/main/java/de/hshannover/f4/trust/ifmapj/messages/Requests.java#L375-L385
jbundle/jbundle
base/remote/src/main/java/org/jbundle/base/remote/message/ReceiveQueueSession.java
ReceiveQueueSession.removeRemoteMessageFilter
public boolean removeRemoteMessageFilter(BaseMessageFilter messageFilter, boolean bFreeFilter) throws RemoteException { """ Remove this listener (called from remote). @param messageFilter The message filter. """ Utility.getLogger().info("EJB removeMessageFilter filter: " + messageFilter); MessageManager messageManager = ((Application)this.getTask().getApplication()).getMessageManager(); BaseMessageReceiver messageReceiver = (BaseMessageReceiver)messageManager.getMessageQueue(messageFilter.getRemoteFilterQueueName(), messageFilter.getRemoteFilterQueueType()).getMessageReceiver(); boolean bRemoved = false; if (messageReceiver != null) bRemoved = messageReceiver.removeMessageFilter(messageFilter.getRemoteFilterID(), bFreeFilter); return bRemoved; }
java
public boolean removeRemoteMessageFilter(BaseMessageFilter messageFilter, boolean bFreeFilter) throws RemoteException { Utility.getLogger().info("EJB removeMessageFilter filter: " + messageFilter); MessageManager messageManager = ((Application)this.getTask().getApplication()).getMessageManager(); BaseMessageReceiver messageReceiver = (BaseMessageReceiver)messageManager.getMessageQueue(messageFilter.getRemoteFilterQueueName(), messageFilter.getRemoteFilterQueueType()).getMessageReceiver(); boolean bRemoved = false; if (messageReceiver != null) bRemoved = messageReceiver.removeMessageFilter(messageFilter.getRemoteFilterID(), bFreeFilter); return bRemoved; }
[ "public", "boolean", "removeRemoteMessageFilter", "(", "BaseMessageFilter", "messageFilter", ",", "boolean", "bFreeFilter", ")", "throws", "RemoteException", "{", "Utility", ".", "getLogger", "(", ")", ".", "info", "(", "\"EJB removeMessageFilter filter: \"", "+", "mess...
Remove this listener (called from remote). @param messageFilter The message filter.
[ "Remove", "this", "listener", "(", "called", "from", "remote", ")", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/remote/src/main/java/org/jbundle/base/remote/message/ReceiveQueueSession.java#L184-L193
Harium/keel
src/main/java/com/harium/keel/catalano/math/distance/Distance.java
Distance.KumarJohnsonDivergence
public static double KumarJohnsonDivergence(double[] p, double[] q) { """ Gets the Kumar-Johnson divergence. @param p P vector. @param q Q vector. @return The Kumar-Johnson divergence between p and q. """ double r = 0; for (int i = 0; i < p.length; i++) { if (p[i] != 0 && q[i] != 0) { r += Math.pow(p[i] * p[i] - q[i] * q[i], 2) / 2 * Math.pow(p[i] * q[i], 1.5); } } return r; }
java
public static double KumarJohnsonDivergence(double[] p, double[] q) { double r = 0; for (int i = 0; i < p.length; i++) { if (p[i] != 0 && q[i] != 0) { r += Math.pow(p[i] * p[i] - q[i] * q[i], 2) / 2 * Math.pow(p[i] * q[i], 1.5); } } return r; }
[ "public", "static", "double", "KumarJohnsonDivergence", "(", "double", "[", "]", "p", ",", "double", "[", "]", "q", ")", "{", "double", "r", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "p", ".", "length", ";", "i", "++", ")"...
Gets the Kumar-Johnson divergence. @param p P vector. @param q Q vector. @return The Kumar-Johnson divergence between p and q.
[ "Gets", "the", "Kumar", "-", "Johnson", "divergence", "." ]
train
https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/math/distance/Distance.java#L543-L551
RKumsher/utils
src/main/java/com/github/rkumsher/collection/IterableUtils.java
IterableUtils.randomFrom
public static <T> T randomFrom(Iterable<T> iterable, Collection<T> excludes) { """ Returns a random element from the given {@link Iterable} that's not in the values to exclude. @param iterable {@link Iterable} to return random element from @param excludes values to exclude @param <T> the type of elements in the given iterable @return random element from the given {@link Iterable} that's not in the values to exclude @throws IllegalArgumentException if the iterable is empty """ checkArgument(!Iterables.isEmpty(iterable), "Iterable cannot be empty"); checkArgument(!containsAll(excludes, iterable), "Iterable only consists of the given excludes"); Iterable<T> copy = Lists.newArrayList(iterable); Iterables.removeAll(copy, excludes); return randomFrom(copy); }
java
public static <T> T randomFrom(Iterable<T> iterable, Collection<T> excludes) { checkArgument(!Iterables.isEmpty(iterable), "Iterable cannot be empty"); checkArgument(!containsAll(excludes, iterable), "Iterable only consists of the given excludes"); Iterable<T> copy = Lists.newArrayList(iterable); Iterables.removeAll(copy, excludes); return randomFrom(copy); }
[ "public", "static", "<", "T", ">", "T", "randomFrom", "(", "Iterable", "<", "T", ">", "iterable", ",", "Collection", "<", "T", ">", "excludes", ")", "{", "checkArgument", "(", "!", "Iterables", ".", "isEmpty", "(", "iterable", ")", ",", "\"Iterable canno...
Returns a random element from the given {@link Iterable} that's not in the values to exclude. @param iterable {@link Iterable} to return random element from @param excludes values to exclude @param <T> the type of elements in the given iterable @return random element from the given {@link Iterable} that's not in the values to exclude @throws IllegalArgumentException if the iterable is empty
[ "Returns", "a", "random", "element", "from", "the", "given", "{", "@link", "Iterable", "}", "that", "s", "not", "in", "the", "values", "to", "exclude", "." ]
train
https://github.com/RKumsher/utils/blob/fcdb190569cd0288249bf4b46fd418f8c01d1caf/src/main/java/com/github/rkumsher/collection/IterableUtils.java#L57-L63
Azure/azure-sdk-for-java
cognitiveservices/data-plane/search/bingvideosearch/src/main/java/com/microsoft/azure/cognitiveservices/search/videosearch/implementation/BingVideosImpl.java
BingVideosImpl.searchWithServiceResponseAsync
public Observable<ServiceResponse<VideosModel>> searchWithServiceResponseAsync(String query, SearchOptionalParameter searchOptionalParameter) { """ The Video Search API lets you send a search query to Bing and get back a list of videos that are relevant to the search query. This section provides technical details about the query parameters and headers that you use to request videos and the JSON response objects that contain them. For examples that show how to make requests, see [Searching the Web for Videos](https://docs.microsoft.com/azure/cognitive-services/bing-video-search/search-the-web). @param query The user's search query string. The query string cannot be empty. The query string may contain [Bing Advanced Operators](http://msdn.microsoft.com/library/ff795620.aspx). For example, to limit videos to a specific domain, use the [site:](http://msdn.microsoft.com/library/ff795613.aspx) operator. Use this parameter only with the Video Search API. Do not specify this parameter when calling the Trending Videos API. @param searchOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the VideosModel object """ if (query == null) { throw new IllegalArgumentException("Parameter query is required and cannot be null."); } final String acceptLanguage = searchOptionalParameter != null ? searchOptionalParameter.acceptLanguage() : null; final String userAgent = searchOptionalParameter != null ? searchOptionalParameter.userAgent() : this.client.userAgent(); final String clientId = searchOptionalParameter != null ? searchOptionalParameter.clientId() : null; final String clientIp = searchOptionalParameter != null ? searchOptionalParameter.clientIp() : null; final String location = searchOptionalParameter != null ? searchOptionalParameter.location() : null; final String countryCode = searchOptionalParameter != null ? searchOptionalParameter.countryCode() : null; final Integer count = searchOptionalParameter != null ? searchOptionalParameter.count() : null; final Freshness freshness = searchOptionalParameter != null ? searchOptionalParameter.freshness() : null; final String id = searchOptionalParameter != null ? searchOptionalParameter.id() : null; final VideoLength length = searchOptionalParameter != null ? searchOptionalParameter.length() : null; final String market = searchOptionalParameter != null ? searchOptionalParameter.market() : null; final Integer offset = searchOptionalParameter != null ? searchOptionalParameter.offset() : null; final VideoPricing pricing = searchOptionalParameter != null ? searchOptionalParameter.pricing() : null; final VideoResolution resolution = searchOptionalParameter != null ? searchOptionalParameter.resolution() : null; final SafeSearch safeSearch = searchOptionalParameter != null ? searchOptionalParameter.safeSearch() : null; final String setLang = searchOptionalParameter != null ? searchOptionalParameter.setLang() : null; final Boolean textDecorations = searchOptionalParameter != null ? searchOptionalParameter.textDecorations() : null; final TextFormat textFormat = searchOptionalParameter != null ? searchOptionalParameter.textFormat() : null; return searchWithServiceResponseAsync(query, acceptLanguage, userAgent, clientId, clientIp, location, countryCode, count, freshness, id, length, market, offset, pricing, resolution, safeSearch, setLang, textDecorations, textFormat); }
java
public Observable<ServiceResponse<VideosModel>> searchWithServiceResponseAsync(String query, SearchOptionalParameter searchOptionalParameter) { if (query == null) { throw new IllegalArgumentException("Parameter query is required and cannot be null."); } final String acceptLanguage = searchOptionalParameter != null ? searchOptionalParameter.acceptLanguage() : null; final String userAgent = searchOptionalParameter != null ? searchOptionalParameter.userAgent() : this.client.userAgent(); final String clientId = searchOptionalParameter != null ? searchOptionalParameter.clientId() : null; final String clientIp = searchOptionalParameter != null ? searchOptionalParameter.clientIp() : null; final String location = searchOptionalParameter != null ? searchOptionalParameter.location() : null; final String countryCode = searchOptionalParameter != null ? searchOptionalParameter.countryCode() : null; final Integer count = searchOptionalParameter != null ? searchOptionalParameter.count() : null; final Freshness freshness = searchOptionalParameter != null ? searchOptionalParameter.freshness() : null; final String id = searchOptionalParameter != null ? searchOptionalParameter.id() : null; final VideoLength length = searchOptionalParameter != null ? searchOptionalParameter.length() : null; final String market = searchOptionalParameter != null ? searchOptionalParameter.market() : null; final Integer offset = searchOptionalParameter != null ? searchOptionalParameter.offset() : null; final VideoPricing pricing = searchOptionalParameter != null ? searchOptionalParameter.pricing() : null; final VideoResolution resolution = searchOptionalParameter != null ? searchOptionalParameter.resolution() : null; final SafeSearch safeSearch = searchOptionalParameter != null ? searchOptionalParameter.safeSearch() : null; final String setLang = searchOptionalParameter != null ? searchOptionalParameter.setLang() : null; final Boolean textDecorations = searchOptionalParameter != null ? searchOptionalParameter.textDecorations() : null; final TextFormat textFormat = searchOptionalParameter != null ? searchOptionalParameter.textFormat() : null; return searchWithServiceResponseAsync(query, acceptLanguage, userAgent, clientId, clientIp, location, countryCode, count, freshness, id, length, market, offset, pricing, resolution, safeSearch, setLang, textDecorations, textFormat); }
[ "public", "Observable", "<", "ServiceResponse", "<", "VideosModel", ">", ">", "searchWithServiceResponseAsync", "(", "String", "query", ",", "SearchOptionalParameter", "searchOptionalParameter", ")", "{", "if", "(", "query", "==", "null", ")", "{", "throw", "new", ...
The Video Search API lets you send a search query to Bing and get back a list of videos that are relevant to the search query. This section provides technical details about the query parameters and headers that you use to request videos and the JSON response objects that contain them. For examples that show how to make requests, see [Searching the Web for Videos](https://docs.microsoft.com/azure/cognitive-services/bing-video-search/search-the-web). @param query The user's search query string. The query string cannot be empty. The query string may contain [Bing Advanced Operators](http://msdn.microsoft.com/library/ff795620.aspx). For example, to limit videos to a specific domain, use the [site:](http://msdn.microsoft.com/library/ff795613.aspx) operator. Use this parameter only with the Video Search API. Do not specify this parameter when calling the Trending Videos API. @param searchOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the VideosModel object
[ "The", "Video", "Search", "API", "lets", "you", "send", "a", "search", "query", "to", "Bing", "and", "get", "back", "a", "list", "of", "videos", "that", "are", "relevant", "to", "the", "search", "query", ".", "This", "section", "provides", "technical", "...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/search/bingvideosearch/src/main/java/com/microsoft/azure/cognitiveservices/search/videosearch/implementation/BingVideosImpl.java#L137-L161
jmxtrans/jmxtrans
jmxtrans-core/src/main/java/com/googlecode/jmxtrans/model/naming/StringUtils.java
StringUtils.cleanupStr
public static String cleanupStr(String name, boolean allowDottedKeys) { """ Replaces all . and / with _ and removes all spaces and double/single quotes. Chomps any trailing . or _ character. @param allowDottedKeys whether we remove the dots or not. """ if (name == null) { return null; } Pattern pattern; if (!allowDottedKeys) { pattern = DOT_SLASH_UNDERSCORE_PAT; } else { pattern = SLASH_UNDERSCORE_PAT; } String clean = pattern.matcher(name).replaceAll("_"); clean = SPACE_PAT.matcher(clean).replaceAll(""); clean = org.apache.commons.lang.StringUtils.chomp(clean, "."); clean = org.apache.commons.lang.StringUtils.chomp(clean, "_"); return clean; }
java
public static String cleanupStr(String name, boolean allowDottedKeys) { if (name == null) { return null; } Pattern pattern; if (!allowDottedKeys) { pattern = DOT_SLASH_UNDERSCORE_PAT; } else { pattern = SLASH_UNDERSCORE_PAT; } String clean = pattern.matcher(name).replaceAll("_"); clean = SPACE_PAT.matcher(clean).replaceAll(""); clean = org.apache.commons.lang.StringUtils.chomp(clean, "."); clean = org.apache.commons.lang.StringUtils.chomp(clean, "_"); return clean; }
[ "public", "static", "String", "cleanupStr", "(", "String", "name", ",", "boolean", "allowDottedKeys", ")", "{", "if", "(", "name", "==", "null", ")", "{", "return", "null", ";", "}", "Pattern", "pattern", ";", "if", "(", "!", "allowDottedKeys", ")", "{",...
Replaces all . and / with _ and removes all spaces and double/single quotes. Chomps any trailing . or _ character. @param allowDottedKeys whether we remove the dots or not.
[ "Replaces", "all", ".", "and", "/", "with", "_", "and", "removes", "all", "spaces", "and", "double", "/", "single", "quotes", ".", "Chomps", "any", "trailing", ".", "or", "_", "character", "." ]
train
https://github.com/jmxtrans/jmxtrans/blob/496f342de3bcf2c2226626374b7a16edf8f4ba2a/jmxtrans-core/src/main/java/com/googlecode/jmxtrans/model/naming/StringUtils.java#L47-L62
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/nio/PacketIOHelper.java
PacketIOHelper.writeTo
public boolean writeTo(Packet packet, ByteBuffer dst) { """ Writes the packet data to the supplied {@code ByteBuffer}, up to the buffer's limit. If it returns {@code false}, it should be called again to write the remaining data. @param dst the destination byte buffer @return {@code true} if all the packet's data is now written out; {@code false} otherwise. """ if (!headerComplete) { if (dst.remaining() < HEADER_SIZE) { return false; } dst.put(VERSION); dst.putChar(packet.getFlags()); dst.putInt(packet.getPartitionId()); size = packet.totalSize(); dst.putInt(size); headerComplete = true; } if (writeValue(packet, dst)) { reset(); return true; } else { return false; } }
java
public boolean writeTo(Packet packet, ByteBuffer dst) { if (!headerComplete) { if (dst.remaining() < HEADER_SIZE) { return false; } dst.put(VERSION); dst.putChar(packet.getFlags()); dst.putInt(packet.getPartitionId()); size = packet.totalSize(); dst.putInt(size); headerComplete = true; } if (writeValue(packet, dst)) { reset(); return true; } else { return false; } }
[ "public", "boolean", "writeTo", "(", "Packet", "packet", ",", "ByteBuffer", "dst", ")", "{", "if", "(", "!", "headerComplete", ")", "{", "if", "(", "dst", ".", "remaining", "(", ")", "<", "HEADER_SIZE", ")", "{", "return", "false", ";", "}", "dst", "...
Writes the packet data to the supplied {@code ByteBuffer}, up to the buffer's limit. If it returns {@code false}, it should be called again to write the remaining data. @param dst the destination byte buffer @return {@code true} if all the packet's data is now written out; {@code false} otherwise.
[ "Writes", "the", "packet", "data", "to", "the", "supplied", "{", "@code", "ByteBuffer", "}", "up", "to", "the", "buffer", "s", "limit", ".", "If", "it", "returns", "{", "@code", "false", "}", "it", "should", "be", "called", "again", "to", "write", "the...
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/nio/PacketIOHelper.java#L58-L78
apache/incubator-gobblin
gobblin-config-management/gobblin-config-core/src/main/java/org/apache/gobblin/config/common/impl/InMemoryTopology.java
InMemoryTopology.getImportedBy
@Override public Collection<ConfigKeyPath> getImportedBy(ConfigKeyPath configKey) { """ {@inheritDoc}. <p> If the result is already in cache, return the result. Otherwise, delegate the functionality to the fallback object. If the fallback did not support this operation, will build the entire topology of the {@link org.apache.gobblin.config.store.api.ConfigStore} using default breath first search. </p> """ return getImportedBy(configKey, Optional.<Config>absent()); }
java
@Override public Collection<ConfigKeyPath> getImportedBy(ConfigKeyPath configKey) { return getImportedBy(configKey, Optional.<Config>absent()); }
[ "@", "Override", "public", "Collection", "<", "ConfigKeyPath", ">", "getImportedBy", "(", "ConfigKeyPath", "configKey", ")", "{", "return", "getImportedBy", "(", "configKey", ",", "Optional", ".", "<", "Config", ">", "absent", "(", ")", ")", ";", "}" ]
{@inheritDoc}. <p> If the result is already in cache, return the result. Otherwise, delegate the functionality to the fallback object. If the fallback did not support this operation, will build the entire topology of the {@link org.apache.gobblin.config.store.api.ConfigStore} using default breath first search. </p>
[ "{", "@inheritDoc", "}", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-config-management/gobblin-config-core/src/main/java/org/apache/gobblin/config/common/impl/InMemoryTopology.java#L149-L152
real-logic/simple-binary-encoding
sbe-tool/src/main/java/uk/co/real_logic/sbe/xml/XmlSchemaParser.java
XmlSchemaParser.getAttributeValueOrNull
public static String getAttributeValueOrNull(final Node elementNode, final String attrName) { """ Helper function that hides the null return from {@link org.w3c.dom.NamedNodeMap#getNamedItem(String)} @param elementNode that could be null @param attrName that is to be looked up @return null or value of the attribute """ if (null == elementNode || null == elementNode.getAttributes()) { return null; } final Node attrNode = elementNode.getAttributes().getNamedItemNS(null, attrName); if (null == attrNode) { return null; } return attrNode.getNodeValue(); }
java
public static String getAttributeValueOrNull(final Node elementNode, final String attrName) { if (null == elementNode || null == elementNode.getAttributes()) { return null; } final Node attrNode = elementNode.getAttributes().getNamedItemNS(null, attrName); if (null == attrNode) { return null; } return attrNode.getNodeValue(); }
[ "public", "static", "String", "getAttributeValueOrNull", "(", "final", "Node", "elementNode", ",", "final", "String", "attrName", ")", "{", "if", "(", "null", "==", "elementNode", "||", "null", "==", "elementNode", ".", "getAttributes", "(", ")", ")", "{", "...
Helper function that hides the null return from {@link org.w3c.dom.NamedNodeMap#getNamedItem(String)} @param elementNode that could be null @param attrName that is to be looked up @return null or value of the attribute
[ "Helper", "function", "that", "hides", "the", "null", "return", "from", "{", "@link", "org", ".", "w3c", ".", "dom", ".", "NamedNodeMap#getNamedItem", "(", "String", ")", "}" ]
train
https://github.com/real-logic/simple-binary-encoding/blob/9a7be490c86d98f0e430e4189bc6c8c4fbef658b/sbe-tool/src/main/java/uk/co/real_logic/sbe/xml/XmlSchemaParser.java#L320-L334
Azure/azure-sdk-for-java
mediaservices/resource-manager/v2018_03_30_preview/src/main/java/com/microsoft/azure/management/mediaservices/v2018_03_30_preview/implementation/TransformsInner.java
TransformsInner.getAsync
public Observable<TransformInner> getAsync(String resourceGroupName, String accountName, String transformName) { """ Get Transform. Gets a Transform. @param resourceGroupName The name of the resource group within the Azure subscription. @param accountName The Media Services account name. @param transformName The Transform name. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the TransformInner object """ return getWithServiceResponseAsync(resourceGroupName, accountName, transformName).map(new Func1<ServiceResponse<TransformInner>, TransformInner>() { @Override public TransformInner call(ServiceResponse<TransformInner> response) { return response.body(); } }); }
java
public Observable<TransformInner> getAsync(String resourceGroupName, String accountName, String transformName) { return getWithServiceResponseAsync(resourceGroupName, accountName, transformName).map(new Func1<ServiceResponse<TransformInner>, TransformInner>() { @Override public TransformInner call(ServiceResponse<TransformInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "TransformInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "accountName", ",", "String", "transformName", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",", "accountName", ",", "tra...
Get Transform. Gets a Transform. @param resourceGroupName The name of the resource group within the Azure subscription. @param accountName The Media Services account name. @param transformName The Transform name. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the TransformInner object
[ "Get", "Transform", ".", "Gets", "a", "Transform", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mediaservices/resource-manager/v2018_03_30_preview/src/main/java/com/microsoft/azure/management/mediaservices/v2018_03_30_preview/implementation/TransformsInner.java#L399-L406
looly/hutool
hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java
ArrayUtil.join
public static String join(long[] array, CharSequence conjunction) { """ 以 conjunction 为分隔符将数组转换为字符串 @param array 数组 @param conjunction 分隔符 @return 连接后的字符串 """ if (null == array) { return null; } final StringBuilder sb = new StringBuilder(); boolean isFirst = true; for (long item : array) { if (isFirst) { isFirst = false; } else { sb.append(conjunction); } sb.append(item); } return sb.toString(); }
java
public static String join(long[] array, CharSequence conjunction) { if (null == array) { return null; } final StringBuilder sb = new StringBuilder(); boolean isFirst = true; for (long item : array) { if (isFirst) { isFirst = false; } else { sb.append(conjunction); } sb.append(item); } return sb.toString(); }
[ "public", "static", "String", "join", "(", "long", "[", "]", "array", ",", "CharSequence", "conjunction", ")", "{", "if", "(", "null", "==", "array", ")", "{", "return", "null", ";", "}", "final", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ...
以 conjunction 为分隔符将数组转换为字符串 @param array 数组 @param conjunction 分隔符 @return 连接后的字符串
[ "以", "conjunction", "为分隔符将数组转换为字符串" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java#L2341-L2357
netty/netty
common/src/main/java/io/netty/util/internal/StringUtil.java
StringUtil.commonSuffixOfLength
public static boolean commonSuffixOfLength(String s, String p, int len) { """ Checks if two strings have the same suffix of specified length @param s string @param p string @param len length of the common suffix @return true if both s and p are not null and both have the same suffix. Otherwise - false """ return s != null && p != null && len >= 0 && s.regionMatches(s.length() - len, p, p.length() - len, len); }
java
public static boolean commonSuffixOfLength(String s, String p, int len) { return s != null && p != null && len >= 0 && s.regionMatches(s.length() - len, p, p.length() - len, len); }
[ "public", "static", "boolean", "commonSuffixOfLength", "(", "String", "s", ",", "String", "p", ",", "int", "len", ")", "{", "return", "s", "!=", "null", "&&", "p", "!=", "null", "&&", "len", ">=", "0", "&&", "s", ".", "regionMatches", "(", "s", ".", ...
Checks if two strings have the same suffix of specified length @param s string @param p string @param len length of the common suffix @return true if both s and p are not null and both have the same suffix. Otherwise - false
[ "Checks", "if", "two", "strings", "have", "the", "same", "suffix", "of", "specified", "length" ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/internal/StringUtil.java#L83-L85
hankcs/HanLP
src/main/java/com/hankcs/hanlp/HanLP.java
HanLP.extractWords
public static List<WordInfo> extractWords(String text, int size, boolean newWordsOnly) { """ 提取词语(新词发现) @param text 大文本 @param size 需要提取词语的数量 @param newWordsOnly 是否只提取词典中没有的词语 @return 一个词语列表 """ NewWordDiscover discover = new NewWordDiscover(4, 0.0f, .5f, 100f, newWordsOnly); return discover.discover(text, size); }
java
public static List<WordInfo> extractWords(String text, int size, boolean newWordsOnly) { NewWordDiscover discover = new NewWordDiscover(4, 0.0f, .5f, 100f, newWordsOnly); return discover.discover(text, size); }
[ "public", "static", "List", "<", "WordInfo", ">", "extractWords", "(", "String", "text", ",", "int", "size", ",", "boolean", "newWordsOnly", ")", "{", "NewWordDiscover", "discover", "=", "new", "NewWordDiscover", "(", "4", ",", "0.0f", ",", ".5f", ",", "10...
提取词语(新词发现) @param text 大文本 @param size 需要提取词语的数量 @param newWordsOnly 是否只提取词典中没有的词语 @return 一个词语列表
[ "提取词语(新词发现)" ]
train
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/HanLP.java#L757-L761
OpenLiberty/open-liberty
dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/ChannelFrameworkImpl.java
ChannelFrameworkImpl.getChannelState
public synchronized RuntimeState getChannelState(String channelName, Chain chain) { """ Return the state of the input runtime channel. @param channelName @param chain that includes this channel @return state of channel, or -1 if the channel cannot be found. """ RuntimeState state = null; Channel channel = getRunningChannel(channelName, chain); if (channel != null) { ChannelContainer channelContainer = this.channelRunningMap.get(channel.getName()); if (null != channelContainer) { state = channelContainer.getState(); } } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "getChannelState: " + channelName + "=" + state); } return state; }
java
public synchronized RuntimeState getChannelState(String channelName, Chain chain) { RuntimeState state = null; Channel channel = getRunningChannel(channelName, chain); if (channel != null) { ChannelContainer channelContainer = this.channelRunningMap.get(channel.getName()); if (null != channelContainer) { state = channelContainer.getState(); } } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "getChannelState: " + channelName + "=" + state); } return state; }
[ "public", "synchronized", "RuntimeState", "getChannelState", "(", "String", "channelName", ",", "Chain", "chain", ")", "{", "RuntimeState", "state", "=", "null", ";", "Channel", "channel", "=", "getRunningChannel", "(", "channelName", ",", "chain", ")", ";", "if...
Return the state of the input runtime channel. @param channelName @param chain that includes this channel @return state of channel, or -1 if the channel cannot be found.
[ "Return", "the", "state", "of", "the", "input", "runtime", "channel", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/ChannelFrameworkImpl.java#L4075-L4089
apache/groovy
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
DefaultGroovyMethods.getMetaPropertyValues
public static List<PropertyValue> getMetaPropertyValues(Object self) { """ Retrieves the list of {@link groovy.lang.MetaProperty} objects for 'self' and wraps it in a list of {@link groovy.lang.PropertyValue} objects that additionally provide the value for each property of 'self'. @param self the receiver object @return list of {@link groovy.lang.PropertyValue} objects @see groovy.util.Expando#getMetaPropertyValues() @since 1.0 """ MetaClass metaClass = InvokerHelper.getMetaClass(self); List<MetaProperty> mps = metaClass.getProperties(); List<PropertyValue> props = new ArrayList<PropertyValue>(mps.size()); for (MetaProperty mp : mps) { props.add(new PropertyValue(self, mp)); } return props; }
java
public static List<PropertyValue> getMetaPropertyValues(Object self) { MetaClass metaClass = InvokerHelper.getMetaClass(self); List<MetaProperty> mps = metaClass.getProperties(); List<PropertyValue> props = new ArrayList<PropertyValue>(mps.size()); for (MetaProperty mp : mps) { props.add(new PropertyValue(self, mp)); } return props; }
[ "public", "static", "List", "<", "PropertyValue", ">", "getMetaPropertyValues", "(", "Object", "self", ")", "{", "MetaClass", "metaClass", "=", "InvokerHelper", ".", "getMetaClass", "(", "self", ")", ";", "List", "<", "MetaProperty", ">", "mps", "=", "metaClas...
Retrieves the list of {@link groovy.lang.MetaProperty} objects for 'self' and wraps it in a list of {@link groovy.lang.PropertyValue} objects that additionally provide the value for each property of 'self'. @param self the receiver object @return list of {@link groovy.lang.PropertyValue} objects @see groovy.util.Expando#getMetaPropertyValues() @since 1.0
[ "Retrieves", "the", "list", "of", "{", "@link", "groovy", ".", "lang", ".", "MetaProperty", "}", "objects", "for", "self", "and", "wraps", "it", "in", "a", "list", "of", "{", "@link", "groovy", ".", "lang", ".", "PropertyValue", "}", "objects", "that", ...
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L512-L520
google/closure-compiler
src/com/google/javascript/jscomp/JsMessageVisitor.java
JsMessageVisitor.parseMessageTextNode
private static void parseMessageTextNode(Builder builder, Node node) throws MalformedException { """ Appends the message parts in a JS message value extracted from the given text node. @param builder the JS message builder to append parts to @param node the node with string literal that contains the message text @throws MalformedException if {@code value} contains a reference to an unregistered placeholder """ String value = extractStringFromStringExprNode(node); while (true) { int phBegin = value.indexOf(PH_JS_PREFIX); if (phBegin < 0) { // Just a string literal builder.appendStringPart(value); return; } else { if (phBegin > 0) { // A string literal followed by a placeholder builder.appendStringPart(value.substring(0, phBegin)); } // A placeholder. Find where it ends int phEnd = value.indexOf(PH_JS_SUFFIX, phBegin); if (phEnd < 0) { throw new MalformedException( "Placeholder incorrectly formatted in: " + builder.getKey(), node); } String phName = value.substring(phBegin + PH_JS_PREFIX.length(), phEnd); builder.appendPlaceholderReference(phName); int nextPos = phEnd + PH_JS_SUFFIX.length(); if (nextPos < value.length()) { // Iterate on the rest of the message value value = value.substring(nextPos); } else { // The message is parsed return; } } } }
java
private static void parseMessageTextNode(Builder builder, Node node) throws MalformedException { String value = extractStringFromStringExprNode(node); while (true) { int phBegin = value.indexOf(PH_JS_PREFIX); if (phBegin < 0) { // Just a string literal builder.appendStringPart(value); return; } else { if (phBegin > 0) { // A string literal followed by a placeholder builder.appendStringPart(value.substring(0, phBegin)); } // A placeholder. Find where it ends int phEnd = value.indexOf(PH_JS_SUFFIX, phBegin); if (phEnd < 0) { throw new MalformedException( "Placeholder incorrectly formatted in: " + builder.getKey(), node); } String phName = value.substring(phBegin + PH_JS_PREFIX.length(), phEnd); builder.appendPlaceholderReference(phName); int nextPos = phEnd + PH_JS_SUFFIX.length(); if (nextPos < value.length()) { // Iterate on the rest of the message value value = value.substring(nextPos); } else { // The message is parsed return; } } } }
[ "private", "static", "void", "parseMessageTextNode", "(", "Builder", "builder", ",", "Node", "node", ")", "throws", "MalformedException", "{", "String", "value", "=", "extractStringFromStringExprNode", "(", "node", ")", ";", "while", "(", "true", ")", "{", "int"...
Appends the message parts in a JS message value extracted from the given text node. @param builder the JS message builder to append parts to @param node the node with string literal that contains the message text @throws MalformedException if {@code value} contains a reference to an unregistered placeholder
[ "Appends", "the", "message", "parts", "in", "a", "JS", "message", "value", "extracted", "from", "the", "given", "text", "node", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/JsMessageVisitor.java#L817-L854
jtablesaw/tablesaw
core/src/main/java/tech/tablesaw/joining/DataFrameJoiner.java
DataFrameJoiner.fullOuter
public Table fullOuter(boolean allowDuplicateColumnNames, Table... tables) { """ Full outer join to the given tables assuming that they have a column of the name we're joining on @param allowDuplicateColumnNames if {@code false} the join will fail if any columns other than the join column have the same name if {@code true} the join will succeed and duplicate columns are renamed* @param tables The tables to join with @return The resulting table """ Table joined = table; for (Table currT : tables) { joined = fullOuter(joined, currT, allowDuplicateColumnNames, columnNames); } return joined; }
java
public Table fullOuter(boolean allowDuplicateColumnNames, Table... tables) { Table joined = table; for (Table currT : tables) { joined = fullOuter(joined, currT, allowDuplicateColumnNames, columnNames); } return joined; }
[ "public", "Table", "fullOuter", "(", "boolean", "allowDuplicateColumnNames", ",", "Table", "...", "tables", ")", "{", "Table", "joined", "=", "table", ";", "for", "(", "Table", "currT", ":", "tables", ")", "{", "joined", "=", "fullOuter", "(", "joined", ",...
Full outer join to the given tables assuming that they have a column of the name we're joining on @param allowDuplicateColumnNames if {@code false} the join will fail if any columns other than the join column have the same name if {@code true} the join will succeed and duplicate columns are renamed* @param tables The tables to join with @return The resulting table
[ "Full", "outer", "join", "to", "the", "given", "tables", "assuming", "that", "they", "have", "a", "column", "of", "the", "name", "we", "re", "joining", "on" ]
train
https://github.com/jtablesaw/tablesaw/blob/68a75b4098ac677e9486df5572cf13ec39f9f701/core/src/main/java/tech/tablesaw/joining/DataFrameJoiner.java#L352-L359
janus-project/guava.janusproject.io
guava/src/com/google/common/net/InetAddresses.java
InetAddresses.getTeredoInfo
public static TeredoInfo getTeredoInfo(Inet6Address ip) { """ Returns the Teredo information embedded in a Teredo address. @param ip {@link Inet6Address} to be examined for embedded Teredo information @return extracted {@code TeredoInfo} @throws IllegalArgumentException if the argument is not a valid IPv6 Teredo address """ Preconditions.checkArgument(isTeredoAddress(ip), "Address '%s' is not a Teredo address.", toAddrString(ip)); byte[] bytes = ip.getAddress(); Inet4Address server = getInet4Address(Arrays.copyOfRange(bytes, 4, 8)); int flags = ByteStreams.newDataInput(bytes, 8).readShort() & 0xffff; // Teredo obfuscates the mapped client port, per section 4 of the RFC. int port = ~ByteStreams.newDataInput(bytes, 10).readShort() & 0xffff; byte[] clientBytes = Arrays.copyOfRange(bytes, 12, 16); for (int i = 0; i < clientBytes.length; i++) { // Teredo obfuscates the mapped client IP, per section 4 of the RFC. clientBytes[i] = (byte) ~clientBytes[i]; } Inet4Address client = getInet4Address(clientBytes); return new TeredoInfo(server, client, port, flags); }
java
public static TeredoInfo getTeredoInfo(Inet6Address ip) { Preconditions.checkArgument(isTeredoAddress(ip), "Address '%s' is not a Teredo address.", toAddrString(ip)); byte[] bytes = ip.getAddress(); Inet4Address server = getInet4Address(Arrays.copyOfRange(bytes, 4, 8)); int flags = ByteStreams.newDataInput(bytes, 8).readShort() & 0xffff; // Teredo obfuscates the mapped client port, per section 4 of the RFC. int port = ~ByteStreams.newDataInput(bytes, 10).readShort() & 0xffff; byte[] clientBytes = Arrays.copyOfRange(bytes, 12, 16); for (int i = 0; i < clientBytes.length; i++) { // Teredo obfuscates the mapped client IP, per section 4 of the RFC. clientBytes[i] = (byte) ~clientBytes[i]; } Inet4Address client = getInet4Address(clientBytes); return new TeredoInfo(server, client, port, flags); }
[ "public", "static", "TeredoInfo", "getTeredoInfo", "(", "Inet6Address", "ip", ")", "{", "Preconditions", ".", "checkArgument", "(", "isTeredoAddress", "(", "ip", ")", ",", "\"Address '%s' is not a Teredo address.\"", ",", "toAddrString", "(", "ip", ")", ")", ";", ...
Returns the Teredo information embedded in a Teredo address. @param ip {@link Inet6Address} to be examined for embedded Teredo information @return extracted {@code TeredoInfo} @throws IllegalArgumentException if the argument is not a valid IPv6 Teredo address
[ "Returns", "the", "Teredo", "information", "embedded", "in", "a", "Teredo", "address", "." ]
train
https://github.com/janus-project/guava.janusproject.io/blob/1c48fb672c9fdfddf276970570f703fa1115f588/guava/src/com/google/common/net/InetAddresses.java#L693-L713
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/blas/impl/SparseBaseLevel1.java
SparseBaseLevel1.axpy
@Override public void axpy(long n, double alpha, INDArray x, INDArray y) { """ Adds a scalar multiple of compressed sparse vector to a full-storage vector. @param n The number of element @param alpha @param x a sparse vector @param y a dense vector """ BaseSparseNDArray sparseX = (BaseSparseNDArray) x; DataBuffer pointers = sparseX.getVectorCoordinates(); switch (x.data().dataType()) { case DOUBLE: DefaultOpExecutioner.validateDataType(DataType.DOUBLE, x); DefaultOpExecutioner.validateDataType(DataType.DOUBLE, y); daxpyi(n, alpha, x, pointers, y); break; case FLOAT: DefaultOpExecutioner.validateDataType(DataType.FLOAT, x); DefaultOpExecutioner.validateDataType(DataType.FLOAT, y); saxpyi(n, alpha, x, pointers, y); break; case HALF: DefaultOpExecutioner.validateDataType(DataType.HALF, x); DefaultOpExecutioner.validateDataType(DataType.HALF, y); haxpyi(n, alpha, x, pointers, y); break; default: throw new UnsupportedOperationException(); } }
java
@Override public void axpy(long n, double alpha, INDArray x, INDArray y) { BaseSparseNDArray sparseX = (BaseSparseNDArray) x; DataBuffer pointers = sparseX.getVectorCoordinates(); switch (x.data().dataType()) { case DOUBLE: DefaultOpExecutioner.validateDataType(DataType.DOUBLE, x); DefaultOpExecutioner.validateDataType(DataType.DOUBLE, y); daxpyi(n, alpha, x, pointers, y); break; case FLOAT: DefaultOpExecutioner.validateDataType(DataType.FLOAT, x); DefaultOpExecutioner.validateDataType(DataType.FLOAT, y); saxpyi(n, alpha, x, pointers, y); break; case HALF: DefaultOpExecutioner.validateDataType(DataType.HALF, x); DefaultOpExecutioner.validateDataType(DataType.HALF, y); haxpyi(n, alpha, x, pointers, y); break; default: throw new UnsupportedOperationException(); } }
[ "@", "Override", "public", "void", "axpy", "(", "long", "n", ",", "double", "alpha", ",", "INDArray", "x", ",", "INDArray", "y", ")", "{", "BaseSparseNDArray", "sparseX", "=", "(", "BaseSparseNDArray", ")", "x", ";", "DataBuffer", "pointers", "=", "sparseX...
Adds a scalar multiple of compressed sparse vector to a full-storage vector. @param n The number of element @param alpha @param x a sparse vector @param y a dense vector
[ "Adds", "a", "scalar", "multiple", "of", "compressed", "sparse", "vector", "to", "a", "full", "-", "storage", "vector", "." ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/blas/impl/SparseBaseLevel1.java#L204-L227