repository_name
stringlengths
7
54
func_path_in_repository
stringlengths
18
218
func_name
stringlengths
5
140
whole_func_string
stringlengths
79
3.99k
language
stringclasses
1 value
func_code_string
stringlengths
79
3.99k
func_code_tokens
listlengths
20
624
func_documentation_string
stringlengths
61
1.96k
func_documentation_tokens
listlengths
1
478
split_name
stringclasses
1 value
func_code_url
stringlengths
107
339
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/MeasureFormat.java
MeasureFormat.getInstance
public static MeasureFormat getInstance(ULocale locale, FormatWidth formatWidth) { return getInstance(locale, formatWidth, NumberFormat.getInstance(locale)); }
java
public static MeasureFormat getInstance(ULocale locale, FormatWidth formatWidth) { return getInstance(locale, formatWidth, NumberFormat.getInstance(locale)); }
[ "public", "static", "MeasureFormat", "getInstance", "(", "ULocale", "locale", ",", "FormatWidth", "formatWidth", ")", "{", "return", "getInstance", "(", "locale", ",", "formatWidth", ",", "NumberFormat", ".", "getInstance", "(", "locale", ")", ")", ";", "}" ]
Create a format from the locale, formatWidth, and format. @param locale the locale. @param formatWidth hints how long formatted strings should be. @return The new MeasureFormat object.
[ "Create", "a", "format", "from", "the", "locale", "formatWidth", "and", "format", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/MeasureFormat.java#L212-L214
languagetool-org/languagetool
languagetool-language-modules/en/src/main/java/org/languagetool/rules/en/AvsAnData.java
AvsAnData.loadWords
private static Set<String> loadWords(String path) { Set<String> set = new HashSet<>(); InputStream stream = JLanguageTool.getDataBroker().getFromRulesDirAsStream(path); try (Scanner scanner = new Scanner(stream, "utf-8")) { while (scanner.hasNextLine()) { String line = scanner.nextLine().trim(); if (line.isEmpty() || line.charAt(0) == '#') { continue; } if (line.charAt(0) == '*') { set.add(line.substring(1)); } else { set.add(line.toLowerCase()); } } } return Collections.unmodifiableSet(set); }
java
private static Set<String> loadWords(String path) { Set<String> set = new HashSet<>(); InputStream stream = JLanguageTool.getDataBroker().getFromRulesDirAsStream(path); try (Scanner scanner = new Scanner(stream, "utf-8")) { while (scanner.hasNextLine()) { String line = scanner.nextLine().trim(); if (line.isEmpty() || line.charAt(0) == '#') { continue; } if (line.charAt(0) == '*') { set.add(line.substring(1)); } else { set.add(line.toLowerCase()); } } } return Collections.unmodifiableSet(set); }
[ "private", "static", "Set", "<", "String", ">", "loadWords", "(", "String", "path", ")", "{", "Set", "<", "String", ">", "set", "=", "new", "HashSet", "<>", "(", ")", ";", "InputStream", "stream", "=", "JLanguageTool", ".", "getDataBroker", "(", ")", "...
Load words, normalized to lowercase unless starting with '*'.
[ "Load", "words", "normalized", "to", "lowercase", "unless", "starting", "with", "*", "." ]
train
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-language-modules/en/src/main/java/org/languagetool/rules/en/AvsAnData.java#L52-L69
UrielCh/ovh-java-sdk
ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java
ApiOvhMe.accessRestriction_sms_POST
public OvhSmsSecret accessRestriction_sms_POST(String phone) throws IOException { String qPath = "/me/accessRestriction/sms"; StringBuilder sb = path(qPath); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "phone", phone); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhSmsSecret.class); }
java
public OvhSmsSecret accessRestriction_sms_POST(String phone) throws IOException { String qPath = "/me/accessRestriction/sms"; StringBuilder sb = path(qPath); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "phone", phone); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhSmsSecret.class); }
[ "public", "OvhSmsSecret", "accessRestriction_sms_POST", "(", "String", "phone", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/me/accessRestriction/sms\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ")", ";", "HashMap", "<", "String", "...
Add a SMS access restriction REST: POST /me/accessRestriction/sms @param phone [required] Cell phone number to register
[ "Add", "a", "SMS", "access", "restriction" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L3767-L3774
looly/hutool
hutool-core/src/main/java/cn/hutool/core/lang/Validator.java
Validator.validateNumber
public static String validateNumber(String value, String errorMsg) throws ValidateException { if (false == isNumber(value)) { throw new ValidateException(errorMsg); } return value; }
java
public static String validateNumber(String value, String errorMsg) throws ValidateException { if (false == isNumber(value)) { throw new ValidateException(errorMsg); } return value; }
[ "public", "static", "String", "validateNumber", "(", "String", "value", ",", "String", "errorMsg", ")", "throws", "ValidateException", "{", "if", "(", "false", "==", "isNumber", "(", "value", ")", ")", "{", "throw", "new", "ValidateException", "(", "errorMsg",...
验证是否为数字 @param value 表单值 @param errorMsg 验证错误的信息 @return 验证后的值 @throws ValidateException 验证异常
[ "验证是否为数字" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Validator.java#L544-L549
jbundle/webapp
base/src/main/java/org/jbundle/util/webapp/base/MultipleHttpServiceActivator.java
MultipleHttpServiceActivator.shutdownService
@Override public boolean shutdownService(Object service, BundleContext context) { for (String alias : getAliases()) { HttpServiceTracker serviceTracker = getServiceTracker(context, BaseWebappServlet.ALIAS, alias); if (serviceTracker != null) serviceTracker.close(); } return true; }
java
@Override public boolean shutdownService(Object service, BundleContext context) { for (String alias : getAliases()) { HttpServiceTracker serviceTracker = getServiceTracker(context, BaseWebappServlet.ALIAS, alias); if (serviceTracker != null) serviceTracker.close(); } return true; }
[ "@", "Override", "public", "boolean", "shutdownService", "(", "Object", "service", ",", "BundleContext", "context", ")", "{", "for", "(", "String", "alias", ":", "getAliases", "(", ")", ")", "{", "HttpServiceTracker", "serviceTracker", "=", "getServiceTracker", ...
Start this service. Override this to do all the startup. @return true if successful.
[ "Start", "this", "service", ".", "Override", "this", "to", "do", "all", "the", "startup", "." ]
train
https://github.com/jbundle/webapp/blob/af2cf32bd92254073052f1f9b4bcd47c2f76ba7d/base/src/main/java/org/jbundle/util/webapp/base/MultipleHttpServiceActivator.java#L53-L63
zaproxy/zaproxy
src/org/zaproxy/zap/control/AddOnLoaderUtils.java
AddOnLoaderUtils.loadAndInstantiateClass
public static <T> T loadAndInstantiateClass( AddOnClassLoader addOnClassLoader, String classname, Class<T> clazz, String type) { validateNotNull(addOnClassLoader, "addOnClassLoader"); validateNotNull(classname, "classname"); validateNotNull(clazz, "clazz"); validateNotNull(type, "type"); return loadAndInstantiateClassImpl(addOnClassLoader, classname, clazz, type); }
java
public static <T> T loadAndInstantiateClass( AddOnClassLoader addOnClassLoader, String classname, Class<T> clazz, String type) { validateNotNull(addOnClassLoader, "addOnClassLoader"); validateNotNull(classname, "classname"); validateNotNull(clazz, "clazz"); validateNotNull(type, "type"); return loadAndInstantiateClassImpl(addOnClassLoader, classname, clazz, type); }
[ "public", "static", "<", "T", ">", "T", "loadAndInstantiateClass", "(", "AddOnClassLoader", "addOnClassLoader", ",", "String", "classname", ",", "Class", "<", "T", ">", "clazz", ",", "String", "type", ")", "{", "validateNotNull", "(", "addOnClassLoader", ",", ...
Loads, using the given {@code addOnClassLoader}, and creates an instance with the given {@code classname} of the (expected) given {@code clazz}. The {@code type} is used in error log messages, to indicate the expected type being loaded. @param <T> the type of the class that will be instantiated @param addOnClassLoader the class loader of the add-on that contains the classes @param classname the binary name of the class that will be loaded @param clazz the type of the instance that will be created using the class loaded @param type the expected type being loaded (for example, "extension", "ascanrule"...) @return an instance of the given {@code clazz}, or {@code null} if an error occurred (for example, not being of the expected type) @throws IllegalArgumentException if any of the parameters is {@code null}.
[ "Loads", "using", "the", "given", "{", "@code", "addOnClassLoader", "}", "and", "creates", "an", "instance", "with", "the", "given", "{", "@code", "classname", "}", "of", "the", "(", "expected", ")", "given", "{", "@code", "clazz", "}", ".", "The", "{", ...
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/control/AddOnLoaderUtils.java#L58-L69
database-rider/database-rider
rider-core/src/main/java/com/github/database/rider/core/dataset/DataSetExecutorImpl.java
DataSetExecutorImpl.performReplacements
private IDataSet performReplacements(IDataSet dataSet, List<Replacer> replacersList) { if (replacersList == null || replacersList.isEmpty()) return dataSet; ReplacementDataSet replacementSet = new ReplacementDataSet(dataSet); // convert to set to remove duplicates Set<Replacer> replacers = new HashSet<>((List<Replacer>) replacersList); for (Replacer replacer : replacers) { replacer.addReplacements(replacementSet); } return replacementSet; }
java
private IDataSet performReplacements(IDataSet dataSet, List<Replacer> replacersList) { if (replacersList == null || replacersList.isEmpty()) return dataSet; ReplacementDataSet replacementSet = new ReplacementDataSet(dataSet); // convert to set to remove duplicates Set<Replacer> replacers = new HashSet<>((List<Replacer>) replacersList); for (Replacer replacer : replacers) { replacer.addReplacements(replacementSet); } return replacementSet; }
[ "private", "IDataSet", "performReplacements", "(", "IDataSet", "dataSet", ",", "List", "<", "Replacer", ">", "replacersList", ")", "{", "if", "(", "replacersList", "==", "null", "||", "replacersList", ".", "isEmpty", "(", ")", ")", "return", "dataSet", ";", ...
Perform replacements from all {@link Replacer} implementations to given dataset registered in {@link #dbUnitConfig}.
[ "Perform", "replacements", "from", "all", "{" ]
train
https://github.com/database-rider/database-rider/blob/7545cc31118df9cfef3f89e27223b433a24fb5dd/rider-core/src/main/java/com/github/database/rider/core/dataset/DataSetExecutorImpl.java#L458-L471
Azure/azure-sdk-for-java
appservice/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/appservice/v2016_03_01/implementation/ResourceHealthMetadatasInner.java
ResourceHealthMetadatasInner.listBySiteWithServiceResponseAsync
public Observable<ServiceResponse<Page<ResourceHealthMetadataInner>>> listBySiteWithServiceResponseAsync(final String resourceGroupName, final String name) { return listBySiteSinglePageAsync(resourceGroupName, name) .concatMap(new Func1<ServiceResponse<Page<ResourceHealthMetadataInner>>, Observable<ServiceResponse<Page<ResourceHealthMetadataInner>>>>() { @Override public Observable<ServiceResponse<Page<ResourceHealthMetadataInner>>> call(ServiceResponse<Page<ResourceHealthMetadataInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listBySiteNextWithServiceResponseAsync(nextPageLink)); } }); }
java
public Observable<ServiceResponse<Page<ResourceHealthMetadataInner>>> listBySiteWithServiceResponseAsync(final String resourceGroupName, final String name) { return listBySiteSinglePageAsync(resourceGroupName, name) .concatMap(new Func1<ServiceResponse<Page<ResourceHealthMetadataInner>>, Observable<ServiceResponse<Page<ResourceHealthMetadataInner>>>>() { @Override public Observable<ServiceResponse<Page<ResourceHealthMetadataInner>>> call(ServiceResponse<Page<ResourceHealthMetadataInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listBySiteNextWithServiceResponseAsync(nextPageLink)); } }); }
[ "public", "Observable", "<", "ServiceResponse", "<", "Page", "<", "ResourceHealthMetadataInner", ">", ">", ">", "listBySiteWithServiceResponseAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "name", ")", "{", "return", "listBySiteSinglePageAs...
Gets the category of ResourceHealthMetadata to use for the given site as a collection. Gets the category of ResourceHealthMetadata to use for the given site as a collection. @param resourceGroupName Name of the resource group to which the resource belongs. @param name Name of web app. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;ResourceHealthMetadataInner&gt; object
[ "Gets", "the", "category", "of", "ResourceHealthMetadata", "to", "use", "for", "the", "given", "site", "as", "a", "collection", ".", "Gets", "the", "category", "of", "ResourceHealthMetadata", "to", "use", "for", "the", "given", "site", "as", "a", "collection",...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/appservice/v2016_03_01/implementation/ResourceHealthMetadatasInner.java#L406-L418
GenesysPureEngage/provisioning-client-java
src/main/java/com/genesys/provisioning/OperationsApi.java
OperationsApi.getUsersAsync
public void getUsersAsync(Integer limit, Integer offset, String order, String sortBy, String filterName, String filterParameters, String roles, String skills, Boolean userEnabled, String userValid, AsyncCallback callback) throws ProvisioningApiException { String aioId = UUID.randomUUID().toString(); asyncCallbacks.put(aioId, callback); try { ApiAsyncSuccessResponse resp = operationsApi.getUsersAsync( aioId, limit, offset, order, sortBy, filterName, filterParameters, roles, skills, userEnabled, userValid ); if (!resp.getStatus().getCode().equals(1)) { throw new ProvisioningApiException("Error getting users. Code: " + resp.getStatus().getCode()); } } catch(ApiException e) { throw new ProvisioningApiException("Error getting users", e); } }
java
public void getUsersAsync(Integer limit, Integer offset, String order, String sortBy, String filterName, String filterParameters, String roles, String skills, Boolean userEnabled, String userValid, AsyncCallback callback) throws ProvisioningApiException { String aioId = UUID.randomUUID().toString(); asyncCallbacks.put(aioId, callback); try { ApiAsyncSuccessResponse resp = operationsApi.getUsersAsync( aioId, limit, offset, order, sortBy, filterName, filterParameters, roles, skills, userEnabled, userValid ); if (!resp.getStatus().getCode().equals(1)) { throw new ProvisioningApiException("Error getting users. Code: " + resp.getStatus().getCode()); } } catch(ApiException e) { throw new ProvisioningApiException("Error getting users", e); } }
[ "public", "void", "getUsersAsync", "(", "Integer", "limit", ",", "Integer", "offset", ",", "String", "order", ",", "String", "sortBy", ",", "String", "filterName", ",", "String", "filterParameters", ",", "String", "roles", ",", "String", "skills", ",", "Boolea...
Get users. Get [CfgPerson](https://docs.genesys.com/Documentation/PSDK/latest/ConfigLayerRef/CfgPerson) objects based on the specified filters. @param limit Limit the number of users the Provisioning API should return. (optional) @param offset The number of matches the Provisioning API should skip in the returned users. (optional) @param order The sort order. (optional) @param sortBy A comma-separated list of fields to sort on. Possible values are firstName, lastName, and userName. (optional) @param filterName The name of a filter to use on the results. (optional) @param filterParameters A part of the users first or last name, if you use the FirstNameOrLastNameMatches filter. (optional) @param roles Return only return users who have these Workspace Web Edition roles. The roles can be specified in a comma-separated list. Possible values are ROLE_AGENT and ROLE_ADMIN,ROLE_SUPERVISOR. (optional) @param skills Return only users who have these skills. The skills can be specified in a comma-separated list. (optional) @param userEnabled Return only enabled or disabled users. (optional) @param userValid Return only valid or invalid users. (optional) @param callback The callback function called when the skills are returned asynchronously. Callback takes one parameter: Map&lt;String, Object&lt; results. @throws ProvisioningApiException if the call is unsuccessful.
[ "Get", "users", ".", "Get", "[", "CfgPerson", "]", "(", "https", ":", "//", "docs", ".", "genesys", ".", "com", "/", "Documentation", "/", "PSDK", "/", "latest", "/", "ConfigLayerRef", "/", "CfgPerson", ")", "objects", "based", "on", "the", "specified", ...
train
https://github.com/GenesysPureEngage/provisioning-client-java/blob/1ad594c3767cec83052168e350994f922a26f75e/src/main/java/com/genesys/provisioning/OperationsApi.java#L62-L87
infinispan/infinispan
remote-query/remote-query-server/src/main/java/org/infinispan/query/remote/impl/ProtobufMetadataManagerImpl.java
ProtobufMetadataManagerImpl.init
@Inject protected void init(EmbeddedCacheManager cacheManager, InternalCacheRegistry internalCacheRegistry) { this.cacheManager = cacheManager; internalCacheRegistry.registerInternalCache(PROTOBUF_METADATA_CACHE_NAME, getProtobufMetadataCacheConfig().build(), EnumSet.of(Flag.USER, Flag.PROTECTED, Flag.PERSISTENT)); }
java
@Inject protected void init(EmbeddedCacheManager cacheManager, InternalCacheRegistry internalCacheRegistry) { this.cacheManager = cacheManager; internalCacheRegistry.registerInternalCache(PROTOBUF_METADATA_CACHE_NAME, getProtobufMetadataCacheConfig().build(), EnumSet.of(Flag.USER, Flag.PROTECTED, Flag.PERSISTENT)); }
[ "@", "Inject", "protected", "void", "init", "(", "EmbeddedCacheManager", "cacheManager", ",", "InternalCacheRegistry", "internalCacheRegistry", ")", "{", "this", ".", "cacheManager", "=", "cacheManager", ";", "internalCacheRegistry", ".", "registerInternalCache", "(", "...
Defines the configuration of the ___protobuf_metadata internal cache.
[ "Defines", "the", "configuration", "of", "the", "___protobuf_metadata", "internal", "cache", "." ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/remote-query/remote-query-server/src/main/java/org/infinispan/query/remote/impl/ProtobufMetadataManagerImpl.java#L76-L82
jbundle/jbundle
thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/JBasePanel.java
JBasePanel.getTargetScreen
public Container getTargetScreen(Container component, Class<?> targetClass) { Container container = this.getTargetScreen(component, targetClass, true); if (container == null) if (component instanceof JBasePanel) if (component != this) // Special case, need to look from the component up, not from this up. return ((JBasePanel)component).getTargetScreen(component, targetClass, true); return container; }
java
public Container getTargetScreen(Container component, Class<?> targetClass) { Container container = this.getTargetScreen(component, targetClass, true); if (container == null) if (component instanceof JBasePanel) if (component != this) // Special case, need to look from the component up, not from this up. return ((JBasePanel)component).getTargetScreen(component, targetClass, true); return container; }
[ "public", "Container", "getTargetScreen", "(", "Container", "component", ",", "Class", "<", "?", ">", "targetClass", ")", "{", "Container", "container", "=", "this", ".", "getTargetScreen", "(", "component", ",", "targetClass", ",", "true", ")", ";", "if", "...
Climb up through the panel hierarchy until you find a component of this class. @param component The (non-inclusive) component to start climbing up to find this class. @param targetClass The class type to find (or inherited). @return The first parent up the tree to match this class (or null).
[ "Climb", "up", "through", "the", "panel", "hierarchy", "until", "you", "find", "a", "component", "of", "this", "class", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/JBasePanel.java#L348-L356
arakelian/more-commons
src/main/java/com/arakelian/core/utils/XmlStreamReaderUtils.java
XmlStreamReaderUtils.requiredByteAttribute
public static byte requiredByteAttribute(final XMLStreamReader reader, final String localName) throws XMLStreamException { return requiredByteAttribute(reader, null, localName); }
java
public static byte requiredByteAttribute(final XMLStreamReader reader, final String localName) throws XMLStreamException { return requiredByteAttribute(reader, null, localName); }
[ "public", "static", "byte", "requiredByteAttribute", "(", "final", "XMLStreamReader", "reader", ",", "final", "String", "localName", ")", "throws", "XMLStreamException", "{", "return", "requiredByteAttribute", "(", "reader", ",", "null", ",", "localName", ")", ";", ...
Returns the value of an attribute as a byte. If the attribute is empty, this method throws an exception. @param reader <code>XMLStreamReader</code> that contains attribute values. @param localName local name of attribute (the namespace is ignored). @return value of attribute as byte @throws XMLStreamException if attribute is empty.
[ "Returns", "the", "value", "of", "an", "attribute", "as", "a", "byte", ".", "If", "the", "attribute", "is", "empty", "this", "method", "throws", "an", "exception", "." ]
train
https://github.com/arakelian/more-commons/blob/83c607044f64a7f6c005a67866c0ef7cb68d6e29/src/main/java/com/arakelian/core/utils/XmlStreamReaderUtils.java#L1038-L1041
lightblueseas/vintage-time
src/main/java/de/alpharogroup/date/CalculateDateExtensions.java
CalculateDateExtensions.addDays
public static Date addDays(final Date date, final int addDays) { final Calendar dateOnCalendar = Calendar.getInstance(); dateOnCalendar.setTime(date); dateOnCalendar.add(Calendar.DATE, addDays); return dateOnCalendar.getTime(); }
java
public static Date addDays(final Date date, final int addDays) { final Calendar dateOnCalendar = Calendar.getInstance(); dateOnCalendar.setTime(date); dateOnCalendar.add(Calendar.DATE, addDays); return dateOnCalendar.getTime(); }
[ "public", "static", "Date", "addDays", "(", "final", "Date", "date", ",", "final", "int", "addDays", ")", "{", "final", "Calendar", "dateOnCalendar", "=", "Calendar", ".", "getInstance", "(", ")", ";", "dateOnCalendar", ".", "setTime", "(", "date", ")", ";...
Adds days to the given Date object and returns it. Note: you can add negative values too for get date in past. @param date The Date object to add the days. @param addDays The days to add. @return The resulted Date object.
[ "Adds", "days", "to", "the", "given", "Date", "object", "and", "returns", "it", ".", "Note", ":", "you", "can", "add", "negative", "values", "too", "for", "get", "date", "in", "past", "." ]
train
https://github.com/lightblueseas/vintage-time/blob/fbf201e679d9f9b92e7b5771f3eea1413cc2e113/src/main/java/de/alpharogroup/date/CalculateDateExtensions.java#L56-L62
qiujiayu/AutoLoadCache
src/main/java/com/jarvis/cache/script/AbstractScriptParser.java
AbstractScriptParser.isCacheable
public boolean isCacheable(Cache cache, Object target, Object[] arguments, Object result) throws Exception { boolean rv = true; if (null != cache.condition() && cache.condition().length() > 0) { rv = this.getElValue(cache.condition(), target, arguments, result, true, Boolean.class); } return rv; }
java
public boolean isCacheable(Cache cache, Object target, Object[] arguments, Object result) throws Exception { boolean rv = true; if (null != cache.condition() && cache.condition().length() > 0) { rv = this.getElValue(cache.condition(), target, arguments, result, true, Boolean.class); } return rv; }
[ "public", "boolean", "isCacheable", "(", "Cache", "cache", ",", "Object", "target", ",", "Object", "[", "]", "arguments", ",", "Object", "result", ")", "throws", "Exception", "{", "boolean", "rv", "=", "true", ";", "if", "(", "null", "!=", "cache", ".", ...
是否可以缓存 @param cache Cache @param target AOP 拦截到的实例 @param arguments 参数 @param result 执行结果 @return cacheAble 是否可以进行缓存 @throws Exception 异常
[ "是否可以缓存" ]
train
https://github.com/qiujiayu/AutoLoadCache/blob/8121c146f1a420fa6d6832e849acadb547c13622/src/main/java/com/jarvis/cache/script/AbstractScriptParser.java#L109-L115
OpenBEL/openbel-framework
org.openbel.framework.ws/src/main/java/org/openbel/framework/ws/endpoint/PathFindEndPoint.java
PathFindEndPoint.lookupKam
private Kam lookupKam(KamNode kamNode, Dialect dialect, final String errorMsg) throws KamCacheServiceException, InvalidIdException, RequestException { KamStoreObjectRef kamNodeRef = Converter.decodeNode(kamNode); KamInfo kamInfo = null; try { kamInfo = kamCatalogDao.getKamInfoById(kamNodeRef.getKamInfoId()); } catch (SQLException e) { throw new RequestException(errorMsg, e); } if (kamInfo == null) { throw new InvalidIdException(kamNodeRef.getEncodedString()); } final Kam kam = kamCacheService.getKam(kamInfo.getName()); if (kam == null) { throw new InvalidIdException(kamNodeRef.getEncodedString()); } return kam; }
java
private Kam lookupKam(KamNode kamNode, Dialect dialect, final String errorMsg) throws KamCacheServiceException, InvalidIdException, RequestException { KamStoreObjectRef kamNodeRef = Converter.decodeNode(kamNode); KamInfo kamInfo = null; try { kamInfo = kamCatalogDao.getKamInfoById(kamNodeRef.getKamInfoId()); } catch (SQLException e) { throw new RequestException(errorMsg, e); } if (kamInfo == null) { throw new InvalidIdException(kamNodeRef.getEncodedString()); } final Kam kam = kamCacheService.getKam(kamInfo.getName()); if (kam == null) { throw new InvalidIdException(kamNodeRef.getEncodedString()); } return kam; }
[ "private", "Kam", "lookupKam", "(", "KamNode", "kamNode", ",", "Dialect", "dialect", ",", "final", "String", "errorMsg", ")", "throws", "KamCacheServiceException", ",", "InvalidIdException", ",", "RequestException", "{", "KamStoreObjectRef", "kamNodeRef", "=", "Conver...
Lookup the {@link Kam} associated with the {@link KamNode}. @param kamNode {@link KamNode}, the kam node @param dialect {@link Dialect} to apply to the kam, potentially <code>null</code> @return the {@link Kam} associated with the {@link KamNode}, which might be null @throws KamCacheServiceException Thrown if an error occurred while retrieving the {@link Kam} from the cache @throws InvalidIdException Thrown if an error occurred while decoding the {@link KamNode node}'s id
[ "Lookup", "the", "{", "@link", "Kam", "}", "associated", "with", "the", "{", "@link", "KamNode", "}", "." ]
train
https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.ws/src/main/java/org/openbel/framework/ws/endpoint/PathFindEndPoint.java#L284-L303
doanduyhai/Achilles
achilles-common/src/main/java/info/archinnov/achilles/script/ScriptExecutor.java
ScriptExecutor.executeScriptTemplate
public void executeScriptTemplate(String scriptTemplateLocation, Map<String, Object> values) { final List<SimpleStatement> statements = buildStatements(loadScriptAsLines(scriptTemplateLocation, values)); for (SimpleStatement statement : statements) { if (isDMLStatement(statement)) { DML_LOGGER.debug("\tSCRIPT : {}\n", statement.getQueryString()); } else { DDL_LOGGER.debug("\tSCRIPT : {}\n", statement.getQueryString()); } session.execute(statement); } }
java
public void executeScriptTemplate(String scriptTemplateLocation, Map<String, Object> values) { final List<SimpleStatement> statements = buildStatements(loadScriptAsLines(scriptTemplateLocation, values)); for (SimpleStatement statement : statements) { if (isDMLStatement(statement)) { DML_LOGGER.debug("\tSCRIPT : {}\n", statement.getQueryString()); } else { DDL_LOGGER.debug("\tSCRIPT : {}\n", statement.getQueryString()); } session.execute(statement); } }
[ "public", "void", "executeScriptTemplate", "(", "String", "scriptTemplateLocation", ",", "Map", "<", "String", ",", "Object", ">", "values", ")", "{", "final", "List", "<", "SimpleStatement", ">", "statements", "=", "buildStatements", "(", "loadScriptAsLines", "("...
Execute a CQL script template located in the class path and inject provided values into the template to produce the actual script @param scriptTemplateLocation the location of the script template in the class path @param values template values
[ "Execute", "a", "CQL", "script", "template", "located", "in", "the", "class", "path", "and", "inject", "provided", "values", "into", "the", "template", "to", "produce", "the", "actual", "script" ]
train
https://github.com/doanduyhai/Achilles/blob/8281c33100e72c993e570592ae1a5306afac6813/achilles-common/src/main/java/info/archinnov/achilles/script/ScriptExecutor.java#L86-L96
wcm-io/wcm-io-handler
media/src/main/java/io/wcm/handler/mediasource/dam/markup/DamVideoMediaMarkupBuilder.java
DamVideoMediaMarkupBuilder.buildFlashVarsString
protected String buildFlashVarsString(Map<String, String> flashVars) { try { StringBuilder flashvarsString = new StringBuilder(); Iterator<Map.Entry<String, String>> flashvarsIterator = flashVars.entrySet().iterator(); while (flashvarsIterator.hasNext()) { Map.Entry<String, String> entry = flashvarsIterator.next(); flashvarsString.append(URLEncoder.encode(entry.getKey(), CharEncoding.UTF_8)); flashvarsString.append('='); flashvarsString.append(URLEncoder.encode(entry.getValue(), CharEncoding.UTF_8)); if (flashvarsIterator.hasNext()) { flashvarsString.append('&'); } } return flashvarsString.toString(); } catch (UnsupportedEncodingException ex) { throw new RuntimeException("Unsupported encoding.", ex); } }
java
protected String buildFlashVarsString(Map<String, String> flashVars) { try { StringBuilder flashvarsString = new StringBuilder(); Iterator<Map.Entry<String, String>> flashvarsIterator = flashVars.entrySet().iterator(); while (flashvarsIterator.hasNext()) { Map.Entry<String, String> entry = flashvarsIterator.next(); flashvarsString.append(URLEncoder.encode(entry.getKey(), CharEncoding.UTF_8)); flashvarsString.append('='); flashvarsString.append(URLEncoder.encode(entry.getValue(), CharEncoding.UTF_8)); if (flashvarsIterator.hasNext()) { flashvarsString.append('&'); } } return flashvarsString.toString(); } catch (UnsupportedEncodingException ex) { throw new RuntimeException("Unsupported encoding.", ex); } }
[ "protected", "String", "buildFlashVarsString", "(", "Map", "<", "String", ",", "String", ">", "flashVars", ")", "{", "try", "{", "StringBuilder", "flashvarsString", "=", "new", "StringBuilder", "(", ")", ";", "Iterator", "<", "Map", ".", "Entry", "<", "Strin...
Build flashvars string to be used on HTML object element for flash embedding. @param flashVars flashvars map @return flashvars string with proper encoding
[ "Build", "flashvars", "string", "to", "be", "used", "on", "HTML", "object", "element", "for", "flash", "embedding", "." ]
train
https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/media/src/main/java/io/wcm/handler/mediasource/dam/markup/DamVideoMediaMarkupBuilder.java#L233-L251
javalite/activejdbc
app-config/src/main/java/org/javalite/app_config/AppConfig.java
AppConfig.setProperty
public static String setProperty(String name, String value) { String val = null; if(props.containsKey(name)){ val = props.get(name).getValue(); } props.put(name, new Property(name, value, "dynamically added")); LOGGER.warn("Temporary overriding property: " + name + ". Old value: " + val + ". New value: " + value); return val; }
java
public static String setProperty(String name, String value) { String val = null; if(props.containsKey(name)){ val = props.get(name).getValue(); } props.put(name, new Property(name, value, "dynamically added")); LOGGER.warn("Temporary overriding property: " + name + ". Old value: " + val + ". New value: " + value); return val; }
[ "public", "static", "String", "setProperty", "(", "String", "name", ",", "String", "value", ")", "{", "String", "val", "=", "null", ";", "if", "(", "props", ".", "containsKey", "(", "name", ")", ")", "{", "val", "=", "props", ".", "get", "(", "name",...
Sets a property in memory. If property exists, it will be overwritten, if not, a new one will be created. @param name - name of property @param value - value of property @return old value
[ "Sets", "a", "property", "in", "memory", ".", "If", "property", "exists", "it", "will", "be", "overwritten", "if", "not", "a", "new", "one", "will", "be", "created", "." ]
train
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/app-config/src/main/java/org/javalite/app_config/AppConfig.java#L231-L239
UrielCh/ovh-java-sdk
ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java
ApiOvhDedicatedserver.serviceName_support_replace_hardDiskDrive_POST
public OvhNewMessageInfo serviceName_support_replace_hardDiskDrive_POST(String serviceName, String comment, OvhSupportReplaceHddInfo[] disks, Boolean inverse) throws IOException { String qPath = "/dedicated/server/{serviceName}/support/replace/hardDiskDrive"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "comment", comment); addBody(o, "disks", disks); addBody(o, "inverse", inverse); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhNewMessageInfo.class); }
java
public OvhNewMessageInfo serviceName_support_replace_hardDiskDrive_POST(String serviceName, String comment, OvhSupportReplaceHddInfo[] disks, Boolean inverse) throws IOException { String qPath = "/dedicated/server/{serviceName}/support/replace/hardDiskDrive"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "comment", comment); addBody(o, "disks", disks); addBody(o, "inverse", inverse); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhNewMessageInfo.class); }
[ "public", "OvhNewMessageInfo", "serviceName_support_replace_hardDiskDrive_POST", "(", "String", "serviceName", ",", "String", "comment", ",", "OvhSupportReplaceHddInfo", "[", "]", "disks", ",", "Boolean", "inverse", ")", "throws", "IOException", "{", "String", "qPath", ...
Ask for a broken HDD replacement REST: POST /dedicated/server/{serviceName}/support/replace/hardDiskDrive @param inverse [required] If set to 'true', replace only NON LISTED DISKS @param disks [required] If 'inverse' is set as 'false', the list of HDD TO REPLACE. If 'inverse' is set as 'true', the list of HDD TO NOT REPLACE. @param comment [required] User comment @param serviceName [required] The internal name of your dedicated server API beta
[ "Ask", "for", "a", "broken", "HDD", "replacement" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java#L2023-L2032
opendatatrentino/s-match
src/main/java/it/unitn/disi/smatch/filters/RedundantMappingFilter.java
RedundantMappingFilter.isRedundant
private boolean isRedundant(IContextMapping<INode> mapping, IMappingElement<INode> e) { switch (e.getRelation()) { case IMappingElement.LESS_GENERAL: { if (verifyCondition1(mapping, e)) { return true; } break; } case IMappingElement.MORE_GENERAL: { if (verifyCondition2(mapping, e)) { return true; } break; } case IMappingElement.DISJOINT: { if (verifyCondition3(mapping, e)) { return true; } break; } case IMappingElement.EQUIVALENCE: { if (verifyCondition4(mapping, e)) { return true; } break; } default: { return false; } }// end switch return false; }
java
private boolean isRedundant(IContextMapping<INode> mapping, IMappingElement<INode> e) { switch (e.getRelation()) { case IMappingElement.LESS_GENERAL: { if (verifyCondition1(mapping, e)) { return true; } break; } case IMappingElement.MORE_GENERAL: { if (verifyCondition2(mapping, e)) { return true; } break; } case IMappingElement.DISJOINT: { if (verifyCondition3(mapping, e)) { return true; } break; } case IMappingElement.EQUIVALENCE: { if (verifyCondition4(mapping, e)) { return true; } break; } default: { return false; } }// end switch return false; }
[ "private", "boolean", "isRedundant", "(", "IContextMapping", "<", "INode", ">", "mapping", ",", "IMappingElement", "<", "INode", ">", "e", ")", "{", "switch", "(", "e", ".", "getRelation", "(", ")", ")", "{", "case", "IMappingElement", ".", "LESS_GENERAL", ...
Checks the relation between source and target is redundant or not for minimal mapping. @param mapping a mapping @param e a mapping element @return true for redundant relation
[ "Checks", "the", "relation", "between", "source", "and", "target", "is", "redundant", "or", "not", "for", "minimal", "mapping", "." ]
train
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/filters/RedundantMappingFilter.java#L65-L98
threerings/nenya
tools/src/main/java/com/threerings/media/tile/bundle/tools/TileSetBundler.java
TileSetBundler.createBundle
public boolean createBundle ( File target, TileSetBundle bundle, ImageProvider improv, String imageBase, long newestMod) throws IOException { return createBundleJar(target, bundle, improv, imageBase, _keepRawPngs, _uncompressed); }
java
public boolean createBundle ( File target, TileSetBundle bundle, ImageProvider improv, String imageBase, long newestMod) throws IOException { return createBundleJar(target, bundle, improv, imageBase, _keepRawPngs, _uncompressed); }
[ "public", "boolean", "createBundle", "(", "File", "target", ",", "TileSetBundle", "bundle", ",", "ImageProvider", "improv", ",", "String", "imageBase", ",", "long", "newestMod", ")", "throws", "IOException", "{", "return", "createBundleJar", "(", "target", ",", ...
Finish the creation of a tileset bundle jar file. @param target the tileset bundle file that will be created. @param bundle contains the tilesets we'd like to save out to the bundle. @param improv the image provider. @param imageBase the base directory for getting images for non @param newestMod the most recent modification to any part of the bundle. By default we ignore this since we normally duck out if we're up to date. ObjectTileSet tilesets.
[ "Finish", "the", "creation", "of", "a", "tileset", "bundle", "jar", "file", "." ]
train
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/tools/src/main/java/com/threerings/media/tile/bundle/tools/TileSetBundler.java#L349-L354
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/proxyqueue/queue/AsynchConsumerQueue.java
AsynchConsumerQueue.appendToLastMessage
public void appendToLastMessage(CommsByteBuffer msgBuffer, boolean lastChunk) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "appendToLastMessage", new Object[]{msgBuffer, lastChunk}); synchronized (this) { // Get the last queue data from the queue QueueData queueData = queue.getLast(); queueData.addSlice(msgBuffer, lastChunk); // If this is the last chunk, update the counters to indicate a complete message has now // been received if (lastChunk) { notifyMessageReceived(queueData.isLastInBatch()); } } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Append has completed: " + this); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "appendToLastMessage"); }
java
public void appendToLastMessage(CommsByteBuffer msgBuffer, boolean lastChunk) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "appendToLastMessage", new Object[]{msgBuffer, lastChunk}); synchronized (this) { // Get the last queue data from the queue QueueData queueData = queue.getLast(); queueData.addSlice(msgBuffer, lastChunk); // If this is the last chunk, update the counters to indicate a complete message has now // been received if (lastChunk) { notifyMessageReceived(queueData.isLastInBatch()); } } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Append has completed: " + this); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "appendToLastMessage"); }
[ "public", "void", "appendToLastMessage", "(", "CommsByteBuffer", "msgBuffer", ",", "boolean", "lastChunk", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "("...
This method is called when a middle or final chunk of a message has been received by the proxy queue. In this case we should append the chunk to those already collected and if this is the last chunk we perform the processing that would normally be done when a full message is received. @see com.ibm.ws.sib.comms.client.proxyqueue.queue.Queue#appendToLastMessage(com.ibm.ws.sib.comms.common.CommsByteBuffer, boolean)
[ "This", "method", "is", "called", "when", "a", "middle", "or", "final", "chunk", "of", "a", "message", "has", "been", "received", "by", "the", "proxy", "queue", ".", "In", "this", "case", "we", "should", "append", "the", "chunk", "to", "those", "already"...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/proxyqueue/queue/AsynchConsumerQueue.java#L139-L161
cdk/cdk
base/isomorphism/src/main/java/org/openscience/cdk/isomorphism/matchers/RGroupQuery.java
RGroupQuery.getAtomPosition
private int getAtomPosition(IAtom atom, IAtomContainer container) { for (int i = 0; i < container.getAtomCount(); i++) { if (atom.equals(container.getAtom(i))) { return i; } } return -1; }
java
private int getAtomPosition(IAtom atom, IAtomContainer container) { for (int i = 0; i < container.getAtomCount(); i++) { if (atom.equals(container.getAtom(i))) { return i; } } return -1; }
[ "private", "int", "getAtomPosition", "(", "IAtom", "atom", ",", "IAtomContainer", "container", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "container", ".", "getAtomCount", "(", ")", ";", "i", "++", ")", "{", "if", "(", "atom", ".", ...
Helper method, used to help construct a configuration. @param atom @param container @return the array position of atom in container
[ "Helper", "method", "used", "to", "help", "construct", "a", "configuration", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/isomorphism/src/main/java/org/openscience/cdk/isomorphism/matchers/RGroupQuery.java#L494-L501
windup/windup
rules-java/api/src/main/java/org/jboss/windup/rules/apps/mavenize/PackagesToContainingMavenArtifactsIndex.java
PackagesToContainingMavenArtifactsIndex.markProjectsUsingPackagesFromAPI
public void markProjectsUsingPackagesFromAPI(MavenCoord apiCoords) { final Service<ArchiveCoordinateModel> coordsService = graphContext.service(ArchiveCoordinateModel.class); Iterable<String> packages = this.getPackagesInArtifact(apiCoords); for (String pkg : packages) { Iterable<ProjectModel> projects = this.getProjectsContainingClassesReferencingPackage(pkg); for (ProjectModel project : projects) { ArchiveCoordinateModel apiArchiveRepresentant = new ArchiveCoordinateService(graphContext, ArchiveCoordinateModel.class) .getSingleOrCreate(apiCoords.getGroupId(), apiCoords.getArtifactId(), null); // We specifically want null. project.getElement().addEdge(EDGE_USES, apiArchiveRepresentant.getElement()); } } }
java
public void markProjectsUsingPackagesFromAPI(MavenCoord apiCoords) { final Service<ArchiveCoordinateModel> coordsService = graphContext.service(ArchiveCoordinateModel.class); Iterable<String> packages = this.getPackagesInArtifact(apiCoords); for (String pkg : packages) { Iterable<ProjectModel> projects = this.getProjectsContainingClassesReferencingPackage(pkg); for (ProjectModel project : projects) { ArchiveCoordinateModel apiArchiveRepresentant = new ArchiveCoordinateService(graphContext, ArchiveCoordinateModel.class) .getSingleOrCreate(apiCoords.getGroupId(), apiCoords.getArtifactId(), null); // We specifically want null. project.getElement().addEdge(EDGE_USES, apiArchiveRepresentant.getElement()); } } }
[ "public", "void", "markProjectsUsingPackagesFromAPI", "(", "MavenCoord", "apiCoords", ")", "{", "final", "Service", "<", "ArchiveCoordinateModel", ">", "coordsService", "=", "graphContext", ".", "service", "(", "ArchiveCoordinateModel", ".", "class", ")", ";", "Iterab...
After the packages are registered and Java scanning done, we can link the ProjectModel and API packages together. ProjectModel --uses--> ArchiveCoordinateModel
[ "After", "the", "packages", "are", "registered", "and", "Java", "scanning", "done", "we", "can", "link", "the", "ProjectModel", "and", "API", "packages", "together", ".", "ProjectModel", "--", "uses", "--", ">", "ArchiveCoordinateModel" ]
train
https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/rules-java/api/src/main/java/org/jboss/windup/rules/apps/mavenize/PackagesToContainingMavenArtifactsIndex.java#L70-L85
casmi/casmi
src/main/java/casmi/graphics/material/Material.java
Material.setAmbient
public void setAmbient(float red, float green, float blue){ ambient[0]=red; ambient[1]=green; ambient[2]=blue; Am = true; }
java
public void setAmbient(float red, float green, float blue){ ambient[0]=red; ambient[1]=green; ambient[2]=blue; Am = true; }
[ "public", "void", "setAmbient", "(", "float", "red", ",", "float", "green", ",", "float", "blue", ")", "{", "ambient", "[", "0", "]", "=", "red", ";", "ambient", "[", "1", "]", "=", "green", ";", "ambient", "[", "2", "]", "=", "blue", ";", "Am", ...
Sets the ambient reflectance for shapes drawn to the screen. @param red The red color of the ambient reflectance. @param green The green color of the ambient reflectance. @param blue The blue color of the ambient reflectance.
[ "Sets", "the", "ambient", "reflectance", "for", "shapes", "drawn", "to", "the", "screen", "." ]
train
https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/graphics/material/Material.java#L84-L89
gsi-upm/Shanks
shanks-core/src/main/java/es/upm/dit/gsi/shanks/model/scenario/portrayal/ScenarioPortrayal.java
ScenarioPortrayal.setHistogramRange
public void setHistogramRange(String histogramID, int lower, int upper) { if (this.histograms.containsKey(histogramID)) this.histograms.get(histogramID).setYAxisRange(lower, upper); }
java
public void setHistogramRange(String histogramID, int lower, int upper) { if (this.histograms.containsKey(histogramID)) this.histograms.get(histogramID).setYAxisRange(lower, upper); }
[ "public", "void", "setHistogramRange", "(", "String", "histogramID", ",", "int", "lower", ",", "int", "upper", ")", "{", "if", "(", "this", ".", "histograms", ".", "containsKey", "(", "histogramID", ")", ")", "this", ".", "histograms", ".", "get", "(", "...
Set the histogram range to be displayed @param histogramID The histogram ID @param lower The lower value for the histogram @param upper The upper value for the histogram
[ "Set", "the", "histogram", "range", "to", "be", "displayed" ]
train
https://github.com/gsi-upm/Shanks/blob/35d87a81c22731f4f83bbd0571c9c6d466bd16be/shanks-core/src/main/java/es/upm/dit/gsi/shanks/model/scenario/portrayal/ScenarioPortrayal.java#L428-L431
box/box-java-sdk
src/main/java/com/box/sdk/BoxFolder.java
BoxFolder.addMetadataCascadePolicy
public BoxMetadataCascadePolicy.Info addMetadataCascadePolicy(String scope, String templateKey) { return BoxMetadataCascadePolicy.create(this.getAPI(), this.getID(), scope, templateKey); }
java
public BoxMetadataCascadePolicy.Info addMetadataCascadePolicy(String scope, String templateKey) { return BoxMetadataCascadePolicy.create(this.getAPI(), this.getID(), scope, templateKey); }
[ "public", "BoxMetadataCascadePolicy", ".", "Info", "addMetadataCascadePolicy", "(", "String", "scope", ",", "String", "templateKey", ")", "{", "return", "BoxMetadataCascadePolicy", ".", "create", "(", "this", ".", "getAPI", "(", ")", ",", "this", ".", "getID", "...
Creates a new Metadata Cascade Policy on a folder. @param scope the scope of the metadata cascade policy. @param templateKey the key of the template. @return information about the Metadata Cascade Policy.
[ "Creates", "a", "new", "Metadata", "Cascade", "Policy", "on", "a", "folder", "." ]
train
https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/BoxFolder.java#L1120-L1123
wuman/orientdb-android
core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/string/OStringSerializerEmbedded.java
OStringSerializerEmbedded.toStream
public StringBuilder toStream(final StringBuilder iOutput, Object iValue) { if (iValue != null) { if (!(iValue instanceof OSerializableStream)) throw new OSerializationException("Cannot serialize the object since it's not implements the OSerializableStream interface"); OSerializableStream stream = (OSerializableStream) iValue; iOutput.append(iValue.getClass().getName()); iOutput.append(OStreamSerializerHelper.SEPARATOR); iOutput.append(OBinaryProtocol.bytes2string(stream.toStream())); } return iOutput; }
java
public StringBuilder toStream(final StringBuilder iOutput, Object iValue) { if (iValue != null) { if (!(iValue instanceof OSerializableStream)) throw new OSerializationException("Cannot serialize the object since it's not implements the OSerializableStream interface"); OSerializableStream stream = (OSerializableStream) iValue; iOutput.append(iValue.getClass().getName()); iOutput.append(OStreamSerializerHelper.SEPARATOR); iOutput.append(OBinaryProtocol.bytes2string(stream.toStream())); } return iOutput; }
[ "public", "StringBuilder", "toStream", "(", "final", "StringBuilder", "iOutput", ",", "Object", "iValue", ")", "{", "if", "(", "iValue", "!=", "null", ")", "{", "if", "(", "!", "(", "iValue", "instanceof", "OSerializableStream", ")", ")", "throw", "new", "...
Serialize the class name size + class name + object content @param iValue
[ "Serialize", "the", "class", "name", "size", "+", "class", "name", "+", "object", "content" ]
train
https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/string/OStringSerializerEmbedded.java#L46-L57
duracloud/duracloud
s3storageprovider/src/main/java/org/duracloud/s3storage/S3StorageProvider.java
S3StorageProvider.getSpaceCount
protected String getSpaceCount(String spaceId, int maxCount) { List<String> spaceContentChunk = null; long count = 0; do { String marker = null; if (spaceContentChunk != null && spaceContentChunk.size() > 0) { marker = spaceContentChunk.get(spaceContentChunk.size() - 1); } spaceContentChunk = getSpaceContentsChunked(spaceId, null, MAX_ITEM_COUNT, marker); count += spaceContentChunk.size(); } while (spaceContentChunk.size() > 0 && count < maxCount); String suffix = ""; if (count >= maxCount) { suffix = "+"; } return String.valueOf(count) + suffix; }
java
protected String getSpaceCount(String spaceId, int maxCount) { List<String> spaceContentChunk = null; long count = 0; do { String marker = null; if (spaceContentChunk != null && spaceContentChunk.size() > 0) { marker = spaceContentChunk.get(spaceContentChunk.size() - 1); } spaceContentChunk = getSpaceContentsChunked(spaceId, null, MAX_ITEM_COUNT, marker); count += spaceContentChunk.size(); } while (spaceContentChunk.size() > 0 && count < maxCount); String suffix = ""; if (count >= maxCount) { suffix = "+"; } return String.valueOf(count) + suffix; }
[ "protected", "String", "getSpaceCount", "(", "String", "spaceId", ",", "int", "maxCount", ")", "{", "List", "<", "String", ">", "spaceContentChunk", "=", "null", ";", "long", "count", "=", "0", ";", "do", "{", "String", "marker", "=", "null", ";", "if", ...
/* Counts the number of items in a space up to the maxCount. If maxCount is reached or exceeded, the returned string will indicate this with a trailing '+' character (e.g. 1000+). Note that anecdotal evidence shows that this method of counting (using size of chunked calls) is faster in most cases than enumerating the Iteration: StorageProviderUtil.count(getSpaceContents(spaceId, null))
[ "/", "*", "Counts", "the", "number", "of", "items", "in", "a", "space", "up", "to", "the", "maxCount", ".", "If", "maxCount", "is", "reached", "or", "exceeded", "the", "returned", "string", "will", "indicate", "this", "with", "a", "trailing", "+", "chara...
train
https://github.com/duracloud/duracloud/blob/dc4f3a1716d43543cc3b2e1880605f9389849b66/s3storageprovider/src/main/java/org/duracloud/s3storage/S3StorageProvider.java#L409-L430
alkacon/opencms-core
src/org/opencms/ui/apps/sessions/CmsSessionsTable.java
CmsSessionsTable.onItemClick
void onItemClick(MouseEvents.ClickEvent event, Object itemId, Object propertyId) { if (!event.isCtrlKey() && !event.isShiftKey()) { changeValueIfNotMultiSelect(itemId); // don't interfere with multi-selection using control key if (event.getButton().equals(MouseButton.RIGHT) || (TableProperty.Icon.equals(propertyId))) { m_menu.setEntries(getMenuEntries(), (Set<String>)getValue()); m_menu.openForTable(event, itemId, propertyId, this); } else if (event.getButton().equals(MouseButton.LEFT) && TableProperty.UserName.equals(propertyId)) { showUserInfoWindow(((Set<String>)getValue()).iterator().next()); } } }
java
void onItemClick(MouseEvents.ClickEvent event, Object itemId, Object propertyId) { if (!event.isCtrlKey() && !event.isShiftKey()) { changeValueIfNotMultiSelect(itemId); // don't interfere with multi-selection using control key if (event.getButton().equals(MouseButton.RIGHT) || (TableProperty.Icon.equals(propertyId))) { m_menu.setEntries(getMenuEntries(), (Set<String>)getValue()); m_menu.openForTable(event, itemId, propertyId, this); } else if (event.getButton().equals(MouseButton.LEFT) && TableProperty.UserName.equals(propertyId)) { showUserInfoWindow(((Set<String>)getValue()).iterator().next()); } } }
[ "void", "onItemClick", "(", "MouseEvents", ".", "ClickEvent", "event", ",", "Object", "itemId", ",", "Object", "propertyId", ")", "{", "if", "(", "!", "event", ".", "isCtrlKey", "(", ")", "&&", "!", "event", ".", "isShiftKey", "(", ")", ")", "{", "chan...
Handles the table item clicks, including clicks on images inside of a table item.<p> @param event the click event @param itemId of the clicked row @param propertyId column id
[ "Handles", "the", "table", "item", "clicks", "including", "clicks", "on", "images", "inside", "of", "a", "table", "item", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/sessions/CmsSessionsTable.java#L613-L628
Azure/azure-sdk-for-java
sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedBackupShortTermRetentionPoliciesInner.java
ManagedBackupShortTermRetentionPoliciesInner.beginUpdate
public ManagedBackupShortTermRetentionPolicyInner beginUpdate(String resourceGroupName, String managedInstanceName, String databaseName, Integer retentionDays) { return beginUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, retentionDays).toBlocking().single().body(); }
java
public ManagedBackupShortTermRetentionPolicyInner beginUpdate(String resourceGroupName, String managedInstanceName, String databaseName, Integer retentionDays) { return beginUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, retentionDays).toBlocking().single().body(); }
[ "public", "ManagedBackupShortTermRetentionPolicyInner", "beginUpdate", "(", "String", "resourceGroupName", ",", "String", "managedInstanceName", ",", "String", "databaseName", ",", "Integer", "retentionDays", ")", "{", "return", "beginUpdateWithServiceResponseAsync", "(", "re...
Updates a managed database's short term retention policy. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param managedInstanceName The name of the managed instance. @param databaseName The name of the database. @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. @throws IllegalArgumentException thrown if parameters fail the validation @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 ManagedBackupShortTermRetentionPolicyInner object if successful.
[ "Updates", "a", "managed", "database", "s", "short", "term", "retention", "policy", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedBackupShortTermRetentionPoliciesInner.java#L804-L806
beangle/beangle3
commons/core/src/main/java/org/beangle/commons/lang/Range.java
Range.intersectionWith
public Range<T> intersectionWith(Range<T> other) { if (!this.isOverlappedBy(other)) { throw new IllegalArgumentException(String.format( "Cannot calculate intersection with non-overlapping range %s", other)); } if (this.equals(other)) { return this; } T min = this.comparator.compare(this.min, other.min) < 0 ? other.min : this.min; T max = this.comparator.compare(this.max, other.max) < 0 ? this.max : other.max; return between(min, max, this.comparator); }
java
public Range<T> intersectionWith(Range<T> other) { if (!this.isOverlappedBy(other)) { throw new IllegalArgumentException(String.format( "Cannot calculate intersection with non-overlapping range %s", other)); } if (this.equals(other)) { return this; } T min = this.comparator.compare(this.min, other.min) < 0 ? other.min : this.min; T max = this.comparator.compare(this.max, other.max) < 0 ? this.max : other.max; return between(min, max, this.comparator); }
[ "public", "Range", "<", "T", ">", "intersectionWith", "(", "Range", "<", "T", ">", "other", ")", "{", "if", "(", "!", "this", ".", "isOverlappedBy", "(", "other", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "String", ".", "format", ...
Calculate the intersection of {@code this} and an overlapping Range.
[ "Calculate", "the", "intersection", "of", "{" ]
train
https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/commons/core/src/main/java/org/beangle/commons/lang/Range.java#L265-L272
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/ISPNCacheWorkspaceStorageCache.java
ISPNCacheWorkspaceStorageCache.updateInBuffer
protected Set<String> updateInBuffer(final NodeData node, final QPath prevPath, Set<String> idsToSkip) { // I expect that NullNodeData will never update existing NodeData. CacheQPath prevKey = new CacheQPath(getOwnerId(), node.getParentIdentifier(), prevPath, ItemType.NODE); if (node.getIdentifier().equals(cache.getFromBuffer(prevKey))) { cache.remove(prevKey); } // update childs paths if index changed int nodeIndex = node.getQPath().getEntries()[node.getQPath().getEntries().length - 1].getIndex(); int prevNodeIndex = prevPath.getEntries()[prevPath.getEntries().length - 1].getIndex(); if (nodeIndex != prevNodeIndex) { // its a same name reordering return updateTreePath(prevPath, node.getQPath(), idsToSkip); } return null; }
java
protected Set<String> updateInBuffer(final NodeData node, final QPath prevPath, Set<String> idsToSkip) { // I expect that NullNodeData will never update existing NodeData. CacheQPath prevKey = new CacheQPath(getOwnerId(), node.getParentIdentifier(), prevPath, ItemType.NODE); if (node.getIdentifier().equals(cache.getFromBuffer(prevKey))) { cache.remove(prevKey); } // update childs paths if index changed int nodeIndex = node.getQPath().getEntries()[node.getQPath().getEntries().length - 1].getIndex(); int prevNodeIndex = prevPath.getEntries()[prevPath.getEntries().length - 1].getIndex(); if (nodeIndex != prevNodeIndex) { // its a same name reordering return updateTreePath(prevPath, node.getQPath(), idsToSkip); } return null; }
[ "protected", "Set", "<", "String", ">", "updateInBuffer", "(", "final", "NodeData", "node", ",", "final", "QPath", "prevPath", ",", "Set", "<", "String", ">", "idsToSkip", ")", "{", "// I expect that NullNodeData will never update existing NodeData.\r", "CacheQPath", ...
Update Node hierarchy in case of same-name siblings reorder. Assumes the new (updated) nodes already put in the cache. Previous name of updated nodes will be calculated and that node will be deleted (if has same id as the new node). Children paths will be updated to a new node path. @param node new node data @param prevPath old path @param idsToSkip set of ids to skip, this is needed to avoid modifying the path twice in case of an OrderBefore @return the ids to skip for the next operation
[ "Update", "Node", "hierarchy", "in", "case", "of", "same", "-", "name", "siblings", "reorder", ".", "Assumes", "the", "new", "(", "updated", ")", "nodes", "already", "put", "in", "the", "cache", ".", "Previous", "name", "of", "updated", "nodes", "will", ...
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/ISPNCacheWorkspaceStorageCache.java#L1565-L1583
alkacon/opencms-core
src/org/opencms/cache/CmsVfsDiskCache.java
CmsVfsDiskCache.saveCacheFile
public void saveCacheFile(String rfsName, byte[] content, long dateLastModified) throws IOException { dateLastModified = simplifyDateLastModified(dateLastModified); File f = saveFile(rfsName, content); // set last modification date f.setLastModified(dateLastModified); }
java
public void saveCacheFile(String rfsName, byte[] content, long dateLastModified) throws IOException { dateLastModified = simplifyDateLastModified(dateLastModified); File f = saveFile(rfsName, content); // set last modification date f.setLastModified(dateLastModified); }
[ "public", "void", "saveCacheFile", "(", "String", "rfsName", ",", "byte", "[", "]", "content", ",", "long", "dateLastModified", ")", "throws", "IOException", "{", "dateLastModified", "=", "simplifyDateLastModified", "(", "dateLastModified", ")", ";", "File", "f", ...
Saves the given file content in the disk cache.<p> @param rfsName the RFS name of the file to save the content in @param content the content of the file to save @param dateLastModified the date of last modification to set for the save file @throws IOException in case of disk access errors
[ "Saves", "the", "given", "file", "content", "in", "the", "disk", "cache", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/cache/CmsVfsDiskCache.java#L155-L161
xvik/dropwizard-guicey
src/main/java/ru/vyarus/dropwizard/guice/module/context/ConfigurationInfo.java
ConfigurationInfo.getItems
@SuppressWarnings("unchecked") public List<Class<Object>> getItems(final Predicate<ItemInfo> filter) { final List<Class<Object>> items = (List) Lists.newArrayList(itemsHolder.values()); return filter(items, filter); }
java
@SuppressWarnings("unchecked") public List<Class<Object>> getItems(final Predicate<ItemInfo> filter) { final List<Class<Object>> items = (List) Lists.newArrayList(itemsHolder.values()); return filter(items, filter); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "List", "<", "Class", "<", "Object", ">", ">", "getItems", "(", "final", "Predicate", "<", "ItemInfo", ">", "filter", ")", "{", "final", "List", "<", "Class", "<", "Object", ">", ">", "items",...
Used to query items of all configuration types. May be useful to build configuration tree (e.g. to search all items configured by bundle or by classpath scan). Some common filters are predefined in {@link Filters}. Use {@link Predicate#and(Predicate)}, {@link Predicate#or(Predicate)} and {@link Predicate#negate()} to reuse default filters. <p> Pay attention that disabled (or disabled and never registered) items are also returned. @param filter predicate to filter definitions @return registered item classes in registration order, filtered with provided filter or empty list
[ "Used", "to", "query", "items", "of", "all", "configuration", "types", ".", "May", "be", "useful", "to", "build", "configuration", "tree", "(", "e", ".", "g", ".", "to", "search", "all", "items", "configured", "by", "bundle", "or", "by", "classpath", "sc...
train
https://github.com/xvik/dropwizard-guicey/blob/dd39ad77283555be21f606d5ebf0f11207a733d4/src/main/java/ru/vyarus/dropwizard/guice/module/context/ConfigurationInfo.java#L93-L97
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/PluralRules.java
PluralRules.getFunctionalEquivalent
public static ULocale getFunctionalEquivalent(ULocale locale, boolean[] isAvailable) { return Factory.getDefaultFactory().getFunctionalEquivalent(locale, isAvailable); }
java
public static ULocale getFunctionalEquivalent(ULocale locale, boolean[] isAvailable) { return Factory.getDefaultFactory().getFunctionalEquivalent(locale, isAvailable); }
[ "public", "static", "ULocale", "getFunctionalEquivalent", "(", "ULocale", "locale", ",", "boolean", "[", "]", "isAvailable", ")", "{", "return", "Factory", ".", "getDefaultFactory", "(", ")", ".", "getFunctionalEquivalent", "(", "locale", ",", "isAvailable", ")", ...
Returns the 'functionally equivalent' locale with respect to plural rules. Calling PluralRules.forLocale with the functionally equivalent locale, and with the provided locale, returns rules that behave the same. <br> All locales with the same functionally equivalent locale have plural rules that behave the same. This is not exaustive; there may be other locales whose plural rules behave the same that do not have the same equivalent locale. @param locale the locale to check @param isAvailable if not null and of length &gt; 0, this will hold 'true' at index 0 if locale is directly defined (without fallback) as having plural rules @return the functionally-equivalent locale @hide draft / provisional / internal are hidden on Android
[ "Returns", "the", "functionally", "equivalent", "locale", "with", "respect", "to", "plural", "rules", ".", "Calling", "PluralRules", ".", "forLocale", "with", "the", "functionally", "equivalent", "locale", "and", "with", "the", "provided", "locale", "returns", "ru...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/PluralRules.java#L2219-L2221
hyperledger/fabric-sdk-java
src/main/java/org/hyperledger/fabric/sdk/Channel.java
Channel.queryBlockByHash
public BlockInfo queryBlockByHash(Peer peer, byte[] blockHash) throws InvalidArgumentException, ProposalException { return queryBlockByHash(Collections.singleton(peer), blockHash); }
java
public BlockInfo queryBlockByHash(Peer peer, byte[] blockHash) throws InvalidArgumentException, ProposalException { return queryBlockByHash(Collections.singleton(peer), blockHash); }
[ "public", "BlockInfo", "queryBlockByHash", "(", "Peer", "peer", ",", "byte", "[", "]", "blockHash", ")", "throws", "InvalidArgumentException", ",", "ProposalException", "{", "return", "queryBlockByHash", "(", "Collections", ".", "singleton", "(", "peer", ")", ",",...
Query a peer in this channel for a Block by the block hash. <STRONG>This method may not be thread safe if client context is changed!</STRONG> @param peer the Peer to query. @param blockHash the hash of the Block in the chain. @return the {@link BlockInfo} with the given block Hash @throws InvalidArgumentException if the channel is shutdown or any of the arguments are not valid. @throws ProposalException if an error occurred processing the query.
[ "Query", "a", "peer", "in", "this", "channel", "for", "a", "Block", "by", "the", "block", "hash", "." ]
train
https://github.com/hyperledger/fabric-sdk-java/blob/4a2d7b3408b8b0a1ed812aa36942c438159c37a0/src/main/java/org/hyperledger/fabric/sdk/Channel.java#L2683-L2685
gsi-upm/Shanks
shanks-core/src/main/java/es/upm/dit/gsi/shanks/model/scenario/portrayal/ScenarioPortrayal.java
ScenarioPortrayal.addHistogram
public void addHistogram(String histogramID, String xAxisLabel, String yAxisLabel) throws ShanksException { if (!this.histograms.containsKey(histogramID)) { HistogramGenerator histogram = new HistogramGenerator(); histogram.setTitle(histogramID); histogram.setXAxisLabel(xAxisLabel); histogram.setYAxisLabel(yAxisLabel); this.histograms.put(histogramID, histogram); } else { throw new DuplicatedChartIDException(histogramID); } }
java
public void addHistogram(String histogramID, String xAxisLabel, String yAxisLabel) throws ShanksException { if (!this.histograms.containsKey(histogramID)) { HistogramGenerator histogram = new HistogramGenerator(); histogram.setTitle(histogramID); histogram.setXAxisLabel(xAxisLabel); histogram.setYAxisLabel(yAxisLabel); this.histograms.put(histogramID, histogram); } else { throw new DuplicatedChartIDException(histogramID); } }
[ "public", "void", "addHistogram", "(", "String", "histogramID", ",", "String", "xAxisLabel", ",", "String", "yAxisLabel", ")", "throws", "ShanksException", "{", "if", "(", "!", "this", ".", "histograms", ".", "containsKey", "(", "histogramID", ")", ")", "{", ...
Add a histogram to the simulation @param histogramID @param xAxisLabel @param yAxisLabel @throws ShanksException
[ "Add", "a", "histogram", "to", "the", "simulation" ]
train
https://github.com/gsi-upm/Shanks/blob/35d87a81c22731f4f83bbd0571c9c6d466bd16be/shanks-core/src/main/java/es/upm/dit/gsi/shanks/model/scenario/portrayal/ScenarioPortrayal.java#L345-L355
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/gen/CodeBuilderUtil.java
CodeBuilderUtil.convertValue
public static void convertValue(CodeBuilder b, Class from, Class to) { if (from == to) { return; } TypeDesc fromType = TypeDesc.forClass(from); TypeDesc toType = TypeDesc.forClass(to); // Let CodeBuilder have a crack at the conversion first. try { b.convert(fromType, toType); return; } catch (IllegalArgumentException e) { if (to != String.class && to != Object.class && to != CharSequence.class) { throw e; } } // Fallback case is to convert to a String. if (fromType.isPrimitive()) { b.invokeStatic(TypeDesc.STRING, "valueOf", TypeDesc.STRING, new TypeDesc[]{fromType}); } else { // If object on stack is null, then just leave it alone. b.dup(); Label isNull = b.createLabel(); b.ifNullBranch(isNull, true); b.invokeStatic(TypeDesc.STRING, "valueOf", TypeDesc.STRING, new TypeDesc[]{TypeDesc.OBJECT}); isNull.setLocation(); } }
java
public static void convertValue(CodeBuilder b, Class from, Class to) { if (from == to) { return; } TypeDesc fromType = TypeDesc.forClass(from); TypeDesc toType = TypeDesc.forClass(to); // Let CodeBuilder have a crack at the conversion first. try { b.convert(fromType, toType); return; } catch (IllegalArgumentException e) { if (to != String.class && to != Object.class && to != CharSequence.class) { throw e; } } // Fallback case is to convert to a String. if (fromType.isPrimitive()) { b.invokeStatic(TypeDesc.STRING, "valueOf", TypeDesc.STRING, new TypeDesc[]{fromType}); } else { // If object on stack is null, then just leave it alone. b.dup(); Label isNull = b.createLabel(); b.ifNullBranch(isNull, true); b.invokeStatic(TypeDesc.STRING, "valueOf", TypeDesc.STRING, new TypeDesc[]{TypeDesc.OBJECT}); isNull.setLocation(); } }
[ "public", "static", "void", "convertValue", "(", "CodeBuilder", "b", ",", "Class", "from", ",", "Class", "to", ")", "{", "if", "(", "from", "==", "to", ")", "{", "return", ";", "}", "TypeDesc", "fromType", "=", "TypeDesc", ".", "forClass", "(", "from",...
Converts a value on the stack. If "to" type is a String, then conversion may call the String.valueOf(from).
[ "Converts", "a", "value", "on", "the", "stack", ".", "If", "to", "type", "is", "a", "String", "then", "conversion", "may", "call", "the", "String", ".", "valueOf", "(", "from", ")", "." ]
train
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/gen/CodeBuilderUtil.java#L647-L678
OpenLiberty/open-liberty
dev/com.ibm.ws.microprofile.metrics/src/com/ibm/ws/microprofile/metrics/impl/MetricRegistryImpl.java
MetricRegistryImpl.getMeters
@Override public SortedMap<String, Meter> getMeters(MetricFilter filter) { return getMetrics(Meter.class, filter); }
java
@Override public SortedMap<String, Meter> getMeters(MetricFilter filter) { return getMetrics(Meter.class, filter); }
[ "@", "Override", "public", "SortedMap", "<", "String", ",", "Meter", ">", "getMeters", "(", "MetricFilter", "filter", ")", "{", "return", "getMetrics", "(", "Meter", ".", "class", ",", "filter", ")", ";", "}" ]
Returns a map of all the meters in the registry and their names which match the given filter. @param filter the metric filter to match @return all the meters in the registry
[ "Returns", "a", "map", "of", "all", "the", "meters", "in", "the", "registry", "and", "their", "names", "which", "match", "the", "given", "filter", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.metrics/src/com/ibm/ws/microprofile/metrics/impl/MetricRegistryImpl.java#L405-L408
gresrun/jesque
src/main/java/net/greghaines/jesque/utils/JesqueUtils.java
JesqueUtils.nullSafeEquals
public static boolean nullSafeEquals(final Object obj1, final Object obj2) { return ((obj1 == null && obj2 == null) || (obj1 != null && obj2 != null && obj1.equals(obj2))); }
java
public static boolean nullSafeEquals(final Object obj1, final Object obj2) { return ((obj1 == null && obj2 == null) || (obj1 != null && obj2 != null && obj1.equals(obj2))); }
[ "public", "static", "boolean", "nullSafeEquals", "(", "final", "Object", "obj1", ",", "final", "Object", "obj2", ")", "{", "return", "(", "(", "obj1", "==", "null", "&&", "obj2", "==", "null", ")", "||", "(", "obj1", "!=", "null", "&&", "obj2", "!=", ...
Test for equality. @param obj1 the first object @param obj2 the second object @return true if both are null or the two objects are equal
[ "Test", "for", "equality", "." ]
train
https://github.com/gresrun/jesque/blob/44749183dccc40962a94c2af547ea7d0d880b5d1/src/main/java/net/greghaines/jesque/utils/JesqueUtils.java#L363-L366
apereo/person-directory
person-directory-impl/src/main/java/org/apereo/services/persondir/support/ComplexStubPersonAttributeDao.java
ComplexStubPersonAttributeDao.setBackingMap
public void setBackingMap(final Map<String, Map<String, List<Object>>> backingMap) { if (backingMap == null) { this.backingMap = new HashMap<>(); this.possibleUserAttributeNames = new HashSet<>(); } else { this.backingMap = new LinkedHashMap<>(backingMap); this.initializePossibleAttributeNames(); } }
java
public void setBackingMap(final Map<String, Map<String, List<Object>>> backingMap) { if (backingMap == null) { this.backingMap = new HashMap<>(); this.possibleUserAttributeNames = new HashSet<>(); } else { this.backingMap = new LinkedHashMap<>(backingMap); this.initializePossibleAttributeNames(); } }
[ "public", "void", "setBackingMap", "(", "final", "Map", "<", "String", ",", "Map", "<", "String", ",", "List", "<", "Object", ">", ">", ">", "backingMap", ")", "{", "if", "(", "backingMap", "==", "null", ")", "{", "this", ".", "backingMap", "=", "new...
The backing Map to use for queries, the outer map is keyed on the query attribute. The inner Map is the set of user attributes to be returned for the query attribute. @param backingMap backing map
[ "The", "backing", "Map", "to", "use", "for", "queries", "the", "outer", "map", "is", "keyed", "on", "the", "query", "attribute", ".", "The", "inner", "Map", "is", "the", "set", "of", "user", "attributes", "to", "be", "returned", "for", "the", "query", ...
train
https://github.com/apereo/person-directory/blob/331200c0878aec202b8aff12a732402d6ba7681f/person-directory-impl/src/main/java/org/apereo/services/persondir/support/ComplexStubPersonAttributeDao.java#L124-L132
sarxos/webcam-capture
webcam-capture-drivers/driver-raspberrypi/src/main/java/com/github/sarxos/webcam/ds/raspberrypi/IPCDriver.java
IPCDriver.parseArguments
protected void parseArguments(final Options options, String[] cmdArray) { CommandLineParser parser = new PosixParser(); try { CommandLine cmd = parser.parse(options, cmdArray); Option[] opts = cmd.getOptions(); for (Option o : opts) { arguments.put(o.getLongOpt(), o.getValue() == null ? "" : o.getValue()); } } catch (ParseException e) { if (LOGGER.isDebugEnabled()) { LOGGER.debug(MSG_WRONG_ARGUMENT); } e.printStackTrace(); } }
java
protected void parseArguments(final Options options, String[] cmdArray) { CommandLineParser parser = new PosixParser(); try { CommandLine cmd = parser.parse(options, cmdArray); Option[] opts = cmd.getOptions(); for (Option o : opts) { arguments.put(o.getLongOpt(), o.getValue() == null ? "" : o.getValue()); } } catch (ParseException e) { if (LOGGER.isDebugEnabled()) { LOGGER.debug(MSG_WRONG_ARGUMENT); } e.printStackTrace(); } }
[ "protected", "void", "parseArguments", "(", "final", "Options", "options", ",", "String", "[", "]", "cmdArray", ")", "{", "CommandLineParser", "parser", "=", "new", "PosixParser", "(", ")", ";", "try", "{", "CommandLine", "cmd", "=", "parser", ".", "parse", ...
parse arguments and add to arguments @param options @param cmdArray
[ "parse", "arguments", "and", "add", "to", "arguments" ]
train
https://github.com/sarxos/webcam-capture/blob/efbdae04f9ba48db9ec621e94a9bcd6f031882c8/webcam-capture-drivers/driver-raspberrypi/src/main/java/com/github/sarxos/webcam/ds/raspberrypi/IPCDriver.java#L90-L104
Sciss/abc4j
abc/src/main/java/abc/ui/swing/ScoreTemplate.java
ScoreTemplate.setElementColor
public void setElementColor(byte scoreElement, Color color) { String name = "COLOR_"+Byte.toString(scoreElement); if (color == null) m_attributes.remove(name); else m_attributes.put(name, color); notifyListeners(); }
java
public void setElementColor(byte scoreElement, Color color) { String name = "COLOR_"+Byte.toString(scoreElement); if (color == null) m_attributes.remove(name); else m_attributes.put(name, color); notifyListeners(); }
[ "public", "void", "setElementColor", "(", "byte", "scoreElement", ",", "Color", "color", ")", "{", "String", "name", "=", "\"COLOR_\"", "+", "Byte", ".", "toString", "(", "scoreElement", ")", ";", "if", "(", "color", "==", "null", ")", "m_attributes", ".",...
Sets the color of the given element type @param scoreElement One of the {@link ScoreElements} constant @param color <TT>null</TT> to remove this attribute
[ "Sets", "the", "color", "of", "the", "given", "element", "type" ]
train
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/ui/swing/ScoreTemplate.java#L782-L789
RobotiumTech/robotium
robotium-solo/src/main/java/com/robotium/solo/Clicker.java
Clicker.clickOnScreen
public void clickOnScreen(View view, boolean longClick, int time) { if(view == null) Assert.fail("View is null and can therefore not be clicked!"); float[] xyToClick = getClickCoordinates(view); float x = xyToClick[0]; float y = xyToClick[1]; if(x == 0 || y == 0){ sleeper.sleepMini(); try { view = viewFetcher.getIdenticalView(view); } catch (Exception ignored){} if(view != null){ xyToClick = getClickCoordinates(view); x = xyToClick[0]; y = xyToClick[1]; } } sleeper.sleep(300); if (longClick) clickLongOnScreen(x, y, time, view); else clickOnScreen(x, y, view); }
java
public void clickOnScreen(View view, boolean longClick, int time) { if(view == null) Assert.fail("View is null and can therefore not be clicked!"); float[] xyToClick = getClickCoordinates(view); float x = xyToClick[0]; float y = xyToClick[1]; if(x == 0 || y == 0){ sleeper.sleepMini(); try { view = viewFetcher.getIdenticalView(view); } catch (Exception ignored){} if(view != null){ xyToClick = getClickCoordinates(view); x = xyToClick[0]; y = xyToClick[1]; } } sleeper.sleep(300); if (longClick) clickLongOnScreen(x, y, time, view); else clickOnScreen(x, y, view); }
[ "public", "void", "clickOnScreen", "(", "View", "view", ",", "boolean", "longClick", ",", "int", "time", ")", "{", "if", "(", "view", "==", "null", ")", "Assert", ".", "fail", "(", "\"View is null and can therefore not be clicked!\"", ")", ";", "float", "[", ...
Private method used to click on a given view. @param view the view that should be clicked @param longClick true if the click should be a long click @param time the amount of time to long click
[ "Private", "method", "used", "to", "click", "on", "a", "given", "view", "." ]
train
https://github.com/RobotiumTech/robotium/blob/75e567c38f26a6a87dc8bef90b3886a20e28d291/robotium-solo/src/main/java/com/robotium/solo/Clicker.java#L184-L210
theHilikus/Event-manager
src/main/java/com/github/thehilikus/events/event_manager/SubscriptionManager.java
SubscriptionManager.subscribe
public <T extends EventListener> void subscribe(EventPublisher source, T listener) { if (source == null || listener == null) { throw new IllegalArgumentException("Parameters cannot be null"); } log.debug("[subscribe] Adding {} --> {}", source.getClass().getName(), listener.getClass().getName()); GenericEventDispatcher<T> dispatcher = (GenericEventDispatcher<T>) dispatchers.get(source); if (dispatcher == null) { log.warn("[subscribe] Registering with a disconnected source"); dispatcher = createDispatcher(source); } dispatcher.addListener(listener); }
java
public <T extends EventListener> void subscribe(EventPublisher source, T listener) { if (source == null || listener == null) { throw new IllegalArgumentException("Parameters cannot be null"); } log.debug("[subscribe] Adding {} --> {}", source.getClass().getName(), listener.getClass().getName()); GenericEventDispatcher<T> dispatcher = (GenericEventDispatcher<T>) dispatchers.get(source); if (dispatcher == null) { log.warn("[subscribe] Registering with a disconnected source"); dispatcher = createDispatcher(source); } dispatcher.addListener(listener); }
[ "public", "<", "T", "extends", "EventListener", ">", "void", "subscribe", "(", "EventPublisher", "source", ",", "T", "listener", ")", "{", "if", "(", "source", "==", "null", "||", "listener", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException"...
Binds a listener to a publisher @param source the event publisher @param listener the event receiver
[ "Binds", "a", "listener", "to", "a", "publisher" ]
train
https://github.com/theHilikus/Event-manager/blob/c3dabf5a145e57b2a6de89c1910851b8a8ae6064/src/main/java/com/github/thehilikus/events/event_manager/SubscriptionManager.java#L30-L44
liferay/com-liferay-commerce
commerce-discount-service/src/main/java/com/liferay/commerce/discount/service/persistence/impl/CommerceDiscountPersistenceImpl.java
CommerceDiscountPersistenceImpl.removeByUuid_C
@Override public void removeByUuid_C(String uuid, long companyId) { for (CommerceDiscount commerceDiscount : findByUuid_C(uuid, companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(commerceDiscount); } }
java
@Override public void removeByUuid_C(String uuid, long companyId) { for (CommerceDiscount commerceDiscount : findByUuid_C(uuid, companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(commerceDiscount); } }
[ "@", "Override", "public", "void", "removeByUuid_C", "(", "String", "uuid", ",", "long", "companyId", ")", "{", "for", "(", "CommerceDiscount", "commerceDiscount", ":", "findByUuid_C", "(", "uuid", ",", "companyId", ",", "QueryUtil", ".", "ALL_POS", ",", "Quer...
Removes all the commerce discounts where uuid = &#63; and companyId = &#63; from the database. @param uuid the uuid @param companyId the company ID
[ "Removes", "all", "the", "commerce", "discounts", "where", "uuid", "=", "&#63", ";", "and", "companyId", "=", "&#63", ";", "from", "the", "database", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-discount-service/src/main/java/com/liferay/commerce/discount/service/persistence/impl/CommerceDiscountPersistenceImpl.java#L1407-L1413
looly/hutool
hutool-system/src/main/java/cn/hutool/system/SystemUtil.java
SystemUtil.get
public static String get(String name, boolean quiet) { try { return System.getProperty(name); } catch (SecurityException e) { if (false == quiet) { Console.error("Caught a SecurityException reading the system property '{}'; the SystemUtil property value will default to null.", name); } return null; } }
java
public static String get(String name, boolean quiet) { try { return System.getProperty(name); } catch (SecurityException e) { if (false == quiet) { Console.error("Caught a SecurityException reading the system property '{}'; the SystemUtil property value will default to null.", name); } return null; } }
[ "public", "static", "String", "get", "(", "String", "name", ",", "boolean", "quiet", ")", "{", "try", "{", "return", "System", ".", "getProperty", "(", "name", ")", ";", "}", "catch", "(", "SecurityException", "e", ")", "{", "if", "(", "false", "==", ...
取得系统属性,如果因为Java安全的限制而失败,则将错误打在Log中,然后返回 <code>null</code>。 @param name 属性名 @param quiet 安静模式,不将出错信息打在<code>System.err</code>中 @return 属性值或<code>null</code>
[ "取得系统属性,如果因为Java安全的限制而失败,则将错误打在Log中,然后返回", "<code", ">", "null<", "/", "code", ">", "。" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-system/src/main/java/cn/hutool/system/SystemUtil.java#L118-L127
codegist/crest
core/src/main/java/org/codegist/crest/CRestBuilder.java
CRestBuilder.setProperties
public CRestBuilder setProperties(Map<String, Object> crestProperties) { this.crestProperties.clear(); return addProperties(crestProperties); }
java
public CRestBuilder setProperties(Map<String, Object> crestProperties) { this.crestProperties.clear(); return addProperties(crestProperties); }
[ "public", "CRestBuilder", "setProperties", "(", "Map", "<", "String", ",", "Object", ">", "crestProperties", ")", "{", "this", ".", "crestProperties", ".", "clear", "(", ")", ";", "return", "addProperties", "(", "crestProperties", ")", ";", "}" ]
<p>Sets all given properties to the {@link org.codegist.crest.CRestConfig} that will be passed to all <b>CRest</b> components.</p> <p>Note that these properties can be used to override defaut <b>CRest</b>'s MethodConfig and ParamConfig values when none are provided through annotations.</p> @param crestProperties properties @return current builder @see org.codegist.crest.CRestConfig @see org.codegist.crest.config.MethodConfig @see org.codegist.crest.config.ParamConfig
[ "<p", ">", "Sets", "all", "given", "properties", "to", "the", "{" ]
train
https://github.com/codegist/crest/blob/e99ba7728b27d2ddb2c247261350f1b6fa7a6698/core/src/main/java/org/codegist/crest/CRestBuilder.java#L379-L382
JoeKerouac/utils
src/main/java/com/joe/utils/common/IOUtils.java
IOUtils.saveAsFile
public static void saveAsFile(byte[] data, String addr) throws IOException { log.debug("将字节数据保存到本地文件"); File file = new File(addr); if (!file.exists()) { if (!file.getParentFile().mkdirs()) { log.error("创建目录{}失败", addr); } } log.debug("保存路径为:{}", file.getAbsolutePath()); FileOutputStream out = new FileOutputStream(file); out.write(data); out.flush(); out.close(); log.debug("文件保存完毕"); }
java
public static void saveAsFile(byte[] data, String addr) throws IOException { log.debug("将字节数据保存到本地文件"); File file = new File(addr); if (!file.exists()) { if (!file.getParentFile().mkdirs()) { log.error("创建目录{}失败", addr); } } log.debug("保存路径为:{}", file.getAbsolutePath()); FileOutputStream out = new FileOutputStream(file); out.write(data); out.flush(); out.close(); log.debug("文件保存完毕"); }
[ "public", "static", "void", "saveAsFile", "(", "byte", "[", "]", "data", ",", "String", "addr", ")", "throws", "IOException", "{", "log", ".", "debug", "(", "\"将字节数据保存到本地文件\");", "", "", "File", "file", "=", "new", "File", "(", "addr", ")", ";", "if", ...
保存数据到本地 @param data 数据 @param addr 保存本地的路径,包含文件名,例如D://a.txt @throws IOException IO异常
[ "保存数据到本地" ]
train
https://github.com/JoeKerouac/utils/blob/45e1b2dc4d736956674fc4dcbe6cf84eaee69278/src/main/java/com/joe/utils/common/IOUtils.java#L63-L77
Bandwidth/java-bandwidth
src/main/java/com/bandwidth/sdk/model/Domain.java
Domain.update
public static Domain update(final BandwidthClient client, final String id, final Map<String, Object>params) throws AppPlatformException, ParseException, IOException, Exception { assert(client != null && id != null); final String domainsUri = client.getUserResourceInstanceUri(BandwidthConstants.DOMAINS_URI_PATH, id); final RestResponse response = client.post(domainsUri, params); final JSONObject jsonObject = toJSONObject(client.get(domainsUri, null)); return new Domain(client, jsonObject); }
java
public static Domain update(final BandwidthClient client, final String id, final Map<String, Object>params) throws AppPlatformException, ParseException, IOException, Exception { assert(client != null && id != null); final String domainsUri = client.getUserResourceInstanceUri(BandwidthConstants.DOMAINS_URI_PATH, id); final RestResponse response = client.post(domainsUri, params); final JSONObject jsonObject = toJSONObject(client.get(domainsUri, null)); return new Domain(client, jsonObject); }
[ "public", "static", "Domain", "update", "(", "final", "BandwidthClient", "client", ",", "final", "String", "id", ",", "final", "Map", "<", "String", ",", "Object", ">", "params", ")", "throws", "AppPlatformException", ",", "ParseException", ",", "IOException", ...
Convenience method to return a Domain. @param client the client. @param id the domain id. @param params the params @return the domain object. @throws AppPlatformException API Exception @throws ParseException Error parsing data @throws IOException unexpected error @throws Exception error
[ "Convenience", "method", "to", "return", "a", "Domain", "." ]
train
https://github.com/Bandwidth/java-bandwidth/blob/2124c85148ad6a54d2f2949cb952eb3985830e2a/src/main/java/com/bandwidth/sdk/model/Domain.java#L220-L226
sarl/sarl
main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/externalspec/vim/VimGenerator2.java
VimGenerator2.appendCmd
protected IStyleAppendable appendCmd(IStyleAppendable it, String text) { return appendCmd(it, true, text); }
java
protected IStyleAppendable appendCmd(IStyleAppendable it, String text) { return appendCmd(it, true, text); }
[ "protected", "IStyleAppendable", "appendCmd", "(", "IStyleAppendable", "it", ",", "String", "text", ")", "{", "return", "appendCmd", "(", "it", ",", "true", ",", "text", ")", ";", "}" ]
Append a Vim command. @param it the receiver of the generated elements. @param text the text of the command. @return {@code it}.
[ "Append", "a", "Vim", "command", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/externalspec/vim/VimGenerator2.java#L539-L541
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/serialize/SerializerUtils.java
SerializerUtils.addAttribute
public static void addAttribute(SerializationHandler handler, int attr) throws TransformerException { TransformerImpl transformer = (TransformerImpl) handler.getTransformer(); DTM dtm = transformer.getXPathContext().getDTM(attr); if (SerializerUtils.isDefinedNSDecl(handler, attr, dtm)) return; String ns = dtm.getNamespaceURI(attr); if (ns == null) ns = ""; // %OPT% ...can I just store the node handle? try { handler.addAttribute( ns, dtm.getLocalName(attr), dtm.getNodeName(attr), "CDATA", dtm.getNodeValue(attr), false); } catch (SAXException e) { // do something? } }
java
public static void addAttribute(SerializationHandler handler, int attr) throws TransformerException { TransformerImpl transformer = (TransformerImpl) handler.getTransformer(); DTM dtm = transformer.getXPathContext().getDTM(attr); if (SerializerUtils.isDefinedNSDecl(handler, attr, dtm)) return; String ns = dtm.getNamespaceURI(attr); if (ns == null) ns = ""; // %OPT% ...can I just store the node handle? try { handler.addAttribute( ns, dtm.getLocalName(attr), dtm.getNodeName(attr), "CDATA", dtm.getNodeValue(attr), false); } catch (SAXException e) { // do something? } }
[ "public", "static", "void", "addAttribute", "(", "SerializationHandler", "handler", ",", "int", "attr", ")", "throws", "TransformerException", "{", "TransformerImpl", "transformer", "=", "(", "TransformerImpl", ")", "handler", ".", "getTransformer", "(", ")", ";", ...
Copy an DOM attribute to the created output element, executing attribute templates as need be, and processing the xsl:use attribute. @param handler SerializationHandler to which the attributes are added. @param attr Attribute node to add to SerializationHandler. @throws TransformerException
[ "Copy", "an", "DOM", "attribute", "to", "the", "created", "output", "element", "executing", "attribute", "templates", "as", "need", "be", "and", "processing", "the", "xsl", ":", "use", "attribute", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/serialize/SerializerUtils.java#L54-L84
micronaut-projects/micronaut-core
inject/src/main/java/io/micronaut/inject/annotation/DefaultAnnotationMetadata.java
DefaultAnnotationMetadata.addRepeatable
protected final void addRepeatable(String annotationName, io.micronaut.core.annotation.AnnotationValue annotationValue) { if (StringUtils.isNotEmpty(annotationName) && annotationValue != null) { Map<String, Map<CharSequence, Object>> allAnnotations = getAllAnnotations(); addRepeatableInternal(annotationName, annotationValue, allAnnotations); } }
java
protected final void addRepeatable(String annotationName, io.micronaut.core.annotation.AnnotationValue annotationValue) { if (StringUtils.isNotEmpty(annotationName) && annotationValue != null) { Map<String, Map<CharSequence, Object>> allAnnotations = getAllAnnotations(); addRepeatableInternal(annotationName, annotationValue, allAnnotations); } }
[ "protected", "final", "void", "addRepeatable", "(", "String", "annotationName", ",", "io", ".", "micronaut", ".", "core", ".", "annotation", ".", "AnnotationValue", "annotationValue", ")", "{", "if", "(", "StringUtils", ".", "isNotEmpty", "(", "annotationName", ...
Adds a repeatable annotation value. If a value already exists will be added @param annotationName The annotation name @param annotationValue The annotation value
[ "Adds", "a", "repeatable", "annotation", "value", ".", "If", "a", "value", "already", "exists", "will", "be", "added" ]
train
https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/inject/src/main/java/io/micronaut/inject/annotation/DefaultAnnotationMetadata.java#L550-L556
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/TimSort.java
TimSort.mergeAt
private void mergeAt(int i) { assert stackSize >= 2; assert i >= 0; assert i == stackSize - 2 || i == stackSize - 3; int base1 = runBase[i]; int len1 = runLen[i]; int base2 = runBase[i + 1]; int len2 = runLen[i + 1]; assert len1 > 0 && len2 > 0; assert base1 + len1 == base2; /* * Record the length of the combined runs; if i is the 3rd-last * run now, also slide over the last run (which isn't involved * in this merge). The current run (i+1) goes away in any case. */ runLen[i] = len1 + len2; if (i == stackSize - 3) { runBase[i + 1] = runBase[i + 2]; runLen[i + 1] = runLen[i + 2]; } stackSize--; /* * Find where the first element of run2 goes in run1. Prior elements * in run1 can be ignored (because they're already in place). */ int k = gallopRight(a[base2], a, base1, len1, 0, c); assert k >= 0; base1 += k; len1 -= k; if (len1 == 0) return; /* * Find where the last element of run1 goes in run2. Subsequent elements * in run2 can be ignored (because they're already in place). */ len2 = gallopLeft(a[base1 + len1 - 1], a, base2, len2, len2 - 1, c); assert len2 >= 0; if (len2 == 0) return; // Merge remaining runs, using tmp array with min(len1, len2) elements if (len1 <= len2) mergeLo(base1, len1, base2, len2); else mergeHi(base1, len1, base2, len2); }
java
private void mergeAt(int i) { assert stackSize >= 2; assert i >= 0; assert i == stackSize - 2 || i == stackSize - 3; int base1 = runBase[i]; int len1 = runLen[i]; int base2 = runBase[i + 1]; int len2 = runLen[i + 1]; assert len1 > 0 && len2 > 0; assert base1 + len1 == base2; /* * Record the length of the combined runs; if i is the 3rd-last * run now, also slide over the last run (which isn't involved * in this merge). The current run (i+1) goes away in any case. */ runLen[i] = len1 + len2; if (i == stackSize - 3) { runBase[i + 1] = runBase[i + 2]; runLen[i + 1] = runLen[i + 2]; } stackSize--; /* * Find where the first element of run2 goes in run1. Prior elements * in run1 can be ignored (because they're already in place). */ int k = gallopRight(a[base2], a, base1, len1, 0, c); assert k >= 0; base1 += k; len1 -= k; if (len1 == 0) return; /* * Find where the last element of run1 goes in run2. Subsequent elements * in run2 can be ignored (because they're already in place). */ len2 = gallopLeft(a[base1 + len1 - 1], a, base2, len2, len2 - 1, c); assert len2 >= 0; if (len2 == 0) return; // Merge remaining runs, using tmp array with min(len1, len2) elements if (len1 <= len2) mergeLo(base1, len1, base2, len2); else mergeHi(base1, len1, base2, len2); }
[ "private", "void", "mergeAt", "(", "int", "i", ")", "{", "assert", "stackSize", ">=", "2", ";", "assert", "i", ">=", "0", ";", "assert", "i", "==", "stackSize", "-", "2", "||", "i", "==", "stackSize", "-", "3", ";", "int", "base1", "=", "runBase", ...
Merges the two runs at stack indices i and i+1. Run i must be the penultimate or antepenultimate run on the stack. In other words, i must be equal to stackSize-2 or stackSize-3. @param i stack index of the first of the two runs to merge
[ "Merges", "the", "two", "runs", "at", "stack", "indices", "i", "and", "i", "+", "1", ".", "Run", "i", "must", "be", "the", "penultimate", "or", "antepenultimate", "run", "on", "the", "stack", ".", "In", "other", "words", "i", "must", "be", "equal", "...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/TimSort.java#L468-L517
otto-de/edison-hal
src/main/java/de/otto/edison/hal/traverson/Traverson.java
Traverson.getResourceAs
public <T extends HalRepresentation> Optional<T> getResourceAs(final Class<T> type, final EmbeddedTypeInfo embeddedTypeInfo, final EmbeddedTypeInfo... moreEmbeddedTypeInfos) throws IOException { if (moreEmbeddedTypeInfos == null || moreEmbeddedTypeInfos.length == 0) { return getResourceAs(type, embeddedTypeInfo != null ? singletonList(embeddedTypeInfo) : emptyList()); } else { final List<EmbeddedTypeInfo> typeInfos = new ArrayList<>(); typeInfos.add(requireNonNull(embeddedTypeInfo)); typeInfos.addAll(asList(moreEmbeddedTypeInfos)); return getResourceAs(type, typeInfos); } }
java
public <T extends HalRepresentation> Optional<T> getResourceAs(final Class<T> type, final EmbeddedTypeInfo embeddedTypeInfo, final EmbeddedTypeInfo... moreEmbeddedTypeInfos) throws IOException { if (moreEmbeddedTypeInfos == null || moreEmbeddedTypeInfos.length == 0) { return getResourceAs(type, embeddedTypeInfo != null ? singletonList(embeddedTypeInfo) : emptyList()); } else { final List<EmbeddedTypeInfo> typeInfos = new ArrayList<>(); typeInfos.add(requireNonNull(embeddedTypeInfo)); typeInfos.addAll(asList(moreEmbeddedTypeInfos)); return getResourceAs(type, typeInfos); } }
[ "public", "<", "T", "extends", "HalRepresentation", ">", "Optional", "<", "T", ">", "getResourceAs", "(", "final", "Class", "<", "T", ">", "type", ",", "final", "EmbeddedTypeInfo", "embeddedTypeInfo", ",", "final", "EmbeddedTypeInfo", "...", "moreEmbeddedTypeInfos...
Return the selected resource and return it in the specified type. <p> The EmbeddedTypeInfo is used to define the specific type of embedded items. </p> <p> If there are multiple matching representations, the first node is returned. </p> @param type the subtype of the HalRepresentation used to parse the resource. @param embeddedTypeInfo specification of the type of embedded items @param moreEmbeddedTypeInfos more type infors for embedded items @param <T> the subtype of HalRepresentation of the returned resource. @return HalRepresentation @throws IOException if a low-level I/O problem (unexpected end-of-input, network error) occurs. @throws JsonParseException if the json document can not be parsed by Jackson's ObjectMapper @throws JsonMappingException if the input JSON structure can not be mapped to the specified HalRepresentation type @since 1.0.0
[ "Return", "the", "selected", "resource", "and", "return", "it", "in", "the", "specified", "type", ".", "<p", ">", "The", "EmbeddedTypeInfo", "is", "used", "to", "define", "the", "specific", "type", "of", "embedded", "items", ".", "<", "/", "p", ">", "<p"...
train
https://github.com/otto-de/edison-hal/blob/1582d2b49d1f0d9103e03bf742f18afa9d166992/src/main/java/de/otto/edison/hal/traverson/Traverson.java#L1140-L1151
indeedeng/util
util-core/src/main/java/com/indeed/util/core/sort/Quicksortables.java
Quicksortables.popHeap
public static void popHeap(Quicksortable q, int size) { q.swap(0, size-1); heapifyDown(q, 0, size-1); }
java
public static void popHeap(Quicksortable q, int size) { q.swap(0, size-1); heapifyDown(q, 0, size-1); }
[ "public", "static", "void", "popHeap", "(", "Quicksortable", "q", ",", "int", "size", ")", "{", "q", ".", "swap", "(", "0", ",", "size", "-", "1", ")", ";", "heapifyDown", "(", "q", ",", "0", ",", "size", "-", "1", ")", ";", "}" ]
Pops the lowest element off the heap and stores it in the last element @param q The quicksortable to heapify down. @param size The size of the quicksortable.
[ "Pops", "the", "lowest", "element", "off", "the", "heap", "and", "stores", "it", "in", "the", "last", "element" ]
train
https://github.com/indeedeng/util/blob/332008426cf14b57e7fc3e817d9423e3f84fb922/util-core/src/main/java/com/indeed/util/core/sort/Quicksortables.java#L330-L333
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java
Gen.binaryQualifier
Symbol binaryQualifier(Symbol sym, Type site) { if (site.hasTag(ARRAY)) { if (sym == syms.lengthVar || sym.owner != syms.arrayClass) return sym; // array clone can be qualified by the array type in later targets Symbol qualifier = new ClassSymbol(Flags.PUBLIC, site.tsym.name, site, syms.noSymbol); return sym.clone(qualifier); } if (sym.owner == site.tsym || (sym.flags() & (STATIC | SYNTHETIC)) == (STATIC | SYNTHETIC)) { return sym; } // leave alone methods inherited from Object // JLS 13.1. if (sym.owner == syms.objectType.tsym) return sym; return sym.clone(site.tsym); }
java
Symbol binaryQualifier(Symbol sym, Type site) { if (site.hasTag(ARRAY)) { if (sym == syms.lengthVar || sym.owner != syms.arrayClass) return sym; // array clone can be qualified by the array type in later targets Symbol qualifier = new ClassSymbol(Flags.PUBLIC, site.tsym.name, site, syms.noSymbol); return sym.clone(qualifier); } if (sym.owner == site.tsym || (sym.flags() & (STATIC | SYNTHETIC)) == (STATIC | SYNTHETIC)) { return sym; } // leave alone methods inherited from Object // JLS 13.1. if (sym.owner == syms.objectType.tsym) return sym; return sym.clone(site.tsym); }
[ "Symbol", "binaryQualifier", "(", "Symbol", "sym", ",", "Type", "site", ")", "{", "if", "(", "site", ".", "hasTag", "(", "ARRAY", ")", ")", "{", "if", "(", "sym", "==", "syms", ".", "lengthVar", "||", "sym", ".", "owner", "!=", "syms", ".", "arrayC...
Construct a symbol to reflect the qualifying type that should appear in the byte code as per JLS 13.1. For {@literal target >= 1.2}: Clone a method with the qualifier as owner (except for those cases where we need to work around VM bugs). For {@literal target <= 1.1}: If qualified variable or method is defined in a non-accessible class, clone it with the qualifier class as owner. @param sym The accessed symbol @param site The qualifier's type.
[ "Construct", "a", "symbol", "to", "reflect", "the", "qualifying", "type", "that", "should", "appear", "in", "the", "byte", "code", "as", "per", "JLS", "13", ".", "1", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java#L222-L245
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.billingAccount_ovhPabx_serviceName_dialplan_dialplanId_PUT
public void billingAccount_ovhPabx_serviceName_dialplan_dialplanId_PUT(String billingAccount, String serviceName, Long dialplanId, OvhOvhPabxDialplan body) throws IOException { String qPath = "/telephony/{billingAccount}/ovhPabx/{serviceName}/dialplan/{dialplanId}"; StringBuilder sb = path(qPath, billingAccount, serviceName, dialplanId); exec(qPath, "PUT", sb.toString(), body); }
java
public void billingAccount_ovhPabx_serviceName_dialplan_dialplanId_PUT(String billingAccount, String serviceName, Long dialplanId, OvhOvhPabxDialplan body) throws IOException { String qPath = "/telephony/{billingAccount}/ovhPabx/{serviceName}/dialplan/{dialplanId}"; StringBuilder sb = path(qPath, billingAccount, serviceName, dialplanId); exec(qPath, "PUT", sb.toString(), body); }
[ "public", "void", "billingAccount_ovhPabx_serviceName_dialplan_dialplanId_PUT", "(", "String", "billingAccount", ",", "String", "serviceName", ",", "Long", "dialplanId", ",", "OvhOvhPabxDialplan", "body", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/tele...
Alter this object properties REST: PUT /telephony/{billingAccount}/ovhPabx/{serviceName}/dialplan/{dialplanId} @param body [required] New object properties @param billingAccount [required] The name of your billingAccount @param serviceName [required] @param dialplanId [required]
[ "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#L7387-L7391
unic/neba
core/src/main/java/io/neba/core/resourcemodels/mapping/FieldValueMappingCallback.java
FieldValueMappingCallback.resolvePropertyTypedValueFromForeignResource
private <T> T resolvePropertyTypedValueFromForeignResource(FieldData field, Class<T> propertyType) { Resource property = this.resource.getResourceResolver().getResource(this.resource, field.path); if (property == null) { return null; } // Only adaptation to String-types is supported by the property resource if (propertyType == String.class || propertyType == String[].class) { return property.adaptTo(propertyType); } // Obtain the ValueMap representation of the parent containing the property to use property conversion Resource parent = property.getParent(); if (parent == null) { return null; } ValueMap properties = parent.adaptTo(ValueMap.class); if (properties == null) { return null; } return new PrimitiveSupportingValueMap(properties).get(property.getName(), propertyType); }
java
private <T> T resolvePropertyTypedValueFromForeignResource(FieldData field, Class<T> propertyType) { Resource property = this.resource.getResourceResolver().getResource(this.resource, field.path); if (property == null) { return null; } // Only adaptation to String-types is supported by the property resource if (propertyType == String.class || propertyType == String[].class) { return property.adaptTo(propertyType); } // Obtain the ValueMap representation of the parent containing the property to use property conversion Resource parent = property.getParent(); if (parent == null) { return null; } ValueMap properties = parent.adaptTo(ValueMap.class); if (properties == null) { return null; } return new PrimitiveSupportingValueMap(properties).get(property.getName(), propertyType); }
[ "private", "<", "T", ">", "T", "resolvePropertyTypedValueFromForeignResource", "(", "FieldData", "field", ",", "Class", "<", "T", ">", "propertyType", ")", "{", "Resource", "property", "=", "this", ".", "resource", ".", "getResourceResolver", "(", ")", ".", "g...
Resolves a property via a property {@link Resource}. This is used to retrieve relative or absolute references to the properties of resources other than the current resource. Such references cannot be reliably retrieved using a resource's {@link ValueMap} as the value map may be <code>null</code> and does not support access to properties of parent resources. @return the resolved value, or <code>null</code>.
[ "Resolves", "a", "property", "via", "a", "property", "{", "@link", "Resource", "}", ".", "This", "is", "used", "to", "retrieve", "relative", "or", "absolute", "references", "to", "the", "properties", "of", "resources", "other", "than", "the", "current", "res...
train
https://github.com/unic/neba/blob/4d762e60112a1fcb850926a56a9843d5aa424c4b/core/src/main/java/io/neba/core/resourcemodels/mapping/FieldValueMappingCallback.java#L423-L446
realexpayments/rxp-hpp-java
src/main/java/com/realexpayments/hpp/sdk/domain/HppRequest.java
HppRequest.addSupplementaryDataValue
@JsonAnySetter public HppRequest addSupplementaryDataValue(String name, String value) { supplementaryData.put(name, value); return this; }
java
@JsonAnySetter public HppRequest addSupplementaryDataValue(String name, String value) { supplementaryData.put(name, value); return this; }
[ "@", "JsonAnySetter", "public", "HppRequest", "addSupplementaryDataValue", "(", "String", "name", ",", "String", "value", ")", "{", "supplementaryData", ".", "put", "(", "name", ",", "value", ")", ";", "return", "this", ";", "}" ]
Helper method to add supplementary data. @param name @param value @return HppRequest
[ "Helper", "method", "to", "add", "supplementary", "data", "." ]
train
https://github.com/realexpayments/rxp-hpp-java/blob/29cc5df036af09a6d8ea16ccd7e02e856f72620f/src/main/java/com/realexpayments/hpp/sdk/domain/HppRequest.java#L1198-L1202
geomajas/geomajas-project-server
plugin/reporting/reporting/src/main/java/org/geomajas/plugin/reporting/mvc/ReportingController.java
ReportingController.addParameters
@SuppressWarnings("unchecked") private void addParameters(Model model, HttpServletRequest request) { for (Object objectEntry : request.getParameterMap().entrySet()) { Map.Entry<String, String[]> entry = (Map.Entry<String, String[]>) objectEntry; String key = entry.getKey(); String[] values = entry.getValue(); if (null != values && values.length > 0) { String value = values[0]; try { model.addAttribute(key, getParameter(key, value)); } catch (ParseException pe) { log.error("Could not parse parameter value {} for {}, ignoring parameter.", key, value); } catch (NumberFormatException nfe) { log.error("Could not parse parameter value {} for {}, ignoring parameter.", key, value); } } } }
java
@SuppressWarnings("unchecked") private void addParameters(Model model, HttpServletRequest request) { for (Object objectEntry : request.getParameterMap().entrySet()) { Map.Entry<String, String[]> entry = (Map.Entry<String, String[]>) objectEntry; String key = entry.getKey(); String[] values = entry.getValue(); if (null != values && values.length > 0) { String value = values[0]; try { model.addAttribute(key, getParameter(key, value)); } catch (ParseException pe) { log.error("Could not parse parameter value {} for {}, ignoring parameter.", key, value); } catch (NumberFormatException nfe) { log.error("Could not parse parameter value {} for {}, ignoring parameter.", key, value); } } } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "private", "void", "addParameters", "(", "Model", "model", ",", "HttpServletRequest", "request", ")", "{", "for", "(", "Object", "objectEntry", ":", "request", ".", "getParameterMap", "(", ")", ".", "entrySet",...
Add the extra parameters which are passed as report parameters. The type of the parameter is "guessed" from the first letter of the parameter name. @param model view model @param request servlet request
[ "Add", "the", "extra", "parameters", "which", "are", "passed", "as", "report", "parameters", ".", "The", "type", "of", "the", "parameter", "is", "guessed", "from", "the", "first", "letter", "of", "the", "parameter", "name", "." ]
train
https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/plugin/reporting/reporting/src/main/java/org/geomajas/plugin/reporting/mvc/ReportingController.java#L153-L170
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/slim/MapFixture.java
MapFixture.addValueToIn
public void addValueToIn(Object value, String name, Map<String, Object> map) { getMapHelper().addValueToIn(value, name, map); }
java
public void addValueToIn(Object value, String name, Map<String, Object> map) { getMapHelper().addValueToIn(value, name, map); }
[ "public", "void", "addValueToIn", "(", "Object", "value", ",", "String", "name", ",", "Map", "<", "String", ",", "Object", ">", "map", ")", "{", "getMapHelper", "(", ")", ".", "addValueToIn", "(", "value", ",", "name", ",", "map", ")", ";", "}" ]
Adds value to a list map. @param value value to be passed. @param name name to use this value for. @param map map to store value in.
[ "Adds", "value", "to", "a", "list", "map", "." ]
train
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/slim/MapFixture.java#L95-L97
future-architect/uroborosql
src/main/java/jp/co/future/uroborosql/parameter/OutParameter.java
OutParameter.setOutParameter
protected int setOutParameter(final CallableStatement callableStatement, int index) throws SQLException { callableStatement.registerOutParameter(index, sqlType.getVendorTypeNumber()); parameterLog(index); index++; return index; }
java
protected int setOutParameter(final CallableStatement callableStatement, int index) throws SQLException { callableStatement.registerOutParameter(index, sqlType.getVendorTypeNumber()); parameterLog(index); index++; return index; }
[ "protected", "int", "setOutParameter", "(", "final", "CallableStatement", "callableStatement", ",", "int", "index", ")", "throws", "SQLException", "{", "callableStatement", ".", "registerOutParameter", "(", "index", ",", "sqlType", ".", "getVendorTypeNumber", "(", ")"...
ステートメントに出力パラメータを登録。 @param callableStatement コーラブルステートメント @param index パラメータインデックス @return 次のパラメータインデックス @throws SQLException SQL例外
[ "ステートメントに出力パラメータを登録。" ]
train
https://github.com/future-architect/uroborosql/blob/4c26db51defdac3c6ed16866e33ab45e190e2e0c/src/main/java/jp/co/future/uroborosql/parameter/OutParameter.java#L83-L88
udoprog/ffwd-client-java
src/main/java/com/google/protobuf250/ExtensionRegistry.java
ExtensionRegistry.findExtensionByNumber
public ExtensionInfo findExtensionByNumber(final Descriptor containingType, final int fieldNumber) { return extensionsByNumber.get( new DescriptorIntPair(containingType, fieldNumber)); }
java
public ExtensionInfo findExtensionByNumber(final Descriptor containingType, final int fieldNumber) { return extensionsByNumber.get( new DescriptorIntPair(containingType, fieldNumber)); }
[ "public", "ExtensionInfo", "findExtensionByNumber", "(", "final", "Descriptor", "containingType", ",", "final", "int", "fieldNumber", ")", "{", "return", "extensionsByNumber", ".", "get", "(", "new", "DescriptorIntPair", "(", "containingType", ",", "fieldNumber", ")",...
Find an extension by containing type and field number. @return Information about the extension if found, or {@code null} otherwise.
[ "Find", "an", "extension", "by", "containing", "type", "and", "field", "number", "." ]
train
https://github.com/udoprog/ffwd-client-java/blob/b4161d2b138e3edb8fa9420cc3cc653d5764cf5b/src/main/java/com/google/protobuf250/ExtensionRegistry.java#L150-L154
deeplearning4j/deeplearning4j
nd4j/nd4j-serde/nd4j-arrow/src/main/java/org/nd4j/arrow/ArrowSerde.java
ArrowSerde.typeFromTensorType
public static DataType typeFromTensorType(byte type, int elementSize) { if(type == Type.FloatingPoint) { return DataType.FLOAT; } else if(type == Type.Decimal) { return DataType.DOUBLE; } else if(type == Type.Int) { if(elementSize == 4) { return DataType.INT; } else if(elementSize == 8) { return DataType.LONG; } } else { throw new IllegalArgumentException("Only valid types are Type.Decimal and Type.Int"); } throw new IllegalArgumentException("Unable to determine data type"); }
java
public static DataType typeFromTensorType(byte type, int elementSize) { if(type == Type.FloatingPoint) { return DataType.FLOAT; } else if(type == Type.Decimal) { return DataType.DOUBLE; } else if(type == Type.Int) { if(elementSize == 4) { return DataType.INT; } else if(elementSize == 8) { return DataType.LONG; } } else { throw new IllegalArgumentException("Only valid types are Type.Decimal and Type.Int"); } throw new IllegalArgumentException("Unable to determine data type"); }
[ "public", "static", "DataType", "typeFromTensorType", "(", "byte", "type", ",", "int", "elementSize", ")", "{", "if", "(", "type", "==", "Type", ".", "FloatingPoint", ")", "{", "return", "DataType", ".", "FLOAT", ";", "}", "else", "if", "(", "type", "=="...
Create thee databuffer type frm the given type, relative to the bytes in arrow in class: {@link Type} @param type the type to create the nd4j {@link DataType} from @param elementSize the element size @return the data buffer type
[ "Create", "thee", "databuffer", "type", "frm", "the", "given", "type", "relative", "to", "the", "bytes", "in", "arrow", "in", "class", ":", "{" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-serde/nd4j-arrow/src/main/java/org/nd4j/arrow/ArrowSerde.java#L177-L197
apache/flink
flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java
Configuration.getTrimmed
public String getTrimmed(String name, String defaultValue) { String ret = getTrimmed(name); return ret == null ? defaultValue : ret; }
java
public String getTrimmed(String name, String defaultValue) { String ret = getTrimmed(name); return ret == null ? defaultValue : ret; }
[ "public", "String", "getTrimmed", "(", "String", "name", ",", "String", "defaultValue", ")", "{", "String", "ret", "=", "getTrimmed", "(", "name", ")", ";", "return", "ret", "==", "null", "?", "defaultValue", ":", "ret", ";", "}" ]
Get the value of the <code>name</code> property as a trimmed <code>String</code>, <code>defaultValue</code> if no such property exists. See @{Configuration#getTrimmed} for more details. @param name the property name. @param defaultValue the property default value. @return the value of the <code>name</code> or defaultValue if it is not set.
[ "Get", "the", "value", "of", "the", "<code", ">", "name<", "/", "code", ">", "property", "as", "a", "trimmed", "<code", ">", "String<", "/", "code", ">", "<code", ">", "defaultValue<", "/", "code", ">", "if", "no", "such", "property", "exists", ".", ...
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java#L1148-L1151
dottydingo/hyperion
client/src/main/java/com/dottydingo/hyperion/client/builder/query/QueryBuilder.java
QueryBuilder.lt
public QueryExpression lt(String propertyName,String value) { return new SimpleQueryExpression(propertyName, ComparisonOperator.LESS_THAN,wrap(value)); }
java
public QueryExpression lt(String propertyName,String value) { return new SimpleQueryExpression(propertyName, ComparisonOperator.LESS_THAN,wrap(value)); }
[ "public", "QueryExpression", "lt", "(", "String", "propertyName", ",", "String", "value", ")", "{", "return", "new", "SimpleQueryExpression", "(", "propertyName", ",", "ComparisonOperator", ".", "LESS_THAN", ",", "wrap", "(", "value", ")", ")", ";", "}" ]
Create a less than expression @param propertyName The propery name @param value The value @return The query expression
[ "Create", "a", "less", "than", "expression" ]
train
https://github.com/dottydingo/hyperion/blob/c4d119c90024a88c0335d7d318e9ccdb70149764/client/src/main/java/com/dottydingo/hyperion/client/builder/query/QueryBuilder.java#L213-L216
OpenLiberty/open-liberty
dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/Director.java
Director.uninstallFeatures
public void uninstallFeatures(Collection<String> featureNames, Collection<String> uninstallInstallFeatures) { getUninstallDirector().uninstallFeatures(featureNames, uninstallInstallFeatures, false); }
java
public void uninstallFeatures(Collection<String> featureNames, Collection<String> uninstallInstallFeatures) { getUninstallDirector().uninstallFeatures(featureNames, uninstallInstallFeatures, false); }
[ "public", "void", "uninstallFeatures", "(", "Collection", "<", "String", ">", "featureNames", ",", "Collection", "<", "String", ">", "uninstallInstallFeatures", ")", "{", "getUninstallDirector", "(", ")", ".", "uninstallFeatures", "(", "featureNames", ",", "uninstal...
Uninstalls features @param featureNames Collection of feature names to uninstall @param uninstallInstallFeatures
[ "Uninstalls", "features" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/Director.java#L1838-L1840
Grasia/phatsim
phat-core/src/main/java/phat/sensors/Sensor.java
Sensor.cloneControl
protected Control cloneControl(Control control, Spatial spatial) { if (control instanceof Sensor) { Sensor sensor = (Sensor) control; sensor.setId(id); sensor.listeners.addAll(listeners); } return control; }
java
protected Control cloneControl(Control control, Spatial spatial) { if (control instanceof Sensor) { Sensor sensor = (Sensor) control; sensor.setId(id); sensor.listeners.addAll(listeners); } return control; }
[ "protected", "Control", "cloneControl", "(", "Control", "control", ",", "Spatial", "spatial", ")", "{", "if", "(", "control", "instanceof", "Sensor", ")", "{", "Sensor", "sensor", "=", "(", "Sensor", ")", "control", ";", "sensor", ".", "setId", "(", "id", ...
/*protected void notifyListeners(SensorData sourceData) { for (SensorListener sl : listeners) { sl.update(this, sourceData); } }
[ "/", "*", "protected", "void", "notifyListeners", "(", "SensorData", "sourceData", ")", "{", "for", "(", "SensorListener", "sl", ":", "listeners", ")", "{", "sl", ".", "update", "(", "this", "sourceData", ")", ";", "}", "}" ]
train
https://github.com/Grasia/phatsim/blob/2d4fc8189be9730b34c8e3e1a08fb4800e01c5df/phat-core/src/main/java/phat/sensors/Sensor.java#L111-L119
code4everything/util
src/main/java/com/zhazhapan/util/NetUtils.java
NetUtils.getCookie
public static Cookie getCookie(String name, HttpServletRequest request) { return getCookie(name, request.getCookies()); }
java
public static Cookie getCookie(String name, HttpServletRequest request) { return getCookie(name, request.getCookies()); }
[ "public", "static", "Cookie", "getCookie", "(", "String", "name", ",", "HttpServletRequest", "request", ")", "{", "return", "getCookie", "(", "name", ",", "request", ".", "getCookies", "(", ")", ")", ";", "}" ]
通过名称获取Cookie @param name Cookie名 @param request {@link HttpServletRequest} @return {@link Cookie} @since 1.0.8
[ "通过名称获取Cookie" ]
train
https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/NetUtils.java#L629-L631
enioka/jqm
jqm-all/jqm-engine/src/main/java/com/enioka/jqm/tools/JqmEngine.java
JqmEngine.purgeDeadJobInstances
private void purgeDeadJobInstances(DbConn cnx, Node node) { for (JobInstance ji : JobInstance.select(cnx, "ji_select_by_node", node.getId())) { try { cnx.runSelectSingle("history_select_state_by_id", String.class, ji.getId()); } catch (NoResultException e) { History.create(cnx, ji, State.CRASHED, Calendar.getInstance()); Message.create(cnx, "Job was supposed to be running at server startup - usually means it was killed along a server by an admin or a crash", ji.getId()); } cnx.runUpdate("ji_delete_by_id", ji.getId()); } cnx.commit(); }
java
private void purgeDeadJobInstances(DbConn cnx, Node node) { for (JobInstance ji : JobInstance.select(cnx, "ji_select_by_node", node.getId())) { try { cnx.runSelectSingle("history_select_state_by_id", String.class, ji.getId()); } catch (NoResultException e) { History.create(cnx, ji, State.CRASHED, Calendar.getInstance()); Message.create(cnx, "Job was supposed to be running at server startup - usually means it was killed along a server by an admin or a crash", ji.getId()); } cnx.runUpdate("ji_delete_by_id", ji.getId()); } cnx.commit(); }
[ "private", "void", "purgeDeadJobInstances", "(", "DbConn", "cnx", ",", "Node", "node", ")", "{", "for", "(", "JobInstance", "ji", ":", "JobInstance", ".", "select", "(", "cnx", ",", "\"ji_select_by_node\"", ",", "node", ".", "getId", "(", ")", ")", ")", ...
To be called at node startup - it purges all job instances associated to this node. @param cnx @param node
[ "To", "be", "called", "at", "node", "startup", "-", "it", "purges", "all", "job", "instances", "associated", "to", "this", "node", "." ]
train
https://github.com/enioka/jqm/blob/391733b8e291404b97c714c3727a241c4a861f98/jqm-all/jqm-engine/src/main/java/com/enioka/jqm/tools/JqmEngine.java#L492-L511
VueGWT/vue-gwt
core/src/main/java/com/axellience/vuegwt/core/client/component/options/VueComponentOptions.java
VueComponentOptions.initData
@JsOverlay public final void initData(boolean useFactory, Set<String> fieldNames) { JsPropertyMap<Object> dataFields = JsPropertyMap.of(); dataFieldsToProxy = new HashSet<>(); for (String fieldName : fieldNames) { dataFields.set(fieldName, null); // If field name starts with $ or _ Vue.js won't proxify it so we must do it if (fieldName.startsWith("$") || fieldName.startsWith("_")) { dataFieldsToProxy.add(fieldName); } } if (useFactory) { String dataFieldsJSON = JSON.stringify(dataFields); this.setData((DataFactory) () -> JSON.parse(dataFieldsJSON)); } else { this.setData((DataFactory) () -> dataFields); } }
java
@JsOverlay public final void initData(boolean useFactory, Set<String> fieldNames) { JsPropertyMap<Object> dataFields = JsPropertyMap.of(); dataFieldsToProxy = new HashSet<>(); for (String fieldName : fieldNames) { dataFields.set(fieldName, null); // If field name starts with $ or _ Vue.js won't proxify it so we must do it if (fieldName.startsWith("$") || fieldName.startsWith("_")) { dataFieldsToProxy.add(fieldName); } } if (useFactory) { String dataFieldsJSON = JSON.stringify(dataFields); this.setData((DataFactory) () -> JSON.parse(dataFieldsJSON)); } else { this.setData((DataFactory) () -> dataFields); } }
[ "@", "JsOverlay", "public", "final", "void", "initData", "(", "boolean", "useFactory", ",", "Set", "<", "String", ">", "fieldNames", ")", "{", "JsPropertyMap", "<", "Object", ">", "dataFields", "=", "JsPropertyMap", ".", "of", "(", ")", ";", "dataFieldsToPro...
Initialise the data structure, then set it to either a Factory or directly on the Component. @param useFactory Boolean representing whether or not to use a Factory. @param fieldNames Name of the data fields in the object
[ "Initialise", "the", "data", "structure", "then", "set", "it", "to", "either", "a", "Factory", "or", "directly", "on", "the", "Component", "." ]
train
https://github.com/VueGWT/vue-gwt/blob/961cd83aed6fe8e2dd80c279847f1b3f62918a1f/core/src/main/java/com/axellience/vuegwt/core/client/component/options/VueComponentOptions.java#L81-L100
strator-dev/greenpepper
greenpepper/greenpepper-client/src/main/java/com/greenpepper/server/domain/Repository.java
Repository.addRequirement
public void addRequirement(Requirement requirement) throws GreenPepperServerException { if(requirements.contains(requirement) || requirementNameExists(requirement.getName())) throw new GreenPepperServerException( GreenPepperServerErrorKey.REQUIREMENT_ALREADY_EXISTS, "Requirement already exists"); requirement.setRepository(this); requirements.add(requirement); }
java
public void addRequirement(Requirement requirement) throws GreenPepperServerException { if(requirements.contains(requirement) || requirementNameExists(requirement.getName())) throw new GreenPepperServerException( GreenPepperServerErrorKey.REQUIREMENT_ALREADY_EXISTS, "Requirement already exists"); requirement.setRepository(this); requirements.add(requirement); }
[ "public", "void", "addRequirement", "(", "Requirement", "requirement", ")", "throws", "GreenPepperServerException", "{", "if", "(", "requirements", ".", "contains", "(", "requirement", ")", "||", "requirementNameExists", "(", "requirement", ".", "getName", "(", ")",...
<p>addRequirement.</p> @param requirement a {@link com.greenpepper.server.domain.Requirement} object. @throws com.greenpepper.server.GreenPepperServerException if any.
[ "<p", ">", "addRequirement", ".", "<", "/", "p", ">" ]
train
https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper/greenpepper-client/src/main/java/com/greenpepper/server/domain/Repository.java#L348-L355
attribyte/wpdb
src/main/java/org/attribyte/wp/db/DB.java
DB.clearPostTerm
public void clearPostTerm(final long postId, final long taxonomyTermId) throws SQLException { Connection conn = null; PreparedStatement stmt = null; Timer.Context ctx = metrics.postTermsClearTimer.time(); try { conn = connectionSupplier.getConnection(); stmt = conn.prepareStatement(clearPostTermSQL); stmt.setLong(1, postId); stmt.setLong(2, taxonomyTermId); stmt.executeUpdate(); } finally { ctx.stop(); SQLUtil.closeQuietly(conn, stmt); } }
java
public void clearPostTerm(final long postId, final long taxonomyTermId) throws SQLException { Connection conn = null; PreparedStatement stmt = null; Timer.Context ctx = metrics.postTermsClearTimer.time(); try { conn = connectionSupplier.getConnection(); stmt = conn.prepareStatement(clearPostTermSQL); stmt.setLong(1, postId); stmt.setLong(2, taxonomyTermId); stmt.executeUpdate(); } finally { ctx.stop(); SQLUtil.closeQuietly(conn, stmt); } }
[ "public", "void", "clearPostTerm", "(", "final", "long", "postId", ",", "final", "long", "taxonomyTermId", ")", "throws", "SQLException", "{", "Connection", "conn", "=", "null", ";", "PreparedStatement", "stmt", "=", "null", ";", "Timer", ".", "Context", "ctx"...
Clears a single taxonomy term associated with a post. @param postId The post id. @param taxonomyTermId The taxonomy term id. @throws SQLException on database error.
[ "Clears", "a", "single", "taxonomy", "term", "associated", "with", "a", "post", "." ]
train
https://github.com/attribyte/wpdb/blob/b9adf6131dfb67899ebff770c9bfeb001cc42f30/src/main/java/org/attribyte/wp/db/DB.java#L2468-L2482
mp911de/spinach
src/main/java/biz/paluch/spinach/cluster/QueueListener.java
QueueListener.call
@Override public void call(Subscriber<? super Job<K, V>> subscriber) { log.debug("onSubscribe()"); if (subscriber.isUnsubscribed()) { return; } String subscriberId = getClass().getSimpleName() + "-" + id + "-" + subscriberIds.incrementAndGet(); subscriber.onStart(); try { Scheduler.Worker worker = scheduler.createWorker(); GetJobsAction<K, V> getJobsAction = new GetJobsAction<K, V>(disqueConnectionSupplier, subscriberId, subscriber, jobLocalityTracking, getJobsArgs); actions.add(getJobsAction); Subscription subscription = worker.schedulePeriodically(getJobsAction, 0, 10, TimeUnit.MILLISECONDS); getJobsAction.setSelfSubscription(subscription); if (improveLocalityTimeUnit != null && improveLocalityInterval > 0 && reconnectTrigger == null) { reconnectTrigger = worker.schedulePeriodically(new Action0() { @Override public void call() { switchNodes(); } }, improveLocalityInterval, improveLocalityInterval, improveLocalityTimeUnit); } } catch (Exception e) { if (log.isDebugEnabled()) { log.debug("QueueListener.call caught an exception: {}", e.getMessage(), e); } subscriber.onError(e); } }
java
@Override public void call(Subscriber<? super Job<K, V>> subscriber) { log.debug("onSubscribe()"); if (subscriber.isUnsubscribed()) { return; } String subscriberId = getClass().getSimpleName() + "-" + id + "-" + subscriberIds.incrementAndGet(); subscriber.onStart(); try { Scheduler.Worker worker = scheduler.createWorker(); GetJobsAction<K, V> getJobsAction = new GetJobsAction<K, V>(disqueConnectionSupplier, subscriberId, subscriber, jobLocalityTracking, getJobsArgs); actions.add(getJobsAction); Subscription subscription = worker.schedulePeriodically(getJobsAction, 0, 10, TimeUnit.MILLISECONDS); getJobsAction.setSelfSubscription(subscription); if (improveLocalityTimeUnit != null && improveLocalityInterval > 0 && reconnectTrigger == null) { reconnectTrigger = worker.schedulePeriodically(new Action0() { @Override public void call() { switchNodes(); } }, improveLocalityInterval, improveLocalityInterval, improveLocalityTimeUnit); } } catch (Exception e) { if (log.isDebugEnabled()) { log.debug("QueueListener.call caught an exception: {}", e.getMessage(), e); } subscriber.onError(e); } }
[ "@", "Override", "public", "void", "call", "(", "Subscriber", "<", "?", "super", "Job", "<", "K", ",", "V", ">", ">", "subscriber", ")", "{", "log", ".", "debug", "(", "\"onSubscribe()\"", ")", ";", "if", "(", "subscriber", ".", "isUnsubscribed", "(", ...
Setup subscriptions when the Observable subscription is set up. @param subscriber the subscriber
[ "Setup", "subscriptions", "when", "the", "Observable", "subscription", "is", "set", "up", "." ]
train
https://github.com/mp911de/spinach/blob/ca8081f52de17c46dce6ffdcb519eec600c5c93d/src/main/java/biz/paluch/spinach/cluster/QueueListener.java#L79-L114
UrielCh/ovh-java-sdk
ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java
ApiOvhEmaildomain.domain_acl_POST
public OvhAcl domain_acl_POST(String domain, String accountId) throws IOException { String qPath = "/email/domain/{domain}/acl"; StringBuilder sb = path(qPath, domain); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "accountId", accountId); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhAcl.class); }
java
public OvhAcl domain_acl_POST(String domain, String accountId) throws IOException { String qPath = "/email/domain/{domain}/acl"; StringBuilder sb = path(qPath, domain); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "accountId", accountId); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhAcl.class); }
[ "public", "OvhAcl", "domain_acl_POST", "(", "String", "domain", ",", "String", "accountId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/email/domain/{domain}/acl\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "domain", ")", ";...
Create new ACL REST: POST /email/domain/{domain}/acl @param accountId [required] Deleguates rights to @param domain [required] Name of your domain name
[ "Create", "new", "ACL" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java#L1292-L1299
Azure/azure-sdk-for-java
edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/DevicesInner.java
DevicesInner.update
public DataBoxEdgeDeviceInner update(String deviceName, String resourceGroupName, Map<String, String> tags) { return updateWithServiceResponseAsync(deviceName, resourceGroupName, tags).toBlocking().single().body(); }
java
public DataBoxEdgeDeviceInner update(String deviceName, String resourceGroupName, Map<String, String> tags) { return updateWithServiceResponseAsync(deviceName, resourceGroupName, tags).toBlocking().single().body(); }
[ "public", "DataBoxEdgeDeviceInner", "update", "(", "String", "deviceName", ",", "String", "resourceGroupName", ",", "Map", "<", "String", ",", "String", ">", "tags", ")", "{", "return", "updateWithServiceResponseAsync", "(", "deviceName", ",", "resourceGroupName", "...
Modifies a Data Box Edge/Gateway resource. @param deviceName The device name. @param resourceGroupName The resource group name. @param tags The tags attached to the Data Box Edge/Gateway resource. @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 DataBoxEdgeDeviceInner object if successful.
[ "Modifies", "a", "Data", "Box", "Edge", "/", "Gateway", "resource", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/DevicesInner.java#L1111-L1113
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/shapes/polygon/DetectPolygonBinaryGrayRefine.java
DetectPolygonBinaryGrayRefine.process
public void process(T gray , GrayU8 binary ) { detector.process(gray,binary); if( refineGray != null ) refineGray.setImage(gray); edgeIntensity.setImage(gray); long time0 = System.nanoTime(); FastQueue<DetectPolygonFromContour.Info> detections = detector.getFound(); if( adjustForBias != null ) { int minSides = getMinimumSides(); for (int i = detections.size()-1; i >= 0; i-- ) { Polygon2D_F64 p = detections.get(i).polygon; adjustForBias.process(p, detector.isOutputClockwise()); // When the polygon is adjusted for bias a point might need to be removed because it's // almost parallel. This could cause the shape to have too few corners and needs to be removed. if( p.size() < minSides) detections.remove(i); } } long time1 = System.nanoTime(); double milli = (time1-time0)*1e-6; milliAdjustBias.update(milli); // System.out.printf(" contour %7.2f shapes %7.2f adjust_bias %7.2f\n", // detector.getMilliShapes(),detector.getMilliShapes(),milliAdjustBias); }
java
public void process(T gray , GrayU8 binary ) { detector.process(gray,binary); if( refineGray != null ) refineGray.setImage(gray); edgeIntensity.setImage(gray); long time0 = System.nanoTime(); FastQueue<DetectPolygonFromContour.Info> detections = detector.getFound(); if( adjustForBias != null ) { int minSides = getMinimumSides(); for (int i = detections.size()-1; i >= 0; i-- ) { Polygon2D_F64 p = detections.get(i).polygon; adjustForBias.process(p, detector.isOutputClockwise()); // When the polygon is adjusted for bias a point might need to be removed because it's // almost parallel. This could cause the shape to have too few corners and needs to be removed. if( p.size() < minSides) detections.remove(i); } } long time1 = System.nanoTime(); double milli = (time1-time0)*1e-6; milliAdjustBias.update(milli); // System.out.printf(" contour %7.2f shapes %7.2f adjust_bias %7.2f\n", // detector.getMilliShapes(),detector.getMilliShapes(),milliAdjustBias); }
[ "public", "void", "process", "(", "T", "gray", ",", "GrayU8", "binary", ")", "{", "detector", ".", "process", "(", "gray", ",", "binary", ")", ";", "if", "(", "refineGray", "!=", "null", ")", "refineGray", ".", "setImage", "(", "gray", ")", ";", "edg...
Detects polygons inside the grayscale image and its thresholded version @param gray Gray scale image @param binary Binary version of grayscale image
[ "Detects", "polygons", "inside", "the", "grayscale", "image", "and", "its", "thresholded", "version" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/shapes/polygon/DetectPolygonBinaryGrayRefine.java#L149-L177
loldevs/riotapi
rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java
ThrottledApiHandler.getItem
public Future<Item> getItem(int id, ItemData data) { return new DummyFuture<>(handler.getItem(id, data)); }
java
public Future<Item> getItem(int id, ItemData data) { return new DummyFuture<>(handler.getItem(id, data)); }
[ "public", "Future", "<", "Item", ">", "getItem", "(", "int", "id", ",", "ItemData", "data", ")", "{", "return", "new", "DummyFuture", "<>", "(", "handler", ".", "getItem", "(", "id", ",", "data", ")", ")", ";", "}" ]
<p> Retrieve a specific item </p> This method does not count towards the rate limit and is not affected by the throttle @param id The id of the item @param data Additional information to retrieve @return The item @see <a href=https://developer.riotgames.com/api/methods#!/649/2176>Official API documentation</a>
[ "<p", ">", "Retrieve", "a", "specific", "item", "<", "/", "p", ">", "This", "method", "does", "not", "count", "towards", "the", "rate", "limit", "and", "is", "not", "affected", "by", "the", "throttle" ]
train
https://github.com/loldevs/riotapi/blob/0b8aac407aa5289845f249024f9732332855544f/rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java#L506-L508
pressgang-ccms/PressGangCCMSContentSpec
src/main/java/org/jboss/pressgang/ccms/contentspec/utils/CSTransformer.java
CSTransformer.transformSpecTopic
protected static SpecTopic transformSpecTopic(final CSNodeWrapper node, final Map<Integer, Node> nodes, final Map<String, SpecTopic> targetTopics, final List<CSNodeWrapper> relationshipFromNodes) { if (node.getNodeType() != CommonConstants.CS_NODE_TOPIC) { throw new IllegalArgumentException("The passed node is not a Spec Topic"); } return transformSpecTopicWithoutTypeCheck(node, nodes, targetTopics, relationshipFromNodes); }
java
protected static SpecTopic transformSpecTopic(final CSNodeWrapper node, final Map<Integer, Node> nodes, final Map<String, SpecTopic> targetTopics, final List<CSNodeWrapper> relationshipFromNodes) { if (node.getNodeType() != CommonConstants.CS_NODE_TOPIC) { throw new IllegalArgumentException("The passed node is not a Spec Topic"); } return transformSpecTopicWithoutTypeCheck(node, nodes, targetTopics, relationshipFromNodes); }
[ "protected", "static", "SpecTopic", "transformSpecTopic", "(", "final", "CSNodeWrapper", "node", ",", "final", "Map", "<", "Integer", ",", "Node", ">", "nodes", ",", "final", "Map", "<", "String", ",", "SpecTopic", ">", "targetTopics", ",", "final", "List", ...
Transform a Topic CSNode entity object into a SpecTopic Object that can be added to a Content Specification. @param node The CSNode entity object to be transformed. @param nodes A mapping of node entity ids to their transformed counterparts. @param targetTopics A mapping of target ids to SpecTopics. @param relationshipFromNodes A list of CSNode entities that have relationships. @return The transformed SpecTopic entity.
[ "Transform", "a", "Topic", "CSNode", "entity", "object", "into", "a", "SpecTopic", "Object", "that", "can", "be", "added", "to", "a", "Content", "Specification", "." ]
train
https://github.com/pressgang-ccms/PressGangCCMSContentSpec/blob/2bc02e2971e4522b47a130fb7ae5a0f5ad377df1/src/main/java/org/jboss/pressgang/ccms/contentspec/utils/CSTransformer.java#L464-L471
beanshell/beanshell
src/main/java/bsh/NameSpace.java
NameSpace.get
public Object get(final String name, final Interpreter interpreter) throws UtilEvalError { final CallStack callstack = new CallStack(this); return this.getNameResolver(name).toObject(callstack, interpreter); }
java
public Object get(final String name, final Interpreter interpreter) throws UtilEvalError { final CallStack callstack = new CallStack(this); return this.getNameResolver(name).toObject(callstack, interpreter); }
[ "public", "Object", "get", "(", "final", "String", "name", ",", "final", "Interpreter", "interpreter", ")", "throws", "UtilEvalError", "{", "final", "CallStack", "callstack", "=", "new", "CallStack", "(", "this", ")", ";", "return", "this", ".", "getNameResolv...
Resolve name to an object through this namespace. @param name the name @param interpreter the interpreter @return the object @throws UtilEvalError the util eval error
[ "Resolve", "name", "to", "an", "object", "through", "this", "namespace", "." ]
train
https://github.com/beanshell/beanshell/blob/fdddee3de948c9e6babb2d1337028f6fd0a2ba5c/src/main/java/bsh/NameSpace.java#L218-L222
netty/netty
codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java
HttpHeaders.removeHeader
@Deprecated public static void removeHeader(HttpMessage message, CharSequence name) { message.headers().remove(name); }
java
@Deprecated public static void removeHeader(HttpMessage message, CharSequence name) { message.headers().remove(name); }
[ "@", "Deprecated", "public", "static", "void", "removeHeader", "(", "HttpMessage", "message", ",", "CharSequence", "name", ")", "{", "message", ".", "headers", "(", ")", ".", "remove", "(", "name", ")", ";", "}" ]
@deprecated Use {@link #remove(CharSequence)} instead. Removes the header with the specified name.
[ "@deprecated", "Use", "{", "@link", "#remove", "(", "CharSequence", ")", "}", "instead", "." ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java#L689-L692
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/regex/Matcher.java
Matcher.appendEvaluated
private void appendEvaluated(StringBuffer buffer, String s) { boolean escape = false; boolean dollar = false; for (int i = 0; i < s.length(); i++) { char c = s.charAt(i); if (c == '\\' && !escape) { escape = true; } else if (c == '$' && !escape) { dollar = true; } else if (c >= '0' && c <= '9' && dollar) { buffer.append(group(c - '0')); dollar = false; } else { buffer.append(c); dollar = false; escape = false; } } if (escape) { throw new ArrayIndexOutOfBoundsException(s.length()); } }
java
private void appendEvaluated(StringBuffer buffer, String s) { boolean escape = false; boolean dollar = false; for (int i = 0; i < s.length(); i++) { char c = s.charAt(i); if (c == '\\' && !escape) { escape = true; } else if (c == '$' && !escape) { dollar = true; } else if (c >= '0' && c <= '9' && dollar) { buffer.append(group(c - '0')); dollar = false; } else { buffer.append(c); dollar = false; escape = false; } } if (escape) { throw new ArrayIndexOutOfBoundsException(s.length()); } }
[ "private", "void", "appendEvaluated", "(", "StringBuffer", "buffer", ",", "String", "s", ")", "{", "boolean", "escape", "=", "false", ";", "boolean", "dollar", "=", "false", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "s", ".", "length", "(...
Internal helper method to append a given string to a given string buffer. If the string contains any references to groups, these are replaced by the corresponding group's contents. @param buffer the string buffer. @param s the string to append.
[ "Internal", "helper", "method", "to", "append", "a", "given", "string", "to", "a", "given", "string", "buffer", ".", "If", "the", "string", "contains", "any", "references", "to", "groups", "these", "are", "replaced", "by", "the", "corresponding", "group", "s...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/regex/Matcher.java#L631-L654
liferay/com-liferay-commerce
commerce-product-api/src/main/java/com/liferay/commerce/product/service/persistence/CPMeasurementUnitUtil.java
CPMeasurementUnitUtil.removeByUUID_G
public static CPMeasurementUnit removeByUUID_G(String uuid, long groupId) throws com.liferay.commerce.product.exception.NoSuchCPMeasurementUnitException { return getPersistence().removeByUUID_G(uuid, groupId); }
java
public static CPMeasurementUnit removeByUUID_G(String uuid, long groupId) throws com.liferay.commerce.product.exception.NoSuchCPMeasurementUnitException { return getPersistence().removeByUUID_G(uuid, groupId); }
[ "public", "static", "CPMeasurementUnit", "removeByUUID_G", "(", "String", "uuid", ",", "long", "groupId", ")", "throws", "com", ".", "liferay", ".", "commerce", ".", "product", ".", "exception", ".", "NoSuchCPMeasurementUnitException", "{", "return", "getPersistence...
Removes the cp measurement unit where uuid = &#63; and groupId = &#63; from the database. @param uuid the uuid @param groupId the group ID @return the cp measurement unit that was removed
[ "Removes", "the", "cp", "measurement", "unit", "where", "uuid", "=", "&#63", ";", "and", "groupId", "=", "&#63", ";", "from", "the", "database", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-api/src/main/java/com/liferay/commerce/product/service/persistence/CPMeasurementUnitUtil.java#L315-L318
lukas-krecan/JsonUnit
json-unit/src/main/java/net/javacrumbs/jsonunit/JsonAssert.java
JsonAssert.assertJsonPartEquals
public static void assertJsonPartEquals(Object expected, Object fullJson, String path) { assertJsonPartEquals(expected, fullJson, path, configuration); }
java
public static void assertJsonPartEquals(Object expected, Object fullJson, String path) { assertJsonPartEquals(expected, fullJson, path, configuration); }
[ "public", "static", "void", "assertJsonPartEquals", "(", "Object", "expected", ",", "Object", "fullJson", ",", "String", "path", ")", "{", "assertJsonPartEquals", "(", "expected", ",", "fullJson", ",", "path", ",", "configuration", ")", ";", "}" ]
Compares part of the JSON. Path has this format "root.array[0].value".
[ "Compares", "part", "of", "the", "JSON", ".", "Path", "has", "this", "format", "root", ".", "array", "[", "0", "]", ".", "value", "." ]
train
https://github.com/lukas-krecan/JsonUnit/blob/2b12ed792e8dd787bddd6f3b8eb2325737435791/json-unit/src/main/java/net/javacrumbs/jsonunit/JsonAssert.java#L73-L75
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/asynchronous/GVRCompressedTextureLoader.java
GVRCompressedTextureLoader.CompressedTexture
protected CompressedTexture CompressedTexture(int internalformat, int width, int height, int imageSize, int levels, byte[] data, int dataOffset, int dataBytes) { ByteBuffer buffer = ByteBuffer.wrap(data, dataOffset, dataBytes); return new CompressedTexture(internalformat, width, height, imageSize, levels, buffer); }
java
protected CompressedTexture CompressedTexture(int internalformat, int width, int height, int imageSize, int levels, byte[] data, int dataOffset, int dataBytes) { ByteBuffer buffer = ByteBuffer.wrap(data, dataOffset, dataBytes); return new CompressedTexture(internalformat, width, height, imageSize, levels, buffer); }
[ "protected", "CompressedTexture", "CompressedTexture", "(", "int", "internalformat", ",", "int", "width", ",", "int", "height", ",", "int", "imageSize", ",", "int", "levels", ",", "byte", "[", "]", "data", ",", "int", "dataOffset", ",", "int", "dataBytes", "...
Provides external parsers access to the internal {@code CompressedImage} constructor. The {@code CompressedImage} class represents a texture file, loaded into memory; it's what your {@link #parse(byte[], Reader)} method needs to return. <p> The first four parameters are passed directly to {@code glCompressedTexImage2D}; the names are from <a href= "https://www.khronos.org/opengles/sdk/docs/man/xhtml/glCompressedTexImage2D.xml" >https://www.khronos.org/opengles/sdk/docs/man/xhtml/ glCompressedTexImage2D.xml</a> @param internalformat The {@link GLES20#glCompressedTexImage2D(int, int, int, int, int, int, int, java.nio.Buffer) glCompressedTexImage2D()} <code>internalformat</code> parameter. @param width The {@link GLES20#glCompressedTexImage2D(int, int, int, int, int, int, int, java.nio.Buffer) glCompressedTexImage2D()} <code>width</code> parameter. @param height The {@link GLES20#glCompressedTexImage2D(int, int, int, int, int, int, int, java.nio.Buffer) glCompressedTexImage2D()} <code>height</code> parameter. @param imageSize The {@link GLES20#glCompressedTexImage2D(int, int, int, int, int, int, int, java.nio.Buffer) glCompressedTexImage2D()} <code>imageSize</code> parameter. @param levels The number of mipmap levels @param data The {@code byte[]} passed to {@link #parse(byte[], Reader)} @param dataOffset Header length - offset of first byte of texture data @param dataBytes Number of bytes of texture data @return An internal buffer that the GL thread can use to create a {@link GVRCompressedImage}
[ "Provides", "external", "parsers", "access", "to", "the", "internal", "{", "@code", "CompressedImage", "}", "constructor", "." ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/asynchronous/GVRCompressedTextureLoader.java#L161-L167
scalecube/scalecube-services
services/src/main/java/io/scalecube/services/metrics/Metrics.java
Metrics.mark
public static void mark(Metrics metrics, String component, String methodName, String eventType) { if (metrics != null) { mark(metrics.getMeter(component, methodName, eventType)); } }
java
public static void mark(Metrics metrics, String component, String methodName, String eventType) { if (metrics != null) { mark(metrics.getMeter(component, methodName, eventType)); } }
[ "public", "static", "void", "mark", "(", "Metrics", "metrics", ",", "String", "component", ",", "String", "methodName", ",", "String", "eventType", ")", "{", "if", "(", "metrics", "!=", "null", ")", "{", "mark", "(", "metrics", ".", "getMeter", "(", "com...
Reports an event to <code>meter</code> described by given parameters. @param metrics - {@link Metrics} instance with {@link MetricRegistry} initialized. @param component - part of metric description. @param methodName - part of metric description. @param eventType - part of metric description.
[ "Reports", "an", "event", "to", "<code", ">", "meter<", "/", "code", ">", "described", "by", "given", "parameters", "." ]
train
https://github.com/scalecube/scalecube-services/blob/76c8de6019e5480a1436d12b37acf163f70eea47/services/src/main/java/io/scalecube/services/metrics/Metrics.java#L144-L148
CloudSlang/cs-actions
cs-powershell/src/main/java/io/cloudslang/content/services/WSManRemoteShellService.java
WSManRemoteShellService.setCommonHttpInputs
private static HttpClientInputs setCommonHttpInputs(HttpClientInputs httpClientInputs, URL url, WSManRequestInputs wsManRequestInputs) throws MalformedURLException { httpClientInputs.setUrl(url.toString()); httpClientInputs.setUsername(wsManRequestInputs.getUsername()); httpClientInputs.setPassword(wsManRequestInputs.getPassword()); httpClientInputs.setAuthType(wsManRequestInputs.getAuthType()); httpClientInputs.setKerberosConfFile(wsManRequestInputs.getKerberosConfFile()); httpClientInputs.setKerberosLoginConfFile(wsManRequestInputs.getKerberosLoginConfFile()); httpClientInputs.setKerberosSkipPortCheck(wsManRequestInputs.getKerberosSkipPortForLookup()); httpClientInputs.setTrustAllRoots(wsManRequestInputs.getTrustAllRoots()); httpClientInputs.setX509HostnameVerifier(wsManRequestInputs.getX509HostnameVerifier()); httpClientInputs.setProxyHost(wsManRequestInputs.getProxyHost()); httpClientInputs.setProxyPort(wsManRequestInputs.getProxyPort()); httpClientInputs.setProxyUsername(wsManRequestInputs.getProxyUsername()); httpClientInputs.setProxyPassword(wsManRequestInputs.getProxyPassword()); httpClientInputs.setKeystore(wsManRequestInputs.getKeystore()); httpClientInputs.setKeystorePassword(wsManRequestInputs.getKeystorePassword()); httpClientInputs.setTrustKeystore(wsManRequestInputs.getTrustKeystore()); httpClientInputs.setTrustPassword(wsManRequestInputs.getTrustPassword()); String headers = httpClientInputs.getHeaders(); if (StringUtils.isEmpty(headers)) { httpClientInputs.setHeaders(CONTENT_TYPE_HEADER); } else { httpClientInputs.setHeaders(headers + NEW_LINE_SEPARATOR + CONTENT_TYPE_HEADER); } httpClientInputs.setMethod(HttpPost.METHOD_NAME); return httpClientInputs; }
java
private static HttpClientInputs setCommonHttpInputs(HttpClientInputs httpClientInputs, URL url, WSManRequestInputs wsManRequestInputs) throws MalformedURLException { httpClientInputs.setUrl(url.toString()); httpClientInputs.setUsername(wsManRequestInputs.getUsername()); httpClientInputs.setPassword(wsManRequestInputs.getPassword()); httpClientInputs.setAuthType(wsManRequestInputs.getAuthType()); httpClientInputs.setKerberosConfFile(wsManRequestInputs.getKerberosConfFile()); httpClientInputs.setKerberosLoginConfFile(wsManRequestInputs.getKerberosLoginConfFile()); httpClientInputs.setKerberosSkipPortCheck(wsManRequestInputs.getKerberosSkipPortForLookup()); httpClientInputs.setTrustAllRoots(wsManRequestInputs.getTrustAllRoots()); httpClientInputs.setX509HostnameVerifier(wsManRequestInputs.getX509HostnameVerifier()); httpClientInputs.setProxyHost(wsManRequestInputs.getProxyHost()); httpClientInputs.setProxyPort(wsManRequestInputs.getProxyPort()); httpClientInputs.setProxyUsername(wsManRequestInputs.getProxyUsername()); httpClientInputs.setProxyPassword(wsManRequestInputs.getProxyPassword()); httpClientInputs.setKeystore(wsManRequestInputs.getKeystore()); httpClientInputs.setKeystorePassword(wsManRequestInputs.getKeystorePassword()); httpClientInputs.setTrustKeystore(wsManRequestInputs.getTrustKeystore()); httpClientInputs.setTrustPassword(wsManRequestInputs.getTrustPassword()); String headers = httpClientInputs.getHeaders(); if (StringUtils.isEmpty(headers)) { httpClientInputs.setHeaders(CONTENT_TYPE_HEADER); } else { httpClientInputs.setHeaders(headers + NEW_LINE_SEPARATOR + CONTENT_TYPE_HEADER); } httpClientInputs.setMethod(HttpPost.METHOD_NAME); return httpClientInputs; }
[ "private", "static", "HttpClientInputs", "setCommonHttpInputs", "(", "HttpClientInputs", "httpClientInputs", ",", "URL", "url", ",", "WSManRequestInputs", "wsManRequestInputs", ")", "throws", "MalformedURLException", "{", "httpClientInputs", ".", "setUrl", "(", "url", "."...
Configures the HttpClientInputs object with the most common http parameters. @param httpClientInputs @param url @param wsManRequestInputs @return the configured HttpClientInputs object. @throws MalformedURLException
[ "Configures", "the", "HttpClientInputs", "object", "with", "the", "most", "common", "http", "parameters", "." ]
train
https://github.com/CloudSlang/cs-actions/blob/9a1be1e99ad88286a6c153d5f2275df6ae1a57a1/cs-powershell/src/main/java/io/cloudslang/content/services/WSManRemoteShellService.java#L131-L157
square/okhttp
mockwebserver/src/main/java/okhttp3/mockwebserver/MockResponse.java
MockResponse.addHeader
public MockResponse addHeader(String name, Object value) { headers.add(name, String.valueOf(value)); return this; }
java
public MockResponse addHeader(String name, Object value) { headers.add(name, String.valueOf(value)); return this; }
[ "public", "MockResponse", "addHeader", "(", "String", "name", ",", "Object", "value", ")", "{", "headers", ".", "add", "(", "name", ",", "String", ".", "valueOf", "(", "value", ")", ")", ";", "return", "this", ";", "}" ]
Adds a new header with the name and value. This may be used to add multiple headers with the same name.
[ "Adds", "a", "new", "header", "with", "the", "name", "and", "value", ".", "This", "may", "be", "used", "to", "add", "multiple", "headers", "with", "the", "same", "name", "." ]
train
https://github.com/square/okhttp/blob/a8c65a822dd6cadd2de7d115bf94adf312e67868/mockwebserver/src/main/java/okhttp3/mockwebserver/MockResponse.java#L130-L133
graphql-java/graphql-java
src/main/java/graphql/schema/idl/SchemaTypeChecker.java
SchemaTypeChecker.checkNamedUniqueness
static <T, E extends GraphQLError> void checkNamedUniqueness(List<GraphQLError> errors, List<T> listOfNamedThings, Function<T, String> namer, BiFunction<String, T, E> errorFunction) { Set<String> names = new LinkedHashSet<>(); listOfNamedThings.forEach(thing -> { String name = namer.apply(thing); if (names.contains(name)) { errors.add(errorFunction.apply(name, thing)); } else { names.add(name); } }); }
java
static <T, E extends GraphQLError> void checkNamedUniqueness(List<GraphQLError> errors, List<T> listOfNamedThings, Function<T, String> namer, BiFunction<String, T, E> errorFunction) { Set<String> names = new LinkedHashSet<>(); listOfNamedThings.forEach(thing -> { String name = namer.apply(thing); if (names.contains(name)) { errors.add(errorFunction.apply(name, thing)); } else { names.add(name); } }); }
[ "static", "<", "T", ",", "E", "extends", "GraphQLError", ">", "void", "checkNamedUniqueness", "(", "List", "<", "GraphQLError", ">", "errors", ",", "List", "<", "T", ">", "listOfNamedThings", ",", "Function", "<", "T", ",", "String", ">", "namer", ",", "...
A simple function that takes a list of things, asks for their names and checks that the names are unique within that list. If not it calls the error handler function @param errors the error list @param listOfNamedThings the list of named things @param namer the function naming a thing @param errorFunction the function producing an error
[ "A", "simple", "function", "that", "takes", "a", "list", "of", "things", "asks", "for", "their", "names", "and", "checks", "that", "the", "names", "are", "unique", "within", "that", "list", ".", "If", "not", "it", "calls", "the", "error", "handler", "fun...
train
https://github.com/graphql-java/graphql-java/blob/9214b6044317849388bd88a14b54fc1c18c9f29f/src/main/java/graphql/schema/idl/SchemaTypeChecker.java#L375-L385
ironjacamar/ironjacamar
core/src/main/java/org/ironjacamar/core/tracer/Tracer.java
Tracer.getConnectionListener
public static synchronized void getConnectionListener(String poolName, Object mcp, Object cl, boolean pooled, boolean interleaving, Throwable callstack) { if (!interleaving) { if (pooled) { log.tracef("%s", new TraceEvent(poolName, Integer.toHexString(System.identityHashCode(mcp)), TraceEvent.GET_CONNECTION_LISTENER, Integer.toHexString(System.identityHashCode(cl)), !confidential && callstack != null ? toString(callstack) : "")); } else { log.tracef("%s", new TraceEvent(poolName, Integer.toHexString(System.identityHashCode(mcp)), TraceEvent.GET_CONNECTION_LISTENER_NEW, Integer.toHexString(System.identityHashCode(cl)), !confidential && callstack != null ? toString(callstack) : "")); } } else { if (pooled) { log.tracef("%s", new TraceEvent(poolName, Integer.toHexString(System.identityHashCode(mcp)), TraceEvent.GET_INTERLEAVING_CONNECTION_LISTENER, Integer.toHexString(System.identityHashCode(cl)), !confidential && callstack != null ? toString(callstack) : "")); } else { log.tracef("%s", new TraceEvent(poolName, Integer.toHexString(System.identityHashCode(mcp)), TraceEvent.GET_INTERLEAVING_CONNECTION_LISTENER_NEW, Integer.toHexString(System.identityHashCode(cl)), !confidential && callstack != null ? toString(callstack) : "")); } } }
java
public static synchronized void getConnectionListener(String poolName, Object mcp, Object cl, boolean pooled, boolean interleaving, Throwable callstack) { if (!interleaving) { if (pooled) { log.tracef("%s", new TraceEvent(poolName, Integer.toHexString(System.identityHashCode(mcp)), TraceEvent.GET_CONNECTION_LISTENER, Integer.toHexString(System.identityHashCode(cl)), !confidential && callstack != null ? toString(callstack) : "")); } else { log.tracef("%s", new TraceEvent(poolName, Integer.toHexString(System.identityHashCode(mcp)), TraceEvent.GET_CONNECTION_LISTENER_NEW, Integer.toHexString(System.identityHashCode(cl)), !confidential && callstack != null ? toString(callstack) : "")); } } else { if (pooled) { log.tracef("%s", new TraceEvent(poolName, Integer.toHexString(System.identityHashCode(mcp)), TraceEvent.GET_INTERLEAVING_CONNECTION_LISTENER, Integer.toHexString(System.identityHashCode(cl)), !confidential && callstack != null ? toString(callstack) : "")); } else { log.tracef("%s", new TraceEvent(poolName, Integer.toHexString(System.identityHashCode(mcp)), TraceEvent.GET_INTERLEAVING_CONNECTION_LISTENER_NEW, Integer.toHexString(System.identityHashCode(cl)), !confidential && callstack != null ? toString(callstack) : "")); } } }
[ "public", "static", "synchronized", "void", "getConnectionListener", "(", "String", "poolName", ",", "Object", "mcp", ",", "Object", "cl", ",", "boolean", "pooled", ",", "boolean", "interleaving", ",", "Throwable", "callstack", ")", "{", "if", "(", "!", "inter...
Get connection listener @param poolName The name of the pool @param mcp The managed connection pool @param cl The connection listener @param pooled Is the connection pooled @param interleaving Interleaving flag @param callstack The call stack
[ "Get", "connection", "listener" ]
train
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/core/src/main/java/org/ironjacamar/core/tracer/Tracer.java#L128-L169
jenkinsci/jenkins
core/src/main/java/hudson/model/Descriptor.java
Descriptor.addHelpFileRedirect
protected void addHelpFileRedirect(String fieldName, Class<? extends Describable> owner, String fieldNameToRedirectTo) { helpRedirect.put(fieldName, new HelpRedirect(owner,fieldNameToRedirectTo)); }
java
protected void addHelpFileRedirect(String fieldName, Class<? extends Describable> owner, String fieldNameToRedirectTo) { helpRedirect.put(fieldName, new HelpRedirect(owner,fieldNameToRedirectTo)); }
[ "protected", "void", "addHelpFileRedirect", "(", "String", "fieldName", ",", "Class", "<", "?", "extends", "Describable", ">", "owner", ",", "String", "fieldNameToRedirectTo", ")", "{", "helpRedirect", ".", "put", "(", "fieldName", ",", "new", "HelpRedirect", "(...
Tells Jenkins that the help file for the field 'fieldName' is defined in the help file for the 'fieldNameToRedirectTo' in the 'owner' class. @since 1.425
[ "Tells", "Jenkins", "that", "the", "help", "file", "for", "the", "field", "fieldName", "is", "defined", "in", "the", "help", "file", "for", "the", "fieldNameToRedirectTo", "in", "the", "owner", "class", "." ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/Descriptor.java#L770-L772
casbin/jcasbin
src/main/java/org/casbin/jcasbin/main/Enforcer.java
Enforcer.deletePermissionForUser
public boolean deletePermissionForUser(String user, List<String> permission) { return deletePermissionForUser(user, permission.toArray(new String[0])); }
java
public boolean deletePermissionForUser(String user, List<String> permission) { return deletePermissionForUser(user, permission.toArray(new String[0])); }
[ "public", "boolean", "deletePermissionForUser", "(", "String", "user", ",", "List", "<", "String", ">", "permission", ")", "{", "return", "deletePermissionForUser", "(", "user", ",", "permission", ".", "toArray", "(", "new", "String", "[", "0", "]", ")", ")"...
deletePermissionForUser deletes a permission for a user or role. Returns false if the user or role does not have the permission (aka not affected). @param user the user. @param permission the permission, usually be (obj, act). It is actually the rule without the subject. @return succeeds or not.
[ "deletePermissionForUser", "deletes", "a", "permission", "for", "a", "user", "or", "role", ".", "Returns", "false", "if", "the", "user", "or", "role", "does", "not", "have", "the", "permission", "(", "aka", "not", "affected", ")", "." ]
train
https://github.com/casbin/jcasbin/blob/b46d7a756b6c39cdb17e0600607e5fcdc66edd11/src/main/java/org/casbin/jcasbin/main/Enforcer.java#L297-L299
ag-gipp/MathMLTools
mathml-converters/src/main/java/com/formulasearchengine/mathmltools/converters/LaTeXMLConverter.java
LaTeXMLConverter.convertToString
public String convertToString(List<String> arguments, String latex) { NativeResponse response = parseToNativeResponse(arguments, latex); if (handleResponseCode(response, NAME, LOG) != 0) { return null; } LOG.info(NAME + " conversion successful."); return response.getResult(); }
java
public String convertToString(List<String> arguments, String latex) { NativeResponse response = parseToNativeResponse(arguments, latex); if (handleResponseCode(response, NAME, LOG) != 0) { return null; } LOG.info(NAME + " conversion successful."); return response.getResult(); }
[ "public", "String", "convertToString", "(", "List", "<", "String", ">", "arguments", ",", "String", "latex", ")", "{", "NativeResponse", "response", "=", "parseToNativeResponse", "(", "arguments", ",", "latex", ")", ";", "if", "(", "handleResponseCode", "(", "...
Parses latex to MathML string via LaTeXML (locally) @param arguments @param latex @return
[ "Parses", "latex", "to", "MathML", "string", "via", "LaTeXML", "(", "locally", ")" ]
train
https://github.com/ag-gipp/MathMLTools/blob/77c69b6366a5b8720796d1cd9d155ba26c2f1b20/mathml-converters/src/main/java/com/formulasearchengine/mathmltools/converters/LaTeXMLConverter.java#L161-L168
facebook/fresco
imagepipeline-base/src/main/java/com/facebook/imagepipeline/cache/CountingMemoryCache.java
CountingMemoryCache.maybeClose
private void maybeClose(@Nullable ArrayList<Entry<K, V>> oldEntries) { if (oldEntries != null) { for (Entry<K, V> oldEntry : oldEntries) { CloseableReference.closeSafely(referenceToClose(oldEntry)); } } }
java
private void maybeClose(@Nullable ArrayList<Entry<K, V>> oldEntries) { if (oldEntries != null) { for (Entry<K, V> oldEntry : oldEntries) { CloseableReference.closeSafely(referenceToClose(oldEntry)); } } }
[ "private", "void", "maybeClose", "(", "@", "Nullable", "ArrayList", "<", "Entry", "<", "K", ",", "V", ">", ">", "oldEntries", ")", "{", "if", "(", "oldEntries", "!=", "null", ")", "{", "for", "(", "Entry", "<", "K", ",", "V", ">", "oldEntry", ":", ...
Notifies the client that the cache no longer tracks the given items. <p> This method invokes the external {@link CloseableReference#close} method, so it must not be called while holding the <code>this</code> lock.
[ "Notifies", "the", "client", "that", "the", "cache", "no", "longer", "tracks", "the", "given", "items", "." ]
train
https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/imagepipeline-base/src/main/java/com/facebook/imagepipeline/cache/CountingMemoryCache.java#L431-L437
algorithmiaio/algorithmia-java
src/main/java/com/algorithmia/data/DataFile.java
DataFile.put
public void put(byte[] data) throws APIException { HttpResponse response = client.put(getUrl(), new ByteArrayEntity(data, ContentType.APPLICATION_OCTET_STREAM)); HttpClientHelpers.throwIfNotOk(response); }
java
public void put(byte[] data) throws APIException { HttpResponse response = client.put(getUrl(), new ByteArrayEntity(data, ContentType.APPLICATION_OCTET_STREAM)); HttpClientHelpers.throwIfNotOk(response); }
[ "public", "void", "put", "(", "byte", "[", "]", "data", ")", "throws", "APIException", "{", "HttpResponse", "response", "=", "client", ".", "put", "(", "getUrl", "(", ")", ",", "new", "ByteArrayEntity", "(", "data", ",", "ContentType", ".", "APPLICATION_OC...
Upload raw data to this file as binary @param data the data to upload @throws APIException if there were any problems communicating with the Algorithmia API
[ "Upload", "raw", "data", "to", "this", "file", "as", "binary" ]
train
https://github.com/algorithmiaio/algorithmia-java/blob/64bfdbd426e2d7f659be06d230523253e642a730/src/main/java/com/algorithmia/data/DataFile.java#L143-L146
cqframework/clinical_quality_language
Src/java/elm/src/main/java/org/cqframework/cql/elm/visiting/ElmBaseVisitor.java
ElmBaseVisitor.visitList
public T visitList(List elm, C context) { if (elm.getTypeSpecifier() != null) { visitElement(elm.getTypeSpecifier(), context); } for (Expression element : elm.getElement()) { visitElement(element, context); } return null; }
java
public T visitList(List elm, C context) { if (elm.getTypeSpecifier() != null) { visitElement(elm.getTypeSpecifier(), context); } for (Expression element : elm.getElement()) { visitElement(element, context); } return null; }
[ "public", "T", "visitList", "(", "List", "elm", ",", "C", "context", ")", "{", "if", "(", "elm", ".", "getTypeSpecifier", "(", ")", "!=", "null", ")", "{", "visitElement", "(", "elm", ".", "getTypeSpecifier", "(", ")", ",", "context", ")", ";", "}", ...
Visit a List. This method will be called for every node in the tree that is a List. @param elm the ELM tree @param context the context passed to the visitor @return the visitor result
[ "Visit", "a", "List", ".", "This", "method", "will", "be", "called", "for", "every", "node", "in", "the", "tree", "that", "is", "a", "List", "." ]
train
https://github.com/cqframework/clinical_quality_language/blob/67459d1ef453e49db8d7c5c86e87278377ed0a0b/Src/java/elm/src/main/java/org/cqframework/cql/elm/visiting/ElmBaseVisitor.java#L535-L543
Mozu/mozu-java
mozu-java-core/src/main/java/com/mozu/api/urls/commerce/orders/DigitalPackageUrl.java
DigitalPackageUrl.getAvailableDigitalPackageFulfillmentActionsUrl
public static MozuUrl getAvailableDigitalPackageFulfillmentActionsUrl(String digitalPackageId, String orderId) { UrlFormatter formatter = new UrlFormatter("/api/commerce/orders/{orderId}/digitalpackages/{digitalPackageId}/actions"); formatter.formatUrl("digitalPackageId", digitalPackageId); formatter.formatUrl("orderId", orderId); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
java
public static MozuUrl getAvailableDigitalPackageFulfillmentActionsUrl(String digitalPackageId, String orderId) { UrlFormatter formatter = new UrlFormatter("/api/commerce/orders/{orderId}/digitalpackages/{digitalPackageId}/actions"); formatter.formatUrl("digitalPackageId", digitalPackageId); formatter.formatUrl("orderId", orderId); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
[ "public", "static", "MozuUrl", "getAvailableDigitalPackageFulfillmentActionsUrl", "(", "String", "digitalPackageId", ",", "String", "orderId", ")", "{", "UrlFormatter", "formatter", "=", "new", "UrlFormatter", "(", "\"/api/commerce/orders/{orderId}/digitalpackages/{digitalPackage...
Get Resource Url for GetAvailableDigitalPackageFulfillmentActions @param digitalPackageId This parameter supplies package ID to get fulfillment actions for the digital package. @param orderId Unique identifier of the order. @return String Resource Url
[ "Get", "Resource", "Url", "for", "GetAvailableDigitalPackageFulfillmentActions" ]
train
https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/orders/DigitalPackageUrl.java#L22-L28
molgenis/molgenis
molgenis-data-import/src/main/java/org/molgenis/data/importer/MyEntitiesValidationReport.java
MyEntitiesValidationReport.addEntity
public MyEntitiesValidationReport addEntity(String entityTypeId, boolean importable) { sheetsImportable.put(entityTypeId, importable); valid = valid && importable; if (importable) { fieldsImportable.put(entityTypeId, new ArrayList<>()); fieldsUnknown.put(entityTypeId, new ArrayList<>()); fieldsRequired.put(entityTypeId, new ArrayList<>()); fieldsAvailable.put(entityTypeId, new ArrayList<>()); importOrder.add(entityTypeId); } return this; }
java
public MyEntitiesValidationReport addEntity(String entityTypeId, boolean importable) { sheetsImportable.put(entityTypeId, importable); valid = valid && importable; if (importable) { fieldsImportable.put(entityTypeId, new ArrayList<>()); fieldsUnknown.put(entityTypeId, new ArrayList<>()); fieldsRequired.put(entityTypeId, new ArrayList<>()); fieldsAvailable.put(entityTypeId, new ArrayList<>()); importOrder.add(entityTypeId); } return this; }
[ "public", "MyEntitiesValidationReport", "addEntity", "(", "String", "entityTypeId", ",", "boolean", "importable", ")", "{", "sheetsImportable", ".", "put", "(", "entityTypeId", ",", "importable", ")", ";", "valid", "=", "valid", "&&", "importable", ";", "if", "(...
Creates a new report, with an entity added to it. @param entityTypeId name of the entity @param importable true if the entity is importable @return this report
[ "Creates", "a", "new", "report", "with", "an", "entity", "added", "to", "it", "." ]
train
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-import/src/main/java/org/molgenis/data/importer/MyEntitiesValidationReport.java#L54-L65