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
listlengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
listlengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
dlemmermann/CalendarFX
CalendarFXView/src/main/java/com/calendarfx/model/Entry.java
Entry.isShowing
public final boolean isShowing(LocalDate startDate, LocalDate endDate, ZoneId zoneId) { """ Checks whether the entry will be visible within the given start and end dates. This method takes recurrence into consideration and will return true if any recurrence of this entry will be displayed inside the given time interval. @param startDate the start date of the search interval @param endDate the end date of the search interval @param zoneId the time zone @return true if the entry or any of its recurrences is showing """ return isShowing(this, startDate, endDate, zoneId); }
java
public final boolean isShowing(LocalDate startDate, LocalDate endDate, ZoneId zoneId) { return isShowing(this, startDate, endDate, zoneId); }
[ "public", "final", "boolean", "isShowing", "(", "LocalDate", "startDate", ",", "LocalDate", "endDate", ",", "ZoneId", "zoneId", ")", "{", "return", "isShowing", "(", "this", ",", "startDate", ",", "endDate", ",", "zoneId", ")", ";", "}" ]
Checks whether the entry will be visible within the given start and end dates. This method takes recurrence into consideration and will return true if any recurrence of this entry will be displayed inside the given time interval. @param startDate the start date of the search interval @param endDate the end date of the search interval @param zoneId the time zone @return true if the entry or any of its recurrences is showing
[ "Checks", "whether", "the", "entry", "will", "be", "visible", "within", "the", "given", "start", "and", "end", "dates", ".", "This", "method", "takes", "recurrence", "into", "consideration", "and", "will", "return", "true", "if", "any", "recurrence", "of", "...
train
https://github.com/dlemmermann/CalendarFX/blob/f2b91c2622c3f29d004485b6426b23b86c331f96/CalendarFXView/src/main/java/com/calendarfx/model/Entry.java#L1487-L1489
landawn/AbacusUtil
src/com/landawn/abacus/util/SQLExecutor.java
SQLExecutor.streamAll
@SafeVarargs public final <T> Stream<T> streamAll(final List<String> sqls, final StatementSetter statementSetter, final JdbcUtil.BiRecordGetter<T, RuntimeException> recordGetter, final JdbcSettings jdbcSettings, final Object... parameters) { """ Remember to close the returned <code>Stream</code> list to close the underlying <code>ResultSet</code> list. {@code stream} operation won't be part of transaction or use the connection created by {@code Transaction} even it's in transaction block/range. @param sqls @param statementSetter @param recordGetter @param jdbcSettings @param parameters @return """ if (sqls.size() == 1) { return streamAll(sqls.get(0), statementSetter, recordGetter, jdbcSettings, parameters); } final boolean isQueryInParallel = jdbcSettings != null && jdbcSettings.isQueryInParallel(); return Stream.of(sqls).__(new Function<Stream<String>, Stream<String>>() { @Override public Stream<String> apply(Stream<String> s) { return isQueryInParallel ? s.parallel(sqls.size()) : s; } }).flatMap(new Function<String, Stream<T>>() { @Override public Stream<T> apply(String sql) { return streamAll(sql, statementSetter, recordGetter, jdbcSettings, parameters); } }); }
java
@SafeVarargs public final <T> Stream<T> streamAll(final List<String> sqls, final StatementSetter statementSetter, final JdbcUtil.BiRecordGetter<T, RuntimeException> recordGetter, final JdbcSettings jdbcSettings, final Object... parameters) { if (sqls.size() == 1) { return streamAll(sqls.get(0), statementSetter, recordGetter, jdbcSettings, parameters); } final boolean isQueryInParallel = jdbcSettings != null && jdbcSettings.isQueryInParallel(); return Stream.of(sqls).__(new Function<Stream<String>, Stream<String>>() { @Override public Stream<String> apply(Stream<String> s) { return isQueryInParallel ? s.parallel(sqls.size()) : s; } }).flatMap(new Function<String, Stream<T>>() { @Override public Stream<T> apply(String sql) { return streamAll(sql, statementSetter, recordGetter, jdbcSettings, parameters); } }); }
[ "@", "SafeVarargs", "public", "final", "<", "T", ">", "Stream", "<", "T", ">", "streamAll", "(", "final", "List", "<", "String", ">", "sqls", ",", "final", "StatementSetter", "statementSetter", ",", "final", "JdbcUtil", ".", "BiRecordGetter", "<", "T", ","...
Remember to close the returned <code>Stream</code> list to close the underlying <code>ResultSet</code> list. {@code stream} operation won't be part of transaction or use the connection created by {@code Transaction} even it's in transaction block/range. @param sqls @param statementSetter @param recordGetter @param jdbcSettings @param parameters @return
[ "Remember", "to", "close", "the", "returned", "<code", ">", "Stream<", "/", "code", ">", "list", "to", "close", "the", "underlying", "<code", ">", "ResultSet<", "/", "code", ">", "list", ".", "{", "@code", "stream", "}", "operation", "won", "t", "be", ...
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/SQLExecutor.java#L2984-L3004
scireum/server-sass
src/main/java/org/serversass/Functions.java
Functions.darken
public static Expression darken(Generator generator, FunctionCall input) { """ Decreases the lightness of the given color by N percent. @param generator the surrounding generator @param input the function call to evaluate @return the result of the evaluation """ Color color = input.getExpectedColorParam(0); int decrease = input.getExpectedIntParam(1); return changeLighteness(color, -decrease); }
java
public static Expression darken(Generator generator, FunctionCall input) { Color color = input.getExpectedColorParam(0); int decrease = input.getExpectedIntParam(1); return changeLighteness(color, -decrease); }
[ "public", "static", "Expression", "darken", "(", "Generator", "generator", ",", "FunctionCall", "input", ")", "{", "Color", "color", "=", "input", ".", "getExpectedColorParam", "(", "0", ")", ";", "int", "decrease", "=", "input", ".", "getExpectedIntParam", "(...
Decreases the lightness of the given color by N percent. @param generator the surrounding generator @param input the function call to evaluate @return the result of the evaluation
[ "Decreases", "the", "lightness", "of", "the", "given", "color", "by", "N", "percent", "." ]
train
https://github.com/scireum/server-sass/blob/e74af983567f10c43420d70cd31165dd080ba8fc/src/main/java/org/serversass/Functions.java#L130-L134
Javacord/Javacord
javacord-api/src/main/java/org/javacord/api/entity/webhook/WebhookUpdater.java
WebhookUpdater.setAvatar
public WebhookUpdater setAvatar(BufferedImage avatar, String fileType) { """ Queues the avatar to be updated. @param avatar The avatar to set. @param fileType The type of the avatar, e.g. "png" or "jpg". @return The current instance in order to chain call methods. """ delegate.setAvatar(avatar, fileType); return this; }
java
public WebhookUpdater setAvatar(BufferedImage avatar, String fileType) { delegate.setAvatar(avatar, fileType); return this; }
[ "public", "WebhookUpdater", "setAvatar", "(", "BufferedImage", "avatar", ",", "String", "fileType", ")", "{", "delegate", ".", "setAvatar", "(", "avatar", ",", "fileType", ")", ";", "return", "this", ";", "}" ]
Queues the avatar to be updated. @param avatar The avatar to set. @param fileType The type of the avatar, e.g. "png" or "jpg". @return The current instance in order to chain call methods.
[ "Queues", "the", "avatar", "to", "be", "updated", "." ]
train
https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-api/src/main/java/org/javacord/api/entity/webhook/WebhookUpdater.java#L85-L88
alkacon/opencms-core
src/org/opencms/ade/sitemap/CmsModelPageHelper.java
CmsModelPageHelper.setDefaultModelPage
CmsModelInfo setDefaultModelPage(CmsResource configFile, CmsUUID modelId) throws CmsException { """ Sets the default model page within the given configuration file.<p> @param configFile the configuration file @param modelId the default model id @return the updated model configuration @throws CmsException in case something goes wrong """ CmsFile file = m_cms.readFile(configFile); CmsXmlContent content = CmsXmlContentFactory.unmarshal(m_cms, file); Locale locale = getLocale(content); int defaultValueIndex = -1; String defaultModelTarget = null; for (I_CmsXmlContentValue value : content.getValues(CmsConfigurationReader.N_MODEL_PAGE, locale)) { I_CmsXmlContentValue linkValue = content.getValue( CmsStringUtil.joinPaths(value.getPath(), CmsConfigurationReader.N_PAGE), locale); I_CmsXmlContentValue isDefaultValue = content.getValue( CmsStringUtil.joinPaths(value.getPath(), CmsConfigurationReader.N_IS_DEFAULT), locale); CmsLink link = ((CmsXmlVfsFileValue)linkValue).getLink(m_cms); if ((link != null) && link.getStructureId().equals(modelId)) { // store index and site path defaultValueIndex = value.getIndex(); defaultModelTarget = link.getTarget(); } else { isDefaultValue.setStringValue(m_cms, Boolean.FALSE.toString()); } } if (defaultValueIndex != -1) { // remove the value from the old position and insert it a the top content.removeValue(CmsConfigurationReader.N_MODEL_PAGE, locale, defaultValueIndex); content.addValue(m_cms, CmsConfigurationReader.N_MODEL_PAGE, locale, 0); content.getValue( CmsConfigurationReader.N_MODEL_PAGE + "[1]/" + CmsConfigurationReader.N_PAGE, locale).setStringValue(m_cms, defaultModelTarget); content.getValue( CmsConfigurationReader.N_MODEL_PAGE + "[1]/" + CmsConfigurationReader.N_DISABLED, locale).setStringValue(m_cms, Boolean.FALSE.toString()); content.getValue( CmsConfigurationReader.N_MODEL_PAGE + "[1]/" + CmsConfigurationReader.N_IS_DEFAULT, locale).setStringValue(m_cms, Boolean.TRUE.toString()); } content.setAutoCorrectionEnabled(true); content.correctXmlStructure(m_cms); file.setContents(content.marshal()); m_cms.writeFile(file); OpenCms.getADEManager().waitForCacheUpdate(false); m_adeConfig = OpenCms.getADEManager().lookupConfiguration(m_cms, m_rootResource.getRootPath()); return getModelInfo(); }
java
CmsModelInfo setDefaultModelPage(CmsResource configFile, CmsUUID modelId) throws CmsException { CmsFile file = m_cms.readFile(configFile); CmsXmlContent content = CmsXmlContentFactory.unmarshal(m_cms, file); Locale locale = getLocale(content); int defaultValueIndex = -1; String defaultModelTarget = null; for (I_CmsXmlContentValue value : content.getValues(CmsConfigurationReader.N_MODEL_PAGE, locale)) { I_CmsXmlContentValue linkValue = content.getValue( CmsStringUtil.joinPaths(value.getPath(), CmsConfigurationReader.N_PAGE), locale); I_CmsXmlContentValue isDefaultValue = content.getValue( CmsStringUtil.joinPaths(value.getPath(), CmsConfigurationReader.N_IS_DEFAULT), locale); CmsLink link = ((CmsXmlVfsFileValue)linkValue).getLink(m_cms); if ((link != null) && link.getStructureId().equals(modelId)) { // store index and site path defaultValueIndex = value.getIndex(); defaultModelTarget = link.getTarget(); } else { isDefaultValue.setStringValue(m_cms, Boolean.FALSE.toString()); } } if (defaultValueIndex != -1) { // remove the value from the old position and insert it a the top content.removeValue(CmsConfigurationReader.N_MODEL_PAGE, locale, defaultValueIndex); content.addValue(m_cms, CmsConfigurationReader.N_MODEL_PAGE, locale, 0); content.getValue( CmsConfigurationReader.N_MODEL_PAGE + "[1]/" + CmsConfigurationReader.N_PAGE, locale).setStringValue(m_cms, defaultModelTarget); content.getValue( CmsConfigurationReader.N_MODEL_PAGE + "[1]/" + CmsConfigurationReader.N_DISABLED, locale).setStringValue(m_cms, Boolean.FALSE.toString()); content.getValue( CmsConfigurationReader.N_MODEL_PAGE + "[1]/" + CmsConfigurationReader.N_IS_DEFAULT, locale).setStringValue(m_cms, Boolean.TRUE.toString()); } content.setAutoCorrectionEnabled(true); content.correctXmlStructure(m_cms); file.setContents(content.marshal()); m_cms.writeFile(file); OpenCms.getADEManager().waitForCacheUpdate(false); m_adeConfig = OpenCms.getADEManager().lookupConfiguration(m_cms, m_rootResource.getRootPath()); return getModelInfo(); }
[ "CmsModelInfo", "setDefaultModelPage", "(", "CmsResource", "configFile", ",", "CmsUUID", "modelId", ")", "throws", "CmsException", "{", "CmsFile", "file", "=", "m_cms", ".", "readFile", "(", "configFile", ")", ";", "CmsXmlContent", "content", "=", "CmsXmlContentFact...
Sets the default model page within the given configuration file.<p> @param configFile the configuration file @param modelId the default model id @return the updated model configuration @throws CmsException in case something goes wrong
[ "Sets", "the", "default", "model", "page", "within", "the", "given", "configuration", "file", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/sitemap/CmsModelPageHelper.java#L471-L515
sarxos/win-registry
src/main/java/com/github/sarxos/winreg/WindowsRegistry.java
WindowsRegistry.readStringValues
public Map<String, String> readStringValues(HKey hk, String key) throws RegistryException { """ Read value(s) and value name(s) form given key @param hk the HKEY @param key the key @return the value name(s) plus the value(s) @throws RegistryException when something is not right """ return readStringValues(hk, key, null); }
java
public Map<String, String> readStringValues(HKey hk, String key) throws RegistryException { return readStringValues(hk, key, null); }
[ "public", "Map", "<", "String", ",", "String", ">", "readStringValues", "(", "HKey", "hk", ",", "String", "key", ")", "throws", "RegistryException", "{", "return", "readStringValues", "(", "hk", ",", "key", ",", "null", ")", ";", "}" ]
Read value(s) and value name(s) form given key @param hk the HKEY @param key the key @return the value name(s) plus the value(s) @throws RegistryException when something is not right
[ "Read", "value", "(", "s", ")", "and", "value", "name", "(", "s", ")", "form", "given", "key" ]
train
https://github.com/sarxos/win-registry/blob/5ccbe2157ae0ee894de7c41bec4bd7b1e0f5c437/src/main/java/com/github/sarxos/winreg/WindowsRegistry.java#L75-L77
Jasig/uPortal
uPortal-groups/uPortal-groups-core/src/main/java/org/apereo/portal/groups/RDBMEntityGroupStore.java
RDBMEntityGroupStore.primUpdate
private void primUpdate(IEntityGroup group, Connection conn) throws SQLException, GroupsException { """ Update the entity in the database. @param group IEntityGroup @param conn the database connection """ try { PreparedStatement ps = conn.prepareStatement(getUpdateGroupSql()); try { Integer typeID = EntityTypesLocator.getEntityTypes() .getEntityIDFromType(group.getLeafType()); ps.setString(1, group.getCreatorID()); ps.setInt(2, typeID.intValue()); ps.setString(3, group.getName()); ps.setString(4, group.getDescription()); ps.setString(5, group.getLocalKey()); if (LOG.isDebugEnabled()) LOG.debug( "RDBMEntityGroupStore.primUpdate(): " + ps + "(" + group.getCreatorID() + ", " + typeID + ", " + group.getName() + ", " + group.getDescription() + ", " + group.getLocalKey() + ")"); int rc = ps.executeUpdate(); if (rc != 1) { String errString = "Problem updating " + group; LOG.error(errString); throw new GroupsException(errString); } } finally { ps.close(); } } catch (SQLException sqle) { LOG.error("Error updating entity in database. Group: " + group, sqle); throw sqle; } }
java
private void primUpdate(IEntityGroup group, Connection conn) throws SQLException, GroupsException { try { PreparedStatement ps = conn.prepareStatement(getUpdateGroupSql()); try { Integer typeID = EntityTypesLocator.getEntityTypes() .getEntityIDFromType(group.getLeafType()); ps.setString(1, group.getCreatorID()); ps.setInt(2, typeID.intValue()); ps.setString(3, group.getName()); ps.setString(4, group.getDescription()); ps.setString(5, group.getLocalKey()); if (LOG.isDebugEnabled()) LOG.debug( "RDBMEntityGroupStore.primUpdate(): " + ps + "(" + group.getCreatorID() + ", " + typeID + ", " + group.getName() + ", " + group.getDescription() + ", " + group.getLocalKey() + ")"); int rc = ps.executeUpdate(); if (rc != 1) { String errString = "Problem updating " + group; LOG.error(errString); throw new GroupsException(errString); } } finally { ps.close(); } } catch (SQLException sqle) { LOG.error("Error updating entity in database. Group: " + group, sqle); throw sqle; } }
[ "private", "void", "primUpdate", "(", "IEntityGroup", "group", ",", "Connection", "conn", ")", "throws", "SQLException", ",", "GroupsException", "{", "try", "{", "PreparedStatement", "ps", "=", "conn", ".", "prepareStatement", "(", "getUpdateGroupSql", "(", ")", ...
Update the entity in the database. @param group IEntityGroup @param conn the database connection
[ "Update", "the", "entity", "in", "the", "database", "." ]
train
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-groups/uPortal-groups-core/src/main/java/org/apereo/portal/groups/RDBMEntityGroupStore.java#L1155-L1201
alkacon/opencms-core
src-modules/org/opencms/workplace/list/CmsHtmlList.java
CmsHtmlList.htmlPageSelector
public static String htmlPageSelector(int nrPages, int itemsPage, int nrItems, int curPage, Locale locale) { """ Generates the list of html option elements for a html select control to select a page of a list.<p> @param nrPages the total number of pages @param itemsPage the maximum number of items per page @param nrItems the total number of items @param curPage the current page @param locale the locale @return html code """ StringBuffer html = new StringBuffer(256); for (int i = 0; i < nrPages; i++) { int displayedFrom = (i * itemsPage) + 1; int displayedTo = ((i + 1) * itemsPage) < nrItems ? (i + 1) * itemsPage : nrItems; html.append("\t\t\t\t<option value='"); html.append(i + 1); html.append("'"); html.append((i + 1) == curPage ? " selected" : ""); html.append(">"); html.append( Messages.get().getBundle(locale).key( Messages.GUI_LIST_PAGE_ENTRY_3, new Integer(i + 1), new Integer(displayedFrom), new Integer(displayedTo))); html.append("</option>\n"); } return html.toString(); }
java
public static String htmlPageSelector(int nrPages, int itemsPage, int nrItems, int curPage, Locale locale) { StringBuffer html = new StringBuffer(256); for (int i = 0; i < nrPages; i++) { int displayedFrom = (i * itemsPage) + 1; int displayedTo = ((i + 1) * itemsPage) < nrItems ? (i + 1) * itemsPage : nrItems; html.append("\t\t\t\t<option value='"); html.append(i + 1); html.append("'"); html.append((i + 1) == curPage ? " selected" : ""); html.append(">"); html.append( Messages.get().getBundle(locale).key( Messages.GUI_LIST_PAGE_ENTRY_3, new Integer(i + 1), new Integer(displayedFrom), new Integer(displayedTo))); html.append("</option>\n"); } return html.toString(); }
[ "public", "static", "String", "htmlPageSelector", "(", "int", "nrPages", ",", "int", "itemsPage", ",", "int", "nrItems", ",", "int", "curPage", ",", "Locale", "locale", ")", "{", "StringBuffer", "html", "=", "new", "StringBuffer", "(", "256", ")", ";", "fo...
Generates the list of html option elements for a html select control to select a page of a list.<p> @param nrPages the total number of pages @param itemsPage the maximum number of items per page @param nrItems the total number of items @param curPage the current page @param locale the locale @return html code
[ "Generates", "the", "list", "of", "html", "option", "elements", "for", "a", "html", "select", "control", "to", "select", "a", "page", "of", "a", "list", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/list/CmsHtmlList.java#L147-L167
landawn/AbacusUtil
src/com/landawn/abacus/util/ShortList.java
ShortList.reduce
public <E extends Exception> short reduce(final short identity, final Try.ShortBinaryOperator<E> accumulator) throws E { """ This is equivalent to: <pre> <code> if (isEmpty()) { return identity; } short result = identity; for (int i = 0; i < size; i++) { result = accumulator.applyAsShort(result, elementData[i]); } return result; </code> </pre> @param identity @param accumulator @return """ if (isEmpty()) { return identity; } short result = identity; for (int i = 0; i < size; i++) { result = accumulator.applyAsShort(result, elementData[i]); } return result; }
java
public <E extends Exception> short reduce(final short identity, final Try.ShortBinaryOperator<E> accumulator) throws E { if (isEmpty()) { return identity; } short result = identity; for (int i = 0; i < size; i++) { result = accumulator.applyAsShort(result, elementData[i]); } return result; }
[ "public", "<", "E", "extends", "Exception", ">", "short", "reduce", "(", "final", "short", "identity", ",", "final", "Try", ".", "ShortBinaryOperator", "<", "E", ">", "accumulator", ")", "throws", "E", "{", "if", "(", "isEmpty", "(", ")", ")", "{", "re...
This is equivalent to: <pre> <code> if (isEmpty()) { return identity; } short result = identity; for (int i = 0; i < size; i++) { result = accumulator.applyAsShort(result, elementData[i]); } return result; </code> </pre> @param identity @param accumulator @return
[ "This", "is", "equivalent", "to", ":", "<pre", ">", "<code", ">", "if", "(", "isEmpty", "()", ")", "{", "return", "identity", ";", "}" ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/ShortList.java#L1121-L1133
steveohara/j2mod
src/main/java/com/ghgande/j2mod/modbus/util/BitVector.java
BitVector.setBytes
public void setBytes(byte[] data, int size) { """ Sets the <tt>byte[]</tt> which stores the bits of this <tt>BitVector</tt>. <p> @param data a <tt>byte[]</tt>. @param size Size to set the bit vector to """ System.arraycopy(data, 0, this.data, 0, data.length); this.size = size; }
java
public void setBytes(byte[] data, int size) { System.arraycopy(data, 0, this.data, 0, data.length); this.size = size; }
[ "public", "void", "setBytes", "(", "byte", "[", "]", "data", ",", "int", "size", ")", "{", "System", ".", "arraycopy", "(", "data", ",", "0", ",", "this", ".", "data", ",", "0", ",", "data", ".", "length", ")", ";", "this", ".", "size", "=", "s...
Sets the <tt>byte[]</tt> which stores the bits of this <tt>BitVector</tt>. <p> @param data a <tt>byte[]</tt>. @param size Size to set the bit vector to
[ "Sets", "the", "<tt", ">", "byte", "[]", "<", "/", "tt", ">", "which", "stores", "the", "bits", "of", "this", "<tt", ">", "BitVector<", "/", "tt", ">", ".", "<p", ">" ]
train
https://github.com/steveohara/j2mod/blob/67162c55d7c02564e50211a9df06b8314953b5f2/src/main/java/com/ghgande/j2mod/modbus/util/BitVector.java#L184-L187
UrielCh/ovh-java-sdk
ovh-java-sdk-deskaas/src/main/java/net/minidev/ovh/api/ApiOvhDeskaas.java
ApiOvhDeskaas.serviceName_changeContact_POST
public ArrayList<Long> serviceName_changeContact_POST(String serviceName, String contactAdmin, String contactBilling, String contactTech) throws IOException { """ Launch a contact change procedure REST: POST /deskaas/{serviceName}/changeContact @param contactAdmin The contact to set as admin contact @param contactTech The contact to set as tech contact @param contactBilling The contact to set as billing contact @param serviceName [required] Domain of the service """ String qPath = "/deskaas/{serviceName}/changeContact"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "contactAdmin", contactAdmin); addBody(o, "contactBilling", contactBilling); addBody(o, "contactTech", contactTech); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, t1); }
java
public ArrayList<Long> serviceName_changeContact_POST(String serviceName, String contactAdmin, String contactBilling, String contactTech) throws IOException { String qPath = "/deskaas/{serviceName}/changeContact"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "contactAdmin", contactAdmin); addBody(o, "contactBilling", contactBilling); addBody(o, "contactTech", contactTech); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, t1); }
[ "public", "ArrayList", "<", "Long", ">", "serviceName_changeContact_POST", "(", "String", "serviceName", ",", "String", "contactAdmin", ",", "String", "contactBilling", ",", "String", "contactTech", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/desk...
Launch a contact change procedure REST: POST /deskaas/{serviceName}/changeContact @param contactAdmin The contact to set as admin contact @param contactTech The contact to set as tech contact @param contactBilling The contact to set as billing contact @param serviceName [required] Domain of the service
[ "Launch", "a", "contact", "change", "procedure" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-deskaas/src/main/java/net/minidev/ovh/api/ApiOvhDeskaas.java#L301-L310
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/cache/cachepolicylabel.java
cachepolicylabel.get
public static cachepolicylabel get(nitro_service service, String labelname) throws Exception { """ Use this API to fetch cachepolicylabel resource of given name . """ cachepolicylabel obj = new cachepolicylabel(); obj.set_labelname(labelname); cachepolicylabel response = (cachepolicylabel) obj.get_resource(service); return response; }
java
public static cachepolicylabel get(nitro_service service, String labelname) throws Exception{ cachepolicylabel obj = new cachepolicylabel(); obj.set_labelname(labelname); cachepolicylabel response = (cachepolicylabel) obj.get_resource(service); return response; }
[ "public", "static", "cachepolicylabel", "get", "(", "nitro_service", "service", ",", "String", "labelname", ")", "throws", "Exception", "{", "cachepolicylabel", "obj", "=", "new", "cachepolicylabel", "(", ")", ";", "obj", ".", "set_labelname", "(", "labelname", ...
Use this API to fetch cachepolicylabel resource of given name .
[ "Use", "this", "API", "to", "fetch", "cachepolicylabel", "resource", "of", "given", "name", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/cache/cachepolicylabel.java#L325-L330
raphw/byte-buddy
byte-buddy-dep/src/main/java/net/bytebuddy/asm/ModifierAdjustment.java
ModifierAdjustment.withTypeModifiers
public ModifierAdjustment withTypeModifiers(ElementMatcher<? super TypeDescription> matcher, ModifierContributor.ForType... modifierContributor) { """ Adjusts an instrumented type's modifiers if it matches the supplied matcher. @param matcher The matcher that determines a type's eligibility. @param modifierContributor The modifier contributors to enforce. @return A new modifier adjustment that enforces the given modifier contributors and any previous adjustments. """ return withTypeModifiers(matcher, Arrays.asList(modifierContributor)); }
java
public ModifierAdjustment withTypeModifiers(ElementMatcher<? super TypeDescription> matcher, ModifierContributor.ForType... modifierContributor) { return withTypeModifiers(matcher, Arrays.asList(modifierContributor)); }
[ "public", "ModifierAdjustment", "withTypeModifiers", "(", "ElementMatcher", "<", "?", "super", "TypeDescription", ">", "matcher", ",", "ModifierContributor", ".", "ForType", "...", "modifierContributor", ")", "{", "return", "withTypeModifiers", "(", "matcher", ",", "A...
Adjusts an instrumented type's modifiers if it matches the supplied matcher. @param matcher The matcher that determines a type's eligibility. @param modifierContributor The modifier contributors to enforce. @return A new modifier adjustment that enforces the given modifier contributors and any previous adjustments.
[ "Adjusts", "an", "instrumented", "type", "s", "modifiers", "if", "it", "matches", "the", "supplied", "matcher", "." ]
train
https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/asm/ModifierAdjustment.java#L119-L122
notnoop/java-apns
src/main/java/com/notnoop/apns/ApnsServiceBuilder.java
ApnsServiceBuilder.withAuthProxy
public ApnsServiceBuilder withAuthProxy(Proxy proxy, String proxyUsername, String proxyPassword) { """ Specify the proxy and the authentication parameters to be used to establish the connections to Apple Servers. <p>Read the <a href="http://java.sun.com/javase/6/docs/technotes/guides/net/proxies.html"> Java Networking and Proxies</a> guide to understand the proxies complexity. @param proxy the proxy object to be used to create connections @param proxyUsername a String object representing the username of the proxy server @param proxyPassword a String object representing the password of the proxy server @return this """ this.proxy = proxy; this.proxyUsername = proxyUsername; this.proxyPassword = proxyPassword; return this; }
java
public ApnsServiceBuilder withAuthProxy(Proxy proxy, String proxyUsername, String proxyPassword) { this.proxy = proxy; this.proxyUsername = proxyUsername; this.proxyPassword = proxyPassword; return this; }
[ "public", "ApnsServiceBuilder", "withAuthProxy", "(", "Proxy", "proxy", ",", "String", "proxyUsername", ",", "String", "proxyPassword", ")", "{", "this", ".", "proxy", "=", "proxy", ";", "this", ".", "proxyUsername", "=", "proxyUsername", ";", "this", ".", "pr...
Specify the proxy and the authentication parameters to be used to establish the connections to Apple Servers. <p>Read the <a href="http://java.sun.com/javase/6/docs/technotes/guides/net/proxies.html"> Java Networking and Proxies</a> guide to understand the proxies complexity. @param proxy the proxy object to be used to create connections @param proxyUsername a String object representing the username of the proxy server @param proxyPassword a String object representing the password of the proxy server @return this
[ "Specify", "the", "proxy", "and", "the", "authentication", "parameters", "to", "be", "used", "to", "establish", "the", "connections", "to", "Apple", "Servers", "." ]
train
https://github.com/notnoop/java-apns/blob/180a190d4cb49458441596ca7c69d50ec7f1dba5/src/main/java/com/notnoop/apns/ApnsServiceBuilder.java#L488-L493
bladecoder/blade-ink
src/main/java/com/bladecoder/ink/runtime/Story.java
Story.evaluateFunction
public Object evaluateFunction(String functionName, StringBuilder textOutput, Object[] arguments) throws Exception { """ Evaluates a function defined in ink, and gathers the possibly multi-line text as generated by the function. @param arguments The arguments that the ink function takes, if any. Note that we don't (can't) do any validation on the number of arguments right now, so make sure you get it right! @param functionName The name of the function as declared in ink. @param textOutput This text output is any text written as normal content within the function, as opposed to the return value, as returned with `~ return`. @return The return value as returned from the ink function with `~ return myValue`, or null if nothing is returned. @throws Exception """ ifAsyncWeCant("evaluate a function"); if (functionName == null) { throw new Exception("Function is null"); } else if (functionName.trim().isEmpty()) { throw new Exception("Function is empty or white space."); } // Get the content that we need to run Container funcContainer = knotContainerWithName(functionName); if (funcContainer == null) throw new Exception("Function doesn't exist: '" + functionName + "'"); // Snapshot the output stream ArrayList<RTObject> outputStreamBefore = new ArrayList<RTObject>(state.getOutputStream()); state.resetOutput(); // State will temporarily replace the callstack in order to evaluate state.startFunctionEvaluationFromGame(funcContainer, arguments); // Evaluate the function, and collect the string output while (canContinue()) { String text = Continue(); if (textOutput != null) textOutput.append(text); } // Restore the output stream in case this was called // during main story evaluation. state.resetOutput(outputStreamBefore); // Finish evaluation, and see whether anything was produced Object result = state.completeFunctionEvaluationFromGame(); return result; }
java
public Object evaluateFunction(String functionName, StringBuilder textOutput, Object[] arguments) throws Exception { ifAsyncWeCant("evaluate a function"); if (functionName == null) { throw new Exception("Function is null"); } else if (functionName.trim().isEmpty()) { throw new Exception("Function is empty or white space."); } // Get the content that we need to run Container funcContainer = knotContainerWithName(functionName); if (funcContainer == null) throw new Exception("Function doesn't exist: '" + functionName + "'"); // Snapshot the output stream ArrayList<RTObject> outputStreamBefore = new ArrayList<RTObject>(state.getOutputStream()); state.resetOutput(); // State will temporarily replace the callstack in order to evaluate state.startFunctionEvaluationFromGame(funcContainer, arguments); // Evaluate the function, and collect the string output while (canContinue()) { String text = Continue(); if (textOutput != null) textOutput.append(text); } // Restore the output stream in case this was called // during main story evaluation. state.resetOutput(outputStreamBefore); // Finish evaluation, and see whether anything was produced Object result = state.completeFunctionEvaluationFromGame(); return result; }
[ "public", "Object", "evaluateFunction", "(", "String", "functionName", ",", "StringBuilder", "textOutput", ",", "Object", "[", "]", "arguments", ")", "throws", "Exception", "{", "ifAsyncWeCant", "(", "\"evaluate a function\"", ")", ";", "if", "(", "functionName", ...
Evaluates a function defined in ink, and gathers the possibly multi-line text as generated by the function. @param arguments The arguments that the ink function takes, if any. Note that we don't (can't) do any validation on the number of arguments right now, so make sure you get it right! @param functionName The name of the function as declared in ink. @param textOutput This text output is any text written as normal content within the function, as opposed to the return value, as returned with `~ return`. @return The return value as returned from the ink function with `~ return myValue`, or null if nothing is returned. @throws Exception
[ "Evaluates", "a", "function", "defined", "in", "ink", "and", "gathers", "the", "possibly", "multi", "-", "line", "text", "as", "generated", "by", "the", "function", "." ]
train
https://github.com/bladecoder/blade-ink/blob/930922099f7073f50f956479adaa3cbd47c70225/src/main/java/com/bladecoder/ink/runtime/Story.java#L2419-L2455
awslabs/jsii
packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiObject.java
JsiiObject.jsiiGet
@Nullable protected final <T> T jsiiGet(final String property, final Class<T> type) { """ Gets a property value from the object. @param property The property name. @param type The Java type of the property. @param <T> The Java type of the property. @return The property value. """ return JsiiObjectMapper.treeToValue(engine.getClient().getPropertyValue(this.objRef, property), type); }
java
@Nullable protected final <T> T jsiiGet(final String property, final Class<T> type) { return JsiiObjectMapper.treeToValue(engine.getClient().getPropertyValue(this.objRef, property), type); }
[ "@", "Nullable", "protected", "final", "<", "T", ">", "T", "jsiiGet", "(", "final", "String", "property", ",", "final", "Class", "<", "T", ">", "type", ")", "{", "return", "JsiiObjectMapper", ".", "treeToValue", "(", "engine", ".", "getClient", "(", ")",...
Gets a property value from the object. @param property The property name. @param type The Java type of the property. @param <T> The Java type of the property. @return The property value.
[ "Gets", "a", "property", "value", "from", "the", "object", "." ]
train
https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiObject.java#L105-L108
OpenLiberty/open-liberty
dev/com.ibm.ws.webserver.plugin.utility/src/com/ibm/ws/webserver/plugin/utility/utils/CommonMBeanConnection.java
CommonMBeanConnection.getJMXConnector
public JMXConnector getJMXConnector(String controllerHost, int controllerPort, String user, String password) throws NoSuchAlgorithmException, KeyManagementException, MalformedURLException, IOException { """ Returns a connected JMXConnector. @param controllerHost @param controllerPort @param user @param password @return @throws NoSuchAlgorithmException @throws KeyManagementException @throws MalformedURLException @throws IOException """ HashMap<String, Object> environment = createJMXEnvironment(user, password, setUpSSLContext()); JMXConnector connector = getMBeanServerConnection(controllerHost, controllerPort, environment); connector.connect(); return connector; }
java
public JMXConnector getJMXConnector(String controllerHost, int controllerPort, String user, String password) throws NoSuchAlgorithmException, KeyManagementException, MalformedURLException, IOException { HashMap<String, Object> environment = createJMXEnvironment(user, password, setUpSSLContext()); JMXConnector connector = getMBeanServerConnection(controllerHost, controllerPort, environment); connector.connect(); return connector; }
[ "public", "JMXConnector", "getJMXConnector", "(", "String", "controllerHost", ",", "int", "controllerPort", ",", "String", "user", ",", "String", "password", ")", "throws", "NoSuchAlgorithmException", ",", "KeyManagementException", ",", "MalformedURLException", ",", "IO...
Returns a connected JMXConnector. @param controllerHost @param controllerPort @param user @param password @return @throws NoSuchAlgorithmException @throws KeyManagementException @throws MalformedURLException @throws IOException
[ "Returns", "a", "connected", "JMXConnector", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webserver.plugin.utility/src/com/ibm/ws/webserver/plugin/utility/utils/CommonMBeanConnection.java#L132-L137
maguro/aunit
junit/src/main/java/com/toolazydogs/aunit/Assert.java
Assert.assertTree
public static void assertTree(int rootType, String preorder, ParseResults parseResults) { """ Asserts a parse tree. @param rootType the type of the root of the tree. @param preorder the preorder traversal of the tree. @param parseResults a helper class """ assertTree(rootType, preorder, parseResults.getTree()); }
java
public static void assertTree(int rootType, String preorder, ParseResults parseResults) { assertTree(rootType, preorder, parseResults.getTree()); }
[ "public", "static", "void", "assertTree", "(", "int", "rootType", ",", "String", "preorder", ",", "ParseResults", "parseResults", ")", "{", "assertTree", "(", "rootType", ",", "preorder", ",", "parseResults", ".", "getTree", "(", ")", ")", ";", "}" ]
Asserts a parse tree. @param rootType the type of the root of the tree. @param preorder the preorder traversal of the tree. @param parseResults a helper class
[ "Asserts", "a", "parse", "tree", "." ]
train
https://github.com/maguro/aunit/blob/1f972e35b28327e5e2e7881befc928df0546d74c/junit/src/main/java/com/toolazydogs/aunit/Assert.java#L230-L233
Stratio/deep-spark
deep-commons/src/main/java/com/stratio/deep/commons/utils/Utils.java
Utils.newBlockingFixedThreadPoolExecutor
public static ExecutorService newBlockingFixedThreadPoolExecutor(int nThreads, int queueSize) { """ Returns an instance of ThreadPoolExecutor using an bounded queue and blocking when the worker queue is full. @param nThreads thread pool size @param queueSize workers queue size @return thread pool executor """ BlockingQueue<Runnable> blockingQueue = new ArrayBlockingQueue<>(queueSize); RejectedExecutionHandler blockingRejectedExecutionHandler = new RejectedExecutionHandler() { @Override public void rejectedExecution(Runnable task, ThreadPoolExecutor executor) { try { executor.getQueue().put(task); } catch (InterruptedException e) { } } }; return new ThreadPoolExecutor(nThreads, nThreads, 0L, TimeUnit.MILLISECONDS, blockingQueue, blockingRejectedExecutionHandler); }
java
public static ExecutorService newBlockingFixedThreadPoolExecutor(int nThreads, int queueSize) { BlockingQueue<Runnable> blockingQueue = new ArrayBlockingQueue<>(queueSize); RejectedExecutionHandler blockingRejectedExecutionHandler = new RejectedExecutionHandler() { @Override public void rejectedExecution(Runnable task, ThreadPoolExecutor executor) { try { executor.getQueue().put(task); } catch (InterruptedException e) { } } }; return new ThreadPoolExecutor(nThreads, nThreads, 0L, TimeUnit.MILLISECONDS, blockingQueue, blockingRejectedExecutionHandler); }
[ "public", "static", "ExecutorService", "newBlockingFixedThreadPoolExecutor", "(", "int", "nThreads", ",", "int", "queueSize", ")", "{", "BlockingQueue", "<", "Runnable", ">", "blockingQueue", "=", "new", "ArrayBlockingQueue", "<>", "(", "queueSize", ")", ";", "Rejec...
Returns an instance of ThreadPoolExecutor using an bounded queue and blocking when the worker queue is full. @param nThreads thread pool size @param queueSize workers queue size @return thread pool executor
[ "Returns", "an", "instance", "of", "ThreadPoolExecutor", "using", "an", "bounded", "queue", "and", "blocking", "when", "the", "worker", "queue", "is", "full", "." ]
train
https://github.com/Stratio/deep-spark/blob/b9621c9b7a6d996f80fce1d073d696a157bed095/deep-commons/src/main/java/com/stratio/deep/commons/utils/Utils.java#L546-L562
BioPAX/Paxtools
paxtools-query/src/main/java/org/biopax/paxtools/query/QueryExecuter.java
QueryExecuter.runPathsFromTo
public static Set<BioPAXElement> runPathsFromTo( Set<BioPAXElement> sourceSet, Set<BioPAXElement> targetSet, Model model, LimitType limitType, int limit, Filter... filters) { """ Gets paths the graph composed of the paths from a source node, and ends at a target node. @param sourceSet Seeds for start points of paths @param targetSet Seeds for end points of paths @param model BioPAX model @param limitType either NORMAL or SHORTEST_PLUS_K @param limit Length limit fothe paths to be found @param filters for filtering graph elements @return BioPAX elements in the result """ Graph graph; if (model.getLevel() == BioPAXLevel.L3) { graph = new GraphL3(model, filters); } else return Collections.emptySet(); Set<Node> source = prepareSingleNodeSet(sourceSet, graph); Set<Node> target = prepareSingleNodeSet(targetSet, graph); PathsFromToQuery query = new PathsFromToQuery(source, target, limitType, limit, true); Set<GraphObject> resultWrappers = query.run(); return convertQueryResult(resultWrappers, graph, true); }
java
public static Set<BioPAXElement> runPathsFromTo( Set<BioPAXElement> sourceSet, Set<BioPAXElement> targetSet, Model model, LimitType limitType, int limit, Filter... filters) { Graph graph; if (model.getLevel() == BioPAXLevel.L3) { graph = new GraphL3(model, filters); } else return Collections.emptySet(); Set<Node> source = prepareSingleNodeSet(sourceSet, graph); Set<Node> target = prepareSingleNodeSet(targetSet, graph); PathsFromToQuery query = new PathsFromToQuery(source, target, limitType, limit, true); Set<GraphObject> resultWrappers = query.run(); return convertQueryResult(resultWrappers, graph, true); }
[ "public", "static", "Set", "<", "BioPAXElement", ">", "runPathsFromTo", "(", "Set", "<", "BioPAXElement", ">", "sourceSet", ",", "Set", "<", "BioPAXElement", ">", "targetSet", ",", "Model", "model", ",", "LimitType", "limitType", ",", "int", "limit", ",", "F...
Gets paths the graph composed of the paths from a source node, and ends at a target node. @param sourceSet Seeds for start points of paths @param targetSet Seeds for end points of paths @param model BioPAX model @param limitType either NORMAL or SHORTEST_PLUS_K @param limit Length limit fothe paths to be found @param filters for filtering graph elements @return BioPAX elements in the result
[ "Gets", "paths", "the", "graph", "composed", "of", "the", "paths", "from", "a", "source", "node", "and", "ends", "at", "a", "target", "node", "." ]
train
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/paxtools-query/src/main/java/org/biopax/paxtools/query/QueryExecuter.java#L195-L217
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/factory/feature/detect/extract/FactoryFeatureExtractor.java
FactoryFeatureExtractor.nonmaxCandidate
public static NonMaxSuppression nonmaxCandidate( @Nullable ConfigExtract config ) { """ Non-max feature extractor which saves a candidate list of all the found local maximums.. @param config Configuration for extractor @return A feature extractor. """ if( config == null ) config = new ConfigExtract(); config.checkValidity(); if( BOverrideFactoryFeatureExtractor.nonmaxCandidate != null ) { return BOverrideFactoryFeatureExtractor.nonmaxCandidate.process(config); } NonMaxCandidate.Search search; // no need to check the detection max/min since these algorithms can handle both if (config.useStrictRule) { search = new NonMaxCandidate.Strict(); } else { search = new NonMaxCandidate.Relaxed(); } // See if the user wants to use threaded code or not NonMaxCandidate extractor = BoofConcurrency.USE_CONCURRENT? new NonMaxCandidate_MT(search):new NonMaxCandidate(search); WrapperNonMaxCandidate ret = new WrapperNonMaxCandidate(extractor,false,true); ret.setSearchRadius(config.radius); ret.setIgnoreBorder(config.ignoreBorder); ret.setThresholdMaximum(config.threshold); return ret; }
java
public static NonMaxSuppression nonmaxCandidate( @Nullable ConfigExtract config ) { if( config == null ) config = new ConfigExtract(); config.checkValidity(); if( BOverrideFactoryFeatureExtractor.nonmaxCandidate != null ) { return BOverrideFactoryFeatureExtractor.nonmaxCandidate.process(config); } NonMaxCandidate.Search search; // no need to check the detection max/min since these algorithms can handle both if (config.useStrictRule) { search = new NonMaxCandidate.Strict(); } else { search = new NonMaxCandidate.Relaxed(); } // See if the user wants to use threaded code or not NonMaxCandidate extractor = BoofConcurrency.USE_CONCURRENT? new NonMaxCandidate_MT(search):new NonMaxCandidate(search); WrapperNonMaxCandidate ret = new WrapperNonMaxCandidate(extractor,false,true); ret.setSearchRadius(config.radius); ret.setIgnoreBorder(config.ignoreBorder); ret.setThresholdMaximum(config.threshold); return ret; }
[ "public", "static", "NonMaxSuppression", "nonmaxCandidate", "(", "@", "Nullable", "ConfigExtract", "config", ")", "{", "if", "(", "config", "==", "null", ")", "config", "=", "new", "ConfigExtract", "(", ")", ";", "config", ".", "checkValidity", "(", ")", ";"...
Non-max feature extractor which saves a candidate list of all the found local maximums.. @param config Configuration for extractor @return A feature extractor.
[ "Non", "-", "max", "feature", "extractor", "which", "saves", "a", "candidate", "list", "of", "all", "the", "found", "local", "maximums", ".." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/factory/feature/detect/extract/FactoryFeatureExtractor.java#L110-L140
Alluxio/alluxio
core/server/common/src/main/java/alluxio/master/journal/ufs/UfsJournalFile.java
UfsJournalFile.encodeLogFileLocation
static URI encodeLogFileLocation(UfsJournal journal, long start, long end) { """ Encodes a log location under the log directory. @param journal the UFS journal instance @param start the start sequence number (inclusive) @param end the end sequence number (exclusive) @return the location """ String filename = String.format("0x%x-0x%x", start, end); URI location = URIUtils.appendPathOrDie(journal.getLogDir(), filename); return location; }
java
static URI encodeLogFileLocation(UfsJournal journal, long start, long end) { String filename = String.format("0x%x-0x%x", start, end); URI location = URIUtils.appendPathOrDie(journal.getLogDir(), filename); return location; }
[ "static", "URI", "encodeLogFileLocation", "(", "UfsJournal", "journal", ",", "long", "start", ",", "long", "end", ")", "{", "String", "filename", "=", "String", ".", "format", "(", "\"0x%x-0x%x\"", ",", "start", ",", "end", ")", ";", "URI", "location", "="...
Encodes a log location under the log directory. @param journal the UFS journal instance @param start the start sequence number (inclusive) @param end the end sequence number (exclusive) @return the location
[ "Encodes", "a", "log", "location", "under", "the", "log", "directory", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/common/src/main/java/alluxio/master/journal/ufs/UfsJournalFile.java#L127-L131
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/authentication/authenticationvserver_binding.java
authenticationvserver_binding.get
public static authenticationvserver_binding get(nitro_service service, String name) throws Exception { """ Use this API to fetch authenticationvserver_binding resource of given name . """ authenticationvserver_binding obj = new authenticationvserver_binding(); obj.set_name(name); authenticationvserver_binding response = (authenticationvserver_binding) obj.get_resource(service); return response; }
java
public static authenticationvserver_binding get(nitro_service service, String name) throws Exception{ authenticationvserver_binding obj = new authenticationvserver_binding(); obj.set_name(name); authenticationvserver_binding response = (authenticationvserver_binding) obj.get_resource(service); return response; }
[ "public", "static", "authenticationvserver_binding", "get", "(", "nitro_service", "service", ",", "String", "name", ")", "throws", "Exception", "{", "authenticationvserver_binding", "obj", "=", "new", "authenticationvserver_binding", "(", ")", ";", "obj", ".", "set_na...
Use this API to fetch authenticationvserver_binding resource of given name .
[ "Use", "this", "API", "to", "fetch", "authenticationvserver_binding", "resource", "of", "given", "name", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/authentication/authenticationvserver_binding.java#L202-L207
santhosh-tekuri/jlibs
core/src/main/java/jlibs/core/lang/Ansi.java
Ansi.outFormat
public void outFormat(String format, Object... args) { """ Prints formatted and colorized {@code format} to {@link System#out} @param format A format string whose output to be colorized @param args Arguments referenced by the format specifiers in the format """ format(System.out, format, args); }
java
public void outFormat(String format, Object... args){ format(System.out, format, args); }
[ "public", "void", "outFormat", "(", "String", "format", ",", "Object", "...", "args", ")", "{", "format", "(", "System", ".", "out", ",", "format", ",", "args", ")", ";", "}" ]
Prints formatted and colorized {@code format} to {@link System#out} @param format A format string whose output to be colorized @param args Arguments referenced by the format specifiers in the format
[ "Prints", "formatted", "and", "colorized", "{", "@code", "format", "}", "to", "{", "@link", "System#out", "}" ]
train
https://github.com/santhosh-tekuri/jlibs/blob/59c28719f054123cf778278154e1b92e943ad232/core/src/main/java/jlibs/core/lang/Ansi.java#L306-L308
lessthanoptimal/BoofCV
main/boofcv-sfm/src/main/java/boofcv/alg/sfm/d2/StitchingFromMotion2D.java
StitchingFromMotion2D.getImageCorners
public Corners getImageCorners( int width , int height , Corners corners ) { """ Returns the location of the input image's corners inside the stitch image. @return image corners """ if( corners == null ) corners = new Corners(); int w = width; int h = height; tranCurrToWorld.compute(0,0,work); corners.p0.set(work.x, work.y); tranCurrToWorld.compute(w,0,work); corners.p1.set(work.x, work.y); tranCurrToWorld.compute(w,h,work); corners.p2.set(work.x, work.y); tranCurrToWorld.compute(0,h,work); corners.p3.set(work.x, work.y); return corners; }
java
public Corners getImageCorners( int width , int height , Corners corners ) { if( corners == null ) corners = new Corners(); int w = width; int h = height; tranCurrToWorld.compute(0,0,work); corners.p0.set(work.x, work.y); tranCurrToWorld.compute(w,0,work); corners.p1.set(work.x, work.y); tranCurrToWorld.compute(w,h,work); corners.p2.set(work.x, work.y); tranCurrToWorld.compute(0,h,work); corners.p3.set(work.x, work.y); return corners; }
[ "public", "Corners", "getImageCorners", "(", "int", "width", ",", "int", "height", ",", "Corners", "corners", ")", "{", "if", "(", "corners", "==", "null", ")", "corners", "=", "new", "Corners", "(", ")", ";", "int", "w", "=", "width", ";", "int", "h...
Returns the location of the input image's corners inside the stitch image. @return image corners
[ "Returns", "the", "location", "of", "the", "input", "image", "s", "corners", "inside", "the", "stitch", "image", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-sfm/src/main/java/boofcv/alg/sfm/d2/StitchingFromMotion2D.java#L299-L313
xwiki/xwiki-commons
xwiki-commons-core/xwiki-commons-extension/xwiki-commons-extension-api/src/main/java/org/xwiki/extension/job/internal/UpgradePlanJob.java
UpgradePlanJob.tryInstallExtension
protected boolean tryInstallExtension(ExtensionId extensionId, String namespace) { """ Try to install the provided extension and update the plan if it's working. @param extensionId the extension version to install @param namespace the namespace where to install the extension @return true if the installation would succeed, false otherwise """ DefaultExtensionPlanTree currentTree = this.extensionTree.clone(); try { installExtension(extensionId, namespace, currentTree); setExtensionTree(currentTree); return true; } catch (InstallException e) { if (getRequest().isVerbose()) { this.logger.info(FAILED_INSTALL_MESSAGE, extensionId, namespace, e); } else { this.logger.debug(FAILED_INSTALL_MESSAGE, extensionId, namespace, e); } } return false; }
java
protected boolean tryInstallExtension(ExtensionId extensionId, String namespace) { DefaultExtensionPlanTree currentTree = this.extensionTree.clone(); try { installExtension(extensionId, namespace, currentTree); setExtensionTree(currentTree); return true; } catch (InstallException e) { if (getRequest().isVerbose()) { this.logger.info(FAILED_INSTALL_MESSAGE, extensionId, namespace, e); } else { this.logger.debug(FAILED_INSTALL_MESSAGE, extensionId, namespace, e); } } return false; }
[ "protected", "boolean", "tryInstallExtension", "(", "ExtensionId", "extensionId", ",", "String", "namespace", ")", "{", "DefaultExtensionPlanTree", "currentTree", "=", "this", ".", "extensionTree", ".", "clone", "(", ")", ";", "try", "{", "installExtension", "(", ...
Try to install the provided extension and update the plan if it's working. @param extensionId the extension version to install @param namespace the namespace where to install the extension @return true if the installation would succeed, false otherwise
[ "Try", "to", "install", "the", "provided", "extension", "and", "update", "the", "plan", "if", "it", "s", "working", "." ]
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/job/internal/UpgradePlanJob.java#L192-L211
pravega/pravega
segmentstore/server/src/main/java/io/pravega/segmentstore/server/containers/MetadataStore.java
MetadataStore.deleteSegment
CompletableFuture<Boolean> deleteSegment(String segmentName, Duration timeout) { """ Deletes a Segment and any associated information from the Metadata Store. Notes: - This method removes both the Segment and its Metadata Store entries. - {@link #clearSegmentInfo} only removes Metadata Store entries. This operation is made of multiple steps and is restart-able. If it was only able to execute partially before being interrupted (by an unexpected exception or system crash), a reinvocation should be able to pick up from where it left off previously. A partial invocation may leave the Segment in an undefined state, so it is highly recommended that such an interrupted call be reinvoked until successful. @param segmentName The case-sensitive Segment Name. @param timeout Timeout for the operation. @return A CompletableFuture that, when completed normally, will contain a Boolean indicating whether the Segment has been deleted (true means there was a Segment to delete, false means there was no segment to delete). If the operation failed, this will contain the exception that caused the failure. """ long traceId = LoggerHelpers.traceEnterWithContext(log, traceObjectId, "deleteSegment", segmentName); TimeoutTimer timer = new TimeoutTimer(timeout); // Find the Segment's Id. long segmentId = this.connector.containerMetadata.getStreamSegmentId(segmentName, true); CompletableFuture<Void> deleteSegment; if (isValidSegmentId(segmentId)) { // This segment is currently mapped in the ContainerMetadata. if (this.connector.containerMetadata.getStreamSegmentMetadata(segmentId).isDeleted()) { // ... but it is marked as Deleted, so nothing more we can do here. deleteSegment = CompletableFuture.completedFuture(null); } else { // Queue it up for deletion. This ensures that any component that is actively using it will be notified. deleteSegment = this.connector.getLazyDeleteSegment().apply(segmentId, timer.getRemaining()); } } else { // This segment is not currently mapped in the ContainerMetadata. As such, it is safe to delete it directly. deleteSegment = this.connector.getDirectDeleteSegment().apply(segmentName, timer.getRemaining()); } // It is OK if the previous action indicated the Segment was deleted. We still need to make sure that any traces // of this Segment are cleared from the Metadata Store as this invocation may be a retry of a previous partially // executed operation (where we only managed to delete the Segment, but not clear the Metadata). val result = Futures .exceptionallyExpecting(deleteSegment, ex -> ex instanceof StreamSegmentNotExistsException, null) .thenComposeAsync(ignored -> clearSegmentInfo(segmentName, timer.getRemaining()), this.executor); if (log.isTraceEnabled()) { deleteSegment.thenAccept(v -> LoggerHelpers.traceLeave(log, traceObjectId, "deleteSegment", traceId, segmentName)); } return result; }
java
CompletableFuture<Boolean> deleteSegment(String segmentName, Duration timeout) { long traceId = LoggerHelpers.traceEnterWithContext(log, traceObjectId, "deleteSegment", segmentName); TimeoutTimer timer = new TimeoutTimer(timeout); // Find the Segment's Id. long segmentId = this.connector.containerMetadata.getStreamSegmentId(segmentName, true); CompletableFuture<Void> deleteSegment; if (isValidSegmentId(segmentId)) { // This segment is currently mapped in the ContainerMetadata. if (this.connector.containerMetadata.getStreamSegmentMetadata(segmentId).isDeleted()) { // ... but it is marked as Deleted, so nothing more we can do here. deleteSegment = CompletableFuture.completedFuture(null); } else { // Queue it up for deletion. This ensures that any component that is actively using it will be notified. deleteSegment = this.connector.getLazyDeleteSegment().apply(segmentId, timer.getRemaining()); } } else { // This segment is not currently mapped in the ContainerMetadata. As such, it is safe to delete it directly. deleteSegment = this.connector.getDirectDeleteSegment().apply(segmentName, timer.getRemaining()); } // It is OK if the previous action indicated the Segment was deleted. We still need to make sure that any traces // of this Segment are cleared from the Metadata Store as this invocation may be a retry of a previous partially // executed operation (where we only managed to delete the Segment, but not clear the Metadata). val result = Futures .exceptionallyExpecting(deleteSegment, ex -> ex instanceof StreamSegmentNotExistsException, null) .thenComposeAsync(ignored -> clearSegmentInfo(segmentName, timer.getRemaining()), this.executor); if (log.isTraceEnabled()) { deleteSegment.thenAccept(v -> LoggerHelpers.traceLeave(log, traceObjectId, "deleteSegment", traceId, segmentName)); } return result; }
[ "CompletableFuture", "<", "Boolean", ">", "deleteSegment", "(", "String", "segmentName", ",", "Duration", "timeout", ")", "{", "long", "traceId", "=", "LoggerHelpers", ".", "traceEnterWithContext", "(", "log", ",", "traceObjectId", ",", "\"deleteSegment\"", ",", "...
Deletes a Segment and any associated information from the Metadata Store. Notes: - This method removes both the Segment and its Metadata Store entries. - {@link #clearSegmentInfo} only removes Metadata Store entries. This operation is made of multiple steps and is restart-able. If it was only able to execute partially before being interrupted (by an unexpected exception or system crash), a reinvocation should be able to pick up from where it left off previously. A partial invocation may leave the Segment in an undefined state, so it is highly recommended that such an interrupted call be reinvoked until successful. @param segmentName The case-sensitive Segment Name. @param timeout Timeout for the operation. @return A CompletableFuture that, when completed normally, will contain a Boolean indicating whether the Segment has been deleted (true means there was a Segment to delete, false means there was no segment to delete). If the operation failed, this will contain the exception that caused the failure.
[ "Deletes", "a", "Segment", "and", "any", "associated", "information", "from", "the", "Metadata", "Store", ".", "Notes", ":", "-", "This", "method", "removes", "both", "the", "Segment", "and", "its", "Metadata", "Store", "entries", ".", "-", "{", "@link", "...
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/containers/MetadataStore.java#L163-L195
hankcs/HanLP
src/main/java/com/hankcs/hanlp/collection/MDAG/MDAG.java
MDAG.addStringInternal
private void addStringInternal(String str) { """ Adds a String to the MDAG (called by addString to do actual MDAG manipulation). @param str the String to be added to the MDAG """ String prefixString = determineLongestPrefixInMDAG(str); String suffixString = str.substring(prefixString.length()); //Retrive the data related to the first confluence node (a node with two or more incoming transitions) //in the _transition path from sourceNode corresponding to prefixString. HashMap<String, Object> firstConfluenceNodeDataHashMap = getTransitionPathFirstConfluenceNodeData(sourceNode, prefixString); MDAGNode firstConfluenceNodeInPrefix = (MDAGNode) firstConfluenceNodeDataHashMap.get("confluenceNode"); Integer toFirstConfluenceNodeTransitionCharIndex = (Integer) firstConfluenceNodeDataHashMap.get("toConfluenceNodeTransitionCharIndex"); ///// //Remove the register entries of all the nodes in the prefixString _transition path up to the first confluence node //(those past the confluence node will not need to be removed since they will be cloned and unaffected by the //addition of suffixString). If there is no confluence node in prefixString, then remove the register entries in prefixString's entire _transition path removeTransitionPathRegisterEntries((toFirstConfluenceNodeTransitionCharIndex == null ? prefixString : prefixString.substring(0, toFirstConfluenceNodeTransitionCharIndex))); //If there is a confluence node in the prefix, we must duplicate the _transition path //of the prefix starting from that node, before we add suffixString (to the duplicate path). //This ensures that we do not disturb the other _transition paths containing this node. if (firstConfluenceNodeInPrefix != null) { String transitionStringOfPathToFirstConfluenceNode = prefixString.substring(0, toFirstConfluenceNodeTransitionCharIndex + 1); String transitionStringOfToBeDuplicatedPath = prefixString.substring(toFirstConfluenceNodeTransitionCharIndex + 1); cloneTransitionPath(firstConfluenceNodeInPrefix, transitionStringOfPathToFirstConfluenceNode, transitionStringOfToBeDuplicatedPath); } ///// //Add the _transition based on suffixString to the end of the (possibly duplicated) _transition path corresponding to prefixString addTransitionPath(sourceNode.transition(prefixString), suffixString); }
java
private void addStringInternal(String str) { String prefixString = determineLongestPrefixInMDAG(str); String suffixString = str.substring(prefixString.length()); //Retrive the data related to the first confluence node (a node with two or more incoming transitions) //in the _transition path from sourceNode corresponding to prefixString. HashMap<String, Object> firstConfluenceNodeDataHashMap = getTransitionPathFirstConfluenceNodeData(sourceNode, prefixString); MDAGNode firstConfluenceNodeInPrefix = (MDAGNode) firstConfluenceNodeDataHashMap.get("confluenceNode"); Integer toFirstConfluenceNodeTransitionCharIndex = (Integer) firstConfluenceNodeDataHashMap.get("toConfluenceNodeTransitionCharIndex"); ///// //Remove the register entries of all the nodes in the prefixString _transition path up to the first confluence node //(those past the confluence node will not need to be removed since they will be cloned and unaffected by the //addition of suffixString). If there is no confluence node in prefixString, then remove the register entries in prefixString's entire _transition path removeTransitionPathRegisterEntries((toFirstConfluenceNodeTransitionCharIndex == null ? prefixString : prefixString.substring(0, toFirstConfluenceNodeTransitionCharIndex))); //If there is a confluence node in the prefix, we must duplicate the _transition path //of the prefix starting from that node, before we add suffixString (to the duplicate path). //This ensures that we do not disturb the other _transition paths containing this node. if (firstConfluenceNodeInPrefix != null) { String transitionStringOfPathToFirstConfluenceNode = prefixString.substring(0, toFirstConfluenceNodeTransitionCharIndex + 1); String transitionStringOfToBeDuplicatedPath = prefixString.substring(toFirstConfluenceNodeTransitionCharIndex + 1); cloneTransitionPath(firstConfluenceNodeInPrefix, transitionStringOfPathToFirstConfluenceNode, transitionStringOfToBeDuplicatedPath); } ///// //Add the _transition based on suffixString to the end of the (possibly duplicated) _transition path corresponding to prefixString addTransitionPath(sourceNode.transition(prefixString), suffixString); }
[ "private", "void", "addStringInternal", "(", "String", "str", ")", "{", "String", "prefixString", "=", "determineLongestPrefixInMDAG", "(", "str", ")", ";", "String", "suffixString", "=", "str", ".", "substring", "(", "prefixString", ".", "length", "(", ")", "...
Adds a String to the MDAG (called by addString to do actual MDAG manipulation). @param str the String to be added to the MDAG
[ "Adds", "a", "String", "to", "the", "MDAG", "(", "called", "by", "addString", "to", "do", "actual", "MDAG", "manipulation", ")", "." ]
train
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/collection/MDAG/MDAG.java#L682-L712
marklogic/java-client-api
marklogic-client-api/src/main/java/com/marklogic/client/example/cookbook/DocumentMetadataRead.java
DocumentMetadataRead.setUpExample
public static void setUpExample(XMLDocumentManager docMgr, String docId, String filename) throws IOException { """ set up by writing document metadata and content for the example to read """ InputStream docStream = Util.openStream("data"+File.separator+filename); if (docStream == null) throw new IOException("Could not read document example"); DocumentMetadataHandle metadataHandle = new DocumentMetadataHandle(); metadataHandle.getCollections().addAll("products", "real-estate"); metadataHandle.getPermissions().add("app-user", Capability.UPDATE, Capability.READ); metadataHandle.getProperties().put("reviewed", true); metadataHandle.setQuality(1); metadataHandle.getMetadataValues().add("key1", "value1"); InputStreamHandle handle = new InputStreamHandle(); handle.set(docStream); docMgr.write(docId, metadataHandle, handle); }
java
public static void setUpExample(XMLDocumentManager docMgr, String docId, String filename) throws IOException { InputStream docStream = Util.openStream("data"+File.separator+filename); if (docStream == null) throw new IOException("Could not read document example"); DocumentMetadataHandle metadataHandle = new DocumentMetadataHandle(); metadataHandle.getCollections().addAll("products", "real-estate"); metadataHandle.getPermissions().add("app-user", Capability.UPDATE, Capability.READ); metadataHandle.getProperties().put("reviewed", true); metadataHandle.setQuality(1); metadataHandle.getMetadataValues().add("key1", "value1"); InputStreamHandle handle = new InputStreamHandle(); handle.set(docStream); docMgr.write(docId, metadataHandle, handle); }
[ "public", "static", "void", "setUpExample", "(", "XMLDocumentManager", "docMgr", ",", "String", "docId", ",", "String", "filename", ")", "throws", "IOException", "{", "InputStream", "docStream", "=", "Util", ".", "openStream", "(", "\"data\"", "+", "File", ".", ...
set up by writing document metadata and content for the example to read
[ "set", "up", "by", "writing", "document", "metadata", "and", "content", "for", "the", "example", "to", "read" ]
train
https://github.com/marklogic/java-client-api/blob/acf60229a928abd4a8cc4b21b641d56957467da7/marklogic-client-api/src/main/java/com/marklogic/client/example/cookbook/DocumentMetadataRead.java#L93-L109
census-instrumentation/opencensus-java
exporters/trace/datadog/src/main/java/io/opencensus/exporter/trace/datadog/DatadogTraceExporter.java
DatadogTraceExporter.createAndRegister
public static void createAndRegister(DatadogTraceConfiguration configuration) throws MalformedURLException { """ Creates and registers the Datadog Trace exporter to the OpenCensus library. Only one Datadog exporter can be registered at any point. @param configuration the {@code DatadogTraceConfiguration} used to create the exporter. @throws MalformedURLException if the agent URL is invalid. @since 0.19 """ synchronized (monitor) { checkState(handler == null, "Datadog exporter is already registered."); String agentEndpoint = configuration.getAgentEndpoint(); String service = configuration.getService(); String type = configuration.getType(); final DatadogExporterHandler exporterHandler = new DatadogExporterHandler(agentEndpoint, service, type); handler = exporterHandler; Tracing.getExportComponent() .getSpanExporter() .registerHandler(REGISTER_NAME, exporterHandler); } }
java
public static void createAndRegister(DatadogTraceConfiguration configuration) throws MalformedURLException { synchronized (monitor) { checkState(handler == null, "Datadog exporter is already registered."); String agentEndpoint = configuration.getAgentEndpoint(); String service = configuration.getService(); String type = configuration.getType(); final DatadogExporterHandler exporterHandler = new DatadogExporterHandler(agentEndpoint, service, type); handler = exporterHandler; Tracing.getExportComponent() .getSpanExporter() .registerHandler(REGISTER_NAME, exporterHandler); } }
[ "public", "static", "void", "createAndRegister", "(", "DatadogTraceConfiguration", "configuration", ")", "throws", "MalformedURLException", "{", "synchronized", "(", "monitor", ")", "{", "checkState", "(", "handler", "==", "null", ",", "\"Datadog exporter is already regis...
Creates and registers the Datadog Trace exporter to the OpenCensus library. Only one Datadog exporter can be registered at any point. @param configuration the {@code DatadogTraceConfiguration} used to create the exporter. @throws MalformedURLException if the agent URL is invalid. @since 0.19
[ "Creates", "and", "registers", "the", "Datadog", "Trace", "exporter", "to", "the", "OpenCensus", "library", ".", "Only", "one", "Datadog", "exporter", "can", "be", "registered", "at", "any", "point", "." ]
train
https://github.com/census-instrumentation/opencensus-java/blob/deefac9bed77e40a2297bff1ca5ec5aa48a5f755/exporters/trace/datadog/src/main/java/io/opencensus/exporter/trace/datadog/DatadogTraceExporter.java#L65-L81
apache/incubator-heron
heron/api/src/java/org/apache/heron/classification/HeronAnnotationProcessor.java
HeronAnnotationProcessor.process
@Override public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) { """ If a non-heron class extends from a class annotated as Unstable, Private or LimitedPrivate, emit a warning. """ if (!roundEnv.processingOver()) { for (TypeElement te : annotations) { for (Element elt : roundEnv.getElementsAnnotatedWith(te)) { if (!elt.toString().startsWith("org.apache.heron")) { env.getMessager().printMessage( Kind.WARNING, String.format("%s extends from a class annotated with %s", elt, te), elt); } } } } return true; }
java
@Override public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) { if (!roundEnv.processingOver()) { for (TypeElement te : annotations) { for (Element elt : roundEnv.getElementsAnnotatedWith(te)) { if (!elt.toString().startsWith("org.apache.heron")) { env.getMessager().printMessage( Kind.WARNING, String.format("%s extends from a class annotated with %s", elt, te), elt); } } } } return true; }
[ "@", "Override", "public", "boolean", "process", "(", "Set", "<", "?", "extends", "TypeElement", ">", "annotations", ",", "RoundEnvironment", "roundEnv", ")", "{", "if", "(", "!", "roundEnv", ".", "processingOver", "(", ")", ")", "{", "for", "(", "TypeElem...
If a non-heron class extends from a class annotated as Unstable, Private or LimitedPrivate, emit a warning.
[ "If", "a", "non", "-", "heron", "class", "extends", "from", "a", "class", "annotated", "as", "Unstable", "Private", "or", "LimitedPrivate", "emit", "a", "warning", "." ]
train
https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/api/src/java/org/apache/heron/classification/HeronAnnotationProcessor.java#L55-L70
OpenLiberty/open-liberty
dev/com.ibm.ws.repository.resolver/src/com/ibm/ws/repository/resolver/RepositoryResolutionException.java
RepositoryResolutionException.getMaximumVersionForMissingProduct
public String getMaximumVersionForMissingProduct(String productId, String version, String edition) { """ <p>This will iterate through the products that couldn't be found as supplied by {@link #getMissingProducts()} and look for the maximum version that was searched for. It will limit it to products that match the supplied <code>productId</code>. Note that if the maximum version on a {@link ProductRequirementInformation} is not in the form digit.digit.digit.digit then it will be ignored. Also, if the maximum version is unbounded then this method will return <code>null</code>, this means that {@link #getMinimumVersionForMissingProduct(String)} may return a non-null value at the same time as this method returning <code>null</code>. It is possible for a strange quirk in that if the repository had the following versions in it:</p> <ul><li>8.5.5.2</li> <li>8.5.5.4+</li></ul> <p>The {@link #getMinimumVersionForMissingProduct(String)} would return "8.5.5.2" and this method would return <code>null</code> implying a range from 8.5.5.2 to infinity even though 8.5.5.3 is not supported, therefore {@link #getMissingProducts()} should be relied on for the most accurate information although in reality this situation would indicate a fairly odd repository setup.</p> @param productId The product ID to find the maximum missing version for or <code>null</code> to match to all products @param version The version to find the maximum missing version for by matching the first three parts so if you supply "8.5.5.2" and this item applies to version "8.5.5.3" and "9.0.0.1" then "8.5.5.3" will be returned. Supply <code>null</code> to match all versions @param edition The edition to find the maximum missing version for or <code>null</code> to match to all products @return The maximum missing version or <code>null</code> if there were no relevant matches or the maximum version is unbounded """ Collection<LibertyVersionRange> filteredRanges = filterVersionRanges(productId, edition); Collection<LibertyVersion> maximumVersions = new HashSet<LibertyVersion>(); for (LibertyVersionRange range : filteredRanges) { LibertyVersion maxVersion = range.getMaxVersion(); if (maxVersion == null) { // unbounded return null; } maximumVersions.add(maxVersion); } Collection<LibertyVersion> filteredVersions = filterVersions(maximumVersions, version); LibertyVersion maximumVersion = null; for (LibertyVersion potentialNewMaxVersion : filteredVersions) { if (maximumVersion == null || potentialNewMaxVersion.compareTo(maximumVersion) > 0) { maximumVersion = potentialNewMaxVersion; } } return maximumVersion == null ? null : maximumVersion.toString(); }
java
public String getMaximumVersionForMissingProduct(String productId, String version, String edition) { Collection<LibertyVersionRange> filteredRanges = filterVersionRanges(productId, edition); Collection<LibertyVersion> maximumVersions = new HashSet<LibertyVersion>(); for (LibertyVersionRange range : filteredRanges) { LibertyVersion maxVersion = range.getMaxVersion(); if (maxVersion == null) { // unbounded return null; } maximumVersions.add(maxVersion); } Collection<LibertyVersion> filteredVersions = filterVersions(maximumVersions, version); LibertyVersion maximumVersion = null; for (LibertyVersion potentialNewMaxVersion : filteredVersions) { if (maximumVersion == null || potentialNewMaxVersion.compareTo(maximumVersion) > 0) { maximumVersion = potentialNewMaxVersion; } } return maximumVersion == null ? null : maximumVersion.toString(); }
[ "public", "String", "getMaximumVersionForMissingProduct", "(", "String", "productId", ",", "String", "version", ",", "String", "edition", ")", "{", "Collection", "<", "LibertyVersionRange", ">", "filteredRanges", "=", "filterVersionRanges", "(", "productId", ",", "edi...
<p>This will iterate through the products that couldn't be found as supplied by {@link #getMissingProducts()} and look for the maximum version that was searched for. It will limit it to products that match the supplied <code>productId</code>. Note that if the maximum version on a {@link ProductRequirementInformation} is not in the form digit.digit.digit.digit then it will be ignored. Also, if the maximum version is unbounded then this method will return <code>null</code>, this means that {@link #getMinimumVersionForMissingProduct(String)} may return a non-null value at the same time as this method returning <code>null</code>. It is possible for a strange quirk in that if the repository had the following versions in it:</p> <ul><li>8.5.5.2</li> <li>8.5.5.4+</li></ul> <p>The {@link #getMinimumVersionForMissingProduct(String)} would return "8.5.5.2" and this method would return <code>null</code> implying a range from 8.5.5.2 to infinity even though 8.5.5.3 is not supported, therefore {@link #getMissingProducts()} should be relied on for the most accurate information although in reality this situation would indicate a fairly odd repository setup.</p> @param productId The product ID to find the maximum missing version for or <code>null</code> to match to all products @param version The version to find the maximum missing version for by matching the first three parts so if you supply "8.5.5.2" and this item applies to version "8.5.5.3" and "9.0.0.1" then "8.5.5.3" will be returned. Supply <code>null</code> to match all versions @param edition The edition to find the maximum missing version for or <code>null</code> to match to all products @return The maximum missing version or <code>null</code> if there were no relevant matches or the maximum version is unbounded
[ "<p", ">", "This", "will", "iterate", "through", "the", "products", "that", "couldn", "t", "be", "found", "as", "supplied", "by", "{", "@link", "#getMissingProducts", "()", "}", "and", "look", "for", "the", "maximum", "version", "that", "was", "searched", ...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.repository.resolver/src/com/ibm/ws/repository/resolver/RepositoryResolutionException.java#L181-L200
opendatatrentino/s-match
src/main/java/it/unitn/disi/smatch/matchers/element/MatcherLibrary.java
MatcherLibrary.getRelation
protected char getRelation(IAtomicConceptOfLabel sourceACoL, IAtomicConceptOfLabel targetACoL) throws MatcherLibraryException { """ Returns a semantic relation between two atomic concepts. @param sourceACoL source concept @param targetACoL target concept @return relation between concepts @throws MatcherLibraryException MatcherLibraryException """ try { char relation = senseMatcher.getRelation(sourceACoL.getSenseList(), targetACoL.getSenseList()); //if WN matcher did not find relation if (IMappingElement.IDK == relation) { if (useWeakSemanticsElementLevelMatchersLibrary) { //use string based matchers relation = getRelationFromStringMatchers(sourceACoL.getLemma(), targetACoL.getLemma()); //if they did not find relation if (IMappingElement.IDK == relation) { //use sense and gloss based matchers relation = getRelationFromSenseGlossMatchers(sourceACoL.getSenseList(), targetACoL.getSenseList()); } } } return relation; } catch (SenseMatcherException e) { final String errMessage = e.getClass().getSimpleName() + ": " + e.getMessage(); log.error(errMessage, e); throw new MatcherLibraryException(errMessage, e); } }
java
protected char getRelation(IAtomicConceptOfLabel sourceACoL, IAtomicConceptOfLabel targetACoL) throws MatcherLibraryException { try { char relation = senseMatcher.getRelation(sourceACoL.getSenseList(), targetACoL.getSenseList()); //if WN matcher did not find relation if (IMappingElement.IDK == relation) { if (useWeakSemanticsElementLevelMatchersLibrary) { //use string based matchers relation = getRelationFromStringMatchers(sourceACoL.getLemma(), targetACoL.getLemma()); //if they did not find relation if (IMappingElement.IDK == relation) { //use sense and gloss based matchers relation = getRelationFromSenseGlossMatchers(sourceACoL.getSenseList(), targetACoL.getSenseList()); } } } return relation; } catch (SenseMatcherException e) { final String errMessage = e.getClass().getSimpleName() + ": " + e.getMessage(); log.error(errMessage, e); throw new MatcherLibraryException(errMessage, e); } }
[ "protected", "char", "getRelation", "(", "IAtomicConceptOfLabel", "sourceACoL", ",", "IAtomicConceptOfLabel", "targetACoL", ")", "throws", "MatcherLibraryException", "{", "try", "{", "char", "relation", "=", "senseMatcher", ".", "getRelation", "(", "sourceACoL", ".", ...
Returns a semantic relation between two atomic concepts. @param sourceACoL source concept @param targetACoL target concept @return relation between concepts @throws MatcherLibraryException MatcherLibraryException
[ "Returns", "a", "semantic", "relation", "between", "two", "atomic", "concepts", "." ]
train
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/matchers/element/MatcherLibrary.java#L178-L201
AgNO3/jcifs-ng
src/main/java/jcifs/internal/smb1/AndXServerMessageBlock.java
AndXServerMessageBlock.encode
@Override public int encode ( byte[] dst, int dstIndex ) { """ /* We overload this method from ServerMessageBlock because we want writeAndXWireFormat to write the parameterWords and bytes. This is so we can write batched smbs because all but the first smb of the chaain do not have a header and therefore we do not want to writeHeaderWireFormat. We just recursivly call writeAndXWireFormat. """ int start = this.headerStart = dstIndex; dstIndex += writeHeaderWireFormat(dst, dstIndex); dstIndex += writeAndXWireFormat(dst, dstIndex); this.length = dstIndex - start; if ( this.digest != null ) { this.digest.sign(dst, this.headerStart, this.length, this, this.getResponse()); } return this.length; }
java
@Override public int encode ( byte[] dst, int dstIndex ) { int start = this.headerStart = dstIndex; dstIndex += writeHeaderWireFormat(dst, dstIndex); dstIndex += writeAndXWireFormat(dst, dstIndex); this.length = dstIndex - start; if ( this.digest != null ) { this.digest.sign(dst, this.headerStart, this.length, this, this.getResponse()); } return this.length; }
[ "@", "Override", "public", "int", "encode", "(", "byte", "[", "]", "dst", ",", "int", "dstIndex", ")", "{", "int", "start", "=", "this", ".", "headerStart", "=", "dstIndex", ";", "dstIndex", "+=", "writeHeaderWireFormat", "(", "dst", ",", "dstIndex", ")"...
/* We overload this method from ServerMessageBlock because we want writeAndXWireFormat to write the parameterWords and bytes. This is so we can write batched smbs because all but the first smb of the chaain do not have a header and therefore we do not want to writeHeaderWireFormat. We just recursivly call writeAndXWireFormat.
[ "/", "*", "We", "overload", "this", "method", "from", "ServerMessageBlock", "because", "we", "want", "writeAndXWireFormat", "to", "write", "the", "parameterWords", "and", "bytes", ".", "This", "is", "so", "we", "can", "write", "batched", "smbs", "because", "al...
train
https://github.com/AgNO3/jcifs-ng/blob/0311107a077ea372527ae74839eec8042197332f/src/main/java/jcifs/internal/smb1/AndXServerMessageBlock.java#L135-L148
alkacon/opencms-core
src/org/opencms/flex/CmsFlexCacheKey.java
CmsFlexCacheKey.getKeyName
public static String getKeyName(String resourcename, boolean online) { """ Calculates the cache key name that is used as key in the first level of the FlexCache.<p> @param resourcename the full name of the resource including site root @param online must be true for an online resource, false for offline resources @return the FlexCache key name """ return resourcename.concat(online ? CmsFlexCache.CACHE_ONLINESUFFIX : CmsFlexCache.CACHE_OFFLINESUFFIX); }
java
public static String getKeyName(String resourcename, boolean online) { return resourcename.concat(online ? CmsFlexCache.CACHE_ONLINESUFFIX : CmsFlexCache.CACHE_OFFLINESUFFIX); }
[ "public", "static", "String", "getKeyName", "(", "String", "resourcename", ",", "boolean", "online", ")", "{", "return", "resourcename", ".", "concat", "(", "online", "?", "CmsFlexCache", ".", "CACHE_ONLINESUFFIX", ":", "CmsFlexCache", ".", "CACHE_OFFLINESUFFIX", ...
Calculates the cache key name that is used as key in the first level of the FlexCache.<p> @param resourcename the full name of the resource including site root @param online must be true for an online resource, false for offline resources @return the FlexCache key name
[ "Calculates", "the", "cache", "key", "name", "that", "is", "used", "as", "key", "in", "the", "first", "level", "of", "the", "FlexCache", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/flex/CmsFlexCacheKey.java#L263-L266
dkpro/dkpro-statistics
dkpro-statistics-significance/src/main/java/org/dkpro/statistics/significance/Significance.java
Significance.getSignificance
public static double getSignificance(double[] sample1, double[] sample2) throws IllegalArgumentException, MathException { """ Uses a paired t-test to test whether the correlation value computed from these datasets is significant. @param sample1 The first dataset vector. @param sample2 The second dataset vector. @return The significance value p. @throws MathException @throws IllegalArgumentException """ double alpha = TestUtils.pairedTTest(sample1, sample2); boolean significance = TestUtils.pairedTTest(sample1, sample2, .30); System.err.println("sig: " + significance); return alpha; }
java
public static double getSignificance(double[] sample1, double[] sample2) throws IllegalArgumentException, MathException { double alpha = TestUtils.pairedTTest(sample1, sample2); boolean significance = TestUtils.pairedTTest(sample1, sample2, .30); System.err.println("sig: " + significance); return alpha; }
[ "public", "static", "double", "getSignificance", "(", "double", "[", "]", "sample1", ",", "double", "[", "]", "sample2", ")", "throws", "IllegalArgumentException", ",", "MathException", "{", "double", "alpha", "=", "TestUtils", ".", "pairedTTest", "(", "sample1"...
Uses a paired t-test to test whether the correlation value computed from these datasets is significant. @param sample1 The first dataset vector. @param sample2 The second dataset vector. @return The significance value p. @throws MathException @throws IllegalArgumentException
[ "Uses", "a", "paired", "t", "-", "test", "to", "test", "whether", "the", "correlation", "value", "computed", "from", "these", "datasets", "is", "significant", "." ]
train
https://github.com/dkpro/dkpro-statistics/blob/0b0e93dc49223984964411cbc6df420ba796a8cb/dkpro-statistics-significance/src/main/java/org/dkpro/statistics/significance/Significance.java#L93-L98
zaproxy/zaproxy
src/org/parosproxy/paros/db/DbUtils.java
DbUtils.hasTable
public static boolean hasTable(final Connection connection, final String tableName) throws SQLException { """ Tells whether the table {@code tableName} exists in the database, or not. @param connection the connection to the database @param tableName the name of the table that will be checked @return {@code true} if the table {@code tableName} exists in the database, {@code false} otherwise. @throws SQLException if an error occurred while checking if the table exists """ boolean hasTable = false; ResultSet rs = null; try { rs = connection.getMetaData().getTables(null, null, tableName, null); if (rs.next()) { hasTable = true; } } finally { try { if (rs != null) { rs.close(); } } catch (SQLException e) { if (logger.isDebugEnabled()) { logger.debug(e.getMessage(), e); } } } return hasTable; }
java
public static boolean hasTable(final Connection connection, final String tableName) throws SQLException { boolean hasTable = false; ResultSet rs = null; try { rs = connection.getMetaData().getTables(null, null, tableName, null); if (rs.next()) { hasTable = true; } } finally { try { if (rs != null) { rs.close(); } } catch (SQLException e) { if (logger.isDebugEnabled()) { logger.debug(e.getMessage(), e); } } } return hasTable; }
[ "public", "static", "boolean", "hasTable", "(", "final", "Connection", "connection", ",", "final", "String", "tableName", ")", "throws", "SQLException", "{", "boolean", "hasTable", "=", "false", ";", "ResultSet", "rs", "=", "null", ";", "try", "{", "rs", "="...
Tells whether the table {@code tableName} exists in the database, or not. @param connection the connection to the database @param tableName the name of the table that will be checked @return {@code true} if the table {@code tableName} exists in the database, {@code false} otherwise. @throws SQLException if an error occurred while checking if the table exists
[ "Tells", "whether", "the", "table", "{", "@code", "tableName", "}", "exists", "in", "the", "database", "or", "not", "." ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/parosproxy/paros/db/DbUtils.java#L48-L70
molgenis/molgenis
molgenis-data-import/src/main/java/org/molgenis/data/importer/ImportServiceFactory.java
ImportServiceFactory.getImportService
public ImportService getImportService(File file, RepositoryCollection source) { """ Finds a suitable ImportService for a FileRepositoryCollection. <p>Import of mixed backend types in one FileRepositoryCollection isn't supported. @return ImportService @throws MolgenisDataException if no suitable ImportService is found for the FileRepositoryCollection """ final Map<String, ImportService> importServicesMappedToExtensions = Maps.newHashMap(); importServices .stream() .filter(importService -> importService.canImport(file, source)) .forEach( importService -> { for (String extension : importService.getSupportedFileExtensions()) { importServicesMappedToExtensions.put(extension.toLowerCase(), importService); } }); String extension = FileExtensionUtils.findExtensionFromPossibilities( file.getName(), importServicesMappedToExtensions.keySet()); final ImportService importService = importServicesMappedToExtensions.get(extension); if (importService == null) throw new MolgenisDataException("Can not import file. No suitable importer found"); return importService; }
java
public ImportService getImportService(File file, RepositoryCollection source) { final Map<String, ImportService> importServicesMappedToExtensions = Maps.newHashMap(); importServices .stream() .filter(importService -> importService.canImport(file, source)) .forEach( importService -> { for (String extension : importService.getSupportedFileExtensions()) { importServicesMappedToExtensions.put(extension.toLowerCase(), importService); } }); String extension = FileExtensionUtils.findExtensionFromPossibilities( file.getName(), importServicesMappedToExtensions.keySet()); final ImportService importService = importServicesMappedToExtensions.get(extension); if (importService == null) throw new MolgenisDataException("Can not import file. No suitable importer found"); return importService; }
[ "public", "ImportService", "getImportService", "(", "File", "file", ",", "RepositoryCollection", "source", ")", "{", "final", "Map", "<", "String", ",", "ImportService", ">", "importServicesMappedToExtensions", "=", "Maps", ".", "newHashMap", "(", ")", ";", "impor...
Finds a suitable ImportService for a FileRepositoryCollection. <p>Import of mixed backend types in one FileRepositoryCollection isn't supported. @return ImportService @throws MolgenisDataException if no suitable ImportService is found for the FileRepositoryCollection
[ "Finds", "a", "suitable", "ImportService", "for", "a", "FileRepositoryCollection", "." ]
train
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-import/src/main/java/org/molgenis/data/importer/ImportServiceFactory.java#L35-L57
dnault/therapi-runtime-javadoc
therapi-runtime-javadoc/src/main/java/com/github/therapi/runtimejavadoc/RuntimeJavadoc.java
RuntimeJavadoc.getJavadoc
public static ClassJavadoc getJavadoc(String qualifiedClassName, Class loader) { """ Gets the Javadoc of the given class, using the given {@link Class} object to load the Javadoc resource. <p> The return value is always non-null. If no Javadoc is available, the returned object's {@link BaseJavadoc#isEmpty isEmpty()} method will return {@code true}. @param qualifiedClassName the fully qualified name of the class whose Javadoc you want to retrieve @param loader the class object to use to find the Javadoc resource file @return the Javadoc of the given class """ final String resourceName = getResourceName(qualifiedClassName); try (InputStream is = loader.getResourceAsStream("/" + resourceName)) { return parseJavadocResource(qualifiedClassName, is); } catch (IOException e) { throw new RuntimeException(e); } }
java
public static ClassJavadoc getJavadoc(String qualifiedClassName, Class loader) { final String resourceName = getResourceName(qualifiedClassName); try (InputStream is = loader.getResourceAsStream("/" + resourceName)) { return parseJavadocResource(qualifiedClassName, is); } catch (IOException e) { throw new RuntimeException(e); } }
[ "public", "static", "ClassJavadoc", "getJavadoc", "(", "String", "qualifiedClassName", ",", "Class", "loader", ")", "{", "final", "String", "resourceName", "=", "getResourceName", "(", "qualifiedClassName", ")", ";", "try", "(", "InputStream", "is", "=", "loader",...
Gets the Javadoc of the given class, using the given {@link Class} object to load the Javadoc resource. <p> The return value is always non-null. If no Javadoc is available, the returned object's {@link BaseJavadoc#isEmpty isEmpty()} method will return {@code true}. @param qualifiedClassName the fully qualified name of the class whose Javadoc you want to retrieve @param loader the class object to use to find the Javadoc resource file @return the Javadoc of the given class
[ "Gets", "the", "Javadoc", "of", "the", "given", "class", "using", "the", "given", "{", "@link", "Class", "}", "object", "to", "load", "the", "Javadoc", "resource", ".", "<p", ">", "The", "return", "value", "is", "always", "non", "-", "null", ".", "If",...
train
https://github.com/dnault/therapi-runtime-javadoc/blob/74902191dcf74b870e296653b2adf7dbb747c189/therapi-runtime-javadoc/src/main/java/com/github/therapi/runtimejavadoc/RuntimeJavadoc.java#L82-L89
burberius/eve-esi
src/main/java/net/troja/eve/esi/api/MetaApi.java
MetaApi.getStatusAsync
public com.squareup.okhttp.Call getStatusAsync(String version, final ApiCallback<List<EsiStatusResponse>> callback) throws ApiException { """ ESI health status (asynchronously) Provides a general health indicator per route and method @param version The version of metrics to request. Note that alternate versions are grouped together (optional, default to latest) @param callback The callback to be executed when the API call finishes @return The request call @throws ApiException If fail to process the API call, e.g. serializing the request body object """ com.squareup.okhttp.Call call = getStatusValidateBeforeCall(version, callback); Type localVarReturnType = new TypeToken<List<EsiStatusResponse>>() { }.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; }
java
public com.squareup.okhttp.Call getStatusAsync(String version, final ApiCallback<List<EsiStatusResponse>> callback) throws ApiException { com.squareup.okhttp.Call call = getStatusValidateBeforeCall(version, callback); Type localVarReturnType = new TypeToken<List<EsiStatusResponse>>() { }.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; }
[ "public", "com", ".", "squareup", ".", "okhttp", ".", "Call", "getStatusAsync", "(", "String", "version", ",", "final", "ApiCallback", "<", "List", "<", "EsiStatusResponse", ">", ">", "callback", ")", "throws", "ApiException", "{", "com", ".", "squareup", "....
ESI health status (asynchronously) Provides a general health indicator per route and method @param version The version of metrics to request. Note that alternate versions are grouped together (optional, default to latest) @param callback The callback to be executed when the API call finishes @return The request call @throws ApiException If fail to process the API call, e.g. serializing the request body object
[ "ESI", "health", "status", "(", "asynchronously", ")", "Provides", "a", "general", "health", "indicator", "per", "route", "and", "method" ]
train
https://github.com/burberius/eve-esi/blob/24a941c592cfc15f23471ef849b282fbc582ca13/src/main/java/net/troja/eve/esi/api/MetaApi.java#L346-L354
fcrepo3/fcrepo
fcrepo-server/src/main/java/org/fcrepo/server/journal/JournalReader.java
JournalReader.getJournalEntryStartTag
private StartElement getJournalEntryStartTag(XMLEventReader reader) throws XMLStreamException, JournalException { """ Get the next event and complain if it isn't a JournalEntry start tag. """ XMLEvent event = reader.nextTag(); if (!isStartTagEvent(event, QNAME_TAG_JOURNAL_ENTRY)) { throw getNotStartTagException(QNAME_TAG_JOURNAL_ENTRY, event); } return event.asStartElement(); }
java
private StartElement getJournalEntryStartTag(XMLEventReader reader) throws XMLStreamException, JournalException { XMLEvent event = reader.nextTag(); if (!isStartTagEvent(event, QNAME_TAG_JOURNAL_ENTRY)) { throw getNotStartTagException(QNAME_TAG_JOURNAL_ENTRY, event); } return event.asStartElement(); }
[ "private", "StartElement", "getJournalEntryStartTag", "(", "XMLEventReader", "reader", ")", "throws", "XMLStreamException", ",", "JournalException", "{", "XMLEvent", "event", "=", "reader", ".", "nextTag", "(", ")", ";", "if", "(", "!", "isStartTagEvent", "(", "ev...
Get the next event and complain if it isn't a JournalEntry start tag.
[ "Get", "the", "next", "event", "and", "complain", "if", "it", "isn", "t", "a", "JournalEntry", "start", "tag", "." ]
train
https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/journal/JournalReader.java#L218-L225
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/utility/ArrayIterate.java
ArrayIterate.indexOf
public static <T> int indexOf(T[] objectArray, T elem) { """ Searches for the first occurrence of the given argument, testing for equality using the <tt>equals</tt> method. """ return InternalArrayIterate.indexOf(objectArray, objectArray.length, elem); }
java
public static <T> int indexOf(T[] objectArray, T elem) { return InternalArrayIterate.indexOf(objectArray, objectArray.length, elem); }
[ "public", "static", "<", "T", ">", "int", "indexOf", "(", "T", "[", "]", "objectArray", ",", "T", "elem", ")", "{", "return", "InternalArrayIterate", ".", "indexOf", "(", "objectArray", ",", "objectArray", ".", "length", ",", "elem", ")", ";", "}" ]
Searches for the first occurrence of the given argument, testing for equality using the <tt>equals</tt> method.
[ "Searches", "for", "the", "first", "occurrence", "of", "the", "given", "argument", "testing", "for", "equality", "using", "the", "<tt", ">", "equals<", "/", "tt", ">", "method", "." ]
train
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/ArrayIterate.java#L1094-L1097
alkacon/opencms-core
src-gwt/org/opencms/gwt/client/ui/externallink/CmsEditExternalLinkDialog.java
CmsEditExternalLinkDialog.setOkEnabled
protected void setOkEnabled(boolean enabled, String message) { """ Enables or disables the OK button.<p> @param enabled <code>true</code> to enable the button @param message the disabled reason """ if (enabled) { m_okButton.enable(); } else { m_okButton.disable(message); } }
java
protected void setOkEnabled(boolean enabled, String message) { if (enabled) { m_okButton.enable(); } else { m_okButton.disable(message); } }
[ "protected", "void", "setOkEnabled", "(", "boolean", "enabled", ",", "String", "message", ")", "{", "if", "(", "enabled", ")", "{", "m_okButton", ".", "enable", "(", ")", ";", "}", "else", "{", "m_okButton", ".", "disable", "(", "message", ")", ";", "}...
Enables or disables the OK button.<p> @param enabled <code>true</code> to enable the button @param message the disabled reason
[ "Enables", "or", "disables", "the", "OK", "button", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/externallink/CmsEditExternalLinkDialog.java#L371-L378
jwtk/jjwt
api/src/main/java/io/jsonwebtoken/lang/Assert.java
Assert.notEmpty
public static void notEmpty(Map map, String message) { """ Assert that a Map has entries; that is, it must not be <code>null</code> and must have at least one entry. <pre class="code">Assert.notEmpty(map, "Map must have entries");</pre> @param map the map to check @param message the exception message to use if the assertion fails @throws IllegalArgumentException if the map is <code>null</code> or has no entries """ if (Collections.isEmpty(map)) { throw new IllegalArgumentException(message); } }
java
public static void notEmpty(Map map, String message) { if (Collections.isEmpty(map)) { throw new IllegalArgumentException(message); } }
[ "public", "static", "void", "notEmpty", "(", "Map", "map", ",", "String", "message", ")", "{", "if", "(", "Collections", ".", "isEmpty", "(", "map", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "message", ")", ";", "}", "}" ]
Assert that a Map has entries; that is, it must not be <code>null</code> and must have at least one entry. <pre class="code">Assert.notEmpty(map, "Map must have entries");</pre> @param map the map to check @param message the exception message to use if the assertion fails @throws IllegalArgumentException if the map is <code>null</code> or has no entries
[ "Assert", "that", "a", "Map", "has", "entries", ";", "that", "is", "it", "must", "not", "be", "<code", ">", "null<", "/", "code", ">", "and", "must", "have", "at", "least", "one", "entry", ".", "<pre", "class", "=", "code", ">", "Assert", ".", "not...
train
https://github.com/jwtk/jjwt/blob/86b6096946752cffcfbc9b0a5503f1ea195cc140/api/src/main/java/io/jsonwebtoken/lang/Assert.java#L268-L272
DV8FromTheWorld/JDA
src/main/java/net/dv8tion/jda/core/requests/restaction/MessageAction.java
MessageAction.addFile
@CheckReturnValue public MessageAction addFile(final byte[] data, final String name) { """ Adds the provided byte[] as file data. <p>To reset all files use {@link #clearFiles()} @param data The byte[] that will be interpreted as file data @param name The file name that should be used to interpret the type of the given data using the file-name extension. This name is similar to what will be visible through {@link net.dv8tion.jda.core.entities.Message.Attachment#getFileName() Message.Attachment.getFileName()} @throws java.lang.IllegalStateException If the file limit of {@value Message#MAX_FILE_AMOUNT} has been reached prior to calling this method, or if this MessageAction will perform an edit operation on an existing Message (see {@link #isEdit()}) @throws java.lang.IllegalArgumentException If the provided data is {@code null} or the provided name is blank or {@code null} or if the provided data exceeds the maximum file size of the currently logged in account @throws net.dv8tion.jda.core.exceptions.InsufficientPermissionException If this is targeting a TextChannel and the currently logged in account does not have {@link net.dv8tion.jda.core.Permission#MESSAGE_ATTACH_FILES Permission.MESSAGE_ATTACH_FILES} @return Updated MessageAction for chaining convenience @see net.dv8tion.jda.core.entities.SelfUser#getAllowedFileSize() SelfUser.getAllowedFileSize() """ Checks.notNull(data, "Data"); final long maxSize = getJDA().getSelfUser().getAllowedFileSize(); Checks.check(data.length <= maxSize, "File may not exceed the maximum file length of %d bytes!", maxSize); return addFile(new ByteArrayInputStream(data), name); }
java
@CheckReturnValue public MessageAction addFile(final byte[] data, final String name) { Checks.notNull(data, "Data"); final long maxSize = getJDA().getSelfUser().getAllowedFileSize(); Checks.check(data.length <= maxSize, "File may not exceed the maximum file length of %d bytes!", maxSize); return addFile(new ByteArrayInputStream(data), name); }
[ "@", "CheckReturnValue", "public", "MessageAction", "addFile", "(", "final", "byte", "[", "]", "data", ",", "final", "String", "name", ")", "{", "Checks", ".", "notNull", "(", "data", ",", "\"Data\"", ")", ";", "final", "long", "maxSize", "=", "getJDA", ...
Adds the provided byte[] as file data. <p>To reset all files use {@link #clearFiles()} @param data The byte[] that will be interpreted as file data @param name The file name that should be used to interpret the type of the given data using the file-name extension. This name is similar to what will be visible through {@link net.dv8tion.jda.core.entities.Message.Attachment#getFileName() Message.Attachment.getFileName()} @throws java.lang.IllegalStateException If the file limit of {@value Message#MAX_FILE_AMOUNT} has been reached prior to calling this method, or if this MessageAction will perform an edit operation on an existing Message (see {@link #isEdit()}) @throws java.lang.IllegalArgumentException If the provided data is {@code null} or the provided name is blank or {@code null} or if the provided data exceeds the maximum file size of the currently logged in account @throws net.dv8tion.jda.core.exceptions.InsufficientPermissionException If this is targeting a TextChannel and the currently logged in account does not have {@link net.dv8tion.jda.core.Permission#MESSAGE_ATTACH_FILES Permission.MESSAGE_ATTACH_FILES} @return Updated MessageAction for chaining convenience @see net.dv8tion.jda.core.entities.SelfUser#getAllowedFileSize() SelfUser.getAllowedFileSize()
[ "Adds", "the", "provided", "byte", "[]", "as", "file", "data", "." ]
train
https://github.com/DV8FromTheWorld/JDA/blob/8ecbbe354d03f6bf448411bba573d0d4c268b560/src/main/java/net/dv8tion/jda/core/requests/restaction/MessageAction.java#L404-L411
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/LocalDateTime.java
LocalDateTime.plusYears
public LocalDateTime plusYears(long years) { """ Returns a copy of this {@code LocalDateTime} with the specified number of years added. <p> This method adds the specified amount to the years field in three steps: <ol> <li>Add the input years to the year field</li> <li>Check if the resulting date would be invalid</li> <li>Adjust the day-of-month to the last valid day if necessary</li> </ol> <p> For example, 2008-02-29 (leap year) plus one year would result in the invalid date 2009-02-29 (standard year). Instead of returning an invalid result, the last valid day of the month, 2009-02-28, is selected instead. <p> This instance is immutable and unaffected by this method call. @param years the years to add, may be negative @return a {@code LocalDateTime} based on this date-time with the years added, not null @throws DateTimeException if the result exceeds the supported date range """ LocalDate newDate = date.plusYears(years); return with(newDate, time); }
java
public LocalDateTime plusYears(long years) { LocalDate newDate = date.plusYears(years); return with(newDate, time); }
[ "public", "LocalDateTime", "plusYears", "(", "long", "years", ")", "{", "LocalDate", "newDate", "=", "date", ".", "plusYears", "(", "years", ")", ";", "return", "with", "(", "newDate", ",", "time", ")", ";", "}" ]
Returns a copy of this {@code LocalDateTime} with the specified number of years added. <p> This method adds the specified amount to the years field in three steps: <ol> <li>Add the input years to the year field</li> <li>Check if the resulting date would be invalid</li> <li>Adjust the day-of-month to the last valid day if necessary</li> </ol> <p> For example, 2008-02-29 (leap year) plus one year would result in the invalid date 2009-02-29 (standard year). Instead of returning an invalid result, the last valid day of the month, 2009-02-28, is selected instead. <p> This instance is immutable and unaffected by this method call. @param years the years to add, may be negative @return a {@code LocalDateTime} based on this date-time with the years added, not null @throws DateTimeException if the result exceeds the supported date range
[ "Returns", "a", "copy", "of", "this", "{", "@code", "LocalDateTime", "}", "with", "the", "specified", "number", "of", "years", "added", ".", "<p", ">", "This", "method", "adds", "the", "specified", "amount", "to", "the", "years", "field", "in", "three", ...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/LocalDateTime.java#L1214-L1217
eclipse/xtext-core
org.eclipse.xtext.util/src/org/eclipse/xtext/util/concurrent/AbstractReadWriteAcces.java
AbstractReadWriteAcces.process
public <Result> Result process(IUnitOfWork<Result, State> work) { """ Upgrades a read transaction to a write transaction, executes the work then downgrades to a read transaction again. @since 2.4 @noreference """ releaseReadLock(); acquireWriteLock(); try { if (log.isTraceEnabled()) log.trace("process - " + Thread.currentThread().getName()); return modify(work); } finally { if (log.isTraceEnabled()) log.trace("Downgrading from write lock to read lock..."); acquireReadLock(); releaseWriteLock(); } }
java
public <Result> Result process(IUnitOfWork<Result, State> work) { releaseReadLock(); acquireWriteLock(); try { if (log.isTraceEnabled()) log.trace("process - " + Thread.currentThread().getName()); return modify(work); } finally { if (log.isTraceEnabled()) log.trace("Downgrading from write lock to read lock..."); acquireReadLock(); releaseWriteLock(); } }
[ "public", "<", "Result", ">", "Result", "process", "(", "IUnitOfWork", "<", "Result", ",", "State", ">", "work", ")", "{", "releaseReadLock", "(", ")", ";", "acquireWriteLock", "(", ")", ";", "try", "{", "if", "(", "log", ".", "isTraceEnabled", "(", ")...
Upgrades a read transaction to a write transaction, executes the work then downgrades to a read transaction again. @since 2.4 @noreference
[ "Upgrades", "a", "read", "transaction", "to", "a", "write", "transaction", "executes", "the", "work", "then", "downgrades", "to", "a", "read", "transaction", "again", "." ]
train
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext.util/src/org/eclipse/xtext/util/concurrent/AbstractReadWriteAcces.java#L107-L120
BlueBrain/bluima
modules/bluima_typesystem/src/main/java/de/julielab/jules/types/ace/EntityAttribute.java
EntityAttribute.setNames
public void setNames(int i, Name v) { """ indexed setter for names - sets an indexed value - @generated @param i index in the array to set @param v value to set into the array """ if (EntityAttribute_Type.featOkTst && ((EntityAttribute_Type)jcasType).casFeat_names == null) jcasType.jcas.throwFeatMissing("names", "de.julielab.jules.types.ace.EntityAttribute"); jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((EntityAttribute_Type)jcasType).casFeatCode_names), i); jcasType.ll_cas.ll_setRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((EntityAttribute_Type)jcasType).casFeatCode_names), i, jcasType.ll_cas.ll_getFSRef(v));}
java
public void setNames(int i, Name v) { if (EntityAttribute_Type.featOkTst && ((EntityAttribute_Type)jcasType).casFeat_names == null) jcasType.jcas.throwFeatMissing("names", "de.julielab.jules.types.ace.EntityAttribute"); jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((EntityAttribute_Type)jcasType).casFeatCode_names), i); jcasType.ll_cas.ll_setRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((EntityAttribute_Type)jcasType).casFeatCode_names), i, jcasType.ll_cas.ll_getFSRef(v));}
[ "public", "void", "setNames", "(", "int", "i", ",", "Name", "v", ")", "{", "if", "(", "EntityAttribute_Type", ".", "featOkTst", "&&", "(", "(", "EntityAttribute_Type", ")", "jcasType", ")", ".", "casFeat_names", "==", "null", ")", "jcasType", ".", "jcas", ...
indexed setter for names - sets an indexed value - @generated @param i index in the array to set @param v value to set into the array
[ "indexed", "setter", "for", "names", "-", "sets", "an", "indexed", "value", "-" ]
train
https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_typesystem/src/main/java/de/julielab/jules/types/ace/EntityAttribute.java#L116-L120
moleculer-java/moleculer-java
src/main/java/services/moleculer/eventbus/EventEmitter.java
EventEmitter.broadcastLocal
public void broadcastLocal(String name, Object... params) { """ Emits a <b>LOCAL</b> event to <b>ALL</b> listeners from ALL (or the specified) event group(s), who are listening this event. Sample code:<br> <br> ctx.broadcastLocal("user.deleted", "a", 1, "b", 2);<br> <br> ...or send event to (one or more) local listener group(s):<br> <br> ctx.broadcastLocal("user.deleted", "a", 1, "b", 2, Groups.of("logger")); @param name name of event (eg. "user.deleted") @param params list of parameter name-value pairs and an optional {@link Groups event group} container """ ParseResult res = parseParams(params); eventbus.broadcast(name, res.data, res.groups, true); }
java
public void broadcastLocal(String name, Object... params) { ParseResult res = parseParams(params); eventbus.broadcast(name, res.data, res.groups, true); }
[ "public", "void", "broadcastLocal", "(", "String", "name", ",", "Object", "...", "params", ")", "{", "ParseResult", "res", "=", "parseParams", "(", "params", ")", ";", "eventbus", ".", "broadcast", "(", "name", ",", "res", ".", "data", ",", "res", ".", ...
Emits a <b>LOCAL</b> event to <b>ALL</b> listeners from ALL (or the specified) event group(s), who are listening this event. Sample code:<br> <br> ctx.broadcastLocal("user.deleted", "a", 1, "b", 2);<br> <br> ...or send event to (one or more) local listener group(s):<br> <br> ctx.broadcastLocal("user.deleted", "a", 1, "b", 2, Groups.of("logger")); @param name name of event (eg. "user.deleted") @param params list of parameter name-value pairs and an optional {@link Groups event group} container
[ "Emits", "a", "<b", ">", "LOCAL<", "/", "b", ">", "event", "to", "<b", ">", "ALL<", "/", "b", ">", "listeners", "from", "ALL", "(", "or", "the", "specified", ")", "event", "group", "(", "s", ")", "who", "are", "listening", "this", "event", ".", "...
train
https://github.com/moleculer-java/moleculer-java/blob/27575c44b9ecacc17c4456ceacf5d1851abf1cc4/src/main/java/services/moleculer/eventbus/EventEmitter.java#L199-L202
ModeShape/modeshape
index-providers/modeshape-elasticsearch-index-provider/src/main/java/org/modeshape/jcr/index/elasticsearch/client/EsClient.java
EsClient.getDocument
public EsRequest getDocument(String name, String type, String id) throws IOException { """ Searches indexed document. @param name index name. @param type index type. @param id document identifier. @return document if it was found or null. @throws IOException """ CloseableHttpClient client = HttpClients.createDefault(); HttpGet method = new HttpGet(String.format("http://%s:%d/%s/%s/%s", host, port, name, type, id)); try { CloseableHttpResponse resp = client.execute(method); int status = resp.getStatusLine().getStatusCode(); switch (status) { case HttpStatus.SC_OK : EsResponse doc = EsResponse.read(resp.getEntity().getContent()); return new EsRequest((Document) doc.get("_source")); case HttpStatus.SC_NOT_ACCEPTABLE: case HttpStatus.SC_NOT_FOUND: return null; default: throw new IOException(resp.getStatusLine().getReasonPhrase()); } } finally { method.releaseConnection(); } }
java
public EsRequest getDocument(String name, String type, String id) throws IOException { CloseableHttpClient client = HttpClients.createDefault(); HttpGet method = new HttpGet(String.format("http://%s:%d/%s/%s/%s", host, port, name, type, id)); try { CloseableHttpResponse resp = client.execute(method); int status = resp.getStatusLine().getStatusCode(); switch (status) { case HttpStatus.SC_OK : EsResponse doc = EsResponse.read(resp.getEntity().getContent()); return new EsRequest((Document) doc.get("_source")); case HttpStatus.SC_NOT_ACCEPTABLE: case HttpStatus.SC_NOT_FOUND: return null; default: throw new IOException(resp.getStatusLine().getReasonPhrase()); } } finally { method.releaseConnection(); } }
[ "public", "EsRequest", "getDocument", "(", "String", "name", ",", "String", "type", ",", "String", "id", ")", "throws", "IOException", "{", "CloseableHttpClient", "client", "=", "HttpClients", ".", "createDefault", "(", ")", ";", "HttpGet", "method", "=", "new...
Searches indexed document. @param name index name. @param type index type. @param id document identifier. @return document if it was found or null. @throws IOException
[ "Searches", "indexed", "document", "." ]
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/index-providers/modeshape-elasticsearch-index-provider/src/main/java/org/modeshape/jcr/index/elasticsearch/client/EsClient.java#L149-L168
albfernandez/itext2
src/main/java/com/lowagie/text/FontFactory.java
FontFactory.registerFamily
public void registerFamily(String familyName, String fullName, String path) { """ Register a font by giving explicitly the font family and name. @param familyName the font family @param fullName the font name @param path the font path """ fontImp.registerFamily(familyName, fullName, path); }
java
public void registerFamily(String familyName, String fullName, String path) { fontImp.registerFamily(familyName, fullName, path); }
[ "public", "void", "registerFamily", "(", "String", "familyName", ",", "String", "fullName", ",", "String", "path", ")", "{", "fontImp", ".", "registerFamily", "(", "familyName", ",", "fullName", ",", "path", ")", ";", "}" ]
Register a font by giving explicitly the font family and name. @param familyName the font family @param fullName the font name @param path the font path
[ "Register", "a", "font", "by", "giving", "explicitly", "the", "font", "family", "and", "name", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/FontFactory.java#L338-L340
devcon5io/common
classutils/src/main/java/io/devcon5/classutils/JarScanner.java
JarScanner.toUri
private static URI toUri(final URL u) { """ Converts a url to uri without throwing a checked exception. In case an URI syntax exception occurs, an IllegalArgumentException is thrown. @param u the url to be converted @return the converted uri """ try { return u.toURI(); } catch (URISyntaxException e) { throw new IllegalArgumentException("Could not convert URL "+u+" to uri",e); } }
java
private static URI toUri(final URL u) { try { return u.toURI(); } catch (URISyntaxException e) { throw new IllegalArgumentException("Could not convert URL "+u+" to uri",e); } }
[ "private", "static", "URI", "toUri", "(", "final", "URL", "u", ")", "{", "try", "{", "return", "u", ".", "toURI", "(", ")", ";", "}", "catch", "(", "URISyntaxException", "e", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Could not convert U...
Converts a url to uri without throwing a checked exception. In case an URI syntax exception occurs, an IllegalArgumentException is thrown. @param u the url to be converted @return the converted uri
[ "Converts", "a", "url", "to", "uri", "without", "throwing", "a", "checked", "exception", ".", "In", "case", "an", "URI", "syntax", "exception", "occurs", "an", "IllegalArgumentException", "is", "thrown", "." ]
train
https://github.com/devcon5io/common/blob/363688e0dc904d559682bf796bd6c836b4e0efc7/classutils/src/main/java/io/devcon5/classutils/JarScanner.java#L124-L131
elki-project/elki
elki/src/main/java/de/lmu/ifi/dbs/elki/algorithm/outlier/clustering/CBLOF.java
CBLOF.getClusterBoundary
private int getClusterBoundary(Relation<O> relation, List<? extends Cluster<MeanModel>> clusters) { """ Compute the boundary index separating the large cluster from the small cluster. @param relation Data to process @param clusters All clusters that were found @return Index of boundary between large and small cluster. """ int totalSize = relation.size(); int clusterBoundary = clusters.size() - 1; int cumulativeSize = 0; for(int i = 0; i < clusters.size() - 1; i++) { cumulativeSize += clusters.get(i).size(); // Given majority covered by large cluster if(cumulativeSize >= totalSize * alpha) { clusterBoundary = i; break; } // Relative difference in cluster size between two consecutive clusters if(clusters.get(i).size() / (double) clusters.get(i + 1).size() >= beta) { clusterBoundary = i; break; } } return clusterBoundary; }
java
private int getClusterBoundary(Relation<O> relation, List<? extends Cluster<MeanModel>> clusters) { int totalSize = relation.size(); int clusterBoundary = clusters.size() - 1; int cumulativeSize = 0; for(int i = 0; i < clusters.size() - 1; i++) { cumulativeSize += clusters.get(i).size(); // Given majority covered by large cluster if(cumulativeSize >= totalSize * alpha) { clusterBoundary = i; break; } // Relative difference in cluster size between two consecutive clusters if(clusters.get(i).size() / (double) clusters.get(i + 1).size() >= beta) { clusterBoundary = i; break; } } return clusterBoundary; }
[ "private", "int", "getClusterBoundary", "(", "Relation", "<", "O", ">", "relation", ",", "List", "<", "?", "extends", "Cluster", "<", "MeanModel", ">", ">", "clusters", ")", "{", "int", "totalSize", "=", "relation", ".", "size", "(", ")", ";", "int", "...
Compute the boundary index separating the large cluster from the small cluster. @param relation Data to process @param clusters All clusters that were found @return Index of boundary between large and small cluster.
[ "Compute", "the", "boundary", "index", "separating", "the", "large", "cluster", "from", "the", "small", "cluster", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki/src/main/java/de/lmu/ifi/dbs/elki/algorithm/outlier/clustering/CBLOF.java#L191-L211
cubedtear/aritzh
aritzh-core/src/main/java/io/github/aritzhack/aritzh/util/ARGBColorUtil.java
ARGBColorUtil.composite
public static int composite(final int foreground, final int background) { """ Composes two colors with the ARGB format: <br> The format of the color integer is as follows: 0xAARRGGBB Where: <ol> <li>AA is the alpha component (0-255)</li> <li>RR is the red component (0-255)</li> <li>GG is the green component (0-255)</li> <li>BB is the blue component (0-255)</li> </ol> NOTE: The source of this method is quite obscure, but it's done this way because it's performance-critical (this method could be run thousands of times per second!)<br> The code (unobscured) does this: <br><br> <code> double alpha1 = getAlpha(foreground) / 256.0;<br> double alpha2 = getAlpha(background) / 256.0;<br> <br> if (alpha1 == 1.0 || alpha2 == 0) return foreground;<br> else if (alpha1 == 0) return background;<br> <br> int red1 = getRed(foreground);<br> int red2 = getRed(background);<br> int green1 = getGreen(foreground);<br> int green2 = getGreen(background);<br> int blue1 = getBlue(foreground);<br> int blue2 = getBlue(background);<br> <br> double doubleAlpha = (alpha1 + alpha2 * (1 - alpha1));<br> int finalAlpha = (int) (doubleAlpha * 256);<br> <br> double cAlpha2 = alpha2 * (1 - alpha1) * 0.5;<br> <br> int finalRed = (int) (red1 * alpha1 + red2 * cAlpha2);<br> int finalGreen = (int) (green1 * alpha1 + green2 * cAlpha2);<br> int finalBlue = (int) (blue1 * alpha1 + blue2 * cAlpha2);<br> return getColor(finalAlpha, finalRed, finalGreen, finalBlue);<br><br> </code> @param foreground The foreground color (above) @param background The background color (below) @return A composition of both colors, in ARGB format """ double fA = getAlpha(foreground) / 255.0; double bA = getAlpha(background) / 255.0; if (bA <= 0.0001) return foreground; else if (fA <= 0.0001) return background; final double alphaA = bA * (1 - fA); return getColor( (int) (255 * (fA + alphaA)), // ALPHA (int) (fA * getRed(foreground) + alphaA * getRed(background)), // RED (int) (fA * getGreen(foreground) + alphaA * getGreen(background)), // GREEN (int) (fA * getBlue(foreground) + alphaA * getBlue(background))); // BLUE }
java
public static int composite(final int foreground, final int background) { double fA = getAlpha(foreground) / 255.0; double bA = getAlpha(background) / 255.0; if (bA <= 0.0001) return foreground; else if (fA <= 0.0001) return background; final double alphaA = bA * (1 - fA); return getColor( (int) (255 * (fA + alphaA)), // ALPHA (int) (fA * getRed(foreground) + alphaA * getRed(background)), // RED (int) (fA * getGreen(foreground) + alphaA * getGreen(background)), // GREEN (int) (fA * getBlue(foreground) + alphaA * getBlue(background))); // BLUE }
[ "public", "static", "int", "composite", "(", "final", "int", "foreground", ",", "final", "int", "background", ")", "{", "double", "fA", "=", "getAlpha", "(", "foreground", ")", "/", "255.0", ";", "double", "bA", "=", "getAlpha", "(", "background", ")", "...
Composes two colors with the ARGB format: <br> The format of the color integer is as follows: 0xAARRGGBB Where: <ol> <li>AA is the alpha component (0-255)</li> <li>RR is the red component (0-255)</li> <li>GG is the green component (0-255)</li> <li>BB is the blue component (0-255)</li> </ol> NOTE: The source of this method is quite obscure, but it's done this way because it's performance-critical (this method could be run thousands of times per second!)<br> The code (unobscured) does this: <br><br> <code> double alpha1 = getAlpha(foreground) / 256.0;<br> double alpha2 = getAlpha(background) / 256.0;<br> <br> if (alpha1 == 1.0 || alpha2 == 0) return foreground;<br> else if (alpha1 == 0) return background;<br> <br> int red1 = getRed(foreground);<br> int red2 = getRed(background);<br> int green1 = getGreen(foreground);<br> int green2 = getGreen(background);<br> int blue1 = getBlue(foreground);<br> int blue2 = getBlue(background);<br> <br> double doubleAlpha = (alpha1 + alpha2 * (1 - alpha1));<br> int finalAlpha = (int) (doubleAlpha * 256);<br> <br> double cAlpha2 = alpha2 * (1 - alpha1) * 0.5;<br> <br> int finalRed = (int) (red1 * alpha1 + red2 * cAlpha2);<br> int finalGreen = (int) (green1 * alpha1 + green2 * cAlpha2);<br> int finalBlue = (int) (blue1 * alpha1 + blue2 * cAlpha2);<br> return getColor(finalAlpha, finalRed, finalGreen, finalBlue);<br><br> </code> @param foreground The foreground color (above) @param background The background color (below) @return A composition of both colors, in ARGB format
[ "Composes", "two", "colors", "with", "the", "ARGB", "format", ":", "<br", ">", "The", "format", "of", "the", "color", "integer", "is", "as", "follows", ":", "0xAARRGGBB", "Where", ":", "<ol", ">", "<li", ">", "AA", "is", "the", "alpha", "component", "(...
train
https://github.com/cubedtear/aritzh/blob/bc7493447a1a6088c4a7306ca4d0f0c20278364f/aritzh-core/src/main/java/io/github/aritzhack/aritzh/util/ARGBColorUtil.java#L89-L103
tvesalainen/util
rpm/src/main/java/org/vesalainen/pm/deb/DEBBuilder.java
DEBBuilder.addConflict
@Override public DEBBuilder addConflict(String name, String version, Condition... dependency) { """ Add debian/control Conflicts field. @param name @param version @param dependency @return """ control.addConflict(release, version, dependency); return this; }
java
@Override public DEBBuilder addConflict(String name, String version, Condition... dependency) { control.addConflict(release, version, dependency); return this; }
[ "@", "Override", "public", "DEBBuilder", "addConflict", "(", "String", "name", ",", "String", "version", ",", "Condition", "...", "dependency", ")", "{", "control", ".", "addConflict", "(", "release", ",", "version", ",", "dependency", ")", ";", "return", "t...
Add debian/control Conflicts field. @param name @param version @param dependency @return
[ "Add", "debian", "/", "control", "Conflicts", "field", "." ]
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/rpm/src/main/java/org/vesalainen/pm/deb/DEBBuilder.java#L161-L166
Baidu-AIP/java-sdk
src/main/java/com/baidu/aip/easydl/AipEasyDL.java
AipEasyDL.sendImageRequest
public JSONObject sendImageRequest(String url, String image, HashMap<String, Object> options) { """ easyDL通用请求方法 @param url 服务的url @param image 图片本地路径 @param options 可选参数 @return Json返回 """ try { byte[] data = Util.readFileByBytes(image); return sendImageRequest(url, data, options); } catch (IOException e) { e.printStackTrace(); return AipError.IMAGE_READ_ERROR.toJsonResult(); } }
java
public JSONObject sendImageRequest(String url, String image, HashMap<String, Object> options) { try { byte[] data = Util.readFileByBytes(image); return sendImageRequest(url, data, options); } catch (IOException e) { e.printStackTrace(); return AipError.IMAGE_READ_ERROR.toJsonResult(); } }
[ "public", "JSONObject", "sendImageRequest", "(", "String", "url", ",", "String", "image", ",", "HashMap", "<", "String", ",", "Object", ">", "options", ")", "{", "try", "{", "byte", "[", "]", "data", "=", "Util", ".", "readFileByBytes", "(", "image", ")"...
easyDL通用请求方法 @param url 服务的url @param image 图片本地路径 @param options 可选参数 @return Json返回
[ "easyDL通用请求方法" ]
train
https://github.com/Baidu-AIP/java-sdk/blob/16bb8b7bb8f9bbcb7c8af62d0a67a1e79eecad90/src/main/java/com/baidu/aip/easydl/AipEasyDL.java#L30-L38
softindex/datakernel
core-http/src/main/java/io/datakernel/http/HttpUtils.java
HttpUtils.renderQueryString
public static String renderQueryString(Map<String, String> q, String enc) { """ Method which creates string with parameters and its value in format URL @param q map in which keys if name of parameters, value - value of parameters. @param enc encoding of this string @return string with parameters and its value in format URL """ StringBuilder sb = new StringBuilder(); for (Map.Entry<String, String> e : q.entrySet()) { String name = urlEncode(e.getKey(), enc); sb.append(name); if (e.getValue() != null) { sb.append('='); sb.append(urlEncode(e.getValue(), enc)); } sb.append('&'); } if (sb.length() > 0) sb.setLength(sb.length() - 1); return sb.toString(); }
java
public static String renderQueryString(Map<String, String> q, String enc) { StringBuilder sb = new StringBuilder(); for (Map.Entry<String, String> e : q.entrySet()) { String name = urlEncode(e.getKey(), enc); sb.append(name); if (e.getValue() != null) { sb.append('='); sb.append(urlEncode(e.getValue(), enc)); } sb.append('&'); } if (sb.length() > 0) sb.setLength(sb.length() - 1); return sb.toString(); }
[ "public", "static", "String", "renderQueryString", "(", "Map", "<", "String", ",", "String", ">", "q", ",", "String", "enc", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "Map", ".", "Entry", "<", "String", ",...
Method which creates string with parameters and its value in format URL @param q map in which keys if name of parameters, value - value of parameters. @param enc encoding of this string @return string with parameters and its value in format URL
[ "Method", "which", "creates", "string", "with", "parameters", "and", "its", "value", "in", "format", "URL" ]
train
https://github.com/softindex/datakernel/blob/090ca1116416c14d463d49d275cb1daaafa69c56/core-http/src/main/java/io/datakernel/http/HttpUtils.java#L190-L204
querydsl/querydsl
querydsl-collections/src/main/java/com/querydsl/collections/DefaultEvaluatorFactory.java
DefaultEvaluatorFactory.createEvaluator
public <T> Evaluator<List<T>> createEvaluator(QueryMetadata metadata, Expression<? extends T> source, Predicate filter) { """ Create an Evaluator for the given source and filter @param <T> @param source source of the query @param filter filter of the query @return evaluator """ String typeName = ClassUtils.getName(source.getType()); CollQuerySerializer ser = new CollQuerySerializer(templates); ser.append("java.util.List<" + typeName + "> rv = new java.util.ArrayList<" + typeName + ">();\n"); ser.append("for (" + typeName + " " + source + " : " + source + "_) {\n"); ser.append(" try {\n"); ser.append(" if (").handle(filter).append(") {\n"); ser.append(" rv.add(" + source + ");\n"); ser.append(" }\n"); ser.append(" } catch (NullPointerException npe) { }\n"); ser.append("}\n"); ser.append("return rv;"); Map<Object,String> constantToLabel = ser.getConstantToLabel(); Map<String, Object> constants = getConstants(metadata, constantToLabel); Type sourceType = new ClassType(TypeCategory.SIMPLE, source.getType()); ClassType sourceListType = new ClassType(TypeCategory.SIMPLE, Iterable.class, sourceType); return factory.createEvaluator( ser.toString(), sourceListType, new String[]{source + "_"}, new Type[]{sourceListType}, new Class<?>[]{Iterable.class}, constants); }
java
public <T> Evaluator<List<T>> createEvaluator(QueryMetadata metadata, Expression<? extends T> source, Predicate filter) { String typeName = ClassUtils.getName(source.getType()); CollQuerySerializer ser = new CollQuerySerializer(templates); ser.append("java.util.List<" + typeName + "> rv = new java.util.ArrayList<" + typeName + ">();\n"); ser.append("for (" + typeName + " " + source + " : " + source + "_) {\n"); ser.append(" try {\n"); ser.append(" if (").handle(filter).append(") {\n"); ser.append(" rv.add(" + source + ");\n"); ser.append(" }\n"); ser.append(" } catch (NullPointerException npe) { }\n"); ser.append("}\n"); ser.append("return rv;"); Map<Object,String> constantToLabel = ser.getConstantToLabel(); Map<String, Object> constants = getConstants(metadata, constantToLabel); Type sourceType = new ClassType(TypeCategory.SIMPLE, source.getType()); ClassType sourceListType = new ClassType(TypeCategory.SIMPLE, Iterable.class, sourceType); return factory.createEvaluator( ser.toString(), sourceListType, new String[]{source + "_"}, new Type[]{sourceListType}, new Class<?>[]{Iterable.class}, constants); }
[ "public", "<", "T", ">", "Evaluator", "<", "List", "<", "T", ">", ">", "createEvaluator", "(", "QueryMetadata", "metadata", ",", "Expression", "<", "?", "extends", "T", ">", "source", ",", "Predicate", "filter", ")", "{", "String", "typeName", "=", "Clas...
Create an Evaluator for the given source and filter @param <T> @param source source of the query @param filter filter of the query @return evaluator
[ "Create", "an", "Evaluator", "for", "the", "given", "source", "and", "filter" ]
train
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-collections/src/main/java/com/querydsl/collections/DefaultEvaluatorFactory.java#L131-L158
apache/flink
flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/rank/TopNBuffer.java
TopNBuffer.put
public int put(BaseRow sortKey, BaseRow value) { """ Appends a record into the buffer. @param sortKey sort key with which the specified value is to be associated @param value record which is to be appended @return the size of the collection under the sortKey. """ currentTopNum += 1; // update treeMap Collection<BaseRow> collection = treeMap.get(sortKey); if (collection == null) { collection = valueSupplier.get(); treeMap.put(sortKey, collection); } collection.add(value); return collection.size(); }
java
public int put(BaseRow sortKey, BaseRow value) { currentTopNum += 1; // update treeMap Collection<BaseRow> collection = treeMap.get(sortKey); if (collection == null) { collection = valueSupplier.get(); treeMap.put(sortKey, collection); } collection.add(value); return collection.size(); }
[ "public", "int", "put", "(", "BaseRow", "sortKey", ",", "BaseRow", "value", ")", "{", "currentTopNum", "+=", "1", ";", "// update treeMap", "Collection", "<", "BaseRow", ">", "collection", "=", "treeMap", ".", "get", "(", "sortKey", ")", ";", "if", "(", ...
Appends a record into the buffer. @param sortKey sort key with which the specified value is to be associated @param value record which is to be appended @return the size of the collection under the sortKey.
[ "Appends", "a", "record", "into", "the", "buffer", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/rank/TopNBuffer.java#L58-L68
sarl/sarl
main/coreplugins/io.sarl.lang/src/io/sarl/lang/jvmmodel/SARLJvmModelInferrer.java
SARLJvmModelInferrer.cloneWithProxiesFromOtherResource
protected JvmTypeReference cloneWithProxiesFromOtherResource(JvmTypeReference type, JvmOperation target) { """ Clone the given type reference that is associated to another Xtext resource. <p>This function ensures that the resource of the reference clone is not pointing to the resource of the original reference. <p>This function calls {@link JvmTypesBuilder#cloneWithProxies(JvmTypeReference)} or {@link #cloneWithTypeParametersAndProxies(JvmTypeReference, JvmExecutable)} if the {@code target} is {@code null} for the first, and not {@code null} for the second. @param type the source type. @param target the operation for which the type is clone, or {@code null} if not relevant. @return the result type, i.e. a copy of the source type. """ if (type == null) { return this._typeReferenceBuilder.typeRef(Void.TYPE); } // Do not clone inferred types because they are not yet resolved and it is located within the current resource. if (InferredTypeIndicator.isInferred(type)) { return type; } // Do not clone primitive types because the associated resource to the type reference will not be correct. final String id = type.getIdentifier(); if (Objects.equal(id, Void.TYPE.getName())) { return this._typeReferenceBuilder.typeRef(Void.TYPE); } if (this.services.getPrimitives().isPrimitive(type)) { return this._typeReferenceBuilder.typeRef(id); } // Clone the type if (target != null) { return cloneWithTypeParametersAndProxies(type, target); } return this.typeBuilder.cloneWithProxies(type); }
java
protected JvmTypeReference cloneWithProxiesFromOtherResource(JvmTypeReference type, JvmOperation target) { if (type == null) { return this._typeReferenceBuilder.typeRef(Void.TYPE); } // Do not clone inferred types because they are not yet resolved and it is located within the current resource. if (InferredTypeIndicator.isInferred(type)) { return type; } // Do not clone primitive types because the associated resource to the type reference will not be correct. final String id = type.getIdentifier(); if (Objects.equal(id, Void.TYPE.getName())) { return this._typeReferenceBuilder.typeRef(Void.TYPE); } if (this.services.getPrimitives().isPrimitive(type)) { return this._typeReferenceBuilder.typeRef(id); } // Clone the type if (target != null) { return cloneWithTypeParametersAndProxies(type, target); } return this.typeBuilder.cloneWithProxies(type); }
[ "protected", "JvmTypeReference", "cloneWithProxiesFromOtherResource", "(", "JvmTypeReference", "type", ",", "JvmOperation", "target", ")", "{", "if", "(", "type", "==", "null", ")", "{", "return", "this", ".", "_typeReferenceBuilder", ".", "typeRef", "(", "Void", ...
Clone the given type reference that is associated to another Xtext resource. <p>This function ensures that the resource of the reference clone is not pointing to the resource of the original reference. <p>This function calls {@link JvmTypesBuilder#cloneWithProxies(JvmTypeReference)} or {@link #cloneWithTypeParametersAndProxies(JvmTypeReference, JvmExecutable)} if the {@code target} is {@code null} for the first, and not {@code null} for the second. @param type the source type. @param target the operation for which the type is clone, or {@code null} if not relevant. @return the result type, i.e. a copy of the source type.
[ "Clone", "the", "given", "type", "reference", "that", "is", "associated", "to", "another", "Xtext", "resource", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/jvmmodel/SARLJvmModelInferrer.java#L3324-L3345
apache/flink
flink-metrics/flink-metrics-core/src/main/java/org/apache/flink/metrics/MetricConfig.java
MetricConfig.getFloat
public float getFloat(String key, float defaultValue) { """ Searches for the property with the specified key in this property list. If the key is not found in this property list, the default property list, and its defaults, recursively, are then checked. The method returns the default value argument if the property is not found. @param key the hashtable key. @param defaultValue a default value. @return the value in this property list with the specified key value parsed as a float. """ String argument = getProperty(key, null); return argument == null ? defaultValue : Float.parseFloat(argument); }
java
public float getFloat(String key, float defaultValue) { String argument = getProperty(key, null); return argument == null ? defaultValue : Float.parseFloat(argument); }
[ "public", "float", "getFloat", "(", "String", "key", ",", "float", "defaultValue", ")", "{", "String", "argument", "=", "getProperty", "(", "key", ",", "null", ")", ";", "return", "argument", "==", "null", "?", "defaultValue", ":", "Float", ".", "parseFloa...
Searches for the property with the specified key in this property list. If the key is not found in this property list, the default property list, and its defaults, recursively, are then checked. The method returns the default value argument if the property is not found. @param key the hashtable key. @param defaultValue a default value. @return the value in this property list with the specified key value parsed as a float.
[ "Searches", "for", "the", "property", "with", "the", "specified", "key", "in", "this", "property", "list", ".", "If", "the", "key", "is", "not", "found", "in", "this", "property", "list", "the", "default", "property", "list", "and", "its", "defaults", "rec...
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-metrics/flink-metrics-core/src/main/java/org/apache/flink/metrics/MetricConfig.java#L76-L81
sarl/sarl
main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/extralanguage/preferences/ExtraLanguagePreferenceAccess.java
ExtraLanguagePreferenceAccess.getBoolean
public boolean getBoolean(String preferenceContainerID, IProject project, String preferenceName) { """ Replies the preference value. <p>This function takes care of the specific options that are associated to the given project. If the given project is {@code null} or has no specific options, according to {@link #ifSpecificConfiguration(String, IProject)}, then the global preferences are used. @param preferenceContainerID the identifier of the generator's preference container. @param project the context. If {@code null}, the global context is assumed. @param preferenceName the name of the preference. @return the value. @since 0.8 """ assert preferenceName != null; final IProject prj = ifSpecificConfiguration(preferenceContainerID, project); final IPreferenceStore store = getPreferenceStore(prj); return getBoolean(store, preferenceContainerID, preferenceName); }
java
public boolean getBoolean(String preferenceContainerID, IProject project, String preferenceName) { assert preferenceName != null; final IProject prj = ifSpecificConfiguration(preferenceContainerID, project); final IPreferenceStore store = getPreferenceStore(prj); return getBoolean(store, preferenceContainerID, preferenceName); }
[ "public", "boolean", "getBoolean", "(", "String", "preferenceContainerID", ",", "IProject", "project", ",", "String", "preferenceName", ")", "{", "assert", "preferenceName", "!=", "null", ";", "final", "IProject", "prj", "=", "ifSpecificConfiguration", "(", "prefere...
Replies the preference value. <p>This function takes care of the specific options that are associated to the given project. If the given project is {@code null} or has no specific options, according to {@link #ifSpecificConfiguration(String, IProject)}, then the global preferences are used. @param preferenceContainerID the identifier of the generator's preference container. @param project the context. If {@code null}, the global context is assumed. @param preferenceName the name of the preference. @return the value. @since 0.8
[ "Replies", "the", "preference", "value", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/extralanguage/preferences/ExtraLanguagePreferenceAccess.java#L167-L172
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/impl/RequestIdTable.java
RequestIdTable.getListener
public synchronized ReceiveListener getListener(int requestId) { """ Returns the receive listener associated with the specified request ID. The request ID must be present in the table otherwise a runtime exception will be thrown. @param requestId The request ID to retrieve the receive listener for. @return ReceiveListener The receive listener received. """ if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "getListener", ""+requestId); if (!containsId(requestId)) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) debugTraceTable("id ("+requestId+") not in table"); throw new SIErrorException(nls.getFormattedMessage("REQIDTABLE_INTERNAL_SICJ0058", null, "REQIDTABLE_INTERNAL_SICJ0058")); // D226223 } testReqIdTableEntry.requestId = requestId; RequestIdTableEntry entry = table.get(testReqIdTableEntry); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "getListener", entry.receiveListener); return entry.receiveListener; }
java
public synchronized ReceiveListener getListener(int requestId) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "getListener", ""+requestId); if (!containsId(requestId)) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) debugTraceTable("id ("+requestId+") not in table"); throw new SIErrorException(nls.getFormattedMessage("REQIDTABLE_INTERNAL_SICJ0058", null, "REQIDTABLE_INTERNAL_SICJ0058")); // D226223 } testReqIdTableEntry.requestId = requestId; RequestIdTableEntry entry = table.get(testReqIdTableEntry); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "getListener", entry.receiveListener); return entry.receiveListener; }
[ "public", "synchronized", "ReceiveListener", "getListener", "(", "int", "requestId", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "this", ",", "tc",...
Returns the receive listener associated with the specified request ID. The request ID must be present in the table otherwise a runtime exception will be thrown. @param requestId The request ID to retrieve the receive listener for. @return ReceiveListener The receive listener received.
[ "Returns", "the", "receive", "listener", "associated", "with", "the", "specified", "request", "ID", ".", "The", "request", "ID", "must", "be", "present", "in", "the", "table", "otherwise", "a", "runtime", "exception", "will", "be", "thrown", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/impl/RequestIdTable.java#L188-L203
icode/ameba
src/main/java/ameba/mvc/template/internal/AbstractTemplateProcessor.java
AbstractTemplateProcessor.setContentType
protected Charset setContentType(MediaType mediaType, MultivaluedMap<String, Object> httpHeaders) { """ <p>setContentType.</p> @param mediaType a {@link javax.ws.rs.core.MediaType} object. @param httpHeaders a {@link javax.ws.rs.core.MultivaluedMap} object. @return a {@link java.nio.charset.Charset} object. @since 0.1.6e """ String charset = mediaType.getParameters().get("charset"); Charset encoding; MediaType finalMediaType; if (charset == null) { encoding = this.getEncoding(); HashMap<String, String> typeList = Maps.newHashMap(mediaType.getParameters()); typeList.put("charset", encoding.name()); finalMediaType = new MediaType(mediaType.getType(), mediaType.getSubtype(), typeList); } else { try { encoding = Charset.forName(charset); } catch (Exception e) { encoding = Charsets.UTF_8; } finalMediaType = mediaType; } List<Object> typeList = Lists.newArrayListWithCapacity(1); typeList.add(finalMediaType.toString()); httpHeaders.put("Content-Type", typeList); return encoding; }
java
protected Charset setContentType(MediaType mediaType, MultivaluedMap<String, Object> httpHeaders) { String charset = mediaType.getParameters().get("charset"); Charset encoding; MediaType finalMediaType; if (charset == null) { encoding = this.getEncoding(); HashMap<String, String> typeList = Maps.newHashMap(mediaType.getParameters()); typeList.put("charset", encoding.name()); finalMediaType = new MediaType(mediaType.getType(), mediaType.getSubtype(), typeList); } else { try { encoding = Charset.forName(charset); } catch (Exception e) { encoding = Charsets.UTF_8; } finalMediaType = mediaType; } List<Object> typeList = Lists.newArrayListWithCapacity(1); typeList.add(finalMediaType.toString()); httpHeaders.put("Content-Type", typeList); return encoding; }
[ "protected", "Charset", "setContentType", "(", "MediaType", "mediaType", ",", "MultivaluedMap", "<", "String", ",", "Object", ">", "httpHeaders", ")", "{", "String", "charset", "=", "mediaType", ".", "getParameters", "(", ")", ".", "get", "(", "\"charset\"", "...
<p>setContentType.</p> @param mediaType a {@link javax.ws.rs.core.MediaType} object. @param httpHeaders a {@link javax.ws.rs.core.MultivaluedMap} object. @return a {@link java.nio.charset.Charset} object. @since 0.1.6e
[ "<p", ">", "setContentType", ".", "<", "/", "p", ">" ]
train
https://github.com/icode/ameba/blob/9d4956e935898e41331b2745e400ef869cd265e0/src/main/java/ameba/mvc/template/internal/AbstractTemplateProcessor.java#L166-L188
Squarespace/cldr
runtime/src/main/java/com/squarespace/cldr/dates/CalendarFormatterBase.java
CalendarFormatterBase.formatTimeZone_X
void formatTimeZone_X(StringBuilder b, ZonedDateTime d, int width, char ch) { """ Format timezone in ISO8601 basic or extended format for field 'x' or 'X'. http://www.unicode.org/reports/tr35/tr35-dates.html#dfst-zone """ int[] tz = getTzComponents(d); // Emit a 'Z' by itself for X if time is exactly GMT if (ch == 'X' && tz[TZOFFSET] == 0) { b.append('Z'); return; } switch (width) { case 5: case 4: case 3: case 2: case 1: if (tz[TZNEG] == -1) { b.append('-'); } else { b.append('+'); } zeroPad2(b, tz[TZHOURS], 2); // Delimiter is omitted for X, XX and XXXX if (width == 3 || width == 5) { b.append(':'); } int mins = tz[TZMINS]; // Minutes are optional for X if (width != 1 || mins > 0) { zeroPad2(b, mins, 2); } break; } }
java
void formatTimeZone_X(StringBuilder b, ZonedDateTime d, int width, char ch) { int[] tz = getTzComponents(d); // Emit a 'Z' by itself for X if time is exactly GMT if (ch == 'X' && tz[TZOFFSET] == 0) { b.append('Z'); return; } switch (width) { case 5: case 4: case 3: case 2: case 1: if (tz[TZNEG] == -1) { b.append('-'); } else { b.append('+'); } zeroPad2(b, tz[TZHOURS], 2); // Delimiter is omitted for X, XX and XXXX if (width == 3 || width == 5) { b.append(':'); } int mins = tz[TZMINS]; // Minutes are optional for X if (width != 1 || mins > 0) { zeroPad2(b, mins, 2); } break; } }
[ "void", "formatTimeZone_X", "(", "StringBuilder", "b", ",", "ZonedDateTime", "d", ",", "int", "width", ",", "char", "ch", ")", "{", "int", "[", "]", "tz", "=", "getTzComponents", "(", "d", ")", ";", "// Emit a 'Z' by itself for X if time is exactly GMT", "if", ...
Format timezone in ISO8601 basic or extended format for field 'x' or 'X'. http://www.unicode.org/reports/tr35/tr35-dates.html#dfst-zone
[ "Format", "timezone", "in", "ISO8601", "basic", "or", "extended", "format", "for", "field", "x", "or", "X", ".", "http", ":", "//", "www", ".", "unicode", ".", "org", "/", "reports", "/", "tr35", "/", "tr35", "-", "dates", ".", "html#dfst", "-", "zon...
train
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/dates/CalendarFormatterBase.java#L876-L911
overturetool/overture
core/codegen/platform/src/main/java/org/overture/codegen/analysis/vdm/VarShadowingRenameCollector.java
VarShadowingRenameCollector.visitModuleDefs
private void visitModuleDefs(List<PDefinition> defs, INode module) throws AnalysisException { """ Note that this methods is intended to work both for SL modules and PP/RT classes """ DefinitionInfo defInfo = getStateDefs(defs, module); if (defInfo != null) { addLocalDefs(defInfo); handleExecutables(defs); removeLocalDefs(defInfo); } else { handleExecutables(defs); } }
java
private void visitModuleDefs(List<PDefinition> defs, INode module) throws AnalysisException { DefinitionInfo defInfo = getStateDefs(defs, module); if (defInfo != null) { addLocalDefs(defInfo); handleExecutables(defs); removeLocalDefs(defInfo); } else { handleExecutables(defs); } }
[ "private", "void", "visitModuleDefs", "(", "List", "<", "PDefinition", ">", "defs", ",", "INode", "module", ")", "throws", "AnalysisException", "{", "DefinitionInfo", "defInfo", "=", "getStateDefs", "(", "defs", ",", "module", ")", ";", "if", "(", "defInfo", ...
Note that this methods is intended to work both for SL modules and PP/RT classes
[ "Note", "that", "this", "methods", "is", "intended", "to", "work", "both", "for", "SL", "modules", "and", "PP", "/", "RT", "classes" ]
train
https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/core/codegen/platform/src/main/java/org/overture/codegen/analysis/vdm/VarShadowingRenameCollector.java#L720-L734
Azure/azure-sdk-for-java
policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyStatesInner.java
PolicyStatesInner.summarizeForSubscriptionLevelPolicyAssignmentAsync
public Observable<SummarizeResultsInner> summarizeForSubscriptionLevelPolicyAssignmentAsync(String subscriptionId, String policyAssignmentName) { """ Summarizes policy states for the subscription level policy assignment. @param subscriptionId Microsoft Azure subscription ID. @param policyAssignmentName Policy assignment name. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the SummarizeResultsInner object """ return summarizeForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, policyAssignmentName).map(new Func1<ServiceResponse<SummarizeResultsInner>, SummarizeResultsInner>() { @Override public SummarizeResultsInner call(ServiceResponse<SummarizeResultsInner> response) { return response.body(); } }); }
java
public Observable<SummarizeResultsInner> summarizeForSubscriptionLevelPolicyAssignmentAsync(String subscriptionId, String policyAssignmentName) { return summarizeForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, policyAssignmentName).map(new Func1<ServiceResponse<SummarizeResultsInner>, SummarizeResultsInner>() { @Override public SummarizeResultsInner call(ServiceResponse<SummarizeResultsInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "SummarizeResultsInner", ">", "summarizeForSubscriptionLevelPolicyAssignmentAsync", "(", "String", "subscriptionId", ",", "String", "policyAssignmentName", ")", "{", "return", "summarizeForSubscriptionLevelPolicyAssignmentWithServiceResponseAsync", "(", ...
Summarizes policy states for the subscription level policy assignment. @param subscriptionId Microsoft Azure subscription ID. @param policyAssignmentName Policy assignment name. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the SummarizeResultsInner object
[ "Summarizes", "policy", "states", "for", "the", "subscription", "level", "policy", "assignment", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyStatesInner.java#L2714-L2721
jblas-project/jblas
src/main/java/org/jblas/ComplexDouble.java
ComplexDouble.subi
public ComplexDouble subi(ComplexDouble c, ComplexDouble result) { """ Subtract two complex numbers, in-place @param c complex number to subtract @param result resulting complex number @return same as result """ if (this == result) { r -= c.r; i -= c.i; } else { result.r = r - c.r; result.i = i - c.i; } return this; }
java
public ComplexDouble subi(ComplexDouble c, ComplexDouble result) { if (this == result) { r -= c.r; i -= c.i; } else { result.r = r - c.r; result.i = i - c.i; } return this; }
[ "public", "ComplexDouble", "subi", "(", "ComplexDouble", "c", ",", "ComplexDouble", "result", ")", "{", "if", "(", "this", "==", "result", ")", "{", "r", "-=", "c", ".", "r", ";", "i", "-=", "c", ".", "i", ";", "}", "else", "{", "result", ".", "r...
Subtract two complex numbers, in-place @param c complex number to subtract @param result resulting complex number @return same as result
[ "Subtract", "two", "complex", "numbers", "in", "-", "place" ]
train
https://github.com/jblas-project/jblas/blob/2818f231228e655cda80dfd8e0b87709fdfd8a70/src/main/java/org/jblas/ComplexDouble.java#L176-L185
Jasig/uPortal
uPortal-portlets/src/main/java/org/apereo/portal/portlets/search/SearchPortletController.java
SearchPortletController.cleanAndTrimString
private String cleanAndTrimString(String text, int maxTextLength) { """ for slower network connections and makes autocomplete UI results smaller/shorter. """ if (StringUtils.isNotBlank(text)) { String cleaned = text.trim().replaceAll("[\\s]+", " "); return cleaned.length() <= maxTextLength ? cleaned : cleaned.substring(0, maxTextLength) + " ..."; } return text; }
java
private String cleanAndTrimString(String text, int maxTextLength) { if (StringUtils.isNotBlank(text)) { String cleaned = text.trim().replaceAll("[\\s]+", " "); return cleaned.length() <= maxTextLength ? cleaned : cleaned.substring(0, maxTextLength) + " ..."; } return text; }
[ "private", "String", "cleanAndTrimString", "(", "String", "text", ",", "int", "maxTextLength", ")", "{", "if", "(", "StringUtils", ".", "isNotBlank", "(", "text", ")", ")", "{", "String", "cleaned", "=", "text", ".", "trim", "(", ")", ".", "replaceAll", ...
for slower network connections and makes autocomplete UI results smaller/shorter.
[ "for", "slower", "network", "connections", "and", "makes", "autocomplete", "UI", "results", "smaller", "/", "shorter", "." ]
train
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-portlets/src/main/java/org/apereo/portal/portlets/search/SearchPortletController.java#L771-L779
sdaschner/jaxrs-analyzer
src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/bytecode/simulation/MethodSimulator.java
MethodSimulator.simulateStore
private void simulateStore(final StoreInstruction instruction) { """ Simulates the store instruction. @param instruction The instruction to simulate """ final int index = instruction.getNumber(); final Element elementToStore = runtimeStack.pop(); if (elementToStore instanceof MethodHandle) mergeMethodHandleStore(index, (MethodHandle) elementToStore); else mergeElementStore(index, instruction.getVariableType(), elementToStore); }
java
private void simulateStore(final StoreInstruction instruction) { final int index = instruction.getNumber(); final Element elementToStore = runtimeStack.pop(); if (elementToStore instanceof MethodHandle) mergeMethodHandleStore(index, (MethodHandle) elementToStore); else mergeElementStore(index, instruction.getVariableType(), elementToStore); }
[ "private", "void", "simulateStore", "(", "final", "StoreInstruction", "instruction", ")", "{", "final", "int", "index", "=", "instruction", ".", "getNumber", "(", ")", ";", "final", "Element", "elementToStore", "=", "runtimeStack", ".", "pop", "(", ")", ";", ...
Simulates the store instruction. @param instruction The instruction to simulate
[ "Simulates", "the", "store", "instruction", "." ]
train
https://github.com/sdaschner/jaxrs-analyzer/blob/4ac62942202d05632977d6c14d3cd7e2d27e2b9b/src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/bytecode/simulation/MethodSimulator.java#L205-L213
ModeShape/modeshape
modeshape-schematic/src/main/java/org/modeshape/schematic/Schematic.java
Schematic.getDb
public static <T extends SchematicDb> T getDb(Document document) throws RuntimeException { """ Returns a DB with the given configuration document {@code Document}. This document is expected to contain a {@link Schematic#TYPE_FIELD type field} to indicate the type of DB. @see #getDb(Document, ClassLoader) """ return getDb(document, Schematic.class.getClassLoader()); }
java
public static <T extends SchematicDb> T getDb(Document document) throws RuntimeException { return getDb(document, Schematic.class.getClassLoader()); }
[ "public", "static", "<", "T", "extends", "SchematicDb", ">", "T", "getDb", "(", "Document", "document", ")", "throws", "RuntimeException", "{", "return", "getDb", "(", "document", ",", "Schematic", ".", "class", ".", "getClassLoader", "(", ")", ")", ";", "...
Returns a DB with the given configuration document {@code Document}. This document is expected to contain a {@link Schematic#TYPE_FIELD type field} to indicate the type of DB. @see #getDb(Document, ClassLoader)
[ "Returns", "a", "DB", "with", "the", "given", "configuration", "document", "{", "@code", "Document", "}", ".", "This", "document", "is", "expected", "to", "contain", "a", "{", "@link", "Schematic#TYPE_FIELD", "type", "field", "}", "to", "indicate", "the", "t...
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-schematic/src/main/java/org/modeshape/schematic/Schematic.java#L52-L54
gallandarakhneorg/afc
advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/tree/GISTreeSetUtil.java
GISTreeSetUtil.computeCutPoint
private static <P extends GISPrimitive, N extends AbstractGISTreeSetNode<P, N>> Point2d computeCutPoint(IcosepQuadTreeZone region, N parent) { """ Computes the cut planes' position of the given region. @param region is the id of the region for which the cut plane position must be computed @param parent is the parent node. @return the cut planes' position of the region, or <code>null</code> if the cut planes' position could not be computed (because the region is the icosep region for instance). """ final double w = parent.nodeWidth / 4.; final double h = parent.nodeHeight / 4.; final double x; final double y; switch (region) { case SOUTH_WEST: x = parent.verticalSplit - w; y = parent.horizontalSplit - h; break; case SOUTH_EAST: x = parent.verticalSplit + w; y = parent.horizontalSplit - h; break; case NORTH_WEST: x = parent.verticalSplit - w; y = parent.horizontalSplit + h; break; case NORTH_EAST: x = parent.verticalSplit + w; y = parent.horizontalSplit + h; break; case ICOSEP: default: return null; } return new Point2d(x, y); }
java
private static <P extends GISPrimitive, N extends AbstractGISTreeSetNode<P, N>> Point2d computeCutPoint(IcosepQuadTreeZone region, N parent) { final double w = parent.nodeWidth / 4.; final double h = parent.nodeHeight / 4.; final double x; final double y; switch (region) { case SOUTH_WEST: x = parent.verticalSplit - w; y = parent.horizontalSplit - h; break; case SOUTH_EAST: x = parent.verticalSplit + w; y = parent.horizontalSplit - h; break; case NORTH_WEST: x = parent.verticalSplit - w; y = parent.horizontalSplit + h; break; case NORTH_EAST: x = parent.verticalSplit + w; y = parent.horizontalSplit + h; break; case ICOSEP: default: return null; } return new Point2d(x, y); }
[ "private", "static", "<", "P", "extends", "GISPrimitive", ",", "N", "extends", "AbstractGISTreeSetNode", "<", "P", ",", "N", ">", ">", "Point2d", "computeCutPoint", "(", "IcosepQuadTreeZone", "region", ",", "N", "parent", ")", "{", "final", "double", "w", "=...
Computes the cut planes' position of the given region. @param region is the id of the region for which the cut plane position must be computed @param parent is the parent node. @return the cut planes' position of the region, or <code>null</code> if the cut planes' position could not be computed (because the region is the icosep region for instance).
[ "Computes", "the", "cut", "planes", "position", "of", "the", "given", "region", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/tree/GISTreeSetUtil.java#L512-L540
OpenLiberty/open-liberty
dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java
WSRdbManagedConnectionImpl.setAutoCommit
public final void setAutoCommit(boolean value) throws SQLException { """ /* Sets the requested autocommit value for the underlying connection if different than the currently requested value or if required to always set the autocommit value as a workaround. 346032.2 @param value the newly requested autocommit value. """ if (value != currentAutoCommit || helper.alwaysSetAutoCommit()) { if( (dsConfig.get().isolationLevel == Connection.TRANSACTION_NONE) && (value == false) ) throw new SQLException(AdapterUtil.getNLSMessage("DSRA4010.tran.none.autocommit.required", dsConfig.get().id)); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(this, tc, "Set AutoCommit to " + value); // Don't update values until AFTER the operation completes successfully on the // underlying Connection. sqlConn.setAutoCommit(value); currentAutoCommit = value; } if (cachedConnection != null) cachedConnection.setCurrentAutoCommit(currentAutoCommit, key); }
java
public final void setAutoCommit(boolean value) throws SQLException { if (value != currentAutoCommit || helper.alwaysSetAutoCommit()) { if( (dsConfig.get().isolationLevel == Connection.TRANSACTION_NONE) && (value == false) ) throw new SQLException(AdapterUtil.getNLSMessage("DSRA4010.tran.none.autocommit.required", dsConfig.get().id)); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(this, tc, "Set AutoCommit to " + value); // Don't update values until AFTER the operation completes successfully on the // underlying Connection. sqlConn.setAutoCommit(value); currentAutoCommit = value; } if (cachedConnection != null) cachedConnection.setCurrentAutoCommit(currentAutoCommit, key); }
[ "public", "final", "void", "setAutoCommit", "(", "boolean", "value", ")", "throws", "SQLException", "{", "if", "(", "value", "!=", "currentAutoCommit", "||", "helper", ".", "alwaysSetAutoCommit", "(", ")", ")", "{", "if", "(", "(", "dsConfig", ".", "get", ...
/* Sets the requested autocommit value for the underlying connection if different than the currently requested value or if required to always set the autocommit value as a workaround. 346032.2 @param value the newly requested autocommit value.
[ "/", "*", "Sets", "the", "requested", "autocommit", "value", "for", "the", "underlying", "connection", "if", "different", "than", "the", "currently", "requested", "value", "or", "if", "required", "to", "always", "set", "the", "autocommit", "value", "as", "a", ...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java#L3950-L3967
alkacon/opencms-core
src/org/opencms/search/CmsSearch.java
CmsSearch.addFieldQueryMustNot
public void addFieldQueryMustNot(String fieldName, String searchQuery) { """ Adds an individual query for a search field that MUST NOT occur.<p> If this is used, any setting made with {@link #setQuery(String)} and {@link #setField(String[])} will be ignored and only the individual field search settings will be used.<p> When combining occurrences of SHOULD, MUST and MUST_NOT, keep the following in mind: All SHOULD clauses will be grouped and wrapped in one query, all MUST and MUST_NOT clauses will be grouped in another query. This means that at least one of the terms which are given as a SHOULD query must occur in the search result.<p> @param fieldName the field name @param searchQuery the search query @since 7.5.1 """ addFieldQuery(fieldName, searchQuery, BooleanClause.Occur.MUST_NOT); }
java
public void addFieldQueryMustNot(String fieldName, String searchQuery) { addFieldQuery(fieldName, searchQuery, BooleanClause.Occur.MUST_NOT); }
[ "public", "void", "addFieldQueryMustNot", "(", "String", "fieldName", ",", "String", "searchQuery", ")", "{", "addFieldQuery", "(", "fieldName", ",", "searchQuery", ",", "BooleanClause", ".", "Occur", ".", "MUST_NOT", ")", ";", "}" ]
Adds an individual query for a search field that MUST NOT occur.<p> If this is used, any setting made with {@link #setQuery(String)} and {@link #setField(String[])} will be ignored and only the individual field search settings will be used.<p> When combining occurrences of SHOULD, MUST and MUST_NOT, keep the following in mind: All SHOULD clauses will be grouped and wrapped in one query, all MUST and MUST_NOT clauses will be grouped in another query. This means that at least one of the terms which are given as a SHOULD query must occur in the search result.<p> @param fieldName the field name @param searchQuery the search query @since 7.5.1
[ "Adds", "an", "individual", "query", "for", "a", "search", "field", "that", "MUST", "NOT", "occur", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/CmsSearch.java#L209-L212
mbeiter/util
db/src/main/java/org/beiter/michael/db/ConnectionFactory.java
ConnectionFactory.getConnection
public static Connection getConnection(final String jndiName) throws FactoryException { """ Return a Connection instance for a JNDI managed JDBC connection. @param jndiName The JNDI connection name @return a JDBC connection @throws FactoryException When the connection cannot be retrieved from JNDI @throws NullPointerException When {@code jndiName} is null @throws IllegalArgumentException When {@code jndiName} is empty """ Validate.notBlank(jndiName, "The validated character sequence 'jndiName' is null or empty"); // no need for defensive copies of Strings try { return DataSourceFactory.getDataSource(jndiName).getConnection(); } catch (SQLException e) { final String error = "Error retrieving JDBC connection from JNDI: " + jndiName; LOG.warn(error); throw new FactoryException(error, e); } }
java
public static Connection getConnection(final String jndiName) throws FactoryException { Validate.notBlank(jndiName, "The validated character sequence 'jndiName' is null or empty"); // no need for defensive copies of Strings try { return DataSourceFactory.getDataSource(jndiName).getConnection(); } catch (SQLException e) { final String error = "Error retrieving JDBC connection from JNDI: " + jndiName; LOG.warn(error); throw new FactoryException(error, e); } }
[ "public", "static", "Connection", "getConnection", "(", "final", "String", "jndiName", ")", "throws", "FactoryException", "{", "Validate", ".", "notBlank", "(", "jndiName", ",", "\"The validated character sequence 'jndiName' is null or empty\"", ")", ";", "// no need for de...
Return a Connection instance for a JNDI managed JDBC connection. @param jndiName The JNDI connection name @return a JDBC connection @throws FactoryException When the connection cannot be retrieved from JNDI @throws NullPointerException When {@code jndiName} is null @throws IllegalArgumentException When {@code jndiName} is empty
[ "Return", "a", "Connection", "instance", "for", "a", "JNDI", "managed", "JDBC", "connection", "." ]
train
https://github.com/mbeiter/util/blob/490fcebecb936e00c2f2ce2096b679b2fd10865e/db/src/main/java/org/beiter/michael/db/ConnectionFactory.java#L71-L85
menacher/java-game-server
jetclient/src/main/java/org/menacheri/jetclient/util/NettyUtils.java
NettyUtils.readStrings
public static String[] readStrings(ChannelBuffer buffer, int numOfStrings) { """ This method will read multiple strings of the buffer and return them as a string array. It internally uses the readString(ChannelBuffer buffer) to accomplish this task. The strings are read back in the order they are written. @param buffer The buffer containing the strings, with each string being a strlength-strbytes combination. @param numOfStrings The number of strings to be read. Should not be negative or 0 @return the strings read from the buffer as an array. """ return readStrings(buffer,numOfStrings,CharsetUtil.UTF_8); }
java
public static String[] readStrings(ChannelBuffer buffer, int numOfStrings) { return readStrings(buffer,numOfStrings,CharsetUtil.UTF_8); }
[ "public", "static", "String", "[", "]", "readStrings", "(", "ChannelBuffer", "buffer", ",", "int", "numOfStrings", ")", "{", "return", "readStrings", "(", "buffer", ",", "numOfStrings", ",", "CharsetUtil", ".", "UTF_8", ")", ";", "}" ]
This method will read multiple strings of the buffer and return them as a string array. It internally uses the readString(ChannelBuffer buffer) to accomplish this task. The strings are read back in the order they are written. @param buffer The buffer containing the strings, with each string being a strlength-strbytes combination. @param numOfStrings The number of strings to be read. Should not be negative or 0 @return the strings read from the buffer as an array.
[ "This", "method", "will", "read", "multiple", "strings", "of", "the", "buffer", "and", "return", "them", "as", "a", "string", "array", ".", "It", "internally", "uses", "the", "readString", "(", "ChannelBuffer", "buffer", ")", "to", "accomplish", "this", "tas...
train
https://github.com/menacher/java-game-server/blob/668ca49e8bd1dac43add62378cf6c22a93125d48/jetclient/src/main/java/org/menacheri/jetclient/util/NettyUtils.java#L65-L68
greatman/GreatmancodeTools
src/main/java/com/greatmancode/tools/utils/Vector.java
Vector.isInAABB
public boolean isInAABB(Vector min, Vector max) { """ Returns whether this vector is in an axis-aligned bounding box. <p> The minimum and maximum vectors given must be truly the minimum and maximum X, Y and Z components. @param min Minimum vector @param max Maximum vector @return whether this vector is in the AABB """ return x >= min.x && x <= max.x && y >= min.y && y <= max.y && z >= min.z && z <= max.z; }
java
public boolean isInAABB(Vector min, Vector max) { return x >= min.x && x <= max.x && y >= min.y && y <= max.y && z >= min.z && z <= max.z; }
[ "public", "boolean", "isInAABB", "(", "Vector", "min", ",", "Vector", "max", ")", "{", "return", "x", ">=", "min", ".", "x", "&&", "x", "<=", "max", ".", "x", "&&", "y", ">=", "min", ".", "y", "&&", "y", "<=", "max", ".", "y", "&&", "z", ">="...
Returns whether this vector is in an axis-aligned bounding box. <p> The minimum and maximum vectors given must be truly the minimum and maximum X, Y and Z components. @param min Minimum vector @param max Maximum vector @return whether this vector is in the AABB
[ "Returns", "whether", "this", "vector", "is", "in", "an", "axis", "-", "aligned", "bounding", "box", ".", "<p", ">", "The", "minimum", "and", "maximum", "vectors", "given", "must", "be", "truly", "the", "minimum", "and", "maximum", "X", "Y", "and", "Z", ...
train
https://github.com/greatman/GreatmancodeTools/blob/4c9d2656c5c8298ff9e1f235c9be8b148e43c9f1/src/main/java/com/greatmancode/tools/utils/Vector.java#L357-L359
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/SerializedFormBuilder.java
SerializedFormBuilder.buildSerializableFields
public void buildSerializableFields(XMLNode node, Content classContentTree) throws DocletException { """ Build the summaries for the fields that belong to the given class. @param node the XML element that specifies which components to document @param classContentTree content tree to which the documentation will be added @throws DocletException if there is a problem while building the documentation """ SortedSet<VariableElement> members = utils.serializableFields(currentTypeElement); if (!members.isEmpty()) { Content serializableFieldsTree = fieldWriter.getSerializableFieldsHeader(); for (VariableElement ve : members) { currentMember = ve; if (!utils.definesSerializableFields(currentTypeElement)) { Content fieldsContentTree = fieldWriter.getFieldsContentHeader( currentMember == members.last()); buildChildren(node, fieldsContentTree); serializableFieldsTree.addContent(fieldsContentTree); } else { buildSerialFieldTagsInfo(serializableFieldsTree); } } classContentTree.addContent(fieldWriter.getSerializableFields( configuration.getText("doclet.Serialized_Form_fields"), serializableFieldsTree)); } }
java
public void buildSerializableFields(XMLNode node, Content classContentTree) throws DocletException { SortedSet<VariableElement> members = utils.serializableFields(currentTypeElement); if (!members.isEmpty()) { Content serializableFieldsTree = fieldWriter.getSerializableFieldsHeader(); for (VariableElement ve : members) { currentMember = ve; if (!utils.definesSerializableFields(currentTypeElement)) { Content fieldsContentTree = fieldWriter.getFieldsContentHeader( currentMember == members.last()); buildChildren(node, fieldsContentTree); serializableFieldsTree.addContent(fieldsContentTree); } else { buildSerialFieldTagsInfo(serializableFieldsTree); } } classContentTree.addContent(fieldWriter.getSerializableFields( configuration.getText("doclet.Serialized_Form_fields"), serializableFieldsTree)); } }
[ "public", "void", "buildSerializableFields", "(", "XMLNode", "node", ",", "Content", "classContentTree", ")", "throws", "DocletException", "{", "SortedSet", "<", "VariableElement", ">", "members", "=", "utils", ".", "serializableFields", "(", "currentTypeElement", ")"...
Build the summaries for the fields that belong to the given class. @param node the XML element that specifies which components to document @param classContentTree content tree to which the documentation will be added @throws DocletException if there is a problem while building the documentation
[ "Build", "the", "summaries", "for", "the", "fields", "that", "belong", "to", "the", "given", "class", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/SerializedFormBuilder.java#L426-L446
remkop/picocli
src/main/java/picocli/CommandLine.java
CommandLine.addSubcommand
public CommandLine addSubcommand(String name, Object command, String... aliases) { """ Registers a subcommand with the specified name and all specified aliases. See also {@link #addSubcommand(String, Object)}. @param name the string to recognize on the command line as a subcommand @param command the object to initialize with command line arguments following the subcommand name. This may be a {@code CommandLine} instance with its own (nested) subcommands @param aliases zero or more alias names that are also recognized on the command line as this subcommand @return this CommandLine object, to allow method chaining @since 3.1 @see #addSubcommand(String, Object) """ CommandLine subcommandLine = toCommandLine(command, factory); subcommandLine.getCommandSpec().aliases.addAll(Arrays.asList(aliases)); getCommandSpec().addSubcommand(name, subcommandLine); CommandLine.Model.CommandReflection.initParentCommand(subcommandLine.getCommandSpec().userObject(), getCommandSpec().userObject()); return this; }
java
public CommandLine addSubcommand(String name, Object command, String... aliases) { CommandLine subcommandLine = toCommandLine(command, factory); subcommandLine.getCommandSpec().aliases.addAll(Arrays.asList(aliases)); getCommandSpec().addSubcommand(name, subcommandLine); CommandLine.Model.CommandReflection.initParentCommand(subcommandLine.getCommandSpec().userObject(), getCommandSpec().userObject()); return this; }
[ "public", "CommandLine", "addSubcommand", "(", "String", "name", ",", "Object", "command", ",", "String", "...", "aliases", ")", "{", "CommandLine", "subcommandLine", "=", "toCommandLine", "(", "command", ",", "factory", ")", ";", "subcommandLine", ".", "getComm...
Registers a subcommand with the specified name and all specified aliases. See also {@link #addSubcommand(String, Object)}. @param name the string to recognize on the command line as a subcommand @param command the object to initialize with command line arguments following the subcommand name. This may be a {@code CommandLine} instance with its own (nested) subcommands @param aliases zero or more alias names that are also recognized on the command line as this subcommand @return this CommandLine object, to allow method chaining @since 3.1 @see #addSubcommand(String, Object)
[ "Registers", "a", "subcommand", "with", "the", "specified", "name", "and", "all", "specified", "aliases", ".", "See", "also", "{", "@link", "#addSubcommand", "(", "String", "Object", ")", "}", "." ]
train
https://github.com/remkop/picocli/blob/3c5384f0d12817401d1921c3013c1282e2edcab2/src/main/java/picocli/CommandLine.java#L313-L319
elki-project/elki
addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/style/PropertiesBasedStyleLibrary.java
PropertiesBasedStyleLibrary.getCached
private <T> T getCached(String prefix, String postfix, Class<T> cls) { """ Get a value from the cache (to avoid repeated parsing) @param <T> Type @param prefix Tree name @param postfix Property name @param cls Class restriction @return Resulting value """ return cls.cast(cache.get(prefix + '.' + postfix)); }
java
private <T> T getCached(String prefix, String postfix, Class<T> cls) { return cls.cast(cache.get(prefix + '.' + postfix)); }
[ "private", "<", "T", ">", "T", "getCached", "(", "String", "prefix", ",", "String", "postfix", ",", "Class", "<", "T", ">", "cls", ")", "{", "return", "cls", ".", "cast", "(", "cache", ".", "get", "(", "prefix", "+", "'", "'", "+", "postfix", ")"...
Get a value from the cache (to avoid repeated parsing) @param <T> Type @param prefix Tree name @param postfix Property name @param cls Class restriction @return Resulting value
[ "Get", "a", "value", "from", "the", "cache", "(", "to", "avoid", "repeated", "parsing", ")" ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/style/PropertiesBasedStyleLibrary.java#L169-L171
strator-dev/greenpepper
greenpepper/core/src/main/java/com/greenpepper/util/DuckType.java
DuckType.instanceOf
public static boolean instanceOf(Class type, Object object) { """ Indicates if object is a (DuckType) instance of a type (interface). That is, is every method in type is present on object. @param type The interface to implement @param object The object to test @return true if every method in type is present on object, false otherwise """ if (type.isInstance(object)) return true; Class<?> candidate = object.getClass(); for (Method method : type.getMethods()) { try { candidate.getMethod(method.getName(), (Class[])method.getParameterTypes()); } catch (NoSuchMethodException e) { return false; } } return true; }
java
public static boolean instanceOf(Class type, Object object) { if (type.isInstance(object)) return true; Class<?> candidate = object.getClass(); for (Method method : type.getMethods()) { try { candidate.getMethod(method.getName(), (Class[])method.getParameterTypes()); } catch (NoSuchMethodException e) { return false; } } return true; }
[ "public", "static", "boolean", "instanceOf", "(", "Class", "type", ",", "Object", "object", ")", "{", "if", "(", "type", ".", "isInstance", "(", "object", ")", ")", "return", "true", ";", "Class", "<", "?", ">", "candidate", "=", "object", ".", "getCla...
Indicates if object is a (DuckType) instance of a type (interface). That is, is every method in type is present on object. @param type The interface to implement @param object The object to test @return true if every method in type is present on object, false otherwise
[ "Indicates", "if", "object", "is", "a", "(", "DuckType", ")", "instance", "of", "a", "type", "(", "interface", ")", ".", "That", "is", "is", "every", "method", "in", "type", "is", "present", "on", "object", "." ]
train
https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper/core/src/main/java/com/greenpepper/util/DuckType.java#L51-L68
redkale/redkale
src/org/redkale/source/EntityInfo.java
EntityInfo.formatSQLValue
protected CharSequence formatSQLValue(String col, Attribute<T, Serializable> attr, final ColumnValue cv) { """ 拼接UPDATE给字段赋值的SQL片段 @param col 表字段名 @param attr Attribute @param cv ColumnValue @return CharSequence """ if (cv == null) return null; Object val = cv.getValue(); CryptHandler handler = attr.attach(); if (handler != null) val = handler.encrypt(val); switch (cv.getExpress()) { case INC: return new StringBuilder().append(col).append(" + ").append(val); case MUL: return new StringBuilder().append(col).append(" * ").append(val); case AND: return new StringBuilder().append(col).append(" & ").append(val); case ORR: return new StringBuilder().append(col).append(" | ").append(val); case MOV: return formatToString(val); } return formatToString(val); }
java
protected CharSequence formatSQLValue(String col, Attribute<T, Serializable> attr, final ColumnValue cv) { if (cv == null) return null; Object val = cv.getValue(); CryptHandler handler = attr.attach(); if (handler != null) val = handler.encrypt(val); switch (cv.getExpress()) { case INC: return new StringBuilder().append(col).append(" + ").append(val); case MUL: return new StringBuilder().append(col).append(" * ").append(val); case AND: return new StringBuilder().append(col).append(" & ").append(val); case ORR: return new StringBuilder().append(col).append(" | ").append(val); case MOV: return formatToString(val); } return formatToString(val); }
[ "protected", "CharSequence", "formatSQLValue", "(", "String", "col", ",", "Attribute", "<", "T", ",", "Serializable", ">", "attr", ",", "final", "ColumnValue", "cv", ")", "{", "if", "(", "cv", "==", "null", ")", "return", "null", ";", "Object", "val", "=...
拼接UPDATE给字段赋值的SQL片段 @param col 表字段名 @param attr Attribute @param cv ColumnValue @return CharSequence
[ "拼接UPDATE给字段赋值的SQL片段" ]
train
https://github.com/redkale/redkale/blob/ea5169b5c5ea7412fd762331c0c497165832e901/src/org/redkale/source/EntityInfo.java#L956-L974
alkacon/opencms-core
src/org/opencms/db/CmsSecurityManager.java
CmsSecurityManager.readChildResources
public List<CmsResource> readChildResources( CmsRequestContext context, CmsResource resource, CmsResourceFilter filter, boolean getFolders, boolean getFiles) throws CmsException, CmsSecurityException { """ Returns the child resources of a resource, that is the resources contained in a folder.<p> With the parameters <code>getFolders</code> and <code>getFiles</code> you can control what type of resources you want in the result list: files, folders, or both.<p> This method is mainly used by the workplace explorer.<p> @param context the current request context @param resource the resource to return the child resources for @param filter the resource filter to use @param getFolders if true the child folders are included in the result @param getFiles if true the child files are included in the result @return a list of all child resources @throws CmsException if something goes wrong @throws CmsSecurityException if the user has insufficient permission for the given resource (read is required) """ List<CmsResource> result = null; CmsDbContext dbc = m_dbContextFactory.getDbContext(context); try { // check the access permissions checkPermissions(dbc, resource, CmsPermissionSet.ACCESS_READ, true, CmsResourceFilter.ALL); result = m_driverManager.readChildResources(dbc, resource, filter, getFolders, getFiles, true); } catch (Exception e) { dbc.report( null, Messages.get().container(Messages.ERR_READ_CHILD_RESOURCES_1, context.getSitePath(resource)), e); } finally { dbc.clear(); } return result; }
java
public List<CmsResource> readChildResources( CmsRequestContext context, CmsResource resource, CmsResourceFilter filter, boolean getFolders, boolean getFiles) throws CmsException, CmsSecurityException { List<CmsResource> result = null; CmsDbContext dbc = m_dbContextFactory.getDbContext(context); try { // check the access permissions checkPermissions(dbc, resource, CmsPermissionSet.ACCESS_READ, true, CmsResourceFilter.ALL); result = m_driverManager.readChildResources(dbc, resource, filter, getFolders, getFiles, true); } catch (Exception e) { dbc.report( null, Messages.get().container(Messages.ERR_READ_CHILD_RESOURCES_1, context.getSitePath(resource)), e); } finally { dbc.clear(); } return result; }
[ "public", "List", "<", "CmsResource", ">", "readChildResources", "(", "CmsRequestContext", "context", ",", "CmsResource", "resource", ",", "CmsResourceFilter", "filter", ",", "boolean", "getFolders", ",", "boolean", "getFiles", ")", "throws", "CmsException", ",", "C...
Returns the child resources of a resource, that is the resources contained in a folder.<p> With the parameters <code>getFolders</code> and <code>getFiles</code> you can control what type of resources you want in the result list: files, folders, or both.<p> This method is mainly used by the workplace explorer.<p> @param context the current request context @param resource the resource to return the child resources for @param filter the resource filter to use @param getFolders if true the child folders are included in the result @param getFiles if true the child files are included in the result @return a list of all child resources @throws CmsException if something goes wrong @throws CmsSecurityException if the user has insufficient permission for the given resource (read is required)
[ "Returns", "the", "child", "resources", "of", "a", "resource", "that", "is", "the", "resources", "contained", "in", "a", "folder", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSecurityManager.java#L4134-L4157
codeprimate-software/cp-elements
src/main/java/org/cp/elements/util/Environment.java
Environment.getAs
public <T> T getAs(String environmentVariableName, Class<T> type, T defaultValue) { """ Returns the value set for the environment variable identified by the given name as the given {@link Class} type. Returns the {@code defaultValue} if the named environment variable is not set. @param <T> {@link Class} type to convert the environment variable value to. @param environmentVariableName {@link String} name of the environment variable. @param type {@link Class} type to convert the environment variable value to. @param defaultValue the default value to return if the specified environment variable is not set. @return the value set the environment variable identified by the given name as the given {@link Class} type or {@code defaultValue} if the named environment variable is not set. @see #environmentVariables() """ return environmentVariables().getAsType(environmentVariableName, type, defaultValue); }
java
public <T> T getAs(String environmentVariableName, Class<T> type, T defaultValue) { return environmentVariables().getAsType(environmentVariableName, type, defaultValue); }
[ "public", "<", "T", ">", "T", "getAs", "(", "String", "environmentVariableName", ",", "Class", "<", "T", ">", "type", ",", "T", "defaultValue", ")", "{", "return", "environmentVariables", "(", ")", ".", "getAsType", "(", "environmentVariableName", ",", "type...
Returns the value set for the environment variable identified by the given name as the given {@link Class} type. Returns the {@code defaultValue} if the named environment variable is not set. @param <T> {@link Class} type to convert the environment variable value to. @param environmentVariableName {@link String} name of the environment variable. @param type {@link Class} type to convert the environment variable value to. @param defaultValue the default value to return if the specified environment variable is not set. @return the value set the environment variable identified by the given name as the given {@link Class} type or {@code defaultValue} if the named environment variable is not set. @see #environmentVariables()
[ "Returns", "the", "value", "set", "for", "the", "environment", "variable", "identified", "by", "the", "given", "name", "as", "the", "given", "{", "@link", "Class", "}", "type", ".", "Returns", "the", "{", "@code", "defaultValue", "}", "if", "the", "named",...
train
https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/util/Environment.java#L263-L265
nostra13/Android-Universal-Image-Loader
library/src/main/java/com/nostra13/universalimageloader/core/ImageLoader.java
ImageLoader.displayImage
public void displayImage(String uri, ImageView imageView, DisplayImageOptions options, ImageLoadingListener listener) { """ Adds display image task to execution pool. Image will be set to ImageView when it's turn.<br /> <b>NOTE:</b> {@link #init(ImageLoaderConfiguration)} method must be called before this method call @param uri Image URI (i.e. "http://site.com/image.png", "file:///mnt/sdcard/image.png") @param imageView {@link ImageView} which should display image @param options {@linkplain com.nostra13.universalimageloader.core.DisplayImageOptions Options} for image decoding and displaying. If <b>null</b> - default display image options {@linkplain ImageLoaderConfiguration.Builder#defaultDisplayImageOptions(DisplayImageOptions) from configuration} will be used. @param listener {@linkplain ImageLoadingListener Listener} for image loading process. Listener fires events on UI thread if this method is called on UI thread. @throws IllegalStateException if {@link #init(ImageLoaderConfiguration)} method wasn't called before @throws IllegalArgumentException if passed <b>imageView</b> is null """ displayImage(uri, imageView, options, listener, null); }
java
public void displayImage(String uri, ImageView imageView, DisplayImageOptions options, ImageLoadingListener listener) { displayImage(uri, imageView, options, listener, null); }
[ "public", "void", "displayImage", "(", "String", "uri", ",", "ImageView", "imageView", ",", "DisplayImageOptions", "options", ",", "ImageLoadingListener", "listener", ")", "{", "displayImage", "(", "uri", ",", "imageView", ",", "options", ",", "listener", ",", "...
Adds display image task to execution pool. Image will be set to ImageView when it's turn.<br /> <b>NOTE:</b> {@link #init(ImageLoaderConfiguration)} method must be called before this method call @param uri Image URI (i.e. "http://site.com/image.png", "file:///mnt/sdcard/image.png") @param imageView {@link ImageView} which should display image @param options {@linkplain com.nostra13.universalimageloader.core.DisplayImageOptions Options} for image decoding and displaying. If <b>null</b> - default display image options {@linkplain ImageLoaderConfiguration.Builder#defaultDisplayImageOptions(DisplayImageOptions) from configuration} will be used. @param listener {@linkplain ImageLoadingListener Listener} for image loading process. Listener fires events on UI thread if this method is called on UI thread. @throws IllegalStateException if {@link #init(ImageLoaderConfiguration)} method wasn't called before @throws IllegalArgumentException if passed <b>imageView</b> is null
[ "Adds", "display", "image", "task", "to", "execution", "pool", ".", "Image", "will", "be", "set", "to", "ImageView", "when", "it", "s", "turn", ".", "<br", "/", ">", "<b", ">", "NOTE", ":", "<", "/", "b", ">", "{", "@link", "#init", "(", "ImageLoad...
train
https://github.com/nostra13/Android-Universal-Image-Loader/blob/fc3c5f6779bb4f702e233653b61bd9d559e345cc/library/src/main/java/com/nostra13/universalimageloader/core/ImageLoader.java#L383-L386
soi-toolkit/soi-toolkit-mule
commons/components/commons-mule/src/main/java/org/soitoolkit/commons/mule/monitor/MonitorEndpointHelper.java
MonitorEndpointHelper.pingJmsBackoutQueue
public static String pingJmsBackoutQueue(MuleContext muleContext, String queueName) { """ Verify access to a JMS backout queue by browsing the backout queue and ensure that no messages exists. @param queueName @return """ return pingJmsBackoutQueue(muleContext, DEFAULT_MULE_JMS_CONNECTOR, queueName); }
java
public static String pingJmsBackoutQueue(MuleContext muleContext, String queueName) { return pingJmsBackoutQueue(muleContext, DEFAULT_MULE_JMS_CONNECTOR, queueName); }
[ "public", "static", "String", "pingJmsBackoutQueue", "(", "MuleContext", "muleContext", ",", "String", "queueName", ")", "{", "return", "pingJmsBackoutQueue", "(", "muleContext", ",", "DEFAULT_MULE_JMS_CONNECTOR", ",", "queueName", ")", ";", "}" ]
Verify access to a JMS backout queue by browsing the backout queue and ensure that no messages exists. @param queueName @return
[ "Verify", "access", "to", "a", "JMS", "backout", "queue", "by", "browsing", "the", "backout", "queue", "and", "ensure", "that", "no", "messages", "exists", "." ]
train
https://github.com/soi-toolkit/soi-toolkit-mule/blob/e891350dbf55e6307be94d193d056bdb785b37d3/commons/components/commons-mule/src/main/java/org/soitoolkit/commons/mule/monitor/MonitorEndpointHelper.java#L142-L144
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/alg/geo/PerspectiveOps.java
PerspectiveOps.convertPixelToNorm
public static Point2D_F64 convertPixelToNorm( DMatrixRMaj K , Point2D_F64 pixel , Point2D_F64 norm ) { """ <p> Convenient function for converting from original image pixel coordinate to normalized< image coordinates. If speed is a concern then {@link PinholePtoN_F64} should be used instead. </p> NOTE: norm and pixel can be the same instance. @param K Intrinsic camera calibration matrix @param pixel Pixel coordinate. @param norm Optional storage for output. If null a new instance will be declared. @return normalized image coordinate """ return ImplPerspectiveOps_F64.convertPixelToNorm(K, pixel, norm); }
java
public static Point2D_F64 convertPixelToNorm( DMatrixRMaj K , Point2D_F64 pixel , Point2D_F64 norm ) { return ImplPerspectiveOps_F64.convertPixelToNorm(K, pixel, norm); }
[ "public", "static", "Point2D_F64", "convertPixelToNorm", "(", "DMatrixRMaj", "K", ",", "Point2D_F64", "pixel", ",", "Point2D_F64", "norm", ")", "{", "return", "ImplPerspectiveOps_F64", ".", "convertPixelToNorm", "(", "K", ",", "pixel", ",", "norm", ")", ";", "}"...
<p> Convenient function for converting from original image pixel coordinate to normalized< image coordinates. If speed is a concern then {@link PinholePtoN_F64} should be used instead. </p> NOTE: norm and pixel can be the same instance. @param K Intrinsic camera calibration matrix @param pixel Pixel coordinate. @param norm Optional storage for output. If null a new instance will be declared. @return normalized image coordinate
[ "<p", ">", "Convenient", "function", "for", "converting", "from", "original", "image", "pixel", "coordinate", "to", "normalized<", "image", "coordinates", ".", "If", "speed", "is", "a", "concern", "then", "{", "@link", "PinholePtoN_F64", "}", "should", "be", "...
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/PerspectiveOps.java#L479-L481
lucee/Lucee
core/src/main/java/lucee/transformer/library/function/FunctionLibFactory.java
FunctionLibFactory.loadFromSystem
public static FunctionLib[] loadFromSystem(Identification id) throws FunctionLibException { """ Laedt die Systeminterne FLD. @param saxParser Definition des Sax Parser mit dem die FunctionLib eingelsesen werden soll. @return FunctionLib @throws FunctionLibException """ if (systemFLDs[CFMLEngine.DIALECT_CFML] == null) { FunctionLib cfml = new FunctionLibFactory(null, FLD_BASE, id, true).getLib(); FunctionLib lucee = cfml.duplicate(false); systemFLDs[CFMLEngine.DIALECT_CFML] = new FunctionLibFactory(cfml, FLD_CFML, id, true).getLib(); systemFLDs[CFMLEngine.DIALECT_LUCEE] = new FunctionLibFactory(lucee, FLD_LUCEE, id, true).getLib(); } return systemFLDs; }
java
public static FunctionLib[] loadFromSystem(Identification id) throws FunctionLibException { if (systemFLDs[CFMLEngine.DIALECT_CFML] == null) { FunctionLib cfml = new FunctionLibFactory(null, FLD_BASE, id, true).getLib(); FunctionLib lucee = cfml.duplicate(false); systemFLDs[CFMLEngine.DIALECT_CFML] = new FunctionLibFactory(cfml, FLD_CFML, id, true).getLib(); systemFLDs[CFMLEngine.DIALECT_LUCEE] = new FunctionLibFactory(lucee, FLD_LUCEE, id, true).getLib(); } return systemFLDs; }
[ "public", "static", "FunctionLib", "[", "]", "loadFromSystem", "(", "Identification", "id", ")", "throws", "FunctionLibException", "{", "if", "(", "systemFLDs", "[", "CFMLEngine", ".", "DIALECT_CFML", "]", "==", "null", ")", "{", "FunctionLib", "cfml", "=", "n...
Laedt die Systeminterne FLD. @param saxParser Definition des Sax Parser mit dem die FunctionLib eingelsesen werden soll. @return FunctionLib @throws FunctionLibException
[ "Laedt", "die", "Systeminterne", "FLD", "." ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/transformer/library/function/FunctionLibFactory.java#L410-L418
EXIficient/exificient-core
src/main/java/com/siemens/ct/exi/core/values/DateTimeValue.java
DateTimeValue.parse
public static DateTimeValue parse(Calendar cal, DateTimeType type) { """ Encode Date-Time as a sequence of values representing the individual components of the Date-Time. @param cal calendar @param type date-time type @return date-time value """ int sYear = 0; int sMonthDay = 0; int sTime = 0; int sFractionalSecs = 0; boolean sPresenceTimezone = false; int sTimezone; switch (type) { case gYear: // gYear Year, [Time-Zone] case gYearMonth: // gYearMonth Year, MonthDay, [TimeZone] case date: // date Year, MonthDay, [TimeZone] sYear = cal.get(Calendar.YEAR); sMonthDay = getMonthDay(cal); break; case dateTime: // dateTime Year, MonthDay, Time, [FractionalSecs], // [TimeZone] sYear = cal.get(Calendar.YEAR); sMonthDay = getMonthDay(cal); // Note: *no* break; case time: // time Time, [FractionalSecs], [TimeZone] sTime = getTime(cal); sFractionalSecs = cal.get(Calendar.MILLISECOND); break; case gMonth: // gMonth MonthDay, [TimeZone] case gMonthDay: // gMonthDay MonthDay, [TimeZone] case gDay: // gDay MonthDay, [TimeZone] sMonthDay = getMonthDay(cal); break; default: throw new UnsupportedOperationException(); } // [TimeZone] sTimezone = getTimeZoneInMinutesOffset(cal); if (sTimezone != 0) { sPresenceTimezone = true; } return new DateTimeValue(type, sYear, sMonthDay, sTime, sFractionalSecs, sPresenceTimezone, sTimezone); }
java
public static DateTimeValue parse(Calendar cal, DateTimeType type) { int sYear = 0; int sMonthDay = 0; int sTime = 0; int sFractionalSecs = 0; boolean sPresenceTimezone = false; int sTimezone; switch (type) { case gYear: // gYear Year, [Time-Zone] case gYearMonth: // gYearMonth Year, MonthDay, [TimeZone] case date: // date Year, MonthDay, [TimeZone] sYear = cal.get(Calendar.YEAR); sMonthDay = getMonthDay(cal); break; case dateTime: // dateTime Year, MonthDay, Time, [FractionalSecs], // [TimeZone] sYear = cal.get(Calendar.YEAR); sMonthDay = getMonthDay(cal); // Note: *no* break; case time: // time Time, [FractionalSecs], [TimeZone] sTime = getTime(cal); sFractionalSecs = cal.get(Calendar.MILLISECOND); break; case gMonth: // gMonth MonthDay, [TimeZone] case gMonthDay: // gMonthDay MonthDay, [TimeZone] case gDay: // gDay MonthDay, [TimeZone] sMonthDay = getMonthDay(cal); break; default: throw new UnsupportedOperationException(); } // [TimeZone] sTimezone = getTimeZoneInMinutesOffset(cal); if (sTimezone != 0) { sPresenceTimezone = true; } return new DateTimeValue(type, sYear, sMonthDay, sTime, sFractionalSecs, sPresenceTimezone, sTimezone); }
[ "public", "static", "DateTimeValue", "parse", "(", "Calendar", "cal", ",", "DateTimeType", "type", ")", "{", "int", "sYear", "=", "0", ";", "int", "sMonthDay", "=", "0", ";", "int", "sTime", "=", "0", ";", "int", "sFractionalSecs", "=", "0", ";", "bool...
Encode Date-Time as a sequence of values representing the individual components of the Date-Time. @param cal calendar @param type date-time type @return date-time value
[ "Encode", "Date", "-", "Time", "as", "a", "sequence", "of", "values", "representing", "the", "individual", "components", "of", "the", "Date", "-", "Time", "." ]
train
https://github.com/EXIficient/exificient-core/blob/b6026c5fd39e9cc3d7874caa20f084e264e0ddc7/src/main/java/com/siemens/ct/exi/core/values/DateTimeValue.java#L365-L406
flow/commons
src/main/java/com/flowpowered/commons/typechecker/TypeChecker.java
TypeChecker.tMap
public static <K, V> TypeChecker<Map<? extends K, ? extends V>> tMap(TypeChecker<? extends K> keyChecker, Class<? extends V> valueType) { """ Creates a recursing type checker for a {@link java.util.Map}. @param keyChecker The typechecker to check the keys with @param valueType The typechecker to check the values with @return a typechecker for a Map containing keys passing the specified type checker and values of the specified type """ return tMap(keyChecker, tSimple(valueType)); }
java
public static <K, V> TypeChecker<Map<? extends K, ? extends V>> tMap(TypeChecker<? extends K> keyChecker, Class<? extends V> valueType) { return tMap(keyChecker, tSimple(valueType)); }
[ "public", "static", "<", "K", ",", "V", ">", "TypeChecker", "<", "Map", "<", "?", "extends", "K", ",", "?", "extends", "V", ">", ">", "tMap", "(", "TypeChecker", "<", "?", "extends", "K", ">", "keyChecker", ",", "Class", "<", "?", "extends", "V", ...
Creates a recursing type checker for a {@link java.util.Map}. @param keyChecker The typechecker to check the keys with @param valueType The typechecker to check the values with @return a typechecker for a Map containing keys passing the specified type checker and values of the specified type
[ "Creates", "a", "recursing", "type", "checker", "for", "a", "{", "@link", "java", ".", "util", ".", "Map", "}", "." ]
train
https://github.com/flow/commons/blob/0690efdac06fd728fcd7e9cf10f2b1319379c45b/src/main/java/com/flowpowered/commons/typechecker/TypeChecker.java#L216-L218
JOML-CI/JOML
src/org/joml/Matrix4d.java
Matrix4d.rotateLocalZ
public Matrix4d rotateLocalZ(double ang, Matrix4d dest) { """ Pre-multiply a rotation around the Z axis to this matrix by rotating the given amount of radians about the Z axis and store the result in <code>dest</code>. <p> When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise. <p> If <code>M</code> is <code>this</code> matrix and <code>R</code> the rotation matrix, then the new matrix will be <code>R * M</code>. So when transforming a vector <code>v</code> with the new matrix by using <code>R * M * v</code>, the rotation will be applied last! <p> In order to set the matrix to a rotation matrix without pre-multiplying the rotation transformation, use {@link #rotationZ(double) rotationZ()}. <p> Reference: <a href="http://en.wikipedia.org/wiki/Rotation_matrix#Rotation_matrix_from_axis_and_angle">http://en.wikipedia.org</a> @see #rotationZ(double) @param ang the angle in radians to rotate about the Z axis @param dest will hold the result @return dest """ double sin = Math.sin(ang); double cos = Math.cosFromSin(sin, ang); double nm00 = cos * m00 - sin * m01; double nm01 = sin * m00 + cos * m01; double nm10 = cos * m10 - sin * m11; double nm11 = sin * m10 + cos * m11; double nm20 = cos * m20 - sin * m21; double nm21 = sin * m20 + cos * m21; double nm30 = cos * m30 - sin * m31; double nm31 = sin * m30 + cos * m31; dest.m00 = nm00; dest.m01 = nm01; dest.m02 = m02; dest.m03 = m03; dest.m10 = nm10; dest.m11 = nm11; dest.m12 = m12; dest.m13 = m13; dest.m20 = nm20; dest.m21 = nm21; dest.m22 = m22; dest.m23 = m23; dest.m30 = nm30; dest.m31 = nm31; dest.m32 = m32; dest.m33 = m33; dest.properties = properties & ~(PROPERTY_PERSPECTIVE | PROPERTY_IDENTITY | PROPERTY_TRANSLATION); return dest; }
java
public Matrix4d rotateLocalZ(double ang, Matrix4d dest) { double sin = Math.sin(ang); double cos = Math.cosFromSin(sin, ang); double nm00 = cos * m00 - sin * m01; double nm01 = sin * m00 + cos * m01; double nm10 = cos * m10 - sin * m11; double nm11 = sin * m10 + cos * m11; double nm20 = cos * m20 - sin * m21; double nm21 = sin * m20 + cos * m21; double nm30 = cos * m30 - sin * m31; double nm31 = sin * m30 + cos * m31; dest.m00 = nm00; dest.m01 = nm01; dest.m02 = m02; dest.m03 = m03; dest.m10 = nm10; dest.m11 = nm11; dest.m12 = m12; dest.m13 = m13; dest.m20 = nm20; dest.m21 = nm21; dest.m22 = m22; dest.m23 = m23; dest.m30 = nm30; dest.m31 = nm31; dest.m32 = m32; dest.m33 = m33; dest.properties = properties & ~(PROPERTY_PERSPECTIVE | PROPERTY_IDENTITY | PROPERTY_TRANSLATION); return dest; }
[ "public", "Matrix4d", "rotateLocalZ", "(", "double", "ang", ",", "Matrix4d", "dest", ")", "{", "double", "sin", "=", "Math", ".", "sin", "(", "ang", ")", ";", "double", "cos", "=", "Math", ".", "cosFromSin", "(", "sin", ",", "ang", ")", ";", "double"...
Pre-multiply a rotation around the Z axis to this matrix by rotating the given amount of radians about the Z axis and store the result in <code>dest</code>. <p> When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise. <p> If <code>M</code> is <code>this</code> matrix and <code>R</code> the rotation matrix, then the new matrix will be <code>R * M</code>. So when transforming a vector <code>v</code> with the new matrix by using <code>R * M * v</code>, the rotation will be applied last! <p> In order to set the matrix to a rotation matrix without pre-multiplying the rotation transformation, use {@link #rotationZ(double) rotationZ()}. <p> Reference: <a href="http://en.wikipedia.org/wiki/Rotation_matrix#Rotation_matrix_from_axis_and_angle">http://en.wikipedia.org</a> @see #rotationZ(double) @param ang the angle in radians to rotate about the Z axis @param dest will hold the result @return dest
[ "Pre", "-", "multiply", "a", "rotation", "around", "the", "Z", "axis", "to", "this", "matrix", "by", "rotating", "the", "given", "amount", "of", "radians", "about", "the", "Z", "axis", "and", "store", "the", "result", "in", "<code", ">", "dest<", "/", ...
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4d.java#L5926-L5955
lucmoreau/ProvToolbox
prov-model/src/main/java/org/openprovenance/prov/model/ProvFactory.java
ProvFactory.newEntry
public Entry newEntry(Key key, QualifiedName entity) { """ Factory method for Key-entity entries. Key-entity entries are used to identify the members of a dictionary. @param key indexing the entity in the dictionary @param entity a {@link QualifiedName} denoting an entity @return an instance of {@link Entry} """ Entry res = of.createEntry(); res.setKey(key); res.setEntity(entity); return res; }
java
public Entry newEntry(Key key, QualifiedName entity) { Entry res = of.createEntry(); res.setKey(key); res.setEntity(entity); return res; }
[ "public", "Entry", "newEntry", "(", "Key", "key", ",", "QualifiedName", "entity", ")", "{", "Entry", "res", "=", "of", ".", "createEntry", "(", ")", ";", "res", ".", "setKey", "(", "key", ")", ";", "res", ".", "setEntity", "(", "entity", ")", ";", ...
Factory method for Key-entity entries. Key-entity entries are used to identify the members of a dictionary. @param key indexing the entity in the dictionary @param entity a {@link QualifiedName} denoting an entity @return an instance of {@link Entry}
[ "Factory", "method", "for", "Key", "-", "entity", "entries", ".", "Key", "-", "entity", "entries", "are", "used", "to", "identify", "the", "members", "of", "a", "dictionary", "." ]
train
https://github.com/lucmoreau/ProvToolbox/blob/f865952868ffb69432937b08728c86bebbe4678a/prov-model/src/main/java/org/openprovenance/prov/model/ProvFactory.java#L661-L666
datasift/datasift-java
src/main/java/com/datasift/client/FutureData.java
FutureData.sync
public T sync() { """ /* Forces the client to wait until a response is received before returning @return a result instance - if an interrupt exception is thrown it is possible that a response isn't available yet the user must check to ensure null isn't returned """ //if data is present there's no need to block if (data != null) { return data; } synchronized (this) { try { // wait(); block.take(); } catch (InterruptedException e) { if (interruptCause == null) { interruptCause = e; } } if (interruptCause != null) { if (interruptCause instanceof DataSiftException) { throw (DataSiftException) interruptCause; } else { throw new DataSiftException("Interrupted while waiting for response", interruptCause); } } return data; } }
java
public T sync() { //if data is present there's no need to block if (data != null) { return data; } synchronized (this) { try { // wait(); block.take(); } catch (InterruptedException e) { if (interruptCause == null) { interruptCause = e; } } if (interruptCause != null) { if (interruptCause instanceof DataSiftException) { throw (DataSiftException) interruptCause; } else { throw new DataSiftException("Interrupted while waiting for response", interruptCause); } } return data; } }
[ "public", "T", "sync", "(", ")", "{", "//if data is present there's no need to block", "if", "(", "data", "!=", "null", ")", "{", "return", "data", ";", "}", "synchronized", "(", "this", ")", "{", "try", "{", "// wait();", "block", ".", "take", "(", ")", ...
/* Forces the client to wait until a response is received before returning @return a result instance - if an interrupt exception is thrown it is possible that a response isn't available yet the user must check to ensure null isn't returned
[ "/", "*", "Forces", "the", "client", "to", "wait", "until", "a", "response", "is", "received", "before", "returning" ]
train
https://github.com/datasift/datasift-java/blob/09de124f2a1a507ff6181e59875c6f325290850e/src/main/java/com/datasift/client/FutureData.java#L89-L112
nmorel/gwt-jackson
gwt-jackson/src/main/java/com/github/nmorel/gwtjackson/client/JsonSerializationContext.java
JsonSerializationContext.addObjectId
public void addObjectId( Object object, ObjectIdSerializer<?> id ) { """ <p>addObjectId</p> @param object a {@link java.lang.Object} object. @param id a {@link com.github.nmorel.gwtjackson.client.ser.bean.ObjectIdSerializer} object. """ if ( null == mapObjectId ) { if ( useEqualityForObjectId ) { mapObjectId = new HashMap<Object, ObjectIdSerializer<?>>(); } else { mapObjectId = new IdentityHashMap<Object, ObjectIdSerializer<?>>(); } } mapObjectId.put( object, id ); }
java
public void addObjectId( Object object, ObjectIdSerializer<?> id ) { if ( null == mapObjectId ) { if ( useEqualityForObjectId ) { mapObjectId = new HashMap<Object, ObjectIdSerializer<?>>(); } else { mapObjectId = new IdentityHashMap<Object, ObjectIdSerializer<?>>(); } } mapObjectId.put( object, id ); }
[ "public", "void", "addObjectId", "(", "Object", "object", ",", "ObjectIdSerializer", "<", "?", ">", "id", ")", "{", "if", "(", "null", "==", "mapObjectId", ")", "{", "if", "(", "useEqualityForObjectId", ")", "{", "mapObjectId", "=", "new", "HashMap", "<", ...
<p>addObjectId</p> @param object a {@link java.lang.Object} object. @param id a {@link com.github.nmorel.gwtjackson.client.ser.bean.ObjectIdSerializer} object.
[ "<p", ">", "addObjectId<", "/", "p", ">" ]
train
https://github.com/nmorel/gwt-jackson/blob/3fdc4350a27a9b64fc437d5fe516bf9191b74824/gwt-jackson/src/main/java/com/github/nmorel/gwtjackson/client/JsonSerializationContext.java#L574-L583
jbundle/jbundle
app/program/project/src/main/java/org/jbundle/app/program/project/report/ProjectReportScreen.java
ProjectReportScreen.getNextGridRecord
public Record getNextGridRecord(boolean bFirstTime) throws DBException { """ Get the next grid record. @param bFirstTime If true, I want the first record. @return the next record (or null if EOF). """ Record record = this.getMainRecord(); Record recNew = null; if (bFirstTime) { String mainString = this.getScreenRecord().getField(ProjectTaskScreenRecord.PROJECT_TASK_ID).toString(); recNew = this.getCurrentLevelInfo(+0, record); recNew.addListener(new StringSubFileFilter(mainString, ProjectTask.PARENT_PROJECT_TASK_ID, null, null, null, null)); } else { // See if there are any sub-records to the last valid record recNew = this.getCurrentLevelInfo(+1, record); String mainString = record.getCounterField().toString(); if (recNew.getListener(StringSubFileFilter.class) == null) recNew.addListener(new StringSubFileFilter(mainString, ProjectTask.PARENT_PROJECT_TASK_ID, null, null, null, null)); } boolean bHasNext = recNew.hasNext(); if (!bHasNext) { int dLevel = (int)this.getScreenRecord().getField(ProjectTaskScreenRecord.CURRENT_LEVEL).getValue(); if (dLevel == 0) return null; // All done Record recTemp = this.getCurrentLevelInfo(+0, record); recTemp.removeListener(recTemp.getListener(StringSubFileFilter.class), true); recTemp.close(); dLevel = dLevel - 2; // Since it is incremented next time this.getScreenRecord().getField(ProjectTaskScreenRecord.CURRENT_LEVEL).setValue(dLevel); return this.getNextGridRecord(false); } Record recNext = (Record)recNew.next(); record.moveFields(recNext, null, true, DBConstants.SCREEN_MOVE, false, false, false, false); return record; }
java
public Record getNextGridRecord(boolean bFirstTime) throws DBException { Record record = this.getMainRecord(); Record recNew = null; if (bFirstTime) { String mainString = this.getScreenRecord().getField(ProjectTaskScreenRecord.PROJECT_TASK_ID).toString(); recNew = this.getCurrentLevelInfo(+0, record); recNew.addListener(new StringSubFileFilter(mainString, ProjectTask.PARENT_PROJECT_TASK_ID, null, null, null, null)); } else { // See if there are any sub-records to the last valid record recNew = this.getCurrentLevelInfo(+1, record); String mainString = record.getCounterField().toString(); if (recNew.getListener(StringSubFileFilter.class) == null) recNew.addListener(new StringSubFileFilter(mainString, ProjectTask.PARENT_PROJECT_TASK_ID, null, null, null, null)); } boolean bHasNext = recNew.hasNext(); if (!bHasNext) { int dLevel = (int)this.getScreenRecord().getField(ProjectTaskScreenRecord.CURRENT_LEVEL).getValue(); if (dLevel == 0) return null; // All done Record recTemp = this.getCurrentLevelInfo(+0, record); recTemp.removeListener(recTemp.getListener(StringSubFileFilter.class), true); recTemp.close(); dLevel = dLevel - 2; // Since it is incremented next time this.getScreenRecord().getField(ProjectTaskScreenRecord.CURRENT_LEVEL).setValue(dLevel); return this.getNextGridRecord(false); } Record recNext = (Record)recNew.next(); record.moveFields(recNext, null, true, DBConstants.SCREEN_MOVE, false, false, false, false); return record; }
[ "public", "Record", "getNextGridRecord", "(", "boolean", "bFirstTime", ")", "throws", "DBException", "{", "Record", "record", "=", "this", ".", "getMainRecord", "(", ")", ";", "Record", "recNew", "=", "null", ";", "if", "(", "bFirstTime", ")", "{", "String",...
Get the next grid record. @param bFirstTime If true, I want the first record. @return the next record (or null if EOF).
[ "Get", "the", "next", "grid", "record", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/project/src/main/java/org/jbundle/app/program/project/report/ProjectReportScreen.java#L122-L155
tminglei/form-binder-java
src/main/java/com/github/tminglei/bind/Mappings.java
Mappings.bigInt
public static Mapping<BigInteger> bigInt(Constraint... constraints) { """ (convert to BigInteger) mapping @param constraints constraints @return new created mapping """ return new FieldMapping( InputMode.SINGLE, mkSimpleConverter(s -> isEmptyStr(s) ? BigInteger.ZERO : new BigInteger(s) ), new MappingMeta(MAPPING_BIG_INTEGER, BigInteger.class) ).constraint(checking(BigInteger::new, "error.bigint", true)) .constraint(constraints); }
java
public static Mapping<BigInteger> bigInt(Constraint... constraints) { return new FieldMapping( InputMode.SINGLE, mkSimpleConverter(s -> isEmptyStr(s) ? BigInteger.ZERO : new BigInteger(s) ), new MappingMeta(MAPPING_BIG_INTEGER, BigInteger.class) ).constraint(checking(BigInteger::new, "error.bigint", true)) .constraint(constraints); }
[ "public", "static", "Mapping", "<", "BigInteger", ">", "bigInt", "(", "Constraint", "...", "constraints", ")", "{", "return", "new", "FieldMapping", "(", "InputMode", ".", "SINGLE", ",", "mkSimpleConverter", "(", "s", "->", "isEmptyStr", "(", "s", ")", "?", ...
(convert to BigInteger) mapping @param constraints constraints @return new created mapping
[ "(", "convert", "to", "BigInteger", ")", "mapping" ]
train
https://github.com/tminglei/form-binder-java/blob/4c0bd1e8f81ae56b21142bb525ee6b4deb7f92ab/src/main/java/com/github/tminglei/bind/Mappings.java#L137-L145
RestComm/jdiameter
core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/helpers/IPConverter.java
IPConverter.InetAddressByIPv4
public static InetAddress InetAddressByIPv4(String address) { """ Convert defined string to IPv4 object instance @param address string representation of ip address @return IPv4 object instance """ StringTokenizer addressTokens = new StringTokenizer(address, "."); byte[] bytes; if (addressTokens.countTokens() == 4) { bytes = new byte[]{ getByBytes(addressTokens), getByBytes(addressTokens), getByBytes(addressTokens), getByBytes(addressTokens) }; } else { return null; } try { return InetAddress.getByAddress(bytes); } catch (UnknownHostException e) { return null; } }
java
public static InetAddress InetAddressByIPv4(String address) { StringTokenizer addressTokens = new StringTokenizer(address, "."); byte[] bytes; if (addressTokens.countTokens() == 4) { bytes = new byte[]{ getByBytes(addressTokens), getByBytes(addressTokens), getByBytes(addressTokens), getByBytes(addressTokens) }; } else { return null; } try { return InetAddress.getByAddress(bytes); } catch (UnknownHostException e) { return null; } }
[ "public", "static", "InetAddress", "InetAddressByIPv4", "(", "String", "address", ")", "{", "StringTokenizer", "addressTokens", "=", "new", "StringTokenizer", "(", "address", ",", "\".\"", ")", ";", "byte", "[", "]", "bytes", ";", "if", "(", "addressTokens", "...
Convert defined string to IPv4 object instance @param address string representation of ip address @return IPv4 object instance
[ "Convert", "defined", "string", "to", "IPv4", "object", "instance" ]
train
https://github.com/RestComm/jdiameter/blob/672134c378ea9704bf06dbe1985872ad4ebf4640/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/helpers/IPConverter.java#L63-L83
adminfaces/admin-persistence
src/main/java/com/github/adminfaces/persistence/service/CrudService.java
CrudService.exampleLike
public Criteria exampleLike(T example, SingularAttribute<T, String>... usingAttributes) { """ A 'criteria by example' will be created using an example entity. ONLY <code>String</code> attributes will be considered. It will use 'likeIgnoreCase' for comparing STRING attributes of the example entity. @param example An entity whose attribute's value will be used for creating a criteria @param usingAttributes attributes from example entity to consider. @return A criteria restricted by example using 'likeIgnoreCase' for comparing attributes @throws RuntimeException If no attribute is provided. """ return exampleLike(criteria(), example, usingAttributes); }
java
public Criteria exampleLike(T example, SingularAttribute<T, String>... usingAttributes) { return exampleLike(criteria(), example, usingAttributes); }
[ "public", "Criteria", "exampleLike", "(", "T", "example", ",", "SingularAttribute", "<", "T", ",", "String", ">", "...", "usingAttributes", ")", "{", "return", "exampleLike", "(", "criteria", "(", ")", ",", "example", ",", "usingAttributes", ")", ";", "}" ]
A 'criteria by example' will be created using an example entity. ONLY <code>String</code> attributes will be considered. It will use 'likeIgnoreCase' for comparing STRING attributes of the example entity. @param example An entity whose attribute's value will be used for creating a criteria @param usingAttributes attributes from example entity to consider. @return A criteria restricted by example using 'likeIgnoreCase' for comparing attributes @throws RuntimeException If no attribute is provided.
[ "A", "criteria", "by", "example", "will", "be", "created", "using", "an", "example", "entity", ".", "ONLY", "<code", ">", "String<", "/", "code", ">", "attributes", "will", "be", "considered", ".", "It", "will", "use", "likeIgnoreCase", "for", "comparing", ...
train
https://github.com/adminfaces/admin-persistence/blob/fe065eed73781d01f14a4eb11910acc6a4150b9e/src/main/java/com/github/adminfaces/persistence/service/CrudService.java#L314-L316
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/misc/FDBigInteger.java
FDBigInteger.mult
private static void mult(int[] s1, int s1Len, int[] s2, int s2Len, int[] dst) { """ /*@ @ requires s1 != dst && s2 != dst; @ requires s1.length >= s1Len && s2.length >= s2Len && dst.length >= s1Len + s2Len; @ assignable dst[0 .. s1Len + s2Len - 1]; @ ensures AP(dst, s1Len + s2Len) == \old(AP(s1, s1Len) * AP(s2, s2Len)); @ """ for (int i = 0; i < s1Len; i++) { long v = s1[i] & LONG_MASK; long p = 0L; for (int j = 0; j < s2Len; j++) { p += (dst[i + j] & LONG_MASK) + v * (s2[j] & LONG_MASK); dst[i + j] = (int) p; p >>>= 32; } dst[i + s2Len] = (int) p; } }
java
private static void mult(int[] s1, int s1Len, int[] s2, int s2Len, int[] dst) { for (int i = 0; i < s1Len; i++) { long v = s1[i] & LONG_MASK; long p = 0L; for (int j = 0; j < s2Len; j++) { p += (dst[i + j] & LONG_MASK) + v * (s2[j] & LONG_MASK); dst[i + j] = (int) p; p >>>= 32; } dst[i + s2Len] = (int) p; } }
[ "private", "static", "void", "mult", "(", "int", "[", "]", "s1", ",", "int", "s1Len", ",", "int", "[", "]", "s2", ",", "int", "s2Len", ",", "int", "[", "]", "dst", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "s1Len", ";", "i"...
/*@ @ requires s1 != dst && s2 != dst; @ requires s1.length >= s1Len && s2.length >= s2Len && dst.length >= s1Len + s2Len; @ assignable dst[0 .. s1Len + s2Len - 1]; @ ensures AP(dst, s1Len + s2Len) == \old(AP(s1, s1Len) * AP(s2, s2Len)); @
[ "/", "*" ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/misc/FDBigInteger.java#L745-L756
maddingo/sojo
src/main/java/net/sf/sojo/core/ConversionIterator.java
ConversionIterator.fireBeforeConvertRecursion
private ConversionContext fireBeforeConvertRecursion(int pvNumberOfIteration, Object pvKey, Object pvValue) { """ Create a new ConversionContext and fire "before convert recursion" event. @param pvNumberOfIteration Counter for the number of recursion. @param pvKey The key can be the key by the <code>Map</code> or the property name by a JavaBean. @param pvValue The value is the map-value or the value in a list or the property-value from a JavaBean. @return New ConversionContext. """ ConversionContext lvContext = new ConversionContext(pvNumberOfIteration, pvKey, pvValue); getConverterInterceptorHandler().fireBeforeConvertRecursion(lvContext); return lvContext; }
java
private ConversionContext fireBeforeConvertRecursion(int pvNumberOfIteration, Object pvKey, Object pvValue) { ConversionContext lvContext = new ConversionContext(pvNumberOfIteration, pvKey, pvValue); getConverterInterceptorHandler().fireBeforeConvertRecursion(lvContext); return lvContext; }
[ "private", "ConversionContext", "fireBeforeConvertRecursion", "(", "int", "pvNumberOfIteration", ",", "Object", "pvKey", ",", "Object", "pvValue", ")", "{", "ConversionContext", "lvContext", "=", "new", "ConversionContext", "(", "pvNumberOfIteration", ",", "pvKey", ",",...
Create a new ConversionContext and fire "before convert recursion" event. @param pvNumberOfIteration Counter for the number of recursion. @param pvKey The key can be the key by the <code>Map</code> or the property name by a JavaBean. @param pvValue The value is the map-value or the value in a list or the property-value from a JavaBean. @return New ConversionContext.
[ "Create", "a", "new", "ConversionContext", "and", "fire", "before", "convert", "recursion", "event", "." ]
train
https://github.com/maddingo/sojo/blob/99e9e0a146b502deb7f507fe0623227402ed675b/src/main/java/net/sf/sojo/core/ConversionIterator.java#L146-L150