repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
204
func_name
stringlengths
5
103
whole_func_string
stringlengths
87
3.44k
language
stringclasses
1 value
func_code_string
stringlengths
87
3.44k
func_code_tokens
listlengths
21
714
func_documentation_string
stringlengths
61
1.95k
func_documentation_tokens
listlengths
1
482
split_name
stringclasses
1 value
func_code_url
stringlengths
102
309
google/j2objc
jre_emul/android/platform/external/okhttp/okio/okio/src/main/java/okio/Buffer.java
Buffer.copyTo
public Buffer copyTo(Buffer out, long offset, long byteCount) { if (out == null) throw new IllegalArgumentException("out == null"); checkOffsetAndCount(size, offset, byteCount); if (byteCount == 0) return this; out.size += byteCount; // Skip segments that we aren't copying from. Segment s = head; for (; offset >= (s.limit - s.pos); s = s.next) { offset -= (s.limit - s.pos); } // Copy one segment at a time. for (; byteCount > 0; s = s.next) { Segment copy = new Segment(s); copy.pos += offset; copy.limit = Math.min(copy.pos + (int) byteCount, copy.limit); if (out.head == null) { out.head = copy.next = copy.prev = copy; } else { out.head.prev.push(copy); } byteCount -= copy.limit - copy.pos; offset = 0; } return this; }
java
public Buffer copyTo(Buffer out, long offset, long byteCount) { if (out == null) throw new IllegalArgumentException("out == null"); checkOffsetAndCount(size, offset, byteCount); if (byteCount == 0) return this; out.size += byteCount; // Skip segments that we aren't copying from. Segment s = head; for (; offset >= (s.limit - s.pos); s = s.next) { offset -= (s.limit - s.pos); } // Copy one segment at a time. for (; byteCount > 0; s = s.next) { Segment copy = new Segment(s); copy.pos += offset; copy.limit = Math.min(copy.pos + (int) byteCount, copy.limit); if (out.head == null) { out.head = copy.next = copy.prev = copy; } else { out.head.prev.push(copy); } byteCount -= copy.limit - copy.pos; offset = 0; } return this; }
[ "public", "Buffer", "copyTo", "(", "Buffer", "out", ",", "long", "offset", ",", "long", "byteCount", ")", "{", "if", "(", "out", "==", "null", ")", "throw", "new", "IllegalArgumentException", "(", "\"out == null\"", ")", ";", "checkOffsetAndCount", "(", "siz...
Copy {@code byteCount} bytes from this, starting at {@code offset}, to {@code out}.
[ "Copy", "{" ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/okhttp/okio/okio/src/main/java/okio/Buffer.java#L164-L192
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/ProteinSequence.java
ProteinSequence.setParentDNASequence
public void setParentDNASequence(AbstractSequence<NucleotideCompound> parentDNASequence, Integer begin, Integer end) { this.setParentSequence(parentDNASequence); setBioBegin(begin); setBioEnd(end); }
java
public void setParentDNASequence(AbstractSequence<NucleotideCompound> parentDNASequence, Integer begin, Integer end) { this.setParentSequence(parentDNASequence); setBioBegin(begin); setBioEnd(end); }
[ "public", "void", "setParentDNASequence", "(", "AbstractSequence", "<", "NucleotideCompound", ">", "parentDNASequence", ",", "Integer", "begin", ",", "Integer", "end", ")", "{", "this", ".", "setParentSequence", "(", "parentDNASequence", ")", ";", "setBioBegin", "("...
However, due to the derivation of this class, this is the only possible type argument for this parameter...
[ "However", "due", "to", "the", "derivation", "of", "this", "class", "this", "is", "the", "only", "possible", "type", "argument", "for", "this", "parameter", "..." ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/ProteinSequence.java#L149-L153
dashorst/wicket-stuff-markup-validator
jing/src/main/java/com/thaiopensource/validate/nvdl/FilteredAttributes.java
FilteredAttributes.getRealIndex
private int getRealIndex(String uri, String localName) { int index = attributes.getIndex(uri, localName); if (index < 0 || reverseIndex(index) < 0) return -1; return index; }
java
private int getRealIndex(String uri, String localName) { int index = attributes.getIndex(uri, localName); if (index < 0 || reverseIndex(index) < 0) return -1; return index; }
[ "private", "int", "getRealIndex", "(", "String", "uri", ",", "String", "localName", ")", "{", "int", "index", "=", "attributes", ".", "getIndex", "(", "uri", ",", "localName", ")", ";", "if", "(", "index", "<", "0", "||", "reverseIndex", "(", "index", ...
Get the real index, in the initial attributes list of a given attribute. If the attribute is filtered out then return -1. @param uri The attribute uri. @param localName The attribute local name. @return The real index if the attribute is present and not filtered out, otherwise -1.
[ "Get", "the", "real", "index", "in", "the", "initial", "attributes", "list", "of", "a", "given", "attribute", ".", "If", "the", "attribute", "is", "filtered", "out", "then", "return", "-", "1", "." ]
train
https://github.com/dashorst/wicket-stuff-markup-validator/blob/9e529a4dc8bfdbbe4c794f3132ef400a006560a1/jing/src/main/java/com/thaiopensource/validate/nvdl/FilteredAttributes.java#L133-L138
spring-projects/spring-data-solr
src/main/java/org/springframework/data/solr/core/QueryParserBase.java
QueryParserBase.appendRequestHandler
protected void appendRequestHandler(SolrQuery solrQuery, @Nullable String requestHandler) { if (StringUtils.isNotBlank(requestHandler)) { solrQuery.add(CommonParams.QT, requestHandler); } }
java
protected void appendRequestHandler(SolrQuery solrQuery, @Nullable String requestHandler) { if (StringUtils.isNotBlank(requestHandler)) { solrQuery.add(CommonParams.QT, requestHandler); } }
[ "protected", "void", "appendRequestHandler", "(", "SolrQuery", "solrQuery", ",", "@", "Nullable", "String", "requestHandler", ")", "{", "if", "(", "StringUtils", ".", "isNotBlank", "(", "requestHandler", ")", ")", "{", "solrQuery", ".", "add", "(", "CommonParams...
Set request handler parameter for {@link SolrQuery} @param solrQuery @param requestHandler
[ "Set", "request", "handler", "parameter", "for", "{", "@link", "SolrQuery", "}" ]
train
https://github.com/spring-projects/spring-data-solr/blob/20be5cb82498b70134dfda6c1a91ad21f8e657e0/src/main/java/org/springframework/data/solr/core/QueryParserBase.java#L499-L503
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Currency.java
Currency.registerInstance
public static Object registerInstance(Currency currency, ULocale locale) { return getShim().registerInstance(currency, locale); }
java
public static Object registerInstance(Currency currency, ULocale locale) { return getShim().registerInstance(currency, locale); }
[ "public", "static", "Object", "registerInstance", "(", "Currency", "currency", ",", "ULocale", "locale", ")", "{", "return", "getShim", "(", ")", ".", "registerInstance", "(", "currency", ",", "locale", ")", ";", "}" ]
Registers a new currency for the provided locale. The returned object is a key that can be used to unregister this currency object. <p>Because ICU may choose to cache Currency objects internally, this must be called at application startup, prior to any calls to Currency.getInstance to avoid undefined behavior. @param currency the currency to register @param locale the ulocale under which to register the currency @return a registry key that can be used to unregister this currency @see #unregister @hide unsupported on Android
[ "Registers", "a", "new", "currency", "for", "the", "provided", "locale", ".", "The", "returned", "object", "is", "a", "key", "that", "can", "be", "used", "to", "unregister", "this", "currency", "object", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Currency.java#L322-L324
gturri/aXMLRPC
src/main/java/de/timroes/axmlrpc/XMLUtil.java
XMLUtil.makeXmlTag
public static XmlElement makeXmlTag(String type, String content) { XmlElement xml = new XmlElement(type); xml.setContent(content); return xml; }
java
public static XmlElement makeXmlTag(String type, String content) { XmlElement xml = new XmlElement(type); xml.setContent(content); return xml; }
[ "public", "static", "XmlElement", "makeXmlTag", "(", "String", "type", ",", "String", "content", ")", "{", "XmlElement", "xml", "=", "new", "XmlElement", "(", "type", ")", ";", "xml", ".", "setContent", "(", "content", ")", ";", "return", "xml", ";", "}"...
Creates an xml tag with a given type and content. @param type The type of the xml tag. What will be filled in the <..>. @param content The content of the tag. @return The xml tag with its content as a string.
[ "Creates", "an", "xml", "tag", "with", "a", "given", "type", "and", "content", "." ]
train
https://github.com/gturri/aXMLRPC/blob/8ca6f95f7eb3a28efaef3569d53adddeb32b6bda/src/main/java/de/timroes/axmlrpc/XMLUtil.java#L120-L124
Azure/azure-sdk-for-java
network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/VpnSitesInner.java
VpnSitesInner.createOrUpdateAsync
public Observable<VpnSiteInner> createOrUpdateAsync(String resourceGroupName, String vpnSiteName, VpnSiteInner vpnSiteParameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, vpnSiteName, vpnSiteParameters).map(new Func1<ServiceResponse<VpnSiteInner>, VpnSiteInner>() { @Override public VpnSiteInner call(ServiceResponse<VpnSiteInner> response) { return response.body(); } }); }
java
public Observable<VpnSiteInner> createOrUpdateAsync(String resourceGroupName, String vpnSiteName, VpnSiteInner vpnSiteParameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, vpnSiteName, vpnSiteParameters).map(new Func1<ServiceResponse<VpnSiteInner>, VpnSiteInner>() { @Override public VpnSiteInner call(ServiceResponse<VpnSiteInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "VpnSiteInner", ">", "createOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "vpnSiteName", ",", "VpnSiteInner", "vpnSiteParameters", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", ...
Creates a VpnSite resource if it doesn't exist else updates the existing VpnSite. @param resourceGroupName The resource group name of the VpnSite. @param vpnSiteName The name of the VpnSite being created or updated. @param vpnSiteParameters Parameters supplied to create or update VpnSite. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Creates", "a", "VpnSite", "resource", "if", "it", "doesn", "t", "exist", "else", "updates", "the", "existing", "VpnSite", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/VpnSitesInner.java#L238-L245
googlegenomics/utils-java
src/main/java/com/google/cloud/genomics/utils/grpc/VariantStreamIterator.java
VariantStreamIterator.enforceShardBoundary
public static VariantStreamIterator enforceShardBoundary(ManagedChannel channel, StreamVariantsRequest request, Requirement shardBoundary, String fields) { Predicate<Variant> shardPredicate; if(ShardBoundary.Requirement.STRICT == shardBoundary) { shardPredicate = ShardBoundary.getStrictVariantPredicate(request.getStart(), fields); } else { shardPredicate = null; } return new VariantStreamIterator(channel, request, shardPredicate); }
java
public static VariantStreamIterator enforceShardBoundary(ManagedChannel channel, StreamVariantsRequest request, Requirement shardBoundary, String fields) { Predicate<Variant> shardPredicate; if(ShardBoundary.Requirement.STRICT == shardBoundary) { shardPredicate = ShardBoundary.getStrictVariantPredicate(request.getStart(), fields); } else { shardPredicate = null; } return new VariantStreamIterator(channel, request, shardPredicate); }
[ "public", "static", "VariantStreamIterator", "enforceShardBoundary", "(", "ManagedChannel", "channel", ",", "StreamVariantsRequest", "request", ",", "Requirement", "shardBoundary", ",", "String", "fields", ")", "{", "Predicate", "<", "Variant", ">", "shardPredicate", ";...
Create a stream iterator that can enforce shard boundary semantics. @param channel The ManagedChannel. @param request The request for the shard of data. @param shardBoundary The shard boundary semantics to enforce. @param fields Used to check whether the specified fields would meet the minimum required fields for the shard boundary predicate, if applicable.
[ "Create", "a", "stream", "iterator", "that", "can", "enforce", "shard", "boundary", "semantics", "." ]
train
https://github.com/googlegenomics/utils-java/blob/7205d5b4e4f61fc6b93acb4bdd76b93df5b5f612/src/main/java/com/google/cloud/genomics/utils/grpc/VariantStreamIterator.java#L70-L80
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java
TrainingsImpl.getTags
public List<Tag> getTags(UUID projectId, GetTagsOptionalParameter getTagsOptionalParameter) { return getTagsWithServiceResponseAsync(projectId, getTagsOptionalParameter).toBlocking().single().body(); }
java
public List<Tag> getTags(UUID projectId, GetTagsOptionalParameter getTagsOptionalParameter) { return getTagsWithServiceResponseAsync(projectId, getTagsOptionalParameter).toBlocking().single().body(); }
[ "public", "List", "<", "Tag", ">", "getTags", "(", "UUID", "projectId", ",", "GetTagsOptionalParameter", "getTagsOptionalParameter", ")", "{", "return", "getTagsWithServiceResponseAsync", "(", "projectId", ",", "getTagsOptionalParameter", ")", ".", "toBlocking", "(", ...
Get the tags for a given project and iteration. @param projectId The project id @param getTagsOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the List&lt;Tag&gt; object if successful.
[ "Get", "the", "tags", "for", "a", "given", "project", "and", "iteration", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java#L453-L455
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java
KeyVaultClientBaseImpl.getCertificateOperationAsync
public ServiceFuture<CertificateOperation> getCertificateOperationAsync(String vaultBaseUrl, String certificateName, final ServiceCallback<CertificateOperation> serviceCallback) { return ServiceFuture.fromResponse(getCertificateOperationWithServiceResponseAsync(vaultBaseUrl, certificateName), serviceCallback); }
java
public ServiceFuture<CertificateOperation> getCertificateOperationAsync(String vaultBaseUrl, String certificateName, final ServiceCallback<CertificateOperation> serviceCallback) { return ServiceFuture.fromResponse(getCertificateOperationWithServiceResponseAsync(vaultBaseUrl, certificateName), serviceCallback); }
[ "public", "ServiceFuture", "<", "CertificateOperation", ">", "getCertificateOperationAsync", "(", "String", "vaultBaseUrl", ",", "String", "certificateName", ",", "final", "ServiceCallback", "<", "CertificateOperation", ">", "serviceCallback", ")", "{", "return", "Service...
Gets the creation operation of a certificate. Gets the creation operation associated with a specified certificate. This operation requires the certificates/get permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param certificateName The name of the certificate. @param serviceCallback the async ServiceCallback to handle successful and failed responses. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceFuture} object
[ "Gets", "the", "creation", "operation", "of", "a", "certificate", ".", "Gets", "the", "creation", "operation", "associated", "with", "a", "specified", "certificate", ".", "This", "operation", "requires", "the", "certificates", "/", "get", "permission", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L7748-L7750
elki-project/elki
elki-persistent/src/main/java/de/lmu/ifi/dbs/elki/persistent/OnDiskUpperTriangleMatrix.java
OnDiskUpperTriangleMatrix.getRecordBuffer
public synchronized ByteBuffer getRecordBuffer(int x, int y) throws IOException { if(x >= matrixsize || y >= matrixsize) { throw new ArrayIndexOutOfBoundsException(); } return array.getRecordBuffer(computeOffset(x, y)); }
java
public synchronized ByteBuffer getRecordBuffer(int x, int y) throws IOException { if(x >= matrixsize || y >= matrixsize) { throw new ArrayIndexOutOfBoundsException(); } return array.getRecordBuffer(computeOffset(x, y)); }
[ "public", "synchronized", "ByteBuffer", "getRecordBuffer", "(", "int", "x", ",", "int", "y", ")", "throws", "IOException", "{", "if", "(", "x", ">=", "matrixsize", "||", "y", ">=", "matrixsize", ")", "{", "throw", "new", "ArrayIndexOutOfBoundsException", "(", ...
Get a record buffer @param x First coordinate @param y Second coordinate @return Byte buffer for the record @throws IOException on IO errors
[ "Get", "a", "record", "buffer" ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-persistent/src/main/java/de/lmu/ifi/dbs/elki/persistent/OnDiskUpperTriangleMatrix.java#L147-L152
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/ManagedDatabasesInner.java
ManagedDatabasesInner.beginCompleteRestoreAsync
public Observable<Void> beginCompleteRestoreAsync(String locationName, UUID operationId, String lastBackupName) { return beginCompleteRestoreWithServiceResponseAsync(locationName, operationId, lastBackupName).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
java
public Observable<Void> beginCompleteRestoreAsync(String locationName, UUID operationId, String lastBackupName) { return beginCompleteRestoreWithServiceResponseAsync(locationName, operationId, lastBackupName).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "beginCompleteRestoreAsync", "(", "String", "locationName", ",", "UUID", "operationId", ",", "String", "lastBackupName", ")", "{", "return", "beginCompleteRestoreWithServiceResponseAsync", "(", "locationName", ",", "operationId", ...
Completes the restore operation on a managed database. @param locationName The name of the region where the resource is located. @param operationId Management operation id that this request tries to complete. @param lastBackupName The last backup name to apply @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful.
[ "Completes", "the", "restore", "operation", "on", "a", "managed", "database", "." ]
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/ManagedDatabasesInner.java#L229-L236
OpenLiberty/open-liberty
dev/com.ibm.ws.microprofile.faulttolerance.2.0/src/com/ibm/ws/microprofile/faulttolerance20/state/FaultToleranceStateFactory.java
FaultToleranceStateFactory.createSyncBulkheadState
public SyncBulkheadState createSyncBulkheadState(BulkheadPolicy policy, MetricRecorder metricRecorder) { if (policy == null) { return new SyncBulkheadStateNullImpl(); } else { return new SyncBulkheadStateImpl(policy, metricRecorder); } }
java
public SyncBulkheadState createSyncBulkheadState(BulkheadPolicy policy, MetricRecorder metricRecorder) { if (policy == null) { return new SyncBulkheadStateNullImpl(); } else { return new SyncBulkheadStateImpl(policy, metricRecorder); } }
[ "public", "SyncBulkheadState", "createSyncBulkheadState", "(", "BulkheadPolicy", "policy", ",", "MetricRecorder", "metricRecorder", ")", "{", "if", "(", "policy", "==", "null", ")", "{", "return", "new", "SyncBulkheadStateNullImpl", "(", ")", ";", "}", "else", "{"...
Create an object implementing a synchronous Bulkhead @param policy the BulkheadPolicy, may be {@code null} @return a new SyncBulkheadState
[ "Create", "an", "object", "implementing", "a", "synchronous", "Bulkhead" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.faulttolerance.2.0/src/com/ibm/ws/microprofile/faulttolerance20/state/FaultToleranceStateFactory.java#L67-L73
jtablesaw/tablesaw
core/src/main/java/tech/tablesaw/io/string/DataFramePrinter.java
DataFramePrinter.getHeaderTemplate
private static String getHeaderTemplate(int[] widths, String[] headers) { return IntStream.range(0, widths.length).mapToObj(i -> { final int width = widths[i]; final int length = headers[i].length(); final int leading = (width - length) / 2; final int trailing = width - (length + leading); final StringBuilder text = new StringBuilder(); whitespace(text, leading + 1); text.append("%").append(i + 1).append("$s"); whitespace(text, trailing); text.append(" |"); return text.toString(); }).reduce((left, right) -> left + " " + right).orElse(""); }
java
private static String getHeaderTemplate(int[] widths, String[] headers) { return IntStream.range(0, widths.length).mapToObj(i -> { final int width = widths[i]; final int length = headers[i].length(); final int leading = (width - length) / 2; final int trailing = width - (length + leading); final StringBuilder text = new StringBuilder(); whitespace(text, leading + 1); text.append("%").append(i + 1).append("$s"); whitespace(text, trailing); text.append(" |"); return text.toString(); }).reduce((left, right) -> left + " " + right).orElse(""); }
[ "private", "static", "String", "getHeaderTemplate", "(", "int", "[", "]", "widths", ",", "String", "[", "]", "headers", ")", "{", "return", "IntStream", ".", "range", "(", "0", ",", "widths", ".", "length", ")", ".", "mapToObj", "(", "i", "->", "{", ...
Returns the header template given the widths specified @param widths the token widths @return the line format template
[ "Returns", "the", "header", "template", "given", "the", "widths", "specified" ]
train
https://github.com/jtablesaw/tablesaw/blob/68a75b4098ac677e9486df5572cf13ec39f9f701/core/src/main/java/tech/tablesaw/io/string/DataFramePrinter.java#L74-L87
bbottema/simple-java-mail
modules/simple-java-mail/src/main/java/org/simplejavamail/converter/EmailConverter.java
EmailConverter.emlToEmailBuilder
public static EmailPopulatingBuilder emlToEmailBuilder(@Nonnull final InputStream emlInputStream) { try { return emlToEmailBuilder(readInputStreamToString(checkNonEmptyArgument(emlInputStream, "emlInputStream"), UTF_8)); } catch (IOException e) { throw new EmailConverterException(EmailConverterException.ERROR_READING_EML_INPUTSTREAM, e); } }
java
public static EmailPopulatingBuilder emlToEmailBuilder(@Nonnull final InputStream emlInputStream) { try { return emlToEmailBuilder(readInputStreamToString(checkNonEmptyArgument(emlInputStream, "emlInputStream"), UTF_8)); } catch (IOException e) { throw new EmailConverterException(EmailConverterException.ERROR_READING_EML_INPUTSTREAM, e); } }
[ "public", "static", "EmailPopulatingBuilder", "emlToEmailBuilder", "(", "@", "Nonnull", "final", "InputStream", "emlInputStream", ")", "{", "try", "{", "return", "emlToEmailBuilder", "(", "readInputStreamToString", "(", "checkNonEmptyArgument", "(", "emlInputStream", ",",...
Delegates to {@link #emlToEmail(String)} with the full string value read from the given <code>InputStream</code>.
[ "Delegates", "to", "{" ]
train
https://github.com/bbottema/simple-java-mail/blob/b03635328aeecd525e35eddfef8f5b9a184559d8/modules/simple-java-mail/src/main/java/org/simplejavamail/converter/EmailConverter.java#L133-L139
mangstadt/biweekly
src/main/java/biweekly/io/TimezoneInfo.java
TimezoneInfo.setFloating
public void setFloating(ICalProperty property, boolean enable) { if (enable) { floatingProperties.add(property); } else { removeIdentity(floatingProperties, property); } }
java
public void setFloating(ICalProperty property, boolean enable) { if (enable) { floatingProperties.add(property); } else { removeIdentity(floatingProperties, property); } }
[ "public", "void", "setFloating", "(", "ICalProperty", "property", ",", "boolean", "enable", ")", "{", "if", "(", "enable", ")", "{", "floatingProperties", ".", "add", "(", "property", ")", ";", "}", "else", "{", "removeIdentity", "(", "floatingProperties", "...
<p> Sets whether a property value should be formatted in floating time when written to an output stream (by default, floating time is disabled for all properties). </p> <p> A floating time value does not have a timezone associated with it, and is to be interpreted as being in the local timezone of the computer that is consuming the iCalendar object. </p> @param property the property @param enable true to enable floating time for this property, false to disable
[ "<p", ">", "Sets", "whether", "a", "property", "value", "should", "be", "formatted", "in", "floating", "time", "when", "written", "to", "an", "output", "stream", "(", "by", "default", "floating", "time", "is", "disabled", "for", "all", "properties", ")", "...
train
https://github.com/mangstadt/biweekly/blob/2e21350f85c13dfff52fdef98fdbebe2976fcf61/src/main/java/biweekly/io/TimezoneInfo.java#L253-L259
TheHortonMachine/hortonmachine
dbs/src/main/java/org/hortonmachine/dbs/utils/DbsUtilities.java
DbsUtilities.joinBySeparator
public static String joinBySeparator( List<String> items, String separator ) { int size = items.size(); if (size == 0) { return ""; } StringBuilder sb = new StringBuilder(items.get(0)); for( int i = 1; i < size; i++ ) { sb.append(separator).append(items.get(i)); } return sb.toString(); }
java
public static String joinBySeparator( List<String> items, String separator ) { int size = items.size(); if (size == 0) { return ""; } StringBuilder sb = new StringBuilder(items.get(0)); for( int i = 1; i < size; i++ ) { sb.append(separator).append(items.get(i)); } return sb.toString(); }
[ "public", "static", "String", "joinBySeparator", "(", "List", "<", "String", ">", "items", ",", "String", "separator", ")", "{", "int", "size", "=", "items", ".", "size", "(", ")", ";", "if", "(", "size", "==", "0", ")", "{", "return", "\"\"", ";", ...
Join a list of strings by string. @param items the list of strings. @param separator the separator to use. @return the resulting string.
[ "Join", "a", "list", "of", "strings", "by", "string", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/dbs/src/main/java/org/hortonmachine/dbs/utils/DbsUtilities.java#L99-L109
james-hu/jabb-core
src/main/java/net/sf/jabb/camel/RegistryUtility.java
RegistryUtility.addCodecOnly
static protected void addCodecOnly(CombinedRegistry registry, String name, ChannelHandler codec){ Object oldValue = registry.lookup(name); if (oldValue != null && oldValue != codec){ throw new IllegalArgumentException("Codec name '" + name + "' is already in use in at least one of the registries."); } registry.getDefaultSimpleRegistry().put(name, codec); }
java
static protected void addCodecOnly(CombinedRegistry registry, String name, ChannelHandler codec){ Object oldValue = registry.lookup(name); if (oldValue != null && oldValue != codec){ throw new IllegalArgumentException("Codec name '" + name + "' is already in use in at least one of the registries."); } registry.getDefaultSimpleRegistry().put(name, codec); }
[ "static", "protected", "void", "addCodecOnly", "(", "CombinedRegistry", "registry", ",", "String", "name", ",", "ChannelHandler", "codec", ")", "{", "Object", "oldValue", "=", "registry", ".", "lookup", "(", "name", ")", ";", "if", "(", "oldValue", "!=", "nu...
Adds codec to Registry only, it will not handle the manipulating of encoders or decoders list in Registry.<br> 仅仅把codec直接加入到Registry中,而不处理加入到Registry里的encoders或decoders列表中。 <p> If a codec with the same name already exists in the Registry, IllegalArgumentException will be thrown.<br> 如果Registry中原先已经有同名的别的codec,则抛出IllegalArgumentException。 @param registry The CombinedRegistry that the codec will be added into.<br> codec将要被加入的CombinedRegistry。 @param name Name of the codec in Registry.<br> codec在Registry中的名字。 @param codec The codec that will be used by Netty.<br> 将被Netty使用的codec。
[ "Adds", "codec", "to", "Registry", "only", "it", "will", "not", "handle", "the", "manipulating", "of", "encoders", "or", "decoders", "list", "in", "Registry", ".", "<br", ">", "仅仅把codec直接加入到Registry中,而不处理加入到Registry里的encoders或decoders列表中。", "<p", ">", "If", "a", "...
train
https://github.com/james-hu/jabb-core/blob/bceed441595c5e5195a7418795f03b69fa7b61e4/src/main/java/net/sf/jabb/camel/RegistryUtility.java#L140-L146
santhosh-tekuri/jlibs
core/src/main/java/jlibs/core/lang/ArrayUtil.java
ArrayUtil.indexOf
public static <T, S extends T> int indexOf(T array[], S item, int fromIndex){ if(array==null) return -1; for(int i=fromIndex; i<array.length; i++){ if(Util.equals(array[i], item)) return i; } return -1; }
java
public static <T, S extends T> int indexOf(T array[], S item, int fromIndex){ if(array==null) return -1; for(int i=fromIndex; i<array.length; i++){ if(Util.equals(array[i], item)) return i; } return -1; }
[ "public", "static", "<", "T", ",", "S", "extends", "T", ">", "int", "indexOf", "(", "T", "array", "[", "]", ",", "S", "item", ",", "int", "fromIndex", ")", "{", "if", "(", "array", "==", "null", ")", "return", "-", "1", ";", "for", "(", "int", ...
returns first index of <code>item<code> in given <code>array</code> starting from <code>fromIndex</code>(inclusive) @param array object array, can be null @param item item to be searched, can be null @param fromIndex index(inclusive) from which search happens. @return -1 if array is null, or the item is not found otherwize returns first index of item in array
[ "returns", "first", "index", "of", "<code", ">", "item<code", ">", "in", "given", "<code", ">", "array<", "/", "code", ">", "starting", "from", "<code", ">", "fromIndex<", "/", "code", ">", "(", "inclusive", ")" ]
train
https://github.com/santhosh-tekuri/jlibs/blob/59c28719f054123cf778278154e1b92e943ad232/core/src/main/java/jlibs/core/lang/ArrayUtil.java#L43-L52
EXIficient/exificient-core
src/main/java/com/siemens/ct/exi/core/io/BitOutputStream.java
BitOutputStream.writeBits
public void writeBits(int b, int n) throws IOException { if (n <= capacity) { // all bits fit into the current buffer buffer = (buffer << n) | (b & (0xff >> (BITS_IN_BYTE - n))); capacity -= n; if (capacity == 0) { ostream.write(buffer); capacity = BITS_IN_BYTE; len++; } } else { // fill as many bits into buffer as possible buffer = (buffer << capacity) | ((b >>> (n - capacity)) & (0xff >> (BITS_IN_BYTE - capacity))); n -= capacity; ostream.write(buffer); len++; // possibly write whole bytes while (n >= 8) { n -= 8; ostream.write(b >>> n); len++; } // put the rest of bits into the buffer buffer = b; // Note: the high bits will be shifted out during // further filling capacity = BITS_IN_BYTE - n; } }
java
public void writeBits(int b, int n) throws IOException { if (n <= capacity) { // all bits fit into the current buffer buffer = (buffer << n) | (b & (0xff >> (BITS_IN_BYTE - n))); capacity -= n; if (capacity == 0) { ostream.write(buffer); capacity = BITS_IN_BYTE; len++; } } else { // fill as many bits into buffer as possible buffer = (buffer << capacity) | ((b >>> (n - capacity)) & (0xff >> (BITS_IN_BYTE - capacity))); n -= capacity; ostream.write(buffer); len++; // possibly write whole bytes while (n >= 8) { n -= 8; ostream.write(b >>> n); len++; } // put the rest of bits into the buffer buffer = b; // Note: the high bits will be shifted out during // further filling capacity = BITS_IN_BYTE - n; } }
[ "public", "void", "writeBits", "(", "int", "b", ",", "int", "n", ")", "throws", "IOException", "{", "if", "(", "n", "<=", "capacity", ")", "{", "// all bits fit into the current buffer", "buffer", "=", "(", "buffer", "<<", "n", ")", "|", "(", "b", "&", ...
Write the n least significant bits of parameter b starting with the most significant, i.e. from left to right. @param b bits @param n number of bits @throws IOException IO exception
[ "Write", "the", "n", "least", "significant", "bits", "of", "parameter", "b", "starting", "with", "the", "most", "significant", "i", ".", "e", ".", "from", "left", "to", "right", "." ]
train
https://github.com/EXIficient/exificient-core/blob/b6026c5fd39e9cc3d7874caa20f084e264e0ddc7/src/main/java/com/siemens/ct/exi/core/io/BitOutputStream.java#L202-L232
LearnLib/automatalib
commons/util/src/main/java/net/automatalib/commons/util/process/ProcessUtil.java
ProcessUtil.invokeProcess
public static int invokeProcess(String[] commandLine, Consumer<String> consumer) throws IOException, InterruptedException { return invokeProcess(commandLine, null, new DelegatingConsumer(consumer)); }
java
public static int invokeProcess(String[] commandLine, Consumer<String> consumer) throws IOException, InterruptedException { return invokeProcess(commandLine, null, new DelegatingConsumer(consumer)); }
[ "public", "static", "int", "invokeProcess", "(", "String", "[", "]", "commandLine", ",", "Consumer", "<", "String", ">", "consumer", ")", "throws", "IOException", ",", "InterruptedException", "{", "return", "invokeProcess", "(", "commandLine", ",", "null", ",", ...
Runs the given set of command line arguments as a system process and returns the exit value of the spawned process. Outputs of the process (both normal and error) are passed to the {@code consumer}. @param commandLine the list of command line arguments to run @param consumer the consumer for the program's output @return the exit code of the process @throws IOException if an exception occurred while reading the process' outputs @throws InterruptedException if an exception occurred during process exception
[ "Runs", "the", "given", "set", "of", "command", "line", "arguments", "as", "a", "system", "process", "and", "returns", "the", "exit", "value", "of", "the", "spawned", "process", ".", "Outputs", "of", "the", "process", "(", "both", "normal", "and", "error",...
train
https://github.com/LearnLib/automatalib/blob/8a462ec52f6eaab9f8996e344f2163a72cb8aa6e/commons/util/src/main/java/net/automatalib/commons/util/process/ProcessUtil.java#L98-L101
Azure/azure-sdk-for-java
appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServicePlansInner.java
AppServicePlansInner.listHybridConnectionsWithServiceResponseAsync
public Observable<ServiceResponse<Page<HybridConnectionInner>>> listHybridConnectionsWithServiceResponseAsync(final String resourceGroupName, final String name) { return listHybridConnectionsSinglePageAsync(resourceGroupName, name) .concatMap(new Func1<ServiceResponse<Page<HybridConnectionInner>>, Observable<ServiceResponse<Page<HybridConnectionInner>>>>() { @Override public Observable<ServiceResponse<Page<HybridConnectionInner>>> call(ServiceResponse<Page<HybridConnectionInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listHybridConnectionsNextWithServiceResponseAsync(nextPageLink)); } }); }
java
public Observable<ServiceResponse<Page<HybridConnectionInner>>> listHybridConnectionsWithServiceResponseAsync(final String resourceGroupName, final String name) { return listHybridConnectionsSinglePageAsync(resourceGroupName, name) .concatMap(new Func1<ServiceResponse<Page<HybridConnectionInner>>, Observable<ServiceResponse<Page<HybridConnectionInner>>>>() { @Override public Observable<ServiceResponse<Page<HybridConnectionInner>>> call(ServiceResponse<Page<HybridConnectionInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listHybridConnectionsNextWithServiceResponseAsync(nextPageLink)); } }); }
[ "public", "Observable", "<", "ServiceResponse", "<", "Page", "<", "HybridConnectionInner", ">", ">", ">", "listHybridConnectionsWithServiceResponseAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "name", ")", "{", "return", "listHybridConnect...
Retrieve all Hybrid Connections in use in an App Service plan. Retrieve all Hybrid Connections in use in an App Service plan. @param resourceGroupName Name of the resource group to which the resource belongs. @param name Name of the App Service plan. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;HybridConnectionInner&gt; object
[ "Retrieve", "all", "Hybrid", "Connections", "in", "use", "in", "an", "App", "Service", "plan", ".", "Retrieve", "all", "Hybrid", "Connections", "in", "use", "in", "an", "App", "Service", "plan", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServicePlansInner.java#L1739-L1751
petergeneric/stdlib
stdlib/src/main/java/com/peterphi/std/types/Timecode.java
Timecode.getInstance
@Deprecated public static final Timecode getInstance(long frameNumber, boolean dropFrame, Timebase timebase, boolean supportDays) { final Timecode timecode = getInstance(frameNumber, dropFrame, timebase); if (!supportDays && timecode.getDaysPart() != 0) { throw new IllegalArgumentException("supportDays disabled but resulting timecode had a days component: " + timecode.toEncodedString()); } else { return timecode; } }
java
@Deprecated public static final Timecode getInstance(long frameNumber, boolean dropFrame, Timebase timebase, boolean supportDays) { final Timecode timecode = getInstance(frameNumber, dropFrame, timebase); if (!supportDays && timecode.getDaysPart() != 0) { throw new IllegalArgumentException("supportDays disabled but resulting timecode had a days component: " + timecode.toEncodedString()); } else { return timecode; } }
[ "@", "Deprecated", "public", "static", "final", "Timecode", "getInstance", "(", "long", "frameNumber", ",", "boolean", "dropFrame", ",", "Timebase", "timebase", ",", "boolean", "supportDays", ")", "{", "final", "Timecode", "timecode", "=", "getInstance", "(", "f...
@param frameNumber the frame offset from zero @param dropFrame set to true to indicate that the frame-rate excludes dropframes (keep false for PAL) @param timebase the timebase @param supportDays true if the resulting Timecode may use the days field (default false) @return a timecode representation of the given data, null when a timecode can not be generated (i.e. duration exceeds a day) @deprecated use method without supportDays
[ "@param", "frameNumber", "the", "frame", "offset", "from", "zero", "@param", "dropFrame", "set", "to", "true", "to", "indicate", "that", "the", "frame", "-", "rate", "excludes", "dropframes", "(", "keep", "false", "for", "PAL", ")", "@param", "timebase", "th...
train
https://github.com/petergeneric/stdlib/blob/d4025d2f881bc0542b1e004c5f65a1ccaf895836/stdlib/src/main/java/com/peterphi/std/types/Timecode.java#L880-L894
oboehm/jfachwert
src/main/java/de/jfachwert/pruefung/NumberValidator.java
NumberValidator.validate
@Override public String validate(String value) { String normalized = normalize(value); try { BigDecimal n = new BigDecimal(normalized); if (range.contains(n)) { return normalized; } } catch (NumberFormatException ex) { throw new InvalidValueException(value, NUMBER, ex); } throw new InvalidValueException(value, NUMBER, range); }
java
@Override public String validate(String value) { String normalized = normalize(value); try { BigDecimal n = new BigDecimal(normalized); if (range.contains(n)) { return normalized; } } catch (NumberFormatException ex) { throw new InvalidValueException(value, NUMBER, ex); } throw new InvalidValueException(value, NUMBER, range); }
[ "@", "Override", "public", "String", "validate", "(", "String", "value", ")", "{", "String", "normalized", "=", "normalize", "(", "value", ")", ";", "try", "{", "BigDecimal", "n", "=", "new", "BigDecimal", "(", "normalized", ")", ";", "if", "(", "range",...
Wenn der uebergebene Wert gueltig ist, soll er unveraendert zurueckgegeben werden, damit er anschliessend von der aufrufenden Methode weiterverarbeitet werden kann. Ist der Wert nicht gueltig, soll eine {@link ValidationException} geworfen werden. @param value Wert, der validiert werden soll @return Wert selber, wenn er gueltig ist
[ "Wenn", "der", "uebergebene", "Wert", "gueltig", "ist", "soll", "er", "unveraendert", "zurueckgegeben", "werden", "damit", "er", "anschliessend", "von", "der", "aufrufenden", "Methode", "weiterverarbeitet", "werden", "kann", ".", "Ist", "der", "Wert", "nicht", "gu...
train
https://github.com/oboehm/jfachwert/blob/67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b/src/main/java/de/jfachwert/pruefung/NumberValidator.java#L83-L95
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/alg/geo/MultiViewOps.java
MultiViewOps.extractEpipoles
public static void extractEpipoles( DMatrixRMaj F , Point3D_F64 e1 , Point3D_F64 e2 ) { FundamentalExtractEpipoles alg = new FundamentalExtractEpipoles(); alg.process(F,e1,e2); }
java
public static void extractEpipoles( DMatrixRMaj F , Point3D_F64 e1 , Point3D_F64 e2 ) { FundamentalExtractEpipoles alg = new FundamentalExtractEpipoles(); alg.process(F,e1,e2); }
[ "public", "static", "void", "extractEpipoles", "(", "DMatrixRMaj", "F", ",", "Point3D_F64", "e1", ",", "Point3D_F64", "e2", ")", "{", "FundamentalExtractEpipoles", "alg", "=", "new", "FundamentalExtractEpipoles", "(", ")", ";", "alg", ".", "process", "(", "F", ...
<p> Extracts the epipoles from an essential or fundamental matrix. The epipoles are extracted from the left and right null space of the provided matrix. Note that the found epipoles are in homogeneous coordinates. If the epipole is at infinity then z=0 </p> <p> Left: e<sub>2</sub><sup>T</sup>*F = 0 <br> Right: F*e<sub>1</sub> = 0 </p> @param F Input: Fundamental or Essential 3x3 matrix. Not modified. @param e1 Output: Right epipole in homogeneous coordinates. Can be null. Modified. @param e2 Output: Left epipole in homogeneous coordinates. Can be null. Modified.
[ "<p", ">", "Extracts", "the", "epipoles", "from", "an", "essential", "or", "fundamental", "matrix", ".", "The", "epipoles", "are", "extracted", "from", "the", "left", "and", "right", "null", "space", "of", "the", "provided", "matrix", ".", "Note", "that", ...
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/MultiViewOps.java#L842-L845
ops4j/org.ops4j.pax.logging
pax-logging-api/src/main/java/org/apache/logging/log4j/status/StatusData.java
StatusData.getFormattedStatus
public String getFormattedStatus() { final StringBuilder sb = new StringBuilder(); final SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss,SSS"); sb.append(format.format(new Date(timestamp))); sb.append(SPACE); sb.append(getThreadName()); sb.append(SPACE); sb.append(level.toString()); sb.append(SPACE); sb.append(msg.getFormattedMessage()); final Object[] params = msg.getParameters(); Throwable t; if (throwable == null && params != null && params[params.length - 1] instanceof Throwable) { t = (Throwable) params[params.length - 1]; } else { t = throwable; } if (t != null) { sb.append(SPACE); final ByteArrayOutputStream baos = new ByteArrayOutputStream(); t.printStackTrace(new PrintStream(baos)); sb.append(baos.toString()); } return sb.toString(); }
java
public String getFormattedStatus() { final StringBuilder sb = new StringBuilder(); final SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss,SSS"); sb.append(format.format(new Date(timestamp))); sb.append(SPACE); sb.append(getThreadName()); sb.append(SPACE); sb.append(level.toString()); sb.append(SPACE); sb.append(msg.getFormattedMessage()); final Object[] params = msg.getParameters(); Throwable t; if (throwable == null && params != null && params[params.length - 1] instanceof Throwable) { t = (Throwable) params[params.length - 1]; } else { t = throwable; } if (t != null) { sb.append(SPACE); final ByteArrayOutputStream baos = new ByteArrayOutputStream(); t.printStackTrace(new PrintStream(baos)); sb.append(baos.toString()); } return sb.toString(); }
[ "public", "String", "getFormattedStatus", "(", ")", "{", "final", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "final", "SimpleDateFormat", "format", "=", "new", "SimpleDateFormat", "(", "\"yyyy-MM-dd HH:mm:ss,SSS\"", ")", ";", "sb", ".", "...
Formats the StatusData for viewing. @return The formatted status data as a String.
[ "Formats", "the", "StatusData", "for", "viewing", "." ]
train
https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/apache/logging/log4j/status/StatusData.java#L120-L144
looly/hutool
hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java
ImgUtil.convert
@Deprecated public static void convert(Image srcImage, String formatName, ImageOutputStream destImageStream) { convert(srcImage, formatName, destImageStream, false); }
java
@Deprecated public static void convert(Image srcImage, String formatName, ImageOutputStream destImageStream) { convert(srcImage, formatName, destImageStream, false); }
[ "@", "Deprecated", "public", "static", "void", "convert", "(", "Image", "srcImage", ",", "String", "formatName", ",", "ImageOutputStream", "destImageStream", ")", "{", "convert", "(", "srcImage", ",", "formatName", ",", "destImageStream", ",", "false", ")", ";",...
图像类型转换:GIF=》JPG、GIF=》PNG、PNG=》JPG、PNG=》GIF(X)、BMP=》PNG<br> 此方法并不关闭流 @param srcImage 源图像流 @param formatName 包含格式非正式名称的 String:如JPG、JPEG、GIF等 @param destImageStream 目标图像输出流 @since 3.0.9 @deprecated 请使用{@link #write(Image, String, ImageOutputStream)}
[ "图像类型转换:GIF", "=", "》JPG、GIF", "=", "》PNG、PNG", "=", "》JPG、PNG", "=", "》GIF", "(", "X", ")", "、BMP", "=", "》PNG<br", ">", "此方法并不关闭流" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L550-L553
alkacon/opencms-core
src/org/opencms/jsp/decorator/CmsDecorationObject.java
CmsDecorationObject.replaceMacros
private String replaceMacros(String msg, String contentLocale) { CmsMacroResolver resolver = CmsMacroResolver.newInstance(); resolver.addMacro(MACRO_DECORATION, m_decoration); resolver.addMacro(MACRO_DECORATIONKEY, m_decorationKey); if (m_locale != null) { resolver.addMacro(MACRO_LOCALE, m_locale.toString()); if (!contentLocale.equals(m_locale.toString())) { resolver.addMacro(MACRO_LANGUAGE, "lang=\"" + m_locale.toString() + "\""); } } return resolver.resolveMacros(msg); }
java
private String replaceMacros(String msg, String contentLocale) { CmsMacroResolver resolver = CmsMacroResolver.newInstance(); resolver.addMacro(MACRO_DECORATION, m_decoration); resolver.addMacro(MACRO_DECORATIONKEY, m_decorationKey); if (m_locale != null) { resolver.addMacro(MACRO_LOCALE, m_locale.toString()); if (!contentLocale.equals(m_locale.toString())) { resolver.addMacro(MACRO_LANGUAGE, "lang=\"" + m_locale.toString() + "\""); } } return resolver.resolveMacros(msg); }
[ "private", "String", "replaceMacros", "(", "String", "msg", ",", "String", "contentLocale", ")", "{", "CmsMacroResolver", "resolver", "=", "CmsMacroResolver", ".", "newInstance", "(", ")", ";", "resolver", ".", "addMacro", "(", "MACRO_DECORATION", ",", "m_decorati...
Replaces the macros in the given message.<p> @param msg the message in which the macros are replaced @param contentLocale the locale of the content that is currently decorated @return the message with the macros replaced
[ "Replaces", "the", "macros", "in", "the", "given", "message", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/decorator/CmsDecorationObject.java#L185-L198
jpaoletti/java-presentation-manager
modules/jpm-core/src/main/java/jpaoletti/jpm/converter/Converter.java
Converter.getNestedProperty
public Object getNestedProperty(Object obj, String propertyName) { if (obj != null && propertyName != null) { return PresentationManager.getPm().get(obj, propertyName); } return null; }
java
public Object getNestedProperty(Object obj, String propertyName) { if (obj != null && propertyName != null) { return PresentationManager.getPm().get(obj, propertyName); } return null; }
[ "public", "Object", "getNestedProperty", "(", "Object", "obj", ",", "String", "propertyName", ")", "{", "if", "(", "obj", "!=", "null", "&&", "propertyName", "!=", "null", ")", "{", "return", "PresentationManager", ".", "getPm", "(", ")", ".", "get", "(", ...
Getter for a nested property in the given object. @param obj The object @param propertyName The name of the property to get @return The property value
[ "Getter", "for", "a", "nested", "property", "in", "the", "given", "object", "." ]
train
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/converter/Converter.java#L111-L116
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/Frame.java
Frame.getArgument
public ValueType getArgument(InvokeInstruction ins, ConstantPoolGen cpg, int i, SignatureParser sigParser) throws DataflowAnalysisException { if (i >= sigParser.getNumParameters()) { throw new IllegalArgumentException("requesting parameter # " + i + " of " + sigParser); } return getStackValue(sigParser.getSlotsFromTopOfStackForParameter(i)); }
java
public ValueType getArgument(InvokeInstruction ins, ConstantPoolGen cpg, int i, SignatureParser sigParser) throws DataflowAnalysisException { if (i >= sigParser.getNumParameters()) { throw new IllegalArgumentException("requesting parameter # " + i + " of " + sigParser); } return getStackValue(sigParser.getSlotsFromTopOfStackForParameter(i)); }
[ "public", "ValueType", "getArgument", "(", "InvokeInstruction", "ins", ",", "ConstantPoolGen", "cpg", ",", "int", "i", ",", "SignatureParser", "sigParser", ")", "throws", "DataflowAnalysisException", "{", "if", "(", "i", ">=", "sigParser", ".", "getNumParameters", ...
Get the <i>i</i>th argument passed to given method invocation. @param ins the method invocation instruction @param cpg the ConstantPoolGen for the class containing the method @param i index of the argument; 0 for the first argument, etc. @return the <i>i</i>th argument @throws DataflowAnalysisException
[ "Get", "the", "<i", ">", "i<", "/", "i", ">", "th", "argument", "passed", "to", "given", "method", "invocation", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/Frame.java#L406-L412
Azure/azure-sdk-for-java
common/azure-common/src/main/java/com/azure/common/implementation/util/TypeUtil.java
TypeUtil.getSuperType
public static Type getSuperType(Type subType, Class<?> rawSuperType) { while (subType != null && getRawClass(subType) != rawSuperType) { subType = getSuperType(subType); } return subType; }
java
public static Type getSuperType(Type subType, Class<?> rawSuperType) { while (subType != null && getRawClass(subType) != rawSuperType) { subType = getSuperType(subType); } return subType; }
[ "public", "static", "Type", "getSuperType", "(", "Type", "subType", ",", "Class", "<", "?", ">", "rawSuperType", ")", "{", "while", "(", "subType", "!=", "null", "&&", "getRawClass", "(", "subType", ")", "!=", "rawSuperType", ")", "{", "subType", "=", "g...
Get the super type for a type in its super type chain, which has a raw class that matches the specified class. @param subType the sub type to find super type for @param rawSuperType the raw class for the super type @return the super type that matches the requirement
[ "Get", "the", "super", "type", "for", "a", "type", "in", "its", "super", "type", "chain", "which", "has", "a", "raw", "class", "that", "matches", "the", "specified", "class", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/common/azure-common/src/main/java/com/azure/common/implementation/util/TypeUtil.java#L126-L131
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/internal/partition/impl/PartitionReplicaManager.java
PartitionReplicaManager.triggerPartitionReplicaSync
public void triggerPartitionReplicaSync(int partitionId, Collection<ServiceNamespace> namespaces, int replicaIndex) { assert replicaIndex >= 0 && replicaIndex < InternalPartition.MAX_REPLICA_COUNT : "Invalid replica index! partitionId=" + partitionId + ", replicaIndex=" + replicaIndex; PartitionReplica target = checkAndGetPrimaryReplicaOwner(partitionId, replicaIndex); if (target == null) { return; } if (!partitionService.areMigrationTasksAllowed()) { logger.finest("Cannot send sync replica request for partitionId=" + partitionId + ", replicaIndex=" + replicaIndex + ", namespaces=" + namespaces + ". Sync is not allowed."); return; } InternalPartitionImpl partition = partitionStateManager.getPartitionImpl(partitionId); if (partition.isMigrating()) { logger.finest("Cannot send sync replica request for partitionId=" + partitionId + ", replicaIndex=" + replicaIndex + ", namespaces=" + namespaces + ". Partition is already migrating."); return; } sendSyncReplicaRequest(partitionId, namespaces, replicaIndex, target); }
java
public void triggerPartitionReplicaSync(int partitionId, Collection<ServiceNamespace> namespaces, int replicaIndex) { assert replicaIndex >= 0 && replicaIndex < InternalPartition.MAX_REPLICA_COUNT : "Invalid replica index! partitionId=" + partitionId + ", replicaIndex=" + replicaIndex; PartitionReplica target = checkAndGetPrimaryReplicaOwner(partitionId, replicaIndex); if (target == null) { return; } if (!partitionService.areMigrationTasksAllowed()) { logger.finest("Cannot send sync replica request for partitionId=" + partitionId + ", replicaIndex=" + replicaIndex + ", namespaces=" + namespaces + ". Sync is not allowed."); return; } InternalPartitionImpl partition = partitionStateManager.getPartitionImpl(partitionId); if (partition.isMigrating()) { logger.finest("Cannot send sync replica request for partitionId=" + partitionId + ", replicaIndex=" + replicaIndex + ", namespaces=" + namespaces + ". Partition is already migrating."); return; } sendSyncReplicaRequest(partitionId, namespaces, replicaIndex, target); }
[ "public", "void", "triggerPartitionReplicaSync", "(", "int", "partitionId", ",", "Collection", "<", "ServiceNamespace", ">", "namespaces", ",", "int", "replicaIndex", ")", "{", "assert", "replicaIndex", ">=", "0", "&&", "replicaIndex", "<", "InternalPartition", ".",...
This method is called on a backup node (replica). Given all conditions are satisfied, this method initiates a replica sync operation and registers it to replicaSyncRequest. The operation is scheduled for a future execution if : <ul> <li>the {@code delayMillis} is greater than 0</li> <li>if a migration is not allowed (during repartitioning or a node joining the cluster)</li> <li>the partition is currently migrating</li> <li>another sync request has already been sent</li> <li>the maximum number of parallel synchronizations has already been reached</li> </ul> @param partitionId the partition which is being synchronized @param namespaces namespaces of partition replica fragments @param replicaIndex the index of the replica which is being synchronized @throws IllegalArgumentException if the replica index is not between 0 and {@link InternalPartition#MAX_REPLICA_COUNT}
[ "This", "method", "is", "called", "on", "a", "backup", "node", "(", "replica", ")", ".", "Given", "all", "conditions", "are", "satisfied", "this", "method", "initiates", "a", "replica", "sync", "operation", "and", "registers", "it", "to", "replicaSyncRequest",...
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/partition/impl/PartitionReplicaManager.java#L134-L157
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/doclets/formats/html/AbstractIndexWriter.java
AbstractIndexWriter.addDescription
protected void addDescription(ClassDoc cd, Content dlTree) { Content link = getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.INDEX, cd).strong(true)); Content dt = HtmlTree.DT(link); dt.addContent(" - "); addClassInfo(cd, dt); dlTree.addContent(dt); Content dd = new HtmlTree(HtmlTag.DD); addComment(cd, dd); dlTree.addContent(dd); }
java
protected void addDescription(ClassDoc cd, Content dlTree) { Content link = getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.INDEX, cd).strong(true)); Content dt = HtmlTree.DT(link); dt.addContent(" - "); addClassInfo(cd, dt); dlTree.addContent(dt); Content dd = new HtmlTree(HtmlTag.DD); addComment(cd, dd); dlTree.addContent(dd); }
[ "protected", "void", "addDescription", "(", "ClassDoc", "cd", ",", "Content", "dlTree", ")", "{", "Content", "link", "=", "getLink", "(", "new", "LinkInfoImpl", "(", "configuration", ",", "LinkInfoImpl", ".", "Kind", ".", "INDEX", ",", "cd", ")", ".", "str...
Add one line summary comment for the class. @param cd the class being documented @param dlTree the content tree to which the description will be added
[ "Add", "one", "line", "summary", "comment", "for", "the", "class", "." ]
train
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/doclets/formats/html/AbstractIndexWriter.java#L142-L152
eclipse/xtext-lib
org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/CharacterExtensions.java
CharacterExtensions.operator_notEquals
@Pure @Inline(value="($1 != $2)", constantExpression=true) public static boolean operator_notEquals(char a, int b) { return a != b; }
java
@Pure @Inline(value="($1 != $2)", constantExpression=true) public static boolean operator_notEquals(char a, int b) { return a != b; }
[ "@", "Pure", "@", "Inline", "(", "value", "=", "\"($1 != $2)\"", ",", "constantExpression", "=", "true", ")", "public", "static", "boolean", "operator_notEquals", "(", "char", "a", ",", "int", "b", ")", "{", "return", "a", "!=", "b", ";", "}" ]
The binary <code>notEquals</code> operator. This is the equivalent to the Java <code>!=</code> operator. @param a a character. @param b an integer. @return <code>a!=b</code> @since 2.3
[ "The", "binary", "<code", ">", "notEquals<", "/", "code", ">", "operator", ".", "This", "is", "the", "equivalent", "to", "the", "Java", "<code", ">", "!", "=", "<", "/", "code", ">", "operator", "." ]
train
https://github.com/eclipse/xtext-lib/blob/7063572e1f1bd713a3aa53bdf3a8dc60e25c169a/org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/CharacterExtensions.java#L823-L827
stripe/stripe-java
src/main/java/com/stripe/net/OAuth.java
OAuth.authorizeUrl
public static String authorizeUrl(Map<String, Object> params, RequestOptions options) throws AuthenticationException, InvalidRequestException { final String base = Stripe.getConnectBase(); params.put("client_id", getClientId(params, options)); if (params.get("response_type") == null) { params.put("response_type", "code"); } String query; try { query = LiveStripeResponseGetter.createQuery(params); } catch (UnsupportedEncodingException e) { throw new InvalidRequestException("Unable to encode parameters to " + ApiResource.CHARSET + ". Please contact support@stripe.com for assistance.", null, null, null, 0, e); } String url = base + "/oauth/authorize?" + query; return url; }
java
public static String authorizeUrl(Map<String, Object> params, RequestOptions options) throws AuthenticationException, InvalidRequestException { final String base = Stripe.getConnectBase(); params.put("client_id", getClientId(params, options)); if (params.get("response_type") == null) { params.put("response_type", "code"); } String query; try { query = LiveStripeResponseGetter.createQuery(params); } catch (UnsupportedEncodingException e) { throw new InvalidRequestException("Unable to encode parameters to " + ApiResource.CHARSET + ". Please contact support@stripe.com for assistance.", null, null, null, 0, e); } String url = base + "/oauth/authorize?" + query; return url; }
[ "public", "static", "String", "authorizeUrl", "(", "Map", "<", "String", ",", "Object", ">", "params", ",", "RequestOptions", "options", ")", "throws", "AuthenticationException", ",", "InvalidRequestException", "{", "final", "String", "base", "=", "Stripe", ".", ...
Generates a URL to Stripe's OAuth form. @param params the parameters to include in the URL. @param options the request options. @return the URL to Stripe's OAuth form.
[ "Generates", "a", "URL", "to", "Stripe", "s", "OAuth", "form", "." ]
train
https://github.com/stripe/stripe-java/blob/acfa8becef3e73bfe3e9d8880bea3f3f30dadeac/src/main/java/com/stripe/net/OAuth.java#L27-L47
jdereg/java-util
src/main/java/com/cedarsoftware/util/DeepEquals.java
DeepEquals.compareOrderedCollection
private static boolean compareOrderedCollection(Collection col1, Collection col2, Deque stack, Set visited) { // Same instance check already performed... if (col1.size() != col2.size()) { return false; } Iterator i1 = col1.iterator(); Iterator i2 = col2.iterator(); while (i1.hasNext()) { DualKey dk = new DualKey(i1.next(), i2.next()); if (!visited.contains(dk)) { // push contents for further comparison stack.addFirst(dk); } } return true; }
java
private static boolean compareOrderedCollection(Collection col1, Collection col2, Deque stack, Set visited) { // Same instance check already performed... if (col1.size() != col2.size()) { return false; } Iterator i1 = col1.iterator(); Iterator i2 = col2.iterator(); while (i1.hasNext()) { DualKey dk = new DualKey(i1.next(), i2.next()); if (!visited.contains(dk)) { // push contents for further comparison stack.addFirst(dk); } } return true; }
[ "private", "static", "boolean", "compareOrderedCollection", "(", "Collection", "col1", ",", "Collection", "col2", ",", "Deque", "stack", ",", "Set", "visited", ")", "{", "// Same instance check already performed...", "if", "(", "col1", ".", "size", "(", ")", "!=",...
Deeply compare two Collections that must be same length and in same order. @param col1 First collection of items to compare @param col2 Second collection of items to compare @param stack add items to compare to the Stack (Stack versus recursion) @param visited Set of objects already compared (prevents cycles) value of 'true' indicates that the Collections may be equal, and the sets items will be added to the Stack for further comparison.
[ "Deeply", "compare", "two", "Collections", "that", "must", "be", "same", "length", "and", "in", "same", "order", "." ]
train
https://github.com/jdereg/java-util/blob/a2dce61aed16d6454ee575174dda1ba6bff0015c/src/main/java/com/cedarsoftware/util/DeepEquals.java#L411-L432
alkacon/opencms-core
src-gwt/org/opencms/ade/containerpage/client/CmsContainerpageController.java
CmsContainerpageController.replaceElement
public void replaceElement(final CmsContainerPageElementPanel elementWidget, final String elementId) { final CmsRpcAction<CmsContainerElementData> action = new CmsRpcAction<CmsContainerElementData>() { @Override public void execute() { start(500, true); getContainerpageService().replaceElement( getData().getRpcContext(), getData().getDetailId(), getRequestParams(), elementWidget.getId(), elementId, getPageState(), getLocale(), this); } @Override protected void onResponse(CmsContainerElementData result) { stop(false); if (result != null) { // cache the loaded element m_elements.put(result.getClientId(), result); try { replaceContainerElement(elementWidget, result); resetEditButtons(); addToRecentList(result.getClientId(), null); setPageChanged(new Runnable() { public void run() { // nothing to do } }); } catch (Exception e) { // should never happen CmsDebugLog.getInstance().printLine(e.getLocalizedMessage()); } } } }; if (!isGroupcontainerEditing()) { lockContainerpage(new I_CmsSimpleCallback<Boolean>() { public void execute(Boolean arg) { if (arg.booleanValue()) { action.execute(); } } }); } else { action.execute(); } }
java
public void replaceElement(final CmsContainerPageElementPanel elementWidget, final String elementId) { final CmsRpcAction<CmsContainerElementData> action = new CmsRpcAction<CmsContainerElementData>() { @Override public void execute() { start(500, true); getContainerpageService().replaceElement( getData().getRpcContext(), getData().getDetailId(), getRequestParams(), elementWidget.getId(), elementId, getPageState(), getLocale(), this); } @Override protected void onResponse(CmsContainerElementData result) { stop(false); if (result != null) { // cache the loaded element m_elements.put(result.getClientId(), result); try { replaceContainerElement(elementWidget, result); resetEditButtons(); addToRecentList(result.getClientId(), null); setPageChanged(new Runnable() { public void run() { // nothing to do } }); } catch (Exception e) { // should never happen CmsDebugLog.getInstance().printLine(e.getLocalizedMessage()); } } } }; if (!isGroupcontainerEditing()) { lockContainerpage(new I_CmsSimpleCallback<Boolean>() { public void execute(Boolean arg) { if (arg.booleanValue()) { action.execute(); } } }); } else { action.execute(); } }
[ "public", "void", "replaceElement", "(", "final", "CmsContainerPageElementPanel", "elementWidget", ",", "final", "String", "elementId", ")", "{", "final", "CmsRpcAction", "<", "CmsContainerElementData", ">", "action", "=", "new", "CmsRpcAction", "<", "CmsContainerElemen...
Replaces the given element with another content while keeping it's settings.<p> @param elementWidget the element to replace @param elementId the id of the replacing content
[ "Replaces", "the", "given", "element", "with", "another", "content", "while", "keeping", "it", "s", "settings", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/containerpage/client/CmsContainerpageController.java#L2753-L2815
wildfly/wildfly-core
controller/src/main/java/org/jboss/as/controller/AccessAuditContext.java
AccessAuditContext.doAs
public static <T> T doAs(final SecurityIdentity securityIdentity, final InetAddress remoteAddress, final PrivilegedAction<T> action) { return doAs(false, securityIdentity, remoteAddress, action); }
java
public static <T> T doAs(final SecurityIdentity securityIdentity, final InetAddress remoteAddress, final PrivilegedAction<T> action) { return doAs(false, securityIdentity, remoteAddress, action); }
[ "public", "static", "<", "T", ">", "T", "doAs", "(", "final", "SecurityIdentity", "securityIdentity", ",", "final", "InetAddress", "remoteAddress", ",", "final", "PrivilegedAction", "<", "T", ">", "action", ")", "{", "return", "doAs", "(", "false", ",", "sec...
Perform work with a new {@code AccessAuditContext} as a particular {@code SecurityIdentity} @param securityIdentity the {@code SecurityIdentity} that the specified {@code action} will run as. May be {@code null} @param remoteAddress the remote address of the caller. @param action the work to perform. Cannot be {@code null} @param <T> the type of teh return value @return the value returned by the PrivilegedAction's <code>run</code> method @exception NullPointerException if the specified <code>PrivilegedExceptionAction</code> is <code>null</code>. @exception SecurityException if the caller does not have permission to invoke this method.
[ "Perform", "work", "with", "a", "new", "{", "@code", "AccessAuditContext", "}", "as", "a", "particular", "{", "@code", "SecurityIdentity", "}", "@param", "securityIdentity", "the", "{", "@code", "SecurityIdentity", "}", "that", "the", "specified", "{", "@code", ...
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/AccessAuditContext.java#L174-L176
Breinify/brein-time-utilities
src/com/brein/time/timeseries/BucketTimeSeries.java
BucketTimeSeries.normalizeUnixTimeStamp
public BucketEndPoints normalizeUnixTimeStamp(final long unixTimeStamp) { final TimeUnit timeUnit = config.getTimeUnit(); // first get the time stamp in the unit of the time-series final long timeStamp = timeUnit.convert(unixTimeStamp, TimeUnit.SECONDS); /* * Now lets, normalize the time stamp regarding to the bucketSize: * 1.) we need the size of a bucket * 2.) we need where the current time stamp is located within the size, * i.e., how much it reaches into the bucket (ratio => offset) * 3.) we use the calculated offset to determine the end points (in seconds) * * Example: * The time stamp 1002 (in minutes or seconds or ...?) should be mapped * to a normalized bucket, so the bucket would be, e.g., [1000, 1005). */ final int bucketSize = config.getBucketSize(); final long offset = timeStamp % bucketSize; final long start = timeStamp - offset; final long end = start + config.getBucketSize(); return new BucketEndPoints(TimeUnit.SECONDS.convert(start, timeUnit), TimeUnit.SECONDS.convert(end, timeUnit)); }
java
public BucketEndPoints normalizeUnixTimeStamp(final long unixTimeStamp) { final TimeUnit timeUnit = config.getTimeUnit(); // first get the time stamp in the unit of the time-series final long timeStamp = timeUnit.convert(unixTimeStamp, TimeUnit.SECONDS); /* * Now lets, normalize the time stamp regarding to the bucketSize: * 1.) we need the size of a bucket * 2.) we need where the current time stamp is located within the size, * i.e., how much it reaches into the bucket (ratio => offset) * 3.) we use the calculated offset to determine the end points (in seconds) * * Example: * The time stamp 1002 (in minutes or seconds or ...?) should be mapped * to a normalized bucket, so the bucket would be, e.g., [1000, 1005). */ final int bucketSize = config.getBucketSize(); final long offset = timeStamp % bucketSize; final long start = timeStamp - offset; final long end = start + config.getBucketSize(); return new BucketEndPoints(TimeUnit.SECONDS.convert(start, timeUnit), TimeUnit.SECONDS.convert(end, timeUnit)); }
[ "public", "BucketEndPoints", "normalizeUnixTimeStamp", "(", "final", "long", "unixTimeStamp", ")", "{", "final", "TimeUnit", "timeUnit", "=", "config", ".", "getTimeUnit", "(", ")", ";", "// first get the time stamp in the unit of the time-series", "final", "long", "timeS...
This method is used to determine the bucket the {@code unixTimeStamp} belongs into. The bucket is represented by a {@link BucketEndPoints} instance, which defines the end-points of the bucket and provides methods to calculate the distance between buckets. @param unixTimeStamp the time-stamp to determine the bucket for @return the bucket for the specified {@code unixTimeStamp} based on the configuration of the time-series
[ "This", "method", "is", "used", "to", "determine", "the", "bucket", "the", "{", "@code", "unixTimeStamp", "}", "belongs", "into", ".", "The", "bucket", "is", "represented", "by", "a", "{", "@link", "BucketEndPoints", "}", "instance", "which", "defines", "the...
train
https://github.com/Breinify/brein-time-utilities/blob/ec0165a50ec1951ec7730b72c85c801c2018f314/src/com/brein/time/timeseries/BucketTimeSeries.java#L367-L391
aspectran/aspectran
core/src/main/java/com/aspectran/core/context/rule/BeanMethodActionRule.java
BeanMethodActionRule.newInstance
public static BeanMethodActionRule newInstance(String id, String beanId, String methodName, Boolean hidden) throws IllegalRuleException { if (methodName == null) { throw new IllegalRuleException("The 'action' element requires an 'method' attribute"); } BeanMethodActionRule beanMethodActionRule = new BeanMethodActionRule(); beanMethodActionRule.setActionId(id); beanMethodActionRule.setBeanId(beanId); beanMethodActionRule.setMethodName(methodName); beanMethodActionRule.setHidden(hidden); return beanMethodActionRule; }
java
public static BeanMethodActionRule newInstance(String id, String beanId, String methodName, Boolean hidden) throws IllegalRuleException { if (methodName == null) { throw new IllegalRuleException("The 'action' element requires an 'method' attribute"); } BeanMethodActionRule beanMethodActionRule = new BeanMethodActionRule(); beanMethodActionRule.setActionId(id); beanMethodActionRule.setBeanId(beanId); beanMethodActionRule.setMethodName(methodName); beanMethodActionRule.setHidden(hidden); return beanMethodActionRule; }
[ "public", "static", "BeanMethodActionRule", "newInstance", "(", "String", "id", ",", "String", "beanId", ",", "String", "methodName", ",", "Boolean", "hidden", ")", "throws", "IllegalRuleException", "{", "if", "(", "methodName", "==", "null", ")", "{", "throw", ...
Returns a new instance of BeanActionRule. @param id the action id @param beanId the bean id @param methodName the method name @param hidden true if hiding the result of the action; false otherwise @return the bean method action rule @throws IllegalRuleException if an illegal rule is found
[ "Returns", "a", "new", "instance", "of", "BeanActionRule", "." ]
train
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/rule/BeanMethodActionRule.java#L274-L286
alexa/alexa-skills-kit-sdk-for-java
ask-sdk-core/src/com/amazon/ask/response/ResponseBuilder.java
ResponseBuilder.addConfirmSlotDirective
public ResponseBuilder addConfirmSlotDirective(String slotName, Intent updatedIntent) { ConfirmSlotDirective confirmSlotDirective = ConfirmSlotDirective.builder() .withSlotToConfirm(slotName) .withUpdatedIntent(updatedIntent) .build(); return addDirective(confirmSlotDirective); }
java
public ResponseBuilder addConfirmSlotDirective(String slotName, Intent updatedIntent) { ConfirmSlotDirective confirmSlotDirective = ConfirmSlotDirective.builder() .withSlotToConfirm(slotName) .withUpdatedIntent(updatedIntent) .build(); return addDirective(confirmSlotDirective); }
[ "public", "ResponseBuilder", "addConfirmSlotDirective", "(", "String", "slotName", ",", "Intent", "updatedIntent", ")", "{", "ConfirmSlotDirective", "confirmSlotDirective", "=", "ConfirmSlotDirective", ".", "builder", "(", ")", ".", "withSlotToConfirm", "(", "slotName", ...
Adds a Dialog {@link ConfirmSlotDirective} to the response. @param slotName name of slot to elicit @param updatedIntent updated intent @return response builder
[ "Adds", "a", "Dialog", "{", "@link", "ConfirmSlotDirective", "}", "to", "the", "response", "." ]
train
https://github.com/alexa/alexa-skills-kit-sdk-for-java/blob/c49194da0693898c70f3f2c4a372f5a12da04e3e/ask-sdk-core/src/com/amazon/ask/response/ResponseBuilder.java#L302-L308
netscaler/sdx_nitro
src/main/java/com/citrix/sdx/nitro/resource/config/br_broker/br_broker_snmpmanager.java
br_broker_snmpmanager.addmanager
public static br_broker_snmpmanager addmanager(nitro_service client, br_broker_snmpmanager resource) throws Exception { return ((br_broker_snmpmanager[]) resource.perform_operation(client, "addmanager"))[0]; }
java
public static br_broker_snmpmanager addmanager(nitro_service client, br_broker_snmpmanager resource) throws Exception { return ((br_broker_snmpmanager[]) resource.perform_operation(client, "addmanager"))[0]; }
[ "public", "static", "br_broker_snmpmanager", "addmanager", "(", "nitro_service", "client", ",", "br_broker_snmpmanager", "resource", ")", "throws", "Exception", "{", "return", "(", "(", "br_broker_snmpmanager", "[", "]", ")", "resource", ".", "perform_operation", "(",...
<pre> Use this operation to add snmp manager to Repeater. </pre>
[ "<pre", ">", "Use", "this", "operation", "to", "add", "snmp", "manager", "to", "Repeater", ".", "<", "/", "pre", ">" ]
train
https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/br_broker/br_broker_snmpmanager.java#L147-L150
spring-projects/spring-boot
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/MongoClientFactory.java
MongoClientFactory.createMongoClient
public MongoClient createMongoClient(MongoClientOptions options) { Integer embeddedPort = getEmbeddedPort(); if (embeddedPort != null) { return createEmbeddedMongoClient(options, embeddedPort); } return createNetworkMongoClient(options); }
java
public MongoClient createMongoClient(MongoClientOptions options) { Integer embeddedPort = getEmbeddedPort(); if (embeddedPort != null) { return createEmbeddedMongoClient(options, embeddedPort); } return createNetworkMongoClient(options); }
[ "public", "MongoClient", "createMongoClient", "(", "MongoClientOptions", "options", ")", "{", "Integer", "embeddedPort", "=", "getEmbeddedPort", "(", ")", ";", "if", "(", "embeddedPort", "!=", "null", ")", "{", "return", "createEmbeddedMongoClient", "(", "options", ...
Creates a {@link MongoClient} using the given {@code options}. If the environment contains a {@code local.mongo.port} property, it is used to configure a client to an embedded MongoDB instance. @param options the options @return the Mongo client
[ "Creates", "a", "{" ]
train
https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/MongoClientFactory.java#L62-L68
timols/java-gitlab-api
src/main/java/org/gitlab/api/GitlabAPI.java
GitlabAPI.getDiscussions
public List<GitlabDiscussion> getDiscussions(GitlabMergeRequest mergeRequest) throws IOException { String tailUrl = GitlabProject.URL + "/" + mergeRequest.getProjectId() + GitlabMergeRequest.URL + "/" + mergeRequest.getIid() + GitlabDiscussion.URL; GitlabDiscussion[] discussions = retrieve().to(tailUrl, GitlabDiscussion[].class); return Arrays.asList(discussions); }
java
public List<GitlabDiscussion> getDiscussions(GitlabMergeRequest mergeRequest) throws IOException { String tailUrl = GitlabProject.URL + "/" + mergeRequest.getProjectId() + GitlabMergeRequest.URL + "/" + mergeRequest.getIid() + GitlabDiscussion.URL; GitlabDiscussion[] discussions = retrieve().to(tailUrl, GitlabDiscussion[].class); return Arrays.asList(discussions); }
[ "public", "List", "<", "GitlabDiscussion", ">", "getDiscussions", "(", "GitlabMergeRequest", "mergeRequest", ")", "throws", "IOException", "{", "String", "tailUrl", "=", "GitlabProject", ".", "URL", "+", "\"/\"", "+", "mergeRequest", ".", "getProjectId", "(", ")",...
Get the discussions from a merge request. <a href="https://docs.gitlab.com/ce/api/discussions.html#list-project-merge-request-discussions">https://docs.gitlab.com/ce/api/discussions.html#list-project-merge-request-discussions</a> @param mergeRequest to fetch the discussions from. @return The discussions contained in the given merge request. @throws IOException on a GitLab api call error
[ "Get", "the", "discussions", "from", "a", "merge", "request", ".", "<a", "href", "=", "https", ":", "//", "docs", ".", "gitlab", ".", "com", "/", "ce", "/", "api", "/", "discussions", ".", "html#list", "-", "project", "-", "merge", "-", "request", "-...
train
https://github.com/timols/java-gitlab-api/blob/f03eedf952cfbb40306be3bf9234dcf78fab029e/src/main/java/org/gitlab/api/GitlabAPI.java#L1729-L1736
offbynull/coroutines
instrumenter/src/main/java/com/offbynull/coroutines/instrumenter/generators/GenericGenerators.java
GenericGenerators.addIntegers
public static InsnList addIntegers(InsnList lhs, InsnList rhs) { Validate.notNull(lhs); Validate.notNull(rhs); InsnList ret = new InsnList(); ret.add(lhs); ret.add(rhs); ret.add(new InsnNode(Opcodes.IADD)); return ret; }
java
public static InsnList addIntegers(InsnList lhs, InsnList rhs) { Validate.notNull(lhs); Validate.notNull(rhs); InsnList ret = new InsnList(); ret.add(lhs); ret.add(rhs); ret.add(new InsnNode(Opcodes.IADD)); return ret; }
[ "public", "static", "InsnList", "addIntegers", "(", "InsnList", "lhs", ",", "InsnList", "rhs", ")", "{", "Validate", ".", "notNull", "(", "lhs", ")", ";", "Validate", ".", "notNull", "(", "rhs", ")", ";", "InsnList", "ret", "=", "new", "InsnList", "(", ...
Adds two integers together and puts the result on to the stack. @param lhs instructions to generate the first operand -- must leave an int on the stack @param rhs instructions to generate the second operand -- must leave an int on the stack @return instructions to add the two numbers together -- will leave an int on the stack @throws NullPointerException if any argument is {@code null}
[ "Adds", "two", "integers", "together", "and", "puts", "the", "result", "on", "to", "the", "stack", "." ]
train
https://github.com/offbynull/coroutines/blob/b1b83c293945f53a2f63fca8f15a53e88b796bf5/instrumenter/src/main/java/com/offbynull/coroutines/instrumenter/generators/GenericGenerators.java#L568-L579
reactor/reactor-netty
src/main/java/reactor/netty/tcp/SslProvider.java
SslProvider.addHandlerConfigurator
public static SslProvider addHandlerConfigurator( SslProvider provider, Consumer<? super SslHandler> handlerConfigurator) { Objects.requireNonNull(provider, "provider"); Objects.requireNonNull(handlerConfigurator, "handlerConfigurator"); return new SslProvider(provider, handlerConfigurator); }
java
public static SslProvider addHandlerConfigurator( SslProvider provider, Consumer<? super SslHandler> handlerConfigurator) { Objects.requireNonNull(provider, "provider"); Objects.requireNonNull(handlerConfigurator, "handlerConfigurator"); return new SslProvider(provider, handlerConfigurator); }
[ "public", "static", "SslProvider", "addHandlerConfigurator", "(", "SslProvider", "provider", ",", "Consumer", "<", "?", "super", "SslHandler", ">", "handlerConfigurator", ")", "{", "Objects", ".", "requireNonNull", "(", "provider", ",", "\"provider\"", ")", ";", "...
Creates a new {@link SslProvider SslProvider} with a prepending handler configurator callback to inject default settings to an existing provider configuration. @return a new SslProvider
[ "Creates", "a", "new", "{", "@link", "SslProvider", "SslProvider", "}", "with", "a", "prepending", "handler", "configurator", "callback", "to", "inject", "default", "settings", "to", "an", "existing", "provider", "configuration", "." ]
train
https://github.com/reactor/reactor-netty/blob/4ed14316e1d7fca3cecd18d6caa5f2251e159e49/src/main/java/reactor/netty/tcp/SslProvider.java#L76-L81
Netflix/eureka
eureka-client/src/main/java/com/netflix/discovery/util/DeserializerStringCache.java
DeserializerStringCache.apply
public String apply(final JsonParser jp) throws IOException { return apply(jp, CacheScope.APPLICATION_SCOPE, null); }
java
public String apply(final JsonParser jp) throws IOException { return apply(jp, CacheScope.APPLICATION_SCOPE, null); }
[ "public", "String", "apply", "(", "final", "JsonParser", "jp", ")", "throws", "IOException", "{", "return", "apply", "(", "jp", ",", "CacheScope", ".", "APPLICATION_SCOPE", ",", "null", ")", ";", "}" ]
returns a String read from the JsonParser argument's current position. The returned value may be interned at the app scope to reduce heap consumption @param jp @return a possibly interned String @throws IOException
[ "returns", "a", "String", "read", "from", "the", "JsonParser", "argument", "s", "current", "position", ".", "The", "returned", "value", "may", "be", "interned", "at", "the", "app", "scope", "to", "reduce", "heap", "consumption" ]
train
https://github.com/Netflix/eureka/blob/48446d956be09df6650a3c00b7ebd7e2d1e1544f/eureka-client/src/main/java/com/netflix/discovery/util/DeserializerStringCache.java#L191-L193
chhh/MSFTBX
MSFileToolbox/src/main/java/umich/ms/util/jaxb/JaxbUtils.java
JaxbUtils.createCollectionElement
protected static <T> JAXBElement createCollectionElement(String rootName, Collection<T> c) { JAXBCollection collection = new JAXBCollection(c); return new JAXBElement<>(new QName(rootName), JAXBCollection.class, collection); }
java
protected static <T> JAXBElement createCollectionElement(String rootName, Collection<T> c) { JAXBCollection collection = new JAXBCollection(c); return new JAXBElement<>(new QName(rootName), JAXBCollection.class, collection); }
[ "protected", "static", "<", "T", ">", "JAXBElement", "createCollectionElement", "(", "String", "rootName", ",", "Collection", "<", "T", ">", "c", ")", "{", "JAXBCollection", "collection", "=", "new", "JAXBCollection", "(", "c", ")", ";", "return", "new", "JA...
Create a JAXBElement containing a JAXBCollection. Needed for marshalling a generic collection without a seperate wrapper class. @param rootName Name of the XML root element @return JAXBElement containing the given Collection, wrapped in a JAXBCollection.
[ "Create", "a", "JAXBElement", "containing", "a", "JAXBCollection", ".", "Needed", "for", "marshalling", "a", "generic", "collection", "without", "a", "seperate", "wrapper", "class", "." ]
train
https://github.com/chhh/MSFTBX/blob/e53ae6be982e2de3123292be7d5297715bec70bb/MSFileToolbox/src/main/java/umich/ms/util/jaxb/JaxbUtils.java#L478-L481
alkacon/opencms-core
src/org/opencms/db/CmsDriverManager.java
CmsDriverManager.lookupPrincipal
public I_CmsPrincipal lookupPrincipal(CmsDbContext dbc, String principalName) { try { CmsGroup group = getUserDriver(dbc).readGroup(dbc, principalName); if (group != null) { return group; } } catch (Exception e) { // ignore this exception } try { CmsUser user = readUser(dbc, principalName); if (user != null) { return user; } } catch (Exception e) { // ignore this exception } return null; }
java
public I_CmsPrincipal lookupPrincipal(CmsDbContext dbc, String principalName) { try { CmsGroup group = getUserDriver(dbc).readGroup(dbc, principalName); if (group != null) { return group; } } catch (Exception e) { // ignore this exception } try { CmsUser user = readUser(dbc, principalName); if (user != null) { return user; } } catch (Exception e) { // ignore this exception } return null; }
[ "public", "I_CmsPrincipal", "lookupPrincipal", "(", "CmsDbContext", "dbc", ",", "String", "principalName", ")", "{", "try", "{", "CmsGroup", "group", "=", "getUserDriver", "(", "dbc", ")", ".", "readGroup", "(", "dbc", ",", "principalName", ")", ";", "if", "...
Lookup and read the user or group with the given name.<p> @param dbc the current database context @param principalName the name of the principal to lookup @return the principal (group or user) if found, otherwise <code>null</code>
[ "Lookup", "and", "read", "the", "user", "or", "group", "with", "the", "given", "name", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsDriverManager.java#L5671-L5692
pedrovgs/Renderers
renderers/src/main/java/com/pedrogomez/renderers/VPRendererAdapter.java
VPRendererAdapter.instantiateItem
@Override public Object instantiateItem(ViewGroup parent, int position) { T content = getItem(position); rendererBuilder.withContent(content); rendererBuilder.withParent(parent); rendererBuilder.withLayoutInflater(LayoutInflater.from(parent.getContext())); Renderer<T> renderer = rendererBuilder.build(); if (renderer == null) { throw new NullRendererBuiltException("RendererBuilder have to return a not null Renderer"); } updateRendererExtraValues(content, renderer, position); renderer.render(); View view = renderer.getRootView(); parent.addView(view); return view; }
java
@Override public Object instantiateItem(ViewGroup parent, int position) { T content = getItem(position); rendererBuilder.withContent(content); rendererBuilder.withParent(parent); rendererBuilder.withLayoutInflater(LayoutInflater.from(parent.getContext())); Renderer<T> renderer = rendererBuilder.build(); if (renderer == null) { throw new NullRendererBuiltException("RendererBuilder have to return a not null Renderer"); } updateRendererExtraValues(content, renderer, position); renderer.render(); View view = renderer.getRootView(); parent.addView(view); return view; }
[ "@", "Override", "public", "Object", "instantiateItem", "(", "ViewGroup", "parent", ",", "int", "position", ")", "{", "T", "content", "=", "getItem", "(", "position", ")", ";", "rendererBuilder", ".", "withContent", "(", "content", ")", ";", "rendererBuilder",...
Main method of VPRendererAdapter. This method has the responsibility of update the RendererBuilder values and create or recycle a new Renderer. Once the renderer has been obtained the RendereBuilder will call the render method in the renderer and will return the Renderer root view to the ViewPager. If RendererBuilder returns a null Renderer this method will throw a NullRendererBuiltException. @param parent The containing View in which the page will be shown. @param position to render. @return view rendered.
[ "Main", "method", "of", "VPRendererAdapter", ".", "This", "method", "has", "the", "responsibility", "of", "update", "the", "RendererBuilder", "values", "and", "create", "or", "recycle", "a", "new", "Renderer", ".", "Once", "the", "renderer", "has", "been", "ob...
train
https://github.com/pedrovgs/Renderers/blob/7477fb6e3984468b32b59c8520b66afb765081ea/renderers/src/main/java/com/pedrogomez/renderers/VPRendererAdapter.java#L66-L80
couchbase/couchbase-java-client
src/main/java/com/couchbase/client/java/query/dsl/functions/DateFunctions.java
DateFunctions.dateDiffMillis
public static Expression dateDiffMillis(Expression expression1, Expression expression2, DatePart part) { return x("DATE_DIFF_MILLIS(" + expression1.toString() + ", " + expression2.toString() + ", \"" + part.toString() + "\")"); }
java
public static Expression dateDiffMillis(Expression expression1, Expression expression2, DatePart part) { return x("DATE_DIFF_MILLIS(" + expression1.toString() + ", " + expression2.toString() + ", \"" + part.toString() + "\")"); }
[ "public", "static", "Expression", "dateDiffMillis", "(", "Expression", "expression1", ",", "Expression", "expression2", ",", "DatePart", "part", ")", "{", "return", "x", "(", "\"DATE_DIFF_MILLIS(\"", "+", "expression1", ".", "toString", "(", ")", "+", "\", \"", ...
Returned expression results in Date arithmetic. Returns the elapsed time between two UNIX timestamps as an integer whose unit is part.
[ "Returned", "expression", "results", "in", "Date", "arithmetic", ".", "Returns", "the", "elapsed", "time", "between", "two", "UNIX", "timestamps", "as", "an", "integer", "whose", "unit", "is", "part", "." ]
train
https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/functions/DateFunctions.java#L106-L109
mygreen/excel-cellformatter
src/main/java/com/github/mygreen/cellformatter/lang/MessageResolver.java
MessageResolver.getMessage
public String getMessage(final Locale locale, final String key, final String defaultValue) { String message = getMessage(locale, key); return message == null ? defaultValue : message; }
java
public String getMessage(final Locale locale, final String key, final String defaultValue) { String message = getMessage(locale, key); return message == null ? defaultValue : message; }
[ "public", "String", "getMessage", "(", "final", "Locale", "locale", ",", "final", "String", "key", ",", "final", "String", "defaultValue", ")", "{", "String", "message", "=", "getMessage", "(", "locale", ",", "key", ")", ";", "return", "message", "==", "nu...
値がnullの場合、defaultValueの値を返す。 @param locale ロケール @param key メッセージキー @param defaultValue @return 該当するロケールのメッセージが見つからない場合は、引数で指定した'defaultValue'の値を返す。
[ "値がnullの場合、defaultValueの値を返す。" ]
train
https://github.com/mygreen/excel-cellformatter/blob/e802af273d49889500591e03799c9262cbf29185/src/main/java/com/github/mygreen/cellformatter/lang/MessageResolver.java#L323-L326
phax/ph-schedule
ph-mini-quartz/src/main/java/com/helger/quartz/SimpleScheduleBuilder.java
SimpleScheduleBuilder.repeatHourlyForTotalCount
@Nonnull public static SimpleScheduleBuilder repeatHourlyForTotalCount (final int nCount, final int nHours) { ValueEnforcer.isGT0 (nCount, "Count"); return simpleSchedule ().withIntervalInHours (nHours).withRepeatCount (nCount - 1); }
java
@Nonnull public static SimpleScheduleBuilder repeatHourlyForTotalCount (final int nCount, final int nHours) { ValueEnforcer.isGT0 (nCount, "Count"); return simpleSchedule ().withIntervalInHours (nHours).withRepeatCount (nCount - 1); }
[ "@", "Nonnull", "public", "static", "SimpleScheduleBuilder", "repeatHourlyForTotalCount", "(", "final", "int", "nCount", ",", "final", "int", "nHours", ")", "{", "ValueEnforcer", ".", "isGT0", "(", "nCount", ",", "\"Count\"", ")", ";", "return", "simpleSchedule", ...
Create a SimpleScheduleBuilder set to repeat the given number of times - 1 with an interval of the given number of hours. <p> Note: Total count = 1 (at start time) + repeat count </p> @return the new SimpleScheduleBuilder
[ "Create", "a", "SimpleScheduleBuilder", "set", "to", "repeat", "the", "given", "number", "of", "times", "-", "1", "with", "an", "interval", "of", "the", "given", "number", "of", "hours", ".", "<p", ">", "Note", ":", "Total", "count", "=", "1", "(", "at...
train
https://github.com/phax/ph-schedule/blob/b000790b46a9f8d23ad44cc20591f753d07c0229/ph-mini-quartz/src/main/java/com/helger/quartz/SimpleScheduleBuilder.java#L235-L240
OpenTSDB/opentsdb
src/tools/UidManager.java
UidManager.findAndPrintRow
private static int findAndPrintRow(final HBaseClient client, final byte[] table, final byte[] key, final byte[] family, boolean formard) { final GetRequest get = new GetRequest(table, key); get.family(family); ArrayList<KeyValue> row; try { row = client.get(get).joinUninterruptibly(); } catch (HBaseException e) { LOG.error("Get failed: " + get, e); return 1; } catch (Exception e) { LOG.error("WTF? Unexpected exception type, get=" + get, e); return 42; } return printResult(row, family, formard) ? 0 : 1; }
java
private static int findAndPrintRow(final HBaseClient client, final byte[] table, final byte[] key, final byte[] family, boolean formard) { final GetRequest get = new GetRequest(table, key); get.family(family); ArrayList<KeyValue> row; try { row = client.get(get).joinUninterruptibly(); } catch (HBaseException e) { LOG.error("Get failed: " + get, e); return 1; } catch (Exception e) { LOG.error("WTF? Unexpected exception type, get=" + get, e); return 42; } return printResult(row, family, formard) ? 0 : 1; }
[ "private", "static", "int", "findAndPrintRow", "(", "final", "HBaseClient", "client", ",", "final", "byte", "[", "]", "table", ",", "final", "byte", "[", "]", "key", ",", "final", "byte", "[", "]", "family", ",", "boolean", "formard", ")", "{", "final", ...
Gets a given row in HBase and prints it on standard output. @param client The HBase client to use. @param table The name of the HBase table to use. @param key The row key to attempt to get from HBase. @param family The family in which we're interested. @return 0 if at least one cell was found and printed, 1 otherwise.
[ "Gets", "a", "given", "row", "in", "HBase", "and", "prints", "it", "on", "standard", "output", "." ]
train
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tools/UidManager.java#L862-L880
dlemmermann/CalendarFX
CalendarFXView/src/main/java/com/calendarfx/model/Interval.java
Interval.withEndDateTime
public Interval withEndDateTime(LocalDateTime dateTime) { requireNonNull(dateTime); return new Interval(startDate, startTime, dateTime.toLocalDate(), dateTime.toLocalTime()); }
java
public Interval withEndDateTime(LocalDateTime dateTime) { requireNonNull(dateTime); return new Interval(startDate, startTime, dateTime.toLocalDate(), dateTime.toLocalTime()); }
[ "public", "Interval", "withEndDateTime", "(", "LocalDateTime", "dateTime", ")", "{", "requireNonNull", "(", "dateTime", ")", ";", "return", "new", "Interval", "(", "startDate", ",", "startTime", ",", "dateTime", ".", "toLocalDate", "(", ")", ",", "dateTime", "...
Returns a new interval based on this interval but with a different end date and time. @param dateTime the new end date and time @return a new interval
[ "Returns", "a", "new", "interval", "based", "on", "this", "interval", "but", "with", "a", "different", "end", "date", "and", "time", "." ]
train
https://github.com/dlemmermann/CalendarFX/blob/f2b91c2622c3f29d004485b6426b23b86c331f96/CalendarFXView/src/main/java/com/calendarfx/model/Interval.java#L379-L382
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/time/DateUtils.java
DateUtils.getFragmentInMinutes
@GwtIncompatible("incompatible method") public static long getFragmentInMinutes(final Date date, final int fragment) { return getFragment(date, fragment, TimeUnit.MINUTES); }
java
@GwtIncompatible("incompatible method") public static long getFragmentInMinutes(final Date date, final int fragment) { return getFragment(date, fragment, TimeUnit.MINUTES); }
[ "@", "GwtIncompatible", "(", "\"incompatible method\"", ")", "public", "static", "long", "getFragmentInMinutes", "(", "final", "Date", "date", ",", "final", "int", "fragment", ")", "{", "return", "getFragment", "(", "date", ",", "fragment", ",", "TimeUnit", ".",...
<p>Returns the number of minutes within the fragment. All datefields greater than the fragment will be ignored.</p> <p>Asking the minutes of any date will only return the number of minutes of the current hour (resulting in a number between 0 and 59). This method will retrieve the number of minutes for any fragment. For example, if you want to calculate the number of minutes past this month, your fragment is Calendar.MONTH. The result will be all minutes of the past day(s) and hour(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 MINUTE field will return 0.</p> <ul> <li>January 1, 2008 7:15:10.538 with Calendar.HOUR_OF_DAY as fragment will return 15 (equivalent to deprecated date.getMinutes())</li> <li>January 6, 2008 7:15:10.538 with Calendar.HOUR_OF_DAY as fragment will return 15 (equivalent to deprecated date.getMinutes())</li> <li>January 1, 2008 7:15:10.538 with Calendar.MONTH as fragment will return 15</li> <li>January 6, 2008 7:15:10.538 with Calendar.MONTH as fragment will return 435 (7*60 + 15)</li> <li>January 16, 2008 7:15:10.538 with Calendar.MILLISECOND as fragment will return 0 (a millisecond cannot be split in minutes)</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 minutes 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", "minutes", "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#L1374-L1377
citrusframework/citrus
modules/citrus-ws/src/main/java/com/consol/citrus/ws/validation/AbstractSoapAttachmentValidator.java
AbstractSoapAttachmentValidator.validateAttachmentContentId
protected void validateAttachmentContentId(SoapAttachment receivedAttachment, SoapAttachment controlAttachment) { //in case contentId was not set in test case, skip validation if (!StringUtils.hasText(controlAttachment.getContentId())) { return; } if (receivedAttachment.getContentId() != null) { Assert.isTrue(controlAttachment.getContentId() != null, buildValidationErrorMessage("Values not equal for attachment contentId", null, receivedAttachment.getContentId())); Assert.isTrue(receivedAttachment.getContentId().equals(controlAttachment.getContentId()), buildValidationErrorMessage("Values not equal for attachment contentId", controlAttachment.getContentId(), receivedAttachment.getContentId())); } else { Assert.isTrue(controlAttachment.getContentId() == null || controlAttachment.getContentId().length() == 0, buildValidationErrorMessage("Values not equal for attachment contentId", controlAttachment.getContentId(), null)); } if (log.isDebugEnabled()) { log.debug("Validating attachment contentId: " + receivedAttachment.getContentId() + "='" + controlAttachment.getContentId() + "': OK."); } }
java
protected void validateAttachmentContentId(SoapAttachment receivedAttachment, SoapAttachment controlAttachment) { //in case contentId was not set in test case, skip validation if (!StringUtils.hasText(controlAttachment.getContentId())) { return; } if (receivedAttachment.getContentId() != null) { Assert.isTrue(controlAttachment.getContentId() != null, buildValidationErrorMessage("Values not equal for attachment contentId", null, receivedAttachment.getContentId())); Assert.isTrue(receivedAttachment.getContentId().equals(controlAttachment.getContentId()), buildValidationErrorMessage("Values not equal for attachment contentId", controlAttachment.getContentId(), receivedAttachment.getContentId())); } else { Assert.isTrue(controlAttachment.getContentId() == null || controlAttachment.getContentId().length() == 0, buildValidationErrorMessage("Values not equal for attachment contentId", controlAttachment.getContentId(), null)); } if (log.isDebugEnabled()) { log.debug("Validating attachment contentId: " + receivedAttachment.getContentId() + "='" + controlAttachment.getContentId() + "': OK."); } }
[ "protected", "void", "validateAttachmentContentId", "(", "SoapAttachment", "receivedAttachment", ",", "SoapAttachment", "controlAttachment", ")", "{", "//in case contentId was not set in test case, skip validation ", "if", "(", "!", "StringUtils", ".", "hasText", "(", "controlA...
Validating SOAP attachment content id. @param receivedAttachment @param controlAttachment
[ "Validating", "SOAP", "attachment", "content", "id", "." ]
train
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-ws/src/main/java/com/consol/citrus/ws/validation/AbstractSoapAttachmentValidator.java#L105-L127
mangstadt/biweekly
src/main/java/biweekly/io/scribe/property/ICalPropertyScribe.java
ICalPropertyScribe._writeXml
protected void _writeXml(T property, XCalElement element, WriteContext context) { String value = writeText(property, context); ICalDataType dataType = dataType(property, ICalVersion.V2_0); element.append(dataType, value); }
java
protected void _writeXml(T property, XCalElement element, WriteContext context) { String value = writeText(property, context); ICalDataType dataType = dataType(property, ICalVersion.V2_0); element.append(dataType, value); }
[ "protected", "void", "_writeXml", "(", "T", "property", ",", "XCalElement", "element", ",", "WriteContext", "context", ")", "{", "String", "value", "=", "writeText", "(", "property", ",", "context", ")", ";", "ICalDataType", "dataType", "=", "dataType", "(", ...
<p> Marshals a property's value to an XML element (xCal). </p> <p> This method should be overridden by child classes that wish to support xCal. The default implementation of this method will append one child element to the property's XML element. The child element's name will be that of the property's data type (retrieved using the {@link #dataType} method), and the child element's text content will be set to the property's marshalled plain-text value (retrieved using the {@link #writeText} method). </p> @param property the property @param element the property's XML element @param context the context @throws SkipMeException if the property should not be written to the data stream
[ "<p", ">", "Marshals", "a", "property", "s", "value", "to", "an", "XML", "element", "(", "xCal", ")", ".", "<", "/", "p", ">", "<p", ">", "This", "method", "should", "be", "overridden", "by", "child", "classes", "that", "wish", "to", "support", "xCal...
train
https://github.com/mangstadt/biweekly/blob/2e21350f85c13dfff52fdef98fdbebe2976fcf61/src/main/java/biweekly/io/scribe/property/ICalPropertyScribe.java#L372-L376
k3po/k3po
driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/codec/http/QueryStringEncoder.java
QueryStringEncoder.addParam
public void addParam(String name, String value) { if (name == null) { throw new NullPointerException("name"); } if (value == null) { throw new NullPointerException("value"); } params.add(new Param(name, value)); }
java
public void addParam(String name, String value) { if (name == null) { throw new NullPointerException("name"); } if (value == null) { throw new NullPointerException("value"); } params.add(new Param(name, value)); }
[ "public", "void", "addParam", "(", "String", "name", ",", "String", "value", ")", "{", "if", "(", "name", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "\"name\"", ")", ";", "}", "if", "(", "value", "==", "null", ")", "{", "thr...
Adds a parameter with the specified name and value to this encoder.
[ "Adds", "a", "parameter", "with", "the", "specified", "name", "and", "value", "to", "this", "encoder", "." ]
train
https://github.com/k3po/k3po/blob/3ca4fd31ab4a397893aa640c62ada0e485c8bbd4/driver/src/main/java/org/kaazing/k3po/driver/internal/behavior/handler/codec/http/QueryStringEncoder.java#L106-L114
knowm/XChange
xchange-core/src/main/java/org/knowm/xchange/utils/DateUtils.java
DateUtils.fromRfc3339DateString
public static Date fromRfc3339DateString(String rfc3339FormattedDate) throws InvalidFormatException { SimpleDateFormat rfc3339DateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); try { return rfc3339DateFormat.parse(rfc3339FormattedDate); } catch (ParseException e) { throw new InvalidFormatException("Error parsing as date", rfc3339FormattedDate, Date.class); } }
java
public static Date fromRfc3339DateString(String rfc3339FormattedDate) throws InvalidFormatException { SimpleDateFormat rfc3339DateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); try { return rfc3339DateFormat.parse(rfc3339FormattedDate); } catch (ParseException e) { throw new InvalidFormatException("Error parsing as date", rfc3339FormattedDate, Date.class); } }
[ "public", "static", "Date", "fromRfc3339DateString", "(", "String", "rfc3339FormattedDate", ")", "throws", "InvalidFormatException", "{", "SimpleDateFormat", "rfc3339DateFormat", "=", "new", "SimpleDateFormat", "(", "\"yyyy-MM-dd HH:mm:ss\"", ")", ";", "try", "{", "return...
Converts an RFC3339 formatted Date String to a Java Date RFC3339 format: yyyy-MM-dd HH:mm:ss @param rfc3339FormattedDate RFC3339 formatted Date @return an {@link Date} object @throws InvalidFormatException the RFC3339 formatted Date is invalid or cannot be parsed. @see <a href="https://tools.ietf.org/html/rfc3339">The Internet Society - RFC 3339</a>
[ "Converts", "an", "RFC3339", "formatted", "Date", "String", "to", "a", "Java", "Date", "RFC3339", "format", ":", "yyyy", "-", "MM", "-", "dd", "HH", ":", "mm", ":", "ss" ]
train
https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-core/src/main/java/org/knowm/xchange/utils/DateUtils.java#L115-L124
googleapis/google-cloud-java
google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/DiskTypeId.java
DiskTypeId.of
public static DiskTypeId of(ZoneId zoneId, String type) { return new DiskTypeId(zoneId.getProject(), zoneId.getZone(), type); }
java
public static DiskTypeId of(ZoneId zoneId, String type) { return new DiskTypeId(zoneId.getProject(), zoneId.getZone(), type); }
[ "public", "static", "DiskTypeId", "of", "(", "ZoneId", "zoneId", ",", "String", "type", ")", "{", "return", "new", "DiskTypeId", "(", "zoneId", ".", "getProject", "(", ")", ",", "zoneId", ".", "getZone", "(", ")", ",", "type", ")", ";", "}" ]
Returns a disk type identity given the zone identity and the disk type name.
[ "Returns", "a", "disk", "type", "identity", "given", "the", "zone", "identity", "and", "the", "disk", "type", "name", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/DiskTypeId.java#L111-L113
tvesalainen/util
util/src/main/java/org/vesalainen/bean/BeanHelper.java
BeanHelper.addList
public static final <T> T addList(Object bean, String property, String hint, BiFunction<Class<T>,String,T> factory) { Object fieldValue = getValue(bean, property); if (fieldValue instanceof List) { List list = (List) fieldValue; Class[] pt = getParameterTypes(bean, property); T value = (T)factory.apply(pt[0], hint); if (value != null && !pt[0].isAssignableFrom(value.getClass())) { throw new IllegalArgumentException(pt[0]+" not assignable from "+value); } list.add(value); return value; } else { throw new IllegalArgumentException(fieldValue+" not List"); } }
java
public static final <T> T addList(Object bean, String property, String hint, BiFunction<Class<T>,String,T> factory) { Object fieldValue = getValue(bean, property); if (fieldValue instanceof List) { List list = (List) fieldValue; Class[] pt = getParameterTypes(bean, property); T value = (T)factory.apply(pt[0], hint); if (value != null && !pt[0].isAssignableFrom(value.getClass())) { throw new IllegalArgumentException(pt[0]+" not assignable from "+value); } list.add(value); return value; } else { throw new IllegalArgumentException(fieldValue+" not List"); } }
[ "public", "static", "final", "<", "T", ">", "T", "addList", "(", "Object", "bean", ",", "String", "property", ",", "String", "hint", ",", "BiFunction", "<", "Class", "<", "T", ">", ",", "String", ",", "T", ">", "factory", ")", "{", "Object", "fieldVa...
Adds pattern item to end of list using given factory and hint @param <T> @param bean @param property @param hint @param factory
[ "Adds", "pattern", "item", "to", "end", "of", "list", "using", "given", "factory", "and", "hint" ]
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/bean/BeanHelper.java#L594-L613
stephenc/java-iso-tools
loop-fs-spi/src/main/java/com/github/stephenc/javaisotools/loopfs/spi/AbstractBlockFileSystem.java
AbstractBlockFileSystem.readBlock
protected final boolean readBlock(final long block, final byte[] buffer) throws IOException { final int bytesRead = readData(block * this.blockSize, buffer, 0, this.blockSize); if (bytesRead <= 0) { return false; } if (this.blockSize != bytesRead) { throw new IOException("Could not deserialize a complete block"); } return true; }
java
protected final boolean readBlock(final long block, final byte[] buffer) throws IOException { final int bytesRead = readData(block * this.blockSize, buffer, 0, this.blockSize); if (bytesRead <= 0) { return false; } if (this.blockSize != bytesRead) { throw new IOException("Could not deserialize a complete block"); } return true; }
[ "protected", "final", "boolean", "readBlock", "(", "final", "long", "block", ",", "final", "byte", "[", "]", "buffer", ")", "throws", "IOException", "{", "final", "int", "bytesRead", "=", "readData", "(", "block", "*", "this", ".", "blockSize", ",", "buffe...
Read the data for the specified block into the specified buffer. @return if the block was actually read @throws IOException if the number of bytes read into the buffer was less than the expected number (i.e. the block size)
[ "Read", "the", "data", "for", "the", "specified", "block", "into", "the", "specified", "buffer", "." ]
train
https://github.com/stephenc/java-iso-tools/blob/828c50b02eb311a14dde0dab43462a0d0c9dfb06/loop-fs-spi/src/main/java/com/github/stephenc/javaisotools/loopfs/spi/AbstractBlockFileSystem.java#L89-L101
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/policy/policystringmap_binding.java
policystringmap_binding.get
public static policystringmap_binding get(nitro_service service, String name) throws Exception{ policystringmap_binding obj = new policystringmap_binding(); obj.set_name(name); policystringmap_binding response = (policystringmap_binding) obj.get_resource(service); return response; }
java
public static policystringmap_binding get(nitro_service service, String name) throws Exception{ policystringmap_binding obj = new policystringmap_binding(); obj.set_name(name); policystringmap_binding response = (policystringmap_binding) obj.get_resource(service); return response; }
[ "public", "static", "policystringmap_binding", "get", "(", "nitro_service", "service", ",", "String", "name", ")", "throws", "Exception", "{", "policystringmap_binding", "obj", "=", "new", "policystringmap_binding", "(", ")", ";", "obj", ".", "set_name", "(", "nam...
Use this API to fetch policystringmap_binding resource of given name .
[ "Use", "this", "API", "to", "fetch", "policystringmap_binding", "resource", "of", "given", "name", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/policy/policystringmap_binding.java#L103-L108
mangstadt/biweekly
src/main/java/biweekly/util/com/google/ical/iter/IntSet.java
IntSet.toIntArray
int[] toIntArray() { int[] out = new int[size()]; int a = 0, b = out.length; for (int i = -1; (i = ints.nextSetBit(i + 1)) >= 0;) { int n = decode(i); if (n < 0) { out[a++] = n; } else { out[--b] = n; } } //if it contains -3, -1, 0, 1, 2, 4 //then out will be -1, -3, 4, 2, 1, 0 reverse(out, 0, a); reverse(out, a, out.length); return out; }
java
int[] toIntArray() { int[] out = new int[size()]; int a = 0, b = out.length; for (int i = -1; (i = ints.nextSetBit(i + 1)) >= 0;) { int n = decode(i); if (n < 0) { out[a++] = n; } else { out[--b] = n; } } //if it contains -3, -1, 0, 1, 2, 4 //then out will be -1, -3, 4, 2, 1, 0 reverse(out, 0, a); reverse(out, a, out.length); return out; }
[ "int", "[", "]", "toIntArray", "(", ")", "{", "int", "[", "]", "out", "=", "new", "int", "[", "size", "(", ")", "]", ";", "int", "a", "=", "0", ",", "b", "=", "out", ".", "length", ";", "for", "(", "int", "i", "=", "-", "1", ";", "(", "...
Converts this set to a new integer array that is sorted in ascending order. @return the array (sorted in ascending order)
[ "Converts", "this", "set", "to", "a", "new", "integer", "array", "that", "is", "sorted", "in", "ascending", "order", "." ]
train
https://github.com/mangstadt/biweekly/blob/2e21350f85c13dfff52fdef98fdbebe2976fcf61/src/main/java/biweekly/util/com/google/ical/iter/IntSet.java#L82-L100
andkulikov/Transitions-Everywhere
library(1.x)/src/main/java/com/transitionseverywhere/Transition.java
Transition.excludeTarget
@NonNull public Transition excludeTarget(@Nullable View target, boolean exclude) { mTargetExcludes = excludeObject(mTargetExcludes, target, exclude); return this; }
java
@NonNull public Transition excludeTarget(@Nullable View target, boolean exclude) { mTargetExcludes = excludeObject(mTargetExcludes, target, exclude); return this; }
[ "@", "NonNull", "public", "Transition", "excludeTarget", "(", "@", "Nullable", "View", "target", ",", "boolean", "exclude", ")", "{", "mTargetExcludes", "=", "excludeObject", "(", "mTargetExcludes", ",", "target", ",", "exclude", ")", ";", "return", "this", ";...
Whether to add the given target to the list of targets to exclude from this transition. The <code>exclude</code> parameter specifies whether the target should be added to or removed from the excluded list. <p/> <p>Excluding targets is a general mechanism for allowing transitions to run on a view hierarchy while skipping target views that should not be part of the transition. For example, you may want to avoid animating children of a specific ListView or Spinner. Views can be excluded either by their id, or by their instance reference, or by the Class of that view (eg, {@link Spinner}).</p> @param target The target to ignore when running this transition. @param exclude Whether to add the target to or remove the target from the current list of excluded targets. @return This transition object. @see #excludeChildren(View, boolean) @see #excludeTarget(int, boolean) @see #excludeTarget(Class, boolean)
[ "Whether", "to", "add", "the", "given", "target", "to", "the", "list", "of", "targets", "to", "exclude", "from", "this", "transition", ".", "The", "<code", ">", "exclude<", "/", "code", ">", "parameter", "specifies", "whether", "the", "target", "should", "...
train
https://github.com/andkulikov/Transitions-Everywhere/blob/828efe5f152a2f05e2bfeee6254b74ad2269d4f1/library(1.x)/src/main/java/com/transitionseverywhere/Transition.java#L1225-L1229
carewebframework/carewebframework-core
org.carewebframework.mvn-parent/org.carewebframework.mvn.plugin-parent/org.carewebframework.mvn.plugin.core/src/main/java/org/carewebframework/maven/plugin/core/ConfigTemplate.java
ConfigTemplate.createFile
protected void createFile(File stagingDirectory) throws MojoExecutionException { File targetDirectory = newSubdirectory(stagingDirectory, "META-INF"); File newEntry = new File(targetDirectory, filename); try (FileOutputStream out = new FileOutputStream(newEntry); PrintStream ps = new PrintStream(out);) { Iterator<ConfigEntry> iter = entries.values().iterator(); ConfigEntry entry = null; for (int i = 0; i < buffer.size(); i++) { if (entry == null && iter.hasNext()) { entry = iter.next(); } if (entry != null && entry.placeholder == i) { for (String line : entry.buffer) { ps.println(line); } entry = null; continue; } ps.println(buffer.get(i)); } } catch (Exception e) { throw new MojoExecutionException("Unexpected error while creating configuration file.", e); } }
java
protected void createFile(File stagingDirectory) throws MojoExecutionException { File targetDirectory = newSubdirectory(stagingDirectory, "META-INF"); File newEntry = new File(targetDirectory, filename); try (FileOutputStream out = new FileOutputStream(newEntry); PrintStream ps = new PrintStream(out);) { Iterator<ConfigEntry> iter = entries.values().iterator(); ConfigEntry entry = null; for (int i = 0; i < buffer.size(); i++) { if (entry == null && iter.hasNext()) { entry = iter.next(); } if (entry != null && entry.placeholder == i) { for (String line : entry.buffer) { ps.println(line); } entry = null; continue; } ps.println(buffer.get(i)); } } catch (Exception e) { throw new MojoExecutionException("Unexpected error while creating configuration file.", e); } }
[ "protected", "void", "createFile", "(", "File", "stagingDirectory", ")", "throws", "MojoExecutionException", "{", "File", "targetDirectory", "=", "newSubdirectory", "(", "stagingDirectory", ",", "\"META-INF\"", ")", ";", "File", "newEntry", "=", "new", "File", "(", ...
Create the xml configuration descriptor. @param stagingDirectory The parent directory where the configuration descriptor is to be created. @throws MojoExecutionException Unspecified exception.
[ "Create", "the", "xml", "configuration", "descriptor", "." ]
train
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.mvn-parent/org.carewebframework.mvn.plugin-parent/org.carewebframework.mvn.plugin.core/src/main/java/org/carewebframework/maven/plugin/core/ConfigTemplate.java#L128-L156
googleapis/google-cloud-java
google-cloud-clients/google-cloud-container/src/main/java/com/google/cloud/container/v1/ClusterManagerClient.java
ClusterManagerClient.startIPRotation
public final Operation startIPRotation(String projectId, String zone, String clusterId) { StartIPRotationRequest request = StartIPRotationRequest.newBuilder() .setProjectId(projectId) .setZone(zone) .setClusterId(clusterId) .build(); return startIPRotation(request); }
java
public final Operation startIPRotation(String projectId, String zone, String clusterId) { StartIPRotationRequest request = StartIPRotationRequest.newBuilder() .setProjectId(projectId) .setZone(zone) .setClusterId(clusterId) .build(); return startIPRotation(request); }
[ "public", "final", "Operation", "startIPRotation", "(", "String", "projectId", ",", "String", "zone", ",", "String", "clusterId", ")", "{", "StartIPRotationRequest", "request", "=", "StartIPRotationRequest", ".", "newBuilder", "(", ")", ".", "setProjectId", "(", "...
Start master IP rotation. <p>Sample code: <pre><code> try (ClusterManagerClient clusterManagerClient = ClusterManagerClient.create()) { String projectId = ""; String zone = ""; String clusterId = ""; Operation response = clusterManagerClient.startIPRotation(projectId, zone, clusterId); } </code></pre> @param projectId Deprecated. The Google Developers Console [project ID or project number](https://developers.google.com/console/help/new/#projectnumber). This field has been deprecated and replaced by the name field. @param zone Deprecated. The name of the Google Compute Engine [zone](/compute/docs/zones#available) in which the cluster resides. This field has been deprecated and replaced by the name field. @param clusterId Deprecated. The name of the cluster. This field has been deprecated and replaced by the name field. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Start", "master", "IP", "rotation", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-container/src/main/java/com/google/cloud/container/v1/ClusterManagerClient.java#L2439-L2448
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/ByteArrayUtil.java
ByteArrayUtil.putShortLE
public static void putShortLE(final byte[] array, final int offset, final short value) { array[offset ] = (byte) (value ); array[offset + 1] = (byte) (value >>> 8); }
java
public static void putShortLE(final byte[] array, final int offset, final short value) { array[offset ] = (byte) (value ); array[offset + 1] = (byte) (value >>> 8); }
[ "public", "static", "void", "putShortLE", "(", "final", "byte", "[", "]", "array", ",", "final", "int", "offset", ",", "final", "short", "value", ")", "{", "array", "[", "offset", "]", "=", "(", "byte", ")", "(", "value", ")", ";", "array", "[", "o...
Put the source <i>short</i> into the destination byte array starting at the given offset in little endian order. There is no bounds checking. @param array destination byte array @param offset destination offset @param value source <i>short</i>
[ "Put", "the", "source", "<i", ">", "short<", "/", "i", ">", "into", "the", "destination", "byte", "array", "starting", "at", "the", "given", "offset", "in", "little", "endian", "order", ".", "There", "is", "no", "bounds", "checking", "." ]
train
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/ByteArrayUtil.java#L26-L29
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPOptionPersistenceImpl.java
CPOptionPersistenceImpl.fetchByG_K
@Override public CPOption fetchByG_K(long groupId, String key) { return fetchByG_K(groupId, key, true); }
java
@Override public CPOption fetchByG_K(long groupId, String key) { return fetchByG_K(groupId, key, true); }
[ "@", "Override", "public", "CPOption", "fetchByG_K", "(", "long", "groupId", ",", "String", "key", ")", "{", "return", "fetchByG_K", "(", "groupId", ",", "key", ",", "true", ")", ";", "}" ]
Returns the cp option where groupId = &#63; and key = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache. @param groupId the group ID @param key the key @return the matching cp option, or <code>null</code> if a matching cp option could not be found
[ "Returns", "the", "cp", "option", "where", "groupId", "=", "&#63", ";", "and", "key", "=", "&#63", ";", "or", "returns", "<code", ">", "null<", "/", "code", ">", "if", "it", "could", "not", "be", "found", ".", "Uses", "the", "finder", "cache", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPOptionPersistenceImpl.java#L2027-L2030
sababado/CircularView
library/src/main/java/com/sababado/circularview/CircularView.java
CircularView.setTextSize
public void setTextSize(int unit, float size) { Context c = getContext(); Resources r; if (c == null) r = Resources.getSystem(); else r = c.getResources(); setRawTextSize(TypedValue.applyDimension( unit, size, r.getDisplayMetrics())); }
java
public void setTextSize(int unit, float size) { Context c = getContext(); Resources r; if (c == null) r = Resources.getSystem(); else r = c.getResources(); setRawTextSize(TypedValue.applyDimension( unit, size, r.getDisplayMetrics())); }
[ "public", "void", "setTextSize", "(", "int", "unit", ",", "float", "size", ")", "{", "Context", "c", "=", "getContext", "(", ")", ";", "Resources", "r", ";", "if", "(", "c", "==", "null", ")", "r", "=", "Resources", ".", "getSystem", "(", ")", ";",...
Set the default text size to a given unit and value. See {@link TypedValue} for the possible dimension units. See R.styleable#CircularView_textSize @param unit The desired dimension unit. @param size The desired size in the given units.
[ "Set", "the", "default", "text", "size", "to", "a", "given", "unit", "and", "value", ".", "See", "{", "@link", "TypedValue", "}", "for", "the", "possible", "dimension", "units", ".", "See", "R", ".", "styleable#CircularView_textSize" ]
train
https://github.com/sababado/CircularView/blob/c9ab818d063bcc0796183616f8a82166a9b80aac/library/src/main/java/com/sababado/circularview/CircularView.java#L435-L446
fabric8io/kubernetes-client
kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/base/OperationSupport.java
OperationSupport.handleResponse
protected <T> T handleResponse(OkHttpClient client, Request.Builder requestBuilder, Class<T> type, Map<String, String> parameters) throws ExecutionException, InterruptedException, KubernetesClientException, IOException { VersionUsageUtils.log(this.resourceT, this.apiGroupVersion); Request request = requestBuilder.build(); Response response = client.newCall(request).execute(); try (ResponseBody body = response.body()) { assertResponseCode(request, response); if (type != null) { try (InputStream bodyInputStream = body.byteStream()) { return Serialization.unmarshal(bodyInputStream, type, parameters); } } else { return null; } } catch (Exception e) { if (e instanceof KubernetesClientException) { throw e; } throw requestException(request, e); } finally { if(response != null && response.body() != null) { response.body().close(); } } }
java
protected <T> T handleResponse(OkHttpClient client, Request.Builder requestBuilder, Class<T> type, Map<String, String> parameters) throws ExecutionException, InterruptedException, KubernetesClientException, IOException { VersionUsageUtils.log(this.resourceT, this.apiGroupVersion); Request request = requestBuilder.build(); Response response = client.newCall(request).execute(); try (ResponseBody body = response.body()) { assertResponseCode(request, response); if (type != null) { try (InputStream bodyInputStream = body.byteStream()) { return Serialization.unmarshal(bodyInputStream, type, parameters); } } else { return null; } } catch (Exception e) { if (e instanceof KubernetesClientException) { throw e; } throw requestException(request, e); } finally { if(response != null && response.body() != null) { response.body().close(); } } }
[ "protected", "<", "T", ">", "T", "handleResponse", "(", "OkHttpClient", "client", ",", "Request", ".", "Builder", "requestBuilder", ",", "Class", "<", "T", ">", "type", ",", "Map", "<", "String", ",", "String", ">", "parameters", ")", "throws", "ExecutionE...
Send an http request and handle the response, optionally performing placeholder substitution to the response. @param client OkHttp client provided @param requestBuilder Request builder @param type Type of object provided @param parameters A hashmap containing parameters @param <T> Template argument provided @return Returns a de-serialized object as api server response of provided type. @throws ExecutionException Execution Exception @throws InterruptedException Interrupted Exception @throws KubernetesClientException KubernetesClientException @throws IOException IOException
[ "Send", "an", "http", "request", "and", "handle", "the", "response", "optionally", "performing", "placeholder", "substitution", "to", "the", "response", "." ]
train
https://github.com/fabric8io/kubernetes-client/blob/141668a882ed8e902c045a5cd0a80f14bd17d132/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/base/OperationSupport.java#L401-L424
fcrepo3/fcrepo
fcrepo-server/src/main/java/org/fcrepo/server/management/FedoraAPIMImpl.java
FedoraAPIMImpl.purgeObject
@Override public String purgeObject(String pid, String logMessage, boolean force) { LOG.debug("start: purgeObject, {}", pid); assertInitialized(); try { MessageContext ctx = context.getMessageContext(); return DateUtility.convertDateToString(m_management .purgeObject(ReadOnlyContext.getSoapContext(ctx), pid, logMessage)); } catch (Throwable th) { LOG.error("Error purging object", th); throw CXFUtility.getFault(th); } finally { LOG.debug("end: purgeObject, {}", pid); } }
java
@Override public String purgeObject(String pid, String logMessage, boolean force) { LOG.debug("start: purgeObject, {}", pid); assertInitialized(); try { MessageContext ctx = context.getMessageContext(); return DateUtility.convertDateToString(m_management .purgeObject(ReadOnlyContext.getSoapContext(ctx), pid, logMessage)); } catch (Throwable th) { LOG.error("Error purging object", th); throw CXFUtility.getFault(th); } finally { LOG.debug("end: purgeObject, {}", pid); } }
[ "@", "Override", "public", "String", "purgeObject", "(", "String", "pid", ",", "String", "logMessage", ",", "boolean", "force", ")", "{", "LOG", ".", "debug", "(", "\"start: purgeObject, {}\"", ",", "pid", ")", ";", "assertInitialized", "(", ")", ";", "try",...
/* (non-Javadoc) @see org.fcrepo.server.management.FedoraAPIMMTOM#purgeObject(String pid ,)String logMessage ,)boolean force )*
[ "/", "*", "(", "non", "-", "Javadoc", ")" ]
train
https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/management/FedoraAPIMImpl.java#L182-L198
facebookarchive/hadoop-20
src/core/org/apache/hadoop/metrics/APITrace.java
APITrace.logCall
public static void logCall(long entryTime, long returnTime, int callIndex, Object returnValue, Object argValues[], long streamId) { if (!API_TRACE_LOG.isInfoEnabled()) { return; } // determine elapsed time long elapsed = returnTime; elapsed -= entryTime; entryTime -= baseTime; // TODO: for the first entry, we get negatives for entryTime. // is this something weird in order the Java instantiates? // append universal fields (i.e., ones that occur for every call) StringBuilder line = new StringBuilder(); line.append(pid + ","); line.append(nextEventId.getAndIncrement() + ","); line.append(entryTime + ","); line.append(elapsed + ","); line.append(callIndex + ","); line.append(streamId + ","); line.append(escape(returnValue)); // append the args to the method call if (argValues != null) { for (int i = 0; i < argValues.length; i++) { line.append("," + escape(argValues[i])); } } API_TRACE_LOG.info(line); }
java
public static void logCall(long entryTime, long returnTime, int callIndex, Object returnValue, Object argValues[], long streamId) { if (!API_TRACE_LOG.isInfoEnabled()) { return; } // determine elapsed time long elapsed = returnTime; elapsed -= entryTime; entryTime -= baseTime; // TODO: for the first entry, we get negatives for entryTime. // is this something weird in order the Java instantiates? // append universal fields (i.e., ones that occur for every call) StringBuilder line = new StringBuilder(); line.append(pid + ","); line.append(nextEventId.getAndIncrement() + ","); line.append(entryTime + ","); line.append(elapsed + ","); line.append(callIndex + ","); line.append(streamId + ","); line.append(escape(returnValue)); // append the args to the method call if (argValues != null) { for (int i = 0; i < argValues.length; i++) { line.append("," + escape(argValues[i])); } } API_TRACE_LOG.info(line); }
[ "public", "static", "void", "logCall", "(", "long", "entryTime", ",", "long", "returnTime", ",", "int", "callIndex", ",", "Object", "returnValue", ",", "Object", "argValues", "[", "]", ",", "long", "streamId", ")", "{", "if", "(", "!", "API_TRACE_LOG", "."...
Record a method call and its return value in the log. @param entry the System.nanoTime timestamp for method entry @param callIndex index into callTable @param returnValue value returned by traced method @param argValues arguments passed to traced method @param streamId unique identifier for stream, or -1 if not applicable
[ "Record", "a", "method", "call", "and", "its", "return", "value", "in", "the", "log", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/metrics/APITrace.java#L114-L149
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/FileProxyRNASequenceCreator.java
FileProxyRNASequenceCreator.getSequence
@Override public AbstractSequence<NucleotideCompound> getSequence(String sequence, long index ) throws CompoundNotFoundException, IOException { SequenceFileProxyLoader<NucleotideCompound> sequenceFileProxyLoader = new SequenceFileProxyLoader<NucleotideCompound>( file, sequenceParser, index, sequence.length(), compoundSet); return new RNASequence(sequenceFileProxyLoader, compoundSet); }
java
@Override public AbstractSequence<NucleotideCompound> getSequence(String sequence, long index ) throws CompoundNotFoundException, IOException { SequenceFileProxyLoader<NucleotideCompound> sequenceFileProxyLoader = new SequenceFileProxyLoader<NucleotideCompound>( file, sequenceParser, index, sequence.length(), compoundSet); return new RNASequence(sequenceFileProxyLoader, compoundSet); }
[ "@", "Override", "public", "AbstractSequence", "<", "NucleotideCompound", ">", "getSequence", "(", "String", "sequence", ",", "long", "index", ")", "throws", "CompoundNotFoundException", ",", "IOException", "{", "SequenceFileProxyLoader", "<", "NucleotideCompound", ">",...
Even though we are passing in the sequence we really only care about the length of the sequence and the offset index in the fasta file. @param sequence @param index @return @throws CompoundNotFoundException @throws IOException
[ "Even", "though", "we", "are", "passing", "in", "the", "sequence", "we", "really", "only", "care", "about", "the", "length", "of", "the", "sequence", "and", "the", "offset", "index", "in", "the", "fasta", "file", "." ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/FileProxyRNASequenceCreator.java#L79-L88
att/AAF
authz/authz-core/src/main/java/com/att/cssa/rserv/HttpCode.java
HttpCode.pathParam
public String pathParam(HttpServletRequest req, String key) { return match.param(req.getPathInfo(), key); }
java
public String pathParam(HttpServletRequest req, String key) { return match.param(req.getPathInfo(), key); }
[ "public", "String", "pathParam", "(", "HttpServletRequest", "req", ",", "String", "key", ")", "{", "return", "match", ".", "param", "(", "req", ".", "getPathInfo", "(", ")", ",", "key", ")", ";", "}" ]
Get the variable element out of the Path Parameter, as set by initial Code @param req @param key @return
[ "Get", "the", "variable", "element", "out", "of", "the", "Path", "Parameter", "as", "set", "by", "initial", "Code" ]
train
https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/authz/authz-core/src/main/java/com/att/cssa/rserv/HttpCode.java#L61-L63
jcuda/jcuda
JCudaJava/src/main/java/jcuda/runtime/JCuda.java
JCuda.cudaMemset
public static int cudaMemset(Pointer mem, int c, long count) { return checkResult(cudaMemsetNative(mem, c, count)); }
java
public static int cudaMemset(Pointer mem, int c, long count) { return checkResult(cudaMemsetNative(mem, c, count)); }
[ "public", "static", "int", "cudaMemset", "(", "Pointer", "mem", ",", "int", "c", ",", "long", "count", ")", "{", "return", "checkResult", "(", "cudaMemsetNative", "(", "mem", ",", "c", ",", "count", ")", ")", ";", "}" ]
Initializes or sets device memory to a value. <pre> cudaError_t cudaMemset ( void* devPtr, int value, size_t count ) </pre> <div> <p>Initializes or sets device memory to a value. Fills the first <tt>count</tt> bytes of the memory area pointed to by <tt>devPtr</tt> with the constant byte value <tt>value</tt>. </p> <p>Note that this function is asynchronous with respect to the host unless <tt>devPtr</tt> refers to pinned host memory. </p> <div> <span>Note:</span> <ul> <li> <p>Note that this function may also return error codes from previous, asynchronous launches. </p> </li> </ul> </div> </p> </div> @param devPtr Pointer to device memory @param value Value to set for each byte of specified memory @param count Size in bytes to set @return cudaSuccess, cudaErrorInvalidValue, cudaErrorInvalidDevicePointer @see JCuda#cudaMemset2D @see JCuda#cudaMemset3D @see JCuda#cudaMemsetAsync @see JCuda#cudaMemset2DAsync @see JCuda#cudaMemset3DAsync
[ "Initializes", "or", "sets", "device", "memory", "to", "a", "value", "." ]
train
https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/runtime/JCuda.java#L6206-L6209
UrielCh/ovh-java-sdk
ovh-java-sdk-dedicatednasha/src/main/java/net/minidev/ovh/api/ApiOvhDedicatednasha.java
ApiOvhDedicatednasha.serviceName_partition_partitionName_snapshot_GET
public ArrayList<OvhSnapshotEnum> serviceName_partition_partitionName_snapshot_GET(String serviceName, String partitionName) throws IOException { String qPath = "/dedicated/nasha/{serviceName}/partition/{partitionName}/snapshot"; StringBuilder sb = path(qPath, serviceName, partitionName); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t4); }
java
public ArrayList<OvhSnapshotEnum> serviceName_partition_partitionName_snapshot_GET(String serviceName, String partitionName) throws IOException { String qPath = "/dedicated/nasha/{serviceName}/partition/{partitionName}/snapshot"; StringBuilder sb = path(qPath, serviceName, partitionName); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t4); }
[ "public", "ArrayList", "<", "OvhSnapshotEnum", ">", "serviceName_partition_partitionName_snapshot_GET", "(", "String", "serviceName", ",", "String", "partitionName", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/dedicated/nasha/{serviceName}/partition/{partitio...
Get scheduled snapshot types for this partition REST: GET /dedicated/nasha/{serviceName}/partition/{partitionName}/snapshot @param serviceName [required] The internal name of your storage @param partitionName [required] the given name of partition
[ "Get", "scheduled", "snapshot", "types", "for", "this", "partition" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatednasha/src/main/java/net/minidev/ovh/api/ApiOvhDedicatednasha.java#L325-L330
OpenLiberty/open-liberty
dev/com.ibm.ws.monitor/src/com/ibm/ws/pmi/server/NLS.java
NLS.getString
public String getString(String key) throws MissingResourceException { // Error Checking Trace. Ensure that we got a valid key if (key == null) { if (tc.isEventEnabled()) { // DGH20040823: Begin fix for defect 218797 - Source provided by Tom Musta // String msg = messages.getString("NLS.nullKey", // "Null lookup key passed to NLS"); String msg = getMessages().getString("NLS.nullKey", "Null lookup key passed to NLS"); // DGH20040823: End fix for defect 218797 - Source provided by Tom Musta Tr.warning(tc, msg); } return null; } // Error Checking Trace. Ensure that we got a valid bundle. if (bundle == null) { if (tc.isEventEnabled()) { // DGH20040823: Begin fix for defect 218797 - Source provided by Tom Musta // String msg = messages.getString("NLS.noBundles", // "Encountered an internal error. No valid bundles."); String msg = getMessages().getString("NLS.noBundles", "Encountered an internal error. No valid bundles."); // DGH20040823: End fix for defect 218797 - Source provided by Tom Musta Tr.warning(tc, msg); } throw new MissingResourceException(bundleName, bundleName, key); } // Return Code. String rtn = null; // Get the resource (string). rtn = bundle.getString(key); return rtn; }
java
public String getString(String key) throws MissingResourceException { // Error Checking Trace. Ensure that we got a valid key if (key == null) { if (tc.isEventEnabled()) { // DGH20040823: Begin fix for defect 218797 - Source provided by Tom Musta // String msg = messages.getString("NLS.nullKey", // "Null lookup key passed to NLS"); String msg = getMessages().getString("NLS.nullKey", "Null lookup key passed to NLS"); // DGH20040823: End fix for defect 218797 - Source provided by Tom Musta Tr.warning(tc, msg); } return null; } // Error Checking Trace. Ensure that we got a valid bundle. if (bundle == null) { if (tc.isEventEnabled()) { // DGH20040823: Begin fix for defect 218797 - Source provided by Tom Musta // String msg = messages.getString("NLS.noBundles", // "Encountered an internal error. No valid bundles."); String msg = getMessages().getString("NLS.noBundles", "Encountered an internal error. No valid bundles."); // DGH20040823: End fix for defect 218797 - Source provided by Tom Musta Tr.warning(tc, msg); } throw new MissingResourceException(bundleName, bundleName, key); } // Return Code. String rtn = null; // Get the resource (string). rtn = bundle.getString(key); return rtn; }
[ "public", "String", "getString", "(", "String", "key", ")", "throws", "MissingResourceException", "{", "// Error Checking Trace. Ensure that we got a valid key", "if", "(", "key", "==", "null", ")", "{", "if", "(", "tc", ".", "isEventEnabled", "(", ")", ")", "{",...
Overrides ResourceBundle.getString. Adds some error checking to ensure that we got a non-null key and resource bundle. @param key Name portion of "name=value" pair. @return rtn The resource string.
[ "Overrides", "ResourceBundle", ".", "getString", ".", "Adds", "some", "error", "checking", "to", "ensure", "that", "we", "got", "a", "non", "-", "null", "key", "and", "resource", "bundle", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.monitor/src/com/ibm/ws/pmi/server/NLS.java#L308-L341
gallandarakhneorg/afc
core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/GraphPath.java
GraphPath.splitAt
public GP splitAt(ST obj, PT startPoint) { return splitAt(indexOf(obj, startPoint), true); }
java
public GP splitAt(ST obj, PT startPoint) { return splitAt(indexOf(obj, startPoint), true); }
[ "public", "GP", "splitAt", "(", "ST", "obj", ",", "PT", "startPoint", ")", "{", "return", "splitAt", "(", "indexOf", "(", "obj", ",", "startPoint", ")", ",", "true", ")", ";", "}" ]
Split this path and retains the first part of the part in this object and reply the second part. The first occurrence of this specified element will be in the second part. <p>This function removes until the <i>last occurence</i> of the given object. @param obj the reference segment. @param startPoint is the starting point of the searched segment. @return the rest of the path after the first occurence of the given element.
[ "Split", "this", "path", "and", "retains", "the", "first", "part", "of", "the", "part", "in", "this", "object", "and", "reply", "the", "second", "part", ".", "The", "first", "occurrence", "of", "this", "specified", "element", "will", "be", "in", "the", "...
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/GraphPath.java#L1130-L1132
shrinkwrap/shrinkwrap
impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/tar/TarHeader.java
TarHeader.getNameBytes
public static int getNameBytes(StringBuffer name, byte[] buf, int offset, int length) { int i; for (i = 0; i < length && i < name.length(); ++i) { buf[offset + i] = (byte) name.charAt(i); } for (; i < length; ++i) { buf[offset + i] = 0; } return offset + length; }
java
public static int getNameBytes(StringBuffer name, byte[] buf, int offset, int length) { int i; for (i = 0; i < length && i < name.length(); ++i) { buf[offset + i] = (byte) name.charAt(i); } for (; i < length; ++i) { buf[offset + i] = 0; } return offset + length; }
[ "public", "static", "int", "getNameBytes", "(", "StringBuffer", "name", ",", "byte", "[", "]", "buf", ",", "int", "offset", ",", "int", "length", ")", "{", "int", "i", ";", "for", "(", "i", "=", "0", ";", "i", "<", "length", "&&", "i", "<", "name...
Move the bytes from the name StringBuffer into the header's buffer. @param header The header buffer into which to copy the name. @param offset The offset into the buffer at which to store. @param length The number of header bytes to store. @return The new offset (offset + length).
[ "Move", "the", "bytes", "from", "the", "name", "StringBuffer", "into", "the", "header", "s", "buffer", "." ]
train
https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/tar/TarHeader.java#L400-L412
JRebirth/JRebirth
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/ui/AbstractBaseController.java
AbstractBaseController.isEventType
private boolean isEventType(final EventType<? extends Event> testEventType, final EventType<? extends Event> anyEventType) { return testEventType.equals(anyEventType) || testEventType.getSuperType().equals(anyEventType); }
java
private boolean isEventType(final EventType<? extends Event> testEventType, final EventType<? extends Event> anyEventType) { return testEventType.equals(anyEventType) || testEventType.getSuperType().equals(anyEventType); }
[ "private", "boolean", "isEventType", "(", "final", "EventType", "<", "?", "extends", "Event", ">", "testEventType", ",", "final", "EventType", "<", "?", "extends", "Event", ">", "anyEventType", ")", "{", "return", "testEventType", ".", "equals", "(", "anyEvent...
Check the event type given and check the super level if necessary to always return the ANy event type. @param testEventType the sub event type or any instance @param anyEventType the eventype.ANY instance @return true if the ANY event type is the same for both objects
[ "Check", "the", "event", "type", "given", "and", "check", "the", "super", "level", "if", "necessary", "to", "always", "return", "the", "ANy", "event", "type", "." ]
train
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/ui/AbstractBaseController.java#L275-L277
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/BugInstance.java
BugInstance.addSourceLineRange
@Nonnull public BugInstance addSourceLineRange(ClassContext classContext, PreorderVisitor visitor, int startPC, int endPC) { SourceLineAnnotation sourceLineAnnotation = SourceLineAnnotation.fromVisitedInstructionRange(classContext, visitor, startPC, endPC); requireNonNull(sourceLineAnnotation); add(sourceLineAnnotation); return this; }
java
@Nonnull public BugInstance addSourceLineRange(ClassContext classContext, PreorderVisitor visitor, int startPC, int endPC) { SourceLineAnnotation sourceLineAnnotation = SourceLineAnnotation.fromVisitedInstructionRange(classContext, visitor, startPC, endPC); requireNonNull(sourceLineAnnotation); add(sourceLineAnnotation); return this; }
[ "@", "Nonnull", "public", "BugInstance", "addSourceLineRange", "(", "ClassContext", "classContext", ",", "PreorderVisitor", "visitor", ",", "int", "startPC", ",", "int", "endPC", ")", "{", "SourceLineAnnotation", "sourceLineAnnotation", "=", "SourceLineAnnotation", ".",...
Add a source line annotation describing the source line numbers for a range of instructions in the method being visited by the given visitor. Note that if the method does not have line number information, then no source line annotation will be added. @param classContext the ClassContext @param visitor a BetterVisitor which is visiting the method @param startPC the bytecode offset of the start instruction in the range @param endPC the bytecode offset of the end instruction in the range @return this object
[ "Add", "a", "source", "line", "annotation", "describing", "the", "source", "line", "numbers", "for", "a", "range", "of", "instructions", "in", "the", "method", "being", "visited", "by", "the", "given", "visitor", ".", "Note", "that", "if", "the", "method", ...
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/BugInstance.java#L1796-L1803
jbundle/jbundle
thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/BaseApplet.java
BaseApplet.setScreenProperties
public void setScreenProperties(PropertyOwner propertyOwner, Map<String,Object> properties) { Frame frame = ScreenUtil.getFrame(this); ScreenUtil.updateLookAndFeel((Frame)frame, propertyOwner, properties); Color colorBackgroundNew = ScreenUtil.getColor(ScreenUtil.BACKGROUND_COLOR, propertyOwner, properties); if (colorBackgroundNew != null) this.setBackgroundColor(colorBackgroundNew); }
java
public void setScreenProperties(PropertyOwner propertyOwner, Map<String,Object> properties) { Frame frame = ScreenUtil.getFrame(this); ScreenUtil.updateLookAndFeel((Frame)frame, propertyOwner, properties); Color colorBackgroundNew = ScreenUtil.getColor(ScreenUtil.BACKGROUND_COLOR, propertyOwner, properties); if (colorBackgroundNew != null) this.setBackgroundColor(colorBackgroundNew); }
[ "public", "void", "setScreenProperties", "(", "PropertyOwner", "propertyOwner", ",", "Map", "<", "String", ",", "Object", ">", "properties", ")", "{", "Frame", "frame", "=", "ScreenUtil", ".", "getFrame", "(", "this", ")", ";", "ScreenUtil", ".", "updateLookAn...
Change the screen properties to these properties. @param propertyOwner The properties to change to.
[ "Change", "the", "screen", "properties", "to", "these", "properties", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/BaseApplet.java#L1665-L1672
pmwmedia/tinylog
tinylog-impl/src/main/java/org/tinylog/writers/JdbcWriter.java
JdbcWriter.getUrl
private static String getUrl(final Map<String, String> properties) { String url = properties.get("url"); if (url == null) { throw new IllegalArgumentException("URL is missing for JDBC writer"); } else { return url; } }
java
private static String getUrl(final Map<String, String> properties) { String url = properties.get("url"); if (url == null) { throw new IllegalArgumentException("URL is missing for JDBC writer"); } else { return url; } }
[ "private", "static", "String", "getUrl", "(", "final", "Map", "<", "String", ",", "String", ">", "properties", ")", "{", "String", "url", "=", "properties", ".", "get", "(", "\"url\"", ")", ";", "if", "(", "url", "==", "null", ")", "{", "throw", "new...
Extracts the URL to database or data source from configuration. @param properties Configuration for writer @return Connection URL @throws IllegalArgumentException URL is not defined in configuration
[ "Extracts", "the", "URL", "to", "database", "or", "data", "source", "from", "configuration", "." ]
train
https://github.com/pmwmedia/tinylog/blob/d03d4ef84a1310155037e08ca8822a91697d1086/tinylog-impl/src/main/java/org/tinylog/writers/JdbcWriter.java#L322-L329
btc-ag/redg
redg-generator/src/main/java/com/btc/redg/generator/extractor/MetadataExtractor.java
MetadataExtractor.processJoinTables
private static void processJoinTables(final List<TableModel> result, final Map<String, Map<Table, List<String>>> joinTableMetadata) { joinTableMetadata.entrySet().forEach(entry -> { LOG.debug("Processing join tables for {}. Found {} join tables to process", entry.getKey(), entry.getValue().size()); final TableModel model = getModelBySQLName(result, entry.getKey()); if (model == null) { LOG.error("Could not find table {} in the already generated models! This should not happen!", entry.getKey()); throw new NullPointerException("Table model not found"); } entry.getValue().entrySet().forEach(tableListEntry -> { LOG.debug("Processing join table {}", tableListEntry.getKey().getFullName()); final TableModel joinTable = getModelBySQLName(result, tableListEntry.getKey().getFullName()); if (joinTable == null) { LOG.error("Could not find join table {} in the already generated models! This should not happen!", entry.getKey()); throw new NullPointerException("Table model not found"); } JoinTableSimplifierModel jtsModel = new JoinTableSimplifierModel(); jtsModel.setName(joinTable.getName()); for (ForeignKeyModel fKModel : joinTable.getForeignKeys()) { if (fKModel.getJavaTypeName().equals(model.getClassName())) { jtsModel.getConstructorParams().add("this"); } else { jtsModel.getConstructorParams().add(fKModel.getName()); jtsModel.getMethodParams().put(fKModel.getJavaTypeName(), fKModel.getName()); } } model.getJoinTableSimplifierData().put(joinTable.getClassName(), jtsModel); }); }); }
java
private static void processJoinTables(final List<TableModel> result, final Map<String, Map<Table, List<String>>> joinTableMetadata) { joinTableMetadata.entrySet().forEach(entry -> { LOG.debug("Processing join tables for {}. Found {} join tables to process", entry.getKey(), entry.getValue().size()); final TableModel model = getModelBySQLName(result, entry.getKey()); if (model == null) { LOG.error("Could not find table {} in the already generated models! This should not happen!", entry.getKey()); throw new NullPointerException("Table model not found"); } entry.getValue().entrySet().forEach(tableListEntry -> { LOG.debug("Processing join table {}", tableListEntry.getKey().getFullName()); final TableModel joinTable = getModelBySQLName(result, tableListEntry.getKey().getFullName()); if (joinTable == null) { LOG.error("Could not find join table {} in the already generated models! This should not happen!", entry.getKey()); throw new NullPointerException("Table model not found"); } JoinTableSimplifierModel jtsModel = new JoinTableSimplifierModel(); jtsModel.setName(joinTable.getName()); for (ForeignKeyModel fKModel : joinTable.getForeignKeys()) { if (fKModel.getJavaTypeName().equals(model.getClassName())) { jtsModel.getConstructorParams().add("this"); } else { jtsModel.getConstructorParams().add(fKModel.getName()); jtsModel.getMethodParams().put(fKModel.getJavaTypeName(), fKModel.getName()); } } model.getJoinTableSimplifierData().put(joinTable.getClassName(), jtsModel); }); }); }
[ "private", "static", "void", "processJoinTables", "(", "final", "List", "<", "TableModel", ">", "result", ",", "final", "Map", "<", "String", ",", "Map", "<", "Table", ",", "List", "<", "String", ">", ">", ">", "joinTableMetadata", ")", "{", "joinTableMeta...
Processes the information about the join tables that were collected during table model extraction. @param result The already processed tables @param joinTableMetadata The metadata about the join tables
[ "Processes", "the", "information", "about", "the", "join", "tables", "that", "were", "collected", "during", "table", "model", "extraction", "." ]
train
https://github.com/btc-ag/redg/blob/416a68639d002512cabfebff09afd2e1909e27df/redg-generator/src/main/java/com/btc/redg/generator/extractor/MetadataExtractor.java#L84-L113
bozaro/git-lfs-java
gitlfs-pointer/src/main/java/ru/bozaro/gitlfs/pointer/Pointer.java
Pointer.parsePointer
@Nullable public static Map<String, String> parsePointer(@NotNull InputStream stream) throws IOException { byte[] buffer = new byte[Constants.POINTER_MAX_SIZE]; int size = 0; while (size < buffer.length) { int len = stream.read(buffer, size, buffer.length - size); if (len <= 0) { return parsePointer(buffer, 0, size); } size += len; } return null; }
java
@Nullable public static Map<String, String> parsePointer(@NotNull InputStream stream) throws IOException { byte[] buffer = new byte[Constants.POINTER_MAX_SIZE]; int size = 0; while (size < buffer.length) { int len = stream.read(buffer, size, buffer.length - size); if (len <= 0) { return parsePointer(buffer, 0, size); } size += len; } return null; }
[ "@", "Nullable", "public", "static", "Map", "<", "String", ",", "String", ">", "parsePointer", "(", "@", "NotNull", "InputStream", "stream", ")", "throws", "IOException", "{", "byte", "[", "]", "buffer", "=", "new", "byte", "[", "Constants", ".", "POINTER_...
Read pointer data. @param stream Input stream. @return Return pointer info or null if blob is not a pointer data.
[ "Read", "pointer", "data", "." ]
train
https://github.com/bozaro/git-lfs-java/blob/ee05bf0472ee61bf362cf93d283e5ee5d44ef685/gitlfs-pointer/src/main/java/ru/bozaro/gitlfs/pointer/Pointer.java#L91-L103
diirt/util
src/main/java/org/epics/util/stats/Ranges.java
Ranges.contains
public static boolean contains(Range range, Range subrange) { return range.getMinimum().doubleValue() <= subrange.getMinimum().doubleValue() && range.getMaximum().doubleValue() >= subrange.getMaximum().doubleValue(); }
java
public static boolean contains(Range range, Range subrange) { return range.getMinimum().doubleValue() <= subrange.getMinimum().doubleValue() && range.getMaximum().doubleValue() >= subrange.getMaximum().doubleValue(); }
[ "public", "static", "boolean", "contains", "(", "Range", "range", ",", "Range", "subrange", ")", "{", "return", "range", ".", "getMinimum", "(", ")", ".", "doubleValue", "(", ")", "<=", "subrange", ".", "getMinimum", "(", ")", ".", "doubleValue", "(", ")...
Determines whether the subrange is contained in the range or not. @param range a range @param subrange a possible subrange @return true if subrange is contained in range
[ "Determines", "whether", "the", "subrange", "is", "contained", "in", "the", "range", "or", "not", "." ]
train
https://github.com/diirt/util/blob/24aca0a173a635aaf0b78d213a3fee8d4f91c077/src/main/java/org/epics/util/stats/Ranges.java#L70-L74
apache/incubator-atlas
client/src/main/java/org/apache/atlas/AtlasClient.java
AtlasClient.searchByFullText
public JSONObject searchByFullText(final String query, final int limit, final int offset) throws AtlasServiceException { return callAPIWithRetries(API.SEARCH_FULL_TEXT, null, new ResourceCreator() { @Override public WebResource createResource() { WebResource resource = getResource(API.SEARCH_FULL_TEXT); resource = resource.queryParam(QUERY, query); resource = resource.queryParam(LIMIT, String.valueOf(limit)); resource = resource.queryParam(OFFSET, String.valueOf(offset)); return resource; } }); }
java
public JSONObject searchByFullText(final String query, final int limit, final int offset) throws AtlasServiceException { return callAPIWithRetries(API.SEARCH_FULL_TEXT, null, new ResourceCreator() { @Override public WebResource createResource() { WebResource resource = getResource(API.SEARCH_FULL_TEXT); resource = resource.queryParam(QUERY, query); resource = resource.queryParam(LIMIT, String.valueOf(limit)); resource = resource.queryParam(OFFSET, String.valueOf(offset)); return resource; } }); }
[ "public", "JSONObject", "searchByFullText", "(", "final", "String", "query", ",", "final", "int", "limit", ",", "final", "int", "offset", ")", "throws", "AtlasServiceException", "{", "return", "callAPIWithRetries", "(", "API", ".", "SEARCH_FULL_TEXT", ",", "null",...
Search given full text search @param query Query @param limit number of rows to be returned in the result, used for pagination. maxlimit > limit > 0. -1 maps to atlas.search.defaultlimit property value @param offset offset to the results returned, used for pagination. offset >= 0. -1 maps to offset 0 @return result json object @throws AtlasServiceException
[ "Search", "given", "full", "text", "search" ]
train
https://github.com/apache/incubator-atlas/blob/e0d2cdc27c32742ebecd24db4cca62dc04dcdf4b/client/src/main/java/org/apache/atlas/AtlasClient.java#L867-L878
Netflix/conductor
es5-persistence/src/main/java/com/netflix/conductor/dao/es5/index/ElasticSearchRestDAOV5.java
ElasticSearchRestDAOV5.initIndex
private void initIndex() throws Exception { //0. Add the tasklog template if (doesResourceNotExist("/_template/tasklog_template")) { logger.info("Creating the index template 'tasklog_template'"); InputStream stream = ElasticSearchDAOV5.class.getResourceAsStream("/template_tasklog.json"); byte[] templateSource = IOUtils.toByteArray(stream); HttpEntity entity = new NByteArrayEntity(templateSource, ContentType.APPLICATION_JSON); try { elasticSearchAdminClient.performRequest(HttpMethod.PUT, "/_template/tasklog_template", Collections.emptyMap(), entity); } catch (IOException e) { logger.error("Failed to initialize tasklog_template", e); } } }
java
private void initIndex() throws Exception { //0. Add the tasklog template if (doesResourceNotExist("/_template/tasklog_template")) { logger.info("Creating the index template 'tasklog_template'"); InputStream stream = ElasticSearchDAOV5.class.getResourceAsStream("/template_tasklog.json"); byte[] templateSource = IOUtils.toByteArray(stream); HttpEntity entity = new NByteArrayEntity(templateSource, ContentType.APPLICATION_JSON); try { elasticSearchAdminClient.performRequest(HttpMethod.PUT, "/_template/tasklog_template", Collections.emptyMap(), entity); } catch (IOException e) { logger.error("Failed to initialize tasklog_template", e); } } }
[ "private", "void", "initIndex", "(", ")", "throws", "Exception", "{", "//0. Add the tasklog template", "if", "(", "doesResourceNotExist", "(", "\"/_template/tasklog_template\"", ")", ")", "{", "logger", ".", "info", "(", "\"Creating the index template 'tasklog_template'\"",...
Initializes the index with the required templates and mappings.
[ "Initializes", "the", "index", "with", "the", "required", "templates", "and", "mappings", "." ]
train
https://github.com/Netflix/conductor/blob/78fae0ed9ddea22891f9eebb96a2ec0b2783dca0/es5-persistence/src/main/java/com/netflix/conductor/dao/es5/index/ElasticSearchRestDAOV5.java#L197-L212
Azure/azure-sdk-for-java
network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/NetworkInterfacesInner.java
NetworkInterfacesInner.getEffectiveRouteTableAsync
public Observable<EffectiveRouteListResultInner> getEffectiveRouteTableAsync(String resourceGroupName, String networkInterfaceName) { return getEffectiveRouteTableWithServiceResponseAsync(resourceGroupName, networkInterfaceName).map(new Func1<ServiceResponse<EffectiveRouteListResultInner>, EffectiveRouteListResultInner>() { @Override public EffectiveRouteListResultInner call(ServiceResponse<EffectiveRouteListResultInner> response) { return response.body(); } }); }
java
public Observable<EffectiveRouteListResultInner> getEffectiveRouteTableAsync(String resourceGroupName, String networkInterfaceName) { return getEffectiveRouteTableWithServiceResponseAsync(resourceGroupName, networkInterfaceName).map(new Func1<ServiceResponse<EffectiveRouteListResultInner>, EffectiveRouteListResultInner>() { @Override public EffectiveRouteListResultInner call(ServiceResponse<EffectiveRouteListResultInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "EffectiveRouteListResultInner", ">", "getEffectiveRouteTableAsync", "(", "String", "resourceGroupName", ",", "String", "networkInterfaceName", ")", "{", "return", "getEffectiveRouteTableWithServiceResponseAsync", "(", "resourceGroupName", ",", "net...
Gets all route tables applied to a network interface. @param resourceGroupName The name of the resource group. @param networkInterfaceName The name of the network interface. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Gets", "all", "route", "tables", "applied", "to", "a", "network", "interface", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/NetworkInterfacesInner.java#L1217-L1224
Azure/azure-sdk-for-java
appservice/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/appservice/v2016_03_01/implementation/ResourceHealthMetadatasInner.java
ResourceHealthMetadatasInner.getBySiteAsync
public Observable<ResourceHealthMetadataInner> getBySiteAsync(String resourceGroupName, String name) { return getBySiteWithServiceResponseAsync(resourceGroupName, name).map(new Func1<ServiceResponse<ResourceHealthMetadataInner>, ResourceHealthMetadataInner>() { @Override public ResourceHealthMetadataInner call(ServiceResponse<ResourceHealthMetadataInner> response) { return response.body(); } }); }
java
public Observable<ResourceHealthMetadataInner> getBySiteAsync(String resourceGroupName, String name) { return getBySiteWithServiceResponseAsync(resourceGroupName, name).map(new Func1<ServiceResponse<ResourceHealthMetadataInner>, ResourceHealthMetadataInner>() { @Override public ResourceHealthMetadataInner call(ServiceResponse<ResourceHealthMetadataInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ResourceHealthMetadataInner", ">", "getBySiteAsync", "(", "String", "resourceGroupName", ",", "String", "name", ")", "{", "return", "getBySiteWithServiceResponseAsync", "(", "resourceGroupName", ",", "name", ")", ".", "map", "(", "new", ...
Gets the category of ResourceHealthMetadata to use for the given site. Gets the category of ResourceHealthMetadata to use for the given site. @param resourceGroupName Name of the resource group to which the resource belongs. @param name Name of web app @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ResourceHealthMetadataInner object
[ "Gets", "the", "category", "of", "ResourceHealthMetadata", "to", "use", "for", "the", "given", "site", ".", "Gets", "the", "category", "of", "ResourceHealthMetadata", "to", "use", "for", "the", "given", "site", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/appservice/v2016_03_01/implementation/ResourceHealthMetadatasInner.java#L501-L508
h2oai/h2o-2
src/main/java/water/Key.java
Key.make
static public Key make(String s, byte rf, byte systemType, H2ONode... replicas) { return make(decodeKeyName(s),rf,systemType,replicas); }
java
static public Key make(String s, byte rf, byte systemType, H2ONode... replicas) { return make(decodeKeyName(s),rf,systemType,replicas); }
[ "static", "public", "Key", "make", "(", "String", "s", ",", "byte", "rf", ",", "byte", "systemType", ",", "H2ONode", "...", "replicas", ")", "{", "return", "make", "(", "decodeKeyName", "(", "s", ")", ",", "rf", ",", "systemType", ",", "replicas", ")",...
If the addresses are not specified, returns a key with no home information.
[ "If", "the", "addresses", "are", "not", "specified", "returns", "a", "key", "with", "no", "home", "information", "." ]
train
https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/Key.java#L252-L254
mirage-sql/mirage
src/main/java/com/miragesql/miragesql/SqlExecutor.java
SqlExecutor.setParameters
@SuppressWarnings("unchecked") protected void setParameters(PreparedStatement stmt, PropertyDesc[] propDescs, Object entity) throws SQLException { for (int i = 0; i < propDescs.length; i++) { PropertyDesc propertyDesc = propDescs[i]; if(propertyDesc == null /*|| propertyDesc.getValue(entity) == null*/){ stmt.setObject(i + 1, null); } else { Class<?> propertType = propertyDesc.getPropertyType(); @SuppressWarnings("rawtypes") ValueType valueType = MirageUtil.getValueType(propertType, propertyDesc, dialect, valueTypes); if(valueType != null){ valueType.set(propertType, stmt, propertyDesc.getValue(entity), i + 1); } else { if(logger.isWarnEnabled()) { logger.warn("valueType for " + propertType.getName() + " not found."); } } } } }
java
@SuppressWarnings("unchecked") protected void setParameters(PreparedStatement stmt, PropertyDesc[] propDescs, Object entity) throws SQLException { for (int i = 0; i < propDescs.length; i++) { PropertyDesc propertyDesc = propDescs[i]; if(propertyDesc == null /*|| propertyDesc.getValue(entity) == null*/){ stmt.setObject(i + 1, null); } else { Class<?> propertType = propertyDesc.getPropertyType(); @SuppressWarnings("rawtypes") ValueType valueType = MirageUtil.getValueType(propertType, propertyDesc, dialect, valueTypes); if(valueType != null){ valueType.set(propertType, stmt, propertyDesc.getValue(entity), i + 1); } else { if(logger.isWarnEnabled()) { logger.warn("valueType for " + propertType.getName() + " not found."); } } } } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "protected", "void", "setParameters", "(", "PreparedStatement", "stmt", ",", "PropertyDesc", "[", "]", "propDescs", ",", "Object", "entity", ")", "throws", "SQLException", "{", "for", "(", "int", "i", "=", "0...
Sets parameters to the PreparedStatement. @param stmt the prepared statement @param propDescs the property descriptors @param entity the entity @throws SQLException if something goes wrong
[ "Sets", "parameters", "to", "the", "PreparedStatement", "." ]
train
https://github.com/mirage-sql/mirage/blob/29a44b7ad267b5a48bc250cd0ef7d74813d46889/src/main/java/com/miragesql/miragesql/SqlExecutor.java#L468-L487
robinst/autolink-java
src/main/java/org/nibor/autolink/Autolink.java
Autolink.renderLinks
@Deprecated public static String renderLinks(CharSequence input, Iterable<LinkSpan> links, LinkRenderer linkRenderer) { if (input == null) { throw new NullPointerException("input must not be null"); } if (links == null) { throw new NullPointerException("links must not be null"); } if (linkRenderer == null) { throw new NullPointerException("linkRenderer must not be null"); } StringBuilder sb = new StringBuilder(input.length() + 16); int lastIndex = 0; for (LinkSpan link : links) { sb.append(input, lastIndex, link.getBeginIndex()); linkRenderer.render(link, input, sb); lastIndex = link.getEndIndex(); } if (lastIndex < input.length()) { sb.append(input, lastIndex, input.length()); } return sb.toString(); }
java
@Deprecated public static String renderLinks(CharSequence input, Iterable<LinkSpan> links, LinkRenderer linkRenderer) { if (input == null) { throw new NullPointerException("input must not be null"); } if (links == null) { throw new NullPointerException("links must not be null"); } if (linkRenderer == null) { throw new NullPointerException("linkRenderer must not be null"); } StringBuilder sb = new StringBuilder(input.length() + 16); int lastIndex = 0; for (LinkSpan link : links) { sb.append(input, lastIndex, link.getBeginIndex()); linkRenderer.render(link, input, sb); lastIndex = link.getEndIndex(); } if (lastIndex < input.length()) { sb.append(input, lastIndex, input.length()); } return sb.toString(); }
[ "@", "Deprecated", "public", "static", "String", "renderLinks", "(", "CharSequence", "input", ",", "Iterable", "<", "LinkSpan", ">", "links", ",", "LinkRenderer", "linkRenderer", ")", "{", "if", "(", "input", "==", "null", ")", "{", "throw", "new", "NullPoin...
Render the supplied links from the supplied input text using a renderer. The parts of the text outside of links are added to the result without processing. @param input the input text, must not be null @param links the links to render, see {@link LinkExtractor} to extract them @param linkRenderer the link rendering implementation @return the rendered string @deprecated use {@link LinkExtractor#extractSpans(CharSequence)} instead
[ "Render", "the", "supplied", "links", "from", "the", "supplied", "input", "text", "using", "a", "renderer", ".", "The", "parts", "of", "the", "text", "outside", "of", "links", "are", "added", "to", "the", "result", "without", "processing", "." ]
train
https://github.com/robinst/autolink-java/blob/9b01c2620d450cd51942f4d092e4e7153980c6d8/src/main/java/org/nibor/autolink/Autolink.java#L18-L40
overturetool/overture
ide/debug/src/main/java/org/overture/ide/debug/utils/CharOperation.java
CharOperation.prefixEquals
public static final boolean prefixEquals(char[] prefix, char[] name) { int max = prefix.length; if (name.length < max) { return false; } for (int i = max; --i >= 0;) { // assumes the prefix is not larger than the name if (prefix[i] != name[i]) { return false; } } return true; }
java
public static final boolean prefixEquals(char[] prefix, char[] name) { int max = prefix.length; if (name.length < max) { return false; } for (int i = max; --i >= 0;) { // assumes the prefix is not larger than the name if (prefix[i] != name[i]) { return false; } } return true; }
[ "public", "static", "final", "boolean", "prefixEquals", "(", "char", "[", "]", "prefix", ",", "char", "[", "]", "name", ")", "{", "int", "max", "=", "prefix", ".", "length", ";", "if", "(", "name", ".", "length", "<", "max", ")", "{", "return", "fa...
Answers true if the given name starts with the given prefix, false otherwise. The comparison is case sensitive. <br> <br> For example: <ol> <li> <pre> prefix = { 'a' , 'b' } name = { 'a' , 'b', 'b', 'a', 'b', 'a' } result =&gt; true </pre> </li> <li> <pre> prefix = { 'a' , 'c' } name = { 'a' , 'b', 'b', 'a', 'b', 'a' } result =&gt; false </pre> </li> </ol> @param prefix the given prefix @param name the given name @return true if the given name starts with the given prefix, false otherwise @throws NullPointerException if the given name is null or if the given prefix is null
[ "Answers", "true", "if", "the", "given", "name", "starts", "with", "the", "given", "prefix", "false", "otherwise", ".", "The", "comparison", "is", "case", "sensitive", ".", "<br", ">", "<br", ">", "For", "example", ":", "<ol", ">", "<li", ">" ]
train
https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/ide/debug/src/main/java/org/overture/ide/debug/utils/CharOperation.java#L3151-L3168
UrielCh/ovh-java-sdk
ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java
ApiOvhIp.loadBalancing_serviceName_probeIp_GET
public ArrayList<String> loadBalancing_serviceName_probeIp_GET(String serviceName, OvhLoadBalancingZoneEnum zone) throws IOException { String qPath = "/ip/loadBalancing/{serviceName}/probeIp"; StringBuilder sb = path(qPath, serviceName); query(sb, "zone", zone); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t2); }
java
public ArrayList<String> loadBalancing_serviceName_probeIp_GET(String serviceName, OvhLoadBalancingZoneEnum zone) throws IOException { String qPath = "/ip/loadBalancing/{serviceName}/probeIp"; StringBuilder sb = path(qPath, serviceName); query(sb, "zone", zone); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t2); }
[ "public", "ArrayList", "<", "String", ">", "loadBalancing_serviceName_probeIp_GET", "(", "String", "serviceName", ",", "OvhLoadBalancingZoneEnum", "zone", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/ip/loadBalancing/{serviceName}/probeIp\"", ";", "StringB...
Ip subnet used to send probes to your backends REST: GET /ip/loadBalancing/{serviceName}/probeIp @param zone [required] one of your ip loadbalancing's zone @param serviceName [required] The internal name of your IP load balancing
[ "Ip", "subnet", "used", "to", "send", "probes", "to", "your", "backends" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java#L1584-L1590
baasbox/Android-SDK
library/src/main/java/com/baasbox/android/BaasDocument.java
BaasDocument.fetchAll
public static RequestToken fetchAll(String collection, BaasQuery.Criteria filter, int flags, BaasHandler<List<BaasDocument>> handler) { BaasBox box = BaasBox.getDefaultChecked(); if (collection == null) throw new IllegalArgumentException("collection cannot be null"); Fetch f = new Fetch(box, collection, filter, flags, handler); return box.submitAsync(f); }
java
public static RequestToken fetchAll(String collection, BaasQuery.Criteria filter, int flags, BaasHandler<List<BaasDocument>> handler) { BaasBox box = BaasBox.getDefaultChecked(); if (collection == null) throw new IllegalArgumentException("collection cannot be null"); Fetch f = new Fetch(box, collection, filter, flags, handler); return box.submitAsync(f); }
[ "public", "static", "RequestToken", "fetchAll", "(", "String", "collection", ",", "BaasQuery", ".", "Criteria", "filter", ",", "int", "flags", ",", "BaasHandler", "<", "List", "<", "BaasDocument", ">", ">", "handler", ")", "{", "BaasBox", "box", "=", "BaasBo...
Asynchronously retrieves the list of documents readable to the user in <code>collection</code> @param collection the collection to retrieve not <code>null</code> @param flags {@link RequestOptions} @param handler a callback to be invoked with the result of the request @return a {@link com.baasbox.android.RequestToken} to handle the asynchronous request
[ "Asynchronously", "retrieves", "the", "list", "of", "documents", "readable", "to", "the", "user", "in", "<code", ">", "collection<", "/", "code", ">" ]
train
https://github.com/baasbox/Android-SDK/blob/6bb2203246b885b2ad63a7bfaf37c83caf15e0d8/library/src/main/java/com/baasbox/android/BaasDocument.java#L258-L263
VoltDB/voltdb
third_party/java/src/org/apache/commons_voltpatches/cli/HelpFormatter.java
HelpFormatter.printHelp
public void printHelp(String cmdLineSyntax, Options options) { printHelp(getWidth(), cmdLineSyntax, null, options, null, false); }
java
public void printHelp(String cmdLineSyntax, Options options) { printHelp(getWidth(), cmdLineSyntax, null, options, null, false); }
[ "public", "void", "printHelp", "(", "String", "cmdLineSyntax", ",", "Options", "options", ")", "{", "printHelp", "(", "getWidth", "(", ")", ",", "cmdLineSyntax", ",", "null", ",", "options", ",", "null", ",", "false", ")", ";", "}" ]
Print the help for <code>options</code> with the specified command line syntax. This method prints help information to System.out. @param cmdLineSyntax the syntax for this application @param options the Options instance
[ "Print", "the", "help", "for", "<code", ">", "options<", "/", "code", ">", "with", "the", "specified", "command", "line", "syntax", ".", "This", "method", "prints", "help", "information", "to", "System", ".", "out", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/org/apache/commons_voltpatches/cli/HelpFormatter.java#L406-L409
jhy/jsoup
src/main/java/org/jsoup/parser/CharacterReader.java
CharacterReader.cacheString
private static String cacheString(final char[] charBuf, final String[] stringCache, final int start, final int count) { // limit (no cache): if (count > maxStringCacheLen) return new String(charBuf, start, count); if (count < 1) return ""; // calculate hash: int hash = 0; int offset = start; for (int i = 0; i < count; i++) { hash = 31 * hash + charBuf[offset++]; } // get from cache final int index = hash & stringCache.length - 1; String cached = stringCache[index]; if (cached == null) { // miss, add cached = new String(charBuf, start, count); stringCache[index] = cached; } else { // hashcode hit, check equality if (rangeEquals(charBuf, start, count, cached)) { // hit return cached; } else { // hashcode conflict cached = new String(charBuf, start, count); stringCache[index] = cached; // update the cache, as recently used strings are more likely to show up again } } return cached; }
java
private static String cacheString(final char[] charBuf, final String[] stringCache, final int start, final int count) { // limit (no cache): if (count > maxStringCacheLen) return new String(charBuf, start, count); if (count < 1) return ""; // calculate hash: int hash = 0; int offset = start; for (int i = 0; i < count; i++) { hash = 31 * hash + charBuf[offset++]; } // get from cache final int index = hash & stringCache.length - 1; String cached = stringCache[index]; if (cached == null) { // miss, add cached = new String(charBuf, start, count); stringCache[index] = cached; } else { // hashcode hit, check equality if (rangeEquals(charBuf, start, count, cached)) { // hit return cached; } else { // hashcode conflict cached = new String(charBuf, start, count); stringCache[index] = cached; // update the cache, as recently used strings are more likely to show up again } } return cached; }
[ "private", "static", "String", "cacheString", "(", "final", "char", "[", "]", "charBuf", ",", "final", "String", "[", "]", "stringCache", ",", "final", "int", "start", ",", "final", "int", "count", ")", "{", "// limit (no cache):", "if", "(", "count", ">",...
Caches short strings, as a flywheel pattern, to reduce GC load. Just for this doc, to prevent leaks. <p /> Simplistic, and on hash collisions just falls back to creating a new string, vs a full HashMap with Entry list. That saves both having to create objects as hash keys, and running through the entry list, at the expense of some more duplicates.
[ "Caches", "short", "strings", "as", "a", "flywheel", "pattern", "to", "reduce", "GC", "load", ".", "Just", "for", "this", "doc", "to", "prevent", "leaks", ".", "<p", "/", ">", "Simplistic", "and", "on", "hash", "collisions", "just", "falls", "back", "to"...
train
https://github.com/jhy/jsoup/blob/68ff8cbe7ad847059737a09c567a501a7f1d251f/src/main/java/org/jsoup/parser/CharacterReader.java#L463-L493