repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
188
func_name
stringlengths
7
127
whole_func_string
stringlengths
77
3.91k
language
stringclasses
1 value
func_code_string
stringlengths
77
3.91k
func_code_tokens
listlengths
20
745
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
477
split_name
stringclasses
1 value
func_code_url
stringlengths
111
288
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java
ModelsImpl.createCustomPrebuiltEntityRole
public UUID createCustomPrebuiltEntityRole(UUID appId, String versionId, UUID entityId, CreateCustomPrebuiltEntityRoleOptionalParameter createCustomPrebuiltEntityRoleOptionalParameter) { return createCustomPrebuiltEntityRoleWithServiceResponseAsync(appId, versionId, entityId, createCustomPrebuiltEntityRoleOptionalParameter).toBlocking().single().body(); }
java
public UUID createCustomPrebuiltEntityRole(UUID appId, String versionId, UUID entityId, CreateCustomPrebuiltEntityRoleOptionalParameter createCustomPrebuiltEntityRoleOptionalParameter) { return createCustomPrebuiltEntityRoleWithServiceResponseAsync(appId, versionId, entityId, createCustomPrebuiltEntityRoleOptionalParameter).toBlocking().single().body(); }
[ "public", "UUID", "createCustomPrebuiltEntityRole", "(", "UUID", "appId", ",", "String", "versionId", ",", "UUID", "entityId", ",", "CreateCustomPrebuiltEntityRoleOptionalParameter", "createCustomPrebuiltEntityRoleOptionalParameter", ")", "{", "return", "createCustomPrebuiltEntit...
Create an entity role for an entity in the application. @param appId The application ID. @param versionId The version ID. @param entityId The entity model ID. @param createCustomPrebuiltEntityRoleOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the UUID object if successful.
[ "Create", "an", "entity", "role", "for", "an", "entity", "in", "the", "application", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L9712-L9714
alkacon/opencms-core
src/org/opencms/ade/galleries/CmsGalleryService.java
CmsGalleryService.addGalleriesForType
@SuppressWarnings("deprecation") private void addGalleriesForType(Map<String, CmsGalleryTypeInfo> galleryTypeInfos, String typeName) throws CmsLoaderException { I_CmsResourceType contentType = getResourceManager().getResourceType(typeName); for (I_CmsResourceType galleryType : contentType.getGalleryTypes()) { if (galleryTypeInfos.containsKey(galleryType.getTypeName())) { CmsGalleryTypeInfo typeInfo = galleryTypeInfos.get(galleryType.getTypeName()); typeInfo.addContentType(contentType); } else { CmsGalleryTypeInfo typeInfo; typeInfo = new CmsGalleryTypeInfo( galleryType, contentType, getGalleriesByType(galleryType.getTypeId())); galleryTypeInfos.put(galleryType.getTypeName(), typeInfo); } } }
java
@SuppressWarnings("deprecation") private void addGalleriesForType(Map<String, CmsGalleryTypeInfo> galleryTypeInfos, String typeName) throws CmsLoaderException { I_CmsResourceType contentType = getResourceManager().getResourceType(typeName); for (I_CmsResourceType galleryType : contentType.getGalleryTypes()) { if (galleryTypeInfos.containsKey(galleryType.getTypeName())) { CmsGalleryTypeInfo typeInfo = galleryTypeInfos.get(galleryType.getTypeName()); typeInfo.addContentType(contentType); } else { CmsGalleryTypeInfo typeInfo; typeInfo = new CmsGalleryTypeInfo( galleryType, contentType, getGalleriesByType(galleryType.getTypeId())); galleryTypeInfos.put(galleryType.getTypeName(), typeInfo); } } }
[ "@", "SuppressWarnings", "(", "\"deprecation\"", ")", "private", "void", "addGalleriesForType", "(", "Map", "<", "String", ",", "CmsGalleryTypeInfo", ">", "galleryTypeInfos", ",", "String", "typeName", ")", "throws", "CmsLoaderException", "{", "I_CmsResourceType", "co...
Adds galleries for a given type.<p> @param galleryTypeInfos the gallery type infos @param typeName the type name @throws CmsLoaderException if something goes wrong
[ "Adds", "galleries", "for", "a", "given", "type", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/galleries/CmsGalleryService.java#L1546-L1568
xwiki/xwiki-commons
xwiki-commons-core/xwiki-commons-extension/xwiki-commons-extension-api/src/main/java/org/xwiki/extension/repository/internal/installed/DefaultInstalledExtension.java
DefaultInstalledExtension.isDependency
public static boolean isDependency(Extension extension, String namespace) { boolean isDependency = false; if (namespace == null) { isDependency = extension.getProperty(PKEY_DEPENDENCY, false); } else { Object namespacesObject = extension.getProperty(PKEY_NAMESPACES); // RETRO-COMPATIBILITY: used to be a String collection with just the actual namespaces if (namespacesObject instanceof Map) { Map<String, Object> installedNamespace = ((Map<String, Map<String, Object>>) namespacesObject).get(namespace); isDependency = installedNamespace != null ? (installedNamespace.get(PKEY_NAMESPACES_DEPENDENCY) == Boolean.TRUE) : isDependency(extension, null); } else { isDependency = isDependency(extension, null); } } return isDependency; }
java
public static boolean isDependency(Extension extension, String namespace) { boolean isDependency = false; if (namespace == null) { isDependency = extension.getProperty(PKEY_DEPENDENCY, false); } else { Object namespacesObject = extension.getProperty(PKEY_NAMESPACES); // RETRO-COMPATIBILITY: used to be a String collection with just the actual namespaces if (namespacesObject instanceof Map) { Map<String, Object> installedNamespace = ((Map<String, Map<String, Object>>) namespacesObject).get(namespace); isDependency = installedNamespace != null ? (installedNamespace.get(PKEY_NAMESPACES_DEPENDENCY) == Boolean.TRUE) : isDependency(extension, null); } else { isDependency = isDependency(extension, null); } } return isDependency; }
[ "public", "static", "boolean", "isDependency", "(", "Extension", "extension", ",", "String", "namespace", ")", "{", "boolean", "isDependency", "=", "false", ";", "if", "(", "namespace", "==", "null", ")", "{", "isDependency", "=", "extension", ".", "getPropert...
Indicate if the extension as been installed as a dependency of another one. @param extension the extension @param namespace the namespace to look at, null indicate the root namespace @return true if the the extension has been installed only because it was a dependency of another extension @see InstalledExtension#isDependency(String) @since 8.2RC1
[ "Indicate", "if", "the", "extension", "as", "been", "installed", "as", "a", "dependency", "of", "another", "one", "." ]
train
https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-extension/xwiki-commons-extension-api/src/main/java/org/xwiki/extension/repository/internal/installed/DefaultInstalledExtension.java#L112-L135
juebanlin/util4j
util4j/src/main/java/net/jueb/util4j/filter/wordsFilter/sd/SensitiveWordFilter.java
SensitiveWordFilter.isContaintSensitiveWord
public boolean isContaintSensitiveWord(String txt,MatchType matchType){ boolean flag = false; for(int i = 0 ; i < txt.length() ; i++){ int matchFlag = checkSensitiveWord(txt, i, matchType); //判断是否包含敏感字符 if(matchFlag > 0){ //大于0存在,返回true flag = true; } } return flag; }
java
public boolean isContaintSensitiveWord(String txt,MatchType matchType){ boolean flag = false; for(int i = 0 ; i < txt.length() ; i++){ int matchFlag = checkSensitiveWord(txt, i, matchType); //判断是否包含敏感字符 if(matchFlag > 0){ //大于0存在,返回true flag = true; } } return flag; }
[ "public", "boolean", "isContaintSensitiveWord", "(", "String", "txt", ",", "MatchType", "matchType", ")", "{", "boolean", "flag", "=", "false", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "txt", ".", "length", "(", ")", ";", "i", "++", ")",...
判断文字是否包含敏感字符 @param txt 文字 @param matchType 匹配规则&nbsp;1:最小匹配规则,2:最大匹配规则 @return 若包含返回true,否则返回false @version 1.0
[ "判断文字是否包含敏感字符" ]
train
https://github.com/juebanlin/util4j/blob/c404b2dbdedf7a8890533b351257fa8af4f1439f/util4j/src/main/java/net/jueb/util4j/filter/wordsFilter/sd/SensitiveWordFilter.java#L49-L58
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/HtmlSerialFieldWriter.java
HtmlSerialFieldWriter.getSerializableFields
public Content getSerializableFields(String heading, Content serializableFieldsTree) { HtmlTree li = new HtmlTree(HtmlTag.LI); li.addStyle(HtmlStyle.blockList); if (serializableFieldsTree.isValid()) { Content headingContent = new StringContent(heading); Content serialHeading = HtmlTree.HEADING(HtmlConstants.SERIALIZED_MEMBER_HEADING, headingContent); li.addContent(serialHeading); li.addContent(serializableFieldsTree); } return li; }
java
public Content getSerializableFields(String heading, Content serializableFieldsTree) { HtmlTree li = new HtmlTree(HtmlTag.LI); li.addStyle(HtmlStyle.blockList); if (serializableFieldsTree.isValid()) { Content headingContent = new StringContent(heading); Content serialHeading = HtmlTree.HEADING(HtmlConstants.SERIALIZED_MEMBER_HEADING, headingContent); li.addContent(serialHeading); li.addContent(serializableFieldsTree); } return li; }
[ "public", "Content", "getSerializableFields", "(", "String", "heading", ",", "Content", "serializableFieldsTree", ")", "{", "HtmlTree", "li", "=", "new", "HtmlTree", "(", "HtmlTag", ".", "LI", ")", ";", "li", ".", "addStyle", "(", "HtmlStyle", ".", "blockList"...
Add serializable fields. @param heading the heading for the section @param serializableFieldsTree the tree to be added to the serializable fileds content tree @return a content tree for the serializable fields content
[ "Add", "serializable", "fields", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/HtmlSerialFieldWriter.java#L96-L107
pac4j/pac4j
pac4j-saml/src/main/java/org/pac4j/saml/sso/impl/SAML2AuthnResponseValidator.java
SAML2AuthnResponseValidator.validateAssertionConditions
protected final void validateAssertionConditions(final Conditions conditions, final SAML2MessageContext context) { if (conditions == null) { return; } if (conditions.getNotBefore() != null && conditions.getNotBefore().minusSeconds(acceptedSkew).isAfterNow()) { throw new SAMLAssertionConditionException("Assertion condition notBefore is not valid"); } if (conditions.getNotOnOrAfter() != null && conditions.getNotOnOrAfter().plusSeconds(acceptedSkew).isBeforeNow()) { throw new SAMLAssertionConditionException("Assertion condition notOnOrAfter is not valid"); } final String entityId = context.getSAMLSelfEntityContext().getEntityId(); validateAudienceRestrictions(conditions.getAudienceRestrictions(), entityId); }
java
protected final void validateAssertionConditions(final Conditions conditions, final SAML2MessageContext context) { if (conditions == null) { return; } if (conditions.getNotBefore() != null && conditions.getNotBefore().minusSeconds(acceptedSkew).isAfterNow()) { throw new SAMLAssertionConditionException("Assertion condition notBefore is not valid"); } if (conditions.getNotOnOrAfter() != null && conditions.getNotOnOrAfter().plusSeconds(acceptedSkew).isBeforeNow()) { throw new SAMLAssertionConditionException("Assertion condition notOnOrAfter is not valid"); } final String entityId = context.getSAMLSelfEntityContext().getEntityId(); validateAudienceRestrictions(conditions.getAudienceRestrictions(), entityId); }
[ "protected", "final", "void", "validateAssertionConditions", "(", "final", "Conditions", "conditions", ",", "final", "SAML2MessageContext", "context", ")", "{", "if", "(", "conditions", "==", "null", ")", "{", "return", ";", "}", "if", "(", "conditions", ".", ...
Validate assertionConditions - notBefore - notOnOrAfter @param conditions the conditions @param context the context
[ "Validate", "assertionConditions", "-", "notBefore", "-", "notOnOrAfter" ]
train
https://github.com/pac4j/pac4j/blob/d9cd029f8783792b31dd48bf1e32f80628f2c4a3/pac4j-saml/src/main/java/org/pac4j/saml/sso/impl/SAML2AuthnResponseValidator.java#L478-L494
rhuss/jolokia
agent/jvm/src/main/java/org/jolokia/jvmagent/client/util/VirtualMachineHandler.java
VirtualMachineHandler.attachVirtualMachine
public Object attachVirtualMachine() { if (options.getPid() == null && options.getProcessPattern() == null) { return null; } Class vmClass = lookupVirtualMachineClass(); String pid = null; try { Method method = vmClass.getMethod("attach",String.class); pid = getProcessId(options); return method.invoke(null, pid); } catch (NoSuchMethodException e) { throw new ProcessingException("Internal: No method 'attach' found on " + vmClass,e,options); } catch (InvocationTargetException e) { throw new ProcessingException(getPidErrorMesssage(pid,"InvocationTarget",vmClass),e,options); } catch (IllegalAccessException e) { throw new ProcessingException(getPidErrorMesssage(pid, "IllegalAccessException", vmClass),e,options); } catch (IllegalArgumentException e) { throw new ProcessingException("Illegal Argument",e,options); } }
java
public Object attachVirtualMachine() { if (options.getPid() == null && options.getProcessPattern() == null) { return null; } Class vmClass = lookupVirtualMachineClass(); String pid = null; try { Method method = vmClass.getMethod("attach",String.class); pid = getProcessId(options); return method.invoke(null, pid); } catch (NoSuchMethodException e) { throw new ProcessingException("Internal: No method 'attach' found on " + vmClass,e,options); } catch (InvocationTargetException e) { throw new ProcessingException(getPidErrorMesssage(pid,"InvocationTarget",vmClass),e,options); } catch (IllegalAccessException e) { throw new ProcessingException(getPidErrorMesssage(pid, "IllegalAccessException", vmClass),e,options); } catch (IllegalArgumentException e) { throw new ProcessingException("Illegal Argument",e,options); } }
[ "public", "Object", "attachVirtualMachine", "(", ")", "{", "if", "(", "options", ".", "getPid", "(", ")", "==", "null", "&&", "options", ".", "getProcessPattern", "(", ")", "==", "null", ")", "{", "return", "null", ";", "}", "Class", "vmClass", "=", "l...
Lookup and create a {@link com.sun.tools.attach.VirtualMachine} via reflection. First, a direct lookup via {@link Class#forName(String)} is done, which will succeed for JVM on OS X, since tools.jar is bundled there together with classes.zip. Next, tools.jar is tried to be found (by examine <code>java.home</code>) and an own classloader is created for looking up the VirtualMachine. If lookup fails, a message is printed out (except when '--quiet' is provided) @return the create virtual machine of <code>null</code> if none could be created
[ "Lookup", "and", "create", "a", "{", "@link", "com", ".", "sun", ".", "tools", ".", "attach", ".", "VirtualMachine", "}", "via", "reflection", ".", "First", "a", "direct", "lookup", "via", "{", "@link", "Class#forName", "(", "String", ")", "}", "is", "...
train
https://github.com/rhuss/jolokia/blob/dc95e7bef859b1829776c5a84c8f7738f5d7d9c3/agent/jvm/src/main/java/org/jolokia/jvmagent/client/util/VirtualMachineHandler.java#L59-L78
Mozu/mozu-java
mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/customer/B2BAccountUrl.java
B2BAccountUrl.getUserRolesAsyncUrl
public static MozuUrl getUserRolesAsyncUrl(Integer accountId, String responseFields, String userId) { UrlFormatter formatter = new UrlFormatter("/api/commerce/customer/b2baccounts/{accountId}/user/{userId}/roles?responseFields={responseFields}"); formatter.formatUrl("accountId", accountId); formatter.formatUrl("responseFields", responseFields); formatter.formatUrl("userId", userId); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
java
public static MozuUrl getUserRolesAsyncUrl(Integer accountId, String responseFields, String userId) { UrlFormatter formatter = new UrlFormatter("/api/commerce/customer/b2baccounts/{accountId}/user/{userId}/roles?responseFields={responseFields}"); formatter.formatUrl("accountId", accountId); formatter.formatUrl("responseFields", responseFields); formatter.formatUrl("userId", userId); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
[ "public", "static", "MozuUrl", "getUserRolesAsyncUrl", "(", "Integer", "accountId", ",", "String", "responseFields", ",", "String", "userId", ")", "{", "UrlFormatter", "formatter", "=", "new", "UrlFormatter", "(", "\"/api/commerce/customer/b2baccounts/{accountId}/user/{user...
Get Resource Url for GetUserRolesAsync @param accountId Unique identifier of the customer account. @param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss. @param userId Unique identifier of the user whose tenant scopes you want to retrieve. @return String Resource Url
[ "Get", "Resource", "Url", "for", "GetUserRolesAsync" ]
train
https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/customer/B2BAccountUrl.java#L87-L94
eclipse/xtext-extras
org.eclipse.xtext.common.types/src/org/eclipse/xtext/common/types/util/TypeReferences.java
TypeReferences.findDeclaredType
public JvmType findDeclaredType(Class<?> clazz, Notifier context) { if (clazz == null) throw new NullPointerException("clazz"); JvmType declaredType = findDeclaredType(clazz.getName(), context); return declaredType; }
java
public JvmType findDeclaredType(Class<?> clazz, Notifier context) { if (clazz == null) throw new NullPointerException("clazz"); JvmType declaredType = findDeclaredType(clazz.getName(), context); return declaredType; }
[ "public", "JvmType", "findDeclaredType", "(", "Class", "<", "?", ">", "clazz", ",", "Notifier", "context", ")", "{", "if", "(", "clazz", "==", "null", ")", "throw", "new", "NullPointerException", "(", "\"clazz\"", ")", ";", "JvmType", "declaredType", "=", ...
looks up a JVMType corresponding to the given {@link Class}. This method ignores any Jvm types created in non- {@link TypeResource} in the given EObject's resourceSet, but goes straight to the Java-layer, using a {@link IJvmTypeProvider}. @return the JvmType with the same qualified name as the given {@link Class} object, or null if no such JvmType could be found using the context's resourceSet.
[ "looks", "up", "a", "JVMType", "corresponding", "to", "the", "given", "{", "@link", "Class", "}", ".", "This", "method", "ignores", "any", "Jvm", "types", "created", "in", "non", "-", "{", "@link", "TypeResource", "}", "in", "the", "given", "EObject", "s...
train
https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.common.types/src/org/eclipse/xtext/common/types/util/TypeReferences.java#L229-L234
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java
SeaGlassLookAndFeel.getDerivedColor
protected final Color getDerivedColor(Color color1, Color color2, float midPoint) { return getDerivedColor(color1, color2, midPoint, true); }
java
protected final Color getDerivedColor(Color color1, Color color2, float midPoint) { return getDerivedColor(color1, color2, midPoint, true); }
[ "protected", "final", "Color", "getDerivedColor", "(", "Color", "color1", ",", "Color", "color2", ",", "float", "midPoint", ")", "{", "return", "getDerivedColor", "(", "color1", ",", "color2", ",", "midPoint", ",", "true", ")", ";", "}" ]
Decodes and returns a color, which is derived from a offset between two other colors. @param color1 The first color @param color2 The second color @param midPoint The offset between color 1 and color 2, a value of 0.0 is color 1 and 1.0 is color 2; @return The derived color, which will be a UIResource
[ "Decodes", "and", "returns", "a", "color", "which", "is", "derived", "from", "a", "offset", "between", "two", "other", "colors", "." ]
train
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java#L3470-L3473
Azure/azure-sdk-for-java
datalakestore/resource-manager/v2015_10_01_preview/src/main/java/com/microsoft/azure/management/datalakestore/v2015_10_01_preview/implementation/AccountsInner.java
AccountsInner.beginCreateAsync
public Observable<DataLakeStoreAccountInner> beginCreateAsync(String resourceGroupName, String name, DataLakeStoreAccountInner parameters) { return beginCreateWithServiceResponseAsync(resourceGroupName, name, parameters).map(new Func1<ServiceResponse<DataLakeStoreAccountInner>, DataLakeStoreAccountInner>() { @Override public DataLakeStoreAccountInner call(ServiceResponse<DataLakeStoreAccountInner> response) { return response.body(); } }); }
java
public Observable<DataLakeStoreAccountInner> beginCreateAsync(String resourceGroupName, String name, DataLakeStoreAccountInner parameters) { return beginCreateWithServiceResponseAsync(resourceGroupName, name, parameters).map(new Func1<ServiceResponse<DataLakeStoreAccountInner>, DataLakeStoreAccountInner>() { @Override public DataLakeStoreAccountInner call(ServiceResponse<DataLakeStoreAccountInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "DataLakeStoreAccountInner", ">", "beginCreateAsync", "(", "String", "resourceGroupName", ",", "String", "name", ",", "DataLakeStoreAccountInner", "parameters", ")", "{", "return", "beginCreateWithServiceResponseAsync", "(", "resourceGroupName", ...
Creates the specified Data Lake Store account. @param resourceGroupName The name of the Azure resource group that contains the Data Lake Store account. @param name The name of the Data Lake Store account to create. @param parameters Parameters supplied to create the Data Lake Store account. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the DataLakeStoreAccountInner object
[ "Creates", "the", "specified", "Data", "Lake", "Store", "account", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datalakestore/resource-manager/v2015_10_01_preview/src/main/java/com/microsoft/azure/management/datalakestore/v2015_10_01_preview/implementation/AccountsInner.java#L664-L671
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/event/SelectOnUpdateHandler.java
SelectOnUpdateHandler.doRecordChange
public int doRecordChange(FieldInfo field, int iChangeType, boolean bDisplayOption) { // Read a valid record int iErrorCode = super.doRecordChange(field, iChangeType, bDisplayOption); // Initialize the record if (iErrorCode != DBConstants.NORMAL_RETURN) return iErrorCode; if ((iChangeType == DBConstants.AFTER_UPDATE_TYPE) || (iChangeType == DBConstants.AFTER_ADD_TYPE)) return this.syncRecords(); return iErrorCode; }
java
public int doRecordChange(FieldInfo field, int iChangeType, boolean bDisplayOption) { // Read a valid record int iErrorCode = super.doRecordChange(field, iChangeType, bDisplayOption); // Initialize the record if (iErrorCode != DBConstants.NORMAL_RETURN) return iErrorCode; if ((iChangeType == DBConstants.AFTER_UPDATE_TYPE) || (iChangeType == DBConstants.AFTER_ADD_TYPE)) return this.syncRecords(); return iErrorCode; }
[ "public", "int", "doRecordChange", "(", "FieldInfo", "field", ",", "int", "iChangeType", ",", "boolean", "bDisplayOption", ")", "{", "// Read a valid record", "int", "iErrorCode", "=", "super", ".", "doRecordChange", "(", "field", ",", "iChangeType", ",", "bDispla...
Called when a change is the record status is about to happen/has happened. @param field If this file change is due to a field, this is the field. @param changeType The type of change that occurred. @param bDisplayOption If true, display any changes. @return an error code. Synchronize records after an update or add.
[ "Called", "when", "a", "change", "is", "the", "record", "status", "is", "about", "to", "happen", "/", "has", "happened", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/event/SelectOnUpdateHandler.java#L72-L81
SG-O/miIO
src/main/java/de/sg_o/app/miio/vacuum/Vacuum.java
Vacuum.setSoundVolume
public boolean setSoundVolume(int volume) throws CommandExecutionException { if (volume < 0) volume = 0; if (volume > 100) volume = 100; JSONArray payload = new JSONArray(); payload.put(volume); return sendOk("change_sound_volume", payload); }
java
public boolean setSoundVolume(int volume) throws CommandExecutionException { if (volume < 0) volume = 0; if (volume > 100) volume = 100; JSONArray payload = new JSONArray(); payload.put(volume); return sendOk("change_sound_volume", payload); }
[ "public", "boolean", "setSoundVolume", "(", "int", "volume", ")", "throws", "CommandExecutionException", "{", "if", "(", "volume", "<", "0", ")", "volume", "=", "0", ";", "if", "(", "volume", ">", "100", ")", "volume", "=", "100", ";", "JSONArray", "payl...
Set the vacuums volume. @param volume The volume between 0 and 100. @return True if the command was received successfully. @throws CommandExecutionException When there has been a error during the communication or the response was invalid.
[ "Set", "the", "vacuums", "volume", "." ]
train
https://github.com/SG-O/miIO/blob/f352dbd2a699d2cdb1b412ca5e6cbb0c38ca779b/src/main/java/de/sg_o/app/miio/vacuum/Vacuum.java#L446-L452
openengsb/openengsb
components/ekb/transformation-wonderland/src/main/java/org/openengsb/core/ekb/transformation/wonderland/internal/performer/TransformationPerformer.java
TransformationPerformer.loadObjectFromField
private Object loadObjectFromField(String fieldname, Object object, Object alternative) throws Exception { Object source = object != null ? object : alternative; try { return FieldUtils.readField(source, fieldname, true); } catch (Exception e) { throw new IllegalArgumentException(String.format("Unable to load field '%s' from object '%s'", fieldname, source.getClass().getName())); } }
java
private Object loadObjectFromField(String fieldname, Object object, Object alternative) throws Exception { Object source = object != null ? object : alternative; try { return FieldUtils.readField(source, fieldname, true); } catch (Exception e) { throw new IllegalArgumentException(String.format("Unable to load field '%s' from object '%s'", fieldname, source.getClass().getName())); } }
[ "private", "Object", "loadObjectFromField", "(", "String", "fieldname", ",", "Object", "object", ",", "Object", "alternative", ")", "throws", "Exception", "{", "Object", "source", "=", "object", "!=", "null", "?", "object", ":", "alternative", ";", "try", "{",...
Loads the object from the field with the given name from either the object parameter or if this parameter is null from the alternative parameter.
[ "Loads", "the", "object", "from", "the", "field", "with", "the", "given", "name", "from", "either", "the", "object", "parameter", "or", "if", "this", "parameter", "is", "null", "from", "the", "alternative", "parameter", "." ]
train
https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/components/ekb/transformation-wonderland/src/main/java/org/openengsb/core/ekb/transformation/wonderland/internal/performer/TransformationPerformer.java#L196-L204
timewalker74/ffmq
core/src/main/java/net/timewalker/ffmq4/local/TransactionSet.java
TransactionSet.updatedQueues
public synchronized List<LocalQueue> updatedQueues( List<String> deliveredMessageIDs ) throws FFMQException { int len = deliveredMessageIDs.size(); List<LocalQueue> updatedQueues = new ArrayList<>(len); for(int n=0;n<len;n++) { String deliveredMessageID = deliveredMessageIDs.get(len-n-1); boolean found = false; Iterator<TransactionItem> entries = items.iterator(); while (entries.hasNext()) { TransactionItem item = entries.next(); if (item.getMessageId().equals(deliveredMessageID)) { found = true; LocalQueue localQueue = item.getDestination(); if (!updatedQueues.contains(localQueue)) updatedQueues.add(localQueue); break; } } if (!found) throw new FFMQException("Message does not belong to transaction : "+deliveredMessageID,"INTERNAL_ERROR"); } return updatedQueues; }
java
public synchronized List<LocalQueue> updatedQueues( List<String> deliveredMessageIDs ) throws FFMQException { int len = deliveredMessageIDs.size(); List<LocalQueue> updatedQueues = new ArrayList<>(len); for(int n=0;n<len;n++) { String deliveredMessageID = deliveredMessageIDs.get(len-n-1); boolean found = false; Iterator<TransactionItem> entries = items.iterator(); while (entries.hasNext()) { TransactionItem item = entries.next(); if (item.getMessageId().equals(deliveredMessageID)) { found = true; LocalQueue localQueue = item.getDestination(); if (!updatedQueues.contains(localQueue)) updatedQueues.add(localQueue); break; } } if (!found) throw new FFMQException("Message does not belong to transaction : "+deliveredMessageID,"INTERNAL_ERROR"); } return updatedQueues; }
[ "public", "synchronized", "List", "<", "LocalQueue", ">", "updatedQueues", "(", "List", "<", "String", ">", "deliveredMessageIDs", ")", "throws", "FFMQException", "{", "int", "len", "=", "deliveredMessageIDs", ".", "size", "(", ")", ";", "List", "<", "LocalQue...
Compute a list of queues that were updated in this transaction set
[ "Compute", "a", "list", "of", "queues", "that", "were", "updated", "in", "this", "transaction", "set" ]
train
https://github.com/timewalker74/ffmq/blob/638773ee29a4a5f9c6119ed74ad14ac9c46382b3/core/src/main/java/net/timewalker/ffmq4/local/TransactionSet.java#L163-L192
Impetus/Kundera
src/jpa-engine/core/src/main/java/com/impetus/kundera/configure/SchemaConfiguration.java
SchemaConfiguration.onInheritedProperty
private void onInheritedProperty(TableInfo tableInfo, EntityType entityType) { String discrColumn = ((AbstractManagedType) entityType).getDiscriminatorColumn(); if (discrColumn != null) { ColumnInfo columnInfo = new ColumnInfo(); columnInfo.setColumnName(discrColumn); columnInfo.setType(String.class); columnInfo.setIndexable(true); IndexInfo idxInfo = new IndexInfo(discrColumn); tableInfo.addColumnInfo(columnInfo); tableInfo.addToIndexedColumnList(idxInfo); } }
java
private void onInheritedProperty(TableInfo tableInfo, EntityType entityType) { String discrColumn = ((AbstractManagedType) entityType).getDiscriminatorColumn(); if (discrColumn != null) { ColumnInfo columnInfo = new ColumnInfo(); columnInfo.setColumnName(discrColumn); columnInfo.setType(String.class); columnInfo.setIndexable(true); IndexInfo idxInfo = new IndexInfo(discrColumn); tableInfo.addColumnInfo(columnInfo); tableInfo.addToIndexedColumnList(idxInfo); } }
[ "private", "void", "onInheritedProperty", "(", "TableInfo", "tableInfo", ",", "EntityType", "entityType", ")", "{", "String", "discrColumn", "=", "(", "(", "AbstractManagedType", ")", "entityType", ")", ".", "getDiscriminatorColumn", "(", ")", ";", "if", "(", "d...
Add {@link DiscriminatorColumn} for schema generation. @param tableInfo table info. @param entityType entity type.
[ "Add", "{", "@link", "DiscriminatorColumn", "}", "for", "schema", "generation", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/configure/SchemaConfiguration.java#L514-L529
geomajas/geomajas-project-client-gwt
plugin/widget-searchandfilter/searchandfilter-gwt/src/main/java/org/geomajas/widget/searchandfilter/client/widget/multifeaturelistgrid/FeatureListGridTab.java
FeatureListGridTab.addButton
public void addButton(ToolStripButton button, int position) { toolStrip.addButton(button, position); extraButtons.add(button); button.setDisabled(true); }
java
public void addButton(ToolStripButton button, int position) { toolStrip.addButton(button, position); extraButtons.add(button); button.setDisabled(true); }
[ "public", "void", "addButton", "(", "ToolStripButton", "button", ",", "int", "position", ")", "{", "toolStrip", ".", "addButton", "(", "button", ",", "position", ")", ";", "extraButtons", ".", "add", "(", "button", ")", ";", "button", ".", "setDisabled", "...
Add a button in the tool strip at the requested position. @param button button to add @param position position
[ "Add", "a", "button", "in", "the", "tool", "strip", "at", "the", "requested", "position", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/plugin/widget-searchandfilter/searchandfilter-gwt/src/main/java/org/geomajas/widget/searchandfilter/client/widget/multifeaturelistgrid/FeatureListGridTab.java#L221-L225
Wadpam/guja
guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDFactoryDaoImpl.java
GeneratedDFactoryDaoImpl.queryByCreatedBy
public Iterable<DFactory> queryByCreatedBy(java.lang.String createdBy) { return queryByField(null, DFactoryMapper.Field.CREATEDBY.getFieldName(), createdBy); }
java
public Iterable<DFactory> queryByCreatedBy(java.lang.String createdBy) { return queryByField(null, DFactoryMapper.Field.CREATEDBY.getFieldName(), createdBy); }
[ "public", "Iterable", "<", "DFactory", ">", "queryByCreatedBy", "(", "java", ".", "lang", ".", "String", "createdBy", ")", "{", "return", "queryByField", "(", "null", ",", "DFactoryMapper", ".", "Field", ".", "CREATEDBY", ".", "getFieldName", "(", ")", ",", ...
query-by method for field createdBy @param createdBy the specified attribute @return an Iterable of DFactorys for the specified createdBy
[ "query", "-", "by", "method", "for", "field", "createdBy" ]
train
https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDFactoryDaoImpl.java#L97-L99
BlueBrain/bluima
modules/bluima_typesystem/src/main/java/de/julielab/jules/types/OntClassMention.java
OntClassMention.setMatchedTokens
public void setMatchedTokens(int i, Token v) { if (OntClassMention_Type.featOkTst && ((OntClassMention_Type)jcasType).casFeat_matchedTokens == null) jcasType.jcas.throwFeatMissing("matchedTokens", "de.julielab.jules.types.OntClassMention"); jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((OntClassMention_Type)jcasType).casFeatCode_matchedTokens), i); jcasType.ll_cas.ll_setRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((OntClassMention_Type)jcasType).casFeatCode_matchedTokens), i, jcasType.ll_cas.ll_getFSRef(v));}
java
public void setMatchedTokens(int i, Token v) { if (OntClassMention_Type.featOkTst && ((OntClassMention_Type)jcasType).casFeat_matchedTokens == null) jcasType.jcas.throwFeatMissing("matchedTokens", "de.julielab.jules.types.OntClassMention"); jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((OntClassMention_Type)jcasType).casFeatCode_matchedTokens), i); jcasType.ll_cas.ll_setRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((OntClassMention_Type)jcasType).casFeatCode_matchedTokens), i, jcasType.ll_cas.ll_getFSRef(v));}
[ "public", "void", "setMatchedTokens", "(", "int", "i", ",", "Token", "v", ")", "{", "if", "(", "OntClassMention_Type", ".", "featOkTst", "&&", "(", "(", "OntClassMention_Type", ")", "jcasType", ")", ".", "casFeat_matchedTokens", "==", "null", ")", "jcasType", ...
indexed setter for matchedTokens - sets an indexed value - List of tokens the ontology class mention is comprised of. @generated @param i index in the array to set @param v value to set into the array
[ "indexed", "setter", "for", "matchedTokens", "-", "sets", "an", "indexed", "value", "-", "List", "of", "tokens", "the", "ontology", "class", "mention", "is", "comprised", "of", "." ]
train
https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_typesystem/src/main/java/de/julielab/jules/types/OntClassMention.java#L249-L253
OpenTSDB/opentsdb
src/tsd/StatsRpc.java
StatsRpc.execute
public Deferred<Object> execute(final TSDB tsdb, final Channel chan, final String[] cmd) { final boolean canonical = tsdb.getConfig().getBoolean("tsd.stats.canonical"); final StringBuilder buf = new StringBuilder(1024); final ASCIICollector collector = new ASCIICollector("tsd", buf, null); doCollectStats(tsdb, collector, canonical); chan.write(buf.toString()); return Deferred.fromResult(null); }
java
public Deferred<Object> execute(final TSDB tsdb, final Channel chan, final String[] cmd) { final boolean canonical = tsdb.getConfig().getBoolean("tsd.stats.canonical"); final StringBuilder buf = new StringBuilder(1024); final ASCIICollector collector = new ASCIICollector("tsd", buf, null); doCollectStats(tsdb, collector, canonical); chan.write(buf.toString()); return Deferred.fromResult(null); }
[ "public", "Deferred", "<", "Object", ">", "execute", "(", "final", "TSDB", "tsdb", ",", "final", "Channel", "chan", ",", "final", "String", "[", "]", "cmd", ")", "{", "final", "boolean", "canonical", "=", "tsdb", ".", "getConfig", "(", ")", ".", "getBo...
Telnet RPC responder that returns the stats in ASCII style @param tsdb The TSDB to use for fetching stats @param chan The netty channel to respond on @param cmd call parameters
[ "Telnet", "RPC", "responder", "that", "returns", "the", "stats", "in", "ASCII", "style" ]
train
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tsd/StatsRpc.java#L59-L67
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/PoolsImpl.java
PoolsImpl.patchAsync
public Observable<Void> patchAsync(String poolId, PoolPatchParameter poolPatchParameter, PoolPatchOptions poolPatchOptions) { return patchWithServiceResponseAsync(poolId, poolPatchParameter, poolPatchOptions).map(new Func1<ServiceResponseWithHeaders<Void, PoolPatchHeaders>, Void>() { @Override public Void call(ServiceResponseWithHeaders<Void, PoolPatchHeaders> response) { return response.body(); } }); }
java
public Observable<Void> patchAsync(String poolId, PoolPatchParameter poolPatchParameter, PoolPatchOptions poolPatchOptions) { return patchWithServiceResponseAsync(poolId, poolPatchParameter, poolPatchOptions).map(new Func1<ServiceResponseWithHeaders<Void, PoolPatchHeaders>, Void>() { @Override public Void call(ServiceResponseWithHeaders<Void, PoolPatchHeaders> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "patchAsync", "(", "String", "poolId", ",", "PoolPatchParameter", "poolPatchParameter", ",", "PoolPatchOptions", "poolPatchOptions", ")", "{", "return", "patchWithServiceResponseAsync", "(", "poolId", ",", "poolPatchParameter", ...
Updates the properties of the specified pool. This only replaces the pool properties specified in the request. For example, if the pool has a start task associated with it, and a request does not specify a start task element, then the pool keeps the existing start task. @param poolId The ID of the pool to update. @param poolPatchParameter The parameters for the request. @param poolPatchOptions Additional parameters for the operation @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponseWithHeaders} object if successful.
[ "Updates", "the", "properties", "of", "the", "specified", "pool", ".", "This", "only", "replaces", "the", "pool", "properties", "specified", "in", "the", "request", ".", "For", "example", "if", "the", "pool", "has", "a", "start", "task", "associated", "with"...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/PoolsImpl.java#L1968-L1975
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/AbstractWSelectList.java
AbstractWSelectList.optionToCode
protected String optionToCode(final Object option, final int index) { if (index < 0) { List<?> options = getOptions(); if (options == null || options.isEmpty()) { Integrity.issue(this, "No options available, so cannot convert the option \"" + option + "\" to a code."); } else { StringBuffer message = new StringBuffer(); message.append("The option \"").append(option).append( "\" is not one of the available options."); Object firstOption = SelectListUtil.getFirstOption(options); if (firstOption != null && option != null && firstOption.getClass() != option. getClass()) { message.append(" The options in this list component are of type \""); message.append(firstOption.getClass().getName()) .append("\", the selection you supplied is of type \""); message.append(option.getClass().getName()).append("\"."); } Integrity.issue(this, message.toString()); } return null; } else if (option instanceof Option) { Option opt = (Option) option; return opt.getCode() == null ? "" : opt.getCode(); } else { String code = APPLICATION_LOOKUP_TABLE.getCode(getLookupTable(), option); if (code == null) { return String.valueOf(index + 1); } else { return code; } } }
java
protected String optionToCode(final Object option, final int index) { if (index < 0) { List<?> options = getOptions(); if (options == null || options.isEmpty()) { Integrity.issue(this, "No options available, so cannot convert the option \"" + option + "\" to a code."); } else { StringBuffer message = new StringBuffer(); message.append("The option \"").append(option).append( "\" is not one of the available options."); Object firstOption = SelectListUtil.getFirstOption(options); if (firstOption != null && option != null && firstOption.getClass() != option. getClass()) { message.append(" The options in this list component are of type \""); message.append(firstOption.getClass().getName()) .append("\", the selection you supplied is of type \""); message.append(option.getClass().getName()).append("\"."); } Integrity.issue(this, message.toString()); } return null; } else if (option instanceof Option) { Option opt = (Option) option; return opt.getCode() == null ? "" : opt.getCode(); } else { String code = APPLICATION_LOOKUP_TABLE.getCode(getLookupTable(), option); if (code == null) { return String.valueOf(index + 1); } else { return code; } } }
[ "protected", "String", "optionToCode", "(", "final", "Object", "option", ",", "final", "int", "index", ")", "{", "if", "(", "index", "<", "0", ")", "{", "List", "<", "?", ">", "options", "=", "getOptions", "(", ")", ";", "if", "(", "options", "==", ...
Retrieves the code for the given option. Will return null if there is no matching option. @param option the option @param index the index of the option in the list. @return the code for the given option, or null if there is no matching option.
[ "Retrieves", "the", "code", "for", "the", "given", "option", ".", "Will", "return", "null", "if", "there", "is", "no", "matching", "option", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/AbstractWSelectList.java#L126-L163
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/reflect/ConstructorUtils.java
ConstructorUtils.getMatchingAccessibleConstructor
public static <T> Constructor<T> getMatchingAccessibleConstructor(final Class<T> cls, final Class<?>... parameterTypes) { Validate.notNull(cls, "class cannot be null"); // see if we can find the constructor directly // most of the time this works and it's much faster try { final Constructor<T> ctor = cls.getConstructor(parameterTypes); MemberUtils.setAccessibleWorkaround(ctor); return ctor; } catch (final NoSuchMethodException e) { // NOPMD - Swallow } Constructor<T> result = null; /* * (1) Class.getConstructors() is documented to return Constructor<T> so as * long as the array is not subsequently modified, everything's fine. */ final Constructor<?>[] ctors = cls.getConstructors(); // return best match: for (Constructor<?> ctor : ctors) { // compare parameters if (MemberUtils.isMatchingConstructor(ctor, parameterTypes)) { // get accessible version of constructor ctor = getAccessibleConstructor(ctor); if (ctor != null) { MemberUtils.setAccessibleWorkaround(ctor); if (result == null || MemberUtils.compareConstructorFit(ctor, result, parameterTypes) < 0) { // temporary variable for annotation, see comment above (1) @SuppressWarnings("unchecked") final Constructor<T> constructor = (Constructor<T>)ctor; result = constructor; } } } } return result; }
java
public static <T> Constructor<T> getMatchingAccessibleConstructor(final Class<T> cls, final Class<?>... parameterTypes) { Validate.notNull(cls, "class cannot be null"); // see if we can find the constructor directly // most of the time this works and it's much faster try { final Constructor<T> ctor = cls.getConstructor(parameterTypes); MemberUtils.setAccessibleWorkaround(ctor); return ctor; } catch (final NoSuchMethodException e) { // NOPMD - Swallow } Constructor<T> result = null; /* * (1) Class.getConstructors() is documented to return Constructor<T> so as * long as the array is not subsequently modified, everything's fine. */ final Constructor<?>[] ctors = cls.getConstructors(); // return best match: for (Constructor<?> ctor : ctors) { // compare parameters if (MemberUtils.isMatchingConstructor(ctor, parameterTypes)) { // get accessible version of constructor ctor = getAccessibleConstructor(ctor); if (ctor != null) { MemberUtils.setAccessibleWorkaround(ctor); if (result == null || MemberUtils.compareConstructorFit(ctor, result, parameterTypes) < 0) { // temporary variable for annotation, see comment above (1) @SuppressWarnings("unchecked") final Constructor<T> constructor = (Constructor<T>)ctor; result = constructor; } } } } return result; }
[ "public", "static", "<", "T", ">", "Constructor", "<", "T", ">", "getMatchingAccessibleConstructor", "(", "final", "Class", "<", "T", ">", "cls", ",", "final", "Class", "<", "?", ">", "...", "parameterTypes", ")", "{", "Validate", ".", "notNull", "(", "c...
<p>Finds an accessible constructor with compatible parameters.</p> <p>This checks all the constructor and finds one with compatible parameters This requires that every parameter is assignable from the given parameter types. This is a more flexible search than the normal exact matching algorithm.</p> <p>First it checks if there is a constructor matching the exact signature. If not then all the constructors of the class are checked to see if their signatures are assignment-compatible with the parameter types. The first assignment-compatible matching constructor is returned.</p> @param <T> the constructor type @param cls the class to find a constructor for, not {@code null} @param parameterTypes find method with compatible parameters @return the constructor, null if no matching accessible constructor found @throws NullPointerException if {@code cls} is {@code null}
[ "<p", ">", "Finds", "an", "accessible", "constructor", "with", "compatible", "parameters", ".", "<", "/", "p", ">" ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/reflect/ConstructorUtils.java#L247-L284
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java
ClassWriterImpl.getClassLinks
private Content getClassLinks(LinkInfoImpl.Kind context, List<?> list) { Object[] typeList = list.toArray(); Content dd = new HtmlTree(HtmlTag.DD); for (int i = 0; i < list.size(); i++) { if (i > 0) { Content separator = new StringContent(", "); dd.addContent(separator); } if (typeList[i] instanceof ClassDoc) { Content link = getLink( new LinkInfoImpl(configuration, context, (ClassDoc)(typeList[i]))); dd.addContent(link); } else { Content link = getLink( new LinkInfoImpl(configuration, context, (Type)(typeList[i]))); dd.addContent(link); } } return dd; }
java
private Content getClassLinks(LinkInfoImpl.Kind context, List<?> list) { Object[] typeList = list.toArray(); Content dd = new HtmlTree(HtmlTag.DD); for (int i = 0; i < list.size(); i++) { if (i > 0) { Content separator = new StringContent(", "); dd.addContent(separator); } if (typeList[i] instanceof ClassDoc) { Content link = getLink( new LinkInfoImpl(configuration, context, (ClassDoc)(typeList[i]))); dd.addContent(link); } else { Content link = getLink( new LinkInfoImpl(configuration, context, (Type)(typeList[i]))); dd.addContent(link); } } return dd; }
[ "private", "Content", "getClassLinks", "(", "LinkInfoImpl", ".", "Kind", "context", ",", "List", "<", "?", ">", "list", ")", "{", "Object", "[", "]", "typeList", "=", "list", ".", "toArray", "(", ")", ";", "Content", "dd", "=", "new", "HtmlTree", "(", ...
Get links to the given classes. @param context the id of the context where the link will be printed @param list the list of classes @return a content tree for the class list
[ "Get", "links", "to", "the", "given", "classes", "." ]
train
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java#L584-L603
Esri/geometry-api-java
src/main/java/com/esri/core/geometry/QuadTree.java
QuadTree.getIterator
public QuadTreeIterator getIterator(Geometry query, double tolerance) { QuadTreeImpl.QuadTreeIteratorImpl iterator = m_impl.getIterator(query, tolerance); return new QuadTreeIterator(iterator, false); }
java
public QuadTreeIterator getIterator(Geometry query, double tolerance) { QuadTreeImpl.QuadTreeIteratorImpl iterator = m_impl.getIterator(query, tolerance); return new QuadTreeIterator(iterator, false); }
[ "public", "QuadTreeIterator", "getIterator", "(", "Geometry", "query", ",", "double", "tolerance", ")", "{", "QuadTreeImpl", ".", "QuadTreeIteratorImpl", "iterator", "=", "m_impl", ".", "getIterator", "(", "query", ",", "tolerance", ")", ";", "return", "new", "Q...
Gets an iterator on the QuadTree. The query will be the Envelope2D that bounds the input Geometry. To reuse the existing iterator on the same QuadTree but with a new query, use the reset_iterator function on the QuadTree_iterator. \param query The Geometry used for the query. If the Geometry is a Line segment, then the query will be the segment. Otherwise the query will be the Envelope2D bounding the Geometry. \param tolerance The tolerance used for the intersection tests.
[ "Gets", "an", "iterator", "on", "the", "QuadTree", ".", "The", "query", "will", "be", "the", "Envelope2D", "that", "bounds", "the", "input", "Geometry", ".", "To", "reuse", "the", "existing", "iterator", "on", "the", "same", "QuadTree", "but", "with", "a",...
train
https://github.com/Esri/geometry-api-java/blob/494da8ec953d76e7c6072afbc081abfe48ff07cf/src/main/java/com/esri/core/geometry/QuadTree.java#L263-L266
alkacon/opencms-core
src/org/opencms/widgets/A_CmsNativeComplexWidget.java
A_CmsNativeComplexWidget.initConfiguration
public final void initConfiguration(String config) { m_configuration = config; m_configurationMap = CmsStringUtil.splitAsMap(config, "|", ":"); m_configurationMap.put(CmsContentDefinition.PARAM_INIT_CALL, INIT_FUNCTION_PREFIX + getName()); m_jsonConfig = new JSONObject(new HashMap<String, Object>(m_configurationMap)); }
java
public final void initConfiguration(String config) { m_configuration = config; m_configurationMap = CmsStringUtil.splitAsMap(config, "|", ":"); m_configurationMap.put(CmsContentDefinition.PARAM_INIT_CALL, INIT_FUNCTION_PREFIX + getName()); m_jsonConfig = new JSONObject(new HashMap<String, Object>(m_configurationMap)); }
[ "public", "final", "void", "initConfiguration", "(", "String", "config", ")", "{", "m_configuration", "=", "config", ";", "m_configurationMap", "=", "CmsStringUtil", ".", "splitAsMap", "(", "config", ",", "\"|\"", ",", "\":\"", ")", ";", "m_configurationMap", "....
Initializes the configuration date from the given configuration string.<p> This should be called by subclasses of this class.<p> @param config the widget configuration string
[ "Initializes", "the", "configuration", "date", "from", "the", "given", "configuration", "string", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/widgets/A_CmsNativeComplexWidget.java#L109-L115
sagiegurari/fax4j
src/main/java/org/fax4j/spi/http/XMLHTTPResponseHandler.java
XMLHTTPResponseHandler.convertToObject
@Override protected Document convertToObject(HTTPResponse httpResponse) { //get response text Document document=null; String content=httpResponse.getContent(); if(content!=null) { //get response encoding String encoding=this.getResponseDataEncoding(); //create in memory stream byte[] data=IOHelper.convertStringToBinary(content,encoding); InputStream inputStream=new ByteArrayInputStream(data); try { //parse XML DocumentBuilderFactory documentBuilderFactory=DocumentBuilderFactory.newInstance(); DocumentBuilder documentBuilder=documentBuilderFactory.newDocumentBuilder(); document=documentBuilder.parse(inputStream); } catch(Exception exception) { throw new FaxException("Unable to parse HTTP response text as XML.",exception); } finally { //'close' stream IOHelper.closeResource(inputStream); } } return document; }
java
@Override protected Document convertToObject(HTTPResponse httpResponse) { //get response text Document document=null; String content=httpResponse.getContent(); if(content!=null) { //get response encoding String encoding=this.getResponseDataEncoding(); //create in memory stream byte[] data=IOHelper.convertStringToBinary(content,encoding); InputStream inputStream=new ByteArrayInputStream(data); try { //parse XML DocumentBuilderFactory documentBuilderFactory=DocumentBuilderFactory.newInstance(); DocumentBuilder documentBuilder=documentBuilderFactory.newDocumentBuilder(); document=documentBuilder.parse(inputStream); } catch(Exception exception) { throw new FaxException("Unable to parse HTTP response text as XML.",exception); } finally { //'close' stream IOHelper.closeResource(inputStream); } } return document; }
[ "@", "Override", "protected", "Document", "convertToObject", "(", "HTTPResponse", "httpResponse", ")", "{", "//get response text", "Document", "document", "=", "null", ";", "String", "content", "=", "httpResponse", ".", "getContent", "(", ")", ";", "if", "(", "c...
This function converts the HTTP response content to the specific object. @param httpResponse The HTTP response @return The object
[ "This", "function", "converts", "the", "HTTP", "response", "content", "to", "the", "specific", "object", "." ]
train
https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/spi/http/XMLHTTPResponseHandler.java#L317-L351
operasoftware/operaprestodriver
src/com/opera/core/systems/OperaDesktopDriver.java
OperaDesktopDriver.keyDown
public void keyDown(String key, List<ModifierPressed> modifiers) { systemInputManager.keyDown(key, modifiers); }
java
public void keyDown(String key, List<ModifierPressed> modifiers) { systemInputManager.keyDown(key, modifiers); }
[ "public", "void", "keyDown", "(", "String", "key", ",", "List", "<", "ModifierPressed", ">", "modifiers", ")", "{", "systemInputManager", ".", "keyDown", "(", "key", ",", "modifiers", ")", ";", "}" ]
Press Key. @param key key to press @param modifiers modifiers held
[ "Press", "Key", "." ]
train
https://github.com/operasoftware/operaprestodriver/blob/1ccceda80f1c1a0489171d17dcaa6e7b18fb4c01/src/com/opera/core/systems/OperaDesktopDriver.java#L620-L622
tomdcc/sham
sham-core/src/main/java/org/shamdata/Sham.java
Sham.setSeed
public void setSeed(long seedVal) { try { Field f = Random.class.getDeclaredField("seed"); //NoSuchFieldException f.setAccessible(true); AtomicLong seed = (AtomicLong) f.get(random); seed.set(seedVal); } catch(NoSuchFieldException e) { throw new RuntimeException("Couldn't access seed field - perhaps JDK Random object not laid out as expected?", e); } catch(IllegalAccessException e) { throw new RuntimeException("Couldn't access seed field - are you running under a SecurityManager?", e); } catch(SecurityException e) { throw new RuntimeException("Couldn't access seed field - are you running under a SecurityManager?", e); } }
java
public void setSeed(long seedVal) { try { Field f = Random.class.getDeclaredField("seed"); //NoSuchFieldException f.setAccessible(true); AtomicLong seed = (AtomicLong) f.get(random); seed.set(seedVal); } catch(NoSuchFieldException e) { throw new RuntimeException("Couldn't access seed field - perhaps JDK Random object not laid out as expected?", e); } catch(IllegalAccessException e) { throw new RuntimeException("Couldn't access seed field - are you running under a SecurityManager?", e); } catch(SecurityException e) { throw new RuntimeException("Couldn't access seed field - are you running under a SecurityManager?", e); } }
[ "public", "void", "setSeed", "(", "long", "seedVal", ")", "{", "try", "{", "Field", "f", "=", "Random", ".", "class", ".", "getDeclaredField", "(", "\"seed\"", ")", ";", "//NoSuchFieldException", "f", ".", "setAccessible", "(", "true", ")", ";", "AtomicLon...
Sets the random seem value for Sham's internal random number generator. Since {@link java.util.Random java.util.Random} does not allow us to set this directly (the {@link Random#setSeed(long) Random.setSeed()} and {@link Random#Random(long) new Random(seed)} calls don't set it directly, the seed gets mutated first), we use reflection to set it. This has been tested in Sun / Oracle JRE 1.6 - other implementations may not work yet. Also may not work if you're running inside a {@link SecurityManager}. @param seedVal the value to set the seed to
[ "Sets", "the", "random", "seem", "value", "for", "Sham", "s", "internal", "random", "number", "generator", ".", "Since", "{", "@link", "java", ".", "util", ".", "Random", "java", ".", "util", ".", "Random", "}", "does", "not", "allow", "us", "to", "set...
train
https://github.com/tomdcc/sham/blob/33ede5e7130888736d6c84368e16a56e9e31e033/sham-core/src/main/java/org/shamdata/Sham.java#L322-L335
apache/flink
flink-core/src/main/java/org/apache/flink/util/ReflectionUtil.java
ReflectionUtil.getFullTemplateType
public static FullTypeInfo getFullTemplateType(Type type, int templatePosition) { if (type instanceof ParameterizedType) { return getFullTemplateType(((ParameterizedType) type).getActualTypeArguments()[templatePosition]); } else { throw new IllegalArgumentException(); } }
java
public static FullTypeInfo getFullTemplateType(Type type, int templatePosition) { if (type instanceof ParameterizedType) { return getFullTemplateType(((ParameterizedType) type).getActualTypeArguments()[templatePosition]); } else { throw new IllegalArgumentException(); } }
[ "public", "static", "FullTypeInfo", "getFullTemplateType", "(", "Type", "type", ",", "int", "templatePosition", ")", "{", "if", "(", "type", "instanceof", "ParameterizedType", ")", "{", "return", "getFullTemplateType", "(", "(", "(", "ParameterizedType", ")", "typ...
Extract the full template type information from the given type's template parameter at the given position. @param type type to extract the full template parameter information from @param templatePosition describing at which position the template type parameter is @return Full type information describing the template parameter's type
[ "Extract", "the", "full", "template", "type", "information", "from", "the", "given", "type", "s", "template", "parameter", "at", "the", "given", "position", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/util/ReflectionUtil.java#L169-L175
alkacon/opencms-core
src/org/opencms/ui/components/extensions/CmsGwtDialogExtension.java
CmsGwtDialogExtension.showPreview
public void showPreview(CmsUUID id, Integer version, OfflineOnline offlineOnline) { getRpcProxy(I_CmsGwtDialogClientRpc.class).showPreview("" + id, version + ":" + offlineOnline); }
java
public void showPreview(CmsUUID id, Integer version, OfflineOnline offlineOnline) { getRpcProxy(I_CmsGwtDialogClientRpc.class).showPreview("" + id, version + ":" + offlineOnline); }
[ "public", "void", "showPreview", "(", "CmsUUID", "id", ",", "Integer", "version", ",", "OfflineOnline", "offlineOnline", ")", "{", "getRpcProxy", "(", "I_CmsGwtDialogClientRpc", ".", "class", ")", ".", "showPreview", "(", "\"\"", "+", "id", ",", "version", "+"...
Shows the prewview dialog for a given resource and version.<p> @param id the structure id of the resource @param version the version @param offlineOnline indicates whether we want the offlne or online version
[ "Shows", "the", "prewview", "dialog", "for", "a", "given", "resource", "and", "version", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/components/extensions/CmsGwtDialogExtension.java#L262-L265
TheHortonMachine/hortonmachine
gears/src/main/java/oms3/io/DataIO.java
DataIO.columnExist
public static boolean columnExist(CSTable table, String name) { for (int i = 1; i <= table.getColumnCount(); i++) { if (table.getColumnName(i).startsWith(name)) { return true; } } return false; }
java
public static boolean columnExist(CSTable table, String name) { for (int i = 1; i <= table.getColumnCount(); i++) { if (table.getColumnName(i).startsWith(name)) { return true; } } return false; }
[ "public", "static", "boolean", "columnExist", "(", "CSTable", "table", ",", "String", "name", ")", "{", "for", "(", "int", "i", "=", "1", ";", "i", "<=", "table", ".", "getColumnCount", "(", ")", ";", "i", "++", ")", "{", "if", "(", "table", ".", ...
Check if a column exist in table. @param table the table to check @param name the name of the column @return
[ "Check", "if", "a", "column", "exist", "in", "table", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/oms3/io/DataIO.java#L1237-L1244
landawn/AbacusUtil
src/com/landawn/abacus/util/N.java
N.bucketSort
public static <T> void bucketSort(final T[] a, final int fromIndex, final int toIndex, final Comparator<? super T> cmp) { Array.bucketSort(a, fromIndex, toIndex, cmp); }
java
public static <T> void bucketSort(final T[] a, final int fromIndex, final int toIndex, final Comparator<? super T> cmp) { Array.bucketSort(a, fromIndex, toIndex, cmp); }
[ "public", "static", "<", "T", ">", "void", "bucketSort", "(", "final", "T", "[", "]", "a", ",", "final", "int", "fromIndex", ",", "final", "int", "toIndex", ",", "final", "Comparator", "<", "?", "super", "T", ">", "cmp", ")", "{", "Array", ".", "bu...
Note: All the objects with same value will be replaced with first element with the same value. @param a @param fromIndex @param toIndex @param cmp
[ "Note", ":", "All", "the", "objects", "with", "same", "value", "will", "be", "replaced", "with", "first", "element", "with", "the", "same", "value", "." ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/N.java#L12024-L12026
phax/ph-oton
ph-oton-bootstrap3/src/main/java/com/helger/photon/bootstrap3/ext/BootstrapSystemMessage.java
BootstrapSystemMessage.setDefaultFormatter
public static void setDefaultFormatter (@Nonnull final BiConsumer <String, BootstrapSystemMessage> aFormatter) { ValueEnforcer.notNull (aFormatter, "Formatter"); s_aRWLock.writeLocked ( () -> s_aFormatter = aFormatter); }
java
public static void setDefaultFormatter (@Nonnull final BiConsumer <String, BootstrapSystemMessage> aFormatter) { ValueEnforcer.notNull (aFormatter, "Formatter"); s_aRWLock.writeLocked ( () -> s_aFormatter = aFormatter); }
[ "public", "static", "void", "setDefaultFormatter", "(", "@", "Nonnull", "final", "BiConsumer", "<", "String", ",", "BootstrapSystemMessage", ">", "aFormatter", ")", "{", "ValueEnforcer", ".", "notNull", "(", "aFormatter", ",", "\"Formatter\"", ")", ";", "s_aRWLock...
Set the default text formatter to be used. This can e.g. be used to easily visualize Markdown syntax in the system message. @param aFormatter The formatter callback. May not be <code>null</code>.
[ "Set", "the", "default", "text", "formatter", "to", "be", "used", ".", "This", "can", "e", ".", "g", ".", "be", "used", "to", "easily", "visualize", "Markdown", "syntax", "in", "the", "system", "message", "." ]
train
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-bootstrap3/src/main/java/com/helger/photon/bootstrap3/ext/BootstrapSystemMessage.java#L65-L69
JOML-CI/JOML
src/org/joml/Matrix4d.java
Matrix4d.lookAlong
public Matrix4d lookAlong(double dirX, double dirY, double dirZ, double upX, double upY, double upZ) { return lookAlong(dirX, dirY, dirZ, upX, upY, upZ, this); }
java
public Matrix4d lookAlong(double dirX, double dirY, double dirZ, double upX, double upY, double upZ) { return lookAlong(dirX, dirY, dirZ, upX, upY, upZ, this); }
[ "public", "Matrix4d", "lookAlong", "(", "double", "dirX", ",", "double", "dirY", ",", "double", "dirZ", ",", "double", "upX", ",", "double", "upY", ",", "double", "upZ", ")", "{", "return", "lookAlong", "(", "dirX", ",", "dirY", ",", "dirZ", ",", "upX"...
Apply a rotation transformation to this matrix to make <code>-z</code> point along <code>dir</code>. <p> If <code>M</code> is <code>this</code> matrix and <code>L</code> the lookalong rotation matrix, then the new matrix will be <code>M * L</code>. So when transforming a vector <code>v</code> with the new matrix by using <code>M * L * v</code>, the lookalong rotation transformation will be applied first! <p> This is equivalent to calling {@link #lookAt(double, double, double, double, double, double, double, double, double) lookAt()} with <code>eye = (0, 0, 0)</code> and <code>center = dir</code>. <p> In order to set the matrix to a lookalong transformation without post-multiplying it, use {@link #setLookAlong(double, double, double, double, double, double) setLookAlong()} @see #lookAt(double, double, double, double, double, double, double, double, double) @see #setLookAlong(double, double, double, double, double, double) @param dirX the x-coordinate of the direction to look along @param dirY the y-coordinate of the direction to look along @param dirZ the z-coordinate of the direction to look along @param upX the x-coordinate of the up vector @param upY the y-coordinate of the up vector @param upZ the z-coordinate of the up vector @return this
[ "Apply", "a", "rotation", "transformation", "to", "this", "matrix", "to", "make", "<code", ">", "-", "z<", "/", "code", ">", "point", "along", "<code", ">", "dir<", "/", "code", ">", ".", "<p", ">", "If", "<code", ">", "M<", "/", "code", ">", "is",...
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4d.java#L10992-L10995
Azure/azure-sdk-for-java
applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/implementation/ExportConfigurationsInner.java
ExportConfigurationsInner.updateAsync
public Observable<ApplicationInsightsComponentExportConfigurationInner> updateAsync(String resourceGroupName, String resourceName, String exportId, ApplicationInsightsComponentExportRequest exportProperties) { return updateWithServiceResponseAsync(resourceGroupName, resourceName, exportId, exportProperties).map(new Func1<ServiceResponse<ApplicationInsightsComponentExportConfigurationInner>, ApplicationInsightsComponentExportConfigurationInner>() { @Override public ApplicationInsightsComponentExportConfigurationInner call(ServiceResponse<ApplicationInsightsComponentExportConfigurationInner> response) { return response.body(); } }); }
java
public Observable<ApplicationInsightsComponentExportConfigurationInner> updateAsync(String resourceGroupName, String resourceName, String exportId, ApplicationInsightsComponentExportRequest exportProperties) { return updateWithServiceResponseAsync(resourceGroupName, resourceName, exportId, exportProperties).map(new Func1<ServiceResponse<ApplicationInsightsComponentExportConfigurationInner>, ApplicationInsightsComponentExportConfigurationInner>() { @Override public ApplicationInsightsComponentExportConfigurationInner call(ServiceResponse<ApplicationInsightsComponentExportConfigurationInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ApplicationInsightsComponentExportConfigurationInner", ">", "updateAsync", "(", "String", "resourceGroupName", ",", "String", "resourceName", ",", "String", "exportId", ",", "ApplicationInsightsComponentExportRequest", "exportProperties", ")", "{",...
Update the Continuous Export configuration for this export id. @param resourceGroupName The name of the resource group. @param resourceName The name of the Application Insights component resource. @param exportId The Continuous Export configuration ID. This is unique within a Application Insights component. @param exportProperties Properties that need to be specified to update the Continuous Export configuration. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ApplicationInsightsComponentExportConfigurationInner object
[ "Update", "the", "Continuous", "Export", "configuration", "for", "this", "export", "id", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/implementation/ExportConfigurationsInner.java#L490-L497
redlink-gmbh/redlink-java-sdk
src/main/java/io/redlink/sdk/impl/analysis/model/RDFStructureParser.java
RDFStructureParser.parseDocumentSentiment
public Double parseDocumentSentiment() throws EnhancementParserException { RepositoryConnection conn = null; try { conn = repository.getConnection(); conn.begin(); String documentSentimentQuery = "PREFIX fise: <http://fise.iks-project.eu/ontology/> \n" + "PREFIX dct: <http://purl.org/dc/terms/> \n" + "SELECT ?docSent { \n" + " ?annotation a fise:TextAnnotation . \n" + " ?annotation dct:type fise:DocumentSentiment . \n" + " ?annotation fise:sentiment ?docSent \n" + "}"; TupleQueryResult documentSentimentAnnotationsResults = conn.prepareTupleQuery( QueryLanguage.SPARQL, documentSentimentQuery).evaluate(); final Double docSentiment; if(documentSentimentAnnotationsResults.hasNext()) { BindingSet result = documentSentimentAnnotationsResults.next(); docSentiment = Double.parseDouble(result.getBinding("docSent").getValue().stringValue()); } else { docSentiment = null; } documentSentimentAnnotationsResults.close(); conn.commit(); return docSentiment; } catch (QueryEvaluationException | MalformedQueryException e) { throw new EnhancementParserException("Error parsing text annotations", e); } catch (RepositoryException e) { throw new EnhancementParserException("Error querying the RDF Model obtained as Service Response", e); } finally { if(conn != null){ try { conn.close(); } catch (RepositoryException e) {/*ignore*/} } } }
java
public Double parseDocumentSentiment() throws EnhancementParserException { RepositoryConnection conn = null; try { conn = repository.getConnection(); conn.begin(); String documentSentimentQuery = "PREFIX fise: <http://fise.iks-project.eu/ontology/> \n" + "PREFIX dct: <http://purl.org/dc/terms/> \n" + "SELECT ?docSent { \n" + " ?annotation a fise:TextAnnotation . \n" + " ?annotation dct:type fise:DocumentSentiment . \n" + " ?annotation fise:sentiment ?docSent \n" + "}"; TupleQueryResult documentSentimentAnnotationsResults = conn.prepareTupleQuery( QueryLanguage.SPARQL, documentSentimentQuery).evaluate(); final Double docSentiment; if(documentSentimentAnnotationsResults.hasNext()) { BindingSet result = documentSentimentAnnotationsResults.next(); docSentiment = Double.parseDouble(result.getBinding("docSent").getValue().stringValue()); } else { docSentiment = null; } documentSentimentAnnotationsResults.close(); conn.commit(); return docSentiment; } catch (QueryEvaluationException | MalformedQueryException e) { throw new EnhancementParserException("Error parsing text annotations", e); } catch (RepositoryException e) { throw new EnhancementParserException("Error querying the RDF Model obtained as Service Response", e); } finally { if(conn != null){ try { conn.close(); } catch (RepositoryException e) {/*ignore*/} } } }
[ "public", "Double", "parseDocumentSentiment", "(", ")", "throws", "EnhancementParserException", "{", "RepositoryConnection", "conn", "=", "null", ";", "try", "{", "conn", "=", "repository", ".", "getConnection", "(", ")", ";", "conn", ".", "begin", "(", ")", "...
Returns the Sentiment for the processed document or <code>null</code> if no Sentiment analysis component is configured for the analysis. @return the Document Sentiment or <code>null</code> if not available @throws EnhancementParserException
[ "Returns", "the", "Sentiment", "for", "the", "processed", "document", "or", "<code", ">", "null<", "/", "code", ">", "if", "no", "Sentiment", "analysis", "component", "is", "configured", "for", "the", "analysis", "." ]
train
https://github.com/redlink-gmbh/redlink-java-sdk/blob/c412ff11bd80da52ade09f2483ab29cdbff5a28a/src/main/java/io/redlink/sdk/impl/analysis/model/RDFStructureParser.java#L878-L914
sarl/sarl
contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyGenerator.java
PyGenerator._generate
protected void _generate(SarlInterface interf, IExtraLanguageGeneratorContext context) { final JvmDeclaredType jvmType = getJvmModelAssociations().getInferredType(interf); final PyAppendable appendable = createAppendable(jvmType, context); if (generateTypeDeclaration( this.qualifiedNameProvider.getFullyQualifiedName(interf).toString(), interf.getName(), true, interf.getExtends(), getTypeBuilder().getDocumentation(interf), true, interf.getMembers(), appendable, context, null)) { final QualifiedName name = getQualifiedNameProvider().getFullyQualifiedName(interf); writeFile(name, appendable, context); } }
java
protected void _generate(SarlInterface interf, IExtraLanguageGeneratorContext context) { final JvmDeclaredType jvmType = getJvmModelAssociations().getInferredType(interf); final PyAppendable appendable = createAppendable(jvmType, context); if (generateTypeDeclaration( this.qualifiedNameProvider.getFullyQualifiedName(interf).toString(), interf.getName(), true, interf.getExtends(), getTypeBuilder().getDocumentation(interf), true, interf.getMembers(), appendable, context, null)) { final QualifiedName name = getQualifiedNameProvider().getFullyQualifiedName(interf); writeFile(name, appendable, context); } }
[ "protected", "void", "_generate", "(", "SarlInterface", "interf", ",", "IExtraLanguageGeneratorContext", "context", ")", "{", "final", "JvmDeclaredType", "jvmType", "=", "getJvmModelAssociations", "(", ")", ".", "getInferredType", "(", "interf", ")", ";", "final", "...
Generate the given object. @param interf the interface. @param context the context.
[ "Generate", "the", "given", "object", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyGenerator.java#L692-L704
grails/grails-core
grails-core/src/main/groovy/grails/util/AbstractTypeConvertingMap.java
AbstractTypeConvertingMap.getDate
public Date getDate(String name, String format) { Object value = get(name); if (value instanceof Date) { return (Date)value; } if (value != null) { try { return new SimpleDateFormat(format).parse(value.toString()); } catch (ParseException e) { // ignore } } return null; }
java
public Date getDate(String name, String format) { Object value = get(name); if (value instanceof Date) { return (Date)value; } if (value != null) { try { return new SimpleDateFormat(format).parse(value.toString()); } catch (ParseException e) { // ignore } } return null; }
[ "public", "Date", "getDate", "(", "String", "name", ",", "String", "format", ")", "{", "Object", "value", "=", "get", "(", "name", ")", ";", "if", "(", "value", "instanceof", "Date", ")", "{", "return", "(", "Date", ")", "value", ";", "}", "if", "(...
Obtains a date from the parameter using the given format @param name The name @param format The format @return The date or null
[ "Obtains", "a", "date", "from", "the", "parameter", "using", "the", "given", "format" ]
train
https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-core/src/main/groovy/grails/util/AbstractTypeConvertingMap.java#L365-L379
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/parser/lexparser/AbstractTreebankParserParams.java
AbstractTreebankParserParams.parsevalObjectify
public static Collection<Constituent> parsevalObjectify(Tree t, TreeTransformer collinizer, boolean labelConstituents) { Collection<Constituent> spans = new ArrayList<Constituent>(); Tree t1 = collinizer.transformTree(t); if (t1 == null) { return spans; } for (Tree node : t1) { if (node.isLeaf() || node.isPreTerminal() || (node != t1 && node.parent(t1) == null)) { continue; } int leftEdge = t1.leftCharEdge(node); int rightEdge = t1.rightCharEdge(node); if(labelConstituents) spans.add(new LabeledConstituent(leftEdge, rightEdge, node.label())); else spans.add(new SimpleConstituent(leftEdge, rightEdge)); } return spans; }
java
public static Collection<Constituent> parsevalObjectify(Tree t, TreeTransformer collinizer, boolean labelConstituents) { Collection<Constituent> spans = new ArrayList<Constituent>(); Tree t1 = collinizer.transformTree(t); if (t1 == null) { return spans; } for (Tree node : t1) { if (node.isLeaf() || node.isPreTerminal() || (node != t1 && node.parent(t1) == null)) { continue; } int leftEdge = t1.leftCharEdge(node); int rightEdge = t1.rightCharEdge(node); if(labelConstituents) spans.add(new LabeledConstituent(leftEdge, rightEdge, node.label())); else spans.add(new SimpleConstituent(leftEdge, rightEdge)); } return spans; }
[ "public", "static", "Collection", "<", "Constituent", ">", "parsevalObjectify", "(", "Tree", "t", ",", "TreeTransformer", "collinizer", ",", "boolean", "labelConstituents", ")", "{", "Collection", "<", "Constituent", ">", "spans", "=", "new", "ArrayList", "<", "...
Takes a Tree and a collinizer and returns a Collection of {@link Constituent}s for PARSEVAL evaluation. Some notes on this particular parseval: <ul> <li> It is character-based, which allows it to be used on segmentation/parsing combination evaluation. <li> whether it gives you labeled or unlabeled bracketings depends on the value of the <code>labelConstituents</code> parameter </ul> (Note that I haven't checked this rigorously yet with the PARSEVAL definition -- Roger.)
[ "Takes", "a", "Tree", "and", "a", "collinizer", "and", "returns", "a", "Collection", "of", "{", "@link", "Constituent", "}", "s", "for", "PARSEVAL", "evaluation", ".", "Some", "notes", "on", "this", "particular", "parseval", ":", "<ul", ">", "<li", ">", ...
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/parser/lexparser/AbstractTreebankParserParams.java#L320-L338
deeplearning4j/deeplearning4j
nd4j/nd4j-common/src/main/java/org/nd4j/linalg/util/Rational.java
Rational.compareTo
public int compareTo(final BigInteger val) { final Rational val2 = new Rational(val, BigInteger.ONE); return (compareTo(val2)); }
java
public int compareTo(final BigInteger val) { final Rational val2 = new Rational(val, BigInteger.ONE); return (compareTo(val2)); }
[ "public", "int", "compareTo", "(", "final", "BigInteger", "val", ")", "{", "final", "Rational", "val2", "=", "new", "Rational", "(", "val", ",", "BigInteger", ".", "ONE", ")", ";", "return", "(", "compareTo", "(", "val2", ")", ")", ";", "}" ]
Compares the value of this with another constant. @param val the other constant to compare with @return -1, 0 or 1 if this number is numerically less than, equal to, or greater than val.
[ "Compares", "the", "value", "of", "this", "with", "another", "constant", "." ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-common/src/main/java/org/nd4j/linalg/util/Rational.java#L441-L444
codeprimate-software/cp-elements
src/main/java/org/cp/elements/util/sort/support/HeapSort.java
HeapSort.siftDown
protected <E> void siftDown(final List<E> elements, final int startIndex, final int endIndex) { int rootIndex = startIndex; while ((rootIndex * 2 + 1) <= endIndex) { int swapIndex = rootIndex; int leftChildIndex = (rootIndex * 2 + 1); int rightChildIndex = (leftChildIndex + 1); if (getOrderBy().compare(elements.get(swapIndex), elements.get(leftChildIndex)) < 0) { swapIndex = leftChildIndex; } if (rightChildIndex <= endIndex && getOrderBy().compare(elements.get(swapIndex), elements.get(rightChildIndex)) < 0) { swapIndex = rightChildIndex; } if (swapIndex != rootIndex) { swap(elements, rootIndex, swapIndex); rootIndex = swapIndex; } else { return; } } }
java
protected <E> void siftDown(final List<E> elements, final int startIndex, final int endIndex) { int rootIndex = startIndex; while ((rootIndex * 2 + 1) <= endIndex) { int swapIndex = rootIndex; int leftChildIndex = (rootIndex * 2 + 1); int rightChildIndex = (leftChildIndex + 1); if (getOrderBy().compare(elements.get(swapIndex), elements.get(leftChildIndex)) < 0) { swapIndex = leftChildIndex; } if (rightChildIndex <= endIndex && getOrderBy().compare(elements.get(swapIndex), elements.get(rightChildIndex)) < 0) { swapIndex = rightChildIndex; } if (swapIndex != rootIndex) { swap(elements, rootIndex, swapIndex); rootIndex = swapIndex; } else { return; } } }
[ "protected", "<", "E", ">", "void", "siftDown", "(", "final", "List", "<", "E", ">", "elements", ",", "final", "int", "startIndex", ",", "final", "int", "endIndex", ")", "{", "int", "rootIndex", "=", "startIndex", ";", "while", "(", "(", "rootIndex", "...
Creates a binary heap with the list of elements with the largest valued element at the root followed by the next largest valued elements as parents down to the leafs. @param <E> the Class type of the elements in the List. @param elements the List of elements to heapify. @param startIndex an integer value indicating the starting index in the heap in the List of elements. @param endIndex an integer value indicating the ending index in the heap in the List of elements.
[ "Creates", "a", "binary", "heap", "with", "the", "list", "of", "elements", "with", "the", "largest", "valued", "element", "at", "the", "root", "followed", "by", "the", "next", "largest", "valued", "elements", "as", "parents", "down", "to", "the", "leafs", ...
train
https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/util/sort/support/HeapSort.java#L75-L99
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/features/StyleUtils.java
StyleUtils.createMarkerOptions
public static MarkerOptions createMarkerOptions(FeatureStyleExtension featureStyleExtension, FeatureRow featureRow, float density) { MarkerOptions markerOptions = new MarkerOptions(); setFeatureStyle(markerOptions, featureStyleExtension, featureRow, density); return markerOptions; }
java
public static MarkerOptions createMarkerOptions(FeatureStyleExtension featureStyleExtension, FeatureRow featureRow, float density) { MarkerOptions markerOptions = new MarkerOptions(); setFeatureStyle(markerOptions, featureStyleExtension, featureRow, density); return markerOptions; }
[ "public", "static", "MarkerOptions", "createMarkerOptions", "(", "FeatureStyleExtension", "featureStyleExtension", ",", "FeatureRow", "featureRow", ",", "float", "density", ")", "{", "MarkerOptions", "markerOptions", "=", "new", "MarkerOptions", "(", ")", ";", "setFeatu...
Create new marker options populated with the feature row style (icon or style) @param featureStyleExtension feature style extension @param featureRow feature row @param density display density: {@link android.util.DisplayMetrics#density} @return marker options populated with the feature style
[ "Create", "new", "marker", "options", "populated", "with", "the", "feature", "row", "style", "(", "icon", "or", "style", ")" ]
train
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/features/StyleUtils.java#L94-L100
socialsensor/socialsensor-framework-client
src/main/java/eu/socialsensor/framework/client/search/visual/VisualIndexHandler.java
VisualIndexHandler.getSimilarImagesAndIndex
public JsonResultSet getSimilarImagesAndIndex(String id, double[] vector, double threshold) { JsonResultSet similar = new JsonResultSet(); byte[] vectorInBytes = new byte[8 * vector.length]; ByteBuffer bbuf = ByteBuffer.wrap(vectorInBytes); for (double value : vector) { bbuf.putDouble(value); } PostMethod queryMethod = null; String response = null; try { ByteArrayPartSource source = new ByteArrayPartSource("bytes", vectorInBytes); Part[] parts = { new StringPart("id", id), new FilePart("vector", source), new StringPart("threshold", String.valueOf(threshold)) }; queryMethod = new PostMethod(webServiceHost + "/rest/visual/qindex/" + collectionName); queryMethod.setRequestEntity(new MultipartRequestEntity(parts, queryMethod.getParams())); int code = httpClient.executeMethod(queryMethod); if (code == 200) { InputStream inputStream = queryMethod.getResponseBodyAsStream(); StringWriter writer = new StringWriter(); IOUtils.copy(inputStream, writer); response = writer.toString(); queryMethod.releaseConnection(); similar = parseResponse(response); } } catch (Exception e) { _logger.error("Exception for vector of length " + vector.length, e); response = null; } finally { if (queryMethod != null) { queryMethod.releaseConnection(); } } return similar; }
java
public JsonResultSet getSimilarImagesAndIndex(String id, double[] vector, double threshold) { JsonResultSet similar = new JsonResultSet(); byte[] vectorInBytes = new byte[8 * vector.length]; ByteBuffer bbuf = ByteBuffer.wrap(vectorInBytes); for (double value : vector) { bbuf.putDouble(value); } PostMethod queryMethod = null; String response = null; try { ByteArrayPartSource source = new ByteArrayPartSource("bytes", vectorInBytes); Part[] parts = { new StringPart("id", id), new FilePart("vector", source), new StringPart("threshold", String.valueOf(threshold)) }; queryMethod = new PostMethod(webServiceHost + "/rest/visual/qindex/" + collectionName); queryMethod.setRequestEntity(new MultipartRequestEntity(parts, queryMethod.getParams())); int code = httpClient.executeMethod(queryMethod); if (code == 200) { InputStream inputStream = queryMethod.getResponseBodyAsStream(); StringWriter writer = new StringWriter(); IOUtils.copy(inputStream, writer); response = writer.toString(); queryMethod.releaseConnection(); similar = parseResponse(response); } } catch (Exception e) { _logger.error("Exception for vector of length " + vector.length, e); response = null; } finally { if (queryMethod != null) { queryMethod.releaseConnection(); } } return similar; }
[ "public", "JsonResultSet", "getSimilarImagesAndIndex", "(", "String", "id", ",", "double", "[", "]", "vector", ",", "double", "threshold", ")", "{", "JsonResultSet", "similar", "=", "new", "JsonResultSet", "(", ")", ";", "byte", "[", "]", "vectorInBytes", "=",...
Get similar images by vector @param vector @param threshold @return
[ "Get", "similar", "images", "by", "vector" ]
train
https://github.com/socialsensor/socialsensor-framework-client/blob/67cd45c5d8e096d5f76ace49f453ff6438920473/src/main/java/eu/socialsensor/framework/client/search/visual/VisualIndexHandler.java#L267-L308
petergeneric/stdlib
stdlib/src/main/java/com/peterphi/std/threading/Daemon.java
Daemon.startThread
public synchronized Thread startThread(String name) throws IllegalThreadStateException { if (!running) { log.info("[Daemon] {startThread} Starting thread " + name); this.running = true; thisThread = new Thread(this, name); thisThread.setDaemon(shouldStartAsDaemon()); // Set whether we're a daemon thread (false by default) thisThread.start(); return thisThread; } else { throw new IllegalThreadStateException("Daemon must be stopped before it may be started"); } }
java
public synchronized Thread startThread(String name) throws IllegalThreadStateException { if (!running) { log.info("[Daemon] {startThread} Starting thread " + name); this.running = true; thisThread = new Thread(this, name); thisThread.setDaemon(shouldStartAsDaemon()); // Set whether we're a daemon thread (false by default) thisThread.start(); return thisThread; } else { throw new IllegalThreadStateException("Daemon must be stopped before it may be started"); } }
[ "public", "synchronized", "Thread", "startThread", "(", "String", "name", ")", "throws", "IllegalThreadStateException", "{", "if", "(", "!", "running", ")", "{", "log", ".", "info", "(", "\"[Daemon] {startThread} Starting thread \"", "+", "name", ")", ";", "this",...
Starts this daemon, creating a new thread for it @param name String The name for the thread @return Thread The daemon's thread @throws IllegalThreadStateException If the daemon is still running
[ "Starts", "this", "daemon", "creating", "a", "new", "thread", "for", "it" ]
train
https://github.com/petergeneric/stdlib/blob/d4025d2f881bc0542b1e004c5f65a1ccaf895836/stdlib/src/main/java/com/peterphi/std/threading/Daemon.java#L75-L90
alkacon/opencms-core
src/org/opencms/xml/content/CmsDefaultXmlContentHandler.java
CmsDefaultXmlContentHandler.addSearchSetting
protected void addSearchSetting(CmsXmlContentDefinition contentDefinition, String elementName, Boolean value) throws CmsXmlException { if (contentDefinition.getSchemaType(elementName) == null) { throw new CmsXmlException( Messages.get().container(Messages.ERR_XMLCONTENT_INVALID_ELEM_SEARCHSETTINGS_1, elementName)); } // store the search exclusion as defined m_searchSettings.put(elementName, value); }
java
protected void addSearchSetting(CmsXmlContentDefinition contentDefinition, String elementName, Boolean value) throws CmsXmlException { if (contentDefinition.getSchemaType(elementName) == null) { throw new CmsXmlException( Messages.get().container(Messages.ERR_XMLCONTENT_INVALID_ELEM_SEARCHSETTINGS_1, elementName)); } // store the search exclusion as defined m_searchSettings.put(elementName, value); }
[ "protected", "void", "addSearchSetting", "(", "CmsXmlContentDefinition", "contentDefinition", ",", "String", "elementName", ",", "Boolean", "value", ")", "throws", "CmsXmlException", "{", "if", "(", "contentDefinition", ".", "getSchemaType", "(", "elementName", ")", "...
Adds a search setting for an element.<p> @param contentDefinition the XML content definition this XML content handler belongs to @param elementName the element name to map @param value the search setting value to store @throws CmsXmlException in case an unknown element name is used
[ "Adds", "a", "search", "setting", "for", "an", "element", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/content/CmsDefaultXmlContentHandler.java#L2101-L2110
powermock/powermock
powermock-api/powermock-api-easymock/src/main/java/org/powermock/api/easymock/PowerMock.java
PowerMock.mockStaticPartial
public static synchronized void mockStaticPartial(Class<?> clazz, String... methodNames) { mockStatic(clazz, Whitebox.getMethods(clazz, methodNames)); }
java
public static synchronized void mockStaticPartial(Class<?> clazz, String... methodNames) { mockStatic(clazz, Whitebox.getMethods(clazz, methodNames)); }
[ "public", "static", "synchronized", "void", "mockStaticPartial", "(", "Class", "<", "?", ">", "clazz", ",", "String", "...", "methodNames", ")", "{", "mockStatic", "(", "clazz", ",", "Whitebox", ".", "getMethods", "(", "clazz", ",", "methodNames", ")", ")", ...
A utility method that may be used to mock several <b>static</b> methods in an easy way (by just passing in the method names of the method you wish to mock). Note that you cannot uniquely specify a method to mock using this method if there are several methods with the same name in {@code type}. This method will mock ALL methods that match the supplied name regardless of parameter types and signature. If this is the case you should fall-back on using the {@link #mockStatic(Class, Method...)} method instead. @param clazz The class that contains the static methods that should be mocked. @param methodNames The names of the methods that should be mocked. If {@code null}, then this method will have the same effect as just calling {@link #mockStatic(Class, Method...)} with the second parameter as {@code new Method[0]} (i.e. all methods in that class will be mocked).
[ "A", "utility", "method", "that", "may", "be", "used", "to", "mock", "several", "<b", ">", "static<", "/", "b", ">", "methods", "in", "an", "easy", "way", "(", "by", "just", "passing", "in", "the", "method", "names", "of", "the", "method", "you", "wi...
train
https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-api/powermock-api-easymock/src/main/java/org/powermock/api/easymock/PowerMock.java#L569-L571
jhunters/jprotobuf
v3/src/main/java/com/baidu/bjf/remoting/protobuf/code/CodedConstant.java
CodedConstant.getFiledType
public static String getFiledType(FieldType type, boolean isList) { if ((type == FieldType.STRING || type == FieldType.BYTES) && !isList) { return "com.google.protobuf.ByteString"; } // add null check String defineType = type.getJavaType(); if (isList) { defineType = "List"; } return defineType; }
java
public static String getFiledType(FieldType type, boolean isList) { if ((type == FieldType.STRING || type == FieldType.BYTES) && !isList) { return "com.google.protobuf.ByteString"; } // add null check String defineType = type.getJavaType(); if (isList) { defineType = "List"; } return defineType; }
[ "public", "static", "String", "getFiledType", "(", "FieldType", "type", ",", "boolean", "isList", ")", "{", "if", "(", "(", "type", "==", "FieldType", ".", "STRING", "||", "type", "==", "FieldType", ".", "BYTES", ")", "&&", "!", "isList", ")", "{", "re...
Gets the filed type. @param type the type @param isList the is list @return the filed type
[ "Gets", "the", "filed", "type", "." ]
train
https://github.com/jhunters/jprotobuf/blob/55832c9b4792afb128e5b35139d8a3891561d8a3/v3/src/main/java/com/baidu/bjf/remoting/protobuf/code/CodedConstant.java#L179-L192
xiancloud/xian
xian-oauth20/xian-apifestOauth20/src/main/java/com/apifest/oauth20/ScopeService.java
ScopeService.scopeAllowed
public boolean scopeAllowed(String scope, String allowedScopes) { String[] allScopes = allowedScopes.split(SPACE); List<String> allowedList = Arrays.asList(allScopes); String[] scopes = scope.split(SPACE); int allowedCount = 0; for (String s : scopes) { if (allowedList.contains(s)) { allowedCount++; } } return (allowedCount == scopes.length); }
java
public boolean scopeAllowed(String scope, String allowedScopes) { String[] allScopes = allowedScopes.split(SPACE); List<String> allowedList = Arrays.asList(allScopes); String[] scopes = scope.split(SPACE); int allowedCount = 0; for (String s : scopes) { if (allowedList.contains(s)) { allowedCount++; } } return (allowedCount == scopes.length); }
[ "public", "boolean", "scopeAllowed", "(", "String", "scope", ",", "String", "allowedScopes", ")", "{", "String", "[", "]", "allScopes", "=", "allowedScopes", ".", "split", "(", "SPACE", ")", ";", "List", "<", "String", ">", "allowedList", "=", "Arrays", "....
Checks whether a scope is contained in allowed scopes. @param scope scope to be checked @param allowedScopes all allowed scopes @return true if the scope is allowed, otherwise false
[ "Checks", "whether", "a", "scope", "is", "contained", "in", "allowed", "scopes", "." ]
train
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-oauth20/xian-apifestOauth20/src/main/java/com/apifest/oauth20/ScopeService.java#L160-L171
phax/ph-poi
src/main/java/com/helger/poi/excel/WorkbookCreationHelper.java
WorkbookCreationHelper.addMergeRegionInCurrentRow
public int addMergeRegionInCurrentRow (@Nonnegative final int nFirstCol, @Nonnegative final int nLastCol) { final int nCurrentRowIndex = getRowIndex (); return addMergeRegion (nCurrentRowIndex, nCurrentRowIndex, nFirstCol, nLastCol); }
java
public int addMergeRegionInCurrentRow (@Nonnegative final int nFirstCol, @Nonnegative final int nLastCol) { final int nCurrentRowIndex = getRowIndex (); return addMergeRegion (nCurrentRowIndex, nCurrentRowIndex, nFirstCol, nLastCol); }
[ "public", "int", "addMergeRegionInCurrentRow", "(", "@", "Nonnegative", "final", "int", "nFirstCol", ",", "@", "Nonnegative", "final", "int", "nLastCol", ")", "{", "final", "int", "nCurrentRowIndex", "=", "getRowIndex", "(", ")", ";", "return", "addMergeRegion", ...
Add a merge region in the current row. Note: only the content of the first cell is used as the content of the merged cell! @param nFirstCol First column to be merged (inclusive). 0-based @param nLastCol Last column to be merged (inclusive). 0-based, must be larger than {@code nFirstCol} @return index of this region
[ "Add", "a", "merge", "region", "in", "the", "current", "row", ".", "Note", ":", "only", "the", "content", "of", "the", "first", "cell", "is", "used", "as", "the", "content", "of", "the", "merged", "cell!" ]
train
https://github.com/phax/ph-poi/blob/908c5dd434739e6989cf88e55bea48f2f18c6996/src/main/java/com/helger/poi/excel/WorkbookCreationHelper.java#L440-L444
nemerosa/ontrack
ontrack-extension-svn/src/main/java/net/nemerosa/ontrack/extension/svn/property/SVNBranchConfigurationPropertyType.java
SVNBranchConfigurationPropertyType.canEdit
@Override public boolean canEdit(ProjectEntity entity, SecurityService securityService) { return securityService.isProjectFunctionGranted(entity.projectId(), ProjectConfig.class) && propertyService.hasProperty( entity.getProject(), SVNProjectConfigurationPropertyType.class); }
java
@Override public boolean canEdit(ProjectEntity entity, SecurityService securityService) { return securityService.isProjectFunctionGranted(entity.projectId(), ProjectConfig.class) && propertyService.hasProperty( entity.getProject(), SVNProjectConfigurationPropertyType.class); }
[ "@", "Override", "public", "boolean", "canEdit", "(", "ProjectEntity", "entity", ",", "SecurityService", "securityService", ")", "{", "return", "securityService", ".", "isProjectFunctionGranted", "(", "entity", ".", "projectId", "(", ")", ",", "ProjectConfig", ".", ...
One can edit the SVN configuration of a branch only if he can configurure a project and if the project is itself configured with SVN.
[ "One", "can", "edit", "the", "SVN", "configuration", "of", "a", "branch", "only", "if", "he", "can", "configurure", "a", "project", "and", "if", "the", "project", "is", "itself", "configured", "with", "SVN", "." ]
train
https://github.com/nemerosa/ontrack/blob/37b0874cbf387b58aba95cd3c1bc3b15e11bc913/ontrack-extension-svn/src/main/java/net/nemerosa/ontrack/extension/svn/property/SVNBranchConfigurationPropertyType.java#L60-L66
jsurfer/JsonSurfer
jsurfer-core/src/main/java/org/jsfr/json/JsonSurfer.java
JsonSurfer.createResumableParser
public ResumableParser createResumableParser(String json, SurfingConfiguration configuration) { ensureSetting(configuration); return jsonParserAdapter.createResumableParser(json, new SurfingContext(configuration)); }
java
public ResumableParser createResumableParser(String json, SurfingConfiguration configuration) { ensureSetting(configuration); return jsonParserAdapter.createResumableParser(json, new SurfingContext(configuration)); }
[ "public", "ResumableParser", "createResumableParser", "(", "String", "json", ",", "SurfingConfiguration", "configuration", ")", "{", "ensureSetting", "(", "configuration", ")", ";", "return", "jsonParserAdapter", ".", "createResumableParser", "(", "json", ",", "new", ...
Create resumable parser @param json Json source @param configuration SurfingConfiguration @return Resumable parser
[ "Create", "resumable", "parser" ]
train
https://github.com/jsurfer/JsonSurfer/blob/52bd75a453338b86e115092803da140bf99cee62/jsurfer-core/src/main/java/org/jsfr/json/JsonSurfer.java#L212-L215
alkacon/opencms-core
src/org/opencms/xml/types/CmsXmlVfsImageValue.java
CmsXmlVfsImageValue.getParameterValue
private String getParameterValue(CmsObject cms, String key) { if (m_parameters == null) { m_parameters = getParameterMap(getStringValue(cms)); } return getParameterValue(cms, m_parameters, key); }
java
private String getParameterValue(CmsObject cms, String key) { if (m_parameters == null) { m_parameters = getParameterMap(getStringValue(cms)); } return getParameterValue(cms, m_parameters, key); }
[ "private", "String", "getParameterValue", "(", "CmsObject", "cms", ",", "String", "key", ")", "{", "if", "(", "m_parameters", "==", "null", ")", "{", "m_parameters", "=", "getParameterMap", "(", "getStringValue", "(", "cms", ")", ")", ";", "}", "return", "...
Returns the value of the given parameter name from the current parameter map.<p> @param cms the current users context @param key the parameter name @return the value of the parameter or an empty String
[ "Returns", "the", "value", "of", "the", "given", "parameter", "name", "from", "the", "current", "parameter", "map", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/types/CmsXmlVfsImageValue.java#L366-L372
before/quality-check
modules/quality-check/src/main/java/net/sf/qualitycheck/Check.java
Check.noNullElements
@ArgumentsChecked @Throws({ IllegalNullArgumentException.class, IllegalNullElementsException.class }) public static <T> T[] noNullElements(@Nonnull final T[] array) { return noNullElements(array, EMPTY_ARGUMENT_NAME); }
java
@ArgumentsChecked @Throws({ IllegalNullArgumentException.class, IllegalNullElementsException.class }) public static <T> T[] noNullElements(@Nonnull final T[] array) { return noNullElements(array, EMPTY_ARGUMENT_NAME); }
[ "@", "ArgumentsChecked", "@", "Throws", "(", "{", "IllegalNullArgumentException", ".", "class", ",", "IllegalNullElementsException", ".", "class", "}", ")", "public", "static", "<", "T", ">", "T", "[", "]", "noNullElements", "(", "@", "Nonnull", "final", "T", ...
Ensures that an array does not contain {@code null}. <p> We recommend to use the overloaded method {@link Check#noNullElements(Object[], String)} and pass as second argument the name of the parameter to enhance the exception message. @param array reference to an array @return the passed reference which contains no elements that are {@code null} @throws IllegalNullElementsException if the given argument {@code array} contains {@code null}
[ "Ensures", "that", "an", "array", "does", "not", "contain", "{", "@code", "null", "}", "." ]
train
https://github.com/before/quality-check/blob/a75c32c39434ddb1f89bece57acae0536724c15a/modules/quality-check/src/main/java/net/sf/qualitycheck/Check.java#L1867-L1871
jbundle/jbundle
base/remote/src/main/java/org/jbundle/base/remote/proxy/TaskHolder.java
TaskHolder.getNextIntParam
public int getNextIntParam(InputStream in, String strName, Map<String, Object> properties) { return m_proxyTask.getNextIntParam(in, strName, properties); }
java
public int getNextIntParam(InputStream in, String strName, Map<String, Object> properties) { return m_proxyTask.getNextIntParam(in, strName, properties); }
[ "public", "int", "getNextIntParam", "(", "InputStream", "in", ",", "String", "strName", ",", "Map", "<", "String", ",", "Object", ">", "properties", ")", "{", "return", "m_proxyTask", ".", "getNextIntParam", "(", "in", ",", "strName", ",", "properties", ")",...
Get the next (String) param. @param strName The param name (in most implementations this is optional). @return The next param as a string.
[ "Get", "the", "next", "(", "String", ")", "param", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/remote/src/main/java/org/jbundle/base/remote/proxy/TaskHolder.java#L183-L186
OpenLiberty/open-liberty
dev/com.ibm.ws.logging.hpel/src/com/ibm/websphere/logging/hpel/reader/HpelCBEFormatter.java
HpelCBEFormatter.createExtendedElement
private void createExtendedElement(StringBuilder sb, String edeName, String edeType, String edeValues) { sb.append(lineSeparator).append(INDENT[0]).append("<extendedDataElements name=\"").append(edeName).append("\" type=\"").append(edeType).append("\">"); sb.append(lineSeparator).append(INDENT[1]).append("<values>").append(edeValues).append("</values>"); sb.append(lineSeparator).append(INDENT[0]).append("</extendedDataElements>"); }
java
private void createExtendedElement(StringBuilder sb, String edeName, String edeType, String edeValues) { sb.append(lineSeparator).append(INDENT[0]).append("<extendedDataElements name=\"").append(edeName).append("\" type=\"").append(edeType).append("\">"); sb.append(lineSeparator).append(INDENT[1]).append("<values>").append(edeValues).append("</values>"); sb.append(lineSeparator).append(INDENT[0]).append("</extendedDataElements>"); }
[ "private", "void", "createExtendedElement", "(", "StringBuilder", "sb", ",", "String", "edeName", ",", "String", "edeType", ",", "String", "edeValues", ")", "{", "sb", ".", "append", "(", "lineSeparator", ")", ".", "append", "(", "INDENT", "[", "0", "]", "...
Prints and extendedDataElement for CBE output Formatter's time zone. @param sb the string buffer the element will be added to @param edeName the name of the extendedDataElement. @param edeType the data type for the extendedDataElement value(s). @param edeValues the values for this extendedDataElement.
[ "Prints", "and", "extendedDataElement", "for", "CBE", "output", "Formatter", "s", "time", "zone", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/websphere/logging/hpel/reader/HpelCBEFormatter.java#L280-L284
fuinorg/event-store-commons
spi/src/main/java/org/fuin/esc/spi/Data.java
Data.unmarshalContent
@SuppressWarnings("unchecked") public final <T> T unmarshalContent(final JAXBContext ctx) { if (!(isJson() || isXml() || isText())) { throw new IllegalStateException( "Can only unmarshal JSON, XML or TEXT content, not: " + mimeType); } // We can only handle JSON... if (isJson()) { try { try (final JsonReader reader = Json.createReader(new StringReader(content))) { return (T) reader.readObject(); } } catch (final RuntimeException ex) { throw new RuntimeException( "Error parsing json content: '" + content + "'", ex); } } // ...or XML if (isXml()) { try { return unmarshal(ctx, content, null); } catch (final RuntimeException ex) { throw new RuntimeException( "Error parsing xml content: '" + content + "'", ex); } } // ...or TEXT return (T) content; }
java
@SuppressWarnings("unchecked") public final <T> T unmarshalContent(final JAXBContext ctx) { if (!(isJson() || isXml() || isText())) { throw new IllegalStateException( "Can only unmarshal JSON, XML or TEXT content, not: " + mimeType); } // We can only handle JSON... if (isJson()) { try { try (final JsonReader reader = Json.createReader(new StringReader(content))) { return (T) reader.readObject(); } } catch (final RuntimeException ex) { throw new RuntimeException( "Error parsing json content: '" + content + "'", ex); } } // ...or XML if (isXml()) { try { return unmarshal(ctx, content, null); } catch (final RuntimeException ex) { throw new RuntimeException( "Error parsing xml content: '" + content + "'", ex); } } // ...or TEXT return (T) content; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "final", "<", "T", ">", "T", "unmarshalContent", "(", "final", "JAXBContext", "ctx", ")", "{", "if", "(", "!", "(", "isJson", "(", ")", "||", "isXml", "(", ")", "||", "isText", "(", ")", "...
Unmarshals the content into an object. Content is required to be "application/xml", "application/json" or "text/plain". @param ctx In case the XML JAXB unmarshalling is used, you have to pass the JAXB context here. @return Object created from content. @param <T> Type expected to be returned.
[ "Unmarshals", "the", "content", "into", "an", "object", ".", "Content", "is", "required", "to", "be", "application", "/", "xml", "application", "/", "json", "or", "text", "/", "plain", "." ]
train
https://github.com/fuinorg/event-store-commons/blob/ea175582d8cda2b5a6d2fe52bbb2f1c183eee77c/spi/src/main/java/org/fuin/esc/spi/Data.java#L174-L204
buschmais/jqa-core-framework
rule/src/main/java/com/buschmais/jqassistant/core/rule/api/executor/RuleSetExecutor.java
RuleSetExecutor.getEffectiveSeverity
private Severity getEffectiveSeverity(SeverityRule rule, Severity parentSeverity, Severity requestedSeverity) { Severity effectiveSeverity = requestedSeverity != null ? requestedSeverity : parentSeverity; return effectiveSeverity != null ? effectiveSeverity : rule.getSeverity(); }
java
private Severity getEffectiveSeverity(SeverityRule rule, Severity parentSeverity, Severity requestedSeverity) { Severity effectiveSeverity = requestedSeverity != null ? requestedSeverity : parentSeverity; return effectiveSeverity != null ? effectiveSeverity : rule.getSeverity(); }
[ "private", "Severity", "getEffectiveSeverity", "(", "SeverityRule", "rule", ",", "Severity", "parentSeverity", ",", "Severity", "requestedSeverity", ")", "{", "Severity", "effectiveSeverity", "=", "requestedSeverity", "!=", "null", "?", "requestedSeverity", ":", "parent...
Determines the effective severity for a rule to be executed. @param rule The rule. @param parentSeverity The severity inherited from the parent group. @param requestedSeverity The severity as specified on the rule in the parent group. @return The effective severity.
[ "Determines", "the", "effective", "severity", "for", "a", "rule", "to", "be", "executed", "." ]
train
https://github.com/buschmais/jqa-core-framework/blob/0e63ff509cfe52f9063539a23d5f9f183b2ea4a5/rule/src/main/java/com/buschmais/jqassistant/core/rule/api/executor/RuleSetExecutor.java#L132-L135
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RelativeDateTimeFormatter.java
RelativeDateTimeFormatter.getInstance
public static RelativeDateTimeFormatter getInstance(Locale locale, NumberFormat nf) { return getInstance(ULocale.forLocale(locale), nf); }
java
public static RelativeDateTimeFormatter getInstance(Locale locale, NumberFormat nf) { return getInstance(ULocale.forLocale(locale), nf); }
[ "public", "static", "RelativeDateTimeFormatter", "getInstance", "(", "Locale", "locale", ",", "NumberFormat", "nf", ")", "{", "return", "getInstance", "(", "ULocale", ".", "forLocale", "(", "locale", ")", ",", "nf", ")", ";", "}" ]
Returns a RelativeDateTimeFormatter for a particular {@link java.util.Locale} that uses a particular NumberFormat object. @param locale the {@link java.util.Locale} @param nf the number format object. It is defensively copied to ensure thread-safety and immutability of this class. @return An instance of RelativeDateTimeFormatter.
[ "Returns", "a", "RelativeDateTimeFormatter", "for", "a", "particular", "{", "@link", "java", ".", "util", ".", "Locale", "}", "that", "uses", "a", "particular", "NumberFormat", "object", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RelativeDateTimeFormatter.java#L441-L443
aragozin/jvm-tools
sjk-win32/src/main/java/org/gridkit/jvmtool/win32/SjkWinHelper.java
SjkWinHelper.getProcessCpuTimes
public synchronized boolean getProcessCpuTimes(int pid, long[] result) { int rc = GetProcessTimes(pid, callBuf); if (rc == 0) { long ktime = (0xFFFFFFFFl & callBuf[4]) | ((long)callBuf[5]) << 32; long utime = (0xFFFFFFFFl & callBuf[6]) | ((long)callBuf[7]) << 32; result[0] = ktime / 10; result[1] = utime / 10; return true; } else { System.out.println("Error code: " + rc); return false; } }
java
public synchronized boolean getProcessCpuTimes(int pid, long[] result) { int rc = GetProcessTimes(pid, callBuf); if (rc == 0) { long ktime = (0xFFFFFFFFl & callBuf[4]) | ((long)callBuf[5]) << 32; long utime = (0xFFFFFFFFl & callBuf[6]) | ((long)callBuf[7]) << 32; result[0] = ktime / 10; result[1] = utime / 10; return true; } else { System.out.println("Error code: " + rc); return false; } }
[ "public", "synchronized", "boolean", "getProcessCpuTimes", "(", "int", "pid", ",", "long", "[", "]", "result", ")", "{", "int", "rc", "=", "GetProcessTimes", "(", "pid", ",", "callBuf", ")", ";", "if", "(", "rc", "==", "0", ")", "{", "long", "ktime", ...
Call kernel32::GetProcessTimes. If successful kernel and user times are set to first two slots in array. <p> Time units are microseconds. @param pid @return <code>false</code> is not successful
[ "Call", "kernel32", "::", "GetProcessTimes", ".", "If", "successful", "kernel", "and", "user", "times", "are", "set", "to", "first", "two", "slots", "in", "array", ".", "<p", ">", "Time", "units", "are", "microseconds", "." ]
train
https://github.com/aragozin/jvm-tools/blob/d3a4d0c6a47fb9317f274988569655f30dcd2f76/sjk-win32/src/main/java/org/gridkit/jvmtool/win32/SjkWinHelper.java#L85-L99
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/charset/CharsetHelper.java
CharsetHelper.getInputStreamAndCharsetFromBOM
@Nonnull public static InputStreamAndCharset getInputStreamAndCharsetFromBOM (@Nonnull @WillNotClose final InputStream aIS) { ValueEnforcer.notNull (aIS, "InputStream"); // Check for BOM final int nMaxBOMBytes = EUnicodeBOM.getMaximumByteCount (); @WillNotClose final NonBlockingPushbackInputStream aPIS = new NonBlockingPushbackInputStream (StreamHelper.getBuffered (aIS), nMaxBOMBytes); try { // Try to read as many bytes as necessary to determine all supported BOMs final byte [] aBOM = new byte [nMaxBOMBytes]; final int nReadBOMBytes = aPIS.read (aBOM); EUnicodeBOM eBOM = null; Charset aDeterminedCharset = null; if (nReadBOMBytes > 0) { // Some byte BOMs were read - determine eBOM = EUnicodeBOM.getFromBytesOrNull (ArrayHelper.getCopy (aBOM, 0, nReadBOMBytes)); if (eBOM == null) { // Unread the whole BOM aPIS.unread (aBOM, 0, nReadBOMBytes); // aDeterminedCharset stays null } else { if (LOGGER.isDebugEnabled ()) LOGGER.debug ("Found " + eBOM + " on " + aIS.getClass ().getName ()); // Unread the unnecessary parts of the BOM final int nBOMBytes = eBOM.getByteCount (); if (nBOMBytes < nReadBOMBytes) aPIS.unread (aBOM, nBOMBytes, nReadBOMBytes - nBOMBytes); // Use the Charset of the BOM - maybe null! aDeterminedCharset = eBOM.getCharset (); } } return new InputStreamAndCharset (aPIS, eBOM, aDeterminedCharset); } catch (final IOException ex) { LOGGER.error ("Failed to determine BOM", ex); StreamHelper.close (aPIS); throw new UncheckedIOException (ex); } }
java
@Nonnull public static InputStreamAndCharset getInputStreamAndCharsetFromBOM (@Nonnull @WillNotClose final InputStream aIS) { ValueEnforcer.notNull (aIS, "InputStream"); // Check for BOM final int nMaxBOMBytes = EUnicodeBOM.getMaximumByteCount (); @WillNotClose final NonBlockingPushbackInputStream aPIS = new NonBlockingPushbackInputStream (StreamHelper.getBuffered (aIS), nMaxBOMBytes); try { // Try to read as many bytes as necessary to determine all supported BOMs final byte [] aBOM = new byte [nMaxBOMBytes]; final int nReadBOMBytes = aPIS.read (aBOM); EUnicodeBOM eBOM = null; Charset aDeterminedCharset = null; if (nReadBOMBytes > 0) { // Some byte BOMs were read - determine eBOM = EUnicodeBOM.getFromBytesOrNull (ArrayHelper.getCopy (aBOM, 0, nReadBOMBytes)); if (eBOM == null) { // Unread the whole BOM aPIS.unread (aBOM, 0, nReadBOMBytes); // aDeterminedCharset stays null } else { if (LOGGER.isDebugEnabled ()) LOGGER.debug ("Found " + eBOM + " on " + aIS.getClass ().getName ()); // Unread the unnecessary parts of the BOM final int nBOMBytes = eBOM.getByteCount (); if (nBOMBytes < nReadBOMBytes) aPIS.unread (aBOM, nBOMBytes, nReadBOMBytes - nBOMBytes); // Use the Charset of the BOM - maybe null! aDeterminedCharset = eBOM.getCharset (); } } return new InputStreamAndCharset (aPIS, eBOM, aDeterminedCharset); } catch (final IOException ex) { LOGGER.error ("Failed to determine BOM", ex); StreamHelper.close (aPIS); throw new UncheckedIOException (ex); } }
[ "@", "Nonnull", "public", "static", "InputStreamAndCharset", "getInputStreamAndCharsetFromBOM", "(", "@", "Nonnull", "@", "WillNotClose", "final", "InputStream", "aIS", ")", "{", "ValueEnforcer", ".", "notNull", "(", "aIS", ",", "\"InputStream\"", ")", ";", "// Chec...
If a BOM is present in the {@link InputStream} it is read and if possible the charset is automatically determined from the BOM. @param aIS The input stream to use. May not be <code>null</code>. @return Never <code>null</code>. Always use the input stream contained in the returned object and never the one passed in as a parameter, because the returned IS is a push-back InputStream that has a couple of bytes already buffered!
[ "If", "a", "BOM", "is", "present", "in", "the", "{", "@link", "InputStream", "}", "it", "is", "read", "and", "if", "possible", "the", "charset", "is", "automatically", "determined", "from", "the", "BOM", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/charset/CharsetHelper.java#L310-L359
steveash/jopenfst
src/main/java/com/github/steveash/jopenfst/FstInputOutput.java
FstInputOutput.readFstFromBinaryStream
public static MutableFst readFstFromBinaryStream(ObjectInput in) throws IOException, ClassNotFoundException { int version = in.readInt(); if (version < FIRST_VERSION && version > CURRENT_VERSION) { throw new IllegalArgumentException("cant read version fst model " + version); } MutableSymbolTable is = readStringMap(in); MutableSymbolTable os = readStringMap(in); MutableSymbolTable ss = null; if (in.readBoolean()) { ss = readStringMap(in); } return readFstWithTables(in, is, os, ss); }
java
public static MutableFst readFstFromBinaryStream(ObjectInput in) throws IOException, ClassNotFoundException { int version = in.readInt(); if (version < FIRST_VERSION && version > CURRENT_VERSION) { throw new IllegalArgumentException("cant read version fst model " + version); } MutableSymbolTable is = readStringMap(in); MutableSymbolTable os = readStringMap(in); MutableSymbolTable ss = null; if (in.readBoolean()) { ss = readStringMap(in); } return readFstWithTables(in, is, os, ss); }
[ "public", "static", "MutableFst", "readFstFromBinaryStream", "(", "ObjectInput", "in", ")", "throws", "IOException", ",", "ClassNotFoundException", "{", "int", "version", "=", "in", ".", "readInt", "(", ")", ";", "if", "(", "version", "<", "FIRST_VERSION", "&&",...
Deserializes an Fst from an ObjectInput @param in the ObjectInput. It should be already be initialized by the caller.
[ "Deserializes", "an", "Fst", "from", "an", "ObjectInput" ]
train
https://github.com/steveash/jopenfst/blob/4c675203015c1cfad2072556cb532b6edc73261d/src/main/java/com/github/steveash/jopenfst/FstInputOutput.java#L77-L92
alkacon/opencms-core
src/org/opencms/search/fields/CmsSearchFieldConfiguration.java
CmsSearchFieldConfiguration.getLocaleExtendedName
public static final String getLocaleExtendedName(String lookup, Locale locale) { if (locale == null) { return lookup; } return getLocaleExtendedName(lookup, locale.toString()); }
java
public static final String getLocaleExtendedName(String lookup, Locale locale) { if (locale == null) { return lookup; } return getLocaleExtendedName(lookup, locale.toString()); }
[ "public", "static", "final", "String", "getLocaleExtendedName", "(", "String", "lookup", ",", "Locale", "locale", ")", "{", "if", "(", "locale", "==", "null", ")", "{", "return", "lookup", ";", "}", "return", "getLocaleExtendedName", "(", "lookup", ",", "loc...
Returns the locale extended name for the given lookup String.<p> @param lookup the lookup String @param locale the locale @return the locale extended name for the given lookup String
[ "Returns", "the", "locale", "extended", "name", "for", "the", "given", "lookup", "String", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/fields/CmsSearchFieldConfiguration.java#L95-L101
tango-controls/JTango
server/src/main/java/org/tango/server/properties/AttributePropertiesManager.java
AttributePropertiesManager.setAttributePropertyInDB
public void setAttributePropertyInDB(final String attributeName, final String propertyName, final String value) throws DevFailed { xlogger.entry(propertyName); // insert value in db only if input value is different and not a // default value // if (checkCurrentValue) { // final String presentValue = getAttributePropertyFromDB(attributeName, propertyName); // final boolean isADefaultValue = presentValue.isEmpty() // && (value.equalsIgnoreCase(AttributePropertiesImpl.NOT_SPECIFIED) // || value.equalsIgnoreCase(AttributePropertiesImpl.NO_DIPLAY_UNIT) // || value.equalsIgnoreCase(AttributePropertiesImpl.NO_UNIT) || value // .equalsIgnoreCase(AttributePropertiesImpl.NO_STD_UNIT)); // if (!isADefaultValue && !presentValue.equals(value) && !value.isEmpty() && !value.equals("NaN")) { // LOGGER.debug("update in DB {}, property {}= {}", new Object[] { attributeName, propertyName, value }); // final Map<String, String[]> propInsert = new HashMap<String, String[]>(); // propInsert.put(propertyName, new String[] { value }); // DatabaseFactory.getDatabase().setAttributeProperties(deviceName, attributeName, propInsert); // } // } else { logger.debug("update in DB {}, property {}= {}", new Object[] { attributeName, propertyName, value }); final Map<String, String[]> propInsert = new HashMap<String, String[]>(); propInsert.put(propertyName, new String[] { value }); DatabaseFactory.getDatabase().setAttributeProperties(deviceName, attributeName, propInsert); // } xlogger.exit(); }
java
public void setAttributePropertyInDB(final String attributeName, final String propertyName, final String value) throws DevFailed { xlogger.entry(propertyName); // insert value in db only if input value is different and not a // default value // if (checkCurrentValue) { // final String presentValue = getAttributePropertyFromDB(attributeName, propertyName); // final boolean isADefaultValue = presentValue.isEmpty() // && (value.equalsIgnoreCase(AttributePropertiesImpl.NOT_SPECIFIED) // || value.equalsIgnoreCase(AttributePropertiesImpl.NO_DIPLAY_UNIT) // || value.equalsIgnoreCase(AttributePropertiesImpl.NO_UNIT) || value // .equalsIgnoreCase(AttributePropertiesImpl.NO_STD_UNIT)); // if (!isADefaultValue && !presentValue.equals(value) && !value.isEmpty() && !value.equals("NaN")) { // LOGGER.debug("update in DB {}, property {}= {}", new Object[] { attributeName, propertyName, value }); // final Map<String, String[]> propInsert = new HashMap<String, String[]>(); // propInsert.put(propertyName, new String[] { value }); // DatabaseFactory.getDatabase().setAttributeProperties(deviceName, attributeName, propInsert); // } // } else { logger.debug("update in DB {}, property {}= {}", new Object[] { attributeName, propertyName, value }); final Map<String, String[]> propInsert = new HashMap<String, String[]>(); propInsert.put(propertyName, new String[] { value }); DatabaseFactory.getDatabase().setAttributeProperties(deviceName, attributeName, propInsert); // } xlogger.exit(); }
[ "public", "void", "setAttributePropertyInDB", "(", "final", "String", "attributeName", ",", "final", "String", "propertyName", ",", "final", "String", "value", ")", "throws", "DevFailed", "{", "xlogger", ".", "entry", "(", "propertyName", ")", ";", "// insert valu...
Set attribute property in tango db @param attributeName @param propertyName @param value @throws DevFailed
[ "Set", "attribute", "property", "in", "tango", "db" ]
train
https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/server/properties/AttributePropertiesManager.java#L134-L160
lessthanoptimal/ejml
main/ejml-dsparse/src/org/ejml/sparse/csc/CommonOps_DSCC.java
CommonOps_DSCC.multTransB
public static void multTransB(DMatrixSparseCSC A , DMatrixSparseCSC B , DMatrixSparseCSC C , @Nullable IGrowArray gw, @Nullable DGrowArray gx ) { if( A.numCols != B.numCols ) throw new MatrixDimensionException("Inconsistent matrix shapes. "+stringShapes(A,B)); C.reshape(A.numRows,B.numRows); if( !B.isIndicesSorted() ) B.sortIndices(null); ImplSparseSparseMult_DSCC.multTransB(A,B,C,gw,gx); }
java
public static void multTransB(DMatrixSparseCSC A , DMatrixSparseCSC B , DMatrixSparseCSC C , @Nullable IGrowArray gw, @Nullable DGrowArray gx ) { if( A.numCols != B.numCols ) throw new MatrixDimensionException("Inconsistent matrix shapes. "+stringShapes(A,B)); C.reshape(A.numRows,B.numRows); if( !B.isIndicesSorted() ) B.sortIndices(null); ImplSparseSparseMult_DSCC.multTransB(A,B,C,gw,gx); }
[ "public", "static", "void", "multTransB", "(", "DMatrixSparseCSC", "A", ",", "DMatrixSparseCSC", "B", ",", "DMatrixSparseCSC", "C", ",", "@", "Nullable", "IGrowArray", "gw", ",", "@", "Nullable", "DGrowArray", "gx", ")", "{", "if", "(", "A", ".", "numCols", ...
Performs matrix multiplication. C = A*B<sup>T</sup>. B needs to be sorted and will be sorted if it has not already been sorted. @param A (Input) Matrix. Not modified. @param B (Input) Matrix. Value not modified but indicies will be sorted if not sorted already. @param C (Output) Storage for results. Data length is increased if increased if insufficient. @param gw (Optional) Storage for internal workspace. Can be null. @param gx (Optional) Storage for internal workspace. Can be null.
[ "Performs", "matrix", "multiplication", ".", "C", "=", "A", "*", "B<sup", ">", "T<", "/", "sup", ">", ".", "B", "needs", "to", "be", "sorted", "and", "will", "be", "sorted", "if", "it", "has", "not", "already", "been", "sorted", "." ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-dsparse/src/org/ejml/sparse/csc/CommonOps_DSCC.java#L174-L185
wso2/transport-http
components/org.wso2.transport.http.netty/src/main/java/org/wso2/transport/http/netty/contractimpl/listener/HttpServerChannelInitializer.java
HttpServerChannelInitializer.configureH2cPipeline
private void configureH2cPipeline(ChannelPipeline pipeline) { // Add handler to handle http2 requests without an upgrade pipeline.addLast(new Http2WithPriorKnowledgeHandler( interfaceId, serverName, serverConnectorFuture, this)); // Add http2 upgrade decoder and upgrade handler final HttpServerCodec sourceCodec = new HttpServerCodec(reqSizeValidationConfig.getMaxUriLength(), reqSizeValidationConfig.getMaxHeaderSize(), reqSizeValidationConfig.getMaxChunkSize()); final HttpServerUpgradeHandler.UpgradeCodecFactory upgradeCodecFactory = protocol -> { if (AsciiString.contentEquals(Http2CodecUtil.HTTP_UPGRADE_PROTOCOL_NAME, protocol)) { return new Http2ServerUpgradeCodec( Constants.HTTP2_SOURCE_CONNECTION_HANDLER, new Http2SourceConnectionHandlerBuilder( interfaceId, serverConnectorFuture, serverName, this).build()); } else { return null; } }; pipeline.addLast(Constants.HTTP_SERVER_CODEC, sourceCodec); pipeline.addLast(Constants.HTTP_COMPRESSOR, new CustomHttpContentCompressor()); if (httpTraceLogEnabled) { pipeline.addLast(HTTP_TRACE_LOG_HANDLER, new HttpTraceLoggingHandler(TRACE_LOG_DOWNSTREAM)); } if (httpAccessLogEnabled) { pipeline.addLast(HTTP_ACCESS_LOG_HANDLER, new HttpAccessLoggingHandler(ACCESS_LOG)); } pipeline.addLast(Constants.HTTP2_UPGRADE_HANDLER, new HttpServerUpgradeHandler(sourceCodec, upgradeCodecFactory, Integer.MAX_VALUE)); /* Max size of the upgrade request is limited to 2GB. Need to see whether there is a better approach to handle large upgrade requests. Requests will be propagated to next handlers if no upgrade has been attempted */ pipeline.addLast(Constants.HTTP2_TO_HTTP_FALLBACK_HANDLER, new Http2ToHttpFallbackHandler(this)); }
java
private void configureH2cPipeline(ChannelPipeline pipeline) { // Add handler to handle http2 requests without an upgrade pipeline.addLast(new Http2WithPriorKnowledgeHandler( interfaceId, serverName, serverConnectorFuture, this)); // Add http2 upgrade decoder and upgrade handler final HttpServerCodec sourceCodec = new HttpServerCodec(reqSizeValidationConfig.getMaxUriLength(), reqSizeValidationConfig.getMaxHeaderSize(), reqSizeValidationConfig.getMaxChunkSize()); final HttpServerUpgradeHandler.UpgradeCodecFactory upgradeCodecFactory = protocol -> { if (AsciiString.contentEquals(Http2CodecUtil.HTTP_UPGRADE_PROTOCOL_NAME, protocol)) { return new Http2ServerUpgradeCodec( Constants.HTTP2_SOURCE_CONNECTION_HANDLER, new Http2SourceConnectionHandlerBuilder( interfaceId, serverConnectorFuture, serverName, this).build()); } else { return null; } }; pipeline.addLast(Constants.HTTP_SERVER_CODEC, sourceCodec); pipeline.addLast(Constants.HTTP_COMPRESSOR, new CustomHttpContentCompressor()); if (httpTraceLogEnabled) { pipeline.addLast(HTTP_TRACE_LOG_HANDLER, new HttpTraceLoggingHandler(TRACE_LOG_DOWNSTREAM)); } if (httpAccessLogEnabled) { pipeline.addLast(HTTP_ACCESS_LOG_HANDLER, new HttpAccessLoggingHandler(ACCESS_LOG)); } pipeline.addLast(Constants.HTTP2_UPGRADE_HANDLER, new HttpServerUpgradeHandler(sourceCodec, upgradeCodecFactory, Integer.MAX_VALUE)); /* Max size of the upgrade request is limited to 2GB. Need to see whether there is a better approach to handle large upgrade requests. Requests will be propagated to next handlers if no upgrade has been attempted */ pipeline.addLast(Constants.HTTP2_TO_HTTP_FALLBACK_HANDLER, new Http2ToHttpFallbackHandler(this)); }
[ "private", "void", "configureH2cPipeline", "(", "ChannelPipeline", "pipeline", ")", "{", "// Add handler to handle http2 requests without an upgrade", "pipeline", ".", "addLast", "(", "new", "Http2WithPriorKnowledgeHandler", "(", "interfaceId", ",", "serverName", ",", "server...
Configures HTTP/2 clear text pipeline. @param pipeline the channel pipeline
[ "Configures", "HTTP", "/", "2", "clear", "text", "pipeline", "." ]
train
https://github.com/wso2/transport-http/blob/c51aa715b473db6c1b82a7d7b22f6e65f74df4c9/components/org.wso2.transport.http.netty/src/main/java/org/wso2/transport/http/netty/contractimpl/listener/HttpServerChannelInitializer.java#L237-L271
looly/hutool
hutool-log/src/main/java/cn/hutool/log/dialect/slf4j/Slf4jLog.java
Slf4jLog.locationAwareLog
private boolean locationAwareLog(int level_int, String msgTemplate, Object[] arguments) { return locationAwareLog(level_int, null, msgTemplate, arguments); }
java
private boolean locationAwareLog(int level_int, String msgTemplate, Object[] arguments) { return locationAwareLog(level_int, null, msgTemplate, arguments); }
[ "private", "boolean", "locationAwareLog", "(", "int", "level_int", ",", "String", "msgTemplate", ",", "Object", "[", "]", "arguments", ")", "{", "return", "locationAwareLog", "(", "level_int", ",", "null", ",", "msgTemplate", ",", "arguments", ")", ";", "}" ]
打印日志<br> 此方法用于兼容底层日志实现,通过传入当前包装类名,以解决打印日志中行号错误问题 @param level_int 日志级别,使用LocationAwareLogger中的常量 @param msgTemplate 消息模板 @param arguments 参数 @return 是否支持 LocationAwareLogger对象,如果不支持需要日志方法调用被包装类的相应方法
[ "打印日志<br", ">", "此方法用于兼容底层日志实现,通过传入当前包装类名,以解决打印日志中行号错误问题" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-log/src/main/java/cn/hutool/log/dialect/slf4j/Slf4jLog.java#L187-L189
Azure/azure-sdk-for-java
sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerAzureADAdministratorsInner.java
ServerAzureADAdministratorsInner.beginDeleteAsync
public Observable<ServerAzureADAdministratorInner> beginDeleteAsync(String resourceGroupName, String serverName) { return beginDeleteWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1<ServiceResponse<ServerAzureADAdministratorInner>, ServerAzureADAdministratorInner>() { @Override public ServerAzureADAdministratorInner call(ServiceResponse<ServerAzureADAdministratorInner> response) { return response.body(); } }); }
java
public Observable<ServerAzureADAdministratorInner> beginDeleteAsync(String resourceGroupName, String serverName) { return beginDeleteWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1<ServiceResponse<ServerAzureADAdministratorInner>, ServerAzureADAdministratorInner>() { @Override public ServerAzureADAdministratorInner call(ServiceResponse<ServerAzureADAdministratorInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ServerAzureADAdministratorInner", ">", "beginDeleteAsync", "(", "String", "resourceGroupName", ",", "String", "serverName", ")", "{", "return", "beginDeleteWithServiceResponseAsync", "(", "resourceGroupName", ",", "serverName", ")", ".", "map...
Deletes an existing server Active Directory Administrator. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ServerAzureADAdministratorInner object
[ "Deletes", "an", "existing", "server", "Active", "Directory", "Administrator", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerAzureADAdministratorsInner.java#L366-L373
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/classfile/MethodUtils.java
MethodUtils.addMethods
private static void addMethods(Set<MethodEntry> methods, Class<?> clazz, Map<String, Class<?>> types, Class<?> parent) { // validate interface if (!clazz.isInterface()) { throw new IllegalStateException("class must be interface: " + clazz); } // loop through each method (only those declared) for (Method method : clazz.getDeclaredMethods()) { addMethods(methods, clazz, types, parent, method); } // recursively add each super interface providing type info if valid addParentMethods(methods, clazz, types, parent, null); }
java
private static void addMethods(Set<MethodEntry> methods, Class<?> clazz, Map<String, Class<?>> types, Class<?> parent) { // validate interface if (!clazz.isInterface()) { throw new IllegalStateException("class must be interface: " + clazz); } // loop through each method (only those declared) for (Method method : clazz.getDeclaredMethods()) { addMethods(methods, clazz, types, parent, method); } // recursively add each super interface providing type info if valid addParentMethods(methods, clazz, types, parent, null); }
[ "private", "static", "void", "addMethods", "(", "Set", "<", "MethodEntry", ">", "methods", ",", "Class", "<", "?", ">", "clazz", ",", "Map", "<", "String", ",", "Class", "<", "?", ">", ">", "types", ",", "Class", "<", "?", ">", "parent", ")", "{", ...
Recursive method that adds all applicable methods for the given class, which is expected to be an interface. The tree is walked for the class and all super interfaces in recursive fashion to get each available method. Any method that is already defined by the given parent will be ignored. Otherwise, the method, including any required bridged methods will be added. The specified list of types define the optional type parameters of the given interface class. These types will propogate up the tree as necessary for any super-interfaces that match. @param methods The set of existing methods @param clazz The current interface class @param types The set of named type variable @param parent The optional parent class
[ "Recursive", "method", "that", "adds", "all", "applicable", "methods", "for", "the", "given", "class", "which", "is", "expected", "to", "be", "an", "interface", ".", "The", "tree", "is", "walked", "for", "the", "class", "and", "all", "super", "interfaces", ...
train
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/classfile/MethodUtils.java#L330-L346
googleads/googleads-java-lib
examples/adwords_axis/src/main/java/adwords/axis/v201809/optimization/EstimateKeywordTraffic.java
EstimateKeywordTraffic.calculateMean
private static Double calculateMean(Number min, Number max) { if (min == null || max == null) { return null; } return (min.doubleValue() + max.doubleValue()) / 2; }
java
private static Double calculateMean(Number min, Number max) { if (min == null || max == null) { return null; } return (min.doubleValue() + max.doubleValue()) / 2; }
[ "private", "static", "Double", "calculateMean", "(", "Number", "min", ",", "Number", "max", ")", "{", "if", "(", "min", "==", "null", "||", "max", "==", "null", ")", "{", "return", "null", ";", "}", "return", "(", "min", ".", "doubleValue", "(", ")",...
Returns the mean of the two Number values if neither is null, else returns null.
[ "Returns", "the", "mean", "of", "the", "two", "Number", "values", "if", "neither", "is", "null", "else", "returns", "null", "." ]
train
https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/examples/adwords_axis/src/main/java/adwords/axis/v201809/optimization/EstimateKeywordTraffic.java#L293-L298
aol/cyclops
cyclops/src/main/java/com/oath/cyclops/util/ExceptionSoftener.java
ExceptionSoftener.throwOrHandle
public static <X extends Throwable> void throwOrHandle(final X e, final Predicate<X> p, final Consumer<X> handler) { if (p.test(e)) throw ExceptionSoftener.<RuntimeException> uncheck(e); else handler.accept(e); }
java
public static <X extends Throwable> void throwOrHandle(final X e, final Predicate<X> p, final Consumer<X> handler) { if (p.test(e)) throw ExceptionSoftener.<RuntimeException> uncheck(e); else handler.accept(e); }
[ "public", "static", "<", "X", "extends", "Throwable", ">", "void", "throwOrHandle", "(", "final", "X", "e", ",", "final", "Predicate", "<", "X", ">", "p", ",", "final", "Consumer", "<", "X", ">", "handler", ")", "{", "if", "(", "p", ".", "test", "(...
Throw the exception as upwards if the predicate holds, otherwise pass to the handler @param e Exception @param p Predicate to check exception should be thrown or not @param handler Handles exceptions that should not be thrown
[ "Throw", "the", "exception", "as", "upwards", "if", "the", "predicate", "holds", "otherwise", "pass", "to", "the", "handler" ]
train
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/com/oath/cyclops/util/ExceptionSoftener.java#L692-L697
mpetazzoni/ttorrent
common/src/main/java/com/turn/ttorrent/common/creation/MetadataBuilder.java
MetadataBuilder.addDataSource
public MetadataBuilder addDataSource(@NotNull InputStream dataSource, String path) { addDataSource(dataSource, path, true); return this; }
java
public MetadataBuilder addDataSource(@NotNull InputStream dataSource, String path) { addDataSource(dataSource, path, true); return this; }
[ "public", "MetadataBuilder", "addDataSource", "(", "@", "NotNull", "InputStream", "dataSource", ",", "String", "path", ")", "{", "addDataSource", "(", "dataSource", ",", "path", ",", "true", ")", ";", "return", "this", ";", "}" ]
add custom source in torrent with custom path. Path can be separated with any slash.
[ "add", "custom", "source", "in", "torrent", "with", "custom", "path", ".", "Path", "can", "be", "separated", "with", "any", "slash", "." ]
train
https://github.com/mpetazzoni/ttorrent/blob/ecd0e6caf853b63393c4ab63cfd8f20114f73f70/common/src/main/java/com/turn/ttorrent/common/creation/MetadataBuilder.java#L207-L210
pravega/pravega
segmentstore/storage/impl/src/main/java/io/pravega/segmentstore/storage/impl/bookkeeper/HierarchyUtils.java
HierarchyUtils.getPath
static String getPath(int nodeId, int depth) { StringBuilder pathBuilder = new StringBuilder(); int value = nodeId; for (int i = 0; i < depth; i++) { int r = value % DIVISOR; value = value / DIVISOR; pathBuilder.append(SEPARATOR).append(r); } return pathBuilder.append(SEPARATOR).append(nodeId).toString(); }
java
static String getPath(int nodeId, int depth) { StringBuilder pathBuilder = new StringBuilder(); int value = nodeId; for (int i = 0; i < depth; i++) { int r = value % DIVISOR; value = value / DIVISOR; pathBuilder.append(SEPARATOR).append(r); } return pathBuilder.append(SEPARATOR).append(nodeId).toString(); }
[ "static", "String", "getPath", "(", "int", "nodeId", ",", "int", "depth", ")", "{", "StringBuilder", "pathBuilder", "=", "new", "StringBuilder", "(", ")", ";", "int", "value", "=", "nodeId", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "dept...
Gets a hierarchical path using the value of nodeId to construct the intermediate paths. Examples: * nodeId = 1234, depth = 3 -> /4/3/2/1234 * nodeId = 1234, depth = 0 -> /1234 * nodeId = 1234, depth = 6 -> /4/3/2/1/0/0/1234 @param nodeId The node id to create the path for. @param depth The hierarchy depth (0 means flat). @return The hierarchical path.
[ "Gets", "a", "hierarchical", "path", "using", "the", "value", "of", "nodeId", "to", "construct", "the", "intermediate", "paths", ".", "Examples", ":", "*", "nodeId", "=", "1234", "depth", "=", "3", "-", ">", "/", "4", "/", "3", "/", "2", "/", "1234",...
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/storage/impl/src/main/java/io/pravega/segmentstore/storage/impl/bookkeeper/HierarchyUtils.java#L37-L47
wisdom-framework/wisdom
core/wisdom-api/src/main/java/org/wisdom/api/http/Result.java
Result.render
public Result render(String padding, JsonNode node) { this.content = new RenderableJsonP(padding, node); setContentType(MimeTypes.JAVASCRIPT); charset = Charsets.UTF_8; return this; }
java
public Result render(String padding, JsonNode node) { this.content = new RenderableJsonP(padding, node); setContentType(MimeTypes.JAVASCRIPT); charset = Charsets.UTF_8; return this; }
[ "public", "Result", "render", "(", "String", "padding", ",", "JsonNode", "node", ")", "{", "this", ".", "content", "=", "new", "RenderableJsonP", "(", "padding", ",", "node", ")", ";", "setContentType", "(", "MimeTypes", ".", "JAVASCRIPT", ")", ";", "chars...
Sets the content of the current result to the JSONP response using the given padding (callback). It also sets the content-type header to JavaScript and the charset to UTF-8. @param node the content @return the current result
[ "Sets", "the", "content", "of", "the", "current", "result", "to", "the", "JSONP", "response", "using", "the", "given", "padding", "(", "callback", ")", ".", "It", "also", "sets", "the", "content", "-", "type", "header", "to", "JavaScript", "and", "the", ...
train
https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-api/src/main/java/org/wisdom/api/http/Result.java#L141-L146
alkacon/opencms-core
src-modules/org/opencms/workplace/tools/projects/CmsPublishProjectReport.java
CmsPublishProjectReport.startValidationThread
private void startValidationThread(CmsPublishList publishList) throws JspException { try { CmsRelationsValidatorThread thread = new CmsRelationsValidatorThread(getCms(), publishList, getSettings()); thread.start(); setParamThread(thread.getUUID().toString()); setParamThreadHasNext(CmsStringUtil.TRUE); setParamAction(REPORT_BEGIN); // set the key name for the continue checkbox setParamReportContinueKey(Messages.GUI_PUBLISH_CONTINUE_BROKEN_LINKS_0); } catch (Throwable e) { // error while link validation, show error screen includeErrorpage(this, e); } }
java
private void startValidationThread(CmsPublishList publishList) throws JspException { try { CmsRelationsValidatorThread thread = new CmsRelationsValidatorThread(getCms(), publishList, getSettings()); thread.start(); setParamThread(thread.getUUID().toString()); setParamThreadHasNext(CmsStringUtil.TRUE); setParamAction(REPORT_BEGIN); // set the key name for the continue checkbox setParamReportContinueKey(Messages.GUI_PUBLISH_CONTINUE_BROKEN_LINKS_0); } catch (Throwable e) { // error while link validation, show error screen includeErrorpage(this, e); } }
[ "private", "void", "startValidationThread", "(", "CmsPublishList", "publishList", ")", "throws", "JspException", "{", "try", "{", "CmsRelationsValidatorThread", "thread", "=", "new", "CmsRelationsValidatorThread", "(", "getCms", "(", ")", ",", "publishList", ",", "get...
Starts the link validation thread for the project.<p> @param publishList the list of resources to publish @throws JspException if something goes wrong
[ "Starts", "the", "link", "validation", "thread", "for", "the", "project", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/tools/projects/CmsPublishProjectReport.java#L215-L232
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/widget/MapWidget.java
MapWidget.setScalebarEnabled
public void setScalebarEnabled(boolean enabled) { scaleBarEnabled = enabled; final String scaleBarId = "scalebar"; if (scaleBarEnabled) { if (!getMapAddons().containsKey(scaleBarId)) { ScaleBar scalebar = new ScaleBar(scaleBarId, this); scalebar.setVerticalAlignment(VerticalAlignment.BOTTOM); scalebar.setHorizontalMargin(2); scalebar.setVerticalMargin(2); scalebar.initialize(getMapModel().getMapInfo().getDisplayUnitType(), unitLength, new Coordinate(20, graphics.getHeight() - 25)); registerMapAddon(scalebar); } } else { unregisterMapAddon(addons.get(scaleBarId)); } }
java
public void setScalebarEnabled(boolean enabled) { scaleBarEnabled = enabled; final String scaleBarId = "scalebar"; if (scaleBarEnabled) { if (!getMapAddons().containsKey(scaleBarId)) { ScaleBar scalebar = new ScaleBar(scaleBarId, this); scalebar.setVerticalAlignment(VerticalAlignment.BOTTOM); scalebar.setHorizontalMargin(2); scalebar.setVerticalMargin(2); scalebar.initialize(getMapModel().getMapInfo().getDisplayUnitType(), unitLength, new Coordinate(20, graphics.getHeight() - 25)); registerMapAddon(scalebar); } } else { unregisterMapAddon(addons.get(scaleBarId)); } }
[ "public", "void", "setScalebarEnabled", "(", "boolean", "enabled", ")", "{", "scaleBarEnabled", "=", "enabled", ";", "final", "String", "scaleBarId", "=", "\"scalebar\"", ";", "if", "(", "scaleBarEnabled", ")", "{", "if", "(", "!", "getMapAddons", "(", ")", ...
Enables or disables the scale bar. This setting has immediate effect on the map. @param enabled set status
[ "Enables", "or", "disables", "the", "scale", "bar", ".", "This", "setting", "has", "immediate", "effect", "on", "the", "map", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/widget/MapWidget.java#L727-L744
landawn/AbacusUtil
src/com/landawn/abacus/util/JdbcUtil.java
JdbcUtil.importData
public static int importData(final DataSet dataset, final Collection<String> selectColumnNames, final int offset, final int count, final PreparedStatement stmt, final int batchSize, final int batchInterval) throws UncheckedSQLException { return importData(dataset, selectColumnNames, offset, count, Fn.alwaysTrue(), stmt, batchSize, batchInterval); }
java
public static int importData(final DataSet dataset, final Collection<String> selectColumnNames, final int offset, final int count, final PreparedStatement stmt, final int batchSize, final int batchInterval) throws UncheckedSQLException { return importData(dataset, selectColumnNames, offset, count, Fn.alwaysTrue(), stmt, batchSize, batchInterval); }
[ "public", "static", "int", "importData", "(", "final", "DataSet", "dataset", ",", "final", "Collection", "<", "String", ">", "selectColumnNames", ",", "final", "int", "offset", ",", "final", "int", "count", ",", "final", "PreparedStatement", "stmt", ",", "fina...
Imports the data from <code>DataSet</code> to database. @param dataset @param selectColumnNames @param offset @param count @param stmt the column order in the sql must be consistent with the column order in the DataSet. @return @throws UncheckedSQLException
[ "Imports", "the", "data", "from", "<code", ">", "DataSet<", "/", "code", ">", "to", "database", "." ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/JdbcUtil.java#L2220-L2223
phax/ph-web
ph-servlet/src/main/java/com/helger/servlet/request/RequestHelper.java
RequestHelper.getUserAgent
@Nonnull public static IUserAgent getUserAgent (@Nonnull final HttpServletRequest aHttpRequest) { IUserAgent aUserAgent = (IUserAgent) aHttpRequest.getAttribute (IUserAgent.class.getName ()); if (aUserAgent == null) { // Extract HTTP header from request final String sUserAgent = getHttpUserAgentStringFromRequest (aHttpRequest); aUserAgent = UserAgentDatabase.getParsedUserAgent (sUserAgent); if (aUserAgent == null) { LOGGER.warn ("No user agent was passed in the request!"); aUserAgent = new UserAgent ("", new UserAgentElementList ()); } ServletHelper.setRequestAttribute (aHttpRequest, IUserAgent.class.getName (), aUserAgent); } return aUserAgent; }
java
@Nonnull public static IUserAgent getUserAgent (@Nonnull final HttpServletRequest aHttpRequest) { IUserAgent aUserAgent = (IUserAgent) aHttpRequest.getAttribute (IUserAgent.class.getName ()); if (aUserAgent == null) { // Extract HTTP header from request final String sUserAgent = getHttpUserAgentStringFromRequest (aHttpRequest); aUserAgent = UserAgentDatabase.getParsedUserAgent (sUserAgent); if (aUserAgent == null) { LOGGER.warn ("No user agent was passed in the request!"); aUserAgent = new UserAgent ("", new UserAgentElementList ()); } ServletHelper.setRequestAttribute (aHttpRequest, IUserAgent.class.getName (), aUserAgent); } return aUserAgent; }
[ "@", "Nonnull", "public", "static", "IUserAgent", "getUserAgent", "(", "@", "Nonnull", "final", "HttpServletRequest", "aHttpRequest", ")", "{", "IUserAgent", "aUserAgent", "=", "(", "IUserAgent", ")", "aHttpRequest", ".", "getAttribute", "(", "IUserAgent", ".", "c...
Get the user agent object from the given HTTP request. @param aHttpRequest The HTTP request to extract the information from. @return A non-<code>null</code> user agent object.
[ "Get", "the", "user", "agent", "object", "from", "the", "given", "HTTP", "request", "." ]
train
https://github.com/phax/ph-web/blob/d445fd25184605b62682c93c9782409acf0ae813/ph-servlet/src/main/java/com/helger/servlet/request/RequestHelper.java#L857-L874
liyiorg/weixin-popular
src/main/java/weixin/popular/api/CustomserviceAPI.java
CustomserviceAPI.msgrecordGetrecord
public static KFMsgRecord msgrecordGetrecord(String access_token, int endtime, int pageindex, int pagesize, int starttime) { String jsonPostData = String.format("{\"endtime\":%1d,\"pageindex\":%2d,\"pagesize\":%3d,\"starttime\":%4d}", endtime, pageindex, pagesize, starttime); HttpUriRequest httpUriRequest = RequestBuilder.post() .setHeader(jsonHeader) .setUri(BASE_URI + "/customservice/msgrecord/getrecord") .addParameter(PARAM_ACCESS_TOKEN, API.accessToken(access_token)) .setEntity(new StringEntity(jsonPostData, Charset.forName("utf-8"))) .build(); return LocalHttpClient.executeJsonResult(httpUriRequest, KFMsgRecord.class); }
java
public static KFMsgRecord msgrecordGetrecord(String access_token, int endtime, int pageindex, int pagesize, int starttime) { String jsonPostData = String.format("{\"endtime\":%1d,\"pageindex\":%2d,\"pagesize\":%3d,\"starttime\":%4d}", endtime, pageindex, pagesize, starttime); HttpUriRequest httpUriRequest = RequestBuilder.post() .setHeader(jsonHeader) .setUri(BASE_URI + "/customservice/msgrecord/getrecord") .addParameter(PARAM_ACCESS_TOKEN, API.accessToken(access_token)) .setEntity(new StringEntity(jsonPostData, Charset.forName("utf-8"))) .build(); return LocalHttpClient.executeJsonResult(httpUriRequest, KFMsgRecord.class); }
[ "public", "static", "KFMsgRecord", "msgrecordGetrecord", "(", "String", "access_token", ",", "int", "endtime", ",", "int", "pageindex", ",", "int", "pagesize", ",", "int", "starttime", ")", "{", "String", "jsonPostData", "=", "String", ".", "format", "(", "\"{...
获取客服聊天记录 @param access_token access_token @param endtime 查询结束时间,UNIX时间戳,每次查询不能跨日查询 @param pageindex 查询第几页,从1开始 @param pagesize 每页大小,每页最多拉取50条 @param starttime 查询开始时间,UNIX时间戳 @return KFMsgRecord
[ "获取客服聊天记录" ]
train
https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/api/CustomserviceAPI.java#L235-L248
landawn/AbacusUtil
src/com/landawn/abacus/eventBus/EventBus.java
EventBus.removeStickyEvent
public boolean removeStickyEvent(final Object event, final String eventId) { synchronized (stickyEventMap) { final String val = stickyEventMap.get(event); if (N.equals(val, eventId) && (val != null || stickyEventMap.containsKey(event))) { stickyEventMap.remove(event); this.mapOfStickyEvent = null; return true; } } return false; }
java
public boolean removeStickyEvent(final Object event, final String eventId) { synchronized (stickyEventMap) { final String val = stickyEventMap.get(event); if (N.equals(val, eventId) && (val != null || stickyEventMap.containsKey(event))) { stickyEventMap.remove(event); this.mapOfStickyEvent = null; return true; } } return false; }
[ "public", "boolean", "removeStickyEvent", "(", "final", "Object", "event", ",", "final", "String", "eventId", ")", "{", "synchronized", "(", "stickyEventMap", ")", "{", "final", "String", "val", "=", "stickyEventMap", ".", "get", "(", "event", ")", ";", "if"...
Remove the sticky event posted with the specified <code>eventId</code>. @param event @param eventId @return
[ "Remove", "the", "sticky", "event", "posted", "with", "the", "specified", "<code", ">", "eventId<", "/", "code", ">", "." ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/eventBus/EventBus.java#L529-L542
aws/aws-sdk-java
aws-java-sdk-budgets/src/main/java/com/amazonaws/services/budgets/model/Budget.java
Budget.setCostFilters
public void setCostFilters(java.util.Map<String, java.util.List<String>> costFilters) { this.costFilters = costFilters; }
java
public void setCostFilters(java.util.Map<String, java.util.List<String>> costFilters) { this.costFilters = costFilters; }
[ "public", "void", "setCostFilters", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "java", ".", "util", ".", "List", "<", "String", ">", ">", "costFilters", ")", "{", "this", ".", "costFilters", "=", "costFilters", ";", "}" ]
<p> The cost filters, such as service or region, that are applied to a budget. </p> <p> AWS Budgets supports the following services as a filter for RI budgets: </p> <ul> <li> <p> Amazon Elastic Compute Cloud - Compute </p> </li> <li> <p> Amazon Redshift </p> </li> <li> <p> Amazon Relational Database Service </p> </li> <li> <p> Amazon ElastiCache </p> </li> <li> <p> Amazon Elasticsearch Service </p> </li> </ul> @param costFilters The cost filters, such as service or region, that are applied to a budget.</p> <p> AWS Budgets supports the following services as a filter for RI budgets: </p> <ul> <li> <p> Amazon Elastic Compute Cloud - Compute </p> </li> <li> <p> Amazon Redshift </p> </li> <li> <p> Amazon Relational Database Service </p> </li> <li> <p> Amazon ElastiCache </p> </li> <li> <p> Amazon Elasticsearch Service </p> </li>
[ "<p", ">", "The", "cost", "filters", "such", "as", "service", "or", "region", "that", "are", "applied", "to", "a", "budget", ".", "<", "/", "p", ">", "<p", ">", "AWS", "Budgets", "supports", "the", "following", "services", "as", "a", "filter", "for", ...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-budgets/src/main/java/com/amazonaws/services/budgets/model/Budget.java#L401-L403
datacleaner/DataCleaner
engine/xml-config/src/main/java/org/datacleaner/configuration/DomConfigurationWriter.java
DomConfigurationWriter.removeHadoopClusterServerInformation
public boolean removeHadoopClusterServerInformation(final String serverName) { final Element serverInformationCatalogElement = getServerInformationCatalogElement(); final Element hadoopClustersElement = getOrCreateChildElementByTagName(serverInformationCatalogElement, "hadoop-clusters"); return removeChildElementByNameAttribute(serverName, hadoopClustersElement); }
java
public boolean removeHadoopClusterServerInformation(final String serverName) { final Element serverInformationCatalogElement = getServerInformationCatalogElement(); final Element hadoopClustersElement = getOrCreateChildElementByTagName(serverInformationCatalogElement, "hadoop-clusters"); return removeChildElementByNameAttribute(serverName, hadoopClustersElement); }
[ "public", "boolean", "removeHadoopClusterServerInformation", "(", "final", "String", "serverName", ")", "{", "final", "Element", "serverInformationCatalogElement", "=", "getServerInformationCatalogElement", "(", ")", ";", "final", "Element", "hadoopClustersElement", "=", "g...
Removes a Hadoop cluster by its name, if it exists and is recognizeable by the externalizer. @param serverName @return true if a server information element was removed from the XML document.
[ "Removes", "a", "Hadoop", "cluster", "by", "its", "name", "if", "it", "exists", "and", "is", "recognizeable", "by", "the", "externalizer", "." ]
train
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/engine/xml-config/src/main/java/org/datacleaner/configuration/DomConfigurationWriter.java#L217-L222
ow2-chameleon/fuchsia
bases/knx/calimero/src/main/java/tuwien/auto/calimero/process/ProcessListenerEx.java
ProcessListenerEx.asString
public String asString(ProcessEvent e, int dptMainNumber, String dptID) throws KNXException { final DPTXlator t = TranslatorTypes.createTranslator(dptMainNumber, dptID); t.setData(e.getASDU()); return t.getValue(); }
java
public String asString(ProcessEvent e, int dptMainNumber, String dptID) throws KNXException { final DPTXlator t = TranslatorTypes.createTranslator(dptMainNumber, dptID); t.setData(e.getASDU()); return t.getValue(); }
[ "public", "String", "asString", "(", "ProcessEvent", "e", ",", "int", "dptMainNumber", ",", "String", "dptID", ")", "throws", "KNXException", "{", "final", "DPTXlator", "t", "=", "TranslatorTypes", ".", "createTranslator", "(", "dptMainNumber", ",", "dptID", ")"...
Returns the ASDU of the received process event as datapoint value of the requested DPT in String representation. <p> This method has to be invoked manually by the user (either in {@link #groupReadResponse(ProcessEvent)} or {@link ProcessListener#groupWrite(ProcessEvent)}), depending on the received datapoint type. @param e the process event with the ASDU to translate @param dptMainNumber datapoint type main number, number >= 0; use 0 to infer translator type from <code>dptID</code> argument only @param dptID datapoint type ID for selecting a particular kind of value translation @return the received value of the requested type as String representation @throws KNXException on not supported or not available DPT @see TranslatorTypes#createTranslator(int, String)
[ "Returns", "the", "ASDU", "of", "the", "received", "process", "event", "as", "datapoint", "value", "of", "the", "requested", "DPT", "in", "String", "representation", ".", "<p", ">", "This", "method", "has", "to", "be", "invoked", "manually", "by", "the", "...
train
https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/bases/knx/calimero/src/main/java/tuwien/auto/calimero/process/ProcessListenerEx.java#L235-L241
openbase/jul
processing/default/src/main/java/org/openbase/jul/processing/StringProcessor.java
StringProcessor.fillWithSpaces
public static String fillWithSpaces(String input, int lenght) { return fillWithSpaces(input, lenght, Alignment.LEFT); }
java
public static String fillWithSpaces(String input, int lenght) { return fillWithSpaces(input, lenght, Alignment.LEFT); }
[ "public", "static", "String", "fillWithSpaces", "(", "String", "input", ",", "int", "lenght", ")", "{", "return", "fillWithSpaces", "(", "input", ",", "lenght", ",", "Alignment", ".", "LEFT", ")", ";", "}" ]
Method fills the given input string with width-spaces until the given string length is reached. <p> Note: The origin input string will aligned to the left. @param input the original input string @param lenght the requested input string length. @return the extended input string
[ "Method", "fills", "the", "given", "input", "string", "with", "width", "-", "spaces", "until", "the", "given", "string", "length", "is", "reached", ".", "<p", ">", "Note", ":", "The", "origin", "input", "string", "will", "aligned", "to", "the", "left", "...
train
https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/processing/default/src/main/java/org/openbase/jul/processing/StringProcessor.java#L127-L129
alkacon/opencms-core
src/org/opencms/ui/apps/modules/CmsSiteSelectDialog.java
CmsSiteSelectDialog.openDialogInWindow
public static void openDialogInWindow(final I_Callback callback, String windowCaption) { final Window window = CmsBasicDialog.prepareWindow(); window.setCaption(windowCaption); CmsSiteSelectDialog dialog = new CmsSiteSelectDialog(); window.setContent(dialog); dialog.setCallback(new I_Callback() { public void onCancel() { window.close(); callback.onCancel(); } public void onSiteSelect(String site) { window.close(); callback.onSiteSelect(site); } }); A_CmsUI.get().addWindow(window); }
java
public static void openDialogInWindow(final I_Callback callback, String windowCaption) { final Window window = CmsBasicDialog.prepareWindow(); window.setCaption(windowCaption); CmsSiteSelectDialog dialog = new CmsSiteSelectDialog(); window.setContent(dialog); dialog.setCallback(new I_Callback() { public void onCancel() { window.close(); callback.onCancel(); } public void onSiteSelect(String site) { window.close(); callback.onSiteSelect(site); } }); A_CmsUI.get().addWindow(window); }
[ "public", "static", "void", "openDialogInWindow", "(", "final", "I_Callback", "callback", ",", "String", "windowCaption", ")", "{", "final", "Window", "window", "=", "CmsBasicDialog", ".", "prepareWindow", "(", ")", ";", "window", ".", "setCaption", "(", "window...
Opens the site selection dialog in a window.<p> @param callback the callback to call when the dialog finishes @param windowCaption the window caption
[ "Opens", "the", "site", "selection", "dialog", "in", "a", "window", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/modules/CmsSiteSelectDialog.java#L124-L146
TheHolyWaffle/League-of-Legends-XMPP-Chat-Library
src/main/java/com/github/theholywaffle/lolchatapi/LolChat.java
LolChat.addFriendGroup
public FriendGroup addFriendGroup(String name) { final RosterGroup g = connection.getRoster().createGroup(name); if (g != null) { return new FriendGroup(this, connection, g); } return null; }
java
public FriendGroup addFriendGroup(String name) { final RosterGroup g = connection.getRoster().createGroup(name); if (g != null) { return new FriendGroup(this, connection, g); } return null; }
[ "public", "FriendGroup", "addFriendGroup", "(", "String", "name", ")", "{", "final", "RosterGroup", "g", "=", "connection", ".", "getRoster", "(", ")", ".", "createGroup", "(", "name", ")", ";", "if", "(", "g", "!=", "null", ")", "{", "return", "new", ...
Creates a new FriendGroup. If this FriendGroup contains no Friends when you logout it will be erased from the server. @param name The name of this FriendGroup @return The new FriendGroup or null if a FriendGroup with this name already exists.
[ "Creates", "a", "new", "FriendGroup", ".", "If", "this", "FriendGroup", "contains", "no", "Friends", "when", "you", "logout", "it", "will", "be", "erased", "from", "the", "server", "." ]
train
https://github.com/TheHolyWaffle/League-of-Legends-XMPP-Chat-Library/blob/5e4d87d0c054ff2f6510545b0e9f838338695c70/src/main/java/com/github/theholywaffle/lolchatapi/LolChat.java#L292-L298
doanduyhai/Achilles
achilles-core/src/main/java/info/archinnov/achilles/internals/apt/AptUtils.java
AptUtils.getElementValue
public static <T> T getElementValue(AnnotationMirror anno, CharSequence name, Class<T> expectedType, boolean useDefaults) { Map<? extends ExecutableElement, ? extends AnnotationValue> valmap = useDefaults ? getElementValuesWithDefaults(anno) : anno.getElementValues(); for (ExecutableElement elem : valmap.keySet()) { if (elem.getSimpleName().contentEquals(name)) { AnnotationValue val = valmap.get(elem); return expectedType.cast(val.getValue()); } } return null; }
java
public static <T> T getElementValue(AnnotationMirror anno, CharSequence name, Class<T> expectedType, boolean useDefaults) { Map<? extends ExecutableElement, ? extends AnnotationValue> valmap = useDefaults ? getElementValuesWithDefaults(anno) : anno.getElementValues(); for (ExecutableElement elem : valmap.keySet()) { if (elem.getSimpleName().contentEquals(name)) { AnnotationValue val = valmap.get(elem); return expectedType.cast(val.getValue()); } } return null; }
[ "public", "static", "<", "T", ">", "T", "getElementValue", "(", "AnnotationMirror", "anno", ",", "CharSequence", "name", ",", "Class", "<", "T", ">", "expectedType", ",", "boolean", "useDefaults", ")", "{", "Map", "<", "?", "extends", "ExecutableElement", ",...
Get the attribute with the name {@code name} of the annotation {@code anno}. The result is expected to have type {@code expectedType}. <em>Note 1</em>: The method does not work well for attributes of an array type (as it would return a list of {@link AnnotationValue}s). Use {@code getElementValueArray} instead. <em>Note 2</em>: The method does not work for attributes of an enum type, as the AnnotationValue is a VarSymbol and would be cast to the enum type, which doesn't work. Use {@code getElementValueEnum} instead. @param anno the annotation to disassemble @param name the name of the attribute to access @param expectedType the expected type used to cast the return type @param useDefaults whether to apply default values to the attribute. @return the value of the attribute with the given name
[ "Get", "the", "attribute", "with", "the", "name", "{", "@code", "name", "}", "of", "the", "annotation", "{", "@code", "anno", "}", ".", "The", "result", "is", "expected", "to", "have", "type", "{", "@code", "expectedType", "}", "." ]
train
https://github.com/doanduyhai/Achilles/blob/8281c33100e72c993e570592ae1a5306afac6813/achilles-core/src/main/java/info/archinnov/achilles/internals/apt/AptUtils.java#L252-L266
google/closure-compiler
src/com/google/javascript/jscomp/Es6RewriteClass.java
Es6RewriteClass.getQualifiedMemberAccess
private Node getQualifiedMemberAccess(Node member, ClassDeclarationMetadata metadata) { Node context = member.isStaticMember() ? metadata.getFullClassNameNode().cloneTree() : metadata.getClassPrototypeNode().cloneTree(); // context.useSourceInfoIfMissingFromForTree(member); context.makeNonIndexableRecursive(); if (member.isComputedProp()) { return astFactory .createGetElem(context, member.removeFirstChild()) .useSourceInfoIfMissingFromForTree(member); } else { Node methodName = member.getFirstFirstChild(); return astFactory .createGetProp(context, member.getString()) .useSourceInfoFromForTree(methodName); } }
java
private Node getQualifiedMemberAccess(Node member, ClassDeclarationMetadata metadata) { Node context = member.isStaticMember() ? metadata.getFullClassNameNode().cloneTree() : metadata.getClassPrototypeNode().cloneTree(); // context.useSourceInfoIfMissingFromForTree(member); context.makeNonIndexableRecursive(); if (member.isComputedProp()) { return astFactory .createGetElem(context, member.removeFirstChild()) .useSourceInfoIfMissingFromForTree(member); } else { Node methodName = member.getFirstFirstChild(); return astFactory .createGetProp(context, member.getString()) .useSourceInfoFromForTree(methodName); } }
[ "private", "Node", "getQualifiedMemberAccess", "(", "Node", "member", ",", "ClassDeclarationMetadata", "metadata", ")", "{", "Node", "context", "=", "member", ".", "isStaticMember", "(", ")", "?", "metadata", ".", "getFullClassNameNode", "(", ")", ".", "cloneTree"...
Constructs a Node that represents an access to the given class member, qualified by either the static or the instance access context, depending on whether the member is static. <p><b>WARNING:</b> {@code member} may be modified/destroyed by this method, do not use it afterwards.
[ "Constructs", "a", "Node", "that", "represents", "an", "access", "to", "the", "given", "class", "member", "qualified", "by", "either", "the", "static", "or", "the", "instance", "access", "context", "depending", "on", "whether", "the", "member", "is", "static",...
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/Es6RewriteClass.java#L555-L572
atomix/atomix
protocols/raft/src/main/java/io/atomix/protocols/raft/service/RaftServiceContext.java
RaftServiceContext.openSession
public long openSession(long index, long timestamp, RaftSession session) { log.debug("Opening session {}", session.sessionId()); // Update the state machine index/timestamp. tick(index, timestamp); // Set the session timestamp to the current service timestamp. session.setLastUpdated(currentTimestamp); // Expire sessions that have timed out. expireSessions(currentTimestamp); // Add the session to the sessions list. session.open(); service.register(sessions.addSession(session)); // Commit the index, causing events to be sent to clients if necessary. commit(); // Complete the future. return session.sessionId().id(); }
java
public long openSession(long index, long timestamp, RaftSession session) { log.debug("Opening session {}", session.sessionId()); // Update the state machine index/timestamp. tick(index, timestamp); // Set the session timestamp to the current service timestamp. session.setLastUpdated(currentTimestamp); // Expire sessions that have timed out. expireSessions(currentTimestamp); // Add the session to the sessions list. session.open(); service.register(sessions.addSession(session)); // Commit the index, causing events to be sent to clients if necessary. commit(); // Complete the future. return session.sessionId().id(); }
[ "public", "long", "openSession", "(", "long", "index", ",", "long", "timestamp", ",", "RaftSession", "session", ")", "{", "log", ".", "debug", "(", "\"Opening session {}\"", ",", "session", ".", "sessionId", "(", ")", ")", ";", "// Update the state machine index...
Registers the given session. @param index The index of the registration. @param timestamp The timestamp of the registration. @param session The session to register.
[ "Registers", "the", "given", "session", "." ]
train
https://github.com/atomix/atomix/blob/3a94b7c80576d762dd0d396d4645df07a0b37c31/protocols/raft/src/main/java/io/atomix/protocols/raft/service/RaftServiceContext.java#L326-L347
rpuch/xremoting
xremoting-core/src/main/java/com/googlecode/xremoting/core/commonshttpclient/HttpClientBuilder.java
HttpClientBuilder.trustKeyStore
public HttpClientBuilder trustKeyStore(URL url, String password) { if (sslHostConfig == null) { throw new IllegalStateException("ssl(String) must be called before this"); } sslHostConfig.trustKeyStoreUrl = url; sslHostConfig.trustKeyStorePassword = password; return this; }
java
public HttpClientBuilder trustKeyStore(URL url, String password) { if (sslHostConfig == null) { throw new IllegalStateException("ssl(String) must be called before this"); } sslHostConfig.trustKeyStoreUrl = url; sslHostConfig.trustKeyStorePassword = password; return this; }
[ "public", "HttpClientBuilder", "trustKeyStore", "(", "URL", "url", ",", "String", "password", ")", "{", "if", "(", "sslHostConfig", "==", "null", ")", "{", "throw", "new", "IllegalStateException", "(", "\"ssl(String) must be called before this\"", ")", ";", "}", "...
Configures a trust store for the current SSL host (see {@link #ssl(String)}). If set, SSL client authentication will be used when connecting to that host (i.e. the client certificate will be sent). @param url URL from which to obtain trust store @param password trust store password @return this @see #ssl(String) @see #keyStore(URL, String)
[ "Configures", "a", "trust", "store", "for", "the", "current", "SSL", "host", "(", "see", "{", "@link", "#ssl", "(", "String", ")", "}", ")", ".", "If", "set", "SSL", "client", "authentication", "will", "be", "used", "when", "connecting", "to", "that", ...
train
https://github.com/rpuch/xremoting/blob/519b640e5225652a8c23e10e5cab71827636a8b1/xremoting-core/src/main/java/com/googlecode/xremoting/core/commonshttpclient/HttpClientBuilder.java#L189-L196
elki-project/elki
elki-outlier/src/main/java/de/lmu/ifi/dbs/elki/algorithm/outlier/distance/ReferenceBasedOutlierDetection.java
ReferenceBasedOutlierDetection.computeDensity
protected double computeDensity(DoubleDBIDList referenceDists, DoubleDBIDListIter iter, int index) { final int size = referenceDists.size(); final double xDist = iter.seek(index).doubleValue(); int lef = index, rig = index; double sum = 0.; double lef_d = (--lef >= 0) ? xDist - iter.seek(lef).doubleValue() : Double.POSITIVE_INFINITY; double rig_d = (++rig < size) ? iter.seek(rig).doubleValue() - xDist : Double.POSITIVE_INFINITY; for(int i = 0; i < k; ++i) { if(lef >= 0 && rig < size) { // Prefer n or m? if(lef_d < rig_d) { sum += lef_d; // Update left lef_d = (--lef >= 0) ? xDist - iter.seek(lef).doubleValue() : Double.POSITIVE_INFINITY; } else { sum += rig_d; // Update right rig_d = (++rig < size) ? iter.seek(rig).doubleValue() - xDist : Double.POSITIVE_INFINITY; } } else if(lef >= 0) { // Choose left, since right is not available. sum += lef_d; // update left lef_d = (--lef >= 0) ? xDist - iter.seek(lef).doubleValue() : Double.POSITIVE_INFINITY; } else if(rig < size) { // Choose right, since left is not available sum += rig_d; // Update right rig_d = (++rig < size) ? iter.seek(rig).doubleValue() - xDist : Double.POSITIVE_INFINITY; } else { // Not enough objects in database? throw new IndexOutOfBoundsException("Less than k objects?"); } } return k / sum; }
java
protected double computeDensity(DoubleDBIDList referenceDists, DoubleDBIDListIter iter, int index) { final int size = referenceDists.size(); final double xDist = iter.seek(index).doubleValue(); int lef = index, rig = index; double sum = 0.; double lef_d = (--lef >= 0) ? xDist - iter.seek(lef).doubleValue() : Double.POSITIVE_INFINITY; double rig_d = (++rig < size) ? iter.seek(rig).doubleValue() - xDist : Double.POSITIVE_INFINITY; for(int i = 0; i < k; ++i) { if(lef >= 0 && rig < size) { // Prefer n or m? if(lef_d < rig_d) { sum += lef_d; // Update left lef_d = (--lef >= 0) ? xDist - iter.seek(lef).doubleValue() : Double.POSITIVE_INFINITY; } else { sum += rig_d; // Update right rig_d = (++rig < size) ? iter.seek(rig).doubleValue() - xDist : Double.POSITIVE_INFINITY; } } else if(lef >= 0) { // Choose left, since right is not available. sum += lef_d; // update left lef_d = (--lef >= 0) ? xDist - iter.seek(lef).doubleValue() : Double.POSITIVE_INFINITY; } else if(rig < size) { // Choose right, since left is not available sum += rig_d; // Update right rig_d = (++rig < size) ? iter.seek(rig).doubleValue() - xDist : Double.POSITIVE_INFINITY; } else { // Not enough objects in database? throw new IndexOutOfBoundsException("Less than k objects?"); } } return k / sum; }
[ "protected", "double", "computeDensity", "(", "DoubleDBIDList", "referenceDists", ",", "DoubleDBIDListIter", "iter", ",", "int", "index", ")", "{", "final", "int", "size", "=", "referenceDists", ".", "size", "(", ")", ";", "final", "double", "xDist", "=", "ite...
Computes the density of an object. The density of an object is the distances to the k nearest neighbors. Neighbors and distances are computed approximately. (approximation for kNN distance: instead of a normal NN search the NN of an object are those objects that have a similar distance to a reference point. The k- nearest neighbors of an object are those objects that lay close to the object in the reference distance vector) @param referenceDists vector of the reference distances @param iter Iterator to this list (will be reused) @param index index of the current object @return density for one object and reference point
[ "Computes", "the", "density", "of", "an", "object", ".", "The", "density", "of", "an", "object", "is", "the", "distances", "to", "the", "k", "nearest", "neighbors", ".", "Neighbors", "and", "distances", "are", "computed", "approximately", ".", "(", "approxim...
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-outlier/src/main/java/de/lmu/ifi/dbs/elki/algorithm/outlier/distance/ReferenceBasedOutlierDetection.java#L223-L263
windup/windup
config/api/src/main/java/org/jboss/windup/config/RuleSubset.java
RuleSubset.logTimeTakenByRuleProvider
private void logTimeTakenByRuleProvider(GraphContext graphContext, Context context, int ruleIndex, int timeTaken) { AbstractRuleProvider ruleProvider = (AbstractRuleProvider) context.get(RuleMetadataType.RULE_PROVIDER); if (ruleProvider == null) return; if (!timeTakenByProvider.containsKey(ruleProvider)) { RuleProviderExecutionStatisticsModel model = new RuleProviderExecutionStatisticsService(graphContext) .create(); model.setRuleIndex(ruleIndex); model.setRuleProviderID(ruleProvider.getMetadata().getID()); model.setTimeTaken(timeTaken); timeTakenByProvider.put(ruleProvider, model.getElement().id()); } else { RuleProviderExecutionStatisticsService service = new RuleProviderExecutionStatisticsService(graphContext); RuleProviderExecutionStatisticsModel model = service.getById(timeTakenByProvider.get(ruleProvider)); int prevTimeTaken = model.getTimeTaken(); model.setTimeTaken(prevTimeTaken + timeTaken); } logTimeTakenByPhase(graphContext, ruleProvider.getMetadata().getPhase(), timeTaken); }
java
private void logTimeTakenByRuleProvider(GraphContext graphContext, Context context, int ruleIndex, int timeTaken) { AbstractRuleProvider ruleProvider = (AbstractRuleProvider) context.get(RuleMetadataType.RULE_PROVIDER); if (ruleProvider == null) return; if (!timeTakenByProvider.containsKey(ruleProvider)) { RuleProviderExecutionStatisticsModel model = new RuleProviderExecutionStatisticsService(graphContext) .create(); model.setRuleIndex(ruleIndex); model.setRuleProviderID(ruleProvider.getMetadata().getID()); model.setTimeTaken(timeTaken); timeTakenByProvider.put(ruleProvider, model.getElement().id()); } else { RuleProviderExecutionStatisticsService service = new RuleProviderExecutionStatisticsService(graphContext); RuleProviderExecutionStatisticsModel model = service.getById(timeTakenByProvider.get(ruleProvider)); int prevTimeTaken = model.getTimeTaken(); model.setTimeTaken(prevTimeTaken + timeTaken); } logTimeTakenByPhase(graphContext, ruleProvider.getMetadata().getPhase(), timeTaken); }
[ "private", "void", "logTimeTakenByRuleProvider", "(", "GraphContext", "graphContext", ",", "Context", "context", ",", "int", "ruleIndex", ",", "int", "timeTaken", ")", "{", "AbstractRuleProvider", "ruleProvider", "=", "(", "AbstractRuleProvider", ")", "context", ".", ...
Logs the time taken by this rule, and attaches this to the total for the RuleProvider
[ "Logs", "the", "time", "taken", "by", "this", "rule", "and", "attaches", "this", "to", "the", "total", "for", "the", "RuleProvider" ]
train
https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/config/api/src/main/java/org/jboss/windup/config/RuleSubset.java#L138-L162
snowflakedb/snowflake-jdbc
src/main/java/net/snowflake/client/jdbc/telemetry/TelemetryUtil.java
TelemetryUtil.buildJobData
public static TelemetryData buildJobData(String queryId, TelemetryField field, long value) { ObjectNode obj = mapper.createObjectNode(); obj.put(TYPE, field.toString()); obj.put(QUERY_ID, queryId); obj.put(VALUE, value); return new TelemetryData(obj, System.currentTimeMillis()); }
java
public static TelemetryData buildJobData(String queryId, TelemetryField field, long value) { ObjectNode obj = mapper.createObjectNode(); obj.put(TYPE, field.toString()); obj.put(QUERY_ID, queryId); obj.put(VALUE, value); return new TelemetryData(obj, System.currentTimeMillis()); }
[ "public", "static", "TelemetryData", "buildJobData", "(", "String", "queryId", ",", "TelemetryField", "field", ",", "long", "value", ")", "{", "ObjectNode", "obj", "=", "mapper", ".", "createObjectNode", "(", ")", ";", "obj", ".", "put", "(", "TYPE", ",", ...
Create a simple TelemetryData instance for Job metrics using given parameters @param queryId the id of the query @param field the field to log (represents the "type" field in telemetry) @param value the value to log for the field @return TelemetryData instance constructed from parameters
[ "Create", "a", "simple", "TelemetryData", "instance", "for", "Job", "metrics", "using", "given", "parameters" ]
train
https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/jdbc/telemetry/TelemetryUtil.java#L24-L31
gallandarakhneorg/afc
core/vmutils/src/main/java/org/arakhne/afc/vmutil/VMCommandLine.java
VMCommandLine.saveVMParametersIfNotSet
@Inline(value = "VMCommandLine.saveVMParametersIfNotSet(($1).getCanonicalName(), ($2))", imported = {VMCommandLine.class}, statementExpression = true) public static void saveVMParametersIfNotSet(Class<?> classToLaunch, String... parameters) { saveVMParametersIfNotSet(classToLaunch.getCanonicalName(), parameters); }
java
@Inline(value = "VMCommandLine.saveVMParametersIfNotSet(($1).getCanonicalName(), ($2))", imported = {VMCommandLine.class}, statementExpression = true) public static void saveVMParametersIfNotSet(Class<?> classToLaunch, String... parameters) { saveVMParametersIfNotSet(classToLaunch.getCanonicalName(), parameters); }
[ "@", "Inline", "(", "value", "=", "\"VMCommandLine.saveVMParametersIfNotSet(($1).getCanonicalName(), ($2))\"", ",", "imported", "=", "{", "VMCommandLine", ".", "class", "}", ",", "statementExpression", "=", "true", ")", "public", "static", "void", "saveVMParametersIfNotSe...
Save parameters that permit to relaunch a VM with {@link #relaunchVM()}. @param classToLaunch is the class which contains a <code>main</code>. @param parameters is the parameters to pass to the <code>main</code>.
[ "Save", "parameters", "that", "permit", "to", "relaunch", "a", "VM", "with", "{", "@link", "#relaunchVM", "()", "}", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/VMCommandLine.java#L341-L345
Azure/azure-sdk-for-java
logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/SessionsInner.java
SessionsInner.createOrUpdateAsync
public Observable<IntegrationAccountSessionInner> createOrUpdateAsync(String resourceGroupName, String integrationAccountName, String sessionName, IntegrationAccountSessionInner session) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, integrationAccountName, sessionName, session).map(new Func1<ServiceResponse<IntegrationAccountSessionInner>, IntegrationAccountSessionInner>() { @Override public IntegrationAccountSessionInner call(ServiceResponse<IntegrationAccountSessionInner> response) { return response.body(); } }); }
java
public Observable<IntegrationAccountSessionInner> createOrUpdateAsync(String resourceGroupName, String integrationAccountName, String sessionName, IntegrationAccountSessionInner session) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, integrationAccountName, sessionName, session).map(new Func1<ServiceResponse<IntegrationAccountSessionInner>, IntegrationAccountSessionInner>() { @Override public IntegrationAccountSessionInner call(ServiceResponse<IntegrationAccountSessionInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "IntegrationAccountSessionInner", ">", "createOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "integrationAccountName", ",", "String", "sessionName", ",", "IntegrationAccountSessionInner", "session", ")", "{", "return", "creat...
Creates or updates an integration account session. @param resourceGroupName The resource group name. @param integrationAccountName The integration account name. @param sessionName The integration account session name. @param session The integration account session. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the IntegrationAccountSessionInner object
[ "Creates", "or", "updates", "an", "integration", "account", "session", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/SessionsInner.java#L471-L478
Azure/azure-sdk-for-java
containerregistry/resource-manager/v2018_02_01_preview/src/main/java/com/microsoft/azure/management/containerregistry/v2018_02_01_preview/implementation/BuildStepsInner.java
BuildStepsInner.getAsync
public Observable<BuildStepInner> getAsync(String resourceGroupName, String registryName, String buildTaskName, String stepName) { return getWithServiceResponseAsync(resourceGroupName, registryName, buildTaskName, stepName).map(new Func1<ServiceResponse<BuildStepInner>, BuildStepInner>() { @Override public BuildStepInner call(ServiceResponse<BuildStepInner> response) { return response.body(); } }); }
java
public Observable<BuildStepInner> getAsync(String resourceGroupName, String registryName, String buildTaskName, String stepName) { return getWithServiceResponseAsync(resourceGroupName, registryName, buildTaskName, stepName).map(new Func1<ServiceResponse<BuildStepInner>, BuildStepInner>() { @Override public BuildStepInner call(ServiceResponse<BuildStepInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "BuildStepInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "registryName", ",", "String", "buildTaskName", ",", "String", "stepName", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", "...
Gets the build step for a build task. @param resourceGroupName The name of the resource group to which the container registry belongs. @param registryName The name of the container registry. @param buildTaskName The name of the container registry build task. @param stepName The name of a build step for a container registry build task. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the BuildStepInner object
[ "Gets", "the", "build", "step", "for", "a", "build", "task", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerregistry/resource-manager/v2018_02_01_preview/src/main/java/com/microsoft/azure/management/containerregistry/v2018_02_01_preview/implementation/BuildStepsInner.java#L284-L291
apereo/cas
support/cas-server-support-rest-core/src/main/java/org/apereo/cas/support/rest/resources/TicketGrantingTicketResource.java
TicketGrantingTicketResource.createTicketGrantingTicket
@PostMapping(value = "/v1/tickets", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE) public ResponseEntity<String> createTicketGrantingTicket(@RequestBody(required=false) final MultiValueMap<String, String> requestBody, final HttpServletRequest request) { try { val tgtId = createTicketGrantingTicketForRequest(requestBody, request); return createResponseEntityForTicket(request, tgtId); } catch (final AuthenticationException e) { return RestResourceUtils.createResponseEntityForAuthnFailure(e, request, applicationContext); } catch (final BadRestRequestException e) { LOGGER.error(e.getMessage(), e); return new ResponseEntity<>(e.getMessage(), HttpStatus.BAD_REQUEST); } catch (final Exception e) { LOGGER.error(e.getMessage(), e); return new ResponseEntity<>(e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR); } }
java
@PostMapping(value = "/v1/tickets", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE) public ResponseEntity<String> createTicketGrantingTicket(@RequestBody(required=false) final MultiValueMap<String, String> requestBody, final HttpServletRequest request) { try { val tgtId = createTicketGrantingTicketForRequest(requestBody, request); return createResponseEntityForTicket(request, tgtId); } catch (final AuthenticationException e) { return RestResourceUtils.createResponseEntityForAuthnFailure(e, request, applicationContext); } catch (final BadRestRequestException e) { LOGGER.error(e.getMessage(), e); return new ResponseEntity<>(e.getMessage(), HttpStatus.BAD_REQUEST); } catch (final Exception e) { LOGGER.error(e.getMessage(), e); return new ResponseEntity<>(e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR); } }
[ "@", "PostMapping", "(", "value", "=", "\"/v1/tickets\"", ",", "consumes", "=", "MediaType", ".", "APPLICATION_FORM_URLENCODED_VALUE", ")", "public", "ResponseEntity", "<", "String", ">", "createTicketGrantingTicket", "(", "@", "RequestBody", "(", "required", "=", "...
Create new ticket granting ticket. @param requestBody username and password application/x-www-form-urlencoded values @param request raw HttpServletRequest used to call this method @return ResponseEntity representing RESTful response
[ "Create", "new", "ticket", "granting", "ticket", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-rest-core/src/main/java/org/apereo/cas/support/rest/resources/TicketGrantingTicketResource.java#L62-L77
liferay/com-liferay-commerce
commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceOrderPersistenceImpl.java
CommerceOrderPersistenceImpl.findAll
@Override public List<CommerceOrder> findAll() { return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); }
java
@Override public List<CommerceOrder> findAll() { return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); }
[ "@", "Override", "public", "List", "<", "CommerceOrder", ">", "findAll", "(", ")", "{", "return", "findAll", "(", "QueryUtil", ".", "ALL_POS", ",", "QueryUtil", ".", "ALL_POS", ",", "null", ")", ";", "}" ]
Returns all the commerce orders. @return the commerce orders
[ "Returns", "all", "the", "commerce", "orders", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceOrderPersistenceImpl.java#L6962-L6965
algolia/algoliasearch-client-java
src/main/java/com/algolia/search/saas/APIClient.java
APIClient.multipleQueries
public JSONObject multipleQueries(List<IndexQuery> queries) throws AlgoliaException { return multipleQueries(queries, "none", RequestOptions.empty); }
java
public JSONObject multipleQueries(List<IndexQuery> queries) throws AlgoliaException { return multipleQueries(queries, "none", RequestOptions.empty); }
[ "public", "JSONObject", "multipleQueries", "(", "List", "<", "IndexQuery", ">", "queries", ")", "throws", "AlgoliaException", "{", "return", "multipleQueries", "(", "queries", ",", "\"none\"", ",", "RequestOptions", ".", "empty", ")", ";", "}" ]
This method allows to query multiple indexes with one API call
[ "This", "method", "allows", "to", "query", "multiple", "indexes", "with", "one", "API", "call" ]
train
https://github.com/algolia/algoliasearch-client-java/blob/a05da2f66c099fe6f77295c7b6a8a12c24e95f9b/src/main/java/com/algolia/search/saas/APIClient.java#L1255-L1257
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPOptionValuePersistenceImpl.java
CPOptionValuePersistenceImpl.removeByC_K
@Override public CPOptionValue removeByC_K(long CPOptionId, String key) throws NoSuchCPOptionValueException { CPOptionValue cpOptionValue = findByC_K(CPOptionId, key); return remove(cpOptionValue); }
java
@Override public CPOptionValue removeByC_K(long CPOptionId, String key) throws NoSuchCPOptionValueException { CPOptionValue cpOptionValue = findByC_K(CPOptionId, key); return remove(cpOptionValue); }
[ "@", "Override", "public", "CPOptionValue", "removeByC_K", "(", "long", "CPOptionId", ",", "String", "key", ")", "throws", "NoSuchCPOptionValueException", "{", "CPOptionValue", "cpOptionValue", "=", "findByC_K", "(", "CPOptionId", ",", "key", ")", ";", "return", "...
Removes the cp option value where CPOptionId = &#63; and key = &#63; from the database. @param CPOptionId the cp option ID @param key the key @return the cp option value that was removed
[ "Removes", "the", "cp", "option", "value", "where", "CPOptionId", "=", "&#63", ";", "and", "key", "=", "&#63", ";", "from", "the", "database", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPOptionValuePersistenceImpl.java#L3171-L3177