repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
188
func_name
stringlengths
7
127
whole_func_string
stringlengths
77
3.91k
language
stringclasses
1 value
func_code_string
stringlengths
77
3.91k
func_code_tokens
listlengths
20
745
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
477
split_name
stringclasses
1 value
func_code_url
stringlengths
111
288
cdapio/tephra
tephra-hbase-compat-1.1/src/main/java/co/cask/tephra/hbase11/coprocessor/TransactionProcessor.java
TransactionProcessor.getTransactionFilter
protected Filter getTransactionFilter(Transaction tx, ScanType type, Filter filter) { return TransactionFilters.getVisibilityFilter(tx, ttlByFamily, allowEmptyValues, type, filter); }
java
protected Filter getTransactionFilter(Transaction tx, ScanType type, Filter filter) { return TransactionFilters.getVisibilityFilter(tx, ttlByFamily, allowEmptyValues, type, filter); }
[ "protected", "Filter", "getTransactionFilter", "(", "Transaction", "tx", ",", "ScanType", "type", ",", "Filter", "filter", ")", "{", "return", "TransactionFilters", ".", "getVisibilityFilter", "(", "tx", ",", "ttlByFamily", ",", "allowEmptyValues", ",", "type", ",...
Derived classes can override this method to customize the filter used to return data visible for the current transaction. @param tx the current transaction to apply @param type the type of scan being performed
[ "Derived", "classes", "can", "override", "this", "method", "to", "customize", "the", "filter", "used", "to", "return", "data", "visible", "for", "the", "current", "transaction", "." ]
train
https://github.com/cdapio/tephra/blob/082c56c15c6ece15002631ff6f89206a00d8915c/tephra-hbase-compat-1.1/src/main/java/co/cask/tephra/hbase11/coprocessor/TransactionProcessor.java#L314-L316
spring-projects/spring-loaded
springloaded/src/main/java/org/springsource/loaded/TypeRegistry.java
TypeRegistry.getReloadableType
@UsedByGeneratedCode public static ReloadableType getReloadableType(int typeRegistryId, int typeId) { if (GlobalConfiguration.verboseMode && log.isLoggable(Level.INFO)) { log.info( ">TypeRegistry.getReloadableType(typeRegistryId=" + typeRegistryId + ",typeId=" + typeId + ")"); } TypeRegistry typeRegistry = registryInstances[typeRegistryId].get(); if (typeRegistry == null) { throw new IllegalStateException("Request to access registry id " + typeRegistryId + " but no registry with that id has been created"); } ReloadableType reloadableType = typeRegistry.getReloadableType(typeId); if (reloadableType == null) { throw new IllegalStateException("The type registry " + typeRegistry + " does not know about type id " + typeId); } reloadableType.setResolved(); if (GlobalConfiguration.verboseMode && log.isLoggable(Level.INFO)) { log.info("<TypeRegistry.getReloadableType(typeRegistryId=" + typeRegistryId + ",typeId=" + typeId + ") returning " + reloadableType); } reloadableType.createTypeAssociations(); return reloadableType; }
java
@UsedByGeneratedCode public static ReloadableType getReloadableType(int typeRegistryId, int typeId) { if (GlobalConfiguration.verboseMode && log.isLoggable(Level.INFO)) { log.info( ">TypeRegistry.getReloadableType(typeRegistryId=" + typeRegistryId + ",typeId=" + typeId + ")"); } TypeRegistry typeRegistry = registryInstances[typeRegistryId].get(); if (typeRegistry == null) { throw new IllegalStateException("Request to access registry id " + typeRegistryId + " but no registry with that id has been created"); } ReloadableType reloadableType = typeRegistry.getReloadableType(typeId); if (reloadableType == null) { throw new IllegalStateException("The type registry " + typeRegistry + " does not know about type id " + typeId); } reloadableType.setResolved(); if (GlobalConfiguration.verboseMode && log.isLoggable(Level.INFO)) { log.info("<TypeRegistry.getReloadableType(typeRegistryId=" + typeRegistryId + ",typeId=" + typeId + ") returning " + reloadableType); } reloadableType.createTypeAssociations(); return reloadableType; }
[ "@", "UsedByGeneratedCode", "public", "static", "ReloadableType", "getReloadableType", "(", "int", "typeRegistryId", ",", "int", "typeId", ")", "{", "if", "(", "GlobalConfiguration", ".", "verboseMode", "&&", "log", ".", "isLoggable", "(", "Level", ".", "INFO", ...
This method discovers the reloadable type instance for the registry and type id specified. @param typeRegistryId the type registry id @param typeId the type id @return the ReloadableType (if there is no ReloadableType an exception will be thrown)
[ "This", "method", "discovers", "the", "reloadable", "type", "instance", "for", "the", "registry", "and", "type", "id", "specified", "." ]
train
https://github.com/spring-projects/spring-loaded/blob/59b32f957a05c6d9f149148158053605e2a6205a/springloaded/src/main/java/org/springsource/loaded/TypeRegistry.java#L1906-L1929
nguillaumin/slick2d-maven
slick2d-hiero/src/main/java/org/newdawn/slick/tools/hiero/truetype/FontData.java
FontData.deriveFont
public FontData deriveFont(float size, int style) { FontData original = getStyled(getFamilyName(), style); FontData data = new FontData(); data.size = size; data.javaFont = original.javaFont.deriveFont(style, size); data.upem = upem; data.ansiKerning = ansiKerning; data.charWidth = charWidth; return data; }
java
public FontData deriveFont(float size, int style) { FontData original = getStyled(getFamilyName(), style); FontData data = new FontData(); data.size = size; data.javaFont = original.javaFont.deriveFont(style, size); data.upem = upem; data.ansiKerning = ansiKerning; data.charWidth = charWidth; return data; }
[ "public", "FontData", "deriveFont", "(", "float", "size", ",", "int", "style", ")", "{", "FontData", "original", "=", "getStyled", "(", "getFamilyName", "(", ")", ",", "style", ")", ";", "FontData", "data", "=", "new", "FontData", "(", ")", ";", "data", ...
Derive a new version of this font based on a new size @param size The size of the new font @param style The style of the new font @return The new font data
[ "Derive", "a", "new", "version", "of", "this", "font", "based", "on", "a", "new", "size" ]
train
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-hiero/src/main/java/org/newdawn/slick/tools/hiero/truetype/FontData.java#L438-L448
marklogic/marklogic-contentpump
mlcp/src/main/java/com/marklogic/contentpump/utilities/OptionsFileUtil.java
OptionsFileUtil.removeQuotesEncolosingOption
private static String removeQuotesEncolosingOption( String fileName, String option) throws Exception { // Attempt to remove double quotes. If successful, return. String option1 = removeQuoteCharactersIfNecessary(fileName, option, '"'); if (!option1.equals(option)) { // Quotes were successfully removed return option1; } // Attempt to remove single quotes. return removeQuoteCharactersIfNecessary(fileName, option, '\''); }
java
private static String removeQuotesEncolosingOption( String fileName, String option) throws Exception { // Attempt to remove double quotes. If successful, return. String option1 = removeQuoteCharactersIfNecessary(fileName, option, '"'); if (!option1.equals(option)) { // Quotes were successfully removed return option1; } // Attempt to remove single quotes. return removeQuoteCharactersIfNecessary(fileName, option, '\''); }
[ "private", "static", "String", "removeQuotesEncolosingOption", "(", "String", "fileName", ",", "String", "option", ")", "throws", "Exception", "{", "// Attempt to remove double quotes. If successful, return.", "String", "option1", "=", "removeQuoteCharactersIfNecessary", "(", ...
Removes the surrounding quote characters as needed. It first attempts to remove surrounding double quotes. If successful, the resultant string is returned. If no surrounding double quotes are found, it attempts to remove surrounding single quote characters. If successful, the resultant string is returned. If not the original string is returnred. @param fileName @param option @return @throws Exception
[ "Removes", "the", "surrounding", "quote", "characters", "as", "needed", ".", "It", "first", "attempts", "to", "remove", "surrounding", "double", "quotes", ".", "If", "successful", "the", "resultant", "string", "is", "returned", ".", "If", "no", "surrounding", ...
train
https://github.com/marklogic/marklogic-contentpump/blob/4c41e4a953301f81a4c655efb2a847603dee8afc/mlcp/src/main/java/com/marklogic/contentpump/utilities/OptionsFileUtil.java#L129-L141
spockframework/spock
spock-core/src/main/java/spock/util/concurrent/BlockingVariable.java
BlockingVariable.get
public T get() throws InterruptedException { if (!valueReady.await((long) (timeout * 1000), TimeUnit.MILLISECONDS)) { String msg = String.format("BlockingVariable.get() timed out after %1.2f seconds", timeout); throw new SpockTimeoutError(timeout, msg); } return value; }
java
public T get() throws InterruptedException { if (!valueReady.await((long) (timeout * 1000), TimeUnit.MILLISECONDS)) { String msg = String.format("BlockingVariable.get() timed out after %1.2f seconds", timeout); throw new SpockTimeoutError(timeout, msg); } return value; }
[ "public", "T", "get", "(", ")", "throws", "InterruptedException", "{", "if", "(", "!", "valueReady", ".", "await", "(", "(", "long", ")", "(", "timeout", "*", "1000", ")", ",", "TimeUnit", ".", "MILLISECONDS", ")", ")", "{", "String", "msg", "=", "St...
Blocks until a value has been set for this variable, or a timeout expires. @return the variable's value @throws InterruptedException if the calling thread is interrupted
[ "Blocks", "until", "a", "value", "has", "been", "set", "for", "this", "variable", "or", "a", "timeout", "expires", "." ]
train
https://github.com/spockframework/spock/blob/d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9/spock-core/src/main/java/spock/util/concurrent/BlockingVariable.java#L110-L116
liferay/com-liferay-commerce
commerce-currency-api/src/main/java/com/liferay/commerce/currency/service/persistence/CommerceCurrencyUtil.java
CommerceCurrencyUtil.removeByG_C
public static CommerceCurrency removeByG_C(long groupId, String code) throws com.liferay.commerce.currency.exception.NoSuchCurrencyException { return getPersistence().removeByG_C(groupId, code); }
java
public static CommerceCurrency removeByG_C(long groupId, String code) throws com.liferay.commerce.currency.exception.NoSuchCurrencyException { return getPersistence().removeByG_C(groupId, code); }
[ "public", "static", "CommerceCurrency", "removeByG_C", "(", "long", "groupId", ",", "String", "code", ")", "throws", "com", ".", "liferay", ".", "commerce", ".", "currency", ".", "exception", ".", "NoSuchCurrencyException", "{", "return", "getPersistence", "(", ...
Removes the commerce currency where groupId = &#63; and code = &#63; from the database. @param groupId the group ID @param code the code @return the commerce currency that was removed
[ "Removes", "the", "commerce", "currency", "where", "groupId", "=", "&#63", ";", "and", "code", "=", "&#63", ";", "from", "the", "database", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-currency-api/src/main/java/com/liferay/commerce/currency/service/persistence/CommerceCurrencyUtil.java#L707-L710
Azure/azure-sdk-for-java
privatedns/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/privatedns/v2018_09_01/implementation/VirtualNetworkLinksInner.java
VirtualNetworkLinksInner.createOrUpdate
public VirtualNetworkLinkInner createOrUpdate(String resourceGroupName, String privateZoneName, String virtualNetworkLinkName, VirtualNetworkLinkInner parameters, String ifMatch, String ifNoneMatch) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, privateZoneName, virtualNetworkLinkName, parameters, ifMatch, ifNoneMatch).toBlocking().last().body(); }
java
public VirtualNetworkLinkInner createOrUpdate(String resourceGroupName, String privateZoneName, String virtualNetworkLinkName, VirtualNetworkLinkInner parameters, String ifMatch, String ifNoneMatch) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, privateZoneName, virtualNetworkLinkName, parameters, ifMatch, ifNoneMatch).toBlocking().last().body(); }
[ "public", "VirtualNetworkLinkInner", "createOrUpdate", "(", "String", "resourceGroupName", ",", "String", "privateZoneName", ",", "String", "virtualNetworkLinkName", ",", "VirtualNetworkLinkInner", "parameters", ",", "String", "ifMatch", ",", "String", "ifNoneMatch", ")", ...
Creates or updates a virtual network link to the specified Private DNS zone. @param resourceGroupName The name of the resource group. @param privateZoneName The name of the Private DNS zone (without a terminating dot). @param virtualNetworkLinkName The name of the virtual network link. @param parameters Parameters supplied to the CreateOrUpdate operation. @param ifMatch The ETag of the virtual network link to the Private DNS zone. Omit this value to always overwrite the current virtual network link. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent changes. @param ifNoneMatch Set to '*' to allow a new virtual network link to the Private DNS zone to be created, but to prevent updating an existing link. Other values will be ignored. @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 VirtualNetworkLinkInner object if successful.
[ "Creates", "or", "updates", "a", "virtual", "network", "link", "to", "the", "specified", "Private", "DNS", "zone", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/privatedns/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/privatedns/v2018_09_01/implementation/VirtualNetworkLinksInner.java#L202-L204
mabe02/lanterna
src/main/java/com/googlecode/lanterna/TerminalTextUtils.java
TerminalTextUtils.getANSIControlSequenceAt
public static String getANSIControlSequenceAt(String string, int index) { int len = getANSIControlSequenceLength(string, index); return len == 0 ? null : string.substring(index,index+len); }
java
public static String getANSIControlSequenceAt(String string, int index) { int len = getANSIControlSequenceLength(string, index); return len == 0 ? null : string.substring(index,index+len); }
[ "public", "static", "String", "getANSIControlSequenceAt", "(", "String", "string", ",", "int", "index", ")", "{", "int", "len", "=", "getANSIControlSequenceLength", "(", "string", ",", "index", ")", ";", "return", "len", "==", "0", "?", "null", ":", "string"...
Given a string and an index in that string, returns the ANSI control sequence beginning on this index. If there is no control sequence starting there, the method will return null. The returned value is the complete escape sequence including the ESC prefix. @param string String to scan for control sequences @param index Index in the string where the control sequence begins @return {@code null} if there was no control sequence starting at the specified index, otherwise the entire control sequence
[ "Given", "a", "string", "and", "an", "index", "in", "that", "string", "returns", "the", "ANSI", "control", "sequence", "beginning", "on", "this", "index", ".", "If", "there", "is", "no", "control", "sequence", "starting", "there", "the", "method", "will", ...
train
https://github.com/mabe02/lanterna/blob/8dfd62206ff46ab10223b2ef2dbb0a2c51850954/src/main/java/com/googlecode/lanterna/TerminalTextUtils.java#L51-L54
xwiki/xwiki-commons
xwiki-commons-core/xwiki-commons-velocity/src/main/java/org/xwiki/velocity/introspection/DeprecatedCheckUberspector.java
DeprecatedCheckUberspector.logWarning
private void logWarning(String deprecationType, Object object, String methodName, Info info) { this.log.warn(String.format("Deprecated usage of %s [%s] in %s@%d,%d", deprecationType, object.getClass() .getCanonicalName() + "." + methodName, info.getTemplateName(), info.getLine(), info.getColumn())); }
java
private void logWarning(String deprecationType, Object object, String methodName, Info info) { this.log.warn(String.format("Deprecated usage of %s [%s] in %s@%d,%d", deprecationType, object.getClass() .getCanonicalName() + "." + methodName, info.getTemplateName(), info.getLine(), info.getColumn())); }
[ "private", "void", "logWarning", "(", "String", "deprecationType", ",", "Object", "object", ",", "String", "methodName", ",", "Info", "info", ")", "{", "this", ".", "log", ".", "warn", "(", "String", ".", "format", "(", "\"Deprecated usage of %s [%s] in %s@%d,%d...
Helper method to log a warning when a deprecation has been found. @param deprecationType the type of deprecation (eg "getter", "setter", "method") @param object the object that has a deprecation @param methodName the deprecated method's name @param info a Velocity {@link org.apache.velocity.util.introspection.Info} object containing information about where the deprecation was located in the Velocity template file
[ "Helper", "method", "to", "log", "a", "warning", "when", "a", "deprecation", "has", "been", "found", "." ]
train
https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-velocity/src/main/java/org/xwiki/velocity/introspection/DeprecatedCheckUberspector.java#L112-L116
rackerlabs/clouddocs-maven-plugin
src/main/java/com/rackspace/cloud/api/docs/calabash/extensions/util/RelativePath.java
RelativePath.getRelativePath
public static String getRelativePath(File home,File f){ List<String> homelist = getPathList(home); List<String> filelist = getPathList(f); String s = matchPathLists(homelist,filelist); return s; }
java
public static String getRelativePath(File home,File f){ List<String> homelist = getPathList(home); List<String> filelist = getPathList(f); String s = matchPathLists(homelist,filelist); return s; }
[ "public", "static", "String", "getRelativePath", "(", "File", "home", ",", "File", "f", ")", "{", "List", "<", "String", ">", "homelist", "=", "getPathList", "(", "home", ")", ";", "List", "<", "String", ">", "filelist", "=", "getPathList", "(", "f", "...
get relative path of File 'f' with respect to 'home' directory example : home = /a/b/c f = /a/d/e/x.txt s = getRelativePath(home,f) = ../../d/e/x.txt @param home base path, should be a directory, not a file, or it doesn't make sense @param f file to generate path for @return path from home to f as a string
[ "get", "relative", "path", "of", "File", "f", "with", "respect", "to", "home", "directory", "example", ":", "home", "=", "/", "a", "/", "b", "/", "c", "f", "=", "/", "a", "/", "d", "/", "e", "/", "x", ".", "txt", "s", "=", "getRelativePath", "(...
train
https://github.com/rackerlabs/clouddocs-maven-plugin/blob/ba8554dc340db674307efdaac647c6fd2b58a34b/src/main/java/com/rackspace/cloud/api/docs/calabash/extensions/util/RelativePath.java#L83-L89
wcm-io/wcm-io-wcm
ui/granite/src/main/java/io/wcm/wcm/ui/granite/components/pathfield/ColumnView.java
ColumnView.getDataSource
private DataSource getDataSource(ComponentHelper cmp, Resource resource) { try { /* * by default the path is read from request "path" parameter * here we overwrite it via a synthetic resource because the path may be overwritten by validation logic * to ensure the path is not beyond the configured root path */ ValueMap overwriteProperties = new ValueMapDecorator(ImmutableMap.<String, Object>of("path", resource.getPath())); Resource dataSourceResourceWrapper = GraniteUiSyntheticResource.wrapMerge(request.getResource(), overwriteProperties); return cmp.getItemDataSource(dataSourceResourceWrapper); } catch (ServletException | IOException ex) { throw new RuntimeException("Unable to get data source.", ex); } }
java
private DataSource getDataSource(ComponentHelper cmp, Resource resource) { try { /* * by default the path is read from request "path" parameter * here we overwrite it via a synthetic resource because the path may be overwritten by validation logic * to ensure the path is not beyond the configured root path */ ValueMap overwriteProperties = new ValueMapDecorator(ImmutableMap.<String, Object>of("path", resource.getPath())); Resource dataSourceResourceWrapper = GraniteUiSyntheticResource.wrapMerge(request.getResource(), overwriteProperties); return cmp.getItemDataSource(dataSourceResourceWrapper); } catch (ServletException | IOException ex) { throw new RuntimeException("Unable to get data source.", ex); } }
[ "private", "DataSource", "getDataSource", "(", "ComponentHelper", "cmp", ",", "Resource", "resource", ")", "{", "try", "{", "/*\n * by default the path is read from request \"path\" parameter\n * here we overwrite it via a synthetic resource because the path may be overwritten ...
Get data source to list children of given resource. @param cmp Component helper @param resource Given resource @return Data source
[ "Get", "data", "source", "to", "list", "children", "of", "given", "resource", "." ]
train
https://github.com/wcm-io/wcm-io-wcm/blob/8eff9434f2f4b6462fdb718f8769ad793c55b8d7/ui/granite/src/main/java/io/wcm/wcm/ui/granite/components/pathfield/ColumnView.java#L132-L146
phax/ph-commons
ph-jaxb/src/main/java/com/helger/jaxb/JAXBMarshallerHelper.java
JAXBMarshallerHelper.setFragment
public static void setFragment (@Nonnull final Marshaller aMarshaller, final boolean bFragment) { _setProperty (aMarshaller, Marshaller.JAXB_FRAGMENT, Boolean.valueOf (bFragment)); }
java
public static void setFragment (@Nonnull final Marshaller aMarshaller, final boolean bFragment) { _setProperty (aMarshaller, Marshaller.JAXB_FRAGMENT, Boolean.valueOf (bFragment)); }
[ "public", "static", "void", "setFragment", "(", "@", "Nonnull", "final", "Marshaller", "aMarshaller", ",", "final", "boolean", "bFragment", ")", "{", "_setProperty", "(", "aMarshaller", ",", "Marshaller", ".", "JAXB_FRAGMENT", ",", "Boolean", ".", "valueOf", "("...
Set the standard property for marshalling a fragment only. @param aMarshaller The marshaller to set the property. May not be <code>null</code>. @param bFragment the value to be set
[ "Set", "the", "standard", "property", "for", "marshalling", "a", "fragment", "only", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-jaxb/src/main/java/com/helger/jaxb/JAXBMarshallerHelper.java#L187-L190
Azure/azure-sdk-for-java
sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerUsagesInner.java
ServerUsagesInner.listByServerAsync
public Observable<List<ServerUsageInner>> listByServerAsync(String resourceGroupName, String serverName) { return listByServerWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1<ServiceResponse<List<ServerUsageInner>>, List<ServerUsageInner>>() { @Override public List<ServerUsageInner> call(ServiceResponse<List<ServerUsageInner>> response) { return response.body(); } }); }
java
public Observable<List<ServerUsageInner>> listByServerAsync(String resourceGroupName, String serverName) { return listByServerWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1<ServiceResponse<List<ServerUsageInner>>, List<ServerUsageInner>>() { @Override public List<ServerUsageInner> call(ServiceResponse<List<ServerUsageInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "List", "<", "ServerUsageInner", ">", ">", "listByServerAsync", "(", "String", "resourceGroupName", ",", "String", "serverName", ")", "{", "return", "listByServerWithServiceResponseAsync", "(", "resourceGroupName", ",", "serverName", ")", ...
Returns server usages. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the List&lt;ServerUsageInner&gt; object
[ "Returns", "server", "usages", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerUsagesInner.java#L96-L103
javers/javers
javers-core/src/main/java/org/javers/core/JaversBuilder.java
JaversBuilder.registerValueWithCustomToString
public <T> JaversBuilder registerValueWithCustomToString(Class<T> valueClass, Function<T, String> toString) { argumentsAreNotNull(valueClass, toString); if (!clientsClassDefinitions.containsKey(valueClass)){ registerType(new ValueDefinition(valueClass)); } ValueDefinition def = getClassDefinition(valueClass); def.setToStringFunction((Function)toString); return this; }
java
public <T> JaversBuilder registerValueWithCustomToString(Class<T> valueClass, Function<T, String> toString) { argumentsAreNotNull(valueClass, toString); if (!clientsClassDefinitions.containsKey(valueClass)){ registerType(new ValueDefinition(valueClass)); } ValueDefinition def = getClassDefinition(valueClass); def.setToStringFunction((Function)toString); return this; }
[ "public", "<", "T", ">", "JaversBuilder", "registerValueWithCustomToString", "(", "Class", "<", "T", ">", "valueClass", ",", "Function", "<", "T", ",", "String", ">", "toString", ")", "{", "argumentsAreNotNull", "(", "valueClass", ",", "toString", ")", ";", ...
For complex <code>ValueType</code> classes that are used as Entity Id. <br/><br/> Registers a custom <code>toString</code> function that will be used for creating <code>GlobalId</code> for Entities, instead of default {@link ReflectionUtil#reflectiveToString(Object)}. <br/><br/> For example: <pre> class Entity { &#64;Id Point id String data } class Point { double x double y String myToString() { "("+ (int)x +"," +(int)y + ")" } } def "should use custom toString function for complex Id"(){ given: Entity entity = new Entity( id: new Point(x: 1/3, y: 4/3)) when: "default reflectiveToString function" def javers = JaversBuilder.javers().build() GlobalId id = javers.getTypeMapping(Entity).createIdFromInstance(entity) then: id.value() == "com.mypackage.Entity/0.3333333333,1.3333333333" when: "custom toString function" javers = JaversBuilder.javers() .registerValueWithCustomToString(Point, {it.myToString()}).build() id = javers.getTypeMapping(Entity).createIdFromInstance(entity) then: id.value() == "com.mypackage.Entity/(0,1)" } </pre> For <code>ValueType</code> you can register both custom <code>toString</code> function and <code>CustomValueComparator</code>. @param toString should return String value of a given object @see ValueType @see #registerValue(Class, CustomValueComparator) @since 3.7.6
[ "For", "complex", "<code", ">", "ValueType<", "/", "code", ">", "classes", "that", "are", "used", "as", "Entity", "Id", ".", "<br", "/", ">", "<br", "/", ">" ]
train
https://github.com/javers/javers/blob/a51511be7d8bcee3e1812db8b7e69a45330b4e14/javers-core/src/main/java/org/javers/core/JaversBuilder.java#L444-L454
cerner/beadledom
client/resteasy-client/src/main/java/com/cerner/beadledom/client/resteasy/BeadledomResteasyClientBuilder.java
BeadledomResteasyClientBuilder.keyStore
@Override public BeadledomResteasyClientBuilder keyStore(KeyStore keyStore, char[] password) { this.clientKeyStore = keyStore; this.clientPrivateKeyPassword = new String(password); return this; }
java
@Override public BeadledomResteasyClientBuilder keyStore(KeyStore keyStore, char[] password) { this.clientKeyStore = keyStore; this.clientPrivateKeyPassword = new String(password); return this; }
[ "@", "Override", "public", "BeadledomResteasyClientBuilder", "keyStore", "(", "KeyStore", "keyStore", ",", "char", "[", "]", "password", ")", "{", "this", ".", "clientKeyStore", "=", "keyStore", ";", "this", ".", "clientPrivateKeyPassword", "=", "new", "String", ...
Sets the default SSL key store to be used if a {@link ClientHttpEngine} isn't specified via {@link #setHttpEngine(ClientHttpEngine)}. <p>If a {@link ClientHttpEngine} is specified via {@link #setHttpEngine(ClientHttpEngine)}, then this property will be ignored. <p>{@inheritDoc} @return this builder
[ "Sets", "the", "default", "SSL", "key", "store", "to", "be", "used", "if", "a", "{", "@link", "ClientHttpEngine", "}", "isn", "t", "specified", "via", "{", "@link", "#setHttpEngine", "(", "ClientHttpEngine", ")", "}", "." ]
train
https://github.com/cerner/beadledom/blob/75435bced5187d5455b46518fadf85c93cf32014/client/resteasy-client/src/main/java/com/cerner/beadledom/client/resteasy/BeadledomResteasyClientBuilder.java#L410-L415
auth0/Auth0.Android
auth0/src/main/java/com/auth0/android/authentication/storage/SecureCredentialsManager.java
SecureCredentialsManager.checkAuthenticationResult
public boolean checkAuthenticationResult(int requestCode, int resultCode) { if (requestCode != authenticationRequestCode || decryptCallback == null) { return false; } if (resultCode == Activity.RESULT_OK) { continueGetCredentials(decryptCallback); } else { decryptCallback.onFailure(new CredentialsManagerException("The user didn't pass the authentication challenge.")); decryptCallback = null; } return true; }
java
public boolean checkAuthenticationResult(int requestCode, int resultCode) { if (requestCode != authenticationRequestCode || decryptCallback == null) { return false; } if (resultCode == Activity.RESULT_OK) { continueGetCredentials(decryptCallback); } else { decryptCallback.onFailure(new CredentialsManagerException("The user didn't pass the authentication challenge.")); decryptCallback = null; } return true; }
[ "public", "boolean", "checkAuthenticationResult", "(", "int", "requestCode", ",", "int", "resultCode", ")", "{", "if", "(", "requestCode", "!=", "authenticationRequestCode", "||", "decryptCallback", "==", "null", ")", "{", "return", "false", ";", "}", "if", "(",...
Checks the result after showing the LockScreen to the user. Must be called from the {@link Activity#onActivityResult(int, int, Intent)} method with the received parameters. It's safe to call this method even if {@link SecureCredentialsManager#requireAuthentication(Activity, int, String, String)} was unsuccessful. @param requestCode the request code received in the onActivityResult call. @param resultCode the result code received in the onActivityResult call. @return true if the result was handled, false otherwise.
[ "Checks", "the", "result", "after", "showing", "the", "LockScreen", "to", "the", "user", ".", "Must", "be", "called", "from", "the", "{", "@link", "Activity#onActivityResult", "(", "int", "int", "Intent", ")", "}", "method", "with", "the", "received", "param...
train
https://github.com/auth0/Auth0.Android/blob/ee37b7f94d989c1fbab2cb1378c87fdcaf7a8156/auth0/src/main/java/com/auth0/android/authentication/storage/SecureCredentialsManager.java#L117-L128
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java
FSDirectory.unprotectedHardLinkTo
boolean unprotectedHardLinkTo(String src, String dst, long timestamp) throws QuotaExceededException, FileNotFoundException { return unprotectedHardLinkTo(src, null, null, null, dst, null, null, null, timestamp); }
java
boolean unprotectedHardLinkTo(String src, String dst, long timestamp) throws QuotaExceededException, FileNotFoundException { return unprotectedHardLinkTo(src, null, null, null, dst, null, null, null, timestamp); }
[ "boolean", "unprotectedHardLinkTo", "(", "String", "src", ",", "String", "dst", ",", "long", "timestamp", ")", "throws", "QuotaExceededException", ",", "FileNotFoundException", "{", "return", "unprotectedHardLinkTo", "(", "src", ",", "null", ",", "null", ",", "nul...
hard link the dst path to the src path @param src source path @param dst destination path @param timestamp The modification timestamp for the dst's parent directory @return true if the hardLink succeeds; false otherwise @throws QuotaExceededException if the operation violates any quota limit @throws FileNotFoundException
[ "hard", "link", "the", "dst", "path", "to", "the", "src", "path" ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java#L596-L599
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/SerializerBase.java
SerializerBase.addAttribute
public void addAttribute(String name, final String value) { if (m_elemContext.m_startTagOpen) { final String patchedName = patchName(name); final String localName = getLocalName(patchedName); final String uri = getNamespaceURI(patchedName, false); addAttributeAlways(uri,localName, patchedName, "CDATA", value, false); } }
java
public void addAttribute(String name, final String value) { if (m_elemContext.m_startTagOpen) { final String patchedName = patchName(name); final String localName = getLocalName(patchedName); final String uri = getNamespaceURI(patchedName, false); addAttributeAlways(uri,localName, patchedName, "CDATA", value, false); } }
[ "public", "void", "addAttribute", "(", "String", "name", ",", "final", "String", "value", ")", "{", "if", "(", "m_elemContext", ".", "m_startTagOpen", ")", "{", "final", "String", "patchedName", "=", "patchName", "(", "name", ")", ";", "final", "String", "...
Adds the given attribute to the set of collected attributes, but only if there is a currently open element. @param name the attribute's qualified name @param value the value of the attribute
[ "Adds", "the", "given", "attribute", "to", "the", "set", "of", "collected", "attributes", "but", "only", "if", "there", "is", "a", "currently", "open", "element", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/SerializerBase.java#L444-L454
inkstand-io/scribble
scribble-jcr/src/main/java/io/inkstand/scribble/jcr/rules/util/XMLContentHandler.java
XMLContentHandler.characters
@Override public void characters(final char[] chr, final int start, final int length) throws SAXException { final String text = new String(chr).substring(start, start + length); LOG.trace("characters; '{}'", text); final String trimmedText = text.trim(); LOG.info("text: '{}'", trimmedText); this.textStack.push(trimmedText); }
java
@Override public void characters(final char[] chr, final int start, final int length) throws SAXException { final String text = new String(chr).substring(start, start + length); LOG.trace("characters; '{}'", text); final String trimmedText = text.trim(); LOG.info("text: '{}'", trimmedText); this.textStack.push(trimmedText); }
[ "@", "Override", "public", "void", "characters", "(", "final", "char", "[", "]", "chr", ",", "final", "int", "start", ",", "final", "int", "length", ")", "throws", "SAXException", "{", "final", "String", "text", "=", "new", "String", "(", "chr", ")", "...
Detects text by trimming the effective content of the char array.
[ "Detects", "text", "by", "trimming", "the", "effective", "content", "of", "the", "char", "array", "." ]
train
https://github.com/inkstand-io/scribble/blob/66e67553bad4b1ff817e1715fd1d3dd833406744/scribble-jcr/src/main/java/io/inkstand/scribble/jcr/rules/util/XMLContentHandler.java#L291-L299
Impetus/Kundera
src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/schemamanager/CassandraSchemaManager.java
CassandraSchemaManager.onSetReadRepairChance
private void onSetReadRepairChance(CfDef cfDef, Properties cfProperties, StringBuilder builder) { String dclocalReadRepairChance = cfProperties.getProperty(CassandraConstants.DCLOCAL_READ_REPAIR_CHANCE); if (dclocalReadRepairChance != null) { try { if (builder != null) { appendPropertyToBuilder(builder, dclocalReadRepairChance, CassandraConstants.DCLOCAL_READ_REPAIR_CHANCE); } else { cfDef.setDclocal_read_repair_chance(Double.parseDouble(dclocalReadRepairChance)); } } catch (NumberFormatException nfe) { log.error("READ_REPAIR_CHANCE should be double type, Caused by: {}.", nfe); throw new SchemaGenerationException(nfe); } } }
java
private void onSetReadRepairChance(CfDef cfDef, Properties cfProperties, StringBuilder builder) { String dclocalReadRepairChance = cfProperties.getProperty(CassandraConstants.DCLOCAL_READ_REPAIR_CHANCE); if (dclocalReadRepairChance != null) { try { if (builder != null) { appendPropertyToBuilder(builder, dclocalReadRepairChance, CassandraConstants.DCLOCAL_READ_REPAIR_CHANCE); } else { cfDef.setDclocal_read_repair_chance(Double.parseDouble(dclocalReadRepairChance)); } } catch (NumberFormatException nfe) { log.error("READ_REPAIR_CHANCE should be double type, Caused by: {}.", nfe); throw new SchemaGenerationException(nfe); } } }
[ "private", "void", "onSetReadRepairChance", "(", "CfDef", "cfDef", ",", "Properties", "cfProperties", ",", "StringBuilder", "builder", ")", "{", "String", "dclocalReadRepairChance", "=", "cfProperties", ".", "getProperty", "(", "CassandraConstants", ".", "DCLOCAL_READ_R...
On set read repair chance. @param cfDef the cf def @param cfProperties the cf properties @param builder the builder
[ "On", "set", "read", "repair", "chance", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/schemamanager/CassandraSchemaManager.java#L2366-L2390
primefaces/primefaces
src/main/java/org/primefaces/util/ComponentUtils.java
ComponentUtils.findParentForm
@Deprecated public static UIComponent findParentForm(FacesContext context, UIComponent component) { return ComponentTraversalUtils.closestForm(context, component); }
java
@Deprecated public static UIComponent findParentForm(FacesContext context, UIComponent component) { return ComponentTraversalUtils.closestForm(context, component); }
[ "@", "Deprecated", "public", "static", "UIComponent", "findParentForm", "(", "FacesContext", "context", ",", "UIComponent", "component", ")", "{", "return", "ComponentTraversalUtils", ".", "closestForm", "(", "context", ",", "component", ")", ";", "}" ]
Use {@link ComponentTraversalUtils#closestForm(javax.faces.context.FacesContext, javax.faces.component.UIComponent)} instead. @param context @param component @return @deprecated
[ "Use", "{", "@link", "ComponentTraversalUtils#closestForm", "(", "javax", ".", "faces", ".", "context", ".", "FacesContext", "javax", ".", "faces", ".", "component", ".", "UIComponent", ")", "}", "instead", "." ]
train
https://github.com/primefaces/primefaces/blob/b8cdd5ed395d09826e40e3302d6b14901d3ef4e7/src/main/java/org/primefaces/util/ComponentUtils.java#L419-L422
xdcrafts/flower
flower-tools/src/main/java/com/github/xdcrafts/flower/tools/map/MapDotApi.java
MapDotApi.dotGetUnsafe
public static <T> T dotGetUnsafe(final Map map, final Class<T> clazz, final String pathString) { return dotGet(map, clazz, pathString).orElseThrow(() -> new IllegalAccessError( "Map " + map + " does not have value of type " + clazz.getName() + " by " + pathString) ); }
java
public static <T> T dotGetUnsafe(final Map map, final Class<T> clazz, final String pathString) { return dotGet(map, clazz, pathString).orElseThrow(() -> new IllegalAccessError( "Map " + map + " does not have value of type " + clazz.getName() + " by " + pathString) ); }
[ "public", "static", "<", "T", ">", "T", "dotGetUnsafe", "(", "final", "Map", "map", ",", "final", "Class", "<", "T", ">", "clazz", ",", "final", "String", "pathString", ")", "{", "return", "dotGet", "(", "map", ",", "clazz", ",", "pathString", ")", "...
Walks by map's nodes and extracts optional value of type T. @param <T> value type @param clazz type of value @param map subject @param pathString nodes to walk in map @return optional value of type T
[ "Walks", "by", "map", "s", "nodes", "and", "extracts", "optional", "value", "of", "type", "T", "." ]
train
https://github.com/xdcrafts/flower/blob/96a8e49102fea434bd383a3c7852f0ee9545f999/flower-tools/src/main/java/com/github/xdcrafts/flower/tools/map/MapDotApi.java#L89-L98
marklogic/marklogic-sesame
marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/MarkLogicRepositoryConnection.java
MarkLogicRepositoryConnection.hasStatement
@Override public boolean hasStatement(Statement st, boolean includeInferred, Resource... contexts) throws RepositoryException { return hasStatement(st.getSubject(),st.getPredicate(),st.getObject(),includeInferred,contexts); }
java
@Override public boolean hasStatement(Statement st, boolean includeInferred, Resource... contexts) throws RepositoryException { return hasStatement(st.getSubject(),st.getPredicate(),st.getObject(),includeInferred,contexts); }
[ "@", "Override", "public", "boolean", "hasStatement", "(", "Statement", "st", ",", "boolean", "includeInferred", ",", "Resource", "...", "contexts", ")", "throws", "RepositoryException", "{", "return", "hasStatement", "(", "st", ".", "getSubject", "(", ")", ",",...
returns true or false if a statement exists in repository / context @param st @param includeInferred @param contexts @return boolean @throws RepositoryException
[ "returns", "true", "or", "false", "if", "a", "statement", "exists", "in", "repository", "/", "context" ]
train
https://github.com/marklogic/marklogic-sesame/blob/d5b668ed2b3d5e90c9f1d5096012813c272062a2/marklogic-sesame/src/main/java/com/marklogic/semantics/sesame/MarkLogicRepositoryConnection.java#L627-L630
liferay/com-liferay-commerce
commerce-notification-service/src/main/java/com/liferay/commerce/notification/service/persistence/impl/CommerceNotificationQueueEntryPersistenceImpl.java
CommerceNotificationQueueEntryPersistenceImpl.findAll
@Override public List<CommerceNotificationQueueEntry> findAll() { return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); }
java
@Override public List<CommerceNotificationQueueEntry> findAll() { return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); }
[ "@", "Override", "public", "List", "<", "CommerceNotificationQueueEntry", ">", "findAll", "(", ")", "{", "return", "findAll", "(", "QueryUtil", ".", "ALL_POS", ",", "QueryUtil", ".", "ALL_POS", ",", "null", ")", ";", "}" ]
Returns all the commerce notification queue entries. @return the commerce notification queue entries
[ "Returns", "all", "the", "commerce", "notification", "queue", "entries", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-notification-service/src/main/java/com/liferay/commerce/notification/service/persistence/impl/CommerceNotificationQueueEntryPersistenceImpl.java#L2795-L2798
ralscha/extdirectspring
src/main/java/ch/ralscha/extdirectspring/util/JsonHandler.java
JsonHandler.readValue
@SuppressWarnings("unchecked") public <T> T readValue(String json, TypeReference<T> typeReference) { try { return (T) this.mapper.readValue(json, typeReference); } catch (Exception e) { LogFactory.getLog(JsonHandler.class).info("deserialize json to object", e); return null; } }
java
@SuppressWarnings("unchecked") public <T> T readValue(String json, TypeReference<T> typeReference) { try { return (T) this.mapper.readValue(json, typeReference); } catch (Exception e) { LogFactory.getLog(JsonHandler.class).info("deserialize json to object", e); return null; } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "<", "T", ">", "T", "readValue", "(", "String", "json", ",", "TypeReference", "<", "T", ">", "typeReference", ")", "{", "try", "{", "return", "(", "T", ")", "this", ".", "mapper", ".", "read...
Converts a JSON string into an object. In case of an exception returns null and logs the exception. @param <T> type of the object to create @param json string with the JSON @param typeReference {@link TypeReference} instance of the desired result type {@link com.fasterxml.jackson.core.type.TypeReference} @return the created object, null if there was an exception
[ "Converts", "a", "JSON", "string", "into", "an", "object", ".", "In", "case", "of", "an", "exception", "returns", "null", "and", "logs", "the", "exception", "." ]
train
https://github.com/ralscha/extdirectspring/blob/4b018497c4e7503033f91d0491b4e74bf8291d2c/src/main/java/ch/ralscha/extdirectspring/util/JsonHandler.java#L104-L113
alkacon/opencms-core
src/org/opencms/flex/CmsFlexResponse.java
CmsFlexResponse.addHeaderList
private void addHeaderList(Map<String, List<String>> headers, String name, String value) { List<String> values = headers.get(name); if (values == null) { values = new ArrayList<String>(); headers.put(name, values); } values.add(value); }
java
private void addHeaderList(Map<String, List<String>> headers, String name, String value) { List<String> values = headers.get(name); if (values == null) { values = new ArrayList<String>(); headers.put(name, values); } values.add(value); }
[ "private", "void", "addHeaderList", "(", "Map", "<", "String", ",", "List", "<", "String", ">", ">", "headers", ",", "String", "name", ",", "String", "value", ")", "{", "List", "<", "String", ">", "values", "=", "headers", ".", "get", "(", "name", ")...
Helper method to add a value in the internal header list.<p> @param headers the headers to look up the value in @param name the name to look up @param value the value to set
[ "Helper", "method", "to", "add", "a", "value", "in", "the", "internal", "header", "list", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/flex/CmsFlexResponse.java#L1067-L1075
intendia-oss/rxjava-gwt
src/main/modified/io/reactivex/super/io/reactivex/Flowable.java
Flowable.mergeWith
@CheckReturnValue @BackpressureSupport(BackpressureKind.PASS_THROUGH) @SchedulerSupport(SchedulerSupport.NONE) public final Flowable<T> mergeWith(@NonNull CompletableSource other) { ObjectHelper.requireNonNull(other, "other is null"); return RxJavaPlugins.onAssembly(new FlowableMergeWithCompletable<T>(this, other)); }
java
@CheckReturnValue @BackpressureSupport(BackpressureKind.PASS_THROUGH) @SchedulerSupport(SchedulerSupport.NONE) public final Flowable<T> mergeWith(@NonNull CompletableSource other) { ObjectHelper.requireNonNull(other, "other is null"); return RxJavaPlugins.onAssembly(new FlowableMergeWithCompletable<T>(this, other)); }
[ "@", "CheckReturnValue", "@", "BackpressureSupport", "(", "BackpressureKind", ".", "PASS_THROUGH", ")", "@", "SchedulerSupport", "(", "SchedulerSupport", ".", "NONE", ")", "public", "final", "Flowable", "<", "T", ">", "mergeWith", "(", "@", "NonNull", "Completable...
Relays the items of this Flowable and completes only when the other CompletableSource completes as well. <p> <img width="640" height="380" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/merge.png" alt=""> <dl> <dt><b>Backpressure:</b></dt> <dd>The operator doesn't interfere with backpressure which is determined by the source {@code Publisher}'s backpressure behavior.</dd> <dt><b>Scheduler:</b></dt> <dd>{@code mergeWith} does not operate by default on a particular {@link Scheduler}.</dd> </dl> <p>History: 2.1.10 - experimental @param other the {@code CompletableSource} to await for completion @return the new Flowable instance @since 2.2
[ "Relays", "the", "items", "of", "this", "Flowable", "and", "completes", "only", "when", "the", "other", "CompletableSource", "completes", "as", "well", ".", "<p", ">", "<img", "width", "=", "640", "height", "=", "380", "src", "=", "https", ":", "//", "ra...
train
https://github.com/intendia-oss/rxjava-gwt/blob/8d5635b12ce40da99e76b59dc6bfe6fc2fffc1fa/src/main/modified/io/reactivex/super/io/reactivex/Flowable.java#L11180-L11186
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
FSNamesystem.setQuota
void setQuota(String path, long nsQuota, long dsQuota) throws IOException { writeLock(); try { if (isInSafeMode()) { throw new SafeModeException("Cannot setQuota " + path, safeMode); } INode[] inodes = this.dir.getExistingPathINodes(path); if (isPermissionEnabled && isPermissionCheckingEnabled(inodes)) { checkSuperuserPrivilege(); } dir.setQuota(path, nsQuota, dsQuota); } finally { writeUnlock(); } getEditLog().logSync(false); }
java
void setQuota(String path, long nsQuota, long dsQuota) throws IOException { writeLock(); try { if (isInSafeMode()) { throw new SafeModeException("Cannot setQuota " + path, safeMode); } INode[] inodes = this.dir.getExistingPathINodes(path); if (isPermissionEnabled && isPermissionCheckingEnabled(inodes)) { checkSuperuserPrivilege(); } dir.setQuota(path, nsQuota, dsQuota); } finally { writeUnlock(); } getEditLog().logSync(false); }
[ "void", "setQuota", "(", "String", "path", ",", "long", "nsQuota", ",", "long", "dsQuota", ")", "throws", "IOException", "{", "writeLock", "(", ")", ";", "try", "{", "if", "(", "isInSafeMode", "(", ")", ")", "{", "throw", "new", "SafeModeException", "(",...
Set the namespace quota and diskspace quota for a directory. See {@link ClientProtocol#setQuota(String, long, long)} for the contract.
[ "Set", "the", "namespace", "quota", "and", "diskspace", "quota", "for", "a", "directory", ".", "See", "{" ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L4082-L4099
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/UnicodeSet.java
UnicodeSet.findLastIn
@Deprecated public int findLastIn(CharSequence value, int fromIndex, boolean findNot) { //TODO add strings, optimize, using ICU4C algorithms int cp; fromIndex -= 1; for (; fromIndex >= 0; fromIndex -= UTF16.getCharCount(cp)) { cp = UTF16.charAt(value, fromIndex); if (contains(cp) != findNot) { break; } } return fromIndex < 0 ? -1 : fromIndex; }
java
@Deprecated public int findLastIn(CharSequence value, int fromIndex, boolean findNot) { //TODO add strings, optimize, using ICU4C algorithms int cp; fromIndex -= 1; for (; fromIndex >= 0; fromIndex -= UTF16.getCharCount(cp)) { cp = UTF16.charAt(value, fromIndex); if (contains(cp) != findNot) { break; } } return fromIndex < 0 ? -1 : fromIndex; }
[ "@", "Deprecated", "public", "int", "findLastIn", "(", "CharSequence", "value", ",", "int", "fromIndex", ",", "boolean", "findNot", ")", "{", "//TODO add strings, optimize, using ICU4C algorithms", "int", "cp", ";", "fromIndex", "-=", "1", ";", "for", "(", ";", ...
Find the last index before fromIndex where the UnicodeSet matches at that index. If findNot is true, then reverse the sense of the match: find the last place where the UnicodeSet doesn't match. If there is no match, -1 is returned. BEFORE index is not in the UnicodeSet. @deprecated This API is ICU internal only. Use spanBack instead. @hide original deprecated declaration @hide draft / provisional / internal are hidden on Android
[ "Find", "the", "last", "index", "before", "fromIndex", "where", "the", "UnicodeSet", "matches", "at", "that", "index", ".", "If", "findNot", "is", "true", "then", "reverse", "the", "sense", "of", "the", "match", ":", "find", "the", "last", "place", "where"...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/UnicodeSet.java#L4621-L4633
apache/incubator-druid
server/src/main/java/org/apache/druid/segment/realtime/appenderator/BatchAppenderatorDriver.java
BatchAppenderatorDriver.pushAllAndClear
public SegmentsAndMetadata pushAllAndClear(long pushAndClearTimeoutMs) throws InterruptedException, ExecutionException, TimeoutException { final Collection<String> sequences; synchronized (segments) { sequences = ImmutableList.copyOf(segments.keySet()); } return pushAndClear(sequences, pushAndClearTimeoutMs); }
java
public SegmentsAndMetadata pushAllAndClear(long pushAndClearTimeoutMs) throws InterruptedException, ExecutionException, TimeoutException { final Collection<String> sequences; synchronized (segments) { sequences = ImmutableList.copyOf(segments.keySet()); } return pushAndClear(sequences, pushAndClearTimeoutMs); }
[ "public", "SegmentsAndMetadata", "pushAllAndClear", "(", "long", "pushAndClearTimeoutMs", ")", "throws", "InterruptedException", ",", "ExecutionException", ",", "TimeoutException", "{", "final", "Collection", "<", "String", ">", "sequences", ";", "synchronized", "(", "s...
Push and drop all segments in the {@link SegmentState#APPENDING} state. @param pushAndClearTimeoutMs timeout for pushing and dropping segments @return {@link SegmentsAndMetadata} for pushed and dropped segments
[ "Push", "and", "drop", "all", "segments", "in", "the", "{", "@link", "SegmentState#APPENDING", "}", "state", "." ]
train
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/server/src/main/java/org/apache/druid/segment/realtime/appenderator/BatchAppenderatorDriver.java#L116-L125
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/internal/SSOAuthenticator.java
SSOAuthenticator.createAuthenticationData
private AuthenticationData createAuthenticationData(HttpServletRequest req, HttpServletResponse res, String token, String oid) { AuthenticationData authenticationData = new WSAuthenticationData(); authenticationData.set(AuthenticationData.HTTP_SERVLET_REQUEST, req); authenticationData.set(AuthenticationData.HTTP_SERVLET_RESPONSE, res); if (oid.equals(LTPA_OID)) { authenticationData.set(AuthenticationData.TOKEN64, token); } else { authenticationData.set(AuthenticationData.JWT_TOKEN, token); } authenticationData.set(AuthenticationData.AUTHENTICATION_MECH_OID, oid); return authenticationData; }
java
private AuthenticationData createAuthenticationData(HttpServletRequest req, HttpServletResponse res, String token, String oid) { AuthenticationData authenticationData = new WSAuthenticationData(); authenticationData.set(AuthenticationData.HTTP_SERVLET_REQUEST, req); authenticationData.set(AuthenticationData.HTTP_SERVLET_RESPONSE, res); if (oid.equals(LTPA_OID)) { authenticationData.set(AuthenticationData.TOKEN64, token); } else { authenticationData.set(AuthenticationData.JWT_TOKEN, token); } authenticationData.set(AuthenticationData.AUTHENTICATION_MECH_OID, oid); return authenticationData; }
[ "private", "AuthenticationData", "createAuthenticationData", "(", "HttpServletRequest", "req", ",", "HttpServletResponse", "res", ",", "String", "token", ",", "String", "oid", ")", "{", "AuthenticationData", "authenticationData", "=", "new", "WSAuthenticationData", "(", ...
Create an authentication data for ltpaToken @param ssoToken @return authenticationData
[ "Create", "an", "authentication", "data", "for", "ltpaToken" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/internal/SSOAuthenticator.java#L222-L234
forge/core
ui/impl/src/main/java/org/jboss/forge/addon/ui/impl/input/InputComponentFactoryImpl.java
InputComponentFactoryImpl.preconfigureInput
public void preconfigureInput(InputComponent<?, ?> input, WithAttributes atts) { if (atts != null) { input.setEnabled(atts.enabled()); input.setLabel(atts.label()); input.setRequired(atts.required()); input.setRequiredMessage(atts.requiredMessage()); input.setDescription(atts.description()); input.setDeprecated(atts.deprecated()); input.setDeprecatedMessage(atts.deprecatedMessage()); // Set input type if (!InputType.DEFAULT.equals(atts.type())) { input.getFacet(HintsFacet.class).setInputType(atts.type()); } // Set Default Value if (!atts.defaultValue().isEmpty()) { InputComponents.setDefaultValueFor(converterFactory, (InputComponent<?, Object>) input, atts.defaultValue()); } // Set Note if (!atts.note().isEmpty()) { input.setNote(atts.note()); } } }
java
public void preconfigureInput(InputComponent<?, ?> input, WithAttributes atts) { if (atts != null) { input.setEnabled(atts.enabled()); input.setLabel(atts.label()); input.setRequired(atts.required()); input.setRequiredMessage(atts.requiredMessage()); input.setDescription(atts.description()); input.setDeprecated(atts.deprecated()); input.setDeprecatedMessage(atts.deprecatedMessage()); // Set input type if (!InputType.DEFAULT.equals(atts.type())) { input.getFacet(HintsFacet.class).setInputType(atts.type()); } // Set Default Value if (!atts.defaultValue().isEmpty()) { InputComponents.setDefaultValueFor(converterFactory, (InputComponent<?, Object>) input, atts.defaultValue()); } // Set Note if (!atts.note().isEmpty()) { input.setNote(atts.note()); } } }
[ "public", "void", "preconfigureInput", "(", "InputComponent", "<", "?", ",", "?", ">", "input", ",", "WithAttributes", "atts", ")", "{", "if", "(", "atts", "!=", "null", ")", "{", "input", ".", "setEnabled", "(", "atts", ".", "enabled", "(", ")", ")", ...
Pre-configure input based on WithAttributes info if annotation exists
[ "Pre", "-", "configure", "input", "based", "on", "WithAttributes", "info", "if", "annotation", "exists" ]
train
https://github.com/forge/core/blob/e140eb03bbe2b3409478ad70c86c3edbef6d9a0c/ui/impl/src/main/java/org/jboss/forge/addon/ui/impl/input/InputComponentFactoryImpl.java#L118-L148
MGunlogson/CuckooFilter4J
src/main/java/com/github/mgunlogson/cuckoofilter4j/FilterTable.java
FilterTable.deleteFromBucket
boolean deleteFromBucket(long i1, long tag) { for (int i = 0; i < CuckooFilter.BUCKET_SIZE; i++) { if (checkTag(i1, i, tag)) { deleteTag(i1, i); return true; } } return false; }
java
boolean deleteFromBucket(long i1, long tag) { for (int i = 0; i < CuckooFilter.BUCKET_SIZE; i++) { if (checkTag(i1, i, tag)) { deleteTag(i1, i); return true; } } return false; }
[ "boolean", "deleteFromBucket", "(", "long", "i1", ",", "long", "tag", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "CuckooFilter", ".", "BUCKET_SIZE", ";", "i", "++", ")", "{", "if", "(", "checkTag", "(", "i1", ",", "i", ",", "tag",...
Deletes an item from the table if it is found in the bucket @param i1 bucket index @param tag tag @return true if item was deleted
[ "Deletes", "an", "item", "from", "the", "table", "if", "it", "is", "found", "in", "the", "bucket" ]
train
https://github.com/MGunlogson/CuckooFilter4J/blob/e8472aa150b201f05046d1c81cac5a5ca4348db8/src/main/java/com/github/mgunlogson/cuckoofilter4j/FilterTable.java#L153-L161
casmi/casmi
src/main/java/casmi/graphics/Graphics.java
Graphics.setSpotLight
public void setSpotLight(int i, Color color, boolean enableColor, Vector3D v, float nx, float ny, float nz, float angle) { float spotColor[] = { (float)color.getRed(), (float)color.getGreen(), (float)color.getBlue(), (float)color.getAlpha() }; float pos[] = { (float)v.getX(), (float)v.getY(), (float)v.getZ(), 0.0f }; float direction[] = { nx, ny, nz }; float a[] = { angle }; gl.glEnable(GL2.GL_LIGHTING); gl.glEnable(GL2.GL_LIGHT0 + i); gl.glLightfv(GL2.GL_LIGHT0 + i, GL2.GL_POSITION, pos, 0); if(enableColor) gl.glLightfv(GL2.GL_LIGHT0 + i, GL2.GL_DIFFUSE, spotColor, 0); gl.glLightfv(GL2.GL_LIGHT0 + i, GL2.GL_SPOT_DIRECTION, direction, 0); gl.glLightfv(GL2.GL_LIGHT0 + i, GL2.GL_SPOT_CUTOFF, a, 0); }
java
public void setSpotLight(int i, Color color, boolean enableColor, Vector3D v, float nx, float ny, float nz, float angle) { float spotColor[] = { (float)color.getRed(), (float)color.getGreen(), (float)color.getBlue(), (float)color.getAlpha() }; float pos[] = { (float)v.getX(), (float)v.getY(), (float)v.getZ(), 0.0f }; float direction[] = { nx, ny, nz }; float a[] = { angle }; gl.glEnable(GL2.GL_LIGHTING); gl.glEnable(GL2.GL_LIGHT0 + i); gl.glLightfv(GL2.GL_LIGHT0 + i, GL2.GL_POSITION, pos, 0); if(enableColor) gl.glLightfv(GL2.GL_LIGHT0 + i, GL2.GL_DIFFUSE, spotColor, 0); gl.glLightfv(GL2.GL_LIGHT0 + i, GL2.GL_SPOT_DIRECTION, direction, 0); gl.glLightfv(GL2.GL_LIGHT0 + i, GL2.GL_SPOT_CUTOFF, a, 0); }
[ "public", "void", "setSpotLight", "(", "int", "i", ",", "Color", "color", ",", "boolean", "enableColor", ",", "Vector3D", "v", ",", "float", "nx", ",", "float", "ny", ",", "float", "nz", ",", "float", "angle", ")", "{", "float", "spotColor", "[", "]", ...
Sets the color value, position, direction and the angle of the spotlight cone of the No.i spotLight
[ "Sets", "the", "color", "value", "position", "direction", "and", "the", "angle", "of", "the", "spotlight", "cone", "of", "the", "No", ".", "i", "spotLight" ]
train
https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/graphics/Graphics.java#L586-L608
OpenLiberty/open-liberty
dev/com.ibm.ws.logging/src/com/ibm/ws/logging/internal/impl/LoggingConfigUtils.java
LoggingConfigUtils.getStringValue
public static String getStringValue(Object newValue, String defaultValue) { if (newValue == null) return defaultValue; return (String) newValue; }
java
public static String getStringValue(Object newValue, String defaultValue) { if (newValue == null) return defaultValue; return (String) newValue; }
[ "public", "static", "String", "getStringValue", "(", "Object", "newValue", ",", "String", "defaultValue", ")", "{", "if", "(", "newValue", "==", "null", ")", "return", "defaultValue", ";", "return", "(", "String", ")", "newValue", ";", "}" ]
If the value is null, return the defaultValue. Otherwise return the new value.
[ "If", "the", "value", "is", "null", "return", "the", "defaultValue", ".", "Otherwise", "return", "the", "new", "value", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging/src/com/ibm/ws/logging/internal/impl/LoggingConfigUtils.java#L120-L125
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WMessages.java
WMessages.addMessage
public void addMessage(final Message message, final boolean encodeText) { switch (message.getType()) { case Message.SUCCESS_MESSAGE: addMessage(successMessages, message, encodeText); break; case Message.INFO_MESSAGE: addMessage(infoMessages, message, encodeText); break; case Message.WARNING_MESSAGE: addMessage(warningMessages, message, encodeText); break; case Message.ERROR_MESSAGE: addMessage(errorMessages, message, encodeText); break; default: LOG.warn("Unknown message type: " + message.getType()); } }
java
public void addMessage(final Message message, final boolean encodeText) { switch (message.getType()) { case Message.SUCCESS_MESSAGE: addMessage(successMessages, message, encodeText); break; case Message.INFO_MESSAGE: addMessage(infoMessages, message, encodeText); break; case Message.WARNING_MESSAGE: addMessage(warningMessages, message, encodeText); break; case Message.ERROR_MESSAGE: addMessage(errorMessages, message, encodeText); break; default: LOG.warn("Unknown message type: " + message.getType()); } }
[ "public", "void", "addMessage", "(", "final", "Message", "message", ",", "final", "boolean", "encodeText", ")", "{", "switch", "(", "message", ".", "getType", "(", ")", ")", "{", "case", "Message", ".", "SUCCESS_MESSAGE", ":", "addMessage", "(", "successMess...
Adds a message. <p> When setting <code>encodeText</code> to <code>false</code>, it then becomes the responsibility of the application to ensure that the text does not contain any characters which need to be escaped. </p> <p> <b>WARNING:</b> If you are using WMessageBox to display "user entered" or untrusted data, use of this method with <code>encodeText</code> set to <code>false</code> may result in security issues. </p> @param message the message to add @param encodeText true to encode the message, false to leave it unencoded.
[ "Adds", "a", "message", ".", "<p", ">", "When", "setting", "<code", ">", "encodeText<", "/", "code", ">", "to", "<code", ">", "false<", "/", "code", ">", "it", "then", "becomes", "the", "responsibility", "of", "the", "application", "to", "ensure", "that"...
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WMessages.java#L136-L157
davidmarquis/fluent-interface-proxy
src/main/java/com/fluentinterface/beans/ObjectWrapper.java
ObjectWrapper.getMappedValue
public Object getMappedValue(Property property, Object key) { return getMappedValue(object, property, key); }
java
public Object getMappedValue(Property property, Object key) { return getMappedValue(object, property, key); }
[ "public", "Object", "getMappedValue", "(", "Property", "property", ",", "Object", "key", ")", "{", "return", "getMappedValue", "(", "object", ",", "property", ",", "key", ")", ";", "}" ]
Returns the value of the specified mapped property from the wrapped object. @param property the mapped property whose value is to be extracted, cannot be {@code null} @param key the key of the property value to be extracted, can be {@code null} @return the mapped property value @throws ReflectionException if a reflection error occurs @throws IllegalArgumentException if the property parameter is {@code null} @throws IllegalArgumentException if the mapped object in the wrapped object is not a {@link Map} type @throws NullPointerException if the mapped object in the wrapped object is {@code null}
[ "Returns", "the", "value", "of", "the", "specified", "mapped", "property", "from", "the", "wrapped", "object", "." ]
train
https://github.com/davidmarquis/fluent-interface-proxy/blob/8e72fff6cd1f496c76a01773269caead994fea65/src/main/java/com/fluentinterface/beans/ObjectWrapper.java#L284-L286
OpenLiberty/open-liberty
dev/com.ibm.ws.security.wim.core/src/com/ibm/ws/security/wim/util/SortHandler.java
SortHandler.compareEntitysWithRespectToProperties
public int compareEntitysWithRespectToProperties(Entity entity1, Entity entity2) { List<SortKeyType> sortKeys = sortControl.getSortKeys(); int temp = 0; for (int i = 0; i < sortKeys.size() && temp == 0; i++) { SortKeyType sortKey = (SortKeyType) sortKeys.get(i); String propName = sortKey.getPropertyName(); boolean ascendingSorting = sortKey.isAscendingOrder(); Object propValue1 = getPropertyValue(entity1, propName, ascendingSorting); Object propValue2 = getPropertyValue(entity2, propName, ascendingSorting); temp = compareProperties(propValue1, propValue2); if (!ascendingSorting) { temp = 0 - temp; } } return temp; }
java
public int compareEntitysWithRespectToProperties(Entity entity1, Entity entity2) { List<SortKeyType> sortKeys = sortControl.getSortKeys(); int temp = 0; for (int i = 0; i < sortKeys.size() && temp == 0; i++) { SortKeyType sortKey = (SortKeyType) sortKeys.get(i); String propName = sortKey.getPropertyName(); boolean ascendingSorting = sortKey.isAscendingOrder(); Object propValue1 = getPropertyValue(entity1, propName, ascendingSorting); Object propValue2 = getPropertyValue(entity2, propName, ascendingSorting); temp = compareProperties(propValue1, propValue2); if (!ascendingSorting) { temp = 0 - temp; } } return temp; }
[ "public", "int", "compareEntitysWithRespectToProperties", "(", "Entity", "entity1", ",", "Entity", "entity2", ")", "{", "List", "<", "SortKeyType", ">", "sortKeys", "=", "sortControl", ".", "getSortKeys", "(", ")", ";", "int", "temp", "=", "0", ";", "for", "...
Compares the two entity data objects. @param member1 the first member object to be compared @param member2 the second member object to be compared @return a negative integer, zero, or a positive integer as the first member object is less than, equal to, or greater than the second.
[ "Compares", "the", "two", "entity", "data", "objects", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.wim.core/src/com/ibm/ws/security/wim/util/SortHandler.java#L59-L75
RKumsher/utils
src/main/java/com/github/rkumsher/date/RandomDateUtils.java
RandomDateUtils.randomMonthDay
public static MonthDay randomMonthDay(MonthDay startInclusive, MonthDay endExclusive) { return randomMonthDay(startInclusive, endExclusive, Year.now().isLeap()); }
java
public static MonthDay randomMonthDay(MonthDay startInclusive, MonthDay endExclusive) { return randomMonthDay(startInclusive, endExclusive, Year.now().isLeap()); }
[ "public", "static", "MonthDay", "randomMonthDay", "(", "MonthDay", "startInclusive", ",", "MonthDay", "endExclusive", ")", "{", "return", "randomMonthDay", "(", "startInclusive", ",", "endExclusive", ",", "Year", ".", "now", "(", ")", ".", "isLeap", "(", ")", ...
Returns a random {@link MonthDay} within the specified range. Includes leap day if the current year is a leap year. @param startInclusive the earliest {@link MonthDay} that can be returned @param endExclusive the upper bound (not included) @return the random {@link MonthDay} @throws IllegalArgumentException if startInclusive or endExclusive are null or if endExclusive is earlier than startInclusive
[ "Returns", "a", "random", "{", "@link", "MonthDay", "}", "within", "the", "specified", "range", ".", "Includes", "leap", "day", "if", "the", "current", "year", "is", "a", "leap", "year", "." ]
train
https://github.com/RKumsher/utils/blob/fcdb190569cd0288249bf4b46fd418f8c01d1caf/src/main/java/com/github/rkumsher/date/RandomDateUtils.java#L690-L692
knowm/XChange
xchange-core/src/main/java/org/knowm/xchange/utils/retries/Retries.java
Retries.callWithRetries
public static <V> V callWithRetries( int nAttempts, int initialRetrySec, Callable<V> action, IPredicate<Exception> retryableException) throws Exception { int retryDelaySec = initialRetrySec; for (int attemptsLeftAfterThis = nAttempts - 1; attemptsLeftAfterThis >= 0; attemptsLeftAfterThis--) { try { return action.call(); } catch (Exception e) { if (!retryableException.test(e)) { throw e; } if (attemptsLeftAfterThis <= 0) { throw new RuntimeException("Ultimately failed after " + nAttempts + " attempts.", e); } log.warn("Failed; {} attempts left: {}", e.toString(), attemptsLeftAfterThis); } retryDelaySec = pauseAndIncrease(retryDelaySec); } throw new RuntimeException("Failed; total attempts allowed: " + nAttempts); }
java
public static <V> V callWithRetries( int nAttempts, int initialRetrySec, Callable<V> action, IPredicate<Exception> retryableException) throws Exception { int retryDelaySec = initialRetrySec; for (int attemptsLeftAfterThis = nAttempts - 1; attemptsLeftAfterThis >= 0; attemptsLeftAfterThis--) { try { return action.call(); } catch (Exception e) { if (!retryableException.test(e)) { throw e; } if (attemptsLeftAfterThis <= 0) { throw new RuntimeException("Ultimately failed after " + nAttempts + " attempts.", e); } log.warn("Failed; {} attempts left: {}", e.toString(), attemptsLeftAfterThis); } retryDelaySec = pauseAndIncrease(retryDelaySec); } throw new RuntimeException("Failed; total attempts allowed: " + nAttempts); }
[ "public", "static", "<", "V", ">", "V", "callWithRetries", "(", "int", "nAttempts", ",", "int", "initialRetrySec", ",", "Callable", "<", "V", ">", "action", ",", "IPredicate", "<", "Exception", ">", "retryableException", ")", "throws", "Exception", "{", "int...
Allows a client to attempt a call and retry a finite amount of times if the exception thrown is the right kind. The retries back off exponentially. @param nAttempts Number of attempts before giving up @param initialRetrySec Number of seconds to wait before trying again on the first retry. @param action A callable or lambda expression that contains the code that will be tried and retried, if necessary. @param retryableException An instance of {@link org.knowm.xchange.utils.retries.IPredicate} that will be used to check if the exception caught is retryable, which can be any complex criteria that the user defines. @return @throws Exception If the exception isn't retryable, it's immediately thrown again. If it is retryable, then a RunTimeException is thrown after the allowed number of retries is exhausted. @author Matija Mazi and Bryan Hernandez
[ "Allows", "a", "client", "to", "attempt", "a", "call", "and", "retry", "a", "finite", "amount", "of", "times", "if", "the", "exception", "thrown", "is", "the", "right", "kind", ".", "The", "retries", "back", "off", "exponentially", "." ]
train
https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-core/src/main/java/org/knowm/xchange/utils/retries/Retries.java#L28-L52
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.billingAccount_timeCondition_serviceName_condition_id_PUT
public void billingAccount_timeCondition_serviceName_condition_id_PUT(String billingAccount, String serviceName, Long id, OvhTimeCondition body) throws IOException { String qPath = "/telephony/{billingAccount}/timeCondition/{serviceName}/condition/{id}"; StringBuilder sb = path(qPath, billingAccount, serviceName, id); exec(qPath, "PUT", sb.toString(), body); }
java
public void billingAccount_timeCondition_serviceName_condition_id_PUT(String billingAccount, String serviceName, Long id, OvhTimeCondition body) throws IOException { String qPath = "/telephony/{billingAccount}/timeCondition/{serviceName}/condition/{id}"; StringBuilder sb = path(qPath, billingAccount, serviceName, id); exec(qPath, "PUT", sb.toString(), body); }
[ "public", "void", "billingAccount_timeCondition_serviceName_condition_id_PUT", "(", "String", "billingAccount", ",", "String", "serviceName", ",", "Long", "id", ",", "OvhTimeCondition", "body", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/telephony/{bill...
Alter this object properties REST: PUT /telephony/{billingAccount}/timeCondition/{serviceName}/condition/{id} @param body [required] New object properties @param billingAccount [required] The name of your billingAccount @param serviceName [required] @param id [required] Id of the object
[ "Alter", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L5841-L5845
hawkular/hawkular-apm
client/collector/src/main/java/org/hawkular/apm/client/collector/internal/DefaultTraceCollector.java
DefaultTraceCollector.mergeProducer
protected void mergeProducer(Producer inner, Producer outer) { if (log.isLoggable(Level.FINEST)) { log.finest("Merging Producer = " + inner + " into Producer = " + outer); } // NOTE: For now, assumption is that inner Producer is equivalent to the outer // and results from instrumentation rules being triggered multiple times // for the same message. // Merge correlation - just replace for now if (log.isLoggable(Level.FINEST)) { log.finest("Merging Producers: replacing correlation ids (" + outer.getCorrelationIds() + ") with (" + inner.getCorrelationIds() + ")"); } outer.setCorrelationIds(inner.getCorrelationIds()); // Remove the inner Producer from the child nodes of the outer outer.getNodes().remove(inner); }
java
protected void mergeProducer(Producer inner, Producer outer) { if (log.isLoggable(Level.FINEST)) { log.finest("Merging Producer = " + inner + " into Producer = " + outer); } // NOTE: For now, assumption is that inner Producer is equivalent to the outer // and results from instrumentation rules being triggered multiple times // for the same message. // Merge correlation - just replace for now if (log.isLoggable(Level.FINEST)) { log.finest("Merging Producers: replacing correlation ids (" + outer.getCorrelationIds() + ") with (" + inner.getCorrelationIds() + ")"); } outer.setCorrelationIds(inner.getCorrelationIds()); // Remove the inner Producer from the child nodes of the outer outer.getNodes().remove(inner); }
[ "protected", "void", "mergeProducer", "(", "Producer", "inner", ",", "Producer", "outer", ")", "{", "if", "(", "log", ".", "isLoggable", "(", "Level", ".", "FINEST", ")", ")", "{", "log", ".", "finest", "(", "\"Merging Producer = \"", "+", "inner", "+", ...
This method merges an inner Producer node information into its containing Producer node, before removing the inner node. @param inner @param outer
[ "This", "method", "merges", "an", "inner", "Producer", "node", "information", "into", "its", "containing", "Producer", "node", "before", "removing", "the", "inner", "node", "." ]
train
https://github.com/hawkular/hawkular-apm/blob/57a4df0611b359597626563ea5f9ac64d4bb2533/client/collector/src/main/java/org/hawkular/apm/client/collector/internal/DefaultTraceCollector.java#L571-L589
JodaOrg/joda-time
src/main/java/org/joda/time/field/FieldUtils.java
FieldUtils.verifyValueBounds
public static void verifyValueBounds(String fieldName, int value, int lowerBound, int upperBound) { if ((value < lowerBound) || (value > upperBound)) { throw new IllegalFieldValueException (fieldName, Integer.valueOf(value), Integer.valueOf(lowerBound), Integer.valueOf(upperBound)); } }
java
public static void verifyValueBounds(String fieldName, int value, int lowerBound, int upperBound) { if ((value < lowerBound) || (value > upperBound)) { throw new IllegalFieldValueException (fieldName, Integer.valueOf(value), Integer.valueOf(lowerBound), Integer.valueOf(upperBound)); } }
[ "public", "static", "void", "verifyValueBounds", "(", "String", "fieldName", ",", "int", "value", ",", "int", "lowerBound", ",", "int", "upperBound", ")", "{", "if", "(", "(", "value", "<", "lowerBound", ")", "||", "(", "value", ">", "upperBound", ")", "...
Verify that input values are within specified bounds. @param value the value to check @param lowerBound the lower bound allowed for value @param upperBound the upper bound allowed for value @throws IllegalFieldValueException if value is not in the specified bounds
[ "Verify", "that", "input", "values", "are", "within", "specified", "bounds", "." ]
train
https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/field/FieldUtils.java#L289-L296
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/spatial/predicates/ST_DWithin.java
ST_DWithin.isWithinDistance
public static Boolean isWithinDistance(Geometry geomA, Geometry geomB, Double distance) { if(geomA == null||geomB == null){ return null; } return geomA.isWithinDistance(geomB, distance); }
java
public static Boolean isWithinDistance(Geometry geomA, Geometry geomB, Double distance) { if(geomA == null||geomB == null){ return null; } return geomA.isWithinDistance(geomB, distance); }
[ "public", "static", "Boolean", "isWithinDistance", "(", "Geometry", "geomA", ",", "Geometry", "geomB", ",", "Double", "distance", ")", "{", "if", "(", "geomA", "==", "null", "||", "geomB", "==", "null", ")", "{", "return", "null", ";", "}", "return", "ge...
Returns true if the geometries are within the specified distance of one another. @param geomA Geometry A @param geomB Geometry B @param distance Distance @return True if if the geometries are within the specified distance of one another
[ "Returns", "true", "if", "the", "geometries", "are", "within", "the", "specified", "distance", "of", "one", "another", "." ]
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/predicates/ST_DWithin.java#L52-L57
pmlopes/yoke
framework/src/main/java/com/jetdrone/vertx/yoke/middleware/YokeRequest.java
YokeRequest.getHeader
public String getHeader(@NotNull final String name, String defaultValue) { if (headers().contains(name)) { return getHeader(name); } else { return defaultValue; } }
java
public String getHeader(@NotNull final String name, String defaultValue) { if (headers().contains(name)) { return getHeader(name); } else { return defaultValue; } }
[ "public", "String", "getHeader", "(", "@", "NotNull", "final", "String", "name", ",", "String", "defaultValue", ")", "{", "if", "(", "headers", "(", ")", ".", "contains", "(", "name", ")", ")", "{", "return", "getHeader", "(", "name", ")", ";", "}", ...
Allow getting headers in a generified way and return defaultValue if the key does not exist. @param name The key to get @param defaultValue value returned when the key does not exist @return {String} The found object
[ "Allow", "getting", "headers", "in", "a", "generified", "way", "and", "return", "defaultValue", "if", "the", "key", "does", "not", "exist", "." ]
train
https://github.com/pmlopes/yoke/blob/fe8a64036f09fb745f0644faddd46162d64faf3c/framework/src/main/java/com/jetdrone/vertx/yoke/middleware/YokeRequest.java#L176-L182
haraldk/TwelveMonkeys
sandbox/sandbox-common/src/main/java/com/twelvemonkeys/util/DebugUtil.java
DebugUtil.printDebug
public static void printDebug(final String[] pStringArray, final PrintStream pPrintStream) { if (pPrintStream == null) { System.err.println(PRINTSTREAM_IS_NULL_ERROR_MESSAGE); return; } if (pStringArray == null) { pPrintStream.println(STRINGARRAY_IS_NULL_ERROR_MESSAGE); return; } for (int i = 0; i < pStringArray.length; i++) { pPrintStream.println(pStringArray[i]); } }
java
public static void printDebug(final String[] pStringArray, final PrintStream pPrintStream) { if (pPrintStream == null) { System.err.println(PRINTSTREAM_IS_NULL_ERROR_MESSAGE); return; } if (pStringArray == null) { pPrintStream.println(STRINGARRAY_IS_NULL_ERROR_MESSAGE); return; } for (int i = 0; i < pStringArray.length; i++) { pPrintStream.println(pStringArray[i]); } }
[ "public", "static", "void", "printDebug", "(", "final", "String", "[", "]", "pStringArray", ",", "final", "PrintStream", "pPrintStream", ")", "{", "if", "(", "pPrintStream", "==", "null", ")", "{", "System", ".", "err", ".", "println", "(", "PRINTSTREAM_IS_N...
Prints the content of a {@code java.lang.String[]} to a {@code java.io.PrintStream}. <p> @param pStringArray the {@code java.lang.String[]} to be printed. @param pPrintStream the {@code java.io.PrintStream} for flushing the results.
[ "Prints", "the", "content", "of", "a", "{" ]
train
https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/sandbox/sandbox-common/src/main/java/com/twelvemonkeys/util/DebugUtil.java#L389-L402
synchronoss/cpo-api
cpo-jdbc/src/main/java/org/synchronoss/cpo/jdbc/jta/JdbcCpoXaAdapter.java
JdbcCpoXaAdapter.executeObject
@Override public <T, C> T executeObject(String name, C criteria, T result) throws CpoException { return getCurrentResource().executeObject( name, criteria, result ); }
java
@Override public <T, C> T executeObject(String name, C criteria, T result) throws CpoException { return getCurrentResource().executeObject( name, criteria, result ); }
[ "@", "Override", "public", "<", "T", ",", "C", ">", "T", "executeObject", "(", "String", "name", ",", "C", "criteria", ",", "T", "result", ")", "throws", "CpoException", "{", "return", "getCurrentResource", "(", ")", ".", "executeObject", "(", "name", ",...
Executes an Object that represents an executable object within the datasource. It is assumed that the object exists in the datasource. If the object does not exist, an exception will be thrown <p> <pre>Example: <code> <p> class SomeObject so = new SomeObject(); class SomeResult sr = new SomeResult(); class CpoAdapter cpo = null; <p> try { cpo = new JdbcCpoAdapter(new JdbcDataSourceInfo(driver, url, user, password,1,1,false)); } catch (CpoException ce) { // Handle the error cpo = null; } <p> if (cpo!=null) { so.setId(1); so.setName("SomeName"); try{ sr = (SomeResult)cpo.executeObject("execNotifyProc",so, sr); } catch (CpoException ce) { // Handle the error } } </code> </pre> @param name The String name of the EXECUTE Function Group that will be used to create the object in the datasource. null signifies that the default rules will be used. @param criteria This is an object that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. If the object does not exist in the datasource, an exception will be thrown. This object is used to populate the IN parameters used to retrieve the collection of objects. @param result This is an object that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. If the object does not exist in the datasource, an exception will be thrown. This object defines the object type that will be created, filled with the return data and returned from this method. @return An object populated with the out parameters @throws CpoException Thrown if there are errors accessing the datasource
[ "Executes", "an", "Object", "that", "represents", "an", "executable", "object", "within", "the", "datasource", ".", "It", "is", "assumed", "that", "the", "object", "exists", "in", "the", "datasource", ".", "If", "the", "object", "does", "not", "exist", "an",...
train
https://github.com/synchronoss/cpo-api/blob/dc745aca3b3206abf80b85d9689b0132f5baa694/cpo-jdbc/src/main/java/org/synchronoss/cpo/jdbc/jta/JdbcCpoXaAdapter.java#L819-L822
integration-technology/amazon-mws-orders
src/main/java/com/amazonservices/mws/orders/_2013_09_01/MarketplaceWebServiceOrdersConfig.java
MarketplaceWebServiceOrdersConfig.withRequestHeader
public MarketplaceWebServiceOrdersConfig withRequestHeader(String name, String value) { cc.includeRequestHeader(name, value); return this; }
java
public MarketplaceWebServiceOrdersConfig withRequestHeader(String name, String value) { cc.includeRequestHeader(name, value); return this; }
[ "public", "MarketplaceWebServiceOrdersConfig", "withRequestHeader", "(", "String", "name", ",", "String", "value", ")", "{", "cc", ".", "includeRequestHeader", "(", "name", ",", "value", ")", ";", "return", "this", ";", "}" ]
Sets the value of a request header to be included on every request @param name the name of the header to set @param value value to send with header @return the current config object
[ "Sets", "the", "value", "of", "a", "request", "header", "to", "be", "included", "on", "every", "request" ]
train
https://github.com/integration-technology/amazon-mws-orders/blob/042e8cd5b10588a30150222bf9c91faf4f130b3c/src/main/java/com/amazonservices/mws/orders/_2013_09_01/MarketplaceWebServiceOrdersConfig.java#L371-L374
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/svg/InkscapeLoader.java
InkscapeLoader.loadDiagram
private Diagram loadDiagram(InputStream in, boolean offset) throws SlickException { try { DocumentBuilderFactory factory = DocumentBuilderFactory .newInstance(); factory.setValidating(false); factory.setNamespaceAware(true); DocumentBuilder builder = factory.newDocumentBuilder(); builder.setEntityResolver(new EntityResolver() { public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException { return new InputSource( new ByteArrayInputStream(new byte[0])); } }); Document doc = builder.parse(in); Element root = doc.getDocumentElement(); String widthString = root.getAttribute("width"); while (Character.isLetter(widthString .charAt(widthString.length() - 1))) { widthString = widthString.substring(0, widthString.length() - 1); } String heightString = root.getAttribute("height"); while (Character.isLetter(heightString .charAt(heightString.length() - 1))) { heightString = heightString.substring(0,heightString.length() - 1); } float docWidth = Float.parseFloat(widthString); float docHeight = Float.parseFloat(heightString); diagram = new Diagram(docWidth, docHeight); if (!offset) { docHeight = 0; } loadChildren(root, Transform .createTranslateTransform(0, -docHeight)); return diagram; } catch (Exception e) { throw new SlickException("Failed to load inkscape document", e); } }
java
private Diagram loadDiagram(InputStream in, boolean offset) throws SlickException { try { DocumentBuilderFactory factory = DocumentBuilderFactory .newInstance(); factory.setValidating(false); factory.setNamespaceAware(true); DocumentBuilder builder = factory.newDocumentBuilder(); builder.setEntityResolver(new EntityResolver() { public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException { return new InputSource( new ByteArrayInputStream(new byte[0])); } }); Document doc = builder.parse(in); Element root = doc.getDocumentElement(); String widthString = root.getAttribute("width"); while (Character.isLetter(widthString .charAt(widthString.length() - 1))) { widthString = widthString.substring(0, widthString.length() - 1); } String heightString = root.getAttribute("height"); while (Character.isLetter(heightString .charAt(heightString.length() - 1))) { heightString = heightString.substring(0,heightString.length() - 1); } float docWidth = Float.parseFloat(widthString); float docHeight = Float.parseFloat(heightString); diagram = new Diagram(docWidth, docHeight); if (!offset) { docHeight = 0; } loadChildren(root, Transform .createTranslateTransform(0, -docHeight)); return diagram; } catch (Exception e) { throw new SlickException("Failed to load inkscape document", e); } }
[ "private", "Diagram", "loadDiagram", "(", "InputStream", "in", ",", "boolean", "offset", ")", "throws", "SlickException", "{", "try", "{", "DocumentBuilderFactory", "factory", "=", "DocumentBuilderFactory", ".", "newInstance", "(", ")", ";", "factory", ".", "setVa...
Load a SVG document into a diagram @param in The input stream from which to read the SVG @param offset Offset the diagram for the height of the document @return The diagram loaded @throws SlickException Indicates a failure to process the document
[ "Load", "a", "SVG", "document", "into", "a", "diagram" ]
train
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/svg/InkscapeLoader.java#L144-L190
netplex/json-smart-v2
json-smart/src/main/java/net/minidev/json/JSONNavi.java
JSONNavi.set
public JSONNavi<T> set(String key, long value) { return set(key, Long.valueOf(value)); }
java
public JSONNavi<T> set(String key, long value) { return set(key, Long.valueOf(value)); }
[ "public", "JSONNavi", "<", "T", ">", "set", "(", "String", "key", ",", "long", "value", ")", "{", "return", "set", "(", "key", ",", "Long", ".", "valueOf", "(", "value", ")", ")", ";", "}" ]
write an value in the current object @param key key to access @param value new value @return this
[ "write", "an", "value", "in", "the", "current", "object" ]
train
https://github.com/netplex/json-smart-v2/blob/bfb3daef039e22a7bbff5f76bf14ea23330cd70e/json-smart/src/main/java/net/minidev/json/JSONNavi.java#L239-L241
exoplatform/jcr
exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/resource/FileResource.java
FileResource.getProperty
private HierarchicalProperty getProperty(Node node, QName name) throws PathNotFoundException, RepositoryException { Property property = node.getProperty(WebDavNamespaceContext.createName(name)); String propertyValue; if (property.getDefinition().isMultiple()) { if (property.getValues().length >= 1) { propertyValue = property.getValues()[0].getString(); } else { // this means that we return empty value, because according to WebDAV spec: // this is a property whose semantics and syntax are not enforced by the server // the server only records the value of a dead property; // the client is responsible for maintaining the consistency of the syntax and semantics of a dead property. propertyValue = ""; } } else { propertyValue = property.getString(); } return new HierarchicalProperty(name, propertyValue); }
java
private HierarchicalProperty getProperty(Node node, QName name) throws PathNotFoundException, RepositoryException { Property property = node.getProperty(WebDavNamespaceContext.createName(name)); String propertyValue; if (property.getDefinition().isMultiple()) { if (property.getValues().length >= 1) { propertyValue = property.getValues()[0].getString(); } else { // this means that we return empty value, because according to WebDAV spec: // this is a property whose semantics and syntax are not enforced by the server // the server only records the value of a dead property; // the client is responsible for maintaining the consistency of the syntax and semantics of a dead property. propertyValue = ""; } } else { propertyValue = property.getString(); } return new HierarchicalProperty(name, propertyValue); }
[ "private", "HierarchicalProperty", "getProperty", "(", "Node", "node", ",", "QName", "name", ")", "throws", "PathNotFoundException", ",", "RepositoryException", "{", "Property", "property", "=", "node", ".", "getProperty", "(", "WebDavNamespaceContext", ".", "createNa...
Returns node's property wrapped in {@link HierarchicalProperty}.
[ "Returns", "node", "s", "property", "wrapped", "in", "{" ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/resource/FileResource.java#L332-L356
UrielCh/ovh-java-sdk
ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java
ApiOvhOrder.hosting_privateDatabase_serviceName_ram_GET
public ArrayList<String> hosting_privateDatabase_serviceName_ram_GET(String serviceName, OvhAvailableRamSizeEnum ram) throws IOException { String qPath = "/order/hosting/privateDatabase/{serviceName}/ram"; StringBuilder sb = path(qPath, serviceName); query(sb, "ram", ram); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t1); }
java
public ArrayList<String> hosting_privateDatabase_serviceName_ram_GET(String serviceName, OvhAvailableRamSizeEnum ram) throws IOException { String qPath = "/order/hosting/privateDatabase/{serviceName}/ram"; StringBuilder sb = path(qPath, serviceName); query(sb, "ram", ram); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t1); }
[ "public", "ArrayList", "<", "String", ">", "hosting_privateDatabase_serviceName_ram_GET", "(", "String", "serviceName", ",", "OvhAvailableRamSizeEnum", "ram", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/order/hosting/privateDatabase/{serviceName}/ram\"", ";...
Get allowed durations for 'ram' option REST: GET /order/hosting/privateDatabase/{serviceName}/ram @param ram [required] Private database ram size @param serviceName [required] The internal name of your private database
[ "Get", "allowed", "durations", "for", "ram", "option" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L5200-L5206
jbundle/jbundle
base/remote/src/main/java/org/jbundle/base/remote/proxy/SendQueueHolder.java
SendQueueHolder.doProcess
public void doProcess(InputStream in, PrintWriter out, Map<String, Object> properties) throws RemoteException { String strCommand = this.getProperty(REMOTE_COMMAND, properties); if (SEND_MESSAGE.equals(strCommand)) { BaseMessage message = (BaseMessage)this.getNextObjectParam(in, MESSAGE, properties); ((RemoteSendQueue)m_remoteObject).sendMessage(message); } else super.doProcess(in, out, properties); }
java
public void doProcess(InputStream in, PrintWriter out, Map<String, Object> properties) throws RemoteException { String strCommand = this.getProperty(REMOTE_COMMAND, properties); if (SEND_MESSAGE.equals(strCommand)) { BaseMessage message = (BaseMessage)this.getNextObjectParam(in, MESSAGE, properties); ((RemoteSendQueue)m_remoteObject).sendMessage(message); } else super.doProcess(in, out, properties); }
[ "public", "void", "doProcess", "(", "InputStream", "in", ",", "PrintWriter", "out", ",", "Map", "<", "String", ",", "Object", ">", "properties", ")", "throws", "RemoteException", "{", "String", "strCommand", "=", "this", ".", "getProperty", "(", "REMOTE_COMMAN...
Handle the command send from my client peer. @param in The (optional) Inputstream to get the params from. @param out The stream to write the results.
[ "Handle", "the", "command", "send", "from", "my", "client", "peer", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/remote/src/main/java/org/jbundle/base/remote/proxy/SendQueueHolder.java#L60-L71
sarl/sarl
main/coreplugins/io.sarl.lang/src/io/sarl/lang/extralanguage/compiler/AbstractExtraLanguageGenerator.java
AbstractExtraLanguageGenerator._generate
protected void _generate(SarlScript script, IExtraLanguageGeneratorContext context) { if (script != null) { for (final XtendTypeDeclaration content : script.getXtendTypes()) { if (context.getCancelIndicator().isCanceled()) { return; } try { generate(content, context); } finally { context.clearData(); } } } }
java
protected void _generate(SarlScript script, IExtraLanguageGeneratorContext context) { if (script != null) { for (final XtendTypeDeclaration content : script.getXtendTypes()) { if (context.getCancelIndicator().isCanceled()) { return; } try { generate(content, context); } finally { context.clearData(); } } } }
[ "protected", "void", "_generate", "(", "SarlScript", "script", ",", "IExtraLanguageGeneratorContext", "context", ")", "{", "if", "(", "script", "!=", "null", ")", "{", "for", "(", "final", "XtendTypeDeclaration", "content", ":", "script", ".", "getXtendTypes", "...
Generate the given script. @param script the script. @param context the context.
[ "Generate", "the", "given", "script", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/extralanguage/compiler/AbstractExtraLanguageGenerator.java#L678-L691
jbundle/jbundle
base/message/trx/src/main/java/org/jbundle/base/message/trx/transport/BaseMessageTransport.java
BaseMessageTransport.sendMessage
public void sendMessage(BaseMessage messageOut, BaseInternalMessageProcessor messageOutProcessor) { int iErrorCode = this.convertToExternal(messageOut, messageOutProcessor); // Convert my standard message to the external format for this message BaseMessage messageReplyIn = null; if (iErrorCode != DBConstants.NORMAL_RETURN) { String strMessageDescription = this.getTask().getLastError(iErrorCode); if ((strMessageDescription == null) || (strMessageDescription.length() == 0)) strMessageDescription = "Error converting to external format"; iErrorCode = this.getTask().setLastError(strMessageDescription); messageReplyIn = BaseMessageProcessor.processErrorMessage(this, messageOut, strMessageDescription); } else { Utility.getLogger().info("sendMessage externalTrxMessage = " + messageOut); messageReplyIn = this.sendMessageRequest(messageOut); } if (messageReplyIn != null) // No reply if null. { this.setupReplyMessage(messageReplyIn, messageOut, MessageInfoTypeModel.REPLY, MessageTypeModel.MESSAGE_IN); Utility.getLogger().info("externalMessageReply: " + messageReplyIn); this.processIncomingMessage(messageReplyIn, messageOut); } }
java
public void sendMessage(BaseMessage messageOut, BaseInternalMessageProcessor messageOutProcessor) { int iErrorCode = this.convertToExternal(messageOut, messageOutProcessor); // Convert my standard message to the external format for this message BaseMessage messageReplyIn = null; if (iErrorCode != DBConstants.NORMAL_RETURN) { String strMessageDescription = this.getTask().getLastError(iErrorCode); if ((strMessageDescription == null) || (strMessageDescription.length() == 0)) strMessageDescription = "Error converting to external format"; iErrorCode = this.getTask().setLastError(strMessageDescription); messageReplyIn = BaseMessageProcessor.processErrorMessage(this, messageOut, strMessageDescription); } else { Utility.getLogger().info("sendMessage externalTrxMessage = " + messageOut); messageReplyIn = this.sendMessageRequest(messageOut); } if (messageReplyIn != null) // No reply if null. { this.setupReplyMessage(messageReplyIn, messageOut, MessageInfoTypeModel.REPLY, MessageTypeModel.MESSAGE_IN); Utility.getLogger().info("externalMessageReply: " + messageReplyIn); this.processIncomingMessage(messageReplyIn, messageOut); } }
[ "public", "void", "sendMessage", "(", "BaseMessage", "messageOut", ",", "BaseInternalMessageProcessor", "messageOutProcessor", ")", "{", "int", "iErrorCode", "=", "this", ".", "convertToExternal", "(", "messageOut", ",", "messageOutProcessor", ")", ";", "// Convert my s...
Using this transport, send this message (using this processor) and (optionally) process the reply. @param internalTrxMessage The message to send. @param messageOutProcessor The message out processor.
[ "Using", "this", "transport", "send", "this", "message", "(", "using", "this", "processor", ")", "and", "(", "optionally", ")", "process", "the", "reply", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/message/trx/src/main/java/org/jbundle/base/message/trx/transport/BaseMessageTransport.java#L159-L183
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java
Section508Compliance.processNullLayouts
private void processNullLayouts(String className, String methodName) { if ("java/awt/Container".equals(className) && "setLayout".equals(methodName) && (stack.getStackDepth() > 0) && stack.getStackItem(0).isNull()) { bugReporter.reportBug(new BugInstance(this, BugType.S508C_NULL_LAYOUT.name(), NORMAL_PRIORITY).addClass(this).addMethod(this).addSourceLine(this)); } }
java
private void processNullLayouts(String className, String methodName) { if ("java/awt/Container".equals(className) && "setLayout".equals(methodName) && (stack.getStackDepth() > 0) && stack.getStackItem(0).isNull()) { bugReporter.reportBug(new BugInstance(this, BugType.S508C_NULL_LAYOUT.name(), NORMAL_PRIORITY).addClass(this).addMethod(this).addSourceLine(this)); } }
[ "private", "void", "processNullLayouts", "(", "String", "className", ",", "String", "methodName", ")", "{", "if", "(", "\"java/awt/Container\"", ".", "equals", "(", "className", ")", "&&", "\"setLayout\"", ".", "equals", "(", "methodName", ")", "&&", "(", "sta...
looks for containers where a null layout is installed @param className class that a method call is made on @param methodName name of the method that is called
[ "looks", "for", "containers", "where", "a", "null", "layout", "is", "installed" ]
train
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/Section508Compliance.java#L367-L371
openengsb/openengsb
components/edb/src/main/java/org/openengsb/core/edb/jpa/internal/AbstractEDBService.java
AbstractEDBService.persistCommitChanges
private void persistCommitChanges(JPACommit commit, Long timestamp) { commit.setTimestamp(timestamp); addModifiedObjectsToEntityManager(commit.getJPAObjects(), timestamp); commit.setCommitted(true); logger.debug("persisting JPACommit"); entityManager.persist(commit); logger.debug("mark the deleted elements as deleted"); updateDeletedObjectsThroughEntityManager(commit.getDeletions(), timestamp); }
java
private void persistCommitChanges(JPACommit commit, Long timestamp) { commit.setTimestamp(timestamp); addModifiedObjectsToEntityManager(commit.getJPAObjects(), timestamp); commit.setCommitted(true); logger.debug("persisting JPACommit"); entityManager.persist(commit); logger.debug("mark the deleted elements as deleted"); updateDeletedObjectsThroughEntityManager(commit.getDeletions(), timestamp); }
[ "private", "void", "persistCommitChanges", "(", "JPACommit", "commit", ",", "Long", "timestamp", ")", "{", "commit", ".", "setTimestamp", "(", "timestamp", ")", ";", "addModifiedObjectsToEntityManager", "(", "commit", ".", "getJPAObjects", "(", ")", ",", "timestam...
Add all the changes which are done through the given commit object to the entity manager.
[ "Add", "all", "the", "changes", "which", "are", "done", "through", "the", "given", "commit", "object", "to", "the", "entity", "manager", "." ]
train
https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/components/edb/src/main/java/org/openengsb/core/edb/jpa/internal/AbstractEDBService.java#L112-L120
treasure-data/td-client-java
src/main/java/com/treasuredata/client/TDClient.java
TDClient.withApiKey
@Override public TDClient withApiKey(String newApiKey) { return new TDClient(config, httpClient, Optional.of(newApiKey)); }
java
@Override public TDClient withApiKey(String newApiKey) { return new TDClient(config, httpClient, Optional.of(newApiKey)); }
[ "@", "Override", "public", "TDClient", "withApiKey", "(", "String", "newApiKey", ")", "{", "return", "new", "TDClient", "(", "config", ",", "httpClient", ",", "Optional", ".", "of", "(", "newApiKey", ")", ")", ";", "}" ]
Create a new TDClient that uses the given api key for the authentication. The new instance of TDClient shares the same HttpClient, so closing this will invalidate the other copy of TDClient instances @param newApiKey @return
[ "Create", "a", "new", "TDClient", "that", "uses", "the", "given", "api", "key", "for", "the", "authentication", ".", "The", "new", "instance", "of", "TDClient", "shares", "the", "same", "HttpClient", "so", "closing", "this", "will", "invalidate", "the", "oth...
train
https://github.com/treasure-data/td-client-java/blob/2769cbcf0e787d457344422cfcdde467399bd684/src/main/java/com/treasuredata/client/TDClient.java#L143-L147
gallandarakhneorg/afc
core/text/src/main/java/org/arakhne/afc/text/TextUtil.java
TextUtil.equalsIgnoreCase
@Pure public static boolean equalsIgnoreCase(String firstText, String secondText, boolean isNullEmptyEquivalence) { final String aa = (firstText != null || !isNullEmptyEquivalence) ? firstText : ""; //$NON-NLS-1$ final String bb = (secondText != null || !isNullEmptyEquivalence) ? secondText : ""; //$NON-NLS-1$ if (aa == null) { return bb == null; } if (bb == null) { return false; } return aa.equalsIgnoreCase(bb); }
java
@Pure public static boolean equalsIgnoreCase(String firstText, String secondText, boolean isNullEmptyEquivalence) { final String aa = (firstText != null || !isNullEmptyEquivalence) ? firstText : ""; //$NON-NLS-1$ final String bb = (secondText != null || !isNullEmptyEquivalence) ? secondText : ""; //$NON-NLS-1$ if (aa == null) { return bb == null; } if (bb == null) { return false; } return aa.equalsIgnoreCase(bb); }
[ "@", "Pure", "public", "static", "boolean", "equalsIgnoreCase", "(", "String", "firstText", ",", "String", "secondText", ",", "boolean", "isNullEmptyEquivalence", ")", "{", "final", "String", "aa", "=", "(", "firstText", "!=", "null", "||", "!", "isNullEmptyEqui...
Enforced version of the equality test on two strings with case ignoring. This enforced version supported <code>null</code> values given as parameters. @param firstText first text. @param secondText second text. @param isNullEmptyEquivalence indicates if the <code>null</code> value is assimilated to the empty string. @return <code>true</code> if a is equal to b; otherwise <code>false</code>.
[ "Enforced", "version", "of", "the", "equality", "test", "on", "two", "strings", "with", "case", "ignoring", ".", "This", "enforced", "version", "supported", "<code", ">", "null<", "/", "code", ">", "values", "given", "as", "parameters", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/text/src/main/java/org/arakhne/afc/text/TextUtil.java#L78-L89
finmath/finmath-lib
src/main/java6/net/finmath/marketdata/model/curves/ForwardCurve.java
ForwardCurve.createForwardCurveFromForwards
public static ForwardCurve createForwardCurveFromForwards(String name, double[] times, double[] givenForwards, AnalyticModelInterface model, String discountCurveName, double paymentOffset) { ForwardCurve forwardCurve = new ForwardCurve(name, paymentOffset, InterpolationEntityForward.FORWARD, discountCurveName); for(int timeIndex=0; timeIndex<times.length;timeIndex++) { double fixingTime = times[timeIndex]; boolean isParameter = (fixingTime > 0); forwardCurve.addForward(model, fixingTime, givenForwards[timeIndex], isParameter); } return forwardCurve; }
java
public static ForwardCurve createForwardCurveFromForwards(String name, double[] times, double[] givenForwards, AnalyticModelInterface model, String discountCurveName, double paymentOffset) { ForwardCurve forwardCurve = new ForwardCurve(name, paymentOffset, InterpolationEntityForward.FORWARD, discountCurveName); for(int timeIndex=0; timeIndex<times.length;timeIndex++) { double fixingTime = times[timeIndex]; boolean isParameter = (fixingTime > 0); forwardCurve.addForward(model, fixingTime, givenForwards[timeIndex], isParameter); } return forwardCurve; }
[ "public", "static", "ForwardCurve", "createForwardCurveFromForwards", "(", "String", "name", ",", "double", "[", "]", "times", ",", "double", "[", "]", "givenForwards", ",", "AnalyticModelInterface", "model", ",", "String", "discountCurveName", ",", "double", "payme...
Create a forward curve from given times and given forwards with respect to an associated discount curve and payment offset. @param name The name of this curve. @param times A vector of given time points. @param givenForwards A vector of given forwards (corresponding to the given time points). @param model An analytic model providing a context. The discount curve (if needed) is obtained from this model. @param discountCurveName Name of the discount curve associated with this index (associated with it's funding or collateralization). @param paymentOffset Time between fixing and payment. @return A new ForwardCurve object.
[ "Create", "a", "forward", "curve", "from", "given", "times", "and", "given", "forwards", "with", "respect", "to", "an", "associated", "discount", "curve", "and", "payment", "offset", "." ]
train
https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java6/net/finmath/marketdata/model/curves/ForwardCurve.java#L289-L298
intellimate/Izou
src/main/java/org/intellimate/izou/identification/AddOnInformationManager.java
AddOnInformationManager.unregisterHelper
private boolean unregisterHelper(Supplier<Optional<AddOnModel>> suppAdd, Supplier<Optional<AddOnInformation>> suppAddInf) { boolean success1 = false; Optional<AddOnModel> addOnModel = suppAdd.get(); if (addOnModel.isPresent()) { success1 = addOns.remove(addOnModel.get()); } boolean success2 = false; Optional<AddOnInformation> addOnInformation = suppAddInf.get(); if (addOnInformation.isPresent()) { success2 = addOnInformations.remove(addOnInformation.get()); } return success1 && success2; }
java
private boolean unregisterHelper(Supplier<Optional<AddOnModel>> suppAdd, Supplier<Optional<AddOnInformation>> suppAddInf) { boolean success1 = false; Optional<AddOnModel> addOnModel = suppAdd.get(); if (addOnModel.isPresent()) { success1 = addOns.remove(addOnModel.get()); } boolean success2 = false; Optional<AddOnInformation> addOnInformation = suppAddInf.get(); if (addOnInformation.isPresent()) { success2 = addOnInformations.remove(addOnInformation.get()); } return success1 && success2; }
[ "private", "boolean", "unregisterHelper", "(", "Supplier", "<", "Optional", "<", "AddOnModel", ">", ">", "suppAdd", ",", "Supplier", "<", "Optional", "<", "AddOnInformation", ">", ">", "suppAddInf", ")", "{", "boolean", "success1", "=", "false", ";", "Optional...
Helper to unregister an addOn. @param suppAdd The first get function to find the right addon. @param suppAddInf The second get function to find the right addonInformation. @return True if the operation was successful, otherwise false.
[ "Helper", "to", "unregister", "an", "addOn", "." ]
train
https://github.com/intellimate/Izou/blob/40a808b97998e17655c4a78e30ce7326148aed27/src/main/java/org/intellimate/izou/identification/AddOnInformationManager.java#L93-L107
iipc/openwayback
wayback-core/src/main/java/org/archive/wayback/resourcestore/locationdb/RemoteResourceFileLocationDB.java
RemoteResourceFileLocationDB.removeNameUrl
public void removeNameUrl(final String name, final String url) throws IOException { doPostMethod(ResourceFileLocationDBServlet.REMOVE_OPERATION, name, url); }
java
public void removeNameUrl(final String name, final String url) throws IOException { doPostMethod(ResourceFileLocationDBServlet.REMOVE_OPERATION, name, url); }
[ "public", "void", "removeNameUrl", "(", "final", "String", "name", ",", "final", "String", "url", ")", "throws", "IOException", "{", "doPostMethod", "(", "ResourceFileLocationDBServlet", ".", "REMOVE_OPERATION", ",", "name", ",", "url", ")", ";", "}" ]
remove a single url location for a name, if it exists @param name @param url @throws IOException
[ "remove", "a", "single", "url", "location", "for", "a", "name", "if", "it", "exists" ]
train
https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/resourcestore/locationdb/RemoteResourceFileLocationDB.java#L148-L151
vladmihalcea/flexy-pool
flexy-pool-core/src/main/java/com/vladmihalcea/flexypool/util/ReflectionUtils.java
ReflectionUtils.getMethod
public static Method getMethod(Object target, String methodName, Class... parameterTypes) { try { return target.getClass().getMethod(methodName, parameterTypes); } catch (NoSuchMethodException e) { throw handleException(methodName, e); } }
java
public static Method getMethod(Object target, String methodName, Class... parameterTypes) { try { return target.getClass().getMethod(methodName, parameterTypes); } catch (NoSuchMethodException e) { throw handleException(methodName, e); } }
[ "public", "static", "Method", "getMethod", "(", "Object", "target", ",", "String", "methodName", ",", "Class", "...", "parameterTypes", ")", "{", "try", "{", "return", "target", ".", "getClass", "(", ")", ".", "getMethod", "(", "methodName", ",", "parameterT...
Get target method @param target target object @param methodName method name @param parameterTypes method parameter types @return return value
[ "Get", "target", "method" ]
train
https://github.com/vladmihalcea/flexy-pool/blob/d763d359e68299c2b4e28e4b67770581ae083431/flexy-pool-core/src/main/java/com/vladmihalcea/flexypool/util/ReflectionUtils.java#L76-L82
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/media/MediaClient.java
MediaClient.getMediaInfoOfFile
public GetMediaInfoOfFileResponse getMediaInfoOfFile(String bucket, String key) { GetMediaInfoOfFileRequest request = new GetMediaInfoOfFileRequest(); request.setBucket(bucket); request.setKey(key); return getMediaInfoOfFile(request); }
java
public GetMediaInfoOfFileResponse getMediaInfoOfFile(String bucket, String key) { GetMediaInfoOfFileRequest request = new GetMediaInfoOfFileRequest(); request.setBucket(bucket); request.setKey(key); return getMediaInfoOfFile(request); }
[ "public", "GetMediaInfoOfFileResponse", "getMediaInfoOfFile", "(", "String", "bucket", ",", "String", "key", ")", "{", "GetMediaInfoOfFileRequest", "request", "=", "new", "GetMediaInfoOfFileRequest", "(", ")", ";", "request", ".", "setBucket", "(", "bucket", ")", ";...
Retrieve the media information of an object in Bos bucket. @param bucket The bucket name of Bos object which you want to read. @param key The key name of Bos object which your want to read. @return The media information of an object in Bos bucket.
[ "Retrieve", "the", "media", "information", "of", "an", "object", "in", "Bos", "bucket", "." ]
train
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/media/MediaClient.java#L1001-L1006
SG-O/miIO
src/main/java/de/sg_o/app/miio/vacuum/Vacuum.java
Vacuum.cleanArea
public boolean cleanArea(float x0, float y0, float x1, float y1, int passes) throws CommandExecutionException { float t; if (x0 > x1) { t = x0; x0 = x1; x1 = t; } if (y0 > y1) { t = y0; y0 = y1; y1 = t; } int[] p0 = {(int)(x0 * 1000d), (int)(y0 * 1000d)}; int[] p1 = {(int)(x1 * 1000d), (int)(y1 * 1000d)}; return cleanArea(p0, p1, passes); }
java
public boolean cleanArea(float x0, float y0, float x1, float y1, int passes) throws CommandExecutionException { float t; if (x0 > x1) { t = x0; x0 = x1; x1 = t; } if (y0 > y1) { t = y0; y0 = y1; y1 = t; } int[] p0 = {(int)(x0 * 1000d), (int)(y0 * 1000d)}; int[] p1 = {(int)(x1 * 1000d), (int)(y1 * 1000d)}; return cleanArea(p0, p1, passes); }
[ "public", "boolean", "cleanArea", "(", "float", "x0", ",", "float", "y0", ",", "float", "x1", ",", "float", "y1", ",", "int", "passes", ")", "throws", "CommandExecutionException", "{", "float", "t", ";", "if", "(", "x0", ">", "x1", ")", "{", "t", "="...
Clean the specified area on the map. @param x0 The x position of the first point defining the area in meters. 25.6 meters is the center of the map. @param y0 The y position of the first point defining the area in meters. 25.6 meters is the center of the map. @param x1 The x position of the second point defining the area in meters. 25.6 meters is the center of the map. @param y1 The y position of the second point defining the area in meters. 25.6 meters is the center of the map. @param passes The number of times to clean this area. @return True if the command has been received correctly. @throws CommandExecutionException When there has been a error during the communication or the response was invalid.
[ "Clean", "the", "specified", "area", "on", "the", "map", "." ]
train
https://github.com/SG-O/miIO/blob/f352dbd2a699d2cdb1b412ca5e6cbb0c38ca779b/src/main/java/de/sg_o/app/miio/vacuum/Vacuum.java#L336-L353
Alluxio/alluxio
core/common/src/main/java/alluxio/util/ConfigurationUtils.java
ConfigurationUtils.loadClusterConfiguration
private static AlluxioConfiguration loadClusterConfiguration(GetConfigurationPResponse response, AlluxioConfiguration conf) { String clientVersion = conf.get(PropertyKey.VERSION); LOG.info("Alluxio client (version {}) is trying to load cluster level configurations", clientVersion); List<alluxio.grpc.ConfigProperty> clusterConfig = response.getConfigsList(); Properties clusterProps = loadClientProperties(clusterConfig, (key, value) -> String.format("Loading property: %s (%s) -> %s", key, key.getScope(), value)); // Check version. String clusterVersion = clusterProps.get(PropertyKey.VERSION).toString(); if (!clientVersion.equals(clusterVersion)) { LOG.warn("Alluxio client version ({}) does not match Alluxio cluster version ({})", clientVersion, clusterVersion); clusterProps.remove(PropertyKey.VERSION); } // Merge conf returned by master as the cluster default into conf object AlluxioProperties props = conf.copyProperties(); props.merge(clusterProps, Source.CLUSTER_DEFAULT); // Use the constructor to set cluster defaults as being loaded. InstancedConfiguration updatedConf = new InstancedConfiguration(props, true); updatedConf.validate(); LOG.info("Alluxio client has loaded cluster level configurations"); return updatedConf; }
java
private static AlluxioConfiguration loadClusterConfiguration(GetConfigurationPResponse response, AlluxioConfiguration conf) { String clientVersion = conf.get(PropertyKey.VERSION); LOG.info("Alluxio client (version {}) is trying to load cluster level configurations", clientVersion); List<alluxio.grpc.ConfigProperty> clusterConfig = response.getConfigsList(); Properties clusterProps = loadClientProperties(clusterConfig, (key, value) -> String.format("Loading property: %s (%s) -> %s", key, key.getScope(), value)); // Check version. String clusterVersion = clusterProps.get(PropertyKey.VERSION).toString(); if (!clientVersion.equals(clusterVersion)) { LOG.warn("Alluxio client version ({}) does not match Alluxio cluster version ({})", clientVersion, clusterVersion); clusterProps.remove(PropertyKey.VERSION); } // Merge conf returned by master as the cluster default into conf object AlluxioProperties props = conf.copyProperties(); props.merge(clusterProps, Source.CLUSTER_DEFAULT); // Use the constructor to set cluster defaults as being loaded. InstancedConfiguration updatedConf = new InstancedConfiguration(props, true); updatedConf.validate(); LOG.info("Alluxio client has loaded cluster level configurations"); return updatedConf; }
[ "private", "static", "AlluxioConfiguration", "loadClusterConfiguration", "(", "GetConfigurationPResponse", "response", ",", "AlluxioConfiguration", "conf", ")", "{", "String", "clientVersion", "=", "conf", ".", "get", "(", "PropertyKey", ".", "VERSION", ")", ";", "LOG...
Loads the cluster level configuration from the get configuration response, and merges it with the existing configuration. @param response the get configuration RPC response @param conf the existing configuration @return the merged configuration
[ "Loads", "the", "cluster", "level", "configuration", "from", "the", "get", "configuration", "response", "and", "merges", "it", "with", "the", "existing", "configuration", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/util/ConfigurationUtils.java#L535-L558
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/accesslayer/BasePrefetcher.java
BasePrefetcher.buildPrefetchCriteriaMultipleKeys
private Criteria buildPrefetchCriteriaMultipleKeys(Collection ids, FieldDescriptor fields[]) { Criteria crit = new Criteria(); Iterator iter = ids.iterator(); Object[] val; Identity id; while (iter.hasNext()) { Criteria c = new Criteria(); id = (Identity) iter.next(); val = id.getPrimaryKeyValues(); for (int i = 0; i < val.length; i++) { if (val[i] == null) { c.addIsNull(fields[i].getAttributeName()); } else { c.addEqualTo(fields[i].getAttributeName(), val[i]); } } crit.addOrCriteria(c); } return crit; }
java
private Criteria buildPrefetchCriteriaMultipleKeys(Collection ids, FieldDescriptor fields[]) { Criteria crit = new Criteria(); Iterator iter = ids.iterator(); Object[] val; Identity id; while (iter.hasNext()) { Criteria c = new Criteria(); id = (Identity) iter.next(); val = id.getPrimaryKeyValues(); for (int i = 0; i < val.length; i++) { if (val[i] == null) { c.addIsNull(fields[i].getAttributeName()); } else { c.addEqualTo(fields[i].getAttributeName(), val[i]); } } crit.addOrCriteria(c); } return crit; }
[ "private", "Criteria", "buildPrefetchCriteriaMultipleKeys", "(", "Collection", "ids", ",", "FieldDescriptor", "fields", "[", "]", ")", "{", "Criteria", "crit", "=", "new", "Criteria", "(", ")", ";", "Iterator", "iter", "=", "ids", ".", "iterator", "(", ")", ...
Build the Criteria using multiple ORs @param ids collection of identities @param fields @return Criteria
[ "Build", "the", "Criteria", "using", "multiple", "ORs" ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/accesslayer/BasePrefetcher.java#L203-L230
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.createTag
public Tag createTag(UUID projectId, String name, CreateTagOptionalParameter createTagOptionalParameter) { return createTagWithServiceResponseAsync(projectId, name, createTagOptionalParameter).toBlocking().single().body(); }
java
public Tag createTag(UUID projectId, String name, CreateTagOptionalParameter createTagOptionalParameter) { return createTagWithServiceResponseAsync(projectId, name, createTagOptionalParameter).toBlocking().single().body(); }
[ "public", "Tag", "createTag", "(", "UUID", "projectId", ",", "String", "name", ",", "CreateTagOptionalParameter", "createTagOptionalParameter", ")", "{", "return", "createTagWithServiceResponseAsync", "(", "projectId", ",", "name", ",", "createTagOptionalParameter", ")", ...
Create a tag for the project. @param projectId The project id @param name The tag name @param createTagOptionalParameter 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 Tag object if successful.
[ "Create", "a", "tag", "for", "the", "project", "." ]
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#L286-L288
vlingo/vlingo-actors
src/main/java/io/vlingo/actors/World.java
World.start
public static World start(final String name, final java.util.Properties properties) { return start(name, Configuration.defineWith(properties)); }
java
public static World start(final String name, final java.util.Properties properties) { return start(name, Configuration.defineWith(properties)); }
[ "public", "static", "World", "start", "(", "final", "String", "name", ",", "final", "java", ".", "util", ".", "Properties", "properties", ")", "{", "return", "start", "(", "name", ",", "Configuration", ".", "defineWith", "(", "properties", ")", ")", ";", ...
Answers a new {@code World} with the given {@code name} and that is configured with the contents of the properties. @param name the String name to assign to the new {@code World} instance @param properties the java.util.Properties used for configuration @return {@code World}
[ "Answers", "a", "new", "{" ]
train
https://github.com/vlingo/vlingo-actors/blob/c7d046fd139c0490cf0fd2588d7dc2f792f13493/src/main/java/io/vlingo/actors/World.java#L67-L69
Azure/azure-sdk-for-java
containerservice/resource-manager/v2019_02_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_02_01/implementation/ContainerServicesInner.java
ContainerServicesInner.createOrUpdate
public ContainerServiceInner createOrUpdate(String resourceGroupName, String containerServiceName, ContainerServiceInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, containerServiceName, parameters).toBlocking().last().body(); }
java
public ContainerServiceInner createOrUpdate(String resourceGroupName, String containerServiceName, ContainerServiceInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, containerServiceName, parameters).toBlocking().last().body(); }
[ "public", "ContainerServiceInner", "createOrUpdate", "(", "String", "resourceGroupName", ",", "String", "containerServiceName", ",", "ContainerServiceInner", "parameters", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "containerSer...
Creates or updates a container service. Creates or updates a container service with the specified configuration of orchestrator, masters, and agents. @param resourceGroupName The name of the resource group. @param containerServiceName The name of the container service in the specified subscription and resource group. @param parameters Parameters supplied to the Create or Update a Container Service operation. @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 ContainerServiceInner object if successful.
[ "Creates", "or", "updates", "a", "container", "service", ".", "Creates", "or", "updates", "a", "container", "service", "with", "the", "specified", "configuration", "of", "orchestrator", "masters", "and", "agents", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerservice/resource-manager/v2019_02_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_02_01/implementation/ContainerServicesInner.java#L231-L233
marvinlabs/android-intents
library/src/main/java/com/marvinlabs/intents/GeoIntents.java
GeoIntents.newNavigationIntent
public static Intent newNavigationIntent(float latitude, float longitude) { StringBuilder sb = new StringBuilder(); sb.append("google.navigation:q="); sb.append(latitude); sb.append(","); sb.append(longitude); return new Intent(Intent.ACTION_VIEW, Uri.parse(sb.toString())); }
java
public static Intent newNavigationIntent(float latitude, float longitude) { StringBuilder sb = new StringBuilder(); sb.append("google.navigation:q="); sb.append(latitude); sb.append(","); sb.append(longitude); return new Intent(Intent.ACTION_VIEW, Uri.parse(sb.toString())); }
[ "public", "static", "Intent", "newNavigationIntent", "(", "float", "latitude", ",", "float", "longitude", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "sb", ".", "append", "(", "\"google.navigation:q=\"", ")", ";", "sb", ".", ...
Intent that should allow opening a map showing the given location (if it exists) @param latitude The latitude of the center of the map @param longitude The longitude of the center of the map @return the intent
[ "Intent", "that", "should", "allow", "opening", "a", "map", "showing", "the", "given", "location", "(", "if", "it", "exists", ")" ]
train
https://github.com/marvinlabs/android-intents/blob/33e79c825188b6a97601869522533cc825801f6e/library/src/main/java/com/marvinlabs/intents/GeoIntents.java#L115-L124
line/armeria
core/src/main/java/com/linecorp/armeria/server/ServerBuilder.java
ServerBuilder.annotatedService
public ServerBuilder annotatedService(String pathPrefix, Object service) { return annotatedService(pathPrefix, service, Function.identity(), ImmutableList.of()); }
java
public ServerBuilder annotatedService(String pathPrefix, Object service) { return annotatedService(pathPrefix, service, Function.identity(), ImmutableList.of()); }
[ "public", "ServerBuilder", "annotatedService", "(", "String", "pathPrefix", ",", "Object", "service", ")", "{", "return", "annotatedService", "(", "pathPrefix", ",", "service", ",", "Function", ".", "identity", "(", ")", ",", "ImmutableList", ".", "of", "(", "...
Binds the specified annotated service object under the specified path prefix.
[ "Binds", "the", "specified", "annotated", "service", "object", "under", "the", "specified", "path", "prefix", "." ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/server/ServerBuilder.java#L1025-L1027
jbundle/webapp
base/src/main/java/org/jbundle/util/webapp/base/HttpServiceTracker.java
HttpServiceTracker.changeServletProperties
public boolean changeServletProperties(Servlet servlet, Dictionary<String, String> properties) { if (servlet instanceof WebappServlet) { Dictionary<String, String> dictionary = ((WebappServlet)servlet).getProperties(); properties = BaseBundleActivator.putAll(properties, dictionary); } return this.setServletProperties(servlet, properties); }
java
public boolean changeServletProperties(Servlet servlet, Dictionary<String, String> properties) { if (servlet instanceof WebappServlet) { Dictionary<String, String> dictionary = ((WebappServlet)servlet).getProperties(); properties = BaseBundleActivator.putAll(properties, dictionary); } return this.setServletProperties(servlet, properties); }
[ "public", "boolean", "changeServletProperties", "(", "Servlet", "servlet", ",", "Dictionary", "<", "String", ",", "String", ">", "properties", ")", "{", "if", "(", "servlet", "instanceof", "WebappServlet", ")", "{", "Dictionary", "<", "String", ",", "String", ...
Change the servlet properties to these properties. @param servlet @param properties @return
[ "Change", "the", "servlet", "properties", "to", "these", "properties", "." ]
train
https://github.com/jbundle/webapp/blob/af2cf32bd92254073052f1f9b4bcd47c2f76ba7d/base/src/main/java/org/jbundle/util/webapp/base/HttpServiceTracker.java#L283-L291
eduarddrenth/ConfigurableReports
src/main/java/com/vectorprint/report/itext/style/FontLoader.java
FontLoader.loadFont
public LOADSTATUS loadFont(InputStream in, String extension) throws IOException, VectorPrintException { // first download, then load File f = File.createTempFile("font.", extension); f.deleteOnExit(); IOHelper.load(in, new FileOutputStream(f), ReportConstants.DEFAULTBUFFERSIZE, true); return loadFont(f.getPath()); }
java
public LOADSTATUS loadFont(InputStream in, String extension) throws IOException, VectorPrintException { // first download, then load File f = File.createTempFile("font.", extension); f.deleteOnExit(); IOHelper.load(in, new FileOutputStream(f), ReportConstants.DEFAULTBUFFERSIZE, true); return loadFont(f.getPath()); }
[ "public", "LOADSTATUS", "loadFont", "(", "InputStream", "in", ",", "String", "extension", ")", "throws", "IOException", ",", "VectorPrintException", "{", "// first download, then load", "File", "f", "=", "File", ".", "createTempFile", "(", "\"font.\"", ",", "extensi...
allows loading font from a stream by first saving the bytes from the stream to a tempfile and then calling {@link #loadFont(java.lang.String) }. @param in @param extension e.g. .ttf @return @throws IOException
[ "allows", "loading", "font", "from", "a", "stream", "by", "first", "saving", "the", "bytes", "from", "the", "stream", "to", "a", "tempfile", "and", "then", "calling", "{", "@link", "#loadFont", "(", "java", ".", "lang", ".", "String", ")", "}", "." ]
train
https://github.com/eduarddrenth/ConfigurableReports/blob/b5fb7a89e16d9b35f557f3bf620594f821fa1552/src/main/java/com/vectorprint/report/itext/style/FontLoader.java#L98-L104
lesaint/damapping
core-parent/annotation-processor/src/main/java/fr/javatronic/damapping/processor/impl/javaxparsing/ProcessingEnvironmentWrapper.java
ProcessingEnvironmentWrapper.getAnnotationMirror
@Nullable private AnnotationMirror getAnnotationMirror(final TypeElement annotation, final Element element) { Optional<? extends AnnotationMirror> annotationMirror = FluentIterable .from(element.getAnnotationMirrors()) .filter(new Predicate<AnnotationMirror>() { @Override public boolean apply(@Nullable AnnotationMirror o) { return getTypeUtils().isSameType(o.getAnnotationType(), annotation.asType()); } } ).first(); if (annotationMirror.isPresent()) { return annotationMirror.get(); } return null; }
java
@Nullable private AnnotationMirror getAnnotationMirror(final TypeElement annotation, final Element element) { Optional<? extends AnnotationMirror> annotationMirror = FluentIterable .from(element.getAnnotationMirrors()) .filter(new Predicate<AnnotationMirror>() { @Override public boolean apply(@Nullable AnnotationMirror o) { return getTypeUtils().isSameType(o.getAnnotationType(), annotation.asType()); } } ).first(); if (annotationMirror.isPresent()) { return annotationMirror.get(); } return null; }
[ "@", "Nullable", "private", "AnnotationMirror", "getAnnotationMirror", "(", "final", "TypeElement", "annotation", ",", "final", "Element", "element", ")", "{", "Optional", "<", "?", "extends", "AnnotationMirror", ">", "annotationMirror", "=", "FluentIterable", ".", ...
Récupère l'AnnotationMirror sur l'Element spécifié qui correspond à l'annotation traitée par l'AnnotationProcessor dont le TypeElement est spécifié. </p> Cela permet de connaitre la ligne dans les sources où se trouver l'annotation traitée et de contextualiser encore plus finement le message d'erreur à la compilation. @param annotation un {@link TypeElement} représentation la classe d'une annotation @param element un {@link Element} sur lequel est posé l'annotation @return un {@link AnnotationMirror} ou {@code null}
[ "Récupère", "l", "AnnotationMirror", "sur", "l", "Element", "spécifié", "qui", "correspond", "à", "l", "annotation", "traitée", "par", "l", "AnnotationProcessor", "dont", "le", "TypeElement", "est", "spécifié", ".", "<", "/", "p", ">", "Cela", "permet", "de", ...
train
https://github.com/lesaint/damapping/blob/357afa5866939fd2a18c09213975ffef4836f328/core-parent/annotation-processor/src/main/java/fr/javatronic/damapping/processor/impl/javaxparsing/ProcessingEnvironmentWrapper.java#L134-L149
groupe-sii/ogham
ogham-core/src/main/java/fr/sii/ogham/core/util/EqualsBuilder.java
EqualsBuilder.append
public EqualsBuilder append(Object objectFieldValue, Object otherFieldValue) { if (equals && !same) { delegate.append(objectFieldValue, otherFieldValue); } return this; }
java
public EqualsBuilder append(Object objectFieldValue, Object otherFieldValue) { if (equals && !same) { delegate.append(objectFieldValue, otherFieldValue); } return this; }
[ "public", "EqualsBuilder", "append", "(", "Object", "objectFieldValue", ",", "Object", "otherFieldValue", ")", "{", "if", "(", "equals", "&&", "!", "same", ")", "{", "delegate", ".", "append", "(", "objectFieldValue", ",", "otherFieldValue", ")", ";", "}", "...
Test if two Objects are equal using their equals method. @param objectFieldValue the value of a field of the object @param otherFieldValue the value of a field of the other object @return used to chain calls
[ "Test", "if", "two", "Objects", "are", "equal", "using", "their", "equals", "method", "." ]
train
https://github.com/groupe-sii/ogham/blob/e273b845604add74b5a25dfd931cb3c166b1008f/ogham-core/src/main/java/fr/sii/ogham/core/util/EqualsBuilder.java#L145-L150
diffplug/durian
src/com/diffplug/common/base/MoreCollectors.java
MoreCollectors.singleOrEmptyShortCircuiting
public static <T> Optional<T> singleOrEmptyShortCircuiting(Stream<T> stream) { return stream.limit(2).map(Optional::ofNullable).reduce(Optional.empty(), (a, b) -> a.isPresent() ^ b.isPresent() ? b : Optional.empty()); }
java
public static <T> Optional<T> singleOrEmptyShortCircuiting(Stream<T> stream) { return stream.limit(2).map(Optional::ofNullable).reduce(Optional.empty(), (a, b) -> a.isPresent() ^ b.isPresent() ? b : Optional.empty()); }
[ "public", "static", "<", "T", ">", "Optional", "<", "T", ">", "singleOrEmptyShortCircuiting", "(", "Stream", "<", "T", ">", "stream", ")", "{", "return", "stream", ".", "limit", "(", "2", ")", ".", "map", "(", "Optional", "::", "ofNullable", ")", ".", ...
Same behavior as {@link #singleOrEmpty}, except that it returns early if it is possible to do so. Unfortunately, it is not possible to implement early-return behavior using the Collector interface, so MoreCollectors takes the stream as an argument. <p> Implementation credit to Thomas Jungblut <a href="http://stackoverflow.com/a/26810932/1153071">on StackOverflow</a>.
[ "Same", "behavior", "as", "{" ]
train
https://github.com/diffplug/durian/blob/10631a3480e5491eb6eb6ee06e752d8596914232/src/com/diffplug/common/base/MoreCollectors.java#L47-L50
OpenLiberty/open-liberty
dev/com.ibm.ws.repository.parsers/src/com/ibm/ws/repository/parsers/ParserBase.java
ParserBase.findFiles
private static Collection<Path> findFiles(FileSystem fs, final String contains) throws IOException { final ArrayList<Path> rv = new ArrayList<>(); Iterator<Path> dirs = fs.getRootDirectories().iterator(); Files.walkFileTree(dirs.next(), new SimpleFileVisitor<Path>() { @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) { if (file.toString().contains(contains)) { rv.add(file); } return FileVisitResult.CONTINUE; } }); if (dirs.hasNext()) { // There is more than one root directory. throw new IOException("FileSystem had more than one root directory: " + fs); } return rv; }
java
private static Collection<Path> findFiles(FileSystem fs, final String contains) throws IOException { final ArrayList<Path> rv = new ArrayList<>(); Iterator<Path> dirs = fs.getRootDirectories().iterator(); Files.walkFileTree(dirs.next(), new SimpleFileVisitor<Path>() { @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) { if (file.toString().contains(contains)) { rv.add(file); } return FileVisitResult.CONTINUE; } }); if (dirs.hasNext()) { // There is more than one root directory. throw new IOException("FileSystem had more than one root directory: " + fs); } return rv; }
[ "private", "static", "Collection", "<", "Path", ">", "findFiles", "(", "FileSystem", "fs", ",", "final", "String", "contains", ")", "throws", "IOException", "{", "final", "ArrayList", "<", "Path", ">", "rv", "=", "new", "ArrayList", "<>", "(", ")", ";", ...
Find files in the given fs where the path contains the string <code>contains</code>. Will throw an IOException if the fs contains more than one root directory.
[ "Find", "files", "in", "the", "given", "fs", "where", "the", "path", "contains", "the", "string", "<code", ">", "contains<", "/", "code", ">", ".", "Will", "throw", "an", "IOException", "if", "the", "fs", "contains", "more", "than", "one", "root", "direc...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.repository.parsers/src/com/ibm/ws/repository/parsers/ParserBase.java#L630-L647
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/PdfContentByte.java
PdfContentByte.setColorFill
public void setColorFill(PdfSpotColor sp, float tint) { checkWriter(); state.colorDetails = writer.addSimple(sp); PageResources prs = getPageResources(); PdfName name = state.colorDetails.getColorName(); name = prs.addColor(name, state.colorDetails.getIndirectReference()); content.append(name.getBytes()).append(" cs ").append(tint).append(" scn").append_i(separator); }
java
public void setColorFill(PdfSpotColor sp, float tint) { checkWriter(); state.colorDetails = writer.addSimple(sp); PageResources prs = getPageResources(); PdfName name = state.colorDetails.getColorName(); name = prs.addColor(name, state.colorDetails.getIndirectReference()); content.append(name.getBytes()).append(" cs ").append(tint).append(" scn").append_i(separator); }
[ "public", "void", "setColorFill", "(", "PdfSpotColor", "sp", ",", "float", "tint", ")", "{", "checkWriter", "(", ")", ";", "state", ".", "colorDetails", "=", "writer", ".", "addSimple", "(", "sp", ")", ";", "PageResources", "prs", "=", "getPageResources", ...
Sets the fill color to a spot color. @param sp the spot color @param tint the tint for the spot color. 0 is no color and 1 is 100% color
[ "Sets", "the", "fill", "color", "to", "a", "spot", "color", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfContentByte.java#L2268-L2275
livetribe/livetribe-slp
core/src/main/java/org/livetribe/slp/Attributes.java
Attributes.unescapeTag
public static String unescapeTag(String escapedTag) { // Check that the escaped tag does not contain reserved characters checkEscaped(escapedTag, Tag.reservedChars, false); // Unescape the tag return unescape(escapedTag, Tag.reservedChars); }
java
public static String unescapeTag(String escapedTag) { // Check that the escaped tag does not contain reserved characters checkEscaped(escapedTag, Tag.reservedChars, false); // Unescape the tag return unescape(escapedTag, Tag.reservedChars); }
[ "public", "static", "String", "unescapeTag", "(", "String", "escapedTag", ")", "{", "// Check that the escaped tag does not contain reserved characters", "checkEscaped", "(", "escapedTag", ",", "Tag", ".", "reservedChars", ",", "false", ")", ";", "// Unescape the tag", "r...
Unescapes the given escaped tag following RFC 2608, 5.0. For example, the escaped tag string <code>file\5fpath</code> will be converted into <code>file_path</code>. @param escapedTag the tag string to unescape @return the unescaped tag @throws ServiceLocationException if the escaping is wrong @see #escapeTag(String)
[ "Unescapes", "the", "given", "escaped", "tag", "following", "RFC", "2608", "5", ".", "0", ".", "For", "example", "the", "escaped", "tag", "string", "<code", ">", "file", "\\", "5fpath<", "/", "code", ">", "will", "be", "converted", "into", "<code", ">", ...
train
https://github.com/livetribe/livetribe-slp/blob/6cc13dbe81feab133fe3dd291ca081cbc6e1f591/core/src/main/java/org/livetribe/slp/Attributes.java#L285-L291
raphw/byte-buddy
byte-buddy-dep/src/main/java/net/bytebuddy/matcher/ElementMatchers.java
ElementMatchers.takesArgument
public static <T extends MethodDescription> ElementMatcher.Junction<T> takesArgument(int index, ElementMatcher<? super TypeDescription> matcher) { return takesGenericArgument(index, erasure(matcher)); }
java
public static <T extends MethodDescription> ElementMatcher.Junction<T> takesArgument(int index, ElementMatcher<? super TypeDescription> matcher) { return takesGenericArgument(index, erasure(matcher)); }
[ "public", "static", "<", "T", "extends", "MethodDescription", ">", "ElementMatcher", ".", "Junction", "<", "T", ">", "takesArgument", "(", "int", "index", ",", "ElementMatcher", "<", "?", "super", "TypeDescription", ">", "matcher", ")", "{", "return", "takesGe...
Matches {@link MethodDescription}s that define a type erasure as a parameter at the given index that matches the supplied matcher. @param index The index of the parameter. @param matcher A matcher to apply to the argument at the specified index. @param <T> The type of the matched object. @return An element matcher that matches a given argument type for a method description.
[ "Matches", "{", "@link", "MethodDescription", "}", "s", "that", "define", "a", "type", "erasure", "as", "a", "parameter", "at", "the", "given", "index", "that", "matches", "the", "supplied", "matcher", "." ]
train
https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/matcher/ElementMatchers.java#L1266-L1268
apache/flink
flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java
StreamExecutionEnvironment.enableCheckpointing
@Deprecated @SuppressWarnings("deprecation") @PublicEvolving public StreamExecutionEnvironment enableCheckpointing(long interval, CheckpointingMode mode, boolean force) { checkpointCfg.setCheckpointingMode(mode); checkpointCfg.setCheckpointInterval(interval); checkpointCfg.setForceCheckpointing(force); return this; }
java
@Deprecated @SuppressWarnings("deprecation") @PublicEvolving public StreamExecutionEnvironment enableCheckpointing(long interval, CheckpointingMode mode, boolean force) { checkpointCfg.setCheckpointingMode(mode); checkpointCfg.setCheckpointInterval(interval); checkpointCfg.setForceCheckpointing(force); return this; }
[ "@", "Deprecated", "@", "SuppressWarnings", "(", "\"deprecation\"", ")", "@", "PublicEvolving", "public", "StreamExecutionEnvironment", "enableCheckpointing", "(", "long", "interval", ",", "CheckpointingMode", "mode", ",", "boolean", "force", ")", "{", "checkpointCfg", ...
Enables checkpointing for the streaming job. The distributed state of the streaming dataflow will be periodically snapshotted. In case of a failure, the streaming dataflow will be restarted from the latest completed checkpoint. <p>The job draws checkpoints periodically, in the given interval. The state will be stored in the configured state backend. <p>NOTE: Checkpointing iterative streaming dataflows in not properly supported at the moment. If the "force" parameter is set to true, the system will execute the job nonetheless. @param interval Time interval between state checkpoints in millis. @param mode The checkpointing mode, selecting between "exactly once" and "at least once" guaranteed. @param force If true checkpointing will be enabled for iterative jobs as well. @deprecated Use {@link #enableCheckpointing(long, CheckpointingMode)} instead. Forcing checkpoints will be removed in the future.
[ "Enables", "checkpointing", "for", "the", "streaming", "job", ".", "The", "distributed", "state", "of", "the", "streaming", "dataflow", "will", "be", "periodically", "snapshotted", ".", "In", "case", "of", "a", "failure", "the", "streaming", "dataflow", "will", ...
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java#L366-L374
querydsl/querydsl
querydsl-core/src/main/java/com/querydsl/core/types/ExpressionUtils.java
ExpressionUtils.orderBy
public static Expression<?> orderBy(List<OrderSpecifier<?>> args) { return operation(Object.class, Ops.ORDER, ConstantImpl.create(args)); }
java
public static Expression<?> orderBy(List<OrderSpecifier<?>> args) { return operation(Object.class, Ops.ORDER, ConstantImpl.create(args)); }
[ "public", "static", "Expression", "<", "?", ">", "orderBy", "(", "List", "<", "OrderSpecifier", "<", "?", ">", ">", "args", ")", "{", "return", "operation", "(", "Object", ".", "class", ",", "Ops", ".", "ORDER", ",", "ConstantImpl", ".", "create", "(",...
Create an expression out of the given order specifiers @param args order @return expression for order
[ "Create", "an", "expression", "out", "of", "the", "given", "order", "specifiers" ]
train
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-core/src/main/java/com/querydsl/core/types/ExpressionUtils.java#L915-L917
asterisk-java/asterisk-java
src/main/java/org/asteriskjava/config/dialplan/ExtensionsConfigFileReader.java
ExtensionsConfigFileReader.processQuotesAndSlashes
private static String processQuotesAndSlashes(String start, char find, char replace_with) { String dataPut = ""; int inEscape = 0; int inQuotes = 0; char[] startChars = start.toCharArray(); for (char startChar : startChars) { if (inEscape != 0) { dataPut += startChar; /* Always goes verbatim */ inEscape = 0; } else { if (startChar == '\\') { inEscape = 1; /* Do not copy \ into the data */ } else if (startChar == '\'') { inQuotes = 1 - inQuotes; /* Do not copy ' into the data */ } else { /* Replace , with |, unless in quotes */ dataPut += inQuotes != 0 ? startChar : ((startChar == find) ? replace_with : startChar); } } } return dataPut; }
java
private static String processQuotesAndSlashes(String start, char find, char replace_with) { String dataPut = ""; int inEscape = 0; int inQuotes = 0; char[] startChars = start.toCharArray(); for (char startChar : startChars) { if (inEscape != 0) { dataPut += startChar; /* Always goes verbatim */ inEscape = 0; } else { if (startChar == '\\') { inEscape = 1; /* Do not copy \ into the data */ } else if (startChar == '\'') { inQuotes = 1 - inQuotes; /* Do not copy ' into the data */ } else { /* Replace , with |, unless in quotes */ dataPut += inQuotes != 0 ? startChar : ((startChar == find) ? replace_with : startChar); } } } return dataPut; }
[ "private", "static", "String", "processQuotesAndSlashes", "(", "String", "start", ",", "char", "find", ",", "char", "replace_with", ")", "{", "String", "dataPut", "=", "\"\"", ";", "int", "inEscape", "=", "0", ";", "int", "inQuotes", "=", "0", ";", "char",...
/* ast_process_quotes_and_slashes rewritten to be java friendly
[ "/", "*", "ast_process_quotes_and_slashes", "rewritten", "to", "be", "java", "friendly" ]
train
https://github.com/asterisk-java/asterisk-java/blob/cdc9849270d97ef75afa447a02c5194ed29121eb/src/main/java/org/asteriskjava/config/dialplan/ExtensionsConfigFileReader.java#L160-L192
OpenLiberty/open-liberty
dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/FixDependencyChecker.java
FixDependencyChecker.isSupersededBy
private static boolean isSupersededBy(List<Problem> apars1, List<Problem> apars2) { boolean result = true; // Now iterate over the current list of problems, and see if the incoming IFixInfo contains all of the problems from this IfixInfo. // If it does then return true, to indicate that this IFixInfo object has been superseded. for (Iterator<Problem> iter1 = apars1.iterator(); iter1.hasNext();) { boolean currAparMatch = false; Problem currApar1 = iter1.next(); for (Iterator<Problem> iter2 = apars2.iterator(); iter2.hasNext();) { Problem currApar2 = iter2.next(); if (currApar1.getDisplayId().equals(currApar2.getDisplayId())) { currAparMatch = true; } } if (!currAparMatch) result = false; } return result; }
java
private static boolean isSupersededBy(List<Problem> apars1, List<Problem> apars2) { boolean result = true; // Now iterate over the current list of problems, and see if the incoming IFixInfo contains all of the problems from this IfixInfo. // If it does then return true, to indicate that this IFixInfo object has been superseded. for (Iterator<Problem> iter1 = apars1.iterator(); iter1.hasNext();) { boolean currAparMatch = false; Problem currApar1 = iter1.next(); for (Iterator<Problem> iter2 = apars2.iterator(); iter2.hasNext();) { Problem currApar2 = iter2.next(); if (currApar1.getDisplayId().equals(currApar2.getDisplayId())) { currAparMatch = true; } } if (!currAparMatch) result = false; } return result; }
[ "private", "static", "boolean", "isSupersededBy", "(", "List", "<", "Problem", ">", "apars1", ",", "List", "<", "Problem", ">", "apars2", ")", "{", "boolean", "result", "=", "true", ";", "// Now iterate over the current list of problems, and see if the incoming IFixInfo...
Returns if the apars list apars1 is superseded by apars2. Apars1 is superseded by apars2 if all the apars in apars1 is also included in apars2 @param apars1 Fix to check @param apars2 @return Returns true if apars list apars1 is superseded by apars2. Else return false.
[ "Returns", "if", "the", "apars", "list", "apars1", "is", "superseded", "by", "apars2", ".", "Apars1", "is", "superseded", "by", "apars2", "if", "all", "the", "apars", "in", "apars1", "is", "also", "included", "in", "apars2" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/FixDependencyChecker.java#L165-L184
haifengl/smile
graph/src/main/java/smile/graph/AdjacencyMatrix.java
AdjacencyMatrix.dfsearch
private int dfsearch(int v, int[] pre, int[] ts, int count) { pre[v] = 0; for (int t = 0; t < n; t++) { if (graph[v][t] != 0.0 && pre[t] == -1) { count = dfsearch(t, pre, ts, count); } } ts[count++] = v; return count; }
java
private int dfsearch(int v, int[] pre, int[] ts, int count) { pre[v] = 0; for (int t = 0; t < n; t++) { if (graph[v][t] != 0.0 && pre[t] == -1) { count = dfsearch(t, pre, ts, count); } } ts[count++] = v; return count; }
[ "private", "int", "dfsearch", "(", "int", "v", ",", "int", "[", "]", "pre", ",", "int", "[", "]", "ts", ",", "int", "count", ")", "{", "pre", "[", "v", "]", "=", "0", ";", "for", "(", "int", "t", "=", "0", ";", "t", "<", "n", ";", "t", ...
Depth-first search of graph. @param v the start vertex. @param pre the array to store the order that vertices will be visited. @param ts the array to store the reverse topological order. @param count the number of vertices have been visited before this search. @return the number of vertices that have been visited after this search.
[ "Depth", "-", "first", "search", "of", "graph", "." ]
train
https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/graph/src/main/java/smile/graph/AdjacencyMatrix.java#L253-L264
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/io/utility/PRJUtil.java
PRJUtil.isSRIDValid
public static boolean isSRIDValid(int srid, Connection connection) throws SQLException { PreparedStatement ps = null; ResultSet rs = null; String queryCheck = "SELECT count(SRID) from PUBLIC.SPATIAL_REF_SYS WHERE SRID = ?"; try { ps = connection.prepareStatement(queryCheck); ps.setInt(1, srid); rs = ps.executeQuery(); if (rs.next()) { return rs.getInt(1) != 0; } } finally { if (rs != null) { rs.close(); } if (ps != null) { ps.close(); } } return false; }
java
public static boolean isSRIDValid(int srid, Connection connection) throws SQLException { PreparedStatement ps = null; ResultSet rs = null; String queryCheck = "SELECT count(SRID) from PUBLIC.SPATIAL_REF_SYS WHERE SRID = ?"; try { ps = connection.prepareStatement(queryCheck); ps.setInt(1, srid); rs = ps.executeQuery(); if (rs.next()) { return rs.getInt(1) != 0; } } finally { if (rs != null) { rs.close(); } if (ps != null) { ps.close(); } } return false; }
[ "public", "static", "boolean", "isSRIDValid", "(", "int", "srid", ",", "Connection", "connection", ")", "throws", "SQLException", "{", "PreparedStatement", "ps", "=", "null", ";", "ResultSet", "rs", "=", "null", ";", "String", "queryCheck", "=", "\"SELECT count(...
This method checks if a SRID value is valid according a list of SRID's avalaible on spatial_ref table of the datababase. @param srid @param connection @return @throws java.sql.SQLException
[ "This", "method", "checks", "if", "a", "SRID", "value", "is", "valid", "according", "a", "list", "of", "SRID", "s", "avalaible", "on", "spatial_ref", "table", "of", "the", "datababase", "." ]
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/utility/PRJUtil.java#L184-L204
akarnokd/akarnokd-xml
src/main/java/hu/akarnokd/xml/XNElement.java
XNElement.getDouble
public double getDouble(String name, String namespace) { return Double.parseDouble(get(name, namespace)); }
java
public double getDouble(String name, String namespace) { return Double.parseDouble(get(name, namespace)); }
[ "public", "double", "getDouble", "(", "String", "name", ",", "String", "namespace", ")", "{", "return", "Double", ".", "parseDouble", "(", "get", "(", "name", ",", "namespace", ")", ")", ";", "}" ]
Returns the attribute as a double value. @param name the attribute name @param namespace the attribute namespace @return the value
[ "Returns", "the", "attribute", "as", "a", "double", "value", "." ]
train
https://github.com/akarnokd/akarnokd-xml/blob/57466a5a9cb455a13d7121557c165287b31ee870/src/main/java/hu/akarnokd/xml/XNElement.java#L787-L789
netty/netty
handler/src/main/java/io/netty/handler/ssl/OpenSslSessionContext.java
OpenSslSessionContext.setTicketKeys
@Deprecated public void setTicketKeys(byte[] keys) { if (keys.length % SessionTicketKey.TICKET_KEY_SIZE != 0) { throw new IllegalArgumentException("keys.length % " + SessionTicketKey.TICKET_KEY_SIZE + " != 0"); } SessionTicketKey[] tickets = new SessionTicketKey[keys.length / SessionTicketKey.TICKET_KEY_SIZE]; for (int i = 0, a = 0; i < tickets.length; i++) { byte[] name = Arrays.copyOfRange(keys, a, SessionTicketKey.NAME_SIZE); a += SessionTicketKey.NAME_SIZE; byte[] hmacKey = Arrays.copyOfRange(keys, a, SessionTicketKey.HMAC_KEY_SIZE); i += SessionTicketKey.HMAC_KEY_SIZE; byte[] aesKey = Arrays.copyOfRange(keys, a, SessionTicketKey.AES_KEY_SIZE); a += SessionTicketKey.AES_KEY_SIZE; tickets[i] = new SessionTicketKey(name, hmacKey, aesKey); } Lock writerLock = context.ctxLock.writeLock(); writerLock.lock(); try { SSLContext.clearOptions(context.ctx, SSL.SSL_OP_NO_TICKET); SSLContext.setSessionTicketKeys(context.ctx, tickets); } finally { writerLock.unlock(); } }
java
@Deprecated public void setTicketKeys(byte[] keys) { if (keys.length % SessionTicketKey.TICKET_KEY_SIZE != 0) { throw new IllegalArgumentException("keys.length % " + SessionTicketKey.TICKET_KEY_SIZE + " != 0"); } SessionTicketKey[] tickets = new SessionTicketKey[keys.length / SessionTicketKey.TICKET_KEY_SIZE]; for (int i = 0, a = 0; i < tickets.length; i++) { byte[] name = Arrays.copyOfRange(keys, a, SessionTicketKey.NAME_SIZE); a += SessionTicketKey.NAME_SIZE; byte[] hmacKey = Arrays.copyOfRange(keys, a, SessionTicketKey.HMAC_KEY_SIZE); i += SessionTicketKey.HMAC_KEY_SIZE; byte[] aesKey = Arrays.copyOfRange(keys, a, SessionTicketKey.AES_KEY_SIZE); a += SessionTicketKey.AES_KEY_SIZE; tickets[i] = new SessionTicketKey(name, hmacKey, aesKey); } Lock writerLock = context.ctxLock.writeLock(); writerLock.lock(); try { SSLContext.clearOptions(context.ctx, SSL.SSL_OP_NO_TICKET); SSLContext.setSessionTicketKeys(context.ctx, tickets); } finally { writerLock.unlock(); } }
[ "@", "Deprecated", "public", "void", "setTicketKeys", "(", "byte", "[", "]", "keys", ")", "{", "if", "(", "keys", ".", "length", "%", "SessionTicketKey", ".", "TICKET_KEY_SIZE", "!=", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"keys.le...
Sets the SSL session ticket keys of this context. @deprecated use {@link #setTicketKeys(OpenSslSessionTicketKey...)}.
[ "Sets", "the", "SSL", "session", "ticket", "keys", "of", "this", "context", "." ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/OpenSslSessionContext.java#L72-L95
line/armeria
core/src/main/java/com/linecorp/armeria/internal/annotation/AnnotatedValueResolver.java
AnnotatedValueResolver.ofBeanField
static Optional<AnnotatedValueResolver> ofBeanField(Field field, Set<String> pathParams, List<RequestObjectResolver> objectResolvers) { // 'Field' is only used for converting a bean. // So we always need to pass 'implicitRequestObjectAnnotation' as false. return of(field, field, field.getType(), pathParams, objectResolvers, false); }
java
static Optional<AnnotatedValueResolver> ofBeanField(Field field, Set<String> pathParams, List<RequestObjectResolver> objectResolvers) { // 'Field' is only used for converting a bean. // So we always need to pass 'implicitRequestObjectAnnotation' as false. return of(field, field, field.getType(), pathParams, objectResolvers, false); }
[ "static", "Optional", "<", "AnnotatedValueResolver", ">", "ofBeanField", "(", "Field", "field", ",", "Set", "<", "String", ">", "pathParams", ",", "List", "<", "RequestObjectResolver", ">", "objectResolvers", ")", "{", "// 'Field' is only used for converting a bean.", ...
Returns a list of {@link AnnotatedValueResolver} which is constructed with the specified {@link Field}, {@code pathParams} and {@code objectResolvers}.
[ "Returns", "a", "list", "of", "{" ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/internal/annotation/AnnotatedValueResolver.java#L159-L164
akamai/AkamaiOPEN-edgegrid-java
edgerc-reader/src/main/java/com/akamai/edgegrid/signer/EdgeRcClientCredentialProvider.java
EdgeRcClientCredentialProvider.fromEdgeRc
public static EdgeRcClientCredentialProvider fromEdgeRc(File file, String section) throws ConfigurationException, IOException { Objects.requireNonNull(file, "file cannot be null"); return fromEdgeRc(new FileReader(file), section); }
java
public static EdgeRcClientCredentialProvider fromEdgeRc(File file, String section) throws ConfigurationException, IOException { Objects.requireNonNull(file, "file cannot be null"); return fromEdgeRc(new FileReader(file), section); }
[ "public", "static", "EdgeRcClientCredentialProvider", "fromEdgeRc", "(", "File", "file", ",", "String", "section", ")", "throws", "ConfigurationException", ",", "IOException", "{", "Objects", ".", "requireNonNull", "(", "file", ",", "\"file cannot be null\"", ")", ";"...
Loads an EdgeRc configuration file and returns an {@link EdgeRcClientCredentialProvider} to read {@link ClientCredential}s from it. @param file a {@link File} pointing to an EdgeRc file @param section a config section ({@code null} for the default section) @return a {@link EdgeRcClientCredentialProvider} @throws ConfigurationException If an error occurs while reading the configuration @throws IOException if an I/O error occurs
[ "Loads", "an", "EdgeRc", "configuration", "file", "and", "returns", "an", "{", "@link", "EdgeRcClientCredentialProvider", "}", "to", "read", "{", "@link", "ClientCredential", "}", "s", "from", "it", "." ]
train
https://github.com/akamai/AkamaiOPEN-edgegrid-java/blob/29aa39f0f70f62503e6a434c4470ee25cb640f58/edgerc-reader/src/main/java/com/akamai/edgegrid/signer/EdgeRcClientCredentialProvider.java#L62-L66
liyiorg/weixin-popular
src/main/java/weixin/popular/support/TicketManager.java
TicketManager.destroyed
public static void destroyed(String appid,String... types){ for(String type : types){ String key = appid + KEY_JOIN + type; if(futureMap.containsKey(key)){ futureMap.get(key).cancel(true); logger.info("destroyed appid:{} type:{}",appid,type); } } }
java
public static void destroyed(String appid,String... types){ for(String type : types){ String key = appid + KEY_JOIN + type; if(futureMap.containsKey(key)){ futureMap.get(key).cancel(true); logger.info("destroyed appid:{} type:{}",appid,type); } } }
[ "public", "static", "void", "destroyed", "(", "String", "appid", ",", "String", "...", "types", ")", "{", "for", "(", "String", "type", ":", "types", ")", "{", "String", "key", "=", "appid", "+", "KEY_JOIN", "+", "type", ";", "if", "(", "futureMap", ...
取消刷新 @param appid appid @param types ticket 类型 [jsapi,wx_card]
[ "取消刷新" ]
train
https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/support/TicketManager.java#L173-L181
elki-project/elki
addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/projections/CanvasSize.java
CanvasSize.continueToMargin
public double continueToMargin(double[] origin, double[] delta) { assert (delta.length == 2 && origin.length == 2); double factor = Double.POSITIVE_INFINITY; if(delta[0] > 0) { factor = Math.min(factor, (maxx - origin[0]) / delta[0]); } else if(delta[0] < 0) { factor = Math.min(factor, (origin[0] - minx) / -delta[0]); } if(delta[1] > 0) { factor = Math.min(factor, (maxy - origin[1]) / delta[1]); } else if(delta[1] < 0) { factor = Math.min(factor, (origin[1] - miny) / -delta[1]); } return factor; }
java
public double continueToMargin(double[] origin, double[] delta) { assert (delta.length == 2 && origin.length == 2); double factor = Double.POSITIVE_INFINITY; if(delta[0] > 0) { factor = Math.min(factor, (maxx - origin[0]) / delta[0]); } else if(delta[0] < 0) { factor = Math.min(factor, (origin[0] - minx) / -delta[0]); } if(delta[1] > 0) { factor = Math.min(factor, (maxy - origin[1]) / delta[1]); } else if(delta[1] < 0) { factor = Math.min(factor, (origin[1] - miny) / -delta[1]); } return factor; }
[ "public", "double", "continueToMargin", "(", "double", "[", "]", "origin", ",", "double", "[", "]", "delta", ")", "{", "assert", "(", "delta", ".", "length", "==", "2", "&&", "origin", ".", "length", "==", "2", ")", ";", "double", "factor", "=", "Dou...
Continue a line along a given direction to the margin. @param origin Origin point @param delta Direction vector @return scaling factor for delta vector
[ "Continue", "a", "line", "along", "a", "given", "direction", "to", "the", "margin", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/projections/CanvasSize.java#L116-L132
ModeShape/modeshape
modeshape-jcr/src/main/java/org/modeshape/connector/filesystem/FileSystemConnector.java
FileSystemConnector.fileFor
protected File fileFor( String id ) { assert id.startsWith(DELIMITER); if (id.endsWith(DELIMITER)) { id = id.substring(0, id.length() - DELIMITER.length()); } if (isContentNode(id)) { id = id.substring(0, id.length() - JCR_CONTENT_SUFFIX_LENGTH); } return new File(directory, id); }
java
protected File fileFor( String id ) { assert id.startsWith(DELIMITER); if (id.endsWith(DELIMITER)) { id = id.substring(0, id.length() - DELIMITER.length()); } if (isContentNode(id)) { id = id.substring(0, id.length() - JCR_CONTENT_SUFFIX_LENGTH); } return new File(directory, id); }
[ "protected", "File", "fileFor", "(", "String", "id", ")", "{", "assert", "id", ".", "startsWith", "(", "DELIMITER", ")", ";", "if", "(", "id", ".", "endsWith", "(", "DELIMITER", ")", ")", "{", "id", "=", "id", ".", "substring", "(", "0", ",", "id",...
Utility method for obtaining the {@link File} object that corresponds to the supplied identifier. Subclasses may override this method to change the format of the identifiers, but in that case should also override the {@link #isRoot(String)}, {@link #isContentNode(String)}, and {@link #idFor(File)} methods. @param id the identifier; may not be null @return the File object for the given identifier @see #isRoot(String) @see #isContentNode(String) @see #idFor(File)
[ "Utility", "method", "for", "obtaining", "the", "{", "@link", "File", "}", "object", "that", "corresponds", "to", "the", "supplied", "identifier", ".", "Subclasses", "may", "override", "this", "method", "to", "change", "the", "format", "of", "the", "identifier...
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/connector/filesystem/FileSystemConnector.java#L326-L335
webmetrics/browsermob-proxy
src/main/java/org/browsermob/proxy/jetty/http/ajp/AJP13Listener.java
AJP13Listener.createConnection
protected AJP13Connection createConnection(Socket socket) throws IOException { return new AJP13Connection(this,socket.getInputStream(),socket.getOutputStream(),socket,getBufferSize()); }
java
protected AJP13Connection createConnection(Socket socket) throws IOException { return new AJP13Connection(this,socket.getInputStream(),socket.getOutputStream(),socket,getBufferSize()); }
[ "protected", "AJP13Connection", "createConnection", "(", "Socket", "socket", ")", "throws", "IOException", "{", "return", "new", "AJP13Connection", "(", "this", ",", "socket", ".", "getInputStream", "(", ")", ",", "socket", ".", "getOutputStream", "(", ")", ",",...
Create an AJP13Connection instance. This method can be used to override the connection instance. @param socket The underlying socket.
[ "Create", "an", "AJP13Connection", "instance", ".", "This", "method", "can", "be", "used", "to", "override", "the", "connection", "instance", "." ]
train
https://github.com/webmetrics/browsermob-proxy/blob/a9252e62246ac33d55d51b993ba1159404e7d389/src/main/java/org/browsermob/proxy/jetty/http/ajp/AJP13Listener.java#L223-L226
cryptomator/cryptofs
src/main/java/org/cryptomator/cryptofs/migration/Migrators.java
Migrators.needsMigration
public boolean needsMigration(Path pathToVault, String masterkeyFilename) throws IOException { Path masterKeyPath = pathToVault.resolve(masterkeyFilename); byte[] keyFileContents = Files.readAllBytes(masterKeyPath); KeyFile keyFile = KeyFile.parse(keyFileContents); return keyFile.getVersion() < Constants.VAULT_VERSION; }
java
public boolean needsMigration(Path pathToVault, String masterkeyFilename) throws IOException { Path masterKeyPath = pathToVault.resolve(masterkeyFilename); byte[] keyFileContents = Files.readAllBytes(masterKeyPath); KeyFile keyFile = KeyFile.parse(keyFileContents); return keyFile.getVersion() < Constants.VAULT_VERSION; }
[ "public", "boolean", "needsMigration", "(", "Path", "pathToVault", ",", "String", "masterkeyFilename", ")", "throws", "IOException", "{", "Path", "masterKeyPath", "=", "pathToVault", ".", "resolve", "(", "masterkeyFilename", ")", ";", "byte", "[", "]", "keyFileCon...
Inspects the vault and checks if it is supported by this library. @param pathToVault Path to the vault's root @param masterkeyFilename Name of the masterkey file located in the vault @return <code>true</code> if the vault at the given path is of an older format than supported by this library @throws IOException if an I/O error occurs parsing the masterkey file
[ "Inspects", "the", "vault", "and", "checks", "if", "it", "is", "supported", "by", "this", "library", "." ]
train
https://github.com/cryptomator/cryptofs/blob/67fc1a4950dd1c150cd2e2c75bcabbeb7c9ac82e/src/main/java/org/cryptomator/cryptofs/migration/Migrators.java#L74-L79
casmi/casmi
src/main/java/casmi/graphics/color/CMYKColor.java
CMYKColor.lerpColor
public static Color lerpColor(ColorSet colorSet1, ColorSet colorSet2, double amt) { return lerpColor((CMYKColor)CMYKColor.color(colorSet1), (CMYKColor)CMYKColor.color(colorSet2), amt); }
java
public static Color lerpColor(ColorSet colorSet1, ColorSet colorSet2, double amt) { return lerpColor((CMYKColor)CMYKColor.color(colorSet1), (CMYKColor)CMYKColor.color(colorSet2), amt); }
[ "public", "static", "Color", "lerpColor", "(", "ColorSet", "colorSet1", ",", "ColorSet", "colorSet2", ",", "double", "amt", ")", "{", "return", "lerpColor", "(", "(", "CMYKColor", ")", "CMYKColor", ".", "color", "(", "colorSet1", ")", ",", "(", "CMYKColor", ...
Calculates a color or colors between two color at a specific increment. @param colorSet1 interpolate from this color @param colorSet2 interpolate to this color @param amt between 0.0 and 1.0 @return The calculated color values.
[ "Calculates", "a", "color", "or", "colors", "between", "two", "color", "at", "a", "specific", "increment", "." ]
train
https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/graphics/color/CMYKColor.java#L164-L166
lingochamp/okdownload
okdownload/src/main/java/com/liulishuo/okdownload/core/breakpoint/BreakpointInfo.java
BreakpointInfo.copyWithReplaceIdAndUrl
public BreakpointInfo copyWithReplaceIdAndUrl(int replaceId, String newUrl) { final BreakpointInfo info = new BreakpointInfo(replaceId, newUrl, parentFile, filenameHolder.get(), taskOnlyProvidedParentPath); info.chunked = this.chunked; for (BlockInfo blockInfo : blockInfoList) { info.blockInfoList.add(blockInfo.copy()); } return info; }
java
public BreakpointInfo copyWithReplaceIdAndUrl(int replaceId, String newUrl) { final BreakpointInfo info = new BreakpointInfo(replaceId, newUrl, parentFile, filenameHolder.get(), taskOnlyProvidedParentPath); info.chunked = this.chunked; for (BlockInfo blockInfo : blockInfoList) { info.blockInfoList.add(blockInfo.copy()); } return info; }
[ "public", "BreakpointInfo", "copyWithReplaceIdAndUrl", "(", "int", "replaceId", ",", "String", "newUrl", ")", "{", "final", "BreakpointInfo", "info", "=", "new", "BreakpointInfo", "(", "replaceId", ",", "newUrl", ",", "parentFile", ",", "filenameHolder", ".", "get...
You can use this method to replace url for using breakpoint info from another task.
[ "You", "can", "use", "this", "method", "to", "replace", "url", "for", "using", "breakpoint", "info", "from", "another", "task", "." ]
train
https://github.com/lingochamp/okdownload/blob/403e2c814556ef7f2fade1f5bee83a02a5eaecb2/okdownload/src/main/java/com/liulishuo/okdownload/core/breakpoint/BreakpointInfo.java#L202-L210
netscaler/sdx_nitro
src/main/java/com/citrix/sdx/nitro/resource/config/mps/traceroute.java
traceroute.get_nitro_bulk_response
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { traceroute_responses result = (traceroute_responses) service.get_payload_formatter().string_to_resource(traceroute_responses.class, response); if(result.errorcode != 0) { if (result.errorcode == SESSION_NOT_EXISTS) service.clear_session(); throw new nitro_exception(result.message, result.errorcode, (base_response [])result.traceroute_response_array); } traceroute[] result_traceroute = new traceroute[result.traceroute_response_array.length]; for(int i = 0; i < result.traceroute_response_array.length; i++) { result_traceroute[i] = result.traceroute_response_array[i].traceroute[0]; } return result_traceroute; }
java
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { traceroute_responses result = (traceroute_responses) service.get_payload_formatter().string_to_resource(traceroute_responses.class, response); if(result.errorcode != 0) { if (result.errorcode == SESSION_NOT_EXISTS) service.clear_session(); throw new nitro_exception(result.message, result.errorcode, (base_response [])result.traceroute_response_array); } traceroute[] result_traceroute = new traceroute[result.traceroute_response_array.length]; for(int i = 0; i < result.traceroute_response_array.length; i++) { result_traceroute[i] = result.traceroute_response_array[i].traceroute[0]; } return result_traceroute; }
[ "protected", "base_resource", "[", "]", "get_nitro_bulk_response", "(", "nitro_service", "service", ",", "String", "response", ")", "throws", "Exception", "{", "traceroute_responses", "result", "=", "(", "traceroute_responses", ")", "service", ".", "get_payload_formatte...
<pre> Converts API response of bulk operation into object and returns the object array in case of get request. </pre>
[ "<pre", ">", "Converts", "API", "response", "of", "bulk", "operation", "into", "object", "and", "returns", "the", "object", "array", "in", "case", "of", "get", "request", ".", "<", "/", "pre", ">" ]
train
https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/mps/traceroute.java#L203-L220
looly/hutool
hutool-db/src/main/java/cn/hutool/db/sql/SqlBuilder.java
SqlBuilder.insert
public SqlBuilder insert(Entity entity, DialectName dialectName) { // 验证 validateEntity(entity); if (null != wrapper) { // 包装表名 // entity = wrapper.wrap(entity); entity.setTableName(wrapper.wrap(entity.getTableName())); } final boolean isOracle = ObjectUtil.equal(dialectName, DialectName.ORACLE);// 对Oracle的特殊处理 final StringBuilder fieldsPart = new StringBuilder(); final StringBuilder placeHolder = new StringBuilder(); boolean isFirst = true; String field; Object value; for (Entry<String, Object> entry : entity.entrySet()) { field = entry.getKey(); value = entry.getValue(); if (StrUtil.isNotBlank(field) /* && null != value */) { if (isFirst) { isFirst = false; } else { // 非第一个参数,追加逗号 fieldsPart.append(", "); placeHolder.append(", "); } this.fields.add(field); fieldsPart.append((null != wrapper) ? wrapper.wrap(field) : field); if (isOracle && value instanceof String && StrUtil.endWithIgnoreCase((String) value, ".nextval")) { // Oracle的特殊自增键,通过字段名.nextval获得下一个值 placeHolder.append(value); } else { placeHolder.append("?"); this.paramValues.add(value); } } } sql.append("INSERT INTO ")// .append(entity.getTableName()).append(" (").append(fieldsPart).append(") VALUES (")// .append(placeHolder.toString()).append(")"); return this; }
java
public SqlBuilder insert(Entity entity, DialectName dialectName) { // 验证 validateEntity(entity); if (null != wrapper) { // 包装表名 // entity = wrapper.wrap(entity); entity.setTableName(wrapper.wrap(entity.getTableName())); } final boolean isOracle = ObjectUtil.equal(dialectName, DialectName.ORACLE);// 对Oracle的特殊处理 final StringBuilder fieldsPart = new StringBuilder(); final StringBuilder placeHolder = new StringBuilder(); boolean isFirst = true; String field; Object value; for (Entry<String, Object> entry : entity.entrySet()) { field = entry.getKey(); value = entry.getValue(); if (StrUtil.isNotBlank(field) /* && null != value */) { if (isFirst) { isFirst = false; } else { // 非第一个参数,追加逗号 fieldsPart.append(", "); placeHolder.append(", "); } this.fields.add(field); fieldsPart.append((null != wrapper) ? wrapper.wrap(field) : field); if (isOracle && value instanceof String && StrUtil.endWithIgnoreCase((String) value, ".nextval")) { // Oracle的特殊自增键,通过字段名.nextval获得下一个值 placeHolder.append(value); } else { placeHolder.append("?"); this.paramValues.add(value); } } } sql.append("INSERT INTO ")// .append(entity.getTableName()).append(" (").append(fieldsPart).append(") VALUES (")// .append(placeHolder.toString()).append(")"); return this; }
[ "public", "SqlBuilder", "insert", "(", "Entity", "entity", ",", "DialectName", "dialectName", ")", "{", "// 验证\r", "validateEntity", "(", "entity", ")", ";", "if", "(", "null", "!=", "wrapper", ")", "{", "// 包装表名\r", "// entity = wrapper.wrap(entity);\r", "entity"...
插入<br> 插入会忽略空的字段名及其对应值,但是对于有字段名对应值为{@code null}的情况不忽略 @param entity 实体 @param dialectName 方言名 @return 自己
[ "插入<br", ">", "插入会忽略空的字段名及其对应值,但是对于有字段名对应值为", "{", "@code", "null", "}", "的情况不忽略" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/sql/SqlBuilder.java#L106-L151