repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
sequencelengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
sequencelengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
OpenLiberty/open-liberty
dev/com.ibm.ws.jpa.container.core/src/com/ibm/ws/jpa/management/JPAEMPool.java
JPAEMPool.createEntityManager
@Override public EntityManager createEntityManager() { """ Gets entity manager from pool and wraps it in an invocation type aware, enlistment capable em. """ if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "createEntityManager : " + this); EntityManager em = getEntityManager(false, false); JPAPooledEntityManager pem = new JPAPooledEntityManager(this, em, ivAbstractJpaComponent, true); return pem; }
java
@Override public EntityManager createEntityManager() { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "createEntityManager : " + this); EntityManager em = getEntityManager(false, false); JPAPooledEntityManager pem = new JPAPooledEntityManager(this, em, ivAbstractJpaComponent, true); return pem; }
[ "@", "Override", "public", "EntityManager", "createEntityManager", "(", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "Tr", ".", "debug", "(", "tc", ",", "\"createEntityManager : \"", "+", "this", ")", ";", "EntityManager", "em", "=", "getEntityManager", "(", "false", ",", "false", ")", ";", "JPAPooledEntityManager", "pem", "=", "new", "JPAPooledEntityManager", "(", "this", ",", "em", ",", "ivAbstractJpaComponent", ",", "true", ")", ";", "return", "pem", ";", "}" ]
Gets entity manager from pool and wraps it in an invocation type aware, enlistment capable em.
[ "Gets", "entity", "manager", "from", "pool", "and", "wraps", "it", "in", "an", "invocation", "type", "aware", "enlistment", "capable", "em", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jpa.container.core/src/com/ibm/ws/jpa/management/JPAEMPool.java#L262-L271
knowm/XChange
xchange-coinbase/src/main/java/org/knowm/xchange/coinbase/service/CoinbaseBaseService.java
CoinbaseBaseService.createCoinbaseUser
public CoinbaseUser createCoinbaseUser(CoinbaseUser user, final String oAuthClientId) throws IOException { """ Unauthenticated resource that creates a user with an email and password. @param user New Coinbase User information. @param oAuthClientId Optional client id that corresponds to your OAuth2 application. @return Information for the newly created user, including information to perform future OAuth requests for the user. @throws IOException @see <a href="https://coinbase.com/api/doc/1.0/users/create.html">coinbase.com/api/doc/1.0/users/create.html</a> @see {@link CoinbaseUser#createNewCoinbaseUser} and {@link CoinbaseUser#createCoinbaseNewUserWithReferrerId} """ final CoinbaseUser createdUser = coinbase.createUser(user.withoAuthClientId(oAuthClientId)); return handleResponse(createdUser); }
java
public CoinbaseUser createCoinbaseUser(CoinbaseUser user, final String oAuthClientId) throws IOException { final CoinbaseUser createdUser = coinbase.createUser(user.withoAuthClientId(oAuthClientId)); return handleResponse(createdUser); }
[ "public", "CoinbaseUser", "createCoinbaseUser", "(", "CoinbaseUser", "user", ",", "final", "String", "oAuthClientId", ")", "throws", "IOException", "{", "final", "CoinbaseUser", "createdUser", "=", "coinbase", ".", "createUser", "(", "user", ".", "withoAuthClientId", "(", "oAuthClientId", ")", ")", ";", "return", "handleResponse", "(", "createdUser", ")", ";", "}" ]
Unauthenticated resource that creates a user with an email and password. @param user New Coinbase User information. @param oAuthClientId Optional client id that corresponds to your OAuth2 application. @return Information for the newly created user, including information to perform future OAuth requests for the user. @throws IOException @see <a href="https://coinbase.com/api/doc/1.0/users/create.html">coinbase.com/api/doc/1.0/users/create.html</a> @see {@link CoinbaseUser#createNewCoinbaseUser} and {@link CoinbaseUser#createCoinbaseNewUserWithReferrerId}
[ "Unauthenticated", "resource", "that", "creates", "a", "user", "with", "an", "email", "and", "password", "." ]
train
https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-coinbase/src/main/java/org/knowm/xchange/coinbase/service/CoinbaseBaseService.java#L82-L87
samskivert/samskivert
src/main/java/com/samskivert/swing/util/TaskMaster.java
TaskMaster.invokeMethodTask
public static void invokeMethodTask (String name, Object source, TaskObserver observer) { """ Invokes the method with the specified name on the supplied source object as if it were a task. The observer is notified when the method has completed and returned its result or if it fails. The named method must have a signature the same as the <code>invoke</code> method of the <code>Task</code> interface. Aborting tasks run in this way is not supported. """ // create a method task instance to invoke the named method and // then run that through the normal task invocation mechanism invokeTask(name, new MethodTask(name, source), observer); }
java
public static void invokeMethodTask (String name, Object source, TaskObserver observer) { // create a method task instance to invoke the named method and // then run that through the normal task invocation mechanism invokeTask(name, new MethodTask(name, source), observer); }
[ "public", "static", "void", "invokeMethodTask", "(", "String", "name", ",", "Object", "source", ",", "TaskObserver", "observer", ")", "{", "// create a method task instance to invoke the named method and", "// then run that through the normal task invocation mechanism", "invokeTask", "(", "name", ",", "new", "MethodTask", "(", "name", ",", "source", ")", ",", "observer", ")", ";", "}" ]
Invokes the method with the specified name on the supplied source object as if it were a task. The observer is notified when the method has completed and returned its result or if it fails. The named method must have a signature the same as the <code>invoke</code> method of the <code>Task</code> interface. Aborting tasks run in this way is not supported.
[ "Invokes", "the", "method", "with", "the", "specified", "name", "on", "the", "supplied", "source", "object", "as", "if", "it", "were", "a", "task", ".", "The", "observer", "is", "notified", "when", "the", "method", "has", "completed", "and", "returned", "its", "result", "or", "if", "it", "fails", ".", "The", "named", "method", "must", "have", "a", "signature", "the", "same", "as", "the", "<code", ">", "invoke<", "/", "code", ">", "method", "of", "the", "<code", ">", "Task<", "/", "code", ">", "interface", ".", "Aborting", "tasks", "run", "in", "this", "way", "is", "not", "supported", "." ]
train
https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/swing/util/TaskMaster.java#L52-L57
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.updateSubListAsync
public Observable<OperationStatus> updateSubListAsync(UUID appId, String versionId, UUID clEntityId, int subListId, WordListBaseUpdateObject wordListBaseUpdateObject) { """ Updates one of the closed list's sublists. @param appId The application ID. @param versionId The version ID. @param clEntityId The closed list entity extractor ID. @param subListId The sublist ID. @param wordListBaseUpdateObject A sublist update object containing the new canonical form and the list of words. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the OperationStatus object """ return updateSubListWithServiceResponseAsync(appId, versionId, clEntityId, subListId, wordListBaseUpdateObject).map(new Func1<ServiceResponse<OperationStatus>, OperationStatus>() { @Override public OperationStatus call(ServiceResponse<OperationStatus> response) { return response.body(); } }); }
java
public Observable<OperationStatus> updateSubListAsync(UUID appId, String versionId, UUID clEntityId, int subListId, WordListBaseUpdateObject wordListBaseUpdateObject) { return updateSubListWithServiceResponseAsync(appId, versionId, clEntityId, subListId, wordListBaseUpdateObject).map(new Func1<ServiceResponse<OperationStatus>, OperationStatus>() { @Override public OperationStatus call(ServiceResponse<OperationStatus> response) { return response.body(); } }); }
[ "public", "Observable", "<", "OperationStatus", ">", "updateSubListAsync", "(", "UUID", "appId", ",", "String", "versionId", ",", "UUID", "clEntityId", ",", "int", "subListId", ",", "WordListBaseUpdateObject", "wordListBaseUpdateObject", ")", "{", "return", "updateSubListWithServiceResponseAsync", "(", "appId", ",", "versionId", ",", "clEntityId", ",", "subListId", ",", "wordListBaseUpdateObject", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "OperationStatus", ">", ",", "OperationStatus", ">", "(", ")", "{", "@", "Override", "public", "OperationStatus", "call", "(", "ServiceResponse", "<", "OperationStatus", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Updates one of the closed list's sublists. @param appId The application ID. @param versionId The version ID. @param clEntityId The closed list entity extractor ID. @param subListId The sublist ID. @param wordListBaseUpdateObject A sublist update object containing the new canonical form and the list of words. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the OperationStatus object
[ "Updates", "one", "of", "the", "closed", "list", "s", "sublists", "." ]
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#L4999-L5006
lightblueseas/file-worker
src/main/java/de/alpharogroup/file/search/PathFinder.java
PathFinder.getRelativePathTo
public static File getRelativePathTo(final File parent, final String separator, final String folders, final String filename) { """ Gets the file or directory from the given parent File object and the relative path given over the list as String objects. @param parent The parent directory. @param separator The separator for separate the String folders. @param folders The relative path as a String object separated with the defined separator. @param filename The filename. @return the resulted file or directory from the given arguments. """ final List<String> list = new ArrayList<>(Arrays.asList(folders.split(separator))); if (filename != null && !filename.isEmpty()) { list.add(filename); } return getRelativePathTo(parent, list); }
java
public static File getRelativePathTo(final File parent, final String separator, final String folders, final String filename) { final List<String> list = new ArrayList<>(Arrays.asList(folders.split(separator))); if (filename != null && !filename.isEmpty()) { list.add(filename); } return getRelativePathTo(parent, list); }
[ "public", "static", "File", "getRelativePathTo", "(", "final", "File", "parent", ",", "final", "String", "separator", ",", "final", "String", "folders", ",", "final", "String", "filename", ")", "{", "final", "List", "<", "String", ">", "list", "=", "new", "ArrayList", "<>", "(", "Arrays", ".", "asList", "(", "folders", ".", "split", "(", "separator", ")", ")", ")", ";", "if", "(", "filename", "!=", "null", "&&", "!", "filename", ".", "isEmpty", "(", ")", ")", "{", "list", ".", "add", "(", "filename", ")", ";", "}", "return", "getRelativePathTo", "(", "parent", ",", "list", ")", ";", "}" ]
Gets the file or directory from the given parent File object and the relative path given over the list as String objects. @param parent The parent directory. @param separator The separator for separate the String folders. @param folders The relative path as a String object separated with the defined separator. @param filename The filename. @return the resulted file or directory from the given arguments.
[ "Gets", "the", "file", "or", "directory", "from", "the", "given", "parent", "File", "object", "and", "the", "relative", "path", "given", "over", "the", "list", "as", "String", "objects", "." ]
train
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/search/PathFinder.java#L162-L171
looly/hutool
hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java
ArrayUtil.sub
public static Object[] sub(Object array, int start, int end) { """ 获取子数组 @param array 数组 @param start 开始位置(包括) @param end 结束位置(不包括) @return 新的数组 @since 4.0.6 """ return sub(array, start, end, 1); }
java
public static Object[] sub(Object array, int start, int end) { return sub(array, start, end, 1); }
[ "public", "static", "Object", "[", "]", "sub", "(", "Object", "array", ",", "int", "start", ",", "int", "end", ")", "{", "return", "sub", "(", "array", ",", "start", ",", "end", ",", "1", ")", ";", "}" ]
获取子数组 @param array 数组 @param start 开始位置(包括) @param end 结束位置(不包括) @return 新的数组 @since 4.0.6
[ "获取子数组" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java#L2170-L2172
alkacon/opencms-core
src/org/opencms/ui/apps/sitemanager/CmsCreateSiteThread.java
CmsCreateSiteThread.createSitemapContentFolder
private void createSitemapContentFolder(CmsObject cms, CmsResource subSitemapFolder, String contentFolder) throws CmsException, CmsLoaderException { """ Helper method for creating the .content folder of a sub-sitemap.<p> @param cms the current CMS context @param subSitemapFolder the sub-sitemap folder in which the .content folder should be created @param contentFolder the content folder path @throws CmsException if something goes wrong @throws CmsLoaderException if something goes wrong """ CmsResource configFile = null; String sitePath = cms.getSitePath(subSitemapFolder); String folderName = CmsStringUtil.joinPaths(sitePath, CmsADEManager.CONTENT_FOLDER_NAME + "/"); String sitemapConfigName = CmsStringUtil.joinPaths(folderName, CmsADEManager.CONFIG_FILE_NAME); if (!cms.existsResource(folderName)) { cms.createResource( folderName, OpenCms.getResourceManager().getResourceType(CmsADEManager.CONFIG_FOLDER_TYPE)); } I_CmsResourceType configType = OpenCms.getResourceManager().getResourceType(CmsADEManager.CONFIG_TYPE); if (cms.existsResource(sitemapConfigName)) { configFile = cms.readResource(sitemapConfigName); if (!OpenCms.getResourceManager().getResourceType(configFile).getTypeName().equals( configType.getTypeName())) { throw new CmsException( Messages.get().container( Messages.ERR_CREATING_SUB_SITEMAP_WRONG_CONFIG_FILE_TYPE_2, sitemapConfigName, CmsADEManager.CONFIG_TYPE)); } } else { configFile = cms.createResource( sitemapConfigName, OpenCms.getResourceManager().getResourceType(CmsADEManager.CONFIG_TYPE)); } if (configFile != null) { try { CmsResource newFolder = m_cms.createResource( contentFolder + NEW, OpenCms.getResourceManager().getResourceType(CmsResourceTypeFolder.RESOURCE_TYPE_NAME)); I_CmsResourceType containerType = OpenCms.getResourceManager().getResourceType( org.opencms.file.types.CmsResourceTypeXmlContainerPage.RESOURCE_TYPE_NAME); CmsResource modelPage = m_cms.createResource(newFolder.getRootPath() + BLANK_HTML, containerType); String defTitle = Messages.get().getBundle(m_cms.getRequestContext().getLocale()).key( Messages.GUI_DEFAULT_MODEL_TITLE_1, m_site.getTitle()); String defDes = Messages.get().getBundle(m_cms.getRequestContext().getLocale()).key( Messages.GUI_DEFAULT_MODEL_DESCRIPTION_1, m_site.getTitle()); CmsProperty prop = new CmsProperty(CmsPropertyDefinition.PROPERTY_TITLE, defTitle, defTitle); m_cms.writePropertyObject(modelPage.getRootPath(), prop); prop = new CmsProperty(CmsPropertyDefinition.PROPERTY_DESCRIPTION, defDes, defDes); m_cms.writePropertyObject(modelPage.getRootPath(), prop); CmsFile file = m_cms.readFile(configFile); CmsXmlContent con = CmsXmlContentFactory.unmarshal(m_cms, file); con.addValue(m_cms, MODEL_PAGE, Locale.ENGLISH, 0); I_CmsXmlContentValue val = con.getValue(MODEL_PAGE_PAGE, Locale.ENGLISH); val.setStringValue(m_cms, modelPage.getRootPath()); file.setContents(con.marshal()); m_cms.writeFile(file); } catch (CmsException e) { LOG.error(e.getLocalizedMessage(), e); } } }
java
private void createSitemapContentFolder(CmsObject cms, CmsResource subSitemapFolder, String contentFolder) throws CmsException, CmsLoaderException { CmsResource configFile = null; String sitePath = cms.getSitePath(subSitemapFolder); String folderName = CmsStringUtil.joinPaths(sitePath, CmsADEManager.CONTENT_FOLDER_NAME + "/"); String sitemapConfigName = CmsStringUtil.joinPaths(folderName, CmsADEManager.CONFIG_FILE_NAME); if (!cms.existsResource(folderName)) { cms.createResource( folderName, OpenCms.getResourceManager().getResourceType(CmsADEManager.CONFIG_FOLDER_TYPE)); } I_CmsResourceType configType = OpenCms.getResourceManager().getResourceType(CmsADEManager.CONFIG_TYPE); if (cms.existsResource(sitemapConfigName)) { configFile = cms.readResource(sitemapConfigName); if (!OpenCms.getResourceManager().getResourceType(configFile).getTypeName().equals( configType.getTypeName())) { throw new CmsException( Messages.get().container( Messages.ERR_CREATING_SUB_SITEMAP_WRONG_CONFIG_FILE_TYPE_2, sitemapConfigName, CmsADEManager.CONFIG_TYPE)); } } else { configFile = cms.createResource( sitemapConfigName, OpenCms.getResourceManager().getResourceType(CmsADEManager.CONFIG_TYPE)); } if (configFile != null) { try { CmsResource newFolder = m_cms.createResource( contentFolder + NEW, OpenCms.getResourceManager().getResourceType(CmsResourceTypeFolder.RESOURCE_TYPE_NAME)); I_CmsResourceType containerType = OpenCms.getResourceManager().getResourceType( org.opencms.file.types.CmsResourceTypeXmlContainerPage.RESOURCE_TYPE_NAME); CmsResource modelPage = m_cms.createResource(newFolder.getRootPath() + BLANK_HTML, containerType); String defTitle = Messages.get().getBundle(m_cms.getRequestContext().getLocale()).key( Messages.GUI_DEFAULT_MODEL_TITLE_1, m_site.getTitle()); String defDes = Messages.get().getBundle(m_cms.getRequestContext().getLocale()).key( Messages.GUI_DEFAULT_MODEL_DESCRIPTION_1, m_site.getTitle()); CmsProperty prop = new CmsProperty(CmsPropertyDefinition.PROPERTY_TITLE, defTitle, defTitle); m_cms.writePropertyObject(modelPage.getRootPath(), prop); prop = new CmsProperty(CmsPropertyDefinition.PROPERTY_DESCRIPTION, defDes, defDes); m_cms.writePropertyObject(modelPage.getRootPath(), prop); CmsFile file = m_cms.readFile(configFile); CmsXmlContent con = CmsXmlContentFactory.unmarshal(m_cms, file); con.addValue(m_cms, MODEL_PAGE, Locale.ENGLISH, 0); I_CmsXmlContentValue val = con.getValue(MODEL_PAGE_PAGE, Locale.ENGLISH); val.setStringValue(m_cms, modelPage.getRootPath()); file.setContents(con.marshal()); m_cms.writeFile(file); } catch (CmsException e) { LOG.error(e.getLocalizedMessage(), e); } } }
[ "private", "void", "createSitemapContentFolder", "(", "CmsObject", "cms", ",", "CmsResource", "subSitemapFolder", ",", "String", "contentFolder", ")", "throws", "CmsException", ",", "CmsLoaderException", "{", "CmsResource", "configFile", "=", "null", ";", "String", "sitePath", "=", "cms", ".", "getSitePath", "(", "subSitemapFolder", ")", ";", "String", "folderName", "=", "CmsStringUtil", ".", "joinPaths", "(", "sitePath", ",", "CmsADEManager", ".", "CONTENT_FOLDER_NAME", "+", "\"/\"", ")", ";", "String", "sitemapConfigName", "=", "CmsStringUtil", ".", "joinPaths", "(", "folderName", ",", "CmsADEManager", ".", "CONFIG_FILE_NAME", ")", ";", "if", "(", "!", "cms", ".", "existsResource", "(", "folderName", ")", ")", "{", "cms", ".", "createResource", "(", "folderName", ",", "OpenCms", ".", "getResourceManager", "(", ")", ".", "getResourceType", "(", "CmsADEManager", ".", "CONFIG_FOLDER_TYPE", ")", ")", ";", "}", "I_CmsResourceType", "configType", "=", "OpenCms", ".", "getResourceManager", "(", ")", ".", "getResourceType", "(", "CmsADEManager", ".", "CONFIG_TYPE", ")", ";", "if", "(", "cms", ".", "existsResource", "(", "sitemapConfigName", ")", ")", "{", "configFile", "=", "cms", ".", "readResource", "(", "sitemapConfigName", ")", ";", "if", "(", "!", "OpenCms", ".", "getResourceManager", "(", ")", ".", "getResourceType", "(", "configFile", ")", ".", "getTypeName", "(", ")", ".", "equals", "(", "configType", ".", "getTypeName", "(", ")", ")", ")", "{", "throw", "new", "CmsException", "(", "Messages", ".", "get", "(", ")", ".", "container", "(", "Messages", ".", "ERR_CREATING_SUB_SITEMAP_WRONG_CONFIG_FILE_TYPE_2", ",", "sitemapConfigName", ",", "CmsADEManager", ".", "CONFIG_TYPE", ")", ")", ";", "}", "}", "else", "{", "configFile", "=", "cms", ".", "createResource", "(", "sitemapConfigName", ",", "OpenCms", ".", "getResourceManager", "(", ")", ".", "getResourceType", "(", "CmsADEManager", ".", "CONFIG_TYPE", ")", ")", ";", "}", "if", "(", "configFile", "!=", "null", ")", "{", "try", "{", "CmsResource", "newFolder", "=", "m_cms", ".", "createResource", "(", "contentFolder", "+", "NEW", ",", "OpenCms", ".", "getResourceManager", "(", ")", ".", "getResourceType", "(", "CmsResourceTypeFolder", ".", "RESOURCE_TYPE_NAME", ")", ")", ";", "I_CmsResourceType", "containerType", "=", "OpenCms", ".", "getResourceManager", "(", ")", ".", "getResourceType", "(", "org", ".", "opencms", ".", "file", ".", "types", ".", "CmsResourceTypeXmlContainerPage", ".", "RESOURCE_TYPE_NAME", ")", ";", "CmsResource", "modelPage", "=", "m_cms", ".", "createResource", "(", "newFolder", ".", "getRootPath", "(", ")", "+", "BLANK_HTML", ",", "containerType", ")", ";", "String", "defTitle", "=", "Messages", ".", "get", "(", ")", ".", "getBundle", "(", "m_cms", ".", "getRequestContext", "(", ")", ".", "getLocale", "(", ")", ")", ".", "key", "(", "Messages", ".", "GUI_DEFAULT_MODEL_TITLE_1", ",", "m_site", ".", "getTitle", "(", ")", ")", ";", "String", "defDes", "=", "Messages", ".", "get", "(", ")", ".", "getBundle", "(", "m_cms", ".", "getRequestContext", "(", ")", ".", "getLocale", "(", ")", ")", ".", "key", "(", "Messages", ".", "GUI_DEFAULT_MODEL_DESCRIPTION_1", ",", "m_site", ".", "getTitle", "(", ")", ")", ";", "CmsProperty", "prop", "=", "new", "CmsProperty", "(", "CmsPropertyDefinition", ".", "PROPERTY_TITLE", ",", "defTitle", ",", "defTitle", ")", ";", "m_cms", ".", "writePropertyObject", "(", "modelPage", ".", "getRootPath", "(", ")", ",", "prop", ")", ";", "prop", "=", "new", "CmsProperty", "(", "CmsPropertyDefinition", ".", "PROPERTY_DESCRIPTION", ",", "defDes", ",", "defDes", ")", ";", "m_cms", ".", "writePropertyObject", "(", "modelPage", ".", "getRootPath", "(", ")", ",", "prop", ")", ";", "CmsFile", "file", "=", "m_cms", ".", "readFile", "(", "configFile", ")", ";", "CmsXmlContent", "con", "=", "CmsXmlContentFactory", ".", "unmarshal", "(", "m_cms", ",", "file", ")", ";", "con", ".", "addValue", "(", "m_cms", ",", "MODEL_PAGE", ",", "Locale", ".", "ENGLISH", ",", "0", ")", ";", "I_CmsXmlContentValue", "val", "=", "con", ".", "getValue", "(", "MODEL_PAGE_PAGE", ",", "Locale", ".", "ENGLISH", ")", ";", "val", ".", "setStringValue", "(", "m_cms", ",", "modelPage", ".", "getRootPath", "(", ")", ")", ";", "file", ".", "setContents", "(", "con", ".", "marshal", "(", ")", ")", ";", "m_cms", ".", "writeFile", "(", "file", ")", ";", "}", "catch", "(", "CmsException", "e", ")", "{", "LOG", ".", "error", "(", "e", ".", "getLocalizedMessage", "(", ")", ",", "e", ")", ";", "}", "}", "}" ]
Helper method for creating the .content folder of a sub-sitemap.<p> @param cms the current CMS context @param subSitemapFolder the sub-sitemap folder in which the .content folder should be created @param contentFolder the content folder path @throws CmsException if something goes wrong @throws CmsLoaderException if something goes wrong
[ "Helper", "method", "for", "creating", "the", ".", "content", "folder", "of", "a", "sub", "-", "sitemap", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/sitemanager/CmsCreateSiteThread.java#L334-L392
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/xml/hints/HintRule.java
HintRule.addGivenVendor
public void addGivenVendor(String source, String name, String value, boolean regex, Confidence confidence) { """ Adds a given vendors to the list of evidence to matched. @param source the source of the evidence @param name the name of the evidence @param value the value of the evidence @param regex whether value is a regex @param confidence the confidence of the evidence """ givenVendor.add(new EvidenceMatcher(source, name, value, regex, confidence)); }
java
public void addGivenVendor(String source, String name, String value, boolean regex, Confidence confidence) { givenVendor.add(new EvidenceMatcher(source, name, value, regex, confidence)); }
[ "public", "void", "addGivenVendor", "(", "String", "source", ",", "String", "name", ",", "String", "value", ",", "boolean", "regex", ",", "Confidence", "confidence", ")", "{", "givenVendor", ".", "add", "(", "new", "EvidenceMatcher", "(", "source", ",", "name", ",", "value", ",", "regex", ",", "confidence", ")", ")", ";", "}" ]
Adds a given vendors to the list of evidence to matched. @param source the source of the evidence @param name the name of the evidence @param value the value of the evidence @param regex whether value is a regex @param confidence the confidence of the evidence
[ "Adds", "a", "given", "vendors", "to", "the", "list", "of", "evidence", "to", "matched", "." ]
train
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/xml/hints/HintRule.java#L128-L130
cdk/cdk
misc/extra/src/main/java/org/openscience/cdk/tools/GridGenerator.java
GridGenerator.setDimension
public void setDimension(double[] minMax, boolean cubicGridFlag) { """ Method sets the maximal 3d dimensions to given min and max values. """ if (cubicGridFlag) { double min = minMax[0]; double max = minMax[0]; for (int i = 0; i < minMax.length; i++) { if (minMax[i] < min) { min = minMax[i]; } else if (minMax[i] > max) { max = minMax[i]; } } setDimension(min, max); } else { this.minx = minMax[0]; this.maxx = minMax[1]; this.miny = minMax[2]; this.maxy = minMax[3]; this.minz = minMax[4]; this.maxz = minMax[5]; } }
java
public void setDimension(double[] minMax, boolean cubicGridFlag) { if (cubicGridFlag) { double min = minMax[0]; double max = minMax[0]; for (int i = 0; i < minMax.length; i++) { if (minMax[i] < min) { min = minMax[i]; } else if (minMax[i] > max) { max = minMax[i]; } } setDimension(min, max); } else { this.minx = minMax[0]; this.maxx = minMax[1]; this.miny = minMax[2]; this.maxy = minMax[3]; this.minz = minMax[4]; this.maxz = minMax[5]; } }
[ "public", "void", "setDimension", "(", "double", "[", "]", "minMax", ",", "boolean", "cubicGridFlag", ")", "{", "if", "(", "cubicGridFlag", ")", "{", "double", "min", "=", "minMax", "[", "0", "]", ";", "double", "max", "=", "minMax", "[", "0", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "minMax", ".", "length", ";", "i", "++", ")", "{", "if", "(", "minMax", "[", "i", "]", "<", "min", ")", "{", "min", "=", "minMax", "[", "i", "]", ";", "}", "else", "if", "(", "minMax", "[", "i", "]", ">", "max", ")", "{", "max", "=", "minMax", "[", "i", "]", ";", "}", "}", "setDimension", "(", "min", ",", "max", ")", ";", "}", "else", "{", "this", ".", "minx", "=", "minMax", "[", "0", "]", ";", "this", ".", "maxx", "=", "minMax", "[", "1", "]", ";", "this", ".", "miny", "=", "minMax", "[", "2", "]", ";", "this", ".", "maxy", "=", "minMax", "[", "3", "]", ";", "this", ".", "minz", "=", "minMax", "[", "4", "]", ";", "this", ".", "maxz", "=", "minMax", "[", "5", "]", ";", "}", "}" ]
Method sets the maximal 3d dimensions to given min and max values.
[ "Method", "sets", "the", "maximal", "3d", "dimensions", "to", "given", "min", "and", "max", "values", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/misc/extra/src/main/java/org/openscience/cdk/tools/GridGenerator.java#L86-L106
YahooArchive/samoa
samoa-api/src/main/java/com/yahoo/labs/samoa/topology/TopologyBuilder.java
TopologyBuilder.createPi
private ProcessingItem createPi(Processor processor, int parallelism) { """ Creates a processing item with a specific processor and paralellism level. @param processor @param parallelism @return ProcessingItem """ ProcessingItem pi = this.componentFactory.createPi(processor, parallelism); this.topology.addProcessingItem(pi, parallelism); return pi; }
java
private ProcessingItem createPi(Processor processor, int parallelism) { ProcessingItem pi = this.componentFactory.createPi(processor, parallelism); this.topology.addProcessingItem(pi, parallelism); return pi; }
[ "private", "ProcessingItem", "createPi", "(", "Processor", "processor", ",", "int", "parallelism", ")", "{", "ProcessingItem", "pi", "=", "this", ".", "componentFactory", ".", "createPi", "(", "processor", ",", "parallelism", ")", ";", "this", ".", "topology", ".", "addProcessingItem", "(", "pi", ",", "parallelism", ")", ";", "return", "pi", ";", "}" ]
Creates a processing item with a specific processor and paralellism level. @param processor @param parallelism @return ProcessingItem
[ "Creates", "a", "processing", "item", "with", "a", "specific", "processor", "and", "paralellism", "level", "." ]
train
https://github.com/YahooArchive/samoa/blob/540a2c30167ac85c432b593baabd5ca97e7e8a0f/samoa-api/src/main/java/com/yahoo/labs/samoa/topology/TopologyBuilder.java#L190-L194
alexvasilkov/AndroidCommons
library/src/main/java/com/alexvasilkov/android/commons/prefs/PreferencesHelper.java
PreferencesHelper.getJson
@Nullable public static <T> T getJson(@NonNull SharedPreferences prefs, @NonNull String key, @NonNull Class<T> clazz) { """ Retrieves object stored as json encoded string. Gson library should be available in classpath. """ return getJson(prefs, key, (Type) clazz); }
java
@Nullable public static <T> T getJson(@NonNull SharedPreferences prefs, @NonNull String key, @NonNull Class<T> clazz) { return getJson(prefs, key, (Type) clazz); }
[ "@", "Nullable", "public", "static", "<", "T", ">", "T", "getJson", "(", "@", "NonNull", "SharedPreferences", "prefs", ",", "@", "NonNull", "String", "key", ",", "@", "NonNull", "Class", "<", "T", ">", "clazz", ")", "{", "return", "getJson", "(", "prefs", ",", "key", ",", "(", "Type", ")", "clazz", ")", ";", "}" ]
Retrieves object stored as json encoded string. Gson library should be available in classpath.
[ "Retrieves", "object", "stored", "as", "json", "encoded", "string", ".", "Gson", "library", "should", "be", "available", "in", "classpath", "." ]
train
https://github.com/alexvasilkov/AndroidCommons/blob/aca9f6d5acfc6bd3694984b7f89956e1a0146ddb/library/src/main/java/com/alexvasilkov/android/commons/prefs/PreferencesHelper.java#L140-L144
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/FinalParameters.java
FinalParameters.getRegisterName
private static String getRegisterName(final Code obj, final int reg) { """ returns the variable name of the specified register slot @param obj the currently parsed code object @param reg the variable register of interest @return the variable name of the specified register """ LocalVariableTable lvt = obj.getLocalVariableTable(); if (lvt != null) { LocalVariable lv = lvt.getLocalVariable(reg, 0); if (lv != null) { return lv.getName(); } } return String.valueOf(reg); }
java
private static String getRegisterName(final Code obj, final int reg) { LocalVariableTable lvt = obj.getLocalVariableTable(); if (lvt != null) { LocalVariable lv = lvt.getLocalVariable(reg, 0); if (lv != null) { return lv.getName(); } } return String.valueOf(reg); }
[ "private", "static", "String", "getRegisterName", "(", "final", "Code", "obj", ",", "final", "int", "reg", ")", "{", "LocalVariableTable", "lvt", "=", "obj", ".", "getLocalVariableTable", "(", ")", ";", "if", "(", "lvt", "!=", "null", ")", "{", "LocalVariable", "lv", "=", "lvt", ".", "getLocalVariable", "(", "reg", ",", "0", ")", ";", "if", "(", "lv", "!=", "null", ")", "{", "return", "lv", ".", "getName", "(", ")", ";", "}", "}", "return", "String", ".", "valueOf", "(", "reg", ")", ";", "}" ]
returns the variable name of the specified register slot @param obj the currently parsed code object @param reg the variable register of interest @return the variable name of the specified register
[ "returns", "the", "variable", "name", "of", "the", "specified", "register", "slot" ]
train
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/FinalParameters.java#L238-L247
JodaOrg/joda-time
src/main/java/org/joda/time/DateTimeZone.java
DateTimeZone.adjustOffset
public long adjustOffset(long instant, boolean earlierOrLater) { """ Adjusts the offset to be the earlier or later one during an overlap. @param instant the instant to adjust @param earlierOrLater false for earlier, true for later @return the adjusted instant millis """ // a bit messy, but will work in all non-pathological cases // evaluate 3 hours before and after to work out if anything is happening long instantBefore = instant - 3 * DateTimeConstants.MILLIS_PER_HOUR; long instantAfter = instant + 3 * DateTimeConstants.MILLIS_PER_HOUR; long offsetBefore = getOffset(instantBefore); long offsetAfter = getOffset(instantAfter); if (offsetBefore <= offsetAfter) { return instant; // not an overlap (less than is a gap, equal is normal case) } // work out range of instants that have duplicate local times long diff = offsetBefore - offsetAfter; long transition = nextTransition(instantBefore); long overlapStart = transition - diff; long overlapEnd = transition + diff; if (instant < overlapStart || instant >= overlapEnd) { return instant; // not an overlap } // calculate result long afterStart = instant - overlapStart; if (afterStart >= diff) { // currently in later offset return earlierOrLater ? instant : instant - diff; } else { // currently in earlier offset return earlierOrLater ? instant + diff : instant; } }
java
public long adjustOffset(long instant, boolean earlierOrLater) { // a bit messy, but will work in all non-pathological cases // evaluate 3 hours before and after to work out if anything is happening long instantBefore = instant - 3 * DateTimeConstants.MILLIS_PER_HOUR; long instantAfter = instant + 3 * DateTimeConstants.MILLIS_PER_HOUR; long offsetBefore = getOffset(instantBefore); long offsetAfter = getOffset(instantAfter); if (offsetBefore <= offsetAfter) { return instant; // not an overlap (less than is a gap, equal is normal case) } // work out range of instants that have duplicate local times long diff = offsetBefore - offsetAfter; long transition = nextTransition(instantBefore); long overlapStart = transition - diff; long overlapEnd = transition + diff; if (instant < overlapStart || instant >= overlapEnd) { return instant; // not an overlap } // calculate result long afterStart = instant - overlapStart; if (afterStart >= diff) { // currently in later offset return earlierOrLater ? instant : instant - diff; } else { // currently in earlier offset return earlierOrLater ? instant + diff : instant; } }
[ "public", "long", "adjustOffset", "(", "long", "instant", ",", "boolean", "earlierOrLater", ")", "{", "// a bit messy, but will work in all non-pathological cases", "// evaluate 3 hours before and after to work out if anything is happening", "long", "instantBefore", "=", "instant", "-", "3", "*", "DateTimeConstants", ".", "MILLIS_PER_HOUR", ";", "long", "instantAfter", "=", "instant", "+", "3", "*", "DateTimeConstants", ".", "MILLIS_PER_HOUR", ";", "long", "offsetBefore", "=", "getOffset", "(", "instantBefore", ")", ";", "long", "offsetAfter", "=", "getOffset", "(", "instantAfter", ")", ";", "if", "(", "offsetBefore", "<=", "offsetAfter", ")", "{", "return", "instant", ";", "// not an overlap (less than is a gap, equal is normal case)", "}", "// work out range of instants that have duplicate local times", "long", "diff", "=", "offsetBefore", "-", "offsetAfter", ";", "long", "transition", "=", "nextTransition", "(", "instantBefore", ")", ";", "long", "overlapStart", "=", "transition", "-", "diff", ";", "long", "overlapEnd", "=", "transition", "+", "diff", ";", "if", "(", "instant", "<", "overlapStart", "||", "instant", ">=", "overlapEnd", ")", "{", "return", "instant", ";", "// not an overlap", "}", "// calculate result", "long", "afterStart", "=", "instant", "-", "overlapStart", ";", "if", "(", "afterStart", ">=", "diff", ")", "{", "// currently in later offset", "return", "earlierOrLater", "?", "instant", ":", "instant", "-", "diff", ";", "}", "else", "{", "// currently in earlier offset", "return", "earlierOrLater", "?", "instant", "+", "diff", ":", "instant", ";", "}", "}" ]
Adjusts the offset to be the earlier or later one during an overlap. @param instant the instant to adjust @param earlierOrLater false for earlier, true for later @return the adjusted instant millis
[ "Adjusts", "the", "offset", "to", "be", "the", "earlier", "or", "later", "one", "during", "an", "overlap", "." ]
train
https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/DateTimeZone.java#L1195-L1225
Erudika/para
para-core/src/main/java/com/erudika/para/Para.java
Para.getParaClassLoader
public static ClassLoader getParaClassLoader() { """ Returns the {@link URLClassLoader} classloader for Para. Used for loading JAR files from 'lib/*.jar'. @return a classloader """ if (paraClassLoader == null) { try { ClassLoader currentClassLoader = Thread.currentThread().getContextClassLoader(); List<URL> jars = new ArrayList<>(); File lib = new File(Config.getConfigParam("plugin_folder", "lib/")); if (lib.exists() && lib.isDirectory()) { for (File file : FileUtils.listFiles(lib, new String[]{"jar"}, false)) { jars.add(file.toURI().toURL()); } } paraClassLoader = new URLClassLoader(jars.toArray(new URL[0]), currentClassLoader); // Thread.currentThread().setContextClassLoader(paraClassLoader); } catch (Exception e) { logger.error(null, e); } } return paraClassLoader; }
java
public static ClassLoader getParaClassLoader() { if (paraClassLoader == null) { try { ClassLoader currentClassLoader = Thread.currentThread().getContextClassLoader(); List<URL> jars = new ArrayList<>(); File lib = new File(Config.getConfigParam("plugin_folder", "lib/")); if (lib.exists() && lib.isDirectory()) { for (File file : FileUtils.listFiles(lib, new String[]{"jar"}, false)) { jars.add(file.toURI().toURL()); } } paraClassLoader = new URLClassLoader(jars.toArray(new URL[0]), currentClassLoader); // Thread.currentThread().setContextClassLoader(paraClassLoader); } catch (Exception e) { logger.error(null, e); } } return paraClassLoader; }
[ "public", "static", "ClassLoader", "getParaClassLoader", "(", ")", "{", "if", "(", "paraClassLoader", "==", "null", ")", "{", "try", "{", "ClassLoader", "currentClassLoader", "=", "Thread", ".", "currentThread", "(", ")", ".", "getContextClassLoader", "(", ")", ";", "List", "<", "URL", ">", "jars", "=", "new", "ArrayList", "<>", "(", ")", ";", "File", "lib", "=", "new", "File", "(", "Config", ".", "getConfigParam", "(", "\"plugin_folder\"", ",", "\"lib/\"", ")", ")", ";", "if", "(", "lib", ".", "exists", "(", ")", "&&", "lib", ".", "isDirectory", "(", ")", ")", "{", "for", "(", "File", "file", ":", "FileUtils", ".", "listFiles", "(", "lib", ",", "new", "String", "[", "]", "{", "\"jar\"", "}", ",", "false", ")", ")", "{", "jars", ".", "add", "(", "file", ".", "toURI", "(", ")", ".", "toURL", "(", ")", ")", ";", "}", "}", "paraClassLoader", "=", "new", "URLClassLoader", "(", "jars", ".", "toArray", "(", "new", "URL", "[", "0", "]", ")", ",", "currentClassLoader", ")", ";", "// Thread.currentThread().setContextClassLoader(paraClassLoader);", "}", "catch", "(", "Exception", "e", ")", "{", "logger", ".", "error", "(", "null", ",", "e", ")", ";", "}", "}", "return", "paraClassLoader", ";", "}" ]
Returns the {@link URLClassLoader} classloader for Para. Used for loading JAR files from 'lib/*.jar'. @return a classloader
[ "Returns", "the", "{" ]
train
https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-core/src/main/java/com/erudika/para/Para.java#L320-L338
lucee/Lucee
core/src/main/java/lucee/runtime/type/scope/session/SessionFile.java
SessionFile.getInstance
public static Session getInstance(String name, PageContext pc, Log log) { """ load new instance of the class @param name @param pc @param checkExpires @return """ Resource res = _loadResource(pc.getConfig(), SCOPE_SESSION, name, pc.getCFID()); Struct data = _loadData(pc, res, log); return new SessionFile(pc, res, data); }
java
public static Session getInstance(String name, PageContext pc, Log log) { Resource res = _loadResource(pc.getConfig(), SCOPE_SESSION, name, pc.getCFID()); Struct data = _loadData(pc, res, log); return new SessionFile(pc, res, data); }
[ "public", "static", "Session", "getInstance", "(", "String", "name", ",", "PageContext", "pc", ",", "Log", "log", ")", "{", "Resource", "res", "=", "_loadResource", "(", "pc", ".", "getConfig", "(", ")", ",", "SCOPE_SESSION", ",", "name", ",", "pc", ".", "getCFID", "(", ")", ")", ";", "Struct", "data", "=", "_loadData", "(", "pc", ",", "res", ",", "log", ")", ";", "return", "new", "SessionFile", "(", "pc", ",", "res", ",", "data", ")", ";", "}" ]
load new instance of the class @param name @param pc @param checkExpires @return
[ "load", "new", "instance", "of", "the", "class" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/type/scope/session/SessionFile.java#L61-L66
sundrio/sundrio
codegen/src/main/java/io/sundr/codegen/utils/TypeUtils.java
TypeUtils.typeExtends
public static TypeDef typeExtends(TypeDef base, ClassRef superClass) { """ Sets one {@link io.sundr.codegen.model.TypeDef} as a super class of an other. @param base The base type. @param superClass The super type. @return The updated type definition. """ return new TypeDefBuilder(base) .withExtendsList(superClass) .build(); }
java
public static TypeDef typeExtends(TypeDef base, ClassRef superClass) { return new TypeDefBuilder(base) .withExtendsList(superClass) .build(); }
[ "public", "static", "TypeDef", "typeExtends", "(", "TypeDef", "base", ",", "ClassRef", "superClass", ")", "{", "return", "new", "TypeDefBuilder", "(", "base", ")", ".", "withExtendsList", "(", "superClass", ")", ".", "build", "(", ")", ";", "}" ]
Sets one {@link io.sundr.codegen.model.TypeDef} as a super class of an other. @param base The base type. @param superClass The super type. @return The updated type definition.
[ "Sets", "one", "{", "@link", "io", ".", "sundr", ".", "codegen", ".", "model", ".", "TypeDef", "}", "as", "a", "super", "class", "of", "an", "other", "." ]
train
https://github.com/sundrio/sundrio/blob/4e38368f4db0d950f7c41a8c75e15b0baff1f69a/codegen/src/main/java/io/sundr/codegen/utils/TypeUtils.java#L160-L164
osglworks/java-tool
src/main/java/org/osgl/util/IO.java
IO.zipInto
public static void zipInto(File target, File... files) { """ Zip a list of files into specified target file. @param target the target file as the zip package @param files the files to be zipped. """ ZipOutputStream zos = null; try { zos = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(target))); byte[] buffer = new byte[128]; for (File f : files) { ZipEntry entry = new ZipEntry(f.getName()); InputStream is = new BufferedInputStream(new FileInputStream(f)); zos.putNextEntry(entry); int read = 0; while ((read = is.read(buffer)) != -1) { zos.write(buffer, 0, read); } zos.closeEntry(); IO.close(is); } } catch (IOException e) { throw E.ioException(e); } finally { IO.close(zos); } }
java
public static void zipInto(File target, File... files) { ZipOutputStream zos = null; try { zos = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(target))); byte[] buffer = new byte[128]; for (File f : files) { ZipEntry entry = new ZipEntry(f.getName()); InputStream is = new BufferedInputStream(new FileInputStream(f)); zos.putNextEntry(entry); int read = 0; while ((read = is.read(buffer)) != -1) { zos.write(buffer, 0, read); } zos.closeEntry(); IO.close(is); } } catch (IOException e) { throw E.ioException(e); } finally { IO.close(zos); } }
[ "public", "static", "void", "zipInto", "(", "File", "target", ",", "File", "...", "files", ")", "{", "ZipOutputStream", "zos", "=", "null", ";", "try", "{", "zos", "=", "new", "ZipOutputStream", "(", "new", "BufferedOutputStream", "(", "new", "FileOutputStream", "(", "target", ")", ")", ")", ";", "byte", "[", "]", "buffer", "=", "new", "byte", "[", "128", "]", ";", "for", "(", "File", "f", ":", "files", ")", "{", "ZipEntry", "entry", "=", "new", "ZipEntry", "(", "f", ".", "getName", "(", ")", ")", ";", "InputStream", "is", "=", "new", "BufferedInputStream", "(", "new", "FileInputStream", "(", "f", ")", ")", ";", "zos", ".", "putNextEntry", "(", "entry", ")", ";", "int", "read", "=", "0", ";", "while", "(", "(", "read", "=", "is", ".", "read", "(", "buffer", ")", ")", "!=", "-", "1", ")", "{", "zos", ".", "write", "(", "buffer", ",", "0", ",", "read", ")", ";", "}", "zos", ".", "closeEntry", "(", ")", ";", "IO", ".", "close", "(", "is", ")", ";", "}", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "E", ".", "ioException", "(", "e", ")", ";", "}", "finally", "{", "IO", ".", "close", "(", "zos", ")", ";", "}", "}" ]
Zip a list of files into specified target file. @param target the target file as the zip package @param files the files to be zipped.
[ "Zip", "a", "list", "of", "files", "into", "specified", "target", "file", "." ]
train
https://github.com/osglworks/java-tool/blob/8b6eee2bccb067eb32e6a7bc4a4dfef7a7d9008b/src/main/java/org/osgl/util/IO.java#L2131-L2152
aws/aws-sdk-java
aws-java-sdk-devicefarm/src/main/java/com/amazonaws/services/devicefarm/model/GetOfferingStatusResult.java
GetOfferingStatusResult.withNextPeriod
public GetOfferingStatusResult withNextPeriod(java.util.Map<String, OfferingStatus> nextPeriod) { """ <p> When specified, gets the offering status for the next period. </p> @param nextPeriod When specified, gets the offering status for the next period. @return Returns a reference to this object so that method calls can be chained together. """ setNextPeriod(nextPeriod); return this; }
java
public GetOfferingStatusResult withNextPeriod(java.util.Map<String, OfferingStatus> nextPeriod) { setNextPeriod(nextPeriod); return this; }
[ "public", "GetOfferingStatusResult", "withNextPeriod", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "OfferingStatus", ">", "nextPeriod", ")", "{", "setNextPeriod", "(", "nextPeriod", ")", ";", "return", "this", ";", "}" ]
<p> When specified, gets the offering status for the next period. </p> @param nextPeriod When specified, gets the offering status for the next period. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "When", "specified", "gets", "the", "offering", "status", "for", "the", "next", "period", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-devicefarm/src/main/java/com/amazonaws/services/devicefarm/model/GetOfferingStatusResult.java#L145-L148
wellner/jcarafe
jcarafe-core/src/main/java/cern/colt/map/OpenIntDoubleHashMap.java
OpenIntDoubleHashMap.pairsMatching
public void pairsMatching(final IntDoubleProcedure condition, final IntArrayList keyList, final DoubleArrayList valueList) { """ Fills all pairs satisfying a given condition into the specified lists. Fills into the lists, starting at index 0. After this call returns the specified lists both have a new size, the number of pairs satisfying the condition. Iteration order is guaranteed to be <i>identical</i> to the order used by method {@link #forEachKey(IntProcedure)}. <p> <b>Example:</b> <br> <pre> IntDoubleProcedure condition = new IntDoubleProcedure() { // match even keys only public boolean apply(int key, double value) { return key%2==0; } } keys = (8,7,6), values = (1,2,2) --> keyList = (6,8), valueList = (2,1)</tt> </pre> @param condition the condition to be matched. Takes the current key as first and the current value as second argument. @param keyList the list to be filled with keys, can have any size. @param valueList the list to be filled with values, can have any size. """ keyList.clear(); valueList.clear(); for (int i = table.length ; i-- > 0 ;) { if (state[i]==FULL && condition.apply(table[i],values[i])) { keyList.add(table[i]); valueList.add(values[i]); } } }
java
public void pairsMatching(final IntDoubleProcedure condition, final IntArrayList keyList, final DoubleArrayList valueList) { keyList.clear(); valueList.clear(); for (int i = table.length ; i-- > 0 ;) { if (state[i]==FULL && condition.apply(table[i],values[i])) { keyList.add(table[i]); valueList.add(values[i]); } } }
[ "public", "void", "pairsMatching", "(", "final", "IntDoubleProcedure", "condition", ",", "final", "IntArrayList", "keyList", ",", "final", "DoubleArrayList", "valueList", ")", "{", "keyList", ".", "clear", "(", ")", ";", "valueList", ".", "clear", "(", ")", ";", "for", "(", "int", "i", "=", "table", ".", "length", ";", "i", "--", ">", "0", ";", ")", "{", "if", "(", "state", "[", "i", "]", "==", "FULL", "&&", "condition", ".", "apply", "(", "table", "[", "i", "]", ",", "values", "[", "i", "]", ")", ")", "{", "keyList", ".", "add", "(", "table", "[", "i", "]", ")", ";", "valueList", ".", "add", "(", "values", "[", "i", "]", ")", ";", "}", "}", "}" ]
Fills all pairs satisfying a given condition into the specified lists. Fills into the lists, starting at index 0. After this call returns the specified lists both have a new size, the number of pairs satisfying the condition. Iteration order is guaranteed to be <i>identical</i> to the order used by method {@link #forEachKey(IntProcedure)}. <p> <b>Example:</b> <br> <pre> IntDoubleProcedure condition = new IntDoubleProcedure() { // match even keys only public boolean apply(int key, double value) { return key%2==0; } } keys = (8,7,6), values = (1,2,2) --> keyList = (6,8), valueList = (2,1)</tt> </pre> @param condition the condition to be matched. Takes the current key as first and the current value as second argument. @param keyList the list to be filled with keys, can have any size. @param valueList the list to be filled with values, can have any size.
[ "Fills", "all", "pairs", "satisfying", "a", "given", "condition", "into", "the", "specified", "lists", ".", "Fills", "into", "the", "lists", "starting", "at", "index", "0", ".", "After", "this", "call", "returns", "the", "specified", "lists", "both", "have", "a", "new", "size", "the", "number", "of", "pairs", "satisfying", "the", "condition", ".", "Iteration", "order", "is", "guaranteed", "to", "be", "<i", ">", "identical<", "/", "i", ">", "to", "the", "order", "used", "by", "method", "{", "@link", "#forEachKey", "(", "IntProcedure", ")", "}", ".", "<p", ">", "<b", ">", "Example", ":", "<", "/", "b", ">", "<br", ">", "<pre", ">", "IntDoubleProcedure", "condition", "=", "new", "IntDoubleProcedure", "()", "{", "//", "match", "even", "keys", "only", "public", "boolean", "apply", "(", "int", "key", "double", "value", ")", "{", "return", "key%2", "==", "0", ";", "}", "}", "keys", "=", "(", "8", "7", "6", ")", "values", "=", "(", "1", "2", "2", ")", "--", ">", "keyList", "=", "(", "6", "8", ")", "valueList", "=", "(", "2", "1", ")", "<", "/", "tt", ">", "<", "/", "pre", ">" ]
train
https://github.com/wellner/jcarafe/blob/ab8b0a83dbf600fe80c27711815c90bd3055b217/jcarafe-core/src/main/java/cern/colt/map/OpenIntDoubleHashMap.java#L370-L380
lievendoclo/Valkyrie-RCP
valkyrie-rcp-samples/valkyrie-rcp-vldocking-sample/src/main/java/org/valkyriercp/sample/vldocking/ui/InitialView.java
InitialView.createControl
protected JComponent createControl() { """ Create the actual UI control for this view. It will be placed into the window according to the layout of the page holding this view. """ // In this view, we're just going to use standard Swing to place a // few controls. // The location of the text to display has been set as a Resource in the // property descriptionTextPath. So, use that resource to obtain a URL // and set that as the page for the text pane. JTextPane textPane = new JTextPane(); JScrollPane spDescription = getApplicationConfig().componentFactory().createScrollPane(textPane); try { textPane.setPage(getDescriptionTextPath().getURL()); } catch (IOException e) { throw new RuntimeException("Unable to load description URL", e); } JLabel lblMessage = getApplicationConfig().componentFactory().createLabel(getFirstMessage()); lblMessage.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0)); JPanel panel = getApplicationConfig().componentFactory().createPanel(new BorderLayout()); panel.add(spDescription); panel.add(lblMessage, BorderLayout.SOUTH); return panel; }
java
protected JComponent createControl() { // In this view, we're just going to use standard Swing to place a // few controls. // The location of the text to display has been set as a Resource in the // property descriptionTextPath. So, use that resource to obtain a URL // and set that as the page for the text pane. JTextPane textPane = new JTextPane(); JScrollPane spDescription = getApplicationConfig().componentFactory().createScrollPane(textPane); try { textPane.setPage(getDescriptionTextPath().getURL()); } catch (IOException e) { throw new RuntimeException("Unable to load description URL", e); } JLabel lblMessage = getApplicationConfig().componentFactory().createLabel(getFirstMessage()); lblMessage.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0)); JPanel panel = getApplicationConfig().componentFactory().createPanel(new BorderLayout()); panel.add(spDescription); panel.add(lblMessage, BorderLayout.SOUTH); return panel; }
[ "protected", "JComponent", "createControl", "(", ")", "{", "// In this view, we're just going to use standard Swing to place a", "// few controls.", "// The location of the text to display has been set as a Resource in the", "// property descriptionTextPath. So, use that resource to obtain a URL", "// and set that as the page for the text pane.", "JTextPane", "textPane", "=", "new", "JTextPane", "(", ")", ";", "JScrollPane", "spDescription", "=", "getApplicationConfig", "(", ")", ".", "componentFactory", "(", ")", ".", "createScrollPane", "(", "textPane", ")", ";", "try", "{", "textPane", ".", "setPage", "(", "getDescriptionTextPath", "(", ")", ".", "getURL", "(", ")", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "\"Unable to load description URL\"", ",", "e", ")", ";", "}", "JLabel", "lblMessage", "=", "getApplicationConfig", "(", ")", ".", "componentFactory", "(", ")", ".", "createLabel", "(", "getFirstMessage", "(", ")", ")", ";", "lblMessage", ".", "setBorder", "(", "BorderFactory", ".", "createEmptyBorder", "(", "5", ",", "0", ",", "5", ",", "0", ")", ")", ";", "JPanel", "panel", "=", "getApplicationConfig", "(", ")", ".", "componentFactory", "(", ")", ".", "createPanel", "(", "new", "BorderLayout", "(", ")", ")", ";", "panel", ".", "add", "(", "spDescription", ")", ";", "panel", ".", "add", "(", "lblMessage", ",", "BorderLayout", ".", "SOUTH", ")", ";", "return", "panel", ";", "}" ]
Create the actual UI control for this view. It will be placed into the window according to the layout of the page holding this view.
[ "Create", "the", "actual", "UI", "control", "for", "this", "view", ".", "It", "will", "be", "placed", "into", "the", "window", "according", "to", "the", "layout", "of", "the", "page", "holding", "this", "view", "." ]
train
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-samples/valkyrie-rcp-vldocking-sample/src/main/java/org/valkyriercp/sample/vldocking/ui/InitialView.java#L104-L129
Domo42/saga-lib
saga-lib-guice/src/main/java/com/codebullets/sagalib/guice/SagaLibModule.java
SagaLibModule.bindIfNotNull
private <T> void bindIfNotNull(final Class<T> interfaceType, @Nullable final Class<? extends T> implementationType) { """ Perform binding to interface only if implementation type is not null. """ if (implementationType != null) { bind(interfaceType).to(implementationType); } }
java
private <T> void bindIfNotNull(final Class<T> interfaceType, @Nullable final Class<? extends T> implementationType) { if (implementationType != null) { bind(interfaceType).to(implementationType); } }
[ "private", "<", "T", ">", "void", "bindIfNotNull", "(", "final", "Class", "<", "T", ">", "interfaceType", ",", "@", "Nullable", "final", "Class", "<", "?", "extends", "T", ">", "implementationType", ")", "{", "if", "(", "implementationType", "!=", "null", ")", "{", "bind", "(", "interfaceType", ")", ".", "to", "(", "implementationType", ")", ";", "}", "}" ]
Perform binding to interface only if implementation type is not null.
[ "Perform", "binding", "to", "interface", "only", "if", "implementation", "type", "is", "not", "null", "." ]
train
https://github.com/Domo42/saga-lib/blob/c8f232e2a51fcb6a3fe0082cfbf105c1e6bf90ef/saga-lib-guice/src/main/java/com/codebullets/sagalib/guice/SagaLibModule.java#L155-L159
apache/incubator-druid
processing/src/main/java/org/apache/druid/collections/spatial/search/PolygonBound.java
PolygonBound.from
@JsonCreator public static PolygonBound from( @JsonProperty("abscissa") float[] abscissa, @JsonProperty("ordinate") float[] ordinate, @JsonProperty("limit") int limit ) { """ abscissa and ordinate contain the coordinates of polygon. abscissa[i] is the horizontal coordinate for the i'th corner of the polygon, and ordinate[i] is the vertical coordinate for the i'th corner. The polygon must have more than 2 corners, so the length of abscissa or ordinate must be equal or greater than 3. if the polygon is a rectangular, which corners are {0.0, 0.0}, {0.0, 1.0}, {1.0, 1.0}, {1.0, 0.0}, the abscissa should be {0.0, 0.0, 1.0, 1.0} and ordinate should be {0.0, 1.0, 1.0, 0.0} """ Preconditions.checkArgument(abscissa.length == ordinate.length); //abscissa and ordinate should be the same length Preconditions.checkArgument(abscissa.length > 2); //a polygon should have more than 2 corners return new PolygonBound(abscissa, ordinate, limit); }
java
@JsonCreator public static PolygonBound from( @JsonProperty("abscissa") float[] abscissa, @JsonProperty("ordinate") float[] ordinate, @JsonProperty("limit") int limit ) { Preconditions.checkArgument(abscissa.length == ordinate.length); //abscissa and ordinate should be the same length Preconditions.checkArgument(abscissa.length > 2); //a polygon should have more than 2 corners return new PolygonBound(abscissa, ordinate, limit); }
[ "@", "JsonCreator", "public", "static", "PolygonBound", "from", "(", "@", "JsonProperty", "(", "\"abscissa\"", ")", "float", "[", "]", "abscissa", ",", "@", "JsonProperty", "(", "\"ordinate\"", ")", "float", "[", "]", "ordinate", ",", "@", "JsonProperty", "(", "\"limit\"", ")", "int", "limit", ")", "{", "Preconditions", ".", "checkArgument", "(", "abscissa", ".", "length", "==", "ordinate", ".", "length", ")", ";", "//abscissa and ordinate should be the same length", "Preconditions", ".", "checkArgument", "(", "abscissa", ".", "length", ">", "2", ")", ";", "//a polygon should have more than 2 corners", "return", "new", "PolygonBound", "(", "abscissa", ",", "ordinate", ",", "limit", ")", ";", "}" ]
abscissa and ordinate contain the coordinates of polygon. abscissa[i] is the horizontal coordinate for the i'th corner of the polygon, and ordinate[i] is the vertical coordinate for the i'th corner. The polygon must have more than 2 corners, so the length of abscissa or ordinate must be equal or greater than 3. if the polygon is a rectangular, which corners are {0.0, 0.0}, {0.0, 1.0}, {1.0, 1.0}, {1.0, 0.0}, the abscissa should be {0.0, 0.0, 1.0, 1.0} and ordinate should be {0.0, 1.0, 1.0, 0.0}
[ "abscissa", "and", "ordinate", "contain", "the", "coordinates", "of", "polygon", ".", "abscissa", "[", "i", "]", "is", "the", "horizontal", "coordinate", "for", "the", "i", "th", "corner", "of", "the", "polygon", "and", "ordinate", "[", "i", "]", "is", "the", "vertical", "coordinate", "for", "the", "i", "th", "corner", ".", "The", "polygon", "must", "have", "more", "than", "2", "corners", "so", "the", "length", "of", "abscissa", "or", "ordinate", "must", "be", "equal", "or", "greater", "than", "3", "." ]
train
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/processing/src/main/java/org/apache/druid/collections/spatial/search/PolygonBound.java#L89-L99
amaembo/streamex
src/main/java/one/util/streamex/EntryStream.java
EntryStream.toCustomMap
public <M extends Map<K, V>> M toCustomMap(BinaryOperator<V> mergeFunction, Supplier<M> mapSupplier) { """ Returns a {@link Map} containing the elements of this stream. The {@code Map} is created by a provided supplier function. <p> If the mapped keys contains duplicates (according to {@link Object#equals(Object)}), the value mapping function is applied to each equal element, and the results are merged using the provided merging function. <p> This is a <a href="package-summary.html#StreamOps">terminal</a> operation. @param <M> the type of the resulting map @param mergeFunction a merge function, used to resolve collisions between values associated with the same key. @param mapSupplier a function which returns a new, empty {@code Map} into which the results will be inserted @return a {@code Map} containing the elements of this stream @see Collectors#toMap(Function, Function) @see Collectors#toConcurrentMap(Function, Function) """ Function<Entry<K, V>, K> keyMapper = Entry::getKey; Function<Entry<K, V>, V> valueMapper = Entry::getValue; return collect(Collectors.toMap(keyMapper, valueMapper, mergeFunction, mapSupplier)); }
java
public <M extends Map<K, V>> M toCustomMap(BinaryOperator<V> mergeFunction, Supplier<M> mapSupplier) { Function<Entry<K, V>, K> keyMapper = Entry::getKey; Function<Entry<K, V>, V> valueMapper = Entry::getValue; return collect(Collectors.toMap(keyMapper, valueMapper, mergeFunction, mapSupplier)); }
[ "public", "<", "M", "extends", "Map", "<", "K", ",", "V", ">", ">", "M", "toCustomMap", "(", "BinaryOperator", "<", "V", ">", "mergeFunction", ",", "Supplier", "<", "M", ">", "mapSupplier", ")", "{", "Function", "<", "Entry", "<", "K", ",", "V", ">", ",", "K", ">", "keyMapper", "=", "Entry", "::", "getKey", ";", "Function", "<", "Entry", "<", "K", ",", "V", ">", ",", "V", ">", "valueMapper", "=", "Entry", "::", "getValue", ";", "return", "collect", "(", "Collectors", ".", "toMap", "(", "keyMapper", ",", "valueMapper", ",", "mergeFunction", ",", "mapSupplier", ")", ")", ";", "}" ]
Returns a {@link Map} containing the elements of this stream. The {@code Map} is created by a provided supplier function. <p> If the mapped keys contains duplicates (according to {@link Object#equals(Object)}), the value mapping function is applied to each equal element, and the results are merged using the provided merging function. <p> This is a <a href="package-summary.html#StreamOps">terminal</a> operation. @param <M> the type of the resulting map @param mergeFunction a merge function, used to resolve collisions between values associated with the same key. @param mapSupplier a function which returns a new, empty {@code Map} into which the results will be inserted @return a {@code Map} containing the elements of this stream @see Collectors#toMap(Function, Function) @see Collectors#toConcurrentMap(Function, Function)
[ "Returns", "a", "{", "@link", "Map", "}", "containing", "the", "elements", "of", "this", "stream", ".", "The", "{", "@code", "Map", "}", "is", "created", "by", "a", "provided", "supplier", "function", "." ]
train
https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/EntryStream.java#L1270-L1274
Azure/azure-sdk-for-java
storage/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/storage/v2018_03_01_preview/implementation/StorageAccountsInner.java
StorageAccountsInner.regenerateKey
public StorageAccountListKeysResultInner regenerateKey(String resourceGroupName, String accountName, String keyName) { """ Regenerates one of the access keys for the specified storage account. @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. @param keyName The name of storage keys that want to be regenerated, possible vaules are key1, key2. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the StorageAccountListKeysResultInner object if successful. """ return regenerateKeyWithServiceResponseAsync(resourceGroupName, accountName, keyName).toBlocking().single().body(); }
java
public StorageAccountListKeysResultInner regenerateKey(String resourceGroupName, String accountName, String keyName) { return regenerateKeyWithServiceResponseAsync(resourceGroupName, accountName, keyName).toBlocking().single().body(); }
[ "public", "StorageAccountListKeysResultInner", "regenerateKey", "(", "String", "resourceGroupName", ",", "String", "accountName", ",", "String", "keyName", ")", "{", "return", "regenerateKeyWithServiceResponseAsync", "(", "resourceGroupName", ",", "accountName", ",", "keyName", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Regenerates one of the access keys for the specified storage account. @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. @param keyName The name of storage keys that want to be regenerated, possible vaules are key1, key2. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the StorageAccountListKeysResultInner object if successful.
[ "Regenerates", "one", "of", "the", "access", "keys", "for", "the", "specified", "storage", "account", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/storage/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/storage/v2018_03_01_preview/implementation/StorageAccountsInner.java#L920-L922
drinkjava2/jBeanBox
jbeanbox/src/main/java/com/github/drinkjava2/asm5_0_3/util/CheckClassAdapter.java
CheckClassAdapter.checkTypeArguments
private static int checkTypeArguments(final String signature, int pos) { """ Checks the type arguments in a class type signature. @param signature a string containing the signature that must be checked. @param pos index of first character to be checked. @return the index of the first character after the checked part. """ // TypeArguments: // < TypeArgument+ > pos = checkChar('<', signature, pos); pos = checkTypeArgument(signature, pos); while (getChar(signature, pos) != '>') { pos = checkTypeArgument(signature, pos); } return pos + 1; }
java
private static int checkTypeArguments(final String signature, int pos) { // TypeArguments: // < TypeArgument+ > pos = checkChar('<', signature, pos); pos = checkTypeArgument(signature, pos); while (getChar(signature, pos) != '>') { pos = checkTypeArgument(signature, pos); } return pos + 1; }
[ "private", "static", "int", "checkTypeArguments", "(", "final", "String", "signature", ",", "int", "pos", ")", "{", "// TypeArguments:", "// < TypeArgument+ >", "pos", "=", "checkChar", "(", "'", "'", ",", "signature", ",", "pos", ")", ";", "pos", "=", "checkTypeArgument", "(", "signature", ",", "pos", ")", ";", "while", "(", "getChar", "(", "signature", ",", "pos", ")", "!=", "'", "'", ")", "{", "pos", "=", "checkTypeArgument", "(", "signature", ",", "pos", ")", ";", "}", "return", "pos", "+", "1", ";", "}" ]
Checks the type arguments in a class type signature. @param signature a string containing the signature that must be checked. @param pos index of first character to be checked. @return the index of the first character after the checked part.
[ "Checks", "the", "type", "arguments", "in", "a", "class", "type", "signature", "." ]
train
https://github.com/drinkjava2/jBeanBox/blob/01c216599ffa2e5f2d9c01df2adaad0f45567c04/jbeanbox/src/main/java/com/github/drinkjava2/asm5_0_3/util/CheckClassAdapter.java#L877-L887
jpush/jmessage-api-java-client
src/main/java/cn/jmessage/api/user/UserClient.java
UserClient.setGroupShield
public ResponseWrapper setGroupShield(GroupShieldPayload payload, String username) throws APIConnectionException, APIRequestException { """ Set user's group message blocking @param payload GroupShieldPayload @param username Necessary @return No content @throws APIConnectionException connect exception @throws APIRequestException request exception """ Preconditions.checkArgument(null != payload, "GroupShieldPayload should not be null"); StringUtils.checkUsername(username); return _httpClient.sendPost(_baseUrl + userPath + "/" + username + "/groupsShield", payload.toString()); }
java
public ResponseWrapper setGroupShield(GroupShieldPayload payload, String username) throws APIConnectionException, APIRequestException { Preconditions.checkArgument(null != payload, "GroupShieldPayload should not be null"); StringUtils.checkUsername(username); return _httpClient.sendPost(_baseUrl + userPath + "/" + username + "/groupsShield", payload.toString()); }
[ "public", "ResponseWrapper", "setGroupShield", "(", "GroupShieldPayload", "payload", ",", "String", "username", ")", "throws", "APIConnectionException", ",", "APIRequestException", "{", "Preconditions", ".", "checkArgument", "(", "null", "!=", "payload", ",", "\"GroupShieldPayload should not be null\"", ")", ";", "StringUtils", ".", "checkUsername", "(", "username", ")", ";", "return", "_httpClient", ".", "sendPost", "(", "_baseUrl", "+", "userPath", "+", "\"/\"", "+", "username", "+", "\"/groupsShield\"", ",", "payload", ".", "toString", "(", ")", ")", ";", "}" ]
Set user's group message blocking @param payload GroupShieldPayload @param username Necessary @return No content @throws APIConnectionException connect exception @throws APIRequestException request exception
[ "Set", "user", "s", "group", "message", "blocking" ]
train
https://github.com/jpush/jmessage-api-java-client/blob/767f5fb15e9fe5a546c00f6e68b64f6dd53c617c/src/main/java/cn/jmessage/api/user/UserClient.java#L360-L365
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/event/NewOnChangeHandler.java
NewOnChangeHandler.fieldChanged
public int fieldChanged(boolean bDisplayOption, int iMoveMode) { """ The Field has Changed. Do an addNew() on the target record. @param bDisplayOption If true, display the change. @param iMoveMode The type of move being done (init/read/screen). @return The error code (or NORMAL_RETURN if okay). Field Changed, do an addNew on this record. """ try { m_recTarget.addNew(); } catch (DBException e) { return e.getErrorCode(); } return DBConstants.NORMAL_RETURN; }
java
public int fieldChanged(boolean bDisplayOption, int iMoveMode) { try { m_recTarget.addNew(); } catch (DBException e) { return e.getErrorCode(); } return DBConstants.NORMAL_RETURN; }
[ "public", "int", "fieldChanged", "(", "boolean", "bDisplayOption", ",", "int", "iMoveMode", ")", "{", "try", "{", "m_recTarget", ".", "addNew", "(", ")", ";", "}", "catch", "(", "DBException", "e", ")", "{", "return", "e", ".", "getErrorCode", "(", ")", ";", "}", "return", "DBConstants", ".", "NORMAL_RETURN", ";", "}" ]
The Field has Changed. Do an addNew() on the target record. @param bDisplayOption If true, display the change. @param iMoveMode The type of move being done (init/read/screen). @return The error code (or NORMAL_RETURN if okay). Field Changed, do an addNew on this record.
[ "The", "Field", "has", "Changed", ".", "Do", "an", "addNew", "()", "on", "the", "target", "record", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/event/NewOnChangeHandler.java#L75-L83
glyptodon/guacamole-client
guacamole/src/main/java/org/apache/guacamole/rest/patch/PatchRESTService.java
PatchRESTService.getPatches
@GET public List<String> getPatches() throws GuacamoleException { """ Returns a list of all available HTML patches, in the order they should be applied. Each patch is raw HTML containing additional meta tags describing how and where the patch should be applied. @return A list of all HTML patches defined in the system, in the order they should be applied. @throws GuacamoleException If an error occurs preventing any HTML patch from being read. """ try { // Allocate a list of equal size to the total number of patches List<Resource> resources = patchResourceService.getPatchResources(); List<String> patches = new ArrayList<String>(resources.size()); // Convert each patch resource to a string for (Resource resource : resources) { patches.add(readResourceAsString(resource)); } // Return all patches in string form return patches; } // Bail out entirely on error catch (IOException e) { throw new GuacamoleServerException("Unable to read HTML patches.", e); } }
java
@GET public List<String> getPatches() throws GuacamoleException { try { // Allocate a list of equal size to the total number of patches List<Resource> resources = patchResourceService.getPatchResources(); List<String> patches = new ArrayList<String>(resources.size()); // Convert each patch resource to a string for (Resource resource : resources) { patches.add(readResourceAsString(resource)); } // Return all patches in string form return patches; } // Bail out entirely on error catch (IOException e) { throw new GuacamoleServerException("Unable to read HTML patches.", e); } }
[ "@", "GET", "public", "List", "<", "String", ">", "getPatches", "(", ")", "throws", "GuacamoleException", "{", "try", "{", "// Allocate a list of equal size to the total number of patches", "List", "<", "Resource", ">", "resources", "=", "patchResourceService", ".", "getPatchResources", "(", ")", ";", "List", "<", "String", ">", "patches", "=", "new", "ArrayList", "<", "String", ">", "(", "resources", ".", "size", "(", ")", ")", ";", "// Convert each patch resource to a string", "for", "(", "Resource", "resource", ":", "resources", ")", "{", "patches", ".", "add", "(", "readResourceAsString", "(", "resource", ")", ")", ";", "}", "// Return all patches in string form", "return", "patches", ";", "}", "// Bail out entirely on error", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "GuacamoleServerException", "(", "\"Unable to read HTML patches.\"", ",", "e", ")", ";", "}", "}" ]
Returns a list of all available HTML patches, in the order they should be applied. Each patch is raw HTML containing additional meta tags describing how and where the patch should be applied. @return A list of all HTML patches defined in the system, in the order they should be applied. @throws GuacamoleException If an error occurs preventing any HTML patch from being read.
[ "Returns", "a", "list", "of", "all", "available", "HTML", "patches", "in", "the", "order", "they", "should", "be", "applied", ".", "Each", "patch", "is", "raw", "HTML", "containing", "additional", "meta", "tags", "describing", "how", "and", "where", "the", "patch", "should", "be", "applied", "." ]
train
https://github.com/glyptodon/guacamole-client/blob/ea1b10e9d1e3f1fa640dff2ca64d61b44bf1ace9/guacamole/src/main/java/org/apache/guacamole/rest/patch/PatchRESTService.java#L102-L126
Azure/azure-sdk-for-java
sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/GeoBackupPoliciesInner.java
GeoBackupPoliciesInner.getAsync
public Observable<GeoBackupPolicyInner> getAsync(String resourceGroupName, String serverName, String databaseName) { """ Gets a geo backup policy. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param databaseName The name of the database. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the GeoBackupPolicyInner object """ return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1<ServiceResponse<GeoBackupPolicyInner>, GeoBackupPolicyInner>() { @Override public GeoBackupPolicyInner call(ServiceResponse<GeoBackupPolicyInner> response) { return response.body(); } }); }
java
public Observable<GeoBackupPolicyInner> getAsync(String resourceGroupName, String serverName, String databaseName) { return getWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1<ServiceResponse<GeoBackupPolicyInner>, GeoBackupPolicyInner>() { @Override public GeoBackupPolicyInner call(ServiceResponse<GeoBackupPolicyInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "GeoBackupPolicyInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "databaseName", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",", "serverName", ",", "databaseName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "GeoBackupPolicyInner", ">", ",", "GeoBackupPolicyInner", ">", "(", ")", "{", "@", "Override", "public", "GeoBackupPolicyInner", "call", "(", "ServiceResponse", "<", "GeoBackupPolicyInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Gets a geo backup policy. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param databaseName The name of the database. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the GeoBackupPolicyInner object
[ "Gets", "a", "geo", "backup", "policy", "." ]
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/GeoBackupPoliciesInner.java#L214-L221
sgroschupf/zkclient
src/main/java/org/I0Itec/zkclient/serialize/TcclAwareObjectIputStream.java
TcclAwareObjectIputStream.resolveProxyClass
protected Class resolveProxyClass(String[] interfaces) throws IOException, ClassNotFoundException { """ Returns a proxy class that implements the interfaces named in a proxy class descriptor; subclasses may implement this method to read custom data from the stream along with the descriptors for dynamic proxy classes, allowing them to use an alternate loading mechanism for the interfaces and the proxy class. For each interface uses the current class {@link ClassLoader} and falls back to the {@link Thread} context {@link ClassLoader}. """ ClassLoader cl = getClass().getClassLoader(); Class[] cinterfaces = new Class[interfaces.length]; for (int i = 0; i < interfaces.length; i++) { try { cinterfaces[i] = cl.loadClass(interfaces[i]); } catch (ClassNotFoundException ex) { ClassLoader tccl = Thread.currentThread().getContextClassLoader(); if (tccl != null) { return tccl.loadClass(interfaces[i]); } else { throw ex; } } } try { return Proxy.getProxyClass(cinterfaces[0].getClassLoader(), cinterfaces); } catch (IllegalArgumentException e) { throw new ClassNotFoundException(null, e); } }
java
protected Class resolveProxyClass(String[] interfaces) throws IOException, ClassNotFoundException { ClassLoader cl = getClass().getClassLoader(); Class[] cinterfaces = new Class[interfaces.length]; for (int i = 0; i < interfaces.length; i++) { try { cinterfaces[i] = cl.loadClass(interfaces[i]); } catch (ClassNotFoundException ex) { ClassLoader tccl = Thread.currentThread().getContextClassLoader(); if (tccl != null) { return tccl.loadClass(interfaces[i]); } else { throw ex; } } } try { return Proxy.getProxyClass(cinterfaces[0].getClassLoader(), cinterfaces); } catch (IllegalArgumentException e) { throw new ClassNotFoundException(null, e); } }
[ "protected", "Class", "resolveProxyClass", "(", "String", "[", "]", "interfaces", ")", "throws", "IOException", ",", "ClassNotFoundException", "{", "ClassLoader", "cl", "=", "getClass", "(", ")", ".", "getClassLoader", "(", ")", ";", "Class", "[", "]", "cinterfaces", "=", "new", "Class", "[", "interfaces", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "interfaces", ".", "length", ";", "i", "++", ")", "{", "try", "{", "cinterfaces", "[", "i", "]", "=", "cl", ".", "loadClass", "(", "interfaces", "[", "i", "]", ")", ";", "}", "catch", "(", "ClassNotFoundException", "ex", ")", "{", "ClassLoader", "tccl", "=", "Thread", ".", "currentThread", "(", ")", ".", "getContextClassLoader", "(", ")", ";", "if", "(", "tccl", "!=", "null", ")", "{", "return", "tccl", ".", "loadClass", "(", "interfaces", "[", "i", "]", ")", ";", "}", "else", "{", "throw", "ex", ";", "}", "}", "}", "try", "{", "return", "Proxy", ".", "getProxyClass", "(", "cinterfaces", "[", "0", "]", ".", "getClassLoader", "(", ")", ",", "cinterfaces", ")", ";", "}", "catch", "(", "IllegalArgumentException", "e", ")", "{", "throw", "new", "ClassNotFoundException", "(", "null", ",", "e", ")", ";", "}", "}" ]
Returns a proxy class that implements the interfaces named in a proxy class descriptor; subclasses may implement this method to read custom data from the stream along with the descriptors for dynamic proxy classes, allowing them to use an alternate loading mechanism for the interfaces and the proxy class. For each interface uses the current class {@link ClassLoader} and falls back to the {@link Thread} context {@link ClassLoader}.
[ "Returns", "a", "proxy", "class", "that", "implements", "the", "interfaces", "named", "in", "a", "proxy", "class", "descriptor", ";", "subclasses", "may", "implement", "this", "method", "to", "read", "custom", "data", "from", "the", "stream", "along", "with", "the", "descriptors", "for", "dynamic", "proxy", "classes", "allowing", "them", "to", "use", "an", "alternate", "loading", "mechanism", "for", "the", "interfaces", "and", "the", "proxy", "class", "." ]
train
https://github.com/sgroschupf/zkclient/blob/03ccf12c70aca2f771bfcd94d44dc7c4d4a1495e/src/main/java/org/I0Itec/zkclient/serialize/TcclAwareObjectIputStream.java#L60-L81
strator-dev/greenpepper
greenpepper-open/greenpepper-maven-runner/src/main/java/com/greenpepper/maven/runner/util/ReflectionUtils.java
ReflectionUtils.setSystemOutputs
public static void setSystemOutputs(ClassLoader classLoader, PrintStream out, PrintStream err) throws Exception { """ <p>setSystemOutputs.</p> @param classLoader a {@link java.lang.ClassLoader} object. @param out a {@link java.io.PrintStream} object. @param err a {@link java.io.PrintStream} object. @throws java.lang.Exception if any. """ Class<?> systemClass = classLoader.loadClass("java.lang.System"); Method setSystemOutMethod = systemClass.getMethod("setOut", PrintStream.class); setSystemOutMethod.invoke(null, out); Method setSystemErrMethod = systemClass.getMethod("setErr", PrintStream.class); setSystemErrMethod.invoke(null, err); }
java
public static void setSystemOutputs(ClassLoader classLoader, PrintStream out, PrintStream err) throws Exception { Class<?> systemClass = classLoader.loadClass("java.lang.System"); Method setSystemOutMethod = systemClass.getMethod("setOut", PrintStream.class); setSystemOutMethod.invoke(null, out); Method setSystemErrMethod = systemClass.getMethod("setErr", PrintStream.class); setSystemErrMethod.invoke(null, err); }
[ "public", "static", "void", "setSystemOutputs", "(", "ClassLoader", "classLoader", ",", "PrintStream", "out", ",", "PrintStream", "err", ")", "throws", "Exception", "{", "Class", "<", "?", ">", "systemClass", "=", "classLoader", ".", "loadClass", "(", "\"java.lang.System\"", ")", ";", "Method", "setSystemOutMethod", "=", "systemClass", ".", "getMethod", "(", "\"setOut\"", ",", "PrintStream", ".", "class", ")", ";", "setSystemOutMethod", ".", "invoke", "(", "null", ",", "out", ")", ";", "Method", "setSystemErrMethod", "=", "systemClass", ".", "getMethod", "(", "\"setErr\"", ",", "PrintStream", ".", "class", ")", ";", "setSystemErrMethod", ".", "invoke", "(", "null", ",", "err", ")", ";", "}" ]
<p>setSystemOutputs.</p> @param classLoader a {@link java.lang.ClassLoader} object. @param out a {@link java.io.PrintStream} object. @param err a {@link java.io.PrintStream} object. @throws java.lang.Exception if any.
[ "<p", ">", "setSystemOutputs", ".", "<", "/", "p", ">" ]
train
https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper-open/greenpepper-maven-runner/src/main/java/com/greenpepper/maven/runner/util/ReflectionUtils.java#L89-L97
jdereg/java-util
src/main/java/com/cedarsoftware/util/DeepEquals.java
DeepEquals.compareArrays
private static boolean compareArrays(Object array1, Object array2, Deque stack, Set visited) { """ Deeply compare to Arrays []. Both arrays must be of the same type, same length, and all elements within the arrays must be deeply equal in order to return true. @param array1 [] type (Object[], String[], etc.) @param array2 [] type (Object[], String[], etc.) @param stack add items to compare to the Stack (Stack versus recursion) @param visited Set of objects already compared (prevents cycles) @return true if the two arrays are the same length and contain deeply equivalent items. """ // Same instance check already performed... int len = Array.getLength(array1); if (len != Array.getLength(array2)) { return false; } for (int i = 0; i < len; i++) { DualKey dk = new DualKey(Array.get(array1, i), Array.get(array2, i)); if (!visited.contains(dk)) { // push contents for further comparison stack.addFirst(dk); } } return true; }
java
private static boolean compareArrays(Object array1, Object array2, Deque stack, Set visited) { // Same instance check already performed... int len = Array.getLength(array1); if (len != Array.getLength(array2)) { return false; } for (int i = 0; i < len; i++) { DualKey dk = new DualKey(Array.get(array1, i), Array.get(array2, i)); if (!visited.contains(dk)) { // push contents for further comparison stack.addFirst(dk); } } return true; }
[ "private", "static", "boolean", "compareArrays", "(", "Object", "array1", ",", "Object", "array2", ",", "Deque", "stack", ",", "Set", "visited", ")", "{", "// Same instance check already performed...", "int", "len", "=", "Array", ".", "getLength", "(", "array1", ")", ";", "if", "(", "len", "!=", "Array", ".", "getLength", "(", "array2", ")", ")", "{", "return", "false", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "len", ";", "i", "++", ")", "{", "DualKey", "dk", "=", "new", "DualKey", "(", "Array", ".", "get", "(", "array1", ",", "i", ")", ",", "Array", ".", "get", "(", "array2", ",", "i", ")", ")", ";", "if", "(", "!", "visited", ".", "contains", "(", "dk", ")", ")", "{", "// push contents for further comparison", "stack", ".", "addFirst", "(", "dk", ")", ";", "}", "}", "return", "true", ";", "}" ]
Deeply compare to Arrays []. Both arrays must be of the same type, same length, and all elements within the arrays must be deeply equal in order to return true. @param array1 [] type (Object[], String[], etc.) @param array2 [] type (Object[], String[], etc.) @param stack add items to compare to the Stack (Stack versus recursion) @param visited Set of objects already compared (prevents cycles) @return true if the two arrays are the same length and contain deeply equivalent items.
[ "Deeply", "compare", "to", "Arrays", "[]", ".", "Both", "arrays", "must", "be", "of", "the", "same", "type", "same", "length", "and", "all", "elements", "within", "the", "arrays", "must", "be", "deeply", "equal", "in", "order", "to", "return", "true", "." ]
train
https://github.com/jdereg/java-util/blob/a2dce61aed16d6454ee575174dda1ba6bff0015c/src/main/java/com/cedarsoftware/util/DeepEquals.java#L381-L400
xwiki/xwiki-commons
xwiki-commons-core/xwiki-commons-extension/xwiki-commons-extension-api/src/main/java/org/xwiki/extension/internal/ExtensionUtils.java
ExtensionUtils.importProperty
public static <T> T importProperty(MutableExtension extension, String propertySuffix) { """ Delete and return the value of the passed special property. @param <T> type of the property value @param extension the extension from which to extract custom property @param propertySuffix the property suffix @return the value @ @since 8.3M1 """ return extension.removeProperty(Extension.IKEYPREFIX + propertySuffix); }
java
public static <T> T importProperty(MutableExtension extension, String propertySuffix) { return extension.removeProperty(Extension.IKEYPREFIX + propertySuffix); }
[ "public", "static", "<", "T", ">", "T", "importProperty", "(", "MutableExtension", "extension", ",", "String", "propertySuffix", ")", "{", "return", "extension", ".", "removeProperty", "(", "Extension", ".", "IKEYPREFIX", "+", "propertySuffix", ")", ";", "}" ]
Delete and return the value of the passed special property. @param <T> type of the property value @param extension the extension from which to extract custom property @param propertySuffix the property suffix @return the value @ @since 8.3M1
[ "Delete", "and", "return", "the", "value", "of", "the", "passed", "special", "property", "." ]
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/internal/ExtensionUtils.java#L162-L165
Azure/azure-sdk-for-java
edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/UsersInner.java
UsersInner.beginCreateOrUpdateAsync
public Observable<UserInner> beginCreateOrUpdateAsync(String deviceName, String name, String resourceGroupName, UserInner user) { """ Creates a new user or updates an existing user's information on a data box edge/gateway device. @param deviceName The device name. @param name The user name. @param resourceGroupName The resource group name. @param user The user details. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the UserInner object """ return beginCreateOrUpdateWithServiceResponseAsync(deviceName, name, resourceGroupName, user).map(new Func1<ServiceResponse<UserInner>, UserInner>() { @Override public UserInner call(ServiceResponse<UserInner> response) { return response.body(); } }); }
java
public Observable<UserInner> beginCreateOrUpdateAsync(String deviceName, String name, String resourceGroupName, UserInner user) { return beginCreateOrUpdateWithServiceResponseAsync(deviceName, name, resourceGroupName, user).map(new Func1<ServiceResponse<UserInner>, UserInner>() { @Override public UserInner call(ServiceResponse<UserInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "UserInner", ">", "beginCreateOrUpdateAsync", "(", "String", "deviceName", ",", "String", "name", ",", "String", "resourceGroupName", ",", "UserInner", "user", ")", "{", "return", "beginCreateOrUpdateWithServiceResponseAsync", "(", "deviceName", ",", "name", ",", "resourceGroupName", ",", "user", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "UserInner", ">", ",", "UserInner", ">", "(", ")", "{", "@", "Override", "public", "UserInner", "call", "(", "ServiceResponse", "<", "UserInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Creates a new user or updates an existing user's information on a data box edge/gateway device. @param deviceName The device name. @param name The user name. @param resourceGroupName The resource group name. @param user The user details. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the UserInner object
[ "Creates", "a", "new", "user", "or", "updates", "an", "existing", "user", "s", "information", "on", "a", "data", "box", "edge", "/", "gateway", "device", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/UsersInner.java#L435-L442
amaembo/streamex
src/main/java/one/util/streamex/AbstractStreamEx.java
AbstractStreamEx.foldLeft
public <U> U foldLeft(U seed, BiFunction<U, ? super T, U> accumulator) { """ Folds the elements of this stream using the provided seed object and accumulation function, going left to right. This is equivalent to: <pre> {@code U result = seed; for (T element : this stream) result = accumulator.apply(result, element) return result; } </pre> <p> This is a terminal operation. <p> This method cannot take all the advantages of parallel streams as it must process elements strictly left to right. If your accumulator function is associative and you can provide a combiner function, consider using {@link #reduce(Object, BiFunction, BinaryOperator)} method. <p> For parallel stream it's not guaranteed that accumulator will always be executed in the same thread. @param <U> The type of the result @param seed the starting value @param accumulator a <a href="package-summary.html#NonInterference">non-interfering </a>, <a href="package-summary.html#Statelessness">stateless</a> function for incorporating an additional element into a result @return the result of the folding @see #foldRight(Object, BiFunction) @see #reduce(Object, BinaryOperator) @see #reduce(Object, BiFunction, BinaryOperator) @since 0.2.0 """ Box<U> result = new Box<>(seed); forEachOrdered(t -> result.a = accumulator.apply(result.a, t)); return result.a; }
java
public <U> U foldLeft(U seed, BiFunction<U, ? super T, U> accumulator) { Box<U> result = new Box<>(seed); forEachOrdered(t -> result.a = accumulator.apply(result.a, t)); return result.a; }
[ "public", "<", "U", ">", "U", "foldLeft", "(", "U", "seed", ",", "BiFunction", "<", "U", ",", "?", "super", "T", ",", "U", ">", "accumulator", ")", "{", "Box", "<", "U", ">", "result", "=", "new", "Box", "<>", "(", "seed", ")", ";", "forEachOrdered", "(", "t", "->", "result", ".", "a", "=", "accumulator", ".", "apply", "(", "result", ".", "a", ",", "t", ")", ")", ";", "return", "result", ".", "a", ";", "}" ]
Folds the elements of this stream using the provided seed object and accumulation function, going left to right. This is equivalent to: <pre> {@code U result = seed; for (T element : this stream) result = accumulator.apply(result, element) return result; } </pre> <p> This is a terminal operation. <p> This method cannot take all the advantages of parallel streams as it must process elements strictly left to right. If your accumulator function is associative and you can provide a combiner function, consider using {@link #reduce(Object, BiFunction, BinaryOperator)} method. <p> For parallel stream it's not guaranteed that accumulator will always be executed in the same thread. @param <U> The type of the result @param seed the starting value @param accumulator a <a href="package-summary.html#NonInterference">non-interfering </a>, <a href="package-summary.html#Statelessness">stateless</a> function for incorporating an additional element into a result @return the result of the folding @see #foldRight(Object, BiFunction) @see #reduce(Object, BinaryOperator) @see #reduce(Object, BiFunction, BinaryOperator) @since 0.2.0
[ "Folds", "the", "elements", "of", "this", "stream", "using", "the", "provided", "seed", "object", "and", "accumulation", "function", "going", "left", "to", "right", ".", "This", "is", "equivalent", "to", ":" ]
train
https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/AbstractStreamEx.java#L1352-L1356
aws/aws-sdk-java
aws-java-sdk-cognitoidentity/src/main/java/com/amazonaws/services/cognitoidentity/model/UpdateIdentityPoolResult.java
UpdateIdentityPoolResult.withIdentityPoolTags
public UpdateIdentityPoolResult withIdentityPoolTags(java.util.Map<String, String> identityPoolTags) { """ <p> The tags that are assigned to the identity pool. A tag is a label that you can apply to identity pools to categorize and manage them in different ways, such as by purpose, owner, environment, or other criteria. </p> @param identityPoolTags The tags that are assigned to the identity pool. A tag is a label that you can apply to identity pools to categorize and manage them in different ways, such as by purpose, owner, environment, or other criteria. @return Returns a reference to this object so that method calls can be chained together. """ setIdentityPoolTags(identityPoolTags); return this; }
java
public UpdateIdentityPoolResult withIdentityPoolTags(java.util.Map<String, String> identityPoolTags) { setIdentityPoolTags(identityPoolTags); return this; }
[ "public", "UpdateIdentityPoolResult", "withIdentityPoolTags", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "identityPoolTags", ")", "{", "setIdentityPoolTags", "(", "identityPoolTags", ")", ";", "return", "this", ";", "}" ]
<p> The tags that are assigned to the identity pool. A tag is a label that you can apply to identity pools to categorize and manage them in different ways, such as by purpose, owner, environment, or other criteria. </p> @param identityPoolTags The tags that are assigned to the identity pool. A tag is a label that you can apply to identity pools to categorize and manage them in different ways, such as by purpose, owner, environment, or other criteria. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "The", "tags", "that", "are", "assigned", "to", "the", "identity", "pool", ".", "A", "tag", "is", "a", "label", "that", "you", "can", "apply", "to", "identity", "pools", "to", "categorize", "and", "manage", "them", "in", "different", "ways", "such", "as", "by", "purpose", "owner", "environment", "or", "other", "criteria", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-cognitoidentity/src/main/java/com/amazonaws/services/cognitoidentity/model/UpdateIdentityPoolResult.java#L569-L572
revelc/formatter-maven-plugin
src/main/java/net/revelc/code/formatter/FormatterMojo.java
FormatterMojo.formatFile
private void formatFile(File file, ResultCollector rc, Properties hashCache, String basedirPath) throws MojoFailureException, MojoExecutionException { """ Format file. @param file the file @param rc the rc @param hashCache the hash cache @param basedirPath the basedir path """ try { doFormatFile(file, rc, hashCache, basedirPath, false); } catch (IOException | MalformedTreeException | BadLocationException e) { rc.failCount++; getLog().warn(e); } }
java
private void formatFile(File file, ResultCollector rc, Properties hashCache, String basedirPath) throws MojoFailureException, MojoExecutionException { try { doFormatFile(file, rc, hashCache, basedirPath, false); } catch (IOException | MalformedTreeException | BadLocationException e) { rc.failCount++; getLog().warn(e); } }
[ "private", "void", "formatFile", "(", "File", "file", ",", "ResultCollector", "rc", ",", "Properties", "hashCache", ",", "String", "basedirPath", ")", "throws", "MojoFailureException", ",", "MojoExecutionException", "{", "try", "{", "doFormatFile", "(", "file", ",", "rc", ",", "hashCache", ",", "basedirPath", ",", "false", ")", ";", "}", "catch", "(", "IOException", "|", "MalformedTreeException", "|", "BadLocationException", "e", ")", "{", "rc", ".", "failCount", "++", ";", "getLog", "(", ")", ".", "warn", "(", "e", ")", ";", "}", "}" ]
Format file. @param file the file @param rc the rc @param hashCache the hash cache @param basedirPath the basedir path
[ "Format", "file", "." ]
train
https://github.com/revelc/formatter-maven-plugin/blob/a237073ce6220e73ad6b1faef412fe0660485cf4/src/main/java/net/revelc/code/formatter/FormatterMojo.java#L461-L469
graknlabs/grakn
server/src/graql/reasoner/atom/binary/RelationAtom.java
RelationAtom.relationPattern
private Statement relationPattern(Variable varName, Collection<RelationProperty.RolePlayer> relationPlayers) { """ construct a $varName (rolemap) isa $typeVariable relation @param varName variable name @param relationPlayers collection of rolePlayer-roleType mappings @return corresponding {@link Statement} """ Statement var = new Statement(varName); for (RelationProperty.RolePlayer rp : relationPlayers) { Statement rolePattern = rp.getRole().orElse(null); var = rolePattern != null? var.rel(rolePattern, rp.getPlayer()) : var.rel(rp.getPlayer()); } return var; }
java
private Statement relationPattern(Variable varName, Collection<RelationProperty.RolePlayer> relationPlayers) { Statement var = new Statement(varName); for (RelationProperty.RolePlayer rp : relationPlayers) { Statement rolePattern = rp.getRole().orElse(null); var = rolePattern != null? var.rel(rolePattern, rp.getPlayer()) : var.rel(rp.getPlayer()); } return var; }
[ "private", "Statement", "relationPattern", "(", "Variable", "varName", ",", "Collection", "<", "RelationProperty", ".", "RolePlayer", ">", "relationPlayers", ")", "{", "Statement", "var", "=", "new", "Statement", "(", "varName", ")", ";", "for", "(", "RelationProperty", ".", "RolePlayer", "rp", ":", "relationPlayers", ")", "{", "Statement", "rolePattern", "=", "rp", ".", "getRole", "(", ")", ".", "orElse", "(", "null", ")", ";", "var", "=", "rolePattern", "!=", "null", "?", "var", ".", "rel", "(", "rolePattern", ",", "rp", ".", "getPlayer", "(", ")", ")", ":", "var", ".", "rel", "(", "rp", ".", "getPlayer", "(", ")", ")", ";", "}", "return", "var", ";", "}" ]
construct a $varName (rolemap) isa $typeVariable relation @param varName variable name @param relationPlayers collection of rolePlayer-roleType mappings @return corresponding {@link Statement}
[ "construct", "a", "$varName", "(", "rolemap", ")", "isa", "$typeVariable", "relation" ]
train
https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/graql/reasoner/atom/binary/RelationAtom.java#L276-L283
denisneuling/apitrary.jar
apitrary-api-client/src/main/java/com/apitrary/api/client/util/ClassUtil.java
ClassUtil.getValueOfField
public static Object getValueOfField(Field field, Object ref) { """ <p> getValueOfField. </p> @param field a {@link java.lang.reflect.Field} object. @param ref a {@link java.lang.Object} object. @return a {@link java.lang.Object} object. """ field.setAccessible(true); Object value = null; try { value = field.get(ref); } catch (IllegalArgumentException e) { log.warning(e.getClass().getSimpleName() + ": " + e.getMessage()); } catch (IllegalAccessException e) { log.warning(e.getClass().getSimpleName() + ": " + e.getMessage()); } return value; }
java
public static Object getValueOfField(Field field, Object ref) { field.setAccessible(true); Object value = null; try { value = field.get(ref); } catch (IllegalArgumentException e) { log.warning(e.getClass().getSimpleName() + ": " + e.getMessage()); } catch (IllegalAccessException e) { log.warning(e.getClass().getSimpleName() + ": " + e.getMessage()); } return value; }
[ "public", "static", "Object", "getValueOfField", "(", "Field", "field", ",", "Object", "ref", ")", "{", "field", ".", "setAccessible", "(", "true", ")", ";", "Object", "value", "=", "null", ";", "try", "{", "value", "=", "field", ".", "get", "(", "ref", ")", ";", "}", "catch", "(", "IllegalArgumentException", "e", ")", "{", "log", ".", "warning", "(", "e", ".", "getClass", "(", ")", ".", "getSimpleName", "(", ")", "+", "\": \"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "catch", "(", "IllegalAccessException", "e", ")", "{", "log", ".", "warning", "(", "e", ".", "getClass", "(", ")", ".", "getSimpleName", "(", ")", "+", "\": \"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "return", "value", ";", "}" ]
<p> getValueOfField. </p> @param field a {@link java.lang.reflect.Field} object. @param ref a {@link java.lang.Object} object. @return a {@link java.lang.Object} object.
[ "<p", ">", "getValueOfField", ".", "<", "/", "p", ">" ]
train
https://github.com/denisneuling/apitrary.jar/blob/b7f639a1e735c60ba2b1b62851926757f5de8628/apitrary-api-client/src/main/java/com/apitrary/api/client/util/ClassUtil.java#L240-L251
d-sauer/JCalcAPI
src/main/java/org/jdice/calc/internal/InfixParser.java
InfixParser.countOccurrences
private int countOccurrences(String haystack, char needle) { """ Count how many time needle appears in haystack @param haystack @param needle @return """ int count = 0; for (int i = 0; i < haystack.length(); i++) { if (haystack.charAt(i) == needle) count++; } return count; }
java
private int countOccurrences(String haystack, char needle) { int count = 0; for (int i = 0; i < haystack.length(); i++) { if (haystack.charAt(i) == needle) count++; } return count; }
[ "private", "int", "countOccurrences", "(", "String", "haystack", ",", "char", "needle", ")", "{", "int", "count", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "haystack", ".", "length", "(", ")", ";", "i", "++", ")", "{", "if", "(", "haystack", ".", "charAt", "(", "i", ")", "==", "needle", ")", "count", "++", ";", "}", "return", "count", ";", "}" ]
Count how many time needle appears in haystack @param haystack @param needle @return
[ "Count", "how", "many", "time", "needle", "appears", "in", "haystack" ]
train
https://github.com/d-sauer/JCalcAPI/blob/36ae1f9adfe611a6f1bd8ef87cf1dc0ec88ac035/src/main/java/org/jdice/calc/internal/InfixParser.java#L461-L468
intuit/QuickBooks-V3-Java-SDK
ipp-v3-java-devkit/src/main/java/com/intuit/ipp/interceptors/PrepareRequestInterceptor.java
PrepareRequestInterceptor.getUri
private <T extends IEntity> String getUri(Boolean platformService, String action, Context context, Map<String, String> requestParameters, Boolean entitlementService) throws FMSException { """ Method to construct the URI @param action the entity name @param context the context @param requestParameters the request params @return returns URI """ String uri = null; if (!platformService) { ServiceType serviceType = context.getIntuitServiceType(); if (entitlementService) { uri = prepareEntitlementUri(context); } else if (ServiceType.QBO == serviceType) { uri = prepareQBOUri(action, context, requestParameters); } else if (ServiceType.QBOPremier == serviceType) { uri = prepareQBOPremierUri(action, context, requestParameters); } else { throw new FMSException("SDK doesn't support for the service type : " + serviceType); } } else { uri = prepareIPSUri(action, context); } return uri; }
java
private <T extends IEntity> String getUri(Boolean platformService, String action, Context context, Map<String, String> requestParameters, Boolean entitlementService) throws FMSException { String uri = null; if (!platformService) { ServiceType serviceType = context.getIntuitServiceType(); if (entitlementService) { uri = prepareEntitlementUri(context); } else if (ServiceType.QBO == serviceType) { uri = prepareQBOUri(action, context, requestParameters); } else if (ServiceType.QBOPremier == serviceType) { uri = prepareQBOPremierUri(action, context, requestParameters); } else { throw new FMSException("SDK doesn't support for the service type : " + serviceType); } } else { uri = prepareIPSUri(action, context); } return uri; }
[ "private", "<", "T", "extends", "IEntity", ">", "String", "getUri", "(", "Boolean", "platformService", ",", "String", "action", ",", "Context", "context", ",", "Map", "<", "String", ",", "String", ">", "requestParameters", ",", "Boolean", "entitlementService", ")", "throws", "FMSException", "{", "String", "uri", "=", "null", ";", "if", "(", "!", "platformService", ")", "{", "ServiceType", "serviceType", "=", "context", ".", "getIntuitServiceType", "(", ")", ";", "if", "(", "entitlementService", ")", "{", "uri", "=", "prepareEntitlementUri", "(", "context", ")", ";", "}", "else", "if", "(", "ServiceType", ".", "QBO", "==", "serviceType", ")", "{", "uri", "=", "prepareQBOUri", "(", "action", ",", "context", ",", "requestParameters", ")", ";", "}", "else", "if", "(", "ServiceType", ".", "QBOPremier", "==", "serviceType", ")", "{", "uri", "=", "prepareQBOPremierUri", "(", "action", ",", "context", ",", "requestParameters", ")", ";", "}", "else", "{", "throw", "new", "FMSException", "(", "\"SDK doesn't support for the service type : \"", "+", "serviceType", ")", ";", "}", "}", "else", "{", "uri", "=", "prepareIPSUri", "(", "action", ",", "context", ")", ";", "}", "return", "uri", ";", "}" ]
Method to construct the URI @param action the entity name @param context the context @param requestParameters the request params @return returns URI
[ "Method", "to", "construct", "the", "URI" ]
train
https://github.com/intuit/QuickBooks-V3-Java-SDK/blob/59f988d0776d46620d0b34711c411b2b5b1da06b/ipp-v3-java-devkit/src/main/java/com/intuit/ipp/interceptors/PrepareRequestInterceptor.java#L229-L250
google/closure-compiler
src/com/google/javascript/rhino/jstype/JSTypeRegistry.java
JSTypeRegistry.createFunctionType
public FunctionType createFunctionType( JSType returnType, JSType... parameterTypes) { """ Creates a function type. @param returnType the function's return type @param parameterTypes the parameters' types """ return createFunctionType(returnType, createParameters(parameterTypes)); }
java
public FunctionType createFunctionType( JSType returnType, JSType... parameterTypes) { return createFunctionType(returnType, createParameters(parameterTypes)); }
[ "public", "FunctionType", "createFunctionType", "(", "JSType", "returnType", ",", "JSType", "...", "parameterTypes", ")", "{", "return", "createFunctionType", "(", "returnType", ",", "createParameters", "(", "parameterTypes", ")", ")", ";", "}" ]
Creates a function type. @param returnType the function's return type @param parameterTypes the parameters' types
[ "Creates", "a", "function", "type", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/jstype/JSTypeRegistry.java#L1589-L1592
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/FeatureShapes.java
FeatureShapes.getFeatureShape
public FeatureShape getFeatureShape(String database, String table, long featureId) { """ Get the feature shape for the database, table, and feature id @param database GeoPackage database @param table table name @param featureId feature id @return feature shape @since 3.2.0 """ Map<Long, FeatureShape> featureIds = getFeatureIds(database, table); FeatureShape featureShape = getFeatureShape(featureIds, featureId); return featureShape; }
java
public FeatureShape getFeatureShape(String database, String table, long featureId) { Map<Long, FeatureShape> featureIds = getFeatureIds(database, table); FeatureShape featureShape = getFeatureShape(featureIds, featureId); return featureShape; }
[ "public", "FeatureShape", "getFeatureShape", "(", "String", "database", ",", "String", "table", ",", "long", "featureId", ")", "{", "Map", "<", "Long", ",", "FeatureShape", ">", "featureIds", "=", "getFeatureIds", "(", "database", ",", "table", ")", ";", "FeatureShape", "featureShape", "=", "getFeatureShape", "(", "featureIds", ",", "featureId", ")", ";", "return", "featureShape", ";", "}" ]
Get the feature shape for the database, table, and feature id @param database GeoPackage database @param table table name @param featureId feature id @return feature shape @since 3.2.0
[ "Get", "the", "feature", "shape", "for", "the", "database", "table", "and", "feature", "id" ]
train
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/FeatureShapes.java#L136-L140
Azure/azure-sdk-for-java
edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/StorageAccountCredentialsInner.java
StorageAccountCredentialsInner.getAsync
public Observable<StorageAccountCredentialInner> getAsync(String deviceName, String name, String resourceGroupName) { """ Gets the properties of the specified storage account credential. @param deviceName The device name. @param name The storage account credential name. @param resourceGroupName The resource group name. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the StorageAccountCredentialInner object """ return getWithServiceResponseAsync(deviceName, name, resourceGroupName).map(new Func1<ServiceResponse<StorageAccountCredentialInner>, StorageAccountCredentialInner>() { @Override public StorageAccountCredentialInner call(ServiceResponse<StorageAccountCredentialInner> response) { return response.body(); } }); }
java
public Observable<StorageAccountCredentialInner> getAsync(String deviceName, String name, String resourceGroupName) { return getWithServiceResponseAsync(deviceName, name, resourceGroupName).map(new Func1<ServiceResponse<StorageAccountCredentialInner>, StorageAccountCredentialInner>() { @Override public StorageAccountCredentialInner call(ServiceResponse<StorageAccountCredentialInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "StorageAccountCredentialInner", ">", "getAsync", "(", "String", "deviceName", ",", "String", "name", ",", "String", "resourceGroupName", ")", "{", "return", "getWithServiceResponseAsync", "(", "deviceName", ",", "name", ",", "resourceGroupName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "StorageAccountCredentialInner", ">", ",", "StorageAccountCredentialInner", ">", "(", ")", "{", "@", "Override", "public", "StorageAccountCredentialInner", "call", "(", "ServiceResponse", "<", "StorageAccountCredentialInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Gets the properties of the specified storage account credential. @param deviceName The device name. @param name The storage account credential name. @param resourceGroupName The resource group name. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the StorageAccountCredentialInner object
[ "Gets", "the", "properties", "of", "the", "specified", "storage", "account", "credential", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/StorageAccountCredentialsInner.java#L255-L262
UrielCh/ovh-java-sdk
ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java
ApiOvhDedicatedserver.serviceName_features_backupCloud_POST
public OvhBackupCloud serviceName_features_backupCloud_POST(String serviceName, String cloudProjectId, String projectDescription) throws IOException { """ Create a new storage backup space associated to server REST: POST /dedicated/server/{serviceName}/features/backupCloud @param projectDescription [required] Project description of the project to be created (ignored when an existing project is already specified) @param cloudProjectId [required] cloud project id @param serviceName [required] The internal name of your dedicated server API beta """ String qPath = "/dedicated/server/{serviceName}/features/backupCloud"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "cloudProjectId", cloudProjectId); addBody(o, "projectDescription", projectDescription); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhBackupCloud.class); }
java
public OvhBackupCloud serviceName_features_backupCloud_POST(String serviceName, String cloudProjectId, String projectDescription) throws IOException { String qPath = "/dedicated/server/{serviceName}/features/backupCloud"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "cloudProjectId", cloudProjectId); addBody(o, "projectDescription", projectDescription); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhBackupCloud.class); }
[ "public", "OvhBackupCloud", "serviceName_features_backupCloud_POST", "(", "String", "serviceName", ",", "String", "cloudProjectId", ",", "String", "projectDescription", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/dedicated/server/{serviceName}/features/backupCloud\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ")", ";", "HashMap", "<", "String", ",", "Object", ">", "o", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "addBody", "(", "o", ",", "\"cloudProjectId\"", ",", "cloudProjectId", ")", ";", "addBody", "(", "o", ",", "\"projectDescription\"", ",", "projectDescription", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"POST\"", ",", "sb", ".", "toString", "(", ")", ",", "o", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhBackupCloud", ".", "class", ")", ";", "}" ]
Create a new storage backup space associated to server REST: POST /dedicated/server/{serviceName}/features/backupCloud @param projectDescription [required] Project description of the project to be created (ignored when an existing project is already specified) @param cloudProjectId [required] cloud project id @param serviceName [required] The internal name of your dedicated server API beta
[ "Create", "a", "new", "storage", "backup", "space", "associated", "to", "server" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java#L778-L786
Impetus/Kundera
src/jpa-engine/core/src/main/java/com/impetus/kundera/metadata/model/type/AbstractManagedType.java
AbstractManagedType.onCheckCollectionAttribute
private <E> boolean onCheckCollectionAttribute(PluralAttribute<? super X, ?, ?> pluralAttribute, Class<E> paramClass) { """ On check collection attribute. @param <E> the element type @param pluralAttribute the plural attribute @param paramClass the param class @return true, if successful """ if (pluralAttribute != null) { if (isCollectionAttribute(pluralAttribute) && isBindable(pluralAttribute, paramClass)) { return true; } } return false; }
java
private <E> boolean onCheckCollectionAttribute(PluralAttribute<? super X, ?, ?> pluralAttribute, Class<E> paramClass) { if (pluralAttribute != null) { if (isCollectionAttribute(pluralAttribute) && isBindable(pluralAttribute, paramClass)) { return true; } } return false; }
[ "private", "<", "E", ">", "boolean", "onCheckCollectionAttribute", "(", "PluralAttribute", "<", "?", "super", "X", ",", "?", ",", "?", ">", "pluralAttribute", ",", "Class", "<", "E", ">", "paramClass", ")", "{", "if", "(", "pluralAttribute", "!=", "null", ")", "{", "if", "(", "isCollectionAttribute", "(", "pluralAttribute", ")", "&&", "isBindable", "(", "pluralAttribute", ",", "paramClass", ")", ")", "{", "return", "true", ";", "}", "}", "return", "false", ";", "}" ]
On check collection attribute. @param <E> the element type @param pluralAttribute the plural attribute @param paramClass the param class @return true, if successful
[ "On", "check", "collection", "attribute", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/metadata/model/type/AbstractManagedType.java#L931-L943
OpenLiberty/open-liberty
dev/com.ibm.ws.jaxws.clientcontainer/src/com/ibm/ws/jaxws/utils/JaxWsUtils.java
JaxWsUtils.getServiceQName
public static QName getServiceQName(ClassInfo classInfo, String seiClassName, String targetNamespace) { """ Get serviceName's QName of Web Service @param classInfo @return """ AnnotationInfo annotationInfo = getAnnotationInfoFromClass(classInfo, "Service QName"); if (annotationInfo == null) { return null; } //serviceName can only be defined in implementation bean, targetNamespace should be the implemented one. return getQName(classInfo, targetNamespace, annotationInfo.getValue(JaxWsConstants.SERVICENAME_ATTRIBUTE).getStringValue(), JaxWsConstants.SERVICENAME_ATTRIBUTE_SUFFIX); }
java
public static QName getServiceQName(ClassInfo classInfo, String seiClassName, String targetNamespace) { AnnotationInfo annotationInfo = getAnnotationInfoFromClass(classInfo, "Service QName"); if (annotationInfo == null) { return null; } //serviceName can only be defined in implementation bean, targetNamespace should be the implemented one. return getQName(classInfo, targetNamespace, annotationInfo.getValue(JaxWsConstants.SERVICENAME_ATTRIBUTE).getStringValue(), JaxWsConstants.SERVICENAME_ATTRIBUTE_SUFFIX); }
[ "public", "static", "QName", "getServiceQName", "(", "ClassInfo", "classInfo", ",", "String", "seiClassName", ",", "String", "targetNamespace", ")", "{", "AnnotationInfo", "annotationInfo", "=", "getAnnotationInfoFromClass", "(", "classInfo", ",", "\"Service QName\"", ")", ";", "if", "(", "annotationInfo", "==", "null", ")", "{", "return", "null", ";", "}", "//serviceName can only be defined in implementation bean, targetNamespace should be the implemented one.", "return", "getQName", "(", "classInfo", ",", "targetNamespace", ",", "annotationInfo", ".", "getValue", "(", "JaxWsConstants", ".", "SERVICENAME_ATTRIBUTE", ")", ".", "getStringValue", "(", ")", ",", "JaxWsConstants", ".", "SERVICENAME_ATTRIBUTE_SUFFIX", ")", ";", "}" ]
Get serviceName's QName of Web Service @param classInfo @return
[ "Get", "serviceName", "s", "QName", "of", "Web", "Service" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jaxws.clientcontainer/src/com/ibm/ws/jaxws/utils/JaxWsUtils.java#L92-L102
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/internal/util/hashslot/impl/HashSlotArrayBase.java
HashSlotArrayBase.ensure0
protected final SlotAssignmentResult ensure0(long key1, long key2) { """ These protected final methods will be called from the subclasses """ assertValid(); final long size = size(); if (size == expansionThreshold()) { resizeTo(CapacityUtil.nextCapacity(capacity())); } long slot = keyHash(key1, key2) & mask(); while (isSlotAssigned(slot)) { if (equal(key1OfSlot(slot), key2OfSlot(slot), key1, key2)) { slotAssignmentResult.setAddress(valueAddrOfSlot(slot)); slotAssignmentResult.setNew(false); return slotAssignmentResult; } slot = (slot + 1) & mask(); } setSize(size + 1); putKey(baseAddress, slot, key1, key2); slotAssignmentResult.setAddress(valueAddrOfSlot(slot)); slotAssignmentResult.setNew(true); return slotAssignmentResult; }
java
protected final SlotAssignmentResult ensure0(long key1, long key2) { assertValid(); final long size = size(); if (size == expansionThreshold()) { resizeTo(CapacityUtil.nextCapacity(capacity())); } long slot = keyHash(key1, key2) & mask(); while (isSlotAssigned(slot)) { if (equal(key1OfSlot(slot), key2OfSlot(slot), key1, key2)) { slotAssignmentResult.setAddress(valueAddrOfSlot(slot)); slotAssignmentResult.setNew(false); return slotAssignmentResult; } slot = (slot + 1) & mask(); } setSize(size + 1); putKey(baseAddress, slot, key1, key2); slotAssignmentResult.setAddress(valueAddrOfSlot(slot)); slotAssignmentResult.setNew(true); return slotAssignmentResult; }
[ "protected", "final", "SlotAssignmentResult", "ensure0", "(", "long", "key1", ",", "long", "key2", ")", "{", "assertValid", "(", ")", ";", "final", "long", "size", "=", "size", "(", ")", ";", "if", "(", "size", "==", "expansionThreshold", "(", ")", ")", "{", "resizeTo", "(", "CapacityUtil", ".", "nextCapacity", "(", "capacity", "(", ")", ")", ")", ";", "}", "long", "slot", "=", "keyHash", "(", "key1", ",", "key2", ")", "&", "mask", "(", ")", ";", "while", "(", "isSlotAssigned", "(", "slot", ")", ")", "{", "if", "(", "equal", "(", "key1OfSlot", "(", "slot", ")", ",", "key2OfSlot", "(", "slot", ")", ",", "key1", ",", "key2", ")", ")", "{", "slotAssignmentResult", ".", "setAddress", "(", "valueAddrOfSlot", "(", "slot", ")", ")", ";", "slotAssignmentResult", ".", "setNew", "(", "false", ")", ";", "return", "slotAssignmentResult", ";", "}", "slot", "=", "(", "slot", "+", "1", ")", "&", "mask", "(", ")", ";", "}", "setSize", "(", "size", "+", "1", ")", ";", "putKey", "(", "baseAddress", ",", "slot", ",", "key1", ",", "key2", ")", ";", "slotAssignmentResult", ".", "setAddress", "(", "valueAddrOfSlot", "(", "slot", ")", ")", ";", "slotAssignmentResult", ".", "setNew", "(", "true", ")", ";", "return", "slotAssignmentResult", ";", "}" ]
These protected final methods will be called from the subclasses
[ "These", "protected", "final", "methods", "will", "be", "called", "from", "the", "subclasses" ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/util/hashslot/impl/HashSlotArrayBase.java#L221-L241
googleads/googleads-java-lib
examples/adwords_axis/src/main/java/adwords/axis/v201809/shoppingcampaigns/GetProductCategoryTaxonomy.java
GetProductCategoryTaxonomy.displayCategories
private static void displayCategories(List<CategoryNode> categories, String prefix) { """ Recursively prints out each category node and its children. @param categories the categories to print. @param prefix the string to print at the beginning of each line of output. """ for (CategoryNode category : categories) { System.out.printf("%s%s [%s]%n", prefix, category.name, category.id); displayCategories(category.children, String.format("%s%s > ", prefix, category.name)); } }
java
private static void displayCategories(List<CategoryNode> categories, String prefix) { for (CategoryNode category : categories) { System.out.printf("%s%s [%s]%n", prefix, category.name, category.id); displayCategories(category.children, String.format("%s%s > ", prefix, category.name)); } }
[ "private", "static", "void", "displayCategories", "(", "List", "<", "CategoryNode", ">", "categories", ",", "String", "prefix", ")", "{", "for", "(", "CategoryNode", "category", ":", "categories", ")", "{", "System", ".", "out", ".", "printf", "(", "\"%s%s [%s]%n\"", ",", "prefix", ",", "category", ".", "name", ",", "category", ".", "id", ")", ";", "displayCategories", "(", "category", ".", "children", ",", "String", ".", "format", "(", "\"%s%s > \"", ",", "prefix", ",", "category", ".", "name", ")", ")", ";", "}", "}" ]
Recursively prints out each category node and its children. @param categories the categories to print. @param prefix the string to print at the beginning of each line of output.
[ "Recursively", "prints", "out", "each", "category", "node", "and", "its", "children", "." ]
train
https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/examples/adwords_axis/src/main/java/adwords/axis/v201809/shoppingcampaigns/GetProductCategoryTaxonomy.java#L168-L173
netty/netty
common/src/main/java/io/netty/util/ReferenceCountUtil.java
ReferenceCountUtil.releaseLater
@Deprecated public static <T> T releaseLater(T msg, int decrement) { """ Schedules the specified object to be released when the caller thread terminates. Note that this operation is intended to simplify reference counting of ephemeral objects during unit tests. Do not use it beyond the intended use case. @deprecated this may introduce a lot of memory usage so it is generally preferable to manually release objects. """ if (msg instanceof ReferenceCounted) { ThreadDeathWatcher.watch(Thread.currentThread(), new ReleasingTask((ReferenceCounted) msg, decrement)); } return msg; }
java
@Deprecated public static <T> T releaseLater(T msg, int decrement) { if (msg instanceof ReferenceCounted) { ThreadDeathWatcher.watch(Thread.currentThread(), new ReleasingTask((ReferenceCounted) msg, decrement)); } return msg; }
[ "@", "Deprecated", "public", "static", "<", "T", ">", "T", "releaseLater", "(", "T", "msg", ",", "int", "decrement", ")", "{", "if", "(", "msg", "instanceof", "ReferenceCounted", ")", "{", "ThreadDeathWatcher", ".", "watch", "(", "Thread", ".", "currentThread", "(", ")", ",", "new", "ReleasingTask", "(", "(", "ReferenceCounted", ")", "msg", ",", "decrement", ")", ")", ";", "}", "return", "msg", ";", "}" ]
Schedules the specified object to be released when the caller thread terminates. Note that this operation is intended to simplify reference counting of ephemeral objects during unit tests. Do not use it beyond the intended use case. @deprecated this may introduce a lot of memory usage so it is generally preferable to manually release objects.
[ "Schedules", "the", "specified", "object", "to", "be", "released", "when", "the", "caller", "thread", "terminates", ".", "Note", "that", "this", "operation", "is", "intended", "to", "simplify", "reference", "counting", "of", "ephemeral", "objects", "during", "unit", "tests", ".", "Do", "not", "use", "it", "beyond", "the", "intended", "use", "case", "." ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/ReferenceCountUtil.java#L155-L161
OpenLiberty/open-liberty
dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/util/MessageDigestUtility.java
MessageDigestUtility.processMessageDigestForData
public static String processMessageDigestForData(MessageDigest messageDigest, byte[] data) { """ Calculate the digest specified by byte array of data @param messageDigest @param data @return digest in string with base64 encoding. """ String output = ""; //$NON-NLS-1$ if (messageDigest != null) { // Get the digest for the given data messageDigest.update(data); byte[] digest = messageDigest.digest(); output = Base64Coder.encode(digest); } return output; }
java
public static String processMessageDigestForData(MessageDigest messageDigest, byte[] data) { String output = ""; //$NON-NLS-1$ if (messageDigest != null) { // Get the digest for the given data messageDigest.update(data); byte[] digest = messageDigest.digest(); output = Base64Coder.encode(digest); } return output; }
[ "public", "static", "String", "processMessageDigestForData", "(", "MessageDigest", "messageDigest", ",", "byte", "[", "]", "data", ")", "{", "String", "output", "=", "\"\"", ";", "//$NON-NLS-1$", "if", "(", "messageDigest", "!=", "null", ")", "{", "// Get the digest for the given data", "messageDigest", ".", "update", "(", "data", ")", ";", "byte", "[", "]", "digest", "=", "messageDigest", ".", "digest", "(", ")", ";", "output", "=", "Base64Coder", ".", "encode", "(", "digest", ")", ";", "}", "return", "output", ";", "}" ]
Calculate the digest specified by byte array of data @param messageDigest @param data @return digest in string with base64 encoding.
[ "Calculate", "the", "digest", "specified", "by", "byte", "array", "of", "data" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/util/MessageDigestUtility.java#L42-L51
Drivemode/TypefaceHelper
TypefaceHelper/src/main/java/com/drivemode/android/typeface/TypefaceHelper.java
TypefaceHelper.setTypeface
public <V extends TextView> void setTypeface(V view, @StringRes int strResId) { """ Set the typeface to the target view. @param view to set typeface. @param strResId string resource containing typeface name. @param <V> text view parameter. """ setTypeface(view, mApplication.getString(strResId)); }
java
public <V extends TextView> void setTypeface(V view, @StringRes int strResId) { setTypeface(view, mApplication.getString(strResId)); }
[ "public", "<", "V", "extends", "TextView", ">", "void", "setTypeface", "(", "V", "view", ",", "@", "StringRes", "int", "strResId", ")", "{", "setTypeface", "(", "view", ",", "mApplication", ".", "getString", "(", "strResId", ")", ")", ";", "}" ]
Set the typeface to the target view. @param view to set typeface. @param strResId string resource containing typeface name. @param <V> text view parameter.
[ "Set", "the", "typeface", "to", "the", "target", "view", "." ]
train
https://github.com/Drivemode/TypefaceHelper/blob/86bef9ce16b9626b7076559e846db1b9f043c008/TypefaceHelper/src/main/java/com/drivemode/android/typeface/TypefaceHelper.java#L95-L97
Azure/azure-sdk-for-java
network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/VirtualNetworksInner.java
VirtualNetworksInner.updateTagsAsync
public Observable<VirtualNetworkInner> updateTagsAsync(String resourceGroupName, String virtualNetworkName, Map<String, String> tags) { """ Updates a virtual network tags. @param resourceGroupName The name of the resource group. @param virtualNetworkName The name of the virtual network. @param tags Resource tags. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request """ return updateTagsWithServiceResponseAsync(resourceGroupName, virtualNetworkName, tags).map(new Func1<ServiceResponse<VirtualNetworkInner>, VirtualNetworkInner>() { @Override public VirtualNetworkInner call(ServiceResponse<VirtualNetworkInner> response) { return response.body(); } }); }
java
public Observable<VirtualNetworkInner> updateTagsAsync(String resourceGroupName, String virtualNetworkName, Map<String, String> tags) { return updateTagsWithServiceResponseAsync(resourceGroupName, virtualNetworkName, tags).map(new Func1<ServiceResponse<VirtualNetworkInner>, VirtualNetworkInner>() { @Override public VirtualNetworkInner call(ServiceResponse<VirtualNetworkInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "VirtualNetworkInner", ">", "updateTagsAsync", "(", "String", "resourceGroupName", ",", "String", "virtualNetworkName", ",", "Map", "<", "String", ",", "String", ">", "tags", ")", "{", "return", "updateTagsWithServiceResponseAsync", "(", "resourceGroupName", ",", "virtualNetworkName", ",", "tags", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "VirtualNetworkInner", ">", ",", "VirtualNetworkInner", ">", "(", ")", "{", "@", "Override", "public", "VirtualNetworkInner", "call", "(", "ServiceResponse", "<", "VirtualNetworkInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Updates a virtual network tags. @param resourceGroupName The name of the resource group. @param virtualNetworkName The name of the virtual network. @param tags Resource tags. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Updates", "a", "virtual", "network", "tags", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/VirtualNetworksInner.java#L720-L727
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/event/ChangeFocusOnChangeHandler.java
ChangeFocusOnChangeHandler.init
public void init(BaseField field, ScreenComponent screenField, BaseField fldTarget) { """ Constructor. This listener only responds to screen moves by default. @param field The field to change the focus to on change to this field. @param screenField The screen field to change the focus to on change to this field. """ super.init(field); m_screenField = screenField; m_fldTarget = fldTarget; m_bScreenMove = true; // Only respond to user change m_bInitMove = false; m_bReadMove = false; if (screenField == null) this.lookupSField(); }
java
public void init(BaseField field, ScreenComponent screenField, BaseField fldTarget) { super.init(field); m_screenField = screenField; m_fldTarget = fldTarget; m_bScreenMove = true; // Only respond to user change m_bInitMove = false; m_bReadMove = false; if (screenField == null) this.lookupSField(); }
[ "public", "void", "init", "(", "BaseField", "field", ",", "ScreenComponent", "screenField", ",", "BaseField", "fldTarget", ")", "{", "super", ".", "init", "(", "field", ")", ";", "m_screenField", "=", "screenField", ";", "m_fldTarget", "=", "fldTarget", ";", "m_bScreenMove", "=", "true", ";", "// Only respond to user change", "m_bInitMove", "=", "false", ";", "m_bReadMove", "=", "false", ";", "if", "(", "screenField", "==", "null", ")", "this", ".", "lookupSField", "(", ")", ";", "}" ]
Constructor. This listener only responds to screen moves by default. @param field The field to change the focus to on change to this field. @param screenField The screen field to change the focus to on change to this field.
[ "Constructor", ".", "This", "listener", "only", "responds", "to", "screen", "moves", "by", "default", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/event/ChangeFocusOnChangeHandler.java#L68-L79
OpenLiberty/open-liberty
dev/com.ibm.ws.monitor/src/com/ibm/ws/pmi/server/PmiRegistry.java
PmiRegistry.getStats
private static StatsImpl getStats(ModuleItem moduleItem, boolean recursive) { """ /* // Return a StatsImpl for server data // Take a boolean parameter for two modes: recursive and non-recursive private static StatsImpl getServer(boolean recursive) { // Note: there is no data under directly under server module tree root, // so return null if not recursive if(!recursive) return null; ModuleItem[] modItems = moduleRoot.children(); if(modItems == null) { return new StatsImpl("server", TYPE_SERVER, moduleRoot.level, null, null); } ArrayList modMembers = new ArrayList(modItems.length); for(int i=0; i<modItems.length; i++) { modMembers.add(modItems[i].getStats(recursive)); } StatsImpl sCol = new StatsImpl("server", TYPE_SERVER, moduleRoot.level, null, modMembers); return sCol; } """ // Note: cannot retrieve single data for JMX interface //int[] dataIds = msd.getDataIds(); if (moduleItem == null) { // not found return null; } return moduleItem.getStats(recursive); /* * else if(moduleItem.getInstance() == null) * { // root module item * return getServer(recursive); * } * else * { * return moduleItem.getStats(recursive); * } */ }
java
private static StatsImpl getStats(ModuleItem moduleItem, boolean recursive) { // Note: cannot retrieve single data for JMX interface //int[] dataIds = msd.getDataIds(); if (moduleItem == null) { // not found return null; } return moduleItem.getStats(recursive); /* * else if(moduleItem.getInstance() == null) * { // root module item * return getServer(recursive); * } * else * { * return moduleItem.getStats(recursive); * } */ }
[ "private", "static", "StatsImpl", "getStats", "(", "ModuleItem", "moduleItem", ",", "boolean", "recursive", ")", "{", "// Note: cannot retrieve single data for JMX interface", "//int[] dataIds = msd.getDataIds();", "if", "(", "moduleItem", "==", "null", ")", "{", "// not found", "return", "null", ";", "}", "return", "moduleItem", ".", "getStats", "(", "recursive", ")", ";", "/*\n * else if(moduleItem.getInstance() == null)\n * { // root module item\n * return getServer(recursive);\n * }\n * else\n * {\n * return moduleItem.getStats(recursive);\n * }\n */", "}" ]
/* // Return a StatsImpl for server data // Take a boolean parameter for two modes: recursive and non-recursive private static StatsImpl getServer(boolean recursive) { // Note: there is no data under directly under server module tree root, // so return null if not recursive if(!recursive) return null; ModuleItem[] modItems = moduleRoot.children(); if(modItems == null) { return new StatsImpl("server", TYPE_SERVER, moduleRoot.level, null, null); } ArrayList modMembers = new ArrayList(modItems.length); for(int i=0; i<modItems.length; i++) { modMembers.add(modItems[i].getStats(recursive)); } StatsImpl sCol = new StatsImpl("server", TYPE_SERVER, moduleRoot.level, null, modMembers); return sCol; }
[ "/", "*", "//", "Return", "a", "StatsImpl", "for", "server", "data", "//", "Take", "a", "boolean", "parameter", "for", "two", "modes", ":", "recursive", "and", "non", "-", "recursive", "private", "static", "StatsImpl", "getServer", "(", "boolean", "recursive", ")", "{", "//", "Note", ":", "there", "is", "no", "data", "under", "directly", "under", "server", "module", "tree", "root", "//", "so", "return", "null", "if", "not", "recursive", "if", "(", "!recursive", ")", "return", "null", ";", "ModuleItem", "[]", "modItems", "=", "moduleRoot", ".", "children", "()", ";", "if", "(", "modItems", "==", "null", ")", "{", "return", "new", "StatsImpl", "(", "server", "TYPE_SERVER", "moduleRoot", ".", "level", "null", "null", ")", ";", "}", "ArrayList", "modMembers", "=", "new", "ArrayList", "(", "modItems", ".", "length", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i<modItems", ".", "length", ";", "i", "++", ")", "{", "modMembers", ".", "add", "(", "modItems", "[", "i", "]", ".", "getStats", "(", "recursive", "))", ";", "}", "StatsImpl", "sCol", "=", "new", "StatsImpl", "(", "server", "TYPE_SERVER", "moduleRoot", ".", "level", "null", "modMembers", ")", ";", "return", "sCol", ";", "}" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.monitor/src/com/ibm/ws/pmi/server/PmiRegistry.java#L559-L578
grails/grails-core
grails-core/src/main/groovy/grails/util/GrailsClassUtils.java
GrailsClassUtils.isPropertyOfType
public static boolean isPropertyOfType(Class<?> clazz, String propertyName, Class<?> type) { """ Returns true if the specified property in the specified class is of the specified type @param clazz The class which contains the property @param propertyName The property name @param type The type to check @return A boolean value """ try { Class<?> propType = getPropertyType(clazz, propertyName); return propType != null && propType.equals(type); } catch (Exception e) { return false; } }
java
public static boolean isPropertyOfType(Class<?> clazz, String propertyName, Class<?> type) { try { Class<?> propType = getPropertyType(clazz, propertyName); return propType != null && propType.equals(type); } catch (Exception e) { return false; } }
[ "public", "static", "boolean", "isPropertyOfType", "(", "Class", "<", "?", ">", "clazz", ",", "String", "propertyName", ",", "Class", "<", "?", ">", "type", ")", "{", "try", "{", "Class", "<", "?", ">", "propType", "=", "getPropertyType", "(", "clazz", ",", "propertyName", ")", ";", "return", "propType", "!=", "null", "&&", "propType", ".", "equals", "(", "type", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "return", "false", ";", "}", "}" ]
Returns true if the specified property in the specified class is of the specified type @param clazz The class which contains the property @param propertyName The property name @param type The type to check @return A boolean value
[ "Returns", "true", "if", "the", "specified", "property", "in", "the", "specified", "class", "is", "of", "the", "specified", "type" ]
train
https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-core/src/main/groovy/grails/util/GrailsClassUtils.java#L201-L209
b3dgs/lionengine
lionengine-core/src/main/java/com/b3dgs/lionengine/graphic/drawable/ImageHeaderReaderAbstract.java
ImageHeaderReaderAbstract.checkHeader
private static boolean checkHeader(InputStream input, int[] header) throws IOException { """ Check header data. @param input The input stream to check. @param header The expected header. @return <code>true</code> if right header, <code>false</code> else. @throws IOException If unable to read header. """ for (final int b : header) { if (b != input.read()) { return false; } } return true; }
java
private static boolean checkHeader(InputStream input, int[] header) throws IOException { for (final int b : header) { if (b != input.read()) { return false; } } return true; }
[ "private", "static", "boolean", "checkHeader", "(", "InputStream", "input", ",", "int", "[", "]", "header", ")", "throws", "IOException", "{", "for", "(", "final", "int", "b", ":", "header", ")", "{", "if", "(", "b", "!=", "input", ".", "read", "(", ")", ")", "{", "return", "false", ";", "}", "}", "return", "true", ";", "}" ]
Check header data. @param input The input stream to check. @param header The expected header. @return <code>true</code> if right header, <code>false</code> else. @throws IOException If unable to read header.
[ "Check", "header", "data", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-core/src/main/java/com/b3dgs/lionengine/graphic/drawable/ImageHeaderReaderAbstract.java#L104-L114
javalite/activejdbc
javalite-common/src/main/java/org/javalite/common/Templator.java
Templator.mergeFromPath
public static String mergeFromPath(String templatePath, Map<String, ?> values) { """ This method is used in one-off operations, where it is OK to load a template every time. Example: <code> String result = Templator.mergeFromPath(readResource("/message_template.txt", valuesMap)); </code> @param templatePath template to merge @param values values to merge into a template @return result of merging """ return mergeFromTemplate(readResource(templatePath), values); }
java
public static String mergeFromPath(String templatePath, Map<String, ?> values) { return mergeFromTemplate(readResource(templatePath), values); }
[ "public", "static", "String", "mergeFromPath", "(", "String", "templatePath", ",", "Map", "<", "String", ",", "?", ">", "values", ")", "{", "return", "mergeFromTemplate", "(", "readResource", "(", "templatePath", ")", ",", "values", ")", ";", "}" ]
This method is used in one-off operations, where it is OK to load a template every time. Example: <code> String result = Templator.mergeFromPath(readResource("/message_template.txt", valuesMap)); </code> @param templatePath template to merge @param values values to merge into a template @return result of merging
[ "This", "method", "is", "used", "in", "one", "-", "off", "operations", "where", "it", "is", "OK", "to", "load", "a", "template", "every", "time", "." ]
train
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/javalite-common/src/main/java/org/javalite/common/Templator.java#L81-L83
deeplearning4j/deeplearning4j
datavec/datavec-spark/src/main/java/org/datavec/spark/transform/utils/SparkUtils.java
SparkUtils.writeObjectToFile
public static void writeObjectToFile(String path, Object toWrite, Configuration hadoopConfig) throws IOException { """ Write an object to HDFS (or local) using default Java object serialization @param path Path to write the object to @param toWrite Object to write @param hadoopConfig Hadoop configuration, for example from SparkContext.hadoopConfiguration() """ FileSystem fileSystem = FileSystem.get(hadoopConfig); try (BufferedOutputStream bos = new BufferedOutputStream(fileSystem.create(new Path(path)))) { ObjectOutputStream oos = new ObjectOutputStream(bos); oos.writeObject(toWrite); } }
java
public static void writeObjectToFile(String path, Object toWrite, Configuration hadoopConfig) throws IOException { FileSystem fileSystem = FileSystem.get(hadoopConfig); try (BufferedOutputStream bos = new BufferedOutputStream(fileSystem.create(new Path(path)))) { ObjectOutputStream oos = new ObjectOutputStream(bos); oos.writeObject(toWrite); } }
[ "public", "static", "void", "writeObjectToFile", "(", "String", "path", ",", "Object", "toWrite", ",", "Configuration", "hadoopConfig", ")", "throws", "IOException", "{", "FileSystem", "fileSystem", "=", "FileSystem", ".", "get", "(", "hadoopConfig", ")", ";", "try", "(", "BufferedOutputStream", "bos", "=", "new", "BufferedOutputStream", "(", "fileSystem", ".", "create", "(", "new", "Path", "(", "path", ")", ")", ")", ")", "{", "ObjectOutputStream", "oos", "=", "new", "ObjectOutputStream", "(", "bos", ")", ";", "oos", ".", "writeObject", "(", "toWrite", ")", ";", "}", "}" ]
Write an object to HDFS (or local) using default Java object serialization @param path Path to write the object to @param toWrite Object to write @param hadoopConfig Hadoop configuration, for example from SparkContext.hadoopConfiguration()
[ "Write", "an", "object", "to", "HDFS", "(", "or", "local", ")", "using", "default", "Java", "object", "serialization" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-spark/src/main/java/org/datavec/spark/transform/utils/SparkUtils.java#L166-L172
craterdog/java-general-utilities
src/main/java/craterdog/utils/ByteUtils.java
ByteUtils.bytesToDouble
static public double bytesToDouble(byte[] buffer, int index) { """ This function converts the bytes in a byte array at the specified index to its corresponding double value. @param buffer The byte array containing the double. @param index The index for the first byte in the byte array. @return The corresponding double value. """ double real; long bits = bytesToLong(buffer, index); real = Double.longBitsToDouble(bits); return real; }
java
static public double bytesToDouble(byte[] buffer, int index) { double real; long bits = bytesToLong(buffer, index); real = Double.longBitsToDouble(bits); return real; }
[ "static", "public", "double", "bytesToDouble", "(", "byte", "[", "]", "buffer", ",", "int", "index", ")", "{", "double", "real", ";", "long", "bits", "=", "bytesToLong", "(", "buffer", ",", "index", ")", ";", "real", "=", "Double", ".", "longBitsToDouble", "(", "bits", ")", ";", "return", "real", ";", "}" ]
This function converts the bytes in a byte array at the specified index to its corresponding double value. @param buffer The byte array containing the double. @param index The index for the first byte in the byte array. @return The corresponding double value.
[ "This", "function", "converts", "the", "bytes", "in", "a", "byte", "array", "at", "the", "specified", "index", "to", "its", "corresponding", "double", "value", "." ]
train
https://github.com/craterdog/java-general-utilities/blob/a3ff45eaa00c2b8ed5c53efe9fe5166065fc1f57/src/main/java/craterdog/utils/ByteUtils.java#L455-L460
ogaclejapan/SmartTabLayout
library/src/main/java/com/ogaclejapan/smarttablayout/SmartTabStrip.java
SmartTabStrip.setColorAlpha
private static int setColorAlpha(int color, byte alpha) { """ Set the alpha value of the {@code color} to be the given {@code alpha} value. """ return Color.argb(alpha, Color.red(color), Color.green(color), Color.blue(color)); }
java
private static int setColorAlpha(int color, byte alpha) { return Color.argb(alpha, Color.red(color), Color.green(color), Color.blue(color)); }
[ "private", "static", "int", "setColorAlpha", "(", "int", "color", ",", "byte", "alpha", ")", "{", "return", "Color", ".", "argb", "(", "alpha", ",", "Color", ".", "red", "(", "color", ")", ",", "Color", ".", "green", "(", "color", ")", ",", "Color", ".", "blue", "(", "color", ")", ")", ";", "}" ]
Set the alpha value of the {@code color} to be the given {@code alpha} value.
[ "Set", "the", "alpha", "value", "of", "the", "{" ]
train
https://github.com/ogaclejapan/SmartTabLayout/blob/712e81a92f1e12a3c33dcbda03d813e0162e8589/library/src/main/java/com/ogaclejapan/smarttablayout/SmartTabStrip.java#L193-L195
pac4j/pac4j
pac4j-oauth/src/main/java/org/pac4j/oauth/config/OAuthConfiguration.java
OAuthConfiguration.buildService
public S buildService(final WebContext context, final IndirectClient client, final String state) { """ Build an OAuth service from the web context and with a state. @param context the web context @param client the client @param state a given state @return the OAuth service """ init(); final String finalCallbackUrl = client.computeFinalCallbackUrl(context); return getApi().createService(this.key, this.secret, finalCallbackUrl, this.scope, null, state, this.responseType, null, this.httpClientConfig, null); }
java
public S buildService(final WebContext context, final IndirectClient client, final String state) { init(); final String finalCallbackUrl = client.computeFinalCallbackUrl(context); return getApi().createService(this.key, this.secret, finalCallbackUrl, this.scope, null, state, this.responseType, null, this.httpClientConfig, null); }
[ "public", "S", "buildService", "(", "final", "WebContext", "context", ",", "final", "IndirectClient", "client", ",", "final", "String", "state", ")", "{", "init", "(", ")", ";", "final", "String", "finalCallbackUrl", "=", "client", ".", "computeFinalCallbackUrl", "(", "context", ")", ";", "return", "getApi", "(", ")", ".", "createService", "(", "this", ".", "key", ",", "this", ".", "secret", ",", "finalCallbackUrl", ",", "this", ".", "scope", ",", "null", ",", "state", ",", "this", ".", "responseType", ",", "null", ",", "this", ".", "httpClientConfig", ",", "null", ")", ";", "}" ]
Build an OAuth service from the web context and with a state. @param context the web context @param client the client @param state a given state @return the OAuth service
[ "Build", "an", "OAuth", "service", "from", "the", "web", "context", "and", "with", "a", "state", "." ]
train
https://github.com/pac4j/pac4j/blob/d9cd029f8783792b31dd48bf1e32f80628f2c4a3/pac4j-oauth/src/main/java/org/pac4j/oauth/config/OAuthConfiguration.java#L62-L69
drewnoakes/metadata-extractor
Source/com/drew/metadata/Age.java
Age.fromPanasonicString
@Nullable public static Age fromPanasonicString(@NotNull String s) { """ Parses an age object from the string format used by Panasonic cameras: <code>0031:07:15 00:00:00</code> @param s The String in format <code>0031:07:15 00:00:00</code>. @return The parsed Age object, or null if the value could not be parsed """ if (s.length() != 19 || s.startsWith("9999:99:99")) return null; try { int years = Integer.parseInt(s.substring(0, 4)); int months = Integer.parseInt(s.substring(5, 7)); int days = Integer.parseInt(s.substring(8, 10)); int hours = Integer.parseInt(s.substring(11, 13)); int minutes = Integer.parseInt(s.substring(14, 16)); int seconds = Integer.parseInt(s.substring(17, 19)); return new Age(years, months, days, hours, minutes, seconds); } catch (NumberFormatException ignored) { return null; } }
java
@Nullable public static Age fromPanasonicString(@NotNull String s) { if (s.length() != 19 || s.startsWith("9999:99:99")) return null; try { int years = Integer.parseInt(s.substring(0, 4)); int months = Integer.parseInt(s.substring(5, 7)); int days = Integer.parseInt(s.substring(8, 10)); int hours = Integer.parseInt(s.substring(11, 13)); int minutes = Integer.parseInt(s.substring(14, 16)); int seconds = Integer.parseInt(s.substring(17, 19)); return new Age(years, months, days, hours, minutes, seconds); } catch (NumberFormatException ignored) { return null; } }
[ "@", "Nullable", "public", "static", "Age", "fromPanasonicString", "(", "@", "NotNull", "String", "s", ")", "{", "if", "(", "s", ".", "length", "(", ")", "!=", "19", "||", "s", ".", "startsWith", "(", "\"9999:99:99\"", ")", ")", "return", "null", ";", "try", "{", "int", "years", "=", "Integer", ".", "parseInt", "(", "s", ".", "substring", "(", "0", ",", "4", ")", ")", ";", "int", "months", "=", "Integer", ".", "parseInt", "(", "s", ".", "substring", "(", "5", ",", "7", ")", ")", ";", "int", "days", "=", "Integer", ".", "parseInt", "(", "s", ".", "substring", "(", "8", ",", "10", ")", ")", ";", "int", "hours", "=", "Integer", ".", "parseInt", "(", "s", ".", "substring", "(", "11", ",", "13", ")", ")", ";", "int", "minutes", "=", "Integer", ".", "parseInt", "(", "s", ".", "substring", "(", "14", ",", "16", ")", ")", ";", "int", "seconds", "=", "Integer", ".", "parseInt", "(", "s", ".", "substring", "(", "17", ",", "19", ")", ")", ";", "return", "new", "Age", "(", "years", ",", "months", ",", "days", ",", "hours", ",", "minutes", ",", "seconds", ")", ";", "}", "catch", "(", "NumberFormatException", "ignored", ")", "{", "return", "null", ";", "}", "}" ]
Parses an age object from the string format used by Panasonic cameras: <code>0031:07:15 00:00:00</code> @param s The String in format <code>0031:07:15 00:00:00</code>. @return The parsed Age object, or null if the value could not be parsed
[ "Parses", "an", "age", "object", "from", "the", "string", "format", "used", "by", "Panasonic", "cameras", ":", "<code", ">", "0031", ":", "07", ":", "15", "00", ":", "00", ":", "00<", "/", "code", ">" ]
train
https://github.com/drewnoakes/metadata-extractor/blob/a958e0b61b50e590731b3be1dca8df8e21ebd43c/Source/com/drew/metadata/Age.java#L50-L70
Polidea/RxAndroidBle
rxandroidble/src/main/java/com/polidea/rxandroidble2/helpers/ValueInterpreter.java
ValueInterpreter.unsignedToSigned
private static int unsignedToSigned(int unsigned, int size) { """ Convert an unsigned integer value to a two's-complement encoded signed value. """ if ((unsigned & (1 << size - 1)) != 0) { unsigned = -1 * ((1 << size - 1) - (unsigned & ((1 << size - 1) - 1))); } return unsigned; }
java
private static int unsignedToSigned(int unsigned, int size) { if ((unsigned & (1 << size - 1)) != 0) { unsigned = -1 * ((1 << size - 1) - (unsigned & ((1 << size - 1) - 1))); } return unsigned; }
[ "private", "static", "int", "unsignedToSigned", "(", "int", "unsigned", ",", "int", "size", ")", "{", "if", "(", "(", "unsigned", "&", "(", "1", "<<", "size", "-", "1", ")", ")", "!=", "0", ")", "{", "unsigned", "=", "-", "1", "*", "(", "(", "1", "<<", "size", "-", "1", ")", "-", "(", "unsigned", "&", "(", "(", "1", "<<", "size", "-", "1", ")", "-", "1", ")", ")", ")", ";", "}", "return", "unsigned", ";", "}" ]
Convert an unsigned integer value to a two's-complement encoded signed value.
[ "Convert", "an", "unsigned", "integer", "value", "to", "a", "two", "s", "-", "complement", "encoded", "signed", "value", "." ]
train
https://github.com/Polidea/RxAndroidBle/blob/c6e4a9753c834d710e255306bb290e9244cdbc10/rxandroidble/src/main/java/com/polidea/rxandroidble2/helpers/ValueInterpreter.java#L228-L233
micronaut-projects/micronaut-core
core/src/main/java/io/micronaut/core/util/StringUtils.java
StringUtils.prependUri
public static String prependUri(String baseUri, String uri) { """ Prepends a partial uri and normalizes / characters. For example, if the base uri is "/foo/" and the uri is "/bar/", the output will be "/foo/bar/". Similarly if the base uri is "/foo" and the uri is "bar", the output will be "/foo/bar" @param baseUri The uri to prepend. Eg. /foo @param uri The uri to combine with the baseUri. Eg. /bar @return A combined uri string """ if (!uri.startsWith("/")) { uri = "/" + uri; } if (uri.length() == 1 && uri.charAt(0) == '/') { uri = ""; } uri = baseUri + uri; return uri.replaceAll("[\\/]{2,}", "/"); }
java
public static String prependUri(String baseUri, String uri) { if (!uri.startsWith("/")) { uri = "/" + uri; } if (uri.length() == 1 && uri.charAt(0) == '/') { uri = ""; } uri = baseUri + uri; return uri.replaceAll("[\\/]{2,}", "/"); }
[ "public", "static", "String", "prependUri", "(", "String", "baseUri", ",", "String", "uri", ")", "{", "if", "(", "!", "uri", ".", "startsWith", "(", "\"/\"", ")", ")", "{", "uri", "=", "\"/\"", "+", "uri", ";", "}", "if", "(", "uri", ".", "length", "(", ")", "==", "1", "&&", "uri", ".", "charAt", "(", "0", ")", "==", "'", "'", ")", "{", "uri", "=", "\"\"", ";", "}", "uri", "=", "baseUri", "+", "uri", ";", "return", "uri", ".", "replaceAll", "(", "\"[\\\\/]{2,}\"", ",", "\"/\"", ")", ";", "}" ]
Prepends a partial uri and normalizes / characters. For example, if the base uri is "/foo/" and the uri is "/bar/", the output will be "/foo/bar/". Similarly if the base uri is "/foo" and the uri is "bar", the output will be "/foo/bar" @param baseUri The uri to prepend. Eg. /foo @param uri The uri to combine with the baseUri. Eg. /bar @return A combined uri string
[ "Prepends", "a", "partial", "uri", "and", "normalizes", "/", "characters", ".", "For", "example", "if", "the", "base", "uri", "is", "/", "foo", "/", "and", "the", "uri", "is", "/", "bar", "/", "the", "output", "will", "be", "/", "foo", "/", "bar", "/", ".", "Similarly", "if", "the", "base", "uri", "is", "/", "foo", "and", "the", "uri", "is", "bar", "the", "output", "will", "be", "/", "foo", "/", "bar" ]
train
https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/core/src/main/java/io/micronaut/core/util/StringUtils.java#L255-L264
aehrc/snorocket
snorocket-core/src/main/java/au/csiro/snorocket/core/axioms/GCI.java
GCI.rule6
boolean rule6(final IFactory factory, final Inclusion[] gcis) { """ B &#8849; &#8707;r.C' &rarr; {B &#8849; &#8707;r.A, A &#8849; C'} @param gcis @return """ boolean result = false; if (rhs instanceof Existential) { Existential existential = (Existential) rhs; final AbstractConcept cHat = existential.getConcept(); if (!(cHat instanceof Concept)) { result = true; Concept a = getA(factory, cHat); gcis[0] = new GCI(lhs, new Existential(existential.getRole(), a)); gcis[1] = new GCI(a, cHat); } } return result; }
java
boolean rule6(final IFactory factory, final Inclusion[] gcis) { boolean result = false; if (rhs instanceof Existential) { Existential existential = (Existential) rhs; final AbstractConcept cHat = existential.getConcept(); if (!(cHat instanceof Concept)) { result = true; Concept a = getA(factory, cHat); gcis[0] = new GCI(lhs, new Existential(existential.getRole(), a)); gcis[1] = new GCI(a, cHat); } } return result; }
[ "boolean", "rule6", "(", "final", "IFactory", "factory", ",", "final", "Inclusion", "[", "]", "gcis", ")", "{", "boolean", "result", "=", "false", ";", "if", "(", "rhs", "instanceof", "Existential", ")", "{", "Existential", "existential", "=", "(", "Existential", ")", "rhs", ";", "final", "AbstractConcept", "cHat", "=", "existential", ".", "getConcept", "(", ")", ";", "if", "(", "!", "(", "cHat", "instanceof", "Concept", ")", ")", "{", "result", "=", "true", ";", "Concept", "a", "=", "getA", "(", "factory", ",", "cHat", ")", ";", "gcis", "[", "0", "]", "=", "new", "GCI", "(", "lhs", ",", "new", "Existential", "(", "existential", ".", "getRole", "(", ")", ",", "a", ")", ")", ";", "gcis", "[", "1", "]", "=", "new", "GCI", "(", "a", ",", "cHat", ")", ";", "}", "}", "return", "result", ";", "}" ]
B &#8849; &#8707;r.C' &rarr; {B &#8849; &#8707;r.A, A &#8849; C'} @param gcis @return
[ "B", "&#8849", ";", "&#8707", ";", "r", ".", "C", "&rarr", ";", "{", "B", "&#8849", ";", "&#8707", ";", "r", ".", "A", "A", "&#8849", ";", "C", "}" ]
train
https://github.com/aehrc/snorocket/blob/e33c1e216f8a66d6502e3a14e80876811feedd8b/snorocket-core/src/main/java/au/csiro/snorocket/core/axioms/GCI.java#L247-L263
baratine/baratine
core/src/main/java/com/caucho/v5/inject/impl/InjectorImpl.java
InjectorImpl.addBinding
private <T> void addBinding(Class<T> type, BindingAmp<T> binding) { """ Adds a new injection producer to the discovered producer list. """ synchronized (_bindingSetMap) { BindingSet<T> set = (BindingSet) _bindingSetMap.get(type); if (set == null) { set = new BindingSet<>(type); _bindingSetMap.put(type, set); } set.addBinding(binding); } }
java
private <T> void addBinding(Class<T> type, BindingAmp<T> binding) { synchronized (_bindingSetMap) { BindingSet<T> set = (BindingSet) _bindingSetMap.get(type); if (set == null) { set = new BindingSet<>(type); _bindingSetMap.put(type, set); } set.addBinding(binding); } }
[ "private", "<", "T", ">", "void", "addBinding", "(", "Class", "<", "T", ">", "type", ",", "BindingAmp", "<", "T", ">", "binding", ")", "{", "synchronized", "(", "_bindingSetMap", ")", "{", "BindingSet", "<", "T", ">", "set", "=", "(", "BindingSet", ")", "_bindingSetMap", ".", "get", "(", "type", ")", ";", "if", "(", "set", "==", "null", ")", "{", "set", "=", "new", "BindingSet", "<>", "(", "type", ")", ";", "_bindingSetMap", ".", "put", "(", "type", ",", "set", ")", ";", "}", "set", ".", "addBinding", "(", "binding", ")", ";", "}", "}" ]
Adds a new injection producer to the discovered producer list.
[ "Adds", "a", "new", "injection", "producer", "to", "the", "discovered", "producer", "list", "." ]
train
https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/core/src/main/java/com/caucho/v5/inject/impl/InjectorImpl.java#L754-L766
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/LocalDateTime.java
LocalDateTime.ofEpochSecond
public static LocalDateTime ofEpochSecond(long epochSecond, int nanoOfSecond, ZoneOffset offset) { """ Obtains an instance of {@code LocalDateTime} using seconds from the epoch of 1970-01-01T00:00:00Z. <p> This allows the {@link ChronoField#INSTANT_SECONDS epoch-second} field to be converted to a local date-time. This is primarily intended for low-level conversions rather than general application usage. @param epochSecond the number of seconds from the epoch of 1970-01-01T00:00:00Z @param nanoOfSecond the nanosecond within the second, from 0 to 999,999,999 @param offset the zone offset, not null @return the local date-time, not null @throws DateTimeException if the result exceeds the supported range, or if the nano-of-second is invalid """ Objects.requireNonNull(offset, "offset"); NANO_OF_SECOND.checkValidValue(nanoOfSecond); long localSecond = epochSecond + offset.getTotalSeconds(); // overflow caught later long localEpochDay = Math.floorDiv(localSecond, SECONDS_PER_DAY); int secsOfDay = (int)Math.floorMod(localSecond, SECONDS_PER_DAY); LocalDate date = LocalDate.ofEpochDay(localEpochDay); LocalTime time = LocalTime.ofNanoOfDay(secsOfDay * NANOS_PER_SECOND + nanoOfSecond); return new LocalDateTime(date, time); }
java
public static LocalDateTime ofEpochSecond(long epochSecond, int nanoOfSecond, ZoneOffset offset) { Objects.requireNonNull(offset, "offset"); NANO_OF_SECOND.checkValidValue(nanoOfSecond); long localSecond = epochSecond + offset.getTotalSeconds(); // overflow caught later long localEpochDay = Math.floorDiv(localSecond, SECONDS_PER_DAY); int secsOfDay = (int)Math.floorMod(localSecond, SECONDS_PER_DAY); LocalDate date = LocalDate.ofEpochDay(localEpochDay); LocalTime time = LocalTime.ofNanoOfDay(secsOfDay * NANOS_PER_SECOND + nanoOfSecond); return new LocalDateTime(date, time); }
[ "public", "static", "LocalDateTime", "ofEpochSecond", "(", "long", "epochSecond", ",", "int", "nanoOfSecond", ",", "ZoneOffset", "offset", ")", "{", "Objects", ".", "requireNonNull", "(", "offset", ",", "\"offset\"", ")", ";", "NANO_OF_SECOND", ".", "checkValidValue", "(", "nanoOfSecond", ")", ";", "long", "localSecond", "=", "epochSecond", "+", "offset", ".", "getTotalSeconds", "(", ")", ";", "// overflow caught later", "long", "localEpochDay", "=", "Math", ".", "floorDiv", "(", "localSecond", ",", "SECONDS_PER_DAY", ")", ";", "int", "secsOfDay", "=", "(", "int", ")", "Math", ".", "floorMod", "(", "localSecond", ",", "SECONDS_PER_DAY", ")", ";", "LocalDate", "date", "=", "LocalDate", ".", "ofEpochDay", "(", "localEpochDay", ")", ";", "LocalTime", "time", "=", "LocalTime", ".", "ofNanoOfDay", "(", "secsOfDay", "*", "NANOS_PER_SECOND", "+", "nanoOfSecond", ")", ";", "return", "new", "LocalDateTime", "(", "date", ",", "time", ")", ";", "}" ]
Obtains an instance of {@code LocalDateTime} using seconds from the epoch of 1970-01-01T00:00:00Z. <p> This allows the {@link ChronoField#INSTANT_SECONDS epoch-second} field to be converted to a local date-time. This is primarily intended for low-level conversions rather than general application usage. @param epochSecond the number of seconds from the epoch of 1970-01-01T00:00:00Z @param nanoOfSecond the nanosecond within the second, from 0 to 999,999,999 @param offset the zone offset, not null @return the local date-time, not null @throws DateTimeException if the result exceeds the supported range, or if the nano-of-second is invalid
[ "Obtains", "an", "instance", "of", "{", "@code", "LocalDateTime", "}", "using", "seconds", "from", "the", "epoch", "of", "1970", "-", "01", "-", "01T00", ":", "00", ":", "00Z", ".", "<p", ">", "This", "allows", "the", "{", "@link", "ChronoField#INSTANT_SECONDS", "epoch", "-", "second", "}", "field", "to", "be", "converted", "to", "a", "local", "date", "-", "time", ".", "This", "is", "primarily", "intended", "for", "low", "-", "level", "conversions", "rather", "than", "general", "application", "usage", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/LocalDateTime.java#L410-L419
mapfish/mapfish-print
core/src/main/java/org/mapfish/print/wrapper/PAbstractObject.java
PAbstractObject.optFloat
@Override public final Float optFloat(final String key, final Float defaultValue) { """ Get a property as a float or Default value. @param key the property name @param defaultValue default value """ Float result = optFloat(key); return result == null ? defaultValue : result; }
java
@Override public final Float optFloat(final String key, final Float defaultValue) { Float result = optFloat(key); return result == null ? defaultValue : result; }
[ "@", "Override", "public", "final", "Float", "optFloat", "(", "final", "String", "key", ",", "final", "Float", "defaultValue", ")", "{", "Float", "result", "=", "optFloat", "(", "key", ")", ";", "return", "result", "==", "null", "?", "defaultValue", ":", "result", ";", "}" ]
Get a property as a float or Default value. @param key the property name @param defaultValue default value
[ "Get", "a", "property", "as", "a", "float", "or", "Default", "value", "." ]
train
https://github.com/mapfish/mapfish-print/blob/25a452cb39f592bd8a53b20db1037703898e1e22/core/src/main/java/org/mapfish/print/wrapper/PAbstractObject.java#L143-L147
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/EasterHoliday.java
EasterRule.computeInYear
private Date computeInYear(Date date, GregorianCalendar cal) { """ Compute the month and date on which this holiday falls in the year containing the date "date". First figure out which date Easter lands on in this year, and then add the offset for this holiday to get the right date. <p> The algorithm here is taken from the <a href="http://www.faqs.org/faqs/calendars/faq/">Calendar FAQ</a>. """ if (cal == null) cal = calendar; synchronized(cal) { cal.setTime(date); int year = cal.get(Calendar.YEAR); int g = year % 19; // "Golden Number" of year - 1 int i = 0; // # of days from 3/21 to the Paschal full moon int j = 0; // Weekday (0-based) of Paschal full moon if (cal.getTime().after( cal.getGregorianChange())) { // We're past the Gregorian switchover, so use the Gregorian rules. int c = year / 100; int h = (c - c/4 - (8*c+13)/25 + 19*g + 15) % 30; i = h - (h/28)*(1 - (h/28)*(29/(h+1))*((21-g)/11)); j = (year + year/4 + i + 2 - c + c/4) % 7; } else { // Use the old Julian rules. i = (19*g + 15) % 30; j = (year + year/4 + i) % 7; } int l = i - j; int m = 3 + (l+40)/44; // 1-based month in which Easter falls int d = l + 28 - 31*(m/4); // Date of Easter within that month cal.clear(); cal.set(Calendar.ERA, GregorianCalendar.AD); cal.set(Calendar.YEAR, year); cal.set(Calendar.MONTH, m-1); // 0-based cal.set(Calendar.DATE, d); cal.getTime(); // JDK 1.1.2 bug workaround cal.add(Calendar.DATE, daysAfterEaster); return cal.getTime(); } }
java
private Date computeInYear(Date date, GregorianCalendar cal) { if (cal == null) cal = calendar; synchronized(cal) { cal.setTime(date); int year = cal.get(Calendar.YEAR); int g = year % 19; // "Golden Number" of year - 1 int i = 0; // # of days from 3/21 to the Paschal full moon int j = 0; // Weekday (0-based) of Paschal full moon if (cal.getTime().after( cal.getGregorianChange())) { // We're past the Gregorian switchover, so use the Gregorian rules. int c = year / 100; int h = (c - c/4 - (8*c+13)/25 + 19*g + 15) % 30; i = h - (h/28)*(1 - (h/28)*(29/(h+1))*((21-g)/11)); j = (year + year/4 + i + 2 - c + c/4) % 7; } else { // Use the old Julian rules. i = (19*g + 15) % 30; j = (year + year/4 + i) % 7; } int l = i - j; int m = 3 + (l+40)/44; // 1-based month in which Easter falls int d = l + 28 - 31*(m/4); // Date of Easter within that month cal.clear(); cal.set(Calendar.ERA, GregorianCalendar.AD); cal.set(Calendar.YEAR, year); cal.set(Calendar.MONTH, m-1); // 0-based cal.set(Calendar.DATE, d); cal.getTime(); // JDK 1.1.2 bug workaround cal.add(Calendar.DATE, daysAfterEaster); return cal.getTime(); } }
[ "private", "Date", "computeInYear", "(", "Date", "date", ",", "GregorianCalendar", "cal", ")", "{", "if", "(", "cal", "==", "null", ")", "cal", "=", "calendar", ";", "synchronized", "(", "cal", ")", "{", "cal", ".", "setTime", "(", "date", ")", ";", "int", "year", "=", "cal", ".", "get", "(", "Calendar", ".", "YEAR", ")", ";", "int", "g", "=", "year", "%", "19", ";", "// \"Golden Number\" of year - 1", "int", "i", "=", "0", ";", "// # of days from 3/21 to the Paschal full moon", "int", "j", "=", "0", ";", "// Weekday (0-based) of Paschal full moon", "if", "(", "cal", ".", "getTime", "(", ")", ".", "after", "(", "cal", ".", "getGregorianChange", "(", ")", ")", ")", "{", "// We're past the Gregorian switchover, so use the Gregorian rules.", "int", "c", "=", "year", "/", "100", ";", "int", "h", "=", "(", "c", "-", "c", "/", "4", "-", "(", "8", "*", "c", "+", "13", ")", "/", "25", "+", "19", "*", "g", "+", "15", ")", "%", "30", ";", "i", "=", "h", "-", "(", "h", "/", "28", ")", "*", "(", "1", "-", "(", "h", "/", "28", ")", "*", "(", "29", "/", "(", "h", "+", "1", ")", ")", "*", "(", "(", "21", "-", "g", ")", "/", "11", ")", ")", ";", "j", "=", "(", "year", "+", "year", "/", "4", "+", "i", "+", "2", "-", "c", "+", "c", "/", "4", ")", "%", "7", ";", "}", "else", "{", "// Use the old Julian rules.", "i", "=", "(", "19", "*", "g", "+", "15", ")", "%", "30", ";", "j", "=", "(", "year", "+", "year", "/", "4", "+", "i", ")", "%", "7", ";", "}", "int", "l", "=", "i", "-", "j", ";", "int", "m", "=", "3", "+", "(", "l", "+", "40", ")", "/", "44", ";", "// 1-based month in which Easter falls", "int", "d", "=", "l", "+", "28", "-", "31", "*", "(", "m", "/", "4", ")", ";", "// Date of Easter within that month", "cal", ".", "clear", "(", ")", ";", "cal", ".", "set", "(", "Calendar", ".", "ERA", ",", "GregorianCalendar", ".", "AD", ")", ";", "cal", ".", "set", "(", "Calendar", ".", "YEAR", ",", "year", ")", ";", "cal", ".", "set", "(", "Calendar", ".", "MONTH", ",", "m", "-", "1", ")", ";", "// 0-based", "cal", ".", "set", "(", "Calendar", ".", "DATE", ",", "d", ")", ";", "cal", ".", "getTime", "(", ")", ";", "// JDK 1.1.2 bug workaround", "cal", ".", "add", "(", "Calendar", ".", "DATE", ",", "daysAfterEaster", ")", ";", "return", "cal", ".", "getTime", "(", ")", ";", "}", "}" ]
Compute the month and date on which this holiday falls in the year containing the date "date". First figure out which date Easter lands on in this year, and then add the offset for this holiday to get the right date. <p> The algorithm here is taken from the <a href="http://www.faqs.org/faqs/calendars/faq/">Calendar FAQ</a>.
[ "Compute", "the", "month", "and", "date", "on", "which", "this", "holiday", "falls", "in", "the", "year", "containing", "the", "date", "date", ".", "First", "figure", "out", "which", "date", "Easter", "lands", "on", "in", "this", "year", "and", "then", "add", "the", "offset", "for", "this", "holiday", "to", "get", "the", "right", "date", ".", "<p", ">", "The", "algorithm", "here", "is", "taken", "from", "the", "<a", "href", "=", "http", ":", "//", "www", ".", "faqs", ".", "org", "/", "faqs", "/", "calendars", "/", "faq", "/", ">", "Calendar", "FAQ<", "/", "a", ">", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/EasterHoliday.java#L235-L275
amplexus/java-flac-encoder
src/main/java/net/sourceforge/javaflacencoder/FLAC_ConsoleFileEncoder.java
FLAC_ConsoleFileEncoder.getInt
int getInt(String[] args, int index) { """ Utility function to parse a positive integer argument out of a String array at the given index. @param args String array containing element to find. @param index Index of array element to parse integer from. @return Integer parsed, or -1 if error. """ int result = -1; if(index >= 0 && index < args.length) { try { result = Integer.parseInt(args[index]); }catch(NumberFormatException e) { result = -1; } } return result; }
java
int getInt(String[] args, int index) { int result = -1; if(index >= 0 && index < args.length) { try { result = Integer.parseInt(args[index]); }catch(NumberFormatException e) { result = -1; } } return result; }
[ "int", "getInt", "(", "String", "[", "]", "args", ",", "int", "index", ")", "{", "int", "result", "=", "-", "1", ";", "if", "(", "index", ">=", "0", "&&", "index", "<", "args", ".", "length", ")", "{", "try", "{", "result", "=", "Integer", ".", "parseInt", "(", "args", "[", "index", "]", ")", ";", "}", "catch", "(", "NumberFormatException", "e", ")", "{", "result", "=", "-", "1", ";", "}", "}", "return", "result", ";", "}" ]
Utility function to parse a positive integer argument out of a String array at the given index. @param args String array containing element to find. @param index Index of array element to parse integer from. @return Integer parsed, or -1 if error.
[ "Utility", "function", "to", "parse", "a", "positive", "integer", "argument", "out", "of", "a", "String", "array", "at", "the", "given", "index", "." ]
train
https://github.com/amplexus/java-flac-encoder/blob/3d536b877dee2a3fd4ab2e0d9569e292cae93bc9/src/main/java/net/sourceforge/javaflacencoder/FLAC_ConsoleFileEncoder.java#L328-L338
tango-controls/JTango
dao/src/main/java/fr/esrf/TangoDs/Logging.java
Logging.init
public static Logging init(String ds_name, int trace_level, Database db) { """ Create and get the singleton object reference. <p> This method returns a reference to the object of the Logging class. If the class singleton object has not been created, it will be instanciated @param ds_name The device server executable name @param db The database object @return The Logging object reference """ if (_instance == null) { _instance = new Logging(ds_name, trace_level, db); } return _instance; }
java
public static Logging init(String ds_name, int trace_level, Database db) { if (_instance == null) { _instance = new Logging(ds_name, trace_level, db); } return _instance; }
[ "public", "static", "Logging", "init", "(", "String", "ds_name", ",", "int", "trace_level", ",", "Database", "db", ")", "{", "if", "(", "_instance", "==", "null", ")", "{", "_instance", "=", "new", "Logging", "(", "ds_name", ",", "trace_level", ",", "db", ")", ";", "}", "return", "_instance", ";", "}" ]
Create and get the singleton object reference. <p> This method returns a reference to the object of the Logging class. If the class singleton object has not been created, it will be instanciated @param ds_name The device server executable name @param db The database object @return The Logging object reference
[ "Create", "and", "get", "the", "singleton", "object", "reference", ".", "<p", ">", "This", "method", "returns", "a", "reference", "to", "the", "object", "of", "the", "Logging", "class", ".", "If", "the", "class", "singleton", "object", "has", "not", "been", "created", "it", "will", "be", "instanciated" ]
train
https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/dao/src/main/java/fr/esrf/TangoDs/Logging.java#L236-L241
Deep-Symmetry/beat-link
src/main/java/org/deepsymmetry/beatlink/data/MetadataFinder.java
MetadataFinder.getFullTrackList
List<Message> getFullTrackList(final CdjStatus.TrackSourceSlot slot, final Client client, final int sortOrder) throws IOException, InterruptedException, TimeoutException { """ Request the list of all tracks in the specified slot, given a dbserver connection to a player that has already been set up. @param slot identifies the media slot we are querying @param client the dbserver client that is communicating with the appropriate player @return the retrieved track list entry items @throws IOException if there is a communication problem @throws InterruptedException if the thread is interrupted while trying to lock the client for menu operations @throws TimeoutException if we are unable to lock the client for menu operations """ // Send the metadata menu request if (client.tryLockingForMenuOperations(MENU_TIMEOUT, TimeUnit.SECONDS)) { try { Message response = client.menuRequest(Message.KnownType.TRACK_MENU_REQ, Message.MenuIdentifier.MAIN_MENU, slot, new NumberField(sortOrder)); final long count = response.getMenuResultsCount(); if (count == Message.NO_MENU_RESULTS_AVAILABLE || count == 0) { return Collections.emptyList(); } // Gather all the metadata menu items return client.renderMenuItems(Message.MenuIdentifier.MAIN_MENU, slot, CdjStatus.TrackType.REKORDBOX, response); } finally { client.unlockForMenuOperations(); } } else { throw new TimeoutException("Unable to lock the player for menu operations"); } }
java
List<Message> getFullTrackList(final CdjStatus.TrackSourceSlot slot, final Client client, final int sortOrder) throws IOException, InterruptedException, TimeoutException { // Send the metadata menu request if (client.tryLockingForMenuOperations(MENU_TIMEOUT, TimeUnit.SECONDS)) { try { Message response = client.menuRequest(Message.KnownType.TRACK_MENU_REQ, Message.MenuIdentifier.MAIN_MENU, slot, new NumberField(sortOrder)); final long count = response.getMenuResultsCount(); if (count == Message.NO_MENU_RESULTS_AVAILABLE || count == 0) { return Collections.emptyList(); } // Gather all the metadata menu items return client.renderMenuItems(Message.MenuIdentifier.MAIN_MENU, slot, CdjStatus.TrackType.REKORDBOX, response); } finally { client.unlockForMenuOperations(); } } else { throw new TimeoutException("Unable to lock the player for menu operations"); } }
[ "List", "<", "Message", ">", "getFullTrackList", "(", "final", "CdjStatus", ".", "TrackSourceSlot", "slot", ",", "final", "Client", "client", ",", "final", "int", "sortOrder", ")", "throws", "IOException", ",", "InterruptedException", ",", "TimeoutException", "{", "// Send the metadata menu request", "if", "(", "client", ".", "tryLockingForMenuOperations", "(", "MENU_TIMEOUT", ",", "TimeUnit", ".", "SECONDS", ")", ")", "{", "try", "{", "Message", "response", "=", "client", ".", "menuRequest", "(", "Message", ".", "KnownType", ".", "TRACK_MENU_REQ", ",", "Message", ".", "MenuIdentifier", ".", "MAIN_MENU", ",", "slot", ",", "new", "NumberField", "(", "sortOrder", ")", ")", ";", "final", "long", "count", "=", "response", ".", "getMenuResultsCount", "(", ")", ";", "if", "(", "count", "==", "Message", ".", "NO_MENU_RESULTS_AVAILABLE", "||", "count", "==", "0", ")", "{", "return", "Collections", ".", "emptyList", "(", ")", ";", "}", "// Gather all the metadata menu items", "return", "client", ".", "renderMenuItems", "(", "Message", ".", "MenuIdentifier", ".", "MAIN_MENU", ",", "slot", ",", "CdjStatus", ".", "TrackType", ".", "REKORDBOX", ",", "response", ")", ";", "}", "finally", "{", "client", ".", "unlockForMenuOperations", "(", ")", ";", "}", "}", "else", "{", "throw", "new", "TimeoutException", "(", "\"Unable to lock the player for menu operations\"", ")", ";", "}", "}" ]
Request the list of all tracks in the specified slot, given a dbserver connection to a player that has already been set up. @param slot identifies the media slot we are querying @param client the dbserver client that is communicating with the appropriate player @return the retrieved track list entry items @throws IOException if there is a communication problem @throws InterruptedException if the thread is interrupted while trying to lock the client for menu operations @throws TimeoutException if we are unable to lock the client for menu operations
[ "Request", "the", "list", "of", "all", "tracks", "in", "the", "specified", "slot", "given", "a", "dbserver", "connection", "to", "a", "player", "that", "has", "already", "been", "set", "up", "." ]
train
https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/MetadataFinder.java#L212-L233
lookfirst/WePay-Java-SDK
src/main/java/com/lookfirst/wepay/WePayApi.java
WePayApi.execute
public <T> T execute(String token, WePayRequest<T> req) throws IOException, WePayException { """ Make API calls against authenticated user. Turn up logging to trace level to see the request / response. """ String uri = currentUrl + req.getEndpoint(); String postJson = MAPPER.writeValueAsString(req); if (log.isTraceEnabled()) { log.trace("request to {}: {}", uri, postJson); } // Use the data provider to get an input stream response. This is faked out in tests. InputStream is = dataProvider.getData(uri, postJson, token); JsonNode resp; if (log.isTraceEnabled()) { String results = IOUtils.toString(is); log.trace("response: " + results); resp = MAPPER.readTree(results); } else { resp = MAPPER.readTree(is); } // if there is an error in the response from wepay, it'll get thrown in this call. this.checkForError(resp); // This is a little bit of black magic with jackson. We know that any request passed extends // the abstract WePayRequest and de-genericizes it. This means the concrete class has full // generic type information, and we can use this to determine what type to deserialize. The // trickiest case is WePayAccountFindRequest, whose response type is List<AccountWithUri>. ParameterizedType paramType = (ParameterizedType)req.getClass().getGenericSuperclass(); JavaType type = MAPPER.constructType(paramType.getActualTypeArguments()[0]); return MAPPER.readValue(MAPPER.treeAsTokens(resp), type); }
java
public <T> T execute(String token, WePayRequest<T> req) throws IOException, WePayException { String uri = currentUrl + req.getEndpoint(); String postJson = MAPPER.writeValueAsString(req); if (log.isTraceEnabled()) { log.trace("request to {}: {}", uri, postJson); } // Use the data provider to get an input stream response. This is faked out in tests. InputStream is = dataProvider.getData(uri, postJson, token); JsonNode resp; if (log.isTraceEnabled()) { String results = IOUtils.toString(is); log.trace("response: " + results); resp = MAPPER.readTree(results); } else { resp = MAPPER.readTree(is); } // if there is an error in the response from wepay, it'll get thrown in this call. this.checkForError(resp); // This is a little bit of black magic with jackson. We know that any request passed extends // the abstract WePayRequest and de-genericizes it. This means the concrete class has full // generic type information, and we can use this to determine what type to deserialize. The // trickiest case is WePayAccountFindRequest, whose response type is List<AccountWithUri>. ParameterizedType paramType = (ParameterizedType)req.getClass().getGenericSuperclass(); JavaType type = MAPPER.constructType(paramType.getActualTypeArguments()[0]); return MAPPER.readValue(MAPPER.treeAsTokens(resp), type); }
[ "public", "<", "T", ">", "T", "execute", "(", "String", "token", ",", "WePayRequest", "<", "T", ">", "req", ")", "throws", "IOException", ",", "WePayException", "{", "String", "uri", "=", "currentUrl", "+", "req", ".", "getEndpoint", "(", ")", ";", "String", "postJson", "=", "MAPPER", ".", "writeValueAsString", "(", "req", ")", ";", "if", "(", "log", ".", "isTraceEnabled", "(", ")", ")", "{", "log", ".", "trace", "(", "\"request to {}: {}\"", ",", "uri", ",", "postJson", ")", ";", "}", "// Use the data provider to get an input stream response. This is faked out in tests.", "InputStream", "is", "=", "dataProvider", ".", "getData", "(", "uri", ",", "postJson", ",", "token", ")", ";", "JsonNode", "resp", ";", "if", "(", "log", ".", "isTraceEnabled", "(", ")", ")", "{", "String", "results", "=", "IOUtils", ".", "toString", "(", "is", ")", ";", "log", ".", "trace", "(", "\"response: \"", "+", "results", ")", ";", "resp", "=", "MAPPER", ".", "readTree", "(", "results", ")", ";", "}", "else", "{", "resp", "=", "MAPPER", ".", "readTree", "(", "is", ")", ";", "}", "// if there is an error in the response from wepay, it'll get thrown in this call.", "this", ".", "checkForError", "(", "resp", ")", ";", "// This is a little bit of black magic with jackson. We know that any request passed extends", "// the abstract WePayRequest and de-genericizes it. This means the concrete class has full", "// generic type information, and we can use this to determine what type to deserialize. The", "// trickiest case is WePayAccountFindRequest, whose response type is List<AccountWithUri>.", "ParameterizedType", "paramType", "=", "(", "ParameterizedType", ")", "req", ".", "getClass", "(", ")", ".", "getGenericSuperclass", "(", ")", ";", "JavaType", "type", "=", "MAPPER", ".", "constructType", "(", "paramType", ".", "getActualTypeArguments", "(", ")", "[", "0", "]", ")", ";", "return", "MAPPER", ".", "readValue", "(", "MAPPER", ".", "treeAsTokens", "(", "resp", ")", ",", "type", ")", ";", "}" ]
Make API calls against authenticated user. Turn up logging to trace level to see the request / response.
[ "Make", "API", "calls", "against", "authenticated", "user", ".", "Turn", "up", "logging", "to", "trace", "level", "to", "see", "the", "request", "/", "response", "." ]
train
https://github.com/lookfirst/WePay-Java-SDK/blob/3c0a47d6fa051d531c8fdbbfd54a0ef2891aa8f0/src/main/java/com/lookfirst/wepay/WePayApi.java#L214-L247
Azure/azure-sdk-for-java
resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/ResourcesInner.java
ResourcesInner.moveResources
public void moveResources(String sourceResourceGroupName, ResourcesMoveInfo parameters) { """ Moves resources from one resource group to another resource group. The resources to move must be in the same source resource group. The target resource group may be in a different subscription. When moving resources, both the source group and the target group are locked for the duration of the operation. Write and delete operations are blocked on the groups until the move completes. @param sourceResourceGroupName The name of the resource group containing the resources to move. @param parameters Parameters for moving resources. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent """ moveResourcesWithServiceResponseAsync(sourceResourceGroupName, parameters).toBlocking().last().body(); }
java
public void moveResources(String sourceResourceGroupName, ResourcesMoveInfo parameters) { moveResourcesWithServiceResponseAsync(sourceResourceGroupName, parameters).toBlocking().last().body(); }
[ "public", "void", "moveResources", "(", "String", "sourceResourceGroupName", ",", "ResourcesMoveInfo", "parameters", ")", "{", "moveResourcesWithServiceResponseAsync", "(", "sourceResourceGroupName", ",", "parameters", ")", ".", "toBlocking", "(", ")", ".", "last", "(", ")", ".", "body", "(", ")", ";", "}" ]
Moves resources from one resource group to another resource group. The resources to move must be in the same source resource group. The target resource group may be in a different subscription. When moving resources, both the source group and the target group are locked for the duration of the operation. Write and delete operations are blocked on the groups until the move completes. @param sourceResourceGroupName The name of the resource group containing the resources to move. @param parameters Parameters for moving resources. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
[ "Moves", "resources", "from", "one", "resource", "group", "to", "another", "resource", "group", ".", "The", "resources", "to", "move", "must", "be", "in", "the", "same", "source", "resource", "group", ".", "The", "target", "resource", "group", "may", "be", "in", "a", "different", "subscription", ".", "When", "moving", "resources", "both", "the", "source", "group", "and", "the", "target", "group", "are", "locked", "for", "the", "duration", "of", "the", "operation", ".", "Write", "and", "delete", "operations", "are", "blocked", "on", "the", "groups", "until", "the", "move", "completes", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/ResourcesInner.java#L418-L420
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/SourceStreamManager.java
SourceStreamManager.restoreMessage
public void restoreMessage(SIMPMessage msgItem, boolean commit) throws SIResourceException { """ Put a message back into the appropriate source stream. This will create a stream if one does not exist but will not change any fields in the message @param msgItem The message to be restored @param commit Boolean indicating whether message to be restored is in commit state """ if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "restoreMessage", new Object[] { msgItem }); int priority = msgItem.getPriority(); Reliability reliability = msgItem.getReliability(); SIBUuid12 streamID = msgItem.getGuaranteedStreamUuid(); StreamSet streamSet = getStreamSet(streamID); SourceStream sourceStream = null; synchronized(streamSet) { sourceStream = (SourceStream) streamSet.getStream(priority, reliability); if(sourceStream == null && reliability.compareTo(Reliability.BEST_EFFORT_NONPERSISTENT) > 0) { sourceStream = createStream(streamSet, priority, reliability, streamSet.getPersistentData(priority, reliability), true ); } } // NOTE: sourceStream should only be null for express qos if(sourceStream != null) { if( !commit ) sourceStream.restoreUncommitted(msgItem); else sourceStream.restoreValue(msgItem); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "restoreMessage"); }
java
public void restoreMessage(SIMPMessage msgItem, boolean commit) throws SIResourceException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "restoreMessage", new Object[] { msgItem }); int priority = msgItem.getPriority(); Reliability reliability = msgItem.getReliability(); SIBUuid12 streamID = msgItem.getGuaranteedStreamUuid(); StreamSet streamSet = getStreamSet(streamID); SourceStream sourceStream = null; synchronized(streamSet) { sourceStream = (SourceStream) streamSet.getStream(priority, reliability); if(sourceStream == null && reliability.compareTo(Reliability.BEST_EFFORT_NONPERSISTENT) > 0) { sourceStream = createStream(streamSet, priority, reliability, streamSet.getPersistentData(priority, reliability), true ); } } // NOTE: sourceStream should only be null for express qos if(sourceStream != null) { if( !commit ) sourceStream.restoreUncommitted(msgItem); else sourceStream.restoreValue(msgItem); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "restoreMessage"); }
[ "public", "void", "restoreMessage", "(", "SIMPMessage", "msgItem", ",", "boolean", "commit", ")", "throws", "SIResourceException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"restoreMessage\"", ",", "new", "Object", "[", "]", "{", "msgItem", "}", ")", ";", "int", "priority", "=", "msgItem", ".", "getPriority", "(", ")", ";", "Reliability", "reliability", "=", "msgItem", ".", "getReliability", "(", ")", ";", "SIBUuid12", "streamID", "=", "msgItem", ".", "getGuaranteedStreamUuid", "(", ")", ";", "StreamSet", "streamSet", "=", "getStreamSet", "(", "streamID", ")", ";", "SourceStream", "sourceStream", "=", "null", ";", "synchronized", "(", "streamSet", ")", "{", "sourceStream", "=", "(", "SourceStream", ")", "streamSet", ".", "getStream", "(", "priority", ",", "reliability", ")", ";", "if", "(", "sourceStream", "==", "null", "&&", "reliability", ".", "compareTo", "(", "Reliability", ".", "BEST_EFFORT_NONPERSISTENT", ")", ">", "0", ")", "{", "sourceStream", "=", "createStream", "(", "streamSet", ",", "priority", ",", "reliability", ",", "streamSet", ".", "getPersistentData", "(", "priority", ",", "reliability", ")", ",", "true", ")", ";", "}", "}", "// NOTE: sourceStream should only be null for express qos", "if", "(", "sourceStream", "!=", "null", ")", "{", "if", "(", "!", "commit", ")", "sourceStream", ".", "restoreUncommitted", "(", "msgItem", ")", ";", "else", "sourceStream", ".", "restoreValue", "(", "msgItem", ")", ";", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"restoreMessage\"", ")", ";", "}" ]
Put a message back into the appropriate source stream. This will create a stream if one does not exist but will not change any fields in the message @param msgItem The message to be restored @param commit Boolean indicating whether message to be restored is in commit state
[ "Put", "a", "message", "back", "into", "the", "appropriate", "source", "stream", ".", "This", "will", "create", "a", "stream", "if", "one", "does", "not", "exist", "but", "will", "not", "change", "any", "fields", "in", "the", "message" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/SourceStreamManager.java#L431-L467
eyp/serfj
src/main/java/net/sf/serfj/ServletHelper.java
ServletHelper.inheritedStrategy
private Object inheritedStrategy(UrlInfo urlInfo, ResponseHelper responseHelper) throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException { """ Invokes URL's action using INHERIT strategy. It means that controller inherits from {@link RestController}, so the framework will inject {@link ResponseHelper} to controller by RestAction.setResposeHelper method. Furthermore, controller's actions signatures don't have arguments. @param urlInfo Information of REST's URL. @param responseHelper ResponseHelper object to inject into the controller. @throws ClassNotFoundException if controller's class doesn't exist. @throws NoSuchMethodException if doesn't exist a method for action required in the URL. @throws IllegalArgumentException if controller's method for action has arguments. @throws IllegalAccessException if the controller or its method are not accessibles- @throws InvocationTargetException if the controller's method raise an exception. @throws InstantiationException if it isn't possible to instantiate the controller. """ Class<?> clazz = Class.forName(urlInfo.getController()); Method setResponseHelper = clazz.getMethod("setResponseHelper", new Class<?>[] { ResponseHelper.class }); LOGGER.debug("Instantiating controller {}", clazz.getCanonicalName()); Object controllerInstance = clazz.newInstance(); LOGGER.debug("Calling {}.setResponseHelper(ResponseHelper)", clazz.getCanonicalName()); setResponseHelper.invoke(controllerInstance, responseHelper); Method action = clazz.getMethod(urlInfo.getAction(), new Class[] {}); LOGGER.debug("Calling {}.{}()", urlInfo.getController(), urlInfo.getAction()); responseHelper.notRenderPage(action); return this.invokeAction(controllerInstance, action, urlInfo); }
java
private Object inheritedStrategy(UrlInfo urlInfo, ResponseHelper responseHelper) throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException { Class<?> clazz = Class.forName(urlInfo.getController()); Method setResponseHelper = clazz.getMethod("setResponseHelper", new Class<?>[] { ResponseHelper.class }); LOGGER.debug("Instantiating controller {}", clazz.getCanonicalName()); Object controllerInstance = clazz.newInstance(); LOGGER.debug("Calling {}.setResponseHelper(ResponseHelper)", clazz.getCanonicalName()); setResponseHelper.invoke(controllerInstance, responseHelper); Method action = clazz.getMethod(urlInfo.getAction(), new Class[] {}); LOGGER.debug("Calling {}.{}()", urlInfo.getController(), urlInfo.getAction()); responseHelper.notRenderPage(action); return this.invokeAction(controllerInstance, action, urlInfo); }
[ "private", "Object", "inheritedStrategy", "(", "UrlInfo", "urlInfo", ",", "ResponseHelper", "responseHelper", ")", "throws", "ClassNotFoundException", ",", "NoSuchMethodException", ",", "IllegalAccessException", ",", "InvocationTargetException", ",", "InstantiationException", "{", "Class", "<", "?", ">", "clazz", "=", "Class", ".", "forName", "(", "urlInfo", ".", "getController", "(", ")", ")", ";", "Method", "setResponseHelper", "=", "clazz", ".", "getMethod", "(", "\"setResponseHelper\"", ",", "new", "Class", "<", "?", ">", "[", "]", "{", "ResponseHelper", ".", "class", "}", ")", ";", "LOGGER", ".", "debug", "(", "\"Instantiating controller {}\"", ",", "clazz", ".", "getCanonicalName", "(", ")", ")", ";", "Object", "controllerInstance", "=", "clazz", ".", "newInstance", "(", ")", ";", "LOGGER", ".", "debug", "(", "\"Calling {}.setResponseHelper(ResponseHelper)\"", ",", "clazz", ".", "getCanonicalName", "(", ")", ")", ";", "setResponseHelper", ".", "invoke", "(", "controllerInstance", ",", "responseHelper", ")", ";", "Method", "action", "=", "clazz", ".", "getMethod", "(", "urlInfo", ".", "getAction", "(", ")", ",", "new", "Class", "[", "]", "{", "}", ")", ";", "LOGGER", ".", "debug", "(", "\"Calling {}.{}()\"", ",", "urlInfo", ".", "getController", "(", ")", ",", "urlInfo", ".", "getAction", "(", ")", ")", ";", "responseHelper", ".", "notRenderPage", "(", "action", ")", ";", "return", "this", ".", "invokeAction", "(", "controllerInstance", ",", "action", ",", "urlInfo", ")", ";", "}" ]
Invokes URL's action using INHERIT strategy. It means that controller inherits from {@link RestController}, so the framework will inject {@link ResponseHelper} to controller by RestAction.setResposeHelper method. Furthermore, controller's actions signatures don't have arguments. @param urlInfo Information of REST's URL. @param responseHelper ResponseHelper object to inject into the controller. @throws ClassNotFoundException if controller's class doesn't exist. @throws NoSuchMethodException if doesn't exist a method for action required in the URL. @throws IllegalArgumentException if controller's method for action has arguments. @throws IllegalAccessException if the controller or its method are not accessibles- @throws InvocationTargetException if the controller's method raise an exception. @throws InstantiationException if it isn't possible to instantiate the controller.
[ "Invokes", "URL", "s", "action", "using", "INHERIT", "strategy", ".", "It", "means", "that", "controller", "inherits", "from", "{", "@link", "RestController", "}", "so", "the", "framework", "will", "inject", "{", "@link", "ResponseHelper", "}", "to", "controller", "by", "RestAction", ".", "setResposeHelper", "method", ".", "Furthermore", "controller", "s", "actions", "signatures", "don", "t", "have", "arguments", "." ]
train
https://github.com/eyp/serfj/blob/e617592af6f24e59ea58443f2785c44aa2312189/src/main/java/net/sf/serfj/ServletHelper.java#L170-L182
undertow-io/undertow
core/src/main/java/io/undertow/server/handlers/proxy/ProxyHandler.java
ProxyHandler.addRequestHeader
@Deprecated public ProxyHandler addRequestHeader(final HttpString header, final String attribute, final ClassLoader classLoader) { """ Adds a request header to the outgoing request. If the header resolves to null or an empty string it will not be added, however any existing header with the same name will be removed. <p> The attribute value will be parsed, and the resulting exchange attribute will be used to create the actual header value. @param header The header name @param attribute The header value attribute. @return this """ requestHeaders.put(header, ExchangeAttributes.parser(classLoader).parse(attribute)); return this; }
java
@Deprecated public ProxyHandler addRequestHeader(final HttpString header, final String attribute, final ClassLoader classLoader) { requestHeaders.put(header, ExchangeAttributes.parser(classLoader).parse(attribute)); return this; }
[ "@", "Deprecated", "public", "ProxyHandler", "addRequestHeader", "(", "final", "HttpString", "header", ",", "final", "String", "attribute", ",", "final", "ClassLoader", "classLoader", ")", "{", "requestHeaders", ".", "put", "(", "header", ",", "ExchangeAttributes", ".", "parser", "(", "classLoader", ")", ".", "parse", "(", "attribute", ")", ")", ";", "return", "this", ";", "}" ]
Adds a request header to the outgoing request. If the header resolves to null or an empty string it will not be added, however any existing header with the same name will be removed. <p> The attribute value will be parsed, and the resulting exchange attribute will be used to create the actual header value. @param header The header name @param attribute The header value attribute. @return this
[ "Adds", "a", "request", "header", "to", "the", "outgoing", "request", ".", "If", "the", "header", "resolves", "to", "null", "or", "an", "empty", "string", "it", "will", "not", "be", "added", "however", "any", "existing", "header", "with", "the", "same", "name", "will", "be", "removed", ".", "<p", ">", "The", "attribute", "value", "will", "be", "parsed", "and", "the", "resulting", "exchange", "attribute", "will", "be", "used", "to", "create", "the", "actual", "header", "value", "." ]
train
https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/server/handlers/proxy/ProxyHandler.java#L254-L258
hibernate/hibernate-ogm
core/src/main/java/org/hibernate/ogm/model/spi/Association.java
Association.getOperations
public List<AssociationOperation> getOperations() { """ Return the list of actions on the tuple. Operations are inherently deduplicated, i.e. there will be at most one operation for a specific row key. <p> Note that the global CLEAR operation is put at the top of the list. @return the operations to execute on the association, the global CLEAR operation is put at the top of the list """ List<AssociationOperation> result = new ArrayList<AssociationOperation>( currentState.size() + 1 ); if ( cleared ) { result.add( new AssociationOperation( null, null, AssociationOperationType.CLEAR ) ); } result.addAll( currentState.values() ); return result; }
java
public List<AssociationOperation> getOperations() { List<AssociationOperation> result = new ArrayList<AssociationOperation>( currentState.size() + 1 ); if ( cleared ) { result.add( new AssociationOperation( null, null, AssociationOperationType.CLEAR ) ); } result.addAll( currentState.values() ); return result; }
[ "public", "List", "<", "AssociationOperation", ">", "getOperations", "(", ")", "{", "List", "<", "AssociationOperation", ">", "result", "=", "new", "ArrayList", "<", "AssociationOperation", ">", "(", "currentState", ".", "size", "(", ")", "+", "1", ")", ";", "if", "(", "cleared", ")", "{", "result", ".", "add", "(", "new", "AssociationOperation", "(", "null", ",", "null", ",", "AssociationOperationType", ".", "CLEAR", ")", ")", ";", "}", "result", ".", "addAll", "(", "currentState", ".", "values", "(", ")", ")", ";", "return", "result", ";", "}" ]
Return the list of actions on the tuple. Operations are inherently deduplicated, i.e. there will be at most one operation for a specific row key. <p> Note that the global CLEAR operation is put at the top of the list. @return the operations to execute on the association, the global CLEAR operation is put at the top of the list
[ "Return", "the", "list", "of", "actions", "on", "the", "tuple", ".", "Operations", "are", "inherently", "deduplicated", "i", ".", "e", ".", "there", "will", "be", "at", "most", "one", "operation", "for", "a", "specific", "row", "key", ".", "<p", ">", "Note", "that", "the", "global", "CLEAR", "operation", "is", "put", "at", "the", "top", "of", "the", "list", "." ]
train
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/core/src/main/java/org/hibernate/ogm/model/spi/Association.java#L108-L115
aws/aws-sdk-java
aws-java-sdk-pinpoint/src/main/java/com/amazonaws/services/pinpoint/model/SegmentResponse.java
SegmentResponse.withTags
public SegmentResponse withTags(java.util.Map<String, String> tags) { """ The Tags for the segment. @param tags The Tags for the segment. @return Returns a reference to this object so that method calls can be chained together. """ setTags(tags); return this; }
java
public SegmentResponse withTags(java.util.Map<String, String> tags) { setTags(tags); return this; }
[ "public", "SegmentResponse", "withTags", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "tags", ")", "{", "setTags", "(", "tags", ")", ";", "return", "this", ";", "}" ]
The Tags for the segment. @param tags The Tags for the segment. @return Returns a reference to this object so that method calls can be chained together.
[ "The", "Tags", "for", "the", "segment", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-pinpoint/src/main/java/com/amazonaws/services/pinpoint/model/SegmentResponse.java#L507-L510
JodaOrg/joda-time
src/main/java/org/joda/time/convert/ReadableIntervalConverter.java
ReadableIntervalConverter.setInto
public void setInto(ReadWritablePeriod writablePeriod, Object object, Chronology chrono) { """ Sets the values of the mutable duration from the specified interval. @param writablePeriod the period to modify @param object the interval to set from @param chrono the chronology to use """ ReadableInterval interval = (ReadableInterval) object; chrono = (chrono != null ? chrono : DateTimeUtils.getIntervalChronology(interval)); long start = interval.getStartMillis(); long end = interval.getEndMillis(); int[] values = chrono.get(writablePeriod, start, end); for (int i = 0; i < values.length; i++) { writablePeriod.setValue(i, values[i]); } }
java
public void setInto(ReadWritablePeriod writablePeriod, Object object, Chronology chrono) { ReadableInterval interval = (ReadableInterval) object; chrono = (chrono != null ? chrono : DateTimeUtils.getIntervalChronology(interval)); long start = interval.getStartMillis(); long end = interval.getEndMillis(); int[] values = chrono.get(writablePeriod, start, end); for (int i = 0; i < values.length; i++) { writablePeriod.setValue(i, values[i]); } }
[ "public", "void", "setInto", "(", "ReadWritablePeriod", "writablePeriod", ",", "Object", "object", ",", "Chronology", "chrono", ")", "{", "ReadableInterval", "interval", "=", "(", "ReadableInterval", ")", "object", ";", "chrono", "=", "(", "chrono", "!=", "null", "?", "chrono", ":", "DateTimeUtils", ".", "getIntervalChronology", "(", "interval", ")", ")", ";", "long", "start", "=", "interval", ".", "getStartMillis", "(", ")", ";", "long", "end", "=", "interval", ".", "getEndMillis", "(", ")", ";", "int", "[", "]", "values", "=", "chrono", ".", "get", "(", "writablePeriod", ",", "start", ",", "end", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "values", ".", "length", ";", "i", "++", ")", "{", "writablePeriod", ".", "setValue", "(", "i", ",", "values", "[", "i", "]", ")", ";", "}", "}" ]
Sets the values of the mutable duration from the specified interval. @param writablePeriod the period to modify @param object the interval to set from @param chrono the chronology to use
[ "Sets", "the", "values", "of", "the", "mutable", "duration", "from", "the", "specified", "interval", "." ]
train
https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/convert/ReadableIntervalConverter.java#L63-L72
phax/ph-css
ph-css/src/main/java/com/helger/css/decl/CascadingStyleSheet.java
CascadingStyleSheet.addImportRule
@Nonnull public CascadingStyleSheet addImportRule (@Nonnegative final int nIndex, @Nonnull final CSSImportRule aImportRule) { """ Add a new <code>@import</code> rule at a specified index of the <code>@import</code> rule list. @param nIndex The index where the rule should be added. Must be &ge; 0. @param aImportRule The import rule to add. May not be <code>null</code>. @return this @throws ArrayIndexOutOfBoundsException if the index is invalid """ ValueEnforcer.isGE0 (nIndex, "Index"); ValueEnforcer.notNull (aImportRule, "ImportRule"); if (nIndex >= getImportRuleCount ()) m_aImportRules.add (aImportRule); else m_aImportRules.add (nIndex, aImportRule); return this; }
java
@Nonnull public CascadingStyleSheet addImportRule (@Nonnegative final int nIndex, @Nonnull final CSSImportRule aImportRule) { ValueEnforcer.isGE0 (nIndex, "Index"); ValueEnforcer.notNull (aImportRule, "ImportRule"); if (nIndex >= getImportRuleCount ()) m_aImportRules.add (aImportRule); else m_aImportRules.add (nIndex, aImportRule); return this; }
[ "@", "Nonnull", "public", "CascadingStyleSheet", "addImportRule", "(", "@", "Nonnegative", "final", "int", "nIndex", ",", "@", "Nonnull", "final", "CSSImportRule", "aImportRule", ")", "{", "ValueEnforcer", ".", "isGE0", "(", "nIndex", ",", "\"Index\"", ")", ";", "ValueEnforcer", ".", "notNull", "(", "aImportRule", ",", "\"ImportRule\"", ")", ";", "if", "(", "nIndex", ">=", "getImportRuleCount", "(", ")", ")", "m_aImportRules", ".", "add", "(", "aImportRule", ")", ";", "else", "m_aImportRules", ".", "add", "(", "nIndex", ",", "aImportRule", ")", ";", "return", "this", ";", "}" ]
Add a new <code>@import</code> rule at a specified index of the <code>@import</code> rule list. @param nIndex The index where the rule should be added. Must be &ge; 0. @param aImportRule The import rule to add. May not be <code>null</code>. @return this @throws ArrayIndexOutOfBoundsException if the index is invalid
[ "Add", "a", "new", "<code", ">", "@import<", "/", "code", ">", "rule", "at", "a", "specified", "index", "of", "the", "<code", ">", "@import<", "/", "code", ">", "rule", "list", "." ]
train
https://github.com/phax/ph-css/blob/c9da5bb4decc681de6e27ce31712aad4c00adafa/ph-css/src/main/java/com/helger/css/decl/CascadingStyleSheet.java#L114-L125
Azure/azure-sdk-for-java
appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/WebSiteManagementClientImpl.java
WebSiteManagementClientImpl.validateAsync
public Observable<ValidateResponseInner> validateAsync(String resourceGroupName, ValidateRequest validateRequest) { """ Validate if a resource can be created. Validate if a resource can be created. @param resourceGroupName Name of the resource group to which the resource belongs. @param validateRequest Request with the resources to validate. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ValidateResponseInner object """ return validateWithServiceResponseAsync(resourceGroupName, validateRequest).map(new Func1<ServiceResponse<ValidateResponseInner>, ValidateResponseInner>() { @Override public ValidateResponseInner call(ServiceResponse<ValidateResponseInner> response) { return response.body(); } }); }
java
public Observable<ValidateResponseInner> validateAsync(String resourceGroupName, ValidateRequest validateRequest) { return validateWithServiceResponseAsync(resourceGroupName, validateRequest).map(new Func1<ServiceResponse<ValidateResponseInner>, ValidateResponseInner>() { @Override public ValidateResponseInner call(ServiceResponse<ValidateResponseInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ValidateResponseInner", ">", "validateAsync", "(", "String", "resourceGroupName", ",", "ValidateRequest", "validateRequest", ")", "{", "return", "validateWithServiceResponseAsync", "(", "resourceGroupName", ",", "validateRequest", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "ValidateResponseInner", ">", ",", "ValidateResponseInner", ">", "(", ")", "{", "@", "Override", "public", "ValidateResponseInner", "call", "(", "ServiceResponse", "<", "ValidateResponseInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Validate if a resource can be created. Validate if a resource can be created. @param resourceGroupName Name of the resource group to which the resource belongs. @param validateRequest Request with the resources to validate. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ValidateResponseInner object
[ "Validate", "if", "a", "resource", "can", "be", "created", ".", "Validate", "if", "a", "resource", "can", "be", "created", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/WebSiteManagementClientImpl.java#L2267-L2274
netty/netty
codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketClientHandshaker.java
WebSocketClientHandshaker.close
public ChannelFuture close(Channel channel, CloseWebSocketFrame frame) { """ Performs the closing handshake @param channel Channel @param frame Closing Frame that was received """ if (channel == null) { throw new NullPointerException("channel"); } return close(channel, frame, channel.newPromise()); }
java
public ChannelFuture close(Channel channel, CloseWebSocketFrame frame) { if (channel == null) { throw new NullPointerException("channel"); } return close(channel, frame, channel.newPromise()); }
[ "public", "ChannelFuture", "close", "(", "Channel", "channel", ",", "CloseWebSocketFrame", "frame", ")", "{", "if", "(", "channel", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "\"channel\"", ")", ";", "}", "return", "close", "(", "channel", ",", "frame", ",", "channel", ".", "newPromise", "(", ")", ")", ";", "}" ]
Performs the closing handshake @param channel Channel @param frame Closing Frame that was received
[ "Performs", "the", "closing", "handshake" ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketClientHandshaker.java#L473-L478
spring-projects/spring-data-solr
src/main/java/org/springframework/data/solr/core/DefaultQueryParser.java
DefaultQueryParser.doConstructSolrQuery
@Override public final SolrQuery doConstructSolrQuery(SolrDataQuery query, @Nullable Class<?> domainType) { """ Convert given Query into a SolrQuery executable via {@link org.apache.solr.client.solrj.SolrClient} @param query the source query to turn into a {@link SolrQuery}. @param domainType can be {@literal null}. @return """ Assert.notNull(query, "Cannot construct solrQuery from null value."); Assert.notNull(query.getCriteria(), "Query has to have a criteria."); SolrQuery solrQuery = new SolrQuery(); solrQuery.setParam(CommonParams.Q, getQueryString(query, domainType)); if (query instanceof Query) { processQueryOptions(solrQuery, (Query) query, domainType); } if (query instanceof FacetQuery) { processFacetOptions(solrQuery, (FacetQuery) query, domainType); } if (query instanceof HighlightQuery) { processHighlightOptions(solrQuery, (HighlightQuery) query, domainType); } return solrQuery; }
java
@Override public final SolrQuery doConstructSolrQuery(SolrDataQuery query, @Nullable Class<?> domainType) { Assert.notNull(query, "Cannot construct solrQuery from null value."); Assert.notNull(query.getCriteria(), "Query has to have a criteria."); SolrQuery solrQuery = new SolrQuery(); solrQuery.setParam(CommonParams.Q, getQueryString(query, domainType)); if (query instanceof Query) { processQueryOptions(solrQuery, (Query) query, domainType); } if (query instanceof FacetQuery) { processFacetOptions(solrQuery, (FacetQuery) query, domainType); } if (query instanceof HighlightQuery) { processHighlightOptions(solrQuery, (HighlightQuery) query, domainType); } return solrQuery; }
[ "@", "Override", "public", "final", "SolrQuery", "doConstructSolrQuery", "(", "SolrDataQuery", "query", ",", "@", "Nullable", "Class", "<", "?", ">", "domainType", ")", "{", "Assert", ".", "notNull", "(", "query", ",", "\"Cannot construct solrQuery from null value.\"", ")", ";", "Assert", ".", "notNull", "(", "query", ".", "getCriteria", "(", ")", ",", "\"Query has to have a criteria.\"", ")", ";", "SolrQuery", "solrQuery", "=", "new", "SolrQuery", "(", ")", ";", "solrQuery", ".", "setParam", "(", "CommonParams", ".", "Q", ",", "getQueryString", "(", "query", ",", "domainType", ")", ")", ";", "if", "(", "query", "instanceof", "Query", ")", "{", "processQueryOptions", "(", "solrQuery", ",", "(", "Query", ")", "query", ",", "domainType", ")", ";", "}", "if", "(", "query", "instanceof", "FacetQuery", ")", "{", "processFacetOptions", "(", "solrQuery", ",", "(", "FacetQuery", ")", "query", ",", "domainType", ")", ";", "}", "if", "(", "query", "instanceof", "HighlightQuery", ")", "{", "processHighlightOptions", "(", "solrQuery", ",", "(", "HighlightQuery", ")", "query", ",", "domainType", ")", ";", "}", "return", "solrQuery", ";", "}" ]
Convert given Query into a SolrQuery executable via {@link org.apache.solr.client.solrj.SolrClient} @param query the source query to turn into a {@link SolrQuery}. @param domainType can be {@literal null}. @return
[ "Convert", "given", "Query", "into", "a", "SolrQuery", "executable", "via", "{", "@link", "org", ".", "apache", ".", "solr", ".", "client", ".", "solrj", ".", "SolrClient", "}" ]
train
https://github.com/spring-projects/spring-data-solr/blob/20be5cb82498b70134dfda6c1a91ad21f8e657e0/src/main/java/org/springframework/data/solr/core/DefaultQueryParser.java#L89-L111
apache/incubator-shardingsphere
sharding-proxy/sharding-proxy-frontend/sharding-proxy-frontend-core/src/main/java/org/apache/shardingsphere/shardingproxy/frontend/executor/CommandExecutorSelector.java
CommandExecutorSelector.getExecutor
public static ExecutorService getExecutor(final boolean isOccupyThreadForPerConnection, final TransactionType transactionType, final ChannelId channelId) { """ Get executor service. @param isOccupyThreadForPerConnection is occupy thread for per connection or not @param transactionType transaction type @param channelId channel ID @return executor service """ return (isOccupyThreadForPerConnection || TransactionType.XA == transactionType || TransactionType.BASE == transactionType) ? ChannelThreadExecutorGroup.getInstance().get(channelId) : UserExecutorGroup.getInstance().getExecutorService(); }
java
public static ExecutorService getExecutor(final boolean isOccupyThreadForPerConnection, final TransactionType transactionType, final ChannelId channelId) { return (isOccupyThreadForPerConnection || TransactionType.XA == transactionType || TransactionType.BASE == transactionType) ? ChannelThreadExecutorGroup.getInstance().get(channelId) : UserExecutorGroup.getInstance().getExecutorService(); }
[ "public", "static", "ExecutorService", "getExecutor", "(", "final", "boolean", "isOccupyThreadForPerConnection", ",", "final", "TransactionType", "transactionType", ",", "final", "ChannelId", "channelId", ")", "{", "return", "(", "isOccupyThreadForPerConnection", "||", "TransactionType", ".", "XA", "==", "transactionType", "||", "TransactionType", ".", "BASE", "==", "transactionType", ")", "?", "ChannelThreadExecutorGroup", ".", "getInstance", "(", ")", ".", "get", "(", "channelId", ")", ":", "UserExecutorGroup", ".", "getInstance", "(", ")", ".", "getExecutorService", "(", ")", ";", "}" ]
Get executor service. @param isOccupyThreadForPerConnection is occupy thread for per connection or not @param transactionType transaction type @param channelId channel ID @return executor service
[ "Get", "executor", "service", "." ]
train
https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-proxy/sharding-proxy-frontend/sharding-proxy-frontend-core/src/main/java/org/apache/shardingsphere/shardingproxy/frontend/executor/CommandExecutorSelector.java#L43-L46
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/SerializedFormBuilder.java
SerializedFormBuilder.buildSerialUIDInfo
public void buildSerialUIDInfo(XMLNode node, Content classTree) { """ Build the serial UID information for the given class. @param node the XML element that specifies which components to document @param classTree content tree to which the serial UID information will be added """ Content serialUidTree = writer.getSerialUIDInfoHeader(); FieldDoc[] fields = currentClass.fields(false); for (int i = 0; i < fields.length; i++) { if (fields[i].name().equals("serialVersionUID") && fields[i].constantValueExpression() != null) { writer.addSerialUIDInfo(SERIAL_VERSION_UID_HEADER, fields[i].constantValueExpression(), serialUidTree); break; } } classTree.addContent(serialUidTree); }
java
public void buildSerialUIDInfo(XMLNode node, Content classTree) { Content serialUidTree = writer.getSerialUIDInfoHeader(); FieldDoc[] fields = currentClass.fields(false); for (int i = 0; i < fields.length; i++) { if (fields[i].name().equals("serialVersionUID") && fields[i].constantValueExpression() != null) { writer.addSerialUIDInfo(SERIAL_VERSION_UID_HEADER, fields[i].constantValueExpression(), serialUidTree); break; } } classTree.addContent(serialUidTree); }
[ "public", "void", "buildSerialUIDInfo", "(", "XMLNode", "node", ",", "Content", "classTree", ")", "{", "Content", "serialUidTree", "=", "writer", ".", "getSerialUIDInfoHeader", "(", ")", ";", "FieldDoc", "[", "]", "fields", "=", "currentClass", ".", "fields", "(", "false", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "fields", ".", "length", ";", "i", "++", ")", "{", "if", "(", "fields", "[", "i", "]", ".", "name", "(", ")", ".", "equals", "(", "\"serialVersionUID\"", ")", "&&", "fields", "[", "i", "]", ".", "constantValueExpression", "(", ")", "!=", "null", ")", "{", "writer", ".", "addSerialUIDInfo", "(", "SERIAL_VERSION_UID_HEADER", ",", "fields", "[", "i", "]", ".", "constantValueExpression", "(", ")", ",", "serialUidTree", ")", ";", "break", ";", "}", "}", "classTree", ".", "addContent", "(", "serialUidTree", ")", ";", "}" ]
Build the serial UID information for the given class. @param node the XML element that specifies which components to document @param classTree content tree to which the serial UID information will be added
[ "Build", "the", "serial", "UID", "information", "for", "the", "given", "class", "." ]
train
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/SerializedFormBuilder.java#L240-L252
SimiaCryptus/utilities
java-util/src/main/java/com/simiacryptus/util/MonitoredObject.java
MonitoredObject.addObj
@javax.annotation.Nonnull public com.simiacryptus.util.MonitoredObject addObj(final String key, final MonitoredItem item) { """ Add obj monitored object. @param key the key @param item the item @return the monitored object """ items.put(key, item); return this; }
java
@javax.annotation.Nonnull public com.simiacryptus.util.MonitoredObject addObj(final String key, final MonitoredItem item) { items.put(key, item); return this; }
[ "@", "javax", ".", "annotation", ".", "Nonnull", "public", "com", ".", "simiacryptus", ".", "util", ".", "MonitoredObject", "addObj", "(", "final", "String", "key", ",", "final", "MonitoredItem", "item", ")", "{", "items", ".", "put", "(", "key", ",", "item", ")", ";", "return", "this", ";", "}" ]
Add obj monitored object. @param key the key @param item the item @return the monitored object
[ "Add", "obj", "monitored", "object", "." ]
train
https://github.com/SimiaCryptus/utilities/blob/b5a5e73449aae57de7dbfca2ed7a074432c5b17e/java-util/src/main/java/com/simiacryptus/util/MonitoredObject.java#L67-L71
openbase/jul
communication/controller/src/main/java/org/openbase/jul/communication/controller/AbstractConfigurableController.java
AbstractConfigurableController.applyConfigUpdate
@Override public CONFIG applyConfigUpdate(final CONFIG config) throws CouldNotPerformException, InterruptedException { """ Apply an update to the configuration of this controller. @param config the updated configuration @return the updated configuration @throws CouldNotPerformException if the update could not be performed @throws InterruptedException if the update has been interrupted """ try { boolean scopeChanged; try(final CloseableWriteLockWrapper ignored = getManageWriteLock(this)) { this.config = config; if (supportsDataField(TYPE_FIELD_ID) && hasConfigField(TYPE_FIELD_ID)) { setDataField(TYPE_FIELD_ID, getConfigField(TYPE_FIELD_ID)); } if (supportsDataField(TYPE_FIELD_LABEL) && hasConfigField(TYPE_FIELD_LABEL)) { setDataField(TYPE_FIELD_LABEL, getConfigField(TYPE_FIELD_LABEL)); } scopeChanged = !currentScope.equals(detectScope(config)); currentScope = detectScope(); } // detect scope change if instance is already active and reinit if needed. // this needs to be done without holding the config lock to avoid a deadlock with the server manageable lock. try { if (isActive() && scopeChanged) { super.init(currentScope); } } catch (CouldNotPerformException ex) { throw new CouldNotPerformException("Could not verify scope changes!", ex); } return this.config; } catch (CouldNotPerformException ex) { throw new CouldNotPerformException("Could not apply config update!", ex); } }
java
@Override public CONFIG applyConfigUpdate(final CONFIG config) throws CouldNotPerformException, InterruptedException { try { boolean scopeChanged; try(final CloseableWriteLockWrapper ignored = getManageWriteLock(this)) { this.config = config; if (supportsDataField(TYPE_FIELD_ID) && hasConfigField(TYPE_FIELD_ID)) { setDataField(TYPE_FIELD_ID, getConfigField(TYPE_FIELD_ID)); } if (supportsDataField(TYPE_FIELD_LABEL) && hasConfigField(TYPE_FIELD_LABEL)) { setDataField(TYPE_FIELD_LABEL, getConfigField(TYPE_FIELD_LABEL)); } scopeChanged = !currentScope.equals(detectScope(config)); currentScope = detectScope(); } // detect scope change if instance is already active and reinit if needed. // this needs to be done without holding the config lock to avoid a deadlock with the server manageable lock. try { if (isActive() && scopeChanged) { super.init(currentScope); } } catch (CouldNotPerformException ex) { throw new CouldNotPerformException("Could not verify scope changes!", ex); } return this.config; } catch (CouldNotPerformException ex) { throw new CouldNotPerformException("Could not apply config update!", ex); } }
[ "@", "Override", "public", "CONFIG", "applyConfigUpdate", "(", "final", "CONFIG", "config", ")", "throws", "CouldNotPerformException", ",", "InterruptedException", "{", "try", "{", "boolean", "scopeChanged", ";", "try", "(", "final", "CloseableWriteLockWrapper", "ignored", "=", "getManageWriteLock", "(", "this", ")", ")", "{", "this", ".", "config", "=", "config", ";", "if", "(", "supportsDataField", "(", "TYPE_FIELD_ID", ")", "&&", "hasConfigField", "(", "TYPE_FIELD_ID", ")", ")", "{", "setDataField", "(", "TYPE_FIELD_ID", ",", "getConfigField", "(", "TYPE_FIELD_ID", ")", ")", ";", "}", "if", "(", "supportsDataField", "(", "TYPE_FIELD_LABEL", ")", "&&", "hasConfigField", "(", "TYPE_FIELD_LABEL", ")", ")", "{", "setDataField", "(", "TYPE_FIELD_LABEL", ",", "getConfigField", "(", "TYPE_FIELD_LABEL", ")", ")", ";", "}", "scopeChanged", "=", "!", "currentScope", ".", "equals", "(", "detectScope", "(", "config", ")", ")", ";", "currentScope", "=", "detectScope", "(", ")", ";", "}", "// detect scope change if instance is already active and reinit if needed.", "// this needs to be done without holding the config lock to avoid a deadlock with the server manageable lock.", "try", "{", "if", "(", "isActive", "(", ")", "&&", "scopeChanged", ")", "{", "super", ".", "init", "(", "currentScope", ")", ";", "}", "}", "catch", "(", "CouldNotPerformException", "ex", ")", "{", "throw", "new", "CouldNotPerformException", "(", "\"Could not verify scope changes!\"", ",", "ex", ")", ";", "}", "return", "this", ".", "config", ";", "}", "catch", "(", "CouldNotPerformException", "ex", ")", "{", "throw", "new", "CouldNotPerformException", "(", "\"Could not apply config update!\"", ",", "ex", ")", ";", "}", "}" ]
Apply an update to the configuration of this controller. @param config the updated configuration @return the updated configuration @throws CouldNotPerformException if the update could not be performed @throws InterruptedException if the update has been interrupted
[ "Apply", "an", "update", "to", "the", "configuration", "of", "this", "controller", "." ]
train
https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/communication/controller/src/main/java/org/openbase/jul/communication/controller/AbstractConfigurableController.java#L92-L125
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/methods/TmdbAccount.java
TmdbAccount.getGuestRatedMovies
public ResultList<MovieBasic> getGuestRatedMovies(String guestSessionId, String language, Integer page, SortBy sortBy) throws MovieDbException { """ Get a list of rated movies for a specific guest session id. @param guestSessionId @param language @param page @param sortBy only CREATED_AT_ASC or CREATED_AT_DESC is supported @return @throws MovieDbException """ TmdbParameters parameters = new TmdbParameters(); parameters.add(Param.ID, guestSessionId); parameters.add(Param.LANGUAGE, language); parameters.add(Param.PAGE, page); if (sortBy != null) { // Only created_at is supported parameters.add(Param.SORT_BY, "created_at"); if (sortBy.getPropertyString().endsWith("asc")) { parameters.add(Param.SORT_ORDER, "asc"); } else { parameters.add(Param.SORT_ORDER, "desc"); } } URL url = new ApiUrl(apiKey, MethodBase.GUEST_SESSION).subMethod(MethodSub.RATED_MOVIES_GUEST).buildUrl(parameters); WrapperGenericList<MovieBasic> wrapper = processWrapper(getTypeReference(MovieBasic.class), url, "Guest Session Movies"); return wrapper.getResultsList(); }
java
public ResultList<MovieBasic> getGuestRatedMovies(String guestSessionId, String language, Integer page, SortBy sortBy) throws MovieDbException { TmdbParameters parameters = new TmdbParameters(); parameters.add(Param.ID, guestSessionId); parameters.add(Param.LANGUAGE, language); parameters.add(Param.PAGE, page); if (sortBy != null) { // Only created_at is supported parameters.add(Param.SORT_BY, "created_at"); if (sortBy.getPropertyString().endsWith("asc")) { parameters.add(Param.SORT_ORDER, "asc"); } else { parameters.add(Param.SORT_ORDER, "desc"); } } URL url = new ApiUrl(apiKey, MethodBase.GUEST_SESSION).subMethod(MethodSub.RATED_MOVIES_GUEST).buildUrl(parameters); WrapperGenericList<MovieBasic> wrapper = processWrapper(getTypeReference(MovieBasic.class), url, "Guest Session Movies"); return wrapper.getResultsList(); }
[ "public", "ResultList", "<", "MovieBasic", ">", "getGuestRatedMovies", "(", "String", "guestSessionId", ",", "String", "language", ",", "Integer", "page", ",", "SortBy", "sortBy", ")", "throws", "MovieDbException", "{", "TmdbParameters", "parameters", "=", "new", "TmdbParameters", "(", ")", ";", "parameters", ".", "add", "(", "Param", ".", "ID", ",", "guestSessionId", ")", ";", "parameters", ".", "add", "(", "Param", ".", "LANGUAGE", ",", "language", ")", ";", "parameters", ".", "add", "(", "Param", ".", "PAGE", ",", "page", ")", ";", "if", "(", "sortBy", "!=", "null", ")", "{", "// Only created_at is supported", "parameters", ".", "add", "(", "Param", ".", "SORT_BY", ",", "\"created_at\"", ")", ";", "if", "(", "sortBy", ".", "getPropertyString", "(", ")", ".", "endsWith", "(", "\"asc\"", ")", ")", "{", "parameters", ".", "add", "(", "Param", ".", "SORT_ORDER", ",", "\"asc\"", ")", ";", "}", "else", "{", "parameters", ".", "add", "(", "Param", ".", "SORT_ORDER", ",", "\"desc\"", ")", ";", "}", "}", "URL", "url", "=", "new", "ApiUrl", "(", "apiKey", ",", "MethodBase", ".", "GUEST_SESSION", ")", ".", "subMethod", "(", "MethodSub", ".", "RATED_MOVIES_GUEST", ")", ".", "buildUrl", "(", "parameters", ")", ";", "WrapperGenericList", "<", "MovieBasic", ">", "wrapper", "=", "processWrapper", "(", "getTypeReference", "(", "MovieBasic", ".", "class", ")", ",", "url", ",", "\"Guest Session Movies\"", ")", ";", "return", "wrapper", ".", "getResultsList", "(", ")", ";", "}" ]
Get a list of rated movies for a specific guest session id. @param guestSessionId @param language @param page @param sortBy only CREATED_AT_ASC or CREATED_AT_DESC is supported @return @throws MovieDbException
[ "Get", "a", "list", "of", "rated", "movies", "for", "a", "specific", "guest", "session", "id", "." ]
train
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/methods/TmdbAccount.java#L306-L325
highsource/jaxb2-basics
tools/src/main/java/org/jvnet/jaxb2_commons/plugin/AbstractParameterizablePlugin.java
AbstractParameterizablePlugin.parseArgument
public int parseArgument(Options opt, String[] args, int start) throws BadCommandLineException, IOException { """ Parses the arguments and injects values into the beans via properties. """ int consumed = 0; final String optionPrefix = "-" + getOptionName() + "-"; final int optionPrefixLength = optionPrefix.length(); final String arg = args[start]; final int equalsPosition = arg.indexOf('='); if (arg.startsWith(optionPrefix) && equalsPosition > optionPrefixLength) { final String propertyName = arg.substring(optionPrefixLength, equalsPosition); final String value = arg.substring(equalsPosition + 1); consumed++; try { BeanUtils.setProperty(this, propertyName, value); } catch (Exception ex) { ex.printStackTrace(); throw new BadCommandLineException("Error setting property [" + propertyName + "], value [" + value + "]."); } } return consumed; }
java
public int parseArgument(Options opt, String[] args, int start) throws BadCommandLineException, IOException { int consumed = 0; final String optionPrefix = "-" + getOptionName() + "-"; final int optionPrefixLength = optionPrefix.length(); final String arg = args[start]; final int equalsPosition = arg.indexOf('='); if (arg.startsWith(optionPrefix) && equalsPosition > optionPrefixLength) { final String propertyName = arg.substring(optionPrefixLength, equalsPosition); final String value = arg.substring(equalsPosition + 1); consumed++; try { BeanUtils.setProperty(this, propertyName, value); } catch (Exception ex) { ex.printStackTrace(); throw new BadCommandLineException("Error setting property [" + propertyName + "], value [" + value + "]."); } } return consumed; }
[ "public", "int", "parseArgument", "(", "Options", "opt", ",", "String", "[", "]", "args", ",", "int", "start", ")", "throws", "BadCommandLineException", ",", "IOException", "{", "int", "consumed", "=", "0", ";", "final", "String", "optionPrefix", "=", "\"-\"", "+", "getOptionName", "(", ")", "+", "\"-\"", ";", "final", "int", "optionPrefixLength", "=", "optionPrefix", ".", "length", "(", ")", ";", "final", "String", "arg", "=", "args", "[", "start", "]", ";", "final", "int", "equalsPosition", "=", "arg", ".", "indexOf", "(", "'", "'", ")", ";", "if", "(", "arg", ".", "startsWith", "(", "optionPrefix", ")", "&&", "equalsPosition", ">", "optionPrefixLength", ")", "{", "final", "String", "propertyName", "=", "arg", ".", "substring", "(", "optionPrefixLength", ",", "equalsPosition", ")", ";", "final", "String", "value", "=", "arg", ".", "substring", "(", "equalsPosition", "+", "1", ")", ";", "consumed", "++", ";", "try", "{", "BeanUtils", ".", "setProperty", "(", "this", ",", "propertyName", ",", "value", ")", ";", "}", "catch", "(", "Exception", "ex", ")", "{", "ex", ".", "printStackTrace", "(", ")", ";", "throw", "new", "BadCommandLineException", "(", "\"Error setting property [\"", "+", "propertyName", "+", "\"], value [\"", "+", "value", "+", "\"].\"", ")", ";", "}", "}", "return", "consumed", ";", "}" ]
Parses the arguments and injects values into the beans via properties.
[ "Parses", "the", "arguments", "and", "injects", "values", "into", "the", "beans", "via", "properties", "." ]
train
https://github.com/highsource/jaxb2-basics/blob/571cca0ce58a75d984324d33d8af453bf5862e75/tools/src/main/java/org/jvnet/jaxb2_commons/plugin/AbstractParameterizablePlugin.java#L29-L54
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ULocale.java
ULocale.getDisplayNameWithDialect
public static String getDisplayNameWithDialect(String localeID, String displayLocaleID) { """ <strong>[icu]</strong> Returns the locale ID localized for display in the provided locale. If a dialect name is present in the locale data, then it is returned. This is a cover for the ICU4C API. @param localeID the locale whose name is to be displayed. @param displayLocaleID the id of the locale in which to display the locale name. @return the localized locale name. """ return getDisplayNameWithDialectInternal(new ULocale(localeID), new ULocale(displayLocaleID)); }
java
public static String getDisplayNameWithDialect(String localeID, String displayLocaleID) { return getDisplayNameWithDialectInternal(new ULocale(localeID), new ULocale(displayLocaleID)); }
[ "public", "static", "String", "getDisplayNameWithDialect", "(", "String", "localeID", ",", "String", "displayLocaleID", ")", "{", "return", "getDisplayNameWithDialectInternal", "(", "new", "ULocale", "(", "localeID", ")", ",", "new", "ULocale", "(", "displayLocaleID", ")", ")", ";", "}" ]
<strong>[icu]</strong> Returns the locale ID localized for display in the provided locale. If a dialect name is present in the locale data, then it is returned. This is a cover for the ICU4C API. @param localeID the locale whose name is to be displayed. @param displayLocaleID the id of the locale in which to display the locale name. @return the localized locale name.
[ "<strong", ">", "[", "icu", "]", "<", "/", "strong", ">", "Returns", "the", "locale", "ID", "localized", "for", "display", "in", "the", "provided", "locale", ".", "If", "a", "dialect", "name", "is", "present", "in", "the", "locale", "data", "then", "it", "is", "returned", ".", "This", "is", "a", "cover", "for", "the", "ICU4C", "API", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ULocale.java#L1825-L1828
alkacon/opencms-core
src/org/opencms/db/CmsSecurityManager.java
CmsSecurityManager.getDateLastVisitedBy
public long getDateLastVisitedBy(CmsRequestContext context, String poolName, CmsUser user, CmsResource resource) throws CmsException { """ Returns the date when the resource was last visited by the user.<p> @param context the request context @param poolName the name of the database pool to use @param user the user to check the date @param resource the resource to check the date @return the date when the resource was last visited by the user @throws CmsException if something goes wrong """ CmsDbContext dbc = m_dbContextFactory.getDbContext(context); long result = 0; try { result = m_driverManager.getDateLastVisitedBy(dbc, poolName, user, resource); } catch (Exception e) { dbc.report( null, Messages.get().container( Messages.ERR_GET_DATE_LASTVISITED_2, user.getName(), context.getSitePath(resource)), e); } finally { dbc.clear(); } return result; }
java
public long getDateLastVisitedBy(CmsRequestContext context, String poolName, CmsUser user, CmsResource resource) throws CmsException { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); long result = 0; try { result = m_driverManager.getDateLastVisitedBy(dbc, poolName, user, resource); } catch (Exception e) { dbc.report( null, Messages.get().container( Messages.ERR_GET_DATE_LASTVISITED_2, user.getName(), context.getSitePath(resource)), e); } finally { dbc.clear(); } return result; }
[ "public", "long", "getDateLastVisitedBy", "(", "CmsRequestContext", "context", ",", "String", "poolName", ",", "CmsUser", "user", ",", "CmsResource", "resource", ")", "throws", "CmsException", "{", "CmsDbContext", "dbc", "=", "m_dbContextFactory", ".", "getDbContext", "(", "context", ")", ";", "long", "result", "=", "0", ";", "try", "{", "result", "=", "m_driverManager", ".", "getDateLastVisitedBy", "(", "dbc", ",", "poolName", ",", "user", ",", "resource", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "dbc", ".", "report", "(", "null", ",", "Messages", ".", "get", "(", ")", ".", "container", "(", "Messages", ".", "ERR_GET_DATE_LASTVISITED_2", ",", "user", ".", "getName", "(", ")", ",", "context", ".", "getSitePath", "(", "resource", ")", ")", ",", "e", ")", ";", "}", "finally", "{", "dbc", ".", "clear", "(", ")", ";", "}", "return", "result", ";", "}" ]
Returns the date when the resource was last visited by the user.<p> @param context the request context @param poolName the name of the database pool to use @param user the user to check the date @param resource the resource to check the date @return the date when the resource was last visited by the user @throws CmsException if something goes wrong
[ "Returns", "the", "date", "when", "the", "resource", "was", "last", "visited", "by", "the", "user", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSecurityManager.java#L2136-L2155
mozilla/rhino
src/org/mozilla/javascript/NativeArray.java
NativeArray.getRawElem
private static Object getRawElem(Scriptable target, long index) { """ same as getElem, but without converting NOT_FOUND to undefined """ if (index > Integer.MAX_VALUE) { return ScriptableObject.getProperty(target, Long.toString(index)); } return ScriptableObject.getProperty(target, (int)index); }
java
private static Object getRawElem(Scriptable target, long index) { if (index > Integer.MAX_VALUE) { return ScriptableObject.getProperty(target, Long.toString(index)); } return ScriptableObject.getProperty(target, (int)index); }
[ "private", "static", "Object", "getRawElem", "(", "Scriptable", "target", ",", "long", "index", ")", "{", "if", "(", "index", ">", "Integer", ".", "MAX_VALUE", ")", "{", "return", "ScriptableObject", ".", "getProperty", "(", "target", ",", "Long", ".", "toString", "(", "index", ")", ")", ";", "}", "return", "ScriptableObject", ".", "getProperty", "(", "target", ",", "(", "int", ")", "index", ")", ";", "}" ]
same as getElem, but without converting NOT_FOUND to undefined
[ "same", "as", "getElem", "but", "without", "converting", "NOT_FOUND", "to", "undefined" ]
train
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/NativeArray.java#L793-L798
citrusframework/citrus
modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/ReceiveMessageBuilder.java
ReceiveMessageBuilder.extractFromHeader
public T extractFromHeader(String headerName, String variable) { """ Extract message header entry as variable. @param headerName @param variable @return """ if (headerExtractor == null) { headerExtractor = new MessageHeaderVariableExtractor(); getAction().getVariableExtractors().add(headerExtractor); } headerExtractor.getHeaderMappings().put(headerName, variable); return self; }
java
public T extractFromHeader(String headerName, String variable) { if (headerExtractor == null) { headerExtractor = new MessageHeaderVariableExtractor(); getAction().getVariableExtractors().add(headerExtractor); } headerExtractor.getHeaderMappings().put(headerName, variable); return self; }
[ "public", "T", "extractFromHeader", "(", "String", "headerName", ",", "String", "variable", ")", "{", "if", "(", "headerExtractor", "==", "null", ")", "{", "headerExtractor", "=", "new", "MessageHeaderVariableExtractor", "(", ")", ";", "getAction", "(", ")", ".", "getVariableExtractors", "(", ")", ".", "add", "(", "headerExtractor", ")", ";", "}", "headerExtractor", ".", "getHeaderMappings", "(", ")", ".", "put", "(", "headerName", ",", "variable", ")", ";", "return", "self", ";", "}" ]
Extract message header entry as variable. @param headerName @param variable @return
[ "Extract", "message", "header", "entry", "as", "variable", "." ]
train
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/ReceiveMessageBuilder.java#L778-L787
cdk/cdk
legacy/src/main/java/org/openscience/cdk/geometry/GeometryTools.java
GeometryTools.getBestAlignmentForLabel
public static int getBestAlignmentForLabel(IAtomContainer container, IAtom atom) { """ Determines the best alignment for the label of an atom in 2D space. It returns 1 if left aligned, and -1 if right aligned. See comment for center(IAtomContainer atomCon, Dimension areaDim, HashMap renderingCoordinates) for details on coordinate sets @param container Description of the Parameter @param atom Description of the Parameter @return The bestAlignmentForLabel value """ double overallDiffX = 0; for (IAtom connectedAtom : container.getConnectedAtomsList(atom)) { overallDiffX += connectedAtom.getPoint2d().x - atom.getPoint2d().x; } if (overallDiffX <= 0) { return 1; } else { return -1; } }
java
public static int getBestAlignmentForLabel(IAtomContainer container, IAtom atom) { double overallDiffX = 0; for (IAtom connectedAtom : container.getConnectedAtomsList(atom)) { overallDiffX += connectedAtom.getPoint2d().x - atom.getPoint2d().x; } if (overallDiffX <= 0) { return 1; } else { return -1; } }
[ "public", "static", "int", "getBestAlignmentForLabel", "(", "IAtomContainer", "container", ",", "IAtom", "atom", ")", "{", "double", "overallDiffX", "=", "0", ";", "for", "(", "IAtom", "connectedAtom", ":", "container", ".", "getConnectedAtomsList", "(", "atom", ")", ")", "{", "overallDiffX", "+=", "connectedAtom", ".", "getPoint2d", "(", ")", ".", "x", "-", "atom", ".", "getPoint2d", "(", ")", ".", "x", ";", "}", "if", "(", "overallDiffX", "<=", "0", ")", "{", "return", "1", ";", "}", "else", "{", "return", "-", "1", ";", "}", "}" ]
Determines the best alignment for the label of an atom in 2D space. It returns 1 if left aligned, and -1 if right aligned. See comment for center(IAtomContainer atomCon, Dimension areaDim, HashMap renderingCoordinates) for details on coordinate sets @param container Description of the Parameter @param atom Description of the Parameter @return The bestAlignmentForLabel value
[ "Determines", "the", "best", "alignment", "for", "the", "label", "of", "an", "atom", "in", "2D", "space", ".", "It", "returns", "1", "if", "left", "aligned", "and", "-", "1", "if", "right", "aligned", ".", "See", "comment", "for", "center", "(", "IAtomContainer", "atomCon", "Dimension", "areaDim", "HashMap", "renderingCoordinates", ")", "for", "details", "on", "coordinate", "sets" ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/legacy/src/main/java/org/openscience/cdk/geometry/GeometryTools.java#L1196-L1206
Azure/azure-sdk-for-java
logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/WorkflowsInner.java
WorkflowsInner.listAsync
public Observable<Page<WorkflowInner>> listAsync(final Integer top, final String filter) { """ Gets a list of workflows by subscription. @param top The number of items to be included in the result. @param filter The filter to apply on the operation. Options for filters include: State, Trigger, and ReferencedResourceId. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;WorkflowInner&gt; object """ return listWithServiceResponseAsync(top, filter) .map(new Func1<ServiceResponse<Page<WorkflowInner>>, Page<WorkflowInner>>() { @Override public Page<WorkflowInner> call(ServiceResponse<Page<WorkflowInner>> response) { return response.body(); } }); }
java
public Observable<Page<WorkflowInner>> listAsync(final Integer top, final String filter) { return listWithServiceResponseAsync(top, filter) .map(new Func1<ServiceResponse<Page<WorkflowInner>>, Page<WorkflowInner>>() { @Override public Page<WorkflowInner> call(ServiceResponse<Page<WorkflowInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "WorkflowInner", ">", ">", "listAsync", "(", "final", "Integer", "top", ",", "final", "String", "filter", ")", "{", "return", "listWithServiceResponseAsync", "(", "top", ",", "filter", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "Page", "<", "WorkflowInner", ">", ">", ",", "Page", "<", "WorkflowInner", ">", ">", "(", ")", "{", "@", "Override", "public", "Page", "<", "WorkflowInner", ">", "call", "(", "ServiceResponse", "<", "Page", "<", "WorkflowInner", ">", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Gets a list of workflows by subscription. @param top The number of items to be included in the result. @param filter The filter to apply on the operation. Options for filters include: State, Trigger, and ReferencedResourceId. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;WorkflowInner&gt; object
[ "Gets", "a", "list", "of", "workflows", "by", "subscription", "." ]
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/WorkflowsInner.java#L294-L302
strator-dev/greenpepper
greenpepper/greenpepper-client/src/main/java/com/greenpepper/server/rpc/runner/XmlRpcRemoteRunner.java
XmlRpcRemoteRunner.runReference
public Reference runReference(String projectName, String sutName, String requirementRepositoryId, String requirementName, String repositoryId, String specificationName, String locale) throws GreenPepperServerException { """ <p>runReference.</p> @param projectName a {@link java.lang.String} object. @param sutName a {@link java.lang.String} object. @param requirementRepositoryId a {@link java.lang.String} object. @param requirementName a {@link java.lang.String} object. @param repositoryId a {@link java.lang.String} object. @param specificationName a {@link java.lang.String} object. @param locale a {@link java.lang.String} object. @return a {@link com.greenpepper.server.domain.Reference} object. @throws com.greenpepper.server.GreenPepperServerException if any. """ SystemUnderTest sut = SystemUnderTest.newInstance(sutName); sut.setProject(Project.newInstance(projectName)); Specification specification =Specification.newInstance(specificationName == null ? requirementName : specificationName); specification.setRepository(Repository.newInstance(repositoryId == null ? requirementRepositoryId : repositoryId)); Requirement requirement = Requirement.newInstance(requirementName); requirement.setRepository(Repository.newInstance(requirementRepositoryId)); Reference reference = Reference.newInstance(requirement, specification, sut); return runReference(reference, locale); }
java
public Reference runReference(String projectName, String sutName, String requirementRepositoryId, String requirementName, String repositoryId, String specificationName, String locale) throws GreenPepperServerException { SystemUnderTest sut = SystemUnderTest.newInstance(sutName); sut.setProject(Project.newInstance(projectName)); Specification specification =Specification.newInstance(specificationName == null ? requirementName : specificationName); specification.setRepository(Repository.newInstance(repositoryId == null ? requirementRepositoryId : repositoryId)); Requirement requirement = Requirement.newInstance(requirementName); requirement.setRepository(Repository.newInstance(requirementRepositoryId)); Reference reference = Reference.newInstance(requirement, specification, sut); return runReference(reference, locale); }
[ "public", "Reference", "runReference", "(", "String", "projectName", ",", "String", "sutName", ",", "String", "requirementRepositoryId", ",", "String", "requirementName", ",", "String", "repositoryId", ",", "String", "specificationName", ",", "String", "locale", ")", "throws", "GreenPepperServerException", "{", "SystemUnderTest", "sut", "=", "SystemUnderTest", ".", "newInstance", "(", "sutName", ")", ";", "sut", ".", "setProject", "(", "Project", ".", "newInstance", "(", "projectName", ")", ")", ";", "Specification", "specification", "=", "Specification", ".", "newInstance", "(", "specificationName", "==", "null", "?", "requirementName", ":", "specificationName", ")", ";", "specification", ".", "setRepository", "(", "Repository", ".", "newInstance", "(", "repositoryId", "==", "null", "?", "requirementRepositoryId", ":", "repositoryId", ")", ")", ";", "Requirement", "requirement", "=", "Requirement", ".", "newInstance", "(", "requirementName", ")", ";", "requirement", ".", "setRepository", "(", "Repository", ".", "newInstance", "(", "requirementRepositoryId", ")", ")", ";", "Reference", "reference", "=", "Reference", ".", "newInstance", "(", "requirement", ",", "specification", ",", "sut", ")", ";", "return", "runReference", "(", "reference", ",", "locale", ")", ";", "}" ]
<p>runReference.</p> @param projectName a {@link java.lang.String} object. @param sutName a {@link java.lang.String} object. @param requirementRepositoryId a {@link java.lang.String} object. @param requirementName a {@link java.lang.String} object. @param repositoryId a {@link java.lang.String} object. @param specificationName a {@link java.lang.String} object. @param locale a {@link java.lang.String} object. @return a {@link com.greenpepper.server.domain.Reference} object. @throws com.greenpepper.server.GreenPepperServerException if any.
[ "<p", ">", "runReference", ".", "<", "/", "p", ">" ]
train
https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper/greenpepper-client/src/main/java/com/greenpepper/server/rpc/runner/XmlRpcRemoteRunner.java#L170-L186
oboehm/jfachwert
src/main/java/de/jfachwert/bank/Geldbetrag.java
Geldbetrag.valueOf
public static Geldbetrag valueOf(Number value, Currency currency) { """ Wandelt den angegebenen MonetaryAmount in einen Geldbetrag um. Um die Anzahl von Objekten gering zu halten, wird nur dann tatsaechlich eine neues Objekt erzeugt, wenn es sich nicht vermeiden laesst. <p> In Anlehnung an {@link BigDecimal} heisst die Methode "valueOf". </p> @param value Wert des andere Geldbetrags @param currency Waehrung des anderen Geldbetrags @return ein Geldbetrag """ return valueOf(new Geldbetrag(value, currency)); }
java
public static Geldbetrag valueOf(Number value, Currency currency) { return valueOf(new Geldbetrag(value, currency)); }
[ "public", "static", "Geldbetrag", "valueOf", "(", "Number", "value", ",", "Currency", "currency", ")", "{", "return", "valueOf", "(", "new", "Geldbetrag", "(", "value", ",", "currency", ")", ")", ";", "}" ]
Wandelt den angegebenen MonetaryAmount in einen Geldbetrag um. Um die Anzahl von Objekten gering zu halten, wird nur dann tatsaechlich eine neues Objekt erzeugt, wenn es sich nicht vermeiden laesst. <p> In Anlehnung an {@link BigDecimal} heisst die Methode "valueOf". </p> @param value Wert des andere Geldbetrags @param currency Waehrung des anderen Geldbetrags @return ein Geldbetrag
[ "Wandelt", "den", "angegebenen", "MonetaryAmount", "in", "einen", "Geldbetrag", "um", ".", "Um", "die", "Anzahl", "von", "Objekten", "gering", "zu", "halten", "wird", "nur", "dann", "tatsaechlich", "eine", "neues", "Objekt", "erzeugt", "wenn", "es", "sich", "nicht", "vermeiden", "laesst", ".", "<p", ">", "In", "Anlehnung", "an", "{", "@link", "BigDecimal", "}", "heisst", "die", "Methode", "valueOf", ".", "<", "/", "p", ">" ]
train
https://github.com/oboehm/jfachwert/blob/67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b/src/main/java/de/jfachwert/bank/Geldbetrag.java#L366-L368
JOML-CI/JOML
src/org/joml/Matrix4f.java
Matrix4f.perspectiveRect
public Matrix4f perspectiveRect(float width, float height, float zNear, float zFar, Matrix4f dest) { """ Apply a symmetric perspective projection frustum transformation for a right-handed coordinate system using OpenGL's NDC z range of <code>[-1..+1]</code> to this matrix and store the result in <code>dest</code>. <p> If <code>M</code> is <code>this</code> matrix and <code>P</code> the perspective projection matrix, then the new matrix will be <code>M * P</code>. So when transforming a vector <code>v</code> with the new matrix by using <code>M * P * v</code>, the perspective projection will be applied first! <p> In order to set the matrix to a perspective frustum transformation without post-multiplying, use {@link #setPerspectiveRect(float, float, float, float) setPerspectiveRect}. @see #setPerspectiveRect(float, float, float, float) @param width the width of the near frustum plane @param height the height of the near frustum plane @param zNear near clipping plane distance. If the special value {@link Float#POSITIVE_INFINITY} is used, the near clipping plane will be at positive infinity. In that case, <code>zFar</code> may not also be {@link Float#POSITIVE_INFINITY}. @param zFar far clipping plane distance. If the special value {@link Float#POSITIVE_INFINITY} is used, the far clipping plane will be at positive infinity. In that case, <code>zNear</code> may not also be {@link Float#POSITIVE_INFINITY}. @param dest will hold the result @return dest """ return perspectiveRect(width, height, zNear, zFar, false, dest); }
java
public Matrix4f perspectiveRect(float width, float height, float zNear, float zFar, Matrix4f dest) { return perspectiveRect(width, height, zNear, zFar, false, dest); }
[ "public", "Matrix4f", "perspectiveRect", "(", "float", "width", ",", "float", "height", ",", "float", "zNear", ",", "float", "zFar", ",", "Matrix4f", "dest", ")", "{", "return", "perspectiveRect", "(", "width", ",", "height", ",", "zNear", ",", "zFar", ",", "false", ",", "dest", ")", ";", "}" ]
Apply a symmetric perspective projection frustum transformation for a right-handed coordinate system using OpenGL's NDC z range of <code>[-1..+1]</code> to this matrix and store the result in <code>dest</code>. <p> If <code>M</code> is <code>this</code> matrix and <code>P</code> the perspective projection matrix, then the new matrix will be <code>M * P</code>. So when transforming a vector <code>v</code> with the new matrix by using <code>M * P * v</code>, the perspective projection will be applied first! <p> In order to set the matrix to a perspective frustum transformation without post-multiplying, use {@link #setPerspectiveRect(float, float, float, float) setPerspectiveRect}. @see #setPerspectiveRect(float, float, float, float) @param width the width of the near frustum plane @param height the height of the near frustum plane @param zNear near clipping plane distance. If the special value {@link Float#POSITIVE_INFINITY} is used, the near clipping plane will be at positive infinity. In that case, <code>zFar</code> may not also be {@link Float#POSITIVE_INFINITY}. @param zFar far clipping plane distance. If the special value {@link Float#POSITIVE_INFINITY} is used, the far clipping plane will be at positive infinity. In that case, <code>zNear</code> may not also be {@link Float#POSITIVE_INFINITY}. @param dest will hold the result @return dest
[ "Apply", "a", "symmetric", "perspective", "projection", "frustum", "transformation", "for", "a", "right", "-", "handed", "coordinate", "system", "using", "OpenGL", "s", "NDC", "z", "range", "of", "<code", ">", "[", "-", "1", "..", "+", "1", "]", "<", "/", "code", ">", "to", "this", "matrix", "and", "store", "the", "result", "in", "<code", ">", "dest<", "/", "code", ">", ".", "<p", ">", "If", "<code", ">", "M<", "/", "code", ">", "is", "<code", ">", "this<", "/", "code", ">", "matrix", "and", "<code", ">", "P<", "/", "code", ">", "the", "perspective", "projection", "matrix", "then", "the", "new", "matrix", "will", "be", "<code", ">", "M", "*", "P<", "/", "code", ">", ".", "So", "when", "transforming", "a", "vector", "<code", ">", "v<", "/", "code", ">", "with", "the", "new", "matrix", "by", "using", "<code", ">", "M", "*", "P", "*", "v<", "/", "code", ">", "the", "perspective", "projection", "will", "be", "applied", "first!", "<p", ">", "In", "order", "to", "set", "the", "matrix", "to", "a", "perspective", "frustum", "transformation", "without", "post", "-", "multiplying", "use", "{", "@link", "#setPerspectiveRect", "(", "float", "float", "float", "float", ")", "setPerspectiveRect", "}", "." ]
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4f.java#L9502-L9504